@univerjs/sheets-data-validation 0.9.2 → 0.9.3
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 +42 -42
- package/lib/index.js +42 -42
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/es/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (o, 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
|
|
1
|
+
var Rt = Object.defineProperty;
|
|
2
|
+
var St = (o, a, e) => a in o ? Rt(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
|
+
var m = (o, a, e) => St(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 Et, RBush as Vt, debounce as Mt, 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 yt, generateRandomId as st, 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 { ERROR_TYPE_SET as Bt, LexerTreeBuilder as Y, isReferenceString as
|
|
7
|
-
import { SetRangeValuesMutation as se, RemoveSheetMutation as
|
|
6
|
+
import { ERROR_TYPE_SET as Bt, LexerTreeBuilder as Y, isReferenceString as nt, sequenceNodeType as xt, deserializeRangeWithSheet as Ht, deserializeRangeWithSheetWithCache as Pt, operatorToken as Wt } from "@univerjs/engine-formula";
|
|
7
|
+
import { SetRangeValuesMutation as se, RemoveSheetMutation as lt, getSheetCommandTarget as Xe, SetRangeValuesUndoMutationFactory as ut, WorksheetViewPermission as $t, RefRangeService as kt, handleCommonDefaultRangeChangeWithEffectRefCommands as jt, SheetInterceptorService as dt, RemoveSheetCommand as Qt, SheetsSelectionsService as ct, ClearSelectionAllCommand as qt } from "@univerjs/sheets";
|
|
8
8
|
import { Subject as Qe, bufferWhen as Gt, filter as Je } from "rxjs";
|
|
9
|
-
import { RegisterOtherFormulaService as
|
|
9
|
+
import { RegisterOtherFormulaService as ht, FormulaRefRangeService as mt } from "@univerjs/sheets-formula";
|
|
10
10
|
var Yt = Object.getOwnPropertyDescriptor, Xt = (o, a, e, t) => {
|
|
11
11
|
for (var r = t > 1 ? void 0 : t ? Yt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
12
12
|
(s = o[i]) && (r = s(r) || r);
|
|
@@ -35,7 +35,7 @@ let Q = class extends W {
|
|
|
35
35
|
_initSheetRemove() {
|
|
36
36
|
this.disposeWithMe(this._commandService.onCommandExecuted((a) => {
|
|
37
37
|
var e;
|
|
38
|
-
if (a.id ===
|
|
38
|
+
if (a.id === lt.id) {
|
|
39
39
|
const { unitId: t, subUnitId: r } = a.params;
|
|
40
40
|
(e = this._cacheMatrix.get(t)) == null || e.delete(r);
|
|
41
41
|
}
|
|
@@ -231,7 +231,7 @@ let P = class extends W {
|
|
|
231
231
|
};
|
|
232
232
|
P = zt([
|
|
233
233
|
re(0, w),
|
|
234
|
-
re(1, R(
|
|
234
|
+
re(1, R(ht)),
|
|
235
235
|
re(2, R(Ye)),
|
|
236
236
|
re(3, R(Q)),
|
|
237
237
|
re(4, R(q))
|
|
@@ -323,22 +323,22 @@ let K = class extends W {
|
|
|
323
323
|
};
|
|
324
324
|
K = Jt([
|
|
325
325
|
ie(0, w),
|
|
326
|
-
ie(1, R(
|
|
326
|
+
ie(1, R(ht)),
|
|
327
327
|
ie(2, R(Q)),
|
|
328
328
|
ie(3, R(Ye)),
|
|
329
329
|
ie(4, R(q))
|
|
330
330
|
], K);
|
|
331
331
|
function ne(o) {
|
|
332
|
-
return
|
|
332
|
+
return Et(o);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function gt(o) {
|
|
335
335
|
var a;
|
|
336
336
|
return String((a = ne(o)) != null ? a : "");
|
|
337
337
|
}
|
|
338
338
|
class Ke {
|
|
339
339
|
constructor(a, e, t, r, i = !1) {
|
|
340
340
|
m(this, "_map");
|
|
341
|
-
m(this, "_tree", new
|
|
341
|
+
m(this, "_tree", new Vt());
|
|
342
342
|
m(this, "_dirty", !0);
|
|
343
343
|
m(this, "_buildTree", () => {
|
|
344
344
|
if (!this._dirty || this._disableTree)
|
|
@@ -357,7 +357,7 @@ class Ke {
|
|
|
357
357
|
});
|
|
358
358
|
}), this._tree.load(a), this._dirty = !1;
|
|
359
359
|
});
|
|
360
|
-
m(this, "_debonceBuildTree",
|
|
360
|
+
m(this, "_debonceBuildTree", Mt(this._buildTree, 0));
|
|
361
361
|
this._unitId = e, this._subUnitId = t, this._univerInstanceService = r, this._disableTree = i, this._map = a, this._buildTree();
|
|
362
362
|
}
|
|
363
363
|
get _worksheet() {
|
|
@@ -500,7 +500,7 @@ let F = class extends W {
|
|
|
500
500
|
})
|
|
501
501
|
), this.disposeWithMe(
|
|
502
502
|
this._commandService.onCommandExecuted((a) => {
|
|
503
|
-
if (a.id ===
|
|
503
|
+
if (a.id === lt.id) {
|
|
504
504
|
const { unitId: e, subUnitId: t } = a.params, r = this._ruleMatrixMap.get(e);
|
|
505
505
|
r && r.delete(t);
|
|
506
506
|
}
|
|
@@ -987,21 +987,21 @@ const na = [
|
|
|
987
987
|
"offset"
|
|
988
988
|
];
|
|
989
989
|
function la(o, a) {
|
|
990
|
-
if (!S(o) ||
|
|
990
|
+
if (!S(o) || nt(o.slice(1)))
|
|
991
991
|
return !0;
|
|
992
992
|
const t = a.sequenceNodesBuilder(o);
|
|
993
993
|
return t && t.some((r) => typeof r == "object" && r.nodeType === xt.FUNCTION && na.indexOf(r.token.toLowerCase()) > -1);
|
|
994
994
|
}
|
|
995
995
|
function ua(o, a) {
|
|
996
996
|
const { formula1: e = "", ranges: t } = o;
|
|
997
|
-
if (
|
|
997
|
+
if (nt(e.slice(1))) {
|
|
998
998
|
const i = Ht(e.slice(1));
|
|
999
999
|
if ((!i.sheetName || i.sheetName === a) && t.some((s) => I.intersects(s, i.range)))
|
|
1000
1000
|
return !0;
|
|
1001
1001
|
}
|
|
1002
1002
|
return !1;
|
|
1003
1003
|
}
|
|
1004
|
-
class
|
|
1004
|
+
class _t extends G {
|
|
1005
1005
|
constructor() {
|
|
1006
1006
|
super(...arguments);
|
|
1007
1007
|
m(this, "formulaService", this.injector.get(K));
|
|
@@ -1160,7 +1160,7 @@ class da extends G {
|
|
|
1160
1160
|
return `${this.localeService.t(Nt[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1163
|
+
function pt(o) {
|
|
1164
1164
|
var e, t;
|
|
1165
1165
|
return o ? o.p ? !((t = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() : E.isBlank(o.v) : !0;
|
|
1166
1166
|
}
|
|
@@ -1176,8 +1176,8 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1176
1176
|
function V(f, A) {
|
|
1177
1177
|
i && f.forEach(($) => {
|
|
1178
1178
|
b.foreach($, (B, k) => {
|
|
1179
|
-
const x = p.getCellRaw(B, k), J =
|
|
1180
|
-
(
|
|
1179
|
+
const x = p.getCellRaw(B, k), J = gt(x);
|
|
1180
|
+
(pt(x) || J === A) && !(x != null && x.p) && (v = !0, _.setValue(B, k, {
|
|
1181
1181
|
v: A,
|
|
1182
1182
|
p: null
|
|
1183
1183
|
}));
|
|
@@ -1331,7 +1331,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1331
1331
|
}
|
|
1332
1332
|
}, A = {
|
|
1333
1333
|
id: se.id,
|
|
1334
|
-
params:
|
|
1334
|
+
params: ut(t, f.params)
|
|
1335
1335
|
};
|
|
1336
1336
|
l.push(f), u.push(A);
|
|
1337
1337
|
}
|
|
@@ -1439,8 +1439,8 @@ const ca = {
|
|
|
1439
1439
|
let Ue = !1;
|
|
1440
1440
|
if (A.forEach((ge) => {
|
|
1441
1441
|
b.foreach(ge, (ae, Be) => {
|
|
1442
|
-
const j = x.getCellRaw(ae, Be), ze =
|
|
1443
|
-
(
|
|
1442
|
+
const j = x.getCellRaw(ae, Be), ze = gt(j);
|
|
1443
|
+
(pt(j) || ze === String(J)) && !(j != null && j.p) ? (k.setValue(ae, Be, {
|
|
1444
1444
|
v: he,
|
|
1445
1445
|
p: null
|
|
1446
1446
|
}), Ue = !0) : ze === String(ce) && !(j != null && j.p) && (k.setValue(ae, Be, {
|
|
@@ -1458,7 +1458,7 @@ const ca = {
|
|
|
1458
1458
|
}
|
|
1459
1459
|
}, ae = {
|
|
1460
1460
|
id: se.id,
|
|
1461
|
-
params:
|
|
1461
|
+
params: ut(o, ge.params)
|
|
1462
1462
|
};
|
|
1463
1463
|
_.push(ge), V.push(ae);
|
|
1464
1464
|
}
|
|
@@ -1604,7 +1604,7 @@ const ca = {
|
|
|
1604
1604
|
}), i.executeCommand(D.id, a), !0;
|
|
1605
1605
|
}
|
|
1606
1606
|
}, Ra = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
1607
|
-
var
|
|
1607
|
+
var ft = /* @__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))(ft || {}), Sa = Object.getOwnPropertyDescriptor, Ea = (o, a, e, t) => {
|
|
1608
1608
|
for (var r = t > 1 ? void 0 : t ? Sa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1609
1609
|
(s = o[i]) && (r = s(r) || r);
|
|
1610
1610
|
return r;
|
|
@@ -1637,7 +1637,7 @@ let Te = class extends W {
|
|
|
1637
1637
|
for (let v = c; v <= g; v++)
|
|
1638
1638
|
for (let V = p; V <= _; V++) {
|
|
1639
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[
|
|
1640
|
+
if ((f == null ? void 0 : f[ft.View]) === !1)
|
|
1641
1641
|
return !1;
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
|
@@ -1646,7 +1646,7 @@ let Te = class extends W {
|
|
|
1646
1646
|
};
|
|
1647
1647
|
Te = Ea([
|
|
1648
1648
|
We(0, w),
|
|
1649
|
-
We(1,
|
|
1649
|
+
We(1, yt),
|
|
1650
1650
|
We(2, R(Y))
|
|
1651
1651
|
], Te);
|
|
1652
1652
|
const Va = "sheets-data-validation.config", rt = {};
|
|
@@ -1726,7 +1726,7 @@ let Fe = class extends W {
|
|
|
1726
1726
|
}
|
|
1727
1727
|
});
|
|
1728
1728
|
for (let p = 1; p < u.length; p++) {
|
|
1729
|
-
const _ = u[p], v =
|
|
1729
|
+
const _ = u[p], v = st();
|
|
1730
1730
|
d.push({
|
|
1731
1731
|
id: L.id,
|
|
1732
1732
|
params: {
|
|
@@ -1794,7 +1794,7 @@ let Fe = class extends W {
|
|
|
1794
1794
|
};
|
|
1795
1795
|
Fe = ya([
|
|
1796
1796
|
$e(0, R(F)),
|
|
1797
|
-
$e(1, R(
|
|
1797
|
+
$e(1, R(mt)),
|
|
1798
1798
|
$e(2, R(q))
|
|
1799
1799
|
], Fe);
|
|
1800
1800
|
var Ta = Object.getOwnPropertyDescriptor, Fa = (o, a, e, t) => {
|
|
@@ -1967,7 +1967,7 @@ Ce = Fa([
|
|
|
1967
1967
|
ee(1, R(Ge)),
|
|
1968
1968
|
ee(2, R(kt)),
|
|
1969
1969
|
ee(3, R(K)),
|
|
1970
|
-
ee(4, R(
|
|
1970
|
+
ee(4, R(mt)),
|
|
1971
1971
|
ee(5, R(q))
|
|
1972
1972
|
], Ce);
|
|
1973
1973
|
var Ca = Object.getOwnPropertyDescriptor, Oa = (o, a, e, t) => {
|
|
@@ -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(dt)),
|
|
2027
2027
|
ke(1, R(w)),
|
|
2028
2028
|
ke(2, R(F))
|
|
2029
2029
|
], Oe);
|
|
@@ -2094,7 +2094,7 @@ class Aa extends G {
|
|
|
2094
2094
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2095
2095
|
}
|
|
2096
2096
|
}
|
|
2097
|
-
class Ia extends
|
|
2097
|
+
class Ia extends _t {
|
|
2098
2098
|
constructor() {
|
|
2099
2099
|
super(...arguments);
|
|
2100
2100
|
m(this, "id", T.LIST_MULTIPLE);
|
|
@@ -2191,7 +2191,7 @@ let we = class extends Ft {
|
|
|
2191
2191
|
da,
|
|
2192
2192
|
oa,
|
|
2193
2193
|
aa,
|
|
2194
|
-
|
|
2194
|
+
_t,
|
|
2195
2195
|
Ia,
|
|
2196
2196
|
Aa
|
|
2197
2197
|
].forEach((o) => {
|
|
@@ -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(ct)),
|
|
2231
|
+
te(4, R(dt)),
|
|
2232
2232
|
te(5, R(F))
|
|
2233
2233
|
], we);
|
|
2234
2234
|
var La = Object.getOwnPropertyDescriptor, Ua = (o, a, e, t) => {
|
|
@@ -2339,7 +2339,7 @@ var Ba = Object.defineProperty, xa = Object.getOwnPropertyDescriptor, Ha = (o, a
|
|
|
2339
2339
|
for (var r = t > 1 ? void 0 : t ? xa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2340
2340
|
(s = o[i]) && (r = s(r) || r);
|
|
2341
2341
|
return r;
|
|
2342
|
-
}, je = (o, a) => (e, t) => a(e, t, o),
|
|
2342
|
+
}, je = (o, a) => (e, t) => a(e, t, o), vt = (o, a, e) => Ha(o, typeof a != "symbol" ? a + "" : a, e);
|
|
2343
2343
|
let Ie = class extends It {
|
|
2344
2344
|
constructor(o = rt, a, e, t) {
|
|
2345
2345
|
super(), this._config = o, this._injector = a, this._commandService = e, this._configService = t;
|
|
@@ -2383,8 +2383,8 @@ let Ie = class extends It {
|
|
|
2383
2383
|
this._injector.get(Te);
|
|
2384
2384
|
}
|
|
2385
2385
|
};
|
|
2386
|
-
|
|
2387
|
-
|
|
2386
|
+
vt(Ie, "pluginName", Ra);
|
|
2387
|
+
vt(Ie, "type", C.UNIVER_SHEET);
|
|
2388
2388
|
Ie = Pa([
|
|
2389
2389
|
wt(Ut),
|
|
2390
2390
|
je(1, R(Ge)),
|
|
@@ -2392,9 +2392,9 @@ 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(ct).getCurrentSelections().map((i) => i.range);
|
|
2396
2396
|
return {
|
|
2397
|
-
uid:
|
|
2397
|
+
uid: st(6),
|
|
2398
2398
|
type: T.DECIMAL,
|
|
2399
2399
|
operator: h.EQUAL,
|
|
2400
2400
|
formula1: "100",
|
|
@@ -2419,7 +2419,7 @@ export {
|
|
|
2419
2419
|
oa as DateValidator,
|
|
2420
2420
|
Ja as LIST_FORMULA_INPUT_NAME,
|
|
2421
2421
|
Ia as ListMultipleValidator,
|
|
2422
|
-
|
|
2422
|
+
_t as ListValidator,
|
|
2423
2423
|
pa as RemoveSheetAllDataValidationCommand,
|
|
2424
2424
|
va as RemoveSheetDataValidationCommand,
|
|
2425
2425
|
F as SheetDataValidationModel,
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (o, 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
|
|
1
|
+
var Rt = Object.defineProperty;
|
|
2
|
+
var St = (o, a, e) => a in o ? Rt(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
|
+
var m = (o, a, e) => St(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 Et, RBush as Vt, debounce as Mt, 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 yt, generateRandomId as st, 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 { ERROR_TYPE_SET as Bt, LexerTreeBuilder as Y, isReferenceString as
|
|
7
|
-
import { SetRangeValuesMutation as se, RemoveSheetMutation as
|
|
6
|
+
import { ERROR_TYPE_SET as Bt, LexerTreeBuilder as Y, isReferenceString as nt, sequenceNodeType as xt, deserializeRangeWithSheet as Ht, deserializeRangeWithSheetWithCache as Pt, operatorToken as Wt } from "@univerjs/engine-formula";
|
|
7
|
+
import { SetRangeValuesMutation as se, RemoveSheetMutation as lt, getSheetCommandTarget as Xe, SetRangeValuesUndoMutationFactory as ut, WorksheetViewPermission as $t, RefRangeService as kt, handleCommonDefaultRangeChangeWithEffectRefCommands as jt, SheetInterceptorService as dt, RemoveSheetCommand as Qt, SheetsSelectionsService as ct, ClearSelectionAllCommand as qt } from "@univerjs/sheets";
|
|
8
8
|
import { Subject as Qe, bufferWhen as Gt, filter as Je } from "rxjs";
|
|
9
|
-
import { RegisterOtherFormulaService as
|
|
9
|
+
import { RegisterOtherFormulaService as ht, FormulaRefRangeService as mt } from "@univerjs/sheets-formula";
|
|
10
10
|
var Yt = Object.getOwnPropertyDescriptor, Xt = (o, a, e, t) => {
|
|
11
11
|
for (var r = t > 1 ? void 0 : t ? Yt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
12
12
|
(s = o[i]) && (r = s(r) || r);
|
|
@@ -35,7 +35,7 @@ let Q = class extends W {
|
|
|
35
35
|
_initSheetRemove() {
|
|
36
36
|
this.disposeWithMe(this._commandService.onCommandExecuted((a) => {
|
|
37
37
|
var e;
|
|
38
|
-
if (a.id ===
|
|
38
|
+
if (a.id === lt.id) {
|
|
39
39
|
const { unitId: t, subUnitId: r } = a.params;
|
|
40
40
|
(e = this._cacheMatrix.get(t)) == null || e.delete(r);
|
|
41
41
|
}
|
|
@@ -231,7 +231,7 @@ let P = class extends W {
|
|
|
231
231
|
};
|
|
232
232
|
P = zt([
|
|
233
233
|
re(0, w),
|
|
234
|
-
re(1, R(
|
|
234
|
+
re(1, R(ht)),
|
|
235
235
|
re(2, R(Ye)),
|
|
236
236
|
re(3, R(Q)),
|
|
237
237
|
re(4, R(q))
|
|
@@ -323,22 +323,22 @@ let K = class extends W {
|
|
|
323
323
|
};
|
|
324
324
|
K = Jt([
|
|
325
325
|
ie(0, w),
|
|
326
|
-
ie(1, R(
|
|
326
|
+
ie(1, R(ht)),
|
|
327
327
|
ie(2, R(Q)),
|
|
328
328
|
ie(3, R(Ye)),
|
|
329
329
|
ie(4, R(q))
|
|
330
330
|
], K);
|
|
331
331
|
function ne(o) {
|
|
332
|
-
return
|
|
332
|
+
return Et(o);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function gt(o) {
|
|
335
335
|
var a;
|
|
336
336
|
return String((a = ne(o)) != null ? a : "");
|
|
337
337
|
}
|
|
338
338
|
class Ke {
|
|
339
339
|
constructor(a, e, t, r, i = !1) {
|
|
340
340
|
m(this, "_map");
|
|
341
|
-
m(this, "_tree", new
|
|
341
|
+
m(this, "_tree", new Vt());
|
|
342
342
|
m(this, "_dirty", !0);
|
|
343
343
|
m(this, "_buildTree", () => {
|
|
344
344
|
if (!this._dirty || this._disableTree)
|
|
@@ -357,7 +357,7 @@ class Ke {
|
|
|
357
357
|
});
|
|
358
358
|
}), this._tree.load(a), this._dirty = !1;
|
|
359
359
|
});
|
|
360
|
-
m(this, "_debonceBuildTree",
|
|
360
|
+
m(this, "_debonceBuildTree", Mt(this._buildTree, 0));
|
|
361
361
|
this._unitId = e, this._subUnitId = t, this._univerInstanceService = r, this._disableTree = i, this._map = a, this._buildTree();
|
|
362
362
|
}
|
|
363
363
|
get _worksheet() {
|
|
@@ -500,7 +500,7 @@ let F = class extends W {
|
|
|
500
500
|
})
|
|
501
501
|
), this.disposeWithMe(
|
|
502
502
|
this._commandService.onCommandExecuted((a) => {
|
|
503
|
-
if (a.id ===
|
|
503
|
+
if (a.id === lt.id) {
|
|
504
504
|
const { unitId: e, subUnitId: t } = a.params, r = this._ruleMatrixMap.get(e);
|
|
505
505
|
r && r.delete(t);
|
|
506
506
|
}
|
|
@@ -987,21 +987,21 @@ const na = [
|
|
|
987
987
|
"offset"
|
|
988
988
|
];
|
|
989
989
|
function la(o, a) {
|
|
990
|
-
if (!S(o) ||
|
|
990
|
+
if (!S(o) || nt(o.slice(1)))
|
|
991
991
|
return !0;
|
|
992
992
|
const t = a.sequenceNodesBuilder(o);
|
|
993
993
|
return t && t.some((r) => typeof r == "object" && r.nodeType === xt.FUNCTION && na.indexOf(r.token.toLowerCase()) > -1);
|
|
994
994
|
}
|
|
995
995
|
function ua(o, a) {
|
|
996
996
|
const { formula1: e = "", ranges: t } = o;
|
|
997
|
-
if (
|
|
997
|
+
if (nt(e.slice(1))) {
|
|
998
998
|
const i = Ht(e.slice(1));
|
|
999
999
|
if ((!i.sheetName || i.sheetName === a) && t.some((s) => I.intersects(s, i.range)))
|
|
1000
1000
|
return !0;
|
|
1001
1001
|
}
|
|
1002
1002
|
return !1;
|
|
1003
1003
|
}
|
|
1004
|
-
class
|
|
1004
|
+
class _t extends G {
|
|
1005
1005
|
constructor() {
|
|
1006
1006
|
super(...arguments);
|
|
1007
1007
|
m(this, "formulaService", this.injector.get(K));
|
|
@@ -1160,7 +1160,7 @@ class da extends G {
|
|
|
1160
1160
|
return `${this.localeService.t(Nt[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1163
|
+
function pt(o) {
|
|
1164
1164
|
var e, t;
|
|
1165
1165
|
return o ? o.p ? !((t = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() : E.isBlank(o.v) : !0;
|
|
1166
1166
|
}
|
|
@@ -1176,8 +1176,8 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1176
1176
|
function V(f, A) {
|
|
1177
1177
|
i && f.forEach(($) => {
|
|
1178
1178
|
b.foreach($, (B, k) => {
|
|
1179
|
-
const x = p.getCellRaw(B, k), J =
|
|
1180
|
-
(
|
|
1179
|
+
const x = p.getCellRaw(B, k), J = gt(x);
|
|
1180
|
+
(pt(x) || J === A) && !(x != null && x.p) && (v = !0, _.setValue(B, k, {
|
|
1181
1181
|
v: A,
|
|
1182
1182
|
p: null
|
|
1183
1183
|
}));
|
|
@@ -1331,7 +1331,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1331
1331
|
}
|
|
1332
1332
|
}, A = {
|
|
1333
1333
|
id: se.id,
|
|
1334
|
-
params:
|
|
1334
|
+
params: ut(t, f.params)
|
|
1335
1335
|
};
|
|
1336
1336
|
l.push(f), u.push(A);
|
|
1337
1337
|
}
|
|
@@ -1439,8 +1439,8 @@ const ca = {
|
|
|
1439
1439
|
let Ue = !1;
|
|
1440
1440
|
if (A.forEach((ge) => {
|
|
1441
1441
|
b.foreach(ge, (ae, Be) => {
|
|
1442
|
-
const j = x.getCellRaw(ae, Be), ze =
|
|
1443
|
-
(
|
|
1442
|
+
const j = x.getCellRaw(ae, Be), ze = gt(j);
|
|
1443
|
+
(pt(j) || ze === String(J)) && !(j != null && j.p) ? (k.setValue(ae, Be, {
|
|
1444
1444
|
v: he,
|
|
1445
1445
|
p: null
|
|
1446
1446
|
}), Ue = !0) : ze === String(ce) && !(j != null && j.p) && (k.setValue(ae, Be, {
|
|
@@ -1458,7 +1458,7 @@ const ca = {
|
|
|
1458
1458
|
}
|
|
1459
1459
|
}, ae = {
|
|
1460
1460
|
id: se.id,
|
|
1461
|
-
params:
|
|
1461
|
+
params: ut(o, ge.params)
|
|
1462
1462
|
};
|
|
1463
1463
|
_.push(ge), V.push(ae);
|
|
1464
1464
|
}
|
|
@@ -1604,7 +1604,7 @@ const ca = {
|
|
|
1604
1604
|
}), i.executeCommand(D.id, a), !0;
|
|
1605
1605
|
}
|
|
1606
1606
|
}, Ra = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
1607
|
-
var
|
|
1607
|
+
var ft = /* @__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))(ft || {}), Sa = Object.getOwnPropertyDescriptor, Ea = (o, a, e, t) => {
|
|
1608
1608
|
for (var r = t > 1 ? void 0 : t ? Sa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1609
1609
|
(s = o[i]) && (r = s(r) || r);
|
|
1610
1610
|
return r;
|
|
@@ -1637,7 +1637,7 @@ let Te = class extends W {
|
|
|
1637
1637
|
for (let v = c; v <= g; v++)
|
|
1638
1638
|
for (let V = p; V <= _; V++) {
|
|
1639
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[
|
|
1640
|
+
if ((f == null ? void 0 : f[ft.View]) === !1)
|
|
1641
1641
|
return !1;
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
|
@@ -1646,7 +1646,7 @@ let Te = class extends W {
|
|
|
1646
1646
|
};
|
|
1647
1647
|
Te = Ea([
|
|
1648
1648
|
We(0, w),
|
|
1649
|
-
We(1,
|
|
1649
|
+
We(1, yt),
|
|
1650
1650
|
We(2, R(Y))
|
|
1651
1651
|
], Te);
|
|
1652
1652
|
const Va = "sheets-data-validation.config", rt = {};
|
|
@@ -1726,7 +1726,7 @@ let Fe = class extends W {
|
|
|
1726
1726
|
}
|
|
1727
1727
|
});
|
|
1728
1728
|
for (let p = 1; p < u.length; p++) {
|
|
1729
|
-
const _ = u[p], v =
|
|
1729
|
+
const _ = u[p], v = st();
|
|
1730
1730
|
d.push({
|
|
1731
1731
|
id: L.id,
|
|
1732
1732
|
params: {
|
|
@@ -1794,7 +1794,7 @@ let Fe = class extends W {
|
|
|
1794
1794
|
};
|
|
1795
1795
|
Fe = ya([
|
|
1796
1796
|
$e(0, R(F)),
|
|
1797
|
-
$e(1, R(
|
|
1797
|
+
$e(1, R(mt)),
|
|
1798
1798
|
$e(2, R(q))
|
|
1799
1799
|
], Fe);
|
|
1800
1800
|
var Ta = Object.getOwnPropertyDescriptor, Fa = (o, a, e, t) => {
|
|
@@ -1967,7 +1967,7 @@ Ce = Fa([
|
|
|
1967
1967
|
ee(1, R(Ge)),
|
|
1968
1968
|
ee(2, R(kt)),
|
|
1969
1969
|
ee(3, R(K)),
|
|
1970
|
-
ee(4, R(
|
|
1970
|
+
ee(4, R(mt)),
|
|
1971
1971
|
ee(5, R(q))
|
|
1972
1972
|
], Ce);
|
|
1973
1973
|
var Ca = Object.getOwnPropertyDescriptor, Oa = (o, a, e, t) => {
|
|
@@ -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(dt)),
|
|
2027
2027
|
ke(1, R(w)),
|
|
2028
2028
|
ke(2, R(F))
|
|
2029
2029
|
], Oe);
|
|
@@ -2094,7 +2094,7 @@ class Aa extends G {
|
|
|
2094
2094
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2095
2095
|
}
|
|
2096
2096
|
}
|
|
2097
|
-
class Ia extends
|
|
2097
|
+
class Ia extends _t {
|
|
2098
2098
|
constructor() {
|
|
2099
2099
|
super(...arguments);
|
|
2100
2100
|
m(this, "id", T.LIST_MULTIPLE);
|
|
@@ -2191,7 +2191,7 @@ let we = class extends Ft {
|
|
|
2191
2191
|
da,
|
|
2192
2192
|
oa,
|
|
2193
2193
|
aa,
|
|
2194
|
-
|
|
2194
|
+
_t,
|
|
2195
2195
|
Ia,
|
|
2196
2196
|
Aa
|
|
2197
2197
|
].forEach((o) => {
|
|
@@ -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(ct)),
|
|
2231
|
+
te(4, R(dt)),
|
|
2232
2232
|
te(5, R(F))
|
|
2233
2233
|
], we);
|
|
2234
2234
|
var La = Object.getOwnPropertyDescriptor, Ua = (o, a, e, t) => {
|
|
@@ -2339,7 +2339,7 @@ var Ba = Object.defineProperty, xa = Object.getOwnPropertyDescriptor, Ha = (o, a
|
|
|
2339
2339
|
for (var r = t > 1 ? void 0 : t ? xa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2340
2340
|
(s = o[i]) && (r = s(r) || r);
|
|
2341
2341
|
return r;
|
|
2342
|
-
}, je = (o, a) => (e, t) => a(e, t, o),
|
|
2342
|
+
}, je = (o, a) => (e, t) => a(e, t, o), vt = (o, a, e) => Ha(o, typeof a != "symbol" ? a + "" : a, e);
|
|
2343
2343
|
let Ie = class extends It {
|
|
2344
2344
|
constructor(o = rt, a, e, t) {
|
|
2345
2345
|
super(), this._config = o, this._injector = a, this._commandService = e, this._configService = t;
|
|
@@ -2383,8 +2383,8 @@ let Ie = class extends It {
|
|
|
2383
2383
|
this._injector.get(Te);
|
|
2384
2384
|
}
|
|
2385
2385
|
};
|
|
2386
|
-
|
|
2387
|
-
|
|
2386
|
+
vt(Ie, "pluginName", Ra);
|
|
2387
|
+
vt(Ie, "type", C.UNIVER_SHEET);
|
|
2388
2388
|
Ie = Pa([
|
|
2389
2389
|
wt(Ut),
|
|
2390
2390
|
je(1, R(Ge)),
|
|
@@ -2392,9 +2392,9 @@ 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(ct).getCurrentSelections().map((i) => i.range);
|
|
2396
2396
|
return {
|
|
2397
|
-
uid:
|
|
2397
|
+
uid: st(6),
|
|
2398
2398
|
type: T.DECIMAL,
|
|
2399
2399
|
operator: h.EQUAL,
|
|
2400
2400
|
formula1: "100",
|
|
@@ -2419,7 +2419,7 @@ export {
|
|
|
2419
2419
|
oa as DateValidator,
|
|
2420
2420
|
Ja as LIST_FORMULA_INPUT_NAME,
|
|
2421
2421
|
Ia as ListMultipleValidator,
|
|
2422
|
-
|
|
2422
|
+
_t as ListValidator,
|
|
2423
2423
|
pa as RemoveSheetAllDataValidationCommand,
|
|
2424
2424
|
va as RemoveSheetDataValidationCommand,
|
|
2425
2425
|
F as SheetDataValidationModel,
|