@univerjs/sheets-filter-ui 1.4.0 → 1.5.0

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/worker.js CHANGED
@@ -1,9 +1,39 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_worker = require("./worker-CME9bDM7.js");
2
+ const require_config = require("./config-BF97qkoE.js");
3
+ let _univerjs_core = require("@univerjs/core");
4
+ let _univerjs_rpc = require("@univerjs/rpc");
5
+
6
+ // src/worker/plugin.ts
7
+ let UniverSheetsFilterUIWorkerPlugin = class UniverSheetsFilterUIWorkerPlugin extends _univerjs_core.Plugin {
8
+ constructor(_config = require_config.defaultPluginConfig, _injector, _configService, _rpcChannelService) {
9
+ super();
10
+ this._config = _config;
11
+ this._injector = _injector;
12
+ this._configService = _configService;
13
+ this._rpcChannelService = _rpcChannelService;
14
+ const { ...rest } = (0, _univerjs_core.merge)({}, require_config.defaultPluginConfig, this._config);
15
+ this._configService.setConfig(require_config.SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, rest);
16
+ }
17
+ onStarting() {
18
+ [[require_config.ISheetsGenerateFilterValuesService, { useClass: require_config.SheetsGenerateFilterValuesService }]].forEach((d) => this._injector.add(d));
19
+ }
20
+ onReady() {
21
+ this._rpcChannelService.registerChannel(require_config.SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME, (0, _univerjs_rpc.fromModule)(this._injector.get(require_config.ISheetsGenerateFilterValuesService)));
22
+ }
23
+ };
24
+ require_config._defineProperty(UniverSheetsFilterUIWorkerPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
25
+ require_config._defineProperty(UniverSheetsFilterUIWorkerPlugin, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN");
26
+ require_config._defineProperty(UniverSheetsFilterUIWorkerPlugin, "packageName", require_config.name);
27
+ require_config._defineProperty(UniverSheetsFilterUIWorkerPlugin, "version", require_config.version);
28
+ UniverSheetsFilterUIWorkerPlugin = require_config.__decorate([
29
+ require_config.__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
30
+ require_config.__decorateParam(2, _univerjs_core.IConfigService),
31
+ require_config.__decorateParam(3, _univerjs_rpc.IRPCChannelService)
32
+ ], UniverSheetsFilterUIWorkerPlugin);
3
33
 
4
34
  Object.defineProperty(exports, "UniverSheetsFilterUIWorkerPlugin", {
5
35
  enumerable: true,
6
36
  get: function () {
7
- return require_worker.UniverSheetsFilterUIWorkerPlugin;
37
+ return UniverSheetsFilterUIWorkerPlugin;
8
38
  }
9
39
  });
@@ -1,15 +1,14 @@
1
- import { Disposable, IConfigService, ILogService, IUniverInstanceService, Inject, Injector, LocaleService, Plugin, UniverInstanceType, createIdentifier, extractPureTextFromCell, isNumeric, merge, numfmt } from "@univerjs/core";
1
+ import { Disposable, ILogService, IUniverInstanceService, Inject, LocaleService, createIdentifier, extractPureTextFromCell, isNumeric, numfmt } from "@univerjs/core";
2
2
  import { FilterBy } from "@univerjs/sheets-filter";
3
- import { IRPCChannelService, fromModule } from "@univerjs/rpc";
4
3
 
5
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
4
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
6
5
  function __decorateParam(paramIndex, decorator) {
7
6
  return function(target, key) {
8
7
  decorator(target, key, paramIndex);
9
8
  };
10
9
  }
11
10
 
12
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
11
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
13
12
  function __decorate(decorators, target, key, desc) {
14
13
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
14
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -195,7 +194,7 @@ function compare(strA, strB) {
195
194
  else return strA.localeCompare(strB);
196
195
  }
197
196
 
198
- // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
197
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
199
198
  function _typeof(o) {
200
199
  "@babel/helpers - typeof";
201
200
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -205,25 +204,25 @@ function _typeof(o) {
205
204
  }, _typeof(o);
206
205
  }
207
206
 
208
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
209
- function toPrimitive(t, r) {
207
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
208
+ function toPrimitive(t, e) {
210
209
  if ("object" != _typeof(t) || !t) return t;
211
- var e = t[Symbol.toPrimitive];
212
- if (void 0 !== e) {
213
- var i = e.call(t, r || "default");
210
+ var r;
211
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
212
+ var i = r.call(t, e || "default");
214
213
  if ("object" != _typeof(i)) return i;
215
214
  throw new TypeError("@@toPrimitive must return a primitive value.");
216
215
  }
217
- return ("string" === r ? String : Number)(t);
216
+ return ("string" === e ? String : Number)(t);
218
217
  }
219
218
 
220
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
219
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
221
220
  function toPropertyKey(t) {
222
221
  var i = toPrimitive(t, "string");
223
222
  return "symbol" == _typeof(i) ? i : i + "";
224
223
  }
225
224
 
226
- // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
225
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
227
226
  function _defineProperty(e, r, t) {
228
227
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
229
228
  value: t,
@@ -235,39 +234,11 @@ function _defineProperty(e, r, t) {
235
234
 
236
235
  // package.json
237
236
  var name = "@univerjs/sheets-filter-ui";
238
- var version = "1.4.0";
237
+ var version = "1.5.0";
239
238
 
240
239
  // src/config/config.ts
241
240
  const SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY = "sheets-filter-ui.config";
242
241
  const configSymbol = Symbol(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY);
243
242
  const defaultPluginConfig = {};
244
243
 
245
- // src/worker/plugin.ts
246
- let UniverSheetsFilterUIWorkerPlugin = class UniverSheetsFilterUIWorkerPlugin extends Plugin {
247
- constructor(_config = defaultPluginConfig, _injector, _configService, _rpcChannelService) {
248
- super();
249
- this._config = _config;
250
- this._injector = _injector;
251
- this._configService = _configService;
252
- this._rpcChannelService = _rpcChannelService;
253
- const { ...rest } = merge({}, defaultPluginConfig, this._config);
254
- this._configService.setConfig(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, rest);
255
- }
256
- onStarting() {
257
- [[ISheetsGenerateFilterValuesService, { useClass: SheetsGenerateFilterValuesService }]].forEach((d) => this._injector.add(d));
258
- }
259
- onReady() {
260
- this._rpcChannelService.registerChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME, fromModule(this._injector.get(ISheetsGenerateFilterValuesService)));
261
- }
262
- };
263
- _defineProperty(UniverSheetsFilterUIWorkerPlugin, "type", UniverInstanceType.UNIVER_SHEET);
264
- _defineProperty(UniverSheetsFilterUIWorkerPlugin, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN");
265
- _defineProperty(UniverSheetsFilterUIWorkerPlugin, "packageName", name);
266
- _defineProperty(UniverSheetsFilterUIWorkerPlugin, "version", version);
267
- UniverSheetsFilterUIWorkerPlugin = __decorate([
268
- __decorateParam(1, Inject(Injector)),
269
- __decorateParam(2, IConfigService),
270
- __decorateParam(3, IRPCChannelService)
271
- ], UniverSheetsFilterUIWorkerPlugin);
272
-
273
- export { version as a, SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME as c, __decorateParam as d, name as i, getFilterTreeByValueItems as l, SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY as n, _defineProperty as o, defaultPluginConfig as r, ISheetsGenerateFilterValuesService as s, UniverSheetsFilterUIWorkerPlugin as t, __decorate as u };
244
+ export { _defineProperty as a, SheetsGenerateFilterValuesService as c, __decorateParam as d, version as i, getFilterTreeByValueItems as l, defaultPluginConfig as n, ISheetsGenerateFilterValuesService as o, name as r, SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME as s, SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY as t, __decorate as u };
@@ -1,15 +1,14 @@
1
- import { Disposable, IConfigService, ILogService, IUniverInstanceService, Inject, Injector, LocaleService, Plugin, UniverInstanceType, createIdentifier, extractPureTextFromCell, isNumeric, merge, numfmt } from "@univerjs/core";
1
+ import { Disposable, ILogService, IUniverInstanceService, Inject, LocaleService, createIdentifier, extractPureTextFromCell, isNumeric, numfmt } from "@univerjs/core";
2
2
  import { FilterBy } from "@univerjs/sheets-filter";
3
- import { IRPCChannelService, fromModule } from "@univerjs/rpc";
4
3
 
5
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
4
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
6
5
  function __decorateParam(paramIndex, decorator) {
7
6
  return function(target, key) {
8
7
  decorator(target, key, paramIndex);
9
8
  };
10
9
  }
11
10
 
12
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
11
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
13
12
  function __decorate(decorators, target, key, desc) {
14
13
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
14
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -195,7 +194,7 @@ function compare(strA, strB) {
195
194
  else return strA.localeCompare(strB);
196
195
  }
197
196
 
198
- // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
197
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
199
198
  function _typeof(o) {
200
199
  "@babel/helpers - typeof";
201
200
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -205,25 +204,25 @@ function _typeof(o) {
205
204
  }, _typeof(o);
206
205
  }
207
206
 
208
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
209
- function toPrimitive(t, r) {
207
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
208
+ function toPrimitive(t, e) {
210
209
  if ("object" != _typeof(t) || !t) return t;
211
- var e = t[Symbol.toPrimitive];
212
- if (void 0 !== e) {
213
- var i = e.call(t, r || "default");
210
+ var r;
211
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
212
+ var i = r.call(t, e || "default");
214
213
  if ("object" != _typeof(i)) return i;
215
214
  throw new TypeError("@@toPrimitive must return a primitive value.");
216
215
  }
217
- return ("string" === r ? String : Number)(t);
216
+ return ("string" === e ? String : Number)(t);
218
217
  }
219
218
 
220
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
219
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
221
220
  function toPropertyKey(t) {
222
221
  var i = toPrimitive(t, "string");
223
222
  return "symbol" == _typeof(i) ? i : i + "";
224
223
  }
225
224
 
226
- // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
225
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
227
226
  function _defineProperty(e, r, t) {
228
227
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
229
228
  value: t,
@@ -235,39 +234,11 @@ function _defineProperty(e, r, t) {
235
234
 
236
235
  // package.json
237
236
  var name = "@univerjs/sheets-filter-ui";
238
- var version = "1.4.0";
237
+ var version = "1.5.0";
239
238
 
240
239
  // src/config/config.ts
241
240
  const SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY = "sheets-filter-ui.config";
242
241
  const configSymbol = Symbol(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY);
243
242
  const defaultPluginConfig = {};
244
243
 
245
- // src/worker/plugin.ts
246
- let UniverSheetsFilterUIWorkerPlugin = class UniverSheetsFilterUIWorkerPlugin extends Plugin {
247
- constructor(_config = defaultPluginConfig, _injector, _configService, _rpcChannelService) {
248
- super();
249
- this._config = _config;
250
- this._injector = _injector;
251
- this._configService = _configService;
252
- this._rpcChannelService = _rpcChannelService;
253
- const { ...rest } = merge({}, defaultPluginConfig, this._config);
254
- this._configService.setConfig(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, rest);
255
- }
256
- onStarting() {
257
- [[ISheetsGenerateFilterValuesService, { useClass: SheetsGenerateFilterValuesService }]].forEach((d) => this._injector.add(d));
258
- }
259
- onReady() {
260
- this._rpcChannelService.registerChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME, fromModule(this._injector.get(ISheetsGenerateFilterValuesService)));
261
- }
262
- };
263
- _defineProperty(UniverSheetsFilterUIWorkerPlugin, "type", UniverInstanceType.UNIVER_SHEET);
264
- _defineProperty(UniverSheetsFilterUIWorkerPlugin, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN");
265
- _defineProperty(UniverSheetsFilterUIWorkerPlugin, "packageName", name);
266
- _defineProperty(UniverSheetsFilterUIWorkerPlugin, "version", version);
267
- UniverSheetsFilterUIWorkerPlugin = __decorate([
268
- __decorateParam(1, Inject(Injector)),
269
- __decorateParam(2, IConfigService),
270
- __decorateParam(3, IRPCChannelService)
271
- ], UniverSheetsFilterUIWorkerPlugin);
272
-
273
- export { version as a, SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME as c, __decorateParam as d, name as i, getFilterTreeByValueItems as l, SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY as n, _defineProperty as o, defaultPluginConfig as r, ISheetsGenerateFilterValuesService as s, UniverSheetsFilterUIWorkerPlugin as t, __decorate as u };
244
+ export { _defineProperty as a, SheetsGenerateFilterValuesService as c, __decorateParam as d, version as i, getFilterTreeByValueItems as l, defaultPluginConfig as n, ISheetsGenerateFilterValuesService as o, name as r, SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME as s, SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY as t, __decorate as u };
package/lib/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { a as version, c as SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME, d as __decorateParam, i as name, l as getFilterTreeByValueItems, n as SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, o as _defineProperty, r as defaultPluginConfig, s as ISheetsGenerateFilterValuesService, t as UniverSheetsFilterUIWorkerPlugin, u as __decorate } from "./worker-VROMWls7.js";
2
- import { BooleanNumber, ColorKit, CommandType, DependentOn, Disposable, ICommandService, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, Optional, Plugin, Quantity, RxDisposable, ThemeService, Tools, UniverInstanceType, VerticalAlign, createIdentifier, fromCallback, merge, registerDependencies, touchDependencies } from "@univerjs/core";
1
+ import { a as _defineProperty, d as __decorateParam, i as version, l as getFilterTreeByValueItems, n as defaultPluginConfig, o as ISheetsGenerateFilterValuesService, r as name, s as SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME, t as SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, u as __decorate } from "./config-CbqvVwlO.js";
2
+ import { BooleanNumber, ColorKit, CommandType, DependentOn, Disposable, ICommandService, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, Optional, Plugin, Quantity, RxDisposable, SheetTypes, ThemeService, Tools, UniverInstanceType, VerticalAlign, createIdentifier, fromCallback, merge, registerDependencies, touchDependencies } from "@univerjs/core";
3
3
  import { ClearSheetsFilterCriteriaCommand, CustomFilterOperator, FILTER_MUTATIONS, FilterBy, ReCalcSheetsFilterCommand, ReCalcSheetsFilterMutation, RemoveSheetsFilterMutation, SetSheetsFilterCriteriaCommand, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation, SheetsFilterService, SheetsFilterSyncController, SmartToggleSheetsFilterCommand, UniverSheetsFilterPlugin } from "@univerjs/sheets-filter";
4
- import { IEditorBridgeService, ISheetSelectionRenderService, SelectionControl, SetCellEditVisibleOperation, SheetCanvasPopManagerService, SheetSkeletonManagerService, SheetsRenderService, SheetsUIPart, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, getCoordByCell, getCurrentRangeDisable$, getObservableWithExclusiveRange$, whenSheetEditorFocused } from "@univerjs/sheets-ui";
4
+ import { IEditorBridgeService, ISheetSelectionRenderService, SelectionControl, SetCellEditVisibleOperation, SheetCanvasPopManagerService, SheetSkeletonManagerService, SheetsRenderService, SheetsUIPart, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, deriveStateFromActiveSheet$, getCoordByCell, getCurrentRangeDisable$, getObservableWithExclusiveRange$, whenSheetEditorFocused } from "@univerjs/sheets-ui";
5
5
  import { BuiltInUIPart, ComponentContainer, ComponentManager, ILayoutService, IMenuManagerService, IMessageService, IShortcutService, IUIPartsService, IconManager, KeyCode, MenuItemType, MetaKeys, MobileDrawer, RibbonDataGroup, UniverMobileUIPlugin, connectInjector, getMenuHiddenObservable, useComponentsOfPart, useDependency, useObservable } from "@univerjs/ui";
6
6
  import { COLOR_BLACK_RGB, IRenderManagerService, Rect, Shape, UniverRenderEnginePlugin } from "@univerjs/engine-render";
7
7
  import { INTERCEPTOR_POINT, RangeProtectionPermissionViewPoint, RefRangeService, SetRangeValuesMutation, SheetInterceptorService, SheetPermissionCheckController, SheetsSelectionsService, UniverSheetsPlugin, WorksheetFilterPermission, WorksheetViewPermission, attachSelectionWithCoord, expandToContinuousRange, getSheetCommandTarget } from "@univerjs/sheets";
@@ -1289,10 +1289,7 @@ function SmartToggleFilterMenuItemFactory(accessor) {
1289
1289
  tooltip: "sheets-filter-ui.toolbar.smart-toggle-filter-tooltip",
1290
1290
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1291
1291
  activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
1292
- disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, {
1293
- worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission],
1294
- rangeTypes: [RangeProtectionPermissionViewPoint]
1295
- }))
1292
+ disabled$: getFilterRangeDisabled$(accessor)
1296
1293
  };
1297
1294
  }
1298
1295
  function ClearFilterCriteriaMenuItemFactory(accessor) {
@@ -1302,7 +1299,10 @@ function ClearFilterCriteriaMenuItemFactory(accessor) {
1302
1299
  type: MenuItemType.BUTTON,
1303
1300
  title: "sheets-filter-ui.toolbar.clear-filter-criteria",
1304
1301
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1305
- disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => (model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe(map((m) => !m))) ?? of(true)))
1302
+ disabled$: deriveStateFromActiveSheet$(accessor.get(IUniverInstanceService), true, ({ worksheet }) => {
1303
+ if (worksheet.getConfig().type === SheetTypes.CHART) return of(true);
1304
+ return sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => (model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe(map((hasCriteria) => !hasCriteria))) ?? of(true)));
1305
+ })
1306
1306
  };
1307
1307
  }
1308
1308
  function ReCalcFilterMenuItemFactory(accessor) {
@@ -1312,9 +1312,18 @@ function ReCalcFilterMenuItemFactory(accessor) {
1312
1312
  type: MenuItemType.BUTTON,
1313
1313
  title: "sheets-filter-ui.toolbar.re-calc-filter-conditions",
1314
1314
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1315
- disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => (model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe(map((m) => !m))) ?? of(true)))
1315
+ disabled$: deriveStateFromActiveSheet$(accessor.get(IUniverInstanceService), true, ({ worksheet }) => {
1316
+ if (worksheet.getConfig().type === SheetTypes.CHART) return of(true);
1317
+ return sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => (model === null || model === void 0 ? void 0 : model.hasCriteria$.pipe(map((hasCriteria) => !hasCriteria))) ?? of(true)));
1318
+ })
1316
1319
  };
1317
1320
  }
1321
+ function getFilterRangeDisabled$(accessor) {
1322
+ return getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, {
1323
+ worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission],
1324
+ rangeTypes: [RangeProtectionPermissionViewPoint]
1325
+ }));
1326
+ }
1318
1327
 
1319
1328
  // src/menu/schema.ts
1320
1329
  const menuSchema = { [RibbonDataGroup.ORGANIZATION]: { [SmartToggleSheetsFilterCommand.id]: {
@@ -1464,6 +1473,21 @@ function MobileFilterByColor(props) {
1464
1473
  }
1465
1474
 
1466
1475
  // src/views/mobile/MobileFilterByCondition.tsx
1476
+ /**
1477
+ * Copyright 2023-present DreamNum Co., Ltd.
1478
+ *
1479
+ * Licensed under the Apache License, Version 2.0 (the "License");
1480
+ * you may not use this file except in compliance with the License.
1481
+ * You may obtain a copy of the License at
1482
+ *
1483
+ * http://www.apache.org/licenses/LICENSE-2.0
1484
+ *
1485
+ * Unless required by applicable law or agreed to in writing, software
1486
+ * distributed under the License is distributed on an "AS IS" BASIS,
1487
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1488
+ * See the License for the specific language governing permissions and
1489
+ * limitations under the License.
1490
+ */
1467
1491
  function MobileFilterByCondition(props) {
1468
1492
  const { model } = props;
1469
1493
  const localeService = useDependency(LocaleService);
@@ -1493,12 +1517,14 @@ function MobileFilterByCondition(props) {
1493
1517
  /* @__PURE__ */ jsx(MobileSelect, {
1494
1518
  value: operator,
1495
1519
  options: secondaryOptions,
1496
- onChange: (nextOperator) => model.onConditionFormChange({ [name]: nextOperator })
1520
+ onChange: (nextOperator) => model.onConditionFormChange({ [name]: nextOperator }),
1521
+ size: "small"
1497
1522
  }),
1498
1523
  needsValue && /* @__PURE__ */ jsx(Input, {
1499
1524
  value,
1500
1525
  placeholder: localeService.t("sheets-filter-ui.panel.input-values-placeholder"),
1501
- onChange: (nextValue) => model.onConditionFormChange({ [name === "operator1" ? "val1" : "val2"]: nextValue })
1526
+ onChange: (nextValue) => model.onConditionFormChange({ [name === "operator1" ? "val1" : "val2"]: nextValue }),
1527
+ size: "small"
1502
1528
  })
1503
1529
  ]
1504
1530
  });
@@ -1510,7 +1536,8 @@ function MobileFilterByCondition(props) {
1510
1536
  condition.numOfParameters === 1 && /* @__PURE__ */ jsx(Input, {
1511
1537
  value: formParams.val1 ?? "",
1512
1538
  placeholder: localeService.t("sheets-filter-ui.panel.input-values-placeholder"),
1513
- onChange: (value) => model.onConditionFormChange({ val1: value })
1539
+ onChange: (value) => model.onConditionFormChange({ val1: value }),
1540
+ size: "small"
1514
1541
  }),
1515
1542
  condition.numOfParameters >= 2 && renderSecondaryCondition(formParams.operator1, formParams.val1 ?? "", "operator1"),
1516
1543
  condition.numOfParameters >= 2 && renderSecondaryCondition(formParams.operator2, formParams.val2 ?? "", "operator2"),
@@ -1552,6 +1579,21 @@ function MobileFilterByCondition(props) {
1552
1579
  }
1553
1580
 
1554
1581
  // src/views/mobile/MobileFilterByValue.tsx
1582
+ /**
1583
+ * Copyright 2023-present DreamNum Co., Ltd.
1584
+ *
1585
+ * Licensed under the Apache License, Version 2.0 (the "License");
1586
+ * you may not use this file except in compliance with the License.
1587
+ * You may obtain a copy of the License at
1588
+ *
1589
+ * http://www.apache.org/licenses/LICENSE-2.0
1590
+ *
1591
+ * Unless required by applicable law or agreed to in writing, software
1592
+ * distributed under the License is distributed on an "AS IS" BASIS,
1593
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1594
+ * See the License for the specific language governing permissions and
1595
+ * limitations under the License.
1596
+ */
1555
1597
  function extractCheckedKeys(items) {
1556
1598
  let checkedKeys = [];
1557
1599
  items.forEach((item) => {
@@ -1580,7 +1622,8 @@ function MobileFilterByValue(props) {
1580
1622
  className: "univer-flex-1",
1581
1623
  value: searchText,
1582
1624
  placeholder: searchLabel,
1583
- onChange: (value) => model.setSearchString(value)
1625
+ onChange: (value) => model.setSearchString(value),
1626
+ size: "small"
1584
1627
  }), /* @__PURE__ */ jsx("button", {
1585
1628
  type: "button",
1586
1629
  "aria-label": localeService.t("sheets-filter-ui.panel.cancel"),
@@ -1594,7 +1637,7 @@ function MobileFilterByValue(props) {
1594
1637
  },
1595
1638
  children: /* @__PURE__ */ jsx(CloseIcon, { className: "univer-size-5" })
1596
1639
  })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Checkbox, {
1597
- className: "univer-min-h-12 univer-flex-1 univer-text-base",
1640
+ className: "univer-flex-1",
1598
1641
  contentClassName: "univer-flex univer-items-center univer-gap-1",
1599
1642
  indeterminate,
1600
1643
  disabled: items.length === 0,
@@ -1667,6 +1710,7 @@ function MobileFilterSyncSwitch() {
1667
1710
  children: localeService.t(enabled ? "sheets-filter-ui.sync.statusTips.on" : "sheets-filter-ui.sync.statusTips.off")
1668
1711
  })]
1669
1712
  }), /* @__PURE__ */ jsx(Switch, {
1713
+ "aria-label": localeService.t("sheets-filter-ui.sync.title"),
1670
1714
  defaultChecked: enabled,
1671
1715
  onChange: (checked) => {
1672
1716
  filterSyncController.setEnabled(checked);
@@ -1763,11 +1807,13 @@ function MobileSheetsFilterPanelContent() {
1763
1807
  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",
1764
1808
  children: /* @__PURE__ */ jsxs(MobileActionRowGroup, { children: [/* @__PURE__ */ jsx(Button, {
1765
1809
  onClick: () => closePanel().catch(() => void 0),
1810
+ size: "middle",
1766
1811
  children: localeService.t("sheets-filter-ui.panel.cancel")
1767
1812
  }), /* @__PURE__ */ jsx(Button, {
1768
1813
  variant: "primary",
1769
1814
  disabled: !canApply || !filterByModel,
1770
1815
  onClick: () => applyFilter().catch(() => void 0),
1816
+ size: "middle",
1771
1817
  children: localeService.t("sheets-filter-ui.panel.confirm")
1772
1818
  })] })
1773
1819
  }) : void 0,
@@ -1783,10 +1829,12 @@ function MobileSheetsFilterPanelContent() {
1783
1829
  children: [/* @__PURE__ */ jsx(Button, {
1784
1830
  disabled: !filterRange || col <= filterRange.startColumn,
1785
1831
  onClick: () => changeColumn(-1),
1832
+ size: "middle",
1786
1833
  children: localeService.t("sheets-filter-ui.panel.mobile.previous-column")
1787
1834
  }), /* @__PURE__ */ jsx(Button, {
1788
1835
  disabled: !filterRange || col >= filterRange.endColumn,
1789
1836
  onClick: () => changeColumn(1),
1837
+ size: "middle",
1790
1838
  children: localeService.t("sheets-filter-ui.panel.mobile.next-column")
1791
1839
  })]
1792
1840
  })]
@@ -1816,7 +1864,7 @@ function MobileSheetsFilterPanelContent() {
1816
1864
  }),
1817
1865
  /* @__PURE__ */ jsx(MobileFilterSyncSwitch, {}),
1818
1866
  /* @__PURE__ */ jsx(Button, {
1819
- size: "large",
1867
+ size: "middle",
1820
1868
  disabled: !hasCriteria || !filterByModel,
1821
1869
  onClick: () => clearFilter().catch(() => void 0),
1822
1870
  children: localeService.t("sheets-filter-ui.panel.clear-filter")
@@ -2549,6 +2597,21 @@ function FilterByValue(props) {
2549
2597
  }
2550
2598
 
2551
2599
  // src/views/components/SheetsFilterSyncSwitch.tsx
2600
+ /**
2601
+ * Copyright 2023-present DreamNum Co., Ltd.
2602
+ *
2603
+ * Licensed under the Apache License, Version 2.0 (the "License");
2604
+ * you may not use this file except in compliance with the License.
2605
+ * You may obtain a copy of the License at
2606
+ *
2607
+ * http://www.apache.org/licenses/LICENSE-2.0
2608
+ *
2609
+ * Unless required by applicable law or agreed to in writing, software
2610
+ * distributed under the License is distributed on an "AS IS" BASIS,
2611
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2612
+ * See the License for the specific language governing permissions and
2613
+ * limitations under the License.
2614
+ */
2552
2615
  function FilterSyncSwitch() {
2553
2616
  const sheetsFilterSyncController = useDependency(SheetsFilterSyncController);
2554
2617
  const visible = useObservable(sheetsFilterSyncController.visible$, void 0, true);
@@ -2566,6 +2629,7 @@ function FilterSyncSwitch() {
2566
2629
  children: /* @__PURE__ */ jsx(InfoIcon, { className: "univer-block" })
2567
2630
  })]
2568
2631
  }), /* @__PURE__ */ jsx(Switch, {
2632
+ "aria-label": localeService.t("sheets-filter-ui.sync.title"),
2569
2633
  defaultChecked: enabled,
2570
2634
  onChange: (checked) => {
2571
2635
  const message = checked ? localeService.t("sheets-filter-ui.sync.switchTips.on") : localeService.t("sheets-filter-ui.sync.switchTips.off");
@@ -2865,4 +2929,4 @@ UniverSheetsFilterUIPlugin = __decorate([
2865
2929
  __decorateParam(3, Optional(IRPCChannelService))
2866
2930
  ], UniverSheetsFilterUIPlugin);
2867
2931
 
2868
- export { ChangeFilterByOperation, CloseFilterPanelOperation, OpenFilterPanelOperation, menuSchema as SheetsFilterUIMenuSchema, UniverSheetsFilterMobileUIPlugin, UniverSheetsFilterUIPlugin, UniverSheetsFilterUIWorkerPlugin };
2932
+ export { ChangeFilterByOperation, CloseFilterPanelOperation, OpenFilterPanelOperation, menuSchema as SheetsFilterUIMenuSchema, UniverSheetsFilterMobileUIPlugin, UniverSheetsFilterUIPlugin };
package/lib/es/worker.js CHANGED
@@ -1,3 +1,33 @@
1
- import { t as UniverSheetsFilterUIWorkerPlugin } from "./worker-VROMWls7.js";
1
+ import { a as _defineProperty, c as SheetsGenerateFilterValuesService, d as __decorateParam, i as version, n as defaultPluginConfig, o as ISheetsGenerateFilterValuesService, r as name, s as SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME, t as SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, u as __decorate } from "./config-CbqvVwlO.js";
2
+ import { IConfigService, Inject, Injector, Plugin, UniverInstanceType, merge } from "@univerjs/core";
3
+ import { IRPCChannelService, fromModule } from "@univerjs/rpc";
4
+
5
+ // src/worker/plugin.ts
6
+ let UniverSheetsFilterUIWorkerPlugin = class UniverSheetsFilterUIWorkerPlugin extends Plugin {
7
+ constructor(_config = defaultPluginConfig, _injector, _configService, _rpcChannelService) {
8
+ super();
9
+ this._config = _config;
10
+ this._injector = _injector;
11
+ this._configService = _configService;
12
+ this._rpcChannelService = _rpcChannelService;
13
+ const { ...rest } = merge({}, defaultPluginConfig, this._config);
14
+ this._configService.setConfig(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, rest);
15
+ }
16
+ onStarting() {
17
+ [[ISheetsGenerateFilterValuesService, { useClass: SheetsGenerateFilterValuesService }]].forEach((d) => this._injector.add(d));
18
+ }
19
+ onReady() {
20
+ this._rpcChannelService.registerChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME, fromModule(this._injector.get(ISheetsGenerateFilterValuesService)));
21
+ }
22
+ };
23
+ _defineProperty(UniverSheetsFilterUIWorkerPlugin, "type", UniverInstanceType.UNIVER_SHEET);
24
+ _defineProperty(UniverSheetsFilterUIWorkerPlugin, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN");
25
+ _defineProperty(UniverSheetsFilterUIWorkerPlugin, "packageName", name);
26
+ _defineProperty(UniverSheetsFilterUIWorkerPlugin, "version", version);
27
+ UniverSheetsFilterUIWorkerPlugin = __decorate([
28
+ __decorateParam(1, Inject(Injector)),
29
+ __decorateParam(2, IConfigService),
30
+ __decorateParam(3, IRPCChannelService)
31
+ ], UniverSheetsFilterUIWorkerPlugin);
2
32
 
3
33
  export { UniverSheetsFilterUIWorkerPlugin };