@univerjs/sheets-filter-ui 0.5.4 → 0.5.5-experimental.20250123-34738ff

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.
Files changed (35) hide show
  1. package/lib/cjs/index.js +1 -9
  2. package/lib/cjs/locale/en-US.js +1 -1
  3. package/lib/cjs/locale/fa-IR.js +1 -1
  4. package/lib/cjs/locale/fr-FR.js +1 -1
  5. package/lib/cjs/locale/ru-RU.js +1 -1
  6. package/lib/cjs/locale/vi-VN.js +1 -1
  7. package/lib/cjs/locale/zh-CN.js +1 -1
  8. package/lib/cjs/locale/zh-TW.js +1 -1
  9. package/lib/es/index.js +1344 -1338
  10. package/lib/es/locale/en-US.js +2 -2
  11. package/lib/es/locale/fa-IR.js +2 -2
  12. package/lib/es/locale/fr-FR.js +2 -2
  13. package/lib/es/locale/ru-RU.js +2 -2
  14. package/lib/es/locale/vi-VN.js +2 -2
  15. package/lib/es/locale/zh-CN.js +2 -2
  16. package/lib/es/locale/zh-TW.js +2 -2
  17. package/lib/types/views/components/SheetsFilterByConditionsPanel.d.ts +1 -2
  18. package/lib/types/views/components/SheetsFilterByValuesPanel.d.ts +1 -2
  19. package/lib/types/views/components/SheetsFilterPanel.d.ts +16 -2
  20. package/lib/types/views/components/SheetsFilterPanel.stories.d.ts +3 -4
  21. package/lib/umd/index.js +1 -9
  22. package/lib/umd/locale/en-US.js +1 -1
  23. package/lib/umd/locale/fa-IR.js +1 -1
  24. package/lib/umd/locale/fr-FR.js +1 -1
  25. package/lib/umd/locale/ru-RU.js +1 -1
  26. package/lib/umd/locale/vi-VN.js +1 -1
  27. package/lib/umd/locale/zh-CN.js +1 -1
  28. package/lib/umd/locale/zh-TW.js +1 -1
  29. package/package.json +13 -13
  30. package/LICENSE +0 -176
  31. package/lib/types/commands/commands/__tests__/sheets-filter.command.spec.d.ts +0 -16
  32. package/lib/types/commands/operations/__tests__/sheets-filter.operation.spec.d.ts +0 -16
  33. package/lib/types/controllers/__tests__/sheets-filter.menu.spec.d.ts +0 -16
  34. package/lib/types/models/__tests__/conditions.spec.d.ts +0 -16
  35. package/lib/types/services/__tests__/sheets-filter-panel.service.spec.d.ts +0 -16
package/lib/es/index.js CHANGED
@@ -1,688 +1,701 @@
1
- var Kt = Object.defineProperty;
2
- var Xt = (t, e, r) => e in t ? Kt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var _ = (t, e, r) => Xt(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { BooleanNumber as nt, createIdentifier as gt, Inject as E, LocaleService as K, Disposable as pe, IUniverInstanceService as Ye, ILogService as Zt, extractPureTextFromCell as Jt, numfmt as it, Injector as X, ICommandService as W, Quantity as vt, Tools as Fe, CommandType as $e, IContextService as we, useDependency as te, UniverInstanceType as Z, ThemeService as Et, RxDisposable as Tt, fromCallback as zt, InterceptorEffectEnum as er, DependentOn as Ft, Optional as tr, Plugin as qe, merge as Ct, IConfigService as Nt } from "@univerjs/core";
5
- import { IRPCChannelService as Pt, toModule as rr, fromModule as sr } from "@univerjs/rpc";
6
- import { CustomFilterOperator as u, SetSheetsFilterCriteriaCommand as re, SheetsFilterService as k, SmartToggleSheetsFilterCommand as me, ClearSheetsFilterCriteriaCommand as Ke, ReCalcSheetsFilterCommand as Xe, FILTER_MUTATIONS as nr, SetSheetsFilterRangeMutation as ir, SetSheetsFilterCriteriaMutation as or, RemoveSheetsFilterMutation as ar, ReCalcSheetsFilterMutation as lr, RemoveSheetFilterCommand as cr, SetSheetFilterRangeCommand as ur, UniverSheetsFilterPlugin as Ot } from "@univerjs/sheets-filter";
7
- import { RefRangeService as hr, SheetPermissionCheckController as dr, SheetsSelectionsService as fr, getSheetCommandTarget as pr, RangeProtectionPermissionViewPoint as le, WorksheetFilterPermission as ce, WorksheetViewPermission as ue, expandToContinuousRange as mr, SheetInterceptorService as _r, SetRangeValuesMutation as Sr, INTERCEPTOR_POINT as gr } from "@univerjs/sheets";
8
- import { ILayoutService as vr, useObservable as V, useComponentsOfPart as Er, ComponentContainer as Tr, MenuItemType as Ze, getMenuHiddenObservable as Je, RibbonStartGroup as Fr, KeyCode as Cr, MetaKeys as ot, ComponentManager as Nr, IShortcutService as Pr, IMenuManagerService as Or, IMessageService as Rr } from "@univerjs/ui";
9
- import { SetCellEditVisibleOperation as Ir, SheetsUIPart as yr, getObservableWithExclusiveRange$ as Ar, getCurrentRangeDisable$ as br, whenSheetEditorFocused as Lr, SheetSkeletonManagerService as Mr, ISheetSelectionRenderService as $r, SelectionControl as wr, attachSelectionWithCoord as Ur, getCoordByCell as Hr, SheetsRenderService as Rt, SheetCanvasPopManagerService as Dr } from "@univerjs/sheets-ui";
10
- import { BehaviorSubject as q, ReplaySubject as xr, of as _e, Subject as Br, merge as Vr, combineLatest as jr, throttleTime as It, startWith as yt, map as se, shareReplay as Wr, switchMap as ze, filter as kr, takeUntil as Qr, distinctUntilChanged as Gr } from "rxjs";
11
- import { Select as at, RadioGroup as Yr, Radio as lt, Input as At, Checkbox as qr, Tree as Kr, Button as Ce, Segmented as Xr, MessageType as Zr } from "@univerjs/design";
12
- import { Rect as ct, Shape as Jr, IRenderManagerService as bt } from "@univerjs/engine-render";
13
- import zr, { forwardRef as Lt, useRef as es, createElement as Mt, useCallback as D, useMemo as et } from "react";
14
- const $t = "sheets-filter-ui.config", Ne = {};
15
- var N = /* @__PURE__ */ ((t) => (t[t.FIRST = 0] = "FIRST", t[t.SECOND = 1] = "SECOND", t))(N || {}), S = /* @__PURE__ */ ((t) => (t.NONE = "none", t.STARTS_WITH = "startsWith", t.DOES_NOT_START_WITH = "doesNotStartWith", t.ENDS_WITH = "endsWith", t.DOES_NOT_END_WITH = "doesNotEndWith", t.CONTAINS = "contains", t.DOES_NOT_CONTAIN = "doesNotContain", t.EQUALS = "equals", t.NOT_EQUALS = "notEquals", t.EMPTY = "empty", t.NOT_EMPTY = "notEmpty", t.BETWEEN = "between", t.NOT_BETWEEN = "notBetween", t.CUSTOM = "custom", t))(S || {}), f;
16
- ((t) => {
17
- t.NONE = {
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
+ import { BooleanNumber, createIdentifier, Inject, LocaleService, Disposable, IUniverInstanceService, ILogService, extractPureTextFromCell, numfmt, Injector, ICommandService, Quantity, Tools, CommandType, IContextService, useDependency, UniverInstanceType, ThemeService, RxDisposable, fromCallback, InterceptorEffectEnum, DependentOn, Optional, Plugin, merge as merge$1, IConfigService } from "@univerjs/core";
6
+ import { IRPCChannelService, toModule, fromModule } from "@univerjs/rpc";
7
+ import { CustomFilterOperator, SetSheetsFilterCriteriaCommand, SheetsFilterService, SmartToggleSheetsFilterCommand, ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, FILTER_MUTATIONS, SetSheetsFilterRangeMutation, SetSheetsFilterCriteriaMutation, RemoveSheetsFilterMutation, ReCalcSheetsFilterMutation, RemoveSheetFilterCommand, SetSheetFilterRangeCommand, UniverSheetsFilterPlugin } from "@univerjs/sheets-filter";
8
+ import { RefRangeService, SheetPermissionCheckController, SheetsSelectionsService, getSheetCommandTarget, RangeProtectionPermissionViewPoint, WorksheetFilterPermission, WorksheetViewPermission, expandToContinuousRange, SheetInterceptorService, SetRangeValuesMutation, INTERCEPTOR_POINT } from "@univerjs/sheets";
9
+ import { ILayoutService, useObservable, useComponentsOfPart, ComponentContainer, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, KeyCode, MetaKeys, ComponentManager, IShortcutService, IMenuManagerService, IMessageService } from "@univerjs/ui";
10
+ import { SetCellEditVisibleOperation, SheetsUIPart, getObservableWithExclusiveRange$, getCurrentRangeDisable$, SheetSkeletonManagerService, ISheetSelectionRenderService, SelectionControl, attachSelectionWithCoord, getCoordByCell, SheetsRenderService, whenSheetEditorFocused, SheetCanvasPopManagerService } from "@univerjs/sheets-ui";
11
+ import { BehaviorSubject, ReplaySubject, of, Subject, merge, combineLatest, throttleTime, startWith, map, shareReplay, switchMap, filter, takeUntil, distinctUntilChanged } from "rxjs";
12
+ import { Select, RadioGroup, Radio, Input, Checkbox, Tree, Button, Segmented, MessageType } from "@univerjs/design";
13
+ import { Rect, Shape, IRenderManagerService } from "@univerjs/engine-render";
14
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
15
+ import { forwardRef, useRef, createElement, useCallback, useMemo } from "react";
16
+ const SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY = "sheets-filter-ui.config", defaultPluginConfig = {};
17
+ var OperatorOrder = /* @__PURE__ */ ((OperatorOrder2) => (OperatorOrder2[OperatorOrder2.FIRST = 0] = "FIRST", OperatorOrder2[OperatorOrder2.SECOND = 1] = "SECOND", OperatorOrder2))(OperatorOrder || {}), ExtendCustomFilterOperator = /* @__PURE__ */ ((ExtendCustomFilterOperator2) => (ExtendCustomFilterOperator2.NONE = "none", ExtendCustomFilterOperator2.STARTS_WITH = "startsWith", ExtendCustomFilterOperator2.DOES_NOT_START_WITH = "doesNotStartWith", ExtendCustomFilterOperator2.ENDS_WITH = "endsWith", ExtendCustomFilterOperator2.DOES_NOT_END_WITH = "doesNotEndWith", ExtendCustomFilterOperator2.CONTAINS = "contains", ExtendCustomFilterOperator2.DOES_NOT_CONTAIN = "doesNotContain", ExtendCustomFilterOperator2.EQUALS = "equals", ExtendCustomFilterOperator2.NOT_EQUALS = "notEquals", ExtendCustomFilterOperator2.EMPTY = "empty", ExtendCustomFilterOperator2.NOT_EMPTY = "notEmpty", ExtendCustomFilterOperator2.BETWEEN = "between", ExtendCustomFilterOperator2.NOT_BETWEEN = "notBetween", ExtendCustomFilterOperator2.CUSTOM = "custom", ExtendCustomFilterOperator2))(ExtendCustomFilterOperator || {}), FilterConditionItems;
18
+ ((FilterConditionItems2) => {
19
+ FilterConditionItems2.NONE = {
18
20
  label: "sheets-filter.conditions.none",
19
- operator: S.NONE,
20
- order: N.SECOND,
21
+ operator: ExtendCustomFilterOperator.NONE,
22
+ order: OperatorOrder.SECOND,
21
23
  numOfParameters: 0,
22
- getDefaultFormParams: () => {
24
+ getDefaultFormParams: /* @__PURE__ */ __name(() => {
23
25
  throw new Error("[FilterConditionItems.NONE]: should not have initial form params!");
24
- },
25
- testMappingParams: (s) => s.operator1 === S.NONE,
26
- mapToFilterColumn: () => null,
27
- testMappingFilterColumn: (s) => !s.customFilters && !s.filters ? {} : !1
28
- }, t.EMPTY = {
26
+ }, "getDefaultFormParams"),
27
+ testMappingParams: /* @__PURE__ */ __name((params) => params.operator1 === ExtendCustomFilterOperator.NONE, "testMappingParams"),
28
+ mapToFilterColumn: /* @__PURE__ */ __name(() => null, "mapToFilterColumn"),
29
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => !filterColumn.customFilters && !filterColumn.filters ? {} : !1, "testMappingFilterColumn")
30
+ }, FilterConditionItems2.EMPTY = {
29
31
  label: "sheets-filter.conditions.empty",
30
- operator: S.EMPTY,
31
- order: N.SECOND,
32
+ operator: ExtendCustomFilterOperator.EMPTY,
33
+ order: OperatorOrder.SECOND,
32
34
  numOfParameters: 0,
33
- getDefaultFormParams: () => {
35
+ getDefaultFormParams: /* @__PURE__ */ __name(() => {
34
36
  throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!");
35
- },
36
- testMappingParams: ({ operator1: s }) => s === S.EMPTY,
37
- mapToFilterColumn: () => ({ customFilters: { customFilters: [{ val: "" }] } }),
38
- testMappingFilterColumn: (s) => {
39
- var c;
40
- if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
37
+ }, "getDefaultFormParams"),
38
+ testMappingParams: /* @__PURE__ */ __name(({ operator1 }) => operator1 === ExtendCustomFilterOperator.EMPTY, "testMappingParams"),
39
+ mapToFilterColumn: /* @__PURE__ */ __name(() => ({ customFilters: { customFilters: [{ val: "" }] } }), "mapToFilterColumn"),
40
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
41
+ var _a13;
42
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
41
43
  return !1;
42
- const o = s.customFilters.customFilters[0];
43
- return o.val === "" && o.operator === void 0 ? { operator1: S.EMPTY } : !1;
44
- }
45
- }, t.NOT_EMPTY = {
44
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0];
45
+ return firstCustomFilter.val === "" && firstCustomFilter.operator === void 0 ? { operator1: ExtendCustomFilterOperator.EMPTY } : !1;
46
+ }, "testMappingFilterColumn")
47
+ }, FilterConditionItems2.NOT_EMPTY = {
46
48
  label: "sheets-filter.conditions.not-empty",
47
- operator: S.NOT_EMPTY,
48
- order: N.SECOND,
49
+ operator: ExtendCustomFilterOperator.NOT_EMPTY,
50
+ order: OperatorOrder.SECOND,
49
51
  numOfParameters: 0,
50
- getDefaultFormParams: () => {
52
+ getDefaultFormParams: /* @__PURE__ */ __name(() => {
51
53
  throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!");
52
- },
53
- testMappingParams: ({ operator1: s }) => s === S.NOT_EMPTY,
54
- mapToFilterColumn: () => ({ customFilters: { customFilters: [{ val: "", operator: u.NOT_EQUALS }] } }),
55
- testMappingFilterColumn: (s) => {
56
- var c;
57
- if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
54
+ }, "getDefaultFormParams"),
55
+ testMappingParams: /* @__PURE__ */ __name(({ operator1 }) => operator1 === ExtendCustomFilterOperator.NOT_EMPTY, "testMappingParams"),
56
+ mapToFilterColumn: /* @__PURE__ */ __name(() => ({ customFilters: { customFilters: [{ val: "", operator: CustomFilterOperator.NOT_EQUALS }] } }), "mapToFilterColumn"),
57
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
58
+ var _a13;
59
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
58
60
  return !1;
59
- const o = s.customFilters.customFilters[0];
60
- return o.val === " " && o.operator === u.NOT_EQUALS ? { operator1: S.NOT_EMPTY } : !1;
61
- }
62
- }, t.TEXT_CONTAINS = {
61
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0];
62
+ return firstCustomFilter.val === " " && firstCustomFilter.operator === CustomFilterOperator.NOT_EQUALS ? { operator1: ExtendCustomFilterOperator.NOT_EMPTY } : !1;
63
+ }, "testMappingFilterColumn")
64
+ }, FilterConditionItems2.TEXT_CONTAINS = {
63
65
  label: "sheets-filter.conditions.text-contains",
64
- operator: S.CONTAINS,
65
- order: N.FIRST,
66
+ operator: ExtendCustomFilterOperator.CONTAINS,
67
+ order: OperatorOrder.FIRST,
66
68
  numOfParameters: 1,
67
- getDefaultFormParams: () => ({ operator1: S.CONTAINS, val1: "" }),
68
- testMappingParams: (s) => {
69
- const [o] = L(s);
70
- return o === S.CONTAINS;
71
- },
72
- mapToFilterColumn: (s) => {
73
- const { val1: o } = s;
74
- return o === "" ? null : {
75
- customFilters: { customFilters: [{ val: `*${o}*` }] }
69
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: ExtendCustomFilterOperator.CONTAINS, val1: "" }), "getDefaultFormParams"),
70
+ testMappingParams: /* @__PURE__ */ __name((params) => {
71
+ const [op] = getOnlyOperatorAndVal(params);
72
+ return op === ExtendCustomFilterOperator.CONTAINS;
73
+ }, "testMappingParams"),
74
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => {
75
+ const { val1 } = mapParams;
76
+ return val1 === "" ? null : {
77
+ customFilters: { customFilters: [{ val: `*${val1}*` }] }
76
78
  };
77
- },
78
- testMappingFilterColumn: (s) => {
79
- var c;
80
- if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
79
+ }, "mapToFilterColumn"),
80
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
81
+ var _a13;
82
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
81
83
  return !1;
82
- const o = s.customFilters.customFilters[0], a = o.val.toString();
83
- return !o.operator && a.startsWith("*") && a.endsWith("*") ? { operator1: S.CONTAINS, val1: a.slice(1, -1) } : !1;
84
- }
85
- }, t.DOES_NOT_CONTAIN = {
84
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0], valAsString = firstCustomFilter.val.toString();
85
+ return !firstCustomFilter.operator && valAsString.startsWith("*") && valAsString.endsWith("*") ? { operator1: ExtendCustomFilterOperator.CONTAINS, val1: valAsString.slice(1, -1) } : !1;
86
+ }, "testMappingFilterColumn")
87
+ }, FilterConditionItems2.DOES_NOT_CONTAIN = {
86
88
  label: "sheets-filter.conditions.does-not-contain",
87
- operator: S.DOES_NOT_CONTAIN,
88
- order: N.FIRST,
89
+ operator: ExtendCustomFilterOperator.DOES_NOT_CONTAIN,
90
+ order: OperatorOrder.FIRST,
89
91
  numOfParameters: 1,
90
- getDefaultFormParams: () => ({ operator1: S.DOES_NOT_CONTAIN, val1: "" }),
91
- mapToFilterColumn: (s) => ({
92
- customFilters: { customFilters: [{ val: `*${s.val1}*`, operator: u.NOT_EQUALS }] }
93
- }),
94
- testMappingParams: (s) => {
95
- const [o] = L(s);
96
- return o === S.DOES_NOT_CONTAIN;
97
- },
98
- testMappingFilterColumn: (s) => {
99
- var c;
100
- if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
92
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: ExtendCustomFilterOperator.DOES_NOT_CONTAIN, val1: "" }), "getDefaultFormParams"),
93
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => ({
94
+ customFilters: { customFilters: [{ val: `*${mapParams.val1}*`, operator: CustomFilterOperator.NOT_EQUALS }] }
95
+ }), "mapToFilterColumn"),
96
+ testMappingParams: /* @__PURE__ */ __name((params) => {
97
+ const [op] = getOnlyOperatorAndVal(params);
98
+ return op === ExtendCustomFilterOperator.DOES_NOT_CONTAIN;
99
+ }, "testMappingParams"),
100
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
101
+ var _a13;
102
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
101
103
  return !1;
102
- const o = s.customFilters.customFilters[0], a = o.val.toString();
103
- return o.operator === u.NOT_EQUALS && a.startsWith("*") && a.endsWith("*") ? { operator1: S.DOES_NOT_CONTAIN, val1: a.slice(1, -1) } : !1;
104
- }
105
- }, t.STARTS_WITH = {
104
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0], valAsString = firstCustomFilter.val.toString();
105
+ return firstCustomFilter.operator === CustomFilterOperator.NOT_EQUALS && valAsString.startsWith("*") && valAsString.endsWith("*") ? { operator1: ExtendCustomFilterOperator.DOES_NOT_CONTAIN, val1: valAsString.slice(1, -1) } : !1;
106
+ }, "testMappingFilterColumn")
107
+ }, FilterConditionItems2.STARTS_WITH = {
106
108
  label: "sheets-filter.conditions.starts-with",
107
- operator: S.STARTS_WITH,
108
- order: N.FIRST,
109
+ operator: ExtendCustomFilterOperator.STARTS_WITH,
110
+ order: OperatorOrder.FIRST,
109
111
  numOfParameters: 1,
110
- getDefaultFormParams: () => ({ operator1: S.STARTS_WITH, val1: "" }),
111
- mapToFilterColumn: (s) => ({
112
- customFilters: { customFilters: [{ val: `${s.val1}*` }] }
113
- }),
114
- testMappingParams: (s) => {
115
- const [o] = L(s);
116
- return o === S.STARTS_WITH;
117
- },
118
- testMappingFilterColumn: (s) => {
119
- var c;
120
- if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
112
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: ExtendCustomFilterOperator.STARTS_WITH, val1: "" }), "getDefaultFormParams"),
113
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => ({
114
+ customFilters: { customFilters: [{ val: `${mapParams.val1}*` }] }
115
+ }), "mapToFilterColumn"),
116
+ testMappingParams: /* @__PURE__ */ __name((params) => {
117
+ const [op] = getOnlyOperatorAndVal(params);
118
+ return op === ExtendCustomFilterOperator.STARTS_WITH;
119
+ }, "testMappingParams"),
120
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
121
+ var _a13;
122
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
121
123
  return !1;
122
- const o = s.customFilters.customFilters[0], a = o.val.toString();
123
- return !o.operator && a.endsWith("*") && !a.startsWith("*") ? { operator1: S.STARTS_WITH, val1: a.slice(0, -1) } : !1;
124
- }
125
- }, t.ENDS_WITH = {
124
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0], valAsString = firstCustomFilter.val.toString();
125
+ return !firstCustomFilter.operator && valAsString.endsWith("*") && !valAsString.startsWith("*") ? { operator1: ExtendCustomFilterOperator.STARTS_WITH, val1: valAsString.slice(0, -1) } : !1;
126
+ }, "testMappingFilterColumn")
127
+ }, FilterConditionItems2.ENDS_WITH = {
126
128
  label: "sheets-filter.conditions.ends-with",
127
- operator: S.ENDS_WITH,
128
- order: N.FIRST,
129
+ operator: ExtendCustomFilterOperator.ENDS_WITH,
130
+ order: OperatorOrder.FIRST,
129
131
  numOfParameters: 1,
130
- getDefaultFormParams: () => ({ operator1: S.ENDS_WITH, val1: "" }),
131
- mapToFilterColumn: (s) => ({
132
- customFilters: { customFilters: [{ val: `*${s.val1}` }] }
133
- }),
134
- testMappingParams: (s) => {
135
- const [o] = L(s);
136
- return o === S.ENDS_WITH;
137
- },
138
- testMappingFilterColumn: (s) => {
139
- var c;
140
- if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
132
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: ExtendCustomFilterOperator.ENDS_WITH, val1: "" }), "getDefaultFormParams"),
133
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => ({
134
+ customFilters: { customFilters: [{ val: `*${mapParams.val1}` }] }
135
+ }), "mapToFilterColumn"),
136
+ testMappingParams: /* @__PURE__ */ __name((params) => {
137
+ const [op] = getOnlyOperatorAndVal(params);
138
+ return op === ExtendCustomFilterOperator.ENDS_WITH;
139
+ }, "testMappingParams"),
140
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
141
+ var _a13;
142
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
141
143
  return !1;
142
- const o = s.customFilters.customFilters[0], a = o.val.toString();
143
- return !o.operator && a.startsWith("*") && !a.endsWith("*") ? { operator1: S.ENDS_WITH, val1: a.slice(1) } : !1;
144
- }
145
- }, t.EQUALS = {
144
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0], valAsString = firstCustomFilter.val.toString();
145
+ return !firstCustomFilter.operator && valAsString.startsWith("*") && !valAsString.endsWith("*") ? { operator1: ExtendCustomFilterOperator.ENDS_WITH, val1: valAsString.slice(1) } : !1;
146
+ }, "testMappingFilterColumn")
147
+ }, FilterConditionItems2.EQUALS = {
146
148
  label: "sheets-filter.conditions.equals",
147
- operator: S.EQUALS,
148
- order: N.FIRST,
149
+ operator: ExtendCustomFilterOperator.EQUALS,
150
+ order: OperatorOrder.FIRST,
149
151
  numOfParameters: 1,
150
- getDefaultFormParams: () => ({ operator1: S.EQUALS, val1: "" }),
151
- testMappingParams: (s) => {
152
- const [o] = L(s);
153
- return o === S.EQUALS;
154
- },
155
- mapToFilterColumn: (s) => {
156
- const { val1: o } = s;
157
- return o === "" ? null : {
158
- customFilters: { customFilters: [{ val: o }] }
152
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: ExtendCustomFilterOperator.EQUALS, val1: "" }), "getDefaultFormParams"),
153
+ testMappingParams: /* @__PURE__ */ __name((params) => {
154
+ const [op] = getOnlyOperatorAndVal(params);
155
+ return op === ExtendCustomFilterOperator.EQUALS;
156
+ }, "testMappingParams"),
157
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => {
158
+ const { val1 } = mapParams;
159
+ return val1 === "" ? null : {
160
+ customFilters: { customFilters: [{ val: val1 }] }
159
161
  };
160
- },
161
- testMappingFilterColumn: (s) => {
162
- var o, a, c;
163
- return ((a = (o = s.filters) == null ? void 0 : o.filters) == null ? void 0 : a.length) === 1 ? { operator1: S.EQUALS, val1: "" } : ((c = s.customFilters) == null ? void 0 : c.customFilters.length) === 1 && !s.customFilters.customFilters[0].operator ? { operator1: S.EQUALS, val1: s.customFilters.customFilters[0].val.toString() } : !1;
164
- }
165
- }, t.GREATER_THAN = {
162
+ }, "mapToFilterColumn"),
163
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
164
+ var _a13, _b, _c;
165
+ return ((_b = (_a13 = filterColumn.filters) == null ? void 0 : _a13.filters) == null ? void 0 : _b.length) === 1 ? { operator1: ExtendCustomFilterOperator.EQUALS, val1: "" } : ((_c = filterColumn.customFilters) == null ? void 0 : _c.customFilters.length) === 1 && !filterColumn.customFilters.customFilters[0].operator ? { operator1: ExtendCustomFilterOperator.EQUALS, val1: filterColumn.customFilters.customFilters[0].val.toString() } : !1;
166
+ }, "testMappingFilterColumn")
167
+ }, FilterConditionItems2.GREATER_THAN = {
166
168
  label: "sheets-filter.conditions.greater-than",
167
- operator: u.GREATER_THAN,
169
+ operator: CustomFilterOperator.GREATER_THAN,
168
170
  numOfParameters: 1,
169
- order: N.FIRST,
170
- getDefaultFormParams: () => ({ operator1: u.GREATER_THAN, val1: "" }),
171
- mapToFilterColumn: (s) => ({
172
- customFilters: { customFilters: [{ val: s.val1, operator: u.GREATER_THAN }] }
173
- }),
174
- testMappingParams: (s) => {
175
- const [o] = L(s);
176
- return o === u.GREATER_THAN;
177
- },
178
- testMappingFilterColumn: (s) => {
179
- var a;
180
- if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
171
+ order: OperatorOrder.FIRST,
172
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: CustomFilterOperator.GREATER_THAN, val1: "" }), "getDefaultFormParams"),
173
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => ({
174
+ customFilters: { customFilters: [{ val: mapParams.val1, operator: CustomFilterOperator.GREATER_THAN }] }
175
+ }), "mapToFilterColumn"),
176
+ testMappingParams: /* @__PURE__ */ __name((params) => {
177
+ const [op] = getOnlyOperatorAndVal(params);
178
+ return op === CustomFilterOperator.GREATER_THAN;
179
+ }, "testMappingParams"),
180
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
181
+ var _a13;
182
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
181
183
  return !1;
182
- const o = s.customFilters.customFilters[0];
183
- return o.operator !== u.GREATER_THAN ? !1 : { operator1: u.GREATER_THAN, val1: o.val.toString() };
184
- }
185
- }, t.GREATER_THAN_OR_EQUAL = {
184
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0];
185
+ return firstCustomFilter.operator !== CustomFilterOperator.GREATER_THAN ? !1 : { operator1: CustomFilterOperator.GREATER_THAN, val1: firstCustomFilter.val.toString() };
186
+ }, "testMappingFilterColumn")
187
+ }, FilterConditionItems2.GREATER_THAN_OR_EQUAL = {
186
188
  label: "sheets-filter.conditions.greater-than-or-equal",
187
- operator: u.GREATER_THAN_OR_EQUAL,
189
+ operator: CustomFilterOperator.GREATER_THAN_OR_EQUAL,
188
190
  numOfParameters: 1,
189
- order: N.FIRST,
190
- getDefaultFormParams: () => ({ operator1: u.GREATER_THAN_OR_EQUAL, val1: "" }),
191
- testMappingParams: (s) => {
192
- const [o] = L(s);
193
- return o === u.GREATER_THAN_OR_EQUAL;
194
- },
195
- mapToFilterColumn: (s) => ({
196
- customFilters: { customFilters: [{ val: s.val1, operator: u.GREATER_THAN_OR_EQUAL }] }
197
- }),
198
- testMappingFilterColumn: (s) => {
199
- var a;
200
- if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
191
+ order: OperatorOrder.FIRST,
192
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: CustomFilterOperator.GREATER_THAN_OR_EQUAL, val1: "" }), "getDefaultFormParams"),
193
+ testMappingParams: /* @__PURE__ */ __name((params) => {
194
+ const [op] = getOnlyOperatorAndVal(params);
195
+ return op === CustomFilterOperator.GREATER_THAN_OR_EQUAL;
196
+ }, "testMappingParams"),
197
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => ({
198
+ customFilters: { customFilters: [{ val: mapParams.val1, operator: CustomFilterOperator.GREATER_THAN_OR_EQUAL }] }
199
+ }), "mapToFilterColumn"),
200
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
201
+ var _a13;
202
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
201
203
  return !1;
202
- const o = s.customFilters.customFilters[0];
203
- return o.operator !== u.GREATER_THAN_OR_EQUAL ? !1 : { operator1: u.GREATER_THAN_OR_EQUAL, val1: o.val.toString() };
204
- }
205
- }, t.LESS_THAN = {
204
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0];
205
+ return firstCustomFilter.operator !== CustomFilterOperator.GREATER_THAN_OR_EQUAL ? !1 : { operator1: CustomFilterOperator.GREATER_THAN_OR_EQUAL, val1: firstCustomFilter.val.toString() };
206
+ }, "testMappingFilterColumn")
207
+ }, FilterConditionItems2.LESS_THAN = {
206
208
  label: "sheets-filter.conditions.less-than",
207
- operator: u.LESS_THAN,
209
+ operator: CustomFilterOperator.LESS_THAN,
208
210
  numOfParameters: 1,
209
- order: N.FIRST,
210
- getDefaultFormParams: () => ({ operator1: u.LESS_THAN, val1: "" }),
211
- testMappingParams: (s) => {
212
- const [o] = L(s);
213
- return o === u.LESS_THAN;
214
- },
215
- mapToFilterColumn: (s) => ({
216
- customFilters: { customFilters: [{ val: s.val1, operator: u.LESS_THAN }] }
217
- }),
218
- testMappingFilterColumn: (s) => {
219
- var a;
220
- if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
211
+ order: OperatorOrder.FIRST,
212
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: CustomFilterOperator.LESS_THAN, val1: "" }), "getDefaultFormParams"),
213
+ testMappingParams: /* @__PURE__ */ __name((params) => {
214
+ const [op] = getOnlyOperatorAndVal(params);
215
+ return op === CustomFilterOperator.LESS_THAN;
216
+ }, "testMappingParams"),
217
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => ({
218
+ customFilters: { customFilters: [{ val: mapParams.val1, operator: CustomFilterOperator.LESS_THAN }] }
219
+ }), "mapToFilterColumn"),
220
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
221
+ var _a13;
222
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
221
223
  return !1;
222
- const o = s.customFilters.customFilters[0];
223
- return o.operator !== u.LESS_THAN ? !1 : { operator1: u.LESS_THAN, val1: o.val.toString() };
224
- }
225
- }, t.LESS_THAN_OR_EQUAL = {
224
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0];
225
+ return firstCustomFilter.operator !== CustomFilterOperator.LESS_THAN ? !1 : { operator1: CustomFilterOperator.LESS_THAN, val1: firstCustomFilter.val.toString() };
226
+ }, "testMappingFilterColumn")
227
+ }, FilterConditionItems2.LESS_THAN_OR_EQUAL = {
226
228
  label: "sheets-filter.conditions.less-than-or-equal",
227
- operator: u.LESS_THAN_OR_EQUAL,
229
+ operator: CustomFilterOperator.LESS_THAN_OR_EQUAL,
228
230
  numOfParameters: 1,
229
- order: N.FIRST,
230
- getDefaultFormParams: () => ({ operator1: u.LESS_THAN_OR_EQUAL, val1: "" }),
231
- testMappingParams: (s) => {
232
- const [o] = L(s);
233
- return o === u.LESS_THAN_OR_EQUAL;
234
- },
235
- mapToFilterColumn: (s) => ({
236
- customFilters: { customFilters: [{ val: s.val1, operator: u.LESS_THAN_OR_EQUAL }] }
237
- }),
238
- testMappingFilterColumn: (s) => {
239
- var a;
240
- if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
231
+ order: OperatorOrder.FIRST,
232
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: CustomFilterOperator.LESS_THAN_OR_EQUAL, val1: "" }), "getDefaultFormParams"),
233
+ testMappingParams: /* @__PURE__ */ __name((params) => {
234
+ const [op] = getOnlyOperatorAndVal(params);
235
+ return op === CustomFilterOperator.LESS_THAN_OR_EQUAL;
236
+ }, "testMappingParams"),
237
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => ({
238
+ customFilters: { customFilters: [{ val: mapParams.val1, operator: CustomFilterOperator.LESS_THAN_OR_EQUAL }] }
239
+ }), "mapToFilterColumn"),
240
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
241
+ var _a13;
242
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
241
243
  return !1;
242
- const o = s.customFilters.customFilters[0];
243
- return o.operator !== u.LESS_THAN_OR_EQUAL ? !1 : { operator1: u.LESS_THAN_OR_EQUAL, val1: o.val.toString() };
244
- }
245
- }, t.EQUAL = {
244
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0];
245
+ return firstCustomFilter.operator !== CustomFilterOperator.LESS_THAN_OR_EQUAL ? !1 : { operator1: CustomFilterOperator.LESS_THAN_OR_EQUAL, val1: firstCustomFilter.val.toString() };
246
+ }, "testMappingFilterColumn")
247
+ }, FilterConditionItems2.EQUAL = {
246
248
  label: "sheets-filter.conditions.equal",
247
- operator: u.EQUAL,
249
+ operator: CustomFilterOperator.EQUAL,
248
250
  numOfParameters: 1,
249
- order: N.FIRST,
250
- getDefaultFormParams: () => ({ operator1: u.EQUAL, val1: "" }),
251
- testMappingParams: (s) => {
252
- const [o] = L(s);
253
- return o === u.EQUAL;
254
- },
255
- mapToFilterColumn: (s) => ({
256
- customFilters: { customFilters: [{ val: s.val1, operator: u.EQUAL }] }
257
- }),
258
- testMappingFilterColumn: (s) => {
259
- var a;
260
- if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
251
+ order: OperatorOrder.FIRST,
252
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: CustomFilterOperator.EQUAL, val1: "" }), "getDefaultFormParams"),
253
+ testMappingParams: /* @__PURE__ */ __name((params) => {
254
+ const [op] = getOnlyOperatorAndVal(params);
255
+ return op === CustomFilterOperator.EQUAL;
256
+ }, "testMappingParams"),
257
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => ({
258
+ customFilters: { customFilters: [{ val: mapParams.val1, operator: CustomFilterOperator.EQUAL }] }
259
+ }), "mapToFilterColumn"),
260
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
261
+ var _a13;
262
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
261
263
  return !1;
262
- const o = s.customFilters.customFilters[0];
263
- return o.operator !== u.EQUAL ? !1 : { operator1: u.EQUAL, val1: o.val.toString() };
264
- }
265
- }, t.NOT_EQUAL = {
264
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0];
265
+ return firstCustomFilter.operator !== CustomFilterOperator.EQUAL ? !1 : { operator1: CustomFilterOperator.EQUAL, val1: firstCustomFilter.val.toString() };
266
+ }, "testMappingFilterColumn")
267
+ }, FilterConditionItems2.NOT_EQUAL = {
266
268
  label: "sheets-filter.conditions.not-equal",
267
- operator: u.NOT_EQUALS,
269
+ operator: CustomFilterOperator.NOT_EQUALS,
268
270
  numOfParameters: 1,
269
- order: N.FIRST,
270
- getDefaultFormParams: () => ({ operator1: u.NOT_EQUALS, val1: "" }),
271
- testMappingParams: (s) => {
272
- const [o] = L(s);
273
- return o === u.NOT_EQUALS;
274
- },
275
- mapToFilterColumn: (s) => ({
276
- customFilters: { customFilters: [{ val: s.val1, operator: u.NOT_EQUALS }] }
277
- }),
278
- testMappingFilterColumn: (s) => {
279
- var a;
280
- if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
271
+ order: OperatorOrder.FIRST,
272
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({ operator1: CustomFilterOperator.NOT_EQUALS, val1: "" }), "getDefaultFormParams"),
273
+ testMappingParams: /* @__PURE__ */ __name((params) => {
274
+ const [op] = getOnlyOperatorAndVal(params);
275
+ return op === CustomFilterOperator.NOT_EQUALS;
276
+ }, "testMappingParams"),
277
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => ({
278
+ customFilters: { customFilters: [{ val: mapParams.val1, operator: CustomFilterOperator.NOT_EQUALS }] }
279
+ }), "mapToFilterColumn"),
280
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
281
+ var _a13;
282
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 1)
281
283
  return !1;
282
- const o = s.customFilters.customFilters[0];
283
- return o.operator !== u.NOT_EQUALS ? !1 : { operator1: u.NOT_EQUALS, val1: o.val.toString() };
284
- }
285
- }, t.BETWEEN = {
284
+ const firstCustomFilter = filterColumn.customFilters.customFilters[0];
285
+ return firstCustomFilter.operator !== CustomFilterOperator.NOT_EQUALS ? !1 : { operator1: CustomFilterOperator.NOT_EQUALS, val1: firstCustomFilter.val.toString() };
286
+ }, "testMappingFilterColumn")
287
+ }, FilterConditionItems2.BETWEEN = {
286
288
  label: "sheets-filter.conditions.between",
287
- operator: S.BETWEEN,
288
- order: N.SECOND,
289
+ operator: ExtendCustomFilterOperator.BETWEEN,
290
+ order: OperatorOrder.SECOND,
289
291
  numOfParameters: 2,
290
- getDefaultFormParams: () => ({
292
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({
291
293
  and: !0,
292
- operator1: u.GREATER_THAN_OR_EQUAL,
294
+ operator1: CustomFilterOperator.GREATER_THAN_OR_EQUAL,
293
295
  val1: "",
294
- operator2: u.LESS_THAN_OR_EQUAL,
296
+ operator2: CustomFilterOperator.LESS_THAN_OR_EQUAL,
295
297
  val2: ""
296
- }),
297
- testMappingParams: (s) => {
298
- const { and: o, operator1: a, operator2: c } = s;
299
- if (!o) return !1;
300
- const h = [a, c];
301
- return h.includes(u.GREATER_THAN_OR_EQUAL) && h.includes(u.LESS_THAN_OR_EQUAL);
302
- },
303
- mapToFilterColumn: (s) => {
304
- const { val1: o, val2: a, operator1: c } = s, h = c === u.GREATER_THAN_OR_EQUAL;
298
+ }), "getDefaultFormParams"),
299
+ testMappingParams: /* @__PURE__ */ __name((params) => {
300
+ const { and, operator1, operator2 } = params;
301
+ if (!and) return !1;
302
+ const operators = [operator1, operator2];
303
+ return operators.includes(CustomFilterOperator.GREATER_THAN_OR_EQUAL) && operators.includes(CustomFilterOperator.LESS_THAN_OR_EQUAL);
304
+ }, "testMappingParams"),
305
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => {
306
+ const { val1, val2, operator1 } = mapParams, operator1IsGreater = operator1 === CustomFilterOperator.GREATER_THAN_OR_EQUAL;
305
307
  return {
306
308
  customFilters: {
307
- and: nt.TRUE,
309
+ and: BooleanNumber.TRUE,
308
310
  customFilters: [
309
- { val: h ? o : a, operator: u.GREATER_THAN_OR_EQUAL },
310
- { val: h ? a : o, operator: u.LESS_THAN_OR_EQUAL }
311
+ { val: operator1IsGreater ? val1 : val2, operator: CustomFilterOperator.GREATER_THAN_OR_EQUAL },
312
+ { val: operator1IsGreater ? val2 : val1, operator: CustomFilterOperator.LESS_THAN_OR_EQUAL }
311
313
  ]
312
314
  }
313
315
  };
314
- },
315
- testMappingFilterColumn: (s) => {
316
- var c;
317
- if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 2)
316
+ }, "mapToFilterColumn"),
317
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
318
+ var _a13;
319
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 2)
318
320
  return !1;
319
- const [o, a] = s.customFilters.customFilters;
320
- return o.operator === u.GREATER_THAN_OR_EQUAL && a.operator === u.LESS_THAN_OR_EQUAL && s.customFilters.and ? {
321
+ const [firstCustomFilter, secondCustomFilter] = filterColumn.customFilters.customFilters;
322
+ return firstCustomFilter.operator === CustomFilterOperator.GREATER_THAN_OR_EQUAL && secondCustomFilter.operator === CustomFilterOperator.LESS_THAN_OR_EQUAL && filterColumn.customFilters.and ? {
321
323
  and: !0,
322
- operator1: u.GREATER_THAN_OR_EQUAL,
323
- val1: o.val.toString(),
324
- operator2: u.LESS_THAN_OR_EQUAL,
325
- val2: a.val.toString()
326
- } : a.operator === u.GREATER_THAN_OR_EQUAL && o.operator === u.LESS_THAN_OR_EQUAL && s.customFilters.and ? {
324
+ operator1: CustomFilterOperator.GREATER_THAN_OR_EQUAL,
325
+ val1: firstCustomFilter.val.toString(),
326
+ operator2: CustomFilterOperator.LESS_THAN_OR_EQUAL,
327
+ val2: secondCustomFilter.val.toString()
328
+ } : secondCustomFilter.operator === CustomFilterOperator.GREATER_THAN_OR_EQUAL && firstCustomFilter.operator === CustomFilterOperator.LESS_THAN_OR_EQUAL && filterColumn.customFilters.and ? {
327
329
  and: !0,
328
- operator1: u.GREATER_THAN_OR_EQUAL,
329
- val1: a.val.toString(),
330
- operator2: u.LESS_THAN_OR_EQUAL,
331
- val2: o.val.toLocaleString()
330
+ operator1: CustomFilterOperator.GREATER_THAN_OR_EQUAL,
331
+ val1: secondCustomFilter.val.toString(),
332
+ operator2: CustomFilterOperator.LESS_THAN_OR_EQUAL,
333
+ val2: firstCustomFilter.val.toLocaleString()
332
334
  } : !1;
333
- }
334
- }, t.NOT_BETWEEN = {
335
+ }, "testMappingFilterColumn")
336
+ }, FilterConditionItems2.NOT_BETWEEN = {
335
337
  label: "sheets-filter.conditions.not-between",
336
- operator: S.NOT_BETWEEN,
337
- order: N.SECOND,
338
+ operator: ExtendCustomFilterOperator.NOT_BETWEEN,
339
+ order: OperatorOrder.SECOND,
338
340
  numOfParameters: 2,
339
- getDefaultFormParams: () => ({
340
- operator1: u.LESS_THAN,
341
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({
342
+ operator1: CustomFilterOperator.LESS_THAN,
341
343
  val1: "",
342
- operator2: u.GREATER_THAN,
344
+ operator2: CustomFilterOperator.GREATER_THAN,
343
345
  val2: ""
344
- }),
345
- testMappingParams: (s) => {
346
- const { and: o, operator1: a, operator2: c } = s;
347
- if (o) return !1;
348
- const h = [a, c];
349
- return h.includes(u.GREATER_THAN) && h.includes(u.LESS_THAN);
350
- },
351
- mapToFilterColumn: (s) => {
352
- const { val1: o, val2: a, operator1: c } = s, h = c === u.GREATER_THAN;
346
+ }), "getDefaultFormParams"),
347
+ testMappingParams: /* @__PURE__ */ __name((params) => {
348
+ const { and, operator1, operator2 } = params;
349
+ if (and) return !1;
350
+ const operators = [operator1, operator2];
351
+ return operators.includes(CustomFilterOperator.GREATER_THAN) && operators.includes(CustomFilterOperator.LESS_THAN);
352
+ }, "testMappingParams"),
353
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => {
354
+ const { val1, val2, operator1 } = mapParams, operator1IsGreater = operator1 === CustomFilterOperator.GREATER_THAN;
353
355
  return {
354
356
  customFilters: {
355
357
  customFilters: [
356
- { val: h ? o : a, operator: u.GREATER_THAN },
357
- { val: h ? a : o, operator: u.LESS_THAN }
358
+ { val: operator1IsGreater ? val1 : val2, operator: CustomFilterOperator.GREATER_THAN },
359
+ { val: operator1IsGreater ? val2 : val1, operator: CustomFilterOperator.LESS_THAN }
358
360
  ]
359
361
  }
360
362
  };
361
- },
362
- testMappingFilterColumn: (s) => {
363
- var c;
364
- if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 2)
363
+ }, "mapToFilterColumn"),
364
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
365
+ var _a13;
366
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 2)
365
367
  return !1;
366
- const [o, a] = s.customFilters.customFilters;
367
- return o.operator === u.LESS_THAN && a.operator === u.GREATER_THAN && !s.customFilters.and ? {
368
- operator1: u.LESS_THAN,
369
- val1: o.val.toString(),
370
- operator2: u.GREATER_THAN,
371
- val2: a.val.toString()
372
- } : a.operator === u.LESS_THAN && o.operator === u.GREATER_THAN && !s.customFilters.and ? {
373
- operator1: u.GREATER_THAN,
374
- val1: a.val.toString(),
375
- operator2: u.LESS_THAN,
376
- val2: o.val.toLocaleString()
368
+ const [firstCustomFilter, secondCustomFilter] = filterColumn.customFilters.customFilters;
369
+ return firstCustomFilter.operator === CustomFilterOperator.LESS_THAN && secondCustomFilter.operator === CustomFilterOperator.GREATER_THAN && !filterColumn.customFilters.and ? {
370
+ operator1: CustomFilterOperator.LESS_THAN,
371
+ val1: firstCustomFilter.val.toString(),
372
+ operator2: CustomFilterOperator.GREATER_THAN,
373
+ val2: secondCustomFilter.val.toString()
374
+ } : secondCustomFilter.operator === CustomFilterOperator.LESS_THAN && firstCustomFilter.operator === CustomFilterOperator.GREATER_THAN && !filterColumn.customFilters.and ? {
375
+ operator1: CustomFilterOperator.GREATER_THAN,
376
+ val1: secondCustomFilter.val.toString(),
377
+ operator2: CustomFilterOperator.LESS_THAN,
378
+ val2: firstCustomFilter.val.toLocaleString()
377
379
  } : !1;
378
- }
379
- }, t.CUSTOM = {
380
+ }, "testMappingFilterColumn")
381
+ }, FilterConditionItems2.CUSTOM = {
380
382
  label: "sheets-filter.conditions.custom",
381
- operator: S.CUSTOM,
382
- order: N.SECOND,
383
+ operator: ExtendCustomFilterOperator.CUSTOM,
384
+ order: OperatorOrder.SECOND,
383
385
  numOfParameters: 2,
384
- getDefaultFormParams: () => ({
385
- operator1: S.NONE,
386
+ getDefaultFormParams: /* @__PURE__ */ __name(() => ({
387
+ operator1: ExtendCustomFilterOperator.NONE,
386
388
  val1: "",
387
- operator2: S.NONE,
389
+ operator2: ExtendCustomFilterOperator.NONE,
388
390
  val2: ""
389
- }),
390
- testMappingParams: () => !0,
391
- mapToFilterColumn: (s) => {
392
- const { and: o, val1: a, val2: c, operator1: h, operator2: d } = s;
393
- function g(I, R) {
394
- for (const M of t.ALL_CONDITIONS)
395
- if (M.operator === I)
396
- return M.mapToFilterColumn({ val1: R, operator1: I });
391
+ }), "getDefaultFormParams"),
392
+ testMappingParams: /* @__PURE__ */ __name(() => !0, "testMappingParams"),
393
+ mapToFilterColumn: /* @__PURE__ */ __name((mapParams) => {
394
+ const { and, val1, val2, operator1, operator2 } = mapParams;
395
+ function mapOperator(operator, val) {
396
+ for (const condition of FilterConditionItems2.ALL_CONDITIONS)
397
+ if (condition.operator === operator)
398
+ return condition.mapToFilterColumn({ val1: val, operator1: operator });
397
399
  }
398
- const m = !h || h === t.NONE.operator, T = !d || d === t.NONE.operator;
399
- if (m && T)
400
- return t.NONE.mapToFilterColumn({});
401
- if (m)
402
- return g(d, c);
403
- if (T)
404
- return g(h, a);
405
- const v = g(h, a), P = g(d, c), F = {
400
+ __name(mapOperator, "mapOperator");
401
+ const operator1IsNone = !operator1 || operator1 === FilterConditionItems2.NONE.operator, operator2IsNone = !operator2 || operator2 === FilterConditionItems2.NONE.operator;
402
+ if (operator1IsNone && operator2IsNone)
403
+ return FilterConditionItems2.NONE.mapToFilterColumn({});
404
+ if (operator1IsNone)
405
+ return mapOperator(operator2, val2);
406
+ if (operator2IsNone)
407
+ return mapOperator(operator1, val1);
408
+ const mappedCustomFilter1 = mapOperator(operator1, val1), mappedCustomFilter2 = mapOperator(operator2, val2), customFilters = {
406
409
  customFilters: [
407
- v.customFilters.customFilters[0],
408
- P.customFilters.customFilters[0]
410
+ mappedCustomFilter1.customFilters.customFilters[0],
411
+ mappedCustomFilter2.customFilters.customFilters[0]
409
412
  ]
410
413
  };
411
- return o && (F.and = nt.TRUE), { customFilters: F };
412
- },
413
- testMappingFilterColumn: (s) => {
414
- var c;
415
- if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 2)
414
+ return and && (customFilters.and = BooleanNumber.TRUE), { customFilters };
415
+ }, "mapToFilterColumn"),
416
+ testMappingFilterColumn: /* @__PURE__ */ __name((filterColumn) => {
417
+ var _a13;
418
+ if (((_a13 = filterColumn.customFilters) == null ? void 0 : _a13.customFilters.length) !== 2)
416
419
  return !1;
417
- const o = s.customFilters.customFilters.map((h) => l({ customFilters: { customFilters: [h] } })), a = {
418
- operator1: o[0][0].operator,
419
- val1: o[0][1].val1,
420
- operator2: o[1][0].operator,
421
- val2: o[1][1].val1
420
+ const params = filterColumn.customFilters.customFilters.map((customFilter) => testMappingFilterColumn({ customFilters: { customFilters: [customFilter] } })), result = {
421
+ operator1: params[0][0].operator,
422
+ val1: params[0][1].val1,
423
+ operator2: params[1][0].operator,
424
+ val2: params[1][1].val1
422
425
  };
423
- return s.customFilters.and && (a.and = !0), a;
424
- }
425
- }, t.ALL_CONDITIONS = [
426
+ return filterColumn.customFilters.and && (result.and = !0), result;
427
+ }, "testMappingFilterColumn")
428
+ }, FilterConditionItems2.ALL_CONDITIONS = [
426
429
  // ------------------------------
427
- t.NONE,
430
+ FilterConditionItems2.NONE,
428
431
  // ------------------------------
429
- t.EMPTY,
430
- t.NOT_EMPTY,
432
+ FilterConditionItems2.EMPTY,
433
+ FilterConditionItems2.NOT_EMPTY,
431
434
  // ------------------------------
432
- t.TEXT_CONTAINS,
433
- t.DOES_NOT_CONTAIN,
434
- t.STARTS_WITH,
435
- t.ENDS_WITH,
436
- t.EQUALS,
435
+ FilterConditionItems2.TEXT_CONTAINS,
436
+ FilterConditionItems2.DOES_NOT_CONTAIN,
437
+ FilterConditionItems2.STARTS_WITH,
438
+ FilterConditionItems2.ENDS_WITH,
439
+ FilterConditionItems2.EQUALS,
437
440
  // ------------------------------
438
- t.GREATER_THAN,
439
- t.GREATER_THAN_OR_EQUAL,
440
- t.LESS_THAN,
441
- t.LESS_THAN_OR_EQUAL,
442
- t.EQUAL,
443
- t.NOT_EQUAL,
444
- t.BETWEEN,
445
- t.NOT_BETWEEN,
441
+ FilterConditionItems2.GREATER_THAN,
442
+ FilterConditionItems2.GREATER_THAN_OR_EQUAL,
443
+ FilterConditionItems2.LESS_THAN,
444
+ FilterConditionItems2.LESS_THAN_OR_EQUAL,
445
+ FilterConditionItems2.EQUAL,
446
+ FilterConditionItems2.NOT_EQUAL,
447
+ FilterConditionItems2.BETWEEN,
448
+ FilterConditionItems2.NOT_BETWEEN,
446
449
  // ------------------------------
447
- t.CUSTOM
450
+ FilterConditionItems2.CUSTOM
448
451
  ];
449
- function e(s) {
450
- const o = t.ALL_CONDITIONS.find((a) => a.operator === s);
451
- if (!o)
452
- throw new Error(`[SheetsFilter]: no condition item found for operator: ${s}`);
453
- return o;
454
- }
455
- t.getItemByOperator = e;
456
- function r(s, o) {
457
- for (const a of t.ALL_CONDITIONS.filter((c) => c.numOfParameters === o))
458
- if (a.numOfParameters !== 0 && a.testMappingParams(s))
459
- return a;
460
- for (const a of t.ALL_CONDITIONS)
461
- if (a.testMappingParams(s))
462
- return a;
452
+ function getItemByOperator(operator) {
453
+ const item = FilterConditionItems2.ALL_CONDITIONS.find((condition) => condition.operator === operator);
454
+ if (!item)
455
+ throw new Error(`[SheetsFilter]: no condition item found for operator: ${operator}`);
456
+ return item;
457
+ }
458
+ __name(getItemByOperator, "getItemByOperator"), FilterConditionItems2.getItemByOperator = getItemByOperator;
459
+ function testMappingParams(mapParams, numOfParameters) {
460
+ for (const condition of FilterConditionItems2.ALL_CONDITIONS.filter((condition2) => condition2.numOfParameters === numOfParameters))
461
+ if (condition.numOfParameters !== 0 && condition.testMappingParams(mapParams))
462
+ return condition;
463
+ for (const condition of FilterConditionItems2.ALL_CONDITIONS)
464
+ if (condition.testMappingParams(mapParams))
465
+ return condition;
463
466
  throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!");
464
467
  }
465
- t.testMappingParams = r;
466
- function n(s) {
467
- const o = t.ALL_CONDITIONS.find((a) => a.operator === s);
468
- return (o == null ? void 0 : o.numOfParameters) === 0 ? { operator1: o.operator } : o.getDefaultFormParams();
469
- }
470
- t.getInitialFormParams = n;
471
- function i(s, o) {
472
- return s.mapToFilterColumn(o);
473
- }
474
- t.mapToFilterColumn = i;
475
- function l(s) {
476
- if (!s)
477
- return [t.NONE, {}];
478
- for (const o of t.ALL_CONDITIONS) {
479
- const a = o.testMappingFilterColumn(s);
480
- if (a)
481
- return [o, a];
468
+ __name(testMappingParams, "testMappingParams"), FilterConditionItems2.testMappingParams = testMappingParams;
469
+ function getInitialFormParams(operator) {
470
+ const condition = FilterConditionItems2.ALL_CONDITIONS.find((condition2) => condition2.operator === operator);
471
+ return (condition == null ? void 0 : condition.numOfParameters) === 0 ? { operator1: condition.operator } : condition.getDefaultFormParams();
472
+ }
473
+ __name(getInitialFormParams, "getInitialFormParams"), FilterConditionItems2.getInitialFormParams = getInitialFormParams;
474
+ function mapToFilterColumn(condition, mapParams) {
475
+ return condition.mapToFilterColumn(mapParams);
476
+ }
477
+ __name(mapToFilterColumn, "mapToFilterColumn"), FilterConditionItems2.mapToFilterColumn = mapToFilterColumn;
478
+ function testMappingFilterColumn(filterColumn) {
479
+ if (!filterColumn)
480
+ return [FilterConditionItems2.NONE, {}];
481
+ for (const condition of FilterConditionItems2.ALL_CONDITIONS) {
482
+ const mapParams = condition.testMappingFilterColumn(filterColumn);
483
+ if (mapParams)
484
+ return [condition, mapParams];
482
485
  }
483
- return [t.NONE, {}];
486
+ return [FilterConditionItems2.NONE, {}];
484
487
  }
485
- t.testMappingFilterColumn = l;
486
- })(f || (f = {}));
487
- function L(t) {
488
- const { operator1: e, operator2: r, val1: n, val2: i } = t;
489
- if (e && r)
488
+ __name(testMappingFilterColumn, "testMappingFilterColumn"), FilterConditionItems2.testMappingFilterColumn = testMappingFilterColumn;
489
+ })(FilterConditionItems || (FilterConditionItems = {}));
490
+ function getOnlyOperatorAndVal(mapParams) {
491
+ const { operator1, operator2, val1, val2 } = mapParams;
492
+ if (operator1 && operator2)
490
493
  throw new Error("Both operator1 and operator2 are set!");
491
- if (!e && !r)
494
+ if (!operator1 && !operator2)
492
495
  throw new Error("Neither operator1 and operator2 and both not set!");
493
- return e ? [e, n] : [r, i];
496
+ return operator1 ? [operator1, val1] : [operator2, val2];
494
497
  }
495
- function je(t) {
496
- const e = [], r = [];
497
- let n = 0, i = 0;
498
- function l(s) {
499
- s.leaf && (s.checked ? (e.push(s), n += s.count) : (r.push(s), i += s.count)), s.children && s.children.forEach(l);
500
- }
501
- return t.forEach(l), {
502
- checkedItems: e,
503
- uncheckedItems: r,
504
- checked: n,
505
- unchecked: i
498
+ __name(getOnlyOperatorAndVal, "getOnlyOperatorAndVal");
499
+ function statisticFilterByValueItems(items) {
500
+ const checkedItems = [], uncheckedItems = [];
501
+ let checked = 0, unchecked = 0;
502
+ function traverse(node) {
503
+ node.leaf && (node.checked ? (checkedItems.push(node), checked += node.count) : (uncheckedItems.push(node), unchecked += node.count)), node.children && node.children.forEach(traverse);
504
+ }
505
+ return __name(traverse, "traverse"), items.forEach(traverse), {
506
+ checkedItems,
507
+ uncheckedItems,
508
+ checked,
509
+ unchecked
506
510
  };
507
511
  }
508
- var ts = Object.defineProperty, rs = Object.getOwnPropertyDescriptor, ss = (t, e, r, n) => {
509
- for (var i = n > 1 ? void 0 : n ? rs(e, r) : e, l = t.length - 1, s; l >= 0; l--)
510
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
511
- return n && i && ts(e, r, i), i;
512
- }, De = (t, e) => (r, n) => e(r, n, t);
513
- const tt = "sheets-filter.generate-filter-values.service", Pe = gt(tt), ns = ["yyyy-mm-dd", "yyyy-mm-dd;@", "yyyy/mm/dd;@", "yyyy/mm/dd hh:mm", "yyyy-m-d am/pm h:mm", "yyyy-MM-dd", "yyyy/MM/dd", "yyyy/mm/dd", 'yyyy"年"MM"月"dd"日"', "MM-dd", 'M""d"日"', "MM-dd A/P hh:mm"];
514
- let We = class extends pe {
515
- constructor(t, e, r) {
516
- super(), this._localeService = t, this._univerInstanceService = e, this._logService = r;
517
- }
518
- async getFilterValues(t) {
519
- var h;
520
- const { unitId: e, subUnitId: r, filteredOutRowsByOtherColumns: n, filters: i, blankChecked: l, iterateRange: s, alreadyChecked: o } = t, a = this._univerInstanceService.getUnit(e), c = (h = this._univerInstanceService.getUnit(e)) == null ? void 0 : h.getSheetBySheetId(r);
521
- return !a || !c ? [] : (this._logService.debug("[SheetsGenerateFilterValuesService]", "getFilterValues for", { unitId: e, subUnitId: r }), wt(i, this._localeService, s, c, new Set(n), new Set(o.map(String)), l, a.getStyles()));
522
- }
523
- };
524
- We = ss([
525
- De(0, E(K)),
526
- De(1, Ye),
527
- De(2, Zt)
528
- ], We);
529
- function wt(t, e, r, n, i, l, s, o) {
530
- var v, P, F, I, R, M, $, Se, ge;
531
- const a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), h = "yyyy-mm-dd", d = new Set(ns), g = "empty";
532
- let m = 0;
533
- for (const y of n.iterateByColumn(r, !1, !1)) {
534
- const { row: Gt, rowSpan: st = 1 } = y;
535
- let J = 0;
536
- for (; J < st; ) {
537
- const Yt = Gt + J;
538
- if (i.has(Yt)) {
539
- J++;
512
+ __name(statisticFilterByValueItems, "statisticFilterByValueItems");
513
+ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
514
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
515
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
516
+ return kind && result && __defProp$9(target, key, result), result;
517
+ }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9");
518
+ const SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME = "sheets-filter.generate-filter-values.service", ISheetsGenerateFilterValuesService = createIdentifier(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME), CAN_PARSE_DATE_FORMAT = ["yyyy-mm-dd", "yyyy-mm-dd;@", "yyyy/mm/dd;@", "yyyy/mm/dd hh:mm", "yyyy-m-d am/pm h:mm", "yyyy-MM-dd", "yyyy/MM/dd", "yyyy/mm/dd", 'yyyy"年"MM"月"dd"日"', "MM-dd", 'M"月"d"日"', "MM-dd A/P hh:mm"];
519
+ var _a;
520
+ let SheetsGenerateFilterValuesService = (_a = class extends Disposable {
521
+ constructor(_localeService, _univerInstanceService, _logService) {
522
+ super(), this._localeService = _localeService, this._univerInstanceService = _univerInstanceService, this._logService = _logService;
523
+ }
524
+ async getFilterValues(params) {
525
+ var _a13;
526
+ const { unitId, subUnitId, filteredOutRowsByOtherColumns, filters, blankChecked, iterateRange, alreadyChecked } = params, workbook = this._univerInstanceService.getUnit(unitId), worksheet = (_a13 = this._univerInstanceService.getUnit(unitId)) == null ? void 0 : _a13.getSheetBySheetId(subUnitId);
527
+ return !workbook || !worksheet ? [] : (this._logService.debug("[SheetsGenerateFilterValuesService]", "getFilterValues for", { unitId, subUnitId }), getFilterTreeByValueItems(filters, this._localeService, iterateRange, worksheet, new Set(filteredOutRowsByOtherColumns), new Set(alreadyChecked.map(String)), blankChecked, workbook.getStyles()));
528
+ }
529
+ }, __name(_a, "SheetsGenerateFilterValuesService"), _a);
530
+ SheetsGenerateFilterValuesService = __decorateClass$9([
531
+ __decorateParam$9(0, Inject(LocaleService)),
532
+ __decorateParam$9(1, IUniverInstanceService),
533
+ __decorateParam$9(2, ILogService)
534
+ ], SheetsGenerateFilterValuesService);
535
+ function getFilterTreeByValueItems(filters, localeService, iterateRange, worksheet, filteredOutRowsByOtherColumns, alreadyChecked, blankChecked, styles2) {
536
+ var _a13, _b, _c, _d, _e, _f, _g, _h, _i;
537
+ const items = /* @__PURE__ */ new Map(), treeMap = /* @__PURE__ */ new Map(), DefaultPattern = "yyyy-mm-dd", canSplitPatternSet = new Set(CAN_PARSE_DATE_FORMAT), EmptyKey = "empty";
538
+ let emptyCount = 0;
539
+ for (const cell of worksheet.iterateByColumn(iterateRange, !1, !1)) {
540
+ const { row, rowSpan = 1 } = cell;
541
+ let rowIndex = 0;
542
+ for (; rowIndex < rowSpan; ) {
543
+ const targetRow = row + rowIndex;
544
+ if (filteredOutRowsByOtherColumns.has(targetRow)) {
545
+ rowIndex++;
540
546
  continue;
541
547
  }
542
- const Q = y != null && y.value ? Jt(y.value) : "";
543
- if (!Q) {
544
- m += 1, J += st;
548
+ const value = cell != null && cell.value ? extractPureTextFromCell(cell.value) : "";
549
+ if (!value) {
550
+ emptyCount += 1, rowIndex += rowSpan;
545
551
  continue;
546
552
  }
547
- const ve = (v = y.value) != null && v.v && !y.value.p ? (I = (F = o.get((P = y.value) == null ? void 0 : P.s)) == null ? void 0 : F.n) == null ? void 0 : I.pattern : "", qt = ve && it.isDate(ve);
548
- if (ve && qt && d.has(ve)) {
549
- const x = (R = n.getCellRaw(y.row, y.col)) == null ? void 0 : R.v;
550
- if (!x) {
551
- J++;
553
+ const fmtStr = (_a13 = cell.value) != null && _a13.v && !cell.value.p ? (_d = (_c = styles2.get((_b = cell.value) == null ? void 0 : _b.s)) == null ? void 0 : _c.n) == null ? void 0 : _d.pattern : "", isDateValue = fmtStr && numfmt.isDate(fmtStr);
554
+ if (fmtStr && isDateValue && canSplitPatternSet.has(fmtStr)) {
555
+ const originValue = (_e = worksheet.getCellRaw(cell.row, cell.col)) == null ? void 0 : _e.v;
556
+ if (!originValue) {
557
+ rowIndex++;
552
558
  continue;
553
559
  }
554
- const z = it.format(h, x), [O, w, oe] = z.split("-").map(Number);
555
- let G = a.get(`${O}`);
556
- G || (G = {
557
- title: `${O}`,
558
- key: `${O}`,
560
+ const valueParsedByDefaultPattern = numfmt.format(DefaultPattern, originValue), [year, month, day] = valueParsedByDefaultPattern.split("-").map(Number);
561
+ let yearItem = items.get(`${year}`);
562
+ yearItem || (yearItem = {
563
+ title: `${year}`,
564
+ key: `${year}`,
559
565
  children: [],
560
566
  count: 0,
561
567
  leaf: !1,
562
568
  checked: !1
563
- }, a.set(`${O}`, G), c.set(`${O}`, [`${O}`]));
564
- let U = (M = G.children) == null ? void 0 : M.find((He) => He.key === `${O}-${w}`);
565
- U || (U = {
566
- title: e.t(`sheets-filter.date.${w}`),
567
- key: `${O}-${w}`,
569
+ }, items.set(`${year}`, yearItem), treeMap.set(`${year}`, [`${year}`]));
570
+ let monthItem = (_f = yearItem.children) == null ? void 0 : _f.find((item) => item.key === `${year}-${month}`);
571
+ monthItem || (monthItem = {
572
+ title: localeService.t(`sheets-filter.date.${month}`),
573
+ key: `${year}-${month}`,
568
574
  children: [],
569
575
  count: 0,
570
576
  leaf: !1,
571
577
  checked: !1
572
- }, ($ = G.children) == null || $.push(U), c.set(`${O}-${w}`, [`${O}`, `${O}-${w}`]));
573
- const Ue = (Se = U == null ? void 0 : U.children) == null ? void 0 : Se.find((He) => He.key === `${O}-${w}-${oe}`);
574
- Ue ? (Ue.originValues.add(Q), Ue.count++, U.count++, G.count++) : ((ge = U.children) == null || ge.push({
575
- title: `${oe}`,
576
- key: `${O}-${w}-${oe}`,
578
+ }, (_g = yearItem.children) == null || _g.push(monthItem), treeMap.set(`${year}-${month}`, [`${year}`, `${year}-${month}`]));
579
+ const dayItem = (_h = monthItem == null ? void 0 : monthItem.children) == null ? void 0 : _h.find((item) => item.key === `${year}-${month}-${day}`);
580
+ dayItem ? (dayItem.originValues.add(value), dayItem.count++, monthItem.count++, yearItem.count++) : ((_i = monthItem.children) == null || _i.push({
581
+ title: `${day}`,
582
+ key: `${year}-${month}-${day}`,
577
583
  count: 1,
578
- originValues: /* @__PURE__ */ new Set([Q]),
584
+ originValues: /* @__PURE__ */ new Set([value]),
579
585
  leaf: !0,
580
- checked: l.size ? l.has(Q) : !s
581
- }), U.count++, G.count++, c.set(`${O}-${w}-${oe}`, [`${O}`, `${O}-${w}`, `${O}-${w}-${oe}`]));
586
+ checked: alreadyChecked.size ? alreadyChecked.has(value) : !blankChecked
587
+ }), monthItem.count++, yearItem.count++, treeMap.set(`${year}-${month}-${day}`, [`${year}`, `${year}-${month}`, `${year}-${month}-${day}`]));
582
588
  } else {
583
- const x = Q;
584
- let z = a.get(x);
585
- z ? z.count++ : (z = {
586
- title: Q,
589
+ const key = value;
590
+ let item = items.get(key);
591
+ item ? item.count++ : (item = {
592
+ title: value,
587
593
  leaf: !0,
588
- checked: l.size ? l.has(Q) : !s,
589
- key: x,
594
+ checked: alreadyChecked.size ? alreadyChecked.has(value) : !blankChecked,
595
+ key,
590
596
  count: 1
591
- }, a.set(x, z), c.set(x, [x]));
597
+ }, items.set(key, item), treeMap.set(key, [key]));
592
598
  }
593
- J++;
599
+ rowIndex++;
594
600
  }
595
601
  }
596
- const T = t ? s : !0;
597
- if (m > 0) {
598
- const y = {
599
- title: e.t("sheets-filter.panel.empty"),
600
- count: m,
602
+ const initialBlankChecked = filters ? blankChecked : !0;
603
+ if (emptyCount > 0) {
604
+ const item = {
605
+ title: localeService.t("sheets-filter.panel.empty"),
606
+ count: emptyCount,
601
607
  leaf: !0,
602
- checked: T,
603
- key: g
608
+ checked: initialBlankChecked,
609
+ key: EmptyKey
604
610
  };
605
- a.set("empty", y), c.set("empty", [g]);
611
+ items.set("empty", item), treeMap.set("empty", [EmptyKey]);
606
612
  }
607
613
  return {
608
- filterTreeItems: is(Array.from(a.values())),
609
- filterTreeMapCache: c
614
+ filterTreeItems: generateFilterTreeBySort(Array.from(items.values())),
615
+ filterTreeMapCache: treeMap
610
616
  };
611
617
  }
612
- function is(t) {
613
- return Array.from(t).sort((e, r) => e.children && !r.children ? -1 : !e.children && r.children ? 1 : r.title.localeCompare(e.title)).map((e) => (e.children && e.children.sort((r, n) => {
614
- const i = Number.parseInt(r.key.split("-")[1], 10), l = Number.parseInt(n.key.split("-")[1], 10);
615
- return i - l;
616
- }).forEach((r) => {
617
- r.children && r.children.sort((n, i) => {
618
- const l = Number.parseInt(n.key.split("-")[2], 10), s = Number.parseInt(i.key.split("-")[2], 10);
619
- return l - s;
618
+ __name(getFilterTreeByValueItems, "getFilterTreeByValueItems");
619
+ function generateFilterTreeBySort(tree) {
620
+ return Array.from(tree).sort((a, b) => a.children && !b.children ? -1 : !a.children && b.children ? 1 : b.title.localeCompare(a.title)).map((yearItem) => (yearItem.children && yearItem.children.sort((a, b) => {
621
+ const monthA = Number.parseInt(a.key.split("-")[1], 10), monthB = Number.parseInt(b.key.split("-")[1], 10);
622
+ return monthA - monthB;
623
+ }).forEach((monthItem) => {
624
+ monthItem.children && monthItem.children.sort((a, b) => {
625
+ const dayA = Number.parseInt(a.key.split("-")[2], 10), dayB = Number.parseInt(b.key.split("-")[2], 10);
626
+ return dayA - dayB;
620
627
  });
621
- }), e));
628
+ }), yearItem));
622
629
  }
623
- function ke(t, e) {
624
- for (const r of t) {
625
- if (r.key === e)
626
- return r;
627
- if (r.children) {
628
- const n = ke(r.children, e);
629
- if (n)
630
- return n;
630
+ __name(generateFilterTreeBySort, "generateFilterTreeBySort");
631
+ function findObjectByKey(data, targetKey) {
632
+ for (const node of data) {
633
+ if (node.key === targetKey)
634
+ return node;
635
+ if (node.children) {
636
+ const result = findObjectByKey(node.children, targetKey);
637
+ if (result)
638
+ return result;
631
639
  }
632
640
  }
633
641
  return null;
634
642
  }
635
- function Ut(t) {
636
- return t.leaf ? t.checked : t.children ? t.children.every((e) => Ut(e)) : !0;
643
+ __name(findObjectByKey, "findObjectByKey");
644
+ function areAllLeafNodesChecked(node) {
645
+ return node.leaf ? node.checked : node.children ? node.children.every((child) => areAllLeafNodesChecked(child)) : !0;
637
646
  }
638
- function he(t, e) {
639
- t.leaf && (e !== void 0 ? t.checked = e : t.checked = !t.checked), t.children && t.children.forEach((r) => he(r, e));
647
+ __name(areAllLeafNodesChecked, "areAllLeafNodesChecked");
648
+ function updateLeafNodesCheckedStatus(node, status) {
649
+ node.leaf && (status !== void 0 ? node.checked = status : node.checked = !node.checked), node.children && node.children.forEach((child) => updateLeafNodesCheckedStatus(child, status));
640
650
  }
641
- function Ht(t, e) {
642
- const r = [];
643
- return t.forEach((n) => {
644
- const i = n.originValues ? e.some(
645
- (o) => Array.from(n.originValues).some(
646
- (a) => a.toLowerCase().includes(o.toLowerCase())
651
+ __name(updateLeafNodesCheckedStatus, "updateLeafNodesCheckedStatus");
652
+ function searchTree(items, searchKeywords) {
653
+ const result = [];
654
+ return items.forEach((item) => {
655
+ const originMatches = item.originValues ? searchKeywords.some(
656
+ (keyword) => Array.from(item.originValues).some(
657
+ (value) => value.toLowerCase().includes(keyword.toLowerCase())
647
658
  )
648
- ) : !1, l = !i && e.some(
649
- (o) => n.title.toLowerCase().includes(o.toLowerCase())
659
+ ) : !1, titleMatches = !originMatches && searchKeywords.some(
660
+ (keyword) => item.title.toLowerCase().includes(keyword.toLowerCase())
650
661
  );
651
- if (i || l)
652
- r.push({ ...n });
653
- else if (n.children) {
654
- const o = Ht(n.children, e);
655
- if (o.length > 0) {
656
- const a = o.reduce((c, h) => c + h.count, 0);
657
- r.push({ ...n, count: a, children: o });
662
+ if (originMatches || titleMatches)
663
+ result.push({ ...item });
664
+ else if (item.children) {
665
+ const filteredChildren = searchTree(item.children, searchKeywords);
666
+ if (filteredChildren.length > 0) {
667
+ const aggregatedCount = filteredChildren.reduce((sum, child) => sum + child.count, 0);
668
+ result.push({ ...item, count: aggregatedCount, children: filteredChildren });
658
669
  }
659
670
  }
660
- }), r;
671
+ }), result;
661
672
  }
662
- var os = Object.defineProperty, as = Object.getOwnPropertyDescriptor, rt = (t, e, r, n) => {
663
- for (var i = n > 1 ? void 0 : n ? as(e, r) : e, l = t.length - 1, s; l >= 0; l--)
664
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
665
- return n && i && os(e, r, i), i;
666
- }, Oe = (t, e) => (r, n) => e(r, n, t), Re = /* @__PURE__ */ ((t) => (t[t.VALUES = 0] = "VALUES", t[t.CONDITIONS = 1] = "CONDITIONS", t))(Re || {});
667
- gt("sheets-filter-ui.sheets-filter-panel.service");
668
- let j = class extends pe {
669
- constructor(e, r) {
673
+ __name(searchTree, "searchTree");
674
+ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
675
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
676
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
677
+ return kind && result && __defProp$8(target, key, result), result;
678
+ }, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), FilterBy = /* @__PURE__ */ ((FilterBy2) => (FilterBy2[FilterBy2.VALUES = 0] = "VALUES", FilterBy2[FilterBy2.CONDITIONS = 1] = "CONDITIONS", FilterBy2))(FilterBy || {});
679
+ createIdentifier("sheets-filter-ui.sheets-filter-panel.service");
680
+ var _a2;
681
+ let SheetsFilterPanelService = (_a2 = class extends Disposable {
682
+ constructor(_injector, _refRangeService) {
670
683
  super();
671
- _(this, "_filterBy$", new q(
684
+ __publicField(this, "_filterBy$", new BehaviorSubject(
672
685
  0
673
686
  /* VALUES */
674
687
  ));
675
- _(this, "filterBy$", this._filterBy$.asObservable());
676
- _(this, "_filterByModel$", new xr(1));
677
- _(this, "filterByModel$", this._filterByModel$.asObservable());
678
- _(this, "_filterByModel", null);
679
- _(this, "_hasCriteria$", new q(!1));
680
- _(this, "hasCriteria$", this._hasCriteria$.asObservable());
681
- _(this, "_filterModel", null);
682
- _(this, "_col$", new q(-1));
683
- _(this, "col$", this._col$.asObservable());
684
- _(this, "_filterHeaderListener", null);
685
- this._injector = e, this._refRangeService = r;
688
+ __publicField(this, "filterBy$", this._filterBy$.asObservable());
689
+ __publicField(this, "_filterByModel$", new ReplaySubject(1));
690
+ __publicField(this, "filterByModel$", this._filterByModel$.asObservable());
691
+ __publicField(this, "_filterByModel", null);
692
+ __publicField(this, "_hasCriteria$", new BehaviorSubject(!1));
693
+ __publicField(this, "hasCriteria$", this._hasCriteria$.asObservable());
694
+ __publicField(this, "_filterModel", null);
695
+ __publicField(this, "_col$", new BehaviorSubject(-1));
696
+ __publicField(this, "col$", this._col$.asObservable());
697
+ __publicField(this, "_filterHeaderListener", null);
698
+ this._injector = _injector, this._refRangeService = _refRangeService;
686
699
  }
687
700
  get filterBy() {
688
701
  return this._filterBy$.getValue();
@@ -690,8 +703,8 @@ let j = class extends pe {
690
703
  get filterByModel() {
691
704
  return this._filterByModel;
692
705
  }
693
- set filterByModel(e) {
694
- this._filterByModel = e, this._filterByModel$.next(e);
706
+ set filterByModel(model) {
707
+ this._filterByModel = model, this._filterByModel$.next(model);
695
708
  }
696
709
  get filterModel() {
697
710
  return this._filterModel;
@@ -702,98 +715,99 @@ let j = class extends pe {
702
715
  dispose() {
703
716
  this._filterBy$.complete(), this._filterByModel$.complete(), this._hasCriteria$.complete();
704
717
  }
705
- setupCol(e, r) {
706
- this.terminate(), this._filterModel = e, this._col$.next(r);
707
- const n = e.getFilterColumn(r);
708
- if (n) {
709
- const i = n.getColumnData();
710
- if (i.customFilters) {
711
- this._hasCriteria$.next(!0), this._setupByConditions(e, r);
718
+ setupCol(filterModel, col) {
719
+ this.terminate(), this._filterModel = filterModel, this._col$.next(col);
720
+ const filterColumn = filterModel.getFilterColumn(col);
721
+ if (filterColumn) {
722
+ const info = filterColumn.getColumnData();
723
+ if (info.customFilters) {
724
+ this._hasCriteria$.next(!0), this._setupByConditions(filterModel, col);
712
725
  return;
713
726
  }
714
- if (i.filters) {
715
- this._hasCriteria$.next(!0), this._setupByValues(e, r);
727
+ if (info.filters) {
728
+ this._hasCriteria$.next(!0), this._setupByValues(filterModel, col);
716
729
  return;
717
730
  }
718
- this._hasCriteria$.next(!1), this._setupByValues(e, r);
731
+ this._hasCriteria$.next(!1), this._setupByValues(filterModel, col);
719
732
  return;
720
733
  }
721
- this._hasCriteria$.next(!1), this._setupByValues(e, r);
734
+ this._hasCriteria$.next(!1), this._setupByValues(filterModel, col);
722
735
  }
723
- changeFilterBy(e) {
724
- return !this._filterModel || this.col === -1 ? !1 : (e === 0 ? this._setupByValues(this._filterModel, this.col) : this._setupByConditions(this._filterModel, this.col), !0);
736
+ changeFilterBy(filterBy) {
737
+ return !this._filterModel || this.col === -1 ? !1 : (filterBy === 0 ? this._setupByValues(this._filterModel, this.col) : this._setupByConditions(this._filterModel, this.col), !0);
725
738
  }
726
739
  terminate() {
727
740
  return this._filterModel = null, this._col$.next(-1), this._disposeFilterHeaderChangeListener(), !0;
728
741
  }
729
742
  _disposeFilterHeaderChangeListener() {
730
- var e;
731
- (e = this._filterHeaderListener) == null || e.dispose(), this._filterHeaderListener = null;
743
+ var _a13;
744
+ (_a13 = this._filterHeaderListener) == null || _a13.dispose(), this._filterHeaderListener = null;
732
745
  }
733
- _listenToFilterHeaderChange(e, r) {
746
+ _listenToFilterHeaderChange(filterModel, col) {
734
747
  this._disposeFilterHeaderChangeListener();
735
- const n = e.unitId, i = e.subUnitId, l = e.getRange(), s = {
736
- startColumn: r,
737
- startRow: l.startRow,
738
- endRow: l.startRow,
739
- endColumn: r
748
+ const unitId = filterModel.unitId, subUnitId = filterModel.subUnitId, filterRange = filterModel.getRange(), columnHeaderRange = {
749
+ startColumn: col,
750
+ startRow: filterRange.startRow,
751
+ endRow: filterRange.startRow,
752
+ endColumn: col
740
753
  };
741
- this._filterHeaderListener = this._refRangeService.watchRange(n, i, s, (o, a) => {
742
- if (!a)
754
+ this._filterHeaderListener = this._refRangeService.watchRange(unitId, subUnitId, columnHeaderRange, (before, after) => {
755
+ if (!after)
743
756
  this.terminate();
744
757
  else {
745
- const c = a.startColumn - o.startColumn;
746
- c !== 0 && this._filterByModel.deltaCol(c);
758
+ const offset = after.startColumn - before.startColumn;
759
+ offset !== 0 && this._filterByModel.deltaCol(offset);
747
760
  }
748
761
  });
749
762
  }
750
- async _setupByValues(e, r) {
763
+ async _setupByValues(filterModel, col) {
751
764
  this._disposePreviousModel();
752
- const n = e.getRange();
753
- if (n.startRow === n.endRow) return !1;
754
- const i = await ye.fromFilterColumn(
765
+ const range = filterModel.getRange();
766
+ if (range.startRow === range.endRow) return !1;
767
+ const filterByModel = await ByValuesModel.fromFilterColumn(
755
768
  this._injector,
756
- e,
757
- r
769
+ filterModel,
770
+ col
758
771
  );
759
- return this.filterByModel = i, this._filterBy$.next(
772
+ return this.filterByModel = filterByModel, this._filterBy$.next(
760
773
  0
761
774
  /* VALUES */
762
- ), this._listenToFilterHeaderChange(e, r), !0;
775
+ ), this._listenToFilterHeaderChange(filterModel, col), !0;
763
776
  }
764
- _setupByConditions(e, r) {
777
+ _setupByConditions(filterModel, col) {
765
778
  this._disposePreviousModel();
766
- const n = e.getRange();
767
- if (n.startRow === n.endRow) return !1;
768
- const i = Ie.fromFilterColumn(
779
+ const range = filterModel.getRange();
780
+ if (range.startRow === range.endRow) return !1;
781
+ const model = ByConditionsModel.fromFilterColumn(
769
782
  this._injector,
770
- e,
771
- r,
772
- e.getFilterColumn(r)
783
+ filterModel,
784
+ col,
785
+ filterModel.getFilterColumn(col)
773
786
  );
774
- return this.filterByModel = i, this._filterBy$.next(
787
+ return this.filterByModel = model, this._filterBy$.next(
775
788
  1
776
789
  /* CONDITIONS */
777
- ), this._listenToFilterHeaderChange(e, r), !0;
790
+ ), this._listenToFilterHeaderChange(filterModel, col), !0;
778
791
  }
779
792
  _disposePreviousModel() {
780
- var e;
781
- (e = this._filterByModel) == null || e.dispose(), this.filterByModel = null;
782
- }
783
- };
784
- j = rt([
785
- Oe(0, E(X)),
786
- Oe(1, E(hr))
787
- ], j);
788
- let Ie = class extends pe {
789
- constructor(e, r, n, i, l) {
793
+ var _a13;
794
+ (_a13 = this._filterByModel) == null || _a13.dispose(), this.filterByModel = null;
795
+ }
796
+ }, __name(_a2, "SheetsFilterPanelService"), _a2);
797
+ SheetsFilterPanelService = __decorateClass$8([
798
+ __decorateParam$8(0, Inject(Injector)),
799
+ __decorateParam$8(1, Inject(RefRangeService))
800
+ ], SheetsFilterPanelService);
801
+ var _a3;
802
+ let ByConditionsModel = (_a3 = class extends Disposable {
803
+ constructor(_filterModel, col, conditionItem, conditionParams, _commandService) {
790
804
  super();
791
- _(this, "canApply$", _e(!0));
792
- _(this, "_conditionItem$");
793
- _(this, "conditionItem$");
794
- _(this, "_filterConditionFormParams$");
795
- _(this, "filterConditionFormParams$");
796
- this._filterModel = e, this.col = r, this._commandService = l, this._conditionItem$ = new q(n), this.conditionItem$ = this._conditionItem$.asObservable(), this._filterConditionFormParams$ = new q(i), this.filterConditionFormParams$ = this._filterConditionFormParams$.asObservable();
805
+ __publicField(this, "canApply$", of(!0));
806
+ __publicField(this, "_conditionItem$");
807
+ __publicField(this, "conditionItem$");
808
+ __publicField(this, "_filterConditionFormParams$");
809
+ __publicField(this, "filterConditionFormParams$");
810
+ this._filterModel = _filterModel, this.col = col, this._commandService = _commandService, this._conditionItem$ = new BehaviorSubject(conditionItem), this.conditionItem$ = this._conditionItem$.asObservable(), this._filterConditionFormParams$ = new BehaviorSubject(conditionParams), this.filterConditionFormParams$ = this._filterConditionFormParams$.asObservable();
797
811
  }
798
812
  /**
799
813
  * Create a model with targeting filter column. If there is not a filter column, the model would be created with
@@ -806,9 +820,9 @@ let Ie = class extends pe {
806
820
  *
807
821
  * @returns the model to control the panel's state
808
822
  */
809
- static fromFilterColumn(e, r, n, i) {
810
- const [l, s] = f.testMappingFilterColumn(i == null ? void 0 : i.getColumnData());
811
- return e.createInstance(Ie, r, n, l, s);
823
+ static fromFilterColumn(injector, filterModel, col, filterColumn) {
824
+ const [conditionItem, conditionParams] = FilterConditionItems.testMappingFilterColumn(filterColumn == null ? void 0 : filterColumn.getColumnData());
825
+ return injector.createInstance(ByConditionsModel, filterModel, col, conditionItem, conditionParams);
812
826
  }
813
827
  get conditionItem() {
814
828
  return this._conditionItem$.getValue();
@@ -819,11 +833,11 @@ let Ie = class extends pe {
819
833
  dispose() {
820
834
  super.dispose(), this._conditionItem$.complete(), this._filterConditionFormParams$.complete();
821
835
  }
822
- deltaCol(e) {
823
- this.col += e;
836
+ deltaCol(offset) {
837
+ this.col += offset;
824
838
  }
825
839
  clear() {
826
- return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand(re.id, {
840
+ return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand(SetSheetsFilterCriteriaCommand.id, {
827
841
  unitId: this._filterModel.unitId,
828
842
  subUnitId: this._filterModel.subUnitId,
829
843
  col: this.col,
@@ -835,23 +849,23 @@ let Ie = class extends pe {
835
849
  */
836
850
  async apply() {
837
851
  if (this._disposed) return !1;
838
- const e = f.mapToFilterColumn(this.conditionItem, this.filterConditionFormParams);
839
- return this._commandService.executeCommand(re.id, {
852
+ const filterColumn = FilterConditionItems.mapToFilterColumn(this.conditionItem, this.filterConditionFormParams);
853
+ return this._commandService.executeCommand(SetSheetsFilterCriteriaCommand.id, {
840
854
  unitId: this._filterModel.unitId,
841
855
  subUnitId: this._filterModel.subUnitId,
842
856
  col: this.col,
843
- criteria: e
857
+ criteria: filterColumn
844
858
  });
845
859
  }
846
860
  /**
847
861
  * This method would be called when user changes the primary condition. The model would load the corresponding
848
862
  * `IFilterConditionFormParams` and load default condition form params.
849
863
  */
850
- onPrimaryConditionChange(e) {
851
- const r = f.ALL_CONDITIONS.find((n) => n.operator === e);
852
- if (!r)
853
- throw new Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);
854
- this._conditionItem$.next(r), this._filterConditionFormParams$.next(f.getInitialFormParams(e));
864
+ onPrimaryConditionChange(operator) {
865
+ const conditionItem = FilterConditionItems.ALL_CONDITIONS.find((item) => item.operator === operator);
866
+ if (!conditionItem)
867
+ throw new Error(`[ByConditionsModel]: condition item not found for operator: ${operator}!`);
868
+ this._conditionItem$.next(conditionItem), this._filterConditionFormParams$.next(FilterConditionItems.getInitialFormParams(operator));
855
869
  }
856
870
  /**
857
871
  * This method would be called when user changes the primary conditions, the input values or "AND" "OR" ratio.
@@ -861,46 +875,47 @@ let Ie = class extends pe {
861
875
  *
862
876
  * @param params
863
877
  */
864
- onConditionFormChange(e) {
865
- const r = { ...this.filterConditionFormParams, ...e };
866
- if (r.and !== !0 && delete r.and, typeof e.and < "u" || typeof e.operator1 < "u" || typeof e.operator2 < "u") {
867
- const n = f.testMappingParams(r, this.conditionItem.numOfParameters);
868
- this._conditionItem$.next(n);
878
+ onConditionFormChange(params) {
879
+ const newParams = { ...this.filterConditionFormParams, ...params };
880
+ if (newParams.and !== !0 && delete newParams.and, typeof params.and < "u" || typeof params.operator1 < "u" || typeof params.operator2 < "u") {
881
+ const conditionItem = FilterConditionItems.testMappingParams(newParams, this.conditionItem.numOfParameters);
882
+ this._conditionItem$.next(conditionItem);
869
883
  }
870
- this._filterConditionFormParams$.next(r);
871
- }
872
- };
873
- Ie = rt([
874
- Oe(4, W)
875
- ], Ie);
876
- let ye = class extends pe {
877
- constructor(e, r, n, i, l) {
884
+ this._filterConditionFormParams$.next(newParams);
885
+ }
886
+ }, __name(_a3, "ByConditionsModel"), _a3);
887
+ ByConditionsModel = __decorateClass$8([
888
+ __decorateParam$8(4, ICommandService)
889
+ ], ByConditionsModel);
890
+ var _a4;
891
+ let ByValuesModel = (_a4 = class extends Disposable {
892
+ constructor(_filterModel, col, items, cache, _commandService) {
878
893
  super();
879
- _(this, "_rawFilterItems$");
880
- _(this, "rawFilterItems$");
881
- _(this, "filterItems$");
882
- _(this, "_filterItems", []);
883
- _(this, "_treeMapCache");
884
- _(this, "canApply$");
885
- _(this, "_manuallyUpdateFilterItems$");
886
- _(this, "_searchString$");
887
- _(this, "searchString$");
888
- this._filterModel = e, this.col = r, this._commandService = l, this._treeMapCache = i, this._searchString$ = new q(""), this.searchString$ = this._searchString$.asObservable(), this._rawFilterItems$ = new q(n), this.rawFilterItems$ = this._rawFilterItems$.asObservable(), this._manuallyUpdateFilterItems$ = new Br(), this.filterItems$ = Vr(
889
- jr([
894
+ __publicField(this, "_rawFilterItems$");
895
+ __publicField(this, "rawFilterItems$");
896
+ __publicField(this, "filterItems$");
897
+ __publicField(this, "_filterItems", []);
898
+ __publicField(this, "_treeMapCache");
899
+ __publicField(this, "canApply$");
900
+ __publicField(this, "_manuallyUpdateFilterItems$");
901
+ __publicField(this, "_searchString$");
902
+ __publicField(this, "searchString$");
903
+ this._filterModel = _filterModel, this.col = col, this._commandService = _commandService, this._treeMapCache = cache, this._searchString$ = new BehaviorSubject(""), this.searchString$ = this._searchString$.asObservable(), this._rawFilterItems$ = new BehaviorSubject(items), this.rawFilterItems$ = this._rawFilterItems$.asObservable(), this._manuallyUpdateFilterItems$ = new Subject(), this.filterItems$ = merge(
904
+ combineLatest([
890
905
  this._searchString$.pipe(
891
- It(500, void 0, { leading: !0, trailing: !0 }),
892
- yt(void 0)
906
+ throttleTime(500, void 0, { leading: !0, trailing: !0 }),
907
+ startWith(void 0)
893
908
  ),
894
909
  this._rawFilterItems$
895
910
  ]).pipe(
896
- se(([s, o]) => {
897
- if (!s) return o;
898
- const c = s.toLowerCase().split(/\s+/).filter((h) => !!h);
899
- return Ht(o, c);
911
+ map(([searchString, items2]) => {
912
+ if (!searchString) return items2;
913
+ const searchKeyWords = searchString.toLowerCase().split(/\s+/).filter((s) => !!s);
914
+ return searchTree(items2, searchKeyWords);
900
915
  })
901
916
  ),
902
917
  this._manuallyUpdateFilterItems$
903
- ).pipe(Wr(1)), this.canApply$ = this.filterItems$.pipe(se((s) => je(s).checked > 0)), this.disposeWithMe(this.filterItems$.subscribe((s) => this._filterItems = s));
918
+ ).pipe(shareReplay(1)), this.canApply$ = this.filterItems$.pipe(map((items2) => statisticFilterByValueItems(items2).checked > 0)), this.disposeWithMe(this.filterItems$.subscribe((items2) => this._filterItems = items2));
904
919
  }
905
920
  /**
906
921
  * Create a model with targeting filter column. If there is not a filter column, the model would be created with
@@ -912,30 +927,30 @@ let ye = class extends pe {
912
927
  *
913
928
  * @returns the model to control the panel's state
914
929
  */
915
- static async fromFilterColumn(e, r, n) {
916
- var M;
917
- const i = e.get(Ye), l = e.get(K), s = e.get(Pe, vt.OPTIONAL), { unitId: o, subUnitId: a } = r, c = i.getUniverSheetInstance(o);
918
- if (!c) throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${o}!`);
919
- const h = c == null ? void 0 : c.getSheetBySheetId(a);
920
- if (!h) throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${o} and subUnitId: ${a}!`);
921
- const d = r.getRange(), g = n, m = (M = r.getFilterColumn(n)) == null ? void 0 : M.getColumnData().filters, T = new Set(m == null ? void 0 : m.filters), v = !!(m && m.blank), P = r.getFilteredOutRowsExceptCol(n), F = { ...d, startRow: d.startRow + 1, startColumn: g, endColumn: g };
922
- let I, R;
923
- if (s) {
924
- const $ = await s.getFilterValues({
925
- unitId: o,
926
- subUnitId: a,
927
- filteredOutRowsByOtherColumns: Array.from(P),
928
- filters: !!m,
929
- blankChecked: v,
930
- iterateRange: F,
931
- alreadyChecked: Array.from(T)
930
+ static async fromFilterColumn(injector, filterModel, col) {
931
+ var _a13;
932
+ const univerInstanceService = injector.get(IUniverInstanceService), localeService = injector.get(LocaleService), generateFilterValuesService = injector.get(ISheetsGenerateFilterValuesService, Quantity.OPTIONAL), { unitId, subUnitId } = filterModel, workbook = univerInstanceService.getUniverSheetInstance(unitId);
933
+ if (!workbook) throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${unitId}!`);
934
+ const worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId);
935
+ if (!worksheet) throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${unitId} and subUnitId: ${subUnitId}!`);
936
+ const range = filterModel.getRange(), column = col, filters = (_a13 = filterModel.getFilterColumn(col)) == null ? void 0 : _a13.getColumnData().filters, alreadyChecked = new Set(filters == null ? void 0 : filters.filters), blankChecked = !!(filters && filters.blank), filteredOutRowsByOtherColumns = filterModel.getFilteredOutRowsExceptCol(col), iterateRange = { ...range, startRow: range.startRow + 1, startColumn: column, endColumn: column };
937
+ let items, cache;
938
+ if (generateFilterValuesService) {
939
+ const res = await generateFilterValuesService.getFilterValues({
940
+ unitId,
941
+ subUnitId,
942
+ filteredOutRowsByOtherColumns: Array.from(filteredOutRowsByOtherColumns),
943
+ filters: !!filters,
944
+ blankChecked,
945
+ iterateRange,
946
+ alreadyChecked: Array.from(alreadyChecked)
932
947
  });
933
- I = $.filterTreeItems, R = $.filterTreeMapCache;
948
+ items = res.filterTreeItems, cache = res.filterTreeMapCache;
934
949
  } else {
935
- const $ = wt(!!m, l, F, h, P, T, v, c.getStyles());
936
- I = $.filterTreeItems, R = $.filterTreeMapCache;
950
+ const res = getFilterTreeByValueItems(!!filters, localeService, iterateRange, worksheet, filteredOutRowsByOtherColumns, alreadyChecked, blankChecked, workbook.getStyles());
951
+ items = res.filterTreeItems, cache = res.filterTreeMapCache;
937
952
  }
938
- return e.createInstance(ye, r, n, I, R);
953
+ return injector.createInstance(ByValuesModel, filterModel, col, items, cache);
939
954
  }
940
955
  get rawFilterItems() {
941
956
  return this._rawFilterItems$.getValue();
@@ -949,40 +964,40 @@ let ye = class extends pe {
949
964
  dispose() {
950
965
  this._rawFilterItems$.complete(), this._searchString$.complete();
951
966
  }
952
- deltaCol(e) {
953
- this.col += e;
967
+ deltaCol(offset) {
968
+ this.col += offset;
954
969
  }
955
- setSearchString(e) {
956
- this._searchString$.next(e);
970
+ setSearchString(str) {
971
+ this._searchString$.next(str);
957
972
  }
958
- onCheckAllToggled(e) {
959
- const r = Fe.deepClone(this._filterItems);
960
- r.forEach((n) => he(n, e)), this._manuallyUpdateFilterItems(r);
973
+ onCheckAllToggled(checked) {
974
+ const items = Tools.deepClone(this._filterItems);
975
+ items.forEach((item) => updateLeafNodesCheckedStatus(item, checked)), this._manuallyUpdateFilterItems(items);
961
976
  }
962
977
  /**
963
978
  * Toggle a filter item.
964
979
  */
965
- onFilterCheckToggled(e) {
966
- const r = Fe.deepClone(this._filterItems), n = ke(r, e.key);
967
- if (!n)
980
+ onFilterCheckToggled(item) {
981
+ const items = Tools.deepClone(this._filterItems), changedItem = findObjectByKey(items, item.key);
982
+ if (!changedItem)
968
983
  return;
969
- const i = Ut(n);
970
- he(n, !i), this._manuallyUpdateFilterItems(r);
984
+ const allLeafChecked = areAllLeafNodesChecked(changedItem);
985
+ updateLeafNodesCheckedStatus(changedItem, !allLeafChecked), this._manuallyUpdateFilterItems(items);
971
986
  }
972
- onFilterOnly(e) {
973
- const r = Fe.deepClone(this._filterItems);
974
- r.forEach((n) => he(n, !1)), e.forEach((n) => {
975
- const i = ke(r, n);
976
- i && he(i, !0);
977
- }), this._manuallyUpdateFilterItems(r);
987
+ onFilterOnly(itemKeys) {
988
+ const items = Tools.deepClone(this._filterItems);
989
+ items.forEach((item) => updateLeafNodesCheckedStatus(item, !1)), itemKeys.forEach((key) => {
990
+ const changedItem = findObjectByKey(items, key);
991
+ changedItem && updateLeafNodesCheckedStatus(changedItem, !0);
992
+ }), this._manuallyUpdateFilterItems(items);
978
993
  }
979
- _manuallyUpdateFilterItems(e) {
980
- this._manuallyUpdateFilterItems$.next(e);
994
+ _manuallyUpdateFilterItems(items) {
995
+ this._manuallyUpdateFilterItems$.next(items);
981
996
  }
982
997
  // expose method here to let the panel change filter items
983
998
  // #region ByValuesModel apply methods
984
999
  clear() {
985
- return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand(re.id, {
1000
+ return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand(SetSheetsFilterCriteriaCommand.id, {
986
1001
  unitId: this._filterModel.unitId,
987
1002
  subUnitId: this._filterModel.subUnitId,
988
1003
  col: this.col,
@@ -995,541 +1010,521 @@ let ye = class extends pe {
995
1010
  async apply() {
996
1011
  if (this._disposed)
997
1012
  return !1;
998
- const e = je(this._filterItems), { checked: r, checkedItems: n } = e, i = this.rawFilterItems;
999
- let l = 0;
1000
- for (const c of i)
1001
- l += c.count;
1002
- const s = r === 0, o = e.checked === l, a = { colId: this.col };
1003
- if (s)
1013
+ const statistics = statisticFilterByValueItems(this._filterItems), { checked, checkedItems } = statistics, rawFilterItems = this.rawFilterItems;
1014
+ let rawFilterCount = 0;
1015
+ for (const item of rawFilterItems)
1016
+ rawFilterCount += item.count;
1017
+ const noChecked = checked === 0, allChecked = statistics.checked === rawFilterCount, criteria = { colId: this.col };
1018
+ if (noChecked)
1004
1019
  throw new Error("[ByValuesModel]: no checked items!");
1005
- if (o)
1006
- return this._commandService.executeCommand(re.id, {
1020
+ if (allChecked)
1021
+ return this._commandService.executeCommand(SetSheetsFilterCriteriaCommand.id, {
1007
1022
  unitId: this._filterModel.unitId,
1008
1023
  subUnitId: this._filterModel.subUnitId,
1009
1024
  col: this.col,
1010
1025
  criteria: null
1011
1026
  });
1012
1027
  {
1013
- a.filters = {};
1014
- const c = n.filter((d) => d.key !== "empty");
1015
- c.length > 0 && (a.filters = {
1016
- filters: c.flatMap((d) => d.originValues ? Array.from(d.originValues) : [d.title])
1017
- }), c.length !== n.length && (a.filters.blank = !0);
1028
+ criteria.filters = {};
1029
+ const nonEmptyItems = checkedItems.filter((item) => item.key !== "empty");
1030
+ nonEmptyItems.length > 0 && (criteria.filters = {
1031
+ filters: nonEmptyItems.flatMap((item) => item.originValues ? Array.from(item.originValues) : [item.title])
1032
+ }), nonEmptyItems.length !== checkedItems.length && (criteria.filters.blank = !0);
1018
1033
  }
1019
- return this._commandService.executeCommand(re.id, {
1034
+ return this._commandService.executeCommand(SetSheetsFilterCriteriaCommand.id, {
1020
1035
  unitId: this._filterModel.unitId,
1021
1036
  subUnitId: this._filterModel.subUnitId,
1022
1037
  col: this.col,
1023
- criteria: a
1038
+ criteria
1024
1039
  });
1025
1040
  }
1026
1041
  // #endregion
1027
- };
1028
- ye = rt([
1029
- Oe(4, W)
1030
- ], ye);
1031
- const ne = "FILTER_PANEL_OPENED", Ae = {
1042
+ }, __name(_a4, "ByValuesModel"), _a4);
1043
+ ByValuesModel = __decorateClass$8([
1044
+ __decorateParam$8(4, ICommandService)
1045
+ ], ByValuesModel);
1046
+ const FILTER_PANEL_OPENED_KEY = "FILTER_PANEL_OPENED", OpenFilterPanelOperation = {
1032
1047
  id: "sheet.operation.open-filter-panel",
1033
- type: $e.OPERATION,
1034
- handler: (t, e) => {
1035
- const r = t.get(we), n = t.get(k), i = t.get(j);
1036
- t.get(W).syncExecuteCommand(Ir.id, { visible: !1 });
1037
- const { unitId: s, subUnitId: o, col: a } = e, c = n.getFilterModel(s, o);
1038
- return c ? (i.setupCol(c, a), r.getContextValue(ne) || r.setContextValue(ne, !0), !0) : !1;
1039
- }
1040
- }, de = {
1048
+ type: CommandType.OPERATION,
1049
+ handler: /* @__PURE__ */ __name((accessor, params) => {
1050
+ const contextService = accessor.get(IContextService), sheetsFilterService = accessor.get(SheetsFilterService), sheetsFilterPanelService = accessor.get(SheetsFilterPanelService);
1051
+ accessor.get(ICommandService).syncExecuteCommand(SetCellEditVisibleOperation.id, { visible: !1 });
1052
+ const { unitId, subUnitId, col } = params, filterModel = sheetsFilterService.getFilterModel(unitId, subUnitId);
1053
+ return filterModel ? (sheetsFilterPanelService.setupCol(filterModel, col), contextService.getContextValue(FILTER_PANEL_OPENED_KEY) || contextService.setContextValue(FILTER_PANEL_OPENED_KEY, !0), !0) : !1;
1054
+ }, "handler")
1055
+ }, CloseFilterPanelOperation = {
1041
1056
  id: "sheet.operation.close-filter-panel",
1042
- type: $e.OPERATION,
1043
- handler: (t) => {
1044
- const e = t.get(we), r = t.get(j), n = t.get(vr, vt.OPTIONAL);
1045
- return e.getContextValue(ne) ? (e.setContextValue(ne, !1), n == null || n.focus(), r.terminate()) : !1;
1046
- }
1047
- }, Dt = {
1057
+ type: CommandType.OPERATION,
1058
+ handler: /* @__PURE__ */ __name((accessor) => {
1059
+ const contextService = accessor.get(IContextService), sheetsFilterPanelService = accessor.get(SheetsFilterPanelService), layoutService = accessor.get(ILayoutService, Quantity.OPTIONAL);
1060
+ return contextService.getContextValue(FILTER_PANEL_OPENED_KEY) ? (contextService.setContextValue(FILTER_PANEL_OPENED_KEY, !1), layoutService == null || layoutService.focus(), sheetsFilterPanelService.terminate()) : !1;
1061
+ }, "handler")
1062
+ }, ChangeFilterByOperation = {
1048
1063
  id: "sheet.operation.apply-filter",
1049
- type: $e.OPERATION,
1050
- handler: (t, e) => {
1051
- const { filterBy: r } = e;
1052
- return t.get(j).changeFilterBy(r);
1053
- }
1064
+ type: CommandType.OPERATION,
1065
+ handler: /* @__PURE__ */ __name((accessor, params) => {
1066
+ const { filterBy } = params;
1067
+ return accessor.get(SheetsFilterPanelService).changeFilterBy(filterBy);
1068
+ }, "handler")
1054
1069
  };
1055
- var ls = Object.defineProperty, cs = Object.getOwnPropertyDescriptor, us = (t, e, r, n) => {
1056
- for (var i = n > 1 ? void 0 : n ? cs(e, r) : e, l = t.length - 1, s; l >= 0; l--)
1057
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
1058
- return n && i && ls(e, r, i), i;
1059
- }, ee = (t, e) => (r, n) => e(r, n, t);
1060
- let ie = class extends pe {
1061
- constructor(t, e, r, n, i, l) {
1062
- super(), this._sheetsFilterService = t, this._localeService = e, this._commandService = r, this._sheetPermissionCheckPermission = n, this._injector = i, this._sheetsSelectionService = l, this._commandExecutedListener();
1070
+ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1071
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1072
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1073
+ return kind && result && __defProp$7(target, key, result), result;
1074
+ }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a5;
1075
+ let SheetsFilterPermissionController = (_a5 = class extends Disposable {
1076
+ constructor(_sheetsFilterService, _localeService, _commandService, _sheetPermissionCheckPermission, _injector, _sheetsSelectionService) {
1077
+ super(), this._sheetsFilterService = _sheetsFilterService, this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionCheckPermission = _sheetPermissionCheckPermission, this._injector = _injector, this._sheetsSelectionService = _sheetsSelectionService, this._commandExecutedListener();
1063
1078
  }
1064
1079
  _commandExecutedListener() {
1065
1080
  this.disposeWithMe(
1066
- this._commandService.beforeCommandExecuted((t) => {
1067
- var e, r, n;
1068
- if (t.id === me.id) {
1069
- const i = this._injector.get(Ye), l = pr(i);
1070
- if (!l) return;
1071
- const { unitId: s, subUnitId: o, worksheet: a } = l, c = (e = this._sheetsFilterService.getFilterModel(s, o)) == null ? void 0 : e.getRange();
1072
- let h;
1073
- if (c)
1074
- h = this._sheetPermissionCheckPermission.permissionCheckWithRanges({
1075
- rangeTypes: [le],
1076
- worksheetTypes: [ce, ue]
1077
- }, [c]);
1081
+ this._commandService.beforeCommandExecuted((command) => {
1082
+ var _a13, _b, _c;
1083
+ if (command.id === SmartToggleSheetsFilterCommand.id) {
1084
+ const univerInstanceService = this._injector.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService);
1085
+ if (!target) return;
1086
+ const { unitId, subUnitId, worksheet } = target, filterRange = (_a13 = this._sheetsFilterService.getFilterModel(unitId, subUnitId)) == null ? void 0 : _a13.getRange();
1087
+ let permission;
1088
+ if (filterRange)
1089
+ permission = this._sheetPermissionCheckPermission.permissionCheckWithRanges({
1090
+ rangeTypes: [RangeProtectionPermissionViewPoint],
1091
+ worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission]
1092
+ }, [filterRange]);
1078
1093
  else {
1079
- const d = (r = this._sheetsSelectionService.getCurrentLastSelection()) == null ? void 0 : r.range;
1080
- if (d) {
1081
- let g = { ...d };
1082
- g = d.startColumn === d.endColumn && d.startRow === d.endRow ? mr(g, { left: !0, right: !0, up: !0, down: !0 }, a) : g, h = this._sheetPermissionCheckPermission.permissionCheckWithRanges({
1083
- rangeTypes: [le],
1084
- worksheetTypes: [ue, ce]
1085
- }, [g], s, o);
1094
+ const range = (_b = this._sheetsSelectionService.getCurrentLastSelection()) == null ? void 0 : _b.range;
1095
+ if (range) {
1096
+ let newRange = { ...range };
1097
+ newRange = range.startColumn === range.endColumn && range.startRow === range.endRow ? expandToContinuousRange(newRange, { left: !0, right: !0, up: !0, down: !0 }, worksheet) : newRange, permission = this._sheetPermissionCheckPermission.permissionCheckWithRanges({
1098
+ rangeTypes: [RangeProtectionPermissionViewPoint],
1099
+ worksheetTypes: [WorksheetViewPermission, WorksheetFilterPermission]
1100
+ }, [newRange], unitId, subUnitId);
1086
1101
  } else
1087
- h = this._sheetPermissionCheckPermission.permissionCheckWithoutRange({
1088
- rangeTypes: [le],
1089
- worksheetTypes: [ue, ce]
1102
+ permission = this._sheetPermissionCheckPermission.permissionCheckWithoutRange({
1103
+ rangeTypes: [RangeProtectionPermissionViewPoint],
1104
+ worksheetTypes: [WorksheetViewPermission, WorksheetFilterPermission]
1090
1105
  });
1091
1106
  }
1092
- h || this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr"));
1107
+ permission || this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr"));
1093
1108
  }
1094
- if (t.id === Ae.id) {
1095
- const i = t.params, { unitId: l, subUnitId: s } = i, o = (n = this._sheetsFilterService.getFilterModel(l, s)) == null ? void 0 : n.getRange(), a = Fe.deepClone(o);
1096
- a && (a.startColumn = i.col, a.endColumn = i.col, this._sheetPermissionCheckPermission.permissionCheckWithRanges({
1097
- rangeTypes: [le],
1098
- worksheetTypes: [ce, ue]
1099
- }, [a]) || this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr")));
1109
+ if (command.id === OpenFilterPanelOperation.id) {
1110
+ const params = command.params, { unitId, subUnitId } = params, filterRange = (_c = this._sheetsFilterService.getFilterModel(unitId, subUnitId)) == null ? void 0 : _c.getRange(), colRange = Tools.deepClone(filterRange);
1111
+ colRange && (colRange.startColumn = params.col, colRange.endColumn = params.col, this._sheetPermissionCheckPermission.permissionCheckWithRanges({
1112
+ rangeTypes: [RangeProtectionPermissionViewPoint],
1113
+ worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission]
1114
+ }, [colRange]) || this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr")));
1100
1115
  }
1101
1116
  })
1102
1117
  );
1103
1118
  }
1104
- };
1105
- ie = us([
1106
- ee(0, E(k)),
1107
- ee(1, E(K)),
1108
- ee(2, W),
1109
- ee(3, E(dr)),
1110
- ee(4, E(X)),
1111
- ee(5, E(fr))
1112
- ], ie);
1113
- var b = function() {
1114
- return b = Object.assign || function(t) {
1115
- for (var e, r = 1, n = arguments.length; r < n; r++) {
1116
- e = arguments[r];
1117
- for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
1119
+ }, __name(_a5, "SheetsFilterPermissionController"), _a5);
1120
+ SheetsFilterPermissionController = __decorateClass$7([
1121
+ __decorateParam$7(0, Inject(SheetsFilterService)),
1122
+ __decorateParam$7(1, Inject(LocaleService)),
1123
+ __decorateParam$7(2, ICommandService),
1124
+ __decorateParam$7(3, Inject(SheetPermissionCheckController)),
1125
+ __decorateParam$7(4, Inject(Injector)),
1126
+ __decorateParam$7(5, Inject(SheetsSelectionsService))
1127
+ ], SheetsFilterPermissionController);
1128
+ var __assign = function() {
1129
+ return __assign = Object.assign || function(t) {
1130
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1131
+ s = arguments[i];
1132
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
1118
1133
  }
1119
1134
  return t;
1120
- }, b.apply(this, arguments);
1121
- }, hs = function(t, e) {
1122
- var r = {};
1123
- for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
1124
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
1125
- for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++)
1126
- e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]);
1127
- return r;
1128
- }, xt = Lt(function(t, e) {
1129
- var r = t.icon, n = t.id, i = t.className, l = t.extend, s = hs(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), a = es("_".concat(ps()));
1130
- return Bt(r, "".concat(n), { defIds: r.defIds, idSuffix: a.current }, b({ ref: e, className: o }, s), l);
1135
+ }, __assign.apply(this, arguments);
1136
+ }, __rest = function(s, e) {
1137
+ var t = {};
1138
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
1139
+ if (s != null && typeof Object.getOwnPropertySymbols == "function")
1140
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
1141
+ e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
1142
+ return t;
1143
+ }, IconBase = forwardRef(function(props, ref) {
1144
+ var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
1145
+ return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
1131
1146
  });
1132
- function Bt(t, e, r, n, i) {
1133
- return Mt(t.tag, b(b({ key: e }, ds(t, r, i)), n), (fs(t, r).children || []).map(function(l, s) {
1134
- return Bt(l, "".concat(e, "-").concat(t.tag, "-").concat(s), r, void 0, i);
1147
+ function render(node, id, runtimeProps, rootProps, extend) {
1148
+ return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
1149
+ return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
1135
1150
  }));
1136
1151
  }
1137
- function ds(t, e, r) {
1138
- var n = b({}, t.attrs);
1139
- r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
1140
- var i = e.defIds;
1141
- return !i || i.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(l) {
1142
- var s = l[0], o = l[1];
1143
- typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
1144
- })), n;
1152
+ __name(render, "render");
1153
+ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
1154
+ var attrs = __assign({}, node.attrs);
1155
+ extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
1156
+ var defIds = runtimeProps.defIds;
1157
+ return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a13) {
1158
+ var key = _a13[0], value = _a13[1];
1159
+ typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
1160
+ })), attrs;
1145
1161
  }
1146
- function fs(t, e) {
1147
- var r, n = e.defIds;
1148
- return !n || n.length === 0 ? t : t.tag === "defs" && (!((r = t.children) === null || r === void 0) && r.length) ? b(b({}, t), { children: t.children.map(function(i) {
1149
- return typeof i.attrs.id == "string" && n && n.indexOf(i.attrs.id) > -1 ? b(b({}, i), { attrs: b(b({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
1150
- }) }) : t;
1162
+ __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
1163
+ function replaceRuntimeIdsInDefs(node, runtimeProps) {
1164
+ var _a13, defIds = runtimeProps.defIds;
1165
+ return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a13 = node.children) === null || _a13 === void 0) && _a13.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
1166
+ return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
1167
+ }) }) : node;
1151
1168
  }
1152
- function ps() {
1169
+ __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
1170
+ function generateShortUuid() {
1153
1171
  return Math.random().toString(36).substring(2, 8);
1154
1172
  }
1155
- xt.displayName = "UniverIcon";
1156
- var ms = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.32182 2.60967C2.98161 2.60967 2.79671 3.0074 3.01601 3.2675L6.85819 7.8246C6.94943 7.93282 6.99947 8.06981 6.99947 8.21136V12.7338C6.99947 12.898 7.0998 13.0455 7.2525 13.1058L8.73833 13.6928C9.00085 13.7965 9.28531 13.6031 9.28531 13.3208V8.21136C9.28531 8.06981 9.33535 7.93282 9.42659 7.8246L13.2688 3.2675C13.4881 3.0074 13.3032 2.60967 12.963 2.60967H3.32182ZM2.09858 4.04101C1.22139 3.0006 1.96097 1.40967 3.32182 1.40967H12.963C14.3238 1.40967 15.0634 3.0006 14.1862 4.04101L10.4853 8.43054V13.3208C10.4853 14.4498 9.34747 15.2237 8.29742 14.8089L6.81158 14.2219C6.20078 13.9806 5.79947 13.3905 5.79947 12.7338V8.43054L2.09858 4.04101Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Vt = Lt(function(t, e) {
1157
- return Mt(xt, Object.assign({}, t, {
1173
+ __name(generateShortUuid, "generateShortUuid");
1174
+ IconBase.displayName = "UniverIcon";
1175
+ var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.32182 2.60967C2.98161 2.60967 2.79671 3.0074 3.01601 3.2675L6.85819 7.8246C6.94943 7.93282 6.99947 8.06981 6.99947 8.21136V12.7338C6.99947 12.898 7.0998 13.0455 7.2525 13.1058L8.73833 13.6928C9.00085 13.7965 9.28531 13.6031 9.28531 13.3208V8.21136C9.28531 8.06981 9.33535 7.93282 9.42659 7.8246L13.2688 3.2675C13.4881 3.0074 13.3032 2.60967 12.963 2.60967H3.32182ZM2.09858 4.04101C1.22139 3.0006 1.96097 1.40967 3.32182 1.40967H12.963C14.3238 1.40967 15.0634 3.0006 14.1862 4.04101L10.4853 8.43054V13.3208C10.4853 14.4498 9.34747 15.2237 8.29742 14.8089L6.81158 14.2219C6.20078 13.9806 5.79947 13.3905 5.79947 12.7338V8.43054L2.09858 4.04101Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, FilterSingle = forwardRef(function(props, ref) {
1176
+ return createElement(IconBase, Object.assign({}, props, {
1158
1177
  id: "filter-single",
1159
- ref: e,
1160
- icon: ms
1178
+ ref,
1179
+ icon: element
1161
1180
  }));
1162
1181
  });
1163
- Vt.displayName = "FilterSingle";
1164
- var xe = { exports: {} }, ae = {};
1165
- /**
1166
- * @license React
1167
- * react-jsx-runtime.production.min.js
1168
- *
1169
- * Copyright (c) Facebook, Inc. and its affiliates.
1170
- *
1171
- * This source code is licensed under the MIT license found in the
1172
- * LICENSE file in the root directory of this source tree.
1173
- */
1174
- var ut;
1175
- function _s() {
1176
- if (ut) return ae;
1177
- ut = 1;
1178
- var t = zr, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
1179
- function s(o, a, c) {
1180
- var h, d = {}, g = null, m = null;
1181
- c !== void 0 && (g = "" + c), a.key !== void 0 && (g = "" + a.key), a.ref !== void 0 && (m = a.ref);
1182
- for (h in a) n.call(a, h) && !l.hasOwnProperty(h) && (d[h] = a[h]);
1183
- if (o && o.defaultProps) for (h in a = o.defaultProps, a) d[h] === void 0 && (d[h] = a[h]);
1184
- return { $$typeof: e, type: o, key: g, ref: m, props: d, _owner: i.current };
1185
- }
1186
- return ae.Fragment = r, ae.jsx = s, ae.jsxs = s, ae;
1187
- }
1188
- var ht;
1189
- function Ss() {
1190
- return ht || (ht = 1, xe.exports = _s()), xe.exports;
1191
- }
1192
- var p = Ss();
1193
- const gs = "univer-sheets-filter-panel", vs = "univer-sheets-filter-panel-header", Es = "univer-sheets-filter-panel-content", Ts = "univer-sheets-filter-panel-select-all", Fs = "univer-sheets-filter-panel-select-all-count", Cs = "univer-sheets-filter-panel-values-container", Ns = "univer-input-affix-wrapper", Ps = "univer-select", Os = "univer-radio-group", Rs = "univer-sheets-filter-panel-values-find", Is = "univer-sheets-filter-panel-values-list", ys = "univer-sheets-filter-panel-values-list-inner-container", As = "univer-sheets-filter-panel-values-virtual", bs = "univer-sheets-filter-panel-values-item", Ls = "univer-sheets-filter-panel-values-item-inner", Ms = "univer-sheets-filter-panel-values-item-count", $s = "univer-sheets-filter-panel-values-item-exclude-button", ws = "univer-sheets-filter-panel-values-item-text", Us = "univer-sheets-filter-panel-conditions-container", Hs = "univer-sheets-filter-panel-conditions-container-inner", Ds = "univer-sheets-filter-panel-conditions-desc", xs = "univer-sheets-filter-panel-footer", Bs = "univer-sheets-filter-panel-footer-primary-buttons", Vs = "univer-button", js = "univer-input", Ws = "univer-form-dual-column-layout", ks = "univer-sheets-filter-tree-node", Qs = "univer-sheets-filter-tree-node-filter-only", Gs = "univer-sheets-filter-tree-node-attach", C = {
1194
- sheetsFilterPanel: gs,
1195
- sheetsFilterPanelHeader: vs,
1196
- sheetsFilterPanelContent: Es,
1197
- sheetsFilterPanelSelectAll: Ts,
1198
- sheetsFilterPanelSelectAllCount: Fs,
1199
- sheetsFilterPanelValuesContainer: Cs,
1200
- inputAffixWrapper: Ns,
1201
- select: Ps,
1202
- radioGroup: Os,
1203
- sheetsFilterPanelValuesFind: Rs,
1204
- sheetsFilterPanelValuesList: Is,
1205
- sheetsFilterPanelValuesListInnerContainer: ys,
1206
- sheetsFilterPanelValuesVirtual: As,
1207
- sheetsFilterPanelValuesItem: bs,
1208
- sheetsFilterPanelValuesItemInner: Ls,
1209
- sheetsFilterPanelValuesItemCount: Ms,
1210
- sheetsFilterPanelValuesItemExcludeButton: $s,
1211
- sheetsFilterPanelValuesItemText: ws,
1212
- sheetsFilterPanelConditionsContainer: Us,
1213
- sheetsFilterPanelConditionsContainerInner: Hs,
1214
- sheetsFilterPanelConditionsDesc: Ds,
1215
- sheetsFilterPanelFooter: xs,
1216
- sheetsFilterPanelFooterPrimaryButtons: Bs,
1217
- button: Vs,
1218
- input: js,
1219
- formDualColumnLayout: Ws,
1220
- sheetsFilterTreeNode: ks,
1221
- sheetsFilterTreeNodeFilterOnly: Qs,
1222
- sheetsFilterTreeNodeAttach: Gs
1182
+ FilterSingle.displayName = "FilterSingle";
1183
+ const sheetsFilterPanel = "univer-sheets-filter-panel", sheetsFilterPanelHeader = "univer-sheets-filter-panel-header", sheetsFilterPanelContent = "univer-sheets-filter-panel-content", sheetsFilterPanelSelectAll = "univer-sheets-filter-panel-select-all", sheetsFilterPanelSelectAllCount = "univer-sheets-filter-panel-select-all-count", sheetsFilterPanelValuesContainer = "univer-sheets-filter-panel-values-container", inputAffixWrapper = "univer-input-affix-wrapper", select = "univer-select", radioGroup = "univer-radio-group", sheetsFilterPanelValuesFind = "univer-sheets-filter-panel-values-find", sheetsFilterPanelValuesList = "univer-sheets-filter-panel-values-list", sheetsFilterPanelValuesListInnerContainer = "univer-sheets-filter-panel-values-list-inner-container", sheetsFilterPanelValuesVirtual = "univer-sheets-filter-panel-values-virtual", sheetsFilterPanelValuesItem = "univer-sheets-filter-panel-values-item", sheetsFilterPanelValuesItemInner = "univer-sheets-filter-panel-values-item-inner", sheetsFilterPanelValuesItemCount = "univer-sheets-filter-panel-values-item-count", sheetsFilterPanelValuesItemExcludeButton = "univer-sheets-filter-panel-values-item-exclude-button", sheetsFilterPanelValuesItemText = "univer-sheets-filter-panel-values-item-text", sheetsFilterPanelConditionsContainer = "univer-sheets-filter-panel-conditions-container", sheetsFilterPanelConditionsContainerInner = "univer-sheets-filter-panel-conditions-container-inner", sheetsFilterPanelConditionsDesc = "univer-sheets-filter-panel-conditions-desc", sheetsFilterPanelFooter = "univer-sheets-filter-panel-footer", sheetsFilterPanelFooterPrimaryButtons = "univer-sheets-filter-panel-footer-primary-buttons", button = "univer-button", input = "univer-input", formDualColumnLayout = "univer-form-dual-column-layout", sheetsFilterTreeNode = "univer-sheets-filter-tree-node", sheetsFilterTreeNodeFilterOnly = "univer-sheets-filter-tree-node-filter-only", sheetsFilterTreeNodeAttach = "univer-sheets-filter-tree-node-attach", styles = {
1184
+ sheetsFilterPanel,
1185
+ sheetsFilterPanelHeader,
1186
+ sheetsFilterPanelContent,
1187
+ sheetsFilterPanelSelectAll,
1188
+ sheetsFilterPanelSelectAllCount,
1189
+ sheetsFilterPanelValuesContainer,
1190
+ inputAffixWrapper,
1191
+ select,
1192
+ radioGroup,
1193
+ sheetsFilterPanelValuesFind,
1194
+ sheetsFilterPanelValuesList,
1195
+ sheetsFilterPanelValuesListInnerContainer,
1196
+ sheetsFilterPanelValuesVirtual,
1197
+ sheetsFilterPanelValuesItem,
1198
+ sheetsFilterPanelValuesItemInner,
1199
+ sheetsFilterPanelValuesItemCount,
1200
+ sheetsFilterPanelValuesItemExcludeButton,
1201
+ sheetsFilterPanelValuesItemText,
1202
+ sheetsFilterPanelConditionsContainer,
1203
+ sheetsFilterPanelConditionsContainerInner,
1204
+ sheetsFilterPanelConditionsDesc,
1205
+ sheetsFilterPanelFooter,
1206
+ sheetsFilterPanelFooterPrimaryButtons,
1207
+ button,
1208
+ input,
1209
+ formDualColumnLayout,
1210
+ sheetsFilterTreeNode,
1211
+ sheetsFilterTreeNodeFilterOnly,
1212
+ sheetsFilterTreeNodeAttach
1223
1213
  };
1224
- function Ys(t) {
1225
- var m, T;
1226
- const { model: e } = t, r = te(K), n = V(e.conditionItem$, void 0), i = V(e.filterConditionFormParams$, void 0), l = i != null && i.and ? "AND" : "OR", s = D((v) => {
1227
- e.onConditionFormChange({ and: v === "AND" });
1228
- }, [e]), o = qs(r), a = D((v) => {
1229
- e.onPrimaryConditionChange(v);
1230
- }, [e]), c = Ks(r), h = D((v) => {
1231
- e.onConditionFormChange(v);
1232
- }, [e]), d = r.t("sheets-filter.panel.input-values-placeholder");
1233
- function g(v, P, F) {
1234
- const I = f.getItemByOperator(v).numOfParameters === 1;
1235
- return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
1236
- F === "operator2" && /* @__PURE__ */ p.jsxs(Yr, { value: l, onChange: s, children: [
1237
- /* @__PURE__ */ p.jsx(lt, { value: "AND", children: r.t("sheets-filter.panel.and") }),
1238
- /* @__PURE__ */ p.jsx(lt, { value: "OR", children: r.t("sheets-filter.panel.or") })
1214
+ function FilterByCondition(props) {
1215
+ var _a13, _b;
1216
+ const { model } = props, localeService = useDependency(LocaleService), condition = useObservable(model.conditionItem$, void 0), formParams = useObservable(model.filterConditionFormParams$, void 0), radioValue = formParams != null && formParams.and ? "AND" : "OR", onRadioChange = useCallback((key) => {
1217
+ model.onConditionFormChange({ and: key === "AND" });
1218
+ }, [model]), primaryOptions = usePrimaryOptions(localeService), onPrimaryConditionChange = useCallback((value) => {
1219
+ model.onPrimaryConditionChange(value);
1220
+ }, [model]), secondaryOptions = useSecondaryOptions(localeService), onFormParamsChange = useCallback((diffParams) => {
1221
+ model.onConditionFormChange(diffParams);
1222
+ }, [model]), placeholder = localeService.t("sheets-filter.panel.input-values-placeholder");
1223
+ function renderSecondaryCondition(operator, val, name) {
1224
+ const shouldRenderInput = FilterConditionItems.getItemByOperator(operator).numOfParameters === 1;
1225
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1226
+ name === "operator2" && /* @__PURE__ */ jsxs(RadioGroup, { value: radioValue, onChange: onRadioChange, children: [
1227
+ /* @__PURE__ */ jsx(Radio, { value: "AND", children: localeService.t("sheets-filter.panel.and") }),
1228
+ /* @__PURE__ */ jsx(Radio, { value: "OR", children: localeService.t("sheets-filter.panel.or") })
1239
1229
  ] }),
1240
- /* @__PURE__ */ p.jsx(at, { value: v, options: c, onChange: (R) => h({ [F]: R }) }),
1241
- I && /* @__PURE__ */ p.jsx("div", { children: /* @__PURE__ */ p.jsx(At, { value: P, placeholder: d, onChange: (R) => h({ [F === "operator1" ? "val1" : "val2"]: R }) }) })
1230
+ /* @__PURE__ */ jsx(Select, { value: operator, options: secondaryOptions, onChange: /* @__PURE__ */ __name((operator2) => onFormParamsChange({ [name]: operator2 }), "onChange") }),
1231
+ shouldRenderInput && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Input, { value: val, placeholder, onChange: /* @__PURE__ */ __name((value) => onFormParamsChange({ [name === "operator1" ? "val1" : "val2"]: value }), "onChange") }) })
1242
1232
  ] });
1243
1233
  }
1244
- return /* @__PURE__ */ p.jsx("div", { className: C.sheetsFilterPanelConditionsContainer, children: n && i && /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
1245
- /* @__PURE__ */ p.jsx(at, { value: n.operator, options: o, onChange: a }),
1246
- f.getItemByOperator(n.operator).numOfParameters !== 0 ? /* @__PURE__ */ p.jsxs("div", { className: C.sheetsFilterPanelConditionsContainerInner, children: [
1247
- n.numOfParameters >= 1 && g(i.operator1, (m = i.val1) != null ? m : "", "operator1"),
1248
- n.numOfParameters >= 2 && g(i.operator2, (T = i.val2) != null ? T : "", "operator2"),
1249
- /* @__PURE__ */ p.jsxs("div", { className: C.sheetsFilterPanelConditionsDesc, children: [
1250
- r.t("sheets-filter.panel.?"),
1251
- /* @__PURE__ */ p.jsx("br", {}),
1252
- r.t("sheets-filter.panel.*")
1234
+ return __name(renderSecondaryCondition, "renderSecondaryCondition"), /* @__PURE__ */ jsx("div", { className: styles.sheetsFilterPanelConditionsContainer, children: condition && formParams && /* @__PURE__ */ jsxs(Fragment, { children: [
1235
+ /* @__PURE__ */ jsx(Select, { value: condition.operator, options: primaryOptions, onChange: onPrimaryConditionChange }),
1236
+ FilterConditionItems.getItemByOperator(condition.operator).numOfParameters !== 0 ? /* @__PURE__ */ jsxs("div", { className: styles.sheetsFilterPanelConditionsContainerInner, children: [
1237
+ condition.numOfParameters >= 1 && renderSecondaryCondition(formParams.operator1, (_a13 = formParams.val1) != null ? _a13 : "", "operator1"),
1238
+ condition.numOfParameters >= 2 && renderSecondaryCondition(formParams.operator2, (_b = formParams.val2) != null ? _b : "", "operator2"),
1239
+ /* @__PURE__ */ jsxs("div", { className: styles.sheetsFilterPanelConditionsDesc, children: [
1240
+ localeService.t("sheets-filter.panel.?"),
1241
+ /* @__PURE__ */ jsx("br", {}),
1242
+ localeService.t("sheets-filter.panel.*")
1253
1243
  ] })
1254
1244
  ] }) : null
1255
1245
  ] }) });
1256
1246
  }
1257
- function qs(t) {
1258
- const e = t.getCurrentLocale();
1259
- return et(
1247
+ __name(FilterByCondition, "FilterByCondition");
1248
+ function usePrimaryOptions(localeService) {
1249
+ const locale = localeService.getCurrentLocale();
1250
+ return useMemo(
1260
1251
  () => [
1261
1252
  {
1262
1253
  options: [
1263
- { label: t.t(f.NONE.label), value: f.NONE.operator }
1254
+ { label: localeService.t(FilterConditionItems.NONE.label), value: FilterConditionItems.NONE.operator }
1264
1255
  ]
1265
1256
  },
1266
1257
  {
1267
1258
  options: [
1268
- { label: t.t(f.EMPTY.label), value: f.EMPTY.operator },
1269
- { label: t.t(f.NOT_EMPTY.label), value: f.NOT_EMPTY.operator }
1259
+ { label: localeService.t(FilterConditionItems.EMPTY.label), value: FilterConditionItems.EMPTY.operator },
1260
+ { label: localeService.t(FilterConditionItems.NOT_EMPTY.label), value: FilterConditionItems.NOT_EMPTY.operator }
1270
1261
  ]
1271
1262
  },
1272
1263
  {
1273
1264
  options: [
1274
- { label: t.t(f.TEXT_CONTAINS.label), value: f.TEXT_CONTAINS.operator },
1275
- { label: t.t(f.DOES_NOT_CONTAIN.label), value: f.DOES_NOT_CONTAIN.operator },
1276
- { label: t.t(f.STARTS_WITH.label), value: f.STARTS_WITH.operator },
1277
- { label: t.t(f.ENDS_WITH.label), value: f.ENDS_WITH.operator },
1278
- { label: t.t(f.EQUALS.label), value: f.EQUALS.operator }
1265
+ { label: localeService.t(FilterConditionItems.TEXT_CONTAINS.label), value: FilterConditionItems.TEXT_CONTAINS.operator },
1266
+ { label: localeService.t(FilterConditionItems.DOES_NOT_CONTAIN.label), value: FilterConditionItems.DOES_NOT_CONTAIN.operator },
1267
+ { label: localeService.t(FilterConditionItems.STARTS_WITH.label), value: FilterConditionItems.STARTS_WITH.operator },
1268
+ { label: localeService.t(FilterConditionItems.ENDS_WITH.label), value: FilterConditionItems.ENDS_WITH.operator },
1269
+ { label: localeService.t(FilterConditionItems.EQUALS.label), value: FilterConditionItems.EQUALS.operator }
1279
1270
  ]
1280
1271
  },
1281
1272
  {
1282
1273
  options: [
1283
- { label: t.t(f.GREATER_THAN.label), value: f.GREATER_THAN.operator },
1284
- { label: t.t(f.GREATER_THAN_OR_EQUAL.label), value: f.GREATER_THAN_OR_EQUAL.operator },
1285
- { label: t.t(f.LESS_THAN.label), value: f.LESS_THAN.operator },
1286
- { label: t.t(f.LESS_THAN_OR_EQUAL.label), value: f.LESS_THAN_OR_EQUAL.operator },
1287
- { label: t.t(f.EQUAL.label), value: f.EQUAL.operator },
1288
- { label: t.t(f.NOT_EQUAL.label), value: f.NOT_EQUAL.operator },
1289
- { label: t.t(f.BETWEEN.label), value: f.BETWEEN.operator },
1290
- { label: t.t(f.NOT_BETWEEN.label), value: f.NOT_BETWEEN.operator }
1274
+ { label: localeService.t(FilterConditionItems.GREATER_THAN.label), value: FilterConditionItems.GREATER_THAN.operator },
1275
+ { label: localeService.t(FilterConditionItems.GREATER_THAN_OR_EQUAL.label), value: FilterConditionItems.GREATER_THAN_OR_EQUAL.operator },
1276
+ { label: localeService.t(FilterConditionItems.LESS_THAN.label), value: FilterConditionItems.LESS_THAN.operator },
1277
+ { label: localeService.t(FilterConditionItems.LESS_THAN_OR_EQUAL.label), value: FilterConditionItems.LESS_THAN_OR_EQUAL.operator },
1278
+ { label: localeService.t(FilterConditionItems.EQUAL.label), value: FilterConditionItems.EQUAL.operator },
1279
+ { label: localeService.t(FilterConditionItems.NOT_EQUAL.label), value: FilterConditionItems.NOT_EQUAL.operator },
1280
+ { label: localeService.t(FilterConditionItems.BETWEEN.label), value: FilterConditionItems.BETWEEN.operator },
1281
+ { label: localeService.t(FilterConditionItems.NOT_BETWEEN.label), value: FilterConditionItems.NOT_BETWEEN.operator }
1291
1282
  ]
1292
1283
  },
1293
1284
  {
1294
1285
  options: [
1295
- { label: t.t(f.CUSTOM.label), value: f.CUSTOM.operator }
1286
+ { label: localeService.t(FilterConditionItems.CUSTOM.label), value: FilterConditionItems.CUSTOM.operator }
1296
1287
  ]
1297
1288
  }
1298
1289
  ],
1299
1290
  // eslint-disable-next-line react-hooks/exhaustive-deps
1300
- [e, t]
1291
+ [locale, localeService]
1301
1292
  );
1302
1293
  }
1303
- function Ks(t) {
1304
- const e = t.getCurrentLocale();
1305
- return et(
1306
- () => f.ALL_CONDITIONS.filter((r) => r.numOfParameters !== 2).map((r) => ({ label: t.t(r.label), value: r.operator })),
1294
+ __name(usePrimaryOptions, "usePrimaryOptions");
1295
+ function useSecondaryOptions(localeService) {
1296
+ const locale = localeService.getCurrentLocale();
1297
+ return useMemo(
1298
+ () => FilterConditionItems.ALL_CONDITIONS.filter((c) => c.numOfParameters !== 2).map((c) => ({ label: localeService.t(c.label), value: c.operator })),
1307
1299
  // eslint-disable-next-line react-hooks/exhaustive-deps
1308
- [e, t]
1300
+ [locale, localeService]
1309
1301
  );
1310
1302
  }
1311
- function Xs(t) {
1312
- const { model: e } = t, r = te(K), n = V(e.searchString$, "", !0), i = V(e.filterItems$, void 0, !0), l = r.t("sheets-filter.panel.filter-only"), s = je(i), o = s.checked > 0 && s.unchecked === 0, a = s.checked > 0 && s.unchecked > 0, c = e.treeMapCache, h = D(() => {
1313
- e.onCheckAllToggled(!o);
1314
- }, [e, o]), d = D((m) => {
1315
- e.setSearchString(m);
1316
- }, [e]);
1317
- function g(m) {
1318
- let T = [];
1319
- return m.forEach((v) => {
1320
- v.checked && T.push(v.key), v.children && (T = T.concat(g(v.children)));
1321
- }), T;
1322
- }
1323
- return /* @__PURE__ */ p.jsxs("div", { className: C.sheetsFilterPanelValuesContainer, children: [
1324
- /* @__PURE__ */ p.jsx(At, { autoFocus: !0, value: n, placeholder: r.t("sheets-filter.panel.search-placeholder"), onChange: d }),
1325
- /* @__PURE__ */ p.jsxs("div", { className: C.sheetsFilterPanelValuesList, children: [
1326
- /* @__PURE__ */ p.jsx("div", { className: C.sheetsFilterPanelValuesItem, children: /* @__PURE__ */ p.jsxs("div", { className: C.sheetsFilterPanelValuesItemInner, children: [
1327
- /* @__PURE__ */ p.jsx(
1328
- qr,
1303
+ __name(useSecondaryOptions, "useSecondaryOptions");
1304
+ function FilterByValue(props) {
1305
+ const { model } = props, localeService = useDependency(LocaleService), searchText = useObservable(model.searchString$, "", !0), items = useObservable(model.filterItems$, void 0, !0), filterOnly = localeService.t("sheets-filter.panel.filter-only"), stat = statisticFilterByValueItems(items), allChecked = stat.checked > 0 && stat.unchecked === 0, indeterminate = stat.checked > 0 && stat.unchecked > 0, treeMap = model.treeMapCache, onCheckAllToggled = useCallback(() => {
1306
+ model.onCheckAllToggled(!allChecked);
1307
+ }, [model, allChecked]), onSearchValueChange = useCallback((str) => {
1308
+ model.setSearchString(str);
1309
+ }, [model]);
1310
+ function extractCheckedKeys(items2) {
1311
+ let checkedKeys = [];
1312
+ return items2.forEach((item) => {
1313
+ item.checked && checkedKeys.push(item.key), item.children && (checkedKeys = checkedKeys.concat(extractCheckedKeys(item.children)));
1314
+ }), checkedKeys;
1315
+ }
1316
+ return __name(extractCheckedKeys, "extractCheckedKeys"), /* @__PURE__ */ jsxs("div", { className: styles.sheetsFilterPanelValuesContainer, children: [
1317
+ /* @__PURE__ */ jsx(Input, { autoFocus: !0, value: searchText, placeholder: localeService.t("sheets-filter.panel.search-placeholder"), onChange: onSearchValueChange }),
1318
+ /* @__PURE__ */ jsxs("div", { className: styles.sheetsFilterPanelValuesList, children: [
1319
+ /* @__PURE__ */ jsx("div", { className: styles.sheetsFilterPanelValuesItem, children: /* @__PURE__ */ jsxs("div", { className: styles.sheetsFilterPanelValuesItemInner, children: [
1320
+ /* @__PURE__ */ jsx(
1321
+ Checkbox,
1329
1322
  {
1330
- indeterminate: a,
1331
- disabled: i.length === 0,
1332
- checked: o,
1333
- onChange: h
1323
+ indeterminate,
1324
+ disabled: items.length === 0,
1325
+ checked: allChecked,
1326
+ onChange: onCheckAllToggled
1334
1327
  }
1335
1328
  ),
1336
- /* @__PURE__ */ p.jsx("span", { className: C.sheetsFilterPanelValuesItemText, children: `${r.t("sheets-filter.panel.select-all")}` }),
1337
- /* @__PURE__ */ p.jsx("span", { className: C.sheetsFilterPanelValuesItemCount, children: `(${s.checked}/${s.checked + s.unchecked})` })
1329
+ /* @__PURE__ */ jsx("span", { className: styles.sheetsFilterPanelValuesItemText, children: `${localeService.t("sheets-filter.panel.select-all")}` }),
1330
+ /* @__PURE__ */ jsx("span", { className: styles.sheetsFilterPanelValuesItemCount, children: `(${stat.checked}/${stat.checked + stat.unchecked})` })
1338
1331
  ] }) }),
1339
- /* @__PURE__ */ p.jsx("div", { className: C.sheetsFilterPanelValuesVirtual, children: /* @__PURE__ */ p.jsx(
1340
- Kr,
1332
+ /* @__PURE__ */ jsx("div", { className: styles.sheetsFilterPanelValuesVirtual, children: /* @__PURE__ */ jsx(
1333
+ Tree,
1341
1334
  {
1342
- data: i,
1335
+ data: items,
1343
1336
  defaultExpandAll: !1,
1344
- valueGroup: g(i),
1337
+ valueGroup: extractCheckedKeys(items),
1345
1338
  height: 180,
1346
- onChange: (m) => {
1347
- e.onFilterCheckToggled(m);
1348
- },
1349
- defaultCache: c,
1339
+ onChange: /* @__PURE__ */ __name((node) => {
1340
+ model.onFilterCheckToggled(node);
1341
+ }, "onChange"),
1342
+ defaultCache: treeMap,
1350
1343
  itemHeight: 28,
1351
- treeNodeClassName: C.sheetsFilterTreeNode,
1352
- attachRender: (m) => /* @__PURE__ */ p.jsxs("div", { className: C.sheetsFilterTreeNodeAttach, children: [
1353
- /* @__PURE__ */ p.jsx("span", { className: C.sheetsFilterPanelValuesItemCount, children: `(${m.count})` }),
1354
- /* @__PURE__ */ p.jsx(
1355
- Ce,
1344
+ treeNodeClassName: styles.sheetsFilterTreeNode,
1345
+ attachRender: /* @__PURE__ */ __name((item) => /* @__PURE__ */ jsxs("div", { className: styles.sheetsFilterTreeNodeAttach, children: [
1346
+ /* @__PURE__ */ jsx("span", { className: styles.sheetsFilterPanelValuesItemCount, children: `(${item.count})` }),
1347
+ /* @__PURE__ */ jsx(
1348
+ Button,
1356
1349
  {
1357
- className: C.sheetsFilterTreeNodeFilterOnly,
1350
+ className: styles.sheetsFilterTreeNodeFilterOnly,
1358
1351
  size: "small",
1359
1352
  type: "link",
1360
- onClick: () => {
1361
- const T = [];
1362
- m.children ? m.children.forEach((v) => {
1363
- v.children ? v.children.forEach((P) => {
1364
- T.push(P.key);
1365
- }) : T.push(v.key);
1366
- }) : T.push(m.key), e.onFilterOnly(T);
1367
- },
1368
- children: l
1353
+ onClick: /* @__PURE__ */ __name(() => {
1354
+ const filterValues = [];
1355
+ item.children ? item.children.forEach((child) => {
1356
+ child.children ? child.children.forEach((subChild) => {
1357
+ filterValues.push(subChild.key);
1358
+ }) : filterValues.push(child.key);
1359
+ }) : filterValues.push(item.key), model.onFilterOnly(filterValues);
1360
+ }, "onClick"),
1361
+ children: filterOnly
1369
1362
  }
1370
1363
  )
1371
- ] })
1364
+ ] }), "attachRender")
1372
1365
  }
1373
1366
  ) })
1374
1367
  ] })
1375
1368
  ] });
1376
1369
  }
1377
- function Zs() {
1378
- var P;
1379
- const t = te(j), e = te(K), r = te(W), n = V(t.filterBy$, void 0, !0), i = V(t.filterByModel$, void 0, !1), l = V(() => (i == null ? void 0 : i.canApply$) || _e(!1), void 0, !1, [i]), s = Js(e), o = !V(t.hasCriteria$), a = D((F) => {
1380
- r.executeCommand(Dt.id, { filterBy: F });
1381
- }, [r]), c = D(async () => {
1382
- await (i == null ? void 0 : i.clear()), r.executeCommand(de.id);
1383
- }, [i, r]), h = D(() => {
1384
- r.executeCommand(de.id);
1385
- }, [r]), d = D(async () => {
1386
- await (i == null ? void 0 : i.apply()), r.executeCommand(de.id);
1387
- }, [i, r]), m = (P = te(k).activeFilterModel) == null ? void 0 : P.getRange(), T = t.col, v = Er(yr.FILTER_PANEL_EMBED_POINT);
1388
- return /* @__PURE__ */ p.jsxs("div", { className: C.sheetsFilterPanel, children: [
1389
- /* @__PURE__ */ p.jsx(
1390
- Tr,
1370
+ __name(FilterByValue, "FilterByValue");
1371
+ function FilterPanel() {
1372
+ var _a13;
1373
+ const sheetsFilterPanelService = useDependency(SheetsFilterPanelService), localeService = useDependency(LocaleService), commandService = useDependency(ICommandService), filterBy = useObservable(sheetsFilterPanelService.filterBy$, void 0, !0), filterByModel = useObservable(sheetsFilterPanelService.filterByModel$, void 0, !1), canApply = useObservable(() => (filterByModel == null ? void 0 : filterByModel.canApply$) || of(!1), void 0, !1, [filterByModel]), options = useFilterByOptions(localeService), clearFilterDisabled = !useObservable(sheetsFilterPanelService.hasCriteria$), onFilterByTypeChange = useCallback((value) => {
1374
+ commandService.executeCommand(ChangeFilterByOperation.id, { filterBy: value });
1375
+ }, [commandService]), onClearCriteria = useCallback(async () => {
1376
+ await (filterByModel == null ? void 0 : filterByModel.clear()), commandService.executeCommand(CloseFilterPanelOperation.id);
1377
+ }, [filterByModel, commandService]), onCancel = useCallback(() => {
1378
+ commandService.executeCommand(CloseFilterPanelOperation.id);
1379
+ }, [commandService]), onApply = useCallback(async () => {
1380
+ await (filterByModel == null ? void 0 : filterByModel.apply()), commandService.executeCommand(CloseFilterPanelOperation.id);
1381
+ }, [filterByModel, commandService]), range = (_a13 = useDependency(SheetsFilterService).activeFilterModel) == null ? void 0 : _a13.getRange(), colIndex = sheetsFilterPanelService.col, FilterPanelEmbedPointPart = useComponentsOfPart(SheetsUIPart.FILTER_PANEL_EMBED_POINT);
1382
+ return /* @__PURE__ */ jsxs("div", { className: styles.sheetsFilterPanel, children: [
1383
+ /* @__PURE__ */ jsx(
1384
+ ComponentContainer,
1391
1385
  {
1392
- components: v,
1393
- sharedProps: { range: m, colIndex: T, onClose: h }
1386
+ components: FilterPanelEmbedPointPart,
1387
+ sharedProps: { range, colIndex, onClose: onCancel }
1394
1388
  }
1395
1389
  ),
1396
- /* @__PURE__ */ p.jsx("div", { className: C.sheetsFilterPanelHeader, children: /* @__PURE__ */ p.jsx(Xr, { value: n, options: s, onChange: (F) => a(F) }) }),
1397
- i ? /* @__PURE__ */ p.jsx("div", { className: C.sheetsFilterPanelContent, children: n === Re.VALUES ? /* @__PURE__ */ p.jsx(Xs, { model: i }) : /* @__PURE__ */ p.jsx(Ys, { model: i }) }) : /* @__PURE__ */ p.jsx("div", { style: { flex: 1 } }),
1398
- /* @__PURE__ */ p.jsxs("div", { className: C.sheetsFilterPanelFooter, children: [
1399
- /* @__PURE__ */ p.jsx(Ce, { type: "link", onClick: c, disabled: o, children: e.t("sheets-filter.panel.clear-filter") }),
1400
- /* @__PURE__ */ p.jsxs("span", { className: C.sheetsFilterPanelFooterPrimaryButtons, children: [
1401
- /* @__PURE__ */ p.jsx(Ce, { type: "default", onClick: h, children: e.t("sheets-filter.panel.cancel") }),
1402
- /* @__PURE__ */ p.jsx(Ce, { disabled: !l, type: "primary", onClick: d, children: e.t("sheets-filter.panel.confirm") })
1390
+ /* @__PURE__ */ jsx("div", { className: styles.sheetsFilterPanelHeader, children: /* @__PURE__ */ jsx(Segmented, { value: filterBy, options, onChange: /* @__PURE__ */ __name((value) => onFilterByTypeChange(value), "onChange") }) }),
1391
+ filterByModel ? /* @__PURE__ */ jsx("div", { className: styles.sheetsFilterPanelContent, children: filterBy === FilterBy.VALUES ? /* @__PURE__ */ jsx(FilterByValue, { model: filterByModel }) : /* @__PURE__ */ jsx(FilterByCondition, { model: filterByModel }) }) : /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
1392
+ /* @__PURE__ */ jsxs("div", { className: styles.sheetsFilterPanelFooter, children: [
1393
+ /* @__PURE__ */ jsx(Button, { type: "link", onClick: onClearCriteria, disabled: clearFilterDisabled, children: localeService.t("sheets-filter.panel.clear-filter") }),
1394
+ /* @__PURE__ */ jsxs("span", { className: styles.sheetsFilterPanelFooterPrimaryButtons, children: [
1395
+ /* @__PURE__ */ jsx(Button, { type: "default", onClick: onCancel, children: localeService.t("sheets-filter.panel.cancel") }),
1396
+ /* @__PURE__ */ jsx(Button, { disabled: !canApply, type: "primary", onClick: onApply, children: localeService.t("sheets-filter.panel.confirm") })
1403
1397
  ] })
1404
1398
  ] })
1405
1399
  ] });
1406
1400
  }
1407
- function Js(t) {
1408
- const e = t.getCurrentLocale();
1409
- return et(
1401
+ __name(FilterPanel, "FilterPanel");
1402
+ function useFilterByOptions(localeService) {
1403
+ const locale = localeService.getCurrentLocale();
1404
+ return useMemo(
1410
1405
  () => [
1411
- { label: t.t("sheets-filter.panel.by-values"), value: Re.VALUES },
1412
- { label: t.t("sheets-filter.panel.by-conditions"), value: Re.CONDITIONS }
1406
+ { label: localeService.t("sheets-filter.panel.by-values"), value: FilterBy.VALUES },
1407
+ { label: localeService.t("sheets-filter.panel.by-conditions"), value: FilterBy.CONDITIONS }
1413
1408
  ],
1414
- [e, t]
1409
+ [locale, localeService]
1415
1410
  );
1416
1411
  }
1417
- function zs(t) {
1418
- const e = t.get(k);
1412
+ __name(useFilterByOptions, "useFilterByOptions");
1413
+ function SmartToggleFilterMenuItemFactory(accessor) {
1414
+ const sheetsFilterService = accessor.get(SheetsFilterService);
1419
1415
  return {
1420
- id: me.id,
1421
- type: Ze.BUTTON_SELECTOR,
1416
+ id: SmartToggleSheetsFilterCommand.id,
1417
+ type: MenuItemType.BUTTON_SELECTOR,
1422
1418
  icon: "FilterSingle",
1423
1419
  tooltip: "sheets-filter.toolbar.smart-toggle-filter-tooltip",
1424
- hidden$: Je(t, Z.UNIVER_SHEET),
1425
- activated$: e.activeFilterModel$.pipe(se((r) => !!r)),
1426
- disabled$: Ar(t, br(t, { worksheetTypes: [ce, ue], rangeTypes: [le] }))
1420
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1421
+ activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
1422
+ disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, { worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission], rangeTypes: [RangeProtectionPermissionViewPoint] }))
1427
1423
  };
1428
1424
  }
1429
- function en(t) {
1430
- const e = t.get(k);
1425
+ __name(SmartToggleFilterMenuItemFactory, "SmartToggleFilterMenuItemFactory");
1426
+ function ClearFilterCriteriaMenuItemFactory(accessor) {
1427
+ const sheetsFilterService = accessor.get(SheetsFilterService);
1431
1428
  return {
1432
- id: Ke.id,
1433
- type: Ze.BUTTON,
1429
+ id: ClearSheetsFilterCriteriaCommand.id,
1430
+ type: MenuItemType.BUTTON,
1434
1431
  title: "sheets-filter.toolbar.clear-filter-criteria",
1435
- hidden$: Je(t, Z.UNIVER_SHEET),
1436
- disabled$: e.activeFilterModel$.pipe(ze((r) => {
1437
- var n;
1438
- return (n = r == null ? void 0 : r.hasCriteria$.pipe(se((i) => !i))) != null ? n : _e(!0);
1432
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1433
+ disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
1434
+ var _a13;
1435
+ return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m) => !m))) != null ? _a13 : of(!0);
1439
1436
  }))
1440
1437
  };
1441
1438
  }
1442
- function tn(t) {
1443
- const e = t.get(k);
1439
+ __name(ClearFilterCriteriaMenuItemFactory, "ClearFilterCriteriaMenuItemFactory");
1440
+ function ReCalcFilterMenuItemFactory(accessor) {
1441
+ const sheetsFilterService = accessor.get(SheetsFilterService);
1444
1442
  return {
1445
- id: Xe.id,
1446
- type: Ze.BUTTON,
1443
+ id: ReCalcSheetsFilterCommand.id,
1444
+ type: MenuItemType.BUTTON,
1447
1445
  title: "sheets-filter.toolbar.re-calc-filter-conditions",
1448
- hidden$: Je(t, Z.UNIVER_SHEET),
1449
- disabled$: e.activeFilterModel$.pipe(ze((r) => {
1450
- var n;
1451
- return (n = r == null ? void 0 : r.hasCriteria$.pipe(se((i) => !i))) != null ? n : _e(!0);
1446
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1447
+ disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
1448
+ var _a13;
1449
+ return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m) => !m))) != null ? _a13 : of(!0);
1452
1450
  }))
1453
1451
  };
1454
1452
  }
1455
- const rn = {
1456
- [Fr.FORMULAS_INSERT]: {
1457
- [me.id]: {
1453
+ __name(ReCalcFilterMenuItemFactory, "ReCalcFilterMenuItemFactory");
1454
+ const menuSchema = {
1455
+ [RibbonStartGroup.FORMULAS_INSERT]: {
1456
+ [SmartToggleSheetsFilterCommand.id]: {
1458
1457
  order: 10,
1459
- menuItemFactory: zs,
1460
- [Ke.id]: {
1458
+ menuItemFactory: SmartToggleFilterMenuItemFactory,
1459
+ [ClearSheetsFilterCriteriaCommand.id]: {
1461
1460
  order: 0,
1462
- menuItemFactory: en
1461
+ menuItemFactory: ClearFilterCriteriaMenuItemFactory
1463
1462
  },
1464
- [Xe.id]: {
1463
+ [ReCalcSheetsFilterCommand.id]: {
1465
1464
  order: 1,
1466
- menuItemFactory: tn
1465
+ menuItemFactory: ReCalcFilterMenuItemFactory
1467
1466
  }
1468
1467
  }
1469
1468
  }
1470
- }, sn = {
1471
- id: me.id,
1472
- binding: Cr.L | ot.CTRL_COMMAND | ot.SHIFT,
1473
- description: "sheets-filter.shortcut.smart-toggle-filter",
1474
- preconditions: Lr,
1475
- group: "4_sheet-edit"
1476
- }, B = 16, nn = new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");
1477
- class dt {
1478
- static drawNoCriteria(e, r, n, i) {
1479
- e.save(), ct.drawWith(e, {
1469
+ }, BUTTON_VIEWPORT = 16, FILTER_BUTTON_EMPTY = new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z"), _FilterButton = class _FilterButton {
1470
+ static drawNoCriteria(ctx, size, fgColor, bgColor) {
1471
+ ctx.save(), Rect.drawWith(ctx, {
1480
1472
  radius: 2,
1481
- width: B,
1482
- height: B,
1483
- fill: i
1484
- }), e.lineCap = "square", e.strokeStyle = n, e.scale(r / B, r / B), e.beginPath(), e.lineWidth = 1, e.lineCap = "round", e.moveTo(3, 4), e.lineTo(13, 4), e.moveTo(4.5, 8), e.lineTo(11.5, 8), e.moveTo(6, 12), e.lineTo(10, 12), e.stroke(), e.restore();
1473
+ width: BUTTON_VIEWPORT,
1474
+ height: BUTTON_VIEWPORT,
1475
+ fill: bgColor
1476
+ }), ctx.lineCap = "square", ctx.strokeStyle = fgColor, ctx.scale(size / BUTTON_VIEWPORT, size / BUTTON_VIEWPORT), ctx.beginPath(), ctx.lineWidth = 1, ctx.lineCap = "round", ctx.moveTo(3, 4), ctx.lineTo(13, 4), ctx.moveTo(4.5, 8), ctx.lineTo(11.5, 8), ctx.moveTo(6, 12), ctx.lineTo(10, 12), ctx.stroke(), ctx.restore();
1485
1477
  }
1486
- static drawHasCriteria(e, r, n, i) {
1487
- e.save(), ct.drawWith(e, {
1478
+ static drawHasCriteria(ctx, size, fgColor, bgColor) {
1479
+ ctx.save(), Rect.drawWith(ctx, {
1488
1480
  radius: 2,
1489
- width: B,
1490
- height: B,
1491
- fill: i
1492
- }), e.scale(r / B, r / B), e.fillStyle = n, e.fill(nn), e.restore();
1481
+ width: BUTTON_VIEWPORT,
1482
+ height: BUTTON_VIEWPORT,
1483
+ fill: bgColor
1484
+ }), ctx.scale(size / BUTTON_VIEWPORT, size / BUTTON_VIEWPORT), ctx.fillStyle = fgColor, ctx.fill(FILTER_BUTTON_EMPTY), ctx.restore();
1493
1485
  }
1494
- }
1495
- var on = Object.defineProperty, an = Object.getOwnPropertyDescriptor, ln = (t, e, r, n) => {
1496
- for (var i = n > 1 ? void 0 : n ? an(e, r) : e, l = t.length - 1, s; l >= 0; l--)
1497
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
1498
- return n && i && on(e, r, i), i;
1499
- }, Be = (t, e) => (r, n) => e(r, n, t);
1500
- const H = 16, Ee = 1;
1501
- let Qe = class extends Jr {
1502
- constructor(e, r, n, i, l) {
1503
- super(e, r);
1504
- _(this, "_cellWidth", 0);
1505
- _(this, "_cellHeight", 0);
1506
- _(this, "_filterParams");
1507
- _(this, "_hovered", !1);
1508
- this._contextService = n, this._commandService = i, this._themeService = l, this.setShapeProps(r), this.onPointerDown$.subscribeEvent((s) => this.onPointerDown(s)), this.onPointerEnter$.subscribeEvent(() => this.onPointerEnter()), this.onPointerLeave$.subscribeEvent(() => this.onPointerLeave());
1509
- }
1510
- setShapeProps(e) {
1511
- typeof e.cellHeight < "u" && (this._cellHeight = e.cellHeight), typeof e.cellWidth < "u" && (this._cellWidth = e.cellWidth), typeof e.filterParams < "u" && (this._filterParams = e.filterParams), this.transformByState({
1512
- width: e.width,
1513
- height: e.height
1486
+ };
1487
+ __name(_FilterButton, "FilterButton");
1488
+ let FilterButton = _FilterButton;
1489
+ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1490
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1491
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1492
+ return kind && result && __defProp$6(target, key, result), result;
1493
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6");
1494
+ const FILTER_ICON_SIZE = 16, FILTER_ICON_PADDING = 1;
1495
+ var _a6;
1496
+ let SheetsFilterButtonShape = (_a6 = class extends Shape {
1497
+ constructor(key, props, _contextService, _commandService, _themeService) {
1498
+ super(key, props);
1499
+ __publicField(this, "_cellWidth", 0);
1500
+ __publicField(this, "_cellHeight", 0);
1501
+ __publicField(this, "_filterParams");
1502
+ __publicField(this, "_hovered", !1);
1503
+ this._contextService = _contextService, this._commandService = _commandService, this._themeService = _themeService, this.setShapeProps(props), this.onPointerDown$.subscribeEvent((evt) => this.onPointerDown(evt)), this.onPointerEnter$.subscribeEvent(() => this.onPointerEnter()), this.onPointerLeave$.subscribeEvent(() => this.onPointerLeave());
1504
+ }
1505
+ setShapeProps(props) {
1506
+ typeof props.cellHeight < "u" && (this._cellHeight = props.cellHeight), typeof props.cellWidth < "u" && (this._cellWidth = props.cellWidth), typeof props.filterParams < "u" && (this._filterParams = props.filterParams), this.transformByState({
1507
+ width: props.width,
1508
+ height: props.height
1514
1509
  });
1515
1510
  }
1516
- _draw(e) {
1517
- const r = this._cellHeight, n = this._cellWidth, i = H - n, l = H - r;
1518
- e.save();
1519
- const s = new Path2D();
1520
- s.rect(i, l, n, r), e.clip(s);
1521
- const { hasCriteria: o } = this._filterParams, a = this._themeService.getCurrentTheme().primaryColor, c = this._hovered ? this._themeService.getCurrentTheme().grey50 : "rgba(255, 255, 255, 1.0)";
1522
- o ? dt.drawHasCriteria(e, H, a, c) : dt.drawNoCriteria(e, H, a, c), e.restore();
1511
+ _draw(ctx) {
1512
+ const cellHeight = this._cellHeight, cellWidth = this._cellWidth, left = FILTER_ICON_SIZE - cellWidth, top = FILTER_ICON_SIZE - cellHeight;
1513
+ ctx.save();
1514
+ const cellRegion = new Path2D();
1515
+ cellRegion.rect(left, top, cellWidth, cellHeight), ctx.clip(cellRegion);
1516
+ const { hasCriteria } = this._filterParams, fgColor = this._themeService.getCurrentTheme().primaryColor, bgColor = this._hovered ? this._themeService.getCurrentTheme().grey50 : "rgba(255, 255, 255, 1.0)";
1517
+ hasCriteria ? FilterButton.drawHasCriteria(ctx, FILTER_ICON_SIZE, fgColor, bgColor) : FilterButton.drawNoCriteria(ctx, FILTER_ICON_SIZE, fgColor, bgColor), ctx.restore();
1523
1518
  }
1524
- onPointerDown(e) {
1525
- if (e.button === 2)
1519
+ onPointerDown(evt) {
1520
+ if (evt.button === 2)
1526
1521
  return;
1527
- const { col: r, unitId: n, subUnitId: i } = this._filterParams;
1528
- this._contextService.getContextValue(ne) || !this._commandService.hasCommand(Ae.id) || setTimeout(() => {
1529
- this._commandService.executeCommand(Ae.id, {
1530
- unitId: n,
1531
- subUnitId: i,
1532
- col: r
1522
+ const { col, unitId, subUnitId } = this._filterParams;
1523
+ this._contextService.getContextValue(FILTER_PANEL_OPENED_KEY) || !this._commandService.hasCommand(OpenFilterPanelOperation.id) || setTimeout(() => {
1524
+ this._commandService.executeCommand(OpenFilterPanelOperation.id, {
1525
+ unitId,
1526
+ subUnitId,
1527
+ col
1533
1528
  });
1534
1529
  }, 200);
1535
1530
  }
@@ -1539,342 +1534,353 @@ let Qe = class extends Jr {
1539
1534
  onPointerLeave() {
1540
1535
  this._hovered = !1, this.makeDirty(!0);
1541
1536
  }
1542
- };
1543
- Qe = ln([
1544
- Be(2, we),
1545
- Be(3, W),
1546
- Be(4, E(Et))
1547
- ], Qe);
1548
- var cn = Object.defineProperty, un = Object.getOwnPropertyDescriptor, hn = (t, e, r, n) => {
1549
- for (var i = n > 1 ? void 0 : n ? un(e, r) : e, l = t.length - 1, s; l >= 0; l--)
1550
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
1551
- return n && i && cn(e, r, i), i;
1552
- }, Y = (t, e) => (r, n) => e(r, n, t);
1553
- const dn = 1e3, fn = 5e3;
1554
- let Ge = class extends Tt {
1555
- constructor(e, r, n, i, l, s, o, a) {
1537
+ }, __name(_a6, "SheetsFilterButtonShape"), _a6);
1538
+ SheetsFilterButtonShape = __decorateClass$6([
1539
+ __decorateParam$6(2, IContextService),
1540
+ __decorateParam$6(3, ICommandService),
1541
+ __decorateParam$6(4, Inject(ThemeService))
1542
+ ], SheetsFilterButtonShape);
1543
+ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1544
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1545
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1546
+ return kind && result && __defProp$5(target, key, result), result;
1547
+ }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5");
1548
+ const DEFAULT_Z_INDEX = 1e3, SHEETS_FILTER_BUTTON_Z_INDEX = 5e3;
1549
+ var _a7;
1550
+ let SheetsFilterRenderController = (_a7 = class extends RxDisposable {
1551
+ constructor(_context, _injector, _sheetSkeletonManagerService, _sheetsFilterService, _themeService, _sheetInterceptorService, _commandService, _selectionRenderService) {
1556
1552
  super();
1557
- _(this, "_filterRangeShape", null);
1558
- _(this, "_buttonRenderDisposable", null);
1559
- _(this, "_filterButtonShapes", []);
1560
- this._context = e, this._injector = r, this._sheetSkeletonManagerService = n, this._sheetsFilterService = i, this._themeService = l, this._sheetInterceptorService = s, this._commandService = o, this._selectionRenderService = a, this._initRenderer();
1553
+ __publicField(this, "_filterRangeShape", null);
1554
+ __publicField(this, "_buttonRenderDisposable", null);
1555
+ __publicField(this, "_filterButtonShapes", []);
1556
+ this._context = _context, this._injector = _injector, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._sheetsFilterService = _sheetsFilterService, this._themeService = _themeService, this._sheetInterceptorService = _sheetInterceptorService, this._commandService = _commandService, this._selectionRenderService = _selectionRenderService, this._initRenderer();
1561
1557
  }
1562
1558
  dispose() {
1563
1559
  super.dispose(), this._disposeRendering();
1564
1560
  }
1565
1561
  _initRenderer() {
1566
1562
  this._sheetSkeletonManagerService.currentSkeleton$.pipe(
1567
- ze((e) => {
1568
- var o, a;
1569
- if (!e) return _e(null);
1570
- const { unit: r, unitId: n } = this._context, i = ((o = r.getActiveSheet()) == null ? void 0 : o.getSheetId()) || "", l = (a = this._sheetsFilterService.getFilterModel(n, i)) != null ? a : void 0, s = () => ({
1571
- unitId: n,
1572
- worksheetId: i,
1573
- filterModel: l,
1574
- range: l == null ? void 0 : l.getRange(),
1575
- skeleton: e.skeleton
1576
- });
1577
- return zt(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(
1578
- kr(
1579
- ([c]) => {
1580
- var h;
1581
- return c.type === $e.MUTATION && ((h = c.params) == null ? void 0 : h.unitId) === r.getUnitId() && (nr.has(c.id) || c.id === Sr.id);
1563
+ switchMap((skeletonParams) => {
1564
+ var _a13, _b;
1565
+ if (!skeletonParams) return of(null);
1566
+ const { unit: workbook, unitId } = this._context, worksheetId = ((_a13 = workbook.getActiveSheet()) == null ? void 0 : _a13.getSheetId()) || "", filterModel = (_b = this._sheetsFilterService.getFilterModel(unitId, worksheetId)) != null ? _b : void 0, getParams = /* @__PURE__ */ __name(() => ({
1567
+ unitId,
1568
+ worksheetId,
1569
+ filterModel,
1570
+ range: filterModel == null ? void 0 : filterModel.getRange(),
1571
+ skeleton: skeletonParams.skeleton
1572
+ }), "getParams");
1573
+ return fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(
1574
+ filter(
1575
+ ([command]) => {
1576
+ var _a14;
1577
+ return command.type === CommandType.MUTATION && ((_a14 = command.params) == null ? void 0 : _a14.unitId) === workbook.getUnitId() && (FILTER_MUTATIONS.has(command.id) || command.id === SetRangeValuesMutation.id);
1582
1578
  }
1583
1579
  ),
1584
- It(20, void 0, { leading: !1, trailing: !0 }),
1585
- se(s),
1586
- yt(s())
1580
+ throttleTime(20, void 0, { leading: !1, trailing: !0 }),
1581
+ map(getParams),
1582
+ startWith(getParams())
1587
1583
  // must trigger once
1588
1584
  );
1589
1585
  }),
1590
- Qr(this.dispose$)
1591
- ).subscribe((e) => {
1592
- this._disposeRendering(), !(!e || !e.range) && (this._renderRange(e.range, e.skeleton), this._renderButtons(e));
1586
+ takeUntil(this.dispose$)
1587
+ ).subscribe((renderParams) => {
1588
+ this._disposeRendering(), !(!renderParams || !renderParams.range) && (this._renderRange(renderParams.range, renderParams.skeleton), this._renderButtons(renderParams));
1593
1589
  });
1594
1590
  }
1595
- _renderRange(e, r) {
1596
- const { scene: n } = this._context, { rowHeaderWidth: i, columnHeaderHeight: l } = r, s = this._filterRangeShape = new wr(
1597
- n,
1598
- dn,
1591
+ _renderRange(range, skeleton) {
1592
+ const { scene } = this._context, { rowHeaderWidth, columnHeaderHeight } = skeleton, filterRangeShape = this._filterRangeShape = new SelectionControl(
1593
+ scene,
1594
+ DEFAULT_Z_INDEX,
1599
1595
  this._themeService,
1600
1596
  {
1601
- rowHeaderWidth: i,
1602
- columnHeaderHeight: l,
1597
+ rowHeaderWidth,
1598
+ columnHeaderHeight,
1603
1599
  enableAutoFill: !1,
1604
1600
  highlightHeader: !1
1605
1601
  }
1606
- ), a = Ur({
1607
- range: e,
1602
+ ), selectionWithCoord = attachSelectionWithCoord({
1603
+ range,
1608
1604
  primary: null,
1609
1605
  style: { fill: "rgba(0, 0, 0, 0.0)" }
1610
- }, r);
1611
- s.updateRangeBySelectionWithCoord(a), s.setEvent(!1), n.makeDirty(!0);
1612
- }
1613
- _renderButtons(e) {
1614
- const { range: r, filterModel: n, unitId: i, skeleton: l, worksheetId: s } = e, { scene: o } = this._context;
1615
- this._interceptCellContent(i, s, e.range);
1616
- const { startColumn: a, endColumn: c, startRow: h } = r;
1617
- for (let d = a; d <= c; d++) {
1618
- const g = `sheets-filter-button-${d}`, m = Hr(h, d, o, l), { startX: T, startY: v, endX: P, endY: F } = m, I = P - T, R = F - v;
1619
- if (R <= Ee || I <= Ee)
1606
+ }, skeleton);
1607
+ filterRangeShape.updateRangeBySelectionWithCoord(selectionWithCoord), filterRangeShape.setEvent(!1), scene.makeDirty(!0);
1608
+ }
1609
+ _renderButtons(params) {
1610
+ const { range, filterModel, unitId, skeleton, worksheetId } = params, { scene } = this._context;
1611
+ this._interceptCellContent(unitId, worksheetId, params.range);
1612
+ const { startColumn, endColumn, startRow } = range;
1613
+ for (let col = startColumn; col <= endColumn; col++) {
1614
+ const key = `sheets-filter-button-${col}`, startPosition = getCoordByCell(startRow, col, scene, skeleton), { startX, startY, endX, endY } = startPosition, cellWidth = endX - startX, cellHeight = endY - startY;
1615
+ if (cellHeight <= FILTER_ICON_PADDING || cellWidth <= FILTER_ICON_PADDING)
1620
1616
  continue;
1621
- const M = !!n.getFilterColumn(d), $ = P - H - Ee, Se = F - H - Ee, ge = {
1622
- left: $,
1623
- top: Se,
1624
- height: H,
1625
- width: H,
1626
- zIndex: fn,
1627
- cellHeight: R,
1628
- cellWidth: I,
1629
- filterParams: { unitId: i, subUnitId: s, col: d, hasCriteria: M }
1630
- }, y = this._injector.createInstance(Qe, g, ge);
1631
- this._filterButtonShapes.push(y);
1617
+ const hasCriteria = !!filterModel.getFilterColumn(col), iconStartX = endX - FILTER_ICON_SIZE - FILTER_ICON_PADDING, iconStartY = endY - FILTER_ICON_SIZE - FILTER_ICON_PADDING, props = {
1618
+ left: iconStartX,
1619
+ top: iconStartY,
1620
+ height: FILTER_ICON_SIZE,
1621
+ width: FILTER_ICON_SIZE,
1622
+ zIndex: SHEETS_FILTER_BUTTON_Z_INDEX,
1623
+ cellHeight,
1624
+ cellWidth,
1625
+ filterParams: { unitId, subUnitId: worksheetId, col, hasCriteria }
1626
+ }, buttonShape = this._injector.createInstance(SheetsFilterButtonShape, key, props);
1627
+ this._filterButtonShapes.push(buttonShape);
1632
1628
  }
1633
- o.addObjects(this._filterButtonShapes), o.makeDirty();
1634
- }
1635
- _interceptCellContent(e, r, n) {
1636
- const { startRow: i, startColumn: l, endColumn: s } = n;
1637
- this._buttonRenderDisposable = this._sheetInterceptorService.intercept(gr.CELL_CONTENT, {
1638
- effect: er.Style,
1639
- handler: (o, a, c) => {
1640
- const { row: h, col: d, unitId: g, subUnitId: m } = a;
1641
- return g !== e || m !== r || h !== i || d < l || d > s ? c(o) : c({
1642
- ...o,
1629
+ scene.addObjects(this._filterButtonShapes), scene.makeDirty();
1630
+ }
1631
+ _interceptCellContent(workbookId, worksheetId, range) {
1632
+ const { startRow, startColumn, endColumn } = range;
1633
+ this._buttonRenderDisposable = this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {
1634
+ effect: InterceptorEffectEnum.Style,
1635
+ handler: /* @__PURE__ */ __name((cell, pos, next) => {
1636
+ const { row, col, unitId, subUnitId } = pos;
1637
+ return unitId !== workbookId || subUnitId !== worksheetId || row !== startRow || col < startColumn || col > endColumn ? next(cell) : next({
1638
+ ...cell,
1643
1639
  fontRenderExtension: {
1644
- ...o == null ? void 0 : o.fontRenderExtension,
1645
- rightOffset: H
1640
+ ...cell == null ? void 0 : cell.fontRenderExtension,
1641
+ rightOffset: FILTER_ICON_SIZE
1646
1642
  }
1647
1643
  });
1648
- },
1644
+ }, "handler"),
1649
1645
  priority: 10
1650
1646
  });
1651
1647
  }
1652
1648
  _disposeRendering() {
1653
- var e, r;
1654
- (e = this._filterRangeShape) == null || e.dispose(), this._filterButtonShapes.forEach((n) => n.dispose()), (r = this._buttonRenderDisposable) == null || r.dispose(), this._filterRangeShape = null, this._buttonRenderDisposable = null, this._filterButtonShapes = [];
1655
- }
1656
- };
1657
- Ge = hn([
1658
- Y(1, E(X)),
1659
- Y(2, E(Mr)),
1660
- Y(3, E(k)),
1661
- Y(4, E(Et)),
1662
- Y(5, E(_r)),
1663
- Y(6, W),
1664
- Y(7, $r)
1665
- ], Ge);
1666
- var pn = Object.defineProperty, mn = Object.getOwnPropertyDescriptor, _n = (t, e, r, n) => {
1667
- for (var i = n > 1 ? void 0 : n ? mn(e, r) : e, l = t.length - 1, s; l >= 0; l--)
1668
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
1669
- return n && i && pn(e, r, i), i;
1670
- }, ft = (t, e) => (r, n) => e(r, n, t);
1671
- let fe = class extends Tt {
1672
- constructor(t, e) {
1673
- super(), this._renderManagerService = t, this._sheetsRenderService = e, [
1674
- ir,
1675
- or,
1676
- ar,
1677
- lr
1678
- ].forEach((r) => this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(r.id))), this.disposeWithMe(this._renderManagerService.registerRenderModule(
1679
- Z.UNIVER_SHEET,
1680
- [Ge]
1649
+ var _a13, _b;
1650
+ (_a13 = this._filterRangeShape) == null || _a13.dispose(), this._filterButtonShapes.forEach((s) => s.dispose()), (_b = this._buttonRenderDisposable) == null || _b.dispose(), this._filterRangeShape = null, this._buttonRenderDisposable = null, this._filterButtonShapes = [];
1651
+ }
1652
+ }, __name(_a7, "SheetsFilterRenderController"), _a7);
1653
+ SheetsFilterRenderController = __decorateClass$5([
1654
+ __decorateParam$5(1, Inject(Injector)),
1655
+ __decorateParam$5(2, Inject(SheetSkeletonManagerService)),
1656
+ __decorateParam$5(3, Inject(SheetsFilterService)),
1657
+ __decorateParam$5(4, Inject(ThemeService)),
1658
+ __decorateParam$5(5, Inject(SheetInterceptorService)),
1659
+ __decorateParam$5(6, ICommandService),
1660
+ __decorateParam$5(7, ISheetSelectionRenderService)
1661
+ ], SheetsFilterRenderController);
1662
+ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1663
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1664
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1665
+ return kind && result && __defProp$4(target, key, result), result;
1666
+ }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a8;
1667
+ let SheetsFilterUIMobileController = (_a8 = class extends RxDisposable {
1668
+ constructor(_renderManagerService, _sheetsRenderService) {
1669
+ super(), this._renderManagerService = _renderManagerService, this._sheetsRenderService = _sheetsRenderService, [
1670
+ SetSheetsFilterRangeMutation,
1671
+ SetSheetsFilterCriteriaMutation,
1672
+ RemoveSheetsFilterMutation,
1673
+ ReCalcSheetsFilterMutation
1674
+ ].forEach((m) => this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(m.id))), this.disposeWithMe(this._renderManagerService.registerRenderModule(
1675
+ UniverInstanceType.UNIVER_SHEET,
1676
+ [SheetsFilterRenderController]
1681
1677
  ));
1682
1678
  }
1679
+ }, __name(_a8, "SheetsFilterUIMobileController"), _a8);
1680
+ SheetsFilterUIMobileController = __decorateClass$4([
1681
+ __decorateParam$4(0, IRenderManagerService),
1682
+ __decorateParam$4(1, Inject(SheetsRenderService))
1683
+ ], SheetsFilterUIMobileController);
1684
+ const SmartToggleFilterShortcut = {
1685
+ id: SmartToggleSheetsFilterCommand.id,
1686
+ binding: KeyCode.L | MetaKeys.CTRL_COMMAND | MetaKeys.SHIFT,
1687
+ description: "sheets-filter.shortcut.smart-toggle-filter",
1688
+ preconditions: whenSheetEditorFocused,
1689
+ group: "4_sheet-edit"
1683
1690
  };
1684
- fe = _n([
1685
- ft(0, bt),
1686
- ft(1, E(Rt))
1687
- ], fe);
1688
- var Sn = Object.defineProperty, gn = Object.getOwnPropertyDescriptor, vn = (t, e, r, n) => {
1689
- for (var i = n > 1 ? void 0 : n ? gn(e, r) : e, l = t.length - 1, s; l >= 0; l--)
1690
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
1691
- return n && i && Sn(e, r, i), i;
1692
- }, A = (t, e) => (r, n) => e(r, n, t);
1693
- const pt = "FILTER_PANEL_POPUP";
1694
- let be = class extends fe {
1695
- constructor(e, r, n, i, l, s, o, a, c, h, d, g, m) {
1696
- super(m, g);
1697
- _(this, "_popupDisposable");
1698
- this._injector = e, this._componentManager = r, this._sheetsFilterPanelService = n, this._sheetCanvasPopupService = i, this._sheetsFilterService = l, this._localeService = s, this._shortcutService = o, this._commandService = a, this._menuManagerService = c, this._contextService = h, this._messageService = d, this._initCommands(), this._initShortcuts(), this._initMenuItems(), this._initUI();
1691
+ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1692
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1693
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1694
+ return kind && result && __defProp$3(target, key, result), result;
1695
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3");
1696
+ const FILTER_PANEL_POPUP_KEY = "FILTER_PANEL_POPUP";
1697
+ var _a9;
1698
+ let SheetsFilterUIDesktopController = (_a9 = class extends SheetsFilterUIMobileController {
1699
+ constructor(_injector, _componentManager, _sheetsFilterPanelService, _sheetCanvasPopupService, _sheetsFilterService, _localeService, _shortcutService, _commandService, _menuManagerService, _contextService, _messageService, sheetsRenderService, renderManagerService) {
1700
+ super(renderManagerService, sheetsRenderService);
1701
+ __publicField(this, "_popupDisposable");
1702
+ this._injector = _injector, this._componentManager = _componentManager, this._sheetsFilterPanelService = _sheetsFilterPanelService, this._sheetCanvasPopupService = _sheetCanvasPopupService, this._sheetsFilterService = _sheetsFilterService, this._localeService = _localeService, this._shortcutService = _shortcutService, this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._contextService = _contextService, this._messageService = _messageService, this._initCommands(), this._initShortcuts(), this._initMenuItems(), this._initUI();
1699
1703
  }
1700
1704
  dispose() {
1701
1705
  super.dispose(), this._closeFilterPopup();
1702
1706
  }
1703
1707
  _initShortcuts() {
1704
1708
  [
1705
- sn
1706
- ].forEach((e) => {
1707
- this.disposeWithMe(this._shortcutService.registerShortcut(e));
1709
+ SmartToggleFilterShortcut
1710
+ ].forEach((shortcut) => {
1711
+ this.disposeWithMe(this._shortcutService.registerShortcut(shortcut));
1708
1712
  });
1709
1713
  }
1710
1714
  _initCommands() {
1711
1715
  [
1712
- me,
1713
- cr,
1714
- ur,
1715
- re,
1716
- Ke,
1717
- Xe,
1718
- Dt,
1719
- Ae,
1720
- de
1721
- ].forEach((e) => {
1722
- this.disposeWithMe(this._commandService.registerCommand(e));
1716
+ SmartToggleSheetsFilterCommand,
1717
+ RemoveSheetFilterCommand,
1718
+ SetSheetFilterRangeCommand,
1719
+ SetSheetsFilterCriteriaCommand,
1720
+ ClearSheetsFilterCriteriaCommand,
1721
+ ReCalcSheetsFilterCommand,
1722
+ ChangeFilterByOperation,
1723
+ OpenFilterPanelOperation,
1724
+ CloseFilterPanelOperation
1725
+ ].forEach((c) => {
1726
+ this.disposeWithMe(this._commandService.registerCommand(c));
1723
1727
  });
1724
1728
  }
1725
1729
  _initMenuItems() {
1726
- this._menuManagerService.mergeMenu(rn);
1730
+ this._menuManagerService.mergeMenu(menuSchema);
1727
1731
  }
1728
1732
  _initUI() {
1729
- this.disposeWithMe(this._componentManager.register(pt, Zs)), this.disposeWithMe(this._componentManager.register("FilterSingle", Vt)), this.disposeWithMe(this._contextService.subscribeContextValue$(ne).pipe(Gr()).subscribe((e) => {
1730
- e ? this._openFilterPopup() : this._closeFilterPopup();
1731
- })), this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe((e) => {
1732
- e && this._messageService.show({
1733
- type: Zr.Error,
1734
- content: this._localeService.t(e)
1733
+ this.disposeWithMe(this._componentManager.register(FILTER_PANEL_POPUP_KEY, FilterPanel)), this.disposeWithMe(this._componentManager.register("FilterSingle", FilterSingle)), this.disposeWithMe(this._contextService.subscribeContextValue$(FILTER_PANEL_OPENED_KEY).pipe(distinctUntilChanged()).subscribe((open) => {
1734
+ open ? this._openFilterPopup() : this._closeFilterPopup();
1735
+ })), this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe((content) => {
1736
+ content && this._messageService.show({
1737
+ type: MessageType.Error,
1738
+ content: this._localeService.t(content)
1735
1739
  });
1736
1740
  }));
1737
1741
  }
1738
1742
  _openFilterPopup() {
1739
- const e = this._sheetsFilterPanelService.filterModel;
1740
- if (!e)
1743
+ const currentFilterModel = this._sheetsFilterPanelService.filterModel;
1744
+ if (!currentFilterModel)
1741
1745
  throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");
1742
- const r = e.getRange(), n = this._sheetsFilterPanelService.col, { startRow: i } = r;
1743
- this._popupDisposable = this._sheetCanvasPopupService.attachPopupToCell(i, n, {
1744
- componentKey: pt,
1746
+ const range = currentFilterModel.getRange(), col = this._sheetsFilterPanelService.col, { startRow } = range;
1747
+ this._popupDisposable = this._sheetCanvasPopupService.attachPopupToCell(startRow, col, {
1748
+ componentKey: FILTER_PANEL_POPUP_KEY,
1745
1749
  direction: "horizontal",
1746
- onClickOutside: () => this._commandService.syncExecuteCommand(de.id),
1750
+ onClickOutside: /* @__PURE__ */ __name(() => this._commandService.syncExecuteCommand(CloseFilterPanelOperation.id), "onClickOutside"),
1747
1751
  offset: [5, 0]
1748
1752
  });
1749
1753
  }
1750
1754
  _closeFilterPopup() {
1751
- var e;
1752
- (e = this._popupDisposable) == null || e.dispose(), this._popupDisposable = null;
1753
- }
1754
- };
1755
- be = vn([
1756
- A(0, E(X)),
1757
- A(1, E(Nr)),
1758
- A(2, E(j)),
1759
- A(3, E(Dr)),
1760
- A(4, E(k)),
1761
- A(5, E(K)),
1762
- A(6, Pr),
1763
- A(7, W),
1764
- A(8, Or),
1765
- A(9, we),
1766
- A(10, Rr),
1767
- A(11, E(Rt)),
1768
- A(12, bt)
1769
- ], be);
1770
- var jt = Object.defineProperty, En = Object.getOwnPropertyDescriptor, Tn = (t, e, r) => e in t ? jt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Fn = (t, e, r, n) => {
1771
- for (var i = n > 1 ? void 0 : n ? En(e, r) : e, l = t.length - 1, s; l >= 0; l--)
1772
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
1773
- return n && i && jt(e, r, i), i;
1774
- }, Ve = (t, e) => (r, n) => e(r, n, t), Wt = (t, e, r) => Tn(t, typeof e != "symbol" ? e + "" : e, r);
1775
- const Cn = "SHEET_FILTER_UI_PLUGIN";
1776
- let Le = class extends qe {
1777
- constructor(t = Ne, e, r, n) {
1778
- super(), this._config = t, this._injector = e, this._configService = r, this._rpcChannelService = n;
1779
- const { menu: i, ...l } = Ct(
1755
+ var _a13;
1756
+ (_a13 = this._popupDisposable) == null || _a13.dispose(), this._popupDisposable = null;
1757
+ }
1758
+ }, __name(_a9, "SheetsFilterUIDesktopController"), _a9);
1759
+ SheetsFilterUIDesktopController = __decorateClass$3([
1760
+ __decorateParam$3(0, Inject(Injector)),
1761
+ __decorateParam$3(1, Inject(ComponentManager)),
1762
+ __decorateParam$3(2, Inject(SheetsFilterPanelService)),
1763
+ __decorateParam$3(3, Inject(SheetCanvasPopManagerService)),
1764
+ __decorateParam$3(4, Inject(SheetsFilterService)),
1765
+ __decorateParam$3(5, Inject(LocaleService)),
1766
+ __decorateParam$3(6, IShortcutService),
1767
+ __decorateParam$3(7, ICommandService),
1768
+ __decorateParam$3(8, IMenuManagerService),
1769
+ __decorateParam$3(9, IContextService),
1770
+ __decorateParam$3(10, IMessageService),
1771
+ __decorateParam$3(11, Inject(SheetsRenderService)),
1772
+ __decorateParam$3(12, IRenderManagerService)
1773
+ ], SheetsFilterUIDesktopController);
1774
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __defNormalProp$1 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp$1"), __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1775
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1776
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1777
+ return kind && result && __defProp$2(target, key, result), result;
1778
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), __publicField$1 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField$1");
1779
+ const NAME$1 = "SHEET_FILTER_UI_PLUGIN";
1780
+ var _a10;
1781
+ let UniverSheetsFilterUIPlugin = (_a10 = class extends Plugin {
1782
+ constructor(_config = defaultPluginConfig, _injector, _configService, _rpcChannelService) {
1783
+ super(), this._config = _config, this._injector = _injector, this._configService = _configService, this._rpcChannelService = _rpcChannelService;
1784
+ const { menu, ...rest } = merge$1(
1780
1785
  {},
1781
- Ne,
1786
+ defaultPluginConfig,
1782
1787
  this._config
1783
1788
  );
1784
- i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig($t, l);
1789
+ menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, rest);
1785
1790
  }
1786
1791
  onStarting() {
1787
1792
  [
1788
- [j],
1789
- [ie],
1790
- [be]
1791
- ].forEach((t) => this._injector.add(t)), this._config.useRemoteFilterValuesGenerator && this._rpcChannelService && this._injector.add([Pe, {
1792
- useFactory: () => rr(
1793
- this._rpcChannelService.requestChannel(tt)
1794
- )
1793
+ [SheetsFilterPanelService],
1794
+ [SheetsFilterPermissionController],
1795
+ [SheetsFilterUIDesktopController]
1796
+ ].forEach((d) => this._injector.add(d)), this._config.useRemoteFilterValuesGenerator && this._rpcChannelService && this._injector.add([ISheetsGenerateFilterValuesService, {
1797
+ useFactory: /* @__PURE__ */ __name(() => toModule(
1798
+ this._rpcChannelService.requestChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME)
1799
+ ), "useFactory")
1795
1800
  }]);
1796
1801
  }
1797
1802
  onReady() {
1798
- this._injector.get(ie);
1803
+ this._injector.get(SheetsFilterPermissionController);
1799
1804
  }
1800
1805
  onRendered() {
1801
- this._injector.get(be);
1802
- }
1803
- };
1804
- Wt(Le, "type", Z.UNIVER_SHEET);
1805
- Wt(Le, "pluginName", Cn);
1806
- Le = Fn([
1807
- Ft(Ot),
1808
- Ve(1, E(X)),
1809
- Ve(2, Nt),
1810
- Ve(3, tr(Pt))
1811
- ], Le);
1812
- var kt = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, Pn = (t, e, r) => e in t ? kt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, On = (t, e, r, n) => {
1813
- for (var i = n > 1 ? void 0 : n ? Nn(e, r) : e, l = t.length - 1, s; l >= 0; l--)
1814
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
1815
- return n && i && kt(e, r, i), i;
1816
- }, mt = (t, e) => (r, n) => e(r, n, t), Qt = (t, e, r) => Pn(t, typeof e != "symbol" ? e + "" : e, r);
1817
- const Rn = "SHEET_FILTER_UI_PLUGIN";
1818
- let Me = class extends qe {
1819
- constructor(t = Ne, e, r) {
1820
- super(), this._config = t, this._injector = e, this._configService = r;
1821
- const { menu: n, ...i } = Ct(
1806
+ this._injector.get(SheetsFilterUIDesktopController);
1807
+ }
1808
+ }, __name(_a10, "UniverSheetsFilterUIPlugin"), _a10);
1809
+ __publicField$1(UniverSheetsFilterUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
1810
+ __publicField$1(UniverSheetsFilterUIPlugin, "pluginName", NAME$1);
1811
+ UniverSheetsFilterUIPlugin = __decorateClass$2([
1812
+ DependentOn(UniverSheetsFilterPlugin),
1813
+ __decorateParam$2(1, Inject(Injector)),
1814
+ __decorateParam$2(2, IConfigService),
1815
+ __decorateParam$2(3, Optional(IRPCChannelService))
1816
+ ], UniverSheetsFilterUIPlugin);
1817
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1818
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1819
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1820
+ return kind && result && __defProp$1(target, key, result), result;
1821
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField");
1822
+ const NAME = "SHEET_FILTER_UI_PLUGIN";
1823
+ var _a11;
1824
+ let UniverSheetsFilterMobileUIPlugin = (_a11 = class extends Plugin {
1825
+ constructor(_config = defaultPluginConfig, _injector, _configService) {
1826
+ super(), this._config = _config, this._injector = _injector, this._configService = _configService;
1827
+ const { menu, ...rest } = merge$1(
1822
1828
  {},
1823
- Ne,
1829
+ defaultPluginConfig,
1824
1830
  this._config
1825
1831
  );
1826
- n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig($t, i);
1832
+ menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, rest);
1827
1833
  }
1828
1834
  onStarting() {
1829
1835
  [
1830
- [ie],
1831
- [fe]
1832
- ].forEach((t) => this._injector.add(t));
1836
+ [SheetsFilterPermissionController],
1837
+ [SheetsFilterUIMobileController]
1838
+ ].forEach((d) => this._injector.add(d));
1833
1839
  }
1834
1840
  onReady() {
1835
- this._injector.get(ie);
1841
+ this._injector.get(SheetsFilterPermissionController);
1836
1842
  }
1837
1843
  onRendered() {
1838
- this._injector.get(fe);
1839
- }
1840
- };
1841
- Qt(Me, "type", Z.UNIVER_SHEET);
1842
- Qt(Me, "pluginName", Rn);
1843
- Me = On([
1844
- Ft(Ot),
1845
- mt(1, E(X)),
1846
- mt(2, Nt)
1847
- ], Me);
1848
- var In = Object.defineProperty, yn = Object.getOwnPropertyDescriptor, An = (t, e, r, n) => {
1849
- for (var i = n > 1 ? void 0 : n ? yn(e, r) : e, l = t.length - 1, s; l >= 0; l--)
1850
- (s = t[l]) && (i = (n ? s(e, r, i) : s(i)) || i);
1851
- return n && i && In(e, r, i), i;
1852
- }, _t = (t, e) => (r, n) => e(r, n, t), Te;
1853
- let St = (Te = class extends qe {
1854
- constructor(t, e, r) {
1855
- super(), this._config = t, this._injector = e, this._rpcChannelService = r;
1844
+ this._injector.get(SheetsFilterUIMobileController);
1845
+ }
1846
+ }, __name(_a11, "UniverSheetsFilterMobileUIPlugin"), _a11);
1847
+ __publicField2(UniverSheetsFilterMobileUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
1848
+ __publicField2(UniverSheetsFilterMobileUIPlugin, "pluginName", NAME);
1849
+ UniverSheetsFilterMobileUIPlugin = __decorateClass$1([
1850
+ DependentOn(UniverSheetsFilterPlugin),
1851
+ __decorateParam$1(1, Inject(Injector)),
1852
+ __decorateParam$1(2, IConfigService)
1853
+ ], UniverSheetsFilterMobileUIPlugin);
1854
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1855
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1856
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1857
+ return kind && result && __defProp2(target, key, result), result;
1858
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), _a12;
1859
+ let UniverSheetsFilterUIWorkerPlugin = (_a12 = class extends Plugin {
1860
+ constructor(_config, _injector, _rpcChannelService) {
1861
+ super(), this._config = _config, this._injector = _injector, this._rpcChannelService = _rpcChannelService;
1856
1862
  }
1857
1863
  onStarting() {
1858
1864
  [
1859
- [Pe, { useClass: We }]
1860
- ].forEach((t) => this._injector.add(t));
1865
+ [ISheetsGenerateFilterValuesService, { useClass: SheetsGenerateFilterValuesService }]
1866
+ ].forEach((d) => this._injector.add(d));
1861
1867
  }
1862
1868
  onReady() {
1863
1869
  this._rpcChannelService.registerChannel(
1864
- tt,
1865
- sr(this._injector.get(Pe))
1870
+ SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME,
1871
+ fromModule(this._injector.get(ISheetsGenerateFilterValuesService))
1866
1872
  );
1867
1873
  }
1868
- }, _(Te, "type", Z.UNIVER_SHEET), _(Te, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN"), Te);
1869
- St = An([
1870
- _t(1, E(X)),
1871
- _t(2, Pt)
1872
- ], St);
1874
+ }, __name(_a12, "UniverSheetsFilterUIWorkerPlugin"), __publicField(_a12, "type", UniverInstanceType.UNIVER_SHEET), __publicField(_a12, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN"), _a12);
1875
+ UniverSheetsFilterUIWorkerPlugin = __decorateClass([
1876
+ __decorateParam(1, Inject(Injector)),
1877
+ __decorateParam(2, IRPCChannelService)
1878
+ ], UniverSheetsFilterUIWorkerPlugin);
1873
1879
  export {
1874
- Dt as ChangeFilterByOperation,
1875
- de as CloseFilterPanelOperation,
1876
- Ae as OpenFilterPanelOperation,
1877
- Me as UniverSheetsFilterMobileUIPlugin,
1878
- Le as UniverSheetsFilterUIPlugin,
1879
- St as UniverSheetsFilterUIWorkerPlugin
1880
+ ChangeFilterByOperation,
1881
+ CloseFilterPanelOperation,
1882
+ OpenFilterPanelOperation,
1883
+ UniverSheetsFilterMobileUIPlugin,
1884
+ UniverSheetsFilterUIPlugin,
1885
+ UniverSheetsFilterUIWorkerPlugin
1880
1886
  };