@univerjs/sheets-data-validation 0.1.13 → 0.1.14
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 +1235 -1223
- package/lib/types/controllers/dv-ref-range.controller.d.ts +2 -8
- package/lib/types/controllers/dv-render.controller.d.ts +10 -12
- package/lib/types/index.d.ts +2 -1
- package/lib/types/models/sheet-data-validation-manager.d.ts +2 -2
- package/lib/types/services/dropdown-manager.service.d.ts +2 -3
- package/lib/types/services/dv-validator-service.d.ts +13 -0
- package/lib/umd/index.js +2 -2
- package/package.json +39 -25
package/lib/es/index.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (o, a, e) => (
|
|
4
|
-
import { Disposable as me, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as
|
|
5
|
-
import { ICommandService as
|
|
6
|
-
import { Inject as
|
|
7
|
-
import { DataValidatorRegistryService as Ee, DataValidationModel as
|
|
8
|
-
import {
|
|
9
|
-
import { SheetCanvasPopManagerService as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import { useDependency as
|
|
14
|
-
import { FormLayout as K, RadioGroup as
|
|
15
|
-
import { serializeRange as dr, LexerTreeBuilder as
|
|
16
|
-
import { Subject as ur, filter as
|
|
17
|
-
import
|
|
18
|
-
import { RegisterOtherFormulaService as hr, FormulaRefRangeService as
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
var mr = { exports: {} }, Lt = {};
|
|
1
|
+
var $r = Object.defineProperty;
|
|
2
|
+
var Ur = (o, a, e) => a in o ? $r(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
|
+
var g = (o, a, e) => (Ur(o, typeof a != "symbol" ? a + "" : a, e), e);
|
|
4
|
+
import { Disposable as me, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Wr, DisposableCollection as qa, IUniverInstanceService as ie, UniverInstanceType as se, toDisposable as ma, CommandType as ye, ICommandService as te, IUndoRedoService as za, sequenceExecuteAsync as Qa, LocaleService as le, DataValidationErrorStyle as tt, UndoCommand as Hr, RedoCommand as kr, isUnitRangesEqual as Yr, createInternalEditorID as fa, isValidRange as Gr, debounce as Xr, shallowEqual as ya, DEFAULT_EMPTY_DOCUMENT_VALUE as Ka, OnLifecycle as ve, LifecycleStages as ge, IPermissionService as qr, isFormulaString as F, DataValidationType as q, Tools as U, ObjectMatrix as lt, Range as G, ThemeService as zr, VerticalAlign as re, HorizontalAlign as Ve, DataValidationOperator as C, WrapStrategy as pe, DataValidationRenderMode as ue, DocumentDataModel as Qr, BooleanNumber as Je, RxDisposable as Za, DataValidationStatus as Ce, sequenceExecute as Kr, isRangesEqual as Zr, Rectangle as qe, queryObjectMatrix as Lt, IResourceManagerService as Jr, DependentOn as eo, Plugin as to } from "@univerjs/core";
|
|
5
|
+
import { ICommandService as Tl, LocaleService as Nl, Plugin as Fl } from "@univerjs/core";
|
|
6
|
+
import { Inject as w, Injector as Be } from "@wendellhu/redi";
|
|
7
|
+
import { DataValidatorRegistryService as Ee, DataValidationModel as Z, AddDataValidationMutation as Kt, RemoveDataValidationMutation as It, createDefaultNewRule as Ja, UpdateDataValidationMutation as Ye, UpdateRuleType as De, DataValidatorRegistryScope as ao, TWO_FORMULA_OPERATOR_COUNT as ro, getRuleOptions as Ea, getRuleSetting as Oa, UpdateDataValidationSettingCommand as ba, RemoveDataValidationCommand as er, UpdateDataValidationOptionsCommand as oo, BaseDataValidator as $e, TextLengthErrorTitleMap as no, RemoveAllDataValidationCommand as io, removeDataValidationUndoFactory as so, DataValidationManager as lo, AddDataValidationCommand as co, UniverDataValidationPlugin as uo } from "@univerjs/data-validation";
|
|
8
|
+
import { getSheetCommandTarget as tr, WorksheetViewPermission as ho, SetRangeValuesCommand as pa, WorkbookEditablePermission as Zt, WorksheetSetCellStylePermission as Jt, WorksheetEditPermission as ea, RangeProtectionPermissionEditPoint as ta, SelectionManagerService as mo, SheetInterceptorService as ar, ClearSelectionAllCommand as fo, INTERCEPTOR_POINT as po, RefRangeService as vo, handleCommonDefaultRangeChangeWithEffectRefCommands as go, UniverSheetsPlugin as _o } from "@univerjs/sheets";
|
|
9
|
+
import { SheetCanvasPopManagerService as So, IMarkSelectionService as Ro, getCurrentRangeDisable$ as Co, IEditorBridgeService as va, AutoHeightController as Vo, SheetSkeletonManagerService as Ta, HoverManagerService as Mo, CellAlertManagerService as wo, CellAlertType as Io, IAutoFillService as Do, APPLY_TYPE as Pt, virtualizeDiscreteRanges as aa, getAutoFillRepeatRange as yo, COPY_TYPE as Na, rangeToDiscreteRange as Eo, PREDEFINED_HOOK_NAME as At, getRepeatRange as Fa, ISheetClipboardService as Oo, SheetPermissionInterceptorBaseController as bo, UniverSheetsUIPlugin as To } from "@univerjs/sheets-ui";
|
|
10
|
+
import { useObservable as Ze, ComponentManager as dt, IZenZoneService as No, ISidebarService as rr, useEvent as or, RangeSelector as Fo, TextEditor as nr, MenuItemType as ga, MenuPosition as Lo, MenuGroup as Po, getMenuHiddenObservable as Ao, KeyCode as xo, IDialogService as jo, IMenuService as Bo } from "@univerjs/ui";
|
|
11
|
+
import { IRenderManagerService as ir, fixLineWidthByScale as La, Transform as $o, Checkbox as Uo, getDocsSkeletonPageSize as mt, Rect as sr, DocumentViewModel as Wo, DocumentSkeleton as Ho, Documents as ko, FontCache as Yo, Shape as Go, getFontStyleString as Pa, DeviceInputEventType as Xo } from "@univerjs/engine-render";
|
|
12
|
+
import ra, { forwardRef as Oe, useRef as _a, createElement as be, useState as Q, useMemo as oa, useEffect as Xe } from "react";
|
|
13
|
+
import { useDependency as T } from "@wendellhu/redi/react-bindings";
|
|
14
|
+
import { FormLayout as K, RadioGroup as Sa, Radio as Pe, Checkbox as lr, Input as Ae, Select as na, Button as ze, DraggableList as qo, RectPopup as zo, Scrollbar as Qo, DatePanel as Ko } from "@univerjs/design";
|
|
15
|
+
import { serializeRange as dr, LexerTreeBuilder as Ra, deserializeRangeWithSheet as Zo, isFormulaTransformable as Jo, transformFormula as Aa, isReferenceString as cr, sequenceNodeType as en } from "@univerjs/engine-formula";
|
|
16
|
+
import { Subject as ur, filter as tn, BehaviorSubject as xa, distinctUntilChanged as an, debounceTime as rn } from "rxjs";
|
|
17
|
+
import on from "clsx";
|
|
18
|
+
import { RegisterOtherFormulaService as hr, FormulaRefRangeService as nn, SPECIAL_PASTE_FORMULA as sn } from "@univerjs/sheets-formula";
|
|
19
|
+
import xe from "dayjs";
|
|
20
|
+
var mr = { exports: {} }, Ft = {};
|
|
22
21
|
/**
|
|
23
22
|
* @license React
|
|
24
23
|
* react-jsx-runtime.production.min.js
|
|
@@ -28,24 +27,24 @@ var mr = { exports: {} }, Lt = {};
|
|
|
28
27
|
* This source code is licensed under the MIT license found in the
|
|
29
28
|
* LICENSE file in the root directory of this source tree.
|
|
30
29
|
*/
|
|
31
|
-
var
|
|
30
|
+
var ln = ra, dn = Symbol.for("react.element"), cn = Symbol.for("react.fragment"), un = Object.prototype.hasOwnProperty, hn = ln.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, mn = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
32
31
|
function fr(o, a, e) {
|
|
33
32
|
var t, r = {}, n = null, i = null;
|
|
34
33
|
e !== void 0 && (n = "" + e), a.key !== void 0 && (n = "" + a.key), a.ref !== void 0 && (i = a.ref);
|
|
35
34
|
for (t in a)
|
|
36
|
-
|
|
35
|
+
un.call(a, t) && !mn.hasOwnProperty(t) && (r[t] = a[t]);
|
|
37
36
|
if (o && o.defaultProps)
|
|
38
37
|
for (t in a = o.defaultProps, a)
|
|
39
38
|
r[t] === void 0 && (r[t] = a[t]);
|
|
40
|
-
return { $$typeof:
|
|
39
|
+
return { $$typeof: dn, type: o, key: n, ref: i, props: r, _owner: hn.current };
|
|
41
40
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
mr.exports =
|
|
41
|
+
Ft.Fragment = cn;
|
|
42
|
+
Ft.jsx = fr;
|
|
43
|
+
Ft.jsxs = fr;
|
|
44
|
+
mr.exports = Ft;
|
|
46
45
|
var p = mr.exports;
|
|
47
|
-
function
|
|
48
|
-
const o =
|
|
46
|
+
function fn() {
|
|
47
|
+
const o = T(je), a = Ze(o.activeDropdown$, o.activeDropdown), e = T(dt);
|
|
49
48
|
if (!a)
|
|
50
49
|
return null;
|
|
51
50
|
const { location: t, componentKey: r } = a, n = e.get(r), i = `${t.unitId}-${t.subUnitId}-${t.row}-${t.col}`;
|
|
@@ -64,20 +63,20 @@ function mn() {
|
|
|
64
63
|
);
|
|
65
64
|
}
|
|
66
65
|
const pr = "sheet.ui.dropdown";
|
|
67
|
-
var
|
|
68
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
66
|
+
var pn = Object.defineProperty, vn = Object.getOwnPropertyDescriptor, gn = (o, a, e, t) => {
|
|
67
|
+
for (var r = t > 1 ? void 0 : t ? vn(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
69
68
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
70
|
-
return t && r &&
|
|
71
|
-
},
|
|
72
|
-
let
|
|
73
|
-
constructor(a, e, t, r, n, i
|
|
69
|
+
return t && r && pn(a, e, r), r;
|
|
70
|
+
}, Ue = (o, a) => (e, t) => a(e, t, o);
|
|
71
|
+
let je = class extends me {
|
|
72
|
+
constructor(a, e, t, r, n, i) {
|
|
74
73
|
super();
|
|
75
74
|
g(this, "_activeDropdown");
|
|
76
75
|
g(this, "_activeDropdown$", new ur());
|
|
77
76
|
g(this, "_currentPopup", null);
|
|
78
77
|
g(this, "activeDropdown$", this._activeDropdown$.asObservable());
|
|
79
78
|
g(this, "_zenVisible", !1);
|
|
80
|
-
this._canvasPopupManagerService = a, this._univerInstanceService = e, this.
|
|
79
|
+
this._canvasPopupManagerService = a, this._univerInstanceService = e, this._dataValidatorRegistryService = t, this._zenZoneService = r, this._renderManagerService = n, this._dataValidationModel = i, this._init();
|
|
81
80
|
}
|
|
82
81
|
get activeDropdown() {
|
|
83
82
|
return this._activeDropdown;
|
|
@@ -92,7 +91,7 @@ let $e = class extends me {
|
|
|
92
91
|
if (this._currentPopup && this._currentPopup.dispose(), this._zenVisible)
|
|
93
92
|
return;
|
|
94
93
|
this._activeDropdown = a, this._activeDropdown$.next(this._activeDropdown);
|
|
95
|
-
const n = this._renderManagerService.getRenderById(
|
|
94
|
+
const n = this._renderManagerService.getRenderById(Wr), i = this._canvasPopupManagerService.attachPopupToCell(
|
|
96
95
|
t,
|
|
97
96
|
r,
|
|
98
97
|
{
|
|
@@ -106,7 +105,7 @@ let $e = class extends me {
|
|
|
106
105
|
);
|
|
107
106
|
if (!i)
|
|
108
107
|
throw new Error("[DataValidationDropdownManagerService]: cannot show dropdown!");
|
|
109
|
-
const s = new
|
|
108
|
+
const s = new qa();
|
|
110
109
|
s.add(i), s.add({
|
|
111
110
|
dispose: () => {
|
|
112
111
|
var l, d;
|
|
@@ -125,13 +124,10 @@ let $e = class extends me {
|
|
|
125
124
|
if (!s)
|
|
126
125
|
return;
|
|
127
126
|
const d = this._dataValidationModel.ensureManager(a, e).getRuleByLocation(t, r);
|
|
128
|
-
if (!
|
|
129
|
-
unitId: a,
|
|
130
|
-
sheetId: e
|
|
131
|
-
}) || !d)
|
|
127
|
+
if (!d)
|
|
132
128
|
return;
|
|
133
|
-
const
|
|
134
|
-
if (!
|
|
129
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(d.type);
|
|
130
|
+
if (!c || !c.dropdown) {
|
|
135
131
|
this.hideDropdown();
|
|
136
132
|
return;
|
|
137
133
|
}
|
|
@@ -144,36 +140,35 @@ let $e = class extends me {
|
|
|
144
140
|
unitId: a,
|
|
145
141
|
subUnitId: e
|
|
146
142
|
},
|
|
147
|
-
componentKey:
|
|
143
|
+
componentKey: c.dropdown,
|
|
148
144
|
onHide: n
|
|
149
145
|
});
|
|
150
146
|
}
|
|
151
147
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
var
|
|
162
|
-
for (var r = t > 1 ? void 0 : t ? _n(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
148
|
+
je = gn([
|
|
149
|
+
Ue(0, w(So)),
|
|
150
|
+
Ue(1, ie),
|
|
151
|
+
Ue(2, w(Ee)),
|
|
152
|
+
Ue(3, No),
|
|
153
|
+
Ue(4, ir),
|
|
154
|
+
Ue(5, w(Z))
|
|
155
|
+
], je);
|
|
156
|
+
var _n = Object.defineProperty, Sn = Object.getOwnPropertyDescriptor, Rn = (o, a, e, t) => {
|
|
157
|
+
for (var r = t > 1 ? void 0 : t ? Sn(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
163
158
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
164
|
-
return t && r &&
|
|
159
|
+
return t && r && _n(a, e, r), r;
|
|
165
160
|
}, ja = (o, a) => (e, t) => a(e, t, o);
|
|
166
161
|
let we = class extends me {
|
|
167
162
|
constructor(a, e) {
|
|
168
163
|
super();
|
|
169
164
|
g(this, "_open$", new xa(!1));
|
|
170
|
-
g(this, "open$", this._open$.pipe(
|
|
165
|
+
g(this, "open$", this._open$.pipe(an()));
|
|
171
166
|
g(this, "_activeRule");
|
|
172
167
|
g(this, "_activeRule$", new xa(void 0));
|
|
173
168
|
g(this, "activeRule$", this._activeRule$.asObservable());
|
|
174
169
|
g(this, "_closeDisposable", null);
|
|
175
170
|
this._univerInstanceService = a, this._sidebarService = e, this.disposeWithMe(
|
|
176
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
171
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(se.UNIVER_SHEET).pipe(tn((t) => !t)).subscribe(() => {
|
|
177
172
|
this.close();
|
|
178
173
|
})
|
|
179
174
|
);
|
|
@@ -196,7 +191,7 @@ let we = class extends me {
|
|
|
196
191
|
this._open$.next(!1), (a = this._closeDisposable) == null || a.dispose();
|
|
197
192
|
}
|
|
198
193
|
setCloseDisposable(a) {
|
|
199
|
-
this._closeDisposable =
|
|
194
|
+
this._closeDisposable = ma(() => {
|
|
200
195
|
a.dispose(), this._closeDisposable = null;
|
|
201
196
|
});
|
|
202
197
|
}
|
|
@@ -204,53 +199,53 @@ let we = class extends me {
|
|
|
204
199
|
this._activeRule = a, this._activeRule$.next(a);
|
|
205
200
|
}
|
|
206
201
|
};
|
|
207
|
-
we =
|
|
208
|
-
ja(0,
|
|
209
|
-
ja(1,
|
|
202
|
+
we = Rn([
|
|
203
|
+
ja(0, ie),
|
|
204
|
+
ja(1, rr)
|
|
210
205
|
], we);
|
|
211
206
|
const vr = "DataValidationPanel", ct = {
|
|
212
207
|
id: "data-validation.operation.open-validation-panel",
|
|
213
|
-
type:
|
|
208
|
+
type: ye.OPERATION,
|
|
214
209
|
handler(o, a) {
|
|
215
210
|
if (!a)
|
|
216
211
|
return !1;
|
|
217
|
-
const { ruleId: e, isAdd: t } = a, r = o.get(we), n = o.get(
|
|
212
|
+
const { ruleId: e, isAdd: t } = a, r = o.get(we), n = o.get(Z), i = o.get(ie), s = o.get(rr), l = tr(i);
|
|
218
213
|
if (!l)
|
|
219
214
|
return !1;
|
|
220
|
-
const { unitId: d, subUnitId: c } = l,
|
|
221
|
-
r.open(), r.setActiveRule(
|
|
215
|
+
const { unitId: d, subUnitId: c } = l, h = e ? n.getRuleById(d, c, e) : void 0;
|
|
216
|
+
r.open(), r.setActiveRule(h && {
|
|
222
217
|
unitId: d,
|
|
223
218
|
subUnitId: c,
|
|
224
|
-
rule:
|
|
219
|
+
rule: h
|
|
225
220
|
});
|
|
226
|
-
const
|
|
221
|
+
const u = s.open({
|
|
227
222
|
header: { title: t ? "dataValidation.panel.addTitle" : "dataValidation.panel.title" },
|
|
228
223
|
children: { label: vr },
|
|
229
224
|
width: 312,
|
|
230
225
|
onClose: () => r.close()
|
|
231
226
|
});
|
|
232
|
-
return r.setCloseDisposable(
|
|
227
|
+
return r.setCloseDisposable(u), !0;
|
|
233
228
|
}
|
|
234
229
|
}, gr = {
|
|
235
230
|
id: "data-validation.operation.close-validation-panel",
|
|
236
|
-
type:
|
|
231
|
+
type: ye.OPERATION,
|
|
237
232
|
handler(o) {
|
|
238
233
|
return o.get(we).close(), !0;
|
|
239
234
|
}
|
|
240
|
-
},
|
|
235
|
+
}, Cn = {
|
|
241
236
|
id: "data-validation.operation.toggle-validation-panel",
|
|
242
|
-
type:
|
|
237
|
+
type: ye.OPERATION,
|
|
243
238
|
handler(o) {
|
|
244
239
|
const a = o.get(te), e = o.get(we);
|
|
245
240
|
return e.open(), e.isOpen ? a.executeCommand(gr.id) : a.executeCommand(ct.id), !0;
|
|
246
241
|
}
|
|
247
|
-
},
|
|
248
|
-
type:
|
|
242
|
+
}, Ca = {
|
|
243
|
+
type: ye.OPERATION,
|
|
249
244
|
id: "sheet.operation.show-data-validation-dropdown",
|
|
250
245
|
handler(o, a) {
|
|
251
246
|
if (!a)
|
|
252
247
|
return !1;
|
|
253
|
-
const e = o.get(
|
|
248
|
+
const e = o.get(je), { unitId: t, subUnitId: r, row: n, column: i } = a, s = e.activeDropdown, l = s == null ? void 0 : s.location;
|
|
254
249
|
return l && l.unitId === t && l.subUnitId === r && l.row === n && l.col === i || e.showDataValidationDropdown(
|
|
255
250
|
t,
|
|
256
251
|
r,
|
|
@@ -258,11 +253,11 @@ const vr = "DataValidationPanel", ct = {
|
|
|
258
253
|
i
|
|
259
254
|
), !0;
|
|
260
255
|
}
|
|
261
|
-
},
|
|
262
|
-
type:
|
|
256
|
+
}, Vn = {
|
|
257
|
+
type: ye.OPERATION,
|
|
263
258
|
id: "sheet.operation.hide-data-validation-dropdown",
|
|
264
259
|
handler(o, a) {
|
|
265
|
-
return a ? (o.get(
|
|
260
|
+
return a ? (o.get(je).hideDropdown(), !0) : !1;
|
|
266
261
|
}
|
|
267
262
|
};
|
|
268
263
|
function Qe(o, a, e) {
|
|
@@ -271,14 +266,14 @@ function Qe(o, a, e) {
|
|
|
271
266
|
switch (n.type) {
|
|
272
267
|
case "delete":
|
|
273
268
|
t.push({
|
|
274
|
-
id:
|
|
269
|
+
id: It.id,
|
|
275
270
|
params: {
|
|
276
271
|
unitId: o,
|
|
277
272
|
subUnitId: a,
|
|
278
273
|
ruleId: n.rule.uid
|
|
279
274
|
}
|
|
280
275
|
}), r.unshift({
|
|
281
|
-
id:
|
|
276
|
+
id: Kt.id,
|
|
282
277
|
params: {
|
|
283
278
|
unitId: o,
|
|
284
279
|
subUnitId: a,
|
|
@@ -295,7 +290,7 @@ function Qe(o, a, e) {
|
|
|
295
290
|
subUnitId: a,
|
|
296
291
|
ruleId: n.ruleId,
|
|
297
292
|
payload: {
|
|
298
|
-
type:
|
|
293
|
+
type: De.RANGE,
|
|
299
294
|
payload: n.newRanges
|
|
300
295
|
}
|
|
301
296
|
}
|
|
@@ -306,7 +301,7 @@ function Qe(o, a, e) {
|
|
|
306
301
|
subUnitId: a,
|
|
307
302
|
ruleId: n.ruleId,
|
|
308
303
|
payload: {
|
|
309
|
-
type:
|
|
304
|
+
type: De.RANGE,
|
|
310
305
|
payload: n.oldRanges
|
|
311
306
|
}
|
|
312
307
|
}
|
|
@@ -315,14 +310,14 @@ function Qe(o, a, e) {
|
|
|
315
310
|
}
|
|
316
311
|
case "add": {
|
|
317
312
|
t.push({
|
|
318
|
-
id:
|
|
313
|
+
id: Kt.id,
|
|
319
314
|
params: {
|
|
320
315
|
unitId: o,
|
|
321
316
|
subUnitId: a,
|
|
322
317
|
rule: n.rule
|
|
323
318
|
}
|
|
324
319
|
}), r.unshift({
|
|
325
|
-
id:
|
|
320
|
+
id: It.id,
|
|
326
321
|
params: {
|
|
327
322
|
unitId: o,
|
|
328
323
|
subUnitId: a,
|
|
@@ -337,42 +332,42 @@ function Qe(o, a, e) {
|
|
|
337
332
|
undoMutations: r
|
|
338
333
|
};
|
|
339
334
|
}
|
|
340
|
-
const
|
|
341
|
-
type:
|
|
335
|
+
const Va = {
|
|
336
|
+
type: ye.COMMAND,
|
|
342
337
|
id: "sheet.command.updateDataValidationRuleRange",
|
|
343
338
|
async handler(o, a) {
|
|
344
339
|
if (!a)
|
|
345
340
|
return !1;
|
|
346
|
-
const { unitId: e, subUnitId: t, ranges: r, ruleId: n } = a, i = o.get(
|
|
341
|
+
const { unitId: e, subUnitId: t, ranges: r, ruleId: n } = a, i = o.get(Z), s = o.get(te), l = o.get(za), d = i.ensureManager(e, t), c = d.getRuleById(n);
|
|
347
342
|
if (!c)
|
|
348
343
|
return !1;
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
const f =
|
|
344
|
+
const h = c.ranges, u = d.getRuleObjectMatrix().clone();
|
|
345
|
+
u.updateRange(n, h, r);
|
|
346
|
+
const f = u.diff(d.getDataValidations()), { redoMutations: m, undoMutations: v } = Qe(e, t, f);
|
|
352
347
|
return l.pushUndoRedo({
|
|
353
348
|
undoMutations: v,
|
|
354
349
|
redoMutations: m,
|
|
355
350
|
unitID: e
|
|
356
351
|
}), await Qa(m, s), !0;
|
|
357
352
|
}
|
|
358
|
-
},
|
|
359
|
-
type:
|
|
353
|
+
}, Ma = {
|
|
354
|
+
type: ye.COMMAND,
|
|
360
355
|
id: "sheet.command.addDataValidation",
|
|
361
356
|
async handler(o, a) {
|
|
362
357
|
if (!a)
|
|
363
358
|
return !1;
|
|
364
|
-
const { unitId: e, subUnitId: t, rule: r } = a, n = o.get(
|
|
359
|
+
const { unitId: e, subUnitId: t, rule: r } = a, n = o.get(Z), i = o.get(te), s = o.get(za), l = n.ensureManager(e, t), d = l.getRuleObjectMatrix().clone();
|
|
365
360
|
d.addRule(r);
|
|
366
|
-
const c = d.diff(l.getDataValidations()),
|
|
361
|
+
const c = d.diff(l.getDataValidations()), h = {
|
|
367
362
|
unitId: e,
|
|
368
363
|
subUnitId: t,
|
|
369
364
|
rule: r
|
|
370
|
-
}, { redoMutations:
|
|
371
|
-
return
|
|
372
|
-
id:
|
|
373
|
-
params:
|
|
365
|
+
}, { redoMutations: u, undoMutations: f } = Qe(e, t, c);
|
|
366
|
+
return u.push({
|
|
367
|
+
id: Kt.id,
|
|
368
|
+
params: h
|
|
374
369
|
}), f.unshift({
|
|
375
|
-
id:
|
|
370
|
+
id: It.id,
|
|
376
371
|
params: {
|
|
377
372
|
unitId: e,
|
|
378
373
|
subUnitId: t,
|
|
@@ -380,15 +375,15 @@ const Ma = {
|
|
|
380
375
|
}
|
|
381
376
|
}), s.pushUndoRedo({
|
|
382
377
|
unitID: e,
|
|
383
|
-
redoMutations:
|
|
378
|
+
redoMutations: u,
|
|
384
379
|
undoMutations: f
|
|
385
|
-
}), await Qa(
|
|
380
|
+
}), await Qa(u, i), !0;
|
|
386
381
|
}
|
|
387
382
|
}, _r = {
|
|
388
|
-
type:
|
|
383
|
+
type: ye.COMMAND,
|
|
389
384
|
id: "data-validation.command.addRuleAndOpen",
|
|
390
385
|
async handler(o) {
|
|
391
|
-
const a = o.get(
|
|
386
|
+
const a = o.get(ie), e = tr(a);
|
|
392
387
|
if (!e)
|
|
393
388
|
return !1;
|
|
394
389
|
const { workbook: t, worksheet: r } = e, n = Ja(o), i = o.get(te), s = t.getUnitId(), l = r.getSheetId(), d = {
|
|
@@ -396,22 +391,22 @@ const Ma = {
|
|
|
396
391
|
unitId: s,
|
|
397
392
|
subUnitId: l
|
|
398
393
|
};
|
|
399
|
-
return await i.executeCommand(
|
|
394
|
+
return await i.executeCommand(Ma.id, d) ? (i.executeCommand(ct.id, {
|
|
400
395
|
ruleId: n.uid,
|
|
401
396
|
isAdd: !0
|
|
402
397
|
}), !0) : !1;
|
|
403
398
|
}
|
|
404
399
|
};
|
|
405
|
-
var
|
|
406
|
-
return
|
|
400
|
+
var ce = function() {
|
|
401
|
+
return ce = Object.assign || function(o) {
|
|
407
402
|
for (var a, e = 1, t = arguments.length; e < t; e++) {
|
|
408
403
|
a = arguments[e];
|
|
409
404
|
for (var r in a)
|
|
410
405
|
Object.prototype.hasOwnProperty.call(a, r) && (o[r] = a[r]);
|
|
411
406
|
}
|
|
412
407
|
return o;
|
|
413
|
-
},
|
|
414
|
-
},
|
|
408
|
+
}, ce.apply(this, arguments);
|
|
409
|
+
}, Mn = function(o, a) {
|
|
415
410
|
var e = {};
|
|
416
411
|
for (var t in o)
|
|
417
412
|
Object.prototype.hasOwnProperty.call(o, t) && a.indexOf(t) < 0 && (e[t] = o[t]);
|
|
@@ -420,16 +415,16 @@ var de = function() {
|
|
|
420
415
|
a.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, t[r]) && (e[t[r]] = o[t[r]]);
|
|
421
416
|
return e;
|
|
422
417
|
}, Te = Oe(function(o, a) {
|
|
423
|
-
var e = o.icon, t = o.id, r = o.className, n = o.extend, i =
|
|
424
|
-
return Sr(e, "".concat(t), { defIds: e.defIds, idSuffix: l.current },
|
|
418
|
+
var e = o.icon, t = o.id, r = o.className, n = o.extend, i = Mn(o, ["icon", "id", "className", "extend"]), s = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), l = _a("_".concat(Dn()));
|
|
419
|
+
return Sr(e, "".concat(t), { defIds: e.defIds, idSuffix: l.current }, ce({ ref: a, className: s }, i), n);
|
|
425
420
|
});
|
|
426
421
|
function Sr(o, a, e, t, r) {
|
|
427
|
-
return be(o.tag,
|
|
422
|
+
return be(o.tag, ce(ce({ key: a }, wn(o, e, r)), t), (In(o, e).children || []).map(function(n, i) {
|
|
428
423
|
return Sr(n, "".concat(a, "-").concat(o.tag, "-").concat(i), e, void 0, r);
|
|
429
424
|
}));
|
|
430
425
|
}
|
|
431
|
-
function
|
|
432
|
-
var t =
|
|
426
|
+
function wn(o, a, e) {
|
|
427
|
+
var t = ce({}, o.attrs);
|
|
433
428
|
e != null && e.colorChannel1 && t.fill === "colorChannel1" && (t.fill = e.colorChannel1);
|
|
434
429
|
var r = a.defIds;
|
|
435
430
|
return !r || r.length === 0 || (o.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + a.idSuffix), Object.entries(t).forEach(function(n) {
|
|
@@ -437,13 +432,13 @@ function Mn(o, a, e) {
|
|
|
437
432
|
typeof s == "string" && (t[i] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(a.idSuffix, ")")));
|
|
438
433
|
})), t;
|
|
439
434
|
}
|
|
440
|
-
function
|
|
435
|
+
function In(o, a) {
|
|
441
436
|
var e, t = a.defIds;
|
|
442
|
-
return !t || t.length === 0 ? o : o.tag === "defs" && (!((e = o.children) === null || e === void 0) && e.length) ?
|
|
443
|
-
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ?
|
|
437
|
+
return !t || t.length === 0 ? o : o.tag === "defs" && (!((e = o.children) === null || e === void 0) && e.length) ? ce(ce({}, o), { children: o.children.map(function(r) {
|
|
438
|
+
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? ce(ce({}, r), { attrs: ce(ce({}, r.attrs), { id: r.attrs.id + a.idSuffix }) }) : r;
|
|
444
439
|
}) }) : o;
|
|
445
440
|
}
|
|
446
|
-
function
|
|
441
|
+
function Dn() {
|
|
447
442
|
return Math.random().toString(36).substring(2, 8);
|
|
448
443
|
}
|
|
449
444
|
Te.displayName = "UniverIcon";
|
|
@@ -455,33 +450,33 @@ var yn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
|
|
|
455
450
|
}));
|
|
456
451
|
});
|
|
457
452
|
Rr.displayName = "CheckMarkSingle";
|
|
458
|
-
const
|
|
459
|
-
var
|
|
453
|
+
const En = Rr;
|
|
454
|
+
var On = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.4917 3.07803C1.4917 2.19437 2.20804 1.47803 3.0917 1.47803H5.6917C6.57536 1.47803 7.2917 2.19437 7.2917 3.07803V5.67803C7.2917 6.56168 6.57535 7.27803 5.6917 7.27803H3.0917C2.20804 7.27803 1.4917 6.56168 1.4917 5.67803V3.07803ZM3.0917 2.67803C2.87078 2.67803 2.6917 2.85711 2.6917 3.07803V5.67803C2.6917 5.89894 2.87079 6.07803 3.0917 6.07803H5.6917C5.91261 6.07803 6.0917 5.89894 6.0917 5.67803V3.07803C6.0917 2.85711 5.91261 2.67803 5.6917 2.67803H3.0917Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M14.6175 2.45279C14.8518 2.68711 14.8518 3.06701 14.6175 3.30132L11.6151 6.30365C11.3957 6.52307 11.0451 6.53897 10.8067 6.34031L8.80915 4.67566C8.55458 4.46352 8.52019 4.08518 8.73233 3.83062 8.94447 3.57605 9.32281 3.54166 9.57737 3.7538L11.154 5.06767 13.769 2.45278C14.0033 2.21847 14.3832 2.21848 14.6175 2.45279zM14.1175 9.19746C14.3518 9.43178 14.3518 9.81168 14.1175 10.046L12.5418 11.6217 14.1175 13.1975C14.3518 13.4318 14.3518 13.8117 14.1175 14.046 13.8832 14.2803 13.5033 14.2803 13.269 14.046L11.6933 12.4703 10.1175 14.046C9.88321 14.2803 9.50331 14.2803 9.269 14.046 9.03468 13.8117 9.03468 13.4318 9.269 13.1975L10.8447 11.6217 9.269 10.046C9.03468 9.81168 9.03468 9.43178 9.269 9.19746 9.50331 8.96315 9.88321 8.96315 10.1175 9.19746L11.6933 10.7732 13.269 9.19746C13.5033 8.96315 13.8832 8.96315 14.1175 9.19746z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.0917 8.72168C2.20804 8.72168 1.4917 9.43802 1.4917 10.3217V12.9217C1.4917 13.8053 2.20804 14.5217 3.0917 14.5217H5.6917C6.57535 14.5217 7.2917 13.8053 7.2917 12.9217V10.3217C7.2917 9.43802 6.57536 8.72168 5.6917 8.72168H3.0917ZM2.6917 10.3217C2.6917 10.1008 2.87078 9.92168 3.0917 9.92168H5.6917C5.91261 9.92168 6.0917 10.1008 6.0917 10.3217V12.9217C6.0917 13.1426 5.91261 13.3217 5.6917 13.3217H3.0917C2.87079 13.3217 2.6917 13.1426 2.6917 12.9217V10.3217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Cr = Oe(function(o, a) {
|
|
460
455
|
return be(Te, Object.assign({}, o, {
|
|
461
456
|
id: "data-validation-single",
|
|
462
457
|
ref: a,
|
|
463
|
-
icon:
|
|
458
|
+
icon: On
|
|
464
459
|
}));
|
|
465
460
|
});
|
|
466
461
|
Cr.displayName = "DataValidationSingle";
|
|
467
|
-
var
|
|
462
|
+
var bn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Vr = Oe(function(o, a) {
|
|
468
463
|
return be(Te, Object.assign({}, o, {
|
|
469
464
|
id: "delete-single",
|
|
470
465
|
ref: a,
|
|
471
|
-
icon:
|
|
466
|
+
icon: bn
|
|
472
467
|
}));
|
|
473
468
|
});
|
|
474
469
|
Vr.displayName = "DeleteSingle";
|
|
475
470
|
const Mr = Vr;
|
|
476
|
-
var
|
|
471
|
+
var Tn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, wr = Oe(function(o, a) {
|
|
477
472
|
return be(Te, Object.assign({}, o, {
|
|
478
473
|
id: "increase-single",
|
|
479
474
|
ref: a,
|
|
480
|
-
icon:
|
|
475
|
+
icon: Tn
|
|
481
476
|
}));
|
|
482
477
|
});
|
|
483
478
|
wr.displayName = "IncreaseSingle";
|
|
484
|
-
const
|
|
479
|
+
const Nn = wr;
|
|
485
480
|
var Fn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ir = Oe(function(o, a) {
|
|
486
481
|
return be(Te, Object.assign({}, o, {
|
|
487
482
|
id: "more-down-single",
|
|
@@ -490,35 +485,35 @@ var Fn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
|
|
|
490
485
|
}));
|
|
491
486
|
});
|
|
492
487
|
Ir.displayName = "MoreDownSingle";
|
|
493
|
-
const
|
|
494
|
-
var
|
|
488
|
+
const Ln = Ir;
|
|
489
|
+
var Pn = { 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" } }] }, Dr = Oe(function(o, a) {
|
|
495
490
|
return be(Te, Object.assign({}, o, {
|
|
496
491
|
id: "more-up-single",
|
|
497
492
|
ref: a,
|
|
498
|
-
icon:
|
|
493
|
+
icon: Pn
|
|
499
494
|
}));
|
|
500
495
|
});
|
|
501
|
-
|
|
502
|
-
const An =
|
|
503
|
-
var
|
|
496
|
+
Dr.displayName = "MoreUpSingle";
|
|
497
|
+
const An = Dr;
|
|
498
|
+
var xn = { 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" } }] }] }, yr = Oe(function(o, a) {
|
|
504
499
|
return be(Te, Object.assign({}, o, {
|
|
505
500
|
id: "sequence-single",
|
|
506
501
|
ref: a,
|
|
507
|
-
icon:
|
|
502
|
+
icon: xn
|
|
508
503
|
}));
|
|
509
504
|
});
|
|
510
|
-
|
|
511
|
-
const
|
|
512
|
-
dataValidationOptionsButton:
|
|
513
|
-
dataValidationOptionsButtonIcon:
|
|
505
|
+
yr.displayName = "SequenceSingle";
|
|
506
|
+
const jn = yr, Bn = "univer-data-validation-options-button", $n = "univer-data-validation-options-button-icon", xt = {
|
|
507
|
+
dataValidationOptionsButton: Bn,
|
|
508
|
+
dataValidationOptionsButtonIcon: $n
|
|
514
509
|
};
|
|
515
|
-
function
|
|
510
|
+
function Un(o) {
|
|
516
511
|
var d;
|
|
517
|
-
const a =
|
|
512
|
+
const a = T(le), e = T(dt), { value: t, onChange: r, extraComponent: n } = o, [i, s] = Q(!1), l = n ? e.get(n) : null;
|
|
518
513
|
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
519
|
-
/* @__PURE__ */ p.jsxs("div", { className:
|
|
514
|
+
/* @__PURE__ */ p.jsxs("div", { className: xt.dataValidationOptionsButton, onClick: () => s(!i), children: [
|
|
520
515
|
a.t("dataValidation.panel.options"),
|
|
521
|
-
i ? /* @__PURE__ */ p.jsx(An, { className:
|
|
516
|
+
i ? /* @__PURE__ */ p.jsx(An, { className: xt.dataValidationOptionsButtonIcon }) : /* @__PURE__ */ p.jsx(Ln, { className: xt.dataValidationOptionsButtonIcon })
|
|
522
517
|
] }),
|
|
523
518
|
i && /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
524
519
|
l ? /* @__PURE__ */ p.jsx(l, { value: t, onChange: r }) : null,
|
|
@@ -527,13 +522,13 @@ function $n(o) {
|
|
|
527
522
|
{
|
|
528
523
|
label: a.t("dataValidation.panel.invalid"),
|
|
529
524
|
children: /* @__PURE__ */ p.jsxs(
|
|
530
|
-
|
|
525
|
+
Sa,
|
|
531
526
|
{
|
|
532
527
|
value: `${(d = t.errorStyle) != null ? d : tt.WARNING}`,
|
|
533
528
|
onChange: (c) => r({ ...t, errorStyle: +c }),
|
|
534
529
|
children: [
|
|
535
|
-
/* @__PURE__ */ p.jsx(
|
|
536
|
-
/* @__PURE__ */ p.jsx(
|
|
530
|
+
/* @__PURE__ */ p.jsx(Pe, { value: `${tt.WARNING}`, children: a.t("dataValidation.panel.showWarning") }),
|
|
531
|
+
/* @__PURE__ */ p.jsx(Pe, { value: `${tt.STOP}`, children: a.t("dataValidation.panel.rejectInput") })
|
|
537
532
|
]
|
|
538
533
|
}
|
|
539
534
|
)
|
|
@@ -556,70 +551,70 @@ function $n(o) {
|
|
|
556
551
|
)
|
|
557
552
|
}
|
|
558
553
|
),
|
|
559
|
-
t.showInputMessage ? /* @__PURE__ */ p.jsx(K, { children: /* @__PURE__ */ p.jsx(
|
|
554
|
+
t.showInputMessage ? /* @__PURE__ */ p.jsx(K, { children: /* @__PURE__ */ p.jsx(Ae, { value: t.error, onChange: (c) => r({ ...t, error: c }) }) }) : null
|
|
560
555
|
] })
|
|
561
556
|
] });
|
|
562
557
|
}
|
|
563
|
-
const
|
|
564
|
-
dataValidationDetailFormItem:
|
|
565
|
-
dataValidationDetailButtons:
|
|
566
|
-
dataValidationDetailButton:
|
|
567
|
-
},
|
|
558
|
+
const Wn = "univer-data-validation-detail-form-item", Hn = "univer-data-validation-detail-buttons", kn = "univer-data-validation-detail-button", We = {
|
|
559
|
+
dataValidationDetailFormItem: Wn,
|
|
560
|
+
dataValidationDetailButtons: Hn,
|
|
561
|
+
dataValidationDetailButton: kn
|
|
562
|
+
}, Yn = (o) => Xr(
|
|
568
563
|
async (a, e, t, r) => {
|
|
569
564
|
const n = await o.executeCommand(a, e, t);
|
|
570
565
|
r == null || r(n);
|
|
571
566
|
},
|
|
572
567
|
275
|
|
573
568
|
);
|
|
574
|
-
function
|
|
575
|
-
const [o, a] = Q(0), e =
|
|
569
|
+
function Gn() {
|
|
570
|
+
const [o, a] = Q(0), e = T(we), t = Ze(e.activeRule$, e.activeRule), { unitId: r, subUnitId: n, rule: i } = t || {}, s = i.uid, l = T(Ee), d = T(dt), c = T(te), h = T(Z), u = T(le), [f, m] = Q(i), v = l.getValidatorItem(f.type), [R, S] = Q(!1), V = l.getValidatorsByScope(ao.SHEET), [_, I] = Q(() => f.ranges.map((M) => ({ unitId: "", sheetId: "", range: M }))), D = oa(() => Yn(c), [c]);
|
|
576
571
|
if (Xe(() => {
|
|
577
|
-
c.onCommandExecuted((
|
|
578
|
-
(
|
|
579
|
-
const
|
|
580
|
-
a((
|
|
572
|
+
c.onCommandExecuted((M) => {
|
|
573
|
+
(M.id === Hr.id || M.id === kr.id) && setTimeout(() => {
|
|
574
|
+
const O = h.getRuleById(r, n, s);
|
|
575
|
+
a((z) => z + 1), O && (m(O), I(O.ranges.map((z) => ({ unitId: "", sheetId: "", range: z }))));
|
|
581
576
|
}, 20);
|
|
582
577
|
});
|
|
583
|
-
}, [c,
|
|
578
|
+
}, [c, h, s, n, r]), !v)
|
|
584
579
|
return null;
|
|
585
|
-
const
|
|
580
|
+
const N = v.operators, E = v.operatorNames, L = f.operator ? ro.includes(f.operator) : !1, j = () => {
|
|
586
581
|
v.validatorFormula(f).success ? e.setActiveRule(null) : S(!0);
|
|
587
|
-
},
|
|
588
|
-
if (
|
|
582
|
+
}, A = or((M) => {
|
|
583
|
+
if (Yr(M, _))
|
|
589
584
|
return;
|
|
590
|
-
I(
|
|
591
|
-
const
|
|
585
|
+
I(M);
|
|
586
|
+
const O = M.filter(($) => (!$.unitId || $.unitId === r) && (!$.sheetId || $.sheetId === n)).map(($) => $.range);
|
|
592
587
|
if (m({
|
|
593
588
|
...f,
|
|
594
|
-
ranges:
|
|
595
|
-
}),
|
|
589
|
+
ranges: O
|
|
590
|
+
}), O.length === 0)
|
|
596
591
|
return;
|
|
597
|
-
const
|
|
592
|
+
const z = {
|
|
598
593
|
unitId: r,
|
|
599
594
|
subUnitId: n,
|
|
600
595
|
ruleId: s,
|
|
601
|
-
ranges:
|
|
596
|
+
ranges: O
|
|
602
597
|
};
|
|
603
|
-
|
|
604
|
-
}),
|
|
605
|
-
if (
|
|
598
|
+
D(Va.id, z);
|
|
599
|
+
}), P = (M) => {
|
|
600
|
+
if (ya(M, Oa(f)))
|
|
606
601
|
return;
|
|
607
602
|
m({
|
|
608
603
|
...f,
|
|
609
|
-
...
|
|
604
|
+
...M
|
|
610
605
|
});
|
|
611
|
-
const
|
|
606
|
+
const O = {
|
|
612
607
|
unitId: r,
|
|
613
608
|
subUnitId: n,
|
|
614
609
|
ruleId: s,
|
|
615
|
-
setting:
|
|
610
|
+
setting: M
|
|
616
611
|
};
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
612
|
+
D(
|
|
613
|
+
ba.id,
|
|
614
|
+
O,
|
|
620
615
|
void 0
|
|
621
616
|
);
|
|
622
|
-
},
|
|
617
|
+
}, B = async () => {
|
|
623
618
|
await c.executeCommand(er.id, {
|
|
624
619
|
ruleId: s,
|
|
625
620
|
unitId: r,
|
|
@@ -631,95 +626,95 @@ function Yn() {
|
|
|
631
626
|
formula1: f.formula1,
|
|
632
627
|
formula2: f.formula2,
|
|
633
628
|
allowBlank: f.allowBlank
|
|
634
|
-
},
|
|
635
|
-
const
|
|
636
|
-
if (!
|
|
629
|
+
}, x = (M) => {
|
|
630
|
+
const O = l.getValidatorItem(M);
|
|
631
|
+
if (!O)
|
|
637
632
|
return;
|
|
638
|
-
const
|
|
639
|
-
|
|
633
|
+
const z = O.operators, $ = h.getRuleById(r, n, s), ae = M === ($ == null ? void 0 : $.type) ? {
|
|
634
|
+
...$
|
|
640
635
|
} : {
|
|
641
636
|
...f,
|
|
642
|
-
type:
|
|
643
|
-
operator:
|
|
637
|
+
type: M,
|
|
638
|
+
operator: z[0],
|
|
644
639
|
formula1: void 0,
|
|
645
640
|
formula2: void 0
|
|
646
641
|
};
|
|
647
|
-
m(
|
|
642
|
+
m(ae), c.executeCommand(ba.id, {
|
|
648
643
|
unitId: r,
|
|
649
644
|
subUnitId: n,
|
|
650
645
|
ruleId: f.uid,
|
|
651
|
-
setting:
|
|
646
|
+
setting: Oa(ae)
|
|
652
647
|
});
|
|
653
|
-
},
|
|
654
|
-
|
|
648
|
+
}, b = d.get(v.formulaInput), k = _.map((M) => dr(M.range)).join(","), ee = Ea(f), Y = (M) => {
|
|
649
|
+
ya(M, Ea(f)) || (m({
|
|
655
650
|
...f,
|
|
656
|
-
...
|
|
657
|
-
}),
|
|
658
|
-
|
|
651
|
+
...M
|
|
652
|
+
}), D(
|
|
653
|
+
oo.id,
|
|
659
654
|
{
|
|
660
655
|
unitId: r,
|
|
661
656
|
subUnitId: n,
|
|
662
657
|
ruleId: s,
|
|
663
|
-
options:
|
|
658
|
+
options: M
|
|
664
659
|
}
|
|
665
660
|
));
|
|
666
661
|
};
|
|
667
662
|
return /* @__PURE__ */ p.jsxs("div", { children: [
|
|
668
|
-
/* @__PURE__ */ p.jsx(K, { label:
|
|
669
|
-
|
|
663
|
+
/* @__PURE__ */ p.jsx(K, { label: u.t("dataValidation.panel.range"), children: /* @__PURE__ */ p.jsx(
|
|
664
|
+
Fo,
|
|
670
665
|
{
|
|
671
|
-
className:
|
|
672
|
-
value:
|
|
666
|
+
className: We.dataValidationDetailFormItem,
|
|
667
|
+
value: k,
|
|
673
668
|
id: fa("data-validation-detail"),
|
|
674
669
|
openForSheetUnitId: r,
|
|
675
670
|
openForSheetSubUnitId: n,
|
|
676
|
-
onChange: (
|
|
677
|
-
|
|
671
|
+
onChange: (M) => {
|
|
672
|
+
M.some((O) => !Gr(O.range) || O.range.endColumn < O.range.startColumn || O.range.endRow < O.range.startRow) || A(M);
|
|
678
673
|
}
|
|
679
674
|
},
|
|
680
675
|
o
|
|
681
676
|
) }),
|
|
682
|
-
/* @__PURE__ */ p.jsx(K, { label:
|
|
683
|
-
|
|
677
|
+
/* @__PURE__ */ p.jsx(K, { label: u.t("dataValidation.panel.type"), children: /* @__PURE__ */ p.jsx(
|
|
678
|
+
na,
|
|
684
679
|
{
|
|
685
|
-
options:
|
|
686
|
-
label:
|
|
687
|
-
value:
|
|
680
|
+
options: V == null ? void 0 : V.map((M) => ({
|
|
681
|
+
label: u.t(M.title),
|
|
682
|
+
value: M.id
|
|
688
683
|
})),
|
|
689
684
|
value: f.type,
|
|
690
|
-
onChange:
|
|
691
|
-
className:
|
|
685
|
+
onChange: x,
|
|
686
|
+
className: We.dataValidationDetailFormItem
|
|
692
687
|
}
|
|
693
688
|
) }),
|
|
694
|
-
|
|
695
|
-
|
|
689
|
+
N != null && N.length ? /* @__PURE__ */ p.jsx(K, { label: u.t("dataValidation.panel.operator"), children: /* @__PURE__ */ p.jsx(
|
|
690
|
+
na,
|
|
696
691
|
{
|
|
697
|
-
options:
|
|
698
|
-
value: `${
|
|
699
|
-
label:
|
|
692
|
+
options: N.map((M, O) => ({
|
|
693
|
+
value: `${M}`,
|
|
694
|
+
label: E[O]
|
|
700
695
|
})),
|
|
701
696
|
value: `${f.operator}`,
|
|
702
|
-
onChange: (
|
|
703
|
-
|
|
697
|
+
onChange: (M) => {
|
|
698
|
+
P({
|
|
704
699
|
...X,
|
|
705
|
-
operator:
|
|
700
|
+
operator: M
|
|
706
701
|
});
|
|
707
702
|
},
|
|
708
|
-
className:
|
|
703
|
+
className: We.dataValidationDetailFormItem
|
|
709
704
|
}
|
|
710
705
|
) }) : null,
|
|
711
|
-
|
|
712
|
-
|
|
706
|
+
b ? /* @__PURE__ */ p.jsx(
|
|
707
|
+
b,
|
|
713
708
|
{
|
|
714
|
-
isTwoFormula:
|
|
709
|
+
isTwoFormula: L,
|
|
715
710
|
value: {
|
|
716
711
|
formula1: f.formula1,
|
|
717
712
|
formula2: f.formula2
|
|
718
713
|
},
|
|
719
|
-
onChange: (
|
|
720
|
-
|
|
714
|
+
onChange: (M) => {
|
|
715
|
+
P({
|
|
721
716
|
...X,
|
|
722
|
-
...
|
|
717
|
+
...M
|
|
723
718
|
});
|
|
724
719
|
},
|
|
725
720
|
showError: R,
|
|
@@ -730,21 +725,21 @@ function Yn() {
|
|
|
730
725
|
},
|
|
731
726
|
o
|
|
732
727
|
) : null,
|
|
733
|
-
/* @__PURE__ */ p.jsx(
|
|
734
|
-
/* @__PURE__ */ p.jsxs("div", { className:
|
|
735
|
-
/* @__PURE__ */ p.jsx(ze, { className:
|
|
736
|
-
/* @__PURE__ */ p.jsx(ze, { className:
|
|
728
|
+
/* @__PURE__ */ p.jsx(Un, { value: ee, onChange: Y, extraComponent: v.optionsInput }),
|
|
729
|
+
/* @__PURE__ */ p.jsxs("div", { className: We.dataValidationDetailButtons, children: [
|
|
730
|
+
/* @__PURE__ */ p.jsx(ze, { className: We.dataValidationDetailButton, onClick: B, children: u.t("dataValidation.panel.removeRule") }),
|
|
731
|
+
/* @__PURE__ */ p.jsx(ze, { className: We.dataValidationDetailButton, type: "primary", onClick: j, children: u.t("dataValidation.panel.done") })
|
|
737
732
|
] })
|
|
738
733
|
] });
|
|
739
734
|
}
|
|
740
|
-
var
|
|
741
|
-
const
|
|
742
|
-
dataValidationItemContainer:
|
|
743
|
-
dataValidationItemTitle:
|
|
744
|
-
dataValidationItemContent:
|
|
745
|
-
dataValidationItemIcon:
|
|
746
|
-
},
|
|
747
|
-
const { rule: a, onClick: e, unitId: t, subUnitId: r, disable: n } = o, i =
|
|
735
|
+
var Dt = /* @__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.UNRECOGNIZED = -1] = "UNRECOGNIZED", o))(Dt || {});
|
|
736
|
+
const Xn = "univer-data-validation-item-container", qn = "univer-data-validation-item-title", zn = "univer-data-validation-item-content", Qn = "univer-data-validation-item-icon", ft = {
|
|
737
|
+
dataValidationItemContainer: Xn,
|
|
738
|
+
dataValidationItemTitle: qn,
|
|
739
|
+
dataValidationItemContent: zn,
|
|
740
|
+
dataValidationItemIcon: Qn
|
|
741
|
+
}, Kn = (o) => {
|
|
742
|
+
const { rule: a, onClick: e, unitId: t, subUnitId: r, disable: n } = o, i = T(Ee), s = T(te), l = T(Ro), d = i.getValidatorItem(a.type), c = _a(), [h, u] = Q(!1), f = (m) => {
|
|
748
743
|
s.executeCommand(er.id, {
|
|
749
744
|
ruleId: a.uid,
|
|
750
745
|
unitId: t,
|
|
@@ -762,7 +757,7 @@ const Gn = "univer-data-validation-item-container", Xn = "univer-data-validation
|
|
|
762
757
|
className: ft.dataValidationItemContainer,
|
|
763
758
|
onClick: e,
|
|
764
759
|
onMouseEnter: () => {
|
|
765
|
-
n || (
|
|
760
|
+
n || (u(!0), c.current = a.ranges.map((m) => l.addShape({
|
|
766
761
|
range: m,
|
|
767
762
|
style: {
|
|
768
763
|
hasAutoFill: !1,
|
|
@@ -785,24 +780,24 @@ const Gn = "univer-data-validation-item-container", Xn = "univer-data-validation
|
|
|
785
780
|
},
|
|
786
781
|
onMouseLeave: () => {
|
|
787
782
|
var m;
|
|
788
|
-
|
|
783
|
+
u(!1), (m = c.current) == null || m.forEach((v) => {
|
|
789
784
|
v && l.removeShape(v);
|
|
790
785
|
}), c.current = void 0;
|
|
791
786
|
},
|
|
792
787
|
children: [
|
|
793
788
|
/* @__PURE__ */ p.jsx("div", { className: ft.dataValidationItemTitle, children: d == null ? void 0 : d.generateRuleName(a) }),
|
|
794
789
|
/* @__PURE__ */ p.jsx("div", { className: ft.dataValidationItemContent, children: a.ranges.map((m) => dr(m)).join(",") }),
|
|
795
|
-
|
|
790
|
+
h ? /* @__PURE__ */ p.jsx("div", { className: ft.dataValidationItemIcon, onClick: f, children: /* @__PURE__ */ p.jsx(Mr, {}) }) : null
|
|
796
791
|
]
|
|
797
792
|
}
|
|
798
793
|
);
|
|
799
794
|
};
|
|
800
|
-
var
|
|
801
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
795
|
+
var Zn = Object.defineProperty, Jn = Object.getOwnPropertyDescriptor, ei = (o, a, e, t) => {
|
|
796
|
+
for (var r = t > 1 ? void 0 : t ? Jn(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
802
797
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
803
|
-
return t && r &&
|
|
804
|
-
},
|
|
805
|
-
let
|
|
798
|
+
return t && r && Zn(a, e, r), r;
|
|
799
|
+
}, ti = (o, a) => (e, t) => a(e, t, o);
|
|
800
|
+
let yt = class {
|
|
806
801
|
constructor(o) {
|
|
807
802
|
g(this, "_currentManager");
|
|
808
803
|
g(this, "_currentManager$", new ur());
|
|
@@ -830,14 +825,14 @@ let Ot = class {
|
|
|
830
825
|
return this._ensureManager(o, a);
|
|
831
826
|
}
|
|
832
827
|
};
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
],
|
|
836
|
-
function
|
|
828
|
+
yt = ei([
|
|
829
|
+
ti(0, w(Z))
|
|
830
|
+
], yt);
|
|
831
|
+
function ai(o) {
|
|
837
832
|
var l;
|
|
838
833
|
const { unitId: a, subUnitId: e, value: t, onChange: r, showError: n, validResult: i } = o, s = n ? i == null ? void 0 : i.formula1 : "";
|
|
839
834
|
return /* @__PURE__ */ p.jsx(K, { error: s, children: /* @__PURE__ */ p.jsx(
|
|
840
|
-
|
|
835
|
+
nr,
|
|
841
836
|
{
|
|
842
837
|
value: (l = t == null ? void 0 : t.formula1) != null ? l : "",
|
|
843
838
|
id: fa(`dataValidation-custom-formula-${a}-${e}`),
|
|
@@ -853,21 +848,21 @@ function ti(o) {
|
|
|
853
848
|
}
|
|
854
849
|
) });
|
|
855
850
|
}
|
|
856
|
-
const
|
|
857
|
-
dataValidationFormula:
|
|
858
|
-
dataValidationFormulaAnd:
|
|
859
|
-
dataValidationFormulaListItem:
|
|
860
|
-
dataValidationFormulaListItemIcon:
|
|
861
|
-
dataValidationFormulaListItemDrag:
|
|
862
|
-
dataValidationFormulaListAdd:
|
|
863
|
-
dataValidationFormulaColorSelect:
|
|
864
|
-
dataValidationFormulaColorSelectPanel:
|
|
865
|
-
dataValidationFormulaColorItem:
|
|
866
|
-
},
|
|
867
|
-
const { isTwoFormula: a = !1, value: e, onChange: t, showError: r, validResult: n } = o, i =
|
|
851
|
+
const ri = "univer-data-validation-formula", oi = "univer-data-validation-formula-and", ni = "univer-data-validation-formula-list-item", ii = "univer-data-validation-formula-list-item-icon", si = "univer-data-validation-formula-list-item-drag", li = "univer-data-validation-formula-list-add", di = "univer-data-validation-formula-color-select", ci = "univer-data-validation-formula-color-select-panel", ui = "univer-data-validation-formula-color-item", oe = {
|
|
852
|
+
dataValidationFormula: ri,
|
|
853
|
+
dataValidationFormulaAnd: oi,
|
|
854
|
+
dataValidationFormulaListItem: ni,
|
|
855
|
+
dataValidationFormulaListItemIcon: ii,
|
|
856
|
+
dataValidationFormulaListItemDrag: si,
|
|
857
|
+
dataValidationFormulaListAdd: li,
|
|
858
|
+
dataValidationFormulaColorSelect: di,
|
|
859
|
+
dataValidationFormulaColorSelectPanel: ci,
|
|
860
|
+
dataValidationFormulaColorItem: ui
|
|
861
|
+
}, hi = (o) => {
|
|
862
|
+
const { isTwoFormula: a = !1, value: e, onChange: t, showError: r, validResult: n } = o, i = T(le), s = r ? n == null ? void 0 : n.formula1 : "", l = r ? n == null ? void 0 : n.formula2 : "";
|
|
868
863
|
return a ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
869
864
|
/* @__PURE__ */ p.jsx(K, { error: s, children: /* @__PURE__ */ p.jsx(
|
|
870
|
-
|
|
865
|
+
Ae,
|
|
871
866
|
{
|
|
872
867
|
className: oe.dataValidationFormula,
|
|
873
868
|
placeholder: i.t("dataValidation.panel.formulaPlaceholder"),
|
|
@@ -882,7 +877,7 @@ const ai = "univer-data-validation-formula", ri = "univer-data-validation-formul
|
|
|
882
877
|
) }),
|
|
883
878
|
/* @__PURE__ */ p.jsx("div", { className: oe.dataValidationFormulaAnd, children: i.t("dataValidation.panel.formulaAnd") }),
|
|
884
879
|
/* @__PURE__ */ p.jsx(K, { error: l, children: /* @__PURE__ */ p.jsx(
|
|
885
|
-
|
|
880
|
+
Ae,
|
|
886
881
|
{
|
|
887
882
|
className: oe.dataValidationFormula,
|
|
888
883
|
placeholder: i.t("dataValidation.panel.formulaPlaceholder"),
|
|
@@ -896,7 +891,7 @@ const ai = "univer-data-validation-formula", ri = "univer-data-validation-formul
|
|
|
896
891
|
}
|
|
897
892
|
) })
|
|
898
893
|
] }) : /* @__PURE__ */ p.jsx(K, { error: s, children: /* @__PURE__ */ p.jsx(
|
|
899
|
-
|
|
894
|
+
Ae,
|
|
900
895
|
{
|
|
901
896
|
className: oe.dataValidationFormula,
|
|
902
897
|
placeholder: i.t("dataValidation.panel.formulaPlaceholder"),
|
|
@@ -907,7 +902,7 @@ const ai = "univer-data-validation-formula", ri = "univer-data-validation-formul
|
|
|
907
902
|
}
|
|
908
903
|
) });
|
|
909
904
|
};
|
|
910
|
-
function
|
|
905
|
+
function ne(o) {
|
|
911
906
|
if (o === null)
|
|
912
907
|
return "";
|
|
913
908
|
if (o != null && o.p) {
|
|
@@ -925,16 +920,16 @@ function Er(o) {
|
|
|
925
920
|
function Ge(o) {
|
|
926
921
|
return o.split(",").filter(Boolean);
|
|
927
922
|
}
|
|
928
|
-
function
|
|
929
|
-
const a =
|
|
923
|
+
function mi(o) {
|
|
924
|
+
const a = ne(o);
|
|
930
925
|
return a == null ? "" : a.toString();
|
|
931
926
|
}
|
|
932
|
-
const
|
|
933
|
-
var
|
|
934
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
927
|
+
const wa = "SHEET_DATA_VALIDATION_PLUGIN", Le = "#ECECEC";
|
|
928
|
+
var fi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, vi = (o, a, e, t) => {
|
|
929
|
+
for (var r = t > 1 ? void 0 : t ? pi(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
935
930
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
936
|
-
return t && r &&
|
|
937
|
-
},
|
|
931
|
+
return t && r && fi(a, e, r), r;
|
|
932
|
+
}, jt = (o, a) => (e, t) => a(e, t, o);
|
|
938
933
|
let at = class extends me {
|
|
939
934
|
constructor(o, a, e) {
|
|
940
935
|
super(), this._univerInstanceService = o, this._permissionService = a, this._lexerTreeBuilder = e;
|
|
@@ -948,36 +943,36 @@ let at = class extends me {
|
|
|
948
943
|
const n = a[r];
|
|
949
944
|
if (typeof n == "string")
|
|
950
945
|
continue;
|
|
951
|
-
const { token: i } = n, s =
|
|
946
|
+
const { token: i } = n, s = Zo(i), l = this._univerInstanceService.getCurrentUnitForType(se.UNIVER_SHEET);
|
|
952
947
|
let d = l.getActiveSheet();
|
|
953
948
|
const c = l.getUnitId();
|
|
954
949
|
if (s.sheetName) {
|
|
955
950
|
if (d = l.getSheetBySheetName(s.sheetName), !d)
|
|
956
951
|
return !1;
|
|
957
952
|
const v = d == null ? void 0 : d.getSheetId();
|
|
958
|
-
if (!this._permissionService.getPermissionPoint(new
|
|
953
|
+
if (!this._permissionService.getPermissionPoint(new ho(c, v).id))
|
|
959
954
|
return !1;
|
|
960
955
|
}
|
|
961
956
|
if (!d)
|
|
962
957
|
return !1;
|
|
963
|
-
const { startRow:
|
|
964
|
-
for (let v =
|
|
958
|
+
const { startRow: h, endRow: u, startColumn: f, endColumn: m } = s.range;
|
|
959
|
+
for (let v = h; v <= u; v++)
|
|
965
960
|
for (let R = f; R <= m; R++) {
|
|
966
961
|
const S = (t = (e = d.getCell(v, R)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
967
|
-
if ((S == null ? void 0 : S[
|
|
962
|
+
if ((S == null ? void 0 : S[Dt.View]) === !1)
|
|
968
963
|
return !1;
|
|
969
964
|
}
|
|
970
965
|
}
|
|
971
966
|
return !0;
|
|
972
967
|
}
|
|
973
968
|
};
|
|
974
|
-
at =
|
|
975
|
-
ge
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
969
|
+
at = vi([
|
|
970
|
+
ve(ge.Rendered, at),
|
|
971
|
+
jt(0, ie),
|
|
972
|
+
jt(1, qr),
|
|
973
|
+
jt(2, w(Ra))
|
|
979
974
|
], at);
|
|
980
|
-
const
|
|
975
|
+
const gi = [
|
|
981
976
|
"#FFFFFF",
|
|
982
977
|
"#FEE7E7",
|
|
983
978
|
"#FEF0E6",
|
|
@@ -1002,10 +997,10 @@ const vi = [
|
|
|
1002
997
|
"#3A60F7",
|
|
1003
998
|
"#9E6DE3",
|
|
1004
999
|
"#F248A6"
|
|
1005
|
-
],
|
|
1000
|
+
], _i = (o) => {
|
|
1006
1001
|
const { value: a, onChange: e, disabled: t } = o, [r, n] = Q(!1);
|
|
1007
1002
|
return /* @__PURE__ */ p.jsx(
|
|
1008
|
-
|
|
1003
|
+
na,
|
|
1009
1004
|
{
|
|
1010
1005
|
disabled: t,
|
|
1011
1006
|
open: r,
|
|
@@ -1015,7 +1010,7 @@ const vi = [
|
|
|
1015
1010
|
value: a,
|
|
1016
1011
|
onChange: e,
|
|
1017
1012
|
labelRender: (i) => /* @__PURE__ */ p.jsx("div", { className: oe.dataValidationFormulaColorItem, style: { background: i.value } }),
|
|
1018
|
-
dropdownRender: () => /* @__PURE__ */ p.jsx("div", { className: oe.dataValidationFormulaColorSelectPanel, children:
|
|
1013
|
+
dropdownRender: () => /* @__PURE__ */ p.jsx("div", { className: oe.dataValidationFormulaColorSelectPanel, children: gi.map(
|
|
1019
1014
|
(i) => /* @__PURE__ */ p.jsx(
|
|
1020
1015
|
"div",
|
|
1021
1016
|
{
|
|
@@ -1033,9 +1028,9 @@ const vi = [
|
|
|
1033
1028
|
}, Ba = (o) => {
|
|
1034
1029
|
const { item: a, commonProps: e, style: t } = o, { onItemChange: r, onItemDelete: n } = e;
|
|
1035
1030
|
return /* @__PURE__ */ p.jsxs("div", { className: oe.dataValidationFormulaListItem, style: t, children: [
|
|
1036
|
-
a.isRef ? null : /* @__PURE__ */ p.jsx("div", { className:
|
|
1031
|
+
a.isRef ? null : /* @__PURE__ */ p.jsx("div", { className: on(oe.dataValidationFormulaListItemDrag, "draggableHandle"), children: /* @__PURE__ */ p.jsx(jn, {}) }),
|
|
1037
1032
|
/* @__PURE__ */ p.jsx(
|
|
1038
|
-
|
|
1033
|
+
_i,
|
|
1039
1034
|
{
|
|
1040
1035
|
value: a.color,
|
|
1041
1036
|
onChange: (i) => {
|
|
@@ -1044,7 +1039,7 @@ const vi = [
|
|
|
1044
1039
|
}
|
|
1045
1040
|
),
|
|
1046
1041
|
/* @__PURE__ */ p.jsx(
|
|
1047
|
-
|
|
1042
|
+
Ae,
|
|
1048
1043
|
{
|
|
1049
1044
|
disabled: a.isRef,
|
|
1050
1045
|
value: a.label,
|
|
@@ -1056,162 +1051,162 @@ const vi = [
|
|
|
1056
1051
|
a.isRef ? null : /* @__PURE__ */ p.jsx("div", { className: oe.dataValidationFormulaListItemIcon, children: /* @__PURE__ */ p.jsx(Mr, { onClick: () => n(a.id) }) })
|
|
1057
1052
|
] });
|
|
1058
1053
|
};
|
|
1059
|
-
function
|
|
1054
|
+
function Si(o) {
|
|
1060
1055
|
const { value: a, onChange: e = () => {
|
|
1061
|
-
}, unitId: t, subUnitId: r, validResult: n, showError: i, ruleId: s } = o, { formula1: l = "", formula2: d = "" } = a || {}, c =
|
|
1056
|
+
}, unitId: t, subUnitId: r, validResult: n, showError: i, ruleId: s } = o, { formula1: l = "", formula2: d = "" } = a || {}, c = _a(null), [h, u] = Q(() => F(l) ? "1" : "0"), [f, m] = Q(h === "1" ? l : "="), [v, R] = Q(h === "1" ? l : "="), S = T(le), V = T(Ee), _ = T(Z), I = T(at), [D, N] = Q(() => d.split(",")), E = V.getValidatorItem(q.LIST), [L, j] = Q([]), [A, P] = Q(""), B = i ? n == null ? void 0 : n.formula1 : "", X = Ze(_.ruleChange$), x = or(e);
|
|
1062
1057
|
Xe(() => {
|
|
1063
1058
|
(async () => {
|
|
1064
|
-
await new Promise((
|
|
1065
|
-
setTimeout(() =>
|
|
1059
|
+
await new Promise((H) => {
|
|
1060
|
+
setTimeout(() => H(!0), 100);
|
|
1066
1061
|
});
|
|
1067
|
-
const
|
|
1068
|
-
if (
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1062
|
+
const y = _.getRuleById(t, r, s), W = y == null ? void 0 : y.formula1;
|
|
1063
|
+
if (F(W) && E && y) {
|
|
1064
|
+
const H = await E.getListAsync(y, t, r);
|
|
1065
|
+
j(H);
|
|
1071
1066
|
}
|
|
1072
1067
|
})();
|
|
1073
|
-
}, [_, X,
|
|
1074
|
-
|
|
1068
|
+
}, [_, X, E, s, r, t]), Xe(() => {
|
|
1069
|
+
F(l) && l !== v && (m(l), R(v));
|
|
1075
1070
|
}, [v, l]);
|
|
1076
|
-
const [
|
|
1077
|
-
const
|
|
1078
|
-
return
|
|
1079
|
-
label:
|
|
1080
|
-
color:
|
|
1071
|
+
const [b, k] = Q(() => {
|
|
1072
|
+
const y = h !== "1" ? Ge(l) : [], W = d.split(",");
|
|
1073
|
+
return y.map((H, J) => ({
|
|
1074
|
+
label: H,
|
|
1075
|
+
color: W[J] || Le,
|
|
1081
1076
|
isRef: !1,
|
|
1082
|
-
id:
|
|
1077
|
+
id: U.generateRandomId(4)
|
|
1083
1078
|
}));
|
|
1084
|
-
}), ee = (
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
},
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
},
|
|
1091
|
-
label:
|
|
1092
|
-
color:
|
|
1093
|
-
id: `${
|
|
1079
|
+
}), ee = (y, W, H) => {
|
|
1080
|
+
const J = b.find((_e) => _e.id === y);
|
|
1081
|
+
J && (J.label = W, J.color = H, k([...b]));
|
|
1082
|
+
}, Y = (y) => {
|
|
1083
|
+
const W = b.findIndex((H) => H.id === y);
|
|
1084
|
+
W !== -1 && (b.splice(W, 1), k([...b]));
|
|
1085
|
+
}, M = d.split(","), O = oa(() => L.map((y, W) => ({
|
|
1086
|
+
label: y,
|
|
1087
|
+
color: M[W] || Le,
|
|
1088
|
+
id: `${W}`,
|
|
1094
1089
|
isRef: !0
|
|
1095
|
-
})), [
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1090
|
+
})), [M, L]), z = (y, W, H) => {
|
|
1091
|
+
const J = [...D];
|
|
1092
|
+
J[+y] = H, N(J), x({
|
|
1098
1093
|
formula1: l,
|
|
1099
|
-
formula2:
|
|
1094
|
+
formula2: J.join(",")
|
|
1100
1095
|
});
|
|
1101
|
-
},
|
|
1102
|
-
|
|
1103
|
-
...
|
|
1096
|
+
}, $ = () => {
|
|
1097
|
+
k([
|
|
1098
|
+
...b,
|
|
1104
1099
|
{
|
|
1105
1100
|
label: "",
|
|
1106
|
-
color:
|
|
1101
|
+
color: Le,
|
|
1107
1102
|
isRef: !1,
|
|
1108
|
-
id:
|
|
1103
|
+
id: U.generateRandomId(4)
|
|
1109
1104
|
}
|
|
1110
1105
|
]);
|
|
1111
1106
|
};
|
|
1112
1107
|
Xe(() => {
|
|
1113
|
-
if (
|
|
1108
|
+
if (h === "1")
|
|
1114
1109
|
return;
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1117
|
-
labelList:
|
|
1118
|
-
item:
|
|
1119
|
-
})).forEach(({ item:
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
label:
|
|
1123
|
-
color:
|
|
1110
|
+
const y = /* @__PURE__ */ new Set(), W = [];
|
|
1111
|
+
b.map((H) => ({
|
|
1112
|
+
labelList: H.label.split(","),
|
|
1113
|
+
item: H
|
|
1114
|
+
})).forEach(({ item: H, labelList: J }) => {
|
|
1115
|
+
J.forEach((_e) => {
|
|
1116
|
+
y.has(_e) || (y.add(_e), W.push({
|
|
1117
|
+
label: _e,
|
|
1118
|
+
color: H.color
|
|
1124
1119
|
}));
|
|
1125
1120
|
});
|
|
1126
|
-
}),
|
|
1127
|
-
formula1: Er(
|
|
1128
|
-
formula2:
|
|
1121
|
+
}), x({
|
|
1122
|
+
formula1: Er(W.map((H) => H.label)),
|
|
1123
|
+
formula2: W.map((H) => H.color === Le ? "" : H.color).join(",")
|
|
1129
1124
|
});
|
|
1130
|
-
}, [
|
|
1131
|
-
const
|
|
1132
|
-
() => async (
|
|
1133
|
-
if (!
|
|
1134
|
-
|
|
1125
|
+
}, [b, x, h, v, D]);
|
|
1126
|
+
const ae = oa(
|
|
1127
|
+
() => async (y) => {
|
|
1128
|
+
if (!F(y)) {
|
|
1129
|
+
x == null || x({
|
|
1135
1130
|
formula1: "",
|
|
1136
1131
|
formula2: d
|
|
1137
1132
|
});
|
|
1138
1133
|
return;
|
|
1139
1134
|
}
|
|
1140
|
-
I.getFormulaRefCheck(
|
|
1141
|
-
formula1:
|
|
1135
|
+
I.getFormulaRefCheck(y) ? (x == null || x({
|
|
1136
|
+
formula1: F(y) ? y : "",
|
|
1142
1137
|
formula2: d
|
|
1143
|
-
}),
|
|
1138
|
+
}), P("")) : (x == null || x({
|
|
1144
1139
|
formula1: "",
|
|
1145
1140
|
formula2: d
|
|
1146
|
-
}), m("="),
|
|
1141
|
+
}), m("="), P(S.t("dataValidation.validFail.formulaError")));
|
|
1147
1142
|
},
|
|
1148
|
-
[d,
|
|
1143
|
+
[d, x]
|
|
1149
1144
|
);
|
|
1150
1145
|
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
1151
1146
|
/* @__PURE__ */ p.jsx(K, { label: S.t("dataValidation.list.options"), children: /* @__PURE__ */ p.jsxs(
|
|
1152
|
-
|
|
1147
|
+
Sa,
|
|
1153
1148
|
{
|
|
1154
|
-
value:
|
|
1155
|
-
onChange: (
|
|
1156
|
-
|
|
1149
|
+
value: h,
|
|
1150
|
+
onChange: (y) => {
|
|
1151
|
+
u(y), m(v), y === "1" && x({
|
|
1157
1152
|
formula1: v === "=" ? "" : v,
|
|
1158
|
-
formula2:
|
|
1153
|
+
formula2: D.join(",")
|
|
1159
1154
|
});
|
|
1160
1155
|
},
|
|
1161
1156
|
children: [
|
|
1162
|
-
/* @__PURE__ */ p.jsx(
|
|
1163
|
-
/* @__PURE__ */ p.jsx(
|
|
1157
|
+
/* @__PURE__ */ p.jsx(Pe, { value: "0", children: S.t("dataValidation.list.customOptions") }),
|
|
1158
|
+
/* @__PURE__ */ p.jsx(Pe, { value: "1", children: S.t("dataValidation.list.refOptions") })
|
|
1164
1159
|
]
|
|
1165
1160
|
}
|
|
1166
1161
|
) }),
|
|
1167
|
-
|
|
1168
|
-
/* @__PURE__ */ p.jsx(K, { error:
|
|
1169
|
-
|
|
1162
|
+
h === "1" ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
1163
|
+
/* @__PURE__ */ p.jsx(K, { error: B || A, children: /* @__PURE__ */ p.jsx(
|
|
1164
|
+
nr,
|
|
1170
1165
|
{
|
|
1171
1166
|
id: fa(`list-ref-range-${t}-${r}`),
|
|
1172
1167
|
value: f,
|
|
1173
1168
|
openForSheetUnitId: t,
|
|
1174
1169
|
openForSheetSubUnitId: r,
|
|
1175
1170
|
onlyInputFormula: !0,
|
|
1176
|
-
onChange: async (
|
|
1177
|
-
const
|
|
1178
|
-
R(
|
|
1171
|
+
onChange: async (y) => {
|
|
1172
|
+
const W = y != null ? y : "";
|
|
1173
|
+
R(W), ae(W);
|
|
1179
1174
|
}
|
|
1180
1175
|
}
|
|
1181
1176
|
) }),
|
|
1182
|
-
/* @__PURE__ */ p.jsx(K, { children: /* @__PURE__ */ p.jsx("div", { ref: c, children:
|
|
1183
|
-
] }) : /* @__PURE__ */ p.jsx(K, { error:
|
|
1177
|
+
/* @__PURE__ */ p.jsx(K, { children: /* @__PURE__ */ p.jsx("div", { ref: c, children: O.map((y) => /* @__PURE__ */ p.jsx(Ba, { item: y, commonProps: { onItemChange: z }, style: { marginBottom: 12 } }, y.id)) }) })
|
|
1178
|
+
] }) : /* @__PURE__ */ p.jsx(K, { error: B, children: /* @__PURE__ */ p.jsxs("div", { ref: c, style: { marginTop: "-12px" }, children: [
|
|
1184
1179
|
/* @__PURE__ */ p.jsx(
|
|
1185
|
-
|
|
1180
|
+
qo,
|
|
1186
1181
|
{
|
|
1187
|
-
list:
|
|
1188
|
-
onListChange:
|
|
1182
|
+
list: b,
|
|
1183
|
+
onListChange: k,
|
|
1189
1184
|
rowHeight: 32,
|
|
1190
1185
|
margin: [0, 12],
|
|
1191
1186
|
draggableHandle: ".draggableHandle",
|
|
1192
|
-
itemRender: (
|
|
1187
|
+
itemRender: (y) => /* @__PURE__ */ p.jsx(
|
|
1193
1188
|
Ba,
|
|
1194
1189
|
{
|
|
1195
|
-
item:
|
|
1190
|
+
item: y,
|
|
1196
1191
|
commonProps: {
|
|
1197
1192
|
onItemChange: ee,
|
|
1198
|
-
onItemDelete:
|
|
1193
|
+
onItemDelete: Y
|
|
1199
1194
|
}
|
|
1200
1195
|
},
|
|
1201
|
-
|
|
1196
|
+
y.id
|
|
1202
1197
|
),
|
|
1203
1198
|
idKey: "id"
|
|
1204
1199
|
}
|
|
1205
1200
|
),
|
|
1206
|
-
/* @__PURE__ */ p.jsxs("a", { className: oe.dataValidationFormulaListAdd, onClick:
|
|
1207
|
-
/* @__PURE__ */ p.jsx(
|
|
1201
|
+
/* @__PURE__ */ p.jsxs("a", { className: oe.dataValidationFormulaListAdd, onClick: $, children: [
|
|
1202
|
+
/* @__PURE__ */ p.jsx(Nn, {}),
|
|
1208
1203
|
S.t("dataValidation.list.add")
|
|
1209
1204
|
] })
|
|
1210
1205
|
] }) })
|
|
1211
1206
|
] });
|
|
1212
1207
|
}
|
|
1213
|
-
function
|
|
1214
|
-
const { value: a, onChange: e, showError: t, validResult: r } = o, n =
|
|
1208
|
+
function Ri(o) {
|
|
1209
|
+
const { value: a, onChange: e, showError: t, validResult: r } = o, n = T(le), i = t ? r == null ? void 0 : r.formula1 : "", s = t ? r == null ? void 0 : r.formula2 : "", [l, d] = Q(!((a == null ? void 0 : a.formula1) === void 0 && (a == null ? void 0 : a.formula2) === void 0));
|
|
1215
1210
|
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
1216
1211
|
/* @__PURE__ */ p.jsx(K, { children: /* @__PURE__ */ p.jsx(
|
|
1217
1212
|
lr,
|
|
@@ -1228,7 +1223,7 @@ function Si(o) {
|
|
|
1228
1223
|
}
|
|
1229
1224
|
) }),
|
|
1230
1225
|
l ? /* @__PURE__ */ p.jsx(K, { label: n.t("dataValidation.checkbox.checked"), error: i, children: /* @__PURE__ */ p.jsx(
|
|
1231
|
-
|
|
1226
|
+
Ae,
|
|
1232
1227
|
{
|
|
1233
1228
|
className: oe.dataValidationFormula,
|
|
1234
1229
|
placeholder: n.t("dataValidation.panel.formulaPlaceholder"),
|
|
@@ -1242,7 +1237,7 @@ function Si(o) {
|
|
|
1242
1237
|
}
|
|
1243
1238
|
) }) : null,
|
|
1244
1239
|
l ? /* @__PURE__ */ p.jsx(K, { label: n.t("dataValidation.checkbox.unchecked"), error: s, children: /* @__PURE__ */ p.jsx(
|
|
1245
|
-
|
|
1240
|
+
Ae,
|
|
1246
1241
|
{
|
|
1247
1242
|
className: oe.dataValidationFormula,
|
|
1248
1243
|
placeholder: n.t("dataValidation.panel.formulaPlaceholder"),
|
|
@@ -1257,22 +1252,22 @@ function Si(o) {
|
|
|
1257
1252
|
) }) : null
|
|
1258
1253
|
] });
|
|
1259
1254
|
}
|
|
1260
|
-
const Or = "data-validation.custom-formula-input", ut = "data-validation.formula-input", br = "data-validation.list-formula-input", Tr = "data-validation.checkbox-formula-input",
|
|
1255
|
+
const Or = "data-validation.custom-formula-input", ut = "data-validation.formula-input", br = "data-validation.list-formula-input", Tr = "data-validation.checkbox-formula-input", Ci = [
|
|
1261
1256
|
[
|
|
1262
1257
|
Or,
|
|
1263
|
-
|
|
1258
|
+
ai
|
|
1264
1259
|
],
|
|
1265
1260
|
[
|
|
1266
1261
|
ut,
|
|
1267
|
-
|
|
1262
|
+
hi
|
|
1268
1263
|
],
|
|
1269
1264
|
[
|
|
1270
1265
|
br,
|
|
1271
|
-
|
|
1266
|
+
Si
|
|
1272
1267
|
],
|
|
1273
1268
|
[
|
|
1274
1269
|
Tr,
|
|
1275
|
-
|
|
1270
|
+
Ri
|
|
1276
1271
|
]
|
|
1277
1272
|
];
|
|
1278
1273
|
class ht {
|
|
@@ -1297,17 +1292,17 @@ class ht {
|
|
|
1297
1292
|
updateRuleRanges(a, e, t, r, n) {
|
|
1298
1293
|
const i = this._ensureCache(a, e);
|
|
1299
1294
|
n.forEach((s) => {
|
|
1300
|
-
|
|
1295
|
+
G.foreach(s, (l, d) => {
|
|
1301
1296
|
const c = i.getValue(l, d);
|
|
1302
1297
|
c && (c.temp = !0);
|
|
1303
1298
|
});
|
|
1304
1299
|
}), r.forEach((s) => {
|
|
1305
|
-
|
|
1300
|
+
G.foreach(s, (l, d) => {
|
|
1306
1301
|
const c = i.getValue(l, d);
|
|
1307
1302
|
c && c.ruleId === t ? c.temp = !1 : i.setValue(l, d, void 0);
|
|
1308
1303
|
});
|
|
1309
1304
|
}), n.forEach((s) => {
|
|
1310
|
-
|
|
1305
|
+
G.foreach(s, (l, d) => {
|
|
1311
1306
|
const c = i.getValue(l, d);
|
|
1312
1307
|
c && c.temp === !0 && i.realDeleteValue(l, d);
|
|
1313
1308
|
});
|
|
@@ -1316,7 +1311,7 @@ class ht {
|
|
|
1316
1311
|
markRangeDirty(a, e, t) {
|
|
1317
1312
|
const r = this._ensureCache(a, e);
|
|
1318
1313
|
t.forEach((n) => {
|
|
1319
|
-
|
|
1314
|
+
G.foreach(n, (i, s) => {
|
|
1320
1315
|
r.setValue(i, s, void 0);
|
|
1321
1316
|
});
|
|
1322
1317
|
});
|
|
@@ -1327,7 +1322,7 @@ class ht {
|
|
|
1327
1322
|
_deleteRange(a, e, t) {
|
|
1328
1323
|
const r = this._ensureCache(a, e);
|
|
1329
1324
|
t.forEach((n) => {
|
|
1330
|
-
|
|
1325
|
+
G.foreach(n, (i, s) => {
|
|
1331
1326
|
r.realDeleteValue(i, s);
|
|
1332
1327
|
});
|
|
1333
1328
|
});
|
|
@@ -1339,10 +1334,10 @@ class ht {
|
|
|
1339
1334
|
return this._ensureCache(a, e).setValue(t, r, n);
|
|
1340
1335
|
}
|
|
1341
1336
|
}
|
|
1342
|
-
var
|
|
1343
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1337
|
+
var Vi = Object.defineProperty, Mi = Object.getOwnPropertyDescriptor, wi = (o, a, e, t) => {
|
|
1338
|
+
for (var r = t > 1 ? void 0 : t ? Mi(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
1344
1339
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
1345
|
-
return t && r &&
|
|
1340
|
+
return t && r && Vi(a, e, r), r;
|
|
1346
1341
|
}, pt = (o, a) => (e, t) => a(e, t, o);
|
|
1347
1342
|
let Ke = class extends me {
|
|
1348
1343
|
constructor(a, e, t, r) {
|
|
@@ -1366,8 +1361,8 @@ let Ke = class extends me {
|
|
|
1366
1361
|
const n = t[r], { formulaCellMap: i, ruleFormulaMap: s } = this._ensureMaps(e, r), l = this._dataValidationModel.ensureManager(e, r);
|
|
1367
1362
|
n.forEach((d) => {
|
|
1368
1363
|
var f, m;
|
|
1369
|
-
const c = s.get((f = d.extra) == null ? void 0 : f.ruleId),
|
|
1370
|
-
|
|
1364
|
+
const c = s.get((f = d.extra) == null ? void 0 : f.ruleId), h = i.get(d.formulaId), u = l.getRuleById((m = d.extra) == null ? void 0 : m.ruleId);
|
|
1365
|
+
u && c && !c.isTransformable && this._dataValidationCacheService.markRangeDirty(e, r, u.ranges), h && this._dataValidationCacheService.markCellDirty(e, r, h.row, h.column);
|
|
1371
1366
|
});
|
|
1372
1367
|
}
|
|
1373
1368
|
}
|
|
@@ -1389,11 +1384,11 @@ let Ke = class extends me {
|
|
|
1389
1384
|
deleteByRuleId(a, e, t) {
|
|
1390
1385
|
const { formulaMap: r, formulaCellMap: n, ruleFormulaMap: i } = this._ensureMaps(a, e), s = this._dataValidationModel.getRuleById(a, e, t), l = /* @__PURE__ */ new Set(), d = i.get(t);
|
|
1391
1386
|
!s || !d || (i.delete(t), s.ranges.forEach((c) => {
|
|
1392
|
-
|
|
1393
|
-
const f = r.getValue(
|
|
1387
|
+
G.foreach(c, (h, u) => {
|
|
1388
|
+
const f = r.getValue(h, u);
|
|
1394
1389
|
if (f && f.ruleId === t) {
|
|
1395
1390
|
const { formulaId: m } = f;
|
|
1396
|
-
r.realDeleteValue(
|
|
1391
|
+
r.realDeleteValue(h, u), l.add(m), n.delete(m);
|
|
1397
1392
|
}
|
|
1398
1393
|
});
|
|
1399
1394
|
}), this._registerOtherFormulaService.deleteFormula(a, e, Array.from(l.values())));
|
|
@@ -1402,18 +1397,18 @@ let Ke = class extends me {
|
|
|
1402
1397
|
const { formulaMap: i, ruleFormulaMap: s, formulaCellMap: l } = this._ensureMaps(a, e);
|
|
1403
1398
|
if (!r)
|
|
1404
1399
|
return;
|
|
1405
|
-
const d =
|
|
1400
|
+
const d = Jo(
|
|
1406
1401
|
this._lexerTreeBuilder,
|
|
1407
1402
|
r
|
|
1408
|
-
), c = n[0].startRow,
|
|
1409
|
-
let
|
|
1403
|
+
), c = n[0].startRow, h = n[0].startColumn;
|
|
1404
|
+
let u;
|
|
1410
1405
|
d ? n.forEach((f) => {
|
|
1411
|
-
|
|
1412
|
-
const R =
|
|
1406
|
+
G.foreach(f, (m, v) => {
|
|
1407
|
+
const R = Aa(
|
|
1413
1408
|
this._lexerTreeBuilder,
|
|
1414
1409
|
r,
|
|
1415
1410
|
c,
|
|
1416
|
-
|
|
1411
|
+
h,
|
|
1417
1412
|
m,
|
|
1418
1413
|
v
|
|
1419
1414
|
), S = this._registerFormula(a, e, t, R);
|
|
@@ -1423,51 +1418,51 @@ let Ke = class extends me {
|
|
|
1423
1418
|
ruleId: t
|
|
1424
1419
|
}), l.set(S, { row: m, column: v });
|
|
1425
1420
|
});
|
|
1426
|
-
}) : (
|
|
1427
|
-
|
|
1421
|
+
}) : (u = this._registerFormula(a, e, t, r), n.forEach((f) => {
|
|
1422
|
+
G.foreach(f, (m, v) => {
|
|
1428
1423
|
i.setValue(m, v, {
|
|
1429
|
-
formulaId:
|
|
1424
|
+
formulaId: u,
|
|
1430
1425
|
// formulaText: formula,
|
|
1431
1426
|
ruleId: t
|
|
1432
1427
|
});
|
|
1433
1428
|
});
|
|
1434
1429
|
})), s.set(t, {
|
|
1435
1430
|
formula: r,
|
|
1436
|
-
originCol:
|
|
1431
|
+
originCol: h,
|
|
1437
1432
|
originRow: c,
|
|
1438
1433
|
isTransformable: d,
|
|
1439
|
-
formulaId:
|
|
1434
|
+
formulaId: u
|
|
1440
1435
|
});
|
|
1441
1436
|
}
|
|
1442
1437
|
addRule(a, e, t) {
|
|
1443
1438
|
const { ranges: r, formula1: n, uid: i, type: s } = t;
|
|
1444
|
-
s !==
|
|
1439
|
+
s !== q.CUSTOM || !n || !F(n) || this._addFormulaByRange(a, e, i, n, r);
|
|
1445
1440
|
}
|
|
1446
1441
|
updateRuleRanges(a, e, t, r, n) {
|
|
1447
1442
|
const { formulaMap: i, ruleFormulaMap: s, formulaCellMap: l } = this._ensureMaps(a, e), d = s.get(t);
|
|
1448
1443
|
if (!d)
|
|
1449
1444
|
return;
|
|
1450
|
-
const { formula: c, originCol:
|
|
1445
|
+
const { formula: c, originCol: h, originRow: u, isTransformable: f, formulaId: m } = d, v = /* @__PURE__ */ new Set();
|
|
1451
1446
|
r.forEach((R) => {
|
|
1452
|
-
|
|
1453
|
-
const _ = i.getValue(S,
|
|
1447
|
+
G.foreach(R, (S, V) => {
|
|
1448
|
+
const _ = i.getValue(S, V);
|
|
1454
1449
|
_ && _.ruleId === t && (_.temp = !0);
|
|
1455
1450
|
});
|
|
1456
1451
|
}), n.forEach((R) => {
|
|
1457
|
-
|
|
1452
|
+
G.foreach(R, (S, V) => {
|
|
1458
1453
|
var I;
|
|
1459
|
-
const _ = (I = i.getValue(S,
|
|
1454
|
+
const _ = (I = i.getValue(S, V)) != null ? I : {};
|
|
1460
1455
|
if (_.ruleId !== t) {
|
|
1461
|
-
const
|
|
1462
|
-
if (
|
|
1463
|
-
const
|
|
1464
|
-
i.setValue(S,
|
|
1456
|
+
const D = s.get(_.ruleId);
|
|
1457
|
+
if (D != null && D.isTransformable && v.add(_.formulaId), f) {
|
|
1458
|
+
const N = Aa(this._lexerTreeBuilder, c, u, h, S, V), E = this._registerFormula(a, e, t, N);
|
|
1459
|
+
i.setValue(S, V, {
|
|
1465
1460
|
// formulaText: relativeText,
|
|
1466
1461
|
ruleId: t,
|
|
1467
|
-
formulaId:
|
|
1468
|
-
}), l.set(
|
|
1462
|
+
formulaId: E
|
|
1463
|
+
}), l.set(E, { row: S, column: V });
|
|
1469
1464
|
} else
|
|
1470
|
-
i.setValue(S,
|
|
1465
|
+
i.setValue(S, V, {
|
|
1471
1466
|
// formulaText: formula,
|
|
1472
1467
|
ruleId: t,
|
|
1473
1468
|
formulaId: m
|
|
@@ -1476,9 +1471,9 @@ let Ke = class extends me {
|
|
|
1476
1471
|
_.temp = !1;
|
|
1477
1472
|
});
|
|
1478
1473
|
}), r.forEach((R) => {
|
|
1479
|
-
|
|
1480
|
-
const _ = i.getValue(S,
|
|
1481
|
-
_ && _.ruleId === t && _.temp === !0 && (i.realDeleteValue(S,
|
|
1474
|
+
G.foreach(R, (S, V) => {
|
|
1475
|
+
const _ = i.getValue(S, V);
|
|
1476
|
+
_ && _.ruleId === t && _.temp === !0 && (i.realDeleteValue(S, V), f && v.add(_.formulaId));
|
|
1482
1477
|
});
|
|
1483
1478
|
}), v.forEach((R) => {
|
|
1484
1479
|
l.delete(R);
|
|
@@ -1497,20 +1492,20 @@ let Ke = class extends me {
|
|
|
1497
1492
|
return r.get(t);
|
|
1498
1493
|
}
|
|
1499
1494
|
};
|
|
1500
|
-
Ke =
|
|
1501
|
-
pt(0,
|
|
1502
|
-
pt(1,
|
|
1503
|
-
pt(2,
|
|
1504
|
-
pt(3,
|
|
1495
|
+
Ke = wi([
|
|
1496
|
+
pt(0, w(hr)),
|
|
1497
|
+
pt(1, w(Ra)),
|
|
1498
|
+
pt(2, w(Z)),
|
|
1499
|
+
pt(3, w(ht))
|
|
1505
1500
|
], Ke);
|
|
1506
1501
|
function Me(o) {
|
|
1507
1502
|
var a, e;
|
|
1508
1503
|
return (e = (a = o == null ? void 0 : o[0]) == null ? void 0 : a[0]) == null ? void 0 : e.v;
|
|
1509
1504
|
}
|
|
1510
|
-
class
|
|
1505
|
+
class Ii extends $e {
|
|
1511
1506
|
constructor() {
|
|
1512
1507
|
super(...arguments);
|
|
1513
|
-
g(this, "id",
|
|
1508
|
+
g(this, "id", q.CUSTOM);
|
|
1514
1509
|
g(this, "title", "dataValidation.custom.title");
|
|
1515
1510
|
g(this, "operators", []);
|
|
1516
1511
|
g(this, "scopes", ["sheet"]);
|
|
@@ -1518,7 +1513,7 @@ class wi extends We {
|
|
|
1518
1513
|
g(this, "_customFormulaService", this.injector.get(Ke));
|
|
1519
1514
|
}
|
|
1520
1515
|
validatorFormula(e) {
|
|
1521
|
-
const t =
|
|
1516
|
+
const t = F(e.formula1);
|
|
1522
1517
|
return {
|
|
1523
1518
|
success: t,
|
|
1524
1519
|
formula1: t ? "" : this.localeService.t("dataValidation.validFail.formula")
|
|
@@ -1538,11 +1533,11 @@ class wi extends We {
|
|
|
1538
1533
|
return this.localeService.t("dataValidation.custom.error");
|
|
1539
1534
|
}
|
|
1540
1535
|
}
|
|
1541
|
-
var
|
|
1536
|
+
var Di = Object.defineProperty, yi = Object.getOwnPropertyDescriptor, Ei = (o, a, e, t) => {
|
|
1542
1537
|
for (var r = t > 1 ? void 0 : t ? yi(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
1543
1538
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
1544
|
-
return t && r &&
|
|
1545
|
-
},
|
|
1539
|
+
return t && r && Di(a, e, r), r;
|
|
1540
|
+
}, Bt = (o, a) => (e, t) => a(e, t, o);
|
|
1546
1541
|
let he = class extends me {
|
|
1547
1542
|
constructor(a, e, t) {
|
|
1548
1543
|
super();
|
|
@@ -1558,8 +1553,8 @@ let he = class extends me {
|
|
|
1558
1553
|
n.forEach((l) => {
|
|
1559
1554
|
var d, c;
|
|
1560
1555
|
if (i.get((d = l.extra) == null ? void 0 : d.ruleId)) {
|
|
1561
|
-
const
|
|
1562
|
-
|
|
1556
|
+
const h = s.getRuleById((c = l.extra) == null ? void 0 : c.ruleId);
|
|
1557
|
+
h && this._dataValidationCacheService.markRangeDirty(e, r, h.ranges);
|
|
1563
1558
|
}
|
|
1564
1559
|
});
|
|
1565
1560
|
}
|
|
@@ -1573,7 +1568,7 @@ let he = class extends me {
|
|
|
1573
1568
|
return r || (r = /* @__PURE__ */ new Map(), t.set(e, r)), r;
|
|
1574
1569
|
}
|
|
1575
1570
|
addRule(a, e, t, r, n) {
|
|
1576
|
-
const i =
|
|
1571
|
+
const i = F(r), s = F(n);
|
|
1577
1572
|
if (!i && !s)
|
|
1578
1573
|
return;
|
|
1579
1574
|
const l = this._ensureRuleFormulaMap(a, e), d = [void 0, void 0];
|
|
@@ -1602,7 +1597,7 @@ let he = class extends me {
|
|
|
1602
1597
|
}
|
|
1603
1598
|
const [l, d] = s;
|
|
1604
1599
|
if ((l == null ? void 0 : l.text) !== r)
|
|
1605
|
-
if (l && this._registerOtherFormulaService.deleteFormula(a, e, [l.id]),
|
|
1600
|
+
if (l && this._registerOtherFormulaService.deleteFormula(a, e, [l.id]), F(r)) {
|
|
1606
1601
|
const c = this._registerOtherFormulaService.registerFormula(a, e, r, { ruleId: t });
|
|
1607
1602
|
s[0] = {
|
|
1608
1603
|
text: r,
|
|
@@ -1611,7 +1606,7 @@ let he = class extends me {
|
|
|
1611
1606
|
} else
|
|
1612
1607
|
s[0] = void 0;
|
|
1613
1608
|
if ((d == null ? void 0 : d.text) !== n)
|
|
1614
|
-
if (d && this._registerOtherFormulaService.deleteFormula(a, e, [d.id]),
|
|
1609
|
+
if (d && this._registerOtherFormulaService.deleteFormula(a, e, [d.id]), F(n)) {
|
|
1615
1610
|
const c = this._registerOtherFormulaService.registerFormula(a, e, n, { ruleId: t });
|
|
1616
1611
|
s[1] = {
|
|
1617
1612
|
text: n,
|
|
@@ -1642,23 +1637,23 @@ let he = class extends me {
|
|
|
1642
1637
|
return this._ensureRuleFormulaMap(a, e).get(t);
|
|
1643
1638
|
}
|
|
1644
1639
|
};
|
|
1645
|
-
he =
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1640
|
+
he = Ei([
|
|
1641
|
+
Bt(0, w(hr)),
|
|
1642
|
+
Bt(1, w(ht)),
|
|
1643
|
+
Bt(2, w(Z))
|
|
1649
1644
|
], he);
|
|
1650
|
-
var
|
|
1651
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1645
|
+
var Oi = Object.defineProperty, bi = Object.getOwnPropertyDescriptor, Ti = (o, a, e, t) => {
|
|
1646
|
+
for (var r = t > 1 ? void 0 : t ? bi(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
1652
1647
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
1653
|
-
return t && r &&
|
|
1654
|
-
},
|
|
1648
|
+
return t && r && Oi(a, e, r), r;
|
|
1649
|
+
}, $t = (o, a) => (e, t) => a(e, t, o);
|
|
1655
1650
|
const vt = 6;
|
|
1656
|
-
let
|
|
1651
|
+
let ia = class {
|
|
1657
1652
|
constructor(o, a, e) {
|
|
1658
1653
|
this._commandService = o, this._formulaService = a, this._themeService = e;
|
|
1659
1654
|
}
|
|
1660
1655
|
_calc(o, a) {
|
|
1661
|
-
var d, c,
|
|
1656
|
+
var d, c, h;
|
|
1662
1657
|
const { vt: e, ht: t } = a || {}, r = o.endX - o.startX - vt * 2, n = o.endY - o.startY, i = ((d = a == null ? void 0 : a.fs) != null ? d : 10) * 1.6;
|
|
1663
1658
|
let s = 0, l = 0;
|
|
1664
1659
|
switch (e) {
|
|
@@ -1687,7 +1682,7 @@ let sa = class {
|
|
|
1687
1682
|
left: o.startX + s,
|
|
1688
1683
|
top: o.startY + l,
|
|
1689
1684
|
width: ((c = a == null ? void 0 : a.fs) != null ? c : 10) * 1.6,
|
|
1690
|
-
height: ((
|
|
1685
|
+
height: ((h = a == null ? void 0 : a.fs) != null ? h : 10) * 1.6
|
|
1691
1686
|
};
|
|
1692
1687
|
}
|
|
1693
1688
|
calcCellAutoHeight(o) {
|
|
@@ -1697,21 +1692,21 @@ let sa = class {
|
|
|
1697
1692
|
}
|
|
1698
1693
|
async _parseFormula(o, a, e) {
|
|
1699
1694
|
var i, s;
|
|
1700
|
-
const { formula1: t =
|
|
1695
|
+
const { formula1: t = Et, formula2: r = sa } = o, n = await this._formulaService.getRuleFormulaResult(a, e, o.uid);
|
|
1701
1696
|
return {
|
|
1702
|
-
formula1:
|
|
1703
|
-
formula2:
|
|
1697
|
+
formula1: F(t) ? Me((i = n == null ? void 0 : n[0]) == null ? void 0 : i.result) : t,
|
|
1698
|
+
formula2: F(r) ? Me((s = n == null ? void 0 : n[1]) == null ? void 0 : s.result) : r
|
|
1704
1699
|
};
|
|
1705
1700
|
}
|
|
1706
1701
|
drawWith(o, a) {
|
|
1707
|
-
var
|
|
1708
|
-
const { style: e, data: t, primaryWithCoord: r, unitId: n, subUnitId: i } = a, s = r.isMergedMainCell ? r.mergeInfo : r, l =
|
|
1709
|
-
if (!d || !c
|
|
1702
|
+
var j, A, P, B, X;
|
|
1703
|
+
const { style: e, data: t, primaryWithCoord: r, unitId: n, subUnitId: i } = a, s = r.isMergedMainCell ? r.mergeInfo : r, l = ne(t), d = (j = t.dataValidation) == null ? void 0 : j.rule, c = (A = t.dataValidation) == null ? void 0 : A.validator;
|
|
1704
|
+
if (!d || !c)
|
|
1710
1705
|
return;
|
|
1711
|
-
const
|
|
1706
|
+
const h = this._themeService.getCurrentTheme();
|
|
1712
1707
|
if (!c.skipDefaultFontRender(d, l, { unitId: n, subUnitId: i }))
|
|
1713
1708
|
return;
|
|
1714
|
-
const { formula1:
|
|
1709
|
+
const { formula1: u = Et } = d, f = this._calc(s, e), { a: m, d: v } = o.getTransform(), R = La(f.left, m), S = La(f.top, v), V = $o.create().composeMatrix({
|
|
1715
1710
|
left: R,
|
|
1716
1711
|
top: S,
|
|
1717
1712
|
scaleX: 1,
|
|
@@ -1723,14 +1718,14 @@ let sa = class {
|
|
|
1723
1718
|
flipY: !1
|
|
1724
1719
|
}), _ = s.endX - s.startX, I = s.endY - s.startY;
|
|
1725
1720
|
o.save(), o.beginPath(), o.rect(s.startX, s.startY, _, I), o.clip();
|
|
1726
|
-
const
|
|
1727
|
-
o.transform(
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1730
|
-
checked:
|
|
1731
|
-
width:
|
|
1732
|
-
height:
|
|
1733
|
-
fill: (
|
|
1721
|
+
const D = V.getMatrix();
|
|
1722
|
+
o.transform(D[0], D[1], D[2], D[3], D[4], D[5]);
|
|
1723
|
+
const N = ((P = e == null ? void 0 : e.fs) != null ? P : 10) * 1.6, E = String(l) === String(u), L = h.hyacinth500;
|
|
1724
|
+
Uo.drawWith(o, {
|
|
1725
|
+
checked: E,
|
|
1726
|
+
width: N,
|
|
1727
|
+
height: N,
|
|
1728
|
+
fill: (X = (B = e == null ? void 0 : e.cl) == null ? void 0 : B.rgb) != null ? X : L
|
|
1734
1729
|
}), o.restore();
|
|
1735
1730
|
}
|
|
1736
1731
|
isHit(o, a) {
|
|
@@ -1738,13 +1733,13 @@ let sa = class {
|
|
|
1738
1733
|
return l <= s && l >= i && d <= n && d >= r;
|
|
1739
1734
|
}
|
|
1740
1735
|
async onPointerDown(o, a) {
|
|
1741
|
-
var
|
|
1736
|
+
var u, f;
|
|
1742
1737
|
if (a.button === 2)
|
|
1743
1738
|
return;
|
|
1744
|
-
const { primaryWithCoord: e, unitId: t, subUnitId: r, data: n } = o, i =
|
|
1739
|
+
const { primaryWithCoord: e, unitId: t, subUnitId: r, data: n } = o, i = ne(n), s = (u = n.dataValidation) == null ? void 0 : u.rule, l = (f = n.dataValidation) == null ? void 0 : f.validator;
|
|
1745
1740
|
if (!s || !l || !l.skipDefaultFontRender(s, i, { unitId: t, subUnitId: r }))
|
|
1746
1741
|
return;
|
|
1747
|
-
const { formula1: d, formula2: c } = await this._parseFormula(s, t, r),
|
|
1742
|
+
const { formula1: d, formula2: c } = await this._parseFormula(s, t, r), h = {
|
|
1748
1743
|
range: {
|
|
1749
1744
|
startColumn: e.actualColumn,
|
|
1750
1745
|
endColumn: e.actualColumn,
|
|
@@ -1757,26 +1752,26 @@ let sa = class {
|
|
|
1757
1752
|
}
|
|
1758
1753
|
};
|
|
1759
1754
|
this._commandService.executeCommand(
|
|
1760
|
-
|
|
1761
|
-
|
|
1755
|
+
pa.id,
|
|
1756
|
+
h
|
|
1762
1757
|
);
|
|
1763
1758
|
}
|
|
1764
1759
|
};
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
],
|
|
1770
|
-
const
|
|
1771
|
-
class
|
|
1760
|
+
ia = Ti([
|
|
1761
|
+
$t(0, te),
|
|
1762
|
+
$t(1, w(he)),
|
|
1763
|
+
$t(2, w(zr))
|
|
1764
|
+
], ia);
|
|
1765
|
+
const Et = 1, sa = 0;
|
|
1766
|
+
class Ni extends $e {
|
|
1772
1767
|
constructor() {
|
|
1773
1768
|
super(...arguments);
|
|
1774
|
-
g(this, "id",
|
|
1769
|
+
g(this, "id", q.CHECKBOX);
|
|
1775
1770
|
g(this, "title", "dataValidation.checkbox.title");
|
|
1776
1771
|
g(this, "operators", []);
|
|
1777
1772
|
g(this, "scopes", ["sheet"]);
|
|
1778
1773
|
g(this, "formulaInput", Tr);
|
|
1779
|
-
g(this, "canvasRender", this.injector.createInstance(
|
|
1774
|
+
g(this, "canvasRender", this.injector.createInstance(ia));
|
|
1780
1775
|
g(this, "_formulaService", this.injector.get(he));
|
|
1781
1776
|
}
|
|
1782
1777
|
skipDefaultFontRender(e, t, r) {
|
|
@@ -1784,7 +1779,7 @@ class Ti extends We {
|
|
|
1784
1779
|
return !s || s === `${n}` || s === `${i}`;
|
|
1785
1780
|
}
|
|
1786
1781
|
validatorFormula(e) {
|
|
1787
|
-
const { formula1: t, formula2: r } = e, n =
|
|
1782
|
+
const { formula1: t, formula2: r } = e, n = !U.isBlank(t), i = !U.isBlank(r), s = t === r;
|
|
1788
1783
|
return {
|
|
1789
1784
|
success: n && i && !s || !n && !i,
|
|
1790
1785
|
formula1: n ? s ? this.localeService.t("dataValidation.validFail.checkboxEqual") : "" : this.localeService.t("dataValidation.validFail.common"),
|
|
@@ -1793,23 +1788,23 @@ class Ti extends We {
|
|
|
1793
1788
|
}
|
|
1794
1789
|
async parseFormula(e, t, r) {
|
|
1795
1790
|
var l, d;
|
|
1796
|
-
const { formula1: n =
|
|
1791
|
+
const { formula1: n = Et, formula2: i = sa } = e, s = await this._formulaService.getRuleFormulaResult(t, r, e.uid);
|
|
1797
1792
|
return {
|
|
1798
|
-
formula1:
|
|
1799
|
-
formula2:
|
|
1793
|
+
formula1: F(n) ? Me((l = s == null ? void 0 : s[0]) == null ? void 0 : l.result) : n,
|
|
1794
|
+
formula2: F(i) ? Me((d = s == null ? void 0 : s[1]) == null ? void 0 : d.result) : i
|
|
1800
1795
|
};
|
|
1801
1796
|
}
|
|
1802
1797
|
parseFormulaSync(e, t, r) {
|
|
1803
1798
|
var l, d;
|
|
1804
|
-
const { formula1: n =
|
|
1799
|
+
const { formula1: n = Et, formula2: i = sa } = e, s = this._formulaService.getRuleFormulaResultSync(t, r, e.uid);
|
|
1805
1800
|
return {
|
|
1806
|
-
formula1:
|
|
1807
|
-
formula2:
|
|
1801
|
+
formula1: F(n) ? Me((l = s == null ? void 0 : s[0]) == null ? void 0 : l.result) : n,
|
|
1802
|
+
formula2: F(i) ? Me((d = s == null ? void 0 : s[1]) == null ? void 0 : d.result) : i
|
|
1808
1803
|
};
|
|
1809
1804
|
}
|
|
1810
1805
|
async isValidType(e, t, r) {
|
|
1811
1806
|
const { value: n, unitId: i, subUnitId: s } = e, { formula1: l, formula2: d } = await this.parseFormula(r, i, s);
|
|
1812
|
-
return
|
|
1807
|
+
return !U.isDefine(l) || !U.isDefine(d) ? !0 : U.isDefine(n) && (String(n) === String(l) || String(n) === String(d));
|
|
1813
1808
|
}
|
|
1814
1809
|
generateRuleErrorMessage(e) {
|
|
1815
1810
|
return this.localeService.t("dataValidation.checkbox.error");
|
|
@@ -1818,7 +1813,7 @@ class Ti extends We {
|
|
|
1818
1813
|
const st = [
|
|
1819
1814
|
C.BETWEEN,
|
|
1820
1815
|
C.NOT_BETWEEN
|
|
1821
|
-
],
|
|
1816
|
+
], Ut = 86400;
|
|
1822
1817
|
function Fi(o, a = !0) {
|
|
1823
1818
|
if (a && o >= 0) {
|
|
1824
1819
|
if (o === 0)
|
|
@@ -1838,14 +1833,14 @@ function Fi(o, a = !0) {
|
|
|
1838
1833
|
const s = n + 2 - 12 * e;
|
|
1839
1834
|
return [100 * (t - 49) + r + e | 0, s | 0, i | 0];
|
|
1840
1835
|
}
|
|
1841
|
-
const
|
|
1836
|
+
const Li = (o) => {
|
|
1842
1837
|
let a = o | 0;
|
|
1843
|
-
const e =
|
|
1838
|
+
const e = Ut * (o - a);
|
|
1844
1839
|
let t = Math.floor(e);
|
|
1845
|
-
e - t > 0.9999 && (t += 1, t ===
|
|
1846
|
-
const r = t < 0 ?
|
|
1847
|
-
return
|
|
1848
|
-
},
|
|
1840
|
+
e - t > 0.9999 && (t += 1, t === Ut && (t = 0, a += 1));
|
|
1841
|
+
const r = t < 0 ? Ut + t : t, [n, i, s] = Fi(o, !0), l = Math.floor(r / 60 / 60) % 60, d = Math.floor(r / 60) % 60, c = Math.floor(r) % 60, h = /* @__PURE__ */ new Date(0);
|
|
1842
|
+
return h.setUTCFullYear(n, i - 1, s), h.setUTCHours(l, d, c), h.getTime();
|
|
1843
|
+
}, Pi = {
|
|
1849
1844
|
[C.BETWEEN]: "dataValidation.date.operators.between",
|
|
1850
1845
|
[C.EQUAL]: "dataValidation.date.operators.equal",
|
|
1851
1846
|
[C.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|
|
@@ -1865,7 +1860,7 @@ const Ai = {
|
|
|
1865
1860
|
[C.LESS_THAN_OR_EQUAL]: "dataValidation.date.ruleName.lessThanOrEqual",
|
|
1866
1861
|
[C.NOT_BETWEEN]: "dataValidation.date.ruleName.notBetween",
|
|
1867
1862
|
[C.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual"
|
|
1868
|
-
},
|
|
1863
|
+
}, xi = {
|
|
1869
1864
|
[C.BETWEEN]: "dataValidation.date.errorMsg.between",
|
|
1870
1865
|
[C.EQUAL]: "dataValidation.date.errorMsg.equal",
|
|
1871
1866
|
[C.GREATER_THAN]: "dataValidation.date.errorMsg.greaterThan",
|
|
@@ -1874,14 +1869,14 @@ const Ai = {
|
|
|
1874
1869
|
[C.LESS_THAN_OR_EQUAL]: "dataValidation.date.errorMsg.lessThanOrEqual",
|
|
1875
1870
|
[C.NOT_BETWEEN]: "dataValidation.date.errorMsg.notBetween",
|
|
1876
1871
|
[C.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual"
|
|
1877
|
-
}, $a = "{FORMULA1}", Ua = "{FORMULA2}", Wa = (o) =>
|
|
1872
|
+
}, $a = "{FORMULA1}", Ua = "{FORMULA2}", Wa = (o) => xe(o).isValid(), gt = (o) => {
|
|
1878
1873
|
if (!(o == null || typeof o == "boolean"))
|
|
1879
|
-
return typeof o == "number" || !Number.isNaN(+o) ?
|
|
1874
|
+
return typeof o == "number" || !Number.isNaN(+o) ? xe(Li(+o)) : xe(o);
|
|
1880
1875
|
};
|
|
1881
|
-
class
|
|
1876
|
+
class ji extends $e {
|
|
1882
1877
|
constructor() {
|
|
1883
1878
|
super(...arguments);
|
|
1884
|
-
g(this, "id",
|
|
1879
|
+
g(this, "id", q.DATE);
|
|
1885
1880
|
g(this, "title", "dataValidation.date.title");
|
|
1886
1881
|
g(this, "operators", [
|
|
1887
1882
|
C.BETWEEN,
|
|
@@ -1903,16 +1898,16 @@ class xi extends We {
|
|
|
1903
1898
|
var l, d;
|
|
1904
1899
|
const n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), { formula1: i, formula2: s } = e;
|
|
1905
1900
|
return {
|
|
1906
|
-
formula1: gt(
|
|
1907
|
-
formula2: gt(
|
|
1901
|
+
formula1: gt(F(i) ? Me((l = n == null ? void 0 : n[0]) == null ? void 0 : l.result) : i),
|
|
1902
|
+
formula2: gt(F(s) ? Me((d = n == null ? void 0 : n[1]) == null ? void 0 : d.result) : s)
|
|
1908
1903
|
};
|
|
1909
1904
|
}
|
|
1910
1905
|
async isValidType(e) {
|
|
1911
1906
|
const { value: t } = e;
|
|
1912
|
-
return typeof t == "string" ?
|
|
1907
|
+
return typeof t == "string" ? xe(t).isValid() : typeof t == "number";
|
|
1913
1908
|
}
|
|
1914
1909
|
_validatorSingleFormula(e) {
|
|
1915
|
-
return
|
|
1910
|
+
return !U.isBlank(e) && (F(e) || !Number.isNaN(+e) || !!e && xe(e).isValid());
|
|
1916
1911
|
}
|
|
1917
1912
|
validatorFormula(e) {
|
|
1918
1913
|
const t = e.operator;
|
|
@@ -1980,18 +1975,18 @@ class xi extends We {
|
|
|
1980
1975
|
return n ? r.isBefore(n) || r.isSame(n) : !0;
|
|
1981
1976
|
}
|
|
1982
1977
|
validatorFormulaValue(e) {
|
|
1983
|
-
if (
|
|
1978
|
+
if (!U.isDefine(e.operator))
|
|
1984
1979
|
return;
|
|
1985
1980
|
if (st.includes(e.operator)) {
|
|
1986
|
-
if (
|
|
1981
|
+
if (U.isBlank(e.formula1) || U.isBlank(e.formula2))
|
|
1987
1982
|
return "";
|
|
1988
1983
|
if (!Wa(e.formula1) || !Wa(e.formula2))
|
|
1989
1984
|
return "";
|
|
1990
|
-
} else if (
|
|
1985
|
+
} else if (U.isBlank(e.formula1))
|
|
1991
1986
|
return "";
|
|
1992
1987
|
}
|
|
1993
1988
|
get operatorNames() {
|
|
1994
|
-
return this.operators.map((e) => this.localeService.t(
|
|
1989
|
+
return this.operators.map((e) => this.localeService.t(Pi[e]));
|
|
1995
1990
|
}
|
|
1996
1991
|
generateRuleName(e) {
|
|
1997
1992
|
var r, n;
|
|
@@ -2002,16 +1997,16 @@ class xi extends We {
|
|
|
2002
1997
|
}
|
|
2003
1998
|
generateRuleErrorMessage(e) {
|
|
2004
1999
|
var r, n;
|
|
2005
|
-
return e.operator ? `${this.localeService.t(
|
|
2000
|
+
return e.operator ? `${this.localeService.t(xi[e.operator]).replace($a, (r = e.formula1) != null ? r : "").replace(Ua, (n = e.formula2) != null ? n : "")}` : this.titleStr;
|
|
2006
2001
|
}
|
|
2007
2002
|
}
|
|
2008
|
-
var
|
|
2009
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2003
|
+
var Bi = Object.defineProperty, $i = Object.getOwnPropertyDescriptor, Ui = (o, a, e, t) => {
|
|
2004
|
+
for (var r = t > 1 ? void 0 : t ? $i(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
2010
2005
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
2011
|
-
return t && r &&
|
|
2006
|
+
return t && r && Bi(a, e, r), r;
|
|
2012
2007
|
}, Ha = (o, a) => (e, t) => a(e, t, o);
|
|
2013
|
-
const
|
|
2014
|
-
function
|
|
2008
|
+
const He = 4, Wi = 6, fe = 14, Ne = 6, Se = 2, Hi = "#565656", ka = 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");
|
|
2009
|
+
function ki(o, a) {
|
|
2015
2010
|
const e = o.length;
|
|
2016
2011
|
return {
|
|
2017
2012
|
id: "d",
|
|
@@ -2051,10 +2046,10 @@ function Hi(o, a) {
|
|
|
2051
2046
|
}
|
|
2052
2047
|
};
|
|
2053
2048
|
}
|
|
2054
|
-
function
|
|
2055
|
-
const t =
|
|
2049
|
+
function la(o, a, e) {
|
|
2050
|
+
const t = ki(o, e), r = new Qr(t), n = new Wo(r);
|
|
2056
2051
|
return {
|
|
2057
|
-
documentSkeleton:
|
|
2052
|
+
documentSkeleton: Ho.create(n, a),
|
|
2058
2053
|
docModel: r,
|
|
2059
2054
|
docViewModel: n
|
|
2060
2055
|
};
|
|
@@ -2064,9 +2059,9 @@ function Ya(o, a, e) {
|
|
|
2064
2059
|
documentSkeleton: t,
|
|
2065
2060
|
docModel: r,
|
|
2066
2061
|
docViewModel: n
|
|
2067
|
-
} =
|
|
2062
|
+
} = la(o, a, e);
|
|
2068
2063
|
return {
|
|
2069
|
-
documents: new
|
|
2064
|
+
documents: new ko(`DOCUMENTS_${U.generateRandomId()}`, t, {
|
|
2070
2065
|
pageMarginLeft: 0,
|
|
2071
2066
|
pageMarginTop: 0
|
|
2072
2067
|
}),
|
|
@@ -2075,8 +2070,8 @@ function Ya(o, a, e) {
|
|
|
2075
2070
|
docViewModel: n
|
|
2076
2071
|
};
|
|
2077
2072
|
}
|
|
2078
|
-
var
|
|
2079
|
-
let
|
|
2073
|
+
var Qt;
|
|
2074
|
+
let da = (Qt = class {
|
|
2080
2075
|
constructor(o, a) {
|
|
2081
2076
|
g(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
|
2082
2077
|
g(this, "zIndex");
|
|
@@ -2106,122 +2101,122 @@ let ca = (Kt = class {
|
|
|
2106
2101
|
}
|
|
2107
2102
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
2108
2103
|
drawWith(o, a, e) {
|
|
2109
|
-
var X,
|
|
2110
|
-
const { primaryWithCoord: t, row: r, col: n, style: i, data: s, subUnitId: l } = a, d = t.isMergedMainCell ? t.mergeInfo : t, c = (X = s.dataValidation) == null ? void 0 : X.rule,
|
|
2111
|
-
if (!c || !
|
|
2104
|
+
var X, x;
|
|
2105
|
+
const { primaryWithCoord: t, row: r, col: n, style: i, data: s, subUnitId: l } = a, d = t.isMergedMainCell ? t.mergeInfo : t, c = (X = s.dataValidation) == null ? void 0 : X.rule, h = (x = s.dataValidation) == null ? void 0 : x.validator, u = s.fontRenderExtension, { leftOffset: f = 0, rightOffset: m = 0, topOffset: v = 0, downOffset: R = 0 } = u || {};
|
|
2106
|
+
if (!c || !h || !h.skipDefaultFontRender(c))
|
|
2112
2107
|
return;
|
|
2113
2108
|
const S = {
|
|
2114
2109
|
startX: d.startX + f,
|
|
2115
2110
|
endX: d.endX - m,
|
|
2116
2111
|
startY: d.startY + v,
|
|
2117
2112
|
endY: d.endY - R
|
|
2118
|
-
},
|
|
2119
|
-
let { tb:
|
|
2120
|
-
if (
|
|
2121
|
-
this._drawDownIcon(o, S,
|
|
2122
|
-
const
|
|
2123
|
-
|
|
2124
|
-
const
|
|
2125
|
-
let
|
|
2126
|
-
switch (
|
|
2113
|
+
}, V = S.endX - S.startX, _ = S.endY - S.startY, I = this._ensureMap(l), D = this._generateKey(r, n), N = h.getListWithColor(c), E = ne(s), L = `${E != null ? E : ""}`, j = N.find((b) => b.label === L);
|
|
2114
|
+
let { tb: A, vt: P, ht: B } = i || {};
|
|
2115
|
+
if (A = A != null ? A : pe.WRAP, P = P != null ? P : re.TOP, B = B != null ? B : Ve.LEFT, c.renderMode === ue.ARROW) {
|
|
2116
|
+
this._drawDownIcon(o, S, V, _, P), o.save(), o.translateWithPrecision(S.startX, S.startY), o.beginPath(), o.rect(0, 0, V, _), o.clip();
|
|
2117
|
+
const b = V - fe, { documentSkeleton: k, documents: ee, docModel: Y } = Ya(L, this._localeService, i);
|
|
2118
|
+
A === pe.WRAP && Y.updateDocumentDataPageSize(Math.max(b, 1)), k.calculate(), k.getActualSize();
|
|
2119
|
+
const M = mt(k), { height: O, width: z } = M;
|
|
2120
|
+
let $ = 0;
|
|
2121
|
+
switch (P) {
|
|
2127
2122
|
case re.BOTTOM:
|
|
2128
|
-
|
|
2123
|
+
$ = _ - Se - O;
|
|
2129
2124
|
break;
|
|
2130
2125
|
case re.MIDDLE:
|
|
2131
|
-
|
|
2126
|
+
$ = (_ - Se - O) / 2;
|
|
2132
2127
|
break;
|
|
2133
2128
|
default:
|
|
2134
|
-
|
|
2129
|
+
$ = Se;
|
|
2135
2130
|
break;
|
|
2136
2131
|
}
|
|
2137
|
-
let
|
|
2138
|
-
switch (
|
|
2132
|
+
let ae = 0;
|
|
2133
|
+
switch (B) {
|
|
2139
2134
|
case Ve.CENTER:
|
|
2140
|
-
|
|
2135
|
+
ae = (b - z) / 2;
|
|
2141
2136
|
break;
|
|
2142
2137
|
case Ve.RIGHT:
|
|
2143
|
-
|
|
2138
|
+
ae = b - z;
|
|
2144
2139
|
break;
|
|
2145
2140
|
}
|
|
2146
|
-
o.translate(0,
|
|
2141
|
+
o.translate(0, $), o.save(), o.translateWithPrecision(He, 0), o.beginPath(), o.rect(0, 0, b, O), o.clip(), ee.render(o), o.translateWithPrecision(ae, 0), o.restore(), o.restore(), I.set(D, {
|
|
2147
2142
|
left: S.endX + e.rowHeaderWidth - fe,
|
|
2148
2143
|
top: S.startY + e.columnHeaderHeight,
|
|
2149
2144
|
width: fe,
|
|
2150
2145
|
height: _
|
|
2151
2146
|
});
|
|
2152
2147
|
} else {
|
|
2153
|
-
o.save(), o.translateWithPrecision(S.startX, S.startY), o.beginPath(), o.rect(0, 0,
|
|
2154
|
-
const
|
|
2155
|
-
|
|
2156
|
-
const
|
|
2157
|
-
let
|
|
2158
|
-
switch (
|
|
2148
|
+
o.save(), o.translateWithPrecision(S.startX, S.startY), o.beginPath(), o.rect(0, 0, V, _), o.clip();
|
|
2149
|
+
const b = V - Ne * 2 - He - fe, { documentSkeleton: k, documents: ee, docModel: Y } = Ya(L, this._localeService, i);
|
|
2150
|
+
A === pe.WRAP && Y.updateDocumentDataPageSize(Math.max(b, 1)), k.calculate();
|
|
2151
|
+
const M = mt(k), { height: O, width: z } = M;
|
|
2152
|
+
let $ = 0;
|
|
2153
|
+
switch (P) {
|
|
2159
2154
|
case re.BOTTOM:
|
|
2160
|
-
|
|
2155
|
+
$ = _ - Se - O;
|
|
2161
2156
|
break;
|
|
2162
2157
|
case re.MIDDLE:
|
|
2163
|
-
|
|
2158
|
+
$ = (_ - Se - O) / 2;
|
|
2164
2159
|
break;
|
|
2165
2160
|
default:
|
|
2166
|
-
|
|
2161
|
+
$ = Se;
|
|
2167
2162
|
break;
|
|
2168
2163
|
}
|
|
2169
|
-
let
|
|
2170
|
-
switch (
|
|
2164
|
+
let ae = 0;
|
|
2165
|
+
switch (B) {
|
|
2171
2166
|
case Ve.CENTER:
|
|
2172
|
-
|
|
2167
|
+
ae = (b - z) / 2;
|
|
2173
2168
|
break;
|
|
2174
2169
|
case Ve.RIGHT:
|
|
2175
|
-
|
|
2170
|
+
ae = b - z;
|
|
2176
2171
|
break;
|
|
2177
2172
|
}
|
|
2178
|
-
o.translate(Ne,
|
|
2179
|
-
const
|
|
2180
|
-
|
|
2181
|
-
width:
|
|
2182
|
-
height:
|
|
2183
|
-
fill: (
|
|
2173
|
+
o.translate(Ne, $);
|
|
2174
|
+
const y = Math.max(V - Ne * 2, 1), W = O;
|
|
2175
|
+
sr.drawWith(o, {
|
|
2176
|
+
width: y,
|
|
2177
|
+
height: W,
|
|
2178
|
+
fill: (j == null ? void 0 : j.color) || Le,
|
|
2184
2179
|
radius: 8
|
|
2185
|
-
}), o.save(), o.translateWithPrecision(
|
|
2180
|
+
}), o.save(), o.translateWithPrecision(He, 0), o.beginPath(), o.rect(0, 0, b, O), o.clip(), o.translateWithPrecision(ae, 0), ee.render(o), o.restore(), o.translate(b + He + 4, (O - Wi) / 2), o.fillStyle = Hi, o.fill(ka), o.restore(), I.set(D, {
|
|
2186
2181
|
left: S.startX + Ne + e.rowHeaderWidth,
|
|
2187
|
-
top: S.startY +
|
|
2188
|
-
width:
|
|
2189
|
-
height:
|
|
2182
|
+
top: S.startY + $ + e.columnHeaderHeight,
|
|
2183
|
+
width: y,
|
|
2184
|
+
height: W
|
|
2190
2185
|
});
|
|
2191
2186
|
}
|
|
2192
2187
|
}
|
|
2193
2188
|
calcCellAutoHeight(o) {
|
|
2194
2189
|
var R;
|
|
2195
2190
|
const { primaryWithCoord: a, style: e, data: t } = o, r = a.isMergedMainCell ? a.mergeInfo : a, n = t.fontRenderExtension, { leftOffset: i = 0, rightOffset: s = 0, topOffset: l = 0, downOffset: d = 0 } = n || {}, c = (R = t.dataValidation) == null ? void 0 : R.rule;
|
|
2196
|
-
if (!c || c.renderMode ===
|
|
2191
|
+
if (!c || c.renderMode === ue.TEXT)
|
|
2197
2192
|
return;
|
|
2198
|
-
const
|
|
2193
|
+
const h = {
|
|
2199
2194
|
startX: r.startX + i,
|
|
2200
2195
|
endX: r.endX - s,
|
|
2201
2196
|
startY: r.startY + l,
|
|
2202
2197
|
endY: r.endY - d
|
|
2203
|
-
},
|
|
2198
|
+
}, u = h.endX - h.startX, f = ne(t), m = `${f != null ? f : ""}`;
|
|
2204
2199
|
let { tb: v } = e || {};
|
|
2205
|
-
if (v = v != null ? v :
|
|
2206
|
-
const S =
|
|
2207
|
-
v ===
|
|
2208
|
-
const I = mt(
|
|
2209
|
-
return
|
|
2200
|
+
if (v = v != null ? v : pe.WRAP, c.renderMode === ue.ARROW) {
|
|
2201
|
+
const S = u - fe, { documentSkeleton: V, docModel: _ } = la(m, this._localeService, e);
|
|
2202
|
+
v === pe.WRAP && _.updateDocumentDataPageSize(Math.max(S, 1)), V.calculate(), V.getActualSize();
|
|
2203
|
+
const I = mt(V), { height: D } = I;
|
|
2204
|
+
return D;
|
|
2210
2205
|
} else {
|
|
2211
|
-
const S =
|
|
2212
|
-
v ===
|
|
2213
|
-
const I = mt(
|
|
2214
|
-
height:
|
|
2206
|
+
const S = u - Ne * 2 - He - fe, { documentSkeleton: V, docModel: _ } = la(m, this._localeService, e);
|
|
2207
|
+
v === pe.WRAP && _.updateDocumentDataPageSize(Math.max(S, 1)), V.calculate();
|
|
2208
|
+
const I = mt(V), {
|
|
2209
|
+
height: D
|
|
2215
2210
|
} = I;
|
|
2216
|
-
return
|
|
2211
|
+
return D + Se * 2;
|
|
2217
2212
|
}
|
|
2218
2213
|
}
|
|
2219
2214
|
isHit(o, a) {
|
|
2220
2215
|
const { data: e, subUnitId: t, row: r, col: n } = a, s = this._ensureMap(t).get(this._generateKey(r, n)), l = e.dataValidation;
|
|
2221
|
-
if (!l || !s || l.rule.renderMode ===
|
|
2216
|
+
if (!l || !s || l.rule.renderMode === ue.TEXT)
|
|
2222
2217
|
return !1;
|
|
2223
|
-
const { top: d, left: c, width:
|
|
2224
|
-
return f >= c && f <= c +
|
|
2218
|
+
const { top: d, left: c, width: h, height: u } = s, { x: f, y: m } = o;
|
|
2219
|
+
return f >= c && f <= c + h && m >= d && m <= d + u;
|
|
2225
2220
|
}
|
|
2226
2221
|
onPointerDown(o, a) {
|
|
2227
2222
|
if (a.button === 2)
|
|
@@ -2232,74 +2227,74 @@ let ca = (Kt = class {
|
|
|
2232
2227
|
row: r,
|
|
2233
2228
|
column: n
|
|
2234
2229
|
};
|
|
2235
|
-
this._commandService.executeCommand(
|
|
2230
|
+
this._commandService.executeCommand(Ca.id, i);
|
|
2236
2231
|
}
|
|
2237
|
-
}, g(
|
|
2238
|
-
l: Ne +
|
|
2232
|
+
}, g(Qt, "padding", {
|
|
2233
|
+
l: Ne + He,
|
|
2239
2234
|
r: fe + Ne,
|
|
2240
|
-
t:
|
|
2241
|
-
b:
|
|
2242
|
-
}),
|
|
2243
|
-
|
|
2244
|
-
Ha(0,
|
|
2235
|
+
t: Se,
|
|
2236
|
+
b: Se
|
|
2237
|
+
}), Qt);
|
|
2238
|
+
da = Ui([
|
|
2239
|
+
Ha(0, w(le)),
|
|
2245
2240
|
Ha(1, te)
|
|
2246
|
-
],
|
|
2247
|
-
const
|
|
2248
|
-
function
|
|
2241
|
+
], da);
|
|
2242
|
+
const Yi = "LIST_RENDER_MODE_OPTION_INPUT";
|
|
2243
|
+
function Ot(o) {
|
|
2249
2244
|
var r;
|
|
2250
|
-
const { value: a, onChange: e } = o, t =
|
|
2251
|
-
return /* @__PURE__ */ p.jsx(K, { label: t.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ p.jsxs(
|
|
2252
|
-
/* @__PURE__ */ p.jsx(
|
|
2253
|
-
/* @__PURE__ */ p.jsx(
|
|
2254
|
-
/* @__PURE__ */ p.jsx(
|
|
2245
|
+
const { value: a, onChange: e } = o, t = T(le);
|
|
2246
|
+
return /* @__PURE__ */ p.jsx(K, { label: t.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ p.jsxs(Sa, { value: `${(r = a.renderMode) != null ? r : ue.CUSTOM}`, onChange: (n) => e({ ...a, renderMode: +n }), children: [
|
|
2247
|
+
/* @__PURE__ */ p.jsx(Pe, { value: `${ue.CUSTOM}`, children: t.t("dataValidation.renderMode.chip") }),
|
|
2248
|
+
/* @__PURE__ */ p.jsx(Pe, { value: `${ue.ARROW}`, children: t.t("dataValidation.renderMode.arrow") }),
|
|
2249
|
+
/* @__PURE__ */ p.jsx(Pe, { value: `${ue.TEXT}`, children: t.t("dataValidation.renderMode.text") })
|
|
2255
2250
|
] }) });
|
|
2256
2251
|
}
|
|
2257
|
-
|
|
2258
|
-
function
|
|
2252
|
+
Ot.componentKey = Yi;
|
|
2253
|
+
function Wt(o) {
|
|
2259
2254
|
if (!o)
|
|
2260
2255
|
return [];
|
|
2261
2256
|
const a = /* @__PURE__ */ new Set();
|
|
2262
2257
|
return o.forEach(
|
|
2263
2258
|
(e) => {
|
|
2264
2259
|
e.forEach((t) => {
|
|
2265
|
-
const r =
|
|
2260
|
+
const r = ne(t);
|
|
2266
2261
|
r != null && a.add(r.toString());
|
|
2267
2262
|
});
|
|
2268
2263
|
}
|
|
2269
2264
|
), [...a];
|
|
2270
2265
|
}
|
|
2271
|
-
const
|
|
2266
|
+
const Gi = [
|
|
2272
2267
|
"if",
|
|
2273
2268
|
"indirect",
|
|
2274
2269
|
"choose",
|
|
2275
2270
|
"offset"
|
|
2276
2271
|
];
|
|
2277
|
-
function
|
|
2278
|
-
if (!
|
|
2272
|
+
function Xi(o, a) {
|
|
2273
|
+
if (!F(o) || cr(o.slice(1)))
|
|
2279
2274
|
return !0;
|
|
2280
2275
|
const t = a.sequenceNodesBuilder(o);
|
|
2281
|
-
return t && t.some((r) => typeof r == "object" && r.nodeType ===
|
|
2276
|
+
return t && t.some((r) => typeof r == "object" && r.nodeType === en.FUNCTION && Gi.indexOf(r.token.toLowerCase()) > -1);
|
|
2282
2277
|
}
|
|
2283
|
-
class
|
|
2278
|
+
class Nr extends $e {
|
|
2284
2279
|
constructor() {
|
|
2285
2280
|
super(...arguments);
|
|
2286
2281
|
g(this, "formulaService", this.injector.get(he));
|
|
2287
|
-
g(this, "_lexer", this.injector.get(
|
|
2288
|
-
g(this, "id",
|
|
2282
|
+
g(this, "_lexer", this.injector.get(Ra));
|
|
2283
|
+
g(this, "id", q.LIST);
|
|
2289
2284
|
g(this, "title", "dataValidation.list.title");
|
|
2290
2285
|
g(this, "operators", []);
|
|
2291
2286
|
g(this, "scopes", ["sheet"]);
|
|
2292
2287
|
g(this, "formulaInput", br);
|
|
2293
|
-
g(this, "canvasRender", this.injector.createInstance(
|
|
2294
|
-
g(this, "dropdown",
|
|
2295
|
-
g(this, "optionsInput",
|
|
2288
|
+
g(this, "canvasRender", this.injector.createInstance(da));
|
|
2289
|
+
g(this, "dropdown", Ar);
|
|
2290
|
+
g(this, "optionsInput", Ot.componentKey);
|
|
2296
2291
|
}
|
|
2297
2292
|
skipDefaultFontRender(e) {
|
|
2298
|
-
return e.renderMode !==
|
|
2293
|
+
return e.renderMode !== ue.TEXT;
|
|
2299
2294
|
}
|
|
2300
2295
|
validatorFormula(e) {
|
|
2301
2296
|
var n;
|
|
2302
|
-
const t =
|
|
2297
|
+
const t = !U.isBlank(e.formula1), r = Xi((n = e.formula1) != null ? n : "", this._lexer);
|
|
2303
2298
|
return {
|
|
2304
2299
|
success: !!(t && r),
|
|
2305
2300
|
formula1: t ? r ? void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -2313,7 +2308,7 @@ class Fr extends We {
|
|
|
2313
2308
|
var s;
|
|
2314
2309
|
const { formula1: n = "" } = e, i = await this.formulaService.getRuleFormulaResult(t, r, e.uid);
|
|
2315
2310
|
return {
|
|
2316
|
-
formula1:
|
|
2311
|
+
formula1: F(n) ? Wt((s = i == null ? void 0 : i[0]) == null ? void 0 : s.result) : Ge(n),
|
|
2317
2312
|
formula2: void 0
|
|
2318
2313
|
};
|
|
2319
2314
|
}
|
|
@@ -2328,20 +2323,20 @@ class Fr extends We {
|
|
|
2328
2323
|
return this.localeService.t("dataValidation.list.error");
|
|
2329
2324
|
}
|
|
2330
2325
|
getList(e, t, r) {
|
|
2331
|
-
var
|
|
2332
|
-
const { formula1: n = "" } = e, i = this.injector.get(
|
|
2326
|
+
var u, f, m;
|
|
2327
|
+
const { formula1: n = "" } = e, i = this.injector.get(ie), s = (u = t ? i.getUniverSheetInstance(t) : void 0) != null ? u : i.getCurrentUnitForType(se.UNIVER_SHEET);
|
|
2333
2328
|
if (!s)
|
|
2334
2329
|
return [];
|
|
2335
|
-
const l = (f = r ? s.getSheetBySheetId(r) : void 0) != null ? f : s.getActiveSheet(), d = s.getUnitId(), c = l.getSheetId(),
|
|
2336
|
-
return
|
|
2330
|
+
const l = (f = r ? s.getSheetBySheetId(r) : void 0) != null ? f : s.getActiveSheet(), d = s.getUnitId(), c = l.getSheetId(), h = this.formulaService.getRuleFormulaResultSync(d, c, e.uid);
|
|
2331
|
+
return F(n) ? Wt((m = h == null ? void 0 : h[0]) == null ? void 0 : m.result) : Ge(n);
|
|
2337
2332
|
}
|
|
2338
2333
|
async getListAsync(e, t, r) {
|
|
2339
|
-
var
|
|
2340
|
-
const { formula1: n = "" } = e, i = this.injector.get(
|
|
2334
|
+
var u, f, m;
|
|
2335
|
+
const { formula1: n = "" } = e, i = this.injector.get(ie), s = (u = t ? i.getUniverSheetInstance(t) : void 0) != null ? u : i.getCurrentUnitForType(se.UNIVER_SHEET);
|
|
2341
2336
|
if (!s)
|
|
2342
2337
|
return [];
|
|
2343
|
-
const l = (f = r ? s.getSheetBySheetId(r) : void 0) != null ? f : s.getActiveSheet(), d = s.getUnitId(), c = l.getSheetId(),
|
|
2344
|
-
return
|
|
2338
|
+
const l = (f = r ? s.getSheetBySheetId(r) : void 0) != null ? f : s.getActiveSheet(), d = s.getUnitId(), c = l.getSheetId(), h = await this.formulaService.getRuleFormulaResult(d, c, e.uid);
|
|
2339
|
+
return F(n) ? Wt((m = h == null ? void 0 : h[0]) == null ? void 0 : m.result) : Ge(n);
|
|
2345
2340
|
}
|
|
2346
2341
|
getListWithColor(e, t, r) {
|
|
2347
2342
|
const n = this.getList(e, t, r), i = (e.formula2 || "").split(",");
|
|
@@ -2354,15 +2349,15 @@ class Fr extends We {
|
|
|
2354
2349
|
}), i;
|
|
2355
2350
|
}
|
|
2356
2351
|
}
|
|
2357
|
-
function
|
|
2352
|
+
function bt(o) {
|
|
2358
2353
|
let a = o;
|
|
2359
2354
|
return typeof o == "string" ? ((o.startsWith("¥") || o.startsWith("$")) && (a = o.slice(1)), +a) : +o;
|
|
2360
2355
|
}
|
|
2361
|
-
class
|
|
2356
|
+
class qi extends $e {
|
|
2362
2357
|
constructor() {
|
|
2363
2358
|
super(...arguments);
|
|
2364
2359
|
g(this, "_formulaService", this.injector.get(he));
|
|
2365
|
-
g(this, "id",
|
|
2360
|
+
g(this, "id", q.DECIMAL);
|
|
2366
2361
|
g(this, "title", "dataValidation.decimal.title");
|
|
2367
2362
|
g(this, "operators", [
|
|
2368
2363
|
C.BETWEEN,
|
|
@@ -2379,28 +2374,28 @@ class Xi extends We {
|
|
|
2379
2374
|
g(this, "dropDownInput");
|
|
2380
2375
|
}
|
|
2381
2376
|
_isFormulaOrNumber(e) {
|
|
2382
|
-
return
|
|
2377
|
+
return !U.isBlank(e) && (F(e) || !Number.isNaN(+e));
|
|
2383
2378
|
}
|
|
2384
2379
|
async isValidType(e, t, r) {
|
|
2385
2380
|
const { value: n } = e;
|
|
2386
|
-
return !Number.isNaN(
|
|
2381
|
+
return !Number.isNaN(bt(n));
|
|
2387
2382
|
}
|
|
2388
2383
|
transform(e, t, r) {
|
|
2389
2384
|
const { value: n } = e;
|
|
2390
2385
|
return {
|
|
2391
2386
|
...e,
|
|
2392
|
-
value:
|
|
2387
|
+
value: bt(n)
|
|
2393
2388
|
};
|
|
2394
2389
|
}
|
|
2395
2390
|
_parseNumber(e) {
|
|
2396
2391
|
return e == null ? Number.NaN : +e;
|
|
2397
2392
|
}
|
|
2398
2393
|
async parseFormula(e, t, r) {
|
|
2399
|
-
var d, c,
|
|
2394
|
+
var d, c, h, u, f, m, v, R;
|
|
2400
2395
|
const n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), { formula1: i, formula2: s } = e;
|
|
2401
2396
|
return {
|
|
2402
|
-
formula1: this._parseNumber(
|
|
2403
|
-
formula2: this._parseNumber(
|
|
2397
|
+
formula1: this._parseNumber(F(i) ? (u = (h = (c = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : c[0]) == null ? void 0 : h[0]) == null ? void 0 : u.v : i),
|
|
2398
|
+
formula2: this._parseNumber(F(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)
|
|
2404
2399
|
};
|
|
2405
2400
|
}
|
|
2406
2401
|
validatorFormula(e) {
|
|
@@ -2409,7 +2404,7 @@ class Xi extends We {
|
|
|
2409
2404
|
return {
|
|
2410
2405
|
success: !1
|
|
2411
2406
|
};
|
|
2412
|
-
const r =
|
|
2407
|
+
const r = U.isDefine(e.formula1) && this._isFormulaOrNumber(e.formula1), n = U.isDefine(e.formula2) && this._isFormulaOrNumber(e.formula2), i = st.includes(t), s = this.localeService.t("dataValidation.validFail.number");
|
|
2413
2408
|
return i ? {
|
|
2414
2409
|
success: r && n,
|
|
2415
2410
|
formula1: r ? void 0 : s,
|
|
@@ -2458,11 +2453,11 @@ class Xi extends We {
|
|
|
2458
2453
|
return Number.isNaN(n) ? !0 : e.value <= n;
|
|
2459
2454
|
}
|
|
2460
2455
|
}
|
|
2461
|
-
const
|
|
2462
|
-
class
|
|
2456
|
+
const zi = "{FORMULA1}", Qi = "{FORMULA2}";
|
|
2457
|
+
class Ki extends $e {
|
|
2463
2458
|
constructor() {
|
|
2464
2459
|
super(...arguments);
|
|
2465
|
-
g(this, "id",
|
|
2460
|
+
g(this, "id", q.TEXT_LENGTH);
|
|
2466
2461
|
g(this, "title", "dataValidation.textLength.title");
|
|
2467
2462
|
g(this, "operators", [
|
|
2468
2463
|
C.BETWEEN,
|
|
@@ -2479,7 +2474,7 @@ class Qi extends We {
|
|
|
2479
2474
|
g(this, "_formulaService", this.injector.get(he));
|
|
2480
2475
|
}
|
|
2481
2476
|
_isFormulaOrInt(e) {
|
|
2482
|
-
return
|
|
2477
|
+
return !U.isBlank(e) && (F(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2483
2478
|
}
|
|
2484
2479
|
validatorFormula(e) {
|
|
2485
2480
|
const t = e.operator;
|
|
@@ -2487,7 +2482,7 @@ class Qi extends We {
|
|
|
2487
2482
|
return {
|
|
2488
2483
|
success: !1
|
|
2489
2484
|
};
|
|
2490
|
-
const r =
|
|
2485
|
+
const r = U.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = U.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), i = st.includes(t), s = this.localeService.t("dataValidation.validFail.number");
|
|
2491
2486
|
return i ? {
|
|
2492
2487
|
success: r && n,
|
|
2493
2488
|
formula1: r ? void 0 : s,
|
|
@@ -2504,11 +2499,11 @@ class Qi extends We {
|
|
|
2504
2499
|
return !Number.isNaN(e);
|
|
2505
2500
|
}
|
|
2506
2501
|
async parseFormula(e, t, r) {
|
|
2507
|
-
var l, d, c,
|
|
2502
|
+
var l, d, c, h, u, f, m, v;
|
|
2508
2503
|
const n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), { formula1: i, formula2: s } = e;
|
|
2509
2504
|
return {
|
|
2510
|
-
formula1: this._parseNumber(
|
|
2511
|
-
formula2: this._parseNumber(
|
|
2505
|
+
formula1: this._parseNumber(F(i) ? (h = (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 : h.v : i),
|
|
2506
|
+
formula2: this._parseNumber(F(s) ? (v = (m = (f = (u = n == null ? void 0 : n[1]) == null ? void 0 : u.result) == null ? void 0 : f[0]) == null ? void 0 : m[0]) == null ? void 0 : v.v : s)
|
|
2512
2507
|
};
|
|
2513
2508
|
}
|
|
2514
2509
|
transform(e, t, r) {
|
|
@@ -2523,11 +2518,11 @@ class Qi extends We {
|
|
|
2523
2518
|
}
|
|
2524
2519
|
async validatorIsEqual(e, t, r) {
|
|
2525
2520
|
const { formula1: n } = t;
|
|
2526
|
-
return
|
|
2521
|
+
return U.isDefine(n) ? e.value === n : !1;
|
|
2527
2522
|
}
|
|
2528
2523
|
async validatorIsNotEqual(e, t, r) {
|
|
2529
2524
|
const { formula1: n } = t;
|
|
2530
|
-
return
|
|
2525
|
+
return U.isDefine(n) ? e.value !== n : !1;
|
|
2531
2526
|
}
|
|
2532
2527
|
async validatorIsBetween(e, t, r) {
|
|
2533
2528
|
const { formula1: n, formula2: i } = t, { value: s } = e;
|
|
@@ -2561,14 +2556,14 @@ class Qi extends We {
|
|
|
2561
2556
|
}
|
|
2562
2557
|
generateRuleErrorMessage(e) {
|
|
2563
2558
|
var r, n;
|
|
2564
|
-
return e.operator ? `${this.localeService.t(
|
|
2559
|
+
return e.operator ? `${this.localeService.t(no[e.operator]).replace(zi, (r = e.formula1) != null ? r : "").replace(Qi, (n = e.formula2) != null ? n : "")}` : this.titleStr;
|
|
2565
2560
|
}
|
|
2566
2561
|
}
|
|
2567
|
-
class
|
|
2562
|
+
class Zi extends $e {
|
|
2568
2563
|
constructor() {
|
|
2569
2564
|
super(...arguments);
|
|
2570
2565
|
g(this, "_formulaService", this.injector.get(he));
|
|
2571
|
-
g(this, "id",
|
|
2566
|
+
g(this, "id", q.WHOLE);
|
|
2572
2567
|
g(this, "title", "dataValidation.whole.title");
|
|
2573
2568
|
g(this, "operators", [
|
|
2574
2569
|
C.BETWEEN,
|
|
@@ -2585,28 +2580,28 @@ class Ki extends We {
|
|
|
2585
2580
|
g(this, "dropDownInput");
|
|
2586
2581
|
}
|
|
2587
2582
|
_isFormulaOrInt(e) {
|
|
2588
|
-
return
|
|
2583
|
+
return !U.isBlank(e) && (F(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2589
2584
|
}
|
|
2590
2585
|
async isValidType(e, t, r) {
|
|
2591
|
-
const { value: n } = e, i =
|
|
2586
|
+
const { value: n } = e, i = bt(n);
|
|
2592
2587
|
return !Number.isNaN(i) && Number.isInteger(i);
|
|
2593
2588
|
}
|
|
2594
2589
|
transform(e, t, r) {
|
|
2595
2590
|
const { value: n } = e;
|
|
2596
2591
|
return {
|
|
2597
2592
|
...e,
|
|
2598
|
-
value:
|
|
2593
|
+
value: bt(n)
|
|
2599
2594
|
};
|
|
2600
2595
|
}
|
|
2601
2596
|
_parseNumber(e) {
|
|
2602
2597
|
return e == null ? Number.NaN : +e;
|
|
2603
2598
|
}
|
|
2604
2599
|
async parseFormula(e, t, r) {
|
|
2605
|
-
var d, c,
|
|
2600
|
+
var d, c, h, u, f, m, v, R;
|
|
2606
2601
|
const n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), { formula1: i, formula2: s } = e;
|
|
2607
2602
|
return {
|
|
2608
|
-
formula1: this._parseNumber(
|
|
2609
|
-
formula2: this._parseNumber(
|
|
2603
|
+
formula1: this._parseNumber(F(i) ? (u = (h = (c = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : c[0]) == null ? void 0 : h[0]) == null ? void 0 : u.v : i),
|
|
2604
|
+
formula2: this._parseNumber(F(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)
|
|
2610
2605
|
};
|
|
2611
2606
|
}
|
|
2612
2607
|
validatorFormula(e) {
|
|
@@ -2615,7 +2610,7 @@ class Ki extends We {
|
|
|
2615
2610
|
return {
|
|
2616
2611
|
success: !1
|
|
2617
2612
|
};
|
|
2618
|
-
const r =
|
|
2613
|
+
const r = U.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = U.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), i = st.includes(t), s = this.localeService.t("dataValidation.validFail.number");
|
|
2619
2614
|
return i ? {
|
|
2620
2615
|
success: r && n,
|
|
2621
2616
|
formula1: r ? void 0 : s,
|
|
@@ -2664,26 +2659,26 @@ class Ki extends We {
|
|
|
2664
2659
|
return Number.isNaN(n) ? !0 : e.value <= n;
|
|
2665
2660
|
}
|
|
2666
2661
|
}
|
|
2667
|
-
const
|
|
2668
|
-
function
|
|
2669
|
-
const e =
|
|
2662
|
+
const Fr = 4, Ji = 0, Ht = 4, Lr = 4, ca = 6, Tt = 6, Fe = 14;
|
|
2663
|
+
function es(o, a) {
|
|
2664
|
+
const e = Yo.getTextSize(o, a), t = e.width + Fr * 2, { ba: r, bd: n } = e, i = r + n;
|
|
2670
2665
|
return {
|
|
2671
2666
|
width: t,
|
|
2672
|
-
height: i +
|
|
2667
|
+
height: i + Ji * 2,
|
|
2673
2668
|
ba: r
|
|
2674
2669
|
};
|
|
2675
2670
|
}
|
|
2676
2671
|
function Ga(o, a, e, t) {
|
|
2677
|
-
const r = e -
|
|
2678
|
-
layout:
|
|
2672
|
+
const r = e - Fe - ca, n = t - Tt * 2, i = o.map((c) => ({
|
|
2673
|
+
layout: es(c, a),
|
|
2679
2674
|
text: c
|
|
2680
2675
|
}));
|
|
2681
2676
|
let s;
|
|
2682
2677
|
const l = [];
|
|
2683
2678
|
i.forEach((c) => {
|
|
2684
|
-
const { layout:
|
|
2685
|
-
!s || s.width +
|
|
2686
|
-
width:
|
|
2679
|
+
const { layout: h } = c, { width: u, height: f } = h;
|
|
2680
|
+
!s || s.width + u + Ht > r ? (s = {
|
|
2681
|
+
width: u,
|
|
2687
2682
|
height: f,
|
|
2688
2683
|
items: [{
|
|
2689
2684
|
...c,
|
|
@@ -2691,39 +2686,39 @@ function Ga(o, a, e, t) {
|
|
|
2691
2686
|
}]
|
|
2692
2687
|
}, l.push(s)) : (s.items.push({
|
|
2693
2688
|
...c,
|
|
2694
|
-
left: s.width +
|
|
2695
|
-
}), s.width = s.width +
|
|
2689
|
+
left: s.width + Ht
|
|
2690
|
+
}), s.width = s.width + u + Ht);
|
|
2696
2691
|
});
|
|
2697
2692
|
let d = 0;
|
|
2698
|
-
return l.forEach((c,
|
|
2699
|
-
|
|
2693
|
+
return l.forEach((c, h) => {
|
|
2694
|
+
h === l.length - 1 ? d += c.height : d += c.height + Lr;
|
|
2700
2695
|
}), {
|
|
2701
2696
|
lines: l,
|
|
2702
2697
|
totalHeight: d,
|
|
2703
2698
|
contentWidth: r,
|
|
2704
2699
|
contentHeight: n,
|
|
2705
|
-
cellAutoHeight: d +
|
|
2700
|
+
cellAutoHeight: d + Tt * 2
|
|
2706
2701
|
};
|
|
2707
2702
|
}
|
|
2708
|
-
const
|
|
2709
|
-
class
|
|
2703
|
+
const ts = 8;
|
|
2704
|
+
class as extends Go {
|
|
2710
2705
|
static drawWith(a, e) {
|
|
2711
2706
|
const { fontFamily: t, fontString: r, fontSize: n, info: i, fill: s, color: l } = e, { layout: d, text: c } = i;
|
|
2712
|
-
a.save(),
|
|
2707
|
+
a.save(), sr.drawWith(a, {
|
|
2713
2708
|
width: d.width,
|
|
2714
2709
|
height: d.height,
|
|
2715
|
-
radius:
|
|
2716
|
-
fill: s ||
|
|
2717
|
-
}), a.translateWithPrecision(
|
|
2710
|
+
radius: ts,
|
|
2711
|
+
fill: s || Le
|
|
2712
|
+
}), a.translateWithPrecision(Fr, d.ba), a.font = r, a.fillStyle = l, a.fillText(c, 0, 0), a.restore();
|
|
2718
2713
|
}
|
|
2719
2714
|
}
|
|
2720
|
-
var
|
|
2721
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2715
|
+
var rs = Object.defineProperty, os = Object.getOwnPropertyDescriptor, ns = (o, a, e, t) => {
|
|
2716
|
+
for (var r = t > 1 ? void 0 : t ? os(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
2722
2717
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
2723
|
-
return t && r &&
|
|
2724
|
-
},
|
|
2725
|
-
const
|
|
2726
|
-
let
|
|
2718
|
+
return t && r && rs(a, e, r), r;
|
|
2719
|
+
}, is = (o, a) => (e, t) => a(e, t, o);
|
|
2720
|
+
const ss = 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");
|
|
2721
|
+
let ua = class {
|
|
2727
2722
|
constructor(o) {
|
|
2728
2723
|
g(this, "zIndex");
|
|
2729
2724
|
g(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
|
@@ -2737,65 +2732,65 @@ let ha = class {
|
|
|
2737
2732
|
return `${o}.${a}`;
|
|
2738
2733
|
}
|
|
2739
2734
|
_drawDownIcon(o, a, e, t, r) {
|
|
2740
|
-
const n = e -
|
|
2735
|
+
const n = e - Fe + 4;
|
|
2741
2736
|
let i = 4;
|
|
2742
2737
|
switch (r) {
|
|
2743
2738
|
case re.MIDDLE:
|
|
2744
|
-
i = (t -
|
|
2739
|
+
i = (t - Fe) / 2 + 4;
|
|
2745
2740
|
break;
|
|
2746
2741
|
case re.BOTTOM:
|
|
2747
|
-
i = t -
|
|
2742
|
+
i = t - Fe + 4;
|
|
2748
2743
|
break;
|
|
2749
2744
|
}
|
|
2750
|
-
o.save(), o.translateWithPrecision(a.startX + n, a.startY + i), o.fillStyle = "#565656", o.fill(
|
|
2745
|
+
o.save(), o.translateWithPrecision(a.startX + n, a.startY + i), o.fillStyle = "#565656", o.fill(ss), o.restore();
|
|
2751
2746
|
}
|
|
2752
2747
|
// eslint-disable-next-line max-lines-per-function
|
|
2753
2748
|
drawWith(o, a, e, t) {
|
|
2754
|
-
var
|
|
2755
|
-
const { primaryWithCoord: r, row: n, col: i, style: s, data: l, subUnitId: d } = a, c = r.isMergedMainCell ? r.mergeInfo : r,
|
|
2756
|
-
if (!R
|
|
2749
|
+
var O, z;
|
|
2750
|
+
const { primaryWithCoord: r, row: n, col: i, style: s, data: l, subUnitId: d } = a, c = r.isMergedMainCell ? r.mergeInfo : r, h = l.fontRenderExtension, { leftOffset: u = 0, rightOffset: f = 0, topOffset: m = 0, downOffset: v = 0 } = h || {}, R = l.dataValidation, S = this._ensureMap(d), V = this._generateKey(n, i);
|
|
2751
|
+
if (!R)
|
|
2757
2752
|
return;
|
|
2758
2753
|
const _ = {
|
|
2759
|
-
startX: c.startX +
|
|
2754
|
+
startX: c.startX + u,
|
|
2760
2755
|
endX: c.endX - f,
|
|
2761
2756
|
startY: c.startY + m,
|
|
2762
2757
|
endY: c.endY - v
|
|
2763
|
-
}, I = _.endX - _.startX,
|
|
2764
|
-
this._drawDownIcon(o, _, I,
|
|
2765
|
-
let
|
|
2766
|
-
switch (
|
|
2758
|
+
}, I = _.endX - _.startX, D = _.endY - _.startY, { cl: N } = s || {}, E = (O = typeof N == "object" ? N == null ? void 0 : N.rgb : N) != null ? O : "#000", L = Pa(s != null ? s : void 0), { rule: j, validator: A } = R, P = A, { vt: B, ht: X } = s || {}, x = B != null ? B : re.MIDDLE, b = (z = ne(l)) != null ? z : "", k = P.parseCellValue(b), ee = P.getListWithColorMap(j), Y = Ga(k, L, I, D);
|
|
2759
|
+
this._drawDownIcon(o, _, I, D, x), o.save(), o.translateWithPrecision(_.startX, _.startY), o.beginPath(), o.rect(0, 0, I - Fe, D), o.clip(), o.translateWithPrecision(ca, Tt);
|
|
2760
|
+
let M = 0;
|
|
2761
|
+
switch (x) {
|
|
2767
2762
|
case re.MIDDLE:
|
|
2768
|
-
|
|
2763
|
+
M = (Y.contentHeight - Y.totalHeight) / 2;
|
|
2769
2764
|
break;
|
|
2770
2765
|
case re.BOTTOM:
|
|
2771
|
-
|
|
2766
|
+
M = Y.contentHeight - Y.totalHeight;
|
|
2772
2767
|
break;
|
|
2773
2768
|
}
|
|
2774
|
-
o.translateWithPrecision(0,
|
|
2769
|
+
o.translateWithPrecision(0, M), Y.lines.forEach(($, ae) => {
|
|
2775
2770
|
o.save();
|
|
2776
|
-
const { width:
|
|
2777
|
-
let
|
|
2771
|
+
const { width: y, height: W, items: H } = $;
|
|
2772
|
+
let J = 0;
|
|
2778
2773
|
switch (X) {
|
|
2779
2774
|
case Ve.RIGHT:
|
|
2780
|
-
|
|
2775
|
+
J = Y.contentWidth - y;
|
|
2781
2776
|
break;
|
|
2782
2777
|
case Ve.CENTER:
|
|
2783
|
-
|
|
2778
|
+
J = (Y.contentWidth - y) / 2;
|
|
2784
2779
|
break;
|
|
2785
2780
|
}
|
|
2786
|
-
o.translate(
|
|
2787
|
-
o.save(), o.translateWithPrecision(
|
|
2788
|
-
...
|
|
2789
|
-
info:
|
|
2790
|
-
color:
|
|
2791
|
-
fill: ee[
|
|
2781
|
+
o.translate(J, ae * (W + Lr)), H.forEach((_e) => {
|
|
2782
|
+
o.save(), o.translateWithPrecision(_e.left, 0), as.drawWith(o, {
|
|
2783
|
+
...L,
|
|
2784
|
+
info: _e,
|
|
2785
|
+
color: E,
|
|
2786
|
+
fill: ee[_e.text]
|
|
2792
2787
|
}), o.restore();
|
|
2793
2788
|
}), o.restore();
|
|
2794
|
-
}), o.restore(), S.set(
|
|
2789
|
+
}), o.restore(), S.set(V, {
|
|
2795
2790
|
left: _.startX,
|
|
2796
2791
|
top: _.startY,
|
|
2797
|
-
width:
|
|
2798
|
-
height:
|
|
2792
|
+
width: Y.contentWidth + ca + Fe,
|
|
2793
|
+
height: Y.contentHeight + Tt * 2
|
|
2799
2794
|
});
|
|
2800
2795
|
}
|
|
2801
2796
|
calcCellAutoHeight(o) {
|
|
@@ -2805,15 +2800,15 @@ let ha = class {
|
|
|
2805
2800
|
endX: d.endX - i,
|
|
2806
2801
|
startY: d.startY + s,
|
|
2807
2802
|
endY: d.endY - l
|
|
2808
|
-
},
|
|
2809
|
-
if (!
|
|
2803
|
+
}, h = t.dataValidation;
|
|
2804
|
+
if (!h)
|
|
2810
2805
|
return;
|
|
2811
|
-
const
|
|
2812
|
-
return Ga(S,
|
|
2806
|
+
const u = c.endX - c.startX, f = c.endY - c.startY, m = (I = ne(t)) != null ? I : "", { validator: v } = h, S = v.parseCellValue(m), V = Pa(e != null ? e : void 0);
|
|
2807
|
+
return Ga(S, V, u, f).cellAutoHeight;
|
|
2813
2808
|
}
|
|
2814
2809
|
isHit(o, a) {
|
|
2815
2810
|
const { primaryWithCoord: e } = a, t = e.isMergedMainCell ? e.mergeInfo : e, { endX: r } = t, { x: n } = o;
|
|
2816
|
-
return n >= r -
|
|
2811
|
+
return n >= r - Fe && n <= r;
|
|
2817
2812
|
}
|
|
2818
2813
|
onPointerDown(o, a) {
|
|
2819
2814
|
if (a.button === 2)
|
|
@@ -2824,74 +2819,74 @@ let ha = class {
|
|
|
2824
2819
|
row: r,
|
|
2825
2820
|
column: n
|
|
2826
2821
|
};
|
|
2827
|
-
this._commandService.executeCommand(
|
|
2822
|
+
this._commandService.executeCommand(Ca.id, i);
|
|
2828
2823
|
}
|
|
2829
2824
|
};
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
],
|
|
2833
|
-
class
|
|
2825
|
+
ua = ns([
|
|
2826
|
+
is(0, te)
|
|
2827
|
+
], ua);
|
|
2828
|
+
class ls extends Nr {
|
|
2834
2829
|
constructor() {
|
|
2835
2830
|
super(...arguments);
|
|
2836
|
-
g(this, "id",
|
|
2831
|
+
g(this, "id", q.LIST_MULTIPLE);
|
|
2837
2832
|
g(this, "title", "dataValidation.listMultiple.title");
|
|
2838
|
-
g(this, "canvasRender", this.injector.createInstance(
|
|
2833
|
+
g(this, "canvasRender", this.injector.createInstance(ua));
|
|
2839
2834
|
}
|
|
2840
2835
|
skipDefaultFontRender() {
|
|
2841
2836
|
return !0;
|
|
2842
2837
|
}
|
|
2843
2838
|
}
|
|
2844
|
-
const
|
|
2845
|
-
function
|
|
2839
|
+
const Pr = "data-validation-single", Ia = "sheet.menu.data-validation";
|
|
2840
|
+
function ds(o) {
|
|
2846
2841
|
return {
|
|
2847
|
-
id:
|
|
2848
|
-
type:
|
|
2849
|
-
positions: [
|
|
2850
|
-
group:
|
|
2851
|
-
icon:
|
|
2842
|
+
id: Ia,
|
|
2843
|
+
type: ga.SUBITEMS,
|
|
2844
|
+
positions: [Lo.TOOLBAR_START],
|
|
2845
|
+
group: Po.TOOLBAR_FORMULAS_INSERT,
|
|
2846
|
+
icon: Pr,
|
|
2852
2847
|
tooltip: "dataValidation.title",
|
|
2853
|
-
hidden$:
|
|
2854
|
-
disabled$:
|
|
2848
|
+
hidden$: Ao(o, se.UNIVER_SHEET),
|
|
2849
|
+
disabled$: Co(o, { workbookTypes: [Zt], worksheetTypes: [Jt, ea], rangeTypes: [ta] })
|
|
2855
2850
|
};
|
|
2856
2851
|
}
|
|
2857
|
-
function
|
|
2852
|
+
function cs(o) {
|
|
2858
2853
|
return {
|
|
2859
2854
|
id: ct.id,
|
|
2860
2855
|
title: "dataValidation.panel.title",
|
|
2861
|
-
type:
|
|
2862
|
-
positions: [
|
|
2856
|
+
type: ga.BUTTON,
|
|
2857
|
+
positions: [Ia]
|
|
2863
2858
|
};
|
|
2864
2859
|
}
|
|
2865
|
-
function
|
|
2860
|
+
function us(o) {
|
|
2866
2861
|
return {
|
|
2867
2862
|
id: _r.id,
|
|
2868
2863
|
title: "dataValidation.panel.add",
|
|
2869
|
-
type:
|
|
2870
|
-
positions: [
|
|
2864
|
+
type: ga.BUTTON,
|
|
2865
|
+
positions: [Ia]
|
|
2871
2866
|
};
|
|
2872
2867
|
}
|
|
2873
|
-
var
|
|
2874
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2868
|
+
var hs = Object.defineProperty, ms = Object.getOwnPropertyDescriptor, fs = (o, a, e, t) => {
|
|
2869
|
+
for (var r = t > 1 ? void 0 : t ? ms(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
2875
2870
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
2876
|
-
return t && r &&
|
|
2871
|
+
return t && r && hs(a, e, r), r;
|
|
2877
2872
|
}, Ie = (o, a) => (e, t) => a(e, t, o);
|
|
2878
2873
|
let rt = class extends Za {
|
|
2879
2874
|
constructor(o, a, e, t, r, n, i, s) {
|
|
2880
2875
|
super(), this._univerInstanceService = o, this._sheetDataValidationService = a, this._dataValidatorRegistryService = e, this._injector = t, this._componentManger = r, this._selectionManagerService = n, this._sheetInterceptorService = i, this._dataValidationModel = s, this._init();
|
|
2881
2876
|
}
|
|
2882
2877
|
_init() {
|
|
2883
|
-
this._registerValidators(), this._initInstanceChange(), this._componentManger.register(
|
|
2878
|
+
this._registerValidators(), this._initInstanceChange(), this._componentManger.register(Pr, Cr), this._initCommandInterceptor();
|
|
2884
2879
|
}
|
|
2885
2880
|
_registerValidators() {
|
|
2886
2881
|
[
|
|
2887
|
-
|
|
2882
|
+
qi,
|
|
2883
|
+
Zi,
|
|
2888
2884
|
Ki,
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
wi
|
|
2885
|
+
ji,
|
|
2886
|
+
Ni,
|
|
2887
|
+
Nr,
|
|
2888
|
+
ls,
|
|
2889
|
+
Ii
|
|
2895
2890
|
].forEach((o) => {
|
|
2896
2891
|
const a = this._injector.createInstance(o);
|
|
2897
2892
|
this.disposeWithMe(
|
|
@@ -2904,9 +2899,9 @@ let rt = class extends Za {
|
|
|
2904
2899
|
});
|
|
2905
2900
|
}
|
|
2906
2901
|
_initInstanceChange() {
|
|
2907
|
-
const o = new
|
|
2908
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2909
|
-
o.dispose(), a && (this._sheetDataValidationService.switchCurrent(a.getUnitId(), a.getActiveSheet().getSheetId()), o.add(
|
|
2902
|
+
const o = new qa();
|
|
2903
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(se.UNIVER_SHEET).subscribe((a) => {
|
|
2904
|
+
o.dispose(), a && (this._sheetDataValidationService.switchCurrent(a.getUnitId(), a.getActiveSheet().getSheetId()), o.add(ma(
|
|
2910
2905
|
a.activeSheet$.subscribe((e) => {
|
|
2911
2906
|
if (e) {
|
|
2912
2907
|
const t = a.getUnitId(), r = e.getSheetId();
|
|
@@ -2919,8 +2914,8 @@ let rt = class extends Za {
|
|
|
2919
2914
|
_initCommandInterceptor() {
|
|
2920
2915
|
this._sheetInterceptorService.interceptCommand({
|
|
2921
2916
|
getMutations: (o) => {
|
|
2922
|
-
if (o.id ===
|
|
2923
|
-
const a = this._univerInstanceService.getCurrentUnitForType(
|
|
2917
|
+
if (o.id === fo.id) {
|
|
2918
|
+
const a = this._univerInstanceService.getCurrentUnitForType(se.UNIVER_SHEET), e = a.getUnitId(), r = a.getActiveSheet().getSheetId(), n = this._selectionManagerService.getSelectionRanges(), i = this._dataValidationModel.ensureManager(e, r), s = i.getRuleObjectMatrix().clone();
|
|
2924
2919
|
n && s.removeRange(n);
|
|
2925
2920
|
const l = s.diff(i.getDataValidations()), { redoMutations: d, undoMutations: c } = Qe(e, r, l);
|
|
2926
2921
|
return {
|
|
@@ -2936,34 +2931,34 @@ let rt = class extends Za {
|
|
|
2936
2931
|
});
|
|
2937
2932
|
}
|
|
2938
2933
|
};
|
|
2939
|
-
rt =
|
|
2940
|
-
ge
|
|
2941
|
-
Ie(0,
|
|
2942
|
-
Ie(1,
|
|
2943
|
-
Ie(2,
|
|
2944
|
-
Ie(3,
|
|
2945
|
-
Ie(4,
|
|
2946
|
-
Ie(5,
|
|
2947
|
-
Ie(6,
|
|
2948
|
-
Ie(7,
|
|
2934
|
+
rt = fs([
|
|
2935
|
+
ve(ge.Rendered, rt),
|
|
2936
|
+
Ie(0, ie),
|
|
2937
|
+
Ie(1, w(yt)),
|
|
2938
|
+
Ie(2, w(Ee)),
|
|
2939
|
+
Ie(3, w(Be)),
|
|
2940
|
+
Ie(4, w(dt)),
|
|
2941
|
+
Ie(5, w(mo)),
|
|
2942
|
+
Ie(6, w(ar)),
|
|
2943
|
+
Ie(7, w(Z))
|
|
2949
2944
|
], rt);
|
|
2950
|
-
const
|
|
2951
|
-
dataValidationListButtons:
|
|
2952
|
-
dataValidationListButton:
|
|
2945
|
+
const ps = "univer-data-validation-list-buttons", vs = "univer-data-validation-list-button", kt = {
|
|
2946
|
+
dataValidationListButtons: ps,
|
|
2947
|
+
dataValidationListButton: vs
|
|
2953
2948
|
};
|
|
2954
|
-
function
|
|
2955
|
-
const o =
|
|
2956
|
-
() => o.getCurrentTypeOfUnit$(
|
|
2949
|
+
function gs() {
|
|
2950
|
+
const o = T(ie), a = Ze(
|
|
2951
|
+
() => o.getCurrentTypeOfUnit$(se.UNIVER_SHEET),
|
|
2957
2952
|
void 0,
|
|
2958
2953
|
void 0,
|
|
2959
2954
|
[]
|
|
2960
2955
|
);
|
|
2961
|
-
return a ? /* @__PURE__ */ p.jsx(
|
|
2956
|
+
return a ? /* @__PURE__ */ p.jsx(_s, { workbook: a }) : null;
|
|
2962
2957
|
}
|
|
2963
|
-
function
|
|
2964
|
-
const a =
|
|
2965
|
-
|
|
2966
|
-
const i =
|
|
2958
|
+
function _s(o) {
|
|
2959
|
+
const a = T(Z), e = T(ie), t = T(te), r = T(Be), n = T(we);
|
|
2960
|
+
T(rt);
|
|
2961
|
+
const i = T(le), [s, l] = Q([]), { workbook: d } = o, c = Ze(d.activeSheet$, void 0, !0), h = d.getUnitId(), u = c == null ? void 0 : c.getSheetId(), f = a.ensureManager(h, u);
|
|
2967
2962
|
Xe(() => {
|
|
2968
2963
|
l(f.getDataValidations());
|
|
2969
2964
|
const _ = f.dataValidations$.subscribe((I) => {
|
|
@@ -2975,49 +2970,49 @@ function gs(o) {
|
|
|
2975
2970
|
}, [f]);
|
|
2976
2971
|
const m = async () => {
|
|
2977
2972
|
const _ = Ja(r), I = {
|
|
2978
|
-
unitId:
|
|
2979
|
-
subUnitId:
|
|
2973
|
+
unitId: h,
|
|
2974
|
+
subUnitId: u,
|
|
2980
2975
|
rule: _
|
|
2981
2976
|
};
|
|
2982
|
-
await t.executeCommand(
|
|
2983
|
-
unitId:
|
|
2984
|
-
subUnitId:
|
|
2977
|
+
await t.executeCommand(Ma.id, I), n.setActiveRule({
|
|
2978
|
+
unitId: h,
|
|
2979
|
+
subUnitId: u,
|
|
2985
2980
|
rule: _
|
|
2986
2981
|
});
|
|
2987
2982
|
}, v = () => {
|
|
2988
|
-
t.executeCommand(
|
|
2989
|
-
unitId:
|
|
2990
|
-
subUnitId:
|
|
2983
|
+
t.executeCommand(io.id, {
|
|
2984
|
+
unitId: h,
|
|
2985
|
+
subUnitId: u
|
|
2991
2986
|
});
|
|
2992
2987
|
}, S = ((_) => {
|
|
2993
|
-
const
|
|
2994
|
-
return _.map((
|
|
2995
|
-
const { ranges:
|
|
2996
|
-
return (
|
|
2997
|
-
var
|
|
2998
|
-
const { startRow:
|
|
2999
|
-
for (let ee =
|
|
3000
|
-
for (let
|
|
3001
|
-
const
|
|
3002
|
-
if ((
|
|
2988
|
+
const D = e.getCurrentUnitForType(se.UNIVER_SHEET).getActiveSheet();
|
|
2989
|
+
return _.map((E) => {
|
|
2990
|
+
const { ranges: L } = E;
|
|
2991
|
+
return (L == null ? void 0 : L.some((A) => {
|
|
2992
|
+
var b, k;
|
|
2993
|
+
const { startRow: P, startColumn: B, endRow: X, endColumn: x } = A;
|
|
2994
|
+
for (let ee = P; ee <= X; ee++)
|
|
2995
|
+
for (let Y = B; Y <= x; Y++) {
|
|
2996
|
+
const M = (k = (b = D.getCell(ee, Y)) == null ? void 0 : b.selectionProtection) == null ? void 0 : k[0];
|
|
2997
|
+
if ((M == null ? void 0 : M[Dt.Edit]) === !1 || (M == null ? void 0 : M[Dt.View]) === !1)
|
|
3003
2998
|
return !0;
|
|
3004
2999
|
}
|
|
3005
3000
|
return !1;
|
|
3006
|
-
})) ? { ...
|
|
3001
|
+
})) ? { ...E, disable: !0 } : { ...E };
|
|
3007
3002
|
});
|
|
3008
|
-
})(s),
|
|
3003
|
+
})(s), V = S == null ? void 0 : S.some((_) => _.disable);
|
|
3009
3004
|
return /* @__PURE__ */ p.jsxs("div", { children: [
|
|
3010
3005
|
S == null ? void 0 : S.map((_) => {
|
|
3011
3006
|
var I;
|
|
3012
3007
|
return /* @__PURE__ */ p.jsx(
|
|
3013
|
-
|
|
3008
|
+
Kn,
|
|
3014
3009
|
{
|
|
3015
|
-
unitId:
|
|
3016
|
-
subUnitId:
|
|
3010
|
+
unitId: h,
|
|
3011
|
+
subUnitId: u,
|
|
3017
3012
|
onClick: () => {
|
|
3018
3013
|
_.disable || n.setActiveRule({
|
|
3019
|
-
unitId:
|
|
3020
|
-
subUnitId:
|
|
3014
|
+
unitId: h,
|
|
3015
|
+
subUnitId: u,
|
|
3021
3016
|
rule: _
|
|
3022
3017
|
});
|
|
3023
3018
|
},
|
|
@@ -3027,69 +3022,69 @@ function gs(o) {
|
|
|
3027
3022
|
_.uid
|
|
3028
3023
|
);
|
|
3029
3024
|
}),
|
|
3030
|
-
/* @__PURE__ */ p.jsxs("div", { className:
|
|
3031
|
-
s.length && !
|
|
3032
|
-
/* @__PURE__ */ p.jsx(ze, { className:
|
|
3025
|
+
/* @__PURE__ */ p.jsxs("div", { className: kt.dataValidationListButtons, children: [
|
|
3026
|
+
s.length && !V ? /* @__PURE__ */ p.jsx(ze, { className: kt.dataValidationListButton, onClick: v, children: i.t("dataValidation.panel.removeAll") }) : null,
|
|
3027
|
+
/* @__PURE__ */ p.jsx(ze, { className: kt.dataValidationListButton, type: "primary", onClick: m, children: i.t("dataValidation.panel.add") })
|
|
3033
3028
|
] })
|
|
3034
3029
|
] });
|
|
3035
3030
|
}
|
|
3036
|
-
const
|
|
3037
|
-
const o =
|
|
3038
|
-
return a ? /* @__PURE__ */ p.jsx(
|
|
3039
|
-
},
|
|
3040
|
-
dvListDropdown:
|
|
3041
|
-
dvListDropdownTitle:
|
|
3042
|
-
dvListDropdownList:
|
|
3043
|
-
dvListDropdownListContainer:
|
|
3044
|
-
dvListDropdownSelectedIcon:
|
|
3045
|
-
dvListDropdownItemContainer:
|
|
3046
|
-
dvListDropdownItem:
|
|
3031
|
+
const Ss = () => {
|
|
3032
|
+
const o = T(we), a = Ze(o.activeRule$, o.activeRule);
|
|
3033
|
+
return a ? /* @__PURE__ */ p.jsx(Gn, {}, a.rule.uid) : /* @__PURE__ */ p.jsx(gs, {});
|
|
3034
|
+
}, Rs = "univer-dv-list-dropdown", Cs = "univer-dv-list-dropdown-title", Vs = "univer-dv-list-dropdown-list", Ms = "univer-dv-list-dropdown-list-container", ws = "univer-dv-list-dropdown-selected-icon", Is = "univer-dv-list-dropdown-item-container", Ds = "univer-dv-list-dropdown-item", ys = "univer-dv-list-dropdown-split", Es = "univer-dv-list-dropdown-edit", Re = {
|
|
3035
|
+
dvListDropdown: Rs,
|
|
3036
|
+
dvListDropdownTitle: Cs,
|
|
3037
|
+
dvListDropdownList: Vs,
|
|
3038
|
+
dvListDropdownListContainer: Ms,
|
|
3039
|
+
dvListDropdownSelectedIcon: ws,
|
|
3040
|
+
dvListDropdownItemContainer: Is,
|
|
3041
|
+
dvListDropdownItem: Ds,
|
|
3047
3042
|
dvListDropdownSplit: ys,
|
|
3048
|
-
dvListDropdownEdit:
|
|
3049
|
-
},
|
|
3043
|
+
dvListDropdownEdit: Es
|
|
3044
|
+
}, Os = (o) => {
|
|
3050
3045
|
const { value: a, onChange: e, multiple: t, options: r, title: n, onEdit: i, style: s } = o;
|
|
3051
|
-
return /* @__PURE__ */ p.jsxs("div", { className:
|
|
3052
|
-
/* @__PURE__ */ p.jsx("div", { className:
|
|
3053
|
-
/* @__PURE__ */ p.jsx("div", { className:
|
|
3054
|
-
const c = a.indexOf(l.value) > -1,
|
|
3055
|
-
let
|
|
3056
|
-
c ?
|
|
3046
|
+
return /* @__PURE__ */ p.jsxs("div", { className: Re.dvListDropdown, style: s, children: [
|
|
3047
|
+
/* @__PURE__ */ p.jsx("div", { className: Re.dvListDropdownTitle, children: n }),
|
|
3048
|
+
/* @__PURE__ */ p.jsx("div", { className: Re.dvListDropdownList, children: /* @__PURE__ */ p.jsx(Qo, { children: /* @__PURE__ */ p.jsx("div", { className: Re.dvListDropdownListContainer, children: r.map((l, d) => {
|
|
3049
|
+
const c = a.indexOf(l.value) > -1, h = () => {
|
|
3050
|
+
let u;
|
|
3051
|
+
c ? u = new Set(a.filter((m) => m !== l.value)) : u = new Set(t ? [...a, l.value] : [l.value]);
|
|
3057
3052
|
const f = [];
|
|
3058
3053
|
r.forEach((m) => {
|
|
3059
|
-
|
|
3054
|
+
u.has(m.value) && f.push(m.value);
|
|
3060
3055
|
}), e(f);
|
|
3061
3056
|
};
|
|
3062
|
-
return /* @__PURE__ */ p.jsxs("div", { className:
|
|
3063
|
-
/* @__PURE__ */ p.jsx("div", { className:
|
|
3064
|
-
/* @__PURE__ */ p.jsx("div", { className:
|
|
3057
|
+
return /* @__PURE__ */ p.jsxs("div", { className: Re.dvListDropdownItemContainer, onClick: h, children: [
|
|
3058
|
+
/* @__PURE__ */ p.jsx("div", { className: Re.dvListDropdownItem, style: { background: l.color || Le }, children: l.label }),
|
|
3059
|
+
/* @__PURE__ */ p.jsx("div", { className: Re.dvListDropdownSelectedIcon, children: c ? /* @__PURE__ */ p.jsx(En, {}) : null })
|
|
3065
3060
|
] }, d);
|
|
3066
3061
|
}) }) }) }),
|
|
3067
|
-
/* @__PURE__ */ p.jsx("div", { className:
|
|
3068
|
-
/* @__PURE__ */ p.jsx("div", { className:
|
|
3062
|
+
/* @__PURE__ */ p.jsx("div", { className: Re.dvListDropdownSplit }),
|
|
3063
|
+
/* @__PURE__ */ p.jsx("div", { className: Re.dvListDropdownEdit, children: /* @__PURE__ */ p.jsx("a", { onClick: i, children: "编辑" }) })
|
|
3069
3064
|
] });
|
|
3070
3065
|
};
|
|
3071
|
-
function
|
|
3072
|
-
var
|
|
3073
|
-
const { location: a, hideFn: e } = o, { worksheet: t, row: r, col: n, unitId: i, subUnitId: s } = a, l =
|
|
3066
|
+
function bs(o) {
|
|
3067
|
+
var L, j;
|
|
3068
|
+
const { location: a, hideFn: e } = o, { worksheet: t, row: r, col: n, unitId: i, subUnitId: s } = a, l = T(te), d = T(le), [c, h] = Q(""), u = T(va), f = zo.useContext(), m = f.right - f.left;
|
|
3074
3069
|
if (!t)
|
|
3075
3070
|
return null;
|
|
3076
|
-
const v = t.getCell(r, n), R = (
|
|
3071
|
+
const v = t.getCell(r, n), R = (L = v == null ? void 0 : v.dataValidation) == null ? void 0 : L.rule, S = (j = v == null ? void 0 : v.dataValidation) == null ? void 0 : j.validator, V = (R == null ? void 0 : R.renderMode) === ue.CUSTOM || (R == null ? void 0 : R.renderMode) === void 0;
|
|
3077
3072
|
if (!v || !R || !S)
|
|
3078
3073
|
return;
|
|
3079
|
-
const _ = R.type ===
|
|
3074
|
+
const _ = R.type === q.LIST_MULTIPLE, I = S.getListWithColor(R, i, s), D = c || mi(v), N = Ge(D), E = () => {
|
|
3080
3075
|
l.executeCommand(ct.id, {
|
|
3081
3076
|
ruleId: R.uid
|
|
3082
3077
|
}), e();
|
|
3083
3078
|
};
|
|
3084
3079
|
return /* @__PURE__ */ p.jsx(
|
|
3085
|
-
|
|
3080
|
+
Os,
|
|
3086
3081
|
{
|
|
3087
3082
|
style: { minWidth: m, maxWidth: Math.max(m, 200) },
|
|
3088
3083
|
title: _ ? d.t("dataValidation.listMultiple.dropdown") : d.t("dataValidation.list.dropdown"),
|
|
3089
|
-
value:
|
|
3084
|
+
value: N,
|
|
3090
3085
|
multiple: _,
|
|
3091
|
-
onChange: (
|
|
3092
|
-
const
|
|
3086
|
+
onChange: (A) => {
|
|
3087
|
+
const P = Er(A), B = {
|
|
3093
3088
|
unitId: i,
|
|
3094
3089
|
subUnitId: s,
|
|
3095
3090
|
range: {
|
|
@@ -3099,31 +3094,31 @@ function Os(o) {
|
|
|
3099
3094
|
endRow: r
|
|
3100
3095
|
},
|
|
3101
3096
|
value: {
|
|
3102
|
-
v:
|
|
3097
|
+
v: P,
|
|
3103
3098
|
p: null,
|
|
3104
3099
|
f: null,
|
|
3105
3100
|
si: null
|
|
3106
3101
|
}
|
|
3107
3102
|
};
|
|
3108
|
-
|
|
3103
|
+
u.isVisible() && u.changeVisible({
|
|
3109
3104
|
visible: !1,
|
|
3110
|
-
keycode:
|
|
3111
|
-
eventType:
|
|
3112
|
-
}), l.executeCommand(
|
|
3105
|
+
keycode: xo.ESC,
|
|
3106
|
+
eventType: Xo.Keyboard
|
|
3107
|
+
}), l.executeCommand(pa.id, B), h(P), _ || e();
|
|
3113
3108
|
},
|
|
3114
|
-
options: I.map((
|
|
3115
|
-
label:
|
|
3116
|
-
value:
|
|
3117
|
-
color:
|
|
3109
|
+
options: I.map((A) => ({
|
|
3110
|
+
label: A.label,
|
|
3111
|
+
value: A.label,
|
|
3112
|
+
color: V ? A.color : "transparent"
|
|
3118
3113
|
})),
|
|
3119
|
-
onEdit:
|
|
3114
|
+
onEdit: E
|
|
3120
3115
|
}
|
|
3121
3116
|
);
|
|
3122
3117
|
}
|
|
3123
|
-
var
|
|
3124
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
3118
|
+
var Ts = Object.defineProperty, Ns = Object.getOwnPropertyDescriptor, Fs = (o, a, e, t) => {
|
|
3119
|
+
for (var r = t > 1 ? void 0 : t ? Ns(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
3125
3120
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
3126
|
-
return t && r &&
|
|
3121
|
+
return t && r && Ts(a, e, r), r;
|
|
3127
3122
|
}, et = (o, a) => (e, t) => a(e, t, o);
|
|
3128
3123
|
let ot = class extends me {
|
|
3129
3124
|
constructor(o, a, e, t, r) {
|
|
@@ -3134,19 +3129,19 @@ let ot = class extends me {
|
|
|
3134
3129
|
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT_ASYNC,
|
|
3135
3130
|
{
|
|
3136
3131
|
handler: async (o, a, e) => {
|
|
3137
|
-
const t = await o, { worksheet: r, row: n, col: i, unitId: s, subUnitId: l } = a, d = this._dataValidationModel.ensureManager(s, l), c = d.getRuleIdByLocation(n, i),
|
|
3138
|
-
if (!
|
|
3132
|
+
const t = await o, { worksheet: r, row: n, col: i, unitId: s, subUnitId: l } = a, d = this._dataValidationModel.ensureManager(s, l), c = d.getRuleIdByLocation(n, i), h = c ? d.getRuleById(c) : void 0;
|
|
3133
|
+
if (!h || h.errorStyle !== tt.STOP)
|
|
3139
3134
|
return e(Promise.resolve(t));
|
|
3140
|
-
const
|
|
3141
|
-
if (!
|
|
3135
|
+
const u = await this._dataValidatorRegistryService.getValidatorItem(h.type);
|
|
3136
|
+
if (!u || await u.validator(
|
|
3142
3137
|
{
|
|
3143
|
-
value:
|
|
3138
|
+
value: ne(t),
|
|
3144
3139
|
row: n,
|
|
3145
3140
|
column: i,
|
|
3146
3141
|
unitId: s,
|
|
3147
3142
|
subUnitId: l
|
|
3148
3143
|
},
|
|
3149
|
-
|
|
3144
|
+
h
|
|
3150
3145
|
))
|
|
3151
3146
|
return e(Promise.resolve(t));
|
|
3152
3147
|
const m = r.getCellRaw(n, i);
|
|
@@ -3157,10 +3152,10 @@ let ot = class extends me {
|
|
|
3157
3152
|
},
|
|
3158
3153
|
id: "reject-input-dialog",
|
|
3159
3154
|
children: {
|
|
3160
|
-
title:
|
|
3155
|
+
title: u.getRuleFinalError(h)
|
|
3161
3156
|
},
|
|
3162
3157
|
footer: {
|
|
3163
|
-
title:
|
|
3158
|
+
title: ra.createElement(
|
|
3164
3159
|
ze,
|
|
3165
3160
|
{
|
|
3166
3161
|
type: "primary",
|
|
@@ -3188,7 +3183,7 @@ let ot = class extends me {
|
|
|
3188
3183
|
title: o
|
|
3189
3184
|
},
|
|
3190
3185
|
footer: {
|
|
3191
|
-
title:
|
|
3186
|
+
title: ra.createElement(
|
|
3192
3187
|
ze,
|
|
3193
3188
|
{
|
|
3194
3189
|
type: "primary",
|
|
@@ -3204,38 +3199,38 @@ let ot = class extends me {
|
|
|
3204
3199
|
}
|
|
3205
3200
|
};
|
|
3206
3201
|
ot = Fs([
|
|
3207
|
-
ge
|
|
3208
|
-
et(0,
|
|
3209
|
-
et(1,
|
|
3210
|
-
et(2,
|
|
3211
|
-
et(3,
|
|
3212
|
-
et(4,
|
|
3202
|
+
ve(ge.Ready, ot),
|
|
3203
|
+
et(0, va),
|
|
3204
|
+
et(1, w(Z)),
|
|
3205
|
+
et(2, w(Ee)),
|
|
3206
|
+
et(3, jo),
|
|
3207
|
+
et(4, w(le))
|
|
3213
3208
|
], ot);
|
|
3214
|
-
const
|
|
3215
|
-
dvDateDropdown:
|
|
3209
|
+
const Ls = "univer-dv-date-dropdown", Ps = {
|
|
3210
|
+
dvDateDropdown: Ls
|
|
3216
3211
|
};
|
|
3217
3212
|
function As(o) {
|
|
3218
|
-
var
|
|
3219
|
-
const { location: a, hideFn: e } = o, { worksheet: t, row: r, col: n, unitId: i, subUnitId: s } = a, l =
|
|
3213
|
+
var V, _, I;
|
|
3214
|
+
const { location: a, hideFn: e } = o, { worksheet: t, row: r, col: n, unitId: i, subUnitId: s } = a, l = T(te), d = T(ot), [c, h] = Q();
|
|
3220
3215
|
if (!t)
|
|
3221
3216
|
return null;
|
|
3222
|
-
const
|
|
3223
|
-
if (!
|
|
3217
|
+
const u = t.getCell(r, n), f = (V = u == null ? void 0 : u.dataValidation) == null ? void 0 : V.rule, m = (_ = u == null ? void 0 : u.dataValidation) == null ? void 0 : _.validator;
|
|
3218
|
+
if (!u || !f || !m)
|
|
3224
3219
|
return;
|
|
3225
|
-
const v =
|
|
3226
|
-
return /* @__PURE__ */ p.jsx("div", { className:
|
|
3227
|
-
|
|
3220
|
+
const v = ne(u), R = (I = m.transformDate(v)) != null ? I : xe(), S = R.isValid() ? R : xe();
|
|
3221
|
+
return /* @__PURE__ */ p.jsx("div", { className: Ps.dvDateDropdown, children: /* @__PURE__ */ p.jsx(
|
|
3222
|
+
Ko,
|
|
3228
3223
|
{
|
|
3229
3224
|
pickerValue: c != null ? c : S,
|
|
3230
|
-
onSelect: async (
|
|
3231
|
-
const
|
|
3225
|
+
onSelect: async (D) => {
|
|
3226
|
+
const N = D.format("YYYY/MM/DD");
|
|
3232
3227
|
f.errorStyle !== tt.STOP || await m.validator({
|
|
3233
|
-
value:
|
|
3228
|
+
value: N,
|
|
3234
3229
|
unitId: i,
|
|
3235
3230
|
subUnitId: s,
|
|
3236
3231
|
row: r,
|
|
3237
3232
|
column: n
|
|
3238
|
-
}, f) ? l.executeCommand(
|
|
3233
|
+
}, f) ? l.executeCommand(pa.id, {
|
|
3239
3234
|
unitId: i,
|
|
3240
3235
|
subUnitId: s,
|
|
3241
3236
|
range: {
|
|
@@ -3245,44 +3240,41 @@ function As(o) {
|
|
|
3245
3240
|
endRow: r
|
|
3246
3241
|
},
|
|
3247
3242
|
value: {
|
|
3248
|
-
v:
|
|
3243
|
+
v: N,
|
|
3249
3244
|
p: null,
|
|
3250
3245
|
f: null,
|
|
3251
3246
|
si: null
|
|
3252
3247
|
}
|
|
3253
3248
|
}) : d.showReject(m.getRuleFinalError(f)), e();
|
|
3254
3249
|
},
|
|
3255
|
-
onPanelChange: (
|
|
3256
|
-
|
|
3250
|
+
onPanelChange: (D) => {
|
|
3251
|
+
h(D);
|
|
3257
3252
|
}
|
|
3258
3253
|
}
|
|
3259
3254
|
) });
|
|
3260
3255
|
}
|
|
3261
|
-
const
|
|
3262
|
-
var
|
|
3263
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
3256
|
+
const Ar = "data-validation.list.dropdown", xr = "data-validation.date.dropdown";
|
|
3257
|
+
var xs = Object.defineProperty, js = Object.getOwnPropertyDescriptor, Bs = (o, a, e, t) => {
|
|
3258
|
+
for (var r = t > 1 ? void 0 : t ? js(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
3264
3259
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
3265
|
-
return t && r &&
|
|
3266
|
-
},
|
|
3267
|
-
const
|
|
3260
|
+
return t && r && xs(a, e, r), r;
|
|
3261
|
+
}, de = (o, a) => (e, t) => a(e, t, o);
|
|
3262
|
+
const $s = {}, Us = {
|
|
3268
3263
|
tr: {
|
|
3269
3264
|
size: 6,
|
|
3270
3265
|
color: "#fe4b4b"
|
|
3271
3266
|
}
|
|
3272
3267
|
};
|
|
3273
3268
|
let nt = class extends Za {
|
|
3274
|
-
constructor(o, a, e, t, r, n, i, s, l, d, c,
|
|
3275
|
-
super(), this._config = o, this.
|
|
3276
|
-
}
|
|
3277
|
-
_init() {
|
|
3278
|
-
this._initComponents(), this._initMenu(), this._initSkeletonChange(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
|
3269
|
+
constructor(o, a, e, t, r, n, i, s, l, d, c, h, u) {
|
|
3270
|
+
super(), this._config = o, this._commandService = a, this._editorBridgeService = e, this._menuService = t, this._renderManagerService = r, this._univerInstanceService = n, this._autoHeightController = i, this._componentManager = s, this._dropdownManagerService = l, this._dataValidationModel = d, this._dataValidatorRegistryService = c, this._injector = h, this._sheetInterceptorService = u, this._initComponents(), this._initMenu(), this._initSkeletonChange(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
|
3279
3271
|
}
|
|
3280
3272
|
_initMenu() {
|
|
3281
3273
|
const { menu: o = {} } = this._config;
|
|
3282
3274
|
[
|
|
3283
|
-
ls,
|
|
3284
3275
|
ds,
|
|
3285
|
-
cs
|
|
3276
|
+
cs,
|
|
3277
|
+
us
|
|
3286
3278
|
].forEach((a) => {
|
|
3287
3279
|
this.disposeWithMe(
|
|
3288
3280
|
this._menuService.addMenuItem(a(this._injector), o)
|
|
@@ -3293,25 +3285,25 @@ let nt = class extends Za {
|
|
|
3293
3285
|
[
|
|
3294
3286
|
[
|
|
3295
3287
|
vr,
|
|
3296
|
-
|
|
3288
|
+
Ss
|
|
3297
3289
|
],
|
|
3298
3290
|
[
|
|
3299
3291
|
pr,
|
|
3300
|
-
|
|
3292
|
+
fn
|
|
3301
3293
|
],
|
|
3302
3294
|
[
|
|
3303
|
-
|
|
3304
|
-
|
|
3295
|
+
Ar,
|
|
3296
|
+
bs
|
|
3305
3297
|
],
|
|
3306
3298
|
[
|
|
3307
3299
|
xr,
|
|
3308
3300
|
As
|
|
3309
3301
|
],
|
|
3310
3302
|
[
|
|
3311
|
-
|
|
3312
|
-
|
|
3303
|
+
Ot.componentKey,
|
|
3304
|
+
Ot
|
|
3313
3305
|
],
|
|
3314
|
-
...
|
|
3306
|
+
...Ci
|
|
3315
3307
|
].forEach(([o, a]) => {
|
|
3316
3308
|
this.disposeWithMe(this._componentManager.register(
|
|
3317
3309
|
o,
|
|
@@ -3334,8 +3326,8 @@ let nt = class extends Za {
|
|
|
3334
3326
|
const d = this._dataValidatorRegistryService.getValidatorItem(l.type);
|
|
3335
3327
|
if (!(d != null && d.dropdown))
|
|
3336
3328
|
return;
|
|
3337
|
-
const c = i.getActiveSheet(),
|
|
3338
|
-
if (
|
|
3329
|
+
const c = i.getActiveSheet(), h = this._dropdownManagerService.activeDropdown, u = h == null ? void 0 : h.location;
|
|
3330
|
+
if (u && u.unitId === e && u.subUnitId === t && u.row === r && u.col === n)
|
|
3339
3331
|
return;
|
|
3340
3332
|
this._dropdownManagerService.showDropdown({
|
|
3341
3333
|
location: {
|
|
@@ -3355,64 +3347,64 @@ let nt = class extends Za {
|
|
|
3355
3347
|
}
|
|
3356
3348
|
_initSkeletonChange() {
|
|
3357
3349
|
const o = () => {
|
|
3358
|
-
|
|
3350
|
+
var i, s;
|
|
3351
|
+
const a = this._univerInstanceService.getCurrentUnitForType(se.UNIVER_SHEET);
|
|
3359
3352
|
if (!a)
|
|
3360
3353
|
return;
|
|
3361
|
-
const e = a.getUnitId(), t = a.getActiveSheet().getSheetId(), r = this.
|
|
3354
|
+
const e = a.getUnitId(), t = a.getActiveSheet().getSheetId(), r = (s = (i = this._renderManagerService.getRenderById(e)) == null ? void 0 : i.with(Ta).getUnitSkeleton(e, t)) == null ? void 0 : s.skeleton, n = this._renderManagerService.getRenderById(e);
|
|
3362
3355
|
r == null || r.makeDirty(!0), r == null || r.calculate(), n && n.mainComponent.makeForceDirty();
|
|
3363
3356
|
};
|
|
3364
|
-
this.disposeWithMe(this._dataValidationModel.ruleChange$.subscribe(() =>
|
|
3365
|
-
o();
|
|
3366
|
-
})), this.disposeWithMe(this._dataValidationModel.validStatusChange$.subscribe(() => {
|
|
3367
|
-
o();
|
|
3368
|
-
}));
|
|
3357
|
+
this.disposeWithMe(this._dataValidationModel.ruleChange$.subscribe(() => o())), this.disposeWithMe(this._dataValidationModel.validStatusChange$.subscribe(() => o()));
|
|
3369
3358
|
}
|
|
3370
3359
|
// eslint-disable-next-line max-lines-per-function
|
|
3371
3360
|
_initViewModelIntercept() {
|
|
3372
3361
|
this.disposeWithMe(
|
|
3373
3362
|
this._sheetInterceptorService.intercept(
|
|
3374
|
-
|
|
3363
|
+
po.CELL_CONTENT,
|
|
3375
3364
|
{
|
|
3376
3365
|
priority: 200,
|
|
3377
|
-
// eslint-disable-next-line max-lines-per-function
|
|
3366
|
+
// eslint-disable-next-line max-lines-per-function
|
|
3378
3367
|
handler: (o, a, e) => {
|
|
3379
|
-
var
|
|
3380
|
-
const { row: t, col: r, unitId: n, subUnitId: i } = a, s = this._dataValidationModel.ensureManager(n, i)
|
|
3381
|
-
if (!s
|
|
3368
|
+
var V, _, I, D, N;
|
|
3369
|
+
const { row: t, col: r, unitId: n, subUnitId: i } = a, s = this._dataValidationModel.ensureManager(n, i);
|
|
3370
|
+
if (!s)
|
|
3382
3371
|
return e(o);
|
|
3383
|
-
const
|
|
3384
|
-
if (!
|
|
3372
|
+
const l = (_ = (V = this._renderManagerService.getRenderById(n)) == null ? void 0 : V.with(Ta).getUnitSkeleton(n, i)) == null ? void 0 : _.skeleton;
|
|
3373
|
+
if (!l)
|
|
3385
3374
|
return e(o);
|
|
3386
|
-
const h = s.
|
|
3375
|
+
const d = a.workbook.getStyles(), c = (typeof (o == null ? void 0 : o.s) == "string" ? d.get(o == null ? void 0 : o.s) : o == null ? void 0 : o.s) || {}, h = s.getRuleIdByLocation(t, r);
|
|
3387
3376
|
if (!h)
|
|
3388
3377
|
return e(o);
|
|
3389
|
-
const
|
|
3378
|
+
const u = s.getRuleById(h);
|
|
3379
|
+
if (!u)
|
|
3380
|
+
return e(o);
|
|
3381
|
+
const f = a.worksheet.getCellRaw(a.row, a.col), m = this._dataValidationModel.validator(ne(f), u, a), v = this._dataValidatorRegistryService.getValidatorItem(u.type), R = ne(o);
|
|
3390
3382
|
let S = {};
|
|
3391
|
-
if ((
|
|
3383
|
+
if ((u.type === q.LIST || u.type === q.LIST_MULTIPLE) && (S = {
|
|
3392
3384
|
interceptorStyle: {
|
|
3393
3385
|
...o == null ? void 0 : o.interceptorStyle,
|
|
3394
|
-
tb: (
|
|
3386
|
+
tb: (I = c.tb !== pe.OVERFLOW ? c.tb : pe.CLIP) != null ? I : pe.WRAP
|
|
3395
3387
|
}
|
|
3396
|
-
}),
|
|
3397
|
-
const { formula2: E } = v.parseFormulaSync(
|
|
3388
|
+
}), u.type === q.CHECKBOX) {
|
|
3389
|
+
const { formula2: E } = v.parseFormulaSync(u, a.unitId, a.subUnitId);
|
|
3398
3390
|
R || (S = {
|
|
3399
3391
|
v: E,
|
|
3400
3392
|
t: 1,
|
|
3401
3393
|
p: null,
|
|
3402
3394
|
interceptorStyle: {
|
|
3403
3395
|
...o == null ? void 0 : o.interceptorStyle,
|
|
3404
|
-
tb:
|
|
3396
|
+
tb: pe.CLIP
|
|
3405
3397
|
}
|
|
3406
3398
|
});
|
|
3407
3399
|
}
|
|
3408
|
-
if (
|
|
3409
|
-
const E = v.getListWithColorMap(
|
|
3410
|
-
|
|
3400
|
+
if (u.type === q.LIST && (u.renderMode === ue.ARROW || u.renderMode === ue.TEXT)) {
|
|
3401
|
+
const E = v.getListWithColorMap(u), L = `${(D = ne(o)) != null ? D : ""}`, j = E[L];
|
|
3402
|
+
j && (S = {
|
|
3411
3403
|
...S,
|
|
3412
3404
|
interceptorStyle: {
|
|
3413
3405
|
...S.interceptorStyle,
|
|
3414
3406
|
bg: {
|
|
3415
|
-
rgb:
|
|
3407
|
+
rgb: j
|
|
3416
3408
|
}
|
|
3417
3409
|
}
|
|
3418
3410
|
});
|
|
@@ -3421,52 +3413,52 @@ let nt = class extends Za {
|
|
|
3421
3413
|
...o,
|
|
3422
3414
|
...S,
|
|
3423
3415
|
dataValidation: {
|
|
3424
|
-
ruleId:
|
|
3416
|
+
ruleId: h,
|
|
3425
3417
|
validStatus: m,
|
|
3426
|
-
rule:
|
|
3418
|
+
rule: u,
|
|
3427
3419
|
validator: v
|
|
3428
3420
|
},
|
|
3429
3421
|
markers: {
|
|
3430
3422
|
...o == null ? void 0 : o.markers,
|
|
3431
|
-
...m ===
|
|
3423
|
+
...m === Ce.INVALID ? Us : null
|
|
3432
3424
|
},
|
|
3433
3425
|
customRender: [
|
|
3434
|
-
...(
|
|
3426
|
+
...(N = o == null ? void 0 : o.customRender) != null ? N : [],
|
|
3435
3427
|
...v != null && v.canvasRender ? [v.canvasRender] : []
|
|
3436
3428
|
],
|
|
3437
3429
|
// @ts-ignore
|
|
3438
3430
|
fontRenderExtension: {
|
|
3439
3431
|
// @ts-ignore
|
|
3440
3432
|
...o == null ? void 0 : o.fontRenderExtension,
|
|
3441
|
-
isSkip: v == null ? void 0 : v.skipDefaultFontRender(
|
|
3433
|
+
isSkip: v == null ? void 0 : v.skipDefaultFontRender(u, R, a)
|
|
3442
3434
|
},
|
|
3443
3435
|
interceptorStyle: {
|
|
3444
3436
|
...o == null ? void 0 : o.interceptorStyle,
|
|
3445
3437
|
...S.interceptorStyle
|
|
3446
3438
|
},
|
|
3447
3439
|
get interceptorAutoHeight() {
|
|
3448
|
-
var
|
|
3449
|
-
const E = l.mergeData.find((
|
|
3450
|
-
const { startColumn:
|
|
3451
|
-
return t >=
|
|
3440
|
+
var j, A, P, B;
|
|
3441
|
+
const E = l.mergeData.find((X) => {
|
|
3442
|
+
const { startColumn: x, startRow: b, endColumn: k, endRow: ee } = X;
|
|
3443
|
+
return t >= b && r >= x && t <= ee && r <= k;
|
|
3452
3444
|
}), L = {
|
|
3453
3445
|
data: {
|
|
3454
3446
|
...o,
|
|
3455
3447
|
dataValidation: {
|
|
3456
|
-
ruleId:
|
|
3448
|
+
ruleId: h,
|
|
3457
3449
|
validStatus: m,
|
|
3458
|
-
rule:
|
|
3450
|
+
rule: u,
|
|
3459
3451
|
validator: v
|
|
3460
3452
|
}
|
|
3461
3453
|
},
|
|
3462
3454
|
style: l.getsStyles().getStyleByCell(o),
|
|
3463
|
-
primaryWithCoord: l.getCellByIndex((
|
|
3455
|
+
primaryWithCoord: l.getCellByIndex((j = E == null ? void 0 : E.startRow) != null ? j : t, (A = E == null ? void 0 : E.startColumn) != null ? A : r),
|
|
3464
3456
|
unitId: n,
|
|
3465
3457
|
subUnitId: i,
|
|
3466
3458
|
row: t,
|
|
3467
3459
|
col: r
|
|
3468
3460
|
};
|
|
3469
|
-
return (
|
|
3461
|
+
return (B = (P = v == null ? void 0 : v.canvasRender) == null ? void 0 : P.calcCellAutoHeight) == null ? void 0 : B.call(P, L);
|
|
3470
3462
|
}
|
|
3471
3463
|
});
|
|
3472
3464
|
}
|
|
@@ -3479,34 +3471,33 @@ let nt = class extends Za {
|
|
|
3479
3471
|
var a;
|
|
3480
3472
|
if ((a = o.rule) != null && a.ranges) {
|
|
3481
3473
|
const e = this._autoHeightController.getUndoRedoParamsOfAutoHeight(o.rule.ranges);
|
|
3482
|
-
|
|
3474
|
+
Kr(e.redos, this._commandService);
|
|
3483
3475
|
}
|
|
3484
3476
|
});
|
|
3485
3477
|
}
|
|
3486
3478
|
};
|
|
3487
|
-
nt =
|
|
3488
|
-
ge
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
ie(13, te)
|
|
3479
|
+
nt = Bs([
|
|
3480
|
+
ve(ge.Rendered, nt),
|
|
3481
|
+
de(1, te),
|
|
3482
|
+
de(2, va),
|
|
3483
|
+
de(3, Bo),
|
|
3484
|
+
de(4, ir),
|
|
3485
|
+
de(5, ie),
|
|
3486
|
+
de(6, w(Vo)),
|
|
3487
|
+
de(7, w(dt)),
|
|
3488
|
+
de(8, w(je)),
|
|
3489
|
+
de(9, w(Z)),
|
|
3490
|
+
de(10, w(Ee)),
|
|
3491
|
+
de(11, w(Be)),
|
|
3492
|
+
de(12, w(ar))
|
|
3502
3493
|
], nt);
|
|
3503
|
-
var
|
|
3504
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
3494
|
+
var Ws = Object.defineProperty, Hs = Object.getOwnPropertyDescriptor, ks = (o, a, e, t) => {
|
|
3495
|
+
for (var r = t > 1 ? void 0 : t ? Hs(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
3505
3496
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
3506
|
-
return t && r &&
|
|
3497
|
+
return t && r && Ws(a, e, r), r;
|
|
3507
3498
|
}, _t = (o, a) => (e, t) => a(e, t, o);
|
|
3508
|
-
const
|
|
3509
|
-
let
|
|
3499
|
+
const Yt = "SHEET_DATA_VALIDATION_ALERT";
|
|
3500
|
+
let Rt = class extends me {
|
|
3510
3501
|
constructor(o, a, e, t) {
|
|
3511
3502
|
super(), this._hoverManagerService = o, this._cellAlertManagerService = a, this._univerInstanceService = e, this._localeService = t, this._init();
|
|
3512
3503
|
}
|
|
@@ -3514,55 +3505,53 @@ let Ct = class extends me {
|
|
|
3514
3505
|
this._initCellAlertPopup();
|
|
3515
3506
|
}
|
|
3516
3507
|
_initCellAlertPopup() {
|
|
3517
|
-
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(
|
|
3518
|
-
var a, e
|
|
3508
|
+
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(rn(100)).subscribe((o) => {
|
|
3509
|
+
var a, e;
|
|
3519
3510
|
if (o) {
|
|
3520
|
-
const
|
|
3521
|
-
if (((a =
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
const s = this._cellAlertManagerService.currentAlert.get(Xt), l = (t = s == null ? void 0 : s.alert) == null ? void 0 : t.location;
|
|
3525
|
-
if (l && l.row === o.location.row && l.col === o.location.col && l.subUnitId === o.location.subUnitId && l.unitId === o.location.unitId)
|
|
3511
|
+
const n = this._univerInstanceService.getCurrentUnitForType(se.UNIVER_SHEET).getActiveSheet().getCell(o.location.row, o.location.col);
|
|
3512
|
+
if (((a = n == null ? void 0 : n.dataValidation) == null ? void 0 : a.validStatus) === Ce.INVALID) {
|
|
3513
|
+
const i = this._cellAlertManagerService.currentAlert.get(Yt), s = (e = i == null ? void 0 : i.alert) == null ? void 0 : e.location;
|
|
3514
|
+
if (s && s.row === o.location.row && s.col === o.location.col && s.subUnitId === o.location.subUnitId && s.unitId === o.location.unitId)
|
|
3526
3515
|
return;
|
|
3527
|
-
const
|
|
3528
|
-
if (!
|
|
3516
|
+
const l = n.dataValidation.validator, d = n.dataValidation.rule;
|
|
3517
|
+
if (!l)
|
|
3529
3518
|
return;
|
|
3530
3519
|
this._cellAlertManagerService.showAlert({
|
|
3531
|
-
type:
|
|
3520
|
+
type: Io.ERROR,
|
|
3532
3521
|
title: this._localeService.t("dataValidation.error.title"),
|
|
3533
|
-
message:
|
|
3522
|
+
message: l == null ? void 0 : l.getRuleFinalError(d),
|
|
3534
3523
|
location: o.location,
|
|
3535
3524
|
width: 200,
|
|
3536
3525
|
height: 74,
|
|
3537
|
-
key:
|
|
3526
|
+
key: Yt
|
|
3538
3527
|
});
|
|
3539
3528
|
return;
|
|
3540
3529
|
}
|
|
3541
3530
|
}
|
|
3542
|
-
this._cellAlertManagerService.removeAlert(
|
|
3531
|
+
this._cellAlertManagerService.removeAlert(Yt);
|
|
3543
3532
|
}));
|
|
3544
3533
|
}
|
|
3545
3534
|
};
|
|
3546
|
-
|
|
3547
|
-
ge
|
|
3548
|
-
_t(0,
|
|
3549
|
-
_t(1,
|
|
3550
|
-
_t(2,
|
|
3551
|
-
_t(3,
|
|
3552
|
-
],
|
|
3553
|
-
var
|
|
3554
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
3535
|
+
Rt = ks([
|
|
3536
|
+
ve(ge.Rendered, Rt),
|
|
3537
|
+
_t(0, w(Mo)),
|
|
3538
|
+
_t(1, w(wo)),
|
|
3539
|
+
_t(2, ie),
|
|
3540
|
+
_t(3, w(le))
|
|
3541
|
+
], Rt);
|
|
3542
|
+
var Ys = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, Xs = (o, a, e, t) => {
|
|
3543
|
+
for (var r = t > 1 ? void 0 : t ? Gs(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
3555
3544
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
3556
|
-
return t && r &&
|
|
3557
|
-
},
|
|
3545
|
+
return t && r && Ys(a, e, r), r;
|
|
3546
|
+
}, ke = (o, a) => (e, t) => a(e, t, o);
|
|
3558
3547
|
let it = class extends me {
|
|
3559
|
-
constructor(a, e, t, r, n, i
|
|
3548
|
+
constructor(a, e, t, r, n, i) {
|
|
3560
3549
|
super();
|
|
3561
3550
|
g(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
3562
3551
|
g(this, "registerRule", (a, e, t) => {
|
|
3563
3552
|
this.register(a, e, t), this.registerFormula(a, e, t);
|
|
3564
3553
|
});
|
|
3565
|
-
this._dataValidationModel = a, this.
|
|
3554
|
+
this._dataValidationModel = a, this._injector = e, this._refRangeService = t, this._dataValidationCustomFormulaService = r, this._dataValidationFormulaService = n, this._formulaRefRangeService = i, this._initRefRange();
|
|
3566
3555
|
}
|
|
3567
3556
|
_getIdWithUnitId(a, e, t) {
|
|
3568
3557
|
return `${a}_${e}_${t}`;
|
|
@@ -3571,22 +3560,22 @@ let it = class extends me {
|
|
|
3571
3560
|
registerFormula(a, e, t) {
|
|
3572
3561
|
var l;
|
|
3573
3562
|
const r = t.uid, n = this._getIdWithUnitId(a, e, r), i = (l = this._disposableMap.get(n)) != null ? l : /* @__PURE__ */ new Set(), s = (d, c) => {
|
|
3574
|
-
const
|
|
3575
|
-
if (!
|
|
3563
|
+
const h = this._dataValidationModel.getRuleById(a, e, r);
|
|
3564
|
+
if (!h)
|
|
3576
3565
|
return { redos: [], undos: [] };
|
|
3577
|
-
const
|
|
3578
|
-
if (!
|
|
3566
|
+
const u = h[d];
|
|
3567
|
+
if (!u || u === c)
|
|
3579
3568
|
return { redos: [], undos: [] };
|
|
3580
3569
|
const f = {
|
|
3581
3570
|
unitId: a,
|
|
3582
3571
|
subUnitId: e,
|
|
3583
3572
|
ruleId: t.uid,
|
|
3584
3573
|
payload: {
|
|
3585
|
-
type:
|
|
3574
|
+
type: De.SETTING,
|
|
3586
3575
|
payload: {
|
|
3587
|
-
type:
|
|
3588
|
-
formula1:
|
|
3589
|
-
formula2:
|
|
3576
|
+
type: h.type,
|
|
3577
|
+
formula1: h.formula1,
|
|
3578
|
+
formula2: h.formula2,
|
|
3590
3579
|
[d]: c
|
|
3591
3580
|
}
|
|
3592
3581
|
}
|
|
@@ -3595,11 +3584,11 @@ let it = class extends me {
|
|
|
3595
3584
|
subUnitId: e,
|
|
3596
3585
|
ruleId: t.uid,
|
|
3597
3586
|
payload: {
|
|
3598
|
-
type:
|
|
3587
|
+
type: De.SETTING,
|
|
3599
3588
|
payload: {
|
|
3600
|
-
type:
|
|
3601
|
-
formula1:
|
|
3602
|
-
formula2:
|
|
3589
|
+
type: h.type,
|
|
3590
|
+
formula1: h.formula1,
|
|
3591
|
+
formula2: h.formula2
|
|
3603
3592
|
}
|
|
3604
3593
|
}
|
|
3605
3594
|
}, v = [
|
|
@@ -3615,33 +3604,33 @@ let it = class extends me {
|
|
|
3615
3604
|
];
|
|
3616
3605
|
return { redos: v, undos: R };
|
|
3617
3606
|
};
|
|
3618
|
-
if (t.type ===
|
|
3607
|
+
if (t.type === q.CUSTOM) {
|
|
3619
3608
|
const d = this._dataValidationCustomFormulaService.getRuleFormulaInfo(a, e, r);
|
|
3620
3609
|
if (d) {
|
|
3621
3610
|
const c = this._formulaRefRangeService.registerFormula(
|
|
3622
3611
|
d.formula,
|
|
3623
|
-
(
|
|
3612
|
+
(h) => s("formula1", h)
|
|
3624
3613
|
);
|
|
3625
3614
|
i.add(() => c.dispose());
|
|
3626
3615
|
}
|
|
3627
3616
|
}
|
|
3628
|
-
if (t.type !==
|
|
3617
|
+
if (t.type !== q.CUSTOM) {
|
|
3629
3618
|
const d = this._dataValidationFormulaService.getRuleFormulaInfo(a, e, r);
|
|
3630
3619
|
if (d) {
|
|
3631
|
-
const [c,
|
|
3620
|
+
const [c, h] = d;
|
|
3632
3621
|
if (c) {
|
|
3633
|
-
const
|
|
3622
|
+
const u = this._formulaRefRangeService.registerFormula(
|
|
3634
3623
|
c.text,
|
|
3635
3624
|
(f) => s("formula1", f)
|
|
3636
3625
|
);
|
|
3637
|
-
i.add(() =>
|
|
3626
|
+
i.add(() => u.dispose());
|
|
3638
3627
|
}
|
|
3639
|
-
if (
|
|
3640
|
-
const
|
|
3641
|
-
|
|
3628
|
+
if (h) {
|
|
3629
|
+
const u = this._formulaRefRangeService.registerFormula(
|
|
3630
|
+
h.text,
|
|
3642
3631
|
(f) => s("formula1", f)
|
|
3643
3632
|
);
|
|
3644
|
-
i.add(() =>
|
|
3633
|
+
i.add(() => u.dispose());
|
|
3645
3634
|
}
|
|
3646
3635
|
}
|
|
3647
3636
|
}
|
|
@@ -3649,17 +3638,17 @@ let it = class extends me {
|
|
|
3649
3638
|
register(a, e, t) {
|
|
3650
3639
|
var l;
|
|
3651
3640
|
const r = (d) => {
|
|
3652
|
-
const c = [...t.ranges],
|
|
3653
|
-
if (
|
|
3641
|
+
const c = [...t.ranges], u = c.map((m) => go(m, d)).filter((m) => !!m).flat();
|
|
3642
|
+
if (Zr(u, c))
|
|
3654
3643
|
return { redos: [], undos: [] };
|
|
3655
|
-
if (
|
|
3644
|
+
if (u.length) {
|
|
3656
3645
|
const m = {
|
|
3657
3646
|
unitId: a,
|
|
3658
3647
|
subUnitId: e,
|
|
3659
3648
|
ruleId: t.uid,
|
|
3660
3649
|
payload: {
|
|
3661
|
-
type:
|
|
3662
|
-
payload:
|
|
3650
|
+
type: De.RANGE,
|
|
3651
|
+
payload: u
|
|
3663
3652
|
}
|
|
3664
3653
|
}, v = [{ id: Ye.id, params: m }], R = [{
|
|
3665
3654
|
id: Ye.id,
|
|
@@ -3668,14 +3657,14 @@ let it = class extends me {
|
|
|
3668
3657
|
subUnitId: e,
|
|
3669
3658
|
ruleId: t.uid,
|
|
3670
3659
|
payload: {
|
|
3671
|
-
type:
|
|
3660
|
+
type: De.RANGE,
|
|
3672
3661
|
payload: c
|
|
3673
3662
|
}
|
|
3674
3663
|
}
|
|
3675
3664
|
}];
|
|
3676
3665
|
return { redos: v, undos: R };
|
|
3677
3666
|
} else {
|
|
3678
|
-
const m = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id:
|
|
3667
|
+
const m = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id: It.id, params: m }], R = so(this._injector, m);
|
|
3679
3668
|
return { redos: v, undos: R };
|
|
3680
3669
|
}
|
|
3681
3670
|
}, n = [];
|
|
@@ -3688,141 +3677,117 @@ let it = class extends me {
|
|
|
3688
3677
|
}
|
|
3689
3678
|
_initRefRange() {
|
|
3690
3679
|
this.disposeWithMe(
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
}
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
switch (e.type) {
|
|
3711
|
-
case "add": {
|
|
3712
|
-
const i = e.rule;
|
|
3713
|
-
this.registerRule(e.unitId, e.subUnitId, i);
|
|
3714
|
-
break;
|
|
3715
|
-
}
|
|
3716
|
-
case "remove": {
|
|
3717
|
-
const i = this._disposableMap.get(this._getIdWithUnitId(t, r, n.uid));
|
|
3718
|
-
i && i.forEach((s) => s());
|
|
3719
|
-
break;
|
|
3720
|
-
}
|
|
3721
|
-
case "update": {
|
|
3722
|
-
const i = e.rule, s = this._disposableMap.get(this._getIdWithUnitId(t, r, i.uid));
|
|
3723
|
-
s && s.forEach((l) => l()), this.registerRule(e.unitId, e.subUnitId, i);
|
|
3724
|
-
break;
|
|
3725
|
-
}
|
|
3726
|
-
}
|
|
3727
|
-
})
|
|
3728
|
-
)
|
|
3729
|
-
);
|
|
3680
|
+
this._dataValidationModel.ruleChange$.subscribe((a) => {
|
|
3681
|
+
const { unitId: e, subUnitId: t, rule: r } = a;
|
|
3682
|
+
switch (a.type) {
|
|
3683
|
+
case "add": {
|
|
3684
|
+
const n = a.rule;
|
|
3685
|
+
this.registerRule(a.unitId, a.subUnitId, n);
|
|
3686
|
+
break;
|
|
3687
|
+
}
|
|
3688
|
+
case "remove": {
|
|
3689
|
+
const n = this._disposableMap.get(this._getIdWithUnitId(e, t, r.uid));
|
|
3690
|
+
n && n.forEach((i) => i());
|
|
3691
|
+
break;
|
|
3692
|
+
}
|
|
3693
|
+
case "update": {
|
|
3694
|
+
const n = a.rule, i = this._disposableMap.get(this._getIdWithUnitId(e, t, n.uid));
|
|
3695
|
+
i && i.forEach((s) => s()), this.registerRule(a.unitId, a.subUnitId, n);
|
|
3696
|
+
break;
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3730
3699
|
})
|
|
3731
|
-
), this.disposeWithMe(
|
|
3700
|
+
), this.disposeWithMe(ma(() => {
|
|
3732
3701
|
this._disposableMap.forEach((a) => {
|
|
3733
3702
|
a.forEach((e) => e());
|
|
3734
3703
|
}), this._disposableMap.clear();
|
|
3735
3704
|
}));
|
|
3736
3705
|
}
|
|
3737
3706
|
};
|
|
3738
|
-
it =
|
|
3739
|
-
ge
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
pe(6, V(he)),
|
|
3747
|
-
pe(7, V(tn)),
|
|
3748
|
-
pe(8, te),
|
|
3749
|
-
pe(9, V(ht))
|
|
3707
|
+
it = Xs([
|
|
3708
|
+
ve(ge.Ready, it),
|
|
3709
|
+
ke(0, w(Z)),
|
|
3710
|
+
ke(1, w(Be)),
|
|
3711
|
+
ke(2, w(vo)),
|
|
3712
|
+
ke(3, w(Ke)),
|
|
3713
|
+
ke(4, w(he)),
|
|
3714
|
+
ke(5, w(nn))
|
|
3750
3715
|
], it);
|
|
3751
|
-
var
|
|
3752
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
3716
|
+
var qs = Object.defineProperty, zs = Object.getOwnPropertyDescriptor, Qs = (o, a, e, t) => {
|
|
3717
|
+
for (var r = t > 1 ? void 0 : t ? zs(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
3753
3718
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
3754
|
-
return t && r &&
|
|
3719
|
+
return t && r && qs(a, e, r), r;
|
|
3755
3720
|
}, Xa = (o, a) => (e, t) => a(e, t, o);
|
|
3756
|
-
let
|
|
3721
|
+
let Ct = class extends me {
|
|
3757
3722
|
constructor(o, a) {
|
|
3758
3723
|
super(), this._autoFillService = o, this._dataValidationModel = a, this._initAutoFill();
|
|
3759
3724
|
}
|
|
3760
3725
|
// eslint-disable-next-line max-lines-per-function
|
|
3761
3726
|
_initAutoFill() {
|
|
3762
3727
|
const o = () => ({ redos: [], undos: [] }), a = (t) => {
|
|
3763
|
-
const { source: r, target: n, unitId: i, subUnitId: s } = t, l = this._dataValidationModel.ensureManager(i, s), d = l.getRuleObjectMatrix().clone(), c =
|
|
3764
|
-
row:
|
|
3765
|
-
col:
|
|
3728
|
+
const { source: r, target: n, unitId: i, subUnitId: s } = t, l = this._dataValidationModel.ensureManager(i, s), d = l.getRuleObjectMatrix().clone(), c = aa([r, n]), [h, u] = c.ranges, { mapFunc: f } = c, m = {
|
|
3729
|
+
row: h.startRow,
|
|
3730
|
+
col: h.startColumn
|
|
3766
3731
|
};
|
|
3767
|
-
|
|
3768
|
-
const I = _.repeatStartCell,
|
|
3732
|
+
yo(h, u).forEach((_) => {
|
|
3733
|
+
const I = _.repeatStartCell, D = _.relativeRange, N = {
|
|
3769
3734
|
startRow: m.row,
|
|
3770
3735
|
startColumn: m.col,
|
|
3771
3736
|
endColumn: m.col,
|
|
3772
3737
|
endRow: m.row
|
|
3773
|
-
},
|
|
3738
|
+
}, E = {
|
|
3774
3739
|
startRow: I.row,
|
|
3775
3740
|
startColumn: I.col,
|
|
3776
3741
|
endColumn: I.col,
|
|
3777
3742
|
endRow: I.row
|
|
3778
3743
|
};
|
|
3779
|
-
|
|
3780
|
-
const
|
|
3744
|
+
G.foreach(D, (L, j) => {
|
|
3745
|
+
const A = qe.getPositionRange(
|
|
3781
3746
|
{
|
|
3782
|
-
startRow:
|
|
3783
|
-
startColumn:
|
|
3784
|
-
endColumn:
|
|
3785
|
-
endRow:
|
|
3747
|
+
startRow: L,
|
|
3748
|
+
startColumn: j,
|
|
3749
|
+
endColumn: j,
|
|
3750
|
+
endRow: L
|
|
3786
3751
|
},
|
|
3787
|
-
|
|
3788
|
-
), { row:
|
|
3752
|
+
N
|
|
3753
|
+
), { row: P, col: B } = f(A.startRow, A.startColumn), X = l.getRuleIdByLocation(P, B);
|
|
3789
3754
|
if (X) {
|
|
3790
|
-
const
|
|
3755
|
+
const x = qe.getPositionRange(
|
|
3791
3756
|
{
|
|
3792
|
-
startRow:
|
|
3793
|
-
startColumn:
|
|
3794
|
-
endColumn:
|
|
3795
|
-
endRow:
|
|
3757
|
+
startRow: L,
|
|
3758
|
+
startColumn: j,
|
|
3759
|
+
endColumn: j,
|
|
3760
|
+
endRow: L
|
|
3796
3761
|
},
|
|
3797
|
-
|
|
3798
|
-
), { row:
|
|
3799
|
-
d.setValue(
|
|
3762
|
+
E
|
|
3763
|
+
), { row: b, col: k } = f(x.startRow, x.startColumn);
|
|
3764
|
+
d.setValue(b, k, X);
|
|
3800
3765
|
}
|
|
3801
3766
|
});
|
|
3802
3767
|
});
|
|
3803
|
-
const R = d.diff(l.getDataValidations()), { redoMutations: S, undoMutations:
|
|
3768
|
+
const R = d.diff(l.getDataValidations()), { redoMutations: S, undoMutations: V } = Qe(i, s, R);
|
|
3804
3769
|
return {
|
|
3805
|
-
undos:
|
|
3770
|
+
undos: V,
|
|
3806
3771
|
redos: S
|
|
3807
3772
|
};
|
|
3808
3773
|
}, e = {
|
|
3809
|
-
id:
|
|
3810
|
-
onFillData: (t, r, n) => n ===
|
|
3774
|
+
id: wa,
|
|
3775
|
+
onFillData: (t, r, n) => n === Pt.COPY || n === Pt.ONLY_FORMAT || n === Pt.SERIES ? a(t) : o()
|
|
3811
3776
|
};
|
|
3812
3777
|
this.disposeWithMe(this._autoFillService.addHook(e));
|
|
3813
3778
|
}
|
|
3814
3779
|
};
|
|
3815
|
-
|
|
3816
|
-
ge
|
|
3817
|
-
Xa(0,
|
|
3818
|
-
Xa(1,
|
|
3819
|
-
],
|
|
3820
|
-
var
|
|
3821
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
3780
|
+
Ct = Qs([
|
|
3781
|
+
ve(ge.Ready, Ct),
|
|
3782
|
+
Xa(0, Do),
|
|
3783
|
+
Xa(1, w(Z))
|
|
3784
|
+
], Ct);
|
|
3785
|
+
var Ks = Object.defineProperty, Zs = Object.getOwnPropertyDescriptor, Js = (o, a, e, t) => {
|
|
3786
|
+
for (var r = t > 1 ? void 0 : t ? Zs(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
3822
3787
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
3823
|
-
return t && r &&
|
|
3824
|
-
},
|
|
3825
|
-
let
|
|
3788
|
+
return t && r && Ks(a, e, r), r;
|
|
3789
|
+
}, Gt = (o, a) => (e, t) => a(e, t, o);
|
|
3790
|
+
let Vt = class extends me {
|
|
3826
3791
|
constructor(a, e, t) {
|
|
3827
3792
|
super();
|
|
3828
3793
|
g(this, "_copyInfo");
|
|
@@ -3830,10 +3795,10 @@ let Mt = class extends me {
|
|
|
3830
3795
|
}
|
|
3831
3796
|
_initCopyPaste() {
|
|
3832
3797
|
this._sheetClipboardService.addClipboardHook({
|
|
3833
|
-
id:
|
|
3798
|
+
id: wa,
|
|
3834
3799
|
onBeforeCopy: (a, e, t) => this._collect(a, e, t),
|
|
3835
3800
|
onPasteCells: (a, e, t, r) => {
|
|
3836
|
-
const { copyType: n =
|
|
3801
|
+
const { copyType: n = Na.COPY, pasteType: i } = r, { range: s } = a || {}, { range: l, unitId: d, subUnitId: c } = e;
|
|
3837
3802
|
return this._generateMutations(l, { copyType: n, pasteType: i, copyRange: s, unitId: d, subUnitId: c });
|
|
3838
3803
|
}
|
|
3839
3804
|
});
|
|
@@ -3847,14 +3812,14 @@ let Mt = class extends me {
|
|
|
3847
3812
|
};
|
|
3848
3813
|
const n = this._dataValidationModel.ensureManager(a, e), i = {
|
|
3849
3814
|
get: this._injector.get.bind(this._injector)
|
|
3850
|
-
}, s =
|
|
3815
|
+
}, s = Eo(t, i, a, e);
|
|
3851
3816
|
if (!s)
|
|
3852
3817
|
return;
|
|
3853
3818
|
const { rows: l, cols: d } = s;
|
|
3854
|
-
l.forEach((c,
|
|
3855
|
-
d.forEach((
|
|
3856
|
-
const m = n.getRuleIdByLocation(c,
|
|
3857
|
-
r.setValue(
|
|
3819
|
+
l.forEach((c, h) => {
|
|
3820
|
+
d.forEach((u, f) => {
|
|
3821
|
+
const m = n.getRuleIdByLocation(c, u);
|
|
3822
|
+
r.setValue(h, f, m != null ? m : "");
|
|
3858
3823
|
});
|
|
3859
3824
|
});
|
|
3860
3825
|
}
|
|
@@ -3862,54 +3827,54 @@ let Mt = class extends me {
|
|
|
3862
3827
|
_generateMutations(a, e) {
|
|
3863
3828
|
if (!this._copyInfo)
|
|
3864
3829
|
return { redos: [], undos: [] };
|
|
3865
|
-
if (e.copyType ===
|
|
3830
|
+
if (e.copyType === Na.CUT)
|
|
3866
3831
|
return this._copyInfo = null, { redos: [], undos: [] };
|
|
3867
3832
|
if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !e.copyRange)
|
|
3868
3833
|
return { redos: [], undos: [] };
|
|
3869
3834
|
if ([
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3835
|
+
At.SPECIAL_PASTE_COL_WIDTH,
|
|
3836
|
+
At.SPECIAL_PASTE_VALUE,
|
|
3837
|
+
At.SPECIAL_PASTE_FORMAT,
|
|
3838
|
+
sn
|
|
3874
3839
|
].includes(
|
|
3875
3840
|
e.pasteType
|
|
3876
3841
|
))
|
|
3877
3842
|
return { redos: [], undos: [] };
|
|
3878
3843
|
const { unitId: t, subUnitId: r } = this._copyInfo;
|
|
3879
3844
|
if (e.unitId !== t || r !== e.subUnitId) {
|
|
3880
|
-
const n = this._dataValidationModel.ensureManager(t, r), i = this._dataValidationModel.ensureManager(e.unitId, e.subUnitId), s = i.getRuleObjectMatrix().clone(), { ranges: [l, d], mapFunc: c } =
|
|
3881
|
-
|
|
3845
|
+
const n = this._dataValidationModel.ensureManager(t, r), i = this._dataValidationModel.ensureManager(e.unitId, e.subUnitId), s = i.getRuleObjectMatrix().clone(), { ranges: [l, d], mapFunc: c } = aa([e.copyRange, a]), h = Fa(l, d, !0), u = /* @__PURE__ */ new Map();
|
|
3846
|
+
h.forEach(({ startRange: v }) => {
|
|
3882
3847
|
var R;
|
|
3883
|
-
(R = this._copyInfo) == null || R.matrix.forValue((S,
|
|
3848
|
+
(R = this._copyInfo) == null || R.matrix.forValue((S, V, _) => {
|
|
3884
3849
|
const I = qe.getPositionRange(
|
|
3885
3850
|
{
|
|
3886
3851
|
startRow: S,
|
|
3887
3852
|
endRow: S,
|
|
3888
|
-
startColumn:
|
|
3889
|
-
endColumn:
|
|
3853
|
+
startColumn: V,
|
|
3854
|
+
endColumn: V
|
|
3890
3855
|
},
|
|
3891
3856
|
v
|
|
3892
|
-
),
|
|
3893
|
-
!i.getRuleById(
|
|
3894
|
-
const { row:
|
|
3895
|
-
s.setValue(
|
|
3857
|
+
), D = `${r}-${_}`, N = n.getRuleById(_);
|
|
3858
|
+
!i.getRuleById(D) && N && u.set(D, { ...N, uid: D });
|
|
3859
|
+
const { row: E, col: L } = c(I.startRow, I.startColumn);
|
|
3860
|
+
s.setValue(E, L, D);
|
|
3896
3861
|
});
|
|
3897
3862
|
});
|
|
3898
3863
|
const { redoMutations: f, undoMutations: m } = Qe(
|
|
3899
3864
|
e.unitId,
|
|
3900
3865
|
e.subUnitId,
|
|
3901
|
-
s.diffWithAddition(i.getDataValidations(),
|
|
3866
|
+
s.diffWithAddition(i.getDataValidations(), u.values())
|
|
3902
3867
|
);
|
|
3903
3868
|
return {
|
|
3904
3869
|
redos: f,
|
|
3905
3870
|
undos: m
|
|
3906
3871
|
};
|
|
3907
3872
|
} else {
|
|
3908
|
-
const n = this._dataValidationModel.ensureManager(t, r), i = n.getRuleObjectMatrix().clone(), { ranges: [s, l], mapFunc: d } =
|
|
3909
|
-
|
|
3873
|
+
const n = this._dataValidationModel.ensureManager(t, r), i = n.getRuleObjectMatrix().clone(), { ranges: [s, l], mapFunc: d } = aa([e.copyRange, a]);
|
|
3874
|
+
Fa(s, l, !0).forEach(({ startRange: f }) => {
|
|
3910
3875
|
var m;
|
|
3911
3876
|
(m = this._copyInfo) == null || m.matrix.forValue((v, R, S) => {
|
|
3912
|
-
const
|
|
3877
|
+
const V = qe.getPositionRange(
|
|
3913
3878
|
{
|
|
3914
3879
|
startRow: v,
|
|
3915
3880
|
endRow: v,
|
|
@@ -3917,28 +3882,28 @@ let Mt = class extends me {
|
|
|
3917
3882
|
endColumn: R
|
|
3918
3883
|
},
|
|
3919
3884
|
f
|
|
3920
|
-
), { row: _, col: I } = d(
|
|
3885
|
+
), { row: _, col: I } = d(V.startRow, V.startColumn);
|
|
3921
3886
|
i.setValue(_, I, S);
|
|
3922
3887
|
});
|
|
3923
3888
|
});
|
|
3924
|
-
const { redoMutations:
|
|
3889
|
+
const { redoMutations: h, undoMutations: u } = Qe(
|
|
3925
3890
|
t,
|
|
3926
3891
|
r,
|
|
3927
3892
|
i.diff(n.getDataValidations())
|
|
3928
3893
|
);
|
|
3929
3894
|
return {
|
|
3930
|
-
redos:
|
|
3931
|
-
undos:
|
|
3895
|
+
redos: h,
|
|
3896
|
+
undos: u
|
|
3932
3897
|
};
|
|
3933
3898
|
}
|
|
3934
3899
|
}
|
|
3935
3900
|
};
|
|
3936
|
-
|
|
3937
|
-
ge
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
],
|
|
3901
|
+
Vt = Js([
|
|
3902
|
+
ve(ge.Ready, Vt),
|
|
3903
|
+
Gt(0, Oo),
|
|
3904
|
+
Gt(1, w(Z)),
|
|
3905
|
+
Gt(2, w(Be))
|
|
3906
|
+
], Vt);
|
|
3942
3907
|
class Da {
|
|
3943
3908
|
constructor(a) {
|
|
3944
3909
|
g(this, "value");
|
|
@@ -3947,21 +3912,21 @@ class Da {
|
|
|
3947
3912
|
addRule(a) {
|
|
3948
3913
|
const e = a.uid;
|
|
3949
3914
|
a.ranges.forEach((t) => {
|
|
3950
|
-
|
|
3915
|
+
G.foreach(t, (r, n) => {
|
|
3951
3916
|
this.value.setValue(r, n, e);
|
|
3952
3917
|
});
|
|
3953
3918
|
});
|
|
3954
3919
|
}
|
|
3955
3920
|
removeRange(a) {
|
|
3956
3921
|
a.forEach((e) => {
|
|
3957
|
-
|
|
3922
|
+
G.foreach(e, (t, r) => {
|
|
3958
3923
|
this.value.realDeleteValue(t, r);
|
|
3959
3924
|
});
|
|
3960
3925
|
});
|
|
3961
3926
|
}
|
|
3962
3927
|
removeRule(a) {
|
|
3963
3928
|
a.ranges.forEach((e) => {
|
|
3964
|
-
|
|
3929
|
+
G.foreach(e, (t, r) => {
|
|
3965
3930
|
this.value.setValue(t, r, "");
|
|
3966
3931
|
});
|
|
3967
3932
|
});
|
|
@@ -3969,15 +3934,15 @@ class Da {
|
|
|
3969
3934
|
updateRange(a, e, t) {
|
|
3970
3935
|
const r = `${a}$`;
|
|
3971
3936
|
e.forEach((n) => {
|
|
3972
|
-
|
|
3937
|
+
G.foreach(n, (i, s) => {
|
|
3973
3938
|
this.value.getValue(i, s) === a && this.value.setValue(i, s, r);
|
|
3974
3939
|
});
|
|
3975
3940
|
}), t.forEach((n) => {
|
|
3976
|
-
|
|
3941
|
+
G.foreach(n, (i, s) => {
|
|
3977
3942
|
this.value.setValue(i, s, a);
|
|
3978
3943
|
});
|
|
3979
3944
|
}), e.forEach((n) => {
|
|
3980
|
-
|
|
3945
|
+
G.foreach(n, (i, s) => {
|
|
3981
3946
|
this.value.getValue(i, s) === r && this.value.realDeleteValue(i, s);
|
|
3982
3947
|
});
|
|
3983
3948
|
});
|
|
@@ -3986,7 +3951,7 @@ class Da {
|
|
|
3986
3951
|
const e = [];
|
|
3987
3952
|
let t = 0;
|
|
3988
3953
|
return a.forEach((r, n) => {
|
|
3989
|
-
const i =
|
|
3954
|
+
const i = Lt(this.value, (l) => l === r.uid), s = r.ranges;
|
|
3990
3955
|
(i.length !== s.length || i.some((l, d) => !qe.equals(l, s[d]))) && e.push({
|
|
3991
3956
|
type: "update",
|
|
3992
3957
|
ruleId: r.uid,
|
|
@@ -4003,7 +3968,7 @@ class Da {
|
|
|
4003
3968
|
const t = [];
|
|
4004
3969
|
let r = 0;
|
|
4005
3970
|
return a.forEach((n, i) => {
|
|
4006
|
-
const s =
|
|
3971
|
+
const s = Lt(this.value, (d) => d === n.uid), l = n.ranges;
|
|
4007
3972
|
(s.length !== l.length || s.some((d, c) => !qe.equals(d, l[c]))) && t.push({
|
|
4008
3973
|
type: "update",
|
|
4009
3974
|
ruleId: n.uid,
|
|
@@ -4015,7 +3980,7 @@ class Da {
|
|
|
4015
3980
|
index: i - r
|
|
4016
3981
|
}), r++);
|
|
4017
3982
|
}), Array.from(e).forEach((n) => {
|
|
4018
|
-
const i =
|
|
3983
|
+
const i = Lt(this.value, (s) => s === n.uid);
|
|
4019
3984
|
t.push({
|
|
4020
3985
|
type: "add",
|
|
4021
3986
|
rule: {
|
|
@@ -4035,7 +4000,7 @@ class Da {
|
|
|
4035
4000
|
return this.value.setValue(a, e, t);
|
|
4036
4001
|
}
|
|
4037
4002
|
}
|
|
4038
|
-
class
|
|
4003
|
+
class el extends lo {
|
|
4039
4004
|
constructor(e, t, r, n) {
|
|
4040
4005
|
super(e, t, r);
|
|
4041
4006
|
/**
|
|
@@ -4053,8 +4018,8 @@ class Js extends no {
|
|
|
4053
4018
|
r == null || r.forEach((s) => {
|
|
4054
4019
|
const l = s.uid;
|
|
4055
4020
|
s.ranges.forEach((d) => {
|
|
4056
|
-
|
|
4057
|
-
i.setValue(c,
|
|
4021
|
+
G.foreach(d, (c, h) => {
|
|
4022
|
+
i.setValue(c, h, l);
|
|
4058
4023
|
});
|
|
4059
4024
|
});
|
|
4060
4025
|
}), r == null || r.forEach((s) => {
|
|
@@ -4064,7 +4029,7 @@ class Js extends no {
|
|
|
4064
4029
|
_addRuleSideEffect(e) {
|
|
4065
4030
|
var n;
|
|
4066
4031
|
const { unitId: t, subUnitId: r } = this;
|
|
4067
|
-
(e.type ===
|
|
4032
|
+
(e.type === q.LIST || e.type === q.LIST_MULTIPLE) && cr((n = e.formula1) != null ? n : "") && (e.formula1 = `=${e.formula1}`), this._ruleMatrix.addRule(e), this._dataValidationCacheService.addRule(t, r, e), this._dataValidationFormulaService.addRule(t, r, e.uid, e.formula1, e.formula2), this._dataValidationCustomFormulaService.addRule(t, r, e);
|
|
4068
4033
|
}
|
|
4069
4034
|
addRule(e, t) {
|
|
4070
4035
|
(Array.isArray(e) ? e : [e]).forEach((n) => {
|
|
@@ -4075,7 +4040,7 @@ class Js extends no {
|
|
|
4075
4040
|
const r = this.getRuleById(e);
|
|
4076
4041
|
if (!r)
|
|
4077
4042
|
throw new Error(`Rule not found! id: ${e}`);
|
|
4078
|
-
return t.type ===
|
|
4043
|
+
return t.type === De.RANGE ? (this._ruleMatrix.updateRange(e, r.ranges, t.payload), this._dataValidationCacheService.updateRuleRanges(this.unitId, this.subUnitId, e, t.payload, r.ranges), this._dataValidationCustomFormulaService.updateRuleRanges(this.unitId, this.subUnitId, e, r.ranges, t.payload)) : t.type === De.SETTING && (this._dataValidationCacheService.markRangeDirty(this.unitId, this.subUnitId, r.ranges), this._dataValidationFormulaService.updateRuleFormulaText(this.unitId, this.subUnitId, e, t.payload.formula1, t.payload.formula2), this._dataValidationCustomFormulaService.updateRuleFormula(this.unitId, this.subUnitId, e, r.ranges, t.payload.formula1)), super.updateRule(e, t);
|
|
4079
4044
|
}
|
|
4080
4045
|
removeRule(e) {
|
|
4081
4046
|
const t = this.getRuleById(e);
|
|
@@ -4090,23 +4055,23 @@ class Js extends no {
|
|
|
4090
4055
|
return this.getRuleById(r);
|
|
4091
4056
|
}
|
|
4092
4057
|
validator(e, t, r, n) {
|
|
4093
|
-
const { col: i, row: s, unitId: l, subUnitId: d } = r, c = t.uid,
|
|
4094
|
-
if (
|
|
4095
|
-
const
|
|
4096
|
-
return !
|
|
4058
|
+
const { col: i, row: s, unitId: l, subUnitId: d } = r, c = t.uid, h = this._dataValidatorRegistryService.getValidatorItem(t.type);
|
|
4059
|
+
if (h) {
|
|
4060
|
+
const u = this._cache.getValue(s, i);
|
|
4061
|
+
return !u || u.value !== e ? (this._cache.setValue(s, i, {
|
|
4097
4062
|
value: e,
|
|
4098
|
-
status:
|
|
4063
|
+
status: Ce.VALIDATING,
|
|
4099
4064
|
ruleId: c
|
|
4100
|
-
}),
|
|
4101
|
-
const m = f ?
|
|
4065
|
+
}), h.validator({ value: e, unitId: l, subUnitId: d, row: s, column: i }, t).then((f) => {
|
|
4066
|
+
const m = f ? Ce.VALID : Ce.INVALID;
|
|
4102
4067
|
this._cache.setValue(s, i, {
|
|
4103
4068
|
value: e,
|
|
4104
4069
|
status: m,
|
|
4105
4070
|
ruleId: c
|
|
4106
|
-
}), n(m);
|
|
4107
|
-
}),
|
|
4071
|
+
}), n(m, !0);
|
|
4072
|
+
}), Ce.VALIDATING) : (n(u.status, !1), u.status);
|
|
4108
4073
|
} else
|
|
4109
|
-
return
|
|
4074
|
+
return n(Ce.VALID, !1), Ce.VALID;
|
|
4110
4075
|
}
|
|
4111
4076
|
getRuleErrorMsg(e) {
|
|
4112
4077
|
const t = this.getRuleById(e);
|
|
@@ -4119,17 +4084,17 @@ class Js extends no {
|
|
|
4119
4084
|
return this._ruleMatrix;
|
|
4120
4085
|
}
|
|
4121
4086
|
}
|
|
4122
|
-
var
|
|
4123
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
4087
|
+
var tl = Object.defineProperty, al = Object.getOwnPropertyDescriptor, rl = (o, a, e, t) => {
|
|
4088
|
+
for (var r = t > 1 ? void 0 : t ? al(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
4124
4089
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
4125
|
-
return t && r &&
|
|
4090
|
+
return t && r && tl(a, e, r), r;
|
|
4126
4091
|
}, St = (o, a) => (e, t) => a(e, t, o);
|
|
4127
|
-
let
|
|
4092
|
+
let Mt = class extends me {
|
|
4128
4093
|
constructor(o, a, e, t) {
|
|
4129
4094
|
super(), this._resourceManagerService = o, this._univerInstanceService = a, this._dataValidationModel = e, this._injector = t, this._initDataValidationDataSource();
|
|
4130
4095
|
}
|
|
4131
4096
|
_createSheetDataValidationManager(o, a) {
|
|
4132
|
-
return new
|
|
4097
|
+
return new el(
|
|
4133
4098
|
o,
|
|
4134
4099
|
a,
|
|
4135
4100
|
[],
|
|
@@ -4140,63 +4105,106 @@ let wt = class extends me {
|
|
|
4140
4105
|
this._dataValidationModel.setManagerCreator(this._createSheetDataValidationManager.bind(this));
|
|
4141
4106
|
}
|
|
4142
4107
|
};
|
|
4143
|
-
|
|
4144
|
-
ge
|
|
4145
|
-
St(0,
|
|
4146
|
-
St(1,
|
|
4147
|
-
St(2,
|
|
4148
|
-
St(3,
|
|
4149
|
-
],
|
|
4150
|
-
var
|
|
4151
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
4108
|
+
Mt = rl([
|
|
4109
|
+
ve(ge.Starting, Mt),
|
|
4110
|
+
St(0, Jr),
|
|
4111
|
+
St(1, ie),
|
|
4112
|
+
St(2, w(Z)),
|
|
4113
|
+
St(3, w(Be))
|
|
4114
|
+
], Mt);
|
|
4115
|
+
var ol = Object.defineProperty, nl = Object.getOwnPropertyDescriptor, il = (o, a, e, t) => {
|
|
4116
|
+
for (var r = t > 1 ? void 0 : t ? nl(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
4152
4117
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
4153
|
-
return t && r &&
|
|
4154
|
-
},
|
|
4155
|
-
let
|
|
4118
|
+
return t && r && ol(a, e, r), r;
|
|
4119
|
+
}, Xt = (o, a) => (e, t) => a(e, t, o);
|
|
4120
|
+
let wt = class extends me {
|
|
4156
4121
|
constructor(o, a, e) {
|
|
4157
4122
|
super(), this._localeService = o, this._commandService = a, this._sheetPermissionInterceptorBaseController = e, this._commandExecutedListener();
|
|
4158
4123
|
}
|
|
4159
4124
|
_commandExecutedListener() {
|
|
4160
4125
|
this.disposeWithMe(
|
|
4161
4126
|
this._commandService.beforeCommandExecuted((o) => {
|
|
4162
|
-
o.id ===
|
|
4163
|
-
workbookTypes: [
|
|
4164
|
-
rangeTypes: [
|
|
4165
|
-
worksheetTypes: [
|
|
4166
|
-
}) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr"))), o.id ===
|
|
4167
|
-
workbookTypes: [
|
|
4168
|
-
rangeTypes: [
|
|
4169
|
-
worksheetTypes: [
|
|
4127
|
+
o.id === co.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
4128
|
+
workbookTypes: [Zt],
|
|
4129
|
+
rangeTypes: [ta],
|
|
4130
|
+
worksheetTypes: [ea, Jt]
|
|
4131
|
+
}) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr"))), o.id === Va.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
4132
|
+
workbookTypes: [Zt],
|
|
4133
|
+
rangeTypes: [ta],
|
|
4134
|
+
worksheetTypes: [ea, Jt]
|
|
4170
4135
|
}, o.params.ranges) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")));
|
|
4171
4136
|
})
|
|
4172
4137
|
);
|
|
4173
4138
|
}
|
|
4174
4139
|
};
|
|
4175
|
-
|
|
4176
|
-
ge
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
],
|
|
4181
|
-
var
|
|
4182
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
4140
|
+
wt = il([
|
|
4141
|
+
ve(ge.Ready, wt),
|
|
4142
|
+
Xt(0, w(le)),
|
|
4143
|
+
Xt(1, te),
|
|
4144
|
+
Xt(2, w(bo))
|
|
4145
|
+
], wt);
|
|
4146
|
+
var sl = Object.defineProperty, ll = Object.getOwnPropertyDescriptor, dl = (o, a, e, t) => {
|
|
4147
|
+
for (var r = t > 1 ? void 0 : t ? ll(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
4148
|
+
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
4149
|
+
return t && r && sl(a, e, r), r;
|
|
4150
|
+
}, qt = (o, a) => (e, t) => a(e, t, o);
|
|
4151
|
+
let ha = class {
|
|
4152
|
+
constructor(o, a, e) {
|
|
4153
|
+
this._univerInstanceService = o, this._dataValidationModel = a, this._dataValidationCacheService = e;
|
|
4154
|
+
}
|
|
4155
|
+
async validatorCell(o, a, e, t) {
|
|
4156
|
+
const r = this._univerInstanceService.getUnit(o, se.UNIVER_SHEET);
|
|
4157
|
+
if (!r)
|
|
4158
|
+
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
4159
|
+
const n = r.getSheetBySheetId(a);
|
|
4160
|
+
if (!n)
|
|
4161
|
+
throw new Error(`cannot find current worksheet, sheetId: ${a}`);
|
|
4162
|
+
const i = n.getCellRaw(e, t), s = this._dataValidationModel.ensureManager(o, a), l = s.getRuleByLocation(e, t);
|
|
4163
|
+
return l ? new Promise((d) => {
|
|
4164
|
+
s.validator(ne(i), l, { unitId: o, subUnitId: a, row: e, col: t }, d);
|
|
4165
|
+
}) : Ce.VALID;
|
|
4166
|
+
}
|
|
4167
|
+
async validatorWorksheet(o, a) {
|
|
4168
|
+
const t = this._dataValidationModel.ensureManager(o, a).getDataValidations();
|
|
4169
|
+
return await Promise.all(t.map((r) => Promise.all(r.ranges.map((n) => {
|
|
4170
|
+
const i = [];
|
|
4171
|
+
return G.foreach(n, (s, l) => {
|
|
4172
|
+
i.push(this.validatorCell(o, a, s, l));
|
|
4173
|
+
}), i;
|
|
4174
|
+
})))), this._dataValidationCacheService.ensureCache(o, a);
|
|
4175
|
+
}
|
|
4176
|
+
async validatorWorkbook(o) {
|
|
4177
|
+
const a = this._dataValidationModel.getSubUnitIds(o), e = await Promise.all(a.map((r) => this.validatorWorksheet(o, r))), t = {};
|
|
4178
|
+
return e.forEach((r, n) => {
|
|
4179
|
+
t[a[n]] = r;
|
|
4180
|
+
}), t;
|
|
4181
|
+
}
|
|
4182
|
+
};
|
|
4183
|
+
ha = dl([
|
|
4184
|
+
qt(0, ie),
|
|
4185
|
+
qt(1, w(Z)),
|
|
4186
|
+
qt(2, w(ht))
|
|
4187
|
+
], ha);
|
|
4188
|
+
var jr = Object.defineProperty, cl = Object.getOwnPropertyDescriptor, ul = (o, a, e) => a in o ? jr(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e, hl = (o, a, e, t) => {
|
|
4189
|
+
for (var r = t > 1 ? void 0 : t ? cl(a, e) : a, n = o.length - 1, i; n >= 0; n--)
|
|
4183
4190
|
(i = o[n]) && (r = (t ? i(a, e, r) : i(r)) || r);
|
|
4184
|
-
return t && r &&
|
|
4185
|
-
},
|
|
4186
|
-
let
|
|
4191
|
+
return t && r && jr(a, e, r), r;
|
|
4192
|
+
}, zt = (o, a) => (e, t) => a(e, t, o), Br = (o, a, e) => (ul(o, typeof a != "symbol" ? a + "" : a, e), e);
|
|
4193
|
+
let Nt = class extends to {
|
|
4187
4194
|
constructor(o = {}, a, e, t) {
|
|
4188
|
-
super(), this._config = o, this._injector = a, this._commandService = e, this._localeService = t, this._config =
|
|
4195
|
+
super(), this._config = o, this._injector = a, this._commandService = e, this._localeService = t, this._config = U.deepMerge({}, $s, this._config);
|
|
4189
4196
|
}
|
|
4190
4197
|
onStarting(o) {
|
|
4191
4198
|
[
|
|
4192
4199
|
[we],
|
|
4193
|
-
[
|
|
4200
|
+
[yt],
|
|
4194
4201
|
[ht],
|
|
4195
4202
|
[he],
|
|
4196
4203
|
[Ke],
|
|
4197
|
-
[
|
|
4204
|
+
[je],
|
|
4205
|
+
[ha],
|
|
4198
4206
|
// controller
|
|
4199
|
-
[
|
|
4207
|
+
[Mt],
|
|
4200
4208
|
[rt],
|
|
4201
4209
|
[
|
|
4202
4210
|
nt,
|
|
@@ -4204,56 +4212,60 @@ let qa = (Rt = class extends Zr {
|
|
|
4204
4212
|
useFactory: () => this._injector.createInstance(nt, this._config)
|
|
4205
4213
|
}
|
|
4206
4214
|
],
|
|
4207
|
-
[
|
|
4215
|
+
[Rt],
|
|
4208
4216
|
[it],
|
|
4209
|
-
[
|
|
4217
|
+
[wt],
|
|
4218
|
+
[Ct],
|
|
4210
4219
|
[Vt],
|
|
4211
|
-
[Mt],
|
|
4212
4220
|
[at],
|
|
4213
4221
|
[ot]
|
|
4214
4222
|
].forEach((a) => {
|
|
4215
4223
|
o.add(a);
|
|
4216
4224
|
}), [
|
|
4217
|
-
wa,
|
|
4218
|
-
_r,
|
|
4219
4225
|
Ma,
|
|
4220
|
-
|
|
4226
|
+
_r,
|
|
4221
4227
|
Va,
|
|
4222
|
-
|
|
4228
|
+
// operation
|
|
4229
|
+
Ca,
|
|
4230
|
+
Vn,
|
|
4223
4231
|
gr,
|
|
4224
4232
|
ct,
|
|
4225
|
-
|
|
4233
|
+
Cn
|
|
4226
4234
|
].forEach((a) => {
|
|
4227
4235
|
this._commandService.registerCommand(a);
|
|
4228
4236
|
});
|
|
4229
4237
|
}
|
|
4230
|
-
}
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4238
|
+
};
|
|
4239
|
+
Br(Nt, "pluginName", wa);
|
|
4240
|
+
Br(Nt, "type", se.UNIVER_SHEET);
|
|
4241
|
+
Nt = hl([
|
|
4242
|
+
eo(uo, _o, To),
|
|
4243
|
+
zt(1, w(Be)),
|
|
4244
|
+
zt(2, te),
|
|
4245
|
+
zt(3, w(le))
|
|
4246
|
+
], Nt);
|
|
4236
4247
|
export {
|
|
4237
4248
|
_r as AddSheetDataValidationAndOpenCommand,
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4249
|
+
Ma as AddSheetDataValidationCommand,
|
|
4250
|
+
wa as DATA_VALIDATION_PLUGIN_NAME,
|
|
4251
|
+
Rt as DataValidationAlertController,
|
|
4252
|
+
Ct as DataValidationAutoFillController,
|
|
4242
4253
|
ht as DataValidationCacheService,
|
|
4243
4254
|
rt as DataValidationController,
|
|
4244
|
-
|
|
4255
|
+
Vt as DataValidationCopyPasteController,
|
|
4245
4256
|
Ke as DataValidationCustomFormulaService,
|
|
4246
4257
|
at as DataValidationFormulaController,
|
|
4247
4258
|
he as DataValidationFormulaService,
|
|
4248
4259
|
it as DataValidationRefRangeController,
|
|
4249
4260
|
ot as DataValidationRejectInputController,
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4261
|
+
Vn as HideDataValidationDropdown,
|
|
4262
|
+
Tl as ICommandService,
|
|
4263
|
+
Nl as LocaleService,
|
|
4264
|
+
Fl as Plugin,
|
|
4265
|
+
yt as SheetDataValidationService,
|
|
4266
|
+
nt as SheetsDataValidationRenderController,
|
|
4267
|
+
ha as SheetsDataValidationValidatorService,
|
|
4268
|
+
Ca as ShowDataValidationDropdown,
|
|
4269
|
+
Nt as UniverSheetsDataValidationPlugin,
|
|
4270
|
+
Va as UpdateSheetDataValidationRangeCommand
|
|
4259
4271
|
};
|