@univerjs/sheets-data-validation-ui 0.8.0-nightly.202506041607 → 0.8.0
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/LICENSE +176 -0
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +282 -277
- package/lib/index.js +282 -277
- package/lib/umd/index.js +1 -1
- package/package.json +13 -13
package/lib/index.js
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
var Tr = Object.defineProperty;
|
2
2
|
var Pr = (e, t, r) => t in e ? Tr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
3
|
-
var
|
3
|
+
var D = (e, t, r) => Pr(e, typeof t != "symbol" ? t + "" : t, r);
|
4
4
|
import { LocaleService as ce, isFormulaString as Oe, DataValidationType as j, Tools as In, Inject as M, Injector as ye, Disposable as be, UniverInstanceType as X, toDisposable as Ar, IUniverInstanceService as ue, DataValidationErrorStyle as lt, DataValidationStatus as Ze, ICommandService as te, IConfigService as sn, DataValidationRenderMode as se, DisposableCollection as Lr, dayjs as Rn, numfmt as jn, CellValueType as kr, CommandType as rt, ObjectMatrix as Rt, Range as Nr, Rectangle as yt, queryObjectMatrix as Kt, Optional as Ur, RxDisposable as ln, InterceptorEffectEnum as Yn, sequenceExecute as Xn, bufferDebounceTime as Fr, debounce as xr, UndoCommand as Br, RedoCommand as Wr, isUnitRangesEqual as Hr, shallowEqual as yn, ThemeService as Zn, ColorKit as $r, VerticalAlign as de, HorizontalAlign as Re, DEFAULT_STYLES as ae, WrapStrategy as me, Plugin as Kn, merge as zn } from "@univerjs/core";
|
5
5
|
import { DataValidationFormulaController as jr, deserializeListOptions as Yr, serializeListOptions as Gn, CUSTOM_FORMULA_INPUT_NAME as qn, BASE_FORMULA_INPUT_NAME as Pt, LIST_FORMULA_INPUT_NAME as dn, CHECKBOX_FORMULA_INPUT_NAME as Jn, SheetDataValidationModel as ie, SheetsDataValidationValidatorService as Xr, getDataValidationCellValue as Nt, getCellValueOrigin as re, createDefaultNewRule as Qn, AddSheetDataValidationCommand as cn, DATA_VALIDATION_PLUGIN_NAME as er, getDataValidationDiffMutations as zt, UpdateSheetDataValidationRangeCommand as tr, DataValidationCacheService as nr, UpdateSheetDataValidationSettingCommand as bn, UpdateSheetDataValidationOptionsCommand as Zr, RemoveSheetDataValidationCommand as rr, RemoveSheetAllDataValidationCommand as Kr, DataValidationFormulaService as zr, CHECKBOX_FORMULA_2 as Gr, CHECKBOX_FORMULA_1 as qr, getFormulaResult as Ut, isLegalFormulaResult as Mn, transformCheckboxValue as Jr } from "@univerjs/sheets-data-validation";
|
6
6
|
import { jsxs as $, Fragment as dt, jsx as S } from "react/jsx-runtime";
|
7
7
|
import { FormLayout as Y, Input as Pe, Checkbox as At, clsx as Ne, borderClassName as bt, RadioGroup as un, Radio as Ae, DraggableList as Qr, Dropdown as ei, Button as Ke, Select as En } from "@univerjs/design";
|
8
|
-
import { useDependency as F, useSidebarClick as ir, useObservable as Le, useEvent as Gt, ISidebarService as or, IDialogService as ti, IZenZoneService as ar, KeyCode as
|
9
|
-
import { useState as W, useRef as
|
8
|
+
import { useDependency as F, useSidebarClick as ir, useObservable as Le, useEvent as Gt, ISidebarService as or, IDialogService as ti, IZenZoneService as ar, KeyCode as gt, MenuItemType as hn, getMenuHiddenObservable as ni, RibbonDataGroup as ri, IMenuManagerService as ii, ComponentManager as pn } from "@univerjs/ui";
|
9
|
+
import { useState as W, useRef as pt, forwardRef as Fe, createElement as Ie, useMemo as ct, useEffect as ke } from "react";
|
10
10
|
import { FormulaEditor as sr, RangeSelector as oi } from "@univerjs/sheets-formula-ui";
|
11
|
-
import { DataValidatorRegistryService as Me, DataValidationModel as
|
11
|
+
import { DataValidatorRegistryService as Me, DataValidationModel as gn, DataValidatorDropdownType as ve, DataValidatorRegistryScope as ai, TWO_FORMULA_OPERATOR_COUNT as si, getRuleOptions as Dn, getRuleSetting as Vn } from "@univerjs/data-validation";
|
12
12
|
import { debounceTime as lr, filter as vn, BehaviorSubject as On, distinctUntilChanged as li, Subject as di, bufferTime as dr, of as ci } from "rxjs";
|
13
|
-
import { DeviceInputEventType as vt, IRenderManagerService as xe, fixLineWidthByScale as Tn, Transform as ui, CheckboxShape as hi, getCurrentTypeOfRenderer as ze, CURSOR_TYPE as Ge, FontCache as
|
14
|
-
import { SheetInterceptorService as fn, VALIDATE_CELL as vi, SheetsSelectionsService as ur, SetRangeValuesCommand as st, getSheetCommandTarget as hr, rangeToDiscreteRange as fi, SheetPermissionCheckController as mi, WorksheetEditPermission as qt, WorksheetSetCellStylePermission as Jt, RangeProtectionPermissionEditPoint as Qt, WorkbookEditablePermission as en, INTERCEPTOR_POINT as
|
13
|
+
import { DeviceInputEventType as vt, IRenderManagerService as xe, fixLineWidthByScale as Tn, Transform as ui, CheckboxShape as hi, getCurrentTypeOfRenderer as ze, CURSOR_TYPE as Ge, FontCache as pi, Shape as gi, Rect as cr, getFontStyleString as Te, DocSimpleSkeleton as it, Text as Pn } from "@univerjs/engine-render";
|
14
|
+
import { SheetInterceptorService as fn, VALIDATE_CELL as vi, SheetsSelectionsService as ur, SetRangeValuesCommand as st, getSheetCommandTarget as hr, rangeToDiscreteRange as fi, SheetPermissionCheckController as mi, WorksheetEditPermission as qt, WorksheetSetCellStylePermission as Jt, RangeProtectionPermissionEditPoint as Qt, WorkbookEditablePermission as en, INTERCEPTOR_POINT as pr, InterceptCellContentPriority as gr, checkRangesEditablePermission as _i } from "@univerjs/sheets";
|
15
15
|
import { getPatternType as Si } from "@univerjs/sheets-numfmt";
|
16
|
-
import { ISheetCellDropdownManagerService as Ci, IEditorBridgeService as vr, SetCellEditVisibleOperation as ft, HoverManagerService as wi, CellAlertManagerService as Ii, CellAlertType as Ri, IAutoFillService as yi, APPLY_TYPE as ot, virtualizeDiscreteRanges as tn, getAutoFillRepeatRange as bi, ISheetClipboardService as Mi, COPY_TYPE as An, PREDEFINED_HOOK_NAME as mt, getRepeatRange as Ln, getCurrentRangeDisable$ as Ei, AutoHeightController as fr, SheetSkeletonManagerService as ut, IMarkSelectionService as
|
17
|
-
import { deserializeRangeWithSheet as
|
16
|
+
import { ISheetCellDropdownManagerService as Ci, IEditorBridgeService as vr, SetCellEditVisibleOperation as ft, HoverManagerService as wi, CellAlertManagerService as Ii, CellAlertType as Ri, IAutoFillService as yi, APPLY_TYPE as ot, virtualizeDiscreteRanges as tn, getAutoFillRepeatRange as bi, ISheetClipboardService as Mi, COPY_TYPE as An, PREDEFINED_HOOK_NAME as mt, getRepeatRange as Ln, getCurrentRangeDisable$ as Ei, AutoHeightController as fr, SheetSkeletonManagerService as ut, IMarkSelectionService as Di } from "@univerjs/sheets-ui";
|
17
|
+
import { deserializeRangeWithSheet as Vi, serializeRange as mr } from "@univerjs/engine-formula";
|
18
18
|
const Oi = (e) => {
|
19
19
|
const { isTwoFormula: t = !1, value: r, onChange: n, showError: i, validResult: o } = e, a = F(ce), l = i ? o == null ? void 0 : o.formula1 : "", s = i ? o == null ? void 0 : o.formula2 : "";
|
20
20
|
return t ? /* @__PURE__ */ $(dt, { children: [
|
@@ -108,10 +108,10 @@ function Ti(e) {
|
|
108
108
|
}
|
109
109
|
function Pi(e) {
|
110
110
|
var h;
|
111
|
-
const { unitId: t, subUnitId: r, value: n, onChange: i, showError: o, validResult: a } = e, l = o ? a == null ? void 0 : a.formula1 : void 0, s =
|
111
|
+
const { unitId: t, subUnitId: r, value: n, onChange: i, showError: o, validResult: a } = e, l = o ? a == null ? void 0 : a.formula1 : void 0, s = pt(null), [d, u] = W(!1);
|
112
112
|
return ir((c) => {
|
113
|
-
var
|
114
|
-
((
|
113
|
+
var p;
|
114
|
+
((p = s.current) == null ? void 0 : p.isClickOutSide(c)) && u(!1);
|
115
115
|
}), /* @__PURE__ */ S(Y, { error: l, children: /* @__PURE__ */ S(
|
116
116
|
sr,
|
117
117
|
{
|
@@ -149,7 +149,7 @@ var le = function() {
|
|
149
149
|
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
|
150
150
|
return r;
|
151
151
|
}, Be = Fe(function(e, t) {
|
152
|
-
var r = e.icon, n = e.id, i = e.className, o = e.extend, a = Ai(e, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), s =
|
152
|
+
var r = e.icon, n = e.id, i = e.className, o = e.extend, a = Ai(e, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), s = pt("_".concat(Ni()));
|
153
153
|
return _r(r, "".concat(n), { defIds: r.defIds, idSuffix: s.current }, le({ ref: t, className: l }, a), o);
|
154
154
|
});
|
155
155
|
function _r(e, t, r, n, i) {
|
@@ -332,43 +332,43 @@ const Ye = "#ECECEC", $i = [
|
|
332
332
|
};
|
333
333
|
function Yi(e) {
|
334
334
|
const { value: t, onChange: r = () => {
|
335
|
-
}, unitId: n, subUnitId: i, validResult: o, showError: a, ruleId: l } = e, { formula1: s = "", formula2: d = "" } = t || {}, [u, h] = W(() => Oe(s) ? "1" : "0"), [c, m] = W(u === "1" ? s : "="), [
|
335
|
+
}, unitId: n, subUnitId: i, validResult: o, showError: a, ruleId: l } = e, { formula1: s = "", formula2: d = "" } = t || {}, [u, h] = W(() => Oe(s) ? "1" : "0"), [c, m] = W(u === "1" ? s : "="), [p, b] = W(u === "1" ? s : "="), y = F(ce), g = F(Me), C = F(gn), v = F(jr), [I, w] = W(() => d.split(",")), _ = g.getValidatorItem(j.LIST), [R, L] = W([]), [N, E] = W(""), T = a ? o == null ? void 0 : o.formula1 : "", O = ct(() => C.ruleChange$.pipe(lr(16)), []), P = Le(O), k = Gt(r);
|
336
336
|
ke(() => {
|
337
337
|
(async () => {
|
338
338
|
await new Promise((f) => {
|
339
339
|
setTimeout(() => f(!0), 100);
|
340
340
|
});
|
341
|
-
const
|
342
|
-
if (Oe(U) && _ &&
|
343
|
-
const f = await _.getListAsync(
|
341
|
+
const V = C.getRuleById(n, i, l), U = V == null ? void 0 : V.formula1;
|
342
|
+
if (Oe(U) && _ && V) {
|
343
|
+
const f = await _.getListAsync(V, n, i);
|
344
344
|
L(f);
|
345
345
|
}
|
346
346
|
})();
|
347
347
|
}, [C, P, _, l, i, n]), ke(() => {
|
348
|
-
Oe(s) && s !==
|
349
|
-
}, [
|
348
|
+
Oe(s) && s !== p && (m(s), b(p));
|
349
|
+
}, [p, s]);
|
350
350
|
const [H, B] = W(() => {
|
351
|
-
const
|
352
|
-
return
|
351
|
+
const V = u !== "1" ? Yr(s) : [], U = d.split(",");
|
352
|
+
return V.map((f, A) => ({
|
353
353
|
label: f,
|
354
354
|
color: U[A] || Ye,
|
355
355
|
isRef: !1,
|
356
356
|
id: In.generateRandomId(4)
|
357
357
|
}));
|
358
|
-
}), J = (
|
359
|
-
const A = H.find((x) => x.id ===
|
358
|
+
}), J = (V, U, f) => {
|
359
|
+
const A = H.find((x) => x.id === V);
|
360
360
|
A && (A.label = U, A.color = f, B([...H]));
|
361
|
-
}, ne = (
|
362
|
-
const U = H.findIndex((f) => f.id ===
|
361
|
+
}, ne = (V) => {
|
362
|
+
const U = H.findIndex((f) => f.id === V);
|
363
363
|
U !== -1 && (H.splice(U, 1), B([...H]));
|
364
|
-
}, oe = d.split(","), he = ct(() => R.map((
|
365
|
-
label:
|
364
|
+
}, oe = d.split(","), he = ct(() => R.map((V, U) => ({
|
365
|
+
label: V,
|
366
366
|
color: oe[U] || Ye,
|
367
367
|
id: `${U}`,
|
368
368
|
isRef: !0
|
369
|
-
})), [oe, R]), z = (
|
369
|
+
})), [oe, R]), z = (V, U, f) => {
|
370
370
|
const A = [...I];
|
371
|
-
A[+
|
371
|
+
A[+V] = f, w(A), k({
|
372
372
|
formula1: s,
|
373
373
|
formula2: A.join(",")
|
374
374
|
});
|
@@ -386,13 +386,13 @@ function Yi(e) {
|
|
386
386
|
ke(() => {
|
387
387
|
if (u === "1")
|
388
388
|
return;
|
389
|
-
const
|
389
|
+
const V = /* @__PURE__ */ new Set(), U = [];
|
390
390
|
H.map((f) => ({
|
391
391
|
labelList: f.label.split(","),
|
392
392
|
item: f
|
393
393
|
})).forEach(({ item: f, labelList: A }) => {
|
394
394
|
A.forEach((x) => {
|
395
|
-
|
395
|
+
V.has(x) || (V.add(x), U.push({
|
396
396
|
label: x,
|
397
397
|
color: f.color
|
398
398
|
}));
|
@@ -401,34 +401,34 @@ function Yi(e) {
|
|
401
401
|
formula1: Gn(U.map((f) => f.label)),
|
402
402
|
formula2: U.map((f) => f.color === Ye ? "" : f.color).join(",")
|
403
403
|
});
|
404
|
-
}, [H, k, u,
|
405
|
-
const fe = Gt(async (
|
406
|
-
if (!Oe(
|
404
|
+
}, [H, k, u, p, I]);
|
405
|
+
const fe = Gt(async (V) => {
|
406
|
+
if (!Oe(V)) {
|
407
407
|
k == null || k({
|
408
408
|
formula1: "",
|
409
409
|
formula2: d
|
410
410
|
});
|
411
411
|
return;
|
412
412
|
}
|
413
|
-
v.getFormulaRefCheck(
|
414
|
-
formula1: Oe(
|
413
|
+
v.getFormulaRefCheck(V) ? (k == null || k({
|
414
|
+
formula1: Oe(V) ? V : "",
|
415
415
|
formula2: d
|
416
416
|
}), E("")) : (k == null || k({
|
417
417
|
formula1: "",
|
418
418
|
formula2: d
|
419
419
|
}), m("="), E(y.t("dataValidation.validFail.formulaError")));
|
420
|
-
}), Q =
|
421
|
-
return ir((
|
420
|
+
}), Q = pt(null), [q, G] = W(!1);
|
421
|
+
return ir((V) => {
|
422
422
|
var f;
|
423
|
-
((f = Q.current) == null ? void 0 : f.isClickOutSide(
|
423
|
+
((f = Q.current) == null ? void 0 : f.isClickOutSide(V)) && G(!1);
|
424
424
|
}), /* @__PURE__ */ $(dt, { children: [
|
425
425
|
/* @__PURE__ */ S(Y, { label: y.t("dataValidation.list.options"), children: /* @__PURE__ */ $(
|
426
426
|
un,
|
427
427
|
{
|
428
428
|
value: u,
|
429
|
-
onChange: (
|
430
|
-
h(
|
431
|
-
formula1:
|
429
|
+
onChange: (V) => {
|
430
|
+
h(V), m(p), V === "1" && k({
|
431
|
+
formula1: p === "=" ? "" : p,
|
432
432
|
formula2: I.join(",")
|
433
433
|
});
|
434
434
|
},
|
@@ -450,20 +450,20 @@ function Yi(e) {
|
|
450
450
|
isFocus: q,
|
451
451
|
isSupportAcrossSheet: !0,
|
452
452
|
onFocus: () => G(!0),
|
453
|
-
onChange: (
|
454
|
-
const U = (
|
453
|
+
onChange: (V = "") => {
|
454
|
+
const U = (V != null ? V : "").trim();
|
455
455
|
b(U), fe(U);
|
456
456
|
}
|
457
457
|
}
|
458
458
|
),
|
459
|
-
he.length > 0 && /* @__PURE__ */ S("div", { className: "univer-mt-3", children: he.map((
|
459
|
+
he.length > 0 && /* @__PURE__ */ S("div", { className: "univer-mt-3", children: he.map((V) => /* @__PURE__ */ S(
|
460
460
|
kn,
|
461
461
|
{
|
462
462
|
className: "univer-mb-3",
|
463
|
-
item:
|
463
|
+
item: V,
|
464
464
|
commonProps: { onItemChange: z }
|
465
465
|
},
|
466
|
-
|
466
|
+
V.id
|
467
467
|
)) })
|
468
468
|
] }) : /* @__PURE__ */ S(Y, { error: T, children: /* @__PURE__ */ $("div", { className: "-univer-mt-3", children: [
|
469
469
|
/* @__PURE__ */ S(
|
@@ -474,16 +474,16 @@ function Yi(e) {
|
|
474
474
|
rowHeight: 28,
|
475
475
|
margin: [0, 12],
|
476
476
|
draggableHandle: ".draggableHandle",
|
477
|
-
itemRender: (
|
477
|
+
itemRender: (V) => /* @__PURE__ */ S(
|
478
478
|
kn,
|
479
479
|
{
|
480
|
-
item:
|
480
|
+
item: V,
|
481
481
|
commonProps: {
|
482
482
|
onItemChange: J,
|
483
483
|
onItemDelete: ne
|
484
484
|
}
|
485
485
|
},
|
486
|
-
|
486
|
+
V.id
|
487
487
|
),
|
488
488
|
idKey: "id"
|
489
489
|
}
|
@@ -527,10 +527,10 @@ var Zi = Object.getOwnPropertyDescriptor, Ki = (e, t, r, n) => {
|
|
527
527
|
}, zi = (e, t) => (r, n) => t(r, n, e);
|
528
528
|
let Se = class {
|
529
529
|
constructor(e) {
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
530
|
+
D(this, "canvasRender", null);
|
531
|
+
D(this, "dropdownType");
|
532
|
+
D(this, "optionsInput");
|
533
|
+
D(this, "formulaInput", dn);
|
534
534
|
this.injector = e;
|
535
535
|
}
|
536
536
|
};
|
@@ -545,12 +545,12 @@ var Gi = Object.getOwnPropertyDescriptor, qi = (e, t, r, n) => {
|
|
545
545
|
let Ce = class extends be {
|
546
546
|
constructor(t, r) {
|
547
547
|
super();
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
548
|
+
D(this, "_open$", new On(!1));
|
549
|
+
D(this, "open$", this._open$.pipe(li()));
|
550
|
+
D(this, "_activeRule");
|
551
|
+
D(this, "_activeRule$", new On(void 0));
|
552
|
+
D(this, "activeRule$", this._activeRule$.asObservable());
|
553
|
+
D(this, "_closeDisposable", null);
|
554
554
|
this._univerInstanceService = t, this._sidebarService = r, this.disposeWithMe(
|
555
555
|
this._univerInstanceService.getCurrentTypeOfUnit$(X.UNIVER_SHEET).pipe(vn((n) => !n)).subscribe(() => {
|
556
556
|
this.close();
|
@@ -677,7 +677,7 @@ var eo = Object.getOwnPropertyDescriptor, to = (e, t, r, n) => {
|
|
677
677
|
for (var i = n > 1 ? void 0 : n ? eo(t, r) : t, o = e.length - 1, a; o >= 0; o--)
|
678
678
|
(a = e[o]) && (i = a(i) || i);
|
679
679
|
return i;
|
680
|
-
},
|
680
|
+
}, pe = (e, t) => (r, n) => t(r, n, e);
|
681
681
|
const Ft = (e) => {
|
682
682
|
if (e == null || typeof e == "boolean")
|
683
683
|
return;
|
@@ -703,11 +703,11 @@ function no(e, t) {
|
|
703
703
|
let Ue = class extends be {
|
704
704
|
constructor(t, r, n, i, o, a, l, s, d, u, h) {
|
705
705
|
super();
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
706
|
+
D(this, "_activeDropdown");
|
707
|
+
D(this, "_activeDropdown$", new di());
|
708
|
+
D(this, "_currentPopup", null);
|
709
|
+
D(this, "activeDropdown$", this._activeDropdown$.asObservable());
|
710
|
+
D(this, "_zenVisible", !1);
|
711
711
|
this._univerInstanceService = t, this._dataValidatorRegistryService = r, this._zenZoneService = n, this._dataValidationModel = i, this._sheetsSelectionsService = o, this._cellDropdownManagerService = a, this._sheetDataValidationModel = l, this._commandService = s, this._editorBridgeService = d, this._injector = u, this._configService = h, this._init(), this._initSelectionChange(), this.disposeWithMe(() => {
|
712
712
|
this._activeDropdown$.complete();
|
713
713
|
});
|
@@ -740,7 +740,7 @@ let Ue = class extends be {
|
|
740
740
|
}
|
741
741
|
// eslint-disable-next-line max-lines-per-function, complexity
|
742
742
|
showDropdown(t) {
|
743
|
-
var b, y,
|
743
|
+
var b, y, g, C;
|
744
744
|
const { location: r } = t, { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = r;
|
745
745
|
if (this._currentPopup && this._currentPopup.dispose(), this._zenVisible)
|
746
746
|
return;
|
@@ -771,7 +771,7 @@ let Ue = class extends be {
|
|
771
771
|
visible: !1,
|
772
772
|
eventType: vt.Keyboard,
|
773
773
|
unitId: o,
|
774
|
-
keycode:
|
774
|
+
keycode: gt.ESC
|
775
775
|
}), await this._commandService.executeCommand(st.id, {
|
776
776
|
unitId: o,
|
777
777
|
subUnitId: a,
|
@@ -860,7 +860,7 @@ let Ue = class extends be {
|
|
860
860
|
visible: !1,
|
861
861
|
eventType: vt.Keyboard,
|
862
862
|
unitId: o,
|
863
|
-
keycode:
|
863
|
+
keycode: gt.ESC
|
864
864
|
}), this._commandService.executeCommand(st.id, O), !v;
|
865
865
|
}, w = (d == null ? void 0 : d.renderMode) === se.CUSTOM || (d == null ? void 0 : d.renderMode) === void 0, _ = u.getListWithColor(d, o, a), R = Nt(s.getCellRaw(n, i)), L = () => {
|
866
866
|
this._commandService.executeCommand(We.id, {
|
@@ -880,7 +880,7 @@ let Ue = class extends be {
|
|
880
880
|
onEdit: L,
|
881
881
|
defaultValue: R,
|
882
882
|
multiple: v,
|
883
|
-
showEdit: (
|
883
|
+
showEdit: (g = (y = this._configService.getConfig(Sn)) == null ? void 0 : y.showEditOnDropdown) != null ? g : !0
|
884
884
|
}
|
885
885
|
};
|
886
886
|
break;
|
@@ -910,7 +910,7 @@ let Ue = class extends be {
|
|
910
910
|
visible: !1,
|
911
911
|
eventType: vt.Keyboard,
|
912
912
|
unitId: o,
|
913
|
-
keycode:
|
913
|
+
keycode: gt.ESC
|
914
914
|
}), this._commandService.syncExecuteCommand(st.id, w), !0;
|
915
915
|
},
|
916
916
|
defaultValue: Nt(s.getCellRaw(n, i)).split("/"),
|
@@ -945,7 +945,7 @@ let Ue = class extends be {
|
|
945
945
|
visible: !1,
|
946
946
|
eventType: vt.Keyboard,
|
947
947
|
unitId: o,
|
948
|
-
keycode:
|
948
|
+
keycode: gt.ESC
|
949
949
|
}), this._commandService.syncExecuteCommand(st.id, w), !0;
|
950
950
|
},
|
951
951
|
defaultValue: Nt(s.getCellRaw(n, i))
|
@@ -957,15 +957,20 @@ let Ue = class extends be {
|
|
957
957
|
default:
|
958
958
|
throw new Error("[DataValidationDropdownManagerService]: unknown type!");
|
959
959
|
}
|
960
|
-
if (h = this._cellDropdownManagerService.showDropdown(
|
960
|
+
if (h = this._cellDropdownManagerService.showDropdown({
|
961
|
+
...m,
|
962
|
+
onHide: () => {
|
963
|
+
this._activeDropdown = null, this._activeDropdown$.next(null);
|
964
|
+
}
|
965
|
+
}), !h)
|
961
966
|
throw new Error("[DataValidationDropdownManagerService]: cannot show dropdown!");
|
962
|
-
const
|
963
|
-
|
967
|
+
const p = new Lr();
|
968
|
+
p.add(h), p.add({
|
964
969
|
dispose: () => {
|
965
970
|
var v, I;
|
966
971
|
(I = (v = this._activeDropdown) == null ? void 0 : v.onHide) == null || I.call(v);
|
967
972
|
}
|
968
|
-
}), this._currentPopup =
|
973
|
+
}), this._currentPopup = p;
|
969
974
|
}
|
970
975
|
hideDropdown() {
|
971
976
|
this._activeDropdown && (this._currentPopup && this._currentPopup.dispose(), this._currentPopup = null, this._activeDropdown = null, this._activeDropdown$.next(null));
|
@@ -999,17 +1004,17 @@ let Ue = class extends be {
|
|
999
1004
|
}
|
1000
1005
|
};
|
1001
1006
|
Ue = to([
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1007
|
+
pe(0, ue),
|
1008
|
+
pe(1, M(Me)),
|
1009
|
+
pe(2, ar),
|
1010
|
+
pe(3, M(ie)),
|
1011
|
+
pe(4, M(ur)),
|
1012
|
+
pe(5, M(Ci)),
|
1013
|
+
pe(6, M(ie)),
|
1014
|
+
pe(7, te),
|
1015
|
+
pe(8, vr),
|
1016
|
+
pe(9, M(ye)),
|
1017
|
+
pe(10, sn)
|
1013
1018
|
], Ue);
|
1014
1019
|
const Et = "DataValidationPanel", We = {
|
1015
1020
|
id: "data-validation.operation.open-validation-panel",
|
@@ -1017,7 +1022,7 @@ const Et = "DataValidationPanel", We = {
|
|
1017
1022
|
handler(e, t) {
|
1018
1023
|
if (!t)
|
1019
1024
|
return !1;
|
1020
|
-
const { ruleId: r, isAdd: n } = t, i = e.get(Ce), o = e.get(
|
1025
|
+
const { ruleId: r, isAdd: n } = t, i = e.get(Ce), o = e.get(gn), a = e.get(ue), l = e.get(or), s = hr(a);
|
1021
1026
|
if (!s) return !1;
|
1022
1027
|
const { unitId: d, subUnitId: u } = s, h = r ? o.getRuleById(d, u, r) : void 0;
|
1023
1028
|
i.open(), i.setActiveRule(h && {
|
@@ -1160,16 +1165,16 @@ let Je = class extends be {
|
|
1160
1165
|
// eslint-disable-next-line max-lines-per-function
|
1161
1166
|
_initAutoFill() {
|
1162
1167
|
const e = () => ({ redos: [], undos: [] }), t = (n, i) => {
|
1163
|
-
const { source: o, target: a, unitId: l, subUnitId: s } = n, d = this._sheetDataValidationModel.getRuleObjectMatrix(l, s).clone(), u = tn([o, a]), [h, c] = u.ranges, { mapFunc: m } = u,
|
1168
|
+
const { source: o, target: a, unitId: l, subUnitId: s } = n, d = this._sheetDataValidationModel.getRuleObjectMatrix(l, s).clone(), u = tn([o, a]), [h, c] = u.ranges, { mapFunc: m } = u, p = {
|
1164
1169
|
row: h.startRow,
|
1165
1170
|
col: h.startColumn
|
1166
|
-
}, b = bi(h, c), y = new Rt(),
|
1171
|
+
}, b = bi(h, c), y = new Rt(), g = /* @__PURE__ */ new Set();
|
1167
1172
|
b.forEach((_) => {
|
1168
1173
|
const R = _.repeatStartCell, L = _.relativeRange, N = {
|
1169
|
-
startRow:
|
1170
|
-
startColumn:
|
1171
|
-
endColumn:
|
1172
|
-
endRow:
|
1174
|
+
startRow: p.row,
|
1175
|
+
startColumn: p.col,
|
1176
|
+
endColumn: p.col,
|
1177
|
+
endRow: p.row
|
1173
1178
|
}, E = {
|
1174
1179
|
startRow: R.row,
|
1175
1180
|
startColumn: R.col,
|
@@ -1194,10 +1199,10 @@ let Je = class extends be {
|
|
1194
1199
|
},
|
1195
1200
|
E
|
1196
1201
|
), { row: ne, col: oe } = m(J.startRow, J.startColumn);
|
1197
|
-
y.setValue(ne, oe, B),
|
1202
|
+
y.setValue(ne, oe, B), g.add(B);
|
1198
1203
|
});
|
1199
1204
|
});
|
1200
|
-
const C = Array.from(
|
1205
|
+
const C = Array.from(g).map((_) => ({ id: _, ranges: Kt(y, (R) => R === _) }));
|
1201
1206
|
d.addRangeRules(C);
|
1202
1207
|
const v = d.diff(this._sheetDataValidationModel.getRules(l, s)), { redoMutations: I, undoMutations: w } = zt(l, s, v, this._injector, "patched", i === ot.ONLY_FORMAT);
|
1203
1208
|
return {
|
@@ -1237,7 +1242,7 @@ var so = Object.getOwnPropertyDescriptor, lo = (e, t, r, n) => {
|
|
1237
1242
|
let Qe = class extends be {
|
1238
1243
|
constructor(t, r, n) {
|
1239
1244
|
super();
|
1240
|
-
|
1245
|
+
D(this, "_copyInfo");
|
1241
1246
|
this._sheetClipboardService = t, this._sheetDataValidationModel = r, this._injector = n, this._initCopyPaste();
|
1242
1247
|
}
|
1243
1248
|
_initCopyPaste() {
|
@@ -1286,7 +1291,7 @@ let Qe = class extends be {
|
|
1286
1291
|
const { unitId: i, subUnitId: o } = this._copyInfo;
|
1287
1292
|
if (r.unitId !== i || o !== r.subUnitId) {
|
1288
1293
|
const a = this._sheetDataValidationModel.getRuleObjectMatrix(r.unitId, r.subUnitId).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [d, u], mapFunc: h } = tn([r.copyRange, t]), c = Ln(d, u, !0), m = /* @__PURE__ */ new Map();
|
1289
|
-
c.forEach(({ startRange:
|
1294
|
+
c.forEach(({ startRange: g }) => {
|
1290
1295
|
var C;
|
1291
1296
|
(C = this._copyInfo) == null || C.matrix.forValue((v, I, w) => {
|
1292
1297
|
const _ = yt.getPositionRange(
|
@@ -1296,15 +1301,15 @@ let Qe = class extends be {
|
|
1296
1301
|
startColumn: I,
|
1297
1302
|
endColumn: I
|
1298
1303
|
},
|
1299
|
-
|
1304
|
+
g
|
1300
1305
|
), R = `${o}-${w}`, L = this._sheetDataValidationModel.getRuleById(i, o, w);
|
1301
1306
|
!this._sheetDataValidationModel.getRuleById(r.unitId, r.subUnitId, R) && L && m.set(R, { ...L, uid: R });
|
1302
1307
|
const { row: N, col: E } = h(_.startRow, _.startColumn);
|
1303
1308
|
s.add(R), l.setValue(N, E, R);
|
1304
1309
|
});
|
1305
1310
|
});
|
1306
|
-
const
|
1307
|
-
a.addRangeRules(
|
1311
|
+
const p = Array.from(s).map((g) => ({ id: g, ranges: Kt(l, (C) => C === g) }));
|
1312
|
+
a.addRangeRules(p);
|
1308
1313
|
const { redoMutations: b, undoMutations: y } = zt(
|
1309
1314
|
r.unitId,
|
1310
1315
|
r.subUnitId,
|
@@ -1320,8 +1325,8 @@ let Qe = class extends be {
|
|
1320
1325
|
} else {
|
1321
1326
|
const a = this._sheetDataValidationModel.getRuleObjectMatrix(i, o).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [d, u], mapFunc: h } = tn([r.copyRange, t]);
|
1322
1327
|
Ln(d, u, !0).forEach(({ startRange: y }) => {
|
1323
|
-
var
|
1324
|
-
(
|
1328
|
+
var g;
|
1329
|
+
(g = this._copyInfo) == null || g.matrix.forValue((C, v, I) => {
|
1325
1330
|
const w = yt.getPositionRange(
|
1326
1331
|
{
|
1327
1332
|
startRow: C,
|
@@ -1334,9 +1339,9 @@ let Qe = class extends be {
|
|
1334
1339
|
l.setValue(_, R, I), s.add(I);
|
1335
1340
|
});
|
1336
1341
|
});
|
1337
|
-
const m = Array.from(s).map((y) => ({ id: y, ranges: Kt(l, (
|
1342
|
+
const m = Array.from(s).map((y) => ({ id: y, ranges: Kt(l, (g) => g === y) }));
|
1338
1343
|
a.addRangeRules(m);
|
1339
|
-
const { redoMutations:
|
1344
|
+
const { redoMutations: p, undoMutations: b } = zt(
|
1340
1345
|
i,
|
1341
1346
|
o,
|
1342
1347
|
a.diff(this._sheetDataValidationModel.getRules(i, o)),
|
@@ -1345,7 +1350,7 @@ let Qe = class extends be {
|
|
1345
1350
|
!1
|
1346
1351
|
);
|
1347
1352
|
return {
|
1348
|
-
redos:
|
1353
|
+
redos: p,
|
1349
1354
|
undos: b
|
1350
1355
|
};
|
1351
1356
|
}
|
@@ -1397,14 +1402,14 @@ function ho(e) {
|
|
1397
1402
|
disabled$: Ei(e, { workbookTypes: [en], worksheetTypes: [Jt, qt], rangeTypes: [Qt] })
|
1398
1403
|
};
|
1399
1404
|
}
|
1400
|
-
function
|
1405
|
+
function po(e) {
|
1401
1406
|
return {
|
1402
1407
|
id: We.id,
|
1403
1408
|
title: "dataValidation.panel.title",
|
1404
1409
|
type: hn.BUTTON
|
1405
1410
|
};
|
1406
1411
|
}
|
1407
|
-
function
|
1412
|
+
function go(e) {
|
1408
1413
|
return {
|
1409
1414
|
id: kt.id,
|
1410
1415
|
title: "dataValidation.panel.add",
|
@@ -1418,11 +1423,11 @@ const vo = {
|
|
1418
1423
|
menuItemFactory: ho,
|
1419
1424
|
[We.id]: {
|
1420
1425
|
order: 0,
|
1421
|
-
menuItemFactory:
|
1426
|
+
menuItemFactory: po
|
1422
1427
|
},
|
1423
1428
|
[kt.id]: {
|
1424
1429
|
order: 1,
|
1425
|
-
menuItemFactory:
|
1430
|
+
menuItemFactory: go
|
1426
1431
|
}
|
1427
1432
|
}
|
1428
1433
|
}
|
@@ -1489,26 +1494,26 @@ let tt = class extends ln {
|
|
1489
1494
|
_initViewModelIntercept() {
|
1490
1495
|
this.disposeWithMe(
|
1491
1496
|
this._sheetInterceptorService.intercept(
|
1492
|
-
|
1497
|
+
pr.CELL_CONTENT,
|
1493
1498
|
{
|
1494
1499
|
effect: Yn.Style,
|
1495
1500
|
// must be after numfmt
|
1496
|
-
priority:
|
1501
|
+
priority: gr.DATA_VALIDATION,
|
1497
1502
|
// eslint-disable-next-line max-lines-per-function, complexity
|
1498
1503
|
handler: (e, t, r) => {
|
1499
|
-
var
|
1504
|
+
var g, C, v, I, w;
|
1500
1505
|
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t, d = this._sheetDataValidationModel.getRuleIdByLocation(o, a, n, i);
|
1501
1506
|
if (!d)
|
1502
1507
|
return r(e);
|
1503
1508
|
const u = this._sheetDataValidationModel.getRuleById(o, a, d);
|
1504
1509
|
if (!u)
|
1505
1510
|
return r(e);
|
1506
|
-
const h = (
|
1507
|
-
let
|
1511
|
+
const h = (g = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? g : Ze.VALID, c = this._dataValidatorRegistryService.getValidatorItem(u.type), m = t.rawData;
|
1512
|
+
let p;
|
1508
1513
|
const b = {
|
1509
1514
|
get value() {
|
1510
1515
|
var _;
|
1511
|
-
return
|
1516
|
+
return p !== void 0 || (p = (_ = re(m)) != null ? _ : null), p;
|
1512
1517
|
}
|
1513
1518
|
}, y = {
|
1514
1519
|
get value() {
|
@@ -1614,30 +1619,30 @@ let Un = class extends ln {
|
|
1614
1619
|
_initViewModelIntercept() {
|
1615
1620
|
this.disposeWithMe(
|
1616
1621
|
this._sheetInterceptorService.intercept(
|
1617
|
-
|
1622
|
+
pr.CELL_CONTENT,
|
1618
1623
|
{
|
1619
1624
|
effect: Yn.Style,
|
1620
1625
|
// must be after numfmt
|
1621
|
-
priority:
|
1626
|
+
priority: gr.DATA_VALIDATION,
|
1622
1627
|
// eslint-disable-next-line complexity, max-lines-per-function
|
1623
1628
|
handler: (e, t, r) => {
|
1624
|
-
var y,
|
1629
|
+
var y, g, C, v, I;
|
1625
1630
|
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t, d = this._sheetDataValidationModel.getRuleIdByLocation(o, a, n, i);
|
1626
1631
|
if (!d)
|
1627
1632
|
return r(e);
|
1628
1633
|
const u = this._sheetDataValidationModel.getRuleById(o, a, d);
|
1629
1634
|
if (!u)
|
1630
1635
|
return r(e);
|
1631
|
-
const h = (y = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? y : Ze.VALID, c = this._dataValidatorRegistryService.getValidatorItem(u.type), m = s.getCellRaw(n, i),
|
1636
|
+
const h = (y = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? y : Ze.VALID, c = this._dataValidatorRegistryService.getValidatorItem(u.type), m = s.getCellRaw(n, i), p = re(m), b = `${p != null ? p : ""}`;
|
1632
1637
|
return (!e || e === t.rawData) && (e = { ...t.rawData }), e.markers = {
|
1633
1638
|
...e == null ? void 0 : e.markers,
|
1634
1639
|
...h === Ze.INVALID ? Er : null
|
1635
1640
|
}, e.customRender = [
|
1636
|
-
...(
|
1641
|
+
...(g = e == null ? void 0 : e.customRender) != null ? g : [],
|
1637
1642
|
...c != null && c.canvasRender ? [c.canvasRender] : []
|
1638
1643
|
], e.fontRenderExtension = {
|
1639
1644
|
...e == null ? void 0 : e.fontRenderExtension,
|
1640
|
-
isSkip: ((C = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : C.isSkip) || ((v = c == null ? void 0 : c.skipDefaultFontRender) == null ? void 0 : v.call(c, u,
|
1645
|
+
isSkip: ((C = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : C.isSkip) || ((v = c == null ? void 0 : c.skipDefaultFontRender) == null ? void 0 : v.call(c, u, p, t))
|
1641
1646
|
}, e.interceptorStyle = {
|
1642
1647
|
...e == null ? void 0 : e.interceptorStyle,
|
1643
1648
|
...c == null ? void 0 : c.getExtraStyle(u, b, {
|
@@ -1716,7 +1721,7 @@ var mo = Object.getOwnPropertyDescriptor, _o = (e, t, r, n) => {
|
|
1716
1721
|
(a = e[o]) && (i = a(i) || i);
|
1717
1722
|
return i;
|
1718
1723
|
}, Fn = (e, t) => (r, n) => t(r, n, e);
|
1719
|
-
let
|
1724
|
+
let Dt = class extends be {
|
1720
1725
|
constructor(e, t, r) {
|
1721
1726
|
super(), this._context = e, this._sheetDataValidationModel = t, this._sheetSkeletonManagerService = r, this._initSkeletonChange();
|
1722
1727
|
}
|
@@ -1736,13 +1741,13 @@ let Vt = class extends be {
|
|
1736
1741
|
this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe(Fr(16)).subscribe(e));
|
1737
1742
|
}
|
1738
1743
|
};
|
1739
|
-
|
1744
|
+
Dt = _o([
|
1740
1745
|
Fn(1, M(ie)),
|
1741
1746
|
Fn(2, M(ut))
|
1742
|
-
],
|
1747
|
+
], Dt);
|
1743
1748
|
function So(e) {
|
1744
1749
|
var d;
|
1745
|
-
const t = F(ce), r = F(
|
1750
|
+
const t = F(ce), r = F(pn), { value: n, onChange: i, extraComponent: o } = e, [a, l] = W(!1), s = o ? r.get(o) : null;
|
1746
1751
|
return /* @__PURE__ */ $(dt, { children: [
|
1747
1752
|
/* @__PURE__ */ $(
|
1748
1753
|
"div",
|
@@ -1807,8 +1812,8 @@ function wo(e, t, r) {
|
|
1807
1812
|
return t ? ((i = (n = e.getUnit(t)) == null ? void 0 : n.getSheetBySheetName(r)) == null ? void 0 : i.getSheetId()) || "" : ((a = (o = e.getCurrentUnitForType(X.UNIVER_SHEET)) == null ? void 0 : o.getSheetBySheetName(r)) == null ? void 0 : a.getSheetId()) || "";
|
1808
1813
|
}
|
1809
1814
|
function Io() {
|
1810
|
-
var
|
1811
|
-
const [e, t] = W(0), r = F(Ce), n = Le(r.activeRule$, r.activeRule), { unitId: i, subUnitId: o, rule: a } = n || {}, l = a.uid, s = F(Me), d = F(ue), u = F(
|
1815
|
+
var V, U;
|
1816
|
+
const [e, t] = W(0), r = F(Ce), n = Le(r.activeRule$, r.activeRule), { unitId: i, subUnitId: o, rule: a } = n || {}, l = a.uid, s = F(Me), d = F(ue), u = F(pn), h = F(te), c = F(gn), m = F(ce), [p, b] = W(a), y = s.getValidatorItem(p.type), [g, C] = W(!1), v = s.getValidatorsByScope(ai.SHEET), [I, w] = W(() => p.ranges.map((f) => ({ unitId: "", sheetId: "", range: f }))), _ = ct(() => Co(h), [h]), [R, L] = W(!1), [N, E] = W(!1), T = pt(null), O = F(ur);
|
1812
1817
|
if (ke(() => () => {
|
1813
1818
|
const f = O.getCurrentLastSelection();
|
1814
1819
|
f && O.setSelections([f]);
|
@@ -1821,11 +1826,11 @@ function Io() {
|
|
1821
1826
|
});
|
1822
1827
|
}, [h, c, l, o, i]), !y)
|
1823
1828
|
return null;
|
1824
|
-
const P = y.operators, k = y.operatorNames, H =
|
1829
|
+
const P = y.operators, k = y.operatorNames, H = p.operator ? si.includes(p.operator) : !1, B = () => {
|
1825
1830
|
var f, A, x;
|
1826
|
-
(A = (f = T.current) == null ? void 0 : f.editor) != null && A.isFocus() && J((x = T.current) == null ? void 0 : x.getValue()), !(!
|
1831
|
+
(A = (f = T.current) == null ? void 0 : f.editor) != null && A.isFocus() && J((x = T.current) == null ? void 0 : x.getValue()), !(!p.ranges.length || R) && (y.validatorFormula(p, i, o).success ? r.setActiveRule(null) : C(!0));
|
1827
1832
|
}, J = Gt((f) => {
|
1828
|
-
const A = f.split(",").filter(Boolean).map(
|
1833
|
+
const A = f.split(",").filter(Boolean).map(Vi).map((ee) => {
|
1829
1834
|
const wn = ee.sheetName;
|
1830
1835
|
if (wn) {
|
1831
1836
|
const Or = wo(d, ee.unitId, wn);
|
@@ -1841,7 +1846,7 @@ function Io() {
|
|
1841
1846
|
w(A);
|
1842
1847
|
const x = A.filter((ee) => (!ee.unitId || ee.unitId === i) && (!ee.sheetId || ee.sheetId === o)).map((ee) => ee.range);
|
1843
1848
|
if (b({
|
1844
|
-
...
|
1849
|
+
...p,
|
1845
1850
|
ranges: x
|
1846
1851
|
}), x.length === 0)
|
1847
1852
|
return;
|
@@ -1853,10 +1858,10 @@ function Io() {
|
|
1853
1858
|
};
|
1854
1859
|
_(tr.id, we);
|
1855
1860
|
}), ne = (f) => {
|
1856
|
-
if (yn(f,
|
1861
|
+
if (yn(f, Vn(p)))
|
1857
1862
|
return;
|
1858
1863
|
b({
|
1859
|
-
...
|
1864
|
+
...p,
|
1860
1865
|
...f
|
1861
1866
|
});
|
1862
1867
|
const A = {
|
@@ -1877,11 +1882,11 @@ function Io() {
|
|
1877
1882
|
subUnitId: o
|
1878
1883
|
}), r.setActiveRule(null);
|
1879
1884
|
}, he = {
|
1880
|
-
type:
|
1881
|
-
operator:
|
1882
|
-
formula1:
|
1883
|
-
formula2:
|
1884
|
-
allowBlank:
|
1885
|
+
type: p.type,
|
1886
|
+
operator: p.operator,
|
1887
|
+
formula1: p.formula1,
|
1888
|
+
formula2: p.formula2,
|
1889
|
+
allowBlank: p.allowBlank
|
1885
1890
|
}, z = (f) => {
|
1886
1891
|
const A = s.getValidatorItem(f);
|
1887
1892
|
if (!A)
|
@@ -1890,7 +1895,7 @@ function Io() {
|
|
1890
1895
|
...we,
|
1891
1896
|
type: f
|
1892
1897
|
} : {
|
1893
|
-
...
|
1898
|
+
...p,
|
1894
1899
|
type: f,
|
1895
1900
|
operator: x[0],
|
1896
1901
|
formula1: void 0,
|
@@ -1899,12 +1904,12 @@ function Io() {
|
|
1899
1904
|
b(ee), h.executeCommand(bn.id, {
|
1900
1905
|
unitId: i,
|
1901
1906
|
subUnitId: o,
|
1902
|
-
ruleId:
|
1903
|
-
setting:
|
1907
|
+
ruleId: p.uid,
|
1908
|
+
setting: Vn(ee)
|
1904
1909
|
});
|
1905
|
-
}, Z = u.get(y.formulaInput), fe = ct(() => I.map((f) => mr(f.range)).join(","), []), Q =
|
1906
|
-
yn(f,
|
1907
|
-
...
|
1910
|
+
}, Z = u.get(y.formulaInput), fe = ct(() => I.map((f) => mr(f.range)).join(","), []), Q = Dn(p), q = (f) => {
|
1911
|
+
yn(f, Dn(p)) || (b({
|
1912
|
+
...p,
|
1908
1913
|
...f
|
1909
1914
|
}), _(
|
1910
1915
|
Zr.id,
|
@@ -1915,13 +1920,13 @@ function Io() {
|
|
1915
1920
|
options: f
|
1916
1921
|
}
|
1917
1922
|
));
|
1918
|
-
}, G = P.length && !
|
1923
|
+
}, G = P.length && !p.operator;
|
1919
1924
|
return /* @__PURE__ */ $("div", { "data-u-comp": "data-validation-detail", className: "univer-py-2", children: [
|
1920
1925
|
/* @__PURE__ */ S(
|
1921
1926
|
Y,
|
1922
1927
|
{
|
1923
1928
|
label: m.t("dataValidation.panel.range"),
|
1924
|
-
error: !
|
1929
|
+
error: !p.ranges.length || R ? m.t("dataValidation.panel.rangeError") : "",
|
1925
1930
|
children: /* @__PURE__ */ S(
|
1926
1931
|
oi,
|
1927
1932
|
{
|
@@ -1946,8 +1951,8 @@ function Io() {
|
|
1946
1951
|
En,
|
1947
1952
|
{
|
1948
1953
|
className: "univer-w-full",
|
1949
|
-
value:
|
1950
|
-
options: (
|
1954
|
+
value: p.type,
|
1955
|
+
options: (V = v == null ? void 0 : v.sort((f, A) => f.order - A.order)) == null ? void 0 : V.map((f) => ({
|
1951
1956
|
label: m.t(f.title),
|
1952
1957
|
value: f.id
|
1953
1958
|
})),
|
@@ -1958,7 +1963,7 @@ function Io() {
|
|
1958
1963
|
En,
|
1959
1964
|
{
|
1960
1965
|
className: "univer-w-full",
|
1961
|
-
value: `${
|
1966
|
+
value: `${p.operator}`,
|
1962
1967
|
options: [
|
1963
1968
|
{
|
1964
1969
|
value: "",
|
@@ -1982,8 +1987,8 @@ function Io() {
|
|
1982
1987
|
{
|
1983
1988
|
isTwoFormula: H,
|
1984
1989
|
value: {
|
1985
|
-
formula1:
|
1986
|
-
formula2:
|
1990
|
+
formula1: p.formula1,
|
1991
|
+
formula2: p.formula2
|
1987
1992
|
},
|
1988
1993
|
onChange: (f) => {
|
1989
1994
|
ne({
|
@@ -1991,23 +1996,23 @@ function Io() {
|
|
1991
1996
|
...f
|
1992
1997
|
});
|
1993
1998
|
},
|
1994
|
-
showError:
|
1995
|
-
validResult: y.validatorFormula(
|
1999
|
+
showError: g,
|
2000
|
+
validResult: y.validatorFormula(p, i, o),
|
1996
2001
|
unitId: i,
|
1997
2002
|
subUnitId: o,
|
1998
2003
|
ruleId: l
|
1999
2004
|
},
|
2000
|
-
e +
|
2005
|
+
e + p.type
|
2001
2006
|
) : null,
|
2002
2007
|
/* @__PURE__ */ S(Y, { children: /* @__PURE__ */ S(
|
2003
2008
|
At,
|
2004
2009
|
{
|
2005
|
-
checked: (U =
|
2010
|
+
checked: (U = p.allowBlank) != null ? U : !0,
|
2006
2011
|
onChange: () => {
|
2007
2012
|
var f;
|
2008
2013
|
return ne({
|
2009
2014
|
...he,
|
2010
|
-
allowBlank: !((f =
|
2015
|
+
allowBlank: !((f = p.allowBlank) == null || f)
|
2011
2016
|
});
|
2012
2017
|
},
|
2013
2018
|
children: m.t("dataValidation.panel.allowBlank")
|
@@ -2021,23 +2026,23 @@ function Io() {
|
|
2021
2026
|
] });
|
2022
2027
|
}
|
2023
2028
|
const Ro = (e) => {
|
2024
|
-
const { rule: t, onClick: r, unitId: n, subUnitId: i, disable: o } = e, a = F(Me), l = F(te), s = F(
|
2029
|
+
const { rule: t, onClick: r, unitId: n, subUnitId: i, disable: o } = e, a = F(Me), l = F(te), s = F(Di), d = a.getValidatorItem(t.type), u = pt(void 0), [h, c] = W(!1), m = F(Zn), p = Le(m.currentTheme$), b = ct(() => {
|
2025
2030
|
var w;
|
2026
|
-
const
|
2031
|
+
const g = m.getColorFromTheme("primary.600"), C = m.getColorFromTheme("loop-color.2"), v = (w = m.getColorFromTheme(C)) != null ? w : g, I = new $r(v).toRgb();
|
2027
2032
|
return {
|
2028
2033
|
fill: `rgba(${I.r}, ${I.g}, ${I.b}, 0.1)`,
|
2029
2034
|
stroke: v
|
2030
2035
|
};
|
2031
|
-
}, [
|
2036
|
+
}, [p]), y = (g) => {
|
2032
2037
|
l.executeCommand(rr.id, {
|
2033
2038
|
ruleId: t.uid,
|
2034
2039
|
unitId: n,
|
2035
2040
|
subUnitId: i
|
2036
|
-
}),
|
2041
|
+
}), g.stopPropagation();
|
2037
2042
|
};
|
2038
2043
|
return ke(() => () => {
|
2039
|
-
var
|
2040
|
-
u.current && ((
|
2044
|
+
var g;
|
2045
|
+
u.current && ((g = u.current) == null || g.forEach((C) => {
|
2041
2046
|
C && s.removeShape(C);
|
2042
2047
|
}));
|
2043
2048
|
}, [s]), /* @__PURE__ */ $(
|
@@ -2056,15 +2061,15 @@ const Ro = (e) => {
|
|
2056
2061
|
),
|
2057
2062
|
onClick: r,
|
2058
2063
|
onMouseEnter: () => {
|
2059
|
-
o || (c(!0), u.current = t.ranges.map((
|
2060
|
-
range:
|
2064
|
+
o || (c(!0), u.current = t.ranges.map((g) => s.addShape({
|
2065
|
+
range: g,
|
2061
2066
|
style: b,
|
2062
2067
|
primary: null
|
2063
2068
|
})));
|
2064
2069
|
},
|
2065
2070
|
onMouseLeave: () => {
|
2066
|
-
var
|
2067
|
-
c(!1), (
|
2071
|
+
var g;
|
2072
|
+
c(!1), (g = u.current) == null || g.forEach((C) => {
|
2068
2073
|
C && s.removeShape(C);
|
2069
2074
|
}), u.current = void 0;
|
2070
2075
|
},
|
@@ -2080,7 +2085,7 @@ const Ro = (e) => {
|
|
2080
2085
|
"div",
|
2081
2086
|
{
|
2082
2087
|
className: "univer-text-secondary univer-truncate univer-text-xs univer-leading-[18px] dark:!univer-text-gray-300",
|
2083
|
-
children: t.ranges.map((
|
2088
|
+
children: t.ranges.map((g) => mr(g)).join(",")
|
2084
2089
|
}
|
2085
2090
|
),
|
2086
2091
|
h ? /* @__PURE__ */ S(
|
@@ -2117,7 +2122,7 @@ function yo(e) {
|
|
2117
2122
|
subUnitId: c,
|
2118
2123
|
rule: C
|
2119
2124
|
});
|
2120
|
-
},
|
2125
|
+
}, p = () => {
|
2121
2126
|
n.executeCommand(Kr.id, {
|
2122
2127
|
unitId: h,
|
2123
2128
|
subUnitId: c
|
@@ -2125,7 +2130,7 @@ function yo(e) {
|
|
2125
2130
|
}, y = ((C) => {
|
2126
2131
|
const v = r.getCurrentUnitForType(X.UNIVER_SHEET), I = v.getActiveSheet(), w = v.getUnitId(), _ = I.getSheetId();
|
2127
2132
|
return C.map((L) => _i(i, w, _, L.ranges) ? { ...L } : { ...L, disable: !0 });
|
2128
|
-
})(l),
|
2133
|
+
})(l), g = y == null ? void 0 : y.some((C) => C.disable);
|
2129
2134
|
return /* @__PURE__ */ $("div", { className: "univer-pb-4", children: [
|
2130
2135
|
y == null ? void 0 : y.map((C) => {
|
2131
2136
|
var v;
|
@@ -2148,7 +2153,7 @@ function yo(e) {
|
|
2148
2153
|
);
|
2149
2154
|
}),
|
2150
2155
|
/* @__PURE__ */ $("div", { className: "univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2", children: [
|
2151
|
-
l.length && !
|
2156
|
+
l.length && !g ? /* @__PURE__ */ S(Ke, { onClick: p, children: a.t("dataValidation.panel.removeAll") }) : null,
|
2152
2157
|
/* @__PURE__ */ S(Ke, { variant: "primary", onClick: m, children: a.t("dataValidation.panel.add") })
|
2153
2158
|
] })
|
2154
2159
|
] });
|
@@ -2165,7 +2170,7 @@ const bo = () => {
|
|
2165
2170
|
}, void 0, void 0, []);
|
2166
2171
|
return !n || !i ? null : t && t.subUnitId === i.getSheetId() ? /* @__PURE__ */ S(Io, {}, t.rule.uid) : /* @__PURE__ */ S(yo, { workbook: n });
|
2167
2172
|
}, Mo = "LIST_RENDER_MODE_OPTION_INPUT";
|
2168
|
-
function
|
2173
|
+
function Vt(e) {
|
2169
2174
|
var i;
|
2170
2175
|
const { value: t, onChange: r } = e, n = F(ce);
|
2171
2176
|
return /* @__PURE__ */ S(Y, { label: n.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ $(un, { value: `${(i = t.renderMode) != null ? i : se.CUSTOM}`, onChange: (o) => r({ ...t, renderMode: +o }), children: [
|
@@ -2174,7 +2179,7 @@ function Dt(e) {
|
|
2174
2179
|
/* @__PURE__ */ S(Ae, { value: `${se.TEXT}`, children: n.t("dataValidation.renderMode.text") })
|
2175
2180
|
] }) });
|
2176
2181
|
}
|
2177
|
-
|
2182
|
+
Vt.componentKey = Mo;
|
2178
2183
|
const Eo = "DATE_SHOW_TIME_OPTION";
|
2179
2184
|
function Ot(e) {
|
2180
2185
|
var i;
|
@@ -2197,8 +2202,8 @@ function Ot(e) {
|
|
2197
2202
|
) });
|
2198
2203
|
}
|
2199
2204
|
Ot.componentKey = Eo;
|
2200
|
-
var
|
2201
|
-
for (var i = n > 1 ? void 0 : n ?
|
2205
|
+
var Do = Object.getOwnPropertyDescriptor, Vo = (e, t, r, n) => {
|
2206
|
+
for (var i = n > 1 ? void 0 : n ? Do(t, r) : t, o = e.length - 1, a; o >= 0; o--)
|
2202
2207
|
(a = e[o]) && (i = a(i) || i);
|
2203
2208
|
return i;
|
2204
2209
|
}, je = (e, t) => (r, n) => t(r, n, e);
|
@@ -2251,10 +2256,10 @@ let nn = class {
|
|
2251
2256
|
return ((r = t == null ? void 0 : t.fs) != null ? r : 10) * 1.6;
|
2252
2257
|
}
|
2253
2258
|
async _parseFormula(e, t, r) {
|
2254
|
-
var d, u, h, c, m,
|
2255
|
-
const { formula1: n = qr, formula2: i = Gr } = e, o = await this._formulaService.getRuleFormulaResult(t, r, e.uid), a = Ut((h = (u = (d = o == null ? void 0 : o[0]) == null ? void 0 : d.result) == null ? void 0 : u[0]) == null ? void 0 : h[0]), l = Ut((
|
2259
|
+
var d, u, h, c, m, p, b, y, g;
|
2260
|
+
const { formula1: n = qr, formula2: i = Gr } = e, o = await this._formulaService.getRuleFormulaResult(t, r, e.uid), a = Ut((h = (u = (d = o == null ? void 0 : o[0]) == null ? void 0 : d.result) == null ? void 0 : u[0]) == null ? void 0 : h[0]), l = Ut((p = (m = (c = o == null ? void 0 : o[1]) == null ? void 0 : c.result) == null ? void 0 : m[0]) == null ? void 0 : p[0]), s = Mn(String(a)) && Mn(String(l));
|
2256
2261
|
return {
|
2257
|
-
formula1: Oe(n) ? Ut((
|
2262
|
+
formula1: Oe(n) ? Ut((g = (y = (b = o == null ? void 0 : o[0]) == null ? void 0 : b.result) == null ? void 0 : y[0]) == null ? void 0 : g[0]) : n,
|
2258
2263
|
formula2: Oe(i) ? l : i,
|
2259
2264
|
isFormulaValid: s
|
2260
2265
|
};
|
@@ -2267,7 +2272,7 @@ let nn = class {
|
|
2267
2272
|
const c = this._dataValidationModel.getValidator(h.type);
|
2268
2273
|
if (!c || !((T = c.skipDefaultFontRender) != null && T.call(c, h, u, { unitId: i, subUnitId: o, row: l, column: s })))
|
2269
2274
|
return;
|
2270
|
-
const m = c.parseFormulaSync(h, i, o), { formula1:
|
2275
|
+
const m = c.parseFormulaSync(h, i, o), { formula1: p } = m, b = this._calc(d, r), { a: y, d: g } = e.getTransform(), C = Tn(b.left, y), v = Tn(b.top, g), I = ui.create().composeMatrix({
|
2271
2276
|
left: C,
|
2272
2277
|
top: v,
|
2273
2278
|
scaleX: 1,
|
@@ -2281,7 +2286,7 @@ let nn = class {
|
|
2281
2286
|
e.save(), e.beginPath(), e.rect(d.startX, d.startY, w, _), e.clip();
|
2282
2287
|
const R = I.getMatrix();
|
2283
2288
|
e.transform(R[0], R[1], R[2], R[3], R[4], R[5]);
|
2284
|
-
const L = ((O = r == null ? void 0 : r.fs) != null ? O : 10) * 1.6, N = String(u) === String(
|
2289
|
+
const L = ((O = r == null ? void 0 : r.fs) != null ? O : 10) * 1.6, N = String(u) === String(p), E = this._themeService.getColorFromTheme("primary.600");
|
2285
2290
|
hi.drawWith(e, {
|
2286
2291
|
checked: N,
|
2287
2292
|
width: L,
|
@@ -2294,14 +2299,14 @@ let nn = class {
|
|
2294
2299
|
return s <= l && s >= a && d <= o && d >= i;
|
2295
2300
|
}
|
2296
2301
|
async onPointerDown(e, t) {
|
2297
|
-
var
|
2302
|
+
var p;
|
2298
2303
|
if (t.button === 2)
|
2299
2304
|
return;
|
2300
2305
|
const { primaryWithCoord: r, unitId: n, subUnitId: i, worksheet: o, row: a, col: l } = e, s = re(o.getCellRaw(a, l)), d = this._dataValidationModel.getRuleByLocation(n, i, a, l);
|
2301
2306
|
if (!d)
|
2302
2307
|
return;
|
2303
2308
|
const u = this._dataValidationModel.getValidator(d.type);
|
2304
|
-
if (!u || !((
|
2309
|
+
if (!u || !((p = u.skipDefaultFontRender) != null && p.call(u, d, s, { unitId: n, subUnitId: i, row: a, column: l })))
|
2305
2310
|
return;
|
2306
2311
|
const { formula1: h, formula2: c } = await this._parseFormula(d, n, i), m = {
|
2307
2312
|
range: {
|
@@ -2329,7 +2334,7 @@ let nn = class {
|
|
2329
2334
|
(n = (r = ze(X.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.mainComponent) == null || n.setCursor(Ge.DEFAULT);
|
2330
2335
|
}
|
2331
2336
|
};
|
2332
|
-
nn =
|
2337
|
+
nn = Vo([
|
2333
2338
|
je(0, te),
|
2334
2339
|
je(1, ue),
|
2335
2340
|
je(2, M(zr)),
|
@@ -2340,38 +2345,38 @@ nn = Do([
|
|
2340
2345
|
class Oo extends Se {
|
2341
2346
|
constructor() {
|
2342
2347
|
super(...arguments);
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2348
|
+
D(this, "id", j.CHECKBOX);
|
2349
|
+
D(this, "canvasRender", this.injector.createInstance(nn));
|
2350
|
+
D(this, "formulaInput", Jn);
|
2346
2351
|
}
|
2347
2352
|
}
|
2348
2353
|
class To extends Se {
|
2349
2354
|
constructor() {
|
2350
2355
|
super(...arguments);
|
2351
|
-
|
2352
|
-
|
2356
|
+
D(this, "id", j.CUSTOM);
|
2357
|
+
D(this, "formulaInput", qn);
|
2353
2358
|
}
|
2354
2359
|
}
|
2355
2360
|
const Po = "data-validation.formula-input";
|
2356
2361
|
class Ao extends Se {
|
2357
2362
|
constructor() {
|
2358
2363
|
super(...arguments);
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2364
|
+
D(this, "id", j.DATE);
|
2365
|
+
D(this, "formulaInput", Po);
|
2366
|
+
D(this, "optionsInput", Ot.componentKey);
|
2367
|
+
D(this, "dropdownType", ve.DATE);
|
2363
2368
|
}
|
2364
2369
|
}
|
2365
2370
|
class Lo extends Se {
|
2366
2371
|
constructor() {
|
2367
2372
|
super(...arguments);
|
2368
|
-
|
2369
|
-
|
2373
|
+
D(this, "id", j.DECIMAL);
|
2374
|
+
D(this, "formulaInput", Pt);
|
2370
2375
|
}
|
2371
2376
|
}
|
2372
|
-
const
|
2377
|
+
const Dr = 4, ko = 0, Ht = 4, Vr = 4, rn = 6, Tt = 6, Ve = 14;
|
2373
2378
|
function No(e, t) {
|
2374
|
-
const r =
|
2379
|
+
const r = pi.getTextSize(e, t), n = r.width + Dr * 2, { ba: i, bd: o } = r, a = i + o;
|
2375
2380
|
return {
|
2376
2381
|
width: n,
|
2377
2382
|
height: a + ko * 2,
|
@@ -2379,16 +2384,16 @@ function No(e, t) {
|
|
2379
2384
|
};
|
2380
2385
|
}
|
2381
2386
|
function $t(e, t, r, n) {
|
2382
|
-
const i =
|
2387
|
+
const i = Ve + rn * 2, o = r - i, a = n - Tt * 2, l = e.map((c) => ({
|
2383
2388
|
layout: No(c, t),
|
2384
2389
|
text: c
|
2385
2390
|
}));
|
2386
2391
|
let s;
|
2387
2392
|
const d = [];
|
2388
2393
|
l.forEach((c) => {
|
2389
|
-
const { layout: m } = c, { width:
|
2390
|
-
!s || s.width +
|
2391
|
-
width:
|
2394
|
+
const { layout: m } = c, { width: p, height: b } = m;
|
2395
|
+
!s || s.width + p + Ht > o ? (s = {
|
2396
|
+
width: p,
|
2392
2397
|
height: b,
|
2393
2398
|
items: [{
|
2394
2399
|
...c,
|
@@ -2397,11 +2402,11 @@ function $t(e, t, r, n) {
|
|
2397
2402
|
}, d.push(s)) : (s.items.push({
|
2398
2403
|
...c,
|
2399
2404
|
left: s.width + Ht
|
2400
|
-
}), s.width = s.width +
|
2405
|
+
}), s.width = s.width + p + Ht);
|
2401
2406
|
});
|
2402
2407
|
let u = 0, h = 0;
|
2403
2408
|
return d.forEach((c, m) => {
|
2404
|
-
h = Math.max(h, c.width), m === d.length - 1 ? u += c.height : u += c.height +
|
2409
|
+
h = Math.max(h, c.width), m === d.length - 1 ? u += c.height : u += c.height + Vr;
|
2405
2410
|
}), {
|
2406
2411
|
lines: d,
|
2407
2412
|
totalHeight: u,
|
@@ -2412,7 +2417,7 @@ function $t(e, t, r, n) {
|
|
2412
2417
|
};
|
2413
2418
|
}
|
2414
2419
|
const Uo = 8;
|
2415
|
-
class Fo extends
|
2420
|
+
class Fo extends gi {
|
2416
2421
|
static drawWith(t, r) {
|
2417
2422
|
const { fontString: n, info: i, fill: o, color: a } = r, { layout: l, text: s } = i;
|
2418
2423
|
t.save(), cr.drawWith(t, {
|
@@ -2420,7 +2425,7 @@ class Fo extends pi {
|
|
2420
2425
|
height: l.height,
|
2421
2426
|
radius: Uo,
|
2422
2427
|
fill: o || Ye
|
2423
|
-
}), t.translateWithPrecision(
|
2428
|
+
}), t.translateWithPrecision(Dr, l.ba), t.font = n, t.fillStyle = a, t.fillText(s, 0, 0), t.restore();
|
2424
2429
|
}
|
2425
2430
|
}
|
2426
2431
|
var xo = Object.getOwnPropertyDescriptor, Bo = (e, t, r, n) => {
|
@@ -2431,8 +2436,8 @@ var xo = Object.getOwnPropertyDescriptor, Bo = (e, t, r, n) => {
|
|
2431
2436
|
const Wo = 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");
|
2432
2437
|
let on = class {
|
2433
2438
|
constructor(e, t, r, n) {
|
2434
|
-
|
2435
|
-
|
2439
|
+
D(this, "zIndex");
|
2440
|
+
D(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
2436
2441
|
this._commandService = e, this._univerInstanceService = t, this._renderManagerService = r, this._dataValidationModel = n;
|
2437
2442
|
}
|
2438
2443
|
_ensureMap(e) {
|
@@ -2443,14 +2448,14 @@ let on = class {
|
|
2443
2448
|
return `${e}.${t}`;
|
2444
2449
|
}
|
2445
2450
|
_drawDownIcon(e, t, r, n, i) {
|
2446
|
-
const o = r -
|
2451
|
+
const o = r - Ve + 4;
|
2447
2452
|
let a = 4;
|
2448
2453
|
switch (i) {
|
2449
2454
|
case de.MIDDLE:
|
2450
|
-
a = (n -
|
2455
|
+
a = (n - Ve) / 2 + 4;
|
2451
2456
|
break;
|
2452
2457
|
case de.BOTTOM:
|
2453
|
-
a = n -
|
2458
|
+
a = n - Ve + 4;
|
2454
2459
|
break;
|
2455
2460
|
}
|
2456
2461
|
e.save(), e.translateWithPrecision(t.startX + o, t.startY + a), e.fillStyle = "#565656", e.fill(Wo), e.restore();
|
@@ -2458,7 +2463,7 @@ let on = class {
|
|
2458
2463
|
// eslint-disable-next-line max-lines-per-function
|
2459
2464
|
drawWith(e, t, r, n) {
|
2460
2465
|
var ne, oe;
|
2461
|
-
const { primaryWithCoord: i, row: o, col: a, style: l, data: s, subUnitId: d } = t, u = i.isMergedMainCell ? i.mergeInfo : i, h = s == null ? void 0 : s.fontRenderExtension, { leftOffset: c = 0, rightOffset: m = 0, topOffset:
|
2466
|
+
const { primaryWithCoord: i, row: o, col: a, style: l, data: s, subUnitId: d } = t, u = i.isMergedMainCell ? i.mergeInfo : i, h = s == null ? void 0 : s.fontRenderExtension, { leftOffset: c = 0, rightOffset: m = 0, topOffset: p = 0, downOffset: b = 0 } = h || {}, y = this._ensureMap(d), g = this._generateKey(o, a), C = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, o, a);
|
2462
2467
|
if (!C)
|
2463
2468
|
return;
|
2464
2469
|
const v = this._dataValidationModel.getValidator(C.type);
|
@@ -2467,10 +2472,10 @@ let on = class {
|
|
2467
2472
|
const I = {
|
2468
2473
|
startX: u.startX + c,
|
2469
2474
|
endX: u.endX - m,
|
2470
|
-
startY: u.startY +
|
2475
|
+
startY: u.startY + p,
|
2471
2476
|
endY: u.endY - b
|
2472
2477
|
}, w = I.endX - I.startX, _ = I.endY - I.startY, { cl: R } = l || {}, L = (ne = typeof R == "object" ? R == null ? void 0 : R.rgb : R) != null ? ne : "#000", N = Te(l != null ? l : void 0), { vt: E, ht: T } = l || {}, O = E != null ? E : de.MIDDLE, P = (oe = re(s)) != null ? oe : "", k = v.parseCellValue(P), H = v.getListWithColorMap(C), B = $t(k, N, w, _);
|
2473
|
-
this._drawDownIcon(e, I, w, _, O), e.save(), e.translateWithPrecision(I.startX, I.startY), e.beginPath(), e.rect(0, 0, w -
|
2478
|
+
this._drawDownIcon(e, I, w, _, O), e.save(), e.translateWithPrecision(I.startX, I.startY), e.beginPath(), e.rect(0, 0, w - Ve, _), e.clip(), e.translateWithPrecision(rn, Tt);
|
2474
2479
|
let J = 0;
|
2475
2480
|
switch (O) {
|
2476
2481
|
case de.MIDDLE:
|
@@ -2492,7 +2497,7 @@ let on = class {
|
|
2492
2497
|
q = (B.contentWidth - Z) / 2;
|
2493
2498
|
break;
|
2494
2499
|
}
|
2495
|
-
e.translate(q, z * (fe +
|
2500
|
+
e.translate(q, z * (fe + Vr)), Q.forEach((G) => {
|
2496
2501
|
e.save(), e.translateWithPrecision(G.left, 0), Fo.drawWith(e, {
|
2497
2502
|
...N,
|
2498
2503
|
info: G,
|
@@ -2500,10 +2505,10 @@ let on = class {
|
|
2500
2505
|
fill: H[G.text]
|
2501
2506
|
}), e.restore();
|
2502
2507
|
}), e.restore();
|
2503
|
-
}), e.restore(), y.set(
|
2508
|
+
}), e.restore(), y.set(g, {
|
2504
2509
|
left: I.startX,
|
2505
2510
|
top: I.startY,
|
2506
|
-
width: B.contentWidth + rn +
|
2511
|
+
width: B.contentWidth + rn + Ve,
|
2507
2512
|
height: B.contentHeight + Tt * 2
|
2508
2513
|
});
|
2509
2514
|
}
|
@@ -2517,10 +2522,10 @@ let on = class {
|
|
2517
2522
|
}, m = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2518
2523
|
if (!m)
|
2519
2524
|
return;
|
2520
|
-
const
|
2521
|
-
if (!
|
2525
|
+
const p = this._dataValidationModel.getValidator(m.type);
|
2526
|
+
if (!p)
|
2522
2527
|
return;
|
2523
|
-
const b = c.endX - c.startX, y = c.endY - c.startY,
|
2528
|
+
const b = c.endX - c.startX, y = c.endY - c.startY, g = (w = re(n)) != null ? w : "", C = p.parseCellValue(g), v = Te(r != null ? r : void 0);
|
2524
2529
|
return $t(C, v, b, y).cellAutoHeight;
|
2525
2530
|
}
|
2526
2531
|
calcCellAutoWidth(e) {
|
@@ -2533,15 +2538,15 @@ let on = class {
|
|
2533
2538
|
}, m = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2534
2539
|
if (!m)
|
2535
2540
|
return;
|
2536
|
-
const
|
2537
|
-
if (!
|
2541
|
+
const p = this._dataValidationModel.getValidator(m.type);
|
2542
|
+
if (!p)
|
2538
2543
|
return;
|
2539
|
-
const b = c.endX - c.startX, y = c.endY - c.startY,
|
2544
|
+
const b = c.endX - c.startX, y = c.endY - c.startY, g = (w = re(n)) != null ? w : "", C = p.parseCellValue(g), v = Te(r != null ? r : void 0);
|
2540
2545
|
return $t(C, v, b, y).calcAutoWidth;
|
2541
2546
|
}
|
2542
2547
|
isHit(e, t) {
|
2543
2548
|
const { primaryWithCoord: r } = t, n = r.isMergedMainCell ? r.mergeInfo : r, { endX: i } = n, { x: o } = e;
|
2544
|
-
return o >= i -
|
2549
|
+
return o >= i - Ve && o <= i;
|
2545
2550
|
}
|
2546
2551
|
onPointerDown(e, t) {
|
2547
2552
|
if (t.button === 2)
|
@@ -2572,9 +2577,9 @@ on = Bo([
|
|
2572
2577
|
class Ho extends Se {
|
2573
2578
|
constructor() {
|
2574
2579
|
super(...arguments);
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2580
|
+
D(this, "id", j.LIST_MULTIPLE);
|
2581
|
+
D(this, "canvasRender", this.injector.createInstance(on));
|
2582
|
+
D(this, "dropdownType", ve.MULTIPLE_LIST);
|
2578
2583
|
}
|
2579
2584
|
}
|
2580
2585
|
var $o = Object.getOwnPropertyDescriptor, jo = (e, t, r, n) => {
|
@@ -2582,7 +2587,7 @@ var $o = Object.getOwnPropertyDescriptor, jo = (e, t, r, n) => {
|
|
2582
2587
|
(a = e[o]) && (i = a(i) || i);
|
2583
2588
|
return i;
|
2584
2589
|
}, at = (e, t) => (r, n) => t(r, n, e);
|
2585
|
-
const
|
2590
|
+
const De = 4, Ct = 4, ge = 14, xn = 1, _e = 6, Xe = 3, jt = 8, Yo = "#565656", Bn = 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");
|
2586
2591
|
function Wn(e, t, r, n, i, o, a = !0) {
|
2587
2592
|
let l = 0;
|
2588
2593
|
const s = a ? Xe : 0;
|
@@ -2614,8 +2619,8 @@ function Wn(e, t, r, n, i, o, a = !0) {
|
|
2614
2619
|
}
|
2615
2620
|
let an = class {
|
2616
2621
|
constructor(e, t, r, n, i) {
|
2617
|
-
|
2618
|
-
|
2622
|
+
D(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
2623
|
+
D(this, "zIndex");
|
2619
2624
|
this._univerInstanceService = e, this._localeService = t, this._commandService = r, this._renderManagerService = n, this._dataValidationModel = i;
|
2620
2625
|
}
|
2621
2626
|
_ensureMap(e) {
|
@@ -2626,7 +2631,7 @@ let an = class {
|
|
2626
2631
|
return `${e}.${t}`;
|
2627
2632
|
}
|
2628
2633
|
_drawDownIcon(e, t, r, n, i, o, a) {
|
2629
|
-
const { t: l = ae.pd.t, b: s = ae.pd.b } = a, d = r -
|
2634
|
+
const { t: l = ae.pd.t, b: s = ae.pd.b } = a, d = r - ge;
|
2630
2635
|
let u;
|
2631
2636
|
switch (o) {
|
2632
2637
|
case de.MIDDLE:
|
@@ -2650,20 +2655,20 @@ let an = class {
|
|
2650
2655
|
const h = this._dataValidationModel.getValidator(u.type);
|
2651
2656
|
if (!h)
|
2652
2657
|
return;
|
2653
|
-
const c = l == null ? void 0 : l.fontRenderExtension, { leftOffset: m = 0, rightOffset:
|
2658
|
+
const c = l == null ? void 0 : l.fontRenderExtension, { leftOffset: m = 0, rightOffset: p = 0, topOffset: b = 0, downOffset: y = 0 } = c || {};
|
2654
2659
|
if (!u || !h || !h || h.id.indexOf(j.LIST) !== 0 || !h.skipDefaultFontRender(u))
|
2655
2660
|
return;
|
2656
|
-
const
|
2661
|
+
const g = {
|
2657
2662
|
startX: d.startX + m,
|
2658
|
-
endX: d.endX -
|
2663
|
+
endX: d.endX - p,
|
2659
2664
|
startY: d.startY + b,
|
2660
2665
|
endY: d.endY - y
|
2661
|
-
}, C =
|
2666
|
+
}, C = g.endX - g.startX, v = g.endY - g.startY, I = this._ensureMap(s), w = this._generateKey(i, o), _ = h.getListWithColor(u), R = re(l), L = `${R != null ? R : ""}`, N = _.find((z) => z.label === L);
|
2662
2667
|
let { tb: E, vt: T, ht: O, pd: P } = a || {};
|
2663
2668
|
E = E != null ? E : me.WRAP, T = T != null ? T : de.BOTTOM, O = O != null ? O : ae.ht, P = P != null ? P : ae.pd;
|
2664
2669
|
const k = Te(a).fontCache;
|
2665
2670
|
if (u.renderMode === se.ARROW) {
|
2666
|
-
const { l: z = ae.pd.l, t: Z = ae.pd.t, r: fe = ae.pd.r, b: Q = ae.pd.b } = P, q = C - z - fe -
|
2671
|
+
const { l: z = ae.pd.l, t: Z = ae.pd.t, r: fe = ae.pd.r, b: Q = ae.pd.b } = P, q = C - z - fe - ge - 4, G = new it(
|
2667
2672
|
L,
|
2668
2673
|
k,
|
2669
2674
|
E === me.WRAP,
|
@@ -2671,8 +2676,8 @@ let an = class {
|
|
2671
2676
|
1 / 0
|
2672
2677
|
);
|
2673
2678
|
G.calculate();
|
2674
|
-
const
|
2675
|
-
this._drawDownIcon(e,
|
2679
|
+
const V = G.getTotalWidth(), U = G.getTotalHeight(), { paddingTop: f, paddingLeft: A } = Wn(q, v - Z - Q, V, U, T, O, !0);
|
2680
|
+
this._drawDownIcon(e, g, C, v, U, T, P), e.save(), e.translateWithPrecision(g.startX + z, g.startY + Z), e.beginPath(), e.rect(0, 0, C - z - fe, v - Z - Q), e.clip(), e.translateWithPrecision(0, f), e.save(), e.translateWithPrecision(De, 0), e.beginPath(), e.rect(0, 0, q, U), e.clip(), Pn.drawWith(e, {
|
2676
2681
|
text: L,
|
2677
2682
|
fontStyle: k,
|
2678
2683
|
width: q,
|
@@ -2683,14 +2688,14 @@ let an = class {
|
|
2683
2688
|
warp: E === me.WRAP,
|
2684
2689
|
hAlign: Re.LEFT
|
2685
2690
|
}, G), e.translateWithPrecision(A, 0), e.restore(), e.restore(), I.set(w, {
|
2686
|
-
left:
|
2687
|
-
top:
|
2688
|
-
width:
|
2691
|
+
left: g.endX + z + r.rowHeaderWidth - ge,
|
2692
|
+
top: g.startY + Z + r.columnHeaderHeight,
|
2693
|
+
width: ge,
|
2689
2694
|
height: v - Z - Q
|
2690
2695
|
});
|
2691
2696
|
} else {
|
2692
|
-
e.save(), e.translateWithPrecision(
|
2693
|
-
const z = C - _e * 2 -
|
2697
|
+
e.save(), e.translateWithPrecision(g.startX, g.startY), e.beginPath(), e.rect(0, 0, C, v), e.clip();
|
2698
|
+
const z = C - _e * 2 - De - ge - 4, Z = new it(
|
2694
2699
|
L,
|
2695
2700
|
k,
|
2696
2701
|
E === me.WRAP,
|
@@ -2698,13 +2703,13 @@ let an = class {
|
|
2698
2703
|
1 / 0
|
2699
2704
|
);
|
2700
2705
|
Z.calculate();
|
2701
|
-
const fe = Z.getTotalWidth(), Q = Z.getTotalHeight(), q = Q + xn * 2, G = Math.max(C - _e * 2, 1), { paddingTop:
|
2702
|
-
e.translateWithPrecision(_e,
|
2706
|
+
const fe = Z.getTotalWidth(), Q = Z.getTotalHeight(), q = Q + xn * 2, G = Math.max(C - _e * 2, 1), { paddingTop: V, paddingLeft: U } = Wn(G, v, fe, q, T, O);
|
2707
|
+
e.translateWithPrecision(_e, V), cr.drawWith(e, {
|
2703
2708
|
width: G,
|
2704
2709
|
height: q,
|
2705
2710
|
fill: (N == null ? void 0 : N.color) || Ye,
|
2706
2711
|
radius: jt
|
2707
|
-
}), e.save(), e.translateWithPrecision(
|
2712
|
+
}), e.save(), e.translateWithPrecision(De, xn), e.beginPath(), e.rect(0, 0, z, Q), e.clip(), e.translateWithPrecision(U, 0), Pn.drawWith(e, {
|
2708
2713
|
text: L,
|
2709
2714
|
fontStyle: k,
|
2710
2715
|
width: z,
|
@@ -2714,9 +2719,9 @@ let an = class {
|
|
2714
2719
|
underline: !!((he = a == null ? void 0 : a.ul) != null && he.s),
|
2715
2720
|
warp: E === me.WRAP,
|
2716
2721
|
hAlign: Re.LEFT
|
2717
|
-
}, Z), e.restore(), e.translateWithPrecision(z +
|
2718
|
-
left:
|
2719
|
-
top:
|
2722
|
+
}, Z), e.restore(), e.translateWithPrecision(z + De + 4, (Q - Ct) / 2), e.fillStyle = Yo, e.fill(Bn), e.restore(), I.set(w, {
|
2723
|
+
left: g.startX + _e + r.rowHeaderWidth,
|
2724
|
+
top: g.startY + V + r.columnHeaderHeight,
|
2720
2725
|
width: G,
|
2721
2726
|
height: q
|
2722
2727
|
});
|
@@ -2731,23 +2736,23 @@ let an = class {
|
|
2731
2736
|
endX: a.endX - d,
|
2732
2737
|
startY: a.startY + u,
|
2733
2738
|
endY: a.endY - h
|
2734
|
-
},
|
2735
|
-
let { tb:
|
2739
|
+
}, p = m.endX - m.startX, b = re(n), y = `${b != null ? b : ""}`;
|
2740
|
+
let { tb: g, pd: C } = r || {};
|
2736
2741
|
const { t: v = ae.pd.t, b: I = ae.pd.b } = C != null ? C : {};
|
2737
|
-
if (
|
2738
|
-
const w =
|
2742
|
+
if (g = g != null ? g : me.WRAP, c.renderMode === se.ARROW) {
|
2743
|
+
const w = p - ge, _ = new it(
|
2739
2744
|
y,
|
2740
2745
|
Te(r).fontCache,
|
2741
|
-
|
2746
|
+
g === me.WRAP,
|
2742
2747
|
w,
|
2743
2748
|
1 / 0
|
2744
2749
|
);
|
2745
2750
|
return _.calculate(), _.getTotalHeight() + v + I + Xe * 2;
|
2746
2751
|
} else {
|
2747
|
-
const w = Math.max(
|
2752
|
+
const w = Math.max(p - _e * 2 - De - ge, 10), _ = new it(
|
2748
2753
|
y,
|
2749
2754
|
Te(r).fontCache,
|
2750
|
-
|
2755
|
+
g === me.WRAP,
|
2751
2756
|
w,
|
2752
2757
|
1 / 0
|
2753
2758
|
);
|
@@ -2763,26 +2768,26 @@ let an = class {
|
|
2763
2768
|
endX: a.endX - d,
|
2764
2769
|
startY: a.startY + u,
|
2765
2770
|
endY: a.endY - h
|
2766
|
-
},
|
2767
|
-
let { tb:
|
2771
|
+
}, p = m.endX - m.startX, b = re(n), y = `${b != null ? b : ""}`;
|
2772
|
+
let { tb: g, pd: C } = r || {};
|
2768
2773
|
const { l: v = ae.pd.l, r: I = ae.pd.r } = C != null ? C : {};
|
2769
|
-
|
2770
|
-
let w = _e * 2 +
|
2774
|
+
g = g != null ? g : me.WRAP;
|
2775
|
+
let w = _e * 2 + ge;
|
2771
2776
|
switch (c.renderMode) {
|
2772
2777
|
case se.ARROW:
|
2773
|
-
w =
|
2778
|
+
w = ge + _e * 2 + I + v;
|
2774
2779
|
break;
|
2775
2780
|
case se.CUSTOM:
|
2776
|
-
w =
|
2781
|
+
w = ge + _e * 2 + De * 2 + I + v + jt / 2 + 1;
|
2777
2782
|
break;
|
2778
2783
|
// default is CUSTOM
|
2779
2784
|
default:
|
2780
|
-
w =
|
2785
|
+
w = ge + _e * 2 + De * 2 + I + v + jt / 2 + 1;
|
2781
2786
|
}
|
2782
|
-
const _ =
|
2787
|
+
const _ = p - w, R = new it(
|
2783
2788
|
y,
|
2784
2789
|
Te(r).fontCache,
|
2785
|
-
|
2790
|
+
g === me.WRAP,
|
2786
2791
|
_,
|
2787
2792
|
1 / 0
|
2788
2793
|
);
|
@@ -2825,25 +2830,25 @@ an = jo([
|
|
2825
2830
|
class Xo extends Se {
|
2826
2831
|
constructor() {
|
2827
2832
|
super(...arguments);
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
+
D(this, "id", j.LIST);
|
2834
|
+
D(this, "canvasRender", this.injector.createInstance(an));
|
2835
|
+
D(this, "dropdownType", ve.LIST);
|
2836
|
+
D(this, "optionsInput", Vt.componentKey);
|
2837
|
+
D(this, "formulaInput", dn);
|
2833
2838
|
}
|
2834
2839
|
}
|
2835
2840
|
class Zo extends Se {
|
2836
2841
|
constructor() {
|
2837
2842
|
super(...arguments);
|
2838
|
-
|
2839
|
-
|
2843
|
+
D(this, "id", j.TEXT_LENGTH);
|
2844
|
+
D(this, "formulaInput", Pt);
|
2840
2845
|
}
|
2841
2846
|
}
|
2842
2847
|
class Ko extends Se {
|
2843
2848
|
constructor() {
|
2844
2849
|
super(...arguments);
|
2845
|
-
|
2846
|
-
|
2850
|
+
D(this, "id", j.WHOLE);
|
2851
|
+
D(this, "formulaInput", Pt);
|
2847
2852
|
}
|
2848
2853
|
}
|
2849
2854
|
var zo = Object.getOwnPropertyDescriptor, Go = (e, t, r, n) => {
|
@@ -2859,7 +2864,7 @@ let nt = class extends ln {
|
|
2859
2864
|
[
|
2860
2865
|
["DataValidationIcon", Sr],
|
2861
2866
|
[Et, bo],
|
2862
|
-
[
|
2867
|
+
[Vt.componentKey, Vt],
|
2863
2868
|
[Ot.componentKey, Ot],
|
2864
2869
|
...Xi
|
2865
2870
|
].forEach(([e, t]) => {
|
@@ -2887,7 +2892,7 @@ let nt = class extends ln {
|
|
2887
2892
|
};
|
2888
2893
|
nt = Go([
|
2889
2894
|
Yt(0, M(ye)),
|
2890
|
-
Yt(1, M(
|
2895
|
+
Yt(1, M(pn)),
|
2891
2896
|
Yt(2, M(Me))
|
2892
2897
|
], nt);
|
2893
2898
|
var qo = Object.getOwnPropertyDescriptor, Jo = (e, t, r, n) => {
|
@@ -2934,7 +2939,7 @@ let Hn = (wt = class extends Kn {
|
|
2934
2939
|
onReady() {
|
2935
2940
|
this._injector.get(Qe), this._injector.get(et), this._injector.get(qe), this._injector.get(ht), this._injector.get(xe).registerRenderModule(
|
2936
2941
|
X.UNIVER_SHEET,
|
2937
|
-
[
|
2942
|
+
[Dt]
|
2938
2943
|
);
|
2939
2944
|
}
|
2940
2945
|
onRendered() {
|
@@ -2943,7 +2948,7 @@ let Hn = (wt = class extends Kn {
|
|
2943
2948
|
onSteady() {
|
2944
2949
|
this._injector.get(Je);
|
2945
2950
|
}
|
2946
|
-
},
|
2951
|
+
}, D(wt, "pluginName", Qo), D(wt, "type", X.UNIVER_SHEET), wt);
|
2947
2952
|
Hn = Jo([
|
2948
2953
|
Xt(1, M(ye)),
|
2949
2954
|
Xt(2, te),
|
@@ -2992,7 +2997,7 @@ let $n = (It = class extends Kn {
|
|
2992
2997
|
onReady() {
|
2993
2998
|
this._injector.get(Qe), this._injector.get(et), this._injector.get(xe).registerRenderModule(
|
2994
2999
|
X.UNIVER_SHEET,
|
2995
|
-
[
|
3000
|
+
[Dt]
|
2996
3001
|
);
|
2997
3002
|
}
|
2998
3003
|
onRendered() {
|
@@ -3001,7 +3006,7 @@ let $n = (It = class extends Kn {
|
|
3001
3006
|
onSteady() {
|
3002
3007
|
this._injector.get(Je);
|
3003
3008
|
}
|
3004
|
-
},
|
3009
|
+
}, D(It, "pluginName", na), D(It, "type", X.UNIVER_SHEET), It);
|
3005
3010
|
$n = ta([
|
3006
3011
|
Zt(1, M(ye)),
|
3007
3012
|
Zt(2, te),
|