e-virt-table 1.2.17 → 1.2.19
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/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +817 -795
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Cell.d.ts +2 -1
- package/dist/lib/Cell.js +7 -0
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/Config.d.ts +3 -1
- package/dist/lib/Config.js +7 -0
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Context.d.ts +4 -2
- package/dist/lib/Context.js +28 -9
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/Database.d.ts +3 -2
- package/dist/lib/Database.js +45 -19
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +4 -3
- package/dist/lib/EVirtTable.js +11 -6
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/History.js +2 -2
- package/dist/lib/History.js.map +1 -1
- package/dist/lib/Selector.d.ts +2 -1
- package/dist/lib/Selector.js +2 -2
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: transparent;--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-line-color: #e1e6eb}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-readonly-text-color: #cfd3dc;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
2
|
var Jt = Object.defineProperty;
|
|
3
|
-
var Qt = (
|
|
4
|
-
var n = (
|
|
3
|
+
var Qt = (c, t, e) => t in c ? Jt(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
4
|
+
var n = (c, t, e) => Qt(c, typeof t != "symbol" ? t + "" : t, e);
|
|
5
5
|
class te {
|
|
6
6
|
constructor(t) {
|
|
7
7
|
n(this, "rules");
|
|
8
8
|
this.rules = t;
|
|
9
9
|
}
|
|
10
10
|
validate(t) {
|
|
11
|
-
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: l, rowIndex: a, value:
|
|
11
|
+
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: l, rowIndex: a, value: h, field: d, fieldValue: f } = t;
|
|
12
12
|
Array.isArray(this.rules) || (this.rules = [this.rules]);
|
|
13
13
|
for (const x of this.rules) {
|
|
14
14
|
if (x.validator) {
|
|
15
15
|
const u = {
|
|
16
16
|
field: d,
|
|
17
17
|
fieldValue: f,
|
|
18
|
-
value:
|
|
18
|
+
value: h,
|
|
19
19
|
column: i,
|
|
20
20
|
colIndex: l,
|
|
21
21
|
rowIndex: a,
|
|
@@ -24,15 +24,15 @@ class te {
|
|
|
24
24
|
rowKey: r,
|
|
25
25
|
...x
|
|
26
26
|
};
|
|
27
|
-
x.validator(u,
|
|
27
|
+
x.validator(u, h, (p) => {
|
|
28
28
|
p && e.push({
|
|
29
29
|
...u,
|
|
30
30
|
message: p
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
x.pattern && !x.pattern.test(
|
|
35
|
-
value:
|
|
34
|
+
x.pattern && !x.pattern.test(h) && e.push({
|
|
35
|
+
value: h,
|
|
36
36
|
column: i,
|
|
37
37
|
row: s,
|
|
38
38
|
key: o,
|
|
@@ -42,8 +42,8 @@ class te {
|
|
|
42
42
|
field: d,
|
|
43
43
|
fieldValue: f,
|
|
44
44
|
message: x.message || `${o} is pattern validation error`
|
|
45
|
-
}), x.required && (
|
|
46
|
-
value:
|
|
45
|
+
}), x.required && (h == null || h === "") && e.push({
|
|
46
|
+
value: h,
|
|
47
47
|
column: i,
|
|
48
48
|
row: s,
|
|
49
49
|
key: o,
|
|
@@ -59,26 +59,26 @@ class te {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
function St() {
|
|
62
|
-
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(
|
|
62
|
+
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(c) {
|
|
63
63
|
const t = Math.random() * 16 | 0;
|
|
64
|
-
return (
|
|
64
|
+
return (c === "x" ? t : t & 3 | 8).toString(16);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
function Lt(
|
|
67
|
+
function Lt(c, t) {
|
|
68
68
|
let e = 0, i;
|
|
69
69
|
return function(...s) {
|
|
70
70
|
const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e;
|
|
71
|
-
!e || r >= t ? (
|
|
72
|
-
|
|
71
|
+
!e || r >= t ? (c.apply(this, s), e = o) : i || (i = setTimeout(() => {
|
|
72
|
+
c.apply(this, s), e = (/* @__PURE__ */ new Date()).getTime(), i = void 0;
|
|
73
73
|
}, t - r));
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
function Tt(
|
|
77
|
-
return
|
|
76
|
+
function Tt(c = []) {
|
|
77
|
+
return c.length ? c.map((t) => Tt(t.children) + 1).sort((t, e) => e - t)[0] : 0;
|
|
78
78
|
}
|
|
79
|
-
function ee(
|
|
79
|
+
function ee(c = []) {
|
|
80
80
|
let t = [], e = [], i = [];
|
|
81
|
-
return
|
|
81
|
+
return c.forEach((s) => {
|
|
82
82
|
s.fixed === "left" ? t.push(s) : s.fixed === "right" ? i.push(s) : e.push(s);
|
|
83
83
|
}), [
|
|
84
84
|
...t.sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0)),
|
|
@@ -86,8 +86,8 @@ function ee(h = []) {
|
|
|
86
86
|
...i.sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0))
|
|
87
87
|
];
|
|
88
88
|
}
|
|
89
|
-
function At(
|
|
90
|
-
return
|
|
89
|
+
function At(c = [], t = 1, e = 0) {
|
|
90
|
+
return c.map((i) => {
|
|
91
91
|
if (i.children) {
|
|
92
92
|
let s = 0, o = i.fixed;
|
|
93
93
|
i.children.forEach((l) => {
|
|
@@ -113,72 +113,72 @@ function At(h = [], t = 1, e = 0) {
|
|
|
113
113
|
};
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function et(c = []) {
|
|
117
117
|
let t = [];
|
|
118
|
-
return
|
|
119
|
-
e.children ? t = t.concat(
|
|
118
|
+
return c.forEach((e) => {
|
|
119
|
+
e.children ? t = t.concat(et(e.children)) : t.push(e);
|
|
120
120
|
}), t;
|
|
121
121
|
}
|
|
122
122
|
const mt = /^(\r\n|\n\r|\r|\n)/, ie = /^[^\t\r\n]+/, yt = /^\t/;
|
|
123
|
-
function se(
|
|
123
|
+
function se(c) {
|
|
124
124
|
let t = [[""]];
|
|
125
|
-
if (
|
|
125
|
+
if (c.length === 0)
|
|
126
126
|
return t;
|
|
127
127
|
let e = 0, i = 0, s;
|
|
128
|
-
for (;
|
|
129
|
-
if (s =
|
|
130
|
-
|
|
131
|
-
else if (
|
|
132
|
-
|
|
128
|
+
for (; c.length > 0 && s !== c.length; )
|
|
129
|
+
if (s = c.length, c.match(yt))
|
|
130
|
+
c = c.replace(yt, ""), e += 1, t[i][e] = "";
|
|
131
|
+
else if (c.match(mt))
|
|
132
|
+
c = c.replace(mt, ""), e = 0, i += 1, t[i] = [""];
|
|
133
133
|
else {
|
|
134
134
|
let o = "";
|
|
135
|
-
if (
|
|
135
|
+
if (c.startsWith('"')) {
|
|
136
136
|
let r = 0, l = !0;
|
|
137
137
|
for (; l; ) {
|
|
138
|
-
const a =
|
|
139
|
-
a === '"' && (r += 1), o += a,
|
|
138
|
+
const a = c.slice(0, 1);
|
|
139
|
+
a === '"' && (r += 1), o += a, c = c.slice(1), (c.length === 0 || c.match(/^[\t\r\n]/) && r % 2 === 0) && (l = !1);
|
|
140
140
|
}
|
|
141
141
|
o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (a) => new Array(Math.floor(a.length / 2)).fill('"').join(""));
|
|
142
142
|
} else {
|
|
143
|
-
const r =
|
|
144
|
-
o = r ? r[0] : "",
|
|
143
|
+
const r = c.match(ie);
|
|
144
|
+
o = r ? r[0] : "", c = c.slice(o.length);
|
|
145
145
|
}
|
|
146
146
|
t[i][e] = o;
|
|
147
147
|
}
|
|
148
148
|
return Array.isArray(t) && t.length > 1 && t[t.length - 1].length === 1 && t[t.length - 1][0] === "" && (t = t.slice(0, t.length - 1)), t;
|
|
149
149
|
}
|
|
150
|
-
function oe(
|
|
150
|
+
function oe(c) {
|
|
151
151
|
let t, e, i, s, o = "", r;
|
|
152
|
-
for (t = 0, e =
|
|
153
|
-
for (s =
|
|
154
|
-
i > 0 && (o += " "), r =
|
|
152
|
+
for (t = 0, e = c.length; t < e; t += 1) {
|
|
153
|
+
for (s = c[t].length, i = 0; i < s; i += 1)
|
|
154
|
+
i > 0 && (o += " "), r = c[t][i], typeof r == "string" ? r.indexOf(`
|
|
155
155
|
`) > -1 ? o += `"${r.replace(/"/g, '""')}"` : o += r : r == null ? o += "" : o += r;
|
|
156
156
|
t !== e - 1 && (o += `
|
|
157
157
|
`);
|
|
158
158
|
}
|
|
159
159
|
return o;
|
|
160
160
|
}
|
|
161
|
-
function Mt(
|
|
161
|
+
function Mt(c, t, e = []) {
|
|
162
162
|
let i = 0;
|
|
163
163
|
const s = [];
|
|
164
|
-
return
|
|
164
|
+
return c.forEach((o, r) => {
|
|
165
165
|
if (r === 0)
|
|
166
166
|
s.push(1);
|
|
167
167
|
else {
|
|
168
|
-
const l = e.reduce((
|
|
168
|
+
const l = e.reduce((h, d) => `${h}${o[d] ?? ""}`, "") || o[t], a = e.reduce((h, d) => `${h}${c[r - 1][d] ?? ""}`, "") || c[r - 1][t];
|
|
169
169
|
l === a ? (s[i] += 1, s.push(0)) : (s.push(1), i = r);
|
|
170
170
|
}
|
|
171
171
|
}), s;
|
|
172
172
|
}
|
|
173
|
-
function Ht(
|
|
173
|
+
function Ht(c, t) {
|
|
174
174
|
let e = "", i = "";
|
|
175
175
|
const s = {};
|
|
176
176
|
return t.forEach((o, r) => {
|
|
177
|
-
r === 0 ? (e = o.key, i = o.key, s[o.key] = 1) :
|
|
177
|
+
r === 0 ? (e = o.key, i = o.key, s[o.key] = 1) : c[o.key] === c[e] ? (s[o.key] = 0, s[i] += 1) : (s[o.key] = 1, e = o.key, i = o.key);
|
|
178
178
|
}), s;
|
|
179
179
|
}
|
|
180
|
-
function re(
|
|
181
|
-
const { visibleRows: i, rowIndex: s, headIndex: o } =
|
|
180
|
+
function re(c, t, e = []) {
|
|
181
|
+
const { visibleRows: i, rowIndex: s, headIndex: o } = c, r = Mt(i, t, e);
|
|
182
182
|
return r[s - o] === 0 ? {
|
|
183
183
|
rowspan: 0,
|
|
184
184
|
colspan: 0,
|
|
@@ -191,8 +191,8 @@ function re(h, t, e = []) {
|
|
|
191
191
|
mergeRow: !0
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
function ne(
|
|
195
|
-
const { column: e, row: i, visibleLeafColumns: s } =
|
|
194
|
+
function ne(c, t = []) {
|
|
195
|
+
const { column: e, row: i, visibleLeafColumns: s } = c, o = s.filter((r) => t.includes(r.key));
|
|
196
196
|
if (t.includes(e.key)) {
|
|
197
197
|
const r = Ht(i, o);
|
|
198
198
|
return r[e.key] === 0 ? {
|
|
@@ -208,8 +208,8 @@ function ne(h, t = []) {
|
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
function le(
|
|
212
|
-
const e =
|
|
211
|
+
function le(c, t = document.documentElement) {
|
|
212
|
+
const e = c.startsWith("--") ? c : `--${c}`;
|
|
213
213
|
return getComputedStyle(t).getPropertyValue(e).trim();
|
|
214
214
|
}
|
|
215
215
|
class Dt {
|
|
@@ -259,8 +259,8 @@ class Dt {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
class ut extends Dt {
|
|
262
|
-
constructor(e, i, s, o, r, l, a,
|
|
263
|
-
super(e, o, r, l, a, f,
|
|
262
|
+
constructor(e, i, s, o, r, l, a, h, d, f = "body") {
|
|
263
|
+
super(e, o, r, l, a, f, h.fixed);
|
|
264
264
|
n(this, "formatter");
|
|
265
265
|
n(this, "formatterFooter");
|
|
266
266
|
n(this, "hoverIconName", "");
|
|
@@ -315,9 +315,10 @@ class ut extends Dt {
|
|
|
315
315
|
n(this, "rowExpand", !1);
|
|
316
316
|
n(this, "rowHasChildren", !1);
|
|
317
317
|
n(this, "overflowTooltipShow", !0);
|
|
318
|
+
n(this, "selectorCellValueType", "value");
|
|
318
319
|
n(this, "overflowTooltipMaxWidth", 500);
|
|
319
320
|
n(this, "overflowTooltipPlacement", "top");
|
|
320
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
321
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.column = h, this.rules = h.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.formatterFooter = h.formatterFooter, this.update();
|
|
321
322
|
}
|
|
322
323
|
setWidthHeight(e, i) {
|
|
323
324
|
this.width = e, this.height = i;
|
|
@@ -344,7 +345,7 @@ class ut extends Dt {
|
|
|
344
345
|
relationRowKeys: r,
|
|
345
346
|
relationColKeys: l,
|
|
346
347
|
mergeRow: a = !1,
|
|
347
|
-
mergeCol:
|
|
348
|
+
mergeCol: h = !1
|
|
348
349
|
} = i({
|
|
349
350
|
row: this.row,
|
|
350
351
|
rowIndex: this.rowIndex,
|
|
@@ -357,7 +358,7 @@ class ut extends Dt {
|
|
|
357
358
|
visibleLeafColumns: this.ctx.header.visibleLeafColumns,
|
|
358
359
|
rows: this.ctx.body.data
|
|
359
360
|
}) || {};
|
|
360
|
-
Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(l) && l.length > 0 ? this.relationColKeys = l : this.relationColKeys = [this.key], this.mergeCol =
|
|
361
|
+
Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(l) && l.length > 0 ? this.relationColKeys = l : this.relationColKeys = [this.key], this.mergeCol = h, this.mergeRow = a, this.colspan = s, this.rowspan = o, this.visibleWidth = this.getWidthByColIndexColSpan(this.colIndex, this.colspan), this.visibleHeight = this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex, this.rowspan);
|
|
361
362
|
}
|
|
362
363
|
}
|
|
363
364
|
updateSpanInfo() {
|
|
@@ -430,19 +431,19 @@ class ut extends Dt {
|
|
|
430
431
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
431
432
|
let o, r = 0, l = "";
|
|
432
433
|
if (this.type === "tree" && s === "body") {
|
|
433
|
-
const a = this.ctx.database.getRowForRowKey(i), { expand:
|
|
434
|
-
if (this.rowExpand =
|
|
435
|
-
const
|
|
436
|
-
l = "loading", o =
|
|
434
|
+
const a = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: x = 0 } = a || {};
|
|
435
|
+
if (this.rowExpand = h, this.rowHasChildren = d, f) {
|
|
436
|
+
const g = this.ctx.icons.get("loading");
|
|
437
|
+
l = "loading", o = g, r = x * 8;
|
|
437
438
|
} else if (d) {
|
|
438
|
-
const
|
|
439
|
-
o =
|
|
439
|
+
const g = this.ctx.icons.get("expand"), w = this.ctx.icons.get("shrink");
|
|
440
|
+
o = h ? w : g, l = h ? "shrink" : "expand", r = x * 8;
|
|
440
441
|
} else
|
|
441
442
|
r = x * 8;
|
|
442
443
|
let u = 20, p = 20;
|
|
443
444
|
if (o) {
|
|
444
|
-
let
|
|
445
|
-
this.ctx.paint.drawImage(o,
|
|
445
|
+
let g = this.drawX + r + e, w = this.drawY + (this.visibleHeight - p) / 2;
|
|
446
|
+
this.ctx.paint.drawImage(o, g, w, u, p), this.drawImageX = g, this.drawImageY = w, this.drawImageWidth = u, this.drawImageHeight = p, this.drawImageName = l, this.drawImageSource = o;
|
|
446
447
|
}
|
|
447
448
|
this.align = "left", this.drawTextX = r + this.drawX + u - 0.5;
|
|
448
449
|
}
|
|
@@ -456,16 +457,16 @@ class ut extends Dt {
|
|
|
456
457
|
READONLY_TEXT_COLOR: r,
|
|
457
458
|
BODY_TEXT_COLOR: l,
|
|
458
459
|
FOOTER_TEXT_COLOR: a,
|
|
459
|
-
FOOTER_BG_COLOR:
|
|
460
|
+
FOOTER_BG_COLOR: h,
|
|
460
461
|
HIGHLIGHT_SELECTED_ROW: d,
|
|
461
462
|
HIGHLIGHT_SELECTED_ROW_COLOR: f,
|
|
462
463
|
HIGHLIGHT_HOVER_ROW: x,
|
|
463
464
|
HIGHLIGHT_HOVER_ROW_COLOR: u,
|
|
464
465
|
STRIPE: p,
|
|
465
|
-
STRIPE_COLOR:
|
|
466
|
+
STRIPE_COLOR: g
|
|
466
467
|
} = this.ctx.config;
|
|
467
468
|
if (this.cellType === "footer") {
|
|
468
|
-
let _ =
|
|
469
|
+
let _ = h, S = a;
|
|
469
470
|
if (typeof o == "function") {
|
|
470
471
|
const v = o, { backgroundColor: b, color: O } = v({
|
|
471
472
|
row: this.row,
|
|
@@ -479,16 +480,16 @@ class ut extends Dt {
|
|
|
479
480
|
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor = S;
|
|
480
481
|
return;
|
|
481
482
|
}
|
|
482
|
-
let
|
|
483
|
-
const E = this.ctx.hoverCell,
|
|
484
|
-
let
|
|
483
|
+
let w = "transparent";
|
|
484
|
+
const E = this.ctx.hoverCell, m = this.ctx.currentCell;
|
|
485
|
+
let y = this.rowIndex, R = this.rowIndex;
|
|
485
486
|
if (this.rowspan !== 1 && (x || d)) {
|
|
486
487
|
const _ = this.getSpanInfo(), { yArr: S } = _;
|
|
487
|
-
|
|
488
|
+
y = S[0], R = S[1];
|
|
488
489
|
}
|
|
489
|
-
x && E && (E.rowKey === this.rowKey && (
|
|
490
|
-
let
|
|
491
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (
|
|
490
|
+
x && E && (E.rowKey === this.rowKey && (w = u), E.rowIndex >= y && E.rowIndex <= R && (w = u)), d && m && (m.rowKey === this.rowKey && (w = f), m.rowIndex >= y && m.rowIndex <= R && (w = f)), this.drawCellSkyBgColor = w;
|
|
491
|
+
let C = e, I = l;
|
|
492
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r), p && (this.rowIndex % 2 ? C = g : C = e), typeof s == "function") {
|
|
492
493
|
const _ = s, { backgroundColor: S, color: v } = _({
|
|
493
494
|
row: this.row,
|
|
494
495
|
rowIndex: this.rowIndex,
|
|
@@ -497,16 +498,16 @@ class ut extends Dt {
|
|
|
497
498
|
isHasChanged: this.isHasChanged,
|
|
498
499
|
value: this.getValue()
|
|
499
500
|
}) || {};
|
|
500
|
-
S && (
|
|
501
|
+
S && (C = S), v && (I = v);
|
|
501
502
|
}
|
|
502
|
-
this.drawCellBgColor =
|
|
503
|
+
this.drawCellBgColor = C, this.drawTextColor = I;
|
|
503
504
|
}
|
|
504
505
|
updateSelection() {
|
|
505
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: l, rowIndex: a, rowKey:
|
|
506
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: l, rowIndex: a, rowKey: h } = this;
|
|
506
507
|
if (!(s === 0 || o === 0) && r !== "footer" && ["index-selection", "selection"].includes(l)) {
|
|
507
|
-
const d = this.ctx.database.getRowSelection(
|
|
508
|
-
let
|
|
509
|
-
d && f ? (
|
|
508
|
+
const d = this.ctx.database.getRowSelection(h), f = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, p = this.drawY + (i - x) / 2;
|
|
509
|
+
let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
510
|
+
d && f ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : d && f ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !d && f ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && l == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === a || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g) : g && l === "selection" && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g);
|
|
510
511
|
}
|
|
511
512
|
}
|
|
512
513
|
updateHoverIcon() {
|
|
@@ -514,27 +515,27 @@ class ut extends Dt {
|
|
|
514
515
|
return;
|
|
515
516
|
const { BODY_CELL_HOVER_ICON_METHOD: i, CELL_HOVER_ICON_SIZE: s, CELL_PADDING: o, ENABLE_MERGE_CELL_LINK: r } = this.ctx.config;
|
|
516
517
|
if (typeof i == "function") {
|
|
517
|
-
const
|
|
518
|
+
const h = i({
|
|
518
519
|
row: this.row,
|
|
519
520
|
rowIndex: this.rowIndex,
|
|
520
521
|
colIndex: this.colIndex,
|
|
521
522
|
column: this.column,
|
|
522
523
|
value: this.getValue()
|
|
523
524
|
});
|
|
524
|
-
|
|
525
|
+
h !== void 0 && (this.hoverIconName = h);
|
|
525
526
|
}
|
|
526
527
|
const { hoverCell: l } = this.ctx;
|
|
527
528
|
if (this.hoverIconName && !this.ctx.editing && l) {
|
|
528
|
-
let a = 0,
|
|
529
|
-
if (l.rowKey === this.rowKey && (a = this.drawX + this.width - s - o,
|
|
529
|
+
let a = 0, h = 0;
|
|
530
|
+
if (l.rowKey === this.rowKey && (a = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
|
|
530
531
|
const f = this.getSpanInfo(), { yArr: x } = f, u = x[0], p = x[1];
|
|
531
532
|
if (l.rowIndex >= u && l.rowIndex <= p) {
|
|
532
|
-
const { width:
|
|
533
|
-
a = this.drawX -
|
|
533
|
+
const { width: g, height: w, offsetTop: E, offsetLeft: m } = f;
|
|
534
|
+
a = this.drawX - m + g - s - o, h = this.drawY - E + (w - s) / 2;
|
|
534
535
|
}
|
|
535
536
|
}
|
|
536
537
|
const d = this.ctx.icons.get(this.hoverIconName);
|
|
537
|
-
this.drawImageX = a, this.drawImageY =
|
|
538
|
+
this.drawImageX = a, this.drawImageY = h, this.drawImageWidth = s, this.drawImageHeight = s, this.drawImageName = this.hoverIconName, this.drawImageSource = d;
|
|
538
539
|
}
|
|
539
540
|
}
|
|
540
541
|
// 过去跨度配置
|
|
@@ -629,10 +630,10 @@ class ut extends Dt {
|
|
|
629
630
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: o } = this.ctx.config;
|
|
630
631
|
if (!s || !i || this.ctx.editing)
|
|
631
632
|
return;
|
|
632
|
-
const { xArr: r, yArr: l } = this.ctx.selector, a = r[1],
|
|
633
|
-
if (d === a && f ===
|
|
634
|
-
const
|
|
635
|
-
this.ctx.paint.drawRect(x + this.width -
|
|
633
|
+
const { xArr: r, yArr: l } = this.ctx.selector, a = r[1], h = l[1], { colIndex: d, rowIndex: f, drawX: x, drawY: u } = this;
|
|
634
|
+
if (d === a && f === h) {
|
|
635
|
+
const g = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
|
|
636
|
+
this.ctx.paint.drawRect(x + this.width - g, u + this.height - g, 6, 6, {
|
|
636
637
|
borderColor: o,
|
|
637
638
|
fillColor: e
|
|
638
639
|
});
|
|
@@ -665,13 +666,13 @@ class ut extends Dt {
|
|
|
665
666
|
const { ellipsis: r } = this.ctx.paint.handleEllipsis(this.displayText, o, e, i);
|
|
666
667
|
this.ellipsis = r;
|
|
667
668
|
const { placeholder: l } = this.column;
|
|
668
|
-
let a = this.displayText,
|
|
669
|
-
return !this.ctx.database.getReadonly(this.rowKey, this.key) && l && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = l,
|
|
669
|
+
let a = this.displayText, h = this.drawTextColor;
|
|
670
|
+
return !this.ctx.database.getReadonly(this.rowKey, this.key) && l && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = l, h = s), this.ctx.paint.drawText(a, this.drawTextX, this.drawTextY, o, this.visibleHeight, {
|
|
670
671
|
font: i,
|
|
671
672
|
padding: e,
|
|
672
673
|
align: this.align,
|
|
673
674
|
verticalAlign: this.verticalAlign,
|
|
674
|
-
color:
|
|
675
|
+
color: h
|
|
675
676
|
});
|
|
676
677
|
}
|
|
677
678
|
drawImage() {
|
|
@@ -728,11 +729,11 @@ class ut extends Dt {
|
|
|
728
729
|
fillColor: "transparent",
|
|
729
730
|
borderWidth: 1
|
|
730
731
|
});
|
|
731
|
-
const [l, a] = i, [
|
|
732
|
-
!(l === a &&
|
|
732
|
+
const [l, a] = i, [h, d] = s;
|
|
733
|
+
!(l === a && h === d) && this.colIndex >= l && this.colIndex <= a && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.width, this.height, {
|
|
733
734
|
borderColor: "transparent",
|
|
734
735
|
fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)"
|
|
735
|
-
}), this.operation && this.rowIndex >=
|
|
736
|
+
}), this.operation && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
|
|
736
737
|
borderColor: "transparent",
|
|
737
738
|
fillColor: this.ctx.config.SELECT_ROW_COL_BG_COLOR || "transparent"
|
|
738
739
|
});
|
|
@@ -758,46 +759,46 @@ class ut extends Dt {
|
|
|
758
759
|
}
|
|
759
760
|
drawBorder(e) {
|
|
760
761
|
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: l, width: a } = this;
|
|
761
|
-
let
|
|
762
|
-
const { xArr: f, yArr: x, lineDash: u = [], borderWidth: p = 1, borderColor:
|
|
763
|
-
if (r >= E && r <=
|
|
764
|
-
const
|
|
765
|
-
this.ctx.paint.drawLine([
|
|
766
|
-
borderColor:
|
|
767
|
-
fillColor:
|
|
762
|
+
let h = i, d = s;
|
|
763
|
+
const { xArr: f, yArr: x, lineDash: u = [], borderWidth: p = 1, borderColor: g, fillColor: w } = e, E = f[0], m = f[1], y = x[0], R = x[1];
|
|
764
|
+
if (r >= E && r <= m && o === y) {
|
|
765
|
+
const C = r === m ? 1 : 0, I = r === E ? 1 : 0;
|
|
766
|
+
this.ctx.paint.drawLine([h + I, d + 1, h + a - C, d + 1], {
|
|
767
|
+
borderColor: g,
|
|
768
|
+
fillColor: w,
|
|
768
769
|
borderWidth: p,
|
|
769
770
|
lineCap: "round",
|
|
770
771
|
lineJoin: "round",
|
|
771
772
|
lineDash: u
|
|
772
773
|
});
|
|
773
774
|
}
|
|
774
|
-
if (r ===
|
|
775
|
-
const
|
|
776
|
-
this.ctx.paint.drawLine([
|
|
777
|
-
borderColor:
|
|
778
|
-
fillColor:
|
|
775
|
+
if (r === m && o >= y && o <= R) {
|
|
776
|
+
const C = o === y ? 1 : 0, I = o === R ? 1 : 0;
|
|
777
|
+
this.ctx.paint.drawLine([h + a - 1, d + C, h + a - 1, d + l - I], {
|
|
778
|
+
borderColor: g,
|
|
779
|
+
fillColor: w,
|
|
779
780
|
borderWidth: p,
|
|
780
781
|
lineCap: "round",
|
|
781
782
|
lineJoin: "round",
|
|
782
783
|
lineDash: u
|
|
783
784
|
});
|
|
784
785
|
}
|
|
785
|
-
if (r >= E && r <=
|
|
786
|
-
const
|
|
787
|
-
this.ctx.paint.drawLine([
|
|
788
|
-
borderColor:
|
|
789
|
-
fillColor:
|
|
786
|
+
if (r >= E && r <= m && o === R) {
|
|
787
|
+
const C = r === m ? 1 : 0, I = r === E ? 1 : 0;
|
|
788
|
+
this.ctx.paint.drawLine([h + I, d + l - 1, h + a - C, d + l - 1], {
|
|
789
|
+
borderColor: g,
|
|
790
|
+
fillColor: w,
|
|
790
791
|
borderWidth: p,
|
|
791
792
|
lineCap: "round",
|
|
792
793
|
lineJoin: "round",
|
|
793
794
|
lineDash: u
|
|
794
795
|
});
|
|
795
796
|
}
|
|
796
|
-
if (r === E && o >=
|
|
797
|
-
const
|
|
798
|
-
this.ctx.paint.drawLine([
|
|
799
|
-
borderColor:
|
|
800
|
-
fillColor:
|
|
797
|
+
if (r === E && o >= y && o <= R) {
|
|
798
|
+
const C = o === R ? 1 : 0, I = o === y ? 1 : 0;
|
|
799
|
+
this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + l - C], {
|
|
800
|
+
borderColor: g,
|
|
801
|
+
fillColor: w,
|
|
801
802
|
borderWidth: p,
|
|
802
803
|
lineCap: "round",
|
|
803
804
|
lineJoin: "round",
|
|
@@ -842,7 +843,14 @@ class ae {
|
|
|
842
843
|
}
|
|
843
844
|
// 初始化默认不忽略清空改变值和校验map
|
|
844
845
|
init(t = !0) {
|
|
845
|
-
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear()
|
|
846
|
+
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
|
|
847
|
+
const e = this.getColumns(), i = et(e);
|
|
848
|
+
if (this.ctx.hasSelection = i.some((s) => s.type === "selection"), this.ctx.hasTree = i.some((s) => s.type === "tree"), t) {
|
|
849
|
+
this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear();
|
|
850
|
+
const { ROW_KEY: s } = this.ctx.config;
|
|
851
|
+
s ? (this.ctx.hasSelection || this.selectionMap.clear(), this.ctx.hasTree || this.expandMap.clear()) : (this.selectionMap.clear(), this.expandMap.clear());
|
|
852
|
+
}
|
|
853
|
+
this.itemRowKeyMap = /* @__PURE__ */ new WeakMap(), this.initData(this.data), this.getData(), this.bufferCheckState.buffer = !1;
|
|
846
854
|
}
|
|
847
855
|
/**
|
|
848
856
|
* 清除缓存数据
|
|
@@ -858,33 +866,33 @@ class ae {
|
|
|
858
866
|
initData(t, e = 0, i = []) {
|
|
859
867
|
t.forEach((s, o) => {
|
|
860
868
|
var E;
|
|
861
|
-
const { ROW_KEY: r = "", DEFAULT_EXPAND_ALL: l, CELL_HEIGHT: a, SELECTABLE_METHOD:
|
|
869
|
+
const { ROW_KEY: r = "", DEFAULT_EXPAND_ALL: l, CELL_HEIGHT: a, SELECTABLE_METHOD: h, CHECKBOX_KEY: d } = this.ctx.config, f = s[r], x = f != null ? `${f}` : St();
|
|
862
870
|
this.itemRowKeyMap.set(s, x);
|
|
863
871
|
const u = s._height || a, p = s._readonly;
|
|
864
|
-
let
|
|
865
|
-
if (typeof
|
|
866
|
-
const
|
|
867
|
-
if (this.checkboxKeyMap.has(
|
|
868
|
-
const
|
|
869
|
-
|
|
872
|
+
let g = !0;
|
|
873
|
+
if (typeof h == "function" && (g = h), d) {
|
|
874
|
+
const m = s[d];
|
|
875
|
+
if (this.checkboxKeyMap.has(m)) {
|
|
876
|
+
const y = this.checkboxKeyMap.get(m) || [];
|
|
877
|
+
y.push(x), this.checkboxKeyMap.set(m, y);
|
|
870
878
|
} else
|
|
871
|
-
this.checkboxKeyMap.set(
|
|
879
|
+
this.checkboxKeyMap.set(m, [x]);
|
|
872
880
|
}
|
|
873
881
|
this.selectionMap.set(x, {
|
|
874
882
|
key: d ? s[d] : x,
|
|
875
883
|
row: s,
|
|
876
884
|
check: ((E = this.selectionMap.get(x)) == null ? void 0 : E.check) || !1
|
|
877
885
|
});
|
|
878
|
-
const
|
|
879
|
-
this.expandMap.set(x,
|
|
886
|
+
const w = l || this.expandMap.get(x) || s._expand || !1;
|
|
887
|
+
this.expandMap.set(x, w), this.rowKeyMap.set(x, {
|
|
880
888
|
readonly: p,
|
|
881
889
|
index: o,
|
|
882
890
|
rowIndex: o,
|
|
883
891
|
level: e,
|
|
884
892
|
height: u,
|
|
885
893
|
check: !1,
|
|
886
|
-
selectable:
|
|
887
|
-
expand:
|
|
894
|
+
selectable: g,
|
|
895
|
+
expand: w,
|
|
888
896
|
expandLazy: !1,
|
|
889
897
|
hasChildren: s._hasChildren || (Array.isArray(s.children) ? s.children.length > 0 : !1),
|
|
890
898
|
expandLoading: !1,
|
|
@@ -952,12 +960,12 @@ class ae {
|
|
|
952
960
|
const i = (o) => {
|
|
953
961
|
o.forEach((r) => {
|
|
954
962
|
t.push(r);
|
|
955
|
-
const l = this.itemRowKeyMap.get(r), { expand: a, hasChildren:
|
|
963
|
+
const l = this.itemRowKeyMap.get(r), { expand: a, hasChildren: h, height: d } = this.rowKeyMap.get(l), f = this.sumHeight;
|
|
956
964
|
this.sumHeight += d, this.rowIndexRowKeyMap.set(e, l), this.rowKeyRowIndexMap.set(l, e), this.positions.push({
|
|
957
965
|
top: f,
|
|
958
966
|
height: d,
|
|
959
967
|
bottom: this.sumHeight
|
|
960
|
-
}), e += 1, a &&
|
|
968
|
+
}), e += 1, a && h && i(r.children);
|
|
961
969
|
});
|
|
962
970
|
};
|
|
963
971
|
this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
|
|
@@ -1092,54 +1100,56 @@ class ae {
|
|
|
1092
1100
|
* @param history
|
|
1093
1101
|
* @returns
|
|
1094
1102
|
*/
|
|
1095
|
-
async batchSetItemValue(t, e = !1) {
|
|
1096
|
-
let
|
|
1097
|
-
const
|
|
1098
|
-
let
|
|
1103
|
+
async batchSetItemValue(t, e = !1, i = !0) {
|
|
1104
|
+
let s = [];
|
|
1105
|
+
const o = /* @__PURE__ */ new Set();
|
|
1106
|
+
let r = [], l = t.map((d) => {
|
|
1099
1107
|
const { rowKey: f, key: x } = d;
|
|
1100
1108
|
let u = d.value, p = u;
|
|
1101
|
-
const
|
|
1102
|
-
return (E == null ? void 0 : E.type) === "number" && (["", void 0, null].includes(u) ? p = null : /^-?\d+(\.\d+)?$/.test(`${u}`) ? p = Number(u) : (p =
|
|
1109
|
+
const g = this.getRowDataItemForRowKey(f), w = this.getItemValue(f, x), E = this.getVirtualBodyCellByKey(f, x);
|
|
1110
|
+
return (E == null ? void 0 : E.type) === "number" && (["", void 0, null].includes(u) ? p = null : /^-?\d+(\.\d+)?$/.test(`${u}`) ? p = Number(u) : (p = w, r.push({
|
|
1103
1111
|
...d,
|
|
1104
1112
|
value: p,
|
|
1105
|
-
oldValue:
|
|
1106
|
-
row:
|
|
1113
|
+
oldValue: w,
|
|
1114
|
+
row: g
|
|
1107
1115
|
}))), {
|
|
1108
1116
|
...d,
|
|
1109
1117
|
value: p,
|
|
1110
|
-
oldValue:
|
|
1111
|
-
row:
|
|
1118
|
+
oldValue: w,
|
|
1119
|
+
row: g
|
|
1112
1120
|
};
|
|
1113
1121
|
});
|
|
1114
|
-
if (
|
|
1122
|
+
if (l = l.filter((d) => !r.some((f) => d.rowKey === f.rowKey && d.key === f.key)), r.length) {
|
|
1115
1123
|
const d = {
|
|
1116
1124
|
code: "ERR_BATCH_SET_NUMBER_VALUE",
|
|
1117
1125
|
message: "Assignment failed, not a numeric type",
|
|
1118
|
-
data:
|
|
1126
|
+
data: r
|
|
1119
1127
|
};
|
|
1120
1128
|
this.ctx.emit("error", d);
|
|
1121
1129
|
}
|
|
1122
|
-
if (!
|
|
1130
|
+
if (!l.length)
|
|
1123
1131
|
return;
|
|
1124
|
-
const { BEFORE_VALUE_CHANGE_METHOD:
|
|
1125
|
-
typeof
|
|
1132
|
+
const { BEFORE_VALUE_CHANGE_METHOD: a } = this.ctx.config;
|
|
1133
|
+
typeof a == "function" && (l = await a(l)), l.forEach((d) => {
|
|
1126
1134
|
const { value: f, rowKey: x, key: u, oldValue: p } = d;
|
|
1127
|
-
|
|
1135
|
+
o.add(x), this.setItemValue(x, u, f, !1, !1, !1, i), s.push({
|
|
1128
1136
|
rowKey: x,
|
|
1129
1137
|
key: u,
|
|
1130
1138
|
oldValue: p,
|
|
1131
1139
|
newValue: f
|
|
1132
1140
|
});
|
|
1133
1141
|
});
|
|
1134
|
-
let
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
})
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1142
|
+
let h = [];
|
|
1143
|
+
if (o.forEach((d) => {
|
|
1144
|
+
h.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
1145
|
+
}), i) {
|
|
1146
|
+
const d = l.map(({ rowKey: f, key: x }) => this.getValidator(f, x));
|
|
1147
|
+
Promise.all(d).then(() => {
|
|
1148
|
+
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1149
|
+
}), this.ctx.emit("change", l, h);
|
|
1150
|
+
}
|
|
1151
|
+
e && this.ctx.history.pushState({
|
|
1152
|
+
changeList: s,
|
|
1143
1153
|
scrollX: this.ctx.scrollX,
|
|
1144
1154
|
scrollY: this.ctx.scrollY,
|
|
1145
1155
|
type: "multiple"
|
|
@@ -1153,91 +1163,92 @@ class ae {
|
|
|
1153
1163
|
* @param history 是否添加历史记录
|
|
1154
1164
|
* @param reDraw 是否刷新重绘
|
|
1155
1165
|
* @param isEditor 是否是编辑器
|
|
1166
|
+
* @param checkReadonly 是否检查只读
|
|
1156
1167
|
* @returns
|
|
1157
1168
|
*/
|
|
1158
|
-
async setItemValue(t, e, i, s = !1, o = !1, r = !1) {
|
|
1169
|
+
async setItemValue(t, e, i, s = !1, o = !1, r = !1, l = !0) {
|
|
1159
1170
|
if (!this.rowKeyMap.has(t))
|
|
1160
1171
|
return {};
|
|
1161
|
-
const { item:
|
|
1162
|
-
let
|
|
1163
|
-
if (this.ctx.database.getReadonly(t, e))
|
|
1172
|
+
const { item: a } = this.rowKeyMap.get(t);
|
|
1173
|
+
let h = a[e], d = i;
|
|
1174
|
+
if (l && this.ctx.database.getReadonly(t, e))
|
|
1164
1175
|
return {
|
|
1165
|
-
oldValue:
|
|
1166
|
-
newValue:
|
|
1176
|
+
oldValue: h,
|
|
1177
|
+
newValue: h
|
|
1167
1178
|
};
|
|
1168
|
-
|
|
1169
|
-
const
|
|
1170
|
-
this.originalDataMap.has(
|
|
1171
|
-
const
|
|
1179
|
+
a[e] !== null && typeof a[e] == "object" && (h = JSON.parse(JSON.stringify(a[e])));
|
|
1180
|
+
const f = `${t}_${e}`;
|
|
1181
|
+
this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
|
|
1182
|
+
const x = this.originalDataMap.get(f), u = this.getRowDataItemForRowKey(t);
|
|
1172
1183
|
if (r) {
|
|
1173
|
-
const
|
|
1174
|
-
if ((
|
|
1184
|
+
const p = this.getVirtualBodyCellByKey(t, e);
|
|
1185
|
+
if ((p == null ? void 0 : p.type) === "number")
|
|
1175
1186
|
if (["", void 0, null].includes(i))
|
|
1176
|
-
|
|
1187
|
+
d = null;
|
|
1177
1188
|
else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
|
|
1178
|
-
|
|
1189
|
+
d = Number(i);
|
|
1179
1190
|
else {
|
|
1180
|
-
|
|
1181
|
-
const
|
|
1191
|
+
d = h;
|
|
1192
|
+
const E = {
|
|
1182
1193
|
code: "ERR_SET_NUMBER_VALUE",
|
|
1183
1194
|
message: "Assignment failed, not a numeric type",
|
|
1184
1195
|
data: [
|
|
1185
1196
|
{
|
|
1186
1197
|
rowKey: t,
|
|
1187
1198
|
key: e,
|
|
1188
|
-
value:
|
|
1189
|
-
oldValue:
|
|
1190
|
-
row:
|
|
1199
|
+
value: d,
|
|
1200
|
+
oldValue: h,
|
|
1201
|
+
row: u
|
|
1191
1202
|
}
|
|
1192
1203
|
]
|
|
1193
1204
|
};
|
|
1194
|
-
this.ctx.emit("error",
|
|
1205
|
+
this.ctx.emit("error", E);
|
|
1195
1206
|
}
|
|
1196
|
-
if (
|
|
1207
|
+
if (d === h)
|
|
1197
1208
|
return {
|
|
1198
|
-
oldValue:
|
|
1199
|
-
newValue:
|
|
1209
|
+
oldValue: h,
|
|
1210
|
+
newValue: h
|
|
1200
1211
|
};
|
|
1201
|
-
const { BEFORE_VALUE_CHANGE_METHOD:
|
|
1202
|
-
if (typeof
|
|
1203
|
-
const
|
|
1212
|
+
const { BEFORE_VALUE_CHANGE_METHOD: g } = this.ctx.config;
|
|
1213
|
+
if (typeof g == "function") {
|
|
1214
|
+
const m = await g([
|
|
1204
1215
|
{
|
|
1205
1216
|
rowKey: t,
|
|
1206
1217
|
key: e,
|
|
1207
|
-
value:
|
|
1208
|
-
oldValue:
|
|
1209
|
-
row:
|
|
1218
|
+
value: d,
|
|
1219
|
+
oldValue: a[e],
|
|
1220
|
+
row: u
|
|
1210
1221
|
}
|
|
1211
1222
|
]);
|
|
1212
|
-
|
|
1223
|
+
m && m.length && (d = m[0].value);
|
|
1213
1224
|
}
|
|
1214
|
-
this.changedDataMap.set(
|
|
1225
|
+
this.changedDataMap.set(f, d), a[e] = d;
|
|
1215
1226
|
const w = {
|
|
1216
1227
|
rowKey: t,
|
|
1217
1228
|
key: e,
|
|
1218
|
-
oldValue:
|
|
1219
|
-
value:
|
|
1220
|
-
row:
|
|
1229
|
+
oldValue: h,
|
|
1230
|
+
value: d,
|
|
1231
|
+
row: u
|
|
1221
1232
|
};
|
|
1222
|
-
this.getValidator(t, e).then(() => {
|
|
1233
|
+
l && (this.getValidator(t, e).then(() => {
|
|
1223
1234
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1224
|
-
}), this.ctx.emit("change", [w], [
|
|
1235
|
+
}), this.ctx.emit("change", [w], [u])), this.ctx.emit("editChange", {
|
|
1225
1236
|
rowKey: t,
|
|
1226
1237
|
key: e,
|
|
1227
|
-
oldValue:
|
|
1228
|
-
value:
|
|
1229
|
-
originalValue:
|
|
1230
|
-
row:
|
|
1238
|
+
oldValue: h,
|
|
1239
|
+
value: d,
|
|
1240
|
+
originalValue: x,
|
|
1241
|
+
row: u
|
|
1231
1242
|
});
|
|
1232
1243
|
} else
|
|
1233
|
-
this.changedDataMap.set(
|
|
1244
|
+
this.changedDataMap.set(f, d), a[e] = d;
|
|
1234
1245
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1235
1246
|
rowKey: t,
|
|
1236
1247
|
key: e,
|
|
1237
|
-
oldValue:
|
|
1238
|
-
value:
|
|
1239
|
-
originalValue: this.originalDataMap.get(
|
|
1240
|
-
row:
|
|
1248
|
+
oldValue: h,
|
|
1249
|
+
value: d,
|
|
1250
|
+
originalValue: this.originalDataMap.get(f),
|
|
1251
|
+
row: u
|
|
1241
1252
|
}), s && this.ctx.history.pushState({
|
|
1242
1253
|
type: "single",
|
|
1243
1254
|
scrollX: this.ctx.scrollX,
|
|
@@ -1246,13 +1257,13 @@ class ae {
|
|
|
1246
1257
|
{
|
|
1247
1258
|
rowKey: t,
|
|
1248
1259
|
key: e,
|
|
1249
|
-
oldValue:
|
|
1250
|
-
newValue:
|
|
1260
|
+
oldValue: h,
|
|
1261
|
+
newValue: d
|
|
1251
1262
|
}
|
|
1252
1263
|
]
|
|
1253
1264
|
}), o && this.ctx.emit("draw"), {
|
|
1254
|
-
oldValue:
|
|
1255
|
-
newValue:
|
|
1265
|
+
oldValue: h,
|
|
1266
|
+
newValue: d
|
|
1256
1267
|
};
|
|
1257
1268
|
}
|
|
1258
1269
|
/**
|
|
@@ -1372,23 +1383,23 @@ class ae {
|
|
|
1372
1383
|
let s = 0, o = 0;
|
|
1373
1384
|
const r = this.selectionMap.size, l = Array.from(this.selectionMap.values()).some((x) => x.check);
|
|
1374
1385
|
this.rowKeyMap.forEach((x, u) => {
|
|
1375
|
-
var
|
|
1376
|
-
(
|
|
1386
|
+
var g;
|
|
1387
|
+
(g = this.selectionMap.get(u)) != null && g.check && (s += 1);
|
|
1377
1388
|
let p = x.selectable;
|
|
1378
1389
|
typeof p == "function" && (p = p({
|
|
1379
1390
|
row: x.item,
|
|
1380
1391
|
rowIndex: x.rowIndex
|
|
1381
1392
|
})), p && (o += 1);
|
|
1382
1393
|
});
|
|
1383
|
-
const a = r > i && s === 0 && l,
|
|
1394
|
+
const a = r > i && s === 0 && l, h = o && o > s && s > 0 || a, d = o !== 0, f = !!o && o === s;
|
|
1384
1395
|
return this.bufferCheckState = {
|
|
1385
1396
|
buffer: !0,
|
|
1386
1397
|
check: f,
|
|
1387
|
-
indeterminate:
|
|
1398
|
+
indeterminate: h,
|
|
1388
1399
|
selectable: d
|
|
1389
1400
|
}, {
|
|
1390
1401
|
check: f,
|
|
1391
|
-
indeterminate:
|
|
1402
|
+
indeterminate: h,
|
|
1392
1403
|
selectable: d
|
|
1393
1404
|
};
|
|
1394
1405
|
}
|
|
@@ -1517,7 +1528,7 @@ class ae {
|
|
|
1517
1528
|
d && (a = d);
|
|
1518
1529
|
}
|
|
1519
1530
|
if (a) {
|
|
1520
|
-
const
|
|
1531
|
+
const h = {
|
|
1521
1532
|
row: s.item,
|
|
1522
1533
|
rowIndex: s.rowIndex,
|
|
1523
1534
|
colIndex: o.colIndex,
|
|
@@ -1527,7 +1538,7 @@ class ae {
|
|
|
1527
1538
|
value: this.getItemValue(t, e),
|
|
1528
1539
|
field: e,
|
|
1529
1540
|
fieldValue: this.getItemValue(t, e)
|
|
1530
|
-
}, f = new te(a).validate(
|
|
1541
|
+
}, f = new te(a).validate(h);
|
|
1531
1542
|
this.setValidationError(t, e, f), i(f);
|
|
1532
1543
|
} else
|
|
1533
1544
|
this.clearValidationError(t, e), i([]);
|
|
@@ -1550,13 +1561,13 @@ class ae {
|
|
|
1550
1561
|
value: r,
|
|
1551
1562
|
colIndex: l,
|
|
1552
1563
|
relationRowKeys: a,
|
|
1553
|
-
relationColKeys:
|
|
1564
|
+
relationColKeys: h,
|
|
1554
1565
|
rowspan: d,
|
|
1555
1566
|
height: f,
|
|
1556
1567
|
width: x,
|
|
1557
1568
|
colspan: u,
|
|
1558
1569
|
mergeRow: p,
|
|
1559
|
-
mergeCol:
|
|
1570
|
+
mergeCol: g
|
|
1560
1571
|
} = t;
|
|
1561
1572
|
if (d === 1 && u === 1)
|
|
1562
1573
|
return {
|
|
@@ -1577,7 +1588,7 @@ class ae {
|
|
|
1577
1588
|
}
|
|
1578
1589
|
]
|
|
1579
1590
|
};
|
|
1580
|
-
let
|
|
1591
|
+
let w = e, E = e, m = l, y = l, R = [], C = 0, I = 0, _ = 0, S = 0;
|
|
1581
1592
|
if (d !== 1 && p) {
|
|
1582
1593
|
S = x;
|
|
1583
1594
|
const v = a.reduce((b, O) => {
|
|
@@ -1590,7 +1601,7 @@ class ae {
|
|
|
1590
1601
|
return `${M}${X}`;
|
|
1591
1602
|
}, "");
|
|
1592
1603
|
if (v === L)
|
|
1593
|
-
|
|
1604
|
+
w = b;
|
|
1594
1605
|
else
|
|
1595
1606
|
break;
|
|
1596
1607
|
}
|
|
@@ -1604,11 +1615,11 @@ class ae {
|
|
|
1604
1615
|
else
|
|
1605
1616
|
break;
|
|
1606
1617
|
}
|
|
1607
|
-
for (let b =
|
|
1618
|
+
for (let b = w; b < e; b++) {
|
|
1608
1619
|
const { height: O } = this.positions[b];
|
|
1609
|
-
|
|
1620
|
+
C += O;
|
|
1610
1621
|
}
|
|
1611
|
-
for (let b =
|
|
1622
|
+
for (let b = w; b <= E; b++) {
|
|
1612
1623
|
const { height: O } = this.positions[b];
|
|
1613
1624
|
_ += O;
|
|
1614
1625
|
const L = this.rowIndexRowKeyMap.get(b) || "", { item: M } = this.rowKeyMap.get(L), T = this.getItemValue(L, i);
|
|
@@ -1620,15 +1631,15 @@ class ae {
|
|
|
1620
1631
|
});
|
|
1621
1632
|
}
|
|
1622
1633
|
}
|
|
1623
|
-
if (u !== 1 &&
|
|
1634
|
+
if (u !== 1 && g) {
|
|
1624
1635
|
_ = f;
|
|
1625
1636
|
for (let v = l - 1; v >= 0; v--) {
|
|
1626
1637
|
const b = this.getColumnByColIndex(v);
|
|
1627
1638
|
if (!b)
|
|
1628
1639
|
break;
|
|
1629
1640
|
const O = this.getItemValue(s, i), L = this.getItemValue(s, b.key);
|
|
1630
|
-
if (O === L &&
|
|
1631
|
-
|
|
1641
|
+
if (O === L && h.includes(b.key))
|
|
1642
|
+
m = v;
|
|
1632
1643
|
else
|
|
1633
1644
|
break;
|
|
1634
1645
|
}
|
|
@@ -1637,18 +1648,18 @@ class ae {
|
|
|
1637
1648
|
if (!b)
|
|
1638
1649
|
break;
|
|
1639
1650
|
const O = this.getItemValue(s, i), L = this.getItemValue(s, b.key);
|
|
1640
|
-
if (O === L &&
|
|
1641
|
-
|
|
1651
|
+
if (O === L && h.includes(b.key))
|
|
1652
|
+
y = v;
|
|
1642
1653
|
else
|
|
1643
1654
|
break;
|
|
1644
1655
|
}
|
|
1645
|
-
for (let v =
|
|
1656
|
+
for (let v = m; v < l; v++) {
|
|
1646
1657
|
const b = this.getColumnByColIndex(v);
|
|
1647
1658
|
if (!b)
|
|
1648
1659
|
break;
|
|
1649
1660
|
I += b.width || 100;
|
|
1650
1661
|
}
|
|
1651
|
-
for (let v =
|
|
1662
|
+
for (let v = m; v <= y; v++) {
|
|
1652
1663
|
const b = this.getColumnByColIndex(v);
|
|
1653
1664
|
if (!b)
|
|
1654
1665
|
break;
|
|
@@ -1661,13 +1672,13 @@ class ae {
|
|
|
1661
1672
|
}
|
|
1662
1673
|
}
|
|
1663
1674
|
return {
|
|
1664
|
-
xArr: [
|
|
1665
|
-
yArr: [
|
|
1675
|
+
xArr: [m, y],
|
|
1676
|
+
yArr: [w, E],
|
|
1666
1677
|
rowspan: d,
|
|
1667
1678
|
colspan: u,
|
|
1668
1679
|
height: _,
|
|
1669
1680
|
width: S,
|
|
1670
|
-
offsetTop:
|
|
1681
|
+
offsetTop: C,
|
|
1671
1682
|
offsetLeft: I,
|
|
1672
1683
|
dataList: R
|
|
1673
1684
|
};
|
|
@@ -1682,7 +1693,7 @@ class ae {
|
|
|
1682
1693
|
const s = this.rowIndexRowKeyMap.get(t), o = `${s}_${e}`, r = this.getRowForRowIndex(t), l = this.getColumnByKey(e);
|
|
1683
1694
|
if (!s || !l || !r)
|
|
1684
1695
|
return;
|
|
1685
|
-
const a = this.getItemValue(s, e),
|
|
1696
|
+
const a = this.getItemValue(s, e), h = [
|
|
1686
1697
|
{
|
|
1687
1698
|
key: e,
|
|
1688
1699
|
rowKey: s,
|
|
@@ -1696,7 +1707,7 @@ class ae {
|
|
|
1696
1707
|
fieldValue: a
|
|
1697
1708
|
}
|
|
1698
1709
|
];
|
|
1699
|
-
this.validationErrorMap.set(o,
|
|
1710
|
+
this.validationErrorMap.set(o, h);
|
|
1700
1711
|
}
|
|
1701
1712
|
setValidationError(t, e, i) {
|
|
1702
1713
|
const s = `${t}_${e}`;
|
|
@@ -1767,7 +1778,7 @@ class he {
|
|
|
1767
1778
|
value: o.oldValue,
|
|
1768
1779
|
row: {}
|
|
1769
1780
|
}));
|
|
1770
|
-
this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1), this.historyIndex -= 1;
|
|
1781
|
+
this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1, !1), this.historyIndex -= 1;
|
|
1771
1782
|
}
|
|
1772
1783
|
}
|
|
1773
1784
|
// 前进
|
|
@@ -1780,7 +1791,7 @@ class he {
|
|
|
1780
1791
|
value: i.newValue,
|
|
1781
1792
|
row: {}
|
|
1782
1793
|
}));
|
|
1783
|
-
this.ctx.database.batchSetItemValue(e, !1);
|
|
1794
|
+
this.ctx.database.batchSetItemValue(e, !1, !1);
|
|
1784
1795
|
}
|
|
1785
1796
|
}
|
|
1786
1797
|
// 清空历史
|
|
@@ -1938,21 +1949,21 @@ class fe {
|
|
|
1938
1949
|
* @param {string} color - 阴影的颜色
|
|
1939
1950
|
*/
|
|
1940
1951
|
drawShadow(t, e, i, s, o) {
|
|
1941
|
-
const { fillColor: r, side: l, shadowWidth: a, colorStart:
|
|
1952
|
+
const { fillColor: r, side: l, shadowWidth: a, colorStart: h, colorEnd: d } = o;
|
|
1942
1953
|
this.ctx.save(), r && (this.ctx.fillStyle = r, this.ctx.fillRect(t, e, i, s));
|
|
1943
1954
|
let f;
|
|
1944
1955
|
switch (l) {
|
|
1945
1956
|
case "left":
|
|
1946
|
-
f = this.ctx.createLinearGradient(t - a, e, t, e), f.addColorStop(0,
|
|
1957
|
+
f = this.ctx.createLinearGradient(t - a, e, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t - a, e, a, s);
|
|
1947
1958
|
break;
|
|
1948
1959
|
case "right":
|
|
1949
|
-
f = this.ctx.createLinearGradient(t + i, e, t + i + a, e), f.addColorStop(0,
|
|
1960
|
+
f = this.ctx.createLinearGradient(t + i, e, t + i + a, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t + i, e, a, s);
|
|
1950
1961
|
break;
|
|
1951
1962
|
case "top":
|
|
1952
|
-
f = this.ctx.createLinearGradient(t, e - a, t, e), f.addColorStop(0,
|
|
1963
|
+
f = this.ctx.createLinearGradient(t, e - a, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e - a, i, a);
|
|
1953
1964
|
break;
|
|
1954
1965
|
case "bottom":
|
|
1955
|
-
f = this.ctx.createLinearGradient(t, e + s, t, e + s + a), f.addColorStop(0,
|
|
1966
|
+
f = this.ctx.createLinearGradient(t, e + s, t, e + s + a), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e + s, i, a);
|
|
1956
1967
|
break;
|
|
1957
1968
|
default:
|
|
1958
1969
|
console.error("Invalid side specified for shadow");
|
|
@@ -1977,8 +1988,8 @@ class fe {
|
|
|
1977
1988
|
if (this.ctx.save(), this.ctx.beginPath(), l !== void 0 && (this.ctx.fillStyle = l), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), a === 0)
|
|
1978
1989
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
1979
1990
|
else {
|
|
1980
|
-
const [
|
|
1981
|
-
this.ctx.moveTo(t +
|
|
1991
|
+
const [h, d, f, x] = typeof a == "number" ? [a, a, a, a] : a;
|
|
1992
|
+
this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + h, e, h);
|
|
1982
1993
|
}
|
|
1983
1994
|
l !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1984
1995
|
}
|
|
@@ -1997,17 +2008,17 @@ class fe {
|
|
|
1997
2008
|
const {
|
|
1998
2009
|
font: l = "12px Arial",
|
|
1999
2010
|
align: a = "center",
|
|
2000
|
-
color:
|
|
2011
|
+
color: h = "#495060",
|
|
2001
2012
|
padding: d = 0,
|
|
2002
2013
|
verticalAlign: f = "middle"
|
|
2003
2014
|
} = r;
|
|
2004
|
-
this.ctx.font = l, this.ctx.fillStyle =
|
|
2015
|
+
this.ctx.font = l, this.ctx.fillStyle = h, this.ctx.textBaseline = f, this.ctx.textAlign = a;
|
|
2005
2016
|
let x = 0;
|
|
2006
2017
|
f === "top" ? x = i + d : f === "bottom" ? x = i + o - d : x = i + (o + 1) / 2;
|
|
2007
2018
|
let u = 0;
|
|
2008
2019
|
a === "left" ? u = e + d : a === "right" ? u = e + s - d : u = e + s / 2;
|
|
2009
|
-
const { _text: p, ellipsis:
|
|
2010
|
-
return this.ctx.fillText(p, u, x), this.ctx.restore(),
|
|
2020
|
+
const { _text: p, ellipsis: g } = this.handleEllipsis(t, s, d, l);
|
|
2021
|
+
return this.ctx.fillText(p, u, x), this.ctx.restore(), g;
|
|
2011
2022
|
}
|
|
2012
2023
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
2013
2024
|
let o = !1, r = t;
|
|
@@ -2019,9 +2030,9 @@ class fe {
|
|
|
2019
2030
|
const l = this.ctx.measureText("...").width, a = this.ctx.measureText(t).width;
|
|
2020
2031
|
if (a && a + l >= e - i * 2) {
|
|
2021
2032
|
o = !0;
|
|
2022
|
-
let
|
|
2033
|
+
let h = 0;
|
|
2023
2034
|
for (let d = 0; d < t.length; d++)
|
|
2024
|
-
if (
|
|
2035
|
+
if (h += this.ctx.measureText(t[d]).width, h >= e - i * 2 - l) {
|
|
2025
2036
|
r = t.slice(0, d) + "...";
|
|
2026
2037
|
break;
|
|
2027
2038
|
}
|
|
@@ -2185,6 +2196,9 @@ class Ct {
|
|
|
2185
2196
|
n(this, "SELECTOR_AREA_MAX_Y", 0);
|
|
2186
2197
|
/** 选择器Y最大范围,0默认rowMax */
|
|
2187
2198
|
n(this, "SELECTOR_AREA_MAX_Y_OFFSET", 0);
|
|
2199
|
+
/** 选择器值类型,value,displayText,区别displayText受format影响 */
|
|
2200
|
+
n(this, "SELECTOR_CELL_VALUE_TYPE", "value");
|
|
2201
|
+
// displayText | value
|
|
2188
2202
|
/** 启用自动主题 */
|
|
2189
2203
|
n(this, "ENABLE_AUTO_THEME", !0);
|
|
2190
2204
|
/** 启用选择器-选择器单选 */
|
|
@@ -2416,21 +2430,21 @@ class xe {
|
|
|
2416
2430
|
}
|
|
2417
2431
|
async createImageFromSVG(t, e, i = !1) {
|
|
2418
2432
|
const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
2419
|
-
e && r.querySelectorAll("*").forEach((
|
|
2420
|
-
|
|
2433
|
+
e && r.querySelectorAll("*").forEach((h) => {
|
|
2434
|
+
h.setAttribute("fill", e);
|
|
2421
2435
|
});
|
|
2422
2436
|
const l = new Image();
|
|
2423
2437
|
let a = "";
|
|
2424
2438
|
if (i) {
|
|
2425
|
-
const
|
|
2439
|
+
const h = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
2426
2440
|
type: "image/svg+xml"
|
|
2427
2441
|
});
|
|
2428
|
-
a = URL.createObjectURL(
|
|
2442
|
+
a = URL.createObjectURL(h);
|
|
2429
2443
|
} else
|
|
2430
2444
|
a = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(r));
|
|
2431
|
-
return l.src = a, new Promise((
|
|
2445
|
+
return l.src = a, new Promise((h, d) => {
|
|
2432
2446
|
l.onerror = () => d(new Error("Failed to load image")), l.onload = () => {
|
|
2433
|
-
|
|
2447
|
+
h(l);
|
|
2434
2448
|
};
|
|
2435
2449
|
});
|
|
2436
2450
|
}
|
|
@@ -2501,11 +2515,11 @@ class Xt extends Dt {
|
|
|
2501
2515
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2502
2516
|
let o = i, r = s;
|
|
2503
2517
|
if (typeof e == "function") {
|
|
2504
|
-
const l = e, { backgroundColor: a, color:
|
|
2518
|
+
const l = e, { backgroundColor: a, color: h } = l({
|
|
2505
2519
|
colIndex: this.colIndex,
|
|
2506
2520
|
column: this.column
|
|
2507
2521
|
}) || {};
|
|
2508
|
-
a && (o = a),
|
|
2522
|
+
a && (o = a), h && (r = h);
|
|
2509
2523
|
}
|
|
2510
2524
|
this.drawCellBgColor = o, this.drawTextColor = r;
|
|
2511
2525
|
}
|
|
@@ -2516,11 +2530,11 @@ class Xt extends Dt {
|
|
|
2516
2530
|
const {
|
|
2517
2531
|
paint: e,
|
|
2518
2532
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: o, BORDER: r }
|
|
2519
|
-
} = this.ctx, { drawX: l, drawY: a, displayText:
|
|
2533
|
+
} = this.ctx, { drawX: l, drawY: a, displayText: h } = this;
|
|
2520
2534
|
e.drawRect(l, a, this.width, this.height, {
|
|
2521
2535
|
borderColor: r ? i : "transparent",
|
|
2522
2536
|
fillColor: this.drawCellBgColor
|
|
2523
|
-
}), this.ellipsis = e.drawText(
|
|
2537
|
+
}), this.ellipsis = e.drawText(h, l, a, this.width, this.height, {
|
|
2524
2538
|
font: o,
|
|
2525
2539
|
padding: s,
|
|
2526
2540
|
color: this.drawTextColor,
|
|
@@ -2541,9 +2555,9 @@ class Xt extends Dt {
|
|
|
2541
2555
|
drawSelection() {
|
|
2542
2556
|
const { width: e, height: i, type: s } = this;
|
|
2543
2557
|
if (["index-selection", "selection"].includes(s)) {
|
|
2544
|
-
const { indeterminate: o, check: r, selectable: l } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: a = 0 } = this.ctx.config,
|
|
2558
|
+
const { indeterminate: o, check: r, selectable: l } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: a = 0 } = this.ctx.config, h = this.drawX + (e - a) / 2, d = this.drawY + (i - a) / 2;
|
|
2545
2559
|
let f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2546
|
-
o ? (f = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : r && l ? (f = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : r && l ? (f = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !r && l ? (f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (f = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), f && (this.drawImageX =
|
|
2560
|
+
o ? (f = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : r && l ? (f = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : r && l ? (f = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !r && l ? (f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (f = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), f && (this.drawImageX = h, this.drawImageY = d, this.drawImageWidth = a, this.drawImageHeight = a, this.drawImageName = x, this.drawImageSource = f, this.ctx.paint.drawImage(
|
|
2547
2561
|
this.drawImageSource,
|
|
2548
2562
|
this.drawImageX,
|
|
2549
2563
|
this.drawImageY,
|
|
@@ -2716,13 +2730,13 @@ class ue {
|
|
|
2716
2730
|
for (const r of i) {
|
|
2717
2731
|
const l = r.fixedCells.concat(r.noFixedCells);
|
|
2718
2732
|
for (const a of l) {
|
|
2719
|
-
const
|
|
2733
|
+
const h = a.getDrawX(), d = a.getDrawY();
|
|
2720
2734
|
if (o) {
|
|
2721
|
-
if (t >
|
|
2735
|
+
if (t > h && t < h + a.visibleWidth && e > d && e < d + a.visibleHeight) {
|
|
2722
2736
|
s(a);
|
|
2723
2737
|
return;
|
|
2724
2738
|
}
|
|
2725
|
-
} else if (t >
|
|
2739
|
+
} else if (t > h && t < h + a.width && e > d && e < d + a.height) {
|
|
2726
2740
|
s(a);
|
|
2727
2741
|
return;
|
|
2728
2742
|
}
|
|
@@ -2785,6 +2799,10 @@ class ge {
|
|
|
2785
2799
|
// 只有合并单元格
|
|
2786
2800
|
n(this, "selectOnlyOne", !1);
|
|
2787
2801
|
// 只选择一个
|
|
2802
|
+
n(this, "hasSelection", !1);
|
|
2803
|
+
// 是否有选中
|
|
2804
|
+
n(this, "hasTree", !1);
|
|
2805
|
+
// 是否有树形结构
|
|
2788
2806
|
n(this, "scrollY", 0);
|
|
2789
2807
|
n(this, "scrollX", 0);
|
|
2790
2808
|
n(this, "fixedLeftWidth", 0);
|
|
@@ -2859,38 +2877,38 @@ class ge {
|
|
|
2859
2877
|
overlayerElement: r,
|
|
2860
2878
|
editorElement: l,
|
|
2861
2879
|
emptyElement: a,
|
|
2862
|
-
contextMenuElement:
|
|
2880
|
+
contextMenuElement: h
|
|
2863
2881
|
} = t;
|
|
2864
|
-
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = l, this.emptyElement = a, this.contextMenuElement =
|
|
2882
|
+
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = l, this.emptyElement = a, this.contextMenuElement = h, this.config = new Ct(e.config || {}), this.eventBus = new de(), this.eventBrowser = new ce(this), this.eventTable = new ue(this), this.paint = new fe(this.canvasElement), this.database = new ae(this, e), this.history = new he(this), this.icons = new xe(this);
|
|
2865
2883
|
}
|
|
2866
2884
|
setConfig(t) {
|
|
2867
2885
|
this.config = new Ct(t);
|
|
2868
2886
|
}
|
|
2869
|
-
setItemValueByEditor(t, e, i, s = !0, o = !0) {
|
|
2887
|
+
setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
|
|
2870
2888
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
2871
|
-
const
|
|
2872
|
-
if (
|
|
2873
|
-
const { dataList:
|
|
2874
|
-
this.database.batchSetItemValue(
|
|
2889
|
+
const l = this.database.getVirtualBodyCellByKey(t, e);
|
|
2890
|
+
if (l && (l.mergeRow || l.mergeCol)) {
|
|
2891
|
+
const { dataList: a } = l.getSpanInfo(), h = a.map((d) => ({ ...d, value: i }));
|
|
2892
|
+
this.database.batchSetItemValue(h, s, r);
|
|
2875
2893
|
return;
|
|
2876
2894
|
}
|
|
2877
2895
|
}
|
|
2878
|
-
this.database.setItemValue(t, e, i, s, o, !0);
|
|
2896
|
+
this.database.setItemValue(t, e, i, s, o, !0, r);
|
|
2879
2897
|
}
|
|
2880
|
-
batchSetItemValueByEditor(t, e = !0) {
|
|
2898
|
+
batchSetItemValueByEditor(t, e = !0, i = !0) {
|
|
2881
2899
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
2882
|
-
const
|
|
2883
|
-
t.forEach((
|
|
2884
|
-
const
|
|
2885
|
-
if (
|
|
2886
|
-
const
|
|
2887
|
-
if (
|
|
2888
|
-
const { dataList:
|
|
2889
|
-
|
|
2900
|
+
const s = [];
|
|
2901
|
+
t.forEach((o) => {
|
|
2902
|
+
const r = this.database.getRowIndexForRowKey(o.rowKey), l = this.database.getColIndexForKey(o.key);
|
|
2903
|
+
if (r === void 0 || l === void 0) return;
|
|
2904
|
+
const a = this.database.getVirtualBodyCell(r, l);
|
|
2905
|
+
if (a) {
|
|
2906
|
+
const { dataList: h } = a.getSpanInfo(), d = h.map((f) => ({ ...f, value: o.value }));
|
|
2907
|
+
s.push(...d);
|
|
2890
2908
|
}
|
|
2891
|
-
}), this.database.batchSetItemValue(
|
|
2909
|
+
}), this.database.batchSetItemValue(s, e, i);
|
|
2892
2910
|
} else
|
|
2893
|
-
this.database.batchSetItemValue(t, e);
|
|
2911
|
+
this.database.batchSetItemValue(t, e, i);
|
|
2894
2912
|
}
|
|
2895
2913
|
setFocusCell(t) {
|
|
2896
2914
|
var e;
|
|
@@ -2930,8 +2948,8 @@ class ge {
|
|
|
2930
2948
|
for (let o = 0; o <= e[1] - e[0]; o++) {
|
|
2931
2949
|
const r = [];
|
|
2932
2950
|
for (let l = 0; l <= i[1] - i[0]; l++) {
|
|
2933
|
-
const a = o + e[0],
|
|
2934
|
-
d && r.push(d.
|
|
2951
|
+
const a = o + e[0], h = l + i[0], d = this.database.getVirtualBodyCell(a, h);
|
|
2952
|
+
d && (d.selectorCellValueType === "displayText" ? r.push(d.displayText) : r.push(d.getValue()));
|
|
2935
2953
|
}
|
|
2936
2954
|
s += `${r.join(" ")}\r`, t.push(r);
|
|
2937
2955
|
}
|
|
@@ -3078,24 +3096,24 @@ class Rt {
|
|
|
3078
3096
|
stageHeight: i,
|
|
3079
3097
|
stageWidth: s,
|
|
3080
3098
|
config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER: l }
|
|
3081
|
-
} = this.ctx, a = s,
|
|
3099
|
+
} = this.ctx, a = s, h = i, d = e.height, f = e.width, x = t.height, u = this.ctx.footer.height;
|
|
3082
3100
|
if (this.type === "vertical") {
|
|
3083
|
-
this.visibleDistance =
|
|
3101
|
+
this.visibleDistance = h - o - d, this.distance = x - this.visibleDistance + u, this.trackX = a - o, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + o, d], this.trackWidth = o, this.trackHeight = h, this.barX = this.trackX - 1 + (o - r) / 2, this.barWidth = r;
|
|
3084
3102
|
const p = this.distance ? this.visibleDistance / (x + u) : 0;
|
|
3085
|
-
let
|
|
3086
|
-
|
|
3103
|
+
let g = Math.floor(p * this.visibleDistance);
|
|
3104
|
+
g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
3087
3105
|
} else {
|
|
3088
3106
|
this.visibleDistance = a - o, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3089
3107
|
a - o,
|
|
3090
|
-
|
|
3108
|
+
h - o,
|
|
3091
3109
|
a - o,
|
|
3092
|
-
|
|
3110
|
+
h
|
|
3093
3111
|
];
|
|
3094
3112
|
const p = l ? 0 : 0.5;
|
|
3095
|
-
this.trackX = 0, this.trackY =
|
|
3096
|
-
const
|
|
3097
|
-
let
|
|
3098
|
-
this.barY = this.trackY - 1 + (o - r) / 2,
|
|
3113
|
+
this.trackX = 0, this.trackY = h - o + p, this.trackWidth = a, this.trackHeight = o;
|
|
3114
|
+
const g = this.distance ? this.visibleDistance / f : 0;
|
|
3115
|
+
let w = Math.floor(g * this.visibleDistance);
|
|
3116
|
+
this.barY = this.trackY - 1 + (o - r) / 2, w < 30 ? w = 30 : w >= this.visibleDistance && (w = 0), this.barWidth = w, this.barHeight = r, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
3099
3117
|
}
|
|
3100
3118
|
}
|
|
3101
3119
|
draw() {
|
|
@@ -3232,10 +3250,10 @@ class pe {
|
|
|
3232
3250
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
3233
3251
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3234
3252
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3235
|
-
const s = Tt(i), o =
|
|
3253
|
+
const s = Tt(i), o = et(i);
|
|
3236
3254
|
this.height = t * s, this.width = o.reduce((f, x) => {
|
|
3237
|
-
const u = x.width || 100, { maxWidth: p, minWidth:
|
|
3238
|
-
return p && u > p ? f + p :
|
|
3255
|
+
const u = x.width || 100, { maxWidth: p, minWidth: g } = x;
|
|
3256
|
+
return p && u > p ? f + p : g && u < g ? f + g : f + u;
|
|
3239
3257
|
}, 0), this.visibleHeight = this.height;
|
|
3240
3258
|
const r = ee(At(i, s));
|
|
3241
3259
|
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
@@ -3246,8 +3264,8 @@ class pe {
|
|
|
3246
3264
|
const f = Math.floor(a / this.resizeNum * 100) / 100;
|
|
3247
3265
|
this.resizeAllColumn(f);
|
|
3248
3266
|
}
|
|
3249
|
-
const
|
|
3250
|
-
this.ctx.fixedLeftWidth =
|
|
3267
|
+
const h = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
|
|
3268
|
+
this.ctx.fixedLeftWidth = h.reduce((f, x) => f + x.width, 0);
|
|
3251
3269
|
const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
|
|
3252
3270
|
this.ctx.fixedRightWidth = d.reduce((f, x) => f + x.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
3253
3271
|
}
|
|
@@ -3280,8 +3298,8 @@ class pe {
|
|
|
3280
3298
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3281
3299
|
const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3282
3300
|
for (const r of o) {
|
|
3283
|
-
const { offsetX: l, offsetY: a } = this.ctx.getOffset(e),
|
|
3284
|
-
|
|
3301
|
+
const { offsetX: l, offsetY: a } = this.ctx.getOffset(e), h = l, d = r.getDrawX();
|
|
3302
|
+
h > d + r.width - 5 && h < d + r.width + 4 && h < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3285
3303
|
r.colspan <= 1 && this.ctx.isTarget(e) && a <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = r);
|
|
3286
3304
|
}
|
|
3287
3305
|
}
|
|
@@ -3336,10 +3354,10 @@ class pe {
|
|
|
3336
3354
|
let s = e;
|
|
3337
3355
|
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
3338
3356
|
for (let r = 0; r < i; r++) {
|
|
3339
|
-
const l = t[r], a = o * (l.rowspan || 0),
|
|
3357
|
+
const l = t[r], a = o * (l.rowspan || 0), h = o * (l.level || 0);
|
|
3340
3358
|
let { minWidth: d, maxWidth: f } = l, x = l.width || 100;
|
|
3341
|
-
d && x < d && (x = d), f && x > f && (x = f), l.children && (x =
|
|
3342
|
-
const u = new Xt(this.ctx, this.columnIndex, s,
|
|
3359
|
+
d && x < d && (x = d), f && x > f && (x = f), l.children && (x = et(l.children).reduce((g, w) => g + ((w == null ? void 0 : w.width) || 100), 0));
|
|
3360
|
+
const u = new Xt(this.ctx, this.columnIndex, s, h, x, a, l);
|
|
3343
3361
|
this.ctx.database.setHeader(l.key, u), this.allCellHeaders.push(u), l.children || (this.leafCellHeaders.push(u), u.column.widthFillDisable || this.resizeNum++), l.fixed === "left" ? this.fixedLeftCellHeaders.push(u) : l.fixed === "right" ? this.fixedRightCellHeaders.push(u) : this.centerCellHeaders.push(u), !l.children && this.columnIndex++, l.children && this.render(l.children, s), s += x;
|
|
3344
3362
|
}
|
|
3345
3363
|
}
|
|
@@ -3413,7 +3431,7 @@ class pe {
|
|
|
3413
3431
|
}), this.drawTipLine(), this.drawBottomLine();
|
|
3414
3432
|
}
|
|
3415
3433
|
}
|
|
3416
|
-
class
|
|
3434
|
+
class Bt {
|
|
3417
3435
|
constructor(t, e, i = 0, s = 0, o = 0, r = 0, l, a = "body") {
|
|
3418
3436
|
n(this, "ctx");
|
|
3419
3437
|
n(this, "x", 0);
|
|
@@ -3506,7 +3524,7 @@ class Ee {
|
|
|
3506
3524
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3507
3525
|
HEIGHT: l,
|
|
3508
3526
|
EMPTY_BODY_HEIGHT: a = 0,
|
|
3509
|
-
MAX_HEIGHT:
|
|
3527
|
+
MAX_HEIGHT: h = 0,
|
|
3510
3528
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3511
3529
|
OFFSET_HEIGHT: f = 0,
|
|
3512
3530
|
FOOTER_POSITION: x
|
|
@@ -3517,20 +3535,20 @@ class Ee {
|
|
|
3517
3535
|
this.x = 0, x === "top" && o ? this.y = e.height + i.height : this.y = e.height;
|
|
3518
3536
|
const { data: u, sumHeight: p } = s.getData();
|
|
3519
3537
|
this.height = p, this.data = u, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
3520
|
-
const
|
|
3521
|
-
!this.data.length && !l ? this.height = a : !this.data.length && l && (this.height = l - e.height -
|
|
3522
|
-
let
|
|
3523
|
-
|
|
3524
|
-
let E =
|
|
3525
|
-
const
|
|
3526
|
-
if (
|
|
3527
|
-
const L =
|
|
3528
|
-
L > e.height + r ? E = L :
|
|
3529
|
-
} else this.data.length && l ? E = l : this.data.length &&
|
|
3538
|
+
const g = this.ctx.footer.height;
|
|
3539
|
+
!this.data.length && !l ? this.height = a : !this.data.length && l && (this.height = l - e.height - g - r);
|
|
3540
|
+
let w = this.height + e.height + r;
|
|
3541
|
+
w += g;
|
|
3542
|
+
let E = w;
|
|
3543
|
+
const m = window.innerHeight, { top: y } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
|
|
3544
|
+
if (m > y && d && !l) {
|
|
3545
|
+
const L = m - y - f;
|
|
3546
|
+
L > e.height + r ? E = L : w > h && (E = h);
|
|
3547
|
+
} else this.data.length && l ? E = l : this.data.length && h && w > h && (E = h);
|
|
3530
3548
|
E > 0 && (this.ctx.stageHeight = Math.floor(E), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
|
|
3531
3549
|
let R = this.ctx.stageHeight - e.height - r;
|
|
3532
|
-
o ? this.visibleHeight = R -
|
|
3533
|
-
const
|
|
3550
|
+
o ? this.visibleHeight = R - g : this.visibleHeight = R, this.data.length || (this.height = this.visibleHeight), this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = u;
|
|
3551
|
+
const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
|
|
3534
3552
|
t.width = Math.round(I), t.height = Math.round(_);
|
|
3535
3553
|
const S = this.data.length ? "not-empty" : "empty";
|
|
3536
3554
|
this.ctx.emit("emptyChange", {
|
|
@@ -3538,12 +3556,12 @@ class Ee {
|
|
|
3538
3556
|
type: S,
|
|
3539
3557
|
headerHeight: e.height,
|
|
3540
3558
|
bodyHeight: this.height,
|
|
3541
|
-
footerHeight:
|
|
3559
|
+
footerHeight: g,
|
|
3542
3560
|
width: this.width,
|
|
3543
|
-
height: this.data.length ? 0 : a +
|
|
3561
|
+
height: this.data.length ? 0 : a + g
|
|
3544
3562
|
});
|
|
3545
|
-
const v = Math.round(t.width /
|
|
3546
|
-
this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${v}px;`), this.ctx.paint.scale(
|
|
3563
|
+
const v = Math.round(t.width / C * 1e4) / 1e4, b = Math.round(t.height / C * 1e4) / 1e4;
|
|
3564
|
+
this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${v}px;`), this.ctx.paint.scale(C);
|
|
3547
3565
|
}
|
|
3548
3566
|
// 调整行的高度
|
|
3549
3567
|
initResizeRow() {
|
|
@@ -3564,7 +3582,7 @@ class Ee {
|
|
|
3564
3582
|
if (this.ctx.editing) return;
|
|
3565
3583
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s, l = e.clientY, {
|
|
3566
3584
|
stageHeight: a,
|
|
3567
|
-
scrollY:
|
|
3585
|
+
scrollY: h,
|
|
3568
3586
|
config: { RESIZE_ROW_MIN_HEIGHT: d = 0 }
|
|
3569
3587
|
} = this.ctx;
|
|
3570
3588
|
if (this.isResizing && this.resizeTarget) {
|
|
@@ -3583,10 +3601,10 @@ class Ee {
|
|
|
3583
3601
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3584
3602
|
for (let f = 0; f < this.renderRows.length; f++) {
|
|
3585
3603
|
const x = this.renderRows[f];
|
|
3586
|
-
if (o > x.y -
|
|
3604
|
+
if (o > x.y - h + x.height - 1.5 && o < x.y - h + x.height + 1.5 && o < a - 4)
|
|
3587
3605
|
for (let p = 0; p < x.cells.length; p++) {
|
|
3588
|
-
const
|
|
3589
|
-
r >
|
|
3606
|
+
const g = x.cells[p];
|
|
3607
|
+
r > g.drawX + 10 && r < g.drawX + g.width - 10 && g.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
3590
3608
|
}
|
|
3591
3609
|
}
|
|
3592
3610
|
}
|
|
@@ -3661,16 +3679,16 @@ class Ee {
|
|
|
3661
3679
|
config: { CELL_HEIGHT: s }
|
|
3662
3680
|
} = this.ctx, o = i, { data: r, positions: l } = e.getData();
|
|
3663
3681
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3664
|
-
let a = this.binarySearch(l, o),
|
|
3665
|
-
if (
|
|
3682
|
+
let a = this.binarySearch(l, o), h = this.binarySearch(l, o + this.visibleHeight);
|
|
3683
|
+
if (h === -1 && (h = this.ctx.maxRowIndex), a === -1 && h === this.ctx.maxRowIndex) {
|
|
3666
3684
|
const f = Math.floor(this.visibleHeight / s);
|
|
3667
3685
|
a = this.ctx.maxRowIndex - f;
|
|
3668
3686
|
}
|
|
3669
|
-
this.headIndex = Math.max(0, a), this.tailIndex = Math.min(this.ctx.maxRowIndex,
|
|
3687
|
+
this.headIndex = Math.max(0, a), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3670
3688
|
const d = [];
|
|
3671
3689
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3672
|
-
const x = this.headIndex + f, u = this.visibleRows[f], { height: p, top:
|
|
3673
|
-
d.push(
|
|
3690
|
+
const x = this.headIndex + f, u = this.visibleRows[f], { height: p, top: g } = this.ctx.database.getPositionForRowIndex(x), w = new Bt(this.ctx, x, 0, g + this.y, t.width, p, u);
|
|
3691
|
+
d.push(w);
|
|
3674
3692
|
}
|
|
3675
3693
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
3676
3694
|
}
|
|
@@ -3725,8 +3743,8 @@ class me {
|
|
|
3725
3743
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3726
3744
|
colorEnd: "rgba(0,0,0,0)"
|
|
3727
3745
|
}), i < Math.floor(s.width - o - 1) && e !== l) {
|
|
3728
|
-
const
|
|
3729
|
-
this.ctx.paint.drawShadow(
|
|
3746
|
+
const h = s.width - (this.x + this.width) + o - e;
|
|
3747
|
+
this.ctx.paint.drawShadow(h, a, e, this.height, {
|
|
3730
3748
|
fillColor: r,
|
|
3731
3749
|
side: "left",
|
|
3732
3750
|
shadowWidth: 4,
|
|
@@ -3741,7 +3759,7 @@ class me {
|
|
|
3741
3759
|
let e = this.y;
|
|
3742
3760
|
const i = [];
|
|
3743
3761
|
this.data.forEach((s, o) => {
|
|
3744
|
-
const r = new
|
|
3762
|
+
const r = new Bt(this.ctx, o, 0, e, this.width, t, s, "footer");
|
|
3745
3763
|
e += t, i.push(r);
|
|
3746
3764
|
}), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
|
|
3747
3765
|
}
|
|
@@ -3885,22 +3903,22 @@ class ye {
|
|
|
3885
3903
|
const {
|
|
3886
3904
|
SELECTOR_AREA_MIN_X: l,
|
|
3887
3905
|
SELECTOR_AREA_MAX_X: a,
|
|
3888
|
-
SELECTOR_AREA_MIN_Y:
|
|
3906
|
+
SELECTOR_AREA_MIN_Y: h,
|
|
3889
3907
|
SELECTOR_AREA_MAX_Y: d,
|
|
3890
3908
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
3891
3909
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
3892
|
-
} = this.ctx.config, u = l, p = a || this.ctx.maxColIndex - f,
|
|
3893
|
-
let [E,
|
|
3894
|
-
if (E < u ||
|
|
3910
|
+
} = this.ctx.config, u = l, p = a || this.ctx.maxColIndex - f, g = h, w = d || this.ctx.maxRowIndex - x;
|
|
3911
|
+
let [E, m] = o, [y, R] = r;
|
|
3912
|
+
if (E < u || m > p || y < g || R > w)
|
|
3895
3913
|
return;
|
|
3896
3914
|
if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
3897
3915
|
const I = this.adjustMergeCells(o, r);
|
|
3898
|
-
|
|
3916
|
+
y = I.yArr[0], R = I.yArr[1], E = I.xArr[0], m = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
|
|
3899
3917
|
}
|
|
3900
|
-
E ===
|
|
3901
|
-
const { BEFORE_SET_SELECTOR_METHOD:
|
|
3902
|
-
if (typeof
|
|
3903
|
-
const _ =
|
|
3918
|
+
E === m && y === R ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(u, E), Math.min(p, m)], r = [Math.max(g, y), Math.min(w, R)];
|
|
3919
|
+
const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
|
|
3920
|
+
if (typeof C == "function") {
|
|
3921
|
+
const _ = C({
|
|
3904
3922
|
focusCell: this.ctx.focusCell,
|
|
3905
3923
|
xArr: o,
|
|
3906
3924
|
yArr: r
|
|
@@ -3916,34 +3934,34 @@ class ye {
|
|
|
3916
3934
|
var p;
|
|
3917
3935
|
const [i, s] = e, [o, r] = t;
|
|
3918
3936
|
let l = [], a = [];
|
|
3919
|
-
for (let
|
|
3920
|
-
for (let
|
|
3921
|
-
const E =
|
|
3922
|
-
|
|
3937
|
+
for (let g = 0; g <= e[1] - e[0]; g++)
|
|
3938
|
+
for (let w = 0; w <= t[1] - t[0]; w++) {
|
|
3939
|
+
const E = g + e[0], m = w + t[0], y = this.ctx.database.getVirtualBodyCell(E, m);
|
|
3940
|
+
y && ((E === i || E === s) && l.push(y), (m === o || m === r) && a.push(y));
|
|
3923
3941
|
}
|
|
3924
|
-
const
|
|
3925
|
-
(
|
|
3926
|
-
const { yArr: E } =
|
|
3927
|
-
return
|
|
3942
|
+
const h = l.reduce(
|
|
3943
|
+
(g, w) => {
|
|
3944
|
+
const { yArr: E } = w.getSpanInfo(), [m, y] = E;
|
|
3945
|
+
return g.minY = Math.min(g.minY, m), g.maxY = Math.max(g.maxY, y), g;
|
|
3928
3946
|
},
|
|
3929
3947
|
{
|
|
3930
3948
|
minY: i,
|
|
3931
3949
|
maxY: s
|
|
3932
3950
|
}
|
|
3933
3951
|
), d = a.reduce(
|
|
3934
|
-
(
|
|
3935
|
-
const { xArr: E } =
|
|
3936
|
-
return
|
|
3952
|
+
(g, w) => {
|
|
3953
|
+
const { xArr: E } = w.getSpanInfo(), [m, y] = E;
|
|
3954
|
+
return g.minX = Math.min(g.minX, m), g.maxX = Math.max(g.maxX, y), g;
|
|
3937
3955
|
},
|
|
3938
3956
|
{
|
|
3939
3957
|
minX: o,
|
|
3940
3958
|
maxX: r
|
|
3941
3959
|
}
|
|
3942
|
-
), f = [d.minX, d.maxX], x = [
|
|
3960
|
+
), f = [d.minX, d.maxX], x = [h.minY, h.maxY];
|
|
3943
3961
|
let u = !1;
|
|
3944
|
-
if (d.minX !== d.maxX ||
|
|
3945
|
-
const
|
|
3946
|
-
u = (
|
|
3962
|
+
if (d.minX !== d.maxX || h.minY !== h.maxY) {
|
|
3963
|
+
const g = JSON.stringify(f) + JSON.stringify(x), w = (p = this.ctx.focusCell) == null ? void 0 : p.getSpanInfo();
|
|
3964
|
+
u = (w && JSON.stringify(w.xArr) + JSON.stringify(w.yArr)) === g;
|
|
3947
3965
|
}
|
|
3948
3966
|
return {
|
|
3949
3967
|
xArr: f,
|
|
@@ -3962,11 +3980,11 @@ class ye {
|
|
|
3962
3980
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3963
3981
|
const { colIndex: l } = this.ctx.focusCellHeader;
|
|
3964
3982
|
if (this.ctx.clearSelector(), t.colIndex >= l) {
|
|
3965
|
-
const a = [l, t.colIndex + t.colspan - 1],
|
|
3966
|
-
this.setSelector(a,
|
|
3983
|
+
const a = [l, t.colIndex + t.colspan - 1], h = [o, r];
|
|
3984
|
+
this.setSelector(a, h);
|
|
3967
3985
|
} else {
|
|
3968
|
-
const a = [t.colIndex, l],
|
|
3969
|
-
this.setSelector(a,
|
|
3986
|
+
const a = [t.colIndex, l], h = [o, r];
|
|
3987
|
+
this.setSelector(a, h);
|
|
3970
3988
|
}
|
|
3971
3989
|
} else {
|
|
3972
3990
|
const l = [t.colIndex, t.colIndex + t.colspan - 1], a = [o, r];
|
|
@@ -3985,7 +4003,7 @@ class ye {
|
|
|
3985
4003
|
SELECTOR_AREA_MAX_Y: r,
|
|
3986
4004
|
SELECTOR_AREA_MAX_X_OFFSET: l,
|
|
3987
4005
|
SELECTOR_AREA_MAX_Y_OFFSET: a
|
|
3988
|
-
} = this.ctx.config,
|
|
4006
|
+
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - l, f = o, x = r || this.ctx.maxRowIndex - a, u = [h, d], p = [f, x];
|
|
3989
4007
|
this.setSelector(u, p);
|
|
3990
4008
|
}
|
|
3991
4009
|
}
|
|
@@ -3995,17 +4013,17 @@ class ye {
|
|
|
3995
4013
|
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o } = this.ctx.config, r = s || this.ctx.maxColIndex - o, l = i;
|
|
3996
4014
|
if (e) {
|
|
3997
4015
|
this.ctx.setFocusCell(t);
|
|
3998
|
-
const a = [l, r],
|
|
3999
|
-
this.setSelector(a,
|
|
4016
|
+
const a = [l, r], h = [t.rowIndex, t.rowIndex];
|
|
4017
|
+
this.setSelector(a, h);
|
|
4000
4018
|
}
|
|
4001
4019
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
4002
4020
|
const { rowIndex: a } = this.ctx.focusCell;
|
|
4003
4021
|
if (t.rowIndex >= a) {
|
|
4004
|
-
const
|
|
4005
|
-
this.setSelector(
|
|
4022
|
+
const h = [l, r], d = [a, t.rowIndex];
|
|
4023
|
+
this.setSelector(h, d);
|
|
4006
4024
|
} else {
|
|
4007
|
-
const
|
|
4008
|
-
this.setSelector(
|
|
4025
|
+
const h = [l, r], d = [t.rowIndex, a];
|
|
4026
|
+
this.setSelector(h, d);
|
|
4009
4027
|
}
|
|
4010
4028
|
}
|
|
4011
4029
|
}
|
|
@@ -4014,7 +4032,7 @@ class ye {
|
|
|
4014
4032
|
return;
|
|
4015
4033
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
4016
4034
|
if (t && e && i) {
|
|
4017
|
-
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), l = Math.max(i.colIndex, o), a = Math.min(i.rowIndex, s),
|
|
4035
|
+
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), l = Math.max(i.colIndex, o), a = Math.min(i.rowIndex, s), h = Math.max(i.rowIndex, s), d = [r, l], f = [a, h];
|
|
4018
4036
|
this.setSelector(d, f);
|
|
4019
4037
|
}
|
|
4020
4038
|
}
|
|
@@ -4024,7 +4042,7 @@ class ye {
|
|
|
4024
4042
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
4025
4043
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
|
|
4026
4044
|
return;
|
|
4027
|
-
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: l } = e, a = Math.min(r, s),
|
|
4045
|
+
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: l } = e, a = Math.min(r, s), h = Math.max(r, s), d = Math.min(l, o), f = Math.max(l, o), x = [a, h], u = [d, f];
|
|
4028
4046
|
this.setSelector(x, u);
|
|
4029
4047
|
} else {
|
|
4030
4048
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -4086,32 +4104,32 @@ class ye {
|
|
|
4086
4104
|
}), this.ctx.emit("draw");
|
|
4087
4105
|
}).catch((r) => console.error("Copy Failure:", r)) : console.error("current browser does not support the Clipboard API");
|
|
4088
4106
|
}
|
|
4089
|
-
clearSelectedData(t, e, i = !1) {
|
|
4090
|
-
let
|
|
4091
|
-
const
|
|
4092
|
-
for (let
|
|
4093
|
-
for (let
|
|
4094
|
-
const
|
|
4095
|
-
if (
|
|
4096
|
-
const { rowKey:
|
|
4097
|
-
this.ctx.database.getReadonly(
|
|
4098
|
-
rowKey:
|
|
4099
|
-
key:
|
|
4100
|
-
value:
|
|
4107
|
+
clearSelectedData(t, e, i = !1, s = null) {
|
|
4108
|
+
let o = [];
|
|
4109
|
+
const r = /* @__PURE__ */ new Set();
|
|
4110
|
+
for (let a = 0; a <= e[1] - e[0]; a++)
|
|
4111
|
+
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4112
|
+
const d = a + e[0], f = h + t[0], x = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
|
|
4113
|
+
if (x) {
|
|
4114
|
+
const { rowKey: u, key: p } = x;
|
|
4115
|
+
this.ctx.database.getReadonly(u, p) || (r.add(u), o.push({
|
|
4116
|
+
rowKey: u,
|
|
4117
|
+
key: p,
|
|
4118
|
+
value: s,
|
|
4101
4119
|
row: {}
|
|
4102
4120
|
//内部有设置
|
|
4103
4121
|
}));
|
|
4104
4122
|
}
|
|
4105
4123
|
}
|
|
4106
|
-
if (!
|
|
4124
|
+
if (!o.length)
|
|
4107
4125
|
return [];
|
|
4108
4126
|
if (i)
|
|
4109
|
-
return
|
|
4110
|
-
this.ctx.database.batchSetItemValue(
|
|
4111
|
-
let
|
|
4112
|
-
return
|
|
4113
|
-
|
|
4114
|
-
}), this.ctx.emit("clearSelectedDataChange",
|
|
4127
|
+
return o;
|
|
4128
|
+
this.ctx.database.batchSetItemValue(o, !0);
|
|
4129
|
+
let l = [];
|
|
4130
|
+
return r.forEach((a) => {
|
|
4131
|
+
l.push(this.ctx.database.getRowDataItemForRowKey(a));
|
|
4132
|
+
}), this.ctx.emit("clearSelectedDataChange", o, l), o;
|
|
4115
4133
|
}
|
|
4116
4134
|
paste() {
|
|
4117
4135
|
if (!navigator.clipboard) {
|
|
@@ -4123,36 +4141,36 @@ class ye {
|
|
|
4123
4141
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
4124
4142
|
navigator.clipboard.readText().then(async (o) => {
|
|
4125
4143
|
let r = se(o);
|
|
4126
|
-
const l = [i, i + r[0].length - 1], a = [e, e + r.length - 1], [
|
|
4144
|
+
const l = [i, i + r[0].length - 1], a = [e, e + r.length - 1], [h, d] = a, [f, x] = l, u = d - this.ctx.maxRowIndex, p = x - this.ctx.maxColIndex;
|
|
4127
4145
|
(u > 0 || p > 0) && this.ctx.emit("onPastedDataOverflow", {
|
|
4128
4146
|
maxY: d,
|
|
4129
4147
|
maxX: x,
|
|
4130
|
-
minY:
|
|
4148
|
+
minY: h,
|
|
4131
4149
|
minX: f,
|
|
4132
4150
|
overflowRowCount: u,
|
|
4133
4151
|
overflowColCount: p,
|
|
4134
4152
|
textArr: r
|
|
4135
4153
|
});
|
|
4136
|
-
const
|
|
4137
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !
|
|
4138
|
-
const
|
|
4154
|
+
const g = r.length === 1 && r[0].length === 1;
|
|
4155
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !g) {
|
|
4156
|
+
const y = {
|
|
4139
4157
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4140
4158
|
message: "Merged cells cannot span paste data"
|
|
4141
4159
|
};
|
|
4142
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4160
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", y) : alert(y.message);
|
|
4143
4161
|
return;
|
|
4144
4162
|
}
|
|
4145
|
-
let
|
|
4146
|
-
for (let
|
|
4147
|
-
const R = r[
|
|
4148
|
-
for (let
|
|
4149
|
-
const I =
|
|
4163
|
+
let w = [];
|
|
4164
|
+
for (let y = 0; y <= r.length - 1; y++) {
|
|
4165
|
+
const R = r[y].length;
|
|
4166
|
+
for (let C = 0; C <= R - 1; C++) {
|
|
4167
|
+
const I = y + e, _ = C + i, S = r[y][C], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4150
4168
|
I,
|
|
4151
4169
|
_
|
|
4152
4170
|
);
|
|
4153
4171
|
if (v) {
|
|
4154
4172
|
const { rowKey: b, key: O } = v;
|
|
4155
|
-
this.ctx.database.getReadonly(b, O) || (s.add(b),
|
|
4173
|
+
this.ctx.database.getReadonly(b, O) || (s.add(b), w.push({
|
|
4156
4174
|
rowKey: b,
|
|
4157
4175
|
key: O,
|
|
4158
4176
|
value: S,
|
|
@@ -4163,35 +4181,35 @@ class ye {
|
|
|
4163
4181
|
}
|
|
4164
4182
|
}
|
|
4165
4183
|
if (this.isCut) {
|
|
4166
|
-
const
|
|
4184
|
+
const y = this.clearSelectedData(
|
|
4167
4185
|
this.ctx.selector.xArrCopy,
|
|
4168
4186
|
this.ctx.selector.yArrCopy,
|
|
4169
4187
|
!0
|
|
4170
4188
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4171
|
-
), R =
|
|
4172
|
-
|
|
4173
|
-
R.includes(`${
|
|
4189
|
+
), R = w.map((C) => `${C.rowKey}-${C.key}`);
|
|
4190
|
+
y.forEach((C) => {
|
|
4191
|
+
R.includes(`${C.rowKey}-${C.key}`) || w.unshift(C);
|
|
4174
4192
|
}), this.isCut = !1;
|
|
4175
4193
|
}
|
|
4176
|
-
if (!
|
|
4194
|
+
if (!w.length)
|
|
4177
4195
|
return;
|
|
4178
4196
|
const { BEFORE_PASTE_DATA_METHOD: E } = this.ctx.config;
|
|
4179
4197
|
if (typeof E == "function") {
|
|
4180
|
-
const
|
|
4181
|
-
rowKey:
|
|
4182
|
-
key:
|
|
4183
|
-
value:
|
|
4184
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4185
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
4198
|
+
const y = E, R = w.map((C) => ({
|
|
4199
|
+
rowKey: C.rowKey,
|
|
4200
|
+
key: C.key,
|
|
4201
|
+
value: C.value,
|
|
4202
|
+
oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
|
|
4203
|
+
row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
|
|
4186
4204
|
}));
|
|
4187
|
-
if (
|
|
4205
|
+
if (w = await y(R, l, a, r), w && !w.length)
|
|
4188
4206
|
return;
|
|
4189
4207
|
}
|
|
4190
|
-
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(
|
|
4191
|
-
let
|
|
4192
|
-
s.forEach((
|
|
4193
|
-
|
|
4194
|
-
}), this.ctx.emit("pasteChange",
|
|
4208
|
+
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(w, !0);
|
|
4209
|
+
let m = [];
|
|
4210
|
+
s.forEach((y) => {
|
|
4211
|
+
m.push(this.ctx.database.getRowDataItemForRowKey(y));
|
|
4212
|
+
}), this.ctx.emit("pasteChange", w, m);
|
|
4195
4213
|
}).catch((o) => {
|
|
4196
4214
|
console.error("Failed to get the clipboard content:", o);
|
|
4197
4215
|
});
|
|
@@ -4222,8 +4240,8 @@ class ye {
|
|
|
4222
4240
|
s < a && s++;
|
|
4223
4241
|
break;
|
|
4224
4242
|
}
|
|
4225
|
-
const
|
|
4226
|
-
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(
|
|
4243
|
+
const h = [i, i], d = [s, s], f = this.getCell(s, i);
|
|
4244
|
+
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(h, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
|
|
4227
4245
|
}
|
|
4228
4246
|
stopAdjustPosition() {
|
|
4229
4247
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -4237,8 +4255,8 @@ class ye {
|
|
|
4237
4255
|
SELECTOR_AREA_MAX_Y: r,
|
|
4238
4256
|
SELECTOR_AREA_MAX_X_OFFSET: l,
|
|
4239
4257
|
SELECTOR_AREA_MAX_Y_OFFSET: a
|
|
4240
|
-
} = this.ctx.config,
|
|
4241
|
-
return !(e <
|
|
4258
|
+
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - l, f = o, x = r || this.ctx.maxRowIndex - a;
|
|
4259
|
+
return !(e < h || e > d || t < f || t > x);
|
|
4242
4260
|
}
|
|
4243
4261
|
/**
|
|
4244
4262
|
* 调整滚动条位置,让到达边界时自动滚动
|
|
@@ -4251,8 +4269,8 @@ class ye {
|
|
|
4251
4269
|
let l = 10 * (s === "left" ? -1 : 1);
|
|
4252
4270
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
4253
4271
|
l *= 1.5;
|
|
4254
|
-
const { scrollX: a } = this.ctx,
|
|
4255
|
-
(
|
|
4272
|
+
const { scrollX: a } = this.ctx, h = a + l;
|
|
4273
|
+
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
4256
4274
|
}, 100);
|
|
4257
4275
|
}
|
|
4258
4276
|
if (o && this.adjustPositionY !== o) {
|
|
@@ -4260,8 +4278,8 @@ class ye {
|
|
|
4260
4278
|
let l = 10 * (o === "top" ? -1 : 1);
|
|
4261
4279
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
4262
4280
|
l *= 1.5;
|
|
4263
|
-
const { scrollY: a } = this.ctx,
|
|
4264
|
-
(
|
|
4281
|
+
const { scrollY: a } = this.ctx, h = a + l;
|
|
4282
|
+
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
4265
4283
|
}, 100);
|
|
4266
4284
|
}
|
|
4267
4285
|
}
|
|
@@ -4278,21 +4296,21 @@ class ye {
|
|
|
4278
4296
|
header: r,
|
|
4279
4297
|
footer: l,
|
|
4280
4298
|
body: a,
|
|
4281
|
-
scrollX:
|
|
4299
|
+
scrollX: h,
|
|
4282
4300
|
scrollY: d,
|
|
4283
4301
|
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION: u, ENABLE_MERGE_CELL_LINK: p }
|
|
4284
4302
|
} = this.ctx;
|
|
4285
4303
|
if (!i)
|
|
4286
4304
|
return;
|
|
4287
4305
|
p && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
4288
|
-
const { drawX:
|
|
4289
|
-
let I = r.height -
|
|
4306
|
+
const { drawX: g, drawY: w, width: E, height: m, fixed: y } = i, R = o - g + 1, C = i.drawX + E - (e - s) + 1;
|
|
4307
|
+
let I = r.height - w, _ = m;
|
|
4290
4308
|
_ > a.visibleHeight && (_ = a.visibleHeight);
|
|
4291
4309
|
let S = 0;
|
|
4292
|
-
x && (u === "top" ? I = r.height + l.height -
|
|
4293
|
-
const v =
|
|
4294
|
-
let b =
|
|
4295
|
-
|
|
4310
|
+
x && (u === "top" ? I = r.height + l.height - w : S = l.visibleHeight);
|
|
4311
|
+
const v = w + _ - (t - S - f);
|
|
4312
|
+
let b = h, O = d;
|
|
4313
|
+
C > 0 && !y ? b = Math.floor(h + C) : R > 0 && !y && (b = Math.floor(h - R)), I > 0 ? O = Math.floor(d - I) : v > 0 && (O = Math.floor(d + v)), (Math.abs(h - b) > 2 || Math.abs(d - O) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(b, O), this.ctx.emit("adjustBoundaryPosition", i));
|
|
4296
4314
|
}
|
|
4297
4315
|
destroy() {
|
|
4298
4316
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -4308,7 +4326,7 @@ class Ce {
|
|
|
4308
4326
|
this.ctx.on("mousemove", (t) => {
|
|
4309
4327
|
if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
|
|
4310
4328
|
return;
|
|
4311
|
-
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: l, width: a, height:
|
|
4329
|
+
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: l, width: a, height: h } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || o === this.ctx.maxRowIndex ? 0 : 2, x = r + a - d + f, u = l + h - d + f;
|
|
4312
4330
|
e > x && i > u && e < x + d && i < u + d && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4313
4331
|
}), this.ctx.on("cellMouseenter", (t) => {
|
|
4314
4332
|
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: l } = t;
|
|
@@ -4351,16 +4369,16 @@ class Ce {
|
|
|
4351
4369
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(l)) {
|
|
4352
4370
|
const {
|
|
4353
4371
|
SELECTOR_AREA_MIN_X: a,
|
|
4354
|
-
SELECTOR_AREA_MAX_X:
|
|
4372
|
+
SELECTOR_AREA_MAX_X: h,
|
|
4355
4373
|
SELECTOR_AREA_MIN_Y: d,
|
|
4356
4374
|
SELECTOR_AREA_MAX_Y: f,
|
|
4357
4375
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4358
4376
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4359
|
-
} = this.ctx.config, p = a,
|
|
4360
|
-
let [
|
|
4361
|
-
if (
|
|
4377
|
+
} = this.ctx.config, p = a, g = h || this.ctx.maxColIndex - x, w = d, E = f || this.ctx.maxRowIndex - u;
|
|
4378
|
+
let [m, y] = r, [R, C] = l;
|
|
4379
|
+
if (m < p || R < w)
|
|
4362
4380
|
return;
|
|
4363
|
-
r = [Math.max(p,
|
|
4381
|
+
r = [Math.max(p, m), Math.min(g, y)], l = [Math.max(w, R), Math.min(E, C)];
|
|
4364
4382
|
const { BEFORE_SET_AUTOFILL_METHOD: I } = this.ctx.config;
|
|
4365
4383
|
if (typeof I == "function") {
|
|
4366
4384
|
const S = I({
|
|
@@ -4382,11 +4400,11 @@ class Ce {
|
|
|
4382
4400
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
4383
4401
|
for (let u = 0; u <= e.yArr[1] - e.yArr[0]; u++)
|
|
4384
4402
|
for (let p = 0; p <= e.xArr[1] - e.xArr[0]; p++) {
|
|
4385
|
-
const
|
|
4386
|
-
i.set(`${
|
|
4403
|
+
const g = u + e.yArr[0], w = p + e.xArr[0];
|
|
4404
|
+
i.set(`${g}-${w}`, !0);
|
|
4387
4405
|
}
|
|
4388
|
-
const { value: s } = e, o = s[0].length, r = s.length, l = this.ctx.autofill.xArr, a = this.ctx.autofill.yArr,
|
|
4389
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !
|
|
4406
|
+
const { value: s } = e, o = s[0].length, r = s.length, l = this.ctx.autofill.xArr, a = this.ctx.autofill.yArr, h = o === 1 && r === 1;
|
|
4407
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !h) {
|
|
4390
4408
|
const u = {
|
|
4391
4409
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
4392
4410
|
message: "Merged cells cannot span autofill data"
|
|
@@ -4397,12 +4415,12 @@ class Ce {
|
|
|
4397
4415
|
let d = [];
|
|
4398
4416
|
for (let u = 0; u <= a[1] - a[0]; u++)
|
|
4399
4417
|
for (let p = 0; p <= l[1] - l[0]; p++) {
|
|
4400
|
-
const
|
|
4401
|
-
if (
|
|
4402
|
-
const { rowKey: R, key:
|
|
4403
|
-
this.ctx.database.getReadonly(R,
|
|
4418
|
+
const g = p + l[0], w = u + a[0], E = s[u % r][p % o], m = this.ctx.database.getItemValueForRowIndexAndColIndex(w, g), y = `${w}-${g}`;
|
|
4419
|
+
if (m && !i.has(y)) {
|
|
4420
|
+
const { rowKey: R, key: C } = m;
|
|
4421
|
+
this.ctx.database.getReadonly(R, C) || (t.add(R), d.push({
|
|
4404
4422
|
rowKey: R,
|
|
4405
|
-
key:
|
|
4423
|
+
key: C,
|
|
4406
4424
|
value: E,
|
|
4407
4425
|
row: {}
|
|
4408
4426
|
}));
|
|
@@ -4413,12 +4431,12 @@ class Ce {
|
|
|
4413
4431
|
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
|
|
4414
4432
|
const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
|
|
4415
4433
|
if (typeof f == "function") {
|
|
4416
|
-
const u = f, p = d.map((
|
|
4417
|
-
rowKey:
|
|
4418
|
-
key:
|
|
4419
|
-
value:
|
|
4420
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4421
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
4434
|
+
const u = f, p = d.map((g) => ({
|
|
4435
|
+
rowKey: g.rowKey,
|
|
4436
|
+
key: g.key,
|
|
4437
|
+
value: g.value,
|
|
4438
|
+
oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
|
|
4439
|
+
row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
|
|
4422
4440
|
}));
|
|
4423
4441
|
if (d = await u(p, l, a), d && !d.length)
|
|
4424
4442
|
return;
|
|
@@ -4441,9 +4459,9 @@ class Ce {
|
|
|
4441
4459
|
destroy() {
|
|
4442
4460
|
}
|
|
4443
4461
|
}
|
|
4444
|
-
const Z = Math.min, z = Math.max,
|
|
4445
|
-
x:
|
|
4446
|
-
y:
|
|
4462
|
+
const Z = Math.min, z = Math.max, it = Math.round, V = (c) => ({
|
|
4463
|
+
x: c,
|
|
4464
|
+
y: c
|
|
4447
4465
|
}), be = {
|
|
4448
4466
|
left: "right",
|
|
4449
4467
|
right: "left",
|
|
@@ -4453,46 +4471,46 @@ const Z = Math.min, z = Math.max, et = Math.round, W = (h) => ({
|
|
|
4453
4471
|
start: "end",
|
|
4454
4472
|
end: "start"
|
|
4455
4473
|
};
|
|
4456
|
-
function ht(
|
|
4457
|
-
return z(
|
|
4474
|
+
function ht(c, t, e) {
|
|
4475
|
+
return z(c, Z(t, e));
|
|
4458
4476
|
}
|
|
4459
|
-
function J(
|
|
4460
|
-
return typeof
|
|
4477
|
+
function J(c, t) {
|
|
4478
|
+
return typeof c == "function" ? c(t) : c;
|
|
4461
4479
|
}
|
|
4462
|
-
function P(
|
|
4463
|
-
return
|
|
4480
|
+
function P(c) {
|
|
4481
|
+
return c.split("-")[0];
|
|
4464
4482
|
}
|
|
4465
|
-
function Q(
|
|
4466
|
-
return
|
|
4483
|
+
function Q(c) {
|
|
4484
|
+
return c.split("-")[1];
|
|
4467
4485
|
}
|
|
4468
|
-
function
|
|
4469
|
-
return
|
|
4486
|
+
function kt(c) {
|
|
4487
|
+
return c === "x" ? "y" : "x";
|
|
4470
4488
|
}
|
|
4471
|
-
function gt(
|
|
4472
|
-
return
|
|
4489
|
+
function gt(c) {
|
|
4490
|
+
return c === "y" ? "height" : "width";
|
|
4473
4491
|
}
|
|
4474
|
-
function G(
|
|
4475
|
-
return ["top", "bottom"].includes(P(
|
|
4492
|
+
function G(c) {
|
|
4493
|
+
return ["top", "bottom"].includes(P(c)) ? "y" : "x";
|
|
4476
4494
|
}
|
|
4477
|
-
function wt(
|
|
4478
|
-
return
|
|
4495
|
+
function wt(c) {
|
|
4496
|
+
return kt(G(c));
|
|
4479
4497
|
}
|
|
4480
|
-
function ve(
|
|
4498
|
+
function ve(c, t, e) {
|
|
4481
4499
|
e === void 0 && (e = !1);
|
|
4482
|
-
const i = Q(
|
|
4500
|
+
const i = Q(c), s = wt(c), o = gt(s);
|
|
4483
4501
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4484
|
-
return t.reference[o] > t.floating[o] && (r =
|
|
4502
|
+
return t.reference[o] > t.floating[o] && (r = st(r)), [r, st(r)];
|
|
4485
4503
|
}
|
|
4486
|
-
function Ie(
|
|
4487
|
-
const t =
|
|
4488
|
-
return [ct(
|
|
4504
|
+
function Ie(c) {
|
|
4505
|
+
const t = st(c);
|
|
4506
|
+
return [ct(c), t, ct(t)];
|
|
4489
4507
|
}
|
|
4490
|
-
function ct(
|
|
4491
|
-
return
|
|
4508
|
+
function ct(c) {
|
|
4509
|
+
return c.replace(/start|end/g, (t) => Re[t]);
|
|
4492
4510
|
}
|
|
4493
|
-
function _e(
|
|
4511
|
+
function _e(c, t, e) {
|
|
4494
4512
|
const i = ["left", "right"], s = ["right", "left"], o = ["top", "bottom"], r = ["bottom", "top"];
|
|
4495
|
-
switch (
|
|
4513
|
+
switch (c) {
|
|
4496
4514
|
case "top":
|
|
4497
4515
|
case "bottom":
|
|
4498
4516
|
return e ? t ? s : i : t ? i : s;
|
|
@@ -4503,38 +4521,38 @@ function _e(h, t, e) {
|
|
|
4503
4521
|
return [];
|
|
4504
4522
|
}
|
|
4505
4523
|
}
|
|
4506
|
-
function Oe(
|
|
4507
|
-
const s = Q(
|
|
4508
|
-
let o = _e(P(
|
|
4524
|
+
function Oe(c, t, e, i) {
|
|
4525
|
+
const s = Q(c);
|
|
4526
|
+
let o = _e(P(c), e === "start", i);
|
|
4509
4527
|
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(ct)))), o;
|
|
4510
4528
|
}
|
|
4511
|
-
function
|
|
4512
|
-
return
|
|
4529
|
+
function st(c) {
|
|
4530
|
+
return c.replace(/left|right|bottom|top/g, (t) => be[t]);
|
|
4513
4531
|
}
|
|
4514
|
-
function Se(
|
|
4532
|
+
function Se(c) {
|
|
4515
4533
|
return {
|
|
4516
4534
|
top: 0,
|
|
4517
4535
|
right: 0,
|
|
4518
4536
|
bottom: 0,
|
|
4519
4537
|
left: 0,
|
|
4520
|
-
...
|
|
4538
|
+
...c
|
|
4521
4539
|
};
|
|
4522
4540
|
}
|
|
4523
|
-
function Kt(
|
|
4524
|
-
return typeof
|
|
4525
|
-
top:
|
|
4526
|
-
right:
|
|
4527
|
-
bottom:
|
|
4528
|
-
left:
|
|
4541
|
+
function Kt(c) {
|
|
4542
|
+
return typeof c != "number" ? Se(c) : {
|
|
4543
|
+
top: c,
|
|
4544
|
+
right: c,
|
|
4545
|
+
bottom: c,
|
|
4546
|
+
left: c
|
|
4529
4547
|
};
|
|
4530
4548
|
}
|
|
4531
|
-
function
|
|
4549
|
+
function ot(c) {
|
|
4532
4550
|
const {
|
|
4533
4551
|
x: t,
|
|
4534
4552
|
y: e,
|
|
4535
4553
|
width: i,
|
|
4536
4554
|
height: s
|
|
4537
|
-
} =
|
|
4555
|
+
} = c;
|
|
4538
4556
|
return {
|
|
4539
4557
|
width: i,
|
|
4540
4558
|
height: s,
|
|
@@ -4546,12 +4564,12 @@ function st(h) {
|
|
|
4546
4564
|
y: e
|
|
4547
4565
|
};
|
|
4548
4566
|
}
|
|
4549
|
-
function vt(
|
|
4567
|
+
function vt(c, t, e) {
|
|
4550
4568
|
let {
|
|
4551
4569
|
reference: i,
|
|
4552
4570
|
floating: s
|
|
4553
|
-
} =
|
|
4554
|
-
const o = G(t), r = wt(t), l = gt(r), a = P(t),
|
|
4571
|
+
} = c;
|
|
4572
|
+
const o = G(t), r = wt(t), l = gt(r), a = P(t), h = o === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, x = i[l] / 2 - s[l] / 2;
|
|
4555
4573
|
let u;
|
|
4556
4574
|
switch (a) {
|
|
4557
4575
|
case "top":
|
|
@@ -4586,38 +4604,38 @@ function vt(h, t, e) {
|
|
|
4586
4604
|
}
|
|
4587
4605
|
switch (Q(t)) {
|
|
4588
4606
|
case "start":
|
|
4589
|
-
u[r] -= x * (e &&
|
|
4607
|
+
u[r] -= x * (e && h ? -1 : 1);
|
|
4590
4608
|
break;
|
|
4591
4609
|
case "end":
|
|
4592
|
-
u[r] += x * (e &&
|
|
4610
|
+
u[r] += x * (e && h ? -1 : 1);
|
|
4593
4611
|
break;
|
|
4594
4612
|
}
|
|
4595
4613
|
return u;
|
|
4596
4614
|
}
|
|
4597
|
-
const Le = async (
|
|
4615
|
+
const Le = async (c, t, e) => {
|
|
4598
4616
|
const {
|
|
4599
4617
|
placement: i = "bottom",
|
|
4600
4618
|
strategy: s = "absolute",
|
|
4601
4619
|
middleware: o = [],
|
|
4602
4620
|
platform: r
|
|
4603
4621
|
} = e, l = o.filter(Boolean), a = await (r.isRTL == null ? void 0 : r.isRTL(t));
|
|
4604
|
-
let
|
|
4605
|
-
reference:
|
|
4622
|
+
let h = await r.getElementRects({
|
|
4623
|
+
reference: c,
|
|
4606
4624
|
floating: t,
|
|
4607
4625
|
strategy: s
|
|
4608
4626
|
}), {
|
|
4609
4627
|
x: d,
|
|
4610
4628
|
y: f
|
|
4611
|
-
} = vt(
|
|
4612
|
-
for (let
|
|
4629
|
+
} = vt(h, i, a), x = i, u = {}, p = 0;
|
|
4630
|
+
for (let g = 0; g < l.length; g++) {
|
|
4613
4631
|
const {
|
|
4614
|
-
name:
|
|
4632
|
+
name: w,
|
|
4615
4633
|
fn: E
|
|
4616
|
-
} = l[
|
|
4617
|
-
x:
|
|
4618
|
-
y
|
|
4634
|
+
} = l[g], {
|
|
4635
|
+
x: m,
|
|
4636
|
+
y,
|
|
4619
4637
|
data: R,
|
|
4620
|
-
reset:
|
|
4638
|
+
reset: C
|
|
4621
4639
|
} = await E({
|
|
4622
4640
|
x: d,
|
|
4623
4641
|
y: f,
|
|
@@ -4625,27 +4643,27 @@ const Le = async (h, t, e) => {
|
|
|
4625
4643
|
placement: x,
|
|
4626
4644
|
strategy: s,
|
|
4627
4645
|
middlewareData: u,
|
|
4628
|
-
rects:
|
|
4646
|
+
rects: h,
|
|
4629
4647
|
platform: r,
|
|
4630
4648
|
elements: {
|
|
4631
|
-
reference:
|
|
4649
|
+
reference: c,
|
|
4632
4650
|
floating: t
|
|
4633
4651
|
}
|
|
4634
4652
|
});
|
|
4635
|
-
d =
|
|
4653
|
+
d = m ?? d, f = y ?? f, u = {
|
|
4636
4654
|
...u,
|
|
4637
|
-
[
|
|
4638
|
-
...u[
|
|
4655
|
+
[w]: {
|
|
4656
|
+
...u[w],
|
|
4639
4657
|
...R
|
|
4640
4658
|
}
|
|
4641
|
-
},
|
|
4642
|
-
reference:
|
|
4659
|
+
}, C && p <= 50 && (p++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
4660
|
+
reference: c,
|
|
4643
4661
|
floating: t,
|
|
4644
4662
|
strategy: s
|
|
4645
|
-
}) :
|
|
4663
|
+
}) : C.rects), {
|
|
4646
4664
|
x: d,
|
|
4647
4665
|
y: f
|
|
4648
|
-
} = vt(
|
|
4666
|
+
} = vt(h, x, a)), g = -1);
|
|
4649
4667
|
}
|
|
4650
4668
|
return {
|
|
4651
4669
|
x: d,
|
|
@@ -4655,7 +4673,7 @@ const Le = async (h, t, e) => {
|
|
|
4655
4673
|
middlewareData: u
|
|
4656
4674
|
};
|
|
4657
4675
|
};
|
|
4658
|
-
async function Nt(
|
|
4676
|
+
async function Nt(c, t) {
|
|
4659
4677
|
var e;
|
|
4660
4678
|
t === void 0 && (t = {});
|
|
4661
4679
|
const {
|
|
@@ -4665,44 +4683,44 @@ async function Nt(h, t) {
|
|
|
4665
4683
|
rects: r,
|
|
4666
4684
|
elements: l,
|
|
4667
4685
|
strategy: a
|
|
4668
|
-
} =
|
|
4669
|
-
boundary:
|
|
4686
|
+
} = c, {
|
|
4687
|
+
boundary: h = "clippingAncestors",
|
|
4670
4688
|
rootBoundary: d = "viewport",
|
|
4671
4689
|
elementContext: f = "floating",
|
|
4672
4690
|
altBoundary: x = !1,
|
|
4673
4691
|
padding: u = 0
|
|
4674
|
-
} = J(t,
|
|
4675
|
-
element: (e = await (o.isElement == null ? void 0 : o.isElement(
|
|
4676
|
-
boundary:
|
|
4692
|
+
} = J(t, c), p = Kt(u), w = l[x ? f === "floating" ? "reference" : "floating" : f], E = ot(await o.getClippingRect({
|
|
4693
|
+
element: (e = await (o.isElement == null ? void 0 : o.isElement(w))) == null || e ? w : w.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(l.floating)),
|
|
4694
|
+
boundary: h,
|
|
4677
4695
|
rootBoundary: d,
|
|
4678
4696
|
strategy: a
|
|
4679
|
-
})),
|
|
4697
|
+
})), m = f === "floating" ? {
|
|
4680
4698
|
x: i,
|
|
4681
4699
|
y: s,
|
|
4682
4700
|
width: r.floating.width,
|
|
4683
4701
|
height: r.floating.height
|
|
4684
|
-
} : r.reference,
|
|
4702
|
+
} : r.reference, y = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l.floating)), R = await (o.isElement == null ? void 0 : o.isElement(y)) ? await (o.getScale == null ? void 0 : o.getScale(y)) || {
|
|
4685
4703
|
x: 1,
|
|
4686
4704
|
y: 1
|
|
4687
4705
|
} : {
|
|
4688
4706
|
x: 1,
|
|
4689
4707
|
y: 1
|
|
4690
|
-
},
|
|
4708
|
+
}, C = ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4691
4709
|
elements: l,
|
|
4692
|
-
rect:
|
|
4693
|
-
offsetParent:
|
|
4710
|
+
rect: m,
|
|
4711
|
+
offsetParent: y,
|
|
4694
4712
|
strategy: a
|
|
4695
|
-
}) :
|
|
4713
|
+
}) : m);
|
|
4696
4714
|
return {
|
|
4697
|
-
top: (E.top -
|
|
4698
|
-
bottom: (
|
|
4699
|
-
left: (E.left -
|
|
4700
|
-
right: (
|
|
4715
|
+
top: (E.top - C.top + p.top) / R.y,
|
|
4716
|
+
bottom: (C.bottom - E.bottom + p.bottom) / R.y,
|
|
4717
|
+
left: (E.left - C.left + p.left) / R.x,
|
|
4718
|
+
right: (C.right - E.right + p.right) / R.x
|
|
4701
4719
|
};
|
|
4702
4720
|
}
|
|
4703
|
-
const Te = (
|
|
4721
|
+
const Te = (c) => ({
|
|
4704
4722
|
name: "arrow",
|
|
4705
|
-
options:
|
|
4723
|
+
options: c,
|
|
4706
4724
|
async fn(t) {
|
|
4707
4725
|
const {
|
|
4708
4726
|
x: e,
|
|
@@ -4713,34 +4731,34 @@ const Te = (h) => ({
|
|
|
4713
4731
|
elements: l,
|
|
4714
4732
|
middlewareData: a
|
|
4715
4733
|
} = t, {
|
|
4716
|
-
element:
|
|
4734
|
+
element: h,
|
|
4717
4735
|
padding: d = 0
|
|
4718
|
-
} = J(
|
|
4719
|
-
if (
|
|
4736
|
+
} = J(c, t) || {};
|
|
4737
|
+
if (h == null)
|
|
4720
4738
|
return {};
|
|
4721
4739
|
const f = Kt(d), x = {
|
|
4722
4740
|
x: e,
|
|
4723
4741
|
y: i
|
|
4724
|
-
}, u = wt(s), p = gt(u),
|
|
4725
|
-
let _ = I ? I[
|
|
4726
|
-
(!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = l.floating[
|
|
4727
|
-
const S = R / 2 -
|
|
4742
|
+
}, u = wt(s), p = gt(u), g = await r.getDimensions(h), w = u === "y", E = w ? "top" : "left", m = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", R = o.reference[p] + o.reference[u] - x[u] - o.floating[p], C = x[u] - o.reference[u], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
|
|
4743
|
+
let _ = I ? I[y] : 0;
|
|
4744
|
+
(!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = l.floating[y] || o.floating[p]);
|
|
4745
|
+
const S = R / 2 - C / 2, v = _ / 2 - g[p] / 2 - 1, b = Z(f[E], v), O = Z(f[m], v), L = b, M = _ - g[p] - O, T = _ / 2 - g[p] / 2 + S, X = ht(L, T, M), K = !a.arrow && Q(s) != null && T !== X && o.reference[p] / 2 - (T < L ? b : O) - g[p] / 2 < 0, B = K ? T < L ? T - L : T - M : 0;
|
|
4728
4746
|
return {
|
|
4729
|
-
[u]: x[u] +
|
|
4747
|
+
[u]: x[u] + B,
|
|
4730
4748
|
data: {
|
|
4731
4749
|
[u]: X,
|
|
4732
|
-
centerOffset: T - X -
|
|
4750
|
+
centerOffset: T - X - B,
|
|
4733
4751
|
...K && {
|
|
4734
|
-
alignmentOffset:
|
|
4752
|
+
alignmentOffset: B
|
|
4735
4753
|
}
|
|
4736
4754
|
},
|
|
4737
4755
|
reset: K
|
|
4738
4756
|
};
|
|
4739
4757
|
}
|
|
4740
|
-
}), Ae = function(
|
|
4741
|
-
return
|
|
4758
|
+
}), Ae = function(c) {
|
|
4759
|
+
return c === void 0 && (c = {}), {
|
|
4742
4760
|
name: "flip",
|
|
4743
|
-
options:
|
|
4761
|
+
options: c,
|
|
4744
4762
|
async fn(t) {
|
|
4745
4763
|
var e, i;
|
|
4746
4764
|
const {
|
|
@@ -4749,21 +4767,21 @@ const Te = (h) => ({
|
|
|
4749
4767
|
rects: r,
|
|
4750
4768
|
initialPlacement: l,
|
|
4751
4769
|
platform: a,
|
|
4752
|
-
elements:
|
|
4770
|
+
elements: h
|
|
4753
4771
|
} = t, {
|
|
4754
4772
|
mainAxis: d = !0,
|
|
4755
4773
|
crossAxis: f = !0,
|
|
4756
4774
|
fallbackPlacements: x,
|
|
4757
4775
|
fallbackStrategy: u = "bestFit",
|
|
4758
4776
|
fallbackAxisSideDirection: p = "none",
|
|
4759
|
-
flipAlignment:
|
|
4760
|
-
...
|
|
4761
|
-
} = J(
|
|
4777
|
+
flipAlignment: g = !0,
|
|
4778
|
+
...w
|
|
4779
|
+
} = J(c, t);
|
|
4762
4780
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
4763
4781
|
return {};
|
|
4764
|
-
const E = P(s),
|
|
4765
|
-
!x && I &&
|
|
4766
|
-
const _ = [l, ...
|
|
4782
|
+
const E = P(s), m = G(l), y = P(l) === l, R = await (a.isRTL == null ? void 0 : a.isRTL(h.floating)), C = x || (y || !g ? [st(l)] : Ie(l)), I = p !== "none";
|
|
4783
|
+
!x && I && C.push(...Oe(l, g, p, R));
|
|
4784
|
+
const _ = [l, ...C], S = await Nt(t, w), v = [];
|
|
4767
4785
|
let b = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
4768
4786
|
if (d && v.push(S[E]), f) {
|
|
4769
4787
|
const T = ve(s, r, R);
|
|
@@ -4785,21 +4803,21 @@ const Te = (h) => ({
|
|
|
4785
4803
|
placement: X
|
|
4786
4804
|
}
|
|
4787
4805
|
};
|
|
4788
|
-
let K = (L = b.filter((
|
|
4806
|
+
let K = (L = b.filter((B) => B.overflows[0] <= 0).sort((B, Y) => B.overflows[1] - Y.overflows[1])[0]) == null ? void 0 : L.placement;
|
|
4789
4807
|
if (!K)
|
|
4790
4808
|
switch (u) {
|
|
4791
4809
|
case "bestFit": {
|
|
4792
4810
|
var M;
|
|
4793
|
-
const
|
|
4811
|
+
const B = (M = b.filter((Y) => {
|
|
4794
4812
|
if (I) {
|
|
4795
4813
|
const F = G(Y.placement);
|
|
4796
|
-
return F ===
|
|
4814
|
+
return F === m || // Create a bias to the `y` side axis due to horizontal
|
|
4797
4815
|
// reading directions favoring greater width.
|
|
4798
4816
|
F === "y";
|
|
4799
4817
|
}
|
|
4800
4818
|
return !0;
|
|
4801
4819
|
}).map((Y) => [Y.placement, Y.overflows.filter((F) => F > 0).reduce((F, qt) => F + qt, 0)]).sort((Y, F) => Y[1] - F[1])[0]) == null ? void 0 : M[0];
|
|
4802
|
-
|
|
4820
|
+
B && (K = B);
|
|
4803
4821
|
break;
|
|
4804
4822
|
}
|
|
4805
4823
|
case "initialPlacement":
|
|
@@ -4817,12 +4835,12 @@ const Te = (h) => ({
|
|
|
4817
4835
|
}
|
|
4818
4836
|
};
|
|
4819
4837
|
};
|
|
4820
|
-
async function Me(
|
|
4838
|
+
async function Me(c, t) {
|
|
4821
4839
|
const {
|
|
4822
4840
|
placement: e,
|
|
4823
4841
|
platform: i,
|
|
4824
4842
|
elements: s
|
|
4825
|
-
} =
|
|
4843
|
+
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = P(e), l = Q(e), a = G(e) === "y", h = ["left", "top"].includes(r) ? -1 : 1, d = o && a ? -1 : 1, f = J(t, c);
|
|
4826
4844
|
let {
|
|
4827
4845
|
mainAxis: x,
|
|
4828
4846
|
crossAxis: u,
|
|
@@ -4838,16 +4856,16 @@ async function Me(h, t) {
|
|
|
4838
4856
|
};
|
|
4839
4857
|
return l && typeof p == "number" && (u = l === "end" ? p * -1 : p), a ? {
|
|
4840
4858
|
x: u * d,
|
|
4841
|
-
y: x *
|
|
4859
|
+
y: x * h
|
|
4842
4860
|
} : {
|
|
4843
|
-
x: x *
|
|
4861
|
+
x: x * h,
|
|
4844
4862
|
y: u * d
|
|
4845
4863
|
};
|
|
4846
4864
|
}
|
|
4847
|
-
const He = function(
|
|
4848
|
-
return
|
|
4865
|
+
const He = function(c) {
|
|
4866
|
+
return c === void 0 && (c = 0), {
|
|
4849
4867
|
name: "offset",
|
|
4850
|
-
options:
|
|
4868
|
+
options: c,
|
|
4851
4869
|
async fn(t) {
|
|
4852
4870
|
var e, i;
|
|
4853
4871
|
const {
|
|
@@ -4855,7 +4873,7 @@ const He = function(h) {
|
|
|
4855
4873
|
y: o,
|
|
4856
4874
|
placement: r,
|
|
4857
4875
|
middlewareData: l
|
|
4858
|
-
} = t, a = await Me(t,
|
|
4876
|
+
} = t, a = await Me(t, c);
|
|
4859
4877
|
return r === ((e = l.offset) == null ? void 0 : e.placement) && (i = l.arrow) != null && i.alignmentOffset ? {} : {
|
|
4860
4878
|
x: s + a.x,
|
|
4861
4879
|
y: o + a.y,
|
|
@@ -4866,10 +4884,10 @@ const He = function(h) {
|
|
|
4866
4884
|
};
|
|
4867
4885
|
}
|
|
4868
4886
|
};
|
|
4869
|
-
}, De = function(
|
|
4870
|
-
return
|
|
4887
|
+
}, De = function(c) {
|
|
4888
|
+
return c === void 0 && (c = {}), {
|
|
4871
4889
|
name: "shift",
|
|
4872
|
-
options:
|
|
4890
|
+
options: c,
|
|
4873
4891
|
async fn(t) {
|
|
4874
4892
|
const {
|
|
4875
4893
|
x: e,
|
|
@@ -4879,41 +4897,41 @@ const He = function(h) {
|
|
|
4879
4897
|
mainAxis: o = !0,
|
|
4880
4898
|
crossAxis: r = !1,
|
|
4881
4899
|
limiter: l = {
|
|
4882
|
-
fn: (
|
|
4900
|
+
fn: (w) => {
|
|
4883
4901
|
let {
|
|
4884
4902
|
x: E,
|
|
4885
|
-
y:
|
|
4886
|
-
} =
|
|
4903
|
+
y: m
|
|
4904
|
+
} = w;
|
|
4887
4905
|
return {
|
|
4888
4906
|
x: E,
|
|
4889
|
-
y:
|
|
4907
|
+
y: m
|
|
4890
4908
|
};
|
|
4891
4909
|
}
|
|
4892
4910
|
},
|
|
4893
4911
|
...a
|
|
4894
|
-
} = J(
|
|
4912
|
+
} = J(c, t), h = {
|
|
4895
4913
|
x: e,
|
|
4896
4914
|
y: i
|
|
4897
|
-
}, d = await Nt(t, a), f = G(P(s)), x =
|
|
4898
|
-
let u =
|
|
4915
|
+
}, d = await Nt(t, a), f = G(P(s)), x = kt(f);
|
|
4916
|
+
let u = h[x], p = h[f];
|
|
4899
4917
|
if (o) {
|
|
4900
|
-
const
|
|
4901
|
-
u = ht(
|
|
4918
|
+
const w = x === "y" ? "top" : "left", E = x === "y" ? "bottom" : "right", m = u + d[w], y = u - d[E];
|
|
4919
|
+
u = ht(m, u, y);
|
|
4902
4920
|
}
|
|
4903
4921
|
if (r) {
|
|
4904
|
-
const
|
|
4905
|
-
p = ht(
|
|
4922
|
+
const w = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", m = p + d[w], y = p - d[E];
|
|
4923
|
+
p = ht(m, p, y);
|
|
4906
4924
|
}
|
|
4907
|
-
const
|
|
4925
|
+
const g = l.fn({
|
|
4908
4926
|
...t,
|
|
4909
4927
|
[x]: u,
|
|
4910
4928
|
[f]: p
|
|
4911
4929
|
});
|
|
4912
4930
|
return {
|
|
4913
|
-
...
|
|
4931
|
+
...g,
|
|
4914
4932
|
data: {
|
|
4915
|
-
x:
|
|
4916
|
-
y:
|
|
4933
|
+
x: g.x - e,
|
|
4934
|
+
y: g.y - i,
|
|
4917
4935
|
enabled: {
|
|
4918
4936
|
[x]: o,
|
|
4919
4937
|
[f]: r
|
|
@@ -4923,212 +4941,212 @@ const He = function(h) {
|
|
|
4923
4941
|
}
|
|
4924
4942
|
};
|
|
4925
4943
|
};
|
|
4926
|
-
function
|
|
4944
|
+
function rt() {
|
|
4927
4945
|
return typeof window < "u";
|
|
4928
4946
|
}
|
|
4929
|
-
function j(
|
|
4930
|
-
return Yt(
|
|
4947
|
+
function j(c) {
|
|
4948
|
+
return Yt(c) ? (c.nodeName || "").toLowerCase() : "#document";
|
|
4931
4949
|
}
|
|
4932
|
-
function A(
|
|
4950
|
+
function A(c) {
|
|
4933
4951
|
var t;
|
|
4934
|
-
return (
|
|
4952
|
+
return (c == null || (t = c.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
4935
4953
|
}
|
|
4936
|
-
function N(
|
|
4954
|
+
function N(c) {
|
|
4937
4955
|
var t;
|
|
4938
|
-
return (t = (Yt(
|
|
4956
|
+
return (t = (Yt(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4939
4957
|
}
|
|
4940
|
-
function Yt(
|
|
4941
|
-
return
|
|
4958
|
+
function Yt(c) {
|
|
4959
|
+
return rt() ? c instanceof Node || c instanceof A(c).Node : !1;
|
|
4942
4960
|
}
|
|
4943
|
-
function H(
|
|
4944
|
-
return
|
|
4961
|
+
function H(c) {
|
|
4962
|
+
return rt() ? c instanceof Element || c instanceof A(c).Element : !1;
|
|
4945
4963
|
}
|
|
4946
|
-
function
|
|
4947
|
-
return
|
|
4964
|
+
function k(c) {
|
|
4965
|
+
return rt() ? c instanceof HTMLElement || c instanceof A(c).HTMLElement : !1;
|
|
4948
4966
|
}
|
|
4949
|
-
function It(
|
|
4950
|
-
return !
|
|
4967
|
+
function It(c) {
|
|
4968
|
+
return !rt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof A(c).ShadowRoot;
|
|
4951
4969
|
}
|
|
4952
|
-
function tt(
|
|
4970
|
+
function tt(c) {
|
|
4953
4971
|
const {
|
|
4954
4972
|
overflow: t,
|
|
4955
4973
|
overflowX: e,
|
|
4956
4974
|
overflowY: i,
|
|
4957
4975
|
display: s
|
|
4958
|
-
} = D(
|
|
4976
|
+
} = D(c);
|
|
4959
4977
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
4960
4978
|
}
|
|
4961
|
-
function Xe(
|
|
4962
|
-
return ["table", "td", "th"].includes(j(
|
|
4979
|
+
function Xe(c) {
|
|
4980
|
+
return ["table", "td", "th"].includes(j(c));
|
|
4963
4981
|
}
|
|
4964
|
-
function
|
|
4982
|
+
function nt(c) {
|
|
4965
4983
|
return [":popover-open", ":modal"].some((t) => {
|
|
4966
4984
|
try {
|
|
4967
|
-
return
|
|
4985
|
+
return c.matches(t);
|
|
4968
4986
|
} catch {
|
|
4969
4987
|
return !1;
|
|
4970
4988
|
}
|
|
4971
4989
|
});
|
|
4972
4990
|
}
|
|
4973
|
-
function pt(
|
|
4974
|
-
const t = Et(), e = H(
|
|
4991
|
+
function pt(c) {
|
|
4992
|
+
const t = Et(), e = H(c) ? D(c) : c;
|
|
4975
4993
|
return e.transform !== "none" || e.perspective !== "none" || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((i) => (e.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (e.contain || "").includes(i));
|
|
4976
4994
|
}
|
|
4977
|
-
function
|
|
4978
|
-
let t =
|
|
4979
|
-
for (;
|
|
4995
|
+
function Be(c) {
|
|
4996
|
+
let t = W(c);
|
|
4997
|
+
for (; k(t) && !U(t); ) {
|
|
4980
4998
|
if (pt(t))
|
|
4981
4999
|
return t;
|
|
4982
|
-
if (
|
|
5000
|
+
if (nt(t))
|
|
4983
5001
|
return null;
|
|
4984
|
-
t =
|
|
5002
|
+
t = W(t);
|
|
4985
5003
|
}
|
|
4986
5004
|
return null;
|
|
4987
5005
|
}
|
|
4988
5006
|
function Et() {
|
|
4989
5007
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
4990
5008
|
}
|
|
4991
|
-
function U(
|
|
4992
|
-
return ["html", "body", "#document"].includes(j(
|
|
5009
|
+
function U(c) {
|
|
5010
|
+
return ["html", "body", "#document"].includes(j(c));
|
|
4993
5011
|
}
|
|
4994
|
-
function D(
|
|
4995
|
-
return A(
|
|
5012
|
+
function D(c) {
|
|
5013
|
+
return A(c).getComputedStyle(c);
|
|
4996
5014
|
}
|
|
4997
|
-
function
|
|
4998
|
-
return H(
|
|
4999
|
-
scrollLeft:
|
|
5000
|
-
scrollTop:
|
|
5015
|
+
function lt(c) {
|
|
5016
|
+
return H(c) ? {
|
|
5017
|
+
scrollLeft: c.scrollLeft,
|
|
5018
|
+
scrollTop: c.scrollTop
|
|
5001
5019
|
} : {
|
|
5002
|
-
scrollLeft:
|
|
5003
|
-
scrollTop:
|
|
5020
|
+
scrollLeft: c.scrollX,
|
|
5021
|
+
scrollTop: c.scrollY
|
|
5004
5022
|
};
|
|
5005
5023
|
}
|
|
5006
|
-
function
|
|
5007
|
-
if (j(
|
|
5008
|
-
return
|
|
5024
|
+
function W(c) {
|
|
5025
|
+
if (j(c) === "html")
|
|
5026
|
+
return c;
|
|
5009
5027
|
const t = (
|
|
5010
5028
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
It(
|
|
5014
|
-
N(
|
|
5029
|
+
c.assignedSlot || // DOM Element detected.
|
|
5030
|
+
c.parentNode || // ShadowRoot detected.
|
|
5031
|
+
It(c) && c.host || // Fallback.
|
|
5032
|
+
N(c)
|
|
5015
5033
|
);
|
|
5016
5034
|
return It(t) ? t.host : t;
|
|
5017
5035
|
}
|
|
5018
|
-
function Ft(
|
|
5019
|
-
const t =
|
|
5020
|
-
return U(t) ?
|
|
5036
|
+
function Ft(c) {
|
|
5037
|
+
const t = W(c);
|
|
5038
|
+
return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : k(t) && tt(t) ? t : Ft(t);
|
|
5021
5039
|
}
|
|
5022
|
-
function dt(
|
|
5040
|
+
function dt(c, t, e) {
|
|
5023
5041
|
var i;
|
|
5024
5042
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
5025
|
-
const s = Ft(
|
|
5043
|
+
const s = Ft(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = A(s);
|
|
5026
5044
|
if (o) {
|
|
5027
5045
|
const l = ft(r);
|
|
5028
5046
|
return t.concat(r, r.visualViewport || [], tt(s) ? s : [], l && e ? dt(l) : []);
|
|
5029
5047
|
}
|
|
5030
5048
|
return t.concat(s, dt(s, [], e));
|
|
5031
5049
|
}
|
|
5032
|
-
function ft(
|
|
5033
|
-
return
|
|
5050
|
+
function ft(c) {
|
|
5051
|
+
return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
|
|
5034
5052
|
}
|
|
5035
|
-
function
|
|
5036
|
-
const t = D(
|
|
5053
|
+
function Vt(c) {
|
|
5054
|
+
const t = D(c);
|
|
5037
5055
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
5038
|
-
const s =
|
|
5056
|
+
const s = k(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, l = it(e) !== o || it(i) !== r;
|
|
5039
5057
|
return l && (e = o, i = r), {
|
|
5040
5058
|
width: e,
|
|
5041
5059
|
height: i,
|
|
5042
5060
|
$: l
|
|
5043
5061
|
};
|
|
5044
5062
|
}
|
|
5045
|
-
function
|
|
5046
|
-
return H(
|
|
5063
|
+
function Wt(c) {
|
|
5064
|
+
return H(c) ? c : c.contextElement;
|
|
5047
5065
|
}
|
|
5048
|
-
function $(
|
|
5049
|
-
const t =
|
|
5050
|
-
if (!
|
|
5051
|
-
return
|
|
5066
|
+
function $(c) {
|
|
5067
|
+
const t = Wt(c);
|
|
5068
|
+
if (!k(t))
|
|
5069
|
+
return V(1);
|
|
5052
5070
|
const e = t.getBoundingClientRect(), {
|
|
5053
5071
|
width: i,
|
|
5054
5072
|
height: s,
|
|
5055
5073
|
$: o
|
|
5056
|
-
} =
|
|
5057
|
-
let r = (o ?
|
|
5074
|
+
} = Vt(t);
|
|
5075
|
+
let r = (o ? it(e.width) : e.width) / i, l = (o ? it(e.height) : e.height) / s;
|
|
5058
5076
|
return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
|
|
5059
5077
|
x: r,
|
|
5060
5078
|
y: l
|
|
5061
5079
|
};
|
|
5062
5080
|
}
|
|
5063
|
-
const
|
|
5064
|
-
function Pt(
|
|
5065
|
-
const t = A(
|
|
5066
|
-
return !Et() || !t.visualViewport ?
|
|
5081
|
+
const ke = /* @__PURE__ */ V(0);
|
|
5082
|
+
function Pt(c) {
|
|
5083
|
+
const t = A(c);
|
|
5084
|
+
return !Et() || !t.visualViewport ? ke : {
|
|
5067
5085
|
x: t.visualViewport.offsetLeft,
|
|
5068
5086
|
y: t.visualViewport.offsetTop
|
|
5069
5087
|
};
|
|
5070
5088
|
}
|
|
5071
|
-
function Ke(
|
|
5072
|
-
return t === void 0 && (t = !1), !e || t && e !== A(
|
|
5089
|
+
function Ke(c, t, e) {
|
|
5090
|
+
return t === void 0 && (t = !1), !e || t && e !== A(c) ? !1 : t;
|
|
5073
5091
|
}
|
|
5074
|
-
function q(
|
|
5092
|
+
function q(c, t, e, i) {
|
|
5075
5093
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
5076
|
-
const s =
|
|
5077
|
-
let r =
|
|
5078
|
-
t && (i ? H(i) && (r = $(i)) : r = $(
|
|
5079
|
-
const l = Ke(o, e, i) ? Pt(o) :
|
|
5080
|
-
let a = (s.left + l.x) / r.x,
|
|
5094
|
+
const s = c.getBoundingClientRect(), o = Wt(c);
|
|
5095
|
+
let r = V(1);
|
|
5096
|
+
t && (i ? H(i) && (r = $(i)) : r = $(c));
|
|
5097
|
+
const l = Ke(o, e, i) ? Pt(o) : V(0);
|
|
5098
|
+
let a = (s.left + l.x) / r.x, h = (s.top + l.y) / r.y, d = s.width / r.x, f = s.height / r.y;
|
|
5081
5099
|
if (o) {
|
|
5082
5100
|
const x = A(o), u = i && H(i) ? A(i) : i;
|
|
5083
|
-
let p = x,
|
|
5084
|
-
for (;
|
|
5085
|
-
const
|
|
5086
|
-
a *=
|
|
5101
|
+
let p = x, g = ft(p);
|
|
5102
|
+
for (; g && i && u !== p; ) {
|
|
5103
|
+
const w = $(g), E = g.getBoundingClientRect(), m = D(g), y = E.left + (g.clientLeft + parseFloat(m.paddingLeft)) * w.x, R = E.top + (g.clientTop + parseFloat(m.paddingTop)) * w.y;
|
|
5104
|
+
a *= w.x, h *= w.y, d *= w.x, f *= w.y, a += y, h += R, p = A(g), g = ft(p);
|
|
5087
5105
|
}
|
|
5088
5106
|
}
|
|
5089
|
-
return
|
|
5107
|
+
return ot({
|
|
5090
5108
|
width: d,
|
|
5091
5109
|
height: f,
|
|
5092
5110
|
x: a,
|
|
5093
|
-
y:
|
|
5111
|
+
y: h
|
|
5094
5112
|
});
|
|
5095
5113
|
}
|
|
5096
|
-
function Ne(
|
|
5114
|
+
function Ne(c) {
|
|
5097
5115
|
let {
|
|
5098
5116
|
elements: t,
|
|
5099
5117
|
rect: e,
|
|
5100
5118
|
offsetParent: i,
|
|
5101
5119
|
strategy: s
|
|
5102
|
-
} =
|
|
5103
|
-
const o = s === "fixed", r = N(i), l = t ?
|
|
5120
|
+
} = c;
|
|
5121
|
+
const o = s === "fixed", r = N(i), l = t ? nt(t.floating) : !1;
|
|
5104
5122
|
if (i === r || l && o)
|
|
5105
5123
|
return e;
|
|
5106
5124
|
let a = {
|
|
5107
5125
|
scrollLeft: 0,
|
|
5108
5126
|
scrollTop: 0
|
|
5109
|
-
},
|
|
5110
|
-
const d =
|
|
5111
|
-
if ((f || !f && !o) && ((j(i) !== "body" || tt(r)) && (a =
|
|
5127
|
+
}, h = V(1);
|
|
5128
|
+
const d = V(0), f = k(i);
|
|
5129
|
+
if ((f || !f && !o) && ((j(i) !== "body" || tt(r)) && (a = lt(i)), k(i))) {
|
|
5112
5130
|
const x = q(i);
|
|
5113
|
-
|
|
5131
|
+
h = $(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5114
5132
|
}
|
|
5115
5133
|
return {
|
|
5116
|
-
width: e.width *
|
|
5117
|
-
height: e.height *
|
|
5118
|
-
x: e.x *
|
|
5119
|
-
y: e.y *
|
|
5134
|
+
width: e.width * h.x,
|
|
5135
|
+
height: e.height * h.y,
|
|
5136
|
+
x: e.x * h.x - a.scrollLeft * h.x + d.x,
|
|
5137
|
+
y: e.y * h.y - a.scrollTop * h.y + d.y
|
|
5120
5138
|
};
|
|
5121
5139
|
}
|
|
5122
|
-
function Ye(
|
|
5123
|
-
return Array.from(
|
|
5140
|
+
function Ye(c) {
|
|
5141
|
+
return Array.from(c.getClientRects());
|
|
5124
5142
|
}
|
|
5125
|
-
function xt(
|
|
5126
|
-
const e =
|
|
5127
|
-
return t ? t.left + e : q(N(
|
|
5143
|
+
function xt(c, t) {
|
|
5144
|
+
const e = lt(c).scrollLeft;
|
|
5145
|
+
return t ? t.left + e : q(N(c)).left + e;
|
|
5128
5146
|
}
|
|
5129
|
-
function Fe(
|
|
5130
|
-
const t = N(
|
|
5131
|
-
let r = -e.scrollLeft + xt(
|
|
5147
|
+
function Fe(c) {
|
|
5148
|
+
const t = N(c), e = lt(c), i = c.ownerDocument.body, s = z(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = z(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
5149
|
+
let r = -e.scrollLeft + xt(c);
|
|
5132
5150
|
const l = -e.scrollTop;
|
|
5133
5151
|
return D(i).direction === "rtl" && (r += z(t.clientWidth, i.clientWidth) - s), {
|
|
5134
5152
|
width: s,
|
|
@@ -5137,13 +5155,13 @@ function Fe(h) {
|
|
|
5137
5155
|
y: l
|
|
5138
5156
|
};
|
|
5139
5157
|
}
|
|
5140
|
-
function
|
|
5141
|
-
const e = A(
|
|
5158
|
+
function Ve(c, t) {
|
|
5159
|
+
const e = A(c), i = N(c), s = e.visualViewport;
|
|
5142
5160
|
let o = i.clientWidth, r = i.clientHeight, l = 0, a = 0;
|
|
5143
5161
|
if (s) {
|
|
5144
5162
|
o = s.width, r = s.height;
|
|
5145
|
-
const
|
|
5146
|
-
(!
|
|
5163
|
+
const h = Et();
|
|
5164
|
+
(!h || h && t === "fixed") && (l = s.offsetLeft, a = s.offsetTop);
|
|
5147
5165
|
}
|
|
5148
5166
|
return {
|
|
5149
5167
|
width: o,
|
|
@@ -5152,60 +5170,60 @@ function We(h, t) {
|
|
|
5152
5170
|
y: a
|
|
5153
5171
|
};
|
|
5154
5172
|
}
|
|
5155
|
-
function
|
|
5156
|
-
const e = q(
|
|
5173
|
+
function We(c, t) {
|
|
5174
|
+
const e = q(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = k(c) ? $(c) : V(1), r = c.clientWidth * o.x, l = c.clientHeight * o.y, a = s * o.x, h = i * o.y;
|
|
5157
5175
|
return {
|
|
5158
5176
|
width: r,
|
|
5159
5177
|
height: l,
|
|
5160
5178
|
x: a,
|
|
5161
|
-
y:
|
|
5179
|
+
y: h
|
|
5162
5180
|
};
|
|
5163
5181
|
}
|
|
5164
|
-
function _t(
|
|
5182
|
+
function _t(c, t, e) {
|
|
5165
5183
|
let i;
|
|
5166
5184
|
if (t === "viewport")
|
|
5167
|
-
i =
|
|
5185
|
+
i = Ve(c, e);
|
|
5168
5186
|
else if (t === "document")
|
|
5169
|
-
i = Fe(N(
|
|
5187
|
+
i = Fe(N(c));
|
|
5170
5188
|
else if (H(t))
|
|
5171
|
-
i =
|
|
5189
|
+
i = We(t, e);
|
|
5172
5190
|
else {
|
|
5173
|
-
const s = Pt(
|
|
5191
|
+
const s = Pt(c);
|
|
5174
5192
|
i = {
|
|
5175
5193
|
...t,
|
|
5176
5194
|
x: t.x - s.x,
|
|
5177
5195
|
y: t.y - s.y
|
|
5178
5196
|
};
|
|
5179
5197
|
}
|
|
5180
|
-
return
|
|
5198
|
+
return ot(i);
|
|
5181
5199
|
}
|
|
5182
|
-
function zt(
|
|
5183
|
-
const e =
|
|
5200
|
+
function zt(c, t) {
|
|
5201
|
+
const e = W(c);
|
|
5184
5202
|
return e === t || !H(e) || U(e) ? !1 : D(e).position === "fixed" || zt(e, t);
|
|
5185
5203
|
}
|
|
5186
|
-
function Pe(
|
|
5187
|
-
const e = t.get(
|
|
5204
|
+
function Pe(c, t) {
|
|
5205
|
+
const e = t.get(c);
|
|
5188
5206
|
if (e)
|
|
5189
5207
|
return e;
|
|
5190
|
-
let i = dt(
|
|
5191
|
-
const o = D(
|
|
5192
|
-
let r = o ?
|
|
5208
|
+
let i = dt(c, [], !1).filter((l) => H(l) && j(l) !== "body"), s = null;
|
|
5209
|
+
const o = D(c).position === "fixed";
|
|
5210
|
+
let r = o ? W(c) : c;
|
|
5193
5211
|
for (; H(r) && !U(r); ) {
|
|
5194
5212
|
const l = D(r), a = pt(r);
|
|
5195
|
-
!a && l.position === "fixed" && (s = null), (o ? !a && !s : !a && l.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || tt(r) && !a && zt(
|
|
5213
|
+
!a && l.position === "fixed" && (s = null), (o ? !a && !s : !a && l.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || tt(r) && !a && zt(c, r)) ? i = i.filter((d) => d !== r) : s = l, r = W(r);
|
|
5196
5214
|
}
|
|
5197
|
-
return t.set(
|
|
5215
|
+
return t.set(c, i), i;
|
|
5198
5216
|
}
|
|
5199
|
-
function ze(
|
|
5217
|
+
function ze(c) {
|
|
5200
5218
|
let {
|
|
5201
5219
|
element: t,
|
|
5202
5220
|
boundary: e,
|
|
5203
5221
|
rootBoundary: i,
|
|
5204
5222
|
strategy: s
|
|
5205
|
-
} =
|
|
5206
|
-
const r = [...e === "clippingAncestors" ?
|
|
5223
|
+
} = c;
|
|
5224
|
+
const r = [...e === "clippingAncestors" ? nt(t) ? [] : Pe(t, this._c) : [].concat(e), i], l = r[0], a = r.reduce((h, d) => {
|
|
5207
5225
|
const f = _t(t, d, s);
|
|
5208
|
-
return
|
|
5226
|
+
return h.top = z(f.top, h.top), h.right = Z(f.right, h.right), h.bottom = Z(f.bottom, h.bottom), h.left = z(f.left, h.left), h;
|
|
5209
5227
|
}, _t(t, l, s));
|
|
5210
5228
|
return {
|
|
5211
5229
|
width: a.right - a.left,
|
|
@@ -5214,35 +5232,35 @@ function ze(h) {
|
|
|
5214
5232
|
y: a.top
|
|
5215
5233
|
};
|
|
5216
5234
|
}
|
|
5217
|
-
function $e(
|
|
5235
|
+
function $e(c) {
|
|
5218
5236
|
const {
|
|
5219
5237
|
width: t,
|
|
5220
5238
|
height: e
|
|
5221
|
-
} =
|
|
5239
|
+
} = Vt(c);
|
|
5222
5240
|
return {
|
|
5223
5241
|
width: t,
|
|
5224
5242
|
height: e
|
|
5225
5243
|
};
|
|
5226
5244
|
}
|
|
5227
|
-
function Ge(
|
|
5228
|
-
const i =
|
|
5245
|
+
function Ge(c, t, e) {
|
|
5246
|
+
const i = k(t), s = N(t), o = e === "fixed", r = q(c, !0, o, t);
|
|
5229
5247
|
let l = {
|
|
5230
5248
|
scrollLeft: 0,
|
|
5231
5249
|
scrollTop: 0
|
|
5232
5250
|
};
|
|
5233
|
-
const a =
|
|
5251
|
+
const a = V(0);
|
|
5234
5252
|
if (i || !i && !o)
|
|
5235
|
-
if ((j(t) !== "body" || tt(s)) && (l =
|
|
5253
|
+
if ((j(t) !== "body" || tt(s)) && (l = lt(t)), i) {
|
|
5236
5254
|
const u = q(t, !0, o, t);
|
|
5237
5255
|
a.x = u.x + t.clientLeft, a.y = u.y + t.clientTop;
|
|
5238
5256
|
} else s && (a.x = xt(s));
|
|
5239
|
-
let
|
|
5257
|
+
let h = 0, d = 0;
|
|
5240
5258
|
if (s && !i && !o) {
|
|
5241
5259
|
const u = s.getBoundingClientRect();
|
|
5242
|
-
d = u.top + l.scrollTop,
|
|
5260
|
+
d = u.top + l.scrollTop, h = u.left + l.scrollLeft - // RTL <body> scrollbar.
|
|
5243
5261
|
xt(s, u);
|
|
5244
5262
|
}
|
|
5245
|
-
const f = r.left + l.scrollLeft - a.x -
|
|
5263
|
+
const f = r.left + l.scrollLeft - a.x - h, x = r.top + l.scrollTop - a.y - d;
|
|
5246
5264
|
return {
|
|
5247
5265
|
x: f,
|
|
5248
5266
|
y: x,
|
|
@@ -5250,39 +5268,39 @@ function Ge(h, t, e) {
|
|
|
5250
5268
|
height: r.height
|
|
5251
5269
|
};
|
|
5252
5270
|
}
|
|
5253
|
-
function
|
|
5254
|
-
return D(
|
|
5271
|
+
function at(c) {
|
|
5272
|
+
return D(c).position === "static";
|
|
5255
5273
|
}
|
|
5256
|
-
function Ot(
|
|
5257
|
-
if (!
|
|
5274
|
+
function Ot(c, t) {
|
|
5275
|
+
if (!k(c) || D(c).position === "fixed")
|
|
5258
5276
|
return null;
|
|
5259
5277
|
if (t)
|
|
5260
|
-
return t(
|
|
5261
|
-
let e =
|
|
5262
|
-
return N(
|
|
5278
|
+
return t(c);
|
|
5279
|
+
let e = c.offsetParent;
|
|
5280
|
+
return N(c) === e && (e = e.ownerDocument.body), e;
|
|
5263
5281
|
}
|
|
5264
|
-
function $t(
|
|
5265
|
-
const e = A(
|
|
5266
|
-
if (
|
|
5282
|
+
function $t(c, t) {
|
|
5283
|
+
const e = A(c);
|
|
5284
|
+
if (nt(c))
|
|
5267
5285
|
return e;
|
|
5268
|
-
if (!
|
|
5269
|
-
let s =
|
|
5286
|
+
if (!k(c)) {
|
|
5287
|
+
let s = W(c);
|
|
5270
5288
|
for (; s && !U(s); ) {
|
|
5271
|
-
if (H(s) && !
|
|
5289
|
+
if (H(s) && !at(s))
|
|
5272
5290
|
return s;
|
|
5273
|
-
s =
|
|
5291
|
+
s = W(s);
|
|
5274
5292
|
}
|
|
5275
5293
|
return e;
|
|
5276
5294
|
}
|
|
5277
|
-
let i = Ot(
|
|
5278
|
-
for (; i && Xe(i) &&
|
|
5295
|
+
let i = Ot(c, t);
|
|
5296
|
+
for (; i && Xe(i) && at(i); )
|
|
5279
5297
|
i = Ot(i, t);
|
|
5280
|
-
return i && U(i) &&
|
|
5298
|
+
return i && U(i) && at(i) && !pt(i) ? e : i || Be(c) || e;
|
|
5281
5299
|
}
|
|
5282
|
-
const Ue = async function(
|
|
5283
|
-
const t = this.getOffsetParent || $t, e = this.getDimensions, i = await e(
|
|
5300
|
+
const Ue = async function(c) {
|
|
5301
|
+
const t = this.getOffsetParent || $t, e = this.getDimensions, i = await e(c.floating);
|
|
5284
5302
|
return {
|
|
5285
|
-
reference: Ge(
|
|
5303
|
+
reference: Ge(c.reference, await t(c.floating), c.strategy),
|
|
5286
5304
|
floating: {
|
|
5287
5305
|
x: 0,
|
|
5288
5306
|
y: 0,
|
|
@@ -5291,8 +5309,8 @@ const Ue = async function(h) {
|
|
|
5291
5309
|
}
|
|
5292
5310
|
};
|
|
5293
5311
|
};
|
|
5294
|
-
function je(
|
|
5295
|
-
return D(
|
|
5312
|
+
function je(c) {
|
|
5313
|
+
return D(c).direction === "rtl";
|
|
5296
5314
|
}
|
|
5297
5315
|
const Ze = {
|
|
5298
5316
|
convertOffsetParentRelativeRectToViewportRelativeRect: Ne,
|
|
@@ -5305,7 +5323,7 @@ const Ze = {
|
|
|
5305
5323
|
getScale: $,
|
|
5306
5324
|
isElement: H,
|
|
5307
5325
|
isRTL: je
|
|
5308
|
-
}, Gt = He, Ut = De, jt = Ae, qe = Te, Zt = (
|
|
5326
|
+
}, Gt = He, Ut = De, jt = Ae, qe = Te, Zt = (c, t, e) => {
|
|
5309
5327
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
5310
5328
|
platform: Ze,
|
|
5311
5329
|
...e
|
|
@@ -5313,7 +5331,7 @@ const Ze = {
|
|
|
5313
5331
|
...s.platform,
|
|
5314
5332
|
_c: i
|
|
5315
5333
|
};
|
|
5316
|
-
return Le(
|
|
5334
|
+
return Le(c, t, {
|
|
5317
5335
|
...s,
|
|
5318
5336
|
platform: o
|
|
5319
5337
|
});
|
|
@@ -5397,9 +5415,9 @@ let Je = class {
|
|
|
5397
5415
|
placement: t.overflowTooltipPlacement,
|
|
5398
5416
|
middleware: [Ut(), jt(), Gt(6), qe({ element: this.arrowEl })]
|
|
5399
5417
|
}).then((l) => {
|
|
5400
|
-
const { x: a, y:
|
|
5418
|
+
const { x: a, y: h, placement: d, middlewareData: f } = l;
|
|
5401
5419
|
if (Object.assign(this.floatingEl.style, {
|
|
5402
|
-
top: `${
|
|
5420
|
+
top: `${h}px`,
|
|
5403
5421
|
left: `${a}px`
|
|
5404
5422
|
}), f.arrow) {
|
|
5405
5423
|
const x = f.arrow;
|
|
@@ -5471,8 +5489,8 @@ class Qe {
|
|
|
5471
5489
|
}
|
|
5472
5490
|
if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
|
|
5473
5491
|
t.preventDefault();
|
|
5474
|
-
const a = this.inputEl.selectionStart,
|
|
5475
|
-
this.inputEl.value =
|
|
5492
|
+
const a = this.inputEl.selectionStart, h = this.inputEl.value.substring(0, a), d = this.inputEl.value.substring(a);
|
|
5493
|
+
this.inputEl.value = h + `
|
|
5476
5494
|
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = a + 1, this.autoSize();
|
|
5477
5495
|
return;
|
|
5478
5496
|
}
|
|
@@ -5579,12 +5597,12 @@ class Qe {
|
|
|
5579
5597
|
let { height: o, width: r, drawY: l, drawX: a } = t;
|
|
5580
5598
|
this.drawX = a, this.drawY = l;
|
|
5581
5599
|
const {
|
|
5582
|
-
config: { CELL_PADDING:
|
|
5600
|
+
config: { CELL_PADDING: h },
|
|
5583
5601
|
header: d
|
|
5584
5602
|
} = this.ctx;
|
|
5585
5603
|
let f = this.ctx.body.visibleHeight;
|
|
5586
5604
|
if (o > f && (o = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
5587
|
-
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${
|
|
5605
|
+
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus({ preventScroll: !0 });
|
|
5588
5606
|
const x = this.inputEl.value.length;
|
|
5589
5607
|
this.inputEl.setSelectionRange(x, x);
|
|
5590
5608
|
} else
|
|
@@ -5612,10 +5630,10 @@ class Qe {
|
|
|
5612
5630
|
i && !a && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
|
|
5613
5631
|
}
|
|
5614
5632
|
editCell(t, e) {
|
|
5615
|
-
const i = this.ctx.body.renderRows.find((
|
|
5633
|
+
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
5616
5634
|
if (!i)
|
|
5617
5635
|
return;
|
|
5618
|
-
const s = i.cells.find((
|
|
5636
|
+
const s = i.cells.find((h) => h.colIndex === e);
|
|
5619
5637
|
if (!s)
|
|
5620
5638
|
return;
|
|
5621
5639
|
this.ctx.emit("setSelectorCell", s);
|
|
@@ -5643,7 +5661,7 @@ class ti {
|
|
|
5643
5661
|
this.ctx = t;
|
|
5644
5662
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
|
|
5645
5663
|
this.ctx.emptyElement ? this.emptyEl = this.ctx.emptyElement : (this.emptyEl = document.createElement("div"), this.emptyEl.innerText = e), this.emptyEl.className = "e-virt-table-empty", this.emptyEl.style.display = "none", this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: s, headerHeight: o, bodyHeight: r, footerHeight: l }) => {
|
|
5646
|
-
const a = o + (r + l) / 2,
|
|
5664
|
+
const a = o + (r + l) / 2, h = {
|
|
5647
5665
|
display: s === "empty" ? "block" : "none",
|
|
5648
5666
|
position: "absolute",
|
|
5649
5667
|
fontSize: "14px",
|
|
@@ -5653,7 +5671,7 @@ class ti {
|
|
|
5653
5671
|
transform: "translate(-50%, -50%)",
|
|
5654
5672
|
...i
|
|
5655
5673
|
};
|
|
5656
|
-
Object.assign(this.emptyEl.style,
|
|
5674
|
+
Object.assign(this.emptyEl.style, h);
|
|
5657
5675
|
});
|
|
5658
5676
|
}
|
|
5659
5677
|
destroy() {
|
|
@@ -5689,9 +5707,9 @@ class ei {
|
|
|
5689
5707
|
fixedRightWidth: e,
|
|
5690
5708
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5691
5709
|
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: l } = this.ctx.header;
|
|
5692
|
-
let a = [],
|
|
5693
|
-
l.forEach((
|
|
5694
|
-
|
|
5710
|
+
let a = [], h = [], d = [];
|
|
5711
|
+
l.forEach((w) => {
|
|
5712
|
+
w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ? d.push(w) : a.push(w));
|
|
5695
5713
|
});
|
|
5696
5714
|
const f = e - i, x = {
|
|
5697
5715
|
key: "left",
|
|
@@ -5703,7 +5721,7 @@ class ei {
|
|
|
5703
5721
|
width: `${t}px`,
|
|
5704
5722
|
height: `${r}px`
|
|
5705
5723
|
},
|
|
5706
|
-
cells:
|
|
5724
|
+
cells: h
|
|
5707
5725
|
}, u = {
|
|
5708
5726
|
key: "center",
|
|
5709
5727
|
style: {
|
|
@@ -5742,8 +5760,8 @@ class ei {
|
|
|
5742
5760
|
getBody() {
|
|
5743
5761
|
const t = [], e = [], i = [];
|
|
5744
5762
|
let s = this.ctx.body.renderRows;
|
|
5745
|
-
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((
|
|
5746
|
-
|
|
5763
|
+
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((w) => {
|
|
5764
|
+
w.cells.forEach((E) => {
|
|
5747
5765
|
E.cellType === "footer" && (E.render = E.renderFooter), E.render && (E.fixed === "left" ? e.push(E) : E.fixed === "right" ? i.push(E) : t.push(E));
|
|
5748
5766
|
});
|
|
5749
5767
|
});
|
|
@@ -5751,7 +5769,7 @@ class ei {
|
|
|
5751
5769
|
fixedLeftWidth: o,
|
|
5752
5770
|
fixedRightWidth: r,
|
|
5753
5771
|
config: { SCROLLER_TRACK_SIZE: l, CSS_PREFIX: a }
|
|
5754
|
-
} = this.ctx, { visibleWidth:
|
|
5772
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r - l, x = {
|
|
5755
5773
|
key: "left",
|
|
5756
5774
|
style: {
|
|
5757
5775
|
position: "absolute",
|
|
@@ -5769,7 +5787,7 @@ class ei {
|
|
|
5769
5787
|
top: `${0.5}px`,
|
|
5770
5788
|
left: `${o - 0.5}px`,
|
|
5771
5789
|
overflow: "hidden",
|
|
5772
|
-
width: `${
|
|
5790
|
+
width: `${h - o - f}px`,
|
|
5773
5791
|
height: `${d}px`
|
|
5774
5792
|
},
|
|
5775
5793
|
cells: t
|
|
@@ -5791,7 +5809,7 @@ class ei {
|
|
|
5791
5809
|
style: {
|
|
5792
5810
|
position: "relative",
|
|
5793
5811
|
overflow: "hidden",
|
|
5794
|
-
width: `${
|
|
5812
|
+
width: `${h}px`,
|
|
5795
5813
|
height: `${d}px`
|
|
5796
5814
|
},
|
|
5797
5815
|
views: [x, u, p]
|
|
@@ -5799,16 +5817,16 @@ class ei {
|
|
|
5799
5817
|
}
|
|
5800
5818
|
getFooter() {
|
|
5801
5819
|
const t = [], e = [], i = [];
|
|
5802
|
-
this.ctx.footer.renderRows.forEach((
|
|
5803
|
-
|
|
5804
|
-
|
|
5820
|
+
this.ctx.footer.renderRows.forEach((g) => {
|
|
5821
|
+
g.cells.forEach((w) => {
|
|
5822
|
+
w.cellType === "footer" && w.renderFooter && (w.render = w.renderFooter, w.fixed === "left" ? e.push(w) : w.fixed === "right" ? i.push(w) : t.push(w));
|
|
5805
5823
|
});
|
|
5806
5824
|
});
|
|
5807
5825
|
const {
|
|
5808
5826
|
fixedLeftWidth: s,
|
|
5809
5827
|
fixedRightWidth: o,
|
|
5810
5828
|
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: l }
|
|
5811
|
-
} = this.ctx, { visibleWidth: a, visibleHeight:
|
|
5829
|
+
} = this.ctx, { visibleWidth: a, visibleHeight: h } = this.ctx.footer, d = o - r, f = {
|
|
5812
5830
|
key: "left",
|
|
5813
5831
|
style: {
|
|
5814
5832
|
position: "absolute",
|
|
@@ -5816,7 +5834,7 @@ class ei {
|
|
|
5816
5834
|
left: `${0.5}px`,
|
|
5817
5835
|
overflow: "hidden",
|
|
5818
5836
|
width: `${s}px`,
|
|
5819
|
-
height: `${
|
|
5837
|
+
height: `${h}px`
|
|
5820
5838
|
},
|
|
5821
5839
|
cells: e
|
|
5822
5840
|
}, x = {
|
|
@@ -5827,7 +5845,7 @@ class ei {
|
|
|
5827
5845
|
left: `${s - 0.5}px`,
|
|
5828
5846
|
overflow: "hidden",
|
|
5829
5847
|
width: `${a - s - d}px`,
|
|
5830
|
-
height: `${
|
|
5848
|
+
height: `${h}px`
|
|
5831
5849
|
},
|
|
5832
5850
|
cells: t
|
|
5833
5851
|
}, u = {
|
|
@@ -5838,7 +5856,7 @@ class ei {
|
|
|
5838
5856
|
right: `${0.5}px`,
|
|
5839
5857
|
overflow: "hidden",
|
|
5840
5858
|
width: `${d}px`,
|
|
5841
|
-
height: `${
|
|
5859
|
+
height: `${h}px`
|
|
5842
5860
|
},
|
|
5843
5861
|
cells: i
|
|
5844
5862
|
};
|
|
@@ -5849,7 +5867,7 @@ class ei {
|
|
|
5849
5867
|
position: "relative",
|
|
5850
5868
|
overflow: "hidden",
|
|
5851
5869
|
width: `${a}px`,
|
|
5852
|
-
height: `${
|
|
5870
|
+
height: `${h}px`
|
|
5853
5871
|
},
|
|
5854
5872
|
views: [f, x, u]
|
|
5855
5873
|
};
|
|
@@ -5866,8 +5884,8 @@ class ii {
|
|
|
5866
5884
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5867
5885
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5868
5886
|
e.preventDefault();
|
|
5869
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [l, a] = s, { rowIndex:
|
|
5870
|
-
|
|
5887
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [l, a] = s, { rowIndex: h, colIndex: d } = t;
|
|
5888
|
+
h >= l && h <= a && d >= o && d <= r || this.ctx.emit("setSelectorCell", t, e);
|
|
5871
5889
|
const x = {
|
|
5872
5890
|
getBoundingClientRect: () => ({
|
|
5873
5891
|
width: 0,
|
|
@@ -5974,15 +5992,15 @@ class ri {
|
|
|
5974
5992
|
t.className = "e-virt-table-container";
|
|
5975
5993
|
const r = document.createElement("div"), l = document.createElement("canvas"), a = e || document.createElement("div");
|
|
5976
5994
|
r.className = "e-virt-table-stage", t.tabIndex = 0, l.className = "e-virt-table-canvas", a.className = "e-virt-table-overlayer";
|
|
5977
|
-
const
|
|
5978
|
-
|
|
5995
|
+
const h = i || document.createElement("div");
|
|
5996
|
+
h.className = "e-virt-table-editor";
|
|
5979
5997
|
const d = s, f = o;
|
|
5980
5998
|
return r.appendChild(l), r.appendChild(a), t.appendChild(r), {
|
|
5981
5999
|
containerElement: t,
|
|
5982
6000
|
stageElement: r,
|
|
5983
6001
|
canvasElement: l,
|
|
5984
6002
|
overlayerElement: a,
|
|
5985
|
-
editorElement:
|
|
6003
|
+
editorElement: h,
|
|
5986
6004
|
emptyElement: d,
|
|
5987
6005
|
contextMenuElement: f
|
|
5988
6006
|
};
|
|
@@ -6022,14 +6040,18 @@ class ri {
|
|
|
6022
6040
|
editCell(t, e) {
|
|
6023
6041
|
this.editor.editCell(t, e);
|
|
6024
6042
|
}
|
|
6025
|
-
setItemValue(t, e, i, s = !0, o = !0, r = !1) {
|
|
6026
|
-
this.ctx.database.setItemValue(t, e, i, s, o, r);
|
|
6043
|
+
setItemValue(t, e, i, s = !0, o = !0, r = !1, l = !0) {
|
|
6044
|
+
this.ctx.database.setItemValue(t, e, i, s, o, r, l);
|
|
6045
|
+
}
|
|
6046
|
+
batchSetItemValue(t, e = !0, i = !0) {
|
|
6047
|
+
this.ctx.database.batchSetItemValue(t, e, i);
|
|
6027
6048
|
}
|
|
6028
|
-
|
|
6029
|
-
this.ctx.
|
|
6049
|
+
setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
|
|
6050
|
+
this.ctx.setItemValueByEditor(t, e, i, s, o, r), this.editor.doneEdit();
|
|
6030
6051
|
}
|
|
6031
|
-
|
|
6032
|
-
this.ctx.
|
|
6052
|
+
clearEditableData(t = null) {
|
|
6053
|
+
const e = [0, this.ctx.maxColIndex], i = [0, this.ctx.maxRowIndex];
|
|
6054
|
+
return this.selector.clearSelectedData(e, i, !1, t);
|
|
6033
6055
|
}
|
|
6034
6056
|
clearEditor() {
|
|
6035
6057
|
this.editor.clearEditor();
|
|
@@ -6065,15 +6087,15 @@ class ri {
|
|
|
6065
6087
|
return new Promise(async (i, s) => {
|
|
6066
6088
|
let o = [];
|
|
6067
6089
|
for (let r = 0; r < t.length; r++) {
|
|
6068
|
-
const { rowKey: l, key: a } = t[r],
|
|
6069
|
-
Array.isArray(
|
|
6090
|
+
const { rowKey: l, key: a } = t[r], h = await this.ctx.database.getValidator(l, a);
|
|
6091
|
+
Array.isArray(h) && h.length && o.push(h);
|
|
6070
6092
|
}
|
|
6071
6093
|
if (o.length) {
|
|
6072
6094
|
if (s(o), e) {
|
|
6073
6095
|
const [r] = o;
|
|
6074
6096
|
if (Array.isArray(r) && r.length) {
|
|
6075
|
-
const [l] = r, { rowKey: a, key:
|
|
6076
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
6097
|
+
const [l] = r, { rowKey: a, key: h } = l;
|
|
6098
|
+
this.scrollToRowkey(a), this.scrollToColkey(h);
|
|
6077
6099
|
}
|
|
6078
6100
|
}
|
|
6079
6101
|
this.ctx.emit("draw");
|
|
@@ -6090,9 +6112,9 @@ class ri {
|
|
|
6090
6112
|
if (t && Array.isArray(s) && s.length) {
|
|
6091
6113
|
const [o] = s;
|
|
6092
6114
|
if (Array.isArray(o) && o.length) {
|
|
6093
|
-
const [r] = o, { rowKey: l, key: a } = r,
|
|
6094
|
-
if (
|
|
6095
|
-
const { parentRowKeys: d = [] } =
|
|
6115
|
+
const [r] = o, { rowKey: l, key: a } = r, h = this.ctx.database.getRowForRowKey(l);
|
|
6116
|
+
if (h) {
|
|
6117
|
+
const { parentRowKeys: d = [] } = h;
|
|
6096
6118
|
d && d.length && this.setExpandRowKeys(d, !0);
|
|
6097
6119
|
}
|
|
6098
6120
|
this.scrollToRowkey(l), this.scrollToColkey(a);
|