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