@univerjs/sheets-data-validation 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +917 -895
- package/lib/umd/index.js +2 -2
- package/package.json +23 -23
package/lib/es/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
var $r = Object.defineProperty;
|
|
2
2
|
var Wr = (r, a, e) => a in r ? $r(r, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[a] = e;
|
|
3
|
-
var
|
|
4
|
-
import { Disposable as he, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Hr, DisposableCollection as Qa, IUniverInstanceService as
|
|
3
|
+
var g = (r, a, e) => Wr(r, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
+
import { Disposable as he, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Hr, DisposableCollection as Qa, IUniverInstanceService as te, UniverInstanceType as ae, toDisposable as ma, CommandType as ye, ICommandService as re, IUndoRedoService as Ka, sequenceExecuteAsync as Za, LocaleService as ie, DataValidationErrorStyle as at, UndoCommand as kr, RedoCommand as Yr, isUnitRangesEqual as Xr, createInternalEditorID as fa, isValidRange as Gr, debounce as qr, shallowEqual as Oa, DEFAULT_EMPTY_DOCUMENT_VALUE as Ja, OnLifecycle as ve, LifecycleStages as ge, IPermissionService as zr, isFormulaString as N, DataValidationType as X, Tools as B, ObjectMatrix as dt, Range as U, ThemeService as Qr, VerticalAlign as de, HorizontalAlign as Ae, DataValidationOperator as C, WrapStrategy as pe, DataValidationRenderMode as ce, DocumentDataModel as Kr, BooleanNumber as Je, Rectangle as xe, RxDisposable as er, DataValidationStatus as Re, sequenceExecute as Zr, isRangesEqual as Jr, queryObjectMatrix as At, IResourceManagerService as eo, DependentOn as to, Plugin as ao } from "@univerjs/core";
|
|
5
5
|
import { ICommandService as Dl, LocaleService as El, Plugin as Ol } from "@univerjs/core";
|
|
6
|
-
import { Inject as
|
|
7
|
-
import { DataValidatorRegistryService as De, DataValidationModel as K, AddDataValidationMutation as Jt, RemoveDataValidationMutation as
|
|
6
|
+
import { Inject as I, Injector as Ue } from "@wendellhu/redi";
|
|
7
|
+
import { DataValidatorRegistryService as De, DataValidationModel as K, AddDataValidationMutation as Jt, RemoveDataValidationMutation as yt, createDefaultNewRule as tr, UpdateDataValidationMutation as Xe, UpdateRuleType as Ie, DataValidatorRegistryScope as ro, TWO_FORMULA_OPERATOR_COUNT as oo, getRuleOptions as ba, getRuleSetting as Ta, UpdateDataValidationSettingCommand as Fa, RemoveDataValidationCommand as ar, UpdateDataValidationOptionsCommand as no, BaseDataValidator as $e, TextLengthErrorTitleMap as io, RemoveAllDataValidationCommand as so, removeDataValidationUndoFactory as lo, DataValidationManager as co, AddDataValidationCommand as uo, UniverDataValidationPlugin as ho } from "@univerjs/data-validation";
|
|
8
8
|
import { getSheetCommandTarget as rr, WorksheetViewPermission as mo, SetRangeValuesCommand as pa, WorkbookEditablePermission as ea, WorksheetSetCellStylePermission as ta, WorksheetEditPermission as aa, RangeProtectionPermissionEditPoint as ra, SelectionManagerService as fo, SheetInterceptorService as or, ClearSelectionAllCommand as po, INTERCEPTOR_POINT as vo, RefRangeService as go, handleCommonDefaultRangeChangeWithEffectRefCommands as _o, UniverSheetsPlugin as So } from "@univerjs/sheets";
|
|
9
|
-
import { SheetCanvasPopManagerService as Ro, IMarkSelectionService as Co, getCurrentRangeDisable$ as Vo, IEditorBridgeService as va, AutoHeightController as Mo, SheetSkeletonManagerService as
|
|
10
|
-
import { useObservable as Ze, ComponentManager as
|
|
11
|
-
import { IRenderManagerService as lr, fixLineWidthByScale as Aa, Transform as $o, Checkbox as Wo, getDocsSkeletonPageSize as
|
|
12
|
-
import na, { forwardRef as Ee, useRef as _a, createElement as Oe, useState as z, useMemo as
|
|
13
|
-
import { useDependency as
|
|
9
|
+
import { SheetCanvasPopManagerService as Ro, IMarkSelectionService as Co, getCurrentRangeDisable$ as Vo, IEditorBridgeService as va, AutoHeightController as Mo, SheetSkeletonManagerService as Na, HoverManagerService as wo, CellAlertManagerService as Io, CellAlertType as yo, IAutoFillService as Do, APPLY_TYPE as et, virtualizeDiscreteRanges as oa, getAutoFillRepeatRange as Eo, COPY_TYPE as La, rangeToDiscreteRange as Oo, PREDEFINED_HOOK_NAME as xt, getRepeatRange as Pa, ISheetClipboardService as bo, SheetPermissionInterceptorBaseController as To, UniverSheetsUIPlugin as Fo } from "@univerjs/sheets-ui";
|
|
10
|
+
import { useObservable as Ze, ComponentManager as ct, IZenZoneService as No, ISidebarService as nr, useEvent as ir, RangeSelector as Lo, TextEditor as sr, MenuItemType as ga, MenuPosition as Po, MenuGroup as Ao, getMenuHiddenObservable as xo, KeyCode as jo, IDialogService as Bo, IMenuService as Uo } from "@univerjs/ui";
|
|
11
|
+
import { IRenderManagerService as lr, fixLineWidthByScale as Aa, Transform as $o, Checkbox as Wo, getDocsSkeletonPageSize as ft, Rect as dr, DocumentViewModel as Ho, DocumentSkeleton as ko, Documents as Yo, FontCache as Xo, Shape as Go, getFontStyleString as xa, DeviceInputEventType as qo } from "@univerjs/engine-render";
|
|
12
|
+
import na, { forwardRef as Ee, useRef as _a, createElement as Oe, useState as z, useMemo as Dt, useEffect as qe } from "react";
|
|
13
|
+
import { useDependency as T } from "@wendellhu/redi/react-bindings";
|
|
14
14
|
import { FormLayout as Q, RadioGroup as Sa, Radio as Le, Checkbox as cr, Input as Pe, Select as ia, Button as ze, DraggableList as zo, RectPopup as Qo, Scrollbar as Ko, DatePanel as Zo } from "@univerjs/design";
|
|
15
15
|
import { serializeRange as ur, LexerTreeBuilder as Ra, deserializeRangeWithSheet as hr, isFormulaTransformable as Jo, transformFormula as ja, isReferenceString as Ca, sequenceNodeType as en } from "@univerjs/engine-formula";
|
|
16
16
|
import { Subject as mr, filter as tn, BehaviorSubject as Ba, distinctUntilChanged as an, debounceTime as rn } from "rxjs";
|
|
17
17
|
import on from "clsx";
|
|
18
18
|
import { RegisterOtherFormulaService as fr, FormulaRefRangeService as nn, SPECIAL_PASTE_FORMULA as sn } from "@univerjs/sheets-formula";
|
|
19
19
|
import je from "dayjs";
|
|
20
|
-
var pr = { exports: {} },
|
|
20
|
+
var pr = { exports: {} }, Pt = {};
|
|
21
21
|
/**
|
|
22
22
|
* @license React
|
|
23
23
|
* react-jsx-runtime.production.min.js
|
|
@@ -31,20 +31,17 @@ var ln = na, dn = Symbol.for("react.element"), cn = Symbol.for("react.fragment")
|
|
|
31
31
|
function vr(r, a, e) {
|
|
32
32
|
var t, o = {}, n = null, i = null;
|
|
33
33
|
e !== void 0 && (n = "" + e), a.key !== void 0 && (n = "" + a.key), a.ref !== void 0 && (i = a.ref);
|
|
34
|
-
for (t in a)
|
|
35
|
-
|
|
36
|
-
if (r && r.defaultProps)
|
|
37
|
-
for (t in a = r.defaultProps, a)
|
|
38
|
-
o[t] === void 0 && (o[t] = a[t]);
|
|
34
|
+
for (t in a) un.call(a, t) && !mn.hasOwnProperty(t) && (o[t] = a[t]);
|
|
35
|
+
if (r && r.defaultProps) for (t in a = r.defaultProps, a) o[t] === void 0 && (o[t] = a[t]);
|
|
39
36
|
return { $$typeof: dn, type: r, key: n, ref: i, props: o, _owner: hn.current };
|
|
40
37
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
pr.exports =
|
|
38
|
+
Pt.Fragment = cn;
|
|
39
|
+
Pt.jsx = vr;
|
|
40
|
+
Pt.jsxs = vr;
|
|
41
|
+
pr.exports = Pt;
|
|
45
42
|
var p = pr.exports;
|
|
46
43
|
function fn() {
|
|
47
|
-
const r =
|
|
44
|
+
const r = T(Be), a = Ze(r.activeDropdown$, r.activeDropdown), e = T(ct);
|
|
48
45
|
if (!a)
|
|
49
46
|
return null;
|
|
50
47
|
const { location: t, componentKey: o } = a, n = e.get(o), i = `${t.unitId}-${t.subUnitId}-${t.row}-${t.col}`;
|
|
@@ -71,11 +68,11 @@ var pn = Object.defineProperty, vn = Object.getOwnPropertyDescriptor, gn = (r, a
|
|
|
71
68
|
let Be = class extends he {
|
|
72
69
|
constructor(a, e, t, o, n, i) {
|
|
73
70
|
super();
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
g(this, "_activeDropdown");
|
|
72
|
+
g(this, "_activeDropdown$", new mr());
|
|
73
|
+
g(this, "_currentPopup", null);
|
|
74
|
+
g(this, "activeDropdown$", this._activeDropdown$.asObservable());
|
|
75
|
+
g(this, "_zenVisible", !1);
|
|
79
76
|
this._canvasPopupManagerService = a, this._univerInstanceService = e, this._dataValidatorRegistryService = t, this._zenZoneService = o, this._renderManagerService = n, this._dataValidationModel = i, this._init();
|
|
80
77
|
}
|
|
81
78
|
get activeDropdown() {
|
|
@@ -146,12 +143,12 @@ let Be = class extends he {
|
|
|
146
143
|
}
|
|
147
144
|
};
|
|
148
145
|
Be = gn([
|
|
149
|
-
We(0,
|
|
150
|
-
We(1,
|
|
151
|
-
We(2,
|
|
152
|
-
We(3,
|
|
146
|
+
We(0, I(Ro)),
|
|
147
|
+
We(1, te),
|
|
148
|
+
We(2, I(De)),
|
|
149
|
+
We(3, No),
|
|
153
150
|
We(4, lr),
|
|
154
|
-
We(5,
|
|
151
|
+
We(5, I(K))
|
|
155
152
|
], Be);
|
|
156
153
|
var _n = Object.defineProperty, Sn = Object.getOwnPropertyDescriptor, Rn = (r, a, e, t) => {
|
|
157
154
|
for (var o = t > 1 ? void 0 : t ? Sn(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
@@ -161,12 +158,12 @@ var _n = Object.defineProperty, Sn = Object.getOwnPropertyDescriptor, Rn = (r, a
|
|
|
161
158
|
let Ve = class extends he {
|
|
162
159
|
constructor(a, e) {
|
|
163
160
|
super();
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
161
|
+
g(this, "_open$", new Ba(!1));
|
|
162
|
+
g(this, "open$", this._open$.pipe(an()));
|
|
163
|
+
g(this, "_activeRule");
|
|
164
|
+
g(this, "_activeRule$", new Ba(void 0));
|
|
165
|
+
g(this, "activeRule$", this._activeRule$.asObservable());
|
|
166
|
+
g(this, "_closeDisposable", null);
|
|
170
167
|
this._univerInstanceService = a, this._sidebarService = e, this.disposeWithMe(
|
|
171
168
|
this._univerInstanceService.getCurrentTypeOfUnit$(ae.UNIVER_SHEET).pipe(tn((t) => !t)).subscribe(() => {
|
|
172
169
|
this.close();
|
|
@@ -200,31 +197,30 @@ let Ve = class extends he {
|
|
|
200
197
|
}
|
|
201
198
|
};
|
|
202
199
|
Ve = Rn([
|
|
203
|
-
Ua(0,
|
|
200
|
+
Ua(0, te),
|
|
204
201
|
Ua(1, nr)
|
|
205
202
|
], Ve);
|
|
206
|
-
const _r = "DataValidationPanel",
|
|
203
|
+
const _r = "DataValidationPanel", ut = {
|
|
207
204
|
id: "data-validation.operation.open-validation-panel",
|
|
208
205
|
type: ye.OPERATION,
|
|
209
206
|
handler(r, a) {
|
|
210
207
|
if (!a)
|
|
211
208
|
return !1;
|
|
212
|
-
const { ruleId: e, isAdd: t } = a, o = r.get(Ve), n = r.get(K), i = r.get(
|
|
213
|
-
if (!l)
|
|
214
|
-
return !1;
|
|
209
|
+
const { ruleId: e, isAdd: t } = a, o = r.get(Ve), n = r.get(K), i = r.get(te), s = r.get(nr), l = rr(i);
|
|
210
|
+
if (!l) return !1;
|
|
215
211
|
const { unitId: d, subUnitId: c } = l, u = e ? n.getRuleById(d, c, e) : void 0;
|
|
216
212
|
o.open(), o.setActiveRule(u && {
|
|
217
213
|
unitId: d,
|
|
218
214
|
subUnitId: c,
|
|
219
215
|
rule: u
|
|
220
216
|
});
|
|
221
|
-
const
|
|
217
|
+
const h = s.open({
|
|
222
218
|
header: { title: t ? "dataValidation.panel.addTitle" : "dataValidation.panel.title" },
|
|
223
219
|
children: { label: _r },
|
|
224
220
|
width: 312,
|
|
225
221
|
onClose: () => o.close()
|
|
226
222
|
});
|
|
227
|
-
return o.setCloseDisposable(
|
|
223
|
+
return o.setCloseDisposable(h), !0;
|
|
228
224
|
}
|
|
229
225
|
}, Sr = {
|
|
230
226
|
id: "data-validation.operation.close-validation-panel",
|
|
@@ -237,7 +233,7 @@ const _r = "DataValidationPanel", ct = {
|
|
|
237
233
|
type: ye.OPERATION,
|
|
238
234
|
handler(r) {
|
|
239
235
|
const a = r.get(re), e = r.get(Ve);
|
|
240
|
-
return e.open(), e.isOpen ? a.executeCommand(Sr.id) : a.executeCommand(
|
|
236
|
+
return e.open(), e.isOpen ? a.executeCommand(Sr.id) : a.executeCommand(ut.id), !0;
|
|
241
237
|
}
|
|
242
238
|
}, Va = {
|
|
243
239
|
type: ye.OPERATION,
|
|
@@ -266,7 +262,7 @@ function Qe(r, a, e) {
|
|
|
266
262
|
switch (n.type) {
|
|
267
263
|
case "delete":
|
|
268
264
|
t.push({
|
|
269
|
-
id:
|
|
265
|
+
id: yt.id,
|
|
270
266
|
params: {
|
|
271
267
|
unitId: r,
|
|
272
268
|
subUnitId: a,
|
|
@@ -284,7 +280,7 @@ function Qe(r, a, e) {
|
|
|
284
280
|
break;
|
|
285
281
|
case "update": {
|
|
286
282
|
t.push({
|
|
287
|
-
id:
|
|
283
|
+
id: Xe.id,
|
|
288
284
|
params: {
|
|
289
285
|
unitId: r,
|
|
290
286
|
subUnitId: a,
|
|
@@ -295,7 +291,7 @@ function Qe(r, a, e) {
|
|
|
295
291
|
}
|
|
296
292
|
}
|
|
297
293
|
}), o.unshift({
|
|
298
|
-
id:
|
|
294
|
+
id: Xe.id,
|
|
299
295
|
params: {
|
|
300
296
|
unitId: r,
|
|
301
297
|
subUnitId: a,
|
|
@@ -317,7 +313,7 @@ function Qe(r, a, e) {
|
|
|
317
313
|
rule: n.rule
|
|
318
314
|
}
|
|
319
315
|
}), o.unshift({
|
|
320
|
-
id:
|
|
316
|
+
id: yt.id,
|
|
321
317
|
params: {
|
|
322
318
|
unitId: r,
|
|
323
319
|
subUnitId: a,
|
|
@@ -341,14 +337,14 @@ const Ma = {
|
|
|
341
337
|
const { unitId: e, subUnitId: t, ranges: o, ruleId: n } = a, i = r.get(K), s = r.get(re), l = r.get(Ka), d = i.ensureManager(e, t), c = d.getRuleById(n);
|
|
342
338
|
if (!c)
|
|
343
339
|
return !1;
|
|
344
|
-
const u = c.ranges,
|
|
345
|
-
|
|
346
|
-
const f =
|
|
340
|
+
const u = c.ranges, h = d.getRuleObjectMatrix().clone();
|
|
341
|
+
h.updateRange(n, u, o);
|
|
342
|
+
const f = h.diff(d.getDataValidations()), { redoMutations: m, undoMutations: v } = Qe(e, t, f);
|
|
347
343
|
return l.pushUndoRedo({
|
|
348
|
-
undoMutations:
|
|
349
|
-
redoMutations:
|
|
344
|
+
undoMutations: v,
|
|
345
|
+
redoMutations: m,
|
|
350
346
|
unitID: e
|
|
351
|
-
}), await Za(
|
|
347
|
+
}), await Za(m, s), !0;
|
|
352
348
|
}
|
|
353
349
|
}, wa = {
|
|
354
350
|
type: ye.COMMAND,
|
|
@@ -362,12 +358,12 @@ const Ma = {
|
|
|
362
358
|
unitId: e,
|
|
363
359
|
subUnitId: t,
|
|
364
360
|
rule: o
|
|
365
|
-
}, { redoMutations:
|
|
366
|
-
return
|
|
361
|
+
}, { redoMutations: h, undoMutations: f } = Qe(e, t, c);
|
|
362
|
+
return h.push({
|
|
367
363
|
id: Jt.id,
|
|
368
364
|
params: u
|
|
369
365
|
}), f.unshift({
|
|
370
|
-
id:
|
|
366
|
+
id: yt.id,
|
|
371
367
|
params: {
|
|
372
368
|
unitId: e,
|
|
373
369
|
subUnitId: t,
|
|
@@ -375,23 +371,22 @@ const Ma = {
|
|
|
375
371
|
}
|
|
376
372
|
}), s.pushUndoRedo({
|
|
377
373
|
unitID: e,
|
|
378
|
-
redoMutations:
|
|
374
|
+
redoMutations: h,
|
|
379
375
|
undoMutations: f
|
|
380
|
-
}), await Za(
|
|
376
|
+
}), await Za(h, i), !0;
|
|
381
377
|
}
|
|
382
378
|
}, Rr = {
|
|
383
379
|
type: ye.COMMAND,
|
|
384
380
|
id: "data-validation.command.addRuleAndOpen",
|
|
385
381
|
async handler(r) {
|
|
386
|
-
const a = r.get(
|
|
387
|
-
if (!e)
|
|
388
|
-
return !1;
|
|
382
|
+
const a = r.get(te), e = rr(a);
|
|
383
|
+
if (!e) return !1;
|
|
389
384
|
const { workbook: t, worksheet: o } = e, n = tr(r), i = r.get(re), s = t.getUnitId(), l = o.getSheetId(), d = {
|
|
390
385
|
rule: n,
|
|
391
386
|
unitId: s,
|
|
392
387
|
subUnitId: l
|
|
393
388
|
};
|
|
394
|
-
return await i.executeCommand(wa.id, d) ? (i.executeCommand(
|
|
389
|
+
return await i.executeCommand(wa.id, d) ? (i.executeCommand(ut.id, {
|
|
395
390
|
ruleId: n.uid,
|
|
396
391
|
isAdd: !0
|
|
397
392
|
}), !0) : !1;
|
|
@@ -401,15 +396,13 @@ var le = function() {
|
|
|
401
396
|
return le = Object.assign || function(r) {
|
|
402
397
|
for (var a, e = 1, t = arguments.length; e < t; e++) {
|
|
403
398
|
a = arguments[e];
|
|
404
|
-
for (var o in a)
|
|
405
|
-
Object.prototype.hasOwnProperty.call(a, o) && (r[o] = a[o]);
|
|
399
|
+
for (var o in a) Object.prototype.hasOwnProperty.call(a, o) && (r[o] = a[o]);
|
|
406
400
|
}
|
|
407
401
|
return r;
|
|
408
402
|
}, le.apply(this, arguments);
|
|
409
403
|
}, Mn = function(r, a) {
|
|
410
404
|
var e = {};
|
|
411
|
-
for (var t in r)
|
|
412
|
-
Object.prototype.hasOwnProperty.call(r, t) && a.indexOf(t) < 0 && (e[t] = r[t]);
|
|
405
|
+
for (var t in r) Object.prototype.hasOwnProperty.call(r, t) && a.indexOf(t) < 0 && (e[t] = r[t]);
|
|
413
406
|
if (r != null && typeof Object.getOwnPropertySymbols == "function")
|
|
414
407
|
for (var o = 0, t = Object.getOwnPropertySymbols(r); o < t.length; o++)
|
|
415
408
|
a.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(r, t[o]) && (e[t[o]] = r[t[o]]);
|
|
@@ -482,19 +475,19 @@ var Tn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
|
|
|
482
475
|
}));
|
|
483
476
|
});
|
|
484
477
|
Ir.displayName = "MoreDownSingle";
|
|
485
|
-
var
|
|
478
|
+
var Fn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.64645 9.85355C4.45118 9.65829 4.45118 9.34171 4.64645 9.14645L7.64645 6.14645C7.84171 5.95118 8.15829 5.95118 8.35355 6.14645L11.3536 9.14645C11.5488 9.34171 11.5488 9.65829 11.3536 9.85355C11.1583 10.0488 10.8417 10.0488 10.6464 9.85355L8 7.20711L5.35355 9.85355C5.15829 10.0488 4.84171 10.0488 4.64645 9.85355Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, yr = Ee(function(r, a) {
|
|
486
479
|
return Oe(be, Object.assign({}, r, {
|
|
487
480
|
id: "more-up-single",
|
|
488
481
|
ref: a,
|
|
489
|
-
icon:
|
|
482
|
+
icon: Fn
|
|
490
483
|
}));
|
|
491
484
|
});
|
|
492
485
|
yr.displayName = "MoreUpSingle";
|
|
493
|
-
var
|
|
486
|
+
var Nn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_622_8", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_622_8)" }, children: [{ tag: "path", attrs: { d: "M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z" } }] }] }, Dr = Ee(function(r, a) {
|
|
494
487
|
return Oe(be, Object.assign({}, r, {
|
|
495
488
|
id: "sequence-single",
|
|
496
489
|
ref: a,
|
|
497
|
-
icon:
|
|
490
|
+
icon: Nn
|
|
498
491
|
}));
|
|
499
492
|
});
|
|
500
493
|
Dr.displayName = "SequenceSingle";
|
|
@@ -504,7 +497,7 @@ const Ln = "univer-data-validation-options-button", Pn = "univer-data-validation
|
|
|
504
497
|
};
|
|
505
498
|
function An(r) {
|
|
506
499
|
var d;
|
|
507
|
-
const a =
|
|
500
|
+
const a = T(ie), e = T(ct), { value: t, onChange: o, extraComponent: n } = r, [i, s] = z(!1), l = n ? e.get(n) : null;
|
|
508
501
|
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
509
502
|
/* @__PURE__ */ p.jsxs("div", { className: jt.dataValidationOptionsButton, onClick: () => s(!i), children: [
|
|
510
503
|
a.t("dataValidation.panel.options"),
|
|
@@ -519,11 +512,11 @@ function An(r) {
|
|
|
519
512
|
children: /* @__PURE__ */ p.jsxs(
|
|
520
513
|
Sa,
|
|
521
514
|
{
|
|
522
|
-
value: `${(d = t.errorStyle) != null ? d :
|
|
515
|
+
value: `${(d = t.errorStyle) != null ? d : at.WARNING}`,
|
|
523
516
|
onChange: (c) => o({ ...t, errorStyle: +c }),
|
|
524
517
|
children: [
|
|
525
|
-
/* @__PURE__ */ p.jsx(Le, { value: `${
|
|
526
|
-
/* @__PURE__ */ p.jsx(Le, { value: `${
|
|
518
|
+
/* @__PURE__ */ p.jsx(Le, { value: `${at.WARNING}`, children: a.t("dataValidation.panel.showWarning") }),
|
|
519
|
+
/* @__PURE__ */ p.jsx(Le, { value: `${at.STOP}`, children: a.t("dataValidation.panel.rejectInput") })
|
|
527
520
|
]
|
|
528
521
|
}
|
|
529
522
|
)
|
|
@@ -562,89 +555,89 @@ const xn = "univer-data-validation-detail-form-item", jn = "univer-data-validati
|
|
|
562
555
|
275
|
|
563
556
|
);
|
|
564
557
|
function $n() {
|
|
565
|
-
const [r, a] = z(0), e =
|
|
558
|
+
const [r, a] = z(0), e = T(Ve), t = Ze(e.activeRule$, e.activeRule), { unitId: o, subUnitId: n, rule: i } = t || {}, s = i.uid, l = T(De), d = T(ct), c = T(re), u = T(K), h = T(ie), [f, m] = z(i), v = l.getValidatorItem(f.type), [R, _] = z(!1), V = l.getValidatorsByScope(ro.SHEET), [S, y] = z(() => f.ranges.map((M) => ({ unitId: "", sheetId: "", range: M }))), w = Dt(() => Un(c), [c]);
|
|
566
559
|
if (qe(() => {
|
|
567
560
|
c.onCommandExecuted((M) => {
|
|
568
561
|
(M.id === kr.id || M.id === Yr.id) && setTimeout(() => {
|
|
569
|
-
const
|
|
570
|
-
a((
|
|
562
|
+
const O = u.getRuleById(o, n, s);
|
|
563
|
+
a((J) => J + 1), O && (m(O), y(O.ranges.map((J) => ({ unitId: "", sheetId: "", range: J }))));
|
|
571
564
|
}, 20);
|
|
572
565
|
});
|
|
573
|
-
}, [c, u, s, n, o]), !
|
|
566
|
+
}, [c, u, s, n, o]), !v)
|
|
574
567
|
return null;
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
},
|
|
578
|
-
if (
|
|
568
|
+
const F = v.operators, x = v.operatorNames, j = f.operator ? oo.includes(f.operator) : !1, $ = () => {
|
|
569
|
+
v.validatorFormula(f, o, n).success ? e.setActiveRule(null) : _(!0);
|
|
570
|
+
}, E = ir((M) => {
|
|
571
|
+
if (Xr(M, S))
|
|
579
572
|
return;
|
|
580
|
-
|
|
581
|
-
const
|
|
582
|
-
if (
|
|
573
|
+
y(M);
|
|
574
|
+
const O = M.filter((G) => (!G.unitId || G.unitId === o) && (!G.sheetId || G.sheetId === n)).map((G) => G.range);
|
|
575
|
+
if (m({
|
|
583
576
|
...f,
|
|
584
|
-
ranges:
|
|
585
|
-
}),
|
|
577
|
+
ranges: O
|
|
578
|
+
}), O.length === 0)
|
|
586
579
|
return;
|
|
587
|
-
const
|
|
580
|
+
const J = {
|
|
588
581
|
unitId: o,
|
|
589
582
|
subUnitId: n,
|
|
590
583
|
ruleId: s,
|
|
591
|
-
ranges:
|
|
584
|
+
ranges: O
|
|
592
585
|
};
|
|
593
|
-
|
|
594
|
-
}),
|
|
586
|
+
w(Ma.id, J);
|
|
587
|
+
}), P = (M) => {
|
|
595
588
|
if (Oa(M, Ta(f)))
|
|
596
589
|
return;
|
|
597
|
-
|
|
590
|
+
m({
|
|
598
591
|
...f,
|
|
599
592
|
...M
|
|
600
593
|
});
|
|
601
|
-
const
|
|
594
|
+
const O = {
|
|
602
595
|
unitId: o,
|
|
603
596
|
subUnitId: n,
|
|
604
597
|
ruleId: s,
|
|
605
598
|
setting: M
|
|
606
599
|
};
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
600
|
+
w(
|
|
601
|
+
Fa.id,
|
|
602
|
+
O,
|
|
610
603
|
void 0
|
|
611
604
|
);
|
|
612
|
-
},
|
|
605
|
+
}, A = async () => {
|
|
613
606
|
await c.executeCommand(ar.id, {
|
|
614
607
|
ruleId: s,
|
|
615
608
|
unitId: o,
|
|
616
609
|
subUnitId: n
|
|
617
610
|
}), e.setActiveRule(null);
|
|
618
|
-
},
|
|
611
|
+
}, q = {
|
|
619
612
|
type: f.type,
|
|
620
613
|
operator: f.operator,
|
|
621
614
|
formula1: f.formula1,
|
|
622
615
|
formula2: f.formula2,
|
|
623
616
|
allowBlank: f.allowBlank
|
|
624
|
-
},
|
|
625
|
-
const
|
|
626
|
-
if (!
|
|
617
|
+
}, L = (M) => {
|
|
618
|
+
const O = l.getValidatorItem(M);
|
|
619
|
+
if (!O)
|
|
627
620
|
return;
|
|
628
|
-
const
|
|
629
|
-
...
|
|
621
|
+
const J = O.operators, G = u.getRuleById(o, n, s), me = M === (G == null ? void 0 : G.type) ? {
|
|
622
|
+
...G
|
|
630
623
|
} : {
|
|
631
624
|
...f,
|
|
632
625
|
type: M,
|
|
633
|
-
operator:
|
|
626
|
+
operator: J[0],
|
|
634
627
|
formula1: void 0,
|
|
635
628
|
formula2: void 0
|
|
636
629
|
};
|
|
637
|
-
|
|
630
|
+
m(me), c.executeCommand(Fa.id, {
|
|
638
631
|
unitId: o,
|
|
639
632
|
subUnitId: n,
|
|
640
633
|
ruleId: f.uid,
|
|
641
634
|
setting: Ta(me)
|
|
642
635
|
});
|
|
643
|
-
},
|
|
644
|
-
Oa(M, ba(f)) || (
|
|
636
|
+
}, b = d.get(v.formulaInput), Y = Dt(() => S.map((M) => ur(M.range)).join(","), []), Z = ba(f), H = (M) => {
|
|
637
|
+
Oa(M, ba(f)) || (m({
|
|
645
638
|
...f,
|
|
646
639
|
...M
|
|
647
|
-
}),
|
|
640
|
+
}), w(
|
|
648
641
|
no.id,
|
|
649
642
|
{
|
|
650
643
|
unitId: o,
|
|
@@ -655,105 +648,105 @@ function $n() {
|
|
|
655
648
|
));
|
|
656
649
|
};
|
|
657
650
|
return /* @__PURE__ */ p.jsxs("div", { children: [
|
|
658
|
-
/* @__PURE__ */ p.jsx(Q, { label:
|
|
651
|
+
/* @__PURE__ */ p.jsx(Q, { label: h.t("dataValidation.panel.range"), children: /* @__PURE__ */ p.jsx(
|
|
659
652
|
Lo,
|
|
660
653
|
{
|
|
661
654
|
className: He.dataValidationDetailFormItem,
|
|
662
|
-
value:
|
|
655
|
+
value: Y,
|
|
663
656
|
id: fa("data-validation-detail"),
|
|
664
657
|
openForSheetUnitId: o,
|
|
665
658
|
openForSheetSubUnitId: n,
|
|
666
659
|
onChange: (M) => {
|
|
667
|
-
M.some((
|
|
660
|
+
M.some((O) => !Gr(O.range) || O.range.endColumn < O.range.startColumn || O.range.endRow < O.range.startRow) || E(M);
|
|
668
661
|
}
|
|
669
662
|
},
|
|
670
663
|
r
|
|
671
664
|
) }),
|
|
672
|
-
/* @__PURE__ */ p.jsx(Q, { label:
|
|
665
|
+
/* @__PURE__ */ p.jsx(Q, { label: h.t("dataValidation.panel.type"), children: /* @__PURE__ */ p.jsx(
|
|
673
666
|
ia,
|
|
674
667
|
{
|
|
675
668
|
options: V == null ? void 0 : V.map((M) => ({
|
|
676
|
-
label:
|
|
669
|
+
label: h.t(M.title),
|
|
677
670
|
value: M.id
|
|
678
671
|
})),
|
|
679
672
|
value: f.type,
|
|
680
|
-
onChange:
|
|
673
|
+
onChange: L,
|
|
681
674
|
className: He.dataValidationDetailFormItem
|
|
682
675
|
}
|
|
683
676
|
) }),
|
|
684
|
-
|
|
677
|
+
F != null && F.length ? /* @__PURE__ */ p.jsx(Q, { label: h.t("dataValidation.panel.operator"), children: /* @__PURE__ */ p.jsx(
|
|
685
678
|
ia,
|
|
686
679
|
{
|
|
687
|
-
options:
|
|
680
|
+
options: F.map((M, O) => ({
|
|
688
681
|
value: `${M}`,
|
|
689
|
-
label:
|
|
682
|
+
label: x[O]
|
|
690
683
|
})),
|
|
691
684
|
value: `${f.operator}`,
|
|
692
685
|
onChange: (M) => {
|
|
693
|
-
|
|
694
|
-
...
|
|
686
|
+
P({
|
|
687
|
+
...q,
|
|
695
688
|
operator: M
|
|
696
689
|
});
|
|
697
690
|
},
|
|
698
691
|
className: He.dataValidationDetailFormItem
|
|
699
692
|
}
|
|
700
693
|
) }) : null,
|
|
701
|
-
|
|
702
|
-
|
|
694
|
+
b ? /* @__PURE__ */ p.jsx(
|
|
695
|
+
b,
|
|
703
696
|
{
|
|
704
|
-
isTwoFormula:
|
|
697
|
+
isTwoFormula: j,
|
|
705
698
|
value: {
|
|
706
699
|
formula1: f.formula1,
|
|
707
700
|
formula2: f.formula2
|
|
708
701
|
},
|
|
709
702
|
onChange: (M) => {
|
|
710
|
-
|
|
711
|
-
...
|
|
703
|
+
P({
|
|
704
|
+
...q,
|
|
712
705
|
...M
|
|
713
706
|
});
|
|
714
707
|
},
|
|
715
708
|
showError: R,
|
|
716
|
-
validResult:
|
|
709
|
+
validResult: v.validatorFormula(f, o, n),
|
|
717
710
|
unitId: o,
|
|
718
711
|
subUnitId: n,
|
|
719
712
|
ruleId: s
|
|
720
713
|
},
|
|
721
714
|
r
|
|
722
715
|
) : null,
|
|
723
|
-
/* @__PURE__ */ p.jsx(An, { value:
|
|
716
|
+
/* @__PURE__ */ p.jsx(An, { value: Z, onChange: H, extraComponent: v.optionsInput }),
|
|
724
717
|
/* @__PURE__ */ p.jsxs("div", { className: He.dataValidationDetailButtons, children: [
|
|
725
|
-
/* @__PURE__ */ p.jsx(ze, { className: He.dataValidationDetailButton, onClick:
|
|
726
|
-
/* @__PURE__ */ p.jsx(ze, { className: He.dataValidationDetailButton, type: "primary", onClick:
|
|
718
|
+
/* @__PURE__ */ p.jsx(ze, { className: He.dataValidationDetailButton, onClick: A, children: h.t("dataValidation.panel.removeRule") }),
|
|
719
|
+
/* @__PURE__ */ p.jsx(ze, { className: He.dataValidationDetailButton, type: "primary", onClick: $, children: h.t("dataValidation.panel.done") })
|
|
727
720
|
] })
|
|
728
721
|
] });
|
|
729
722
|
}
|
|
730
|
-
var
|
|
731
|
-
const Wn = "univer-data-validation-item-container", Hn = "univer-data-validation-item-title", kn = "univer-data-validation-item-content", Yn = "univer-data-validation-item-icon",
|
|
723
|
+
var Et = /* @__PURE__ */ ((r) => (r[r.View = 0] = "View", r[r.Edit = 1] = "Edit", r[r.ManageCollaborator = 2] = "ManageCollaborator", r[r.Print = 3] = "Print", r[r.Duplicate = 4] = "Duplicate", r[r.Comment = 5] = "Comment", r[r.Copy = 6] = "Copy", r[r.Share = 7] = "Share", r[r.Export = 8] = "Export", r[r.MoveWorksheet = 9] = "MoveWorksheet", r[r.DeleteWorksheet = 10] = "DeleteWorksheet", r[r.HideWorksheet = 11] = "HideWorksheet", r[r.RenameWorksheet = 12] = "RenameWorksheet", r[r.CreateWorksheet = 13] = "CreateWorksheet", r[r.SetWorksheetStyle = 14] = "SetWorksheetStyle", r[r.EditWorksheetCell = 15] = "EditWorksheetCell", r[r.InsertHyperlink = 16] = "InsertHyperlink", r[r.Sort = 17] = "Sort", r[r.Filter = 18] = "Filter", r[r.PivotTable = 19] = "PivotTable", r[r.FloatImg = 20] = "FloatImg", r[r.History = 21] = "History", r[r.RwHgtClWdt = 22] = "RwHgtClWdt", r[r.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", r[r.ViewFilter = 24] = "ViewFilter", r[r.MoveSheet = 25] = "MoveSheet", r[r.DeleteSheet = 26] = "DeleteSheet", r[r.HideSheet = 27] = "HideSheet", r[r.CopySheet = 28] = "CopySheet", r[r.RenameSheet = 29] = "RenameSheet", r[r.CreateSheet = 30] = "CreateSheet", r[r.SelectProtectedCells = 31] = "SelectProtectedCells", r[r.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", r[r.SetCellStyle = 33] = "SetCellStyle", r[r.SetCellValue = 34] = "SetCellValue", r[r.SetRowStyle = 35] = "SetRowStyle", r[r.SetColumnStyle = 36] = "SetColumnStyle", r[r.InsertRow = 37] = "InsertRow", r[r.InsertColumn = 38] = "InsertColumn", r[r.DeleteRow = 39] = "DeleteRow", r[r.DeleteColumn = 40] = "DeleteColumn", r[r.EditExtraObject = 41] = "EditExtraObject", r[r.Delete = 42] = "Delete", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(Et || {});
|
|
724
|
+
const Wn = "univer-data-validation-item-container", Hn = "univer-data-validation-item-title", kn = "univer-data-validation-item-content", Yn = "univer-data-validation-item-icon", pt = {
|
|
732
725
|
dataValidationItemContainer: Wn,
|
|
733
726
|
dataValidationItemTitle: Hn,
|
|
734
727
|
dataValidationItemContent: kn,
|
|
735
728
|
dataValidationItemIcon: Yn
|
|
736
|
-
},
|
|
737
|
-
const { rule: a, onClick: e, unitId: t, subUnitId: o, disable: n } = r, i =
|
|
729
|
+
}, Xn = (r) => {
|
|
730
|
+
const { rule: a, onClick: e, unitId: t, subUnitId: o, disable: n } = r, i = T(De), s = T(re), l = T(Co), d = i.getValidatorItem(a.type), c = _a(), [u, h] = z(!1), f = (m) => {
|
|
738
731
|
s.executeCommand(ar.id, {
|
|
739
732
|
ruleId: a.uid,
|
|
740
733
|
unitId: t,
|
|
741
734
|
subUnitId: o
|
|
742
|
-
}),
|
|
735
|
+
}), m.stopPropagation();
|
|
743
736
|
};
|
|
744
737
|
return qe(() => () => {
|
|
745
|
-
var
|
|
746
|
-
c.current && ((
|
|
747
|
-
|
|
738
|
+
var m;
|
|
739
|
+
c.current && ((m = c.current) == null || m.forEach((v) => {
|
|
740
|
+
v && l.removeShape(v);
|
|
748
741
|
}));
|
|
749
742
|
}, [l]), /* @__PURE__ */ p.jsxs(
|
|
750
743
|
"div",
|
|
751
744
|
{
|
|
752
|
-
className:
|
|
745
|
+
className: pt.dataValidationItemContainer,
|
|
753
746
|
onClick: e,
|
|
754
747
|
onMouseEnter: () => {
|
|
755
|
-
n || (
|
|
756
|
-
range:
|
|
748
|
+
n || (h(!0), c.current = a.ranges.map((m) => l.addShape({
|
|
749
|
+
range: m,
|
|
757
750
|
style: {
|
|
758
751
|
hasAutoFill: !1,
|
|
759
752
|
fill: "rgba(73, 184, 17, 0.05)",
|
|
@@ -762,41 +755,41 @@ const Wn = "univer-data-validation-item-container", Hn = "univer-data-validation
|
|
|
762
755
|
widgets: {}
|
|
763
756
|
},
|
|
764
757
|
primary: {
|
|
765
|
-
startColumn:
|
|
766
|
-
endColumn:
|
|
767
|
-
startRow:
|
|
768
|
-
endRow:
|
|
769
|
-
actualRow:
|
|
770
|
-
actualColumn:
|
|
758
|
+
startColumn: m.startColumn,
|
|
759
|
+
endColumn: m.endColumn,
|
|
760
|
+
startRow: m.startRow,
|
|
761
|
+
endRow: m.endRow,
|
|
762
|
+
actualRow: m.startRow,
|
|
763
|
+
actualColumn: m.startColumn,
|
|
771
764
|
isMerged: !1,
|
|
772
765
|
isMergedMainCell: !1
|
|
773
766
|
}
|
|
774
767
|
})));
|
|
775
768
|
},
|
|
776
769
|
onMouseLeave: () => {
|
|
777
|
-
var
|
|
778
|
-
|
|
779
|
-
|
|
770
|
+
var m;
|
|
771
|
+
h(!1), (m = c.current) == null || m.forEach((v) => {
|
|
772
|
+
v && l.removeShape(v);
|
|
780
773
|
}), c.current = void 0;
|
|
781
774
|
},
|
|
782
775
|
children: [
|
|
783
|
-
/* @__PURE__ */ p.jsx("div", { className:
|
|
784
|
-
/* @__PURE__ */ p.jsx("div", { className:
|
|
785
|
-
u ? /* @__PURE__ */ p.jsx("div", { className:
|
|
776
|
+
/* @__PURE__ */ p.jsx("div", { className: pt.dataValidationItemTitle, children: d == null ? void 0 : d.generateRuleName(a) }),
|
|
777
|
+
/* @__PURE__ */ p.jsx("div", { className: pt.dataValidationItemContent, children: a.ranges.map((m) => ur(m)).join(",") }),
|
|
778
|
+
u ? /* @__PURE__ */ p.jsx("div", { className: pt.dataValidationItemIcon, onClick: f, children: /* @__PURE__ */ p.jsx(Ia, {}) }) : null
|
|
786
779
|
]
|
|
787
780
|
}
|
|
788
781
|
);
|
|
789
782
|
};
|
|
790
|
-
var
|
|
783
|
+
var Gn = Object.defineProperty, qn = Object.getOwnPropertyDescriptor, zn = (r, a, e, t) => {
|
|
791
784
|
for (var o = t > 1 ? void 0 : t ? qn(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
792
785
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
793
|
-
return t && o &&
|
|
786
|
+
return t && o && Gn(a, e, o), o;
|
|
794
787
|
}, Qn = (r, a) => (e, t) => a(e, t, r);
|
|
795
|
-
let
|
|
788
|
+
let Ot = class {
|
|
796
789
|
constructor(r) {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
790
|
+
g(this, "_currentManager");
|
|
791
|
+
g(this, "_currentManager$", new mr());
|
|
792
|
+
g(this, "currentManager$", this._currentManager$.asObservable());
|
|
800
793
|
this._dataValidationModel = r;
|
|
801
794
|
}
|
|
802
795
|
get currentManager() {
|
|
@@ -820,9 +813,9 @@ let Et = class {
|
|
|
820
813
|
return this._ensureManager(r, a);
|
|
821
814
|
}
|
|
822
815
|
};
|
|
823
|
-
|
|
824
|
-
Qn(0,
|
|
825
|
-
],
|
|
816
|
+
Ot = zn([
|
|
817
|
+
Qn(0, I(K))
|
|
818
|
+
], Ot);
|
|
826
819
|
function Kn(r) {
|
|
827
820
|
var l;
|
|
828
821
|
const { unitId: a, subUnitId: e, value: t, onChange: o, showError: n, validResult: i } = r, s = n ? i == null ? void 0 : i.formula1 : "";
|
|
@@ -854,7 +847,7 @@ const Zn = "univer-data-validation-formula", Jn = "univer-data-validation-formul
|
|
|
854
847
|
dataValidationFormulaColorSelectPanel: ni,
|
|
855
848
|
dataValidationFormulaColorItem: ii
|
|
856
849
|
}, si = (r) => {
|
|
857
|
-
const { isTwoFormula: a = !1, value: e, onChange: t, showError: o, validResult: n } = r, i =
|
|
850
|
+
const { isTwoFormula: a = !1, value: e, onChange: t, showError: o, validResult: n } = r, i = T(ie), s = o ? n == null ? void 0 : n.formula1 : "", l = o ? n == null ? void 0 : n.formula2 : "";
|
|
858
851
|
return a ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
859
852
|
/* @__PURE__ */ p.jsx(Q, { error: s, children: /* @__PURE__ */ p.jsx(
|
|
860
853
|
Pe,
|
|
@@ -912,20 +905,20 @@ function ne(r) {
|
|
|
912
905
|
function Er(r) {
|
|
913
906
|
return r.filter(Boolean).join(",");
|
|
914
907
|
}
|
|
915
|
-
function
|
|
908
|
+
function Ge(r) {
|
|
916
909
|
return r.split(",").filter(Boolean);
|
|
917
910
|
}
|
|
918
911
|
function li(r) {
|
|
919
912
|
const a = ne(r);
|
|
920
913
|
return a == null ? "" : a.toString();
|
|
921
914
|
}
|
|
922
|
-
const ya = "SHEET_DATA_VALIDATION_PLUGIN",
|
|
915
|
+
const ya = "SHEET_DATA_VALIDATION_PLUGIN", Ne = "#ECECEC";
|
|
923
916
|
var di = Object.defineProperty, ci = Object.getOwnPropertyDescriptor, ui = (r, a, e, t) => {
|
|
924
917
|
for (var o = t > 1 ? void 0 : t ? ci(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
925
918
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
926
919
|
return t && o && di(a, e, o), o;
|
|
927
920
|
}, Bt = (r, a) => (e, t) => a(e, t, r);
|
|
928
|
-
let
|
|
921
|
+
let rt = class extends he {
|
|
929
922
|
constructor(r, a, e) {
|
|
930
923
|
super(), this._univerInstanceService = r, this._permissionService = a, this._lexerTreeBuilder = e;
|
|
931
924
|
}
|
|
@@ -944,29 +937,28 @@ let at = class extends he {
|
|
|
944
937
|
if (s.sheetName) {
|
|
945
938
|
if (d = l.getSheetBySheetName(s.sheetName), !d)
|
|
946
939
|
return !1;
|
|
947
|
-
const
|
|
948
|
-
if (!this._permissionService.getPermissionPoint(new mo(c,
|
|
949
|
-
return !1;
|
|
940
|
+
const v = d == null ? void 0 : d.getSheetId();
|
|
941
|
+
if (!this._permissionService.getPermissionPoint(new mo(c, v).id)) return !1;
|
|
950
942
|
}
|
|
951
943
|
if (!d)
|
|
952
944
|
return !1;
|
|
953
|
-
const { startRow: u, endRow:
|
|
954
|
-
for (let
|
|
955
|
-
for (let R = f; R <=
|
|
956
|
-
const _ = (t = (e = d.getCell(
|
|
957
|
-
if ((_ == null ? void 0 : _[
|
|
945
|
+
const { startRow: u, endRow: h, startColumn: f, endColumn: m } = s.range;
|
|
946
|
+
for (let v = u; v <= h; v++)
|
|
947
|
+
for (let R = f; R <= m; R++) {
|
|
948
|
+
const _ = (t = (e = d.getCell(v, R)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
949
|
+
if ((_ == null ? void 0 : _[Et.View]) === !1)
|
|
958
950
|
return !1;
|
|
959
951
|
}
|
|
960
952
|
}
|
|
961
953
|
return !0;
|
|
962
954
|
}
|
|
963
955
|
};
|
|
964
|
-
|
|
965
|
-
ve(ge.Rendered,
|
|
966
|
-
Bt(0,
|
|
956
|
+
rt = ui([
|
|
957
|
+
ve(ge.Rendered, rt),
|
|
958
|
+
Bt(0, te),
|
|
967
959
|
Bt(1, zr),
|
|
968
|
-
Bt(2,
|
|
969
|
-
],
|
|
960
|
+
Bt(2, I(Ra))
|
|
961
|
+
], rt);
|
|
970
962
|
const hi = [
|
|
971
963
|
"#FFFFFF",
|
|
972
964
|
"#FEE7E7",
|
|
@@ -1054,54 +1046,54 @@ const hi = [
|
|
|
1054
1046
|
};
|
|
1055
1047
|
function fi(r) {
|
|
1056
1048
|
const { value: a, onChange: e = () => {
|
|
1057
|
-
}, unitId: t, subUnitId: o, validResult: n, showError: i, ruleId: s } = r, { formula1: l = "", formula2: d = "" } = a || {}, c = _a(null), [u,
|
|
1049
|
+
}, unitId: t, subUnitId: o, validResult: n, showError: i, ruleId: s } = r, { formula1: l = "", formula2: d = "" } = a || {}, c = _a(null), [u, h] = z(() => N(l) ? "1" : "0"), [f, m] = z(u === "1" ? l : "="), [v, R] = z(u === "1" ? l : "="), _ = T(ie), V = T(De), S = T(K), y = T(rt), [w, F] = z(() => d.split(",")), x = V.getValidatorItem(X.LIST), [j, $] = z([]), [E, P] = z(""), A = i ? n == null ? void 0 : n.formula1 : "", q = Ze(S.ruleChange$), L = ir(e);
|
|
1058
1050
|
qe(() => {
|
|
1059
1051
|
(async () => {
|
|
1060
1052
|
await new Promise((k) => {
|
|
1061
1053
|
setTimeout(() => k(!0), 100);
|
|
1062
1054
|
});
|
|
1063
1055
|
const D = S.getRuleById(t, o, s), W = D == null ? void 0 : D.formula1;
|
|
1064
|
-
if (
|
|
1065
|
-
const k = await
|
|
1066
|
-
|
|
1056
|
+
if (N(W) && x && D) {
|
|
1057
|
+
const k = await x.getListAsync(D, t, o);
|
|
1058
|
+
$(k);
|
|
1067
1059
|
}
|
|
1068
1060
|
})();
|
|
1069
|
-
}, [S,
|
|
1070
|
-
|
|
1071
|
-
}, [
|
|
1072
|
-
const [
|
|
1073
|
-
const D = u !== "1" ?
|
|
1074
|
-
return D.map((k,
|
|
1061
|
+
}, [S, q, x, s, o, t]), qe(() => {
|
|
1062
|
+
N(l) && l !== v && (m(l), R(v));
|
|
1063
|
+
}, [v, l]);
|
|
1064
|
+
const [b, Y] = z(() => {
|
|
1065
|
+
const D = u !== "1" ? Ge(l) : [], W = d.split(",");
|
|
1066
|
+
return D.map((k, ee) => ({
|
|
1075
1067
|
label: k,
|
|
1076
|
-
color: W[
|
|
1068
|
+
color: W[ee] || Ne,
|
|
1077
1069
|
isRef: !1,
|
|
1078
|
-
id:
|
|
1070
|
+
id: B.generateRandomId(4)
|
|
1079
1071
|
}));
|
|
1080
|
-
}),
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1072
|
+
}), Z = (D, W, k) => {
|
|
1073
|
+
const ee = b.find((_e) => _e.id === D);
|
|
1074
|
+
ee && (ee.label = W, ee.color = k, Y([...b]));
|
|
1083
1075
|
}, H = (D) => {
|
|
1084
|
-
const W =
|
|
1085
|
-
W !== -1 && (
|
|
1086
|
-
}, M = d.split(","),
|
|
1076
|
+
const W = b.findIndex((k) => k.id === D);
|
|
1077
|
+
W !== -1 && (b.splice(W, 1), Y([...b]));
|
|
1078
|
+
}, M = d.split(","), O = Dt(() => j.map((D, W) => ({
|
|
1087
1079
|
label: D,
|
|
1088
|
-
color: M[W] ||
|
|
1080
|
+
color: M[W] || Ne,
|
|
1089
1081
|
id: `${W}`,
|
|
1090
1082
|
isRef: !0
|
|
1091
|
-
})), [M,
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1083
|
+
})), [M, j]), J = (D, W, k) => {
|
|
1084
|
+
const ee = [...w];
|
|
1085
|
+
ee[+D] = k, F(ee), L({
|
|
1094
1086
|
formula1: l,
|
|
1095
|
-
formula2:
|
|
1087
|
+
formula2: ee.join(",")
|
|
1096
1088
|
});
|
|
1097
|
-
},
|
|
1098
|
-
|
|
1099
|
-
...
|
|
1089
|
+
}, G = () => {
|
|
1090
|
+
Y([
|
|
1091
|
+
...b,
|
|
1100
1092
|
{
|
|
1101
1093
|
label: "",
|
|
1102
|
-
color:
|
|
1094
|
+
color: Ne,
|
|
1103
1095
|
isRef: !1,
|
|
1104
|
-
id:
|
|
1096
|
+
id: B.generateRandomId(4)
|
|
1105
1097
|
}
|
|
1106
1098
|
]);
|
|
1107
1099
|
};
|
|
@@ -1109,39 +1101,39 @@ function fi(r) {
|
|
|
1109
1101
|
if (u === "1")
|
|
1110
1102
|
return;
|
|
1111
1103
|
const D = /* @__PURE__ */ new Set(), W = [];
|
|
1112
|
-
|
|
1104
|
+
b.map((k) => ({
|
|
1113
1105
|
labelList: k.label.split(","),
|
|
1114
1106
|
item: k
|
|
1115
|
-
})).forEach(({ item: k, labelList:
|
|
1116
|
-
|
|
1107
|
+
})).forEach(({ item: k, labelList: ee }) => {
|
|
1108
|
+
ee.forEach((_e) => {
|
|
1117
1109
|
D.has(_e) || (D.add(_e), W.push({
|
|
1118
1110
|
label: _e,
|
|
1119
1111
|
color: k.color
|
|
1120
1112
|
}));
|
|
1121
1113
|
});
|
|
1122
|
-
}),
|
|
1114
|
+
}), L({
|
|
1123
1115
|
formula1: Er(W.map((k) => k.label)),
|
|
1124
|
-
formula2: W.map((k) => k.color ===
|
|
1116
|
+
formula2: W.map((k) => k.color === Ne ? "" : k.color).join(",")
|
|
1125
1117
|
});
|
|
1126
|
-
}, [
|
|
1127
|
-
const me =
|
|
1118
|
+
}, [b, L, u, v, w]);
|
|
1119
|
+
const me = Dt(
|
|
1128
1120
|
() => async (D) => {
|
|
1129
|
-
if (!
|
|
1130
|
-
|
|
1121
|
+
if (!N(D)) {
|
|
1122
|
+
L == null || L({
|
|
1131
1123
|
formula1: "",
|
|
1132
1124
|
formula2: d
|
|
1133
1125
|
});
|
|
1134
1126
|
return;
|
|
1135
1127
|
}
|
|
1136
|
-
|
|
1137
|
-
formula1:
|
|
1128
|
+
y.getFormulaRefCheck(D) ? (L == null || L({
|
|
1129
|
+
formula1: N(D) ? D : "",
|
|
1138
1130
|
formula2: d
|
|
1139
|
-
}),
|
|
1131
|
+
}), P("")) : (L == null || L({
|
|
1140
1132
|
formula1: "",
|
|
1141
1133
|
formula2: d
|
|
1142
|
-
}),
|
|
1134
|
+
}), m("="), P(_.t("dataValidation.validFail.formulaError")));
|
|
1143
1135
|
},
|
|
1144
|
-
[d,
|
|
1136
|
+
[d, L]
|
|
1145
1137
|
);
|
|
1146
1138
|
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
1147
1139
|
/* @__PURE__ */ p.jsx(Q, { label: _.t("dataValidation.list.options"), children: /* @__PURE__ */ p.jsxs(
|
|
@@ -1149,9 +1141,9 @@ function fi(r) {
|
|
|
1149
1141
|
{
|
|
1150
1142
|
value: u,
|
|
1151
1143
|
onChange: (D) => {
|
|
1152
|
-
|
|
1153
|
-
formula1:
|
|
1154
|
-
formula2:
|
|
1144
|
+
h(D), m(v), D === "1" && L({
|
|
1145
|
+
formula1: v === "=" ? "" : v,
|
|
1146
|
+
formula2: w.join(",")
|
|
1155
1147
|
});
|
|
1156
1148
|
},
|
|
1157
1149
|
children: [
|
|
@@ -1161,7 +1153,7 @@ function fi(r) {
|
|
|
1161
1153
|
}
|
|
1162
1154
|
) }),
|
|
1163
1155
|
u === "1" ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
1164
|
-
/* @__PURE__ */ p.jsx(Q, { error:
|
|
1156
|
+
/* @__PURE__ */ p.jsx(Q, { error: A || E, children: /* @__PURE__ */ p.jsx(
|
|
1165
1157
|
sr,
|
|
1166
1158
|
{
|
|
1167
1159
|
id: fa(`list-ref-range-${t}-${o}`),
|
|
@@ -1175,13 +1167,13 @@ function fi(r) {
|
|
|
1175
1167
|
}
|
|
1176
1168
|
}
|
|
1177
1169
|
) }),
|
|
1178
|
-
/* @__PURE__ */ p.jsx(Q, { children: /* @__PURE__ */ p.jsx("div", { ref: c, children:
|
|
1179
|
-
] }) : /* @__PURE__ */ p.jsx(Q, { error:
|
|
1170
|
+
/* @__PURE__ */ p.jsx(Q, { children: /* @__PURE__ */ p.jsx("div", { ref: c, children: O.map((D) => /* @__PURE__ */ p.jsx($a, { item: D, commonProps: { onItemChange: J }, style: { marginBottom: 12 } }, D.id)) }) })
|
|
1171
|
+
] }) : /* @__PURE__ */ p.jsx(Q, { error: A, children: /* @__PURE__ */ p.jsxs("div", { ref: c, style: { marginTop: "-12px" }, children: [
|
|
1180
1172
|
/* @__PURE__ */ p.jsx(
|
|
1181
1173
|
zo,
|
|
1182
1174
|
{
|
|
1183
|
-
list:
|
|
1184
|
-
onListChange:
|
|
1175
|
+
list: b,
|
|
1176
|
+
onListChange: Y,
|
|
1185
1177
|
rowHeight: 32,
|
|
1186
1178
|
margin: [0, 12],
|
|
1187
1179
|
draggableHandle: ".draggableHandle",
|
|
@@ -1190,7 +1182,7 @@ function fi(r) {
|
|
|
1190
1182
|
{
|
|
1191
1183
|
item: D,
|
|
1192
1184
|
commonProps: {
|
|
1193
|
-
onItemChange:
|
|
1185
|
+
onItemChange: Z,
|
|
1194
1186
|
onItemDelete: H
|
|
1195
1187
|
}
|
|
1196
1188
|
},
|
|
@@ -1199,7 +1191,7 @@ function fi(r) {
|
|
|
1199
1191
|
idKey: "id"
|
|
1200
1192
|
}
|
|
1201
1193
|
),
|
|
1202
|
-
/* @__PURE__ */ p.jsxs("a", { className: oe.dataValidationFormulaListAdd, onClick:
|
|
1194
|
+
/* @__PURE__ */ p.jsxs("a", { className: oe.dataValidationFormulaListAdd, onClick: G, children: [
|
|
1203
1195
|
/* @__PURE__ */ p.jsx(wr, {}),
|
|
1204
1196
|
_.t("dataValidation.list.add")
|
|
1205
1197
|
] })
|
|
@@ -1207,7 +1199,7 @@ function fi(r) {
|
|
|
1207
1199
|
] });
|
|
1208
1200
|
}
|
|
1209
1201
|
function pi(r) {
|
|
1210
|
-
const { value: a, onChange: e, showError: t, validResult: o } = r, n =
|
|
1202
|
+
const { value: a, onChange: e, showError: t, validResult: o } = r, n = T(ie), i = t ? o == null ? void 0 : o.formula1 : "", s = t ? o == null ? void 0 : o.formula2 : "", [l, d] = z(!((a == null ? void 0 : a.formula1) === void 0 && (a == null ? void 0 : a.formula2) === void 0));
|
|
1211
1203
|
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
1212
1204
|
/* @__PURE__ */ p.jsx(Q, { children: /* @__PURE__ */ p.jsx(
|
|
1213
1205
|
cr,
|
|
@@ -1253,13 +1245,13 @@ function pi(r) {
|
|
|
1253
1245
|
) }) : null
|
|
1254
1246
|
] });
|
|
1255
1247
|
}
|
|
1256
|
-
const Or = "data-validation.custom-formula-input",
|
|
1248
|
+
const Or = "data-validation.custom-formula-input", ht = "data-validation.formula-input", br = "data-validation.list-formula-input", Tr = "data-validation.checkbox-formula-input", vi = [
|
|
1257
1249
|
[
|
|
1258
1250
|
Or,
|
|
1259
1251
|
Kn
|
|
1260
1252
|
],
|
|
1261
1253
|
[
|
|
1262
|
-
|
|
1254
|
+
ht,
|
|
1263
1255
|
si
|
|
1264
1256
|
],
|
|
1265
1257
|
[
|
|
@@ -1271,15 +1263,15 @@ const Or = "data-validation.custom-formula-input", ut = "data-validation.formula
|
|
|
1271
1263
|
pi
|
|
1272
1264
|
]
|
|
1273
1265
|
];
|
|
1274
|
-
class
|
|
1266
|
+
class mt {
|
|
1275
1267
|
constructor() {
|
|
1276
|
-
|
|
1268
|
+
g(this, "_cacheMatrix", /* @__PURE__ */ new Map());
|
|
1277
1269
|
}
|
|
1278
1270
|
_ensureCache(a, e) {
|
|
1279
1271
|
let t = this._cacheMatrix.get(a);
|
|
1280
1272
|
t || (t = /* @__PURE__ */ new Map(), this._cacheMatrix.set(a, t));
|
|
1281
1273
|
let o = t.get(e);
|
|
1282
|
-
return o || (o = new
|
|
1274
|
+
return o || (o = new dt(), t.set(e, o)), o;
|
|
1283
1275
|
}
|
|
1284
1276
|
ensureCache(a, e) {
|
|
1285
1277
|
return this._ensureCache(a, e);
|
|
@@ -1293,17 +1285,17 @@ class ht {
|
|
|
1293
1285
|
updateRuleRanges(a, e, t, o, n) {
|
|
1294
1286
|
const i = this._ensureCache(a, e);
|
|
1295
1287
|
n.forEach((s) => {
|
|
1296
|
-
|
|
1288
|
+
U.foreach(s, (l, d) => {
|
|
1297
1289
|
const c = i.getValue(l, d);
|
|
1298
1290
|
c && (c.temp = !0);
|
|
1299
1291
|
});
|
|
1300
1292
|
}), o.forEach((s) => {
|
|
1301
|
-
|
|
1293
|
+
U.foreach(s, (l, d) => {
|
|
1302
1294
|
const c = i.getValue(l, d);
|
|
1303
1295
|
c && c.ruleId === t ? c.temp = !1 : i.setValue(l, d, void 0);
|
|
1304
1296
|
});
|
|
1305
1297
|
}), n.forEach((s) => {
|
|
1306
|
-
|
|
1298
|
+
U.foreach(s, (l, d) => {
|
|
1307
1299
|
const c = i.getValue(l, d);
|
|
1308
1300
|
c && c.temp === !0 && i.realDeleteValue(l, d);
|
|
1309
1301
|
});
|
|
@@ -1312,7 +1304,7 @@ class ht {
|
|
|
1312
1304
|
markRangeDirty(a, e, t) {
|
|
1313
1305
|
const o = this._ensureCache(a, e);
|
|
1314
1306
|
t.forEach((n) => {
|
|
1315
|
-
|
|
1307
|
+
U.foreach(n, (i, s) => {
|
|
1316
1308
|
o.setValue(i, s, void 0);
|
|
1317
1309
|
});
|
|
1318
1310
|
});
|
|
@@ -1323,7 +1315,7 @@ class ht {
|
|
|
1323
1315
|
_deleteRange(a, e, t) {
|
|
1324
1316
|
const o = this._ensureCache(a, e);
|
|
1325
1317
|
t.forEach((n) => {
|
|
1326
|
-
|
|
1318
|
+
U.foreach(n, (i, s) => {
|
|
1327
1319
|
o.realDeleteValue(i, s);
|
|
1328
1320
|
});
|
|
1329
1321
|
});
|
|
@@ -1339,19 +1331,19 @@ var gi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, Si = (r, a
|
|
|
1339
1331
|
for (var o = t > 1 ? void 0 : t ? _i(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
1340
1332
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
1341
1333
|
return t && o && gi(a, e, o), o;
|
|
1342
|
-
},
|
|
1334
|
+
}, vt = (r, a) => (e, t) => a(e, t, r);
|
|
1343
1335
|
let Ke = class extends he {
|
|
1344
1336
|
constructor(a, e, t, o) {
|
|
1345
1337
|
super();
|
|
1346
|
-
|
|
1338
|
+
g(this, "_formulaMap", /* @__PURE__ */ new Map());
|
|
1347
1339
|
/**
|
|
1348
1340
|
* Map of origin formula of rule
|
|
1349
1341
|
*/
|
|
1350
|
-
|
|
1342
|
+
g(this, "_ruleFormulaMap", /* @__PURE__ */ new Map());
|
|
1351
1343
|
/**
|
|
1352
1344
|
* reflect of formulaId to cell, only store transformable formula
|
|
1353
1345
|
*/
|
|
1354
|
-
|
|
1346
|
+
g(this, "_formulaCellMap", /* @__PURE__ */ new Map());
|
|
1355
1347
|
this._registerOtherFormulaService = a, this._lexerTreeBuilder = e, this._dataValidationModel = t, this._dataValidationCacheService = o, this._initFormulaResultHandler();
|
|
1356
1348
|
}
|
|
1357
1349
|
_initFormulaResultHandler() {
|
|
@@ -1361,9 +1353,9 @@ let Ke = class extends he {
|
|
|
1361
1353
|
for (const o in t) {
|
|
1362
1354
|
const n = t[o], { formulaCellMap: i, ruleFormulaMap: s } = this._ensureMaps(e, o), l = this._dataValidationModel.ensureManager(e, o);
|
|
1363
1355
|
n.forEach((d) => {
|
|
1364
|
-
var f,
|
|
1365
|
-
const c = s.get((f = d.extra) == null ? void 0 : f.ruleId), u = i.get(d.formulaId),
|
|
1366
|
-
|
|
1356
|
+
var f, m;
|
|
1357
|
+
const c = s.get((f = d.extra) == null ? void 0 : f.ruleId), u = i.get(d.formulaId), h = l.getRuleById((m = d.extra) == null ? void 0 : m.ruleId);
|
|
1358
|
+
h && c && !c.isTransformable && this._dataValidationCacheService.markRangeDirty(e, o, h.ranges), u && this._dataValidationCacheService.markCellDirty(e, o, u.row, u.column);
|
|
1367
1359
|
});
|
|
1368
1360
|
}
|
|
1369
1361
|
}
|
|
@@ -1373,7 +1365,7 @@ let Ke = class extends he {
|
|
|
1373
1365
|
let t = this._formulaMap.get(a), o = this._ruleFormulaMap.get(a), n = this._formulaCellMap.get(a);
|
|
1374
1366
|
(!t || !o || !n) && (t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), this._formulaMap.set(a, t), this._ruleFormulaMap.set(a, o), this._formulaCellMap.set(a, n));
|
|
1375
1367
|
let i = t.get(e), s = o.get(e), l = n.get(e);
|
|
1376
|
-
return (!i || !s || !l) && (i = new
|
|
1368
|
+
return (!i || !s || !l) && (i = new dt(), t.set(e, i), s = /* @__PURE__ */ new Map(), o.set(e, s), l = /* @__PURE__ */ new Map(), n.set(e, l)), {
|
|
1377
1369
|
formulaMap: i,
|
|
1378
1370
|
ruleFormulaMap: s,
|
|
1379
1371
|
formulaCellMap: l
|
|
@@ -1385,11 +1377,11 @@ let Ke = class extends he {
|
|
|
1385
1377
|
deleteByRuleId(a, e, t) {
|
|
1386
1378
|
const { formulaMap: o, formulaCellMap: n, ruleFormulaMap: i } = this._ensureMaps(a, e), s = this._dataValidationModel.getRuleById(a, e, t), l = /* @__PURE__ */ new Set(), d = i.get(t);
|
|
1387
1379
|
!s || !d || (i.delete(t), s.ranges.forEach((c) => {
|
|
1388
|
-
|
|
1389
|
-
const f = o.getValue(u,
|
|
1380
|
+
U.foreach(c, (u, h) => {
|
|
1381
|
+
const f = o.getValue(u, h);
|
|
1390
1382
|
if (f && f.ruleId === t) {
|
|
1391
|
-
const { formulaId:
|
|
1392
|
-
o.realDeleteValue(u,
|
|
1383
|
+
const { formulaId: m } = f;
|
|
1384
|
+
o.realDeleteValue(u, h), l.add(m), n.delete(m);
|
|
1393
1385
|
}
|
|
1394
1386
|
});
|
|
1395
1387
|
}), this._registerOtherFormulaService.deleteFormula(a, e, Array.from(l.values())));
|
|
@@ -1402,27 +1394,27 @@ let Ke = class extends he {
|
|
|
1402
1394
|
this._lexerTreeBuilder,
|
|
1403
1395
|
o
|
|
1404
1396
|
), c = n[0].startRow, u = n[0].startColumn;
|
|
1405
|
-
let
|
|
1397
|
+
let h;
|
|
1406
1398
|
d ? n.forEach((f) => {
|
|
1407
|
-
|
|
1399
|
+
U.foreach(f, (m, v) => {
|
|
1408
1400
|
const R = ja(
|
|
1409
1401
|
this._lexerTreeBuilder,
|
|
1410
1402
|
o,
|
|
1411
1403
|
c,
|
|
1412
1404
|
u,
|
|
1413
|
-
|
|
1414
|
-
|
|
1405
|
+
m,
|
|
1406
|
+
v
|
|
1415
1407
|
), _ = this._registerFormula(a, e, t, R);
|
|
1416
|
-
i.setValue(
|
|
1408
|
+
i.setValue(m, v, {
|
|
1417
1409
|
formulaId: _,
|
|
1418
1410
|
// formulaText: relativeFormula,
|
|
1419
1411
|
ruleId: t
|
|
1420
|
-
}), l.set(_, { row:
|
|
1412
|
+
}), l.set(_, { row: m, column: v });
|
|
1421
1413
|
});
|
|
1422
|
-
}) : (
|
|
1423
|
-
|
|
1424
|
-
i.setValue(
|
|
1425
|
-
formulaId:
|
|
1414
|
+
}) : (h = this._registerFormula(a, e, t, o), n.forEach((f) => {
|
|
1415
|
+
U.foreach(f, (m, v) => {
|
|
1416
|
+
i.setValue(m, v, {
|
|
1417
|
+
formulaId: h,
|
|
1426
1418
|
// formulaText: formula,
|
|
1427
1419
|
ruleId: t
|
|
1428
1420
|
});
|
|
@@ -1432,53 +1424,53 @@ let Ke = class extends he {
|
|
|
1432
1424
|
originCol: u,
|
|
1433
1425
|
originRow: c,
|
|
1434
1426
|
isTransformable: d,
|
|
1435
|
-
formulaId:
|
|
1427
|
+
formulaId: h
|
|
1436
1428
|
});
|
|
1437
1429
|
}
|
|
1438
1430
|
addRule(a, e, t) {
|
|
1439
1431
|
const { ranges: o, formula1: n, uid: i, type: s } = t;
|
|
1440
|
-
s !==
|
|
1432
|
+
s !== X.CUSTOM || !n || !N(n) || this._addFormulaByRange(a, e, i, n, o);
|
|
1441
1433
|
}
|
|
1442
1434
|
updateRuleRanges(a, e, t, o, n) {
|
|
1443
1435
|
const { formulaMap: i, ruleFormulaMap: s, formulaCellMap: l } = this._ensureMaps(a, e), d = s.get(t);
|
|
1444
1436
|
if (!d)
|
|
1445
1437
|
return;
|
|
1446
|
-
const { formula: c, originCol: u, originRow:
|
|
1438
|
+
const { formula: c, originCol: u, originRow: h, isTransformable: f, formulaId: m } = d, v = /* @__PURE__ */ new Set();
|
|
1447
1439
|
o.forEach((R) => {
|
|
1448
|
-
|
|
1440
|
+
U.foreach(R, (_, V) => {
|
|
1449
1441
|
const S = i.getValue(_, V);
|
|
1450
1442
|
S && S.ruleId === t && (S.temp = !0);
|
|
1451
1443
|
});
|
|
1452
1444
|
}), n.forEach((R) => {
|
|
1453
|
-
|
|
1454
|
-
var
|
|
1455
|
-
const S = (
|
|
1445
|
+
U.foreach(R, (_, V) => {
|
|
1446
|
+
var y;
|
|
1447
|
+
const S = (y = i.getValue(_, V)) != null ? y : {};
|
|
1456
1448
|
if (S.ruleId !== t) {
|
|
1457
|
-
const
|
|
1458
|
-
if (
|
|
1459
|
-
const
|
|
1449
|
+
const w = s.get(S.ruleId);
|
|
1450
|
+
if (w != null && w.isTransformable && v.add(S.formulaId), f) {
|
|
1451
|
+
const F = ja(this._lexerTreeBuilder, c, h, u, _, V), x = this._registerFormula(a, e, t, F);
|
|
1460
1452
|
i.setValue(_, V, {
|
|
1461
1453
|
// formulaText: relativeText,
|
|
1462
1454
|
ruleId: t,
|
|
1463
|
-
formulaId:
|
|
1464
|
-
}), l.set(
|
|
1455
|
+
formulaId: x
|
|
1456
|
+
}), l.set(x, { row: _, column: V });
|
|
1465
1457
|
} else
|
|
1466
1458
|
i.setValue(_, V, {
|
|
1467
1459
|
// formulaText: formula,
|
|
1468
1460
|
ruleId: t,
|
|
1469
|
-
formulaId:
|
|
1461
|
+
formulaId: m
|
|
1470
1462
|
});
|
|
1471
1463
|
} else
|
|
1472
1464
|
S.temp = !1;
|
|
1473
1465
|
});
|
|
1474
1466
|
}), o.forEach((R) => {
|
|
1475
|
-
|
|
1467
|
+
U.foreach(R, (_, V) => {
|
|
1476
1468
|
const S = i.getValue(_, V);
|
|
1477
|
-
S && S.ruleId === t && S.temp === !0 && (i.realDeleteValue(_, V), f &&
|
|
1469
|
+
S && S.ruleId === t && S.temp === !0 && (i.realDeleteValue(_, V), f && v.add(S.formulaId));
|
|
1478
1470
|
});
|
|
1479
|
-
}),
|
|
1471
|
+
}), v.forEach((R) => {
|
|
1480
1472
|
l.delete(R);
|
|
1481
|
-
}), this._registerOtherFormulaService.deleteFormula(a, e, Array.from(
|
|
1473
|
+
}), this._registerOtherFormulaService.deleteFormula(a, e, Array.from(v.values()));
|
|
1482
1474
|
}
|
|
1483
1475
|
updateRuleFormula(a, e, t, o, n) {
|
|
1484
1476
|
const { ruleFormulaMap: i } = this._ensureMaps(a, e), s = i.get(t);
|
|
@@ -1494,10 +1486,10 @@ let Ke = class extends he {
|
|
|
1494
1486
|
}
|
|
1495
1487
|
};
|
|
1496
1488
|
Ke = Si([
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1489
|
+
vt(0, I(fr)),
|
|
1490
|
+
vt(1, I(Ra)),
|
|
1491
|
+
vt(2, I(K)),
|
|
1492
|
+
vt(3, I(mt))
|
|
1501
1493
|
], Ke);
|
|
1502
1494
|
function Ce(r) {
|
|
1503
1495
|
var a, e;
|
|
@@ -1506,15 +1498,15 @@ function Ce(r) {
|
|
|
1506
1498
|
class Ri extends $e {
|
|
1507
1499
|
constructor() {
|
|
1508
1500
|
super(...arguments);
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1501
|
+
g(this, "id", X.CUSTOM);
|
|
1502
|
+
g(this, "title", "dataValidation.custom.title");
|
|
1503
|
+
g(this, "operators", []);
|
|
1504
|
+
g(this, "scopes", ["sheet"]);
|
|
1505
|
+
g(this, "formulaInput", Or);
|
|
1506
|
+
g(this, "_customFormulaService", this.injector.get(Ke));
|
|
1515
1507
|
}
|
|
1516
1508
|
validatorFormula(e, t, o) {
|
|
1517
|
-
const n =
|
|
1509
|
+
const n = N(e.formula1);
|
|
1518
1510
|
return {
|
|
1519
1511
|
success: n,
|
|
1520
1512
|
formula1: n ? "" : this.localeService.t("dataValidation.validFail.formula")
|
|
@@ -1542,7 +1534,7 @@ var Ci = Object.defineProperty, Vi = Object.getOwnPropertyDescriptor, Mi = (r, a
|
|
|
1542
1534
|
let ue = class extends he {
|
|
1543
1535
|
constructor(a, e, t) {
|
|
1544
1536
|
super();
|
|
1545
|
-
|
|
1537
|
+
g(this, "_formulaRuleMap", /* @__PURE__ */ new Map());
|
|
1546
1538
|
this._registerOtherFormulaService = a, this._dataValidationCacheService = e, this._dataValidationModel = t, this._initFormulaResultHandler();
|
|
1547
1539
|
}
|
|
1548
1540
|
_initFormulaResultHandler() {
|
|
@@ -1569,7 +1561,7 @@ let ue = class extends he {
|
|
|
1569
1561
|
return o || (o = /* @__PURE__ */ new Map(), t.set(e, o)), o;
|
|
1570
1562
|
}
|
|
1571
1563
|
addRule(a, e, t, o, n) {
|
|
1572
|
-
const i =
|
|
1564
|
+
const i = N(o), s = N(n);
|
|
1573
1565
|
if (!i && !s)
|
|
1574
1566
|
return;
|
|
1575
1567
|
const l = this._ensureRuleFormulaMap(a, e), d = [void 0, void 0];
|
|
@@ -1598,7 +1590,7 @@ let ue = class extends he {
|
|
|
1598
1590
|
}
|
|
1599
1591
|
const [l, d] = s;
|
|
1600
1592
|
if ((l == null ? void 0 : l.text) !== o)
|
|
1601
|
-
if (l && this._registerOtherFormulaService.deleteFormula(a, e, [l.id]),
|
|
1593
|
+
if (l && this._registerOtherFormulaService.deleteFormula(a, e, [l.id]), N(o)) {
|
|
1602
1594
|
const c = this._registerOtherFormulaService.registerFormula(a, e, o, { ruleId: t });
|
|
1603
1595
|
s[0] = {
|
|
1604
1596
|
text: o,
|
|
@@ -1607,7 +1599,7 @@ let ue = class extends he {
|
|
|
1607
1599
|
} else
|
|
1608
1600
|
s[0] = void 0;
|
|
1609
1601
|
if ((d == null ? void 0 : d.text) !== n)
|
|
1610
|
-
if (d && this._registerOtherFormulaService.deleteFormula(a, e, [d.id]),
|
|
1602
|
+
if (d && this._registerOtherFormulaService.deleteFormula(a, e, [d.id]), N(n)) {
|
|
1611
1603
|
const c = this._registerOtherFormulaService.registerFormula(a, e, n, { ruleId: t });
|
|
1612
1604
|
s[1] = {
|
|
1613
1605
|
text: n,
|
|
@@ -1639,23 +1631,23 @@ let ue = class extends he {
|
|
|
1639
1631
|
}
|
|
1640
1632
|
};
|
|
1641
1633
|
ue = Mi([
|
|
1642
|
-
Ut(0,
|
|
1643
|
-
Ut(1,
|
|
1644
|
-
Ut(2,
|
|
1634
|
+
Ut(0, I(fr)),
|
|
1635
|
+
Ut(1, I(mt)),
|
|
1636
|
+
Ut(2, I(K))
|
|
1645
1637
|
], ue);
|
|
1646
1638
|
var wi = Object.defineProperty, Ii = Object.getOwnPropertyDescriptor, yi = (r, a, e, t) => {
|
|
1647
1639
|
for (var o = t > 1 ? void 0 : t ? Ii(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
1648
1640
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
1649
1641
|
return t && o && wi(a, e, o), o;
|
|
1650
1642
|
}, $t = (r, a) => (e, t) => a(e, t, r);
|
|
1651
|
-
const
|
|
1643
|
+
const gt = 6;
|
|
1652
1644
|
let sa = class {
|
|
1653
1645
|
constructor(r, a, e) {
|
|
1654
1646
|
this._commandService = r, this._formulaService = a, this._themeService = e;
|
|
1655
1647
|
}
|
|
1656
1648
|
_calc(r, a) {
|
|
1657
1649
|
var d, c, u;
|
|
1658
|
-
const { vt: e, ht: t } = a || {}, o = r.endX - r.startX -
|
|
1650
|
+
const { vt: e, ht: t } = a || {}, o = r.endX - r.startX - gt * 2, n = r.endY - r.startY, i = ((d = a == null ? void 0 : a.fs) != null ? d : 10) * 1.6;
|
|
1659
1651
|
let s = 0, l = 0;
|
|
1660
1652
|
switch (e) {
|
|
1661
1653
|
case de.TOP:
|
|
@@ -1670,13 +1662,13 @@ let sa = class {
|
|
|
1670
1662
|
}
|
|
1671
1663
|
switch (t) {
|
|
1672
1664
|
case Ae.LEFT:
|
|
1673
|
-
s =
|
|
1665
|
+
s = gt;
|
|
1674
1666
|
break;
|
|
1675
1667
|
case Ae.RIGHT:
|
|
1676
|
-
s =
|
|
1668
|
+
s = gt + (o - i);
|
|
1677
1669
|
break;
|
|
1678
1670
|
default:
|
|
1679
|
-
s =
|
|
1671
|
+
s = gt + (o - i) / 2;
|
|
1680
1672
|
break;
|
|
1681
1673
|
}
|
|
1682
1674
|
return {
|
|
@@ -1693,21 +1685,21 @@ let sa = class {
|
|
|
1693
1685
|
}
|
|
1694
1686
|
async _parseFormula(r, a, e) {
|
|
1695
1687
|
var i, s;
|
|
1696
|
-
const { formula1: t =
|
|
1688
|
+
const { formula1: t = bt, formula2: o = la } = r, n = await this._formulaService.getRuleFormulaResult(a, e, r.uid);
|
|
1697
1689
|
return {
|
|
1698
|
-
formula1:
|
|
1699
|
-
formula2:
|
|
1690
|
+
formula1: N(t) ? Ce((i = n == null ? void 0 : n[0]) == null ? void 0 : i.result) : t,
|
|
1691
|
+
formula2: N(o) ? Ce((s = n == null ? void 0 : n[1]) == null ? void 0 : s.result) : o
|
|
1700
1692
|
};
|
|
1701
1693
|
}
|
|
1702
1694
|
drawWith(r, a) {
|
|
1703
|
-
var
|
|
1704
|
-
const { style: e, data: t, primaryWithCoord: o, unitId: n, subUnitId: i } = a, s = o.isMergedMainCell ? o.mergeInfo : o, l = ne(t), d = (
|
|
1695
|
+
var $, E, P, A, q;
|
|
1696
|
+
const { style: e, data: t, primaryWithCoord: o, unitId: n, subUnitId: i } = a, s = o.isMergedMainCell ? o.mergeInfo : o, l = ne(t), d = ($ = t.dataValidation) == null ? void 0 : $.rule, c = (E = t.dataValidation) == null ? void 0 : E.validator;
|
|
1705
1697
|
if (!d || !c)
|
|
1706
1698
|
return;
|
|
1707
1699
|
const u = this._themeService.getCurrentTheme();
|
|
1708
1700
|
if (!c.skipDefaultFontRender(d, l, { unitId: n, subUnitId: i }))
|
|
1709
1701
|
return;
|
|
1710
|
-
const { formula1:
|
|
1702
|
+
const { formula1: h = bt } = d, f = this._calc(s, e), { a: m, d: v } = r.getTransform(), R = Aa(f.left, m), _ = Aa(f.top, v), V = $o.create().composeMatrix({
|
|
1711
1703
|
left: R,
|
|
1712
1704
|
top: _,
|
|
1713
1705
|
scaleX: 1,
|
|
@@ -1717,16 +1709,16 @@ let sa = class {
|
|
|
1717
1709
|
skewY: 0,
|
|
1718
1710
|
flipX: !1,
|
|
1719
1711
|
flipY: !1
|
|
1720
|
-
}), S = s.endX - s.startX,
|
|
1721
|
-
r.save(), r.beginPath(), r.rect(s.startX, s.startY, S,
|
|
1722
|
-
const
|
|
1723
|
-
r.transform(
|
|
1724
|
-
const
|
|
1712
|
+
}), S = s.endX - s.startX, y = s.endY - s.startY;
|
|
1713
|
+
r.save(), r.beginPath(), r.rect(s.startX, s.startY, S, y), r.clip();
|
|
1714
|
+
const w = V.getMatrix();
|
|
1715
|
+
r.transform(w[0], w[1], w[2], w[3], w[4], w[5]);
|
|
1716
|
+
const F = ((P = e == null ? void 0 : e.fs) != null ? P : 10) * 1.6, x = String(l) === String(h), j = u.hyacinth500;
|
|
1725
1717
|
Wo.drawWith(r, {
|
|
1726
|
-
checked:
|
|
1727
|
-
width:
|
|
1728
|
-
height:
|
|
1729
|
-
fill: (
|
|
1718
|
+
checked: x,
|
|
1719
|
+
width: F,
|
|
1720
|
+
height: F,
|
|
1721
|
+
fill: (q = (A = e == null ? void 0 : e.cl) == null ? void 0 : A.rgb) != null ? q : j
|
|
1730
1722
|
}), r.restore();
|
|
1731
1723
|
}
|
|
1732
1724
|
isHit(r, a) {
|
|
@@ -1734,10 +1726,10 @@ let sa = class {
|
|
|
1734
1726
|
return l <= s && l >= i && d <= n && d >= o;
|
|
1735
1727
|
}
|
|
1736
1728
|
async onPointerDown(r, a) {
|
|
1737
|
-
var
|
|
1729
|
+
var h, f;
|
|
1738
1730
|
if (a.button === 2)
|
|
1739
1731
|
return;
|
|
1740
|
-
const { primaryWithCoord: e, unitId: t, subUnitId: o, data: n } = r, i = ne(n), s = (
|
|
1732
|
+
const { primaryWithCoord: e, unitId: t, subUnitId: o, data: n } = r, i = ne(n), s = (h = n.dataValidation) == null ? void 0 : h.rule, l = (f = n.dataValidation) == null ? void 0 : f.validator;
|
|
1741
1733
|
if (!s || !l || !l.skipDefaultFontRender(s, i, { unitId: t, subUnitId: o }))
|
|
1742
1734
|
return;
|
|
1743
1735
|
const { formula1: d, formula2: c } = await this._parseFormula(s, t, o), u = {
|
|
@@ -1760,27 +1752,27 @@ let sa = class {
|
|
|
1760
1752
|
};
|
|
1761
1753
|
sa = yi([
|
|
1762
1754
|
$t(0, re),
|
|
1763
|
-
$t(1,
|
|
1764
|
-
$t(2,
|
|
1755
|
+
$t(1, I(ue)),
|
|
1756
|
+
$t(2, I(Qr))
|
|
1765
1757
|
], sa);
|
|
1766
|
-
const
|
|
1758
|
+
const bt = 1, la = 0;
|
|
1767
1759
|
class Di extends $e {
|
|
1768
1760
|
constructor() {
|
|
1769
1761
|
super(...arguments);
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1762
|
+
g(this, "id", X.CHECKBOX);
|
|
1763
|
+
g(this, "title", "dataValidation.checkbox.title");
|
|
1764
|
+
g(this, "operators", []);
|
|
1765
|
+
g(this, "scopes", ["sheet"]);
|
|
1766
|
+
g(this, "formulaInput", Tr);
|
|
1767
|
+
g(this, "canvasRender", this.injector.createInstance(sa));
|
|
1768
|
+
g(this, "_formulaService", this.injector.get(ue));
|
|
1777
1769
|
}
|
|
1778
1770
|
skipDefaultFontRender(e, t, o) {
|
|
1779
1771
|
const { formula1: n, formula2: i } = this.parseFormulaSync(e, o.unitId, o.subUnitId), s = `${t != null ? t : ""}`;
|
|
1780
1772
|
return !s || s === `${n}` || s === `${i}`;
|
|
1781
1773
|
}
|
|
1782
1774
|
validatorFormula(e, t, o) {
|
|
1783
|
-
const { formula1: n, formula2: i } = e, s = !
|
|
1775
|
+
const { formula1: n, formula2: i } = e, s = !B.isBlank(n), l = !B.isBlank(i), d = n === i;
|
|
1784
1776
|
return {
|
|
1785
1777
|
success: s && l && !d || !s && !l,
|
|
1786
1778
|
formula1: s ? d ? this.localeService.t("dataValidation.validFail.checkboxEqual") : "" : this.localeService.t("dataValidation.validFail.common"),
|
|
@@ -1789,29 +1781,29 @@ class Di extends $e {
|
|
|
1789
1781
|
}
|
|
1790
1782
|
async parseFormula(e, t, o) {
|
|
1791
1783
|
var l, d;
|
|
1792
|
-
const { formula1: n =
|
|
1784
|
+
const { formula1: n = bt, formula2: i = la } = e, s = await this._formulaService.getRuleFormulaResult(t, o, e.uid);
|
|
1793
1785
|
return {
|
|
1794
|
-
formula1:
|
|
1795
|
-
formula2:
|
|
1786
|
+
formula1: N(n) ? Ce((l = s == null ? void 0 : s[0]) == null ? void 0 : l.result) : n,
|
|
1787
|
+
formula2: N(i) ? Ce((d = s == null ? void 0 : s[1]) == null ? void 0 : d.result) : i
|
|
1796
1788
|
};
|
|
1797
1789
|
}
|
|
1798
1790
|
parseFormulaSync(e, t, o) {
|
|
1799
1791
|
var l, d;
|
|
1800
|
-
const { formula1: n =
|
|
1792
|
+
const { formula1: n = bt, formula2: i = la } = e, s = this._formulaService.getRuleFormulaResultSync(t, o, e.uid);
|
|
1801
1793
|
return {
|
|
1802
|
-
formula1:
|
|
1803
|
-
formula2:
|
|
1794
|
+
formula1: N(n) ? Ce((l = s == null ? void 0 : s[0]) == null ? void 0 : l.result) : n,
|
|
1795
|
+
formula2: N(i) ? Ce((d = s == null ? void 0 : s[1]) == null ? void 0 : d.result) : i
|
|
1804
1796
|
};
|
|
1805
1797
|
}
|
|
1806
1798
|
async isValidType(e, t, o) {
|
|
1807
1799
|
const { value: n, unitId: i, subUnitId: s } = e, { formula1: l, formula2: d } = await this.parseFormula(o, i, s);
|
|
1808
|
-
return !
|
|
1800
|
+
return !B.isDefine(l) || !B.isDefine(d) ? !0 : B.isDefine(n) && (String(n) === String(l) || String(n) === String(d));
|
|
1809
1801
|
}
|
|
1810
1802
|
generateRuleErrorMessage(e) {
|
|
1811
1803
|
return this.localeService.t("dataValidation.checkbox.error");
|
|
1812
1804
|
}
|
|
1813
1805
|
}
|
|
1814
|
-
const
|
|
1806
|
+
const lt = [
|
|
1815
1807
|
C.BETWEEN,
|
|
1816
1808
|
C.NOT_BETWEEN
|
|
1817
1809
|
], Wt = 86400;
|
|
@@ -1861,7 +1853,7 @@ const Ti = {
|
|
|
1861
1853
|
[C.LESS_THAN_OR_EQUAL]: "dataValidation.date.ruleName.lessThanOrEqual",
|
|
1862
1854
|
[C.NOT_BETWEEN]: "dataValidation.date.ruleName.notBetween",
|
|
1863
1855
|
[C.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual"
|
|
1864
|
-
},
|
|
1856
|
+
}, Fi = {
|
|
1865
1857
|
[C.BETWEEN]: "dataValidation.date.errorMsg.between",
|
|
1866
1858
|
[C.EQUAL]: "dataValidation.date.errorMsg.equal",
|
|
1867
1859
|
[C.GREATER_THAN]: "dataValidation.date.errorMsg.greaterThan",
|
|
@@ -1870,16 +1862,16 @@ const Ti = {
|
|
|
1870
1862
|
[C.LESS_THAN_OR_EQUAL]: "dataValidation.date.errorMsg.lessThanOrEqual",
|
|
1871
1863
|
[C.NOT_BETWEEN]: "dataValidation.date.errorMsg.notBetween",
|
|
1872
1864
|
[C.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual"
|
|
1873
|
-
}, Wa = "{FORMULA1}", Ha = "{FORMULA2}", ka = (r) => je(r).isValid(),
|
|
1865
|
+
}, Wa = "{FORMULA1}", Ha = "{FORMULA2}", ka = (r) => je(r).isValid(), _t = (r) => {
|
|
1874
1866
|
if (!(r == null || typeof r == "boolean"))
|
|
1875
1867
|
return typeof r == "number" || !Number.isNaN(+r) ? je(Oi(+r)) : je(r);
|
|
1876
1868
|
};
|
|
1877
|
-
class
|
|
1869
|
+
class Ni extends $e {
|
|
1878
1870
|
constructor() {
|
|
1879
1871
|
super(...arguments);
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1872
|
+
g(this, "id", X.DATE);
|
|
1873
|
+
g(this, "title", "dataValidation.date.title");
|
|
1874
|
+
g(this, "operators", [
|
|
1883
1875
|
C.BETWEEN,
|
|
1884
1876
|
C.EQUAL,
|
|
1885
1877
|
C.GREATER_THAN,
|
|
@@ -1889,18 +1881,18 @@ class Fi extends $e {
|
|
|
1889
1881
|
C.NOT_BETWEEN,
|
|
1890
1882
|
C.NOT_EQUAL
|
|
1891
1883
|
]);
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1884
|
+
g(this, "scopes", ["sheet"]);
|
|
1885
|
+
g(this, "formulaInput", ht);
|
|
1886
|
+
g(this, "dropdown", jr);
|
|
1887
|
+
g(this, "_formulaService", this.injector.get(ue));
|
|
1888
|
+
g(this, "transformDate", _t);
|
|
1897
1889
|
}
|
|
1898
1890
|
async parseFormula(e, t, o) {
|
|
1899
1891
|
var l, d;
|
|
1900
1892
|
const n = await this._formulaService.getRuleFormulaResult(t, o, e.uid), { formula1: i, formula2: s } = e;
|
|
1901
1893
|
return {
|
|
1902
|
-
formula1:
|
|
1903
|
-
formula2:
|
|
1894
|
+
formula1: _t(N(i) ? Ce((l = n == null ? void 0 : n[0]) == null ? void 0 : l.result) : i),
|
|
1895
|
+
formula2: _t(N(s) ? Ce((d = n == null ? void 0 : n[1]) == null ? void 0 : d.result) : s)
|
|
1904
1896
|
};
|
|
1905
1897
|
}
|
|
1906
1898
|
async isValidType(e) {
|
|
@@ -1908,7 +1900,7 @@ class Fi extends $e {
|
|
|
1908
1900
|
return typeof t == "string" ? je(t).isValid() : typeof t == "number";
|
|
1909
1901
|
}
|
|
1910
1902
|
_validatorSingleFormula(e) {
|
|
1911
|
-
return !
|
|
1903
|
+
return !B.isBlank(e) && (N(e) || !Number.isNaN(+e) || !!e && je(e).isValid());
|
|
1912
1904
|
}
|
|
1913
1905
|
validatorFormula(e, t, o) {
|
|
1914
1906
|
const n = e.operator;
|
|
@@ -1917,7 +1909,7 @@ class Fi extends $e {
|
|
|
1917
1909
|
success: !1
|
|
1918
1910
|
};
|
|
1919
1911
|
const i = this._validatorSingleFormula(e.formula1), s = this.localeService.t("dataValidation.validFail.date");
|
|
1920
|
-
if (
|
|
1912
|
+
if (lt.includes(n)) {
|
|
1921
1913
|
const d = this._validatorSingleFormula(e.formula2);
|
|
1922
1914
|
return {
|
|
1923
1915
|
success: i && d,
|
|
@@ -1934,7 +1926,7 @@ class Fi extends $e {
|
|
|
1934
1926
|
const { value: n } = e;
|
|
1935
1927
|
return {
|
|
1936
1928
|
...e,
|
|
1937
|
-
value:
|
|
1929
|
+
value: _t(n)
|
|
1938
1930
|
};
|
|
1939
1931
|
}
|
|
1940
1932
|
async validatorIsEqual(e, t, o) {
|
|
@@ -1976,14 +1968,14 @@ class Fi extends $e {
|
|
|
1976
1968
|
return n ? o.isBefore(n) || o.isSame(n) : !0;
|
|
1977
1969
|
}
|
|
1978
1970
|
validatorFormulaValue(e) {
|
|
1979
|
-
if (!
|
|
1971
|
+
if (!B.isDefine(e.operator))
|
|
1980
1972
|
return;
|
|
1981
|
-
if (
|
|
1982
|
-
if (
|
|
1973
|
+
if (lt.includes(e.operator)) {
|
|
1974
|
+
if (B.isBlank(e.formula1) || B.isBlank(e.formula2))
|
|
1983
1975
|
return "";
|
|
1984
1976
|
if (!ka(e.formula1) || !ka(e.formula2))
|
|
1985
1977
|
return "";
|
|
1986
|
-
} else if (
|
|
1978
|
+
} else if (B.isBlank(e.formula1))
|
|
1987
1979
|
return "";
|
|
1988
1980
|
}
|
|
1989
1981
|
get operatorNames() {
|
|
@@ -1998,7 +1990,7 @@ class Fi extends $e {
|
|
|
1998
1990
|
}
|
|
1999
1991
|
generateRuleErrorMessage(e) {
|
|
2000
1992
|
var o, n;
|
|
2001
|
-
return e.operator ? `${this.localeService.t(
|
|
1993
|
+
return e.operator ? `${this.localeService.t(Fi[e.operator]).replace(Wa, (o = e.formula1) != null ? o : "").replace(Ha, (n = e.formula2) != null ? n : "")}` : this.titleStr;
|
|
2002
1994
|
}
|
|
2003
1995
|
}
|
|
2004
1996
|
var Li = Object.defineProperty, Pi = Object.getOwnPropertyDescriptor, Ai = (r, a, e, t) => {
|
|
@@ -2006,7 +1998,7 @@ var Li = Object.defineProperty, Pi = Object.getOwnPropertyDescriptor, Ai = (r, a
|
|
|
2006
1998
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
2007
1999
|
return t && o && Li(a, e, o), o;
|
|
2008
2000
|
}, Ya = (r, a) => (e, t) => a(e, t, r);
|
|
2009
|
-
const ke = 4, xi = 6, fe = 14, Te = 6, we = 4, ji = "#565656",
|
|
2001
|
+
const ke = 4, xi = 6, fe = 14, Te = 6, we = 4, ji = "#565656", Xa = 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");
|
|
2010
2002
|
function Bi(r, a) {
|
|
2011
2003
|
const e = r.length;
|
|
2012
2004
|
return {
|
|
@@ -2047,7 +2039,7 @@ function Bi(r, a) {
|
|
|
2047
2039
|
}
|
|
2048
2040
|
};
|
|
2049
2041
|
}
|
|
2050
|
-
function
|
|
2042
|
+
function Fr(r, a, e) {
|
|
2051
2043
|
const t = Bi(r, e), o = new Kr(t), n = new Ho(o);
|
|
2052
2044
|
return {
|
|
2053
2045
|
documentSkeleton: ko.create(n, a),
|
|
@@ -2060,9 +2052,9 @@ function Ht(r, a, e) {
|
|
|
2060
2052
|
documentSkeleton: t,
|
|
2061
2053
|
docModel: o,
|
|
2062
2054
|
docViewModel: n
|
|
2063
|
-
} =
|
|
2055
|
+
} = Fr(r, a, e);
|
|
2064
2056
|
return {
|
|
2065
|
-
documents: new Yo(`DOCUMENTS_${
|
|
2057
|
+
documents: new Yo(`DOCUMENTS_${B.generateRandomId()}`, t, {
|
|
2066
2058
|
pageMarginLeft: 0,
|
|
2067
2059
|
pageMarginTop: 0
|
|
2068
2060
|
}),
|
|
@@ -2071,7 +2063,7 @@ function Ht(r, a, e) {
|
|
|
2071
2063
|
docViewModel: n
|
|
2072
2064
|
};
|
|
2073
2065
|
}
|
|
2074
|
-
function
|
|
2066
|
+
function Ga(r, a, e, t, o, n) {
|
|
2075
2067
|
let i = 0;
|
|
2076
2068
|
switch (o) {
|
|
2077
2069
|
case de.BOTTOM:
|
|
@@ -2101,10 +2093,10 @@ function Xa(r, a, e, t, o, n) {
|
|
|
2101
2093
|
var Zt;
|
|
2102
2094
|
let da = (Zt = class {
|
|
2103
2095
|
constructor(r, a) {
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2096
|
+
g(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
|
2097
|
+
g(this, "zIndex");
|
|
2098
|
+
g(this, "onPointerEnter");
|
|
2099
|
+
g(this, "onPointerLeave");
|
|
2108
2100
|
this._localeService = r, this._commandService = a;
|
|
2109
2101
|
}
|
|
2110
2102
|
_ensureMap(r) {
|
|
@@ -2116,36 +2108,36 @@ let da = (Zt = class {
|
|
|
2116
2108
|
}
|
|
2117
2109
|
_drawDownIcon(r, a, e, t, o) {
|
|
2118
2110
|
const n = e - fe + 4;
|
|
2119
|
-
let i =
|
|
2111
|
+
let i = 9;
|
|
2120
2112
|
switch (o) {
|
|
2121
2113
|
case de.MIDDLE:
|
|
2122
2114
|
i = (t - fe) / 2 + 4;
|
|
2123
2115
|
break;
|
|
2124
2116
|
case de.BOTTOM:
|
|
2125
|
-
i = t - fe
|
|
2117
|
+
i = t - fe - 1;
|
|
2126
2118
|
break;
|
|
2127
2119
|
}
|
|
2128
|
-
r.save(), r.translateWithPrecision(a.startX + n, a.startY + i), r.fillStyle = "#565656", r.fill(
|
|
2120
|
+
r.save(), r.translateWithPrecision(a.startX + n, a.startY + i), r.fillStyle = "#565656", r.fill(Xa), r.restore();
|
|
2129
2121
|
}
|
|
2130
2122
|
// eslint-disable-next-line max-lines-per-function
|
|
2131
2123
|
drawWith(r, a, e) {
|
|
2132
|
-
var
|
|
2133
|
-
const { primaryWithCoord: t, row: o, col: n, style: i, data: s, subUnitId: l } = a, d = t.isMergedMainCell ? t.mergeInfo : t, c = (
|
|
2124
|
+
var q, L;
|
|
2125
|
+
const { primaryWithCoord: t, row: o, col: n, style: i, data: s, subUnitId: l } = a, d = t.isMergedMainCell ? t.mergeInfo : t, c = (q = s.dataValidation) == null ? void 0 : q.rule, u = (L = s.dataValidation) == null ? void 0 : L.validator, h = s.fontRenderExtension, { leftOffset: f = 0, rightOffset: m = 0, topOffset: v = 0, downOffset: R = 0 } = h || {};
|
|
2134
2126
|
if (!c || !u || !u.skipDefaultFontRender(c))
|
|
2135
2127
|
return;
|
|
2136
2128
|
const _ = {
|
|
2137
2129
|
startX: d.startX + f,
|
|
2138
|
-
endX: d.endX -
|
|
2139
|
-
startY: d.startY +
|
|
2130
|
+
endX: d.endX - m,
|
|
2131
|
+
startY: d.startY + v,
|
|
2140
2132
|
endY: d.endY - R
|
|
2141
|
-
}, V = _.endX - _.startX, S = _.endY - _.startY,
|
|
2142
|
-
let { tb:
|
|
2143
|
-
if (
|
|
2144
|
-
this._drawDownIcon(r, _, V, S,
|
|
2145
|
-
const
|
|
2146
|
-
|
|
2147
|
-
const M =
|
|
2148
|
-
r.translate(0,
|
|
2133
|
+
}, V = _.endX - _.startX, S = _.endY - _.startY, y = this._ensureMap(l), w = this._generateKey(o, n), F = u.getListWithColor(c), x = ne(s), j = `${x != null ? x : ""}`, $ = F.find((b) => b.label === j);
|
|
2134
|
+
let { tb: E, vt: P, ht: A } = i || {};
|
|
2135
|
+
if (E = E != null ? E : pe.WRAP, P = P != null ? P : de.BOTTOM, A = A != null ? A : Ae.LEFT, c.renderMode === ce.ARROW) {
|
|
2136
|
+
this._drawDownIcon(r, _, V, S, P), r.save(), r.translateWithPrecision(_.startX, _.startY), r.beginPath(), r.rect(0, 0, V, S), r.clip();
|
|
2137
|
+
const b = V - fe, { documentSkeleton: Y, documents: Z, docModel: H } = Ht(j, this._localeService, i);
|
|
2138
|
+
E === pe.WRAP && H.updateDocumentDataPageSize(Math.max(b, 1)), Y.calculate(), Y.getActualSize();
|
|
2139
|
+
const M = ft(Y), { height: O, width: J } = M, { paddingTop: G, paddingLeft: me } = Ga(b, S, J, O, P, A);
|
|
2140
|
+
r.translate(0, G), r.save(), r.translateWithPrecision(ke, 0), r.beginPath(), r.rect(0, 0, b, O), r.clip(), Z.render(r), r.translateWithPrecision(me, 0), r.restore(), r.restore(), y.set(w, {
|
|
2149
2141
|
left: _.endX + e.rowHeaderWidth - fe,
|
|
2150
2142
|
top: _.startY + e.columnHeaderHeight,
|
|
2151
2143
|
width: fe,
|
|
@@ -2153,19 +2145,19 @@ let da = (Zt = class {
|
|
|
2153
2145
|
});
|
|
2154
2146
|
} else {
|
|
2155
2147
|
r.save(), r.translateWithPrecision(_.startX, _.startY), r.beginPath(), r.rect(0, 0, V, S), r.clip();
|
|
2156
|
-
const
|
|
2157
|
-
|
|
2158
|
-
const M =
|
|
2159
|
-
r.translate(Te,
|
|
2160
|
-
const D = Math.max(V - Te * 2, 1), W =
|
|
2148
|
+
const b = V - Te * 2 - ke - fe, { documentSkeleton: Y, documents: Z, docModel: H } = Ht(j, this._localeService, i);
|
|
2149
|
+
E === pe.WRAP && H.updateDocumentDataPageSize(Math.max(b, 1)), Y.calculate();
|
|
2150
|
+
const M = ft(Y), { height: O, width: J } = M, { paddingTop: G, paddingLeft: me } = Ga(b, S, J, O, P, A);
|
|
2151
|
+
r.translate(Te, G);
|
|
2152
|
+
const D = Math.max(V - Te * 2, 1), W = O;
|
|
2161
2153
|
dr.drawWith(r, {
|
|
2162
2154
|
width: D,
|
|
2163
2155
|
height: W,
|
|
2164
|
-
fill: (
|
|
2156
|
+
fill: ($ == null ? void 0 : $.color) || Ne,
|
|
2165
2157
|
radius: 8
|
|
2166
|
-
}), r.save(), r.translateWithPrecision(ke, 0), r.beginPath(), r.rect(0, 0,
|
|
2158
|
+
}), r.save(), r.translateWithPrecision(ke, 0), r.beginPath(), r.rect(0, 0, b, O), r.clip(), r.translateWithPrecision(me, 0), Z.render(r), r.restore(), r.translate(b + ke + 4, (O - xi) / 2), r.fillStyle = ji, r.fill(Xa), r.restore(), y.set(w, {
|
|
2167
2159
|
left: _.startX + Te + e.rowHeaderWidth,
|
|
2168
|
-
top: _.startY +
|
|
2160
|
+
top: _.startY + G + e.columnHeaderHeight,
|
|
2169
2161
|
width: D,
|
|
2170
2162
|
height: W
|
|
2171
2163
|
});
|
|
@@ -2181,28 +2173,28 @@ let da = (Zt = class {
|
|
|
2181
2173
|
endX: o.endX - s,
|
|
2182
2174
|
startY: o.startY + l,
|
|
2183
2175
|
endY: o.endY - d
|
|
2184
|
-
},
|
|
2185
|
-
let { tb:
|
|
2186
|
-
if (
|
|
2187
|
-
const _ =
|
|
2188
|
-
|
|
2189
|
-
const
|
|
2190
|
-
return
|
|
2176
|
+
}, h = u.endX - u.startX, f = ne(t), m = `${f != null ? f : ""}`;
|
|
2177
|
+
let { tb: v } = e || {};
|
|
2178
|
+
if (v = v != null ? v : pe.WRAP, c.renderMode === ce.ARROW) {
|
|
2179
|
+
const _ = h - fe, { documentSkeleton: V, docModel: S } = Ht(m, this._localeService, e);
|
|
2180
|
+
v === pe.WRAP && S.updateDocumentDataPageSize(Math.max(_, 1)), V.calculate(), V.getActualSize();
|
|
2181
|
+
const y = ft(V), { height: w } = y;
|
|
2182
|
+
return w;
|
|
2191
2183
|
} else {
|
|
2192
|
-
const _ =
|
|
2193
|
-
|
|
2194
|
-
const
|
|
2195
|
-
height:
|
|
2196
|
-
} =
|
|
2197
|
-
return
|
|
2184
|
+
const _ = h - Te * 2 - ke - fe, { documentSkeleton: V, docModel: S } = Fr(m, this._localeService, e);
|
|
2185
|
+
v === pe.WRAP && S.updateDocumentDataPageSize(Math.max(_, 1)), V.calculate();
|
|
2186
|
+
const y = ft(V), {
|
|
2187
|
+
height: w
|
|
2188
|
+
} = y;
|
|
2189
|
+
return w + we * 2;
|
|
2198
2190
|
}
|
|
2199
2191
|
}
|
|
2200
2192
|
isHit(r, a) {
|
|
2201
2193
|
const { data: e, subUnitId: t, row: o, col: n } = a, s = this._ensureMap(t).get(this._generateKey(o, n)), l = e.dataValidation;
|
|
2202
2194
|
if (!l || !s || l.rule.renderMode === ce.TEXT)
|
|
2203
2195
|
return !1;
|
|
2204
|
-
const { top: d, left: c, width: u, height:
|
|
2205
|
-
return f >= c && f <= c + u &&
|
|
2196
|
+
const { top: d, left: c, width: u, height: h } = s, { x: f, y: m } = r;
|
|
2197
|
+
return f >= c && f <= c + u && m >= d && m <= d + h;
|
|
2206
2198
|
}
|
|
2207
2199
|
onPointerDown(r, a) {
|
|
2208
2200
|
if (a.button === 2)
|
|
@@ -2215,27 +2207,27 @@ let da = (Zt = class {
|
|
|
2215
2207
|
};
|
|
2216
2208
|
this._commandService.executeCommand(Va.id, i);
|
|
2217
2209
|
}
|
|
2218
|
-
},
|
|
2210
|
+
}, g(Zt, "padding", {
|
|
2219
2211
|
l: Te + ke,
|
|
2220
2212
|
r: fe + Te,
|
|
2221
2213
|
t: we,
|
|
2222
2214
|
b: we
|
|
2223
2215
|
}), Zt);
|
|
2224
2216
|
da = Ai([
|
|
2225
|
-
Ya(0,
|
|
2217
|
+
Ya(0, I(ie)),
|
|
2226
2218
|
Ya(1, re)
|
|
2227
2219
|
], da);
|
|
2228
2220
|
const Ui = "LIST_RENDER_MODE_OPTION_INPUT";
|
|
2229
|
-
function
|
|
2221
|
+
function Tt(r) {
|
|
2230
2222
|
var o;
|
|
2231
|
-
const { value: a, onChange: e } = r, t =
|
|
2223
|
+
const { value: a, onChange: e } = r, t = T(ie);
|
|
2232
2224
|
return /* @__PURE__ */ p.jsx(Q, { label: t.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ p.jsxs(Sa, { value: `${(o = a.renderMode) != null ? o : ce.CUSTOM}`, onChange: (n) => e({ ...a, renderMode: +n }), children: [
|
|
2233
2225
|
/* @__PURE__ */ p.jsx(Le, { value: `${ce.CUSTOM}`, children: t.t("dataValidation.renderMode.chip") }),
|
|
2234
2226
|
/* @__PURE__ */ p.jsx(Le, { value: `${ce.ARROW}`, children: t.t("dataValidation.renderMode.arrow") }),
|
|
2235
2227
|
/* @__PURE__ */ p.jsx(Le, { value: `${ce.TEXT}`, children: t.t("dataValidation.renderMode.text") })
|
|
2236
2228
|
] }) });
|
|
2237
2229
|
}
|
|
2238
|
-
|
|
2230
|
+
Tt.componentKey = Ui;
|
|
2239
2231
|
function kt(r) {
|
|
2240
2232
|
if (!r)
|
|
2241
2233
|
return [];
|
|
@@ -2256,7 +2248,7 @@ const $i = [
|
|
|
2256
2248
|
"offset"
|
|
2257
2249
|
];
|
|
2258
2250
|
function Wi(r, a) {
|
|
2259
|
-
if (!
|
|
2251
|
+
if (!N(r) || Ca(r.slice(1)))
|
|
2260
2252
|
return !0;
|
|
2261
2253
|
const t = a.sequenceNodesBuilder(r);
|
|
2262
2254
|
return t && t.some((o) => typeof o == "object" && o.nodeType === en.FUNCTION && $i.indexOf(o.token.toLowerCase()) > -1);
|
|
@@ -2270,27 +2262,27 @@ function Hi(r, a) {
|
|
|
2270
2262
|
}
|
|
2271
2263
|
return !1;
|
|
2272
2264
|
}
|
|
2273
|
-
class
|
|
2265
|
+
class Nr extends $e {
|
|
2274
2266
|
constructor() {
|
|
2275
2267
|
super(...arguments);
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2268
|
+
g(this, "formulaService", this.injector.get(ue));
|
|
2269
|
+
g(this, "_lexer", this.injector.get(Ra));
|
|
2270
|
+
g(this, "_univerInstanceService", this.injector.get(te));
|
|
2271
|
+
g(this, "id", X.LIST);
|
|
2272
|
+
g(this, "title", "dataValidation.list.title");
|
|
2273
|
+
g(this, "operators", []);
|
|
2274
|
+
g(this, "scopes", ["sheet"]);
|
|
2275
|
+
g(this, "formulaInput", br);
|
|
2276
|
+
g(this, "canvasRender", this.injector.createInstance(da));
|
|
2277
|
+
g(this, "dropdown", xr);
|
|
2278
|
+
g(this, "optionsInput", Tt.componentKey);
|
|
2287
2279
|
}
|
|
2288
2280
|
skipDefaultFontRender(e) {
|
|
2289
2281
|
return e.renderMode !== ce.TEXT;
|
|
2290
2282
|
}
|
|
2291
2283
|
validatorFormula(e, t, o) {
|
|
2292
2284
|
var d, c, u;
|
|
2293
|
-
const n = !
|
|
2285
|
+
const n = !B.isBlank(e.formula1), i = Wi((d = e.formula1) != null ? d : "", this._lexer), s = (u = (c = this._univerInstanceService.getUnit(t, ae.UNIVER_SHEET)) == null ? void 0 : c.getSheetBySheetId(o)) == null ? void 0 : u.getName(), l = Hi(e, s != null ? s : "");
|
|
2294
2286
|
return {
|
|
2295
2287
|
success: !!(n && i && !l),
|
|
2296
2288
|
formula1: n ? i ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -2298,13 +2290,13 @@ class Fr extends $e {
|
|
|
2298
2290
|
}
|
|
2299
2291
|
parseCellValue(e) {
|
|
2300
2292
|
const t = e.toString();
|
|
2301
|
-
return
|
|
2293
|
+
return Ge(t);
|
|
2302
2294
|
}
|
|
2303
2295
|
async parseFormula(e, t, o) {
|
|
2304
2296
|
var s;
|
|
2305
2297
|
const { formula1: n = "" } = e, i = await this.formulaService.getRuleFormulaResult(t, o, e.uid);
|
|
2306
2298
|
return {
|
|
2307
|
-
formula1:
|
|
2299
|
+
formula1: N(n) ? kt((s = i == null ? void 0 : i[0]) == null ? void 0 : s.result) : Ge(n),
|
|
2308
2300
|
formula2: void 0
|
|
2309
2301
|
};
|
|
2310
2302
|
}
|
|
@@ -2319,20 +2311,22 @@ class Fr extends $e {
|
|
|
2319
2311
|
return this.localeService.t("dataValidation.list.error");
|
|
2320
2312
|
}
|
|
2321
2313
|
getList(e, t, o) {
|
|
2322
|
-
var
|
|
2323
|
-
const { formula1: n = "" } = e, i = this.injector.get(
|
|
2324
|
-
if (!s)
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2314
|
+
var h, f, m;
|
|
2315
|
+
const { formula1: n = "" } = e, i = this.injector.get(te), s = (h = t ? i.getUniverSheetInstance(t) : void 0) != null ? h : i.getCurrentUnitForType(ae.UNIVER_SHEET);
|
|
2316
|
+
if (!s) return [];
|
|
2317
|
+
const l = (f = o ? s.getSheetBySheetId(o) : void 0) != null ? f : s.getActiveSheet();
|
|
2318
|
+
if (!l) return [];
|
|
2319
|
+
const d = s.getUnitId(), c = l.getSheetId(), u = this.formulaService.getRuleFormulaResultSync(d, c, e.uid);
|
|
2320
|
+
return N(n) ? kt((m = u == null ? void 0 : u[0]) == null ? void 0 : m.result) : Ge(n);
|
|
2328
2321
|
}
|
|
2329
2322
|
async getListAsync(e, t, o) {
|
|
2330
|
-
var
|
|
2331
|
-
const { formula1: n = "" } = e, i = this.injector.get(
|
|
2332
|
-
if (!s)
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2323
|
+
var h, f, m;
|
|
2324
|
+
const { formula1: n = "" } = e, i = this.injector.get(te), s = (h = t ? i.getUniverSheetInstance(t) : void 0) != null ? h : i.getCurrentUnitForType(ae.UNIVER_SHEET);
|
|
2325
|
+
if (!s) return [];
|
|
2326
|
+
const l = (f = o ? s.getSheetBySheetId(o) : void 0) != null ? f : s.getActiveSheet();
|
|
2327
|
+
if (!l) return [];
|
|
2328
|
+
const d = s.getUnitId(), c = l.getSheetId(), u = await this.formulaService.getRuleFormulaResult(d, c, e.uid);
|
|
2329
|
+
return N(n) ? kt((m = u == null ? void 0 : u[0]) == null ? void 0 : m.result) : Ge(n);
|
|
2336
2330
|
}
|
|
2337
2331
|
getListWithColor(e, t, o) {
|
|
2338
2332
|
const n = this.getList(e, t, o), i = (e.formula2 || "").split(",");
|
|
@@ -2345,17 +2339,17 @@ class Fr extends $e {
|
|
|
2345
2339
|
}), i;
|
|
2346
2340
|
}
|
|
2347
2341
|
}
|
|
2348
|
-
function
|
|
2342
|
+
function Ft(r) {
|
|
2349
2343
|
let a = r;
|
|
2350
2344
|
return typeof r == "string" ? ((r.startsWith("¥") || r.startsWith("$")) && (a = r.slice(1)), +a) : +r;
|
|
2351
2345
|
}
|
|
2352
2346
|
class ki extends $e {
|
|
2353
2347
|
constructor() {
|
|
2354
2348
|
super(...arguments);
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2349
|
+
g(this, "_formulaService", this.injector.get(ue));
|
|
2350
|
+
g(this, "id", X.DECIMAL);
|
|
2351
|
+
g(this, "title", "dataValidation.decimal.title");
|
|
2352
|
+
g(this, "operators", [
|
|
2359
2353
|
C.BETWEEN,
|
|
2360
2354
|
C.EQUAL,
|
|
2361
2355
|
C.GREATER_THAN,
|
|
@@ -2365,33 +2359,33 @@ class ki extends $e {
|
|
|
2365
2359
|
C.NOT_BETWEEN,
|
|
2366
2360
|
C.NOT_EQUAL
|
|
2367
2361
|
]);
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2362
|
+
g(this, "scopes", ["sheet"]);
|
|
2363
|
+
g(this, "formulaInput", ht);
|
|
2364
|
+
g(this, "dropDownInput");
|
|
2371
2365
|
}
|
|
2372
2366
|
_isFormulaOrNumber(e) {
|
|
2373
|
-
return !
|
|
2367
|
+
return !B.isBlank(e) && (N(e) || !Number.isNaN(+e));
|
|
2374
2368
|
}
|
|
2375
2369
|
async isValidType(e, t, o) {
|
|
2376
2370
|
const { value: n } = e;
|
|
2377
|
-
return !Number.isNaN(
|
|
2371
|
+
return !Number.isNaN(Ft(n));
|
|
2378
2372
|
}
|
|
2379
2373
|
transform(e, t, o) {
|
|
2380
2374
|
const { value: n } = e;
|
|
2381
2375
|
return {
|
|
2382
2376
|
...e,
|
|
2383
|
-
value:
|
|
2377
|
+
value: Ft(n)
|
|
2384
2378
|
};
|
|
2385
2379
|
}
|
|
2386
2380
|
_parseNumber(e) {
|
|
2387
2381
|
return e == null ? Number.NaN : +e;
|
|
2388
2382
|
}
|
|
2389
2383
|
async parseFormula(e, t, o) {
|
|
2390
|
-
var d, c, u,
|
|
2384
|
+
var d, c, u, h, f, m, v, R;
|
|
2391
2385
|
const n = await this._formulaService.getRuleFormulaResult(t, o, e.uid), { formula1: i, formula2: s } = e;
|
|
2392
2386
|
return {
|
|
2393
|
-
formula1: this._parseNumber(
|
|
2394
|
-
formula2: this._parseNumber(
|
|
2387
|
+
formula1: this._parseNumber(N(i) ? (h = (u = (c = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : c[0]) == null ? void 0 : u[0]) == null ? void 0 : h.v : i),
|
|
2388
|
+
formula2: this._parseNumber(N(s) ? (R = (v = (m = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : m[0]) == null ? void 0 : v[0]) == null ? void 0 : R.v : s)
|
|
2395
2389
|
};
|
|
2396
2390
|
}
|
|
2397
2391
|
validatorFormula(e, t, o) {
|
|
@@ -2400,7 +2394,7 @@ class ki extends $e {
|
|
|
2400
2394
|
return {
|
|
2401
2395
|
success: !1
|
|
2402
2396
|
};
|
|
2403
|
-
const i =
|
|
2397
|
+
const i = B.isDefine(e.formula1) && this._isFormulaOrNumber(e.formula1), s = B.isDefine(e.formula2) && this._isFormulaOrNumber(e.formula2), l = lt.includes(n), d = this.localeService.t("dataValidation.validFail.number");
|
|
2404
2398
|
return l ? {
|
|
2405
2399
|
success: i && s,
|
|
2406
2400
|
formula1: i ? void 0 : d,
|
|
@@ -2449,13 +2443,13 @@ class ki extends $e {
|
|
|
2449
2443
|
return Number.isNaN(n) ? !0 : e.value <= n;
|
|
2450
2444
|
}
|
|
2451
2445
|
}
|
|
2452
|
-
const Yi = "{FORMULA1}",
|
|
2453
|
-
class
|
|
2446
|
+
const Yi = "{FORMULA1}", Xi = "{FORMULA2}";
|
|
2447
|
+
class Gi extends $e {
|
|
2454
2448
|
constructor() {
|
|
2455
2449
|
super(...arguments);
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2450
|
+
g(this, "id", X.TEXT_LENGTH);
|
|
2451
|
+
g(this, "title", "dataValidation.textLength.title");
|
|
2452
|
+
g(this, "operators", [
|
|
2459
2453
|
C.BETWEEN,
|
|
2460
2454
|
C.EQUAL,
|
|
2461
2455
|
C.GREATER_THAN,
|
|
@@ -2465,12 +2459,12 @@ class Xi extends $e {
|
|
|
2465
2459
|
C.NOT_BETWEEN,
|
|
2466
2460
|
C.NOT_EQUAL
|
|
2467
2461
|
]);
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2462
|
+
g(this, "scopes", ["sheet"]);
|
|
2463
|
+
g(this, "formulaInput", ht);
|
|
2464
|
+
g(this, "_formulaService", this.injector.get(ue));
|
|
2471
2465
|
}
|
|
2472
2466
|
_isFormulaOrInt(e) {
|
|
2473
|
-
return !
|
|
2467
|
+
return !B.isBlank(e) && (N(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2474
2468
|
}
|
|
2475
2469
|
validatorFormula(e, t, o) {
|
|
2476
2470
|
const n = e.operator;
|
|
@@ -2478,7 +2472,7 @@ class Xi extends $e {
|
|
|
2478
2472
|
return {
|
|
2479
2473
|
success: !1
|
|
2480
2474
|
};
|
|
2481
|
-
const i =
|
|
2475
|
+
const i = B.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), s = B.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = lt.includes(n), d = this.localeService.t("dataValidation.validFail.number");
|
|
2482
2476
|
return l ? {
|
|
2483
2477
|
success: i && s,
|
|
2484
2478
|
formula1: i ? void 0 : d,
|
|
@@ -2495,11 +2489,11 @@ class Xi extends $e {
|
|
|
2495
2489
|
return !Number.isNaN(e);
|
|
2496
2490
|
}
|
|
2497
2491
|
async parseFormula(e, t, o) {
|
|
2498
|
-
var l, d, c, u,
|
|
2492
|
+
var l, d, c, u, h, f, m, v;
|
|
2499
2493
|
const n = await this._formulaService.getRuleFormulaResult(t, o, e.uid), { formula1: i, formula2: s } = e;
|
|
2500
2494
|
return {
|
|
2501
|
-
formula1: this._parseNumber(
|
|
2502
|
-
formula2: this._parseNumber(
|
|
2495
|
+
formula1: this._parseNumber(N(i) ? (u = (c = (d = (l = n == null ? void 0 : n[0]) == null ? void 0 : l.result) == null ? void 0 : d[0]) == null ? void 0 : c[0]) == null ? void 0 : u.v : i),
|
|
2496
|
+
formula2: this._parseNumber(N(s) ? (v = (m = (f = (h = n == null ? void 0 : n[1]) == null ? void 0 : h.result) == null ? void 0 : f[0]) == null ? void 0 : m[0]) == null ? void 0 : v.v : s)
|
|
2503
2497
|
};
|
|
2504
2498
|
}
|
|
2505
2499
|
transform(e, t, o) {
|
|
@@ -2514,11 +2508,11 @@ class Xi extends $e {
|
|
|
2514
2508
|
}
|
|
2515
2509
|
async validatorIsEqual(e, t, o) {
|
|
2516
2510
|
const { formula1: n } = t;
|
|
2517
|
-
return
|
|
2511
|
+
return B.isDefine(n) ? e.value === n : !1;
|
|
2518
2512
|
}
|
|
2519
2513
|
async validatorIsNotEqual(e, t, o) {
|
|
2520
2514
|
const { formula1: n } = t;
|
|
2521
|
-
return
|
|
2515
|
+
return B.isDefine(n) ? e.value !== n : !1;
|
|
2522
2516
|
}
|
|
2523
2517
|
async validatorIsBetween(e, t, o) {
|
|
2524
2518
|
const { formula1: n, formula2: i } = t, { value: s } = e;
|
|
@@ -2552,16 +2546,16 @@ class Xi extends $e {
|
|
|
2552
2546
|
}
|
|
2553
2547
|
generateRuleErrorMessage(e) {
|
|
2554
2548
|
var o, n;
|
|
2555
|
-
return e.operator ? `${this.localeService.t(io[e.operator]).replace(Yi, (o = e.formula1) != null ? o : "").replace(
|
|
2549
|
+
return e.operator ? `${this.localeService.t(io[e.operator]).replace(Yi, (o = e.formula1) != null ? o : "").replace(Xi, (n = e.formula2) != null ? n : "")}` : this.titleStr;
|
|
2556
2550
|
}
|
|
2557
2551
|
}
|
|
2558
2552
|
class qi extends $e {
|
|
2559
2553
|
constructor() {
|
|
2560
2554
|
super(...arguments);
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2555
|
+
g(this, "_formulaService", this.injector.get(ue));
|
|
2556
|
+
g(this, "id", X.WHOLE);
|
|
2557
|
+
g(this, "title", "dataValidation.whole.title");
|
|
2558
|
+
g(this, "operators", [
|
|
2565
2559
|
C.BETWEEN,
|
|
2566
2560
|
C.EQUAL,
|
|
2567
2561
|
C.GREATER_THAN,
|
|
@@ -2571,33 +2565,33 @@ class qi extends $e {
|
|
|
2571
2565
|
C.NOT_BETWEEN,
|
|
2572
2566
|
C.NOT_EQUAL
|
|
2573
2567
|
]);
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2568
|
+
g(this, "scopes", ["sheet"]);
|
|
2569
|
+
g(this, "formulaInput", ht);
|
|
2570
|
+
g(this, "dropDownInput");
|
|
2577
2571
|
}
|
|
2578
2572
|
_isFormulaOrInt(e) {
|
|
2579
|
-
return !
|
|
2573
|
+
return !B.isBlank(e) && (N(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2580
2574
|
}
|
|
2581
2575
|
async isValidType(e, t, o) {
|
|
2582
|
-
const { value: n } = e, i =
|
|
2576
|
+
const { value: n } = e, i = Ft(n);
|
|
2583
2577
|
return !Number.isNaN(i) && Number.isInteger(i);
|
|
2584
2578
|
}
|
|
2585
2579
|
transform(e, t, o) {
|
|
2586
2580
|
const { value: n } = e;
|
|
2587
2581
|
return {
|
|
2588
2582
|
...e,
|
|
2589
|
-
value:
|
|
2583
|
+
value: Ft(n)
|
|
2590
2584
|
};
|
|
2591
2585
|
}
|
|
2592
2586
|
_parseNumber(e) {
|
|
2593
2587
|
return e == null ? Number.NaN : +e;
|
|
2594
2588
|
}
|
|
2595
2589
|
async parseFormula(e, t, o) {
|
|
2596
|
-
var d, c, u,
|
|
2590
|
+
var d, c, u, h, f, m, v, R;
|
|
2597
2591
|
const n = await this._formulaService.getRuleFormulaResult(t, o, e.uid), { formula1: i, formula2: s } = e;
|
|
2598
2592
|
return {
|
|
2599
|
-
formula1: this._parseNumber(
|
|
2600
|
-
formula2: this._parseNumber(
|
|
2593
|
+
formula1: this._parseNumber(N(i) ? (h = (u = (c = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : c[0]) == null ? void 0 : u[0]) == null ? void 0 : h.v : i),
|
|
2594
|
+
formula2: this._parseNumber(N(s) ? (R = (v = (m = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : m[0]) == null ? void 0 : v[0]) == null ? void 0 : R.v : s)
|
|
2601
2595
|
};
|
|
2602
2596
|
}
|
|
2603
2597
|
validatorFormula(e, t, o) {
|
|
@@ -2606,7 +2600,7 @@ class qi extends $e {
|
|
|
2606
2600
|
return {
|
|
2607
2601
|
success: !1
|
|
2608
2602
|
};
|
|
2609
|
-
const i =
|
|
2603
|
+
const i = B.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), s = B.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = lt.includes(n), d = this.localeService.t("dataValidation.validFail.number");
|
|
2610
2604
|
return l ? {
|
|
2611
2605
|
success: i && s,
|
|
2612
2606
|
formula1: i ? void 0 : d,
|
|
@@ -2655,9 +2649,9 @@ class qi extends $e {
|
|
|
2655
2649
|
return Number.isNaN(n) ? !0 : e.value <= n;
|
|
2656
2650
|
}
|
|
2657
2651
|
}
|
|
2658
|
-
const Lr = 4, zi = 0, Yt = 4, Pr = 4, ca = 6, Nt = 6,
|
|
2652
|
+
const Lr = 4, zi = 0, Yt = 4, Pr = 4, ca = 6, Nt = 6, Fe = 14;
|
|
2659
2653
|
function Qi(r, a) {
|
|
2660
|
-
const e =
|
|
2654
|
+
const e = Xo.getTextSize(r, a), t = e.width + Lr * 2, { ba: o, bd: n } = e, i = o + n;
|
|
2661
2655
|
return {
|
|
2662
2656
|
width: t,
|
|
2663
2657
|
height: i + zi * 2,
|
|
@@ -2665,16 +2659,16 @@ function Qi(r, a) {
|
|
|
2665
2659
|
};
|
|
2666
2660
|
}
|
|
2667
2661
|
function qa(r, a, e, t) {
|
|
2668
|
-
const o = e -
|
|
2662
|
+
const o = e - Fe - ca, n = t - Nt * 2, i = r.map((c) => ({
|
|
2669
2663
|
layout: Qi(c, a),
|
|
2670
2664
|
text: c
|
|
2671
2665
|
}));
|
|
2672
2666
|
let s;
|
|
2673
2667
|
const l = [];
|
|
2674
2668
|
i.forEach((c) => {
|
|
2675
|
-
const { layout: u } = c, { width:
|
|
2676
|
-
!s || s.width +
|
|
2677
|
-
width:
|
|
2669
|
+
const { layout: u } = c, { width: h, height: f } = u;
|
|
2670
|
+
!s || s.width + h + Yt > o ? (s = {
|
|
2671
|
+
width: h,
|
|
2678
2672
|
height: f,
|
|
2679
2673
|
items: [{
|
|
2680
2674
|
...c,
|
|
@@ -2683,7 +2677,7 @@ function qa(r, a, e, t) {
|
|
|
2683
2677
|
}, l.push(s)) : (s.items.push({
|
|
2684
2678
|
...c,
|
|
2685
2679
|
left: s.width + Yt
|
|
2686
|
-
}), s.width = s.width +
|
|
2680
|
+
}), s.width = s.width + h + Yt);
|
|
2687
2681
|
});
|
|
2688
2682
|
let d = 0;
|
|
2689
2683
|
return l.forEach((c, u) => {
|
|
@@ -2697,14 +2691,14 @@ function qa(r, a, e, t) {
|
|
|
2697
2691
|
};
|
|
2698
2692
|
}
|
|
2699
2693
|
const Ki = 8;
|
|
2700
|
-
class Zi extends
|
|
2694
|
+
class Zi extends Go {
|
|
2701
2695
|
static drawWith(a, e) {
|
|
2702
2696
|
const { fontFamily: t, fontString: o, fontSize: n, info: i, fill: s, color: l } = e, { layout: d, text: c } = i;
|
|
2703
2697
|
a.save(), dr.drawWith(a, {
|
|
2704
2698
|
width: d.width,
|
|
2705
2699
|
height: d.height,
|
|
2706
2700
|
radius: Ki,
|
|
2707
|
-
fill: s ||
|
|
2701
|
+
fill: s || Ne
|
|
2708
2702
|
}), a.translateWithPrecision(Lr, d.ba), a.font = o, a.fillStyle = l, a.fillText(c, 0, 0), a.restore();
|
|
2709
2703
|
}
|
|
2710
2704
|
}
|
|
@@ -2716,8 +2710,8 @@ var Ji = Object.defineProperty, es = Object.getOwnPropertyDescriptor, ts = (r, a
|
|
|
2716
2710
|
const rs = 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");
|
|
2717
2711
|
let ua = class {
|
|
2718
2712
|
constructor(r) {
|
|
2719
|
-
|
|
2720
|
-
|
|
2713
|
+
g(this, "zIndex");
|
|
2714
|
+
g(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
|
2721
2715
|
this._commandService = r;
|
|
2722
2716
|
}
|
|
2723
2717
|
_ensureMap(r) {
|
|
@@ -2728,33 +2722,33 @@ let ua = class {
|
|
|
2728
2722
|
return `${r}.${a}`;
|
|
2729
2723
|
}
|
|
2730
2724
|
_drawDownIcon(r, a, e, t, o) {
|
|
2731
|
-
const n = e -
|
|
2725
|
+
const n = e - Fe + 4;
|
|
2732
2726
|
let i = 4;
|
|
2733
2727
|
switch (o) {
|
|
2734
2728
|
case de.MIDDLE:
|
|
2735
|
-
i = (t -
|
|
2729
|
+
i = (t - Fe) / 2 + 4;
|
|
2736
2730
|
break;
|
|
2737
2731
|
case de.BOTTOM:
|
|
2738
|
-
i = t -
|
|
2732
|
+
i = t - Fe + 4;
|
|
2739
2733
|
break;
|
|
2740
2734
|
}
|
|
2741
2735
|
r.save(), r.translateWithPrecision(a.startX + n, a.startY + i), r.fillStyle = "#565656", r.fill(rs), r.restore();
|
|
2742
2736
|
}
|
|
2743
2737
|
// eslint-disable-next-line max-lines-per-function
|
|
2744
2738
|
drawWith(r, a, e, t) {
|
|
2745
|
-
var
|
|
2746
|
-
const { primaryWithCoord: o, row: n, col: i, style: s, data: l, subUnitId: d } = a, c = o.isMergedMainCell ? o.mergeInfo : o, u = l.fontRenderExtension, { leftOffset:
|
|
2739
|
+
var O, J;
|
|
2740
|
+
const { primaryWithCoord: o, row: n, col: i, style: s, data: l, subUnitId: d } = a, c = o.isMergedMainCell ? o.mergeInfo : o, u = l.fontRenderExtension, { leftOffset: h = 0, rightOffset: f = 0, topOffset: m = 0, downOffset: v = 0 } = u || {}, R = l.dataValidation, _ = this._ensureMap(d), V = this._generateKey(n, i);
|
|
2747
2741
|
if (!R)
|
|
2748
2742
|
return;
|
|
2749
2743
|
const S = {
|
|
2750
|
-
startX: c.startX +
|
|
2744
|
+
startX: c.startX + h,
|
|
2751
2745
|
endX: c.endX - f,
|
|
2752
|
-
startY: c.startY +
|
|
2753
|
-
endY: c.endY -
|
|
2754
|
-
},
|
|
2755
|
-
this._drawDownIcon(r, S,
|
|
2746
|
+
startY: c.startY + m,
|
|
2747
|
+
endY: c.endY - v
|
|
2748
|
+
}, y = S.endX - S.startX, w = S.endY - S.startY, { cl: F } = s || {}, x = (O = typeof F == "object" ? F == null ? void 0 : F.rgb : F) != null ? O : "#000", j = xa(s != null ? s : void 0), { rule: $, validator: E } = R, P = E, { vt: A, ht: q } = s || {}, L = A != null ? A : de.MIDDLE, b = (J = ne(l)) != null ? J : "", Y = P.parseCellValue(b), Z = P.getListWithColorMap($), H = qa(Y, j, y, w);
|
|
2749
|
+
this._drawDownIcon(r, S, y, w, L), r.save(), r.translateWithPrecision(S.startX, S.startY), r.beginPath(), r.rect(0, 0, y - Fe, w), r.clip(), r.translateWithPrecision(ca, Nt);
|
|
2756
2750
|
let M = 0;
|
|
2757
|
-
switch (
|
|
2751
|
+
switch (L) {
|
|
2758
2752
|
case de.MIDDLE:
|
|
2759
2753
|
M = (H.contentHeight - H.totalHeight) / 2;
|
|
2760
2754
|
break;
|
|
@@ -2762,35 +2756,35 @@ let ua = class {
|
|
|
2762
2756
|
M = H.contentHeight - H.totalHeight;
|
|
2763
2757
|
break;
|
|
2764
2758
|
}
|
|
2765
|
-
r.translateWithPrecision(0, M), H.lines.forEach((
|
|
2759
|
+
r.translateWithPrecision(0, M), H.lines.forEach((G, me) => {
|
|
2766
2760
|
r.save();
|
|
2767
|
-
const { width: D, height: W, items: k } =
|
|
2768
|
-
let
|
|
2769
|
-
switch (
|
|
2761
|
+
const { width: D, height: W, items: k } = G;
|
|
2762
|
+
let ee = 0;
|
|
2763
|
+
switch (q) {
|
|
2770
2764
|
case Ae.RIGHT:
|
|
2771
|
-
|
|
2765
|
+
ee = H.contentWidth - D;
|
|
2772
2766
|
break;
|
|
2773
2767
|
case Ae.CENTER:
|
|
2774
|
-
|
|
2768
|
+
ee = (H.contentWidth - D) / 2;
|
|
2775
2769
|
break;
|
|
2776
2770
|
}
|
|
2777
|
-
r.translate(
|
|
2771
|
+
r.translate(ee, me * (W + Pr)), k.forEach((_e) => {
|
|
2778
2772
|
r.save(), r.translateWithPrecision(_e.left, 0), Zi.drawWith(r, {
|
|
2779
|
-
...
|
|
2773
|
+
...j,
|
|
2780
2774
|
info: _e,
|
|
2781
|
-
color:
|
|
2782
|
-
fill:
|
|
2775
|
+
color: x,
|
|
2776
|
+
fill: Z[_e.text]
|
|
2783
2777
|
}), r.restore();
|
|
2784
2778
|
}), r.restore();
|
|
2785
2779
|
}), r.restore(), _.set(V, {
|
|
2786
2780
|
left: S.startX,
|
|
2787
2781
|
top: S.startY,
|
|
2788
|
-
width: H.contentWidth + ca +
|
|
2782
|
+
width: H.contentWidth + ca + Fe,
|
|
2789
2783
|
height: H.contentHeight + Nt * 2
|
|
2790
2784
|
});
|
|
2791
2785
|
}
|
|
2792
2786
|
calcCellAutoHeight(r) {
|
|
2793
|
-
var
|
|
2787
|
+
var y;
|
|
2794
2788
|
const { primaryWithCoord: a, style: e, data: t } = r, o = t.fontRenderExtension, { leftOffset: n = 0, rightOffset: i = 0, topOffset: s = 0, downOffset: l = 0 } = o || {}, d = a.isMergedMainCell ? a.mergeInfo : a, c = {
|
|
2795
2789
|
startX: d.startX + n,
|
|
2796
2790
|
endX: d.endX - i,
|
|
@@ -2799,12 +2793,12 @@ let ua = class {
|
|
|
2799
2793
|
}, u = t.dataValidation;
|
|
2800
2794
|
if (!u)
|
|
2801
2795
|
return;
|
|
2802
|
-
const
|
|
2803
|
-
return qa(_, V,
|
|
2796
|
+
const h = c.endX - c.startX, f = c.endY - c.startY, m = (y = ne(t)) != null ? y : "", { validator: v } = u, _ = v.parseCellValue(m), V = xa(e != null ? e : void 0);
|
|
2797
|
+
return qa(_, V, h, f).cellAutoHeight;
|
|
2804
2798
|
}
|
|
2805
2799
|
isHit(r, a) {
|
|
2806
2800
|
const { primaryWithCoord: e } = a, t = e.isMergedMainCell ? e.mergeInfo : e, { endX: o } = t, { x: n } = r;
|
|
2807
|
-
return n >= o -
|
|
2801
|
+
return n >= o - Fe && n <= o;
|
|
2808
2802
|
}
|
|
2809
2803
|
onPointerDown(r, a) {
|
|
2810
2804
|
if (a.button === 2)
|
|
@@ -2821,12 +2815,12 @@ let ua = class {
|
|
|
2821
2815
|
ua = ts([
|
|
2822
2816
|
as(0, re)
|
|
2823
2817
|
], ua);
|
|
2824
|
-
class os extends
|
|
2818
|
+
class os extends Nr {
|
|
2825
2819
|
constructor() {
|
|
2826
2820
|
super(...arguments);
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2821
|
+
g(this, "id", X.LIST_MULTIPLE);
|
|
2822
|
+
g(this, "title", "dataValidation.listMultiple.title");
|
|
2823
|
+
g(this, "canvasRender", this.injector.createInstance(ua));
|
|
2830
2824
|
}
|
|
2831
2825
|
skipDefaultFontRender() {
|
|
2832
2826
|
return !0;
|
|
@@ -2847,7 +2841,7 @@ function ns(r) {
|
|
|
2847
2841
|
}
|
|
2848
2842
|
function is(r) {
|
|
2849
2843
|
return {
|
|
2850
|
-
id:
|
|
2844
|
+
id: ut.id,
|
|
2851
2845
|
title: "dataValidation.panel.title",
|
|
2852
2846
|
type: ga.BUTTON,
|
|
2853
2847
|
positions: [Da]
|
|
@@ -2866,7 +2860,7 @@ var ls = Object.defineProperty, ds = Object.getOwnPropertyDescriptor, cs = (r, a
|
|
|
2866
2860
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
2867
2861
|
return t && o && ls(a, e, o), o;
|
|
2868
2862
|
}, Me = (r, a) => (e, t) => a(e, t, r);
|
|
2869
|
-
let
|
|
2863
|
+
let ot = class extends er {
|
|
2870
2864
|
constructor(r, a, e, t, o, n, i, s) {
|
|
2871
2865
|
super(), this._univerInstanceService = r, this._sheetDataValidationService = a, this._dataValidatorRegistryService = e, this._injector = t, this._componentManger = o, this._selectionManagerService = n, this._sheetInterceptorService = i, this._dataValidationModel = s, this._init();
|
|
2872
2866
|
}
|
|
@@ -2877,10 +2871,10 @@ let rt = class extends er {
|
|
|
2877
2871
|
[
|
|
2878
2872
|
ki,
|
|
2879
2873
|
qi,
|
|
2880
|
-
|
|
2881
|
-
|
|
2874
|
+
Gi,
|
|
2875
|
+
Ni,
|
|
2882
2876
|
Di,
|
|
2883
|
-
|
|
2877
|
+
Nr,
|
|
2884
2878
|
os,
|
|
2885
2879
|
Ri
|
|
2886
2880
|
].forEach((r) => {
|
|
@@ -2897,11 +2891,14 @@ let rt = class extends er {
|
|
|
2897
2891
|
_initInstanceChange() {
|
|
2898
2892
|
const r = new Qa();
|
|
2899
2893
|
this._univerInstanceService.getCurrentTypeOfUnit$(ae.UNIVER_SHEET).subscribe((a) => {
|
|
2900
|
-
r.dispose(), a
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2894
|
+
if (r.dispose(), !a)
|
|
2895
|
+
return;
|
|
2896
|
+
const e = a.getActiveSheet();
|
|
2897
|
+
e && (this._sheetDataValidationService.switchCurrent(a.getUnitId(), e.getSheetId()), r.add(ma(
|
|
2898
|
+
a.activeSheet$.subscribe((t) => {
|
|
2899
|
+
if (t) {
|
|
2900
|
+
const o = a.getUnitId(), n = t.getSheetId();
|
|
2901
|
+
this._sheetDataValidationService.switchCurrent(o, n);
|
|
2905
2902
|
}
|
|
2906
2903
|
})
|
|
2907
2904
|
)));
|
|
@@ -2911,7 +2908,10 @@ let rt = class extends er {
|
|
|
2911
2908
|
this._sheetInterceptorService.interceptCommand({
|
|
2912
2909
|
getMutations: (r) => {
|
|
2913
2910
|
if (r.id === po.id) {
|
|
2914
|
-
const a = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET), e = a.getUnitId(),
|
|
2911
|
+
const a = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET), e = a.getUnitId(), t = a.getActiveSheet();
|
|
2912
|
+
if (!t)
|
|
2913
|
+
throw new Error("No active sheet found");
|
|
2914
|
+
const o = t.getSheetId(), n = this._selectionManagerService.getSelectionRanges(), i = this._dataValidationModel.ensureManager(e, o), s = i.getRuleObjectMatrix().clone();
|
|
2915
2915
|
n && s.removeRange(n);
|
|
2916
2916
|
const l = s.diff(i.getDataValidations()), { redoMutations: d, undoMutations: c } = Qe(e, o, l);
|
|
2917
2917
|
return {
|
|
@@ -2927,23 +2927,23 @@ let rt = class extends er {
|
|
|
2927
2927
|
});
|
|
2928
2928
|
}
|
|
2929
2929
|
};
|
|
2930
|
-
|
|
2931
|
-
ve(ge.Rendered,
|
|
2932
|
-
Me(0,
|
|
2933
|
-
Me(1,
|
|
2934
|
-
Me(2,
|
|
2935
|
-
Me(3,
|
|
2936
|
-
Me(4,
|
|
2937
|
-
Me(5,
|
|
2938
|
-
Me(6,
|
|
2939
|
-
Me(7,
|
|
2940
|
-
],
|
|
2941
|
-
const us = "univer-data-validation-list-buttons", hs = "univer-data-validation-list-button",
|
|
2930
|
+
ot = cs([
|
|
2931
|
+
ve(ge.Rendered, ot),
|
|
2932
|
+
Me(0, te),
|
|
2933
|
+
Me(1, I(Ot)),
|
|
2934
|
+
Me(2, I(De)),
|
|
2935
|
+
Me(3, I(Ue)),
|
|
2936
|
+
Me(4, I(ct)),
|
|
2937
|
+
Me(5, I(fo)),
|
|
2938
|
+
Me(6, I(or)),
|
|
2939
|
+
Me(7, I(K))
|
|
2940
|
+
], ot);
|
|
2941
|
+
const us = "univer-data-validation-list-buttons", hs = "univer-data-validation-list-button", Xt = {
|
|
2942
2942
|
dataValidationListButtons: us,
|
|
2943
2943
|
dataValidationListButton: hs
|
|
2944
2944
|
};
|
|
2945
2945
|
function ms() {
|
|
2946
|
-
const r =
|
|
2946
|
+
const r = T(te), a = Ze(
|
|
2947
2947
|
() => r.getCurrentTypeOfUnit$(ae.UNIVER_SHEET),
|
|
2948
2948
|
void 0,
|
|
2949
2949
|
void 0,
|
|
@@ -2952,80 +2952,80 @@ function ms() {
|
|
|
2952
2952
|
return a ? /* @__PURE__ */ p.jsx(fs, { workbook: a }) : null;
|
|
2953
2953
|
}
|
|
2954
2954
|
function fs(r) {
|
|
2955
|
-
const a =
|
|
2956
|
-
|
|
2957
|
-
const i =
|
|
2955
|
+
const a = T(K), e = T(te), t = T(re), o = T(Ue), n = T(Ve);
|
|
2956
|
+
T(ot);
|
|
2957
|
+
const i = T(ie), [s, l] = z([]), { workbook: d } = r, c = Ze(d.activeSheet$, void 0, !0), u = d.getUnitId(), h = c == null ? void 0 : c.getSheetId(), f = a.ensureManager(u, h);
|
|
2958
2958
|
qe(() => {
|
|
2959
2959
|
l(f.getDataValidations());
|
|
2960
|
-
const S = f.dataValidations$.subscribe((
|
|
2961
|
-
l([...
|
|
2960
|
+
const S = f.dataValidations$.subscribe((y) => {
|
|
2961
|
+
l([...y]);
|
|
2962
2962
|
});
|
|
2963
2963
|
return () => {
|
|
2964
2964
|
S.unsubscribe();
|
|
2965
2965
|
};
|
|
2966
2966
|
}, [f]);
|
|
2967
|
-
const
|
|
2968
|
-
const S = tr(o),
|
|
2967
|
+
const m = async () => {
|
|
2968
|
+
const S = tr(o), y = {
|
|
2969
2969
|
unitId: u,
|
|
2970
|
-
subUnitId:
|
|
2970
|
+
subUnitId: h,
|
|
2971
2971
|
rule: S
|
|
2972
2972
|
};
|
|
2973
|
-
await t.executeCommand(wa.id,
|
|
2973
|
+
await t.executeCommand(wa.id, y), n.setActiveRule({
|
|
2974
2974
|
unitId: u,
|
|
2975
|
-
subUnitId:
|
|
2975
|
+
subUnitId: h,
|
|
2976
2976
|
rule: S
|
|
2977
2977
|
});
|
|
2978
|
-
},
|
|
2978
|
+
}, v = () => {
|
|
2979
2979
|
t.executeCommand(so.id, {
|
|
2980
2980
|
unitId: u,
|
|
2981
|
-
subUnitId:
|
|
2981
|
+
subUnitId: h
|
|
2982
2982
|
});
|
|
2983
2983
|
}, _ = ((S) => {
|
|
2984
|
-
const
|
|
2985
|
-
return S.map((
|
|
2986
|
-
const { ranges:
|
|
2987
|
-
return (
|
|
2988
|
-
var
|
|
2989
|
-
const { startRow:
|
|
2990
|
-
for (let
|
|
2991
|
-
for (let H =
|
|
2992
|
-
const M = (
|
|
2993
|
-
if ((M == null ? void 0 : M[
|
|
2984
|
+
const w = e.getCurrentUnitForType(ae.UNIVER_SHEET).getActiveSheet();
|
|
2985
|
+
return S.map((x) => {
|
|
2986
|
+
const { ranges: j } = x;
|
|
2987
|
+
return (j == null ? void 0 : j.some((E) => {
|
|
2988
|
+
var b, Y;
|
|
2989
|
+
const { startRow: P, startColumn: A, endRow: q, endColumn: L } = E;
|
|
2990
|
+
for (let Z = P; Z <= q; Z++)
|
|
2991
|
+
for (let H = A; H <= L; H++) {
|
|
2992
|
+
const M = (Y = (b = w == null ? void 0 : w.getCell(Z, H)) == null ? void 0 : b.selectionProtection) == null ? void 0 : Y[0];
|
|
2993
|
+
if ((M == null ? void 0 : M[Et.Edit]) === !1 || (M == null ? void 0 : M[Et.View]) === !1)
|
|
2994
2994
|
return !0;
|
|
2995
2995
|
}
|
|
2996
2996
|
return !1;
|
|
2997
|
-
})) ? { ...
|
|
2997
|
+
})) ? { ...x, disable: !0 } : { ...x };
|
|
2998
2998
|
});
|
|
2999
2999
|
})(s), V = _ == null ? void 0 : _.some((S) => S.disable);
|
|
3000
3000
|
return /* @__PURE__ */ p.jsxs("div", { children: [
|
|
3001
3001
|
_ == null ? void 0 : _.map((S) => {
|
|
3002
|
-
var
|
|
3002
|
+
var y;
|
|
3003
3003
|
return /* @__PURE__ */ p.jsx(
|
|
3004
|
-
|
|
3004
|
+
Xn,
|
|
3005
3005
|
{
|
|
3006
3006
|
unitId: u,
|
|
3007
|
-
subUnitId:
|
|
3007
|
+
subUnitId: h,
|
|
3008
3008
|
onClick: () => {
|
|
3009
3009
|
S.disable || n.setActiveRule({
|
|
3010
3010
|
unitId: u,
|
|
3011
|
-
subUnitId:
|
|
3011
|
+
subUnitId: h,
|
|
3012
3012
|
rule: S
|
|
3013
3013
|
});
|
|
3014
3014
|
},
|
|
3015
3015
|
rule: S,
|
|
3016
|
-
disable: (
|
|
3016
|
+
disable: (y = S.disable) != null ? y : !1
|
|
3017
3017
|
},
|
|
3018
3018
|
S.uid
|
|
3019
3019
|
);
|
|
3020
3020
|
}),
|
|
3021
|
-
/* @__PURE__ */ p.jsxs("div", { className:
|
|
3022
|
-
s.length && !V ? /* @__PURE__ */ p.jsx(ze, { className:
|
|
3023
|
-
/* @__PURE__ */ p.jsx(ze, { className:
|
|
3021
|
+
/* @__PURE__ */ p.jsxs("div", { className: Xt.dataValidationListButtons, children: [
|
|
3022
|
+
s.length && !V ? /* @__PURE__ */ p.jsx(ze, { className: Xt.dataValidationListButton, onClick: v, children: i.t("dataValidation.panel.removeAll") }) : null,
|
|
3023
|
+
/* @__PURE__ */ p.jsx(ze, { className: Xt.dataValidationListButton, type: "primary", onClick: m, children: i.t("dataValidation.panel.add") })
|
|
3024
3024
|
] })
|
|
3025
3025
|
] });
|
|
3026
3026
|
}
|
|
3027
3027
|
const ps = () => {
|
|
3028
|
-
const r =
|
|
3028
|
+
const r = T(Ve), a = Ze(r.activeRule$, r.activeRule);
|
|
3029
3029
|
return a ? /* @__PURE__ */ p.jsx($n, {}, a.rule.uid) : /* @__PURE__ */ p.jsx(ms, {});
|
|
3030
3030
|
}, vs = "univer-dv-list-dropdown", gs = "univer-dv-list-dropdown-title", _s = "univer-dv-list-dropdown-list", Ss = "univer-dv-list-dropdown-list-container", Rs = "univer-dv-list-dropdown-selected-icon", Cs = "univer-dv-list-dropdown-item-container", Vs = "univer-dv-list-dropdown-item", Ms = "univer-dv-list-dropdown-split", ws = "univer-dv-list-dropdown-edit", Se = {
|
|
3031
3031
|
dvListDropdown: vs,
|
|
@@ -3043,15 +3043,15 @@ const ps = () => {
|
|
|
3043
3043
|
/* @__PURE__ */ p.jsx("div", { className: Se.dvListDropdownTitle, children: n }),
|
|
3044
3044
|
/* @__PURE__ */ p.jsx("div", { className: Se.dvListDropdownList, children: /* @__PURE__ */ p.jsx(Ko, { children: /* @__PURE__ */ p.jsx("div", { className: Se.dvListDropdownListContainer, children: o.map((l, d) => {
|
|
3045
3045
|
const c = a.indexOf(l.value) > -1, u = () => {
|
|
3046
|
-
let
|
|
3047
|
-
c ?
|
|
3046
|
+
let h;
|
|
3047
|
+
c ? h = new Set(a.filter((m) => m !== l.value)) : h = new Set(t ? [...a, l.value] : [l.value]);
|
|
3048
3048
|
const f = [];
|
|
3049
|
-
o.forEach((
|
|
3050
|
-
|
|
3049
|
+
o.forEach((m) => {
|
|
3050
|
+
h.has(m.value) && f.push(m.value);
|
|
3051
3051
|
}), e(f);
|
|
3052
3052
|
};
|
|
3053
3053
|
return /* @__PURE__ */ p.jsxs("div", { className: Se.dvListDropdownItemContainer, onClick: u, children: [
|
|
3054
|
-
/* @__PURE__ */ p.jsx("div", { className: Se.dvListDropdownItem, style: { background: l.color ||
|
|
3054
|
+
/* @__PURE__ */ p.jsx("div", { className: Se.dvListDropdownItem, style: { background: l.color || Ne }, children: l.label }),
|
|
3055
3055
|
/* @__PURE__ */ p.jsx("div", { className: Se.dvListDropdownSelectedIcon, children: c ? /* @__PURE__ */ p.jsx(Vr, {}) : null })
|
|
3056
3056
|
] }, d);
|
|
3057
3057
|
}) }) }) }),
|
|
@@ -3060,27 +3060,27 @@ const ps = () => {
|
|
|
3060
3060
|
] });
|
|
3061
3061
|
};
|
|
3062
3062
|
function ys(r) {
|
|
3063
|
-
var
|
|
3064
|
-
const { location: a, hideFn: e } = r, { worksheet: t, row: o, col: n, unitId: i, subUnitId: s } = a, l =
|
|
3063
|
+
var j, $;
|
|
3064
|
+
const { location: a, hideFn: e } = r, { worksheet: t, row: o, col: n, unitId: i, subUnitId: s } = a, l = T(re), d = T(ie), [c, u] = z(""), h = T(va), f = Qo.useContext(), m = f.right - f.left;
|
|
3065
3065
|
if (!t)
|
|
3066
3066
|
return null;
|
|
3067
|
-
const
|
|
3068
|
-
if (!
|
|
3067
|
+
const v = t.getCell(o, n), R = (j = v == null ? void 0 : v.dataValidation) == null ? void 0 : j.rule, _ = ($ = v == null ? void 0 : v.dataValidation) == null ? void 0 : $.validator, V = (R == null ? void 0 : R.renderMode) === ce.CUSTOM || (R == null ? void 0 : R.renderMode) === void 0;
|
|
3068
|
+
if (!v || !R || !_)
|
|
3069
3069
|
return;
|
|
3070
|
-
const S = R.type ===
|
|
3071
|
-
l.executeCommand(
|
|
3070
|
+
const S = R.type === X.LIST_MULTIPLE, y = _.getListWithColor(R, i, s), w = c || li(v), F = Ge(w), x = () => {
|
|
3071
|
+
l.executeCommand(ut.id, {
|
|
3072
3072
|
ruleId: R.uid
|
|
3073
3073
|
}), e();
|
|
3074
3074
|
};
|
|
3075
3075
|
return /* @__PURE__ */ p.jsx(
|
|
3076
3076
|
Is,
|
|
3077
3077
|
{
|
|
3078
|
-
style: { minWidth:
|
|
3078
|
+
style: { minWidth: m, maxWidth: Math.max(m, 200) },
|
|
3079
3079
|
title: S ? d.t("dataValidation.listMultiple.dropdown") : d.t("dataValidation.list.dropdown"),
|
|
3080
|
-
value:
|
|
3080
|
+
value: F,
|
|
3081
3081
|
multiple: S,
|
|
3082
|
-
onChange: (
|
|
3083
|
-
const
|
|
3082
|
+
onChange: (E) => {
|
|
3083
|
+
const P = Er(E), A = {
|
|
3084
3084
|
unitId: i,
|
|
3085
3085
|
subUnitId: s,
|
|
3086
3086
|
range: {
|
|
@@ -3090,24 +3090,24 @@ function ys(r) {
|
|
|
3090
3090
|
endRow: o
|
|
3091
3091
|
},
|
|
3092
3092
|
value: {
|
|
3093
|
-
v:
|
|
3093
|
+
v: P,
|
|
3094
3094
|
p: null,
|
|
3095
3095
|
f: null,
|
|
3096
3096
|
si: null
|
|
3097
3097
|
}
|
|
3098
3098
|
};
|
|
3099
|
-
|
|
3099
|
+
h.isVisible() && h.changeVisible({
|
|
3100
3100
|
visible: !1,
|
|
3101
3101
|
keycode: jo.ESC,
|
|
3102
3102
|
eventType: qo.Keyboard
|
|
3103
|
-
}), l.executeCommand(pa.id,
|
|
3103
|
+
}), l.executeCommand(pa.id, A), u(P), S || e();
|
|
3104
3104
|
},
|
|
3105
|
-
options:
|
|
3106
|
-
label:
|
|
3107
|
-
value:
|
|
3108
|
-
color: V ?
|
|
3105
|
+
options: y.map((E) => ({
|
|
3106
|
+
label: E.label,
|
|
3107
|
+
value: E.label,
|
|
3108
|
+
color: V ? E.color : "transparent"
|
|
3109
3109
|
})),
|
|
3110
|
-
onEdit:
|
|
3110
|
+
onEdit: x
|
|
3111
3111
|
}
|
|
3112
3112
|
);
|
|
3113
3113
|
}
|
|
@@ -3115,8 +3115,8 @@ var Ds = Object.defineProperty, Es = Object.getOwnPropertyDescriptor, Os = (r, a
|
|
|
3115
3115
|
for (var o = t > 1 ? void 0 : t ? Es(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
3116
3116
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
3117
3117
|
return t && o && Ds(a, e, o), o;
|
|
3118
|
-
},
|
|
3119
|
-
let
|
|
3118
|
+
}, tt = (r, a) => (e, t) => a(e, t, r);
|
|
3119
|
+
let nt = class extends he {
|
|
3120
3120
|
constructor(r, a, e, t, o) {
|
|
3121
3121
|
super(), this._editorBridgeService = r, this._dataValidationModel = a, this._dataValidatorRegistryService = e, this._dialogService = t, this._localeService = o, this._initEditorBridgeInterceptor();
|
|
3122
3122
|
}
|
|
@@ -3126,10 +3126,10 @@ let ot = class extends he {
|
|
|
3126
3126
|
{
|
|
3127
3127
|
handler: async (r, a, e) => {
|
|
3128
3128
|
const t = await r, { worksheet: o, row: n, col: i, unitId: s, subUnitId: l } = a, d = this._dataValidationModel.ensureManager(s, l), c = d.getRuleIdByLocation(n, i), u = c ? d.getRuleById(c) : void 0;
|
|
3129
|
-
if (!u || u.errorStyle !==
|
|
3129
|
+
if (!u || u.errorStyle !== at.STOP)
|
|
3130
3130
|
return e(Promise.resolve(t));
|
|
3131
|
-
const
|
|
3132
|
-
if (!
|
|
3131
|
+
const h = await this._dataValidatorRegistryService.getValidatorItem(u.type);
|
|
3132
|
+
if (!h || await h.validator(
|
|
3133
3133
|
{
|
|
3134
3134
|
value: ne(t),
|
|
3135
3135
|
row: n,
|
|
@@ -3140,7 +3140,7 @@ let ot = class extends he {
|
|
|
3140
3140
|
u
|
|
3141
3141
|
))
|
|
3142
3142
|
return e(Promise.resolve(t));
|
|
3143
|
-
const
|
|
3143
|
+
const m = o.getCellRaw(n, i);
|
|
3144
3144
|
return this._dialogService.open({
|
|
3145
3145
|
width: 368,
|
|
3146
3146
|
title: {
|
|
@@ -3148,7 +3148,7 @@ let ot = class extends he {
|
|
|
3148
3148
|
},
|
|
3149
3149
|
id: "reject-input-dialog",
|
|
3150
3150
|
children: {
|
|
3151
|
-
title:
|
|
3151
|
+
title: h.getRuleFinalError(u)
|
|
3152
3152
|
},
|
|
3153
3153
|
footer: {
|
|
3154
3154
|
title: na.createElement(
|
|
@@ -3163,7 +3163,7 @@ let ot = class extends he {
|
|
|
3163
3163
|
onClose: () => {
|
|
3164
3164
|
this._dialogService.close("reject-input-dialog");
|
|
3165
3165
|
}
|
|
3166
|
-
}), e(Promise.resolve(
|
|
3166
|
+
}), e(Promise.resolve(m));
|
|
3167
3167
|
}
|
|
3168
3168
|
}
|
|
3169
3169
|
);
|
|
@@ -3194,34 +3194,34 @@ let ot = class extends he {
|
|
|
3194
3194
|
});
|
|
3195
3195
|
}
|
|
3196
3196
|
};
|
|
3197
|
-
|
|
3198
|
-
ve(ge.Ready,
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
],
|
|
3197
|
+
nt = Os([
|
|
3198
|
+
ve(ge.Ready, nt),
|
|
3199
|
+
tt(0, va),
|
|
3200
|
+
tt(1, I(K)),
|
|
3201
|
+
tt(2, I(De)),
|
|
3202
|
+
tt(3, Bo),
|
|
3203
|
+
tt(4, I(ie))
|
|
3204
|
+
], nt);
|
|
3205
3205
|
const bs = "univer-dv-date-dropdown", Ts = {
|
|
3206
3206
|
dvDateDropdown: bs
|
|
3207
3207
|
};
|
|
3208
|
-
function
|
|
3209
|
-
var V, S,
|
|
3210
|
-
const { location: a, hideFn: e } = r, { worksheet: t, row: o, col: n, unitId: i, subUnitId: s } = a, l =
|
|
3208
|
+
function Fs(r) {
|
|
3209
|
+
var V, S, y;
|
|
3210
|
+
const { location: a, hideFn: e } = r, { worksheet: t, row: o, col: n, unitId: i, subUnitId: s } = a, l = T(re), d = T(nt), [c, u] = z();
|
|
3211
3211
|
if (!t)
|
|
3212
3212
|
return null;
|
|
3213
|
-
const
|
|
3214
|
-
if (!
|
|
3213
|
+
const h = t.getCell(o, n), f = (V = h == null ? void 0 : h.dataValidation) == null ? void 0 : V.rule, m = (S = h == null ? void 0 : h.dataValidation) == null ? void 0 : S.validator;
|
|
3214
|
+
if (!h || !f || !m)
|
|
3215
3215
|
return;
|
|
3216
|
-
const
|
|
3216
|
+
const v = ne(h), R = (y = m.transformDate(v)) != null ? y : je(), _ = R.isValid() ? R : je();
|
|
3217
3217
|
return /* @__PURE__ */ p.jsx("div", { className: Ts.dvDateDropdown, children: /* @__PURE__ */ p.jsx(
|
|
3218
3218
|
Zo,
|
|
3219
3219
|
{
|
|
3220
3220
|
pickerValue: c != null ? c : _,
|
|
3221
|
-
onSelect: async (
|
|
3222
|
-
const
|
|
3223
|
-
f.errorStyle !==
|
|
3224
|
-
value:
|
|
3221
|
+
onSelect: async (w) => {
|
|
3222
|
+
const F = w.format("YYYY/MM/DD");
|
|
3223
|
+
f.errorStyle !== at.STOP || await m.validator({
|
|
3224
|
+
value: F,
|
|
3225
3225
|
unitId: i,
|
|
3226
3226
|
subUnitId: s,
|
|
3227
3227
|
row: o,
|
|
@@ -3236,24 +3236,24 @@ function Ns(r) {
|
|
|
3236
3236
|
endRow: o
|
|
3237
3237
|
},
|
|
3238
3238
|
value: {
|
|
3239
|
-
v:
|
|
3239
|
+
v: F,
|
|
3240
3240
|
p: null,
|
|
3241
3241
|
f: null,
|
|
3242
3242
|
si: null
|
|
3243
3243
|
}
|
|
3244
|
-
}) : d.showReject(
|
|
3244
|
+
}) : d.showReject(m.getRuleFinalError(f)), e();
|
|
3245
3245
|
},
|
|
3246
|
-
onPanelChange: (
|
|
3247
|
-
u(
|
|
3246
|
+
onPanelChange: (w) => {
|
|
3247
|
+
u(w);
|
|
3248
3248
|
}
|
|
3249
3249
|
}
|
|
3250
3250
|
) });
|
|
3251
3251
|
}
|
|
3252
3252
|
const xr = "data-validation.list.dropdown", jr = "data-validation.date.dropdown";
|
|
3253
|
-
var
|
|
3253
|
+
var Ns = Object.defineProperty, Ls = Object.getOwnPropertyDescriptor, Ps = (r, a, e, t) => {
|
|
3254
3254
|
for (var o = t > 1 ? void 0 : t ? Ls(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
3255
3255
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
3256
|
-
return t && o &&
|
|
3256
|
+
return t && o && Ns(a, e, o), o;
|
|
3257
3257
|
}, se = (r, a) => (e, t) => a(e, t, r);
|
|
3258
3258
|
const As = {}, xs = {
|
|
3259
3259
|
tr: {
|
|
@@ -3261,9 +3261,9 @@ const As = {}, xs = {
|
|
|
3261
3261
|
color: "#fe4b4b"
|
|
3262
3262
|
}
|
|
3263
3263
|
};
|
|
3264
|
-
let
|
|
3265
|
-
constructor(r, a, e, t, o, n, i, s, l, d, c, u,
|
|
3266
|
-
super(), this._config = r, this._commandService = a, this._editorBridgeService = e, this._menuService = t, this._renderManagerService = o, this._univerInstanceService = n, this._autoHeightController = i, this._componentManager = s, this._dropdownManagerService = l, this._dataValidationModel = d, this._dataValidatorRegistryService = c, this._injector = u, this._sheetInterceptorService =
|
|
3264
|
+
let it = class extends er {
|
|
3265
|
+
constructor(r, a, e, t, o, n, i, s, l, d, c, u, h) {
|
|
3266
|
+
super(), this._config = r, this._commandService = a, this._editorBridgeService = e, this._menuService = t, this._renderManagerService = o, this._univerInstanceService = n, this._autoHeightController = i, this._componentManager = s, this._dropdownManagerService = l, this._dataValidationModel = d, this._dataValidatorRegistryService = c, this._injector = u, this._sheetInterceptorService = h, this._initComponents(), this._initMenu(), this._initSkeletonChange(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
|
3267
3267
|
}
|
|
3268
3268
|
_initMenu() {
|
|
3269
3269
|
const { menu: r = {} } = this._config;
|
|
@@ -3293,11 +3293,11 @@ let nt = class extends er {
|
|
|
3293
3293
|
],
|
|
3294
3294
|
[
|
|
3295
3295
|
jr,
|
|
3296
|
-
|
|
3296
|
+
Fs
|
|
3297
3297
|
],
|
|
3298
3298
|
[
|
|
3299
|
-
|
|
3300
|
-
|
|
3299
|
+
Tt.componentKey,
|
|
3300
|
+
Tt
|
|
3301
3301
|
],
|
|
3302
3302
|
...vi
|
|
3303
3303
|
].forEach(([r, a]) => {
|
|
@@ -3322,8 +3322,10 @@ let nt = class extends er {
|
|
|
3322
3322
|
const d = this._dataValidatorRegistryService.getValidatorItem(l.type);
|
|
3323
3323
|
if (!(d != null && d.dropdown))
|
|
3324
3324
|
return;
|
|
3325
|
-
const c = i.getActiveSheet()
|
|
3326
|
-
if (
|
|
3325
|
+
const c = i.getActiveSheet();
|
|
3326
|
+
if (!c) return;
|
|
3327
|
+
const u = this._dropdownManagerService.activeDropdown, h = u == null ? void 0 : u.location;
|
|
3328
|
+
if (h && h.unitId === e && h.subUnitId === t && h.row === o && h.col === n)
|
|
3327
3329
|
return;
|
|
3328
3330
|
this._dropdownManagerService.showDropdown({
|
|
3329
3331
|
location: {
|
|
@@ -3343,11 +3345,12 @@ let nt = class extends er {
|
|
|
3343
3345
|
}
|
|
3344
3346
|
_initSkeletonChange() {
|
|
3345
3347
|
const r = () => {
|
|
3346
|
-
var i, s;
|
|
3348
|
+
var i, s, l;
|
|
3347
3349
|
const a = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET);
|
|
3348
|
-
if (!a)
|
|
3349
|
-
|
|
3350
|
-
|
|
3350
|
+
if (!a) return;
|
|
3351
|
+
const e = a.getUnitId(), t = (i = a.getActiveSheet()) == null ? void 0 : i.getSheetId();
|
|
3352
|
+
if (!t) return;
|
|
3353
|
+
const o = (l = (s = this._renderManagerService.getRenderById(e)) == null ? void 0 : s.with(Na).getUnitSkeleton(e, t)) == null ? void 0 : l.skeleton, n = this._renderManagerService.getRenderById(e);
|
|
3351
3354
|
o == null || o.makeDirty(!0), o == null || o.calculate(), n && n.mainComponent.makeForceDirty();
|
|
3352
3355
|
};
|
|
3353
3356
|
this.disposeWithMe(this._dataValidationModel.ruleChange$.subscribe(() => r())), this.disposeWithMe(this._dataValidationModel.validStatusChange$.subscribe(() => r()));
|
|
@@ -3359,32 +3362,32 @@ let nt = class extends er {
|
|
|
3359
3362
|
vo.CELL_CONTENT,
|
|
3360
3363
|
{
|
|
3361
3364
|
priority: 200,
|
|
3362
|
-
// eslint-disable-next-line max-lines-per-function
|
|
3365
|
+
// eslint-disable-next-line max-lines-per-function, complexity
|
|
3363
3366
|
handler: (r, a, e) => {
|
|
3364
|
-
var
|
|
3367
|
+
var y, w, F, x, j, $;
|
|
3365
3368
|
const { row: t, col: o, unitId: n, subUnitId: i, workbook: s, worksheet: l } = a, d = this._dataValidationModel.ensureManager(n, i);
|
|
3366
3369
|
if (!d)
|
|
3367
3370
|
return e(r);
|
|
3368
|
-
const c = (
|
|
3371
|
+
const c = (w = (y = this._renderManagerService.getRenderById(n)) == null ? void 0 : y.with(Na).getUnitSkeleton(n, i)) == null ? void 0 : w.skeleton;
|
|
3369
3372
|
if (!c)
|
|
3370
3373
|
return e(r);
|
|
3371
|
-
const u = a.workbook.getStyles(),
|
|
3374
|
+
const u = a.workbook.getStyles(), h = (typeof (r == null ? void 0 : r.s) == "string" ? u.get(r == null ? void 0 : r.s) : r == null ? void 0 : r.s) || {}, f = d.getRuleIdByLocation(t, o);
|
|
3372
3375
|
if (!f)
|
|
3373
3376
|
return e(r);
|
|
3374
|
-
const
|
|
3375
|
-
if (!
|
|
3377
|
+
const m = d.getRuleById(f);
|
|
3378
|
+
if (!m)
|
|
3376
3379
|
return e(r);
|
|
3377
|
-
const
|
|
3380
|
+
const v = l.getCellRaw(a.row, a.col), R = this._dataValidationModel.validator(ne(v), m, a), _ = this._dataValidatorRegistryService.getValidatorItem(m.type), V = ne(r);
|
|
3378
3381
|
let S = {};
|
|
3379
|
-
if ((
|
|
3382
|
+
if ((m.type === X.LIST || m.type === X.LIST_MULTIPLE) && (S = {
|
|
3380
3383
|
interceptorStyle: {
|
|
3381
3384
|
...r == null ? void 0 : r.interceptorStyle,
|
|
3382
|
-
tb: (
|
|
3385
|
+
tb: (F = h.tb !== pe.OVERFLOW ? h.tb : pe.CLIP) != null ? F : pe.WRAP
|
|
3383
3386
|
}
|
|
3384
|
-
}),
|
|
3385
|
-
const { formula2:
|
|
3387
|
+
}), m.type === X.CHECKBOX) {
|
|
3388
|
+
const { formula2: E } = _.parseFormulaSync(m, a.unitId, a.subUnitId);
|
|
3386
3389
|
V || (S = {
|
|
3387
|
-
v:
|
|
3390
|
+
v: E,
|
|
3388
3391
|
t: 1,
|
|
3389
3392
|
p: null,
|
|
3390
3393
|
interceptorStyle: {
|
|
@@ -3393,14 +3396,14 @@ let nt = class extends er {
|
|
|
3393
3396
|
}
|
|
3394
3397
|
});
|
|
3395
3398
|
}
|
|
3396
|
-
if (
|
|
3397
|
-
const
|
|
3398
|
-
|
|
3399
|
+
if (m.type === X.LIST && (m.renderMode === ce.ARROW || m.renderMode === ce.TEXT)) {
|
|
3400
|
+
const E = _.getListWithColorMap(m), P = `${(x = ne(r)) != null ? x : ""}`, A = E[P];
|
|
3401
|
+
A && (S = {
|
|
3399
3402
|
...S,
|
|
3400
3403
|
interceptorStyle: {
|
|
3401
3404
|
...S.interceptorStyle,
|
|
3402
3405
|
bg: {
|
|
3403
|
-
rgb:
|
|
3406
|
+
rgb: A
|
|
3404
3407
|
}
|
|
3405
3408
|
}
|
|
3406
3409
|
});
|
|
@@ -3411,7 +3414,7 @@ let nt = class extends er {
|
|
|
3411
3414
|
dataValidation: {
|
|
3412
3415
|
ruleId: f,
|
|
3413
3416
|
validStatus: R,
|
|
3414
|
-
rule:
|
|
3417
|
+
rule: m,
|
|
3415
3418
|
validator: _
|
|
3416
3419
|
},
|
|
3417
3420
|
markers: {
|
|
@@ -3419,36 +3422,36 @@ let nt = class extends er {
|
|
|
3419
3422
|
...R === Re.INVALID ? xs : null
|
|
3420
3423
|
},
|
|
3421
3424
|
customRender: [
|
|
3422
|
-
...(
|
|
3425
|
+
...(j = r == null ? void 0 : r.customRender) != null ? j : [],
|
|
3423
3426
|
..._ != null && _.canvasRender ? [_.canvasRender] : []
|
|
3424
3427
|
],
|
|
3425
3428
|
// @ts-ignore
|
|
3426
3429
|
fontRenderExtension: {
|
|
3427
3430
|
// @ts-ignore
|
|
3428
3431
|
...r == null ? void 0 : r.fontRenderExtension,
|
|
3429
|
-
isSkip: _ == null ? void 0 : _.skipDefaultFontRender(
|
|
3432
|
+
isSkip: _ == null ? void 0 : _.skipDefaultFontRender(m, V, a)
|
|
3430
3433
|
},
|
|
3431
3434
|
interceptorStyle: {
|
|
3432
3435
|
...r == null ? void 0 : r.interceptorStyle,
|
|
3433
3436
|
...S.interceptorStyle
|
|
3434
3437
|
},
|
|
3435
3438
|
get interceptorAutoHeight() {
|
|
3436
|
-
var
|
|
3437
|
-
const
|
|
3438
|
-
const { startColumn:
|
|
3439
|
-
return t >=
|
|
3440
|
-
}),
|
|
3439
|
+
var A, q, L, b;
|
|
3440
|
+
const E = c.mergeData.find((Y) => {
|
|
3441
|
+
const { startColumn: Z, startRow: H, endColumn: M, endRow: O } = Y;
|
|
3442
|
+
return t >= H && o >= Z && t <= O && o <= M;
|
|
3443
|
+
}), P = {
|
|
3441
3444
|
data: {
|
|
3442
3445
|
...r,
|
|
3443
3446
|
dataValidation: {
|
|
3444
3447
|
ruleId: f,
|
|
3445
3448
|
validStatus: R,
|
|
3446
|
-
rule:
|
|
3449
|
+
rule: m,
|
|
3447
3450
|
validator: _
|
|
3448
3451
|
}
|
|
3449
3452
|
},
|
|
3450
3453
|
style: c.getsStyles().getStyleByCell(r),
|
|
3451
|
-
primaryWithCoord: c.getCellByIndex((
|
|
3454
|
+
primaryWithCoord: c.getCellByIndex((A = E == null ? void 0 : E.startRow) != null ? A : t, (q = E == null ? void 0 : E.startColumn) != null ? q : o),
|
|
3452
3455
|
unitId: n,
|
|
3453
3456
|
subUnitId: i,
|
|
3454
3457
|
row: t,
|
|
@@ -3456,8 +3459,9 @@ let nt = class extends er {
|
|
|
3456
3459
|
workbook: s,
|
|
3457
3460
|
worksheet: l
|
|
3458
3461
|
};
|
|
3459
|
-
return (
|
|
3460
|
-
}
|
|
3462
|
+
return (b = (L = _ == null ? void 0 : _.canvasRender) == null ? void 0 : L.calcCellAutoHeight) == null ? void 0 : b.call(L, P);
|
|
3463
|
+
},
|
|
3464
|
+
coverable: (($ = r == null ? void 0 : r.coverable) != null ? $ : !0) && !(m.type === X.LIST || m.type === X.LIST_MULTIPLE)
|
|
3461
3465
|
});
|
|
3462
3466
|
}
|
|
3463
3467
|
}
|
|
@@ -3474,28 +3478,28 @@ let nt = class extends er {
|
|
|
3474
3478
|
});
|
|
3475
3479
|
}
|
|
3476
3480
|
};
|
|
3477
|
-
|
|
3478
|
-
ve(ge.Rendered,
|
|
3481
|
+
it = Ps([
|
|
3482
|
+
ve(ge.Rendered, it),
|
|
3479
3483
|
se(1, re),
|
|
3480
3484
|
se(2, va),
|
|
3481
3485
|
se(3, Uo),
|
|
3482
3486
|
se(4, lr),
|
|
3483
|
-
se(5,
|
|
3484
|
-
se(6,
|
|
3485
|
-
se(7,
|
|
3486
|
-
se(8,
|
|
3487
|
-
se(9,
|
|
3488
|
-
se(10,
|
|
3489
|
-
se(11,
|
|
3490
|
-
se(12,
|
|
3491
|
-
],
|
|
3487
|
+
se(5, te),
|
|
3488
|
+
se(6, I(Mo)),
|
|
3489
|
+
se(7, I(ct)),
|
|
3490
|
+
se(8, I(Be)),
|
|
3491
|
+
se(9, I(K)),
|
|
3492
|
+
se(10, I(De)),
|
|
3493
|
+
se(11, I(Ue)),
|
|
3494
|
+
se(12, I(or))
|
|
3495
|
+
], it);
|
|
3492
3496
|
var js = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, Us = (r, a, e, t) => {
|
|
3493
3497
|
for (var o = t > 1 ? void 0 : t ? Bs(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
3494
3498
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
3495
3499
|
return t && o && js(a, e, o), o;
|
|
3496
|
-
},
|
|
3497
|
-
const
|
|
3498
|
-
let
|
|
3500
|
+
}, St = (r, a) => (e, t) => a(e, t, r);
|
|
3501
|
+
const Gt = "SHEET_DATA_VALIDATION_ALERT";
|
|
3502
|
+
let Ct = class extends he {
|
|
3499
3503
|
constructor(r, a, e, t) {
|
|
3500
3504
|
super(), this._hoverManagerService = r, this._cellAlertManagerService = a, this._univerInstanceService = e, this._localeService = t, this._init();
|
|
3501
3505
|
}
|
|
@@ -3506,9 +3510,11 @@ let Rt = class extends he {
|
|
|
3506
3510
|
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(rn(100)).subscribe((r) => {
|
|
3507
3511
|
var a, e;
|
|
3508
3512
|
if (r) {
|
|
3509
|
-
const
|
|
3513
|
+
const o = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET).getActiveSheet();
|
|
3514
|
+
if (!o) return;
|
|
3515
|
+
const n = o.getCell(r.location.row, r.location.col);
|
|
3510
3516
|
if (((a = n == null ? void 0 : n.dataValidation) == null ? void 0 : a.validStatus) === Re.INVALID) {
|
|
3511
|
-
const i = this._cellAlertManagerService.currentAlert.get(
|
|
3517
|
+
const i = this._cellAlertManagerService.currentAlert.get(Gt), s = (e = i == null ? void 0 : i.alert) == null ? void 0 : e.location;
|
|
3512
3518
|
if (s && s.row === r.location.row && s.col === r.location.col && s.subUnitId === r.location.subUnitId && s.unitId === r.location.unitId)
|
|
3513
3519
|
return;
|
|
3514
3520
|
const l = n.dataValidation.validator, d = n.dataValidation.rule;
|
|
@@ -3521,32 +3527,32 @@ let Rt = class extends he {
|
|
|
3521
3527
|
location: r.location,
|
|
3522
3528
|
width: 200,
|
|
3523
3529
|
height: 74,
|
|
3524
|
-
key:
|
|
3530
|
+
key: Gt
|
|
3525
3531
|
});
|
|
3526
3532
|
return;
|
|
3527
3533
|
}
|
|
3528
3534
|
}
|
|
3529
|
-
this._cellAlertManagerService.removeAlert(
|
|
3535
|
+
this._cellAlertManagerService.removeAlert(Gt);
|
|
3530
3536
|
}));
|
|
3531
3537
|
}
|
|
3532
3538
|
};
|
|
3533
|
-
|
|
3534
|
-
ve(ge.Rendered,
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
],
|
|
3539
|
+
Ct = Us([
|
|
3540
|
+
ve(ge.Rendered, Ct),
|
|
3541
|
+
St(0, I(wo)),
|
|
3542
|
+
St(1, I(Io)),
|
|
3543
|
+
St(2, te),
|
|
3544
|
+
St(3, I(ie))
|
|
3545
|
+
], Ct);
|
|
3540
3546
|
var $s = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, Hs = (r, a, e, t) => {
|
|
3541
3547
|
for (var o = t > 1 ? void 0 : t ? Ws(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
3542
3548
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
3543
3549
|
return t && o && $s(a, e, o), o;
|
|
3544
3550
|
}, Ye = (r, a) => (e, t) => a(e, t, r);
|
|
3545
|
-
let
|
|
3551
|
+
let st = class extends he {
|
|
3546
3552
|
constructor(a, e, t, o, n, i) {
|
|
3547
3553
|
super();
|
|
3548
|
-
|
|
3549
|
-
|
|
3554
|
+
g(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
3555
|
+
g(this, "registerRule", (a, e, t) => {
|
|
3550
3556
|
this.register(a, e, t), this.registerFormula(a, e, t);
|
|
3551
3557
|
});
|
|
3552
3558
|
this._dataValidationModel = a, this._injector = e, this._refRangeService = t, this._dataValidationCustomFormulaService = o, this._dataValidationFormulaService = n, this._formulaRefRangeService = i, this._initRefRange();
|
|
@@ -3561,8 +3567,8 @@ let it = class extends he {
|
|
|
3561
3567
|
const u = this._dataValidationModel.getRuleById(a, e, o);
|
|
3562
3568
|
if (!u)
|
|
3563
3569
|
return { redos: [], undos: [] };
|
|
3564
|
-
const
|
|
3565
|
-
if (!
|
|
3570
|
+
const h = u[d];
|
|
3571
|
+
if (!h || h === c)
|
|
3566
3572
|
return { redos: [], undos: [] };
|
|
3567
3573
|
const f = {
|
|
3568
3574
|
unitId: a,
|
|
@@ -3577,7 +3583,7 @@ let it = class extends he {
|
|
|
3577
3583
|
[d]: c
|
|
3578
3584
|
}
|
|
3579
3585
|
}
|
|
3580
|
-
},
|
|
3586
|
+
}, m = {
|
|
3581
3587
|
unitId: a,
|
|
3582
3588
|
subUnitId: e,
|
|
3583
3589
|
ruleId: t.uid,
|
|
@@ -3589,20 +3595,20 @@ let it = class extends he {
|
|
|
3589
3595
|
formula2: u.formula2
|
|
3590
3596
|
}
|
|
3591
3597
|
}
|
|
3592
|
-
},
|
|
3598
|
+
}, v = [
|
|
3593
3599
|
{
|
|
3594
|
-
id:
|
|
3600
|
+
id: Xe.id,
|
|
3595
3601
|
params: f
|
|
3596
3602
|
}
|
|
3597
3603
|
], R = [
|
|
3598
3604
|
{
|
|
3599
|
-
id:
|
|
3600
|
-
params:
|
|
3605
|
+
id: Xe.id,
|
|
3606
|
+
params: m
|
|
3601
3607
|
}
|
|
3602
3608
|
];
|
|
3603
|
-
return { redos:
|
|
3609
|
+
return { redos: v, undos: R };
|
|
3604
3610
|
};
|
|
3605
|
-
if (t.type ===
|
|
3611
|
+
if (t.type === X.CUSTOM) {
|
|
3606
3612
|
const d = this._dataValidationCustomFormulaService.getRuleFormulaInfo(a, e, o);
|
|
3607
3613
|
if (d) {
|
|
3608
3614
|
const c = this._formulaRefRangeService.registerFormula(
|
|
@@ -3612,23 +3618,23 @@ let it = class extends he {
|
|
|
3612
3618
|
i.add(() => c.dispose());
|
|
3613
3619
|
}
|
|
3614
3620
|
}
|
|
3615
|
-
if (t.type !==
|
|
3621
|
+
if (t.type !== X.CUSTOM) {
|
|
3616
3622
|
const d = this._dataValidationFormulaService.getRuleFormulaInfo(a, e, o);
|
|
3617
3623
|
if (d) {
|
|
3618
3624
|
const [c, u] = d;
|
|
3619
3625
|
if (c) {
|
|
3620
|
-
const
|
|
3626
|
+
const h = this._formulaRefRangeService.registerFormula(
|
|
3621
3627
|
c.text,
|
|
3622
3628
|
(f) => s("formula1", f)
|
|
3623
3629
|
);
|
|
3624
|
-
i.add(() =>
|
|
3630
|
+
i.add(() => h.dispose());
|
|
3625
3631
|
}
|
|
3626
3632
|
if (u) {
|
|
3627
|
-
const
|
|
3633
|
+
const h = this._formulaRefRangeService.registerFormula(
|
|
3628
3634
|
u.text,
|
|
3629
3635
|
(f) => s("formula1", f)
|
|
3630
3636
|
);
|
|
3631
|
-
i.add(() =>
|
|
3637
|
+
i.add(() => h.dispose());
|
|
3632
3638
|
}
|
|
3633
3639
|
}
|
|
3634
3640
|
}
|
|
@@ -3636,20 +3642,20 @@ let it = class extends he {
|
|
|
3636
3642
|
register(a, e, t) {
|
|
3637
3643
|
var l;
|
|
3638
3644
|
const o = (d) => {
|
|
3639
|
-
const c = [...t.ranges],
|
|
3640
|
-
if (Jr(
|
|
3645
|
+
const c = [...t.ranges], h = c.map((m) => _o(m, d)).filter((m) => !!m).flat();
|
|
3646
|
+
if (Jr(h, c))
|
|
3641
3647
|
return { redos: [], undos: [] };
|
|
3642
|
-
if (
|
|
3643
|
-
const
|
|
3648
|
+
if (h.length) {
|
|
3649
|
+
const m = {
|
|
3644
3650
|
unitId: a,
|
|
3645
3651
|
subUnitId: e,
|
|
3646
3652
|
ruleId: t.uid,
|
|
3647
3653
|
payload: {
|
|
3648
3654
|
type: Ie.RANGE,
|
|
3649
|
-
payload:
|
|
3655
|
+
payload: h
|
|
3650
3656
|
}
|
|
3651
|
-
},
|
|
3652
|
-
id:
|
|
3657
|
+
}, v = [{ id: Xe.id, params: m }], R = [{
|
|
3658
|
+
id: Xe.id,
|
|
3653
3659
|
params: {
|
|
3654
3660
|
unitId: a,
|
|
3655
3661
|
subUnitId: e,
|
|
@@ -3660,10 +3666,10 @@ let it = class extends he {
|
|
|
3660
3666
|
}
|
|
3661
3667
|
}
|
|
3662
3668
|
}];
|
|
3663
|
-
return { redos:
|
|
3669
|
+
return { redos: v, undos: R };
|
|
3664
3670
|
} else {
|
|
3665
|
-
const
|
|
3666
|
-
return { redos:
|
|
3671
|
+
const m = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id: yt.id, params: m }], R = lo(this._injector, m);
|
|
3672
|
+
return { redos: v, undos: R };
|
|
3667
3673
|
}
|
|
3668
3674
|
}, n = [];
|
|
3669
3675
|
t.ranges.forEach((d) => {
|
|
@@ -3702,93 +3708,109 @@ let it = class extends he {
|
|
|
3702
3708
|
}));
|
|
3703
3709
|
}
|
|
3704
3710
|
};
|
|
3705
|
-
|
|
3706
|
-
ve(ge.Ready,
|
|
3707
|
-
Ye(0,
|
|
3708
|
-
Ye(1,
|
|
3709
|
-
Ye(2,
|
|
3710
|
-
Ye(3,
|
|
3711
|
-
Ye(4,
|
|
3712
|
-
Ye(5,
|
|
3713
|
-
],
|
|
3714
|
-
var ks = Object.defineProperty, Ys = Object.getOwnPropertyDescriptor,
|
|
3711
|
+
st = Hs([
|
|
3712
|
+
ve(ge.Ready, st),
|
|
3713
|
+
Ye(0, I(K)),
|
|
3714
|
+
Ye(1, I(Ue)),
|
|
3715
|
+
Ye(2, I(go)),
|
|
3716
|
+
Ye(3, I(Ke)),
|
|
3717
|
+
Ye(4, I(ue)),
|
|
3718
|
+
Ye(5, I(nn))
|
|
3719
|
+
], st);
|
|
3720
|
+
var ks = Object.defineProperty, Ys = Object.getOwnPropertyDescriptor, Xs = (r, a, e, t) => {
|
|
3715
3721
|
for (var o = t > 1 ? void 0 : t ? Ys(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
3716
3722
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
3717
3723
|
return t && o && ks(a, e, o), o;
|
|
3718
3724
|
}, za = (r, a) => (e, t) => a(e, t, r);
|
|
3719
|
-
let
|
|
3725
|
+
let Vt = class extends he {
|
|
3720
3726
|
constructor(r, a) {
|
|
3721
3727
|
super(), this._autoFillService = r, this._dataValidationModel = a, this._initAutoFill();
|
|
3722
3728
|
}
|
|
3723
3729
|
// eslint-disable-next-line max-lines-per-function
|
|
3724
3730
|
_initAutoFill() {
|
|
3725
|
-
const r = () => ({ redos: [], undos: [] }), a = (
|
|
3726
|
-
const { source:
|
|
3727
|
-
row:
|
|
3728
|
-
col:
|
|
3731
|
+
const r = () => ({ redos: [], undos: [] }), a = (o) => {
|
|
3732
|
+
const { source: n, target: i, unitId: s, subUnitId: l } = o, d = this._dataValidationModel.ensureManager(s, l), c = d.getRuleObjectMatrix().clone(), u = oa([n, i]), [h, f] = u.ranges, { mapFunc: m } = u, v = {
|
|
3733
|
+
row: h.startRow,
|
|
3734
|
+
col: h.startColumn
|
|
3729
3735
|
};
|
|
3730
|
-
Eo(
|
|
3731
|
-
const
|
|
3732
|
-
startRow:
|
|
3733
|
-
startColumn:
|
|
3734
|
-
endColumn:
|
|
3735
|
-
endRow:
|
|
3736
|
+
Eo(h, f).forEach((y) => {
|
|
3737
|
+
const w = y.repeatStartCell, F = y.relativeRange, x = {
|
|
3738
|
+
startRow: v.row,
|
|
3739
|
+
startColumn: v.col,
|
|
3740
|
+
endColumn: v.col,
|
|
3741
|
+
endRow: v.row
|
|
3736
3742
|
}, j = {
|
|
3737
|
-
startRow:
|
|
3738
|
-
startColumn:
|
|
3739
|
-
endColumn:
|
|
3740
|
-
endRow:
|
|
3743
|
+
startRow: w.row,
|
|
3744
|
+
startColumn: w.col,
|
|
3745
|
+
endColumn: w.col,
|
|
3746
|
+
endRow: w.row
|
|
3741
3747
|
};
|
|
3742
|
-
|
|
3743
|
-
const
|
|
3748
|
+
U.foreach(F, ($, E) => {
|
|
3749
|
+
const P = xe.getPositionRange(
|
|
3744
3750
|
{
|
|
3745
|
-
startRow:
|
|
3746
|
-
startColumn:
|
|
3747
|
-
endColumn:
|
|
3748
|
-
endRow:
|
|
3751
|
+
startRow: $,
|
|
3752
|
+
startColumn: E,
|
|
3753
|
+
endColumn: E,
|
|
3754
|
+
endRow: $
|
|
3749
3755
|
},
|
|
3750
|
-
|
|
3751
|
-
), { row:
|
|
3752
|
-
if (
|
|
3753
|
-
const
|
|
3756
|
+
x
|
|
3757
|
+
), { row: A, col: q } = m(P.startRow, P.startColumn), L = d.getRuleIdByLocation(A, q);
|
|
3758
|
+
if (L) {
|
|
3759
|
+
const b = xe.getPositionRange(
|
|
3754
3760
|
{
|
|
3755
|
-
startRow:
|
|
3756
|
-
startColumn:
|
|
3757
|
-
endColumn:
|
|
3758
|
-
endRow:
|
|
3761
|
+
startRow: $,
|
|
3762
|
+
startColumn: E,
|
|
3763
|
+
endColumn: E,
|
|
3764
|
+
endRow: $
|
|
3759
3765
|
},
|
|
3760
3766
|
j
|
|
3761
|
-
), { row:
|
|
3762
|
-
|
|
3767
|
+
), { row: Y, col: Z } = m(b.startRow, b.startColumn);
|
|
3768
|
+
c.setValue(Y, Z, L);
|
|
3763
3769
|
}
|
|
3764
3770
|
});
|
|
3765
3771
|
});
|
|
3766
|
-
const
|
|
3772
|
+
const _ = c.diff(d.getDataValidations()), { redoMutations: V, undoMutations: S } = Qe(s, l, _);
|
|
3767
3773
|
return {
|
|
3768
|
-
undos:
|
|
3769
|
-
redos:
|
|
3774
|
+
undos: S,
|
|
3775
|
+
redos: V
|
|
3770
3776
|
};
|
|
3771
|
-
}, e =
|
|
3777
|
+
}, e = [
|
|
3778
|
+
X.CHECKBOX
|
|
3779
|
+
], t = {
|
|
3772
3780
|
id: ya,
|
|
3773
|
-
|
|
3781
|
+
onBeforeFillData: (o) => {
|
|
3782
|
+
const { source: n, unitId: i, subUnitId: s } = o, l = this._dataValidationModel.ensureManager(i, s);
|
|
3783
|
+
for (const d of n.rows)
|
|
3784
|
+
for (const c of n.cols) {
|
|
3785
|
+
const u = l.getRuleByLocation(d, c);
|
|
3786
|
+
if (u && e.indexOf(u.type) > -1) {
|
|
3787
|
+
this._autoFillService.setDisableApplyType(et.SERIES, !0);
|
|
3788
|
+
return;
|
|
3789
|
+
}
|
|
3790
|
+
}
|
|
3791
|
+
},
|
|
3792
|
+
onFillData: (o, n, i) => i === et.COPY || i === et.ONLY_FORMAT || i === et.SERIES ? a(o) : r(),
|
|
3793
|
+
onAfterFillData: () => {
|
|
3794
|
+
this._autoFillService.setDisableApplyType(et.SERIES, !1);
|
|
3795
|
+
}
|
|
3774
3796
|
};
|
|
3775
|
-
this.disposeWithMe(this._autoFillService.addHook(
|
|
3797
|
+
this.disposeWithMe(this._autoFillService.addHook(t));
|
|
3776
3798
|
}
|
|
3777
3799
|
};
|
|
3778
|
-
|
|
3779
|
-
ve(ge.Ready,
|
|
3800
|
+
Vt = Xs([
|
|
3801
|
+
ve(ge.Ready, Vt),
|
|
3780
3802
|
za(0, Do),
|
|
3781
|
-
za(1,
|
|
3782
|
-
],
|
|
3783
|
-
var
|
|
3803
|
+
za(1, I(K))
|
|
3804
|
+
], Vt);
|
|
3805
|
+
var Gs = Object.defineProperty, qs = Object.getOwnPropertyDescriptor, zs = (r, a, e, t) => {
|
|
3784
3806
|
for (var o = t > 1 ? void 0 : t ? qs(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
3785
3807
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
3786
|
-
return t && o &&
|
|
3808
|
+
return t && o && Gs(a, e, o), o;
|
|
3787
3809
|
}, qt = (r, a) => (e, t) => a(e, t, r);
|
|
3788
|
-
let
|
|
3810
|
+
let Mt = class extends he {
|
|
3789
3811
|
constructor(a, e, t) {
|
|
3790
3812
|
super();
|
|
3791
|
-
|
|
3813
|
+
g(this, "_copyInfo");
|
|
3792
3814
|
this._sheetClipboardService = a, this._dataValidationModel = e, this._injector = t, this._initCopyPaste();
|
|
3793
3815
|
}
|
|
3794
3816
|
_initCopyPaste() {
|
|
@@ -3802,7 +3824,7 @@ let Vt = class extends he {
|
|
|
3802
3824
|
});
|
|
3803
3825
|
}
|
|
3804
3826
|
_collect(a, e, t) {
|
|
3805
|
-
const o = new
|
|
3827
|
+
const o = new dt();
|
|
3806
3828
|
this._copyInfo = {
|
|
3807
3829
|
unitId: a,
|
|
3808
3830
|
subUnitId: e,
|
|
@@ -3815,9 +3837,9 @@ let Vt = class extends he {
|
|
|
3815
3837
|
return;
|
|
3816
3838
|
const { rows: l, cols: d } = s;
|
|
3817
3839
|
l.forEach((c, u) => {
|
|
3818
|
-
d.forEach((
|
|
3819
|
-
const
|
|
3820
|
-
o.setValue(u, f,
|
|
3840
|
+
d.forEach((h, f) => {
|
|
3841
|
+
const m = n.getRuleIdByLocation(c, h);
|
|
3842
|
+
o.setValue(u, f, m != null ? m : "");
|
|
3821
3843
|
});
|
|
3822
3844
|
});
|
|
3823
3845
|
}
|
|
@@ -3840,78 +3862,78 @@ let Vt = class extends he {
|
|
|
3840
3862
|
return { redos: [], undos: [] };
|
|
3841
3863
|
const { unitId: t, subUnitId: o } = this._copyInfo;
|
|
3842
3864
|
if (e.unitId !== t || o !== e.subUnitId) {
|
|
3843
|
-
const n = this._dataValidationModel.ensureManager(t, o), i = this._dataValidationModel.ensureManager(e.unitId, e.subUnitId), s = i.getRuleObjectMatrix().clone(), { ranges: [l, d], mapFunc: c } = oa([e.copyRange, a]), u = Pa(l, d, !0),
|
|
3844
|
-
u.forEach(({ startRange:
|
|
3865
|
+
const n = this._dataValidationModel.ensureManager(t, o), i = this._dataValidationModel.ensureManager(e.unitId, e.subUnitId), s = i.getRuleObjectMatrix().clone(), { ranges: [l, d], mapFunc: c } = oa([e.copyRange, a]), u = Pa(l, d, !0), h = /* @__PURE__ */ new Map();
|
|
3866
|
+
u.forEach(({ startRange: v }) => {
|
|
3845
3867
|
var R;
|
|
3846
3868
|
(R = this._copyInfo) == null || R.matrix.forValue((_, V, S) => {
|
|
3847
|
-
const
|
|
3869
|
+
const y = xe.getPositionRange(
|
|
3848
3870
|
{
|
|
3849
3871
|
startRow: _,
|
|
3850
3872
|
endRow: _,
|
|
3851
3873
|
startColumn: V,
|
|
3852
3874
|
endColumn: V
|
|
3853
3875
|
},
|
|
3854
|
-
|
|
3855
|
-
),
|
|
3856
|
-
!i.getRuleById(
|
|
3857
|
-
const { row:
|
|
3858
|
-
s.setValue(
|
|
3876
|
+
v
|
|
3877
|
+
), w = `${o}-${S}`, F = n.getRuleById(S);
|
|
3878
|
+
!i.getRuleById(w) && F && h.set(w, { ...F, uid: w });
|
|
3879
|
+
const { row: x, col: j } = c(y.startRow, y.startColumn);
|
|
3880
|
+
s.setValue(x, j, w);
|
|
3859
3881
|
});
|
|
3860
3882
|
});
|
|
3861
|
-
const { redoMutations: f, undoMutations:
|
|
3883
|
+
const { redoMutations: f, undoMutations: m } = Qe(
|
|
3862
3884
|
e.unitId,
|
|
3863
3885
|
e.subUnitId,
|
|
3864
|
-
s.diffWithAddition(i.getDataValidations(),
|
|
3886
|
+
s.diffWithAddition(i.getDataValidations(), h.values())
|
|
3865
3887
|
);
|
|
3866
3888
|
return {
|
|
3867
3889
|
redos: f,
|
|
3868
|
-
undos:
|
|
3890
|
+
undos: m
|
|
3869
3891
|
};
|
|
3870
3892
|
} else {
|
|
3871
3893
|
const n = this._dataValidationModel.ensureManager(t, o), i = n.getRuleObjectMatrix().clone(), { ranges: [s, l], mapFunc: d } = oa([e.copyRange, a]);
|
|
3872
3894
|
Pa(s, l, !0).forEach(({ startRange: f }) => {
|
|
3873
|
-
var
|
|
3874
|
-
(
|
|
3895
|
+
var m;
|
|
3896
|
+
(m = this._copyInfo) == null || m.matrix.forValue((v, R, _) => {
|
|
3875
3897
|
const V = xe.getPositionRange(
|
|
3876
3898
|
{
|
|
3877
|
-
startRow:
|
|
3878
|
-
endRow:
|
|
3899
|
+
startRow: v,
|
|
3900
|
+
endRow: v,
|
|
3879
3901
|
startColumn: R,
|
|
3880
3902
|
endColumn: R
|
|
3881
3903
|
},
|
|
3882
3904
|
f
|
|
3883
|
-
), { row: S, col:
|
|
3884
|
-
i.setValue(S,
|
|
3905
|
+
), { row: S, col: y } = d(V.startRow, V.startColumn);
|
|
3906
|
+
i.setValue(S, y, _);
|
|
3885
3907
|
});
|
|
3886
3908
|
});
|
|
3887
|
-
const { redoMutations: u, undoMutations:
|
|
3909
|
+
const { redoMutations: u, undoMutations: h } = Qe(
|
|
3888
3910
|
t,
|
|
3889
3911
|
o,
|
|
3890
3912
|
i.diff(n.getDataValidations())
|
|
3891
3913
|
);
|
|
3892
3914
|
return {
|
|
3893
3915
|
redos: u,
|
|
3894
|
-
undos:
|
|
3916
|
+
undos: h
|
|
3895
3917
|
};
|
|
3896
3918
|
}
|
|
3897
3919
|
}
|
|
3898
3920
|
};
|
|
3899
|
-
|
|
3900
|
-
ve(ge.Ready,
|
|
3921
|
+
Mt = zs([
|
|
3922
|
+
ve(ge.Ready, Mt),
|
|
3901
3923
|
qt(0, bo),
|
|
3902
|
-
qt(1,
|
|
3903
|
-
qt(2,
|
|
3904
|
-
],
|
|
3924
|
+
qt(1, I(K)),
|
|
3925
|
+
qt(2, I(Ue))
|
|
3926
|
+
], Mt);
|
|
3905
3927
|
class Ea {
|
|
3906
3928
|
constructor(a, e) {
|
|
3907
|
-
|
|
3929
|
+
g(this, "value");
|
|
3908
3930
|
this._worksheet = e, this.value = a;
|
|
3909
3931
|
}
|
|
3910
3932
|
addRule(a) {
|
|
3911
3933
|
const e = a.uid;
|
|
3912
3934
|
a.ranges.forEach((t) => {
|
|
3913
|
-
|
|
3914
|
-
|
|
3935
|
+
U.foreach(
|
|
3936
|
+
U.transformRange(t, this._worksheet),
|
|
3915
3937
|
(o, n) => {
|
|
3916
3938
|
this.value.setValue(o, n, e);
|
|
3917
3939
|
}
|
|
@@ -3920,30 +3942,30 @@ class Ea {
|
|
|
3920
3942
|
}
|
|
3921
3943
|
removeRange(a) {
|
|
3922
3944
|
a.forEach((e) => {
|
|
3923
|
-
|
|
3945
|
+
U.foreach(U.transformRange(e, this._worksheet), (t, o) => {
|
|
3924
3946
|
this.value.realDeleteValue(t, o);
|
|
3925
3947
|
});
|
|
3926
3948
|
});
|
|
3927
3949
|
}
|
|
3928
3950
|
removeRule(a) {
|
|
3929
3951
|
a.ranges.forEach((e) => {
|
|
3930
|
-
|
|
3952
|
+
U.foreach(U.transformRange(e, this._worksheet), (t, o) => {
|
|
3931
3953
|
this.value.setValue(t, o, "");
|
|
3932
3954
|
});
|
|
3933
3955
|
});
|
|
3934
3956
|
}
|
|
3935
3957
|
updateRange(a, e, t) {
|
|
3936
|
-
const o = `${a}$`, n = e.map((s) =>
|
|
3958
|
+
const o = `${a}$`, n = e.map((s) => U.transformRange(s, this._worksheet)), i = t.map((s) => U.transformRange(s, this._worksheet));
|
|
3937
3959
|
n.forEach((s) => {
|
|
3938
|
-
|
|
3960
|
+
U.foreach(s, (l, d) => {
|
|
3939
3961
|
this.value.getValue(l, d) === a && this.value.setValue(l, d, o);
|
|
3940
3962
|
});
|
|
3941
3963
|
}), i.forEach((s) => {
|
|
3942
|
-
|
|
3964
|
+
U.foreach(s, (l, d) => {
|
|
3943
3965
|
this.value.setValue(l, d, a);
|
|
3944
3966
|
});
|
|
3945
3967
|
}), n.forEach((s) => {
|
|
3946
|
-
|
|
3968
|
+
U.foreach(s, (l, d) => {
|
|
3947
3969
|
this.value.getValue(l, d) === o && this.value.realDeleteValue(l, d);
|
|
3948
3970
|
});
|
|
3949
3971
|
});
|
|
@@ -3952,7 +3974,7 @@ class Ea {
|
|
|
3952
3974
|
const e = [];
|
|
3953
3975
|
let t = 0;
|
|
3954
3976
|
return a.forEach((o, n) => {
|
|
3955
|
-
const i =
|
|
3977
|
+
const i = At(this.value, (l) => l === o.uid), s = o.ranges;
|
|
3956
3978
|
(i.length !== s.length || i.some((l, d) => !xe.equals(l, s[d]))) && e.push({
|
|
3957
3979
|
type: "update",
|
|
3958
3980
|
ruleId: o.uid,
|
|
@@ -3969,7 +3991,7 @@ class Ea {
|
|
|
3969
3991
|
const t = [];
|
|
3970
3992
|
let o = 0;
|
|
3971
3993
|
return a.forEach((n, i) => {
|
|
3972
|
-
const s =
|
|
3994
|
+
const s = At(this.value, (d) => d === n.uid), l = n.ranges;
|
|
3973
3995
|
(s.length !== l.length || s.some((d, c) => !xe.equals(d, l[c]))) && t.push({
|
|
3974
3996
|
type: "update",
|
|
3975
3997
|
ruleId: n.uid,
|
|
@@ -3981,7 +4003,7 @@ class Ea {
|
|
|
3981
4003
|
index: i - o
|
|
3982
4004
|
}), o++);
|
|
3983
4005
|
}), Array.from(e).forEach((n) => {
|
|
3984
|
-
const i =
|
|
4006
|
+
const i = At(this.value, (s) => s === n.uid);
|
|
3985
4007
|
t.push({
|
|
3986
4008
|
type: "add",
|
|
3987
4009
|
rule: {
|
|
@@ -3992,7 +4014,7 @@ class Ea {
|
|
|
3992
4014
|
}), t;
|
|
3993
4015
|
}
|
|
3994
4016
|
clone() {
|
|
3995
|
-
return new Ea(new
|
|
4017
|
+
return new Ea(new dt(this.value.clone()), this._worksheet);
|
|
3996
4018
|
}
|
|
3997
4019
|
getValue(a, e) {
|
|
3998
4020
|
return this.value.getValue(a, e);
|
|
@@ -4007,20 +4029,20 @@ class Qs extends co {
|
|
|
4007
4029
|
/**
|
|
4008
4030
|
* save cell's ruleId
|
|
4009
4031
|
*/
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
this._injector = n, this._dataValidatorRegistryService = this._injector.get(De), this._dataValidationCacheService = this._injector.get(
|
|
4018
|
-
const s = this._injector.get(
|
|
4032
|
+
g(this, "_ruleMatrix");
|
|
4033
|
+
g(this, "_dataValidatorRegistryService");
|
|
4034
|
+
g(this, "_dataValidationCacheService");
|
|
4035
|
+
g(this, "_dataValidationFormulaService");
|
|
4036
|
+
g(this, "_dataValidationCustomFormulaService");
|
|
4037
|
+
g(this, "_cache");
|
|
4038
|
+
g(this, "_dataValidationRefRangeController");
|
|
4039
|
+
this._injector = n, this._dataValidatorRegistryService = this._injector.get(De), this._dataValidationCacheService = this._injector.get(mt), this._dataValidationFormulaService = this._injector.get(ue), this._dataValidationCustomFormulaService = this._injector.get(Ke), this._dataValidationRefRangeController = this._injector.get(st), this._cache = this._dataValidationCacheService.ensureCache(e, t);
|
|
4040
|
+
const s = this._injector.get(te).getUnit(e, ae.UNIVER_SHEET).getSheetBySheetId(t), l = new dt();
|
|
4019
4041
|
o == null || o.forEach((d) => {
|
|
4020
4042
|
const c = d.uid;
|
|
4021
4043
|
d.ranges.forEach((u) => {
|
|
4022
|
-
|
|
4023
|
-
l.setValue(
|
|
4044
|
+
U.foreach(u, (h, f) => {
|
|
4045
|
+
l.setValue(h, f, c);
|
|
4024
4046
|
});
|
|
4025
4047
|
});
|
|
4026
4048
|
}), o == null || o.forEach((d) => {
|
|
@@ -4030,7 +4052,7 @@ class Qs extends co {
|
|
|
4030
4052
|
_addRuleSideEffect(e) {
|
|
4031
4053
|
var n;
|
|
4032
4054
|
const { unitId: t, subUnitId: o } = this;
|
|
4033
|
-
(e.type ===
|
|
4055
|
+
(e.type === X.LIST || e.type === X.LIST_MULTIPLE) && Ca((n = e.formula1) != null ? n : "") && (e.formula1 = `=${e.formula1}`), this._ruleMatrix.addRule(e), this._dataValidationCacheService.addRule(t, o, e), this._dataValidationFormulaService.addRule(t, o, e.uid, e.formula1, e.formula2), this._dataValidationCustomFormulaService.addRule(t, o, e);
|
|
4034
4056
|
}
|
|
4035
4057
|
addRule(e, t) {
|
|
4036
4058
|
(Array.isArray(e) ? e : [e]).forEach((n) => {
|
|
@@ -4058,19 +4080,19 @@ class Qs extends co {
|
|
|
4058
4080
|
validator(e, t, o, n) {
|
|
4059
4081
|
const { col: i, row: s, unitId: l, subUnitId: d } = o, c = t.uid, u = this._dataValidatorRegistryService.getValidatorItem(t.type);
|
|
4060
4082
|
if (u) {
|
|
4061
|
-
const
|
|
4062
|
-
return !
|
|
4083
|
+
const h = this._cache.getValue(s, i);
|
|
4084
|
+
return !h || h.value !== e ? (this._cache.setValue(s, i, {
|
|
4063
4085
|
value: e,
|
|
4064
4086
|
status: Re.VALIDATING,
|
|
4065
4087
|
ruleId: c
|
|
4066
4088
|
}), u.validator({ value: e, unitId: l, subUnitId: d, row: s, column: i }, t).then((f) => {
|
|
4067
|
-
const
|
|
4089
|
+
const m = f ? Re.VALID : Re.INVALID;
|
|
4068
4090
|
this._cache.setValue(s, i, {
|
|
4069
4091
|
value: e,
|
|
4070
|
-
status:
|
|
4092
|
+
status: m,
|
|
4071
4093
|
ruleId: c
|
|
4072
|
-
}), n(
|
|
4073
|
-
}), Re.VALIDATING) : (n(
|
|
4094
|
+
}), n(m, !0);
|
|
4095
|
+
}), Re.VALIDATING) : (n(h.status, !1), h.status);
|
|
4074
4096
|
} else
|
|
4075
4097
|
return n(Re.VALID, !1), Re.VALID;
|
|
4076
4098
|
}
|
|
@@ -4089,8 +4111,8 @@ var Ks = Object.defineProperty, Zs = Object.getOwnPropertyDescriptor, Js = (r, a
|
|
|
4089
4111
|
for (var o = t > 1 ? void 0 : t ? Zs(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
4090
4112
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
4091
4113
|
return t && o && Ks(a, e, o), o;
|
|
4092
|
-
},
|
|
4093
|
-
let
|
|
4114
|
+
}, Rt = (r, a) => (e, t) => a(e, t, r);
|
|
4115
|
+
let wt = class extends he {
|
|
4094
4116
|
constructor(r, a, e, t) {
|
|
4095
4117
|
super(), this._resourceManagerService = r, this._univerInstanceService = a, this._dataValidationModel = e, this._injector = t, this._initDataValidationDataSource();
|
|
4096
4118
|
}
|
|
@@ -4106,19 +4128,19 @@ let Mt = class extends he {
|
|
|
4106
4128
|
this._dataValidationModel.setManagerCreator(this._createSheetDataValidationManager.bind(this));
|
|
4107
4129
|
}
|
|
4108
4130
|
};
|
|
4109
|
-
|
|
4110
|
-
ve(ge.Starting,
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
],
|
|
4131
|
+
wt = Js([
|
|
4132
|
+
ve(ge.Starting, wt),
|
|
4133
|
+
Rt(0, eo),
|
|
4134
|
+
Rt(1, te),
|
|
4135
|
+
Rt(2, I(K)),
|
|
4136
|
+
Rt(3, I(Ue))
|
|
4137
|
+
], wt);
|
|
4116
4138
|
var el = Object.defineProperty, tl = Object.getOwnPropertyDescriptor, al = (r, a, e, t) => {
|
|
4117
4139
|
for (var o = t > 1 ? void 0 : t ? tl(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
4118
4140
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
4119
4141
|
return t && o && el(a, e, o), o;
|
|
4120
4142
|
}, zt = (r, a) => (e, t) => a(e, t, r);
|
|
4121
|
-
let
|
|
4143
|
+
let It = class extends he {
|
|
4122
4144
|
constructor(r, a, e) {
|
|
4123
4145
|
super(), this._localeService = r, this._commandService = a, this._sheetPermissionInterceptorBaseController = e, this._commandExecutedListener();
|
|
4124
4146
|
}
|
|
@@ -4138,12 +4160,12 @@ let wt = class extends he {
|
|
|
4138
4160
|
);
|
|
4139
4161
|
}
|
|
4140
4162
|
};
|
|
4141
|
-
|
|
4142
|
-
ve(ge.Ready,
|
|
4143
|
-
zt(0,
|
|
4163
|
+
It = al([
|
|
4164
|
+
ve(ge.Ready, It),
|
|
4165
|
+
zt(0, I(ie)),
|
|
4144
4166
|
zt(1, re),
|
|
4145
|
-
zt(2,
|
|
4146
|
-
],
|
|
4167
|
+
zt(2, I(To))
|
|
4168
|
+
], It);
|
|
4147
4169
|
var rl = Object.defineProperty, ol = Object.getOwnPropertyDescriptor, nl = (r, a, e, t) => {
|
|
4148
4170
|
for (var o = t > 1 ? void 0 : t ? ol(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
4149
4171
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
@@ -4169,7 +4191,7 @@ let ha = class {
|
|
|
4169
4191
|
const t = this._dataValidationModel.ensureManager(r, a).getDataValidations();
|
|
4170
4192
|
return await Promise.all(t.map((o) => Promise.all(o.ranges.map((n) => {
|
|
4171
4193
|
const i = [];
|
|
4172
|
-
return
|
|
4194
|
+
return U.foreach(n, (s, l) => {
|
|
4173
4195
|
i.push(this.validatorCell(r, a, s, l));
|
|
4174
4196
|
}), i;
|
|
4175
4197
|
})))), this._dataValidationCacheService.ensureCache(r, a);
|
|
@@ -4182,44 +4204,44 @@ let ha = class {
|
|
|
4182
4204
|
}
|
|
4183
4205
|
};
|
|
4184
4206
|
ha = nl([
|
|
4185
|
-
Qt(0,
|
|
4186
|
-
Qt(1,
|
|
4187
|
-
Qt(2,
|
|
4207
|
+
Qt(0, te),
|
|
4208
|
+
Qt(1, I(K)),
|
|
4209
|
+
Qt(2, I(mt))
|
|
4188
4210
|
], ha);
|
|
4189
4211
|
var Br = Object.defineProperty, il = Object.getOwnPropertyDescriptor, sl = (r, a, e) => a in r ? Br(r, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[a] = e, ll = (r, a, e, t) => {
|
|
4190
4212
|
for (var o = t > 1 ? void 0 : t ? il(a, e) : a, n = r.length - 1, i; n >= 0; n--)
|
|
4191
4213
|
(i = r[n]) && (o = (t ? i(a, e, o) : i(o)) || o);
|
|
4192
4214
|
return t && o && Br(a, e, o), o;
|
|
4193
|
-
}, Kt = (r, a) => (e, t) => a(e, t, r), Ur = (r, a, e) =>
|
|
4194
|
-
let
|
|
4215
|
+
}, Kt = (r, a) => (e, t) => a(e, t, r), Ur = (r, a, e) => sl(r, typeof a != "symbol" ? a + "" : a, e);
|
|
4216
|
+
let Lt = class extends ao {
|
|
4195
4217
|
constructor(r = {}, a, e, t) {
|
|
4196
|
-
super(), this._config = r, this._injector = a, this._commandService = e, this._localeService = t, this._config =
|
|
4218
|
+
super(), this._config = r, this._injector = a, this._commandService = e, this._localeService = t, this._config = B.deepMerge({}, As, this._config);
|
|
4197
4219
|
}
|
|
4198
4220
|
onStarting(r) {
|
|
4199
4221
|
[
|
|
4200
4222
|
[Ve],
|
|
4201
|
-
[
|
|
4202
|
-
[
|
|
4223
|
+
[Ot],
|
|
4224
|
+
[mt],
|
|
4203
4225
|
[ue],
|
|
4204
4226
|
[Ke],
|
|
4205
4227
|
[Be],
|
|
4206
4228
|
[ha],
|
|
4207
4229
|
// controller
|
|
4208
|
-
[
|
|
4209
|
-
[
|
|
4230
|
+
[wt],
|
|
4231
|
+
[ot],
|
|
4210
4232
|
[
|
|
4211
|
-
|
|
4233
|
+
it,
|
|
4212
4234
|
{
|
|
4213
|
-
useFactory: () => this._injector.createInstance(
|
|
4235
|
+
useFactory: () => this._injector.createInstance(it, this._config)
|
|
4214
4236
|
}
|
|
4215
4237
|
],
|
|
4216
|
-
[Rt],
|
|
4217
|
-
[it],
|
|
4218
|
-
[wt],
|
|
4219
4238
|
[Ct],
|
|
4239
|
+
[st],
|
|
4240
|
+
[It],
|
|
4220
4241
|
[Vt],
|
|
4221
|
-
[
|
|
4222
|
-
[
|
|
4242
|
+
[Mt],
|
|
4243
|
+
[rt],
|
|
4244
|
+
[nt]
|
|
4223
4245
|
].forEach((a) => {
|
|
4224
4246
|
r.add(a);
|
|
4225
4247
|
}), [
|
|
@@ -4230,43 +4252,43 @@ let Ft = class extends ao {
|
|
|
4230
4252
|
Va,
|
|
4231
4253
|
Vn,
|
|
4232
4254
|
Sr,
|
|
4233
|
-
|
|
4255
|
+
ut,
|
|
4234
4256
|
Cn
|
|
4235
4257
|
].forEach((a) => {
|
|
4236
4258
|
this._commandService.registerCommand(a);
|
|
4237
4259
|
});
|
|
4238
4260
|
}
|
|
4239
4261
|
};
|
|
4240
|
-
Ur(
|
|
4241
|
-
Ur(
|
|
4242
|
-
|
|
4243
|
-
to(ho, So,
|
|
4244
|
-
Kt(1,
|
|
4262
|
+
Ur(Lt, "pluginName", ya);
|
|
4263
|
+
Ur(Lt, "type", ae.UNIVER_SHEET);
|
|
4264
|
+
Lt = ll([
|
|
4265
|
+
to(ho, So, Fo),
|
|
4266
|
+
Kt(1, I(Ue)),
|
|
4245
4267
|
Kt(2, re),
|
|
4246
|
-
Kt(3,
|
|
4247
|
-
],
|
|
4268
|
+
Kt(3, I(ie))
|
|
4269
|
+
], Lt);
|
|
4248
4270
|
export {
|
|
4249
4271
|
Rr as AddSheetDataValidationAndOpenCommand,
|
|
4250
4272
|
wa as AddSheetDataValidationCommand,
|
|
4251
4273
|
ya as DATA_VALIDATION_PLUGIN_NAME,
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4274
|
+
Ct as DataValidationAlertController,
|
|
4275
|
+
Vt as DataValidationAutoFillController,
|
|
4276
|
+
mt as DataValidationCacheService,
|
|
4277
|
+
ot as DataValidationController,
|
|
4278
|
+
Mt as DataValidationCopyPasteController,
|
|
4257
4279
|
Ke as DataValidationCustomFormulaService,
|
|
4258
|
-
|
|
4280
|
+
rt as DataValidationFormulaController,
|
|
4259
4281
|
ue as DataValidationFormulaService,
|
|
4260
|
-
|
|
4261
|
-
|
|
4282
|
+
st as DataValidationRefRangeController,
|
|
4283
|
+
nt as DataValidationRejectInputController,
|
|
4262
4284
|
Vn as HideDataValidationDropdown,
|
|
4263
4285
|
Dl as ICommandService,
|
|
4264
4286
|
El as LocaleService,
|
|
4265
4287
|
Ol as Plugin,
|
|
4266
|
-
|
|
4267
|
-
|
|
4288
|
+
Ot as SheetDataValidationService,
|
|
4289
|
+
it as SheetsDataValidationRenderController,
|
|
4268
4290
|
ha as SheetsDataValidationValidatorService,
|
|
4269
4291
|
Va as ShowDataValidationDropdown,
|
|
4270
|
-
|
|
4292
|
+
Lt as UniverSheetsDataValidationPlugin,
|
|
4271
4293
|
Ma as UpdateSheetDataValidationRangeCommand
|
|
4272
4294
|
};
|