@univerjs/sheets-filter-ui 1.0.0-rc.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -580,12 +580,14 @@ function statisticFilterByValueItems(items) {
580
580
  let checked = 0;
581
581
  let unchecked = 0;
582
582
  function traverse(node) {
583
- if (node.leaf) if (node.checked) {
584
- checkedItems.push(node);
585
- checked += node.count;
586
- } else {
587
- uncheckedItems.push(node);
588
- unchecked += node.count;
583
+ if (node.leaf) {
584
+ if (node.checked) {
585
+ checkedItems.push(node);
586
+ checked += node.count;
587
+ } else {
588
+ uncheckedItems.push(node);
589
+ unchecked += node.count;
590
+ }
589
591
  }
590
592
  if (node.children) node.children.forEach(traverse);
591
593
  }
@@ -599,7 +601,7 @@ function statisticFilterByValueItems(items) {
599
601
  }
600
602
 
601
603
  //#endregion
602
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
604
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
603
605
  function __decorateParam(paramIndex, decorator) {
604
606
  return function(target, key) {
605
607
  decorator(target, key, paramIndex);
@@ -607,7 +609,7 @@ function __decorateParam(paramIndex, decorator) {
607
609
  }
608
610
 
609
611
  //#endregion
610
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
612
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
611
613
  function __decorate(decorators, target, key, desc) {
612
614
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
613
615
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -811,8 +813,10 @@ function areAllLeafNodesChecked(node) {
811
813
  return node.children ? node.children.every((child) => areAllLeafNodesChecked(child)) : true;
812
814
  }
813
815
  function updateLeafNodesCheckedStatus(node, status) {
814
- if (node.leaf) if (status !== void 0) node.checked = status;
815
- else node.checked = !node.checked;
816
+ if (node.leaf) {
817
+ if (status !== void 0) node.checked = status;
818
+ else node.checked = !node.checked;
819
+ }
816
820
  if (node.children) node.children.forEach((child) => updateLeafNodesCheckedStatus(child, status));
817
821
  }
818
822
  function searchTree(items, searchKeywords) {
@@ -837,7 +841,7 @@ function searchTree(items, searchKeywords) {
837
841
  }
838
842
 
839
843
  //#endregion
840
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
844
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
841
845
  function _typeof(o) {
842
846
  "@babel/helpers - typeof";
843
847
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -848,7 +852,7 @@ function _typeof(o) {
848
852
  }
849
853
 
850
854
  //#endregion
851
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
855
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
852
856
  function toPrimitive(t, r) {
853
857
  if ("object" != _typeof(t) || !t) return t;
854
858
  var e = t[Symbol.toPrimitive];
@@ -861,14 +865,14 @@ function toPrimitive(t, r) {
861
865
  }
862
866
 
863
867
  //#endregion
864
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
868
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
865
869
  function toPropertyKey(t) {
866
870
  var i = toPrimitive(t, "string");
867
871
  return "symbol" == _typeof(i) ? i : i + "";
868
872
  }
869
873
 
870
874
  //#endregion
871
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
875
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
872
876
  function _defineProperty(e, r, t) {
873
877
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
874
878
  value: t,
@@ -960,9 +964,7 @@ let SheetsFilterPanelService = class SheetsFilterPanelService extends _univerjs_
960
964
  case _univerjs_sheets_filter.FilterBy.COLORS:
961
965
  this._setupByColors(this._filterModel, this.col);
962
966
  break;
963
- case _univerjs_sheets_filter.FilterBy.CONDITIONS:
964
- this._setupByConditions(this._filterModel, this.col);
965
- break;
967
+ case _univerjs_sheets_filter.FilterBy.CONDITIONS: this._setupByConditions(this._filterModel, this.col);
966
968
  }
967
969
  return true;
968
970
  }
@@ -1221,7 +1223,8 @@ let ByValuesModel = _ByValuesModel = class ByValuesModel extends _univerjs_core.
1221
1223
  trailing: true
1222
1224
  }), (0, rxjs.startWith)(void 0)), this._rawFilterItems$]).pipe((0, rxjs.map)(([searchString, items]) => {
1223
1225
  if (!searchString) return items;
1224
- return searchTree(items, searchString.toLowerCase().split(/\s+/).filter((s) => !!s));
1226
+ const searchKeyWords = searchString.toLowerCase().split(/\s+/).filter((s) => !!s);
1227
+ return searchTree(items, searchKeyWords);
1225
1228
  })), this._manuallyUpdateFilterItems$).pipe((0, rxjs.shareReplay)({
1226
1229
  bufferSize: 1,
1227
1230
  refCount: true
@@ -1253,7 +1256,8 @@ let ByValuesModel = _ByValuesModel = class ByValuesModel extends _univerjs_core.
1253
1256
  const items = _univerjs_core.Tools.deepClone(this._filterItems);
1254
1257
  const changedItem = findObjectByKey(items, item.key);
1255
1258
  if (!changedItem) return;
1256
- updateLeafNodesCheckedStatus(changedItem, !areAllLeafNodesChecked(changedItem));
1259
+ const allLeafChecked = areAllLeafNodesChecked(changedItem);
1260
+ updateLeafNodesCheckedStatus(changedItem, !allLeafChecked);
1257
1261
  this._manuallyUpdateFilterItems(items);
1258
1262
  }
1259
1263
  onFilterOnly(itemKeys) {
@@ -1577,7 +1581,7 @@ const menuSchema = { [_univerjs_ui.RibbonDataGroup.ORGANIZATION]: { [_univerjs_s
1577
1581
  //#endregion
1578
1582
  //#region package.json
1579
1583
  var name = "@univerjs/sheets-filter-ui";
1580
- var version = "1.0.0-rc.0";
1584
+ var version = "1.0.1";
1581
1585
 
1582
1586
  //#endregion
1583
1587
  //#region src/config/config.ts
@@ -1585,6 +1589,21 @@ const SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY = "sheets-filter-ui.config";
1585
1589
  const configSymbol = Symbol(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY);
1586
1590
  const defaultPluginConfig = {};
1587
1591
 
1592
+ //#endregion
1593
+ //#region src/menu/mobile-schema.ts
1594
+ const mobileMenuSchema = { [_univerjs_ui.RibbonDataGroup.ORGANIZATION]: { [_univerjs_sheets_filter.SmartToggleSheetsFilterCommand.id]: {
1595
+ order: 2,
1596
+ menuItemFactory: SmartToggleFilterMenuItemFactory,
1597
+ [_univerjs_sheets_filter.ClearSheetsFilterCriteriaCommand.id]: {
1598
+ order: 0,
1599
+ menuItemFactory: ClearFilterCriteriaMenuItemFactory
1600
+ },
1601
+ [_univerjs_sheets_filter.ReCalcSheetsFilterCommand.id]: {
1602
+ order: 1,
1603
+ menuItemFactory: ReCalcFilterMenuItemFactory
1604
+ }
1605
+ } } };
1606
+
1588
1607
  //#endregion
1589
1608
  //#region src/controllers/mobile-menu.controller.ts
1590
1609
  /**
@@ -1606,7 +1625,7 @@ let SheetsFilterMobileMenuController = class SheetsFilterMobileMenuController ex
1606
1625
  constructor(commandService, menuManagerService) {
1607
1626
  super();
1608
1627
  this.disposeWithMe(commandService.registerCommand(_univerjs_sheets_filter.SmartToggleSheetsFilterCommand));
1609
- menuManagerService.mergeMenu(menuSchema);
1628
+ menuManagerService.mergeMenu(mobileMenuSchema);
1610
1629
  }
1611
1630
  };
1612
1631
  SheetsFilterMobileMenuController = __decorate([__decorateParam(0, _univerjs_core.ICommandService), __decorateParam(1, _univerjs_ui.IMenuManagerService)], SheetsFilterMobileMenuController);
@@ -2402,7 +2421,8 @@ let SheetsFilterPermissionController = class SheetsFilterPermissionController ex
2402
2421
  this.disposeWithMe(this._commandService.beforeCommandExecuted((command) => {
2403
2422
  if (command.id === _univerjs_sheets_filter.SmartToggleSheetsFilterCommand.id) {
2404
2423
  var _this$_sheetsFilterSe;
2405
- const target = (0, _univerjs_sheets.getSheetCommandTarget)(this._injector.get(_univerjs_core.IUniverInstanceService));
2424
+ const univerInstanceService = this._injector.get(_univerjs_core.IUniverInstanceService);
2425
+ const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
2406
2426
  if (!target) return;
2407
2427
  const { unitId, subUnitId, worksheet } = target;
2408
2428
  const filterRange = (_this$_sheetsFilterSe = this._sheetsFilterService.getFilterModel(unitId, subUnitId)) === null || _this$_sheetsFilterSe === void 0 ? void 0 : _this$_sheetsFilterSe.getRange();
@@ -2867,12 +2887,13 @@ function FilterPanel() {
2867
2887
  }, [filterByModel, commandService]);
2868
2888
  const range = (_filterService$active = (0, _univerjs_ui.useDependency)(_univerjs_sheets_filter.SheetsFilterService).activeFilterModel) === null || _filterService$active === void 0 ? void 0 : _filterService$active.getRange();
2869
2889
  const colIndex = sheetsFilterPanelService.col;
2890
+ const FilterPanelEmbedPointPart = (0, _univerjs_ui.useComponentsOfPart)(_univerjs_sheets_ui.SheetsUIPart.FILTER_PANEL_EMBED_POINT);
2870
2891
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2871
2892
  "data-u-comp": "sheets-filter-panel",
2872
2893
  className: "univer-box-border univer-flex univer-max-h-[500px] univer-w-[400px] univer-flex-col univer-rounded-lg univer-bg-gray-0 univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700",
2873
2894
  children: [
2874
2895
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.ComponentContainer, {
2875
- components: (0, _univerjs_ui.useComponentsOfPart)(_univerjs_sheets_ui.SheetsUIPart.FILTER_PANEL_EMBED_POINT),
2896
+ components: FilterPanelEmbedPointPart,
2876
2897
  sharedProps: {
2877
2898
  range,
2878
2899
  colIndex,
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ar-SA.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ca-ES.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/de-DE.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/en-US.ts
3
2
  /**
4
3
  * Copyright 2023-present DreamNum Co., Ltd.
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/es-ES.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/fa-IR.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/fr-FR.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/id-ID.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/it-IT.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ja-JP.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ko-KR.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/pl-PL.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/pt-BR.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/ru-RU.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/sk-SK.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/vi-VN.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/zh-CN.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/zh-HK.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/locale/zh-TW.ts
3
2
  const locale = { "sheets-filter-ui": {
4
3
  toolbar: {
package/lib/es/index.js CHANGED
@@ -579,12 +579,14 @@ function statisticFilterByValueItems(items) {
579
579
  let checked = 0;
580
580
  let unchecked = 0;
581
581
  function traverse(node) {
582
- if (node.leaf) if (node.checked) {
583
- checkedItems.push(node);
584
- checked += node.count;
585
- } else {
586
- uncheckedItems.push(node);
587
- unchecked += node.count;
582
+ if (node.leaf) {
583
+ if (node.checked) {
584
+ checkedItems.push(node);
585
+ checked += node.count;
586
+ } else {
587
+ uncheckedItems.push(node);
588
+ unchecked += node.count;
589
+ }
588
590
  }
589
591
  if (node.children) node.children.forEach(traverse);
590
592
  }
@@ -598,7 +600,7 @@ function statisticFilterByValueItems(items) {
598
600
  }
599
601
 
600
602
  //#endregion
601
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
603
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
602
604
  function __decorateParam(paramIndex, decorator) {
603
605
  return function(target, key) {
604
606
  decorator(target, key, paramIndex);
@@ -606,7 +608,7 @@ function __decorateParam(paramIndex, decorator) {
606
608
  }
607
609
 
608
610
  //#endregion
609
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
611
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
610
612
  function __decorate(decorators, target, key, desc) {
611
613
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
612
614
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -810,8 +812,10 @@ function areAllLeafNodesChecked(node) {
810
812
  return node.children ? node.children.every((child) => areAllLeafNodesChecked(child)) : true;
811
813
  }
812
814
  function updateLeafNodesCheckedStatus(node, status) {
813
- if (node.leaf) if (status !== void 0) node.checked = status;
814
- else node.checked = !node.checked;
815
+ if (node.leaf) {
816
+ if (status !== void 0) node.checked = status;
817
+ else node.checked = !node.checked;
818
+ }
815
819
  if (node.children) node.children.forEach((child) => updateLeafNodesCheckedStatus(child, status));
816
820
  }
817
821
  function searchTree(items, searchKeywords) {
@@ -836,7 +840,7 @@ function searchTree(items, searchKeywords) {
836
840
  }
837
841
 
838
842
  //#endregion
839
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
843
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
840
844
  function _typeof(o) {
841
845
  "@babel/helpers - typeof";
842
846
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -847,7 +851,7 @@ function _typeof(o) {
847
851
  }
848
852
 
849
853
  //#endregion
850
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
854
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
851
855
  function toPrimitive(t, r) {
852
856
  if ("object" != _typeof(t) || !t) return t;
853
857
  var e = t[Symbol.toPrimitive];
@@ -860,14 +864,14 @@ function toPrimitive(t, r) {
860
864
  }
861
865
 
862
866
  //#endregion
863
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
867
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
864
868
  function toPropertyKey(t) {
865
869
  var i = toPrimitive(t, "string");
866
870
  return "symbol" == _typeof(i) ? i : i + "";
867
871
  }
868
872
 
869
873
  //#endregion
870
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
874
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
871
875
  function _defineProperty(e, r, t) {
872
876
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
873
877
  value: t,
@@ -959,9 +963,7 @@ let SheetsFilterPanelService = class SheetsFilterPanelService extends Disposable
959
963
  case FilterBy.COLORS:
960
964
  this._setupByColors(this._filterModel, this.col);
961
965
  break;
962
- case FilterBy.CONDITIONS:
963
- this._setupByConditions(this._filterModel, this.col);
964
- break;
966
+ case FilterBy.CONDITIONS: this._setupByConditions(this._filterModel, this.col);
965
967
  }
966
968
  return true;
967
969
  }
@@ -1220,7 +1222,8 @@ let ByValuesModel = _ByValuesModel = class ByValuesModel extends Disposable {
1220
1222
  trailing: true
1221
1223
  }), startWith(void 0)), this._rawFilterItems$]).pipe(map(([searchString, items]) => {
1222
1224
  if (!searchString) return items;
1223
- return searchTree(items, searchString.toLowerCase().split(/\s+/).filter((s) => !!s));
1225
+ const searchKeyWords = searchString.toLowerCase().split(/\s+/).filter((s) => !!s);
1226
+ return searchTree(items, searchKeyWords);
1224
1227
  })), this._manuallyUpdateFilterItems$).pipe(shareReplay({
1225
1228
  bufferSize: 1,
1226
1229
  refCount: true
@@ -1252,7 +1255,8 @@ let ByValuesModel = _ByValuesModel = class ByValuesModel extends Disposable {
1252
1255
  const items = Tools.deepClone(this._filterItems);
1253
1256
  const changedItem = findObjectByKey(items, item.key);
1254
1257
  if (!changedItem) return;
1255
- updateLeafNodesCheckedStatus(changedItem, !areAllLeafNodesChecked(changedItem));
1258
+ const allLeafChecked = areAllLeafNodesChecked(changedItem);
1259
+ updateLeafNodesCheckedStatus(changedItem, !allLeafChecked);
1256
1260
  this._manuallyUpdateFilterItems(items);
1257
1261
  }
1258
1262
  onFilterOnly(itemKeys) {
@@ -1576,7 +1580,7 @@ const menuSchema = { [RibbonDataGroup.ORGANIZATION]: { [SmartToggleSheetsFilterC
1576
1580
  //#endregion
1577
1581
  //#region package.json
1578
1582
  var name = "@univerjs/sheets-filter-ui";
1579
- var version = "1.0.0-rc.0";
1583
+ var version = "1.0.1";
1580
1584
 
1581
1585
  //#endregion
1582
1586
  //#region src/config/config.ts
@@ -1584,6 +1588,21 @@ const SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY = "sheets-filter-ui.config";
1584
1588
  const configSymbol = Symbol(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY);
1585
1589
  const defaultPluginConfig = {};
1586
1590
 
1591
+ //#endregion
1592
+ //#region src/menu/mobile-schema.ts
1593
+ const mobileMenuSchema = { [RibbonDataGroup.ORGANIZATION]: { [SmartToggleSheetsFilterCommand.id]: {
1594
+ order: 2,
1595
+ menuItemFactory: SmartToggleFilterMenuItemFactory,
1596
+ [ClearSheetsFilterCriteriaCommand.id]: {
1597
+ order: 0,
1598
+ menuItemFactory: ClearFilterCriteriaMenuItemFactory
1599
+ },
1600
+ [ReCalcSheetsFilterCommand.id]: {
1601
+ order: 1,
1602
+ menuItemFactory: ReCalcFilterMenuItemFactory
1603
+ }
1604
+ } } };
1605
+
1587
1606
  //#endregion
1588
1607
  //#region src/controllers/mobile-menu.controller.ts
1589
1608
  /**
@@ -1605,7 +1624,7 @@ let SheetsFilterMobileMenuController = class SheetsFilterMobileMenuController ex
1605
1624
  constructor(commandService, menuManagerService) {
1606
1625
  super();
1607
1626
  this.disposeWithMe(commandService.registerCommand(SmartToggleSheetsFilterCommand));
1608
- menuManagerService.mergeMenu(menuSchema);
1627
+ menuManagerService.mergeMenu(mobileMenuSchema);
1609
1628
  }
1610
1629
  };
1611
1630
  SheetsFilterMobileMenuController = __decorate([__decorateParam(0, ICommandService), __decorateParam(1, IMenuManagerService)], SheetsFilterMobileMenuController);
@@ -2401,7 +2420,8 @@ let SheetsFilterPermissionController = class SheetsFilterPermissionController ex
2401
2420
  this.disposeWithMe(this._commandService.beforeCommandExecuted((command) => {
2402
2421
  if (command.id === SmartToggleSheetsFilterCommand.id) {
2403
2422
  var _this$_sheetsFilterSe;
2404
- const target = getSheetCommandTarget(this._injector.get(IUniverInstanceService));
2423
+ const univerInstanceService = this._injector.get(IUniverInstanceService);
2424
+ const target = getSheetCommandTarget(univerInstanceService);
2405
2425
  if (!target) return;
2406
2426
  const { unitId, subUnitId, worksheet } = target;
2407
2427
  const filterRange = (_this$_sheetsFilterSe = this._sheetsFilterService.getFilterModel(unitId, subUnitId)) === null || _this$_sheetsFilterSe === void 0 ? void 0 : _this$_sheetsFilterSe.getRange();
@@ -2866,12 +2886,13 @@ function FilterPanel() {
2866
2886
  }, [filterByModel, commandService]);
2867
2887
  const range = (_filterService$active = useDependency(SheetsFilterService).activeFilterModel) === null || _filterService$active === void 0 ? void 0 : _filterService$active.getRange();
2868
2888
  const colIndex = sheetsFilterPanelService.col;
2889
+ const FilterPanelEmbedPointPart = useComponentsOfPart(SheetsUIPart.FILTER_PANEL_EMBED_POINT);
2869
2890
  return /* @__PURE__ */ jsxs("div", {
2870
2891
  "data-u-comp": "sheets-filter-panel",
2871
2892
  className: "univer-box-border univer-flex univer-max-h-[500px] univer-w-[400px] univer-flex-col univer-rounded-lg univer-bg-gray-0 univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700",
2872
2893
  children: [
2873
2894
  /* @__PURE__ */ jsx(ComponentContainer, {
2874
- components: useComponentsOfPart(SheetsUIPart.FILTER_PANEL_EMBED_POINT),
2895
+ components: FilterPanelEmbedPointPart,
2875
2896
  sharedProps: {
2876
2897
  range,
2877
2898
  colIndex,
package/lib/index.js CHANGED
@@ -579,12 +579,14 @@ function statisticFilterByValueItems(items) {
579
579
  let checked = 0;
580
580
  let unchecked = 0;
581
581
  function traverse(node) {
582
- if (node.leaf) if (node.checked) {
583
- checkedItems.push(node);
584
- checked += node.count;
585
- } else {
586
- uncheckedItems.push(node);
587
- unchecked += node.count;
582
+ if (node.leaf) {
583
+ if (node.checked) {
584
+ checkedItems.push(node);
585
+ checked += node.count;
586
+ } else {
587
+ uncheckedItems.push(node);
588
+ unchecked += node.count;
589
+ }
588
590
  }
589
591
  if (node.children) node.children.forEach(traverse);
590
592
  }
@@ -598,7 +600,7 @@ function statisticFilterByValueItems(items) {
598
600
  }
599
601
 
600
602
  //#endregion
601
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
603
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
602
604
  function __decorateParam(paramIndex, decorator) {
603
605
  return function(target, key) {
604
606
  decorator(target, key, paramIndex);
@@ -606,7 +608,7 @@ function __decorateParam(paramIndex, decorator) {
606
608
  }
607
609
 
608
610
  //#endregion
609
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
611
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
610
612
  function __decorate(decorators, target, key, desc) {
611
613
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
612
614
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -810,8 +812,10 @@ function areAllLeafNodesChecked(node) {
810
812
  return node.children ? node.children.every((child) => areAllLeafNodesChecked(child)) : true;
811
813
  }
812
814
  function updateLeafNodesCheckedStatus(node, status) {
813
- if (node.leaf) if (status !== void 0) node.checked = status;
814
- else node.checked = !node.checked;
815
+ if (node.leaf) {
816
+ if (status !== void 0) node.checked = status;
817
+ else node.checked = !node.checked;
818
+ }
815
819
  if (node.children) node.children.forEach((child) => updateLeafNodesCheckedStatus(child, status));
816
820
  }
817
821
  function searchTree(items, searchKeywords) {
@@ -836,7 +840,7 @@ function searchTree(items, searchKeywords) {
836
840
  }
837
841
 
838
842
  //#endregion
839
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
843
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
840
844
  function _typeof(o) {
841
845
  "@babel/helpers - typeof";
842
846
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -847,7 +851,7 @@ function _typeof(o) {
847
851
  }
848
852
 
849
853
  //#endregion
850
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
854
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
851
855
  function toPrimitive(t, r) {
852
856
  if ("object" != _typeof(t) || !t) return t;
853
857
  var e = t[Symbol.toPrimitive];
@@ -860,14 +864,14 @@ function toPrimitive(t, r) {
860
864
  }
861
865
 
862
866
  //#endregion
863
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
867
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
864
868
  function toPropertyKey(t) {
865
869
  var i = toPrimitive(t, "string");
866
870
  return "symbol" == _typeof(i) ? i : i + "";
867
871
  }
868
872
 
869
873
  //#endregion
870
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
874
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
871
875
  function _defineProperty(e, r, t) {
872
876
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
873
877
  value: t,
@@ -959,9 +963,7 @@ let SheetsFilterPanelService = class SheetsFilterPanelService extends Disposable
959
963
  case FilterBy.COLORS:
960
964
  this._setupByColors(this._filterModel, this.col);
961
965
  break;
962
- case FilterBy.CONDITIONS:
963
- this._setupByConditions(this._filterModel, this.col);
964
- break;
966
+ case FilterBy.CONDITIONS: this._setupByConditions(this._filterModel, this.col);
965
967
  }
966
968
  return true;
967
969
  }
@@ -1220,7 +1222,8 @@ let ByValuesModel = _ByValuesModel = class ByValuesModel extends Disposable {
1220
1222
  trailing: true
1221
1223
  }), startWith(void 0)), this._rawFilterItems$]).pipe(map(([searchString, items]) => {
1222
1224
  if (!searchString) return items;
1223
- return searchTree(items, searchString.toLowerCase().split(/\s+/).filter((s) => !!s));
1225
+ const searchKeyWords = searchString.toLowerCase().split(/\s+/).filter((s) => !!s);
1226
+ return searchTree(items, searchKeyWords);
1224
1227
  })), this._manuallyUpdateFilterItems$).pipe(shareReplay({
1225
1228
  bufferSize: 1,
1226
1229
  refCount: true
@@ -1252,7 +1255,8 @@ let ByValuesModel = _ByValuesModel = class ByValuesModel extends Disposable {
1252
1255
  const items = Tools.deepClone(this._filterItems);
1253
1256
  const changedItem = findObjectByKey(items, item.key);
1254
1257
  if (!changedItem) return;
1255
- updateLeafNodesCheckedStatus(changedItem, !areAllLeafNodesChecked(changedItem));
1258
+ const allLeafChecked = areAllLeafNodesChecked(changedItem);
1259
+ updateLeafNodesCheckedStatus(changedItem, !allLeafChecked);
1256
1260
  this._manuallyUpdateFilterItems(items);
1257
1261
  }
1258
1262
  onFilterOnly(itemKeys) {
@@ -1576,7 +1580,7 @@ const menuSchema = { [RibbonDataGroup.ORGANIZATION]: { [SmartToggleSheetsFilterC
1576
1580
  //#endregion
1577
1581
  //#region package.json
1578
1582
  var name = "@univerjs/sheets-filter-ui";
1579
- var version = "1.0.0-rc.0";
1583
+ var version = "1.0.1";
1580
1584
 
1581
1585
  //#endregion
1582
1586
  //#region src/config/config.ts
@@ -1584,6 +1588,21 @@ const SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY = "sheets-filter-ui.config";
1584
1588
  const configSymbol = Symbol(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY);
1585
1589
  const defaultPluginConfig = {};
1586
1590
 
1591
+ //#endregion
1592
+ //#region src/menu/mobile-schema.ts
1593
+ const mobileMenuSchema = { [RibbonDataGroup.ORGANIZATION]: { [SmartToggleSheetsFilterCommand.id]: {
1594
+ order: 2,
1595
+ menuItemFactory: SmartToggleFilterMenuItemFactory,
1596
+ [ClearSheetsFilterCriteriaCommand.id]: {
1597
+ order: 0,
1598
+ menuItemFactory: ClearFilterCriteriaMenuItemFactory
1599
+ },
1600
+ [ReCalcSheetsFilterCommand.id]: {
1601
+ order: 1,
1602
+ menuItemFactory: ReCalcFilterMenuItemFactory
1603
+ }
1604
+ } } };
1605
+
1587
1606
  //#endregion
1588
1607
  //#region src/controllers/mobile-menu.controller.ts
1589
1608
  /**
@@ -1605,7 +1624,7 @@ let SheetsFilterMobileMenuController = class SheetsFilterMobileMenuController ex
1605
1624
  constructor(commandService, menuManagerService) {
1606
1625
  super();
1607
1626
  this.disposeWithMe(commandService.registerCommand(SmartToggleSheetsFilterCommand));
1608
- menuManagerService.mergeMenu(menuSchema);
1627
+ menuManagerService.mergeMenu(mobileMenuSchema);
1609
1628
  }
1610
1629
  };
1611
1630
  SheetsFilterMobileMenuController = __decorate([__decorateParam(0, ICommandService), __decorateParam(1, IMenuManagerService)], SheetsFilterMobileMenuController);
@@ -2401,7 +2420,8 @@ let SheetsFilterPermissionController = class SheetsFilterPermissionController ex
2401
2420
  this.disposeWithMe(this._commandService.beforeCommandExecuted((command) => {
2402
2421
  if (command.id === SmartToggleSheetsFilterCommand.id) {
2403
2422
  var _this$_sheetsFilterSe;
2404
- const target = getSheetCommandTarget(this._injector.get(IUniverInstanceService));
2423
+ const univerInstanceService = this._injector.get(IUniverInstanceService);
2424
+ const target = getSheetCommandTarget(univerInstanceService);
2405
2425
  if (!target) return;
2406
2426
  const { unitId, subUnitId, worksheet } = target;
2407
2427
  const filterRange = (_this$_sheetsFilterSe = this._sheetsFilterService.getFilterModel(unitId, subUnitId)) === null || _this$_sheetsFilterSe === void 0 ? void 0 : _this$_sheetsFilterSe.getRange();
@@ -2866,12 +2886,13 @@ function FilterPanel() {
2866
2886
  }, [filterByModel, commandService]);
2867
2887
  const range = (_filterService$active = useDependency(SheetsFilterService).activeFilterModel) === null || _filterService$active === void 0 ? void 0 : _filterService$active.getRange();
2868
2888
  const colIndex = sheetsFilterPanelService.col;
2889
+ const FilterPanelEmbedPointPart = useComponentsOfPart(SheetsUIPart.FILTER_PANEL_EMBED_POINT);
2869
2890
  return /* @__PURE__ */ jsxs("div", {
2870
2891
  "data-u-comp": "sheets-filter-panel",
2871
2892
  className: "univer-box-border univer-flex univer-max-h-[500px] univer-w-[400px] univer-flex-col univer-rounded-lg univer-bg-gray-0 univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700",
2872
2893
  children: [
2873
2894
  /* @__PURE__ */ jsx(ComponentContainer, {
2874
- components: useComponentsOfPart(SheetsUIPart.FILTER_PANEL_EMBED_POINT),
2895
+ components: FilterPanelEmbedPointPart,
2875
2896
  sharedProps: {
2876
2897
  range,
2877
2898
  colIndex,
@@ -13,11 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { RxDisposable } from '@univerjs/core';
17
- import { IRenderManagerService } from '@univerjs/engine-render';
18
- import { SheetsRenderService } from '@univerjs/sheets-ui';
19
- export declare class SheetsFilterUIMobileController extends RxDisposable {
20
- private readonly _renderManagerService;
21
- private _sheetsRenderService;
22
- constructor(_renderManagerService: IRenderManagerService, _sheetsRenderService: SheetsRenderService);
23
- }
16
+ import type { MenuSchemaType } from '@univerjs/ui';
17
+ export declare const mobileMenuSchema: MenuSchemaType;
package/lib/umd/index.js CHANGED
@@ -1,16 +1,16 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/sheets-filter"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("rxjs"),require("react"),require("@univerjs/design"),require("react/jsx-runtime"),require("@univerjs/rpc")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets-filter`,`@univerjs/sheets-ui`,`@univerjs/ui`,`@univerjs/engine-render`,`@univerjs/sheets`,`rxjs`,`react`,`@univerjs/design`,`react/jsx-runtime`,`@univerjs/rpc`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsFilterUi={},e.UniverCore,e.UniverSheetsFilter,e.UniverSheetsUi,e.UniverUi,e.UniverEngineRender,e.UniverSheets,e.rxjs,e.React,e.UniverDesign,e.React,e.UniverRpc))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let f;(function(e){let r=e.NONE={label:`sheets-filter-ui.conditions.none`,operator:`none`,order:1,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.NONE]: should not have initial form params!`)},testMappingParams:e=>e.operator1===`none`,mapToFilterColumn:()=>null,testMappingFilterColumn:e=>!e.customFilters&&!e.filters&&{}},i=e.ALL_CONDITIONS=[r,e.EMPTY={label:`sheets-filter-ui.conditions.empty`,operator:`empty`,order:1,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.EMPTY]: should not have initial form params!`)},testMappingParams:({operator1:e})=>e===`empty`,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:``}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.val!==``||n.operator!==void 0?!1:{operator1:`empty`}}},e.NOT_EMPTY={label:`sheets-filter-ui.conditions.not-empty`,operator:`notEmpty`,order:1,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.NOT_EMPTY]: should not have initial form params!`)},testMappingParams:({operator1:e})=>e===`notEmpty`,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:``,operator:n.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.val!==` `||r.operator!==n.CustomFilterOperator.NOT_EQUALS?!1:{operator1:`notEmpty`}}},e.TEXT_CONTAINS={label:`sheets-filter-ui.conditions.text-contains`,operator:`contains`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`contains`,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===`contains`},mapToFilterColumn:e=>{let{val1:t}=e;return t===``?null:{customFilters:{customFilters:[{val:`*${t}*`}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.startsWith(`*`)&&r.endsWith(`*`)?{operator1:`contains`,val1:r.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:`sheets-filter-ui.conditions.does-not-contain`,operator:`doesNotContain`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`doesNotContain`,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`*${e.val1}*`,operator:n.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:e=>{let[t]=p(e);return t===`doesNotContain`},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0],i=r.val.toString();return r.operator===n.CustomFilterOperator.NOT_EQUALS&&i.startsWith(`*`)&&i.endsWith(`*`)?{operator1:`doesNotContain`,val1:i.slice(1,-1)}:!1}},e.STARTS_WITH={label:`sheets-filter-ui.conditions.starts-with`,operator:`startsWith`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`startsWith`,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`${e.val1}*`}]}}),testMappingParams:e=>{let[t]=p(e);return t===`startsWith`},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.endsWith(`*`)&&!r.startsWith(`*`)?{operator1:`startsWith`,val1:r.slice(0,-1)}:!1}},e.ENDS_WITH={label:`sheets-filter-ui.conditions.ends-with`,operator:`endsWith`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`endsWith`,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`*${e.val1}`}]}}),testMappingParams:e=>{let[t]=p(e);return t===`endsWith`},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.startsWith(`*`)&&!r.endsWith(`*`)?{operator1:`endsWith`,val1:r.slice(1)}:!1}},e.EQUALS={label:`sheets-filter-ui.conditions.equals`,operator:`equals`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`equals`,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===`equals`},mapToFilterColumn:e=>{let{val1:t}=e;return t===``?null:{customFilters:{customFilters:[{val:t}]}}},testMappingFilterColumn:e=>{var t,n;return((t=e.filters)==null||(t=t.filters)==null?void 0:t.length)===1?{operator1:`equals`,val1:``}:((n=e.customFilters)==null?void 0:n.customFilters.length)===1&&!e.customFilters.customFilters[0].operator&&{operator1:`equals`,val1:e.customFilters.customFilters[0].val.toString()}}},e.GREATER_THAN={label:`sheets-filter-ui.conditions.greater-than`,operator:n.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.GREATER_THAN,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.GREATER_THAN},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.GREATER_THAN&&{operator1:n.CustomFilterOperator.GREATER_THAN,val1:r.val.toString()}}},e.GREATER_THAN_OR_EQUAL={label:`sheets-filter-ui.conditions.greater-than-or-equal`,operator:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&{operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:r.val.toString()}}},e.LESS_THAN={label:`sheets-filter-ui.conditions.less-than`,operator:n.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.LESS_THAN,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.LESS_THAN},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.LESS_THAN}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.LESS_THAN&&{operator1:n.CustomFilterOperator.LESS_THAN,val1:r.val.toString()}}},e.LESS_THAN_OR_EQUAL={label:`sheets-filter-ui.conditions.less-than-or-equal`,operator:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.LESS_THAN_OR_EQUAL&&{operator1:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:r.val.toString()}}},e.EQUAL={label:`sheets-filter-ui.conditions.equal`,operator:n.CustomFilterOperator.EQUAL,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.EQUAL,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.EQUAL&&{operator1:n.CustomFilterOperator.EQUAL,val1:r.val.toString()}}},e.NOT_EQUAL={label:`sheets-filter-ui.conditions.not-equal`,operator:n.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.NOT_EQUALS,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.NOT_EQUALS&&{operator1:n.CustomFilterOperator.NOT_EQUALS,val1:r.val.toString()}}},e.BETWEEN={label:`sheets-filter-ui.conditions.between`,operator:`between`,order:1,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:``,operator2:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:``}),testMappingParams:e=>{let{and:t,operator1:r,operator2:i}=e;if(!t)return!1;let a=[r,i];return a.includes(n.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&a.includes(n.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:e=>{let{val1:r,val2:i,operator1:a}=e,o=a===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:t.BooleanNumber.TRUE,customFilters:[{val:o?r:i,operator:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:o?i:r,operator:n.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let[r,i]=e.customFilters.customFilters;return r.operator===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&i.operator===n.CustomFilterOperator.LESS_THAN_OR_EQUAL&&e.customFilters.and?{and:!0,operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:r.val.toString(),operator2:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:i.val.toString()}:i.operator===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&r.operator===n.CustomFilterOperator.LESS_THAN_OR_EQUAL&&e.customFilters.and?{and:!0,operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:i.val.toString(),operator2:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:r.val.toLocaleString()}:!1}},e.NOT_BETWEEN={label:`sheets-filter-ui.conditions.not-between`,operator:`notBetween`,order:1,numOfParameters:2,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.LESS_THAN,val1:``,operator2:n.CustomFilterOperator.GREATER_THAN,val2:``}),testMappingParams:e=>{let{and:t,operator1:r,operator2:i}=e;if(t)return!1;let a=[r,i];return a.includes(n.CustomFilterOperator.GREATER_THAN)&&a.includes(n.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:e=>{let{val1:t,val2:r,operator1:i}=e,a=i===n.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:a?t:r,operator:n.CustomFilterOperator.GREATER_THAN},{val:a?r:t,operator:n.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let[r,i]=e.customFilters.customFilters;return r.operator===n.CustomFilterOperator.LESS_THAN&&i.operator===n.CustomFilterOperator.GREATER_THAN&&!e.customFilters.and?{operator1:n.CustomFilterOperator.LESS_THAN,val1:r.val.toString(),operator2:n.CustomFilterOperator.GREATER_THAN,val2:i.val.toString()}:i.operator===n.CustomFilterOperator.LESS_THAN&&r.operator===n.CustomFilterOperator.GREATER_THAN&&!e.customFilters.and&&{operator1:n.CustomFilterOperator.GREATER_THAN,val1:i.val.toString(),operator2:n.CustomFilterOperator.LESS_THAN,val2:r.val.toLocaleString()}}},e.CUSTOM={label:`sheets-filter-ui.conditions.custom`,operator:`custom`,order:1,numOfParameters:2,getDefaultFormParams:()=>({operator1:`none`,val1:``,operator2:`none`,val2:``}),testMappingParams:()=>!0,mapToFilterColumn:e=>{let{and:n,val1:a,val2:o,operator1:s,operator2:c}=e;function l(e,t){for(let n of i)if(n.operator===e)return n.mapToFilterColumn({val1:t,operator1:e})}let u=!s||s===f.NONE.operator,d=!c||c===f.NONE.operator;if(u&&d)return r.mapToFilterColumn({});if(u)return l(c,o);if(d)return l(s,a);let p=l(s,a),m=l(c,o),h={customFilters:[p.customFilters.customFilters[0],m.customFilters.customFilters[0]]};return n&&(h.and=t.BooleanNumber.TRUE),{customFilters:h}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let n=e.customFilters.customFilters.map(e=>l({customFilters:{customFilters:[e]}})),r={operator1:n[0][0].operator,val1:n[0][1].val1,operator2:n[1][0].operator,val2:n[1][1].val1};return e.customFilters.and&&(r.and=!0),r}}];function a(e){let t=i.find(t=>t.operator===e);if(!t)throw Error(`[SheetsFilter]: no condition item found for operator: ${e}`);return t}e.getItemByOperator=a;function o(e,t){for(let n of i.filter(e=>e.numOfParameters===t))if(n.numOfParameters!==0&&n.testMappingParams(e))return n;for(let t of i)if(t.testMappingParams(e))return t;throw Error(`[SheetsFilter]: no condition item can be mapped from the filter map params!`)}e.testMappingParams=o;function s(e){let t=i.find(t=>t.operator===e);return(t==null?void 0:t.numOfParameters)===0?{operator1:t.operator}:t.getDefaultFormParams()}e.getInitialFormParams=s;function c(e,t){return e.mapToFilterColumn(t)}e.mapToFilterColumn=c;function l(e){if(!e)return[r,{}];for(let t of i){let n=t.testMappingFilterColumn(e);if(n)return[t,n]}return[r,{}]}e.testMappingFilterColumn=l})(f||={});function p(e){let{operator1:t,operator2:n,val1:r,val2:i}=e;if(t&&n)throw Error(`Both operator1 and operator2 are set!`);if(!t&&!n)throw Error(`Neither operator1 and operator2 and both not set!`);return t?[t,r]:[n,i]}function m(e){let t=[],n=[],r=0,i=0;function a(e){e.leaf&&(e.checked?(t.push(e),r+=e.count):(n.push(e),i+=e.count)),e.children&&e.children.forEach(a)}return e.forEach(a),{checkedItems:t,uncheckedItems:n,checked:r,unchecked:i}}function h(e,t){return function(n,r){t(n,r,e)}}function g(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let _=`sheets-filter.generate-filter-values.service`,v=(0,t.createIdentifier)(_),y=class extends t.Disposable{constructor(e,t,n){super(),this._localeService=e,this._univerInstanceService=t,this._logService=n}async getFilterValues(e){var t;let{unitId:n,subUnitId:r,filteredOutRowsByOtherColumns:i,filterColumn:a,filters:o,blankChecked:s,iterateRange:c,alreadyChecked:l}=e,u=this._univerInstanceService.getUnit(n),d=(t=this._univerInstanceService.getUnit(n))==null?void 0:t.getSheetBySheetId(r);return!u||!d?[]:(this._logService.debug(`[SheetsGenerateFilterValuesService]`,`getFilterValues for`,{unitId:n,subUnitId:r}),b(o,this._localeService,c,d,new Set(i),a,new Set(l.map(String)),s,u.getStyles()))}};y=g([h(0,(0,t.Inject)(t.LocaleService)),h(1,t.IUniverInstanceService),h(2,t.ILogService)],y);function b(e,r,i,a,o,s,c,l,u){var d;let f=new Map,p=new Map,m=`empty`,h=!e&&((s==null?void 0:s.filterBy)===n.FilterBy.COLORS||(s==null?void 0:s.filterBy)===n.FilterBy.CONDITIONS)&&((d=s.filteredOutRows)==null?void 0:d.size),g=0;for(let e of a.iterateByColumn(i,!1,!1)){let{row:n,rowSpan:i=1}=e,s=0;for(;s<i;){var _,v,y;let d=n+s;if(o.has(d)){s++;continue}let m=e!=null&&e.value?(0,t.extractPureTextFromCell)(e.value):``;if(!m){g+=1,s+=i;continue}let x=(_=e.value)!=null&&_.v&&!e.value.p?(v=u.get((y=e.value)==null?void 0:y.s))==null||(v=v.n)==null?void 0:v.pattern:``,E=x&&t.numfmt.getFormatInfo(x).isDate,D=!1;if(E){let{year:e,month:n,day:r}=t.numfmt.getFormatDateInfo(x);D=e||n||r}if(x&&E&&D){var b,S,C;let n=(b=a.getCellRaw(e.row,e.col))==null?void 0:b.v;if(!n){s++;continue}let[i,o,u]=t.numfmt.format(`yyyy-mm-dd`,Number(n)).split(`-`).map(Number),d=f.get(`${i}`);d||(d={title:`${i}`,key:`${i}`,children:[],count:0,leaf:!1,checked:!1},f.set(`${i}`,d),p.set(`${i}`,[`${i}`]));let g=(S=d.children)==null?void 0:S.find(e=>e.key===`${i}-${o}`);if(!g){var w;g={title:r.t(`sheets-filter-ui.date.${o}`),key:`${i}-${o}`,children:[],count:0,leaf:!1,checked:!1},(w=d.children)==null||w.push(g),p.set(`${i}-${o}`,[`${i}`,`${i}-${o}`])}let _=g==null||(C=g.children)==null?void 0:C.find(e=>e.key===`${i}-${o}-${u}`);if(_)_.originValues.add(m),_.count++,g.count++,d.count++;else{var T;(T=g.children)==null||T.push({title:`${u}`,key:`${i}-${o}-${u}`,count:1,originValues:new Set([m]),leaf:!0,checked:h?!1:c.size?c.has(m):!l}),g.count++,d.count++,p.set(`${i}-${o}-${u}`,[`${i}`,`${i}-${o}`,`${i}-${o}-${u}`])}}else{let e=m,t=f.get(e);t?t.count++:(t={title:m,leaf:!0,checked:h?!1:c.size?c.has(m):!l,key:e,count:1},f.set(e,t),p.set(e,[e]))}s++}}let E=h?!1:!e||l;if(g>0){let e={title:r.t(`sheets-filter-ui.panel.empty`),count:g,leaf:!0,checked:E,key:m};f.set(`empty`,e),p.set(`empty`,[m])}return{filterTreeItems:x(Array.from(f.values())),filterTreeMapCache:p}}function x(e){return Array.from(e).sort((e,t)=>e.children&&!t.children?-1:!e.children&&t.children?1:S(e.title,t.title)).map(e=>(e.children&&e.children.sort((e,t)=>Number.parseInt(e.key.split(`-`)[1],10)-Number.parseInt(t.key.split(`-`)[1],10)).forEach(e=>{e.children&&e.children.sort((e,t)=>Number.parseInt(e.key.split(`-`)[2],10)-Number.parseInt(t.key.split(`-`)[2],10))}),e))}function S(e,n){let r=(0,t.isNumeric)(e),i=(0,t.isNumeric)(n);return r&&i?Number.parseFloat(e)-Number.parseFloat(n):r&&!i?-1:!r&&i?1:e.localeCompare(n)}function C(e,t){for(let n of e){if(n.key===t)return n;if(n.children){let e=C(n.children,t);if(e)return e}}return null}function w(e){return e.leaf?e.checked:!e.children||e.children.every(e=>w(e))}function T(e,t){e.leaf&&(t===void 0?e.checked=!e.checked:e.checked=t),e.children&&e.children.forEach(e=>T(e,t))}function E(e,t){let n=[];return e.forEach(e=>{let r=e.originValues?t.some(t=>Array.from(e.originValues).some(e=>e.toLowerCase().includes(t.toLowerCase()))):!1,i=!r&&t.some(t=>e.title.toLowerCase().includes(t.toLowerCase()));if(r||i)n.push({...e});else if(e.children){let r=E(e.children,t);if(r.length>0){let t=r.reduce((e,t)=>e+t.count,0);n.push({...e,count:t,children:r})}}}),n}function D(e){"@babel/helpers - typeof";return D=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},D(e)}function O(e,t){if(D(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(D(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ee(e){var t=O(e,`string`);return D(t)==`symbol`?t:t+``}function k(e,t,n){return(t=ee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var te,ne,re;let A=(0,t.createIdentifier)(`sheets-filter-ui.sheets-filter-panel.service`),j=class extends t.Disposable{get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(e){this._filterByModel=e,this._filterByModel$.next(e)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}constructor(e,t){super(),this._injector=e,this._refRangeService=t,k(this,`_filterBy$`,new s.BehaviorSubject(n.FilterBy.VALUES)),k(this,`filterBy$`,this._filterBy$.asObservable()),k(this,`_filterByModel$`,new s.ReplaySubject(1)),k(this,`filterByModel$`,this._filterByModel$.asObservable()),k(this,`_filterByModel`,null),k(this,`_hasCriteria$`,new s.BehaviorSubject(!1)),k(this,`hasCriteria$`,this._hasCriteria$.asObservable()),k(this,`_filterModel`,null),k(this,`_col$`,new s.BehaviorSubject(-1)),k(this,`col$`,this._col$.asObservable()),k(this,`_filterHeaderListener`,null)}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(e,t){this.terminate(),this._filterModel=e,this._col$.next(t);let n=e.getFilterColumn(t);if(n){let r=n.getColumnData();if(r.customFilters){this._hasCriteria$.next(!0),this._setupByConditions(e,t);return}if(r.colorFilters){this._hasCriteria$.next(!0),this._setupByColors(e,t);return}if(r.filters){this._hasCriteria$.next(!0),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t)}changeFilterBy(e){if(!this._filterModel||this.col===-1)return!1;switch(e){case n.FilterBy.VALUES:this._setupByValues(this._filterModel,this.col);break;case n.FilterBy.COLORS:this._setupByColors(this._filterModel,this.col);break;case n.FilterBy.CONDITIONS:this._setupByConditions(this._filterModel,this.col);break}return!0}terminate(){return this._filterModel=null,this._col$.next(-1),this._disposeFilterHeaderChangeListener(),!0}_disposeFilterHeaderChangeListener(){var e;(e=this._filterHeaderListener)==null||e.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(e,t){this._disposeFilterHeaderChangeListener();let n=e.unitId,r=e.subUnitId,i=e.getRange(),a={startColumn:t,startRow:i.startRow,endRow:i.startRow,endColumn:t};this._filterHeaderListener=this._refRangeService.watchRange(n,r,a,(e,t)=>{if(!t)this.terminate();else{let n=t.startColumn-e.startColumn;n!==0&&this._filterByModel.deltaCol(n)}})}async _setupByValues(e,t){this._disposePreviousModel();let r=e.getRange();if(r.startRow===r.endRow)return!1;let i=await ie.fromFilterColumn(this._injector,e,t);return this.filterByModel=i,this._filterBy$.next(n.FilterBy.VALUES),this._listenToFilterHeaderChange(e,t),!0}async _setupByColors(e,t){this._disposePreviousModel();let r=e.getRange();if(r.startRow===r.endRow)return!1;let i=await ae.fromFilterColumn(this._injector,e,t);return this.filterByModel=i,this._filterBy$.next(n.FilterBy.COLORS),this._listenToFilterHeaderChange(e,t),!0}_setupByConditions(e,t){this._disposePreviousModel();let r=e.getRange();if(r.startRow===r.endRow)return!1;let i=M.fromFilterColumn(this._injector,e,t,e.getFilterColumn(t));return this.filterByModel=i,this._filterBy$.next(n.FilterBy.CONDITIONS),this._listenToFilterHeaderChange(e,t),!0}_disposePreviousModel(){var e;(e=this._filterByModel)==null||e.dispose(),this.filterByModel=null}};j=g([h(0,(0,t.Inject)(t.Injector)),h(1,(0,t.Inject)(o.RefRangeService))],j);let M=te=class extends t.Disposable{static fromFilterColumn(e,t,n,r){let[i,a]=f.testMappingFilterColumn(r==null?void 0:r.getColumnData());return e.createInstance(te,t,n,i,a)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,k(this,`canApply$`,(0,s.of)(!0)),k(this,`_conditionItem$`,void 0),k(this,`conditionItem$`,void 0),k(this,`_filterConditionFormParams$`,void 0),k(this,`filterConditionFormParams$`,void 0),this._conditionItem$=new s.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new s.BehaviorSubject(r),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;let e=f.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:e})}onPrimaryConditionChange(e){let t=f.ALL_CONDITIONS.find(t=>t.operator===e);if(!t)throw Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);this._conditionItem$.next(t),this._filterConditionFormParams$.next(f.getInitialFormParams(e))}onConditionFormChange(e){let t={...this.filterConditionFormParams,...e};if(t.and!==!0&&delete t.and,e.and!==void 0||e.operator1!==void 0||e.operator2!==void 0){let e=f.testMappingParams(t,this.conditionItem.numOfParameters);this._conditionItem$.next(e)}this._filterConditionFormParams$.next(t)}};M=te=g([h(4,t.ICommandService)],M);let ie=ne=class extends t.Disposable{static async fromFilterColumn(e,n,r){let i=e.get(t.IUniverInstanceService),a=e.get(t.LocaleService),o=e.get(v,t.Quantity.OPTIONAL),{unitId:s,subUnitId:c}=n,l=i.getUnit(s,t.UniverInstanceType.UNIVER_SHEET);if(!l)throw Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${s}!`);let u=l==null?void 0:l.getSheetBySheetId(c);if(!u)throw Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${s} and subUnitId: ${c}!`);let d=n.getRange(),f=r,p=n.getFilterColumn(r),m=p==null?void 0:p.getColumnData().filters,h=new Set(m==null?void 0:m.filters),g=!!(m&&m.blank),_=n.getFilteredOutRowsExceptCol(r),y={...d,startRow:d.startRow+1,startColumn:f,endColumn:f},x,S;if(o){let e=await o.getFilterValues({unitId:s,subUnitId:c,filteredOutRowsByOtherColumns:Array.from(_),filterColumn:p,filters:!!m,blankChecked:g,iterateRange:y,alreadyChecked:Array.from(h)});x=e.filterTreeItems,S=e.filterTreeMapCache}else{let e=b(!!m,a,y,u,_,p,h,g,l.getStyles());x=e.filterTreeItems,S=e.filterTreeMapCache}return e.createInstance(ne,n,r,x,S)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}get treeMapCache(){return this._treeMapCache}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,k(this,`_rawFilterItems$`,void 0),k(this,`rawFilterItems$`,void 0),k(this,`filterItems$`,void 0),k(this,`_filterItems`,[]),k(this,`_treeMapCache`,void 0),k(this,`canApply$`,void 0),k(this,`_manuallyUpdateFilterItems$`,void 0),k(this,`_searchString$`,void 0),k(this,`searchString$`,void 0),this._treeMapCache=r,this._searchString$=new s.BehaviorSubject(``),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new s.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new s.Subject,this.filterItems$=(0,s.merge)((0,s.combineLatest)([this._searchString$.pipe((0,s.throttleTime)(500,void 0,{leading:!0,trailing:!0}),(0,s.startWith)(void 0)),this._rawFilterItems$]).pipe((0,s.map)(([e,t])=>e?E(t,e.toLowerCase().split(/\s+/).filter(e=>!!e)):t)),this._manuallyUpdateFilterItems$).pipe((0,s.shareReplay)({bufferSize:1,refCount:!0})),this.canApply$=this.filterItems$.pipe((0,s.map)(e=>m(e).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(e=>this._filterItems=e))}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(e){this.col+=e}setSearchString(e){this._searchString$.next(e)}onCheckAllToggled(e){let n=t.Tools.deepClone(this._filterItems);n.forEach(t=>T(t,e)),this._manuallyUpdateFilterItems(n)}onFilterCheckToggled(e){let n=t.Tools.deepClone(this._filterItems),r=C(n,e.key);r&&(T(r,!w(r)),this._manuallyUpdateFilterItems(n))}onFilterOnly(e){let n=t.Tools.deepClone(this._filterItems);n.forEach(e=>T(e,!1)),e.forEach(e=>{let t=C(n,e);t&&T(t,!0)}),this._manuallyUpdateFilterItems(n)}_manuallyUpdateFilterItems(e){this._manuallyUpdateFilterItems$.next(e)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;let e=m(this._filterItems),{checked:t,checkedItems:r}=e,i=this.rawFilterItems,a=0;for(let e of i)a+=e.count;let o=t===0,s=e.checked===a,c={colId:this.col};if(o)throw Error(`[ByValuesModel]: no checked items!`);if(s)return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{c.filters={};let e=r.filter(e=>e.key!==`empty`);e.length>0&&(c.filters={filters:e.flatMap(e=>e.originValues?Array.from(e.originValues):[e.title])}),e.length!==r.length&&(c.filters.blank=!0)}return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:c})}};ie=ne=g([h(4,t.ICommandService)],ie);let ae=re=class extends t.Disposable{static async fromFilterColumn(e,n,r){var i;let o=e.get(t.IUniverInstanceService),{unitId:s,subUnitId:c}=n,l=o.getUnit(s,t.UniverInstanceType.UNIVER_SHEET);if(!l)throw Error(`[ByColorsModel]: Workbook not found for filter model with unitId: ${s}!`);let u=l==null?void 0:l.getSheetBySheetId(c);if(!u)throw Error(`[ByColorsModel]: Worksheet not found for filter model with unitId: ${s} and subUnitId: ${c}!`);let d=n.getRange(),f=r,p=(i=n.getFilterColumn(r))==null?void 0:i.getColumnData().colorFilters,m=n.getFilteredOutRowsExceptCol(r),h={...d,startRow:d.startRow+1,startColumn:f,endColumn:f},g=new Map,_=new Set((p==null?void 0:p.cellFillColors)??[]),v=new Map,y=new Set((p==null?void 0:p.cellTextColors)??[]);for(let e of u.iterateByColumn(h,!1,!0)){let{row:n,col:r,value:i}=e;if(m.has(n))continue;let o=u.getComposedCellStyleByCellData(n,r,i);if(o.bg&&o.bg.rgb){let e=new t.ColorKit(o.bg.rgb).toRgbString();g.has(e)||g.set(e,{color:e,checked:_.has(e)})}else g.set(`default-fill-color`,{color:null,checked:_.has(null)});if(o.cl&&o.cl.rgb){let e=new t.ColorKit(o.cl.rgb).toRgbString();v.has(e)||v.set(e,{color:e,checked:y.has(e)})}else v.set(`default-font-color`,{color:a.COLOR_BLACK_RGB,checked:y.has(a.COLOR_BLACK_RGB)})}return e.createInstance(re,n,r,g,v)}get cellFillColors(){return this._cellFillColors$.getValue()}get cellTextColors(){return this._cellTextColors$.getValue()}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,k(this,`canApply$`,(0,s.of)(!0)),k(this,`_cellFillColors$`,void 0),k(this,`cellFillColors$`,void 0),k(this,`_cellTextColors$`,void 0),k(this,`cellTextColors$`,void 0),this._cellFillColors$=new s.BehaviorSubject(Array.from(n.values())),this.cellFillColors$=this._cellFillColors$.asObservable(),this._cellTextColors$=new s.BehaviorSubject(Array.from(r.values())),this.cellTextColors$=this._cellTextColors$.asObservable()}dispose(){super.dispose(),this._cellFillColors$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}onFilterCheckToggled(e,t=!0){let n=t?this.cellFillColors:this.cellTextColors,r=[],i=!1;for(let t=0;t<n.length;t++){let a=n[t];if(a.color===e.color){i=!0,r.push({color:a.color,checked:!a.checked});continue}r.push({color:a.color,checked:a.checked})}i&&(this._resetColorsCheckedStatus(!t),t?this._cellFillColors$.next([...r]):this._cellTextColors$.next([...r]))}_resetColorsCheckedStatus(e=!0){let t=e?this.cellFillColors:this.cellTextColors,n=[];for(let e=0;e<t.length;e++)n.push({color:t[e].color,checked:!1});e?this._cellFillColors$.next([...n]):this._cellTextColors$.next([...n])}async apply(){if(this._disposed)return!1;let e=this.cellFillColors.filter(e=>e.checked).map(e=>e.color),t=this.cellTextColors.filter(e=>e.checked).map(e=>e.color);if(e.length===0&&t.length===0)return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});let r={colId:this.col};return e.length>0?r.colorFilters={cellFillColors:e}:t.length>0&&(r.colorFilters={cellTextColors:t}),this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:r})}};ae=re=g([h(4,t.ICommandService)],ae);let oe=`FILTER_PANEL_OPENED`,N={id:`sheet.operation.open-filter-panel`,type:t.CommandType.OPERATION,handler:(e,i)=>{let a=e.get(t.IContextService),o=e.get(n.SheetsFilterService),s=e.get(A),c=e.get(t.ICommandService),l=e.has(r.IEditorBridgeService)?e.get(r.IEditorBridgeService):null;l!=null&&l.isVisible().visible&&c.syncExecuteCommand(r.SetCellEditVisibleOperation.id,{visible:!1});let{unitId:u,subUnitId:d,col:f}=i,p=o.getFilterModel(u,d);return p?(s.setupCol(p,f),a.getContextValue(`FILTER_PANEL_OPENED`)||a.setContextValue(oe,!0),!0):!1}},P={id:`sheet.operation.close-filter-panel`,type:t.CommandType.OPERATION,handler:e=>{let n=e.get(t.IContextService),r=e.get(A),a=e.get(i.ILayoutService,t.Quantity.OPTIONAL);return n.getContextValue(`FILTER_PANEL_OPENED`)?(n.setContextValue(oe,!1),a==null||a.focus(),r.terminate()):!1}},F={id:`sheet.operation.apply-filter`,type:t.CommandType.OPERATION,handler:(e,t)=>{let{filterBy:n}=t;return e.get(A).changeFilterBy(n)}};function se(e){let a=e.get(n.SheetsFilterService);return{id:n.SmartToggleSheetsFilterCommand.id,type:i.MenuItemType.BUTTON_SELECTOR,icon:`FilterIcon`,tooltip:`sheets-filter-ui.toolbar.smart-toggle-filter-tooltip`,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),activated$:a.activeFilterModel$.pipe((0,s.map)(e=>!!e)),disabled$:(0,r.getObservableWithExclusiveRange$)(e,(0,r.getCurrentRangeDisable$)(e,{worksheetTypes:[o.WorksheetFilterPermission,o.WorksheetViewPermission],rangeTypes:[o.RangeProtectionPermissionViewPoint]}))}}function ce(e){let r=e.get(n.SheetsFilterService);return{id:n.ClearSheetsFilterCriteriaCommand.id,type:i.MenuItemType.BUTTON,title:`sheets-filter-ui.toolbar.clear-filter-criteria`,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:r.activeFilterModel$.pipe((0,s.switchMap)(e=>(e==null?void 0:e.hasCriteria$.pipe((0,s.map)(e=>!e)))??(0,s.of)(!0)))}}function le(e){let r=e.get(n.SheetsFilterService);return{id:n.ReCalcSheetsFilterCommand.id,type:i.MenuItemType.BUTTON,title:`sheets-filter-ui.toolbar.re-calc-filter-conditions`,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:r.activeFilterModel$.pipe((0,s.switchMap)(e=>(e==null?void 0:e.hasCriteria$.pipe((0,s.map)(e=>!e)))??(0,s.of)(!0)))}}let ue={[i.RibbonDataGroup.ORGANIZATION]:{[n.SmartToggleSheetsFilterCommand.id]:{order:2,gridLayout:{row:1,column:2},menuItemFactory:se,[n.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:ce},[n.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:le}}}};var de=`@univerjs/sheets-filter-ui`,I=`1.0.0-rc.0`;let L=`sheets-filter-ui.config`,R={},z=class extends t.Disposable{constructor(e,t){super(),this.disposeWithMe(e.registerCommand(n.SmartToggleSheetsFilterCommand)),t.mergeMenu(ue)}};z=g([h(0,t.ICommandService),h(1,i.IMenuManagerService)],z);function B({ref:e,...t}){let{preserveStrokeWidth:n,icon:r,id:i,className:a,extend:o,...s}=t,l=`univerjs-icon univerjs-icon-${i} ${a||``}`.trim(),u=`_${(0,c.useId)()}`,d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(e,()=>d.current),(0,c.useLayoutEffect)(()=>{if(!(!n||!d.current||d.current.localName!==r.tag))return he(d.current)},[n,r]),fe(r,`${i}`,{defIds:r.defIds,idSuffix:u},{ref:d,className:l,...s},o)}function fe(e,t,n,r,i){return(0,c.createElement)(e.tag,{key:t,...pe(e,n,i),...r},(me(e,n).children||[]).map((r,a)=>fe(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function pe(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function me(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function he(e){let t=e.viewBox.baseVal,n=Math.max(t.width,t.height);if(!Number.isFinite(n)||n<=0||t.width<=0||t.height<=0)return()=>void 0;let r=16/n,i=Array.from(e.querySelectorAll(`circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tspan, use`)).flatMap(e=>{let t=getComputedStyle(e),n=Number.parseFloat(t.strokeWidth);return t.stroke===`none`||Number.parseFloat(t.strokeOpacity)===0||t.vectorEffect===`non-scaling-stroke`||!Number.isFinite(n)||n<=0?[]:[{element:e,hadStyleAttribute:e.hasAttribute(`style`),originalStrokeWidth:n,strokeWidth:ge(e.style,`stroke-width`)}]}).map(e=>({appliedStrokeWidth:null,element:e.element,hadStyleAttribute:e.hadStyleAttribute,isReleased:!1,originalStrokeWidth:e.originalStrokeWidth,strokeWidth:e.strokeWidth}));if(i.length===0)return()=>void 0;let a=(e,n)=>{if(t.width<=0||t.height<=0||e<=0||n<=0)return;let a=Math.min(e/t.width,n/t.height);!Number.isFinite(a)||a<=0||i.forEach(e=>{if(e.isReleased)return;if(e.appliedStrokeWidth!==null&&(e.element.style.getPropertyValue(`stroke-width`)!==e.appliedStrokeWidth||e.element.style.getPropertyPriority(`stroke-width`)!==e.strokeWidth.priority)){e.appliedStrokeWidth=null,e.isReleased=!0;return}let t=e.originalStrokeWidth*r/a,n=`${Number(t.toFixed(12))}px`;e.element.style.setProperty(`stroke-width`,n,e.strokeWidth.priority),e.appliedStrokeWidth=n})},o=e.getBoundingClientRect();a(o.width,o.height);let s=typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{if(t.some(t=>t.target===e)){let t=e.getBoundingClientRect();a(t.width,t.height)}});return s==null||s.observe(e),()=>{s==null||s.disconnect(),i.forEach(e=>{e.appliedStrokeWidth!==null&&(_e(e.element.style,`stroke-width`,e.appliedStrokeWidth,e.strokeWidth.priority,e.strokeWidth),!e.hadStyleAttribute&&e.element.style.length===0&&e.element.removeAttribute(`style`))})}}function ge(e,t){return{priority:e.getPropertyPriority(t),value:e.getPropertyValue(t)}}function _e(e,t,n,r,i){e.getPropertyValue(t)===n&&e.getPropertyPriority(t)===r&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}B.displayName=`UniverIcon`;let ve={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 20`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M10 1.05957C10.356 1.05957 10.6816 1.26162 10.8408 1.58008L18.8408 17.5801L18.8799 17.668C19.0486 18.1134 18.8551 18.6232 18.4199 18.8408C17.9557 19.0727 17.3913 18.8841 17.1592 18.4199L10 4.10156L2.84082 18.4199C2.60871 18.8841 2.04434 19.0727 1.58008 18.8408C1.11587 18.6087 0.92731 18.0443 1.15918 17.5801L9.15918 1.58008C9.31841 1.26162 9.64395 1.05957 10 1.05957Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M15.3337 11.7261L15.4294 11.731C15.9035 11.779 16.2732 12.1798 16.2732 12.6665C16.2732 13.1532 15.9035 13.554 15.4294 13.602L15.3337 13.6069H4.66675C4.1476 13.6069 3.72632 13.1856 3.72632 12.6665C3.72632 12.1474 4.1476 11.7261 4.66675 11.7261H15.3337Z`}}]},V=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`a-icon`,ref:t,icon:ve}))});V.displayName=`AIcon`;let ye={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 20`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M17.0596 10C17.0596 6.10087 13.8992 2.94043 10 2.94043C6.10087 2.94043 2.94043 6.10087 2.94043 10C2.94043 13.8992 6.10087 17.0596 10 17.0596C13.8992 17.0596 17.0596 13.8992 17.0596 10ZM18.9404 10C18.9404 14.9374 14.9374 18.9404 10 18.9404C5.06257 18.9404 1.05957 14.9374 1.05957 10C1.05957 5.06257 5.06257 1.05957 10 1.05957C14.9374 1.05957 18.9404 5.06257 18.9404 10Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M4.29492 4.13476C4.63911 3.79057 5.1845 3.76906 5.55371 4.07031L5.625 4.13476L16.0244 14.5352L16.0889 14.6064C16.3902 14.9757 16.3686 15.52 16.0244 15.8643C15.6573 16.2313 15.0624 16.2313 14.6953 15.8643L4.29492 5.46484L4.23047 5.39355C3.92922 5.02434 3.95073 4.47895 4.29492 4.13476Z`}}]},H=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`ban-icon`,ref:t,icon:ye}))});H.displayName=`BanIcon`;let be={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},xe=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`check-mark-icon`,ref:t,icon:be}))});xe.displayName=`CheckMarkIcon`;let Se={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z`}}]},Ce=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`close-icon`,ref:t,icon:Se}))});Ce.displayName=`CloseIcon`;let we={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},U=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`filter-icon`,ref:t,icon:we}))});U.displayName=`FilterIcon`;let Te={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.00016 1.33203C6.68162 1.33203 5.39269 1.72302 4.29636 2.45557C3.20004 3.18811 2.34555 4.2293 1.84097 5.44747C1.33638 6.66565 1.20436 8.00609 1.4616 9.2993C1.71883 10.5925 2.35377 11.7804 3.28612 12.7127C4.21847 13.6451 5.40636 14.28 6.69956 14.5373C7.99277 14.7945 9.33321 14.6625 10.5514 14.1579C11.7696 13.6533 12.8108 12.7988 13.5433 11.7025C14.2758 10.6062 14.6668 9.31724 14.6668 7.9987C14.6649 6.23118 13.9619 4.53662 12.7121 3.2868C11.4622 2.03697 9.76768 1.33397 8.00016 1.33203ZM7.66683 3.9987C7.86461 3.9987 8.05795 4.05735 8.2224 4.16723C8.38685 4.27711 8.51502 4.43329 8.59071 4.61601C8.6664 4.79874 8.6862 4.99981 8.64762 5.19379C8.60903 5.38777 8.51379 5.56595 8.37394 5.7058C8.23409 5.84566 8.0559 5.9409 7.86192 5.97948C7.66794 6.01807 7.46687 5.99826 7.28415 5.92258C7.10142 5.84689 6.94524 5.71872 6.83536 5.55427C6.72548 5.38982 6.66683 5.19648 6.66683 4.9987C6.66683 4.73348 6.77219 4.47913 6.95972 4.29159C7.14726 4.10405 7.40162 3.9987 7.66683 3.9987ZM9.3335 11.332H6.66683C6.49002 11.332 6.32045 11.2618 6.19543 11.1368C6.0704 11.0117 6.00016 10.8422 6.00016 10.6654C6.00016 10.4886 6.0704 10.319 6.19543 10.194C6.32045 10.0689 6.49002 9.9987 6.66683 9.9987H7.3335V7.9987H6.66683C6.49002 7.9987 6.32045 7.92846 6.19543 7.80343C6.0704 7.67841 6.00016 7.50884 6.00016 7.33203C6.00016 7.15522 6.0704 6.98565 6.19543 6.86063C6.32045 6.7356 6.49002 6.66536 6.66683 6.66536H8.00016C8.17698 6.66536 8.34655 6.7356 8.47157 6.86063C8.59659 6.98565 8.66683 7.15522 8.66683 7.33203V9.9987H9.3335C9.51031 9.9987 9.67988 10.0689 9.8049 10.194C9.92993 10.319 10.0002 10.4886 10.0002 10.6654C10.0002 10.8422 9.92993 11.0117 9.8049 11.1368C9.67988 11.2618 9.51031 11.332 9.3335 11.332Z`}}]},Ee=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`info-icon`,ref:t,icon:Te}))});Ee.displayName=`InfoIcon`;let De={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M10.3536 12.3536C10.1583 12.5488 9.84171 12.5488 9.64645 12.3536L6.64645 9.35355C6.45118 9.15829 6.45118 8.84171 6.64645 8.64645L9.64645 5.64645C9.84171 5.45118 10.1583 5.45118 10.3536 5.64645C10.5488 5.84171 10.5488 6.15829 10.3536 6.35355L7.70711 9L10.3536 11.6464C10.5488 11.8417 10.5488 12.1583 10.3536 12.3536Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Oe=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`more-left-icon`,ref:t,icon:De}))});Oe.displayName=`MoreLeftIcon`;let ke={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M6.14645 4.64645C6.34171 4.45118 6.65829 4.45118 6.85355 4.64645L9.85355 7.64645C10.0488 7.84171 10.0488 8.15829 9.85355 8.35355L6.85355 11.3536C6.65829 11.5488 6.34171 11.5488 6.14645 11.3536C5.95118 11.1583 5.95118 10.8417 6.14645 10.6464L8.79289 8L6.14645 5.35355C5.95118 5.15829 5.95118 4.84171 6.14645 4.64645Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Ae=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`more-right-icon`,ref:t,icon:ke}))});Ae.displayName=`MoreRightIcon`;let je={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Me=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`search-icon`,ref:t,icon:je}))});Me.displayName=`SearchIcon`;let Ne={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.7245 6.42417C11.9588 6.18985 11.9588 5.80995 11.7245 5.57564C11.4901 5.34132 11.1102 5.34132 10.8759 5.57564L7.3002 9.15137L5.72446 7.57564C5.49014 7.34132 5.11025 7.34132 4.87593 7.57564C4.64162 7.80995 4.64162 8.18985 4.87593 8.42417L6.87593 10.4242C7.11025 10.6585 7.49014 10.6585 7.72446 10.4242L11.7245 6.42417Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Pe=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`success-icon`,ref:t,icon:Ne}))});Pe.displayName=`SuccessIcon`;let W=class extends t.Disposable{constructor(e){super(),this.disposeWithMe(e.register({FilterIcon:U}))}};W=g([h(0,(0,t.Inject)(i.IconManager))],W);function Fe(e){let{item:t,label:n,textColor:r=!1,onSelect:i}=e;return(0,u.jsxs)(`button`,{type:`button`,"aria-label":t.color??n,"aria-pressed":t.checked,className:(0,l.clsx)(l.resetButtonClassName,`univer-relative univer-flex univer-size-12 univer-items-center univer-justify-center univer-rounded-full univer-border univer-border-solid univer-border-gray-200 univer-bg-gray-0 dark:!univer-border-gray-600 dark:!univer-bg-gray-800`),style:!r&&t.color?{backgroundColor:t.color}:void 0,onClick:i,children:[!t.color&&(0,u.jsx)(H,{className:`univer-size-7`}),r&&t.color&&(0,u.jsx)(V,{className:`univer-size-7`,style:{color:t.color}}),t.checked&&(0,u.jsx)(`span`,{className:`univer-absolute -univer-bottom-1 -univer-right-1 univer-flex univer-size-5 univer-items-center univer-justify-center univer-rounded-full univer-bg-primary-600 univer-text-gray-0`,children:(0,u.jsx)(xe,{className:`univer-size-3`})})]})}function Ie(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.cellFillColors$,[],!0),o=(0,i.useObservable)(n.cellTextColors$,[],!0),s=r.t(`sheets-filter-ui.panel.filter-by-cell-fill-color`),c=r.t(`sheets-filter-ui.panel.filter-by-cell-text-color`),l=a.length>1||o.length>1;return(0,u.jsxs)(`div`,{"data-u-comp":`mobile-sheets-filter-by-colors`,className:`univer-flex univer-min-h-full univer-flex-col univer-gap-6`,children:[a.length>1&&(0,u.jsxs)(`section`,{children:[(0,u.jsx)(`h3`,{className:`univer-m-0 univer-mb-4 univer-text-base univer-font-medium`,children:s}),(0,u.jsx)(`div`,{className:`univer-flex univer-flex-wrap univer-gap-4`,children:a.map(e=>(0,u.jsx)(Fe,{item:e,label:s,onSelect:()=>n.onFilterCheckToggled(e)},e.color??`none`))})]}),o.length>1&&(0,u.jsxs)(`section`,{children:[(0,u.jsx)(`h3`,{className:`univer-m-0 univer-mb-4 univer-text-base univer-font-medium`,children:c}),(0,u.jsx)(`div`,{className:`univer-flex univer-flex-wrap univer-gap-4`,children:o.map(e=>(0,u.jsx)(Fe,{item:e,label:c,textColor:!0,onSelect:()=>n.onFilterCheckToggled(e,!1)},e.color??`none`))})]}),!l&&(0,u.jsx)(`div`,{className:`univer-flex univer-flex-1 univer-items-center univer-justify-center univer-text-gray-500`,children:r.t(`sheets-filter-ui.panel.filter-by-color-none`)})]})}function Le(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.conditionItem$,void 0,!0),o=(0,i.useObservable)(n.filterConditionFormParams$,void 0,!0),s=f.ALL_CONDITIONS.filter(e=>e.numOfParameters!==2).map(e=>({label:r.t(e.label),value:e.operator}));if(!a||!o)return null;function c(e,t,i){let a=f.getItemByOperator(e).numOfParameters===1;return(0,u.jsxs)(`div`,{className:`univer-grid univer-gap-3`,children:[i===`operator2`&&(0,u.jsxs)(l.RadioGroup,{value:o!=null&&o.and?`AND`:`OR`,onChange:e=>n.onConditionFormChange({and:e===`AND`}),children:[(0,u.jsx)(l.Radio,{value:`AND`,children:r.t(`sheets-filter-ui.panel.and`)}),(0,u.jsx)(l.Radio,{value:`OR`,children:r.t(`sheets-filter-ui.panel.or`)})]}),(0,u.jsx)(l.MobileSelect,{value:e,options:s,onChange:e=>n.onConditionFormChange({[i]:e})}),a&&(0,u.jsx)(l.Input,{value:t,placeholder:r.t(`sheets-filter-ui.panel.input-values-placeholder`),onChange:e=>n.onConditionFormChange({[i===`operator1`?`val1`:`val2`]:e})})]})}function d(){return(0,u.jsxs)(`div`,{className:`univer-grid univer-gap-3 univer-pb-4 univer-pl-7`,children:[a.numOfParameters===1&&(0,u.jsx)(l.Input,{value:o.val1??``,placeholder:r.t(`sheets-filter-ui.panel.input-values-placeholder`),onChange:e=>n.onConditionFormChange({val1:e})}),a.numOfParameters>=2&&c(o.operator1,o.val1??``,`operator1`),a.numOfParameters>=2&&c(o.operator2,o.val2??``,`operator2`),(0,u.jsxs)(`p`,{className:`univer-m-0 univer-text-xs univer-text-gray-500`,children:[r.t(`sheets-filter-ui.panel.?`),(0,u.jsx)(`br`,{}),r.t(`sheets-filter-ui.panel.*`)]})]})}return(0,u.jsx)(`div`,{"data-u-comp":`mobile-sheets-filter-by-conditions`,className:`univer-grid univer-gap-4`,children:(0,u.jsx)(`div`,{className:`univer-overflow-hidden univer-rounded-xl univer-bg-gray-0 dark:!univer-bg-gray-800`,children:f.ALL_CONDITIONS.map(e=>{let t=a.operator===e.operator;return(0,u.jsxs)(`div`,{"data-u-comp":`mobile-filter-condition-item`,"data-selected":t,className:`univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-px-4 last:univer-border-b-0 dark:!univer-border-gray-700`,children:[(0,u.jsx)(l.Radio,{value:e.operator,checked:t,onChange:e=>n.onPrimaryConditionChange(e),children:(0,u.jsx)(`span`,{className:`univer-flex univer-min-h-12 univer-items-center univer-text-base`,children:r.t(e.label)})}),t&&a.numOfParameters>0&&d()]},e.operator)})})})}function Re(e){let t=[];return e.forEach(e=>{e.checked&&t.push(e.key),e.children&&(t=t.concat(Re(e.children)))}),t}function ze(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),[a,o]=(0,c.useState)(!1),s=(0,i.useObservable)(n.searchString$,``,!0),d=(0,i.useObservable)(n.filterItems$,[],!0),f=m(d),p=f.checked>0&&f.unchecked===0,h=f.checked>0&&f.unchecked>0,g=r.t(`sheets-filter-ui.panel.search-placeholder`);return(0,u.jsxs)(`div`,{"data-u-comp":`mobile-sheets-filter-by-values`,className:`univer-flex univer-min-h-full univer-flex-col`,children:[(0,u.jsx)(`div`,{className:`univer-flex univer-min-h-14 univer-items-center univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-px-2 dark:!univer-border-gray-700`,children:a?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(l.Input,{autoFocus:!0,className:`univer-flex-1`,value:s,placeholder:g,onChange:e=>n.setSearchString(e)}),(0,u.jsx)(`button`,{type:`button`,"aria-label":r.t(`sheets-filter-ui.panel.cancel`),className:`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/sheets-filter"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("rxjs"),require("react"),require("@univerjs/design"),require("react/jsx-runtime"),require("@univerjs/rpc")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets-filter`,`@univerjs/sheets-ui`,`@univerjs/ui`,`@univerjs/engine-render`,`@univerjs/sheets`,`rxjs`,`react`,`@univerjs/design`,`react/jsx-runtime`,`@univerjs/rpc`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsFilterUi={},e.UniverCore,e.UniverSheetsFilter,e.UniverSheetsUi,e.UniverUi,e.UniverEngineRender,e.UniverSheets,e.rxjs,e.React,e.UniverDesign,e.React,e.UniverRpc))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let f;(function(e){let r=e.NONE={label:`sheets-filter-ui.conditions.none`,operator:`none`,order:1,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.NONE]: should not have initial form params!`)},testMappingParams:e=>e.operator1===`none`,mapToFilterColumn:()=>null,testMappingFilterColumn:e=>!e.customFilters&&!e.filters&&{}},i=e.ALL_CONDITIONS=[r,e.EMPTY={label:`sheets-filter-ui.conditions.empty`,operator:`empty`,order:1,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.EMPTY]: should not have initial form params!`)},testMappingParams:({operator1:e})=>e===`empty`,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:``}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.val!==``||n.operator!==void 0?!1:{operator1:`empty`}}},e.NOT_EMPTY={label:`sheets-filter-ui.conditions.not-empty`,operator:`notEmpty`,order:1,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.NOT_EMPTY]: should not have initial form params!`)},testMappingParams:({operator1:e})=>e===`notEmpty`,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:``,operator:n.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.val!==` `||r.operator!==n.CustomFilterOperator.NOT_EQUALS?!1:{operator1:`notEmpty`}}},e.TEXT_CONTAINS={label:`sheets-filter-ui.conditions.text-contains`,operator:`contains`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`contains`,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===`contains`},mapToFilterColumn:e=>{let{val1:t}=e;return t===``?null:{customFilters:{customFilters:[{val:`*${t}*`}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.startsWith(`*`)&&r.endsWith(`*`)?{operator1:`contains`,val1:r.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:`sheets-filter-ui.conditions.does-not-contain`,operator:`doesNotContain`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`doesNotContain`,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`*${e.val1}*`,operator:n.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:e=>{let[t]=p(e);return t===`doesNotContain`},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0],i=r.val.toString();return r.operator===n.CustomFilterOperator.NOT_EQUALS&&i.startsWith(`*`)&&i.endsWith(`*`)?{operator1:`doesNotContain`,val1:i.slice(1,-1)}:!1}},e.STARTS_WITH={label:`sheets-filter-ui.conditions.starts-with`,operator:`startsWith`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`startsWith`,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`${e.val1}*`}]}}),testMappingParams:e=>{let[t]=p(e);return t===`startsWith`},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.endsWith(`*`)&&!r.startsWith(`*`)?{operator1:`startsWith`,val1:r.slice(0,-1)}:!1}},e.ENDS_WITH={label:`sheets-filter-ui.conditions.ends-with`,operator:`endsWith`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`endsWith`,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`*${e.val1}`}]}}),testMappingParams:e=>{let[t]=p(e);return t===`endsWith`},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.startsWith(`*`)&&!r.endsWith(`*`)?{operator1:`endsWith`,val1:r.slice(1)}:!1}},e.EQUALS={label:`sheets-filter-ui.conditions.equals`,operator:`equals`,order:0,numOfParameters:1,getDefaultFormParams:()=>({operator1:`equals`,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===`equals`},mapToFilterColumn:e=>{let{val1:t}=e;return t===``?null:{customFilters:{customFilters:[{val:t}]}}},testMappingFilterColumn:e=>{var t,n;return((t=e.filters)==null||(t=t.filters)==null?void 0:t.length)===1?{operator1:`equals`,val1:``}:((n=e.customFilters)==null?void 0:n.customFilters.length)===1&&!e.customFilters.customFilters[0].operator&&{operator1:`equals`,val1:e.customFilters.customFilters[0].val.toString()}}},e.GREATER_THAN={label:`sheets-filter-ui.conditions.greater-than`,operator:n.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.GREATER_THAN,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.GREATER_THAN},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.GREATER_THAN&&{operator1:n.CustomFilterOperator.GREATER_THAN,val1:r.val.toString()}}},e.GREATER_THAN_OR_EQUAL={label:`sheets-filter-ui.conditions.greater-than-or-equal`,operator:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&{operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:r.val.toString()}}},e.LESS_THAN={label:`sheets-filter-ui.conditions.less-than`,operator:n.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.LESS_THAN,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.LESS_THAN},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.LESS_THAN}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.LESS_THAN&&{operator1:n.CustomFilterOperator.LESS_THAN,val1:r.val.toString()}}},e.LESS_THAN_OR_EQUAL={label:`sheets-filter-ui.conditions.less-than-or-equal`,operator:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.LESS_THAN_OR_EQUAL&&{operator1:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:r.val.toString()}}},e.EQUAL={label:`sheets-filter-ui.conditions.equal`,operator:n.CustomFilterOperator.EQUAL,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.EQUAL,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.EQUAL&&{operator1:n.CustomFilterOperator.EQUAL,val1:r.val.toString()}}},e.NOT_EQUAL={label:`sheets-filter-ui.conditions.not-equal`,operator:n.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:0,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.NOT_EQUALS,val1:``}),testMappingParams:e=>{let[t]=p(e);return t===n.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:n.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let r=e.customFilters.customFilters[0];return r.operator===n.CustomFilterOperator.NOT_EQUALS&&{operator1:n.CustomFilterOperator.NOT_EQUALS,val1:r.val.toString()}}},e.BETWEEN={label:`sheets-filter-ui.conditions.between`,operator:`between`,order:1,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:``,operator2:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:``}),testMappingParams:e=>{let{and:t,operator1:r,operator2:i}=e;if(!t)return!1;let a=[r,i];return a.includes(n.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&a.includes(n.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:e=>{let{val1:r,val2:i,operator1:a}=e,o=a===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:t.BooleanNumber.TRUE,customFilters:[{val:o?r:i,operator:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:o?i:r,operator:n.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let[r,i]=e.customFilters.customFilters;return r.operator===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&i.operator===n.CustomFilterOperator.LESS_THAN_OR_EQUAL&&e.customFilters.and?{and:!0,operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:r.val.toString(),operator2:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:i.val.toString()}:i.operator===n.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&r.operator===n.CustomFilterOperator.LESS_THAN_OR_EQUAL&&e.customFilters.and?{and:!0,operator1:n.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:i.val.toString(),operator2:n.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:r.val.toLocaleString()}:!1}},e.NOT_BETWEEN={label:`sheets-filter-ui.conditions.not-between`,operator:`notBetween`,order:1,numOfParameters:2,getDefaultFormParams:()=>({operator1:n.CustomFilterOperator.LESS_THAN,val1:``,operator2:n.CustomFilterOperator.GREATER_THAN,val2:``}),testMappingParams:e=>{let{and:t,operator1:r,operator2:i}=e;if(t)return!1;let a=[r,i];return a.includes(n.CustomFilterOperator.GREATER_THAN)&&a.includes(n.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:e=>{let{val1:t,val2:r,operator1:i}=e,a=i===n.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:a?t:r,operator:n.CustomFilterOperator.GREATER_THAN},{val:a?r:t,operator:n.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let[r,i]=e.customFilters.customFilters;return r.operator===n.CustomFilterOperator.LESS_THAN&&i.operator===n.CustomFilterOperator.GREATER_THAN&&!e.customFilters.and?{operator1:n.CustomFilterOperator.LESS_THAN,val1:r.val.toString(),operator2:n.CustomFilterOperator.GREATER_THAN,val2:i.val.toString()}:i.operator===n.CustomFilterOperator.LESS_THAN&&r.operator===n.CustomFilterOperator.GREATER_THAN&&!e.customFilters.and&&{operator1:n.CustomFilterOperator.GREATER_THAN,val1:i.val.toString(),operator2:n.CustomFilterOperator.LESS_THAN,val2:r.val.toLocaleString()}}},e.CUSTOM={label:`sheets-filter-ui.conditions.custom`,operator:`custom`,order:1,numOfParameters:2,getDefaultFormParams:()=>({operator1:`none`,val1:``,operator2:`none`,val2:``}),testMappingParams:()=>!0,mapToFilterColumn:e=>{let{and:n,val1:a,val2:o,operator1:s,operator2:c}=e;function l(e,t){for(let n of i)if(n.operator===e)return n.mapToFilterColumn({val1:t,operator1:e})}let u=!s||s===f.NONE.operator,d=!c||c===f.NONE.operator;if(u&&d)return r.mapToFilterColumn({});if(u)return l(c,o);if(d)return l(s,a);let p=l(s,a),m=l(c,o),h={customFilters:[p.customFilters.customFilters[0],m.customFilters.customFilters[0]]};return n&&(h.and=t.BooleanNumber.TRUE),{customFilters:h}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let n=e.customFilters.customFilters.map(e=>l({customFilters:{customFilters:[e]}})),r={operator1:n[0][0].operator,val1:n[0][1].val1,operator2:n[1][0].operator,val2:n[1][1].val1};return e.customFilters.and&&(r.and=!0),r}}];function a(e){let t=i.find(t=>t.operator===e);if(!t)throw Error(`[SheetsFilter]: no condition item found for operator: ${e}`);return t}e.getItemByOperator=a;function o(e,t){for(let n of i.filter(e=>e.numOfParameters===t))if(n.numOfParameters!==0&&n.testMappingParams(e))return n;for(let t of i)if(t.testMappingParams(e))return t;throw Error(`[SheetsFilter]: no condition item can be mapped from the filter map params!`)}e.testMappingParams=o;function s(e){let t=i.find(t=>t.operator===e);return(t==null?void 0:t.numOfParameters)===0?{operator1:t.operator}:t.getDefaultFormParams()}e.getInitialFormParams=s;function c(e,t){return e.mapToFilterColumn(t)}e.mapToFilterColumn=c;function l(e){if(!e)return[r,{}];for(let t of i){let n=t.testMappingFilterColumn(e);if(n)return[t,n]}return[r,{}]}e.testMappingFilterColumn=l})(f||={});function p(e){let{operator1:t,operator2:n,val1:r,val2:i}=e;if(t&&n)throw Error(`Both operator1 and operator2 are set!`);if(!t&&!n)throw Error(`Neither operator1 and operator2 and both not set!`);return t?[t,r]:[n,i]}function m(e){let t=[],n=[],r=0,i=0;function a(e){e.leaf&&(e.checked?(t.push(e),r+=e.count):(n.push(e),i+=e.count)),e.children&&e.children.forEach(a)}return e.forEach(a),{checkedItems:t,uncheckedItems:n,checked:r,unchecked:i}}function h(e,t){return function(n,r){t(n,r,e)}}function g(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let _=`sheets-filter.generate-filter-values.service`,v=(0,t.createIdentifier)(_),y=class extends t.Disposable{constructor(e,t,n){super(),this._localeService=e,this._univerInstanceService=t,this._logService=n}async getFilterValues(e){var t;let{unitId:n,subUnitId:r,filteredOutRowsByOtherColumns:i,filterColumn:a,filters:o,blankChecked:s,iterateRange:c,alreadyChecked:l}=e,u=this._univerInstanceService.getUnit(n),d=(t=this._univerInstanceService.getUnit(n))==null?void 0:t.getSheetBySheetId(r);return!u||!d?[]:(this._logService.debug(`[SheetsGenerateFilterValuesService]`,`getFilterValues for`,{unitId:n,subUnitId:r}),b(o,this._localeService,c,d,new Set(i),a,new Set(l.map(String)),s,u.getStyles()))}};y=g([h(0,(0,t.Inject)(t.LocaleService)),h(1,t.IUniverInstanceService),h(2,t.ILogService)],y);function b(e,r,i,a,o,s,c,l,u){var d;let f=new Map,p=new Map,m=`empty`,h=!e&&((s==null?void 0:s.filterBy)===n.FilterBy.COLORS||(s==null?void 0:s.filterBy)===n.FilterBy.CONDITIONS)&&((d=s.filteredOutRows)==null?void 0:d.size),g=0;for(let e of a.iterateByColumn(i,!1,!1)){let{row:n,rowSpan:i=1}=e,s=0;for(;s<i;){var _,v,y;let d=n+s;if(o.has(d)){s++;continue}let m=e!=null&&e.value?(0,t.extractPureTextFromCell)(e.value):``;if(!m){g+=1,s+=i;continue}let x=(_=e.value)!=null&&_.v&&!e.value.p?(v=u.get((y=e.value)==null?void 0:y.s))==null||(v=v.n)==null?void 0:v.pattern:``,E=x&&t.numfmt.getFormatInfo(x).isDate,D=!1;if(E){let{year:e,month:n,day:r}=t.numfmt.getFormatDateInfo(x);D=e||n||r}if(x&&E&&D){var b,S,C;let n=(b=a.getCellRaw(e.row,e.col))==null?void 0:b.v;if(!n){s++;continue}let[i,o,u]=t.numfmt.format(`yyyy-mm-dd`,Number(n)).split(`-`).map(Number),d=f.get(`${i}`);d||(d={title:`${i}`,key:`${i}`,children:[],count:0,leaf:!1,checked:!1},f.set(`${i}`,d),p.set(`${i}`,[`${i}`]));let g=(S=d.children)==null?void 0:S.find(e=>e.key===`${i}-${o}`);if(!g){var w;g={title:r.t(`sheets-filter-ui.date.${o}`),key:`${i}-${o}`,children:[],count:0,leaf:!1,checked:!1},(w=d.children)==null||w.push(g),p.set(`${i}-${o}`,[`${i}`,`${i}-${o}`])}let _=g==null||(C=g.children)==null?void 0:C.find(e=>e.key===`${i}-${o}-${u}`);if(_)_.originValues.add(m),_.count++,g.count++,d.count++;else{var T;(T=g.children)==null||T.push({title:`${u}`,key:`${i}-${o}-${u}`,count:1,originValues:new Set([m]),leaf:!0,checked:h?!1:c.size?c.has(m):!l}),g.count++,d.count++,p.set(`${i}-${o}-${u}`,[`${i}`,`${i}-${o}`,`${i}-${o}-${u}`])}}else{let e=m,t=f.get(e);t?t.count++:(t={title:m,leaf:!0,checked:h?!1:c.size?c.has(m):!l,key:e,count:1},f.set(e,t),p.set(e,[e]))}s++}}let E=h?!1:!e||l;if(g>0){let e={title:r.t(`sheets-filter-ui.panel.empty`),count:g,leaf:!0,checked:E,key:m};f.set(`empty`,e),p.set(`empty`,[m])}return{filterTreeItems:x(Array.from(f.values())),filterTreeMapCache:p}}function x(e){return Array.from(e).sort((e,t)=>e.children&&!t.children?-1:!e.children&&t.children?1:S(e.title,t.title)).map(e=>(e.children&&e.children.sort((e,t)=>Number.parseInt(e.key.split(`-`)[1],10)-Number.parseInt(t.key.split(`-`)[1],10)).forEach(e=>{e.children&&e.children.sort((e,t)=>Number.parseInt(e.key.split(`-`)[2],10)-Number.parseInt(t.key.split(`-`)[2],10))}),e))}function S(e,n){let r=(0,t.isNumeric)(e),i=(0,t.isNumeric)(n);return r&&i?Number.parseFloat(e)-Number.parseFloat(n):r&&!i?-1:!r&&i?1:e.localeCompare(n)}function C(e,t){for(let n of e){if(n.key===t)return n;if(n.children){let e=C(n.children,t);if(e)return e}}return null}function w(e){return e.leaf?e.checked:!e.children||e.children.every(e=>w(e))}function T(e,t){e.leaf&&(e.checked=t===void 0?!e.checked:t),e.children&&e.children.forEach(e=>T(e,t))}function E(e,t){let n=[];return e.forEach(e=>{let r=e.originValues?t.some(t=>Array.from(e.originValues).some(e=>e.toLowerCase().includes(t.toLowerCase()))):!1,i=!r&&t.some(t=>e.title.toLowerCase().includes(t.toLowerCase()));if(r||i)n.push({...e});else if(e.children){let r=E(e.children,t);if(r.length>0){let t=r.reduce((e,t)=>e+t.count,0);n.push({...e,count:t,children:r})}}}),n}function D(e){"@babel/helpers - typeof";return D=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},D(e)}function ee(e,t){if(D(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(D(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function te(e){var t=ee(e,`string`);return D(t)==`symbol`?t:t+``}function O(e,t,n){return(t=te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var k,ne,re;let A=(0,t.createIdentifier)(`sheets-filter-ui.sheets-filter-panel.service`),j=class extends t.Disposable{get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(e){this._filterByModel=e,this._filterByModel$.next(e)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}constructor(e,t){super(),this._injector=e,this._refRangeService=t,O(this,`_filterBy$`,new s.BehaviorSubject(n.FilterBy.VALUES)),O(this,`filterBy$`,this._filterBy$.asObservable()),O(this,`_filterByModel$`,new s.ReplaySubject(1)),O(this,`filterByModel$`,this._filterByModel$.asObservable()),O(this,`_filterByModel`,null),O(this,`_hasCriteria$`,new s.BehaviorSubject(!1)),O(this,`hasCriteria$`,this._hasCriteria$.asObservable()),O(this,`_filterModel`,null),O(this,`_col$`,new s.BehaviorSubject(-1)),O(this,`col$`,this._col$.asObservable()),O(this,`_filterHeaderListener`,null)}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(e,t){this.terminate(),this._filterModel=e,this._col$.next(t);let n=e.getFilterColumn(t);if(n){let r=n.getColumnData();if(r.customFilters){this._hasCriteria$.next(!0),this._setupByConditions(e,t);return}if(r.colorFilters){this._hasCriteria$.next(!0),this._setupByColors(e,t);return}if(r.filters){this._hasCriteria$.next(!0),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t)}changeFilterBy(e){if(!this._filterModel||this.col===-1)return!1;switch(e){case n.FilterBy.VALUES:this._setupByValues(this._filterModel,this.col);break;case n.FilterBy.COLORS:this._setupByColors(this._filterModel,this.col);break;case n.FilterBy.CONDITIONS:this._setupByConditions(this._filterModel,this.col)}return!0}terminate(){return this._filterModel=null,this._col$.next(-1),this._disposeFilterHeaderChangeListener(),!0}_disposeFilterHeaderChangeListener(){var e;(e=this._filterHeaderListener)==null||e.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(e,t){this._disposeFilterHeaderChangeListener();let n=e.unitId,r=e.subUnitId,i=e.getRange(),a={startColumn:t,startRow:i.startRow,endRow:i.startRow,endColumn:t};this._filterHeaderListener=this._refRangeService.watchRange(n,r,a,(e,t)=>{if(!t)this.terminate();else{let n=t.startColumn-e.startColumn;n!==0&&this._filterByModel.deltaCol(n)}})}async _setupByValues(e,t){this._disposePreviousModel();let r=e.getRange();if(r.startRow===r.endRow)return!1;let i=await N.fromFilterColumn(this._injector,e,t);return this.filterByModel=i,this._filterBy$.next(n.FilterBy.VALUES),this._listenToFilterHeaderChange(e,t),!0}async _setupByColors(e,t){this._disposePreviousModel();let r=e.getRange();if(r.startRow===r.endRow)return!1;let i=await ie.fromFilterColumn(this._injector,e,t);return this.filterByModel=i,this._filterBy$.next(n.FilterBy.COLORS),this._listenToFilterHeaderChange(e,t),!0}_setupByConditions(e,t){this._disposePreviousModel();let r=e.getRange();if(r.startRow===r.endRow)return!1;let i=M.fromFilterColumn(this._injector,e,t,e.getFilterColumn(t));return this.filterByModel=i,this._filterBy$.next(n.FilterBy.CONDITIONS),this._listenToFilterHeaderChange(e,t),!0}_disposePreviousModel(){var e;(e=this._filterByModel)==null||e.dispose(),this.filterByModel=null}};j=g([h(0,(0,t.Inject)(t.Injector)),h(1,(0,t.Inject)(o.RefRangeService))],j);let M=k=class extends t.Disposable{static fromFilterColumn(e,t,n,r){let[i,a]=f.testMappingFilterColumn(r==null?void 0:r.getColumnData());return e.createInstance(k,t,n,i,a)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,O(this,`canApply$`,(0,s.of)(!0)),O(this,`_conditionItem$`,void 0),O(this,`conditionItem$`,void 0),O(this,`_filterConditionFormParams$`,void 0),O(this,`filterConditionFormParams$`,void 0),this._conditionItem$=new s.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new s.BehaviorSubject(r),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;let e=f.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:e})}onPrimaryConditionChange(e){let t=f.ALL_CONDITIONS.find(t=>t.operator===e);if(!t)throw Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);this._conditionItem$.next(t),this._filterConditionFormParams$.next(f.getInitialFormParams(e))}onConditionFormChange(e){let t={...this.filterConditionFormParams,...e};if(t.and!==!0&&delete t.and,e.and!==void 0||e.operator1!==void 0||e.operator2!==void 0){let e=f.testMappingParams(t,this.conditionItem.numOfParameters);this._conditionItem$.next(e)}this._filterConditionFormParams$.next(t)}};M=k=g([h(4,t.ICommandService)],M);let N=ne=class extends t.Disposable{static async fromFilterColumn(e,n,r){let i=e.get(t.IUniverInstanceService),a=e.get(t.LocaleService),o=e.get(v,t.Quantity.OPTIONAL),{unitId:s,subUnitId:c}=n,l=i.getUnit(s,t.UniverInstanceType.UNIVER_SHEET);if(!l)throw Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${s}!`);let u=l==null?void 0:l.getSheetBySheetId(c);if(!u)throw Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${s} and subUnitId: ${c}!`);let d=n.getRange(),f=r,p=n.getFilterColumn(r),m=p==null?void 0:p.getColumnData().filters,h=new Set(m==null?void 0:m.filters),g=!!(m&&m.blank),_=n.getFilteredOutRowsExceptCol(r),y={...d,startRow:d.startRow+1,startColumn:f,endColumn:f},x,S;if(o){let e=await o.getFilterValues({unitId:s,subUnitId:c,filteredOutRowsByOtherColumns:Array.from(_),filterColumn:p,filters:!!m,blankChecked:g,iterateRange:y,alreadyChecked:Array.from(h)});x=e.filterTreeItems,S=e.filterTreeMapCache}else{let e=b(!!m,a,y,u,_,p,h,g,l.getStyles());x=e.filterTreeItems,S=e.filterTreeMapCache}return e.createInstance(ne,n,r,x,S)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}get treeMapCache(){return this._treeMapCache}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,O(this,`_rawFilterItems$`,void 0),O(this,`rawFilterItems$`,void 0),O(this,`filterItems$`,void 0),O(this,`_filterItems`,[]),O(this,`_treeMapCache`,void 0),O(this,`canApply$`,void 0),O(this,`_manuallyUpdateFilterItems$`,void 0),O(this,`_searchString$`,void 0),O(this,`searchString$`,void 0),this._treeMapCache=r,this._searchString$=new s.BehaviorSubject(``),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new s.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new s.Subject,this.filterItems$=(0,s.merge)((0,s.combineLatest)([this._searchString$.pipe((0,s.throttleTime)(500,void 0,{leading:!0,trailing:!0}),(0,s.startWith)(void 0)),this._rawFilterItems$]).pipe((0,s.map)(([e,t])=>e?E(t,e.toLowerCase().split(/\s+/).filter(e=>!!e)):t)),this._manuallyUpdateFilterItems$).pipe((0,s.shareReplay)({bufferSize:1,refCount:!0})),this.canApply$=this.filterItems$.pipe((0,s.map)(e=>m(e).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(e=>this._filterItems=e))}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(e){this.col+=e}setSearchString(e){this._searchString$.next(e)}onCheckAllToggled(e){let n=t.Tools.deepClone(this._filterItems);n.forEach(t=>T(t,e)),this._manuallyUpdateFilterItems(n)}onFilterCheckToggled(e){let n=t.Tools.deepClone(this._filterItems),r=C(n,e.key);r&&(T(r,!w(r)),this._manuallyUpdateFilterItems(n))}onFilterOnly(e){let n=t.Tools.deepClone(this._filterItems);n.forEach(e=>T(e,!1)),e.forEach(e=>{let t=C(n,e);t&&T(t,!0)}),this._manuallyUpdateFilterItems(n)}_manuallyUpdateFilterItems(e){this._manuallyUpdateFilterItems$.next(e)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;let e=m(this._filterItems),{checked:t,checkedItems:r}=e,i=this.rawFilterItems,a=0;for(let e of i)a+=e.count;let o=t===0,s=e.checked===a,c={colId:this.col};if(o)throw Error(`[ByValuesModel]: no checked items!`);if(s)return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{c.filters={};let e=r.filter(e=>e.key!==`empty`);e.length>0&&(c.filters={filters:e.flatMap(e=>e.originValues?Array.from(e.originValues):[e.title])}),e.length!==r.length&&(c.filters.blank=!0)}return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:c})}};N=ne=g([h(4,t.ICommandService)],N);let ie=re=class extends t.Disposable{static async fromFilterColumn(e,n,r){var i;let o=e.get(t.IUniverInstanceService),{unitId:s,subUnitId:c}=n,l=o.getUnit(s,t.UniverInstanceType.UNIVER_SHEET);if(!l)throw Error(`[ByColorsModel]: Workbook not found for filter model with unitId: ${s}!`);let u=l==null?void 0:l.getSheetBySheetId(c);if(!u)throw Error(`[ByColorsModel]: Worksheet not found for filter model with unitId: ${s} and subUnitId: ${c}!`);let d=n.getRange(),f=r,p=(i=n.getFilterColumn(r))==null?void 0:i.getColumnData().colorFilters,m=n.getFilteredOutRowsExceptCol(r),h={...d,startRow:d.startRow+1,startColumn:f,endColumn:f},g=new Map,_=new Set((p==null?void 0:p.cellFillColors)??[]),v=new Map,y=new Set((p==null?void 0:p.cellTextColors)??[]);for(let e of u.iterateByColumn(h,!1,!0)){let{row:n,col:r,value:i}=e;if(m.has(n))continue;let o=u.getComposedCellStyleByCellData(n,r,i);if(o.bg&&o.bg.rgb){let e=new t.ColorKit(o.bg.rgb).toRgbString();g.has(e)||g.set(e,{color:e,checked:_.has(e)})}else g.set(`default-fill-color`,{color:null,checked:_.has(null)});if(o.cl&&o.cl.rgb){let e=new t.ColorKit(o.cl.rgb).toRgbString();v.has(e)||v.set(e,{color:e,checked:y.has(e)})}else v.set(`default-font-color`,{color:a.COLOR_BLACK_RGB,checked:y.has(a.COLOR_BLACK_RGB)})}return e.createInstance(re,n,r,g,v)}get cellFillColors(){return this._cellFillColors$.getValue()}get cellTextColors(){return this._cellTextColors$.getValue()}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,O(this,`canApply$`,(0,s.of)(!0)),O(this,`_cellFillColors$`,void 0),O(this,`cellFillColors$`,void 0),O(this,`_cellTextColors$`,void 0),O(this,`cellTextColors$`,void 0),this._cellFillColors$=new s.BehaviorSubject(Array.from(n.values())),this.cellFillColors$=this._cellFillColors$.asObservable(),this._cellTextColors$=new s.BehaviorSubject(Array.from(r.values())),this.cellTextColors$=this._cellTextColors$.asObservable()}dispose(){super.dispose(),this._cellFillColors$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}onFilterCheckToggled(e,t=!0){let n=t?this.cellFillColors:this.cellTextColors,r=[],i=!1;for(let t=0;t<n.length;t++){let a=n[t];if(a.color===e.color){i=!0,r.push({color:a.color,checked:!a.checked});continue}r.push({color:a.color,checked:a.checked})}i&&(this._resetColorsCheckedStatus(!t),t?this._cellFillColors$.next([...r]):this._cellTextColors$.next([...r]))}_resetColorsCheckedStatus(e=!0){let t=e?this.cellFillColors:this.cellTextColors,n=[];for(let e=0;e<t.length;e++)n.push({color:t[e].color,checked:!1});e?this._cellFillColors$.next([...n]):this._cellTextColors$.next([...n])}async apply(){if(this._disposed)return!1;let e=this.cellFillColors.filter(e=>e.checked).map(e=>e.color),t=this.cellTextColors.filter(e=>e.checked).map(e=>e.color);if(e.length===0&&t.length===0)return this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});let r={colId:this.col};return e.length>0?r.colorFilters={cellFillColors:e}:t.length>0&&(r.colorFilters={cellTextColors:t}),this._commandService.executeCommand(n.SetSheetsFilterCriteriaCommand.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:r})}};ie=re=g([h(4,t.ICommandService)],ie);let ae=`FILTER_PANEL_OPENED`,P={id:`sheet.operation.open-filter-panel`,type:t.CommandType.OPERATION,handler:(e,i)=>{let a=e.get(t.IContextService),o=e.get(n.SheetsFilterService),s=e.get(A),c=e.get(t.ICommandService),l=e.has(r.IEditorBridgeService)?e.get(r.IEditorBridgeService):null;l!=null&&l.isVisible().visible&&c.syncExecuteCommand(r.SetCellEditVisibleOperation.id,{visible:!1});let{unitId:u,subUnitId:d,col:f}=i,p=o.getFilterModel(u,d);return p?(s.setupCol(p,f),a.getContextValue(`FILTER_PANEL_OPENED`)||a.setContextValue(ae,!0),!0):!1}},F={id:`sheet.operation.close-filter-panel`,type:t.CommandType.OPERATION,handler:e=>{let n=e.get(t.IContextService),r=e.get(A),a=e.get(i.ILayoutService,t.Quantity.OPTIONAL);return n.getContextValue(`FILTER_PANEL_OPENED`)?(n.setContextValue(ae,!1),a==null||a.focus(),r.terminate()):!1}},I={id:`sheet.operation.apply-filter`,type:t.CommandType.OPERATION,handler:(e,t)=>{let{filterBy:n}=t;return e.get(A).changeFilterBy(n)}};function oe(e){let a=e.get(n.SheetsFilterService);return{id:n.SmartToggleSheetsFilterCommand.id,type:i.MenuItemType.BUTTON_SELECTOR,icon:`FilterIcon`,tooltip:`sheets-filter-ui.toolbar.smart-toggle-filter-tooltip`,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),activated$:a.activeFilterModel$.pipe((0,s.map)(e=>!!e)),disabled$:(0,r.getObservableWithExclusiveRange$)(e,(0,r.getCurrentRangeDisable$)(e,{worksheetTypes:[o.WorksheetFilterPermission,o.WorksheetViewPermission],rangeTypes:[o.RangeProtectionPermissionViewPoint]}))}}function se(e){let r=e.get(n.SheetsFilterService);return{id:n.ClearSheetsFilterCriteriaCommand.id,type:i.MenuItemType.BUTTON,title:`sheets-filter-ui.toolbar.clear-filter-criteria`,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:r.activeFilterModel$.pipe((0,s.switchMap)(e=>(e==null?void 0:e.hasCriteria$.pipe((0,s.map)(e=>!e)))??(0,s.of)(!0)))}}function ce(e){let r=e.get(n.SheetsFilterService);return{id:n.ReCalcSheetsFilterCommand.id,type:i.MenuItemType.BUTTON,title:`sheets-filter-ui.toolbar.re-calc-filter-conditions`,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:r.activeFilterModel$.pipe((0,s.switchMap)(e=>(e==null?void 0:e.hasCriteria$.pipe((0,s.map)(e=>!e)))??(0,s.of)(!0)))}}let le={[i.RibbonDataGroup.ORGANIZATION]:{[n.SmartToggleSheetsFilterCommand.id]:{order:2,gridLayout:{row:1,column:2},menuItemFactory:oe,[n.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:se},[n.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:ce}}}};var ue=`@univerjs/sheets-filter-ui`,de=`1.0.1`;let L=`sheets-filter-ui.config`,R={},fe={[i.RibbonDataGroup.ORGANIZATION]:{[n.SmartToggleSheetsFilterCommand.id]:{order:2,menuItemFactory:oe,[n.ClearSheetsFilterCriteriaCommand.id]:{order:0,menuItemFactory:se},[n.ReCalcSheetsFilterCommand.id]:{order:1,menuItemFactory:ce}}}},z=class extends t.Disposable{constructor(e,t){super(),this.disposeWithMe(e.registerCommand(n.SmartToggleSheetsFilterCommand)),t.mergeMenu(fe)}};z=g([h(0,t.ICommandService),h(1,i.IMenuManagerService)],z);function B({ref:e,...t}){let{preserveStrokeWidth:n,icon:r,id:i,className:a,extend:o,...s}=t,l=`univerjs-icon univerjs-icon-${i} ${a||``}`.trim(),u=`_${(0,c.useId)()}`,d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(e,()=>d.current),(0,c.useLayoutEffect)(()=>{if(n&&d.current&&d.current.localName===r.tag)return ge(d.current)},[n,r]),pe(r,`${i}`,{defIds:r.defIds,idSuffix:u},{ref:d,className:l,...s},o)}function pe(e,t,n,r,i){return(0,c.createElement)(e.tag,{key:t,...me(e,n,i),...r},(he(e,n).children||[]).map((r,a)=>pe(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function me(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function he(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function ge(e){let t=e.viewBox.baseVal,n=Math.max(t.width,t.height);if(!Number.isFinite(n)||n<=0||t.width<=0||t.height<=0)return()=>void 0;let r=16/n,i=Array.from(e.querySelectorAll(`circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tspan, use`)).flatMap(e=>{let t=getComputedStyle(e),n=Number.parseFloat(t.strokeWidth);return t.stroke===`none`||Number.parseFloat(t.strokeOpacity)===0||t.vectorEffect===`non-scaling-stroke`||!Number.isFinite(n)||n<=0?[]:[{element:e,hadStyleAttribute:e.hasAttribute(`style`),originalStrokeWidth:n,strokeWidth:_e(e.style,`stroke-width`)}]}).map(e=>({appliedStrokeWidth:null,element:e.element,hadStyleAttribute:e.hadStyleAttribute,isReleased:!1,originalStrokeWidth:e.originalStrokeWidth,strokeWidth:e.strokeWidth}));if(i.length===0)return()=>void 0;let a=(e,n)=>{if(t.width<=0||t.height<=0||e<=0||n<=0)return;let a=Math.min(e/t.width,n/t.height);!Number.isFinite(a)||a<=0||i.forEach(e=>{if(e.isReleased)return;if(e.appliedStrokeWidth!==null&&(e.element.style.getPropertyValue(`stroke-width`)!==e.appliedStrokeWidth||e.element.style.getPropertyPriority(`stroke-width`)!==e.strokeWidth.priority)){e.appliedStrokeWidth=null,e.isReleased=!0;return}let t=e.originalStrokeWidth*r/a,n=`${Number(t.toFixed(12))}px`;e.element.style.setProperty(`stroke-width`,n,e.strokeWidth.priority),e.appliedStrokeWidth=n})},o=e.getBoundingClientRect();a(o.width,o.height);let s=typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{if(t.some(t=>t.target===e)){let t=e.getBoundingClientRect();a(t.width,t.height)}});return s==null||s.observe(e),()=>{s==null||s.disconnect(),i.forEach(e=>{e.appliedStrokeWidth!==null&&(ve(e.element.style,`stroke-width`,e.appliedStrokeWidth,e.strokeWidth.priority,e.strokeWidth),!e.hadStyleAttribute&&e.element.style.length===0&&e.element.removeAttribute(`style`))})}}function _e(e,t){return{priority:e.getPropertyPriority(t),value:e.getPropertyValue(t)}}function ve(e,t,n,r,i){e.getPropertyValue(t)===n&&e.getPropertyPriority(t)===r&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}B.displayName=`UniverIcon`;let ye={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 20`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M10 1.05957C10.356 1.05957 10.6816 1.26162 10.8408 1.58008L18.8408 17.5801L18.8799 17.668C19.0486 18.1134 18.8551 18.6232 18.4199 18.8408C17.9557 19.0727 17.3913 18.8841 17.1592 18.4199L10 4.10156L2.84082 18.4199C2.60871 18.8841 2.04434 19.0727 1.58008 18.8408C1.11587 18.6087 0.92731 18.0443 1.15918 17.5801L9.15918 1.58008C9.31841 1.26162 9.64395 1.05957 10 1.05957Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M15.3337 11.7261L15.4294 11.731C15.9035 11.779 16.2732 12.1798 16.2732 12.6665C16.2732 13.1532 15.9035 13.554 15.4294 13.602L15.3337 13.6069H4.66675C4.1476 13.6069 3.72632 13.1856 3.72632 12.6665C3.72632 12.1474 4.1476 11.7261 4.66675 11.7261H15.3337Z`}}]},V=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`a-icon`,ref:t,icon:ye}))});V.displayName=`AIcon`;let be={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 20`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M17.0596 10C17.0596 6.10087 13.8992 2.94043 10 2.94043C6.10087 2.94043 2.94043 6.10087 2.94043 10C2.94043 13.8992 6.10087 17.0596 10 17.0596C13.8992 17.0596 17.0596 13.8992 17.0596 10ZM18.9404 10C18.9404 14.9374 14.9374 18.9404 10 18.9404C5.06257 18.9404 1.05957 14.9374 1.05957 10C1.05957 5.06257 5.06257 1.05957 10 1.05957C14.9374 1.05957 18.9404 5.06257 18.9404 10Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M4.29492 4.13476C4.63911 3.79057 5.1845 3.76906 5.55371 4.07031L5.625 4.13476L16.0244 14.5352L16.0889 14.6064C16.3902 14.9757 16.3686 15.52 16.0244 15.8643C15.6573 16.2313 15.0624 16.2313 14.6953 15.8643L4.29492 5.46484L4.23047 5.39355C3.92922 5.02434 3.95073 4.47895 4.29492 4.13476Z`}}]},H=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`ban-icon`,ref:t,icon:be}))});H.displayName=`BanIcon`;let xe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Se=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`check-mark-icon`,ref:t,icon:xe}))});Se.displayName=`CheckMarkIcon`;let Ce={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z`}}]},we=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`close-icon`,ref:t,icon:Ce}))});we.displayName=`CloseIcon`;let Te={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},U=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`filter-icon`,ref:t,icon:Te}))});U.displayName=`FilterIcon`;let Ee={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.00016 1.33203C6.68162 1.33203 5.39269 1.72302 4.29636 2.45557C3.20004 3.18811 2.34555 4.2293 1.84097 5.44747C1.33638 6.66565 1.20436 8.00609 1.4616 9.2993C1.71883 10.5925 2.35377 11.7804 3.28612 12.7127C4.21847 13.6451 5.40636 14.28 6.69956 14.5373C7.99277 14.7945 9.33321 14.6625 10.5514 14.1579C11.7696 13.6533 12.8108 12.7988 13.5433 11.7025C14.2758 10.6062 14.6668 9.31724 14.6668 7.9987C14.6649 6.23118 13.9619 4.53662 12.7121 3.2868C11.4622 2.03697 9.76768 1.33397 8.00016 1.33203ZM7.66683 3.9987C7.86461 3.9987 8.05795 4.05735 8.2224 4.16723C8.38685 4.27711 8.51502 4.43329 8.59071 4.61601C8.6664 4.79874 8.6862 4.99981 8.64762 5.19379C8.60903 5.38777 8.51379 5.56595 8.37394 5.7058C8.23409 5.84566 8.0559 5.9409 7.86192 5.97948C7.66794 6.01807 7.46687 5.99826 7.28415 5.92258C7.10142 5.84689 6.94524 5.71872 6.83536 5.55427C6.72548 5.38982 6.66683 5.19648 6.66683 4.9987C6.66683 4.73348 6.77219 4.47913 6.95972 4.29159C7.14726 4.10405 7.40162 3.9987 7.66683 3.9987ZM9.3335 11.332H6.66683C6.49002 11.332 6.32045 11.2618 6.19543 11.1368C6.0704 11.0117 6.00016 10.8422 6.00016 10.6654C6.00016 10.4886 6.0704 10.319 6.19543 10.194C6.32045 10.0689 6.49002 9.9987 6.66683 9.9987H7.3335V7.9987H6.66683C6.49002 7.9987 6.32045 7.92846 6.19543 7.80343C6.0704 7.67841 6.00016 7.50884 6.00016 7.33203C6.00016 7.15522 6.0704 6.98565 6.19543 6.86063C6.32045 6.7356 6.49002 6.66536 6.66683 6.66536H8.00016C8.17698 6.66536 8.34655 6.7356 8.47157 6.86063C8.59659 6.98565 8.66683 7.15522 8.66683 7.33203V9.9987H9.3335C9.51031 9.9987 9.67988 10.0689 9.8049 10.194C9.92993 10.319 10.0002 10.4886 10.0002 10.6654C10.0002 10.8422 9.92993 11.0117 9.8049 11.1368C9.67988 11.2618 9.51031 11.332 9.3335 11.332Z`}}]},De=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`info-icon`,ref:t,icon:Ee}))});De.displayName=`InfoIcon`;let Oe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M10.3536 12.3536C10.1583 12.5488 9.84171 12.5488 9.64645 12.3536L6.64645 9.35355C6.45118 9.15829 6.45118 8.84171 6.64645 8.64645L9.64645 5.64645C9.84171 5.45118 10.1583 5.45118 10.3536 5.64645C10.5488 5.84171 10.5488 6.15829 10.3536 6.35355L7.70711 9L10.3536 11.6464C10.5488 11.8417 10.5488 12.1583 10.3536 12.3536Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},ke=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`more-left-icon`,ref:t,icon:Oe}))});ke.displayName=`MoreLeftIcon`;let Ae={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M6.14645 4.64645C6.34171 4.45118 6.65829 4.45118 6.85355 4.64645L9.85355 7.64645C10.0488 7.84171 10.0488 8.15829 9.85355 8.35355L6.85355 11.3536C6.65829 11.5488 6.34171 11.5488 6.14645 11.3536C5.95118 11.1583 5.95118 10.8417 6.14645 10.6464L8.79289 8L6.14645 5.35355C5.95118 5.15829 5.95118 4.84171 6.14645 4.64645Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},je=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`more-right-icon`,ref:t,icon:Ae}))});je.displayName=`MoreRightIcon`;let Me={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Ne=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`search-icon`,ref:t,icon:Me}))});Ne.displayName=`SearchIcon`;let Pe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.7245 6.42417C11.9588 6.18985 11.9588 5.80995 11.7245 5.57564C11.4901 5.34132 11.1102 5.34132 10.8759 5.57564L7.3002 9.15137L5.72446 7.57564C5.49014 7.34132 5.11025 7.34132 4.87593 7.57564C4.64162 7.80995 4.64162 8.18985 4.87593 8.42417L6.87593 10.4242C7.11025 10.6585 7.49014 10.6585 7.72446 10.4242L11.7245 6.42417Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Fe=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(B,Object.assign({},e,{id:`success-icon`,ref:t,icon:Pe}))});Fe.displayName=`SuccessIcon`;let W=class extends t.Disposable{constructor(e){super(),this.disposeWithMe(e.register({FilterIcon:U}))}};W=g([h(0,(0,t.Inject)(i.IconManager))],W);function Ie(e){let{item:t,label:n,textColor:r=!1,onSelect:i}=e;return(0,u.jsxs)(`button`,{type:`button`,"aria-label":t.color??n,"aria-pressed":t.checked,className:(0,l.clsx)(l.resetButtonClassName,`univer-relative univer-flex univer-size-12 univer-items-center univer-justify-center univer-rounded-full univer-border univer-border-solid univer-border-gray-200 univer-bg-gray-0 dark:!univer-border-gray-600 dark:!univer-bg-gray-800`),style:!r&&t.color?{backgroundColor:t.color}:void 0,onClick:i,children:[!t.color&&(0,u.jsx)(H,{className:`univer-size-7`}),r&&t.color&&(0,u.jsx)(V,{className:`univer-size-7`,style:{color:t.color}}),t.checked&&(0,u.jsx)(`span`,{className:`univer-absolute -univer-bottom-1 -univer-right-1 univer-flex univer-size-5 univer-items-center univer-justify-center univer-rounded-full univer-bg-primary-600 univer-text-gray-0`,children:(0,u.jsx)(Se,{className:`univer-size-3`})})]})}function Le(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.cellFillColors$,[],!0),o=(0,i.useObservable)(n.cellTextColors$,[],!0),s=r.t(`sheets-filter-ui.panel.filter-by-cell-fill-color`),c=r.t(`sheets-filter-ui.panel.filter-by-cell-text-color`),l=a.length>1||o.length>1;return(0,u.jsxs)(`div`,{"data-u-comp":`mobile-sheets-filter-by-colors`,className:`univer-flex univer-min-h-full univer-flex-col univer-gap-6`,children:[a.length>1&&(0,u.jsxs)(`section`,{children:[(0,u.jsx)(`h3`,{className:`univer-m-0 univer-mb-4 univer-text-base univer-font-medium`,children:s}),(0,u.jsx)(`div`,{className:`univer-flex univer-flex-wrap univer-gap-4`,children:a.map(e=>(0,u.jsx)(Ie,{item:e,label:s,onSelect:()=>n.onFilterCheckToggled(e)},e.color??`none`))})]}),o.length>1&&(0,u.jsxs)(`section`,{children:[(0,u.jsx)(`h3`,{className:`univer-m-0 univer-mb-4 univer-text-base univer-font-medium`,children:c}),(0,u.jsx)(`div`,{className:`univer-flex univer-flex-wrap univer-gap-4`,children:o.map(e=>(0,u.jsx)(Ie,{item:e,label:c,textColor:!0,onSelect:()=>n.onFilterCheckToggled(e,!1)},e.color??`none`))})]}),!l&&(0,u.jsx)(`div`,{className:`univer-flex univer-flex-1 univer-items-center univer-justify-center univer-text-gray-500`,children:r.t(`sheets-filter-ui.panel.filter-by-color-none`)})]})}function Re(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.conditionItem$,void 0,!0),o=(0,i.useObservable)(n.filterConditionFormParams$,void 0,!0),s=f.ALL_CONDITIONS.filter(e=>e.numOfParameters!==2).map(e=>({label:r.t(e.label),value:e.operator}));if(!a||!o)return null;function c(e,t,i){let a=f.getItemByOperator(e).numOfParameters===1;return(0,u.jsxs)(`div`,{className:`univer-grid univer-gap-3`,children:[i===`operator2`&&(0,u.jsxs)(l.RadioGroup,{value:o!=null&&o.and?`AND`:`OR`,onChange:e=>n.onConditionFormChange({and:e===`AND`}),children:[(0,u.jsx)(l.Radio,{value:`AND`,children:r.t(`sheets-filter-ui.panel.and`)}),(0,u.jsx)(l.Radio,{value:`OR`,children:r.t(`sheets-filter-ui.panel.or`)})]}),(0,u.jsx)(l.MobileSelect,{value:e,options:s,onChange:e=>n.onConditionFormChange({[i]:e})}),a&&(0,u.jsx)(l.Input,{value:t,placeholder:r.t(`sheets-filter-ui.panel.input-values-placeholder`),onChange:e=>n.onConditionFormChange({[i===`operator1`?`val1`:`val2`]:e})})]})}function d(){return(0,u.jsxs)(`div`,{className:`univer-grid univer-gap-3 univer-pb-4 univer-pl-7`,children:[a.numOfParameters===1&&(0,u.jsx)(l.Input,{value:o.val1??``,placeholder:r.t(`sheets-filter-ui.panel.input-values-placeholder`),onChange:e=>n.onConditionFormChange({val1:e})}),a.numOfParameters>=2&&c(o.operator1,o.val1??``,`operator1`),a.numOfParameters>=2&&c(o.operator2,o.val2??``,`operator2`),(0,u.jsxs)(`p`,{className:`univer-m-0 univer-text-xs univer-text-gray-500`,children:[r.t(`sheets-filter-ui.panel.?`),(0,u.jsx)(`br`,{}),r.t(`sheets-filter-ui.panel.*`)]})]})}return(0,u.jsx)(`div`,{"data-u-comp":`mobile-sheets-filter-by-conditions`,className:`univer-grid univer-gap-4`,children:(0,u.jsx)(`div`,{className:`univer-overflow-hidden univer-rounded-xl univer-bg-gray-0 dark:!univer-bg-gray-800`,children:f.ALL_CONDITIONS.map(e=>{let t=a.operator===e.operator;return(0,u.jsxs)(`div`,{"data-u-comp":`mobile-filter-condition-item`,"data-selected":t,className:`univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-px-4 last:univer-border-b-0 dark:!univer-border-gray-700`,children:[(0,u.jsx)(l.Radio,{value:e.operator,checked:t,onChange:e=>n.onPrimaryConditionChange(e),children:(0,u.jsx)(`span`,{className:`univer-flex univer-min-h-12 univer-items-center univer-text-base`,children:r.t(e.label)})}),t&&a.numOfParameters>0&&d()]},e.operator)})})})}function ze(e){let t=[];return e.forEach(e=>{e.checked&&t.push(e.key),e.children&&(t=t.concat(ze(e.children)))}),t}function Be(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),[a,o]=(0,c.useState)(!1),s=(0,i.useObservable)(n.searchString$,``,!0),d=(0,i.useObservable)(n.filterItems$,[],!0),f=m(d),p=f.checked>0&&f.unchecked===0,h=f.checked>0&&f.unchecked>0,g=r.t(`sheets-filter-ui.panel.search-placeholder`);return(0,u.jsxs)(`div`,{"data-u-comp":`mobile-sheets-filter-by-values`,className:`univer-flex univer-min-h-full univer-flex-col`,children:[(0,u.jsx)(`div`,{className:`univer-flex univer-min-h-14 univer-items-center univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-px-2 dark:!univer-border-gray-700`,children:a?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(l.Input,{autoFocus:!0,className:`univer-flex-1`,value:s,placeholder:g,onChange:e=>n.setSearchString(e)}),(0,u.jsx)(`button`,{type:`button`,"aria-label":r.t(`sheets-filter-ui.panel.cancel`),className:`
2
2
  ${l.resetButtonClassName}
3
3
  univer-ml-2 univer-flex univer-size-10 univer-items-center univer-justify-center
4
- `,onClick:()=>{n.setSearchString(``),o(!1)},children:(0,u.jsx)(Ce,{className:`univer-size-5`})})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.Checkbox,{className:`univer-min-h-12 univer-flex-1 univer-text-base`,contentClassName:`univer-flex univer-items-center univer-gap-1`,indeterminate:h,disabled:d.length===0,checked:p,onChange:()=>n.onCheckAllToggled(!p),children:[(0,u.jsx)(`span`,{children:r.t(`sheets-filter-ui.panel.select-all`)}),(0,u.jsx)(`span`,{className:`univer-text-sm univer-text-gray-500`,children:`(${f.checked}/${f.checked+f.unchecked})`})]}),(0,u.jsx)(`button`,{type:`button`,"aria-label":g,className:`
4
+ `,onClick:()=>{n.setSearchString(``),o(!1)},children:(0,u.jsx)(we,{className:`univer-size-5`})})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.Checkbox,{className:`univer-min-h-12 univer-flex-1 univer-text-base`,contentClassName:`univer-flex univer-items-center univer-gap-1`,indeterminate:h,disabled:d.length===0,checked:p,onChange:()=>n.onCheckAllToggled(!p),children:[(0,u.jsx)(`span`,{children:r.t(`sheets-filter-ui.panel.select-all`)}),(0,u.jsx)(`span`,{className:`univer-text-sm univer-text-gray-500`,children:`(${f.checked}/${f.checked+f.unchecked})`})]}),(0,u.jsx)(`button`,{type:`button`,"aria-label":g,className:`
5
5
  ${l.resetButtonClassName}
6
6
  univer-flex univer-size-12 univer-items-center univer-justify-center
7
- `,onClick:()=>o(!0),children:(0,u.jsx)(Me,{className:`univer-size-6`})})]})}),(0,u.jsx)(`div`,{className:`univer-min-h-0 univer-flex-1 univer-py-2`,children:(0,u.jsx)(l.Tree,{data:d,defaultExpandAll:!1,valueGroup:Re(d),onChange:e=>n.onFilterCheckToggled(e),defaultCache:n.treeMapCache,itemHeight:48,treeNodeClassName:`univer-h-full univer-pr-2 univer-text-base univer-text-gray-900 dark:!univer-text-gray-0`,attachRender:e=>(0,u.jsx)(`span`,{className:`univer-ml-auto univer-text-sm univer-text-gray-500`,children:`(${e.count})`})})})]})}let Be=[{label:`sheets-filter-ui.panel.by-values`,value:n.FilterBy.VALUES},{label:`sheets-filter-ui.panel.by-colors`,value:n.FilterBy.COLORS},{label:`sheets-filter-ui.panel.by-conditions`,value:n.FilterBy.CONDITIONS}];function Ve(){let e=(0,i.useDependency)(t.LocaleService),r=(0,i.useDependency)(i.IMessageService),a=(0,i.useDependency)(n.SheetsFilterSyncController),o=(0,i.useObservable)(a.visible$,!1,!0),s=(0,i.useObservable)(a.enabled$,!0,!0);return o?(0,u.jsxs)(`div`,{className:`univer-flex univer-min-h-20 univer-items-center univer-gap-4 univer-rounded-xl univer-bg-gray-0 univer-px-4 univer-py-3 dark:!univer-bg-gray-800`,children:[(0,u.jsxs)(`div`,{className:`univer-min-w-0 univer-flex-1`,children:[(0,u.jsx)(`div`,{className:`univer-text-base univer-font-medium univer-text-gray-900 dark:!univer-text-gray-100`,children:e.t(`sheets-filter-ui.sync.title`)}),(0,u.jsx)(`div`,{className:`univer-mt-1 univer-text-sm univer-text-gray-500 dark:!univer-text-gray-400`,children:e.t(s?`sheets-filter-ui.sync.statusTips.on`:`sheets-filter-ui.sync.statusTips.off`)})]}),(0,u.jsx)(l.Switch,{defaultChecked:s,onChange:t=>{a.setEnabled(t),r.show({content:e.t(t?`sheets-filter-ui.sync.switchTips.on`:`sheets-filter-ui.sync.switchTips.off`),type:l.MessageType.Success,duration:2e3})}})]}):null}function He(){let e=(0,i.useDependency)(t.IContextService);return(0,i.useObservable)(()=>e.subscribeContextValue$(`FILTER_PANEL_OPENED`).pipe((0,s.map)(Boolean)),!!e.getContextValue(`FILTER_PANEL_OPENED`),!1,[e])?(0,u.jsx)(Ue,{}):null}function Ue(){var e;let r=(0,i.useDependency)(t.ICommandService),a=(0,i.useDependency)(t.LocaleService),o=(0,i.useDependency)(A),d=(0,i.useObservable)(o.filterBy$,n.FilterBy.VALUES,!0),f=(0,i.useObservable)(o.filterByModel$,null),p=(0,i.useObservable)(()=>(f==null?void 0:f.canApply$)??(0,s.of)(!1),!1,!0,[f]),m=(0,i.useObservable)(o.hasCriteria$,!1,!0),h=(0,i.useObservable)(o.col$,o.col,!0),[g,_]=(0,c.useState)(!1),[v,y]=(0,c.useState)(`compact`),b=(0,c.useRef)(null),x=(e=o.filterModel)==null?void 0:e.getRange(),S=g?a.t(Be.find(e=>e.value===d).label):a.t(`sheets-filter-ui.toolbar.smart-toggle-filter-tooltip`);async function C(){await r.executeCommand(P.id)}async function w(e){await r.executeCommand(F.id,{filterBy:e})&&(_(!0),y(`expanded`))}async function T(){await(f==null?void 0:f.clear()),await C()}async function E(){await(f==null?void 0:f.apply()),await C()}function D(){if(g){_(!1),y(`compact`);return}C().catch(()=>void 0)}function O(e){let t=h+e;!x||t<x.startColumn||t>x.endColumn||o.setupCol(o.filterModel,t)}return(0,u.jsx)(`div`,{ref:b,className:`univer-pointer-events-none univer-fixed univer-inset-0 univer-z-[1100]`,children:(0,u.jsx)(i.MobileDrawer,{layerRef:b,componentName:`mobile-sheets-filter-drawer`,snap:v,expandLabel:a.t(`sheets-filter-ui.panel.mobile.resize`),collapseLabel:a.t(`sheets-filter-ui.panel.mobile.resize`),onSnapChange:y,onClose:()=>C().catch(()=>void 0),role:`dialog`,ariaLabel:S,panelClassName:`univer-pointer-events-auto`,contentClassName:`univer-min-h-0 univer-px-4 univer-pb-4`,header:(0,u.jsxs)(`div`,{className:`univer-grid univer-h-12 univer-flex-1 univer-grid-cols-[56px_minmax(0,1fr)_56px] univer-items-center univer-px-2`,children:[(0,u.jsx)(`button`,{type:`button`,"aria-label":a.t(`sheets-filter-ui.panel.mobile.back`),className:`
7
+ `,onClick:()=>o(!0),children:(0,u.jsx)(Ne,{className:`univer-size-6`})})]})}),(0,u.jsx)(`div`,{className:`univer-min-h-0 univer-flex-1 univer-py-2`,children:(0,u.jsx)(l.Tree,{data:d,defaultExpandAll:!1,valueGroup:ze(d),onChange:e=>n.onFilterCheckToggled(e),defaultCache:n.treeMapCache,itemHeight:48,treeNodeClassName:`univer-h-full univer-pr-2 univer-text-base univer-text-gray-900 dark:!univer-text-gray-0`,attachRender:e=>(0,u.jsx)(`span`,{className:`univer-ml-auto univer-text-sm univer-text-gray-500`,children:`(${e.count})`})})})]})}let Ve=[{label:`sheets-filter-ui.panel.by-values`,value:n.FilterBy.VALUES},{label:`sheets-filter-ui.panel.by-colors`,value:n.FilterBy.COLORS},{label:`sheets-filter-ui.panel.by-conditions`,value:n.FilterBy.CONDITIONS}];function He(){let e=(0,i.useDependency)(t.LocaleService),r=(0,i.useDependency)(i.IMessageService),a=(0,i.useDependency)(n.SheetsFilterSyncController),o=(0,i.useObservable)(a.visible$,!1,!0),s=(0,i.useObservable)(a.enabled$,!0,!0);return o?(0,u.jsxs)(`div`,{className:`univer-flex univer-min-h-20 univer-items-center univer-gap-4 univer-rounded-xl univer-bg-gray-0 univer-px-4 univer-py-3 dark:!univer-bg-gray-800`,children:[(0,u.jsxs)(`div`,{className:`univer-min-w-0 univer-flex-1`,children:[(0,u.jsx)(`div`,{className:`univer-text-base univer-font-medium univer-text-gray-900 dark:!univer-text-gray-100`,children:e.t(`sheets-filter-ui.sync.title`)}),(0,u.jsx)(`div`,{className:`univer-mt-1 univer-text-sm univer-text-gray-500 dark:!univer-text-gray-400`,children:e.t(s?`sheets-filter-ui.sync.statusTips.on`:`sheets-filter-ui.sync.statusTips.off`)})]}),(0,u.jsx)(l.Switch,{defaultChecked:s,onChange:t=>{a.setEnabled(t),r.show({content:e.t(t?`sheets-filter-ui.sync.switchTips.on`:`sheets-filter-ui.sync.switchTips.off`),type:l.MessageType.Success,duration:2e3})}})]}):null}function Ue(){let e=(0,i.useDependency)(t.IContextService);return(0,i.useObservable)(()=>e.subscribeContextValue$(`FILTER_PANEL_OPENED`).pipe((0,s.map)(Boolean)),!!e.getContextValue(`FILTER_PANEL_OPENED`),!1,[e])?(0,u.jsx)(We,{}):null}function We(){var e;let r=(0,i.useDependency)(t.ICommandService),a=(0,i.useDependency)(t.LocaleService),o=(0,i.useDependency)(A),d=(0,i.useObservable)(o.filterBy$,n.FilterBy.VALUES,!0),f=(0,i.useObservable)(o.filterByModel$,null),p=(0,i.useObservable)(()=>(f==null?void 0:f.canApply$)??(0,s.of)(!1),!1,!0,[f]),m=(0,i.useObservable)(o.hasCriteria$,!1,!0),h=(0,i.useObservable)(o.col$,o.col,!0),[g,_]=(0,c.useState)(!1),[v,y]=(0,c.useState)(`compact`),b=(0,c.useRef)(null),x=(e=o.filterModel)==null?void 0:e.getRange(),S=g?a.t(Ve.find(e=>e.value===d).label):a.t(`sheets-filter-ui.toolbar.smart-toggle-filter-tooltip`);async function C(){await r.executeCommand(F.id)}async function w(e){await r.executeCommand(I.id,{filterBy:e})&&(_(!0),y(`expanded`))}async function T(){await(f==null?void 0:f.clear()),await C()}async function E(){await(f==null?void 0:f.apply()),await C()}function D(){if(g){_(!1),y(`compact`);return}C().catch(()=>void 0)}function ee(e){let t=h+e;!x||t<x.startColumn||t>x.endColumn||o.setupCol(o.filterModel,t)}return(0,u.jsx)(`div`,{ref:b,className:`univer-pointer-events-none univer-fixed univer-inset-0 univer-z-[1100]`,children:(0,u.jsx)(i.MobileDrawer,{layerRef:b,componentName:`mobile-sheets-filter-drawer`,snap:v,expandLabel:a.t(`sheets-filter-ui.panel.mobile.resize`),collapseLabel:a.t(`sheets-filter-ui.panel.mobile.resize`),onSnapChange:y,onClose:()=>C().catch(()=>void 0),role:`dialog`,ariaLabel:S,panelClassName:`univer-pointer-events-auto`,contentClassName:`univer-min-h-0 univer-px-4 univer-pb-4`,header:(0,u.jsxs)(`div`,{className:`univer-grid univer-h-12 univer-flex-1 univer-grid-cols-[56px_minmax(0,1fr)_56px] univer-items-center univer-px-2`,children:[(0,u.jsx)(`button`,{type:`button`,"aria-label":a.t(`sheets-filter-ui.panel.mobile.back`),className:`
8
8
  ${l.resetButtonClassName}
9
9
  univer-flex univer-size-12 univer-items-center univer-justify-center
10
- `,onClick:D,children:(0,u.jsx)(Oe,{className:`univer-size-6`})}),(0,u.jsx)(`div`,{className:`univer-truncate univer-text-center univer-text-base univer-font-semibold`,children:S})]}),footer:g?(0,u.jsx)(`div`,{className:`univer-shrink-0 univer-border-0 univer-border-t univer-border-solid univer-border-gray-200 univer-p-4 dark:!univer-border-gray-700`,children:(0,u.jsxs)(l.MobileActionRowGroup,{children:[(0,u.jsx)(l.Button,{onClick:()=>C().catch(()=>void 0),children:a.t(`sheets-filter-ui.panel.cancel`)}),(0,u.jsx)(l.Button,{variant:`primary`,disabled:!p||!f,onClick:()=>E().catch(()=>void 0),children:a.t(`sheets-filter-ui.panel.confirm`)})]})}):void 0,children:g?(0,u.jsxs)(`div`,{className:`univer-flex univer-min-h-full univer-flex-col`,children:[(0,u.jsxs)(`div`,{className:`univer-flex univer-min-h-14 univer-items-center univer-justify-between univer-px-2`,children:[(0,u.jsx)(`span`,{className:`univer-text-base univer-font-medium`,children:a.t(`sheets-filter-ui.panel.mobile.column`,t.Tools.chatAtABC(h))}),(0,u.jsxs)(`div`,{className:`univer-flex univer-gap-2`,children:[(0,u.jsx)(l.Button,{disabled:!x||h<=x.startColumn,onClick:()=>O(-1),children:a.t(`sheets-filter-ui.panel.mobile.previous-column`)}),(0,u.jsx)(l.Button,{disabled:!x||h>=x.endColumn,onClick:()=>O(1),children:a.t(`sheets-filter-ui.panel.mobile.next-column`)})]})]}),(0,u.jsxs)(`div`,{className:`univer-min-h-0 univer-flex-1`,children:[d===n.FilterBy.VALUES&&f?(0,u.jsx)(ze,{model:f}):null,d===n.FilterBy.COLORS&&f?(0,u.jsx)(Ie,{model:f}):null,d===n.FilterBy.CONDITIONS&&f?(0,u.jsx)(Le,{model:f}):null]})]}):(0,u.jsxs)(`div`,{className:`univer-grid univer-gap-4`,children:[(0,u.jsx)(`div`,{className:`univer-overflow-hidden univer-rounded-xl univer-bg-gray-0 dark:!univer-bg-gray-800`,children:Be.map(e=>{let t=a.t(e.label);return(0,u.jsx)(l.MobileActionRow,{title:t,"aria-label":t,className:`univer-rounded-none`,trailing:(0,u.jsx)(Ae,{className:`univer-size-5 univer-text-gray-400`}),onClick:()=>w(e.value).catch(()=>void 0)},e.value)})}),(0,u.jsx)(Ve,{}),(0,u.jsx)(l.Button,{size:`large`,disabled:!m||!f,onClick:()=>T().catch(()=>void 0),children:a.t(`sheets-filter-ui.panel.clear-filter`)})]})})})}let We=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`);var Ge=class{static drawNoCriteria(e,t,n,r){e.save(),a.Rect.drawWith(e,{radius:2,width:16,height:16,fill:r}),e.lineCap=`square`,e.strokeStyle=n,e.scale(t/16,t/16),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()}static drawHasCriteria(e,t,n,r){e.save(),a.Rect.drawWith(e,{radius:2,width:16,height:16,fill:r}),e.scale(t/16,t/16),e.fillStyle=n,e.fill(We),e.restore()}};let G=class extends a.Shape{constructor(e,t,n,r,i){super(e,t),this._contextService=n,this._commandService=r,this._themeService=i,k(this,`_cellWidth`,0),k(this,`_cellHeight`,0),k(this,`_filterParams`,void 0),k(this,`_hovered`,!1),this.setShapeProps(t),this.onPointerDown$.subscribeEvent(e=>this.onPointerDown(e)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(e){e.cellHeight!==void 0&&(this._cellHeight=e.cellHeight),e.cellWidth!==void 0&&(this._cellWidth=e.cellWidth),e.filterParams!==void 0&&(this._filterParams=e.filterParams),this.transformByState({width:e.width,height:e.height})}_draw(e){let t=this._cellHeight,n=this._cellWidth,r=16-n,i=16-t;e.save();let a=new Path2D;a.rect(r,i,n,t),e.clip(a);let{hasCriteria:o}=this._filterParams,s=this._themeService.getColorFromTheme(`primary.600`),c=this._hovered?this._themeService.getColorFromTheme(`gray.50`):`rgba(255, 255, 255, 1.0)`;o?Ge.drawHasCriteria(e,16,s,c):Ge.drawNoCriteria(e,16,s,c),e.restore()}onPointerDown(e){if(e.button===2)return;let{col:t,unitId:n,subUnitId:r}=this._filterParams;this._contextService.getContextValue(`FILTER_PANEL_OPENED`)||!this._commandService.hasCommand(N.id)||setTimeout(()=>{this._commandService.executeCommand(N.id,{unitId:n,subUnitId:r,col:t})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};G=g([h(2,t.IContextService),h(3,t.ICommandService),h(4,(0,t.Inject)(t.ThemeService))],G);function Ke(e,n,r,i){switch(i){case t.VerticalAlign.TOP:return e+1;case t.VerticalAlign.MIDDLE:return e+Math.max(0,(r-16)/2);case t.VerticalAlign.BOTTOM:default:return n-16-1}}let K=class extends t.RxDisposable{constructor(e,t,n,r,i,a,o,s){super(),this._context=e,this._injector=t,this._sheetSkeletonManagerService=n,this._sheetsFilterService=r,this._themeService=i,this._sheetInterceptorService=a,this._commandService=o,this._selectionRenderService=s,k(this,`_currentRenderParams`,null),k(this,`_filterRangeShape`,null),k(this,`_buttonRenderDisposable`,null),k(this,`_filterButtonShapes`,[]),this._initRenderer()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){this.disposeWithMe(this._themeService.currentTheme$.subscribe(()=>{this._refreshRendering(this._currentRenderParams)})),this._sheetSkeletonManagerService.currentSkeleton$.pipe((0,s.switchMap)(e=>{var r;if(!e)return(0,s.of)(null);let{unit:i,unitId:a}=this._context,c=((r=i.getActiveSheet())==null?void 0:r.getSheetId())||``,l=this._sheetsFilterService.getFilterModel(a,c)??void 0,u=()=>({unitId:a,worksheetId:c,filterModel:l,range:l==null?void 0:l.getRange(),skeleton:e.skeleton});return(0,t.fromCallback)(this._commandService.onCommandExecuted.bind(this._commandService)).pipe((0,s.filter)(([e])=>{var r;return e.type===t.CommandType.MUTATION&&((r=e.params)==null?void 0:r.unitId)===i.getUnitId()&&(n.FILTER_MUTATIONS.has(e.id)||e.id===o.SetRangeValuesMutation.id)}),(0,s.throttleTime)(20,void 0,{leading:!1,trailing:!0}),(0,s.map)(u),(0,s.startWith)(u()))}),(0,s.takeUntil)(this.dispose$)).subscribe(e=>{this._currentRenderParams=e,this._refreshRendering(e)})}_refreshRendering(e){this._disposeRendering(),!(!e||!e.range)&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))}_renderRange(e,t){let{scene:n}=this._context,{rowHeaderWidth:i,columnHeaderHeight:a}=t,s=this._filterRangeShape=new r.SelectionControl(n,1e3,this._themeService,{rowHeaderWidth:i,columnHeaderHeight:a,enableAutoFill:!1,highlightHeader:!1}),c=(0,o.attachSelectionWithCoord)({range:e,primary:null,style:{fill:`rgba(0, 0, 0, 0.0)`}},t);s.updateRangeBySelectionWithCoord(c),s.setEvent(!1),n.makeDirty(!0)}_renderButtons(e){let{range:n,filterModel:i,unitId:a,skeleton:o,worksheetId:s}=e,{unit:c,scene:l}=this._context,u=c.getSheetBySheetId(s);if(!u)return;this._interceptCellContent(a,s,e.range);let{startColumn:d,endColumn:f,startRow:p}=n;for(let e=d;e<=f;e++){let n=`sheets-filter-button-${e}`,c=(0,r.getCoordByCell)(p,e,l,o),d=u.getComposedCellStyle(p,e),f=(d==null?void 0:d.vt)||t.VerticalAlign.BOTTOM,{startX:m,startY:h,endX:g,endY:_}=c,v=g-m,y=_-h;if(y<=1||v<=1)continue;let b=!!i.getFilterColumn(e),x={left:g-16-1,top:Ke(h,_,y,f),height:16,width:16,zIndex:5e3,cellHeight:y,cellWidth:v,filterParams:{unitId:a,subUnitId:s,col:e,hasCriteria:b}},S=this._injector.createInstance(G,n,x);this._filterButtonShapes.push(S)}l.addObjects(this._filterButtonShapes),l.makeDirty()}_interceptCellContent(e,n,r){let{startRow:i,startColumn:a,endColumn:s}=r;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(o.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,handler:(t,r,o)=>{let{row:c,col:l,unitId:u,subUnitId:d}=r;return u!==e||d!==n||c!==i||l<a||l>s?o(t):((!t||t===r.rawData)&&(t={...r.rawData}),t.fontRenderExtension={...t==null?void 0:t.fontRenderExtension,rightOffset:16},o(t))},priority:10})}_disposeRendering(){var e,t;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(e=>e.dispose()),(t=this._buttonRenderDisposable)==null||t.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};K=g([h(1,(0,t.Inject)(t.Injector)),h(2,(0,t.Inject)(r.SheetSkeletonManagerService)),h(3,(0,t.Inject)(n.SheetsFilterService)),h(4,(0,t.Inject)(t.ThemeService)),h(5,(0,t.Inject)(o.SheetInterceptorService)),h(6,t.ICommandService),h(7,r.ISheetSelectionRenderService)],K);let q=class extends t.RxDisposable{constructor(e,r,a,o,s,c,u,d){super(),[F,N,P].forEach(e=>{this.disposeWithMe(r.registerCommand(e))}),[n.SetSheetsFilterRangeMutation,n.SetSheetsFilterCriteriaMutation,n.RemoveSheetsFilterMutation,n.ReCalcSheetsFilterMutation].forEach(e=>{this.disposeWithMe(d.registerSkeletonChangingMutations(e.id))}),this.disposeWithMe(u.registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[K])),this.disposeWithMe(c.registerComponent(i.BuiltInUIPart.GLOBAL,()=>(0,i.connectInjector)(He,e))),this.disposeWithMe(o.errorMsg$.subscribe(e=>{e&&s.show({type:l.MessageType.Error,content:a.t(e)})}))}};q=g([h(0,(0,t.Inject)(t.Injector)),h(1,t.ICommandService),h(2,(0,t.Inject)(t.LocaleService)),h(3,(0,t.Inject)(n.SheetsFilterService)),h(4,i.IMessageService),h(5,i.IUIPartsService),h(6,a.IRenderManagerService),h(7,(0,t.Inject)(r.SheetsRenderService))],q);let J=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._sheetsFilterService=e,this._localeService=t,this._commandService=n,this._sheetPermissionCheckPermission=r,this._injector=i,this._sheetsSelectionService=a,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===n.SmartToggleSheetsFilterCommand.id){var r;let e=(0,o.getSheetCommandTarget)(this._injector.get(t.IUniverInstanceService));if(!e)return;let{unitId:n,subUnitId:a,worksheet:s}=e,c=(r=this._sheetsFilterService.getFilterModel(n,a))==null?void 0:r.getRange(),l;if(c)l=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetFilterPermission,o.WorksheetViewPermission]},[c],n,a);else{var i;let e=(i=this._sheetsSelectionService.getCurrentLastSelection())==null?void 0:i.range;if(e){let t={...e};t=e.startColumn===e.endColumn&&e.startRow===e.endRow?(0,o.expandToContinuousRange)(t,{left:!0,right:!0,up:!0,down:!0},s):t,l=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetViewPermission,o.WorksheetFilterPermission]},[t],n,a)}else l=this._sheetPermissionCheckPermission.permissionCheckWithoutRange({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetViewPermission,o.WorksheetFilterPermission]})}l||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t(`sheets-filter-ui.permission.filterErr`))}if(e.id===N.id){var a;let n=e.params,{unitId:r,subUnitId:i}=n,s=(a=this._sheetsFilterService.getFilterModel(r,i))==null?void 0:a.getRange(),c=t.Tools.deepClone(s);c&&(c.startColumn=n.col,c.endColumn=n.col,this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetFilterPermission,o.WorksheetViewPermission]},[c],r,i)||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t(`sheets-filter-ui.permission.filterErr`)))}}))}};J=g([h(0,(0,t.Inject)(n.SheetsFilterService)),h(1,(0,t.Inject)(t.LocaleService)),h(2,t.ICommandService),h(3,(0,t.Inject)(o.SheetPermissionCheckController)),h(4,(0,t.Inject)(t.Injector)),h(5,(0,t.Inject)(o.SheetsSelectionsService))],J);let Y=class extends t.Plugin{constructor(e=R,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{menu:i,...a}=(0,t.merge)({},R,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(L,a)}onStarting(){this._injector.add([W]),this._injector.get(W),[[A,{useClass:j}],[J],[z],[q]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(J),this._injector.get(z)}onRendered(){this._injector.get(q)}};k(Y,`type`,t.UniverInstanceType.UNIVER_SHEET),k(Y,`pluginName`,`SHEET_FILTER_UI_PLUGIN`),k(Y,`packageName`,de),k(Y,`version`,I),Y=g([(0,t.DependentOn)(a.UniverRenderEnginePlugin,o.UniverSheetsPlugin,i.UniverMobileUIPlugin,n.UniverSheetsFilterPlugin,r.UniverSheetsMobileUIPlugin),h(1,(0,t.Inject)(t.Injector)),h(2,t.IConfigService)],Y);function qe(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.cellFillColors$,[],!0),o=(0,i.useObservable)(n.cellTextColors$,[],!0),s=(0,c.useCallback)(e=>{n.onFilterCheckToggled(e)},[n]),d=(0,c.useCallback)(e=>{n.onFilterCheckToggled(e,!1)},[n]);return(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-colors-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel`,className:(0,l.clsx)(`univer-mt-2 univer-box-border univer-flex univer-h-[300px] univer-flex-grow univer-flex-col univer-gap-4 univer-overflow-auto univer-rounded-md univer-px-2 univer-py-2.5`,l.borderClassName),children:[a.length>1&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`univer-mb-2 univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0`,children:r.t(`sheets-filter-ui.panel.filter-by-cell-fill-color`)}),(0,u.jsx)(`div`,{className:`univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2`,children:a.map((e,t)=>(0,u.jsxs)(`div`,{className:`univer-relative univer-size-6`,onClick:()=>s(e),children:[e.color?(0,u.jsx)(`button`,{type:`button`,className:(0,l.clsx)(`univer-box-border univer-size-6 univer-cursor-pointer univer-rounded-full univer-border univer-border-solid univer-border-transparent univer-bg-gray-300 univer-transition-shadow hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-gray-0`),style:{backgroundColor:e.color}}):(0,u.jsx)(H,{className:`univer-size-6 univer-cursor-pointer univer-rounded-full hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-gray-0`}),e.checked&&(0,u.jsx)(Je,{})]},`sheets-filter-cell-fill-color-${t}`))})]}),o.length>1&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`univer-mb-2 univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0`,children:r.t(`sheets-filter-ui.panel.filter-by-cell-text-color`)}),(0,u.jsx)(`div`,{className:`univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2`,children:o.map((e,t)=>(0,u.jsxs)(`div`,{className:`univer-relative univer-size-6`,onClick:()=>d(e),children:[(0,u.jsx)(`div`,{className:`univer-box-border univer-flex univer-size-full univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-border univer-border-solid univer-border-[rgba(13,13,13,0.06)] univer-p-0.5 hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-gray-0 dark:!univer-border-[rgba(255,255,255,0.06)]`,children:(0,u.jsx)(V,{style:{color:e.color}})}),e.checked&&(0,u.jsx)(Je,{})]},`sheets-filter-cell-text-color-${t}`))})]}),a.length<=1&&o.length<=1&&(0,u.jsx)(`div`,{className:`univer-flex univer-size-full univer-items-center univer-justify-center univer-text-sm univer-text-gray-900 dark:!univer-text-gray-200`,children:r.t(`sheets-filter-ui.panel.filter-by-color-none`)})]})})}function Je(){return(0,u.jsx)(`div`,{className:`univer-absolute -univer-bottom-0.5 -univer-right-0.5 univer-flex univer-size-3 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-bg-gray-0`,children:(0,u.jsx)(Pe,{className:`univer-size-full univer-font-bold univer-text-[#418F1F]`})})}let Ye=[[f.NONE],[f.EMPTY,f.NOT_EMPTY],[f.TEXT_CONTAINS,f.DOES_NOT_CONTAIN,f.STARTS_WITH,f.ENDS_WITH,f.EQUALS],[f.GREATER_THAN,f.GREATER_THAN_OR_EQUAL,f.LESS_THAN,f.LESS_THAN_OR_EQUAL,f.EQUAL,f.NOT_EQUAL,f.BETWEEN,f.NOT_BETWEEN],[f.CUSTOM]];function Xe(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.conditionItem$,void 0),o=(0,i.useObservable)(n.filterConditionFormParams$,void 0),s=o!=null&&o.and?`AND`:`OR`,d=(0,c.useCallback)(e=>{n.onConditionFormChange({and:e===`AND`})},[n]),p=Ye.map(e=>({options:e.map(e=>({label:r.t(e.label),value:e.operator}))})),m=(0,c.useCallback)(e=>{n.onPrimaryConditionChange(e)},[n]),h=f.ALL_CONDITIONS.filter(e=>e.numOfParameters!==2).map(e=>({label:r.t(e.label),value:e.operator})),g=(0,c.useCallback)(e=>{n.onConditionFormChange(e)},[n]),_=r.t(`sheets-filter-ui.panel.input-values-placeholder`);function v(e,t,n){let i=f.getItemByOperator(e).numOfParameters===1;return(0,u.jsxs)(u.Fragment,{children:[n===`operator2`&&(0,u.jsxs)(l.RadioGroup,{value:s,onChange:d,children:[(0,u.jsx)(l.Radio,{value:`AND`,children:r.t(`sheets-filter-ui.panel.and`)}),(0,u.jsx)(l.Radio,{value:`OR`,children:r.t(`sheets-filter-ui.panel.or`)})]}),(0,u.jsx)(l.Select,{value:e,options:h,onChange:e=>g({[n]:e})}),i&&(0,u.jsx)(`div`,{children:(0,u.jsx)(l.Input,{className:`univer-mt-2`,value:t,placeholder:_,onChange:e=>g({[n===`operator1`?`val1`:`val2`]:e})})})]})}return(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-conditions-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:a&&o&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(l.Select,{value:a.operator,options:p,onChange:m}),f.getItemByOperator(a.operator).numOfParameters===0?null:(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-conditions-container-inner`,className:(0,l.clsx)(`univer-mt-2 univer-flex-grow univer-overflow-hidden univer-rounded-md univer-p-2`,l.borderClassName),children:[a.numOfParameters>=1&&v(o.operator1,o.val1??``,`operator1`),a.numOfParameters>=2&&v(o.operator2,o.val2??``,`operator2`),(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-conditions-desc`,className:`univer-mt-2 univer-text-xs univer-text-gray-500`,children:[r.t(`sheets-filter-ui.panel.?`),(0,u.jsx)(`br`,{}),r.t(`sheets-filter-ui.panel.*`)]})]})]})})}function Ze(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.searchString$,``,!0),o=(0,i.useObservable)(n.filterItems$,void 0,!0),s=r.t(`sheets-filter-ui.panel.filter-only`),d=m(o),f=d.checked>0&&d.unchecked===0,p=d.checked>0&&d.unchecked>0,h=n.treeMapCache,g=(0,c.useCallback)(()=>{n.onCheckAllToggled(!f)},[n,f]),_=(0,c.useCallback)(e=>{n.setSearchString(e)},[n]);function v(e){let t=[];return e.forEach(e=>{e.checked&&t.push(e.key),e.children&&(t=t.concat(v(e.children)))}),t}return(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-values-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:[(0,u.jsx)(l.Input,{autoFocus:!0,value:a,placeholder:r.t(`sheets-filter-ui.panel.search-placeholder`),onChange:_}),(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel`,className:(0,l.clsx)(`univer-mt-2 univer-box-border univer-flex univer-flex-grow univer-flex-col univer-overflow-hidden univer-rounded-md univer-px-2 univer-py-2.5`,l.borderClassName),children:[(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-values-item`,className:`univer-box-border univer-h-8 univer-w-full univer-py-0.5`,children:(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-values-item-inner`,className:`univer-box-border univer-flex univer-h-7 univer-items-center univer-rounded-md univer-py-0 univer-pl-5 univer-pr-0.5 univer-text-sm`,children:[(0,u.jsx)(l.Checkbox,{indeterminate:p,disabled:o.length===0,checked:f,onChange:g}),(0,u.jsx)(`span`,{"data-u-comp":`sheets-filter-panel-values-item-text`,className:`univer-mx-1 univer-inline-block univer-flex-shrink univer-truncate univer-text-gray-900 dark:!univer-text-gray-0`,children:`${r.t(`sheets-filter-ui.panel.select-all`)}`}),(0,u.jsx)(`span`,{"data-u-comp":`sheets-filter-panel-values-item-count`,className:`univer-text-gray-400 dark:!univer-text-gray-500`,children:`(${d.checked}/${d.checked+d.unchecked})`})]})}),(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-values-virtual`,className:`univer-flex-grow`,children:(0,u.jsx)(l.Tree,{data:o,defaultExpandAll:!1,valueGroup:v(o),onChange:e=>{n.onFilterCheckToggled(e)},defaultCache:h,itemHeight:28,treeNodeClassName:`
10
+ `,onClick:D,children:(0,u.jsx)(ke,{className:`univer-size-6`})}),(0,u.jsx)(`div`,{className:`univer-truncate univer-text-center univer-text-base univer-font-semibold`,children:S})]}),footer:g?(0,u.jsx)(`div`,{className:`univer-shrink-0 univer-border-0 univer-border-t univer-border-solid univer-border-gray-200 univer-p-4 dark:!univer-border-gray-700`,children:(0,u.jsxs)(l.MobileActionRowGroup,{children:[(0,u.jsx)(l.Button,{onClick:()=>C().catch(()=>void 0),children:a.t(`sheets-filter-ui.panel.cancel`)}),(0,u.jsx)(l.Button,{variant:`primary`,disabled:!p||!f,onClick:()=>E().catch(()=>void 0),children:a.t(`sheets-filter-ui.panel.confirm`)})]})}):void 0,children:g?(0,u.jsxs)(`div`,{className:`univer-flex univer-min-h-full univer-flex-col`,children:[(0,u.jsxs)(`div`,{className:`univer-flex univer-min-h-14 univer-items-center univer-justify-between univer-px-2`,children:[(0,u.jsx)(`span`,{className:`univer-text-base univer-font-medium`,children:a.t(`sheets-filter-ui.panel.mobile.column`,t.Tools.chatAtABC(h))}),(0,u.jsxs)(`div`,{className:`univer-flex univer-gap-2`,children:[(0,u.jsx)(l.Button,{disabled:!x||h<=x.startColumn,onClick:()=>ee(-1),children:a.t(`sheets-filter-ui.panel.mobile.previous-column`)}),(0,u.jsx)(l.Button,{disabled:!x||h>=x.endColumn,onClick:()=>ee(1),children:a.t(`sheets-filter-ui.panel.mobile.next-column`)})]})]}),(0,u.jsxs)(`div`,{className:`univer-min-h-0 univer-flex-1`,children:[d===n.FilterBy.VALUES&&f?(0,u.jsx)(Be,{model:f}):null,d===n.FilterBy.COLORS&&f?(0,u.jsx)(Le,{model:f}):null,d===n.FilterBy.CONDITIONS&&f?(0,u.jsx)(Re,{model:f}):null]})]}):(0,u.jsxs)(`div`,{className:`univer-grid univer-gap-4`,children:[(0,u.jsx)(`div`,{className:`univer-overflow-hidden univer-rounded-xl univer-bg-gray-0 dark:!univer-bg-gray-800`,children:Ve.map(e=>{let t=a.t(e.label);return(0,u.jsx)(l.MobileActionRow,{title:t,"aria-label":t,className:`univer-rounded-none`,trailing:(0,u.jsx)(je,{className:`univer-size-5 univer-text-gray-400`}),onClick:()=>w(e.value).catch(()=>void 0)},e.value)})}),(0,u.jsx)(He,{}),(0,u.jsx)(l.Button,{size:`large`,disabled:!m||!f,onClick:()=>T().catch(()=>void 0),children:a.t(`sheets-filter-ui.panel.clear-filter`)})]})})})}let Ge=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`);var Ke=class{static drawNoCriteria(e,t,n,r){e.save(),a.Rect.drawWith(e,{radius:2,width:16,height:16,fill:r}),e.lineCap=`square`,e.strokeStyle=n,e.scale(t/16,t/16),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()}static drawHasCriteria(e,t,n,r){e.save(),a.Rect.drawWith(e,{radius:2,width:16,height:16,fill:r}),e.scale(t/16,t/16),e.fillStyle=n,e.fill(Ge),e.restore()}};let G=class extends a.Shape{constructor(e,t,n,r,i){super(e,t),this._contextService=n,this._commandService=r,this._themeService=i,O(this,`_cellWidth`,0),O(this,`_cellHeight`,0),O(this,`_filterParams`,void 0),O(this,`_hovered`,!1),this.setShapeProps(t),this.onPointerDown$.subscribeEvent(e=>this.onPointerDown(e)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(e){e.cellHeight!==void 0&&(this._cellHeight=e.cellHeight),e.cellWidth!==void 0&&(this._cellWidth=e.cellWidth),e.filterParams!==void 0&&(this._filterParams=e.filterParams),this.transformByState({width:e.width,height:e.height})}_draw(e){let t=this._cellHeight,n=this._cellWidth,r=16-n,i=16-t;e.save();let a=new Path2D;a.rect(r,i,n,t),e.clip(a);let{hasCriteria:o}=this._filterParams,s=this._themeService.getColorFromTheme(`primary.600`),c=this._hovered?this._themeService.getColorFromTheme(`gray.50`):`rgba(255, 255, 255, 1.0)`;o?Ke.drawHasCriteria(e,16,s,c):Ke.drawNoCriteria(e,16,s,c),e.restore()}onPointerDown(e){if(e.button===2)return;let{col:t,unitId:n,subUnitId:r}=this._filterParams;!this._contextService.getContextValue(`FILTER_PANEL_OPENED`)&&this._commandService.hasCommand(P.id)&&setTimeout(()=>{this._commandService.executeCommand(P.id,{unitId:n,subUnitId:r,col:t})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};G=g([h(2,t.IContextService),h(3,t.ICommandService),h(4,(0,t.Inject)(t.ThemeService))],G);function qe(e,n,r,i){switch(i){case t.VerticalAlign.TOP:return e+1;case t.VerticalAlign.MIDDLE:return e+Math.max(0,(r-16)/2);case t.VerticalAlign.BOTTOM:default:return n-16-1}}let K=class extends t.RxDisposable{constructor(e,t,n,r,i,a,o,s){super(),this._context=e,this._injector=t,this._sheetSkeletonManagerService=n,this._sheetsFilterService=r,this._themeService=i,this._sheetInterceptorService=a,this._commandService=o,this._selectionRenderService=s,O(this,`_currentRenderParams`,null),O(this,`_filterRangeShape`,null),O(this,`_buttonRenderDisposable`,null),O(this,`_filterButtonShapes`,[]),this._initRenderer()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){this.disposeWithMe(this._themeService.currentTheme$.subscribe(()=>{this._refreshRendering(this._currentRenderParams)})),this._sheetSkeletonManagerService.currentSkeleton$.pipe((0,s.switchMap)(e=>{var r;if(!e)return(0,s.of)(null);let{unit:i,unitId:a}=this._context,c=((r=i.getActiveSheet())==null?void 0:r.getSheetId())||``,l=this._sheetsFilterService.getFilterModel(a,c)??void 0,u=()=>({unitId:a,worksheetId:c,filterModel:l,range:l==null?void 0:l.getRange(),skeleton:e.skeleton});return(0,t.fromCallback)(this._commandService.onCommandExecuted.bind(this._commandService)).pipe((0,s.filter)(([e])=>{var r;return e.type===t.CommandType.MUTATION&&((r=e.params)==null?void 0:r.unitId)===i.getUnitId()&&(n.FILTER_MUTATIONS.has(e.id)||e.id===o.SetRangeValuesMutation.id)}),(0,s.throttleTime)(20,void 0,{leading:!1,trailing:!0}),(0,s.map)(u),(0,s.startWith)(u()))}),(0,s.takeUntil)(this.dispose$)).subscribe(e=>{this._currentRenderParams=e,this._refreshRendering(e)})}_refreshRendering(e){this._disposeRendering(),e&&e.range&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))}_renderRange(e,t){let{scene:n}=this._context,{rowHeaderWidth:i,columnHeaderHeight:a}=t,s=this._filterRangeShape=new r.SelectionControl(n,1e3,this._themeService,{rowHeaderWidth:i,columnHeaderHeight:a,enableAutoFill:!1,highlightHeader:!1}),c=(0,o.attachSelectionWithCoord)({range:e,primary:null,style:{fill:`rgba(0, 0, 0, 0.0)`}},t);s.updateRangeBySelectionWithCoord(c),s.setEvent(!1),n.makeDirty(!0)}_renderButtons(e){let{range:n,filterModel:i,unitId:a,skeleton:o,worksheetId:s}=e,{unit:c,scene:l}=this._context,u=c.getSheetBySheetId(s);if(!u)return;this._interceptCellContent(a,s,e.range);let{startColumn:d,endColumn:f,startRow:p}=n;for(let e=d;e<=f;e++){let n=`sheets-filter-button-${e}`,c=(0,r.getCoordByCell)(p,e,l,o),d=u.getComposedCellStyle(p,e),f=(d==null?void 0:d.vt)||t.VerticalAlign.BOTTOM,{startX:m,startY:h,endX:g,endY:_}=c,v=g-m,y=_-h;if(y<=1||v<=1)continue;let b=!!i.getFilterColumn(e),x={left:g-16-1,top:qe(h,_,y,f),height:16,width:16,zIndex:5e3,cellHeight:y,cellWidth:v,filterParams:{unitId:a,subUnitId:s,col:e,hasCriteria:b}},S=this._injector.createInstance(G,n,x);this._filterButtonShapes.push(S)}l.addObjects(this._filterButtonShapes),l.makeDirty()}_interceptCellContent(e,n,r){let{startRow:i,startColumn:a,endColumn:s}=r;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(o.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,handler:(t,r,o)=>{let{row:c,col:l,unitId:u,subUnitId:d}=r;return u!==e||d!==n||c!==i||l<a||l>s?o(t):((!t||t===r.rawData)&&(t={...r.rawData}),t.fontRenderExtension={...t==null?void 0:t.fontRenderExtension,rightOffset:16},o(t))},priority:10})}_disposeRendering(){var e,t;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(e=>e.dispose()),(t=this._buttonRenderDisposable)==null||t.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};K=g([h(1,(0,t.Inject)(t.Injector)),h(2,(0,t.Inject)(r.SheetSkeletonManagerService)),h(3,(0,t.Inject)(n.SheetsFilterService)),h(4,(0,t.Inject)(t.ThemeService)),h(5,(0,t.Inject)(o.SheetInterceptorService)),h(6,t.ICommandService),h(7,r.ISheetSelectionRenderService)],K);let q=class extends t.RxDisposable{constructor(e,r,a,o,s,c,u,d){super(),[I,P,F].forEach(e=>{this.disposeWithMe(r.registerCommand(e))}),[n.SetSheetsFilterRangeMutation,n.SetSheetsFilterCriteriaMutation,n.RemoveSheetsFilterMutation,n.ReCalcSheetsFilterMutation].forEach(e=>{this.disposeWithMe(d.registerSkeletonChangingMutations(e.id))}),this.disposeWithMe(u.registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[K])),this.disposeWithMe(c.registerComponent(i.BuiltInUIPart.GLOBAL,()=>(0,i.connectInjector)(Ue,e))),this.disposeWithMe(o.errorMsg$.subscribe(e=>{e&&s.show({type:l.MessageType.Error,content:a.t(e)})}))}};q=g([h(0,(0,t.Inject)(t.Injector)),h(1,t.ICommandService),h(2,(0,t.Inject)(t.LocaleService)),h(3,(0,t.Inject)(n.SheetsFilterService)),h(4,i.IMessageService),h(5,i.IUIPartsService),h(6,a.IRenderManagerService),h(7,(0,t.Inject)(r.SheetsRenderService))],q);let J=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._sheetsFilterService=e,this._localeService=t,this._commandService=n,this._sheetPermissionCheckPermission=r,this._injector=i,this._sheetsSelectionService=a,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===n.SmartToggleSheetsFilterCommand.id){var r;let e=this._injector.get(t.IUniverInstanceService),n=(0,o.getSheetCommandTarget)(e);if(!n)return;let{unitId:a,subUnitId:s,worksheet:c}=n,l=(r=this._sheetsFilterService.getFilterModel(a,s))==null?void 0:r.getRange(),u;if(l)u=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetFilterPermission,o.WorksheetViewPermission]},[l],a,s);else{var i;let e=(i=this._sheetsSelectionService.getCurrentLastSelection())==null?void 0:i.range;if(e){let t={...e};t=e.startColumn===e.endColumn&&e.startRow===e.endRow?(0,o.expandToContinuousRange)(t,{left:!0,right:!0,up:!0,down:!0},c):t,u=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetViewPermission,o.WorksheetFilterPermission]},[t],a,s)}else u=this._sheetPermissionCheckPermission.permissionCheckWithoutRange({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetViewPermission,o.WorksheetFilterPermission]})}u||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t(`sheets-filter-ui.permission.filterErr`))}if(e.id===P.id){var a;let n=e.params,{unitId:r,subUnitId:i}=n,s=(a=this._sheetsFilterService.getFilterModel(r,i))==null?void 0:a.getRange(),c=t.Tools.deepClone(s);c&&(c.startColumn=n.col,c.endColumn=n.col,this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[o.RangeProtectionPermissionViewPoint],worksheetTypes:[o.WorksheetFilterPermission,o.WorksheetViewPermission]},[c],r,i)||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t(`sheets-filter-ui.permission.filterErr`)))}}))}};J=g([h(0,(0,t.Inject)(n.SheetsFilterService)),h(1,(0,t.Inject)(t.LocaleService)),h(2,t.ICommandService),h(3,(0,t.Inject)(o.SheetPermissionCheckController)),h(4,(0,t.Inject)(t.Injector)),h(5,(0,t.Inject)(o.SheetsSelectionsService))],J);let Y=class extends t.Plugin{constructor(e=R,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{menu:i,...a}=(0,t.merge)({},R,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(L,a)}onStarting(){this._injector.add([W]),this._injector.get(W),[[A,{useClass:j}],[J],[z],[q]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(J),this._injector.get(z)}onRendered(){this._injector.get(q)}};O(Y,`type`,t.UniverInstanceType.UNIVER_SHEET),O(Y,`pluginName`,`SHEET_FILTER_UI_PLUGIN`),O(Y,`packageName`,ue),O(Y,`version`,de),Y=g([(0,t.DependentOn)(a.UniverRenderEnginePlugin,o.UniverSheetsPlugin,i.UniverMobileUIPlugin,n.UniverSheetsFilterPlugin,r.UniverSheetsMobileUIPlugin),h(1,(0,t.Inject)(t.Injector)),h(2,t.IConfigService)],Y);function Je(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.cellFillColors$,[],!0),o=(0,i.useObservable)(n.cellTextColors$,[],!0),s=(0,c.useCallback)(e=>{n.onFilterCheckToggled(e)},[n]),d=(0,c.useCallback)(e=>{n.onFilterCheckToggled(e,!1)},[n]);return(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-colors-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel`,className:(0,l.clsx)(`univer-mt-2 univer-box-border univer-flex univer-h-[300px] univer-flex-grow univer-flex-col univer-gap-4 univer-overflow-auto univer-rounded-md univer-px-2 univer-py-2.5`,l.borderClassName),children:[a.length>1&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`univer-mb-2 univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0`,children:r.t(`sheets-filter-ui.panel.filter-by-cell-fill-color`)}),(0,u.jsx)(`div`,{className:`univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2`,children:a.map((e,t)=>(0,u.jsxs)(`div`,{className:`univer-relative univer-size-6`,onClick:()=>s(e),children:[e.color?(0,u.jsx)(`button`,{type:`button`,className:(0,l.clsx)(`univer-box-border univer-size-6 univer-cursor-pointer univer-rounded-full univer-border univer-border-solid univer-border-transparent univer-bg-gray-300 univer-transition-shadow hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-gray-0`),style:{backgroundColor:e.color}}):(0,u.jsx)(H,{className:`univer-size-6 univer-cursor-pointer univer-rounded-full hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-gray-0`}),e.checked&&(0,u.jsx)(Ye,{})]},`sheets-filter-cell-fill-color-${t}`))})]}),o.length>1&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`univer-mb-2 univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0`,children:r.t(`sheets-filter-ui.panel.filter-by-cell-text-color`)}),(0,u.jsx)(`div`,{className:`univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2`,children:o.map((e,t)=>(0,u.jsxs)(`div`,{className:`univer-relative univer-size-6`,onClick:()=>d(e),children:[(0,u.jsx)(`div`,{className:`univer-box-border univer-flex univer-size-full univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-border univer-border-solid univer-border-[rgba(13,13,13,0.06)] univer-p-0.5 hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-gray-0 dark:!univer-border-[rgba(255,255,255,0.06)]`,children:(0,u.jsx)(V,{style:{color:e.color}})}),e.checked&&(0,u.jsx)(Ye,{})]},`sheets-filter-cell-text-color-${t}`))})]}),a.length<=1&&o.length<=1&&(0,u.jsx)(`div`,{className:`univer-flex univer-size-full univer-items-center univer-justify-center univer-text-sm univer-text-gray-900 dark:!univer-text-gray-200`,children:r.t(`sheets-filter-ui.panel.filter-by-color-none`)})]})})}function Ye(){return(0,u.jsx)(`div`,{className:`univer-absolute -univer-bottom-0.5 -univer-right-0.5 univer-flex univer-size-3 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-bg-gray-0`,children:(0,u.jsx)(Fe,{className:`univer-size-full univer-font-bold univer-text-[#418F1F]`})})}let Xe=[[f.NONE],[f.EMPTY,f.NOT_EMPTY],[f.TEXT_CONTAINS,f.DOES_NOT_CONTAIN,f.STARTS_WITH,f.ENDS_WITH,f.EQUALS],[f.GREATER_THAN,f.GREATER_THAN_OR_EQUAL,f.LESS_THAN,f.LESS_THAN_OR_EQUAL,f.EQUAL,f.NOT_EQUAL,f.BETWEEN,f.NOT_BETWEEN],[f.CUSTOM]];function Ze(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.conditionItem$,void 0),o=(0,i.useObservable)(n.filterConditionFormParams$,void 0),s=o!=null&&o.and?`AND`:`OR`,d=(0,c.useCallback)(e=>{n.onConditionFormChange({and:e===`AND`})},[n]),p=Xe.map(e=>({options:e.map(e=>({label:r.t(e.label),value:e.operator}))})),m=(0,c.useCallback)(e=>{n.onPrimaryConditionChange(e)},[n]),h=f.ALL_CONDITIONS.filter(e=>e.numOfParameters!==2).map(e=>({label:r.t(e.label),value:e.operator})),g=(0,c.useCallback)(e=>{n.onConditionFormChange(e)},[n]),_=r.t(`sheets-filter-ui.panel.input-values-placeholder`);function v(e,t,n){let i=f.getItemByOperator(e).numOfParameters===1;return(0,u.jsxs)(u.Fragment,{children:[n===`operator2`&&(0,u.jsxs)(l.RadioGroup,{value:s,onChange:d,children:[(0,u.jsx)(l.Radio,{value:`AND`,children:r.t(`sheets-filter-ui.panel.and`)}),(0,u.jsx)(l.Radio,{value:`OR`,children:r.t(`sheets-filter-ui.panel.or`)})]}),(0,u.jsx)(l.Select,{value:e,options:h,onChange:e=>g({[n]:e})}),i&&(0,u.jsx)(`div`,{children:(0,u.jsx)(l.Input,{className:`univer-mt-2`,value:t,placeholder:_,onChange:e=>g({[n===`operator1`?`val1`:`val2`]:e})})})]})}return(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-conditions-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:a&&o&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(l.Select,{value:a.operator,options:p,onChange:m}),f.getItemByOperator(a.operator).numOfParameters===0?null:(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-conditions-container-inner`,className:(0,l.clsx)(`univer-mt-2 univer-flex-grow univer-overflow-hidden univer-rounded-md univer-p-2`,l.borderClassName),children:[a.numOfParameters>=1&&v(o.operator1,o.val1??``,`operator1`),a.numOfParameters>=2&&v(o.operator2,o.val2??``,`operator2`),(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-conditions-desc`,className:`univer-mt-2 univer-text-xs univer-text-gray-500`,children:[r.t(`sheets-filter-ui.panel.?`),(0,u.jsx)(`br`,{}),r.t(`sheets-filter-ui.panel.*`)]})]})]})})}function Qe(e){let{model:n}=e,r=(0,i.useDependency)(t.LocaleService),a=(0,i.useObservable)(n.searchString$,``,!0),o=(0,i.useObservable)(n.filterItems$,void 0,!0),s=r.t(`sheets-filter-ui.panel.filter-only`),d=m(o),f=d.checked>0&&d.unchecked===0,p=d.checked>0&&d.unchecked>0,h=n.treeMapCache,g=(0,c.useCallback)(()=>{n.onCheckAllToggled(!f)},[n,f]),_=(0,c.useCallback)(e=>{n.setSearchString(e)},[n]);function v(e){let t=[];return e.forEach(e=>{e.checked&&t.push(e.key),e.children&&(t=t.concat(v(e.children)))}),t}return(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-values-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:[(0,u.jsx)(l.Input,{autoFocus:!0,value:a,placeholder:r.t(`sheets-filter-ui.panel.search-placeholder`),onChange:_}),(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel`,className:(0,l.clsx)(`univer-mt-2 univer-box-border univer-flex univer-flex-grow univer-flex-col univer-overflow-hidden univer-rounded-md univer-px-2 univer-py-2.5`,l.borderClassName),children:[(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-values-item`,className:`univer-box-border univer-h-8 univer-w-full univer-py-0.5`,children:(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-values-item-inner`,className:`univer-box-border univer-flex univer-h-7 univer-items-center univer-rounded-md univer-py-0 univer-pl-5 univer-pr-0.5 univer-text-sm`,children:[(0,u.jsx)(l.Checkbox,{indeterminate:p,disabled:o.length===0,checked:f,onChange:g}),(0,u.jsx)(`span`,{"data-u-comp":`sheets-filter-panel-values-item-text`,className:`univer-mx-1 univer-inline-block univer-flex-shrink univer-truncate univer-text-gray-900 dark:!univer-text-gray-0`,children:`${r.t(`sheets-filter-ui.panel.select-all`)}`}),(0,u.jsx)(`span`,{"data-u-comp":`sheets-filter-panel-values-item-count`,className:`univer-text-gray-400 dark:!univer-text-gray-500`,children:`(${d.checked}/${d.checked+d.unchecked})`})]})}),(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-values-virtual`,className:`univer-flex-grow`,children:(0,u.jsx)(l.Tree,{data:o,defaultExpandAll:!1,valueGroup:v(o),onChange:e=>{n.onFilterCheckToggled(e)},defaultCache:h,itemHeight:28,treeNodeClassName:`
11
11
  univer-pr-2 univer-border-box univer-rounded-md
12
12
  [&:hover_a]:univer-inline-block
13
13
  hover:univer-bg-gray-50 univer-h-full
14
14
  univer-text-gray-900 dark:hover:!univer-bg-gray-900
15
15
  dark:!univer-text-gray-0
16
- `,attachRender:e=>(0,u.jsxs)(`div`,{className:`univer-ml-1 univer-flex univer-h-5 univer-flex-1 univer-cursor-pointer univer-items-center univer-justify-between univer-text-sm univer-text-primary-500`,children:[(0,u.jsx)(`span`,{"data-u-comp":`sheets-filter-panel-values-item-count`,className:`univer-text-gray-400 dark:!univer-text-gray-500`,children:`(${e.count})`}),(0,u.jsx)(`a`,{className:`univer-box-border univer-hidden univer-h-4 univer-whitespace-nowrap univer-px-1.5`,onClick:()=>{let t=[];e.children?e.children.forEach(e=>{e.children?e.children.forEach(e=>{t.push(e.key)}):t.push(e.key)}):t.push(e.key),n.onFilterOnly(t)},children:s})]})})})]})]})}function Qe(){let e=(0,i.useDependency)(n.SheetsFilterSyncController),r=(0,i.useObservable)(e.visible$,void 0,!0),a=(0,i.useDependency)(t.LocaleService),o=(0,i.useDependency)(i.IMessageService),s=(0,i.useObservable)(e.enabled$,void 0,!0);return r?(0,u.jsxs)(`div`,{className:`univer-mt-2 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-900 dark:!univer-text-gray-200`,children:[(0,u.jsxs)(`div`,{className:`univer-flex univer-items-center univer-gap-1`,children:[(0,u.jsx)(`span`,{children:a.t(`sheets-filter-ui.sync.title`)}),(0,u.jsx)(l.Tooltip,{title:s?a.t(`sheets-filter-ui.sync.statusTips.off`):a.t(`sheets-filter-ui.sync.statusTips.on`),asChild:!0,children:(0,u.jsx)(Ee,{className:`univer-block`})})]}),(0,u.jsx)(l.Switch,{defaultChecked:s,onChange:t=>{let n=t?a.t(`sheets-filter-ui.sync.switchTips.on`):a.t(`sheets-filter-ui.sync.switchTips.off`);e.setEnabled(t),o.show({content:n,type:l.MessageType.Success,duration:2e3})}})]}):null}let $e=[{label:`sheets-filter-ui.panel.by-values`,value:n.FilterBy.VALUES},{label:`sheets-filter-ui.panel.by-colors`,value:n.FilterBy.COLORS},{label:`sheets-filter-ui.panel.by-conditions`,value:n.FilterBy.CONDITIONS}];function et(){var e;let a=(0,i.useDependency)(A),o=(0,i.useDependency)(t.LocaleService),d=(0,i.useDependency)(t.ICommandService),f=(0,i.useObservable)(a.filterBy$,void 0,!0),p=(0,i.useObservable)(a.filterByModel$,void 0,!1),m=(0,i.useObservable)(()=>(p==null?void 0:p.canApply$)||(0,s.of)(!1),void 0,!1,[p]),h=$e.map(e=>({...e,label:o.t(e.label)})),g=!(0,i.useObservable)(a.hasCriteria$),_=(0,c.useCallback)(e=>{d.executeCommand(F.id,{filterBy:e})},[d]),v=(0,c.useCallback)(async()=>{await(p==null?void 0:p.clear()),d.executeCommand(P.id)},[p,d]),y=(0,c.useCallback)(()=>{d.executeCommand(P.id)},[d]),b=(0,c.useCallback)(async()=>{await(p==null?void 0:p.apply()),d.executeCommand(P.id)},[p,d]),x=(e=(0,i.useDependency)(n.SheetsFilterService).activeFilterModel)==null?void 0:e.getRange(),S=a.col;return(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel`,className:`univer-box-border univer-flex univer-max-h-[500px] univer-w-[400px] univer-flex-col univer-rounded-lg univer-bg-gray-0 univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700`,children:[(0,u.jsx)(i.ComponentContainer,{components:(0,i.useComponentsOfPart)(r.SheetsUIPart.FILTER_PANEL_EMBED_POINT),sharedProps:{range:x,colIndex:S,onClose:y}}),(0,u.jsx)(`div`,{className:`univer-mb-1 univer-flex-shrink-0 univer-flex-grow-0`,children:(0,u.jsx)(l.Segmented,{value:f,items:h,onChange:e=>_(e)})}),p?(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-content`,className:`univer-flex-shrink univer-flex-grow univer-pt-2`,children:f===n.FilterBy.VALUES?(0,u.jsx)(Ze,{model:p}):f===n.FilterBy.COLORS?(0,u.jsx)(qe,{model:p}):(0,u.jsx)(Xe,{model:p})}):(0,u.jsx)(`div`,{className:`univer-flex-1`}),(0,u.jsx)(Qe,{}),(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-footer`,className:`univer-mt-4 univer-inline-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-nowrap univer-justify-between univer-overflow-hidden`,children:[(0,u.jsx)(l.Button,{variant:`link`,onClick:v,disabled:g,children:o.t(`sheets-filter-ui.panel.clear-filter`)}),(0,u.jsxs)(`span`,{className:`univer-flex univer-gap-2`,children:[(0,u.jsx)(l.Button,{variant:`default`,onClick:y,children:o.t(`sheets-filter-ui.panel.cancel`)}),(0,u.jsx)(l.Button,{disabled:!m,variant:`primary`,onClick:b,children:o.t(`sheets-filter-ui.panel.confirm`)})]})]})]})}let tt=`FILTER_PANEL_POPUP`,X=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerIcons(),this._registerComponents()}_registerIcons(){this.disposeWithMe(this._iconManager.register({FilterIcon:U}))}_registerComponents(){[[tt,et]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};X=g([h(0,(0,t.Inject)(i.ComponentManager)),h(1,(0,t.Inject)(i.IconManager))],X);let nt={id:n.SmartToggleSheetsFilterCommand.id,binding:i.KeyCode.L|i.MetaKeys.CTRL_COMMAND|i.MetaKeys.SHIFT,description:`sheets-filter-ui.shortcut.smart-toggle-filter`,preconditions:r.whenSheetEditorFocused,group:`4_sheet-edit`,groupTitle:`sheets-ui.shortcut.sheet-edit`},Z=class extends t.RxDisposable{constructor(e,r,i,a,o,s,c,l,u,d,f,p){super(),this._injector=e,this._sheetsFilterPanelService=r,this._sheetCanvasPopupService=i,this._sheetsFilterService=a,this._localeService=o,this._shortcutService=s,this._commandService=c,this._menuManagerService=l,this._contextService=u,this._messageService=d,k(this,`_popupDisposable`,void 0),[n.SetSheetsFilterRangeMutation,n.SetSheetsFilterCriteriaMutation,n.RemoveSheetsFilterMutation,n.ReCalcSheetsFilterMutation].forEach(e=>{this.disposeWithMe(f.registerSkeletonChangingMutations(e.id))}),this.disposeWithMe(p.registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[K])),this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[nt].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[n.SmartToggleSheetsFilterCommand,F,N,P].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(ue)}_initUI(){this.disposeWithMe(this._contextService.subscribeContextValue$(oe).pipe((0,s.distinctUntilChanged)()).subscribe(e=>{e?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(e=>{e&&this._messageService.show({type:l.MessageType.Error,content:this._localeService.t(e)})}))}_openFilterPopup(){let e=this._sheetsFilterPanelService.filterModel;if(!e)throw Error(`[SheetsFilterUIController]: no filter model when opening filter popup!`);let t=e.getRange(),n=this._sheetsFilterPanelService.col,{startRow:r}=t;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(r,n,{componentKey:tt,direction:`horizontal`,onClickOutside:()=>this._commandService.syncExecuteCommand(P.id),offset:[5,0]})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null}};Z=g([h(0,(0,t.Inject)(t.Injector)),h(1,A),h(2,(0,t.Inject)(r.SheetCanvasPopManagerService)),h(3,(0,t.Inject)(n.SheetsFilterService)),h(4,(0,t.Inject)(t.LocaleService)),h(5,i.IShortcutService),h(6,t.ICommandService),h(7,i.IMenuManagerService),h(8,t.IContextService),h(9,i.IMessageService),h(10,(0,t.Inject)(r.SheetsRenderService)),h(11,a.IRenderManagerService)],Z);let Q=class extends t.Plugin{constructor(e=R,n,r,i){super(),this._config=e,this._injector=n,this._configService=r,this._rpcChannelService=i;let{menu:a,...o}=(0,t.merge)({},R,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(L,o)}onStarting(){this._injector.add([X]),this._injector.get(X),(0,t.registerDependencies)(this._injector,[[A,{useClass:j}],[J],[Z]]),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([v,{useFactory:()=>(0,d.toModule)(this._rpcChannelService.requestChannel(_))}])}onReady(){(0,t.touchDependencies)(this._injector,[[J]])}onRendered(){(0,t.touchDependencies)(this._injector,[[Z]])}};k(Q,`type`,t.UniverInstanceType.UNIVER_SHEET),k(Q,`pluginName`,`SHEET_FILTER_UI_PLUGIN`),k(Q,`packageName`,de),k(Q,`version`,I),Q=g([(0,t.DependentOn)(a.UniverRenderEnginePlugin,o.UniverSheetsPlugin,n.UniverSheetsFilterPlugin,r.UniverSheetsUIPlugin),h(1,(0,t.Inject)(t.Injector)),h(2,t.IConfigService),h(3,(0,t.Optional)(d.IRPCChannelService))],Q);let $=class extends t.Plugin{constructor(e=R,n,r,i){super(),this._config=e,this._injector=n,this._configService=r,this._rpcChannelService=i;let{...a}=(0,t.merge)({},R,this._config);this._configService.setConfig(L,a)}onStarting(){[[v,{useClass:y}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(_,(0,d.fromModule)(this._injector.get(v)))}};k($,`type`,t.UniverInstanceType.UNIVER_SHEET),k($,`pluginName`,`SHEET_FILTER_UI_WORKER_PLUGIN`),k($,`packageName`,de),k($,`version`,I),$=g([h(1,(0,t.Inject)(t.Injector)),h(2,t.IConfigService),h(3,d.IRPCChannelService)],$),e.ChangeFilterByOperation=F,e.CloseFilterPanelOperation=P,e.OpenFilterPanelOperation=N,e.SheetsFilterUIMenuSchema=ue,Object.defineProperty(e,"UniverSheetsFilterMobileUIPlugin",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"UniverSheetsFilterUIPlugin",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"UniverSheetsFilterUIWorkerPlugin",{enumerable:!0,get:function(){return $}})});
16
+ `,attachRender:e=>(0,u.jsxs)(`div`,{className:`univer-ml-1 univer-flex univer-h-5 univer-flex-1 univer-cursor-pointer univer-items-center univer-justify-between univer-text-sm univer-text-primary-500`,children:[(0,u.jsx)(`span`,{"data-u-comp":`sheets-filter-panel-values-item-count`,className:`univer-text-gray-400 dark:!univer-text-gray-500`,children:`(${e.count})`}),(0,u.jsx)(`a`,{className:`univer-box-border univer-hidden univer-h-4 univer-whitespace-nowrap univer-px-1.5`,onClick:()=>{let t=[];e.children?e.children.forEach(e=>{e.children?e.children.forEach(e=>{t.push(e.key)}):t.push(e.key)}):t.push(e.key),n.onFilterOnly(t)},children:s})]})})})]})]})}function $e(){let e=(0,i.useDependency)(n.SheetsFilterSyncController),r=(0,i.useObservable)(e.visible$,void 0,!0),a=(0,i.useDependency)(t.LocaleService),o=(0,i.useDependency)(i.IMessageService),s=(0,i.useObservable)(e.enabled$,void 0,!0);return r?(0,u.jsxs)(`div`,{className:`univer-mt-2 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-900 dark:!univer-text-gray-200`,children:[(0,u.jsxs)(`div`,{className:`univer-flex univer-items-center univer-gap-1`,children:[(0,u.jsx)(`span`,{children:a.t(`sheets-filter-ui.sync.title`)}),(0,u.jsx)(l.Tooltip,{title:s?a.t(`sheets-filter-ui.sync.statusTips.off`):a.t(`sheets-filter-ui.sync.statusTips.on`),asChild:!0,children:(0,u.jsx)(De,{className:`univer-block`})})]}),(0,u.jsx)(l.Switch,{defaultChecked:s,onChange:t=>{let n=t?a.t(`sheets-filter-ui.sync.switchTips.on`):a.t(`sheets-filter-ui.sync.switchTips.off`);e.setEnabled(t),o.show({content:n,type:l.MessageType.Success,duration:2e3})}})]}):null}let et=[{label:`sheets-filter-ui.panel.by-values`,value:n.FilterBy.VALUES},{label:`sheets-filter-ui.panel.by-colors`,value:n.FilterBy.COLORS},{label:`sheets-filter-ui.panel.by-conditions`,value:n.FilterBy.CONDITIONS}];function tt(){var e;let a=(0,i.useDependency)(A),o=(0,i.useDependency)(t.LocaleService),d=(0,i.useDependency)(t.ICommandService),f=(0,i.useObservable)(a.filterBy$,void 0,!0),p=(0,i.useObservable)(a.filterByModel$,void 0,!1),m=(0,i.useObservable)(()=>(p==null?void 0:p.canApply$)||(0,s.of)(!1),void 0,!1,[p]),h=et.map(e=>({...e,label:o.t(e.label)})),g=!(0,i.useObservable)(a.hasCriteria$),_=(0,c.useCallback)(e=>{d.executeCommand(I.id,{filterBy:e})},[d]),v=(0,c.useCallback)(async()=>{await(p==null?void 0:p.clear()),d.executeCommand(F.id)},[p,d]),y=(0,c.useCallback)(()=>{d.executeCommand(F.id)},[d]),b=(0,c.useCallback)(async()=>{await(p==null?void 0:p.apply()),d.executeCommand(F.id)},[p,d]),x=(e=(0,i.useDependency)(n.SheetsFilterService).activeFilterModel)==null?void 0:e.getRange(),S=a.col,C=(0,i.useComponentsOfPart)(r.SheetsUIPart.FILTER_PANEL_EMBED_POINT);return(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel`,className:`univer-box-border univer-flex univer-max-h-[500px] univer-w-[400px] univer-flex-col univer-rounded-lg univer-bg-gray-0 univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700`,children:[(0,u.jsx)(i.ComponentContainer,{components:C,sharedProps:{range:x,colIndex:S,onClose:y}}),(0,u.jsx)(`div`,{className:`univer-mb-1 univer-flex-shrink-0 univer-flex-grow-0`,children:(0,u.jsx)(l.Segmented,{value:f,items:h,onChange:e=>_(e)})}),p?(0,u.jsx)(`div`,{"data-u-comp":`sheets-filter-panel-content`,className:`univer-flex-shrink univer-flex-grow univer-pt-2`,children:f===n.FilterBy.VALUES?(0,u.jsx)(Qe,{model:p}):f===n.FilterBy.COLORS?(0,u.jsx)(Je,{model:p}):(0,u.jsx)(Ze,{model:p})}):(0,u.jsx)(`div`,{className:`univer-flex-1`}),(0,u.jsx)($e,{}),(0,u.jsxs)(`div`,{"data-u-comp":`sheets-filter-panel-footer`,className:`univer-mt-4 univer-inline-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-nowrap univer-justify-between univer-overflow-hidden`,children:[(0,u.jsx)(l.Button,{variant:`link`,onClick:v,disabled:g,children:o.t(`sheets-filter-ui.panel.clear-filter`)}),(0,u.jsxs)(`span`,{className:`univer-flex univer-gap-2`,children:[(0,u.jsx)(l.Button,{variant:`default`,onClick:y,children:o.t(`sheets-filter-ui.panel.cancel`)}),(0,u.jsx)(l.Button,{disabled:!m,variant:`primary`,onClick:b,children:o.t(`sheets-filter-ui.panel.confirm`)})]})]})]})}let nt=`FILTER_PANEL_POPUP`,X=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerIcons(),this._registerComponents()}_registerIcons(){this.disposeWithMe(this._iconManager.register({FilterIcon:U}))}_registerComponents(){[[nt,tt]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};X=g([h(0,(0,t.Inject)(i.ComponentManager)),h(1,(0,t.Inject)(i.IconManager))],X);let rt={id:n.SmartToggleSheetsFilterCommand.id,binding:i.KeyCode.L|i.MetaKeys.CTRL_COMMAND|i.MetaKeys.SHIFT,description:`sheets-filter-ui.shortcut.smart-toggle-filter`,preconditions:r.whenSheetEditorFocused,group:`4_sheet-edit`,groupTitle:`sheets-ui.shortcut.sheet-edit`},Z=class extends t.RxDisposable{constructor(e,r,i,a,o,s,c,l,u,d,f,p){super(),this._injector=e,this._sheetsFilterPanelService=r,this._sheetCanvasPopupService=i,this._sheetsFilterService=a,this._localeService=o,this._shortcutService=s,this._commandService=c,this._menuManagerService=l,this._contextService=u,this._messageService=d,O(this,`_popupDisposable`,void 0),[n.SetSheetsFilterRangeMutation,n.SetSheetsFilterCriteriaMutation,n.RemoveSheetsFilterMutation,n.ReCalcSheetsFilterMutation].forEach(e=>{this.disposeWithMe(f.registerSkeletonChangingMutations(e.id))}),this.disposeWithMe(p.registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[K])),this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[rt].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[n.SmartToggleSheetsFilterCommand,I,P,F].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(le)}_initUI(){this.disposeWithMe(this._contextService.subscribeContextValue$(ae).pipe((0,s.distinctUntilChanged)()).subscribe(e=>{e?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(e=>{e&&this._messageService.show({type:l.MessageType.Error,content:this._localeService.t(e)})}))}_openFilterPopup(){let e=this._sheetsFilterPanelService.filterModel;if(!e)throw Error(`[SheetsFilterUIController]: no filter model when opening filter popup!`);let t=e.getRange(),n=this._sheetsFilterPanelService.col,{startRow:r}=t;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(r,n,{componentKey:nt,direction:`horizontal`,onClickOutside:()=>this._commandService.syncExecuteCommand(F.id),offset:[5,0]})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null}};Z=g([h(0,(0,t.Inject)(t.Injector)),h(1,A),h(2,(0,t.Inject)(r.SheetCanvasPopManagerService)),h(3,(0,t.Inject)(n.SheetsFilterService)),h(4,(0,t.Inject)(t.LocaleService)),h(5,i.IShortcutService),h(6,t.ICommandService),h(7,i.IMenuManagerService),h(8,t.IContextService),h(9,i.IMessageService),h(10,(0,t.Inject)(r.SheetsRenderService)),h(11,a.IRenderManagerService)],Z);let Q=class extends t.Plugin{constructor(e=R,n,r,i){super(),this._config=e,this._injector=n,this._configService=r,this._rpcChannelService=i;let{menu:a,...o}=(0,t.merge)({},R,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(L,o)}onStarting(){this._injector.add([X]),this._injector.get(X),(0,t.registerDependencies)(this._injector,[[A,{useClass:j}],[J],[Z]]),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([v,{useFactory:()=>(0,d.toModule)(this._rpcChannelService.requestChannel(_))}])}onReady(){(0,t.touchDependencies)(this._injector,[[J]])}onRendered(){(0,t.touchDependencies)(this._injector,[[Z]])}};O(Q,`type`,t.UniverInstanceType.UNIVER_SHEET),O(Q,`pluginName`,`SHEET_FILTER_UI_PLUGIN`),O(Q,`packageName`,ue),O(Q,`version`,de),Q=g([(0,t.DependentOn)(a.UniverRenderEnginePlugin,o.UniverSheetsPlugin,n.UniverSheetsFilterPlugin,r.UniverSheetsUIPlugin),h(1,(0,t.Inject)(t.Injector)),h(2,t.IConfigService),h(3,(0,t.Optional)(d.IRPCChannelService))],Q);let $=class extends t.Plugin{constructor(e=R,n,r,i){super(),this._config=e,this._injector=n,this._configService=r,this._rpcChannelService=i;let{...a}=(0,t.merge)({},R,this._config);this._configService.setConfig(L,a)}onStarting(){[[v,{useClass:y}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(_,(0,d.fromModule)(this._injector.get(v)))}};O($,`type`,t.UniverInstanceType.UNIVER_SHEET),O($,`pluginName`,`SHEET_FILTER_UI_WORKER_PLUGIN`),O($,`packageName`,ue),O($,`version`,de),$=g([h(1,(0,t.Inject)(t.Injector)),h(2,t.IConfigService),h(3,d.IRPCChannelService)],$),e.ChangeFilterByOperation=I,e.CloseFilterPanelOperation=F,e.OpenFilterPanelOperation=P,e.SheetsFilterUIMenuSchema=le,Object.defineProperty(e,"UniverSheetsFilterMobileUIPlugin",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"UniverSheetsFilterUIPlugin",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"UniverSheetsFilterUIWorkerPlugin",{enumerable:!0,get:function(){return $}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-filter-ui",
3
- "version": "1.0.0-rc.0",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
5
  "description": "Filtering menus and panels for Univer Sheets.",
6
6
  "author": "DreamNum Co., Ltd. <developer@univer.ai>",
@@ -58,24 +58,24 @@
58
58
  "rxjs": ">=7.0.0"
59
59
  },
60
60
  "dependencies": {
61
- "@univerjs/icons": "1.38.0",
62
- "@univerjs/design": "1.0.0-rc.0",
63
- "@univerjs/sheets": "1.0.0-rc.0",
64
- "@univerjs/engine-render": "1.0.0-rc.0",
65
- "@univerjs/sheets-ui": "1.0.0-rc.0",
66
- "@univerjs/ui": "1.0.0-rc.0",
67
- "@univerjs/rpc": "1.0.0-rc.0",
68
- "@univerjs/sheets-filter": "1.0.0-rc.0",
69
- "@univerjs/core": "1.0.0-rc.0"
61
+ "@univerjs/core": "1.0.1",
62
+ "@univerjs/design": "1.0.1",
63
+ "@univerjs/engine-render": "1.0.1",
64
+ "@univerjs/icons": "1.43.0",
65
+ "@univerjs/rpc": "1.0.1",
66
+ "@univerjs/sheets": "1.0.1",
67
+ "@univerjs/sheets-filter": "1.0.1",
68
+ "@univerjs/sheets-ui": "1.0.1",
69
+ "@univerjs/ui": "1.0.1"
70
70
  },
71
71
  "devDependencies": {
72
- "postcss": "^8.5.26",
72
+ "@univerjs-infra/shared": "1.0.1",
73
+ "postcss": "^8.5.28",
73
74
  "react": "18.3.1",
74
75
  "rxjs": "^7.8.2",
75
76
  "tailwindcss": "3.4.18",
76
77
  "typescript": "^6.0.3",
77
- "vitest": "^5.0.0",
78
- "@univerjs-infra/shared": "1.0.0-rc.0"
78
+ "vitest": "^5.0.0"
79
79
  },
80
80
  "scripts": {
81
81
  "test": "vitest run",