@univerjs/sheets-data-validation 0.8.2 → 0.8.3-nightly.202507010644
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 +1 -1
- package/lib/es/index.js +139 -139
- package/lib/index.js +139 -139
- package/lib/types/index.d.ts +7 -6
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
var vt = Object.defineProperty;
|
|
2
2
|
var Rt = (o, a, e) => a in o ? vt(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
3
|
var m = (o, a, e) => Rt(o, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
-
import { Inject as R, ICommandService as U, IUniverInstanceService as w, Disposable as W, ObjectMatrix as Se, UniverInstanceType as C, Range as b, Rectangle as I, isFormulaString as S, DataValidationType as T, getOriginCellValue as St, RBush as Et, debounce as Vt, Tools as E, DataValidationStatus as N, WrapStrategy as Re, DataValidationOperator as h, numfmt as H, dayjs as it, DataValidationRenderMode as xe, CommandType as z, IUndoRedoService as Z, sequenceExecute as De, isRangesEqual as ot,
|
|
4
|
+
import { Inject as R, ICommandService as U, IUniverInstanceService as w, Disposable as W, ObjectMatrix as Se, UniverInstanceType as C, Range as b, Rectangle as I, isFormulaString as S, DataValidationType as T, getOriginCellValue as St, RBush as Et, debounce as Vt, Tools as E, DataValidationStatus as N, WrapStrategy as Re, DataValidationOperator as h, numfmt as H, dayjs as it, DataValidationRenderMode as xe, CommandType as z, IUndoRedoService as Z, sequenceExecute as De, isRangesEqual as ot, IPermissionService as Mt, generateRandomId as yt, toDisposable as qe, Injector as Ge, CellValueType as Tt, RxDisposable as Ft, LifecycleService as Ct, LifecycleStages as Ze, bufferDebounceTime as Ot, DependentOn as wt, IConfigService as At, Plugin as It, merge as Dt } from "@univerjs/core";
|
|
5
5
|
import { DataValidationModel as Ye, DataValidatorRegistryService as q, UpdateRuleType as M, BaseDataValidator as G, TextLengthErrorTitleMap as Nt, AddDataValidationMutation as L, RemoveDataValidationMutation as D, UpdateDataValidationMutation as y, getRuleSetting as bt, getRuleOptions as Lt, UniverDataValidationPlugin as Ut } from "@univerjs/data-validation";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
for (var r = t > 1 ? void 0 : t ? Xt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
6
|
+
import { ERROR_TYPE_SET as Bt, LexerTreeBuilder as Y, isReferenceString as st, sequenceNodeType as xt, deserializeRangeWithSheet as Ht, deserializeRangeWithSheetWithCache as Pt, operatorToken as Wt } from "@univerjs/engine-formula";
|
|
7
|
+
import { SetRangeValuesMutation as se, RemoveSheetMutation as nt, getSheetCommandTarget as Xe, SetRangeValuesUndoMutationFactory as lt, WorksheetViewPermission as $t, RefRangeService as kt, handleCommonDefaultRangeChangeWithEffectRefCommands as jt, SheetInterceptorService as ut, RemoveSheetCommand as Qt, SheetsSelectionsService as dt, ClearSelectionAllCommand as qt } from "@univerjs/sheets";
|
|
8
|
+
import { Subject as Qe, bufferWhen as Gt, filter as Je } from "rxjs";
|
|
9
|
+
import { RegisterOtherFormulaService as ct, FormulaRefRangeService as ht } from "@univerjs/sheets-formula";
|
|
10
|
+
var Yt = Object.getOwnPropertyDescriptor, Xt = (o, a, e, t) => {
|
|
11
|
+
for (var r = t > 1 ? void 0 : t ? Yt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
13
12
|
(s = o[i]) && (r = s(r) || r);
|
|
14
13
|
return r;
|
|
15
14
|
}, et = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -36,7 +35,7 @@ let Q = class extends W {
|
|
|
36
35
|
_initSheetRemove() {
|
|
37
36
|
this.disposeWithMe(this._commandService.onCommandExecuted((a) => {
|
|
38
37
|
var e;
|
|
39
|
-
if (a.id ===
|
|
38
|
+
if (a.id === nt.id) {
|
|
40
39
|
const { unitId: t, subUnitId: r } = a.params;
|
|
41
40
|
(e = this._cacheMatrix.get(t)) == null || e.delete(r);
|
|
42
41
|
}
|
|
@@ -79,7 +78,7 @@ let Q = class extends W {
|
|
|
79
78
|
return this._ensureCache(a, e).getValue(t, r);
|
|
80
79
|
}
|
|
81
80
|
};
|
|
82
|
-
Q =
|
|
81
|
+
Q = Xt([
|
|
83
82
|
et(0, R(U)),
|
|
84
83
|
et(1, R(w))
|
|
85
84
|
], Q);
|
|
@@ -92,15 +91,15 @@ function _e(o) {
|
|
|
92
91
|
return (a = o == null ? void 0 : o[0]) == null ? void 0 : a[0];
|
|
93
92
|
}
|
|
94
93
|
function O(o) {
|
|
95
|
-
return !
|
|
94
|
+
return !Bt.has(o);
|
|
96
95
|
}
|
|
97
96
|
function de(o, a) {
|
|
98
97
|
var t;
|
|
99
98
|
const e = a.getValidatorItem(o);
|
|
100
99
|
return (t = e == null ? void 0 : e.offsetFormulaByRange) != null ? t : !1;
|
|
101
100
|
}
|
|
102
|
-
var
|
|
103
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
101
|
+
var Kt = Object.getOwnPropertyDescriptor, zt = (o, a, e, t) => {
|
|
102
|
+
for (var r = t > 1 ? void 0 : t ? Kt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
104
103
|
(s = o[i]) && (r = s(r) || r);
|
|
105
104
|
return r;
|
|
106
105
|
}, re = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -230,15 +229,15 @@ let P = class extends W {
|
|
|
230
229
|
r && this._registerOtherFormulaService.markFormulaDirty(a, e, r.formulaId), i && this._registerOtherFormulaService.markFormulaDirty(a, e, i.formulaId);
|
|
231
230
|
}
|
|
232
231
|
};
|
|
233
|
-
P =
|
|
232
|
+
P = zt([
|
|
234
233
|
re(0, w),
|
|
235
|
-
re(1, R(
|
|
234
|
+
re(1, R(ct)),
|
|
236
235
|
re(2, R(Ye)),
|
|
237
236
|
re(3, R(Q)),
|
|
238
237
|
re(4, R(q))
|
|
239
238
|
], P);
|
|
240
|
-
var
|
|
241
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
239
|
+
var Zt = Object.getOwnPropertyDescriptor, Jt = (o, a, e, t) => {
|
|
240
|
+
for (var r = t > 1 ? void 0 : t ? Zt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
242
241
|
(s = o[i]) && (r = s(r) || r);
|
|
243
242
|
return r;
|
|
244
243
|
}, ie = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -322,9 +321,9 @@ let K = class extends W {
|
|
|
322
321
|
return this._ensureRuleFormulaMap(a, e).get(t);
|
|
323
322
|
}
|
|
324
323
|
};
|
|
325
|
-
K =
|
|
324
|
+
K = Jt([
|
|
326
325
|
ie(0, w),
|
|
327
|
-
ie(1, R(
|
|
326
|
+
ie(1, R(ct)),
|
|
328
327
|
ie(2, R(Q)),
|
|
329
328
|
ie(3, R(Ye)),
|
|
330
329
|
ie(4, R(q))
|
|
@@ -477,8 +476,8 @@ class Ke {
|
|
|
477
476
|
return t.length > 0 ? t[0].ruleId : void 0;
|
|
478
477
|
}
|
|
479
478
|
}
|
|
480
|
-
var
|
|
481
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
479
|
+
var ea = Object.getOwnPropertyDescriptor, ta = (o, a, e, t) => {
|
|
480
|
+
for (var r = t > 1 ? void 0 : t ? ea(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
482
481
|
(s = o[i]) && (r = s(r) || r);
|
|
483
482
|
return r;
|
|
484
483
|
}, X = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -501,7 +500,7 @@ let F = class extends W {
|
|
|
501
500
|
})
|
|
502
501
|
), this.disposeWithMe(
|
|
503
502
|
this._commandService.onCommandExecuted((a) => {
|
|
504
|
-
if (a.id ===
|
|
503
|
+
if (a.id === nt.id) {
|
|
505
504
|
const { unitId: e, subUnitId: t } = a.params, r = this._ruleMatrixMap.get(e);
|
|
506
505
|
r && r.delete(t);
|
|
507
506
|
}
|
|
@@ -630,7 +629,7 @@ let F = class extends W {
|
|
|
630
629
|
return this._dataValidationModel.getAll();
|
|
631
630
|
}
|
|
632
631
|
};
|
|
633
|
-
F =
|
|
632
|
+
F = ta([
|
|
634
633
|
X(0, R(Ye)),
|
|
635
634
|
X(1, w),
|
|
636
635
|
X(2, R(q)),
|
|
@@ -644,7 +643,7 @@ function tt(o, a) {
|
|
|
644
643
|
return E.isBlank(o) ? a.t("dataValidation.validFail.value") : S(o) ? a.t("dataValidation.validFail.primitive") : "";
|
|
645
644
|
}
|
|
646
645
|
const pe = (o) => E.isDefine(o) && String(o).toLowerCase() === "true" ? "1" : String(o).toLowerCase() === "false" ? "0" : o;
|
|
647
|
-
class
|
|
646
|
+
class aa extends G {
|
|
648
647
|
constructor() {
|
|
649
648
|
super(...arguments);
|
|
650
649
|
m(this, "id", T.CHECKBOX);
|
|
@@ -716,7 +715,7 @@ class ra extends G {
|
|
|
716
715
|
return this.titleStr;
|
|
717
716
|
}
|
|
718
717
|
}
|
|
719
|
-
const
|
|
718
|
+
const ra = {
|
|
720
719
|
[h.BETWEEN]: "dataValidation.date.operators.between",
|
|
721
720
|
[h.EQUAL]: "dataValidation.date.operators.equal",
|
|
722
721
|
[h.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|
|
@@ -737,7 +736,7 @@ const at = {
|
|
|
737
736
|
[h.NOT_BETWEEN]: "dataValidation.date.ruleName.notBetween",
|
|
738
737
|
[h.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual",
|
|
739
738
|
NONE: "dataValidation.date.ruleName.legal"
|
|
740
|
-
},
|
|
739
|
+
}, ia = {
|
|
741
740
|
[h.BETWEEN]: "dataValidation.date.errorMsg.between",
|
|
742
741
|
[h.EQUAL]: "dataValidation.date.errorMsg.equal",
|
|
743
742
|
[h.GREATER_THAN]: "dataValidation.date.errorMsg.greaterThan",
|
|
@@ -777,7 +776,7 @@ const He = (o) => {
|
|
|
777
776
|
const a = (e = H.parseDate(o)) == null ? void 0 : e.v;
|
|
778
777
|
return E.isDefine(a) ? a : (t = H.parseDate(it(o).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : t.v;
|
|
779
778
|
};
|
|
780
|
-
class
|
|
779
|
+
class oa extends G {
|
|
781
780
|
constructor() {
|
|
782
781
|
super(...arguments);
|
|
783
782
|
m(this, "id", T.DATE);
|
|
@@ -861,7 +860,7 @@ class sa extends G {
|
|
|
861
860
|
};
|
|
862
861
|
}
|
|
863
862
|
get operatorNames() {
|
|
864
|
-
return this.operators.map((e) => this.localeService.t(
|
|
863
|
+
return this.operators.map((e) => this.localeService.t(ra[e]));
|
|
865
864
|
}
|
|
866
865
|
generateRuleName(e) {
|
|
867
866
|
var r, i;
|
|
@@ -874,7 +873,7 @@ class sa extends G {
|
|
|
874
873
|
if (!e.operator)
|
|
875
874
|
return this.titleStr;
|
|
876
875
|
const { transformedFormula1: r, transformedFormula2: i } = be(this._lexerTreeBuilder, e, t);
|
|
877
|
-
return `${this.localeService.t(
|
|
876
|
+
return `${this.localeService.t(ia[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
878
877
|
}
|
|
879
878
|
}
|
|
880
879
|
h.BETWEEN + "", h.EQUAL + "", h.GREATER_THAN + "", h.GREATER_THAN_OR_EQUAL + "", h.LESS_THAN + "", h.LESS_THAN_OR_EQUAL + "", h.NOT_BETWEEN + "", h.NOT_EQUAL + "";
|
|
@@ -893,7 +892,7 @@ const Me = {
|
|
|
893
892
|
function ye(o) {
|
|
894
893
|
return +o;
|
|
895
894
|
}
|
|
896
|
-
class
|
|
895
|
+
class sa extends G {
|
|
897
896
|
constructor() {
|
|
898
897
|
super(...arguments);
|
|
899
898
|
m(this, "_customFormulaService", this.injector.get(P));
|
|
@@ -981,22 +980,22 @@ function Pe(o) {
|
|
|
981
980
|
}
|
|
982
981
|
), [...a];
|
|
983
982
|
}
|
|
984
|
-
const
|
|
983
|
+
const na = [
|
|
985
984
|
"if",
|
|
986
985
|
"indirect",
|
|
987
986
|
"choose",
|
|
988
987
|
"offset"
|
|
989
988
|
];
|
|
990
|
-
function
|
|
991
|
-
if (!S(o) ||
|
|
989
|
+
function la(o, a) {
|
|
990
|
+
if (!S(o) || st(o.slice(1)))
|
|
992
991
|
return !0;
|
|
993
992
|
const t = a.sequenceNodesBuilder(o);
|
|
994
|
-
return t && t.some((r) => typeof r == "object" && r.nodeType ===
|
|
993
|
+
return t && t.some((r) => typeof r == "object" && r.nodeType === xt.FUNCTION && na.indexOf(r.token.toLowerCase()) > -1);
|
|
995
994
|
}
|
|
996
|
-
function
|
|
995
|
+
function ua(o, a) {
|
|
997
996
|
const { formula1: e = "", ranges: t } = o;
|
|
998
|
-
if (
|
|
999
|
-
const i =
|
|
997
|
+
if (st(e.slice(1))) {
|
|
998
|
+
const i = Ht(e.slice(1));
|
|
1000
999
|
if ((!i.sheetName || i.sheetName === a) && t.some((s) => I.intersects(s, i.range)))
|
|
1001
1000
|
return !0;
|
|
1002
1001
|
}
|
|
@@ -1018,7 +1017,7 @@ class gt extends G {
|
|
|
1018
1017
|
}
|
|
1019
1018
|
validatorFormula(e, t, r) {
|
|
1020
1019
|
var u, d, c;
|
|
1021
|
-
const i = !E.isBlank(e.formula1), s =
|
|
1020
|
+
const i = !E.isBlank(e.formula1), s = la((u = e.formula1) != null ? u : "", this._lexer), n = (c = (d = this._univerInstanceService.getUnit(t, C.UNIVER_SHEET)) == null ? void 0 : d.getSheetBySheetId(r)) == null ? void 0 : c.getName(), l = ua(e, n != null ? n : "");
|
|
1022
1021
|
return {
|
|
1023
1022
|
success: !!(i && s && !l),
|
|
1024
1023
|
formula1: i ? s ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -1094,7 +1093,7 @@ class gt extends G {
|
|
|
1094
1093
|
}), s;
|
|
1095
1094
|
}
|
|
1096
1095
|
}
|
|
1097
|
-
class
|
|
1096
|
+
class da extends G {
|
|
1098
1097
|
constructor() {
|
|
1099
1098
|
super(...arguments);
|
|
1100
1099
|
m(this, "id", T.TEXT_LENGTH);
|
|
@@ -1332,7 +1331,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1332
1331
|
}
|
|
1333
1332
|
}, A = {
|
|
1334
1333
|
id: se.id,
|
|
1335
|
-
params:
|
|
1334
|
+
params: lt(t, f.params)
|
|
1336
1335
|
};
|
|
1337
1336
|
l.push(f), u.push(A);
|
|
1338
1337
|
}
|
|
@@ -1341,7 +1340,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1341
1340
|
undoMutations: u
|
|
1342
1341
|
};
|
|
1343
1342
|
}
|
|
1344
|
-
const
|
|
1343
|
+
const ca = {
|
|
1345
1344
|
type: z.COMMAND,
|
|
1346
1345
|
id: "sheet.command.updateDataValidationRuleRange",
|
|
1347
1346
|
handler(o, a) {
|
|
@@ -1359,7 +1358,7 @@ const ha = {
|
|
|
1359
1358
|
unitID: e
|
|
1360
1359
|
}), De(g, n), !0;
|
|
1361
1360
|
}
|
|
1362
|
-
},
|
|
1361
|
+
}, ha = {
|
|
1363
1362
|
type: z.COMMAND,
|
|
1364
1363
|
id: "sheet.command.addDataValidation",
|
|
1365
1364
|
handler(o, a) {
|
|
@@ -1391,7 +1390,7 @@ const ha = {
|
|
|
1391
1390
|
undoMutations: p
|
|
1392
1391
|
}), De(g, s), !0;
|
|
1393
1392
|
}
|
|
1394
|
-
},
|
|
1393
|
+
}, ma = {
|
|
1395
1394
|
type: z.COMMAND,
|
|
1396
1395
|
id: "sheets.command.update-data-validation-setting",
|
|
1397
1396
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -1459,7 +1458,7 @@ const ha = {
|
|
|
1459
1458
|
}
|
|
1460
1459
|
}, ae = {
|
|
1461
1460
|
id: se.id,
|
|
1462
|
-
params:
|
|
1461
|
+
params: lt(o, ge.params)
|
|
1463
1462
|
};
|
|
1464
1463
|
_.push(ge), V.push(ae);
|
|
1465
1464
|
}
|
|
@@ -1471,7 +1470,7 @@ const ha = {
|
|
|
1471
1470
|
undoMutations: V
|
|
1472
1471
|
}), !0) : !1;
|
|
1473
1472
|
}
|
|
1474
|
-
},
|
|
1473
|
+
}, ga = {
|
|
1475
1474
|
type: z.COMMAND,
|
|
1476
1475
|
id: "sheets.command.update-data-validation-options",
|
|
1477
1476
|
handler(o, a) {
|
|
@@ -1509,7 +1508,7 @@ const ha = {
|
|
|
1509
1508
|
undoMutations: p
|
|
1510
1509
|
}), e.executeCommand(y.id, d), !0;
|
|
1511
1510
|
}
|
|
1512
|
-
},
|
|
1511
|
+
}, _a = {
|
|
1513
1512
|
type: z.COMMAND,
|
|
1514
1513
|
id: "sheets.command.clear-range-data-validation",
|
|
1515
1514
|
handler(o, a) {
|
|
@@ -1526,7 +1525,7 @@ const ha = {
|
|
|
1526
1525
|
undoMutations: p
|
|
1527
1526
|
}), De(g, i).result;
|
|
1528
1527
|
}
|
|
1529
|
-
},
|
|
1528
|
+
}, pa = {
|
|
1530
1529
|
type: z.COMMAND,
|
|
1531
1530
|
id: "sheet.command.remove-all-data-validation",
|
|
1532
1531
|
handler(o, a) {
|
|
@@ -1553,7 +1552,7 @@ const ha = {
|
|
|
1553
1552
|
unitID: e
|
|
1554
1553
|
}), r.executeCommand(D.id, l), !0;
|
|
1555
1554
|
}
|
|
1556
|
-
},
|
|
1555
|
+
}, fa = (o, a) => {
|
|
1557
1556
|
const e = o.get(F), { unitId: t, subUnitId: r, ruleId: i, source: s } = a;
|
|
1558
1557
|
if (Array.isArray(i)) {
|
|
1559
1558
|
const l = i.map((u) => e.getRuleById(t, r, u)).filter(Boolean);
|
|
@@ -1578,7 +1577,7 @@ const ha = {
|
|
|
1578
1577
|
index: e.getRuleIndex(t, r, i)
|
|
1579
1578
|
}
|
|
1580
1579
|
}];
|
|
1581
|
-
},
|
|
1580
|
+
}, va = {
|
|
1582
1581
|
type: z.COMMAND,
|
|
1583
1582
|
id: "sheet.command.remove-data-validation-rule",
|
|
1584
1583
|
handler(o, a) {
|
|
@@ -1604,13 +1603,59 @@ const ha = {
|
|
|
1604
1603
|
unitID: a.unitId
|
|
1605
1604
|
}), i.executeCommand(D.id, a), !0;
|
|
1606
1605
|
}
|
|
1607
|
-
},
|
|
1608
|
-
var
|
|
1609
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1606
|
+
}, Ra = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
1607
|
+
var pt = /* @__PURE__ */ ((o) => (o[o.View = 0] = "View", o[o.Edit = 1] = "Edit", o[o.ManageCollaborator = 2] = "ManageCollaborator", o[o.Print = 3] = "Print", o[o.Duplicate = 4] = "Duplicate", o[o.Comment = 5] = "Comment", o[o.Copy = 6] = "Copy", o[o.Share = 7] = "Share", o[o.Export = 8] = "Export", o[o.MoveWorksheet = 9] = "MoveWorksheet", o[o.DeleteWorksheet = 10] = "DeleteWorksheet", o[o.HideWorksheet = 11] = "HideWorksheet", o[o.RenameWorksheet = 12] = "RenameWorksheet", o[o.CreateWorksheet = 13] = "CreateWorksheet", o[o.SetWorksheetStyle = 14] = "SetWorksheetStyle", o[o.EditWorksheetCell = 15] = "EditWorksheetCell", o[o.InsertHyperlink = 16] = "InsertHyperlink", o[o.Sort = 17] = "Sort", o[o.Filter = 18] = "Filter", o[o.PivotTable = 19] = "PivotTable", o[o.FloatImg = 20] = "FloatImg", o[o.History = 21] = "History", o[o.RwHgtClWdt = 22] = "RwHgtClWdt", o[o.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", o[o.ViewFilter = 24] = "ViewFilter", o[o.MoveSheet = 25] = "MoveSheet", o[o.DeleteSheet = 26] = "DeleteSheet", o[o.HideSheet = 27] = "HideSheet", o[o.CopySheet = 28] = "CopySheet", o[o.RenameSheet = 29] = "RenameSheet", o[o.CreateSheet = 30] = "CreateSheet", o[o.SelectProtectedCells = 31] = "SelectProtectedCells", o[o.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", o[o.SetCellStyle = 33] = "SetCellStyle", o[o.SetCellValue = 34] = "SetCellValue", o[o.SetRowStyle = 35] = "SetRowStyle", o[o.SetColumnStyle = 36] = "SetColumnStyle", o[o.InsertRow = 37] = "InsertRow", o[o.InsertColumn = 38] = "InsertColumn", o[o.DeleteRow = 39] = "DeleteRow", o[o.DeleteColumn = 40] = "DeleteColumn", o[o.EditExtraObject = 41] = "EditExtraObject", o[o.Delete = 42] = "Delete", o[o.RecoverHistory = 43] = "RecoverHistory", o[o.ViewHistory = 44] = "ViewHistory", o[o.CreatePermissionObject = 45] = "CreatePermissionObject", o[o.UNRECOGNIZED = -1] = "UNRECOGNIZED", o))(pt || {}), Sa = Object.getOwnPropertyDescriptor, Ea = (o, a, e, t) => {
|
|
1608
|
+
for (var r = t > 1 ? void 0 : t ? Sa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1610
1609
|
(s = o[i]) && (r = s(r) || r);
|
|
1611
1610
|
return r;
|
|
1612
1611
|
}, We = (o, a) => (e, t) => a(e, t, o);
|
|
1613
1612
|
let Te = class extends W {
|
|
1613
|
+
constructor(o, a, e) {
|
|
1614
|
+
super(), this._univerInstanceService = o, this._permissionService = a, this._lexerTreeBuilder = e;
|
|
1615
|
+
}
|
|
1616
|
+
getFormulaRefCheck(o) {
|
|
1617
|
+
var e, t;
|
|
1618
|
+
const a = this._lexerTreeBuilder.sequenceNodesBuilder(o);
|
|
1619
|
+
if (!a)
|
|
1620
|
+
return !0;
|
|
1621
|
+
for (let r = 0; r < a.length; r++) {
|
|
1622
|
+
const i = a[r];
|
|
1623
|
+
if (typeof i == "string")
|
|
1624
|
+
continue;
|
|
1625
|
+
const { token: s } = i, n = Pt(s), l = this._univerInstanceService.getCurrentUnitForType(C.UNIVER_SHEET);
|
|
1626
|
+
let u = l.getActiveSheet();
|
|
1627
|
+
const d = l.getUnitId();
|
|
1628
|
+
if (n.sheetName) {
|
|
1629
|
+
if (u = l.getSheetBySheetName(n.sheetName), !u)
|
|
1630
|
+
return !1;
|
|
1631
|
+
const v = u == null ? void 0 : u.getSheetId();
|
|
1632
|
+
if (!this._permissionService.getPermissionPoint(new $t(d, v).id)) return !1;
|
|
1633
|
+
}
|
|
1634
|
+
if (!u)
|
|
1635
|
+
return !1;
|
|
1636
|
+
const { startRow: c, endRow: g, startColumn: p, endColumn: _ } = n.range;
|
|
1637
|
+
for (let v = c; v <= g; v++)
|
|
1638
|
+
for (let V = p; V <= _; V++) {
|
|
1639
|
+
const f = (t = (e = u.getCell(v, V)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1640
|
+
if ((f == null ? void 0 : f[pt.View]) === !1)
|
|
1641
|
+
return !1;
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
return !0;
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
Te = Ea([
|
|
1648
|
+
We(0, w),
|
|
1649
|
+
We(1, Mt),
|
|
1650
|
+
We(2, R(Y))
|
|
1651
|
+
], Te);
|
|
1652
|
+
const Va = "sheets-data-validation.config", rt = {};
|
|
1653
|
+
var Ma = Object.getOwnPropertyDescriptor, ya = (o, a, e, t) => {
|
|
1654
|
+
for (var r = t > 1 ? void 0 : t ? Ma(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1655
|
+
(s = o[i]) && (r = s(r) || r);
|
|
1656
|
+
return r;
|
|
1657
|
+
}, $e = (o, a) => (e, t) => a(e, t, o);
|
|
1658
|
+
let Fe = class extends W {
|
|
1614
1659
|
constructor(a, e, t) {
|
|
1615
1660
|
super();
|
|
1616
1661
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
@@ -1681,7 +1726,7 @@ let Te = class extends W {
|
|
|
1681
1726
|
}
|
|
1682
1727
|
});
|
|
1683
1728
|
for (let p = 1; p < u.length; p++) {
|
|
1684
|
-
const _ = u[p], v =
|
|
1729
|
+
const _ = u[p], v = yt();
|
|
1685
1730
|
d.push({
|
|
1686
1731
|
id: L.id,
|
|
1687
1732
|
params: {
|
|
@@ -1747,55 +1792,10 @@ let Te = class extends W {
|
|
|
1747
1792
|
}));
|
|
1748
1793
|
}
|
|
1749
1794
|
};
|
|
1750
|
-
Te = Va([
|
|
1751
|
-
We(0, R(F)),
|
|
1752
|
-
We(1, R(ct)),
|
|
1753
|
-
We(2, R(q))
|
|
1754
|
-
], Te);
|
|
1755
|
-
var pt = /* @__PURE__ */ ((o) => (o[o.View = 0] = "View", o[o.Edit = 1] = "Edit", o[o.ManageCollaborator = 2] = "ManageCollaborator", o[o.Print = 3] = "Print", o[o.Duplicate = 4] = "Duplicate", o[o.Comment = 5] = "Comment", o[o.Copy = 6] = "Copy", o[o.Share = 7] = "Share", o[o.Export = 8] = "Export", o[o.MoveWorksheet = 9] = "MoveWorksheet", o[o.DeleteWorksheet = 10] = "DeleteWorksheet", o[o.HideWorksheet = 11] = "HideWorksheet", o[o.RenameWorksheet = 12] = "RenameWorksheet", o[o.CreateWorksheet = 13] = "CreateWorksheet", o[o.SetWorksheetStyle = 14] = "SetWorksheetStyle", o[o.EditWorksheetCell = 15] = "EditWorksheetCell", o[o.InsertHyperlink = 16] = "InsertHyperlink", o[o.Sort = 17] = "Sort", o[o.Filter = 18] = "Filter", o[o.PivotTable = 19] = "PivotTable", o[o.FloatImg = 20] = "FloatImg", o[o.History = 21] = "History", o[o.RwHgtClWdt = 22] = "RwHgtClWdt", o[o.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", o[o.ViewFilter = 24] = "ViewFilter", o[o.MoveSheet = 25] = "MoveSheet", o[o.DeleteSheet = 26] = "DeleteSheet", o[o.HideSheet = 27] = "HideSheet", o[o.CopySheet = 28] = "CopySheet", o[o.RenameSheet = 29] = "RenameSheet", o[o.CreateSheet = 30] = "CreateSheet", o[o.SelectProtectedCells = 31] = "SelectProtectedCells", o[o.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", o[o.SetCellStyle = 33] = "SetCellStyle", o[o.SetCellValue = 34] = "SetCellValue", o[o.SetRowStyle = 35] = "SetRowStyle", o[o.SetColumnStyle = 36] = "SetColumnStyle", o[o.InsertRow = 37] = "InsertRow", o[o.InsertColumn = 38] = "InsertColumn", o[o.DeleteRow = 39] = "DeleteRow", o[o.DeleteColumn = 40] = "DeleteColumn", o[o.EditExtraObject = 41] = "EditExtraObject", o[o.Delete = 42] = "Delete", o[o.RecoverHistory = 43] = "RecoverHistory", o[o.ViewHistory = 44] = "ViewHistory", o[o.CreatePermissionObject = 45] = "CreatePermissionObject", o[o.UNRECOGNIZED = -1] = "UNRECOGNIZED", o))(pt || {}), Ma = Object.getOwnPropertyDescriptor, ya = (o, a, e, t) => {
|
|
1756
|
-
for (var r = t > 1 ? void 0 : t ? Ma(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1757
|
-
(s = o[i]) && (r = s(r) || r);
|
|
1758
|
-
return r;
|
|
1759
|
-
}, $e = (o, a) => (e, t) => a(e, t, o);
|
|
1760
|
-
let Fe = class extends W {
|
|
1761
|
-
constructor(o, a, e) {
|
|
1762
|
-
super(), this._univerInstanceService = o, this._permissionService = a, this._lexerTreeBuilder = e;
|
|
1763
|
-
}
|
|
1764
|
-
getFormulaRefCheck(o) {
|
|
1765
|
-
var e, t;
|
|
1766
|
-
const a = this._lexerTreeBuilder.sequenceNodesBuilder(o);
|
|
1767
|
-
if (!a)
|
|
1768
|
-
return !0;
|
|
1769
|
-
for (let r = 0; r < a.length; r++) {
|
|
1770
|
-
const i = a[r];
|
|
1771
|
-
if (typeof i == "string")
|
|
1772
|
-
continue;
|
|
1773
|
-
const { token: s } = i, n = qt(s), l = this._univerInstanceService.getCurrentUnitForType(C.UNIVER_SHEET);
|
|
1774
|
-
let u = l.getActiveSheet();
|
|
1775
|
-
const d = l.getUnitId();
|
|
1776
|
-
if (n.sheetName) {
|
|
1777
|
-
if (u = l.getSheetBySheetName(n.sheetName), !u)
|
|
1778
|
-
return !1;
|
|
1779
|
-
const v = u == null ? void 0 : u.getSheetId();
|
|
1780
|
-
if (!this._permissionService.getPermissionPoint(new Bt(d, v).id)) return !1;
|
|
1781
|
-
}
|
|
1782
|
-
if (!u)
|
|
1783
|
-
return !1;
|
|
1784
|
-
const { startRow: c, endRow: g, startColumn: p, endColumn: _ } = n.range;
|
|
1785
|
-
for (let v = c; v <= g; v++)
|
|
1786
|
-
for (let V = p; V <= _; V++) {
|
|
1787
|
-
const f = (t = (e = u.getCell(v, V)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1788
|
-
if ((f == null ? void 0 : f[pt.View]) === !1)
|
|
1789
|
-
return !1;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
return !0;
|
|
1793
|
-
}
|
|
1794
|
-
};
|
|
1795
1795
|
Fe = ya([
|
|
1796
|
-
$e(0,
|
|
1797
|
-
$e(1,
|
|
1798
|
-
$e(2, R(
|
|
1796
|
+
$e(0, R(F)),
|
|
1797
|
+
$e(1, R(ht)),
|
|
1798
|
+
$e(2, R(q))
|
|
1799
1799
|
], Fe);
|
|
1800
1800
|
var Ta = Object.getOwnPropertyDescriptor, Fa = (o, a, e, t) => {
|
|
1801
1801
|
for (var r = t > 1 ? void 0 : t ? Ta(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
@@ -1889,7 +1889,7 @@ let Ce = class extends W {
|
|
|
1889
1889
|
register(a, e, t) {
|
|
1890
1890
|
var l;
|
|
1891
1891
|
const r = (u) => {
|
|
1892
|
-
const d = [...t.ranges], g = d.map((_) =>
|
|
1892
|
+
const d = [...t.ranges], g = d.map((_) => jt(_, u)).filter((_) => !!_).flat();
|
|
1893
1893
|
if (ot(g, d))
|
|
1894
1894
|
return { redos: [], undos: [] };
|
|
1895
1895
|
if (g.length) {
|
|
@@ -1917,7 +1917,7 @@ let Ce = class extends W {
|
|
|
1917
1917
|
}];
|
|
1918
1918
|
return { redos: v, undos: V };
|
|
1919
1919
|
} else {
|
|
1920
|
-
const _ = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id: D.id, params: _ }], V =
|
|
1920
|
+
const _ = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id: D.id, params: _ }], V = fa(this._injector, _);
|
|
1921
1921
|
return { redos: v, undos: V };
|
|
1922
1922
|
}
|
|
1923
1923
|
}, i = [];
|
|
@@ -1965,9 +1965,9 @@ let Ce = class extends W {
|
|
|
1965
1965
|
Ce = Fa([
|
|
1966
1966
|
ee(0, R(F)),
|
|
1967
1967
|
ee(1, R(Ge)),
|
|
1968
|
-
ee(2, R(
|
|
1968
|
+
ee(2, R(kt)),
|
|
1969
1969
|
ee(3, R(K)),
|
|
1970
|
-
ee(4, R(
|
|
1970
|
+
ee(4, R(ht)),
|
|
1971
1971
|
ee(5, R(q))
|
|
1972
1972
|
], Ce);
|
|
1973
1973
|
var Ca = Object.getOwnPropertyDescriptor, Oa = (o, a, e, t) => {
|
|
@@ -1984,7 +1984,7 @@ let Oe = class extends W {
|
|
|
1984
1984
|
this._sheetInterceptorService.interceptCommand({
|
|
1985
1985
|
getMutations: (o) => {
|
|
1986
1986
|
var a;
|
|
1987
|
-
if (o.id ===
|
|
1987
|
+
if (o.id === Qt.id) {
|
|
1988
1988
|
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(C.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
1989
1989
|
if (!r)
|
|
1990
1990
|
return { redos: [], undos: [] };
|
|
@@ -2023,7 +2023,7 @@ let Oe = class extends W {
|
|
|
2023
2023
|
}
|
|
2024
2024
|
};
|
|
2025
2025
|
Oe = Oa([
|
|
2026
|
-
ke(0, R(
|
|
2026
|
+
ke(0, R(ut)),
|
|
2027
2027
|
ke(1, R(w)),
|
|
2028
2028
|
ke(2, R(F))
|
|
2029
2029
|
], Oe);
|
|
@@ -2069,7 +2069,7 @@ class Aa extends G {
|
|
|
2069
2069
|
}
|
|
2070
2070
|
validatorFormula(e, t, r) {
|
|
2071
2071
|
var u;
|
|
2072
|
-
const i = S(e.formula1), s = (u = e.formula1) != null ? u : "", l = this._lexerTreeBuilder.checkIfAddBracket(s) === 0 && s.startsWith(
|
|
2072
|
+
const i = S(e.formula1), s = (u = e.formula1) != null ? u : "", l = this._lexerTreeBuilder.checkIfAddBracket(s) === 0 && s.startsWith(Wt.EQUALS);
|
|
2073
2073
|
return {
|
|
2074
2074
|
success: i && l,
|
|
2075
2075
|
formula1: i && l ? "" : this.localeService.t("dataValidation.validFail.formula")
|
|
@@ -2186,11 +2186,11 @@ let we = class extends Ft {
|
|
|
2186
2186
|
_registerValidators() {
|
|
2187
2187
|
[
|
|
2188
2188
|
wa,
|
|
2189
|
-
na,
|
|
2190
|
-
Da,
|
|
2191
|
-
ca,
|
|
2192
2189
|
sa,
|
|
2193
|
-
|
|
2190
|
+
Da,
|
|
2191
|
+
da,
|
|
2192
|
+
oa,
|
|
2193
|
+
aa,
|
|
2194
2194
|
gt,
|
|
2195
2195
|
Ia,
|
|
2196
2196
|
Aa
|
|
@@ -2203,7 +2203,7 @@ let we = class extends Ft {
|
|
|
2203
2203
|
this._sheetInterceptorService.interceptCommand({
|
|
2204
2204
|
getMutations: (o) => {
|
|
2205
2205
|
var a;
|
|
2206
|
-
if (o.id ===
|
|
2206
|
+
if (o.id === qt.id) {
|
|
2207
2207
|
const e = this._univerInstanceService.getCurrentUnitForType(C.UNIVER_SHEET), t = e.getUnitId(), r = e.getActiveSheet();
|
|
2208
2208
|
if (!r)
|
|
2209
2209
|
throw new Error("No active sheet found");
|
|
@@ -2227,8 +2227,8 @@ we = ba([
|
|
|
2227
2227
|
te(0, w),
|
|
2228
2228
|
te(1, R(q)),
|
|
2229
2229
|
te(2, R(Ge)),
|
|
2230
|
-
te(3, R(
|
|
2231
|
-
te(4, R(
|
|
2230
|
+
te(3, R(dt)),
|
|
2231
|
+
te(4, R(ut)),
|
|
2232
2232
|
te(5, R(F))
|
|
2233
2233
|
], we);
|
|
2234
2234
|
var La = Object.getOwnPropertyDescriptor, Ua = (o, a, e, t) => {
|
|
@@ -2257,7 +2257,7 @@ let Ae = class extends W {
|
|
|
2257
2257
|
});
|
|
2258
2258
|
});
|
|
2259
2259
|
};
|
|
2260
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(
|
|
2260
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Gt(() => this._lifecycleService.lifecycle$.pipe(Je((a) => a === Ze.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Je(() => this._lifecycleService.stage >= Ze.Rendered), Ot(20)).subscribe(o));
|
|
2261
2261
|
}
|
|
2262
2262
|
async _validatorByCell(o, a, e, t) {
|
|
2263
2263
|
const r = o.getUnitId(), i = a.getSheetId();
|
|
@@ -2348,7 +2348,7 @@ let Ie = class extends It {
|
|
|
2348
2348
|
rt,
|
|
2349
2349
|
this._config
|
|
2350
2350
|
);
|
|
2351
|
-
this._configService.setConfig(
|
|
2351
|
+
this._configService.setConfig(Va, r);
|
|
2352
2352
|
}
|
|
2353
2353
|
onStarting() {
|
|
2354
2354
|
[
|
|
@@ -2358,32 +2358,32 @@ let Ie = class extends It {
|
|
|
2358
2358
|
[Ae],
|
|
2359
2359
|
[F],
|
|
2360
2360
|
[we],
|
|
2361
|
-
[
|
|
2361
|
+
[Te],
|
|
2362
2362
|
[Oe],
|
|
2363
2363
|
[Ce],
|
|
2364
|
-
[
|
|
2364
|
+
[Fe]
|
|
2365
2365
|
].forEach((o) => {
|
|
2366
2366
|
this._injector.add(o);
|
|
2367
2367
|
}), [
|
|
2368
|
-
ma,
|
|
2369
2368
|
ha,
|
|
2369
|
+
ca,
|
|
2370
|
+
ma,
|
|
2370
2371
|
ga,
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
pa
|
|
2372
|
+
va,
|
|
2373
|
+
pa,
|
|
2374
|
+
_a
|
|
2375
2375
|
].forEach((o) => {
|
|
2376
2376
|
this._commandService.registerCommand(o);
|
|
2377
|
-
}), this._injector.get(Q), this._injector.get(Ae), this._injector.get(we), this._injector.get(
|
|
2377
|
+
}), this._injector.get(Q), this._injector.get(Ae), this._injector.get(we), this._injector.get(Fe), this._injector.get(Ce);
|
|
2378
2378
|
}
|
|
2379
2379
|
onReady() {
|
|
2380
2380
|
this._injector.get(Oe);
|
|
2381
2381
|
}
|
|
2382
2382
|
onRendered() {
|
|
2383
|
-
this._injector.get(
|
|
2383
|
+
this._injector.get(Te);
|
|
2384
2384
|
}
|
|
2385
2385
|
};
|
|
2386
|
-
ft(Ie, "pluginName",
|
|
2386
|
+
ft(Ie, "pluginName", Ra);
|
|
2387
2387
|
ft(Ie, "type", C.UNIVER_SHEET);
|
|
2388
2388
|
Ie = Pa([
|
|
2389
2389
|
wt(Ut),
|
|
@@ -2392,7 +2392,7 @@ Ie = Pa([
|
|
|
2392
2392
|
je(3, At)
|
|
2393
2393
|
], Ie);
|
|
2394
2394
|
function Ka(o) {
|
|
2395
|
-
const e = o.get(
|
|
2395
|
+
const e = o.get(dt).getCurrentSelections().map((i) => i.range);
|
|
2396
2396
|
return {
|
|
2397
2397
|
uid: E.generateRandomId(6),
|
|
2398
2398
|
type: T.DECIMAL,
|
|
@@ -2403,31 +2403,31 @@ function Ka(o) {
|
|
|
2403
2403
|
}
|
|
2404
2404
|
const za = "data-validation.custom-formula-input", Za = "data-validation.formula-input", Ja = "data-validation.list-formula-input", er = "data-validation.checkbox-formula-input";
|
|
2405
2405
|
export {
|
|
2406
|
-
|
|
2406
|
+
ha as AddSheetDataValidationCommand,
|
|
2407
2407
|
Za as BASE_FORMULA_INPUT_NAME,
|
|
2408
2408
|
Ee as CHECKBOX_FORMULA_1,
|
|
2409
2409
|
Ve as CHECKBOX_FORMULA_2,
|
|
2410
2410
|
er as CHECKBOX_FORMULA_INPUT_NAME,
|
|
2411
2411
|
za as CUSTOM_FORMULA_INPUT_NAME,
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2412
|
+
aa as CheckboxValidator,
|
|
2413
|
+
_a as ClearRangeDataValidationCommand,
|
|
2414
|
+
Ra as DATA_VALIDATION_PLUGIN_NAME,
|
|
2415
2415
|
Q as DataValidationCacheService,
|
|
2416
2416
|
P as DataValidationCustomFormulaService,
|
|
2417
|
-
|
|
2417
|
+
Te as DataValidationFormulaController,
|
|
2418
2418
|
K as DataValidationFormulaService,
|
|
2419
|
-
|
|
2419
|
+
oa as DateValidator,
|
|
2420
2420
|
Ja as LIST_FORMULA_INPUT_NAME,
|
|
2421
2421
|
Ia as ListMultipleValidator,
|
|
2422
2422
|
gt as ListValidator,
|
|
2423
|
-
|
|
2424
|
-
|
|
2423
|
+
pa as RemoveSheetAllDataValidationCommand,
|
|
2424
|
+
va as RemoveSheetDataValidationCommand,
|
|
2425
2425
|
F as SheetDataValidationModel,
|
|
2426
2426
|
Ae as SheetsDataValidationValidatorService,
|
|
2427
2427
|
Ie as UniverSheetsDataValidationPlugin,
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2428
|
+
ga as UpdateSheetDataValidationOptionsCommand,
|
|
2429
|
+
ca as UpdateSheetDataValidationRangeCommand,
|
|
2430
|
+
ma as UpdateSheetDataValidationSettingCommand,
|
|
2431
2431
|
Ka as createDefaultNewRule,
|
|
2432
2432
|
fe as deserializeListOptions,
|
|
2433
2433
|
ye as getCellValueNumber,
|