@univerjs/sheets-data-validation-ui 0.5.0-nightly.202411241606 → 0.5.0-nightly.202411261607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +726 -731
- package/lib/types/controllers/dv-auto-fill.controller.d.ts +2 -2
- package/lib/umd/index.js +2 -2
- package/package.json +13 -13
package/lib/es/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
var Bo = Object.defineProperty;
|
2
2
|
var $o = (e, t, o) => t in e ? Bo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
3
3
|
var M = (e, t, o) => $o(e, typeof t != "symbol" ? t + "" : t, o);
|
4
|
-
import zt, { useState as
|
5
|
-
import { Inject as b, LocaleService as J, Disposable as De, DataValidationErrorStyle as ot, useDependency as
|
4
|
+
import zt, { useState as W, forwardRef as we, useRef as We, createElement as Re, useMemo as Te, useEffect as Ce } from "react";
|
5
|
+
import { Inject as b, LocaleService as J, Disposable as De, DataValidationErrorStyle as ot, useDependency as P, ICommandService as Q, dayjs as Kt, numfmt as Gt, CellValueType as ko, UniverInstanceType as Y, toDisposable as Wo, IUniverInstanceService as ge, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Ho, DisposableCollection as Yo, CommandType as qe, BuildTextUtils as Xo, DataValidationRenderMode as de, DataValidationType as Z, IConfigService as dn, UndoCommand as zo, RedoCommand as Ko, isUnitRangesEqual as Go, debounce as Zo, shallowEqual as Vn, Injector as Fe, DataValidationStatus as at, ObjectMatrix as vt, Range as qo, Rectangle as _t, queryObjectMatrix as Zt, Optional as Jo, RxDisposable as cn, InterceptorEffectEnum as Wn, sequenceExecute as Hn, bufferDebounceTime as Qo, isFormulaString as Pe, Tools as qt, ThemeService as ea, VerticalAlign as ue, HorizontalAlign as He, DEFAULT_STYLES as le, WrapStrategy as Se, DocumentDataModel as ta, DEFAULT_EMPTY_DOCUMENT_VALUE as na, BooleanNumber as Je, Plugin as Yn } from "@univerjs/core";
|
6
6
|
import { Button as je, DatePanel as oa, Scrollbar as aa, FormLayout as G, RadioGroup as un, Radio as Ae, Checkbox as Mt, Input as xe, Select as Jt, DraggableList as ia } from "@univerjs/design";
|
7
7
|
import { DeviceInputEventType as Qt, IRenderManagerService as Ve, fixLineWidthByScale as yn, Transform as ra, Checkbox as sa, CURSOR_TYPE as Ye, FontCache as la, Shape as da, Rect as Xn, getFontStyleString as At, getDocsSkeletonPageSize as Qe, DocumentViewModel as ca, DocumentSkeleton as ua, Documents as ha } from "@univerjs/engine-render";
|
8
8
|
import { SheetInterceptorService as hn, AFTER_CELL_EDIT_ASYNC as pa, SetRangeValuesCommand as pn, SheetsSelectionsService as zn, getSheetCommandTarget as Kn, WorkbookEditablePermission as St, RangeProtectionPermissionEditPoint as Ct, WorksheetEditPermission as It, checkRangesEditablePermission as ma, WorksheetSetCellStylePermission as en, INTERCEPTOR_POINT as Gn, InterceptCellContentPriority as Zn } from "@univerjs/sheets";
|
@@ -37,7 +37,7 @@ Ot.Fragment = Ka;
|
|
37
37
|
Ot.jsx = go;
|
38
38
|
Ot.jsxs = go;
|
39
39
|
fo.exports = Ot;
|
40
|
-
var
|
40
|
+
var u = fo.exports, Ja = Object.defineProperty, Qa = Object.getOwnPropertyDescriptor, ei = (e, t, o, n) => {
|
41
41
|
for (var a = n > 1 ? void 0 : n ? Qa(t, o) : t, i = e.length - 1, r; i >= 0; i--)
|
42
42
|
(r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a);
|
43
43
|
return n && a && Ja(t, o, a), a;
|
@@ -51,19 +51,19 @@ let it = class extends De {
|
|
51
51
|
pa,
|
52
52
|
{
|
53
53
|
handler: async (e, t, o) => {
|
54
|
-
var
|
55
|
-
const n = await e, { worksheet: a, row: i, col: r, unitId:
|
54
|
+
var _;
|
55
|
+
const n = await e, { worksheet: a, row: i, col: r, unitId: s, subUnitId: l, workbook: c } = t, h = this._dataValidationModel.getRuleIdByLocation(s, l, i, r), p = h ? this._dataValidationModel.getRuleById(s, l, h) : void 0;
|
56
56
|
if (!p || p.errorStyle !== ot.STOP)
|
57
57
|
return o(Promise.resolve(n));
|
58
58
|
const d = await this._dataValidatorRegistryService.getValidatorItem(p.type);
|
59
59
|
if (!d || await d.validator(
|
60
60
|
{
|
61
61
|
value: ie(n),
|
62
|
-
interceptValue: ie((
|
62
|
+
interceptValue: ie((_ = t == null ? void 0 : t.origin) != null ? _ : n),
|
63
63
|
row: i,
|
64
64
|
column: r,
|
65
|
-
unitId:
|
66
|
-
subUnitId:
|
65
|
+
unitId: s,
|
66
|
+
subUnitId: l,
|
67
67
|
worksheet: a,
|
68
68
|
workbook: c,
|
69
69
|
t: n == null ? void 0 : n.t
|
@@ -79,7 +79,7 @@ let it = class extends De {
|
|
79
79
|
},
|
80
80
|
id: "reject-input-dialog",
|
81
81
|
children: {
|
82
|
-
title: d.getRuleFinalError(p, { row: i, col: r, unitId:
|
82
|
+
title: d.getRuleFinalError(p, { row: i, col: r, unitId: s, subUnitId: l })
|
83
83
|
},
|
84
84
|
footer: {
|
85
85
|
title: zt.createElement(
|
@@ -146,26 +146,26 @@ const ti = "univer-dv-date-dropdown", ni = "univer-dv-date-dropdown-btns", An =
|
|
146
146
|
};
|
147
147
|
function ai(e) {
|
148
148
|
var g;
|
149
|
-
const { location: t, hideFn: o } = e, { worksheet: n, row: a, col: i, unitId: r, subUnitId:
|
149
|
+
const { location: t, hideFn: o } = e, { worksheet: n, row: a, col: i, unitId: r, subUnitId: s, workbook: l } = t, c = P(Q), h = P(it), p = n.getCell(a, i), d = ie(n.getCellRaw(a, i)), v = oi(d), [m, _] = W(v), w = m && m.isValid() ? m : Kt(), S = P(J), R = P(oe), I = R.getRuleByLocation(r, s, a, i);
|
150
150
|
if (!I)
|
151
151
|
return null;
|
152
|
-
const
|
153
|
-
if (!p || !
|
152
|
+
const V = R.getValidator(I.type);
|
153
|
+
if (!p || !V)
|
154
154
|
return;
|
155
|
-
const
|
156
|
-
var x, j,
|
157
|
-
if (!
|
155
|
+
const C = !!((g = I.bizInfo) != null && g.showTime), f = async () => {
|
156
|
+
var x, j, F;
|
157
|
+
if (!w)
|
158
158
|
return;
|
159
|
-
const
|
160
|
-
I.errorStyle !== ot.STOP || await
|
161
|
-
value:
|
159
|
+
const L = w.format(C ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"), U = (x = Gt.parseDate(L)) == null ? void 0 : x.v, T = l.getStyles().getStyleByCell(p), E = (F = (j = T == null ? void 0 : T.n) == null ? void 0 : j.pattern) != null ? F : "", A = Ra(E);
|
160
|
+
I.errorStyle !== ot.STOP || await V.validator({
|
161
|
+
value: U,
|
162
162
|
unitId: r,
|
163
|
-
subUnitId:
|
163
|
+
subUnitId: s,
|
164
164
|
row: a,
|
165
165
|
column: i,
|
166
166
|
worksheet: n,
|
167
|
-
workbook:
|
168
|
-
interceptValue:
|
167
|
+
workbook: l,
|
168
|
+
interceptValue: L.replace("Z", "").replace("T", " "),
|
169
169
|
t: ko.NUMBER
|
170
170
|
}, I) ? (o(), await c.executeCommand(ao.id, {
|
171
171
|
visible: !1,
|
@@ -174,7 +174,7 @@ function ai(e) {
|
|
174
174
|
keycode: on.ESC
|
175
175
|
}), await c.executeCommand(pn.id, {
|
176
176
|
unitId: r,
|
177
|
-
subUnitId:
|
177
|
+
subUnitId: s,
|
178
178
|
range: {
|
179
179
|
startColumn: i,
|
180
180
|
endColumn: i,
|
@@ -182,36 +182,36 @@ function ai(e) {
|
|
182
182
|
endRow: a
|
183
183
|
},
|
184
184
|
value: {
|
185
|
-
v:
|
185
|
+
v: U,
|
186
186
|
t: 2,
|
187
187
|
p: null,
|
188
188
|
f: null,
|
189
189
|
si: null,
|
190
190
|
s: {
|
191
191
|
n: {
|
192
|
-
pattern:
|
192
|
+
pattern: C ? A === "datetime" ? E : "yyyy-MM-dd hh:mm:ss" : A === "date" ? E : "yyyy-MM-dd"
|
193
193
|
}
|
194
194
|
}
|
195
195
|
}
|
196
|
-
})) :
|
196
|
+
})) : h.showReject(V.getRuleFinalError(I, { row: a, col: i, unitId: r, subUnitId: s }));
|
197
197
|
};
|
198
|
-
return /* @__PURE__ */
|
199
|
-
/* @__PURE__ */
|
198
|
+
return /* @__PURE__ */ u.jsxs("div", { className: An.dvDateDropdown, children: [
|
199
|
+
/* @__PURE__ */ u.jsx(
|
200
200
|
oa,
|
201
201
|
{
|
202
|
-
defaultValue:
|
203
|
-
pickerValue:
|
204
|
-
showTime:
|
205
|
-
onSelect: async (
|
206
|
-
|
202
|
+
defaultValue: w,
|
203
|
+
pickerValue: w,
|
204
|
+
showTime: C || void 0,
|
205
|
+
onSelect: async (y) => {
|
206
|
+
_(y);
|
207
207
|
},
|
208
|
-
onPanelChange: (
|
209
|
-
|
208
|
+
onPanelChange: (y) => {
|
209
|
+
_(y);
|
210
210
|
},
|
211
|
-
disabledDate: (
|
211
|
+
disabledDate: (y) => !Gt.parseDate(y.format("YYYY-MM-DD"))
|
212
212
|
}
|
213
213
|
),
|
214
|
-
/* @__PURE__ */
|
214
|
+
/* @__PURE__ */ u.jsx("div", { className: An.dvDateDropdownBtns, children: /* @__PURE__ */ u.jsx(je, { size: "small", type: "primary", onClick: f, disabled: !w.isValid(), children: S.t("dataValidation.alert.ok") }) })
|
215
215
|
] });
|
216
216
|
}
|
217
217
|
var ce = function() {
|
@@ -230,8 +230,8 @@ var ce = function() {
|
|
230
230
|
t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
|
231
231
|
return o;
|
232
232
|
}, Me = we(function(e, t) {
|
233
|
-
var o = e.icon, n = e.id, a = e.className, i = e.extend, r = ii(e, ["icon", "id", "className", "extend"]),
|
234
|
-
return vo(o, "".concat(n), { defIds: o.defIds, idSuffix:
|
233
|
+
var o = e.icon, n = e.id, a = e.className, i = e.extend, r = ii(e, ["icon", "id", "className", "extend"]), s = "univerjs-icon univerjs-icon-".concat(n, " ").concat(a || "").trim(), l = We("_".concat(li()));
|
234
|
+
return vo(o, "".concat(n), { defIds: o.defIds, idSuffix: l.current }, ce({ ref: t, className: s }, r), i);
|
235
235
|
});
|
236
236
|
function vo(e, t, o, n, a) {
|
237
237
|
return Re(e.tag, ce(ce({ key: t }, ri(e, o, a)), n), (si(e, o).children || []).map(function(i, r) {
|
@@ -243,8 +243,8 @@ function ri(e, t, o) {
|
|
243
243
|
o != null && o.colorChannel1 && n.fill === "colorChannel1" && (n.fill = o.colorChannel1);
|
244
244
|
var a = t.defIds;
|
245
245
|
return !a || a.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(i) {
|
246
|
-
var r = i[0],
|
247
|
-
typeof
|
246
|
+
var r = i[0], s = i[1];
|
247
|
+
typeof s == "string" && (n[r] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
248
248
|
})), n;
|
249
249
|
}
|
250
250
|
function si(e, t) {
|
@@ -328,7 +328,7 @@ let me = class extends De {
|
|
328
328
|
M(this, "activeRule$", this._activeRule$.asObservable());
|
329
329
|
M(this, "_closeDisposable", null);
|
330
330
|
this._univerInstanceService = t, this._sidebarService = o, this.disposeWithMe(
|
331
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
331
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(vn((n) => !n)).subscribe(() => {
|
332
332
|
this.close();
|
333
333
|
})
|
334
334
|
), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((n) => {
|
@@ -368,20 +368,20 @@ me = _i([
|
|
368
368
|
xn(1, lo)
|
369
369
|
], me);
|
370
370
|
function Si() {
|
371
|
-
const e =
|
371
|
+
const e = P(Ie), t = Ne(e.activeDropdown$, e.activeDropdown), o = P(bt);
|
372
372
|
if (!t)
|
373
373
|
return null;
|
374
374
|
const { location: n, componentKey: a } = t, i = o.get(a), r = `${n.unitId}-${n.subUnitId}-${n.row}-${n.col}`;
|
375
375
|
if (!i)
|
376
376
|
return null;
|
377
|
-
const
|
377
|
+
const s = () => {
|
378
378
|
e.hideDropdown();
|
379
379
|
};
|
380
|
-
return /* @__PURE__ */
|
380
|
+
return /* @__PURE__ */ u.jsx(
|
381
381
|
i,
|
382
382
|
{
|
383
383
|
location: n,
|
384
|
-
hideFn:
|
384
|
+
hideFn: s
|
385
385
|
},
|
386
386
|
r
|
387
387
|
);
|
@@ -393,14 +393,14 @@ var Ci = Object.defineProperty, Ii = Object.getOwnPropertyDescriptor, wi = (e, t
|
|
393
393
|
return n && a && Ci(t, o, a), a;
|
394
394
|
}, be = (e, t) => (o, n) => t(o, n, e);
|
395
395
|
let Ie = class extends De {
|
396
|
-
constructor(t, o, n, a, i, r,
|
396
|
+
constructor(t, o, n, a, i, r, s) {
|
397
397
|
super();
|
398
398
|
M(this, "_activeDropdown");
|
399
399
|
M(this, "_activeDropdown$", new Wa());
|
400
400
|
M(this, "_currentPopup", null);
|
401
401
|
M(this, "activeDropdown$", this._activeDropdown$.asObservable());
|
402
402
|
M(this, "_zenVisible", !1);
|
403
|
-
this._canvasPopupManagerService = t, this._univerInstanceService = o, this._dataValidatorRegistryService = n, this._zenZoneService = a, this._renderManagerService = i, this._dataValidationModel = r, this._sheetsSelectionsService =
|
403
|
+
this._canvasPopupManagerService = t, this._univerInstanceService = o, this._dataValidatorRegistryService = n, this._zenZoneService = a, this._renderManagerService = i, this._dataValidationModel = r, this._sheetsSelectionsService = s, this._init(), this._initSelectionChange(), this.disposeWithMe(() => {
|
404
404
|
this._activeDropdown$.complete();
|
405
405
|
});
|
406
406
|
}
|
@@ -413,17 +413,17 @@ let Ie = class extends De {
|
|
413
413
|
}));
|
414
414
|
}
|
415
415
|
_getDropdownByCell(t, o, n, a) {
|
416
|
-
const i = t ? this._univerInstanceService.getUnit(t,
|
416
|
+
const i = t ? this._univerInstanceService.getUnit(t, Y.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitForType(Y.UNIVER_SHEET);
|
417
417
|
if (!i)
|
418
418
|
return;
|
419
419
|
const r = o ? i.getSheetBySheetId(o) : i.getActiveSheet();
|
420
420
|
if (!r)
|
421
421
|
return;
|
422
|
-
const
|
423
|
-
if (!
|
422
|
+
const s = this._dataValidationModel.getRuleByLocation(i.getUnitId(), r.getSheetId(), n, a);
|
423
|
+
if (!s)
|
424
424
|
return;
|
425
|
-
const
|
426
|
-
return
|
425
|
+
const l = this._dataValidatorRegistryService.getValidatorItem(s.type);
|
426
|
+
return l == null ? void 0 : l.dropdown;
|
427
427
|
}
|
428
428
|
_initSelectionChange() {
|
429
429
|
this.disposeWithMe(this._sheetsSelectionsService.selectionMoveEnd$.subscribe((t) => {
|
@@ -431,11 +431,11 @@ let Ie = class extends De {
|
|
431
431
|
}));
|
432
432
|
}
|
433
433
|
showDropdown(t, o = !0) {
|
434
|
-
const { location: n } = t, { row: a, col: i, unitId: r, subUnitId:
|
434
|
+
const { location: n } = t, { row: a, col: i, unitId: r, subUnitId: s } = n;
|
435
435
|
if (this._currentPopup && this._currentPopup.dispose(), this._zenVisible)
|
436
436
|
return;
|
437
437
|
this._activeDropdown = t, this._activeDropdown$.next(this._activeDropdown);
|
438
|
-
const
|
438
|
+
const l = this._renderManagerService.getRenderById(Ho), c = this._canvasPopupManagerService.attachPopupToCell(
|
439
439
|
a,
|
440
440
|
i,
|
441
441
|
{
|
@@ -444,35 +444,35 @@ let Ie = class extends De {
|
|
444
444
|
o && this.hideDropdown();
|
445
445
|
},
|
446
446
|
offset: [0, 3],
|
447
|
-
excludeOutside: [
|
447
|
+
excludeOutside: [l == null ? void 0 : l.engine.getCanvasElement()].filter(Boolean)
|
448
448
|
},
|
449
449
|
r,
|
450
|
-
|
450
|
+
s
|
451
451
|
);
|
452
452
|
if (!c)
|
453
453
|
throw new Error("[DataValidationDropdownManagerService]: cannot show dropdown!");
|
454
|
-
const
|
455
|
-
|
454
|
+
const h = new Yo();
|
455
|
+
h.add(c), h.add({
|
456
456
|
dispose: () => {
|
457
457
|
var p, d;
|
458
458
|
(d = (p = this._activeDropdown) == null ? void 0 : p.onHide) == null || d.call(p);
|
459
459
|
}
|
460
|
-
}), this._currentPopup =
|
460
|
+
}), this._currentPopup = h;
|
461
461
|
}
|
462
462
|
hideDropdown() {
|
463
463
|
this._activeDropdown && (this._currentPopup && this._currentPopup.dispose(), this._currentPopup = null, this._activeDropdown = null, this._activeDropdown$.next(null));
|
464
464
|
}
|
465
465
|
showDataValidationDropdown(t, o, n, a, i) {
|
466
|
-
const r = this._univerInstanceService.getUnit(t,
|
466
|
+
const r = this._univerInstanceService.getUnit(t, Y.UNIVER_SHEET);
|
467
467
|
if (!r)
|
468
468
|
return;
|
469
|
-
const
|
470
|
-
if (!l)
|
471
|
-
return;
|
472
|
-
const s = this._dataValidationModel.getRuleByLocation(r.getUnitId(), l.getSheetId(), n, a);
|
469
|
+
const s = r.getSheetBySheetId(o);
|
473
470
|
if (!s)
|
474
471
|
return;
|
475
|
-
const
|
472
|
+
const l = this._dataValidationModel.getRuleByLocation(r.getUnitId(), s.getSheetId(), n, a);
|
473
|
+
if (!l)
|
474
|
+
return;
|
475
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(l.type);
|
476
476
|
if (!c || !c.dropdown) {
|
477
477
|
this.hideDropdown();
|
478
478
|
return;
|
@@ -480,7 +480,7 @@ let Ie = class extends De {
|
|
480
480
|
this.showDropdown({
|
481
481
|
location: {
|
482
482
|
workbook: r,
|
483
|
-
worksheet:
|
483
|
+
worksheet: s,
|
484
484
|
row: n,
|
485
485
|
col: a,
|
486
486
|
unitId: t,
|
@@ -506,15 +506,15 @@ const Cn = "DataValidationPanel", Ue = {
|
|
506
506
|
handler(e, t) {
|
507
507
|
if (!t)
|
508
508
|
return !1;
|
509
|
-
const { ruleId: o, isAdd: n } = t, a = e.get(me), i = e.get(Et), r = e.get(ge),
|
510
|
-
if (!
|
511
|
-
const { unitId: c, subUnitId:
|
509
|
+
const { ruleId: o, isAdd: n } = t, a = e.get(me), i = e.get(Et), r = e.get(ge), s = e.get(lo), l = Kn(r);
|
510
|
+
if (!l) return !1;
|
511
|
+
const { unitId: c, subUnitId: h } = l, p = o ? i.getRuleById(c, h, o) : void 0;
|
512
512
|
a.open(), a.setActiveRule(p && {
|
513
513
|
unitId: c,
|
514
|
-
subUnitId:
|
514
|
+
subUnitId: h,
|
515
515
|
rule: p
|
516
516
|
});
|
517
|
-
const d =
|
517
|
+
const d = s.open({
|
518
518
|
header: { title: n ? "dataValidation.panel.addTitle" : "dataValidation.panel.title" },
|
519
519
|
children: { label: Cn },
|
520
520
|
width: 312,
|
@@ -541,8 +541,8 @@ const Cn = "DataValidationPanel", Ue = {
|
|
541
541
|
handler(e, t) {
|
542
542
|
if (!t)
|
543
543
|
return !1;
|
544
|
-
const o = e.get(Ie), { unitId: n, subUnitId: a, row: i, column: r } = t,
|
545
|
-
return
|
544
|
+
const o = e.get(Ie), { unitId: n, subUnitId: a, row: i, column: r } = t, s = o.activeDropdown, l = s == null ? void 0 : s.location;
|
545
|
+
return l && l.unitId === n && l.subUnitId === a && l.row === i && l.col === r || o.showDataValidationDropdown(
|
546
546
|
n,
|
547
547
|
a,
|
548
548
|
i,
|
@@ -566,93 +566,93 @@ const Cn = "DataValidationPanel", Ue = {
|
|
566
566
|
dvListDropdownSplit: Oi,
|
567
567
|
dvListDropdownEdit: Pi
|
568
568
|
}, Li = (e) => {
|
569
|
-
var
|
570
|
-
const { value: t, onChange: o, multiple: n, options: a, title: i, onEdit: r, style:
|
569
|
+
var C, f;
|
570
|
+
const { value: t, onChange: o, multiple: n, options: a, title: i, onEdit: r, style: s, filter: l, location: c } = e, h = P(J), p = P(dn), d = l == null ? void 0 : l.toLowerCase(), { row: v, col: m, unitId: _, subUnitId: w } = c, S = a.filter((g) => d ? g.label.toLowerCase().includes(d) : !0), R = (f = (C = p.getConfig(wn)) == null ? void 0 : C.showEditOnDropdown) != null ? f : !0, I = P(ro), V = Te(() => I.permissionCheckWithRanges(
|
571
571
|
{
|
572
572
|
workbookTypes: [St],
|
573
573
|
rangeTypes: [Ct],
|
574
574
|
worksheetTypes: [It]
|
575
575
|
},
|
576
|
-
[{ startColumn: m, startRow:
|
577
|
-
|
578
|
-
|
579
|
-
), [I, m,
|
580
|
-
return /* @__PURE__ */
|
581
|
-
/* @__PURE__ */
|
582
|
-
/* @__PURE__ */
|
583
|
-
const
|
576
|
+
[{ startColumn: m, startRow: v, endColumn: m, endRow: v }],
|
577
|
+
_,
|
578
|
+
w
|
579
|
+
), [I, m, v, _, w]);
|
580
|
+
return /* @__PURE__ */ u.jsxs("div", { className: ve.dvListDropdown, style: s, children: [
|
581
|
+
/* @__PURE__ */ u.jsx("div", { className: ve.dvListDropdownTitle, children: i }),
|
582
|
+
/* @__PURE__ */ u.jsx("div", { className: ve.dvListDropdownList, children: /* @__PURE__ */ u.jsx(aa, { children: /* @__PURE__ */ u.jsx("div", { className: ve.dvListDropdownListContainer, children: S.map((g, y) => {
|
583
|
+
const L = t.indexOf(g.value) > -1, U = () => {
|
584
584
|
let E;
|
585
|
-
|
586
|
-
const
|
585
|
+
L ? E = new Set(t.filter((x) => x !== g.value)) : E = new Set(n ? [...t, g.value] : [g.value]);
|
586
|
+
const A = [];
|
587
587
|
a.forEach((x) => {
|
588
|
-
E.has(x.value) &&
|
589
|
-
}), o(
|
590
|
-
},
|
591
|
-
return /* @__PURE__ */
|
592
|
-
/* @__PURE__ */
|
593
|
-
/* @__PURE__ */
|
594
|
-
/* @__PURE__ */
|
595
|
-
/* @__PURE__ */
|
588
|
+
E.has(x.value) && A.push(x.value);
|
589
|
+
}), o(A);
|
590
|
+
}, T = g.label.toLocaleLowerCase().indexOf(d);
|
591
|
+
return /* @__PURE__ */ u.jsxs("div", { className: ve.dvListDropdownItemContainer, onClick: U, children: [
|
592
|
+
/* @__PURE__ */ u.jsx("div", { className: ve.dvListDropdownItem, style: { background: g.color || Le }, children: d && g.label.toLowerCase().includes(d) ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
593
|
+
/* @__PURE__ */ u.jsx("span", { children: g.label.substring(0, T) }),
|
594
|
+
/* @__PURE__ */ u.jsx("span", { style: { fontWeight: "bold" }, children: g.label.substring(T, T + d.length) }),
|
595
|
+
/* @__PURE__ */ u.jsx("span", { children: g.label.substring(T + d.length) })
|
596
596
|
] }) : g.label }),
|
597
|
-
/* @__PURE__ */
|
598
|
-
] },
|
599
|
-
}) }) },
|
600
|
-
|
601
|
-
/* @__PURE__ */
|
602
|
-
/* @__PURE__ */
|
597
|
+
/* @__PURE__ */ u.jsx("div", { className: ve.dvListDropdownSelectedIcon, children: L ? /* @__PURE__ */ u.jsx(_o, {}) : null })
|
598
|
+
] }, y);
|
599
|
+
}) }) }, l) }),
|
600
|
+
R && V ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
601
|
+
/* @__PURE__ */ u.jsx("div", { className: ve.dvListDropdownSplit }),
|
602
|
+
/* @__PURE__ */ u.jsx("div", { className: ve.dvListDropdownEdit, children: /* @__PURE__ */ u.jsx("a", { onClick: r, children: h.t("dataValidation.list.edit") }) })
|
603
603
|
] }) : null
|
604
604
|
] });
|
605
605
|
};
|
606
606
|
function Ti(e) {
|
607
|
-
var j,
|
608
|
-
const { location: t, hideFn: o } = e, { worksheet: n, row: a, col: i, unitId: r, subUnitId:
|
609
|
-
Ne(
|
610
|
-
const I = xa.useContext(),
|
607
|
+
var j, F, H, X;
|
608
|
+
const { location: t, hideFn: o } = e, { worksheet: n, row: a, col: i, unitId: r, subUnitId: s } = t, l = P(Et), [c, h] = W(""), p = P(Q), d = P(J), [v, m] = W(""), _ = P(io), w = P(ge), S = Te(() => l.ruleChange$.pipe(_n(16)), []), R = P(oe);
|
609
|
+
Ne(S);
|
610
|
+
const I = xa.useContext(), V = ((F = (j = I.current) == null ? void 0 : j.right) != null ? F : 0) - ((X = (H = I.current) == null ? void 0 : H.left) != null ? X : 0);
|
611
611
|
if (Ce(() => {
|
612
|
-
const k = p.onCommandExecuted((
|
612
|
+
const k = p.onCommandExecuted((z) => {
|
613
613
|
var q, ee;
|
614
|
-
if (
|
615
|
-
const te =
|
614
|
+
if (z.id === $a.id) {
|
615
|
+
const te = z.params, { unitId: re } = te, ae = w.getUnit(re, Y.UNIVER_DOC);
|
616
616
|
if (!ae)
|
617
617
|
return;
|
618
618
|
const se = Xo.transform.getPlainText((ee = (q = ae.getSnapshot().body) == null ? void 0 : q.dataStream) != null ? ee : "");
|
619
|
-
|
619
|
+
h(se);
|
620
620
|
}
|
621
621
|
});
|
622
622
|
return () => {
|
623
623
|
k.dispose();
|
624
624
|
};
|
625
|
-
}, [p,
|
626
|
-
return null;
|
627
|
-
const _ = w.getRuleByLocation(r, l, a, i);
|
628
|
-
if (!_)
|
625
|
+
}, [p, w]), !n)
|
629
626
|
return null;
|
630
|
-
const C =
|
627
|
+
const C = R.getRuleByLocation(r, s, a, i);
|
631
628
|
if (!C)
|
632
629
|
return null;
|
633
|
-
const
|
634
|
-
if (!
|
630
|
+
const f = R.getValidator(C.type);
|
631
|
+
if (!f)
|
632
|
+
return null;
|
633
|
+
const g = n.getCell(a, i), y = (C == null ? void 0 : C.renderMode) === de.CUSTOM || (C == null ? void 0 : C.renderMode) === void 0;
|
634
|
+
if (!g || !C || !f || f.id.indexOf(Z.LIST) !== 0)
|
635
635
|
return;
|
636
|
-
const
|
636
|
+
const L = C.type === Z.LIST_MULTIPLE, U = f.getListWithColor(C, r, s), T = v || fa(n.getCellRaw(a, i)), E = qn(T), A = () => {
|
637
637
|
p.executeCommand(Ue.id, {
|
638
|
-
ruleId:
|
638
|
+
ruleId: C.uid
|
639
639
|
}), o();
|
640
|
-
}, x =
|
640
|
+
}, x = U.map((k) => ({
|
641
641
|
label: k.label,
|
642
642
|
value: k.label,
|
643
|
-
color:
|
643
|
+
color: y || k.color ? k.color : "transparent"
|
644
644
|
}));
|
645
|
-
return /* @__PURE__ */
|
645
|
+
return /* @__PURE__ */ u.jsx(
|
646
646
|
Li,
|
647
647
|
{
|
648
|
-
style: { minWidth:
|
649
|
-
title:
|
648
|
+
style: { minWidth: V, maxWidth: Math.max(V, 200) },
|
649
|
+
title: L ? d.t("dataValidation.listMultiple.dropdown") : d.t("dataValidation.list.dropdown"),
|
650
650
|
value: E,
|
651
|
-
multiple:
|
651
|
+
multiple: L,
|
652
652
|
onChange: async (k) => {
|
653
|
-
const
|
653
|
+
const z = Jn(k), q = {
|
654
654
|
unitId: r,
|
655
|
-
subUnitId:
|
655
|
+
subUnitId: s,
|
656
656
|
range: {
|
657
657
|
startColumn: i,
|
658
658
|
endColumn: i,
|
@@ -660,18 +660,18 @@ function Ti(e) {
|
|
660
660
|
endRow: a
|
661
661
|
},
|
662
662
|
value: {
|
663
|
-
v:
|
663
|
+
v: z,
|
664
664
|
p: null,
|
665
665
|
f: null,
|
666
666
|
si: null
|
667
667
|
}
|
668
668
|
};
|
669
|
-
|
669
|
+
_.isVisible() && _.changeVisible({
|
670
670
|
visible: !1,
|
671
671
|
keycode: on.ESC,
|
672
672
|
eventType: Qt.Keyboard,
|
673
673
|
unitId: r
|
674
|
-
}), m(
|
674
|
+
}), m(z), L || o(), _.isVisible().visible && await p.executeCommand(ao.id, {
|
675
675
|
visible: !1,
|
676
676
|
eventType: Qt.Keyboard,
|
677
677
|
unitId: r,
|
@@ -679,7 +679,7 @@ function Ti(e) {
|
|
679
679
|
}), p.executeCommand(pn.id, q);
|
680
680
|
},
|
681
681
|
options: x,
|
682
|
-
onEdit:
|
682
|
+
onEdit: A,
|
683
683
|
filter: c,
|
684
684
|
location: t
|
685
685
|
}
|
@@ -691,36 +691,36 @@ const Ai = "univer-data-validation-options-button", xi = "univer-data-validation
|
|
691
691
|
};
|
692
692
|
function ji(e) {
|
693
693
|
var c;
|
694
|
-
const t =
|
695
|
-
return /* @__PURE__ */
|
696
|
-
/* @__PURE__ */
|
694
|
+
const t = P(J), o = P(bt), { value: n, onChange: a, extraComponent: i } = e, [r, s] = W(!1), l = i ? o.get(i) : null;
|
695
|
+
return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
696
|
+
/* @__PURE__ */ u.jsxs("div", { className: jt.dataValidationOptionsButton, onClick: () => s(!r), children: [
|
697
697
|
t.t("dataValidation.panel.options"),
|
698
|
-
r ? /* @__PURE__ */
|
698
|
+
r ? /* @__PURE__ */ u.jsx(wo, { className: jt.dataValidationOptionsButtonIcon }) : /* @__PURE__ */ u.jsx(Io, { className: jt.dataValidationOptionsButtonIcon })
|
699
699
|
] }),
|
700
|
-
r && /* @__PURE__ */
|
701
|
-
|
702
|
-
/* @__PURE__ */
|
700
|
+
r && /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
701
|
+
l ? /* @__PURE__ */ u.jsx(l, { value: n, onChange: a }) : null,
|
702
|
+
/* @__PURE__ */ u.jsx(
|
703
703
|
G,
|
704
704
|
{
|
705
705
|
label: t.t("dataValidation.panel.invalid"),
|
706
|
-
children: /* @__PURE__ */
|
706
|
+
children: /* @__PURE__ */ u.jsxs(
|
707
707
|
un,
|
708
708
|
{
|
709
709
|
value: `${(c = n.errorStyle) != null ? c : ot.WARNING}`,
|
710
|
-
onChange: (
|
710
|
+
onChange: (h) => a({ ...n, errorStyle: +h }),
|
711
711
|
children: [
|
712
|
-
/* @__PURE__ */
|
713
|
-
/* @__PURE__ */
|
712
|
+
/* @__PURE__ */ u.jsx(Ae, { value: `${ot.WARNING}`, children: t.t("dataValidation.panel.showWarning") }),
|
713
|
+
/* @__PURE__ */ u.jsx(Ae, { value: `${ot.STOP}`, children: t.t("dataValidation.panel.rejectInput") })
|
714
714
|
]
|
715
715
|
}
|
716
716
|
)
|
717
717
|
}
|
718
718
|
),
|
719
|
-
/* @__PURE__ */
|
719
|
+
/* @__PURE__ */ u.jsx(
|
720
720
|
G,
|
721
721
|
{
|
722
722
|
label: t.t("dataValidation.panel.messageInfo"),
|
723
|
-
children: /* @__PURE__ */
|
723
|
+
children: /* @__PURE__ */ u.jsx(
|
724
724
|
Mt,
|
725
725
|
{
|
726
726
|
checked: n.showErrorMessage,
|
@@ -733,7 +733,7 @@ function ji(e) {
|
|
733
733
|
)
|
734
734
|
}
|
735
735
|
),
|
736
|
-
n.showErrorMessage ? /* @__PURE__ */
|
736
|
+
n.showErrorMessage ? /* @__PURE__ */ u.jsx(G, { children: /* @__PURE__ */ u.jsx(xe, { value: n.error, onChange: (h) => a({ ...n, error: h }) }) }) : null
|
737
737
|
] })
|
738
738
|
] });
|
739
739
|
}
|
@@ -751,27 +751,27 @@ const Fi = "univer-data-validation-detail", Ni = "univer-data-validation-detail-
|
|
751
751
|
);
|
752
752
|
function ki(e, t, o) {
|
753
753
|
var n, a, i, r;
|
754
|
-
return t ? ((a = (n = e.getUnit(t)) == null ? void 0 : n.getSheetBySheetName(o)) == null ? void 0 : a.getSheetId()) || "" : ((r = (i = e.getCurrentUnitForType(
|
754
|
+
return t ? ((a = (n = e.getUnit(t)) == null ? void 0 : n.getSheetBySheetName(o)) == null ? void 0 : a.getSheetId()) || "" : ((r = (i = e.getCurrentUnitForType(Y.UNIVER_SHEET)) == null ? void 0 : i.getSheetBySheetName(o)) == null ? void 0 : r.getSheetId()) || "";
|
755
755
|
}
|
756
756
|
function Wi() {
|
757
757
|
var se;
|
758
|
-
const [e, t] =
|
758
|
+
const [e, t] = W(0), o = P(me), n = Ne(o.activeRule$, o.activeRule), { unitId: a, subUnitId: i, rule: r } = n || {}, s = r.uid, l = P(ye), c = P(ge), h = P(bt), p = P(Q), d = P(Et), v = P(J), [m, _] = W(r), w = l.getValidatorItem(m.type), [S, R] = W(!1), I = l.getValidatorsByScope(Ua.SHEET), [V, C] = W(() => m.ranges.map((O) => ({ unitId: "", sheetId: "", range: O }))), f = Te(() => $i(p), [p]), [g, y] = W(!1), L = We({}), [U, T] = W(!1), E = P(zn);
|
759
759
|
if (Ce(() => () => {
|
760
|
-
const
|
761
|
-
|
760
|
+
const O = E.getCurrentLastSelection();
|
761
|
+
O && E.setSelections([O]);
|
762
762
|
}, [E]), Ce(() => {
|
763
|
-
p.onCommandExecuted((
|
764
|
-
(
|
765
|
-
const D = d.getRuleById(a, i,
|
766
|
-
t((
|
763
|
+
p.onCommandExecuted((O) => {
|
764
|
+
(O.id === zo.id || O.id === Ko.id) && setTimeout(() => {
|
765
|
+
const D = d.getRuleById(a, i, s);
|
766
|
+
t((N) => N + 1), D && (_(D), C(D.ranges.map((N) => ({ unitId: "", sheetId: "", range: N }))));
|
767
767
|
}, 20);
|
768
768
|
});
|
769
|
-
}, [p, d,
|
769
|
+
}, [p, d, s, i, a]), !w)
|
770
770
|
return null;
|
771
|
-
const
|
772
|
-
!m.ranges.length || g || (
|
773
|
-
},
|
774
|
-
const D =
|
771
|
+
const A = w.operators, x = w.operatorNames, j = m.operator ? Ba.includes(m.operator) : !1, F = () => {
|
772
|
+
!m.ranges.length || g || (w.validatorFormula(m, a, i).success ? o.setActiveRule(null) : R(!0));
|
773
|
+
}, H = uo((O) => {
|
774
|
+
const D = O.split(",").map(Ha).map(($) => {
|
775
775
|
const _e = $.sheetName;
|
776
776
|
if (_e) {
|
777
777
|
const Uo = ki(c, $.unitId, _e);
|
@@ -782,141 +782,141 @@ function Wi() {
|
|
782
782
|
sheetId: ""
|
783
783
|
};
|
784
784
|
});
|
785
|
-
if (Go(D,
|
785
|
+
if (Go(D, V))
|
786
786
|
return;
|
787
|
-
|
788
|
-
const
|
789
|
-
if (
|
787
|
+
C(D);
|
788
|
+
const N = D.filter(($) => (!$.unitId || $.unitId === a) && (!$.sheetId || $.sheetId === i)).map(($) => $.range);
|
789
|
+
if (_({
|
790
790
|
...m,
|
791
|
-
ranges:
|
792
|
-
}),
|
791
|
+
ranges: N
|
792
|
+
}), N.length === 0)
|
793
793
|
return;
|
794
794
|
const B = {
|
795
795
|
unitId: a,
|
796
796
|
subUnitId: i,
|
797
|
-
ruleId:
|
798
|
-
ranges:
|
797
|
+
ruleId: s,
|
798
|
+
ranges: N
|
799
799
|
};
|
800
|
-
|
801
|
-
}),
|
802
|
-
if (Vn(
|
800
|
+
f(Qn.id, B);
|
801
|
+
}), X = (O) => {
|
802
|
+
if (Vn(O, Ln(m)))
|
803
803
|
return;
|
804
|
-
|
804
|
+
_({
|
805
805
|
...m,
|
806
|
-
...
|
806
|
+
...O
|
807
807
|
});
|
808
808
|
const D = {
|
809
809
|
unitId: a,
|
810
810
|
subUnitId: i,
|
811
|
-
ruleId:
|
812
|
-
setting:
|
811
|
+
ruleId: s,
|
812
|
+
setting: O
|
813
813
|
};
|
814
|
-
|
814
|
+
f(
|
815
815
|
Mn.id,
|
816
816
|
D,
|
817
817
|
void 0
|
818
818
|
);
|
819
819
|
}, k = async () => {
|
820
820
|
await p.executeCommand(eo.id, {
|
821
|
-
ruleId:
|
821
|
+
ruleId: s,
|
822
822
|
unitId: a,
|
823
823
|
subUnitId: i
|
824
824
|
}), o.setActiveRule(null);
|
825
|
-
},
|
825
|
+
}, z = {
|
826
826
|
type: m.type,
|
827
827
|
operator: m.operator,
|
828
828
|
formula1: m.formula1,
|
829
829
|
formula2: m.formula2,
|
830
830
|
allowBlank: m.allowBlank
|
831
|
-
}, q = (
|
832
|
-
const D =
|
831
|
+
}, q = (O) => {
|
832
|
+
const D = l.getValidatorItem(O);
|
833
833
|
if (!D)
|
834
834
|
return;
|
835
|
-
const
|
835
|
+
const N = D.operators, B = d.getRuleById(a, i, s), $ = O === (B == null ? void 0 : B.type) || O.includes("list") && (B != null && B.type.includes("list")) ? {
|
836
836
|
...B,
|
837
|
-
type:
|
837
|
+
type: O
|
838
838
|
} : {
|
839
839
|
...m,
|
840
|
-
type:
|
841
|
-
operator:
|
840
|
+
type: O,
|
841
|
+
operator: N[0],
|
842
842
|
formula1: void 0,
|
843
843
|
formula2: void 0
|
844
844
|
};
|
845
|
-
|
845
|
+
_($), p.executeCommand(Mn.id, {
|
846
846
|
unitId: a,
|
847
847
|
subUnitId: i,
|
848
848
|
ruleId: m.uid,
|
849
849
|
setting: Ln($)
|
850
850
|
});
|
851
|
-
}, ee =
|
852
|
-
Vn(
|
851
|
+
}, ee = h.get(w.formulaInput), te = Te(() => V.map((O) => po(O.range)).join(","), []), re = Pn(m), ae = (O) => {
|
852
|
+
Vn(O, Pn(m)) || (_({
|
853
853
|
...m,
|
854
|
-
...
|
855
|
-
}),
|
854
|
+
...O
|
855
|
+
}), f(
|
856
856
|
ga.id,
|
857
857
|
{
|
858
858
|
unitId: a,
|
859
859
|
subUnitId: i,
|
860
|
-
ruleId:
|
861
|
-
options:
|
860
|
+
ruleId: s,
|
861
|
+
options: O
|
862
862
|
}
|
863
863
|
));
|
864
864
|
};
|
865
|
-
return fn((
|
866
|
-
var
|
867
|
-
const D = (
|
868
|
-
D && D(
|
869
|
-
}), /* @__PURE__ */
|
870
|
-
/* @__PURE__ */
|
865
|
+
return fn((O) => {
|
866
|
+
var N;
|
867
|
+
const D = (N = L.current) == null ? void 0 : N.handleOutClick;
|
868
|
+
D && D(O, () => T(!1));
|
869
|
+
}), /* @__PURE__ */ u.jsxs("div", { className: Be.dataValidationDetail, children: [
|
870
|
+
/* @__PURE__ */ u.jsx(
|
871
871
|
G,
|
872
872
|
{
|
873
|
-
label:
|
874
|
-
error: !m.ranges.length || g ?
|
875
|
-
children: /* @__PURE__ */
|
873
|
+
label: v.t("dataValidation.panel.range"),
|
874
|
+
error: !m.ranges.length || g ? v.t("dataValidation.panel.rangeError") : "",
|
875
|
+
children: /* @__PURE__ */ u.jsx(
|
876
876
|
Ya,
|
877
877
|
{
|
878
878
|
unitId: a,
|
879
879
|
subUnitId: i,
|
880
880
|
initValue: te,
|
881
|
-
onChange:
|
882
|
-
onFocus: () =>
|
883
|
-
isFocus:
|
884
|
-
actions:
|
885
|
-
onVerify: (
|
881
|
+
onChange: H,
|
882
|
+
onFocus: () => T(!0),
|
883
|
+
isFocus: U,
|
884
|
+
actions: L.current,
|
885
|
+
onVerify: (O) => y(!O)
|
886
886
|
}
|
887
887
|
)
|
888
888
|
}
|
889
889
|
),
|
890
|
-
/* @__PURE__ */
|
890
|
+
/* @__PURE__ */ u.jsx(G, { label: v.t("dataValidation.panel.type"), children: /* @__PURE__ */ u.jsx(
|
891
891
|
Jt,
|
892
892
|
{
|
893
|
-
options: I == null ? void 0 : I.map((
|
894
|
-
label:
|
895
|
-
value:
|
893
|
+
options: I == null ? void 0 : I.map((O) => ({
|
894
|
+
label: v.t(O.title),
|
895
|
+
value: O.id
|
896
896
|
})),
|
897
897
|
value: m.type,
|
898
898
|
onChange: q,
|
899
899
|
className: Be.dataValidationDetailFormItem
|
900
900
|
}
|
901
901
|
) }),
|
902
|
-
|
902
|
+
A != null && A.length ? /* @__PURE__ */ u.jsx(G, { label: v.t("dataValidation.panel.operator"), children: /* @__PURE__ */ u.jsx(
|
903
903
|
Jt,
|
904
904
|
{
|
905
|
-
options:
|
906
|
-
value: `${
|
905
|
+
options: A.map((O, D) => ({
|
906
|
+
value: `${O}`,
|
907
907
|
label: x[D]
|
908
908
|
})),
|
909
909
|
value: `${m.operator}`,
|
910
|
-
onChange: (
|
911
|
-
|
912
|
-
...
|
913
|
-
operator:
|
910
|
+
onChange: (O) => {
|
911
|
+
X({
|
912
|
+
...z,
|
913
|
+
operator: O
|
914
914
|
});
|
915
915
|
},
|
916
916
|
className: Be.dataValidationDetailFormItem
|
917
917
|
}
|
918
918
|
) }) : null,
|
919
|
-
ee ? /* @__PURE__ */
|
919
|
+
ee ? /* @__PURE__ */ u.jsx(
|
920
920
|
ee,
|
921
921
|
{
|
922
922
|
isTwoFormula: j,
|
@@ -924,38 +924,38 @@ function Wi() {
|
|
924
924
|
formula1: m.formula1,
|
925
925
|
formula2: m.formula2
|
926
926
|
},
|
927
|
-
onChange: (
|
928
|
-
|
929
|
-
...
|
930
|
-
...
|
927
|
+
onChange: (O) => {
|
928
|
+
X({
|
929
|
+
...z,
|
930
|
+
...O
|
931
931
|
});
|
932
932
|
},
|
933
|
-
showError:
|
934
|
-
validResult:
|
933
|
+
showError: S,
|
934
|
+
validResult: w.validatorFormula(m, a, i),
|
935
935
|
unitId: a,
|
936
936
|
subUnitId: i,
|
937
|
-
ruleId:
|
937
|
+
ruleId: s
|
938
938
|
},
|
939
939
|
e + m.type
|
940
940
|
) : null,
|
941
|
-
/* @__PURE__ */
|
941
|
+
/* @__PURE__ */ u.jsx(G, { children: /* @__PURE__ */ u.jsx(
|
942
942
|
Mt,
|
943
943
|
{
|
944
944
|
checked: (se = m.allowBlank) != null ? se : !0,
|
945
945
|
onChange: () => {
|
946
|
-
var
|
947
|
-
return
|
948
|
-
...
|
949
|
-
allowBlank: !((
|
946
|
+
var O;
|
947
|
+
return X({
|
948
|
+
...z,
|
949
|
+
allowBlank: !((O = m.allowBlank) == null || O)
|
950
950
|
});
|
951
951
|
},
|
952
|
-
children:
|
952
|
+
children: v.t("dataValidation.panel.allowBlank")
|
953
953
|
}
|
954
954
|
) }),
|
955
|
-
/* @__PURE__ */
|
956
|
-
/* @__PURE__ */
|
957
|
-
/* @__PURE__ */
|
958
|
-
/* @__PURE__ */
|
955
|
+
/* @__PURE__ */ u.jsx(ji, { value: re, onChange: ae, extraComponent: w.optionsInput }),
|
956
|
+
/* @__PURE__ */ u.jsxs("div", { className: Be.dataValidationDetailButtons, children: [
|
957
|
+
/* @__PURE__ */ u.jsx(je, { className: Be.dataValidationDetailButton, onClick: k, children: v.t("dataValidation.panel.removeRule") }),
|
958
|
+
/* @__PURE__ */ u.jsx(je, { className: Be.dataValidationDetailButton, type: "primary", onClick: F, children: v.t("dataValidation.panel.done") })
|
959
959
|
] })
|
960
960
|
] });
|
961
961
|
}
|
@@ -965,8 +965,8 @@ const Hi = "univer-data-validation-item-container", Yi = "univer-data-validation
|
|
965
965
|
dataValidationItemContent: Xi,
|
966
966
|
dataValidationItemIcon: zi
|
967
967
|
}, Ki = (e) => {
|
968
|
-
const { rule: t, onClick: o, unitId: n, subUnitId: a, disable: i } = e, r =
|
969
|
-
|
968
|
+
const { rule: t, onClick: o, unitId: n, subUnitId: a, disable: i } = e, r = P(ye), s = P(Q), l = P(Va), c = r.getValidatorItem(t.type), h = We(), [p, d] = W(!1), v = (m) => {
|
969
|
+
s.executeCommand(eo.id, {
|
970
970
|
ruleId: t.uid,
|
971
971
|
unitId: n,
|
972
972
|
subUnitId: a
|
@@ -974,16 +974,16 @@ const Hi = "univer-data-validation-item-container", Yi = "univer-data-validation
|
|
974
974
|
};
|
975
975
|
return Ce(() => () => {
|
976
976
|
var m;
|
977
|
-
|
978
|
-
|
977
|
+
h.current && ((m = h.current) == null || m.forEach((_) => {
|
978
|
+
_ && l.removeShape(_);
|
979
979
|
}));
|
980
|
-
}, [
|
980
|
+
}, [l]), /* @__PURE__ */ u.jsxs(
|
981
981
|
"div",
|
982
982
|
{
|
983
983
|
className: lt.dataValidationItemContainer,
|
984
984
|
onClick: o,
|
985
985
|
onMouseEnter: () => {
|
986
|
-
i || (d(!0),
|
986
|
+
i || (d(!0), h.current = t.ranges.map((m) => l.addShape({
|
987
987
|
range: m,
|
988
988
|
style: {
|
989
989
|
// hasAutoFill: false,
|
@@ -997,14 +997,14 @@ const Hi = "univer-data-validation-item-container", Yi = "univer-data-validation
|
|
997
997
|
},
|
998
998
|
onMouseLeave: () => {
|
999
999
|
var m;
|
1000
|
-
d(!1), (m =
|
1001
|
-
|
1002
|
-
}),
|
1000
|
+
d(!1), (m = h.current) == null || m.forEach((_) => {
|
1001
|
+
_ && l.removeShape(_);
|
1002
|
+
}), h.current = void 0;
|
1003
1003
|
},
|
1004
1004
|
children: [
|
1005
|
-
/* @__PURE__ */
|
1006
|
-
/* @__PURE__ */
|
1007
|
-
p ? /* @__PURE__ */
|
1005
|
+
/* @__PURE__ */ u.jsx("div", { className: lt.dataValidationItemTitle, children: c == null ? void 0 : c.generateRuleName(t) }),
|
1006
|
+
/* @__PURE__ */ u.jsx("div", { className: lt.dataValidationItemContent, children: t.ranges.map((m) => po(m)).join(",") }),
|
1007
|
+
p ? /* @__PURE__ */ u.jsx("div", { className: lt.dataValidationItemIcon, onClick: v, children: /* @__PURE__ */ u.jsx(Sn, {}) }) : null
|
1008
1008
|
]
|
1009
1009
|
}
|
1010
1010
|
);
|
@@ -1014,85 +1014,85 @@ const Hi = "univer-data-validation-item-container", Yi = "univer-data-validation
|
|
1014
1014
|
dataValidationListButton: qi
|
1015
1015
|
};
|
1016
1016
|
function Ji() {
|
1017
|
-
const e =
|
1018
|
-
() => e.getCurrentTypeOfUnit$(
|
1017
|
+
const e = P(ge), t = Ne(
|
1018
|
+
() => e.getCurrentTypeOfUnit$(Y.UNIVER_SHEET),
|
1019
1019
|
void 0,
|
1020
1020
|
void 0,
|
1021
1021
|
[]
|
1022
1022
|
);
|
1023
|
-
return t ? /* @__PURE__ */
|
1023
|
+
return t ? /* @__PURE__ */ u.jsx(Qi, { workbook: t }) : null;
|
1024
1024
|
}
|
1025
1025
|
function Qi(e) {
|
1026
|
-
const t =
|
1026
|
+
const t = P(oe), o = P(ge), n = P(Q), a = P(Fe), i = P(me), r = P(J), [s, l] = W([]), { workbook: c } = e, h = Ne(c.activeSheet$, void 0, !0), p = c.getUnitId(), d = h == null ? void 0 : h.getSheetId();
|
1027
1027
|
Ce(() => {
|
1028
|
-
|
1029
|
-
const
|
1030
|
-
I.unitId === p && I.subUnitId === d &&
|
1028
|
+
l(t.getRules(p, d));
|
1029
|
+
const R = t.ruleChange$.subscribe((I) => {
|
1030
|
+
I.unitId === p && I.subUnitId === d && l(t.getRules(p, d));
|
1031
1031
|
});
|
1032
1032
|
return () => {
|
1033
|
-
|
1033
|
+
R.unsubscribe();
|
1034
1034
|
};
|
1035
1035
|
}, [p, d, t]);
|
1036
|
-
const
|
1037
|
-
const
|
1036
|
+
const v = async () => {
|
1037
|
+
const R = to(a), I = {
|
1038
1038
|
unitId: p,
|
1039
1039
|
subUnitId: d,
|
1040
|
-
rule:
|
1040
|
+
rule: R
|
1041
1041
|
};
|
1042
1042
|
await n.executeCommand(mn.id, I), i.setActiveRule({
|
1043
1043
|
unitId: p,
|
1044
1044
|
subUnitId: d,
|
1045
|
-
rule:
|
1045
|
+
rule: R
|
1046
1046
|
});
|
1047
1047
|
}, m = () => {
|
1048
1048
|
n.executeCommand(va.id, {
|
1049
1049
|
unitId: p,
|
1050
1050
|
subUnitId: d
|
1051
1051
|
});
|
1052
|
-
},
|
1053
|
-
const I = o.getCurrentUnitForType(
|
1054
|
-
return
|
1055
|
-
})(
|
1056
|
-
return /* @__PURE__ */
|
1057
|
-
|
1052
|
+
}, w = ((R) => {
|
1053
|
+
const I = o.getCurrentUnitForType(Y.UNIVER_SHEET), V = I.getActiveSheet(), C = I.getUnitId(), f = V.getSheetId();
|
1054
|
+
return R.map((y) => ma(a, C, f, y.ranges) ? { ...y } : { ...y, disable: !0 });
|
1055
|
+
})(s), S = w == null ? void 0 : w.some((R) => R.disable);
|
1056
|
+
return /* @__PURE__ */ u.jsxs("div", { className: dt.dataValidationList, children: [
|
1057
|
+
w == null ? void 0 : w.map((R) => {
|
1058
1058
|
var I;
|
1059
|
-
return /* @__PURE__ */
|
1059
|
+
return /* @__PURE__ */ u.jsx(
|
1060
1060
|
Ki,
|
1061
1061
|
{
|
1062
1062
|
unitId: p,
|
1063
1063
|
subUnitId: d,
|
1064
1064
|
onClick: () => {
|
1065
|
-
|
1065
|
+
R.disable || i.setActiveRule({
|
1066
1066
|
unitId: p,
|
1067
1067
|
subUnitId: d,
|
1068
|
-
rule:
|
1068
|
+
rule: R
|
1069
1069
|
});
|
1070
1070
|
},
|
1071
|
-
rule:
|
1072
|
-
disable: (I =
|
1071
|
+
rule: R,
|
1072
|
+
disable: (I = R.disable) != null ? I : !1
|
1073
1073
|
},
|
1074
|
-
|
1074
|
+
R.uid
|
1075
1075
|
);
|
1076
1076
|
}),
|
1077
|
-
/* @__PURE__ */
|
1078
|
-
|
1079
|
-
/* @__PURE__ */
|
1077
|
+
/* @__PURE__ */ u.jsxs("div", { className: dt.dataValidationListButtons, children: [
|
1078
|
+
s.length && !S ? /* @__PURE__ */ u.jsx(je, { className: dt.dataValidationListButton, onClick: m, children: r.t("dataValidation.panel.removeAll") }) : null,
|
1079
|
+
/* @__PURE__ */ u.jsx(je, { className: dt.dataValidationListButton, type: "primary", onClick: v, children: r.t("dataValidation.panel.add") })
|
1080
1080
|
] })
|
1081
1081
|
] });
|
1082
1082
|
}
|
1083
1083
|
const er = () => {
|
1084
|
-
const e =
|
1085
|
-
return t ? /* @__PURE__ */
|
1084
|
+
const e = P(me), t = Ne(e.activeRule$, e.activeRule);
|
1085
|
+
return t ? /* @__PURE__ */ u.jsx(Wi, {}, t.rule.uid) : /* @__PURE__ */ u.jsx(Ji, {});
|
1086
1086
|
}, Rn = "data-validation.list.dropdown", bo = "data-validation.date.dropdown", Lt = {
|
1087
1087
|
type: qe.COMMAND,
|
1088
1088
|
id: "data-validation.command.addRuleAndOpen",
|
1089
1089
|
handler(e) {
|
1090
1090
|
const t = e.get(ge), o = Kn(t);
|
1091
1091
|
if (!o) return !1;
|
1092
|
-
const { workbook: n, worksheet: a } = o, i = to(e), r = e.get(Q),
|
1092
|
+
const { workbook: n, worksheet: a } = o, i = to(e), r = e.get(Q), s = n.getUnitId(), l = a.getSheetId(), c = {
|
1093
1093
|
rule: i,
|
1094
|
-
unitId:
|
1095
|
-
subUnitId:
|
1094
|
+
unitId: s,
|
1095
|
+
subUnitId: l
|
1096
1096
|
};
|
1097
1097
|
return r.syncExecuteCommand(mn.id, c) ? (r.syncExecuteCommand(Ue.id, {
|
1098
1098
|
ruleId: i.uid,
|
@@ -1117,20 +1117,20 @@ let rt = class extends De {
|
|
1117
1117
|
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(_n(100)).subscribe((e) => {
|
1118
1118
|
var t;
|
1119
1119
|
if (e) {
|
1120
|
-
if (!this._univerInstanceService.getCurrentUnitForType(
|
1120
|
+
if (!this._univerInstanceService.getCurrentUnitForType(Y.UNIVER_SHEET).getActiveSheet()) return;
|
1121
1121
|
const a = this._dataValidationModel.getRuleByLocation(e.location.unitId, e.location.subUnitId, e.location.row, e.location.col);
|
1122
1122
|
if (!a) return;
|
1123
1123
|
if (this._dataValidationModel.validator(a, e.location) === at.INVALID) {
|
1124
|
-
const r = this._cellAlertManagerService.currentAlert.get(ct),
|
1125
|
-
if (
|
1124
|
+
const r = this._cellAlertManagerService.currentAlert.get(ct), s = (t = r == null ? void 0 : r.alert) == null ? void 0 : t.location;
|
1125
|
+
if (s && s.row === e.location.row && s.col === e.location.col && s.subUnitId === e.location.subUnitId && s.unitId === e.location.unitId)
|
1126
1126
|
return;
|
1127
|
-
const
|
1128
|
-
if (!
|
1127
|
+
const l = this._dataValidationModel.getValidator(a.type);
|
1128
|
+
if (!l)
|
1129
1129
|
return;
|
1130
1130
|
this._cellAlertManagerService.showAlert({
|
1131
1131
|
type: ba.ERROR,
|
1132
1132
|
title: this._localeService.t("dataValidation.error.title"),
|
1133
|
-
message:
|
1133
|
+
message: l == null ? void 0 : l.getRuleFinalError(a, e.location),
|
1134
1134
|
location: e.location,
|
1135
1135
|
width: 200,
|
1136
1136
|
height: 74,
|
@@ -1163,78 +1163,73 @@ var ar = Object.defineProperty, ir = Object.getOwnPropertyDescriptor, rr = (e, t
|
|
1163
1163
|
}, Ft = (e, t) => (o, n) => t(o, n, e);
|
1164
1164
|
let Xe = class extends De {
|
1165
1165
|
constructor(e, t, o) {
|
1166
|
-
super(), this._autoFillService = e, this.
|
1166
|
+
super(), this._autoFillService = e, this._sheetDataValidationModel = t, this._injector = o, this._initAutoFill();
|
1167
1167
|
}
|
1168
1168
|
// eslint-disable-next-line max-lines-per-function
|
1169
1169
|
_initAutoFill() {
|
1170
|
-
const e = () => ({ redos: [], undos: [] }), t = (
|
1171
|
-
const { source:
|
1172
|
-
row:
|
1173
|
-
col:
|
1174
|
-
},
|
1175
|
-
|
1176
|
-
const
|
1177
|
-
startRow:
|
1178
|
-
startColumn:
|
1179
|
-
endColumn:
|
1180
|
-
endRow:
|
1181
|
-
},
|
1182
|
-
startRow:
|
1183
|
-
startColumn:
|
1184
|
-
endColumn:
|
1185
|
-
endRow:
|
1170
|
+
const e = () => ({ redos: [], undos: [] }), t = (n, a) => {
|
1171
|
+
const { source: i, target: r, unitId: s, subUnitId: l } = n, c = this._sheetDataValidationModel.getRuleObjectMatrix(s, l).clone(), h = nn([i, r]), [p, d] = h.ranges, { mapFunc: v } = h, m = {
|
1172
|
+
row: p.startRow,
|
1173
|
+
col: p.startColumn
|
1174
|
+
}, _ = Oa(p, d), w = new vt(), S = /* @__PURE__ */ new Set();
|
1175
|
+
_.forEach((f) => {
|
1176
|
+
const g = f.repeatStartCell, y = f.relativeRange, L = {
|
1177
|
+
startRow: m.row,
|
1178
|
+
startColumn: m.col,
|
1179
|
+
endColumn: m.col,
|
1180
|
+
endRow: m.row
|
1181
|
+
}, U = {
|
1182
|
+
startRow: g.row,
|
1183
|
+
startColumn: g.col,
|
1184
|
+
endColumn: g.col,
|
1185
|
+
endRow: g.row
|
1186
1186
|
};
|
1187
|
-
qo.foreach(
|
1188
|
-
const
|
1187
|
+
qo.foreach(y, (T, E) => {
|
1188
|
+
const A = _t.getPositionRange(
|
1189
1189
|
{
|
1190
|
-
startRow:
|
1191
|
-
startColumn:
|
1192
|
-
endColumn:
|
1193
|
-
endRow:
|
1190
|
+
startRow: T,
|
1191
|
+
startColumn: E,
|
1192
|
+
endColumn: E,
|
1193
|
+
endRow: T
|
1194
1194
|
},
|
1195
|
-
|
1196
|
-
), { row:
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
), { row: k, col: X } = m(Y.startRow, Y.startColumn);
|
1207
|
-
v.setValue(k, X, W), w.add(W);
|
1208
|
-
}
|
1195
|
+
L
|
1196
|
+
), { row: x, col: j } = v(A.startRow, A.startColumn), F = this._sheetDataValidationModel.getRuleIdByLocation(s, l, x, j) || "", H = _t.getPositionRange(
|
1197
|
+
{
|
1198
|
+
startRow: T,
|
1199
|
+
startColumn: E,
|
1200
|
+
endColumn: E,
|
1201
|
+
endRow: T
|
1202
|
+
},
|
1203
|
+
U
|
1204
|
+
), { row: X, col: k } = v(H.startRow, H.startColumn);
|
1205
|
+
w.setValue(X, k, F), S.add(F);
|
1209
1206
|
});
|
1210
1207
|
});
|
1211
|
-
const
|
1212
|
-
|
1213
|
-
const
|
1208
|
+
const R = Array.from(S).map((f) => ({ id: f, ranges: Zt(w, (g) => g === f) }));
|
1209
|
+
c.addRangeRules(R);
|
1210
|
+
const I = c.diff(this._sheetDataValidationModel.getRules(s, l)), { redoMutations: V, undoMutations: C } = tn(s, l, I, this._injector, "patched", a === et.ONLY_FORMAT);
|
1214
1211
|
return {
|
1215
1212
|
undos: C,
|
1216
|
-
redos:
|
1213
|
+
redos: V
|
1217
1214
|
};
|
1218
|
-
}, o =
|
1219
|
-
Z.CHECKBOX
|
1220
|
-
], n = {
|
1215
|
+
}, o = {
|
1221
1216
|
id: no,
|
1222
|
-
onBeforeFillData: (
|
1223
|
-
const { source:
|
1224
|
-
for (const s of
|
1225
|
-
for (const
|
1226
|
-
const
|
1227
|
-
if (
|
1217
|
+
onBeforeFillData: (n) => {
|
1218
|
+
const { source: a, unitId: i, subUnitId: r } = n;
|
1219
|
+
for (const s of a.rows)
|
1220
|
+
for (const l of a.cols) {
|
1221
|
+
const c = this._sheetDataValidationModel.getRuleByLocation(i, r, s, l);
|
1222
|
+
if (c && c.type === Z.CHECKBOX) {
|
1228
1223
|
this._autoFillService.setDisableApplyType(et.SERIES, !0);
|
1229
1224
|
return;
|
1230
1225
|
}
|
1231
1226
|
}
|
1232
1227
|
},
|
1233
|
-
onFillData: (a, i
|
1228
|
+
onFillData: (n, a, i) => i === et.COPY || i === et.ONLY_FORMAT || i === et.SERIES ? t(n, i) : e(),
|
1234
1229
|
onAfterFillData: () => {
|
1235
1230
|
}
|
1236
1231
|
};
|
1237
|
-
this.disposeWithMe(this._autoFillService.addHook(
|
1232
|
+
this.disposeWithMe(this._autoFillService.addHook(o));
|
1238
1233
|
}
|
1239
1234
|
};
|
1240
1235
|
Xe = rr([
|
@@ -1258,8 +1253,8 @@ let ze = class extends De {
|
|
1258
1253
|
id: no,
|
1259
1254
|
onBeforeCopy: (t, o, n) => this._collect(t, o, n),
|
1260
1255
|
onPasteCells: (t, o, n, a) => {
|
1261
|
-
const { copyType: i = En.COPY, pasteType: r } = a, { range:
|
1262
|
-
return this._generateMutations(
|
1256
|
+
const { copyType: i = En.COPY, pasteType: r } = a, { range: s } = t || {}, { range: l, unitId: c, subUnitId: h } = o;
|
1257
|
+
return this._generateMutations(l, { copyType: i, pasteType: r, copyRange: s, unitId: c, subUnitId: h });
|
1263
1258
|
}
|
1264
1259
|
});
|
1265
1260
|
}
|
@@ -1270,13 +1265,13 @@ let ze = class extends De {
|
|
1270
1265
|
subUnitId: o,
|
1271
1266
|
matrix: a
|
1272
1267
|
};
|
1273
|
-
const i = this._injector.invoke((
|
1268
|
+
const i = this._injector.invoke((l) => Pa(n, l, t, o));
|
1274
1269
|
if (!i)
|
1275
1270
|
return;
|
1276
|
-
const { rows: r, cols:
|
1277
|
-
r.forEach((
|
1278
|
-
|
1279
|
-
const d = this._sheetDataValidationModel.getRuleIdByLocation(t, o,
|
1271
|
+
const { rows: r, cols: s } = i;
|
1272
|
+
r.forEach((l, c) => {
|
1273
|
+
s.forEach((h, p) => {
|
1274
|
+
const d = this._sheetDataValidationModel.getRuleIdByLocation(t, o, l, h);
|
1280
1275
|
a.setValue(c, p, d != null ? d : "");
|
1281
1276
|
});
|
1282
1277
|
});
|
@@ -1300,27 +1295,27 @@ let ze = class extends De {
|
|
1300
1295
|
return { redos: [], undos: [] };
|
1301
1296
|
const { unitId: n, subUnitId: a } = this._copyInfo;
|
1302
1297
|
if (o.unitId !== n || a !== o.subUnitId) {
|
1303
|
-
const i = this._sheetDataValidationModel.getRuleObjectMatrix(o.unitId, o.subUnitId).clone(), r = new vt(),
|
1304
|
-
p.forEach(({ startRange:
|
1305
|
-
var
|
1306
|
-
(
|
1307
|
-
const
|
1298
|
+
const i = this._sheetDataValidationModel.getRuleObjectMatrix(o.unitId, o.subUnitId).clone(), r = new vt(), s = /* @__PURE__ */ new Set(), { ranges: [l, c], mapFunc: h } = nn([o.copyRange, t]), p = On(l, c, !0), d = /* @__PURE__ */ new Map();
|
1299
|
+
p.forEach(({ startRange: w }) => {
|
1300
|
+
var S;
|
1301
|
+
(S = this._copyInfo) == null || S.matrix.forValue((R, I, V) => {
|
1302
|
+
const C = _t.getPositionRange(
|
1308
1303
|
{
|
1309
|
-
startRow:
|
1310
|
-
endRow:
|
1304
|
+
startRow: R,
|
1305
|
+
endRow: R,
|
1311
1306
|
startColumn: I,
|
1312
1307
|
endColumn: I
|
1313
1308
|
},
|
1314
|
-
|
1315
|
-
),
|
1316
|
-
!this._sheetDataValidationModel.getRuleById(o.unitId, o.subUnitId,
|
1317
|
-
const { row:
|
1318
|
-
|
1309
|
+
w
|
1310
|
+
), f = `${a}-${V}`, g = this._sheetDataValidationModel.getRuleById(n, a, V);
|
1311
|
+
!this._sheetDataValidationModel.getRuleById(o.unitId, o.subUnitId, f) && g && d.set(f, { ...g, uid: f });
|
1312
|
+
const { row: y, col: L } = h(C.startRow, C.startColumn);
|
1313
|
+
s.add(f), r.setValue(y, L, f);
|
1319
1314
|
});
|
1320
1315
|
});
|
1321
|
-
const
|
1322
|
-
i.addRangeRules(
|
1323
|
-
const { redoMutations: m, undoMutations:
|
1316
|
+
const v = Array.from(s).map((w) => ({ id: w, ranges: Zt(r, (S) => S === w) }));
|
1317
|
+
i.addRangeRules(v);
|
1318
|
+
const { redoMutations: m, undoMutations: _ } = tn(
|
1324
1319
|
o.unitId,
|
1325
1320
|
o.subUnitId,
|
1326
1321
|
i.diffWithAddition(this._sheetDataValidationModel.getRules(o.unitId, o.subUnitId), d.values()),
|
@@ -1330,28 +1325,28 @@ let ze = class extends De {
|
|
1330
1325
|
);
|
1331
1326
|
return {
|
1332
1327
|
redos: m,
|
1333
|
-
undos:
|
1328
|
+
undos: _
|
1334
1329
|
};
|
1335
1330
|
} else {
|
1336
|
-
const i = this._sheetDataValidationModel.getRuleObjectMatrix(n, a).clone(), r = new vt(),
|
1337
|
-
On(
|
1338
|
-
var
|
1339
|
-
(
|
1340
|
-
const
|
1331
|
+
const i = this._sheetDataValidationModel.getRuleObjectMatrix(n, a).clone(), r = new vt(), s = /* @__PURE__ */ new Set(), { ranges: [l, c], mapFunc: h } = nn([o.copyRange, t]);
|
1332
|
+
On(l, c, !0).forEach(({ startRange: _ }) => {
|
1333
|
+
var w;
|
1334
|
+
(w = this._copyInfo) == null || w.matrix.forValue((S, R, I) => {
|
1335
|
+
const V = _t.getPositionRange(
|
1341
1336
|
{
|
1342
|
-
startRow:
|
1343
|
-
endRow:
|
1344
|
-
startColumn:
|
1345
|
-
endColumn:
|
1337
|
+
startRow: S,
|
1338
|
+
endRow: S,
|
1339
|
+
startColumn: R,
|
1340
|
+
endColumn: R
|
1346
1341
|
},
|
1347
|
-
|
1348
|
-
), { row:
|
1349
|
-
r.setValue(
|
1342
|
+
_
|
1343
|
+
), { row: C, col: f } = h(V.startRow, V.startColumn);
|
1344
|
+
r.setValue(C, f, I), s.add(I);
|
1350
1345
|
});
|
1351
1346
|
});
|
1352
|
-
const d = Array.from(
|
1347
|
+
const d = Array.from(s).map((_) => ({ id: _, ranges: Zt(r, (w) => w === _) }));
|
1353
1348
|
i.addRangeRules(d);
|
1354
|
-
const { redoMutations:
|
1349
|
+
const { redoMutations: v, undoMutations: m } = tn(
|
1355
1350
|
n,
|
1356
1351
|
a,
|
1357
1352
|
i.diff(this._sheetDataValidationModel.getRules(n, a)),
|
@@ -1360,7 +1355,7 @@ let ze = class extends De {
|
|
1360
1355
|
!1
|
1361
1356
|
);
|
1362
1357
|
return {
|
1363
|
-
redos:
|
1358
|
+
redos: v,
|
1364
1359
|
undos: m
|
1365
1360
|
};
|
1366
1361
|
}
|
@@ -1408,7 +1403,7 @@ function pr(e) {
|
|
1408
1403
|
type: gn.SUBITEMS,
|
1409
1404
|
icon: Eo,
|
1410
1405
|
tooltip: "dataValidation.title",
|
1411
|
-
hidden$: ja(e,
|
1406
|
+
hidden$: ja(e, Y.UNIVER_SHEET),
|
1412
1407
|
disabled$: Ta(e, { workbookTypes: [St], worksheetTypes: [en, It], rangeTypes: [Ct] })
|
1413
1408
|
};
|
1414
1409
|
}
|
@@ -1454,8 +1449,8 @@ const Lo = {
|
|
1454
1449
|
}
|
1455
1450
|
};
|
1456
1451
|
let Ge = class extends cn {
|
1457
|
-
constructor(e, t, o, n, a, i, r,
|
1458
|
-
super(), this._commandService = e, this._menuManagerService = t, this._renderManagerService = o, this._univerInstanceService = n, this._autoHeightController = a, this._dropdownManagerService = i, this._sheetDataValidationModel = r, this._dataValidatorRegistryService =
|
1452
|
+
constructor(e, t, o, n, a, i, r, s, l, c, h) {
|
1453
|
+
super(), this._commandService = e, this._menuManagerService = t, 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 = h, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
1459
1454
|
}
|
1460
1455
|
_initMenu() {
|
1461
1456
|
this._menuManagerService.mergeMenu(gr);
|
@@ -1469,17 +1464,17 @@ let Ge = class extends cn {
|
|
1469
1464
|
}
|
1470
1465
|
const t = this._editorBridgeService.getEditCellState();
|
1471
1466
|
if (t) {
|
1472
|
-
const { unitId: n, sheetId: a, row: i, column: r } = t,
|
1473
|
-
if (!l)
|
1474
|
-
return;
|
1475
|
-
const s = this._sheetDataValidationModel.getRuleByLocation(n, a, i, r);
|
1467
|
+
const { unitId: n, sheetId: a, row: i, column: r } = t, s = this._univerInstanceService.getUniverSheetInstance(n);
|
1476
1468
|
if (!s)
|
1477
1469
|
return;
|
1478
|
-
const
|
1470
|
+
const l = this._sheetDataValidationModel.getRuleByLocation(n, a, i, r);
|
1471
|
+
if (!l)
|
1472
|
+
return;
|
1473
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(l.type);
|
1479
1474
|
if (!(c != null && c.dropdown))
|
1480
1475
|
return;
|
1481
|
-
const
|
1482
|
-
if (!
|
1476
|
+
const h = s.getActiveSheet();
|
1477
|
+
if (!h) return;
|
1483
1478
|
const p = this._dropdownManagerService.activeDropdown, d = p == null ? void 0 : p.location;
|
1484
1479
|
if (d && d.unitId === n && d.subUnitId === a && d.row === i && d.col === r)
|
1485
1480
|
return;
|
@@ -1490,8 +1485,8 @@ let Ge = class extends cn {
|
|
1490
1485
|
subUnitId: a,
|
1491
1486
|
row: i,
|
1492
1487
|
col: r,
|
1493
|
-
workbook:
|
1494
|
-
worksheet:
|
1488
|
+
workbook: s,
|
1489
|
+
worksheet: h
|
1495
1490
|
},
|
1496
1491
|
componentKey: c.dropdown,
|
1497
1492
|
onHide: () => {
|
@@ -1514,24 +1509,24 @@ let Ge = class extends cn {
|
|
1514
1509
|
priority: Zn.DATA_VALIDATION,
|
1515
1510
|
// eslint-disable-next-line max-lines-per-function, complexity
|
1516
1511
|
handler: (e, t, o) => {
|
1517
|
-
var
|
1518
|
-
const { row: n, col: a, unitId: i, subUnitId: r, workbook:
|
1512
|
+
var S, R, I, V, C;
|
1513
|
+
const { row: n, col: a, unitId: i, subUnitId: r, workbook: s, worksheet: l } = t, c = this._sheetDataValidationModel.getRuleIdByLocation(i, r, n, a);
|
1519
1514
|
if (!c)
|
1520
1515
|
return o(e);
|
1521
|
-
const
|
1522
|
-
if (!
|
1516
|
+
const h = this._sheetDataValidationModel.getRuleById(i, r, c);
|
1517
|
+
if (!h)
|
1523
1518
|
return o(e);
|
1524
|
-
const p = (
|
1519
|
+
const p = (S = this._dataValidationCacheService.getValue(i, r, n, a)) != null ? S : at.VALID, d = this._dataValidatorRegistryService.getValidatorItem(h.type), v = t.rawData;
|
1525
1520
|
let m;
|
1526
|
-
const
|
1521
|
+
const _ = {
|
1527
1522
|
get value() {
|
1528
|
-
var
|
1529
|
-
return m !== void 0 || (m = (
|
1523
|
+
var f;
|
1524
|
+
return m !== void 0 || (m = (f = ie(v)) != null ? f : null), m;
|
1530
1525
|
}
|
1531
|
-
},
|
1526
|
+
}, w = {
|
1532
1527
|
get value() {
|
1533
|
-
var
|
1534
|
-
return `${(
|
1528
|
+
var f;
|
1529
|
+
return `${(f = _.value) != null ? f : ""}`;
|
1535
1530
|
}
|
1536
1531
|
};
|
1537
1532
|
return o({
|
@@ -1541,59 +1536,59 @@ let Ge = class extends cn {
|
|
1541
1536
|
...p === at.INVALID ? Lo : null
|
1542
1537
|
},
|
1543
1538
|
customRender: [
|
1544
|
-
...(
|
1539
|
+
...(R = e == null ? void 0 : e.customRender) != null ? R : [],
|
1545
1540
|
...d != null && d.canvasRender ? [d.canvasRender] : []
|
1546
1541
|
],
|
1547
1542
|
fontRenderExtension: {
|
1548
1543
|
...e == null ? void 0 : e.fontRenderExtension,
|
1549
|
-
isSkip: ((I = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : I.isSkip) || ((
|
1544
|
+
isSkip: ((I = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : I.isSkip) || ((V = d == null ? void 0 : d.skipDefaultFontRender) == null ? void 0 : V.call(d, h, _.value, t))
|
1550
1545
|
},
|
1551
1546
|
interceptorStyle: {
|
1552
1547
|
...e == null ? void 0 : e.interceptorStyle,
|
1553
|
-
...d == null ? void 0 : d.getExtraStyle(
|
1548
|
+
...d == null ? void 0 : d.getExtraStyle(h, w.value, {
|
1554
1549
|
get style() {
|
1555
|
-
const
|
1556
|
-
return (typeof (e == null ? void 0 : e.s) == "string" ?
|
1550
|
+
const f = s.getStyles();
|
1551
|
+
return (typeof (e == null ? void 0 : e.s) == "string" ? f.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {};
|
1557
1552
|
}
|
1558
1553
|
}, n, a)
|
1559
1554
|
},
|
1560
1555
|
interceptorAutoHeight: () => {
|
1561
|
-
var
|
1562
|
-
const
|
1563
|
-
if (!
|
1556
|
+
var L, U, T, E, A, x;
|
1557
|
+
const f = (U = (L = this._renderManagerService.getRenderById(i)) == null ? void 0 : L.with(wt).getWorksheetSkeleton(r)) == null ? void 0 : U.skeleton;
|
1558
|
+
if (!f)
|
1564
1559
|
return;
|
1565
|
-
const g =
|
1560
|
+
const g = f.worksheet.getMergedCell(n, a), y = {
|
1566
1561
|
data: e,
|
1567
|
-
style:
|
1568
|
-
primaryWithCoord:
|
1562
|
+
style: f.getsStyles().getStyleByCell(e),
|
1563
|
+
primaryWithCoord: f.getCellWithCoordByIndex((T = g == null ? void 0 : g.startRow) != null ? T : n, (E = g == null ? void 0 : g.startColumn) != null ? E : a),
|
1569
1564
|
unitId: i,
|
1570
1565
|
subUnitId: r,
|
1571
1566
|
row: n,
|
1572
1567
|
col: a,
|
1573
|
-
workbook:
|
1574
|
-
worksheet:
|
1568
|
+
workbook: s,
|
1569
|
+
worksheet: l
|
1575
1570
|
};
|
1576
|
-
return (x = (
|
1571
|
+
return (x = (A = d == null ? void 0 : d.canvasRender) == null ? void 0 : A.calcCellAutoHeight) == null ? void 0 : x.call(A, y);
|
1577
1572
|
},
|
1578
1573
|
interceptorAutoWidth: () => {
|
1579
|
-
var
|
1580
|
-
const
|
1581
|
-
if (!
|
1574
|
+
var L, U, T, E, A, x;
|
1575
|
+
const f = (U = (L = this._renderManagerService.getRenderById(i)) == null ? void 0 : L.with(wt).getWorksheetSkeleton(r)) == null ? void 0 : U.skeleton;
|
1576
|
+
if (!f)
|
1582
1577
|
return;
|
1583
|
-
const g =
|
1578
|
+
const g = f.worksheet.getMergedCell(n, a), y = {
|
1584
1579
|
data: e,
|
1585
|
-
style:
|
1586
|
-
primaryWithCoord:
|
1580
|
+
style: f.getsStyles().getStyleByCell(e),
|
1581
|
+
primaryWithCoord: f.getCellWithCoordByIndex((T = g == null ? void 0 : g.startRow) != null ? T : n, (E = g == null ? void 0 : g.startColumn) != null ? E : a),
|
1587
1582
|
unitId: i,
|
1588
1583
|
subUnitId: r,
|
1589
1584
|
row: n,
|
1590
1585
|
col: a,
|
1591
|
-
workbook:
|
1592
|
-
worksheet:
|
1586
|
+
workbook: s,
|
1587
|
+
worksheet: l
|
1593
1588
|
};
|
1594
|
-
return (x = (
|
1589
|
+
return (x = (A = d == null ? void 0 : d.canvasRender) == null ? void 0 : A.calcCellAutoWidth) == null ? void 0 : x.call(A, y);
|
1595
1590
|
},
|
1596
|
-
coverable: ((
|
1591
|
+
coverable: ((C = e == null ? void 0 : e.coverable) != null ? C : !0) && !(h.type === Z.LIST || h.type === Z.LIST_MULTIPLE)
|
1597
1592
|
});
|
1598
1593
|
}
|
1599
1594
|
}
|
@@ -1645,14 +1640,14 @@ let jn = class extends cn {
|
|
1645
1640
|
priority: Zn.DATA_VALIDATION,
|
1646
1641
|
// eslint-disable-next-line complexity
|
1647
1642
|
handler: (e, t, o) => {
|
1648
|
-
var
|
1649
|
-
const { row: n, col: a, unitId: i, subUnitId: r, workbook:
|
1643
|
+
var w, S, R, I, V;
|
1644
|
+
const { row: n, col: a, unitId: i, subUnitId: r, workbook: s, worksheet: l } = t, c = this._sheetDataValidationModel.getRuleIdByLocation(i, r, n, a);
|
1650
1645
|
if (!c)
|
1651
1646
|
return o(e);
|
1652
|
-
const
|
1653
|
-
if (!
|
1647
|
+
const h = this._sheetDataValidationModel.getRuleById(i, r, c);
|
1648
|
+
if (!h)
|
1654
1649
|
return o(e);
|
1655
|
-
const p = (
|
1650
|
+
const p = (w = this._dataValidationCacheService.getValue(i, r, n, a)) != null ? w : at.VALID, d = this._dataValidatorRegistryService.getValidatorItem(h.type), v = l.getCellRaw(n, a), m = ie(v), _ = `${m != null ? m : ""}`;
|
1656
1651
|
return o({
|
1657
1652
|
...e,
|
1658
1653
|
markers: {
|
@@ -1660,41 +1655,41 @@ let jn = class extends cn {
|
|
1660
1655
|
...p === at.INVALID ? Lo : null
|
1661
1656
|
},
|
1662
1657
|
customRender: [
|
1663
|
-
...(
|
1658
|
+
...(S = e == null ? void 0 : e.customRender) != null ? S : [],
|
1664
1659
|
...d != null && d.canvasRender ? [d.canvasRender] : []
|
1665
1660
|
],
|
1666
1661
|
fontRenderExtension: {
|
1667
1662
|
...e == null ? void 0 : e.fontRenderExtension,
|
1668
|
-
isSkip: ((
|
1663
|
+
isSkip: ((R = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : R.isSkip) || ((I = d == null ? void 0 : d.skipDefaultFontRender) == null ? void 0 : I.call(d, h, m, t))
|
1669
1664
|
},
|
1670
1665
|
interceptorStyle: {
|
1671
1666
|
...e == null ? void 0 : e.interceptorStyle,
|
1672
|
-
...d == null ? void 0 : d.getExtraStyle(
|
1667
|
+
...d == null ? void 0 : d.getExtraStyle(h, _, {
|
1673
1668
|
get style() {
|
1674
|
-
const
|
1675
|
-
return (typeof (e == null ? void 0 : e.s) == "string" ?
|
1669
|
+
const C = s.getStyles();
|
1670
|
+
return (typeof (e == null ? void 0 : e.s) == "string" ? C.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {};
|
1676
1671
|
}
|
1677
1672
|
}, n, a)
|
1678
1673
|
},
|
1679
1674
|
interceptorAutoHeight: () => {
|
1680
|
-
var
|
1681
|
-
const
|
1682
|
-
if (!
|
1675
|
+
var y, L, U, T, E, A;
|
1676
|
+
const C = (L = (y = this._renderManagerService.getRenderById(i)) == null ? void 0 : y.with(wt).getWorksheetSkeleton(r)) == null ? void 0 : L.skeleton;
|
1677
|
+
if (!C)
|
1683
1678
|
return;
|
1684
|
-
const
|
1679
|
+
const f = C.worksheet.getMergedCell(n, a), g = {
|
1685
1680
|
data: e,
|
1686
|
-
style:
|
1687
|
-
primaryWithCoord:
|
1681
|
+
style: C.getsStyles().getStyleByCell(e),
|
1682
|
+
primaryWithCoord: C.getCellWithCoordByIndex((U = f == null ? void 0 : f.startRow) != null ? U : n, (T = f == null ? void 0 : f.startColumn) != null ? T : a),
|
1688
1683
|
unitId: i,
|
1689
1684
|
subUnitId: r,
|
1690
1685
|
row: n,
|
1691
1686
|
col: a,
|
1692
|
-
workbook:
|
1693
|
-
worksheet:
|
1687
|
+
workbook: s,
|
1688
|
+
worksheet: l
|
1694
1689
|
};
|
1695
|
-
return (
|
1690
|
+
return (A = (E = d == null ? void 0 : d.canvasRender) == null ? void 0 : E.calcCellAutoHeight) == null ? void 0 : A.call(E, g);
|
1696
1691
|
},
|
1697
|
-
coverable: ((
|
1692
|
+
coverable: ((V = e == null ? void 0 : e.coverable) != null ? V : !0) && !(h.type === Z.LIST || h.type === Z.LIST_MULTIPLE)
|
1698
1693
|
});
|
1699
1694
|
}
|
1700
1695
|
}
|
@@ -1766,9 +1761,9 @@ const wr = "univer-data-validation-formula", Rr = "univer-data-validation-formul
|
|
1766
1761
|
dataValidationFormulaColorSelectPanel: Er,
|
1767
1762
|
dataValidationFormulaColorItem: Or
|
1768
1763
|
}, Pr = (e) => {
|
1769
|
-
const { isTwoFormula: t = !1, value: o, onChange: n, showError: a, validResult: i } = e, r =
|
1770
|
-
return t ? /* @__PURE__ */
|
1771
|
-
/* @__PURE__ */
|
1764
|
+
const { isTwoFormula: t = !1, value: o, onChange: n, showError: a, validResult: i } = e, r = P(J), s = a ? i == null ? void 0 : i.formula1 : "", l = a ? i == null ? void 0 : i.formula2 : "";
|
1765
|
+
return t ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
1766
|
+
/* @__PURE__ */ u.jsx(G, { error: s, children: /* @__PURE__ */ u.jsx(
|
1772
1767
|
xe,
|
1773
1768
|
{
|
1774
1769
|
className: ne.dataValidationFormula,
|
@@ -1782,8 +1777,8 @@ const wr = "univer-data-validation-formula", Rr = "univer-data-validation-formul
|
|
1782
1777
|
}
|
1783
1778
|
}
|
1784
1779
|
) }),
|
1785
|
-
/* @__PURE__ */
|
1786
|
-
/* @__PURE__ */
|
1780
|
+
/* @__PURE__ */ u.jsx("div", { className: ne.dataValidationFormulaAnd, children: r.t("dataValidation.panel.formulaAnd") }),
|
1781
|
+
/* @__PURE__ */ u.jsx(G, { error: l, children: /* @__PURE__ */ u.jsx(
|
1787
1782
|
xe,
|
1788
1783
|
{
|
1789
1784
|
className: ne.dataValidationFormula,
|
@@ -1797,7 +1792,7 @@ const wr = "univer-data-validation-formula", Rr = "univer-data-validation-formul
|
|
1797
1792
|
}
|
1798
1793
|
}
|
1799
1794
|
) })
|
1800
|
-
] }) : /* @__PURE__ */
|
1795
|
+
] }) : /* @__PURE__ */ u.jsx(G, { error: s, children: /* @__PURE__ */ u.jsx(
|
1801
1796
|
xe,
|
1802
1797
|
{
|
1803
1798
|
className: ne.dataValidationFormula,
|
@@ -1810,14 +1805,14 @@ const wr = "univer-data-validation-formula", Rr = "univer-data-validation-formul
|
|
1810
1805
|
) });
|
1811
1806
|
};
|
1812
1807
|
function Lr(e) {
|
1813
|
-
const { value: t, onChange: o, showError: n, validResult: a } = e, i =
|
1814
|
-
return /* @__PURE__ */
|
1815
|
-
/* @__PURE__ */
|
1808
|
+
const { value: t, onChange: o, showError: n, validResult: a } = e, i = P(J), r = n ? a == null ? void 0 : a.formula1 : "", s = n ? a == null ? void 0 : a.formula2 : "", [l, c] = W(!((t == null ? void 0 : t.formula1) === void 0 && (t == null ? void 0 : t.formula2) === void 0));
|
1809
|
+
return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
1810
|
+
/* @__PURE__ */ u.jsx(G, { children: /* @__PURE__ */ u.jsx(
|
1816
1811
|
Mt,
|
1817
1812
|
{
|
1818
|
-
checked:
|
1819
|
-
onChange: (
|
1820
|
-
|
1813
|
+
checked: l,
|
1814
|
+
onChange: (h) => {
|
1815
|
+
h ? c(!0) : (c(!1), o == null || o({
|
1821
1816
|
...t,
|
1822
1817
|
formula1: void 0,
|
1823
1818
|
formula2: void 0
|
@@ -1826,30 +1821,30 @@ function Lr(e) {
|
|
1826
1821
|
children: i.t("dataValidation.checkbox.tips")
|
1827
1822
|
}
|
1828
1823
|
) }),
|
1829
|
-
|
1824
|
+
l ? /* @__PURE__ */ u.jsx(G, { label: i.t("dataValidation.checkbox.checked"), error: r, children: /* @__PURE__ */ u.jsx(
|
1830
1825
|
xe,
|
1831
1826
|
{
|
1832
1827
|
className: ne.dataValidationFormula,
|
1833
1828
|
placeholder: i.t("dataValidation.panel.valuePlaceholder"),
|
1834
1829
|
value: t == null ? void 0 : t.formula1,
|
1835
|
-
onChange: (
|
1830
|
+
onChange: (h) => {
|
1836
1831
|
o == null || o({
|
1837
1832
|
...t,
|
1838
|
-
formula1:
|
1833
|
+
formula1: h || void 0
|
1839
1834
|
});
|
1840
1835
|
}
|
1841
1836
|
}
|
1842
1837
|
) }) : null,
|
1843
|
-
|
1838
|
+
l ? /* @__PURE__ */ u.jsx(G, { label: i.t("dataValidation.checkbox.unchecked"), error: s, children: /* @__PURE__ */ u.jsx(
|
1844
1839
|
xe,
|
1845
1840
|
{
|
1846
1841
|
className: ne.dataValidationFormula,
|
1847
1842
|
placeholder: i.t("dataValidation.panel.valuePlaceholder"),
|
1848
1843
|
value: t == null ? void 0 : t.formula2,
|
1849
|
-
onChange: (
|
1844
|
+
onChange: (h) => {
|
1850
1845
|
o == null || o({
|
1851
1846
|
...t,
|
1852
|
-
formula2:
|
1847
|
+
formula2: h || void 0
|
1853
1848
|
});
|
1854
1849
|
}
|
1855
1850
|
}
|
@@ -1858,12 +1853,12 @@ function Lr(e) {
|
|
1858
1853
|
}
|
1859
1854
|
function Tr(e) {
|
1860
1855
|
var p;
|
1861
|
-
const { unitId: t, subUnitId: o, value: n, onChange: a, showError: i, validResult: r } = e,
|
1856
|
+
const { unitId: t, subUnitId: o, value: n, onChange: a, showError: i, validResult: r } = e, s = i ? r == null ? void 0 : r.formula1 : void 0, l = We({}), [c, h] = W(!1);
|
1862
1857
|
return fn((d) => {
|
1863
1858
|
var m;
|
1864
|
-
const
|
1865
|
-
|
1866
|
-
}), /* @__PURE__ */
|
1859
|
+
const v = (m = l.current) == null ? void 0 : m.handleOutClick;
|
1860
|
+
v && v(d, () => h(!1));
|
1861
|
+
}), /* @__PURE__ */ u.jsx(
|
1867
1862
|
mo,
|
1868
1863
|
{
|
1869
1864
|
initValue: (p = n == null ? void 0 : n.formula1) != null ? p : "",
|
@@ -1871,15 +1866,15 @@ function Tr(e) {
|
|
1871
1866
|
subUnitId: o,
|
1872
1867
|
isFocus: c,
|
1873
1868
|
onChange: (d) => {
|
1874
|
-
const
|
1875
|
-
|
1869
|
+
const v = (d != null ? d : "").trim();
|
1870
|
+
v !== (n == null ? void 0 : n.formula1) && (a == null || a({
|
1876
1871
|
...n,
|
1877
|
-
formula1:
|
1872
|
+
formula1: v
|
1878
1873
|
}));
|
1879
1874
|
},
|
1880
|
-
errorText:
|
1881
|
-
onFocus: () =>
|
1882
|
-
actions:
|
1875
|
+
errorText: s,
|
1876
|
+
onFocus: () => h(!0),
|
1877
|
+
actions: l.current,
|
1883
1878
|
isSupportAcrossSheet: !0
|
1884
1879
|
}
|
1885
1880
|
);
|
@@ -1923,8 +1918,8 @@ const xr = [
|
|
1923
1918
|
"#9E6DE3",
|
1924
1919
|
"#F248A6"
|
1925
1920
|
], jr = (e) => {
|
1926
|
-
const { value: t, onChange: o, disabled: n } = e, [a, i] =
|
1927
|
-
return /* @__PURE__ */
|
1921
|
+
const { value: t, onChange: o, disabled: n } = e, [a, i] = W(!1);
|
1922
|
+
return /* @__PURE__ */ u.jsx(
|
1928
1923
|
Jt,
|
1929
1924
|
{
|
1930
1925
|
disabled: n,
|
@@ -1935,15 +1930,15 @@ const xr = [
|
|
1935
1930
|
className: ne.dataValidationFormulaColorSelect,
|
1936
1931
|
value: t,
|
1937
1932
|
onChange: o,
|
1938
|
-
labelRender: (r) => /* @__PURE__ */
|
1933
|
+
labelRender: (r) => /* @__PURE__ */ u.jsx(
|
1939
1934
|
"div",
|
1940
1935
|
{
|
1941
1936
|
className: ne.dataValidationFormulaColorItem,
|
1942
1937
|
style: { background: r.value, marginTop: 5 }
|
1943
1938
|
}
|
1944
1939
|
),
|
1945
|
-
dropdownRender: () => /* @__PURE__ */
|
1946
|
-
(r) => /* @__PURE__ */
|
1940
|
+
dropdownRender: () => /* @__PURE__ */ u.jsx("div", { className: ne.dataValidationFormulaColorSelectPanel, children: xr.map(
|
1941
|
+
(r) => /* @__PURE__ */ u.jsx(
|
1947
1942
|
"div",
|
1948
1943
|
{
|
1949
1944
|
onClick: () => {
|
@@ -1959,9 +1954,9 @@ const xr = [
|
|
1959
1954
|
);
|
1960
1955
|
}, Nn = (e) => {
|
1961
1956
|
const { item: t, commonProps: o, style: n } = e, { onItemChange: a, onItemDelete: i } = o;
|
1962
|
-
return /* @__PURE__ */
|
1963
|
-
t.isRef ? null : /* @__PURE__ */
|
1964
|
-
/* @__PURE__ */
|
1957
|
+
return /* @__PURE__ */ u.jsxs("div", { className: ne.dataValidationFormulaListItem, style: n, children: [
|
1958
|
+
t.isRef ? null : /* @__PURE__ */ u.jsx("div", { className: Ar(ne.dataValidationFormulaListItemDrag, "draggableHandle"), children: /* @__PURE__ */ u.jsx(Ro, {}) }),
|
1959
|
+
/* @__PURE__ */ u.jsx(
|
1965
1960
|
jr,
|
1966
1961
|
{
|
1967
1962
|
value: t.color,
|
@@ -1970,7 +1965,7 @@ const xr = [
|
|
1970
1965
|
}
|
1971
1966
|
}
|
1972
1967
|
),
|
1973
|
-
/* @__PURE__ */
|
1968
|
+
/* @__PURE__ */ u.jsx(
|
1974
1969
|
xe,
|
1975
1970
|
{
|
1976
1971
|
disabled: t.isRef,
|
@@ -1980,54 +1975,54 @@ const xr = [
|
|
1980
1975
|
}
|
1981
1976
|
}
|
1982
1977
|
),
|
1983
|
-
t.isRef ? null : /* @__PURE__ */
|
1978
|
+
t.isRef ? null : /* @__PURE__ */ u.jsx("div", { className: ne.dataValidationFormulaListItemIcon, children: /* @__PURE__ */ u.jsx(Sn, { onClick: () => i(t.id) }) })
|
1984
1979
|
] });
|
1985
1980
|
};
|
1986
1981
|
function Fr(e) {
|
1987
1982
|
const { value: t, onChange: o = () => {
|
1988
|
-
}, unitId: n, subUnitId: a, validResult: i, showError: r, ruleId:
|
1983
|
+
}, unitId: n, subUnitId: a, validResult: i, showError: r, ruleId: s } = e, { formula1: l = "", formula2: c = "" } = t || {}, h = We(null), [p, d] = W(() => Pe(l) ? "1" : "0"), [v, m] = W(p === "1" ? l : "="), [_, w] = W(p === "1" ? l : "="), S = P(J), R = P(ye), I = P(Et), V = P(_a), [C, f] = W(() => c.split(",")), g = R.getValidatorItem(Z.LIST), [y, L] = W([]), [U, T] = W(""), E = r ? i == null ? void 0 : i.formula1 : "", A = Te(() => I.ruleChange$.pipe(_n(16)), []), x = Ne(A), j = uo(o);
|
1989
1984
|
Ce(() => {
|
1990
1985
|
(async () => {
|
1991
1986
|
await new Promise((B) => {
|
1992
1987
|
setTimeout(() => B(!0), 100);
|
1993
1988
|
});
|
1994
|
-
const D = I.getRuleById(n, a,
|
1995
|
-
if (Pe(
|
1989
|
+
const D = I.getRuleById(n, a, s), N = D == null ? void 0 : D.formula1;
|
1990
|
+
if (Pe(N) && g && D) {
|
1996
1991
|
const B = await g.getListAsync(D, n, a);
|
1997
|
-
|
1992
|
+
L(B);
|
1998
1993
|
}
|
1999
1994
|
})();
|
2000
|
-
}, [I, x, g,
|
2001
|
-
Pe(
|
2002
|
-
}, [
|
2003
|
-
const [
|
2004
|
-
const D = p !== "1" ? qn(
|
1995
|
+
}, [I, x, g, s, a, n]), Ce(() => {
|
1996
|
+
Pe(l) && l !== _ && (m(l), w(_));
|
1997
|
+
}, [_, l]);
|
1998
|
+
const [F, H] = W(() => {
|
1999
|
+
const D = p !== "1" ? qn(l) : [], N = c.split(",");
|
2005
2000
|
return D.map((B, $) => ({
|
2006
2001
|
label: B,
|
2007
|
-
color:
|
2002
|
+
color: N[$] || Le,
|
2008
2003
|
isRef: !1,
|
2009
2004
|
id: qt.generateRandomId(4)
|
2010
2005
|
}));
|
2011
|
-
}),
|
2012
|
-
const $ =
|
2013
|
-
$ && ($.label =
|
2006
|
+
}), X = (D, N, B) => {
|
2007
|
+
const $ = F.find((_e) => _e.id === D);
|
2008
|
+
$ && ($.label = N, $.color = B, H([...F]));
|
2014
2009
|
}, k = (D) => {
|
2015
|
-
const
|
2016
|
-
|
2017
|
-
},
|
2010
|
+
const N = F.findIndex((B) => B.id === D);
|
2011
|
+
N !== -1 && (F.splice(N, 1), H([...F]));
|
2012
|
+
}, z = c.split(","), q = Te(() => y.map((D, N) => ({
|
2018
2013
|
label: D,
|
2019
|
-
color:
|
2020
|
-
id: `${
|
2014
|
+
color: z[N] || Le,
|
2015
|
+
id: `${N}`,
|
2021
2016
|
isRef: !0
|
2022
|
-
})), [
|
2023
|
-
const $ = [...
|
2024
|
-
$[+D] = B,
|
2025
|
-
formula1:
|
2017
|
+
})), [z, y]), ee = (D, N, B) => {
|
2018
|
+
const $ = [...C];
|
2019
|
+
$[+D] = B, f($), j({
|
2020
|
+
formula1: l,
|
2026
2021
|
formula2: $.join(",")
|
2027
2022
|
});
|
2028
2023
|
}, te = () => {
|
2029
|
-
|
2030
|
-
...
|
2024
|
+
H([
|
2025
|
+
...F,
|
2031
2026
|
{
|
2032
2027
|
label: "",
|
2033
2028
|
color: Le,
|
@@ -2039,22 +2034,22 @@ function Fr(e) {
|
|
2039
2034
|
Ce(() => {
|
2040
2035
|
if (p === "1")
|
2041
2036
|
return;
|
2042
|
-
const D = /* @__PURE__ */ new Set(),
|
2043
|
-
|
2037
|
+
const D = /* @__PURE__ */ new Set(), N = [];
|
2038
|
+
F.map((B) => ({
|
2044
2039
|
labelList: B.label.split(","),
|
2045
2040
|
item: B
|
2046
2041
|
})).forEach(({ item: B, labelList: $ }) => {
|
2047
2042
|
$.forEach((_e) => {
|
2048
|
-
D.has(_e) || (D.add(_e),
|
2043
|
+
D.has(_e) || (D.add(_e), N.push({
|
2049
2044
|
label: _e,
|
2050
2045
|
color: B.color
|
2051
2046
|
}));
|
2052
2047
|
});
|
2053
2048
|
}), j({
|
2054
|
-
formula1: Jn(
|
2055
|
-
formula2:
|
2049
|
+
formula1: Jn(N.map((B) => B.label)),
|
2050
|
+
formula2: N.map((B) => B.color === Le ? "" : B.color).join(",")
|
2056
2051
|
});
|
2057
|
-
}, [
|
2052
|
+
}, [F, j, p, _, C]);
|
2058
2053
|
const re = Te(
|
2059
2054
|
() => async (D) => {
|
2060
2055
|
if (!Pe(D)) {
|
@@ -2064,71 +2059,71 @@ function Fr(e) {
|
|
2064
2059
|
});
|
2065
2060
|
return;
|
2066
2061
|
}
|
2067
|
-
|
2062
|
+
V.getFormulaRefCheck(D) ? (j == null || j({
|
2068
2063
|
formula1: Pe(D) ? D : "",
|
2069
2064
|
formula2: c
|
2070
|
-
}),
|
2065
|
+
}), T("")) : (j == null || j({
|
2071
2066
|
formula1: "",
|
2072
2067
|
formula2: c
|
2073
|
-
}), m("="),
|
2068
|
+
}), m("="), T(S.t("dataValidation.validFail.formulaError")));
|
2074
2069
|
},
|
2075
2070
|
[c, j]
|
2076
|
-
), ae = We({}), [se,
|
2071
|
+
), ae = We({}), [se, O] = W(!1);
|
2077
2072
|
return fn((D) => {
|
2078
2073
|
var B;
|
2079
|
-
const
|
2080
|
-
|
2081
|
-
}), /* @__PURE__ */
|
2082
|
-
/* @__PURE__ */
|
2074
|
+
const N = (B = ae.current) == null ? void 0 : B.handleOutClick;
|
2075
|
+
N && N(D, () => O(!1));
|
2076
|
+
}), /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
2077
|
+
/* @__PURE__ */ u.jsx(G, { label: S.t("dataValidation.list.options"), children: /* @__PURE__ */ u.jsxs(
|
2083
2078
|
un,
|
2084
2079
|
{
|
2085
2080
|
value: p,
|
2086
2081
|
onChange: (D) => {
|
2087
|
-
d(D), m(
|
2088
|
-
formula1:
|
2089
|
-
formula2:
|
2082
|
+
d(D), m(_), D === "1" && j({
|
2083
|
+
formula1: _ === "=" ? "" : _,
|
2084
|
+
formula2: C.join(",")
|
2090
2085
|
});
|
2091
2086
|
},
|
2092
2087
|
children: [
|
2093
|
-
/* @__PURE__ */
|
2094
|
-
/* @__PURE__ */
|
2088
|
+
/* @__PURE__ */ u.jsx(Ae, { value: "0", children: S.t("dataValidation.list.customOptions") }),
|
2089
|
+
/* @__PURE__ */ u.jsx(Ae, { value: "1", children: S.t("dataValidation.list.refOptions") })
|
2095
2090
|
]
|
2096
2091
|
}
|
2097
2092
|
) }),
|
2098
|
-
p === "1" ? /* @__PURE__ */
|
2099
|
-
/* @__PURE__ */
|
2093
|
+
p === "1" ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
2094
|
+
/* @__PURE__ */ u.jsx(
|
2100
2095
|
mo,
|
2101
2096
|
{
|
2102
|
-
initValue:
|
2097
|
+
initValue: v,
|
2103
2098
|
unitId: n,
|
2104
2099
|
subUnitId: a,
|
2105
2100
|
isFocus: se,
|
2106
2101
|
onChange: (D = "") => {
|
2107
|
-
const
|
2108
|
-
|
2102
|
+
const N = (D != null ? D : "").trim();
|
2103
|
+
w(N), re(N);
|
2109
2104
|
},
|
2110
|
-
errorText: E ||
|
2111
|
-
onFocus: () =>
|
2105
|
+
errorText: E || U || void 0,
|
2106
|
+
onFocus: () => O(!0),
|
2112
2107
|
actions: ae.current,
|
2113
2108
|
isSupportAcrossSheet: !0
|
2114
2109
|
}
|
2115
2110
|
),
|
2116
|
-
/* @__PURE__ */
|
2117
|
-
] }) : /* @__PURE__ */
|
2118
|
-
/* @__PURE__ */
|
2111
|
+
/* @__PURE__ */ u.jsx("div", { ref: h, style: { marginTop: "12px" }, children: q.map((D) => /* @__PURE__ */ u.jsx(Nn, { item: D, commonProps: { onItemChange: ee }, style: { marginBottom: 12 } }, D.id)) })
|
2112
|
+
] }) : /* @__PURE__ */ u.jsx(G, { error: E, children: /* @__PURE__ */ u.jsxs("div", { ref: h, style: { marginTop: "-12px" }, children: [
|
2113
|
+
/* @__PURE__ */ u.jsx(
|
2119
2114
|
ia,
|
2120
2115
|
{
|
2121
|
-
list:
|
2122
|
-
onListChange:
|
2116
|
+
list: F,
|
2117
|
+
onListChange: H,
|
2123
2118
|
rowHeight: 32,
|
2124
2119
|
margin: [0, 12],
|
2125
2120
|
draggableHandle: ".draggableHandle",
|
2126
|
-
itemRender: (D) => /* @__PURE__ */
|
2121
|
+
itemRender: (D) => /* @__PURE__ */ u.jsx(
|
2127
2122
|
Nn,
|
2128
2123
|
{
|
2129
2124
|
item: D,
|
2130
2125
|
commonProps: {
|
2131
|
-
onItemChange:
|
2126
|
+
onItemChange: X,
|
2132
2127
|
onItemDelete: k
|
2133
2128
|
}
|
2134
2129
|
},
|
@@ -2137,9 +2132,9 @@ function Fr(e) {
|
|
2137
2132
|
idKey: "id"
|
2138
2133
|
}
|
2139
2134
|
),
|
2140
|
-
/* @__PURE__ */
|
2141
|
-
/* @__PURE__ */
|
2142
|
-
|
2135
|
+
/* @__PURE__ */ u.jsxs("a", { className: ne.dataValidationFormulaListAdd, onClick: te, children: [
|
2136
|
+
/* @__PURE__ */ u.jsx(Co, {}),
|
2137
|
+
S.t("dataValidation.list.add")
|
2143
2138
|
] })
|
2144
2139
|
] }) })
|
2145
2140
|
] });
|
@@ -2164,19 +2159,19 @@ const Ao = "data-validation.custom-formula-input", Tt = "data-validation.formula
|
|
2164
2159
|
], Ur = "LIST_RENDER_MODE_OPTION_INPUT";
|
2165
2160
|
function Dt(e) {
|
2166
2161
|
var a;
|
2167
|
-
const { value: t, onChange: o } = e, n =
|
2168
|
-
return /* @__PURE__ */
|
2169
|
-
/* @__PURE__ */
|
2170
|
-
/* @__PURE__ */
|
2171
|
-
/* @__PURE__ */
|
2162
|
+
const { value: t, onChange: o } = e, n = P(J);
|
2163
|
+
return /* @__PURE__ */ u.jsx(G, { label: n.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ u.jsxs(un, { value: `${(a = t.renderMode) != null ? a : de.CUSTOM}`, onChange: (i) => o({ ...t, renderMode: +i }), children: [
|
2164
|
+
/* @__PURE__ */ u.jsx(Ae, { value: `${de.CUSTOM}`, children: n.t("dataValidation.renderMode.chip") }),
|
2165
|
+
/* @__PURE__ */ u.jsx(Ae, { value: `${de.ARROW}`, children: n.t("dataValidation.renderMode.arrow") }),
|
2166
|
+
/* @__PURE__ */ u.jsx(Ae, { value: `${de.TEXT}`, children: n.t("dataValidation.renderMode.text") })
|
2172
2167
|
] }) });
|
2173
2168
|
}
|
2174
2169
|
Dt.componentKey = Ur;
|
2175
2170
|
const Br = "DATE_SHOW_TIME_OPTION";
|
2176
2171
|
function Vt(e) {
|
2177
2172
|
var a;
|
2178
|
-
const { value: t, onChange: o } = e, n =
|
2179
|
-
return /* @__PURE__ */
|
2173
|
+
const { value: t, onChange: o } = e, n = P(J);
|
2174
|
+
return /* @__PURE__ */ u.jsx(G, { children: /* @__PURE__ */ u.jsx(
|
2180
2175
|
Mt,
|
2181
2176
|
{
|
2182
2177
|
checked: (a = t.bizInfo) == null ? void 0 : a.showTime,
|
@@ -2205,35 +2200,35 @@ let an = class {
|
|
2205
2200
|
this._commandService = e, this._formulaService = t, this._themeService = o, this._renderManagerService = n, this._dataValidationModel = a;
|
2206
2201
|
}
|
2207
2202
|
_calc(e, t) {
|
2208
|
-
var c,
|
2203
|
+
var c, h, p;
|
2209
2204
|
const { vt: o, ht: n } = t || {}, a = e.endX - e.startX - ut * 2, i = e.endY - e.startY, r = ((c = t == null ? void 0 : t.fs) != null ? c : 10) * 1.6;
|
2210
|
-
let
|
2205
|
+
let s = 0, l = 0;
|
2211
2206
|
switch (o) {
|
2212
2207
|
case ue.TOP:
|
2213
|
-
|
2208
|
+
l = 0;
|
2214
2209
|
break;
|
2215
2210
|
case ue.BOTTOM:
|
2216
|
-
|
2211
|
+
l = 0 + (i - r);
|
2217
2212
|
break;
|
2218
2213
|
default:
|
2219
|
-
|
2214
|
+
l = 0 + (i - r) / 2;
|
2220
2215
|
break;
|
2221
2216
|
}
|
2222
2217
|
switch (n) {
|
2223
2218
|
case He.LEFT:
|
2224
|
-
|
2219
|
+
s = ut;
|
2225
2220
|
break;
|
2226
2221
|
case He.RIGHT:
|
2227
|
-
|
2222
|
+
s = ut + (a - r);
|
2228
2223
|
break;
|
2229
2224
|
default:
|
2230
|
-
|
2225
|
+
s = ut + (a - r) / 2;
|
2231
2226
|
break;
|
2232
2227
|
}
|
2233
2228
|
return {
|
2234
|
-
left: e.startX +
|
2235
|
-
top: e.startY +
|
2236
|
-
width: ((
|
2229
|
+
left: e.startX + s,
|
2230
|
+
top: e.startY + l,
|
2231
|
+
width: ((h = t == null ? void 0 : t.fs) != null ? h : 10) * 1.6,
|
2237
2232
|
height: ((p = t == null ? void 0 : t.fs) != null ? p : 10) * 1.6
|
2238
2233
|
};
|
2239
2234
|
}
|
@@ -2248,28 +2243,28 @@ let an = class {
|
|
2248
2243
|
return ((o = t == null ? void 0 : t.fs) != null ? o : 10) * 1.6;
|
2249
2244
|
}
|
2250
2245
|
async _parseFormula(e, t, o) {
|
2251
|
-
var c,
|
2252
|
-
const { formula1: n = Ia, formula2: a = wa } = e, i = await this._formulaService.getRuleFormulaResult(t, o, e.uid), r = xt((p = (
|
2246
|
+
var c, h, p, d, v, m, _, w, S;
|
2247
|
+
const { formula1: n = Ia, formula2: a = wa } = e, i = await this._formulaService.getRuleFormulaResult(t, o, e.uid), r = xt((p = (h = (c = i == null ? void 0 : i[0]) == null ? void 0 : c.result) == null ? void 0 : h[0]) == null ? void 0 : p[0]), s = xt((m = (v = (d = i == null ? void 0 : i[1]) == null ? void 0 : d.result) == null ? void 0 : v[0]) == null ? void 0 : m[0]), l = bn(String(r)) && bn(String(s));
|
2253
2248
|
return {
|
2254
|
-
formula1: Pe(n) ? xt((
|
2255
|
-
formula2: Pe(a) ?
|
2256
|
-
isFormulaValid:
|
2249
|
+
formula1: Pe(n) ? xt((S = (w = (_ = i == null ? void 0 : i[0]) == null ? void 0 : _.result) == null ? void 0 : w[0]) == null ? void 0 : S[0]) : n,
|
2250
|
+
formula2: Pe(a) ? s : a,
|
2251
|
+
isFormulaValid: l
|
2257
2252
|
};
|
2258
2253
|
}
|
2259
2254
|
drawWith(e, t) {
|
2260
|
-
var E,
|
2261
|
-
const { style: o, primaryWithCoord: n, unitId: a, subUnitId: i, worksheet: r, row:
|
2255
|
+
var E, A, x, j;
|
2256
|
+
const { style: o, primaryWithCoord: n, unitId: a, subUnitId: i, worksheet: r, row: s, col: l } = t, c = n.isMergedMainCell ? n.mergeInfo : n, h = ie(r.getCellRaw(s, l)), p = this._dataValidationModel.getRuleByLocation(a, i, s, l);
|
2262
2257
|
if (!p)
|
2263
2258
|
return;
|
2264
2259
|
const d = this._dataValidationModel.getValidator(p.type);
|
2265
2260
|
if (!d)
|
2266
2261
|
return;
|
2267
|
-
const
|
2268
|
-
if (!((E = d.skipDefaultFontRender) != null && E.call(d, p,
|
2262
|
+
const v = this._themeService.getCurrentTheme();
|
2263
|
+
if (!((E = d.skipDefaultFontRender) != null && E.call(d, p, h, { unitId: a, subUnitId: i, row: s, column: l })))
|
2269
2264
|
return;
|
2270
|
-
const m = d.parseFormulaSync(p, a, i), { formula1:
|
2265
|
+
const m = d.parseFormulaSync(p, a, i), { formula1: _ } = m, w = this._calc(c, o), { a: S, d: R } = e.getTransform(), I = yn(w.left, S), V = yn(w.top, R), C = ra.create().composeMatrix({
|
2271
2266
|
left: I,
|
2272
|
-
top:
|
2267
|
+
top: V,
|
2273
2268
|
scaleX: 1,
|
2274
2269
|
scaleY: 1,
|
2275
2270
|
angle: 0,
|
@@ -2277,33 +2272,33 @@ let an = class {
|
|
2277
2272
|
skewY: 0,
|
2278
2273
|
flipX: !1,
|
2279
2274
|
flipY: !1
|
2280
|
-
}),
|
2281
|
-
e.save(), e.beginPath(), e.rect(c.startX, c.startY,
|
2282
|
-
const
|
2283
|
-
e.transform(
|
2284
|
-
const
|
2275
|
+
}), f = c.endX - c.startX, g = c.endY - c.startY;
|
2276
|
+
e.save(), e.beginPath(), e.rect(c.startX, c.startY, f, g), e.clip();
|
2277
|
+
const y = C.getMatrix();
|
2278
|
+
e.transform(y[0], y[1], y[2], y[3], y[4], y[5]);
|
2279
|
+
const L = ((A = o == null ? void 0 : o.fs) != null ? A : 10) * 1.6, U = String(h) === String(_), T = v.hyacinth500;
|
2285
2280
|
sa.drawWith(e, {
|
2286
|
-
checked:
|
2287
|
-
width:
|
2288
|
-
height:
|
2289
|
-
fill: (j = (x = o == null ? void 0 : o.cl) == null ? void 0 : x.rgb) != null ? j :
|
2281
|
+
checked: U,
|
2282
|
+
width: L,
|
2283
|
+
height: L,
|
2284
|
+
fill: (j = (x = o == null ? void 0 : o.cl) == null ? void 0 : x.rgb) != null ? j : T
|
2290
2285
|
}), e.restore();
|
2291
2286
|
}
|
2292
2287
|
isHit(e, t) {
|
2293
|
-
const o = t.primaryWithCoord.isMergedMainCell ? t.primaryWithCoord.mergeInfo : t.primaryWithCoord, n = this._calc(o, t.style), a = n.top, i = n.top + n.height, r = n.left,
|
2294
|
-
return
|
2288
|
+
const o = t.primaryWithCoord.isMergedMainCell ? t.primaryWithCoord.mergeInfo : t.primaryWithCoord, n = this._calc(o, t.style), a = n.top, i = n.top + n.height, r = n.left, s = n.left + n.width, { x: l, y: c } = e;
|
2289
|
+
return l <= s && l >= r && c <= i && c >= a;
|
2295
2290
|
}
|
2296
2291
|
async onPointerDown(e, t) {
|
2297
2292
|
var m;
|
2298
2293
|
if (t.button === 2)
|
2299
2294
|
return;
|
2300
|
-
const { primaryWithCoord: o, unitId: n, subUnitId: a, worksheet: i, row: r, col:
|
2295
|
+
const { primaryWithCoord: o, unitId: n, subUnitId: a, worksheet: i, row: r, col: s } = e, l = ie(i.getCellRaw(r, s)), c = this._dataValidationModel.getRuleByLocation(n, a, r, s);
|
2301
2296
|
if (!c)
|
2302
2297
|
return;
|
2303
|
-
const
|
2304
|
-
if (!
|
2298
|
+
const h = this._dataValidationModel.getValidator(c.type);
|
2299
|
+
if (!h || !((m = h.skipDefaultFontRender) != null && m.call(h, c, l, { unitId: n, subUnitId: a, row: r, column: s })))
|
2305
2300
|
return;
|
2306
|
-
const { formula1: p, formula2: d } = await this._parseFormula(c, n, a),
|
2301
|
+
const { formula1: p, formula2: d } = await this._parseFormula(c, n, a), v = {
|
2307
2302
|
range: {
|
2308
2303
|
startColumn: o.actualColumn,
|
2309
2304
|
endColumn: o.actualColumn,
|
@@ -2311,22 +2306,22 @@ let an = class {
|
|
2311
2306
|
endRow: o.actualRow
|
2312
2307
|
},
|
2313
2308
|
value: {
|
2314
|
-
v: String(
|
2309
|
+
v: String(l) === Ca(String(p)) ? d : p,
|
2315
2310
|
p: null
|
2316
2311
|
}
|
2317
2312
|
};
|
2318
2313
|
this._commandService.executeCommand(
|
2319
2314
|
pn.id,
|
2320
|
-
|
2315
|
+
v
|
2321
2316
|
);
|
2322
2317
|
}
|
2323
2318
|
onPointerEnter(e, t) {
|
2324
2319
|
var o, n;
|
2325
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2320
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.POINTER);
|
2326
2321
|
}
|
2327
2322
|
onPointerLeave(e, t) {
|
2328
2323
|
var o, n;
|
2329
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2324
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.DEFAULT);
|
2330
2325
|
}
|
2331
2326
|
};
|
2332
2327
|
an = Wr([
|
@@ -2395,48 +2390,48 @@ function es(e, t) {
|
|
2395
2390
|
};
|
2396
2391
|
}
|
2397
2392
|
function $t(e, t, o, n) {
|
2398
|
-
const a = Oe + rn * 2, i = o - a, r = n - yt * 2,
|
2393
|
+
const a = Oe + rn * 2, i = o - a, r = n - yt * 2, s = e.map((d) => ({
|
2399
2394
|
layout: es(d, t),
|
2400
2395
|
text: d
|
2401
2396
|
}));
|
2402
|
-
let
|
2397
|
+
let l;
|
2403
2398
|
const c = [];
|
2404
|
-
|
2405
|
-
const { layout:
|
2406
|
-
!
|
2399
|
+
s.forEach((d) => {
|
2400
|
+
const { layout: v } = d, { width: m, height: _ } = v;
|
2401
|
+
!l || l.width + m + Bt > i ? (l = {
|
2407
2402
|
width: m,
|
2408
|
-
height:
|
2403
|
+
height: _,
|
2409
2404
|
items: [{
|
2410
2405
|
...d,
|
2411
2406
|
left: 0
|
2412
2407
|
}]
|
2413
|
-
}, c.push(
|
2408
|
+
}, c.push(l)) : (l.items.push({
|
2414
2409
|
...d,
|
2415
|
-
left:
|
2416
|
-
}),
|
2410
|
+
left: l.width + Bt
|
2411
|
+
}), l.width = l.width + m + Bt);
|
2417
2412
|
});
|
2418
|
-
let
|
2419
|
-
return c.forEach((d,
|
2420
|
-
p = Math.max(p, d.width),
|
2413
|
+
let h = 0, p = 0;
|
2414
|
+
return c.forEach((d, v) => {
|
2415
|
+
p = Math.max(p, d.width), v === c.length - 1 ? h += d.height : h += d.height + Fo;
|
2421
2416
|
}), {
|
2422
2417
|
lines: c,
|
2423
|
-
totalHeight:
|
2418
|
+
totalHeight: h,
|
2424
2419
|
contentWidth: i,
|
2425
2420
|
contentHeight: r,
|
2426
|
-
cellAutoHeight:
|
2421
|
+
cellAutoHeight: h + yt * 2,
|
2427
2422
|
calcAutoWidth: p + a
|
2428
2423
|
};
|
2429
2424
|
}
|
2430
2425
|
const ts = 8;
|
2431
2426
|
class ns extends da {
|
2432
2427
|
static drawWith(t, o) {
|
2433
|
-
const { fontString: n, info: a, fill: i, color: r } = o, { layout:
|
2428
|
+
const { fontString: n, info: a, fill: i, color: r } = o, { layout: s, text: l } = a;
|
2434
2429
|
t.save(), Xn.drawWith(t, {
|
2435
|
-
width:
|
2436
|
-
height:
|
2430
|
+
width: s.width,
|
2431
|
+
height: s.height,
|
2437
2432
|
radius: ts,
|
2438
2433
|
fill: i || Le
|
2439
|
-
}), t.translateWithPrecision(jo,
|
2434
|
+
}), t.translateWithPrecision(jo, s.ba), t.font = n, t.fillStyle = r, t.fillText(l, 0, 0), t.restore();
|
2440
2435
|
}
|
2441
2436
|
}
|
2442
2437
|
var os = Object.defineProperty, as = Object.getOwnPropertyDescriptor, is = (e, t, o, n) => {
|
@@ -2473,87 +2468,87 @@ let sn = class {
|
|
2473
2468
|
}
|
2474
2469
|
// eslint-disable-next-line max-lines-per-function
|
2475
2470
|
drawWith(e, t, o, n) {
|
2476
|
-
var
|
2477
|
-
const { primaryWithCoord: a, row: i, col: r, style:
|
2478
|
-
if (!
|
2471
|
+
var X, k;
|
2472
|
+
const { primaryWithCoord: a, row: i, col: r, style: s, data: l, subUnitId: c } = t, h = a.isMergedMainCell ? a.mergeInfo : a, p = l == null ? void 0 : l.fontRenderExtension, { leftOffset: d = 0, rightOffset: v = 0, topOffset: m = 0, downOffset: _ = 0 } = p || {}, w = this._ensureMap(c), S = this._generateKey(i, r), R = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, i, r);
|
2473
|
+
if (!R)
|
2479
2474
|
return;
|
2480
|
-
const I = this._dataValidationModel.getValidator(
|
2475
|
+
const I = this._dataValidationModel.getValidator(R.type);
|
2481
2476
|
if (!I)
|
2482
2477
|
return;
|
2483
|
-
const
|
2484
|
-
startX:
|
2485
|
-
endX:
|
2486
|
-
startY:
|
2487
|
-
endY:
|
2488
|
-
},
|
2489
|
-
this._drawDownIcon(e,
|
2490
|
-
let
|
2478
|
+
const V = {
|
2479
|
+
startX: h.startX + d,
|
2480
|
+
endX: h.endX - v,
|
2481
|
+
startY: h.startY + m,
|
2482
|
+
endY: h.endY - _
|
2483
|
+
}, C = V.endX - V.startX, f = V.endY - V.startY, { cl: g } = s || {}, y = (X = typeof g == "object" ? g == null ? void 0 : g.rgb : g) != null ? X : "#000", L = At(s != null ? s : void 0), { vt: U, ht: T } = s || {}, E = U != null ? U : ue.MIDDLE, A = (k = ie(l)) != null ? k : "", x = I.parseCellValue(A), j = I.getListWithColorMap(R), F = $t(x, L, C, f);
|
2484
|
+
this._drawDownIcon(e, V, C, f, E), e.save(), e.translateWithPrecision(V.startX, V.startY), e.beginPath(), e.rect(0, 0, C - Oe, f), e.clip(), e.translateWithPrecision(rn, yt);
|
2485
|
+
let H = 0;
|
2491
2486
|
switch (E) {
|
2492
2487
|
case ue.MIDDLE:
|
2493
|
-
|
2488
|
+
H = (F.contentHeight - F.totalHeight) / 2;
|
2494
2489
|
break;
|
2495
2490
|
case ue.BOTTOM:
|
2496
|
-
|
2491
|
+
H = F.contentHeight - F.totalHeight;
|
2497
2492
|
break;
|
2498
2493
|
}
|
2499
|
-
e.translateWithPrecision(0,
|
2494
|
+
e.translateWithPrecision(0, H), F.lines.forEach((z, q) => {
|
2500
2495
|
e.save();
|
2501
|
-
const { width: ee, height: te, items: re } =
|
2496
|
+
const { width: ee, height: te, items: re } = z;
|
2502
2497
|
let ae = 0;
|
2503
|
-
switch (
|
2498
|
+
switch (T) {
|
2504
2499
|
case He.RIGHT:
|
2505
|
-
ae =
|
2500
|
+
ae = F.contentWidth - ee;
|
2506
2501
|
break;
|
2507
2502
|
case He.CENTER:
|
2508
|
-
ae = (
|
2503
|
+
ae = (F.contentWidth - ee) / 2;
|
2509
2504
|
break;
|
2510
2505
|
}
|
2511
2506
|
e.translate(ae, q * (te + Fo)), re.forEach((se) => {
|
2512
2507
|
e.save(), e.translateWithPrecision(se.left, 0), ns.drawWith(e, {
|
2513
|
-
...
|
2508
|
+
...L,
|
2514
2509
|
info: se,
|
2515
|
-
color:
|
2510
|
+
color: y,
|
2516
2511
|
fill: j[se.text]
|
2517
2512
|
}), e.restore();
|
2518
2513
|
}), e.restore();
|
2519
|
-
}), e.restore(),
|
2520
|
-
left:
|
2521
|
-
top:
|
2522
|
-
width:
|
2523
|
-
height:
|
2514
|
+
}), e.restore(), w.set(S, {
|
2515
|
+
left: V.startX,
|
2516
|
+
top: V.startY,
|
2517
|
+
width: F.contentWidth + rn + Oe,
|
2518
|
+
height: F.contentHeight + yt * 2
|
2524
2519
|
});
|
2525
2520
|
}
|
2526
2521
|
calcCellAutoHeight(e) {
|
2527
|
-
var
|
2528
|
-
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset:
|
2529
|
-
startX: p.startX +
|
2530
|
-
endX: p.endX -
|
2522
|
+
var C;
|
2523
|
+
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset: l = 0, topOffset: c = 0, downOffset: h = 0 } = r || {}, p = t.isMergedMainCell ? t.mergeInfo : t, d = {
|
2524
|
+
startX: p.startX + s,
|
2525
|
+
endX: p.endX - l,
|
2531
2526
|
startY: p.startY + c,
|
2532
|
-
endY: p.endY -
|
2533
|
-
},
|
2534
|
-
if (!
|
2527
|
+
endY: p.endY - h
|
2528
|
+
}, v = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i);
|
2529
|
+
if (!v)
|
2535
2530
|
return;
|
2536
|
-
const m = this._dataValidationModel.getValidator(
|
2531
|
+
const m = this._dataValidationModel.getValidator(v.type);
|
2537
2532
|
if (!m)
|
2538
2533
|
return;
|
2539
|
-
const
|
2540
|
-
return $t(
|
2534
|
+
const _ = d.endX - d.startX, w = d.endY - d.startY, S = (C = ie(n)) != null ? C : "", R = m.parseCellValue(S), I = At(o != null ? o : void 0);
|
2535
|
+
return $t(R, I, _, w).cellAutoHeight;
|
2541
2536
|
}
|
2542
2537
|
calcCellAutoWidth(e) {
|
2543
|
-
var
|
2544
|
-
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset:
|
2545
|
-
startX: p.startX +
|
2546
|
-
endX: p.endX -
|
2538
|
+
var C;
|
2539
|
+
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset: l = 0, topOffset: c = 0, downOffset: h = 0 } = r || {}, p = t.isMergedMainCell ? t.mergeInfo : t, d = {
|
2540
|
+
startX: p.startX + s,
|
2541
|
+
endX: p.endX - l,
|
2547
2542
|
startY: p.startY + c,
|
2548
|
-
endY: p.endY -
|
2549
|
-
},
|
2550
|
-
if (!
|
2543
|
+
endY: p.endY - h
|
2544
|
+
}, v = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i);
|
2545
|
+
if (!v)
|
2551
2546
|
return;
|
2552
|
-
const m = this._dataValidationModel.getValidator(
|
2547
|
+
const m = this._dataValidationModel.getValidator(v.type);
|
2553
2548
|
if (!m)
|
2554
2549
|
return;
|
2555
|
-
const
|
2556
|
-
return $t(
|
2550
|
+
const _ = d.endX - d.startX, w = d.endY - d.startY, S = (C = ie(n)) != null ? C : "", R = m.parseCellValue(S), I = At(o != null ? o : void 0);
|
2551
|
+
return $t(R, I, _, w).calcAutoWidth;
|
2557
2552
|
}
|
2558
2553
|
isHit(e, t) {
|
2559
2554
|
const { primaryWithCoord: o } = t, n = o.isMergedMainCell ? o.mergeInfo : o, { endX: a } = n, { x: i } = e;
|
@@ -2572,11 +2567,11 @@ let sn = class {
|
|
2572
2567
|
}
|
2573
2568
|
onPointerEnter(e, t) {
|
2574
2569
|
var o, n;
|
2575
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2570
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.POINTER);
|
2576
2571
|
}
|
2577
2572
|
onPointerLeave(e, t) {
|
2578
2573
|
var o, n;
|
2579
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2574
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.DEFAULT);
|
2580
2575
|
}
|
2581
2576
|
};
|
2582
2577
|
sn = is([
|
@@ -2663,20 +2658,20 @@ function mt(e, t, o) {
|
|
2663
2658
|
};
|
2664
2659
|
}
|
2665
2660
|
function Bn(e, t, o, n, a, i, r = !0) {
|
2666
|
-
let
|
2667
|
-
const
|
2661
|
+
let s = 0;
|
2662
|
+
const l = r ? ke : 0;
|
2668
2663
|
switch (a) {
|
2669
2664
|
case ue.BOTTOM:
|
2670
|
-
|
2665
|
+
s = t - n - l;
|
2671
2666
|
break;
|
2672
2667
|
case ue.MIDDLE:
|
2673
|
-
|
2668
|
+
s = (t - n) / 2;
|
2674
2669
|
break;
|
2675
2670
|
default:
|
2676
|
-
|
2671
|
+
s = l;
|
2677
2672
|
break;
|
2678
2673
|
}
|
2679
|
-
|
2674
|
+
s = Math.max(ke, s);
|
2680
2675
|
let c = 0;
|
2681
2676
|
switch (i) {
|
2682
2677
|
case He.CENTER:
|
@@ -2688,7 +2683,7 @@ function Bn(e, t, o, n, a, i, r = !0) {
|
|
2688
2683
|
}
|
2689
2684
|
return c = Math.max(pe, c), {
|
2690
2685
|
paddingLeft: c,
|
2691
|
-
paddingTop:
|
2686
|
+
paddingTop: s
|
2692
2687
|
};
|
2693
2688
|
}
|
2694
2689
|
let ln = class {
|
@@ -2705,128 +2700,128 @@ let ln = class {
|
|
2705
2700
|
return `${e}.${t}`;
|
2706
2701
|
}
|
2707
2702
|
_drawDownIcon(e, t, o, n, a, i, r) {
|
2708
|
-
const { t:
|
2709
|
-
let
|
2703
|
+
const { t: s = le.pd.t, b: l = le.pd.b } = r, c = o - he;
|
2704
|
+
let h;
|
2710
2705
|
switch (i) {
|
2711
2706
|
case ue.MIDDLE:
|
2712
|
-
|
2707
|
+
h = (n - pt) / 2;
|
2713
2708
|
break;
|
2714
2709
|
case ue.BOTTOM:
|
2715
|
-
|
2710
|
+
h = n - l - a - ke + (a / 2 - pt / 2);
|
2716
2711
|
break;
|
2717
2712
|
default:
|
2718
|
-
|
2713
|
+
h = s + ke + (a / 2 - pt / 2);
|
2719
2714
|
break;
|
2720
2715
|
}
|
2721
|
-
e.save(), e.translateWithPrecision(t.startX + c, t.startY +
|
2716
|
+
e.save(), e.translateWithPrecision(t.startX + c, t.startY + h), e.fillStyle = "#565656", e.fill(Un), e.restore();
|
2722
2717
|
}
|
2723
2718
|
// eslint-disable-next-line max-lines-per-function, complexity
|
2724
2719
|
drawWith(e, t, o) {
|
2725
|
-
const { primaryWithCoord: n, row: a, col: i, style: r, data:
|
2726
|
-
if (!
|
2720
|
+
const { primaryWithCoord: n, row: a, col: i, style: r, data: s, subUnitId: l } = t, c = n.isMergedMainCell ? n.mergeInfo : n, h = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, a, i);
|
2721
|
+
if (!h)
|
2727
2722
|
return;
|
2728
|
-
const p = this._dataValidationModel.getValidator(
|
2723
|
+
const p = this._dataValidationModel.getValidator(h.type);
|
2729
2724
|
if (!p)
|
2730
2725
|
return;
|
2731
|
-
const d =
|
2732
|
-
if (!
|
2726
|
+
const d = s == null ? void 0 : s.fontRenderExtension, { leftOffset: v = 0, rightOffset: m = 0, topOffset: _ = 0, downOffset: w = 0 } = d || {};
|
2727
|
+
if (!h || !p || !p || p.id.indexOf(Z.LIST) !== 0 || !p.skipDefaultFontRender(h))
|
2733
2728
|
return;
|
2734
|
-
const
|
2735
|
-
startX: c.startX +
|
2729
|
+
const S = {
|
2730
|
+
startX: c.startX + v,
|
2736
2731
|
endX: c.endX - m,
|
2737
|
-
startY: c.startY +
|
2738
|
-
endY: c.endY -
|
2739
|
-
},
|
2740
|
-
let { tb:
|
2741
|
-
if (
|
2742
|
-
const { l: x = le.pd.l, t: j = le.pd.t, r:
|
2743
|
-
|
2744
|
-
const ee = Qe(k), { height: te, width: re } = ee, { paddingTop: ae, paddingLeft: se } = Bn(
|
2745
|
-
this._drawDownIcon(e,
|
2746
|
-
left:
|
2747
|
-
top:
|
2732
|
+
startY: c.startY + _,
|
2733
|
+
endY: c.endY - w
|
2734
|
+
}, R = S.endX - S.startX, I = S.endY - S.startY, V = this._ensureMap(l), C = this._generateKey(a, i), f = p.getListWithColor(h), g = ie(s), y = `${g != null ? g : ""}`, L = f.find((x) => x.label === y);
|
2735
|
+
let { tb: U, vt: T, ht: E, pd: A } = r || {};
|
2736
|
+
if (U = U != null ? U : Se.WRAP, T = T != null ? T : ue.BOTTOM, E = E != null ? E : le.ht, A = A != null ? A : le.pd, h.renderMode === de.ARROW) {
|
2737
|
+
const { l: x = le.pd.l, t: j = le.pd.t, r: F = le.pd.r, b: H = le.pd.b } = A, X = R - x - F - he - 4, { documentSkeleton: k, documents: z, docModel: q } = mt(y, this._localeService, r);
|
2738
|
+
U === Se.WRAP && q.updateDocumentDataPageSize(Math.max(X, 1)), k.calculate(), k.getActualSize();
|
2739
|
+
const ee = Qe(k), { height: te, width: re } = ee, { paddingTop: ae, paddingLeft: se } = Bn(X, I - j - H, re, te, T, E, !0);
|
2740
|
+
this._drawDownIcon(e, S, R, I, te, T, A), e.save(), e.translateWithPrecision(S.startX + x, S.startY + j), e.beginPath(), e.rect(0, 0, R - x - F, I - j - H), e.clip(), e.translateWithPrecision(0, ae), e.save(), e.translateWithPrecision(Ee, 0), e.beginPath(), e.rect(0, 0, X, te), e.clip(), z.render(e), e.translateWithPrecision(se, 0), e.restore(), e.restore(), V.set(C, {
|
2741
|
+
left: S.endX + x + o.rowHeaderWidth - he,
|
2742
|
+
top: S.startY + j + o.columnHeaderHeight,
|
2748
2743
|
width: he,
|
2749
|
-
height: I - j -
|
2744
|
+
height: I - j - H
|
2750
2745
|
});
|
2751
2746
|
} else {
|
2752
|
-
e.save(), e.translateWithPrecision(
|
2753
|
-
const x =
|
2754
|
-
|
2755
|
-
const
|
2747
|
+
e.save(), e.translateWithPrecision(S.startX, S.startY), e.beginPath(), e.rect(0, 0, R, I), e.clip();
|
2748
|
+
const x = R - pe * 2 - Ee - he - 4, { documentSkeleton: j, documents: F, docModel: H } = mt(y, this._localeService, r);
|
2749
|
+
U === Se.WRAP && H.updateDocumentDataPageSize(Math.max(x, 1)), j.calculate();
|
2750
|
+
const X = Qe(j), { height: k, width: z } = X, { paddingTop: q, paddingLeft: ee } = Bn(x, I, z, k, T, E);
|
2756
2751
|
e.translateWithPrecision(pe, q);
|
2757
|
-
const te = Math.max(
|
2752
|
+
const te = Math.max(R - pe * 2, 1), re = k;
|
2758
2753
|
Xn.drawWith(e, {
|
2759
2754
|
width: te,
|
2760
2755
|
height: re,
|
2761
|
-
fill: (
|
2756
|
+
fill: (L == null ? void 0 : L.color) || Le,
|
2762
2757
|
radius: Wt
|
2763
|
-
}), e.save(), e.translateWithPrecision(Ee, 0), e.beginPath(), e.rect(0, 0, x, k), e.clip(), e.translateWithPrecision(ee, 0),
|
2764
|
-
left:
|
2765
|
-
top:
|
2758
|
+
}), e.save(), e.translateWithPrecision(Ee, 0), e.beginPath(), e.rect(0, 0, x, k), e.clip(), e.translateWithPrecision(ee, 0), F.render(e), e.restore(), e.translateWithPrecision(x + Ee + 4, (k - pt) / 2), e.fillStyle = us, e.fill(Un), e.restore(), V.set(C, {
|
2759
|
+
left: S.startX + pe + o.rowHeaderWidth,
|
2760
|
+
top: S.startY + q + o.columnHeaderHeight,
|
2766
2761
|
width: te,
|
2767
2762
|
height: re
|
2768
2763
|
});
|
2769
2764
|
}
|
2770
2765
|
}
|
2771
2766
|
calcCellAutoHeight(e) {
|
2772
|
-
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = t.isMergedMainCell ? t.mergeInfo : t,
|
2767
|
+
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = t.isMergedMainCell ? t.mergeInfo : t, s = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: c = 0, topOffset: h = 0, downOffset: p = 0 } = s || {}, d = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i);
|
2773
2768
|
if (!d || d.renderMode === de.TEXT)
|
2774
2769
|
return;
|
2775
|
-
const
|
2776
|
-
startX: r.startX +
|
2770
|
+
const v = {
|
2771
|
+
startX: r.startX + l,
|
2777
2772
|
endX: r.endX - c,
|
2778
|
-
startY: r.startY +
|
2773
|
+
startY: r.startY + h,
|
2779
2774
|
endY: r.endY - p
|
2780
|
-
}, m =
|
2781
|
-
let { tb:
|
2782
|
-
const { t: I = le.pd.t, b:
|
2783
|
-
if (
|
2784
|
-
const
|
2785
|
-
|
2786
|
-
const
|
2787
|
-
return
|
2775
|
+
}, m = v.endX - v.startX, _ = ie(n), w = `${_ != null ? _ : ""}`;
|
2776
|
+
let { tb: S, pd: R } = o || {};
|
2777
|
+
const { t: I = le.pd.t, b: V = le.pd.b } = R != null ? R : {};
|
2778
|
+
if (S = S != null ? S : Se.WRAP, d.renderMode === de.ARROW) {
|
2779
|
+
const C = m - he, { documentSkeleton: f, docModel: g } = mt(w, this._localeService, o);
|
2780
|
+
S === Se.WRAP && g.updateDocumentDataPageSize(Math.max(C, 1)), f.calculate(), f.getActualSize();
|
2781
|
+
const y = Qe(f), { height: L } = y;
|
2782
|
+
return L + I + V + ke * 2;
|
2788
2783
|
} else {
|
2789
|
-
const
|
2790
|
-
|
2791
|
-
const
|
2792
|
-
height:
|
2793
|
-
} =
|
2794
|
-
return
|
2784
|
+
const C = m - pe * 2 - Ee - he, { documentSkeleton: f, docModel: g } = No(w, this._localeService, o);
|
2785
|
+
S === Se.WRAP && g.updateDocumentDataPageSize(Math.max(C, 1)), f.calculate();
|
2786
|
+
const y = Qe(f), {
|
2787
|
+
height: L
|
2788
|
+
} = y;
|
2789
|
+
return L + ke * 2;
|
2795
2790
|
}
|
2796
2791
|
}
|
2797
2792
|
calcCellAutoWidth(e) {
|
2798
|
-
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = t.isMergedMainCell ? t.mergeInfo : t,
|
2793
|
+
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = t.isMergedMainCell ? t.mergeInfo : t, s = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: c = 0, topOffset: h = 0, downOffset: p = 0 } = s || {}, d = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i);
|
2799
2794
|
if (!d || d.renderMode === de.TEXT)
|
2800
2795
|
return;
|
2801
|
-
const
|
2802
|
-
startX: r.startX +
|
2796
|
+
const v = {
|
2797
|
+
startX: r.startX + l,
|
2803
2798
|
endX: r.endX - c,
|
2804
|
-
startY: r.startY +
|
2799
|
+
startY: r.startY + h,
|
2805
2800
|
endY: r.endY - p
|
2806
|
-
}, m =
|
2807
|
-
let { tb:
|
2808
|
-
const { l: I = le.pd.l, r:
|
2809
|
-
|
2810
|
-
let
|
2801
|
+
}, m = v.endX - v.startX, _ = ie(n), w = `${_ != null ? _ : ""}`;
|
2802
|
+
let { tb: S, pd: R } = o || {};
|
2803
|
+
const { l: I = le.pd.l, r: V = le.pd.r } = R != null ? R : {};
|
2804
|
+
S = S != null ? S : Se.WRAP;
|
2805
|
+
let C = pe * 2 + he;
|
2811
2806
|
switch (d.renderMode) {
|
2812
2807
|
case de.ARROW:
|
2813
|
-
|
2808
|
+
C = he + pe * 2 + V + I;
|
2814
2809
|
break;
|
2815
2810
|
case de.CUSTOM:
|
2816
|
-
|
2811
|
+
C = he + pe * 2 + Ee * 2 + V + I + Wt / 2 + 1;
|
2817
2812
|
break;
|
2818
2813
|
default:
|
2819
|
-
|
2814
|
+
C = he + pe * 2 + Ee * 2 + V + I + Wt / 2 + 1;
|
2820
2815
|
}
|
2821
|
-
const
|
2822
|
-
return
|
2816
|
+
const f = m - C, { documentSkeleton: g, docModel: y } = mt(w, this._localeService, o);
|
2817
|
+
return S === Se.WRAP && y.updateDocumentDataPageSize(Math.max(f, 1)), g.calculate(), g.getActualSize(), Qe(g).width + C;
|
2823
2818
|
}
|
2824
2819
|
isHit(e, t) {
|
2825
|
-
const { subUnitId: o, row: n, col: a } = t, r = this._ensureMap(o).get(this._generateKey(n, a)),
|
2826
|
-
if (!
|
2820
|
+
const { subUnitId: o, row: n, col: a } = t, r = this._ensureMap(o).get(this._generateKey(n, a)), s = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, n, a);
|
2821
|
+
if (!s || !r || s.renderMode === de.TEXT)
|
2827
2822
|
return !1;
|
2828
|
-
const { top:
|
2829
|
-
return d >= c && d <= c +
|
2823
|
+
const { top: l, left: c, width: h, height: p } = r, { x: d, y: v } = e;
|
2824
|
+
return d >= c && d <= c + h && v >= l && v <= l + p;
|
2830
2825
|
}
|
2831
2826
|
onPointerDown(e, t) {
|
2832
2827
|
if (t.button === 2)
|
@@ -2841,11 +2836,11 @@ let ln = class {
|
|
2841
2836
|
}
|
2842
2837
|
onPointerEnter(e, t) {
|
2843
2838
|
var o, n;
|
2844
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2839
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.POINTER);
|
2845
2840
|
}
|
2846
2841
|
onPointerLeave(e, t) {
|
2847
2842
|
var o, n;
|
2848
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2843
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.DEFAULT);
|
2849
2844
|
}
|
2850
2845
|
};
|
2851
2846
|
ln = cs([
|
@@ -2964,7 +2959,7 @@ let $n = (ft = class extends Yn {
|
|
2964
2959
|
}
|
2965
2960
|
onReady() {
|
2966
2961
|
this._injector.get(ze), this._injector.get(Ke), this._injector.get(it), this._injector.get(rt), this._injector.get(Ve).registerRenderModule(
|
2967
|
-
|
2962
|
+
Y.UNIVER_SHEET,
|
2968
2963
|
[Rt]
|
2969
2964
|
);
|
2970
2965
|
}
|
@@ -2974,7 +2969,7 @@ let $n = (ft = class extends Yn {
|
|
2974
2969
|
onSteady() {
|
2975
2970
|
this._injector.get(Xe);
|
2976
2971
|
}
|
2977
|
-
}, M(ft, "pluginName", ws), M(ft, "type",
|
2972
|
+
}, M(ft, "pluginName", ws), M(ft, "type", Y.UNIVER_SHEET), ft);
|
2978
2973
|
$n = Is([
|
2979
2974
|
Yt(1, b(Fe)),
|
2980
2975
|
Yt(2, Q),
|
@@ -3018,7 +3013,7 @@ let kn = (gt = class extends Yn {
|
|
3018
3013
|
}
|
3019
3014
|
onReady() {
|
3020
3015
|
this._injector.get(ze), this._injector.get(Ke), this._injector.get(Ve).registerRenderModule(
|
3021
|
-
|
3016
|
+
Y.UNIVER_SHEET,
|
3022
3017
|
[Rt]
|
3023
3018
|
);
|
3024
3019
|
}
|
@@ -3028,7 +3023,7 @@ let kn = (gt = class extends Yn {
|
|
3028
3023
|
onSteady() {
|
3029
3024
|
this._injector.get(Xe);
|
3030
3025
|
}
|
3031
|
-
}, M(gt, "pluginName", ys), M(gt, "type",
|
3026
|
+
}, M(gt, "pluginName", ys), M(gt, "type", Y.UNIVER_SHEET), gt);
|
3032
3027
|
kn = Vs([
|
3033
3028
|
Xt(1, b(Fe)),
|
3034
3029
|
Xt(2, Q),
|