@univerjs/sheets-data-validation-ui 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +196 -193
- package/lib/umd/index.js +1 -1
- package/package.json +18 -18
package/lib/es/index.js
CHANGED
@@ -31,7 +31,7 @@ let le = class extends Dt {
|
|
31
31
|
{
|
32
32
|
handler: async (t, e, o) => {
|
33
33
|
var C;
|
34
|
-
const n = await t, { worksheet: a, row: i, col: r, unitId:
|
34
|
+
const n = await t, { worksheet: a, row: i, col: r, unitId: s, subUnitId: l, workbook: c } = e, u = this._dataValidationModel.getRuleIdByLocation(s, l, i, r), h = u ? this._dataValidationModel.getRuleById(s, l, u) : void 0;
|
35
35
|
if (!h || h.errorStyle !== re.STOP)
|
36
36
|
return o(Promise.resolve(n));
|
37
37
|
const d = await this._dataValidatorRegistryService.getValidatorItem(h.type);
|
@@ -41,8 +41,8 @@ let le = class extends Dt {
|
|
41
41
|
interceptValue: rt((C = e == null ? void 0 : e.origin) != null ? C : n),
|
42
42
|
row: i,
|
43
43
|
column: r,
|
44
|
-
unitId:
|
45
|
-
subUnitId:
|
44
|
+
unitId: s,
|
45
|
+
subUnitId: l,
|
46
46
|
worksheet: a,
|
47
47
|
workbook: c,
|
48
48
|
t: n == null ? void 0 : n.t
|
@@ -58,7 +58,7 @@ let le = class extends Dt {
|
|
58
58
|
},
|
59
59
|
id: "reject-input-dialog",
|
60
60
|
children: {
|
61
|
-
title: d.getRuleFinalError(h, { row: i, col: r, unitId:
|
61
|
+
title: d.getRuleFinalError(h, { row: i, col: r, unitId: s, subUnitId: l })
|
62
62
|
},
|
63
63
|
footer: {
|
64
64
|
title: An.createElement(
|
@@ -125,7 +125,7 @@ const Ka = "univer-dv-date-dropdown", Ga = "univer-dv-date-dropdown-btns", Un =
|
|
125
125
|
};
|
126
126
|
function qa(t) {
|
127
127
|
var g;
|
128
|
-
const { location: e, hideFn: o } = t, { worksheet: n, row: a, col: i, unitId: r, subUnitId:
|
128
|
+
const { location: e, hideFn: o } = t, { worksheet: n, row: a, col: i, unitId: r, subUnitId: s, workbook: l } = e, c = L(tt), u = L(le), h = n.getCell(a, i), d = rt(n.getCellRaw(a, i)), v = Za(d), [p, C] = x(v), R = p && p.isValid() ? p : Ze(), f = L(Q), w = L(at), I = w.getRuleByLocation(r, s, a, i);
|
129
129
|
if (!I)
|
130
130
|
return null;
|
131
131
|
const V = w.getValidator(I.type);
|
@@ -135,15 +135,15 @@ function qa(t) {
|
|
135
135
|
var k, F, U;
|
136
136
|
if (!R)
|
137
137
|
return;
|
138
|
-
const T = R.format(_ ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"), N = (k = qe.parseDate(T)) == null ? void 0 : k.v, P =
|
138
|
+
const T = R.format(_ ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"), N = (k = qe.parseDate(T)) == null ? void 0 : k.v, P = l.getStyles().getStyleByCell(h), b = (U = (F = P == null ? void 0 : P.n) == null ? void 0 : F.pattern) != null ? U : "", A = Ra(b);
|
139
139
|
I.errorStyle !== re.STOP || await V.validator({
|
140
140
|
value: N,
|
141
141
|
unitId: r,
|
142
|
-
subUnitId:
|
142
|
+
subUnitId: s,
|
143
143
|
row: a,
|
144
144
|
column: i,
|
145
145
|
worksheet: n,
|
146
|
-
workbook:
|
146
|
+
workbook: l,
|
147
147
|
interceptValue: T.replace("Z", "").replace("T", " "),
|
148
148
|
t: Ho.NUMBER
|
149
149
|
}, I) ? (o(), await c.executeCommand(an.id, {
|
@@ -153,7 +153,7 @@ function qa(t) {
|
|
153
153
|
keycode: sn.ESC
|
154
154
|
}), await c.executeCommand(vn.id, {
|
155
155
|
unitId: r,
|
156
|
-
subUnitId:
|
156
|
+
subUnitId: s,
|
157
157
|
range: {
|
158
158
|
startColumn: i,
|
159
159
|
endColumn: i,
|
@@ -172,7 +172,7 @@ function qa(t) {
|
|
172
172
|
}
|
173
173
|
}
|
174
174
|
}
|
175
|
-
})) : u.showReject(V.getRuleFinalError(I, { row: a, col: i, unitId: r, subUnitId:
|
175
|
+
})) : u.showReject(V.getRuleFinalError(I, { row: a, col: i, unitId: r, subUnitId: s }));
|
176
176
|
};
|
177
177
|
return /* @__PURE__ */ j("div", { className: Un.dvDateDropdown, children: [
|
178
178
|
/* @__PURE__ */ m(
|
@@ -209,8 +209,8 @@ var ut = function() {
|
|
209
209
|
e.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[a]) && (o[n[a]] = t[n[a]]);
|
210
210
|
return o;
|
211
211
|
}, bt = yt(function(t, e) {
|
212
|
-
var o = t.icon, n = t.id, a = t.className, i = t.extend, r = Ja(t, ["icon", "id", "className", "extend"]),
|
213
|
-
return _o(o, "".concat(n), { defIds: o.defIds, idSuffix:
|
212
|
+
var o = t.icon, n = t.id, a = t.className, i = t.extend, r = Ja(t, ["icon", "id", "className", "extend"]), s = "univerjs-icon univerjs-icon-".concat(n, " ").concat(a || "").trim(), l = zt("_".concat(ei()));
|
213
|
+
return _o(o, "".concat(n), { defIds: o.defIds, idSuffix: l.current }, ut({ ref: e, className: s }, r), i);
|
214
214
|
});
|
215
215
|
function _o(t, e, o, n, a) {
|
216
216
|
return Mt(t.tag, ut(ut({ key: e }, Qa(t, o, a)), n), (ti(t, o).children || []).map(function(i, r) {
|
@@ -219,11 +219,14 @@ function _o(t, e, o, n, a) {
|
|
219
219
|
}
|
220
220
|
function Qa(t, e, o) {
|
221
221
|
var n = ut({}, t.attrs);
|
222
|
-
o != null && o.colorChannel1 && n.fill === "colorChannel1" && (n.fill = o.colorChannel1)
|
222
|
+
o != null && o.colorChannel1 && n.fill === "colorChannel1" && (n.fill = o.colorChannel1), t.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(function(i) {
|
223
|
+
var r = i[0], s = i[1];
|
224
|
+
r === "mask" && typeof s == "string" && (n[r] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
225
|
+
});
|
223
226
|
var a = e.defIds;
|
224
227
|
return !a || a.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(i) {
|
225
|
-
var r = i[0],
|
226
|
-
typeof
|
228
|
+
var r = i[0], s = i[1];
|
229
|
+
typeof s == "string" && (n[r] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
227
230
|
})), n;
|
228
231
|
}
|
229
232
|
function ti(t, e) {
|
@@ -369,14 +372,14 @@ var hi = Object.getOwnPropertyDescriptor, pi = (t, e, o, n) => {
|
|
369
372
|
return a;
|
370
373
|
}, Ot = (t, e) => (o, n) => e(o, n, t);
|
371
374
|
let Rt = class extends Dt {
|
372
|
-
constructor(e, o, n, a, i, r,
|
375
|
+
constructor(e, o, n, a, i, r, s) {
|
373
376
|
super();
|
374
377
|
M(this, "_activeDropdown");
|
375
378
|
M(this, "_activeDropdown$", new xa());
|
376
379
|
M(this, "_currentPopup", null);
|
377
380
|
M(this, "activeDropdown$", this._activeDropdown$.asObservable());
|
378
381
|
M(this, "_zenVisible", !1);
|
379
|
-
this._canvasPopupManagerService = e, this._univerInstanceService = o, this._dataValidatorRegistryService = n, this._zenZoneService = a, this._renderManagerService = i, this._dataValidationModel = r, this._sheetsSelectionsService =
|
382
|
+
this._canvasPopupManagerService = e, this._univerInstanceService = o, this._dataValidatorRegistryService = n, this._zenZoneService = a, this._renderManagerService = i, this._dataValidationModel = r, this._sheetsSelectionsService = s, this._init(), this._initSelectionChange(), this.disposeWithMe(() => {
|
380
383
|
this._activeDropdown$.complete();
|
381
384
|
});
|
382
385
|
}
|
@@ -395,11 +398,11 @@ let Rt = class extends Dt {
|
|
395
398
|
const r = o ? i.getSheetBySheetId(o) : i.getActiveSheet();
|
396
399
|
if (!r)
|
397
400
|
return;
|
398
|
-
const
|
399
|
-
if (!
|
401
|
+
const s = this._dataValidationModel.getRuleByLocation(i.getUnitId(), r.getSheetId(), n, a);
|
402
|
+
if (!s)
|
400
403
|
return;
|
401
|
-
const
|
402
|
-
return
|
404
|
+
const l = this._dataValidatorRegistryService.getValidatorItem(s.type);
|
405
|
+
return l == null ? void 0 : l.dropdown;
|
403
406
|
}
|
404
407
|
_initSelectionChange() {
|
405
408
|
this.disposeWithMe(this._sheetsSelectionsService.selectionMoveEnd$.subscribe((e) => {
|
@@ -407,11 +410,11 @@ let Rt = class extends Dt {
|
|
407
410
|
}));
|
408
411
|
}
|
409
412
|
showDropdown(e, o = !0) {
|
410
|
-
const { location: n } = e, { row: a, col: i, unitId: r, subUnitId:
|
413
|
+
const { location: n } = e, { row: a, col: i, unitId: r, subUnitId: s } = n;
|
411
414
|
if (this._currentPopup && this._currentPopup.dispose(), this._zenVisible)
|
412
415
|
return;
|
413
416
|
this._activeDropdown = e, this._activeDropdown$.next(this._activeDropdown);
|
414
|
-
const
|
417
|
+
const l = this._renderManagerService.getRenderById(jo), c = this._canvasPopupManagerService.attachPopupToCell(
|
415
418
|
a,
|
416
419
|
i,
|
417
420
|
{
|
@@ -420,10 +423,10 @@ let Rt = class extends Dt {
|
|
420
423
|
o && this.hideDropdown();
|
421
424
|
},
|
422
425
|
offset: [0, 3],
|
423
|
-
excludeOutside: [
|
426
|
+
excludeOutside: [l == null ? void 0 : l.engine.getCanvasElement()].filter(Boolean)
|
424
427
|
},
|
425
428
|
r,
|
426
|
-
|
429
|
+
s
|
427
430
|
);
|
428
431
|
if (!c)
|
429
432
|
throw new Error("[DataValidationDropdownManagerService]: cannot show dropdown!");
|
@@ -442,13 +445,13 @@ let Rt = class extends Dt {
|
|
442
445
|
const r = this._univerInstanceService.getUnit(e, X.UNIVER_SHEET);
|
443
446
|
if (!r)
|
444
447
|
return;
|
445
|
-
const
|
446
|
-
if (!l)
|
447
|
-
return;
|
448
|
-
const s = this._dataValidationModel.getRuleByLocation(r.getUnitId(), l.getSheetId(), n, a);
|
448
|
+
const s = r.getSheetBySheetId(o);
|
449
449
|
if (!s)
|
450
450
|
return;
|
451
|
-
const
|
451
|
+
const l = this._dataValidationModel.getRuleByLocation(r.getUnitId(), s.getSheetId(), n, a);
|
452
|
+
if (!l)
|
453
|
+
return;
|
454
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(l.type);
|
452
455
|
if (!c || !c.dropdown) {
|
453
456
|
this.hideDropdown();
|
454
457
|
return;
|
@@ -456,7 +459,7 @@ let Rt = class extends Dt {
|
|
456
459
|
this.showDropdown({
|
457
460
|
location: {
|
458
461
|
workbook: r,
|
459
|
-
worksheet:
|
462
|
+
worksheet: s,
|
460
463
|
row: n,
|
461
464
|
col: a,
|
462
465
|
unitId: e,
|
@@ -482,15 +485,15 @@ const Ve = "DataValidationPanel", Wt = {
|
|
482
485
|
handler(t, e) {
|
483
486
|
if (!e)
|
484
487
|
return !1;
|
485
|
-
const { ruleId: o, isAdd: n } = e, a = t.get(gt), i = t.get(Pe), r = t.get(vt),
|
486
|
-
if (!
|
487
|
-
const { unitId: c, subUnitId: u } =
|
488
|
+
const { ruleId: o, isAdd: n } = e, a = t.get(gt), i = t.get(Pe), r = t.get(vt), s = t.get(po), l = Qn(r);
|
489
|
+
if (!l) return !1;
|
490
|
+
const { unitId: c, subUnitId: u } = l, h = o ? i.getRuleById(c, u, o) : void 0;
|
488
491
|
a.open(), a.setActiveRule(h && {
|
489
492
|
unitId: c,
|
490
493
|
subUnitId: u,
|
491
494
|
rule: h
|
492
495
|
});
|
493
|
-
const d =
|
496
|
+
const d = s.open({
|
494
497
|
id: Ve,
|
495
498
|
header: { title: n ? "dataValidation.panel.addTitle" : "dataValidation.panel.title" },
|
496
499
|
children: { label: Ve },
|
@@ -518,8 +521,8 @@ const Ve = "DataValidationPanel", Wt = {
|
|
518
521
|
handler(t, e) {
|
519
522
|
if (!e)
|
520
523
|
return !1;
|
521
|
-
const o = t.get(Rt), { unitId: n, subUnitId: a, row: i, column: r } = e,
|
522
|
-
return
|
524
|
+
const o = t.get(Rt), { unitId: n, subUnitId: a, row: i, column: r } = e, s = o.activeDropdown, l = s == null ? void 0 : s.location;
|
525
|
+
return l && l.unitId === n && l.subUnitId === a && l.row === i && l.col === r || o.showDataValidationDropdown(
|
523
526
|
n,
|
524
527
|
a,
|
525
528
|
i,
|
@@ -544,7 +547,7 @@ const Ve = "DataValidationPanel", Wt = {
|
|
544
547
|
dvListDropdownEdit: wi
|
545
548
|
}, Ri = (t) => {
|
546
549
|
var _, S;
|
547
|
-
const { value: e, onChange: o, multiple: n, options: a, title: i, onEdit: r, style:
|
550
|
+
const { value: e, onChange: o, multiple: n, options: a, title: i, onEdit: r, style: s, filter: l, location: c } = t, u = L(Q), h = L(pn), d = l == null ? void 0 : l.toLowerCase(), { row: v, col: p, unitId: C, subUnitId: R } = c, f = a.filter((g) => d ? g.label.toLowerCase().includes(d) : !0), w = (S = (_ = h.getConfig(Vn)) == null ? void 0 : _.showEditOnDropdown) != null ? S : !0, I = L(to), V = Kt(() => I.permissionCheckWithRanges(
|
548
551
|
{
|
549
552
|
workbookTypes: [Re],
|
550
553
|
rangeTypes: [we],
|
@@ -554,7 +557,7 @@ const Ve = "DataValidationPanel", Wt = {
|
|
554
557
|
C,
|
555
558
|
R
|
556
559
|
), [I, p, v, C, R]);
|
557
|
-
return /* @__PURE__ */ j("div", { className: _t.dvListDropdown, style:
|
560
|
+
return /* @__PURE__ */ j("div", { className: _t.dvListDropdown, style: s, children: [
|
558
561
|
/* @__PURE__ */ m("div", { className: _t.dvListDropdownTitle, children: i }),
|
559
562
|
/* @__PURE__ */ m("div", { className: _t.dvListDropdownList, children: /* @__PURE__ */ m(aa, { children: /* @__PURE__ */ m("div", { className: _t.dvListDropdownListContainer, children: f.map((g, y) => {
|
560
563
|
const T = e.indexOf(g.value) > -1, N = () => {
|
@@ -573,7 +576,7 @@ const Ve = "DataValidationPanel", Wt = {
|
|
573
576
|
] }) : g.label }),
|
574
577
|
/* @__PURE__ */ m("div", { className: _t.dvListDropdownSelectedIcon, children: T ? /* @__PURE__ */ m(So, {}) : null })
|
575
578
|
] }, y);
|
576
|
-
}) }) },
|
579
|
+
}) }) }, l) }),
|
577
580
|
w && V ? /* @__PURE__ */ j(wt, { children: [
|
578
581
|
/* @__PURE__ */ m("div", { className: _t.dvListDropdownSplit }),
|
579
582
|
/* @__PURE__ */ m("div", { className: _t.dvListDropdownEdit, children: /* @__PURE__ */ m("a", { onClick: r, children: u.t("dataValidation.list.edit") }) })
|
@@ -582,7 +585,7 @@ const Ve = "DataValidationPanel", Wt = {
|
|
582
585
|
};
|
583
586
|
function Di(t) {
|
584
587
|
var F, U, Y, z;
|
585
|
-
const { location: e, hideFn: o } = t, { worksheet: n, row: a, col: i, unitId: r, subUnitId:
|
588
|
+
const { location: e, hideFn: o } = t, { worksheet: n, row: a, col: i, unitId: r, subUnitId: s } = e, l = L(Pe), [c, u] = x(""), h = L(tt), d = L(Q), [v, p] = x(""), C = L(uo), R = L(vt), f = Kt(() => l.ruleChange$.pipe(wn(16)), []), w = L(at);
|
586
589
|
$t(f);
|
587
590
|
const I = ka.useContext(), V = ((U = (F = I.current) == null ? void 0 : F.right) != null ? U : 0) - ((z = (Y = I.current) == null ? void 0 : Y.left) != null ? z : 0);
|
588
591
|
if (It(() => {
|
@@ -600,7 +603,7 @@ function Di(t) {
|
|
600
603
|
};
|
601
604
|
}, [h, C, R]), !n)
|
602
605
|
return null;
|
603
|
-
const _ = w.getRuleByLocation(r,
|
606
|
+
const _ = w.getRuleByLocation(r, s, a, i);
|
604
607
|
if (!_)
|
605
608
|
return null;
|
606
609
|
const S = w.getValidator(_.type);
|
@@ -609,7 +612,7 @@ function Di(t) {
|
|
609
612
|
const g = n.getCell(a, i), y = (_ == null ? void 0 : _.renderMode) === ct.CUSTOM || (_ == null ? void 0 : _.renderMode) === void 0;
|
610
613
|
if (!g || !_ || !S || S.id.indexOf(K.LIST) !== 0)
|
611
614
|
return;
|
612
|
-
const T = _.type === K.LIST_MULTIPLE, N = S.getListWithColor(_, r,
|
615
|
+
const T = _.type === K.LIST_MULTIPLE, N = S.getListWithColor(_, r, s), P = v || ga(n.getCellRaw(a, i)), b = oo(P), A = () => {
|
613
616
|
h.executeCommand(Wt.id, {
|
614
617
|
ruleId: _.uid
|
615
618
|
}), o();
|
@@ -628,7 +631,7 @@ function Di(t) {
|
|
628
631
|
onChange: async (H) => {
|
629
632
|
const G = ao(H), J = {
|
630
633
|
unitId: r,
|
631
|
-
subUnitId:
|
634
|
+
subUnitId: s,
|
632
635
|
range: {
|
633
636
|
startColumn: i,
|
634
637
|
endColumn: i,
|
@@ -667,14 +670,14 @@ const Vi = "univer-data-validation-options-button", yi = "univer-data-validation
|
|
667
670
|
};
|
668
671
|
function Mi(t) {
|
669
672
|
var c;
|
670
|
-
const e = L(Q), o = L(Te), { value: n, onChange: a, extraComponent: i } = t, [r,
|
673
|
+
const e = L(Q), o = L(Te), { value: n, onChange: a, extraComponent: i } = t, [r, s] = x(!1), l = i ? o.get(i) : null;
|
671
674
|
return /* @__PURE__ */ j(wt, { children: [
|
672
|
-
/* @__PURE__ */ j("div", { className: Be.dataValidationOptionsButton, onClick: () =>
|
675
|
+
/* @__PURE__ */ j("div", { className: Be.dataValidationOptionsButton, onClick: () => s(!r), children: [
|
673
676
|
e.t("dataValidation.panel.options"),
|
674
677
|
r ? /* @__PURE__ */ m(Ro, { className: Be.dataValidationOptionsButtonIcon }) : /* @__PURE__ */ m(wo, { className: Be.dataValidationOptionsButtonIcon })
|
675
678
|
] }),
|
676
679
|
r && /* @__PURE__ */ j(wt, { children: [
|
677
|
-
|
680
|
+
l ? /* @__PURE__ */ m(l, { value: n, onChange: a }) : null,
|
678
681
|
/* @__PURE__ */ m(
|
679
682
|
q,
|
680
683
|
{
|
@@ -731,18 +734,18 @@ function Pi(t, e, o) {
|
|
731
734
|
}
|
732
735
|
function Ai() {
|
733
736
|
var lt;
|
734
|
-
const [t, e] = x(0), o = L(gt), n = $t(o.activeRule$, o.activeRule), { unitId: a, subUnitId: i, rule: r } = n || {},
|
737
|
+
const [t, e] = x(0), o = L(gt), n = $t(o.activeRule$, o.activeRule), { unitId: a, subUnitId: i, rule: r } = n || {}, s = r.uid, l = L(Et), c = L(vt), u = L(Te), h = L(tt), d = L(Pe), v = L(Q), [p, C] = x(r), R = l.getValidatorItem(p.type), [f, w] = x(!1), I = l.getValidatorsByScope(Ba.SHEET), [V, _] = x(() => p.ranges.map((O) => ({ unitId: "", sheetId: "", range: O }))), S = Kt(() => Ti(h), [h]), [g, y] = x(!1), T = zt({}), [N, P] = x(!1), b = L(Jn);
|
735
738
|
if (It(() => () => {
|
736
739
|
const O = b.getCurrentLastSelection();
|
737
740
|
O && b.setSelections([O]);
|
738
741
|
}, [b]), It(() => {
|
739
742
|
h.onCommandExecuted((O) => {
|
740
743
|
(O.id === Ko.id || O.id === Go.id) && setTimeout(() => {
|
741
|
-
const D = d.getRuleById(a, i,
|
744
|
+
const D = d.getRuleById(a, i, s);
|
742
745
|
e((B) => B + 1), D && (C(D), _(D.ranges.map((B) => ({ unitId: "", sheetId: "", range: B }))));
|
743
746
|
}, 20);
|
744
747
|
});
|
745
|
-
}, [h, d,
|
748
|
+
}, [h, d, s, i, a]), !R)
|
746
749
|
return null;
|
747
750
|
const A = R.operators, k = R.operatorNames, F = p.operator ? $a.includes(p.operator) : !1, U = () => {
|
748
751
|
!p.ranges.length || g || (R.validatorFormula(p, a, i).success ? o.setActiveRule(null) : w(!0));
|
@@ -770,7 +773,7 @@ function Ai() {
|
|
770
773
|
const $ = {
|
771
774
|
unitId: a,
|
772
775
|
subUnitId: i,
|
773
|
-
ruleId:
|
776
|
+
ruleId: s,
|
774
777
|
ranges: B
|
775
778
|
};
|
776
779
|
S(io.id, $);
|
@@ -784,7 +787,7 @@ function Ai() {
|
|
784
787
|
const D = {
|
785
788
|
unitId: a,
|
786
789
|
subUnitId: i,
|
787
|
-
ruleId:
|
790
|
+
ruleId: s,
|
788
791
|
setting: O
|
789
792
|
};
|
790
793
|
S(
|
@@ -794,7 +797,7 @@ function Ai() {
|
|
794
797
|
);
|
795
798
|
}, H = async () => {
|
796
799
|
await h.executeCommand(ro.id, {
|
797
|
-
ruleId:
|
800
|
+
ruleId: s,
|
798
801
|
unitId: a,
|
799
802
|
subUnitId: i
|
800
803
|
}), o.setActiveRule(null);
|
@@ -805,10 +808,10 @@ function Ai() {
|
|
805
808
|
formula2: p.formula2,
|
806
809
|
allowBlank: p.allowBlank
|
807
810
|
}, J = (O) => {
|
808
|
-
const D =
|
811
|
+
const D = l.getValidatorItem(O);
|
809
812
|
if (!D)
|
810
813
|
return;
|
811
|
-
const B = D.operators, $ = d.getRuleById(a, i,
|
814
|
+
const B = D.operators, $ = d.getRuleById(a, i, s), W = O === ($ == null ? void 0 : $.type) || O.includes("list") && ($ != null && $.type.includes("list")) ? {
|
812
815
|
...$,
|
813
816
|
type: O
|
814
817
|
} : {
|
@@ -833,7 +836,7 @@ function Ai() {
|
|
833
836
|
{
|
834
837
|
unitId: a,
|
835
838
|
subUnitId: i,
|
836
|
-
ruleId:
|
839
|
+
ruleId: s,
|
837
840
|
options: O
|
838
841
|
}
|
839
842
|
));
|
@@ -910,7 +913,7 @@ function Ai() {
|
|
910
913
|
validResult: R.validatorFormula(p, a, i),
|
911
914
|
unitId: a,
|
912
915
|
subUnitId: i,
|
913
|
-
ruleId:
|
916
|
+
ruleId: s
|
914
917
|
},
|
915
918
|
t + p.type
|
916
919
|
) : null,
|
@@ -941,8 +944,8 @@ const ki = "univer-data-validation-item-container", Fi = "univer-data-validation
|
|
941
944
|
dataValidationItemContent: Ni,
|
942
945
|
dataValidationItemIcon: Ui
|
943
946
|
}, Bi = (t) => {
|
944
|
-
const { rule: e, onClick: o, unitId: n, subUnitId: a, disable: i } = t, r = L(Et),
|
945
|
-
|
947
|
+
const { rule: e, onClick: o, unitId: n, subUnitId: a, disable: i } = t, r = L(Et), s = L(tt), l = L(Va), c = r.getValidatorItem(e.type), u = zt(void 0), [h, d] = x(!1), v = (p) => {
|
948
|
+
s.executeCommand(ro.id, {
|
946
949
|
ruleId: e.uid,
|
947
950
|
unitId: n,
|
948
951
|
subUnitId: a
|
@@ -951,15 +954,15 @@ const ki = "univer-data-validation-item-container", Fi = "univer-data-validation
|
|
951
954
|
return It(() => () => {
|
952
955
|
var p;
|
953
956
|
u.current && ((p = u.current) == null || p.forEach((C) => {
|
954
|
-
C &&
|
957
|
+
C && l.removeShape(C);
|
955
958
|
}));
|
956
|
-
}, [
|
959
|
+
}, [l]), /* @__PURE__ */ j(
|
957
960
|
"div",
|
958
961
|
{
|
959
962
|
className: ue.dataValidationItemContainer,
|
960
963
|
onClick: o,
|
961
964
|
onMouseEnter: () => {
|
962
|
-
i || (d(!0), u.current = e.ranges.map((p) =>
|
965
|
+
i || (d(!0), u.current = e.ranges.map((p) => l.addShape({
|
963
966
|
range: p,
|
964
967
|
style: {
|
965
968
|
// hasAutoFill: false,
|
@@ -974,7 +977,7 @@ const ki = "univer-data-validation-item-container", Fi = "univer-data-validation
|
|
974
977
|
onMouseLeave: () => {
|
975
978
|
var p;
|
976
979
|
d(!1), (p = u.current) == null || p.forEach((C) => {
|
977
|
-
C &&
|
980
|
+
C && l.removeShape(C);
|
978
981
|
}), u.current = void 0;
|
979
982
|
},
|
980
983
|
children: [
|
@@ -999,11 +1002,11 @@ function xi() {
|
|
999
1002
|
return e ? /* @__PURE__ */ m(ji, { workbook: e }) : null;
|
1000
1003
|
}
|
1001
1004
|
function ji(t) {
|
1002
|
-
const e = L(at), o = L(vt), n = L(tt), a = L(Bt), i = L(gt), r = L(Q), [
|
1005
|
+
const e = L(at), o = L(vt), n = L(tt), a = L(Bt), i = L(gt), r = L(Q), [s, l] = x([]), { workbook: c } = t, u = $t(c.activeSheet$, void 0, !0), h = c.getUnitId(), d = u == null ? void 0 : u.getSheetId();
|
1003
1006
|
It(() => {
|
1004
|
-
|
1007
|
+
l(e.getRules(h, d));
|
1005
1008
|
const w = e.ruleChange$.subscribe((I) => {
|
1006
|
-
I.unitId === h && I.subUnitId === d &&
|
1009
|
+
I.unitId === h && I.subUnitId === d && l(e.getRules(h, d));
|
1007
1010
|
});
|
1008
1011
|
return () => {
|
1009
1012
|
w.unsubscribe();
|
@@ -1028,7 +1031,7 @@ function ji(t) {
|
|
1028
1031
|
}, R = ((w) => {
|
1029
1032
|
const I = o.getCurrentUnitForType(X.UNIVER_SHEET), V = I.getActiveSheet(), _ = I.getUnitId(), S = V.getSheetId();
|
1030
1033
|
return w.map((y) => ma(a, _, S, y.ranges) ? { ...y } : { ...y, disable: !0 });
|
1031
|
-
})(
|
1034
|
+
})(s), f = R == null ? void 0 : R.some((w) => w.disable);
|
1032
1035
|
return /* @__PURE__ */ j("div", { className: he.dataValidationList, children: [
|
1033
1036
|
R == null ? void 0 : R.map((w) => {
|
1034
1037
|
var I;
|
@@ -1051,7 +1054,7 @@ function ji(t) {
|
|
1051
1054
|
);
|
1052
1055
|
}),
|
1053
1056
|
/* @__PURE__ */ j("div", { className: he.dataValidationListButtons, children: [
|
1054
|
-
|
1057
|
+
s.length && !f ? /* @__PURE__ */ m(Ut, { className: he.dataValidationListButton, onClick: p, children: r.t("dataValidation.panel.removeAll") }) : null,
|
1055
1058
|
/* @__PURE__ */ m(Ut, { className: he.dataValidationListButton, type: "primary", onClick: v, children: r.t("dataValidation.panel.add") })
|
1056
1059
|
] })
|
1057
1060
|
] });
|
@@ -1065,10 +1068,10 @@ const Yi = () => {
|
|
1065
1068
|
handler(t) {
|
1066
1069
|
const e = t.get(vt), o = Qn(e);
|
1067
1070
|
if (!o) return !1;
|
1068
|
-
const { workbook: n, worksheet: a } = o, i = so(t), r = t.get(tt),
|
1071
|
+
const { workbook: n, worksheet: a } = o, i = so(t), r = t.get(tt), s = n.getUnitId(), l = a.getSheetId(), c = {
|
1069
1072
|
rule: i,
|
1070
|
-
unitId:
|
1071
|
-
subUnitId:
|
1073
|
+
unitId: s,
|
1074
|
+
subUnitId: l
|
1072
1075
|
};
|
1073
1076
|
return r.syncExecuteCommand(_n.id, c) ? (r.syncExecuteCommand(Wt.id, {
|
1074
1077
|
ruleId: i.uid,
|
@@ -1101,20 +1104,20 @@ let de = class extends Dt {
|
|
1101
1104
|
return;
|
1102
1105
|
}
|
1103
1106
|
if (this._dataValidationModel.validator(a, { ...t.location, workbook: o, worksheet: n }) === se.INVALID) {
|
1104
|
-
const r = this._cellAlertManagerService.currentAlert.get(Lt),
|
1105
|
-
if (
|
1107
|
+
const r = this._cellAlertManagerService.currentAlert.get(Lt), s = (e = r == null ? void 0 : r.alert) == null ? void 0 : e.location;
|
1108
|
+
if (s && s.row === t.location.row && s.col === t.location.col && s.subUnitId === t.location.subUnitId && s.unitId === t.location.unitId) {
|
1106
1109
|
this._cellAlertManagerService.removeAlert(Lt);
|
1107
1110
|
return;
|
1108
1111
|
}
|
1109
|
-
const
|
1110
|
-
if (!
|
1112
|
+
const l = this._dataValidationModel.getValidator(a.type);
|
1113
|
+
if (!l) {
|
1111
1114
|
this._cellAlertManagerService.removeAlert(Lt);
|
1112
1115
|
return;
|
1113
1116
|
}
|
1114
1117
|
this._cellAlertManagerService.showAlert({
|
1115
1118
|
type: Ea.ERROR,
|
1116
1119
|
title: this._localeService.t("dataValidation.error.title"),
|
1117
|
-
message:
|
1120
|
+
message: l == null ? void 0 : l.getRuleFinalError(a, t.location),
|
1118
1121
|
location: t.location,
|
1119
1122
|
width: 200,
|
1120
1123
|
height: 74,
|
@@ -1152,7 +1155,7 @@ let Gt = class extends Dt {
|
|
1152
1155
|
// eslint-disable-next-line max-lines-per-function
|
1153
1156
|
_initAutoFill() {
|
1154
1157
|
const t = () => ({ redos: [], undos: [] }), e = (n, a) => {
|
1155
|
-
const { source: i, target: r, unitId:
|
1158
|
+
const { source: i, target: r, unitId: s, subUnitId: l } = n, c = this._sheetDataValidationModel.getRuleObjectMatrix(s, l).clone(), u = rn([i, r]), [h, d] = u.ranges, { mapFunc: v } = u, p = {
|
1156
1159
|
row: h.startRow,
|
1157
1160
|
col: h.startColumn
|
1158
1161
|
}, C = Oa(h, d), R = new Se(), f = /* @__PURE__ */ new Set();
|
@@ -1177,7 +1180,7 @@ let Gt = class extends Dt {
|
|
1177
1180
|
endRow: P
|
1178
1181
|
},
|
1179
1182
|
T
|
1180
|
-
), { row: k, col: F } = v(A.startRow, A.startColumn), U = this._sheetDataValidationModel.getRuleIdByLocation(
|
1183
|
+
), { row: k, col: F } = v(A.startRow, A.startColumn), U = this._sheetDataValidationModel.getRuleIdByLocation(s, l, k, F) || "", Y = Ce.getPositionRange(
|
1181
1184
|
{
|
1182
1185
|
startRow: P,
|
1183
1186
|
startColumn: b,
|
@@ -1191,7 +1194,7 @@ let Gt = class extends Dt {
|
|
1191
1194
|
});
|
1192
1195
|
const w = Array.from(f).map((S) => ({ id: S, ranges: Je(R, (g) => g === S) }));
|
1193
1196
|
c.addRangeRules(w);
|
1194
|
-
const I = c.diff(this._sheetDataValidationModel.getRules(
|
1197
|
+
const I = c.diff(this._sheetDataValidationModel.getRules(s, l)), { redoMutations: V, undoMutations: _ } = on(s, l, I, this._injector, "patched", a === oe.ONLY_FORMAT);
|
1195
1198
|
return {
|
1196
1199
|
undos: _,
|
1197
1200
|
redos: V
|
@@ -1200,9 +1203,9 @@ let Gt = class extends Dt {
|
|
1200
1203
|
id: lo,
|
1201
1204
|
onBeforeFillData: (n) => {
|
1202
1205
|
const { source: a, unitId: i, subUnitId: r } = n;
|
1203
|
-
for (const
|
1204
|
-
for (const
|
1205
|
-
const c = this._sheetDataValidationModel.getRuleByLocation(i, r,
|
1206
|
+
for (const s of a.rows)
|
1207
|
+
for (const l of a.cols) {
|
1208
|
+
const c = this._sheetDataValidationModel.getRuleByLocation(i, r, s, l);
|
1206
1209
|
if (c && c.type === K.CHECKBOX) {
|
1207
1210
|
this._autoFillService.setDisableApplyType(oe.SERIES, !0);
|
1208
1211
|
return;
|
@@ -1237,8 +1240,8 @@ let Zt = class extends Dt {
|
|
1237
1240
|
id: lo,
|
1238
1241
|
onBeforeCopy: (e, o, n) => this._collect(e, o, n),
|
1239
1242
|
onPasteCells: (e, o, n, a) => {
|
1240
|
-
const { copyType: i = Tn.COPY, pasteType: r } = a, { range:
|
1241
|
-
return this._generateMutations(
|
1243
|
+
const { copyType: i = Tn.COPY, pasteType: r } = a, { range: s } = e || {}, { range: l, unitId: c, subUnitId: u } = o;
|
1244
|
+
return this._generateMutations(l, { copyType: i, pasteType: r, copyRange: s, unitId: c, subUnitId: u });
|
1242
1245
|
}
|
1243
1246
|
});
|
1244
1247
|
}
|
@@ -1249,13 +1252,13 @@ let Zt = class extends Dt {
|
|
1249
1252
|
subUnitId: o,
|
1250
1253
|
matrix: a
|
1251
1254
|
};
|
1252
|
-
const i = this._injector.invoke((
|
1255
|
+
const i = this._injector.invoke((l) => Ta(n, l, e, o));
|
1253
1256
|
if (!i)
|
1254
1257
|
return;
|
1255
|
-
const { rows: r, cols:
|
1256
|
-
r.forEach((
|
1257
|
-
|
1258
|
-
const d = this._sheetDataValidationModel.getRuleIdByLocation(e, o,
|
1258
|
+
const { rows: r, cols: s } = i;
|
1259
|
+
r.forEach((l, c) => {
|
1260
|
+
s.forEach((u, h) => {
|
1261
|
+
const d = this._sheetDataValidationModel.getRuleIdByLocation(e, o, l, u);
|
1259
1262
|
a.setValue(c, h, d != null ? d : "");
|
1260
1263
|
});
|
1261
1264
|
});
|
@@ -1277,7 +1280,7 @@ let Zt = class extends Dt {
|
|
1277
1280
|
return { redos: [], undos: [] };
|
1278
1281
|
const { unitId: a, subUnitId: i } = this._copyInfo;
|
1279
1282
|
if (o.unitId !== a || i !== o.subUnitId) {
|
1280
|
-
const r = this._sheetDataValidationModel.getRuleObjectMatrix(o.unitId, o.subUnitId).clone(),
|
1283
|
+
const r = this._sheetDataValidationModel.getRuleObjectMatrix(o.unitId, o.subUnitId).clone(), s = new Se(), l = /* @__PURE__ */ new Set(), { ranges: [c, u], mapFunc: h } = rn([o.copyRange, e]), d = Pn(c, u, !0), v = /* @__PURE__ */ new Map();
|
1281
1284
|
d.forEach(({ startRange: f }) => {
|
1282
1285
|
var w;
|
1283
1286
|
(w = this._copyInfo) == null || w.matrix.forValue((I, V, _) => {
|
@@ -1292,10 +1295,10 @@ let Zt = class extends Dt {
|
|
1292
1295
|
), g = `${i}-${_}`, y = this._sheetDataValidationModel.getRuleById(a, i, _);
|
1293
1296
|
!this._sheetDataValidationModel.getRuleById(o.unitId, o.subUnitId, g) && y && v.set(g, { ...y, uid: g });
|
1294
1297
|
const { row: T, col: N } = h(S.startRow, S.startColumn);
|
1295
|
-
|
1298
|
+
l.add(g), s.setValue(T, N, g);
|
1296
1299
|
});
|
1297
1300
|
});
|
1298
|
-
const p = Array.from(
|
1301
|
+
const p = Array.from(l).map((f) => ({ id: f, ranges: Je(s, (w) => w === f) }));
|
1299
1302
|
r.addRangeRules(p);
|
1300
1303
|
const { redoMutations: C, undoMutations: R } = on(
|
1301
1304
|
o.unitId,
|
@@ -1310,7 +1313,7 @@ let Zt = class extends Dt {
|
|
1310
1313
|
undos: R
|
1311
1314
|
};
|
1312
1315
|
} else {
|
1313
|
-
const r = this._sheetDataValidationModel.getRuleObjectMatrix(a, i).clone(),
|
1316
|
+
const r = this._sheetDataValidationModel.getRuleObjectMatrix(a, i).clone(), s = new Se(), l = /* @__PURE__ */ new Set(), { ranges: [c, u], mapFunc: h } = rn([o.copyRange, e]);
|
1314
1317
|
Pn(c, u, !0).forEach(({ startRange: R }) => {
|
1315
1318
|
var f;
|
1316
1319
|
(f = this._copyInfo) == null || f.matrix.forValue((w, I, V) => {
|
@@ -1323,10 +1326,10 @@ let Zt = class extends Dt {
|
|
1323
1326
|
},
|
1324
1327
|
R
|
1325
1328
|
), { row: S, col: g } = h(_.startRow, _.startColumn);
|
1326
|
-
|
1329
|
+
s.setValue(S, g, V), l.add(V);
|
1327
1330
|
});
|
1328
1331
|
});
|
1329
|
-
const v = Array.from(
|
1332
|
+
const v = Array.from(l).map((R) => ({ id: R, ranges: Je(s, (f) => f === R) }));
|
1330
1333
|
r.addRangeRules(v);
|
1331
1334
|
const { redoMutations: p, undoMutations: C } = on(
|
1332
1335
|
a,
|
@@ -1431,8 +1434,8 @@ const To = {
|
|
1431
1434
|
}
|
1432
1435
|
};
|
1433
1436
|
let Jt = class extends mn {
|
1434
|
-
constructor(t, e, o, n, a, i, r,
|
1435
|
-
super(), this._commandService = t, this._menuManagerService = e, this._renderManagerService = o, this._univerInstanceService = n, this._autoHeightController = a, this._dropdownManagerService = i, this._sheetDataValidationModel = r, this._dataValidatorRegistryService =
|
1437
|
+
constructor(t, e, o, n, a, i, r, s, l, c, u) {
|
1438
|
+
super(), this._commandService = t, this._menuManagerService = e, this._renderManagerService = o, this._univerInstanceService = n, this._autoHeightController = a, this._dropdownManagerService = i, this._sheetDataValidationModel = r, this._dataValidatorRegistryService = s, this._sheetInterceptorService = l, this._dataValidationCacheService = c, this._editorBridgeService = u, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
1436
1439
|
}
|
1437
1440
|
_initMenu() {
|
1438
1441
|
this._menuManagerService.mergeMenu(or);
|
@@ -1446,16 +1449,16 @@ let Jt = class extends mn {
|
|
1446
1449
|
}
|
1447
1450
|
const e = this._editorBridgeService.getEditCellState();
|
1448
1451
|
if (e) {
|
1449
|
-
const { unitId: n, sheetId: a, row: i, column: r } = e,
|
1450
|
-
if (!l)
|
1451
|
-
return;
|
1452
|
-
const s = this._sheetDataValidationModel.getRuleByLocation(n, a, i, r);
|
1452
|
+
const { unitId: n, sheetId: a, row: i, column: r } = e, s = this._univerInstanceService.getUniverSheetInstance(n);
|
1453
1453
|
if (!s)
|
1454
1454
|
return;
|
1455
|
-
const
|
1455
|
+
const l = this._sheetDataValidationModel.getRuleByLocation(n, a, i, r);
|
1456
|
+
if (!l)
|
1457
|
+
return;
|
1458
|
+
const c = this._dataValidatorRegistryService.getValidatorItem(l.type);
|
1456
1459
|
if (!(c != null && c.dropdown))
|
1457
1460
|
return;
|
1458
|
-
const u =
|
1461
|
+
const u = s.getActiveSheet();
|
1459
1462
|
if (!u) return;
|
1460
1463
|
const h = this._dropdownManagerService.activeDropdown, d = h == null ? void 0 : h.location;
|
1461
1464
|
if (d && d.unitId === n && d.subUnitId === a && d.row === i && d.col === r)
|
@@ -1467,7 +1470,7 @@ let Jt = class extends mn {
|
|
1467
1470
|
subUnitId: a,
|
1468
1471
|
row: i,
|
1469
1472
|
col: r,
|
1470
|
-
workbook:
|
1473
|
+
workbook: s,
|
1471
1474
|
worksheet: u
|
1472
1475
|
},
|
1473
1476
|
componentKey: c.dropdown,
|
@@ -1492,7 +1495,7 @@ let Jt = class extends mn {
|
|
1492
1495
|
// eslint-disable-next-line max-lines-per-function, complexity
|
1493
1496
|
handler: (t, e, o) => {
|
1494
1497
|
var f, w, I, V, _;
|
1495
|
-
const { row: n, col: a, unitId: i, subUnitId: r, workbook:
|
1498
|
+
const { row: n, col: a, unitId: i, subUnitId: r, workbook: s, worksheet: l } = e, c = this._sheetDataValidationModel.getRuleIdByLocation(i, r, n, a);
|
1496
1499
|
if (!c)
|
1497
1500
|
return o(t);
|
1498
1501
|
const u = this._sheetDataValidationModel.getRuleById(i, r, c);
|
@@ -1529,7 +1532,7 @@ let Jt = class extends mn {
|
|
1529
1532
|
...t == null ? void 0 : t.interceptorStyle,
|
1530
1533
|
...d == null ? void 0 : d.getExtraStyle(u, R.value, {
|
1531
1534
|
get style() {
|
1532
|
-
const S =
|
1535
|
+
const S = s.getStyles();
|
1533
1536
|
return (typeof (t == null ? void 0 : t.s) == "string" ? S.get(t == null ? void 0 : t.s) : t == null ? void 0 : t.s) || {};
|
1534
1537
|
}
|
1535
1538
|
}, n, a)
|
@@ -1547,8 +1550,8 @@ let Jt = class extends mn {
|
|
1547
1550
|
subUnitId: r,
|
1548
1551
|
row: n,
|
1549
1552
|
col: a,
|
1550
|
-
workbook:
|
1551
|
-
worksheet:
|
1553
|
+
workbook: s,
|
1554
|
+
worksheet: l
|
1552
1555
|
};
|
1553
1556
|
return (k = (A = d == null ? void 0 : d.canvasRender) == null ? void 0 : A.calcCellAutoHeight) == null ? void 0 : k.call(A, y);
|
1554
1557
|
},
|
@@ -1565,8 +1568,8 @@ let Jt = class extends mn {
|
|
1565
1568
|
subUnitId: r,
|
1566
1569
|
row: n,
|
1567
1570
|
col: a,
|
1568
|
-
workbook:
|
1569
|
-
worksheet:
|
1571
|
+
workbook: s,
|
1572
|
+
worksheet: l
|
1570
1573
|
};
|
1571
1574
|
return (k = (A = d == null ? void 0 : d.canvasRender) == null ? void 0 : A.calcCellAutoWidth) == null ? void 0 : k.call(A, y);
|
1572
1575
|
},
|
@@ -1625,13 +1628,13 @@ let $n = class extends mn {
|
|
1625
1628
|
// eslint-disable-next-line complexity
|
1626
1629
|
handler: (t, e, o) => {
|
1627
1630
|
var R, f, w, I, V;
|
1628
|
-
const { row: n, col: a, unitId: i, subUnitId: r, workbook:
|
1631
|
+
const { row: n, col: a, unitId: i, subUnitId: r, workbook: s, worksheet: l } = e, c = this._sheetDataValidationModel.getRuleIdByLocation(i, r, n, a);
|
1629
1632
|
if (!c)
|
1630
1633
|
return o(t);
|
1631
1634
|
const u = this._sheetDataValidationModel.getRuleById(i, r, c);
|
1632
1635
|
if (!u)
|
1633
1636
|
return o(t);
|
1634
|
-
const h = (R = this._dataValidationCacheService.getValue(i, r, n, a)) != null ? R : se.VALID, d = this._dataValidatorRegistryService.getValidatorItem(u.type), v =
|
1637
|
+
const h = (R = this._dataValidationCacheService.getValue(i, r, n, a)) != null ? R : se.VALID, d = this._dataValidatorRegistryService.getValidatorItem(u.type), v = l.getCellRaw(n, a), p = rt(v), C = `${p != null ? p : ""}`;
|
1635
1638
|
return o({
|
1636
1639
|
...t,
|
1637
1640
|
markers: {
|
@@ -1650,7 +1653,7 @@ let $n = class extends mn {
|
|
1650
1653
|
...t == null ? void 0 : t.interceptorStyle,
|
1651
1654
|
...d == null ? void 0 : d.getExtraStyle(u, C, {
|
1652
1655
|
get style() {
|
1653
|
-
const _ =
|
1656
|
+
const _ = s.getStyles();
|
1654
1657
|
return (typeof (t == null ? void 0 : t.s) == "string" ? _.get(t == null ? void 0 : t.s) : t == null ? void 0 : t.s) || {};
|
1655
1658
|
}
|
1656
1659
|
}, n, a)
|
@@ -1668,8 +1671,8 @@ let $n = class extends mn {
|
|
1668
1671
|
subUnitId: r,
|
1669
1672
|
row: n,
|
1670
1673
|
col: a,
|
1671
|
-
workbook:
|
1672
|
-
worksheet:
|
1674
|
+
workbook: s,
|
1675
|
+
worksheet: l
|
1673
1676
|
};
|
1674
1677
|
return (A = (b = d == null ? void 0 : d.canvasRender) == null ? void 0 : b.calcCellAutoHeight) == null ? void 0 : A.call(b, g);
|
1675
1678
|
},
|
@@ -1745,9 +1748,9 @@ const sr = "univer-data-validation-formula", lr = "univer-data-validation-formul
|
|
1745
1748
|
dataValidationFormulaColorSelectPanel: mr,
|
1746
1749
|
dataValidationFormulaColorItem: gr
|
1747
1750
|
}, fr = (t) => {
|
1748
|
-
const { isTwoFormula: e = !1, value: o, onChange: n, showError: a, validResult: i } = t, r = L(Q),
|
1751
|
+
const { isTwoFormula: e = !1, value: o, onChange: n, showError: a, validResult: i } = t, r = L(Q), s = a ? i == null ? void 0 : i.formula1 : "", l = a ? i == null ? void 0 : i.formula2 : "";
|
1749
1752
|
return e ? /* @__PURE__ */ j(wt, { children: [
|
1750
|
-
/* @__PURE__ */ m(q, { error:
|
1753
|
+
/* @__PURE__ */ m(q, { error: s, children: /* @__PURE__ */ m(
|
1751
1754
|
Nt,
|
1752
1755
|
{
|
1753
1756
|
className: ot.dataValidationFormula,
|
@@ -1762,7 +1765,7 @@ const sr = "univer-data-validation-formula", lr = "univer-data-validation-formul
|
|
1762
1765
|
}
|
1763
1766
|
) }),
|
1764
1767
|
/* @__PURE__ */ m("div", { className: ot.dataValidationFormulaAnd, children: r.t("dataValidation.panel.formulaAnd") }),
|
1765
|
-
/* @__PURE__ */ m(q, { error:
|
1768
|
+
/* @__PURE__ */ m(q, { error: l, children: /* @__PURE__ */ m(
|
1766
1769
|
Nt,
|
1767
1770
|
{
|
1768
1771
|
className: ot.dataValidationFormula,
|
@@ -1776,7 +1779,7 @@ const sr = "univer-data-validation-formula", lr = "univer-data-validation-formul
|
|
1776
1779
|
}
|
1777
1780
|
}
|
1778
1781
|
) })
|
1779
|
-
] }) : /* @__PURE__ */ m(q, { error:
|
1782
|
+
] }) : /* @__PURE__ */ m(q, { error: s, children: /* @__PURE__ */ m(
|
1780
1783
|
Nt,
|
1781
1784
|
{
|
1782
1785
|
className: ot.dataValidationFormula,
|
@@ -1789,12 +1792,12 @@ const sr = "univer-data-validation-formula", lr = "univer-data-validation-formul
|
|
1789
1792
|
) });
|
1790
1793
|
};
|
1791
1794
|
function vr(t) {
|
1792
|
-
const { value: e, onChange: o, showError: n, validResult: a } = t, i = L(Q), r = n ? a == null ? void 0 : a.formula1 : "",
|
1795
|
+
const { value: e, onChange: o, showError: n, validResult: a } = t, i = L(Q), r = n ? a == null ? void 0 : a.formula1 : "", s = n ? a == null ? void 0 : a.formula2 : "", [l, c] = x(!((e == null ? void 0 : e.formula1) === void 0 && (e == null ? void 0 : e.formula2) === void 0));
|
1793
1796
|
return /* @__PURE__ */ j(wt, { children: [
|
1794
1797
|
/* @__PURE__ */ m(q, { children: /* @__PURE__ */ m(
|
1795
1798
|
Le,
|
1796
1799
|
{
|
1797
|
-
checked:
|
1800
|
+
checked: l,
|
1798
1801
|
onChange: (u) => {
|
1799
1802
|
u ? c(!0) : (c(!1), o == null || o({
|
1800
1803
|
...e,
|
@@ -1805,7 +1808,7 @@ function vr(t) {
|
|
1805
1808
|
children: i.t("dataValidation.checkbox.tips")
|
1806
1809
|
}
|
1807
1810
|
) }),
|
1808
|
-
|
1811
|
+
l ? /* @__PURE__ */ m(q, { label: i.t("dataValidation.checkbox.checked"), error: r, children: /* @__PURE__ */ m(
|
1809
1812
|
Nt,
|
1810
1813
|
{
|
1811
1814
|
className: ot.dataValidationFormula,
|
@@ -1819,7 +1822,7 @@ function vr(t) {
|
|
1819
1822
|
}
|
1820
1823
|
}
|
1821
1824
|
) }) : null,
|
1822
|
-
|
1825
|
+
l ? /* @__PURE__ */ m(q, { label: i.t("dataValidation.checkbox.unchecked"), error: s, children: /* @__PURE__ */ m(
|
1823
1826
|
Nt,
|
1824
1827
|
{
|
1825
1828
|
className: ot.dataValidationFormula,
|
@@ -1837,10 +1840,10 @@ function vr(t) {
|
|
1837
1840
|
}
|
1838
1841
|
function _r(t) {
|
1839
1842
|
var h;
|
1840
|
-
const { unitId: e, subUnitId: o, value: n, onChange: a, showError: i, validResult: r } = t,
|
1843
|
+
const { unitId: e, subUnitId: o, value: n, onChange: a, showError: i, validResult: r } = t, s = i ? r == null ? void 0 : r.formula1 : void 0, l = zt({}), [c, u] = x(!1);
|
1841
1844
|
return Sn((d) => {
|
1842
1845
|
var p;
|
1843
|
-
const v = (p =
|
1846
|
+
const v = (p = l.current) == null ? void 0 : p.handleOutClick;
|
1844
1847
|
v && v(d, () => u(!1));
|
1845
1848
|
}), /* @__PURE__ */ m(
|
1846
1849
|
vo,
|
@@ -1856,9 +1859,9 @@ function _r(t) {
|
|
1856
1859
|
formula1: v
|
1857
1860
|
}));
|
1858
1861
|
},
|
1859
|
-
errorText:
|
1862
|
+
errorText: s,
|
1860
1863
|
onFocus: () => u(!0),
|
1861
|
-
actions:
|
1864
|
+
actions: l.current,
|
1862
1865
|
isSupportAcrossSheet: !0
|
1863
1866
|
}
|
1864
1867
|
);
|
@@ -1964,23 +1967,23 @@ const Cr = [
|
|
1964
1967
|
};
|
1965
1968
|
function wr(t) {
|
1966
1969
|
const { value: e, onChange: o = () => {
|
1967
|
-
}, unitId: n, subUnitId: a, validResult: i, showError: r, ruleId:
|
1970
|
+
}, unitId: n, subUnitId: a, validResult: i, showError: r, ruleId: s } = t, { formula1: l = "", formula2: c = "" } = e || {}, u = zt(null), [h, d] = x(() => At(l) ? "1" : "0"), [v, p] = x(h === "1" ? l : "="), [C, R] = x(h === "1" ? l : "="), f = L(Q), w = L(Et), I = L(Pe), V = L(_a), [_, S] = x(() => c.split(",")), g = w.getValidatorItem(K.LIST), [y, T] = x([]), [N, P] = x(""), b = r ? i == null ? void 0 : i.formula1 : "", A = Kt(() => I.ruleChange$.pipe(wn(16)), []), k = $t(A), F = ln(o);
|
1968
1971
|
It(() => {
|
1969
1972
|
(async () => {
|
1970
1973
|
await new Promise(($) => {
|
1971
1974
|
setTimeout(() => $(!0), 100);
|
1972
1975
|
});
|
1973
|
-
const D = I.getRuleById(n, a,
|
1976
|
+
const D = I.getRuleById(n, a, s), B = D == null ? void 0 : D.formula1;
|
1974
1977
|
if (At(B) && g && D) {
|
1975
1978
|
const $ = await g.getListAsync(D, n, a);
|
1976
1979
|
T($);
|
1977
1980
|
}
|
1978
1981
|
})();
|
1979
|
-
}, [I, k, g,
|
1980
|
-
At(
|
1981
|
-
}, [C,
|
1982
|
+
}, [I, k, g, s, a, n]), It(() => {
|
1983
|
+
At(l) && l !== C && (p(l), R(C));
|
1984
|
+
}, [C, l]);
|
1982
1985
|
const [U, Y] = x(() => {
|
1983
|
-
const D = h !== "1" ? oo(
|
1986
|
+
const D = h !== "1" ? oo(l) : [], B = c.split(",");
|
1984
1987
|
return D.map(($, W) => ({
|
1985
1988
|
label: $,
|
1986
1989
|
color: B[W] || kt,
|
@@ -2001,7 +2004,7 @@ function wr(t) {
|
|
2001
2004
|
})), [G, y]), et = (D, B, $) => {
|
2002
2005
|
const W = [..._];
|
2003
2006
|
W[+D] = $, S(W), F({
|
2004
|
-
formula1:
|
2007
|
+
formula1: l,
|
2005
2008
|
formula2: W.join(",")
|
2006
2009
|
});
|
2007
2010
|
}, nt = () => {
|
@@ -2183,32 +2186,32 @@ let dn = class {
|
|
2183
2186
|
_calc(t, e) {
|
2184
2187
|
var c, u, h;
|
2185
2188
|
const { vt: o, ht: n } = e || {}, a = t.endX - t.startX - pe * 2, i = t.endY - t.startY, r = ((c = e == null ? void 0 : e.fs) != null ? c : 10) * 1.6;
|
2186
|
-
let
|
2189
|
+
let s = 0, l = 0;
|
2187
2190
|
switch (o) {
|
2188
2191
|
case ht.TOP:
|
2189
|
-
|
2192
|
+
l = 0;
|
2190
2193
|
break;
|
2191
2194
|
case ht.BOTTOM:
|
2192
|
-
|
2195
|
+
l = 0 + (i - r);
|
2193
2196
|
break;
|
2194
2197
|
default:
|
2195
|
-
|
2198
|
+
l = 0 + (i - r) / 2;
|
2196
2199
|
break;
|
2197
2200
|
}
|
2198
2201
|
switch (n) {
|
2199
2202
|
case Yt.LEFT:
|
2200
|
-
|
2203
|
+
s = pe;
|
2201
2204
|
break;
|
2202
2205
|
case Yt.RIGHT:
|
2203
|
-
|
2206
|
+
s = pe + (a - r);
|
2204
2207
|
break;
|
2205
2208
|
default:
|
2206
|
-
|
2209
|
+
s = pe + (a - r) / 2;
|
2207
2210
|
break;
|
2208
2211
|
}
|
2209
2212
|
return {
|
2210
|
-
left: t.startX +
|
2211
|
-
top: t.startY +
|
2213
|
+
left: t.startX + s,
|
2214
|
+
top: t.startY + l,
|
2212
2215
|
width: ((u = e == null ? void 0 : e.fs) != null ? u : 10) * 1.6,
|
2213
2216
|
height: ((h = e == null ? void 0 : e.fs) != null ? h : 10) * 1.6
|
2214
2217
|
};
|
@@ -2225,23 +2228,23 @@ let dn = class {
|
|
2225
2228
|
}
|
2226
2229
|
async _parseFormula(t, e, o) {
|
2227
2230
|
var c, u, h, d, v, p, C, R, f;
|
2228
|
-
const { formula1: n = Ia, formula2: a = Ca } = t, i = await this._formulaService.getRuleFormulaResult(e, o, t.uid), r = Ue((h = (u = (c = i == null ? void 0 : i[0]) == null ? void 0 : c.result) == null ? void 0 : u[0]) == null ? void 0 : h[0]),
|
2231
|
+
const { formula1: n = Ia, formula2: a = Ca } = t, i = await this._formulaService.getRuleFormulaResult(e, o, t.uid), r = Ue((h = (u = (c = i == null ? void 0 : i[0]) == null ? void 0 : c.result) == null ? void 0 : u[0]) == null ? void 0 : h[0]), s = Ue((p = (v = (d = i == null ? void 0 : i[1]) == null ? void 0 : d.result) == null ? void 0 : v[0]) == null ? void 0 : p[0]), l = Ln(String(r)) && Ln(String(s));
|
2229
2232
|
return {
|
2230
2233
|
formula1: At(n) ? Ue((f = (R = (C = i == null ? void 0 : i[0]) == null ? void 0 : C.result) == null ? void 0 : R[0]) == null ? void 0 : f[0]) : n,
|
2231
|
-
formula2: At(a) ?
|
2232
|
-
isFormulaValid:
|
2234
|
+
formula2: At(a) ? s : a,
|
2235
|
+
isFormulaValid: l
|
2233
2236
|
};
|
2234
2237
|
}
|
2235
2238
|
drawWith(t, e) {
|
2236
2239
|
var b, A, k, F;
|
2237
|
-
const { style: o, primaryWithCoord: n, unitId: a, subUnitId: i, worksheet: r, row:
|
2240
|
+
const { style: o, primaryWithCoord: n, unitId: a, subUnitId: i, worksheet: r, row: s, col: l } = e, c = n.isMergedMainCell ? n.mergeInfo : n, u = rt(r.getCellRaw(s, l)), h = this._dataValidationModel.getRuleByLocation(a, i, s, l);
|
2238
2241
|
if (!h)
|
2239
2242
|
return;
|
2240
2243
|
const d = this._dataValidationModel.getValidator(h.type);
|
2241
2244
|
if (!d)
|
2242
2245
|
return;
|
2243
2246
|
const v = this._themeService.getCurrentTheme();
|
2244
|
-
if (!((b = d.skipDefaultFontRender) != null && b.call(d, h, u, { unitId: a, subUnitId: i, row:
|
2247
|
+
if (!((b = d.skipDefaultFontRender) != null && b.call(d, h, u, { unitId: a, subUnitId: i, row: s, column: l })))
|
2245
2248
|
return;
|
2246
2249
|
const p = d.parseFormulaSync(h, a, i), { formula1: C } = p, R = this._calc(c, o), { a: f, d: w } = t.getTransform(), I = bn(R.left, f), V = bn(R.top, w), _ = ra.create().composeMatrix({
|
2247
2250
|
left: I,
|
@@ -2266,18 +2269,18 @@ let dn = class {
|
|
2266
2269
|
}), t.restore();
|
2267
2270
|
}
|
2268
2271
|
isHit(t, e) {
|
2269
|
-
const o = e.primaryWithCoord.isMergedMainCell ? e.primaryWithCoord.mergeInfo : e.primaryWithCoord, n = this._calc(o, e.style), a = n.top, i = n.top + n.height, r = n.left,
|
2270
|
-
return
|
2272
|
+
const o = e.primaryWithCoord.isMergedMainCell ? e.primaryWithCoord.mergeInfo : e.primaryWithCoord, n = this._calc(o, e.style), a = n.top, i = n.top + n.height, r = n.left, s = n.left + n.width, { x: l, y: c } = t;
|
2273
|
+
return l <= s && l >= r && c <= i && c >= a;
|
2271
2274
|
}
|
2272
2275
|
async onPointerDown(t, e) {
|
2273
2276
|
var p;
|
2274
2277
|
if (e.button === 2)
|
2275
2278
|
return;
|
2276
|
-
const { primaryWithCoord: o, unitId: n, subUnitId: a, worksheet: i, row: r, col:
|
2279
|
+
const { primaryWithCoord: o, unitId: n, subUnitId: a, worksheet: i, row: r, col: s } = t, l = rt(i.getCellRaw(r, s)), c = this._dataValidationModel.getRuleByLocation(n, a, r, s);
|
2277
2280
|
if (!c)
|
2278
2281
|
return;
|
2279
2282
|
const u = this._dataValidationModel.getValidator(c.type);
|
2280
|
-
if (!u || !((p = u.skipDefaultFontRender) != null && p.call(u, c,
|
2283
|
+
if (!u || !((p = u.skipDefaultFontRender) != null && p.call(u, c, l, { unitId: n, subUnitId: a, row: r, column: s })))
|
2281
2284
|
return;
|
2282
2285
|
const { formula1: h, formula2: d } = await this._parseFormula(c, n, a), v = {
|
2283
2286
|
range: {
|
@@ -2287,7 +2290,7 @@ let dn = class {
|
|
2287
2290
|
endRow: o.actualRow
|
2288
2291
|
},
|
2289
2292
|
value: {
|
2290
|
-
v: String(
|
2293
|
+
v: String(l) === wa(String(h)) ? d : h,
|
2291
2294
|
p: null
|
2292
2295
|
}
|
2293
2296
|
};
|
@@ -2371,25 +2374,25 @@ function Nr(t, e) {
|
|
2371
2374
|
};
|
2372
2375
|
}
|
2373
2376
|
function je(t, e, o, n) {
|
2374
|
-
const a = Pt + cn * 2, i = o - a, r = n - Oe * 2,
|
2377
|
+
const a = Pt + cn * 2, i = o - a, r = n - Oe * 2, s = t.map((d) => ({
|
2375
2378
|
layout: Nr(d, e),
|
2376
2379
|
text: d
|
2377
2380
|
}));
|
2378
|
-
let
|
2381
|
+
let l;
|
2379
2382
|
const c = [];
|
2380
|
-
|
2383
|
+
s.forEach((d) => {
|
2381
2384
|
const { layout: v } = d, { width: p, height: C } = v;
|
2382
|
-
!
|
2385
|
+
!l || l.width + p + xe > i ? (l = {
|
2383
2386
|
width: p,
|
2384
2387
|
height: C,
|
2385
2388
|
items: [{
|
2386
2389
|
...d,
|
2387
2390
|
left: 0
|
2388
2391
|
}]
|
2389
|
-
}, c.push(
|
2392
|
+
}, c.push(l)) : (l.items.push({
|
2390
2393
|
...d,
|
2391
|
-
left:
|
2392
|
-
}),
|
2394
|
+
left: l.width + xe
|
2395
|
+
}), l.width = l.width + p + xe);
|
2393
2396
|
});
|
2394
2397
|
let u = 0, h = 0;
|
2395
2398
|
return c.forEach((d, v) => {
|
@@ -2406,13 +2409,13 @@ function je(t, e, o, n) {
|
|
2406
2409
|
const Ur = 8;
|
2407
2410
|
class Br extends da {
|
2408
2411
|
static drawWith(e, o) {
|
2409
|
-
const { fontString: n, info: a, fill: i, color: r } = o, { layout:
|
2412
|
+
const { fontString: n, info: a, fill: i, color: r } = o, { layout: s, text: l } = a;
|
2410
2413
|
e.save(), qn.drawWith(e, {
|
2411
|
-
width:
|
2412
|
-
height:
|
2414
|
+
width: s.width,
|
2415
|
+
height: s.height,
|
2413
2416
|
radius: Ur,
|
2414
2417
|
fill: i || kt
|
2415
|
-
}), e.translateWithPrecision(Fo,
|
2418
|
+
}), e.translateWithPrecision(Fo, s.ba), e.font = n, e.fillStyle = r, e.fillText(l, 0, 0), e.restore();
|
2416
2419
|
}
|
2417
2420
|
}
|
2418
2421
|
var $r = Object.getOwnPropertyDescriptor, Wr = (t, e, o, n) => {
|
@@ -2450,7 +2453,7 @@ let un = class {
|
|
2450
2453
|
// eslint-disable-next-line max-lines-per-function
|
2451
2454
|
drawWith(t, e, o, n) {
|
2452
2455
|
var z, H;
|
2453
|
-
const { primaryWithCoord: a, row: i, col: r, style:
|
2456
|
+
const { primaryWithCoord: a, row: i, col: r, style: s, data: l, subUnitId: c } = e, u = a.isMergedMainCell ? a.mergeInfo : a, h = l == null ? void 0 : l.fontRenderExtension, { leftOffset: d = 0, rightOffset: v = 0, topOffset: p = 0, downOffset: C = 0 } = h || {}, R = this._ensureMap(c), f = this._generateKey(i, r), w = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, i, r);
|
2454
2457
|
if (!w)
|
2455
2458
|
return;
|
2456
2459
|
const I = this._dataValidationModel.getValidator(w.type);
|
@@ -2461,7 +2464,7 @@ let un = class {
|
|
2461
2464
|
endX: u.endX - v,
|
2462
2465
|
startY: u.startY + p,
|
2463
2466
|
endY: u.endY - C
|
2464
|
-
}, _ = V.endX - V.startX, S = V.endY - V.startY, { cl: g } =
|
2467
|
+
}, _ = V.endX - V.startX, S = V.endY - V.startY, { cl: g } = s || {}, y = (z = typeof g == "object" ? g == null ? void 0 : g.rgb : g) != null ? z : "#000", T = Ne(s != null ? s : void 0), { vt: N, ht: P } = s || {}, b = N != null ? N : ht.MIDDLE, A = (H = rt(l)) != null ? H : "", k = I.parseCellValue(A), F = I.getListWithColorMap(w), U = je(k, T, _, S);
|
2465
2468
|
this._drawDownIcon(t, V, _, S, b), t.save(), t.translateWithPrecision(V.startX, V.startY), t.beginPath(), t.rect(0, 0, _ - Pt, S), t.clip(), t.translateWithPrecision(cn, Oe);
|
2466
2469
|
let Y = 0;
|
2467
2470
|
switch (b) {
|
@@ -2501,9 +2504,9 @@ let un = class {
|
|
2501
2504
|
}
|
2502
2505
|
calcCellAutoHeight(t) {
|
2503
2506
|
var _;
|
2504
|
-
const { primaryWithCoord: e, style: o, data: n, row: a, col: i } = t, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset:
|
2505
|
-
startX: h.startX +
|
2506
|
-
endX: h.endX -
|
2507
|
+
const { primaryWithCoord: e, style: o, data: n, row: a, col: i } = t, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset: l = 0, topOffset: c = 0, downOffset: u = 0 } = r || {}, h = e.isMergedMainCell ? e.mergeInfo : e, d = {
|
2508
|
+
startX: h.startX + s,
|
2509
|
+
endX: h.endX - l,
|
2507
2510
|
startY: h.startY + c,
|
2508
2511
|
endY: h.endY - u
|
2509
2512
|
}, v = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, a, i);
|
@@ -2517,9 +2520,9 @@ let un = class {
|
|
2517
2520
|
}
|
2518
2521
|
calcCellAutoWidth(t) {
|
2519
2522
|
var _;
|
2520
|
-
const { primaryWithCoord: e, style: o, data: n, row: a, col: i } = t, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset:
|
2521
|
-
startX: h.startX +
|
2522
|
-
endX: h.endX -
|
2523
|
+
const { primaryWithCoord: e, style: o, data: n, row: a, col: i } = t, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset: l = 0, topOffset: c = 0, downOffset: u = 0 } = r || {}, h = e.isMergedMainCell ? e.mergeInfo : e, d = {
|
2524
|
+
startX: h.startX + s,
|
2525
|
+
endX: h.endX - l,
|
2523
2526
|
startY: h.startY + c,
|
2524
2527
|
endY: h.endY - u
|
2525
2528
|
}, v = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, a, i);
|
@@ -2639,20 +2642,20 @@ function fe(t, e, o) {
|
|
2639
2642
|
};
|
2640
2643
|
}
|
2641
2644
|
function jn(t, e, o, n, a, i, r = !0) {
|
2642
|
-
let
|
2643
|
-
const
|
2645
|
+
let s = 0;
|
2646
|
+
const l = r ? jt : 0;
|
2644
2647
|
switch (a) {
|
2645
2648
|
case ht.BOTTOM:
|
2646
|
-
|
2649
|
+
s = e - n - l;
|
2647
2650
|
break;
|
2648
2651
|
case ht.MIDDLE:
|
2649
|
-
|
2652
|
+
s = (e - n) / 2;
|
2650
2653
|
break;
|
2651
2654
|
default:
|
2652
|
-
|
2655
|
+
s = l;
|
2653
2656
|
break;
|
2654
2657
|
}
|
2655
|
-
|
2658
|
+
s = Math.max(jt, s);
|
2656
2659
|
let c = 0;
|
2657
2660
|
switch (i) {
|
2658
2661
|
case Yt.CENTER:
|
@@ -2664,7 +2667,7 @@ function jn(t, e, o, n, a, i, r = !0) {
|
|
2664
2667
|
}
|
2665
2668
|
return c = Math.max(mt, c), {
|
2666
2669
|
paddingLeft: c,
|
2667
|
-
paddingTop:
|
2670
|
+
paddingTop: s
|
2668
2671
|
};
|
2669
2672
|
}
|
2670
2673
|
let hn = class {
|
@@ -2681,30 +2684,30 @@ let hn = class {
|
|
2681
2684
|
return `${t}.${e}`;
|
2682
2685
|
}
|
2683
2686
|
_drawDownIcon(t, e, o, n, a, i, r) {
|
2684
|
-
const { t:
|
2687
|
+
const { t: s = dt.pd.t, b: l = dt.pd.b } = r, c = o - pt;
|
2685
2688
|
let u;
|
2686
2689
|
switch (i) {
|
2687
2690
|
case ht.MIDDLE:
|
2688
2691
|
u = (n - ge) / 2;
|
2689
2692
|
break;
|
2690
2693
|
case ht.BOTTOM:
|
2691
|
-
u = n -
|
2694
|
+
u = n - l - a - jt + (a / 2 - ge / 2);
|
2692
2695
|
break;
|
2693
2696
|
default:
|
2694
|
-
u =
|
2697
|
+
u = s + jt + (a / 2 - ge / 2);
|
2695
2698
|
break;
|
2696
2699
|
}
|
2697
2700
|
t.save(), t.translateWithPrecision(e.startX + c, e.startY + u), t.fillStyle = "#565656", t.fill(xn), t.restore();
|
2698
2701
|
}
|
2699
2702
|
// eslint-disable-next-line max-lines-per-function, complexity
|
2700
2703
|
drawWith(t, e, o) {
|
2701
|
-
const { primaryWithCoord: n, row: a, col: i, style: r, data:
|
2704
|
+
const { primaryWithCoord: n, row: a, col: i, style: r, data: s, subUnitId: l } = e, c = n.isMergedMainCell ? n.mergeInfo : n, u = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i);
|
2702
2705
|
if (!u)
|
2703
2706
|
return;
|
2704
2707
|
const h = this._dataValidationModel.getValidator(u.type);
|
2705
2708
|
if (!h)
|
2706
2709
|
return;
|
2707
|
-
const d =
|
2710
|
+
const d = s == null ? void 0 : s.fontRenderExtension, { leftOffset: v = 0, rightOffset: p = 0, topOffset: C = 0, downOffset: R = 0 } = d || {};
|
2708
2711
|
if (!u || !h || !h || h.id.indexOf(K.LIST) !== 0 || !h.skipDefaultFontRender(u))
|
2709
2712
|
return;
|
2710
2713
|
const f = {
|
@@ -2712,7 +2715,7 @@ let hn = class {
|
|
2712
2715
|
endX: c.endX - p,
|
2713
2716
|
startY: c.startY + C,
|
2714
2717
|
endY: c.endY - R
|
2715
|
-
}, w = f.endX - f.startX, I = f.endY - f.startY, V = this._ensureMap(
|
2718
|
+
}, w = f.endX - f.startX, I = f.endY - f.startY, V = this._ensureMap(l), _ = this._generateKey(a, i), S = h.getListWithColor(u), g = rt(s), y = `${g != null ? g : ""}`, T = S.find((k) => k.label === y);
|
2716
2719
|
let { tb: N, vt: P, ht: b, pd: A } = r || {};
|
2717
2720
|
if (N = N != null ? N : Ct.WRAP, P = P != null ? P : ht.BOTTOM, b = b != null ? b : dt.ht, A = A != null ? A : dt.pd, u.renderMode === ct.ARROW) {
|
2718
2721
|
const { l: k = dt.pd.l, t: F = dt.pd.t, r: U = dt.pd.r, b: Y = dt.pd.b } = A, z = w - k - U - pt - 4, { documentSkeleton: H, documents: G, docModel: J } = fe(y, this._localeService, r);
|
@@ -2745,11 +2748,11 @@ let hn = class {
|
|
2745
2748
|
}
|
2746
2749
|
}
|
2747
2750
|
calcCellAutoHeight(t) {
|
2748
|
-
const { primaryWithCoord: e, style: o, data: n, row: a, col: i } = t, r = e.isMergedMainCell ? e.mergeInfo : e,
|
2751
|
+
const { primaryWithCoord: e, style: o, data: n, row: a, col: i } = t, r = e.isMergedMainCell ? e.mergeInfo : e, s = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: c = 0, topOffset: u = 0, downOffset: h = 0 } = s || {}, d = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, a, i);
|
2749
2752
|
if (!d || d.renderMode === ct.TEXT)
|
2750
2753
|
return;
|
2751
2754
|
const v = {
|
2752
|
-
startX: r.startX +
|
2755
|
+
startX: r.startX + l,
|
2753
2756
|
endX: r.endX - c,
|
2754
2757
|
startY: r.startY + u,
|
2755
2758
|
endY: r.endY - h
|
@@ -2771,11 +2774,11 @@ let hn = class {
|
|
2771
2774
|
}
|
2772
2775
|
}
|
2773
2776
|
calcCellAutoWidth(t) {
|
2774
|
-
const { primaryWithCoord: e, style: o, data: n, row: a, col: i } = t, r = e.isMergedMainCell ? e.mergeInfo : e,
|
2777
|
+
const { primaryWithCoord: e, style: o, data: n, row: a, col: i } = t, r = e.isMergedMainCell ? e.mergeInfo : e, s = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: c = 0, topOffset: u = 0, downOffset: h = 0 } = s || {}, d = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, a, i);
|
2775
2778
|
if (!d || d.renderMode === ct.TEXT)
|
2776
2779
|
return;
|
2777
2780
|
const v = {
|
2778
|
-
startX: r.startX +
|
2781
|
+
startX: r.startX + l,
|
2779
2782
|
endX: r.endX - c,
|
2780
2783
|
startY: r.startY + u,
|
2781
2784
|
endY: r.endY - h
|
@@ -2799,11 +2802,11 @@ let hn = class {
|
|
2799
2802
|
return f === Ct.WRAP && y.updateDocumentDataPageSize(Math.max(S, 1)), g.calculate(), g.getActualSize(), ne(g).width + _;
|
2800
2803
|
}
|
2801
2804
|
isHit(t, e) {
|
2802
|
-
const { subUnitId: o, row: n, col: a } = e, r = this._ensureMap(o).get(this._generateKey(n, a)),
|
2803
|
-
if (!
|
2805
|
+
const { subUnitId: o, row: n, col: a } = e, r = this._ensureMap(o).get(this._generateKey(n, a)), s = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, n, a);
|
2806
|
+
if (!s || !r || s.renderMode === ct.TEXT)
|
2804
2807
|
return !1;
|
2805
|
-
const { top:
|
2806
|
-
return d >= c && d <= c + u && v >=
|
2808
|
+
const { top: l, left: c, width: u, height: h } = r, { x: d, y: v } = t;
|
2809
|
+
return d >= c && d <= c + u && v >= l && v <= l + h;
|
2807
2810
|
}
|
2808
2811
|
onPointerDown(t, e) {
|
2809
2812
|
if (e.button === 2)
|