@univerjs/sheets-data-validation-ui 0.6.10 → 0.7.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +33 -1
- package/lib/es/index.js +1630 -1572
- package/lib/index.css +1 -1
- package/lib/index.js +1630 -1572
- package/lib/types/services/dropdown-manager.service.d.ts +3 -2
- package/lib/umd/index.js +33 -1
- package/package.json +16 -16
- /package/lib/types/views/components/formula-input/{base-formula-input.d.ts → BaseFormulaInput.d.ts} +0 -0
- /package/lib/types/views/components/formula-input/{checkbox-formula-input.d.ts → CheckboxFormulaInput.d.ts} +0 -0
- /package/lib/types/views/components/formula-input/{custom-formula-input.d.ts → CustomFormulaInput.d.ts} +0 -0
- /package/lib/types/views/components/formula-input/{list-formula-input.d.ts → ListFormulaInput.d.ts} +0 -0
package/lib/es/index.js
CHANGED
@@ -1,83 +1,73 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var E = (e, t,
|
4
|
-
import { LocaleService as
|
5
|
-
import { DataValidationFormulaController as
|
6
|
-
import { jsxs as z, Fragment as
|
7
|
-
import { FormLayout as K, Input as
|
8
|
-
import { useDependency as
|
9
|
-
import
|
10
|
-
import { FormulaEditor as
|
11
|
-
import { DataValidatorRegistryService as ye, DataValidationModel as
|
12
|
-
import { debounceTime as
|
13
|
-
import { DeviceInputEventType as
|
14
|
-
import { SheetInterceptorService as
|
15
|
-
import { getPatternType as
|
16
|
-
import { ISheetCellDropdownManagerService as
|
17
|
-
import { deserializeRangeWithSheet as
|
18
|
-
const
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
dataValidationFormulaListItemDrag: Xo,
|
24
|
-
dataValidationFormulaListAdd: zo,
|
25
|
-
dataValidationFormulaColorSelect: Ko,
|
26
|
-
dataValidationFormulaColorSelectPanel: Go,
|
27
|
-
dataValidationFormulaColorItem: Zo
|
28
|
-
}, qo = (e) => {
|
29
|
-
const { isTwoFormula: t = !1, value: n, onChange: a, showError: o, validResult: i } = e, r = N(le), l = o ? i == null ? void 0 : i.formula1 : "", s = o ? i == null ? void 0 : i.formula2 : "";
|
30
|
-
return t ? /* @__PURE__ */ z(Ke, { children: [
|
31
|
-
/* @__PURE__ */ v(K, { error: l, children: /* @__PURE__ */ v(
|
32
|
-
Oe,
|
1
|
+
var Ar = Object.defineProperty;
|
2
|
+
var Lr = (e, t, r) => t in e ? Ar(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
3
|
+
var E = (e, t, r) => Lr(e, typeof t != "symbol" ? t + "" : t, r);
|
4
|
+
import { LocaleService as se, isFormulaString as De, DataValidationType as G, Tools as Kt, Inject as M, Injector as we, Disposable as Re, UniverInstanceType as W, toDisposable as kr, IUniverInstanceService as le, DataValidationErrorStyle as lt, DataValidationStatus as je, ICommandService as J, IConfigService as ln, DataValidationRenderMode as oe, DisposableCollection as Nr, dayjs as wn, numfmt as Hn, CellValueType as Ur, CommandType as nt, ObjectMatrix as wt, Range as Fr, Rectangle as Rt, queryObjectMatrix as Gt, Optional as xr, RxDisposable as cn, InterceptorEffectEnum as Wn, sequenceExecute as jn, bufferDebounceTime as $r, debounce as Br, UndoCommand as Hr, RedoCommand as Wr, isUnitRangesEqual as jr, shallowEqual as Rn, ThemeService as Yn, ColorKit as Yr, VerticalAlign as ae, HorizontalAlign as Ye, DEFAULT_STYLES as re, WrapStrategy as Ie, DocumentDataModel as Xr, BooleanNumber as rt, DEFAULT_EMPTY_DOCUMENT_VALUE as zr, Plugin as Xn, merge as zn } from "@univerjs/core";
|
5
|
+
import { DataValidationFormulaController as Kr, deserializeListOptions as Gr, serializeListOptions as Kn, CUSTOM_FORMULA_INPUT_NAME as Gn, BASE_FORMULA_INPUT_NAME as Tt, LIST_FORMULA_INPUT_NAME as dn, CHECKBOX_FORMULA_INPUT_NAME as Zn, SheetDataValidationModel as ee, SheetsDataValidationValidatorService as Zr, getDataValidationCellValue as kt, getCellValueOrigin as Q, createDefaultNewRule as qn, AddSheetDataValidationCommand as un, DATA_VALIDATION_PLUGIN_NAME as Jn, getDataValidationDiffMutations as Zt, UpdateSheetDataValidationRangeCommand as Qn, DataValidationCacheService as er, UpdateSheetDataValidationSettingCommand as yn, UpdateSheetDataValidationOptionsCommand as qr, RemoveSheetDataValidationCommand as tr, RemoveSheetAllDataValidationCommand as Jr, DataValidationFormulaService as Qr, CHECKBOX_FORMULA_2 as eo, CHECKBOX_FORMULA_1 as to, getFormulaResult as Nt, isLegalFormulaResult as Mn, transformCheckboxValue as no } from "@univerjs/sheets-data-validation";
|
6
|
+
import { jsxs as z, Fragment as Xe, jsx as _ } from "react/jsx-runtime";
|
7
|
+
import { FormLayout as K, Input as Ve, Checkbox as Pt, RadioGroup as hn, Radio as Oe, DraggableList as ro, clsx as nr, LegacySelect as oo, Button as ze, Select as bn } from "@univerjs/design";
|
8
|
+
import { useDependency as U, useSidebarClick as rr, useObservable as Te, useEvent as qt, ISidebarService as or, IDialogService as io, IZenZoneService as ir, KeyCode as ht, MenuItemType as pn, getMenuHiddenObservable as ao, RibbonStartGroup as so, IMenuManagerService as lo, ComponentManager as gn } from "@univerjs/ui";
|
9
|
+
import En, { useState as H, useRef as ut, forwardRef as Le, createElement as ke, useMemo as ct, useEffect as Pe } from "react";
|
10
|
+
import { FormulaEditor as ar, RangeSelector as co } from "@univerjs/sheets-formula-ui";
|
11
|
+
import { DataValidatorRegistryService as ye, DataValidationModel as mn, DataValidatorDropdownType as pe, DataValidatorRegistryScope as uo, TWO_FORMULA_OPERATOR_COUNT as ho, getRuleOptions as Dn, getRuleSetting as Vn } from "@univerjs/data-validation";
|
12
|
+
import { debounceTime as sr, filter as fn, BehaviorSubject as On, distinctUntilChanged as po, Subject as go, bufferTime as lr, of as mo } from "rxjs";
|
13
|
+
import { DeviceInputEventType as pt, IRenderManagerService as Ne, fixLineWidthByScale as Tn, Transform as fo, CheckboxShape as vo, getCurrentTypeOfRenderer as Ke, CURSOR_TYPE as Ge, FontCache as _o, Shape as So, Rect as cr, getFontStyleString as Ut, getDocsSkeletonPageSize as ot, Documents as Co, DocumentViewModel as Io, DocumentSkeleton as wo } from "@univerjs/engine-render";
|
14
|
+
import { SheetInterceptorService as vn, VALIDATE_CELL as Ro, SheetsSelectionsService as dr, SetRangeValuesCommand as st, getSheetCommandTarget as ur, rangeToDiscreteRange as yo, SheetPermissionCheckController as Mo, WorksheetEditPermission as Jt, WorksheetSetCellStylePermission as Qt, RangeProtectionPermissionEditPoint as en, WorkbookEditablePermission as tn, INTERCEPTOR_POINT as hr, InterceptCellContentPriority as pr, checkRangesEditablePermission as bo } from "@univerjs/sheets";
|
15
|
+
import { getPatternType as Eo } from "@univerjs/sheets-numfmt";
|
16
|
+
import { ISheetCellDropdownManagerService as Do, IEditorBridgeService as gr, SetCellEditVisibleOperation as gt, HoverManagerService as Vo, CellAlertManagerService as Oo, CellAlertType as To, IAutoFillService as Po, APPLY_TYPE as it, virtualizeDiscreteRanges as nn, getAutoFillRepeatRange as Ao, ISheetClipboardService as Lo, COPY_TYPE as Pn, PREDEFINED_HOOK_NAME as mt, getRepeatRange as An, getCurrentRangeDisable$ as ko, AutoHeightController as mr, SheetSkeletonManagerService as yt, IMarkSelectionService as No } from "@univerjs/sheets-ui";
|
17
|
+
import { deserializeRangeWithSheet as Uo, serializeRange as fr } from "@univerjs/engine-formula";
|
18
|
+
const Fo = (e) => {
|
19
|
+
const { isTwoFormula: t = !1, value: r, onChange: n, showError: o, validResult: i } = e, a = U(se), l = o ? i == null ? void 0 : i.formula1 : "", s = o ? i == null ? void 0 : i.formula2 : "";
|
20
|
+
return t ? /* @__PURE__ */ z(Xe, { children: [
|
21
|
+
/* @__PURE__ */ _(K, { error: l, children: /* @__PURE__ */ _(
|
22
|
+
Ve,
|
33
23
|
{
|
34
|
-
className:
|
35
|
-
placeholder:
|
36
|
-
value:
|
37
|
-
onChange: (
|
38
|
-
|
39
|
-
...
|
40
|
-
formula1:
|
24
|
+
className: "univer-w-full",
|
25
|
+
placeholder: a.t("dataValidation.panel.formulaPlaceholder"),
|
26
|
+
value: r == null ? void 0 : r.formula1,
|
27
|
+
onChange: (c) => {
|
28
|
+
n == null || n({
|
29
|
+
...r,
|
30
|
+
formula1: c
|
41
31
|
});
|
42
32
|
}
|
43
33
|
}
|
44
34
|
) }),
|
45
|
-
/* @__PURE__ */
|
46
|
-
/* @__PURE__ */
|
47
|
-
|
35
|
+
/* @__PURE__ */ _("div", { className: "-univer-mt-2 univer-mb-1 univer-text-sm univer-text-gray-400", children: a.t("dataValidation.panel.formulaAnd") }),
|
36
|
+
/* @__PURE__ */ _(K, { error: s, children: /* @__PURE__ */ _(
|
37
|
+
Ve,
|
48
38
|
{
|
49
|
-
className:
|
50
|
-
placeholder:
|
51
|
-
value:
|
52
|
-
onChange: (
|
53
|
-
|
54
|
-
...
|
55
|
-
formula2:
|
39
|
+
className: "univer-w-full",
|
40
|
+
placeholder: a.t("dataValidation.panel.formulaPlaceholder"),
|
41
|
+
value: r == null ? void 0 : r.formula2,
|
42
|
+
onChange: (c) => {
|
43
|
+
n == null || n({
|
44
|
+
...r,
|
45
|
+
formula2: c
|
56
46
|
});
|
57
47
|
}
|
58
48
|
}
|
59
49
|
) })
|
60
|
-
] }) : /* @__PURE__ */
|
61
|
-
|
50
|
+
] }) : /* @__PURE__ */ _(K, { error: l, children: /* @__PURE__ */ _(
|
51
|
+
Ve,
|
62
52
|
{
|
63
|
-
className:
|
64
|
-
placeholder:
|
65
|
-
value:
|
66
|
-
onChange: (
|
67
|
-
|
53
|
+
className: "univer-w-full",
|
54
|
+
placeholder: a.t("dataValidation.panel.formulaPlaceholder"),
|
55
|
+
value: r == null ? void 0 : r.formula1,
|
56
|
+
onChange: (c) => {
|
57
|
+
n == null || n({ formula1: c });
|
68
58
|
}
|
69
59
|
}
|
70
60
|
) });
|
71
61
|
};
|
72
|
-
function
|
73
|
-
const { value: t, onChange:
|
74
|
-
return /* @__PURE__ */ z(
|
75
|
-
/* @__PURE__ */
|
76
|
-
|
62
|
+
function xo(e) {
|
63
|
+
const { value: t, onChange: r, showError: n, validResult: o } = e, i = U(se), a = n ? o == null ? void 0 : o.formula1 : "", l = n ? o == null ? void 0 : o.formula2 : "", [s, c] = H(!((t == null ? void 0 : t.formula1) === void 0 && (t == null ? void 0 : t.formula2) === void 0));
|
64
|
+
return /* @__PURE__ */ z(Xe, { children: [
|
65
|
+
/* @__PURE__ */ _(K, { children: /* @__PURE__ */ _(
|
66
|
+
Pt,
|
77
67
|
{
|
78
68
|
checked: s,
|
79
69
|
onChange: (u) => {
|
80
|
-
u ?
|
70
|
+
u ? c(!0) : (c(!1), r == null || r({
|
81
71
|
...t,
|
82
72
|
formula1: void 0,
|
83
73
|
formula2: void 0
|
@@ -86,28 +76,28 @@ function Jo(e) {
|
|
86
76
|
children: i.t("dataValidation.checkbox.tips")
|
87
77
|
}
|
88
78
|
) }),
|
89
|
-
s ? /* @__PURE__ */
|
90
|
-
|
79
|
+
s ? /* @__PURE__ */ _(K, { label: i.t("dataValidation.checkbox.checked"), error: a, children: /* @__PURE__ */ _(
|
80
|
+
Ve,
|
91
81
|
{
|
92
|
-
className:
|
82
|
+
className: "univer-w-full",
|
93
83
|
placeholder: i.t("dataValidation.panel.valuePlaceholder"),
|
94
84
|
value: t == null ? void 0 : t.formula1,
|
95
85
|
onChange: (u) => {
|
96
|
-
|
86
|
+
r == null || r({
|
97
87
|
...t,
|
98
88
|
formula1: u || void 0
|
99
89
|
});
|
100
90
|
}
|
101
91
|
}
|
102
92
|
) }) : null,
|
103
|
-
s ? /* @__PURE__ */
|
104
|
-
|
93
|
+
s ? /* @__PURE__ */ _(K, { label: i.t("dataValidation.checkbox.unchecked"), error: l, children: /* @__PURE__ */ _(
|
94
|
+
Ve,
|
105
95
|
{
|
106
|
-
className:
|
96
|
+
className: "univer-w-full",
|
107
97
|
placeholder: i.t("dataValidation.panel.valuePlaceholder"),
|
108
98
|
value: t == null ? void 0 : t.formula2,
|
109
99
|
onChange: (u) => {
|
110
|
-
|
100
|
+
r == null || r({
|
111
101
|
...t,
|
112
102
|
formula2: u || void 0
|
113
103
|
});
|
@@ -116,24 +106,24 @@ function Jo(e) {
|
|
116
106
|
) }) : null
|
117
107
|
] });
|
118
108
|
}
|
119
|
-
function
|
120
|
-
var
|
121
|
-
const { unitId: t, subUnitId:
|
122
|
-
return
|
123
|
-
var
|
124
|
-
((
|
125
|
-
}), /* @__PURE__ */
|
126
|
-
|
109
|
+
function $o(e) {
|
110
|
+
var h;
|
111
|
+
const { unitId: t, subUnitId: r, value: n, onChange: o, showError: i, validResult: a } = e, l = i ? a == null ? void 0 : a.formula1 : void 0, s = ut(null), [c, u] = H(!1);
|
112
|
+
return rr((d) => {
|
113
|
+
var p;
|
114
|
+
((p = s.current) == null ? void 0 : p.isClickOutSide(d)) && u(!1);
|
115
|
+
}), /* @__PURE__ */ _(
|
116
|
+
ar,
|
127
117
|
{
|
128
|
-
initValue: (
|
118
|
+
initValue: (h = n == null ? void 0 : n.formula1) != null ? h : "=",
|
129
119
|
unitId: t,
|
130
|
-
subUnitId:
|
131
|
-
isFocus:
|
132
|
-
onChange: (
|
133
|
-
const
|
134
|
-
|
135
|
-
...
|
136
|
-
formula1:
|
120
|
+
subUnitId: r,
|
121
|
+
isFocus: c,
|
122
|
+
onChange: (d) => {
|
123
|
+
const S = (d != null ? d : "").trim();
|
124
|
+
S !== (n == null ? void 0 : n.formula1) && (o == null || o({
|
125
|
+
...n,
|
126
|
+
formula1: S
|
137
127
|
}));
|
138
128
|
},
|
139
129
|
errorText: l,
|
@@ -143,101 +133,101 @@ function Qo(e) {
|
|
143
133
|
}
|
144
134
|
);
|
145
135
|
}
|
146
|
-
var
|
147
|
-
return
|
148
|
-
for (var t,
|
149
|
-
t = arguments[
|
136
|
+
var ie = function() {
|
137
|
+
return ie = Object.assign || function(e) {
|
138
|
+
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
139
|
+
t = arguments[r];
|
150
140
|
for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
|
151
141
|
}
|
152
142
|
return e;
|
153
|
-
},
|
154
|
-
},
|
155
|
-
var
|
156
|
-
for (var
|
143
|
+
}, ie.apply(this, arguments);
|
144
|
+
}, Bo = function(e, t) {
|
145
|
+
var r = {};
|
146
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
157
147
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
158
|
-
for (var o = 0,
|
159
|
-
t.indexOf(
|
160
|
-
return
|
161
|
-
}, Ue =
|
162
|
-
var
|
163
|
-
return
|
148
|
+
for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
|
149
|
+
t.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (r[n[o]] = e[n[o]]);
|
150
|
+
return r;
|
151
|
+
}, Ue = Le(function(e, t) {
|
152
|
+
var r = e.icon, n = e.id, o = e.className, i = e.extend, a = Bo(e, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(n, " ").concat(o || "").trim(), s = ut("_".concat(jo()));
|
153
|
+
return vr(r, "".concat(n), { defIds: r.defIds, idSuffix: s.current }, ie({ ref: t, className: l }, a), i);
|
164
154
|
});
|
165
|
-
function
|
166
|
-
return ke(e.tag,
|
167
|
-
return
|
155
|
+
function vr(e, t, r, n, o) {
|
156
|
+
return ke(e.tag, ie(ie({ key: t }, Ho(e, r, o)), n), (Wo(e, r).children || []).map(function(i, a) {
|
157
|
+
return vr(i, "".concat(t, "-").concat(e.tag, "-").concat(a), r, void 0, o);
|
168
158
|
}));
|
169
159
|
}
|
170
|
-
function
|
171
|
-
var
|
172
|
-
|
173
|
-
var
|
174
|
-
|
160
|
+
function Ho(e, t, r) {
|
161
|
+
var n = ie({}, e.attrs);
|
162
|
+
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), e.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(function(i) {
|
163
|
+
var a = i[0], l = i[1];
|
164
|
+
a === "mask" && typeof l == "string" && (n[a] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
175
165
|
});
|
176
166
|
var o = t.defIds;
|
177
|
-
return !o || o.length === 0 || (e.tag === "use" &&
|
178
|
-
var
|
179
|
-
typeof l == "string" && (a
|
180
|
-
})),
|
167
|
+
return !o || o.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(i) {
|
168
|
+
var a = i[0], l = i[1];
|
169
|
+
typeof l == "string" && (n[a] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
170
|
+
})), n;
|
181
171
|
}
|
182
|
-
function
|
183
|
-
var
|
184
|
-
return !
|
185
|
-
return typeof o.attrs.id == "string" &&
|
172
|
+
function Wo(e, t) {
|
173
|
+
var r, n = t.defIds;
|
174
|
+
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? ie(ie({}, e), { children: e.children.map(function(o) {
|
175
|
+
return typeof o.attrs.id == "string" && n && n.indexOf(o.attrs.id) > -1 ? ie(ie({}, o), { attrs: ie(ie({}, o.attrs), { id: o.attrs.id + t.idSuffix }) }) : o;
|
186
176
|
}) }) : e;
|
187
177
|
}
|
188
|
-
function
|
178
|
+
function jo() {
|
189
179
|
return Math.random().toString(36).substring(2, 8);
|
190
180
|
}
|
191
181
|
Ue.displayName = "UniverIcon";
|
192
|
-
var
|
182
|
+
var Yo = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.4917 3.07803C1.4917 2.19437 2.20804 1.47803 3.0917 1.47803H5.6917C6.57536 1.47803 7.2917 2.19437 7.2917 3.07803V5.67803C7.2917 6.56168 6.57535 7.27803 5.6917 7.27803H3.0917C2.20804 7.27803 1.4917 6.56168 1.4917 5.67803V3.07803ZM3.0917 2.67803C2.87078 2.67803 2.6917 2.85711 2.6917 3.07803V5.67803C2.6917 5.89894 2.87079 6.07803 3.0917 6.07803H5.6917C5.91261 6.07803 6.0917 5.89894 6.0917 5.67803V3.07803C6.0917 2.85711 5.91261 2.67803 5.6917 2.67803H3.0917Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M14.6175 2.45279C14.8518 2.68711 14.8518 3.06701 14.6175 3.30132L11.6151 6.30365C11.3957 6.52307 11.0451 6.53897 10.8067 6.34031L8.80915 4.67566C8.55458 4.46352 8.52019 4.08518 8.73233 3.83062 8.94447 3.57605 9.32281 3.54166 9.57737 3.7538L11.154 5.06767 13.769 2.45278C14.0033 2.21847 14.3832 2.21848 14.6175 2.45279zM14.1175 9.19746C14.3518 9.43178 14.3518 9.81168 14.1175 10.046L12.5418 11.6217 14.1175 13.1975C14.3518 13.4318 14.3518 13.8117 14.1175 14.046 13.8832 14.2803 13.5033 14.2803 13.269 14.046L11.6933 12.4703 10.1175 14.046C9.88321 14.2803 9.50331 14.2803 9.269 14.046 9.03468 13.8117 9.03468 13.4318 9.269 13.1975L10.8447 11.6217 9.269 10.046C9.03468 9.81168 9.03468 9.43178 9.269 9.19746 9.50331 8.96315 9.88321 8.96315 10.1175 9.19746L11.6933 10.7732 13.269 9.19746C13.5033 8.96315 13.8832 8.96315 14.1175 9.19746z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.0917 8.72168C2.20804 8.72168 1.4917 9.43802 1.4917 10.3217V12.9217C1.4917 13.8053 2.20804 14.5217 3.0917 14.5217H5.6917C6.57535 14.5217 7.2917 13.8053 7.2917 12.9217V10.3217C7.2917 9.43802 6.57536 8.72168 5.6917 8.72168H3.0917ZM2.6917 10.3217C2.6917 10.1008 2.87078 9.92168 3.0917 9.92168H5.6917C5.91261 9.92168 6.0917 10.1008 6.0917 10.3217V12.9217C6.0917 13.1426 5.91261 13.3217 5.6917 13.3217H3.0917C2.87079 13.3217 2.6917 13.1426 2.6917 12.9217V10.3217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, _r = Le(function(e, t) {
|
193
183
|
return ke(Ue, Object.assign({}, e, {
|
194
184
|
id: "data-validation-single",
|
195
185
|
ref: t,
|
196
|
-
icon:
|
186
|
+
icon: Yo
|
197
187
|
}));
|
198
188
|
});
|
199
|
-
|
200
|
-
var
|
189
|
+
_r.displayName = "DataValidationSingle";
|
190
|
+
var Xo = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, _n = Le(function(e, t) {
|
201
191
|
return ke(Ue, Object.assign({}, e, {
|
202
192
|
id: "delete-single",
|
203
193
|
ref: t,
|
204
|
-
icon:
|
194
|
+
icon: Xo
|
205
195
|
}));
|
206
196
|
});
|
207
|
-
|
208
|
-
var
|
197
|
+
_n.displayName = "DeleteSingle";
|
198
|
+
var zo = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, Sr = Le(function(e, t) {
|
209
199
|
return ke(Ue, Object.assign({}, e, {
|
210
200
|
id: "increase-single",
|
211
201
|
ref: t,
|
212
|
-
icon:
|
202
|
+
icon: zo
|
213
203
|
}));
|
214
204
|
});
|
215
|
-
|
216
|
-
var
|
205
|
+
Sr.displayName = "IncreaseSingle";
|
206
|
+
var Ko = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Cr = Le(function(e, t) {
|
217
207
|
return ke(Ue, Object.assign({}, e, {
|
218
208
|
id: "more-down-single",
|
219
209
|
ref: t,
|
220
|
-
icon:
|
210
|
+
icon: Ko
|
221
211
|
}));
|
222
212
|
});
|
223
|
-
|
224
|
-
var
|
213
|
+
Cr.displayName = "MoreDownSingle";
|
214
|
+
var Go = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.64645 9.85355C4.45118 9.65829 4.45118 9.34171 4.64645 9.14645L7.64645 6.14645C7.84171 5.95118 8.15829 5.95118 8.35355 6.14645L11.3536 9.14645C11.5488 9.34171 11.5488 9.65829 11.3536 9.85355C11.1583 10.0488 10.8417 10.0488 10.6464 9.85355L8 7.20711L5.35355 9.85355C5.15829 10.0488 4.84171 10.0488 4.64645 9.85355Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ir = Le(function(e, t) {
|
225
215
|
return ke(Ue, Object.assign({}, e, {
|
226
216
|
id: "more-up-single",
|
227
217
|
ref: t,
|
228
|
-
icon:
|
218
|
+
icon: Go
|
229
219
|
}));
|
230
220
|
});
|
231
|
-
|
232
|
-
var
|
221
|
+
Ir.displayName = "MoreUpSingle";
|
222
|
+
var Zo = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_622_8", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_622_8)" }, children: [{ tag: "path", attrs: { d: "M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z" } }] }] }, wr = Le(function(e, t) {
|
233
223
|
return ke(Ue, Object.assign({}, e, {
|
234
224
|
id: "sequence-single",
|
235
225
|
ref: t,
|
236
|
-
icon:
|
226
|
+
icon: Zo
|
237
227
|
}));
|
238
228
|
});
|
239
|
-
|
240
|
-
const
|
229
|
+
wr.displayName = "SequenceSingle";
|
230
|
+
const He = "#ECECEC", qo = [
|
241
231
|
"#FFFFFF",
|
242
232
|
"#FEE7E7",
|
243
233
|
"#FEF0E6",
|
@@ -262,288 +252,324 @@ const je = "#ECECEC", ci = [
|
|
262
252
|
"#3A60F7",
|
263
253
|
"#9E6DE3",
|
264
254
|
"#F248A6"
|
265
|
-
],
|
266
|
-
const { value: t, onChange:
|
267
|
-
return /* @__PURE__ */
|
268
|
-
|
255
|
+
], Jo = (e) => {
|
256
|
+
const { value: t, onChange: r, disabled: n } = e, [o, i] = H(!1);
|
257
|
+
return /* @__PURE__ */ _(
|
258
|
+
oo,
|
269
259
|
{
|
270
|
-
disabled:
|
260
|
+
disabled: n,
|
271
261
|
open: o,
|
272
262
|
onDropdownVisibleChange: i,
|
273
263
|
dropdownStyle: { width: 112 },
|
274
264
|
style: { width: 96, cursor: "pointer" },
|
275
|
-
className:
|
265
|
+
className: "univer-ml-1 univer-mr-2 univer-w-[92px]",
|
276
266
|
value: t,
|
277
|
-
onChange:
|
278
|
-
labelRender: (
|
267
|
+
onChange: r,
|
268
|
+
labelRender: (a) => /* @__PURE__ */ _(
|
279
269
|
"div",
|
280
270
|
{
|
281
|
-
className:
|
282
|
-
|
271
|
+
className: `
|
272
|
+
univer-box-border univer-h-4 univer-w-4 univer-rounded univer-border univer-border-gray-200
|
273
|
+
univer-text-base
|
274
|
+
`,
|
275
|
+
style: { background: a.value, marginTop: 5 }
|
283
276
|
}
|
284
277
|
),
|
285
|
-
dropdownRender: () => /* @__PURE__ */
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
278
|
+
dropdownRender: () => /* @__PURE__ */ _(
|
279
|
+
"div",
|
280
|
+
{
|
281
|
+
className: `
|
282
|
+
univer-box-border univer-flex univer-w-28 univer-flex-row univer-flex-wrap
|
283
|
+
univer-justify-between univer-p-3 univer-pl-3
|
284
|
+
`,
|
285
|
+
children: qo.map(
|
286
|
+
(a) => /* @__PURE__ */ _(
|
287
|
+
"div",
|
288
|
+
{
|
289
|
+
onClick: () => {
|
290
|
+
r(a), i(!1);
|
291
|
+
},
|
292
|
+
className: `
|
293
|
+
univer-mb-2 univer-mr-2 univer-box-border univer-box-border univer-h-4 univer-w-4
|
294
|
+
univer-cursor-pointer univer-rounded univer-border univer-border-gray-200
|
295
|
+
univer-text-base
|
296
|
+
`,
|
297
|
+
style: { background: a }
|
298
|
+
},
|
299
|
+
a
|
300
|
+
)
|
301
|
+
)
|
302
|
+
}
|
303
|
+
)
|
298
304
|
}
|
299
305
|
);
|
300
|
-
},
|
301
|
-
const { item: t, commonProps:
|
302
|
-
return /* @__PURE__ */ z("div", { className:
|
303
|
-
t.isRef ? null : /* @__PURE__ */
|
304
|
-
/* @__PURE__ */
|
305
|
-
|
306
|
+
}, Ln = (e) => {
|
307
|
+
const { item: t, commonProps: r, style: n } = e, { onItemChange: o, onItemDelete: i } = r;
|
308
|
+
return /* @__PURE__ */ z("div", { className: "univer-flex univer-items-center univer-pb-0.5", style: n, children: [
|
309
|
+
t.isRef ? null : /* @__PURE__ */ _("div", { className: nr("univer-cursor-move", "draggableHandle"), children: /* @__PURE__ */ _(wr, {}) }),
|
310
|
+
/* @__PURE__ */ _(
|
311
|
+
Jo,
|
306
312
|
{
|
307
313
|
value: t.color,
|
308
|
-
onChange: (
|
309
|
-
o(t.id, t.label,
|
314
|
+
onChange: (a) => {
|
315
|
+
o(t.id, t.label, a);
|
310
316
|
}
|
311
317
|
}
|
312
318
|
),
|
313
|
-
/* @__PURE__ */
|
314
|
-
|
319
|
+
/* @__PURE__ */ _(
|
320
|
+
Ve,
|
315
321
|
{
|
316
322
|
disabled: t.isRef,
|
317
323
|
value: t.label,
|
318
|
-
onChange: (
|
319
|
-
o(t.id,
|
324
|
+
onChange: (a) => {
|
325
|
+
o(t.id, a, t.color);
|
320
326
|
},
|
321
327
|
inputStyle: { height: 28 }
|
322
328
|
}
|
323
329
|
),
|
324
|
-
t.isRef ? null : /* @__PURE__ */
|
330
|
+
t.isRef ? null : /* @__PURE__ */ _(
|
331
|
+
"div",
|
332
|
+
{
|
333
|
+
className: `
|
334
|
+
univer-ml-1 univer-cursor-pointer univer-rounded univer-text-base
|
335
|
+
hover:univer-bg-gray-200
|
336
|
+
`,
|
337
|
+
children: /* @__PURE__ */ _(_n, { onClick: () => i(t.id) })
|
338
|
+
}
|
339
|
+
)
|
325
340
|
] });
|
326
341
|
};
|
327
|
-
function
|
328
|
-
const { value: t, onChange:
|
329
|
-
}, unitId:
|
330
|
-
|
342
|
+
function Qo(e) {
|
343
|
+
const { value: t, onChange: r = () => {
|
344
|
+
}, unitId: n, subUnitId: o, validResult: i, showError: a, ruleId: l } = e, { formula1: s = "", formula2: c = "" } = t || {}, [u, h] = H(() => De(s) ? "1" : "0"), [d, S] = H(u === "1" ? s : "="), [p, b] = H(u === "1" ? s : "="), y = U(se), g = U(ye), f = U(mn), m = U(Kr), [I, w] = H(() => c.split(",")), C = g.getValidatorItem(G.LIST), [R, D] = H([]), [k, V] = H(""), A = a ? i == null ? void 0 : i.formula1 : "", P = ct(() => f.ruleChange$.pipe(sr(16)), []), L = Te(P), O = qt(r);
|
345
|
+
Pe(() => {
|
331
346
|
(async () => {
|
332
|
-
await new Promise((
|
333
|
-
setTimeout(() =>
|
347
|
+
await new Promise((v) => {
|
348
|
+
setTimeout(() => v(!0), 100);
|
334
349
|
});
|
335
|
-
const
|
336
|
-
if (
|
337
|
-
const
|
338
|
-
|
350
|
+
const T = f.getRuleById(n, o, l), B = T == null ? void 0 : T.formula1;
|
351
|
+
if (De(B) && C && T) {
|
352
|
+
const v = await C.getListAsync(T, n, o);
|
353
|
+
D(v);
|
339
354
|
}
|
340
355
|
})();
|
341
|
-
}, [
|
342
|
-
|
343
|
-
}, [
|
344
|
-
const [
|
345
|
-
const
|
346
|
-
return
|
347
|
-
label:
|
348
|
-
color:
|
356
|
+
}, [f, L, C, l, o, n]), Pe(() => {
|
357
|
+
De(s) && s !== p && (S(s), b(p));
|
358
|
+
}, [p, s]);
|
359
|
+
const [F, x] = H(() => {
|
360
|
+
const T = u !== "1" ? Gr(s) : [], B = c.split(",");
|
361
|
+
return T.map((v, N) => ({
|
362
|
+
label: v,
|
363
|
+
color: B[N] || He,
|
349
364
|
isRef: !1,
|
350
|
-
id:
|
365
|
+
id: Kt.generateRandomId(4)
|
351
366
|
}));
|
352
|
-
}), j = (
|
353
|
-
const
|
354
|
-
|
355
|
-
}, Z = (
|
356
|
-
const
|
357
|
-
|
358
|
-
}, Y =
|
359
|
-
label:
|
360
|
-
color: Y[
|
361
|
-
id: `${
|
367
|
+
}), j = (T, B, v) => {
|
368
|
+
const N = F.find(($) => $.id === T);
|
369
|
+
N && (N.label = B, N.color = v, x([...F]));
|
370
|
+
}, Z = (T) => {
|
371
|
+
const B = F.findIndex((v) => v.id === T);
|
372
|
+
B !== -1 && (F.splice(B, 1), x([...F]));
|
373
|
+
}, Y = c.split(","), te = ct(() => R.map((T, B) => ({
|
374
|
+
label: T,
|
375
|
+
color: Y[B] || He,
|
376
|
+
id: `${B}`,
|
362
377
|
isRef: !0
|
363
|
-
})), [Y,
|
364
|
-
const
|
365
|
-
|
378
|
+
})), [Y, R]), ge = (T, B, v) => {
|
379
|
+
const N = [...I];
|
380
|
+
N[+T] = v, w(N), O({
|
366
381
|
formula1: s,
|
367
|
-
formula2:
|
382
|
+
formula2: N.join(",")
|
368
383
|
});
|
369
384
|
}, ce = () => {
|
370
|
-
|
371
|
-
...
|
385
|
+
x([
|
386
|
+
...F,
|
372
387
|
{
|
373
388
|
label: "",
|
374
|
-
color:
|
389
|
+
color: He,
|
375
390
|
isRef: !1,
|
376
|
-
id:
|
391
|
+
id: Kt.generateRandomId(4)
|
377
392
|
}
|
378
393
|
]);
|
379
394
|
};
|
380
|
-
|
395
|
+
Pe(() => {
|
381
396
|
if (u === "1")
|
382
397
|
return;
|
383
|
-
const
|
384
|
-
|
385
|
-
labelList:
|
386
|
-
item:
|
387
|
-
})).forEach(({ item:
|
388
|
-
|
389
|
-
|
398
|
+
const T = /* @__PURE__ */ new Set(), B = [];
|
399
|
+
F.map((v) => ({
|
400
|
+
labelList: v.label.split(","),
|
401
|
+
item: v
|
402
|
+
})).forEach(({ item: v, labelList: N }) => {
|
403
|
+
N.forEach(($) => {
|
404
|
+
T.has($) || (T.add($), B.push({
|
390
405
|
label: $,
|
391
|
-
color:
|
406
|
+
color: v.color
|
392
407
|
}));
|
393
408
|
});
|
394
409
|
}), O({
|
395
|
-
formula1:
|
396
|
-
formula2:
|
410
|
+
formula1: Kn(B.map((v) => v.label)),
|
411
|
+
formula2: B.map((v) => v.color === He ? "" : v.color).join(",")
|
397
412
|
});
|
398
|
-
}, [
|
399
|
-
const ne =
|
400
|
-
if (!
|
413
|
+
}, [F, O, u, p, I]);
|
414
|
+
const ne = qt(async (T) => {
|
415
|
+
if (!De(T)) {
|
401
416
|
O == null || O({
|
402
417
|
formula1: "",
|
403
|
-
formula2:
|
418
|
+
formula2: c
|
404
419
|
});
|
405
420
|
return;
|
406
421
|
}
|
407
|
-
|
408
|
-
formula1:
|
409
|
-
formula2:
|
410
|
-
}),
|
422
|
+
m.getFormulaRefCheck(T) ? (O == null || O({
|
423
|
+
formula1: De(T) ? T : "",
|
424
|
+
formula2: c
|
425
|
+
}), V("")) : (O == null || O({
|
411
426
|
formula1: "",
|
412
|
-
formula2:
|
413
|
-
}),
|
414
|
-
}),
|
415
|
-
return
|
416
|
-
var
|
417
|
-
((
|
418
|
-
}), /* @__PURE__ */ z(
|
419
|
-
/* @__PURE__ */
|
420
|
-
|
427
|
+
formula2: c
|
428
|
+
}), S("="), V(y.t("dataValidation.validFail.formulaError")));
|
429
|
+
}), de = ut(null), [Se, me] = H(!1);
|
430
|
+
return rr((T) => {
|
431
|
+
var v;
|
432
|
+
((v = de.current) == null ? void 0 : v.isClickOutSide(T)) && me(!1);
|
433
|
+
}), /* @__PURE__ */ z(Xe, { children: [
|
434
|
+
/* @__PURE__ */ _(K, { label: y.t("dataValidation.list.options"), children: /* @__PURE__ */ z(
|
435
|
+
hn,
|
421
436
|
{
|
422
437
|
value: u,
|
423
|
-
onChange: (
|
424
|
-
|
425
|
-
formula1:
|
426
|
-
formula2:
|
438
|
+
onChange: (T) => {
|
439
|
+
h(T), S(p), T === "1" && O({
|
440
|
+
formula1: p === "=" ? "" : p,
|
441
|
+
formula2: I.join(",")
|
427
442
|
});
|
428
443
|
},
|
429
444
|
children: [
|
430
|
-
/* @__PURE__ */
|
431
|
-
/* @__PURE__ */
|
445
|
+
/* @__PURE__ */ _(Oe, { value: "0", children: y.t("dataValidation.list.customOptions") }),
|
446
|
+
/* @__PURE__ */ _(Oe, { value: "1", children: y.t("dataValidation.list.refOptions") })
|
432
447
|
]
|
433
448
|
}
|
434
449
|
) }),
|
435
|
-
u === "1" ? /* @__PURE__ */ z(
|
436
|
-
/* @__PURE__ */
|
437
|
-
|
450
|
+
u === "1" ? /* @__PURE__ */ z(Xe, { children: [
|
451
|
+
/* @__PURE__ */ _(
|
452
|
+
ar,
|
438
453
|
{
|
439
|
-
initValue:
|
440
|
-
unitId:
|
454
|
+
initValue: d,
|
455
|
+
unitId: n,
|
441
456
|
subUnitId: o,
|
442
|
-
isFocus:
|
443
|
-
onChange: (
|
444
|
-
const
|
445
|
-
|
457
|
+
isFocus: Se,
|
458
|
+
onChange: (T = "") => {
|
459
|
+
const B = (T != null ? T : "").trim();
|
460
|
+
b(B), ne(B);
|
446
461
|
},
|
447
|
-
errorText:
|
448
|
-
onFocus: () =>
|
462
|
+
errorText: A || k || void 0,
|
463
|
+
onFocus: () => me(!0),
|
449
464
|
isSupportAcrossSheet: !0,
|
450
|
-
ref:
|
465
|
+
ref: de
|
451
466
|
}
|
452
467
|
),
|
453
|
-
|
454
|
-
|
468
|
+
te.length > 0 && /* @__PURE__ */ _("div", { style: { marginTop: "12px" }, children: te.map((T) => /* @__PURE__ */ _(
|
469
|
+
Ln,
|
455
470
|
{
|
456
|
-
item:
|
457
|
-
commonProps: { onItemChange:
|
471
|
+
item: T,
|
472
|
+
commonProps: { onItemChange: ge },
|
458
473
|
style: { marginBottom: 12 }
|
459
474
|
},
|
460
|
-
|
475
|
+
T.id
|
461
476
|
)) })
|
462
|
-
] }) : /* @__PURE__ */
|
463
|
-
/* @__PURE__ */
|
464
|
-
|
477
|
+
] }) : /* @__PURE__ */ _(K, { error: A, children: /* @__PURE__ */ z("div", { style: { marginTop: "-12px" }, children: [
|
478
|
+
/* @__PURE__ */ _(
|
479
|
+
ro,
|
465
480
|
{
|
466
|
-
list:
|
467
|
-
onListChange:
|
481
|
+
list: F,
|
482
|
+
onListChange: x,
|
468
483
|
rowHeight: 28,
|
469
484
|
margin: [0, 12],
|
470
485
|
draggableHandle: ".draggableHandle",
|
471
|
-
itemRender: (
|
472
|
-
|
486
|
+
itemRender: (T) => /* @__PURE__ */ _(
|
487
|
+
Ln,
|
473
488
|
{
|
474
|
-
item:
|
489
|
+
item: T,
|
475
490
|
commonProps: {
|
476
491
|
onItemChange: j,
|
477
492
|
onItemDelete: Z
|
478
493
|
}
|
479
494
|
},
|
480
|
-
|
495
|
+
T.id
|
481
496
|
),
|
482
497
|
idKey: "id"
|
483
498
|
}
|
484
499
|
),
|
485
|
-
/* @__PURE__ */ z(
|
486
|
-
|
487
|
-
|
488
|
-
|
500
|
+
/* @__PURE__ */ z(
|
501
|
+
"a",
|
502
|
+
{
|
503
|
+
className: `
|
504
|
+
univer-flex univer-w-fit univer-cursor-pointer univer-flex-row univer-items-center
|
505
|
+
univer-rounded univer-p-1 univer-px-2 univer-text-sm univer-text-primary
|
506
|
+
hover:univer-bg-primary-600/5
|
507
|
+
`,
|
508
|
+
onClick: ce,
|
509
|
+
children: [
|
510
|
+
/* @__PURE__ */ _(Sr, { className: "univer-mr-1" }),
|
511
|
+
y.t("dataValidation.list.add")
|
512
|
+
]
|
513
|
+
}
|
514
|
+
)
|
489
515
|
] }) })
|
490
516
|
] });
|
491
517
|
}
|
492
|
-
const
|
518
|
+
const ei = [
|
493
519
|
[
|
494
|
-
|
495
|
-
|
520
|
+
Gn,
|
521
|
+
$o
|
496
522
|
],
|
497
523
|
[
|
498
|
-
|
499
|
-
|
524
|
+
Tt,
|
525
|
+
Fo
|
500
526
|
],
|
501
527
|
[
|
502
|
-
|
503
|
-
|
528
|
+
dn,
|
529
|
+
Qo
|
504
530
|
],
|
505
531
|
[
|
506
|
-
|
507
|
-
|
532
|
+
Zn,
|
533
|
+
xo
|
508
534
|
]
|
509
535
|
];
|
510
|
-
var
|
511
|
-
for (var o =
|
512
|
-
(
|
536
|
+
var ti = Object.getOwnPropertyDescriptor, ni = (e, t, r, n) => {
|
537
|
+
for (var o = n > 1 ? void 0 : n ? ti(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
538
|
+
(a = e[i]) && (o = a(o) || o);
|
513
539
|
return o;
|
514
|
-
},
|
515
|
-
let
|
540
|
+
}, ri = (e, t) => (r, n) => t(r, n, e);
|
541
|
+
let ve = class {
|
516
542
|
constructor(e) {
|
517
543
|
E(this, "canvasRender", null);
|
518
544
|
E(this, "dropdownType");
|
519
545
|
E(this, "optionsInput");
|
520
|
-
E(this, "formulaInput",
|
546
|
+
E(this, "formulaInput", dn);
|
521
547
|
this.injector = e;
|
522
548
|
}
|
523
549
|
};
|
524
|
-
|
525
|
-
|
526
|
-
],
|
527
|
-
var
|
528
|
-
for (var o =
|
529
|
-
(
|
550
|
+
ve = ni([
|
551
|
+
ri(0, M(we))
|
552
|
+
], ve);
|
553
|
+
var oi = Object.getOwnPropertyDescriptor, ii = (e, t, r, n) => {
|
554
|
+
for (var o = n > 1 ? void 0 : n ? oi(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
555
|
+
(a = e[i]) && (o = a(o) || o);
|
530
556
|
return o;
|
531
|
-
},
|
532
|
-
let
|
533
|
-
constructor(t,
|
557
|
+
}, kn = (e, t) => (r, n) => t(r, n, e);
|
558
|
+
let _e = class extends Re {
|
559
|
+
constructor(t, r) {
|
534
560
|
super();
|
535
|
-
E(this, "_open$", new
|
536
|
-
E(this, "open$", this._open$.pipe(
|
561
|
+
E(this, "_open$", new On(!1));
|
562
|
+
E(this, "open$", this._open$.pipe(po()));
|
537
563
|
E(this, "_activeRule");
|
538
|
-
E(this, "_activeRule$", new
|
564
|
+
E(this, "_activeRule$", new On(void 0));
|
539
565
|
E(this, "activeRule$", this._activeRule$.asObservable());
|
540
566
|
E(this, "_closeDisposable", null);
|
541
|
-
this._univerInstanceService = t, this._sidebarService =
|
542
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
567
|
+
this._univerInstanceService = t, this._sidebarService = r, this.disposeWithMe(
|
568
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(W.UNIVER_SHEET).pipe(fn((n) => !n)).subscribe(() => {
|
543
569
|
this.close();
|
544
570
|
})
|
545
|
-
), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((
|
546
|
-
|
571
|
+
), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((n) => {
|
572
|
+
n.id === bt && (n.visible || setTimeout(() => {
|
547
573
|
this._sidebarService.sidebarOptions$.next({ visible: !1 });
|
548
574
|
}));
|
549
575
|
}));
|
@@ -566,7 +592,7 @@ let Se = class extends Ve {
|
|
566
592
|
this._open$.next(!1), (t = this._closeDisposable) == null || t.dispose();
|
567
593
|
}
|
568
594
|
setCloseDisposable(t) {
|
569
|
-
this._closeDisposable =
|
595
|
+
this._closeDisposable = kr(() => {
|
570
596
|
t.dispose(), this._closeDisposable = null;
|
571
597
|
});
|
572
598
|
}
|
@@ -574,42 +600,43 @@ let Se = class extends Ve {
|
|
574
600
|
this._activeRule = t, this._activeRule$.next(t);
|
575
601
|
}
|
576
602
|
};
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
],
|
581
|
-
|
582
|
-
|
583
|
-
|
603
|
+
_e = ii([
|
604
|
+
kn(0, le),
|
605
|
+
kn(1, or)
|
606
|
+
], _e);
|
607
|
+
const Sn = "sheets-data-validation-ui.config", Mt = {};
|
608
|
+
var ai = Object.getOwnPropertyDescriptor, si = (e, t, r, n) => {
|
609
|
+
for (var o = n > 1 ? void 0 : n ? ai(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
610
|
+
(a = e[i]) && (o = a(o) || o);
|
584
611
|
return o;
|
585
|
-
},
|
586
|
-
let
|
587
|
-
constructor(e, t,
|
588
|
-
super(), this._sheetInterceptorService = e, this._dataValidationModel = t, this._dataValidatorRegistryService =
|
612
|
+
}, xe = (e, t) => (r, n) => t(r, n, e);
|
613
|
+
let Ze = class extends Re {
|
614
|
+
constructor(e, t, r, n, o, i) {
|
615
|
+
super(), this._sheetInterceptorService = e, this._dataValidationModel = t, this._dataValidatorRegistryService = r, this._dialogService = n, this._localeService = o, this._sheetsDataValidationValidatorService = i, this._initEditorBridgeInterceptor();
|
589
616
|
}
|
590
617
|
_initEditorBridgeInterceptor() {
|
591
618
|
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
592
|
-
|
619
|
+
Ro,
|
593
620
|
{
|
594
|
-
handler: async (e, t,
|
595
|
-
const
|
596
|
-
if (
|
597
|
-
return
|
598
|
-
if (!
|
599
|
-
return
|
600
|
-
const u = this._dataValidatorRegistryService.getValidatorItem(
|
601
|
-
return !u || await this._sheetsDataValidationValidatorService.validatorCell(
|
621
|
+
handler: async (e, t, r) => {
|
622
|
+
const n = await e, { row: o, col: i, unitId: a, subUnitId: l } = t, s = this._dataValidationModel.getRuleIdByLocation(a, l, o, i), c = s ? this._dataValidationModel.getRuleById(a, l, s) : void 0;
|
623
|
+
if (n === !1)
|
624
|
+
return r(Promise.resolve(!1));
|
625
|
+
if (!c || c.errorStyle !== lt.STOP)
|
626
|
+
return r(Promise.resolve(!0));
|
627
|
+
const u = this._dataValidatorRegistryService.getValidatorItem(c.type);
|
628
|
+
return !u || await this._sheetsDataValidationValidatorService.validatorCell(a, l, o, i) === je.VALID ? r(Promise.resolve(!0)) : (this._dialogService.open({
|
602
629
|
width: 368,
|
603
630
|
title: {
|
604
631
|
title: this._localeService.t("dataValidation.alert.title")
|
605
632
|
},
|
606
633
|
id: "reject-input-dialog",
|
607
634
|
children: {
|
608
|
-
title: u.getRuleFinalError(
|
635
|
+
title: u.getRuleFinalError(c, { row: o, col: i, unitId: a, subUnitId: l })
|
609
636
|
},
|
610
637
|
footer: {
|
611
|
-
title:
|
612
|
-
|
638
|
+
title: En.createElement(
|
639
|
+
ze,
|
613
640
|
{
|
614
641
|
variant: "primary",
|
615
642
|
onClick: () => this._dialogService.close("reject-input-dialog")
|
@@ -620,7 +647,7 @@ let Je = class extends Ve {
|
|
620
647
|
onClose: () => {
|
621
648
|
this._dialogService.close("reject-input-dialog");
|
622
649
|
}
|
623
|
-
}),
|
650
|
+
}), r(Promise.resolve(!1)));
|
624
651
|
}
|
625
652
|
}
|
626
653
|
);
|
@@ -636,8 +663,8 @@ let Je = class extends Ve {
|
|
636
663
|
title: e
|
637
664
|
},
|
638
665
|
footer: {
|
639
|
-
title:
|
640
|
-
|
666
|
+
title: En.createElement(
|
667
|
+
ze,
|
641
668
|
{
|
642
669
|
variant: "primary",
|
643
670
|
onClick: () => this._dialogService.close("reject-input-dialog")
|
@@ -651,31 +678,31 @@ let Je = class extends Ve {
|
|
651
678
|
});
|
652
679
|
}
|
653
680
|
};
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
],
|
662
|
-
var
|
663
|
-
for (var o =
|
664
|
-
(
|
681
|
+
Ze = si([
|
682
|
+
xe(0, M(vn)),
|
683
|
+
xe(1, M(ee)),
|
684
|
+
xe(2, M(ye)),
|
685
|
+
xe(3, io),
|
686
|
+
xe(4, M(se)),
|
687
|
+
xe(5, M(Zr))
|
688
|
+
], Ze);
|
689
|
+
var li = Object.getOwnPropertyDescriptor, ci = (e, t, r, n) => {
|
690
|
+
for (var o = n > 1 ? void 0 : n ? li(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
691
|
+
(a = e[i]) && (o = a(o) || o);
|
665
692
|
return o;
|
666
|
-
},
|
667
|
-
const
|
693
|
+
}, ue = (e, t) => (r, n) => t(r, n, e);
|
694
|
+
const Ft = (e) => {
|
668
695
|
if (e == null || typeof e == "boolean")
|
669
696
|
return;
|
670
697
|
if (typeof e == "number" || !Number.isNaN(+e))
|
671
|
-
return
|
672
|
-
const t =
|
698
|
+
return wn(Hn.format("yyyy-MM-dd HH:mm:ss", Number(e)));
|
699
|
+
const t = wn(e);
|
673
700
|
if (t.isValid())
|
674
701
|
return t;
|
675
702
|
};
|
676
|
-
function
|
677
|
-
const
|
678
|
-
if (e ===
|
703
|
+
function di(e, t) {
|
704
|
+
const r = Eo(t);
|
705
|
+
if (e === r)
|
679
706
|
return t;
|
680
707
|
switch (e) {
|
681
708
|
case "datetime":
|
@@ -686,15 +713,15 @@ function wi(e, t) {
|
|
686
713
|
return "HH:mm:ss";
|
687
714
|
}
|
688
715
|
}
|
689
|
-
let
|
690
|
-
constructor(t,
|
716
|
+
let Ae = class extends Re {
|
717
|
+
constructor(t, r, n, o, i, a, l, s, c, u, h) {
|
691
718
|
super();
|
692
719
|
E(this, "_activeDropdown");
|
693
|
-
E(this, "_activeDropdown$", new
|
720
|
+
E(this, "_activeDropdown$", new go());
|
694
721
|
E(this, "_currentPopup", null);
|
695
722
|
E(this, "activeDropdown$", this._activeDropdown$.asObservable());
|
696
723
|
E(this, "_zenVisible", !1);
|
697
|
-
this._univerInstanceService = t, this._dataValidatorRegistryService =
|
724
|
+
this._univerInstanceService = t, this._dataValidatorRegistryService = r, this._zenZoneService = n, this._dataValidationModel = o, this._sheetsSelectionsService = i, this._cellDropdownManagerService = a, this._sheetDataValidationModel = l, this._commandService = s, this._editorBridgeService = c, this._injector = u, this._configService = h, this._init(), this._initSelectionChange(), this.disposeWithMe(() => {
|
698
725
|
this._activeDropdown$.complete();
|
699
726
|
});
|
700
727
|
}
|
@@ -706,14 +733,14 @@ let Pe = class extends Ve {
|
|
706
733
|
this._zenVisible = t, t && this.hideDropdown();
|
707
734
|
}));
|
708
735
|
}
|
709
|
-
_getDropdownByCell(t,
|
710
|
-
const i = t ? this._univerInstanceService.getUnit(t,
|
736
|
+
_getDropdownByCell(t, r, n, o) {
|
737
|
+
const i = t ? this._univerInstanceService.getUnit(t, W.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitForType(W.UNIVER_SHEET);
|
711
738
|
if (!i)
|
712
739
|
return;
|
713
|
-
const
|
714
|
-
if (!
|
740
|
+
const a = r ? i.getSheetBySheetId(r) : i.getActiveSheet();
|
741
|
+
if (!a)
|
715
742
|
return;
|
716
|
-
const l = this._dataValidationModel.getRuleByLocation(i.getUnitId(),
|
743
|
+
const l = this._dataValidationModel.getRuleByLocation(i.getUnitId(), a.getSheetId(), n, o);
|
717
744
|
if (!l)
|
718
745
|
return;
|
719
746
|
const s = this._dataValidatorRegistryService.getValidatorItem(l.type);
|
@@ -721,379 +748,381 @@ let Pe = class extends Ve {
|
|
721
748
|
}
|
722
749
|
_initSelectionChange() {
|
723
750
|
this.disposeWithMe(this._sheetsSelectionsService.selectionMoveEnd$.subscribe((t) => {
|
724
|
-
t && t.every((
|
751
|
+
t && t.every((r) => !(r.primary && this._getDropdownByCell(r.primary.unitId, r.primary.sheetId, r.primary.actualRow, r.primary.actualColumn))) && this.hideDropdown();
|
725
752
|
}));
|
726
753
|
}
|
727
|
-
// eslint-disable-next-line max-lines-per-function
|
754
|
+
// eslint-disable-next-line max-lines-per-function, complexity
|
728
755
|
showDropdown(t) {
|
729
|
-
var
|
730
|
-
const { location:
|
756
|
+
var b, y, g, f;
|
757
|
+
const { location: r } = t, { row: n, col: o, unitId: i, subUnitId: a, workbook: l, worksheet: s } = r;
|
731
758
|
if (this._currentPopup && this._currentPopup.dispose(), this._zenVisible)
|
732
759
|
return;
|
733
760
|
this._activeDropdown = t, this._activeDropdown$.next(this._activeDropdown);
|
734
|
-
const
|
735
|
-
if (!
|
761
|
+
const c = this._sheetDataValidationModel.getRuleByLocation(i, a, n, o);
|
762
|
+
if (!c)
|
736
763
|
return;
|
737
|
-
const u = this._dataValidatorRegistryService.getValidatorItem(
|
764
|
+
const u = this._dataValidatorRegistryService.getValidatorItem(c.type);
|
738
765
|
if (!(u != null && u.dropdownType))
|
739
766
|
return;
|
740
|
-
let
|
741
|
-
const
|
742
|
-
var
|
767
|
+
let h;
|
768
|
+
const d = async (m, I) => {
|
769
|
+
var P, L, O;
|
743
770
|
if (!m)
|
744
771
|
return !0;
|
745
|
-
const
|
746
|
-
return
|
747
|
-
value:
|
772
|
+
const w = m, C = s.getCell(n, o), R = w.format(I === "date" ? "YYYY-MM-DD 00:00:00" : "YYYY-MM-DD HH:mm:ss"), D = (P = Hn.parseDate(R)) == null ? void 0 : P.v, k = I === "time" ? D % 1 : D, V = l.getStyles().getStyleByCell(C), A = (O = (L = V == null ? void 0 : V.n) == null ? void 0 : L.pattern) != null ? O : "";
|
773
|
+
return c.errorStyle !== lt.STOP || await u.validator({
|
774
|
+
value: k,
|
748
775
|
unitId: i,
|
749
|
-
subUnitId:
|
750
|
-
row:
|
776
|
+
subUnitId: a,
|
777
|
+
row: n,
|
751
778
|
column: o,
|
752
779
|
worksheet: s,
|
753
780
|
workbook: l,
|
754
|
-
interceptValue:
|
755
|
-
t:
|
756
|
-
},
|
781
|
+
interceptValue: R.replace("Z", "").replace("T", " "),
|
782
|
+
t: Ur.NUMBER
|
783
|
+
}, c) ? (await this._commandService.executeCommand(gt.id, {
|
757
784
|
visible: !1,
|
758
|
-
eventType:
|
785
|
+
eventType: pt.Keyboard,
|
759
786
|
unitId: i,
|
760
|
-
keycode:
|
761
|
-
}), await this._commandService.executeCommand(
|
787
|
+
keycode: ht.ESC
|
788
|
+
}), await this._commandService.executeCommand(st.id, {
|
762
789
|
unitId: i,
|
763
|
-
subUnitId:
|
790
|
+
subUnitId: a,
|
764
791
|
range: {
|
765
792
|
startColumn: o,
|
766
793
|
endColumn: o,
|
767
|
-
startRow:
|
768
|
-
endRow:
|
794
|
+
startRow: n,
|
795
|
+
endRow: n
|
769
796
|
},
|
770
797
|
value: {
|
771
|
-
v:
|
798
|
+
v: k,
|
772
799
|
t: 2,
|
773
800
|
p: null,
|
774
801
|
f: null,
|
775
802
|
si: null,
|
776
803
|
s: {
|
777
804
|
n: {
|
778
|
-
pattern:
|
805
|
+
pattern: di(I, A)
|
779
806
|
}
|
780
807
|
}
|
781
808
|
}
|
782
|
-
}), !0) : (this._injector.has(
|
809
|
+
}), !0) : (this._injector.has(Ze) && this._injector.get(Ze).showReject(u.getRuleFinalError(c, { row: n, col: o, unitId: i, subUnitId: a })), !1);
|
783
810
|
};
|
784
|
-
let
|
811
|
+
let S;
|
785
812
|
switch (u.dropdownType) {
|
786
|
-
case
|
787
|
-
const m =
|
788
|
-
|
789
|
-
location:
|
813
|
+
case pe.DATE: {
|
814
|
+
const m = Q(s.getCellRaw(n, o)), I = Ft(m), w = !!((b = c.bizInfo) != null && b.showTime);
|
815
|
+
S = {
|
816
|
+
location: r,
|
790
817
|
type: "datepicker",
|
791
818
|
props: {
|
792
|
-
showTime:
|
793
|
-
onChange: (
|
794
|
-
defaultValue:
|
819
|
+
showTime: w,
|
820
|
+
onChange: (C) => d(C, w ? "datetime" : "date"),
|
821
|
+
defaultValue: I,
|
795
822
|
patternType: "date"
|
796
823
|
}
|
797
824
|
};
|
798
825
|
break;
|
799
826
|
}
|
800
|
-
case
|
801
|
-
const m =
|
802
|
-
|
803
|
-
location:
|
827
|
+
case pe.TIME: {
|
828
|
+
const m = Q(s.getCellRaw(n, o)), I = Ft(m);
|
829
|
+
S = {
|
830
|
+
location: r,
|
804
831
|
type: "datepicker",
|
805
832
|
props: {
|
806
|
-
onChange: (
|
807
|
-
defaultValue:
|
833
|
+
onChange: (w) => d(w, "time"),
|
834
|
+
defaultValue: I,
|
808
835
|
patternType: "time"
|
809
836
|
}
|
810
837
|
};
|
811
838
|
break;
|
812
839
|
}
|
813
|
-
case
|
814
|
-
const m =
|
815
|
-
|
816
|
-
location:
|
840
|
+
case pe.DATETIME: {
|
841
|
+
const m = Q(s.getCellRaw(n, o)), I = Ft(m);
|
842
|
+
S = {
|
843
|
+
location: r,
|
817
844
|
type: "datepicker",
|
818
845
|
props: {
|
819
|
-
onChange: (
|
820
|
-
defaultValue:
|
846
|
+
onChange: (w) => d(w, "datetime"),
|
847
|
+
defaultValue: I,
|
821
848
|
patternType: "datetime"
|
822
849
|
}
|
823
850
|
};
|
824
851
|
break;
|
825
852
|
}
|
826
|
-
case
|
827
|
-
case
|
828
|
-
const m = u.dropdownType ===
|
829
|
-
const
|
853
|
+
case pe.LIST:
|
854
|
+
case pe.MULTIPLE_LIST: {
|
855
|
+
const m = u.dropdownType === pe.MULTIPLE_LIST, I = async (V) => {
|
856
|
+
const A = Kn(V), P = {
|
830
857
|
unitId: i,
|
831
|
-
subUnitId:
|
858
|
+
subUnitId: a,
|
832
859
|
range: {
|
833
860
|
startColumn: o,
|
834
861
|
endColumn: o,
|
835
|
-
startRow:
|
836
|
-
endRow:
|
862
|
+
startRow: n,
|
863
|
+
endRow: n
|
837
864
|
},
|
838
865
|
value: {
|
839
|
-
v:
|
866
|
+
v: A,
|
840
867
|
p: null,
|
841
868
|
f: null,
|
842
869
|
si: null
|
843
870
|
}
|
844
871
|
};
|
845
|
-
return this._editorBridgeService.isVisible().visible && await this._commandService.executeCommand(
|
872
|
+
return this._editorBridgeService.isVisible().visible && await this._commandService.executeCommand(gt.id, {
|
846
873
|
visible: !1,
|
847
|
-
eventType:
|
874
|
+
eventType: pt.Keyboard,
|
848
875
|
unitId: i,
|
849
|
-
keycode:
|
850
|
-
}), this._commandService.executeCommand(
|
851
|
-
},
|
852
|
-
this._commandService.executeCommand(
|
853
|
-
ruleId:
|
854
|
-
}),
|
855
|
-
},
|
856
|
-
label:
|
857
|
-
value:
|
858
|
-
color:
|
876
|
+
keycode: ht.ESC
|
877
|
+
}), this._commandService.executeCommand(st.id, P), !m;
|
878
|
+
}, w = (c == null ? void 0 : c.renderMode) === oe.CUSTOM || (c == null ? void 0 : c.renderMode) === void 0, C = u.getListWithColor(c, i, a), R = kt(s.getCellRaw(n, o)), D = () => {
|
879
|
+
this._commandService.executeCommand(Fe.id, {
|
880
|
+
ruleId: c.uid
|
881
|
+
}), h == null || h.dispose();
|
882
|
+
}, k = C.map((V) => ({
|
883
|
+
label: V.label,
|
884
|
+
value: V.label,
|
885
|
+
color: w || V.color ? V.color : "transparent"
|
859
886
|
}));
|
860
|
-
|
861
|
-
location:
|
887
|
+
S = {
|
888
|
+
location: r,
|
862
889
|
type: "list",
|
863
890
|
props: {
|
864
|
-
onChange: (
|
865
|
-
options:
|
866
|
-
onEdit:
|
867
|
-
defaultValue:
|
868
|
-
multiple: m
|
891
|
+
onChange: (V) => I(V),
|
892
|
+
options: k,
|
893
|
+
onEdit: D,
|
894
|
+
defaultValue: R,
|
895
|
+
multiple: m,
|
896
|
+
showEdit: (g = (y = this._configService.getConfig(Sn)) == null ? void 0 : y.showEditOnDropdown) != null ? g : !0
|
869
897
|
}
|
870
898
|
};
|
871
899
|
break;
|
872
900
|
}
|
873
|
-
case
|
874
|
-
|
901
|
+
case pe.CASCADE: {
|
902
|
+
S = {
|
875
903
|
type: "cascader",
|
876
904
|
props: {
|
877
|
-
onChange: (
|
878
|
-
const
|
905
|
+
onChange: (I) => {
|
906
|
+
const w = {
|
879
907
|
unitId: i,
|
880
|
-
subUnitId:
|
908
|
+
subUnitId: a,
|
881
909
|
range: {
|
882
910
|
startColumn: o,
|
883
911
|
endColumn: o,
|
884
|
-
startRow:
|
885
|
-
endRow:
|
912
|
+
startRow: n,
|
913
|
+
endRow: n
|
886
914
|
},
|
887
915
|
value: {
|
888
|
-
v:
|
916
|
+
v: I.join("/"),
|
889
917
|
p: null,
|
890
918
|
f: null,
|
891
919
|
si: null
|
892
920
|
}
|
893
921
|
};
|
894
|
-
return this._editorBridgeService.isVisible().visible && this._commandService.syncExecuteCommand(
|
922
|
+
return this._editorBridgeService.isVisible().visible && this._commandService.syncExecuteCommand(gt.id, {
|
895
923
|
visible: !1,
|
896
|
-
eventType:
|
924
|
+
eventType: pt.Keyboard,
|
897
925
|
unitId: i,
|
898
|
-
keycode:
|
899
|
-
}), this._commandService.syncExecuteCommand(
|
926
|
+
keycode: ht.ESC
|
927
|
+
}), this._commandService.syncExecuteCommand(st.id, w), !0;
|
900
928
|
},
|
901
|
-
defaultValue:
|
902
|
-
options: JSON.parse((
|
929
|
+
defaultValue: kt(s.getCellRaw(n, o)).split("/"),
|
930
|
+
options: JSON.parse((f = c.formula1) != null ? f : "[]")
|
903
931
|
},
|
904
|
-
location:
|
932
|
+
location: r
|
905
933
|
};
|
906
934
|
break;
|
907
935
|
}
|
908
|
-
case
|
909
|
-
|
936
|
+
case pe.COLOR: {
|
937
|
+
S = {
|
910
938
|
type: "color",
|
911
939
|
props: {
|
912
|
-
onChange: (
|
913
|
-
const
|
940
|
+
onChange: (I) => {
|
941
|
+
const w = {
|
914
942
|
unitId: i,
|
915
|
-
subUnitId:
|
943
|
+
subUnitId: a,
|
916
944
|
range: {
|
917
945
|
startColumn: o,
|
918
946
|
endColumn: o,
|
919
|
-
startRow:
|
920
|
-
endRow:
|
947
|
+
startRow: n,
|
948
|
+
endRow: n
|
921
949
|
},
|
922
950
|
value: {
|
923
|
-
v:
|
951
|
+
v: I,
|
924
952
|
p: null,
|
925
953
|
f: null,
|
926
954
|
si: null
|
927
955
|
}
|
928
956
|
};
|
929
|
-
return this._editorBridgeService.isVisible().visible && this._commandService.syncExecuteCommand(
|
957
|
+
return this._editorBridgeService.isVisible().visible && this._commandService.syncExecuteCommand(gt.id, {
|
930
958
|
visible: !1,
|
931
|
-
eventType:
|
959
|
+
eventType: pt.Keyboard,
|
932
960
|
unitId: i,
|
933
|
-
keycode:
|
934
|
-
}), this._commandService.syncExecuteCommand(
|
961
|
+
keycode: ht.ESC
|
962
|
+
}), this._commandService.syncExecuteCommand(st.id, w), !0;
|
935
963
|
},
|
936
|
-
defaultValue:
|
964
|
+
defaultValue: kt(s.getCellRaw(n, o))
|
937
965
|
},
|
938
|
-
location:
|
966
|
+
location: r
|
939
967
|
};
|
940
968
|
break;
|
941
969
|
}
|
942
970
|
default:
|
943
971
|
throw new Error("[DataValidationDropdownManagerService]: unknown type!");
|
944
972
|
}
|
945
|
-
if (
|
973
|
+
if (h = this._cellDropdownManagerService.showDropdown(S), !h)
|
946
974
|
throw new Error("[DataValidationDropdownManagerService]: cannot show dropdown!");
|
947
|
-
const
|
948
|
-
|
975
|
+
const p = new Nr();
|
976
|
+
p.add(h), p.add({
|
949
977
|
dispose: () => {
|
950
|
-
var m,
|
951
|
-
(
|
978
|
+
var m, I;
|
979
|
+
(I = (m = this._activeDropdown) == null ? void 0 : m.onHide) == null || I.call(m);
|
952
980
|
}
|
953
|
-
}), this._currentPopup =
|
981
|
+
}), this._currentPopup = p;
|
954
982
|
}
|
955
983
|
hideDropdown() {
|
956
984
|
this._activeDropdown && (this._currentPopup && this._currentPopup.dispose(), this._currentPopup = null, this._activeDropdown = null, this._activeDropdown$.next(null));
|
957
985
|
}
|
958
|
-
showDataValidationDropdown(t,
|
959
|
-
const
|
960
|
-
if (!
|
986
|
+
showDataValidationDropdown(t, r, n, o, i) {
|
987
|
+
const a = this._univerInstanceService.getUnit(t, W.UNIVER_SHEET);
|
988
|
+
if (!a)
|
961
989
|
return;
|
962
|
-
const l =
|
990
|
+
const l = a.getSheetBySheetId(r);
|
963
991
|
if (!l)
|
964
992
|
return;
|
965
|
-
const s = this._dataValidationModel.getRuleByLocation(
|
993
|
+
const s = this._dataValidationModel.getRuleByLocation(a.getUnitId(), l.getSheetId(), n, o);
|
966
994
|
if (!s)
|
967
995
|
return;
|
968
|
-
const
|
969
|
-
if (!
|
996
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(s.type);
|
997
|
+
if (!c || !c.dropdownType) {
|
970
998
|
this.hideDropdown();
|
971
999
|
return;
|
972
1000
|
}
|
973
1001
|
this.showDropdown({
|
974
1002
|
location: {
|
975
|
-
workbook:
|
1003
|
+
workbook: a,
|
976
1004
|
worksheet: l,
|
977
|
-
row:
|
1005
|
+
row: n,
|
978
1006
|
col: o,
|
979
1007
|
unitId: t,
|
980
|
-
subUnitId:
|
1008
|
+
subUnitId: r
|
981
1009
|
},
|
982
1010
|
onHide: i
|
983
1011
|
});
|
984
1012
|
}
|
985
1013
|
};
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
1014
|
+
Ae = ci([
|
1015
|
+
ue(0, le),
|
1016
|
+
ue(1, M(ye)),
|
1017
|
+
ue(2, ir),
|
1018
|
+
ue(3, M(ee)),
|
1019
|
+
ue(4, M(dr)),
|
1020
|
+
ue(5, M(Do)),
|
1021
|
+
ue(6, M(ee)),
|
1022
|
+
ue(7, J),
|
1023
|
+
ue(8, gr),
|
1024
|
+
ue(9, M(we)),
|
1025
|
+
ue(10, ln)
|
1026
|
+
], Ae);
|
1027
|
+
const bt = "DataValidationPanel", Fe = {
|
999
1028
|
id: "data-validation.operation.open-validation-panel",
|
1000
|
-
type:
|
1029
|
+
type: nt.OPERATION,
|
1001
1030
|
handler(e, t) {
|
1002
1031
|
if (!t)
|
1003
1032
|
return !1;
|
1004
|
-
const { ruleId:
|
1033
|
+
const { ruleId: r, isAdd: n } = t, o = e.get(_e), i = e.get(mn), a = e.get(le), l = e.get(or), s = ur(a);
|
1005
1034
|
if (!s) return !1;
|
1006
|
-
const { unitId:
|
1007
|
-
o.open(), o.setActiveRule(
|
1008
|
-
unitId:
|
1035
|
+
const { unitId: c, subUnitId: u } = s, h = r ? i.getRuleById(c, u, r) : void 0;
|
1036
|
+
o.open(), o.setActiveRule(h && {
|
1037
|
+
unitId: c,
|
1009
1038
|
subUnitId: u,
|
1010
|
-
rule:
|
1039
|
+
rule: h
|
1011
1040
|
});
|
1012
|
-
const
|
1041
|
+
const d = l.open({
|
1013
1042
|
id: bt,
|
1014
|
-
header: { title:
|
1043
|
+
header: { title: n ? "dataValidation.panel.addTitle" : "dataValidation.panel.title" },
|
1015
1044
|
children: { label: bt },
|
1016
1045
|
width: 312,
|
1017
1046
|
onClose: () => o.close()
|
1018
1047
|
});
|
1019
|
-
return o.setCloseDisposable(
|
1048
|
+
return o.setCloseDisposable(d), !0;
|
1020
1049
|
}
|
1021
|
-
},
|
1050
|
+
}, Cn = {
|
1022
1051
|
id: "data-validation.operation.close-validation-panel",
|
1023
|
-
type:
|
1052
|
+
type: nt.OPERATION,
|
1024
1053
|
handler(e) {
|
1025
|
-
return e.get(
|
1054
|
+
return e.get(_e).close(), !0;
|
1026
1055
|
}
|
1027
|
-
},
|
1056
|
+
}, Rr = {
|
1028
1057
|
id: "data-validation.operation.toggle-validation-panel",
|
1029
|
-
type:
|
1058
|
+
type: nt.OPERATION,
|
1030
1059
|
handler(e) {
|
1031
|
-
const t = e.get(
|
1032
|
-
return
|
1060
|
+
const t = e.get(J), r = e.get(_e);
|
1061
|
+
return r.open(), r.isOpen ? t.executeCommand(Cn.id) : t.executeCommand(Fe.id), !0;
|
1033
1062
|
}
|
1034
|
-
},
|
1035
|
-
type:
|
1063
|
+
}, At = {
|
1064
|
+
type: nt.OPERATION,
|
1036
1065
|
id: "sheet.operation.show-data-validation-dropdown",
|
1037
1066
|
handler(e, t) {
|
1038
1067
|
if (!t)
|
1039
1068
|
return !1;
|
1040
|
-
const
|
1041
|
-
return s && s.unitId ===
|
1042
|
-
|
1069
|
+
const r = e.get(Ae), { unitId: n, subUnitId: o, row: i, column: a } = t, l = r.activeDropdown, s = l == null ? void 0 : l.location;
|
1070
|
+
return s && s.unitId === n && s.subUnitId === o && s.row === i && s.col === a || r.showDataValidationDropdown(
|
1071
|
+
n,
|
1043
1072
|
o,
|
1044
1073
|
i,
|
1045
|
-
|
1074
|
+
a
|
1046
1075
|
), !0;
|
1047
1076
|
}
|
1048
|
-
},
|
1049
|
-
type:
|
1077
|
+
}, yr = {
|
1078
|
+
type: nt.OPERATION,
|
1050
1079
|
id: "sheet.operation.hide-data-validation-dropdown",
|
1051
1080
|
handler(e, t) {
|
1052
|
-
return t ? (e.get(
|
1081
|
+
return t ? (e.get(Ae).hideDropdown(), !0) : !1;
|
1053
1082
|
}
|
1054
|
-
},
|
1055
|
-
type:
|
1083
|
+
}, Lt = {
|
1084
|
+
type: nt.COMMAND,
|
1056
1085
|
id: "data-validation.command.addRuleAndOpen",
|
1057
1086
|
handler(e) {
|
1058
|
-
const t = e.get(
|
1059
|
-
if (!
|
1060
|
-
const { workbook:
|
1087
|
+
const t = e.get(le), r = ur(t);
|
1088
|
+
if (!r) return !1;
|
1089
|
+
const { workbook: n, worksheet: o } = r, i = qn(e), a = e.get(J), l = n.getUnitId(), s = o.getSheetId(), c = {
|
1061
1090
|
rule: i,
|
1062
1091
|
unitId: l,
|
1063
1092
|
subUnitId: s
|
1064
1093
|
};
|
1065
|
-
return
|
1094
|
+
return a.syncExecuteCommand(un.id, c) ? (a.syncExecuteCommand(Fe.id, {
|
1066
1095
|
ruleId: i.uid,
|
1067
1096
|
isAdd: !0
|
1068
1097
|
}), !0) : !1;
|
1069
1098
|
}
|
1070
|
-
}
|
1071
|
-
var
|
1072
|
-
for (var o =
|
1073
|
-
(
|
1099
|
+
};
|
1100
|
+
var ui = Object.getOwnPropertyDescriptor, hi = (e, t, r, n) => {
|
1101
|
+
for (var o = n > 1 ? void 0 : n ? ui(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
1102
|
+
(a = e[i]) && (o = a(o) || o);
|
1074
1103
|
return o;
|
1075
|
-
},
|
1104
|
+
}, $e = (e, t) => (r, n) => t(r, n, e);
|
1076
1105
|
const Me = "SHEET_DATA_VALIDATION_ALERT";
|
1077
|
-
let
|
1078
|
-
constructor(e, t,
|
1079
|
-
super(), this._hoverManagerService = e, this._cellAlertManagerService = t, this._univerInstanceService =
|
1106
|
+
let dt = class extends Re {
|
1107
|
+
constructor(e, t, r, n, o, i) {
|
1108
|
+
super(), this._hoverManagerService = e, this._cellAlertManagerService = t, this._univerInstanceService = r, this._localeService = n, this._zenZoneService = o, this._dataValidationModel = i, this._init();
|
1080
1109
|
}
|
1081
1110
|
_init() {
|
1082
1111
|
this._initCellAlertPopup(), this._initZenService();
|
1083
1112
|
}
|
1084
1113
|
_initCellAlertPopup() {
|
1085
|
-
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(
|
1114
|
+
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(sr(100)).subscribe((e) => {
|
1086
1115
|
var t;
|
1087
1116
|
if (e) {
|
1088
|
-
const
|
1089
|
-
if (!
|
1117
|
+
const r = this._univerInstanceService.getUnit(e.location.unitId, W.UNIVER_SHEET), n = r.getSheetBySheetId(e.location.subUnitId);
|
1118
|
+
if (!n) return;
|
1090
1119
|
const o = this._dataValidationModel.getRuleByLocation(e.location.unitId, e.location.subUnitId, e.location.row, e.location.col);
|
1091
1120
|
if (!o) {
|
1092
1121
|
this._cellAlertManagerService.removeAlert(Me);
|
1093
1122
|
return;
|
1094
1123
|
}
|
1095
|
-
if (this._dataValidationModel.validator(o, { ...e.location, workbook:
|
1096
|
-
const
|
1124
|
+
if (this._dataValidationModel.validator(o, { ...e.location, workbook: r, worksheet: n }) === je.INVALID) {
|
1125
|
+
const a = this._cellAlertManagerService.currentAlert.get(Me), l = (t = a == null ? void 0 : a.alert) == null ? void 0 : t.location;
|
1097
1126
|
if (l && l.row === e.location.row && l.col === e.location.col && l.subUnitId === e.location.subUnitId && l.unitId === e.location.unitId) {
|
1098
1127
|
this._cellAlertManagerService.removeAlert(Me);
|
1099
1128
|
return;
|
@@ -1104,7 +1133,7 @@ let ht = class extends Ve {
|
|
1104
1133
|
return;
|
1105
1134
|
}
|
1106
1135
|
this._cellAlertManagerService.showAlert({
|
1107
|
-
type:
|
1136
|
+
type: To.ERROR,
|
1108
1137
|
title: this._localeService.t("dataValidation.error.title"),
|
1109
1138
|
message: s == null ? void 0 : s.getRuleFinalError(o, e.location),
|
1110
1139
|
location: e.location,
|
@@ -1124,341 +1153,341 @@ let ht = class extends Ve {
|
|
1124
1153
|
}));
|
1125
1154
|
}
|
1126
1155
|
};
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
],
|
1135
|
-
var
|
1136
|
-
for (var o =
|
1137
|
-
(
|
1156
|
+
dt = hi([
|
1157
|
+
$e(0, M(Vo)),
|
1158
|
+
$e(1, M(Oo)),
|
1159
|
+
$e(2, le),
|
1160
|
+
$e(3, M(se)),
|
1161
|
+
$e(4, ir),
|
1162
|
+
$e(5, M(ee))
|
1163
|
+
], dt);
|
1164
|
+
var pi = Object.getOwnPropertyDescriptor, gi = (e, t, r, n) => {
|
1165
|
+
for (var o = n > 1 ? void 0 : n ? pi(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
1166
|
+
(a = e[i]) && (o = a(o) || o);
|
1138
1167
|
return o;
|
1139
|
-
}, xt = (e, t) => (
|
1140
|
-
let
|
1141
|
-
constructor(e, t,
|
1142
|
-
super(), this._autoFillService = e, this._sheetDataValidationModel = t, this._injector =
|
1168
|
+
}, xt = (e, t) => (r, n) => t(r, n, e);
|
1169
|
+
let qe = class extends Re {
|
1170
|
+
constructor(e, t, r) {
|
1171
|
+
super(), this._autoFillService = e, this._sheetDataValidationModel = t, this._injector = r, this._initAutoFill();
|
1143
1172
|
}
|
1144
1173
|
// eslint-disable-next-line max-lines-per-function
|
1145
1174
|
_initAutoFill() {
|
1146
|
-
const e = () => ({ redos: [], undos: [] }), t = (
|
1147
|
-
const { source: i, target:
|
1148
|
-
row:
|
1149
|
-
col:
|
1150
|
-
},
|
1151
|
-
|
1152
|
-
const
|
1153
|
-
startRow:
|
1154
|
-
startColumn:
|
1155
|
-
endColumn:
|
1156
|
-
endRow:
|
1157
|
-
},
|
1158
|
-
startRow:
|
1159
|
-
startColumn:
|
1160
|
-
endColumn:
|
1161
|
-
endRow:
|
1175
|
+
const e = () => ({ redos: [], undos: [] }), t = (n, o) => {
|
1176
|
+
const { source: i, target: a, unitId: l, subUnitId: s } = n, c = this._sheetDataValidationModel.getRuleObjectMatrix(l, s).clone(), u = nn([i, a]), [h, d] = u.ranges, { mapFunc: S } = u, p = {
|
1177
|
+
row: h.startRow,
|
1178
|
+
col: h.startColumn
|
1179
|
+
}, b = Ao(h, d), y = new wt(), g = /* @__PURE__ */ new Set();
|
1180
|
+
b.forEach((C) => {
|
1181
|
+
const R = C.repeatStartCell, D = C.relativeRange, k = {
|
1182
|
+
startRow: p.row,
|
1183
|
+
startColumn: p.col,
|
1184
|
+
endColumn: p.col,
|
1185
|
+
endRow: p.row
|
1186
|
+
}, V = {
|
1187
|
+
startRow: R.row,
|
1188
|
+
startColumn: R.col,
|
1189
|
+
endColumn: R.col,
|
1190
|
+
endRow: R.row
|
1162
1191
|
};
|
1163
|
-
|
1164
|
-
const
|
1192
|
+
Fr.foreach(D, (A, P) => {
|
1193
|
+
const L = Rt.getPositionRange(
|
1165
1194
|
{
|
1166
|
-
startRow:
|
1167
|
-
startColumn:
|
1168
|
-
endColumn:
|
1169
|
-
endRow:
|
1195
|
+
startRow: A,
|
1196
|
+
startColumn: P,
|
1197
|
+
endColumn: P,
|
1198
|
+
endRow: A
|
1170
1199
|
},
|
1171
|
-
|
1172
|
-
), { row: O, col:
|
1200
|
+
k
|
1201
|
+
), { row: O, col: F } = S(L.startRow, L.startColumn), x = this._sheetDataValidationModel.getRuleIdByLocation(l, s, O, F) || "", j = Rt.getPositionRange(
|
1173
1202
|
{
|
1174
|
-
startRow:
|
1175
|
-
startColumn:
|
1176
|
-
endColumn:
|
1177
|
-
endRow:
|
1203
|
+
startRow: A,
|
1204
|
+
startColumn: P,
|
1205
|
+
endColumn: P,
|
1206
|
+
endRow: A
|
1178
1207
|
},
|
1179
|
-
|
1180
|
-
), { row: Z, col: Y } =
|
1181
|
-
|
1208
|
+
V
|
1209
|
+
), { row: Z, col: Y } = S(j.startRow, j.startColumn);
|
1210
|
+
y.setValue(Z, Y, x), g.add(x);
|
1182
1211
|
});
|
1183
1212
|
});
|
1184
|
-
const
|
1185
|
-
|
1186
|
-
const
|
1213
|
+
const f = Array.from(g).map((C) => ({ id: C, ranges: Gt(y, (R) => R === C) }));
|
1214
|
+
c.addRangeRules(f);
|
1215
|
+
const m = c.diff(this._sheetDataValidationModel.getRules(l, s)), { redoMutations: I, undoMutations: w } = Zt(l, s, m, this._injector, "patched", o === it.ONLY_FORMAT);
|
1187
1216
|
return {
|
1188
1217
|
undos: w,
|
1189
|
-
redos:
|
1218
|
+
redos: I
|
1190
1219
|
};
|
1191
|
-
},
|
1192
|
-
id:
|
1193
|
-
onBeforeFillData: (
|
1194
|
-
const { source: o, unitId: i, subUnitId:
|
1220
|
+
}, r = {
|
1221
|
+
id: Jn,
|
1222
|
+
onBeforeFillData: (n) => {
|
1223
|
+
const { source: o, unitId: i, subUnitId: a } = n;
|
1195
1224
|
for (const l of o.rows)
|
1196
1225
|
for (const s of o.cols) {
|
1197
|
-
const
|
1198
|
-
if (
|
1199
|
-
this._autoFillService.setDisableApplyType(
|
1226
|
+
const c = this._sheetDataValidationModel.getRuleByLocation(i, a, l, s);
|
1227
|
+
if (c && c.type === G.CHECKBOX) {
|
1228
|
+
this._autoFillService.setDisableApplyType(it.SERIES, !0);
|
1200
1229
|
return;
|
1201
1230
|
}
|
1202
1231
|
}
|
1203
1232
|
},
|
1204
|
-
onFillData: (
|
1233
|
+
onFillData: (n, o, i) => i === it.COPY || i === it.ONLY_FORMAT || i === it.SERIES ? t(n, i) : e(),
|
1205
1234
|
onAfterFillData: () => {
|
1206
1235
|
}
|
1207
1236
|
};
|
1208
|
-
this.disposeWithMe(this._autoFillService.addHook(
|
1237
|
+
this.disposeWithMe(this._autoFillService.addHook(r));
|
1209
1238
|
}
|
1210
1239
|
};
|
1211
|
-
|
1212
|
-
xt(0,
|
1213
|
-
xt(1, M(
|
1240
|
+
qe = gi([
|
1241
|
+
xt(0, Po),
|
1242
|
+
xt(1, M(ee)),
|
1214
1243
|
xt(2, M(we))
|
1215
|
-
],
|
1216
|
-
var
|
1217
|
-
for (var o =
|
1218
|
-
(
|
1244
|
+
], qe);
|
1245
|
+
var mi = Object.getOwnPropertyDescriptor, fi = (e, t, r, n) => {
|
1246
|
+
for (var o = n > 1 ? void 0 : n ? mi(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
1247
|
+
(a = e[i]) && (o = a(o) || o);
|
1219
1248
|
return o;
|
1220
|
-
},
|
1221
|
-
let
|
1222
|
-
constructor(t,
|
1249
|
+
}, $t = (e, t) => (r, n) => t(r, n, e);
|
1250
|
+
let Je = class extends Re {
|
1251
|
+
constructor(t, r, n) {
|
1223
1252
|
super();
|
1224
1253
|
E(this, "_copyInfo");
|
1225
|
-
this._sheetClipboardService = t, this._sheetDataValidationModel =
|
1254
|
+
this._sheetClipboardService = t, this._sheetDataValidationModel = r, this._injector = n, this._initCopyPaste();
|
1226
1255
|
}
|
1227
1256
|
_initCopyPaste() {
|
1228
1257
|
this._sheetClipboardService.addClipboardHook({
|
1229
|
-
id:
|
1230
|
-
onBeforeCopy: (t,
|
1231
|
-
onPasteCells: (t,
|
1232
|
-
const { copyType: i =
|
1233
|
-
return this._generateMutations(s, { copyType: i, pasteType:
|
1258
|
+
id: Jn,
|
1259
|
+
onBeforeCopy: (t, r, n) => this._collect(t, r, n),
|
1260
|
+
onPasteCells: (t, r, n, o) => {
|
1261
|
+
const { copyType: i = Pn.COPY, pasteType: a } = o, { range: l } = t || {}, { range: s, unitId: c, subUnitId: u } = r;
|
1262
|
+
return this._generateMutations(s, { copyType: i, pasteType: a, copyRange: l, unitId: c, subUnitId: u });
|
1234
1263
|
}
|
1235
1264
|
});
|
1236
1265
|
}
|
1237
|
-
_collect(t,
|
1238
|
-
const o = new
|
1266
|
+
_collect(t, r, n) {
|
1267
|
+
const o = new wt();
|
1239
1268
|
this._copyInfo = {
|
1240
1269
|
unitId: t,
|
1241
|
-
subUnitId:
|
1270
|
+
subUnitId: r,
|
1242
1271
|
matrix: o
|
1243
1272
|
};
|
1244
|
-
const i = this._injector.invoke((s) =>
|
1273
|
+
const i = this._injector.invoke((s) => yo(n, s, t, r));
|
1245
1274
|
if (!i)
|
1246
1275
|
return;
|
1247
|
-
const { rows:
|
1248
|
-
|
1249
|
-
l.forEach((u,
|
1250
|
-
const
|
1251
|
-
o.setValue(
|
1276
|
+
const { rows: a, cols: l } = i;
|
1277
|
+
a.forEach((s, c) => {
|
1278
|
+
l.forEach((u, h) => {
|
1279
|
+
const d = this._sheetDataValidationModel.getRuleIdByLocation(t, r, s, u);
|
1280
|
+
o.setValue(c, h, d != null ? d : "");
|
1252
1281
|
});
|
1253
1282
|
});
|
1254
1283
|
}
|
1255
1284
|
// eslint-disable-next-line max-lines-per-function
|
1256
|
-
_generateMutations(t,
|
1285
|
+
_generateMutations(t, r) {
|
1257
1286
|
if (!this._copyInfo)
|
1258
1287
|
return { redos: [], undos: [] };
|
1259
|
-
if (
|
1288
|
+
if (r.copyType === Pn.CUT)
|
1260
1289
|
return this._copyInfo = null, { redos: [], undos: [] };
|
1261
|
-
if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !
|
1290
|
+
if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !r.copyRange)
|
1262
1291
|
return { redos: [], undos: [] };
|
1263
1292
|
if ([
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
].includes(
|
1293
|
+
mt.SPECIAL_PASTE_COL_WIDTH,
|
1294
|
+
mt.SPECIAL_PASTE_VALUE,
|
1295
|
+
mt.SPECIAL_PASTE_FORMAT,
|
1296
|
+
mt.SPECIAL_PASTE_FORMULA
|
1297
|
+
].includes(r.pasteType))
|
1269
1298
|
return { redos: [], undos: [] };
|
1270
1299
|
const { unitId: o, subUnitId: i } = this._copyInfo;
|
1271
|
-
if (
|
1272
|
-
const
|
1273
|
-
|
1274
|
-
var
|
1275
|
-
(
|
1276
|
-
const C =
|
1300
|
+
if (r.unitId !== o || i !== r.subUnitId) {
|
1301
|
+
const a = this._sheetDataValidationModel.getRuleObjectMatrix(r.unitId, r.subUnitId).clone(), l = new wt(), s = /* @__PURE__ */ new Set(), { ranges: [c, u], mapFunc: h } = nn([r.copyRange, t]), d = An(c, u, !0), S = /* @__PURE__ */ new Map();
|
1302
|
+
d.forEach(({ startRange: g }) => {
|
1303
|
+
var f;
|
1304
|
+
(f = this._copyInfo) == null || f.matrix.forValue((m, I, w) => {
|
1305
|
+
const C = Rt.getPositionRange(
|
1277
1306
|
{
|
1278
|
-
startRow:
|
1279
|
-
endRow:
|
1280
|
-
startColumn:
|
1281
|
-
endColumn:
|
1307
|
+
startRow: m,
|
1308
|
+
endRow: m,
|
1309
|
+
startColumn: I,
|
1310
|
+
endColumn: I
|
1282
1311
|
},
|
1283
|
-
|
1284
|
-
),
|
1285
|
-
!this._sheetDataValidationModel.getRuleById(
|
1286
|
-
const { row:
|
1287
|
-
s.add(
|
1312
|
+
g
|
1313
|
+
), R = `${i}-${w}`, D = this._sheetDataValidationModel.getRuleById(o, i, w);
|
1314
|
+
!this._sheetDataValidationModel.getRuleById(r.unitId, r.subUnitId, R) && D && S.set(R, { ...D, uid: R });
|
1315
|
+
const { row: k, col: V } = h(C.startRow, C.startColumn);
|
1316
|
+
s.add(R), l.setValue(k, V, R);
|
1288
1317
|
});
|
1289
1318
|
});
|
1290
|
-
const
|
1291
|
-
|
1292
|
-
const { redoMutations:
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1319
|
+
const p = Array.from(s).map((g) => ({ id: g, ranges: Gt(l, (f) => f === g) }));
|
1320
|
+
a.addRangeRules(p);
|
1321
|
+
const { redoMutations: b, undoMutations: y } = Zt(
|
1322
|
+
r.unitId,
|
1323
|
+
r.subUnitId,
|
1324
|
+
a.diffWithAddition(this._sheetDataValidationModel.getRules(r.unitId, r.subUnitId), S.values()),
|
1296
1325
|
this._injector,
|
1297
1326
|
"patched",
|
1298
1327
|
!1
|
1299
1328
|
);
|
1300
1329
|
return {
|
1301
|
-
redos:
|
1302
|
-
undos:
|
1330
|
+
redos: b,
|
1331
|
+
undos: y
|
1303
1332
|
};
|
1304
1333
|
} else {
|
1305
|
-
const
|
1306
|
-
|
1307
|
-
var
|
1308
|
-
(
|
1309
|
-
const w =
|
1334
|
+
const a = this._sheetDataValidationModel.getRuleObjectMatrix(o, i).clone(), l = new wt(), s = /* @__PURE__ */ new Set(), { ranges: [c, u], mapFunc: h } = nn([r.copyRange, t]);
|
1335
|
+
An(c, u, !0).forEach(({ startRange: y }) => {
|
1336
|
+
var g;
|
1337
|
+
(g = this._copyInfo) == null || g.matrix.forValue((f, m, I) => {
|
1338
|
+
const w = Rt.getPositionRange(
|
1310
1339
|
{
|
1311
|
-
startRow:
|
1312
|
-
endRow:
|
1313
|
-
startColumn:
|
1314
|
-
endColumn:
|
1340
|
+
startRow: f,
|
1341
|
+
endRow: f,
|
1342
|
+
startColumn: m,
|
1343
|
+
endColumn: m
|
1315
1344
|
},
|
1316
|
-
|
1317
|
-
), { row: C, col:
|
1318
|
-
l.setValue(C,
|
1345
|
+
y
|
1346
|
+
), { row: C, col: R } = h(w.startRow, w.startColumn);
|
1347
|
+
l.setValue(C, R, I), s.add(I);
|
1319
1348
|
});
|
1320
1349
|
});
|
1321
|
-
const
|
1322
|
-
|
1323
|
-
const { redoMutations:
|
1350
|
+
const S = Array.from(s).map((y) => ({ id: y, ranges: Gt(l, (g) => g === y) }));
|
1351
|
+
a.addRangeRules(S);
|
1352
|
+
const { redoMutations: p, undoMutations: b } = Zt(
|
1324
1353
|
o,
|
1325
1354
|
i,
|
1326
|
-
|
1355
|
+
a.diff(this._sheetDataValidationModel.getRules(o, i)),
|
1327
1356
|
this._injector,
|
1328
1357
|
"patched",
|
1329
1358
|
!1
|
1330
1359
|
);
|
1331
1360
|
return {
|
1332
|
-
redos:
|
1333
|
-
undos:
|
1361
|
+
redos: p,
|
1362
|
+
undos: b
|
1334
1363
|
};
|
1335
1364
|
}
|
1336
1365
|
}
|
1337
1366
|
};
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
],
|
1343
|
-
var
|
1344
|
-
for (var o =
|
1345
|
-
(
|
1367
|
+
Je = fi([
|
1368
|
+
$t(0, Lo),
|
1369
|
+
$t(1, M(ee)),
|
1370
|
+
$t(2, M(we))
|
1371
|
+
], Je);
|
1372
|
+
var vi = Object.getOwnPropertyDescriptor, _i = (e, t, r, n) => {
|
1373
|
+
for (var o = n > 1 ? void 0 : n ? vi(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
1374
|
+
(a = e[i]) && (o = a(o) || o);
|
1346
1375
|
return o;
|
1347
|
-
},
|
1348
|
-
let
|
1349
|
-
constructor(e, t,
|
1350
|
-
super(), this._localeService = e, this._commandService = t, this._sheetPermissionCheckController =
|
1376
|
+
}, Bt = (e, t) => (r, n) => t(r, n, e);
|
1377
|
+
let Qe = class extends Re {
|
1378
|
+
constructor(e, t, r) {
|
1379
|
+
super(), this._localeService = e, this._commandService = t, this._sheetPermissionCheckController = r, this._commandExecutedListener();
|
1351
1380
|
}
|
1352
1381
|
_commandExecutedListener() {
|
1353
1382
|
this.disposeWithMe(
|
1354
1383
|
this._commandService.beforeCommandExecuted((e) => {
|
1355
|
-
e.id ===
|
1356
|
-
workbookTypes: [
|
1357
|
-
rangeTypes: [
|
1358
|
-
worksheetTypes: [
|
1359
|
-
}) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"))), e.id ===
|
1360
|
-
workbookTypes: [
|
1361
|
-
rangeTypes: [
|
1362
|
-
worksheetTypes: [
|
1384
|
+
e.id === un.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({
|
1385
|
+
workbookTypes: [tn],
|
1386
|
+
rangeTypes: [en],
|
1387
|
+
worksheetTypes: [Jt, Qt]
|
1388
|
+
}) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"))), e.id === Qn.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({
|
1389
|
+
workbookTypes: [tn],
|
1390
|
+
rangeTypes: [en],
|
1391
|
+
worksheetTypes: [Jt, Qt]
|
1363
1392
|
}, e.params.ranges) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")));
|
1364
1393
|
})
|
1365
1394
|
);
|
1366
1395
|
}
|
1367
1396
|
};
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
],
|
1373
|
-
const
|
1374
|
-
function
|
1397
|
+
Qe = _i([
|
1398
|
+
Bt(0, M(se)),
|
1399
|
+
Bt(1, J),
|
1400
|
+
Bt(2, M(Mo))
|
1401
|
+
], Qe);
|
1402
|
+
const Mr = "data-validation-single", br = "sheet.menu.data-validation";
|
1403
|
+
function Si(e) {
|
1375
1404
|
return {
|
1376
|
-
id:
|
1377
|
-
type:
|
1378
|
-
icon:
|
1405
|
+
id: br,
|
1406
|
+
type: pn.SUBITEMS,
|
1407
|
+
icon: Mr,
|
1379
1408
|
tooltip: "dataValidation.title",
|
1380
|
-
hidden$:
|
1381
|
-
disabled$:
|
1409
|
+
hidden$: ao(e, W.UNIVER_SHEET),
|
1410
|
+
disabled$: ko(e, { workbookTypes: [tn], worksheetTypes: [Qt, Jt], rangeTypes: [en] })
|
1382
1411
|
};
|
1383
1412
|
}
|
1384
|
-
function
|
1413
|
+
function Ci(e) {
|
1385
1414
|
return {
|
1386
|
-
id:
|
1415
|
+
id: Fe.id,
|
1387
1416
|
title: "dataValidation.panel.title",
|
1388
|
-
type:
|
1417
|
+
type: pn.BUTTON
|
1389
1418
|
};
|
1390
1419
|
}
|
1391
|
-
function
|
1420
|
+
function Ii(e) {
|
1392
1421
|
return {
|
1393
|
-
id:
|
1422
|
+
id: Lt.id,
|
1394
1423
|
title: "dataValidation.panel.add",
|
1395
|
-
type:
|
1424
|
+
type: pn.BUTTON
|
1396
1425
|
};
|
1397
1426
|
}
|
1398
|
-
const
|
1399
|
-
[
|
1400
|
-
[
|
1427
|
+
const wi = {
|
1428
|
+
[so.FORMULAS_INSERT]: {
|
1429
|
+
[br]: {
|
1401
1430
|
order: 9,
|
1402
|
-
menuItemFactory:
|
1403
|
-
[
|
1431
|
+
menuItemFactory: Si,
|
1432
|
+
[Fe.id]: {
|
1404
1433
|
order: 0,
|
1405
|
-
menuItemFactory:
|
1434
|
+
menuItemFactory: Ci
|
1406
1435
|
},
|
1407
|
-
[
|
1436
|
+
[Lt.id]: {
|
1408
1437
|
order: 1,
|
1409
|
-
menuItemFactory:
|
1438
|
+
menuItemFactory: Ii
|
1410
1439
|
}
|
1411
1440
|
}
|
1412
1441
|
}
|
1413
1442
|
};
|
1414
|
-
var
|
1415
|
-
for (var o =
|
1416
|
-
(
|
1443
|
+
var Ri = Object.getOwnPropertyDescriptor, Er = (e, t, r, n) => {
|
1444
|
+
for (var o = n > 1 ? void 0 : n ? Ri(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
1445
|
+
(a = e[i]) && (o = a(o) || o);
|
1417
1446
|
return o;
|
1418
|
-
}, X = (e, t) => (
|
1419
|
-
const
|
1447
|
+
}, X = (e, t) => (r, n) => t(r, n, e);
|
1448
|
+
const Dr = {
|
1420
1449
|
tr: {
|
1421
1450
|
size: 6,
|
1422
1451
|
color: "#fe4b4b"
|
1423
1452
|
}
|
1424
1453
|
};
|
1425
|
-
let
|
1426
|
-
constructor(e, t,
|
1427
|
-
super(), this._commandService = e, this._menuManagerService = t, this._renderManagerService =
|
1454
|
+
let et = class extends cn {
|
1455
|
+
constructor(e, t, r, n, o, i, a, l, s, c, u) {
|
1456
|
+
super(), this._commandService = e, this._menuManagerService = t, this._renderManagerService = r, this._univerInstanceService = n, this._autoHeightController = o, this._dropdownManagerService = i, this._sheetDataValidationModel = a, this._dataValidatorRegistryService = l, this._sheetInterceptorService = s, this._dataValidationCacheService = c, this._editorBridgeService = u, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
1428
1457
|
}
|
1429
1458
|
_initMenu() {
|
1430
|
-
this._menuManagerService.mergeMenu(
|
1459
|
+
this._menuManagerService.mergeMenu(wi);
|
1431
1460
|
}
|
1432
1461
|
_initDropdown() {
|
1433
1462
|
this._editorBridgeService && this.disposeWithMe(this._editorBridgeService.visible$.subscribe((e) => {
|
1434
|
-
var
|
1463
|
+
var r;
|
1435
1464
|
if (!e.visible) {
|
1436
|
-
((
|
1465
|
+
((r = this._dropdownManagerService.activeDropdown) == null ? void 0 : r.trigger) === "editor-bridge" && this._dropdownManagerService.hideDropdown();
|
1437
1466
|
return;
|
1438
1467
|
}
|
1439
1468
|
const t = this._editorBridgeService.getEditCellState();
|
1440
1469
|
if (t) {
|
1441
|
-
const { unitId:
|
1470
|
+
const { unitId: n, sheetId: o, row: i, column: a } = t, l = this._univerInstanceService.getUniverSheetInstance(n);
|
1442
1471
|
if (!l)
|
1443
1472
|
return;
|
1444
|
-
const s = this._sheetDataValidationModel.getRuleByLocation(
|
1473
|
+
const s = this._sheetDataValidationModel.getRuleByLocation(n, o, i, a);
|
1445
1474
|
if (!s)
|
1446
1475
|
return;
|
1447
|
-
const
|
1448
|
-
if (!(
|
1476
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(s.type);
|
1477
|
+
if (!(c != null && c.dropdownType))
|
1449
1478
|
return;
|
1450
1479
|
const u = l.getActiveSheet();
|
1451
1480
|
if (!u) return;
|
1452
|
-
const
|
1453
|
-
if (
|
1481
|
+
const h = this._dropdownManagerService.activeDropdown, d = h == null ? void 0 : h.location;
|
1482
|
+
if (d && d.unitId === n && d.subUnitId === o && d.row === i && d.col === a)
|
1454
1483
|
return;
|
1455
1484
|
this._dropdownManagerService.showDropdown(
|
1456
1485
|
{
|
1457
1486
|
location: {
|
1458
|
-
unitId:
|
1487
|
+
unitId: n,
|
1459
1488
|
subUnitId: o,
|
1460
1489
|
row: i,
|
1461
|
-
col:
|
1490
|
+
col: a,
|
1462
1491
|
workbook: l,
|
1463
1492
|
worksheet: u
|
1464
1493
|
},
|
@@ -1473,91 +1502,91 @@ let at = class extends ma {
|
|
1473
1502
|
_initViewModelIntercept() {
|
1474
1503
|
this.disposeWithMe(
|
1475
1504
|
this._sheetInterceptorService.intercept(
|
1476
|
-
|
1505
|
+
hr.CELL_CONTENT,
|
1477
1506
|
{
|
1478
|
-
effect:
|
1507
|
+
effect: Wn.Style,
|
1479
1508
|
// must be after numfmt
|
1480
|
-
priority:
|
1509
|
+
priority: pr.DATA_VALIDATION,
|
1481
1510
|
// eslint-disable-next-line max-lines-per-function, complexity
|
1482
|
-
handler: (e, t,
|
1483
|
-
var
|
1484
|
-
const { row:
|
1485
|
-
if (!
|
1486
|
-
return
|
1487
|
-
const u = this._sheetDataValidationModel.getRuleById(i,
|
1511
|
+
handler: (e, t, r) => {
|
1512
|
+
var g, f, m, I, w;
|
1513
|
+
const { row: n, col: o, unitId: i, subUnitId: a, workbook: l, worksheet: s } = t, c = this._sheetDataValidationModel.getRuleIdByLocation(i, a, n, o);
|
1514
|
+
if (!c)
|
1515
|
+
return r(e);
|
1516
|
+
const u = this._sheetDataValidationModel.getRuleById(i, a, c);
|
1488
1517
|
if (!u)
|
1489
|
-
return
|
1490
|
-
const
|
1491
|
-
let
|
1492
|
-
const
|
1518
|
+
return r(e);
|
1519
|
+
const h = (g = this._dataValidationCacheService.getValue(i, a, n, o)) != null ? g : je.VALID, d = this._dataValidatorRegistryService.getValidatorItem(u.type), S = t.rawData;
|
1520
|
+
let p;
|
1521
|
+
const b = {
|
1493
1522
|
get value() {
|
1494
1523
|
var C;
|
1495
|
-
return
|
1524
|
+
return p !== void 0 || (p = (C = Q(S)) != null ? C : null), p;
|
1496
1525
|
}
|
1497
|
-
},
|
1526
|
+
}, y = {
|
1498
1527
|
get value() {
|
1499
1528
|
var C;
|
1500
|
-
return `${(C =
|
1529
|
+
return `${(C = b.value) != null ? C : ""}`;
|
1501
1530
|
}
|
1502
1531
|
};
|
1503
|
-
return
|
1532
|
+
return r({
|
1504
1533
|
...e,
|
1505
1534
|
markers: {
|
1506
1535
|
...e == null ? void 0 : e.markers,
|
1507
|
-
...
|
1536
|
+
...h === je.INVALID ? Dr : null
|
1508
1537
|
},
|
1509
1538
|
customRender: [
|
1510
|
-
...(
|
1511
|
-
...
|
1539
|
+
...(f = e == null ? void 0 : e.customRender) != null ? f : [],
|
1540
|
+
...d != null && d.canvasRender ? [d.canvasRender] : []
|
1512
1541
|
],
|
1513
1542
|
fontRenderExtension: {
|
1514
1543
|
...e == null ? void 0 : e.fontRenderExtension,
|
1515
|
-
isSkip: ((
|
1544
|
+
isSkip: ((m = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : m.isSkip) || ((I = d == null ? void 0 : d.skipDefaultFontRender) == null ? void 0 : I.call(d, u, b.value, t))
|
1516
1545
|
},
|
1517
1546
|
interceptorStyle: {
|
1518
1547
|
...e == null ? void 0 : e.interceptorStyle,
|
1519
|
-
...
|
1548
|
+
...d == null ? void 0 : d.getExtraStyle(u, y.value, {
|
1520
1549
|
get style() {
|
1521
1550
|
const C = l.getStyles();
|
1522
1551
|
return (typeof (e == null ? void 0 : e.s) == "string" ? C.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {};
|
1523
1552
|
}
|
1524
|
-
},
|
1553
|
+
}, n, o)
|
1525
1554
|
},
|
1526
1555
|
interceptorAutoHeight: () => {
|
1527
|
-
var
|
1528
|
-
const C = (
|
1556
|
+
var k, V, A, P, L, O;
|
1557
|
+
const C = (V = (k = this._renderManagerService.getRenderById(i)) == null ? void 0 : k.with(yt).getSkeletonParam(a)) == null ? void 0 : V.skeleton;
|
1529
1558
|
if (!C)
|
1530
1559
|
return;
|
1531
|
-
const
|
1560
|
+
const R = C.worksheet.getMergedCell(n, o), D = {
|
1532
1561
|
data: e,
|
1533
1562
|
style: C.getStyles().getStyleByCell(e),
|
1534
|
-
primaryWithCoord: C.getCellWithCoordByIndex((
|
1563
|
+
primaryWithCoord: C.getCellWithCoordByIndex((A = R == null ? void 0 : R.startRow) != null ? A : n, (P = R == null ? void 0 : R.startColumn) != null ? P : o),
|
1535
1564
|
unitId: i,
|
1536
|
-
subUnitId:
|
1537
|
-
row:
|
1565
|
+
subUnitId: a,
|
1566
|
+
row: n,
|
1538
1567
|
col: o,
|
1539
1568
|
workbook: l,
|
1540
1569
|
worksheet: s
|
1541
1570
|
};
|
1542
|
-
return (O = (
|
1571
|
+
return (O = (L = d == null ? void 0 : d.canvasRender) == null ? void 0 : L.calcCellAutoHeight) == null ? void 0 : O.call(L, D);
|
1543
1572
|
},
|
1544
1573
|
interceptorAutoWidth: () => {
|
1545
|
-
var
|
1546
|
-
const C = (
|
1574
|
+
var k, V, A, P, L, O;
|
1575
|
+
const C = (V = (k = this._renderManagerService.getRenderById(i)) == null ? void 0 : k.with(yt).getSkeletonParam(a)) == null ? void 0 : V.skeleton;
|
1547
1576
|
if (!C)
|
1548
1577
|
return;
|
1549
|
-
const
|
1578
|
+
const R = C.worksheet.getMergedCell(n, o), D = {
|
1550
1579
|
data: e,
|
1551
1580
|
style: C.getStyles().getStyleByCell(e),
|
1552
|
-
primaryWithCoord: C.getCellWithCoordByIndex((
|
1581
|
+
primaryWithCoord: C.getCellWithCoordByIndex((A = R == null ? void 0 : R.startRow) != null ? A : n, (P = R == null ? void 0 : R.startColumn) != null ? P : o),
|
1553
1582
|
unitId: i,
|
1554
|
-
subUnitId:
|
1555
|
-
row:
|
1583
|
+
subUnitId: a,
|
1584
|
+
row: n,
|
1556
1585
|
col: o,
|
1557
1586
|
workbook: l,
|
1558
1587
|
worksheet: s
|
1559
1588
|
};
|
1560
|
-
return (O = (
|
1589
|
+
return (O = (L = d == null ? void 0 : d.canvasRender) == null ? void 0 : L.calcCellAutoWidth) == null ? void 0 : O.call(L, D);
|
1561
1590
|
},
|
1562
1591
|
coverable: ((w = e == null ? void 0 : e.coverable) != null ? w : !0) && !(u.type === G.LIST || u.type === G.LIST_MULTIPLE)
|
1563
1592
|
});
|
@@ -1570,99 +1599,99 @@ let at = class extends ma {
|
|
1570
1599
|
this._sheetDataValidationModel.ruleChange$.pipe(
|
1571
1600
|
// patched data-validation change don't need to re-calc row height
|
1572
1601
|
// re-calc of row height will be triggered precisely by the origin command
|
1573
|
-
|
1574
|
-
|
1602
|
+
fn((e) => e.source === "command"),
|
1603
|
+
lr(100)
|
1575
1604
|
).subscribe((e) => {
|
1576
1605
|
if (e.length === 0)
|
1577
1606
|
return;
|
1578
1607
|
const t = [];
|
1579
|
-
if (e.forEach((
|
1580
|
-
var
|
1581
|
-
(
|
1608
|
+
if (e.forEach((r) => {
|
1609
|
+
var n;
|
1610
|
+
(r.rule.type === G.LIST_MULTIPLE || r.rule.type === G.LIST) && (n = r.rule) != null && n.ranges && t.push(...r.rule.ranges);
|
1582
1611
|
}), t.length) {
|
1583
|
-
const
|
1584
|
-
|
1612
|
+
const r = this._autoHeightController.getUndoRedoParamsOfAutoHeight(t);
|
1613
|
+
jn(r.redos, this._commandService);
|
1585
1614
|
}
|
1586
1615
|
});
|
1587
1616
|
}
|
1588
1617
|
};
|
1589
|
-
|
1590
|
-
X(0,
|
1591
|
-
X(1,
|
1618
|
+
et = Er([
|
1619
|
+
X(0, J),
|
1620
|
+
X(1, lo),
|
1592
1621
|
X(2, Ne),
|
1593
|
-
X(3,
|
1594
|
-
X(4, M(
|
1595
|
-
X(5, M(
|
1596
|
-
X(6, M(
|
1622
|
+
X(3, le),
|
1623
|
+
X(4, M(mr)),
|
1624
|
+
X(5, M(Ae)),
|
1625
|
+
X(6, M(ee)),
|
1597
1626
|
X(7, M(ye)),
|
1598
|
-
X(8, M(
|
1599
|
-
X(9, M(
|
1600
|
-
X(10,
|
1601
|
-
],
|
1602
|
-
let
|
1603
|
-
constructor(e, t,
|
1604
|
-
super(), this._commandService = e, this._renderManagerService = t, this._autoHeightController =
|
1627
|
+
X(8, M(vn)),
|
1628
|
+
X(9, M(er)),
|
1629
|
+
X(10, xr(gr))
|
1630
|
+
], et);
|
1631
|
+
let Nn = class extends cn {
|
1632
|
+
constructor(e, t, r, n, o, i, a) {
|
1633
|
+
super(), this._commandService = e, this._renderManagerService = t, this._autoHeightController = r, this._dataValidatorRegistryService = n, this._sheetInterceptorService = o, this._sheetDataValidationModel = i, this._dataValidationCacheService = a, this._initViewModelIntercept(), this._initAutoHeight();
|
1605
1634
|
}
|
1606
1635
|
_initViewModelIntercept() {
|
1607
1636
|
this.disposeWithMe(
|
1608
1637
|
this._sheetInterceptorService.intercept(
|
1609
|
-
|
1638
|
+
hr.CELL_CONTENT,
|
1610
1639
|
{
|
1611
|
-
effect:
|
1640
|
+
effect: Wn.Style,
|
1612
1641
|
// must be after numfmt
|
1613
|
-
priority:
|
1642
|
+
priority: pr.DATA_VALIDATION,
|
1614
1643
|
// eslint-disable-next-line complexity
|
1615
|
-
handler: (e, t,
|
1616
|
-
var
|
1617
|
-
const { row:
|
1618
|
-
if (!
|
1619
|
-
return
|
1620
|
-
const u = this._sheetDataValidationModel.getRuleById(i,
|
1644
|
+
handler: (e, t, r) => {
|
1645
|
+
var y, g, f, m, I;
|
1646
|
+
const { row: n, col: o, unitId: i, subUnitId: a, workbook: l, worksheet: s } = t, c = this._sheetDataValidationModel.getRuleIdByLocation(i, a, n, o);
|
1647
|
+
if (!c)
|
1648
|
+
return r(e);
|
1649
|
+
const u = this._sheetDataValidationModel.getRuleById(i, a, c);
|
1621
1650
|
if (!u)
|
1622
|
-
return
|
1623
|
-
const
|
1624
|
-
return
|
1651
|
+
return r(e);
|
1652
|
+
const h = (y = this._dataValidationCacheService.getValue(i, a, n, o)) != null ? y : je.VALID, d = this._dataValidatorRegistryService.getValidatorItem(u.type), S = s.getCellRaw(n, o), p = Q(S), b = `${p != null ? p : ""}`;
|
1653
|
+
return r({
|
1625
1654
|
...e,
|
1626
1655
|
markers: {
|
1627
1656
|
...e == null ? void 0 : e.markers,
|
1628
|
-
...
|
1657
|
+
...h === je.INVALID ? Dr : null
|
1629
1658
|
},
|
1630
1659
|
customRender: [
|
1631
|
-
...(
|
1632
|
-
...
|
1660
|
+
...(g = e == null ? void 0 : e.customRender) != null ? g : [],
|
1661
|
+
...d != null && d.canvasRender ? [d.canvasRender] : []
|
1633
1662
|
],
|
1634
1663
|
fontRenderExtension: {
|
1635
1664
|
...e == null ? void 0 : e.fontRenderExtension,
|
1636
|
-
isSkip: ((
|
1665
|
+
isSkip: ((f = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : f.isSkip) || ((m = d == null ? void 0 : d.skipDefaultFontRender) == null ? void 0 : m.call(d, u, p, t))
|
1637
1666
|
},
|
1638
1667
|
interceptorStyle: {
|
1639
1668
|
...e == null ? void 0 : e.interceptorStyle,
|
1640
|
-
...
|
1669
|
+
...d == null ? void 0 : d.getExtraStyle(u, b, {
|
1641
1670
|
get style() {
|
1642
1671
|
const w = l.getStyles();
|
1643
1672
|
return (typeof (e == null ? void 0 : e.s) == "string" ? w.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {};
|
1644
1673
|
}
|
1645
|
-
},
|
1674
|
+
}, n, o)
|
1646
1675
|
},
|
1647
1676
|
interceptorAutoHeight: () => {
|
1648
|
-
var
|
1649
|
-
const w = (
|
1677
|
+
var D, k, V, A, P, L;
|
1678
|
+
const w = (k = (D = this._renderManagerService.getRenderById(i)) == null ? void 0 : D.with(yt).getSkeletonParam(a)) == null ? void 0 : k.skeleton;
|
1650
1679
|
if (!w)
|
1651
1680
|
return;
|
1652
|
-
const C = w.worksheet.getMergedCell(
|
1681
|
+
const C = w.worksheet.getMergedCell(n, o), R = {
|
1653
1682
|
data: e,
|
1654
1683
|
style: w.getStyles().getStyleByCell(e),
|
1655
|
-
primaryWithCoord: w.getCellWithCoordByIndex((
|
1684
|
+
primaryWithCoord: w.getCellWithCoordByIndex((V = C == null ? void 0 : C.startRow) != null ? V : n, (A = C == null ? void 0 : C.startColumn) != null ? A : o),
|
1656
1685
|
unitId: i,
|
1657
|
-
subUnitId:
|
1658
|
-
row:
|
1686
|
+
subUnitId: a,
|
1687
|
+
row: n,
|
1659
1688
|
col: o,
|
1660
1689
|
workbook: l,
|
1661
1690
|
worksheet: s
|
1662
1691
|
};
|
1663
|
-
return (
|
1692
|
+
return (L = (P = d == null ? void 0 : d.canvasRender) == null ? void 0 : P.calcCellAutoHeight) == null ? void 0 : L.call(P, R);
|
1664
1693
|
},
|
1665
|
-
coverable: ((
|
1694
|
+
coverable: ((I = e == null ? void 0 : e.coverable) != null ? I : !0) && !(u.type === G.LIST || u.type === G.LIST_MULTIPLE)
|
1666
1695
|
});
|
1667
1696
|
}
|
1668
1697
|
}
|
@@ -1671,485 +1700,514 @@ let Ua = class extends ma {
|
|
1671
1700
|
}
|
1672
1701
|
_initAutoHeight() {
|
1673
1702
|
this._sheetDataValidationModel.ruleChange$.pipe(
|
1674
|
-
|
1675
|
-
|
1703
|
+
fn((e) => e.source === "command"),
|
1704
|
+
lr(16)
|
1676
1705
|
).subscribe((e) => {
|
1677
1706
|
const t = [];
|
1678
|
-
if (e.forEach((
|
1679
|
-
var
|
1680
|
-
(
|
1707
|
+
if (e.forEach((r) => {
|
1708
|
+
var n;
|
1709
|
+
(n = r.rule) != null && n.ranges && t.push(...r.rule.ranges);
|
1681
1710
|
}), t.length) {
|
1682
|
-
const
|
1683
|
-
|
1711
|
+
const r = this._autoHeightController.getUndoRedoParamsOfAutoHeight(t);
|
1712
|
+
jn(r.redos, this._commandService);
|
1684
1713
|
}
|
1685
1714
|
});
|
1686
1715
|
}
|
1687
1716
|
};
|
1688
|
-
|
1689
|
-
X(0,
|
1717
|
+
Nn = Er([
|
1718
|
+
X(0, J),
|
1690
1719
|
X(1, Ne),
|
1691
|
-
X(2, M(
|
1720
|
+
X(2, M(mr)),
|
1692
1721
|
X(3, M(ye)),
|
1693
|
-
X(4, M(
|
1694
|
-
X(5, M(
|
1695
|
-
X(6, M(
|
1696
|
-
],
|
1697
|
-
var
|
1698
|
-
for (var o =
|
1699
|
-
(
|
1722
|
+
X(4, M(vn)),
|
1723
|
+
X(5, M(ee)),
|
1724
|
+
X(6, M(er))
|
1725
|
+
], Nn);
|
1726
|
+
var yi = Object.getOwnPropertyDescriptor, Mi = (e, t, r, n) => {
|
1727
|
+
for (var o = n > 1 ? void 0 : n ? yi(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
1728
|
+
(a = e[i]) && (o = a(o) || o);
|
1700
1729
|
return o;
|
1701
|
-
},
|
1702
|
-
let
|
1703
|
-
constructor(e, t,
|
1704
|
-
super(), this._context = e, this._sheetDataValidationModel = t, this._sheetSkeletonManagerService =
|
1730
|
+
}, Un = (e, t) => (r, n) => t(r, n, e);
|
1731
|
+
let Et = class extends Re {
|
1732
|
+
constructor(e, t, r) {
|
1733
|
+
super(), this._context = e, this._sheetDataValidationModel = t, this._sheetSkeletonManagerService = r, this._initSkeletonChange();
|
1705
1734
|
}
|
1706
1735
|
_initSkeletonChange() {
|
1707
1736
|
const e = (t) => {
|
1708
|
-
var
|
1737
|
+
var n;
|
1709
1738
|
if (!t.length)
|
1710
1739
|
return;
|
1711
|
-
const
|
1740
|
+
const r = /* @__PURE__ */ new Set();
|
1712
1741
|
t.forEach((o) => {
|
1713
|
-
|
1714
|
-
}),
|
1742
|
+
r.add(o.subUnitId);
|
1743
|
+
}), r.forEach((o) => {
|
1715
1744
|
var i;
|
1716
1745
|
(i = this._sheetSkeletonManagerService.getSkeletonParam(o)) == null || i.skeleton.makeDirty(!0);
|
1717
|
-
}), (
|
1746
|
+
}), (n = this._context.mainComponent) == null || n.makeForceDirty();
|
1718
1747
|
};
|
1719
|
-
this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe(
|
1748
|
+
this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe($r(16)).subscribe(e));
|
1720
1749
|
}
|
1721
1750
|
};
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
],
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1751
|
+
Et = Mi([
|
1752
|
+
Un(1, M(ee)),
|
1753
|
+
Un(2, M(yt))
|
1754
|
+
], Et);
|
1755
|
+
function bi(e) {
|
1756
|
+
var c;
|
1757
|
+
const t = U(se), r = U(gn), { value: n, onChange: o, extraComponent: i } = e, [a, l] = H(!1), s = i ? r.get(i) : null;
|
1758
|
+
return /* @__PURE__ */ z(Xe, { children: [
|
1759
|
+
/* @__PURE__ */ z(
|
1760
|
+
"div",
|
1761
|
+
{
|
1762
|
+
className: `
|
1763
|
+
univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-black
|
1764
|
+
`,
|
1765
|
+
onClick: () => l(!a),
|
1766
|
+
children: [
|
1767
|
+
t.t("dataValidation.panel.options"),
|
1768
|
+
a ? /* @__PURE__ */ _(Ir, { className: "univer-ml-1 univer-text-[8px]" }) : /* @__PURE__ */ _(Cr, { className: "univer-ml-1 univer-text-[8px]" })
|
1769
|
+
]
|
1770
|
+
}
|
1771
|
+
),
|
1772
|
+
a && /* @__PURE__ */ z(Xe, { children: [
|
1773
|
+
s ? /* @__PURE__ */ _(s, { value: n, onChange: o }) : null,
|
1774
|
+
/* @__PURE__ */ _(
|
1741
1775
|
K,
|
1742
1776
|
{
|
1743
1777
|
label: t.t("dataValidation.panel.invalid"),
|
1744
1778
|
children: /* @__PURE__ */ z(
|
1745
|
-
|
1779
|
+
hn,
|
1746
1780
|
{
|
1747
|
-
value: `${(
|
1748
|
-
onChange: (u) => o({ ...
|
1781
|
+
value: `${(c = n.errorStyle) != null ? c : lt.WARNING}`,
|
1782
|
+
onChange: (u) => o({ ...n, errorStyle: +u }),
|
1749
1783
|
children: [
|
1750
|
-
/* @__PURE__ */
|
1751
|
-
/* @__PURE__ */
|
1784
|
+
/* @__PURE__ */ _(Oe, { value: `${lt.WARNING}`, children: t.t("dataValidation.panel.showWarning") }),
|
1785
|
+
/* @__PURE__ */ _(Oe, { value: `${lt.STOP}`, children: t.t("dataValidation.panel.rejectInput") })
|
1752
1786
|
]
|
1753
1787
|
}
|
1754
1788
|
)
|
1755
1789
|
}
|
1756
1790
|
),
|
1757
|
-
/* @__PURE__ */
|
1791
|
+
/* @__PURE__ */ _(
|
1758
1792
|
K,
|
1759
1793
|
{
|
1760
1794
|
label: t.t("dataValidation.panel.messageInfo"),
|
1761
|
-
children: /* @__PURE__ */
|
1762
|
-
|
1795
|
+
children: /* @__PURE__ */ _(
|
1796
|
+
Pt,
|
1763
1797
|
{
|
1764
|
-
checked:
|
1798
|
+
checked: n.showErrorMessage,
|
1765
1799
|
onChange: () => o({
|
1766
|
-
...
|
1767
|
-
showErrorMessage: !
|
1800
|
+
...n,
|
1801
|
+
showErrorMessage: !n.showErrorMessage
|
1768
1802
|
}),
|
1769
1803
|
children: t.t("dataValidation.panel.showInfo")
|
1770
1804
|
}
|
1771
1805
|
)
|
1772
1806
|
}
|
1773
1807
|
),
|
1774
|
-
|
1808
|
+
n.showErrorMessage ? /* @__PURE__ */ _(K, { children: /* @__PURE__ */ _(Ve, { value: n.error, onChange: (u) => o({ ...n, error: u }) }) }) : null
|
1775
1809
|
] })
|
1776
1810
|
] });
|
1777
1811
|
}
|
1778
|
-
const
|
1779
|
-
|
1780
|
-
|
1781
|
-
dataValidationDetailButtons: ji,
|
1782
|
-
dataValidationDetailButton: Yi
|
1783
|
-
}, Xi = (e) => Yn(
|
1784
|
-
async (t, n, a, o) => {
|
1785
|
-
const i = await e.executeCommand(t, n, a);
|
1812
|
+
const Ei = (e) => Br(
|
1813
|
+
async (t, r, n, o) => {
|
1814
|
+
const i = await e.executeCommand(t, r, n);
|
1786
1815
|
o == null || o(i);
|
1787
1816
|
},
|
1788
1817
|
1e3
|
1789
1818
|
);
|
1790
|
-
function
|
1791
|
-
var
|
1792
|
-
return t ? ((o = (
|
1819
|
+
function Di(e, t, r) {
|
1820
|
+
var n, o, i, a;
|
1821
|
+
return t ? ((o = (n = e.getUnit(t)) == null ? void 0 : n.getSheetBySheetName(r)) == null ? void 0 : o.getSheetId()) || "" : ((a = (i = e.getCurrentUnitForType(W.UNIVER_SHEET)) == null ? void 0 : i.getSheetBySheetName(r)) == null ? void 0 : a.getSheetId()) || "";
|
1793
1822
|
}
|
1794
|
-
function
|
1795
|
-
var
|
1796
|
-
const [e, t] =
|
1797
|
-
if (
|
1798
|
-
const
|
1799
|
-
|
1800
|
-
}, [
|
1801
|
-
|
1802
|
-
(
|
1803
|
-
const
|
1804
|
-
t(($) => $ + 1),
|
1823
|
+
function Vi() {
|
1824
|
+
var T, B;
|
1825
|
+
const [e, t] = H(0), r = U(_e), n = Te(r.activeRule$, r.activeRule), { unitId: o, subUnitId: i, rule: a } = n || {}, l = a.uid, s = U(ye), c = U(le), u = U(gn), h = U(J), d = U(mn), S = U(se), [p, b] = H(a), y = s.getValidatorItem(p.type), [g, f] = H(!1), m = s.getValidatorsByScope(uo.SHEET), [I, w] = H(() => p.ranges.map((v) => ({ unitId: "", sheetId: "", range: v }))), C = ct(() => Ei(h), [h]), [R, D] = H(!1), [k, V] = H(!1), A = ut(null), P = U(dr);
|
1826
|
+
if (Pe(() => () => {
|
1827
|
+
const v = P.getCurrentLastSelection();
|
1828
|
+
v && P.setSelections([v]);
|
1829
|
+
}, [P]), Pe(() => {
|
1830
|
+
h.onCommandExecuted((v) => {
|
1831
|
+
(v.id === Hr.id || v.id === Wr.id) && setTimeout(() => {
|
1832
|
+
const N = d.getRuleById(o, i, l);
|
1833
|
+
t(($) => $ + 1), N && (b(N), w(N.ranges.map(($) => ({ unitId: "", sheetId: "", range: $ }))));
|
1805
1834
|
}, 20);
|
1806
1835
|
});
|
1807
|
-
}, [
|
1836
|
+
}, [h, d, l, i, o]), !y)
|
1808
1837
|
return null;
|
1809
|
-
const
|
1810
|
-
var
|
1811
|
-
(
|
1812
|
-
}, j =
|
1813
|
-
const
|
1814
|
-
const
|
1815
|
-
if (
|
1816
|
-
const
|
1817
|
-
return { ...q, sheetId:
|
1838
|
+
const L = y.operators, O = y.operatorNames, F = p.operator ? ho.includes(p.operator) : !1, x = () => {
|
1839
|
+
var v, N, $;
|
1840
|
+
(N = (v = A.current) == null ? void 0 : v.editor) != null && N.isFocus() && j(($ = A.current) == null ? void 0 : $.getValue()), !(!p.ranges.length || R) && (y.validatorFormula(p, o, i).success ? r.setActiveRule(null) : f(!0));
|
1841
|
+
}, j = qt((v) => {
|
1842
|
+
const N = v.split(",").filter(Boolean).map(Uo).map((q) => {
|
1843
|
+
const In = q.sheetName;
|
1844
|
+
if (In) {
|
1845
|
+
const Pr = Di(c, q.unitId, In);
|
1846
|
+
return { ...q, sheetId: Pr };
|
1818
1847
|
}
|
1819
1848
|
return {
|
1820
1849
|
...q,
|
1821
1850
|
sheetId: ""
|
1822
1851
|
};
|
1823
1852
|
});
|
1824
|
-
if (
|
1853
|
+
if (jr(N, I))
|
1825
1854
|
return;
|
1826
|
-
w(
|
1827
|
-
const $ =
|
1828
|
-
if (
|
1829
|
-
...
|
1855
|
+
w(N);
|
1856
|
+
const $ = N.filter((q) => (!q.unitId || q.unitId === o) && (!q.sheetId || q.sheetId === i)).map((q) => q.range);
|
1857
|
+
if (b({
|
1858
|
+
...p,
|
1830
1859
|
ranges: $
|
1831
1860
|
}), $.length === 0)
|
1832
1861
|
return;
|
1833
|
-
const
|
1862
|
+
const Ce = {
|
1834
1863
|
unitId: o,
|
1835
1864
|
subUnitId: i,
|
1836
1865
|
ruleId: l,
|
1837
1866
|
ranges: $
|
1838
1867
|
};
|
1839
|
-
C(
|
1840
|
-
}), Z = (
|
1841
|
-
if (
|
1868
|
+
C(Qn.id, Ce);
|
1869
|
+
}), Z = (v) => {
|
1870
|
+
if (Rn(v, Vn(p)))
|
1842
1871
|
return;
|
1843
|
-
|
1844
|
-
...
|
1845
|
-
...
|
1872
|
+
b({
|
1873
|
+
...p,
|
1874
|
+
...v
|
1846
1875
|
});
|
1847
|
-
const
|
1876
|
+
const N = {
|
1848
1877
|
unitId: o,
|
1849
1878
|
subUnitId: i,
|
1850
1879
|
ruleId: l,
|
1851
|
-
setting:
|
1880
|
+
setting: v
|
1852
1881
|
};
|
1853
1882
|
C(
|
1854
|
-
|
1855
|
-
|
1883
|
+
yn.id,
|
1884
|
+
N,
|
1856
1885
|
void 0
|
1857
1886
|
);
|
1858
1887
|
}, Y = async () => {
|
1859
|
-
await
|
1888
|
+
await h.executeCommand(tr.id, {
|
1860
1889
|
ruleId: l,
|
1861
1890
|
unitId: o,
|
1862
1891
|
subUnitId: i
|
1863
|
-
}),
|
1864
|
-
},
|
1865
|
-
type:
|
1866
|
-
operator:
|
1867
|
-
formula1:
|
1868
|
-
formula2:
|
1869
|
-
allowBlank:
|
1870
|
-
},
|
1871
|
-
const
|
1872
|
-
if (!
|
1892
|
+
}), r.setActiveRule(null);
|
1893
|
+
}, te = {
|
1894
|
+
type: p.type,
|
1895
|
+
operator: p.operator,
|
1896
|
+
formula1: p.formula1,
|
1897
|
+
formula2: p.formula2,
|
1898
|
+
allowBlank: p.allowBlank
|
1899
|
+
}, ge = (v) => {
|
1900
|
+
const N = s.getValidatorItem(v);
|
1901
|
+
if (!N)
|
1873
1902
|
return;
|
1874
|
-
const $ =
|
1875
|
-
...
|
1876
|
-
type:
|
1903
|
+
const $ = N.operators, Ce = d.getRuleById(o, i, l), q = v === (Ce == null ? void 0 : Ce.type) || v.includes("list") && (Ce != null && Ce.type.includes("list")) ? {
|
1904
|
+
...Ce,
|
1905
|
+
type: v
|
1877
1906
|
} : {
|
1878
|
-
...
|
1879
|
-
type:
|
1907
|
+
...p,
|
1908
|
+
type: v,
|
1880
1909
|
operator: $[0],
|
1881
1910
|
formula1: void 0,
|
1882
1911
|
formula2: void 0
|
1883
1912
|
};
|
1884
|
-
|
1913
|
+
b(q), h.executeCommand(yn.id, {
|
1885
1914
|
unitId: o,
|
1886
1915
|
subUnitId: i,
|
1887
|
-
ruleId:
|
1888
|
-
setting:
|
1916
|
+
ruleId: p.uid,
|
1917
|
+
setting: Vn(q)
|
1889
1918
|
});
|
1890
|
-
}, ce = u.get(
|
1891
|
-
|
1892
|
-
...
|
1893
|
-
...
|
1919
|
+
}, ce = u.get(y.formulaInput), ne = ct(() => I.map((v) => fr(v.range)).join(","), []), de = Dn(p), Se = (v) => {
|
1920
|
+
Rn(v, Dn(p)) || (b({
|
1921
|
+
...p,
|
1922
|
+
...v
|
1894
1923
|
}), C(
|
1895
|
-
|
1924
|
+
qr.id,
|
1896
1925
|
{
|
1897
1926
|
unitId: o,
|
1898
1927
|
subUnitId: i,
|
1899
1928
|
ruleId: l,
|
1900
|
-
options:
|
1929
|
+
options: v
|
1901
1930
|
}
|
1902
1931
|
));
|
1903
|
-
},
|
1904
|
-
return /* @__PURE__ */ z("div", { className:
|
1905
|
-
/* @__PURE__ */
|
1932
|
+
}, me = L.length && !p.operator;
|
1933
|
+
return /* @__PURE__ */ z("div", { className: "univer-py-4", children: [
|
1934
|
+
/* @__PURE__ */ _(
|
1906
1935
|
K,
|
1907
1936
|
{
|
1908
|
-
label:
|
1909
|
-
error: !
|
1910
|
-
children: /* @__PURE__ */
|
1911
|
-
|
1937
|
+
label: S.t("dataValidation.panel.range"),
|
1938
|
+
error: !p.ranges.length || R ? S.t("dataValidation.panel.rangeError") : "",
|
1939
|
+
children: /* @__PURE__ */ _(
|
1940
|
+
co,
|
1912
1941
|
{
|
1913
|
-
selectorRef:
|
1942
|
+
selectorRef: A,
|
1914
1943
|
unitId: o,
|
1915
1944
|
subUnitId: i,
|
1916
1945
|
initialValue: ne,
|
1917
|
-
onChange: (
|
1946
|
+
onChange: (v, N) => {
|
1918
1947
|
var $;
|
1919
|
-
!
|
1948
|
+
!k && (($ = A.current) != null && $.verify()) && j(N);
|
1920
1949
|
},
|
1921
|
-
onFocusChange: (
|
1950
|
+
onFocusChange: (v, N) => {
|
1922
1951
|
var $;
|
1923
|
-
|
1952
|
+
V(v), !v && N && (($ = A.current) != null && $.verify()) && j(N);
|
1924
1953
|
},
|
1925
|
-
onVerify: (
|
1954
|
+
onVerify: (v) => D(!v)
|
1926
1955
|
}
|
1927
1956
|
)
|
1928
1957
|
}
|
1929
1958
|
),
|
1930
|
-
/* @__PURE__ */
|
1931
|
-
|
1959
|
+
/* @__PURE__ */ _(K, { label: S.t("dataValidation.panel.type"), children: /* @__PURE__ */ _(
|
1960
|
+
bn,
|
1932
1961
|
{
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1962
|
+
className: "univer-w-full",
|
1963
|
+
value: p.type,
|
1964
|
+
options: (T = m == null ? void 0 : m.sort((v, N) => v.order - N.order)) == null ? void 0 : T.map((v) => ({
|
1965
|
+
label: S.t(v.title),
|
1966
|
+
value: v.id
|
1936
1967
|
})),
|
1937
|
-
|
1938
|
-
onChange: pe,
|
1939
|
-
className: We.dataValidationDetailFormItem
|
1968
|
+
onChange: ge
|
1940
1969
|
}
|
1941
1970
|
) }),
|
1942
|
-
|
1943
|
-
|
1971
|
+
L != null && L.length ? /* @__PURE__ */ _(K, { label: S.t("dataValidation.panel.operator"), children: /* @__PURE__ */ _(
|
1972
|
+
bn,
|
1944
1973
|
{
|
1974
|
+
className: "univer-w-full",
|
1975
|
+
value: `${p.operator}`,
|
1945
1976
|
options: [
|
1946
1977
|
{
|
1947
1978
|
value: "",
|
1948
|
-
label:
|
1979
|
+
label: S.t("dataValidation.operators.legal")
|
1949
1980
|
},
|
1950
|
-
...
|
1951
|
-
value: `${
|
1952
|
-
label: O[
|
1981
|
+
...L.map((v, N) => ({
|
1982
|
+
value: `${v}`,
|
1983
|
+
label: O[N]
|
1953
1984
|
}))
|
1954
1985
|
],
|
1955
|
-
|
1956
|
-
onChange: (f) => {
|
1986
|
+
onChange: (v) => {
|
1957
1987
|
Z({
|
1958
|
-
...
|
1959
|
-
operator:
|
1988
|
+
...te,
|
1989
|
+
operator: v
|
1960
1990
|
});
|
1961
|
-
}
|
1962
|
-
className: We.dataValidationDetailFormItem
|
1991
|
+
}
|
1963
1992
|
}
|
1964
1993
|
) }) : null,
|
1965
|
-
ce && !
|
1994
|
+
ce && !me ? /* @__PURE__ */ _(K, { children: /* @__PURE__ */ _(
|
1966
1995
|
ce,
|
1967
1996
|
{
|
1968
|
-
isTwoFormula:
|
1997
|
+
isTwoFormula: F,
|
1969
1998
|
value: {
|
1970
|
-
formula1:
|
1971
|
-
formula2:
|
1999
|
+
formula1: p.formula1,
|
2000
|
+
formula2: p.formula2
|
1972
2001
|
},
|
1973
|
-
onChange: (
|
2002
|
+
onChange: (v) => {
|
1974
2003
|
Z({
|
1975
|
-
...
|
1976
|
-
...
|
2004
|
+
...te,
|
2005
|
+
...v
|
1977
2006
|
});
|
1978
2007
|
},
|
1979
|
-
showError:
|
1980
|
-
validResult:
|
2008
|
+
showError: g,
|
2009
|
+
validResult: y.validatorFormula(p, o, i),
|
1981
2010
|
unitId: o,
|
1982
2011
|
subUnitId: i,
|
1983
2012
|
ruleId: l
|
1984
2013
|
},
|
1985
|
-
e +
|
2014
|
+
e + p.type
|
1986
2015
|
) }) : null,
|
1987
|
-
/* @__PURE__ */
|
1988
|
-
|
2016
|
+
/* @__PURE__ */ _(K, { children: /* @__PURE__ */ _(
|
2017
|
+
Pt,
|
1989
2018
|
{
|
1990
|
-
checked: (
|
2019
|
+
checked: (B = p.allowBlank) != null ? B : !0,
|
1991
2020
|
onChange: () => {
|
1992
|
-
var
|
2021
|
+
var v;
|
1993
2022
|
return Z({
|
1994
|
-
...
|
1995
|
-
allowBlank: !((
|
2023
|
+
...te,
|
2024
|
+
allowBlank: !((v = p.allowBlank) == null || v)
|
1996
2025
|
});
|
1997
2026
|
},
|
1998
|
-
children:
|
2027
|
+
children: S.t("dataValidation.panel.allowBlank")
|
1999
2028
|
}
|
2000
2029
|
) }),
|
2001
|
-
/* @__PURE__ */
|
2002
|
-
/* @__PURE__ */ z("div", { className:
|
2003
|
-
/* @__PURE__ */
|
2004
|
-
/* @__PURE__ */
|
2030
|
+
/* @__PURE__ */ _(bi, { value: de, onChange: Se, extraComponent: y.optionsInput }),
|
2031
|
+
/* @__PURE__ */ z("div", { className: "univer-mt-5 univer-flex univer-flex-row univer-justify-end", children: [
|
2032
|
+
/* @__PURE__ */ _(ze, { className: "univer-ml-3", onClick: Y, children: S.t("dataValidation.panel.removeRule") }),
|
2033
|
+
/* @__PURE__ */ _(ze, { className: "univer-ml-3", variant: "primary", onClick: x, children: S.t("dataValidation.panel.done") })
|
2005
2034
|
] })
|
2006
2035
|
] });
|
2007
2036
|
}
|
2008
|
-
const
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
dataValidationItemIcon: Ji
|
2013
|
-
}, Qi = (e) => {
|
2014
|
-
const { rule: t, onClick: n, unitId: a, subUnitId: o, disable: i } = e, r = N(ye), l = N(Q), s = N($o), d = r.getValidatorItem(t.type), u = mt(void 0), [p, c] = W(!1), _ = N(za), h = Ae(_.currentTheme$), D = ut(() => {
|
2015
|
-
var S;
|
2016
|
-
const m = (S = h == null ? void 0 : h.loopColor2) != null ? S : "#49B811", g = new Gn(m).toRgb();
|
2037
|
+
const Oi = (e) => {
|
2038
|
+
const { rule: t, onClick: r, unitId: n, subUnitId: o, disable: i } = e, a = U(ye), l = U(J), s = U(No), c = a.getValidatorItem(t.type), u = ut(void 0), [h, d] = H(!1), S = U(Yn), p = Te(S.currentTheme$), b = ct(() => {
|
2039
|
+
var m;
|
2040
|
+
const g = (m = p == null ? void 0 : p.loopColor2) != null ? m : "#49B811", f = new Yr(g).toRgb();
|
2017
2041
|
return {
|
2018
|
-
fill: `rgba(${
|
2019
|
-
stroke:
|
2042
|
+
fill: `rgba(${f.r}, ${f.g}, ${f.b}, 0.1)`,
|
2043
|
+
stroke: g
|
2020
2044
|
};
|
2021
|
-
}, [
|
2022
|
-
l.executeCommand(
|
2045
|
+
}, [p]), y = (g) => {
|
2046
|
+
l.executeCommand(tr.id, {
|
2023
2047
|
ruleId: t.uid,
|
2024
|
-
unitId:
|
2048
|
+
unitId: n,
|
2025
2049
|
subUnitId: o
|
2026
|
-
}),
|
2050
|
+
}), g.stopPropagation();
|
2027
2051
|
};
|
2028
|
-
return
|
2029
|
-
var
|
2030
|
-
u.current && ((
|
2031
|
-
|
2052
|
+
return Pe(() => () => {
|
2053
|
+
var g;
|
2054
|
+
u.current && ((g = u.current) == null || g.forEach((f) => {
|
2055
|
+
f && s.removeShape(f);
|
2032
2056
|
}));
|
2033
2057
|
}, [s]), /* @__PURE__ */ z(
|
2034
2058
|
"div",
|
2035
2059
|
{
|
2036
|
-
className:
|
2037
|
-
|
2060
|
+
className: nr(
|
2061
|
+
`
|
2062
|
+
univer-rounded-md univer-bg-secondary univer-relative univer--ml-2 univer--mr-2 univer-box-border
|
2063
|
+
univer-flex univer-w-[287px] univer-cursor-pointer univer-flex-col univer-justify-between
|
2064
|
+
univer-overflow-hidden univer-rounded-lg univer-p-2 univer-pr-9
|
2065
|
+
`,
|
2066
|
+
{
|
2067
|
+
"hover:univer-bg-gray-50": !i,
|
2068
|
+
"univer-opacity-50": i
|
2069
|
+
}
|
2070
|
+
),
|
2071
|
+
onClick: r,
|
2038
2072
|
onMouseEnter: () => {
|
2039
|
-
i || (
|
2040
|
-
range:
|
2041
|
-
style:
|
2073
|
+
i || (d(!0), u.current = t.ranges.map((g) => s.addShape({
|
2074
|
+
range: g,
|
2075
|
+
style: b,
|
2042
2076
|
primary: null
|
2043
2077
|
})));
|
2044
2078
|
},
|
2045
2079
|
onMouseLeave: () => {
|
2046
|
-
var
|
2047
|
-
|
2048
|
-
|
2080
|
+
var g;
|
2081
|
+
d(!1), (g = u.current) == null || g.forEach((f) => {
|
2082
|
+
f && s.removeShape(f);
|
2049
2083
|
}), u.current = void 0;
|
2050
2084
|
},
|
2051
2085
|
children: [
|
2052
|
-
/* @__PURE__ */
|
2053
|
-
|
2054
|
-
|
2086
|
+
/* @__PURE__ */ _(
|
2087
|
+
"div",
|
2088
|
+
{
|
2089
|
+
className: `
|
2090
|
+
univer-overflow-hidden univer-text-ellipsis univer-text-sm univer-font-medium univer-leading-[22px]
|
2091
|
+
univer-text-black
|
2092
|
+
`,
|
2093
|
+
children: c == null ? void 0 : c.generateRuleName(t)
|
2094
|
+
}
|
2095
|
+
),
|
2096
|
+
/* @__PURE__ */ _(
|
2097
|
+
"div",
|
2098
|
+
{
|
2099
|
+
className: `
|
2100
|
+
univer-text-secondary univer-overflow-hidden univer-text-ellipsis univer-text-xs univer-leading-[18px]
|
2101
|
+
`,
|
2102
|
+
children: t.ranges.map((g) => fr(g)).join(",")
|
2103
|
+
}
|
2104
|
+
),
|
2105
|
+
h ? /* @__PURE__ */ _(
|
2106
|
+
"div",
|
2107
|
+
{
|
2108
|
+
className: `
|
2109
|
+
univer-absolute univer-right-2 univer-top-[19px] univer-flex univer-h-5 univer-w-5
|
2110
|
+
univer-items-center univer-justify-center univer-rounded
|
2111
|
+
hover:univer-bg-gray-200
|
2112
|
+
`,
|
2113
|
+
onClick: y,
|
2114
|
+
children: /* @__PURE__ */ _(_n, {})
|
2115
|
+
}
|
2116
|
+
) : null
|
2055
2117
|
]
|
2056
2118
|
}
|
2057
2119
|
);
|
2058
|
-
}, er = "univer-data-validation-list", tr = "univer-data-validation-list-buttons", ar = "univer-data-validation-list-button", St = {
|
2059
|
-
dataValidationList: er,
|
2060
|
-
dataValidationListButtons: tr,
|
2061
|
-
dataValidationListButton: ar
|
2062
2120
|
};
|
2063
|
-
function
|
2064
|
-
const t =
|
2065
|
-
|
2066
|
-
s(t.getRules(
|
2067
|
-
const
|
2068
|
-
|
2121
|
+
function Ti(e) {
|
2122
|
+
const t = U(ee), r = U(le), n = U(J), o = U(we), i = 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();
|
2123
|
+
Pe(() => {
|
2124
|
+
s(t.getRules(h, d));
|
2125
|
+
const f = t.ruleChange$.subscribe((m) => {
|
2126
|
+
m.unitId === h && m.subUnitId === d && s(t.getRules(h, d));
|
2069
2127
|
});
|
2070
2128
|
return () => {
|
2071
|
-
|
2129
|
+
f.unsubscribe();
|
2072
2130
|
};
|
2073
|
-
}, [
|
2074
|
-
const
|
2075
|
-
const
|
2076
|
-
unitId:
|
2077
|
-
subUnitId:
|
2078
|
-
rule:
|
2131
|
+
}, [h, d, t]);
|
2132
|
+
const S = async () => {
|
2133
|
+
const f = qn(o), m = {
|
2134
|
+
unitId: h,
|
2135
|
+
subUnitId: d,
|
2136
|
+
rule: f
|
2079
2137
|
};
|
2080
|
-
await
|
2081
|
-
unitId:
|
2082
|
-
subUnitId:
|
2083
|
-
rule:
|
2138
|
+
await n.executeCommand(un.id, m), i.setActiveRule({
|
2139
|
+
unitId: h,
|
2140
|
+
subUnitId: d,
|
2141
|
+
rule: f
|
2084
2142
|
});
|
2085
|
-
},
|
2086
|
-
|
2087
|
-
unitId:
|
2088
|
-
subUnitId:
|
2143
|
+
}, p = () => {
|
2144
|
+
n.executeCommand(Jr.id, {
|
2145
|
+
unitId: h,
|
2146
|
+
subUnitId: d
|
2089
2147
|
});
|
2090
|
-
},
|
2091
|
-
const
|
2092
|
-
return
|
2093
|
-
})(l),
|
2094
|
-
return /* @__PURE__ */ z("div", { className:
|
2095
|
-
|
2096
|
-
var
|
2097
|
-
return /* @__PURE__ */
|
2098
|
-
|
2148
|
+
}, y = ((f) => {
|
2149
|
+
const m = r.getCurrentUnitForType(W.UNIVER_SHEET), I = m.getActiveSheet(), w = m.getUnitId(), C = I.getSheetId();
|
2150
|
+
return f.map((D) => bo(o, w, C, D.ranges) ? { ...D } : { ...D, disable: !0 });
|
2151
|
+
})(l), g = y == null ? void 0 : y.some((f) => f.disable);
|
2152
|
+
return /* @__PURE__ */ z("div", { className: "univer-pb-4", children: [
|
2153
|
+
y == null ? void 0 : y.map((f) => {
|
2154
|
+
var m;
|
2155
|
+
return /* @__PURE__ */ _(
|
2156
|
+
Oi,
|
2099
2157
|
{
|
2100
|
-
unitId:
|
2101
|
-
subUnitId:
|
2158
|
+
unitId: h,
|
2159
|
+
subUnitId: d,
|
2102
2160
|
onClick: () => {
|
2103
|
-
|
2104
|
-
unitId:
|
2105
|
-
subUnitId:
|
2106
|
-
rule:
|
2161
|
+
f.disable || i.setActiveRule({
|
2162
|
+
unitId: h,
|
2163
|
+
subUnitId: d,
|
2164
|
+
rule: f
|
2107
2165
|
});
|
2108
2166
|
},
|
2109
|
-
rule:
|
2110
|
-
disable: (
|
2167
|
+
rule: f,
|
2168
|
+
disable: (m = f.disable) != null ? m : !1
|
2111
2169
|
},
|
2112
|
-
|
2170
|
+
f.uid
|
2113
2171
|
);
|
2114
2172
|
}),
|
2115
|
-
/* @__PURE__ */ z("div", { className:
|
2116
|
-
l.length && !
|
2117
|
-
/* @__PURE__ */
|
2173
|
+
/* @__PURE__ */ z("div", { className: "univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2", children: [
|
2174
|
+
l.length && !g ? /* @__PURE__ */ _(ze, { onClick: p, children: a.t("dataValidation.panel.removeAll") }) : null,
|
2175
|
+
/* @__PURE__ */ _(ze, { variant: "primary", onClick: S, children: a.t("dataValidation.panel.add") })
|
2118
2176
|
] })
|
2119
2177
|
] });
|
2120
2178
|
}
|
2121
|
-
const
|
2122
|
-
const e =
|
2123
|
-
() =>
|
2179
|
+
const Pi = () => {
|
2180
|
+
const e = U(_e), t = Te(e.activeRule$, e.activeRule), r = U(le), n = Te(
|
2181
|
+
() => r.getCurrentTypeOfUnit$(W.UNIVER_SHEET),
|
2124
2182
|
void 0,
|
2125
2183
|
void 0,
|
2126
2184
|
[]
|
2127
|
-
), o =
|
2185
|
+
), o = Te(() => {
|
2128
2186
|
var i;
|
2129
|
-
return (i =
|
2187
|
+
return (i = n == null ? void 0 : n.activeSheet$) != null ? i : mo(null);
|
2130
2188
|
}, void 0, void 0, []);
|
2131
|
-
return !
|
2132
|
-
},
|
2133
|
-
function
|
2189
|
+
return !n || !o ? null : t && t.subUnitId === o.getSheetId() ? /* @__PURE__ */ _(Vi, {}, t.rule.uid) : /* @__PURE__ */ _(Ti, { workbook: n });
|
2190
|
+
}, Ai = "LIST_RENDER_MODE_OPTION_INPUT";
|
2191
|
+
function Dt(e) {
|
2134
2192
|
var o;
|
2135
|
-
const { value: t, onChange:
|
2136
|
-
return /* @__PURE__ */
|
2137
|
-
/* @__PURE__ */
|
2138
|
-
/* @__PURE__ */
|
2139
|
-
/* @__PURE__ */
|
2193
|
+
const { value: t, onChange: r } = e, n = U(se);
|
2194
|
+
return /* @__PURE__ */ _(K, { label: n.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ z(hn, { value: `${(o = t.renderMode) != null ? o : oe.CUSTOM}`, onChange: (i) => r({ ...t, renderMode: +i }), children: [
|
2195
|
+
/* @__PURE__ */ _(Oe, { value: `${oe.CUSTOM}`, children: n.t("dataValidation.renderMode.chip") }),
|
2196
|
+
/* @__PURE__ */ _(Oe, { value: `${oe.ARROW}`, children: n.t("dataValidation.renderMode.arrow") }),
|
2197
|
+
/* @__PURE__ */ _(Oe, { value: `${oe.TEXT}`, children: n.t("dataValidation.renderMode.text") })
|
2140
2198
|
] }) });
|
2141
2199
|
}
|
2142
|
-
|
2143
|
-
const
|
2144
|
-
function
|
2200
|
+
Dt.componentKey = Ai;
|
2201
|
+
const Li = "DATE_SHOW_TIME_OPTION";
|
2202
|
+
function Vt(e) {
|
2145
2203
|
var o;
|
2146
|
-
const { value: t, onChange:
|
2147
|
-
return /* @__PURE__ */
|
2148
|
-
|
2204
|
+
const { value: t, onChange: r } = e, n = U(se);
|
2205
|
+
return /* @__PURE__ */ _(K, { children: /* @__PURE__ */ _(
|
2206
|
+
Pt,
|
2149
2207
|
{
|
2150
2208
|
checked: (o = t.bizInfo) == null ? void 0 : o.showTime,
|
2151
2209
|
onChange: (i) => {
|
2152
|
-
|
2210
|
+
r({
|
2153
2211
|
...t,
|
2154
2212
|
bizInfo: {
|
2155
2213
|
...t.bizInfo,
|
@@ -2157,87 +2215,87 @@ function Lt(e) {
|
|
2157
2215
|
}
|
2158
2216
|
});
|
2159
2217
|
},
|
2160
|
-
children:
|
2218
|
+
children: n.t("dataValidation.showTime.label")
|
2161
2219
|
}
|
2162
2220
|
) });
|
2163
2221
|
}
|
2164
|
-
|
2165
|
-
var
|
2166
|
-
for (var o =
|
2167
|
-
(
|
2222
|
+
Vt.componentKey = Li;
|
2223
|
+
var ki = Object.getOwnPropertyDescriptor, Ni = (e, t, r, n) => {
|
2224
|
+
for (var o = n > 1 ? void 0 : n ? ki(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
2225
|
+
(a = e[i]) && (o = a(o) || o);
|
2168
2226
|
return o;
|
2169
|
-
},
|
2170
|
-
const
|
2171
|
-
let
|
2172
|
-
constructor(e, t,
|
2173
|
-
this._commandService = e, this._univerInstanceService = t, this._formulaService =
|
2227
|
+
}, Be = (e, t) => (r, n) => t(r, n, e);
|
2228
|
+
const ft = 6;
|
2229
|
+
let rn = class {
|
2230
|
+
constructor(e, t, r, n, o, i) {
|
2231
|
+
this._commandService = e, this._univerInstanceService = t, this._formulaService = r, this._themeService = n, this._renderManagerService = o, this._dataValidationModel = i;
|
2174
2232
|
}
|
2175
2233
|
_calc(e, t) {
|
2176
|
-
var
|
2177
|
-
const { vt:
|
2234
|
+
var c, u, h;
|
2235
|
+
const { vt: r, ht: n } = t || {}, o = e.endX - e.startX - ft * 2, i = e.endY - e.startY, a = ((c = t == null ? void 0 : t.fs) != null ? c : 10) * 1.6;
|
2178
2236
|
let l = 0, s = 0;
|
2179
|
-
switch (
|
2180
|
-
case
|
2237
|
+
switch (r) {
|
2238
|
+
case ae.TOP:
|
2181
2239
|
s = 0;
|
2182
2240
|
break;
|
2183
|
-
case
|
2184
|
-
s = 0 + (i -
|
2241
|
+
case ae.BOTTOM:
|
2242
|
+
s = 0 + (i - a);
|
2185
2243
|
break;
|
2186
2244
|
default:
|
2187
|
-
s = 0 + (i -
|
2245
|
+
s = 0 + (i - a) / 2;
|
2188
2246
|
break;
|
2189
2247
|
}
|
2190
|
-
switch (
|
2191
|
-
case
|
2192
|
-
l =
|
2248
|
+
switch (n) {
|
2249
|
+
case Ye.LEFT:
|
2250
|
+
l = ft;
|
2193
2251
|
break;
|
2194
|
-
case
|
2195
|
-
l =
|
2252
|
+
case Ye.RIGHT:
|
2253
|
+
l = ft + (o - a);
|
2196
2254
|
break;
|
2197
2255
|
default:
|
2198
|
-
l =
|
2256
|
+
l = ft + (o - a) / 2;
|
2199
2257
|
break;
|
2200
2258
|
}
|
2201
2259
|
return {
|
2202
2260
|
left: e.startX + l,
|
2203
2261
|
top: e.startY + s,
|
2204
2262
|
width: ((u = t == null ? void 0 : t.fs) != null ? u : 10) * 1.6,
|
2205
|
-
height: ((
|
2263
|
+
height: ((h = t == null ? void 0 : t.fs) != null ? h : 10) * 1.6
|
2206
2264
|
};
|
2207
2265
|
}
|
2208
2266
|
calcCellAutoHeight(e) {
|
2209
|
-
var
|
2267
|
+
var r;
|
2210
2268
|
const { style: t } = e;
|
2211
|
-
return ((
|
2269
|
+
return ((r = t == null ? void 0 : t.fs) != null ? r : 10) * 1.6;
|
2212
2270
|
}
|
2213
2271
|
calcCellAutoWidth(e) {
|
2214
|
-
var
|
2272
|
+
var r;
|
2215
2273
|
const { style: t } = e;
|
2216
|
-
return ((
|
2274
|
+
return ((r = t == null ? void 0 : t.fs) != null ? r : 10) * 1.6;
|
2217
2275
|
}
|
2218
|
-
async _parseFormula(e, t,
|
2219
|
-
var
|
2220
|
-
const { formula1:
|
2276
|
+
async _parseFormula(e, t, r) {
|
2277
|
+
var c, u, h, d, S, p, b, y, g;
|
2278
|
+
const { formula1: n = to, formula2: o = eo } = e, i = await this._formulaService.getRuleFormulaResult(t, r, e.uid), a = Nt((h = (u = (c = i == null ? void 0 : i[0]) == null ? void 0 : c.result) == null ? void 0 : u[0]) == null ? void 0 : h[0]), l = Nt((p = (S = (d = i == null ? void 0 : i[1]) == null ? void 0 : d.result) == null ? void 0 : S[0]) == null ? void 0 : p[0]), s = Mn(String(a)) && Mn(String(l));
|
2221
2279
|
return {
|
2222
|
-
formula1:
|
2223
|
-
formula2:
|
2280
|
+
formula1: De(n) ? Nt((g = (y = (b = i == null ? void 0 : i[0]) == null ? void 0 : b.result) == null ? void 0 : y[0]) == null ? void 0 : g[0]) : n,
|
2281
|
+
formula2: De(o) ? l : o,
|
2224
2282
|
isFormulaValid: s
|
2225
2283
|
};
|
2226
2284
|
}
|
2227
2285
|
drawWith(e, t) {
|
2228
|
-
var
|
2229
|
-
const { style:
|
2230
|
-
if (!
|
2286
|
+
var P, L, O, F;
|
2287
|
+
const { style: r, primaryWithCoord: n, unitId: o, subUnitId: i, worksheet: a, row: l, col: s } = t, c = n.isMergedMainCell ? n.mergeInfo : n, u = Q(a.getCellRaw(l, s)), h = this._dataValidationModel.getRuleByLocation(o, i, l, s);
|
2288
|
+
if (!h)
|
2231
2289
|
return;
|
2232
|
-
const
|
2233
|
-
if (!
|
2290
|
+
const d = this._dataValidationModel.getValidator(h.type);
|
2291
|
+
if (!d)
|
2234
2292
|
return;
|
2235
|
-
const
|
2236
|
-
if (!((
|
2293
|
+
const S = this._themeService.getCurrentTheme();
|
2294
|
+
if (!((P = d.skipDefaultFontRender) != null && P.call(d, h, u, { unitId: o, subUnitId: i, row: l, column: s })))
|
2237
2295
|
return;
|
2238
|
-
const
|
2239
|
-
left:
|
2240
|
-
top:
|
2296
|
+
const p = d.parseFormulaSync(h, o, i), { formula1: b } = p, y = this._calc(c, r), { a: g, d: f } = e.getTransform(), m = Tn(y.left, g), I = Tn(y.top, f), w = fo.create().composeMatrix({
|
2297
|
+
left: m,
|
2298
|
+
top: I,
|
2241
2299
|
scaleX: 1,
|
2242
2300
|
scaleY: 1,
|
2243
2301
|
angle: 0,
|
@@ -2245,163 +2303,163 @@ let da = class {
|
|
2245
2303
|
skewY: 0,
|
2246
2304
|
flipX: !1,
|
2247
2305
|
flipY: !1
|
2248
|
-
}), C =
|
2249
|
-
e.save(), e.beginPath(), e.rect(
|
2250
|
-
const
|
2251
|
-
e.transform(
|
2252
|
-
const
|
2253
|
-
|
2254
|
-
checked:
|
2255
|
-
width:
|
2256
|
-
height:
|
2257
|
-
fill: (
|
2306
|
+
}), C = c.endX - c.startX, R = c.endY - c.startY;
|
2307
|
+
e.save(), e.beginPath(), e.rect(c.startX, c.startY, C, R), e.clip();
|
2308
|
+
const D = w.getMatrix();
|
2309
|
+
e.transform(D[0], D[1], D[2], D[3], D[4], D[5]);
|
2310
|
+
const k = ((L = r == null ? void 0 : r.fs) != null ? L : 10) * 1.6, V = String(u) === String(b), A = S.hyacinth500;
|
2311
|
+
vo.drawWith(e, {
|
2312
|
+
checked: V,
|
2313
|
+
width: k,
|
2314
|
+
height: k,
|
2315
|
+
fill: (F = (O = r == null ? void 0 : r.cl) == null ? void 0 : O.rgb) != null ? F : A
|
2258
2316
|
}), e.restore();
|
2259
2317
|
}
|
2260
2318
|
isHit(e, t) {
|
2261
|
-
const
|
2262
|
-
return s <= l && s >=
|
2319
|
+
const r = t.primaryWithCoord.isMergedMainCell ? t.primaryWithCoord.mergeInfo : t.primaryWithCoord, n = this._calc(r, t.style), o = n.top, i = n.top + n.height, a = n.left, l = n.left + n.width, { x: s, y: c } = e;
|
2320
|
+
return s <= l && s >= a && c <= i && c >= o;
|
2263
2321
|
}
|
2264
2322
|
async onPointerDown(e, t) {
|
2265
|
-
var
|
2323
|
+
var p;
|
2266
2324
|
if (t.button === 2)
|
2267
2325
|
return;
|
2268
|
-
const { primaryWithCoord:
|
2269
|
-
if (!
|
2326
|
+
const { primaryWithCoord: r, unitId: n, subUnitId: o, worksheet: i, row: a, col: l } = e, s = Q(i.getCellRaw(a, l)), c = this._dataValidationModel.getRuleByLocation(n, o, a, l);
|
2327
|
+
if (!c)
|
2270
2328
|
return;
|
2271
|
-
const u = this._dataValidationModel.getValidator(
|
2272
|
-
if (!u || !((
|
2329
|
+
const u = this._dataValidationModel.getValidator(c.type);
|
2330
|
+
if (!u || !((p = u.skipDefaultFontRender) != null && p.call(u, c, s, { unitId: n, subUnitId: o, row: a, column: l })))
|
2273
2331
|
return;
|
2274
|
-
const { formula1:
|
2332
|
+
const { formula1: h, formula2: d } = await this._parseFormula(c, n, o), S = {
|
2275
2333
|
range: {
|
2276
|
-
startColumn:
|
2277
|
-
endColumn:
|
2278
|
-
startRow:
|
2279
|
-
endRow:
|
2334
|
+
startColumn: r.actualColumn,
|
2335
|
+
endColumn: r.actualColumn,
|
2336
|
+
startRow: r.actualRow,
|
2337
|
+
endRow: r.actualRow
|
2280
2338
|
},
|
2281
2339
|
value: {
|
2282
|
-
v: String(s) ===
|
2340
|
+
v: String(s) === no(String(h)) ? d : h,
|
2283
2341
|
p: null
|
2284
2342
|
}
|
2285
2343
|
};
|
2286
2344
|
this._commandService.executeCommand(
|
2287
|
-
|
2288
|
-
|
2345
|
+
st.id,
|
2346
|
+
S
|
2289
2347
|
);
|
2290
2348
|
}
|
2291
2349
|
onPointerEnter(e, t) {
|
2292
|
-
var
|
2293
|
-
(
|
2350
|
+
var r, n;
|
2351
|
+
(n = (r = Ke(W.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.mainComponent) == null || n.setCursor(Ge.POINTER);
|
2294
2352
|
}
|
2295
2353
|
onPointerLeave(e, t) {
|
2296
|
-
var
|
2297
|
-
(
|
2354
|
+
var r, n;
|
2355
|
+
(n = (r = Ke(W.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.mainComponent) == null || n.setCursor(Ge.DEFAULT);
|
2298
2356
|
}
|
2299
2357
|
};
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
],
|
2308
|
-
class
|
2358
|
+
rn = Ni([
|
2359
|
+
Be(0, J),
|
2360
|
+
Be(1, le),
|
2361
|
+
Be(2, M(Qr)),
|
2362
|
+
Be(3, M(Yn)),
|
2363
|
+
Be(4, M(Ne)),
|
2364
|
+
Be(5, M(ee))
|
2365
|
+
], rn);
|
2366
|
+
class Ui extends ve {
|
2309
2367
|
constructor() {
|
2310
2368
|
super(...arguments);
|
2311
2369
|
E(this, "id", G.CHECKBOX);
|
2312
|
-
E(this, "canvasRender", this.injector.createInstance(
|
2313
|
-
E(this, "formulaInput",
|
2370
|
+
E(this, "canvasRender", this.injector.createInstance(rn));
|
2371
|
+
E(this, "formulaInput", Zn);
|
2314
2372
|
}
|
2315
2373
|
}
|
2316
|
-
class
|
2374
|
+
class Fi extends ve {
|
2317
2375
|
constructor() {
|
2318
2376
|
super(...arguments);
|
2319
2377
|
E(this, "id", G.CUSTOM);
|
2320
|
-
E(this, "formulaInput",
|
2378
|
+
E(this, "formulaInput", Gn);
|
2321
2379
|
}
|
2322
2380
|
}
|
2323
|
-
const
|
2324
|
-
class
|
2381
|
+
const xi = "data-validation.formula-input";
|
2382
|
+
class $i extends ve {
|
2325
2383
|
constructor() {
|
2326
2384
|
super(...arguments);
|
2327
2385
|
E(this, "id", G.DATE);
|
2328
|
-
E(this, "formulaInput",
|
2329
|
-
E(this, "optionsInput",
|
2330
|
-
E(this, "dropdownType",
|
2386
|
+
E(this, "formulaInput", xi);
|
2387
|
+
E(this, "optionsInput", Vt.componentKey);
|
2388
|
+
E(this, "dropdownType", pe.DATE);
|
2331
2389
|
}
|
2332
2390
|
}
|
2333
|
-
class
|
2391
|
+
class Bi extends ve {
|
2334
2392
|
constructor() {
|
2335
2393
|
super(...arguments);
|
2336
2394
|
E(this, "id", G.DECIMAL);
|
2337
|
-
E(this, "formulaInput",
|
2395
|
+
E(this, "formulaInput", Tt);
|
2338
2396
|
}
|
2339
2397
|
}
|
2340
|
-
const
|
2341
|
-
function
|
2342
|
-
const
|
2398
|
+
const Vr = 4, Hi = 0, Ht = 4, Or = 4, on = 6, Ot = 6, Ee = 14;
|
2399
|
+
function Wi(e, t) {
|
2400
|
+
const r = _o.getTextSize(e, t), n = r.width + Vr * 2, { ba: o, bd: i } = r, a = o + i;
|
2343
2401
|
return {
|
2344
|
-
width:
|
2345
|
-
height:
|
2402
|
+
width: n,
|
2403
|
+
height: a + Hi * 2,
|
2346
2404
|
ba: o
|
2347
2405
|
};
|
2348
2406
|
}
|
2349
|
-
function
|
2350
|
-
const o = Ee +
|
2351
|
-
layout:
|
2352
|
-
text:
|
2407
|
+
function Wt(e, t, r, n) {
|
2408
|
+
const o = Ee + on * 2, i = r - o, a = n - Ot * 2, l = e.map((d) => ({
|
2409
|
+
layout: Wi(d, t),
|
2410
|
+
text: d
|
2353
2411
|
}));
|
2354
2412
|
let s;
|
2355
|
-
const
|
2356
|
-
l.forEach((
|
2357
|
-
const { layout:
|
2358
|
-
!s || s.width +
|
2359
|
-
width:
|
2360
|
-
height:
|
2413
|
+
const c = [];
|
2414
|
+
l.forEach((d) => {
|
2415
|
+
const { layout: S } = d, { width: p, height: b } = S;
|
2416
|
+
!s || s.width + p + Ht > i ? (s = {
|
2417
|
+
width: p,
|
2418
|
+
height: b,
|
2361
2419
|
items: [{
|
2362
|
-
...
|
2420
|
+
...d,
|
2363
2421
|
left: 0
|
2364
2422
|
}]
|
2365
|
-
},
|
2366
|
-
...
|
2367
|
-
left: s.width +
|
2368
|
-
}), s.width = s.width +
|
2423
|
+
}, c.push(s)) : (s.items.push({
|
2424
|
+
...d,
|
2425
|
+
left: s.width + Ht
|
2426
|
+
}), s.width = s.width + p + Ht);
|
2369
2427
|
});
|
2370
|
-
let u = 0,
|
2371
|
-
return
|
2372
|
-
|
2428
|
+
let u = 0, h = 0;
|
2429
|
+
return c.forEach((d, S) => {
|
2430
|
+
h = Math.max(h, d.width), S === c.length - 1 ? u += d.height : u += d.height + Or;
|
2373
2431
|
}), {
|
2374
|
-
lines:
|
2432
|
+
lines: c,
|
2375
2433
|
totalHeight: u,
|
2376
2434
|
contentWidth: i,
|
2377
|
-
contentHeight:
|
2378
|
-
cellAutoHeight: u +
|
2379
|
-
calcAutoWidth:
|
2435
|
+
contentHeight: a,
|
2436
|
+
cellAutoHeight: u + Ot * 2,
|
2437
|
+
calcAutoWidth: h + o
|
2380
2438
|
};
|
2381
2439
|
}
|
2382
|
-
const
|
2383
|
-
class
|
2384
|
-
static drawWith(t,
|
2385
|
-
const { fontString:
|
2386
|
-
t.save(),
|
2440
|
+
const ji = 8;
|
2441
|
+
class Yi extends So {
|
2442
|
+
static drawWith(t, r) {
|
2443
|
+
const { fontString: n, info: o, fill: i, color: a } = r, { layout: l, text: s } = o;
|
2444
|
+
t.save(), cr.drawWith(t, {
|
2387
2445
|
width: l.width,
|
2388
2446
|
height: l.height,
|
2389
|
-
radius:
|
2390
|
-
fill: i ||
|
2391
|
-
}), t.translateWithPrecision(
|
2447
|
+
radius: ji,
|
2448
|
+
fill: i || He
|
2449
|
+
}), t.translateWithPrecision(Vr, l.ba), t.font = n, t.fillStyle = a, t.fillText(s, 0, 0), t.restore();
|
2392
2450
|
}
|
2393
2451
|
}
|
2394
|
-
var
|
2395
|
-
for (var o =
|
2396
|
-
(
|
2452
|
+
var Xi = Object.getOwnPropertyDescriptor, zi = (e, t, r, n) => {
|
2453
|
+
for (var o = n > 1 ? void 0 : n ? Xi(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
2454
|
+
(a = e[i]) && (o = a(o) || o);
|
2397
2455
|
return o;
|
2398
|
-
},
|
2399
|
-
const
|
2400
|
-
let
|
2401
|
-
constructor(e, t,
|
2456
|
+
}, vt = (e, t) => (r, n) => t(r, n, e);
|
2457
|
+
const Ki = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
|
2458
|
+
let an = class {
|
2459
|
+
constructor(e, t, r, n) {
|
2402
2460
|
E(this, "zIndex");
|
2403
2461
|
E(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
2404
|
-
this._commandService = e, this._univerInstanceService = t, this._renderManagerService =
|
2462
|
+
this._commandService = e, this._univerInstanceService = t, this._renderManagerService = r, this._dataValidationModel = n;
|
2405
2463
|
}
|
2406
2464
|
_ensureMap(e) {
|
2407
2465
|
let t = this._dropdownInfoMap.get(e);
|
@@ -2410,168 +2468,168 @@ let ua = class {
|
|
2410
2468
|
_generateKey(e, t) {
|
2411
2469
|
return `${e}.${t}`;
|
2412
2470
|
}
|
2413
|
-
_drawDownIcon(e, t,
|
2414
|
-
const i =
|
2415
|
-
let
|
2471
|
+
_drawDownIcon(e, t, r, n, o) {
|
2472
|
+
const i = r - Ee + 4;
|
2473
|
+
let a = 4;
|
2416
2474
|
switch (o) {
|
2417
|
-
case
|
2418
|
-
|
2475
|
+
case ae.MIDDLE:
|
2476
|
+
a = (n - Ee) / 2 + 4;
|
2419
2477
|
break;
|
2420
|
-
case
|
2421
|
-
|
2478
|
+
case ae.BOTTOM:
|
2479
|
+
a = n - Ee + 4;
|
2422
2480
|
break;
|
2423
2481
|
}
|
2424
|
-
e.save(), e.translateWithPrecision(t.startX + i, t.startY +
|
2482
|
+
e.save(), e.translateWithPrecision(t.startX + i, t.startY + a), e.fillStyle = "#565656", e.fill(Ki), e.restore();
|
2425
2483
|
}
|
2426
2484
|
// eslint-disable-next-line max-lines-per-function
|
2427
|
-
drawWith(e, t,
|
2485
|
+
drawWith(e, t, r, n) {
|
2428
2486
|
var Z, Y;
|
2429
|
-
const { primaryWithCoord: o, row: i, col:
|
2430
|
-
if (!
|
2487
|
+
const { primaryWithCoord: o, row: i, col: a, style: l, data: s, subUnitId: c } = t, u = o.isMergedMainCell ? o.mergeInfo : o, h = s == null ? void 0 : s.fontRenderExtension, { leftOffset: d = 0, rightOffset: S = 0, topOffset: p = 0, downOffset: b = 0 } = h || {}, y = this._ensureMap(c), g = this._generateKey(i, a), f = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, i, a);
|
2488
|
+
if (!f)
|
2431
2489
|
return;
|
2432
|
-
const
|
2433
|
-
if (!
|
2490
|
+
const m = this._dataValidationModel.getValidator(f.type);
|
2491
|
+
if (!m)
|
2434
2492
|
return;
|
2435
|
-
const
|
2436
|
-
startX: u.startX +
|
2437
|
-
endX: u.endX -
|
2438
|
-
startY: u.startY +
|
2439
|
-
endY: u.endY -
|
2440
|
-
}, w =
|
2441
|
-
this._drawDownIcon(e,
|
2493
|
+
const I = {
|
2494
|
+
startX: u.startX + d,
|
2495
|
+
endX: u.endX - S,
|
2496
|
+
startY: u.startY + p,
|
2497
|
+
endY: u.endY - b
|
2498
|
+
}, w = I.endX - I.startX, C = I.endY - I.startY, { cl: R } = l || {}, D = (Z = typeof R == "object" ? R == null ? void 0 : R.rgb : R) != null ? Z : "#000", k = Ut(l != null ? l : void 0), { vt: V, ht: A } = l || {}, P = V != null ? V : ae.MIDDLE, L = (Y = Q(s)) != null ? Y : "", O = m.parseCellValue(L), F = m.getListWithColorMap(f), x = Wt(O, k, w, C);
|
2499
|
+
this._drawDownIcon(e, I, w, C, P), e.save(), e.translateWithPrecision(I.startX, I.startY), e.beginPath(), e.rect(0, 0, w - Ee, C), e.clip(), e.translateWithPrecision(on, Ot);
|
2442
2500
|
let j = 0;
|
2443
|
-
switch (
|
2444
|
-
case
|
2445
|
-
j = (
|
2501
|
+
switch (P) {
|
2502
|
+
case ae.MIDDLE:
|
2503
|
+
j = (x.contentHeight - x.totalHeight) / 2;
|
2446
2504
|
break;
|
2447
|
-
case
|
2448
|
-
j =
|
2505
|
+
case ae.BOTTOM:
|
2506
|
+
j = x.contentHeight - x.totalHeight;
|
2449
2507
|
break;
|
2450
2508
|
}
|
2451
|
-
e.translateWithPrecision(0, j),
|
2509
|
+
e.translateWithPrecision(0, j), x.lines.forEach((te, ge) => {
|
2452
2510
|
e.save();
|
2453
|
-
const { width: ce, height: ne, items:
|
2454
|
-
let
|
2455
|
-
switch (
|
2456
|
-
case
|
2457
|
-
|
2511
|
+
const { width: ce, height: ne, items: de } = te;
|
2512
|
+
let Se = 0;
|
2513
|
+
switch (A) {
|
2514
|
+
case Ye.RIGHT:
|
2515
|
+
Se = x.contentWidth - ce;
|
2458
2516
|
break;
|
2459
|
-
case
|
2460
|
-
|
2517
|
+
case Ye.CENTER:
|
2518
|
+
Se = (x.contentWidth - ce) / 2;
|
2461
2519
|
break;
|
2462
2520
|
}
|
2463
|
-
e.translate(
|
2464
|
-
e.save(), e.translateWithPrecision(
|
2465
|
-
...
|
2466
|
-
info:
|
2467
|
-
color:
|
2468
|
-
fill:
|
2521
|
+
e.translate(Se, ge * (ne + Or)), de.forEach((me) => {
|
2522
|
+
e.save(), e.translateWithPrecision(me.left, 0), Yi.drawWith(e, {
|
2523
|
+
...k,
|
2524
|
+
info: me,
|
2525
|
+
color: D,
|
2526
|
+
fill: F[me.text]
|
2469
2527
|
}), e.restore();
|
2470
2528
|
}), e.restore();
|
2471
|
-
}), e.restore(),
|
2472
|
-
left:
|
2473
|
-
top:
|
2474
|
-
width:
|
2475
|
-
height:
|
2529
|
+
}), e.restore(), y.set(g, {
|
2530
|
+
left: I.startX,
|
2531
|
+
top: I.startY,
|
2532
|
+
width: x.contentWidth + on + Ee,
|
2533
|
+
height: x.contentHeight + Ot * 2
|
2476
2534
|
});
|
2477
2535
|
}
|
2478
2536
|
calcCellAutoHeight(e) {
|
2479
2537
|
var w;
|
2480
|
-
const { primaryWithCoord: t, style:
|
2481
|
-
startX:
|
2482
|
-
endX:
|
2483
|
-
startY:
|
2484
|
-
endY:
|
2485
|
-
},
|
2486
|
-
if (!
|
2538
|
+
const { primaryWithCoord: t, style: r, data: n, row: o, col: i } = 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 = {
|
2539
|
+
startX: h.startX + l,
|
2540
|
+
endX: h.endX - s,
|
2541
|
+
startY: h.startY + c,
|
2542
|
+
endY: h.endY - u
|
2543
|
+
}, S = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, o, i);
|
2544
|
+
if (!S)
|
2487
2545
|
return;
|
2488
|
-
const
|
2489
|
-
if (!
|
2546
|
+
const p = this._dataValidationModel.getValidator(S.type);
|
2547
|
+
if (!p)
|
2490
2548
|
return;
|
2491
|
-
const
|
2492
|
-
return
|
2549
|
+
const b = d.endX - d.startX, y = d.endY - d.startY, g = (w = Q(n)) != null ? w : "", f = p.parseCellValue(g), m = Ut(r != null ? r : void 0);
|
2550
|
+
return Wt(f, m, b, y).cellAutoHeight;
|
2493
2551
|
}
|
2494
2552
|
calcCellAutoWidth(e) {
|
2495
2553
|
var w;
|
2496
|
-
const { primaryWithCoord: t, style:
|
2497
|
-
startX:
|
2498
|
-
endX:
|
2499
|
-
startY:
|
2500
|
-
endY:
|
2501
|
-
},
|
2502
|
-
if (!
|
2554
|
+
const { primaryWithCoord: t, style: r, data: n, row: o, col: i } = 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 = {
|
2555
|
+
startX: h.startX + l,
|
2556
|
+
endX: h.endX - s,
|
2557
|
+
startY: h.startY + c,
|
2558
|
+
endY: h.endY - u
|
2559
|
+
}, S = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, o, i);
|
2560
|
+
if (!S)
|
2503
2561
|
return;
|
2504
|
-
const
|
2505
|
-
if (!
|
2562
|
+
const p = this._dataValidationModel.getValidator(S.type);
|
2563
|
+
if (!p)
|
2506
2564
|
return;
|
2507
|
-
const
|
2508
|
-
return
|
2565
|
+
const b = d.endX - d.startX, y = d.endY - d.startY, g = (w = Q(n)) != null ? w : "", f = p.parseCellValue(g), m = Ut(r != null ? r : void 0);
|
2566
|
+
return Wt(f, m, b, y).calcAutoWidth;
|
2509
2567
|
}
|
2510
2568
|
isHit(e, t) {
|
2511
|
-
const { primaryWithCoord:
|
2569
|
+
const { primaryWithCoord: r } = t, n = r.isMergedMainCell ? r.mergeInfo : r, { endX: o } = n, { x: i } = e;
|
2512
2570
|
return i >= o - Ee && i <= o;
|
2513
2571
|
}
|
2514
2572
|
onPointerDown(e, t) {
|
2515
2573
|
if (t.button === 2)
|
2516
2574
|
return;
|
2517
|
-
const { unitId:
|
2518
|
-
unitId:
|
2519
|
-
subUnitId:
|
2575
|
+
const { unitId: r, subUnitId: n, row: o, col: i } = e, a = {
|
2576
|
+
unitId: r,
|
2577
|
+
subUnitId: n,
|
2520
2578
|
row: o,
|
2521
2579
|
column: i
|
2522
2580
|
};
|
2523
|
-
this._commandService.executeCommand(
|
2581
|
+
this._commandService.executeCommand(At.id, a);
|
2524
2582
|
}
|
2525
2583
|
onPointerEnter(e, t) {
|
2526
|
-
var
|
2527
|
-
return (
|
2584
|
+
var r, n;
|
2585
|
+
return (n = (r = Ke(W.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.mainComponent) == null ? void 0 : n.setCursor(Ge.POINTER);
|
2528
2586
|
}
|
2529
2587
|
onPointerLeave(e, t) {
|
2530
|
-
var
|
2531
|
-
return (
|
2588
|
+
var r, n;
|
2589
|
+
return (n = (r = Ke(W.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.mainComponent) == null ? void 0 : n.setCursor(Ge.DEFAULT);
|
2532
2590
|
}
|
2533
2591
|
};
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
],
|
2540
|
-
class
|
2592
|
+
an = zi([
|
2593
|
+
vt(0, J),
|
2594
|
+
vt(1, le),
|
2595
|
+
vt(2, M(Ne)),
|
2596
|
+
vt(3, M(ee))
|
2597
|
+
], an);
|
2598
|
+
class Gi extends ve {
|
2541
2599
|
constructor() {
|
2542
2600
|
super(...arguments);
|
2543
2601
|
E(this, "id", G.LIST_MULTIPLE);
|
2544
|
-
E(this, "canvasRender", this.injector.createInstance(
|
2545
|
-
E(this, "dropdownType",
|
2602
|
+
E(this, "canvasRender", this.injector.createInstance(an));
|
2603
|
+
E(this, "dropdownType", pe.MULTIPLE_LIST);
|
2546
2604
|
}
|
2547
2605
|
}
|
2548
|
-
var
|
2549
|
-
for (var o =
|
2550
|
-
(
|
2606
|
+
var Zi = Object.getOwnPropertyDescriptor, qi = (e, t, r, n) => {
|
2607
|
+
for (var o = n > 1 ? void 0 : n ? Zi(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
2608
|
+
(a = e[i]) && (o = a(o) || o);
|
2551
2609
|
return o;
|
2552
|
-
},
|
2553
|
-
const
|
2554
|
-
function
|
2555
|
-
const
|
2610
|
+
}, at = (e, t) => (r, n) => t(r, n, e);
|
2611
|
+
const be = 4, _t = 4, he = 14, fe = 6, We = 4, jt = 8, Ji = "#565656", Fn = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
|
2612
|
+
function Qi(e, t) {
|
2613
|
+
const r = e.length;
|
2556
2614
|
return {
|
2557
2615
|
id: "d",
|
2558
2616
|
body: {
|
2559
|
-
dataStream: `${e}${
|
2617
|
+
dataStream: `${e}${zr}`,
|
2560
2618
|
textRuns: [
|
2561
2619
|
{
|
2562
2620
|
ts: {
|
2563
2621
|
fs: 11,
|
2564
2622
|
ff: void 0,
|
2565
|
-
it:
|
2566
|
-
bl:
|
2623
|
+
it: rt.FALSE,
|
2624
|
+
bl: rt.FALSE,
|
2567
2625
|
ul: {
|
2568
|
-
s:
|
2626
|
+
s: rt.FALSE
|
2569
2627
|
},
|
2570
2628
|
st: {
|
2571
|
-
s:
|
2629
|
+
s: rt.FALSE
|
2572
2630
|
},
|
2573
2631
|
ol: {
|
2574
|
-
s:
|
2632
|
+
s: rt.FALSE
|
2575
2633
|
},
|
2576
2634
|
cl: void 0,
|
2577
2635
|
...t,
|
@@ -2579,7 +2637,7 @@ function yr(e, t) {
|
|
2579
2637
|
bd: void 0
|
2580
2638
|
},
|
2581
2639
|
st: 0,
|
2582
|
-
ed:
|
2640
|
+
ed: r
|
2583
2641
|
}
|
2584
2642
|
]
|
2585
2643
|
},
|
@@ -2591,64 +2649,64 @@ function yr(e, t) {
|
|
2591
2649
|
}
|
2592
2650
|
};
|
2593
2651
|
}
|
2594
|
-
function
|
2595
|
-
const
|
2652
|
+
function Tr(e, t, r) {
|
2653
|
+
const n = Qi(e, r), o = new Xr(n), i = new Io(o);
|
2596
2654
|
return {
|
2597
|
-
documentSkeleton:
|
2655
|
+
documentSkeleton: wo.create(i, t),
|
2598
2656
|
docModel: o,
|
2599
2657
|
docViewModel: i
|
2600
2658
|
};
|
2601
2659
|
}
|
2602
|
-
function
|
2660
|
+
function St(e, t, r) {
|
2603
2661
|
const {
|
2604
|
-
documentSkeleton:
|
2662
|
+
documentSkeleton: n,
|
2605
2663
|
docModel: o,
|
2606
2664
|
docViewModel: i
|
2607
|
-
} =
|
2665
|
+
} = Tr(e, t, r);
|
2608
2666
|
return {
|
2609
|
-
documents: new
|
2667
|
+
documents: new Co(`DOCUMENTS_${Kt.generateRandomId()}`, n, {
|
2610
2668
|
pageMarginLeft: 0,
|
2611
2669
|
pageMarginTop: 0
|
2612
2670
|
}),
|
2613
|
-
documentSkeleton:
|
2671
|
+
documentSkeleton: n,
|
2614
2672
|
docModel: o,
|
2615
2673
|
docViewModel: i
|
2616
2674
|
};
|
2617
2675
|
}
|
2618
|
-
function
|
2676
|
+
function xn(e, t, r, n, o, i, a = !0) {
|
2619
2677
|
let l = 0;
|
2620
|
-
const s =
|
2678
|
+
const s = a ? We : 0;
|
2621
2679
|
switch (o) {
|
2622
|
-
case
|
2623
|
-
l = t -
|
2680
|
+
case ae.BOTTOM:
|
2681
|
+
l = t - n - s;
|
2624
2682
|
break;
|
2625
|
-
case
|
2626
|
-
l = (t -
|
2683
|
+
case ae.MIDDLE:
|
2684
|
+
l = (t - n) / 2;
|
2627
2685
|
break;
|
2628
2686
|
default:
|
2629
2687
|
l = s;
|
2630
2688
|
break;
|
2631
2689
|
}
|
2632
|
-
l = Math.max(
|
2633
|
-
let
|
2690
|
+
l = Math.max(We, l);
|
2691
|
+
let c = 0;
|
2634
2692
|
switch (i) {
|
2635
|
-
case
|
2636
|
-
|
2693
|
+
case Ye.CENTER:
|
2694
|
+
c = (e - r) / 2;
|
2637
2695
|
break;
|
2638
|
-
case
|
2639
|
-
|
2696
|
+
case Ye.RIGHT:
|
2697
|
+
c = e - r;
|
2640
2698
|
break;
|
2641
2699
|
}
|
2642
|
-
return
|
2643
|
-
paddingLeft:
|
2700
|
+
return c = Math.max(fe, c), {
|
2701
|
+
paddingLeft: c,
|
2644
2702
|
paddingTop: l
|
2645
2703
|
};
|
2646
2704
|
}
|
2647
|
-
let
|
2648
|
-
constructor(e, t,
|
2705
|
+
let sn = class {
|
2706
|
+
constructor(e, t, r, n, o) {
|
2649
2707
|
E(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
2650
2708
|
E(this, "zIndex");
|
2651
|
-
this._univerInstanceService = e, this._localeService = t, this._commandService =
|
2709
|
+
this._univerInstanceService = e, this._localeService = t, this._commandService = r, this._renderManagerService = n, this._dataValidationModel = o;
|
2652
2710
|
}
|
2653
2711
|
_ensureMap(e) {
|
2654
2712
|
let t = this._dropdownInfoMap.get(e);
|
@@ -2657,198 +2715,198 @@ let ha = class {
|
|
2657
2715
|
_generateKey(e, t) {
|
2658
2716
|
return `${e}.${t}`;
|
2659
2717
|
}
|
2660
|
-
_drawDownIcon(e, t,
|
2661
|
-
const { t: l =
|
2718
|
+
_drawDownIcon(e, t, r, n, o, i, a) {
|
2719
|
+
const { t: l = re.pd.t, b: s = re.pd.b } = a, c = r - he;
|
2662
2720
|
let u;
|
2663
2721
|
switch (i) {
|
2664
|
-
case
|
2665
|
-
u = (
|
2722
|
+
case ae.MIDDLE:
|
2723
|
+
u = (n - _t) / 2;
|
2666
2724
|
break;
|
2667
|
-
case
|
2668
|
-
u =
|
2725
|
+
case ae.BOTTOM:
|
2726
|
+
u = n - s - o - We + (o / 2 - _t / 2);
|
2669
2727
|
break;
|
2670
2728
|
default:
|
2671
|
-
u = l +
|
2729
|
+
u = l + We + (o / 2 - _t / 2);
|
2672
2730
|
break;
|
2673
2731
|
}
|
2674
|
-
e.save(), e.translateWithPrecision(t.startX +
|
2732
|
+
e.save(), e.translateWithPrecision(t.startX + c, t.startY + u), e.fillStyle = "#565656", e.fill(Fn), e.restore();
|
2675
2733
|
}
|
2676
2734
|
// eslint-disable-next-line max-lines-per-function, complexity
|
2677
|
-
drawWith(e, t,
|
2678
|
-
const { primaryWithCoord:
|
2735
|
+
drawWith(e, t, r) {
|
2736
|
+
const { primaryWithCoord: n, row: o, col: i, style: a, data: l, subUnitId: s } = t, c = n.isMergedMainCell ? n.mergeInfo : n, u = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, o, i);
|
2679
2737
|
if (!u)
|
2680
2738
|
return;
|
2681
|
-
const
|
2682
|
-
if (!
|
2739
|
+
const h = this._dataValidationModel.getValidator(u.type);
|
2740
|
+
if (!h)
|
2683
2741
|
return;
|
2684
|
-
const
|
2685
|
-
if (!u || !
|
2742
|
+
const d = l == null ? void 0 : l.fontRenderExtension, { leftOffset: S = 0, rightOffset: p = 0, topOffset: b = 0, downOffset: y = 0 } = d || {};
|
2743
|
+
if (!u || !h || !h || h.id.indexOf(G.LIST) !== 0 || !h.skipDefaultFontRender(u))
|
2686
2744
|
return;
|
2687
|
-
const
|
2688
|
-
startX:
|
2689
|
-
endX:
|
2690
|
-
startY:
|
2691
|
-
endY:
|
2692
|
-
},
|
2693
|
-
let { tb:
|
2694
|
-
if (
|
2695
|
-
const { l: O =
|
2696
|
-
|
2697
|
-
const ce =
|
2698
|
-
this._drawDownIcon(e,
|
2699
|
-
left:
|
2700
|
-
top:
|
2745
|
+
const g = {
|
2746
|
+
startX: c.startX + S,
|
2747
|
+
endX: c.endX - p,
|
2748
|
+
startY: c.startY + b,
|
2749
|
+
endY: c.endY - y
|
2750
|
+
}, f = g.endX - g.startX, m = g.endY - g.startY, I = this._ensureMap(s), w = this._generateKey(o, i), C = h.getListWithColor(u), R = Q(l), D = `${R != null ? R : ""}`, k = C.find((O) => O.label === D);
|
2751
|
+
let { tb: V, vt: A, ht: P, pd: L } = a || {};
|
2752
|
+
if (V = V != null ? V : Ie.WRAP, A = A != null ? A : ae.BOTTOM, P = P != null ? P : re.ht, L = L != null ? L : re.pd, u.renderMode === oe.ARROW) {
|
2753
|
+
const { l: O = re.pd.l, t: F = re.pd.t, r: x = re.pd.r, b: j = re.pd.b } = L, Z = f - O - x - he - 4, { documentSkeleton: Y, documents: te, docModel: ge } = St(D, this._localeService, a);
|
2754
|
+
V === Ie.WRAP && ge.updateDocumentDataPageSize(Math.max(Z, 1)), Y.calculate(), Y.getActualSize();
|
2755
|
+
const ce = ot(Y), { height: ne, width: de } = ce, { paddingTop: Se, paddingLeft: me } = xn(Z, m - F - j, de, ne, A, P, !0);
|
2756
|
+
this._drawDownIcon(e, g, f, m, ne, A, L), e.save(), e.translateWithPrecision(g.startX + O, g.startY + F), e.beginPath(), e.rect(0, 0, f - O - x, m - F - j), 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(me, 0), e.restore(), e.restore(), I.set(w, {
|
2757
|
+
left: g.endX + O + r.rowHeaderWidth - he,
|
2758
|
+
top: g.startY + F + r.columnHeaderHeight,
|
2701
2759
|
width: he,
|
2702
|
-
height:
|
2760
|
+
height: m - F - j
|
2703
2761
|
});
|
2704
2762
|
} else {
|
2705
|
-
e.save(), e.translateWithPrecision(
|
2706
|
-
const O =
|
2707
|
-
|
2708
|
-
const Z =
|
2709
|
-
e.translateWithPrecision(
|
2710
|
-
const ne = Math.max(
|
2711
|
-
|
2763
|
+
e.save(), e.translateWithPrecision(g.startX, g.startY), e.beginPath(), e.rect(0, 0, f, m), e.clip();
|
2764
|
+
const O = f - fe * 2 - be - he - 4, { documentSkeleton: F, documents: x, docModel: j } = St(D, this._localeService, a);
|
2765
|
+
V === Ie.WRAP && j.updateDocumentDataPageSize(Math.max(O, 1)), F.calculate();
|
2766
|
+
const Z = ot(F), { height: Y, width: te } = Z, { paddingTop: ge, paddingLeft: ce } = xn(O, m, te, Y, A, P);
|
2767
|
+
e.translateWithPrecision(fe, ge);
|
2768
|
+
const ne = Math.max(f - fe * 2, 1), de = Y;
|
2769
|
+
cr.drawWith(e, {
|
2712
2770
|
width: ne,
|
2713
|
-
height:
|
2714
|
-
fill: (
|
2715
|
-
radius:
|
2716
|
-
}), e.save(), e.translateWithPrecision(
|
2717
|
-
left:
|
2718
|
-
top:
|
2771
|
+
height: de,
|
2772
|
+
fill: (k == null ? void 0 : k.color) || He,
|
2773
|
+
radius: jt
|
2774
|
+
}), e.save(), e.translateWithPrecision(be, 0), e.beginPath(), e.rect(0, 0, O, Y), e.clip(), e.translateWithPrecision(ce, 0), x.render(e), e.restore(), e.translateWithPrecision(O + be + 4, (Y - _t) / 2), e.fillStyle = Ji, e.fill(Fn), e.restore(), I.set(w, {
|
2775
|
+
left: g.startX + fe + r.rowHeaderWidth,
|
2776
|
+
top: g.startY + ge + r.columnHeaderHeight,
|
2719
2777
|
width: ne,
|
2720
|
-
height:
|
2778
|
+
height: de
|
2721
2779
|
});
|
2722
2780
|
}
|
2723
2781
|
}
|
2724
2782
|
calcCellAutoHeight(e) {
|
2725
|
-
const { primaryWithCoord: t, style:
|
2726
|
-
if (!
|
2783
|
+
const { primaryWithCoord: t, style: r, data: n, row: o, col: i } = 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, o, i);
|
2784
|
+
if (!d || d.renderMode === oe.TEXT)
|
2727
2785
|
return;
|
2728
|
-
const
|
2729
|
-
startX:
|
2730
|
-
endX:
|
2731
|
-
startY:
|
2732
|
-
endY:
|
2733
|
-
},
|
2734
|
-
let { tb:
|
2735
|
-
const { t:
|
2736
|
-
if (
|
2737
|
-
const w =
|
2738
|
-
|
2739
|
-
const
|
2740
|
-
return
|
2786
|
+
const S = {
|
2787
|
+
startX: a.startX + s,
|
2788
|
+
endX: a.endX - c,
|
2789
|
+
startY: a.startY + u,
|
2790
|
+
endY: a.endY - h
|
2791
|
+
}, p = S.endX - S.startX, b = Q(n), y = `${b != null ? b : ""}`;
|
2792
|
+
let { tb: g, pd: f } = r || {};
|
2793
|
+
const { t: m = re.pd.t, b: I = re.pd.b } = f != null ? f : {};
|
2794
|
+
if (g = g != null ? g : Ie.WRAP, d.renderMode === oe.ARROW) {
|
2795
|
+
const w = p - he, { documentSkeleton: C, docModel: R } = St(y, this._localeService, r);
|
2796
|
+
g === Ie.WRAP && R.updateDocumentDataPageSize(Math.max(w, 1)), C.calculate(), C.getActualSize();
|
2797
|
+
const D = ot(C), { height: k } = D;
|
2798
|
+
return k + m + I + We * 2;
|
2741
2799
|
} else {
|
2742
|
-
const w =
|
2743
|
-
|
2744
|
-
const
|
2745
|
-
height:
|
2746
|
-
} =
|
2747
|
-
return
|
2800
|
+
const w = p - fe * 2 - be - he, { documentSkeleton: C, docModel: R } = Tr(y, this._localeService, r);
|
2801
|
+
g === Ie.WRAP && R.updateDocumentDataPageSize(Math.max(w, 1)), C.calculate();
|
2802
|
+
const D = ot(C), {
|
2803
|
+
height: k
|
2804
|
+
} = D;
|
2805
|
+
return k + We * 2;
|
2748
2806
|
}
|
2749
2807
|
}
|
2750
2808
|
calcCellAutoWidth(e) {
|
2751
|
-
const { primaryWithCoord: t, style:
|
2752
|
-
if (!
|
2809
|
+
const { primaryWithCoord: t, style: r, data: n, row: o, col: i } = 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, o, i);
|
2810
|
+
if (!d || d.renderMode === oe.TEXT)
|
2753
2811
|
return;
|
2754
|
-
const
|
2755
|
-
startX:
|
2756
|
-
endX:
|
2757
|
-
startY:
|
2758
|
-
endY:
|
2759
|
-
},
|
2760
|
-
let { tb:
|
2761
|
-
const { l:
|
2762
|
-
|
2763
|
-
let w =
|
2764
|
-
switch (
|
2765
|
-
case
|
2766
|
-
w = he +
|
2812
|
+
const S = {
|
2813
|
+
startX: a.startX + s,
|
2814
|
+
endX: a.endX - c,
|
2815
|
+
startY: a.startY + u,
|
2816
|
+
endY: a.endY - h
|
2817
|
+
}, p = S.endX - S.startX, b = Q(n), y = `${b != null ? b : ""}`;
|
2818
|
+
let { tb: g, pd: f } = r || {};
|
2819
|
+
const { l: m = re.pd.l, r: I = re.pd.r } = f != null ? f : {};
|
2820
|
+
g = g != null ? g : Ie.WRAP;
|
2821
|
+
let w = fe * 2 + he;
|
2822
|
+
switch (d.renderMode) {
|
2823
|
+
case oe.ARROW:
|
2824
|
+
w = he + fe * 2 + I + m;
|
2767
2825
|
break;
|
2768
|
-
case
|
2769
|
-
w = he +
|
2826
|
+
case oe.CUSTOM:
|
2827
|
+
w = he + fe * 2 + be * 2 + I + m + jt / 2 + 1;
|
2770
2828
|
break;
|
2771
2829
|
// default is CUSTOM
|
2772
2830
|
default:
|
2773
|
-
w = he +
|
2831
|
+
w = he + fe * 2 + be * 2 + I + m + jt / 2 + 1;
|
2774
2832
|
}
|
2775
|
-
const C =
|
2776
|
-
return
|
2833
|
+
const C = p - w, { documentSkeleton: R, docModel: D } = St(y, this._localeService, r);
|
2834
|
+
return g === Ie.WRAP && D.updateDocumentDataPageSize(Math.max(C, 1)), R.calculate(), R.getActualSize(), ot(R).width + w;
|
2777
2835
|
}
|
2778
2836
|
isHit(e, t) {
|
2779
|
-
const { subUnitId:
|
2780
|
-
if (!l || !
|
2837
|
+
const { subUnitId: r, row: n, col: o } = t, a = this._ensureMap(r).get(this._generateKey(n, o)), l = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, n, o);
|
2838
|
+
if (!l || !a || l.renderMode === oe.TEXT)
|
2781
2839
|
return !1;
|
2782
|
-
const { top: s, left:
|
2783
|
-
return
|
2840
|
+
const { top: s, left: c, width: u, height: h } = a, { x: d, y: S } = e;
|
2841
|
+
return d >= c && d <= c + u && S >= s && S <= s + h;
|
2784
2842
|
}
|
2785
2843
|
onPointerDown(e, t) {
|
2786
2844
|
if (t.button === 2)
|
2787
2845
|
return;
|
2788
|
-
const { unitId:
|
2789
|
-
unitId:
|
2790
|
-
subUnitId:
|
2846
|
+
const { unitId: r, subUnitId: n, row: o, col: i } = e, a = {
|
2847
|
+
unitId: r,
|
2848
|
+
subUnitId: n,
|
2791
2849
|
row: o,
|
2792
2850
|
column: i
|
2793
2851
|
};
|
2794
|
-
this._commandService.executeCommand(
|
2852
|
+
this._commandService.executeCommand(At.id, a);
|
2795
2853
|
}
|
2796
2854
|
onPointerEnter(e, t) {
|
2797
|
-
var
|
2798
|
-
(
|
2855
|
+
var r, n;
|
2856
|
+
(n = (r = Ke(W.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.mainComponent) == null || n.setCursor(Ge.POINTER);
|
2799
2857
|
}
|
2800
2858
|
onPointerLeave(e, t) {
|
2801
|
-
var
|
2802
|
-
(
|
2859
|
+
var r, n;
|
2860
|
+
(n = (r = Ke(W.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.mainComponent) == null || n.setCursor(Ge.DEFAULT);
|
2803
2861
|
}
|
2804
2862
|
};
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
],
|
2812
|
-
class
|
2863
|
+
sn = qi([
|
2864
|
+
at(0, le),
|
2865
|
+
at(1, M(se)),
|
2866
|
+
at(2, J),
|
2867
|
+
at(3, M(Ne)),
|
2868
|
+
at(4, M(ee))
|
2869
|
+
], sn);
|
2870
|
+
class ea extends ve {
|
2813
2871
|
constructor() {
|
2814
2872
|
super(...arguments);
|
2815
2873
|
E(this, "id", G.LIST);
|
2816
|
-
E(this, "canvasRender", this.injector.createInstance(
|
2817
|
-
E(this, "dropdownType",
|
2818
|
-
E(this, "optionsInput",
|
2819
|
-
E(this, "formulaInput",
|
2874
|
+
E(this, "canvasRender", this.injector.createInstance(sn));
|
2875
|
+
E(this, "dropdownType", pe.LIST);
|
2876
|
+
E(this, "optionsInput", Dt.componentKey);
|
2877
|
+
E(this, "formulaInput", dn);
|
2820
2878
|
}
|
2821
2879
|
}
|
2822
|
-
class
|
2880
|
+
class ta extends ve {
|
2823
2881
|
constructor() {
|
2824
2882
|
super(...arguments);
|
2825
2883
|
E(this, "id", G.TEXT_LENGTH);
|
2826
|
-
E(this, "formulaInput",
|
2884
|
+
E(this, "formulaInput", Tt);
|
2827
2885
|
}
|
2828
2886
|
}
|
2829
|
-
class
|
2887
|
+
class na extends ve {
|
2830
2888
|
constructor() {
|
2831
2889
|
super(...arguments);
|
2832
2890
|
E(this, "id", G.WHOLE);
|
2833
|
-
E(this, "formulaInput",
|
2891
|
+
E(this, "formulaInput", Tt);
|
2834
2892
|
}
|
2835
2893
|
}
|
2836
|
-
var
|
2837
|
-
for (var o =
|
2838
|
-
(
|
2894
|
+
var ra = Object.getOwnPropertyDescriptor, oa = (e, t, r, n) => {
|
2895
|
+
for (var o = n > 1 ? void 0 : n ? ra(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
2896
|
+
(a = e[i]) && (o = a(o) || o);
|
2839
2897
|
return o;
|
2840
|
-
},
|
2841
|
-
let
|
2842
|
-
constructor(e, t,
|
2843
|
-
super(), this._injector = e, this._componentManger = t, this._dataValidatorRegistryService =
|
2898
|
+
}, Yt = (e, t) => (r, n) => t(r, n, e);
|
2899
|
+
let tt = class extends cn {
|
2900
|
+
constructor(e, t, r) {
|
2901
|
+
super(), this._injector = e, this._componentManger = t, this._dataValidatorRegistryService = r, this._initComponents(), this._registerValidatorViews();
|
2844
2902
|
}
|
2845
2903
|
_initComponents() {
|
2846
2904
|
[
|
2847
|
-
[
|
2848
|
-
[bt,
|
2849
|
-
[
|
2850
|
-
[
|
2851
|
-
...
|
2905
|
+
[Mr, _r],
|
2906
|
+
[bt, Pi],
|
2907
|
+
[Dt.componentKey, Dt],
|
2908
|
+
[Vt.componentKey, Vt],
|
2909
|
+
...ei
|
2852
2910
|
].forEach(([e, t]) => {
|
2853
2911
|
this.disposeWithMe(this._componentManger.register(
|
2854
2912
|
e,
|
@@ -2858,144 +2916,144 @@ let nt = class extends ma {
|
|
2858
2916
|
}
|
2859
2917
|
_registerValidatorViews() {
|
2860
2918
|
[
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2864
|
-
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
2919
|
+
Bi,
|
2920
|
+
na,
|
2921
|
+
ta,
|
2922
|
+
$i,
|
2923
|
+
Ui,
|
2924
|
+
ea,
|
2925
|
+
Gi,
|
2926
|
+
Fi
|
2869
2927
|
].forEach((e) => {
|
2870
|
-
const t = this._injector.createInstance(e),
|
2871
|
-
|
2928
|
+
const t = this._injector.createInstance(e), r = this._dataValidatorRegistryService.getValidatorItem(t.id);
|
2929
|
+
r && (r.formulaInput = t.formulaInput, r.canvasRender = t.canvasRender, r.dropdownType = t.dropdownType, r.optionsInput = t.optionsInput);
|
2872
2930
|
});
|
2873
2931
|
}
|
2874
2932
|
};
|
2875
|
-
|
2876
|
-
|
2877
|
-
|
2878
|
-
|
2879
|
-
],
|
2880
|
-
var
|
2881
|
-
for (var o =
|
2882
|
-
(
|
2933
|
+
tt = oa([
|
2934
|
+
Yt(0, M(we)),
|
2935
|
+
Yt(1, M(gn)),
|
2936
|
+
Yt(2, M(ye))
|
2937
|
+
], tt);
|
2938
|
+
var ia = Object.getOwnPropertyDescriptor, aa = (e, t, r, n) => {
|
2939
|
+
for (var o = n > 1 ? void 0 : n ? ia(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
2940
|
+
(a = e[i]) && (o = a(o) || o);
|
2883
2941
|
return o;
|
2884
|
-
},
|
2885
|
-
const
|
2886
|
-
var
|
2887
|
-
let
|
2888
|
-
constructor(e =
|
2889
|
-
super(), this._config = e, this._injector = t, this._commandService =
|
2890
|
-
const { menu: o, ...i } =
|
2942
|
+
}, Xt = (e, t) => (r, n) => t(r, n, e);
|
2943
|
+
const sa = "SHEET_DATA_VALIDATION_UI_PLUGIN";
|
2944
|
+
var Ct;
|
2945
|
+
let $n = (Ct = class extends Xn {
|
2946
|
+
constructor(e = Mt, t, r, n) {
|
2947
|
+
super(), this._config = e, this._injector = t, this._commandService = r, this._configService = n;
|
2948
|
+
const { menu: o, ...i } = zn(
|
2891
2949
|
{},
|
2892
|
-
|
2950
|
+
Mt,
|
2893
2951
|
this._config
|
2894
2952
|
);
|
2895
|
-
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(
|
2953
|
+
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(Sn, i);
|
2896
2954
|
}
|
2897
2955
|
onStarting() {
|
2898
2956
|
[
|
2899
|
-
[
|
2900
|
-
[
|
2901
|
-
[
|
2902
|
-
[
|
2903
|
-
[at],
|
2904
|
-
[tt],
|
2957
|
+
[_e],
|
2958
|
+
[Ae],
|
2959
|
+
[dt],
|
2960
|
+
[qe],
|
2905
2961
|
[et],
|
2962
|
+
[Qe],
|
2906
2963
|
[Je],
|
2907
|
-
[
|
2964
|
+
[Ze],
|
2965
|
+
[tt]
|
2908
2966
|
].forEach((e) => {
|
2909
2967
|
this._injector.add(e);
|
2910
2968
|
}), [
|
2911
|
-
|
2912
|
-
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2969
|
+
Lt,
|
2970
|
+
At,
|
2971
|
+
yr,
|
2972
|
+
Cn,
|
2973
|
+
Fe,
|
2974
|
+
Rr
|
2917
2975
|
].forEach((e) => {
|
2918
2976
|
this._commandService.registerCommand(e);
|
2919
2977
|
});
|
2920
2978
|
}
|
2921
2979
|
onReady() {
|
2922
|
-
this._injector.get(
|
2923
|
-
|
2924
|
-
[
|
2980
|
+
this._injector.get(Je), this._injector.get(Qe), this._injector.get(Ze), this._injector.get(dt), this._injector.get(Ne).registerRenderModule(
|
2981
|
+
W.UNIVER_SHEET,
|
2982
|
+
[Et]
|
2925
2983
|
);
|
2926
2984
|
}
|
2927
2985
|
onRendered() {
|
2928
|
-
this._injector.get(
|
2986
|
+
this._injector.get(tt), this._injector.get(et);
|
2929
2987
|
}
|
2930
2988
|
onSteady() {
|
2931
|
-
this._injector.get(
|
2932
|
-
}
|
2933
|
-
}, E(
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
],
|
2939
|
-
var
|
2940
|
-
for (var o =
|
2941
|
-
(
|
2989
|
+
this._injector.get(qe);
|
2990
|
+
}
|
2991
|
+
}, E(Ct, "pluginName", sa), E(Ct, "type", W.UNIVER_SHEET), Ct);
|
2992
|
+
$n = aa([
|
2993
|
+
Xt(1, M(we)),
|
2994
|
+
Xt(2, J),
|
2995
|
+
Xt(3, ln)
|
2996
|
+
], $n);
|
2997
|
+
var la = Object.getOwnPropertyDescriptor, ca = (e, t, r, n) => {
|
2998
|
+
for (var o = n > 1 ? void 0 : n ? la(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
2999
|
+
(a = e[i]) && (o = a(o) || o);
|
2942
3000
|
return o;
|
2943
|
-
},
|
2944
|
-
const
|
2945
|
-
var
|
2946
|
-
let
|
2947
|
-
constructor(e =
|
2948
|
-
super(), this._config = e, this._injector = t, this._commandService =
|
2949
|
-
const { menu: o, ...i } =
|
3001
|
+
}, zt = (e, t) => (r, n) => t(r, n, e);
|
3002
|
+
const da = "SHEET_DATA_VALIDATION_UI_PLUGIN";
|
3003
|
+
var It;
|
3004
|
+
let Bn = (It = class extends Xn {
|
3005
|
+
constructor(e = Mt, t, r, n) {
|
3006
|
+
super(), this._config = e, this._injector = t, this._commandService = r, this._configService = n;
|
3007
|
+
const { menu: o, ...i } = zn(
|
2950
3008
|
{},
|
2951
|
-
|
3009
|
+
Mt,
|
2952
3010
|
this._config
|
2953
3011
|
);
|
2954
|
-
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(
|
3012
|
+
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(Sn, i);
|
2955
3013
|
}
|
2956
3014
|
onStarting() {
|
2957
3015
|
[
|
2958
|
-
[
|
2959
|
-
[
|
2960
|
-
[
|
2961
|
-
[
|
2962
|
-
[at],
|
2963
|
-
[tt],
|
3016
|
+
[_e],
|
3017
|
+
[Ae],
|
3018
|
+
[dt],
|
3019
|
+
[qe],
|
2964
3020
|
[et],
|
2965
|
-
[
|
3021
|
+
[Qe],
|
3022
|
+
[Je],
|
3023
|
+
[tt]
|
2966
3024
|
].forEach((e) => {
|
2967
3025
|
this._injector.add(e);
|
2968
3026
|
}), [
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
3027
|
+
Lt,
|
3028
|
+
At,
|
3029
|
+
yr,
|
3030
|
+
Cn,
|
3031
|
+
Fe,
|
3032
|
+
Rr
|
2975
3033
|
].forEach((e) => {
|
2976
3034
|
this._commandService.registerCommand(e);
|
2977
3035
|
});
|
2978
3036
|
}
|
2979
3037
|
onReady() {
|
2980
|
-
this._injector.get(
|
2981
|
-
|
2982
|
-
[
|
3038
|
+
this._injector.get(Je), this._injector.get(Qe), this._injector.get(Ne).registerRenderModule(
|
3039
|
+
W.UNIVER_SHEET,
|
3040
|
+
[Et]
|
2983
3041
|
);
|
2984
3042
|
}
|
2985
3043
|
onRendered() {
|
2986
|
-
this._injector.get(
|
3044
|
+
this._injector.get(tt), this._injector.get(et);
|
2987
3045
|
}
|
2988
3046
|
onSteady() {
|
2989
|
-
this._injector.get(
|
2990
|
-
}
|
2991
|
-
}, E(
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
2996
|
-
],
|
3047
|
+
this._injector.get(qe);
|
3048
|
+
}
|
3049
|
+
}, E(It, "pluginName", da), E(It, "type", W.UNIVER_SHEET), It);
|
3050
|
+
Bn = ca([
|
3051
|
+
zt(1, M(we)),
|
3052
|
+
zt(2, J),
|
3053
|
+
zt(3, ln)
|
3054
|
+
], Bn);
|
2997
3055
|
export {
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3056
|
+
ve as BaseSheetDataValidatorView,
|
3057
|
+
Bn as UniverSheetsDataValidationMobileUIPlugin,
|
3058
|
+
$n as UniverSheetsDataValidationUIPlugin
|
3001
3059
|
};
|