@univerjs/sheets-filter-ui 1.0.0-alpha.2 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +117 -167
- package/lib/es/index.js +118 -169
- package/lib/index.js +118 -169
- package/lib/types/controllers/ui.controller.d.ts +2 -2
- package/lib/types/index.d.ts +1 -0
- package/lib/types/services/sheets-filter-panel.service.d.ts +11 -11
- package/lib/umd/index.js +2 -2
- package/package.json +14 -14
package/lib/es/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { INTERCEPTOR_POINT, RangeProtectionPermissionViewPoint, RefRangeService,
|
|
|
7
7
|
import { BehaviorSubject, ReplaySubject, Subject, combineLatest, distinctUntilChanged, filter, map, merge as merge$1, of, shareReplay, startWith, switchMap, takeUntil, throttleTime } from "rxjs";
|
|
8
8
|
import { AIcon, BanIcon, FilterIcon, InfoIcon, SuccessIcon } from "@univerjs/icons";
|
|
9
9
|
import { Button, Checkbox, Input, MessageType, Radio, RadioGroup, Segmented, Select, Switch, Tooltip, Tree, borderClassName, clsx } from "@univerjs/design";
|
|
10
|
-
import { useCallback
|
|
10
|
+
import { useCallback } from "react";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { IRPCChannelService, fromModule, toModule } from "@univerjs/rpc";
|
|
13
13
|
|
|
@@ -1478,7 +1478,7 @@ const OpenFilterPanelOperation = {
|
|
|
1478
1478
|
handler: (accessor, params) => {
|
|
1479
1479
|
const contextService = accessor.get(IContextService);
|
|
1480
1480
|
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
1481
|
-
const sheetsFilterPanelService = accessor.get(
|
|
1481
|
+
const sheetsFilterPanelService = accessor.get(ISheetsFilterPanelService);
|
|
1482
1482
|
const commandService = accessor.get(ICommandService);
|
|
1483
1483
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
1484
1484
|
if (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.isVisible().visible) commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, { visible: false });
|
|
@@ -1495,7 +1495,7 @@ const CloseFilterPanelOperation = {
|
|
|
1495
1495
|
type: CommandType.OPERATION,
|
|
1496
1496
|
handler: (accessor) => {
|
|
1497
1497
|
const contextService = accessor.get(IContextService);
|
|
1498
|
-
const sheetsFilterPanelService = accessor.get(
|
|
1498
|
+
const sheetsFilterPanelService = accessor.get(ISheetsFilterPanelService);
|
|
1499
1499
|
const layoutService = accessor.get(ILayoutService, Quantity.OPTIONAL);
|
|
1500
1500
|
if (contextService.getContextValue("FILTER_PANEL_OPENED")) {
|
|
1501
1501
|
contextService.setContextValue(FILTER_PANEL_OPENED_KEY, false);
|
|
@@ -1510,14 +1510,73 @@ const ChangeFilterByOperation = {
|
|
|
1510
1510
|
type: CommandType.OPERATION,
|
|
1511
1511
|
handler: (accessor, params) => {
|
|
1512
1512
|
const { filterBy } = params;
|
|
1513
|
-
return accessor.get(
|
|
1513
|
+
return accessor.get(ISheetsFilterPanelService).changeFilterBy(filterBy);
|
|
1514
1514
|
}
|
|
1515
1515
|
};
|
|
1516
1516
|
|
|
1517
|
+
//#endregion
|
|
1518
|
+
//#region src/menu/sheets-filter.menu.ts
|
|
1519
|
+
function SmartToggleFilterMenuItemFactory(accessor) {
|
|
1520
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
1521
|
+
return {
|
|
1522
|
+
id: SmartToggleSheetsFilterCommand.id,
|
|
1523
|
+
type: MenuItemType.BUTTON_SELECTOR,
|
|
1524
|
+
icon: "FilterIcon",
|
|
1525
|
+
tooltip: "sheets-filter-ui.toolbar.smart-toggle-filter-tooltip",
|
|
1526
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
1527
|
+
activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
|
|
1528
|
+
disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, {
|
|
1529
|
+
worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission],
|
|
1530
|
+
rangeTypes: [RangeProtectionPermissionViewPoint]
|
|
1531
|
+
}))
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
function ClearFilterCriteriaMenuItemFactory(accessor) {
|
|
1535
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
1536
|
+
return {
|
|
1537
|
+
id: ClearSheetsFilterCriteriaCommand.id,
|
|
1538
|
+
type: MenuItemType.BUTTON,
|
|
1539
|
+
title: "sheets-filter-ui.toolbar.clear-filter-criteria",
|
|
1540
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
1541
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
1542
|
+
var _model$hasCriteria$$p;
|
|
1543
|
+
return (_model$hasCriteria$$p = model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe(map((m) => !m))) !== null && _model$hasCriteria$$p !== void 0 ? _model$hasCriteria$$p : of(true);
|
|
1544
|
+
}))
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
function ReCalcFilterMenuItemFactory(accessor) {
|
|
1548
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
1549
|
+
return {
|
|
1550
|
+
id: ReCalcSheetsFilterCommand.id,
|
|
1551
|
+
type: MenuItemType.BUTTON,
|
|
1552
|
+
title: "sheets-filter-ui.toolbar.re-calc-filter-conditions",
|
|
1553
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
1554
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
1555
|
+
var _model$hasCriteria$$p2;
|
|
1556
|
+
return (_model$hasCriteria$$p2 = model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe(map((m) => !m))) !== null && _model$hasCriteria$$p2 !== void 0 ? _model$hasCriteria$$p2 : of(true);
|
|
1557
|
+
}))
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
//#endregion
|
|
1562
|
+
//#region src/menu/schema.ts
|
|
1563
|
+
const menuSchema = { [RibbonDataGroup.ORGANIZATION]: { [SmartToggleSheetsFilterCommand.id]: {
|
|
1564
|
+
order: 2,
|
|
1565
|
+
menuItemFactory: SmartToggleFilterMenuItemFactory,
|
|
1566
|
+
[ClearSheetsFilterCriteriaCommand.id]: {
|
|
1567
|
+
order: 0,
|
|
1568
|
+
menuItemFactory: ClearFilterCriteriaMenuItemFactory
|
|
1569
|
+
},
|
|
1570
|
+
[ReCalcSheetsFilterCommand.id]: {
|
|
1571
|
+
order: 1,
|
|
1572
|
+
menuItemFactory: ReCalcFilterMenuItemFactory
|
|
1573
|
+
}
|
|
1574
|
+
} } };
|
|
1575
|
+
|
|
1517
1576
|
//#endregion
|
|
1518
1577
|
//#region package.json
|
|
1519
1578
|
var name = "@univerjs/sheets-filter-ui";
|
|
1520
|
-
var version = "1.0.0-alpha.
|
|
1579
|
+
var version = "1.0.0-alpha.4";
|
|
1521
1580
|
|
|
1522
1581
|
//#endregion
|
|
1523
1582
|
//#region src/config/config.ts
|
|
@@ -1594,6 +1653,28 @@ function CheckedIcon() {
|
|
|
1594
1653
|
|
|
1595
1654
|
//#endregion
|
|
1596
1655
|
//#region src/views/components/SheetsFilterByConditionsPanel.tsx
|
|
1656
|
+
const PRIMARY_CONDITION_GROUPS = [
|
|
1657
|
+
[FilterConditionItems.NONE],
|
|
1658
|
+
[FilterConditionItems.EMPTY, FilterConditionItems.NOT_EMPTY],
|
|
1659
|
+
[
|
|
1660
|
+
FilterConditionItems.TEXT_CONTAINS,
|
|
1661
|
+
FilterConditionItems.DOES_NOT_CONTAIN,
|
|
1662
|
+
FilterConditionItems.STARTS_WITH,
|
|
1663
|
+
FilterConditionItems.ENDS_WITH,
|
|
1664
|
+
FilterConditionItems.EQUALS
|
|
1665
|
+
],
|
|
1666
|
+
[
|
|
1667
|
+
FilterConditionItems.GREATER_THAN,
|
|
1668
|
+
FilterConditionItems.GREATER_THAN_OR_EQUAL,
|
|
1669
|
+
FilterConditionItems.LESS_THAN,
|
|
1670
|
+
FilterConditionItems.LESS_THAN_OR_EQUAL,
|
|
1671
|
+
FilterConditionItems.EQUAL,
|
|
1672
|
+
FilterConditionItems.NOT_EQUAL,
|
|
1673
|
+
FilterConditionItems.BETWEEN,
|
|
1674
|
+
FilterConditionItems.NOT_BETWEEN
|
|
1675
|
+
],
|
|
1676
|
+
[FilterConditionItems.CUSTOM]
|
|
1677
|
+
];
|
|
1597
1678
|
/**
|
|
1598
1679
|
* Filter by conditions.
|
|
1599
1680
|
*/
|
|
@@ -1607,11 +1688,17 @@ function FilterByCondition(props) {
|
|
|
1607
1688
|
const onRadioChange = useCallback((key) => {
|
|
1608
1689
|
model.onConditionFormChange({ and: key === "AND" });
|
|
1609
1690
|
}, [model]);
|
|
1610
|
-
const primaryOptions =
|
|
1691
|
+
const primaryOptions = PRIMARY_CONDITION_GROUPS.map((group) => ({ options: group.map((conditionItem) => ({
|
|
1692
|
+
label: localeService.t(conditionItem.label),
|
|
1693
|
+
value: conditionItem.operator
|
|
1694
|
+
})) }));
|
|
1611
1695
|
const onPrimaryConditionChange = useCallback((value) => {
|
|
1612
1696
|
model.onPrimaryConditionChange(value);
|
|
1613
1697
|
}, [model]);
|
|
1614
|
-
const secondaryOptions =
|
|
1698
|
+
const secondaryOptions = FilterConditionItems.ALL_CONDITIONS.filter((conditionItem) => conditionItem.numOfParameters !== 2).map((conditionItem) => ({
|
|
1699
|
+
label: localeService.t(conditionItem.label),
|
|
1700
|
+
value: conditionItem.operator
|
|
1701
|
+
}));
|
|
1615
1702
|
const onFormParamsChange = useCallback((diffParams) => {
|
|
1616
1703
|
model.onConditionFormChange(diffParams);
|
|
1617
1704
|
}, [model]);
|
|
@@ -1669,87 +1756,6 @@ function FilterByCondition(props) {
|
|
|
1669
1756
|
}) : null] })
|
|
1670
1757
|
});
|
|
1671
1758
|
}
|
|
1672
|
-
function usePrimaryOptions(localeService) {
|
|
1673
|
-
return useMemo(() => [
|
|
1674
|
-
{ options: [{
|
|
1675
|
-
label: localeService.t(FilterConditionItems.NONE.label),
|
|
1676
|
-
value: FilterConditionItems.NONE.operator
|
|
1677
|
-
}] },
|
|
1678
|
-
{ options: [{
|
|
1679
|
-
label: localeService.t(FilterConditionItems.EMPTY.label),
|
|
1680
|
-
value: FilterConditionItems.EMPTY.operator
|
|
1681
|
-
}, {
|
|
1682
|
-
label: localeService.t(FilterConditionItems.NOT_EMPTY.label),
|
|
1683
|
-
value: FilterConditionItems.NOT_EMPTY.operator
|
|
1684
|
-
}] },
|
|
1685
|
-
{ options: [
|
|
1686
|
-
{
|
|
1687
|
-
label: localeService.t(FilterConditionItems.TEXT_CONTAINS.label),
|
|
1688
|
-
value: FilterConditionItems.TEXT_CONTAINS.operator
|
|
1689
|
-
},
|
|
1690
|
-
{
|
|
1691
|
-
label: localeService.t(FilterConditionItems.DOES_NOT_CONTAIN.label),
|
|
1692
|
-
value: FilterConditionItems.DOES_NOT_CONTAIN.operator
|
|
1693
|
-
},
|
|
1694
|
-
{
|
|
1695
|
-
label: localeService.t(FilterConditionItems.STARTS_WITH.label),
|
|
1696
|
-
value: FilterConditionItems.STARTS_WITH.operator
|
|
1697
|
-
},
|
|
1698
|
-
{
|
|
1699
|
-
label: localeService.t(FilterConditionItems.ENDS_WITH.label),
|
|
1700
|
-
value: FilterConditionItems.ENDS_WITH.operator
|
|
1701
|
-
},
|
|
1702
|
-
{
|
|
1703
|
-
label: localeService.t(FilterConditionItems.EQUALS.label),
|
|
1704
|
-
value: FilterConditionItems.EQUALS.operator
|
|
1705
|
-
}
|
|
1706
|
-
] },
|
|
1707
|
-
{ options: [
|
|
1708
|
-
{
|
|
1709
|
-
label: localeService.t(FilterConditionItems.GREATER_THAN.label),
|
|
1710
|
-
value: FilterConditionItems.GREATER_THAN.operator
|
|
1711
|
-
},
|
|
1712
|
-
{
|
|
1713
|
-
label: localeService.t(FilterConditionItems.GREATER_THAN_OR_EQUAL.label),
|
|
1714
|
-
value: FilterConditionItems.GREATER_THAN_OR_EQUAL.operator
|
|
1715
|
-
},
|
|
1716
|
-
{
|
|
1717
|
-
label: localeService.t(FilterConditionItems.LESS_THAN.label),
|
|
1718
|
-
value: FilterConditionItems.LESS_THAN.operator
|
|
1719
|
-
},
|
|
1720
|
-
{
|
|
1721
|
-
label: localeService.t(FilterConditionItems.LESS_THAN_OR_EQUAL.label),
|
|
1722
|
-
value: FilterConditionItems.LESS_THAN_OR_EQUAL.operator
|
|
1723
|
-
},
|
|
1724
|
-
{
|
|
1725
|
-
label: localeService.t(FilterConditionItems.EQUAL.label),
|
|
1726
|
-
value: FilterConditionItems.EQUAL.operator
|
|
1727
|
-
},
|
|
1728
|
-
{
|
|
1729
|
-
label: localeService.t(FilterConditionItems.NOT_EQUAL.label),
|
|
1730
|
-
value: FilterConditionItems.NOT_EQUAL.operator
|
|
1731
|
-
},
|
|
1732
|
-
{
|
|
1733
|
-
label: localeService.t(FilterConditionItems.BETWEEN.label),
|
|
1734
|
-
value: FilterConditionItems.BETWEEN.operator
|
|
1735
|
-
},
|
|
1736
|
-
{
|
|
1737
|
-
label: localeService.t(FilterConditionItems.NOT_BETWEEN.label),
|
|
1738
|
-
value: FilterConditionItems.NOT_BETWEEN.operator
|
|
1739
|
-
}
|
|
1740
|
-
] },
|
|
1741
|
-
{ options: [{
|
|
1742
|
-
label: localeService.t(FilterConditionItems.CUSTOM.label),
|
|
1743
|
-
value: FilterConditionItems.CUSTOM.operator
|
|
1744
|
-
}] }
|
|
1745
|
-
], [localeService.getCurrentLocale(), localeService]);
|
|
1746
|
-
}
|
|
1747
|
-
function useSecondaryOptions(localeService) {
|
|
1748
|
-
return useMemo(() => FilterConditionItems.ALL_CONDITIONS.filter((c) => c.numOfParameters !== 2).map((c) => ({
|
|
1749
|
-
label: localeService.t(c.label),
|
|
1750
|
-
value: c.operator
|
|
1751
|
-
})), [localeService.getCurrentLocale(), localeService]);
|
|
1752
|
-
}
|
|
1753
1759
|
|
|
1754
1760
|
//#endregion
|
|
1755
1761
|
//#region src/views/components/SheetsFilterByValuesPanel.tsx
|
|
@@ -1867,10 +1873,11 @@ function FilterByValue(props) {
|
|
|
1867
1873
|
//#region src/views/components/SheetsFilterSyncSwitch.tsx
|
|
1868
1874
|
function FilterSyncSwitch() {
|
|
1869
1875
|
const sheetsFilterSyncController = useDependency(SheetsFilterSyncController);
|
|
1870
|
-
|
|
1876
|
+
const visible = useObservable(sheetsFilterSyncController.visible$, void 0, true);
|
|
1871
1877
|
const localeService = useDependency(LocaleService);
|
|
1872
1878
|
const messageService = useDependency(IMessageService);
|
|
1873
1879
|
const enabled = useObservable(sheetsFilterSyncController.enabled$, void 0, true);
|
|
1880
|
+
if (!visible) return null;
|
|
1874
1881
|
return /* @__PURE__ */ jsxs("div", {
|
|
1875
1882
|
className: "univer-mt-2 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-900 dark:!univer-text-gray-200",
|
|
1876
1883
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -1897,6 +1904,20 @@ function FilterSyncSwitch() {
|
|
|
1897
1904
|
|
|
1898
1905
|
//#endregion
|
|
1899
1906
|
//#region src/views/components/SheetsFilterPanel.tsx
|
|
1907
|
+
const FILTER_BY_OPTIONS = [
|
|
1908
|
+
{
|
|
1909
|
+
label: "sheets-filter-ui.panel.by-values",
|
|
1910
|
+
value: FilterBy.VALUES
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
label: "sheets-filter-ui.panel.by-colors",
|
|
1914
|
+
value: FilterBy.COLORS
|
|
1915
|
+
},
|
|
1916
|
+
{
|
|
1917
|
+
label: "sheets-filter-ui.panel.by-conditions",
|
|
1918
|
+
value: FilterBy.CONDITIONS
|
|
1919
|
+
}
|
|
1920
|
+
];
|
|
1900
1921
|
/**
|
|
1901
1922
|
* This Filter Panel component is used to filter the data in the sheet.
|
|
1902
1923
|
*
|
|
@@ -1904,13 +1925,16 @@ function FilterSyncSwitch() {
|
|
|
1904
1925
|
*/
|
|
1905
1926
|
function FilterPanel() {
|
|
1906
1927
|
var _filterService$active;
|
|
1907
|
-
const sheetsFilterPanelService = useDependency(
|
|
1928
|
+
const sheetsFilterPanelService = useDependency(ISheetsFilterPanelService);
|
|
1908
1929
|
const localeService = useDependency(LocaleService);
|
|
1909
1930
|
const commandService = useDependency(ICommandService);
|
|
1910
1931
|
const filterBy = useObservable(sheetsFilterPanelService.filterBy$, void 0, true);
|
|
1911
1932
|
const filterByModel = useObservable(sheetsFilterPanelService.filterByModel$, void 0, false);
|
|
1912
1933
|
const canApply = useObservable(() => (filterByModel === null || filterByModel === void 0 ? void 0 : filterByModel.canApply$) || of(false), void 0, false, [filterByModel]);
|
|
1913
|
-
const items =
|
|
1934
|
+
const items = FILTER_BY_OPTIONS.map((option) => ({
|
|
1935
|
+
...option,
|
|
1936
|
+
label: localeService.t(option.label)
|
|
1937
|
+
}));
|
|
1914
1938
|
const clearFilterDisabled = !useObservable(sheetsFilterPanelService.hasCriteria$);
|
|
1915
1939
|
const onFilterByTypeChange = useCallback((value) => {
|
|
1916
1940
|
commandService.executeCommand(ChangeFilterByOperation.id, { filterBy: value });
|
|
@@ -1980,22 +2004,6 @@ function FilterPanel() {
|
|
|
1980
2004
|
});
|
|
1981
2005
|
}
|
|
1982
2006
|
const FILTER_PANEL_POPUP_KEY = "FILTER_PANEL_POPUP";
|
|
1983
|
-
function useFilterByOptions(localeService) {
|
|
1984
|
-
return useMemo(() => [
|
|
1985
|
-
{
|
|
1986
|
-
label: localeService.t("sheets-filter-ui.panel.by-values"),
|
|
1987
|
-
value: FilterBy.VALUES
|
|
1988
|
-
},
|
|
1989
|
-
{
|
|
1990
|
-
label: localeService.t("sheets-filter-ui.panel.by-colors"),
|
|
1991
|
-
value: FilterBy.COLORS
|
|
1992
|
-
},
|
|
1993
|
-
{
|
|
1994
|
-
label: localeService.t("sheets-filter-ui.panel.by-conditions"),
|
|
1995
|
-
value: FilterBy.CONDITIONS
|
|
1996
|
-
}
|
|
1997
|
-
], [localeService.getCurrentLocale(), localeService]);
|
|
1998
|
-
}
|
|
1999
2007
|
|
|
2000
2008
|
//#endregion
|
|
2001
2009
|
//#region src/controllers/components.controller.ts
|
|
@@ -2434,65 +2442,6 @@ UniverSheetsFilterMobileUIPlugin = __decorate([
|
|
|
2434
2442
|
__decorateParam(2, IConfigService)
|
|
2435
2443
|
], UniverSheetsFilterMobileUIPlugin);
|
|
2436
2444
|
|
|
2437
|
-
//#endregion
|
|
2438
|
-
//#region src/menu/sheets-filter.menu.ts
|
|
2439
|
-
function SmartToggleFilterMenuItemFactory(accessor) {
|
|
2440
|
-
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
2441
|
-
return {
|
|
2442
|
-
id: SmartToggleSheetsFilterCommand.id,
|
|
2443
|
-
type: MenuItemType.BUTTON_SELECTOR,
|
|
2444
|
-
icon: "FilterIcon",
|
|
2445
|
-
tooltip: "sheets-filter-ui.toolbar.smart-toggle-filter-tooltip",
|
|
2446
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2447
|
-
activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
|
|
2448
|
-
disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, {
|
|
2449
|
-
worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission],
|
|
2450
|
-
rangeTypes: [RangeProtectionPermissionViewPoint]
|
|
2451
|
-
}))
|
|
2452
|
-
};
|
|
2453
|
-
}
|
|
2454
|
-
function ClearFilterCriteriaMenuItemFactory(accessor) {
|
|
2455
|
-
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
2456
|
-
return {
|
|
2457
|
-
id: ClearSheetsFilterCriteriaCommand.id,
|
|
2458
|
-
type: MenuItemType.BUTTON,
|
|
2459
|
-
title: "sheets-filter-ui.toolbar.clear-filter-criteria",
|
|
2460
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2461
|
-
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
2462
|
-
var _model$hasCriteria$$p;
|
|
2463
|
-
return (_model$hasCriteria$$p = model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe(map((m) => !m))) !== null && _model$hasCriteria$$p !== void 0 ? _model$hasCriteria$$p : of(true);
|
|
2464
|
-
}))
|
|
2465
|
-
};
|
|
2466
|
-
}
|
|
2467
|
-
function ReCalcFilterMenuItemFactory(accessor) {
|
|
2468
|
-
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
2469
|
-
return {
|
|
2470
|
-
id: ReCalcSheetsFilterCommand.id,
|
|
2471
|
-
type: MenuItemType.BUTTON,
|
|
2472
|
-
title: "sheets-filter-ui.toolbar.re-calc-filter-conditions",
|
|
2473
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2474
|
-
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
2475
|
-
var _model$hasCriteria$$p2;
|
|
2476
|
-
return (_model$hasCriteria$$p2 = model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe(map((m) => !m))) !== null && _model$hasCriteria$$p2 !== void 0 ? _model$hasCriteria$$p2 : of(true);
|
|
2477
|
-
}))
|
|
2478
|
-
};
|
|
2479
|
-
}
|
|
2480
|
-
|
|
2481
|
-
//#endregion
|
|
2482
|
-
//#region src/menu/schema.ts
|
|
2483
|
-
const menuSchema = { [RibbonDataGroup.ORGANIZATION]: { [SmartToggleSheetsFilterCommand.id]: {
|
|
2484
|
-
order: 2,
|
|
2485
|
-
menuItemFactory: SmartToggleFilterMenuItemFactory,
|
|
2486
|
-
[ClearSheetsFilterCriteriaCommand.id]: {
|
|
2487
|
-
order: 0,
|
|
2488
|
-
menuItemFactory: ClearFilterCriteriaMenuItemFactory
|
|
2489
|
-
},
|
|
2490
|
-
[ReCalcSheetsFilterCommand.id]: {
|
|
2491
|
-
order: 1,
|
|
2492
|
-
menuItemFactory: ReCalcFilterMenuItemFactory
|
|
2493
|
-
}
|
|
2494
|
-
} } };
|
|
2495
|
-
|
|
2496
2445
|
//#endregion
|
|
2497
2446
|
//#region src/controllers/sheets-filter.shortcut.ts
|
|
2498
2447
|
const SmartToggleFilterShortcut = {
|
|
@@ -2580,7 +2529,7 @@ let SheetsFilterUIDesktopController = class SheetsFilterUIDesktopController exte
|
|
|
2580
2529
|
};
|
|
2581
2530
|
SheetsFilterUIDesktopController = __decorate([
|
|
2582
2531
|
__decorateParam(0, Inject(Injector)),
|
|
2583
|
-
__decorateParam(1,
|
|
2532
|
+
__decorateParam(1, ISheetsFilterPanelService),
|
|
2584
2533
|
__decorateParam(2, Inject(SheetCanvasPopManagerService)),
|
|
2585
2534
|
__decorateParam(3, Inject(SheetsFilterService)),
|
|
2586
2535
|
__decorateParam(4, Inject(LocaleService)),
|
|
@@ -2610,7 +2559,7 @@ let UniverSheetsFilterUIPlugin = class UniverSheetsFilterUIPlugin extends Plugin
|
|
|
2610
2559
|
this._injector.add([ComponentsController]);
|
|
2611
2560
|
this._injector.get(ComponentsController);
|
|
2612
2561
|
registerDependencies(this._injector, [
|
|
2613
|
-
[SheetsFilterPanelService],
|
|
2562
|
+
[ISheetsFilterPanelService, { useClass: SheetsFilterPanelService }],
|
|
2614
2563
|
[SheetsFilterPermissionController],
|
|
2615
2564
|
[SheetsFilterUIDesktopController]
|
|
2616
2565
|
]);
|
|
@@ -2664,4 +2613,4 @@ UniverSheetsFilterUIWorkerPlugin = __decorate([
|
|
|
2664
2613
|
], UniverSheetsFilterUIWorkerPlugin);
|
|
2665
2614
|
|
|
2666
2615
|
//#endregion
|
|
2667
|
-
export { ChangeFilterByOperation, CloseFilterPanelOperation, OpenFilterPanelOperation, UniverSheetsFilterMobileUIPlugin, UniverSheetsFilterUIPlugin, UniverSheetsFilterUIWorkerPlugin };
|
|
2616
|
+
export { ChangeFilterByOperation, CloseFilterPanelOperation, OpenFilterPanelOperation, menuSchema as SheetsFilterUIMenuSchema, UniverSheetsFilterMobileUIPlugin, UniverSheetsFilterUIPlugin, UniverSheetsFilterUIWorkerPlugin };
|