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