@univerjs/sheets-data-validation-ui 0.7.0-nightly.202505131607 → 0.7.0-nightly.202505151607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +224 -224
- package/lib/index.css +1 -1
- package/lib/index.js +224 -224
- package/lib/umd/index.js +2 -2
- package/package.json +13 -13
package/lib/index.js
CHANGED
@@ -1,15 +1,15 @@
|
|
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
|
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 cn, 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
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
|
6
|
+
import { jsxs as W, Fragment as dt, jsx as _ } from "react/jsx-runtime";
|
7
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,
|
9
|
-
import On, { useState as H, useRef as ht, forwardRef as Le, createElement as ke, useMemo as
|
10
|
-
import { FormulaEditor as lr, RangeSelector 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 gt, MenuItemType as vn, getMenuHiddenObservable as si, RibbonDataGroup as li, IMenuManagerService as di, ComponentManager as mn } from "@univerjs/ui";
|
9
|
+
import On, { useState as H, useRef as ht, forwardRef as Le, createElement as ke, useMemo as ct, useEffect as Pe } from "react";
|
10
|
+
import { FormulaEditor as lr, RangeSelector as ci } from "@univerjs/sheets-formula-ui";
|
11
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
|
12
|
+
import { debounceTime as dr, filter as _n, BehaviorSubject as An, distinctUntilChanged as gi, Subject as pi, bufferTime as cr, of as vi } from "rxjs";
|
13
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
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";
|
@@ -17,17 +17,17 @@ import { ISheetCellDropdownManagerService as Di, IEditorBridgeService as mr, Set
|
|
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(dt, { 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: (d) => {
|
28
28
|
n == null || n({
|
29
29
|
...r,
|
30
|
-
formula1:
|
30
|
+
formula1: d
|
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: (d) => {
|
43
43
|
n == null || n({
|
44
44
|
...r,
|
45
|
-
formula2:
|
45
|
+
formula2: d
|
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: (d) => {
|
57
|
+
n == null || n({ formula1: d });
|
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, d] = H(!((t == null ? void 0 : t.formula1) === void 0 && (t == null ? void 0 : t.formula2) === void 0));
|
64
|
+
return /* @__PURE__ */ W(dt, { children: [
|
65
65
|
/* @__PURE__ */ _(j, { children: /* @__PURE__ */ _(
|
66
66
|
Lt,
|
67
67
|
{
|
68
68
|
checked: s,
|
69
69
|
onChange: (u) => {
|
70
|
-
u ?
|
70
|
+
u ? d(!0) : (d(!1), r == null || r({
|
71
71
|
...t,
|
72
72
|
formula1: void 0,
|
73
73
|
formula2: void 0
|
@@ -108,22 +108,22 @@ 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((
|
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), [d, u] = H(!1);
|
112
|
+
return or((c) => {
|
113
113
|
var g;
|
114
|
-
((g = s.current) == null ? void 0 : g.isClickOutSide(
|
114
|
+
((g = s.current) == null ? void 0 : g.isClickOutSide(c)) && u(!1);
|
115
115
|
}), /* @__PURE__ */ _(j, { error: l, children: /* @__PURE__ */ _(
|
116
116
|
lr,
|
117
117
|
{
|
118
118
|
ref: s,
|
119
|
-
className: Xe("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent dark
|
119
|
+
className: Xe("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent dark:!univer-bg-gray-700 dark:!univer-text-white hover:univer-border-primary-600", Mt),
|
120
120
|
initValue: (h = n == null ? void 0 : n.formula1) != null ? h : "=",
|
121
121
|
unitId: t,
|
122
122
|
subUnitId: r,
|
123
|
-
isFocus:
|
123
|
+
isFocus: d,
|
124
124
|
isSupportAcrossSheet: !0,
|
125
|
-
onChange: (
|
126
|
-
const m = (
|
125
|
+
onChange: (c) => {
|
126
|
+
const m = (c != null ? c : "").trim();
|
127
127
|
m !== (n == null ? void 0 : n.formula1) && (i == null || i({
|
128
128
|
...n,
|
129
129
|
formula1: m
|
@@ -283,7 +283,7 @@ const He = "#ECECEC", qi = [
|
|
283
283
|
children: /* @__PURE__ */ W(
|
284
284
|
"div",
|
285
285
|
{
|
286
|
-
className: Xe("univer-box-border univer-inline-flex univer-h-8 univer-w-16 univer-cursor-pointer univer-items-center univer-justify-between univer-gap-2 univer-rounded-lg univer-bg-white univer-px-2.5 univer-transition-colors univer-duration-200 dark
|
286
|
+
className: Xe("univer-box-border univer-inline-flex univer-h-8 univer-w-16 univer-cursor-pointer univer-items-center univer-justify-between univer-gap-2 univer-rounded-lg univer-bg-white univer-px-2.5 univer-transition-colors univer-duration-200 dark:!univer-bg-gray-700 dark:!univer-text-white hover:univer-border-primary-600", Mt),
|
287
287
|
children: [
|
288
288
|
/* @__PURE__ */ _(
|
289
289
|
"div",
|
@@ -332,7 +332,7 @@ const He = "#ECECEC", qi = [
|
|
332
332
|
};
|
333
333
|
function Qi(e) {
|
334
334
|
const { value: t, onChange: r = () => {
|
335
|
-
}, unitId: n, subUnitId: i, validResult: o, showError: a, ruleId: l } = e, { formula1: s = "", formula2:
|
335
|
+
}, unitId: n, subUnitId: i, validResult: o, showError: a, ruleId: l } = e, { formula1: s = "", formula2: d = "" } = t || {}, [u, h] = H(() => De(s) ? "1" : "0"), [c, 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(() => d.split(",")), I = p.getValidatorItem(G.LIST), [R, T] = H([]), [N, D] = H(""), P = a ? o == null ? void 0 : o.formula1 : "", A = ct(() => S.ruleChange$.pipe(dr(16)), []), L = Te(A), V = Qt(r);
|
336
336
|
Pe(() => {
|
337
337
|
(async () => {
|
338
338
|
await new Promise((f) => {
|
@@ -348,7 +348,7 @@ function Qi(e) {
|
|
348
348
|
De(s) && s !== g && (m(s), M(g));
|
349
349
|
}, [g, s]);
|
350
350
|
const [F, x] = H(() => {
|
351
|
-
const O = u !== "1" ? Zr(s) : [], B =
|
351
|
+
const O = u !== "1" ? Zr(s) : [], B = d.split(",");
|
352
352
|
return O.map((f, k) => ({
|
353
353
|
label: f,
|
354
354
|
color: B[k] || He,
|
@@ -361,7 +361,7 @@ function Qi(e) {
|
|
361
361
|
}, Z = (O) => {
|
362
362
|
const B = F.findIndex((f) => f.id === O);
|
363
363
|
B !== -1 && (F.splice(B, 1), x([...F]));
|
364
|
-
}, z =
|
364
|
+
}, z = d.split(","), te = ct(() => R.map((O, B) => ({
|
365
365
|
label: O,
|
366
366
|
color: z[B] || He,
|
367
367
|
id: `${B}`,
|
@@ -372,7 +372,7 @@ function Qi(e) {
|
|
372
372
|
formula1: s,
|
373
373
|
formula2: k.join(",")
|
374
374
|
});
|
375
|
-
},
|
375
|
+
}, de = () => {
|
376
376
|
x([
|
377
377
|
...F,
|
378
378
|
{
|
@@ -406,22 +406,22 @@ function Qi(e) {
|
|
406
406
|
if (!De(O)) {
|
407
407
|
V == null || V({
|
408
408
|
formula1: "",
|
409
|
-
formula2:
|
409
|
+
formula2: d
|
410
410
|
});
|
411
411
|
return;
|
412
412
|
}
|
413
413
|
v.getFormulaRefCheck(O) ? (V == null || V({
|
414
414
|
formula1: De(O) ? O : "",
|
415
|
-
formula2:
|
415
|
+
formula2: d
|
416
416
|
}), D("")) : (V == null || V({
|
417
417
|
formula1: "",
|
418
|
-
formula2:
|
418
|
+
formula2: d
|
419
419
|
}), m("="), D(y.t("dataValidation.validFail.formulaError")));
|
420
|
-
}),
|
420
|
+
}), ce = ht(null), [Se, ve] = H(!1);
|
421
421
|
return or((O) => {
|
422
422
|
var f;
|
423
|
-
((f =
|
424
|
-
}), /* @__PURE__ */ W(
|
423
|
+
((f = ce.current) == null ? void 0 : f.isClickOutSide(O)) && ve(!1);
|
424
|
+
}), /* @__PURE__ */ W(dt, { children: [
|
425
425
|
/* @__PURE__ */ _(j, { label: y.t("dataValidation.list.options"), children: /* @__PURE__ */ W(
|
426
426
|
pn,
|
427
427
|
{
|
@@ -442,9 +442,9 @@ function Qi(e) {
|
|
442
442
|
/* @__PURE__ */ _(
|
443
443
|
lr,
|
444
444
|
{
|
445
|
-
ref:
|
446
|
-
className: Xe("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent dark
|
447
|
-
initValue:
|
445
|
+
ref: ce,
|
446
|
+
className: Xe("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent dark:!univer-bg-gray-700 dark:!univer-text-white hover:univer-border-primary-600", Mt),
|
447
|
+
initValue: c,
|
448
448
|
unitId: n,
|
449
449
|
subUnitId: i,
|
450
450
|
isFocus: Se,
|
@@ -492,7 +492,7 @@ function Qi(e) {
|
|
492
492
|
"a",
|
493
493
|
{
|
494
494
|
className: "univer-flex univer-w-fit univer-cursor-pointer univer-flex-row univer-items-center univer-rounded univer-p-1 univer-px-2 univer-text-sm univer-text-primary hover:univer-bg-primary-50",
|
495
|
-
onClick:
|
495
|
+
onClick: de,
|
496
496
|
children: [
|
497
497
|
/* @__PURE__ */ _(Ir, { className: "univer-mr-1" }),
|
498
498
|
y.t("dataValidation.list.add")
|
@@ -606,12 +606,12 @@ let Ze = class extends Re {
|
|
606
606
|
Ri,
|
607
607
|
{
|
608
608
|
handler: async (e, t, r) => {
|
609
|
-
const n = await e, { row: i, col: o, unitId: a, subUnitId: l } = t, s = this._dataValidationModel.getRuleIdByLocation(a, l, i, o),
|
609
|
+
const n = await e, { row: i, col: o, unitId: a, subUnitId: l } = t, s = this._dataValidationModel.getRuleIdByLocation(a, l, i, o), d = s ? this._dataValidationModel.getRuleById(a, l, s) : void 0;
|
610
610
|
if (n === !1)
|
611
611
|
return r(Promise.resolve(!1));
|
612
|
-
if (!
|
612
|
+
if (!d || d.errorStyle !== lt.STOP)
|
613
613
|
return r(Promise.resolve(!0));
|
614
|
-
const u = this._dataValidatorRegistryService.getValidatorItem(
|
614
|
+
const u = this._dataValidatorRegistryService.getValidatorItem(d.type);
|
615
615
|
return !u || await this._sheetsDataValidationValidatorService.validatorCell(a, l, i, o) === je.VALID ? r(Promise.resolve(!0)) : (this._dialogService.open({
|
616
616
|
width: 368,
|
617
617
|
title: {
|
@@ -619,7 +619,7 @@ let Ze = class extends Re {
|
|
619
619
|
},
|
620
620
|
id: "reject-input-dialog",
|
621
621
|
children: {
|
622
|
-
title: u.getRuleFinalError(
|
622
|
+
title: u.getRuleFinalError(d, { row: i, col: o, unitId: a, subUnitId: l })
|
623
623
|
},
|
624
624
|
footer: {
|
625
625
|
title: On.createElement(
|
@@ -701,14 +701,14 @@ function uo(e, t) {
|
|
701
701
|
}
|
702
702
|
}
|
703
703
|
let Ae = class extends Re {
|
704
|
-
constructor(t, r, n, i, o, a, l, s,
|
704
|
+
constructor(t, r, n, i, o, a, l, s, d, u, h) {
|
705
705
|
super();
|
706
706
|
E(this, "_activeDropdown");
|
707
707
|
E(this, "_activeDropdown$", new pi());
|
708
708
|
E(this, "_currentPopup", null);
|
709
709
|
E(this, "activeDropdown$", this._activeDropdown$.asObservable());
|
710
710
|
E(this, "_zenVisible", !1);
|
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 =
|
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
|
});
|
714
714
|
}
|
@@ -745,19 +745,19 @@ let Ae = class extends Re {
|
|
745
745
|
if (this._currentPopup && this._currentPopup.dispose(), this._zenVisible)
|
746
746
|
return;
|
747
747
|
this._activeDropdown = t, this._activeDropdown$.next(this._activeDropdown);
|
748
|
-
const
|
749
|
-
if (!
|
748
|
+
const d = this._sheetDataValidationModel.getRuleByLocation(o, a, n, i);
|
749
|
+
if (!d)
|
750
750
|
return;
|
751
|
-
const u = this._dataValidatorRegistryService.getValidatorItem(
|
751
|
+
const u = this._dataValidatorRegistryService.getValidatorItem(d.type);
|
752
752
|
if (!(u != null && u.dropdownType))
|
753
753
|
return;
|
754
754
|
let h;
|
755
|
-
const
|
755
|
+
const c = async (v, C) => {
|
756
756
|
var A, L, V;
|
757
757
|
if (!v)
|
758
758
|
return !0;
|
759
759
|
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 : "";
|
760
|
-
return
|
760
|
+
return d.errorStyle !== lt.STOP || await u.validator({
|
761
761
|
value: N,
|
762
762
|
unitId: o,
|
763
763
|
subUnitId: a,
|
@@ -767,7 +767,7 @@ let Ae = class extends Re {
|
|
767
767
|
workbook: l,
|
768
768
|
interceptValue: R.replace("Z", "").replace("T", " "),
|
769
769
|
t: Fr.NUMBER
|
770
|
-
},
|
770
|
+
}, d) ? (await this._commandService.executeCommand(vt.id, {
|
771
771
|
visible: !1,
|
772
772
|
eventType: pt.Keyboard,
|
773
773
|
unitId: o,
|
@@ -793,18 +793,18 @@ let Ae = class extends Re {
|
|
793
793
|
}
|
794
794
|
}
|
795
795
|
}
|
796
|
-
}), !0) : (this._injector.has(Ze) && this._injector.get(Ze).showReject(u.getRuleFinalError(
|
796
|
+
}), !0) : (this._injector.has(Ze) && this._injector.get(Ze).showReject(u.getRuleFinalError(d, { row: n, col: i, unitId: o, subUnitId: a })), !1);
|
797
797
|
};
|
798
798
|
let m;
|
799
799
|
switch (u.dropdownType) {
|
800
800
|
case ge.DATE: {
|
801
|
-
const v = Q(s.getCellRaw(n, i)), C = $t(v), w = !!((M =
|
801
|
+
const v = Q(s.getCellRaw(n, i)), C = $t(v), w = !!((M = d.bizInfo) != null && M.showTime);
|
802
802
|
m = {
|
803
803
|
location: r,
|
804
804
|
type: "datepicker",
|
805
805
|
props: {
|
806
806
|
showTime: w,
|
807
|
-
onChange: (I) =>
|
807
|
+
onChange: (I) => c(I, w ? "datetime" : "date"),
|
808
808
|
defaultValue: C,
|
809
809
|
patternType: "date"
|
810
810
|
}
|
@@ -817,7 +817,7 @@ let Ae = class extends Re {
|
|
817
817
|
location: r,
|
818
818
|
type: "datepicker",
|
819
819
|
props: {
|
820
|
-
onChange: (w) =>
|
820
|
+
onChange: (w) => c(w, "time"),
|
821
821
|
defaultValue: C,
|
822
822
|
patternType: "time"
|
823
823
|
}
|
@@ -830,7 +830,7 @@ let Ae = class extends Re {
|
|
830
830
|
location: r,
|
831
831
|
type: "datepicker",
|
832
832
|
props: {
|
833
|
-
onChange: (w) =>
|
833
|
+
onChange: (w) => c(w, "datetime"),
|
834
834
|
defaultValue: C,
|
835
835
|
patternType: "datetime"
|
836
836
|
}
|
@@ -862,9 +862,9 @@ let Ae = class extends Re {
|
|
862
862
|
unitId: o,
|
863
863
|
keycode: gt.ESC
|
864
864
|
}), this._commandService.executeCommand(st.id, A), !v;
|
865
|
-
}, w = (
|
865
|
+
}, w = (d == null ? void 0 : d.renderMode) === ie.CUSTOM || (d == null ? void 0 : d.renderMode) === void 0, I = u.getListWithColor(d, o, a), R = Ut(s.getCellRaw(n, i)), T = () => {
|
866
866
|
this._commandService.executeCommand(Fe.id, {
|
867
|
-
ruleId:
|
867
|
+
ruleId: d.uid
|
868
868
|
}), h == null || h.dispose();
|
869
869
|
}, N = I.map((D) => ({
|
870
870
|
label: D.label,
|
@@ -914,7 +914,7 @@ let Ae = class extends Re {
|
|
914
914
|
}), this._commandService.syncExecuteCommand(st.id, w), !0;
|
915
915
|
},
|
916
916
|
defaultValue: Ut(s.getCellRaw(n, i)).split("/"),
|
917
|
-
options: JSON.parse((S =
|
917
|
+
options: JSON.parse((S = d.formula1) != null ? S : "[]")
|
918
918
|
},
|
919
919
|
location: r
|
920
920
|
};
|
@@ -980,8 +980,8 @@ let Ae = class extends Re {
|
|
980
980
|
const s = this._dataValidationModel.getRuleByLocation(a.getUnitId(), l.getSheetId(), n, i);
|
981
981
|
if (!s)
|
982
982
|
return;
|
983
|
-
const
|
984
|
-
if (!
|
983
|
+
const d = this._dataValidatorRegistryService.getValidatorItem(s.type);
|
984
|
+
if (!d || !d.dropdownType) {
|
985
985
|
this.hideDropdown();
|
986
986
|
return;
|
987
987
|
}
|
@@ -1009,7 +1009,7 @@ Ae = co([
|
|
1009
1009
|
ue(7, J),
|
1010
1010
|
ue(8, mr),
|
1011
1011
|
ue(9, b(we)),
|
1012
|
-
ue(10,
|
1012
|
+
ue(10, cn)
|
1013
1013
|
], Ae);
|
1014
1014
|
const Dt = "DataValidationPanel", Fe = {
|
1015
1015
|
id: "data-validation.operation.open-validation-panel",
|
@@ -1019,20 +1019,20 @@ const Dt = "DataValidationPanel", Fe = {
|
|
1019
1019
|
return !1;
|
1020
1020
|
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);
|
1021
1021
|
if (!s) return !1;
|
1022
|
-
const { unitId:
|
1022
|
+
const { unitId: d, subUnitId: u } = s, h = r ? o.getRuleById(d, u, r) : void 0;
|
1023
1023
|
i.open(), i.setActiveRule(h && {
|
1024
|
-
unitId:
|
1024
|
+
unitId: d,
|
1025
1025
|
subUnitId: u,
|
1026
1026
|
rule: h
|
1027
1027
|
});
|
1028
|
-
const
|
1028
|
+
const c = l.open({
|
1029
1029
|
id: Dt,
|
1030
1030
|
header: { title: n ? "dataValidation.panel.addTitle" : "dataValidation.panel.title" },
|
1031
1031
|
children: { label: Dt },
|
1032
1032
|
width: 312,
|
1033
1033
|
onClose: () => i.close()
|
1034
1034
|
});
|
1035
|
-
return i.setCloseDisposable(
|
1035
|
+
return i.setCloseDisposable(c), !0;
|
1036
1036
|
}
|
1037
1037
|
}, Rn = {
|
1038
1038
|
id: "data-validation.operation.close-validation-panel",
|
@@ -1073,12 +1073,12 @@ const Dt = "DataValidationPanel", Fe = {
|
|
1073
1073
|
handler(e) {
|
1074
1074
|
const t = e.get(le), r = gr(t);
|
1075
1075
|
if (!r) return !1;
|
1076
|
-
const { workbook: n, worksheet: i } = r, o = er(e), a = e.get(J), l = n.getUnitId(), s = i.getSheetId(),
|
1076
|
+
const { workbook: n, worksheet: i } = r, o = er(e), a = e.get(J), l = n.getUnitId(), s = i.getSheetId(), d = {
|
1077
1077
|
rule: o,
|
1078
1078
|
unitId: l,
|
1079
1079
|
subUnitId: s
|
1080
1080
|
};
|
1081
|
-
return a.syncExecuteCommand(gn.id,
|
1081
|
+
return a.syncExecuteCommand(gn.id, d) ? (a.syncExecuteCommand(Fe.id, {
|
1082
1082
|
ruleId: o.uid,
|
1083
1083
|
isAdd: !0
|
1084
1084
|
}), !0) : !1;
|
@@ -1098,7 +1098,7 @@ let ut = class extends Re {
|
|
1098
1098
|
this._initCellAlertPopup(), this._initZenService();
|
1099
1099
|
}
|
1100
1100
|
_initCellAlertPopup() {
|
1101
|
-
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(
|
1101
|
+
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(dr(100)).subscribe((e) => {
|
1102
1102
|
var t;
|
1103
1103
|
if (e) {
|
1104
1104
|
const r = this._univerInstanceService.getUnit(e.location.unitId, Y.UNIVER_SHEET), n = r.getSheetBySheetId(e.location.subUnitId);
|
@@ -1160,10 +1160,10 @@ let qe = class extends Re {
|
|
1160
1160
|
// eslint-disable-next-line max-lines-per-function
|
1161
1161
|
_initAutoFill() {
|
1162
1162
|
const e = () => ({ redos: [], undos: [] }), t = (n, i) => {
|
1163
|
-
const { source: o, target: a, unitId: l, subUnitId: s } = n,
|
1163
|
+
const { source: o, target: a, unitId: l, subUnitId: s } = n, d = this._sheetDataValidationModel.getRuleObjectMatrix(l, s).clone(), u = on([o, a]), [h, c] = u.ranges, { mapFunc: m } = u, g = {
|
1164
1164
|
row: h.startRow,
|
1165
1165
|
col: h.startColumn
|
1166
|
-
}, M = Ai(h,
|
1166
|
+
}, M = Ai(h, c), y = new Rt(), p = /* @__PURE__ */ new Set();
|
1167
1167
|
M.forEach((I) => {
|
1168
1168
|
const R = I.repeatStartCell, T = I.relativeRange, N = {
|
1169
1169
|
startRow: g.row,
|
@@ -1198,8 +1198,8 @@ let qe = class extends Re {
|
|
1198
1198
|
});
|
1199
1199
|
});
|
1200
1200
|
const S = Array.from(p).map((I) => ({ id: I, ranges: qt(y, (R) => R === I) }));
|
1201
|
-
|
1202
|
-
const v =
|
1201
|
+
d.addRangeRules(S);
|
1202
|
+
const v = d.diff(this._sheetDataValidationModel.getRules(l, s)), { redoMutations: C, undoMutations: w } = Jt(l, s, v, this._injector, "patched", i === ot.ONLY_FORMAT);
|
1203
1203
|
return {
|
1204
1204
|
undos: w,
|
1205
1205
|
redos: C
|
@@ -1210,8 +1210,8 @@ let qe = class extends Re {
|
|
1210
1210
|
const { source: i, unitId: o, subUnitId: a } = n;
|
1211
1211
|
for (const l of i.rows)
|
1212
1212
|
for (const s of i.cols) {
|
1213
|
-
const
|
1214
|
-
if (
|
1213
|
+
const d = this._sheetDataValidationModel.getRuleByLocation(o, a, l, s);
|
1214
|
+
if (d && d.type === G.CHECKBOX) {
|
1215
1215
|
this._autoFillService.setDisableApplyType(ot.SERIES, !0);
|
1216
1216
|
return;
|
1217
1217
|
}
|
@@ -1245,8 +1245,8 @@ let Je = class extends Re {
|
|
1245
1245
|
id: tr,
|
1246
1246
|
onBeforeCopy: (t, r, n) => this._collect(t, r, n),
|
1247
1247
|
onPasteCells: (t, r, n, i) => {
|
1248
|
-
const { copyType: o = kn.COPY, pasteType: a } = i, { range: l } = t || {}, { range: s, unitId:
|
1249
|
-
return this._generateMutations(s, { copyType: o, pasteType: a, copyRange: l, unitId:
|
1248
|
+
const { copyType: o = kn.COPY, pasteType: a } = i, { range: l } = t || {}, { range: s, unitId: d, subUnitId: u } = r;
|
1249
|
+
return this._generateMutations(s, { copyType: o, pasteType: a, copyRange: l, unitId: d, subUnitId: u });
|
1250
1250
|
}
|
1251
1251
|
});
|
1252
1252
|
}
|
@@ -1261,10 +1261,10 @@ let Je = class extends Re {
|
|
1261
1261
|
if (!o)
|
1262
1262
|
return;
|
1263
1263
|
const { rows: a, cols: l } = o;
|
1264
|
-
a.forEach((s,
|
1264
|
+
a.forEach((s, d) => {
|
1265
1265
|
l.forEach((u, h) => {
|
1266
|
-
const
|
1267
|
-
i.setValue(
|
1266
|
+
const c = this._sheetDataValidationModel.getRuleIdByLocation(t, r, s, u);
|
1267
|
+
i.setValue(d, h, c != null ? c : "");
|
1268
1268
|
});
|
1269
1269
|
});
|
1270
1270
|
}
|
@@ -1285,8 +1285,8 @@ let Je = class extends Re {
|
|
1285
1285
|
return { redos: [], undos: [] };
|
1286
1286
|
const { unitId: i, subUnitId: o } = this._copyInfo;
|
1287
1287
|
if (r.unitId !== i || o !== r.subUnitId) {
|
1288
|
-
const a = this._sheetDataValidationModel.getRuleObjectMatrix(r.unitId, r.subUnitId).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [
|
1289
|
-
|
1288
|
+
const a = this._sheetDataValidationModel.getRuleObjectMatrix(r.unitId, r.subUnitId).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [d, u], mapFunc: h } = on([r.copyRange, t]), c = Nn(d, u, !0), m = /* @__PURE__ */ new Map();
|
1289
|
+
c.forEach(({ startRange: p }) => {
|
1290
1290
|
var S;
|
1291
1291
|
(S = this._copyInfo) == null || S.matrix.forValue((v, C, w) => {
|
1292
1292
|
const I = yt.getPositionRange(
|
@@ -1318,8 +1318,8 @@ let Je = class extends Re {
|
|
1318
1318
|
undos: y
|
1319
1319
|
};
|
1320
1320
|
} else {
|
1321
|
-
const a = this._sheetDataValidationModel.getRuleObjectMatrix(i, o).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [
|
1322
|
-
Nn(
|
1321
|
+
const a = this._sheetDataValidationModel.getRuleObjectMatrix(i, o).clone(), l = new Rt(), s = /* @__PURE__ */ new Set(), { ranges: [d, u], mapFunc: h } = on([r.copyRange, t]);
|
1322
|
+
Nn(d, u, !0).forEach(({ startRange: y }) => {
|
1323
1323
|
var p;
|
1324
1324
|
(p = this._copyInfo) == null || p.matrix.forValue((S, v, C) => {
|
1325
1325
|
const w = yt.getPositionRange(
|
@@ -1412,9 +1412,9 @@ function wo(e) {
|
|
1412
1412
|
};
|
1413
1413
|
}
|
1414
1414
|
const Ro = {
|
1415
|
-
[li.
|
1415
|
+
[li.RULES]: {
|
1416
1416
|
[Er]: {
|
1417
|
-
order:
|
1417
|
+
order: 0,
|
1418
1418
|
menuItemFactory: Co,
|
1419
1419
|
[Fe.id]: {
|
1420
1420
|
order: 0,
|
@@ -1439,8 +1439,8 @@ const Vr = {
|
|
1439
1439
|
}
|
1440
1440
|
};
|
1441
1441
|
let et = class extends un {
|
1442
|
-
constructor(e, t, r, n, i, o, a, l, s,
|
1443
|
-
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 =
|
1442
|
+
constructor(e, t, r, n, i, o, a, l, s, d, u) {
|
1443
|
+
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 = d, this._editorBridgeService = u, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
1444
1444
|
}
|
1445
1445
|
_initMenu() {
|
1446
1446
|
this._menuManagerService.mergeMenu(Ro);
|
@@ -1460,13 +1460,13 @@ let et = class extends un {
|
|
1460
1460
|
const s = this._sheetDataValidationModel.getRuleByLocation(n, i, o, a);
|
1461
1461
|
if (!s)
|
1462
1462
|
return;
|
1463
|
-
const
|
1464
|
-
if (!(
|
1463
|
+
const d = this._dataValidatorRegistryService.getValidatorItem(s.type);
|
1464
|
+
if (!(d != null && d.dropdownType))
|
1465
1465
|
return;
|
1466
1466
|
const u = l.getActiveSheet();
|
1467
1467
|
if (!u) return;
|
1468
|
-
const h = this._dropdownManagerService.activeDropdown,
|
1469
|
-
if (
|
1468
|
+
const h = this._dropdownManagerService.activeDropdown, c = h == null ? void 0 : h.location;
|
1469
|
+
if (c && c.unitId === n && c.subUnitId === i && c.row === o && c.col === a)
|
1470
1470
|
return;
|
1471
1471
|
this._dropdownManagerService.showDropdown(
|
1472
1472
|
{
|
@@ -1497,13 +1497,13 @@ let et = class extends un {
|
|
1497
1497
|
// eslint-disable-next-line max-lines-per-function, complexity
|
1498
1498
|
handler: (e, t, r) => {
|
1499
1499
|
var p, S, v, C, w;
|
1500
|
-
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t,
|
1501
|
-
if (!
|
1500
|
+
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t, d = this._sheetDataValidationModel.getRuleIdByLocation(o, a, n, i);
|
1501
|
+
if (!d)
|
1502
1502
|
return r(e);
|
1503
|
-
const u = this._sheetDataValidationModel.getRuleById(o, a,
|
1503
|
+
const u = this._sheetDataValidationModel.getRuleById(o, a, d);
|
1504
1504
|
if (!u)
|
1505
1505
|
return r(e);
|
1506
|
-
const h = (p = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? p : je.VALID,
|
1506
|
+
const h = (p = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? p : je.VALID, c = this._dataValidatorRegistryService.getValidatorItem(u.type), m = t.rawData;
|
1507
1507
|
let g;
|
1508
1508
|
const M = {
|
1509
1509
|
get value() {
|
@@ -1524,15 +1524,15 @@ let et = class extends un {
|
|
1524
1524
|
},
|
1525
1525
|
customRender: [
|
1526
1526
|
...(S = e == null ? void 0 : e.customRender) != null ? S : [],
|
1527
|
-
...
|
1527
|
+
...c != null && c.canvasRender ? [c.canvasRender] : []
|
1528
1528
|
],
|
1529
1529
|
fontRenderExtension: {
|
1530
1530
|
...e == null ? void 0 : e.fontRenderExtension,
|
1531
|
-
isSkip: ((v = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : v.isSkip) || ((C =
|
1531
|
+
isSkip: ((v = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : v.isSkip) || ((C = c == null ? void 0 : c.skipDefaultFontRender) == null ? void 0 : C.call(c, u, M.value, t))
|
1532
1532
|
},
|
1533
1533
|
interceptorStyle: {
|
1534
1534
|
...e == null ? void 0 : e.interceptorStyle,
|
1535
|
-
...
|
1535
|
+
...c == null ? void 0 : c.getExtraStyle(u, y.value, {
|
1536
1536
|
get style() {
|
1537
1537
|
const I = l.getStyles();
|
1538
1538
|
return (typeof (e == null ? void 0 : e.s) == "string" ? I.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {};
|
@@ -1555,7 +1555,7 @@ let et = class extends un {
|
|
1555
1555
|
workbook: l,
|
1556
1556
|
worksheet: s
|
1557
1557
|
};
|
1558
|
-
return (V = (L =
|
1558
|
+
return (V = (L = c == null ? void 0 : c.canvasRender) == null ? void 0 : L.calcCellAutoHeight) == null ? void 0 : V.call(L, T);
|
1559
1559
|
},
|
1560
1560
|
interceptorAutoWidth: () => {
|
1561
1561
|
var N, D, P, A, L, V;
|
@@ -1573,7 +1573,7 @@ let et = class extends un {
|
|
1573
1573
|
workbook: l,
|
1574
1574
|
worksheet: s
|
1575
1575
|
};
|
1576
|
-
return (V = (L =
|
1576
|
+
return (V = (L = c == null ? void 0 : c.canvasRender) == null ? void 0 : L.calcCellAutoWidth) == null ? void 0 : V.call(L, T);
|
1577
1577
|
},
|
1578
1578
|
coverable: ((w = e == null ? void 0 : e.coverable) != null ? w : !0) && !(u.type === G.LIST || u.type === G.LIST_MULTIPLE)
|
1579
1579
|
});
|
@@ -1587,7 +1587,7 @@ let et = class extends un {
|
|
1587
1587
|
// patched data-validation change don't need to re-calc row height
|
1588
1588
|
// re-calc of row height will be triggered precisely by the origin command
|
1589
1589
|
_n((e) => e.source === "command"),
|
1590
|
-
|
1590
|
+
cr(100)
|
1591
1591
|
).subscribe((e) => {
|
1592
1592
|
if (e.length === 0)
|
1593
1593
|
return;
|
@@ -1604,7 +1604,7 @@ let et = class extends un {
|
|
1604
1604
|
};
|
1605
1605
|
et = Dr([
|
1606
1606
|
K(0, J),
|
1607
|
-
K(1,
|
1607
|
+
K(1, di),
|
1608
1608
|
K(2, Ne),
|
1609
1609
|
K(3, le),
|
1610
1610
|
K(4, b(fr)),
|
@@ -1630,13 +1630,13 @@ let xn = class extends un {
|
|
1630
1630
|
// eslint-disable-next-line complexity
|
1631
1631
|
handler: (e, t, r) => {
|
1632
1632
|
var y, p, S, v, C;
|
1633
|
-
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t,
|
1634
|
-
if (!
|
1633
|
+
const { row: n, col: i, unitId: o, subUnitId: a, workbook: l, worksheet: s } = t, d = this._sheetDataValidationModel.getRuleIdByLocation(o, a, n, i);
|
1634
|
+
if (!d)
|
1635
1635
|
return r(e);
|
1636
|
-
const u = this._sheetDataValidationModel.getRuleById(o, a,
|
1636
|
+
const u = this._sheetDataValidationModel.getRuleById(o, a, d);
|
1637
1637
|
if (!u)
|
1638
1638
|
return r(e);
|
1639
|
-
const h = (y = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? y : je.VALID,
|
1639
|
+
const h = (y = this._dataValidationCacheService.getValue(o, a, n, i)) != null ? y : je.VALID, c = this._dataValidatorRegistryService.getValidatorItem(u.type), m = s.getCellRaw(n, i), g = Q(m), M = `${g != null ? g : ""}`;
|
1640
1640
|
return r({
|
1641
1641
|
...e,
|
1642
1642
|
markers: {
|
@@ -1645,15 +1645,15 @@ let xn = class extends un {
|
|
1645
1645
|
},
|
1646
1646
|
customRender: [
|
1647
1647
|
...(p = e == null ? void 0 : e.customRender) != null ? p : [],
|
1648
|
-
...
|
1648
|
+
...c != null && c.canvasRender ? [c.canvasRender] : []
|
1649
1649
|
],
|
1650
1650
|
fontRenderExtension: {
|
1651
1651
|
...e == null ? void 0 : e.fontRenderExtension,
|
1652
|
-
isSkip: ((S = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : S.isSkip) || ((v =
|
1652
|
+
isSkip: ((S = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : S.isSkip) || ((v = c == null ? void 0 : c.skipDefaultFontRender) == null ? void 0 : v.call(c, u, g, t))
|
1653
1653
|
},
|
1654
1654
|
interceptorStyle: {
|
1655
1655
|
...e == null ? void 0 : e.interceptorStyle,
|
1656
|
-
...
|
1656
|
+
...c == null ? void 0 : c.getExtraStyle(u, M, {
|
1657
1657
|
get style() {
|
1658
1658
|
const w = l.getStyles();
|
1659
1659
|
return (typeof (e == null ? void 0 : e.s) == "string" ? w.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {};
|
@@ -1676,7 +1676,7 @@ let xn = class extends un {
|
|
1676
1676
|
workbook: l,
|
1677
1677
|
worksheet: s
|
1678
1678
|
};
|
1679
|
-
return (L = (A =
|
1679
|
+
return (L = (A = c == null ? void 0 : c.canvasRender) == null ? void 0 : A.calcCellAutoHeight) == null ? void 0 : L.call(A, R);
|
1680
1680
|
},
|
1681
1681
|
coverable: ((C = e == null ? void 0 : e.coverable) != null ? C : !0) && !(u.type === G.LIST || u.type === G.LIST_MULTIPLE)
|
1682
1682
|
});
|
@@ -1688,7 +1688,7 @@ let xn = class extends un {
|
|
1688
1688
|
_initAutoHeight() {
|
1689
1689
|
this._sheetDataValidationModel.ruleChange$.pipe(
|
1690
1690
|
_n((e) => e.source === "command"),
|
1691
|
-
|
1691
|
+
cr(16)
|
1692
1692
|
).subscribe((e) => {
|
1693
1693
|
const t = [];
|
1694
1694
|
if (e.forEach((r) => {
|
@@ -1740,13 +1740,13 @@ Vt = bo([
|
|
1740
1740
|
$n(2, b(bt))
|
1741
1741
|
], Vt);
|
1742
1742
|
function Eo(e) {
|
1743
|
-
var
|
1743
|
+
var d;
|
1744
1744
|
const t = U(se), r = U(mn), { value: n, onChange: i, extraComponent: o } = e, [a, l] = H(!1), s = o ? r.get(o) : null;
|
1745
|
-
return /* @__PURE__ */ W(
|
1745
|
+
return /* @__PURE__ */ W(dt, { children: [
|
1746
1746
|
/* @__PURE__ */ W(
|
1747
1747
|
"div",
|
1748
1748
|
{
|
1749
|
-
className: "univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-gray-900 dark
|
1749
|
+
className: "univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-gray-900 dark:!univer-text-white",
|
1750
1750
|
onClick: () => l(!a),
|
1751
1751
|
children: [
|
1752
1752
|
t.t("dataValidation.panel.options"),
|
@@ -1754,7 +1754,7 @@ function Eo(e) {
|
|
1754
1754
|
]
|
1755
1755
|
}
|
1756
1756
|
),
|
1757
|
-
a && /* @__PURE__ */ W(
|
1757
|
+
a && /* @__PURE__ */ W(dt, { children: [
|
1758
1758
|
s ? /* @__PURE__ */ _(s, { value: n, onChange: i }) : null,
|
1759
1759
|
/* @__PURE__ */ _(
|
1760
1760
|
j,
|
@@ -1763,7 +1763,7 @@ function Eo(e) {
|
|
1763
1763
|
children: /* @__PURE__ */ W(
|
1764
1764
|
pn,
|
1765
1765
|
{
|
1766
|
-
value: `${(
|
1766
|
+
value: `${(d = n.errorStyle) != null ? d : lt.WARNING}`,
|
1767
1767
|
onChange: (u) => i({ ...n, errorStyle: +u }),
|
1768
1768
|
children: [
|
1769
1769
|
/* @__PURE__ */ _(Oe, { value: `${lt.WARNING}`, children: t.t("dataValidation.panel.showWarning") }),
|
@@ -1807,18 +1807,18 @@ function Vo(e, t, r) {
|
|
1807
1807
|
}
|
1808
1808
|
function Oo() {
|
1809
1809
|
var O, B;
|
1810
|
-
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),
|
1810
|
+
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), d = U(le), u = U(mn), h = U(J), c = 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 = ct(() => Do(h), [h]), [R, T] = H(!1), [N, D] = H(!1), P = ht(null), A = U(hr);
|
1811
1811
|
if (Pe(() => () => {
|
1812
1812
|
const f = A.getCurrentLastSelection();
|
1813
1813
|
f && A.setSelections([f]);
|
1814
1814
|
}, [A]), Pe(() => {
|
1815
1815
|
h.onCommandExecuted((f) => {
|
1816
1816
|
(f.id === Wr.id || f.id === jr.id) && setTimeout(() => {
|
1817
|
-
const k =
|
1817
|
+
const k = c.getRuleById(i, o, l);
|
1818
1818
|
t(($) => $ + 1), k && (M(k), w(k.ranges.map(($) => ({ unitId: "", sheetId: "", range: $ }))));
|
1819
1819
|
}, 20);
|
1820
1820
|
});
|
1821
|
-
}, [h,
|
1821
|
+
}, [h, c, l, o, i]), !y)
|
1822
1822
|
return null;
|
1823
1823
|
const L = y.operators, V = y.operatorNames, F = g.operator ? hi.includes(g.operator) : !1, x = () => {
|
1824
1824
|
var f, k, $;
|
@@ -1827,7 +1827,7 @@ function Oo() {
|
|
1827
1827
|
const k = f.split(",").filter(Boolean).map(Ui).map((q) => {
|
1828
1828
|
const yn = q.sheetName;
|
1829
1829
|
if (yn) {
|
1830
|
-
const Ar = Vo(
|
1830
|
+
const Ar = Vo(d, q.unitId, yn);
|
1831
1831
|
return { ...q, sheetId: Ar };
|
1832
1832
|
}
|
1833
1833
|
return {
|
@@ -1885,7 +1885,7 @@ function Oo() {
|
|
1885
1885
|
const k = s.getValidatorItem(f);
|
1886
1886
|
if (!k)
|
1887
1887
|
return;
|
1888
|
-
const $ = k.operators, Ce =
|
1888
|
+
const $ = k.operators, Ce = c.getRuleById(i, o, l), q = f === (Ce == null ? void 0 : Ce.type) || f.includes("list") && (Ce != null && Ce.type.includes("list")) ? {
|
1889
1889
|
...Ce,
|
1890
1890
|
type: f
|
1891
1891
|
} : {
|
@@ -1901,7 +1901,7 @@ function Oo() {
|
|
1901
1901
|
ruleId: g.uid,
|
1902
1902
|
setting: Pn(q)
|
1903
1903
|
});
|
1904
|
-
},
|
1904
|
+
}, de = u.get(y.formulaInput), ne = ct(() => C.map((f) => _r(f.range)).join(","), []), ce = Tn(g), Se = (f) => {
|
1905
1905
|
bn(f, Tn(g)) || (M({
|
1906
1906
|
...g,
|
1907
1907
|
...f
|
@@ -1915,14 +1915,14 @@ function Oo() {
|
|
1915
1915
|
}
|
1916
1916
|
));
|
1917
1917
|
}, ve = L.length && !g.operator;
|
1918
|
-
return /* @__PURE__ */ W("div", {
|
1918
|
+
return /* @__PURE__ */ W("div", { "data-u-comp": "data-validation-detail", children: [
|
1919
1919
|
/* @__PURE__ */ _(
|
1920
1920
|
j,
|
1921
1921
|
{
|
1922
1922
|
label: m.t("dataValidation.panel.range"),
|
1923
1923
|
error: !g.ranges.length || R ? m.t("dataValidation.panel.rangeError") : "",
|
1924
1924
|
children: /* @__PURE__ */ _(
|
1925
|
-
|
1925
|
+
ci,
|
1926
1926
|
{
|
1927
1927
|
selectorRef: P,
|
1928
1928
|
unitId: i,
|
@@ -1976,8 +1976,8 @@ function Oo() {
|
|
1976
1976
|
}
|
1977
1977
|
}
|
1978
1978
|
) }) : null,
|
1979
|
-
|
1980
|
-
|
1979
|
+
de && !ve ? /* @__PURE__ */ _(
|
1980
|
+
de,
|
1981
1981
|
{
|
1982
1982
|
isTwoFormula: F,
|
1983
1983
|
value: {
|
@@ -2012,7 +2012,7 @@ function Oo() {
|
|
2012
2012
|
children: m.t("dataValidation.panel.allowBlank")
|
2013
2013
|
}
|
2014
2014
|
) }),
|
2015
|
-
/* @__PURE__ */ _(Eo, { value:
|
2015
|
+
/* @__PURE__ */ _(Eo, { value: ce, onChange: Se, extraComponent: y.optionsInput }),
|
2016
2016
|
/* @__PURE__ */ W("div", { className: "univer-mt-5 univer-flex univer-flex-row univer-justify-end", children: [
|
2017
2017
|
/* @__PURE__ */ _(ze, { className: "univer-ml-3", onClick: z, children: m.t("dataValidation.panel.removeRule") }),
|
2018
2018
|
/* @__PURE__ */ _(ze, { className: "univer-ml-3", variant: "primary", onClick: x, children: m.t("dataValidation.panel.done") })
|
@@ -2020,7 +2020,7 @@ function Oo() {
|
|
2020
2020
|
] });
|
2021
2021
|
}
|
2022
2022
|
const To = (e) => {
|
2023
|
-
const { rule: t, onClick: r, unitId: n, subUnitId: i, disable: o } = e, a = U(ye), l = U(J), s = U(Ni),
|
2023
|
+
const { rule: t, onClick: r, unitId: n, subUnitId: i, disable: o } = e, a = U(ye), l = U(J), s = U(Ni), d = a.getValidatorItem(t.type), u = ht(void 0), [h, c] = H(!1), m = U(Kn), g = Te(m.currentTheme$), M = ct(() => {
|
2024
2024
|
var w;
|
2025
2025
|
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();
|
2026
2026
|
return {
|
@@ -2049,13 +2049,13 @@ const To = (e) => {
|
|
2049
2049
|
univer-overflow-hidden univer-p-2 univer-pr-9
|
2050
2050
|
`,
|
2051
2051
|
{
|
2052
|
-
"hover:univer-bg-gray-50": !o,
|
2052
|
+
"dark:hover:!univer-bg-gray-700 hover:univer-bg-gray-50": !o,
|
2053
2053
|
"univer-opacity-50": o
|
2054
2054
|
}
|
2055
2055
|
),
|
2056
2056
|
onClick: r,
|
2057
2057
|
onMouseEnter: () => {
|
2058
|
-
o || (
|
2058
|
+
o || (c(!0), u.current = t.ranges.map((p) => s.addShape({
|
2059
2059
|
range: p,
|
2060
2060
|
style: M,
|
2061
2061
|
primary: null
|
@@ -2063,7 +2063,7 @@ const To = (e) => {
|
|
2063
2063
|
},
|
2064
2064
|
onMouseLeave: () => {
|
2065
2065
|
var p;
|
2066
|
-
|
2066
|
+
c(!1), (p = u.current) == null || p.forEach((S) => {
|
2067
2067
|
S && s.removeShape(S);
|
2068
2068
|
}), u.current = void 0;
|
2069
2069
|
},
|
@@ -2071,21 +2071,21 @@ const To = (e) => {
|
|
2071
2071
|
/* @__PURE__ */ _(
|
2072
2072
|
"div",
|
2073
2073
|
{
|
2074
|
-
className: "univer-truncate univer-text-sm univer-font-medium univer-leading-[22px] univer-text-gray-900 dark
|
2075
|
-
children:
|
2074
|
+
className: "univer-truncate univer-text-sm univer-font-medium univer-leading-[22px] univer-text-gray-900 dark:!univer-text-white",
|
2075
|
+
children: d == null ? void 0 : d.generateRuleName(t)
|
2076
2076
|
}
|
2077
2077
|
),
|
2078
2078
|
/* @__PURE__ */ _(
|
2079
2079
|
"div",
|
2080
2080
|
{
|
2081
|
-
className: "univer-text-secondary univer-truncate univer-text-xs univer-leading-[18px]",
|
2081
|
+
className: "univer-text-secondary univer-truncate univer-text-xs univer-leading-[18px] dark:!univer-text-gray-300",
|
2082
2082
|
children: t.ranges.map((p) => _r(p)).join(",")
|
2083
2083
|
}
|
2084
2084
|
),
|
2085
2085
|
h ? /* @__PURE__ */ _(
|
2086
2086
|
"div",
|
2087
2087
|
{
|
2088
|
-
className: "univer-absolute univer-right-2 univer-top-[19px] univer-flex univer-h-5 univer-w-5 univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-200",
|
2088
|
+
className: "univer-absolute univer-right-2 univer-top-[19px] univer-flex univer-h-5 univer-w-5 univer-items-center univer-justify-center univer-rounded dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-700 hover:univer-bg-gray-200",
|
2089
2089
|
onClick: y,
|
2090
2090
|
children: /* @__PURE__ */ _(Cn, {})
|
2091
2091
|
}
|
@@ -2095,31 +2095,31 @@ const To = (e) => {
|
|
2095
2095
|
);
|
2096
2096
|
};
|
2097
2097
|
function Po(e) {
|
2098
|
-
const t = U(ee), r = U(le), n = U(J), i = U(we), o = U(_e), a = U(se), [l, s] = H([]), { workbook:
|
2098
|
+
const t = U(ee), r = U(le), n = U(J), i = U(we), o = U(_e), a = U(se), [l, s] = H([]), { workbook: d } = e, u = Te(d.activeSheet$, void 0, !0), h = d.getUnitId(), c = u == null ? void 0 : u.getSheetId();
|
2099
2099
|
Pe(() => {
|
2100
|
-
s(t.getRules(h,
|
2100
|
+
s(t.getRules(h, c));
|
2101
2101
|
const S = t.ruleChange$.subscribe((v) => {
|
2102
|
-
v.unitId === h && v.subUnitId ===
|
2102
|
+
v.unitId === h && v.subUnitId === c && s(t.getRules(h, c));
|
2103
2103
|
});
|
2104
2104
|
return () => {
|
2105
2105
|
S.unsubscribe();
|
2106
2106
|
};
|
2107
|
-
}, [h,
|
2107
|
+
}, [h, c, t]);
|
2108
2108
|
const m = async () => {
|
2109
2109
|
const S = er(i), v = {
|
2110
2110
|
unitId: h,
|
2111
|
-
subUnitId:
|
2111
|
+
subUnitId: c,
|
2112
2112
|
rule: S
|
2113
2113
|
};
|
2114
2114
|
await n.executeCommand(gn.id, v), o.setActiveRule({
|
2115
2115
|
unitId: h,
|
2116
|
-
subUnitId:
|
2116
|
+
subUnitId: c,
|
2117
2117
|
rule: S
|
2118
2118
|
});
|
2119
2119
|
}, g = () => {
|
2120
2120
|
n.executeCommand(Qr.id, {
|
2121
2121
|
unitId: h,
|
2122
|
-
subUnitId:
|
2122
|
+
subUnitId: c
|
2123
2123
|
});
|
2124
2124
|
}, y = ((S) => {
|
2125
2125
|
const v = r.getCurrentUnitForType(Y.UNIVER_SHEET), C = v.getActiveSheet(), w = v.getUnitId(), I = C.getSheetId();
|
@@ -2132,11 +2132,11 @@ function Po(e) {
|
|
2132
2132
|
To,
|
2133
2133
|
{
|
2134
2134
|
unitId: h,
|
2135
|
-
subUnitId:
|
2135
|
+
subUnitId: c,
|
2136
2136
|
onClick: () => {
|
2137
2137
|
S.disable || o.setActiveRule({
|
2138
2138
|
unitId: h,
|
2139
|
-
subUnitId:
|
2139
|
+
subUnitId: c,
|
2140
2140
|
rule: S
|
2141
2141
|
});
|
2142
2142
|
},
|
@@ -2207,8 +2207,8 @@ let an = class {
|
|
2207
2207
|
this._commandService = e, this._univerInstanceService = t, this._formulaService = r, this._themeService = n, this._renderManagerService = i, this._dataValidationModel = o;
|
2208
2208
|
}
|
2209
2209
|
_calc(e, t) {
|
2210
|
-
var
|
2211
|
-
const { vt: r, ht: n } = t || {}, i = e.endX - e.startX - ft * 2, o = e.endY - e.startY, a = ((
|
2210
|
+
var d, u, h;
|
2211
|
+
const { vt: r, ht: n } = t || {}, i = e.endX - e.startX - ft * 2, o = e.endY - e.startY, a = ((d = t == null ? void 0 : t.fs) != null ? d : 10) * 1.6;
|
2212
2212
|
let l = 0, s = 0;
|
2213
2213
|
switch (r) {
|
2214
2214
|
case ae.TOP:
|
@@ -2250,8 +2250,8 @@ let an = class {
|
|
2250
2250
|
return ((r = t == null ? void 0 : t.fs) != null ? r : 10) * 1.6;
|
2251
2251
|
}
|
2252
2252
|
async _parseFormula(e, t, r) {
|
2253
|
-
var
|
2254
|
-
const { formula1: n = ni, formula2: i = ti } = e, o = await this._formulaService.getRuleFormulaResult(t, r, e.uid), a = Ft((h = (u = (
|
2253
|
+
var d, u, h, c, m, g, M, y, p;
|
2254
|
+
const { formula1: n = ni, formula2: i = ti } = e, o = await this._formulaService.getRuleFormulaResult(t, r, e.uid), a = Ft((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 = Ft((g = (m = (c = o == null ? void 0 : o[1]) == null ? void 0 : c.result) == null ? void 0 : m[0]) == null ? void 0 : g[0]), s = Dn(String(a)) && Dn(String(l));
|
2255
2255
|
return {
|
2256
2256
|
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,
|
2257
2257
|
formula2: De(i) ? l : i,
|
@@ -2260,13 +2260,13 @@ let an = class {
|
|
2260
2260
|
}
|
2261
2261
|
drawWith(e, t) {
|
2262
2262
|
var P, A, L, V;
|
2263
|
-
const { style: r, primaryWithCoord: n, unitId: i, subUnitId: o, worksheet: a, row: l, col: s } = t,
|
2263
|
+
const { style: r, primaryWithCoord: n, unitId: i, subUnitId: o, worksheet: a, row: l, col: s } = t, d = n.isMergedMainCell ? n.mergeInfo : n, u = Q(a.getCellRaw(l, s)), h = this._dataValidationModel.getRuleByLocation(i, o, l, s);
|
2264
2264
|
if (!h)
|
2265
2265
|
return;
|
2266
|
-
const
|
2267
|
-
if (!
|
2266
|
+
const c = this._dataValidationModel.getValidator(h.type);
|
2267
|
+
if (!c || !((P = c.skipDefaultFontRender) != null && P.call(c, h, u, { unitId: i, subUnitId: o, row: l, column: s })))
|
2268
2268
|
return;
|
2269
|
-
const m =
|
2269
|
+
const m = c.parseFormulaSync(h, i, o), { formula1: g } = m, M = this._calc(d, r), { a: y, d: p } = e.getTransform(), S = Ln(M.left, y), v = Ln(M.top, p), C = mi.create().composeMatrix({
|
2270
2270
|
left: S,
|
2271
2271
|
top: v,
|
2272
2272
|
scaleX: 1,
|
@@ -2276,8 +2276,8 @@ let an = class {
|
|
2276
2276
|
skewY: 0,
|
2277
2277
|
flipX: !1,
|
2278
2278
|
flipY: !1
|
2279
|
-
}), w =
|
2280
|
-
e.save(), e.beginPath(), e.rect(
|
2279
|
+
}), w = d.endX - d.startX, I = d.endY - d.startY;
|
2280
|
+
e.save(), e.beginPath(), e.rect(d.startX, d.startY, w, I), e.clip();
|
2281
2281
|
const R = C.getMatrix();
|
2282
2282
|
e.transform(R[0], R[1], R[2], R[3], R[4], R[5]);
|
2283
2283
|
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");
|
@@ -2289,20 +2289,20 @@ let an = class {
|
|
2289
2289
|
}), e.restore();
|
2290
2290
|
}
|
2291
2291
|
isHit(e, t) {
|
2292
|
-
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:
|
2293
|
-
return s <= l && s >= a &&
|
2292
|
+
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: d } = e;
|
2293
|
+
return s <= l && s >= a && d <= o && d >= i;
|
2294
2294
|
}
|
2295
2295
|
async onPointerDown(e, t) {
|
2296
2296
|
var g;
|
2297
2297
|
if (t.button === 2)
|
2298
2298
|
return;
|
2299
|
-
const { primaryWithCoord: r, unitId: n, subUnitId: i, worksheet: o, row: a, col: l } = e, s = Q(o.getCellRaw(a, l)),
|
2300
|
-
if (!
|
2299
|
+
const { primaryWithCoord: r, unitId: n, subUnitId: i, worksheet: o, row: a, col: l } = e, s = Q(o.getCellRaw(a, l)), d = this._dataValidationModel.getRuleByLocation(n, i, a, l);
|
2300
|
+
if (!d)
|
2301
2301
|
return;
|
2302
|
-
const u = this._dataValidationModel.getValidator(
|
2303
|
-
if (!u || !((g = u.skipDefaultFontRender) != null && g.call(u,
|
2302
|
+
const u = this._dataValidationModel.getValidator(d.type);
|
2303
|
+
if (!u || !((g = u.skipDefaultFontRender) != null && g.call(u, d, s, { unitId: n, subUnitId: i, row: a, column: l })))
|
2304
2304
|
return;
|
2305
|
-
const { formula1: h, formula2:
|
2305
|
+
const { formula1: h, formula2: c } = await this._parseFormula(d, n, i), m = {
|
2306
2306
|
range: {
|
2307
2307
|
startColumn: r.actualColumn,
|
2308
2308
|
endColumn: r.actualColumn,
|
@@ -2310,7 +2310,7 @@ let an = class {
|
|
2310
2310
|
endRow: r.actualRow
|
2311
2311
|
},
|
2312
2312
|
value: {
|
2313
|
-
v: String(s) === ri(String(h)) ?
|
2313
|
+
v: String(s) === ri(String(h)) ? c : h,
|
2314
2314
|
p: null
|
2315
2315
|
}
|
2316
2316
|
};
|
@@ -2378,31 +2378,31 @@ function jo(e, t) {
|
|
2378
2378
|
};
|
2379
2379
|
}
|
2380
2380
|
function Yt(e, t, r, n) {
|
2381
|
-
const i = Ee + sn * 2, o = r - i, a = n - Pt * 2, l = e.map((
|
2382
|
-
layout: jo(
|
2383
|
-
text:
|
2381
|
+
const i = Ee + sn * 2, o = r - i, a = n - Pt * 2, l = e.map((c) => ({
|
2382
|
+
layout: jo(c, t),
|
2383
|
+
text: c
|
2384
2384
|
}));
|
2385
2385
|
let s;
|
2386
|
-
const
|
2387
|
-
l.forEach((
|
2388
|
-
const { layout: m } =
|
2386
|
+
const d = [];
|
2387
|
+
l.forEach((c) => {
|
2388
|
+
const { layout: m } = c, { width: g, height: M } = m;
|
2389
2389
|
!s || s.width + g + jt > o ? (s = {
|
2390
2390
|
width: g,
|
2391
2391
|
height: M,
|
2392
2392
|
items: [{
|
2393
|
-
...
|
2393
|
+
...c,
|
2394
2394
|
left: 0
|
2395
2395
|
}]
|
2396
|
-
},
|
2397
|
-
...
|
2396
|
+
}, d.push(s)) : (s.items.push({
|
2397
|
+
...c,
|
2398
2398
|
left: s.width + jt
|
2399
2399
|
}), s.width = s.width + g + jt);
|
2400
2400
|
});
|
2401
2401
|
let u = 0, h = 0;
|
2402
|
-
return
|
2403
|
-
h = Math.max(h,
|
2402
|
+
return d.forEach((c, m) => {
|
2403
|
+
h = Math.max(h, c.width), m === d.length - 1 ? u += c.height : u += c.height + Tr;
|
2404
2404
|
}), {
|
2405
|
-
lines:
|
2405
|
+
lines: d,
|
2406
2406
|
totalHeight: u,
|
2407
2407
|
contentWidth: o,
|
2408
2408
|
contentHeight: a,
|
@@ -2457,14 +2457,14 @@ let ln = class {
|
|
2457
2457
|
// eslint-disable-next-line max-lines-per-function
|
2458
2458
|
drawWith(e, t, r, n) {
|
2459
2459
|
var Z, z;
|
2460
|
-
const { primaryWithCoord: i, row: o, col: a, style: l, data: s, subUnitId:
|
2460
|
+
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: g = 0, downOffset: M = 0 } = h || {}, y = this._ensureMap(d), p = this._generateKey(o, a), S = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, o, a);
|
2461
2461
|
if (!S)
|
2462
2462
|
return;
|
2463
2463
|
const v = this._dataValidationModel.getValidator(S.type);
|
2464
2464
|
if (!v)
|
2465
2465
|
return;
|
2466
2466
|
const C = {
|
2467
|
-
startX: u.startX +
|
2467
|
+
startX: u.startX + c,
|
2468
2468
|
endX: u.endX - m,
|
2469
2469
|
startY: u.startY + g,
|
2470
2470
|
endY: u.endY - M
|
@@ -2481,17 +2481,17 @@ let ln = class {
|
|
2481
2481
|
}
|
2482
2482
|
e.translateWithPrecision(0, X), x.lines.forEach((te, pe) => {
|
2483
2483
|
e.save();
|
2484
|
-
const { width:
|
2484
|
+
const { width: de, height: ne, items: ce } = te;
|
2485
2485
|
let Se = 0;
|
2486
2486
|
switch (P) {
|
2487
2487
|
case Ye.RIGHT:
|
2488
|
-
Se = x.contentWidth -
|
2488
|
+
Se = x.contentWidth - de;
|
2489
2489
|
break;
|
2490
2490
|
case Ye.CENTER:
|
2491
|
-
Se = (x.contentWidth -
|
2491
|
+
Se = (x.contentWidth - de) / 2;
|
2492
2492
|
break;
|
2493
2493
|
}
|
2494
|
-
e.translate(Se, pe * (ne + Tr)),
|
2494
|
+
e.translate(Se, pe * (ne + Tr)), ce.forEach((ve) => {
|
2495
2495
|
e.save(), e.translateWithPrecision(ve.left, 0), Xo.drawWith(e, {
|
2496
2496
|
...N,
|
2497
2497
|
info: ve,
|
@@ -2508,10 +2508,10 @@ let ln = class {
|
|
2508
2508
|
}
|
2509
2509
|
calcCellAutoHeight(e) {
|
2510
2510
|
var w;
|
2511
|
-
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:
|
2511
|
+
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: d = 0, downOffset: u = 0 } = a || {}, h = t.isMergedMainCell ? t.mergeInfo : t, c = {
|
2512
2512
|
startX: h.startX + l,
|
2513
2513
|
endX: h.endX - s,
|
2514
|
-
startY: h.startY +
|
2514
|
+
startY: h.startY + d,
|
2515
2515
|
endY: h.endY - u
|
2516
2516
|
}, m = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2517
2517
|
if (!m)
|
@@ -2519,15 +2519,15 @@ let ln = class {
|
|
2519
2519
|
const g = this._dataValidationModel.getValidator(m.type);
|
2520
2520
|
if (!g)
|
2521
2521
|
return;
|
2522
|
-
const M =
|
2522
|
+
const M = c.endX - c.startX, y = c.endY - c.startY, p = (w = Q(n)) != null ? w : "", S = g.parseCellValue(p), v = xt(r != null ? r : void 0);
|
2523
2523
|
return Yt(S, v, M, y).cellAutoHeight;
|
2524
2524
|
}
|
2525
2525
|
calcCellAutoWidth(e) {
|
2526
2526
|
var w;
|
2527
|
-
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:
|
2527
|
+
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: d = 0, downOffset: u = 0 } = a || {}, h = t.isMergedMainCell ? t.mergeInfo : t, c = {
|
2528
2528
|
startX: h.startX + l,
|
2529
2529
|
endX: h.endX - s,
|
2530
|
-
startY: h.startY +
|
2530
|
+
startY: h.startY + d,
|
2531
2531
|
endY: h.endY - u
|
2532
2532
|
}, m = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2533
2533
|
if (!m)
|
@@ -2535,7 +2535,7 @@ let ln = class {
|
|
2535
2535
|
const g = this._dataValidationModel.getValidator(m.type);
|
2536
2536
|
if (!g)
|
2537
2537
|
return;
|
2538
|
-
const M =
|
2538
|
+
const M = c.endX - c.startX, y = c.endY - c.startY, p = (w = Q(n)) != null ? w : "", S = g.parseCellValue(p), v = xt(r != null ? r : void 0);
|
2539
2539
|
return Yt(S, v, M, y).calcAutoWidth;
|
2540
2540
|
}
|
2541
2541
|
isHit(e, t) {
|
@@ -2661,21 +2661,21 @@ function Hn(e, t, r, n, i, o, a = !0) {
|
|
2661
2661
|
break;
|
2662
2662
|
}
|
2663
2663
|
l = Math.max(We, l);
|
2664
|
-
let
|
2664
|
+
let d = 0;
|
2665
2665
|
switch (o) {
|
2666
2666
|
case Ye.CENTER:
|
2667
|
-
|
2667
|
+
d = (e - r) / 2;
|
2668
2668
|
break;
|
2669
2669
|
case Ye.RIGHT:
|
2670
|
-
|
2670
|
+
d = e - r;
|
2671
2671
|
break;
|
2672
2672
|
}
|
2673
|
-
return
|
2674
|
-
paddingLeft:
|
2673
|
+
return d = Math.max(me, d), {
|
2674
|
+
paddingLeft: d,
|
2675
2675
|
paddingTop: l
|
2676
2676
|
};
|
2677
2677
|
}
|
2678
|
-
let
|
2678
|
+
let dn = class {
|
2679
2679
|
constructor(e, t, r, n, i) {
|
2680
2680
|
E(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
2681
2681
|
E(this, "zIndex");
|
@@ -2689,7 +2689,7 @@ let cn = class {
|
|
2689
2689
|
return `${e}.${t}`;
|
2690
2690
|
}
|
2691
2691
|
_drawDownIcon(e, t, r, n, i, o, a) {
|
2692
|
-
const { t: l = re.pd.t, b: s = re.pd.b } = a,
|
2692
|
+
const { t: l = re.pd.t, b: s = re.pd.b } = a, d = r - he;
|
2693
2693
|
let u;
|
2694
2694
|
switch (o) {
|
2695
2695
|
case ae.MIDDLE:
|
@@ -2702,30 +2702,30 @@ let cn = class {
|
|
2702
2702
|
u = l + We + (i / 2 - St / 2);
|
2703
2703
|
break;
|
2704
2704
|
}
|
2705
|
-
e.save(), e.translateWithPrecision(t.startX +
|
2705
|
+
e.save(), e.translateWithPrecision(t.startX + d, t.startY + u), e.fillStyle = "#565656", e.fill(Bn), e.restore();
|
2706
2706
|
}
|
2707
2707
|
// eslint-disable-next-line max-lines-per-function, complexity
|
2708
2708
|
drawWith(e, t, r) {
|
2709
|
-
const { primaryWithCoord: n, row: i, col: o, style: a, data: l, subUnitId: s } = t,
|
2709
|
+
const { primaryWithCoord: n, row: i, col: o, style: a, data: l, subUnitId: s } = t, d = n.isMergedMainCell ? n.mergeInfo : n, u = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, i, o);
|
2710
2710
|
if (!u)
|
2711
2711
|
return;
|
2712
2712
|
const h = this._dataValidationModel.getValidator(u.type);
|
2713
2713
|
if (!h)
|
2714
2714
|
return;
|
2715
|
-
const
|
2715
|
+
const c = l == null ? void 0 : l.fontRenderExtension, { leftOffset: m = 0, rightOffset: g = 0, topOffset: M = 0, downOffset: y = 0 } = c || {};
|
2716
2716
|
if (!u || !h || !h || h.id.indexOf(G.LIST) !== 0 || !h.skipDefaultFontRender(u))
|
2717
2717
|
return;
|
2718
2718
|
const p = {
|
2719
|
-
startX:
|
2720
|
-
endX:
|
2721
|
-
startY:
|
2722
|
-
endY:
|
2719
|
+
startX: d.startX + m,
|
2720
|
+
endX: d.endX - g,
|
2721
|
+
startY: d.startY + M,
|
2722
|
+
endY: d.endY - y
|
2723
2723
|
}, 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);
|
2724
2724
|
let { tb: D, vt: P, ht: A, pd: L } = a || {};
|
2725
2725
|
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) {
|
2726
2726
|
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);
|
2727
2727
|
D === Ie.WRAP && pe.updateDocumentDataPageSize(Math.max(Z, 1)), z.calculate(), z.getActualSize();
|
2728
|
-
const
|
2728
|
+
const de = it(z), { height: ne, width: ce } = de, { paddingTop: Se, paddingLeft: ve } = Hn(Z, v - F - X, ce, ne, P, A, !0);
|
2729
2729
|
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, {
|
2730
2730
|
left: p.endX + V + r.rowHeaderWidth - he,
|
2731
2731
|
top: p.startY + F + r.columnHeaderHeight,
|
@@ -2736,35 +2736,35 @@ let cn = class {
|
|
2736
2736
|
e.save(), e.translateWithPrecision(p.startX, p.startY), e.beginPath(), e.rect(0, 0, S, v), e.clip();
|
2737
2737
|
const V = S - me * 2 - be - he - 4, { documentSkeleton: F, documents: x, docModel: X } = Ct(T, this._localeService, a);
|
2738
2738
|
D === Ie.WRAP && X.updateDocumentDataPageSize(Math.max(V, 1)), F.calculate();
|
2739
|
-
const Z = it(F), { height: z, width: te } = Z, { paddingTop: pe, paddingLeft:
|
2739
|
+
const Z = it(F), { height: z, width: te } = Z, { paddingTop: pe, paddingLeft: de } = Hn(V, v, te, z, P, A);
|
2740
2740
|
e.translateWithPrecision(me, pe);
|
2741
|
-
const ne = Math.max(S - me * 2, 1),
|
2741
|
+
const ne = Math.max(S - me * 2, 1), ce = z;
|
2742
2742
|
ur.drawWith(e, {
|
2743
2743
|
width: ne,
|
2744
|
-
height:
|
2744
|
+
height: ce,
|
2745
2745
|
fill: (N == null ? void 0 : N.color) || He,
|
2746
2746
|
radius: Xt
|
2747
|
-
}), e.save(), e.translateWithPrecision(be, 0), e.beginPath(), e.rect(0, 0, V, z), e.clip(), e.translateWithPrecision(
|
2747
|
+
}), e.save(), e.translateWithPrecision(be, 0), e.beginPath(), e.rect(0, 0, V, z), e.clip(), e.translateWithPrecision(de, 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, {
|
2748
2748
|
left: p.startX + me + r.rowHeaderWidth,
|
2749
2749
|
top: p.startY + pe + r.columnHeaderHeight,
|
2750
2750
|
width: ne,
|
2751
|
-
height:
|
2751
|
+
height: ce
|
2752
2752
|
});
|
2753
2753
|
}
|
2754
2754
|
}
|
2755
2755
|
calcCellAutoHeight(e) {
|
2756
|
-
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:
|
2757
|
-
if (!
|
2756
|
+
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: d = 0, topOffset: u = 0, downOffset: h = 0 } = l || {}, c = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2757
|
+
if (!c || c.renderMode === ie.TEXT)
|
2758
2758
|
return;
|
2759
2759
|
const m = {
|
2760
2760
|
startX: a.startX + s,
|
2761
|
-
endX: a.endX -
|
2761
|
+
endX: a.endX - d,
|
2762
2762
|
startY: a.startY + u,
|
2763
2763
|
endY: a.endY - h
|
2764
2764
|
}, g = m.endX - m.startX, M = Q(n), y = `${M != null ? M : ""}`;
|
2765
2765
|
let { tb: p, pd: S } = r || {};
|
2766
2766
|
const { t: v = re.pd.t, b: C = re.pd.b } = S != null ? S : {};
|
2767
|
-
if (p = p != null ? p : Ie.WRAP,
|
2767
|
+
if (p = p != null ? p : Ie.WRAP, c.renderMode === ie.ARROW) {
|
2768
2768
|
const w = g - he, { documentSkeleton: I, docModel: R } = Ct(y, this._localeService, r);
|
2769
2769
|
p === Ie.WRAP && R.updateDocumentDataPageSize(Math.max(w, 1)), I.calculate(), I.getActualSize();
|
2770
2770
|
const T = it(I), { height: N } = T;
|
@@ -2779,12 +2779,12 @@ let cn = class {
|
|
2779
2779
|
}
|
2780
2780
|
}
|
2781
2781
|
calcCellAutoWidth(e) {
|
2782
|
-
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:
|
2783
|
-
if (!
|
2782
|
+
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: d = 0, topOffset: u = 0, downOffset: h = 0 } = l || {}, c = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, o);
|
2783
|
+
if (!c || c.renderMode === ie.TEXT)
|
2784
2784
|
return;
|
2785
2785
|
const m = {
|
2786
2786
|
startX: a.startX + s,
|
2787
|
-
endX: a.endX -
|
2787
|
+
endX: a.endX - d,
|
2788
2788
|
startY: a.startY + u,
|
2789
2789
|
endY: a.endY - h
|
2790
2790
|
}, g = m.endX - m.startX, M = Q(n), y = `${M != null ? M : ""}`;
|
@@ -2792,7 +2792,7 @@ let cn = class {
|
|
2792
2792
|
const { l: v = re.pd.l, r: C = re.pd.r } = S != null ? S : {};
|
2793
2793
|
p = p != null ? p : Ie.WRAP;
|
2794
2794
|
let w = me * 2 + he;
|
2795
|
-
switch (
|
2795
|
+
switch (c.renderMode) {
|
2796
2796
|
case ie.ARROW:
|
2797
2797
|
w = he + me * 2 + C + v;
|
2798
2798
|
break;
|
@@ -2810,8 +2810,8 @@ let cn = class {
|
|
2810
2810
|
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);
|
2811
2811
|
if (!l || !a || l.renderMode === ie.TEXT)
|
2812
2812
|
return !1;
|
2813
|
-
const { top: s, left:
|
2814
|
-
return
|
2813
|
+
const { top: s, left: d, width: u, height: h } = a, { x: c, y: m } = e;
|
2814
|
+
return c >= d && c <= d + u && m >= s && m <= s + h;
|
2815
2815
|
}
|
2816
2816
|
onPointerDown(e, t) {
|
2817
2817
|
if (t.button === 2)
|
@@ -2833,18 +2833,18 @@ let cn = class {
|
|
2833
2833
|
(n = (r = Ke(Y.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.mainComponent) == null || n.setCursor(Ge.DEFAULT);
|
2834
2834
|
}
|
2835
2835
|
};
|
2836
|
-
|
2836
|
+
dn = Jo([
|
2837
2837
|
at(0, le),
|
2838
2838
|
at(1, b(se)),
|
2839
2839
|
at(2, J),
|
2840
2840
|
at(3, b(Ne)),
|
2841
2841
|
at(4, b(ee))
|
2842
|
-
],
|
2842
|
+
], dn);
|
2843
2843
|
class ta extends fe {
|
2844
2844
|
constructor() {
|
2845
2845
|
super(...arguments);
|
2846
2846
|
E(this, "id", G.LIST);
|
2847
|
-
E(this, "canvasRender", this.injector.createInstance(
|
2847
|
+
E(this, "canvasRender", this.injector.createInstance(dn));
|
2848
2848
|
E(this, "dropdownType", ge.LIST);
|
2849
2849
|
E(this, "optionsInput", Ot.componentKey);
|
2850
2850
|
E(this, "formulaInput", hn);
|
@@ -2965,10 +2965,10 @@ let Wn = (It = class extends Gn {
|
|
2965
2965
|
Wn = sa([
|
2966
2966
|
Kt(1, b(we)),
|
2967
2967
|
Kt(2, J),
|
2968
|
-
Kt(3,
|
2968
|
+
Kt(3, cn)
|
2969
2969
|
], Wn);
|
2970
|
-
var
|
2971
|
-
for (var i = n > 1 ? void 0 : n ?
|
2970
|
+
var da = Object.getOwnPropertyDescriptor, ca = (e, t, r, n) => {
|
2971
|
+
for (var i = n > 1 ? void 0 : n ? da(t, r) : t, o = e.length - 1, a; o >= 0; o--)
|
2972
2972
|
(a = e[o]) && (i = a(i) || i);
|
2973
2973
|
return i;
|
2974
2974
|
}, Gt = (e, t) => (r, n) => t(r, n, e);
|
@@ -3020,10 +3020,10 @@ let jn = (wt = class extends Gn {
|
|
3020
3020
|
this._injector.get(qe);
|
3021
3021
|
}
|
3022
3022
|
}, E(wt, "pluginName", ua), E(wt, "type", Y.UNIVER_SHEET), wt);
|
3023
|
-
jn =
|
3023
|
+
jn = ca([
|
3024
3024
|
Gt(1, b(we)),
|
3025
3025
|
Gt(2, J),
|
3026
|
-
Gt(3,
|
3026
|
+
Gt(3, cn)
|
3027
3027
|
], jn);
|
3028
3028
|
export {
|
3029
3029
|
fe as BaseSheetDataValidatorView,
|