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