@univerjs/sheets-filter-ui 1.0.0-alpha.2 → 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 +115 -166
- package/lib/es/index.js +116 -168
- package/lib/index.js +116 -168
- 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 +13 -13
package/lib/cjs/index.js
CHANGED
|
@@ -1479,7 +1479,7 @@ const OpenFilterPanelOperation = {
|
|
|
1479
1479
|
handler: (accessor, params) => {
|
|
1480
1480
|
const contextService = accessor.get(_univerjs_core.IContextService);
|
|
1481
1481
|
const sheetsFilterService = accessor.get(_univerjs_sheets_filter.SheetsFilterService);
|
|
1482
|
-
const sheetsFilterPanelService = accessor.get(
|
|
1482
|
+
const sheetsFilterPanelService = accessor.get(ISheetsFilterPanelService);
|
|
1483
1483
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
1484
1484
|
const editorBridgeService = accessor.has(_univerjs_sheets_ui.IEditorBridgeService) ? accessor.get(_univerjs_sheets_ui.IEditorBridgeService) : null;
|
|
1485
1485
|
if (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.isVisible().visible) commandService.syncExecuteCommand(_univerjs_sheets_ui.SetCellEditVisibleOperation.id, { visible: false });
|
|
@@ -1496,7 +1496,7 @@ const CloseFilterPanelOperation = {
|
|
|
1496
1496
|
type: _univerjs_core.CommandType.OPERATION,
|
|
1497
1497
|
handler: (accessor) => {
|
|
1498
1498
|
const contextService = accessor.get(_univerjs_core.IContextService);
|
|
1499
|
-
const sheetsFilterPanelService = accessor.get(
|
|
1499
|
+
const sheetsFilterPanelService = accessor.get(ISheetsFilterPanelService);
|
|
1500
1500
|
const layoutService = accessor.get(_univerjs_ui.ILayoutService, _univerjs_core.Quantity.OPTIONAL);
|
|
1501
1501
|
if (contextService.getContextValue("FILTER_PANEL_OPENED")) {
|
|
1502
1502
|
contextService.setContextValue(FILTER_PANEL_OPENED_KEY, false);
|
|
@@ -1511,14 +1511,73 @@ const ChangeFilterByOperation = {
|
|
|
1511
1511
|
type: _univerjs_core.CommandType.OPERATION,
|
|
1512
1512
|
handler: (accessor, params) => {
|
|
1513
1513
|
const { filterBy } = params;
|
|
1514
|
-
return accessor.get(
|
|
1514
|
+
return accessor.get(ISheetsFilterPanelService).changeFilterBy(filterBy);
|
|
1515
1515
|
}
|
|
1516
1516
|
};
|
|
1517
1517
|
|
|
1518
|
+
//#endregion
|
|
1519
|
+
//#region src/menu/sheets-filter.menu.ts
|
|
1520
|
+
function SmartToggleFilterMenuItemFactory(accessor) {
|
|
1521
|
+
const sheetsFilterService = accessor.get(_univerjs_sheets_filter.SheetsFilterService);
|
|
1522
|
+
return {
|
|
1523
|
+
id: _univerjs_sheets_filter.SmartToggleSheetsFilterCommand.id,
|
|
1524
|
+
type: _univerjs_ui.MenuItemType.BUTTON_SELECTOR,
|
|
1525
|
+
icon: "FilterIcon",
|
|
1526
|
+
tooltip: "sheets-filter-ui.toolbar.smart-toggle-filter-tooltip",
|
|
1527
|
+
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
|
|
1528
|
+
activated$: sheetsFilterService.activeFilterModel$.pipe((0, rxjs.map)((model) => !!model)),
|
|
1529
|
+
disabled$: (0, _univerjs_sheets_ui.getObservableWithExclusiveRange$)(accessor, (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {
|
|
1530
|
+
worksheetTypes: [_univerjs_sheets.WorksheetFilterPermission, _univerjs_sheets.WorksheetViewPermission],
|
|
1531
|
+
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint]
|
|
1532
|
+
}))
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
function ClearFilterCriteriaMenuItemFactory(accessor) {
|
|
1536
|
+
const sheetsFilterService = accessor.get(_univerjs_sheets_filter.SheetsFilterService);
|
|
1537
|
+
return {
|
|
1538
|
+
id: _univerjs_sheets_filter.ClearSheetsFilterCriteriaCommand.id,
|
|
1539
|
+
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
1540
|
+
title: "sheets-filter-ui.toolbar.clear-filter-criteria",
|
|
1541
|
+
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
|
|
1542
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe((0, rxjs.switchMap)((model) => {
|
|
1543
|
+
var _model$hasCriteria$$p;
|
|
1544
|
+
return (_model$hasCriteria$$p = model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe((0, rxjs.map)((m) => !m))) !== null && _model$hasCriteria$$p !== void 0 ? _model$hasCriteria$$p : (0, rxjs.of)(true);
|
|
1545
|
+
}))
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
function ReCalcFilterMenuItemFactory(accessor) {
|
|
1549
|
+
const sheetsFilterService = accessor.get(_univerjs_sheets_filter.SheetsFilterService);
|
|
1550
|
+
return {
|
|
1551
|
+
id: _univerjs_sheets_filter.ReCalcSheetsFilterCommand.id,
|
|
1552
|
+
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
1553
|
+
title: "sheets-filter-ui.toolbar.re-calc-filter-conditions",
|
|
1554
|
+
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
|
|
1555
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe((0, rxjs.switchMap)((model) => {
|
|
1556
|
+
var _model$hasCriteria$$p2;
|
|
1557
|
+
return (_model$hasCriteria$$p2 = model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe((0, rxjs.map)((m) => !m))) !== null && _model$hasCriteria$$p2 !== void 0 ? _model$hasCriteria$$p2 : (0, rxjs.of)(true);
|
|
1558
|
+
}))
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
//#endregion
|
|
1563
|
+
//#region src/menu/schema.ts
|
|
1564
|
+
const menuSchema = { [_univerjs_ui.RibbonDataGroup.ORGANIZATION]: { [_univerjs_sheets_filter.SmartToggleSheetsFilterCommand.id]: {
|
|
1565
|
+
order: 2,
|
|
1566
|
+
menuItemFactory: SmartToggleFilterMenuItemFactory,
|
|
1567
|
+
[_univerjs_sheets_filter.ClearSheetsFilterCriteriaCommand.id]: {
|
|
1568
|
+
order: 0,
|
|
1569
|
+
menuItemFactory: ClearFilterCriteriaMenuItemFactory
|
|
1570
|
+
},
|
|
1571
|
+
[_univerjs_sheets_filter.ReCalcSheetsFilterCommand.id]: {
|
|
1572
|
+
order: 1,
|
|
1573
|
+
menuItemFactory: ReCalcFilterMenuItemFactory
|
|
1574
|
+
}
|
|
1575
|
+
} } };
|
|
1576
|
+
|
|
1518
1577
|
//#endregion
|
|
1519
1578
|
//#region package.json
|
|
1520
1579
|
var name = "@univerjs/sheets-filter-ui";
|
|
1521
|
-
var version = "1.0.0-alpha.
|
|
1580
|
+
var version = "1.0.0-alpha.3";
|
|
1522
1581
|
|
|
1523
1582
|
//#endregion
|
|
1524
1583
|
//#region src/config/config.ts
|
|
@@ -1595,6 +1654,28 @@ function CheckedIcon() {
|
|
|
1595
1654
|
|
|
1596
1655
|
//#endregion
|
|
1597
1656
|
//#region src/views/components/SheetsFilterByConditionsPanel.tsx
|
|
1657
|
+
const PRIMARY_CONDITION_GROUPS = [
|
|
1658
|
+
[FilterConditionItems.NONE],
|
|
1659
|
+
[FilterConditionItems.EMPTY, FilterConditionItems.NOT_EMPTY],
|
|
1660
|
+
[
|
|
1661
|
+
FilterConditionItems.TEXT_CONTAINS,
|
|
1662
|
+
FilterConditionItems.DOES_NOT_CONTAIN,
|
|
1663
|
+
FilterConditionItems.STARTS_WITH,
|
|
1664
|
+
FilterConditionItems.ENDS_WITH,
|
|
1665
|
+
FilterConditionItems.EQUALS
|
|
1666
|
+
],
|
|
1667
|
+
[
|
|
1668
|
+
FilterConditionItems.GREATER_THAN,
|
|
1669
|
+
FilterConditionItems.GREATER_THAN_OR_EQUAL,
|
|
1670
|
+
FilterConditionItems.LESS_THAN,
|
|
1671
|
+
FilterConditionItems.LESS_THAN_OR_EQUAL,
|
|
1672
|
+
FilterConditionItems.EQUAL,
|
|
1673
|
+
FilterConditionItems.NOT_EQUAL,
|
|
1674
|
+
FilterConditionItems.BETWEEN,
|
|
1675
|
+
FilterConditionItems.NOT_BETWEEN
|
|
1676
|
+
],
|
|
1677
|
+
[FilterConditionItems.CUSTOM]
|
|
1678
|
+
];
|
|
1598
1679
|
/**
|
|
1599
1680
|
* Filter by conditions.
|
|
1600
1681
|
*/
|
|
@@ -1608,11 +1689,17 @@ function FilterByCondition(props) {
|
|
|
1608
1689
|
const onRadioChange = (0, react.useCallback)((key) => {
|
|
1609
1690
|
model.onConditionFormChange({ and: key === "AND" });
|
|
1610
1691
|
}, [model]);
|
|
1611
|
-
const primaryOptions =
|
|
1692
|
+
const primaryOptions = PRIMARY_CONDITION_GROUPS.map((group) => ({ options: group.map((conditionItem) => ({
|
|
1693
|
+
label: localeService.t(conditionItem.label),
|
|
1694
|
+
value: conditionItem.operator
|
|
1695
|
+
})) }));
|
|
1612
1696
|
const onPrimaryConditionChange = (0, react.useCallback)((value) => {
|
|
1613
1697
|
model.onPrimaryConditionChange(value);
|
|
1614
1698
|
}, [model]);
|
|
1615
|
-
const secondaryOptions =
|
|
1699
|
+
const secondaryOptions = FilterConditionItems.ALL_CONDITIONS.filter((conditionItem) => conditionItem.numOfParameters !== 2).map((conditionItem) => ({
|
|
1700
|
+
label: localeService.t(conditionItem.label),
|
|
1701
|
+
value: conditionItem.operator
|
|
1702
|
+
}));
|
|
1616
1703
|
const onFormParamsChange = (0, react.useCallback)((diffParams) => {
|
|
1617
1704
|
model.onConditionFormChange(diffParams);
|
|
1618
1705
|
}, [model]);
|
|
@@ -1670,87 +1757,6 @@ function FilterByCondition(props) {
|
|
|
1670
1757
|
}) : null] })
|
|
1671
1758
|
});
|
|
1672
1759
|
}
|
|
1673
|
-
function usePrimaryOptions(localeService) {
|
|
1674
|
-
return (0, react.useMemo)(() => [
|
|
1675
|
-
{ options: [{
|
|
1676
|
-
label: localeService.t(FilterConditionItems.NONE.label),
|
|
1677
|
-
value: FilterConditionItems.NONE.operator
|
|
1678
|
-
}] },
|
|
1679
|
-
{ options: [{
|
|
1680
|
-
label: localeService.t(FilterConditionItems.EMPTY.label),
|
|
1681
|
-
value: FilterConditionItems.EMPTY.operator
|
|
1682
|
-
}, {
|
|
1683
|
-
label: localeService.t(FilterConditionItems.NOT_EMPTY.label),
|
|
1684
|
-
value: FilterConditionItems.NOT_EMPTY.operator
|
|
1685
|
-
}] },
|
|
1686
|
-
{ options: [
|
|
1687
|
-
{
|
|
1688
|
-
label: localeService.t(FilterConditionItems.TEXT_CONTAINS.label),
|
|
1689
|
-
value: FilterConditionItems.TEXT_CONTAINS.operator
|
|
1690
|
-
},
|
|
1691
|
-
{
|
|
1692
|
-
label: localeService.t(FilterConditionItems.DOES_NOT_CONTAIN.label),
|
|
1693
|
-
value: FilterConditionItems.DOES_NOT_CONTAIN.operator
|
|
1694
|
-
},
|
|
1695
|
-
{
|
|
1696
|
-
label: localeService.t(FilterConditionItems.STARTS_WITH.label),
|
|
1697
|
-
value: FilterConditionItems.STARTS_WITH.operator
|
|
1698
|
-
},
|
|
1699
|
-
{
|
|
1700
|
-
label: localeService.t(FilterConditionItems.ENDS_WITH.label),
|
|
1701
|
-
value: FilterConditionItems.ENDS_WITH.operator
|
|
1702
|
-
},
|
|
1703
|
-
{
|
|
1704
|
-
label: localeService.t(FilterConditionItems.EQUALS.label),
|
|
1705
|
-
value: FilterConditionItems.EQUALS.operator
|
|
1706
|
-
}
|
|
1707
|
-
] },
|
|
1708
|
-
{ options: [
|
|
1709
|
-
{
|
|
1710
|
-
label: localeService.t(FilterConditionItems.GREATER_THAN.label),
|
|
1711
|
-
value: FilterConditionItems.GREATER_THAN.operator
|
|
1712
|
-
},
|
|
1713
|
-
{
|
|
1714
|
-
label: localeService.t(FilterConditionItems.GREATER_THAN_OR_EQUAL.label),
|
|
1715
|
-
value: FilterConditionItems.GREATER_THAN_OR_EQUAL.operator
|
|
1716
|
-
},
|
|
1717
|
-
{
|
|
1718
|
-
label: localeService.t(FilterConditionItems.LESS_THAN.label),
|
|
1719
|
-
value: FilterConditionItems.LESS_THAN.operator
|
|
1720
|
-
},
|
|
1721
|
-
{
|
|
1722
|
-
label: localeService.t(FilterConditionItems.LESS_THAN_OR_EQUAL.label),
|
|
1723
|
-
value: FilterConditionItems.LESS_THAN_OR_EQUAL.operator
|
|
1724
|
-
},
|
|
1725
|
-
{
|
|
1726
|
-
label: localeService.t(FilterConditionItems.EQUAL.label),
|
|
1727
|
-
value: FilterConditionItems.EQUAL.operator
|
|
1728
|
-
},
|
|
1729
|
-
{
|
|
1730
|
-
label: localeService.t(FilterConditionItems.NOT_EQUAL.label),
|
|
1731
|
-
value: FilterConditionItems.NOT_EQUAL.operator
|
|
1732
|
-
},
|
|
1733
|
-
{
|
|
1734
|
-
label: localeService.t(FilterConditionItems.BETWEEN.label),
|
|
1735
|
-
value: FilterConditionItems.BETWEEN.operator
|
|
1736
|
-
},
|
|
1737
|
-
{
|
|
1738
|
-
label: localeService.t(FilterConditionItems.NOT_BETWEEN.label),
|
|
1739
|
-
value: FilterConditionItems.NOT_BETWEEN.operator
|
|
1740
|
-
}
|
|
1741
|
-
] },
|
|
1742
|
-
{ options: [{
|
|
1743
|
-
label: localeService.t(FilterConditionItems.CUSTOM.label),
|
|
1744
|
-
value: FilterConditionItems.CUSTOM.operator
|
|
1745
|
-
}] }
|
|
1746
|
-
], [localeService.getCurrentLocale(), localeService]);
|
|
1747
|
-
}
|
|
1748
|
-
function useSecondaryOptions(localeService) {
|
|
1749
|
-
return (0, react.useMemo)(() => FilterConditionItems.ALL_CONDITIONS.filter((c) => c.numOfParameters !== 2).map((c) => ({
|
|
1750
|
-
label: localeService.t(c.label),
|
|
1751
|
-
value: c.operator
|
|
1752
|
-
})), [localeService.getCurrentLocale(), localeService]);
|
|
1753
|
-
}
|
|
1754
1760
|
|
|
1755
1761
|
//#endregion
|
|
1756
1762
|
//#region src/views/components/SheetsFilterByValuesPanel.tsx
|
|
@@ -1898,6 +1904,20 @@ function FilterSyncSwitch() {
|
|
|
1898
1904
|
|
|
1899
1905
|
//#endregion
|
|
1900
1906
|
//#region src/views/components/SheetsFilterPanel.tsx
|
|
1907
|
+
const FILTER_BY_OPTIONS = [
|
|
1908
|
+
{
|
|
1909
|
+
label: "sheets-filter-ui.panel.by-values",
|
|
1910
|
+
value: _univerjs_sheets_filter.FilterBy.VALUES
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
label: "sheets-filter-ui.panel.by-colors",
|
|
1914
|
+
value: _univerjs_sheets_filter.FilterBy.COLORS
|
|
1915
|
+
},
|
|
1916
|
+
{
|
|
1917
|
+
label: "sheets-filter-ui.panel.by-conditions",
|
|
1918
|
+
value: _univerjs_sheets_filter.FilterBy.CONDITIONS
|
|
1919
|
+
}
|
|
1920
|
+
];
|
|
1901
1921
|
/**
|
|
1902
1922
|
* This Filter Panel component is used to filter the data in the sheet.
|
|
1903
1923
|
*
|
|
@@ -1905,13 +1925,16 @@ function FilterSyncSwitch() {
|
|
|
1905
1925
|
*/
|
|
1906
1926
|
function FilterPanel() {
|
|
1907
1927
|
var _filterService$active;
|
|
1908
|
-
const sheetsFilterPanelService = (0, _univerjs_ui.useDependency)(
|
|
1928
|
+
const sheetsFilterPanelService = (0, _univerjs_ui.useDependency)(ISheetsFilterPanelService);
|
|
1909
1929
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
1910
1930
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
1911
1931
|
const filterBy = (0, _univerjs_ui.useObservable)(sheetsFilterPanelService.filterBy$, void 0, true);
|
|
1912
1932
|
const filterByModel = (0, _univerjs_ui.useObservable)(sheetsFilterPanelService.filterByModel$, void 0, false);
|
|
1913
1933
|
const canApply = (0, _univerjs_ui.useObservable)(() => (filterByModel === null || filterByModel === void 0 ? void 0 : filterByModel.canApply$) || (0, rxjs.of)(false), void 0, false, [filterByModel]);
|
|
1914
|
-
const items =
|
|
1934
|
+
const items = FILTER_BY_OPTIONS.map((option) => ({
|
|
1935
|
+
...option,
|
|
1936
|
+
label: localeService.t(option.label)
|
|
1937
|
+
}));
|
|
1915
1938
|
const clearFilterDisabled = !(0, _univerjs_ui.useObservable)(sheetsFilterPanelService.hasCriteria$);
|
|
1916
1939
|
const onFilterByTypeChange = (0, react.useCallback)((value) => {
|
|
1917
1940
|
commandService.executeCommand(ChangeFilterByOperation.id, { filterBy: value });
|
|
@@ -1981,22 +2004,6 @@ function FilterPanel() {
|
|
|
1981
2004
|
});
|
|
1982
2005
|
}
|
|
1983
2006
|
const FILTER_PANEL_POPUP_KEY = "FILTER_PANEL_POPUP";
|
|
1984
|
-
function useFilterByOptions(localeService) {
|
|
1985
|
-
return (0, react.useMemo)(() => [
|
|
1986
|
-
{
|
|
1987
|
-
label: localeService.t("sheets-filter-ui.panel.by-values"),
|
|
1988
|
-
value: _univerjs_sheets_filter.FilterBy.VALUES
|
|
1989
|
-
},
|
|
1990
|
-
{
|
|
1991
|
-
label: localeService.t("sheets-filter-ui.panel.by-colors"),
|
|
1992
|
-
value: _univerjs_sheets_filter.FilterBy.COLORS
|
|
1993
|
-
},
|
|
1994
|
-
{
|
|
1995
|
-
label: localeService.t("sheets-filter-ui.panel.by-conditions"),
|
|
1996
|
-
value: _univerjs_sheets_filter.FilterBy.CONDITIONS
|
|
1997
|
-
}
|
|
1998
|
-
], [localeService.getCurrentLocale(), localeService]);
|
|
1999
|
-
}
|
|
2000
2007
|
|
|
2001
2008
|
//#endregion
|
|
2002
2009
|
//#region src/controllers/components.controller.ts
|
|
@@ -2435,65 +2442,6 @@ UniverSheetsFilterMobileUIPlugin = __decorate([
|
|
|
2435
2442
|
__decorateParam(2, _univerjs_core.IConfigService)
|
|
2436
2443
|
], UniverSheetsFilterMobileUIPlugin);
|
|
2437
2444
|
|
|
2438
|
-
//#endregion
|
|
2439
|
-
//#region src/menu/sheets-filter.menu.ts
|
|
2440
|
-
function SmartToggleFilterMenuItemFactory(accessor) {
|
|
2441
|
-
const sheetsFilterService = accessor.get(_univerjs_sheets_filter.SheetsFilterService);
|
|
2442
|
-
return {
|
|
2443
|
-
id: _univerjs_sheets_filter.SmartToggleSheetsFilterCommand.id,
|
|
2444
|
-
type: _univerjs_ui.MenuItemType.BUTTON_SELECTOR,
|
|
2445
|
-
icon: "FilterIcon",
|
|
2446
|
-
tooltip: "sheets-filter-ui.toolbar.smart-toggle-filter-tooltip",
|
|
2447
|
-
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
|
|
2448
|
-
activated$: sheetsFilterService.activeFilterModel$.pipe((0, rxjs.map)((model) => !!model)),
|
|
2449
|
-
disabled$: (0, _univerjs_sheets_ui.getObservableWithExclusiveRange$)(accessor, (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {
|
|
2450
|
-
worksheetTypes: [_univerjs_sheets.WorksheetFilterPermission, _univerjs_sheets.WorksheetViewPermission],
|
|
2451
|
-
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint]
|
|
2452
|
-
}))
|
|
2453
|
-
};
|
|
2454
|
-
}
|
|
2455
|
-
function ClearFilterCriteriaMenuItemFactory(accessor) {
|
|
2456
|
-
const sheetsFilterService = accessor.get(_univerjs_sheets_filter.SheetsFilterService);
|
|
2457
|
-
return {
|
|
2458
|
-
id: _univerjs_sheets_filter.ClearSheetsFilterCriteriaCommand.id,
|
|
2459
|
-
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
2460
|
-
title: "sheets-filter-ui.toolbar.clear-filter-criteria",
|
|
2461
|
-
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
|
|
2462
|
-
disabled$: sheetsFilterService.activeFilterModel$.pipe((0, rxjs.switchMap)((model) => {
|
|
2463
|
-
var _model$hasCriteria$$p;
|
|
2464
|
-
return (_model$hasCriteria$$p = model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe((0, rxjs.map)((m) => !m))) !== null && _model$hasCriteria$$p !== void 0 ? _model$hasCriteria$$p : (0, rxjs.of)(true);
|
|
2465
|
-
}))
|
|
2466
|
-
};
|
|
2467
|
-
}
|
|
2468
|
-
function ReCalcFilterMenuItemFactory(accessor) {
|
|
2469
|
-
const sheetsFilterService = accessor.get(_univerjs_sheets_filter.SheetsFilterService);
|
|
2470
|
-
return {
|
|
2471
|
-
id: _univerjs_sheets_filter.ReCalcSheetsFilterCommand.id,
|
|
2472
|
-
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
2473
|
-
title: "sheets-filter-ui.toolbar.re-calc-filter-conditions",
|
|
2474
|
-
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
|
|
2475
|
-
disabled$: sheetsFilterService.activeFilterModel$.pipe((0, rxjs.switchMap)((model) => {
|
|
2476
|
-
var _model$hasCriteria$$p2;
|
|
2477
|
-
return (_model$hasCriteria$$p2 = model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe((0, rxjs.map)((m) => !m))) !== null && _model$hasCriteria$$p2 !== void 0 ? _model$hasCriteria$$p2 : (0, rxjs.of)(true);
|
|
2478
|
-
}))
|
|
2479
|
-
};
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
//#endregion
|
|
2483
|
-
//#region src/menu/schema.ts
|
|
2484
|
-
const menuSchema = { [_univerjs_ui.RibbonDataGroup.ORGANIZATION]: { [_univerjs_sheets_filter.SmartToggleSheetsFilterCommand.id]: {
|
|
2485
|
-
order: 2,
|
|
2486
|
-
menuItemFactory: SmartToggleFilterMenuItemFactory,
|
|
2487
|
-
[_univerjs_sheets_filter.ClearSheetsFilterCriteriaCommand.id]: {
|
|
2488
|
-
order: 0,
|
|
2489
|
-
menuItemFactory: ClearFilterCriteriaMenuItemFactory
|
|
2490
|
-
},
|
|
2491
|
-
[_univerjs_sheets_filter.ReCalcSheetsFilterCommand.id]: {
|
|
2492
|
-
order: 1,
|
|
2493
|
-
menuItemFactory: ReCalcFilterMenuItemFactory
|
|
2494
|
-
}
|
|
2495
|
-
} } };
|
|
2496
|
-
|
|
2497
2445
|
//#endregion
|
|
2498
2446
|
//#region src/controllers/sheets-filter.shortcut.ts
|
|
2499
2447
|
const SmartToggleFilterShortcut = {
|
|
@@ -2581,7 +2529,7 @@ let SheetsFilterUIDesktopController = class SheetsFilterUIDesktopController exte
|
|
|
2581
2529
|
};
|
|
2582
2530
|
SheetsFilterUIDesktopController = __decorate([
|
|
2583
2531
|
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
2584
|
-
__decorateParam(1,
|
|
2532
|
+
__decorateParam(1, ISheetsFilterPanelService),
|
|
2585
2533
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetCanvasPopManagerService)),
|
|
2586
2534
|
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets_filter.SheetsFilterService)),
|
|
2587
2535
|
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
|
|
@@ -2611,7 +2559,7 @@ let UniverSheetsFilterUIPlugin = class UniverSheetsFilterUIPlugin extends _unive
|
|
|
2611
2559
|
this._injector.add([ComponentsController]);
|
|
2612
2560
|
this._injector.get(ComponentsController);
|
|
2613
2561
|
(0, _univerjs_core.registerDependencies)(this._injector, [
|
|
2614
|
-
[SheetsFilterPanelService],
|
|
2562
|
+
[ISheetsFilterPanelService, { useClass: SheetsFilterPanelService }],
|
|
2615
2563
|
[SheetsFilterPermissionController],
|
|
2616
2564
|
[SheetsFilterUIDesktopController]
|
|
2617
2565
|
]);
|
|
@@ -2668,6 +2616,7 @@ UniverSheetsFilterUIWorkerPlugin = __decorate([
|
|
|
2668
2616
|
exports.ChangeFilterByOperation = ChangeFilterByOperation;
|
|
2669
2617
|
exports.CloseFilterPanelOperation = CloseFilterPanelOperation;
|
|
2670
2618
|
exports.OpenFilterPanelOperation = OpenFilterPanelOperation;
|
|
2619
|
+
exports.SheetsFilterUIMenuSchema = menuSchema;
|
|
2671
2620
|
Object.defineProperty(exports, 'UniverSheetsFilterMobileUIPlugin', {
|
|
2672
2621
|
enumerable: true,
|
|
2673
2622
|
get: function () {
|