@univerjs/sheets-data-validation 0.2.7 → 0.2.9

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 (77) hide show
  1. package/README.md +54 -4
  2. package/lib/cjs/index.js +2 -2
  3. package/lib/es/index.js +473 -458
  4. package/lib/locale/en-US.json +10 -9
  5. package/lib/locale/ru-RU.json +2 -1
  6. package/lib/locale/vi-VN.json +2 -1
  7. package/lib/locale/zh-CN.json +10 -9
  8. package/lib/locale/zh-TW.json +2 -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 +5 -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 +1 -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 +4 -5
  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 +5 -3
  35. package/lib/types/services/dv-cache.service.d.ts +1 -1
  36. package/lib/types/services/dv-custom-formula.service.d.ts +3 -3
  37. package/lib/types/services/dv-formula.service.d.ts +0 -1
  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 +1 -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 +2 -3
  46. package/lib/types/validators/decimal-validator.d.ts +5 -2
  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 +5 -2
  50. package/lib/types/validators/util.d.ts +0 -1
  51. package/lib/types/validators/whole-validator.d.ts +5 -2
  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 +25 -25
  75. package/lib/types/services/dv.service.d.ts +0 -20
  76. package/lib/types/services/dv.tips.d.ts +0 -17
  77. package/lib/types/utils/date.d.ts +0 -17
package/lib/es/index.js CHANGED
@@ -2,10 +2,10 @@ 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, UniverInstanceType, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, IUniverInstanceService, 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, numfmt, CellValueType, DEFAULT_STYLES, WrapStrategy, DocumentDataModel, BooleanNumber, Rectangle, IUndoRedoService, sequenceExecuteAsync, sequenceExecute, Optional, RxDisposable, DataValidationStatus, ILogService, 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";
8
- import { getSheetCommandTarget, SetRangeValuesCommand, WorksheetViewPermission, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, WorkbookEditablePermission, WorksheetSetCellStylePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, SheetInterceptorService, INTERCEPTOR_POINT, SheetsSelectionsService, ClearSelectionAllCommand, RefRangeService, handleCommonDefaultRangeChangeWithEffectRefCommands, UniverSheetsPlugin } from "@univerjs/sheets";
7
+ import { DataValidationModel as DataValidationModel2, RemoveDataValidationCommand as RemoveDataValidationCommand2 } from "@univerjs/data-validation";
8
+ import { SheetsSelectionsService, getSheetCommandTarget, SetRangeValuesCommand, WorksheetViewPermission, checkRangesEditablePermission, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, WorkbookEditablePermission, WorksheetSetCellStylePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, SheetInterceptorService, INTERCEPTOR_POINT, InterceptCellContentPriority, 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";
11
11
  import { IRenderManagerService, fixLineWidthByScale, Transform, Checkbox, DeviceInputEventType, getDocsSkeletonPageSize, Rect, DocumentViewModel, DocumentSkeleton, Documents, FontCache, Shape, getFontStyleString } from "@univerjs/engine-render";
@@ -14,9 +14,9 @@ import React, { forwardRef, useRef, createElement, useState, useMemo, useEffect
14
14
  import { RegisterOtherFormulaService, FormulaRefRangeService } from "@univerjs/sheets-formula";
15
15
  import { FormLayout, Input, RadioGroup, Radio, DraggableList, Select, Checkbox as Checkbox$1, Button, RectPopup, Scrollbar, DatePanel } from "@univerjs/design";
16
16
  import cs from "clsx";
17
- import { LexerTreeBuilder, deserializeRangeWithSheet, serializeRange, isReferenceString, sequenceNodeType, isFormulaTransformable, transformFormula } from "@univerjs/engine-formula";
17
+ import { LexerTreeBuilder, deserializeRangeWithSheet, serializeRange, isReferenceString, sequenceNodeType, ERROR_TYPE_SET } 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,20 +85,20 @@ 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
- constructor(_canvasPopupManagerService, _univerInstanceService, _dataValidatorRegistryService, _zenZoneService, _renderManagerService, _dataValidationModel) {
94
+ constructor(_canvasPopupManagerService, _univerInstanceService, _dataValidatorRegistryService, _zenZoneService, _renderManagerService, _dataValidationModel, _sheetsSelectionsService) {
95
95
  super();
96
96
  __publicField(this, "_activeDropdown");
97
97
  __publicField(this, "_activeDropdown$", new Subject());
98
98
  __publicField(this, "_currentPopup", null);
99
99
  __publicField(this, "activeDropdown$", this._activeDropdown$.asObservable());
100
100
  __publicField(this, "_zenVisible", !1);
101
- this._canvasPopupManagerService = _canvasPopupManagerService, this._univerInstanceService = _univerInstanceService, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._zenZoneService = _zenZoneService, this._renderManagerService = _renderManagerService, this._dataValidationModel = _dataValidationModel, this._init(), this.disposeWithMe(() => {
101
+ this._canvasPopupManagerService = _canvasPopupManagerService, this._univerInstanceService = _univerInstanceService, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._zenZoneService = _zenZoneService, this._renderManagerService = _renderManagerService, this._dataValidationModel = _dataValidationModel, this._sheetsSelectionsService = _sheetsSelectionsService, this._init(), this._initSelectionChange(), this.disposeWithMe(() => {
102
102
  this._activeDropdown$.complete();
103
103
  });
104
104
  }
@@ -110,6 +110,24 @@ let DataValidationDropdownManagerService = (_a = class extends Disposable {
110
110
  this._zenVisible = visible, visible && this.hideDropdown();
111
111
  }));
112
112
  }
113
+ _getDropdownByCell(unitId, subUnitId, row, col) {
114
+ const workbook = unitId ? this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
115
+ if (!workbook)
116
+ return;
117
+ const worksheet = subUnitId ? workbook.getSheetBySheetId(subUnitId) : workbook.getActiveSheet();
118
+ if (!worksheet)
119
+ return;
120
+ const rule = this._dataValidationModel.ensureManager(workbook.getUnitId(), worksheet.getSheetId()).getRuleByLocation(row, col);
121
+ if (!rule)
122
+ return;
123
+ const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
124
+ return validator == null ? void 0 : validator.dropdown;
125
+ }
126
+ _initSelectionChange() {
127
+ this.disposeWithMe(this._sheetsSelectionsService.selectionMoveEnd$.subscribe((selections) => {
128
+ selections && selections.every((selection) => !(selection.primary && this._getDropdownByCell(selection.primary.unitId, selection.primary.sheetId, selection.primary.actualRow, selection.primary.actualColumn))) && this.hideDropdown();
129
+ }));
130
+ }
113
131
  showDropdown(param, closeOnOutSide = !0) {
114
132
  const { location } = param, { row, col } = location;
115
133
  if (this._currentPopup && this._currentPopup.dispose(), this._zenVisible)
@@ -132,8 +150,8 @@ let DataValidationDropdownManagerService = (_a = class extends Disposable {
132
150
  const disposableCollection = new DisposableCollection();
133
151
  disposableCollection.add(popupDisposable), disposableCollection.add({
134
152
  dispose: /* @__PURE__ */ __name(() => {
135
- var _a23, _b;
136
- (_b = (_a23 = this._activeDropdown) == null ? void 0 : _a23.onHide) == null || _b.call(_a23);
153
+ var _a22, _b;
154
+ (_b = (_a22 = this._activeDropdown) == null ? void 0 : _a22.onHide) == null || _b.call(_a22);
137
155
  }, "dispose")
138
156
  }), this._currentPopup = disposableCollection;
139
157
  }
@@ -141,7 +159,7 @@ let DataValidationDropdownManagerService = (_a = class extends Disposable {
141
159
  this._activeDropdown && (this._currentPopup && this._currentPopup.dispose(), this._currentPopup = null, this._activeDropdown = null, this._activeDropdown$.next(null));
142
160
  }
143
161
  showDataValidationDropdown(unitId, subUnitId, row, col, onHide) {
144
- const workbook = this._univerInstanceService.getUniverSheetInstance(unitId);
162
+ const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
145
163
  if (!workbook)
146
164
  return;
147
165
  const worksheet = workbook.getSheetBySheetId(subUnitId);
@@ -169,19 +187,20 @@ let DataValidationDropdownManagerService = (_a = class extends Disposable {
169
187
  });
170
188
  }
171
189
  }, __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))
190
+ DataValidationDropdownManagerService = __decorateClass$j([
191
+ __decorateParam$j(0, Inject(SheetCanvasPopManagerService)),
192
+ __decorateParam$j(1, IUniverInstanceService),
193
+ __decorateParam$j(2, Inject(DataValidatorRegistryService)),
194
+ __decorateParam$j(3, IZenZoneService),
195
+ __decorateParam$j(4, IRenderManagerService),
196
+ __decorateParam$j(5, Inject(DataValidationModel)),
197
+ __decorateParam$j(6, Inject(SheetsSelectionsService))
179
198
  ], 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--)
199
+ var __defProp$i = Object.defineProperty, __getOwnPropDesc$i = Object.getOwnPropertyDescriptor, __decorateClass$i = /* @__PURE__ */ __name((decorators, target, key, kind) => {
200
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
182
201
  (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;
202
+ return kind && result && __defProp$i(target, key, result), result;
203
+ }, "__decorateClass$i"), __decorateParam$i = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$i"), _a2;
185
204
  let DataValidationPanelService = (_a2 = class extends Disposable {
186
205
  constructor(_univerInstanceService, _sidebarService) {
187
206
  super();
@@ -204,15 +223,15 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
204
223
  return this._open$.getValue();
205
224
  }
206
225
  dispose() {
207
- var _a23;
208
- super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (_a23 = this._closeDisposable) == null || _a23.dispose();
226
+ var _a22;
227
+ super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (_a22 = this._closeDisposable) == null || _a22.dispose();
209
228
  }
210
229
  open() {
211
230
  this._open$.next(!0);
212
231
  }
213
232
  close() {
214
- var _a23;
215
- this._open$.next(!1), (_a23 = this._closeDisposable) == null || _a23.dispose();
233
+ var _a22;
234
+ this._open$.next(!1), (_a22 = this._closeDisposable) == null || _a22.dispose();
216
235
  }
217
236
  setCloseDisposable(disposable) {
218
237
  this._closeDisposable = toDisposable(() => {
@@ -223,9 +242,9 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
223
242
  this._activeRule = rule, this._activeRule$.next(rule);
224
243
  }
225
244
  }, __name(_a2, "DataValidationPanelService"), _a2);
226
- DataValidationPanelService = __decorateClass$j([
227
- __decorateParam$j(0, IUniverInstanceService),
228
- __decorateParam$j(1, ISidebarService)
245
+ DataValidationPanelService = __decorateClass$i([
246
+ __decorateParam$i(0, IUniverInstanceService),
247
+ __decorateParam$i(1, ISidebarService)
229
248
  ], DataValidationPanelService);
230
249
  const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperation = {
231
250
  id: "data-validation.operation.open-validation-panel",
@@ -348,11 +367,11 @@ const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperatio
348
367
  };
349
368
  __name(_DataValidationCacheService, "DataValidationCacheService");
350
369
  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--)
370
+ var __defProp$h = Object.defineProperty, __getOwnPropDesc$h = Object.getOwnPropertyDescriptor, __decorateClass$h = /* @__PURE__ */ __name((decorators, target, key, kind) => {
371
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
353
372
  (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;
373
+ return kind && result && __defProp$h(target, key, result), result;
374
+ }, "__decorateClass$h"), __decorateParam$h = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$h"), _a3;
356
375
  let DataValidationFormulaService = (_a3 = class extends Disposable {
357
376
  constructor(_instanceService, _registerOtherFormulaService, _dataValidationCacheService, _dataValidationModel) {
358
377
  super();
@@ -367,8 +386,8 @@ let DataValidationFormulaService = (_a3 = class extends Disposable {
367
386
  for (const subUnitId in unitMap) {
368
387
  const results = unitMap[subUnitId], formulaMap = this._ensureRuleFormulaMap(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
369
388
  results.forEach((result) => {
370
- var _a23, _b;
371
- if (formulaMap.get((_a23 = result.extra) == null ? void 0 : _a23.ruleId)) {
389
+ var _a22, _b;
390
+ if (formulaMap.get((_a22 = result.extra) == null ? void 0 : _a22.ruleId)) {
372
391
  const rule = manager.getRuleById((_b = result.extra) == null ? void 0 : _b.ruleId);
373
392
  rule && this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges);
374
393
  }
@@ -453,22 +472,27 @@ let DataValidationFormulaService = (_a3 = class extends Disposable {
453
472
  return this._ensureRuleFormulaMap(unitId, subUnitId).get(ruleId);
454
473
  }
455
474
  }, __name(_a3, "DataValidationFormulaService"), _a3);
456
- DataValidationFormulaService = __decorateClass$i([
457
- __decorateParam$i(0, IUniverInstanceService),
458
- __decorateParam$i(1, Inject(RegisterOtherFormulaService)),
459
- __decorateParam$i(2, Inject(DataValidationCacheService)),
460
- __decorateParam$i(3, Inject(DataValidationModel))
475
+ DataValidationFormulaService = __decorateClass$h([
476
+ __decorateParam$h(0, IUniverInstanceService),
477
+ __decorateParam$h(1, Inject(RegisterOtherFormulaService)),
478
+ __decorateParam$h(2, Inject(DataValidationCacheService)),
479
+ __decorateParam$h(3, Inject(DataValidationModel))
461
480
  ], DataValidationFormulaService);
462
481
  function getFormulaResult(result) {
463
- var _a23, _b;
464
- return (_b = (_a23 = result == null ? void 0 : result[0]) == null ? void 0 : _a23[0]) == null ? void 0 : _b.v;
482
+ var _a22, _b;
483
+ return (_b = (_a22 = result == null ? void 0 : result[0]) == null ? void 0 : _a22[0]) == null ? void 0 : _b.v;
465
484
  }
466
485
  __name(getFormulaResult, "getFormulaResult");
467
- var __defProp$h = Object.defineProperty, __getOwnPropDesc$h = Object.getOwnPropertyDescriptor, __decorateClass$h = /* @__PURE__ */ __name((decorators, target, key, kind) => {
468
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
486
+ function getFormulaCellData(result) {
487
+ var _a22;
488
+ return (_a22 = result == null ? void 0 : result[0]) == null ? void 0 : _a22[0];
489
+ }
490
+ __name(getFormulaCellData, "getFormulaCellData");
491
+ var __defProp$g = Object.defineProperty, __getOwnPropDesc$g = Object.getOwnPropertyDescriptor, __decorateClass$g = /* @__PURE__ */ __name((decorators, target, key, kind) => {
492
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
469
493
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
470
- return kind && result && __defProp$h(target, key, result), result;
471
- }, "__decorateClass$h"), __decorateParam$h = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$h");
494
+ return kind && result && __defProp$g(target, key, result), result;
495
+ }, "__decorateClass$g"), __decorateParam$g = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$g");
472
496
  const MARGIN_H$2 = 6;
473
497
  var _a4;
474
498
  let CheckboxRender = (_a4 = class {
@@ -476,8 +500,8 @@ let CheckboxRender = (_a4 = class {
476
500
  this._commandService = _commandService, this._formulaService = _formulaService, this._themeService = _themeService;
477
501
  }
478
502
  _calc(cellInfo, style) {
479
- var _a23, _b, _c;
480
- 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;
503
+ var _a22, _b, _c;
504
+ 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;
481
505
  let widgetLeft = 0, widgetTop = 0;
482
506
  switch (vt) {
483
507
  case VerticalAlign.TOP:
@@ -509,21 +533,21 @@ let CheckboxRender = (_a4 = class {
509
533
  };
510
534
  }
511
535
  calcCellAutoHeight(info) {
512
- var _a23;
536
+ var _a22;
513
537
  const { style } = info;
514
- return ((_a23 = style == null ? void 0 : style.fs) != null ? _a23 : 10) * 1.6;
538
+ return ((_a22 = style == null ? void 0 : style.fs) != null ? _a22 : 10) * 1.6;
515
539
  }
516
540
  async _parseFormula(rule, unitId, subUnitId) {
517
- var _a23, _b;
541
+ var _a22, _b;
518
542
  const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
519
543
  return {
520
- formula1: isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1,
544
+ formula1: isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1,
521
545
  formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
522
546
  };
523
547
  }
524
548
  drawWith(ctx, info) {
525
- var _a23, _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 = (_a23 = data.dataValidation) == null ? void 0 : _a23.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
549
+ var _a22, _b, _c, _d, _e;
550
+ 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;
527
551
  if (!rule || !validator)
528
552
  return;
529
553
  const colors = this._themeService.getCurrentTheme();
@@ -556,10 +580,10 @@ let CheckboxRender = (_a4 = class {
556
580
  return offsetX <= endX && offsetX >= startX && offsetY <= endY && offsetY >= startY;
557
581
  }
558
582
  async onPointerDown(info, evt) {
559
- var _a23, _b;
583
+ var _a22, _b;
560
584
  if (evt.button === 2)
561
585
  return;
562
- 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;
586
+ 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;
563
587
  if (!rule || !validator || !validator.skipDefaultFontRender(rule, value, { unitId, subUnitId }))
564
588
  return;
565
589
  const { formula1, formula2 } = await this._parseFormula(rule, unitId, subUnitId), params = {
@@ -580,18 +604,18 @@ let CheckboxRender = (_a4 = class {
580
604
  );
581
605
  }
582
606
  }, __name(_a4, "CheckboxRender"), _a4);
583
- CheckboxRender = __decorateClass$h([
584
- __decorateParam$h(0, ICommandService),
585
- __decorateParam$h(1, Inject(DataValidationFormulaService)),
586
- __decorateParam$h(2, Inject(ThemeService))
607
+ CheckboxRender = __decorateClass$g([
608
+ __decorateParam$g(0, ICommandService),
609
+ __decorateParam$g(1, Inject(DataValidationFormulaService)),
610
+ __decorateParam$g(2, Inject(ThemeService))
587
611
  ], CheckboxRender);
588
612
  function CustomFormulaInput(props) {
589
- var _a23;
613
+ var _a22;
590
614
  const { unitId, subUnitId, value, onChange, showError, validResult } = props, formula1Res = showError ? validResult == null ? void 0 : validResult.formula1 : "";
591
615
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { error: formula1Res, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
592
616
  TextEditor,
593
617
  {
594
- value: (_a23 = value == null ? void 0 : value.formula1) != null ? _a23 : "",
618
+ value: (_a22 = value == null ? void 0 : value.formula1) != null ? _a22 : "",
595
619
  id: createInternalEditorID(`dataValidation-custom-formula-${unitId}-${subUnitId}`),
596
620
  onChange: /* @__PURE__ */ __name((newValue) => {
597
621
  onChange == null || onChange({
@@ -689,15 +713,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
689
713
  var attrs = __assign({}, node.attrs);
690
714
  extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
691
715
  var defIds = runtimeProps.defIds;
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(_a23) {
693
- var key = _a23[0], value = _a23[1];
716
+ 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) {
717
+ var key = _a22[0], value = _a22[1];
694
718
  typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
695
719
  })), attrs;
696
720
  }
697
721
  __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
698
722
  function replaceRuntimeIdsInDefs(node, runtimeProps) {
699
- var _a23, defIds = runtimeProps.defIds;
700
- 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) {
723
+ var _a22, defIds = runtimeProps.defIds;
724
+ 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) {
701
725
  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;
702
726
  }) }) : node;
703
727
  }
@@ -777,17 +801,17 @@ function getDataValidationCellValue(cellData) {
777
801
  }
778
802
  __name(getDataValidationCellValue, "getDataValidationCellValue");
779
803
  const DATA_VALIDATION_PLUGIN_NAME = "SHEET_DATA_VALIDATION_PLUGIN", DROP_DOWN_DEFAULT_COLOR = "#ECECEC";
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$g = Object.defineProperty, __getOwnPropDesc$g = Object.getOwnPropertyDescriptor, __decorateClass$g = /* @__PURE__ */ __name((decorators, target, key, kind) => {
781
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
804
+ var L = /* @__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))(L || {}), __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
805
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
782
806
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
783
- return kind && result && __defProp$g(target, key, result), result;
784
- }, "__decorateClass$g"), __decorateParam$g = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$g"), _a5;
807
+ return kind && result && __defProp$f(target, key, result), result;
808
+ }, "__decorateClass$f"), __decorateParam$f = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$f"), _a5;
785
809
  let DataValidationFormulaController = (_a5 = class extends Disposable {
786
810
  constructor(_univerInstanceService, _permissionService, _lexerTreeBuilder) {
787
811
  super(), this._univerInstanceService = _univerInstanceService, this._permissionService = _permissionService, this._lexerTreeBuilder = _lexerTreeBuilder;
788
812
  }
789
813
  getFormulaRefCheck(formulaString) {
790
- var _a23, _b;
814
+ var _a22, _b;
791
815
  const sequenceNodes = this._lexerTreeBuilder.sequenceNodesBuilder(formulaString);
792
816
  if (!sequenceNodes)
793
817
  return !0;
@@ -809,19 +833,19 @@ let DataValidationFormulaController = (_a5 = class extends Disposable {
809
833
  const { startRow, endRow, startColumn, endColumn } = sequenceGrid.range;
810
834
  for (let i2 = startRow; i2 <= endRow; i2++)
811
835
  for (let j = startColumn; j <= endColumn; j++) {
812
- const permission = (_b = (_a23 = targetSheet.getCell(i2, j)) == null ? void 0 : _a23.selectionProtection) == null ? void 0 : _b[0];
813
- if ((permission == null ? void 0 : permission[P.View]) === !1)
836
+ const permission = (_b = (_a22 = targetSheet.getCell(i2, j)) == null ? void 0 : _a22.selectionProtection) == null ? void 0 : _b[0];
837
+ if ((permission == null ? void 0 : permission[L.View]) === !1)
814
838
  return !1;
815
839
  }
816
840
  }
817
841
  return !0;
818
842
  }
819
843
  }, __name(_a5, "DataValidationFormulaController"), _a5);
820
- DataValidationFormulaController = __decorateClass$g([
844
+ DataValidationFormulaController = __decorateClass$f([
821
845
  OnLifecycle(LifecycleStages.Rendered, DataValidationFormulaController),
822
- __decorateParam$g(0, IUniverInstanceService),
823
- __decorateParam$g(1, IPermissionService),
824
- __decorateParam$g(2, Inject(LexerTreeBuilder))
846
+ __decorateParam$f(0, IUniverInstanceService),
847
+ __decorateParam$f(1, IPermissionService),
848
+ __decorateParam$f(2, Inject(LexerTreeBuilder))
825
849
  ], DataValidationFormulaController);
826
850
  const DEFAULT_COLOR_PRESET = [
827
851
  "#FFFFFF",
@@ -1168,18 +1192,18 @@ const _CheckboxValidator = class _CheckboxValidator extends BaseDataValidator {
1168
1192
  };
1169
1193
  }
1170
1194
  async parseFormula(rule, unitId, subUnitId) {
1171
- var _a23, _b;
1195
+ var _a22, _b;
1172
1196
  const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
1173
1197
  return {
1174
- formula1: isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1,
1198
+ formula1: isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1,
1175
1199
  formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
1176
1200
  };
1177
1201
  }
1178
1202
  parseFormulaSync(rule, unitId, subUnitId) {
1179
- var _a23, _b;
1203
+ var _a22, _b;
1180
1204
  const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = this._formulaService.getRuleFormulaResultSync(unitId, subUnitId, rule.uid);
1181
1205
  return {
1182
- formula1: isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1,
1206
+ formula1: isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1,
1183
1207
  formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
1184
1208
  };
1185
1209
  }
@@ -1196,17 +1220,12 @@ let CheckboxValidator = _CheckboxValidator;
1196
1220
  const TWO_FORMULA_OPERATOR_COUNT = [
1197
1221
  DataValidationOperator.BETWEEN,
1198
1222
  DataValidationOperator.NOT_BETWEEN
1199
- ];
1200
- function excelSerialToUnixTimestamp(excelSerial) {
1201
- return new Date((excelSerial - 25569) * 86400).getTime();
1202
- }
1203
- __name(excelSerialToUnixTimestamp, "excelSerialToUnixTimestamp");
1204
- const timestamp2SerialTime = /* @__PURE__ */ __name((timestamp) => timestamp / 86400 + 25569, "timestamp2SerialTime"), dataValidationOptionsButton = "univer-data-validation-options-button", dataValidationOptionsButtonIcon = "univer-data-validation-options-button-icon", styles$5 = {
1223
+ ], dataValidationOptionsButton = "univer-data-validation-options-button", dataValidationOptionsButtonIcon = "univer-data-validation-options-button-icon", styles$5 = {
1205
1224
  dataValidationOptionsButton,
1206
1225
  dataValidationOptionsButtonIcon
1207
1226
  };
1208
1227
  function DataValidationOptions(props) {
1209
- var _a23;
1228
+ var _a22;
1210
1229
  const localeService = useDependency(LocaleService), componentManager = useDependency(ComponentManager), { value, onChange, extraComponent } = props, [show, setShow] = useState(!1), ExtraOptions = extraComponent ? componentManager.get(extraComponent) : null;
1211
1230
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1212
1231
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$5.dataValidationOptionsButton, onClick: /* @__PURE__ */ __name(() => setShow(!show), "onClick"), children: [
@@ -1222,7 +1241,7 @@ function DataValidationOptions(props) {
1222
1241
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
1223
1242
  RadioGroup,
1224
1243
  {
1225
- value: `${(_a23 = value.errorStyle) != null ? _a23 : DataValidationErrorStyle.WARNING}`,
1244
+ value: `${(_a22 = value.errorStyle) != null ? _a22 : DataValidationErrorStyle.WARNING}`,
1226
1245
  onChange: /* @__PURE__ */ __name((errorStyle) => onChange({ ...value, errorStyle: +errorStyle }), "onChange"),
1227
1246
  children: [
1228
1247
  /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationErrorStyle.WARNING}`, children: localeService.t("dataValidation.panel.showWarning") }),
@@ -1239,17 +1258,17 @@ function DataValidationOptions(props) {
1239
1258
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1240
1259
  Checkbox$1,
1241
1260
  {
1242
- checked: value.showInputMessage,
1261
+ checked: value.showErrorMessage,
1243
1262
  onChange: /* @__PURE__ */ __name(() => onChange({
1244
1263
  ...value,
1245
- showInputMessage: !value.showInputMessage
1264
+ showErrorMessage: !value.showErrorMessage
1246
1265
  }), "onChange"),
1247
1266
  children: localeService.t("dataValidation.panel.showInfo")
1248
1267
  }
1249
1268
  )
1250
1269
  }
1251
1270
  ),
1252
- value.showInputMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { value: value.error, onChange: /* @__PURE__ */ __name((error) => onChange({ ...value, error }), "onChange") }) }) : null
1271
+ value.showErrorMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { value: value.error, onChange: /* @__PURE__ */ __name((error) => onChange({ ...value, error }), "onChange") }) }) : null
1253
1272
  ] })
1254
1273
  ] });
1255
1274
  }
@@ -1454,8 +1473,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
1454
1473
  }), e.stopPropagation();
1455
1474
  }, "handleDelete");
1456
1475
  return useEffect(() => () => {
1457
- var _a23;
1458
- ids.current && ((_a23 = ids.current) == null || _a23.forEach((id) => {
1476
+ var _a22;
1477
+ ids.current && ((_a22 = ids.current) == null || _a22.forEach((id) => {
1459
1478
  id && markSelectionService.removeShape(id);
1460
1479
  }));
1461
1480
  }, [markSelectionService]), /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -1486,8 +1505,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
1486
1505
  })));
1487
1506
  }, "onMouseEnter"),
1488
1507
  onMouseLeave: /* @__PURE__ */ __name(() => {
1489
- var _a23;
1490
- setIsHover(!1), (_a23 = ids.current) == null || _a23.forEach((id) => {
1508
+ var _a22;
1509
+ setIsHover(!1), (_a22 = ids.current) == null || _a22.forEach((id) => {
1491
1510
  id && markSelectionService.removeShape(id);
1492
1511
  }), ids.current = void 0;
1493
1512
  }, "onMouseLeave"),
@@ -1540,25 +1559,12 @@ function DataValidationListWithWorkbook(props) {
1540
1559
  subUnitId
1541
1560
  });
1542
1561
  }, "handleRemoveAll"), rulesByPermissionCheck = (/* @__PURE__ */ __name((rules2) => {
1543
- const worksheet2 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
1544
- return rules2.map((rule) => {
1545
- const { ranges } = rule;
1546
- return (ranges == null ? void 0 : ranges.some((range) => {
1547
- var _a23, _b;
1548
- const { startRow, startColumn, endRow, endColumn } = range;
1549
- for (let row = startRow; row <= endRow; row++)
1550
- for (let col = startColumn; col <= endColumn; col++) {
1551
- const permission = (_b = (_a23 = worksheet2 == null ? void 0 : worksheet2.getCell(row, col)) == null ? void 0 : _a23.selectionProtection) == null ? void 0 : _b[0];
1552
- if ((permission == null ? void 0 : permission[P.Edit]) === !1 || (permission == null ? void 0 : permission[P.View]) === !1)
1553
- return !0;
1554
- }
1555
- return !1;
1556
- })) ? { ...rule, disable: !0 } : { ...rule };
1557
- });
1562
+ const workbook2 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), worksheet2 = workbook2.getActiveSheet(), unitId2 = workbook2.getUnitId(), subUnitId2 = worksheet2.getSheetId();
1563
+ return rules2.map((rule) => checkRangesEditablePermission(injector, unitId2, subUnitId2, rule.ranges) ? { ...rule } : { ...rule, disable: !0 });
1558
1564
  }, "getDvRulesByPermissionCorrect"))(rules), hasDisableRule = rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.some((rule) => rule.disable);
1559
1565
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1560
1566
  rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.map((rule) => {
1561
- var _a23;
1567
+ var _a22;
1562
1568
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1563
1569
  DataValidationItem,
1564
1570
  {
@@ -1572,7 +1578,7 @@ function DataValidationListWithWorkbook(props) {
1572
1578
  });
1573
1579
  }, "onClick"),
1574
1580
  rule,
1575
- disable: (_a23 = rule.disable) != null ? _a23 : !1
1581
+ disable: (_a22 = rule.disable) != null ? _a22 : !1
1576
1582
  },
1577
1583
  rule.uid
1578
1584
  );
@@ -1598,10 +1604,10 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
1598
1604
  dvListDropdownSplit,
1599
1605
  dvListDropdownEdit
1600
1606
  }, SelectList = /* @__PURE__ */ __name((props) => {
1601
- const { value, onChange, multiple, options, title, onEdit, style } = props;
1607
+ 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);
1602
1608
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.dvListDropdown, style, children: [
1603
1609
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownTitle, children: title }),
1604
- /* @__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) => {
1610
+ /* @__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) => {
1605
1611
  const selected = value.indexOf(item.value) > -1, handleClick = /* @__PURE__ */ __name(() => {
1606
1612
  let set;
1607
1613
  selected ? set = new Set(value.filter((sub) => sub !== item.value)) : set = new Set(multiple ? [...value, item.value] : [item.value]);
@@ -1609,31 +1615,52 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
1609
1615
  options.forEach((opt) => {
1610
1616
  set.has(opt.value) && newValue.push(opt.value);
1611
1617
  }), onChange(newValue);
1612
- }, "handleClick");
1618
+ }, "handleClick"), index = item.label.toLocaleLowerCase().indexOf(lowerFilter);
1613
1619
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.dvListDropdownItemContainer, onClick: handleClick, children: [
1614
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownItem, style: { background: item.color || DROP_DOWN_DEFAULT_COLOR }, children: item.label }),
1620
+ /* @__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: [
1621
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: item.label.substring(0, index) }),
1622
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { fontWeight: "bold" }, children: item.label.substring(index, index + lowerFilter.length) }),
1623
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: item.label.substring(index + lowerFilter.length) })
1624
+ ] }) : item.label }),
1615
1625
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownSelectedIcon, children: selected ? /* @__PURE__ */ jsxRuntimeExports.jsx(CheckMarkSingle, {}) : null })
1616
1626
  ] }, i);
1617
- }) }) }) }),
1627
+ }) }) }, filter2) }),
1618
1628
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownSplit }),
1619
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownEdit, children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { onClick: onEdit, children: "编辑" }) })
1629
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownEdit, children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { onClick: onEdit, children: localeService.t("dataValidation.list.edit") }) })
1620
1630
  ] });
1621
1631
  }, "SelectList");
1622
1632
  function ListDropDown(props) {
1623
- var _a23, _b;
1624
- 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)), []);
1633
+ var _a22, _b;
1634
+ 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)), []);
1625
1635
  useObservable(ruleChange$);
1626
1636
  const anchorRect = RectPopup.useContext(), cellWidth = anchorRect.right - anchorRect.left;
1627
- if (!worksheet)
1637
+ if (useEffect(() => {
1638
+ const dispose = commandService.onCommandExecuted((command) => {
1639
+ if (command.id === RichTextEditingMutation.id) {
1640
+ const params = command.params, { unitId: unitId2 } = params, unit = instanceService.getUnit(unitId2, UniverInstanceType.UNIVER_DOC);
1641
+ if (!unit)
1642
+ return;
1643
+ const text = getPlainTextFormDocument(unit.getSnapshot());
1644
+ setEditingText(text);
1645
+ }
1646
+ });
1647
+ return () => {
1648
+ dispose.dispose();
1649
+ };
1650
+ }, [commandService, instanceService]), !worksheet)
1628
1651
  return null;
1629
- 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;
1630
- if (!cellData || !rule || !validator)
1652
+ 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;
1653
+ if (!cellData || !rule || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0)
1631
1654
  return;
1632
1655
  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(() => {
1633
1656
  commandService.executeCommand(OpenValidationPanelOperation.id, {
1634
1657
  ruleId: rule.uid
1635
1658
  }), hideFn();
1636
- }, "handleEdit");
1659
+ }, "handleEdit"), options = list.map((item) => ({
1660
+ label: item.label,
1661
+ value: item.label,
1662
+ color: showColor ? item.color : "transparent"
1663
+ }));
1637
1664
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1638
1665
  SelectList,
1639
1666
  {
@@ -1668,12 +1695,9 @@ function ListDropDown(props) {
1668
1695
  unitId
1669
1696
  }), commandService.executeCommand(SetRangeValuesCommand.id, params), setLocalValue(str), multiple || hideFn();
1670
1697
  }, "onChange"),
1671
- options: list.map((item) => ({
1672
- label: item.label,
1673
- value: item.label,
1674
- color: showColor ? item.color : "transparent"
1675
- })),
1676
- onEdit: handleEdit
1698
+ options,
1699
+ onEdit: handleEdit,
1700
+ filter: editingText
1677
1701
  }
1678
1702
  );
1679
1703
  }
@@ -1754,11 +1778,11 @@ var utc$1 = { exports: {} };
1754
1778
  })(utc$1);
1755
1779
  var utcExports = utc$1.exports;
1756
1780
  const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports);
1757
- var __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1758
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1781
+ var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1782
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1759
1783
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1760
- return kind && result && __defProp$f(target, key, result), result;
1761
- }, "__decorateClass$f"), __decorateParam$f = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$f"), _a6;
1784
+ return kind && result && __defProp$e(target, key, result), result;
1785
+ }, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e"), _a6;
1762
1786
  let DataValidationRejectInputController = (_a6 = class extends Disposable {
1763
1787
  constructor(_editorBridgeService, _dataValidationModel, _dataValidatorRegistryService, _dialogService, _localeService) {
1764
1788
  super(), this._editorBridgeService = _editorBridgeService, this._dataValidationModel = _dataValidationModel, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._dialogService = _dialogService, this._localeService = _localeService, this._initEditorBridgeInterceptor();
@@ -1768,17 +1792,21 @@ let DataValidationRejectInputController = (_a6 = class extends Disposable {
1768
1792
  this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT_ASYNC,
1769
1793
  {
1770
1794
  handler: /* @__PURE__ */ __name(async (cellPromise, context, next) => {
1771
- 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;
1795
+ 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;
1772
1796
  if (!rule || rule.errorStyle !== DataValidationErrorStyle.STOP)
1773
1797
  return next(Promise.resolve(cell));
1774
1798
  const validator = await this._dataValidatorRegistryService.getValidatorItem(rule.type);
1775
1799
  if (!validator || await validator.validator(
1776
1800
  {
1777
1801
  value: getCellValueOrigin(cell),
1802
+ interceptValue: getCellValueOrigin(cell),
1778
1803
  row,
1779
1804
  column: col,
1780
1805
  unitId,
1781
- subUnitId
1806
+ subUnitId,
1807
+ worksheet,
1808
+ workbook,
1809
+ t: cell == null ? void 0 : cell.t
1782
1810
  },
1783
1811
  rule
1784
1812
  ))
@@ -1837,13 +1865,13 @@ let DataValidationRejectInputController = (_a6 = class extends Disposable {
1837
1865
  });
1838
1866
  }
1839
1867
  }, __name(_a6, "DataValidationRejectInputController"), _a6);
1840
- DataValidationRejectInputController = __decorateClass$f([
1868
+ DataValidationRejectInputController = __decorateClass$e([
1841
1869
  OnLifecycle(LifecycleStages.Ready, DataValidationRejectInputController),
1842
- __decorateParam$f(0, IEditorBridgeService),
1843
- __decorateParam$f(1, Inject(DataValidationModel)),
1844
- __decorateParam$f(2, Inject(DataValidatorRegistryService)),
1845
- __decorateParam$f(3, IDialogService),
1846
- __decorateParam$f(4, Inject(LocaleService))
1870
+ __decorateParam$e(0, IEditorBridgeService),
1871
+ __decorateParam$e(1, Inject(DataValidationModel)),
1872
+ __decorateParam$e(2, Inject(DataValidatorRegistryService)),
1873
+ __decorateParam$e(3, IDialogService),
1874
+ __decorateParam$e(4, Inject(LocaleService))
1847
1875
  ], DataValidationRejectInputController);
1848
1876
  const dvDateDropdown = "univer-dv-date-dropdown", dvDateDropdownBtns = "univer-dv-date-dropdown-btns", styles = {
1849
1877
  dvDateDropdown,
@@ -1853,29 +1881,32 @@ dayjs.extend(utc);
1853
1881
  const transformDate = /* @__PURE__ */ __name((value) => {
1854
1882
  if (value == null || typeof value == "boolean")
1855
1883
  return;
1856
- if (typeof value == "number" || !Number.isNaN(+value)) {
1857
- const date2 = dayjs.unix(excelSerialToUnixTimestamp(+value)).utc().format().slice(0, -1);
1858
- return dayjs(date2);
1859
- }
1884
+ if (typeof value == "number" || !Number.isNaN(+value))
1885
+ return dayjs(numfmt.format("yyyy-MM-dd HH:mm:ss", value));
1860
1886
  const date = dayjs(value);
1861
1887
  if (date.isValid())
1862
1888
  return date;
1863
1889
  }, "transformDate");
1864
1890
  function DateDropdown(props) {
1865
- var _a23, _b, _c;
1866
- 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();
1891
+ var _a22, _b, _c;
1892
+ 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);
1867
1893
  if (!cellData || !rule || !validator)
1868
1894
  return;
1869
1895
  const handleSave = /* @__PURE__ */ __name(async () => {
1870
- if (!localDate)
1896
+ var _a23;
1897
+ if (!date)
1871
1898
  return;
1872
- 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());
1899
+ const dateStr = date.format(showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"), serialTime = (_a23 = numfmt.parseDate(dateStr)) == null ? void 0 : _a23.v;
1873
1900
  rule.errorStyle !== DataValidationErrorStyle.STOP || await validator.validator({
1874
1901
  value: serialTime,
1875
1902
  unitId,
1876
1903
  subUnitId,
1877
1904
  row,
1878
- column: col
1905
+ column: col,
1906
+ worksheet,
1907
+ workbook,
1908
+ interceptValue: dateStr.replace("Z", "").replace("T", " "),
1909
+ t: CellValueType.NUMBER
1879
1910
  }, rule) ? (commandService.executeCommand(SetRangeValuesCommand.id, {
1880
1911
  unitId,
1881
1912
  subUnitId,
@@ -1903,18 +1934,19 @@ function DateDropdown(props) {
1903
1934
  /* @__PURE__ */ jsxRuntimeExports.jsx(
1904
1935
  DatePanel,
1905
1936
  {
1906
- defaultValue: localDate,
1907
- pickerValue: localDate != null ? localDate : date,
1937
+ defaultValue: date,
1938
+ pickerValue: date,
1908
1939
  showTime: showTime || void 0,
1909
1940
  onSelect: /* @__PURE__ */ __name(async (newValue) => {
1910
1941
  setLocalDate(newValue);
1911
1942
  }, "onSelect"),
1912
1943
  onPanelChange: /* @__PURE__ */ __name((value) => {
1913
1944
  setLocalDate(value);
1914
- }, "onPanelChange")
1945
+ }, "onPanelChange"),
1946
+ disabledDate: /* @__PURE__ */ __name((current) => !numfmt.parseDate(current.format("YYYY-MM-DD")), "disabledDate")
1915
1947
  }
1916
1948
  ),
1917
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.dvDateDropdownBtns, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "primary", onClick: handleSave, disabled: !localDate, children: "确定" }) })
1949
+ /* @__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") }) })
1918
1950
  ] });
1919
1951
  }
1920
1952
  __name(DateDropdown, "DateDropdown");
@@ -1949,12 +1981,12 @@ const DateOperatorTitleMap = {
1949
1981
  [DataValidationOperator.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual"
1950
1982
  }, DATE_SHOW_TIME_OPTION = "DATE_SHOW_TIME_OPTION";
1951
1983
  function DateShowTimeOption(props) {
1952
- var _a23;
1984
+ var _a22;
1953
1985
  const { value, onChange } = props, localeService = useDependency(LocaleService);
1954
1986
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1955
1987
  Checkbox$1,
1956
1988
  {
1957
- checked: (_a23 = value.bizInfo) == null ? void 0 : _a23.showTime,
1989
+ checked: (_a22 = value.bizInfo) == null ? void 0 : _a22.showTime,
1958
1990
  onChange: /* @__PURE__ */ __name((showTime) => {
1959
1991
  onChange({
1960
1992
  ...value,
@@ -1971,12 +2003,13 @@ function DateShowTimeOption(props) {
1971
2003
  __name(DateShowTimeOption, "DateShowTimeOption");
1972
2004
  DateShowTimeOption.componentKey = DATE_SHOW_TIME_OPTION;
1973
2005
  const FORMULA1$1 = "{FORMULA1}", FORMULA2$1 = "{FORMULA2}", transformDate2SerialNumber = /* @__PURE__ */ __name((value) => {
2006
+ var _a22;
1974
2007
  if (value == null || typeof value == "boolean")
1975
2008
  return;
1976
2009
  if (typeof value == "number" || !Number.isNaN(+value))
1977
2010
  return +value;
1978
- const dateStr = `${dayjs(value).format("YYYY-MM-DD HH:mm:ss").split(" ").join("T")}Z`;
1979
- return timestamp2SerialTime(dayjs(dateStr).unix());
2011
+ const dateStr = `${dayjs(value).format("YYYY-MM-DD HH:mm:ss")}`;
2012
+ return (_a22 = numfmt.parseDate(dateStr)) == null ? void 0 : _a22.v;
1980
2013
  }, "transformDate2SerialNumber"), _DateValidator = class _DateValidator extends BaseDataValidator {
1981
2014
  constructor() {
1982
2015
  super(...arguments);
@@ -1999,24 +2032,24 @@ const FORMULA1$1 = "{FORMULA1}", FORMULA2$1 = "{FORMULA2}", transformDate2Serial
1999
2032
  __publicField(this, "_formulaService", this.injector.get(DataValidationFormulaService));
2000
2033
  }
2001
2034
  async parseFormula(rule, unitId, subUnitId) {
2002
- var _a23, _b;
2035
+ var _a22, _b;
2003
2036
  const results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
2004
2037
  return {
2005
- formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1),
2038
+ formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1),
2006
2039
  formula2: transformDate2SerialNumber(isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2)
2007
2040
  };
2008
2041
  }
2009
2042
  parseFormulaSync(rule, unitId, subUnitId) {
2010
- var _a23, _b;
2043
+ var _a22, _b;
2011
2044
  const results = this._formulaService.getRuleFormulaResultSync(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
2012
2045
  return {
2013
- formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : formula1),
2046
+ formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1),
2014
2047
  formula2: transformDate2SerialNumber(isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2)
2015
2048
  };
2016
2049
  }
2017
2050
  async isValidType(info) {
2018
- const { value } = info;
2019
- return typeof value == "string" ? dayjs(value, "YYYY-MM-DD HH:mm:ss", !0).isValid() : typeof value == "number";
2051
+ const { interceptValue } = info;
2052
+ return typeof interceptValue == "string" ? !!numfmt.parseDate(interceptValue) : !1;
2020
2053
  }
2021
2054
  _validatorSingleFormula(formula) {
2022
2055
  return !Tools.isBlank(formula) && (isFormulaString(formula) || !Number.isNaN(+formula) || !!formula && dayjs(formula).isValid());
@@ -2090,25 +2123,25 @@ const FORMULA1$1 = "{FORMULA1}", FORMULA2$1 = "{FORMULA2}", transformDate2Serial
2090
2123
  return this.operators.map((operator) => this.localeService.t(DateOperatorNameMap[operator]));
2091
2124
  }
2092
2125
  generateRuleName(rule) {
2093
- var _a23, _b;
2126
+ var _a22, _b;
2094
2127
  if (!rule.operator)
2095
2128
  return this.titleStr;
2096
- const ruleName = this.localeService.t(DateOperatorTitleMap[rule.operator]).replace(FORMULA1$1, (_a23 = rule.formula1) != null ? _a23 : "").replace(FORMULA2$1, (_b = rule.formula2) != null ? _b : "");
2129
+ const ruleName = this.localeService.t(DateOperatorTitleMap[rule.operator]).replace(FORMULA1$1, (_a22 = rule.formula1) != null ? _a22 : "").replace(FORMULA2$1, (_b = rule.formula2) != null ? _b : "");
2097
2130
  return `${this.titleStr} ${ruleName}`;
2098
2131
  }
2099
2132
  generateRuleErrorMessage(rule) {
2100
- var _a23, _b;
2101
- 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;
2133
+ var _a22, _b;
2134
+ 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;
2102
2135
  }
2103
2136
  };
2104
2137
  __name(_DateValidator, "DateValidator");
2105
2138
  let DateValidator = _DateValidator;
2106
- var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2107
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2139
+ var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPropertyDescriptor, __decorateClass$d = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2140
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2108
2141
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2109
- return kind && result && __defProp$e(target, key, result), result;
2110
- }, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e");
2111
- 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");
2142
+ return kind && result && __defProp$d(target, key, result), result;
2143
+ }, "__decorateClass$d"), __decorateParam$d = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$d");
2144
+ 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");
2112
2145
  function convertToDocumentData(text, style) {
2113
2146
  const contentLength = text.length;
2114
2147
  return {
@@ -2176,19 +2209,21 @@ function createDocuments(text, localeService, style) {
2176
2209
  };
2177
2210
  }
2178
2211
  __name(createDocuments, "createDocuments");
2179
- function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht) {
2212
+ function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht, margin = !0) {
2180
2213
  let paddingTop = 0;
2214
+ const realMargin = margin ? MARGIN_V$1 : 0;
2181
2215
  switch (vt) {
2182
2216
  case VerticalAlign.BOTTOM:
2183
- paddingTop = cellHeight - MARGIN_V$1 * 2 - fontHeight + MARGIN_V$1;
2217
+ paddingTop = cellHeight - realMargin * 2 - fontHeight + realMargin;
2184
2218
  break;
2185
2219
  case VerticalAlign.MIDDLE:
2186
- paddingTop = (cellHeight - MARGIN_V$1 * 2 - fontHeight) / 2 + MARGIN_V$1;
2220
+ paddingTop = (cellHeight - realMargin * 2 - fontHeight) / 2 + realMargin;
2187
2221
  break;
2188
2222
  default:
2189
- paddingTop = MARGIN_V$1;
2223
+ paddingTop = realMargin;
2190
2224
  break;
2191
2225
  }
2226
+ paddingTop = Math.max(MARGIN_V$1, paddingTop);
2192
2227
  let paddingLeft = 0;
2193
2228
  switch (ht) {
2194
2229
  case HorizontalAlign.CENTER:
@@ -2198,7 +2233,7 @@ function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht) {
2198
2233
  paddingLeft = cellWidth - fontWidth;
2199
2234
  break;
2200
2235
  }
2201
- return {
2236
+ return paddingLeft = Math.max(MARGIN_H$1, paddingLeft), {
2202
2237
  paddingLeft,
2203
2238
  paddingTop
2204
2239
  };
@@ -2207,6 +2242,12 @@ __name(calcPadding, "calcPadding");
2207
2242
  var _a7;
2208
2243
  let DropdownWidget = (_a7 = class {
2209
2244
  constructor(_localeService, _commandService) {
2245
+ // static padding: IPaddingData = {
2246
+ // l: MARGIN_H + PADDING_H,
2247
+ // r: ICON_PLACE + MARGIN_H,
2248
+ // t: MARGIN_V,
2249
+ // b: MARGIN_V,
2250
+ // };
2210
2251
  __publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
2211
2252
  __publicField(this, "zIndex");
2212
2253
  __publicField(this, "onPointerEnter");
@@ -2220,24 +2261,27 @@ let DropdownWidget = (_a7 = class {
2220
2261
  _generateKey(row, col) {
2221
2262
  return `${row}.${col}`;
2222
2263
  }
2223
- _drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, vt) {
2224
- const left = cellWidth - ICON_PLACE$1 + 4;
2225
- let top = 9;
2264
+ _drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, fontHeight, vt, pd) {
2265
+ const { t = DEFAULT_STYLES.pd.t, b = DEFAULT_STYLES.pd.b } = pd, left = cellWidth - ICON_PLACE$1;
2266
+ let top;
2226
2267
  switch (vt) {
2227
2268
  case VerticalAlign.MIDDLE:
2228
- top = (cellHeight - ICON_PLACE$1) / 2 + 4;
2269
+ top = (cellHeight - ICON_SIZE) / 2;
2229
2270
  break;
2230
2271
  case VerticalAlign.BOTTOM:
2231
- top = cellHeight - ICON_PLACE$1 - 1;
2272
+ top = cellHeight - ICON_SIZE / 2 - b - fontHeight / 2;
2273
+ break;
2274
+ default:
2275
+ top = t + fontHeight / 2 - ICON_SIZE / 2;
2232
2276
  break;
2233
2277
  }
2234
2278
  ctx.save(), ctx.translateWithPrecision(cellBounding.startX + left, cellBounding.startY + top), ctx.fillStyle = "#565656", ctx.fill(downPath$1), ctx.restore();
2235
2279
  }
2236
- // eslint-disable-next-line max-lines-per-function
2280
+ // eslint-disable-next-line max-lines-per-function, complexity
2237
2281
  drawWith(ctx, info, skeleton) {
2238
- var _a23, _b;
2239
- 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 || {};
2240
- if (!rule || !validator || !validator.skipDefaultFontRender(rule))
2282
+ var _a22, _b;
2283
+ 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 || {};
2284
+ if (!rule || !validator || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0 || !validator.skipDefaultFontRender(rule))
2241
2285
  return;
2242
2286
  const cellBounding = {
2243
2287
  startX: _cellBounding.startX + leftOffset,
@@ -2245,31 +2289,30 @@ let DropdownWidget = (_a7 = class {
2245
2289
  startY: _cellBounding.startY + topOffset,
2246
2290
  endY: _cellBounding.endY - downOffset
2247
2291
  }, 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);
2248
- let { tb, vt, ht } = style || {};
2249
- if (tb = tb != null ? tb : WrapStrategy.WRAP, vt = vt != null ? vt : VerticalAlign.BOTTOM, ht = ht != null ? ht : HorizontalAlign.LEFT, rule.renderMode === DataValidationRenderMode.ARROW) {
2250
- 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();
2251
- const realWidth = cellWidth - ICON_PLACE$1, { documentSkeleton, documents, docModel } = createDocuments(valueStr, this._localeService, style);
2292
+ let { tb, vt, ht, pd } = style || {};
2293
+ 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) {
2294
+ 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);
2252
2295
  tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate(), documentSkeleton.getActualSize();
2253
- const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight, width: fontWidth } = textLayout, { paddingTop, paddingLeft } = calcPadding(realWidth, cellHeight, fontWidth, fontHeight, vt, ht);
2254
- 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, {
2255
- left: cellBounding.endX + skeleton.rowHeaderWidth - ICON_PLACE$1,
2256
- top: cellBounding.startY + skeleton.columnHeaderHeight,
2296
+ const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight, width: fontWidth } = textLayout, { paddingTop, paddingLeft } = calcPadding(realWidth, cellHeight - t - b, fontWidth, fontHeight, vt, ht, !1);
2297
+ 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, {
2298
+ left: cellBounding.endX + l2 + skeleton.rowHeaderWidth - ICON_PLACE$1,
2299
+ top: cellBounding.startY + t + skeleton.columnHeaderHeight,
2257
2300
  width: ICON_PLACE$1,
2258
- height: cellHeight
2301
+ height: cellHeight - t - b
2259
2302
  });
2260
2303
  } else {
2261
2304
  ctx.save(), ctx.translateWithPrecision(cellBounding.startX, cellBounding.startY), ctx.beginPath(), ctx.rect(0, 0, cellWidth, cellHeight), ctx.clip();
2262
2305
  const realWidth = cellWidth - MARGIN_H$1 * 2 - PADDING_H$1 - ICON_PLACE$1, { documentSkeleton, documents, docModel } = createDocuments(valueStr, this._localeService, style);
2263
2306
  tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate();
2264
2307
  const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight, width: fontWidth } = textLayout, { paddingTop, paddingLeft } = calcPadding(realWidth, cellHeight, fontWidth, fontHeight, vt, ht);
2265
- ctx.translate(MARGIN_H$1, paddingTop);
2308
+ ctx.translateWithPrecision(MARGIN_H$1, paddingTop);
2266
2309
  const rectWidth = Math.max(cellWidth - MARGIN_H$1 * 2, 1), rectHeight = fontHeight;
2267
2310
  Rect.drawWith(ctx, {
2268
2311
  width: rectWidth,
2269
2312
  height: rectHeight,
2270
2313
  fill: (activeItem == null ? void 0 : activeItem.color) || DROP_DOWN_DEFAULT_COLOR,
2271
2314
  radius: 8
2272
- }), 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, {
2315
+ }), 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, {
2273
2316
  left: cellBounding.startX + MARGIN_H$1 + skeleton.rowHeaderWidth,
2274
2317
  top: cellBounding.startY + paddingTop + skeleton.columnHeaderHeight,
2275
2318
  width: rectWidth,
@@ -2278,8 +2321,8 @@ let DropdownWidget = (_a7 = class {
2278
2321
  }
2279
2322
  }
2280
2323
  calcCellAutoHeight(info) {
2281
- var _a23;
2282
- 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;
2324
+ var _a22;
2325
+ 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;
2283
2326
  if (!rule || rule.renderMode === DataValidationRenderMode.TEXT)
2284
2327
  return;
2285
2328
  const cellBounding = {
@@ -2288,12 +2331,13 @@ let DropdownWidget = (_a7 = class {
2288
2331
  startY: _cellBounding.startY + topOffset,
2289
2332
  endY: _cellBounding.endY - downOffset
2290
2333
  }, cellWidth = cellBounding.endX - cellBounding.startX, value = getCellValueOrigin(data), valueStr = `${value != null ? value : ""}`;
2291
- let { tb } = style || {};
2334
+ let { tb, pd } = style || {};
2335
+ const { t = DEFAULT_STYLES.pd.t, b = DEFAULT_STYLES.pd.b } = pd != null ? pd : {};
2292
2336
  if (tb = tb != null ? tb : WrapStrategy.WRAP, rule.renderMode === DataValidationRenderMode.ARROW) {
2293
2337
  const realWidth = cellWidth - ICON_PLACE$1, { documentSkeleton, docModel } = createDocuments(valueStr, this._localeService, style);
2294
2338
  tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate(), documentSkeleton.getActualSize();
2295
2339
  const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight } = textLayout;
2296
- return fontHeight;
2340
+ return fontHeight + t + b;
2297
2341
  } else {
2298
2342
  const realWidth = cellWidth - MARGIN_H$1 * 2 - PADDING_H$1 - ICON_PLACE$1, { documentSkeleton, docModel } = createDocSkeleton(valueStr, this._localeService, style);
2299
2343
  tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate();
@@ -2321,21 +2365,16 @@ let DropdownWidget = (_a7 = class {
2321
2365
  };
2322
2366
  this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
2323
2367
  }
2324
- }, __name(_a7, "DropdownWidget"), __publicField(_a7, "padding", {
2325
- l: MARGIN_H$1 + PADDING_H$1,
2326
- r: ICON_PLACE$1 + MARGIN_H$1,
2327
- t: MARGIN_V$1,
2328
- b: MARGIN_V$1
2329
- }), _a7);
2330
- DropdownWidget = __decorateClass$e([
2331
- __decorateParam$e(0, Inject(LocaleService)),
2332
- __decorateParam$e(1, ICommandService)
2368
+ }, __name(_a7, "DropdownWidget"), _a7);
2369
+ DropdownWidget = __decorateClass$d([
2370
+ __decorateParam$d(0, Inject(LocaleService)),
2371
+ __decorateParam$d(1, ICommandService)
2333
2372
  ], DropdownWidget);
2334
2373
  const LIST_RENDER_MODE_OPTION_INPUT = "LIST_RENDER_MODE_OPTION_INPUT";
2335
2374
  function ListRenderModeInput(props) {
2336
- var _a23;
2375
+ var _a22;
2337
2376
  const { value, onChange } = props, localeService = useDependency(LocaleService);
2338
- 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: [
2377
+ 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: [
2339
2378
  /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.CUSTOM}`, children: localeService.t("dataValidation.renderMode.chip") }),
2340
2379
  /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.ARROW}`, children: localeService.t("dataValidation.renderMode.arrow") }),
2341
2380
  /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.TEXT}`, children: localeService.t("dataValidation.renderMode.text") })
@@ -2350,10 +2389,10 @@ function getRuleFormulaResultSet(result) {
2350
2389
  return result.forEach(
2351
2390
  (row) => {
2352
2391
  row.forEach((cell) => {
2353
- var _a23, _b;
2392
+ var _a22, _b;
2354
2393
  const value = getCellValueOrigin(cell);
2355
2394
  if (value != null) {
2356
- if (typeof value != "string" && typeof (cell == null ? void 0 : cell.s) == "object" && ((_b = (_a23 = cell.s) == null ? void 0 : _a23.n) != null && _b.pattern)) {
2395
+ if (typeof value != "string" && typeof (cell == null ? void 0 : cell.s) == "object" && ((_b = (_a22 = cell.s) == null ? void 0 : _a22.n) != null && _b.pattern)) {
2357
2396
  resultSet.add(numfmt.format(cell.s.n.pattern, value));
2358
2397
  return;
2359
2398
  }
@@ -2406,8 +2445,8 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
2406
2445
  return rule.renderMode !== DataValidationRenderMode.TEXT;
2407
2446
  }
2408
2447
  validatorFormula(rule, unitId, subUnitId) {
2409
- var _a23, _b, _c;
2410
- 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 : "");
2448
+ var _a22, _b, _c;
2449
+ 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 : "");
2411
2450
  return {
2412
2451
  success: !!(success && valid && !isIntersects),
2413
2452
  formula1: success ? valid ? isIntersects ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
@@ -2418,10 +2457,10 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
2418
2457
  return deserializeListOptions(cellString);
2419
2458
  }
2420
2459
  async parseFormula(rule, unitId, subUnitId) {
2421
- var _a23;
2460
+ var _a22;
2422
2461
  const { formula1 = "" } = rule, results = await this.formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
2423
2462
  return {
2424
- formula1: isFormulaString(formula1) ? getRuleFormulaResultSet((_a23 = results == null ? void 0 : results[0]) == null ? void 0 : _a23.result) : deserializeListOptions(formula1),
2463
+ formula1: isFormulaString(formula1) ? getRuleFormulaResultSet((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : deserializeListOptions(formula1),
2425
2464
  formula2: void 0
2426
2465
  };
2427
2466
  }
@@ -2436,8 +2475,8 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
2436
2475
  return this.localeService.t("dataValidation.list.error");
2437
2476
  }
2438
2477
  getList(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);
2478
+ var _a22, _b, _c;
2479
+ const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (_a22 = currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : void 0) != null ? _a22 : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2441
2480
  if (!workbook) return [];
2442
2481
  const worksheet = (_b = currentSubUnitId ? workbook.getSheetBySheetId(currentSubUnitId) : void 0) != null ? _b : workbook.getActiveSheet();
2443
2482
  if (!worksheet) return [];
@@ -2445,8 +2484,8 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
2445
2484
  return isFormulaString(formula1) ? getRuleFormulaResultSet((_c = results == null ? void 0 : results[0]) == null ? void 0 : _c.result) : deserializeListOptions(formula1);
2446
2485
  }
2447
2486
  async getListAsync(rule, currentUnitId, currentSubUnitId) {
2448
- var _a23, _b, _c;
2449
- const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (_a23 = currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : void 0) != null ? _a23 : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2487
+ var _a22, _b, _c;
2488
+ const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (_a22 = currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : void 0) != null ? _a22 : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2450
2489
  if (!workbook) return [];
2451
2490
  const worksheet = (_b = currentSubUnitId ? workbook.getSheetBySheetId(currentSubUnitId) : void 0) != null ? _b : workbook.getActiveSheet();
2452
2491
  if (!worksheet) return [];
@@ -2509,10 +2548,10 @@ const _DecimalValidator = class _DecimalValidator extends BaseDataValidator {
2509
2548
  return formula == null ? Number.NaN : +formula;
2510
2549
  }
2511
2550
  async parseFormula(rule, unitId, subUnitId) {
2512
- var _a23, _b, _c, _d, _e, _f, _g, _h;
2551
+ var _a22, _b, _c, _d, _e, _f, _g, _h;
2513
2552
  const formulaInfo = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
2514
2553
  return {
2515
- 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),
2554
+ 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),
2516
2555
  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)
2517
2556
  };
2518
2557
  }
@@ -2618,10 +2657,10 @@ const FORMULA1 = "{FORMULA1}", FORMULA2 = "{FORMULA2}", _TextLengthValidator = c
2618
2657
  return !Number.isNaN(formula);
2619
2658
  }
2620
2659
  async parseFormula(rule, unitId, subUnitId) {
2621
- var _a23, _b, _c, _d, _e, _f, _g, _h;
2660
+ var _a22, _b, _c, _d, _e, _f, _g, _h;
2622
2661
  const formulaInfo = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
2623
2662
  return {
2624
- 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),
2663
+ 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),
2625
2664
  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)
2626
2665
  };
2627
2666
  }
@@ -2674,15 +2713,15 @@ const FORMULA1 = "{FORMULA1}", FORMULA2 = "{FORMULA2}", _TextLengthValidator = c
2674
2713
  return this._isValidFormula(formula1) ? cellValue <= formula1 : !1;
2675
2714
  }
2676
2715
  generateRuleErrorMessage(rule) {
2677
- var _a23, _b;
2678
- 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;
2716
+ var _a22, _b;
2717
+ 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;
2679
2718
  }
2680
2719
  };
2681
2720
  __name(_TextLengthValidator, "TextLengthValidator");
2682
2721
  let TextLengthValidator = _TextLengthValidator;
2683
2722
  function isBlankCell(cellData) {
2684
- var _a23, _b;
2685
- 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;
2723
+ var _a22, _b;
2724
+ 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;
2686
2725
  }
2687
2726
  __name(isBlankCell, "isBlankCell");
2688
2727
  function getDataValidationDiffMutations(unitId, subUnitId, diffs, accessor, source = "command") {
@@ -2974,6 +3013,12 @@ const UpdateSheetDataValidationRangeCommand = {
2974
3013
  undoMutations
2975
3014
  }), commandService.executeCommand(UpdateDataValidationMutation.id, mutationParams), !0;
2976
3015
  }
3016
+ }, ClearRangeDataValidationCommand = {
3017
+ type: CommandType.COMMAND,
3018
+ id: "sheets.command.clear-range-data-validation",
3019
+ handler(accessor, params) {
3020
+ return params ? (accessor.get(ICommandService), !0) : !1;
3021
+ }
2977
3022
  }, DataValidationIcon = "data-validation-single", DATA_VALIDATION_MENU_ID = "sheet.menu.data-validation";
2978
3023
  function dataValidationMenuFactory(accessor) {
2979
3024
  return {
@@ -3006,11 +3051,11 @@ function addDataValidationMenuFactory(_accessor) {
3006
3051
  };
3007
3052
  }
3008
3053
  __name(addDataValidationMenuFactory, "addDataValidationMenuFactory");
3009
- var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPropertyDescriptor, __decorateClass$d = /* @__PURE__ */ __name((decorators, target, key, kind) => {
3010
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3054
+ var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPropertyDescriptor, __decorateClass$c = /* @__PURE__ */ __name((decorators, target, key, kind) => {
3055
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3011
3056
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
3012
- return kind && result && __defProp$d(target, key, result), result;
3013
- }, "__decorateClass$d"), __decorateParam$d = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$d");
3057
+ return kind && result && __defProp$c(target, key, result), result;
3058
+ }, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$c");
3014
3059
  const DefaultSheetsDataValidation = {}, INVALID_MARK = {
3015
3060
  tr: {
3016
3061
  size: 6,
@@ -3036,9 +3081,9 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3036
3081
  }
3037
3082
  _initDropdown() {
3038
3083
  this._editorBridgeService && this.disposeWithMe(this._editorBridgeService.visible$.subscribe((visible) => {
3039
- var _a23;
3084
+ var _a22;
3040
3085
  if (!visible.visible) {
3041
- ((_a23 = this._dropdownManagerService.activeDropdown) == null ? void 0 : _a23.trigger) === "editor-bridge" && this._dropdownManagerService.hideDropdown();
3086
+ ((_a22 = this._dropdownManagerService.activeDropdown) == null ? void 0 : _a22.trigger) === "editor-bridge" && this._dropdownManagerService.hideDropdown();
3042
3087
  return;
3043
3088
  }
3044
3089
  const state = this._editorBridgeService.getEditCellState();
@@ -3079,10 +3124,10 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3079
3124
  }
3080
3125
  _initSkeletonChange() {
3081
3126
  const markSkeletonDirty = /* @__PURE__ */ __name(() => {
3082
- var _a23, _b, _c;
3127
+ var _a22, _b, _c;
3083
3128
  const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
3084
3129
  if (!workbook) return;
3085
- const unitId = workbook.getUnitId(), subUnitId = (_a23 = workbook.getActiveSheet()) == null ? void 0 : _a23.getSheetId();
3130
+ const unitId = workbook.getUnitId(), subUnitId = (_a22 = workbook.getActiveSheet()) == null ? void 0 : _a22.getSheetId();
3086
3131
  if (!subUnitId) return;
3087
3132
  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);
3088
3133
  skeleton == null || skeleton.makeDirty(!0), skeleton == null || skeleton.calculate(), currentRender && currentRender.mainComponent.makeForceDirty();
@@ -3095,14 +3140,15 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3095
3140
  this._sheetInterceptorService.intercept(
3096
3141
  INTERCEPTOR_POINT.CELL_CONTENT,
3097
3142
  {
3098
- priority: 200,
3143
+ // must be after numfmt
3144
+ priority: InterceptCellContentPriority.DATA_VALIDATION,
3099
3145
  // eslint-disable-next-line max-lines-per-function, complexity
3100
3146
  handler: /* @__PURE__ */ __name((cell, pos, next) => {
3101
- var _a23, _b, _c, _d, _e, _f;
3147
+ var _a22, _b, _c, _d, _e, _f;
3102
3148
  const { row, col, unitId, subUnitId, workbook, worksheet } = pos, manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
3103
3149
  if (!manager)
3104
3150
  return next(cell);
3105
- const skeleton = (_b = (_a23 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a23.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
3151
+ const skeleton = (_b = (_a22 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a22.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
3106
3152
  if (!skeleton)
3107
3153
  return next(cell);
3108
3154
  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);
@@ -3111,7 +3157,7 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3111
3157
  const rule = manager.getRuleById(ruleId);
3112
3158
  if (!rule)
3113
3159
  return next(cell);
3114
- const cellRaw = worksheet.getCellRaw(pos.row, pos.col), validStatus = this._dataValidationModel.validator(getCellValueOrigin(cellRaw), rule, pos), validator = this._dataValidatorRegistryService.getValidatorItem(rule.type), cellValue = getCellValueOrigin(cell);
3160
+ const validStatus = this._dataValidationModel.validator(rule, pos, cell), validator = this._dataValidatorRegistryService.getValidatorItem(rule.type), cellValue = getCellValueOrigin(cell);
3115
3161
  let extra = {};
3116
3162
  if ((rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) && (extra = {
3117
3163
  interceptorStyle: {
@@ -3163,7 +3209,7 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3163
3209
  ...extra.interceptorStyle
3164
3210
  },
3165
3211
  get interceptorAutoHeight() {
3166
- var _a24, _b2, _c2, _d2;
3212
+ var _a23, _b2, _c2, _d2;
3167
3213
  const mergeCell = skeleton.mergeData.find((range) => {
3168
3214
  const { startColumn, startRow, endColumn, endRow } = range;
3169
3215
  return row >= startRow && col >= startColumn && row <= endRow && col <= endColumn;
@@ -3178,7 +3224,7 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3178
3224
  }
3179
3225
  },
3180
3226
  style: skeleton.getsStyles().getStyleByCell(cell),
3181
- primaryWithCoord: skeleton.getCellByIndex((_a24 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a24 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
3227
+ primaryWithCoord: skeleton.getCellByIndex((_a23 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a23 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
3182
3228
  unitId,
3183
3229
  subUnitId,
3184
3230
  row,
@@ -3204,8 +3250,8 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3204
3250
  ).subscribe((infos) => {
3205
3251
  const ranges = [];
3206
3252
  if (infos.forEach((info) => {
3207
- var _a23;
3208
- (_a23 = info.rule) != null && _a23.ranges && ranges.push(...info.rule.ranges);
3253
+ var _a22;
3254
+ (_a22 = info.rule) != null && _a22.ranges && ranges.push(...info.rule.ranges);
3209
3255
  }), ranges.length) {
3210
3256
  const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
3211
3257
  sequenceExecute(mutations.redos, this._commandService);
@@ -3213,20 +3259,20 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
3213
3259
  });
3214
3260
  }
3215
3261
  }, __name(_a8, "SheetsDataValidationRenderController"), _a8);
3216
- SheetsDataValidationRenderController = __decorateClass$d([
3262
+ SheetsDataValidationRenderController = __decorateClass$c([
3217
3263
  OnLifecycle(LifecycleStages.Rendered, SheetsDataValidationRenderController),
3218
- __decorateParam$d(1, ICommandService),
3219
- __decorateParam$d(2, IMenuService),
3220
- __decorateParam$d(3, IRenderManagerService),
3221
- __decorateParam$d(4, IUniverInstanceService),
3222
- __decorateParam$d(5, Inject(AutoHeightController)),
3223
- __decorateParam$d(6, Inject(ComponentManager)),
3224
- __decorateParam$d(7, Inject(DataValidationDropdownManagerService)),
3225
- __decorateParam$d(8, Inject(DataValidationModel)),
3226
- __decorateParam$d(9, Inject(DataValidatorRegistryService)),
3227
- __decorateParam$d(10, Inject(Injector)),
3228
- __decorateParam$d(11, Inject(SheetInterceptorService)),
3229
- __decorateParam$d(12, Optional(IEditorBridgeService))
3264
+ __decorateParam$c(1, ICommandService),
3265
+ __decorateParam$c(2, IMenuService),
3266
+ __decorateParam$c(3, IRenderManagerService),
3267
+ __decorateParam$c(4, IUniverInstanceService),
3268
+ __decorateParam$c(5, Inject(AutoHeightController)),
3269
+ __decorateParam$c(6, Inject(ComponentManager)),
3270
+ __decorateParam$c(7, Inject(DataValidationDropdownManagerService)),
3271
+ __decorateParam$c(8, Inject(DataValidationModel)),
3272
+ __decorateParam$c(9, Inject(DataValidatorRegistryService)),
3273
+ __decorateParam$c(10, Inject(Injector)),
3274
+ __decorateParam$c(11, Inject(SheetInterceptorService)),
3275
+ __decorateParam$c(12, Optional(IEditorBridgeService))
3230
3276
  ], SheetsDataValidationRenderController);
3231
3277
  var _a9;
3232
3278
  let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposable {
@@ -3235,10 +3281,10 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3235
3281
  }
3236
3282
  _initSkeletonChange() {
3237
3283
  const markSkeletonDirty = /* @__PURE__ */ __name(() => {
3238
- var _a23, _b, _c;
3284
+ var _a22, _b, _c;
3239
3285
  const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
3240
3286
  if (!workbook) return;
3241
- const unitId = workbook.getUnitId(), subUnitId = (_a23 = workbook.getActiveSheet()) == null ? void 0 : _a23.getSheetId();
3287
+ const unitId = workbook.getUnitId(), subUnitId = (_a22 = workbook.getActiveSheet()) == null ? void 0 : _a22.getSheetId();
3242
3288
  if (!subUnitId) return;
3243
3289
  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);
3244
3290
  skeleton == null || skeleton.makeDirty(!0), skeleton == null || skeleton.calculate(), currentRender && currentRender.mainComponent.makeForceDirty();
@@ -3251,14 +3297,14 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3251
3297
  this._sheetInterceptorService.intercept(
3252
3298
  INTERCEPTOR_POINT.CELL_CONTENT,
3253
3299
  {
3254
- priority: 200,
3255
- // eslint-disable-next-line max-lines-per-function
3300
+ priority: InterceptCellContentPriority.DATA_VALIDATION,
3301
+ // eslint-disable-next-line max-lines-per-function, complexity
3256
3302
  handler: /* @__PURE__ */ __name((cell, pos, next) => {
3257
- var _a23, _b, _c, _d, _e;
3303
+ var _a22, _b, _c, _d, _e;
3258
3304
  const { row, col, unitId, subUnitId, workbook, worksheet } = pos, manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
3259
3305
  if (!manager)
3260
3306
  return next(cell);
3261
- const skeleton = (_b = (_a23 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a23.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
3307
+ const skeleton = (_b = (_a22 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a22.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
3262
3308
  if (!skeleton)
3263
3309
  return next(cell);
3264
3310
  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);
@@ -3267,7 +3313,7 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3267
3313
  const rule = manager.getRuleById(ruleId);
3268
3314
  if (!rule)
3269
3315
  return next(cell);
3270
- const cellRaw = pos.worksheet.getCellRaw(pos.row, pos.col), validStatus = this._dataValidationModel.validator(getCellValueOrigin(cellRaw), rule, pos), validator = this._dataValidatorRegistryService.getValidatorItem(rule.type), cellValue = getCellValueOrigin(cell);
3316
+ const validStatus = this._dataValidationModel.validator(rule, pos, cell), validator = this._dataValidatorRegistryService.getValidatorItem(rule.type), cellValue = getCellValueOrigin(cell);
3271
3317
  let extra = {};
3272
3318
  if ((rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) && (extra = {
3273
3319
  interceptorStyle: {
@@ -3319,7 +3365,7 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3319
3365
  ...extra.interceptorStyle
3320
3366
  },
3321
3367
  get interceptorAutoHeight() {
3322
- var _a24, _b2, _c2, _d2;
3368
+ var _a23, _b2, _c2, _d2;
3323
3369
  const mergeCell = skeleton.mergeData.find((range) => {
3324
3370
  const { startColumn, startRow, endColumn, endRow } = range;
3325
3371
  return row >= startRow && col >= startColumn && row <= endRow && col <= endColumn;
@@ -3334,7 +3380,7 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3334
3380
  }
3335
3381
  },
3336
3382
  style: skeleton.getsStyles().getStyleByCell(cell),
3337
- primaryWithCoord: skeleton.getCellByIndex((_a24 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a24 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
3383
+ primaryWithCoord: skeleton.getCellByIndex((_a23 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a23 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
3338
3384
  unitId,
3339
3385
  subUnitId,
3340
3386
  row,
@@ -3357,8 +3403,8 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3357
3403
  ).subscribe((infos) => {
3358
3404
  const ranges = [];
3359
3405
  if (infos.forEach((info) => {
3360
- var _a23;
3361
- (_a23 = info.rule) != null && _a23.ranges && ranges.push(...info.rule.ranges);
3406
+ var _a22;
3407
+ (_a22 = info.rule) != null && _a22.ranges && ranges.push(...info.rule.ranges);
3362
3408
  }), ranges.length) {
3363
3409
  const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
3364
3410
  sequenceExecute(mutations.redos, this._commandService);
@@ -3366,62 +3412,28 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
3366
3412
  });
3367
3413
  }
3368
3414
  }, __name(_a9, "SheetsDataValidationMobileRenderController"), _a9);
3369
- SheetsDataValidationMobileRenderController = __decorateClass$d([
3415
+ SheetsDataValidationMobileRenderController = __decorateClass$c([
3370
3416
  OnLifecycle(LifecycleStages.Rendered, SheetsDataValidationMobileRenderController),
3371
- __decorateParam$d(1, ICommandService),
3372
- __decorateParam$d(2, IRenderManagerService),
3373
- __decorateParam$d(3, IUniverInstanceService),
3374
- __decorateParam$d(4, Inject(AutoHeightController)),
3375
- __decorateParam$d(5, Inject(DataValidationModel)),
3376
- __decorateParam$d(6, Inject(DataValidatorRegistryService)),
3377
- __decorateParam$d(7, Inject(SheetInterceptorService))
3417
+ __decorateParam$c(1, ICommandService),
3418
+ __decorateParam$c(2, IRenderManagerService),
3419
+ __decorateParam$c(3, IUniverInstanceService),
3420
+ __decorateParam$c(4, Inject(AutoHeightController)),
3421
+ __decorateParam$c(5, Inject(DataValidationModel)),
3422
+ __decorateParam$c(6, Inject(DataValidatorRegistryService)),
3423
+ __decorateParam$c(7, Inject(SheetInterceptorService))
3378
3424
  ], SheetsDataValidationMobileRenderController);
3379
- var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPropertyDescriptor, __decorateClass$c = /* @__PURE__ */ __name((decorators, target, key, kind) => {
3380
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3381
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
3382
- return kind && result && __defProp$c(target, key, result), result;
3383
- }, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$c"), _a10;
3384
- let SheetDataValidationService = (_a10 = class extends Disposable {
3385
- constructor(_dataValidationModel) {
3386
- super();
3387
- __publicField(this, "_currentManager");
3388
- __publicField(this, "_currentManager$", new Subject());
3389
- __publicField(this, "currentManager$", this._currentManager$.asObservable());
3390
- this._dataValidationModel = _dataValidationModel, this.disposeWithMe(() => {
3391
- this._currentManager$.complete();
3392
- });
3393
- }
3394
- get currentManager() {
3395
- return this._currentManager;
3396
- }
3397
- _ensureManager(unitId, subUnitId) {
3398
- return this._dataValidationModel.ensureManager(unitId, subUnitId);
3399
- }
3400
- switchCurrent(unitId, subUnitId) {
3401
- var _a23, _b;
3402
- if (unitId === ((_a23 = this.currentManager) == null ? void 0 : _a23.unitId) && subUnitId === ((_b = this._currentManager) == null ? void 0 : _b.subUnitId))
3403
- return;
3404
- const manager = this._ensureManager(unitId, subUnitId);
3405
- this._currentManager = {
3406
- manager,
3407
- unitId,
3408
- subUnitId
3409
- }, this._currentManager$.next(this._currentManager);
3410
- }
3411
- get(unitId, subUnitId) {
3412
- return this._ensureManager(unitId, subUnitId);
3413
- }
3414
- }, __name(_a10, "SheetDataValidationService"), _a10);
3415
- SheetDataValidationService = __decorateClass$c([
3416
- __decorateParam$c(0, Inject(DataValidationModel))
3417
- ], SheetDataValidationService);
3418
3425
  var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPropertyDescriptor, __decorateClass$b = /* @__PURE__ */ __name((decorators, target, key, kind) => {
3419
3426
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3420
3427
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
3421
3428
  return kind && result && __defProp$b(target, key, result), result;
3422
- }, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"), _a11;
3423
- let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3424
- constructor(_instanceSrv, _registerOtherFormulaService, _lexerTreeBuilder, _dataValidationModel, _dataValidationCacheService) {
3429
+ }, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b");
3430
+ function transformFormula(lexerTreeBuilder, formula, originRow, originCol, targetRow, targetCol) {
3431
+ return lexerTreeBuilder.moveFormulaRefOffset(formula, targetCol - originCol, targetRow - originRow);
3432
+ }
3433
+ __name(transformFormula, "transformFormula");
3434
+ var _a10;
3435
+ let DataValidationCustomFormulaService = (_a10 = class extends Disposable {
3436
+ constructor(_instanceSrv, _registerOtherFormulaService, _lexerTreeBuilder, _dataValidationModel, _dataValidationCacheService, _logService) {
3425
3437
  super();
3426
3438
  __publicField(this, "_formulaMap", /* @__PURE__ */ new Map());
3427
3439
  /**
@@ -3432,7 +3444,7 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3432
3444
  * reflect of formulaId to cell, only store transformable formula
3433
3445
  */
3434
3446
  __publicField(this, "_formulaCellMap", /* @__PURE__ */ new Map());
3435
- this._instanceSrv = _instanceSrv, this._registerOtherFormulaService = _registerOtherFormulaService, this._lexerTreeBuilder = _lexerTreeBuilder, this._dataValidationModel = _dataValidationModel, this._dataValidationCacheService = _dataValidationCacheService, this._initFormulaResultHandler();
3447
+ this._instanceSrv = _instanceSrv, this._registerOtherFormulaService = _registerOtherFormulaService, this._lexerTreeBuilder = _lexerTreeBuilder, this._dataValidationModel = _dataValidationModel, this._dataValidationCacheService = _dataValidationCacheService, this._logService = _logService, this._initFormulaResultHandler();
3436
3448
  }
3437
3449
  _initFormulaResultHandler() {
3438
3450
  this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((resultMap) => {
@@ -3442,8 +3454,8 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3442
3454
  for (const subUnitId in unitMap) {
3443
3455
  const results = unitMap[subUnitId], { formulaCellMap, ruleFormulaMap } = this._ensureMaps(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
3444
3456
  results.forEach((result) => {
3445
- var _a23, _b;
3446
- 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);
3457
+ var _a22, _b;
3458
+ 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);
3447
3459
  rule && ruleInfo && !ruleInfo.isTransformable && this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges), cellInfo && this._dataValidationCacheService.markCellDirty(unitId, subUnitId, cellInfo.row, cellInfo.column);
3448
3460
  });
3449
3461
  }
@@ -3479,12 +3491,9 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3479
3491
  const { formulaMap, ruleFormulaMap, formulaCellMap } = this._ensureMaps(unitId, subUnitId);
3480
3492
  if (!formula)
3481
3493
  return;
3482
- const isTransformable = isFormulaTransformable(
3483
- this._lexerTreeBuilder,
3484
- formula
3485
- ), originRow = ranges[0].startRow, originCol = ranges[0].startColumn;
3494
+ const originRow = ranges[0].startRow, originCol = ranges[0].startColumn;
3486
3495
  let originFormulaId;
3487
- isTransformable ? ranges.forEach((range) => {
3496
+ ranges.forEach((range) => {
3488
3497
  Range.foreach(range, (row, column) => {
3489
3498
  const relativeFormula = transformFormula(
3490
3499
  this._lexerTreeBuilder,
@@ -3500,20 +3509,12 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3500
3509
  ruleId
3501
3510
  }), formulaCellMap.set(formulaId, { row, column });
3502
3511
  });
3503
- }) : (originFormulaId = this._registerFormula(unitId, subUnitId, ruleId, formula), ranges.forEach((range) => {
3504
- Range.foreach(range, (row, col) => {
3505
- formulaMap.setValue(row, col, {
3506
- formulaId: originFormulaId,
3507
- // formulaText: formula,
3508
- ruleId
3509
- });
3510
- });
3511
- })), ruleFormulaMap.set(ruleId, {
3512
+ }), ruleFormulaMap.set(ruleId, {
3512
3513
  formula,
3513
3514
  originCol,
3514
3515
  originRow,
3515
- isTransformable,
3516
- formulaId: originFormulaId
3516
+ formulaId: originFormulaId,
3517
+ isTransformable: !0
3517
3518
  });
3518
3519
  }
3519
3520
  addRule(unitId, subUnitId, rule) {
@@ -3532,14 +3533,13 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3532
3533
  });
3533
3534
  }), newRanges.forEach((range) => {
3534
3535
  Range.foreach(range, (row, col) => {
3535
- var _a23;
3536
- const oldValue = (_a23 = formulaMap.getValue(row, col)) != null ? _a23 : {};
3536
+ var _a22;
3537
+ const oldValue = (_a22 = formulaMap.getValue(row, col)) != null ? _a22 : {};
3537
3538
  if (oldValue.ruleId !== ruleId) {
3538
3539
  const oldRuleFormula = ruleFormulaMap.get(oldValue.ruleId);
3539
3540
  if (oldRuleFormula != null && oldRuleFormula.isTransformable && deleteFormulaIdList.add(oldValue.formulaId), isTransformable) {
3540
3541
  const relativeText = transformFormula(this._lexerTreeBuilder, formula, originRow, originCol, row, col), formulaId2 = this._registerFormula(unitId, subUnitId, ruleId, relativeText);
3541
3542
  formulaMap.setValue(row, col, {
3542
- // formulaText: relativeText,
3543
3543
  ruleId,
3544
3544
  formulaId: formulaId2
3545
3545
  }), formulaCellMap.set(formulaId2, { row, column: col });
@@ -3573,14 +3573,19 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
3573
3573
  const { ruleFormulaMap } = this._ensureMaps(unitId, subUnitId);
3574
3574
  return ruleFormulaMap.get(ruleId);
3575
3575
  }
3576
- }, __name(_a11, "DataValidationCustomFormulaService"), _a11);
3576
+ }, __name(_a10, "DataValidationCustomFormulaService"), _a10);
3577
3577
  DataValidationCustomFormulaService = __decorateClass$b([
3578
3578
  __decorateParam$b(0, IUniverInstanceService),
3579
3579
  __decorateParam$b(1, Inject(RegisterOtherFormulaService)),
3580
3580
  __decorateParam$b(2, Inject(LexerTreeBuilder)),
3581
3581
  __decorateParam$b(3, Inject(DataValidationModel)),
3582
- __decorateParam$b(4, Inject(DataValidationCacheService))
3582
+ __decorateParam$b(4, Inject(DataValidationCacheService)),
3583
+ __decorateParam$b(5, ILogService)
3583
3584
  ], DataValidationCustomFormulaService);
3585
+ function isLegalFormulaResult(res) {
3586
+ return !ERROR_TYPE_SET.has(res);
3587
+ }
3588
+ __name(isLegalFormulaResult, "isLegalFormulaResult");
3584
3589
  const _CustomFormulaValidator = class _CustomFormulaValidator extends BaseDataValidator {
3585
3590
  constructor() {
3586
3591
  super(...arguments);
@@ -3605,8 +3610,8 @@ const _CustomFormulaValidator = class _CustomFormulaValidator extends BaseDataVa
3605
3610
  };
3606
3611
  }
3607
3612
  async isValidType(cellInfo, _formula, _rule) {
3608
- const { column, row, unitId, subUnitId } = cellInfo, result = await this._customFormulaService.getCellFormulaValue(unitId, subUnitId, row, column);
3609
- return !!getFormulaResult(result == null ? void 0 : result.result);
3613
+ const { column, row, unitId, subUnitId } = cellInfo, result = await this._customFormulaService.getCellFormulaValue(unitId, subUnitId, row, column), cellData = getFormulaCellData(result == null ? void 0 : result.result), formulaResult = cellData == null ? void 0 : cellData.v;
3614
+ return Tools.isDefine(formulaResult) && formulaResult !== "" ? cellData.t === CellValueType.BOOLEAN ? !!formulaResult : typeof formulaResult == "boolean" ? formulaResult : typeof formulaResult == "number" ? !!formulaResult : typeof formulaResult == "string" ? isLegalFormulaResult(formulaResult) : !!formulaResult : !1;
3610
3615
  }
3611
3616
  generateRuleErrorMessage(rule) {
3612
3617
  return this.localeService.t("dataValidation.custom.error");
@@ -3652,10 +3657,10 @@ const _WholeValidator = class _WholeValidator extends BaseDataValidator {
3652
3657
  return formula == null ? Number.NaN : +formula;
3653
3658
  }
3654
3659
  async parseFormula(rule, unitId, subUnitId) {
3655
- var _a23, _b, _c, _d, _e, _f, _g, _h;
3660
+ var _a22, _b, _c, _d, _e, _f, _g, _h;
3656
3661
  const formulaInfo = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
3657
3662
  return {
3658
- 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),
3663
+ 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),
3659
3664
  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)
3660
3665
  };
3661
3666
  }
@@ -3778,8 +3783,8 @@ var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPrope
3778
3783
  return kind && result && __defProp$a(target, key, result), result;
3779
3784
  }, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a");
3780
3785
  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");
3781
- var _a12;
3782
- let DropdownMultipleWidget = (_a12 = class {
3786
+ var _a11;
3787
+ let DropdownMultipleWidget = (_a11 = class {
3783
3788
  constructor(_commandService) {
3784
3789
  __publicField(this, "zIndex");
3785
3790
  __publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
@@ -3807,7 +3812,7 @@ let DropdownMultipleWidget = (_a12 = class {
3807
3812
  }
3808
3813
  // eslint-disable-next-line max-lines-per-function
3809
3814
  drawWith(ctx, info, skeleton, spreadsheets) {
3810
- var _a23, _b;
3815
+ var _a22, _b;
3811
3816
  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);
3812
3817
  if (!validation)
3813
3818
  return;
@@ -3816,7 +3821,7 @@ let DropdownMultipleWidget = (_a12 = class {
3816
3821
  endX: _cellBounding.endX - rightOffset,
3817
3822
  startY: _cellBounding.startY + topOffset,
3818
3823
  endY: _cellBounding.endY - downOffset
3819
- }, 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);
3824
+ }, 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);
3820
3825
  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);
3821
3826
  let top = 0;
3822
3827
  switch (vt) {
@@ -3855,7 +3860,7 @@ let DropdownMultipleWidget = (_a12 = class {
3855
3860
  });
3856
3861
  }
3857
3862
  calcCellAutoHeight(info) {
3858
- var _a23;
3863
+ var _a22;
3859
3864
  const { primaryWithCoord, style, data } = info, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, cellBounding = {
3860
3865
  startX: _cellBounding.startX + leftOffset,
3861
3866
  endX: _cellBounding.endX - rightOffset,
@@ -3864,7 +3869,7 @@ let DropdownMultipleWidget = (_a12 = class {
3864
3869
  }, validation = data.dataValidation;
3865
3870
  if (!validation)
3866
3871
  return;
3867
- 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);
3872
+ 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);
3868
3873
  return layoutDropdowns(items, fontStyle, cellWidth, cellHeight).cellAutoHeight;
3869
3874
  }
3870
3875
  isHit(position, info) {
@@ -3882,7 +3887,7 @@ let DropdownMultipleWidget = (_a12 = class {
3882
3887
  };
3883
3888
  this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
3884
3889
  }
3885
- }, __name(_a12, "DropdownMultipleWidget"), _a12);
3890
+ }, __name(_a11, "DropdownMultipleWidget"), _a11);
3886
3891
  DropdownMultipleWidget = __decorateClass$a([
3887
3892
  __decorateParam$a(0, ICommandService)
3888
3893
  ], DropdownMultipleWidget);
@@ -3903,13 +3908,13 @@ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPrope
3903
3908
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
3904
3909
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
3905
3910
  return kind && result && __defProp$9(target, key, result), result;
3906
- }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a13;
3907
- let DataValidationController = (_a13 = class extends RxDisposable {
3908
- constructor(_univerInstanceService, _sheetDataValidationService, _dataValidatorRegistryService, _injector, _componentManger, _selectionManagerService, _sheetInterceptorService, _dataValidationModel) {
3909
- 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();
3911
+ }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a12;
3912
+ let DataValidationController = (_a12 = class extends RxDisposable {
3913
+ constructor(_univerInstanceService, _dataValidatorRegistryService, _injector, _componentManger, _selectionManagerService, _sheetInterceptorService, _dataValidationModel) {
3914
+ super(), this._univerInstanceService = _univerInstanceService, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._injector = _injector, this._componentManger = _componentManger, this._selectionManagerService = _selectionManagerService, this._sheetInterceptorService = _sheetInterceptorService, this._dataValidationModel = _dataValidationModel, this._init();
3910
3915
  }
3911
3916
  _init() {
3912
- this._registerValidators(), this._initInstanceChange(), this._initCommandInterceptor(), this._initComponents();
3917
+ this._registerValidators(), this._initCommandInterceptor(), this._initComponents();
3913
3918
  }
3914
3919
  _registerValidators() {
3915
3920
  [
@@ -3932,31 +3937,15 @@ let DataValidationController = (_a13 = class extends RxDisposable {
3932
3937
  });
3933
3938
  });
3934
3939
  }
3935
- _initInstanceChange() {
3936
- const disposableCollection = new DisposableCollection();
3937
- this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {
3938
- if (disposableCollection.dispose(), !workbook)
3939
- return;
3940
- const worksheet = workbook.getActiveSheet();
3941
- worksheet && (this._sheetDataValidationService.switchCurrent(workbook.getUnitId(), worksheet.getSheetId()), disposableCollection.add(toDisposable(
3942
- workbook.activeSheet$.subscribe((worksheet2) => {
3943
- if (worksheet2) {
3944
- const unitId = workbook.getUnitId(), subUnitId = worksheet2.getSheetId();
3945
- this._sheetDataValidationService.switchCurrent(unitId, subUnitId);
3946
- }
3947
- })
3948
- )));
3949
- })), this.disposeWithMe(disposableCollection);
3950
- }
3951
3940
  _initCommandInterceptor() {
3952
3941
  this._sheetInterceptorService.interceptCommand({
3953
3942
  getMutations: /* @__PURE__ */ __name((commandInfo) => {
3954
- var _a23;
3943
+ var _a22;
3955
3944
  if (commandInfo.id === ClearSelectionAllCommand.id) {
3956
3945
  const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), unitId = workbook.getUnitId(), worksheet = workbook.getActiveSheet();
3957
3946
  if (!worksheet)
3958
3947
  throw new Error("No active sheet found");
3959
- 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();
3948
+ 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();
3960
3949
  selections && ruleMatrix.removeRange(selections);
3961
3950
  const diffs = ruleMatrix.diff(manager.getDataValidations()), { redoMutations, undoMutations } = getDataValidationDiffMutations(unitId, subUnitId, diffs, this._injector, "patched");
3962
3951
  return {
@@ -3988,17 +3977,16 @@ let DataValidationController = (_a13 = class extends RxDisposable {
3988
3977
  ));
3989
3978
  });
3990
3979
  }
3991
- }, __name(_a13, "DataValidationController"), _a13);
3980
+ }, __name(_a12, "DataValidationController"), _a12);
3992
3981
  DataValidationController = __decorateClass$9([
3993
3982
  OnLifecycle(LifecycleStages.Rendered, DataValidationController),
3994
3983
  __decorateParam$9(0, IUniverInstanceService),
3995
- __decorateParam$9(1, Inject(SheetDataValidationService)),
3996
- __decorateParam$9(2, Inject(DataValidatorRegistryService)),
3997
- __decorateParam$9(3, Inject(Injector)),
3998
- __decorateParam$9(4, Inject(ComponentManager)),
3999
- __decorateParam$9(5, Inject(SheetsSelectionsService)),
4000
- __decorateParam$9(6, Inject(SheetInterceptorService)),
4001
- __decorateParam$9(7, Inject(DataValidationModel))
3984
+ __decorateParam$9(1, Inject(DataValidatorRegistryService)),
3985
+ __decorateParam$9(2, Inject(Injector)),
3986
+ __decorateParam$9(3, Inject(ComponentManager)),
3987
+ __decorateParam$9(4, Inject(SheetsSelectionsService)),
3988
+ __decorateParam$9(5, Inject(SheetInterceptorService)),
3989
+ __decorateParam$9(6, Inject(DataValidationModel))
4002
3990
  ], DataValidationController);
4003
3991
  var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
4004
3992
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
@@ -4006,8 +3994,8 @@ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPrope
4006
3994
  return kind && result && __defProp$8(target, key, result), result;
4007
3995
  }, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8");
4008
3996
  const ALERT_KEY = "SHEET_DATA_VALIDATION_ALERT";
4009
- var _a14;
4010
- let DataValidationAlertController = (_a14 = class extends Disposable {
3997
+ var _a13;
3998
+ let DataValidationAlertController = (_a13 = class extends Disposable {
4011
3999
  constructor(_hoverManagerService, _cellAlertManagerService, _univerInstanceService, _localeService) {
4012
4000
  super(), this._hoverManagerService = _hoverManagerService, this._cellAlertManagerService = _cellAlertManagerService, this._univerInstanceService = _univerInstanceService, this._localeService = _localeService, this._init();
4013
4001
  }
@@ -4016,12 +4004,12 @@ let DataValidationAlertController = (_a14 = class extends Disposable {
4016
4004
  }
4017
4005
  _initCellAlertPopup() {
4018
4006
  this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(debounceTime(100)).subscribe((cellPos) => {
4019
- var _a23, _b;
4007
+ var _a22, _b;
4020
4008
  if (cellPos) {
4021
4009
  const worksheet = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
4022
4010
  if (!worksheet) return;
4023
4011
  const cellData = worksheet.getCell(cellPos.location.row, cellPos.location.col);
4024
- if (((_a23 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a23.validStatus) === DataValidationStatus.INVALID) {
4012
+ if (((_a22 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a22.validStatus) === DataValidationStatus.INVALID) {
4025
4013
  const currentAlert = this._cellAlertManagerService.currentAlert.get(ALERT_KEY), currentLoc = (_b = currentAlert == null ? void 0 : currentAlert.alert) == null ? void 0 : _b.location;
4026
4014
  if (currentLoc && currentLoc.row === cellPos.location.row && currentLoc.col === cellPos.location.col && currentLoc.subUnitId === cellPos.location.subUnitId && currentLoc.unitId === cellPos.location.unitId)
4027
4015
  return;
@@ -4043,7 +4031,7 @@ let DataValidationAlertController = (_a14 = class extends Disposable {
4043
4031
  this._cellAlertManagerService.removeAlert(ALERT_KEY);
4044
4032
  }));
4045
4033
  }
4046
- }, __name(_a14, "DataValidationAlertController"), _a14);
4034
+ }, __name(_a13, "DataValidationAlertController"), _a13);
4047
4035
  DataValidationAlertController = __decorateClass$8([
4048
4036
  OnLifecycle(LifecycleStages.Rendered, DataValidationAlertController),
4049
4037
  __decorateParam$8(0, Inject(HoverManagerService)),
@@ -4055,8 +4043,8 @@ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPrope
4055
4043
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4056
4044
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4057
4045
  return kind && result && __defProp$7(target, key, result), result;
4058
- }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a15;
4059
- let DataValidationRefRangeController = (_a15 = class extends Disposable {
4046
+ }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a14;
4047
+ let DataValidationRefRangeController = (_a14 = class extends Disposable {
4060
4048
  constructor(_dataValidationModel, _injector, _refRangeService, _dataValidationCustomFormulaService, _dataValidationFormulaService, _formulaRefRangeService) {
4061
4049
  super();
4062
4050
  __publicField(this, "_disposableMap", /* @__PURE__ */ new Map());
@@ -4070,8 +4058,8 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
4070
4058
  }
4071
4059
  // eslint-disable-next-line max-lines-per-function
4072
4060
  registerFormula(unitId, subUnitId, rule) {
4073
- var _a23;
4074
- 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) => {
4061
+ var _a22;
4062
+ 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) => {
4075
4063
  const oldRule = this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
4076
4064
  if (!oldRule)
4077
4065
  return { redos: [], undos: [] };
@@ -4148,7 +4136,7 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
4148
4136
  }
4149
4137
  }
4150
4138
  register(unitId, subUnitId, rule) {
4151
- var _a23;
4139
+ var _a22;
4152
4140
  const handleRangeChange = /* @__PURE__ */ __name((commandInfo) => {
4153
4141
  const oldRanges = [...rule.ranges], resultRanges = oldRanges.map((range) => handleCommonDefaultRangeChangeWithEffectRefCommands(range, commandInfo)).filter((range) => !!range).flat();
4154
4142
  if (isRangesEqual(resultRanges, oldRanges))
@@ -4186,7 +4174,7 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
4186
4174
  const disposable = this._refRangeService.registerRefRange(range, handleRangeChange, unitId, subUnitId);
4187
4175
  disposeList.push(() => disposable.dispose());
4188
4176
  });
4189
- const id = this._getIdWithUnitId(unitId, subUnitId, rule.uid), current = (_a23 = this._disposableMap.get(id)) != null ? _a23 : /* @__PURE__ */ new Set();
4177
+ const id = this._getIdWithUnitId(unitId, subUnitId, rule.uid), current = (_a22 = this._disposableMap.get(id)) != null ? _a22 : /* @__PURE__ */ new Set();
4190
4178
  current.add(() => disposeList.forEach((dispose) => dispose())), this._disposableMap.set(id, current);
4191
4179
  }
4192
4180
  _initRefRange() {
@@ -4217,7 +4205,7 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
4217
4205
  }), this._disposableMap.clear();
4218
4206
  }));
4219
4207
  }
4220
- }, __name(_a15, "DataValidationRefRangeController"), _a15);
4208
+ }, __name(_a14, "DataValidationRefRangeController"), _a14);
4221
4209
  DataValidationRefRangeController = __decorateClass$7([
4222
4210
  OnLifecycle(LifecycleStages.Starting, DataValidationRefRangeController),
4223
4211
  __decorateParam$7(0, Inject(DataValidationModel)),
@@ -4231,8 +4219,8 @@ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPrope
4231
4219
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4232
4220
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4233
4221
  return kind && result && __defProp$6(target, key, result), result;
4234
- }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a16;
4235
- let DataValidationAutoFillController = (_a16 = class extends Disposable {
4222
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a15;
4223
+ let DataValidationAutoFillController = (_a15 = class extends Disposable {
4236
4224
  constructor(_autoFillService, _dataValidationModel, _injector) {
4237
4225
  super(), this._autoFillService = _autoFillService, this._dataValidationModel = _dataValidationModel, this._injector = _injector, this._initAutoFill();
4238
4226
  }
@@ -4305,7 +4293,7 @@ let DataValidationAutoFillController = (_a16 = class extends Disposable {
4305
4293
  };
4306
4294
  this.disposeWithMe(this._autoFillService.addHook(hook));
4307
4295
  }
4308
- }, __name(_a16, "DataValidationAutoFillController"), _a16);
4296
+ }, __name(_a15, "DataValidationAutoFillController"), _a15);
4309
4297
  DataValidationAutoFillController = __decorateClass$6([
4310
4298
  OnLifecycle(LifecycleStages.Ready, DataValidationAutoFillController),
4311
4299
  __decorateParam$6(0, IAutoFillService),
@@ -4316,8 +4304,8 @@ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPrope
4316
4304
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4317
4305
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4318
4306
  return kind && result && __defProp$5(target, key, result), result;
4319
- }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a17;
4320
- let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4307
+ }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a16;
4308
+ let DataValidationCopyPasteController = (_a16 = class extends Disposable {
4321
4309
  constructor(_sheetClipboardService, _dataValidationModel, _injector) {
4322
4310
  super();
4323
4311
  __publicField(this, "_copyInfo");
@@ -4340,9 +4328,7 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4340
4328
  subUnitId,
4341
4329
  matrix
4342
4330
  };
4343
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), accessor = {
4344
- get: this._injector.get.bind(this._injector)
4345
- }, discreteRange = rangeToDiscreteRange(range, accessor, unitId, subUnitId);
4331
+ const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), discreteRange = this._injector.invoke((accessor) => rangeToDiscreteRange(range, accessor, unitId, subUnitId));
4346
4332
  if (!discreteRange)
4347
4333
  return;
4348
4334
  const { rows, cols } = discreteRange;
@@ -4374,8 +4360,8 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4374
4360
  if (copyInfo.unitId !== unitId || subUnitId !== copyInfo.subUnitId) {
4375
4361
  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();
4376
4362
  repeatRange.forEach(({ startRange }) => {
4377
- var _a23;
4378
- (_a23 = this._copyInfo) == null || _a23.matrix.forValue((row, col, ruleId) => {
4363
+ var _a22;
4364
+ (_a22 = this._copyInfo) == null || _a22.matrix.forValue((row, col, ruleId) => {
4379
4365
  const range = Rectangle.getPositionRange(
4380
4366
  {
4381
4367
  startRow: row,
@@ -4404,8 +4390,8 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4404
4390
  } else {
4405
4391
  const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleMatrix = manager.getRuleObjectMatrix().clone(), { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]);
4406
4392
  getRepeatRange(vCopyRange, vPastedRange, !0).forEach(({ startRange }) => {
4407
- var _a23;
4408
- (_a23 = this._copyInfo) == null || _a23.matrix.forValue((row, col, ruleId) => {
4393
+ var _a22;
4394
+ (_a22 = this._copyInfo) == null || _a22.matrix.forValue((row, col, ruleId) => {
4409
4395
  const range = Rectangle.getPositionRange(
4410
4396
  {
4411
4397
  startRow: row,
@@ -4431,7 +4417,7 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
4431
4417
  };
4432
4418
  }
4433
4419
  }
4434
- }, __name(_a17, "DataValidationCopyPasteController"), _a17);
4420
+ }, __name(_a16, "DataValidationCopyPasteController"), _a16);
4435
4421
  DataValidationCopyPasteController = __decorateClass$5([
4436
4422
  OnLifecycle(LifecycleStages.Ready, DataValidationCopyPasteController),
4437
4423
  __decorateParam$5(0, ISheetClipboardService),
@@ -4556,9 +4542,9 @@ const _SheetDataValidationManager = class _SheetDataValidationManager extends Da
4556
4542
  this._ruleMatrix = new RuleMatrix(matrix, worksheet);
4557
4543
  }
4558
4544
  _addRuleSideEffect(rule) {
4559
- var _a23;
4545
+ var _a22;
4560
4546
  const { unitId, subUnitId } = this;
4561
- (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);
4547
+ (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);
4562
4548
  }
4563
4549
  addRule(rule, index) {
4564
4550
  (Array.isArray(rule) ? rule : [rule]).forEach((item) => {
@@ -4586,20 +4572,35 @@ const _SheetDataValidationManager = class _SheetDataValidationManager extends Da
4586
4572
  if (ruleId)
4587
4573
  return this.getRuleById(ruleId);
4588
4574
  }
4589
- validator(cellValue, rule, pos, onCompete) {
4590
- const { col, row, unitId, subUnitId } = pos, ruleId = rule.uid, validator = this.getValidator(rule.type);
4575
+ validator(cell, rule, pos, onCompete) {
4576
+ const { col, row, unitId, subUnitId, worksheet } = pos, ruleId = rule.uid, validator = this.getValidator(rule.type), cellRaw = worksheet.getCellRaw(row, col), cellValue = getCellValueOrigin(cellRaw), interceptValue = getCellValueOrigin(cell);
4591
4577
  if (validator) {
4592
4578
  const current = this._cache.getValue(row, col);
4593
- return !current || current.value !== cellValue ? (this._cache.setValue(row, col, {
4579
+ return !current || current.value !== cellValue || current.interceptValue !== interceptValue || current.ruleId !== ruleId ? (this._cache.setValue(row, col, {
4594
4580
  value: cellValue,
4581
+ interceptValue,
4595
4582
  status: DataValidationStatus.VALIDATING,
4596
4583
  ruleId
4597
- }), validator.validator({ value: cellValue, unitId, subUnitId, row, column: col }, rule).then((status) => {
4584
+ }), validator.validator(
4585
+ {
4586
+ value: cellValue,
4587
+ unitId,
4588
+ subUnitId,
4589
+ row,
4590
+ column: col,
4591
+ worksheet: pos.worksheet,
4592
+ workbook: pos.workbook,
4593
+ interceptValue: getCellValueOrigin(cell),
4594
+ t: cellRaw == null ? void 0 : cellRaw.t
4595
+ },
4596
+ rule
4597
+ ).then((status) => {
4598
4598
  const realStatus = status ? DataValidationStatus.VALID : DataValidationStatus.INVALID;
4599
4599
  this._cache.setValue(row, col, {
4600
4600
  value: cellValue,
4601
4601
  status: realStatus,
4602
- ruleId
4602
+ ruleId,
4603
+ interceptValue
4603
4604
  }), onCompete(realStatus, !0);
4604
4605
  }), DataValidationStatus.VALIDATING) : (onCompete(current.status, !1), current.status);
4605
4606
  } else
@@ -4622,8 +4623,8 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
4622
4623
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4623
4624
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4624
4625
  return kind && result && __defProp$4(target, key, result), result;
4625
- }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a18;
4626
- let DataValidationModelController = (_a18 = class extends Disposable {
4626
+ }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a17;
4627
+ let DataValidationModelController = (_a17 = class extends Disposable {
4627
4628
  constructor(_resourceManagerService, _univerInstanceService, _dataValidationModel, _injector) {
4628
4629
  super(), this._resourceManagerService = _resourceManagerService, this._univerInstanceService = _univerInstanceService, this._dataValidationModel = _dataValidationModel, this._injector = _injector, this._initDataValidationDataSource();
4629
4630
  }
@@ -4637,7 +4638,7 @@ let DataValidationModelController = (_a18 = class extends Disposable {
4637
4638
  _initDataValidationDataSource() {
4638
4639
  this._dataValidationModel.setManagerCreator(this._createSheetDataValidationManager.bind(this));
4639
4640
  }
4640
- }, __name(_a18, "DataValidationModelController"), _a18);
4641
+ }, __name(_a17, "DataValidationModelController"), _a17);
4641
4642
  DataValidationModelController = __decorateClass$4([
4642
4643
  OnLifecycle(LifecycleStages.Starting, DataValidationModelController),
4643
4644
  __decorateParam$4(0, IResourceManagerService),
@@ -4649,8 +4650,8 @@ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPrope
4649
4650
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4650
4651
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4651
4652
  return kind && result && __defProp$3(target, key, result), result;
4652
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a19;
4653
- let DataValidationPermissionController = (_a19 = class extends Disposable {
4653
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a18;
4654
+ let DataValidationPermissionController = (_a18 = class extends Disposable {
4654
4655
  constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
4655
4656
  super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
4656
4657
  }
@@ -4669,7 +4670,7 @@ let DataValidationPermissionController = (_a19 = class extends Disposable {
4669
4670
  })
4670
4671
  );
4671
4672
  }
4672
- }, __name(_a19, "DataValidationPermissionController"), _a19);
4673
+ }, __name(_a18, "DataValidationPermissionController"), _a18);
4673
4674
  DataValidationPermissionController = __decorateClass$3([
4674
4675
  OnLifecycle(LifecycleStages.Ready, DataValidationPermissionController),
4675
4676
  __decorateParam$3(0, Inject(LocaleService)),
@@ -4680,8 +4681,8 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
4680
4681
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4681
4682
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4682
4683
  return kind && result && __defProp$2(target, key, result), result;
4683
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a20;
4684
- let SheetsDataValidationValidatorService = (_a20 = class {
4684
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a19;
4685
+ let SheetsDataValidationValidatorService = (_a19 = class {
4685
4686
  constructor(_univerInstanceService, _dataValidationModel, _dataValidationCacheService) {
4686
4687
  this._univerInstanceService = _univerInstanceService, this._dataValidationModel = _dataValidationModel, this._dataValidationCacheService = _dataValidationCacheService;
4687
4688
  }
@@ -4692,11 +4693,21 @@ let SheetsDataValidationValidatorService = (_a20 = class {
4692
4693
  const worksheet = workbook.getSheetBySheetId(subUnitId);
4693
4694
  if (!worksheet)
4694
4695
  throw new Error(`cannot find current worksheet, sheetId: ${subUnitId}`);
4695
- const cellRaw = worksheet.getCellRaw(row, col), manager = this._dataValidationModel.ensureManager(unitId, subUnitId), rule = manager.getRuleByLocation(row, col);
4696
+ if (!Tools.isDefine(row) || !Tools.isDefine(col))
4697
+ throw new Error(`row or col is not defined, row: ${row}, col: ${col}`);
4698
+ const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), cell = worksheet.getCell(row, col), rule = manager.getRuleByLocation(row, col);
4696
4699
  return rule ? new Promise((resolve) => {
4697
- manager.validator(getCellValueOrigin(cellRaw), rule, { unitId, subUnitId, row, col }, resolve);
4700
+ manager.validator(cell, rule, { unitId, subUnitId, row, col, worksheet, workbook }, resolve);
4698
4701
  }) : DataValidationStatus.VALID;
4699
4702
  }
4703
+ validatorRanges(unitId, subUnitId, ranges) {
4704
+ return Promise.all(ranges.map((range) => {
4705
+ const promises = [];
4706
+ return Range.foreach(range, (row, col) => {
4707
+ promises.push(this.validatorCell(unitId, subUnitId, row, col));
4708
+ }), promises;
4709
+ }));
4710
+ }
4700
4711
  async validatorWorksheet(unitId, subUnitId) {
4701
4712
  const rules = this._dataValidationModel.ensureManager(unitId, subUnitId).getDataValidations();
4702
4713
  return await Promise.all(rules.map((rule) => Promise.all(rule.ranges.map((range) => {
@@ -4712,7 +4723,19 @@ let SheetsDataValidationValidatorService = (_a20 = class {
4712
4723
  map[sheetIds[i]] = result;
4713
4724
  }), map;
4714
4725
  }
4715
- }, __name(_a20, "SheetsDataValidationValidatorService"), _a20);
4726
+ getDataValidations(unitId, subUnitId, ranges) {
4727
+ const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleMatrix = manager.getRuleObjectMatrix(), ruleIdSet = /* @__PURE__ */ new Set();
4728
+ return ranges.forEach((range) => {
4729
+ Range.foreach(range, (row, col) => {
4730
+ const ruleId = ruleMatrix.getValue(row, col);
4731
+ ruleId && ruleIdSet.add(ruleId);
4732
+ });
4733
+ }), Array.from(ruleIdSet).map((id) => manager.getRuleById(id)).filter(Boolean);
4734
+ }
4735
+ getDataValidation(unitId, subUnitId, ranges) {
4736
+ return this.getDataValidations(unitId, subUnitId, ranges)[0];
4737
+ }
4738
+ }, __name(_a19, "SheetsDataValidationValidatorService"), _a19);
4716
4739
  SheetsDataValidationValidatorService = __decorateClass$2([
4717
4740
  __decorateParam$2(0, IUniverInstanceService),
4718
4741
  __decorateParam$2(1, Inject(DataValidationModel)),
@@ -4722,15 +4745,14 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
4722
4745
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4723
4746
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4724
4747
  return kind && result && __defProp$1(target, key, result), result;
4725
- }, "__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;
4726
- let UniverSheetsDataValidationPlugin = (_a21 = class extends Plugin {
4748
+ }, "__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;
4749
+ let UniverSheetsDataValidationPlugin = (_a20 = class extends Plugin {
4727
4750
  constructor(_config = {}, _injector, _commandService, _localeService) {
4728
4751
  super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._localeService = _localeService, this._config = Tools.deepMerge({}, DefaultSheetsDataValidation, this._config);
4729
4752
  }
4730
4753
  onStarting() {
4731
4754
  [
4732
4755
  [DataValidationPanelService],
4733
- [SheetDataValidationService],
4734
4756
  [DataValidationCacheService],
4735
4757
  [DataValidationFormulaService],
4736
4758
  [DataValidationCustomFormulaService],
@@ -4770,7 +4792,7 @@ let UniverSheetsDataValidationPlugin = (_a21 = class extends Plugin {
4770
4792
  this._commandService.registerCommand(command);
4771
4793
  });
4772
4794
  }
4773
- }, __name(_a21, "UniverSheetsDataValidationPlugin"), _a21);
4795
+ }, __name(_a20, "UniverSheetsDataValidationPlugin"), _a20);
4774
4796
  __publicField$1(UniverSheetsDataValidationPlugin, "pluginName", DATA_VALIDATION_PLUGIN_NAME);
4775
4797
  __publicField$1(UniverSheetsDataValidationPlugin, "type", UniverInstanceType.UNIVER_SHEET);
4776
4798
  UniverSheetsDataValidationPlugin = __decorateClass$1([
@@ -4783,15 +4805,14 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
4783
4805
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
4784
4806
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
4785
4807
  return kind && result && __defProp2(target, key, result), result;
4786
- }, "__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;
4787
- let UniverSheetsDataValidationMobilePlugin = (_a22 = class extends Plugin {
4808
+ }, "__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;
4809
+ let UniverSheetsDataValidationMobilePlugin = (_a21 = class extends Plugin {
4788
4810
  constructor(_config = {}, _injector, _commandService, _localeService) {
4789
4811
  super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._localeService = _localeService, this._config = Tools.deepMerge({}, DefaultSheetsDataValidation, this._config);
4790
4812
  }
4791
4813
  onStarting() {
4792
4814
  [
4793
4815
  [DataValidationPanelService],
4794
- [SheetDataValidationService],
4795
4816
  [DataValidationCacheService],
4796
4817
  [DataValidationFormulaService],
4797
4818
  [DataValidationCustomFormulaService],
@@ -4827,7 +4848,7 @@ let UniverSheetsDataValidationMobilePlugin = (_a22 = class extends Plugin {
4827
4848
  this._commandService.registerCommand(command);
4828
4849
  });
4829
4850
  }
4830
- }, __name(_a22, "UniverSheetsDataValidationMobilePlugin"), _a22);
4851
+ }, __name(_a21, "UniverSheetsDataValidationMobilePlugin"), _a21);
4831
4852
  __publicField2(UniverSheetsDataValidationMobilePlugin, "pluginName", DATA_VALIDATION_PLUGIN_NAME);
4832
4853
  __publicField2(UniverSheetsDataValidationMobilePlugin, "type", UniverInstanceType.UNIVER_SHEET);
4833
4854
  UniverSheetsDataValidationMobilePlugin = __decorateClass([
@@ -4839,29 +4860,23 @@ UniverSheetsDataValidationMobilePlugin = __decorateClass([
4839
4860
  export {
4840
4861
  AddSheetDataValidationAndOpenCommand,
4841
4862
  AddSheetDataValidationCommand,
4863
+ ClearRangeDataValidationCommand,
4842
4864
  CloseValidationPanelOperation,
4843
4865
  DATA_VALIDATION_PLUGIN_NAME,
4844
- DataValidationAlertController,
4845
- DataValidationAutoFillController,
4846
4866
  DataValidationCacheService,
4847
- DataValidationController,
4848
- DataValidationCopyPasteController,
4849
4867
  DataValidationCustomFormulaService,
4850
- DataValidationFormulaController,
4851
4868
  DataValidationFormulaService,
4852
- DataValidationRefRangeController,
4853
- DataValidationRejectInputController,
4869
+ DataValidationModel2 as DataValidationModel,
4854
4870
  HideDataValidationDropdown,
4855
- ICommandService2 as ICommandService,
4856
- LocaleService2 as LocaleService,
4857
4871
  OpenValidationPanelOperation,
4858
- Plugin2 as Plugin,
4859
- SheetDataValidationService,
4860
- SheetsDataValidationRenderController,
4872
+ RemoveDataValidationCommand2 as RemoveSheetDataValidationCommand,
4873
+ SheetDataValidationManager,
4861
4874
  SheetsDataValidationValidatorService,
4862
4875
  ShowDataValidationDropdown,
4863
4876
  ToggleValidationPanelOperation,
4864
4877
  UniverSheetsDataValidationMobilePlugin,
4865
4878
  UniverSheetsDataValidationPlugin,
4866
- UpdateSheetDataValidationRangeCommand
4879
+ UpdateSheetDataValidationOptionsCommand,
4880
+ UpdateSheetDataValidationRangeCommand,
4881
+ UpdateSheetDataValidationSettingCommand
4867
4882
  };