@univerjs/sheets-filter-ui 1.0.0-alpha.1 → 1.0.0-alpha.3
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 +124 -168
- package/lib/es/index.js +125 -170
- package/lib/index.js +125 -170
- 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/types/worker/plugin.d.ts +4 -2
- 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.3";
|
|
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
|
|
@@ -1897,6 +1903,20 @@ function FilterSyncSwitch() {
|
|
|
1897
1903
|
|
|
1898
1904
|
//#endregion
|
|
1899
1905
|
//#region src/views/components/SheetsFilterPanel.tsx
|
|
1906
|
+
const FILTER_BY_OPTIONS = [
|
|
1907
|
+
{
|
|
1908
|
+
label: "sheets-filter-ui.panel.by-values",
|
|
1909
|
+
value: FilterBy.VALUES
|
|
1910
|
+
},
|
|
1911
|
+
{
|
|
1912
|
+
label: "sheets-filter-ui.panel.by-colors",
|
|
1913
|
+
value: FilterBy.COLORS
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
label: "sheets-filter-ui.panel.by-conditions",
|
|
1917
|
+
value: FilterBy.CONDITIONS
|
|
1918
|
+
}
|
|
1919
|
+
];
|
|
1900
1920
|
/**
|
|
1901
1921
|
* This Filter Panel component is used to filter the data in the sheet.
|
|
1902
1922
|
*
|
|
@@ -1904,13 +1924,16 @@ function FilterSyncSwitch() {
|
|
|
1904
1924
|
*/
|
|
1905
1925
|
function FilterPanel() {
|
|
1906
1926
|
var _filterService$active;
|
|
1907
|
-
const sheetsFilterPanelService = useDependency(
|
|
1927
|
+
const sheetsFilterPanelService = useDependency(ISheetsFilterPanelService);
|
|
1908
1928
|
const localeService = useDependency(LocaleService);
|
|
1909
1929
|
const commandService = useDependency(ICommandService);
|
|
1910
1930
|
const filterBy = useObservable(sheetsFilterPanelService.filterBy$, void 0, true);
|
|
1911
1931
|
const filterByModel = useObservable(sheetsFilterPanelService.filterByModel$, void 0, false);
|
|
1912
1932
|
const canApply = useObservable(() => (filterByModel === null || filterByModel === void 0 ? void 0 : filterByModel.canApply$) || of(false), void 0, false, [filterByModel]);
|
|
1913
|
-
const items =
|
|
1933
|
+
const items = FILTER_BY_OPTIONS.map((option) => ({
|
|
1934
|
+
...option,
|
|
1935
|
+
label: localeService.t(option.label)
|
|
1936
|
+
}));
|
|
1914
1937
|
const clearFilterDisabled = !useObservable(sheetsFilterPanelService.hasCriteria$);
|
|
1915
1938
|
const onFilterByTypeChange = useCallback((value) => {
|
|
1916
1939
|
commandService.executeCommand(ChangeFilterByOperation.id, { filterBy: value });
|
|
@@ -1980,22 +2003,6 @@ function FilterPanel() {
|
|
|
1980
2003
|
});
|
|
1981
2004
|
}
|
|
1982
2005
|
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
2006
|
|
|
2000
2007
|
//#endregion
|
|
2001
2008
|
//#region src/controllers/components.controller.ts
|
|
@@ -2434,65 +2441,6 @@ UniverSheetsFilterMobileUIPlugin = __decorate([
|
|
|
2434
2441
|
__decorateParam(2, IConfigService)
|
|
2435
2442
|
], UniverSheetsFilterMobileUIPlugin);
|
|
2436
2443
|
|
|
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
2444
|
//#endregion
|
|
2497
2445
|
//#region src/controllers/sheets-filter.shortcut.ts
|
|
2498
2446
|
const SmartToggleFilterShortcut = {
|
|
@@ -2580,7 +2528,7 @@ let SheetsFilterUIDesktopController = class SheetsFilterUIDesktopController exte
|
|
|
2580
2528
|
};
|
|
2581
2529
|
SheetsFilterUIDesktopController = __decorate([
|
|
2582
2530
|
__decorateParam(0, Inject(Injector)),
|
|
2583
|
-
__decorateParam(1,
|
|
2531
|
+
__decorateParam(1, ISheetsFilterPanelService),
|
|
2584
2532
|
__decorateParam(2, Inject(SheetCanvasPopManagerService)),
|
|
2585
2533
|
__decorateParam(3, Inject(SheetsFilterService)),
|
|
2586
2534
|
__decorateParam(4, Inject(LocaleService)),
|
|
@@ -2610,7 +2558,7 @@ let UniverSheetsFilterUIPlugin = class UniverSheetsFilterUIPlugin extends Plugin
|
|
|
2610
2558
|
this._injector.add([ComponentsController]);
|
|
2611
2559
|
this._injector.get(ComponentsController);
|
|
2612
2560
|
registerDependencies(this._injector, [
|
|
2613
|
-
[SheetsFilterPanelService],
|
|
2561
|
+
[ISheetsFilterPanelService, { useClass: SheetsFilterPanelService }],
|
|
2614
2562
|
[SheetsFilterPermissionController],
|
|
2615
2563
|
[SheetsFilterUIDesktopController]
|
|
2616
2564
|
]);
|
|
@@ -2637,11 +2585,14 @@ UniverSheetsFilterUIPlugin = __decorate([
|
|
|
2637
2585
|
//#endregion
|
|
2638
2586
|
//#region src/worker/plugin.ts
|
|
2639
2587
|
let UniverSheetsFilterUIWorkerPlugin = class UniverSheetsFilterUIWorkerPlugin extends Plugin {
|
|
2640
|
-
constructor(_config, _injector, _rpcChannelService) {
|
|
2588
|
+
constructor(_config = defaultPluginConfig, _injector, _configService, _rpcChannelService) {
|
|
2641
2589
|
super();
|
|
2642
2590
|
this._config = _config;
|
|
2643
2591
|
this._injector = _injector;
|
|
2592
|
+
this._configService = _configService;
|
|
2644
2593
|
this._rpcChannelService = _rpcChannelService;
|
|
2594
|
+
const { ...rest } = merge({}, defaultPluginConfig, this._config);
|
|
2595
|
+
this._configService.setConfig(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, rest);
|
|
2645
2596
|
}
|
|
2646
2597
|
onStarting() {
|
|
2647
2598
|
[[ISheetsGenerateFilterValuesService, { useClass: SheetsGenerateFilterValuesService }]].forEach((d) => this._injector.add(d));
|
|
@@ -2654,7 +2605,11 @@ _defineProperty(UniverSheetsFilterUIWorkerPlugin, "type", UniverInstanceType.UNI
|
|
|
2654
2605
|
_defineProperty(UniverSheetsFilterUIWorkerPlugin, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN");
|
|
2655
2606
|
_defineProperty(UniverSheetsFilterUIWorkerPlugin, "packageName", name);
|
|
2656
2607
|
_defineProperty(UniverSheetsFilterUIWorkerPlugin, "version", version);
|
|
2657
|
-
UniverSheetsFilterUIWorkerPlugin = __decorate([
|
|
2608
|
+
UniverSheetsFilterUIWorkerPlugin = __decorate([
|
|
2609
|
+
__decorateParam(1, Inject(Injector)),
|
|
2610
|
+
__decorateParam(2, IConfigService),
|
|
2611
|
+
__decorateParam(3, IRPCChannelService)
|
|
2612
|
+
], UniverSheetsFilterUIWorkerPlugin);
|
|
2658
2613
|
|
|
2659
2614
|
//#endregion
|
|
2660
|
-
export { ChangeFilterByOperation, CloseFilterPanelOperation, OpenFilterPanelOperation, UniverSheetsFilterMobileUIPlugin, UniverSheetsFilterUIPlugin, UniverSheetsFilterUIWorkerPlugin };
|
|
2615
|
+
export { ChangeFilterByOperation, CloseFilterPanelOperation, OpenFilterPanelOperation, menuSchema as SheetsFilterUIMenuSchema, UniverSheetsFilterMobileUIPlugin, UniverSheetsFilterUIPlugin, UniverSheetsFilterUIWorkerPlugin };
|