@univerjs/sheets-data-validation-ui 0.7.0-nightly.202505091607 → 0.7.0-nightly.202505111606
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 +4 -5
- package/lib/es/index.js +361 -362
- package/lib/index.css +1 -1
- package/lib/index.js +361 -362
- package/lib/umd/index.js +4 -5
- package/package.json +12 -12
package/lib/es/index.js
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
var Lr = Object.defineProperty;
|
2
2
|
var kr = (e, t, r) => t in e ? Lr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
3
3
|
var E = (e, t, r) => kr(e, typeof t != "symbol" ? t + "" : t, r);
|
4
|
-
import { LocaleService as se, isFormulaString as De, DataValidationType as G, Tools as Zt, Inject as b, Injector as we, Disposable as Re, UniverInstanceType as Y, toDisposable as Nr, IUniverInstanceService as le, DataValidationErrorStyle as lt, DataValidationStatus as je, ICommandService as J, IConfigService as
|
5
|
-
import { DataValidationFormulaController as Gr, deserializeListOptions as Zr, serializeListOptions as qn, CUSTOM_FORMULA_INPUT_NAME as Jn, BASE_FORMULA_INPUT_NAME as At, LIST_FORMULA_INPUT_NAME as hn, CHECKBOX_FORMULA_INPUT_NAME as Qn, SheetDataValidationModel as ee, SheetsDataValidationValidatorService as qr, getDataValidationCellValue as Ut, getCellValueOrigin as Q, createDefaultNewRule as er, AddSheetDataValidationCommand as
|
6
|
-
import { jsxs as W, Fragment as
|
7
|
-
import { FormLayout as j, Input as Ve, Checkbox as Lt, clsx as Xe, borderClassName as Mt, RadioGroup as
|
8
|
-
import { useDependency as U, useSidebarClick as or, useObservable as Te, useEvent as Qt, ISidebarService as ar, IDialogService as ai, IZenZoneService as sr, KeyCode as
|
9
|
-
import On, { useState as H, useRef as ht, forwardRef as Le, createElement as ke, useMemo as
|
10
|
-
import { FormulaEditor as lr, RangeSelector as
|
11
|
-
import { DataValidatorRegistryService as ye, DataValidationModel as fn, DataValidatorDropdownType as
|
12
|
-
import { debounceTime as
|
13
|
-
import { DeviceInputEventType as
|
14
|
-
import { SheetInterceptorService as Sn, VALIDATE_CELL as Ri, SheetsSelectionsService as hr, SetRangeValuesCommand as st, getSheetCommandTarget as
|
4
|
+
import { LocaleService as se, isFormulaString as De, DataValidationType as G, Tools as Zt, Inject as b, Injector as we, Disposable as Re, UniverInstanceType as Y, toDisposable as Nr, IUniverInstanceService as le, DataValidationErrorStyle as lt, DataValidationStatus as je, ICommandService as J, IConfigService as dn, DataValidationRenderMode as ie, DisposableCollection as Ur, dayjs as Mn, numfmt as Yn, CellValueType as Fr, CommandType as nt, ObjectMatrix as Rt, Range as xr, Rectangle as yt, queryObjectMatrix as qt, Optional as $r, RxDisposable as un, InterceptorEffectEnum as Xn, sequenceExecute as zn, bufferDebounceTime as Br, debounce as Hr, UndoCommand as Wr, RedoCommand as jr, isUnitRangesEqual as Yr, shallowEqual as bn, ThemeService as Kn, ColorKit as Xr, VerticalAlign as ae, HorizontalAlign as Ye, DEFAULT_STYLES as re, WrapStrategy as Ie, DocumentDataModel as zr, BooleanNumber as rt, DEFAULT_EMPTY_DOCUMENT_VALUE as Kr, Plugin as Gn, merge as Zn } from "@univerjs/core";
|
5
|
+
import { DataValidationFormulaController as Gr, deserializeListOptions as Zr, serializeListOptions as qn, CUSTOM_FORMULA_INPUT_NAME as Jn, BASE_FORMULA_INPUT_NAME as At, LIST_FORMULA_INPUT_NAME as hn, CHECKBOX_FORMULA_INPUT_NAME as Qn, SheetDataValidationModel as ee, SheetsDataValidationValidatorService as qr, getDataValidationCellValue as Ut, getCellValueOrigin as Q, createDefaultNewRule as er, AddSheetDataValidationCommand as gn, DATA_VALIDATION_PLUGIN_NAME as tr, getDataValidationDiffMutations as Jt, UpdateSheetDataValidationRangeCommand as nr, DataValidationCacheService as rr, UpdateSheetDataValidationSettingCommand as En, UpdateSheetDataValidationOptionsCommand as Jr, RemoveSheetDataValidationCommand as ir, RemoveSheetAllDataValidationCommand as Qr, DataValidationFormulaService as ei, CHECKBOX_FORMULA_2 as ti, CHECKBOX_FORMULA_1 as ni, getFormulaResult as Ft, isLegalFormulaResult as Dn, transformCheckboxValue as ri } from "@univerjs/sheets-data-validation";
|
6
|
+
import { jsxs as W, Fragment as ct, jsx as _ } from "react/jsx-runtime";
|
7
|
+
import { FormLayout as j, Input as Ve, Checkbox as Lt, clsx as Xe, borderClassName as Mt, RadioGroup as pn, Radio as Oe, DraggableList as ii, Dropdown as oi, Button as ze, Select as Vn } from "@univerjs/design";
|
8
|
+
import { useDependency as U, useSidebarClick as or, useObservable as Te, useEvent as Qt, ISidebarService as ar, IDialogService as ai, IZenZoneService as sr, KeyCode as gt, MenuItemType as vn, getMenuHiddenObservable as si, RibbonStartGroup as li, IMenuManagerService as ci, ComponentManager as mn } from "@univerjs/ui";
|
9
|
+
import On, { useState as H, useRef as ht, forwardRef as Le, createElement as ke, useMemo as dt, useEffect as Pe } from "react";
|
10
|
+
import { FormulaEditor as lr, RangeSelector as di } from "@univerjs/sheets-formula-ui";
|
11
|
+
import { DataValidatorRegistryService as ye, DataValidationModel as fn, DataValidatorDropdownType as ge, DataValidatorRegistryScope as ui, TWO_FORMULA_OPERATOR_COUNT as hi, getRuleOptions as Tn, getRuleSetting as Pn } from "@univerjs/data-validation";
|
12
|
+
import { debounceTime as cr, filter as _n, BehaviorSubject as An, distinctUntilChanged as gi, Subject as pi, bufferTime as dr, of as vi } from "rxjs";
|
13
|
+
import { DeviceInputEventType as pt, IRenderManagerService as Ne, fixLineWidthByScale as Ln, Transform as mi, CheckboxShape as fi, getCurrentTypeOfRenderer as Ke, CURSOR_TYPE as Ge, FontCache as _i, Shape as Si, Rect as ur, getFontStyleString as xt, getDocsSkeletonPageSize as it, Documents as Ci, DocumentViewModel as Ii, DocumentSkeleton as wi } from "@univerjs/engine-render";
|
14
|
+
import { SheetInterceptorService as Sn, VALIDATE_CELL as Ri, SheetsSelectionsService as hr, SetRangeValuesCommand as st, getSheetCommandTarget as gr, rangeToDiscreteRange as yi, SheetPermissionCheckController as Mi, WorksheetEditPermission as en, WorksheetSetCellStylePermission as tn, RangeProtectionPermissionEditPoint as nn, WorkbookEditablePermission as rn, INTERCEPTOR_POINT as pr, InterceptCellContentPriority as vr, checkRangesEditablePermission as bi } from "@univerjs/sheets";
|
15
15
|
import { getPatternType as Ei } from "@univerjs/sheets-numfmt";
|
16
16
|
import { ISheetCellDropdownManagerService as Di, IEditorBridgeService as mr, SetCellEditVisibleOperation as vt, HoverManagerService as Vi, CellAlertManagerService as Oi, CellAlertType as Ti, IAutoFillService as Pi, APPLY_TYPE as ot, virtualizeDiscreteRanges as on, getAutoFillRepeatRange as Ai, ISheetClipboardService as Li, COPY_TYPE as kn, PREDEFINED_HOOK_NAME as mt, getRepeatRange as Nn, getCurrentRangeDisable$ as ki, AutoHeightController as fr, SheetSkeletonManagerService as bt, IMarkSelectionService as Ni } from "@univerjs/sheets-ui";
|
17
17
|
import { deserializeRangeWithSheet as Ui, serializeRange as _r } from "@univerjs/engine-formula";
|
18
18
|
const Fi = (e) => {
|
19
19
|
const { isTwoFormula: t = !1, value: r, onChange: n, showError: i, validResult: o } = e, a = U(se), l = i ? o == null ? void 0 : o.formula1 : "", s = i ? o == null ? void 0 : o.formula2 : "";
|
20
|
-
return t ? /* @__PURE__ */ W(
|
20
|
+
return t ? /* @__PURE__ */ W(ct, { children: [
|
21
21
|
/* @__PURE__ */ _(j, { error: l, children: /* @__PURE__ */ _(
|
22
22
|
Ve,
|
23
23
|
{
|
24
24
|
className: "univer-w-full",
|
25
25
|
placeholder: a.t("dataValidation.panel.formulaPlaceholder"),
|
26
26
|
value: r == null ? void 0 : r.formula1,
|
27
|
-
onChange: (
|
27
|
+
onChange: (c) => {
|
28
28
|
n == null || n({
|
29
29
|
...r,
|
30
|
-
formula1:
|
30
|
+
formula1: c
|
31
31
|
});
|
32
32
|
}
|
33
33
|
}
|
@@ -39,10 +39,10 @@ const Fi = (e) => {
|
|
39
39
|
className: "univer-w-full",
|
40
40
|
placeholder: a.t("dataValidation.panel.formulaPlaceholder"),
|
41
41
|
value: r == null ? void 0 : r.formula2,
|
42
|
-
onChange: (
|
42
|
+
onChange: (c) => {
|
43
43
|
n == null || n({
|
44
44
|
...r,
|
45
|
-
formula2:
|
45
|
+
formula2: c
|
46
46
|
});
|
47
47
|
}
|
48
48
|
}
|
@@ -53,21 +53,21 @@ const Fi = (e) => {
|
|
53
53
|
className: "univer-w-full",
|
54
54
|
placeholder: a.t("dataValidation.panel.formulaPlaceholder"),
|
55
55
|
value: r == null ? void 0 : r.formula1,
|
56
|
-
onChange: (
|
57
|
-
n == null || n({ formula1:
|
56
|
+
onChange: (c) => {
|
57
|
+
n == null || n({ formula1: c });
|
58
58
|
}
|
59
59
|
}
|
60
60
|
) });
|
61
61
|
};
|
62
62
|
function xi(e) {
|
63
|
-
const { value: t, onChange: r, showError: n, validResult: i } = e, o = U(se), a = n ? i == null ? void 0 : i.formula1 : "", l = n ? i == null ? void 0 : i.formula2 : "", [s,
|
64
|
-
return /* @__PURE__ */ W(
|
63
|
+
const { value: t, onChange: r, showError: n, validResult: i } = e, o = U(se), a = n ? i == null ? void 0 : i.formula1 : "", l = n ? i == null ? void 0 : i.formula2 : "", [s, c] = H(!((t == null ? void 0 : t.formula1) === void 0 && (t == null ? void 0 : t.formula2) === void 0));
|
64
|
+
return /* @__PURE__ */ W(ct, { children: [
|
65
65
|
/* @__PURE__ */ _(j, { children: /* @__PURE__ */ _(
|
66
66
|
Lt,
|
67
67
|
{
|
68
68
|
checked: s,
|
69
69
|
onChange: (u) => {
|
70
|
-
u ?
|
70
|
+
u ? c(!0) : (c(!1), r == null || r({
|
71
71
|
...t,
|
72
72
|
formula1: void 0,
|
73
73
|
formula2: void 0
|
@@ -108,10 +108,10 @@ function xi(e) {
|
|
108
108
|
}
|
109
109
|
function $i(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 = ht(null), [
|
112
|
-
return or((
|
113
|
-
var
|
114
|
-
((
|
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 = ht(null), [c, u] = H(!1);
|
112
|
+
return or((d) => {
|
113
|
+
var g;
|
114
|
+
((g = s.current) == null ? void 0 : g.isClickOutSide(d)) && u(!1);
|
115
115
|
}), /* @__PURE__ */ _(j, { error: l, children: /* @__PURE__ */ _(
|
116
116
|
lr,
|
117
117
|
{
|
@@ -127,10 +127,10 @@ function $i(e) {
|
|
127
127
|
initValue: (h = n == null ? void 0 : n.formula1) != null ? h : "=",
|
128
128
|
unitId: t,
|
129
129
|
subUnitId: r,
|
130
|
-
isFocus:
|
130
|
+
isFocus: c,
|
131
131
|
isSupportAcrossSheet: !0,
|
132
|
-
onChange: (
|
133
|
-
const m = (
|
132
|
+
onChange: (d) => {
|
133
|
+
const m = (d != null ? d : "").trim();
|
134
134
|
m !== (n == null ? void 0 : n.formula1) && (i == null || i({
|
135
135
|
...n,
|
136
136
|
formula1: m
|
@@ -351,7 +351,7 @@ const He = "#ECECEC", qi = [
|
|
351
351
|
};
|
352
352
|
function Qi(e) {
|
353
353
|
const { value: t, onChange: r = () => {
|
354
|
-
}, unitId: n, subUnitId: i, validResult: o, showError: a, ruleId: l } = e, { formula1: s = "", formula2:
|
354
|
+
}, unitId: n, subUnitId: i, validResult: o, showError: a, ruleId: l } = e, { formula1: s = "", formula2: c = "" } = t || {}, [u, h] = H(() => De(s) ? "1" : "0"), [d, m] = H(u === "1" ? s : "="), [g, M] = H(u === "1" ? s : "="), y = U(se), p = U(ye), S = U(fn), v = U(Gr), [C, w] = H(() => c.split(",")), I = p.getValidatorItem(G.LIST), [R, T] = H([]), [N, D] = H(""), P = a ? o == null ? void 0 : o.formula1 : "", A = dt(() => S.ruleChange$.pipe(cr(16)), []), L = Te(A), V = Qt(r);
|
355
355
|
Pe(() => {
|
356
356
|
(async () => {
|
357
357
|
await new Promise((f) => {
|
@@ -364,10 +364,10 @@ function Qi(e) {
|
|
364
364
|
}
|
365
365
|
})();
|
366
366
|
}, [S, L, I, l, i, n]), Pe(() => {
|
367
|
-
De(s) && s !==
|
368
|
-
}, [
|
367
|
+
De(s) && s !== g && (m(s), M(g));
|
368
|
+
}, [g, s]);
|
369
369
|
const [F, x] = H(() => {
|
370
|
-
const O = u !== "1" ? Zr(s) : [], B =
|
370
|
+
const O = u !== "1" ? Zr(s) : [], B = c.split(",");
|
371
371
|
return O.map((f, k) => ({
|
372
372
|
label: f,
|
373
373
|
color: B[k] || He,
|
@@ -380,18 +380,18 @@ function Qi(e) {
|
|
380
380
|
}, Z = (O) => {
|
381
381
|
const B = F.findIndex((f) => f.id === O);
|
382
382
|
B !== -1 && (F.splice(B, 1), x([...F]));
|
383
|
-
}, z =
|
383
|
+
}, z = c.split(","), te = dt(() => R.map((O, B) => ({
|
384
384
|
label: O,
|
385
385
|
color: z[B] || He,
|
386
386
|
id: `${B}`,
|
387
387
|
isRef: !0
|
388
|
-
})), [z, R]),
|
388
|
+
})), [z, R]), pe = (O, B, f) => {
|
389
389
|
const k = [...C];
|
390
390
|
k[+O] = f, w(k), V({
|
391
391
|
formula1: s,
|
392
392
|
formula2: k.join(",")
|
393
393
|
});
|
394
|
-
},
|
394
|
+
}, ce = () => {
|
395
395
|
x([
|
396
396
|
...F,
|
397
397
|
{
|
@@ -420,34 +420,34 @@ function Qi(e) {
|
|
420
420
|
formula1: qn(B.map((f) => f.label)),
|
421
421
|
formula2: B.map((f) => f.color === He ? "" : f.color).join(",")
|
422
422
|
});
|
423
|
-
}, [F, V, u,
|
423
|
+
}, [F, V, u, g, C]);
|
424
424
|
const ne = Qt(async (O) => {
|
425
425
|
if (!De(O)) {
|
426
426
|
V == null || V({
|
427
427
|
formula1: "",
|
428
|
-
formula2:
|
428
|
+
formula2: c
|
429
429
|
});
|
430
430
|
return;
|
431
431
|
}
|
432
432
|
v.getFormulaRefCheck(O) ? (V == null || V({
|
433
433
|
formula1: De(O) ? O : "",
|
434
|
-
formula2:
|
434
|
+
formula2: c
|
435
435
|
}), D("")) : (V == null || V({
|
436
436
|
formula1: "",
|
437
|
-
formula2:
|
437
|
+
formula2: c
|
438
438
|
}), m("="), D(y.t("dataValidation.validFail.formulaError")));
|
439
|
-
}),
|
439
|
+
}), de = ht(null), [Se, ve] = H(!1);
|
440
440
|
return or((O) => {
|
441
441
|
var f;
|
442
|
-
((f =
|
443
|
-
}), /* @__PURE__ */ W(
|
442
|
+
((f = de.current) == null ? void 0 : f.isClickOutSide(O)) && ve(!1);
|
443
|
+
}), /* @__PURE__ */ W(ct, { children: [
|
444
444
|
/* @__PURE__ */ _(j, { label: y.t("dataValidation.list.options"), children: /* @__PURE__ */ W(
|
445
|
-
|
445
|
+
pn,
|
446
446
|
{
|
447
447
|
value: u,
|
448
448
|
onChange: (O) => {
|
449
|
-
h(O), m(
|
450
|
-
formula1:
|
449
|
+
h(O), m(g), O === "1" && V({
|
450
|
+
formula1: g === "=" ? "" : g,
|
451
451
|
formula2: C.join(",")
|
452
452
|
});
|
453
453
|
},
|
@@ -461,7 +461,7 @@ function Qi(e) {
|
|
461
461
|
/* @__PURE__ */ _(
|
462
462
|
lr,
|
463
463
|
{
|
464
|
-
ref:
|
464
|
+
ref: de,
|
465
465
|
className: Xe(`
|
466
466
|
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
|
467
467
|
univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
|
@@ -470,7 +470,7 @@ function Qi(e) {
|
|
470
470
|
dark:univer-bg-gray-700 dark:univer-text-white
|
471
471
|
hover:univer-border-primary-600
|
472
472
|
`, Mt),
|
473
|
-
initValue:
|
473
|
+
initValue: d,
|
474
474
|
unitId: n,
|
475
475
|
subUnitId: i,
|
476
476
|
isFocus: Se,
|
@@ -486,7 +486,7 @@ function Qi(e) {
|
|
486
486
|
Un,
|
487
487
|
{
|
488
488
|
item: O,
|
489
|
-
commonProps: { onItemChange:
|
489
|
+
commonProps: { onItemChange: pe },
|
490
490
|
style: { marginBottom: 12 }
|
491
491
|
},
|
492
492
|
O.id
|
@@ -522,7 +522,7 @@ function Qi(e) {
|
|
522
522
|
univer-rounded univer-p-1 univer-px-2 univer-text-sm univer-text-primary
|
523
523
|
hover:univer-bg-primary-600/5
|
524
524
|
`,
|
525
|
-
onClick:
|
525
|
+
onClick: ce,
|
526
526
|
children: [
|
527
527
|
/* @__PURE__ */ _(Ir, { className: "univer-mr-1" }),
|
528
528
|
y.t("dataValidation.list.add")
|
@@ -576,7 +576,7 @@ let _e = class extends Re {
|
|
576
576
|
constructor(t, r) {
|
577
577
|
super();
|
578
578
|
E(this, "_open$", new An(!1));
|
579
|
-
E(this, "open$", this._open$.pipe(
|
579
|
+
E(this, "open$", this._open$.pipe(gi()));
|
580
580
|
E(this, "_activeRule");
|
581
581
|
E(this, "_activeRule$", new An(void 0));
|
582
582
|
E(this, "activeRule$", this._activeRule$.asObservable());
|
@@ -636,12 +636,12 @@ let Ze = class extends Re {
|
|
636
636
|
Ri,
|
637
637
|
{
|
638
638
|
handler: async (e, t, r) => {
|
639
|
-
const n = await e, { row: i, col: o, unitId: a, subUnitId: l } = t, s = this._dataValidationModel.getRuleIdByLocation(a, l, i, o),
|
639
|
+
const n = await e, { row: i, col: o, unitId: a, subUnitId: l } = t, s = this._dataValidationModel.getRuleIdByLocation(a, l, i, o), c = s ? this._dataValidationModel.getRuleById(a, l, s) : void 0;
|
640
640
|
if (n === !1)
|
641
641
|
return r(Promise.resolve(!1));
|
642
|
-
if (!
|
642
|
+
if (!c || c.errorStyle !== lt.STOP)
|
643
643
|
return r(Promise.resolve(!0));
|
644
|
-
const u = this._dataValidatorRegistryService.getValidatorItem(
|
644
|
+
const u = this._dataValidatorRegistryService.getValidatorItem(c.type);
|
645
645
|
return !u || await this._sheetsDataValidationValidatorService.validatorCell(a, l, i, o) === je.VALID ? r(Promise.resolve(!0)) : (this._dialogService.open({
|
646
646
|
width: 368,
|
647
647
|
title: {
|
@@ -649,7 +649,7 @@ let Ze = class extends Re {
|
|
649
649
|
},
|
650
650
|
id: "reject-input-dialog",
|
651
651
|
children: {
|
652
|
-
title: u.getRuleFinalError(
|
652
|
+
title: u.getRuleFinalError(c, { row: i, col: o, unitId: a, subUnitId: l })
|
653
653
|
},
|
654
654
|
footer: {
|
655
655
|
title: On.createElement(
|
@@ -731,14 +731,14 @@ function uo(e, t) {
|
|
731
731
|
}
|
732
732
|
}
|
733
733
|
let Ae = class extends Re {
|
734
|
-
constructor(t, r, n, i, o, a, l, s,
|
734
|
+
constructor(t, r, n, i, o, a, l, s, c, u, h) {
|
735
735
|
super();
|
736
736
|
E(this, "_activeDropdown");
|
737
|
-
E(this, "_activeDropdown$", new
|
737
|
+
E(this, "_activeDropdown$", new pi());
|
738
738
|
E(this, "_currentPopup", null);
|
739
739
|
E(this, "activeDropdown$", this._activeDropdown$.asObservable());
|
740
740
|
E(this, "_zenVisible", !1);
|
741
|
-
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 =
|
741
|
+
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 = c, this._injector = u, this._configService = h, this._init(), this._initSelectionChange(), this.disposeWithMe(() => {
|
742
742
|
this._activeDropdown$.complete();
|
743
743
|
});
|
744
744
|
}
|
@@ -770,24 +770,24 @@ let Ae = class extends Re {
|
|
770
770
|
}
|
771
771
|
// eslint-disable-next-line max-lines-per-function, complexity
|
772
772
|
showDropdown(t) {
|
773
|
-
var M, y,
|
773
|
+
var M, y, p, S;
|
774
774
|
const { location: r } = t, { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = r;
|
775
775
|
if (this._currentPopup && this._currentPopup.dispose(), this._zenVisible)
|
776
776
|
return;
|
777
777
|
this._activeDropdown = t, this._activeDropdown$.next(this._activeDropdown);
|
778
|
-
const
|
779
|
-
if (!
|
778
|
+
const c = this._sheetDataValidationModel.getRuleByLocation(o, a, n, i);
|
779
|
+
if (!c)
|
780
780
|
return;
|
781
|
-
const u = this._dataValidatorRegistryService.getValidatorItem(
|
781
|
+
const u = this._dataValidatorRegistryService.getValidatorItem(c.type);
|
782
782
|
if (!(u != null && u.dropdownType))
|
783
783
|
return;
|
784
784
|
let h;
|
785
|
-
const
|
785
|
+
const d = async (v, C) => {
|
786
786
|
var A, L, V;
|
787
787
|
if (!v)
|
788
788
|
return !0;
|
789
789
|
const w = v, I = s.getCell(n, i), R = w.format(C === "date" ? "YYYY-MM-DD 00:00:00" : "YYYY-MM-DD HH:mm:ss"), T = (A = Yn.parseDate(R)) == null ? void 0 : A.v, N = C === "time" ? T % 1 : T, D = l.getStyles().getStyleByCell(I), P = (V = (L = D == null ? void 0 : D.n) == null ? void 0 : L.pattern) != null ? V : "";
|
790
|
-
return
|
790
|
+
return c.errorStyle !== lt.STOP || await u.validator({
|
791
791
|
value: N,
|
792
792
|
unitId: o,
|
793
793
|
subUnitId: a,
|
@@ -797,11 +797,11 @@ let Ae = class extends Re {
|
|
797
797
|
workbook: l,
|
798
798
|
interceptValue: R.replace("Z", "").replace("T", " "),
|
799
799
|
t: Fr.NUMBER
|
800
|
-
},
|
800
|
+
}, c) ? (await this._commandService.executeCommand(vt.id, {
|
801
801
|
visible: !1,
|
802
|
-
eventType:
|
802
|
+
eventType: pt.Keyboard,
|
803
803
|
unitId: o,
|
804
|
-
keycode:
|
804
|
+
keycode: gt.ESC
|
805
805
|
}), await this._commandService.executeCommand(st.id, {
|
806
806
|
unitId: o,
|
807
807
|
subUnitId: a,
|
@@ -823,53 +823,53 @@ let Ae = class extends Re {
|
|
823
823
|
}
|
824
824
|
}
|
825
825
|
}
|
826
|
-
}), !0) : (this._injector.has(Ze) && this._injector.get(Ze).showReject(u.getRuleFinalError(
|
826
|
+
}), !0) : (this._injector.has(Ze) && this._injector.get(Ze).showReject(u.getRuleFinalError(c, { row: n, col: i, unitId: o, subUnitId: a })), !1);
|
827
827
|
};
|
828
828
|
let m;
|
829
829
|
switch (u.dropdownType) {
|
830
|
-
case
|
831
|
-
const v = Q(s.getCellRaw(n, i)), C = $t(v), w = !!((M =
|
830
|
+
case ge.DATE: {
|
831
|
+
const v = Q(s.getCellRaw(n, i)), C = $t(v), w = !!((M = c.bizInfo) != null && M.showTime);
|
832
832
|
m = {
|
833
833
|
location: r,
|
834
834
|
type: "datepicker",
|
835
835
|
props: {
|
836
836
|
showTime: w,
|
837
|
-
onChange: (I) =>
|
837
|
+
onChange: (I) => d(I, w ? "datetime" : "date"),
|
838
838
|
defaultValue: C,
|
839
839
|
patternType: "date"
|
840
840
|
}
|
841
841
|
};
|
842
842
|
break;
|
843
843
|
}
|
844
|
-
case
|
844
|
+
case ge.TIME: {
|
845
845
|
const v = Q(s.getCellRaw(n, i)), C = $t(v);
|
846
846
|
m = {
|
847
847
|
location: r,
|
848
848
|
type: "datepicker",
|
849
849
|
props: {
|
850
|
-
onChange: (w) =>
|
850
|
+
onChange: (w) => d(w, "time"),
|
851
851
|
defaultValue: C,
|
852
852
|
patternType: "time"
|
853
853
|
}
|
854
854
|
};
|
855
855
|
break;
|
856
856
|
}
|
857
|
-
case
|
857
|
+
case ge.DATETIME: {
|
858
858
|
const v = Q(s.getCellRaw(n, i)), C = $t(v);
|
859
859
|
m = {
|
860
860
|
location: r,
|
861
861
|
type: "datepicker",
|
862
862
|
props: {
|
863
|
-
onChange: (w) =>
|
863
|
+
onChange: (w) => d(w, "datetime"),
|
864
864
|
defaultValue: C,
|
865
865
|
patternType: "datetime"
|
866
866
|
}
|
867
867
|
};
|
868
868
|
break;
|
869
869
|
}
|
870
|
-
case
|
871
|
-
case
|
872
|
-
const v = u.dropdownType ===
|
870
|
+
case ge.LIST:
|
871
|
+
case ge.MULTIPLE_LIST: {
|
872
|
+
const v = u.dropdownType === ge.MULTIPLE_LIST, C = async (D) => {
|
873
873
|
const P = qn(D), A = {
|
874
874
|
unitId: o,
|
875
875
|
subUnitId: a,
|
@@ -888,13 +888,13 @@ let Ae = class extends Re {
|
|
888
888
|
};
|
889
889
|
return this._editorBridgeService.isVisible().visible && await this._commandService.executeCommand(vt.id, {
|
890
890
|
visible: !1,
|
891
|
-
eventType:
|
891
|
+
eventType: pt.Keyboard,
|
892
892
|
unitId: o,
|
893
|
-
keycode:
|
893
|
+
keycode: gt.ESC
|
894
894
|
}), this._commandService.executeCommand(st.id, A), !v;
|
895
|
-
}, w = (
|
895
|
+
}, w = (c == null ? void 0 : c.renderMode) === ie.CUSTOM || (c == null ? void 0 : c.renderMode) === void 0, I = u.getListWithColor(c, o, a), R = Ut(s.getCellRaw(n, i)), T = () => {
|
896
896
|
this._commandService.executeCommand(Fe.id, {
|
897
|
-
ruleId:
|
897
|
+
ruleId: c.uid
|
898
898
|
}), h == null || h.dispose();
|
899
899
|
}, N = I.map((D) => ({
|
900
900
|
label: D.label,
|
@@ -910,12 +910,12 @@ let Ae = class extends Re {
|
|
910
910
|
onEdit: T,
|
911
911
|
defaultValue: R,
|
912
912
|
multiple: v,
|
913
|
-
showEdit: (
|
913
|
+
showEdit: (p = (y = this._configService.getConfig(wn)) == null ? void 0 : y.showEditOnDropdown) != null ? p : !0
|
914
914
|
}
|
915
915
|
};
|
916
916
|
break;
|
917
917
|
}
|
918
|
-
case
|
918
|
+
case ge.CASCADE: {
|
919
919
|
m = {
|
920
920
|
type: "cascader",
|
921
921
|
props: {
|
@@ -938,19 +938,19 @@ let Ae = class extends Re {
|
|
938
938
|
};
|
939
939
|
return this._editorBridgeService.isVisible().visible && this._commandService.syncExecuteCommand(vt.id, {
|
940
940
|
visible: !1,
|
941
|
-
eventType:
|
941
|
+
eventType: pt.Keyboard,
|
942
942
|
unitId: o,
|
943
|
-
keycode:
|
943
|
+
keycode: gt.ESC
|
944
944
|
}), this._commandService.syncExecuteCommand(st.id, w), !0;
|
945
945
|
},
|
946
946
|
defaultValue: Ut(s.getCellRaw(n, i)).split("/"),
|
947
|
-
options: JSON.parse((S =
|
947
|
+
options: JSON.parse((S = c.formula1) != null ? S : "[]")
|
948
948
|
},
|
949
949
|
location: r
|
950
950
|
};
|
951
951
|
break;
|
952
952
|
}
|
953
|
-
case
|
953
|
+
case ge.COLOR: {
|
954
954
|
m = {
|
955
955
|
type: "color",
|
956
956
|
props: {
|
@@ -973,9 +973,9 @@ let Ae = class extends Re {
|
|
973
973
|
};
|
974
974
|
return this._editorBridgeService.isVisible().visible && this._commandService.syncExecuteCommand(vt.id, {
|
975
975
|
visible: !1,
|
976
|
-
eventType:
|
976
|
+
eventType: pt.Keyboard,
|
977
977
|
unitId: o,
|
978
|
-
keycode:
|
978
|
+
keycode: gt.ESC
|
979
979
|
}), this._commandService.syncExecuteCommand(st.id, w), !0;
|
980
980
|
},
|
981
981
|
defaultValue: Ut(s.getCellRaw(n, i))
|
@@ -989,13 +989,13 @@ let Ae = class extends Re {
|
|
989
989
|
}
|
990
990
|
if (h = this._cellDropdownManagerService.showDropdown(m), !h)
|
991
991
|
throw new Error("[DataValidationDropdownManagerService]: cannot show dropdown!");
|
992
|
-
const
|
993
|
-
|
992
|
+
const g = new Ur();
|
993
|
+
g.add(h), g.add({
|
994
994
|
dispose: () => {
|
995
995
|
var v, C;
|
996
996
|
(C = (v = this._activeDropdown) == null ? void 0 : v.onHide) == null || C.call(v);
|
997
997
|
}
|
998
|
-
}), this._currentPopup =
|
998
|
+
}), this._currentPopup = g;
|
999
999
|
}
|
1000
1000
|
hideDropdown() {
|
1001
1001
|
this._activeDropdown && (this._currentPopup && this._currentPopup.dispose(), this._currentPopup = null, this._activeDropdown = null, this._activeDropdown$.next(null));
|
@@ -1010,8 +1010,8 @@ let Ae = class extends Re {
|
|
1010
1010
|
const s = this._dataValidationModel.getRuleByLocation(a.getUnitId(), l.getSheetId(), n, i);
|
1011
1011
|
if (!s)
|
1012
1012
|
return;
|
1013
|
-
const
|
1014
|
-
if (!
|
1013
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(s.type);
|
1014
|
+
if (!c || !c.dropdownType) {
|
1015
1015
|
this.hideDropdown();
|
1016
1016
|
return;
|
1017
1017
|
}
|
@@ -1039,7 +1039,7 @@ Ae = co([
|
|
1039
1039
|
ue(7, J),
|
1040
1040
|
ue(8, mr),
|
1041
1041
|
ue(9, b(we)),
|
1042
|
-
ue(10,
|
1042
|
+
ue(10, dn)
|
1043
1043
|
], Ae);
|
1044
1044
|
const Dt = "DataValidationPanel", Fe = {
|
1045
1045
|
id: "data-validation.operation.open-validation-panel",
|
@@ -1047,22 +1047,22 @@ const Dt = "DataValidationPanel", Fe = {
|
|
1047
1047
|
handler(e, t) {
|
1048
1048
|
if (!t)
|
1049
1049
|
return !1;
|
1050
|
-
const { ruleId: r, isAdd: n } = t, i = e.get(_e), o = e.get(fn), a = e.get(le), l = e.get(ar), s =
|
1050
|
+
const { ruleId: r, isAdd: n } = t, i = e.get(_e), o = e.get(fn), a = e.get(le), l = e.get(ar), s = gr(a);
|
1051
1051
|
if (!s) return !1;
|
1052
|
-
const { unitId:
|
1052
|
+
const { unitId: c, subUnitId: u } = s, h = r ? o.getRuleById(c, u, r) : void 0;
|
1053
1053
|
i.open(), i.setActiveRule(h && {
|
1054
|
-
unitId:
|
1054
|
+
unitId: c,
|
1055
1055
|
subUnitId: u,
|
1056
1056
|
rule: h
|
1057
1057
|
});
|
1058
|
-
const
|
1058
|
+
const d = l.open({
|
1059
1059
|
id: Dt,
|
1060
1060
|
header: { title: n ? "dataValidation.panel.addTitle" : "dataValidation.panel.title" },
|
1061
1061
|
children: { label: Dt },
|
1062
1062
|
width: 312,
|
1063
1063
|
onClose: () => i.close()
|
1064
1064
|
});
|
1065
|
-
return i.setCloseDisposable(
|
1065
|
+
return i.setCloseDisposable(d), !0;
|
1066
1066
|
}
|
1067
1067
|
}, Rn = {
|
1068
1068
|
id: "data-validation.operation.close-validation-panel",
|
@@ -1101,20 +1101,20 @@ const Dt = "DataValidationPanel", Fe = {
|
|
1101
1101
|
type: nt.COMMAND,
|
1102
1102
|
id: "data-validation.command.addRuleAndOpen",
|
1103
1103
|
handler(e) {
|
1104
|
-
const t = e.get(le), r =
|
1104
|
+
const t = e.get(le), r = gr(t);
|
1105
1105
|
if (!r) return !1;
|
1106
|
-
const { workbook: n, worksheet: i } = r, o = er(e), a = e.get(J), l = n.getUnitId(), s = i.getSheetId(),
|
1106
|
+
const { workbook: n, worksheet: i } = r, o = er(e), a = e.get(J), l = n.getUnitId(), s = i.getSheetId(), c = {
|
1107
1107
|
rule: o,
|
1108
1108
|
unitId: l,
|
1109
1109
|
subUnitId: s
|
1110
1110
|
};
|
1111
|
-
return a.syncExecuteCommand(
|
1111
|
+
return a.syncExecuteCommand(gn.id, c) ? (a.syncExecuteCommand(Fe.id, {
|
1112
1112
|
ruleId: o.uid,
|
1113
1113
|
isAdd: !0
|
1114
1114
|
}), !0) : !1;
|
1115
1115
|
}
|
1116
1116
|
};
|
1117
|
-
var ho = Object.getOwnPropertyDescriptor,
|
1117
|
+
var ho = Object.getOwnPropertyDescriptor, go = (e, t, r, n) => {
|
1118
1118
|
for (var i = n > 1 ? void 0 : n ? ho(t, r) : t, o = e.length - 1, a; o >= 0; o--)
|
1119
1119
|
(a = e[o]) && (i = a(i) || i);
|
1120
1120
|
return i;
|
@@ -1128,7 +1128,7 @@ let ut = class extends Re {
|
|
1128
1128
|
this._initCellAlertPopup(), this._initZenService();
|
1129
1129
|
}
|
1130
1130
|
_initCellAlertPopup() {
|
1131
|
-
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(
|
1131
|
+
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(cr(100)).subscribe((e) => {
|
1132
1132
|
var t;
|
1133
1133
|
if (e) {
|
1134
1134
|
const r = this._univerInstanceService.getUnit(e.location.unitId, Y.UNIVER_SHEET), n = r.getSheetBySheetId(e.location.subUnitId);
|
@@ -1170,7 +1170,7 @@ let ut = class extends Re {
|
|
1170
1170
|
}));
|
1171
1171
|
}
|
1172
1172
|
};
|
1173
|
-
ut =
|
1173
|
+
ut = go([
|
1174
1174
|
$e(0, b(Vi)),
|
1175
1175
|
$e(1, b(Oi)),
|
1176
1176
|
$e(2, le),
|
@@ -1178,8 +1178,8 @@ ut = po([
|
|
1178
1178
|
$e(4, sr),
|
1179
1179
|
$e(5, b(ee))
|
1180
1180
|
], ut);
|
1181
|
-
var
|
1182
|
-
for (var i = n > 1 ? void 0 : n ?
|
1181
|
+
var po = Object.getOwnPropertyDescriptor, vo = (e, t, r, n) => {
|
1182
|
+
for (var i = n > 1 ? void 0 : n ? po(t, r) : t, o = e.length - 1, a; o >= 0; o--)
|
1183
1183
|
(a = e[o]) && (i = a(i) || i);
|
1184
1184
|
return i;
|
1185
1185
|
}, Bt = (e, t) => (r, n) => t(r, n, e);
|
@@ -1190,16 +1190,16 @@ let qe = class extends Re {
|
|
1190
1190
|
// eslint-disable-next-line max-lines-per-function
|
1191
1191
|
_initAutoFill() {
|
1192
1192
|
const e = () => ({ redos: [], undos: [] }), t = (n, i) => {
|
1193
|
-
const { source: o, target: a, unitId: l, subUnitId: s } = n,
|
1193
|
+
const { source: o, target: a, unitId: l, subUnitId: s } = n, c = this._sheetDataValidationModel.getRuleObjectMatrix(l, s).clone(), u = on([o, a]), [h, d] = u.ranges, { mapFunc: m } = u, g = {
|
1194
1194
|
row: h.startRow,
|
1195
1195
|
col: h.startColumn
|
1196
|
-
}, M = Ai(h,
|
1196
|
+
}, M = Ai(h, d), y = new Rt(), p = /* @__PURE__ */ new Set();
|
1197
1197
|
M.forEach((I) => {
|
1198
1198
|
const R = I.repeatStartCell, T = I.relativeRange, N = {
|
1199
|
-
startRow:
|
1200
|
-
startColumn:
|
1201
|
-
endColumn:
|
1202
|
-
endRow:
|
1199
|
+
startRow: g.row,
|
1200
|
+
startColumn: g.col,
|
1201
|
+
endColumn: g.col,
|
1202
|
+
endRow: g.row
|
1203
1203
|
}, D = {
|
1204
1204
|
startRow: R.row,
|
1205
1205
|
startColumn: R.col,
|
@@ -1224,12 +1224,12 @@ let qe = class extends Re {
|
|
1224
1224
|
},
|
1225
1225
|
D
|
1226
1226
|
), { row: Z, col: z } = m(X.startRow, X.startColumn);
|
1227
|
-
y.setValue(Z, z, x),
|
1227
|
+
y.setValue(Z, z, x), p.add(x);
|
1228
1228
|
});
|
1229
1229
|
});
|
1230
|
-
const S = Array.from(
|
1231
|
-
|
1232
|
-
const v =
|
1230
|
+
const S = Array.from(p).map((I) => ({ id: I, ranges: qt(y, (R) => R === I) }));
|
1231
|
+
c.addRangeRules(S);
|
1232
|
+
const v = c.diff(this._sheetDataValidationModel.getRules(l, s)), { redoMutations: C, undoMutations: w } = Jt(l, s, v, this._injector, "patched", i === ot.ONLY_FORMAT);
|
1233
1233
|
return {
|
1234
1234
|
undos: w,
|
1235
1235
|
redos: C
|
@@ -1240,8 +1240,8 @@ let qe = class extends Re {
|
|
1240
1240
|
const { source: i, unitId: o, subUnitId: a } = n;
|
1241
1241
|
for (const l of i.rows)
|
1242
1242
|
for (const s of i.cols) {
|
1243
|
-
const
|
1244
|
-
if (
|
1243
|
+
const c = this._sheetDataValidationModel.getRuleByLocation(o, a, l, s);
|
1244
|
+
if (c && c.type === G.CHECKBOX) {
|
1245
1245
|
this._autoFillService.setDisableApplyType(ot.SERIES, !0);
|
1246
1246
|
return;
|
1247
1247
|
}
|
@@ -1275,8 +1275,8 @@ let Je = class extends Re {
|
|
1275
1275
|
id: tr,
|
1276
1276
|
onBeforeCopy: (t, r, n) => this._collect(t, r, n),
|
1277
1277
|
onPasteCells: (t, r, n, i) => {
|
1278
|
-
const { copyType: o = kn.COPY, pasteType: a } = i, { range: l } = t || {}, { range: s, unitId:
|
1279
|
-
return this._generateMutations(s, { copyType: o, pasteType: a, copyRange: l, unitId:
|
1278
|
+
const { copyType: o = kn.COPY, pasteType: a } = i, { range: l } = t || {}, { range: s, unitId: c, subUnitId: u } = r;
|
1279
|
+
return this._generateMutations(s, { copyType: o, pasteType: a, copyRange: l, unitId: c, subUnitId: u });
|
1280
1280
|
}
|
1281
1281
|
});
|
1282
1282
|
}
|
@@ -1291,10 +1291,10 @@ let Je = class extends Re {
|
|
1291
1291
|
if (!o)
|
1292
1292
|
return;
|
1293
1293
|
const { rows: a, cols: l } = o;
|
1294
|
-
a.forEach((s,
|
1294
|
+
a.forEach((s, c) => {
|
1295
1295
|
l.forEach((u, h) => {
|
1296
|
-
const
|
1297
|
-
i.setValue(
|
1296
|
+
const d = this._sheetDataValidationModel.getRuleIdByLocation(t, r, s, u);
|
1297
|
+
i.setValue(c, h, d != null ? d : "");
|
1298
1298
|
});
|
1299
1299
|
});
|
1300
1300
|
}
|
@@ -1315,8 +1315,8 @@ let Je = class extends Re {
|
|
1315
1315
|
return { redos: [], undos: [] };
|
1316
1316
|
const { unitId: i, subUnitId: o } = this._copyInfo;
|
1317
1317
|
if (r.unitId !== i || o !== r.subUnitId) {
|
1318
|
-
const a = this._sheetDataValidationModel.getRuleObjectMatrix(r.unitId, r.subUnitId).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [
|
1319
|
-
|
1318
|
+
const a = this._sheetDataValidationModel.getRuleObjectMatrix(r.unitId, r.subUnitId).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [c, u], mapFunc: h } = on([r.copyRange, t]), d = Nn(c, u, !0), m = /* @__PURE__ */ new Map();
|
1319
|
+
d.forEach(({ startRange: p }) => {
|
1320
1320
|
var S;
|
1321
1321
|
(S = this._copyInfo) == null || S.matrix.forValue((v, C, w) => {
|
1322
1322
|
const I = yt.getPositionRange(
|
@@ -1326,15 +1326,15 @@ let Je = class extends Re {
|
|
1326
1326
|
startColumn: C,
|
1327
1327
|
endColumn: C
|
1328
1328
|
},
|
1329
|
-
|
1329
|
+
p
|
1330
1330
|
), R = `${o}-${w}`, T = this._sheetDataValidationModel.getRuleById(i, o, w);
|
1331
1331
|
!this._sheetDataValidationModel.getRuleById(r.unitId, r.subUnitId, R) && T && m.set(R, { ...T, uid: R });
|
1332
1332
|
const { row: N, col: D } = h(I.startRow, I.startColumn);
|
1333
1333
|
s.add(R), l.setValue(N, D, R);
|
1334
1334
|
});
|
1335
1335
|
});
|
1336
|
-
const
|
1337
|
-
a.addRangeRules(
|
1336
|
+
const g = Array.from(s).map((p) => ({ id: p, ranges: qt(l, (S) => S === p) }));
|
1337
|
+
a.addRangeRules(g);
|
1338
1338
|
const { redoMutations: M, undoMutations: y } = Jt(
|
1339
1339
|
r.unitId,
|
1340
1340
|
r.subUnitId,
|
@@ -1348,10 +1348,10 @@ let Je = class extends Re {
|
|
1348
1348
|
undos: y
|
1349
1349
|
};
|
1350
1350
|
} else {
|
1351
|
-
const a = this._sheetDataValidationModel.getRuleObjectMatrix(i, o).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [
|
1352
|
-
Nn(
|
1353
|
-
var
|
1354
|
-
(
|
1351
|
+
const a = this._sheetDataValidationModel.getRuleObjectMatrix(i, o).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [c, u], mapFunc: h } = on([r.copyRange, t]);
|
1352
|
+
Nn(c, u, !0).forEach(({ startRange: y }) => {
|
1353
|
+
var p;
|
1354
|
+
(p = this._copyInfo) == null || p.matrix.forValue((S, v, C) => {
|
1355
1355
|
const w = yt.getPositionRange(
|
1356
1356
|
{
|
1357
1357
|
startRow: S,
|
@@ -1364,9 +1364,9 @@ let Je = class extends Re {
|
|
1364
1364
|
l.setValue(I, R, C), s.add(C);
|
1365
1365
|
});
|
1366
1366
|
});
|
1367
|
-
const m = Array.from(s).map((y) => ({ id: y, ranges: qt(l, (
|
1367
|
+
const m = Array.from(s).map((y) => ({ id: y, ranges: qt(l, (p) => p === y) }));
|
1368
1368
|
a.addRangeRules(m);
|
1369
|
-
const { redoMutations:
|
1369
|
+
const { redoMutations: g, undoMutations: M } = Jt(
|
1370
1370
|
i,
|
1371
1371
|
o,
|
1372
1372
|
a.diff(this._sheetDataValidationModel.getRules(i, o)),
|
@@ -1375,7 +1375,7 @@ let Je = class extends Re {
|
|
1375
1375
|
!1
|
1376
1376
|
);
|
1377
1377
|
return {
|
1378
|
-
redos:
|
1378
|
+
redos: g,
|
1379
1379
|
undos: M
|
1380
1380
|
};
|
1381
1381
|
}
|
@@ -1398,7 +1398,7 @@ let Qe = class extends Re {
|
|
1398
1398
|
_commandExecutedListener() {
|
1399
1399
|
this.disposeWithMe(
|
1400
1400
|
this._commandService.beforeCommandExecuted((e) => {
|
1401
|
-
e.id ===
|
1401
|
+
e.id === gn.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({
|
1402
1402
|
workbookTypes: [rn],
|
1403
1403
|
rangeTypes: [nn],
|
1404
1404
|
worksheetTypes: [en, tn]
|
@@ -1469,8 +1469,8 @@ const Vr = {
|
|
1469
1469
|
}
|
1470
1470
|
};
|
1471
1471
|
let et = class extends un {
|
1472
|
-
constructor(e, t, r, n, i, o, a, l, s,
|
1473
|
-
super(), this._commandService = e, this._menuManagerService = t, this._renderManagerService = r, this._univerInstanceService = n, this._autoHeightController = i, this._dropdownManagerService = o, this._sheetDataValidationModel = a, this._dataValidatorRegistryService = l, this._sheetInterceptorService = s, this._dataValidationCacheService =
|
1472
|
+
constructor(e, t, r, n, i, o, a, l, s, c, u) {
|
1473
|
+
super(), this._commandService = e, this._menuManagerService = t, this._renderManagerService = r, this._univerInstanceService = n, this._autoHeightController = i, this._dropdownManagerService = o, this._sheetDataValidationModel = a, this._dataValidatorRegistryService = l, this._sheetInterceptorService = s, this._dataValidationCacheService = c, this._editorBridgeService = u, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
1474
1474
|
}
|
1475
1475
|
_initMenu() {
|
1476
1476
|
this._menuManagerService.mergeMenu(Ro);
|
@@ -1490,13 +1490,13 @@ let et = class extends un {
|
|
1490
1490
|
const s = this._sheetDataValidationModel.getRuleByLocation(n, i, o, a);
|
1491
1491
|
if (!s)
|
1492
1492
|
return;
|
1493
|
-
const
|
1494
|
-
if (!(
|
1493
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(s.type);
|
1494
|
+
if (!(c != null && c.dropdownType))
|
1495
1495
|
return;
|
1496
1496
|
const u = l.getActiveSheet();
|
1497
1497
|
if (!u) return;
|
1498
|
-
const h = this._dropdownManagerService.activeDropdown,
|
1499
|
-
if (
|
1498
|
+
const h = this._dropdownManagerService.activeDropdown, d = h == null ? void 0 : h.location;
|
1499
|
+
if (d && d.unitId === n && d.subUnitId === i && d.row === o && d.col === a)
|
1500
1500
|
return;
|
1501
1501
|
this._dropdownManagerService.showDropdown(
|
1502
1502
|
{
|
@@ -1519,26 +1519,26 @@ let et = class extends un {
|
|
1519
1519
|
_initViewModelIntercept() {
|
1520
1520
|
this.disposeWithMe(
|
1521
1521
|
this._sheetInterceptorService.intercept(
|
1522
|
-
|
1522
|
+
pr.CELL_CONTENT,
|
1523
1523
|
{
|
1524
1524
|
effect: Xn.Style,
|
1525
1525
|
// must be after numfmt
|
1526
1526
|
priority: vr.DATA_VALIDATION,
|
1527
1527
|
// eslint-disable-next-line max-lines-per-function, complexity
|
1528
1528
|
handler: (e, t, r) => {
|
1529
|
-
var
|
1530
|
-
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t,
|
1531
|
-
if (!
|
1529
|
+
var p, S, v, C, w;
|
1530
|
+
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t, c = this._sheetDataValidationModel.getRuleIdByLocation(o, a, n, i);
|
1531
|
+
if (!c)
|
1532
1532
|
return r(e);
|
1533
|
-
const u = this._sheetDataValidationModel.getRuleById(o, a,
|
1533
|
+
const u = this._sheetDataValidationModel.getRuleById(o, a, c);
|
1534
1534
|
if (!u)
|
1535
1535
|
return r(e);
|
1536
|
-
const h = (
|
1537
|
-
let
|
1536
|
+
const h = (p = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? p : je.VALID, d = this._dataValidatorRegistryService.getValidatorItem(u.type), m = t.rawData;
|
1537
|
+
let g;
|
1538
1538
|
const M = {
|
1539
1539
|
get value() {
|
1540
1540
|
var I;
|
1541
|
-
return
|
1541
|
+
return g !== void 0 || (g = (I = Q(m)) != null ? I : null), g;
|
1542
1542
|
}
|
1543
1543
|
}, y = {
|
1544
1544
|
get value() {
|
@@ -1554,15 +1554,15 @@ let et = class extends un {
|
|
1554
1554
|
},
|
1555
1555
|
customRender: [
|
1556
1556
|
...(S = e == null ? void 0 : e.customRender) != null ? S : [],
|
1557
|
-
...
|
1557
|
+
...d != null && d.canvasRender ? [d.canvasRender] : []
|
1558
1558
|
],
|
1559
1559
|
fontRenderExtension: {
|
1560
1560
|
...e == null ? void 0 : e.fontRenderExtension,
|
1561
|
-
isSkip: ((v = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : v.isSkip) || ((C =
|
1561
|
+
isSkip: ((v = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : v.isSkip) || ((C = d == null ? void 0 : d.skipDefaultFontRender) == null ? void 0 : C.call(d, u, M.value, t))
|
1562
1562
|
},
|
1563
1563
|
interceptorStyle: {
|
1564
1564
|
...e == null ? void 0 : e.interceptorStyle,
|
1565
|
-
...
|
1565
|
+
...d == null ? void 0 : d.getExtraStyle(u, y.value, {
|
1566
1566
|
get style() {
|
1567
1567
|
const I = l.getStyles();
|
1568
1568
|
return (typeof (e == null ? void 0 : e.s) == "string" ? I.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {};
|
@@ -1585,7 +1585,7 @@ let et = class extends un {
|
|
1585
1585
|
workbook: l,
|
1586
1586
|
worksheet: s
|
1587
1587
|
};
|
1588
|
-
return (V = (L =
|
1588
|
+
return (V = (L = d == null ? void 0 : d.canvasRender) == null ? void 0 : L.calcCellAutoHeight) == null ? void 0 : V.call(L, T);
|
1589
1589
|
},
|
1590
1590
|
interceptorAutoWidth: () => {
|
1591
1591
|
var N, D, P, A, L, V;
|
@@ -1603,7 +1603,7 @@ let et = class extends un {
|
|
1603
1603
|
workbook: l,
|
1604
1604
|
worksheet: s
|
1605
1605
|
};
|
1606
|
-
return (V = (L =
|
1606
|
+
return (V = (L = d == null ? void 0 : d.canvasRender) == null ? void 0 : L.calcCellAutoWidth) == null ? void 0 : V.call(L, T);
|
1607
1607
|
},
|
1608
1608
|
coverable: ((w = e == null ? void 0 : e.coverable) != null ? w : !0) && !(u.type === G.LIST || u.type === G.LIST_MULTIPLE)
|
1609
1609
|
});
|
@@ -1617,7 +1617,7 @@ let et = class extends un {
|
|
1617
1617
|
// patched data-validation change don't need to re-calc row height
|
1618
1618
|
// re-calc of row height will be triggered precisely by the origin command
|
1619
1619
|
_n((e) => e.source === "command"),
|
1620
|
-
|
1620
|
+
dr(100)
|
1621
1621
|
).subscribe((e) => {
|
1622
1622
|
if (e.length === 0)
|
1623
1623
|
return;
|
@@ -1634,7 +1634,7 @@ let et = class extends un {
|
|
1634
1634
|
};
|
1635
1635
|
et = Dr([
|
1636
1636
|
K(0, J),
|
1637
|
-
K(1,
|
1637
|
+
K(1, ci),
|
1638
1638
|
K(2, Ne),
|
1639
1639
|
K(3, le),
|
1640
1640
|
K(4, b(fr)),
|
@@ -1652,21 +1652,21 @@ let xn = class extends un {
|
|
1652
1652
|
_initViewModelIntercept() {
|
1653
1653
|
this.disposeWithMe(
|
1654
1654
|
this._sheetInterceptorService.intercept(
|
1655
|
-
|
1655
|
+
pr.CELL_CONTENT,
|
1656
1656
|
{
|
1657
1657
|
effect: Xn.Style,
|
1658
1658
|
// must be after numfmt
|
1659
1659
|
priority: vr.DATA_VALIDATION,
|
1660
1660
|
// eslint-disable-next-line complexity
|
1661
1661
|
handler: (e, t, r) => {
|
1662
|
-
var y,
|
1663
|
-
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t,
|
1664
|
-
if (!
|
1662
|
+
var y, p, S, v, C;
|
1663
|
+
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t, c = this._sheetDataValidationModel.getRuleIdByLocation(o, a, n, i);
|
1664
|
+
if (!c)
|
1665
1665
|
return r(e);
|
1666
|
-
const u = this._sheetDataValidationModel.getRuleById(o, a,
|
1666
|
+
const u = this._sheetDataValidationModel.getRuleById(o, a, c);
|
1667
1667
|
if (!u)
|
1668
1668
|
return r(e);
|
1669
|
-
const h = (y = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? y : je.VALID,
|
1669
|
+
const h = (y = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? y : je.VALID, d = this._dataValidatorRegistryService.getValidatorItem(u.type), m = s.getCellRaw(n, i), g = Q(m), M = `${g != null ? g : ""}`;
|
1670
1670
|
return r({
|
1671
1671
|
...e,
|
1672
1672
|
markers: {
|
@@ -1674,16 +1674,16 @@ let xn = class extends un {
|
|
1674
1674
|
...h === je.INVALID ? Vr : null
|
1675
1675
|
},
|
1676
1676
|
customRender: [
|
1677
|
-
...(
|
1678
|
-
...
|
1677
|
+
...(p = e == null ? void 0 : e.customRender) != null ? p : [],
|
1678
|
+
...d != null && d.canvasRender ? [d.canvasRender] : []
|
1679
1679
|
],
|
1680
1680
|
fontRenderExtension: {
|
1681
1681
|
...e == null ? void 0 : e.fontRenderExtension,
|
1682
|
-
isSkip: ((S = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : S.isSkip) || ((v =
|
1682
|
+
isSkip: ((S = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : S.isSkip) || ((v = d == null ? void 0 : d.skipDefaultFontRender) == null ? void 0 : v.call(d, u, g, t))
|
1683
1683
|
},
|
1684
1684
|
interceptorStyle: {
|
1685
1685
|
...e == null ? void 0 : e.interceptorStyle,
|
1686
|
-
...
|
1686
|
+
...d == null ? void 0 : d.getExtraStyle(u, M, {
|
1687
1687
|
get style() {
|
1688
1688
|
const w = l.getStyles();
|
1689
1689
|
return (typeof (e == null ? void 0 : e.s) == "string" ? w.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {};
|
@@ -1706,7 +1706,7 @@ let xn = class extends un {
|
|
1706
1706
|
workbook: l,
|
1707
1707
|
worksheet: s
|
1708
1708
|
};
|
1709
|
-
return (L = (A =
|
1709
|
+
return (L = (A = d == null ? void 0 : d.canvasRender) == null ? void 0 : A.calcCellAutoHeight) == null ? void 0 : L.call(A, R);
|
1710
1710
|
},
|
1711
1711
|
coverable: ((C = e == null ? void 0 : e.coverable) != null ? C : !0) && !(u.type === G.LIST || u.type === G.LIST_MULTIPLE)
|
1712
1712
|
});
|
@@ -1718,7 +1718,7 @@ let xn = class extends un {
|
|
1718
1718
|
_initAutoHeight() {
|
1719
1719
|
this._sheetDataValidationModel.ruleChange$.pipe(
|
1720
1720
|
_n((e) => e.source === "command"),
|
1721
|
-
|
1721
|
+
dr(16)
|
1722
1722
|
).subscribe((e) => {
|
1723
1723
|
const t = [];
|
1724
1724
|
if (e.forEach((r) => {
|
@@ -1770,14 +1770,15 @@ Vt = bo([
|
|
1770
1770
|
$n(2, b(bt))
|
1771
1771
|
], Vt);
|
1772
1772
|
function Eo(e) {
|
1773
|
-
var
|
1773
|
+
var c;
|
1774
1774
|
const t = U(se), r = U(mn), { value: n, onChange: i, extraComponent: o } = e, [a, l] = H(!1), s = o ? r.get(o) : null;
|
1775
|
-
return /* @__PURE__ */ W(
|
1775
|
+
return /* @__PURE__ */ W(ct, { children: [
|
1776
1776
|
/* @__PURE__ */ W(
|
1777
1777
|
"div",
|
1778
1778
|
{
|
1779
1779
|
className: `
|
1780
1780
|
univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-gray-900
|
1781
|
+
dark:univer-text-white
|
1781
1782
|
`,
|
1782
1783
|
onClick: () => l(!a),
|
1783
1784
|
children: [
|
@@ -1786,16 +1787,16 @@ function Eo(e) {
|
|
1786
1787
|
]
|
1787
1788
|
}
|
1788
1789
|
),
|
1789
|
-
a && /* @__PURE__ */ W(
|
1790
|
+
a && /* @__PURE__ */ W(ct, { children: [
|
1790
1791
|
s ? /* @__PURE__ */ _(s, { value: n, onChange: i }) : null,
|
1791
1792
|
/* @__PURE__ */ _(
|
1792
1793
|
j,
|
1793
1794
|
{
|
1794
1795
|
label: t.t("dataValidation.panel.invalid"),
|
1795
1796
|
children: /* @__PURE__ */ W(
|
1796
|
-
|
1797
|
+
pn,
|
1797
1798
|
{
|
1798
|
-
value: `${(
|
1799
|
+
value: `${(c = n.errorStyle) != null ? c : lt.WARNING}`,
|
1799
1800
|
onChange: (u) => i({ ...n, errorStyle: +u }),
|
1800
1801
|
children: [
|
1801
1802
|
/* @__PURE__ */ _(Oe, { value: `${lt.WARNING}`, children: t.t("dataValidation.panel.showWarning") }),
|
@@ -1839,27 +1840,27 @@ function Vo(e, t, r) {
|
|
1839
1840
|
}
|
1840
1841
|
function Oo() {
|
1841
1842
|
var O, B;
|
1842
|
-
const [e, t] = H(0), r = U(_e), n = Te(r.activeRule$, r.activeRule), { unitId: i, subUnitId: o, rule: a } = n || {}, l = a.uid, s = U(ye),
|
1843
|
+
const [e, t] = H(0), r = U(_e), n = Te(r.activeRule$, r.activeRule), { unitId: i, subUnitId: o, rule: a } = n || {}, l = a.uid, s = U(ye), c = U(le), u = U(mn), h = U(J), d = U(fn), m = U(se), [g, M] = H(a), y = s.getValidatorItem(g.type), [p, S] = H(!1), v = s.getValidatorsByScope(ui.SHEET), [C, w] = H(() => g.ranges.map((f) => ({ unitId: "", sheetId: "", range: f }))), I = dt(() => Do(h), [h]), [R, T] = H(!1), [N, D] = H(!1), P = ht(null), A = U(hr);
|
1843
1844
|
if (Pe(() => () => {
|
1844
1845
|
const f = A.getCurrentLastSelection();
|
1845
1846
|
f && A.setSelections([f]);
|
1846
1847
|
}, [A]), Pe(() => {
|
1847
1848
|
h.onCommandExecuted((f) => {
|
1848
1849
|
(f.id === Wr.id || f.id === jr.id) && setTimeout(() => {
|
1849
|
-
const k =
|
1850
|
+
const k = d.getRuleById(i, o, l);
|
1850
1851
|
t(($) => $ + 1), k && (M(k), w(k.ranges.map(($) => ({ unitId: "", sheetId: "", range: $ }))));
|
1851
1852
|
}, 20);
|
1852
1853
|
});
|
1853
|
-
}, [h,
|
1854
|
+
}, [h, d, l, o, i]), !y)
|
1854
1855
|
return null;
|
1855
|
-
const L = y.operators, V = y.operatorNames, F =
|
1856
|
+
const L = y.operators, V = y.operatorNames, F = g.operator ? hi.includes(g.operator) : !1, x = () => {
|
1856
1857
|
var f, k, $;
|
1857
|
-
(k = (f = P.current) == null ? void 0 : f.editor) != null && k.isFocus() && X(($ = P.current) == null ? void 0 : $.getValue()), !(!
|
1858
|
+
(k = (f = P.current) == null ? void 0 : f.editor) != null && k.isFocus() && X(($ = P.current) == null ? void 0 : $.getValue()), !(!g.ranges.length || R) && (y.validatorFormula(g, i, o).success ? r.setActiveRule(null) : S(!0));
|
1858
1859
|
}, X = Qt((f) => {
|
1859
1860
|
const k = f.split(",").filter(Boolean).map(Ui).map((q) => {
|
1860
1861
|
const yn = q.sheetName;
|
1861
1862
|
if (yn) {
|
1862
|
-
const Ar = Vo(
|
1863
|
+
const Ar = Vo(c, q.unitId, yn);
|
1863
1864
|
return { ...q, sheetId: Ar };
|
1864
1865
|
}
|
1865
1866
|
return {
|
@@ -1872,7 +1873,7 @@ function Oo() {
|
|
1872
1873
|
w(k);
|
1873
1874
|
const $ = k.filter((q) => (!q.unitId || q.unitId === i) && (!q.sheetId || q.sheetId === o)).map((q) => q.range);
|
1874
1875
|
if (M({
|
1875
|
-
...
|
1876
|
+
...g,
|
1876
1877
|
ranges: $
|
1877
1878
|
}), $.length === 0)
|
1878
1879
|
return;
|
@@ -1884,10 +1885,10 @@ function Oo() {
|
|
1884
1885
|
};
|
1885
1886
|
I(nr.id, Ce);
|
1886
1887
|
}), Z = (f) => {
|
1887
|
-
if (bn(f, Pn(
|
1888
|
+
if (bn(f, Pn(g)))
|
1888
1889
|
return;
|
1889
1890
|
M({
|
1890
|
-
...
|
1891
|
+
...g,
|
1891
1892
|
...f
|
1892
1893
|
});
|
1893
1894
|
const k = {
|
@@ -1908,20 +1909,20 @@ function Oo() {
|
|
1908
1909
|
subUnitId: o
|
1909
1910
|
}), r.setActiveRule(null);
|
1910
1911
|
}, te = {
|
1911
|
-
type:
|
1912
|
-
operator:
|
1913
|
-
formula1:
|
1914
|
-
formula2:
|
1915
|
-
allowBlank:
|
1916
|
-
},
|
1912
|
+
type: g.type,
|
1913
|
+
operator: g.operator,
|
1914
|
+
formula1: g.formula1,
|
1915
|
+
formula2: g.formula2,
|
1916
|
+
allowBlank: g.allowBlank
|
1917
|
+
}, pe = (f) => {
|
1917
1918
|
const k = s.getValidatorItem(f);
|
1918
1919
|
if (!k)
|
1919
1920
|
return;
|
1920
|
-
const $ = k.operators, Ce =
|
1921
|
+
const $ = k.operators, Ce = d.getRuleById(i, o, l), q = f === (Ce == null ? void 0 : Ce.type) || f.includes("list") && (Ce != null && Ce.type.includes("list")) ? {
|
1921
1922
|
...Ce,
|
1922
1923
|
type: f
|
1923
1924
|
} : {
|
1924
|
-
...
|
1925
|
+
...g,
|
1925
1926
|
type: f,
|
1926
1927
|
operator: $[0],
|
1927
1928
|
formula1: void 0,
|
@@ -1930,12 +1931,12 @@ function Oo() {
|
|
1930
1931
|
M(q), h.executeCommand(En.id, {
|
1931
1932
|
unitId: i,
|
1932
1933
|
subUnitId: o,
|
1933
|
-
ruleId:
|
1934
|
+
ruleId: g.uid,
|
1934
1935
|
setting: Pn(q)
|
1935
1936
|
});
|
1936
|
-
},
|
1937
|
-
bn(f, Tn(
|
1938
|
-
...
|
1937
|
+
}, ce = u.get(y.formulaInput), ne = dt(() => C.map((f) => _r(f.range)).join(","), []), de = Tn(g), Se = (f) => {
|
1938
|
+
bn(f, Tn(g)) || (M({
|
1939
|
+
...g,
|
1939
1940
|
...f
|
1940
1941
|
}), I(
|
1941
1942
|
Jr.id,
|
@@ -1946,15 +1947,15 @@ function Oo() {
|
|
1946
1947
|
options: f
|
1947
1948
|
}
|
1948
1949
|
));
|
1949
|
-
}, ve = L.length && !
|
1950
|
+
}, ve = L.length && !g.operator;
|
1950
1951
|
return /* @__PURE__ */ W("div", { className: "univer-py-4", children: [
|
1951
1952
|
/* @__PURE__ */ _(
|
1952
1953
|
j,
|
1953
1954
|
{
|
1954
1955
|
label: m.t("dataValidation.panel.range"),
|
1955
|
-
error: !
|
1956
|
+
error: !g.ranges.length || R ? m.t("dataValidation.panel.rangeError") : "",
|
1956
1957
|
children: /* @__PURE__ */ _(
|
1957
|
-
|
1958
|
+
di,
|
1958
1959
|
{
|
1959
1960
|
selectorRef: P,
|
1960
1961
|
unitId: i,
|
@@ -1977,19 +1978,19 @@ function Oo() {
|
|
1977
1978
|
Vn,
|
1978
1979
|
{
|
1979
1980
|
className: "univer-w-full",
|
1980
|
-
value:
|
1981
|
+
value: g.type,
|
1981
1982
|
options: (O = v == null ? void 0 : v.sort((f, k) => f.order - k.order)) == null ? void 0 : O.map((f) => ({
|
1982
1983
|
label: m.t(f.title),
|
1983
1984
|
value: f.id
|
1984
1985
|
})),
|
1985
|
-
onChange:
|
1986
|
+
onChange: pe
|
1986
1987
|
}
|
1987
1988
|
) }),
|
1988
1989
|
L != null && L.length ? /* @__PURE__ */ _(j, { label: m.t("dataValidation.panel.operator"), children: /* @__PURE__ */ _(
|
1989
1990
|
Vn,
|
1990
1991
|
{
|
1991
1992
|
className: "univer-w-full",
|
1992
|
-
value: `${
|
1993
|
+
value: `${g.operator}`,
|
1993
1994
|
options: [
|
1994
1995
|
{
|
1995
1996
|
value: "",
|
@@ -2008,13 +2009,13 @@ function Oo() {
|
|
2008
2009
|
}
|
2009
2010
|
}
|
2010
2011
|
) }) : null,
|
2011
|
-
|
2012
|
-
|
2012
|
+
ce && !ve ? /* @__PURE__ */ _(
|
2013
|
+
ce,
|
2013
2014
|
{
|
2014
2015
|
isTwoFormula: F,
|
2015
2016
|
value: {
|
2016
|
-
formula1:
|
2017
|
-
formula2:
|
2017
|
+
formula1: g.formula1,
|
2018
|
+
formula2: g.formula2
|
2018
2019
|
},
|
2019
2020
|
onChange: (f) => {
|
2020
2021
|
Z({
|
@@ -2022,29 +2023,29 @@ function Oo() {
|
|
2022
2023
|
...f
|
2023
2024
|
});
|
2024
2025
|
},
|
2025
|
-
showError:
|
2026
|
-
validResult: y.validatorFormula(
|
2026
|
+
showError: p,
|
2027
|
+
validResult: y.validatorFormula(g, i, o),
|
2027
2028
|
unitId: i,
|
2028
2029
|
subUnitId: o,
|
2029
2030
|
ruleId: l
|
2030
2031
|
},
|
2031
|
-
e +
|
2032
|
+
e + g.type
|
2032
2033
|
) : null,
|
2033
2034
|
/* @__PURE__ */ _(j, { children: /* @__PURE__ */ _(
|
2034
2035
|
Lt,
|
2035
2036
|
{
|
2036
|
-
checked: (B =
|
2037
|
+
checked: (B = g.allowBlank) != null ? B : !0,
|
2037
2038
|
onChange: () => {
|
2038
2039
|
var f;
|
2039
2040
|
return Z({
|
2040
2041
|
...te,
|
2041
|
-
allowBlank: !((f =
|
2042
|
+
allowBlank: !((f = g.allowBlank) == null || f)
|
2042
2043
|
});
|
2043
2044
|
},
|
2044
2045
|
children: m.t("dataValidation.panel.allowBlank")
|
2045
2046
|
}
|
2046
2047
|
) }),
|
2047
|
-
/* @__PURE__ */ _(Eo, { value:
|
2048
|
+
/* @__PURE__ */ _(Eo, { value: de, onChange: Se, extraComponent: y.optionsInput }),
|
2048
2049
|
/* @__PURE__ */ W("div", { className: "univer-mt-5 univer-flex univer-flex-row univer-justify-end", children: [
|
2049
2050
|
/* @__PURE__ */ _(ze, { className: "univer-ml-3", onClick: z, children: m.t("dataValidation.panel.removeRule") }),
|
2050
2051
|
/* @__PURE__ */ _(ze, { className: "univer-ml-3", variant: "primary", onClick: x, children: m.t("dataValidation.panel.done") })
|
@@ -2052,23 +2053,23 @@ function Oo() {
|
|
2052
2053
|
] });
|
2053
2054
|
}
|
2054
2055
|
const To = (e) => {
|
2055
|
-
const { rule: t, onClick: r, unitId: n, subUnitId: i, disable: o } = e, a = U(ye), l = U(J), s = U(Ni),
|
2056
|
+
const { rule: t, onClick: r, unitId: n, subUnitId: i, disable: o } = e, a = U(ye), l = U(J), s = U(Ni), c = a.getValidatorItem(t.type), u = ht(void 0), [h, d] = H(!1), m = U(Kn), g = Te(m.currentTheme$), M = dt(() => {
|
2056
2057
|
var w;
|
2057
|
-
const
|
2058
|
+
const p = m.getColorFromTheme("primary.600"), S = m.getColorFromTheme("loop-color.2"), v = (w = m.getColorFromTheme(S)) != null ? w : p, C = new Xr(v).toRgb();
|
2058
2059
|
return {
|
2059
2060
|
fill: `rgba(${C.r}, ${C.g}, ${C.b}, 0.1)`,
|
2060
2061
|
stroke: v
|
2061
2062
|
};
|
2062
|
-
}, [
|
2063
|
+
}, [g]), y = (p) => {
|
2063
2064
|
l.executeCommand(ir.id, {
|
2064
2065
|
ruleId: t.uid,
|
2065
2066
|
unitId: n,
|
2066
2067
|
subUnitId: i
|
2067
|
-
}),
|
2068
|
+
}), p.stopPropagation();
|
2068
2069
|
};
|
2069
2070
|
return Pe(() => () => {
|
2070
|
-
var
|
2071
|
-
u.current && ((
|
2071
|
+
var p;
|
2072
|
+
u.current && ((p = u.current) == null || p.forEach((S) => {
|
2072
2073
|
S && s.removeShape(S);
|
2073
2074
|
}));
|
2074
2075
|
}, [s]), /* @__PURE__ */ W(
|
@@ -2087,15 +2088,15 @@ const To = (e) => {
|
|
2087
2088
|
),
|
2088
2089
|
onClick: r,
|
2089
2090
|
onMouseEnter: () => {
|
2090
|
-
o || (
|
2091
|
-
range:
|
2091
|
+
o || (d(!0), u.current = t.ranges.map((p) => s.addShape({
|
2092
|
+
range: p,
|
2092
2093
|
style: M,
|
2093
2094
|
primary: null
|
2094
2095
|
})));
|
2095
2096
|
},
|
2096
2097
|
onMouseLeave: () => {
|
2097
|
-
var
|
2098
|
-
|
2098
|
+
var p;
|
2099
|
+
d(!1), (p = u.current) == null || p.forEach((S) => {
|
2099
2100
|
S && s.removeShape(S);
|
2100
2101
|
}), u.current = void 0;
|
2101
2102
|
},
|
@@ -2104,19 +2105,17 @@ const To = (e) => {
|
|
2104
2105
|
"div",
|
2105
2106
|
{
|
2106
2107
|
className: `
|
2107
|
-
univer-
|
2108
|
-
univer-text-
|
2108
|
+
univer-truncate univer-text-sm univer-font-medium univer-leading-[22px] univer-text-gray-900
|
2109
|
+
dark:univer-text-white
|
2109
2110
|
`,
|
2110
|
-
children:
|
2111
|
+
children: c == null ? void 0 : c.generateRuleName(t)
|
2111
2112
|
}
|
2112
2113
|
),
|
2113
2114
|
/* @__PURE__ */ _(
|
2114
2115
|
"div",
|
2115
2116
|
{
|
2116
|
-
className:
|
2117
|
-
|
2118
|
-
`,
|
2119
|
-
children: t.ranges.map((g) => _r(g)).join(",")
|
2117
|
+
className: "univer-text-secondary univer-truncate univer-text-xs univer-leading-[18px]",
|
2118
|
+
children: t.ranges.map((p) => _r(p)).join(",")
|
2120
2119
|
}
|
2121
2120
|
),
|
2122
2121
|
h ? /* @__PURE__ */ _(
|
@@ -2136,36 +2135,36 @@ const To = (e) => {
|
|
2136
2135
|
);
|
2137
2136
|
};
|
2138
2137
|
function Po(e) {
|
2139
|
-
const t = U(ee), r = U(le), n = U(J), i = U(we), o = U(_e), a = U(se), [l, s] = H([]), { workbook:
|
2138
|
+
const t = U(ee), r = U(le), n = U(J), i = U(we), o = U(_e), a = U(se), [l, s] = H([]), { workbook: c } = e, u = Te(c.activeSheet$, void 0, !0), h = c.getUnitId(), d = u == null ? void 0 : u.getSheetId();
|
2140
2139
|
Pe(() => {
|
2141
|
-
s(t.getRules(h,
|
2140
|
+
s(t.getRules(h, d));
|
2142
2141
|
const S = t.ruleChange$.subscribe((v) => {
|
2143
|
-
v.unitId === h && v.subUnitId ===
|
2142
|
+
v.unitId === h && v.subUnitId === d && s(t.getRules(h, d));
|
2144
2143
|
});
|
2145
2144
|
return () => {
|
2146
2145
|
S.unsubscribe();
|
2147
2146
|
};
|
2148
|
-
}, [h,
|
2147
|
+
}, [h, d, t]);
|
2149
2148
|
const m = async () => {
|
2150
2149
|
const S = er(i), v = {
|
2151
2150
|
unitId: h,
|
2152
|
-
subUnitId:
|
2151
|
+
subUnitId: d,
|
2153
2152
|
rule: S
|
2154
2153
|
};
|
2155
|
-
await n.executeCommand(
|
2154
|
+
await n.executeCommand(gn.id, v), o.setActiveRule({
|
2156
2155
|
unitId: h,
|
2157
|
-
subUnitId:
|
2156
|
+
subUnitId: d,
|
2158
2157
|
rule: S
|
2159
2158
|
});
|
2160
|
-
},
|
2159
|
+
}, g = () => {
|
2161
2160
|
n.executeCommand(Qr.id, {
|
2162
2161
|
unitId: h,
|
2163
|
-
subUnitId:
|
2162
|
+
subUnitId: d
|
2164
2163
|
});
|
2165
2164
|
}, y = ((S) => {
|
2166
2165
|
const v = r.getCurrentUnitForType(Y.UNIVER_SHEET), C = v.getActiveSheet(), w = v.getUnitId(), I = C.getSheetId();
|
2167
2166
|
return S.map((T) => bi(i, w, I, T.ranges) ? { ...T } : { ...T, disable: !0 });
|
2168
|
-
})(l),
|
2167
|
+
})(l), p = y == null ? void 0 : y.some((S) => S.disable);
|
2169
2168
|
return /* @__PURE__ */ W("div", { className: "univer-pb-4", children: [
|
2170
2169
|
y == null ? void 0 : y.map((S) => {
|
2171
2170
|
var v;
|
@@ -2173,11 +2172,11 @@ function Po(e) {
|
|
2173
2172
|
To,
|
2174
2173
|
{
|
2175
2174
|
unitId: h,
|
2176
|
-
subUnitId:
|
2175
|
+
subUnitId: d,
|
2177
2176
|
onClick: () => {
|
2178
2177
|
S.disable || o.setActiveRule({
|
2179
2178
|
unitId: h,
|
2180
|
-
subUnitId:
|
2179
|
+
subUnitId: d,
|
2181
2180
|
rule: S
|
2182
2181
|
});
|
2183
2182
|
},
|
@@ -2188,7 +2187,7 @@ function Po(e) {
|
|
2188
2187
|
);
|
2189
2188
|
}),
|
2190
2189
|
/* @__PURE__ */ W("div", { className: "univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2", children: [
|
2191
|
-
l.length && !
|
2190
|
+
l.length && !p ? /* @__PURE__ */ _(ze, { onClick: g, children: a.t("dataValidation.panel.removeAll") }) : null,
|
2192
2191
|
/* @__PURE__ */ _(ze, { variant: "primary", onClick: m, children: a.t("dataValidation.panel.add") })
|
2193
2192
|
] })
|
2194
2193
|
] });
|
@@ -2208,7 +2207,7 @@ const Ao = () => {
|
|
2208
2207
|
function Ot(e) {
|
2209
2208
|
var i;
|
2210
2209
|
const { value: t, onChange: r } = e, n = U(se);
|
2211
|
-
return /* @__PURE__ */ _(j, { label: n.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ W(
|
2210
|
+
return /* @__PURE__ */ _(j, { label: n.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ W(pn, { value: `${(i = t.renderMode) != null ? i : ie.CUSTOM}`, onChange: (o) => r({ ...t, renderMode: +o }), children: [
|
2212
2211
|
/* @__PURE__ */ _(Oe, { value: `${ie.CUSTOM}`, children: n.t("dataValidation.renderMode.chip") }),
|
2213
2212
|
/* @__PURE__ */ _(Oe, { value: `${ie.ARROW}`, children: n.t("dataValidation.renderMode.arrow") }),
|
2214
2213
|
/* @__PURE__ */ _(Oe, { value: `${ie.TEXT}`, children: n.t("dataValidation.renderMode.text") })
|
@@ -2248,8 +2247,8 @@ let an = class {
|
|
2248
2247
|
this._commandService = e, this._univerInstanceService = t, this._formulaService = r, this._themeService = n, this._renderManagerService = i, this._dataValidationModel = o;
|
2249
2248
|
}
|
2250
2249
|
_calc(e, t) {
|
2251
|
-
var
|
2252
|
-
const { vt: r, ht: n } = t || {}, i = e.endX - e.startX - ft * 2, o = e.endY - e.startY, a = ((
|
2250
|
+
var c, u, h;
|
2251
|
+
const { vt: r, ht: n } = t || {}, i = e.endX - e.startX - ft * 2, o = e.endY - e.startY, a = ((c = t == null ? void 0 : t.fs) != null ? c : 10) * 1.6;
|
2253
2252
|
let l = 0, s = 0;
|
2254
2253
|
switch (r) {
|
2255
2254
|
case ae.TOP:
|
@@ -2291,23 +2290,23 @@ let an = class {
|
|
2291
2290
|
return ((r = t == null ? void 0 : t.fs) != null ? r : 10) * 1.6;
|
2292
2291
|
}
|
2293
2292
|
async _parseFormula(e, t, r) {
|
2294
|
-
var
|
2295
|
-
const { formula1: n = ni, formula2: i = ti } = e, o = await this._formulaService.getRuleFormulaResult(t, r, e.uid), a = Ft((h = (u = (
|
2293
|
+
var c, u, h, d, m, g, M, y, p;
|
2294
|
+
const { formula1: n = ni, formula2: i = ti } = e, o = await this._formulaService.getRuleFormulaResult(t, r, e.uid), a = Ft((h = (u = (c = o == null ? void 0 : o[0]) == null ? void 0 : c.result) == null ? void 0 : u[0]) == null ? void 0 : h[0]), l = Ft((g = (m = (d = o == null ? void 0 : o[1]) == null ? void 0 : d.result) == null ? void 0 : m[0]) == null ? void 0 : g[0]), s = Dn(String(a)) && Dn(String(l));
|
2296
2295
|
return {
|
2297
|
-
formula1: De(n) ? Ft((
|
2296
|
+
formula1: De(n) ? Ft((p = (y = (M = o == null ? void 0 : o[0]) == null ? void 0 : M.result) == null ? void 0 : y[0]) == null ? void 0 : p[0]) : n,
|
2298
2297
|
formula2: De(i) ? l : i,
|
2299
2298
|
isFormulaValid: s
|
2300
2299
|
};
|
2301
2300
|
}
|
2302
2301
|
drawWith(e, t) {
|
2303
2302
|
var P, A, L, V;
|
2304
|
-
const { style: r, primaryWithCoord: n, unitId: i, subUnitId: o, worksheet: a, row: l, col: s } = t,
|
2303
|
+
const { style: r, primaryWithCoord: n, unitId: i, subUnitId: o, worksheet: a, row: l, col: s } = t, c = n.isMergedMainCell ? n.mergeInfo : n, u = Q(a.getCellRaw(l, s)), h = this._dataValidationModel.getRuleByLocation(i, o, l, s);
|
2305
2304
|
if (!h)
|
2306
2305
|
return;
|
2307
|
-
const
|
2308
|
-
if (!
|
2306
|
+
const d = this._dataValidationModel.getValidator(h.type);
|
2307
|
+
if (!d || !((P = d.skipDefaultFontRender) != null && P.call(d, h, u, { unitId: i, subUnitId: o, row: l, column: s })))
|
2309
2308
|
return;
|
2310
|
-
const m =
|
2309
|
+
const m = d.parseFormulaSync(h, i, o), { formula1: g } = m, M = this._calc(c, r), { a: y, d: p } = e.getTransform(), S = Ln(M.left, y), v = Ln(M.top, p), C = mi.create().composeMatrix({
|
2311
2310
|
left: S,
|
2312
2311
|
top: v,
|
2313
2312
|
scaleX: 1,
|
@@ -2317,11 +2316,11 @@ let an = class {
|
|
2317
2316
|
skewY: 0,
|
2318
2317
|
flipX: !1,
|
2319
2318
|
flipY: !1
|
2320
|
-
}), w =
|
2321
|
-
e.save(), e.beginPath(), e.rect(
|
2319
|
+
}), w = c.endX - c.startX, I = c.endY - c.startY;
|
2320
|
+
e.save(), e.beginPath(), e.rect(c.startX, c.startY, w, I), e.clip();
|
2322
2321
|
const R = C.getMatrix();
|
2323
2322
|
e.transform(R[0], R[1], R[2], R[3], R[4], R[5]);
|
2324
|
-
const T = ((A = r == null ? void 0 : r.fs) != null ? A : 10) * 1.6, N = String(u) === String(
|
2323
|
+
const T = ((A = r == null ? void 0 : r.fs) != null ? A : 10) * 1.6, N = String(u) === String(g), D = this._themeService.getColorFromTheme("primary.600");
|
2325
2324
|
fi.drawWith(e, {
|
2326
2325
|
checked: N,
|
2327
2326
|
width: T,
|
@@ -2330,20 +2329,20 @@ let an = class {
|
|
2330
2329
|
}), e.restore();
|
2331
2330
|
}
|
2332
2331
|
isHit(e, t) {
|
2333
|
-
const r = t.primaryWithCoord.isMergedMainCell ? t.primaryWithCoord.mergeInfo : t.primaryWithCoord, n = this._calc(r, t.style), i = n.top, o = n.top + n.height, a = n.left, l = n.left + n.width, { x: s, y:
|
2334
|
-
return s <= l && s >= a &&
|
2332
|
+
const r = t.primaryWithCoord.isMergedMainCell ? t.primaryWithCoord.mergeInfo : t.primaryWithCoord, n = this._calc(r, t.style), i = n.top, o = n.top + n.height, a = n.left, l = n.left + n.width, { x: s, y: c } = e;
|
2333
|
+
return s <= l && s >= a && c <= o && c >= i;
|
2335
2334
|
}
|
2336
2335
|
async onPointerDown(e, t) {
|
2337
|
-
var
|
2336
|
+
var g;
|
2338
2337
|
if (t.button === 2)
|
2339
2338
|
return;
|
2340
|
-
const { primaryWithCoord: r, unitId: n, subUnitId: i, worksheet: o, row: a, col: l } = e, s = Q(o.getCellRaw(a, l)),
|
2341
|
-
if (!
|
2339
|
+
const { primaryWithCoord: r, unitId: n, subUnitId: i, worksheet: o, row: a, col: l } = e, s = Q(o.getCellRaw(a, l)), c = this._dataValidationModel.getRuleByLocation(n, i, a, l);
|
2340
|
+
if (!c)
|
2342
2341
|
return;
|
2343
|
-
const u = this._dataValidationModel.getValidator(
|
2344
|
-
if (!u || !((
|
2342
|
+
const u = this._dataValidationModel.getValidator(c.type);
|
2343
|
+
if (!u || !((g = u.skipDefaultFontRender) != null && g.call(u, c, s, { unitId: n, subUnitId: i, row: a, column: l })))
|
2345
2344
|
return;
|
2346
|
-
const { formula1: h, formula2:
|
2345
|
+
const { formula1: h, formula2: d } = await this._parseFormula(c, n, i), m = {
|
2347
2346
|
range: {
|
2348
2347
|
startColumn: r.actualColumn,
|
2349
2348
|
endColumn: r.actualColumn,
|
@@ -2351,7 +2350,7 @@ let an = class {
|
|
2351
2350
|
endRow: r.actualRow
|
2352
2351
|
},
|
2353
2352
|
value: {
|
2354
|
-
v: String(s) === ri(String(h)) ?
|
2353
|
+
v: String(s) === ri(String(h)) ? d : h,
|
2355
2354
|
p: null
|
2356
2355
|
}
|
2357
2356
|
};
|
@@ -2399,7 +2398,7 @@ class Bo extends fe {
|
|
2399
2398
|
E(this, "id", G.DATE);
|
2400
2399
|
E(this, "formulaInput", $o);
|
2401
2400
|
E(this, "optionsInput", Tt.componentKey);
|
2402
|
-
E(this, "dropdownType",
|
2401
|
+
E(this, "dropdownType", ge.DATE);
|
2403
2402
|
}
|
2404
2403
|
}
|
2405
2404
|
class Ho extends fe {
|
@@ -2419,31 +2418,31 @@ function jo(e, t) {
|
|
2419
2418
|
};
|
2420
2419
|
}
|
2421
2420
|
function Yt(e, t, r, n) {
|
2422
|
-
const i = Ee + sn * 2, o = r - i, a = n - Pt * 2, l = e.map((
|
2423
|
-
layout: jo(
|
2424
|
-
text:
|
2421
|
+
const i = Ee + sn * 2, o = r - i, a = n - Pt * 2, l = e.map((d) => ({
|
2422
|
+
layout: jo(d, t),
|
2423
|
+
text: d
|
2425
2424
|
}));
|
2426
2425
|
let s;
|
2427
|
-
const
|
2428
|
-
l.forEach((
|
2429
|
-
const { layout: m } =
|
2430
|
-
!s || s.width +
|
2431
|
-
width:
|
2426
|
+
const c = [];
|
2427
|
+
l.forEach((d) => {
|
2428
|
+
const { layout: m } = d, { width: g, height: M } = m;
|
2429
|
+
!s || s.width + g + jt > o ? (s = {
|
2430
|
+
width: g,
|
2432
2431
|
height: M,
|
2433
2432
|
items: [{
|
2434
|
-
...
|
2433
|
+
...d,
|
2435
2434
|
left: 0
|
2436
2435
|
}]
|
2437
|
-
},
|
2438
|
-
...
|
2436
|
+
}, c.push(s)) : (s.items.push({
|
2437
|
+
...d,
|
2439
2438
|
left: s.width + jt
|
2440
|
-
}), s.width = s.width +
|
2439
|
+
}), s.width = s.width + g + jt);
|
2441
2440
|
});
|
2442
2441
|
let u = 0, h = 0;
|
2443
|
-
return
|
2444
|
-
h = Math.max(h,
|
2442
|
+
return c.forEach((d, m) => {
|
2443
|
+
h = Math.max(h, d.width), m === c.length - 1 ? u += d.height : u += d.height + Tr;
|
2445
2444
|
}), {
|
2446
|
-
lines:
|
2445
|
+
lines: c,
|
2447
2446
|
totalHeight: u,
|
2448
2447
|
contentWidth: o,
|
2449
2448
|
contentHeight: a,
|
@@ -2498,16 +2497,16 @@ let ln = class {
|
|
2498
2497
|
// eslint-disable-next-line max-lines-per-function
|
2499
2498
|
drawWith(e, t, r, n) {
|
2500
2499
|
var Z, z;
|
2501
|
-
const { primaryWithCoord: i, row: o, col: a, style: l, data: s, subUnitId:
|
2500
|
+
const { primaryWithCoord: i, row: o, col: a, style: l, data: s, subUnitId: c } = t, u = i.isMergedMainCell ? i.mergeInfo : i, h = s == null ? void 0 : s.fontRenderExtension, { leftOffset: d = 0, rightOffset: m = 0, topOffset: g = 0, downOffset: M = 0 } = h || {}, y = this._ensureMap(c), p = this._generateKey(o, a), S = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, o, a);
|
2502
2501
|
if (!S)
|
2503
2502
|
return;
|
2504
2503
|
const v = this._dataValidationModel.getValidator(S.type);
|
2505
2504
|
if (!v)
|
2506
2505
|
return;
|
2507
2506
|
const C = {
|
2508
|
-
startX: u.startX +
|
2507
|
+
startX: u.startX + d,
|
2509
2508
|
endX: u.endX - m,
|
2510
|
-
startY: u.startY +
|
2509
|
+
startY: u.startY + g,
|
2511
2510
|
endY: u.endY - M
|
2512
2511
|
}, w = C.endX - C.startX, I = C.endY - C.startY, { cl: R } = l || {}, T = (Z = typeof R == "object" ? R == null ? void 0 : R.rgb : R) != null ? Z : "#000", N = xt(l != null ? l : void 0), { vt: D, ht: P } = l || {}, A = D != null ? D : ae.MIDDLE, L = (z = Q(s)) != null ? z : "", V = v.parseCellValue(L), F = v.getListWithColorMap(S), x = Yt(V, N, w, I);
|
2513
2512
|
this._drawDownIcon(e, C, w, I, A), e.save(), e.translateWithPrecision(C.startX, C.startY), e.beginPath(), e.rect(0, 0, w - Ee, I), e.clip(), e.translateWithPrecision(sn, Pt);
|
@@ -2520,19 +2519,19 @@ let ln = class {
|
|
2520
2519
|
X = x.contentHeight - x.totalHeight;
|
2521
2520
|
break;
|
2522
2521
|
}
|
2523
|
-
e.translateWithPrecision(0, X), x.lines.forEach((te,
|
2522
|
+
e.translateWithPrecision(0, X), x.lines.forEach((te, pe) => {
|
2524
2523
|
e.save();
|
2525
|
-
const { width:
|
2524
|
+
const { width: ce, height: ne, items: de } = te;
|
2526
2525
|
let Se = 0;
|
2527
2526
|
switch (P) {
|
2528
2527
|
case Ye.RIGHT:
|
2529
|
-
Se = x.contentWidth -
|
2528
|
+
Se = x.contentWidth - ce;
|
2530
2529
|
break;
|
2531
2530
|
case Ye.CENTER:
|
2532
|
-
Se = (x.contentWidth -
|
2531
|
+
Se = (x.contentWidth - ce) / 2;
|
2533
2532
|
break;
|
2534
2533
|
}
|
2535
|
-
e.translate(Se,
|
2534
|
+
e.translate(Se, pe * (ne + Tr)), de.forEach((ve) => {
|
2536
2535
|
e.save(), e.translateWithPrecision(ve.left, 0), Xo.drawWith(e, {
|
2537
2536
|
...N,
|
2538
2537
|
info: ve,
|
@@ -2540,7 +2539,7 @@ let ln = class {
|
|
2540
2539
|
fill: F[ve.text]
|
2541
2540
|
}), e.restore();
|
2542
2541
|
}), e.restore();
|
2543
|
-
}), e.restore(), y.set(
|
2542
|
+
}), e.restore(), y.set(p, {
|
2544
2543
|
left: C.startX,
|
2545
2544
|
top: C.startY,
|
2546
2545
|
width: x.contentWidth + sn + Ee,
|
@@ -2549,34 +2548,34 @@ let ln = class {
|
|
2549
2548
|
}
|
2550
2549
|
calcCellAutoHeight(e) {
|
2551
2550
|
var w;
|
2552
|
-
const { primaryWithCoord: t, style: r, data: n, row: i, col: o } = e, a = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: s = 0, topOffset:
|
2551
|
+
const { primaryWithCoord: t, style: r, data: n, row: i, col: o } = e, a = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: s = 0, topOffset: c = 0, downOffset: u = 0 } = a || {}, h = t.isMergedMainCell ? t.mergeInfo : t, d = {
|
2553
2552
|
startX: h.startX + l,
|
2554
2553
|
endX: h.endX - s,
|
2555
|
-
startY: h.startY +
|
2554
|
+
startY: h.startY + c,
|
2556
2555
|
endY: h.endY - u
|
2557
2556
|
}, m = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2558
2557
|
if (!m)
|
2559
2558
|
return;
|
2560
|
-
const
|
2561
|
-
if (!
|
2559
|
+
const g = this._dataValidationModel.getValidator(m.type);
|
2560
|
+
if (!g)
|
2562
2561
|
return;
|
2563
|
-
const M =
|
2562
|
+
const M = d.endX - d.startX, y = d.endY - d.startY, p = (w = Q(n)) != null ? w : "", S = g.parseCellValue(p), v = xt(r != null ? r : void 0);
|
2564
2563
|
return Yt(S, v, M, y).cellAutoHeight;
|
2565
2564
|
}
|
2566
2565
|
calcCellAutoWidth(e) {
|
2567
2566
|
var w;
|
2568
|
-
const { primaryWithCoord: t, style: r, data: n, row: i, col: o } = e, a = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: s = 0, topOffset:
|
2567
|
+
const { primaryWithCoord: t, style: r, data: n, row: i, col: o } = e, a = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: s = 0, topOffset: c = 0, downOffset: u = 0 } = a || {}, h = t.isMergedMainCell ? t.mergeInfo : t, d = {
|
2569
2568
|
startX: h.startX + l,
|
2570
2569
|
endX: h.endX - s,
|
2571
|
-
startY: h.startY +
|
2570
|
+
startY: h.startY + c,
|
2572
2571
|
endY: h.endY - u
|
2573
2572
|
}, m = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2574
2573
|
if (!m)
|
2575
2574
|
return;
|
2576
|
-
const
|
2577
|
-
if (!
|
2575
|
+
const g = this._dataValidationModel.getValidator(m.type);
|
2576
|
+
if (!g)
|
2578
2577
|
return;
|
2579
|
-
const M =
|
2578
|
+
const M = d.endX - d.startX, y = d.endY - d.startY, p = (w = Q(n)) != null ? w : "", S = g.parseCellValue(p), v = xt(r != null ? r : void 0);
|
2580
2579
|
return Yt(S, v, M, y).calcAutoWidth;
|
2581
2580
|
}
|
2582
2581
|
isHit(e, t) {
|
@@ -2614,7 +2613,7 @@ class Zo extends fe {
|
|
2614
2613
|
super(...arguments);
|
2615
2614
|
E(this, "id", G.LIST_MULTIPLE);
|
2616
2615
|
E(this, "canvasRender", this.injector.createInstance(ln));
|
2617
|
-
E(this, "dropdownType",
|
2616
|
+
E(this, "dropdownType", ge.MULTIPLE_LIST);
|
2618
2617
|
}
|
2619
2618
|
}
|
2620
2619
|
var qo = Object.getOwnPropertyDescriptor, Jo = (e, t, r, n) => {
|
@@ -2702,21 +2701,21 @@ function Hn(e, t, r, n, i, o, a = !0) {
|
|
2702
2701
|
break;
|
2703
2702
|
}
|
2704
2703
|
l = Math.max(We, l);
|
2705
|
-
let
|
2704
|
+
let c = 0;
|
2706
2705
|
switch (o) {
|
2707
2706
|
case Ye.CENTER:
|
2708
|
-
|
2707
|
+
c = (e - r) / 2;
|
2709
2708
|
break;
|
2710
2709
|
case Ye.RIGHT:
|
2711
|
-
|
2710
|
+
c = e - r;
|
2712
2711
|
break;
|
2713
2712
|
}
|
2714
|
-
return
|
2715
|
-
paddingLeft:
|
2713
|
+
return c = Math.max(me, c), {
|
2714
|
+
paddingLeft: c,
|
2716
2715
|
paddingTop: l
|
2717
2716
|
};
|
2718
2717
|
}
|
2719
|
-
let
|
2718
|
+
let cn = class {
|
2720
2719
|
constructor(e, t, r, n, i) {
|
2721
2720
|
E(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
2722
2721
|
E(this, "zIndex");
|
@@ -2730,7 +2729,7 @@ let dn = class {
|
|
2730
2729
|
return `${e}.${t}`;
|
2731
2730
|
}
|
2732
2731
|
_drawDownIcon(e, t, r, n, i, o, a) {
|
2733
|
-
const { t: l = re.pd.t, b: s = re.pd.b } = a,
|
2732
|
+
const { t: l = re.pd.t, b: s = re.pd.b } = a, c = r - he;
|
2734
2733
|
let u;
|
2735
2734
|
switch (o) {
|
2736
2735
|
case ae.MIDDLE:
|
@@ -2743,76 +2742,76 @@ let dn = class {
|
|
2743
2742
|
u = l + We + (i / 2 - St / 2);
|
2744
2743
|
break;
|
2745
2744
|
}
|
2746
|
-
e.save(), e.translateWithPrecision(t.startX +
|
2745
|
+
e.save(), e.translateWithPrecision(t.startX + c, t.startY + u), e.fillStyle = "#565656", e.fill(Bn), e.restore();
|
2747
2746
|
}
|
2748
2747
|
// eslint-disable-next-line max-lines-per-function, complexity
|
2749
2748
|
drawWith(e, t, r) {
|
2750
|
-
const { primaryWithCoord: n, row: i, col: o, style: a, data: l, subUnitId: s } = t,
|
2749
|
+
const { primaryWithCoord: n, row: i, col: o, style: a, data: l, subUnitId: s } = t, c = n.isMergedMainCell ? n.mergeInfo : n, u = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, i, o);
|
2751
2750
|
if (!u)
|
2752
2751
|
return;
|
2753
2752
|
const h = this._dataValidationModel.getValidator(u.type);
|
2754
2753
|
if (!h)
|
2755
2754
|
return;
|
2756
|
-
const
|
2755
|
+
const d = l == null ? void 0 : l.fontRenderExtension, { leftOffset: m = 0, rightOffset: g = 0, topOffset: M = 0, downOffset: y = 0 } = d || {};
|
2757
2756
|
if (!u || !h || !h || h.id.indexOf(G.LIST) !== 0 || !h.skipDefaultFontRender(u))
|
2758
2757
|
return;
|
2759
|
-
const
|
2760
|
-
startX:
|
2761
|
-
endX:
|
2762
|
-
startY:
|
2763
|
-
endY:
|
2764
|
-
}, S =
|
2758
|
+
const p = {
|
2759
|
+
startX: c.startX + m,
|
2760
|
+
endX: c.endX - g,
|
2761
|
+
startY: c.startY + M,
|
2762
|
+
endY: c.endY - y
|
2763
|
+
}, S = p.endX - p.startX, v = p.endY - p.startY, C = this._ensureMap(s), w = this._generateKey(i, o), I = h.getListWithColor(u), R = Q(l), T = `${R != null ? R : ""}`, N = I.find((V) => V.label === T);
|
2765
2764
|
let { tb: D, vt: P, ht: A, pd: L } = a || {};
|
2766
2765
|
if (D = D != null ? D : Ie.WRAP, P = P != null ? P : ae.BOTTOM, A = A != null ? A : re.ht, L = L != null ? L : re.pd, u.renderMode === ie.ARROW) {
|
2767
|
-
const { l: V = re.pd.l, t: F = re.pd.t, r: x = re.pd.r, b: X = re.pd.b } = L, Z = S - V - x - he - 4, { documentSkeleton: z, documents: te, docModel:
|
2768
|
-
D === Ie.WRAP &&
|
2769
|
-
const
|
2770
|
-
this._drawDownIcon(e,
|
2771
|
-
left:
|
2772
|
-
top:
|
2766
|
+
const { l: V = re.pd.l, t: F = re.pd.t, r: x = re.pd.r, b: X = re.pd.b } = L, Z = S - V - x - he - 4, { documentSkeleton: z, documents: te, docModel: pe } = Ct(T, this._localeService, a);
|
2767
|
+
D === Ie.WRAP && pe.updateDocumentDataPageSize(Math.max(Z, 1)), z.calculate(), z.getActualSize();
|
2768
|
+
const ce = it(z), { height: ne, width: de } = ce, { paddingTop: Se, paddingLeft: ve } = Hn(Z, v - F - X, de, ne, P, A, !0);
|
2769
|
+
this._drawDownIcon(e, p, S, v, ne, P, L), e.save(), e.translateWithPrecision(p.startX + V, p.startY + F), e.beginPath(), e.rect(0, 0, S - V - x, v - F - X), e.clip(), e.translateWithPrecision(0, Se), e.save(), e.translateWithPrecision(be, 0), e.beginPath(), e.rect(0, 0, Z, ne), e.clip(), te.render(e), e.translateWithPrecision(ve, 0), e.restore(), e.restore(), C.set(w, {
|
2770
|
+
left: p.endX + V + r.rowHeaderWidth - he,
|
2771
|
+
top: p.startY + F + r.columnHeaderHeight,
|
2773
2772
|
width: he,
|
2774
2773
|
height: v - F - X
|
2775
2774
|
});
|
2776
2775
|
} else {
|
2777
|
-
e.save(), e.translateWithPrecision(
|
2776
|
+
e.save(), e.translateWithPrecision(p.startX, p.startY), e.beginPath(), e.rect(0, 0, S, v), e.clip();
|
2778
2777
|
const V = S - me * 2 - be - he - 4, { documentSkeleton: F, documents: x, docModel: X } = Ct(T, this._localeService, a);
|
2779
2778
|
D === Ie.WRAP && X.updateDocumentDataPageSize(Math.max(V, 1)), F.calculate();
|
2780
|
-
const Z = it(F), { height: z, width: te } = Z, { paddingTop:
|
2781
|
-
e.translateWithPrecision(me,
|
2782
|
-
const ne = Math.max(S - me * 2, 1),
|
2779
|
+
const Z = it(F), { height: z, width: te } = Z, { paddingTop: pe, paddingLeft: ce } = Hn(V, v, te, z, P, A);
|
2780
|
+
e.translateWithPrecision(me, pe);
|
2781
|
+
const ne = Math.max(S - me * 2, 1), de = z;
|
2783
2782
|
ur.drawWith(e, {
|
2784
2783
|
width: ne,
|
2785
|
-
height:
|
2784
|
+
height: de,
|
2786
2785
|
fill: (N == null ? void 0 : N.color) || He,
|
2787
2786
|
radius: Xt
|
2788
|
-
}), e.save(), e.translateWithPrecision(be, 0), e.beginPath(), e.rect(0, 0, V, z), e.clip(), e.translateWithPrecision(
|
2789
|
-
left:
|
2790
|
-
top:
|
2787
|
+
}), e.save(), e.translateWithPrecision(be, 0), e.beginPath(), e.rect(0, 0, V, z), e.clip(), e.translateWithPrecision(ce, 0), x.render(e), e.restore(), e.translateWithPrecision(V + be + 4, (z - St) / 2), e.fillStyle = Qo, e.fill(Bn), e.restore(), C.set(w, {
|
2788
|
+
left: p.startX + me + r.rowHeaderWidth,
|
2789
|
+
top: p.startY + pe + r.columnHeaderHeight,
|
2791
2790
|
width: ne,
|
2792
|
-
height:
|
2791
|
+
height: de
|
2793
2792
|
});
|
2794
2793
|
}
|
2795
2794
|
}
|
2796
2795
|
calcCellAutoHeight(e) {
|
2797
|
-
const { primaryWithCoord: t, style: r, data: n, row: i, col: o } = e, a = t.isMergedMainCell ? t.mergeInfo : t, l = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset:
|
2798
|
-
if (!
|
2796
|
+
const { primaryWithCoord: t, style: r, data: n, row: i, col: o } = e, a = t.isMergedMainCell ? t.mergeInfo : t, l = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset: c = 0, topOffset: u = 0, downOffset: h = 0 } = l || {}, d = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2797
|
+
if (!d || d.renderMode === ie.TEXT)
|
2799
2798
|
return;
|
2800
2799
|
const m = {
|
2801
2800
|
startX: a.startX + s,
|
2802
|
-
endX: a.endX -
|
2801
|
+
endX: a.endX - c,
|
2803
2802
|
startY: a.startY + u,
|
2804
2803
|
endY: a.endY - h
|
2805
|
-
},
|
2806
|
-
let { tb:
|
2804
|
+
}, g = m.endX - m.startX, M = Q(n), y = `${M != null ? M : ""}`;
|
2805
|
+
let { tb: p, pd: S } = r || {};
|
2807
2806
|
const { t: v = re.pd.t, b: C = re.pd.b } = S != null ? S : {};
|
2808
|
-
if (
|
2809
|
-
const w =
|
2810
|
-
|
2807
|
+
if (p = p != null ? p : Ie.WRAP, d.renderMode === ie.ARROW) {
|
2808
|
+
const w = g - he, { documentSkeleton: I, docModel: R } = Ct(y, this._localeService, r);
|
2809
|
+
p === Ie.WRAP && R.updateDocumentDataPageSize(Math.max(w, 1)), I.calculate(), I.getActualSize();
|
2811
2810
|
const T = it(I), { height: N } = T;
|
2812
2811
|
return N + v + C + We * 2;
|
2813
2812
|
} else {
|
2814
|
-
const w =
|
2815
|
-
|
2813
|
+
const w = g - me * 2 - be - he, { documentSkeleton: I, docModel: R } = Pr(y, this._localeService, r);
|
2814
|
+
p === Ie.WRAP && R.updateDocumentDataPageSize(Math.max(w, 1)), I.calculate();
|
2816
2815
|
const T = it(I), {
|
2817
2816
|
height: N
|
2818
2817
|
} = T;
|
@@ -2820,20 +2819,20 @@ let dn = class {
|
|
2820
2819
|
}
|
2821
2820
|
}
|
2822
2821
|
calcCellAutoWidth(e) {
|
2823
|
-
const { primaryWithCoord: t, style: r, data: n, row: i, col: o } = e, a = t.isMergedMainCell ? t.mergeInfo : t, l = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset:
|
2824
|
-
if (!
|
2822
|
+
const { primaryWithCoord: t, style: r, data: n, row: i, col: o } = e, a = t.isMergedMainCell ? t.mergeInfo : t, l = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset: c = 0, topOffset: u = 0, downOffset: h = 0 } = l || {}, d = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2823
|
+
if (!d || d.renderMode === ie.TEXT)
|
2825
2824
|
return;
|
2826
2825
|
const m = {
|
2827
2826
|
startX: a.startX + s,
|
2828
|
-
endX: a.endX -
|
2827
|
+
endX: a.endX - c,
|
2829
2828
|
startY: a.startY + u,
|
2830
2829
|
endY: a.endY - h
|
2831
|
-
},
|
2832
|
-
let { tb:
|
2830
|
+
}, g = m.endX - m.startX, M = Q(n), y = `${M != null ? M : ""}`;
|
2831
|
+
let { tb: p, pd: S } = r || {};
|
2833
2832
|
const { l: v = re.pd.l, r: C = re.pd.r } = S != null ? S : {};
|
2834
|
-
|
2833
|
+
p = p != null ? p : Ie.WRAP;
|
2835
2834
|
let w = me * 2 + he;
|
2836
|
-
switch (
|
2835
|
+
switch (d.renderMode) {
|
2837
2836
|
case ie.ARROW:
|
2838
2837
|
w = he + me * 2 + C + v;
|
2839
2838
|
break;
|
@@ -2844,15 +2843,15 @@ let dn = class {
|
|
2844
2843
|
default:
|
2845
2844
|
w = he + me * 2 + be * 2 + C + v + Xt / 2 + 1;
|
2846
2845
|
}
|
2847
|
-
const I =
|
2848
|
-
return
|
2846
|
+
const I = g - w, { documentSkeleton: R, docModel: T } = Ct(y, this._localeService, r);
|
2847
|
+
return p === Ie.WRAP && T.updateDocumentDataPageSize(Math.max(I, 1)), R.calculate(), R.getActualSize(), it(R).width + w;
|
2849
2848
|
}
|
2850
2849
|
isHit(e, t) {
|
2851
2850
|
const { subUnitId: r, row: n, col: i } = t, a = this._ensureMap(r).get(this._generateKey(n, i)), l = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, n, i);
|
2852
2851
|
if (!l || !a || l.renderMode === ie.TEXT)
|
2853
2852
|
return !1;
|
2854
|
-
const { top: s, left:
|
2855
|
-
return
|
2853
|
+
const { top: s, left: c, width: u, height: h } = a, { x: d, y: m } = e;
|
2854
|
+
return d >= c && d <= c + u && m >= s && m <= s + h;
|
2856
2855
|
}
|
2857
2856
|
onPointerDown(e, t) {
|
2858
2857
|
if (t.button === 2)
|
@@ -2874,19 +2873,19 @@ let dn = class {
|
|
2874
2873
|
(n = (r = Ke(Y.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.mainComponent) == null || n.setCursor(Ge.DEFAULT);
|
2875
2874
|
}
|
2876
2875
|
};
|
2877
|
-
|
2876
|
+
cn = Jo([
|
2878
2877
|
at(0, le),
|
2879
2878
|
at(1, b(se)),
|
2880
2879
|
at(2, J),
|
2881
2880
|
at(3, b(Ne)),
|
2882
2881
|
at(4, b(ee))
|
2883
|
-
],
|
2882
|
+
], cn);
|
2884
2883
|
class ta extends fe {
|
2885
2884
|
constructor() {
|
2886
2885
|
super(...arguments);
|
2887
2886
|
E(this, "id", G.LIST);
|
2888
|
-
E(this, "canvasRender", this.injector.createInstance(
|
2889
|
-
E(this, "dropdownType",
|
2887
|
+
E(this, "canvasRender", this.injector.createInstance(cn));
|
2888
|
+
E(this, "dropdownType", ge.LIST);
|
2890
2889
|
E(this, "optionsInput", Ot.componentKey);
|
2891
2890
|
E(this, "formulaInput", hn);
|
2892
2891
|
}
|
@@ -3006,10 +3005,10 @@ let Wn = (It = class extends Gn {
|
|
3006
3005
|
Wn = sa([
|
3007
3006
|
Kt(1, b(we)),
|
3008
3007
|
Kt(2, J),
|
3009
|
-
Kt(3,
|
3008
|
+
Kt(3, dn)
|
3010
3009
|
], Wn);
|
3011
|
-
var
|
3012
|
-
for (var i = n > 1 ? void 0 : n ?
|
3010
|
+
var ca = Object.getOwnPropertyDescriptor, da = (e, t, r, n) => {
|
3011
|
+
for (var i = n > 1 ? void 0 : n ? ca(t, r) : t, o = e.length - 1, a; o >= 0; o--)
|
3013
3012
|
(a = e[o]) && (i = a(i) || i);
|
3014
3013
|
return i;
|
3015
3014
|
}, Gt = (e, t) => (r, n) => t(r, n, e);
|
@@ -3061,10 +3060,10 @@ let jn = (wt = class extends Gn {
|
|
3061
3060
|
this._injector.get(qe);
|
3062
3061
|
}
|
3063
3062
|
}, E(wt, "pluginName", ua), E(wt, "type", Y.UNIVER_SHEET), wt);
|
3064
|
-
jn =
|
3063
|
+
jn = da([
|
3065
3064
|
Gt(1, b(we)),
|
3066
3065
|
Gt(2, J),
|
3067
|
-
Gt(3,
|
3066
|
+
Gt(3, dn)
|
3068
3067
|
], jn);
|
3069
3068
|
export {
|
3070
3069
|
fe as BaseSheetDataValidatorView,
|