@univerjs/sheets-data-validation-ui 0.5.0-nightly.202411251606 → 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 +716 -718
- package/lib/umd/index.js +2 -2
- package/package.json +13 -13
package/lib/es/index.js
CHANGED
@@ -2,7 +2,7 @@ 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
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
|
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,
|
625
|
+
}, [p, w]), !n)
|
626
626
|
return null;
|
627
|
-
const
|
628
|
-
if (!_)
|
629
|
-
return null;
|
630
|
-
const C = w.getValidator(_.type);
|
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] = W(0), o =
|
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
|
-
}, H = uo((
|
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
881
|
onChange: H,
|
882
|
-
onFocus: () =>
|
883
|
-
isFocus:
|
884
|
-
actions:
|
885
|
-
onVerify: (
|
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,
|
@@ -1167,71 +1167,69 @@ let Xe = class extends De {
|
|
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:
|
1195
|
+
L
|
1196
|
+
), { row: x, col: j } = v(A.startRow, A.startColumn), F = this._sheetDataValidationModel.getRuleIdByLocation(s, l, x, j) || "", H = _t.getPositionRange(
|
1197
1197
|
{
|
1198
|
-
startRow:
|
1199
|
-
startColumn:
|
1200
|
-
endColumn:
|
1201
|
-
endRow:
|
1198
|
+
startRow: T,
|
1199
|
+
startColumn: E,
|
1200
|
+
endColumn: E,
|
1201
|
+
endRow: T
|
1202
1202
|
},
|
1203
|
-
|
1204
|
-
), { row:
|
1205
|
-
|
1203
|
+
U
|
1204
|
+
), { row: X, col: k } = v(H.startRow, H.startColumn);
|
1205
|
+
w.setValue(X, k, F), S.add(F);
|
1206
1206
|
});
|
1207
1207
|
});
|
1208
|
-
const
|
1209
|
-
|
1210
|
-
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);
|
1211
1211
|
return {
|
1212
1212
|
undos: C,
|
1213
|
-
redos:
|
1213
|
+
redos: V
|
1214
1214
|
};
|
1215
|
-
}, o =
|
1216
|
-
Z.CHECKBOX
|
1217
|
-
], n = {
|
1215
|
+
}, o = {
|
1218
1216
|
id: no,
|
1219
|
-
onBeforeFillData: (
|
1220
|
-
const { source:
|
1221
|
-
for (const s of
|
1222
|
-
for (const
|
1223
|
-
const
|
1224
|
-
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) {
|
1225
1223
|
this._autoFillService.setDisableApplyType(et.SERIES, !0);
|
1226
1224
|
return;
|
1227
1225
|
}
|
1228
1226
|
}
|
1229
1227
|
},
|
1230
|
-
onFillData: (a, i
|
1228
|
+
onFillData: (n, a, i) => i === et.COPY || i === et.ONLY_FORMAT || i === et.SERIES ? t(n, i) : e(),
|
1231
1229
|
onAfterFillData: () => {
|
1232
1230
|
}
|
1233
1231
|
};
|
1234
|
-
this.disposeWithMe(this._autoFillService.addHook(
|
1232
|
+
this.disposeWithMe(this._autoFillService.addHook(o));
|
1235
1233
|
}
|
1236
1234
|
};
|
1237
1235
|
Xe = rr([
|
@@ -1255,8 +1253,8 @@ let ze = class extends De {
|
|
1255
1253
|
id: no,
|
1256
1254
|
onBeforeCopy: (t, o, n) => this._collect(t, o, n),
|
1257
1255
|
onPasteCells: (t, o, n, a) => {
|
1258
|
-
const { copyType: i = En.COPY, pasteType: r } = a, { range:
|
1259
|
-
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 });
|
1260
1258
|
}
|
1261
1259
|
});
|
1262
1260
|
}
|
@@ -1267,13 +1265,13 @@ let ze = class extends De {
|
|
1267
1265
|
subUnitId: o,
|
1268
1266
|
matrix: a
|
1269
1267
|
};
|
1270
|
-
const i = this._injector.invoke((
|
1268
|
+
const i = this._injector.invoke((l) => Pa(n, l, t, o));
|
1271
1269
|
if (!i)
|
1272
1270
|
return;
|
1273
|
-
const { rows: r, cols:
|
1274
|
-
r.forEach((
|
1275
|
-
|
1276
|
-
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);
|
1277
1275
|
a.setValue(c, p, d != null ? d : "");
|
1278
1276
|
});
|
1279
1277
|
});
|
@@ -1297,27 +1295,27 @@ let ze = class extends De {
|
|
1297
1295
|
return { redos: [], undos: [] };
|
1298
1296
|
const { unitId: n, subUnitId: a } = this._copyInfo;
|
1299
1297
|
if (o.unitId !== n || a !== o.subUnitId) {
|
1300
|
-
const i = this._sheetDataValidationModel.getRuleObjectMatrix(o.unitId, o.subUnitId).clone(), r = new vt(),
|
1301
|
-
p.forEach(({ startRange:
|
1302
|
-
var
|
1303
|
-
(
|
1304
|
-
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(
|
1305
1303
|
{
|
1306
|
-
startRow:
|
1307
|
-
endRow:
|
1304
|
+
startRow: R,
|
1305
|
+
endRow: R,
|
1308
1306
|
startColumn: I,
|
1309
1307
|
endColumn: I
|
1310
1308
|
},
|
1311
|
-
|
1312
|
-
),
|
1313
|
-
!this._sheetDataValidationModel.getRuleById(o.unitId, o.subUnitId,
|
1314
|
-
const { row:
|
1315
|
-
|
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);
|
1316
1314
|
});
|
1317
1315
|
});
|
1318
|
-
const
|
1319
|
-
i.addRangeRules(
|
1320
|
-
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(
|
1321
1319
|
o.unitId,
|
1322
1320
|
o.subUnitId,
|
1323
1321
|
i.diffWithAddition(this._sheetDataValidationModel.getRules(o.unitId, o.subUnitId), d.values()),
|
@@ -1327,28 +1325,28 @@ let ze = class extends De {
|
|
1327
1325
|
);
|
1328
1326
|
return {
|
1329
1327
|
redos: m,
|
1330
|
-
undos:
|
1328
|
+
undos: _
|
1331
1329
|
};
|
1332
1330
|
} else {
|
1333
|
-
const i = this._sheetDataValidationModel.getRuleObjectMatrix(n, a).clone(), r = new vt(),
|
1334
|
-
On(
|
1335
|
-
var
|
1336
|
-
(
|
1337
|
-
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(
|
1338
1336
|
{
|
1339
|
-
startRow:
|
1340
|
-
endRow:
|
1341
|
-
startColumn:
|
1342
|
-
endColumn:
|
1337
|
+
startRow: S,
|
1338
|
+
endRow: S,
|
1339
|
+
startColumn: R,
|
1340
|
+
endColumn: R
|
1343
1341
|
},
|
1344
|
-
|
1345
|
-
), { row:
|
1346
|
-
r.setValue(
|
1342
|
+
_
|
1343
|
+
), { row: C, col: f } = h(V.startRow, V.startColumn);
|
1344
|
+
r.setValue(C, f, I), s.add(I);
|
1347
1345
|
});
|
1348
1346
|
});
|
1349
|
-
const d = Array.from(
|
1347
|
+
const d = Array.from(s).map((_) => ({ id: _, ranges: Zt(r, (w) => w === _) }));
|
1350
1348
|
i.addRangeRules(d);
|
1351
|
-
const { redoMutations:
|
1349
|
+
const { redoMutations: v, undoMutations: m } = tn(
|
1352
1350
|
n,
|
1353
1351
|
a,
|
1354
1352
|
i.diff(this._sheetDataValidationModel.getRules(n, a)),
|
@@ -1357,7 +1355,7 @@ let ze = class extends De {
|
|
1357
1355
|
!1
|
1358
1356
|
);
|
1359
1357
|
return {
|
1360
|
-
redos:
|
1358
|
+
redos: v,
|
1361
1359
|
undos: m
|
1362
1360
|
};
|
1363
1361
|
}
|
@@ -1405,7 +1403,7 @@ function pr(e) {
|
|
1405
1403
|
type: gn.SUBITEMS,
|
1406
1404
|
icon: Eo,
|
1407
1405
|
tooltip: "dataValidation.title",
|
1408
|
-
hidden$: ja(e,
|
1406
|
+
hidden$: ja(e, Y.UNIVER_SHEET),
|
1409
1407
|
disabled$: Ta(e, { workbookTypes: [St], worksheetTypes: [en, It], rangeTypes: [Ct] })
|
1410
1408
|
};
|
1411
1409
|
}
|
@@ -1451,8 +1449,8 @@ const Lo = {
|
|
1451
1449
|
}
|
1452
1450
|
};
|
1453
1451
|
let Ge = class extends cn {
|
1454
|
-
constructor(e, t, o, n, a, i, r,
|
1455
|
-
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();
|
1456
1454
|
}
|
1457
1455
|
_initMenu() {
|
1458
1456
|
this._menuManagerService.mergeMenu(gr);
|
@@ -1466,17 +1464,17 @@ let Ge = class extends cn {
|
|
1466
1464
|
}
|
1467
1465
|
const t = this._editorBridgeService.getEditCellState();
|
1468
1466
|
if (t) {
|
1469
|
-
const { unitId: n, sheetId: a, row: i, column: r } = t,
|
1470
|
-
if (!l)
|
1471
|
-
return;
|
1472
|
-
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);
|
1473
1468
|
if (!s)
|
1474
1469
|
return;
|
1475
|
-
const
|
1470
|
+
const l = this._sheetDataValidationModel.getRuleByLocation(n, a, i, r);
|
1471
|
+
if (!l)
|
1472
|
+
return;
|
1473
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(l.type);
|
1476
1474
|
if (!(c != null && c.dropdown))
|
1477
1475
|
return;
|
1478
|
-
const
|
1479
|
-
if (!
|
1476
|
+
const h = s.getActiveSheet();
|
1477
|
+
if (!h) return;
|
1480
1478
|
const p = this._dropdownManagerService.activeDropdown, d = p == null ? void 0 : p.location;
|
1481
1479
|
if (d && d.unitId === n && d.subUnitId === a && d.row === i && d.col === r)
|
1482
1480
|
return;
|
@@ -1487,8 +1485,8 @@ let Ge = class extends cn {
|
|
1487
1485
|
subUnitId: a,
|
1488
1486
|
row: i,
|
1489
1487
|
col: r,
|
1490
|
-
workbook:
|
1491
|
-
worksheet:
|
1488
|
+
workbook: s,
|
1489
|
+
worksheet: h
|
1492
1490
|
},
|
1493
1491
|
componentKey: c.dropdown,
|
1494
1492
|
onHide: () => {
|
@@ -1511,24 +1509,24 @@ let Ge = class extends cn {
|
|
1511
1509
|
priority: Zn.DATA_VALIDATION,
|
1512
1510
|
// eslint-disable-next-line max-lines-per-function, complexity
|
1513
1511
|
handler: (e, t, o) => {
|
1514
|
-
var
|
1515
|
-
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);
|
1516
1514
|
if (!c)
|
1517
1515
|
return o(e);
|
1518
|
-
const
|
1519
|
-
if (!
|
1516
|
+
const h = this._sheetDataValidationModel.getRuleById(i, r, c);
|
1517
|
+
if (!h)
|
1520
1518
|
return o(e);
|
1521
|
-
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;
|
1522
1520
|
let m;
|
1523
|
-
const
|
1521
|
+
const _ = {
|
1524
1522
|
get value() {
|
1525
|
-
var
|
1526
|
-
return m !== void 0 || (m = (
|
1523
|
+
var f;
|
1524
|
+
return m !== void 0 || (m = (f = ie(v)) != null ? f : null), m;
|
1527
1525
|
}
|
1528
|
-
},
|
1526
|
+
}, w = {
|
1529
1527
|
get value() {
|
1530
|
-
var
|
1531
|
-
return `${(
|
1528
|
+
var f;
|
1529
|
+
return `${(f = _.value) != null ? f : ""}`;
|
1532
1530
|
}
|
1533
1531
|
};
|
1534
1532
|
return o({
|
@@ -1538,59 +1536,59 @@ let Ge = class extends cn {
|
|
1538
1536
|
...p === at.INVALID ? Lo : null
|
1539
1537
|
},
|
1540
1538
|
customRender: [
|
1541
|
-
...(
|
1539
|
+
...(R = e == null ? void 0 : e.customRender) != null ? R : [],
|
1542
1540
|
...d != null && d.canvasRender ? [d.canvasRender] : []
|
1543
1541
|
],
|
1544
1542
|
fontRenderExtension: {
|
1545
1543
|
...e == null ? void 0 : e.fontRenderExtension,
|
1546
|
-
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))
|
1547
1545
|
},
|
1548
1546
|
interceptorStyle: {
|
1549
1547
|
...e == null ? void 0 : e.interceptorStyle,
|
1550
|
-
...d == null ? void 0 : d.getExtraStyle(
|
1548
|
+
...d == null ? void 0 : d.getExtraStyle(h, w.value, {
|
1551
1549
|
get style() {
|
1552
|
-
const
|
1553
|
-
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) || {};
|
1554
1552
|
}
|
1555
1553
|
}, n, a)
|
1556
1554
|
},
|
1557
1555
|
interceptorAutoHeight: () => {
|
1558
|
-
var
|
1559
|
-
const
|
1560
|
-
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)
|
1561
1559
|
return;
|
1562
|
-
const g =
|
1560
|
+
const g = f.worksheet.getMergedCell(n, a), y = {
|
1563
1561
|
data: e,
|
1564
|
-
style:
|
1565
|
-
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),
|
1566
1564
|
unitId: i,
|
1567
1565
|
subUnitId: r,
|
1568
1566
|
row: n,
|
1569
1567
|
col: a,
|
1570
|
-
workbook:
|
1571
|
-
worksheet:
|
1568
|
+
workbook: s,
|
1569
|
+
worksheet: l
|
1572
1570
|
};
|
1573
|
-
return (x = (
|
1571
|
+
return (x = (A = d == null ? void 0 : d.canvasRender) == null ? void 0 : A.calcCellAutoHeight) == null ? void 0 : x.call(A, y);
|
1574
1572
|
},
|
1575
1573
|
interceptorAutoWidth: () => {
|
1576
|
-
var
|
1577
|
-
const
|
1578
|
-
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)
|
1579
1577
|
return;
|
1580
|
-
const g =
|
1578
|
+
const g = f.worksheet.getMergedCell(n, a), y = {
|
1581
1579
|
data: e,
|
1582
|
-
style:
|
1583
|
-
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),
|
1584
1582
|
unitId: i,
|
1585
1583
|
subUnitId: r,
|
1586
1584
|
row: n,
|
1587
1585
|
col: a,
|
1588
|
-
workbook:
|
1589
|
-
worksheet:
|
1586
|
+
workbook: s,
|
1587
|
+
worksheet: l
|
1590
1588
|
};
|
1591
|
-
return (x = (
|
1589
|
+
return (x = (A = d == null ? void 0 : d.canvasRender) == null ? void 0 : A.calcCellAutoWidth) == null ? void 0 : x.call(A, y);
|
1592
1590
|
},
|
1593
|
-
coverable: ((
|
1591
|
+
coverable: ((C = e == null ? void 0 : e.coverable) != null ? C : !0) && !(h.type === Z.LIST || h.type === Z.LIST_MULTIPLE)
|
1594
1592
|
});
|
1595
1593
|
}
|
1596
1594
|
}
|
@@ -1642,14 +1640,14 @@ let jn = class extends cn {
|
|
1642
1640
|
priority: Zn.DATA_VALIDATION,
|
1643
1641
|
// eslint-disable-next-line complexity
|
1644
1642
|
handler: (e, t, o) => {
|
1645
|
-
var
|
1646
|
-
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);
|
1647
1645
|
if (!c)
|
1648
1646
|
return o(e);
|
1649
|
-
const
|
1650
|
-
if (!
|
1647
|
+
const h = this._sheetDataValidationModel.getRuleById(i, r, c);
|
1648
|
+
if (!h)
|
1651
1649
|
return o(e);
|
1652
|
-
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 : ""}`;
|
1653
1651
|
return o({
|
1654
1652
|
...e,
|
1655
1653
|
markers: {
|
@@ -1657,41 +1655,41 @@ let jn = class extends cn {
|
|
1657
1655
|
...p === at.INVALID ? Lo : null
|
1658
1656
|
},
|
1659
1657
|
customRender: [
|
1660
|
-
...(
|
1658
|
+
...(S = e == null ? void 0 : e.customRender) != null ? S : [],
|
1661
1659
|
...d != null && d.canvasRender ? [d.canvasRender] : []
|
1662
1660
|
],
|
1663
1661
|
fontRenderExtension: {
|
1664
1662
|
...e == null ? void 0 : e.fontRenderExtension,
|
1665
|
-
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))
|
1666
1664
|
},
|
1667
1665
|
interceptorStyle: {
|
1668
1666
|
...e == null ? void 0 : e.interceptorStyle,
|
1669
|
-
...d == null ? void 0 : d.getExtraStyle(
|
1667
|
+
...d == null ? void 0 : d.getExtraStyle(h, _, {
|
1670
1668
|
get style() {
|
1671
|
-
const
|
1672
|
-
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) || {};
|
1673
1671
|
}
|
1674
1672
|
}, n, a)
|
1675
1673
|
},
|
1676
1674
|
interceptorAutoHeight: () => {
|
1677
|
-
var
|
1678
|
-
const
|
1679
|
-
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)
|
1680
1678
|
return;
|
1681
|
-
const
|
1679
|
+
const f = C.worksheet.getMergedCell(n, a), g = {
|
1682
1680
|
data: e,
|
1683
|
-
style:
|
1684
|
-
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),
|
1685
1683
|
unitId: i,
|
1686
1684
|
subUnitId: r,
|
1687
1685
|
row: n,
|
1688
1686
|
col: a,
|
1689
|
-
workbook:
|
1690
|
-
worksheet:
|
1687
|
+
workbook: s,
|
1688
|
+
worksheet: l
|
1691
1689
|
};
|
1692
|
-
return (
|
1690
|
+
return (A = (E = d == null ? void 0 : d.canvasRender) == null ? void 0 : E.calcCellAutoHeight) == null ? void 0 : A.call(E, g);
|
1693
1691
|
},
|
1694
|
-
coverable: ((
|
1692
|
+
coverable: ((V = e == null ? void 0 : e.coverable) != null ? V : !0) && !(h.type === Z.LIST || h.type === Z.LIST_MULTIPLE)
|
1695
1693
|
});
|
1696
1694
|
}
|
1697
1695
|
}
|
@@ -1763,9 +1761,9 @@ const wr = "univer-data-validation-formula", Rr = "univer-data-validation-formul
|
|
1763
1761
|
dataValidationFormulaColorSelectPanel: Er,
|
1764
1762
|
dataValidationFormulaColorItem: Or
|
1765
1763
|
}, Pr = (e) => {
|
1766
|
-
const { isTwoFormula: t = !1, value: o, onChange: n, showError: a, validResult: i } = e, r =
|
1767
|
-
return t ? /* @__PURE__ */
|
1768
|
-
/* @__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(
|
1769
1767
|
xe,
|
1770
1768
|
{
|
1771
1769
|
className: ne.dataValidationFormula,
|
@@ -1779,8 +1777,8 @@ const wr = "univer-data-validation-formula", Rr = "univer-data-validation-formul
|
|
1779
1777
|
}
|
1780
1778
|
}
|
1781
1779
|
) }),
|
1782
|
-
/* @__PURE__ */
|
1783
|
-
/* @__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(
|
1784
1782
|
xe,
|
1785
1783
|
{
|
1786
1784
|
className: ne.dataValidationFormula,
|
@@ -1794,7 +1792,7 @@ const wr = "univer-data-validation-formula", Rr = "univer-data-validation-formul
|
|
1794
1792
|
}
|
1795
1793
|
}
|
1796
1794
|
) })
|
1797
|
-
] }) : /* @__PURE__ */
|
1795
|
+
] }) : /* @__PURE__ */ u.jsx(G, { error: s, children: /* @__PURE__ */ u.jsx(
|
1798
1796
|
xe,
|
1799
1797
|
{
|
1800
1798
|
className: ne.dataValidationFormula,
|
@@ -1807,14 +1805,14 @@ const wr = "univer-data-validation-formula", Rr = "univer-data-validation-formul
|
|
1807
1805
|
) });
|
1808
1806
|
};
|
1809
1807
|
function Lr(e) {
|
1810
|
-
const { value: t, onChange: o, showError: n, validResult: a } = e, i =
|
1811
|
-
return /* @__PURE__ */
|
1812
|
-
/* @__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(
|
1813
1811
|
Mt,
|
1814
1812
|
{
|
1815
|
-
checked:
|
1816
|
-
onChange: (
|
1817
|
-
|
1813
|
+
checked: l,
|
1814
|
+
onChange: (h) => {
|
1815
|
+
h ? c(!0) : (c(!1), o == null || o({
|
1818
1816
|
...t,
|
1819
1817
|
formula1: void 0,
|
1820
1818
|
formula2: void 0
|
@@ -1823,30 +1821,30 @@ function Lr(e) {
|
|
1823
1821
|
children: i.t("dataValidation.checkbox.tips")
|
1824
1822
|
}
|
1825
1823
|
) }),
|
1826
|
-
|
1824
|
+
l ? /* @__PURE__ */ u.jsx(G, { label: i.t("dataValidation.checkbox.checked"), error: r, children: /* @__PURE__ */ u.jsx(
|
1827
1825
|
xe,
|
1828
1826
|
{
|
1829
1827
|
className: ne.dataValidationFormula,
|
1830
1828
|
placeholder: i.t("dataValidation.panel.valuePlaceholder"),
|
1831
1829
|
value: t == null ? void 0 : t.formula1,
|
1832
|
-
onChange: (
|
1830
|
+
onChange: (h) => {
|
1833
1831
|
o == null || o({
|
1834
1832
|
...t,
|
1835
|
-
formula1:
|
1833
|
+
formula1: h || void 0
|
1836
1834
|
});
|
1837
1835
|
}
|
1838
1836
|
}
|
1839
1837
|
) }) : null,
|
1840
|
-
|
1838
|
+
l ? /* @__PURE__ */ u.jsx(G, { label: i.t("dataValidation.checkbox.unchecked"), error: s, children: /* @__PURE__ */ u.jsx(
|
1841
1839
|
xe,
|
1842
1840
|
{
|
1843
1841
|
className: ne.dataValidationFormula,
|
1844
1842
|
placeholder: i.t("dataValidation.panel.valuePlaceholder"),
|
1845
1843
|
value: t == null ? void 0 : t.formula2,
|
1846
|
-
onChange: (
|
1844
|
+
onChange: (h) => {
|
1847
1845
|
o == null || o({
|
1848
1846
|
...t,
|
1849
|
-
formula2:
|
1847
|
+
formula2: h || void 0
|
1850
1848
|
});
|
1851
1849
|
}
|
1852
1850
|
}
|
@@ -1855,12 +1853,12 @@ function Lr(e) {
|
|
1855
1853
|
}
|
1856
1854
|
function Tr(e) {
|
1857
1855
|
var p;
|
1858
|
-
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);
|
1859
1857
|
return fn((d) => {
|
1860
1858
|
var m;
|
1861
|
-
const
|
1862
|
-
|
1863
|
-
}), /* @__PURE__ */
|
1859
|
+
const v = (m = l.current) == null ? void 0 : m.handleOutClick;
|
1860
|
+
v && v(d, () => h(!1));
|
1861
|
+
}), /* @__PURE__ */ u.jsx(
|
1864
1862
|
mo,
|
1865
1863
|
{
|
1866
1864
|
initValue: (p = n == null ? void 0 : n.formula1) != null ? p : "",
|
@@ -1868,15 +1866,15 @@ function Tr(e) {
|
|
1868
1866
|
subUnitId: o,
|
1869
1867
|
isFocus: c,
|
1870
1868
|
onChange: (d) => {
|
1871
|
-
const
|
1872
|
-
|
1869
|
+
const v = (d != null ? d : "").trim();
|
1870
|
+
v !== (n == null ? void 0 : n.formula1) && (a == null || a({
|
1873
1871
|
...n,
|
1874
|
-
formula1:
|
1872
|
+
formula1: v
|
1875
1873
|
}));
|
1876
1874
|
},
|
1877
|
-
errorText:
|
1878
|
-
onFocus: () =>
|
1879
|
-
actions:
|
1875
|
+
errorText: s,
|
1876
|
+
onFocus: () => h(!0),
|
1877
|
+
actions: l.current,
|
1880
1878
|
isSupportAcrossSheet: !0
|
1881
1879
|
}
|
1882
1880
|
);
|
@@ -1921,7 +1919,7 @@ const xr = [
|
|
1921
1919
|
"#F248A6"
|
1922
1920
|
], jr = (e) => {
|
1923
1921
|
const { value: t, onChange: o, disabled: n } = e, [a, i] = W(!1);
|
1924
|
-
return /* @__PURE__ */
|
1922
|
+
return /* @__PURE__ */ u.jsx(
|
1925
1923
|
Jt,
|
1926
1924
|
{
|
1927
1925
|
disabled: n,
|
@@ -1932,15 +1930,15 @@ const xr = [
|
|
1932
1930
|
className: ne.dataValidationFormulaColorSelect,
|
1933
1931
|
value: t,
|
1934
1932
|
onChange: o,
|
1935
|
-
labelRender: (r) => /* @__PURE__ */
|
1933
|
+
labelRender: (r) => /* @__PURE__ */ u.jsx(
|
1936
1934
|
"div",
|
1937
1935
|
{
|
1938
1936
|
className: ne.dataValidationFormulaColorItem,
|
1939
1937
|
style: { background: r.value, marginTop: 5 }
|
1940
1938
|
}
|
1941
1939
|
),
|
1942
|
-
dropdownRender: () => /* @__PURE__ */
|
1943
|
-
(r) => /* @__PURE__ */
|
1940
|
+
dropdownRender: () => /* @__PURE__ */ u.jsx("div", { className: ne.dataValidationFormulaColorSelectPanel, children: xr.map(
|
1941
|
+
(r) => /* @__PURE__ */ u.jsx(
|
1944
1942
|
"div",
|
1945
1943
|
{
|
1946
1944
|
onClick: () => {
|
@@ -1956,9 +1954,9 @@ const xr = [
|
|
1956
1954
|
);
|
1957
1955
|
}, Nn = (e) => {
|
1958
1956
|
const { item: t, commonProps: o, style: n } = e, { onItemChange: a, onItemDelete: i } = o;
|
1959
|
-
return /* @__PURE__ */
|
1960
|
-
t.isRef ? null : /* @__PURE__ */
|
1961
|
-
/* @__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(
|
1962
1960
|
jr,
|
1963
1961
|
{
|
1964
1962
|
value: t.color,
|
@@ -1967,7 +1965,7 @@ const xr = [
|
|
1967
1965
|
}
|
1968
1966
|
}
|
1969
1967
|
),
|
1970
|
-
/* @__PURE__ */
|
1968
|
+
/* @__PURE__ */ u.jsx(
|
1971
1969
|
xe,
|
1972
1970
|
{
|
1973
1971
|
disabled: t.isRef,
|
@@ -1977,54 +1975,54 @@ const xr = [
|
|
1977
1975
|
}
|
1978
1976
|
}
|
1979
1977
|
),
|
1980
|
-
t.isRef ? null : /* @__PURE__ */
|
1978
|
+
t.isRef ? null : /* @__PURE__ */ u.jsx("div", { className: ne.dataValidationFormulaListItemIcon, children: /* @__PURE__ */ u.jsx(Sn, { onClick: () => i(t.id) }) })
|
1981
1979
|
] });
|
1982
1980
|
};
|
1983
1981
|
function Fr(e) {
|
1984
1982
|
const { value: t, onChange: o = () => {
|
1985
|
-
}, 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);
|
1986
1984
|
Ce(() => {
|
1987
1985
|
(async () => {
|
1988
1986
|
await new Promise((B) => {
|
1989
1987
|
setTimeout(() => B(!0), 100);
|
1990
1988
|
});
|
1991
|
-
const D = I.getRuleById(n, a,
|
1992
|
-
if (Pe(
|
1989
|
+
const D = I.getRuleById(n, a, s), N = D == null ? void 0 : D.formula1;
|
1990
|
+
if (Pe(N) && g && D) {
|
1993
1991
|
const B = await g.getListAsync(D, n, a);
|
1994
|
-
|
1992
|
+
L(B);
|
1995
1993
|
}
|
1996
1994
|
})();
|
1997
|
-
}, [I, x, g,
|
1998
|
-
Pe(
|
1999
|
-
}, [
|
2000
|
-
const [
|
2001
|
-
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(",");
|
2002
2000
|
return D.map((B, $) => ({
|
2003
2001
|
label: B,
|
2004
|
-
color:
|
2002
|
+
color: N[$] || Le,
|
2005
2003
|
isRef: !1,
|
2006
2004
|
id: qt.generateRandomId(4)
|
2007
2005
|
}));
|
2008
|
-
}),
|
2009
|
-
const $ =
|
2010
|
-
$ && ($.label =
|
2006
|
+
}), X = (D, N, B) => {
|
2007
|
+
const $ = F.find((_e) => _e.id === D);
|
2008
|
+
$ && ($.label = N, $.color = B, H([...F]));
|
2011
2009
|
}, k = (D) => {
|
2012
|
-
const
|
2013
|
-
|
2014
|
-
},
|
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) => ({
|
2015
2013
|
label: D,
|
2016
|
-
color:
|
2017
|
-
id: `${
|
2014
|
+
color: z[N] || Le,
|
2015
|
+
id: `${N}`,
|
2018
2016
|
isRef: !0
|
2019
|
-
})), [
|
2020
|
-
const $ = [...
|
2021
|
-
$[+D] = B,
|
2022
|
-
formula1:
|
2017
|
+
})), [z, y]), ee = (D, N, B) => {
|
2018
|
+
const $ = [...C];
|
2019
|
+
$[+D] = B, f($), j({
|
2020
|
+
formula1: l,
|
2023
2021
|
formula2: $.join(",")
|
2024
2022
|
});
|
2025
2023
|
}, te = () => {
|
2026
2024
|
H([
|
2027
|
-
...
|
2025
|
+
...F,
|
2028
2026
|
{
|
2029
2027
|
label: "",
|
2030
2028
|
color: Le,
|
@@ -2036,22 +2034,22 @@ function Fr(e) {
|
|
2036
2034
|
Ce(() => {
|
2037
2035
|
if (p === "1")
|
2038
2036
|
return;
|
2039
|
-
const D = /* @__PURE__ */ new Set(),
|
2040
|
-
|
2037
|
+
const D = /* @__PURE__ */ new Set(), N = [];
|
2038
|
+
F.map((B) => ({
|
2041
2039
|
labelList: B.label.split(","),
|
2042
2040
|
item: B
|
2043
2041
|
})).forEach(({ item: B, labelList: $ }) => {
|
2044
2042
|
$.forEach((_e) => {
|
2045
|
-
D.has(_e) || (D.add(_e),
|
2043
|
+
D.has(_e) || (D.add(_e), N.push({
|
2046
2044
|
label: _e,
|
2047
2045
|
color: B.color
|
2048
2046
|
}));
|
2049
2047
|
});
|
2050
2048
|
}), j({
|
2051
|
-
formula1: Jn(
|
2052
|
-
formula2:
|
2049
|
+
formula1: Jn(N.map((B) => B.label)),
|
2050
|
+
formula2: N.map((B) => B.color === Le ? "" : B.color).join(",")
|
2053
2051
|
});
|
2054
|
-
}, [
|
2052
|
+
}, [F, j, p, _, C]);
|
2055
2053
|
const re = Te(
|
2056
2054
|
() => async (D) => {
|
2057
2055
|
if (!Pe(D)) {
|
@@ -2061,71 +2059,71 @@ function Fr(e) {
|
|
2061
2059
|
});
|
2062
2060
|
return;
|
2063
2061
|
}
|
2064
|
-
|
2062
|
+
V.getFormulaRefCheck(D) ? (j == null || j({
|
2065
2063
|
formula1: Pe(D) ? D : "",
|
2066
2064
|
formula2: c
|
2067
|
-
}),
|
2065
|
+
}), T("")) : (j == null || j({
|
2068
2066
|
formula1: "",
|
2069
2067
|
formula2: c
|
2070
|
-
}), m("="),
|
2068
|
+
}), m("="), T(S.t("dataValidation.validFail.formulaError")));
|
2071
2069
|
},
|
2072
2070
|
[c, j]
|
2073
|
-
), ae = We({}), [se,
|
2071
|
+
), ae = We({}), [se, O] = W(!1);
|
2074
2072
|
return fn((D) => {
|
2075
2073
|
var B;
|
2076
|
-
const
|
2077
|
-
|
2078
|
-
}), /* @__PURE__ */
|
2079
|
-
/* @__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(
|
2080
2078
|
un,
|
2081
2079
|
{
|
2082
2080
|
value: p,
|
2083
2081
|
onChange: (D) => {
|
2084
|
-
d(D), m(
|
2085
|
-
formula1:
|
2086
|
-
formula2:
|
2082
|
+
d(D), m(_), D === "1" && j({
|
2083
|
+
formula1: _ === "=" ? "" : _,
|
2084
|
+
formula2: C.join(",")
|
2087
2085
|
});
|
2088
2086
|
},
|
2089
2087
|
children: [
|
2090
|
-
/* @__PURE__ */
|
2091
|
-
/* @__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") })
|
2092
2090
|
]
|
2093
2091
|
}
|
2094
2092
|
) }),
|
2095
|
-
p === "1" ? /* @__PURE__ */
|
2096
|
-
/* @__PURE__ */
|
2093
|
+
p === "1" ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
2094
|
+
/* @__PURE__ */ u.jsx(
|
2097
2095
|
mo,
|
2098
2096
|
{
|
2099
|
-
initValue:
|
2097
|
+
initValue: v,
|
2100
2098
|
unitId: n,
|
2101
2099
|
subUnitId: a,
|
2102
2100
|
isFocus: se,
|
2103
2101
|
onChange: (D = "") => {
|
2104
|
-
const
|
2105
|
-
|
2102
|
+
const N = (D != null ? D : "").trim();
|
2103
|
+
w(N), re(N);
|
2106
2104
|
},
|
2107
|
-
errorText: E ||
|
2108
|
-
onFocus: () =>
|
2105
|
+
errorText: E || U || void 0,
|
2106
|
+
onFocus: () => O(!0),
|
2109
2107
|
actions: ae.current,
|
2110
2108
|
isSupportAcrossSheet: !0
|
2111
2109
|
}
|
2112
2110
|
),
|
2113
|
-
/* @__PURE__ */
|
2114
|
-
] }) : /* @__PURE__ */
|
2115
|
-
/* @__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(
|
2116
2114
|
ia,
|
2117
2115
|
{
|
2118
|
-
list:
|
2116
|
+
list: F,
|
2119
2117
|
onListChange: H,
|
2120
2118
|
rowHeight: 32,
|
2121
2119
|
margin: [0, 12],
|
2122
2120
|
draggableHandle: ".draggableHandle",
|
2123
|
-
itemRender: (D) => /* @__PURE__ */
|
2121
|
+
itemRender: (D) => /* @__PURE__ */ u.jsx(
|
2124
2122
|
Nn,
|
2125
2123
|
{
|
2126
2124
|
item: D,
|
2127
2125
|
commonProps: {
|
2128
|
-
onItemChange:
|
2126
|
+
onItemChange: X,
|
2129
2127
|
onItemDelete: k
|
2130
2128
|
}
|
2131
2129
|
},
|
@@ -2134,9 +2132,9 @@ function Fr(e) {
|
|
2134
2132
|
idKey: "id"
|
2135
2133
|
}
|
2136
2134
|
),
|
2137
|
-
/* @__PURE__ */
|
2138
|
-
/* @__PURE__ */
|
2139
|
-
|
2135
|
+
/* @__PURE__ */ u.jsxs("a", { className: ne.dataValidationFormulaListAdd, onClick: te, children: [
|
2136
|
+
/* @__PURE__ */ u.jsx(Co, {}),
|
2137
|
+
S.t("dataValidation.list.add")
|
2140
2138
|
] })
|
2141
2139
|
] }) })
|
2142
2140
|
] });
|
@@ -2161,19 +2159,19 @@ const Ao = "data-validation.custom-formula-input", Tt = "data-validation.formula
|
|
2161
2159
|
], Ur = "LIST_RENDER_MODE_OPTION_INPUT";
|
2162
2160
|
function Dt(e) {
|
2163
2161
|
var a;
|
2164
|
-
const { value: t, onChange: o } = e, n =
|
2165
|
-
return /* @__PURE__ */
|
2166
|
-
/* @__PURE__ */
|
2167
|
-
/* @__PURE__ */
|
2168
|
-
/* @__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") })
|
2169
2167
|
] }) });
|
2170
2168
|
}
|
2171
2169
|
Dt.componentKey = Ur;
|
2172
2170
|
const Br = "DATE_SHOW_TIME_OPTION";
|
2173
2171
|
function Vt(e) {
|
2174
2172
|
var a;
|
2175
|
-
const { value: t, onChange: o } = e, n =
|
2176
|
-
return /* @__PURE__ */
|
2173
|
+
const { value: t, onChange: o } = e, n = P(J);
|
2174
|
+
return /* @__PURE__ */ u.jsx(G, { children: /* @__PURE__ */ u.jsx(
|
2177
2175
|
Mt,
|
2178
2176
|
{
|
2179
2177
|
checked: (a = t.bizInfo) == null ? void 0 : a.showTime,
|
@@ -2202,35 +2200,35 @@ let an = class {
|
|
2202
2200
|
this._commandService = e, this._formulaService = t, this._themeService = o, this._renderManagerService = n, this._dataValidationModel = a;
|
2203
2201
|
}
|
2204
2202
|
_calc(e, t) {
|
2205
|
-
var c,
|
2203
|
+
var c, h, p;
|
2206
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;
|
2207
|
-
let
|
2205
|
+
let s = 0, l = 0;
|
2208
2206
|
switch (o) {
|
2209
2207
|
case ue.TOP:
|
2210
|
-
|
2208
|
+
l = 0;
|
2211
2209
|
break;
|
2212
2210
|
case ue.BOTTOM:
|
2213
|
-
|
2211
|
+
l = 0 + (i - r);
|
2214
2212
|
break;
|
2215
2213
|
default:
|
2216
|
-
|
2214
|
+
l = 0 + (i - r) / 2;
|
2217
2215
|
break;
|
2218
2216
|
}
|
2219
2217
|
switch (n) {
|
2220
2218
|
case He.LEFT:
|
2221
|
-
|
2219
|
+
s = ut;
|
2222
2220
|
break;
|
2223
2221
|
case He.RIGHT:
|
2224
|
-
|
2222
|
+
s = ut + (a - r);
|
2225
2223
|
break;
|
2226
2224
|
default:
|
2227
|
-
|
2225
|
+
s = ut + (a - r) / 2;
|
2228
2226
|
break;
|
2229
2227
|
}
|
2230
2228
|
return {
|
2231
|
-
left: e.startX +
|
2232
|
-
top: e.startY +
|
2233
|
-
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,
|
2234
2232
|
height: ((p = t == null ? void 0 : t.fs) != null ? p : 10) * 1.6
|
2235
2233
|
};
|
2236
2234
|
}
|
@@ -2245,28 +2243,28 @@ let an = class {
|
|
2245
2243
|
return ((o = t == null ? void 0 : t.fs) != null ? o : 10) * 1.6;
|
2246
2244
|
}
|
2247
2245
|
async _parseFormula(e, t, o) {
|
2248
|
-
var c,
|
2249
|
-
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));
|
2250
2248
|
return {
|
2251
|
-
formula1: Pe(n) ? xt((
|
2252
|
-
formula2: Pe(a) ?
|
2253
|
-
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
|
2254
2252
|
};
|
2255
2253
|
}
|
2256
2254
|
drawWith(e, t) {
|
2257
|
-
var E,
|
2258
|
-
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);
|
2259
2257
|
if (!p)
|
2260
2258
|
return;
|
2261
2259
|
const d = this._dataValidationModel.getValidator(p.type);
|
2262
2260
|
if (!d)
|
2263
2261
|
return;
|
2264
|
-
const
|
2265
|
-
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 })))
|
2266
2264
|
return;
|
2267
|
-
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({
|
2268
2266
|
left: I,
|
2269
|
-
top:
|
2267
|
+
top: V,
|
2270
2268
|
scaleX: 1,
|
2271
2269
|
scaleY: 1,
|
2272
2270
|
angle: 0,
|
@@ -2274,33 +2272,33 @@ let an = class {
|
|
2274
2272
|
skewY: 0,
|
2275
2273
|
flipX: !1,
|
2276
2274
|
flipY: !1
|
2277
|
-
}),
|
2278
|
-
e.save(), e.beginPath(), e.rect(c.startX, c.startY,
|
2279
|
-
const
|
2280
|
-
e.transform(
|
2281
|
-
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;
|
2282
2280
|
sa.drawWith(e, {
|
2283
|
-
checked:
|
2284
|
-
width:
|
2285
|
-
height:
|
2286
|
-
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
|
2287
2285
|
}), e.restore();
|
2288
2286
|
}
|
2289
2287
|
isHit(e, t) {
|
2290
|
-
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,
|
2291
|
-
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;
|
2292
2290
|
}
|
2293
2291
|
async onPointerDown(e, t) {
|
2294
2292
|
var m;
|
2295
2293
|
if (t.button === 2)
|
2296
2294
|
return;
|
2297
|
-
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);
|
2298
2296
|
if (!c)
|
2299
2297
|
return;
|
2300
|
-
const
|
2301
|
-
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 })))
|
2302
2300
|
return;
|
2303
|
-
const { formula1: p, formula2: d } = await this._parseFormula(c, n, a),
|
2301
|
+
const { formula1: p, formula2: d } = await this._parseFormula(c, n, a), v = {
|
2304
2302
|
range: {
|
2305
2303
|
startColumn: o.actualColumn,
|
2306
2304
|
endColumn: o.actualColumn,
|
@@ -2308,22 +2306,22 @@ let an = class {
|
|
2308
2306
|
endRow: o.actualRow
|
2309
2307
|
},
|
2310
2308
|
value: {
|
2311
|
-
v: String(
|
2309
|
+
v: String(l) === Ca(String(p)) ? d : p,
|
2312
2310
|
p: null
|
2313
2311
|
}
|
2314
2312
|
};
|
2315
2313
|
this._commandService.executeCommand(
|
2316
2314
|
pn.id,
|
2317
|
-
|
2315
|
+
v
|
2318
2316
|
);
|
2319
2317
|
}
|
2320
2318
|
onPointerEnter(e, t) {
|
2321
2319
|
var o, n;
|
2322
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2320
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.POINTER);
|
2323
2321
|
}
|
2324
2322
|
onPointerLeave(e, t) {
|
2325
2323
|
var o, n;
|
2326
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2324
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.DEFAULT);
|
2327
2325
|
}
|
2328
2326
|
};
|
2329
2327
|
an = Wr([
|
@@ -2392,48 +2390,48 @@ function es(e, t) {
|
|
2392
2390
|
};
|
2393
2391
|
}
|
2394
2392
|
function $t(e, t, o, n) {
|
2395
|
-
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) => ({
|
2396
2394
|
layout: es(d, t),
|
2397
2395
|
text: d
|
2398
2396
|
}));
|
2399
|
-
let
|
2397
|
+
let l;
|
2400
2398
|
const c = [];
|
2401
|
-
|
2402
|
-
const { layout:
|
2403
|
-
!
|
2399
|
+
s.forEach((d) => {
|
2400
|
+
const { layout: v } = d, { width: m, height: _ } = v;
|
2401
|
+
!l || l.width + m + Bt > i ? (l = {
|
2404
2402
|
width: m,
|
2405
|
-
height:
|
2403
|
+
height: _,
|
2406
2404
|
items: [{
|
2407
2405
|
...d,
|
2408
2406
|
left: 0
|
2409
2407
|
}]
|
2410
|
-
}, c.push(
|
2408
|
+
}, c.push(l)) : (l.items.push({
|
2411
2409
|
...d,
|
2412
|
-
left:
|
2413
|
-
}),
|
2410
|
+
left: l.width + Bt
|
2411
|
+
}), l.width = l.width + m + Bt);
|
2414
2412
|
});
|
2415
|
-
let
|
2416
|
-
return c.forEach((d,
|
2417
|
-
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;
|
2418
2416
|
}), {
|
2419
2417
|
lines: c,
|
2420
|
-
totalHeight:
|
2418
|
+
totalHeight: h,
|
2421
2419
|
contentWidth: i,
|
2422
2420
|
contentHeight: r,
|
2423
|
-
cellAutoHeight:
|
2421
|
+
cellAutoHeight: h + yt * 2,
|
2424
2422
|
calcAutoWidth: p + a
|
2425
2423
|
};
|
2426
2424
|
}
|
2427
2425
|
const ts = 8;
|
2428
2426
|
class ns extends da {
|
2429
2427
|
static drawWith(t, o) {
|
2430
|
-
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;
|
2431
2429
|
t.save(), Xn.drawWith(t, {
|
2432
|
-
width:
|
2433
|
-
height:
|
2430
|
+
width: s.width,
|
2431
|
+
height: s.height,
|
2434
2432
|
radius: ts,
|
2435
2433
|
fill: i || Le
|
2436
|
-
}), t.translateWithPrecision(jo,
|
2434
|
+
}), t.translateWithPrecision(jo, s.ba), t.font = n, t.fillStyle = r, t.fillText(l, 0, 0), t.restore();
|
2437
2435
|
}
|
2438
2436
|
}
|
2439
2437
|
var os = Object.defineProperty, as = Object.getOwnPropertyDescriptor, is = (e, t, o, n) => {
|
@@ -2470,87 +2468,87 @@ let sn = class {
|
|
2470
2468
|
}
|
2471
2469
|
// eslint-disable-next-line max-lines-per-function
|
2472
2470
|
drawWith(e, t, o, n) {
|
2473
|
-
var
|
2474
|
-
const { primaryWithCoord: a, row: i, col: r, style:
|
2475
|
-
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)
|
2476
2474
|
return;
|
2477
|
-
const I = this._dataValidationModel.getValidator(
|
2475
|
+
const I = this._dataValidationModel.getValidator(R.type);
|
2478
2476
|
if (!I)
|
2479
2477
|
return;
|
2480
|
-
const
|
2481
|
-
startX:
|
2482
|
-
endX:
|
2483
|
-
startY:
|
2484
|
-
endY:
|
2485
|
-
},
|
2486
|
-
this._drawDownIcon(e,
|
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);
|
2487
2485
|
let H = 0;
|
2488
2486
|
switch (E) {
|
2489
2487
|
case ue.MIDDLE:
|
2490
|
-
H = (
|
2488
|
+
H = (F.contentHeight - F.totalHeight) / 2;
|
2491
2489
|
break;
|
2492
2490
|
case ue.BOTTOM:
|
2493
|
-
H =
|
2491
|
+
H = F.contentHeight - F.totalHeight;
|
2494
2492
|
break;
|
2495
2493
|
}
|
2496
|
-
e.translateWithPrecision(0, H),
|
2494
|
+
e.translateWithPrecision(0, H), F.lines.forEach((z, q) => {
|
2497
2495
|
e.save();
|
2498
|
-
const { width: ee, height: te, items: re } =
|
2496
|
+
const { width: ee, height: te, items: re } = z;
|
2499
2497
|
let ae = 0;
|
2500
|
-
switch (
|
2498
|
+
switch (T) {
|
2501
2499
|
case He.RIGHT:
|
2502
|
-
ae =
|
2500
|
+
ae = F.contentWidth - ee;
|
2503
2501
|
break;
|
2504
2502
|
case He.CENTER:
|
2505
|
-
ae = (
|
2503
|
+
ae = (F.contentWidth - ee) / 2;
|
2506
2504
|
break;
|
2507
2505
|
}
|
2508
2506
|
e.translate(ae, q * (te + Fo)), re.forEach((se) => {
|
2509
2507
|
e.save(), e.translateWithPrecision(se.left, 0), ns.drawWith(e, {
|
2510
|
-
...
|
2508
|
+
...L,
|
2511
2509
|
info: se,
|
2512
|
-
color:
|
2510
|
+
color: y,
|
2513
2511
|
fill: j[se.text]
|
2514
2512
|
}), e.restore();
|
2515
2513
|
}), e.restore();
|
2516
|
-
}), e.restore(),
|
2517
|
-
left:
|
2518
|
-
top:
|
2519
|
-
width:
|
2520
|
-
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
|
2521
2519
|
});
|
2522
2520
|
}
|
2523
2521
|
calcCellAutoHeight(e) {
|
2524
|
-
var
|
2525
|
-
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset:
|
2526
|
-
startX: p.startX +
|
2527
|
-
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,
|
2528
2526
|
startY: p.startY + c,
|
2529
|
-
endY: p.endY -
|
2530
|
-
},
|
2531
|
-
if (!
|
2527
|
+
endY: p.endY - h
|
2528
|
+
}, v = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i);
|
2529
|
+
if (!v)
|
2532
2530
|
return;
|
2533
|
-
const m = this._dataValidationModel.getValidator(
|
2531
|
+
const m = this._dataValidationModel.getValidator(v.type);
|
2534
2532
|
if (!m)
|
2535
2533
|
return;
|
2536
|
-
const
|
2537
|
-
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;
|
2538
2536
|
}
|
2539
2537
|
calcCellAutoWidth(e) {
|
2540
|
-
var
|
2541
|
-
const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset:
|
2542
|
-
startX: p.startX +
|
2543
|
-
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,
|
2544
2542
|
startY: p.startY + c,
|
2545
|
-
endY: p.endY -
|
2546
|
-
},
|
2547
|
-
if (!
|
2543
|
+
endY: p.endY - h
|
2544
|
+
}, v = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i);
|
2545
|
+
if (!v)
|
2548
2546
|
return;
|
2549
|
-
const m = this._dataValidationModel.getValidator(
|
2547
|
+
const m = this._dataValidationModel.getValidator(v.type);
|
2550
2548
|
if (!m)
|
2551
2549
|
return;
|
2552
|
-
const
|
2553
|
-
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;
|
2554
2552
|
}
|
2555
2553
|
isHit(e, t) {
|
2556
2554
|
const { primaryWithCoord: o } = t, n = o.isMergedMainCell ? o.mergeInfo : o, { endX: a } = n, { x: i } = e;
|
@@ -2569,11 +2567,11 @@ let sn = class {
|
|
2569
2567
|
}
|
2570
2568
|
onPointerEnter(e, t) {
|
2571
2569
|
var o, n;
|
2572
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2570
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.POINTER);
|
2573
2571
|
}
|
2574
2572
|
onPointerLeave(e, t) {
|
2575
2573
|
var o, n;
|
2576
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2574
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.DEFAULT);
|
2577
2575
|
}
|
2578
2576
|
};
|
2579
2577
|
sn = is([
|
@@ -2660,20 +2658,20 @@ function mt(e, t, o) {
|
|
2660
2658
|
};
|
2661
2659
|
}
|
2662
2660
|
function Bn(e, t, o, n, a, i, r = !0) {
|
2663
|
-
let
|
2664
|
-
const
|
2661
|
+
let s = 0;
|
2662
|
+
const l = r ? ke : 0;
|
2665
2663
|
switch (a) {
|
2666
2664
|
case ue.BOTTOM:
|
2667
|
-
|
2665
|
+
s = t - n - l;
|
2668
2666
|
break;
|
2669
2667
|
case ue.MIDDLE:
|
2670
|
-
|
2668
|
+
s = (t - n) / 2;
|
2671
2669
|
break;
|
2672
2670
|
default:
|
2673
|
-
|
2671
|
+
s = l;
|
2674
2672
|
break;
|
2675
2673
|
}
|
2676
|
-
|
2674
|
+
s = Math.max(ke, s);
|
2677
2675
|
let c = 0;
|
2678
2676
|
switch (i) {
|
2679
2677
|
case He.CENTER:
|
@@ -2685,7 +2683,7 @@ function Bn(e, t, o, n, a, i, r = !0) {
|
|
2685
2683
|
}
|
2686
2684
|
return c = Math.max(pe, c), {
|
2687
2685
|
paddingLeft: c,
|
2688
|
-
paddingTop:
|
2686
|
+
paddingTop: s
|
2689
2687
|
};
|
2690
2688
|
}
|
2691
2689
|
let ln = class {
|
@@ -2702,128 +2700,128 @@ let ln = class {
|
|
2702
2700
|
return `${e}.${t}`;
|
2703
2701
|
}
|
2704
2702
|
_drawDownIcon(e, t, o, n, a, i, r) {
|
2705
|
-
const { t:
|
2706
|
-
let
|
2703
|
+
const { t: s = le.pd.t, b: l = le.pd.b } = r, c = o - he;
|
2704
|
+
let h;
|
2707
2705
|
switch (i) {
|
2708
2706
|
case ue.MIDDLE:
|
2709
|
-
|
2707
|
+
h = (n - pt) / 2;
|
2710
2708
|
break;
|
2711
2709
|
case ue.BOTTOM:
|
2712
|
-
|
2710
|
+
h = n - l - a - ke + (a / 2 - pt / 2);
|
2713
2711
|
break;
|
2714
2712
|
default:
|
2715
|
-
|
2713
|
+
h = s + ke + (a / 2 - pt / 2);
|
2716
2714
|
break;
|
2717
2715
|
}
|
2718
|
-
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();
|
2719
2717
|
}
|
2720
2718
|
// eslint-disable-next-line max-lines-per-function, complexity
|
2721
2719
|
drawWith(e, t, o) {
|
2722
|
-
const { primaryWithCoord: n, row: a, col: i, style: r, data:
|
2723
|
-
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)
|
2724
2722
|
return;
|
2725
|
-
const p = this._dataValidationModel.getValidator(
|
2723
|
+
const p = this._dataValidationModel.getValidator(h.type);
|
2726
2724
|
if (!p)
|
2727
2725
|
return;
|
2728
|
-
const d =
|
2729
|
-
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))
|
2730
2728
|
return;
|
2731
|
-
const
|
2732
|
-
startX: c.startX +
|
2729
|
+
const S = {
|
2730
|
+
startX: c.startX + v,
|
2733
2731
|
endX: c.endX - m,
|
2734
|
-
startY: c.startY +
|
2735
|
-
endY: c.endY -
|
2736
|
-
},
|
2737
|
-
let { tb:
|
2738
|
-
if (
|
2739
|
-
const { l: x = le.pd.l, t: j = le.pd.t, r:
|
2740
|
-
|
2741
|
-
const ee = Qe(k), { height: te, width: re } = ee, { paddingTop: ae, paddingLeft: se } = Bn(
|
2742
|
-
this._drawDownIcon(e,
|
2743
|
-
left:
|
2744
|
-
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,
|
2745
2743
|
width: he,
|
2746
2744
|
height: I - j - H
|
2747
2745
|
});
|
2748
2746
|
} else {
|
2749
|
-
e.save(), e.translateWithPrecision(
|
2750
|
-
const x =
|
2751
|
-
|
2752
|
-
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);
|
2753
2751
|
e.translateWithPrecision(pe, q);
|
2754
|
-
const te = Math.max(
|
2752
|
+
const te = Math.max(R - pe * 2, 1), re = k;
|
2755
2753
|
Xn.drawWith(e, {
|
2756
2754
|
width: te,
|
2757
2755
|
height: re,
|
2758
|
-
fill: (
|
2756
|
+
fill: (L == null ? void 0 : L.color) || Le,
|
2759
2757
|
radius: Wt
|
2760
|
-
}), e.save(), e.translateWithPrecision(Ee, 0), e.beginPath(), e.rect(0, 0, x, k), e.clip(), e.translateWithPrecision(ee, 0),
|
2761
|
-
left:
|
2762
|
-
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,
|
2763
2761
|
width: te,
|
2764
2762
|
height: re
|
2765
2763
|
});
|
2766
2764
|
}
|
2767
2765
|
}
|
2768
2766
|
calcCellAutoHeight(e) {
|
2769
|
-
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);
|
2770
2768
|
if (!d || d.renderMode === de.TEXT)
|
2771
2769
|
return;
|
2772
|
-
const
|
2773
|
-
startX: r.startX +
|
2770
|
+
const v = {
|
2771
|
+
startX: r.startX + l,
|
2774
2772
|
endX: r.endX - c,
|
2775
|
-
startY: r.startY +
|
2773
|
+
startY: r.startY + h,
|
2776
2774
|
endY: r.endY - p
|
2777
|
-
}, m =
|
2778
|
-
let { tb:
|
2779
|
-
const { t: I = le.pd.t, b:
|
2780
|
-
if (
|
2781
|
-
const
|
2782
|
-
|
2783
|
-
const
|
2784
|
-
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;
|
2785
2783
|
} else {
|
2786
|
-
const
|
2787
|
-
|
2788
|
-
const
|
2789
|
-
height:
|
2790
|
-
} =
|
2791
|
-
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;
|
2792
2790
|
}
|
2793
2791
|
}
|
2794
2792
|
calcCellAutoWidth(e) {
|
2795
|
-
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);
|
2796
2794
|
if (!d || d.renderMode === de.TEXT)
|
2797
2795
|
return;
|
2798
|
-
const
|
2799
|
-
startX: r.startX +
|
2796
|
+
const v = {
|
2797
|
+
startX: r.startX + l,
|
2800
2798
|
endX: r.endX - c,
|
2801
|
-
startY: r.startY +
|
2799
|
+
startY: r.startY + h,
|
2802
2800
|
endY: r.endY - p
|
2803
|
-
}, m =
|
2804
|
-
let { tb:
|
2805
|
-
const { l: I = le.pd.l, r:
|
2806
|
-
|
2807
|
-
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;
|
2808
2806
|
switch (d.renderMode) {
|
2809
2807
|
case de.ARROW:
|
2810
|
-
|
2808
|
+
C = he + pe * 2 + V + I;
|
2811
2809
|
break;
|
2812
2810
|
case de.CUSTOM:
|
2813
|
-
|
2811
|
+
C = he + pe * 2 + Ee * 2 + V + I + Wt / 2 + 1;
|
2814
2812
|
break;
|
2815
2813
|
default:
|
2816
|
-
|
2814
|
+
C = he + pe * 2 + Ee * 2 + V + I + Wt / 2 + 1;
|
2817
2815
|
}
|
2818
|
-
const
|
2819
|
-
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;
|
2820
2818
|
}
|
2821
2819
|
isHit(e, t) {
|
2822
|
-
const { subUnitId: o, row: n, col: a } = t, r = this._ensureMap(o).get(this._generateKey(n, a)),
|
2823
|
-
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)
|
2824
2822
|
return !1;
|
2825
|
-
const { top:
|
2826
|
-
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;
|
2827
2825
|
}
|
2828
2826
|
onPointerDown(e, t) {
|
2829
2827
|
if (t.button === 2)
|
@@ -2838,11 +2836,11 @@ let ln = class {
|
|
2838
2836
|
}
|
2839
2837
|
onPointerEnter(e, t) {
|
2840
2838
|
var o, n;
|
2841
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2839
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.POINTER);
|
2842
2840
|
}
|
2843
2841
|
onPointerLeave(e, t) {
|
2844
2842
|
var o, n;
|
2845
|
-
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(
|
2843
|
+
(n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Ye.DEFAULT);
|
2846
2844
|
}
|
2847
2845
|
};
|
2848
2846
|
ln = cs([
|
@@ -2961,7 +2959,7 @@ let $n = (ft = class extends Yn {
|
|
2961
2959
|
}
|
2962
2960
|
onReady() {
|
2963
2961
|
this._injector.get(ze), this._injector.get(Ke), this._injector.get(it), this._injector.get(rt), this._injector.get(Ve).registerRenderModule(
|
2964
|
-
|
2962
|
+
Y.UNIVER_SHEET,
|
2965
2963
|
[Rt]
|
2966
2964
|
);
|
2967
2965
|
}
|
@@ -2971,7 +2969,7 @@ let $n = (ft = class extends Yn {
|
|
2971
2969
|
onSteady() {
|
2972
2970
|
this._injector.get(Xe);
|
2973
2971
|
}
|
2974
|
-
}, M(ft, "pluginName", ws), M(ft, "type",
|
2972
|
+
}, M(ft, "pluginName", ws), M(ft, "type", Y.UNIVER_SHEET), ft);
|
2975
2973
|
$n = Is([
|
2976
2974
|
Yt(1, b(Fe)),
|
2977
2975
|
Yt(2, Q),
|
@@ -3015,7 +3013,7 @@ let kn = (gt = class extends Yn {
|
|
3015
3013
|
}
|
3016
3014
|
onReady() {
|
3017
3015
|
this._injector.get(ze), this._injector.get(Ke), this._injector.get(Ve).registerRenderModule(
|
3018
|
-
|
3016
|
+
Y.UNIVER_SHEET,
|
3019
3017
|
[Rt]
|
3020
3018
|
);
|
3021
3019
|
}
|
@@ -3025,7 +3023,7 @@ let kn = (gt = class extends Yn {
|
|
3025
3023
|
onSteady() {
|
3026
3024
|
this._injector.get(Xe);
|
3027
3025
|
}
|
3028
|
-
}, M(gt, "pluginName", ys), M(gt, "type",
|
3026
|
+
}, M(gt, "pluginName", ys), M(gt, "type", Y.UNIVER_SHEET), gt);
|
3029
3027
|
kn = Vs([
|
3030
3028
|
Xt(1, b(Fe)),
|
3031
3029
|
Xt(2, Q),
|