@univerjs/sheets-data-validation 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -4
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +392 -394
- package/lib/locale/en-US.json +10 -9
- package/lib/locale/ru-RU.json +2 -1
- package/lib/locale/vi-VN.json +2 -1
- package/lib/locale/zh-CN.json +10 -9
- package/lib/locale/zh-TW.json +2 -1
- package/lib/types/commands/commands/data-validation.command.d.ts +6 -1
- package/lib/types/commands/operations/data-validation.operation.d.ts +0 -1
- package/lib/types/common/date-text-map.d.ts +0 -1
- package/lib/types/controllers/dv-alert.controller.d.ts +0 -1
- package/lib/types/controllers/dv-auto-fill.controller.d.ts +0 -1
- package/lib/types/controllers/dv-copy-paste.controller.d.ts +0 -1
- package/lib/types/controllers/dv-formula.controller.d.ts +0 -1
- package/lib/types/controllers/dv-model.controller.d.ts +0 -1
- package/lib/types/controllers/dv-permission.controller.d.ts +0 -1
- package/lib/types/controllers/dv-ref-range.controller.d.ts +0 -1
- package/lib/types/controllers/dv-reject-input.controller.d.ts +0 -1
- package/lib/types/controllers/dv-render.controller.d.ts +0 -1
- package/lib/types/controllers/dv.controller.d.ts +1 -5
- package/lib/types/controllers/dv.menu.d.ts +0 -1
- package/lib/types/index.d.ts +4 -11
- package/lib/types/locale/en-US.d.ts +0 -1
- package/lib/types/locale/ru-RU.d.ts +0 -1
- package/lib/types/locale/vi-VN.d.ts +0 -1
- package/lib/types/locale/zh-CN.d.ts +1 -0
- package/lib/types/locale/zh-TW.d.ts +0 -1
- package/lib/types/mobile-plugin.d.ts +0 -1
- package/lib/types/models/rule-matrix.d.ts +0 -1
- package/lib/types/models/sheet-data-validation-manager.d.ts +2 -3
- package/lib/types/plugin.d.ts +0 -1
- package/lib/types/services/data-validation-panel.service.d.ts +0 -1
- package/lib/types/services/dropdown-manager.service.d.ts +0 -1
- package/lib/types/services/dv-cache.service.d.ts +0 -1
- package/lib/types/services/dv-custom-formula.service.d.ts +0 -1
- package/lib/types/services/dv-formula.service.d.ts +0 -1
- package/lib/types/services/dv-validator-service.d.ts +4 -2
- package/lib/types/types/const/operator-text-map.d.ts +0 -1
- package/lib/types/types/const/two-formula-operators.d.ts +0 -1
- package/lib/types/utils/formula.d.ts +0 -1
- package/lib/types/utils/get-cell-data-origin.d.ts +0 -1
- package/lib/types/validators/checkbox-validator.d.ts +0 -1
- package/lib/types/validators/custom-validator.d.ts +0 -1
- package/lib/types/validators/date-validator.d.ts +0 -1
- package/lib/types/validators/decimal-validator.d.ts +2 -1
- package/lib/types/validators/list-multiple-validator.d.ts +0 -1
- package/lib/types/validators/list-validator.d.ts +0 -1
- package/lib/types/validators/text-length-validator.d.ts +2 -1
- package/lib/types/validators/util.d.ts +0 -1
- package/lib/types/validators/whole-validator.d.ts +2 -1
- package/lib/types/views/date-dropdown/index.d.ts +0 -1
- package/lib/types/views/detail/index.d.ts +0 -1
- package/lib/types/views/drop-down/CellDropdown.d.ts +0 -1
- package/lib/types/views/formula-input/base-formula-input.d.ts +0 -1
- package/lib/types/views/formula-input/checkbox-formula-input.d.ts +0 -1
- package/lib/types/views/formula-input/custom-formula-input.d.ts +0 -1
- package/lib/types/views/formula-input/formula-input.d.ts +0 -1
- package/lib/types/views/formula-input/index.d.ts +0 -1
- package/lib/types/views/formula-input/list-formula-input.d.ts +0 -1
- package/lib/types/views/item/index.d.ts +0 -1
- package/lib/types/views/list/index.d.ts +0 -1
- package/lib/types/views/list-dropdown/index.d.ts +0 -1
- package/lib/types/views/options/index.d.ts +0 -1
- package/lib/types/views/panel/index.d.ts +0 -1
- package/lib/types/views/render-mode/index.d.ts +0 -1
- package/lib/types/views/show-time/index.d.ts +0 -1
- package/lib/types/widgets/checkbox-widget.d.ts +0 -1
- package/lib/types/widgets/dropdown-multiple-widget.d.ts +0 -1
- package/lib/types/widgets/dropdown-widget.d.ts +1 -3
- package/lib/types/widgets/shape/dropdown.d.ts +0 -1
- package/lib/types/widgets/shape/layout.d.ts +0 -1
- package/lib/umd/index.js +2 -2
- package/package.json +25 -25
- package/lib/types/services/dv.service.d.ts +0 -20
- package/lib/types/services/dv.tips.d.ts +0 -17
package/lib/es/index.js
CHANGED
|
@@ -2,9 +2,9 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { DEFAULT_EMPTY_DOCUMENT_VALUE, useDependency, Inject, Disposable, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, IUniverInstanceService, UniverInstanceType, toDisposable, CommandType, ICommandService, ObjectMatrix, Range, isFormulaString, ThemeService, VerticalAlign, HorizontalAlign, createInternalEditorID, LocaleService, OnLifecycle, LifecycleStages, IPermissionService, DataValidationType, Tools, DataValidationOperator, DataValidationErrorStyle, UndoCommand, RedoCommand, isUnitRangesEqual, isValidRange, debounce, shallowEqual, Injector, DataValidationRenderMode, WrapStrategy, DocumentDataModel, BooleanNumber, Rectangle, IUndoRedoService, sequenceExecuteAsync, sequenceExecute, Optional, RxDisposable, DataValidationStatus, isRangesEqual, queryObjectMatrix, IResourceManagerService, DependentOn, Plugin } from "@univerjs/core";
|
|
6
|
-
import { ICommandService as ICommandService2, LocaleService as LocaleService2, Plugin as Plugin2 } from "@univerjs/core";
|
|
5
|
+
import { DEFAULT_EMPTY_DOCUMENT_VALUE, useDependency, Inject, Disposable, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, IUniverInstanceService, UniverInstanceType, toDisposable, CommandType, ICommandService, ObjectMatrix, Range, isFormulaString, ThemeService, VerticalAlign, HorizontalAlign, createInternalEditorID, LocaleService, OnLifecycle, LifecycleStages, IPermissionService, DataValidationType, Tools, DataValidationOperator, DataValidationErrorStyle, UndoCommand, RedoCommand, isUnitRangesEqual, isValidRange, debounce, shallowEqual, Injector, DataValidationRenderMode, DEFAULT_STYLES, WrapStrategy, DocumentDataModel, BooleanNumber, numfmt, Rectangle, IUndoRedoService, sequenceExecuteAsync, sequenceExecute, Optional, RxDisposable, DataValidationStatus, isRangesEqual, queryObjectMatrix, IResourceManagerService, DependentOn, Plugin } from "@univerjs/core";
|
|
7
6
|
import { DataValidatorRegistryService, DataValidationModel, BaseDataValidator, DataValidatorRegistryScope, TWO_FORMULA_OPERATOR_COUNT as TWO_FORMULA_OPERATOR_COUNT$1, getRuleOptions, getRuleSetting, RemoveDataValidationCommand, createDefaultNewRule, RemoveAllDataValidationCommand, TextLengthErrorTitleMap, AddDataValidationMutation, RemoveDataValidationMutation, UpdateRuleType, UpdateDataValidationMutation, removeDataValidationUndoFactory, DataValidationManager, AddDataValidationCommand, UniverDataValidationPlugin } from "@univerjs/data-validation";
|
|
7
|
+
import { DataValidationModel as DataValidationModel2, RemoveDataValidationCommand as RemoveDataValidationCommand2 } from "@univerjs/data-validation";
|
|
8
8
|
import { getSheetCommandTarget, SetRangeValuesCommand, WorksheetViewPermission, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, WorkbookEditablePermission, WorksheetSetCellStylePermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint, SheetInterceptorService, INTERCEPTOR_POINT, SheetsSelectionsService, ClearSelectionAllCommand, RefRangeService, handleCommonDefaultRangeChangeWithEffectRefCommands, UniverSheetsPlugin } from "@univerjs/sheets";
|
|
9
9
|
import { SheetCanvasPopManagerService, IMarkSelectionService, IEditorBridgeService, getCurrentRangeDisable$, AutoHeightController, SheetSkeletonManagerService, HoverManagerService, CellAlertManagerService, CellAlertType, IAutoFillService, APPLY_TYPE, virtualizeDiscreteRanges, getAutoFillRepeatRange, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, SheetPermissionInterceptorBaseController, UniverSheetsUIPlugin } from "@univerjs/sheets-ui";
|
|
10
10
|
import { useObservable, ComponentManager, IZenZoneService, ISidebarService, TextEditor, useEvent, RangeSelector, KeyCode, IDialogService, MenuItemType, MenuPosition, MenuGroup, getMenuHiddenObservable, IMenuService } from "@univerjs/ui";
|
|
@@ -16,7 +16,7 @@ import { FormLayout, Input, RadioGroup, Radio, DraggableList, Select, Checkbox a
|
|
|
16
16
|
import cs from "clsx";
|
|
17
17
|
import { LexerTreeBuilder, deserializeRangeWithSheet, serializeRange, isReferenceString, sequenceNodeType, isFormulaTransformable, transformFormula } from "@univerjs/engine-formula";
|
|
18
18
|
import dayjs from "dayjs";
|
|
19
|
-
import {
|
|
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
|
|
35
|
-
return String((
|
|
34
|
+
var _a22;
|
|
35
|
+
return String((_a22 = getCellValueOrigin(cell)) != null ? _a22 : "");
|
|
36
36
|
}
|
|
37
37
|
__name(getStringCellValue, "getStringCellValue");
|
|
38
38
|
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
@@ -85,11 +85,11 @@ function CellDropdown() {
|
|
|
85
85
|
}
|
|
86
86
|
__name(CellDropdown, "CellDropdown");
|
|
87
87
|
const DROP_DOWN_KEY = "sheet.ui.dropdown";
|
|
88
|
-
var __defProp$
|
|
89
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
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$
|
|
92
|
-
}, "__decorateClass$
|
|
91
|
+
return kind && result && __defProp$j(target, key, result), result;
|
|
92
|
+
}, "__decorateClass$j"), __decorateParam$j = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$j"), _a;
|
|
93
93
|
let DataValidationDropdownManagerService = (_a = class extends Disposable {
|
|
94
94
|
constructor(_canvasPopupManagerService, _univerInstanceService, _dataValidatorRegistryService, _zenZoneService, _renderManagerService, _dataValidationModel) {
|
|
95
95
|
super();
|
|
@@ -132,8 +132,8 @@ let DataValidationDropdownManagerService = (_a = class extends Disposable {
|
|
|
132
132
|
const disposableCollection = new DisposableCollection();
|
|
133
133
|
disposableCollection.add(popupDisposable), disposableCollection.add({
|
|
134
134
|
dispose: /* @__PURE__ */ __name(() => {
|
|
135
|
-
var
|
|
136
|
-
(_b = (
|
|
135
|
+
var _a22, _b;
|
|
136
|
+
(_b = (_a22 = this._activeDropdown) == null ? void 0 : _a22.onHide) == null || _b.call(_a22);
|
|
137
137
|
}, "dispose")
|
|
138
138
|
}), this._currentPopup = disposableCollection;
|
|
139
139
|
}
|
|
@@ -169,19 +169,19 @@ let DataValidationDropdownManagerService = (_a = class extends Disposable {
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
}, __name(_a, "DataValidationDropdownManagerService"), _a);
|
|
172
|
-
DataValidationDropdownManagerService = __decorateClass$
|
|
173
|
-
__decorateParam$
|
|
174
|
-
__decorateParam$
|
|
175
|
-
__decorateParam$
|
|
176
|
-
__decorateParam$
|
|
177
|
-
__decorateParam$
|
|
178
|
-
__decorateParam$
|
|
172
|
+
DataValidationDropdownManagerService = __decorateClass$j([
|
|
173
|
+
__decorateParam$j(0, Inject(SheetCanvasPopManagerService)),
|
|
174
|
+
__decorateParam$j(1, IUniverInstanceService),
|
|
175
|
+
__decorateParam$j(2, Inject(DataValidatorRegistryService)),
|
|
176
|
+
__decorateParam$j(3, IZenZoneService),
|
|
177
|
+
__decorateParam$j(4, IRenderManagerService),
|
|
178
|
+
__decorateParam$j(5, Inject(DataValidationModel))
|
|
179
179
|
], DataValidationDropdownManagerService);
|
|
180
|
-
var __defProp$
|
|
181
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
180
|
+
var __defProp$i = Object.defineProperty, __getOwnPropDesc$i = Object.getOwnPropertyDescriptor, __decorateClass$i = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
181
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
182
182
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
183
|
-
return kind && result && __defProp$
|
|
184
|
-
}, "__decorateClass$
|
|
183
|
+
return kind && result && __defProp$i(target, key, result), result;
|
|
184
|
+
}, "__decorateClass$i"), __decorateParam$i = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$i"), _a2;
|
|
185
185
|
let DataValidationPanelService = (_a2 = class extends Disposable {
|
|
186
186
|
constructor(_univerInstanceService, _sidebarService) {
|
|
187
187
|
super();
|
|
@@ -204,15 +204,15 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
|
|
|
204
204
|
return this._open$.getValue();
|
|
205
205
|
}
|
|
206
206
|
dispose() {
|
|
207
|
-
var
|
|
208
|
-
super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (
|
|
207
|
+
var _a22;
|
|
208
|
+
super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (_a22 = this._closeDisposable) == null || _a22.dispose();
|
|
209
209
|
}
|
|
210
210
|
open() {
|
|
211
211
|
this._open$.next(!0);
|
|
212
212
|
}
|
|
213
213
|
close() {
|
|
214
|
-
var
|
|
215
|
-
this._open$.next(!1), (
|
|
214
|
+
var _a22;
|
|
215
|
+
this._open$.next(!1), (_a22 = this._closeDisposable) == null || _a22.dispose();
|
|
216
216
|
}
|
|
217
217
|
setCloseDisposable(disposable) {
|
|
218
218
|
this._closeDisposable = toDisposable(() => {
|
|
@@ -223,9 +223,9 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
|
|
|
223
223
|
this._activeRule = rule, this._activeRule$.next(rule);
|
|
224
224
|
}
|
|
225
225
|
}, __name(_a2, "DataValidationPanelService"), _a2);
|
|
226
|
-
DataValidationPanelService = __decorateClass$
|
|
227
|
-
__decorateParam$
|
|
228
|
-
__decorateParam$
|
|
226
|
+
DataValidationPanelService = __decorateClass$i([
|
|
227
|
+
__decorateParam$i(0, IUniverInstanceService),
|
|
228
|
+
__decorateParam$i(1, ISidebarService)
|
|
229
229
|
], DataValidationPanelService);
|
|
230
230
|
const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperation = {
|
|
231
231
|
id: "data-validation.operation.open-validation-panel",
|
|
@@ -348,11 +348,11 @@ const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperatio
|
|
|
348
348
|
};
|
|
349
349
|
__name(_DataValidationCacheService, "DataValidationCacheService");
|
|
350
350
|
let DataValidationCacheService = _DataValidationCacheService;
|
|
351
|
-
var __defProp$
|
|
352
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
351
|
+
var __defProp$h = Object.defineProperty, __getOwnPropDesc$h = Object.getOwnPropertyDescriptor, __decorateClass$h = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
352
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
353
353
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
354
|
-
return kind && result && __defProp$
|
|
355
|
-
}, "__decorateClass$
|
|
354
|
+
return kind && result && __defProp$h(target, key, result), result;
|
|
355
|
+
}, "__decorateClass$h"), __decorateParam$h = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$h"), _a3;
|
|
356
356
|
let DataValidationFormulaService = (_a3 = class extends Disposable {
|
|
357
357
|
constructor(_instanceService, _registerOtherFormulaService, _dataValidationCacheService, _dataValidationModel) {
|
|
358
358
|
super();
|
|
@@ -367,8 +367,8 @@ let DataValidationFormulaService = (_a3 = class extends Disposable {
|
|
|
367
367
|
for (const subUnitId in unitMap) {
|
|
368
368
|
const results = unitMap[subUnitId], formulaMap = this._ensureRuleFormulaMap(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
|
|
369
369
|
results.forEach((result) => {
|
|
370
|
-
var
|
|
371
|
-
if (formulaMap.get((
|
|
370
|
+
var _a22, _b;
|
|
371
|
+
if (formulaMap.get((_a22 = result.extra) == null ? void 0 : _a22.ruleId)) {
|
|
372
372
|
const rule = manager.getRuleById((_b = result.extra) == null ? void 0 : _b.ruleId);
|
|
373
373
|
rule && this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges);
|
|
374
374
|
}
|
|
@@ -453,22 +453,22 @@ let DataValidationFormulaService = (_a3 = class extends Disposable {
|
|
|
453
453
|
return this._ensureRuleFormulaMap(unitId, subUnitId).get(ruleId);
|
|
454
454
|
}
|
|
455
455
|
}, __name(_a3, "DataValidationFormulaService"), _a3);
|
|
456
|
-
DataValidationFormulaService = __decorateClass$
|
|
457
|
-
__decorateParam$
|
|
458
|
-
__decorateParam$
|
|
459
|
-
__decorateParam$
|
|
460
|
-
__decorateParam$
|
|
456
|
+
DataValidationFormulaService = __decorateClass$h([
|
|
457
|
+
__decorateParam$h(0, IUniverInstanceService),
|
|
458
|
+
__decorateParam$h(1, Inject(RegisterOtherFormulaService)),
|
|
459
|
+
__decorateParam$h(2, Inject(DataValidationCacheService)),
|
|
460
|
+
__decorateParam$h(3, Inject(DataValidationModel))
|
|
461
461
|
], DataValidationFormulaService);
|
|
462
462
|
function getFormulaResult(result) {
|
|
463
|
-
var
|
|
464
|
-
return (_b = (
|
|
463
|
+
var _a22, _b;
|
|
464
|
+
return (_b = (_a22 = result == null ? void 0 : result[0]) == null ? void 0 : _a22[0]) == null ? void 0 : _b.v;
|
|
465
465
|
}
|
|
466
466
|
__name(getFormulaResult, "getFormulaResult");
|
|
467
|
-
var __defProp$
|
|
468
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
467
|
+
var __defProp$g = Object.defineProperty, __getOwnPropDesc$g = Object.getOwnPropertyDescriptor, __decorateClass$g = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
468
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
469
469
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
470
|
-
return kind && result && __defProp$
|
|
471
|
-
}, "__decorateClass$
|
|
470
|
+
return kind && result && __defProp$g(target, key, result), result;
|
|
471
|
+
}, "__decorateClass$g"), __decorateParam$g = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$g");
|
|
472
472
|
const MARGIN_H$2 = 6;
|
|
473
473
|
var _a4;
|
|
474
474
|
let CheckboxRender = (_a4 = class {
|
|
@@ -476,8 +476,8 @@ let CheckboxRender = (_a4 = class {
|
|
|
476
476
|
this._commandService = _commandService, this._formulaService = _formulaService, this._themeService = _themeService;
|
|
477
477
|
}
|
|
478
478
|
_calc(cellInfo, style) {
|
|
479
|
-
var
|
|
480
|
-
const { vt, ht } = style || {}, width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2, height = cellInfo.endY - cellInfo.startY, size = ((
|
|
479
|
+
var _a22, _b, _c;
|
|
480
|
+
const { vt, ht } = style || {}, width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2, height = cellInfo.endY - cellInfo.startY, size = ((_a22 = style == null ? void 0 : style.fs) != null ? _a22 : 10) * 1.6;
|
|
481
481
|
let widgetLeft = 0, widgetTop = 0;
|
|
482
482
|
switch (vt) {
|
|
483
483
|
case VerticalAlign.TOP:
|
|
@@ -509,21 +509,21 @@ let CheckboxRender = (_a4 = class {
|
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
511
|
calcCellAutoHeight(info) {
|
|
512
|
-
var
|
|
512
|
+
var _a22;
|
|
513
513
|
const { style } = info;
|
|
514
|
-
return ((
|
|
514
|
+
return ((_a22 = style == null ? void 0 : style.fs) != null ? _a22 : 10) * 1.6;
|
|
515
515
|
}
|
|
516
516
|
async _parseFormula(rule, unitId, subUnitId) {
|
|
517
|
-
var
|
|
517
|
+
var _a22, _b;
|
|
518
518
|
const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
|
|
519
519
|
return {
|
|
520
|
-
formula1: isFormulaString(formula1) ? getFormulaResult((
|
|
520
|
+
formula1: isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1,
|
|
521
521
|
formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
|
|
522
522
|
};
|
|
523
523
|
}
|
|
524
524
|
drawWith(ctx, info) {
|
|
525
|
-
var
|
|
526
|
-
const { style, data, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info, cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (
|
|
525
|
+
var _a22, _b, _c, _d, _e;
|
|
526
|
+
const { style, data, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info, cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a22 = data.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
|
|
527
527
|
if (!rule || !validator)
|
|
528
528
|
return;
|
|
529
529
|
const colors = this._themeService.getCurrentTheme();
|
|
@@ -556,10 +556,10 @@ let CheckboxRender = (_a4 = class {
|
|
|
556
556
|
return offsetX <= endX && offsetX >= startX && offsetY <= endY && offsetY >= startY;
|
|
557
557
|
}
|
|
558
558
|
async onPointerDown(info, evt) {
|
|
559
|
-
var
|
|
559
|
+
var _a22, _b;
|
|
560
560
|
if (evt.button === 2)
|
|
561
561
|
return;
|
|
562
|
-
const { primaryWithCoord, unitId, subUnitId, data, worksheet, row, col } = info, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (
|
|
562
|
+
const { primaryWithCoord, unitId, subUnitId, data, worksheet, row, col } = info, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a22 = data.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
|
|
563
563
|
if (!rule || !validator || !validator.skipDefaultFontRender(rule, value, { unitId, subUnitId }))
|
|
564
564
|
return;
|
|
565
565
|
const { formula1, formula2 } = await this._parseFormula(rule, unitId, subUnitId), params = {
|
|
@@ -580,18 +580,18 @@ let CheckboxRender = (_a4 = class {
|
|
|
580
580
|
);
|
|
581
581
|
}
|
|
582
582
|
}, __name(_a4, "CheckboxRender"), _a4);
|
|
583
|
-
CheckboxRender = __decorateClass$
|
|
584
|
-
__decorateParam$
|
|
585
|
-
__decorateParam$
|
|
586
|
-
__decorateParam$
|
|
583
|
+
CheckboxRender = __decorateClass$g([
|
|
584
|
+
__decorateParam$g(0, ICommandService),
|
|
585
|
+
__decorateParam$g(1, Inject(DataValidationFormulaService)),
|
|
586
|
+
__decorateParam$g(2, Inject(ThemeService))
|
|
587
587
|
], CheckboxRender);
|
|
588
588
|
function CustomFormulaInput(props) {
|
|
589
|
-
var
|
|
589
|
+
var _a22;
|
|
590
590
|
const { unitId, subUnitId, value, onChange, showError, validResult } = props, formula1Res = showError ? validResult == null ? void 0 : validResult.formula1 : "";
|
|
591
591
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { error: formula1Res, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
592
592
|
TextEditor,
|
|
593
593
|
{
|
|
594
|
-
value: (
|
|
594
|
+
value: (_a22 = value == null ? void 0 : value.formula1) != null ? _a22 : "",
|
|
595
595
|
id: createInternalEditorID(`dataValidation-custom-formula-${unitId}-${subUnitId}`),
|
|
596
596
|
onChange: /* @__PURE__ */ __name((newValue) => {
|
|
597
597
|
onChange == null || onChange({
|
|
@@ -689,15 +689,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
|
689
689
|
var attrs = __assign({}, node.attrs);
|
|
690
690
|
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
691
691
|
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(
|
|
693
|
-
var key =
|
|
692
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a22) {
|
|
693
|
+
var key = _a22[0], value = _a22[1];
|
|
694
694
|
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
695
695
|
})), attrs;
|
|
696
696
|
}
|
|
697
697
|
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
698
698
|
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
699
|
-
var
|
|
700
|
-
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((
|
|
699
|
+
var _a22, defIds = runtimeProps.defIds;
|
|
700
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a22 = node.children) === null || _a22 === void 0) && _a22.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
|
701
701
|
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
|
702
702
|
}) }) : node;
|
|
703
703
|
}
|
|
@@ -777,17 +777,17 @@ function getDataValidationCellValue(cellData) {
|
|
|
777
777
|
}
|
|
778
778
|
__name(getDataValidationCellValue, "getDataValidationCellValue");
|
|
779
779
|
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$
|
|
781
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
780
|
+
var P = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(P || {}), __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
781
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
782
782
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
783
|
-
return kind && result && __defProp$
|
|
784
|
-
}, "__decorateClass$
|
|
783
|
+
return kind && result && __defProp$f(target, key, result), result;
|
|
784
|
+
}, "__decorateClass$f"), __decorateParam$f = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$f"), _a5;
|
|
785
785
|
let DataValidationFormulaController = (_a5 = class extends Disposable {
|
|
786
786
|
constructor(_univerInstanceService, _permissionService, _lexerTreeBuilder) {
|
|
787
787
|
super(), this._univerInstanceService = _univerInstanceService, this._permissionService = _permissionService, this._lexerTreeBuilder = _lexerTreeBuilder;
|
|
788
788
|
}
|
|
789
789
|
getFormulaRefCheck(formulaString) {
|
|
790
|
-
var
|
|
790
|
+
var _a22, _b;
|
|
791
791
|
const sequenceNodes = this._lexerTreeBuilder.sequenceNodesBuilder(formulaString);
|
|
792
792
|
if (!sequenceNodes)
|
|
793
793
|
return !0;
|
|
@@ -809,7 +809,7 @@ let DataValidationFormulaController = (_a5 = class extends Disposable {
|
|
|
809
809
|
const { startRow, endRow, startColumn, endColumn } = sequenceGrid.range;
|
|
810
810
|
for (let i2 = startRow; i2 <= endRow; i2++)
|
|
811
811
|
for (let j = startColumn; j <= endColumn; j++) {
|
|
812
|
-
const permission = (_b = (
|
|
812
|
+
const permission = (_b = (_a22 = targetSheet.getCell(i2, j)) == null ? void 0 : _a22.selectionProtection) == null ? void 0 : _b[0];
|
|
813
813
|
if ((permission == null ? void 0 : permission[P.View]) === !1)
|
|
814
814
|
return !1;
|
|
815
815
|
}
|
|
@@ -817,11 +817,11 @@ let DataValidationFormulaController = (_a5 = class extends Disposable {
|
|
|
817
817
|
return !0;
|
|
818
818
|
}
|
|
819
819
|
}, __name(_a5, "DataValidationFormulaController"), _a5);
|
|
820
|
-
DataValidationFormulaController = __decorateClass$
|
|
820
|
+
DataValidationFormulaController = __decorateClass$f([
|
|
821
821
|
OnLifecycle(LifecycleStages.Rendered, DataValidationFormulaController),
|
|
822
|
-
__decorateParam$
|
|
823
|
-
__decorateParam$
|
|
824
|
-
__decorateParam$
|
|
822
|
+
__decorateParam$f(0, IUniverInstanceService),
|
|
823
|
+
__decorateParam$f(1, IPermissionService),
|
|
824
|
+
__decorateParam$f(2, Inject(LexerTreeBuilder))
|
|
825
825
|
], DataValidationFormulaController);
|
|
826
826
|
const DEFAULT_COLOR_PRESET = [
|
|
827
827
|
"#FFFFFF",
|
|
@@ -1168,18 +1168,18 @@ const _CheckboxValidator = class _CheckboxValidator extends BaseDataValidator {
|
|
|
1168
1168
|
};
|
|
1169
1169
|
}
|
|
1170
1170
|
async parseFormula(rule, unitId, subUnitId) {
|
|
1171
|
-
var
|
|
1171
|
+
var _a22, _b;
|
|
1172
1172
|
const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
|
|
1173
1173
|
return {
|
|
1174
|
-
formula1: isFormulaString(formula1) ? getFormulaResult((
|
|
1174
|
+
formula1: isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1,
|
|
1175
1175
|
formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
|
|
1176
1176
|
};
|
|
1177
1177
|
}
|
|
1178
1178
|
parseFormulaSync(rule, unitId, subUnitId) {
|
|
1179
|
-
var
|
|
1179
|
+
var _a22, _b;
|
|
1180
1180
|
const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = this._formulaService.getRuleFormulaResultSync(unitId, subUnitId, rule.uid);
|
|
1181
1181
|
return {
|
|
1182
|
-
formula1: isFormulaString(formula1) ? getFormulaResult((
|
|
1182
|
+
formula1: isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1,
|
|
1183
1183
|
formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
|
|
1184
1184
|
};
|
|
1185
1185
|
}
|
|
@@ -1206,7 +1206,7 @@ const timestamp2SerialTime = /* @__PURE__ */ __name((timestamp) => timestamp / 8
|
|
|
1206
1206
|
dataValidationOptionsButtonIcon
|
|
1207
1207
|
};
|
|
1208
1208
|
function DataValidationOptions(props) {
|
|
1209
|
-
var
|
|
1209
|
+
var _a22;
|
|
1210
1210
|
const localeService = useDependency(LocaleService), componentManager = useDependency(ComponentManager), { value, onChange, extraComponent } = props, [show, setShow] = useState(!1), ExtraOptions = extraComponent ? componentManager.get(extraComponent) : null;
|
|
1211
1211
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
1212
1212
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$5.dataValidationOptionsButton, onClick: /* @__PURE__ */ __name(() => setShow(!show), "onClick"), children: [
|
|
@@ -1222,7 +1222,7 @@ function DataValidationOptions(props) {
|
|
|
1222
1222
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1223
1223
|
RadioGroup,
|
|
1224
1224
|
{
|
|
1225
|
-
value: `${(
|
|
1225
|
+
value: `${(_a22 = value.errorStyle) != null ? _a22 : DataValidationErrorStyle.WARNING}`,
|
|
1226
1226
|
onChange: /* @__PURE__ */ __name((errorStyle) => onChange({ ...value, errorStyle: +errorStyle }), "onChange"),
|
|
1227
1227
|
children: [
|
|
1228
1228
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationErrorStyle.WARNING}`, children: localeService.t("dataValidation.panel.showWarning") }),
|
|
@@ -1239,17 +1239,17 @@ function DataValidationOptions(props) {
|
|
|
1239
1239
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1240
1240
|
Checkbox$1,
|
|
1241
1241
|
{
|
|
1242
|
-
checked: value.
|
|
1242
|
+
checked: value.showErrorMessage,
|
|
1243
1243
|
onChange: /* @__PURE__ */ __name(() => onChange({
|
|
1244
1244
|
...value,
|
|
1245
|
-
|
|
1245
|
+
showErrorMessage: !value.showErrorMessage
|
|
1246
1246
|
}), "onChange"),
|
|
1247
1247
|
children: localeService.t("dataValidation.panel.showInfo")
|
|
1248
1248
|
}
|
|
1249
1249
|
)
|
|
1250
1250
|
}
|
|
1251
1251
|
),
|
|
1252
|
-
value.
|
|
1252
|
+
value.showErrorMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { value: value.error, onChange: /* @__PURE__ */ __name((error) => onChange({ ...value, error }), "onChange") }) }) : null
|
|
1253
1253
|
] })
|
|
1254
1254
|
] });
|
|
1255
1255
|
}
|
|
@@ -1454,8 +1454,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
|
|
|
1454
1454
|
}), e.stopPropagation();
|
|
1455
1455
|
}, "handleDelete");
|
|
1456
1456
|
return useEffect(() => () => {
|
|
1457
|
-
var
|
|
1458
|
-
ids.current && ((
|
|
1457
|
+
var _a22;
|
|
1458
|
+
ids.current && ((_a22 = ids.current) == null || _a22.forEach((id) => {
|
|
1459
1459
|
id && markSelectionService.removeShape(id);
|
|
1460
1460
|
}));
|
|
1461
1461
|
}, [markSelectionService]), /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -1486,8 +1486,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
|
|
|
1486
1486
|
})));
|
|
1487
1487
|
}, "onMouseEnter"),
|
|
1488
1488
|
onMouseLeave: /* @__PURE__ */ __name(() => {
|
|
1489
|
-
var
|
|
1490
|
-
setIsHover(!1), (
|
|
1489
|
+
var _a22;
|
|
1490
|
+
setIsHover(!1), (_a22 = ids.current) == null || _a22.forEach((id) => {
|
|
1491
1491
|
id && markSelectionService.removeShape(id);
|
|
1492
1492
|
}), ids.current = void 0;
|
|
1493
1493
|
}, "onMouseLeave"),
|
|
@@ -1544,11 +1544,11 @@ function DataValidationListWithWorkbook(props) {
|
|
|
1544
1544
|
return rules2.map((rule) => {
|
|
1545
1545
|
const { ranges } = rule;
|
|
1546
1546
|
return (ranges == null ? void 0 : ranges.some((range) => {
|
|
1547
|
-
var
|
|
1547
|
+
var _a22, _b;
|
|
1548
1548
|
const { startRow, startColumn, endRow, endColumn } = range;
|
|
1549
1549
|
for (let row = startRow; row <= endRow; row++)
|
|
1550
1550
|
for (let col = startColumn; col <= endColumn; col++) {
|
|
1551
|
-
const permission = (_b = (
|
|
1551
|
+
const permission = (_b = (_a22 = worksheet2 == null ? void 0 : worksheet2.getCell(row, col)) == null ? void 0 : _a22.selectionProtection) == null ? void 0 : _b[0];
|
|
1552
1552
|
if ((permission == null ? void 0 : permission[P.Edit]) === !1 || (permission == null ? void 0 : permission[P.View]) === !1)
|
|
1553
1553
|
return !0;
|
|
1554
1554
|
}
|
|
@@ -1558,7 +1558,7 @@ function DataValidationListWithWorkbook(props) {
|
|
|
1558
1558
|
}, "getDvRulesByPermissionCorrect"))(rules), hasDisableRule = rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.some((rule) => rule.disable);
|
|
1559
1559
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
1560
1560
|
rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.map((rule) => {
|
|
1561
|
-
var
|
|
1561
|
+
var _a22;
|
|
1562
1562
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1563
1563
|
DataValidationItem,
|
|
1564
1564
|
{
|
|
@@ -1572,7 +1572,7 @@ function DataValidationListWithWorkbook(props) {
|
|
|
1572
1572
|
});
|
|
1573
1573
|
}, "onClick"),
|
|
1574
1574
|
rule,
|
|
1575
|
-
disable: (
|
|
1575
|
+
disable: (_a22 = rule.disable) != null ? _a22 : !1
|
|
1576
1576
|
},
|
|
1577
1577
|
rule.uid
|
|
1578
1578
|
);
|
|
@@ -1598,10 +1598,10 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
|
|
|
1598
1598
|
dvListDropdownSplit,
|
|
1599
1599
|
dvListDropdownEdit
|
|
1600
1600
|
}, SelectList = /* @__PURE__ */ __name((props) => {
|
|
1601
|
-
const { value, onChange, multiple, options, title, onEdit, style } = props;
|
|
1601
|
+
const { value, onChange, multiple, options, title, onEdit, style, filter: filter2 } = props, localeService = useDependency(LocaleService), lowerFilter = filter2 == null ? void 0 : filter2.toLowerCase(), filteredOptions = options.filter((item) => lowerFilter ? item.label.toLowerCase().includes(lowerFilter) : !0);
|
|
1602
1602
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.dvListDropdown, style, children: [
|
|
1603
1603
|
/* @__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:
|
|
1604
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownList, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Scrollbar, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownListContainer, children: filteredOptions.map((item, i) => {
|
|
1605
1605
|
const selected = value.indexOf(item.value) > -1, handleClick = /* @__PURE__ */ __name(() => {
|
|
1606
1606
|
let set;
|
|
1607
1607
|
selected ? set = new Set(value.filter((sub) => sub !== item.value)) : set = new Set(multiple ? [...value, item.value] : [item.value]);
|
|
@@ -1609,31 +1609,52 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
|
|
|
1609
1609
|
options.forEach((opt) => {
|
|
1610
1610
|
set.has(opt.value) && newValue.push(opt.value);
|
|
1611
1611
|
}), onChange(newValue);
|
|
1612
|
-
}, "handleClick");
|
|
1612
|
+
}, "handleClick"), index = item.label.toLocaleLowerCase().indexOf(lowerFilter);
|
|
1613
1613
|
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
|
|
1614
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownItem, style: { background: item.color || DROP_DOWN_DEFAULT_COLOR }, children: lowerFilter && item.label.toLowerCase().includes(lowerFilter) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
1615
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: item.label.substring(0, index) }),
|
|
1616
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { fontWeight: "bold" }, children: item.label.substring(index, index + lowerFilter.length) }),
|
|
1617
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: item.label.substring(index + lowerFilter.length) })
|
|
1618
|
+
] }) : item.label }),
|
|
1615
1619
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownSelectedIcon, children: selected ? /* @__PURE__ */ jsxRuntimeExports.jsx(CheckMarkSingle, {}) : null })
|
|
1616
1620
|
] }, i);
|
|
1617
|
-
}) }) }) }),
|
|
1621
|
+
}) }) }, filter2) }),
|
|
1618
1622
|
/* @__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: "
|
|
1623
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.dvListDropdownEdit, children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { onClick: onEdit, children: localeService.t("dataValidation.list.edit") }) })
|
|
1620
1624
|
] });
|
|
1621
1625
|
}, "SelectList");
|
|
1622
1626
|
function ListDropDown(props) {
|
|
1623
|
-
var
|
|
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)), []);
|
|
1627
|
+
var _a22, _b;
|
|
1628
|
+
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId } = location, dataValidationModel = useDependency(DataValidationModel), [editingText, setEditingText] = useState(""), commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [localValue, setLocalValue] = useState(""), editorBridgeService = useDependency(IEditorBridgeService), instanceService = useDependency(IUniverInstanceService), ruleChange$ = useMemo(() => dataValidationModel.ruleChange$.pipe(debounceTime(16)), []);
|
|
1625
1629
|
useObservable(ruleChange$);
|
|
1626
1630
|
const anchorRect = RectPopup.useContext(), cellWidth = anchorRect.right - anchorRect.left;
|
|
1627
|
-
if (
|
|
1631
|
+
if (useEffect(() => {
|
|
1632
|
+
const dispose = commandService.onCommandExecuted((command) => {
|
|
1633
|
+
if (command.id === RichTextEditingMutation.id) {
|
|
1634
|
+
const params = command.params, { unitId: unitId2 } = params, unit = instanceService.getUnit(unitId2, UniverInstanceType.UNIVER_DOC);
|
|
1635
|
+
if (!unit)
|
|
1636
|
+
return;
|
|
1637
|
+
const text = getPlainTextFormDocument(unit.getSnapshot());
|
|
1638
|
+
setEditingText(text);
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
return () => {
|
|
1642
|
+
dispose.dispose();
|
|
1643
|
+
};
|
|
1644
|
+
}, [commandService, instanceService]), !worksheet)
|
|
1628
1645
|
return null;
|
|
1629
|
-
const cellData = worksheet.getCell(row, col), rule = (
|
|
1630
|
-
if (!cellData || !rule || !validator)
|
|
1646
|
+
const cellData = worksheet.getCell(row, col), rule = (_a22 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, showColor = (rule == null ? void 0 : rule.renderMode) === DataValidationRenderMode.CUSTOM || (rule == null ? void 0 : rule.renderMode) === void 0;
|
|
1647
|
+
if (!cellData || !rule || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0)
|
|
1631
1648
|
return;
|
|
1632
1649
|
const multiple = rule.type === DataValidationType.LIST_MULTIPLE, list = validator.getListWithColor(rule, unitId, subUnitId), cellStr = localValue || getDataValidationCellValue(worksheet.getCellRaw(row, col)), value = deserializeListOptions(cellStr), handleEdit = /* @__PURE__ */ __name(() => {
|
|
1633
1650
|
commandService.executeCommand(OpenValidationPanelOperation.id, {
|
|
1634
1651
|
ruleId: rule.uid
|
|
1635
1652
|
}), hideFn();
|
|
1636
|
-
}, "handleEdit")
|
|
1653
|
+
}, "handleEdit"), options = list.map((item) => ({
|
|
1654
|
+
label: item.label,
|
|
1655
|
+
value: item.label,
|
|
1656
|
+
color: showColor ? item.color : "transparent"
|
|
1657
|
+
}));
|
|
1637
1658
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1638
1659
|
SelectList,
|
|
1639
1660
|
{
|
|
@@ -1668,12 +1689,9 @@ function ListDropDown(props) {
|
|
|
1668
1689
|
unitId
|
|
1669
1690
|
}), commandService.executeCommand(SetRangeValuesCommand.id, params), setLocalValue(str), multiple || hideFn();
|
|
1670
1691
|
}, "onChange"),
|
|
1671
|
-
options
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
color: showColor ? item.color : "transparent"
|
|
1675
|
-
})),
|
|
1676
|
-
onEdit: handleEdit
|
|
1692
|
+
options,
|
|
1693
|
+
onEdit: handleEdit,
|
|
1694
|
+
filter: editingText
|
|
1677
1695
|
}
|
|
1678
1696
|
);
|
|
1679
1697
|
}
|
|
@@ -1754,11 +1772,11 @@ var utc$1 = { exports: {} };
|
|
|
1754
1772
|
})(utc$1);
|
|
1755
1773
|
var utcExports = utc$1.exports;
|
|
1756
1774
|
const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports);
|
|
1757
|
-
var __defProp$
|
|
1758
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
1775
|
+
var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1776
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1759
1777
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1760
|
-
return kind && result && __defProp$
|
|
1761
|
-
}, "__decorateClass$
|
|
1778
|
+
return kind && result && __defProp$e(target, key, result), result;
|
|
1779
|
+
}, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e"), _a6;
|
|
1762
1780
|
let DataValidationRejectInputController = (_a6 = class extends Disposable {
|
|
1763
1781
|
constructor(_editorBridgeService, _dataValidationModel, _dataValidatorRegistryService, _dialogService, _localeService) {
|
|
1764
1782
|
super(), this._editorBridgeService = _editorBridgeService, this._dataValidationModel = _dataValidationModel, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._dialogService = _dialogService, this._localeService = _localeService, this._initEditorBridgeInterceptor();
|
|
@@ -1768,7 +1786,7 @@ let DataValidationRejectInputController = (_a6 = class extends Disposable {
|
|
|
1768
1786
|
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT_ASYNC,
|
|
1769
1787
|
{
|
|
1770
1788
|
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;
|
|
1789
|
+
const cell = await cellPromise, { worksheet, row, col, unitId, subUnitId, workbook } = context, manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleId = manager.getRuleIdByLocation(row, col), rule = ruleId ? manager.getRuleById(ruleId) : void 0;
|
|
1772
1790
|
if (!rule || rule.errorStyle !== DataValidationErrorStyle.STOP)
|
|
1773
1791
|
return next(Promise.resolve(cell));
|
|
1774
1792
|
const validator = await this._dataValidatorRegistryService.getValidatorItem(rule.type);
|
|
@@ -1778,7 +1796,9 @@ let DataValidationRejectInputController = (_a6 = class extends Disposable {
|
|
|
1778
1796
|
row,
|
|
1779
1797
|
column: col,
|
|
1780
1798
|
unitId,
|
|
1781
|
-
subUnitId
|
|
1799
|
+
subUnitId,
|
|
1800
|
+
worksheet,
|
|
1801
|
+
workbook
|
|
1782
1802
|
},
|
|
1783
1803
|
rule
|
|
1784
1804
|
))
|
|
@@ -1837,13 +1857,13 @@ let DataValidationRejectInputController = (_a6 = class extends Disposable {
|
|
|
1837
1857
|
});
|
|
1838
1858
|
}
|
|
1839
1859
|
}, __name(_a6, "DataValidationRejectInputController"), _a6);
|
|
1840
|
-
DataValidationRejectInputController = __decorateClass$
|
|
1860
|
+
DataValidationRejectInputController = __decorateClass$e([
|
|
1841
1861
|
OnLifecycle(LifecycleStages.Ready, DataValidationRejectInputController),
|
|
1842
|
-
__decorateParam$
|
|
1843
|
-
__decorateParam$
|
|
1844
|
-
__decorateParam$
|
|
1845
|
-
__decorateParam$
|
|
1846
|
-
__decorateParam$
|
|
1862
|
+
__decorateParam$e(0, IEditorBridgeService),
|
|
1863
|
+
__decorateParam$e(1, Inject(DataValidationModel)),
|
|
1864
|
+
__decorateParam$e(2, Inject(DataValidatorRegistryService)),
|
|
1865
|
+
__decorateParam$e(3, IDialogService),
|
|
1866
|
+
__decorateParam$e(4, Inject(LocaleService))
|
|
1847
1867
|
], DataValidationRejectInputController);
|
|
1848
1868
|
const dvDateDropdown = "univer-dv-date-dropdown", dvDateDropdownBtns = "univer-dv-date-dropdown-btns", styles = {
|
|
1849
1869
|
dvDateDropdown,
|
|
@@ -1862,20 +1882,22 @@ const transformDate = /* @__PURE__ */ __name((value) => {
|
|
|
1862
1882
|
return date;
|
|
1863
1883
|
}, "transformDate");
|
|
1864
1884
|
function DateDropdown(props) {
|
|
1865
|
-
var
|
|
1866
|
-
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId } = location, commandService = useDependency(ICommandService), rejectInputController = useDependency(DataValidationRejectInputController), cellData = worksheet.getCell(row, col), rule = (
|
|
1885
|
+
var _a22, _b, _c;
|
|
1886
|
+
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId, workbook } = location, commandService = useDependency(ICommandService), rejectInputController = useDependency(DataValidationRejectInputController), cellData = worksheet.getCell(row, col), rule = (_a22 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, cellStr = getCellValueOrigin(worksheet.getCellRaw(row, col)), originDate = transformDate(cellStr), [localDate, setLocalDate] = useState(originDate), showTime = !!((_c = rule == null ? void 0 : rule.bizInfo) != null && _c.showTime), date = localDate && localDate.isValid() ? localDate : dayjs(), localeService = useDependency(LocaleService);
|
|
1867
1887
|
if (!cellData || !rule || !validator)
|
|
1868
1888
|
return;
|
|
1869
1889
|
const handleSave = /* @__PURE__ */ __name(async () => {
|
|
1870
|
-
if (!
|
|
1890
|
+
if (!date)
|
|
1871
1891
|
return;
|
|
1872
|
-
const dateStr = `${
|
|
1892
|
+
const dateStr = `${date.format(showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00").split(" ").join("T")}Z`, serialTime = timestamp2SerialTime(dayjs(dateStr).unix());
|
|
1873
1893
|
rule.errorStyle !== DataValidationErrorStyle.STOP || await validator.validator({
|
|
1874
1894
|
value: serialTime,
|
|
1875
1895
|
unitId,
|
|
1876
1896
|
subUnitId,
|
|
1877
1897
|
row,
|
|
1878
|
-
column: col
|
|
1898
|
+
column: col,
|
|
1899
|
+
worksheet,
|
|
1900
|
+
workbook
|
|
1879
1901
|
}, rule) ? (commandService.executeCommand(SetRangeValuesCommand.id, {
|
|
1880
1902
|
unitId,
|
|
1881
1903
|
subUnitId,
|
|
@@ -1903,8 +1925,8 @@ function DateDropdown(props) {
|
|
|
1903
1925
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1904
1926
|
DatePanel,
|
|
1905
1927
|
{
|
|
1906
|
-
defaultValue:
|
|
1907
|
-
pickerValue:
|
|
1928
|
+
defaultValue: date,
|
|
1929
|
+
pickerValue: date,
|
|
1908
1930
|
showTime: showTime || void 0,
|
|
1909
1931
|
onSelect: /* @__PURE__ */ __name(async (newValue) => {
|
|
1910
1932
|
setLocalDate(newValue);
|
|
@@ -1914,7 +1936,7 @@ function DateDropdown(props) {
|
|
|
1914
1936
|
}, "onPanelChange")
|
|
1915
1937
|
}
|
|
1916
1938
|
),
|
|
1917
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.dvDateDropdownBtns, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "primary", onClick: handleSave, disabled: !
|
|
1939
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.dvDateDropdownBtns, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", type: "primary", onClick: handleSave, disabled: !date.isValid(), children: localeService.t("dataValidation.alert.ok") }) })
|
|
1918
1940
|
] });
|
|
1919
1941
|
}
|
|
1920
1942
|
__name(DateDropdown, "DateDropdown");
|
|
@@ -1949,12 +1971,12 @@ const DateOperatorTitleMap = {
|
|
|
1949
1971
|
[DataValidationOperator.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual"
|
|
1950
1972
|
}, DATE_SHOW_TIME_OPTION = "DATE_SHOW_TIME_OPTION";
|
|
1951
1973
|
function DateShowTimeOption(props) {
|
|
1952
|
-
var
|
|
1974
|
+
var _a22;
|
|
1953
1975
|
const { value, onChange } = props, localeService = useDependency(LocaleService);
|
|
1954
1976
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1955
1977
|
Checkbox$1,
|
|
1956
1978
|
{
|
|
1957
|
-
checked: (
|
|
1979
|
+
checked: (_a22 = value.bizInfo) == null ? void 0 : _a22.showTime,
|
|
1958
1980
|
onChange: /* @__PURE__ */ __name((showTime) => {
|
|
1959
1981
|
onChange({
|
|
1960
1982
|
...value,
|
|
@@ -1999,24 +2021,24 @@ const FORMULA1$1 = "{FORMULA1}", FORMULA2$1 = "{FORMULA2}", transformDate2Serial
|
|
|
1999
2021
|
__publicField(this, "_formulaService", this.injector.get(DataValidationFormulaService));
|
|
2000
2022
|
}
|
|
2001
2023
|
async parseFormula(rule, unitId, subUnitId) {
|
|
2002
|
-
var
|
|
2024
|
+
var _a22, _b;
|
|
2003
2025
|
const results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
|
|
2004
2026
|
return {
|
|
2005
|
-
formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((
|
|
2027
|
+
formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1),
|
|
2006
2028
|
formula2: transformDate2SerialNumber(isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2)
|
|
2007
2029
|
};
|
|
2008
2030
|
}
|
|
2009
2031
|
parseFormulaSync(rule, unitId, subUnitId) {
|
|
2010
|
-
var
|
|
2032
|
+
var _a22, _b;
|
|
2011
2033
|
const results = this._formulaService.getRuleFormulaResultSync(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
|
|
2012
2034
|
return {
|
|
2013
|
-
formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((
|
|
2035
|
+
formula1: transformDate2SerialNumber(isFormulaString(formula1) ? getFormulaResult((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : formula1),
|
|
2014
2036
|
formula2: transformDate2SerialNumber(isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2)
|
|
2015
2037
|
};
|
|
2016
2038
|
}
|
|
2017
2039
|
async isValidType(info) {
|
|
2018
|
-
const { value } = info;
|
|
2019
|
-
return typeof
|
|
2040
|
+
const { value, worksheet, row, column } = info, cell = worksheet.getCell(row, column), interceptValue = getCellValueOrigin(cell);
|
|
2041
|
+
return typeof interceptValue == "string" && typeof value == "number" ? dayjs(interceptValue).isValid() : !1;
|
|
2020
2042
|
}
|
|
2021
2043
|
_validatorSingleFormula(formula) {
|
|
2022
2044
|
return !Tools.isBlank(formula) && (isFormulaString(formula) || !Number.isNaN(+formula) || !!formula && dayjs(formula).isValid());
|
|
@@ -2090,25 +2112,25 @@ const FORMULA1$1 = "{FORMULA1}", FORMULA2$1 = "{FORMULA2}", transformDate2Serial
|
|
|
2090
2112
|
return this.operators.map((operator) => this.localeService.t(DateOperatorNameMap[operator]));
|
|
2091
2113
|
}
|
|
2092
2114
|
generateRuleName(rule) {
|
|
2093
|
-
var
|
|
2115
|
+
var _a22, _b;
|
|
2094
2116
|
if (!rule.operator)
|
|
2095
2117
|
return this.titleStr;
|
|
2096
|
-
const ruleName = this.localeService.t(DateOperatorTitleMap[rule.operator]).replace(FORMULA1$1, (
|
|
2118
|
+
const ruleName = this.localeService.t(DateOperatorTitleMap[rule.operator]).replace(FORMULA1$1, (_a22 = rule.formula1) != null ? _a22 : "").replace(FORMULA2$1, (_b = rule.formula2) != null ? _b : "");
|
|
2097
2119
|
return `${this.titleStr} ${ruleName}`;
|
|
2098
2120
|
}
|
|
2099
2121
|
generateRuleErrorMessage(rule) {
|
|
2100
|
-
var
|
|
2101
|
-
return rule.operator ? `${this.localeService.t(DateOperatorErrorTitleMap[rule.operator]).replace(FORMULA1$1, (
|
|
2122
|
+
var _a22, _b;
|
|
2123
|
+
return rule.operator ? `${this.localeService.t(DateOperatorErrorTitleMap[rule.operator]).replace(FORMULA1$1, (_a22 = rule.formula1) != null ? _a22 : "").replace(FORMULA2$1, (_b = rule.formula2) != null ? _b : "")}` : this.titleStr;
|
|
2102
2124
|
}
|
|
2103
2125
|
};
|
|
2104
2126
|
__name(_DateValidator, "DateValidator");
|
|
2105
2127
|
let DateValidator = _DateValidator;
|
|
2106
|
-
var __defProp$
|
|
2107
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
2128
|
+
var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPropertyDescriptor, __decorateClass$d = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2129
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2108
2130
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2109
|
-
return kind && result && __defProp$
|
|
2110
|
-
}, "__decorateClass$
|
|
2111
|
-
const PADDING_H$1 = 4, ICON_SIZE =
|
|
2131
|
+
return kind && result && __defProp$d(target, key, result), result;
|
|
2132
|
+
}, "__decorateClass$d"), __decorateParam$d = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$d");
|
|
2133
|
+
const PADDING_H$1 = 4, ICON_SIZE = 4, ICON_PLACE$1 = 14, MARGIN_H$1 = 6, MARGIN_V$1 = 4, DROP_DOWN_ICON_COLOR = "#565656", downPath$1 = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
|
|
2112
2134
|
function convertToDocumentData(text, style) {
|
|
2113
2135
|
const contentLength = text.length;
|
|
2114
2136
|
return {
|
|
@@ -2176,17 +2198,18 @@ function createDocuments(text, localeService, style) {
|
|
|
2176
2198
|
};
|
|
2177
2199
|
}
|
|
2178
2200
|
__name(createDocuments, "createDocuments");
|
|
2179
|
-
function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht) {
|
|
2201
|
+
function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht, margin = !0) {
|
|
2180
2202
|
let paddingTop = 0;
|
|
2203
|
+
const realMargin = margin ? MARGIN_V$1 : 0;
|
|
2181
2204
|
switch (vt) {
|
|
2182
2205
|
case VerticalAlign.BOTTOM:
|
|
2183
|
-
paddingTop = cellHeight -
|
|
2206
|
+
paddingTop = cellHeight - realMargin * 2 - fontHeight + realMargin;
|
|
2184
2207
|
break;
|
|
2185
2208
|
case VerticalAlign.MIDDLE:
|
|
2186
|
-
paddingTop = (cellHeight -
|
|
2209
|
+
paddingTop = (cellHeight - realMargin * 2 - fontHeight) / 2 + realMargin;
|
|
2187
2210
|
break;
|
|
2188
2211
|
default:
|
|
2189
|
-
paddingTop =
|
|
2212
|
+
paddingTop = realMargin;
|
|
2190
2213
|
break;
|
|
2191
2214
|
}
|
|
2192
2215
|
let paddingLeft = 0;
|
|
@@ -2207,6 +2230,12 @@ __name(calcPadding, "calcPadding");
|
|
|
2207
2230
|
var _a7;
|
|
2208
2231
|
let DropdownWidget = (_a7 = class {
|
|
2209
2232
|
constructor(_localeService, _commandService) {
|
|
2233
|
+
// static padding: IPaddingData = {
|
|
2234
|
+
// l: MARGIN_H + PADDING_H,
|
|
2235
|
+
// r: ICON_PLACE + MARGIN_H,
|
|
2236
|
+
// t: MARGIN_V,
|
|
2237
|
+
// b: MARGIN_V,
|
|
2238
|
+
// };
|
|
2210
2239
|
__publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
|
2211
2240
|
__publicField(this, "zIndex");
|
|
2212
2241
|
__publicField(this, "onPointerEnter");
|
|
@@ -2220,24 +2249,27 @@ let DropdownWidget = (_a7 = class {
|
|
|
2220
2249
|
_generateKey(row, col) {
|
|
2221
2250
|
return `${row}.${col}`;
|
|
2222
2251
|
}
|
|
2223
|
-
_drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, vt) {
|
|
2224
|
-
const left = cellWidth - ICON_PLACE$1
|
|
2225
|
-
let top
|
|
2252
|
+
_drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, fontHeight, vt, pd) {
|
|
2253
|
+
const { t = DEFAULT_STYLES.pd.t, b = DEFAULT_STYLES.pd.b } = pd, left = cellWidth - ICON_PLACE$1;
|
|
2254
|
+
let top;
|
|
2226
2255
|
switch (vt) {
|
|
2227
2256
|
case VerticalAlign.MIDDLE:
|
|
2228
|
-
top = (cellHeight -
|
|
2257
|
+
top = (cellHeight - ICON_SIZE) / 2;
|
|
2229
2258
|
break;
|
|
2230
2259
|
case VerticalAlign.BOTTOM:
|
|
2231
|
-
top = cellHeight -
|
|
2260
|
+
top = cellHeight - ICON_SIZE / 2 - b - fontHeight / 2;
|
|
2261
|
+
break;
|
|
2262
|
+
default:
|
|
2263
|
+
top = t + fontHeight / 2 - ICON_SIZE / 2;
|
|
2232
2264
|
break;
|
|
2233
2265
|
}
|
|
2234
2266
|
ctx.save(), ctx.translateWithPrecision(cellBounding.startX + left, cellBounding.startY + top), ctx.fillStyle = "#565656", ctx.fill(downPath$1), ctx.restore();
|
|
2235
2267
|
}
|
|
2236
|
-
// eslint-disable-next-line max-lines-per-function
|
|
2268
|
+
// eslint-disable-next-line max-lines-per-function, complexity
|
|
2237
2269
|
drawWith(ctx, info, skeleton) {
|
|
2238
|
-
var
|
|
2239
|
-
const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, rule = (
|
|
2240
|
-
if (!rule || !validator || !validator.skipDefaultFontRender(rule))
|
|
2270
|
+
var _a22, _b;
|
|
2271
|
+
const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, rule = (_a22 = data.dataValidation) == null ? void 0 : _a22.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {};
|
|
2272
|
+
if (!rule || !validator || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0 || !validator.skipDefaultFontRender(rule))
|
|
2241
2273
|
return;
|
|
2242
2274
|
const cellBounding = {
|
|
2243
2275
|
startX: _cellBounding.startX + leftOffset,
|
|
@@ -2245,31 +2277,30 @@ let DropdownWidget = (_a7 = class {
|
|
|
2245
2277
|
startY: _cellBounding.startY + topOffset,
|
|
2246
2278
|
endY: _cellBounding.endY - downOffset
|
|
2247
2279
|
}, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, map = this._ensureMap(subUnitId), key = this._generateKey(row, col), list = validator.getListWithColor(rule), value = getCellValueOrigin(data), valueStr = `${value != null ? value : ""}`, activeItem = list.find((i) => i.label === valueStr);
|
|
2248
|
-
let { tb, vt, ht } = style || {};
|
|
2249
|
-
if (tb = tb != null ? tb : WrapStrategy.WRAP, vt = vt != null ? vt : VerticalAlign.BOTTOM, ht = ht != null ? ht :
|
|
2250
|
-
|
|
2251
|
-
const realWidth = cellWidth - ICON_PLACE$1, { documentSkeleton, documents, docModel } = createDocuments(valueStr, this._localeService, style);
|
|
2280
|
+
let { tb, vt, ht, pd } = style || {};
|
|
2281
|
+
if (tb = tb != null ? tb : WrapStrategy.WRAP, vt = vt != null ? vt : VerticalAlign.BOTTOM, ht = ht != null ? ht : DEFAULT_STYLES.ht, pd = pd != null ? pd : DEFAULT_STYLES.pd, rule.renderMode === DataValidationRenderMode.ARROW) {
|
|
2282
|
+
const { l: l2 = DEFAULT_STYLES.pd.l, t = DEFAULT_STYLES.pd.t, r = DEFAULT_STYLES.pd.r, b = DEFAULT_STYLES.pd.b } = pd, realWidth = cellWidth - l2 - r - ICON_PLACE$1, { documentSkeleton, documents, docModel } = createDocuments(valueStr, this._localeService, style);
|
|
2252
2283
|
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.
|
|
2255
|
-
left: cellBounding.endX + skeleton.rowHeaderWidth - ICON_PLACE$1,
|
|
2256
|
-
top: cellBounding.startY + skeleton.columnHeaderHeight,
|
|
2284
|
+
const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight, width: fontWidth } = textLayout, { paddingTop, paddingLeft } = calcPadding(realWidth, cellHeight - t - b, fontWidth, fontHeight, vt, ht, !1);
|
|
2285
|
+
this._drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, fontHeight, vt, pd), ctx.save(), ctx.translateWithPrecision(cellBounding.startX + l2, cellBounding.startY + t), ctx.beginPath(), ctx.rect(0, 0, cellWidth - l2 - r, cellHeight - t - b), ctx.clip(), ctx.translateWithPrecision(0, paddingTop), ctx.save(), ctx.translateWithPrecision(PADDING_H$1, 0), ctx.beginPath(), ctx.rect(0, 0, realWidth, fontHeight), ctx.clip(), documents.render(ctx), ctx.translateWithPrecision(paddingLeft, 0), ctx.restore(), ctx.restore(), map.set(key, {
|
|
2286
|
+
left: cellBounding.endX + l2 + skeleton.rowHeaderWidth - ICON_PLACE$1,
|
|
2287
|
+
top: cellBounding.startY + t + skeleton.columnHeaderHeight,
|
|
2257
2288
|
width: ICON_PLACE$1,
|
|
2258
|
-
height: cellHeight
|
|
2289
|
+
height: cellHeight - t - b
|
|
2259
2290
|
});
|
|
2260
2291
|
} else {
|
|
2261
2292
|
ctx.save(), ctx.translateWithPrecision(cellBounding.startX, cellBounding.startY), ctx.beginPath(), ctx.rect(0, 0, cellWidth, cellHeight), ctx.clip();
|
|
2262
2293
|
const realWidth = cellWidth - MARGIN_H$1 * 2 - PADDING_H$1 - ICON_PLACE$1, { documentSkeleton, documents, docModel } = createDocuments(valueStr, this._localeService, style);
|
|
2263
2294
|
tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate();
|
|
2264
2295
|
const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight, width: fontWidth } = textLayout, { paddingTop, paddingLeft } = calcPadding(realWidth, cellHeight, fontWidth, fontHeight, vt, ht);
|
|
2265
|
-
ctx.
|
|
2296
|
+
ctx.translateWithPrecision(MARGIN_H$1, paddingTop);
|
|
2266
2297
|
const rectWidth = Math.max(cellWidth - MARGIN_H$1 * 2, 1), rectHeight = fontHeight;
|
|
2267
2298
|
Rect.drawWith(ctx, {
|
|
2268
2299
|
width: rectWidth,
|
|
2269
2300
|
height: rectHeight,
|
|
2270
2301
|
fill: (activeItem == null ? void 0 : activeItem.color) || DROP_DOWN_DEFAULT_COLOR,
|
|
2271
2302
|
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.
|
|
2303
|
+
}), ctx.save(), ctx.translateWithPrecision(PADDING_H$1, 0), ctx.beginPath(), ctx.rect(0, 0, realWidth, fontHeight), ctx.clip(), ctx.translateWithPrecision(paddingLeft, 0), documents.render(ctx), ctx.restore(), ctx.translateWithPrecision(realWidth + PADDING_H$1 + 4, (fontHeight - ICON_SIZE) / 2), ctx.fillStyle = DROP_DOWN_ICON_COLOR, ctx.fill(downPath$1), ctx.restore(), map.set(key, {
|
|
2273
2304
|
left: cellBounding.startX + MARGIN_H$1 + skeleton.rowHeaderWidth,
|
|
2274
2305
|
top: cellBounding.startY + paddingTop + skeleton.columnHeaderHeight,
|
|
2275
2306
|
width: rectWidth,
|
|
@@ -2278,8 +2309,8 @@ let DropdownWidget = (_a7 = class {
|
|
|
2278
2309
|
}
|
|
2279
2310
|
}
|
|
2280
2311
|
calcCellAutoHeight(info) {
|
|
2281
|
-
var
|
|
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 = (
|
|
2312
|
+
var _a22;
|
|
2313
|
+
const { primaryWithCoord, style, data } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, rule = (_a22 = data.dataValidation) == null ? void 0 : _a22.rule;
|
|
2283
2314
|
if (!rule || rule.renderMode === DataValidationRenderMode.TEXT)
|
|
2284
2315
|
return;
|
|
2285
2316
|
const cellBounding = {
|
|
@@ -2288,12 +2319,13 @@ let DropdownWidget = (_a7 = class {
|
|
|
2288
2319
|
startY: _cellBounding.startY + topOffset,
|
|
2289
2320
|
endY: _cellBounding.endY - downOffset
|
|
2290
2321
|
}, cellWidth = cellBounding.endX - cellBounding.startX, value = getCellValueOrigin(data), valueStr = `${value != null ? value : ""}`;
|
|
2291
|
-
let { tb } = style || {};
|
|
2322
|
+
let { tb, pd } = style || {};
|
|
2323
|
+
const { t = DEFAULT_STYLES.pd.t, b = DEFAULT_STYLES.pd.b } = pd != null ? pd : {};
|
|
2292
2324
|
if (tb = tb != null ? tb : WrapStrategy.WRAP, rule.renderMode === DataValidationRenderMode.ARROW) {
|
|
2293
2325
|
const realWidth = cellWidth - ICON_PLACE$1, { documentSkeleton, docModel } = createDocuments(valueStr, this._localeService, style);
|
|
2294
2326
|
tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate(), documentSkeleton.getActualSize();
|
|
2295
2327
|
const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight } = textLayout;
|
|
2296
|
-
return fontHeight;
|
|
2328
|
+
return fontHeight + t + b;
|
|
2297
2329
|
} else {
|
|
2298
2330
|
const realWidth = cellWidth - MARGIN_H$1 * 2 - PADDING_H$1 - ICON_PLACE$1, { documentSkeleton, docModel } = createDocSkeleton(valueStr, this._localeService, style);
|
|
2299
2331
|
tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate();
|
|
@@ -2321,21 +2353,16 @@ let DropdownWidget = (_a7 = class {
|
|
|
2321
2353
|
};
|
|
2322
2354
|
this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
|
|
2323
2355
|
}
|
|
2324
|
-
}, __name(_a7, "DropdownWidget"),
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
b: MARGIN_V$1
|
|
2329
|
-
}), _a7);
|
|
2330
|
-
DropdownWidget = __decorateClass$e([
|
|
2331
|
-
__decorateParam$e(0, Inject(LocaleService)),
|
|
2332
|
-
__decorateParam$e(1, ICommandService)
|
|
2356
|
+
}, __name(_a7, "DropdownWidget"), _a7);
|
|
2357
|
+
DropdownWidget = __decorateClass$d([
|
|
2358
|
+
__decorateParam$d(0, Inject(LocaleService)),
|
|
2359
|
+
__decorateParam$d(1, ICommandService)
|
|
2333
2360
|
], DropdownWidget);
|
|
2334
2361
|
const LIST_RENDER_MODE_OPTION_INPUT = "LIST_RENDER_MODE_OPTION_INPUT";
|
|
2335
2362
|
function ListRenderModeInput(props) {
|
|
2336
|
-
var
|
|
2363
|
+
var _a22;
|
|
2337
2364
|
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: `${(
|
|
2365
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(RadioGroup, { value: `${(_a22 = value.renderMode) != null ? _a22 : DataValidationRenderMode.CUSTOM}`, onChange: /* @__PURE__ */ __name((renderMode) => onChange({ ...value, renderMode: +renderMode }), "onChange"), children: [
|
|
2339
2366
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.CUSTOM}`, children: localeService.t("dataValidation.renderMode.chip") }),
|
|
2340
2367
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.ARROW}`, children: localeService.t("dataValidation.renderMode.arrow") }),
|
|
2341
2368
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.TEXT}`, children: localeService.t("dataValidation.renderMode.text") })
|
|
@@ -2350,10 +2377,10 @@ function getRuleFormulaResultSet(result) {
|
|
|
2350
2377
|
return result.forEach(
|
|
2351
2378
|
(row) => {
|
|
2352
2379
|
row.forEach((cell) => {
|
|
2353
|
-
var
|
|
2380
|
+
var _a22, _b;
|
|
2354
2381
|
const value = getCellValueOrigin(cell);
|
|
2355
2382
|
if (value != null) {
|
|
2356
|
-
if (typeof value != "string" && typeof (cell == null ? void 0 : cell.s) == "object" && ((_b = (
|
|
2383
|
+
if (typeof value != "string" && typeof (cell == null ? void 0 : cell.s) == "object" && ((_b = (_a22 = cell.s) == null ? void 0 : _a22.n) != null && _b.pattern)) {
|
|
2357
2384
|
resultSet.add(numfmt.format(cell.s.n.pattern, value));
|
|
2358
2385
|
return;
|
|
2359
2386
|
}
|
|
@@ -2406,8 +2433,8 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
|
|
|
2406
2433
|
return rule.renderMode !== DataValidationRenderMode.TEXT;
|
|
2407
2434
|
}
|
|
2408
2435
|
validatorFormula(rule, unitId, subUnitId) {
|
|
2409
|
-
var
|
|
2410
|
-
const success = !Tools.isBlank(rule.formula1), valid = isValidListFormula((
|
|
2436
|
+
var _a22, _b, _c;
|
|
2437
|
+
const success = !Tools.isBlank(rule.formula1), valid = isValidListFormula((_a22 = rule.formula1) != null ? _a22 : "", this._lexer), sheetName = (_c = (_b = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _b.getSheetBySheetId(subUnitId)) == null ? void 0 : _c.getName(), isIntersects = isRuleIntersects(rule, sheetName != null ? sheetName : "");
|
|
2411
2438
|
return {
|
|
2412
2439
|
success: !!(success && valid && !isIntersects),
|
|
2413
2440
|
formula1: success ? valid ? isIntersects ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -2418,10 +2445,10 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
|
|
|
2418
2445
|
return deserializeListOptions(cellString);
|
|
2419
2446
|
}
|
|
2420
2447
|
async parseFormula(rule, unitId, subUnitId) {
|
|
2421
|
-
var
|
|
2448
|
+
var _a22;
|
|
2422
2449
|
const { formula1 = "" } = rule, results = await this.formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
|
|
2423
2450
|
return {
|
|
2424
|
-
formula1: isFormulaString(formula1) ? getRuleFormulaResultSet((
|
|
2451
|
+
formula1: isFormulaString(formula1) ? getRuleFormulaResultSet((_a22 = results == null ? void 0 : results[0]) == null ? void 0 : _a22.result) : deserializeListOptions(formula1),
|
|
2425
2452
|
formula2: void 0
|
|
2426
2453
|
};
|
|
2427
2454
|
}
|
|
@@ -2436,8 +2463,8 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
|
|
|
2436
2463
|
return this.localeService.t("dataValidation.list.error");
|
|
2437
2464
|
}
|
|
2438
2465
|
getList(rule, currentUnitId, currentSubUnitId) {
|
|
2439
|
-
var
|
|
2440
|
-
const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (
|
|
2466
|
+
var _a22, _b, _c;
|
|
2467
|
+
const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (_a22 = currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : void 0) != null ? _a22 : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
2441
2468
|
if (!workbook) return [];
|
|
2442
2469
|
const worksheet = (_b = currentSubUnitId ? workbook.getSheetBySheetId(currentSubUnitId) : void 0) != null ? _b : workbook.getActiveSheet();
|
|
2443
2470
|
if (!worksheet) return [];
|
|
@@ -2445,8 +2472,8 @@ const _ListValidator = class _ListValidator extends BaseDataValidator {
|
|
|
2445
2472
|
return isFormulaString(formula1) ? getRuleFormulaResultSet((_c = results == null ? void 0 : results[0]) == null ? void 0 : _c.result) : deserializeListOptions(formula1);
|
|
2446
2473
|
}
|
|
2447
2474
|
async getListAsync(rule, currentUnitId, currentSubUnitId) {
|
|
2448
|
-
var
|
|
2449
|
-
const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (
|
|
2475
|
+
var _a22, _b, _c;
|
|
2476
|
+
const { formula1 = "" } = rule, univerInstanceService = this.injector.get(IUniverInstanceService), workbook = (_a22 = currentUnitId ? univerInstanceService.getUniverSheetInstance(currentUnitId) : void 0) != null ? _a22 : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
2450
2477
|
if (!workbook) return [];
|
|
2451
2478
|
const worksheet = (_b = currentSubUnitId ? workbook.getSheetBySheetId(currentSubUnitId) : void 0) != null ? _b : workbook.getActiveSheet();
|
|
2452
2479
|
if (!worksheet) return [];
|
|
@@ -2509,10 +2536,10 @@ const _DecimalValidator = class _DecimalValidator extends BaseDataValidator {
|
|
|
2509
2536
|
return formula == null ? Number.NaN : +formula;
|
|
2510
2537
|
}
|
|
2511
2538
|
async parseFormula(rule, unitId, subUnitId) {
|
|
2512
|
-
var
|
|
2539
|
+
var _a22, _b, _c, _d, _e, _f, _g, _h;
|
|
2513
2540
|
const formulaInfo = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
|
|
2514
2541
|
return {
|
|
2515
|
-
formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (
|
|
2542
|
+
formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (_a22 = formulaInfo == null ? void 0 : formulaInfo[0]) == null ? void 0 : _a22.result) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.v : formula1),
|
|
2516
2543
|
formula2: this._parseNumber(isFormulaString(formula2) ? (_h = (_g = (_f = (_e = formulaInfo == null ? void 0 : formulaInfo[1]) == null ? void 0 : _e.result) == null ? void 0 : _f[0]) == null ? void 0 : _g[0]) == null ? void 0 : _h.v : formula2)
|
|
2517
2544
|
};
|
|
2518
2545
|
}
|
|
@@ -2618,10 +2645,10 @@ const FORMULA1 = "{FORMULA1}", FORMULA2 = "{FORMULA2}", _TextLengthValidator = c
|
|
|
2618
2645
|
return !Number.isNaN(formula);
|
|
2619
2646
|
}
|
|
2620
2647
|
async parseFormula(rule, unitId, subUnitId) {
|
|
2621
|
-
var
|
|
2648
|
+
var _a22, _b, _c, _d, _e, _f, _g, _h;
|
|
2622
2649
|
const formulaInfo = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
|
|
2623
2650
|
return {
|
|
2624
|
-
formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (
|
|
2651
|
+
formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (_a22 = formulaInfo == null ? void 0 : formulaInfo[0]) == null ? void 0 : _a22.result) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.v : formula1),
|
|
2625
2652
|
formula2: this._parseNumber(isFormulaString(formula2) ? (_h = (_g = (_f = (_e = formulaInfo == null ? void 0 : formulaInfo[1]) == null ? void 0 : _e.result) == null ? void 0 : _f[0]) == null ? void 0 : _g[0]) == null ? void 0 : _h.v : formula2)
|
|
2626
2653
|
};
|
|
2627
2654
|
}
|
|
@@ -2674,15 +2701,15 @@ const FORMULA1 = "{FORMULA1}", FORMULA2 = "{FORMULA2}", _TextLengthValidator = c
|
|
|
2674
2701
|
return this._isValidFormula(formula1) ? cellValue <= formula1 : !1;
|
|
2675
2702
|
}
|
|
2676
2703
|
generateRuleErrorMessage(rule) {
|
|
2677
|
-
var
|
|
2678
|
-
return rule.operator ? `${this.localeService.t(TextLengthErrorTitleMap[rule.operator]).replace(FORMULA1, (
|
|
2704
|
+
var _a22, _b;
|
|
2705
|
+
return rule.operator ? `${this.localeService.t(TextLengthErrorTitleMap[rule.operator]).replace(FORMULA1, (_a22 = rule.formula1) != null ? _a22 : "").replace(FORMULA2, (_b = rule.formula2) != null ? _b : "")}` : this.titleStr;
|
|
2679
2706
|
}
|
|
2680
2707
|
};
|
|
2681
2708
|
__name(_TextLengthValidator, "TextLengthValidator");
|
|
2682
2709
|
let TextLengthValidator = _TextLengthValidator;
|
|
2683
2710
|
function isBlankCell(cellData) {
|
|
2684
|
-
var
|
|
2685
|
-
return cellData ? cellData.p ? !((_b = (
|
|
2711
|
+
var _a22, _b;
|
|
2712
|
+
return cellData ? cellData.p ? !((_b = (_a22 = cellData.p.body) == null ? void 0 : _a22.dataStream) != null ? _b : "").slice(0, -2).trim() : Tools.isBlank(cellData.v) : !0;
|
|
2686
2713
|
}
|
|
2687
2714
|
__name(isBlankCell, "isBlankCell");
|
|
2688
2715
|
function getDataValidationDiffMutations(unitId, subUnitId, diffs, accessor, source = "command") {
|
|
@@ -2974,6 +3001,12 @@ const UpdateSheetDataValidationRangeCommand = {
|
|
|
2974
3001
|
undoMutations
|
|
2975
3002
|
}), commandService.executeCommand(UpdateDataValidationMutation.id, mutationParams), !0;
|
|
2976
3003
|
}
|
|
3004
|
+
}, ClearRangeDataValidationCommand = {
|
|
3005
|
+
type: CommandType.COMMAND,
|
|
3006
|
+
id: "sheets.command.clear-range-data-validation",
|
|
3007
|
+
handler(accessor, params) {
|
|
3008
|
+
return params ? (accessor.get(ICommandService), !0) : !1;
|
|
3009
|
+
}
|
|
2977
3010
|
}, DataValidationIcon = "data-validation-single", DATA_VALIDATION_MENU_ID = "sheet.menu.data-validation";
|
|
2978
3011
|
function dataValidationMenuFactory(accessor) {
|
|
2979
3012
|
return {
|
|
@@ -3006,11 +3039,11 @@ function addDataValidationMenuFactory(_accessor) {
|
|
|
3006
3039
|
};
|
|
3007
3040
|
}
|
|
3008
3041
|
__name(addDataValidationMenuFactory, "addDataValidationMenuFactory");
|
|
3009
|
-
var __defProp$
|
|
3010
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
3042
|
+
var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPropertyDescriptor, __decorateClass$c = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3043
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3011
3044
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
3012
|
-
return kind && result && __defProp$
|
|
3013
|
-
}, "__decorateClass$
|
|
3045
|
+
return kind && result && __defProp$c(target, key, result), result;
|
|
3046
|
+
}, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$c");
|
|
3014
3047
|
const DefaultSheetsDataValidation = {}, INVALID_MARK = {
|
|
3015
3048
|
tr: {
|
|
3016
3049
|
size: 6,
|
|
@@ -3036,9 +3069,9 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
|
3036
3069
|
}
|
|
3037
3070
|
_initDropdown() {
|
|
3038
3071
|
this._editorBridgeService && this.disposeWithMe(this._editorBridgeService.visible$.subscribe((visible) => {
|
|
3039
|
-
var
|
|
3072
|
+
var _a22;
|
|
3040
3073
|
if (!visible.visible) {
|
|
3041
|
-
((
|
|
3074
|
+
((_a22 = this._dropdownManagerService.activeDropdown) == null ? void 0 : _a22.trigger) === "editor-bridge" && this._dropdownManagerService.hideDropdown();
|
|
3042
3075
|
return;
|
|
3043
3076
|
}
|
|
3044
3077
|
const state = this._editorBridgeService.getEditCellState();
|
|
@@ -3079,10 +3112,10 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
|
3079
3112
|
}
|
|
3080
3113
|
_initSkeletonChange() {
|
|
3081
3114
|
const markSkeletonDirty = /* @__PURE__ */ __name(() => {
|
|
3082
|
-
var
|
|
3115
|
+
var _a22, _b, _c;
|
|
3083
3116
|
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
3084
3117
|
if (!workbook) return;
|
|
3085
|
-
const unitId = workbook.getUnitId(), subUnitId = (
|
|
3118
|
+
const unitId = workbook.getUnitId(), subUnitId = (_a22 = workbook.getActiveSheet()) == null ? void 0 : _a22.getSheetId();
|
|
3086
3119
|
if (!subUnitId) return;
|
|
3087
3120
|
const skeleton = (_c = (_b = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _b.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _c.skeleton, currentRender = this._renderManagerService.getRenderById(unitId);
|
|
3088
3121
|
skeleton == null || skeleton.makeDirty(!0), skeleton == null || skeleton.calculate(), currentRender && currentRender.mainComponent.makeForceDirty();
|
|
@@ -3098,11 +3131,11 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
|
3098
3131
|
priority: 200,
|
|
3099
3132
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
3100
3133
|
handler: /* @__PURE__ */ __name((cell, pos, next) => {
|
|
3101
|
-
var
|
|
3134
|
+
var _a22, _b, _c, _d, _e, _f;
|
|
3102
3135
|
const { row, col, unitId, subUnitId, workbook, worksheet } = pos, manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
|
|
3103
3136
|
if (!manager)
|
|
3104
3137
|
return next(cell);
|
|
3105
|
-
const skeleton = (_b = (
|
|
3138
|
+
const skeleton = (_b = (_a22 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a22.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
|
|
3106
3139
|
if (!skeleton)
|
|
3107
3140
|
return next(cell);
|
|
3108
3141
|
const styleMap = pos.workbook.getStyles(), defaultStyle = (typeof (cell == null ? void 0 : cell.s) == "string" ? styleMap.get(cell == null ? void 0 : cell.s) : cell == null ? void 0 : cell.s) || {}, ruleId = manager.getRuleIdByLocation(row, col);
|
|
@@ -3163,7 +3196,7 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
|
3163
3196
|
...extra.interceptorStyle
|
|
3164
3197
|
},
|
|
3165
3198
|
get interceptorAutoHeight() {
|
|
3166
|
-
var
|
|
3199
|
+
var _a23, _b2, _c2, _d2;
|
|
3167
3200
|
const mergeCell = skeleton.mergeData.find((range) => {
|
|
3168
3201
|
const { startColumn, startRow, endColumn, endRow } = range;
|
|
3169
3202
|
return row >= startRow && col >= startColumn && row <= endRow && col <= endColumn;
|
|
@@ -3178,7 +3211,7 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
|
3178
3211
|
}
|
|
3179
3212
|
},
|
|
3180
3213
|
style: skeleton.getsStyles().getStyleByCell(cell),
|
|
3181
|
-
primaryWithCoord: skeleton.getCellByIndex((
|
|
3214
|
+
primaryWithCoord: skeleton.getCellByIndex((_a23 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a23 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
|
|
3182
3215
|
unitId,
|
|
3183
3216
|
subUnitId,
|
|
3184
3217
|
row,
|
|
@@ -3204,8 +3237,8 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
|
3204
3237
|
).subscribe((infos) => {
|
|
3205
3238
|
const ranges = [];
|
|
3206
3239
|
if (infos.forEach((info) => {
|
|
3207
|
-
var
|
|
3208
|
-
(
|
|
3240
|
+
var _a22;
|
|
3241
|
+
(_a22 = info.rule) != null && _a22.ranges && ranges.push(...info.rule.ranges);
|
|
3209
3242
|
}), ranges.length) {
|
|
3210
3243
|
const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
|
|
3211
3244
|
sequenceExecute(mutations.redos, this._commandService);
|
|
@@ -3213,20 +3246,20 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
|
3213
3246
|
});
|
|
3214
3247
|
}
|
|
3215
3248
|
}, __name(_a8, "SheetsDataValidationRenderController"), _a8);
|
|
3216
|
-
SheetsDataValidationRenderController = __decorateClass$
|
|
3249
|
+
SheetsDataValidationRenderController = __decorateClass$c([
|
|
3217
3250
|
OnLifecycle(LifecycleStages.Rendered, SheetsDataValidationRenderController),
|
|
3218
|
-
__decorateParam$
|
|
3219
|
-
__decorateParam$
|
|
3220
|
-
__decorateParam$
|
|
3221
|
-
__decorateParam$
|
|
3222
|
-
__decorateParam$
|
|
3223
|
-
__decorateParam$
|
|
3224
|
-
__decorateParam$
|
|
3225
|
-
__decorateParam$
|
|
3226
|
-
__decorateParam$
|
|
3227
|
-
__decorateParam$
|
|
3228
|
-
__decorateParam$
|
|
3229
|
-
__decorateParam$
|
|
3251
|
+
__decorateParam$c(1, ICommandService),
|
|
3252
|
+
__decorateParam$c(2, IMenuService),
|
|
3253
|
+
__decorateParam$c(3, IRenderManagerService),
|
|
3254
|
+
__decorateParam$c(4, IUniverInstanceService),
|
|
3255
|
+
__decorateParam$c(5, Inject(AutoHeightController)),
|
|
3256
|
+
__decorateParam$c(6, Inject(ComponentManager)),
|
|
3257
|
+
__decorateParam$c(7, Inject(DataValidationDropdownManagerService)),
|
|
3258
|
+
__decorateParam$c(8, Inject(DataValidationModel)),
|
|
3259
|
+
__decorateParam$c(9, Inject(DataValidatorRegistryService)),
|
|
3260
|
+
__decorateParam$c(10, Inject(Injector)),
|
|
3261
|
+
__decorateParam$c(11, Inject(SheetInterceptorService)),
|
|
3262
|
+
__decorateParam$c(12, Optional(IEditorBridgeService))
|
|
3230
3263
|
], SheetsDataValidationRenderController);
|
|
3231
3264
|
var _a9;
|
|
3232
3265
|
let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposable {
|
|
@@ -3235,10 +3268,10 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
|
3235
3268
|
}
|
|
3236
3269
|
_initSkeletonChange() {
|
|
3237
3270
|
const markSkeletonDirty = /* @__PURE__ */ __name(() => {
|
|
3238
|
-
var
|
|
3271
|
+
var _a22, _b, _c;
|
|
3239
3272
|
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
3240
3273
|
if (!workbook) return;
|
|
3241
|
-
const unitId = workbook.getUnitId(), subUnitId = (
|
|
3274
|
+
const unitId = workbook.getUnitId(), subUnitId = (_a22 = workbook.getActiveSheet()) == null ? void 0 : _a22.getSheetId();
|
|
3242
3275
|
if (!subUnitId) return;
|
|
3243
3276
|
const skeleton = (_c = (_b = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _b.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _c.skeleton, currentRender = this._renderManagerService.getRenderById(unitId);
|
|
3244
3277
|
skeleton == null || skeleton.makeDirty(!0), skeleton == null || skeleton.calculate(), currentRender && currentRender.mainComponent.makeForceDirty();
|
|
@@ -3252,13 +3285,13 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
|
3252
3285
|
INTERCEPTOR_POINT.CELL_CONTENT,
|
|
3253
3286
|
{
|
|
3254
3287
|
priority: 200,
|
|
3255
|
-
// eslint-disable-next-line max-lines-per-function
|
|
3288
|
+
// eslint-disable-next-line max-lines-per-function, complexity
|
|
3256
3289
|
handler: /* @__PURE__ */ __name((cell, pos, next) => {
|
|
3257
|
-
var
|
|
3290
|
+
var _a22, _b, _c, _d, _e;
|
|
3258
3291
|
const { row, col, unitId, subUnitId, workbook, worksheet } = pos, manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
|
|
3259
3292
|
if (!manager)
|
|
3260
3293
|
return next(cell);
|
|
3261
|
-
const skeleton = (_b = (
|
|
3294
|
+
const skeleton = (_b = (_a22 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a22.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
|
|
3262
3295
|
if (!skeleton)
|
|
3263
3296
|
return next(cell);
|
|
3264
3297
|
const styleMap = pos.workbook.getStyles(), defaultStyle = (typeof (cell == null ? void 0 : cell.s) == "string" ? styleMap.get(cell == null ? void 0 : cell.s) : cell == null ? void 0 : cell.s) || {}, ruleId = manager.getRuleIdByLocation(row, col);
|
|
@@ -3319,7 +3352,7 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
|
3319
3352
|
...extra.interceptorStyle
|
|
3320
3353
|
},
|
|
3321
3354
|
get interceptorAutoHeight() {
|
|
3322
|
-
var
|
|
3355
|
+
var _a23, _b2, _c2, _d2;
|
|
3323
3356
|
const mergeCell = skeleton.mergeData.find((range) => {
|
|
3324
3357
|
const { startColumn, startRow, endColumn, endRow } = range;
|
|
3325
3358
|
return row >= startRow && col >= startColumn && row <= endRow && col <= endColumn;
|
|
@@ -3334,7 +3367,7 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
|
3334
3367
|
}
|
|
3335
3368
|
},
|
|
3336
3369
|
style: skeleton.getsStyles().getStyleByCell(cell),
|
|
3337
|
-
primaryWithCoord: skeleton.getCellByIndex((
|
|
3370
|
+
primaryWithCoord: skeleton.getCellByIndex((_a23 = mergeCell == null ? void 0 : mergeCell.startRow) != null ? _a23 : row, (_b2 = mergeCell == null ? void 0 : mergeCell.startColumn) != null ? _b2 : col),
|
|
3338
3371
|
unitId,
|
|
3339
3372
|
subUnitId,
|
|
3340
3373
|
row,
|
|
@@ -3357,8 +3390,8 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
|
3357
3390
|
).subscribe((infos) => {
|
|
3358
3391
|
const ranges = [];
|
|
3359
3392
|
if (infos.forEach((info) => {
|
|
3360
|
-
var
|
|
3361
|
-
(
|
|
3393
|
+
var _a22;
|
|
3394
|
+
(_a22 = info.rule) != null && _a22.ranges && ranges.push(...info.rule.ranges);
|
|
3362
3395
|
}), ranges.length) {
|
|
3363
3396
|
const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
|
|
3364
3397
|
sequenceExecute(mutations.redos, this._commandService);
|
|
@@ -3366,61 +3399,22 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
|
3366
3399
|
});
|
|
3367
3400
|
}
|
|
3368
3401
|
}, __name(_a9, "SheetsDataValidationMobileRenderController"), _a9);
|
|
3369
|
-
SheetsDataValidationMobileRenderController = __decorateClass$
|
|
3402
|
+
SheetsDataValidationMobileRenderController = __decorateClass$c([
|
|
3370
3403
|
OnLifecycle(LifecycleStages.Rendered, SheetsDataValidationMobileRenderController),
|
|
3371
|
-
__decorateParam$
|
|
3372
|
-
__decorateParam$
|
|
3373
|
-
__decorateParam$
|
|
3374
|
-
__decorateParam$
|
|
3375
|
-
__decorateParam$
|
|
3376
|
-
__decorateParam$
|
|
3377
|
-
__decorateParam$
|
|
3404
|
+
__decorateParam$c(1, ICommandService),
|
|
3405
|
+
__decorateParam$c(2, IRenderManagerService),
|
|
3406
|
+
__decorateParam$c(3, IUniverInstanceService),
|
|
3407
|
+
__decorateParam$c(4, Inject(AutoHeightController)),
|
|
3408
|
+
__decorateParam$c(5, Inject(DataValidationModel)),
|
|
3409
|
+
__decorateParam$c(6, Inject(DataValidatorRegistryService)),
|
|
3410
|
+
__decorateParam$c(7, Inject(SheetInterceptorService))
|
|
3378
3411
|
], 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
3412
|
var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPropertyDescriptor, __decorateClass$b = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3419
3413
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3420
3414
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
3421
3415
|
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"),
|
|
3423
|
-
let DataValidationCustomFormulaService = (
|
|
3416
|
+
}, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"), _a10;
|
|
3417
|
+
let DataValidationCustomFormulaService = (_a10 = class extends Disposable {
|
|
3424
3418
|
constructor(_instanceSrv, _registerOtherFormulaService, _lexerTreeBuilder, _dataValidationModel, _dataValidationCacheService) {
|
|
3425
3419
|
super();
|
|
3426
3420
|
__publicField(this, "_formulaMap", /* @__PURE__ */ new Map());
|
|
@@ -3442,8 +3436,8 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
|
|
|
3442
3436
|
for (const subUnitId in unitMap) {
|
|
3443
3437
|
const results = unitMap[subUnitId], { formulaCellMap, ruleFormulaMap } = this._ensureMaps(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
|
|
3444
3438
|
results.forEach((result) => {
|
|
3445
|
-
var
|
|
3446
|
-
const ruleInfo = ruleFormulaMap.get((
|
|
3439
|
+
var _a22, _b;
|
|
3440
|
+
const ruleInfo = ruleFormulaMap.get((_a22 = result.extra) == null ? void 0 : _a22.ruleId), cellInfo = formulaCellMap.get(result.formulaId), rule = manager.getRuleById((_b = result.extra) == null ? void 0 : _b.ruleId);
|
|
3447
3441
|
rule && ruleInfo && !ruleInfo.isTransformable && this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges), cellInfo && this._dataValidationCacheService.markCellDirty(unitId, subUnitId, cellInfo.row, cellInfo.column);
|
|
3448
3442
|
});
|
|
3449
3443
|
}
|
|
@@ -3532,8 +3526,8 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
|
|
|
3532
3526
|
});
|
|
3533
3527
|
}), newRanges.forEach((range) => {
|
|
3534
3528
|
Range.foreach(range, (row, col) => {
|
|
3535
|
-
var
|
|
3536
|
-
const oldValue = (
|
|
3529
|
+
var _a22;
|
|
3530
|
+
const oldValue = (_a22 = formulaMap.getValue(row, col)) != null ? _a22 : {};
|
|
3537
3531
|
if (oldValue.ruleId !== ruleId) {
|
|
3538
3532
|
const oldRuleFormula = ruleFormulaMap.get(oldValue.ruleId);
|
|
3539
3533
|
if (oldRuleFormula != null && oldRuleFormula.isTransformable && deleteFormulaIdList.add(oldValue.formulaId), isTransformable) {
|
|
@@ -3573,7 +3567,7 @@ let DataValidationCustomFormulaService = (_a11 = class extends Disposable {
|
|
|
3573
3567
|
const { ruleFormulaMap } = this._ensureMaps(unitId, subUnitId);
|
|
3574
3568
|
return ruleFormulaMap.get(ruleId);
|
|
3575
3569
|
}
|
|
3576
|
-
}, __name(
|
|
3570
|
+
}, __name(_a10, "DataValidationCustomFormulaService"), _a10);
|
|
3577
3571
|
DataValidationCustomFormulaService = __decorateClass$b([
|
|
3578
3572
|
__decorateParam$b(0, IUniverInstanceService),
|
|
3579
3573
|
__decorateParam$b(1, Inject(RegisterOtherFormulaService)),
|
|
@@ -3652,10 +3646,10 @@ const _WholeValidator = class _WholeValidator extends BaseDataValidator {
|
|
|
3652
3646
|
return formula == null ? Number.NaN : +formula;
|
|
3653
3647
|
}
|
|
3654
3648
|
async parseFormula(rule, unitId, subUnitId) {
|
|
3655
|
-
var
|
|
3649
|
+
var _a22, _b, _c, _d, _e, _f, _g, _h;
|
|
3656
3650
|
const formulaInfo = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid), { formula1, formula2 } = rule;
|
|
3657
3651
|
return {
|
|
3658
|
-
formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (
|
|
3652
|
+
formula1: this._parseNumber(isFormulaString(formula1) ? (_d = (_c = (_b = (_a22 = formulaInfo == null ? void 0 : formulaInfo[0]) == null ? void 0 : _a22.result) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.v : formula1),
|
|
3659
3653
|
formula2: this._parseNumber(isFormulaString(formula2) ? (_h = (_g = (_f = (_e = formulaInfo == null ? void 0 : formulaInfo[1]) == null ? void 0 : _e.result) == null ? void 0 : _f[0]) == null ? void 0 : _g[0]) == null ? void 0 : _h.v : formula2)
|
|
3660
3654
|
};
|
|
3661
3655
|
}
|
|
@@ -3778,8 +3772,8 @@ var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPrope
|
|
|
3778
3772
|
return kind && result && __defProp$a(target, key, result), result;
|
|
3779
3773
|
}, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a");
|
|
3780
3774
|
const downPath = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
|
|
3781
|
-
var
|
|
3782
|
-
let DropdownMultipleWidget = (
|
|
3775
|
+
var _a11;
|
|
3776
|
+
let DropdownMultipleWidget = (_a11 = class {
|
|
3783
3777
|
constructor(_commandService) {
|
|
3784
3778
|
__publicField(this, "zIndex");
|
|
3785
3779
|
__publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
|
@@ -3807,7 +3801,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
|
3807
3801
|
}
|
|
3808
3802
|
// eslint-disable-next-line max-lines-per-function
|
|
3809
3803
|
drawWith(ctx, info, skeleton, spreadsheets) {
|
|
3810
|
-
var
|
|
3804
|
+
var _a22, _b;
|
|
3811
3805
|
const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, validation = data.dataValidation, map = this._ensureMap(subUnitId), key = this._generateKey(row, col);
|
|
3812
3806
|
if (!validation)
|
|
3813
3807
|
return;
|
|
@@ -3816,7 +3810,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
|
3816
3810
|
endX: _cellBounding.endX - rightOffset,
|
|
3817
3811
|
startY: _cellBounding.startY + topOffset,
|
|
3818
3812
|
endY: _cellBounding.endY - downOffset
|
|
3819
|
-
}, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, { cl } = style || {}, color = (
|
|
3813
|
+
}, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, { cl } = style || {}, color = (_a22 = typeof cl == "object" ? cl == null ? void 0 : cl.rgb : cl) != null ? _a22 : "#000", fontStyle = getFontStyleString(style != null ? style : void 0), { rule, validator: _validator } = validation, validator = _validator, { vt: _vt, ht } = style || {}, vt = _vt != null ? _vt : VerticalAlign.MIDDLE, cellValue = (_b = getCellValueOrigin(data)) != null ? _b : "", items = validator.parseCellValue(cellValue), labelColorMap = validator.getListWithColorMap(rule), layout = layoutDropdowns(items, fontStyle, cellWidth, cellHeight);
|
|
3820
3814
|
this._drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, vt), ctx.save(), ctx.translateWithPrecision(cellBounding.startX, cellBounding.startY), ctx.beginPath(), ctx.rect(0, 0, cellWidth - ICON_PLACE, cellHeight), ctx.clip(), ctx.translateWithPrecision(CELL_PADDING_H, CELL_PADDING_V);
|
|
3821
3815
|
let top = 0;
|
|
3822
3816
|
switch (vt) {
|
|
@@ -3855,7 +3849,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
|
3855
3849
|
});
|
|
3856
3850
|
}
|
|
3857
3851
|
calcCellAutoHeight(info) {
|
|
3858
|
-
var
|
|
3852
|
+
var _a22;
|
|
3859
3853
|
const { primaryWithCoord, style, data } = info, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, cellBounding = {
|
|
3860
3854
|
startX: _cellBounding.startX + leftOffset,
|
|
3861
3855
|
endX: _cellBounding.endX - rightOffset,
|
|
@@ -3864,7 +3858,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
|
3864
3858
|
}, validation = data.dataValidation;
|
|
3865
3859
|
if (!validation)
|
|
3866
3860
|
return;
|
|
3867
|
-
const cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, cellValue = (
|
|
3861
|
+
const cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, cellValue = (_a22 = getCellValueOrigin(data)) != null ? _a22 : "", { validator: _validator } = validation, items = _validator.parseCellValue(cellValue), fontStyle = getFontStyleString(style != null ? style : void 0);
|
|
3868
3862
|
return layoutDropdowns(items, fontStyle, cellWidth, cellHeight).cellAutoHeight;
|
|
3869
3863
|
}
|
|
3870
3864
|
isHit(position, info) {
|
|
@@ -3882,7 +3876,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
|
3882
3876
|
};
|
|
3883
3877
|
this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
|
|
3884
3878
|
}
|
|
3885
|
-
}, __name(
|
|
3879
|
+
}, __name(_a11, "DropdownMultipleWidget"), _a11);
|
|
3886
3880
|
DropdownMultipleWidget = __decorateClass$a([
|
|
3887
3881
|
__decorateParam$a(0, ICommandService)
|
|
3888
3882
|
], DropdownMultipleWidget);
|
|
@@ -3903,13 +3897,13 @@ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPrope
|
|
|
3903
3897
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3904
3898
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
3905
3899
|
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"),
|
|
3907
|
-
let DataValidationController = (
|
|
3908
|
-
constructor(_univerInstanceService,
|
|
3909
|
-
super(), this._univerInstanceService = _univerInstanceService, this.
|
|
3900
|
+
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a12;
|
|
3901
|
+
let DataValidationController = (_a12 = class extends RxDisposable {
|
|
3902
|
+
constructor(_univerInstanceService, _dataValidatorRegistryService, _injector, _componentManger, _selectionManagerService, _sheetInterceptorService, _dataValidationModel) {
|
|
3903
|
+
super(), this._univerInstanceService = _univerInstanceService, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._injector = _injector, this._componentManger = _componentManger, this._selectionManagerService = _selectionManagerService, this._sheetInterceptorService = _sheetInterceptorService, this._dataValidationModel = _dataValidationModel, this._init();
|
|
3910
3904
|
}
|
|
3911
3905
|
_init() {
|
|
3912
|
-
this._registerValidators(), this.
|
|
3906
|
+
this._registerValidators(), this._initCommandInterceptor(), this._initComponents();
|
|
3913
3907
|
}
|
|
3914
3908
|
_registerValidators() {
|
|
3915
3909
|
[
|
|
@@ -3932,31 +3926,15 @@ let DataValidationController = (_a13 = class extends RxDisposable {
|
|
|
3932
3926
|
});
|
|
3933
3927
|
});
|
|
3934
3928
|
}
|
|
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
3929
|
_initCommandInterceptor() {
|
|
3952
3930
|
this._sheetInterceptorService.interceptCommand({
|
|
3953
3931
|
getMutations: /* @__PURE__ */ __name((commandInfo) => {
|
|
3954
|
-
var
|
|
3932
|
+
var _a22;
|
|
3955
3933
|
if (commandInfo.id === ClearSelectionAllCommand.id) {
|
|
3956
3934
|
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), unitId = workbook.getUnitId(), worksheet = workbook.getActiveSheet();
|
|
3957
3935
|
if (!worksheet)
|
|
3958
3936
|
throw new Error("No active sheet found");
|
|
3959
|
-
const subUnitId = worksheet.getSheetId(), selections = (
|
|
3937
|
+
const subUnitId = worksheet.getSheetId(), selections = (_a22 = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : _a22.map((s) => s.range), manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleMatrix = manager.getRuleObjectMatrix().clone();
|
|
3960
3938
|
selections && ruleMatrix.removeRange(selections);
|
|
3961
3939
|
const diffs = ruleMatrix.diff(manager.getDataValidations()), { redoMutations, undoMutations } = getDataValidationDiffMutations(unitId, subUnitId, diffs, this._injector, "patched");
|
|
3962
3940
|
return {
|
|
@@ -3988,17 +3966,16 @@ let DataValidationController = (_a13 = class extends RxDisposable {
|
|
|
3988
3966
|
));
|
|
3989
3967
|
});
|
|
3990
3968
|
}
|
|
3991
|
-
}, __name(
|
|
3969
|
+
}, __name(_a12, "DataValidationController"), _a12);
|
|
3992
3970
|
DataValidationController = __decorateClass$9([
|
|
3993
3971
|
OnLifecycle(LifecycleStages.Rendered, DataValidationController),
|
|
3994
3972
|
__decorateParam$9(0, IUniverInstanceService),
|
|
3995
|
-
__decorateParam$9(1, Inject(
|
|
3996
|
-
__decorateParam$9(2, Inject(
|
|
3997
|
-
__decorateParam$9(3, Inject(
|
|
3998
|
-
__decorateParam$9(4, Inject(
|
|
3999
|
-
__decorateParam$9(5, Inject(
|
|
4000
|
-
__decorateParam$9(6, Inject(
|
|
4001
|
-
__decorateParam$9(7, Inject(DataValidationModel))
|
|
3973
|
+
__decorateParam$9(1, Inject(DataValidatorRegistryService)),
|
|
3974
|
+
__decorateParam$9(2, Inject(Injector)),
|
|
3975
|
+
__decorateParam$9(3, Inject(ComponentManager)),
|
|
3976
|
+
__decorateParam$9(4, Inject(SheetsSelectionsService)),
|
|
3977
|
+
__decorateParam$9(5, Inject(SheetInterceptorService)),
|
|
3978
|
+
__decorateParam$9(6, Inject(DataValidationModel))
|
|
4002
3979
|
], DataValidationController);
|
|
4003
3980
|
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
4004
3981
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -4006,8 +3983,8 @@ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPrope
|
|
|
4006
3983
|
return kind && result && __defProp$8(target, key, result), result;
|
|
4007
3984
|
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8");
|
|
4008
3985
|
const ALERT_KEY = "SHEET_DATA_VALIDATION_ALERT";
|
|
4009
|
-
var
|
|
4010
|
-
let DataValidationAlertController = (
|
|
3986
|
+
var _a13;
|
|
3987
|
+
let DataValidationAlertController = (_a13 = class extends Disposable {
|
|
4011
3988
|
constructor(_hoverManagerService, _cellAlertManagerService, _univerInstanceService, _localeService) {
|
|
4012
3989
|
super(), this._hoverManagerService = _hoverManagerService, this._cellAlertManagerService = _cellAlertManagerService, this._univerInstanceService = _univerInstanceService, this._localeService = _localeService, this._init();
|
|
4013
3990
|
}
|
|
@@ -4016,12 +3993,12 @@ let DataValidationAlertController = (_a14 = class extends Disposable {
|
|
|
4016
3993
|
}
|
|
4017
3994
|
_initCellAlertPopup() {
|
|
4018
3995
|
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(debounceTime(100)).subscribe((cellPos) => {
|
|
4019
|
-
var
|
|
3996
|
+
var _a22, _b;
|
|
4020
3997
|
if (cellPos) {
|
|
4021
3998
|
const worksheet = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
|
|
4022
3999
|
if (!worksheet) return;
|
|
4023
4000
|
const cellData = worksheet.getCell(cellPos.location.row, cellPos.location.col);
|
|
4024
|
-
if (((
|
|
4001
|
+
if (((_a22 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a22.validStatus) === DataValidationStatus.INVALID) {
|
|
4025
4002
|
const currentAlert = this._cellAlertManagerService.currentAlert.get(ALERT_KEY), currentLoc = (_b = currentAlert == null ? void 0 : currentAlert.alert) == null ? void 0 : _b.location;
|
|
4026
4003
|
if (currentLoc && currentLoc.row === cellPos.location.row && currentLoc.col === cellPos.location.col && currentLoc.subUnitId === cellPos.location.subUnitId && currentLoc.unitId === cellPos.location.unitId)
|
|
4027
4004
|
return;
|
|
@@ -4043,7 +4020,7 @@ let DataValidationAlertController = (_a14 = class extends Disposable {
|
|
|
4043
4020
|
this._cellAlertManagerService.removeAlert(ALERT_KEY);
|
|
4044
4021
|
}));
|
|
4045
4022
|
}
|
|
4046
|
-
}, __name(
|
|
4023
|
+
}, __name(_a13, "DataValidationAlertController"), _a13);
|
|
4047
4024
|
DataValidationAlertController = __decorateClass$8([
|
|
4048
4025
|
OnLifecycle(LifecycleStages.Rendered, DataValidationAlertController),
|
|
4049
4026
|
__decorateParam$8(0, Inject(HoverManagerService)),
|
|
@@ -4055,8 +4032,8 @@ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPrope
|
|
|
4055
4032
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4056
4033
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4057
4034
|
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"),
|
|
4059
|
-
let DataValidationRefRangeController = (
|
|
4035
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a14;
|
|
4036
|
+
let DataValidationRefRangeController = (_a14 = class extends Disposable {
|
|
4060
4037
|
constructor(_dataValidationModel, _injector, _refRangeService, _dataValidationCustomFormulaService, _dataValidationFormulaService, _formulaRefRangeService) {
|
|
4061
4038
|
super();
|
|
4062
4039
|
__publicField(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
@@ -4070,8 +4047,8 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
|
|
|
4070
4047
|
}
|
|
4071
4048
|
// eslint-disable-next-line max-lines-per-function
|
|
4072
4049
|
registerFormula(unitId, subUnitId, rule) {
|
|
4073
|
-
var
|
|
4074
|
-
const ruleId = rule.uid, id = this._getIdWithUnitId(unitId, subUnitId, ruleId), disposeSet = (
|
|
4050
|
+
var _a22;
|
|
4051
|
+
const ruleId = rule.uid, id = this._getIdWithUnitId(unitId, subUnitId, ruleId), disposeSet = (_a22 = this._disposableMap.get(id)) != null ? _a22 : /* @__PURE__ */ new Set(), handleFormulaChange = /* @__PURE__ */ __name((type, formulaString) => {
|
|
4075
4052
|
const oldRule = this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
|
|
4076
4053
|
if (!oldRule)
|
|
4077
4054
|
return { redos: [], undos: [] };
|
|
@@ -4148,7 +4125,7 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
|
|
|
4148
4125
|
}
|
|
4149
4126
|
}
|
|
4150
4127
|
register(unitId, subUnitId, rule) {
|
|
4151
|
-
var
|
|
4128
|
+
var _a22;
|
|
4152
4129
|
const handleRangeChange = /* @__PURE__ */ __name((commandInfo) => {
|
|
4153
4130
|
const oldRanges = [...rule.ranges], resultRanges = oldRanges.map((range) => handleCommonDefaultRangeChangeWithEffectRefCommands(range, commandInfo)).filter((range) => !!range).flat();
|
|
4154
4131
|
if (isRangesEqual(resultRanges, oldRanges))
|
|
@@ -4186,7 +4163,7 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
|
|
|
4186
4163
|
const disposable = this._refRangeService.registerRefRange(range, handleRangeChange, unitId, subUnitId);
|
|
4187
4164
|
disposeList.push(() => disposable.dispose());
|
|
4188
4165
|
});
|
|
4189
|
-
const id = this._getIdWithUnitId(unitId, subUnitId, rule.uid), current = (
|
|
4166
|
+
const id = this._getIdWithUnitId(unitId, subUnitId, rule.uid), current = (_a22 = this._disposableMap.get(id)) != null ? _a22 : /* @__PURE__ */ new Set();
|
|
4190
4167
|
current.add(() => disposeList.forEach((dispose) => dispose())), this._disposableMap.set(id, current);
|
|
4191
4168
|
}
|
|
4192
4169
|
_initRefRange() {
|
|
@@ -4217,7 +4194,7 @@ let DataValidationRefRangeController = (_a15 = class extends Disposable {
|
|
|
4217
4194
|
}), this._disposableMap.clear();
|
|
4218
4195
|
}));
|
|
4219
4196
|
}
|
|
4220
|
-
}, __name(
|
|
4197
|
+
}, __name(_a14, "DataValidationRefRangeController"), _a14);
|
|
4221
4198
|
DataValidationRefRangeController = __decorateClass$7([
|
|
4222
4199
|
OnLifecycle(LifecycleStages.Starting, DataValidationRefRangeController),
|
|
4223
4200
|
__decorateParam$7(0, Inject(DataValidationModel)),
|
|
@@ -4231,8 +4208,8 @@ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPrope
|
|
|
4231
4208
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4232
4209
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4233
4210
|
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"),
|
|
4235
|
-
let DataValidationAutoFillController = (
|
|
4211
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a15;
|
|
4212
|
+
let DataValidationAutoFillController = (_a15 = class extends Disposable {
|
|
4236
4213
|
constructor(_autoFillService, _dataValidationModel, _injector) {
|
|
4237
4214
|
super(), this._autoFillService = _autoFillService, this._dataValidationModel = _dataValidationModel, this._injector = _injector, this._initAutoFill();
|
|
4238
4215
|
}
|
|
@@ -4305,7 +4282,7 @@ let DataValidationAutoFillController = (_a16 = class extends Disposable {
|
|
|
4305
4282
|
};
|
|
4306
4283
|
this.disposeWithMe(this._autoFillService.addHook(hook));
|
|
4307
4284
|
}
|
|
4308
|
-
}, __name(
|
|
4285
|
+
}, __name(_a15, "DataValidationAutoFillController"), _a15);
|
|
4309
4286
|
DataValidationAutoFillController = __decorateClass$6([
|
|
4310
4287
|
OnLifecycle(LifecycleStages.Ready, DataValidationAutoFillController),
|
|
4311
4288
|
__decorateParam$6(0, IAutoFillService),
|
|
@@ -4316,8 +4293,8 @@ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPrope
|
|
|
4316
4293
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4317
4294
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4318
4295
|
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"),
|
|
4320
|
-
let DataValidationCopyPasteController = (
|
|
4296
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a16;
|
|
4297
|
+
let DataValidationCopyPasteController = (_a16 = class extends Disposable {
|
|
4321
4298
|
constructor(_sheetClipboardService, _dataValidationModel, _injector) {
|
|
4322
4299
|
super();
|
|
4323
4300
|
__publicField(this, "_copyInfo");
|
|
@@ -4340,9 +4317,7 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
|
|
|
4340
4317
|
subUnitId,
|
|
4341
4318
|
matrix
|
|
4342
4319
|
};
|
|
4343
|
-
const manager = this._dataValidationModel.ensureManager(unitId, subUnitId),
|
|
4344
|
-
get: this._injector.get.bind(this._injector)
|
|
4345
|
-
}, discreteRange = rangeToDiscreteRange(range, accessor, unitId, subUnitId);
|
|
4320
|
+
const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), discreteRange = this._injector.invoke((accessor) => rangeToDiscreteRange(range, accessor, unitId, subUnitId));
|
|
4346
4321
|
if (!discreteRange)
|
|
4347
4322
|
return;
|
|
4348
4323
|
const { rows, cols } = discreteRange;
|
|
@@ -4374,8 +4349,8 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
|
|
|
4374
4349
|
if (copyInfo.unitId !== unitId || subUnitId !== copyInfo.subUnitId) {
|
|
4375
4350
|
const originManager = this._dataValidationModel.ensureManager(unitId, subUnitId), manager = this._dataValidationModel.ensureManager(copyInfo.unitId, copyInfo.subUnitId), ruleMatrix = manager.getRuleObjectMatrix().clone(), { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]), repeatRange = getRepeatRange(vCopyRange, vPastedRange, !0), additionRules = /* @__PURE__ */ new Map();
|
|
4376
4351
|
repeatRange.forEach(({ startRange }) => {
|
|
4377
|
-
var
|
|
4378
|
-
(
|
|
4352
|
+
var _a22;
|
|
4353
|
+
(_a22 = this._copyInfo) == null || _a22.matrix.forValue((row, col, ruleId) => {
|
|
4379
4354
|
const range = Rectangle.getPositionRange(
|
|
4380
4355
|
{
|
|
4381
4356
|
startRow: row,
|
|
@@ -4404,8 +4379,8 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
|
|
|
4404
4379
|
} else {
|
|
4405
4380
|
const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleMatrix = manager.getRuleObjectMatrix().clone(), { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]);
|
|
4406
4381
|
getRepeatRange(vCopyRange, vPastedRange, !0).forEach(({ startRange }) => {
|
|
4407
|
-
var
|
|
4408
|
-
(
|
|
4382
|
+
var _a22;
|
|
4383
|
+
(_a22 = this._copyInfo) == null || _a22.matrix.forValue((row, col, ruleId) => {
|
|
4409
4384
|
const range = Rectangle.getPositionRange(
|
|
4410
4385
|
{
|
|
4411
4386
|
startRow: row,
|
|
@@ -4431,7 +4406,7 @@ let DataValidationCopyPasteController = (_a17 = class extends Disposable {
|
|
|
4431
4406
|
};
|
|
4432
4407
|
}
|
|
4433
4408
|
}
|
|
4434
|
-
}, __name(
|
|
4409
|
+
}, __name(_a16, "DataValidationCopyPasteController"), _a16);
|
|
4435
4410
|
DataValidationCopyPasteController = __decorateClass$5([
|
|
4436
4411
|
OnLifecycle(LifecycleStages.Ready, DataValidationCopyPasteController),
|
|
4437
4412
|
__decorateParam$5(0, ISheetClipboardService),
|
|
@@ -4556,9 +4531,9 @@ const _SheetDataValidationManager = class _SheetDataValidationManager extends Da
|
|
|
4556
4531
|
this._ruleMatrix = new RuleMatrix(matrix, worksheet);
|
|
4557
4532
|
}
|
|
4558
4533
|
_addRuleSideEffect(rule) {
|
|
4559
|
-
var
|
|
4534
|
+
var _a22;
|
|
4560
4535
|
const { unitId, subUnitId } = this;
|
|
4561
|
-
(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) && isReferenceString((
|
|
4536
|
+
(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) && isReferenceString((_a22 = rule.formula1) != null ? _a22 : "") && (rule.formula1 = `=${rule.formula1}`), this._ruleMatrix.addRule(rule), this._dataValidationCacheService.addRule(unitId, subUnitId, rule), this._dataValidationFormulaService.addRule(unitId, subUnitId, rule.uid, rule.formula1, rule.formula2), this._dataValidationCustomFormulaService.addRule(unitId, subUnitId, rule);
|
|
4562
4537
|
}
|
|
4563
4538
|
addRule(rule, index) {
|
|
4564
4539
|
(Array.isArray(rule) ? rule : [rule]).forEach((item) => {
|
|
@@ -4594,7 +4569,18 @@ const _SheetDataValidationManager = class _SheetDataValidationManager extends Da
|
|
|
4594
4569
|
value: cellValue,
|
|
4595
4570
|
status: DataValidationStatus.VALIDATING,
|
|
4596
4571
|
ruleId
|
|
4597
|
-
}), validator.validator(
|
|
4572
|
+
}), validator.validator(
|
|
4573
|
+
{
|
|
4574
|
+
value: cellValue,
|
|
4575
|
+
unitId,
|
|
4576
|
+
subUnitId,
|
|
4577
|
+
row,
|
|
4578
|
+
column: col,
|
|
4579
|
+
worksheet: pos.worksheet,
|
|
4580
|
+
workbook: pos.workbook
|
|
4581
|
+
},
|
|
4582
|
+
rule
|
|
4583
|
+
).then((status) => {
|
|
4598
4584
|
const realStatus = status ? DataValidationStatus.VALID : DataValidationStatus.INVALID;
|
|
4599
4585
|
this._cache.setValue(row, col, {
|
|
4600
4586
|
value: cellValue,
|
|
@@ -4622,8 +4608,8 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
|
|
|
4622
4608
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4623
4609
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4624
4610
|
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"),
|
|
4626
|
-
let DataValidationModelController = (
|
|
4611
|
+
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a17;
|
|
4612
|
+
let DataValidationModelController = (_a17 = class extends Disposable {
|
|
4627
4613
|
constructor(_resourceManagerService, _univerInstanceService, _dataValidationModel, _injector) {
|
|
4628
4614
|
super(), this._resourceManagerService = _resourceManagerService, this._univerInstanceService = _univerInstanceService, this._dataValidationModel = _dataValidationModel, this._injector = _injector, this._initDataValidationDataSource();
|
|
4629
4615
|
}
|
|
@@ -4637,7 +4623,7 @@ let DataValidationModelController = (_a18 = class extends Disposable {
|
|
|
4637
4623
|
_initDataValidationDataSource() {
|
|
4638
4624
|
this._dataValidationModel.setManagerCreator(this._createSheetDataValidationManager.bind(this));
|
|
4639
4625
|
}
|
|
4640
|
-
}, __name(
|
|
4626
|
+
}, __name(_a17, "DataValidationModelController"), _a17);
|
|
4641
4627
|
DataValidationModelController = __decorateClass$4([
|
|
4642
4628
|
OnLifecycle(LifecycleStages.Starting, DataValidationModelController),
|
|
4643
4629
|
__decorateParam$4(0, IResourceManagerService),
|
|
@@ -4649,8 +4635,8 @@ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPrope
|
|
|
4649
4635
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4650
4636
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4651
4637
|
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"),
|
|
4653
|
-
let DataValidationPermissionController = (
|
|
4638
|
+
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a18;
|
|
4639
|
+
let DataValidationPermissionController = (_a18 = class extends Disposable {
|
|
4654
4640
|
constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
|
|
4655
4641
|
super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
|
|
4656
4642
|
}
|
|
@@ -4669,7 +4655,7 @@ let DataValidationPermissionController = (_a19 = class extends Disposable {
|
|
|
4669
4655
|
})
|
|
4670
4656
|
);
|
|
4671
4657
|
}
|
|
4672
|
-
}, __name(
|
|
4658
|
+
}, __name(_a18, "DataValidationPermissionController"), _a18);
|
|
4673
4659
|
DataValidationPermissionController = __decorateClass$3([
|
|
4674
4660
|
OnLifecycle(LifecycleStages.Ready, DataValidationPermissionController),
|
|
4675
4661
|
__decorateParam$3(0, Inject(LocaleService)),
|
|
@@ -4680,8 +4666,8 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
|
|
|
4680
4666
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4681
4667
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4682
4668
|
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"),
|
|
4684
|
-
let SheetsDataValidationValidatorService = (
|
|
4669
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a19;
|
|
4670
|
+
let SheetsDataValidationValidatorService = (_a19 = class {
|
|
4685
4671
|
constructor(_univerInstanceService, _dataValidationModel, _dataValidationCacheService) {
|
|
4686
4672
|
this._univerInstanceService = _univerInstanceService, this._dataValidationModel = _dataValidationModel, this._dataValidationCacheService = _dataValidationCacheService;
|
|
4687
4673
|
}
|
|
@@ -4694,9 +4680,17 @@ let SheetsDataValidationValidatorService = (_a20 = class {
|
|
|
4694
4680
|
throw new Error(`cannot find current worksheet, sheetId: ${subUnitId}`);
|
|
4695
4681
|
const cellRaw = worksheet.getCellRaw(row, col), manager = this._dataValidationModel.ensureManager(unitId, subUnitId), rule = manager.getRuleByLocation(row, col);
|
|
4696
4682
|
return rule ? new Promise((resolve) => {
|
|
4697
|
-
manager.validator(getCellValueOrigin(cellRaw), rule, { unitId, subUnitId, row, col }, resolve);
|
|
4683
|
+
manager.validator(getCellValueOrigin(cellRaw), rule, { unitId, subUnitId, row, col, worksheet, workbook }, resolve);
|
|
4698
4684
|
}) : DataValidationStatus.VALID;
|
|
4699
4685
|
}
|
|
4686
|
+
validatorRanges(unitId, subUnitId, ranges) {
|
|
4687
|
+
return Promise.all(ranges.map((range) => {
|
|
4688
|
+
const promises = [];
|
|
4689
|
+
return Range.foreach(range, (row, col) => {
|
|
4690
|
+
promises.push(this.validatorCell(unitId, subUnitId, row, col));
|
|
4691
|
+
}), promises;
|
|
4692
|
+
}));
|
|
4693
|
+
}
|
|
4700
4694
|
async validatorWorksheet(unitId, subUnitId) {
|
|
4701
4695
|
const rules = this._dataValidationModel.ensureManager(unitId, subUnitId).getDataValidations();
|
|
4702
4696
|
return await Promise.all(rules.map((rule) => Promise.all(rule.ranges.map((range) => {
|
|
@@ -4712,7 +4706,19 @@ let SheetsDataValidationValidatorService = (_a20 = class {
|
|
|
4712
4706
|
map[sheetIds[i]] = result;
|
|
4713
4707
|
}), map;
|
|
4714
4708
|
}
|
|
4715
|
-
|
|
4709
|
+
getDataValidations(unitId, subUnitId, ranges) {
|
|
4710
|
+
const manager = this._dataValidationModel.ensureManager(unitId, subUnitId), ruleMatrix = manager.getRuleObjectMatrix(), ruleIdSet = /* @__PURE__ */ new Set();
|
|
4711
|
+
return ranges.forEach((range) => {
|
|
4712
|
+
Range.foreach(range, (row, col) => {
|
|
4713
|
+
const ruleId = ruleMatrix.getValue(row, col);
|
|
4714
|
+
ruleId && ruleIdSet.add(ruleId);
|
|
4715
|
+
});
|
|
4716
|
+
}), Array.from(ruleIdSet).map((id) => manager.getRuleById(id)).filter(Boolean);
|
|
4717
|
+
}
|
|
4718
|
+
getDataValidation(unitId, subUnitId, ranges) {
|
|
4719
|
+
return this.getDataValidations(unitId, subUnitId, ranges)[0];
|
|
4720
|
+
}
|
|
4721
|
+
}, __name(_a19, "SheetsDataValidationValidatorService"), _a19);
|
|
4716
4722
|
SheetsDataValidationValidatorService = __decorateClass$2([
|
|
4717
4723
|
__decorateParam$2(0, IUniverInstanceService),
|
|
4718
4724
|
__decorateParam$2(1, Inject(DataValidationModel)),
|
|
@@ -4722,15 +4728,14 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
4722
4728
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4723
4729
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4724
4730
|
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"),
|
|
4726
|
-
let UniverSheetsDataValidationPlugin = (
|
|
4731
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), __publicField$1 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField$1"), _a20;
|
|
4732
|
+
let UniverSheetsDataValidationPlugin = (_a20 = class extends Plugin {
|
|
4727
4733
|
constructor(_config = {}, _injector, _commandService, _localeService) {
|
|
4728
4734
|
super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._localeService = _localeService, this._config = Tools.deepMerge({}, DefaultSheetsDataValidation, this._config);
|
|
4729
4735
|
}
|
|
4730
4736
|
onStarting() {
|
|
4731
4737
|
[
|
|
4732
4738
|
[DataValidationPanelService],
|
|
4733
|
-
[SheetDataValidationService],
|
|
4734
4739
|
[DataValidationCacheService],
|
|
4735
4740
|
[DataValidationFormulaService],
|
|
4736
4741
|
[DataValidationCustomFormulaService],
|
|
@@ -4770,7 +4775,7 @@ let UniverSheetsDataValidationPlugin = (_a21 = class extends Plugin {
|
|
|
4770
4775
|
this._commandService.registerCommand(command);
|
|
4771
4776
|
});
|
|
4772
4777
|
}
|
|
4773
|
-
}, __name(
|
|
4778
|
+
}, __name(_a20, "UniverSheetsDataValidationPlugin"), _a20);
|
|
4774
4779
|
__publicField$1(UniverSheetsDataValidationPlugin, "pluginName", DATA_VALIDATION_PLUGIN_NAME);
|
|
4775
4780
|
__publicField$1(UniverSheetsDataValidationPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
4776
4781
|
UniverSheetsDataValidationPlugin = __decorateClass$1([
|
|
@@ -4783,15 +4788,14 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
|
|
|
4783
4788
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4784
4789
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4785
4790
|
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"),
|
|
4787
|
-
let UniverSheetsDataValidationMobilePlugin = (
|
|
4791
|
+
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a21;
|
|
4792
|
+
let UniverSheetsDataValidationMobilePlugin = (_a21 = class extends Plugin {
|
|
4788
4793
|
constructor(_config = {}, _injector, _commandService, _localeService) {
|
|
4789
4794
|
super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._localeService = _localeService, this._config = Tools.deepMerge({}, DefaultSheetsDataValidation, this._config);
|
|
4790
4795
|
}
|
|
4791
4796
|
onStarting() {
|
|
4792
4797
|
[
|
|
4793
4798
|
[DataValidationPanelService],
|
|
4794
|
-
[SheetDataValidationService],
|
|
4795
4799
|
[DataValidationCacheService],
|
|
4796
4800
|
[DataValidationFormulaService],
|
|
4797
4801
|
[DataValidationCustomFormulaService],
|
|
@@ -4827,7 +4831,7 @@ let UniverSheetsDataValidationMobilePlugin = (_a22 = class extends Plugin {
|
|
|
4827
4831
|
this._commandService.registerCommand(command);
|
|
4828
4832
|
});
|
|
4829
4833
|
}
|
|
4830
|
-
}, __name(
|
|
4834
|
+
}, __name(_a21, "UniverSheetsDataValidationMobilePlugin"), _a21);
|
|
4831
4835
|
__publicField2(UniverSheetsDataValidationMobilePlugin, "pluginName", DATA_VALIDATION_PLUGIN_NAME);
|
|
4832
4836
|
__publicField2(UniverSheetsDataValidationMobilePlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
4833
4837
|
UniverSheetsDataValidationMobilePlugin = __decorateClass([
|
|
@@ -4839,29 +4843,23 @@ UniverSheetsDataValidationMobilePlugin = __decorateClass([
|
|
|
4839
4843
|
export {
|
|
4840
4844
|
AddSheetDataValidationAndOpenCommand,
|
|
4841
4845
|
AddSheetDataValidationCommand,
|
|
4846
|
+
ClearRangeDataValidationCommand,
|
|
4842
4847
|
CloseValidationPanelOperation,
|
|
4843
4848
|
DATA_VALIDATION_PLUGIN_NAME,
|
|
4844
|
-
DataValidationAlertController,
|
|
4845
|
-
DataValidationAutoFillController,
|
|
4846
4849
|
DataValidationCacheService,
|
|
4847
|
-
DataValidationController,
|
|
4848
|
-
DataValidationCopyPasteController,
|
|
4849
4850
|
DataValidationCustomFormulaService,
|
|
4850
|
-
DataValidationFormulaController,
|
|
4851
4851
|
DataValidationFormulaService,
|
|
4852
|
-
|
|
4853
|
-
DataValidationRejectInputController,
|
|
4852
|
+
DataValidationModel2 as DataValidationModel,
|
|
4854
4853
|
HideDataValidationDropdown,
|
|
4855
|
-
ICommandService2 as ICommandService,
|
|
4856
|
-
LocaleService2 as LocaleService,
|
|
4857
4854
|
OpenValidationPanelOperation,
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
SheetsDataValidationRenderController,
|
|
4855
|
+
RemoveDataValidationCommand2 as RemoveSheetDataValidationCommand,
|
|
4856
|
+
SheetDataValidationManager,
|
|
4861
4857
|
SheetsDataValidationValidatorService,
|
|
4862
4858
|
ShowDataValidationDropdown,
|
|
4863
4859
|
ToggleValidationPanelOperation,
|
|
4864
4860
|
UniverSheetsDataValidationMobilePlugin,
|
|
4865
4861
|
UniverSheetsDataValidationPlugin,
|
|
4866
|
-
|
|
4862
|
+
UpdateSheetDataValidationOptionsCommand,
|
|
4863
|
+
UpdateSheetDataValidationRangeCommand,
|
|
4864
|
+
UpdateSheetDataValidationSettingCommand
|
|
4867
4865
|
};
|