2022-10-28 16:11:08 +00:00
|
|
|
import {makeT} from 'app/client/lib/localization';
|
2022-02-07 14:02:26 +00:00
|
|
|
import {reportError} from 'app/client/models/AppModel';
|
|
|
|
import {ColumnRec, DocModel, ViewSectionRec} from 'app/client/models/DocModel';
|
|
|
|
import {FilterInfo} from 'app/client/models/entities/ViewSectionRec';
|
|
|
|
import {CustomComputed} from 'app/client/models/modelUtil';
|
|
|
|
import {attachColumnFilterMenu} from 'app/client/ui/ColumnFilterMenu';
|
|
|
|
import {addFilterMenu} from 'app/client/ui/FilterBar';
|
|
|
|
import {hoverTooltip} from 'app/client/ui/tooltips';
|
|
|
|
import {makeViewLayoutMenu} from 'app/client/ui/ViewLayoutMenu';
|
|
|
|
import {basicButton, primaryButton} from 'app/client/ui2018/buttons';
|
2022-09-06 01:51:57 +00:00
|
|
|
import {theme, vars} from 'app/client/ui2018/cssVars';
|
2022-02-07 14:02:26 +00:00
|
|
|
import {icon} from 'app/client/ui2018/icons';
|
|
|
|
import {menu} from 'app/client/ui2018/menus';
|
|
|
|
import {Sort} from 'app/common/SortSpec';
|
|
|
|
import {Computed, dom, fromKo, IDisposableOwner, makeTestId, Observable, styled} from 'grainjs';
|
|
|
|
import {PopupControl} from 'popweasel';
|
2020-10-02 15:10:00 +00:00
|
|
|
import difference = require('lodash/difference');
|
|
|
|
|
|
|
|
const testId = makeTestId('test-section-menu-');
|
2022-10-28 16:11:08 +00:00
|
|
|
const t = makeT('ViewSectionMenu');
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2022-01-12 13:30:51 +00:00
|
|
|
// Handler for [Save] button.
|
2021-04-30 17:28:52 +00:00
|
|
|
async function doSave(docModel: DocModel, viewSection: ViewSectionRec): Promise<void> {
|
2022-10-28 16:11:08 +00:00
|
|
|
await docModel.docData.bundleActions(t("UpdateSortFilterSettings"), () => Promise.all([
|
2022-01-12 13:30:51 +00:00
|
|
|
viewSection.activeSortJson.save(), // Save sort
|
|
|
|
viewSection.saveFilters(), // Save filter
|
|
|
|
viewSection.activeFilterBar.save(), // Save bar
|
|
|
|
viewSection.activeCustomOptions.save(), // Save widget options
|
2021-04-30 17:28:52 +00:00
|
|
|
]));
|
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2022-01-12 13:30:51 +00:00
|
|
|
// Handler for [Revert] button.
|
2021-04-30 17:28:52 +00:00
|
|
|
function doRevert(viewSection: ViewSectionRec) {
|
2022-01-12 13:30:51 +00:00
|
|
|
viewSection.activeSortJson.revert(); // Revert sort
|
|
|
|
viewSection.revertFilters(); // Revert filter
|
|
|
|
viewSection.activeFilterBar.revert(); // Revert bar
|
|
|
|
viewSection.activeCustomOptions.revert(); // Revert widget options
|
2021-04-30 17:28:52 +00:00
|
|
|
}
|
|
|
|
|
2022-01-12 13:30:51 +00:00
|
|
|
// [Filter Icon] (v) (x) - Filter toggle and all the components in the menu.
|
2021-04-30 17:28:52 +00:00
|
|
|
export function viewSectionMenu(owner: IDisposableOwner, docModel: DocModel, viewSection: ViewSectionRec,
|
2022-02-07 14:02:26 +00:00
|
|
|
isReadonly: Observable<boolean>) {
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2021-11-19 20:30:11 +00:00
|
|
|
const popupControls = new WeakMap<ColumnRec, PopupControl>();
|
2022-01-12 13:30:51 +00:00
|
|
|
|
|
|
|
// If there is any filter (should [Filter Icon] be green).
|
2021-11-19 20:30:11 +00:00
|
|
|
const anyFilter = Computed.create(owner, (use) => Boolean(use(viewSection.activeFilters).length));
|
2021-04-27 19:05:23 +00:00
|
|
|
|
2022-01-12 13:30:51 +00:00
|
|
|
// Should border be green, and should we show [Save] [Revert] (v) (x) buttons.
|
2021-04-30 17:28:52 +00:00
|
|
|
const displaySaveObs: Computed<boolean> = Computed.create(owner, (use) => (
|
|
|
|
use(viewSection.filterSpecChanged)
|
|
|
|
|| !use(viewSection.activeSortJson.isSaved)
|
|
|
|
|| !use(viewSection.activeFilterBar.isSaved)
|
2022-01-12 13:30:51 +00:00
|
|
|
|| !use(viewSection.activeCustomOptions.isSaved)
|
2021-04-30 17:28:52 +00:00
|
|
|
));
|
|
|
|
|
2021-05-06 12:23:50 +00:00
|
|
|
const save = () => { doSave(docModel, viewSection).catch(reportError); };
|
2021-04-30 17:28:52 +00:00
|
|
|
const revert = () => doRevert(viewSection);
|
|
|
|
|
|
|
|
return [
|
|
|
|
cssFilterMenuWrapper(
|
|
|
|
cssFixHeight.cls(''),
|
|
|
|
cssFilterMenuWrapper.cls('-unsaved', displaySaveObs),
|
|
|
|
testId('wrapper'),
|
|
|
|
cssMenu(
|
|
|
|
testId('sortAndFilter'),
|
2022-01-12 13:30:51 +00:00
|
|
|
// [Filter icon] grey or green
|
2021-04-30 17:28:52 +00:00
|
|
|
cssFilterIconWrapper(
|
|
|
|
testId('filter-icon'),
|
2022-01-12 13:30:51 +00:00
|
|
|
// Make green when there are some filters. If there are only sort options, leave grey.
|
2021-04-30 17:28:52 +00:00
|
|
|
cssFilterIconWrapper.cls('-any', anyFilter),
|
2022-10-19 23:06:05 +00:00
|
|
|
cssFilterIcon('Filter'),
|
|
|
|
hoverTooltip('Sort and filter', {key: 'sortFilterBtnTooltip'}),
|
2021-04-30 17:28:52 +00:00
|
|
|
),
|
2021-05-06 12:23:50 +00:00
|
|
|
menu(ctl => [
|
2022-01-12 13:30:51 +00:00
|
|
|
// Sorted by section.
|
2021-04-30 17:28:52 +00:00
|
|
|
dom.domComputed(use => {
|
|
|
|
use(viewSection.activeSortJson.isSaved); // Rebuild sort panel if sort gets saved. A little hacky.
|
|
|
|
return makeSortPanel(viewSection, use(viewSection.activeSortSpec),
|
|
|
|
(row: number) => docModel.columns.getRowModel(row));
|
|
|
|
}),
|
2022-01-12 13:30:51 +00:00
|
|
|
// Filtered by section.
|
2021-11-19 20:30:11 +00:00
|
|
|
dom.domComputed(viewSection.activeFilters, filters =>
|
|
|
|
makeFilterPanel(viewSection, filters, popupControls, () => ctl.close())),
|
2022-01-12 13:30:51 +00:00
|
|
|
// [+] Add filter
|
2021-04-30 17:28:52 +00:00
|
|
|
makeAddFilterButton(viewSection, popupControls),
|
2022-01-12 13:30:51 +00:00
|
|
|
// [+] Toggle filter bar
|
2022-02-07 14:02:26 +00:00
|
|
|
dom.maybe((use) => !use(viewSection.isRaw),
|
|
|
|
() => makeFilterBarToggle(viewSection.activeFilterBar)),
|
2022-01-12 13:30:51 +00:00
|
|
|
// Widget options
|
2022-02-08 15:23:14 +00:00
|
|
|
dom.maybe(use => use(viewSection.parentKey) === 'custom', () =>
|
2022-01-12 13:30:51 +00:00
|
|
|
makeCustomOptions(viewSection)
|
|
|
|
),
|
|
|
|
// [Save] [Revert] buttons
|
2021-04-30 17:28:52 +00:00
|
|
|
dom.domComputed(displaySaveObs, displaySave => [
|
2020-10-02 15:10:00 +00:00
|
|
|
displaySave ? cssMenuInfoHeader(
|
2022-10-28 16:11:08 +00:00
|
|
|
cssSaveButton(t('Save'), testId('btn-save'),
|
2021-05-06 12:23:50 +00:00
|
|
|
dom.on('click', () => { save(); ctl.close(); }),
|
2021-04-30 17:28:52 +00:00
|
|
|
dom.boolAttr('disabled', isReadonly)),
|
2022-10-28 16:11:08 +00:00
|
|
|
basicButton(t('Revert'), testId('btn-revert'),
|
2021-05-06 12:23:50 +00:00
|
|
|
dom.on('click', () => { revert(); ctl.close(); }))
|
2020-10-02 15:10:00 +00:00
|
|
|
) : null,
|
2021-04-30 17:28:52 +00:00
|
|
|
]),
|
|
|
|
]),
|
|
|
|
),
|
2022-01-12 13:30:51 +00:00
|
|
|
// Two icons (v) (x) left to the toggle, when there are unsaved filters or sort options.
|
|
|
|
// Those buttons are equivalent of the [Save] [Revert] buttons in the menu.
|
2021-04-30 17:28:52 +00:00
|
|
|
dom.maybe(displaySaveObs, () => cssSaveIconsWrapper(
|
2022-01-12 13:30:51 +00:00
|
|
|
// (v)
|
2021-04-30 17:28:52 +00:00
|
|
|
cssSmallIconWrapper(
|
|
|
|
cssIcon('Tick'), cssSmallIconWrapper.cls('-green'),
|
|
|
|
dom.on('click', save),
|
2022-10-19 23:06:05 +00:00
|
|
|
hoverTooltip('Save sort & filter settings', {key: 'sortFilterBtnTooltip'}),
|
2021-04-30 17:28:52 +00:00
|
|
|
testId('small-btn-save'),
|
2021-05-05 15:15:15 +00:00
|
|
|
dom.hide(isReadonly),
|
2021-04-30 17:28:52 +00:00
|
|
|
),
|
2022-01-12 13:30:51 +00:00
|
|
|
// (x)
|
2021-04-30 17:28:52 +00:00
|
|
|
cssSmallIconWrapper(
|
|
|
|
cssIcon('CrossSmall'), cssSmallIconWrapper.cls('-gray'),
|
|
|
|
dom.on('click', revert),
|
2022-10-19 23:06:05 +00:00
|
|
|
hoverTooltip('Revert sort & filter settings', {key: 'sortFilterBtnTooltip'}),
|
2021-04-30 17:28:52 +00:00
|
|
|
testId('small-btn-revert'),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
cssMenu(
|
|
|
|
testId('viewLayout'),
|
|
|
|
cssFixHeight.cls(''),
|
|
|
|
cssDotsIconWrapper(cssIcon('Dots')),
|
2022-02-07 14:02:26 +00:00
|
|
|
menu(_ctl => makeViewLayoutMenu(viewSection, isReadonly.get()))
|
2021-04-30 17:28:52 +00:00
|
|
|
)
|
|
|
|
];
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
|
2022-01-12 13:30:51 +00:00
|
|
|
// Sorted by section (and all columns underneath or (Default) label).
|
2021-11-03 11:44:28 +00:00
|
|
|
function makeSortPanel(section: ViewSectionRec, sortSpec: Sort.SortSpec, getColumn: (row: number) => ColumnRec) {
|
|
|
|
const changedColumns = difference(sortSpec, Sort.parseSortColRefs(section.sortColRefs.peek()));
|
|
|
|
const sortColumns = sortSpec.map(colSpec => {
|
2020-10-02 15:10:00 +00:00
|
|
|
// colRef is a rowId of a column or its negative value (indicating descending order).
|
2021-11-03 11:44:28 +00:00
|
|
|
const col = getColumn(Sort.getColRef(colSpec));
|
2020-10-02 15:10:00 +00:00
|
|
|
return cssMenuText(
|
|
|
|
cssMenuIconWrapper(
|
2021-11-03 11:44:28 +00:00
|
|
|
cssMenuIconWrapper.cls('-changed', changedColumns.includes(colSpec)),
|
|
|
|
cssMenuIconWrapper.cls(Sort.isAscending(colSpec) ? '-asc' : '-desc'),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssIcon('Sort',
|
2021-11-03 11:44:28 +00:00
|
|
|
dom.style('transform', Sort.isAscending(colSpec) ? 'scaleY(-1)' : 'none'),
|
2020-10-02 15:10:00 +00:00
|
|
|
dom.on('click', () => {
|
2021-11-03 11:44:28 +00:00
|
|
|
section.activeSortSpec(Sort.flipSort(sortSpec, colSpec));
|
2020-10-02 15:10:00 +00:00
|
|
|
})
|
|
|
|
)
|
|
|
|
),
|
|
|
|
cssMenuTextLabel(col.colId()),
|
|
|
|
cssMenuIconWrapper(
|
|
|
|
cssIcon('Remove', testId('btn-remove-sort'), dom.on('click', () => {
|
2021-11-03 11:44:28 +00:00
|
|
|
if (Sort.findCol(sortSpec, colSpec)) {
|
|
|
|
section.activeSortSpec(Sort.removeCol(sortSpec, colSpec));
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
}))
|
|
|
|
),
|
|
|
|
testId('sort-col')
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
return [
|
2022-10-28 16:11:08 +00:00
|
|
|
cssMenuInfoHeader(t('SortedBy'), testId('heading-sorted')),
|
2021-04-14 15:17:45 +00:00
|
|
|
sortColumns.length > 0 ? sortColumns : cssGrayedMenuText('(Default)')
|
2020-10-02 15:10:00 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2022-01-12 13:30:51 +00:00
|
|
|
// [+] Add Filter.
|
2021-11-19 20:30:11 +00:00
|
|
|
export function makeAddFilterButton(viewSectionRec: ViewSectionRec, popupControls: WeakMap<ColumnRec, PopupControl>) {
|
2021-04-27 19:05:23 +00:00
|
|
|
return dom.domComputed((use) => {
|
2021-11-19 20:30:11 +00:00
|
|
|
const filters = use(viewSectionRec.filters);
|
2021-04-27 19:05:23 +00:00
|
|
|
return cssMenuText(
|
|
|
|
cssMenuIconWrapper(
|
|
|
|
cssIcon('Plus'),
|
2021-11-19 20:30:11 +00:00
|
|
|
addFilterMenu(filters, viewSectionRec, popupControls, {
|
2021-04-27 19:05:23 +00:00
|
|
|
placement: 'bottom-end',
|
|
|
|
// Attach content to triggerElem's parent, which is needed to prevent view section menu to
|
|
|
|
// close when clicking an item of the add filter menu.
|
|
|
|
attach: null
|
|
|
|
}),
|
|
|
|
testId('plus-button'),
|
|
|
|
dom.on('click', (ev) => ev.stopPropagation()),
|
|
|
|
),
|
2022-10-28 16:11:08 +00:00
|
|
|
cssMenuTextLabel(t('AddFilter')),
|
2021-04-27 19:05:23 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-01-12 13:30:51 +00:00
|
|
|
// [v] or [x] Toggle Filter Bar.
|
2021-04-14 15:17:45 +00:00
|
|
|
export function makeFilterBarToggle(activeFilterBar: CustomComputed<boolean>) {
|
|
|
|
return cssMenuText(
|
|
|
|
cssMenuIconWrapper(
|
|
|
|
testId('btn'),
|
|
|
|
cssMenuIconWrapper.cls('-changed', (use) => !use(activeFilterBar.isSaved)),
|
|
|
|
dom.domComputed((use) => {
|
|
|
|
const filterBar = use(activeFilterBar);
|
|
|
|
const isSaved = use(activeFilterBar.isSaved);
|
|
|
|
return cssIcon(filterBar ? "Tick" : (isSaved ? "Plus" : "CrossSmall"),
|
|
|
|
cssIcon.cls('-green', Boolean(filterBar)),
|
|
|
|
testId('icon'));
|
|
|
|
}),
|
|
|
|
),
|
2021-05-04 10:27:15 +00:00
|
|
|
dom.on('click', () => activeFilterBar(!activeFilterBar.peek())),
|
2022-10-28 16:11:08 +00:00
|
|
|
cssMenuTextLabel(t("ToggleFilterBar")),
|
2021-04-14 15:17:45 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-01-12 13:30:51 +00:00
|
|
|
// Filtered by - section in the menu (contains all filtered columns or (Not filtered) label).
|
2021-11-19 20:30:11 +00:00
|
|
|
function makeFilterPanel(section: ViewSectionRec, activeFilters: FilterInfo[],
|
|
|
|
popupControls: WeakMap<ColumnRec, PopupControl>,
|
2021-05-06 12:23:50 +00:00
|
|
|
onCloseContent: () => void) {
|
2021-11-19 20:30:11 +00:00
|
|
|
const filters = activeFilters.map(filterInfo => {
|
|
|
|
const filterChanged = Computed.create(null, fromKo(filterInfo.filter.isSaved), (_use, isSaved) => !isSaved);
|
2020-10-02 15:10:00 +00:00
|
|
|
return cssMenuText(
|
|
|
|
cssMenuIconWrapper(
|
2021-11-19 20:30:11 +00:00
|
|
|
cssMenuIconWrapper.cls('-changed', filterChanged),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssIcon('FilterSimple'),
|
2021-11-19 20:30:11 +00:00
|
|
|
attachColumnFilterMenu(section, filterInfo, {
|
2021-04-27 19:05:23 +00:00
|
|
|
placement: 'bottom-end',
|
2021-11-19 20:30:11 +00:00
|
|
|
trigger: [
|
|
|
|
'click',
|
|
|
|
(_el, popupControl) => popupControls.set(filterInfo.fieldOrColumn.origCol(), popupControl)
|
|
|
|
],
|
2021-05-06 12:23:50 +00:00
|
|
|
onCloseContent,
|
2021-04-27 19:05:23 +00:00
|
|
|
}),
|
2021-04-14 15:17:45 +00:00
|
|
|
testId('filter-icon'),
|
2020-10-02 15:10:00 +00:00
|
|
|
),
|
2021-11-19 20:30:11 +00:00
|
|
|
cssMenuTextLabel(filterInfo.fieldOrColumn.label()),
|
|
|
|
cssMenuIconWrapper(cssIcon('Remove',
|
|
|
|
dom.on('click', () => section.setFilter(filterInfo.fieldOrColumn.origCol().origColRef(), ''))),
|
|
|
|
testId('btn-remove-filter')
|
|
|
|
),
|
2020-10-02 15:10:00 +00:00
|
|
|
testId('filter-col')
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
return [
|
2022-10-28 16:11:08 +00:00
|
|
|
cssMenuInfoHeader(t('FilteredBy'), {style: 'margin-top: 4px'}, testId('heading-filtered')),
|
2021-11-19 20:30:11 +00:00
|
|
|
activeFilters.length > 0 ? filters : cssGrayedMenuText('(Not filtered)')
|
2020-10-02 15:10:00 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2022-01-12 13:30:51 +00:00
|
|
|
|
|
|
|
// Custom Options
|
|
|
|
// (empty)|(customized)|(modified) [Remove Icon]
|
|
|
|
function makeCustomOptions(section: ViewSectionRec) {
|
|
|
|
const color = Computed.create(null, use => use(section.activeCustomOptions.isSaved) ? "-gray" : "-green");
|
|
|
|
const text = Computed.create(null, use => {
|
|
|
|
if (use(section.activeCustomOptions)) {
|
2022-10-28 16:11:08 +00:00
|
|
|
return use(section.activeCustomOptions.isSaved) ? t("Customized") : t("Modified");
|
2022-01-12 13:30:51 +00:00
|
|
|
} else {
|
2022-10-28 16:11:08 +00:00
|
|
|
return t("Empty");
|
2022-01-12 13:30:51 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return [
|
2022-10-28 16:11:08 +00:00
|
|
|
cssMenuInfoHeader(t('CustomOptions'), testId('heading-widget-options')),
|
2022-01-12 13:30:51 +00:00
|
|
|
cssMenuText(
|
|
|
|
dom.autoDispose(text),
|
|
|
|
dom.autoDispose(color),
|
|
|
|
dom.text(text),
|
|
|
|
cssMenuText.cls(color),
|
|
|
|
cssSpacer(),
|
|
|
|
dom.maybe(use => use(section.activeCustomOptions), () =>
|
|
|
|
cssMenuIconWrapper(
|
|
|
|
cssIcon('Remove', testId('btn-remove-options'), dom.on('click', () =>
|
|
|
|
section.activeCustomOptions(null)
|
|
|
|
))
|
|
|
|
),
|
|
|
|
),
|
|
|
|
testId("custom-options")
|
|
|
|
)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
const clsOldUI = styled('div', ``);
|
|
|
|
|
2021-04-30 17:28:52 +00:00
|
|
|
const cssFixHeight = styled('div', `
|
2020-10-02 15:10:00 +00:00
|
|
|
margin-top: -3px; /* Section header is 24px, so need to move this up a little bit */
|
2021-04-30 17:28:52 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssMenu = styled('div', `
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
border-radius: 3px;
|
|
|
|
border: 1px solid transparent;
|
|
|
|
&.${clsOldUI.className} {
|
|
|
|
margin-top: 0px;
|
|
|
|
border-radius: 0px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover, &.weasel-popup-open {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.hover};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssIconWrapper = styled('div', `
|
|
|
|
padding: 3px;
|
|
|
|
border-radius: 3px;
|
|
|
|
cursor: pointer;
|
|
|
|
user-select: none;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssMenuIconWrapper = styled(cssIconWrapper, `
|
2021-04-14 15:17:45 +00:00
|
|
|
display: flex;
|
2020-10-02 15:10:00 +00:00
|
|
|
margin: -3px 0;
|
|
|
|
width: 22px;
|
|
|
|
height: 22px;
|
|
|
|
|
|
|
|
&:hover, &.weasel-popup-open {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.hover};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
&-changed {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.accentIcon};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
&-changed:hover, &-changed:hover.weasel-popup-open {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.controlHoverFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
2021-04-30 17:28:52 +00:00
|
|
|
const cssFilterMenuWrapper = styled('div', `
|
|
|
|
display: inline-flex;
|
|
|
|
margin-right: 10px;
|
|
|
|
border-radius: 3px;
|
|
|
|
align-items: center;
|
|
|
|
&-unsaved {
|
2022-09-06 01:51:57 +00:00
|
|
|
border: 1px solid ${theme.accentBorder};
|
2021-04-30 17:28:52 +00:00
|
|
|
}
|
|
|
|
& .${cssMenu.className} {
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
`);
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
const cssIcon = styled(icon, `
|
|
|
|
flex: none;
|
|
|
|
cursor: pointer;
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.lightText};
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
.${cssMenuIconWrapper.className}-changed & {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.controlPrimaryFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.${clsOldUI.className} & {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.controlPrimaryFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
2021-04-14 15:17:45 +00:00
|
|
|
|
|
|
|
&-green {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.accentIcon};
|
2021-04-14 15:17:45 +00:00
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssDotsIconWrapper = styled(cssIconWrapper, `
|
|
|
|
border-radius: 0px 2px 2px 0px;
|
|
|
|
|
|
|
|
.${clsOldUI.className} & {
|
|
|
|
border-radius: 0px;
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssFilterIconWrapper = styled(cssIconWrapper, `
|
|
|
|
border-radius: 2px 0px 0px 2px;
|
2021-04-30 17:28:52 +00:00
|
|
|
.${cssFilterMenuWrapper.className}-unsaved & {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.accentIcon};
|
2021-04-30 17:28:52 +00:00
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssFilterIcon = styled(cssIcon, `
|
2021-04-30 17:28:52 +00:00
|
|
|
.${cssFilterIconWrapper.className}-any & {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.accentIcon};
|
2021-04-30 17:28:52 +00:00
|
|
|
}
|
|
|
|
.${cssFilterMenuWrapper.className}-unsaved & {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.controlPrimaryFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssMenuInfoHeader = styled('div', `
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.menuSubheaderFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
font-weight: ${vars.bigControlTextWeight};
|
|
|
|
padding: 8px 24px 8px 24px;
|
|
|
|
cursor: default;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssMenuText = styled('div', `
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 0px 24px 8px 24px;
|
|
|
|
cursor: default;
|
2021-04-14 15:17:45 +00:00
|
|
|
white-space: nowrap;
|
2022-01-12 13:30:51 +00:00
|
|
|
&-green {
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.accentText};
|
2022-01-12 13:30:51 +00:00
|
|
|
}
|
|
|
|
&-gray {
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.lightText};
|
2022-01-12 13:30:51 +00:00
|
|
|
}
|
2021-04-14 15:17:45 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssGrayedMenuText = styled(cssMenuText, `
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.lightText};
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssMenuTextLabel = styled('span', `
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.menuItemFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
flex-grow: 1;
|
|
|
|
padding: 0 4px;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssSaveButton = styled(primaryButton, `
|
|
|
|
margin-right: 8px;
|
|
|
|
`);
|
2021-04-30 17:28:52 +00:00
|
|
|
|
|
|
|
const cssSmallIconWrapper = styled('div', `
|
|
|
|
width: 16px;
|
|
|
|
height: 16px;
|
|
|
|
border-radius: 8px;
|
2021-05-05 15:15:15 +00:00
|
|
|
margin: 0 5px 0 5px;
|
|
|
|
|
2021-04-30 17:28:52 +00:00
|
|
|
&-green {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.accentIcon};
|
2021-04-30 17:28:52 +00:00
|
|
|
}
|
|
|
|
&-gray {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.lightText};
|
2021-04-30 17:28:52 +00:00
|
|
|
}
|
|
|
|
& > .${cssIcon.className} {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.controlPrimaryFg};
|
2021-04-30 17:28:52 +00:00
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssSaveIconsWrapper = styled('div', `
|
2021-05-05 15:15:15 +00:00
|
|
|
padding: 0 1px 0 1px;
|
2021-04-30 17:28:52 +00:00
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
`);
|
2022-01-12 13:30:51 +00:00
|
|
|
|
|
|
|
const cssSpacer = styled('div', `
|
|
|
|
margin: 0 auto;
|
|
|
|
`);
|