@univerjs/sheets-data-validation 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +54 -4
  2. package/lib/cjs/index.js +2 -2
  3. package/lib/es/index.js +441 -430
  4. package/lib/locale/en-US.json +12 -10
  5. package/lib/locale/ru-RU.json +3 -1
  6. package/lib/locale/vi-VN.json +3 -1
  7. package/lib/locale/zh-CN.json +11 -9
  8. package/lib/locale/zh-TW.json +3 -1
  9. package/lib/types/commands/commands/data-validation.command.d.ts +6 -1
  10. package/lib/types/commands/operations/data-validation.operation.d.ts +0 -1
  11. package/lib/types/common/date-text-map.d.ts +0 -1
  12. package/lib/types/controllers/dv-alert.controller.d.ts +0 -1
  13. package/lib/types/controllers/dv-auto-fill.controller.d.ts +0 -1
  14. package/lib/types/controllers/dv-copy-paste.controller.d.ts +0 -1
  15. package/lib/types/controllers/dv-formula.controller.d.ts +0 -1
  16. package/lib/types/controllers/dv-model.controller.d.ts +0 -1
  17. package/lib/types/controllers/dv-permission.controller.d.ts +0 -1
  18. package/lib/types/controllers/dv-ref-range.controller.d.ts +0 -1
  19. package/lib/types/controllers/dv-reject-input.controller.d.ts +0 -1
  20. package/lib/types/controllers/dv-render.controller.d.ts +0 -1
  21. package/lib/types/controllers/dv.controller.d.ts +1 -5
  22. package/lib/types/controllers/dv.menu.d.ts +0 -1
  23. package/lib/types/index.d.ts +4 -11
  24. package/lib/types/locale/en-US.d.ts +0 -1
  25. package/lib/types/locale/ru-RU.d.ts +0 -1
  26. package/lib/types/locale/vi-VN.d.ts +0 -1
  27. package/lib/types/locale/zh-CN.d.ts +2 -0
  28. package/lib/types/locale/zh-TW.d.ts +0 -1
  29. package/lib/types/mobile-plugin.d.ts +0 -1
  30. package/lib/types/models/rule-matrix.d.ts +0 -1
  31. package/lib/types/models/sheet-data-validation-manager.d.ts +2 -3
  32. package/lib/types/plugin.d.ts +0 -1
  33. package/lib/types/services/data-validation-panel.service.d.ts +0 -1
  34. package/lib/types/services/dropdown-manager.service.d.ts +1 -1
  35. package/lib/types/services/dv-cache.service.d.ts +0 -1
  36. package/lib/types/services/dv-custom-formula.service.d.ts +3 -3
  37. package/lib/types/services/dv-formula.service.d.ts +3 -3
  38. package/lib/types/services/dv-validator-service.d.ts +4 -2
  39. package/lib/types/types/const/operator-text-map.d.ts +0 -1
  40. package/lib/types/types/const/two-formula-operators.d.ts +0 -1
  41. package/lib/types/utils/formula.d.ts +0 -1
  42. package/lib/types/utils/get-cell-data-origin.d.ts +0 -1
  43. package/lib/types/validators/checkbox-validator.d.ts +0 -1
  44. package/lib/types/validators/custom-validator.d.ts +0 -1
  45. package/lib/types/validators/date-validator.d.ts +0 -1
  46. package/lib/types/validators/decimal-validator.d.ts +2 -1
  47. package/lib/types/validators/list-multiple-validator.d.ts +0 -1
  48. package/lib/types/validators/list-validator.d.ts +0 -1
  49. package/lib/types/validators/text-length-validator.d.ts +2 -1
  50. package/lib/types/validators/util.d.ts +0 -1
  51. package/lib/types/validators/whole-validator.d.ts +2 -1
  52. package/lib/types/views/date-dropdown/index.d.ts +0 -1
  53. package/lib/types/views/detail/index.d.ts +0 -1
  54. package/lib/types/views/drop-down/CellDropdown.d.ts +0 -1
  55. package/lib/types/views/formula-input/base-formula-input.d.ts +0 -1
  56. package/lib/types/views/formula-input/checkbox-formula-input.d.ts +0 -1
  57. package/lib/types/views/formula-input/custom-formula-input.d.ts +0 -1
  58. package/lib/types/views/formula-input/formula-input.d.ts +0 -1
  59. package/lib/types/views/formula-input/index.d.ts +0 -1
  60. package/lib/types/views/formula-input/list-formula-input.d.ts +0 -1
  61. package/lib/types/views/item/index.d.ts +0 -1
  62. package/lib/types/views/list/index.d.ts +0 -1
  63. package/lib/types/views/list-dropdown/index.d.ts +0 -1
  64. package/lib/types/views/options/index.d.ts +0 -1
  65. package/lib/types/views/panel/index.d.ts +0 -1
  66. package/lib/types/views/render-mode/index.d.ts +0 -1
  67. package/lib/types/views/show-time/index.d.ts +0 -1
  68. package/lib/types/widgets/checkbox-widget.d.ts +0 -1
  69. package/lib/types/widgets/dropdown-multiple-widget.d.ts +0 -1
  70. package/lib/types/widgets/dropdown-widget.d.ts +1 -3
  71. package/lib/types/widgets/shape/dropdown.d.ts +0 -1
  72. package/lib/types/widgets/shape/layout.d.ts +0 -1
  73. package/lib/umd/index.js +2 -2
  74. package/package.json +26 -26
  75. package/lib/types/services/dv.service.d.ts +0 -20
  76. package/lib/types/services/dv.tips.d.ts +0 -17
package/lib/es/index.js CHANGED
@@ -2,9 +2,9 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { DEFAULT_EMPTY_DOCUMENT_VALUE, useDependency, Inject, Disposable, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, IUniverInstanceService, UniverInstanceType, toDisposable, CommandType, ICommandService, ObjectMatrix, Range, isFormulaString, ThemeService, VerticalAlign, HorizontalAlign, createInternalEditorID, LocaleService, OnLifecycle, LifecycleStages, IPermissionService, DataValidationType, Tools, DataValidationOperator, DataValidationErrorStyle, UndoCommand, RedoCommand, isUnitRangesEqual, isValidRange, debounce, shallowEqual, Injector, DataValidationRenderMode, WrapStrategy, DocumentDataModel, BooleanNumber, Rectangle, IUndoRedoService, sequenceExecuteAsync, sequenceExecute, Optional, RxDisposable, DataValidationStatus, isRangesEqual, queryObjectMatrix, IResourceManagerService, DependentOn, Plugin } from "@univerjs/core";
6
- import { ICommandService as ICommandService2, LocaleService as LocaleService2, Plugin as Plugin2 } from "@univerjs/core";
5
+ import { DEFAULT_EMPTY_DOCUMENT_VALUE, useDependency, Inject, Disposable, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, IUniverInstanceService, UniverInstanceType, toDisposable, CommandType, ICommandService, ObjectMatrix, Range, isFormulaString, ThemeService, VerticalAlign, HorizontalAlign, createInternalEditorID, LocaleService, OnLifecycle, LifecycleStages, IPermissionService, DataValidationType, Tools, DataValidationOperator, DataValidationErrorStyle, UndoCommand, RedoCommand, isUnitRangesEqual, isValidRange, debounce, shallowEqual, Injector, DataValidationRenderMode, DEFAULT_STYLES, WrapStrategy, DocumentDataModel, BooleanNumber, numfmt, Rectangle, IUndoRedoService, sequenceExecuteAsync, sequenceExecute, Optional, RxDisposable, DataValidationStatus, isRangesEqual, queryObjectMatrix, IResourceManagerService, DependentOn, Plugin } from "@univerjs/core";
7
6
  import { DataValidatorRegistryService, DataValidationModel, BaseDataValidator, DataValidatorRegistryScope, TWO_FORMULA_OPERATOR_COUNT as TWO_FORMULA_OPERATOR_COUNT$1, getRuleOptions, getRuleSetting, RemoveDataValidationCommand, createDefaultNewRule, RemoveAllDataValidationCommand, TextLengthErrorTitleMap, AddDataValidationMutation, RemoveDataValidationMutation, UpdateRuleType, UpdateDataValidationMutation, removeDataValidationUndoFactory, DataValidationManager, AddDataValidationCommand, UniverDataValidationPlugin } from "@univerjs/data-validation";
7
+ import { DataValidationModel as DataValidationModel2, RemoveDataValidationCommand as RemoveDataValidationCommand2 } from "@univerjs/data-validation";
8
8
  import { getSheetCommandTarget, SetRangeValuesCommand, WorksheetViewPermission, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, WorkbookEditablePermission, WorksheetSetCellStylePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, SheetInterceptorService, INTERCEPTOR_POINT, SheetsSelectionsService, ClearSelectionAllCommand, RefRangeService, handleCommonDefaultRangeChangeWithEffectRefCommands, UniverSheetsPlugin } from "@univerjs/sheets";
9
9
  import { SheetCanvasPopManagerService, IMarkSelectionService, IEditorBridgeService, getCurrentRangeDisable$, AutoHeightController, SheetSkeletonManagerService, HoverManagerService, CellAlertManagerService, CellAlertType, IAutoFillService, APPLY_TYPE, virtualizeDiscreteRanges, getAutoFillRepeatRange, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, SheetPermissionInterceptorBaseController, UniverSheetsUIPlugin } from "@univerjs/sheets-ui";
10
10
  import { useObservable, ComponentManager, IZenZoneService, ISidebarService, TextEditor, useEvent, RangeSelector, KeyCode, IDialogService, MenuItemType, MenuPosition, MenuGroup, getMenuHiddenObservable, IMenuService } from "@univerjs/ui";
@@ -16,7 +16,7 @@ import { FormLayout, Input, RadioGroup, Radio, DraggableList, Select, Checkbox a
16
16
  import cs from "clsx";
17
17
  import { LexerTreeBuilder, deserializeRangeWithSheet, serializeRange, isReferenceString, sequenceNodeType, isFormulaTransformable, transformFormula } from "@univerjs/engine-formula";
18
18
  import dayjs from "dayjs";
19
- import { numfmt } from "@univerjs/engine-numfmt";
19
+ import { RichTextEditingMutation, getPlainTextFormDocument } from "@univerjs/docs";
20
20
  function getCellValueOrigin(cell) {
21
21
  if (cell === null)
22
22
  return "";
@@ -31,8 +31,8 @@ function getCellValueOrigin(cell) {
31
31
  }
32
32
  __name(getCellValueOrigin, "getCellValueOrigin");
33
33
  function getStringCellValue(cell) {
34
- var _a23;
35
- return String((_a23 = getCellValueOrigin(cell)) != null ? _a23 : "");
34
+ var _a22;
35
+ return String((_a22 = getCellValueOrigin(cell)) != null ? _a22 : "");
36
36
  }
37
37
  __name(getStringCellValue, "getStringCellValue");
38
38
  var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
@@ -85,11 +85,11 @@ function CellDropdown() {
85
85
  }
86
86
  __name(CellDropdown, "CellDropdown");
87
87
  const DROP_DOWN_KEY = "sheet.ui.dropdown";
88
- var __defProp$k = Object.defineProperty, __getOwnPropDesc$k = Object.getOwnPropertyDescriptor, __decorateClass$k = /* @__PURE__ */ __name((decorators, target, key, kind) => {
89
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
88
+ var __defProp$j = Object.defineProperty, __getOwnPropDesc$j = Object.getOwnPropertyDescriptor, __decorateClass$j = /* @__PURE__ */ __name((decorators, target, key, kind) => {
89
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
90
90
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
91
- return kind && result && __defProp$k(target, key, result), result;
92
- }, "__decorateClass$k"), __decorateParam$k = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$k"), _a;
91
+ return kind && result && __defProp$j(target, key, result), result;
92
+ }, "__decorateClass$j"), __decorateParam$j = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$j"), _a;
93
93
  let DataValidationDropdownManagerService = (_a = class extends Disposable {
94
94
  constructor(_canvasPopupManagerService, _univerInstanceService, _dataValidatorRegistryService, _zenZoneService, _renderManagerService, _dataValidationModel) {
95
95
  super();
@@ -132,8 +132,8 @@ let DataValidationDropdownManagerService = (_a = class extends Disposable {
132
132
  const disposableCollection = new DisposableCollection();
133
133
  disposableCollection.add(popupDisposable), disposableCollection.add({
134
134
  dispose: /* @__PURE__ */ __name(() => {
135
- var _a23, _b;
136
- (_b = (_a23 = this._activeDropdown) == null ? void 0 : _a23.onHide) == null || _b.call(_a23);
135
+ var _a22, _b;
136
+ (_b = (_a22 = this._activeDropdown) == null ? void 0 : _a22.onHide) == null || _b.call(_a22);
137
137
  }, "dispose")
138
138
  }), this._currentPopup = disposableCollection;
139
139
  }
@@ -169,19 +169,19 @@ let DataValidationDropdownManagerService = (_a = class extends Disposable {
169
169
  });
170
170
  }
171
171
  }, __name(_a, "DataValidationDropdownManagerService"), _a);
172
- DataValidationDropdownManagerService = __decorateClass$k([
173
- __decorateParam$k(0, Inject(SheetCanvasPopManagerService)),
174
- __decorateParam$k(1, IUniverInstanceService),
175
- __decorateParam$k(2, Inject(DataValidatorRegistryService)),
176
- __decorateParam$k(3, IZenZoneService),
177
- __decorateParam$k(4, IRenderManagerService),
178
- __decorateParam$k(5, Inject(DataValidationModel))
172
+ DataValidationDropdownManagerService = __decorateClass$j([
173
+ __decorateParam$j(0, Inject(SheetCanvasPopManagerService)),
174
+ __decorateParam$j(1, IUniverInstanceService),
175
+ __decorateParam$j(2, Inject(DataValidatorRegistryService)),
176
+ __decorateParam$j(3, IZenZoneService),
177
+ __decorateParam$j(4, IRenderManagerService),
178
+ __decorateParam$j(5, Inject(DataValidationModel))
179
179
  ], DataValidationDropdownManagerService);
180
- var __defProp$j = Object.defineProperty, __getOwnPropDesc$j = Object.getOwnPropertyDescriptor, __decorateClass$j = /* @__PURE__ */ __name((decorators, target, key, kind) => {
181
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
180
+ var __defProp$i = Object.defineProperty, __getOwnPropDesc$i = Object.getOwnPropertyDescriptor, __decorateClass$i = /* @__PURE__ */ __name((decorators, target, key, kind) => {
181
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
182
182
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
183
- return kind && result && __defProp$j(target, key, result), result;
184
- }, "__decorateClass$j"), __decorateParam$j = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$j"), _a2;
183
+ return kind && result && __defProp$i(target, key, result), result;
184
+ }, "__decorateClass$i"), __decorateParam$i = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$i"), _a2;
185
185
  let DataValidationPanelService = (_a2 = class extends Disposable {
186
186
  constructor(_univerInstanceService, _sidebarService) {
187
187
  super();
@@ -204,15 +204,15 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
204
204
  return this._open$.getValue();
205
205
  }
206
206
  dispose() {
207
- var _a23;
208
- super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (_a23 = this._closeDisposable) == null || _a23.dispose();
207
+ var _a22;
208
+ super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (_a22 = this._closeDisposable) == null || _a22.dispose();
209
209
  }
210
210
  open() {
211
211
  this._open$.next(!0);
212
212
  }
213
213
  close() {
214
- var _a23;
215
- this._open$.next(!1), (_a23 = this._closeDisposable) == null || _a23.dispose();
214
+ var _a22;
215
+ this._open$.next(!1), (_a22 = this._closeDisposable) == null || _a22.dispose();
216
216
  }
217
217
  setCloseDisposable(disposable) {
218
218
  this._closeDisposable = toDisposable(() => {
@@ -223,9 +223,9 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
223
223
  this._activeRule = rule, this._activeRule$.next(rule);
224
224
  }
225
225
  }, __name(_a2, "DataValidationPanelService"), _a2);
226
- DataValidationPanelService = __decorateClass$j([
227
- __decorateParam$j(0, IUniverInstanceService),
228
- __decorateParam$j(1, ISidebarService)
226
+ DataValidationPanelService = __decorateClass$i([
227
+ __decorateParam$i(0, IUniverInstanceService),
228
+ __decorateParam$i(1, ISidebarService)
229
229
  ], DataValidationPanelService);
230
230
  const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperation = {
231
231
  id: "data-validation.operation.open-validation-panel",
@@ -348,31 +348,32 @@ const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperatio
348
348
  };
349
349
  __name(_DataValidationCacheService, "DataValidationCacheService");
350
350
  let DataValidationCacheService = _DataValidationCacheService;
351
- var __defProp$i = Object.defineProperty, __getOwnPropDesc$i = Object.getOwnPropertyDescriptor, __decorateClass$i = /* @__PURE__ */ __name((decorators, target, key, kind) => {
352
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
351
+ var __defProp$h = Object.defineProperty, __getOwnPropDesc$h = Object.getOwnPropertyDescriptor, __decorateClass$h = /* @__PURE__ */ __name((decorators, target, key, kind) => {
352
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
353
353
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
354
- return kind && result && __defProp$i(target, key, result), result;
355
- }, "__decorateClass$i"), __decorateParam$i = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$i"), _a3;
354
+ return kind && result && __defProp$h(target, key, result), result;
355
+ }, "__decorateClass$h"), __decorateParam$h = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$h"), _a3;
356
356
  let DataValidationFormulaService = (_a3 = class extends Disposable {
357
- constructor(_registerOtherFormulaService, _dataValidationCacheService, _dataValidationModel) {
357
+ constructor(_instanceService, _registerOtherFormulaService, _dataValidationCacheService, _dataValidationModel) {
358
358
  super();
359
359
  __publicField(this, "_formulaRuleMap", /* @__PURE__ */ new Map());
360
- this._registerOtherFormulaService = _registerOtherFormulaService, this._dataValidationCacheService = _dataValidationCacheService, this._dataValidationModel = _dataValidationModel, this._initFormulaResultHandler();
360
+ this._instanceService = _instanceService, this._registerOtherFormulaService = _registerOtherFormulaService, this._dataValidationCacheService = _dataValidationCacheService, this._dataValidationModel = _dataValidationModel, this._initFormulaResultHandler();
361
361
  }
362
362
  _initFormulaResultHandler() {
363
363
  this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((resultMap) => {
364
364
  for (const unitId in resultMap) {
365
365
  const unitMap = resultMap[unitId];
366
- for (const subUnitId in unitMap) {
367
- const results = unitMap[subUnitId], formulaMap = this._ensureRuleFormulaMap(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
368
- results.forEach((result) => {
369
- var _a23, _b;
370
- if (formulaMap.get((_a23 = result.extra) == null ? void 0 : _a23.ruleId)) {
371
- const rule = manager.getRuleById((_b = result.extra) == null ? void 0 : _b.ruleId);
372
- rule && this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges);
373
- }
374
- });
375
- }
366
+ if (this._instanceService.getUnitType(unitId) === UniverInstanceType.UNIVER_SHEET)
367
+ for (const subUnitId in unitMap) {
368
+ const results = unitMap[subUnitId], formulaMap = this._ensureRuleFormulaMap(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
369
+ results.forEach((result) => {
370
+ var _a22, _b;
371
+ if (formulaMap.get((_a22 = result.extra) == null ? void 0 : _a22.ruleId)) {
372
+ const rule = manager.getRuleById((_b = result.extra) == null ? void 0 : _b.ruleId);
373
+ rule && this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges);
374
+ }
375
+ });
376
+ }
376
377
  }
377
378
  }));
378
379
  }
@@ -452,21 +453,22 @@ let DataValidationFormulaService = (_a3 = class extends Disposable {
452
453
  return this._ensureRuleFormulaMap(unitId, subUnitId).get(ruleId);
453
454
  }
454
455
  }, __name(_a3, "DataValidationFormulaService"), _a3);
455
- DataValidationFormulaService = __decorateClass$i([
456
- __decorateParam$i(0, Inject(RegisterOtherFormulaService)),
457
- __decorateParam$i(1, Inject(DataValidationCacheService)),
458
- __decorateParam$i(2, Inject(DataValidationModel))
456
+ DataValidationFormulaService = __decorateClass$h([
457
+ __decorateParam$h(0, IUniverInstanceService),
458
+ __decorateParam$h(1, Inject(RegisterOtherFormulaService)),
459
+ __decorateParam$h(2, Inject(DataValidationCacheService)),
460
+ __decorateParam$h(3, Inject(DataValidationModel))
459
461
  ], DataValidationFormulaService);
460
462
  function getFormulaResult(result) {
461
- var _a23, _b;
462
- return (_b = (_a23 = result == null ? void 0 : result[0]) == null ? void 0 : _a23[0]) == null ? void 0 : _b.v;
463
+ var _a22, _b;
464
+ return (_b = (_a22 = result == null ? void 0 : result[0]) == null ? void 0 : _a22[0]) == null ? void 0 : _b.v;
463
465
  }
464
466
  __name(getFormulaResult, "getFormulaResult");
465
- var __defProp$h = Object.defineProperty, __getOwnPropDesc$h = Object.getOwnPropertyDescriptor, __decorateClass$h = /* @__PURE__ */ __name((decorators, target, key, kind) => {
466
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
467
+ var __defProp$g = Object.defineProperty, __getOwnPropDesc$g = Object.getOwnPropertyDescriptor, __decorateClass$g = /* @__PURE__ */ __name((decorators, target, key, kind) => {
468
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
467
469
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
468
- return kind && result && __defProp$h(target, key, result), result;
469
- }, "__decorateClass$h"), __decorateParam$h = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$h");
470
+ return kind && result && __defProp$g(target, key, result), result;
471
+ }, "__decorateClass$g"), __decorateParam$g = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$g");
470
472
  const MARGIN_H$2 = 6;
471
473
  var _a4;
472
474
  let CheckboxRender = (_a4 = class {
@@ -474,8 +476,8 @@ let CheckboxRender = (_a4 = class {
474
476
  this._commandService = _commandService, this._formulaService = _formulaService, this._themeService = _themeService;
475
477
  }
476
478
  _calc(cellInfo, style) {
477
- var _a23, _b, _c;
478
- const { vt, ht } = style || {}, width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2, height = cellInfo.endY - cellInfo.startY, size = ((_a23 = style == null ? void 0 : style.fs) != null ? _a23 : 10) * 1.6;
479
+ var _a22, _b, _c;
480
+ const { vt, ht } = style || {}, width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2, height = cellInfo.endY - cellInfo.startY, size = ((_a22 = style == null ? void 0 : style.fs) != null ? _a22 : 10) * 1.6;
479
481
  let widgetLeft = 0, widgetTop = 0;
480
482
  switch (vt) {
481
483
  case VerticalAlign.TOP:
@@ -507,21 +509,21 @@ let CheckboxRender = (_a4 = class {
507
509
  };
508
510
  }
509
511
  calcCellAutoHeight(info) {
510
- var _a23;
512
+ var _a22;
511
513
  const { style } = info;
512
- return ((_a23 = style == null ? void 0 : style.fs) != null ? _a23 : 10) * 1.6;
514
+ return ((_a22 = style == null ? void 0 : style.fs) != null ? _a22 : 10) * 1.6;
513
515
  }
514
516
  async _parseFormula(rule, unitId, subUnitId) {
515
- var _a23, _b;
517
+ var _a22, _b;
516
518
  const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
517
519
  return {
518
- formula1: isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1,
520
+ formula1: isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1,
519
521
  formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
520
522
  };
521
523
  }
522
524
  drawWith(ctx, info) {
523
- var _a23, _b, _c, _d, _e;
524
- const { style, data, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info, cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a23 = data.dataValidation) == null ? void 0 : _a23.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
525
+ var _a22, _b, _c, _d, _e;
526
+ const { style, data, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info, cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a22 = data.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
525
527
  if (!rule || !validator)
526
528
  return;
527
529
  const colors = this._themeService.getCurrentTheme();
@@ -554,10 +556,10 @@ let CheckboxRender = (_a4 = class {
554
556
  return offsetX <= endX && offsetX >= startX && offsetY <= endY && offsetY >= startY;
555
557
  }
556
558
  async onPointerDown(info, evt) {
557
- var _a23, _b;
559
+ var _a22, _b;
558
560
  if (evt.button === 2)
559
561
  return;
560
- const { primaryWithCoord, unitId, subUnitId, data, worksheet, row, col } = info, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a23 = data.dataValidation) == null ? void 0 : _a23.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
562
+ const { primaryWithCoord, unitId, subUnitId, data, worksheet, row, col } = info, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a22 = data.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
561
563
  if (!rule || !validator || !validator.skipDefaultFontRender(rule, value, { unitId, subUnitId }))
562
564
  return;
563
565
  const { formula1, formula2 } = await this._parseFormula(rule, unitId, subUnitId), params = {
@@ -578,18 +580,18 @@ let CheckboxRender = (_a4 = class {
578
580
  );
579
581
  }
580
582
  }, __name(_a4, "CheckboxRender"), _a4);
581
- CheckboxRender = __decorateClass$h([
582
- __decorateParam$h(0, ICommandService),
583
- __decorateParam$h(1, Inject(DataValidationFormulaService)),
584
- __decorateParam$h(2, Inject(ThemeService))
583
+ CheckboxRender = __decorateClass$g([
584
+ __decorateParam$g(0, ICommandService),
585
+ __decorateParam$g(1, Inject(DataValidationFormulaService)),
586
+ __decorateParam$g(2, Inject(ThemeService))
585
587
  ], CheckboxRender);
586
588
  function CustomFormulaInput(props) {
587
- var _a23;
589
+ var _a22;
588
590
  const { unitId, subUnitId, value, onChange, showError, validResult } = props, formula1Res = showError ? validResult == null ? void 0 : validResult.formula1 : "";
589
591
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { error: formula1Res, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
590
592
  TextEditor,
591
593
  {
592
- value: (_a23 = value == null ? void 0 : value.formula1) != null ? _a23 : "",
594
+ value: (_a22 = value == null ? void 0 : value.formula1) != null ? _a22 : "",
593
595
  id: createInternalEditorID(`dataValidation-custom-formula-${unitId}-${subUnitId}`),
594
596
  onChange: /* @__PURE__ */ __name((newValue) => {
595
597
  onChange == null || onChange({
@@ -687,15 +689,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
687
689
  var attrs = __assign({}, node.attrs);
688
690
  extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
689
691
  var defIds = runtimeProps.defIds;
690
- return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a23) {
691
- var key = _a23[0], value = _a23[1];
692
+ return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a22) {
693
+ var key = _a22[0], value = _a22[1];
692
694
  typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
693
695
  })), attrs;
694
696
  }
695
697
  __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
696
698
  function replaceRuntimeIdsInDefs(node, runtimeProps) {
697
- var _a23, defIds = runtimeProps.defIds;
698
- return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a23 = node.children) === null || _a23 === void 0) && _a23.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
699
+ var _a22, defIds = runtimeProps.defIds;
700
+ return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a22 = node.children) === null || _a22 === void 0) && _a22.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
699
701
  return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
700
702
  }) }) : node;
701
703
  }
@@ -775,17 +777,17 @@ function getDataValidationCellValue(cellData) {
775
777
  }
776
778
  __name(getDataValidationCellValue, "getDataValidationCellValue");
777
779
  const DATA_VALIDATION_PLUGIN_NAME = "SHEET_DATA_VALIDATION_PLUGIN", DROP_DOWN_DEFAULT_COLOR = "#ECECEC";
778
- var P = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(P || {}), __defProp$g = Object.defineProperty, __getOwnPropDesc$g = Object.getOwnPropertyDescriptor, __decorateClass$g = /* @__PURE__ */ __name((decorators, target, key, kind) => {
779
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
780
+ var P = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(P || {}), __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
781
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
780
782
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
781
- return kind && result && __defProp$g(target, key, result), result;
782
- }, "__decorateClass$g"), __decorateParam$g = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$g"), _a5;
783
+ return kind && result && __defProp$f(target, key, result), result;
784
+ }, "__decorateClass$f"), __decorateParam$f = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$f"), _a5;
783
785
  let DataValidationFormulaController = (_a5 = class extends Disposable {
784
786
  constructor(_univerInstanceService, _permissionService, _lexerTreeBuilder) {
785
787
  super(), this._univerInstanceService = _univerInstanceService, this._permissionService = _permissionService, this._lexerTreeBuilder = _lexerTreeBuilder;
786
788
  }
787
789
  getFormulaRefCheck(formulaString) {
788
- var _a23, _b;
790
+ var _a22, _b;
789
791
  const sequenceNodes = this._lexerTreeBuilder.sequenceNodesBuilder(formulaString);
790
792
  if (!sequenceNodes)
791
793
  return !0;
@@ -807,7 +809,7 @@ let DataValidationFormulaController = (_a5 = class extends Disposable {
807
809
  const { startRow, endRow, startColumn, endColumn } = sequenceGrid.range;
808
810
  for (let i2 = startRow; i2 <= endRow; i2++)
809
811
  for (let j = startColumn; j <= endColumn; j++) {
810
- const permission = (_b = (_a23 = targetSheet.getCell(i2, j)) == null ? void 0 : _a23.selectionProtection) == null ? void 0 : _b[0];
812
+ const permission = (_b = (_a22 = targetSheet.getCell(i2, j)) == null ? void 0 : _a22.selectionProtection) == null ? void 0 : _b[0];
811
813
  if ((permission == null ? void 0 : permission[P.View]) === !1)
812
814
  return !1;
813
815
  }
@@ -815,11 +817,11 @@ let DataValidationFormulaController = (_a5 = class extends Disposable {
815
817
  return !0;
816
818
  }
817
819
  }, __name(_a5, "DataValidationFormulaController"), _a5);
818
- DataValidationFormulaController = __decorateClass$g([
820
+ DataValidationFormulaController = __decorateClass$f([
819
821
  OnLifecycle(LifecycleStages.Rendered, DataValidationFormulaController),
820
- __decorateParam$g(0, IUniverInstanceService),
821
- __decorateParam$g(1, IPermissionService),
822
- __decorateParam$g(2, Inject(LexerTreeBuilder))
822
+ __decorateParam$f(0, IUniverInstanceService),
823
+ __decorateParam$f(1, IPermissionService),
824
+ __decorateParam$f(2, Inject(LexerTreeBuilder))
823
825
  ], DataValidationFormulaController);
824
826
  const DEFAULT_COLOR_PRESET = [
825
827
  "#FFFFFF",
@@ -1166,18 +1168,18 @@ const _CheckboxValidator = class _CheckboxValidator extends BaseDataValidator {
1166
1168
  };
1167
1169
  }
1168
1170
  async parseFormula(rule, unitId, subUnitId) {
1169
- var _a23, _b;
1171
+ var _a22, _b;
1170
1172
  const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
1171
1173
  return {
1172
- formula1: isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1,
1174
+ formula1: isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1,
1173
1175
  formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
1174
1176
  };
1175
1177
  }
1176
1178
  parseFormulaSync(rule, unitId, subUnitId) {
1177
- var _a23, _b;
1179
+ var _a22, _b;
1178
1180
  const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = this._formulaService.getRuleFormulaResultSync(unitId, subUnitId, rule.uid);
1179
1181
  return {
1180
- formula1: isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1,
1182
+ formula1: isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1,
1181
1183
  formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
1182
1184
  };
1183
1185
  }
@@ -1204,7 +1206,7 @@ const timestamp2SerialTime = /* @__PURE__ */ __name((timestamp) => timestamp / 8
1204
1206
  dataValidationOptionsButtonIcon
1205
1207
  };
1206
1208
  function DataValidationOptions(props) {
1207
- var _a23;
1209
+ var _a22;
1208
1210
  const localeService = useDependency(LocaleService), componentManager = useDependency(ComponentManager), { value, onChange, extraComponent } = props, [show, setShow] = useState(!1), ExtraOptions = extraComponent ? componentManager.get(extraComponent) : null;
1209
1211
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1210
1212
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$5.dataValidationOptionsButton, onClick: /* @__PURE__ */ __name(() => setShow(!show), "onClick"), children: [
@@ -1220,7 +1222,7 @@ function DataValidationOptions(props) {
1220
1222
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
1221
1223
  RadioGroup,
1222
1224
  {
1223
- value: `${(_a23 = value.errorStyle) != null ? _a23 : DataValidationErrorStyle.WARNING}`,
1225
+ value: `${(_a22 = value.errorStyle) != null ? _a22 : DataValidationErrorStyle.WARNING}`,
1224
1226
  onChange: /* @__PURE__ */ __name((errorStyle) => onChange({ ...value, errorStyle: +errorStyle }), "onChange"),
1225
1227
  children: [
1226
1228
  /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationErrorStyle.WARNING}`, children: localeService.t("dataValidation.panel.showWarning") }),
@@ -1237,17 +1239,17 @@ function DataValidationOptions(props) {
1237
1239
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1238
1240
  Checkbox$1,
1239
1241
  {
1240
- checked: value.showInputMessage,
1242
+ checked: value.showErrorMessage,
1241
1243
  onChange: /* @__PURE__ */ __name(() => onChange({
1242
1244
  ...value,
1243
- showInputMessage: !value.showInputMessage
1245
+ showErrorMessage: !value.showErrorMessage
1244
1246
  }), "onChange"),
1245
1247
  children: localeService.t("dataValidation.panel.showInfo")
1246
1248
  }
1247
1249
  )
1248
1250
  }
1249
1251
  ),
1250
- value.showInputMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { value: value.error, onChange: /* @__PURE__ */ __name((error) => onChange({ ...value, error }), "onChange") }) }) : null
1252
+ value.showErrorMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { value: value.error, onChange: /* @__PURE__ */ __name((error) => onChange({ ...value, error }), "onChange") }) }) : null
1251
1253
  ] })
1252
1254
  ] });
1253
1255
  }
@@ -1275,7 +1277,7 @@ function DataValidationDetail() {
1275
1277
  }, [commandService, dataValidationModel, ruleId, subUnitId, unitId]), !validator)
1276
1278
  return null;
1277
1279
  const operators = validator.operators, operatorNames = validator.operatorNames, isTwoFormula = localRule.operator ? TWO_FORMULA_OPERATOR_COUNT$1.includes(localRule.operator) : !1, handleOk = /* @__PURE__ */ __name(() => {
1278
- validator.validatorFormula(localRule, unitId, subUnitId).success ? dataValidationPanelService.setActiveRule(null) : setShowError(!0);
1280
+ localRule.ranges.length && (validator.validatorFormula(localRule, unitId, subUnitId).success ? dataValidationPanelService.setActiveRule(null) : setShowError(!0));
1279
1281
  }, "handleOk"), handleUpdateRuleRanges = useEvent((unitRanges) => {
1280
1282
  if (isUnitRangesEqual(unitRanges, localRanges))
1281
1283
  return;
@@ -1358,20 +1360,27 @@ function DataValidationDetail() {
1358
1360
  ));
1359
1361
  }, "handleUpdateRuleOptions");
1360
1362
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1361
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("dataValidation.panel.range"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1362
- RangeSelector,
1363
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1364
+ FormLayout,
1363
1365
  {
1364
- className: styles$4.dataValidationDetailFormItem,
1365
- value: rangeStr,
1366
- id: createInternalEditorID("data-validation-detail"),
1367
- openForSheetUnitId: unitId,
1368
- openForSheetSubUnitId: subUnitId,
1369
- onChange: /* @__PURE__ */ __name((newRange) => {
1370
- newRange.some((i) => !isValidRange(i.range) || i.range.endColumn < i.range.startColumn || i.range.endRow < i.range.startRow) || handleUpdateRuleRanges(newRange);
1371
- }, "onChange")
1372
- },
1373
- key
1374
- ) }),
1366
+ label: localeService.t("dataValidation.panel.range"),
1367
+ error: localRule.ranges.length ? "" : localeService.t("dataValidation.panel.rangeError"),
1368
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1369
+ RangeSelector,
1370
+ {
1371
+ className: styles$4.dataValidationDetailFormItem,
1372
+ value: rangeStr,
1373
+ id: createInternalEditorID("data-validation-detail"),
1374
+ openForSheetUnitId: unitId,
1375
+ openForSheetSubUnitId: subUnitId,
1376
+ onChange: /* @__PURE__ */ __name((newRange) => {
1377
+ newRange.some((i) => !isValidRange(i.range) || i.range.endColumn < i.range.startColumn || i.range.endRow < i.range.startRow) || handleUpdateRuleRanges(newRange);
1378
+ }, "onChange")
1379
+ },
1380
+ key
1381
+ )
1382
+ }
1383
+ ),
1375
1384
  /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("dataValidation.panel.type"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1376
1385
  Select,
1377
1386
  {
@@ -1445,8 +1454,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
1445
1454
  }), e.stopPropagation();
1446
1455
  }, "handleDelete");
1447
1456
  return useEffect(() => () => {
1448
- var _a23;
1449
- ids.current && ((_a23 = ids.current) == null || _a23.forEach((id) => {
1457
+ var _a22;
1458
+ ids.current && ((_a22 = ids.current) == null || _a22.forEach((id) => {
1450
1459
  id && markSelectionService.removeShape(id);
1451
1460
  }));
1452
1461
  }, [markSelectionService]), /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -1477,8 +1486,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
1477
1486
  })));
1478
1487
  }, "onMouseEnter"),
1479
1488
  onMouseLeave: /* @__PURE__ */ __name(() => {
1480
- var _a23;
1481
- setIsHover(!1), (_a23 = ids.current) == null || _a23.forEach((id) => {
1489
+ var _a22;
1490
+ setIsHover(!1), (_a22 = ids.current) == null || _a22.forEach((id) => {
1482
1491
  id && markSelectionService.removeShape(id);
1483
1492
  }), ids.current = void 0;
1484
1493
  }, "onMouseLeave"),
@@ -1535,11 +1544,11 @@ function DataValidationListWithWorkbook(props) {
1535
1544
  return rules2.map((rule) => {
1536
1545
  const { ranges } = rule;
1537
1546
  return (ranges == null ? void 0 : ranges.some((range) => {
1538
- var _a23, _b;
1547
+ var _a22, _b;
1539
1548
  const { startRow, startColumn, endRow, endColumn } = range;
1540
1549
  for (let row = startRow; row <= endRow; row++)
1541
1550
  for (let col = startColumn; col <= endColumn; col++) {
1542
- const permission = (_b = (_a23 = worksheet2 == null ? void 0 : worksheet2.getCell(row, col)) == null ? void 0 : _a23.selectionProtection) == null ? void 0 : _b[0];
1551
+ const permission = (_b = (_a22 = worksheet2 == null ? void 0 : worksheet2.getCell(row, col)) == null ? void 0 : _a22.selectionProtection) == null ? void 0 : _b[0];
1543
1552
  if ((permission == null ? void 0 : permission[P.Edit]) === !1 || (permission == null ? void 0 : permission[P.View]) === !1)
1544
1553
  return !0;
1545
1554
  }
@@ -1549,7 +1558,7 @@ function DataValidationListWithWorkbook(props) {
1549
1558
  }, "getDvRulesByPermissionCorrect"))(rules), hasDisableRule = rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.some((rule) => rule.disable);
1550
1559
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1551
1560
  rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.map((rule) => {
1552
- var _a23;
1561
+ var _a22;
1553
1562
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1554
1563
  DataValidationItem,
1555
1564
  {
@@ -1563,7 +1572,7 @@ function DataValidationListWithWorkbook(props) {
1563
1572
  });
1564
1573
  }, "onClick"),
1565
1574
  rule,
1566
- disable: (_a23 = rule.disable) != null ? _a23 : !1
1575
+ disable: (_a22 = rule.disable) != null ? _a22 : !1
1567
1576
  },
1568
1577
  rule.uid
1569
1578
  );
@@ -1589,10 +1598,10 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
1589
1598
  dvListDropdownSplit,
1590
1599
  dvListDropdownEdit
1591
1600
  }, SelectList = /* @__PURE__ */ __name((props) => {
1592
- const { value, onChange, multiple, options, title, onEdit, style } = props;
1601
+ const { value, onChange, multiple, options, title, onEdit, style, filter: filter2 } = props, localeService = useDependency(LocaleService), lowerFilter = filter2 == null ? void 0 : filter2.toLowerCase(), filteredOptions = options.filter((item) => lowerFilter ? item.label.toLowerCase().includes(lowerFilter) : !0);
1593
1602
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.dvListDropdown, style, children: [
1594
1603
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownTitle, children: title }),
1595
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownList, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Scrollbar, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownListContainer, children: options.map((item, i) => {
1604
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownList, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Scrollbar, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownListContainer, children: filteredOptions.map((item, i) => {
1596
1605
  const selected = value.indexOf(item.value) > -1, handleClick = /* @__PURE__ */ __name(() => {
1597
1606
  let set;
1598
1607
  selected ? set = new Set(value.filter((sub) => sub !== item.value)) : set = new Set(multiple ? [...value, item.value] : [item.value]);
@@ -1600,31 +1609,52 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
1600
1609
  options.forEach((opt) => {
1601
1610
  set.has(opt.value) && newValue.push(opt.value);
1602
1611
  }), onChange(newValue);
1603
- }, "handleClick");
1612
+ }, "handleClick"), index = item.label.toLocaleLowerCase().indexOf(lowerFilter);
1604
1613
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.dvListDropdownItemContainer, onClick: handleClick, children: [
1605
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownItem, style: { background: item.color || DROP_DOWN_DEFAULT_COLOR }, children: item.label }),
1614
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownItem, style: { background: item.color || DROP_DOWN_DEFAULT_COLOR }, children: lowerFilter && item.label.toLowerCase().includes(lowerFilter) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1615
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: item.label.substring(0, index) }),
1616
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { fontWeight: "bold" }, children: item.label.substring(index, index + lowerFilter.length) }),
1617
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: item.label.substring(index + lowerFilter.length) })
1618
+ ] }) : item.label }),
1606
1619
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownSelectedIcon, children: selected ? /* @__PURE__ */ jsxRuntimeExports.jsx(CheckMarkSingle, {}) : null })
1607
1620
  ] }, i);
1608
- }) }) }) }),
1621
+ }) }) }, filter2) }),
1609
1622
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownSplit }),
1610
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownEdit, children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { onClick: onEdit, children: "编辑" }) })
1623
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownEdit, children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { onClick: onEdit, children: localeService.t("dataValidation.list.edit") }) })
1611
1624
  ] });
1612
1625
  }, "SelectList");
1613
1626
  function ListDropDown(props) {
1614
- var _a23, _b;
1615
- const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId } = location, dataValidationModel = useDependency(DataValidationModel), commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [localValue, setLocalValue] = useState(""), editorBridgeService = useDependency(IEditorBridgeService), ruleChange$ = useMemo(() => dataValidationModel.ruleChange$.pipe(debounceTime(16)), []);
1627
+ var _a22, _b;
1628
+ const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId } = location, dataValidationModel = useDependency(DataValidationModel), [editingText, setEditingText] = useState(""), commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [localValue, setLocalValue] = useState(""), editorBridgeService = useDependency(IEditorBridgeService), instanceService = useDependency(IUniverInstanceService), ruleChange$ = useMemo(() => dataValidationModel.ruleChange$.pipe(debounceTime(16)), []);
1616
1629
  useObservable(ruleChange$);
1617
1630
  const anchorRect = RectPopup.useContext(), cellWidth = anchorRect.right - anchorRect.left;
1618
- if (!worksheet)
1631
+ if (useEffect(() => {
1632
+ const dispose = commandService.onCommandExecuted((command) => {
1633
+ if (command.id === RichTextEditingMutation.id) {
1634
+ const params = command.params, { unitId: unitId2 } = params, unit = instanceService.getUnit(unitId2, UniverInstanceType.UNIVER_DOC);
1635
+ if (!unit)
1636
+ return;
1637
+ const text = getPlainTextFormDocument(unit.getSnapshot());
1638
+ setEditingText(text);
1639
+ }
1640
+ });
1641
+ return () => {
1642
+ dispose.dispose();
1643
+ };
1644
+ }, [commandService, instanceService]), !worksheet)
1619
1645
  return null;
1620
- const cellData = worksheet.getCell(row, col), rule = (_a23 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a23.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, showColor = (rule == null ? void 0 : rule.renderMode) === DataValidationRenderMode.CUSTOM || (rule == null ? void 0 : rule.renderMode) === void 0;
1621
- if (!cellData || !rule || !validator)
1646
+ const cellData = worksheet.getCell(row, col), rule = (_a22 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, showColor = (rule == null ? void 0 : rule.renderMode) === DataValidationRenderMode.CUSTOM || (rule == null ? void 0 : rule.renderMode) === void 0;
1647
+ if (!cellData || !rule || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0)
1622
1648
  return;
1623
1649
  const multiple = rule.type === DataValidationType.LIST_MULTIPLE, list = validator.getListWithColor(rule, unitId, subUnitId), cellStr = localValue || getDataValidationCellValue(worksheet.getCellRaw(row, col)), value = deserializeListOptions(cellStr), handleEdit = /* @__PURE__ */ __name(() => {
1624
1650
  commandService.executeCommand(OpenValidationPanelOperation.id, {
1625
1651
  ruleId: rule.uid
1626
1652
  }), hideFn();
1627
- }, "handleEdit");
1653
+ }, "handleEdit"), options = list.map((item) => ({
1654
+ label: item.label,
1655
+ value: item.label,
1656
+ color: showColor ? item.color : "transparent"
1657
+ }));
1628
1658
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1629
1659
  SelectList,
1630
1660
  {
@@ -1659,12 +1689,9 @@ function ListDropDown(props) {
1659
1689
  unitId
1660
1690
  }), commandService.executeCommand(SetRangeValuesCommand.id, params), setLocalValue(str), multiple || hideFn();
1661
1691
  }, "onChange"),
1662
- options: list.map((item) => ({
1663
- label: item.label,
1664
- value: item.label,
1665
- color: showColor ? item.color : "transparent"
1666
- })),
1667
- onEdit: handleEdit
1692
+ options,
1693
+ onEdit: handleEdit,
1694
+ filter: editingText
1668
1695
  }
1669
1696
  );
1670
1697
  }
@@ -1745,11 +1772,11 @@ var utc$1 = { exports: {} };
1745
1772
  })(utc$1);
1746
1773
  var utcExports = utc$1.exports;
1747
1774
  const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports);
1748
- var __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1749
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1775
+ var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1776
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1750
1777
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1751
- return kind && result && __defProp$f(target, key, result), result;
1752
- }, "__decorateClass$f"), __decorateParam$f = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$f"), _a6;
1778
+ return kind && result && __defProp$e(target, key, result), result;
1779
+ }, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e"), _a6;
1753
1780
  let DataValidationRejectInputController = (_a6 = class extends Disposable {
1754
1781
  constructor(_editorBridgeService, _dataValidationModel, _dataValidatorRegistryService, _dialogService, _localeService) {
1755
1782
  super(), this._editorBridgeService = _editorBridgeService, this._dataValidationModel = _dataValidationModel, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._dialogService = _dialogService, this._localeService = _localeService, this._initEditorBridgeInterceptor();
@@ -1759,7 +1786,7 @@ let DataValidationRejectInputController = (_a6 = class extends Disposable {
1759
1786
  this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT_ASYNC,
1760
1787
  {
1761
1788
  handler: /* @__PURE__ */ __name(async (cellPromise, context, next) => {
1762
- const cell = await cellPromise, { worksheet, row, col, unitId, subUnitId } = context, manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleId = manager.getRuleIdByLocation(row, col), rule = ruleId ? manager.getRuleById(ruleId) : void 0;
1789
+ const cell = await cellPromise, { worksheet, row, col, unitId, subUnitId, workbook } = context, manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleId = manager.getRuleIdByLocation(row, col), rule = ruleId ? manager.getRuleById(ruleId) : void 0;
1763
1790
  if (!rule || rule.errorStyle !== DataValidationErrorStyle.STOP)
1764
1791
  return next(Promise.resolve(cell));
1765
1792
  const validator = await this._dataValidatorRegistryService.getValidatorItem(rule.type);
@@ -1769,7 +1796,9 @@ let DataValidationRejectInputController = (_a6 = class extends Disposable {
1769
1796
  row,
1770
1797
  column: col,
1771
1798
  unitId,
1772
- subUnitId
1799
+ subUnitId,
1800
+ worksheet,
1801
+ workbook
1773
1802
  },
1774
1803
  rule
1775
1804
  ))
@@ -1828,13 +1857,13 @@ let DataValidationRejectInputController = (_a6 = class extends Disposable {
1828
1857
  });
1829
1858
  }
1830
1859
  }, __name(_a6, "DataValidationRejectInputController"), _a6);
1831
- DataValidationRejectInputController = __decorateClass$f([
1860
+ DataValidationRejectInputController = __decorateClass$e([
1832
1861
  OnLifecycle(LifecycleStages.Ready, DataValidationRejectInputController),
1833
- __decorateParam$f(0, IEditorBridgeService),
1834
- __decorateParam$f(1, Inject(DataValidationModel)),
1835
- __decorateParam$f(2, Inject(DataValidatorRegistryService)),
1836
- __decorateParam$f(3, IDialogService),
1837
- __decorateParam$f(4, Inject(LocaleService))
1862
+ __decorateParam$e(0, IEditorBridgeService),
1863
+ __decorateParam$e(1, Inject(DataValidationModel)),
1864
+ __decorateParam$e(2, Inject(DataValidatorRegistryService)),
1865
+ __decorateParam$e(3, IDialogService),
1866
+ __decorateParam$e(4, Inject(LocaleService))
1838
1867
  ], DataValidationRejectInputController);
1839
1868
  const dvDateDropdown = "univer-dv-date-dropdown", dvDateDropdownBtns = "univer-dv-date-dropdown-btns", styles = {
1840
1869
  dvDateDropdown,
@@ -1853,20 +1882,22 @@ const transformDate = /* @__PURE__ */ __name((value) => {
1853
1882
  return date;
1854
1883
  }, "transformDate");
1855
1884
  function DateDropdown(props) {
1856
- var _a23, _b, _c;
1857
- const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId } = location, commandService = useDependency(ICommandService), rejectInputController = useDependency(DataValidationRejectInputController), cellData = worksheet.getCell(row, col), rule = (_a23 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a23.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, cellStr = getCellValueOrigin(worksheet.getCellRaw(row, col)), originDate = transformDate(cellStr), [localDate, setLocalDate] = useState(originDate), showTime = !!((_c = rule == null ? void 0 : rule.bizInfo) != null && _c.showTime), date = localDate && localDate.isValid() ? localDate : dayjs();
1885
+ var _a22, _b, _c;
1886
+ const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId, workbook } = location, commandService = useDependency(ICommandService), rejectInputController = useDependency(DataValidationRejectInputController), cellData = worksheet.getCell(row, col), rule = (_a22 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, cellStr = getCellValueOrigin(worksheet.getCellRaw(row, col)), originDate = transformDate(cellStr), [localDate, setLocalDate] = useState(originDate), showTime = !!((_c = rule == null ? void 0 : rule.bizInfo) != null && _c.showTime), date = localDate && localDate.isValid() ? localDate : dayjs(), localeService = useDependency(LocaleService);
1858
1887
  if (!cellData || !rule || !validator)
1859
1888
  return;
1860
1889
  const handleSave = /* @__PURE__ */ __name(async () => {
1861
- if (!localDate)
1890
+ if (!date)
1862
1891
  return;
1863
- const dateStr = `${localDate.format(showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00").split(" ").join("T")}Z`, serialTime = timestamp2SerialTime(dayjs(dateStr).unix());
1892
+ const dateStr = `${date.format(showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00").split(" ").join("T")}Z`, serialTime = timestamp2SerialTime(dayjs(dateStr).unix());
1864
1893
  rule.errorStyle !== DataValidationErrorStyle.STOP || await validator.validator({
1865
1894
  value: serialTime,
1866
1895
  unitId,
1867
1896
  subUnitId,
1868
1897
  row,
1869
- column: col
1898
+ column: col,
1899
+ worksheet,
1900
+ workbook
1870
1901
  }, rule) ? (commandService.executeCommand(SetRangeValuesCommand.id, {
1871
1902
  unitId,
1872
1903
  subUnitId,
@@ -1894,8 +1925,8 @@ function DateDropdown(props) {
1894
1925
  /* @__PURE__ */ jsxRuntimeExports.jsx(
1895
1926
  DatePanel,
1896
1927
  {
1897
- defaultValue: localDate,
1898
- pickerValue: localDate != null ? localDate : date,
1928
+ defaultValue: date,
1929
+ pickerValue: date,
1899
1930
  showTime: showTime || void 0,
1900
1931
  onSelect: /* @__PURE__ */ __name(async (newValue) => {
1901
1932
  setLocalDate(newValue);
@@ -1905,7 +1936,7 @@ function DateDropdown(props) {
1905
1936
  }, "onPanelChange")
1906
1937
  }
1907
1938
  ),
1908
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.dvDateDropdownBtns, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "primary", onClick: handleSave, disabled: !localDate, children: "确定" }) })
1939
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.dvDateDropdownBtns, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "primary", onClick: handleSave, disabled: !date.isValid(), children: localeService.t("dataValidation.alert.ok") }) })
1909
1940
  ] });
1910
1941
  }
1911
1942
  __name(DateDropdown, "DateDropdown");
@@ -1940,12 +1971,12 @@ const DateOperatorTitleMap = {
1940
1971
  [DataValidationOperator.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual"
1941
1972
  }, DATE_SHOW_TIME_OPTION = "DATE_SHOW_TIME_OPTION";
1942
1973
  function DateShowTimeOption(props) {
1943
- var _a23;
1974
+ var _a22;
1944
1975
  const { value, onChange } = props, localeService = useDependency(LocaleService);
1945
1976
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1946
1977
  Checkbox$1,
1947
1978
  {
1948
- checked: (_a23 = value.bizInfo) == null ? void 0 : _a23.showTime,
1979
+ checked: (_a22 = value.bizInfo) == null ? void 0 : _a22.showTime,
1949
1980
  onChange: /* @__PURE__ */ __name((showTime) => {
1950
1981
  onChange({
1951
1982
  ...value,
@@ -1990,24 +2021,24 @@ const FORMULA1$1 = "{FORMULA1}", FORMULA2$1 = "{FORMULA2}", transformDate2Serial
1990
2021
  __publicField(this, "_formulaService", this.injector.get(DataValidationFormulaService));
1991
2022
  }
1992
2023
  async parseFormula(rule, unitId, subUnitId) {
1993
- var _a23, _b;
2024
+ var _a22, _b;
1994
2025
  const results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
1995
2026
  return {
1996
- formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1),
2027
+ formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1),
1997
2028
  formula2: transformDate2SerialNumber(isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2)
1998
2029
  };
1999
2030
  }
2000
2031
  parseFormulaSync(rule, unitId, subUnitId) {
2001
- var _a23, _b;
2032
+ var _a22, _b;
2002
2033
  const results = this._formulaService.getRuleFormulaResultSync(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
2003
2034
  return {
2004
- formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1),
2035
+ formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1),
2005
2036
  formula2: transformDate2SerialNumber(isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2)
2006
2037
  };
2007
2038
  }
2008
2039
  async isValidType(info) {
2009
- const { value } = info;
2010
- return typeof value == "string" ? dayjs(value, "YYYY-MM-DD HH:mm:ss", !0).isValid() : typeof value == "number";
2040
+ const { value, worksheet, row, column } = info, cell = worksheet.getCell(row, column), interceptValue = getCellValueOrigin(cell);
2041
+ return typeof interceptValue == "string" && typeof value == "number" ? dayjs(interceptValue).isValid() : !1;
2011
2042
  }
2012
2043
  _validatorSingleFormula(formula) {
2013
2044
  return !Tools.isBlank(formula) && (isFormulaString(formula) || !Number.isNaN(+formula) || !!formula && dayjs(formula).isValid());
@@ -2081,25 +2112,25 @@ const FORMULA1$1 = "{FORMULA1}", FORMULA2$1 = "{FORMULA2}", transformDate2Serial
2081
2112
  return this.operators.map((operator) => this.localeService.t(DateOperatorNameMap[operator]));
2082
2113
  }
2083
2114
  generateRuleName(rule) {
2084
- var _a23, _b;
2115
+ var _a22, _b;
2085
2116
  if (!rule.operator)
2086
2117
  return this.titleStr;
2087
- const ruleName = this.localeService.t(DateOperatorTitleMap[rule.operator]).replace(FORMULA1$1, (_a23 = rule.formula1) != null ? _a23 : "").replace(FORMULA2$1, (_b = rule.formula2) != null ? _b : "");
2118
+ const ruleName = this.localeService.t(DateOperatorTitleMap[rule.operator]).replace(FORMULA1$1, (_a22 = rule.formula1) != null ? _a22 : "").replace(FORMULA2$1, (_b = rule.formula2) != null ? _b : "");
2088
2119
  return `${this.titleStr} ${ruleName}`;
2089
2120
  }
2090
2121
  generateRuleErrorMessage(rule) {
2091
- var _a23, _b;
2092
- return rule.operator ? `${this.localeService.t(DateOperatorErrorTitleMap[rule.operator]).replace(FORMULA1$1, (_a23 = rule.formula1) != null ? _a23 : "").replace(FORMULA2$1, (_b = rule.formula2) != null ? _b : "")}` : this.titleStr;
2122
+ var _a22, _b;
2123
+ return rule.operator ? `${this.localeService.t(DateOperatorErrorTitleMap[rule.operator]).replace(FORMULA1$1, (_a22 = rule.formula1) != null ? _a22 : "").replace(FORMULA2$1, (_b = rule.formula2) != null ? _b : "")}` : this.titleStr;
2093
2124
  }
2094
2125
  };
2095
2126
  __name(_DateValidator, "DateValidator");
2096
2127
  let DateValidator = _DateValidator;
2097
- var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2098
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2128
+ var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPropertyDescriptor, __decorateClass$d = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2129
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2099
2130
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2100
- return kind && result && __defProp$e(target, key, result), result;
2101
- }, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e");
2102
- const PADDING_H$1 = 4, ICON_SIZE = 6, ICON_PLACE$1 = 14, MARGIN_H$1 = 6, MARGIN_V$1 = 4, DROP_DOWN_ICON_COLOR = "#565656", downPath$1 = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
2131
+ return kind && result && __defProp$d(target, key, result), result;
2132
+ }, "__decorateClass$d"), __decorateParam$d = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$d");
2133
+ const PADDING_H$1 = 4, ICON_SIZE = 4, ICON_PLACE$1 = 14, MARGIN_H$1 = 6, MARGIN_V$1 = 4, DROP_DOWN_ICON_COLOR = "#565656", downPath$1 = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
2103
2134
  function convertToDocumentData(text, style) {
2104
2135
  const contentLength = text.length;
2105
2136
  return {
@@ -2167,17 +2198,18 @@ function createDocuments(text, localeService, style) {
2167
2198
  };
2168
2199
  }
2169
2200
  __name(createDocuments, "createDocuments");
2170
- function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht) {
2201
+ function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht, margin = !0) {
2171
2202
  let paddingTop = 0;
2203
+ const realMargin = margin ? MARGIN_V$1 : 0;
2172
2204
  switch (vt) {
2173
2205
  case VerticalAlign.BOTTOM:
2174
- paddingTop = cellHeight - MARGIN_V$1 * 2 - fontHeight + MARGIN_V$1;
2206
+ paddingTop = cellHeight - realMargin * 2 - fontHeight + realMargin;
2175
2207
  break;
2176
2208
  case VerticalAlign.MIDDLE:
2177
- paddingTop = (cellHeight - MARGIN_V$1 * 2 - fontHeight) / 2 + MARGIN_V$1;
2209
+ paddingTop = (cellHeight - realMargin * 2 - fontHeight) / 2 + realMargin;
2178
2210
  break;
2179
2211
  default:
2180
- paddingTop = MARGIN_V$1;
2212
+ paddingTop = realMargin;
2181
2213
  break;
2182
2214
  }
2183
2215
  let paddingLeft = 0;
@@ -2198,6 +2230,12 @@ __name(calcPadding, "calcPadding");
2198
2230
  var _a7;
2199
2231
  let DropdownWidget = (_a7 = class {
2200
2232
  constructor(_localeService, _commandService) {
2233
+ // static padding: IPaddingData = {
2234
+ // l: MARGIN_H + PADDING_H,
2235
+ // r: ICON_PLACE + MARGIN_H,
2236
+ // t: MARGIN_V,
2237
+ // b: MARGIN_V,
2238
+ // };
2201
2239
  __publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
2202
2240
  __publicField(this, "zIndex");
2203
2241
  __publicField(this, "onPointerEnter");
@@ -2211,24 +2249,27 @@ let DropdownWidget = (_a7 = class {
2211
2249
  _generateKey(row, col) {
2212
2250
  return `${row}.${col}`;
2213
2251
  }
2214
- _drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, vt) {
2215
- const left = cellWidth - ICON_PLACE$1 + 4;
2216
- let top = 9;
2252
+ _drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, fontHeight, vt, pd) {
2253
+ const { t = DEFAULT_STYLES.pd.t, b = DEFAULT_STYLES.pd.b } = pd, left = cellWidth - ICON_PLACE$1;
2254
+ let top;
2217
2255
  switch (vt) {
2218
2256
  case VerticalAlign.MIDDLE:
2219
- top = (cellHeight - ICON_PLACE$1) / 2 + 4;
2257
+ top = (cellHeight - ICON_SIZE) / 2;
2220
2258
  break;
2221
2259
  case VerticalAlign.BOTTOM:
2222
- top = cellHeight - ICON_PLACE$1 - 1;
2260
+ top = cellHeight - ICON_SIZE / 2 - b - fontHeight / 2;
2261
+ break;
2262
+ default:
2263
+ top = t + fontHeight / 2 - ICON_SIZE / 2;
2223
2264
  break;
2224
2265
  }
2225
2266
  ctx.save(), ctx.translateWithPrecision(cellBounding.startX + left, cellBounding.startY + top), ctx.fillStyle = "#565656", ctx.fill(downPath$1), ctx.restore();
2226
2267
  }
2227
- // eslint-disable-next-line max-lines-per-function
2268
+ // eslint-disable-next-line max-lines-per-function, complexity
2228
2269
  drawWith(ctx, info, skeleton) {
2229
- var _a23, _b;
2230
- const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, rule = (_a23 = data.dataValidation) == null ? void 0 : _a23.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {};
2231
- if (!rule || !validator || !validator.skipDefaultFontRender(rule))
2270
+ var _a22, _b;
2271
+ const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, rule = (_a22 = data.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {};
2272
+ if (!rule || !validator || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0 || !validator.skipDefaultFontRender(rule))
2232
2273
  return;
2233
2274
  const cellBounding = {
2234
2275
  startX: _cellBounding.startX + leftOffset,
@@ -2236,31 +2277,30 @@ let DropdownWidget = (_a7 = class {
2236
2277
  startY: _cellBounding.startY + topOffset,
2237
2278
  endY: _cellBounding.endY - downOffset
2238
2279
  }, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, map = this._ensureMap(subUnitId), key = this._generateKey(row, col), list = validator.getListWithColor(rule), value = getCellValueOrigin(data), valueStr = `${value != null ? value : ""}`, activeItem = list.find((i) => i.label === valueStr);
2239
- let { tb, vt, ht } = style || {};
2240
- if (tb = tb != null ? tb : WrapStrategy.WRAP, vt = vt != null ? vt : VerticalAlign.BOTTOM, ht = ht != null ? ht : HorizontalAlign.LEFT, rule.renderMode === DataValidationRenderMode.ARROW) {
2241
- this._drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, vt), ctx.save(), ctx.translateWithPrecision(cellBounding.startX, cellBounding.startY), ctx.beginPath(), ctx.rect(0, 0, cellWidth, cellHeight), ctx.clip();
2242
- const realWidth = cellWidth - ICON_PLACE$1, { documentSkeleton, documents, docModel } = createDocuments(valueStr, this._localeService, style);
2280
+ let { tb, vt, ht, pd } = style || {};
2281
+ if (tb = tb != null ? tb : WrapStrategy.WRAP, vt = vt != null ? vt : VerticalAlign.BOTTOM, ht = ht != null ? ht : DEFAULT_STYLES.ht, pd = pd != null ? pd : DEFAULT_STYLES.pd, rule.renderMode === DataValidationRenderMode.ARROW) {
2282
+ const { l: l2 = DEFAULT_STYLES.pd.l, t = DEFAULT_STYLES.pd.t, r = DEFAULT_STYLES.pd.r, b = DEFAULT_STYLES.pd.b } = pd, realWidth = cellWidth - l2 - r - ICON_PLACE$1, { documentSkeleton, documents, docModel } = createDocuments(valueStr, this._localeService, style);
2243
2283
  tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate(), documentSkeleton.getActualSize();
2244
- const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight, width: fontWidth } = textLayout, { paddingTop, paddingLeft } = calcPadding(realWidth, cellHeight, fontWidth, fontHeight, vt, ht);
2245
- ctx.translate(0, paddingTop), ctx.save(), ctx.translateWithPrecision(PADDING_H$1, 0), ctx.beginPath(), ctx.rect(0, 0, realWidth, fontHeight), ctx.clip(), documents.render(ctx), ctx.translateWithPrecision(paddingLeft, 0), ctx.restore(), ctx.restore(), map.set(key, {
2246
- left: cellBounding.endX + skeleton.rowHeaderWidth - ICON_PLACE$1,
2247
- top: cellBounding.startY + skeleton.columnHeaderHeight,
2284
+ const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight, width: fontWidth } = textLayout, { paddingTop, paddingLeft } = calcPadding(realWidth, cellHeight - t - b, fontWidth, fontHeight, vt, ht, !1);
2285
+ this._drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, fontHeight, vt, pd), ctx.save(), ctx.translateWithPrecision(cellBounding.startX + l2, cellBounding.startY + t), ctx.beginPath(), ctx.rect(0, 0, cellWidth - l2 - r, cellHeight - t - b), ctx.clip(), ctx.translateWithPrecision(0, paddingTop), ctx.save(), ctx.translateWithPrecision(PADDING_H$1, 0), ctx.beginPath(), ctx.rect(0, 0, realWidth, fontHeight), ctx.clip(), documents.render(ctx), ctx.translateWithPrecision(paddingLeft, 0), ctx.restore(), ctx.restore(), map.set(key, {
2286
+ left: cellBounding.endX + l2 + skeleton.rowHeaderWidth - ICON_PLACE$1,
2287
+ top: cellBounding.startY + t + skeleton.columnHeaderHeight,
2248
2288
  width: ICON_PLACE$1,
2249
- height: cellHeight
2289
+ height: cellHeight - t - b
2250
2290
  });
2251
2291
  } else {
2252
2292
  ctx.save(), ctx.translateWithPrecision(cellBounding.startX, cellBounding.startY), ctx.beginPath(), ctx.rect(0, 0, cellWidth, cellHeight), ctx.clip();
2253
2293
  const realWidth = cellWidth - MARGIN_H$1 * 2 - PADDING_H$1 - ICON_PLACE$1, { documentSkeleton, documents, docModel } = createDocuments(valueStr, this._localeService, style);
2254
2294
  tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate();
2255
2295
  const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight, width: fontWidth } = textLayout, { paddingTop, paddingLeft } = calcPadding(realWidth, cellHeight, fontWidth, fontHeight, vt, ht);
2256
- ctx.translate(MARGIN_H$1, paddingTop);
2296
+ ctx.translateWithPrecision(MARGIN_H$1, paddingTop);
2257
2297
  const rectWidth = Math.max(cellWidth - MARGIN_H$1 * 2, 1), rectHeight = fontHeight;
2258
2298
  Rect.drawWith(ctx, {
2259
2299
  width: rectWidth,
2260
2300
  height: rectHeight,
2261
2301
  fill: (activeItem == null ? void 0 : activeItem.color) || DROP_DOWN_DEFAULT_COLOR,
2262
2302
  radius: 8
2263
- }), ctx.save(), ctx.translateWithPrecision(PADDING_H$1, 0), ctx.beginPath(), ctx.rect(0, 0, realWidth, fontHeight), ctx.clip(), ctx.translateWithPrecision(paddingLeft, 0), documents.render(ctx), ctx.restore(), ctx.translate(realWidth + PADDING_H$1 + 4, (fontHeight - ICON_SIZE) / 2), ctx.fillStyle = DROP_DOWN_ICON_COLOR, ctx.fill(downPath$1), ctx.restore(), map.set(key, {
2303
+ }), ctx.save(), ctx.translateWithPrecision(PADDING_H$1, 0), ctx.beginPath(), ctx.rect(0, 0, realWidth, fontHeight), ctx.clip(), ctx.translateWithPrecision(paddingLeft, 0), documents.render(ctx), ctx.restore(), ctx.translateWithPrecision(realWidth + PADDING_H$1 + 4, (fontHeight - ICON_SIZE) / 2), ctx.fillStyle = DROP_DOWN_ICON_COLOR, ctx.fill(downPath$1), ctx.restore(), map.set(key, {
2264
2304
  left: cellBounding.startX + MARGIN_H$1 + skeleton.rowHeaderWidth,
2265
2305
  top: cellBounding.startY + paddingTop + skeleton.columnHeaderHeight,
2266
2306
  width: rectWidth,
@@ -2269,8 +2309,8 @@ let DropdownWidget = (_a7 = class {
2269
2309
  }
2270
2310
  }
2271
2311
  calcCellAutoHeight(info) {
2272
- var _a23;
2273
- const { primaryWithCoord, style, data } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, rule = (_a23 = data.dataValidation) == null ? void 0 : _a23.rule;
2312
+ var _a22;
2313
+ const { primaryWithCoord, style, data } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, rule = (_a22 = data.dataValidation) == null ? void 0 : _a22.rule;
2274
2314
  if (!rule || rule.renderMode === DataValidationRenderMode.TEXT)
2275
2315
  return;
2276
2316
  const cellBounding = {
@@ -2279,12 +2319,13 @@ let DropdownWidget = (_a7 = class {
2279
2319
  startY: _cellBounding.startY + topOffset,
2280
2320
  endY: _cellBounding.endY - downOffset
2281
2321
  }, cellWidth = cellBounding.endX - cellBounding.startX, value = getCellValueOrigin(data), valueStr = `${value != null ? value : ""}`;
2282
- let { tb } = style || {};
2322
+ let { tb, pd } = style || {};
2323
+ const { t = DEFAULT_STYLES.pd.t, b = DEFAULT_STYLES.pd.b } = pd != null ? pd : {};
2283
2324
  if (tb = tb != null ? tb : WrapStrategy.WRAP, rule.renderMode === DataValidationRenderMode.ARROW) {
2284
2325
  const realWidth = cellWidth - ICON_PLACE$1, { documentSkeleton, docModel } = createDocuments(valueStr, this._localeService, style);
2285
2326
  tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate(), documentSkeleton.getActualSize();
2286
2327
  const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight } = textLayout;
2287
- return fontHeight;
2328
+ return fontHeight + t + b;
2288
2329
  } else {
2289
2330
  const realWidth = cellWidth - MARGIN_H$1 * 2 - PADDING_H$1 - ICON_PLACE$1, { documentSkeleton, docModel } = createDocSkeleton(valueStr, this._localeService, style);
2290
2331
  tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate();
@@ -2312,21 +2353,16 @@ let DropdownWidget = (_a7 = class {
2312
2353
  };
2313
2354
  this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
2314
2355
  }
2315
- }, __name(_a7, "DropdownWidget"), __publicField(_a7, "padding", {
2316
- l: MARGIN_H$1 + PADDING_H$1,
2317
- r: ICON_PLACE$1 + MARGIN_H$1,
2318
- t: MARGIN_V$1,
2319
- b: MARGIN_V$1
2320
- }), _a7);
2321
- DropdownWidget = __decorateClass$e([
2322
- __decorateParam$e(0, Inject(LocaleService)),
2323
- __decorateParam$e(1, ICommandService)
2356
+ }, __name(_a7, "DropdownWidget"), _a7);
2357
+ DropdownWidget = __decorateClass$d([
2358
+ __decorateParam$d(0, Inject(LocaleService)),
2359
+ __decorateParam$d(1, ICommandService)
2324
2360
  ], DropdownWidget);
2325
2361
  const LIST_RENDER_MODE_OPTION_INPUT = "LIST_RENDER_MODE_OPTION_INPUT";
2326
2362
  function ListRenderModeInput(props) {
2327
- var _a23;
2363
+ var _a22;
2328
2364
  const { value, onChange } = props, localeService = useDependency(LocaleService);
2329
- return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(RadioGroup, { value: `${(_a23 = value.renderMode) != null ? _a23 : DataValidationRenderMode.CUSTOM}`, onChange: /* @__PURE__ */ __name((renderMode) => onChange({ ...value, renderMode: +renderMode }), "onChange"), children: [
2365
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(RadioGroup, { value: `${(_a22 = value.renderMode) != null ? _a22 : DataValidationRenderMode.CUSTOM}`, onChange: /* @__PURE__ */ __name((renderMode) => onChange({ ...value, renderMode: +renderMode }), "onChange"), children: [
2330
2366
  /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.CUSTOM}`, children: localeService.t("dataValidation.renderMode.chip") }),
2331
2367
  /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.ARROW}`, children: localeService.t("dataValidation.renderMode.arrow") }),
2332
2368
  /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.TEXT}`, children: localeService.t("dataValidation.renderMode.text") })
@@ -2341,10 +2377,10 @@ function getRuleFormulaResultSet(result) {
2341
2377
  return result.forEach(
2342
2378
  (row) => {
2343
2379
  row.forEach((cell) => {
2344
- var _a23, _b;
2380
+ var _a22, _b;
2345
2381
  const value = getCellValueOrigin(cell);
2346
2382
  if (value != null) {
2347
- if (typeof value != "string" && typeof (cell == null ? void 0 : cell.s) == "object" && ((_b = (_a23 = cell.s) == null ? void 0 : _a23.n) != null && _b.pattern)) {
2383
+ if (typeof value != "string" && typeof (cell == null ? void 0 : cell.s) == "object" && ((_b = (_a22 = cell.s) == null ? void 0 : _a22.n) != null && _b.pattern)) {
2348
2384
  resultSet.add(numfmt.format(cell.s.n.pattern, value));
2349
2385
  return;
2350
2386
  }
@@ -2397,8 +2433,8 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
2397
2433
  return rule.renderMode !== DataValidationRenderMode.TEXT;
2398
2434
  }
2399
2435
  validatorFormula(rule, unitId, subUnitId) {
2400
- var _a23, _b, _c;
2401
- const success = !Tools.isBlank(rule.formula1), valid = isValidListFormula((_a23 = rule.formula1) != null ? _a23 : "", this._lexer), sheetName = (_c = (_b = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _b.getSheetBySheetId(subUnitId)) == null ? void 0 : _c.getName(), isIntersects = isRuleIntersects(rule, sheetName != null ? sheetName : "");
2436
+ var _a22, _b, _c;
2437
+ const success = !Tools.isBlank(rule.formula1), valid = isValidListFormula((_a22 = rule.formula1) != null ? _a22 : "", this._lexer), sheetName = (_c = (_b = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _b.getSheetBySheetId(subUnitId)) == null ? void 0 : _c.getName(), isIntersects = isRuleIntersects(rule, sheetName != null ? sheetName : "");
2402
2438
  return {
2403
2439
  success: !!(success && valid && !isIntersects),
2404
2440
  formula1: success ? valid ? isIntersects ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
@@ -2409,10 +2445,10 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
2409
2445
  return deserializeListOptions(cellString);
2410
2446
  }
2411
2447
  async parseFormula(rule, unitId, subUnitId) {
2412
- var _a23;
2448
+ var _a22;
2413
2449
  const { formula1 = "" } = rule, results = await this.formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
2414
2450
  return {
2415
- formula1: isFormulaString(formula1) ? getRuleFormulaResultSet((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : deserializeListOptions(formula1),
2451
+ formula1: isFormulaString(formula1) ? getRuleFormulaResultSet((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : deserializeListOptions(formula1),
2416
2452
  formula2: void 0
2417
2453
  };
2418
2454
  }
@@ -2427,8 +2463,8 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
2427
2463
  return this.localeService.t("dataValidation.list.error");
2428
2464
  }
2429
2465
  getList(rule, currentUnitId, currentSubUnitId) {
2430
- var _a23, _b, _c;
2431
- const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (_a23 = currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : void 0) != null ? _a23 : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2466
+ var _a22, _b, _c;
2467
+ const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (_a22 = currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : void 0) != null ? _a22 : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2432
2468
  if (!workbook) return [];
2433
2469
  const worksheet = (_b = currentSubUnitId ? workbook.getSheetBySheetId(currentSubUnitId) : void 0) != null ? _b : workbook.getActiveSheet();
2434
2470
  if (!worksheet) return [];
@@ -2436,8 +2472,8 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
2436
2472
  return isFormulaString(formula1) ? getRuleFormulaResultSet((_c = results == null ? void 0 : results[0]) == null ? void 0 : _c.result) : deserializeListOptions(formula1);
2437
2473
  }
2438
2474
  async getListAsync(rule, currentUnitId, currentSubUnitId) {
2439
- var _a23, _b, _c;
2440
- const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (_a23 = currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : void 0) != null ? _a23 : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2475
+ var _a22, _b, _c;
2476
+ const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (_a22 = currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : void 0) != null ? _a22 : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2441
2477
  if (!workbook) return [];
2442
2478
  const worksheet = (_b = currentSubUnitId ? workbook.getSheetBySheetId(currentSubUnitId) : void 0) != null ? _b : workbook.getActiveSheet();
2443
2479
  if (!worksheet) return [];
@@ -2500,10 +2536,10 @@ const _DecimalValidator = class _DecimalValidator extends BaseDataValidator {
2500
2536
  return formula == null ? Number.NaN : +formula;
2501
2537
  }
2502
2538
  async parseFormula(rule, unitId, subUnitId) {
2503
- var _a23, _b, _c, _d, _e, _f, _g, _h;
2539
+ var _a22, _b, _c, _d, _e, _f, _g, _h;
2504
2540
  const formulaInfo = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
2505
2541
  return {
2506
- formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (_a23 = formulaInfo == null ? void 0 : formulaInfo[0]) == null ? void 0 : _a23.result) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.v : formula1),
2542
+ formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (_a22 = formulaInfo == null ? void 0 : formulaInfo[0]) == null ? void 0 : _a22.result) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.v : formula1),
2507
2543
  formula2: this._parseNumber(isFormulaString(formula2) ? (_h = (_g = (_f = (_e = formulaInfo == null ? void 0 : formulaInfo[1]) == null ? void 0 : _e.result) == null ? void 0 : _f[0]) == null ? void 0 : _g[0]) == null ? void 0 : _h.v : formula2)
2508
2544
  };
2509
2545
  }
@@ -2609,10 +2645,10 @@ const FORMULA1 = "{FORMULA1}", FORMULA2 = "{FORMULA2}", _TextLengthValidator = c
2609
2645
  return !Number.isNaN(formula);
2610
2646
  }
2611
2647
  async parseFormula(rule, unitId, subUnitId) {
2612
- var _a23, _b, _c, _d, _e, _f, _g, _h;
2648
+ var _a22, _b, _c, _d, _e, _f, _g, _h;
2613
2649
  const formulaInfo = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
2614
2650
  return {
2615
- formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (_a23 = formulaInfo == null ? void 0 : formulaInfo[0]) == null ? void 0 : _a23.result) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.v : formula1),
2651
+ formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (_a22 = formulaInfo == null ? void 0 : formulaInfo[0]) == null ? void 0 : _a22.result) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.v : formula1),
2616
2652
  formula2: this._parseNumber(isFormulaString(formula2) ? (_h = (_g = (_f = (_e = formulaInfo == null ? void 0 : formulaInfo[1]) == null ? void 0 : _e.result) == null ? void 0 : _f[0]) == null ? void 0 : _g[0]) == null ? void 0 : _h.v : formula2)
2617
2653
  };
2618
2654
  }
@@ -2665,15 +2701,15 @@ const FORMULA1 = "{FORMULA1}", FORMULA2 = "{FORMULA2}", _TextLengthValidator = c
2665
2701
  return this._isValidFormula(formula1) ? cellValue <= formula1 : !1;
2666
2702
  }
2667
2703
  generateRuleErrorMessage(rule) {
2668
- var _a23, _b;
2669
- return rule.operator ? `${this.localeService.t(TextLengthErrorTitleMap[rule.operator]).replace(FORMULA1, (_a23 = rule.formula1) != null ? _a23 : "").replace(FORMULA2, (_b = rule.formula2) != null ? _b : "")}` : this.titleStr;
2704
+ var _a22, _b;
2705
+ return rule.operator ? `${this.localeService.t(TextLengthErrorTitleMap[rule.operator]).replace(FORMULA1, (_a22 = rule.formula1) != null ? _a22 : "").replace(FORMULA2, (_b = rule.formula2) != null ? _b : "")}` : this.titleStr;
2670
2706
  }
2671
2707
  };
2672
2708
  __name(_TextLengthValidator, "TextLengthValidator");
2673
2709
  let TextLengthValidator = _TextLengthValidator;
2674
2710
  function isBlankCell(cellData) {
2675
- var _a23, _b;
2676
- return cellData ? cellData.p ? !((_b = (_a23 = cellData.p.body) == null ? void 0 : _a23.dataStream) != null ? _b : "").slice(0, -2).trim() : Tools.isBlank(cellData.v) : !0;
2711
+ var _a22, _b;
2712
+ return cellData ? cellData.p ? !((_b = (_a22 = cellData.p.body) == null ? void 0 : _a22.dataStream) != null ? _b : "").slice(0, -2).trim() : Tools.isBlank(cellData.v) : !0;
2677
2713
  }
2678
2714
  __name(isBlankCell, "isBlankCell");
2679
2715
  function getDataValidationDiffMutations(unitId, subUnitId, diffs, accessor, source = "command") {
@@ -2965,6 +3001,12 @@ const UpdateSheetDataValidationRangeCommand = {
2965
3001
  undoMutations
2966
3002
  }), commandService.executeCommand(UpdateDataValidationMutation.id, mutationParams), !0;
2967
3003
  }
3004
+ }, ClearRangeDataValidationCommand = {
3005
+ type: CommandType.COMMAND,
3006
+ id: "sheets.command.clear-range-data-validation",
3007
+ handler(accessor, params) {
3008
+ return params ? (accessor.get(ICommandService), !0) : !1;
3009
+ }
2968
3010
  }, DataValidationIcon = "data-validation-single", DATA_VALIDATION_MENU_ID = "sheet.menu.data-validation";
2969
3011
  function dataValidationMenuFactory(accessor) {
2970
3012
  return {
@@ -2997,11 +3039,11 @@ function addDataValidationMenuFactory(_accessor) {
2997
3039
  };
2998
3040
  }
2999
3041
  __name(addDataValidationMenuFactory, "addDataValidationMenuFactory");
3000
- var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPropertyDescriptor, __decorateClass$d = /* @__PURE__ */ __name((decorators, target, key, kind) => {
3001
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3042
+ var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPropertyDescriptor, __decorateClass$c = /* @__PURE__ */ __name((decorators, target, key, kind) => {
3043
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3002
3044
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
3003
- return kind && result && __defProp$d(target, key, result), result;
3004
- }, "__decorateClass$d"), __decorateParam$d = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$d");
3045
+ return kind && result && __defProp$c(target, key, result), result;
3046
+ }, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$c");
3005
3047
  const DefaultSheetsDataValidation = {}, INVALID_MARK = {
3006
3048
  tr: {
3007
3049
  size: 6,
@@ -3027,8 +3069,9 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3027
3069
  }
3028
3070
  _initDropdown() {
3029
3071
  this._editorBridgeService && this.disposeWithMe(this._editorBridgeService.visible$.subscribe((visible) => {
3072
+ var _a22;
3030
3073
  if (!visible.visible) {
3031
- this._dropdownManagerService.hideDropdown();
3074
+ ((_a22 = this._dropdownManagerService.activeDropdown) == null ? void 0 : _a22.trigger) === "editor-bridge" && this._dropdownManagerService.hideDropdown();
3032
3075
  return;
3033
3076
  }
3034
3077
  const state = this._editorBridgeService.getEditCellState();
@@ -3059,7 +3102,8 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3059
3102
  },
3060
3103
  componentKey: validator.dropdown,
3061
3104
  onHide: /* @__PURE__ */ __name(() => {
3062
- }, "onHide")
3105
+ }, "onHide"),
3106
+ trigger: "editor-bridge"
3063
3107
  },
3064
3108
  !1
3065
3109
  );
@@ -3068,10 +3112,10 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3068
3112
  }
3069
3113
  _initSkeletonChange() {
3070
3114
  const markSkeletonDirty = /* @__PURE__ */ __name(() => {
3071
- var _a23, _b, _c;
3115
+ var _a22, _b, _c;
3072
3116
  const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
3073
3117
  if (!workbook) return;
3074
- const unitId = workbook.getUnitId(), subUnitId = (_a23 = workbook.getActiveSheet()) == null ? void 0 : _a23.getSheetId();
3118
+ const unitId = workbook.getUnitId(), subUnitId = (_a22 = workbook.getActiveSheet()) == null ? void 0 : _a22.getSheetId();
3075
3119
  if (!subUnitId) return;
3076
3120
  const skeleton = (_c = (_b = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _b.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _c.skeleton, currentRender = this._renderManagerService.getRenderById(unitId);
3077
3121
  skeleton == null || skeleton.makeDirty(!0), skeleton == null || skeleton.calculate(), currentRender && currentRender.mainComponent.makeForceDirty();
@@ -3087,11 +3131,11 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3087
3131
  priority: 200,
3088
3132
  // eslint-disable-next-line max-lines-per-function, complexity
3089
3133
  handler: /* @__PURE__ */ __name((cell, pos, next) => {
3090
- var _a23, _b, _c, _d, _e, _f;
3134
+ var _a22, _b, _c, _d, _e, _f;
3091
3135
  const { row, col, unitId, subUnitId, workbook, worksheet } = pos, manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
3092
3136
  if (!manager)
3093
3137
  return next(cell);
3094
- const skeleton = (_b = (_a23 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a23.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
3138
+ const skeleton = (_b = (_a22 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a22.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
3095
3139
  if (!skeleton)
3096
3140
  return next(cell);
3097
3141
  const styleMap = pos.workbook.getStyles(), defaultStyle = (typeof (cell == null ? void 0 : cell.s) == "string" ? styleMap.get(cell == null ? void 0 : cell.s) : cell == null ? void 0 : cell.s) || {}, ruleId = manager.getRuleIdByLocation(row, col);
@@ -3152,7 +3196,7 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3152
3196
  ...extra.interceptorStyle
3153
3197
  },
3154
3198
  get interceptorAutoHeight() {
3155
- var _a24, _b2, _c2, _d2;
3199
+ var _a23, _b2, _c2, _d2;
3156
3200
  const mergeCell = skeleton.mergeData.find((range) => {
3157
3201
  const { startColumn, startRow, endColumn, endRow } = range;
3158
3202
  return row >= startRow && col >= startColumn && row <= endRow && col <= endColumn;
@@ -3167,7 +3211,7 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3167
3211
  }
3168
3212
  },
3169
3213
  style: skeleton.getsStyles().getStyleByCell(cell),
3170
- primaryWithCoord: skeleton.getCellByIndex((_a24 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a24 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
3214
+ primaryWithCoord: skeleton.getCellByIndex((_a23 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a23 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
3171
3215
  unitId,
3172
3216
  subUnitId,
3173
3217
  row,
@@ -3193,8 +3237,8 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3193
3237
  ).subscribe((infos) => {
3194
3238
  const ranges = [];
3195
3239
  if (infos.forEach((info) => {
3196
- var _a23;
3197
- (_a23 = info.rule) != null && _a23.ranges && ranges.push(...info.rule.ranges);
3240
+ var _a22;
3241
+ (_a22 = info.rule) != null && _a22.ranges && ranges.push(...info.rule.ranges);
3198
3242
  }), ranges.length) {
3199
3243
  const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
3200
3244
  sequenceExecute(mutations.redos, this._commandService);
@@ -3202,20 +3246,20 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3202
3246
  });
3203
3247
  }
3204
3248
  }, __name(_a8, "SheetsDataValidationRenderController"), _a8);
3205
- SheetsDataValidationRenderController = __decorateClass$d([
3249
+ SheetsDataValidationRenderController = __decorateClass$c([
3206
3250
  OnLifecycle(LifecycleStages.Rendered, SheetsDataValidationRenderController),
3207
- __decorateParam$d(1, ICommandService),
3208
- __decorateParam$d(2, IMenuService),
3209
- __decorateParam$d(3, IRenderManagerService),
3210
- __decorateParam$d(4, IUniverInstanceService),
3211
- __decorateParam$d(5, Inject(AutoHeightController)),
3212
- __decorateParam$d(6, Inject(ComponentManager)),
3213
- __decorateParam$d(7, Inject(DataValidationDropdownManagerService)),
3214
- __decorateParam$d(8, Inject(DataValidationModel)),
3215
- __decorateParam$d(9, Inject(DataValidatorRegistryService)),
3216
- __decorateParam$d(10, Inject(Injector)),
3217
- __decorateParam$d(11, Inject(SheetInterceptorService)),
3218
- __decorateParam$d(12, Optional(IEditorBridgeService))
3251
+ __decorateParam$c(1, ICommandService),
3252
+ __decorateParam$c(2, IMenuService),
3253
+ __decorateParam$c(3, IRenderManagerService),
3254
+ __decorateParam$c(4, IUniverInstanceService),
3255
+ __decorateParam$c(5, Inject(AutoHeightController)),
3256
+ __decorateParam$c(6, Inject(ComponentManager)),
3257
+ __decorateParam$c(7, Inject(DataValidationDropdownManagerService)),
3258
+ __decorateParam$c(8, Inject(DataValidationModel)),
3259
+ __decorateParam$c(9, Inject(DataValidatorRegistryService)),
3260
+ __decorateParam$c(10, Inject(Injector)),
3261
+ __decorateParam$c(11, Inject(SheetInterceptorService)),
3262
+ __decorateParam$c(12, Optional(IEditorBridgeService))
3219
3263
  ], SheetsDataValidationRenderController);
3220
3264
  var _a9;
3221
3265
  let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposable {
@@ -3224,10 +3268,10 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3224
3268
  }
3225
3269
  _initSkeletonChange() {
3226
3270
  const markSkeletonDirty = /* @__PURE__ */ __name(() => {
3227
- var _a23, _b, _c;
3271
+ var _a22, _b, _c;
3228
3272
  const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
3229
3273
  if (!workbook) return;
3230
- const unitId = workbook.getUnitId(), subUnitId = (_a23 = workbook.getActiveSheet()) == null ? void 0 : _a23.getSheetId();
3274
+ const unitId = workbook.getUnitId(), subUnitId = (_a22 = workbook.getActiveSheet()) == null ? void 0 : _a22.getSheetId();
3231
3275
  if (!subUnitId) return;
3232
3276
  const skeleton = (_c = (_b = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _b.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _c.skeleton, currentRender = this._renderManagerService.getRenderById(unitId);
3233
3277
  skeleton == null || skeleton.makeDirty(!0), skeleton == null || skeleton.calculate(), currentRender && currentRender.mainComponent.makeForceDirty();
@@ -3241,13 +3285,13 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3241
3285
  INTERCEPTOR_POINT.CELL_CONTENT,
3242
3286
  {
3243
3287
  priority: 200,
3244
- // eslint-disable-next-line max-lines-per-function
3288
+ // eslint-disable-next-line max-lines-per-function, complexity
3245
3289
  handler: /* @__PURE__ */ __name((cell, pos, next) => {
3246
- var _a23, _b, _c, _d, _e;
3290
+ var _a22, _b, _c, _d, _e;
3247
3291
  const { row, col, unitId, subUnitId, workbook, worksheet } = pos, manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
3248
3292
  if (!manager)
3249
3293
  return next(cell);
3250
- const skeleton = (_b = (_a23 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a23.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
3294
+ const skeleton = (_b = (_a22 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a22.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
3251
3295
  if (!skeleton)
3252
3296
  return next(cell);
3253
3297
  const styleMap = pos.workbook.getStyles(), defaultStyle = (typeof (cell == null ? void 0 : cell.s) == "string" ? styleMap.get(cell == null ? void 0 : cell.s) : cell == null ? void 0 : cell.s) || {}, ruleId = manager.getRuleIdByLocation(row, col);
@@ -3308,7 +3352,7 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3308
3352
  ...extra.interceptorStyle
3309
3353
  },
3310
3354
  get interceptorAutoHeight() {
3311
- var _a24, _b2, _c2, _d2;
3355
+ var _a23, _b2, _c2, _d2;
3312
3356
  const mergeCell = skeleton.mergeData.find((range) => {
3313
3357
  const { startColumn, startRow, endColumn, endRow } = range;
3314
3358
  return row >= startRow && col >= startColumn && row <= endRow && col <= endColumn;
@@ -3323,7 +3367,7 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3323
3367
  }
3324
3368
  },
3325
3369
  style: skeleton.getsStyles().getStyleByCell(cell),
3326
- primaryWithCoord: skeleton.getCellByIndex((_a24 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a24 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
3370
+ primaryWithCoord: skeleton.getCellByIndex((_a23 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a23 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
3327
3371
  unitId,
3328
3372
  subUnitId,
3329
3373
  row,
@@ -3346,8 +3390,8 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3346
3390
  ).subscribe((infos) => {
3347
3391
  const ranges = [];
3348
3392
  if (infos.forEach((info) => {
3349
- var _a23;
3350
- (_a23 = info.rule) != null && _a23.ranges && ranges.push(...info.rule.ranges);
3393
+ var _a22;
3394
+ (_a22 = info.rule) != null && _a22.ranges && ranges.push(...info.rule.ranges);
3351
3395
  }), ranges.length) {
3352
3396
  const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
3353
3397
  sequenceExecute(mutations.redos, this._commandService);
@@ -3355,62 +3399,23 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3355
3399
  });
3356
3400
  }
3357
3401
  }, __name(_a9, "SheetsDataValidationMobileRenderController"), _a9);
3358
- SheetsDataValidationMobileRenderController = __decorateClass$d([
3402
+ SheetsDataValidationMobileRenderController = __decorateClass$c([
3359
3403
  OnLifecycle(LifecycleStages.Rendered, SheetsDataValidationMobileRenderController),
3360
- __decorateParam$d(1, ICommandService),
3361
- __decorateParam$d(2, IRenderManagerService),
3362
- __decorateParam$d(3, IUniverInstanceService),
3363
- __decorateParam$d(4, Inject(AutoHeightController)),
3364
- __decorateParam$d(5, Inject(DataValidationModel)),
3365
- __decorateParam$d(6, Inject(DataValidatorRegistryService)),
3366
- __decorateParam$d(7, Inject(SheetInterceptorService))
3404
+ __decorateParam$c(1, ICommandService),
3405
+ __decorateParam$c(2, IRenderManagerService),
3406
+ __decorateParam$c(3, IUniverInstanceService),
3407
+ __decorateParam$c(4, Inject(AutoHeightController)),
3408
+ __decorateParam$c(5, Inject(DataValidationModel)),
3409
+ __decorateParam$c(6, Inject(DataValidatorRegistryService)),
3410
+ __decorateParam$c(7, Inject(SheetInterceptorService))
3367
3411
  ], SheetsDataValidationMobileRenderController);
3368
- var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPropertyDescriptor, __decorateClass$c = /* @__PURE__ */ __name((decorators, target, key, kind) => {
3369
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3370
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
3371
- return kind && result && __defProp$c(target, key, result), result;
3372
- }, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$c"), _a10;
3373
- let SheetDataValidationService = (_a10 = class extends Disposable {
3374
- constructor(_dataValidationModel) {
3375
- super();
3376
- __publicField(this, "_currentManager");
3377
- __publicField(this, "_currentManager$", new Subject());
3378
- __publicField(this, "currentManager$", this._currentManager$.asObservable());
3379
- this._dataValidationModel = _dataValidationModel, this.disposeWithMe(() => {
3380
- this._currentManager$.complete();
3381
- });
3382
- }
3383
- get currentManager() {
3384
- return this._currentManager;
3385
- }
3386
- _ensureManager(unitId, subUnitId) {
3387
- return this._dataValidationModel.ensureManager(unitId, subUnitId);
3388
- }
3389
- switchCurrent(unitId, subUnitId) {
3390
- var _a23, _b;
3391
- if (unitId === ((_a23 = this.currentManager) == null ? void 0 : _a23.unitId) && subUnitId === ((_b = this._currentManager) == null ? void 0 : _b.subUnitId))
3392
- return;
3393
- const manager = this._ensureManager(unitId, subUnitId);
3394
- this._currentManager = {
3395
- manager,
3396
- unitId,
3397
- subUnitId
3398
- }, this._currentManager$.next(this._currentManager);
3399
- }
3400
- get(unitId, subUnitId) {
3401
- return this._ensureManager(unitId, subUnitId);
3402
- }
3403
- }, __name(_a10, "SheetDataValidationService"), _a10);
3404
- SheetDataValidationService = __decorateClass$c([
3405
- __decorateParam$c(0, Inject(DataValidationModel))
3406
- ], SheetDataValidationService);
3407
3412
  var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPropertyDescriptor, __decorateClass$b = /* @__PURE__ */ __name((decorators, target, key, kind) => {
3408
3413
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3409
3414
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
3410
3415
  return kind && result && __defProp$b(target, key, result), result;
3411
- }, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"), _a11;
3412
- let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3413
- constructor(_registerOtherFormulaService, _lexerTreeBuilder, _dataValidationModel, _dataValidationCacheService) {
3416
+ }, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"), _a10;
3417
+ let DataValidationCustomFormulaService = (_a10 = class extends Disposable {
3418
+ constructor(_instanceSrv, _registerOtherFormulaService, _lexerTreeBuilder, _dataValidationModel, _dataValidationCacheService) {
3414
3419
  super();
3415
3420
  __publicField(this, "_formulaMap", /* @__PURE__ */ new Map());
3416
3421
  /**
@@ -3421,20 +3426,21 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3421
3426
  * reflect of formulaId to cell, only store transformable formula
3422
3427
  */
3423
3428
  __publicField(this, "_formulaCellMap", /* @__PURE__ */ new Map());
3424
- this._registerOtherFormulaService = _registerOtherFormulaService, this._lexerTreeBuilder = _lexerTreeBuilder, this._dataValidationModel = _dataValidationModel, this._dataValidationCacheService = _dataValidationCacheService, this._initFormulaResultHandler();
3429
+ this._instanceSrv = _instanceSrv, this._registerOtherFormulaService = _registerOtherFormulaService, this._lexerTreeBuilder = _lexerTreeBuilder, this._dataValidationModel = _dataValidationModel, this._dataValidationCacheService = _dataValidationCacheService, this._initFormulaResultHandler();
3425
3430
  }
3426
3431
  _initFormulaResultHandler() {
3427
3432
  this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((resultMap) => {
3428
3433
  for (const unitId in resultMap) {
3429
3434
  const unitMap = resultMap[unitId];
3430
- for (const subUnitId in unitMap) {
3431
- const results = unitMap[subUnitId], { formulaCellMap, ruleFormulaMap } = this._ensureMaps(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
3432
- results.forEach((result) => {
3433
- var _a23, _b;
3434
- const ruleInfo = ruleFormulaMap.get((_a23 = result.extra) == null ? void 0 : _a23.ruleId), cellInfo = formulaCellMap.get(result.formulaId), rule = manager.getRuleById((_b = result.extra) == null ? void 0 : _b.ruleId);
3435
- rule && ruleInfo && !ruleInfo.isTransformable && this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges), cellInfo && this._dataValidationCacheService.markCellDirty(unitId, subUnitId, cellInfo.row, cellInfo.column);
3436
- });
3437
- }
3435
+ if (this._instanceSrv.getUnitType(unitId) === UniverInstanceType.UNIVER_SHEET)
3436
+ for (const subUnitId in unitMap) {
3437
+ const results = unitMap[subUnitId], { formulaCellMap, ruleFormulaMap } = this._ensureMaps(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
3438
+ results.forEach((result) => {
3439
+ var _a22, _b;
3440
+ const ruleInfo = ruleFormulaMap.get((_a22 = result.extra) == null ? void 0 : _a22.ruleId), cellInfo = formulaCellMap.get(result.formulaId), rule = manager.getRuleById((_b = result.extra) == null ? void 0 : _b.ruleId);
3441
+ rule && ruleInfo && !ruleInfo.isTransformable && this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges), cellInfo && this._dataValidationCacheService.markCellDirty(unitId, subUnitId, cellInfo.row, cellInfo.column);
3442
+ });
3443
+ }
3438
3444
  }
3439
3445
  }));
3440
3446
  }
@@ -3520,8 +3526,8 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3520
3526
  });
3521
3527
  }), newRanges.forEach((range) => {
3522
3528
  Range.foreach(range, (row, col) => {
3523
- var _a23;
3524
- const oldValue = (_a23 = formulaMap.getValue(row, col)) != null ? _a23 : {};
3529
+ var _a22;
3530
+ const oldValue = (_a22 = formulaMap.getValue(row, col)) != null ? _a22 : {};
3525
3531
  if (oldValue.ruleId !== ruleId) {
3526
3532
  const oldRuleFormula = ruleFormulaMap.get(oldValue.ruleId);
3527
3533
  if (oldRuleFormula != null && oldRuleFormula.isTransformable && deleteFormulaIdList.add(oldValue.formulaId), isTransformable) {
@@ -3561,12 +3567,13 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3561
3567
  const { ruleFormulaMap } = this._ensureMaps(unitId, subUnitId);
3562
3568
  return ruleFormulaMap.get(ruleId);
3563
3569
  }
3564
- }, __name(_a11, "DataValidationCustomFormulaService"), _a11);
3570
+ }, __name(_a10, "DataValidationCustomFormulaService"), _a10);
3565
3571
  DataValidationCustomFormulaService = __decorateClass$b([
3566
- __decorateParam$b(0, Inject(RegisterOtherFormulaService)),
3567
- __decorateParam$b(1, Inject(LexerTreeBuilder)),
3568
- __decorateParam$b(2, Inject(DataValidationModel)),
3569
- __decorateParam$b(3, Inject(DataValidationCacheService))
3572
+ __decorateParam$b(0, IUniverInstanceService),
3573
+ __decorateParam$b(1, Inject(RegisterOtherFormulaService)),
3574
+ __decorateParam$b(2, Inject(LexerTreeBuilder)),
3575
+ __decorateParam$b(3, Inject(DataValidationModel)),
3576
+ __decorateParam$b(4, Inject(DataValidationCacheService))
3570
3577
  ], DataValidationCustomFormulaService);
3571
3578
  const _CustomFormulaValidator = class _CustomFormulaValidator extends BaseDataValidator {
3572
3579
  constructor() {
@@ -3639,10 +3646,10 @@ const _WholeValidator = class _WholeValidator extends BaseDataValidator {
3639
3646
  return formula == null ? Number.NaN : +formula;
3640
3647
  }
3641
3648
  async parseFormula(rule, unitId, subUnitId) {
3642
- var _a23, _b, _c, _d, _e, _f, _g, _h;
3649
+ var _a22, _b, _c, _d, _e, _f, _g, _h;
3643
3650
  const formulaInfo = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
3644
3651
  return {
3645
- formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (_a23 = formulaInfo == null ? void 0 : formulaInfo[0]) == null ? void 0 : _a23.result) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.v : formula1),
3652
+ formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (_a22 = formulaInfo == null ? void 0 : formulaInfo[0]) == null ? void 0 : _a22.result) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.v : formula1),
3646
3653
  formula2: this._parseNumber(isFormulaString(formula2) ? (_h = (_g = (_f = (_e = formulaInfo == null ? void 0 : formulaInfo[1]) == null ? void 0 : _e.result) == null ? void 0 : _f[0]) == null ? void 0 : _g[0]) == null ? void 0 : _h.v : formula2)
3647
3654
  };
3648
3655
  }
@@ -3765,8 +3772,8 @@ var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPrope
3765
3772
  return kind && result && __defProp$a(target, key, result), result;
3766
3773
  }, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a");
3767
3774
  const downPath = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
3768
- var _a12;
3769
- let DropdownMultipleWidget = (_a12 = class {
3775
+ var _a11;
3776
+ let DropdownMultipleWidget = (_a11 = class {
3770
3777
  constructor(_commandService) {
3771
3778
  __publicField(this, "zIndex");
3772
3779
  __publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
@@ -3794,7 +3801,7 @@ let DropdownMultipleWidget = (_a12 = class {
3794
3801
  }
3795
3802
  // eslint-disable-next-line max-lines-per-function
3796
3803
  drawWith(ctx, info, skeleton, spreadsheets) {
3797
- var _a23, _b;
3804
+ var _a22, _b;
3798
3805
  const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, validation = data.dataValidation, map = this._ensureMap(subUnitId), key = this._generateKey(row, col);
3799
3806
  if (!validation)
3800
3807
  return;
@@ -3803,7 +3810,7 @@ let DropdownMultipleWidget = (_a12 = class {
3803
3810
  endX: _cellBounding.endX - rightOffset,
3804
3811
  startY: _cellBounding.startY + topOffset,
3805
3812
  endY: _cellBounding.endY - downOffset
3806
- }, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, { cl } = style || {}, color = (_a23 = typeof cl == "object" ? cl == null ? void 0 : cl.rgb : cl) != null ? _a23 : "#000", fontStyle = getFontStyleString(style != null ? style : void 0), { rule, validator: _validator } = validation, validator = _validator, { vt: _vt, ht } = style || {}, vt = _vt != null ? _vt : VerticalAlign.MIDDLE, cellValue = (_b = getCellValueOrigin(data)) != null ? _b : "", items = validator.parseCellValue(cellValue), labelColorMap = validator.getListWithColorMap(rule), layout = layoutDropdowns(items, fontStyle, cellWidth, cellHeight);
3813
+ }, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, { cl } = style || {}, color = (_a22 = typeof cl == "object" ? cl == null ? void 0 : cl.rgb : cl) != null ? _a22 : "#000", fontStyle = getFontStyleString(style != null ? style : void 0), { rule, validator: _validator } = validation, validator = _validator, { vt: _vt, ht } = style || {}, vt = _vt != null ? _vt : VerticalAlign.MIDDLE, cellValue = (_b = getCellValueOrigin(data)) != null ? _b : "", items = validator.parseCellValue(cellValue), labelColorMap = validator.getListWithColorMap(rule), layout = layoutDropdowns(items, fontStyle, cellWidth, cellHeight);
3807
3814
  this._drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, vt), ctx.save(), ctx.translateWithPrecision(cellBounding.startX, cellBounding.startY), ctx.beginPath(), ctx.rect(0, 0, cellWidth - ICON_PLACE, cellHeight), ctx.clip(), ctx.translateWithPrecision(CELL_PADDING_H, CELL_PADDING_V);
3808
3815
  let top = 0;
3809
3816
  switch (vt) {
@@ -3842,7 +3849,7 @@ let DropdownMultipleWidget = (_a12 = class {
3842
3849
  });
3843
3850
  }
3844
3851
  calcCellAutoHeight(info) {
3845
- var _a23;
3852
+ var _a22;
3846
3853
  const { primaryWithCoord, style, data } = info, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, cellBounding = {
3847
3854
  startX: _cellBounding.startX + leftOffset,
3848
3855
  endX: _cellBounding.endX - rightOffset,
@@ -3851,7 +3858,7 @@ let DropdownMultipleWidget = (_a12 = class {
3851
3858
  }, validation = data.dataValidation;
3852
3859
  if (!validation)
3853
3860
  return;
3854
- const cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, cellValue = (_a23 = getCellValueOrigin(data)) != null ? _a23 : "", { validator: _validator } = validation, items = _validator.parseCellValue(cellValue), fontStyle = getFontStyleString(style != null ? style : void 0);
3861
+ const cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, cellValue = (_a22 = getCellValueOrigin(data)) != null ? _a22 : "", { validator: _validator } = validation, items = _validator.parseCellValue(cellValue), fontStyle = getFontStyleString(style != null ? style : void 0);
3855
3862
  return layoutDropdowns(items, fontStyle, cellWidth, cellHeight).cellAutoHeight;
3856
3863
  }
3857
3864
  isHit(position, info) {
@@ -3869,7 +3876,7 @@ let DropdownMultipleWidget = (_a12 = class {
3869
3876
  };
3870
3877
  this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
3871
3878
  }
3872
- }, __name(_a12, "DropdownMultipleWidget"), _a12);
3879
+ }, __name(_a11, "DropdownMultipleWidget"), _a11);
3873
3880
  DropdownMultipleWidget = __decorateClass$a([
3874
3881
  __decorateParam$a(0, ICommandService)
3875
3882
  ], DropdownMultipleWidget);
@@ -3890,13 +3897,13 @@ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPrope
3890
3897
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3891
3898
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
3892
3899
  return kind && result && __defProp$9(target, key, result), result;
3893
- }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a13;
3894
- let DataValidationController = (_a13 = class extends RxDisposable {
3895
- constructor(_univerInstanceService, _sheetDataValidationService, _dataValidatorRegistryService, _injector, _componentManger, _selectionManagerService, _sheetInterceptorService, _dataValidationModel) {
3896
- super(), this._univerInstanceService = _univerInstanceService, this._sheetDataValidationService = _sheetDataValidationService, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._injector = _injector, this._componentManger = _componentManger, this._selectionManagerService = _selectionManagerService, this._sheetInterceptorService = _sheetInterceptorService, this._dataValidationModel = _dataValidationModel, this._init();
3900
+ }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a12;
3901
+ let DataValidationController = (_a12 = class extends RxDisposable {
3902
+ constructor(_univerInstanceService, _dataValidatorRegistryService, _injector, _componentManger, _selectionManagerService, _sheetInterceptorService, _dataValidationModel) {
3903
+ super(), this._univerInstanceService = _univerInstanceService, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._injector = _injector, this._componentManger = _componentManger, this._selectionManagerService = _selectionManagerService, this._sheetInterceptorService = _sheetInterceptorService, this._dataValidationModel = _dataValidationModel, this._init();
3897
3904
  }
3898
3905
  _init() {
3899
- this._registerValidators(), this._initInstanceChange(), this._initCommandInterceptor(), this._initComponents();
3906
+ this._registerValidators(), this._initCommandInterceptor(), this._initComponents();
3900
3907
  }
3901
3908
  _registerValidators() {
3902
3909
  [
@@ -3919,31 +3926,15 @@ let DataValidationController = (_a13 = class extends RxDisposable {
3919
3926
  });
3920
3927
  });
3921
3928
  }
3922
- _initInstanceChange() {
3923
- const disposableCollection = new DisposableCollection();
3924
- this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {
3925
- if (disposableCollection.dispose(), !workbook)
3926
- return;
3927
- const worksheet = workbook.getActiveSheet();
3928
- worksheet && (this._sheetDataValidationService.switchCurrent(workbook.getUnitId(), worksheet.getSheetId()), disposableCollection.add(toDisposable(
3929
- workbook.activeSheet$.subscribe((worksheet2) => {
3930
- if (worksheet2) {
3931
- const unitId = workbook.getUnitId(), subUnitId = worksheet2.getSheetId();
3932
- this._sheetDataValidationService.switchCurrent(unitId, subUnitId);
3933
- }
3934
- })
3935
- )));
3936
- })), this.disposeWithMe(disposableCollection);
3937
- }
3938
3929
  _initCommandInterceptor() {
3939
3930
  this._sheetInterceptorService.interceptCommand({
3940
3931
  getMutations: /* @__PURE__ */ __name((commandInfo) => {
3941
- var _a23;
3932
+ var _a22;
3942
3933
  if (commandInfo.id === ClearSelectionAllCommand.id) {
3943
3934
  const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), unitId = workbook.getUnitId(), worksheet = workbook.getActiveSheet();
3944
3935
  if (!worksheet)
3945
3936
  throw new Error("No active sheet found");
3946
- const subUnitId = worksheet.getSheetId(), selections = (_a23 = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : _a23.map((s) => s.range), manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleMatrix = manager.getRuleObjectMatrix().clone();
3937
+ const subUnitId = worksheet.getSheetId(), selections = (_a22 = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : _a22.map((s) => s.range), manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleMatrix = manager.getRuleObjectMatrix().clone();
3947
3938
  selections && ruleMatrix.removeRange(selections);
3948
3939
  const diffs = ruleMatrix.diff(manager.getDataValidations()), { redoMutations, undoMutations } = getDataValidationDiffMutations(unitId, subUnitId, diffs, this._injector, "patched");
3949
3940
  return {
@@ -3975,17 +3966,16 @@ let DataValidationController = (_a13 = class extends RxDisposable {
3975
3966
  ));
3976
3967
  });
3977
3968
  }
3978
- }, __name(_a13, "DataValidationController"), _a13);
3969
+ }, __name(_a12, "DataValidationController"), _a12);
3979
3970
  DataValidationController = __decorateClass$9([
3980
3971
  OnLifecycle(LifecycleStages.Rendered, DataValidationController),
3981
3972
  __decorateParam$9(0, IUniverInstanceService),
3982
- __decorateParam$9(1, Inject(SheetDataValidationService)),
3983
- __decorateParam$9(2, Inject(DataValidatorRegistryService)),
3984
- __decorateParam$9(3, Inject(Injector)),
3985
- __decorateParam$9(4, Inject(ComponentManager)),
3986
- __decorateParam$9(5, Inject(SheetsSelectionsService)),
3987
- __decorateParam$9(6, Inject(SheetInterceptorService)),
3988
- __decorateParam$9(7, Inject(DataValidationModel))
3973
+ __decorateParam$9(1, Inject(DataValidatorRegistryService)),
3974
+ __decorateParam$9(2, Inject(Injector)),
3975
+ __decorateParam$9(3, Inject(ComponentManager)),
3976
+ __decorateParam$9(4, Inject(SheetsSelectionsService)),
3977
+ __decorateParam$9(5, Inject(SheetInterceptorService)),
3978
+ __decorateParam$9(6, Inject(DataValidationModel))
3989
3979
  ], DataValidationController);
3990
3980
  var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
3991
3981
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
@@ -3993,8 +3983,8 @@ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPrope
3993
3983
  return kind && result && __defProp$8(target, key, result), result;
3994
3984
  }, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8");
3995
3985
  const ALERT_KEY = "SHEET_DATA_VALIDATION_ALERT";
3996
- var _a14;
3997
- let DataValidationAlertController = (_a14 = class extends Disposable {
3986
+ var _a13;
3987
+ let DataValidationAlertController = (_a13 = class extends Disposable {
3998
3988
  constructor(_hoverManagerService, _cellAlertManagerService, _univerInstanceService, _localeService) {
3999
3989
  super(), this._hoverManagerService = _hoverManagerService, this._cellAlertManagerService = _cellAlertManagerService, this._univerInstanceService = _univerInstanceService, this._localeService = _localeService, this._init();
4000
3990
  }
@@ -4003,12 +3993,12 @@ let DataValidationAlertController = (_a14 = class extends Disposable {
4003
3993
  }
4004
3994
  _initCellAlertPopup() {
4005
3995
  this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(debounceTime(100)).subscribe((cellPos) => {
4006
- var _a23, _b;
3996
+ var _a22, _b;
4007
3997
  if (cellPos) {
4008
3998
  const worksheet = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
4009
3999
  if (!worksheet) return;
4010
4000
  const cellData = worksheet.getCell(cellPos.location.row, cellPos.location.col);
4011
- if (((_a23 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a23.validStatus) === DataValidationStatus.INVALID) {
4001
+ if (((_a22 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a22.validStatus) === DataValidationStatus.INVALID) {
4012
4002
  const currentAlert = this._cellAlertManagerService.currentAlert.get(ALERT_KEY), currentLoc = (_b = currentAlert == null ? void 0 : currentAlert.alert) == null ? void 0 : _b.location;
4013
4003
  if (currentLoc && currentLoc.row === cellPos.location.row && currentLoc.col === cellPos.location.col && currentLoc.subUnitId === cellPos.location.subUnitId && currentLoc.unitId === cellPos.location.unitId)
4014
4004
  return;
@@ -4030,7 +4020,7 @@ let DataValidationAlertController = (_a14 = class extends Disposable {
4030
4020
  this._cellAlertManagerService.removeAlert(ALERT_KEY);
4031
4021
  }));
4032
4022
  }
4033
- }, __name(_a14, "DataValidationAlertController"), _a14);
4023
+ }, __name(_a13, "DataValidationAlertController"), _a13);
4034
4024
  DataValidationAlertController = __decorateClass$8([
4035
4025
  OnLifecycle(LifecycleStages.Rendered, DataValidationAlertController),
4036
4026
  __decorateParam$8(0, Inject(HoverManagerService)),
@@ -4042,8 +4032,8 @@ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPrope
4042
4032
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4043
4033
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4044
4034
  return kind && result && __defProp$7(target, key, result), result;
4045
- }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a15;
4046
- let DataValidationRefRangeController = (_a15 = class extends Disposable {
4035
+ }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a14;
4036
+ let DataValidationRefRangeController = (_a14 = class extends Disposable {
4047
4037
  constructor(_dataValidationModel, _injector, _refRangeService, _dataValidationCustomFormulaService, _dataValidationFormulaService, _formulaRefRangeService) {
4048
4038
  super();
4049
4039
  __publicField(this, "_disposableMap", /* @__PURE__ */ new Map());
@@ -4057,8 +4047,8 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
4057
4047
  }
4058
4048
  // eslint-disable-next-line max-lines-per-function
4059
4049
  registerFormula(unitId, subUnitId, rule) {
4060
- var _a23;
4061
- const ruleId = rule.uid, id = this._getIdWithUnitId(unitId, subUnitId, ruleId), disposeSet = (_a23 = this._disposableMap.get(id)) != null ? _a23 : /* @__PURE__ */ new Set(), handleFormulaChange = /* @__PURE__ */ __name((type, formulaString) => {
4050
+ var _a22;
4051
+ const ruleId = rule.uid, id = this._getIdWithUnitId(unitId, subUnitId, ruleId), disposeSet = (_a22 = this._disposableMap.get(id)) != null ? _a22 : /* @__PURE__ */ new Set(), handleFormulaChange = /* @__PURE__ */ __name((type, formulaString) => {
4062
4052
  const oldRule = this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
4063
4053
  if (!oldRule)
4064
4054
  return { redos: [], undos: [] };
@@ -4135,7 +4125,7 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
4135
4125
  }
4136
4126
  }
4137
4127
  register(unitId, subUnitId, rule) {
4138
- var _a23;
4128
+ var _a22;
4139
4129
  const handleRangeChange = /* @__PURE__ */ __name((commandInfo) => {
4140
4130
  const oldRanges = [...rule.ranges], resultRanges = oldRanges.map((range) => handleCommonDefaultRangeChangeWithEffectRefCommands(range, commandInfo)).filter((range) => !!range).flat();
4141
4131
  if (isRangesEqual(resultRanges, oldRanges))
@@ -4173,7 +4163,7 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
4173
4163
  const disposable = this._refRangeService.registerRefRange(range, handleRangeChange, unitId, subUnitId);
4174
4164
  disposeList.push(() => disposable.dispose());
4175
4165
  });
4176
- const id = this._getIdWithUnitId(unitId, subUnitId, rule.uid), current = (_a23 = this._disposableMap.get(id)) != null ? _a23 : /* @__PURE__ */ new Set();
4166
+ const id = this._getIdWithUnitId(unitId, subUnitId, rule.uid), current = (_a22 = this._disposableMap.get(id)) != null ? _a22 : /* @__PURE__ */ new Set();
4177
4167
  current.add(() => disposeList.forEach((dispose) => dispose())), this._disposableMap.set(id, current);
4178
4168
  }
4179
4169
  _initRefRange() {
@@ -4204,9 +4194,9 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
4204
4194
  }), this._disposableMap.clear();
4205
4195
  }));
4206
4196
  }
4207
- }, __name(_a15, "DataValidationRefRangeController"), _a15);
4197
+ }, __name(_a14, "DataValidationRefRangeController"), _a14);
4208
4198
  DataValidationRefRangeController = __decorateClass$7([
4209
- OnLifecycle(LifecycleStages.Ready, DataValidationRefRangeController),
4199
+ OnLifecycle(LifecycleStages.Starting, DataValidationRefRangeController),
4210
4200
  __decorateParam$7(0, Inject(DataValidationModel)),
4211
4201
  __decorateParam$7(1, Inject(Injector)),
4212
4202
  __decorateParam$7(2, Inject(RefRangeService)),
@@ -4218,8 +4208,8 @@ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPrope
4218
4208
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4219
4209
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4220
4210
  return kind && result && __defProp$6(target, key, result), result;
4221
- }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a16;
4222
- let DataValidationAutoFillController = (_a16 = class extends Disposable {
4211
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a15;
4212
+ let DataValidationAutoFillController = (_a15 = class extends Disposable {
4223
4213
  constructor(_autoFillService, _dataValidationModel, _injector) {
4224
4214
  super(), this._autoFillService = _autoFillService, this._dataValidationModel = _dataValidationModel, this._injector = _injector, this._initAutoFill();
4225
4215
  }
@@ -4292,7 +4282,7 @@ let DataValidationAutoFillController = (_a16 = class extends Disposable {
4292
4282
  };
4293
4283
  this.disposeWithMe(this._autoFillService.addHook(hook));
4294
4284
  }
4295
- }, __name(_a16, "DataValidationAutoFillController"), _a16);
4285
+ }, __name(_a15, "DataValidationAutoFillController"), _a15);
4296
4286
  DataValidationAutoFillController = __decorateClass$6([
4297
4287
  OnLifecycle(LifecycleStages.Ready, DataValidationAutoFillController),
4298
4288
  __decorateParam$6(0, IAutoFillService),
@@ -4303,8 +4293,8 @@ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPrope
4303
4293
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4304
4294
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4305
4295
  return kind && result && __defProp$5(target, key, result), result;
4306
- }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a17;
4307
- let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4296
+ }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a16;
4297
+ let DataValidationCopyPasteController = (_a16 = class extends Disposable {
4308
4298
  constructor(_sheetClipboardService, _dataValidationModel, _injector) {
4309
4299
  super();
4310
4300
  __publicField(this, "_copyInfo");
@@ -4327,9 +4317,7 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4327
4317
  subUnitId,
4328
4318
  matrix
4329
4319
  };
4330
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), accessor = {
4331
- get: this._injector.get.bind(this._injector)
4332
- }, discreteRange = rangeToDiscreteRange(range, accessor, unitId, subUnitId);
4320
+ const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), discreteRange = this._injector.invoke((accessor) => rangeToDiscreteRange(range, accessor, unitId, subUnitId));
4333
4321
  if (!discreteRange)
4334
4322
  return;
4335
4323
  const { rows, cols } = discreteRange;
@@ -4361,8 +4349,8 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4361
4349
  if (copyInfo.unitId !== unitId || subUnitId !== copyInfo.subUnitId) {
4362
4350
  const originManager = this._dataValidationModel.ensureManager(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(copyInfo.unitId, copyInfo.subUnitId), ruleMatrix = manager.getRuleObjectMatrix().clone(), { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]), repeatRange = getRepeatRange(vCopyRange, vPastedRange, !0), additionRules = /* @__PURE__ */ new Map();
4363
4351
  repeatRange.forEach(({ startRange }) => {
4364
- var _a23;
4365
- (_a23 = this._copyInfo) == null || _a23.matrix.forValue((row, col, ruleId) => {
4352
+ var _a22;
4353
+ (_a22 = this._copyInfo) == null || _a22.matrix.forValue((row, col, ruleId) => {
4366
4354
  const range = Rectangle.getPositionRange(
4367
4355
  {
4368
4356
  startRow: row,
@@ -4391,8 +4379,8 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4391
4379
  } else {
4392
4380
  const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleMatrix = manager.getRuleObjectMatrix().clone(), { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]);
4393
4381
  getRepeatRange(vCopyRange, vPastedRange, !0).forEach(({ startRange }) => {
4394
- var _a23;
4395
- (_a23 = this._copyInfo) == null || _a23.matrix.forValue((row, col, ruleId) => {
4382
+ var _a22;
4383
+ (_a22 = this._copyInfo) == null || _a22.matrix.forValue((row, col, ruleId) => {
4396
4384
  const range = Rectangle.getPositionRange(
4397
4385
  {
4398
4386
  startRow: row,
@@ -4418,7 +4406,7 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4418
4406
  };
4419
4407
  }
4420
4408
  }
4421
- }, __name(_a17, "DataValidationCopyPasteController"), _a17);
4409
+ }, __name(_a16, "DataValidationCopyPasteController"), _a16);
4422
4410
  DataValidationCopyPasteController = __decorateClass$5([
4423
4411
  OnLifecycle(LifecycleStages.Ready, DataValidationCopyPasteController),
4424
4412
  __decorateParam$5(0, ISheetClipboardService),
@@ -4543,9 +4531,9 @@ const _SheetDataValidationManager = class _SheetDataValidationManager extends Da
4543
4531
  this._ruleMatrix = new RuleMatrix(matrix, worksheet);
4544
4532
  }
4545
4533
  _addRuleSideEffect(rule) {
4546
- var _a23;
4534
+ var _a22;
4547
4535
  const { unitId, subUnitId } = this;
4548
- (rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) && isReferenceString((_a23 = rule.formula1) != null ? _a23 : "") && (rule.formula1 = `=${rule.formula1}`), this._ruleMatrix.addRule(rule), this._dataValidationCacheService.addRule(unitId, subUnitId, rule), this._dataValidationFormulaService.addRule(unitId, subUnitId, rule.uid, rule.formula1, rule.formula2), this._dataValidationCustomFormulaService.addRule(unitId, subUnitId, rule);
4536
+ (rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) && isReferenceString((_a22 = rule.formula1) != null ? _a22 : "") && (rule.formula1 = `=${rule.formula1}`), this._ruleMatrix.addRule(rule), this._dataValidationCacheService.addRule(unitId, subUnitId, rule), this._dataValidationFormulaService.addRule(unitId, subUnitId, rule.uid, rule.formula1, rule.formula2), this._dataValidationCustomFormulaService.addRule(unitId, subUnitId, rule);
4549
4537
  }
4550
4538
  addRule(rule, index) {
4551
4539
  (Array.isArray(rule) ? rule : [rule]).forEach((item) => {
@@ -4581,7 +4569,18 @@ const _SheetDataValidationManager = class _SheetDataValidationManager extends Da
4581
4569
  value: cellValue,
4582
4570
  status: DataValidationStatus.VALIDATING,
4583
4571
  ruleId
4584
- }), validator.validator({ value: cellValue, unitId, subUnitId, row, column: col }, rule).then((status) => {
4572
+ }), validator.validator(
4573
+ {
4574
+ value: cellValue,
4575
+ unitId,
4576
+ subUnitId,
4577
+ row,
4578
+ column: col,
4579
+ worksheet: pos.worksheet,
4580
+ workbook: pos.workbook
4581
+ },
4582
+ rule
4583
+ ).then((status) => {
4585
4584
  const realStatus = status ? DataValidationStatus.VALID : DataValidationStatus.INVALID;
4586
4585
  this._cache.setValue(row, col, {
4587
4586
  value: cellValue,
@@ -4609,8 +4608,8 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
4609
4608
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4610
4609
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4611
4610
  return kind && result && __defProp$4(target, key, result), result;
4612
- }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a18;
4613
- let DataValidationModelController = (_a18 = class extends Disposable {
4611
+ }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a17;
4612
+ let DataValidationModelController = (_a17 = class extends Disposable {
4614
4613
  constructor(_resourceManagerService, _univerInstanceService, _dataValidationModel, _injector) {
4615
4614
  super(), this._resourceManagerService = _resourceManagerService, this._univerInstanceService = _univerInstanceService, this._dataValidationModel = _dataValidationModel, this._injector = _injector, this._initDataValidationDataSource();
4616
4615
  }
@@ -4624,7 +4623,7 @@ let DataValidationModelController = (_a18 = class extends Disposable {
4624
4623
  _initDataValidationDataSource() {
4625
4624
  this._dataValidationModel.setManagerCreator(this._createSheetDataValidationManager.bind(this));
4626
4625
  }
4627
- }, __name(_a18, "DataValidationModelController"), _a18);
4626
+ }, __name(_a17, "DataValidationModelController"), _a17);
4628
4627
  DataValidationModelController = __decorateClass$4([
4629
4628
  OnLifecycle(LifecycleStages.Starting, DataValidationModelController),
4630
4629
  __decorateParam$4(0, IResourceManagerService),
@@ -4636,8 +4635,8 @@ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPrope
4636
4635
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4637
4636
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4638
4637
  return kind && result && __defProp$3(target, key, result), result;
4639
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a19;
4640
- let DataValidationPermissionController = (_a19 = class extends Disposable {
4638
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a18;
4639
+ let DataValidationPermissionController = (_a18 = class extends Disposable {
4641
4640
  constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
4642
4641
  super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
4643
4642
  }
@@ -4656,7 +4655,7 @@ let DataValidationPermissionController = (_a19 = class extends Disposable {
4656
4655
  })
4657
4656
  );
4658
4657
  }
4659
- }, __name(_a19, "DataValidationPermissionController"), _a19);
4658
+ }, __name(_a18, "DataValidationPermissionController"), _a18);
4660
4659
  DataValidationPermissionController = __decorateClass$3([
4661
4660
  OnLifecycle(LifecycleStages.Ready, DataValidationPermissionController),
4662
4661
  __decorateParam$3(0, Inject(LocaleService)),
@@ -4667,8 +4666,8 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
4667
4666
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4668
4667
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4669
4668
  return kind && result && __defProp$2(target, key, result), result;
4670
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a20;
4671
- let SheetsDataValidationValidatorService = (_a20 = class {
4669
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a19;
4670
+ let SheetsDataValidationValidatorService = (_a19 = class {
4672
4671
  constructor(_univerInstanceService, _dataValidationModel, _dataValidationCacheService) {
4673
4672
  this._univerInstanceService = _univerInstanceService, this._dataValidationModel = _dataValidationModel, this._dataValidationCacheService = _dataValidationCacheService;
4674
4673
  }
@@ -4681,9 +4680,17 @@ let SheetsDataValidationValidatorService = (_a20 = class {
4681
4680
  throw new Error(`cannot find current worksheet, sheetId: ${subUnitId}`);
4682
4681
  const cellRaw = worksheet.getCellRaw(row, col), manager = this._dataValidationModel.ensureManager(unitId, subUnitId), rule = manager.getRuleByLocation(row, col);
4683
4682
  return rule ? new Promise((resolve) => {
4684
- manager.validator(getCellValueOrigin(cellRaw), rule, { unitId, subUnitId, row, col }, resolve);
4683
+ manager.validator(getCellValueOrigin(cellRaw), rule, { unitId, subUnitId, row, col, worksheet, workbook }, resolve);
4685
4684
  }) : DataValidationStatus.VALID;
4686
4685
  }
4686
+ validatorRanges(unitId, subUnitId, ranges) {
4687
+ return Promise.all(ranges.map((range) => {
4688
+ const promises = [];
4689
+ return Range.foreach(range, (row, col) => {
4690
+ promises.push(this.validatorCell(unitId, subUnitId, row, col));
4691
+ }), promises;
4692
+ }));
4693
+ }
4687
4694
  async validatorWorksheet(unitId, subUnitId) {
4688
4695
  const rules = this._dataValidationModel.ensureManager(unitId, subUnitId).getDataValidations();
4689
4696
  return await Promise.all(rules.map((rule) => Promise.all(rule.ranges.map((range) => {
@@ -4699,7 +4706,19 @@ let SheetsDataValidationValidatorService = (_a20 = class {
4699
4706
  map[sheetIds[i]] = result;
4700
4707
  }), map;
4701
4708
  }
4702
- }, __name(_a20, "SheetsDataValidationValidatorService"), _a20);
4709
+ getDataValidations(unitId, subUnitId, ranges) {
4710
+ const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleMatrix = manager.getRuleObjectMatrix(), ruleIdSet = /* @__PURE__ */ new Set();
4711
+ return ranges.forEach((range) => {
4712
+ Range.foreach(range, (row, col) => {
4713
+ const ruleId = ruleMatrix.getValue(row, col);
4714
+ ruleId && ruleIdSet.add(ruleId);
4715
+ });
4716
+ }), Array.from(ruleIdSet).map((id) => manager.getRuleById(id)).filter(Boolean);
4717
+ }
4718
+ getDataValidation(unitId, subUnitId, ranges) {
4719
+ return this.getDataValidations(unitId, subUnitId, ranges)[0];
4720
+ }
4721
+ }, __name(_a19, "SheetsDataValidationValidatorService"), _a19);
4703
4722
  SheetsDataValidationValidatorService = __decorateClass$2([
4704
4723
  __decorateParam$2(0, IUniverInstanceService),
4705
4724
  __decorateParam$2(1, Inject(DataValidationModel)),
@@ -4709,15 +4728,14 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
4709
4728
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4710
4729
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4711
4730
  return kind && result && __defProp$1(target, key, result), result;
4712
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), __publicField$1 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField$1"), _a21;
4713
- let UniverSheetsDataValidationPlugin = (_a21 = class extends Plugin {
4731
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), __publicField$1 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField$1"), _a20;
4732
+ let UniverSheetsDataValidationPlugin = (_a20 = class extends Plugin {
4714
4733
  constructor(_config = {}, _injector, _commandService, _localeService) {
4715
4734
  super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._localeService = _localeService, this._config = Tools.deepMerge({}, DefaultSheetsDataValidation, this._config);
4716
4735
  }
4717
4736
  onStarting() {
4718
4737
  [
4719
4738
  [DataValidationPanelService],
4720
- [SheetDataValidationService],
4721
4739
  [DataValidationCacheService],
4722
4740
  [DataValidationFormulaService],
4723
4741
  [DataValidationCustomFormulaService],
@@ -4757,7 +4775,7 @@ let UniverSheetsDataValidationPlugin = (_a21 = class extends Plugin {
4757
4775
  this._commandService.registerCommand(command);
4758
4776
  });
4759
4777
  }
4760
- }, __name(_a21, "UniverSheetsDataValidationPlugin"), _a21);
4778
+ }, __name(_a20, "UniverSheetsDataValidationPlugin"), _a20);
4761
4779
  __publicField$1(UniverSheetsDataValidationPlugin, "pluginName", DATA_VALIDATION_PLUGIN_NAME);
4762
4780
  __publicField$1(UniverSheetsDataValidationPlugin, "type", UniverInstanceType.UNIVER_SHEET);
4763
4781
  UniverSheetsDataValidationPlugin = __decorateClass$1([
@@ -4770,15 +4788,14 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
4770
4788
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4771
4789
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4772
4790
  return kind && result && __defProp2(target, key, result), result;
4773
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a22;
4774
- let UniverSheetsDataValidationMobilePlugin = (_a22 = class extends Plugin {
4791
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a21;
4792
+ let UniverSheetsDataValidationMobilePlugin = (_a21 = class extends Plugin {
4775
4793
  constructor(_config = {}, _injector, _commandService, _localeService) {
4776
4794
  super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._localeService = _localeService, this._config = Tools.deepMerge({}, DefaultSheetsDataValidation, this._config);
4777
4795
  }
4778
4796
  onStarting() {
4779
4797
  [
4780
4798
  [DataValidationPanelService],
4781
- [SheetDataValidationService],
4782
4799
  [DataValidationCacheService],
4783
4800
  [DataValidationFormulaService],
4784
4801
  [DataValidationCustomFormulaService],
@@ -4814,7 +4831,7 @@ let UniverSheetsDataValidationMobilePlugin = (_a22 = class extends Plugin {
4814
4831
  this._commandService.registerCommand(command);
4815
4832
  });
4816
4833
  }
4817
- }, __name(_a22, "UniverSheetsDataValidationMobilePlugin"), _a22);
4834
+ }, __name(_a21, "UniverSheetsDataValidationMobilePlugin"), _a21);
4818
4835
  __publicField2(UniverSheetsDataValidationMobilePlugin, "pluginName", DATA_VALIDATION_PLUGIN_NAME);
4819
4836
  __publicField2(UniverSheetsDataValidationMobilePlugin, "type", UniverInstanceType.UNIVER_SHEET);
4820
4837
  UniverSheetsDataValidationMobilePlugin = __decorateClass([
@@ -4826,29 +4843,23 @@ UniverSheetsDataValidationMobilePlugin = __decorateClass([
4826
4843
  export {
4827
4844
  AddSheetDataValidationAndOpenCommand,
4828
4845
  AddSheetDataValidationCommand,
4846
+ ClearRangeDataValidationCommand,
4829
4847
  CloseValidationPanelOperation,
4830
4848
  DATA_VALIDATION_PLUGIN_NAME,
4831
- DataValidationAlertController,
4832
- DataValidationAutoFillController,
4833
4849
  DataValidationCacheService,
4834
- DataValidationController,
4835
- DataValidationCopyPasteController,
4836
4850
  DataValidationCustomFormulaService,
4837
- DataValidationFormulaController,
4838
4851
  DataValidationFormulaService,
4839
- DataValidationRefRangeController,
4840
- DataValidationRejectInputController,
4852
+ DataValidationModel2 as DataValidationModel,
4841
4853
  HideDataValidationDropdown,
4842
- ICommandService2 as ICommandService,
4843
- LocaleService2 as LocaleService,
4844
4854
  OpenValidationPanelOperation,
4845
- Plugin2 as Plugin,
4846
- SheetDataValidationService,
4847
- SheetsDataValidationRenderController,
4855
+ RemoveDataValidationCommand2 as RemoveSheetDataValidationCommand,
4856
+ SheetDataValidationManager,
4848
4857
  SheetsDataValidationValidatorService,
4849
4858
  ShowDataValidationDropdown,
4850
4859
  ToggleValidationPanelOperation,
4851
4860
  UniverSheetsDataValidationMobilePlugin,
4852
4861
  UniverSheetsDataValidationPlugin,
4853
- UpdateSheetDataValidationRangeCommand
4862
+ UpdateSheetDataValidationOptionsCommand,
4863
+ UpdateSheetDataValidationRangeCommand,
4864
+ UpdateSheetDataValidationSettingCommand
4854
4865
  };