e-virt-table 0.0.21 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1258 -1229
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Autofill.js +6 -5
- package/dist/lib/Autofill.js.map +1 -1
- package/dist/lib/BaseCell.d.ts +2 -2
- package/dist/lib/BaseCell.js +11 -11
- package/dist/lib/BaseCell.js.map +1 -1
- package/dist/lib/Body.js +29 -20
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Cell.d.ts +2 -1
- package/dist/lib/Cell.js +26 -7
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +0 -1
- package/dist/lib/CellHeader.js +3 -4
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Context.d.ts +19 -5
- package/dist/lib/Context.js +45 -15
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/ContextMenu.js +1 -1
- package/dist/lib/ContextMenu.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +10 -3
- package/dist/lib/EVirtTable.js +47 -23
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +18 -9
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/Empty.js +1 -1
- package/dist/lib/Empty.js.map +1 -1
- package/dist/lib/EventBrowser.d.ts +3 -1
- package/dist/lib/EventBrowser.js +25 -14
- package/dist/lib/EventBrowser.js.map +1 -1
- package/dist/lib/EventTable.d.ts +2 -0
- package/dist/lib/EventTable.js +143 -166
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/Footer.js +4 -4
- package/dist/lib/Footer.js.map +1 -1
- package/dist/lib/Header.js +21 -19
- package/dist/lib/Header.js.map +1 -1
- package/dist/lib/Overlayer.js +8 -36
- package/dist/lib/Overlayer.js.map +1 -1
- package/dist/lib/Paint.d.ts +7 -3
- package/dist/lib/Paint.js +32 -28
- package/dist/lib/Paint.js.map +1 -1
- package/dist/lib/Scroller.js +10 -10
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.d.ts +1 -0
- package/dist/lib/Selector.js +40 -27
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/Tooltip.js +6 -6
- package/dist/lib/Tooltip.js.map +1 -1
- package/dist/lib/types.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(':root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary:
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(':root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary: #333;--e-virt-table-text-color-regular: #666;--e-virt-table-text-color-secondary: #999;--e-virt-table-box-shadow: 0 2px 12px 0 #0000001a;--e-virt-table-editor-bg-color: #fff;--e-virt-table-border-color: #e1e6eb}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;z-index:10;border-radius:8px;border:1px solid var(--e-virt-table-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;line-height:0;z-index:100;overflow:hidden;background-color:var(--e-virt-table-editor-bg-color);border:2px solid var(--e-virt-table-color-primary);box-sizing:border-box;box-shadow:var(--e-virt-table-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:"absolute";left:0;top:0;overflow:hidden;z-index:10}.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(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-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(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
2
|
var me = Object.defineProperty;
|
|
3
|
-
var Ee = (
|
|
4
|
-
var c = (
|
|
3
|
+
var Ee = (n, t, e) => t in n ? me(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
4
|
+
var c = (n, t, e) => Ee(n, typeof t != "symbol" ? t + "" : t, e);
|
|
5
5
|
function $() {
|
|
6
|
-
return $ = Object.assign ? Object.assign.bind() : function(
|
|
6
|
+
return $ = Object.assign ? Object.assign.bind() : function(n) {
|
|
7
7
|
for (var t = 1; t < arguments.length; t++) {
|
|
8
8
|
var e = arguments[t];
|
|
9
9
|
for (var i in e)
|
|
10
|
-
Object.prototype.hasOwnProperty.call(e, i) && (
|
|
10
|
+
Object.prototype.hasOwnProperty.call(e, i) && (n[i] = e[i]);
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return n;
|
|
13
13
|
}, $.apply(this, arguments);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
15
|
+
function be(n, t) {
|
|
16
|
+
n.prototype = Object.create(t.prototype), n.prototype.constructor = n, st(n, t);
|
|
17
17
|
}
|
|
18
|
-
function Et(
|
|
18
|
+
function Et(n) {
|
|
19
19
|
return Et = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
|
|
20
20
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
21
|
-
}, Et(
|
|
21
|
+
}, Et(n);
|
|
22
22
|
}
|
|
23
|
-
function st(
|
|
23
|
+
function st(n, t) {
|
|
24
24
|
return st = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(i, s) {
|
|
25
25
|
return i.__proto__ = s, i;
|
|
26
|
-
}, st(
|
|
26
|
+
}, st(n, t);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Ce() {
|
|
29
29
|
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
30
30
|
if (typeof Proxy == "function") return !0;
|
|
31
31
|
try {
|
|
@@ -35,20 +35,20 @@ function be() {
|
|
|
35
35
|
return !1;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function dt(
|
|
39
|
-
return
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
return o && st(
|
|
38
|
+
function dt(n, t, e) {
|
|
39
|
+
return Ce() ? dt = Reflect.construct.bind() : dt = function(s, r, o) {
|
|
40
|
+
var a = [null];
|
|
41
|
+
a.push.apply(a, r);
|
|
42
|
+
var h = Function.bind.apply(s, a), l = new h();
|
|
43
|
+
return o && st(l, o.prototype), l;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
46
|
-
function ve(
|
|
47
|
-
return Function.toString.call(
|
|
46
|
+
function ve(n) {
|
|
47
|
+
return Function.toString.call(n).indexOf("[native code]") !== -1;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function bt(n) {
|
|
50
50
|
var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
51
|
-
return
|
|
51
|
+
return bt = function(i) {
|
|
52
52
|
if (i === null || !ve(i)) return i;
|
|
53
53
|
if (typeof i != "function")
|
|
54
54
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -67,36 +67,36 @@ function Ct(a) {
|
|
|
67
67
|
configurable: !0
|
|
68
68
|
}
|
|
69
69
|
}), st(s, i);
|
|
70
|
-
},
|
|
70
|
+
}, bt(n);
|
|
71
71
|
}
|
|
72
|
-
var Re = /%[sdj%]/g,
|
|
72
|
+
var Re = /%[sdj%]/g, Gt = function() {
|
|
73
73
|
};
|
|
74
|
-
typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (
|
|
74
|
+
typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (Gt = function(t, e) {
|
|
75
75
|
typeof console < "u" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING > "u" && e.every(function(i) {
|
|
76
76
|
return typeof i == "string";
|
|
77
77
|
}) && console.warn(t, e);
|
|
78
78
|
});
|
|
79
|
-
function
|
|
80
|
-
if (!
|
|
79
|
+
function Ct(n) {
|
|
80
|
+
if (!n || !n.length) return null;
|
|
81
81
|
var t = {};
|
|
82
|
-
return
|
|
82
|
+
return n.forEach(function(e) {
|
|
83
83
|
var i = e.field;
|
|
84
84
|
t[i] = t[i] || [], t[i].push(e);
|
|
85
85
|
}), t;
|
|
86
86
|
}
|
|
87
|
-
function M(
|
|
87
|
+
function M(n) {
|
|
88
88
|
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
|
|
89
89
|
e[i - 1] = arguments[i];
|
|
90
90
|
var s = 0, r = e.length;
|
|
91
|
-
if (typeof
|
|
92
|
-
return
|
|
93
|
-
if (typeof
|
|
94
|
-
var o =
|
|
95
|
-
if (
|
|
91
|
+
if (typeof n == "function")
|
|
92
|
+
return n.apply(null, e);
|
|
93
|
+
if (typeof n == "string") {
|
|
94
|
+
var o = n.replace(Re, function(a) {
|
|
95
|
+
if (a === "%%")
|
|
96
96
|
return "%";
|
|
97
97
|
if (s >= r)
|
|
98
|
-
return
|
|
99
|
-
switch (
|
|
98
|
+
return a;
|
|
99
|
+
switch (a) {
|
|
100
100
|
case "%s":
|
|
101
101
|
return String(e[s++]);
|
|
102
102
|
case "%d":
|
|
@@ -109,120 +109,120 @@ function M(a) {
|
|
|
109
109
|
}
|
|
110
110
|
break;
|
|
111
111
|
default:
|
|
112
|
-
return
|
|
112
|
+
return a;
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
return o;
|
|
116
116
|
}
|
|
117
|
-
return
|
|
117
|
+
return n;
|
|
118
118
|
}
|
|
119
|
-
function _e(
|
|
120
|
-
return
|
|
119
|
+
function _e(n) {
|
|
120
|
+
return n === "string" || n === "url" || n === "hex" || n === "email" || n === "date" || n === "pattern";
|
|
121
121
|
}
|
|
122
|
-
function _(
|
|
123
|
-
return !!(
|
|
122
|
+
function _(n, t) {
|
|
123
|
+
return !!(n == null || t === "array" && Array.isArray(n) && !n.length || _e(t) && typeof n == "string" && !n);
|
|
124
124
|
}
|
|
125
|
-
function Ie(
|
|
126
|
-
var i = [], s = 0, r =
|
|
127
|
-
function o(
|
|
128
|
-
i.push.apply(i,
|
|
125
|
+
function Ie(n, t, e) {
|
|
126
|
+
var i = [], s = 0, r = n.length;
|
|
127
|
+
function o(a) {
|
|
128
|
+
i.push.apply(i, a || []), s++, s === r && e(i);
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
t(
|
|
130
|
+
n.forEach(function(a) {
|
|
131
|
+
t(a, o);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
var i = 0, s =
|
|
134
|
+
function Xt(n, t, e) {
|
|
135
|
+
var i = 0, s = n.length;
|
|
136
136
|
function r(o) {
|
|
137
137
|
if (o && o.length) {
|
|
138
138
|
e(o);
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
-
var
|
|
142
|
-
i = i + 1,
|
|
141
|
+
var a = i;
|
|
142
|
+
i = i + 1, a < s ? t(n[a], r) : e([]);
|
|
143
143
|
}
|
|
144
144
|
r([]);
|
|
145
145
|
}
|
|
146
|
-
function Oe(
|
|
146
|
+
function Oe(n) {
|
|
147
147
|
var t = [];
|
|
148
|
-
return Object.keys(
|
|
149
|
-
t.push.apply(t,
|
|
148
|
+
return Object.keys(n).forEach(function(e) {
|
|
149
|
+
t.push.apply(t, n[e] || []);
|
|
150
150
|
}), t;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
153
|
-
|
|
152
|
+
var Ft = /* @__PURE__ */ function(n) {
|
|
153
|
+
be(t, n);
|
|
154
154
|
function t(e, i) {
|
|
155
155
|
var s;
|
|
156
|
-
return s =
|
|
156
|
+
return s = n.call(this, "Async Validation Error") || this, s.errors = e, s.fields = i, s;
|
|
157
157
|
}
|
|
158
158
|
return t;
|
|
159
|
-
}(/* @__PURE__ */
|
|
160
|
-
function
|
|
159
|
+
}(/* @__PURE__ */ bt(Error));
|
|
160
|
+
function Te(n, t, e, i, s) {
|
|
161
161
|
if (t.first) {
|
|
162
162
|
var r = new Promise(function(x, u) {
|
|
163
|
-
var
|
|
164
|
-
return i(y), y.length ? u(new
|
|
165
|
-
},
|
|
166
|
-
|
|
163
|
+
var g = function(y) {
|
|
164
|
+
return i(y), y.length ? u(new Ft(y, Ct(y))) : x(s);
|
|
165
|
+
}, w = Oe(n);
|
|
166
|
+
Xt(w, e, g);
|
|
167
167
|
});
|
|
168
168
|
return r.catch(function(x) {
|
|
169
169
|
return x;
|
|
170
170
|
}), r;
|
|
171
171
|
}
|
|
172
|
-
var o = t.firstFields === !0 ? Object.keys(
|
|
173
|
-
var
|
|
174
|
-
if (f.push.apply(f,
|
|
175
|
-
return i(f), f.length ? u(new
|
|
172
|
+
var o = t.firstFields === !0 ? Object.keys(n) : t.firstFields || [], a = Object.keys(n), h = a.length, l = 0, f = [], d = new Promise(function(x, u) {
|
|
173
|
+
var g = function(p) {
|
|
174
|
+
if (f.push.apply(f, p), l++, l === h)
|
|
175
|
+
return i(f), f.length ? u(new Ft(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
|
-
|
|
178
|
-
var
|
|
179
|
-
o.indexOf(
|
|
177
|
+
a.length || (i(f), x(s)), a.forEach(function(w) {
|
|
178
|
+
var p = n[w];
|
|
179
|
+
o.indexOf(w) !== -1 ? Xt(p, e, g) : Ie(p, e, g);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
return d.catch(function(x) {
|
|
183
183
|
return x;
|
|
184
184
|
}), d;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
return !!(
|
|
186
|
+
function Se(n) {
|
|
187
|
+
return !!(n && n.message !== void 0);
|
|
188
188
|
}
|
|
189
|
-
function Ae(
|
|
190
|
-
for (var e =
|
|
189
|
+
function Ae(n, t) {
|
|
190
|
+
for (var e = n, i = 0; i < t.length; i++) {
|
|
191
191
|
if (e == null)
|
|
192
192
|
return e;
|
|
193
193
|
e = e[t[i]];
|
|
194
194
|
}
|
|
195
195
|
return e;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function kt(n, t) {
|
|
198
198
|
return function(e) {
|
|
199
199
|
var i;
|
|
200
|
-
return
|
|
200
|
+
return n.fullFields ? i = Ae(t, n.fullFields) : i = t[e.field || n.fullField], Se(e) ? (e.field = e.field || n.fullField, e.fieldValue = i, e) : {
|
|
201
201
|
message: typeof e == "function" ? e() : e,
|
|
202
202
|
fieldValue: i,
|
|
203
|
-
field: e.field ||
|
|
203
|
+
field: e.field || n.fullField
|
|
204
204
|
};
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Nt(n, t) {
|
|
208
208
|
if (t) {
|
|
209
209
|
for (var e in t)
|
|
210
210
|
if (t.hasOwnProperty(e)) {
|
|
211
211
|
var i = t[e];
|
|
212
|
-
typeof i == "object" && typeof
|
|
212
|
+
typeof i == "object" && typeof n[e] == "object" ? n[e] = $({}, n[e], i) : n[e] = i;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
return
|
|
215
|
+
return n;
|
|
216
216
|
}
|
|
217
|
-
var
|
|
217
|
+
var jt = function(t, e, i, s, r, o) {
|
|
218
218
|
t.required && (!i.hasOwnProperty(t.field) || _(e, o || t.type)) && s.push(M(r.messages.required, t.fullField));
|
|
219
219
|
}, Le = function(t, e, i, s, r) {
|
|
220
220
|
(/^\s+$/.test(e) || e === "") && s.push(M(r.messages.whitespace, t.fullField));
|
|
221
|
-
},
|
|
222
|
-
if (
|
|
223
|
-
return
|
|
224
|
-
var
|
|
225
|
-
return E && E.includeBoundaries ? "(?:(?<=\\s|^)(?=" +
|
|
221
|
+
}, lt, Me = function() {
|
|
222
|
+
if (lt)
|
|
223
|
+
return lt;
|
|
224
|
+
var n = "[a-fA-F\\d:]", t = function(E) {
|
|
225
|
+
return E && E.includeBoundaries ? "(?:(?<=\\s|^)(?=" + n + ")|(?<=" + n + ")(?=\\s|$))" : "";
|
|
226
226
|
}, e = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", i = "[a-fA-F\\d]{1,4}", s = (`
|
|
227
227
|
(?:
|
|
228
228
|
(?:` + i + ":){7}(?:" + i + `|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
@@ -234,17 +234,17 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
234
234
|
(?:` + i + ":){1}(?:(?::" + i + "){0,4}:" + e + "|(?::" + i + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
235
235
|
(?::(?:(?::` + i + "){0,5}:" + e + "|(?::" + i + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
236
236
|
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
237
|
-
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"),
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), a = new RegExp("^" + s + "$"), h = function(E) {
|
|
238
238
|
return E && E.exact ? r : new RegExp("(?:" + t(E) + e + t(E) + ")|(?:" + t(E) + s + t(E) + ")", "g");
|
|
239
239
|
};
|
|
240
|
-
|
|
240
|
+
h.v4 = function(m) {
|
|
241
241
|
return m && m.exact ? o : new RegExp("" + t(m) + e + t(m), "g");
|
|
242
|
-
},
|
|
243
|
-
return m && m.exact ?
|
|
242
|
+
}, h.v6 = function(m) {
|
|
243
|
+
return m && m.exact ? a : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var
|
|
246
|
-
return
|
|
247
|
-
},
|
|
245
|
+
var l = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d = h.v4().source, x = h.v6().source, u = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", g = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", w = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", p = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?', b = "(?:" + l + "|www\\.)" + f + "(?:localhost|" + d + "|" + x + "|" + u + g + w + ")" + p + y;
|
|
246
|
+
return lt = new RegExp("(?:^" + b + "$)", "i"), lt;
|
|
247
|
+
}, Yt = {
|
|
248
248
|
// http://emailregex.com/
|
|
249
249
|
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
250
250
|
// url: new RegExp(
|
|
@@ -284,26 +284,26 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
284
284
|
return typeof t == "function";
|
|
285
285
|
},
|
|
286
286
|
email: function(t) {
|
|
287
|
-
return typeof t == "string" && t.length <= 320 && !!t.match(
|
|
287
|
+
return typeof t == "string" && t.length <= 320 && !!t.match(Yt.email);
|
|
288
288
|
},
|
|
289
289
|
url: function(t) {
|
|
290
290
|
return typeof t == "string" && t.length <= 2048 && !!t.match(Me());
|
|
291
291
|
},
|
|
292
292
|
hex: function(t) {
|
|
293
|
-
return typeof t == "string" && !!t.match(
|
|
293
|
+
return typeof t == "string" && !!t.match(Yt.hex);
|
|
294
294
|
}
|
|
295
295
|
}, He = function(t, e, i, s, r) {
|
|
296
296
|
if (t.required && e === void 0) {
|
|
297
|
-
|
|
297
|
+
jt(t, e, i, s, r);
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
|
-
var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"],
|
|
301
|
-
o.indexOf(
|
|
300
|
+
var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], a = t.type;
|
|
301
|
+
o.indexOf(a) > -1 ? et[a](e) || s.push(M(r.messages.types[a], t.fullField, t.type)) : a && typeof e !== t.type && s.push(M(r.messages.types[a], t.fullField, t.type));
|
|
302
302
|
}, De = function(t, e, i, s, r) {
|
|
303
|
-
var o = typeof t.len == "number",
|
|
304
|
-
if (x ? d = "number" : u ? d = "string" :
|
|
303
|
+
var o = typeof t.len == "number", a = typeof t.min == "number", h = typeof t.max == "number", l = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, f = e, d = null, x = typeof e == "number", u = typeof e == "string", g = Array.isArray(e);
|
|
304
|
+
if (x ? d = "number" : u ? d = "string" : g && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
|
-
|
|
306
|
+
g && (f = e.length), u && (f = e.replace(l, "_").length), o ? f !== t.len && s.push(M(r.messages[d].len, t.fullField, t.len)) : a && !h && f < t.min ? s.push(M(r.messages[d].min, t.fullField, t.min)) : h && !a && f > t.max ? s.push(M(r.messages[d].max, t.fullField, t.max)) : a && h && (f < t.min || f > t.max) && s.push(M(r.messages[d].range, t.fullField, t.min, t.max));
|
|
307
307
|
}, j = "enum", Xe = function(t, e, i, s, r) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(M(r.messages[j], t.fullField, t[j].join(", ")));
|
|
309
309
|
}, Fe = function(t, e, i, s, r) {
|
|
@@ -316,125 +316,125 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}, v = {
|
|
319
|
-
required:
|
|
319
|
+
required: jt,
|
|
320
320
|
whitespace: Le,
|
|
321
321
|
type: He,
|
|
322
322
|
range: De,
|
|
323
323
|
enum: Xe,
|
|
324
324
|
pattern: Fe
|
|
325
325
|
}, ke = function(t, e, i, s, r) {
|
|
326
|
-
var o = [],
|
|
327
|
-
if (
|
|
326
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
327
|
+
if (a) {
|
|
328
328
|
if (_(e, "string") && !t.required)
|
|
329
329
|
return i();
|
|
330
330
|
v.required(t, e, s, o, r, "string"), _(e, "string") || (v.type(t, e, s, o, r), v.range(t, e, s, o, r), v.pattern(t, e, s, o, r), t.whitespace === !0 && v.whitespace(t, e, s, o, r));
|
|
331
331
|
}
|
|
332
332
|
i(o);
|
|
333
333
|
}, Ne = function(t, e, i, s, r) {
|
|
334
|
-
var o = [],
|
|
335
|
-
if (
|
|
334
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
335
|
+
if (a) {
|
|
336
336
|
if (_(e) && !t.required)
|
|
337
337
|
return i();
|
|
338
338
|
v.required(t, e, s, o, r), e !== void 0 && v.type(t, e, s, o, r);
|
|
339
339
|
}
|
|
340
340
|
i(o);
|
|
341
341
|
}, Ye = function(t, e, i, s, r) {
|
|
342
|
-
var o = [],
|
|
343
|
-
if (
|
|
342
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
343
|
+
if (a) {
|
|
344
344
|
if (e === "" && (e = void 0), _(e) && !t.required)
|
|
345
345
|
return i();
|
|
346
346
|
v.required(t, e, s, o, r), e !== void 0 && (v.type(t, e, s, o, r), v.range(t, e, s, o, r));
|
|
347
347
|
}
|
|
348
348
|
i(o);
|
|
349
349
|
}, Ke = function(t, e, i, s, r) {
|
|
350
|
-
var o = [],
|
|
351
|
-
if (
|
|
350
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
351
|
+
if (a) {
|
|
352
352
|
if (_(e) && !t.required)
|
|
353
353
|
return i();
|
|
354
354
|
v.required(t, e, s, o, r), e !== void 0 && v.type(t, e, s, o, r);
|
|
355
355
|
}
|
|
356
356
|
i(o);
|
|
357
357
|
}, Be = function(t, e, i, s, r) {
|
|
358
|
-
var o = [],
|
|
359
|
-
if (
|
|
358
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
359
|
+
if (a) {
|
|
360
360
|
if (_(e) && !t.required)
|
|
361
361
|
return i();
|
|
362
362
|
v.required(t, e, s, o, r), _(e) || v.type(t, e, s, o, r);
|
|
363
363
|
}
|
|
364
364
|
i(o);
|
|
365
365
|
}, We = function(t, e, i, s, r) {
|
|
366
|
-
var o = [],
|
|
367
|
-
if (
|
|
366
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
367
|
+
if (a) {
|
|
368
368
|
if (_(e) && !t.required)
|
|
369
369
|
return i();
|
|
370
370
|
v.required(t, e, s, o, r), e !== void 0 && (v.type(t, e, s, o, r), v.range(t, e, s, o, r));
|
|
371
371
|
}
|
|
372
372
|
i(o);
|
|
373
373
|
}, Pe = function(t, e, i, s, r) {
|
|
374
|
-
var o = [],
|
|
375
|
-
if (
|
|
374
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
375
|
+
if (a) {
|
|
376
376
|
if (_(e) && !t.required)
|
|
377
377
|
return i();
|
|
378
378
|
v.required(t, e, s, o, r), e !== void 0 && (v.type(t, e, s, o, r), v.range(t, e, s, o, r));
|
|
379
379
|
}
|
|
380
380
|
i(o);
|
|
381
381
|
}, Ve = function(t, e, i, s, r) {
|
|
382
|
-
var o = [],
|
|
383
|
-
if (
|
|
382
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
383
|
+
if (a) {
|
|
384
384
|
if (e == null && !t.required)
|
|
385
385
|
return i();
|
|
386
386
|
v.required(t, e, s, o, r, "array"), e != null && (v.type(t, e, s, o, r), v.range(t, e, s, o, r));
|
|
387
387
|
}
|
|
388
388
|
i(o);
|
|
389
389
|
}, ze = function(t, e, i, s, r) {
|
|
390
|
-
var o = [],
|
|
391
|
-
if (
|
|
390
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
391
|
+
if (a) {
|
|
392
392
|
if (_(e) && !t.required)
|
|
393
393
|
return i();
|
|
394
394
|
v.required(t, e, s, o, r), e !== void 0 && v.type(t, e, s, o, r);
|
|
395
395
|
}
|
|
396
396
|
i(o);
|
|
397
397
|
}, $e = "enum", qe = function(t, e, i, s, r) {
|
|
398
|
-
var o = [],
|
|
399
|
-
if (
|
|
398
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
399
|
+
if (a) {
|
|
400
400
|
if (_(e) && !t.required)
|
|
401
401
|
return i();
|
|
402
402
|
v.required(t, e, s, o, r), e !== void 0 && v[$e](t, e, s, o, r);
|
|
403
403
|
}
|
|
404
404
|
i(o);
|
|
405
405
|
}, Ge = function(t, e, i, s, r) {
|
|
406
|
-
var o = [],
|
|
407
|
-
if (
|
|
406
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
407
|
+
if (a) {
|
|
408
408
|
if (_(e, "string") && !t.required)
|
|
409
409
|
return i();
|
|
410
410
|
v.required(t, e, s, o, r), _(e, "string") || v.pattern(t, e, s, o, r);
|
|
411
411
|
}
|
|
412
412
|
i(o);
|
|
413
413
|
}, je = function(t, e, i, s, r) {
|
|
414
|
-
var o = [],
|
|
415
|
-
if (
|
|
414
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
415
|
+
if (a) {
|
|
416
416
|
if (_(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
418
|
if (v.required(t, e, s, o, r), !_(e, "date")) {
|
|
419
|
-
var
|
|
420
|
-
e instanceof Date ?
|
|
419
|
+
var h;
|
|
420
|
+
e instanceof Date ? h = e : h = new Date(e), v.type(t, h, s, o, r), h && v.range(t, h.getTime(), s, o, r);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
i(o);
|
|
424
424
|
}, Ue = function(t, e, i, s, r) {
|
|
425
|
-
var o = [],
|
|
426
|
-
v.required(t, e, s, o, r,
|
|
425
|
+
var o = [], a = Array.isArray(e) ? "array" : typeof e;
|
|
426
|
+
v.required(t, e, s, o, r, a), i(o);
|
|
427
427
|
}, yt = function(t, e, i, s, r) {
|
|
428
|
-
var o = t.type,
|
|
429
|
-
if (
|
|
428
|
+
var o = t.type, a = [], h = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (h) {
|
|
430
430
|
if (_(e, o) && !t.required)
|
|
431
431
|
return i();
|
|
432
|
-
v.required(t, e, s,
|
|
432
|
+
v.required(t, e, s, a, r, o), _(e, o) || v.type(t, e, s, a, r);
|
|
433
433
|
}
|
|
434
|
-
i(
|
|
434
|
+
i(a);
|
|
435
435
|
}, Ze = function(t, e, i, s, r) {
|
|
436
|
-
var o = [],
|
|
437
|
-
if (
|
|
436
|
+
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
437
|
+
if (a) {
|
|
438
438
|
if (_(e) && !t.required)
|
|
439
439
|
return i();
|
|
440
440
|
v.required(t, e, s, o, r);
|
|
@@ -513,10 +513,10 @@ function vt() {
|
|
|
513
513
|
};
|
|
514
514
|
}
|
|
515
515
|
var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
516
|
-
function
|
|
516
|
+
function n(e) {
|
|
517
517
|
this.rules = null, this._messages = Rt, this.define(e);
|
|
518
518
|
}
|
|
519
|
-
var t =
|
|
519
|
+
var t = n.prototype;
|
|
520
520
|
return t.define = function(i) {
|
|
521
521
|
var s = this;
|
|
522
522
|
if (!i)
|
|
@@ -528,51 +528,51 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
528
528
|
s.rules[r] = Array.isArray(o) ? o : [o];
|
|
529
529
|
});
|
|
530
530
|
}, t.messages = function(i) {
|
|
531
|
-
return i && (this._messages =
|
|
531
|
+
return i && (this._messages = Nt(vt(), i)), this._messages;
|
|
532
532
|
}, t.validate = function(i, s, r) {
|
|
533
533
|
var o = this;
|
|
534
534
|
s === void 0 && (s = {}), r === void 0 && (r = function() {
|
|
535
535
|
});
|
|
536
|
-
var
|
|
537
|
-
if (typeof
|
|
538
|
-
return
|
|
539
|
-
function f(
|
|
540
|
-
var
|
|
541
|
-
function
|
|
536
|
+
var a = i, h = s, l = r;
|
|
537
|
+
if (typeof h == "function" && (l = h, h = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
|
+
return l && l(null, a), Promise.resolve(a);
|
|
539
|
+
function f(w) {
|
|
540
|
+
var p = [], y = {};
|
|
541
|
+
function b(E) {
|
|
542
542
|
if (Array.isArray(E)) {
|
|
543
|
-
var
|
|
544
|
-
|
|
543
|
+
var C;
|
|
544
|
+
p = (C = p).concat.apply(C, E);
|
|
545
545
|
} else
|
|
546
|
-
|
|
546
|
+
p.push(E);
|
|
547
547
|
}
|
|
548
|
-
for (var m = 0; m <
|
|
549
|
-
|
|
550
|
-
|
|
548
|
+
for (var m = 0; m < w.length; m++)
|
|
549
|
+
b(w[m]);
|
|
550
|
+
p.length ? (y = Ct(p), l(p, y)) : l(null, a);
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
552
|
+
if (h.messages) {
|
|
553
553
|
var d = this.messages();
|
|
554
|
-
d === Rt && (d = vt()),
|
|
554
|
+
d === Rt && (d = vt()), Nt(d, h.messages), h.messages = d;
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
var x = {}, u =
|
|
558
|
-
u.forEach(function(
|
|
559
|
-
var
|
|
560
|
-
|
|
561
|
-
var m =
|
|
562
|
-
typeof m.transform == "function" && (
|
|
556
|
+
h.messages = this.messages();
|
|
557
|
+
var x = {}, u = h.keys || Object.keys(this.rules);
|
|
558
|
+
u.forEach(function(w) {
|
|
559
|
+
var p = o.rules[w], y = a[w];
|
|
560
|
+
p.forEach(function(b) {
|
|
561
|
+
var m = b;
|
|
562
|
+
typeof m.transform == "function" && (a === i && (a = $({}, a)), y = a[w] = m.transform(y)), typeof m == "function" ? m = {
|
|
563
563
|
validator: m
|
|
564
|
-
} : m = $({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field =
|
|
564
|
+
} : m = $({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field = w, m.fullField = m.fullField || w, m.type = o.getType(m), x[w] = x[w] || [], x[w].push({
|
|
565
565
|
rule: m,
|
|
566
566
|
value: y,
|
|
567
|
-
source:
|
|
568
|
-
field:
|
|
567
|
+
source: a,
|
|
568
|
+
field: w
|
|
569
569
|
}));
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
|
-
var
|
|
573
|
-
return
|
|
574
|
-
var y =
|
|
575
|
-
|
|
572
|
+
var g = {};
|
|
573
|
+
return Te(x, h, function(w, p) {
|
|
574
|
+
var y = w.rule, b = (y.type === "object" || y.type === "array") && (typeof y.fields == "object" || typeof y.defaultField == "object");
|
|
575
|
+
b = b && (y.required || !y.required && w.value), y.field = w.field;
|
|
576
576
|
function m(R, T) {
|
|
577
577
|
return $({}, T, {
|
|
578
578
|
fullField: y.fullField + "." + R,
|
|
@@ -582,52 +582,52 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
582
582
|
function E(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
584
|
var T = Array.isArray(R) ? R : [R];
|
|
585
|
-
!
|
|
586
|
-
var A = T.map(
|
|
587
|
-
if (
|
|
588
|
-
return
|
|
589
|
-
if (!
|
|
590
|
-
|
|
585
|
+
!h.suppressWarning && T.length && n.warning("async-validator:", T), T.length && y.message !== void 0 && (T = [].concat(y.message));
|
|
586
|
+
var A = T.map(kt(y, a));
|
|
587
|
+
if (h.first && A.length)
|
|
588
|
+
return g[y.field] = 1, p(A);
|
|
589
|
+
if (!b)
|
|
590
|
+
p(A);
|
|
591
591
|
else {
|
|
592
|
-
if (y.required && !
|
|
593
|
-
return y.message !== void 0 ? A = [].concat(y.message).map(
|
|
592
|
+
if (y.required && !w.value)
|
|
593
|
+
return y.message !== void 0 ? A = [].concat(y.message).map(kt(y, a)) : h.error && (A = [h.error(y, M(h.messages.required, y.field))]), p(A);
|
|
594
594
|
var L = {};
|
|
595
|
-
y.defaultField && Object.keys(
|
|
595
|
+
y.defaultField && Object.keys(w.value).map(function(I) {
|
|
596
596
|
L[I] = y.defaultField;
|
|
597
|
-
}), L = $({}, L,
|
|
597
|
+
}), L = $({}, L, w.rule.fields);
|
|
598
598
|
var D = {};
|
|
599
599
|
Object.keys(L).forEach(function(I) {
|
|
600
600
|
var S = L[I], O = Array.isArray(S) ? S : [S];
|
|
601
601
|
D[I] = O.map(m.bind(null, I));
|
|
602
602
|
});
|
|
603
|
-
var B = new
|
|
604
|
-
B.messages(
|
|
603
|
+
var B = new n(D);
|
|
604
|
+
B.messages(h.messages), w.rule.options && (w.rule.options.messages = h.messages, w.rule.options.error = h.error), B.validate(w.value, w.rule.options || h, function(I) {
|
|
605
605
|
var S = [];
|
|
606
|
-
A && A.length && S.push.apply(S, A), I && I.length && S.push.apply(S, I),
|
|
606
|
+
A && A.length && S.push.apply(S, A), I && I.length && S.push.apply(S, I), p(S.length ? S : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
var
|
|
610
|
+
var C;
|
|
611
611
|
if (y.asyncValidator)
|
|
612
|
-
|
|
612
|
+
C = y.asyncValidator(y, w.value, E, w.source, h);
|
|
613
613
|
else if (y.validator) {
|
|
614
614
|
try {
|
|
615
|
-
|
|
615
|
+
C = y.validator(y, w.value, E, w.source, h);
|
|
616
616
|
} catch (R) {
|
|
617
|
-
console.error == null || console.error(R),
|
|
617
|
+
console.error == null || console.error(R), h.suppressValidatorError || setTimeout(function() {
|
|
618
618
|
throw R;
|
|
619
619
|
}, 0), E(R.message);
|
|
620
620
|
}
|
|
621
|
-
|
|
621
|
+
C === !0 ? E() : C === !1 ? E(typeof y.message == "function" ? y.message(y.fullField || y.field) : y.message || (y.fullField || y.field) + " fails") : C instanceof Array ? E(C) : C instanceof Error && E(C.message);
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
C && C.then && C.then(function() {
|
|
624
624
|
return E();
|
|
625
625
|
}, function(R) {
|
|
626
626
|
return E(R);
|
|
627
627
|
});
|
|
628
|
-
}, function(
|
|
629
|
-
f(
|
|
630
|
-
},
|
|
628
|
+
}, function(w) {
|
|
629
|
+
f(w);
|
|
630
|
+
}, a);
|
|
631
631
|
}, t.getType = function(i) {
|
|
632
632
|
if (i.type === void 0 && i.pattern instanceof RegExp && (i.type = "pattern"), typeof i.validator != "function" && i.type && !it.hasOwnProperty(i.type))
|
|
633
633
|
throw new Error(M("Unknown rule type %s", i.type));
|
|
@@ -637,37 +637,37 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
637
637
|
return i.validator;
|
|
638
638
|
var s = Object.keys(i), r = s.indexOf("message");
|
|
639
639
|
return r !== -1 && s.splice(r, 1), s.length === 1 && s[0] === "required" ? it.required : it[this.getType(i)] || void 0;
|
|
640
|
-
},
|
|
640
|
+
}, n;
|
|
641
641
|
}();
|
|
642
642
|
nt.register = function(t, e) {
|
|
643
643
|
if (typeof e != "function")
|
|
644
644
|
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
645
645
|
it[t] = e;
|
|
646
646
|
};
|
|
647
|
-
nt.warning =
|
|
647
|
+
nt.warning = Gt;
|
|
648
648
|
nt.messages = Rt;
|
|
649
649
|
nt.validators = it;
|
|
650
|
-
function
|
|
651
|
-
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(
|
|
650
|
+
function Ut() {
|
|
651
|
+
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(n) {
|
|
652
652
|
const t = Math.random() * 16 | 0;
|
|
653
|
-
return (
|
|
653
|
+
return (n === "x" ? t : t & 3 | 8).toString(16);
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
|
-
function Zt(
|
|
656
|
+
function Zt(n, t) {
|
|
657
657
|
let e = 0, i;
|
|
658
658
|
return function(...s) {
|
|
659
659
|
const r = (/* @__PURE__ */ new Date()).getTime(), o = r - e;
|
|
660
|
-
!e || o >= t ? (
|
|
661
|
-
|
|
660
|
+
!e || o >= t ? (n.apply(this, s), e = r) : i || (i = setTimeout(() => {
|
|
661
|
+
n.apply(this, s), e = (/* @__PURE__ */ new Date()).getTime(), i = void 0;
|
|
662
662
|
}, t - o));
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
|
-
function Jt(
|
|
666
|
-
return
|
|
665
|
+
function Jt(n) {
|
|
666
|
+
return n ? n.map((t) => Jt(t.children) + 1).sort((t, e) => e - t)[0] : 0;
|
|
667
667
|
}
|
|
668
|
-
function Je(
|
|
668
|
+
function Je(n = []) {
|
|
669
669
|
let t = [], e = [], i = [];
|
|
670
|
-
return
|
|
670
|
+
return n.forEach((s) => {
|
|
671
671
|
s.fixed === "left" ? t.push(s) : s.fixed === "right" ? i.push(s) : e.push(s);
|
|
672
672
|
}), [
|
|
673
673
|
...t.sort((s, r) => s.sort - r.sort),
|
|
@@ -675,16 +675,16 @@ function Je(a = []) {
|
|
|
675
675
|
...i.sort((s, r) => s.sort - r.sort)
|
|
676
676
|
];
|
|
677
677
|
}
|
|
678
|
-
function Qt(
|
|
679
|
-
return
|
|
678
|
+
function Qt(n = [], t = 1, e = 0) {
|
|
679
|
+
return n.map((i) => {
|
|
680
680
|
if (i.children) {
|
|
681
681
|
let s = 0, r = i.fixed;
|
|
682
|
-
i.children.forEach((
|
|
683
|
-
|
|
682
|
+
i.children.forEach((a) => {
|
|
683
|
+
a.fixed = r;
|
|
684
684
|
});
|
|
685
685
|
const o = Qt(i.children, t - 1, e + 1);
|
|
686
|
-
return o && o.forEach((
|
|
687
|
-
s +=
|
|
686
|
+
return o && o.forEach((a) => {
|
|
687
|
+
s += a.colspan;
|
|
688
688
|
}), {
|
|
689
689
|
...i,
|
|
690
690
|
width: i.width,
|
|
@@ -702,45 +702,45 @@ function Qt(a = [], t = 1, e = 0) {
|
|
|
702
702
|
};
|
|
703
703
|
});
|
|
704
704
|
}
|
|
705
|
-
function _t(
|
|
705
|
+
function _t(n = []) {
|
|
706
706
|
let t = [];
|
|
707
|
-
return
|
|
707
|
+
return n.forEach((e) => {
|
|
708
708
|
e.children ? t = t.concat(_t(e.children)) : t.push(e);
|
|
709
709
|
}), t;
|
|
710
710
|
}
|
|
711
|
-
const
|
|
712
|
-
function ti(
|
|
711
|
+
const Kt = /^(\r\n|\n\r|\r|\n)/, Qe = /^[^\t\r\n]+/, Bt = /^\t/;
|
|
712
|
+
function ti(n) {
|
|
713
713
|
let t = [[""]];
|
|
714
|
-
if (
|
|
714
|
+
if (n.length === 0)
|
|
715
715
|
return t;
|
|
716
716
|
let e = 0, i = 0, s;
|
|
717
|
-
for (;
|
|
718
|
-
if (s =
|
|
719
|
-
|
|
720
|
-
else if (
|
|
721
|
-
|
|
717
|
+
for (; n.length > 0 && s !== n.length; )
|
|
718
|
+
if (s = n.length, n.match(Bt))
|
|
719
|
+
n = n.replace(Bt, ""), e += 1, t[i][e] = "";
|
|
720
|
+
else if (n.match(Kt))
|
|
721
|
+
n = n.replace(Kt, ""), e = 0, i += 1, t[i] = [""];
|
|
722
722
|
else {
|
|
723
723
|
let r = "";
|
|
724
|
-
if (
|
|
725
|
-
let o = 0,
|
|
726
|
-
for (;
|
|
727
|
-
const
|
|
728
|
-
|
|
724
|
+
if (n.startsWith('"')) {
|
|
725
|
+
let o = 0, a = !0;
|
|
726
|
+
for (; a; ) {
|
|
727
|
+
const h = n.slice(0, 1);
|
|
728
|
+
h === '"' && (o += 1), r += h, n = n.slice(1), (n.length === 0 || n.match(/^[\t\r\n]/) && o % 2 === 0) && (a = !1);
|
|
729
729
|
}
|
|
730
|
-
r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (
|
|
730
|
+
r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (h) => new Array(Math.floor(h.length / 2)).fill('"').join(""));
|
|
731
731
|
} else {
|
|
732
|
-
const o =
|
|
733
|
-
r = o ? o[0] : "",
|
|
732
|
+
const o = n.match(Qe);
|
|
733
|
+
r = o ? o[0] : "", n = n.slice(r.length);
|
|
734
734
|
}
|
|
735
735
|
t[i][e] = r;
|
|
736
736
|
}
|
|
737
737
|
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;
|
|
738
738
|
}
|
|
739
|
-
function ei(
|
|
739
|
+
function ei(n) {
|
|
740
740
|
let t, e, i, s, r = "", o;
|
|
741
|
-
for (t = 0, e =
|
|
742
|
-
for (s =
|
|
743
|
-
i > 0 && (r += " "), o =
|
|
741
|
+
for (t = 0, e = n.length; t < e; t += 1) {
|
|
742
|
+
for (s = n[t].length, i = 0; i < s; i += 1)
|
|
743
|
+
i > 0 && (r += " "), o = n[t][i], typeof o == "string" ? o.indexOf(`
|
|
744
744
|
`) > -1 ? r += `"${o.replace(/"/g, '""')}"` : r += o : o == null ? r += "" : r += o;
|
|
745
745
|
t !== e - 1 && (r += `
|
|
746
746
|
`);
|
|
@@ -790,27 +790,27 @@ class ii {
|
|
|
790
790
|
t.forEach((i, s) => {
|
|
791
791
|
let r = !1;
|
|
792
792
|
Array.isArray(i.children) && (r = !0, this.initData(i.children, e + 1));
|
|
793
|
-
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL:
|
|
793
|
+
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT: h, SELECTABLE_METHOD: l, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d ?? Ut();
|
|
794
794
|
this.itemRowKeyMap.set(i, x);
|
|
795
|
-
const u = i._height ||
|
|
796
|
-
let
|
|
797
|
-
if (typeof
|
|
798
|
-
const
|
|
799
|
-
if (this.checkboxKeyMap.has(
|
|
800
|
-
const y = this.checkboxKeyMap.get(
|
|
801
|
-
y.push(x), this.checkboxKeyMap.set(
|
|
795
|
+
const u = i._height || h, g = i._readonly;
|
|
796
|
+
let w = !0;
|
|
797
|
+
if (typeof l == "function" && (w = l), f) {
|
|
798
|
+
const p = i[f];
|
|
799
|
+
if (this.checkboxKeyMap.has(p)) {
|
|
800
|
+
const y = this.checkboxKeyMap.get(p);
|
|
801
|
+
y.push(x), this.checkboxKeyMap.set(p, y);
|
|
802
802
|
} else
|
|
803
|
-
this.checkboxKeyMap.set(
|
|
803
|
+
this.checkboxKeyMap.set(p, [x]);
|
|
804
804
|
}
|
|
805
805
|
this.rowKeyMap.set(x, {
|
|
806
|
-
readonly:
|
|
806
|
+
readonly: g,
|
|
807
807
|
index: s,
|
|
808
808
|
rowIndex: s,
|
|
809
809
|
level: e,
|
|
810
810
|
height: u,
|
|
811
811
|
check: !1,
|
|
812
|
-
selectable:
|
|
813
|
-
expand:
|
|
812
|
+
selectable: w,
|
|
813
|
+
expand: a,
|
|
814
814
|
expandLazy: !1,
|
|
815
815
|
hasChildren: r,
|
|
816
816
|
expandLoading: !1,
|
|
@@ -874,12 +874,12 @@ class ii {
|
|
|
874
874
|
const i = (r) => {
|
|
875
875
|
r.forEach((o) => {
|
|
876
876
|
t.push(o);
|
|
877
|
-
const
|
|
878
|
-
this.sumHeight += f, this.rowIndexRowKeyMap.set(e,
|
|
877
|
+
const a = this.itemRowKeyMap.get(o), { expand: h, hasChildren: l, height: f } = this.rowKeyMap.get(a), d = this.sumHeight;
|
|
878
|
+
this.sumHeight += f, this.rowIndexRowKeyMap.set(e, a), this.positions.push({
|
|
879
879
|
top: d,
|
|
880
880
|
height: f,
|
|
881
881
|
bottom: this.sumHeight
|
|
882
|
-
}), e += 1,
|
|
882
|
+
}), e += 1, h && l && i(o.children);
|
|
883
883
|
});
|
|
884
884
|
};
|
|
885
885
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -1001,27 +1001,27 @@ class ii {
|
|
|
1001
1001
|
batchSetItemValue(t, e = !1) {
|
|
1002
1002
|
let i = [];
|
|
1003
1003
|
const s = /* @__PURE__ */ new Set();
|
|
1004
|
-
t.forEach((
|
|
1005
|
-
const { value:
|
|
1006
|
-
s.add(
|
|
1007
|
-
rowKey:
|
|
1004
|
+
t.forEach((a) => {
|
|
1005
|
+
const { value: h, rowKey: l, key: f } = a, { oldValue: d, newValue: x } = this.setItemValue(l, f, h);
|
|
1006
|
+
s.add(l), i.push({
|
|
1007
|
+
rowKey: l,
|
|
1008
1008
|
key: f,
|
|
1009
1009
|
oldValue: d,
|
|
1010
1010
|
newValue: x
|
|
1011
1011
|
});
|
|
1012
1012
|
});
|
|
1013
1013
|
let r = [];
|
|
1014
|
-
const o = i.map((
|
|
1015
|
-
const
|
|
1014
|
+
const o = i.map((a) => {
|
|
1015
|
+
const h = this.ctx.database.getRowDataItemForRowKey(a.rowKey);
|
|
1016
1016
|
return {
|
|
1017
|
-
rowKey:
|
|
1018
|
-
key:
|
|
1019
|
-
value:
|
|
1020
|
-
row:
|
|
1017
|
+
rowKey: a.rowKey,
|
|
1018
|
+
key: a.key,
|
|
1019
|
+
value: a.newValue,
|
|
1020
|
+
row: h
|
|
1021
1021
|
};
|
|
1022
1022
|
});
|
|
1023
|
-
return s.forEach((
|
|
1024
|
-
r.push(this.ctx.database.getRowDataItemForRowKey(
|
|
1023
|
+
return s.forEach((a) => {
|
|
1024
|
+
r.push(this.ctx.database.getRowDataItemForRowKey(a));
|
|
1025
1025
|
}), this.ctx.emit("change", o, r), e && this.ctx.history.pushState({
|
|
1026
1026
|
changeList: i,
|
|
1027
1027
|
scrollX: this.ctx.scrollX,
|
|
@@ -1042,16 +1042,16 @@ class ii {
|
|
|
1042
1042
|
setItemValue(t, e, i, s = !1, r = !1, o = !1) {
|
|
1043
1043
|
if (!this.rowKeyMap.has(t))
|
|
1044
1044
|
return {};
|
|
1045
|
-
const { item:
|
|
1046
|
-
let
|
|
1045
|
+
const { item: a } = this.rowKeyMap.get(t);
|
|
1046
|
+
let h = a[e];
|
|
1047
1047
|
if (this.ctx.database.getReadonly(t, e))
|
|
1048
1048
|
return {
|
|
1049
|
-
oldValue:
|
|
1050
|
-
newValue:
|
|
1049
|
+
oldValue: h,
|
|
1050
|
+
newValue: h
|
|
1051
1051
|
};
|
|
1052
|
-
|
|
1053
|
-
const
|
|
1054
|
-
if (this.originalDataMap.has(
|
|
1052
|
+
a[e] !== null && typeof a[e] == "object" && (h = JSON.parse(JSON.stringify(a[e])));
|
|
1053
|
+
const l = `${t}_${e}`;
|
|
1054
|
+
if (this.originalDataMap.has(l) || this.originalDataMap.set(l, h), this.changedDataMap.set(l, i), a[e] = i, o) {
|
|
1055
1055
|
const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
|
|
1056
1056
|
rowKey: t,
|
|
1057
1057
|
key: e,
|
|
@@ -1061,18 +1061,18 @@ class ii {
|
|
|
1061
1061
|
this.ctx.emit("change", [d], [f]), this.ctx.emit("editChange", {
|
|
1062
1062
|
rowKey: t,
|
|
1063
1063
|
key: e,
|
|
1064
|
-
oldValue:
|
|
1064
|
+
oldValue: h,
|
|
1065
1065
|
value: i,
|
|
1066
|
-
originalValue: this.originalDataMap.get(
|
|
1066
|
+
originalValue: this.originalDataMap.get(l),
|
|
1067
1067
|
row: f
|
|
1068
1068
|
});
|
|
1069
1069
|
}
|
|
1070
1070
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1071
1071
|
rowKey: t,
|
|
1072
1072
|
key: e,
|
|
1073
|
-
oldValue:
|
|
1073
|
+
oldValue: h,
|
|
1074
1074
|
value: i,
|
|
1075
|
-
originalValue: this.originalDataMap.get(
|
|
1075
|
+
originalValue: this.originalDataMap.get(l),
|
|
1076
1076
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
1077
1077
|
}), s && this.ctx.history.pushState({
|
|
1078
1078
|
type: "single",
|
|
@@ -1082,12 +1082,12 @@ class ii {
|
|
|
1082
1082
|
{
|
|
1083
1083
|
rowKey: t,
|
|
1084
1084
|
key: e,
|
|
1085
|
-
oldValue:
|
|
1085
|
+
oldValue: h,
|
|
1086
1086
|
newValue: i
|
|
1087
1087
|
}
|
|
1088
1088
|
]
|
|
1089
1089
|
}), r && this.ctx.emit("draw"), {
|
|
1090
|
-
oldValue:
|
|
1090
|
+
oldValue: h,
|
|
1091
1091
|
newValue: i
|
|
1092
1092
|
};
|
|
1093
1093
|
}
|
|
@@ -1113,9 +1113,9 @@ class ii {
|
|
|
1113
1113
|
if (!this.rowKeyMap.has(t))
|
|
1114
1114
|
return !1;
|
|
1115
1115
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1116
|
-
this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1116
|
+
this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((a) => {
|
|
1117
|
+
const h = this.rowKeyMap.get(a);
|
|
1118
|
+
h.check = e;
|
|
1119
1119
|
});
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
@@ -1202,11 +1202,11 @@ class ii {
|
|
|
1202
1202
|
let t = 0, e = 0;
|
|
1203
1203
|
this.rowKeyMap.forEach((o) => {
|
|
1204
1204
|
o.check && (t += 1);
|
|
1205
|
-
const
|
|
1206
|
-
typeof
|
|
1205
|
+
const a = o.selectable;
|
|
1206
|
+
typeof a == "function" ? a({
|
|
1207
1207
|
row: o.item,
|
|
1208
1208
|
rowIndex: o.rowIndex
|
|
1209
|
-
}) && (e += 1) :
|
|
1209
|
+
}) && (e += 1) : a && (e += 1);
|
|
1210
1210
|
});
|
|
1211
1211
|
const i = e && e > t && t > 0;
|
|
1212
1212
|
return {
|
|
@@ -1275,17 +1275,17 @@ class ii {
|
|
|
1275
1275
|
return t ? (this.headerMap.set(t, e), !0) : !1;
|
|
1276
1276
|
}
|
|
1277
1277
|
getReadonly(t, e) {
|
|
1278
|
-
const i = this.rowKeyMap.get(t), s = this.headerMap.get(e), r = i == null ? void 0 : i.readonly, o = s == null ? void 0 : s.readonly, { CELL_READONLY_METHOD:
|
|
1279
|
-
if (typeof
|
|
1280
|
-
const
|
|
1278
|
+
const i = this.rowKeyMap.get(t), s = this.headerMap.get(e), r = i == null ? void 0 : i.readonly, o = s == null ? void 0 : s.readonly, { CELL_READONLY_METHOD: a } = this.ctx.config;
|
|
1279
|
+
if (typeof a == "function") {
|
|
1280
|
+
const l = a({
|
|
1281
1281
|
row: i.item,
|
|
1282
1282
|
rowIndex: i.rowIndex,
|
|
1283
1283
|
colIndex: s.colIndex,
|
|
1284
1284
|
column: s.column,
|
|
1285
1285
|
value: this.getItemValue(t, e)
|
|
1286
1286
|
});
|
|
1287
|
-
if (
|
|
1288
|
-
return
|
|
1287
|
+
if (l !== void 0)
|
|
1288
|
+
return l;
|
|
1289
1289
|
}
|
|
1290
1290
|
return o || r;
|
|
1291
1291
|
}
|
|
@@ -1294,43 +1294,43 @@ class ii {
|
|
|
1294
1294
|
}
|
|
1295
1295
|
getValidator(t, e) {
|
|
1296
1296
|
return new Promise((i) => {
|
|
1297
|
-
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { CELL_RULES_METHOD: o } = this.ctx.config,
|
|
1298
|
-
let
|
|
1297
|
+
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { CELL_RULES_METHOD: o } = this.ctx.config, a = r.column;
|
|
1298
|
+
let h = a.rules;
|
|
1299
1299
|
if (typeof o == "function") {
|
|
1300
1300
|
const f = o({
|
|
1301
1301
|
row: s.item,
|
|
1302
1302
|
rowIndex: s.rowIndex,
|
|
1303
1303
|
colIndex: r.colIndex,
|
|
1304
|
-
column:
|
|
1304
|
+
column: a,
|
|
1305
1305
|
value: this.getItemValue(t, e)
|
|
1306
1306
|
});
|
|
1307
|
-
f && (
|
|
1307
|
+
f && (h = f);
|
|
1308
1308
|
}
|
|
1309
|
-
if (
|
|
1310
|
-
let
|
|
1311
|
-
if (f[e] = this.getItemValue(t, e), Array.isArray(
|
|
1312
|
-
const x =
|
|
1309
|
+
if (h) {
|
|
1310
|
+
let l = {}, f = {};
|
|
1311
|
+
if (f[e] = this.getItemValue(t, e), Array.isArray(h) && h.length) {
|
|
1312
|
+
const x = h.map((u) => ({
|
|
1313
1313
|
...u,
|
|
1314
1314
|
row: s.item,
|
|
1315
|
-
column:
|
|
1315
|
+
column: a,
|
|
1316
1316
|
rowIndex: s.rowIndex,
|
|
1317
1317
|
colIndex: r.colIndex
|
|
1318
1318
|
}));
|
|
1319
|
-
|
|
1319
|
+
l[e] = x;
|
|
1320
1320
|
} else
|
|
1321
|
-
|
|
1322
|
-
...
|
|
1321
|
+
l[e] = {
|
|
1322
|
+
...h,
|
|
1323
1323
|
row: s.item,
|
|
1324
|
-
column:
|
|
1324
|
+
column: a,
|
|
1325
1325
|
rowIndex: s.rowIndex,
|
|
1326
1326
|
colIndex: r.colIndex
|
|
1327
1327
|
};
|
|
1328
|
-
new nt(
|
|
1328
|
+
new nt(l).validate(f).then(() => {
|
|
1329
1329
|
this.setValidationError(t, e, []), i([]);
|
|
1330
1330
|
}).catch(({ errors: x }) => {
|
|
1331
|
-
const u = x.map((
|
|
1332
|
-
...
|
|
1333
|
-
column:
|
|
1331
|
+
const u = x.map((g) => ({
|
|
1332
|
+
...g,
|
|
1333
|
+
column: a,
|
|
1334
1334
|
key: e,
|
|
1335
1335
|
row: s.item,
|
|
1336
1336
|
rowKey: t
|
|
@@ -1436,7 +1436,7 @@ class ri {
|
|
|
1436
1436
|
this.ctx = t, this.init();
|
|
1437
1437
|
}
|
|
1438
1438
|
init() {
|
|
1439
|
-
this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "
|
|
1439
|
+
this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "mouseup", this.handleMouseUp.bind(this)), this.bind(window, "mousemove", this.handleMousemove.bind(this)), this.bind(this.ctx.stageElement, "click", this.handleClick.bind(this)), this.bind(window, "keydown", this.handleKeydown.bind(this)), this.bind(this.ctx.stageElement, "wheel", this.handleWheel.bind(this)), this.bind(this.ctx.stageElement, "contextmenu", this.handleContextMenu.bind(this)), this.bind(this.ctx.stageElement, "mousedown", this.handleMouseDown.bind(this)), this.bind(this.ctx.stageElement, "mouseenter", this.handleMouseEnter.bind(this)), this.bind(this.ctx.stageElement, "mouseleave", this.handleMouseLeave.bind(this)), this.bind(this.ctx.stageElement, "dblclick", this.handleDblclick.bind(this));
|
|
1440
1440
|
}
|
|
1441
1441
|
destroy() {
|
|
1442
1442
|
this.eventTasks.forEach((t, e) => {
|
|
@@ -1447,10 +1447,10 @@ class ri {
|
|
|
1447
1447
|
this.ctx.emit("resetHeader", t), this.ctx.emit("resize", t);
|
|
1448
1448
|
}
|
|
1449
1449
|
handleMouseDown(t) {
|
|
1450
|
-
t.button === 0 && (this.ctx.mousedown = !0), this.ctx.emit("mousedown", t);
|
|
1450
|
+
t.preventDefault(), t.button === 0 && (this.ctx.mousedown = !0), this.ctx.emit("mousedown", t);
|
|
1451
1451
|
}
|
|
1452
1452
|
handleMousemove(t) {
|
|
1453
|
-
this.ctx.emit("mousemove", t);
|
|
1453
|
+
t.preventDefault(), this.ctx.emit("mousemove", t);
|
|
1454
1454
|
}
|
|
1455
1455
|
handleMouseUp(t) {
|
|
1456
1456
|
t.button === 0 && (this.ctx.mousedown = !1), this.ctx.emit("mouseup", t);
|
|
@@ -1460,7 +1460,7 @@ class ri {
|
|
|
1460
1460
|
}
|
|
1461
1461
|
handleKeydown(t) {
|
|
1462
1462
|
const { ENABLE_KEYBOARD: e } = this.ctx.config;
|
|
1463
|
-
e && this.ctx.emit("keydown", t);
|
|
1463
|
+
e && this.ctx.isTarget() && this.ctx.emit("keydown", t);
|
|
1464
1464
|
}
|
|
1465
1465
|
handleWheel(t) {
|
|
1466
1466
|
this.ctx.emit("wheel", t);
|
|
@@ -1468,11 +1468,17 @@ class ri {
|
|
|
1468
1468
|
handleContextMenu(t) {
|
|
1469
1469
|
this.ctx.emit("contextMenu", t);
|
|
1470
1470
|
}
|
|
1471
|
-
|
|
1472
|
-
this.ctx.emit("
|
|
1471
|
+
handleMouseEnter(t) {
|
|
1472
|
+
this.ctx.isInsideTargetContainer = !0, this.ctx.emit("mouseenter", t);
|
|
1473
1473
|
}
|
|
1474
|
-
|
|
1475
|
-
|
|
1474
|
+
handleMouseLeave(t) {
|
|
1475
|
+
this.ctx.isInsideTargetContainer = !1, this.ctx.emit("mouseleave", t);
|
|
1476
|
+
}
|
|
1477
|
+
handleDblclick(t) {
|
|
1478
|
+
this.ctx.emit("dblclick", t);
|
|
1479
|
+
}
|
|
1480
|
+
bind(t, e, i, s) {
|
|
1481
|
+
t.addEventListener(e, i, s), this.eventTasks.set(e, i);
|
|
1476
1482
|
}
|
|
1477
1483
|
unbind(t, e, i) {
|
|
1478
1484
|
t.removeEventListener(e, i), this.eventTasks.delete(e);
|
|
@@ -1523,6 +1529,9 @@ class ni {
|
|
|
1523
1529
|
if (!e) throw new Error("canvas context not found");
|
|
1524
1530
|
this.ctx = e;
|
|
1525
1531
|
}
|
|
1532
|
+
scale(t) {
|
|
1533
|
+
this.ctx.scale(t, t);
|
|
1534
|
+
}
|
|
1526
1535
|
save() {
|
|
1527
1536
|
this.ctx.save();
|
|
1528
1537
|
}
|
|
@@ -1536,12 +1545,7 @@ class ni {
|
|
|
1536
1545
|
this.ctx.canvas.style.cursor = t;
|
|
1537
1546
|
}
|
|
1538
1547
|
clear(t = 0, e = 0, i, s) {
|
|
1539
|
-
this.ctx.clearRect(
|
|
1540
|
-
t,
|
|
1541
|
-
e,
|
|
1542
|
-
i || this.ctx.canvas.width,
|
|
1543
|
-
s || this.ctx.canvas.height
|
|
1544
|
-
);
|
|
1548
|
+
this.ctx.clearRect(t, e, i || this.ctx.canvas.width, s || this.ctx.canvas.height);
|
|
1545
1549
|
}
|
|
1546
1550
|
/**
|
|
1547
1551
|
* 在 Canvas 上绘制单侧阴影
|
|
@@ -1554,31 +1558,21 @@ class ni {
|
|
|
1554
1558
|
* @param {string} color - 阴影的颜色
|
|
1555
1559
|
*/
|
|
1556
1560
|
drawShadow(t, e, i, s, r) {
|
|
1557
|
-
const { fillColor: o, side:
|
|
1561
|
+
const { fillColor: o, side: a, shadowWidth: h, colorStart: l, colorEnd: f } = r;
|
|
1558
1562
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1559
1563
|
let d;
|
|
1560
|
-
switch (
|
|
1564
|
+
switch (a) {
|
|
1561
1565
|
case "left":
|
|
1562
|
-
d = this.ctx.createLinearGradient(t -
|
|
1566
|
+
d = this.ctx.createLinearGradient(t - h, e, t, e), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t - h, e, h, s);
|
|
1563
1567
|
break;
|
|
1564
1568
|
case "right":
|
|
1565
|
-
d = this.ctx.createLinearGradient(
|
|
1566
|
-
t + i,
|
|
1567
|
-
e,
|
|
1568
|
-
t + i + l,
|
|
1569
|
-
e
|
|
1570
|
-
), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, l, s);
|
|
1569
|
+
d = this.ctx.createLinearGradient(t + i, e, t + i + h, e), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, h, s);
|
|
1571
1570
|
break;
|
|
1572
1571
|
case "top":
|
|
1573
|
-
d = this.ctx.createLinearGradient(t, e -
|
|
1572
|
+
d = this.ctx.createLinearGradient(t, e - h, t, e), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e - h, i, h);
|
|
1574
1573
|
break;
|
|
1575
1574
|
case "bottom":
|
|
1576
|
-
d = this.ctx.createLinearGradient(
|
|
1577
|
-
t,
|
|
1578
|
-
e + s,
|
|
1579
|
-
t,
|
|
1580
|
-
e + s + l
|
|
1581
|
-
), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, l);
|
|
1575
|
+
d = this.ctx.createLinearGradient(t, e + s, t, e + s + h), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, h);
|
|
1582
1576
|
break;
|
|
1583
1577
|
default:
|
|
1584
1578
|
console.error("Invalid side specified for shadow");
|
|
@@ -1591,22 +1585,22 @@ class ni {
|
|
|
1591
1585
|
throw new Error("A valid array of points is required to draw a line");
|
|
1592
1586
|
this.ctx.save();
|
|
1593
1587
|
const { borderColor: i = "black", borderWidth: s = 1 } = e;
|
|
1594
|
-
this.ctx.beginPath(), this.ctx.moveTo(t[0]
|
|
1588
|
+
this.ctx.beginPath(), this.ctx.moveTo(t[0] - 0.5, t[1] - 0.5);
|
|
1595
1589
|
for (let r = 2; r < t.length; r += 2)
|
|
1596
|
-
this.ctx.lineTo(t[r]
|
|
1590
|
+
this.ctx.lineTo(t[r] - 0.5, t[r + 1] - 0.5);
|
|
1597
1591
|
this.ctx.strokeStyle = i, this.ctx.lineWidth = s, e.lineDash && (this.ctx.lineDashOffset = 4, this.ctx.setLineDash(e.lineDash)), e.fillColor && (this.ctx.fillStyle = e.fillColor, this.ctx.fill()), e.borderColor && (this.ctx.strokeStyle = e.borderColor), this.ctx.stroke(), this.ctx.closePath(), this.ctx.restore();
|
|
1598
1592
|
}
|
|
1599
1593
|
drawImage(t, e, i, s, r) {
|
|
1600
1594
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, r), this.ctx.restore();
|
|
1601
1595
|
}
|
|
1602
|
-
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor:
|
|
1603
|
-
if (this.ctx.save(), this.ctx.beginPath(),
|
|
1604
|
-
this.ctx.rect(t
|
|
1596
|
+
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius: h = 0 } = {}) {
|
|
1597
|
+
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o), h === 0)
|
|
1598
|
+
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
1605
1599
|
else {
|
|
1606
|
-
const [
|
|
1607
|
-
this.ctx.moveTo(t +
|
|
1600
|
+
const [l, f, d, x] = typeof h == "number" ? [h, h, h, h] : h;
|
|
1601
|
+
this.ctx.moveTo(t + l, e), this.ctx.arcTo(t + i, e, t + i, e + f, f), this.ctx.arcTo(t + i, e + s, t + i - d, e + s, d), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + l, e, l);
|
|
1608
1602
|
}
|
|
1609
|
-
|
|
1603
|
+
a !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1610
1604
|
}
|
|
1611
1605
|
/**
|
|
1612
1606
|
* 画文本
|
|
@@ -1621,44 +1615,44 @@ class ni {
|
|
|
1621
1615
|
drawText(t = "", e, i, s, r, o = {}) {
|
|
1622
1616
|
this.ctx.save();
|
|
1623
1617
|
const {
|
|
1624
|
-
font:
|
|
1625
|
-
align:
|
|
1626
|
-
color:
|
|
1618
|
+
font: a = "12px Arial",
|
|
1619
|
+
align: h = "center",
|
|
1620
|
+
color: l = "#495060",
|
|
1627
1621
|
padding: f = 0,
|
|
1628
1622
|
verticalAlign: d = "middle"
|
|
1629
1623
|
} = o;
|
|
1630
|
-
this.ctx.font =
|
|
1624
|
+
this.ctx.font = a, this.ctx.fillStyle = l, this.ctx.textBaseline = d, this.ctx.textAlign = h;
|
|
1631
1625
|
let x = 0;
|
|
1632
|
-
d === "top" ? x = i + f : d === "bottom" ? x = i + r - f : x = i + (r +
|
|
1626
|
+
d === "top" ? x = i + f : d === "bottom" ? x = i + r - f : x = i + (r + 1) / 2;
|
|
1633
1627
|
let u = 0;
|
|
1634
|
-
|
|
1635
|
-
const { _text:
|
|
1636
|
-
return this.ctx.fillText(
|
|
1628
|
+
h === "left" ? u = e + f : h === "right" ? u = e + s - f : u = e + s / 2;
|
|
1629
|
+
const { _text: g, ellipsis: w } = this.handleEllipsis(t, s, f, a);
|
|
1630
|
+
return this.ctx.fillText(g, u, x), this.ctx.restore(), w;
|
|
1637
1631
|
}
|
|
1638
|
-
handleEllipsis(t, e, i = 0) {
|
|
1639
|
-
let
|
|
1640
|
-
if (t == null || t === "")
|
|
1632
|
+
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
1633
|
+
let r = !1, o = t;
|
|
1634
|
+
if (this.ctx.font = s, t == null || t === "")
|
|
1641
1635
|
return {
|
|
1642
1636
|
_text: "",
|
|
1643
|
-
ellipsis:
|
|
1637
|
+
ellipsis: r
|
|
1644
1638
|
};
|
|
1645
|
-
const
|
|
1646
|
-
if (
|
|
1647
|
-
|
|
1639
|
+
const a = this.ctx.measureText("...").width, h = this.ctx.measureText(t).width;
|
|
1640
|
+
if (h && h + a >= e - i * 2) {
|
|
1641
|
+
r = !0;
|
|
1648
1642
|
let l = 0;
|
|
1649
|
-
for (let
|
|
1650
|
-
if (l += this.ctx.measureText(t[
|
|
1651
|
-
|
|
1643
|
+
for (let f = 0; f < t.length; f++)
|
|
1644
|
+
if (l += this.ctx.measureText(t[f]).width, l >= e - i * 2 - a) {
|
|
1645
|
+
o = t.slice(0, f) + "...";
|
|
1652
1646
|
break;
|
|
1653
1647
|
}
|
|
1654
1648
|
}
|
|
1655
1649
|
return {
|
|
1656
|
-
_text:
|
|
1657
|
-
ellipsis:
|
|
1650
|
+
_text: o,
|
|
1651
|
+
ellipsis: r
|
|
1658
1652
|
};
|
|
1659
1653
|
}
|
|
1660
1654
|
}
|
|
1661
|
-
class
|
|
1655
|
+
class Wt {
|
|
1662
1656
|
constructor(t) {
|
|
1663
1657
|
c(this, "PROCESSOR_NUM", 50);
|
|
1664
1658
|
c(this, "CSS_PREFIX", "e-virt-table");
|
|
@@ -1883,15 +1877,15 @@ class ai {
|
|
|
1883
1877
|
}
|
|
1884
1878
|
async createImageFromSVG(t, e) {
|
|
1885
1879
|
const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
1886
|
-
e && r.querySelectorAll("*").forEach((
|
|
1887
|
-
|
|
1880
|
+
e && r.querySelectorAll("*").forEach((l) => {
|
|
1881
|
+
l.setAttribute("fill", e);
|
|
1888
1882
|
});
|
|
1889
|
-
const o = new Image(),
|
|
1883
|
+
const o = new Image(), a = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1890
1884
|
type: "image/svg+xml"
|
|
1891
|
-
}),
|
|
1892
|
-
return o.src =
|
|
1885
|
+
}), h = URL.createObjectURL(a);
|
|
1886
|
+
return o.src = h, new Promise((l, f) => {
|
|
1893
1887
|
o.onerror = () => f(new Error("Failed to load image")), o.onload = () => {
|
|
1894
|
-
|
|
1888
|
+
l(o);
|
|
1895
1889
|
};
|
|
1896
1890
|
});
|
|
1897
1891
|
}
|
|
@@ -1900,7 +1894,7 @@ class ai {
|
|
|
1900
1894
|
}
|
|
1901
1895
|
}
|
|
1902
1896
|
class te {
|
|
1903
|
-
constructor(t, e, i, s, r, o,
|
|
1897
|
+
constructor(t, e, i, s, r, o, a) {
|
|
1904
1898
|
c(this, "ctx");
|
|
1905
1899
|
c(this, "x", 0);
|
|
1906
1900
|
c(this, "y", 0);
|
|
@@ -1908,20 +1902,29 @@ class te {
|
|
|
1908
1902
|
c(this, "height", 0);
|
|
1909
1903
|
c(this, "fixed");
|
|
1910
1904
|
c(this, "cellType");
|
|
1911
|
-
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = r, this.fixed = o, this.cellType =
|
|
1905
|
+
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = r, this.fixed = o, this.cellType = a;
|
|
1912
1906
|
}
|
|
1913
1907
|
isHorizontalVisible() {
|
|
1914
1908
|
if (this.fixed)
|
|
1915
1909
|
return !0;
|
|
1916
|
-
const {
|
|
1910
|
+
const { stageWidth: t, fixedLeftWidth: e, scrollX: i, fixedRightWidth: s } = this.ctx, r = t;
|
|
1917
1911
|
return !(this.x + this.width - e - i <= 0 || this.x - i >= r - s);
|
|
1918
1912
|
}
|
|
1919
1913
|
isVerticalVisible() {
|
|
1920
|
-
const {
|
|
1914
|
+
const { stageHeight: t, scrollY: e } = this.ctx, i = t;
|
|
1921
1915
|
return !(this.y + this.height - e <= 0 || this.y - e >= i);
|
|
1922
1916
|
}
|
|
1923
1917
|
getDrawX() {
|
|
1924
|
-
|
|
1918
|
+
if (this.fixed === "left")
|
|
1919
|
+
return this.x;
|
|
1920
|
+
if (this.fixed === "right") {
|
|
1921
|
+
const {
|
|
1922
|
+
stageWidth: t,
|
|
1923
|
+
config: { SCROLLER_TRACK_SIZE: e }
|
|
1924
|
+
} = this.ctx;
|
|
1925
|
+
return t - (this.ctx.header.width - this.x) - e + 1;
|
|
1926
|
+
}
|
|
1927
|
+
return this.x - this.ctx.scrollX;
|
|
1925
1928
|
}
|
|
1926
1929
|
getDrawY() {
|
|
1927
1930
|
return this.cellType === "header" ? this.y : this.cellType === "footer" && this.ctx.config.FOOTER_FIXED ? this.y : this.y - this.ctx.scrollY;
|
|
@@ -1937,8 +1940,8 @@ class te {
|
|
|
1937
1940
|
}
|
|
1938
1941
|
}
|
|
1939
1942
|
class ee extends te {
|
|
1940
|
-
constructor(e, i, s, r, o,
|
|
1941
|
-
super(e, r, o,
|
|
1943
|
+
constructor(e, i, s, r, o, a, h, l, f, d = "body") {
|
|
1944
|
+
super(e, r, o, a, h, l.fixed, d);
|
|
1942
1945
|
c(this, "formatter");
|
|
1943
1946
|
c(this, "hoverIconName", "");
|
|
1944
1947
|
c(this, "operation", !1);
|
|
@@ -1981,10 +1984,12 @@ class ee extends te {
|
|
|
1981
1984
|
c(this, "drawImageName", "");
|
|
1982
1985
|
c(this, "drawImageSource");
|
|
1983
1986
|
c(this, "ellipsis", !1);
|
|
1987
|
+
c(this, "rowExpand", !1);
|
|
1988
|
+
c(this, "rowHasChildren", !1);
|
|
1984
1989
|
c(this, "overflowTooltipShow", !0);
|
|
1985
1990
|
c(this, "overflowTooltipMaxWidth", 500);
|
|
1986
1991
|
c(this, "overflowTooltipPlacement", "top");
|
|
1987
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
1992
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = l.key, this.type = l.type || "text", this.editorType = l.editorType || "text", this.cellType = d, this.align = l.align || "center", this.verticalAlign = l.verticalAlign || "middle", this.fixed = l.fixed, this.level = l.level, this.operation = l.operation || !1, this.column = l, this.rules = l.rules, this.row = f, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = l.render, this.overflowTooltipShow = l.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = l.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = l.overflowTooltipPlacement || "top", this.renderFooter = l.renderFooter, this.hoverIconName = l.hoverIconName, this.formatter = l.formatter, this.update();
|
|
1988
1993
|
}
|
|
1989
1994
|
getValidationMessage() {
|
|
1990
1995
|
const e = this.ctx.database.getValidationError(this.rowKey, this.key);
|
|
@@ -2076,20 +2081,20 @@ class ee extends te {
|
|
|
2076
2081
|
}
|
|
2077
2082
|
updateTree() {
|
|
2078
2083
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2079
|
-
let r, o = 0,
|
|
2084
|
+
let r, o = 0, a = "";
|
|
2080
2085
|
if (this.type === "tree" && s === "body") {
|
|
2081
|
-
const
|
|
2082
|
-
if (d) {
|
|
2086
|
+
const h = this.ctx.database.getRowForRowKey(i), { expand: l = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = h || {};
|
|
2087
|
+
if (this.rowExpand = l, this.rowHasChildren = f, d) {
|
|
2083
2088
|
const u = this.ctx.icons.get("loading");
|
|
2084
|
-
|
|
2089
|
+
a = "loading", r = u, o = x * 8;
|
|
2085
2090
|
} else if (f) {
|
|
2086
|
-
const u = this.ctx.icons.get("expand"),
|
|
2087
|
-
r =
|
|
2091
|
+
const u = this.ctx.icons.get("expand"), g = this.ctx.icons.get("shrink");
|
|
2092
|
+
r = l ? g : u, a = l ? "shrink" : "expand", o = x * 8;
|
|
2088
2093
|
} else
|
|
2089
2094
|
o = x * 8;
|
|
2090
2095
|
if (r) {
|
|
2091
|
-
let u = 20,
|
|
2092
|
-
this.ctx.paint.drawImage(r,
|
|
2096
|
+
let u = 20, g = 20, w = this.drawX + o + e, p = this.drawY + (this.visibleHeight - g) / 2;
|
|
2097
|
+
this.ctx.paint.drawImage(r, w, p, u, g), this.drawImageX = w, this.drawImageY = p, this.drawImageWidth = u, this.drawImageHeight = g, this.drawImageName = a, this.drawImageSource = r, this.align = "left", this.drawTextX = o + this.drawX + u - 0.5;
|
|
2093
2098
|
}
|
|
2094
2099
|
}
|
|
2095
2100
|
}
|
|
@@ -2100,71 +2105,71 @@ class ee extends te {
|
|
|
2100
2105
|
BODY_CELL_STYLE_METHOD: s,
|
|
2101
2106
|
FOOTER_CELL_STYLE_METHOD: r,
|
|
2102
2107
|
READONLY_TEXT_COLOR: o,
|
|
2103
|
-
FOOTER_BG_COLOR:
|
|
2104
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2105
|
-
HIGHLIGHT_SELECTED_ROW_COLOR:
|
|
2108
|
+
FOOTER_BG_COLOR: a,
|
|
2109
|
+
HIGHLIGHT_SELECTED_ROW: h,
|
|
2110
|
+
HIGHLIGHT_SELECTED_ROW_COLOR: l,
|
|
2106
2111
|
HIGHLIGHT_HOVER_ROW: f,
|
|
2107
2112
|
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
2108
2113
|
} = this.ctx.config;
|
|
2109
2114
|
if (this.cellType === "footer") {
|
|
2110
|
-
let y =
|
|
2115
|
+
let y = a, b = o;
|
|
2111
2116
|
if (typeof r == "function") {
|
|
2112
|
-
const m = r, { backgroundColor: E, color:
|
|
2117
|
+
const m = r, { backgroundColor: E, color: C } = m({
|
|
2113
2118
|
row: this.row,
|
|
2114
2119
|
rowIndex: this.rowIndex,
|
|
2115
2120
|
colIndex: this.colIndex,
|
|
2116
2121
|
column: this.column,
|
|
2117
2122
|
value: this.getValue()
|
|
2118
2123
|
}) || {};
|
|
2119
|
-
E && (y = E),
|
|
2124
|
+
E && (y = E), C && (b = C);
|
|
2120
2125
|
}
|
|
2121
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = y, this.drawTextColor =
|
|
2126
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = y, this.drawTextColor = b;
|
|
2122
2127
|
return;
|
|
2123
2128
|
}
|
|
2124
2129
|
let x = "transparent";
|
|
2125
|
-
const u = this.ctx.focusCell,
|
|
2126
|
-
f && (
|
|
2127
|
-
let
|
|
2130
|
+
const u = this.ctx.focusCell, g = this.ctx.hoverCell;
|
|
2131
|
+
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d), h && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = l), this.drawCellSkyBgColor = x;
|
|
2132
|
+
let w = e, p = o;
|
|
2128
2133
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2129
2134
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
2130
2135
|
return;
|
|
2131
2136
|
}
|
|
2132
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (
|
|
2133
|
-
const y = s, { backgroundColor:
|
|
2137
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (w = i, p = o), typeof s == "function") {
|
|
2138
|
+
const y = s, { backgroundColor: b, color: m } = y({
|
|
2134
2139
|
row: this.row,
|
|
2135
2140
|
rowIndex: this.rowIndex,
|
|
2136
2141
|
colIndex: this.colIndex,
|
|
2137
2142
|
column: this.column,
|
|
2138
2143
|
value: this.getValue()
|
|
2139
2144
|
}) || {};
|
|
2140
|
-
|
|
2145
|
+
b && (w = b), m && (p = m);
|
|
2141
2146
|
}
|
|
2142
|
-
this.drawCellBgColor =
|
|
2147
|
+
this.drawCellBgColor = w, this.drawTextColor = p;
|
|
2143
2148
|
}
|
|
2144
2149
|
updateSelection() {
|
|
2145
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type:
|
|
2146
|
-
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(
|
|
2147
|
-
const f = this.ctx.database.getRowSelection(
|
|
2148
|
-
let
|
|
2149
|
-
f && d ? (
|
|
2150
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex: h, rowKey: l } = this;
|
|
2151
|
+
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(a)) {
|
|
2152
|
+
const f = this.ctx.database.getRowSelection(l), d = this.ctx.database.getRowSelectable(l), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, g = this.drawY + (i - x) / 2;
|
|
2153
|
+
let w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
2154
|
+
f && d ? (w = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : f && d ? (w = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !f && d ? (w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled"), w && a == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w) : w && a === "selection" && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w);
|
|
2150
2155
|
}
|
|
2151
2156
|
}
|
|
2152
2157
|
updateHoverIcon() {
|
|
2153
2158
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2154
2159
|
if (typeof e == "function") {
|
|
2155
|
-
const
|
|
2160
|
+
const h = e({
|
|
2156
2161
|
row: this.row,
|
|
2157
2162
|
rowIndex: this.rowIndex,
|
|
2158
2163
|
colIndex: this.colIndex,
|
|
2159
2164
|
column: this.column,
|
|
2160
2165
|
value: this.getValue()
|
|
2161
2166
|
});
|
|
2162
|
-
|
|
2167
|
+
h !== void 0 && (this.hoverIconName = h);
|
|
2163
2168
|
}
|
|
2164
2169
|
const r = this.drawX + this.width - i - s, o = this.drawY + (this.height - i) / 2;
|
|
2165
2170
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
2166
|
-
const
|
|
2167
|
-
this.drawImageX = r, this.drawImageY = o, this.drawImageWidth = i, this.drawImageHeight = i, this.drawImageName = this.hoverIconName, this.drawImageSource =
|
|
2171
|
+
const a = this.ctx.icons.get(this.hoverIconName);
|
|
2172
|
+
this.drawImageX = r, this.drawImageY = o, this.drawImageWidth = i, this.drawImageHeight = i, this.drawImageName = this.hoverIconName, this.drawImageSource = a;
|
|
2168
2173
|
}
|
|
2169
2174
|
}
|
|
2170
2175
|
/**
|
|
@@ -2206,14 +2211,13 @@ class ee extends te {
|
|
|
2206
2211
|
*/
|
|
2207
2212
|
getOverlayerViewsStyle() {
|
|
2208
2213
|
let e = `${this.drawX - this.ctx.fixedLeftWidth}px`, i = `${this.drawY - this.ctx.body.y}px`;
|
|
2209
|
-
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" && (e = `${this.drawX - (this.ctx.
|
|
2214
|
+
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" && (e = `${this.drawX - (this.ctx.stageWidth - this.ctx.fixedRightWidth)}px`), this.cellType === "footer" && this.ctx.config.FOOTER_FIXED && (i = `${this.drawY - this.ctx.footer.y}px`), {
|
|
2210
2215
|
position: "absolute",
|
|
2211
2216
|
overflow: "hidden",
|
|
2212
2217
|
left: e,
|
|
2213
2218
|
top: i,
|
|
2214
2219
|
width: `${this.visibleWidth}px`,
|
|
2215
|
-
height: `${this.visibleHeight}px
|
|
2216
|
-
pointerEvents: "none"
|
|
2220
|
+
height: `${this.visibleHeight}px`
|
|
2217
2221
|
};
|
|
2218
2222
|
}
|
|
2219
2223
|
draw() {
|
|
@@ -2228,7 +2232,7 @@ class ee extends te {
|
|
|
2228
2232
|
borderColor: "transparent",
|
|
2229
2233
|
borderWidth: 1,
|
|
2230
2234
|
fillColor: this.drawCellSkyBgColor
|
|
2231
|
-
}), this.
|
|
2235
|
+
}), this.drawText(), this.drawImage(), this.drawSelector(), this.drawAutofillPiont(), this.drawErrorTip();
|
|
2232
2236
|
}
|
|
2233
2237
|
/**
|
|
2234
2238
|
* 根据列的索引获取列的宽度
|
|
@@ -2245,8 +2249,8 @@ class ee extends te {
|
|
|
2245
2249
|
return s;
|
|
2246
2250
|
}
|
|
2247
2251
|
drawText() {
|
|
2248
|
-
const { CELL_PADDING: e, BODY_FONT: i } = this.ctx.config;
|
|
2249
|
-
return this.ctx.paint.drawText(
|
|
2252
|
+
const { CELL_PADDING: e, BODY_FONT: i } = this.ctx.config, { ellipsis: s } = this.ctx.paint.handleEllipsis(this.text, this.width, e, i);
|
|
2253
|
+
return this.ellipsis = s, this.ctx.paint.drawText(
|
|
2250
2254
|
this.displayText,
|
|
2251
2255
|
this.drawTextX,
|
|
2252
2256
|
this.drawTextY,
|
|
@@ -2276,8 +2280,8 @@ class ee extends te {
|
|
|
2276
2280
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2277
2281
|
if (!s || !i)
|
|
2278
2282
|
return;
|
|
2279
|
-
const { xArr: r, yArr: o } = this.ctx.selector,
|
|
2280
|
-
|
|
2283
|
+
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1], h = o[1], { colIndex: l, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2284
|
+
l === a && f === h && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2281
2285
|
borderColor: "#fff",
|
|
2282
2286
|
fillColor: e
|
|
2283
2287
|
});
|
|
@@ -2314,7 +2318,7 @@ class ee extends te {
|
|
|
2314
2318
|
drawErrorTip() {
|
|
2315
2319
|
if (this.cellType === "footer" || !this.message)
|
|
2316
2320
|
return;
|
|
2317
|
-
const { ERROR_TIP_ICON_SIZE: e, ERROR_TIP_COLOR: i } = this.ctx.config, { width: s } = this, r = this.drawX, o = this.drawY,
|
|
2321
|
+
const { ERROR_TIP_ICON_SIZE: e, ERROR_TIP_COLOR: i } = this.ctx.config, { width: s } = this, r = this.drawX, o = this.drawY, a = [
|
|
2318
2322
|
r + s - e - 0.5,
|
|
2319
2323
|
o,
|
|
2320
2324
|
r + s - 0.5,
|
|
@@ -2322,7 +2326,7 @@ class ee extends te {
|
|
|
2322
2326
|
r + s - 0.5,
|
|
2323
2327
|
o + e
|
|
2324
2328
|
];
|
|
2325
|
-
this.ctx.paint.drawLine(
|
|
2329
|
+
this.ctx.paint.drawLine(a, {
|
|
2326
2330
|
borderColor: i,
|
|
2327
2331
|
fillColor: i,
|
|
2328
2332
|
borderWidth: 1,
|
|
@@ -2331,35 +2335,35 @@ class ee extends te {
|
|
|
2331
2335
|
});
|
|
2332
2336
|
}
|
|
2333
2337
|
drawBorder(e) {
|
|
2334
|
-
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex:
|
|
2335
|
-
let h = s + 0.5, f = this.height;
|
|
2336
|
-
o === 0 && (
|
|
2337
|
-
const { xArr: d, yArr: x, lineDash: u = [], borderWidth:
|
|
2338
|
-
|
|
2339
|
-
borderColor:
|
|
2340
|
-
fillColor:
|
|
2341
|
-
borderWidth:
|
|
2338
|
+
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: a } = this;
|
|
2339
|
+
let h = i + 0.5, l = s + 0.5, f = this.height;
|
|
2340
|
+
o === 0 && (l = this.y + 1, f = f - 1), a === this.ctx.maxColIndex && (h = h - 1);
|
|
2341
|
+
const { xArr: d, yArr: x, lineDash: u = [], borderWidth: g = 1, borderColor: w, fillColor: p } = e, y = d[0], b = d[1], m = x[0], E = x[1];
|
|
2342
|
+
a >= y && a <= b && o === m && this.ctx.paint.drawLine([h, l, h + r - 2, l], {
|
|
2343
|
+
borderColor: w,
|
|
2344
|
+
fillColor: p,
|
|
2345
|
+
borderWidth: g,
|
|
2342
2346
|
lineCap: "round",
|
|
2343
2347
|
lineJoin: "round",
|
|
2344
2348
|
lineDash: u
|
|
2345
|
-
}),
|
|
2346
|
-
borderColor:
|
|
2347
|
-
fillColor:
|
|
2348
|
-
borderWidth:
|
|
2349
|
+
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([h, l + f - 1.5, h + r, l + f - 1.5], {
|
|
2350
|
+
borderColor: w,
|
|
2351
|
+
fillColor: p,
|
|
2352
|
+
borderWidth: g,
|
|
2349
2353
|
lineCap: "round",
|
|
2350
2354
|
lineJoin: "round",
|
|
2351
2355
|
lineDash: u
|
|
2352
|
-
}),
|
|
2353
|
-
borderColor:
|
|
2354
|
-
fillColor:
|
|
2355
|
-
borderWidth:
|
|
2356
|
+
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([h, l, h, l + f - 1], {
|
|
2357
|
+
borderColor: w,
|
|
2358
|
+
fillColor: p,
|
|
2359
|
+
borderWidth: g,
|
|
2356
2360
|
lineCap: "round",
|
|
2357
2361
|
lineJoin: "round",
|
|
2358
2362
|
lineDash: u
|
|
2359
|
-
}),
|
|
2360
|
-
borderColor:
|
|
2361
|
-
fillColor:
|
|
2362
|
-
borderWidth:
|
|
2363
|
+
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([h + r - 1.5, l, h + r - 1.5, l + f - 1.5], {
|
|
2364
|
+
borderColor: w,
|
|
2365
|
+
fillColor: p,
|
|
2366
|
+
borderWidth: g,
|
|
2363
2367
|
lineCap: "round",
|
|
2364
2368
|
lineJoin: "round",
|
|
2365
2369
|
lineDash: u
|
|
@@ -2367,8 +2371,8 @@ class ee extends te {
|
|
|
2367
2371
|
}
|
|
2368
2372
|
}
|
|
2369
2373
|
class ie extends te {
|
|
2370
|
-
constructor(e, i, s, r, o,
|
|
2371
|
-
super(e, s, r, o,
|
|
2374
|
+
constructor(e, i, s, r, o, a, h) {
|
|
2375
|
+
super(e, s, r, o, a, h.fixed, "header");
|
|
2372
2376
|
c(this, "align");
|
|
2373
2377
|
c(this, "verticalAlign", "middle");
|
|
2374
2378
|
c(this, "fixed");
|
|
@@ -2402,14 +2406,14 @@ class ie extends te {
|
|
|
2402
2406
|
c(this, "drawImageHeight", 0);
|
|
2403
2407
|
c(this, "drawImageName", "");
|
|
2404
2408
|
c(this, "drawImageSource");
|
|
2405
|
-
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height =
|
|
2409
|
+
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key = h.key, this.type = h.type, this.editorType = h.editorType || "text", this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level, this.operation = h.operation || !1, this.text = h.title, this.column = h, this.colspan = h.colspan, this.widthFillDisable = h.widthFillDisable, this.rowspan = h.rowspan, this.rules = h.rules, this.readonly = h.readonly, this.required = h.required, this.rowKey = Ut(), this.hasChildren = h.children && h.children.length > 0 || !1, this.render = h.renderHeader;
|
|
2406
2410
|
}
|
|
2407
2411
|
/**
|
|
2408
2412
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
2409
2413
|
* @returns
|
|
2410
2414
|
*/
|
|
2411
2415
|
isVerticalVisible() {
|
|
2412
|
-
const {
|
|
2416
|
+
const { stageHeight: e } = this.ctx, i = e;
|
|
2413
2417
|
return !(this.y + this.height <= 0 || this.y >= i);
|
|
2414
2418
|
}
|
|
2415
2419
|
/**
|
|
@@ -2422,11 +2426,11 @@ class ie extends te {
|
|
|
2422
2426
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2423
2427
|
let r = i, o = s;
|
|
2424
2428
|
if (typeof e == "function") {
|
|
2425
|
-
const
|
|
2429
|
+
const a = e, { backgroundColor: h, color: l } = a({
|
|
2426
2430
|
colIndex: this.colIndex,
|
|
2427
2431
|
column: this.column
|
|
2428
2432
|
}) || {};
|
|
2429
|
-
|
|
2433
|
+
h && (r = h), l && (o = l);
|
|
2430
2434
|
}
|
|
2431
2435
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2432
2436
|
}
|
|
@@ -2437,11 +2441,11 @@ class ie extends te {
|
|
|
2437
2441
|
const {
|
|
2438
2442
|
paint: e,
|
|
2439
2443
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2440
|
-
} = this.ctx, { drawX: o, drawY:
|
|
2441
|
-
e.drawRect(o,
|
|
2444
|
+
} = this.ctx, { drawX: o, drawY: a, displayText: h } = this;
|
|
2445
|
+
e.drawRect(o, a, this.width, this.height, {
|
|
2442
2446
|
borderColor: i,
|
|
2443
2447
|
fillColor: this.drawCellBgColor
|
|
2444
|
-
}), e.drawText(
|
|
2448
|
+
}), e.drawText(h, o, a, this.width, this.height, {
|
|
2445
2449
|
font: r,
|
|
2446
2450
|
padding: s,
|
|
2447
2451
|
color: this.drawTextColor,
|
|
@@ -2452,9 +2456,9 @@ class ie extends te {
|
|
|
2452
2456
|
drawSelection() {
|
|
2453
2457
|
const { width: e, height: i, type: s } = this;
|
|
2454
2458
|
if (["index-selection", "selection"].includes(s)) {
|
|
2455
|
-
const { indeterminate: r, check: o, selectable:
|
|
2459
|
+
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: h = 0 } = this.ctx.config, l = this.drawX + (e - h) / 2, f = this.drawY + (i - h) / 2;
|
|
2456
2460
|
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2457
|
-
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o &&
|
|
2461
|
+
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && a ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && a ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && a ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = l, this.drawImageY = f, this.drawImageWidth = h, this.drawImageHeight = h, this.drawImageName = x, this.drawImageSource = d, this.ctx.paint.drawImage(
|
|
2458
2462
|
this.drawImageSource,
|
|
2459
2463
|
this.drawImageX,
|
|
2460
2464
|
this.drawImageY,
|
|
@@ -2471,14 +2475,13 @@ class ie extends te {
|
|
|
2471
2475
|
*/
|
|
2472
2476
|
getOverlayerViewsStyle() {
|
|
2473
2477
|
let e = "";
|
|
2474
|
-
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" ? e = `${this.drawX - (this.ctx.
|
|
2478
|
+
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" ? e = `${this.drawX - (this.ctx.stageWidth - this.ctx.fixedRightWidth)}px` : e = `${this.drawX - this.ctx.fixedLeftWidth}px`, {
|
|
2475
2479
|
position: "absolute",
|
|
2476
2480
|
overflow: "hidden",
|
|
2477
2481
|
left: e,
|
|
2478
2482
|
top: `${this.drawY + 1}px`,
|
|
2479
2483
|
width: `${this.width}px`,
|
|
2480
|
-
height: `${this.height - 2}px
|
|
2481
|
-
pointerEvents: "none"
|
|
2484
|
+
height: `${this.height - 2}px`
|
|
2482
2485
|
};
|
|
2483
2486
|
}
|
|
2484
2487
|
}
|
|
@@ -2492,98 +2495,60 @@ class ci {
|
|
|
2492
2495
|
init() {
|
|
2493
2496
|
this.resizeObserver = new ResizeObserver(() => {
|
|
2494
2497
|
this.ctx.emit("resetHeader"), this.ctx.emit("resizeObserver");
|
|
2495
|
-
}), this.
|
|
2498
|
+
}), this.resizeObserver.observe(this.ctx.stageElement), this.ctx.on("mousedown", (t) => {
|
|
2496
2499
|
if (t.button !== 0 || this.isBusy(t))
|
|
2497
2500
|
return;
|
|
2498
|
-
const
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
const r = this.ctx.body.renderRows;
|
|
2507
|
-
for (const o of r) {
|
|
2508
|
-
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2509
|
-
for (const l of n) {
|
|
2510
|
-
const h = l.getDrawX(), f = l.getDrawY();
|
|
2511
|
-
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2512
|
-
this.ctx.setFocusCell(l), this.ctx.emit("cellMousedown", l, t);
|
|
2513
|
-
return;
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2516
|
-
}
|
|
2501
|
+
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, r = i;
|
|
2502
|
+
this.handleHeaderEvent(r, s, this.ctx.header.renderCellHeaders, (o) => {
|
|
2503
|
+
this.ctx.focusCellHeader = o, this.ctx.emit("cellHeaderMousedown", o, t);
|
|
2504
|
+
}), this.handleBodyEvent(r, s, this.ctx.body.renderRows, (o) => {
|
|
2505
|
+
this.ctx.setFocusCell(o), this.ctx.emit("cellMousedown", o, t);
|
|
2506
|
+
});
|
|
2517
2507
|
}), this.ctx.on("click", (t) => {
|
|
2518
2508
|
if (t.button !== 0 || this.isBusy(t))
|
|
2519
2509
|
return;
|
|
2520
|
-
const e = t.offsetY, i =
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
return;
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2510
|
+
const e = this.ctx.getOffset(t).offsetY, i = this.ctx.getOffset(t).offsetX;
|
|
2511
|
+
this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
|
|
2512
|
+
this.ctx.clickCellHeader = s, this.ctx.emit("cellHeaderClick", s, t), this.selectionClick(s);
|
|
2513
|
+
}), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
|
|
2514
|
+
this.ctx.clickCell = s, this.ctx.emit("cellClick", s, t), this.selectionClick(s), this.treeClick(s);
|
|
2515
|
+
});
|
|
2516
|
+
}), this.ctx.on("dblclick", (t) => {
|
|
2517
|
+
if (t.button !== 0 || this.isBusy(t))
|
|
2518
|
+
return;
|
|
2519
|
+
const e = this.ctx.getOffset(t).offsetY, i = this.ctx.getOffset(t).offsetX;
|
|
2520
|
+
this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
|
|
2521
|
+
this.ctx.emit("cellHeaderDblclick", s, t);
|
|
2522
|
+
}), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
|
|
2523
|
+
this.ctx.clickCell = s, this.ctx.emit("cellDblclick", s, t);
|
|
2524
|
+
});
|
|
2539
2525
|
}), this.ctx.on("contextMenu", (t) => {
|
|
2540
2526
|
if (this.isBusy(t))
|
|
2541
2527
|
return;
|
|
2542
|
-
const
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
}
|
|
2549
|
-
}
|
|
2550
|
-
const r = this.ctx.body.renderRows;
|
|
2551
|
-
for (const o of r) {
|
|
2552
|
-
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2553
|
-
for (const l of n) {
|
|
2554
|
-
const h = l.getDrawX(), f = l.getDrawY();
|
|
2555
|
-
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2556
|
-
this.ctx.emit("cellContextMenuClick", l, t);
|
|
2557
|
-
return;
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
}
|
|
2528
|
+
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, r = i;
|
|
2529
|
+
this.handleHeaderEvent(r, s, this.ctx.header.renderCellHeaders, (o) => {
|
|
2530
|
+
this.ctx.emit("cellHeaderContextMenuClick", o, t);
|
|
2531
|
+
}), this.handleBodyEvent(r, s, this.ctx.body.renderRows, (o) => {
|
|
2532
|
+
this.ctx.emit("cellContextMenuClick", o, t);
|
|
2533
|
+
});
|
|
2561
2534
|
}), this.ctx.on("mousemove", (t) => {
|
|
2562
|
-
var o;
|
|
2563
2535
|
if (this.isBusy(t))
|
|
2564
2536
|
return;
|
|
2565
|
-
const e = t.offsetY, i =
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
if (i > f && i < f + h.visibleWidth && e > d && e < d + h.visibleHeight && (this.imageEnterAndLeave(h, t), this.visibleHoverCell !== h && (this.ctx.emit("visibleCellMouseleave", h, t), this.visibleHoverCell = h, this.ctx.emit("visibleCellHoverChange", h, t))), i > f && i < f + h.width && e > d && e < d + h.height) {
|
|
2581
|
-
if (this.ctx.emit("cellMouseenter", h, t), this.ctx.hoverCell && this.ctx.hoverCell !== h && this.ctx.emit("cellMouseleave", this.ctx.hoverCell, t), this.ctx.hoverCell === h) return;
|
|
2582
|
-
((o = this.ctx.hoverCell) == null ? void 0 : o.rowKey) !== h.rowKey && (this.ctx.hoverCell = h, this.ctx.hoverRow = this.ctx.body.renderRows.find((x) => x.rowKey === h.rowKey), this.ctx.emit("rowHoverChange", this.ctx.hoverRow, h, t), this.ctx.emit("draw")), this.ctx.hoverCell = h, this.ctx.emit("cellHoverChange", h, t);
|
|
2583
|
-
return;
|
|
2584
|
-
}
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2537
|
+
const e = this.ctx.getOffset(t).offsetY, i = this.ctx.getOffset(t).offsetX;
|
|
2538
|
+
this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
|
|
2539
|
+
this.ctx.emit("cellHeaderMouseenter", s, t), this.ctx.hoverCellHeader && this.ctx.hoverCellHeader !== s && this.ctx.emit("cellHeaderMouseleave", this.ctx.hoverCellHeader, t), this.imageEnterAndLeave(s, t), this.ctx.hoverCellHeader !== s && (this.ctx.hoverCellHeader = s, this.ctx.emit("cellHeaderHoverChange", s));
|
|
2540
|
+
}), this.handleBodyEvent(
|
|
2541
|
+
i,
|
|
2542
|
+
e,
|
|
2543
|
+
this.ctx.body.renderRows,
|
|
2544
|
+
(s) => {
|
|
2545
|
+
this.imageEnterAndLeave(s, t), this.visibleHoverCell !== s && (this.ctx.emit("visibleCellMouseleave", s, t), this.visibleHoverCell = s, this.ctx.emit("visibleCellHoverChange", s, t));
|
|
2546
|
+
},
|
|
2547
|
+
!0
|
|
2548
|
+
), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
|
|
2549
|
+
var r;
|
|
2550
|
+
this.ctx.emit("cellMouseenter", s, t), this.ctx.hoverCell && this.ctx.hoverCell !== s && this.ctx.emit("cellMouseleave", this.ctx.hoverCell, t), this.ctx.hoverCell !== s && (((r = this.ctx.hoverCell) == null ? void 0 : r.rowKey) !== s.rowKey && (this.ctx.hoverCell = s, this.ctx.hoverRow = this.ctx.body.renderRows.find((o) => o.rowKey === s.rowKey), this.ctx.emit("rowHoverChange", this.ctx.hoverRow, s, t), this.ctx.emit("drawView")), this.ctx.hoverCell = s, this.ctx.emit("cellHoverChange", s, t));
|
|
2551
|
+
});
|
|
2587
2552
|
});
|
|
2588
2553
|
}
|
|
2589
2554
|
/**
|
|
@@ -2614,14 +2579,14 @@ class ci {
|
|
|
2614
2579
|
colIndex: t.colIndex,
|
|
2615
2580
|
column: t.column,
|
|
2616
2581
|
value: t.getValue()
|
|
2617
|
-
}).then((
|
|
2618
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2619
|
-
}).catch((
|
|
2620
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2582
|
+
}).then((h) => {
|
|
2583
|
+
this.ctx.database.setExpandChildren(t.rowKey, h), this.ctx.database.expandLoading(t.rowKey, !1);
|
|
2584
|
+
}).catch((h) => {
|
|
2585
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(h);
|
|
2621
2586
|
}));
|
|
2622
2587
|
else {
|
|
2623
|
-
const
|
|
2624
|
-
this.ctx.database.expandItem(t.rowKey, !
|
|
2588
|
+
const a = this.ctx.database.getIsExpand(t.rowKey);
|
|
2589
|
+
this.ctx.database.expandItem(t.rowKey, !a), this.ctx.emit("expandChange");
|
|
2625
2590
|
}
|
|
2626
2591
|
}
|
|
2627
2592
|
}
|
|
@@ -2631,30 +2596,60 @@ class ci {
|
|
|
2631
2596
|
* @param e
|
|
2632
2597
|
*/
|
|
2633
2598
|
imageEnterAndLeave(t, e) {
|
|
2634
|
-
const i = e
|
|
2635
|
-
|
|
2599
|
+
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s;
|
|
2600
|
+
o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight ? (this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof ee && ["selection", "index-selection"].includes(t.type) && (this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.stageElement.style.cursor = "not-allowed"))) : (this.ctx.isPointer = !1, this.ctx.stageElement.style.cursor === "pointer" && (this.ctx.stageElement.style.cursor = "default"));
|
|
2636
2601
|
}
|
|
2637
2602
|
isBusy(t) {
|
|
2638
|
-
const e = t
|
|
2639
|
-
if (!
|
|
2603
|
+
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, r = i;
|
|
2604
|
+
if (!this.ctx.isTarget() || this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize" || this.ctx.columnResizing || this.ctx.rowResizing)
|
|
2640
2605
|
return !0;
|
|
2641
|
-
const { SCROLLER_TRACK_SIZE:
|
|
2642
|
-
return !!(this.ctx.scrollerMove || this.ctx.scrollerFocus ||
|
|
2606
|
+
const { SCROLLER_TRACK_SIZE: o } = this.ctx.config;
|
|
2607
|
+
return !!(this.ctx.scrollerMove || this.ctx.scrollerFocus || s > this.ctx.stageHeight - o || r > this.ctx.stageWidth - o);
|
|
2608
|
+
}
|
|
2609
|
+
handleBodyEvent(t, e, i, s, r = !1) {
|
|
2610
|
+
for (const o of i) {
|
|
2611
|
+
const a = o.fixedCells.concat(o.noFixedCells);
|
|
2612
|
+
for (const h of a) {
|
|
2613
|
+
const l = h.getDrawX(), f = h.getDrawY();
|
|
2614
|
+
if (r) {
|
|
2615
|
+
if (t > l && t < l + h.visibleWidth && e > f && e < f + h.visibleHeight) {
|
|
2616
|
+
s(h);
|
|
2617
|
+
return;
|
|
2618
|
+
}
|
|
2619
|
+
} else if (t > l && t < l + h.width && e > f && e < f + h.height) {
|
|
2620
|
+
s(h);
|
|
2621
|
+
return;
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
handleHeaderEvent(t, e, i, s) {
|
|
2627
|
+
for (const r of i) {
|
|
2628
|
+
const o = r.getDrawX(), a = r.getDrawY();
|
|
2629
|
+
if (t > o && t < o + r.width && e > a && e < a + r.height) {
|
|
2630
|
+
s(r);
|
|
2631
|
+
return;
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2643
2634
|
}
|
|
2644
2635
|
destroy() {
|
|
2645
|
-
this.resizeObserver.unobserve(this.ctx.
|
|
2636
|
+
this.resizeObserver.unobserve(this.ctx.stageElement);
|
|
2646
2637
|
}
|
|
2647
2638
|
}
|
|
2648
|
-
class
|
|
2649
|
-
constructor(t, e
|
|
2639
|
+
class hi {
|
|
2640
|
+
constructor(t, e) {
|
|
2650
2641
|
c(this, "eventBus");
|
|
2651
2642
|
c(this, "eventBrowser");
|
|
2652
2643
|
c(this, "eventTable");
|
|
2653
|
-
c(this, "
|
|
2654
|
-
c(this, "
|
|
2655
|
-
c(this, "
|
|
2644
|
+
c(this, "containerElement");
|
|
2645
|
+
c(this, "stageElement");
|
|
2646
|
+
c(this, "canvasElement");
|
|
2647
|
+
c(this, "overlayerElement");
|
|
2648
|
+
c(this, "stageWidth", 0);
|
|
2649
|
+
c(this, "stageHeight", 0);
|
|
2656
2650
|
c(this, "paint");
|
|
2657
2651
|
c(this, "icons");
|
|
2652
|
+
c(this, "isInsideTargetContainer", !1);
|
|
2658
2653
|
c(this, "mousedown", !1);
|
|
2659
2654
|
c(this, "isPointer", !1);
|
|
2660
2655
|
c(this, "rowResizing", !1);
|
|
@@ -2736,10 +2731,11 @@ class li {
|
|
|
2736
2731
|
c(this, "database");
|
|
2737
2732
|
c(this, "history");
|
|
2738
2733
|
c(this, "config");
|
|
2739
|
-
|
|
2734
|
+
const { containerElement: i, stageElement: s, canvasElement: r, overlayerElement: o } = t;
|
|
2735
|
+
this.containerElement = i, this.stageElement = s, this.canvasElement = r, this.overlayerElement = o, this.config = new Wt(e.config || {}), this.eventBus = new oi(), this.eventBrowser = new ri(this), this.eventTable = new ci(this), this.paint = new ni(this.canvasElement), this.database = new ii(this, e), this.history = new si(this), this.icons = new ai(this);
|
|
2740
2736
|
}
|
|
2741
2737
|
setConfig(t) {
|
|
2742
|
-
this.config = new
|
|
2738
|
+
this.config = new Wt(t);
|
|
2743
2739
|
}
|
|
2744
2740
|
setFocusCell(t) {
|
|
2745
2741
|
var e;
|
|
@@ -2770,8 +2766,8 @@ class li {
|
|
|
2770
2766
|
let s = "";
|
|
2771
2767
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2772
2768
|
const o = [];
|
|
2773
|
-
for (let
|
|
2774
|
-
const
|
|
2769
|
+
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
2770
|
+
const h = r + e[0], l = a + i[0], f = this.database.getItemValueForRowIndexAndColIndex(h, l);
|
|
2775
2771
|
f && o.push(f.value);
|
|
2776
2772
|
}
|
|
2777
2773
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
@@ -2801,10 +2797,15 @@ class li {
|
|
|
2801
2797
|
const i = this.body.height - this.body.visibleHeight - this.footer.height;
|
|
2802
2798
|
e < 0 ? e = 0 : e > i && (e = i), this.emit("setScrollY", e);
|
|
2803
2799
|
}
|
|
2804
|
-
isTarget(
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2800
|
+
isTarget() {
|
|
2801
|
+
return this.isInsideTargetContainer;
|
|
2802
|
+
}
|
|
2803
|
+
getOffset(t) {
|
|
2804
|
+
const { left: e, top: i } = this.containerElement.getBoundingClientRect();
|
|
2805
|
+
return {
|
|
2806
|
+
offsetX: t.clientX - e,
|
|
2807
|
+
offsetY: t.clientY - i
|
|
2808
|
+
};
|
|
2808
2809
|
}
|
|
2809
2810
|
hasEvent(t) {
|
|
2810
2811
|
return this.eventBus.has(t);
|
|
@@ -2825,7 +2826,7 @@ class li {
|
|
|
2825
2826
|
this.eventTable.destroy(), this.eventBrowser.destroy(), this.eventBus.destroy();
|
|
2826
2827
|
}
|
|
2827
2828
|
}
|
|
2828
|
-
class
|
|
2829
|
+
class Pt {
|
|
2829
2830
|
constructor(t, e) {
|
|
2830
2831
|
c(this, "ctx");
|
|
2831
2832
|
c(this, "type");
|
|
@@ -2856,9 +2857,9 @@ class Vt {
|
|
|
2856
2857
|
this.updateScroll(t);
|
|
2857
2858
|
}
|
|
2858
2859
|
onMouseDown(t) {
|
|
2859
|
-
if (!(t.target instanceof
|
|
2860
|
+
if (!(t.target instanceof Element) || !this.ctx.isTarget())
|
|
2860
2861
|
return;
|
|
2861
|
-
if (this.ctx.
|
|
2862
|
+
if (this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize")
|
|
2862
2863
|
return !0;
|
|
2863
2864
|
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2864
2865
|
if (!(s == this.clientX && r == this.clientY)) {
|
|
@@ -2875,11 +2876,11 @@ class Vt {
|
|
|
2875
2876
|
}
|
|
2876
2877
|
onMouseMove(t) {
|
|
2877
2878
|
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2878
|
-
if (this.isOnScrollbar(e, i) && t.target === this.ctx.
|
|
2879
|
+
if (this.isOnScrollbar(e, i) && t.target === this.ctx.canvasElement ? this.isFocus = !0 : this.isFocus = !1, s == this.clientX && r == this.clientY) return;
|
|
2879
2880
|
let o = 0;
|
|
2880
2881
|
if (this.type === "horizontal" ? o = s - this.clientX : o = r - this.clientY, this.isDragging && o !== 0) {
|
|
2881
|
-
let
|
|
2882
|
-
this.type === "vertical" ?
|
|
2882
|
+
let a = 0;
|
|
2883
|
+
this.type === "vertical" ? a = this.dragStart + o / (this.visibleDistance - this.barHeight) * this.distance : a = this.dragStart + o / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(a, this.distance));
|
|
2883
2884
|
}
|
|
2884
2885
|
}
|
|
2885
2886
|
isPointInElement(t, e, i, s, r, o) {
|
|
@@ -2899,23 +2900,25 @@ class Vt {
|
|
|
2899
2900
|
const {
|
|
2900
2901
|
body: t,
|
|
2901
2902
|
header: e,
|
|
2902
|
-
|
|
2903
|
-
|
|
2903
|
+
stageHeight: i,
|
|
2904
|
+
stageWidth: s,
|
|
2905
|
+
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
2906
|
+
} = this.ctx, a = s, h = i, l = e.height, f = e.width, d = t.height, x = this.ctx.footer.height;
|
|
2904
2907
|
if (this.type === "vertical") {
|
|
2905
|
-
this.visibleDistance =
|
|
2906
|
-
const
|
|
2907
|
-
let
|
|
2908
|
-
|
|
2908
|
+
this.visibleDistance = h - r - l, this.distance = d - this.visibleDistance + x, this.trackX = a - r, this.trackY = 0, this.splitPoints = [this.trackX, l, this.trackX + r, l], this.trackWidth = r, this.trackHeight = h, this.barX = this.trackX - 0.5 + (r - o) / 2, this.barWidth = o;
|
|
2909
|
+
const u = this.distance ? this.visibleDistance / d : 0;
|
|
2910
|
+
let g = Math.floor(u * this.visibleDistance);
|
|
2911
|
+
g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY = l + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2909
2912
|
} else {
|
|
2910
|
-
this.visibleDistance =
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
], this.trackX = 0, this.trackY =
|
|
2916
|
-
const
|
|
2917
|
-
let
|
|
2918
|
-
this.barY = this.trackY
|
|
2913
|
+
this.visibleDistance = a - r, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
2914
|
+
a - r,
|
|
2915
|
+
h - r,
|
|
2916
|
+
a - r,
|
|
2917
|
+
h
|
|
2918
|
+
], this.trackX = 0, this.trackY = h - r, this.trackWidth = a, this.trackHeight = r;
|
|
2919
|
+
const u = this.distance ? this.visibleDistance / f : 0;
|
|
2920
|
+
let g = Math.floor(u * this.visibleDistance);
|
|
2921
|
+
this.barY = this.trackY - 0.5 + (r - o) / 2, g < 30 ? g = 30 : g >= this.visibleDistance && (g = 0), this.barWidth = g, this.barHeight = o, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2919
2922
|
}
|
|
2920
2923
|
}
|
|
2921
2924
|
draw() {
|
|
@@ -2934,12 +2937,12 @@ class Vt {
|
|
|
2934
2937
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
2935
2938
|
}
|
|
2936
2939
|
}
|
|
2937
|
-
class
|
|
2940
|
+
class li {
|
|
2938
2941
|
constructor(t) {
|
|
2939
2942
|
c(this, "ctx");
|
|
2940
2943
|
c(this, "verticalScrollbar");
|
|
2941
2944
|
c(this, "horizontalScrollbar");
|
|
2942
|
-
this.ctx = t, this.verticalScrollbar = new
|
|
2945
|
+
this.ctx = t, this.verticalScrollbar = new Pt(t, "vertical"), this.horizontalScrollbar = new Pt(t, "horizontal"), this.ctx.on("wheel", (e) => this.onWheel(e)), this.ctx.on("mousedown", (e) => this.onMouseDown(e)), this.ctx.on("mousemove", (e) => this.onMouseMove(e)), this.ctx.on("mouseup", () => this.onMouseUp()), this.ctx.on("setScroll", (e, i) => {
|
|
2943
2946
|
this.setScroll(e, i);
|
|
2944
2947
|
}), this.ctx.on("setScrollX", (e) => {
|
|
2945
2948
|
this.setScrollX(e);
|
|
@@ -3043,15 +3046,15 @@ class di {
|
|
|
3043
3046
|
this.height = t * s, this.width = r.reduce((d, x) => d + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
3044
3047
|
const o = Je(Qt(i, s));
|
|
3045
3048
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3046
|
-
const
|
|
3047
|
-
this.resizeNum > 0 ? this.ctx.
|
|
3048
|
-
const
|
|
3049
|
-
if (this.resizeNum &&
|
|
3050
|
-
const d = Math.floor(
|
|
3049
|
+
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3050
|
+
this.resizeNum > 0 ? this.ctx.stageWidth = Math.floor(a.width) : this.ctx.stageWidth = Math.floor(this.width + e), this.ctx.stageElement.style.width = this.ctx.stageWidth - 0.5 + "px", this.visibleWidth = this.ctx.stageWidth - e;
|
|
3051
|
+
const h = this.visibleWidth - this.width;
|
|
3052
|
+
if (this.resizeNum && h > 0) {
|
|
3053
|
+
const d = Math.floor(h / this.resizeNum * 100) / 100;
|
|
3051
3054
|
this.resizeAllColumn(d);
|
|
3052
3055
|
}
|
|
3053
|
-
const
|
|
3054
|
-
this.ctx.fixedLeftWidth =
|
|
3056
|
+
const l = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
3057
|
+
this.ctx.fixedLeftWidth = l.reduce((d, x) => d + x.width, 0);
|
|
3055
3058
|
const f = this.fixedRightCellHeaders.filter((d) => !d.hasChildren);
|
|
3056
3059
|
this.ctx.fixedRightWidth = f.reduce((d, x) => d + 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;
|
|
3057
3060
|
}
|
|
@@ -3061,13 +3064,13 @@ class di {
|
|
|
3061
3064
|
config: { ENABLE_RESIZE_COLUMN: t }
|
|
3062
3065
|
} = this.ctx;
|
|
3063
3066
|
t && (this.ctx.on("mousedown", (e) => {
|
|
3064
|
-
this.ctx.isTarget(
|
|
3067
|
+
this.ctx.isTarget() && (this.clientX = e.clientX, this.resizeTarget ? (this.isResizing = !0, this.ctx.columnResizing = !0) : this.isResizing = !1, this.isMouseDown = !0);
|
|
3065
3068
|
}), this.ctx.on("mouseup", () => {
|
|
3066
3069
|
this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeColumn(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.isResizing = !1, this.ctx.columnResizing = !1, this.clientX = 0;
|
|
3067
3070
|
}), this.ctx.on("mousemove", (e) => {
|
|
3068
3071
|
if (this.ctx.editing) return;
|
|
3069
3072
|
const {
|
|
3070
|
-
|
|
3073
|
+
stageWidth: i,
|
|
3071
3074
|
config: { RESIZE_COLUMN_MIN_WIDTH: s }
|
|
3072
3075
|
} = this.ctx;
|
|
3073
3076
|
if (this.isResizing && this.resizeTarget) {
|
|
@@ -3077,12 +3080,12 @@ class di {
|
|
|
3077
3080
|
} else {
|
|
3078
3081
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3079
3082
|
return;
|
|
3080
|
-
this.ctx.
|
|
3083
|
+
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3081
3084
|
const r = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3082
3085
|
for (const o of r) {
|
|
3083
|
-
const
|
|
3084
|
-
|
|
3085
|
-
o.colspan <= 1 &&
|
|
3086
|
+
const { offsetX: a, offsetY: h } = this.ctx.getOffset(e), l = a, f = o.getDrawX();
|
|
3087
|
+
l > f + o.width - 5 && l < f + o.width + 4 && l < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3088
|
+
o.colspan <= 1 && this.ctx.isTarget() && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3086
3089
|
}
|
|
3087
3090
|
}
|
|
3088
3091
|
}));
|
|
@@ -3091,8 +3094,8 @@ class di {
|
|
|
3091
3094
|
const i = (r) => {
|
|
3092
3095
|
r.forEach((o) => {
|
|
3093
3096
|
if (o.children && o.children.length > 0 && i(o.children), o.key === t.key) {
|
|
3094
|
-
const
|
|
3095
|
-
o.width =
|
|
3097
|
+
const a = o.width || 100;
|
|
3098
|
+
o.width = a + e;
|
|
3096
3099
|
}
|
|
3097
3100
|
});
|
|
3098
3101
|
};
|
|
@@ -3136,19 +3139,19 @@ class di {
|
|
|
3136
3139
|
let s = e;
|
|
3137
3140
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3138
3141
|
for (let o = 0; o < i; o++) {
|
|
3139
|
-
const
|
|
3140
|
-
let f =
|
|
3141
|
-
|
|
3142
|
-
const d = new ie(this.ctx, this.columnIndex, s,
|
|
3143
|
-
this.ctx.database.setHeader(
|
|
3142
|
+
const a = t[o], h = r * (a.rowspan || 1), l = r * a.level;
|
|
3143
|
+
let f = a.width || 100;
|
|
3144
|
+
a.children && (f = _t(a.children).reduce((u, g) => u + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3145
|
+
const d = new ie(this.ctx, this.columnIndex, s, l, f, h, a);
|
|
3146
|
+
this.ctx.database.setHeader(a.key, d), this.allCellHeaders.push(d), a.children || (this.leafCellHeaders.push(d), d.column.widthFillDisable || this.resizeNum++), a.fixed === "left" ? this.fixedLeftCellHeaders.push(d) : a.fixed === "right" ? this.fixedRightCellHeaders.push(d) : this.centerCellHeaders.push(d), !a.children && this.columnIndex++, a.children && this.render(a.children, s), s += f;
|
|
3144
3147
|
}
|
|
3145
3148
|
}
|
|
3146
3149
|
drawTipLine() {
|
|
3147
3150
|
if (this.isResizing && this.resizeTarget) {
|
|
3148
3151
|
const {
|
|
3149
|
-
|
|
3152
|
+
stageHeight: t,
|
|
3150
3153
|
config: { RESIZE_COLUMN_LINE_COLOR: e }
|
|
3151
|
-
} = this.ctx, i = this.resizeTarget.getDrawX(), s = this.resizeTarget.width, r = i + s + this.resizeDiff - 0.5, o = [r
|
|
3154
|
+
} = this.ctx, i = this.resizeTarget.getDrawX(), s = this.resizeTarget.width, r = i + s + this.resizeDiff - 0.5, o = [r - 0.5, 0, r - 0.5, t];
|
|
3152
3155
|
this.ctx.paint.drawLine(o, {
|
|
3153
3156
|
borderColor: e,
|
|
3154
3157
|
borderWidth: 1
|
|
@@ -3161,8 +3164,8 @@ class di {
|
|
|
3161
3164
|
fixedRightWidth: e,
|
|
3162
3165
|
scrollX: i,
|
|
3163
3166
|
header: s,
|
|
3164
|
-
|
|
3165
|
-
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE:
|
|
3167
|
+
stageWidth: r,
|
|
3168
|
+
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3166
3169
|
} = this.ctx;
|
|
3167
3170
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
3168
3171
|
fillColor: o,
|
|
@@ -3170,9 +3173,9 @@ class di {
|
|
|
3170
3173
|
shadowWidth: 4,
|
|
3171
3174
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3172
3175
|
colorEnd: "rgba(0,0,0,0)"
|
|
3173
|
-
}), i < Math.floor(s.width -
|
|
3174
|
-
const
|
|
3175
|
-
this.ctx.paint.drawShadow(
|
|
3176
|
+
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3177
|
+
const h = s.width - (this.x + this.width) + r - e;
|
|
3178
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3176
3179
|
fillColor: o,
|
|
3177
3180
|
side: "left",
|
|
3178
3181
|
shadowWidth: 4,
|
|
@@ -3200,7 +3203,7 @@ class di {
|
|
|
3200
3203
|
}
|
|
3201
3204
|
}
|
|
3202
3205
|
class se {
|
|
3203
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0,
|
|
3206
|
+
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a, h = "body") {
|
|
3204
3207
|
c(this, "ctx");
|
|
3205
3208
|
c(this, "x", 0);
|
|
3206
3209
|
c(this, "y", 0);
|
|
@@ -3213,7 +3216,7 @@ class se {
|
|
|
3213
3216
|
c(this, "rowKey", "");
|
|
3214
3217
|
c(this, "rowType", "body");
|
|
3215
3218
|
c(this, "data");
|
|
3216
|
-
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType =
|
|
3219
|
+
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType = h, this.data = a, this.update();
|
|
3217
3220
|
}
|
|
3218
3221
|
update() {
|
|
3219
3222
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
@@ -3279,51 +3282,51 @@ class fi {
|
|
|
3279
3282
|
}
|
|
3280
3283
|
init() {
|
|
3281
3284
|
const {
|
|
3282
|
-
|
|
3285
|
+
canvasElement: t,
|
|
3283
3286
|
header: e,
|
|
3284
3287
|
database: i,
|
|
3285
3288
|
config: {
|
|
3286
3289
|
FOOTER_FIXED: s,
|
|
3287
3290
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3294
|
-
OFFSET_HEIGHT: x = 0
|
|
3291
|
+
HEIGHT: o,
|
|
3292
|
+
EMPTY_BODY_HEIGHT: a = 0,
|
|
3293
|
+
MAX_HEIGHT: h = 0,
|
|
3294
|
+
ENABLE_OFFSET_HEIGHT: l = 0,
|
|
3295
|
+
OFFSET_HEIGHT: f = 0
|
|
3295
3296
|
}
|
|
3296
3297
|
} = this.ctx;
|
|
3297
3298
|
if (!e.width)
|
|
3298
3299
|
return;
|
|
3299
3300
|
this.x = 0, this.y = e.height;
|
|
3300
|
-
const { data:
|
|
3301
|
-
this.height =
|
|
3302
|
-
const { top:
|
|
3303
|
-
this.width = e.width, this.visibleWidth =
|
|
3304
|
-
const
|
|
3305
|
-
this.data.length || (this.height =
|
|
3306
|
-
const
|
|
3301
|
+
const { data: d, sumHeight: x } = i.getData();
|
|
3302
|
+
this.height = x, this.data = d;
|
|
3303
|
+
const { top: u } = t.getBoundingClientRect();
|
|
3304
|
+
this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
3305
|
+
const g = this.ctx.footer.height;
|
|
3306
|
+
this.data.length || (this.height = a);
|
|
3307
|
+
const w = this.data.length ? "not-empty" : "empty";
|
|
3307
3308
|
this.ctx.emit("emptyChange", {
|
|
3308
|
-
isEmpty:
|
|
3309
|
-
type:
|
|
3309
|
+
isEmpty: w,
|
|
3310
|
+
type: w,
|
|
3310
3311
|
headerHeight: e.height,
|
|
3311
3312
|
bodyHeight: this.height,
|
|
3312
|
-
footerHeight:
|
|
3313
|
+
footerHeight: g,
|
|
3313
3314
|
width: this.width,
|
|
3314
|
-
height: this.data.length ? 0 :
|
|
3315
|
+
height: this.data.length ? 0 : a + g
|
|
3315
3316
|
});
|
|
3316
|
-
let
|
|
3317
|
-
|
|
3318
|
-
let
|
|
3319
|
-
this.data.length &&
|
|
3317
|
+
let p = this.height + e.height + r;
|
|
3318
|
+
p += g;
|
|
3319
|
+
let y = 0;
|
|
3320
|
+
this.data.length && l ? (y = window.innerHeight - u - f, y < 0 && (y = 32, console.error(
|
|
3320
3321
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3321
|
-
))) : this.data.length &&
|
|
3322
|
-
let
|
|
3323
|
-
s ? this.visibleHeight =
|
|
3322
|
+
))) : this.data.length && o ? y = o : this.data.length && h && p > h ? y = h : y = p, y > 0 && (this.ctx.stageHeight = Math.floor(y), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
|
|
3323
|
+
let b = this.ctx.stageHeight - e.height - r;
|
|
3324
|
+
s ? this.visibleHeight = b - g : this.visibleHeight = b, 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 = d;
|
|
3325
|
+
const m = window.devicePixelRatio || 1, E = this.ctx.stageWidth * m, C = this.ctx.stageHeight * m;
|
|
3326
|
+
t.width = Math.floor(E), t.height = Math.floor(C), this.ctx.canvasElement.setAttribute(
|
|
3324
3327
|
"style",
|
|
3325
|
-
`
|
|
3326
|
-
);
|
|
3328
|
+
` height:${this.ctx.stageHeight}px;width:${this.ctx.stageWidth}px;`
|
|
3329
|
+
), this.ctx.paint.scale(m);
|
|
3327
3330
|
}
|
|
3328
3331
|
// 调整行的高度
|
|
3329
3332
|
initResizeRow() {
|
|
@@ -3335,28 +3338,28 @@ class fi {
|
|
|
3335
3338
|
this.ctx.rowResizing = !1;
|
|
3336
3339
|
}, 0), this.clientY = 0;
|
|
3337
3340
|
}), this.ctx.on("mousedown", (e) => {
|
|
3338
|
-
this.ctx.isTarget(
|
|
3341
|
+
this.ctx.isTarget() && (this.clientY = e.clientY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : (this.isResizing = !1, this.ctx.rowResizing = !1), this.isMouseDown = !0);
|
|
3339
3342
|
}), this.ctx.on("mousemove", (e) => {
|
|
3340
3343
|
if (this.ctx.editing) return;
|
|
3341
|
-
const
|
|
3342
|
-
|
|
3343
|
-
scrollY:
|
|
3344
|
-
config: { RESIZE_ROW_MIN_HEIGHT:
|
|
3344
|
+
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s, a = e.clientY, {
|
|
3345
|
+
stageHeight: h,
|
|
3346
|
+
scrollY: l,
|
|
3347
|
+
config: { RESIZE_ROW_MIN_HEIGHT: f = 0 }
|
|
3345
3348
|
} = this.ctx;
|
|
3346
3349
|
if (this.isResizing && this.resizeTarget) {
|
|
3347
|
-
const
|
|
3348
|
-
let
|
|
3349
|
-
|
|
3350
|
+
const d = this.resizeTarget.height;
|
|
3351
|
+
let x = a - this.clientY;
|
|
3352
|
+
x + d < f && (x = -(d - f)), this.resizeDiff = x, this.ctx.emit("draw");
|
|
3350
3353
|
} else {
|
|
3351
|
-
if (this.resizeTarget = null, this.isMouseDown || this.ctx.
|
|
3354
|
+
if (this.resizeTarget = null, this.isMouseDown || this.ctx.stageElement.style.cursor === "crosshair")
|
|
3352
3355
|
return;
|
|
3353
|
-
this.ctx.
|
|
3354
|
-
for (let
|
|
3355
|
-
const
|
|
3356
|
-
if (
|
|
3357
|
-
for (let
|
|
3358
|
-
const
|
|
3359
|
-
|
|
3356
|
+
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3357
|
+
for (let d = 0; d < this.renderRows.length; d++) {
|
|
3358
|
+
const x = this.renderRows[d];
|
|
3359
|
+
if (r > x.y - l + x.height - 1.5 && r < x.y - l + x.height + 1.5 && r < h - 4)
|
|
3360
|
+
for (let g = 0; g < x.cells.length; g++) {
|
|
3361
|
+
const w = x.cells[g];
|
|
3362
|
+
o > w.drawX + 10 && o < w.drawX + w.width - 10 && w.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
3360
3363
|
}
|
|
3361
3364
|
}
|
|
3362
3365
|
}
|
|
@@ -3376,11 +3379,11 @@ class fi {
|
|
|
3376
3379
|
drawTipLine() {
|
|
3377
3380
|
if (this.isResizing && this.resizeTarget) {
|
|
3378
3381
|
const {
|
|
3379
|
-
|
|
3382
|
+
stageWidth: t,
|
|
3380
3383
|
scrollY: e,
|
|
3381
3384
|
config: { RESIZE_ROW_LINE_COLOR: i }
|
|
3382
|
-
} = this.ctx, s = this.resizeTarget.y - e, r = this.resizeTarget.height, o = s + r + this.resizeDiff - 0.5,
|
|
3383
|
-
this.ctx.paint.drawLine(
|
|
3385
|
+
} = this.ctx, s = this.resizeTarget.y - e, r = this.resizeTarget.height, o = s + r + this.resizeDiff - 0.5, a = [0, o - 0.5, t, o - 0.5];
|
|
3386
|
+
this.ctx.paint.drawLine(a, {
|
|
3384
3387
|
borderColor: i,
|
|
3385
3388
|
borderWidth: 1
|
|
3386
3389
|
});
|
|
@@ -3392,8 +3395,8 @@ class fi {
|
|
|
3392
3395
|
fixedRightWidth: e,
|
|
3393
3396
|
scrollX: i,
|
|
3394
3397
|
header: s,
|
|
3395
|
-
|
|
3396
|
-
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE:
|
|
3398
|
+
stageWidth: r,
|
|
3399
|
+
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3397
3400
|
} = this.ctx;
|
|
3398
3401
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
3399
3402
|
fillColor: o,
|
|
@@ -3401,9 +3404,9 @@ class fi {
|
|
|
3401
3404
|
shadowWidth: 4,
|
|
3402
3405
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3403
3406
|
colorEnd: "rgba(0,0,0,0)"
|
|
3404
|
-
}), i < Math.floor(s.width -
|
|
3405
|
-
const
|
|
3406
|
-
this.ctx.paint.drawShadow(
|
|
3407
|
+
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3408
|
+
const h = s.width - (this.x + this.width) + r - e;
|
|
3409
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3407
3410
|
fillColor: o,
|
|
3408
3411
|
side: "left",
|
|
3409
3412
|
shadowWidth: 4,
|
|
@@ -3415,10 +3418,10 @@ class fi {
|
|
|
3415
3418
|
binarySearch(t, e) {
|
|
3416
3419
|
let i = 0, s = t.length - 1, r = -1;
|
|
3417
3420
|
for (; i <= s; ) {
|
|
3418
|
-
let o = Math.floor((i + s) / 2),
|
|
3419
|
-
if (
|
|
3421
|
+
let o = Math.floor((i + s) / 2), a = t[o].bottom;
|
|
3422
|
+
if (a === e)
|
|
3420
3423
|
return o;
|
|
3421
|
-
|
|
3424
|
+
a < e ? i = o + 1 : (r = o, s = o - 1);
|
|
3422
3425
|
}
|
|
3423
3426
|
return r;
|
|
3424
3427
|
}
|
|
@@ -3426,15 +3429,15 @@ class fi {
|
|
|
3426
3429
|
this.init();
|
|
3427
3430
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3428
3431
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3429
|
-
const
|
|
3430
|
-
let
|
|
3431
|
-
|
|
3432
|
-
const
|
|
3432
|
+
const a = this.binarySearch(o, s);
|
|
3433
|
+
let h = this.binarySearch(o, s + this.visibleHeight);
|
|
3434
|
+
h === -1 && (h = r.length), 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;
|
|
3435
|
+
const l = [];
|
|
3433
3436
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3434
|
-
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top:
|
|
3435
|
-
|
|
3437
|
+
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: g } = this.ctx.database.getPositionForRowIndex(d), w = new se(this.ctx, d, 0, g + this.y, t.width, u, x);
|
|
3438
|
+
l.push(w);
|
|
3436
3439
|
}
|
|
3437
|
-
this.renderRows =
|
|
3440
|
+
this.renderRows = l, this.ctx.body.renderRows = l;
|
|
3438
3441
|
}
|
|
3439
3442
|
draw() {
|
|
3440
3443
|
this.renderRows.forEach((t) => {
|
|
@@ -3464,7 +3467,7 @@ class xi {
|
|
|
3464
3467
|
body: e,
|
|
3465
3468
|
config: { CELL_FOOTER_HEIGHT: i, FOOTER_FIXED: s, SCROLLER_TRACK_SIZE: r }
|
|
3466
3469
|
} = this.ctx;
|
|
3467
|
-
this.width = t.width, this.visibleWidth = t.visibleWidth, this.height = this.data.reduce((o) => o + i, 0), this.visibleHeight = this.height, s ? this.y = this.ctx.
|
|
3470
|
+
this.width = t.width, this.visibleWidth = t.visibleWidth, this.height = this.data.reduce((o) => o + i, 0), this.visibleHeight = this.height, s ? this.y = this.ctx.stageHeight - this.height - r : this.y = e.y + e.height, this.ctx.footer.x = this.x, this.ctx.footer.y = this.y, this.ctx.footer.height = this.height, this.ctx.footer.width = this.width, this.ctx.footer.visibleWidth = this.visibleWidth, this.ctx.footer.visibleHeight = this.visibleHeight;
|
|
3468
3471
|
}
|
|
3469
3472
|
drawFiexShadow() {
|
|
3470
3473
|
const {
|
|
@@ -3472,19 +3475,19 @@ class xi {
|
|
|
3472
3475
|
fixedRightWidth: e,
|
|
3473
3476
|
scrollX: i,
|
|
3474
3477
|
header: s,
|
|
3475
|
-
|
|
3476
|
-
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE:
|
|
3478
|
+
stageWidth: r,
|
|
3479
|
+
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3477
3480
|
} = this.ctx;
|
|
3478
|
-
let
|
|
3479
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3481
|
+
let h = this.y;
|
|
3482
|
+
if (this.ctx.config.FOOTER_FIXED || (h = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, h, t, this.height, {
|
|
3480
3483
|
fillColor: o,
|
|
3481
3484
|
side: "right",
|
|
3482
3485
|
shadowWidth: 4,
|
|
3483
3486
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3484
3487
|
colorEnd: "rgba(0,0,0,0)"
|
|
3485
|
-
}), i < Math.floor(s.width -
|
|
3486
|
-
const
|
|
3487
|
-
this.ctx.paint.drawShadow(
|
|
3488
|
+
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3489
|
+
const l = s.width - (this.x + this.width) + r - e;
|
|
3490
|
+
this.ctx.paint.drawShadow(l + 1, h, e, this.height, {
|
|
3488
3491
|
fillColor: o,
|
|
3489
3492
|
side: "left",
|
|
3490
3493
|
shadowWidth: 4,
|
|
@@ -3521,7 +3524,6 @@ class xi {
|
|
|
3521
3524
|
}
|
|
3522
3525
|
}
|
|
3523
3526
|
class ui {
|
|
3524
|
-
// 垂直滚动定时器
|
|
3525
3527
|
constructor(t) {
|
|
3526
3528
|
c(this, "isCut", !1);
|
|
3527
3529
|
c(this, "isMultipleRow", !1);
|
|
@@ -3531,13 +3533,15 @@ class ui {
|
|
|
3531
3533
|
c(this, "timerX", 0);
|
|
3532
3534
|
// 水平滚动定时器
|
|
3533
3535
|
c(this, "timerY", 0);
|
|
3536
|
+
// 垂直滚动定时器
|
|
3537
|
+
c(this, "adjustTimer", 0);
|
|
3534
3538
|
this.ctx = t, this.init();
|
|
3535
3539
|
}
|
|
3536
3540
|
init() {
|
|
3537
3541
|
this.ctx.on(
|
|
3538
3542
|
"mousemove",
|
|
3539
3543
|
Zt((t) => {
|
|
3540
|
-
const {
|
|
3544
|
+
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget() && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
|
|
3541
3545
|
(this.ctx.selectorMove || this.ctx.autofillMove) && (s ? this.stopAdjustPosition() : this.startAdjustPosition(t));
|
|
3542
3546
|
}, 100)
|
|
3543
3547
|
), this.ctx.on("cellHoverChange", (t) => {
|
|
@@ -3549,7 +3553,7 @@ class ui {
|
|
|
3549
3553
|
this.isMultipleRow || this.mouseenter();
|
|
3550
3554
|
}
|
|
3551
3555
|
}), this.ctx.on("cellMousedown", (t, e) => {
|
|
3552
|
-
if (this.ctx.isTarget(
|
|
3556
|
+
if (this.ctx.isTarget() && this.ctx.stageElement.style.cursor !== "pointer" && !this.ctx.isPointer && this.ctx.stageElement.style.cursor !== "crosshair") {
|
|
3553
3557
|
if (t.operation) {
|
|
3554
3558
|
this.isMultipleRow = !0, this.selectRows(t);
|
|
3555
3559
|
return;
|
|
@@ -3559,7 +3563,7 @@ class ui {
|
|
|
3559
3563
|
}), this.ctx.on("cellHeaderHoverChange", (t) => {
|
|
3560
3564
|
this.ctx.mousedown && this.selectCols(t);
|
|
3561
3565
|
}), this.ctx.on("cellHeaderMousedown", (t) => {
|
|
3562
|
-
this.ctx.
|
|
3566
|
+
this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || this.selectCols(t));
|
|
3563
3567
|
}), this.ctx.on("keydown", (t) => {
|
|
3564
3568
|
if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
|
|
3565
3569
|
this.paste();
|
|
@@ -3614,27 +3618,27 @@ class ui {
|
|
|
3614
3618
|
const { ENABLE_SELECTOR_SPAN_COL: i, ENABLE_SELECTOR_SPAN_ROW: s } = this.ctx.config;
|
|
3615
3619
|
let r = t, o = e;
|
|
3616
3620
|
if (!s) {
|
|
3617
|
-
const [
|
|
3618
|
-
o = [
|
|
3621
|
+
const [a] = o;
|
|
3622
|
+
o = [a, a];
|
|
3619
3623
|
}
|
|
3620
3624
|
if (!i) {
|
|
3621
|
-
const [
|
|
3622
|
-
r = [
|
|
3625
|
+
const [a] = r;
|
|
3626
|
+
r = [a, a];
|
|
3623
3627
|
}
|
|
3624
3628
|
if (JSON.stringify(this.ctx.selector.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.selector.yArr) !== JSON.stringify(o)) {
|
|
3625
3629
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3626
3630
|
const {
|
|
3627
|
-
SELECTOR_AREA_MIN_X:
|
|
3628
|
-
SELECTOR_AREA_MAX_X:
|
|
3629
|
-
SELECTOR_AREA_MIN_Y:
|
|
3631
|
+
SELECTOR_AREA_MIN_X: a,
|
|
3632
|
+
SELECTOR_AREA_MAX_X: h,
|
|
3633
|
+
SELECTOR_AREA_MIN_Y: l,
|
|
3630
3634
|
SELECTOR_AREA_MAX_Y: f,
|
|
3631
3635
|
SELECTOR_AREA_MAX_X_OFFSET: d,
|
|
3632
3636
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
3633
|
-
} = this.ctx.config, u =
|
|
3634
|
-
let [y,
|
|
3635
|
-
if (y < u ||
|
|
3637
|
+
} = this.ctx.config, u = a, g = h || this.ctx.maxColIndex - d, w = l, p = f || this.ctx.maxRowIndex - x;
|
|
3638
|
+
let [y, b] = r, [m, E] = o;
|
|
3639
|
+
if (y < u || b > g || m < w || E > p)
|
|
3636
3640
|
return;
|
|
3637
|
-
this.ctx.selector.xArr = [Math.max(u, y), Math.min(
|
|
3641
|
+
this.ctx.selector.xArr = [Math.max(u, y), Math.min(g, b)], this.ctx.selector.yArr = [Math.max(w, m), Math.min(p, E)], this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
|
|
3638
3642
|
}
|
|
3639
3643
|
}
|
|
3640
3644
|
selectCols(t) {
|
|
@@ -3646,17 +3650,17 @@ class ui {
|
|
|
3646
3650
|
}
|
|
3647
3651
|
const { SELECTOR_AREA_MIN_Y: e, SELECTOR_AREA_MAX_Y: i, SELECTOR_AREA_MAX_Y_OFFSET: s } = this.ctx.config, r = e, o = i || this.ctx.maxRowIndex - s;
|
|
3648
3652
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3649
|
-
const { colIndex:
|
|
3650
|
-
if (this.ctx.clearSelector(), t.colIndex >=
|
|
3651
|
-
const
|
|
3652
|
-
this.setSelector(
|
|
3653
|
+
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
3654
|
+
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
3655
|
+
const h = [a, t.colIndex + t.colspan - 1], l = [r, o];
|
|
3656
|
+
this.setSelector(h, l);
|
|
3653
3657
|
} else {
|
|
3654
|
-
const
|
|
3655
|
-
this.setSelector(
|
|
3658
|
+
const h = [t.colIndex, a], l = [r, o];
|
|
3659
|
+
this.setSelector(h, l);
|
|
3656
3660
|
}
|
|
3657
3661
|
} else {
|
|
3658
|
-
const
|
|
3659
|
-
this.setSelector(
|
|
3662
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], h = [r, o];
|
|
3663
|
+
this.setSelector(a, h);
|
|
3660
3664
|
}
|
|
3661
3665
|
}
|
|
3662
3666
|
selectAll() {
|
|
@@ -3669,29 +3673,29 @@ class ui {
|
|
|
3669
3673
|
SELECTOR_AREA_MAX_X: s,
|
|
3670
3674
|
SELECTOR_AREA_MIN_Y: r,
|
|
3671
3675
|
SELECTOR_AREA_MAX_Y: o,
|
|
3672
|
-
SELECTOR_AREA_MAX_X_OFFSET:
|
|
3673
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3674
|
-
} = this.ctx.config,
|
|
3675
|
-
this.setSelector(u,
|
|
3676
|
+
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3677
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
3678
|
+
} = this.ctx.config, l = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - h, u = [l, f], g = [d, x];
|
|
3679
|
+
this.setSelector(u, g);
|
|
3676
3680
|
}
|
|
3677
3681
|
}
|
|
3678
3682
|
selectRows(t, e = !0) {
|
|
3679
3683
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE || !this.ctx.config.ENABLE_SELECTOR_ALL_COLS || this.ctx.autofillMove || this.ctx.editing)
|
|
3680
3684
|
return;
|
|
3681
|
-
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: r } = this.ctx.config, o = s || this.ctx.maxColIndex - r,
|
|
3685
|
+
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: r } = this.ctx.config, o = s || this.ctx.maxColIndex - r, a = i;
|
|
3682
3686
|
if (e) {
|
|
3683
3687
|
this.ctx.setFocusCell(t);
|
|
3684
|
-
const
|
|
3685
|
-
this.setSelector(
|
|
3688
|
+
const h = [a, o], l = [t.rowIndex, t.rowIndex];
|
|
3689
|
+
this.setSelector(h, l);
|
|
3686
3690
|
}
|
|
3687
3691
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3688
|
-
const { rowIndex:
|
|
3689
|
-
if (t.rowIndex >=
|
|
3690
|
-
const
|
|
3691
|
-
this.setSelector(
|
|
3692
|
+
const { rowIndex: h } = this.ctx.focusCell;
|
|
3693
|
+
if (t.rowIndex >= h) {
|
|
3694
|
+
const l = [a, o], f = [h, t.rowIndex];
|
|
3695
|
+
this.setSelector(l, f);
|
|
3692
3696
|
} else {
|
|
3693
|
-
const
|
|
3694
|
-
this.setSelector(
|
|
3697
|
+
const l = [a, o], f = [t.rowIndex, h];
|
|
3698
|
+
this.setSelector(l, f);
|
|
3695
3699
|
}
|
|
3696
3700
|
}
|
|
3697
3701
|
}
|
|
@@ -3700,7 +3704,7 @@ class ui {
|
|
|
3700
3704
|
return;
|
|
3701
3705
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3702
3706
|
if (t && e && i) {
|
|
3703
|
-
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r),
|
|
3707
|
+
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r), h = Math.min(i.rowIndex, s), l = Math.max(i.rowIndex, s), f = [o, a], d = [h, l];
|
|
3704
3708
|
this.setSelector(f, d);
|
|
3705
3709
|
}
|
|
3706
3710
|
}
|
|
@@ -3708,7 +3712,7 @@ class ui {
|
|
|
3708
3712
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3709
3713
|
if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
|
|
3710
3714
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3711
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex:
|
|
3715
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e, h = Math.min(o, s), l = Math.max(o, s), f = Math.min(a, r), d = Math.max(a, r), x = [h, l], u = [f, d];
|
|
3712
3716
|
this.setSelector(x, u);
|
|
3713
3717
|
} else {
|
|
3714
3718
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3738,15 +3742,15 @@ class ui {
|
|
|
3738
3742
|
return;
|
|
3739
3743
|
const { value: t } = this.ctx.getSelectedData(), e = ei(t);
|
|
3740
3744
|
navigator.clipboard ? navigator.clipboard.writeText(e).then(() => {
|
|
3741
|
-
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("setCopy", this.ctx.selector), this.ctx.emit("
|
|
3745
|
+
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("setCopy", this.ctx.selector), this.ctx.emit("drawView");
|
|
3742
3746
|
}).catch((i) => console.error("复制失败:", i)) : console.error("当前浏览器不支持Clipboard API");
|
|
3743
3747
|
}
|
|
3744
3748
|
clearSelectedData(t, e, i = !1) {
|
|
3745
3749
|
let s = [];
|
|
3746
3750
|
const r = /* @__PURE__ */ new Set();
|
|
3747
|
-
for (let
|
|
3748
|
-
for (let
|
|
3749
|
-
const
|
|
3751
|
+
for (let a = 0; a <= e[1] - e[0]; a++)
|
|
3752
|
+
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
3753
|
+
const l = a + e[0], f = h + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(l, f);
|
|
3750
3754
|
if (d) {
|
|
3751
3755
|
const { rowKey: x, key: u } = d;
|
|
3752
3756
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
@@ -3764,9 +3768,9 @@ class ui {
|
|
|
3764
3768
|
return s;
|
|
3765
3769
|
this.ctx.database.batchSetItemValue(s, !0);
|
|
3766
3770
|
let o = [];
|
|
3767
|
-
return r.forEach((
|
|
3768
|
-
o.push(this.ctx.database.getRowDataItemForRowKey(
|
|
3769
|
-
}), this.ctx.emit("clearSelectedDataChange", s, o), this.ctx.emit("
|
|
3771
|
+
return r.forEach((a) => {
|
|
3772
|
+
o.push(this.ctx.database.getRowDataItemForRowKey(a));
|
|
3773
|
+
}), this.ctx.emit("clearSelectedDataChange", s, o), this.ctx.emit("drawView"), s;
|
|
3770
3774
|
}
|
|
3771
3775
|
paste() {
|
|
3772
3776
|
if (!navigator.clipboard) {
|
|
@@ -3777,20 +3781,20 @@ class ui {
|
|
|
3777
3781
|
if (this.ctx.selector.enable && t) {
|
|
3778
3782
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
3779
3783
|
navigator.clipboard.readText().then((r) => {
|
|
3780
|
-
let o = ti(r),
|
|
3781
|
-
for (let
|
|
3782
|
-
const f = o[
|
|
3784
|
+
let o = ti(r), a = [];
|
|
3785
|
+
for (let l = 0; l <= o.length - 1; l++) {
|
|
3786
|
+
const f = o[l].length;
|
|
3783
3787
|
for (let d = 0; d <= f - 1; d++) {
|
|
3784
|
-
const x =
|
|
3788
|
+
const x = l + e, u = d + i, g = o[l][d], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3785
3789
|
x,
|
|
3786
3790
|
u
|
|
3787
3791
|
);
|
|
3788
|
-
if (
|
|
3789
|
-
const { rowKey:
|
|
3790
|
-
this.ctx.database.getReadonly(
|
|
3791
|
-
rowKey:
|
|
3792
|
+
if (w) {
|
|
3793
|
+
const { rowKey: p, key: y } = w;
|
|
3794
|
+
this.ctx.database.getReadonly(p, y) || (s.add(p), a.push({
|
|
3795
|
+
rowKey: p,
|
|
3792
3796
|
key: y,
|
|
3793
|
-
value:
|
|
3797
|
+
value: g,
|
|
3794
3798
|
row: {}
|
|
3795
3799
|
//内部有设置
|
|
3796
3800
|
}));
|
|
@@ -3798,23 +3802,23 @@ class ui {
|
|
|
3798
3802
|
}
|
|
3799
3803
|
}
|
|
3800
3804
|
if (this.isCut) {
|
|
3801
|
-
const
|
|
3805
|
+
const l = this.clearSelectedData(
|
|
3802
3806
|
this.ctx.selector.xArrCopy,
|
|
3803
3807
|
this.ctx.selector.yArrCopy,
|
|
3804
3808
|
!0
|
|
3805
3809
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3806
|
-
), f =
|
|
3807
|
-
|
|
3808
|
-
f.includes(`${d.rowKey}-${d.key}`) ||
|
|
3810
|
+
), f = a.map((d) => `${d.rowKey}-${d.key}`);
|
|
3811
|
+
l.forEach((d) => {
|
|
3812
|
+
f.includes(`${d.rowKey}-${d.key}`) || a.unshift(d);
|
|
3809
3813
|
}), this.isCut = !1;
|
|
3810
3814
|
}
|
|
3811
|
-
if (!
|
|
3815
|
+
if (!a.length)
|
|
3812
3816
|
return;
|
|
3813
|
-
this.ctx.database.batchSetItemValue(
|
|
3814
|
-
let
|
|
3815
|
-
s.forEach((
|
|
3816
|
-
|
|
3817
|
-
}), this.ctx.emit("pasteChange",
|
|
3817
|
+
this.ctx.database.batchSetItemValue(a, !0);
|
|
3818
|
+
let h = [];
|
|
3819
|
+
s.forEach((l) => {
|
|
3820
|
+
h.push(this.ctx.database.getRowDataItemForRowKey(l));
|
|
3821
|
+
}), this.ctx.emit("pasteChange", a, h), this.clearCopyLine(), this.ctx.emit("drawView");
|
|
3818
3822
|
}).catch((r) => {
|
|
3819
3823
|
console.error("获取剪贴板内容失败:", r);
|
|
3820
3824
|
});
|
|
@@ -3830,7 +3834,7 @@ class ui {
|
|
|
3830
3834
|
if (!e)
|
|
3831
3835
|
return;
|
|
3832
3836
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3833
|
-
const r = 0, o = 0,
|
|
3837
|
+
const r = 0, o = 0, a = this.ctx.maxColIndex, h = this.ctx.maxRowIndex;
|
|
3834
3838
|
switch (t) {
|
|
3835
3839
|
case "LEFT":
|
|
3836
3840
|
i > r && i--;
|
|
@@ -3839,14 +3843,14 @@ class ui {
|
|
|
3839
3843
|
s > o && s--;
|
|
3840
3844
|
break;
|
|
3841
3845
|
case "RIGHT":
|
|
3842
|
-
i <
|
|
3846
|
+
i < a && i++;
|
|
3843
3847
|
break;
|
|
3844
3848
|
case "BOTTOM":
|
|
3845
|
-
s <
|
|
3849
|
+
s < h && s++;
|
|
3846
3850
|
break;
|
|
3847
3851
|
}
|
|
3848
|
-
const
|
|
3849
|
-
d && (d.operation || this.isInSettingRange(d.rowIndex, d.colIndex) && (this.ctx.setFocusCell(d), this.setSelector(
|
|
3852
|
+
const l = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
3853
|
+
d && (d.operation || this.isInSettingRange(d.rowIndex, d.colIndex) && (this.ctx.setFocusCell(d), this.setSelector(l, f), this.adjustBoundaryPosition(), this.ctx.emit("drawView")));
|
|
3850
3854
|
}
|
|
3851
3855
|
stopAdjustPosition() {
|
|
3852
3856
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3858,33 +3862,33 @@ class ui {
|
|
|
3858
3862
|
SELECTOR_AREA_MAX_X: s,
|
|
3859
3863
|
SELECTOR_AREA_MIN_Y: r,
|
|
3860
3864
|
SELECTOR_AREA_MAX_Y: o,
|
|
3861
|
-
SELECTOR_AREA_MAX_X_OFFSET:
|
|
3862
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3863
|
-
} = this.ctx.config,
|
|
3864
|
-
return !(e <
|
|
3865
|
+
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3866
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
3867
|
+
} = this.ctx.config, l = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - h;
|
|
3868
|
+
return !(e < l || e > f || t < d || t > x);
|
|
3865
3869
|
}
|
|
3866
3870
|
/**
|
|
3867
3871
|
* 调整滚动条位置,让到达边界时自动滚动
|
|
3868
3872
|
*/
|
|
3869
3873
|
startAdjustPosition(t) {
|
|
3870
|
-
const { offsetX: e, offsetY: i } = t;
|
|
3874
|
+
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t);
|
|
3871
3875
|
let s = "", r = "";
|
|
3872
3876
|
if (e < 0 ? s = "left" : e > this.ctx.body.visibleWidth && (s = "right"), i < this.ctx.header.visibleHeight ? r = "top" : i > this.ctx.header.visibleHeight + this.ctx.body.visibleHeight && (r = "bottom"), s && this.adjustPositionX !== s) {
|
|
3873
3877
|
this.adjustPositionX = s;
|
|
3874
|
-
let
|
|
3878
|
+
let a = 10 * (s === "left" ? -1 : 1);
|
|
3875
3879
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3876
|
-
|
|
3877
|
-
const { scrollX:
|
|
3878
|
-
(
|
|
3880
|
+
a *= 1.5;
|
|
3881
|
+
const { scrollX: h } = this.ctx, l = h + a;
|
|
3882
|
+
(l < 0 || l > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(l);
|
|
3879
3883
|
}, 100);
|
|
3880
3884
|
}
|
|
3881
3885
|
if (r && this.adjustPositionY !== r) {
|
|
3882
3886
|
this.adjustPositionY = r;
|
|
3883
|
-
let
|
|
3887
|
+
let a = 10 * (r === "top" ? -1 : 1);
|
|
3884
3888
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3885
|
-
|
|
3886
|
-
const { scrollY:
|
|
3887
|
-
(
|
|
3889
|
+
a *= 1.5;
|
|
3890
|
+
const { scrollY: h } = this.ctx, l = h + a;
|
|
3891
|
+
(l < 0 || l > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(l);
|
|
3888
3892
|
}, 100);
|
|
3889
3893
|
}
|
|
3890
3894
|
}
|
|
@@ -3892,14 +3896,26 @@ class ui {
|
|
|
3892
3896
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
3893
3897
|
*/
|
|
3894
3898
|
adjustBoundaryPosition() {
|
|
3895
|
-
const {
|
|
3896
|
-
|
|
3899
|
+
const {
|
|
3900
|
+
stageHeight: t,
|
|
3901
|
+
stageWidth: e,
|
|
3902
|
+
focusCell: i,
|
|
3903
|
+
fixedRightWidth: s,
|
|
3904
|
+
fixedLeftWidth: r,
|
|
3905
|
+
header: o,
|
|
3906
|
+
footer: a,
|
|
3907
|
+
scrollX: h,
|
|
3908
|
+
scrollY: l
|
|
3909
|
+
} = this.ctx;
|
|
3910
|
+
if (!i)
|
|
3897
3911
|
return;
|
|
3898
|
-
const { SCROLLER_TRACK_SIZE:
|
|
3899
|
-
let
|
|
3900
|
-
|
|
3901
|
-
const
|
|
3902
|
-
|
|
3912
|
+
const { SCROLLER_TRACK_SIZE: f = 0, FOOTER_FIXED: d } = this.ctx.config;
|
|
3913
|
+
let x = 0;
|
|
3914
|
+
d && (x = a.visibleHeight);
|
|
3915
|
+
const u = r - i.drawX + 1, g = i.drawX + i.width - (e - s) + 1, w = o.height - i.drawY, p = i.drawY + i.height - (t - x - f);
|
|
3916
|
+
this.adjustTimer && (clearTimeout(this.adjustTimer), this.adjustTimer = 0), this.adjustTimer = setTimeout(() => {
|
|
3917
|
+
g > 0 && !i.fixed ? this.ctx.setScrollX(h + g) : u > 0 && !i.fixed && this.ctx.setScrollX(h - u), w > 0 ? this.ctx.setScrollY(l - w) : p > 0 && this.ctx.setScrollY(l + p);
|
|
3918
|
+
}, 167);
|
|
3903
3919
|
}
|
|
3904
3920
|
destroy() {
|
|
3905
3921
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -3912,15 +3928,15 @@ class gi {
|
|
|
3912
3928
|
}
|
|
3913
3929
|
init() {
|
|
3914
3930
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3915
|
-
this.ctx.
|
|
3916
|
-
const {
|
|
3917
|
-
if (this.ctx.config.ENABLE_AUTOFILL &&
|
|
3918
|
-
const p =
|
|
3919
|
-
|
|
3931
|
+
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
|
|
3932
|
+
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1], h = o[1], { colIndex: l, rowIndex: f, drawX: d, drawY: x, width: u, height: g } = t;
|
|
3933
|
+
if (this.ctx.config.ENABLE_AUTOFILL && l === a && f === h) {
|
|
3934
|
+
const p = d + u - 6, y = x + g - 6;
|
|
3935
|
+
i > p && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
3920
3936
|
}
|
|
3921
3937
|
this.mouseenter(t);
|
|
3922
3938
|
}), this.ctx.on("cellMousedown", () => {
|
|
3923
|
-
this.ctx.
|
|
3939
|
+
this.ctx.stageElement.style.cursor === "crosshair" && this.setMousedown();
|
|
3924
3940
|
}), this.ctx.on("mouseup", () => {
|
|
3925
3941
|
this.setMouseUp();
|
|
3926
3942
|
});
|
|
@@ -3945,28 +3961,28 @@ class gi {
|
|
|
3945
3961
|
const { ENABLE_AUTOFILL: i, ENABLE_SELECTOR_SPAN_COL: s, ENABLE_SELECTOR_SPAN_ROW: r } = this.ctx.config;
|
|
3946
3962
|
if (!i)
|
|
3947
3963
|
return;
|
|
3948
|
-
let o = t,
|
|
3964
|
+
let o = t, a = e;
|
|
3949
3965
|
if (!r) {
|
|
3950
|
-
const [
|
|
3951
|
-
|
|
3966
|
+
const [h] = a;
|
|
3967
|
+
a = [h, h];
|
|
3952
3968
|
}
|
|
3953
3969
|
if (!s) {
|
|
3954
|
-
const [
|
|
3955
|
-
o = [
|
|
3970
|
+
const [h] = o;
|
|
3971
|
+
o = [h, h];
|
|
3956
3972
|
}
|
|
3957
|
-
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(
|
|
3973
|
+
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
3958
3974
|
const {
|
|
3959
|
-
SELECTOR_AREA_MIN_X:
|
|
3960
|
-
SELECTOR_AREA_MAX_X:
|
|
3975
|
+
SELECTOR_AREA_MIN_X: h,
|
|
3976
|
+
SELECTOR_AREA_MAX_X: l,
|
|
3961
3977
|
SELECTOR_AREA_MIN_Y: f,
|
|
3962
3978
|
SELECTOR_AREA_MAX_Y: d,
|
|
3963
3979
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
3964
3980
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
3965
|
-
} = this.ctx.config,
|
|
3966
|
-
let [
|
|
3967
|
-
if (
|
|
3981
|
+
} = this.ctx.config, g = h, w = l || this.ctx.maxColIndex - x, p = f, y = d || this.ctx.maxRowIndex - u;
|
|
3982
|
+
let [b, m] = o, [E, C] = a;
|
|
3983
|
+
if (b < g || E < p)
|
|
3968
3984
|
return;
|
|
3969
|
-
this.ctx.autofill.xArr = [Math.max(
|
|
3985
|
+
this.ctx.autofill.xArr = [Math.max(g, b), Math.min(w, m)], this.ctx.autofill.yArr = [Math.max(p, E), Math.min(y, C)], this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
3970
3986
|
}
|
|
3971
3987
|
}
|
|
3972
3988
|
/**
|
|
@@ -3976,47 +3992,47 @@ class gi {
|
|
|
3976
3992
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
3977
3993
|
for (let d = 0; d <= e.yArr[1] - e.yArr[0]; d++)
|
|
3978
3994
|
for (let x = 0; x <= e.xArr[1] - e.xArr[0]; x++) {
|
|
3979
|
-
const u = d + e.yArr[0],
|
|
3980
|
-
i.set(`${u}-${
|
|
3995
|
+
const u = d + e.yArr[0], g = x + e.xArr[0];
|
|
3996
|
+
i.set(`${u}-${g}`, !0);
|
|
3981
3997
|
}
|
|
3982
|
-
const { value: s } = e, r = s[0].length, o = s.length,
|
|
3983
|
-
let
|
|
3984
|
-
for (let d = 0; d <=
|
|
3985
|
-
for (let x = 0; x <=
|
|
3986
|
-
const u = x +
|
|
3987
|
-
if (
|
|
3988
|
-
const { rowKey:
|
|
3989
|
-
this.ctx.database.getReadonly(
|
|
3990
|
-
rowKey:
|
|
3998
|
+
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr, h = this.ctx.autofill.yArr;
|
|
3999
|
+
let l = [];
|
|
4000
|
+
for (let d = 0; d <= h[1] - h[0]; d++)
|
|
4001
|
+
for (let x = 0; x <= a[1] - a[0]; x++) {
|
|
4002
|
+
const u = x + a[0], g = d + h[0], w = s[d % o][x % r], p = this.ctx.database.getItemValueForRowIndexAndColIndex(g, u), y = `${g}-${u}`;
|
|
4003
|
+
if (p && !i.has(y)) {
|
|
4004
|
+
const { rowKey: b, key: m } = p;
|
|
4005
|
+
this.ctx.database.getReadonly(b, m) || (t.add(b), l.push({
|
|
4006
|
+
rowKey: b,
|
|
3991
4007
|
key: m,
|
|
3992
|
-
value:
|
|
4008
|
+
value: w,
|
|
3993
4009
|
row: {}
|
|
3994
4010
|
}));
|
|
3995
4011
|
}
|
|
3996
4012
|
}
|
|
3997
|
-
if (!
|
|
4013
|
+
if (!l.length)
|
|
3998
4014
|
return;
|
|
3999
|
-
this.ctx.database.batchSetItemValue(
|
|
4015
|
+
this.ctx.database.batchSetItemValue(l, !0);
|
|
4000
4016
|
let f = [];
|
|
4001
4017
|
t.forEach((d) => {
|
|
4002
4018
|
f.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
4003
|
-
}), this.ctx.emit("autofillChange",
|
|
4019
|
+
}), this.ctx.emit("autofillChange", l, f), this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.emit("draw");
|
|
4004
4020
|
}
|
|
4005
4021
|
mouseenter(t) {
|
|
4006
4022
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
4007
4023
|
return;
|
|
4008
4024
|
const { selector: e, autofill: i } = this.ctx;
|
|
4009
4025
|
if (this.ctx.mousedown && e.enable && i.enable) {
|
|
4010
|
-
const { rowIndex: s, colIndex: r } = t, o = e.xArr.slice(),
|
|
4011
|
-
s >= e.yArr[0] && s <= e.yArr[1] ? r > e.xArr[1] ? o.splice(1, 1, r) : r < e.xArr[0] && o.splice(0, 1, r) : s > e.yArr[1] ?
|
|
4026
|
+
const { rowIndex: s, colIndex: r } = t, o = e.xArr.slice(), a = e.yArr.slice();
|
|
4027
|
+
s >= e.yArr[0] && s <= e.yArr[1] ? r > e.xArr[1] ? o.splice(1, 1, r) : r < e.xArr[0] && o.splice(0, 1, r) : s > e.yArr[1] ? a.splice(1, 1, s) : s < e.yArr[0] && a.splice(0, 1, s), this.setAutofill(o, a);
|
|
4012
4028
|
}
|
|
4013
4029
|
}
|
|
4014
4030
|
destroy() {
|
|
4015
4031
|
}
|
|
4016
4032
|
}
|
|
4017
|
-
const rt = Math.min, U = Math.max, ft = Math.round, V = (
|
|
4018
|
-
x:
|
|
4019
|
-
y:
|
|
4033
|
+
const rt = Math.min, U = Math.max, ft = Math.round, V = (n) => ({
|
|
4034
|
+
x: n,
|
|
4035
|
+
y: n
|
|
4020
4036
|
}), wi = {
|
|
4021
4037
|
left: "right",
|
|
4022
4038
|
right: "left",
|
|
@@ -4026,46 +4042,46 @@ const rt = Math.min, U = Math.max, ft = Math.round, V = (a) => ({
|
|
|
4026
4042
|
start: "end",
|
|
4027
4043
|
end: "start"
|
|
4028
4044
|
};
|
|
4029
|
-
function It(
|
|
4030
|
-
return U(
|
|
4045
|
+
function It(n, t, e) {
|
|
4046
|
+
return U(n, rt(t, e));
|
|
4031
4047
|
}
|
|
4032
|
-
function at(
|
|
4033
|
-
return typeof
|
|
4048
|
+
function at(n, t) {
|
|
4049
|
+
return typeof n == "function" ? n(t) : n;
|
|
4034
4050
|
}
|
|
4035
|
-
function q(
|
|
4036
|
-
return
|
|
4051
|
+
function q(n) {
|
|
4052
|
+
return n.split("-")[0];
|
|
4037
4053
|
}
|
|
4038
|
-
function ct(
|
|
4039
|
-
return
|
|
4054
|
+
function ct(n) {
|
|
4055
|
+
return n.split("-")[1];
|
|
4040
4056
|
}
|
|
4041
|
-
function re(
|
|
4042
|
-
return
|
|
4057
|
+
function re(n) {
|
|
4058
|
+
return n === "x" ? "y" : "x";
|
|
4043
4059
|
}
|
|
4044
|
-
function
|
|
4045
|
-
return
|
|
4060
|
+
function Lt(n) {
|
|
4061
|
+
return n === "y" ? "height" : "width";
|
|
4046
4062
|
}
|
|
4047
|
-
function J(
|
|
4048
|
-
return ["top", "bottom"].includes(q(
|
|
4063
|
+
function J(n) {
|
|
4064
|
+
return ["top", "bottom"].includes(q(n)) ? "y" : "x";
|
|
4049
4065
|
}
|
|
4050
|
-
function
|
|
4051
|
-
return re(J(
|
|
4066
|
+
function Mt(n) {
|
|
4067
|
+
return re(J(n));
|
|
4052
4068
|
}
|
|
4053
|
-
function yi(
|
|
4069
|
+
function yi(n, t, e) {
|
|
4054
4070
|
e === void 0 && (e = !1);
|
|
4055
|
-
const i = ct(
|
|
4071
|
+
const i = ct(n), s = Mt(n), r = Lt(s);
|
|
4056
4072
|
let o = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4057
4073
|
return t.reference[r] > t.floating[r] && (o = xt(o)), [o, xt(o)];
|
|
4058
4074
|
}
|
|
4059
|
-
function mi(
|
|
4060
|
-
const t = xt(
|
|
4061
|
-
return [Ot(
|
|
4075
|
+
function mi(n) {
|
|
4076
|
+
const t = xt(n);
|
|
4077
|
+
return [Ot(n), t, Ot(t)];
|
|
4062
4078
|
}
|
|
4063
|
-
function Ot(
|
|
4064
|
-
return
|
|
4079
|
+
function Ot(n) {
|
|
4080
|
+
return n.replace(/start|end/g, (t) => pi[t]);
|
|
4065
4081
|
}
|
|
4066
|
-
function Ei(
|
|
4082
|
+
function Ei(n, t, e) {
|
|
4067
4083
|
const i = ["left", "right"], s = ["right", "left"], r = ["top", "bottom"], o = ["bottom", "top"];
|
|
4068
|
-
switch (
|
|
4084
|
+
switch (n) {
|
|
4069
4085
|
case "top":
|
|
4070
4086
|
case "bottom":
|
|
4071
4087
|
return e ? t ? s : i : t ? i : s;
|
|
@@ -4076,38 +4092,38 @@ function Ei(a, t, e) {
|
|
|
4076
4092
|
return [];
|
|
4077
4093
|
}
|
|
4078
4094
|
}
|
|
4079
|
-
function
|
|
4080
|
-
const s = ct(
|
|
4081
|
-
let r = Ei(q(
|
|
4095
|
+
function bi(n, t, e, i) {
|
|
4096
|
+
const s = ct(n);
|
|
4097
|
+
let r = Ei(q(n), e === "start", i);
|
|
4082
4098
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
4083
4099
|
}
|
|
4084
|
-
function xt(
|
|
4085
|
-
return
|
|
4100
|
+
function xt(n) {
|
|
4101
|
+
return n.replace(/left|right|bottom|top/g, (t) => wi[t]);
|
|
4086
4102
|
}
|
|
4087
|
-
function
|
|
4103
|
+
function Ci(n) {
|
|
4088
4104
|
return {
|
|
4089
4105
|
top: 0,
|
|
4090
4106
|
right: 0,
|
|
4091
4107
|
bottom: 0,
|
|
4092
4108
|
left: 0,
|
|
4093
|
-
...
|
|
4109
|
+
...n
|
|
4094
4110
|
};
|
|
4095
4111
|
}
|
|
4096
|
-
function oe(
|
|
4097
|
-
return typeof
|
|
4098
|
-
top:
|
|
4099
|
-
right:
|
|
4100
|
-
bottom:
|
|
4101
|
-
left:
|
|
4112
|
+
function oe(n) {
|
|
4113
|
+
return typeof n != "number" ? Ci(n) : {
|
|
4114
|
+
top: n,
|
|
4115
|
+
right: n,
|
|
4116
|
+
bottom: n,
|
|
4117
|
+
left: n
|
|
4102
4118
|
};
|
|
4103
4119
|
}
|
|
4104
|
-
function ut(
|
|
4120
|
+
function ut(n) {
|
|
4105
4121
|
const {
|
|
4106
4122
|
x: t,
|
|
4107
4123
|
y: e,
|
|
4108
4124
|
width: i,
|
|
4109
4125
|
height: s
|
|
4110
|
-
} =
|
|
4126
|
+
} = n;
|
|
4111
4127
|
return {
|
|
4112
4128
|
width: i,
|
|
4113
4129
|
height: s,
|
|
@@ -4119,14 +4135,14 @@ function ut(a) {
|
|
|
4119
4135
|
y: e
|
|
4120
4136
|
};
|
|
4121
4137
|
}
|
|
4122
|
-
function
|
|
4138
|
+
function Vt(n, t, e) {
|
|
4123
4139
|
let {
|
|
4124
4140
|
reference: i,
|
|
4125
4141
|
floating: s
|
|
4126
|
-
} =
|
|
4127
|
-
const r = J(t), o =
|
|
4142
|
+
} = n;
|
|
4143
|
+
const r = J(t), o = Mt(t), a = Lt(o), h = q(t), l = r === "y", f = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, x = i[a] / 2 - s[a] / 2;
|
|
4128
4144
|
let u;
|
|
4129
|
-
switch (
|
|
4145
|
+
switch (h) {
|
|
4130
4146
|
case "top":
|
|
4131
4147
|
u = {
|
|
4132
4148
|
x: f,
|
|
@@ -4159,38 +4175,38 @@ function zt(a, t, e) {
|
|
|
4159
4175
|
}
|
|
4160
4176
|
switch (ct(t)) {
|
|
4161
4177
|
case "start":
|
|
4162
|
-
u[o] -= x * (e &&
|
|
4178
|
+
u[o] -= x * (e && l ? -1 : 1);
|
|
4163
4179
|
break;
|
|
4164
4180
|
case "end":
|
|
4165
|
-
u[o] += x * (e &&
|
|
4181
|
+
u[o] += x * (e && l ? -1 : 1);
|
|
4166
4182
|
break;
|
|
4167
4183
|
}
|
|
4168
4184
|
return u;
|
|
4169
4185
|
}
|
|
4170
|
-
const vi = async (
|
|
4186
|
+
const vi = async (n, t, e) => {
|
|
4171
4187
|
const {
|
|
4172
4188
|
placement: i = "bottom",
|
|
4173
4189
|
strategy: s = "absolute",
|
|
4174
4190
|
middleware: r = [],
|
|
4175
4191
|
platform: o
|
|
4176
|
-
} = e,
|
|
4177
|
-
let
|
|
4178
|
-
reference:
|
|
4192
|
+
} = e, a = r.filter(Boolean), h = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4193
|
+
let l = await o.getElementRects({
|
|
4194
|
+
reference: n,
|
|
4179
4195
|
floating: t,
|
|
4180
4196
|
strategy: s
|
|
4181
4197
|
}), {
|
|
4182
4198
|
x: f,
|
|
4183
4199
|
y: d
|
|
4184
|
-
} =
|
|
4185
|
-
for (let
|
|
4200
|
+
} = Vt(l, i, h), x = i, u = {}, g = 0;
|
|
4201
|
+
for (let w = 0; w < a.length; w++) {
|
|
4186
4202
|
const {
|
|
4187
|
-
name:
|
|
4203
|
+
name: p,
|
|
4188
4204
|
fn: y
|
|
4189
|
-
} =
|
|
4190
|
-
x:
|
|
4205
|
+
} = a[w], {
|
|
4206
|
+
x: b,
|
|
4191
4207
|
y: m,
|
|
4192
4208
|
data: E,
|
|
4193
|
-
reset:
|
|
4209
|
+
reset: C
|
|
4194
4210
|
} = await y({
|
|
4195
4211
|
x: f,
|
|
4196
4212
|
y: d,
|
|
@@ -4198,27 +4214,27 @@ const vi = async (a, t, e) => {
|
|
|
4198
4214
|
placement: x,
|
|
4199
4215
|
strategy: s,
|
|
4200
4216
|
middlewareData: u,
|
|
4201
|
-
rects:
|
|
4217
|
+
rects: l,
|
|
4202
4218
|
platform: o,
|
|
4203
4219
|
elements: {
|
|
4204
|
-
reference:
|
|
4220
|
+
reference: n,
|
|
4205
4221
|
floating: t
|
|
4206
4222
|
}
|
|
4207
4223
|
});
|
|
4208
|
-
f =
|
|
4224
|
+
f = b ?? f, d = m ?? d, u = {
|
|
4209
4225
|
...u,
|
|
4210
|
-
[
|
|
4211
|
-
...u[
|
|
4226
|
+
[p]: {
|
|
4227
|
+
...u[p],
|
|
4212
4228
|
...E
|
|
4213
4229
|
}
|
|
4214
|
-
},
|
|
4215
|
-
reference:
|
|
4230
|
+
}, C && g <= 50 && (g++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (l = C.rects === !0 ? await o.getElementRects({
|
|
4231
|
+
reference: n,
|
|
4216
4232
|
floating: t,
|
|
4217
4233
|
strategy: s
|
|
4218
|
-
}) :
|
|
4234
|
+
}) : C.rects), {
|
|
4219
4235
|
x: f,
|
|
4220
4236
|
y: d
|
|
4221
|
-
} =
|
|
4237
|
+
} = Vt(l, x, h)), w = -1);
|
|
4222
4238
|
}
|
|
4223
4239
|
return {
|
|
4224
4240
|
x: f,
|
|
@@ -4228,7 +4244,7 @@ const vi = async (a, t, e) => {
|
|
|
4228
4244
|
middlewareData: u
|
|
4229
4245
|
};
|
|
4230
4246
|
};
|
|
4231
|
-
async function ne(
|
|
4247
|
+
async function ne(n, t) {
|
|
4232
4248
|
var e;
|
|
4233
4249
|
t === void 0 && (t = {});
|
|
4234
4250
|
const {
|
|
@@ -4236,46 +4252,46 @@ async function ne(a, t) {
|
|
|
4236
4252
|
y: s,
|
|
4237
4253
|
platform: r,
|
|
4238
4254
|
rects: o,
|
|
4239
|
-
elements:
|
|
4240
|
-
strategy:
|
|
4241
|
-
} =
|
|
4242
|
-
boundary:
|
|
4255
|
+
elements: a,
|
|
4256
|
+
strategy: h
|
|
4257
|
+
} = n, {
|
|
4258
|
+
boundary: l = "clippingAncestors",
|
|
4243
4259
|
rootBoundary: f = "viewport",
|
|
4244
4260
|
elementContext: d = "floating",
|
|
4245
4261
|
altBoundary: x = !1,
|
|
4246
4262
|
padding: u = 0
|
|
4247
|
-
} = at(t,
|
|
4248
|
-
element: (e = await (r.isElement == null ? void 0 : r.isElement(
|
|
4249
|
-
boundary:
|
|
4263
|
+
} = at(t, n), g = oe(u), p = a[x ? d === "floating" ? "reference" : "floating" : d], y = ut(await r.getClippingRect({
|
|
4264
|
+
element: (e = await (r.isElement == null ? void 0 : r.isElement(p))) == null || e ? p : p.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(a.floating)),
|
|
4265
|
+
boundary: l,
|
|
4250
4266
|
rootBoundary: f,
|
|
4251
|
-
strategy:
|
|
4252
|
-
})),
|
|
4267
|
+
strategy: h
|
|
4268
|
+
})), b = d === "floating" ? {
|
|
4253
4269
|
x: i,
|
|
4254
4270
|
y: s,
|
|
4255
4271
|
width: o.floating.width,
|
|
4256
4272
|
height: o.floating.height
|
|
4257
|
-
} : o.reference, m = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(
|
|
4273
|
+
} : o.reference, m = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a.floating)), E = await (r.isElement == null ? void 0 : r.isElement(m)) ? await (r.getScale == null ? void 0 : r.getScale(m)) || {
|
|
4258
4274
|
x: 1,
|
|
4259
4275
|
y: 1
|
|
4260
4276
|
} : {
|
|
4261
4277
|
x: 1,
|
|
4262
4278
|
y: 1
|
|
4263
|
-
},
|
|
4264
|
-
elements:
|
|
4265
|
-
rect:
|
|
4279
|
+
}, C = ut(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4280
|
+
elements: a,
|
|
4281
|
+
rect: b,
|
|
4266
4282
|
offsetParent: m,
|
|
4267
|
-
strategy:
|
|
4268
|
-
}) :
|
|
4283
|
+
strategy: h
|
|
4284
|
+
}) : b);
|
|
4269
4285
|
return {
|
|
4270
|
-
top: (y.top -
|
|
4271
|
-
bottom: (
|
|
4272
|
-
left: (y.left -
|
|
4273
|
-
right: (
|
|
4286
|
+
top: (y.top - C.top + g.top) / E.y,
|
|
4287
|
+
bottom: (C.bottom - y.bottom + g.bottom) / E.y,
|
|
4288
|
+
left: (y.left - C.left + g.left) / E.x,
|
|
4289
|
+
right: (C.right - y.right + g.right) / E.x
|
|
4274
4290
|
};
|
|
4275
4291
|
}
|
|
4276
|
-
const Ri = (
|
|
4292
|
+
const Ri = (n) => ({
|
|
4277
4293
|
name: "arrow",
|
|
4278
|
-
options:
|
|
4294
|
+
options: n,
|
|
4279
4295
|
async fn(t) {
|
|
4280
4296
|
const {
|
|
4281
4297
|
x: e,
|
|
@@ -4283,21 +4299,21 @@ const Ri = (a) => ({
|
|
|
4283
4299
|
placement: s,
|
|
4284
4300
|
rects: r,
|
|
4285
4301
|
platform: o,
|
|
4286
|
-
elements:
|
|
4287
|
-
middlewareData:
|
|
4302
|
+
elements: a,
|
|
4303
|
+
middlewareData: h
|
|
4288
4304
|
} = t, {
|
|
4289
|
-
element:
|
|
4305
|
+
element: l,
|
|
4290
4306
|
padding: f = 0
|
|
4291
|
-
} = at(
|
|
4292
|
-
if (
|
|
4307
|
+
} = at(n, t) || {};
|
|
4308
|
+
if (l == null)
|
|
4293
4309
|
return {};
|
|
4294
4310
|
const d = oe(f), x = {
|
|
4295
4311
|
x: e,
|
|
4296
4312
|
y: i
|
|
4297
|
-
}, u =
|
|
4313
|
+
}, u = Mt(s), g = Lt(u), w = await o.getDimensions(l), p = u === "y", y = p ? "top" : "left", b = p ? "bottom" : "right", m = p ? "clientHeight" : "clientWidth", E = r.reference[g] + r.reference[u] - x[u] - r.floating[g], C = x[u] - r.reference[u], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l));
|
|
4298
4314
|
let T = R ? R[m] : 0;
|
|
4299
|
-
(!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T =
|
|
4300
|
-
const A = E / 2 -
|
|
4315
|
+
(!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T = a.floating[m] || r.floating[g]);
|
|
4316
|
+
const A = E / 2 - C / 2, L = T / 2 - w[g] / 2 - 1, D = rt(d[y], L), B = rt(d[b], L), I = D, S = T - w[g] - B, O = T / 2 - w[g] / 2 + A, G = It(I, O, S), Y = !h.arrow && ct(s) != null && O !== G && r.reference[g] / 2 - (O < I ? D : B) - w[g] / 2 < 0, k = Y ? O < I ? O - I : O - S : 0;
|
|
4301
4317
|
return {
|
|
4302
4318
|
[u]: x[u] + k,
|
|
4303
4319
|
data: {
|
|
@@ -4310,33 +4326,33 @@ const Ri = (a) => ({
|
|
|
4310
4326
|
reset: Y
|
|
4311
4327
|
};
|
|
4312
4328
|
}
|
|
4313
|
-
}), _i = function(
|
|
4314
|
-
return
|
|
4329
|
+
}), _i = function(n) {
|
|
4330
|
+
return n === void 0 && (n = {}), {
|
|
4315
4331
|
name: "flip",
|
|
4316
|
-
options:
|
|
4332
|
+
options: n,
|
|
4317
4333
|
async fn(t) {
|
|
4318
4334
|
var e, i;
|
|
4319
4335
|
const {
|
|
4320
4336
|
placement: s,
|
|
4321
4337
|
middlewareData: r,
|
|
4322
4338
|
rects: o,
|
|
4323
|
-
initialPlacement:
|
|
4324
|
-
platform:
|
|
4325
|
-
elements:
|
|
4339
|
+
initialPlacement: a,
|
|
4340
|
+
platform: h,
|
|
4341
|
+
elements: l
|
|
4326
4342
|
} = t, {
|
|
4327
4343
|
mainAxis: f = !0,
|
|
4328
4344
|
crossAxis: d = !0,
|
|
4329
4345
|
fallbackPlacements: x,
|
|
4330
4346
|
fallbackStrategy: u = "bestFit",
|
|
4331
|
-
fallbackAxisSideDirection:
|
|
4332
|
-
flipAlignment:
|
|
4333
|
-
...
|
|
4334
|
-
} = at(
|
|
4347
|
+
fallbackAxisSideDirection: g = "none",
|
|
4348
|
+
flipAlignment: w = !0,
|
|
4349
|
+
...p
|
|
4350
|
+
} = at(n, t);
|
|
4335
4351
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4336
4352
|
return {};
|
|
4337
|
-
const y = q(s),
|
|
4338
|
-
!x && R &&
|
|
4339
|
-
const T = [
|
|
4353
|
+
const y = q(s), b = J(a), m = q(a) === a, E = await (h.isRTL == null ? void 0 : h.isRTL(l.floating)), C = x || (m || !w ? [xt(a)] : mi(a)), R = g !== "none";
|
|
4354
|
+
!x && R && C.push(...bi(a, w, g, E));
|
|
4355
|
+
const T = [a, ...C], A = await ne(t, p), L = [];
|
|
4340
4356
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4341
4357
|
if (f && L.push(A[y]), d) {
|
|
4342
4358
|
const O = yi(s, o, E);
|
|
@@ -4366,7 +4382,7 @@ const Ri = (a) => ({
|
|
|
4366
4382
|
const k = (S = D.filter((W) => {
|
|
4367
4383
|
if (R) {
|
|
4368
4384
|
const P = J(W.placement);
|
|
4369
|
-
return P ===
|
|
4385
|
+
return P === b || // Create a bias to the `y` side axis due to horizontal
|
|
4370
4386
|
// reading directions favoring greater width.
|
|
4371
4387
|
P === "y";
|
|
4372
4388
|
}
|
|
@@ -4376,7 +4392,7 @@ const Ri = (a) => ({
|
|
|
4376
4392
|
break;
|
|
4377
4393
|
}
|
|
4378
4394
|
case "initialPlacement":
|
|
4379
|
-
Y =
|
|
4395
|
+
Y = a;
|
|
4380
4396
|
break;
|
|
4381
4397
|
}
|
|
4382
4398
|
if (s !== Y)
|
|
@@ -4390,16 +4406,16 @@ const Ri = (a) => ({
|
|
|
4390
4406
|
}
|
|
4391
4407
|
};
|
|
4392
4408
|
};
|
|
4393
|
-
async function Ii(
|
|
4409
|
+
async function Ii(n, t) {
|
|
4394
4410
|
const {
|
|
4395
4411
|
placement: e,
|
|
4396
4412
|
platform: i,
|
|
4397
4413
|
elements: s
|
|
4398
|
-
} =
|
|
4414
|
+
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a = ct(e), h = J(e) === "y", l = ["left", "top"].includes(o) ? -1 : 1, f = r && h ? -1 : 1, d = at(t, n);
|
|
4399
4415
|
let {
|
|
4400
4416
|
mainAxis: x,
|
|
4401
4417
|
crossAxis: u,
|
|
4402
|
-
alignmentAxis:
|
|
4418
|
+
alignmentAxis: g
|
|
4403
4419
|
} = typeof d == "number" ? {
|
|
4404
4420
|
mainAxis: d,
|
|
4405
4421
|
crossAxis: 0,
|
|
@@ -4409,40 +4425,40 @@ async function Ii(a, t) {
|
|
|
4409
4425
|
crossAxis: d.crossAxis || 0,
|
|
4410
4426
|
alignmentAxis: d.alignmentAxis
|
|
4411
4427
|
};
|
|
4412
|
-
return
|
|
4428
|
+
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g), h ? {
|
|
4413
4429
|
x: u * f,
|
|
4414
|
-
y: x *
|
|
4430
|
+
y: x * l
|
|
4415
4431
|
} : {
|
|
4416
|
-
x: x *
|
|
4432
|
+
x: x * l,
|
|
4417
4433
|
y: u * f
|
|
4418
4434
|
};
|
|
4419
4435
|
}
|
|
4420
|
-
const Oi = function(
|
|
4421
|
-
return
|
|
4436
|
+
const Oi = function(n) {
|
|
4437
|
+
return n === void 0 && (n = 0), {
|
|
4422
4438
|
name: "offset",
|
|
4423
|
-
options:
|
|
4439
|
+
options: n,
|
|
4424
4440
|
async fn(t) {
|
|
4425
4441
|
var e, i;
|
|
4426
4442
|
const {
|
|
4427
4443
|
x: s,
|
|
4428
4444
|
y: r,
|
|
4429
4445
|
placement: o,
|
|
4430
|
-
middlewareData:
|
|
4431
|
-
} = t,
|
|
4432
|
-
return o === ((e =
|
|
4433
|
-
x: s +
|
|
4434
|
-
y: r +
|
|
4446
|
+
middlewareData: a
|
|
4447
|
+
} = t, h = await Ii(t, n);
|
|
4448
|
+
return o === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
4449
|
+
x: s + h.x,
|
|
4450
|
+
y: r + h.y,
|
|
4435
4451
|
data: {
|
|
4436
|
-
...
|
|
4452
|
+
...h,
|
|
4437
4453
|
placement: o
|
|
4438
4454
|
}
|
|
4439
4455
|
};
|
|
4440
4456
|
}
|
|
4441
4457
|
};
|
|
4442
|
-
},
|
|
4443
|
-
return
|
|
4458
|
+
}, Ti = function(n) {
|
|
4459
|
+
return n === void 0 && (n = {}), {
|
|
4444
4460
|
name: "shift",
|
|
4445
|
-
options:
|
|
4461
|
+
options: n,
|
|
4446
4462
|
async fn(t) {
|
|
4447
4463
|
const {
|
|
4448
4464
|
x: e,
|
|
@@ -4451,42 +4467,42 @@ const Oi = function(a) {
|
|
|
4451
4467
|
} = t, {
|
|
4452
4468
|
mainAxis: r = !0,
|
|
4453
4469
|
crossAxis: o = !1,
|
|
4454
|
-
limiter:
|
|
4455
|
-
fn: (
|
|
4470
|
+
limiter: a = {
|
|
4471
|
+
fn: (p) => {
|
|
4456
4472
|
let {
|
|
4457
4473
|
x: y,
|
|
4458
|
-
y:
|
|
4459
|
-
} =
|
|
4474
|
+
y: b
|
|
4475
|
+
} = p;
|
|
4460
4476
|
return {
|
|
4461
4477
|
x: y,
|
|
4462
|
-
y:
|
|
4478
|
+
y: b
|
|
4463
4479
|
};
|
|
4464
4480
|
}
|
|
4465
4481
|
},
|
|
4466
|
-
...
|
|
4467
|
-
} = at(
|
|
4482
|
+
...h
|
|
4483
|
+
} = at(n, t), l = {
|
|
4468
4484
|
x: e,
|
|
4469
4485
|
y: i
|
|
4470
|
-
}, f = await ne(t,
|
|
4471
|
-
let u =
|
|
4486
|
+
}, f = await ne(t, h), d = J(q(s)), x = re(d);
|
|
4487
|
+
let u = l[x], g = l[d];
|
|
4472
4488
|
if (r) {
|
|
4473
|
-
const
|
|
4474
|
-
u = It(
|
|
4489
|
+
const p = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", b = u + f[p], m = u - f[y];
|
|
4490
|
+
u = It(b, u, m);
|
|
4475
4491
|
}
|
|
4476
4492
|
if (o) {
|
|
4477
|
-
const
|
|
4478
|
-
|
|
4493
|
+
const p = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", b = g + f[p], m = g - f[y];
|
|
4494
|
+
g = It(b, g, m);
|
|
4479
4495
|
}
|
|
4480
|
-
const
|
|
4496
|
+
const w = a.fn({
|
|
4481
4497
|
...t,
|
|
4482
4498
|
[x]: u,
|
|
4483
|
-
[d]:
|
|
4499
|
+
[d]: g
|
|
4484
4500
|
});
|
|
4485
4501
|
return {
|
|
4486
|
-
...
|
|
4502
|
+
...w,
|
|
4487
4503
|
data: {
|
|
4488
|
-
x:
|
|
4489
|
-
y:
|
|
4504
|
+
x: w.x - e,
|
|
4505
|
+
y: w.y - i,
|
|
4490
4506
|
enabled: {
|
|
4491
4507
|
[x]: r,
|
|
4492
4508
|
[d]: o
|
|
@@ -4499,58 +4515,58 @@ const Oi = function(a) {
|
|
|
4499
4515
|
function gt() {
|
|
4500
4516
|
return typeof window < "u";
|
|
4501
4517
|
}
|
|
4502
|
-
function tt(
|
|
4503
|
-
return ae(
|
|
4518
|
+
function tt(n) {
|
|
4519
|
+
return ae(n) ? (n.nodeName || "").toLowerCase() : "#document";
|
|
4504
4520
|
}
|
|
4505
|
-
function H(
|
|
4521
|
+
function H(n) {
|
|
4506
4522
|
var t;
|
|
4507
|
-
return (
|
|
4523
|
+
return (n == null || (t = n.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
4508
4524
|
}
|
|
4509
|
-
function K(
|
|
4525
|
+
function K(n) {
|
|
4510
4526
|
var t;
|
|
4511
|
-
return (t = (ae(
|
|
4527
|
+
return (t = (ae(n) ? n.ownerDocument : n.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4512
4528
|
}
|
|
4513
|
-
function ae(
|
|
4514
|
-
return gt() ?
|
|
4529
|
+
function ae(n) {
|
|
4530
|
+
return gt() ? n instanceof Node || n instanceof H(n).Node : !1;
|
|
4515
4531
|
}
|
|
4516
|
-
function X(
|
|
4517
|
-
return gt() ?
|
|
4532
|
+
function X(n) {
|
|
4533
|
+
return gt() ? n instanceof Element || n instanceof H(n).Element : !1;
|
|
4518
4534
|
}
|
|
4519
|
-
function N(
|
|
4520
|
-
return gt() ?
|
|
4535
|
+
function N(n) {
|
|
4536
|
+
return gt() ? n instanceof HTMLElement || n instanceof H(n).HTMLElement : !1;
|
|
4521
4537
|
}
|
|
4522
|
-
function
|
|
4523
|
-
return !gt() || typeof ShadowRoot > "u" ? !1 :
|
|
4538
|
+
function zt(n) {
|
|
4539
|
+
return !gt() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof H(n).ShadowRoot;
|
|
4524
4540
|
}
|
|
4525
|
-
function
|
|
4541
|
+
function ht(n) {
|
|
4526
4542
|
const {
|
|
4527
4543
|
overflow: t,
|
|
4528
4544
|
overflowX: e,
|
|
4529
4545
|
overflowY: i,
|
|
4530
4546
|
display: s
|
|
4531
|
-
} = F(
|
|
4547
|
+
} = F(n);
|
|
4532
4548
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
4533
4549
|
}
|
|
4534
|
-
function
|
|
4535
|
-
return ["table", "td", "th"].includes(tt(
|
|
4550
|
+
function Si(n) {
|
|
4551
|
+
return ["table", "td", "th"].includes(tt(n));
|
|
4536
4552
|
}
|
|
4537
|
-
function wt(
|
|
4553
|
+
function wt(n) {
|
|
4538
4554
|
return [":popover-open", ":modal"].some((t) => {
|
|
4539
4555
|
try {
|
|
4540
|
-
return
|
|
4556
|
+
return n.matches(t);
|
|
4541
4557
|
} catch {
|
|
4542
4558
|
return !1;
|
|
4543
4559
|
}
|
|
4544
4560
|
});
|
|
4545
4561
|
}
|
|
4546
|
-
function
|
|
4547
|
-
const t =
|
|
4562
|
+
function Ht(n) {
|
|
4563
|
+
const t = Dt(), e = X(n) ? F(n) : n;
|
|
4548
4564
|
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));
|
|
4549
4565
|
}
|
|
4550
|
-
function Ai(
|
|
4551
|
-
let t = z(
|
|
4566
|
+
function Ai(n) {
|
|
4567
|
+
let t = z(n);
|
|
4552
4568
|
for (; N(t) && !Q(t); ) {
|
|
4553
|
-
if (
|
|
4569
|
+
if (Ht(t))
|
|
4554
4570
|
return t;
|
|
4555
4571
|
if (wt(t))
|
|
4556
4572
|
return null;
|
|
@@ -4558,192 +4574,192 @@ function Ai(a) {
|
|
|
4558
4574
|
}
|
|
4559
4575
|
return null;
|
|
4560
4576
|
}
|
|
4561
|
-
function
|
|
4577
|
+
function Dt() {
|
|
4562
4578
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
4563
4579
|
}
|
|
4564
|
-
function Q(
|
|
4565
|
-
return ["html", "body", "#document"].includes(tt(
|
|
4580
|
+
function Q(n) {
|
|
4581
|
+
return ["html", "body", "#document"].includes(tt(n));
|
|
4566
4582
|
}
|
|
4567
|
-
function F(
|
|
4568
|
-
return H(
|
|
4583
|
+
function F(n) {
|
|
4584
|
+
return H(n).getComputedStyle(n);
|
|
4569
4585
|
}
|
|
4570
|
-
function pt(
|
|
4571
|
-
return X(
|
|
4572
|
-
scrollLeft:
|
|
4573
|
-
scrollTop:
|
|
4586
|
+
function pt(n) {
|
|
4587
|
+
return X(n) ? {
|
|
4588
|
+
scrollLeft: n.scrollLeft,
|
|
4589
|
+
scrollTop: n.scrollTop
|
|
4574
4590
|
} : {
|
|
4575
|
-
scrollLeft:
|
|
4576
|
-
scrollTop:
|
|
4591
|
+
scrollLeft: n.scrollX,
|
|
4592
|
+
scrollTop: n.scrollY
|
|
4577
4593
|
};
|
|
4578
4594
|
}
|
|
4579
|
-
function z(
|
|
4580
|
-
if (tt(
|
|
4581
|
-
return
|
|
4595
|
+
function z(n) {
|
|
4596
|
+
if (tt(n) === "html")
|
|
4597
|
+
return n;
|
|
4582
4598
|
const t = (
|
|
4583
4599
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
K(
|
|
4600
|
+
n.assignedSlot || // DOM Element detected.
|
|
4601
|
+
n.parentNode || // ShadowRoot detected.
|
|
4602
|
+
zt(n) && n.host || // Fallback.
|
|
4603
|
+
K(n)
|
|
4588
4604
|
);
|
|
4589
|
-
return
|
|
4605
|
+
return zt(t) ? t.host : t;
|
|
4590
4606
|
}
|
|
4591
|
-
function ce(
|
|
4592
|
-
const t = z(
|
|
4593
|
-
return Q(t) ?
|
|
4607
|
+
function ce(n) {
|
|
4608
|
+
const t = z(n);
|
|
4609
|
+
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) && ht(t) ? t : ce(t);
|
|
4594
4610
|
}
|
|
4595
|
-
function
|
|
4611
|
+
function Tt(n, t, e) {
|
|
4596
4612
|
var i;
|
|
4597
4613
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4598
|
-
const s = ce(
|
|
4614
|
+
const s = ce(n), r = s === ((i = n.ownerDocument) == null ? void 0 : i.body), o = H(s);
|
|
4599
4615
|
if (r) {
|
|
4600
|
-
const
|
|
4601
|
-
return t.concat(o, o.visualViewport || [],
|
|
4616
|
+
const a = St(o);
|
|
4617
|
+
return t.concat(o, o.visualViewport || [], ht(s) ? s : [], a && e ? Tt(a) : []);
|
|
4602
4618
|
}
|
|
4603
|
-
return t.concat(s,
|
|
4619
|
+
return t.concat(s, Tt(s, [], e));
|
|
4604
4620
|
}
|
|
4605
|
-
function
|
|
4606
|
-
return
|
|
4621
|
+
function St(n) {
|
|
4622
|
+
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
|
|
4607
4623
|
}
|
|
4608
|
-
function
|
|
4609
|
-
const t = F(
|
|
4624
|
+
function he(n) {
|
|
4625
|
+
const t = F(n);
|
|
4610
4626
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4611
|
-
const s = N(
|
|
4612
|
-
return
|
|
4627
|
+
const s = N(n), r = s ? n.offsetWidth : e, o = s ? n.offsetHeight : i, a = ft(e) !== r || ft(i) !== o;
|
|
4628
|
+
return a && (e = r, i = o), {
|
|
4613
4629
|
width: e,
|
|
4614
4630
|
height: i,
|
|
4615
|
-
$:
|
|
4631
|
+
$: a
|
|
4616
4632
|
};
|
|
4617
4633
|
}
|
|
4618
|
-
function
|
|
4619
|
-
return X(
|
|
4634
|
+
function le(n) {
|
|
4635
|
+
return X(n) ? n : n.contextElement;
|
|
4620
4636
|
}
|
|
4621
|
-
function Z(
|
|
4622
|
-
const t =
|
|
4637
|
+
function Z(n) {
|
|
4638
|
+
const t = le(n);
|
|
4623
4639
|
if (!N(t))
|
|
4624
4640
|
return V(1);
|
|
4625
4641
|
const e = t.getBoundingClientRect(), {
|
|
4626
4642
|
width: i,
|
|
4627
4643
|
height: s,
|
|
4628
4644
|
$: r
|
|
4629
|
-
} =
|
|
4630
|
-
let o = (r ? ft(e.width) : e.width) / i,
|
|
4631
|
-
return (!o || !Number.isFinite(o)) && (o = 1), (!
|
|
4645
|
+
} = he(t);
|
|
4646
|
+
let o = (r ? ft(e.width) : e.width) / i, a = (r ? ft(e.height) : e.height) / s;
|
|
4647
|
+
return (!o || !Number.isFinite(o)) && (o = 1), (!a || !Number.isFinite(a)) && (a = 1), {
|
|
4632
4648
|
x: o,
|
|
4633
|
-
y:
|
|
4649
|
+
y: a
|
|
4634
4650
|
};
|
|
4635
4651
|
}
|
|
4636
4652
|
const Li = /* @__PURE__ */ V(0);
|
|
4637
|
-
function de(
|
|
4638
|
-
const t = H(
|
|
4639
|
-
return !
|
|
4653
|
+
function de(n) {
|
|
4654
|
+
const t = H(n);
|
|
4655
|
+
return !Dt() || !t.visualViewport ? Li : {
|
|
4640
4656
|
x: t.visualViewport.offsetLeft,
|
|
4641
4657
|
y: t.visualViewport.offsetTop
|
|
4642
4658
|
};
|
|
4643
4659
|
}
|
|
4644
|
-
function Mi(
|
|
4645
|
-
return t === void 0 && (t = !1), !e || t && e !== H(
|
|
4660
|
+
function Mi(n, t, e) {
|
|
4661
|
+
return t === void 0 && (t = !1), !e || t && e !== H(n) ? !1 : t;
|
|
4646
4662
|
}
|
|
4647
|
-
function ot(
|
|
4663
|
+
function ot(n, t, e, i) {
|
|
4648
4664
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
4649
|
-
const s =
|
|
4665
|
+
const s = n.getBoundingClientRect(), r = le(n);
|
|
4650
4666
|
let o = V(1);
|
|
4651
|
-
t && (i ? X(i) && (o = Z(i)) : o = Z(
|
|
4652
|
-
const
|
|
4653
|
-
let
|
|
4667
|
+
t && (i ? X(i) && (o = Z(i)) : o = Z(n));
|
|
4668
|
+
const a = Mi(r, e, i) ? de(r) : V(0);
|
|
4669
|
+
let h = (s.left + a.x) / o.x, l = (s.top + a.y) / o.y, f = s.width / o.x, d = s.height / o.y;
|
|
4654
4670
|
if (r) {
|
|
4655
4671
|
const x = H(r), u = i && X(i) ? H(i) : i;
|
|
4656
|
-
let
|
|
4657
|
-
for (;
|
|
4658
|
-
const
|
|
4659
|
-
|
|
4672
|
+
let g = x, w = St(g);
|
|
4673
|
+
for (; w && i && u !== g; ) {
|
|
4674
|
+
const p = Z(w), y = w.getBoundingClientRect(), b = F(w), m = y.left + (w.clientLeft + parseFloat(b.paddingLeft)) * p.x, E = y.top + (w.clientTop + parseFloat(b.paddingTop)) * p.y;
|
|
4675
|
+
h *= p.x, l *= p.y, f *= p.x, d *= p.y, h += m, l += E, g = H(w), w = St(g);
|
|
4660
4676
|
}
|
|
4661
4677
|
}
|
|
4662
4678
|
return ut({
|
|
4663
4679
|
width: f,
|
|
4664
4680
|
height: d,
|
|
4665
|
-
x:
|
|
4666
|
-
y:
|
|
4681
|
+
x: h,
|
|
4682
|
+
y: l
|
|
4667
4683
|
});
|
|
4668
4684
|
}
|
|
4669
|
-
function Hi(
|
|
4685
|
+
function Hi(n) {
|
|
4670
4686
|
let {
|
|
4671
4687
|
elements: t,
|
|
4672
4688
|
rect: e,
|
|
4673
4689
|
offsetParent: i,
|
|
4674
4690
|
strategy: s
|
|
4675
|
-
} =
|
|
4676
|
-
const r = s === "fixed", o = K(i),
|
|
4677
|
-
if (i === o ||
|
|
4691
|
+
} = n;
|
|
4692
|
+
const r = s === "fixed", o = K(i), a = t ? wt(t.floating) : !1;
|
|
4693
|
+
if (i === o || a && r)
|
|
4678
4694
|
return e;
|
|
4679
|
-
let
|
|
4695
|
+
let h = {
|
|
4680
4696
|
scrollLeft: 0,
|
|
4681
4697
|
scrollTop: 0
|
|
4682
|
-
},
|
|
4698
|
+
}, l = V(1);
|
|
4683
4699
|
const f = V(0), d = N(i);
|
|
4684
|
-
if ((d || !d && !r) && ((tt(i) !== "body" ||
|
|
4700
|
+
if ((d || !d && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), N(i))) {
|
|
4685
4701
|
const x = ot(i);
|
|
4686
|
-
|
|
4702
|
+
l = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4687
4703
|
}
|
|
4688
4704
|
return {
|
|
4689
|
-
width: e.width *
|
|
4690
|
-
height: e.height *
|
|
4691
|
-
x: e.x *
|
|
4692
|
-
y: e.y *
|
|
4705
|
+
width: e.width * l.x,
|
|
4706
|
+
height: e.height * l.y,
|
|
4707
|
+
x: e.x * l.x - h.scrollLeft * l.x + f.x,
|
|
4708
|
+
y: e.y * l.y - h.scrollTop * l.y + f.y
|
|
4693
4709
|
};
|
|
4694
4710
|
}
|
|
4695
|
-
function Di(
|
|
4696
|
-
return Array.from(
|
|
4711
|
+
function Di(n) {
|
|
4712
|
+
return Array.from(n.getClientRects());
|
|
4697
4713
|
}
|
|
4698
|
-
function At(
|
|
4699
|
-
const e = pt(
|
|
4700
|
-
return t ? t.left + e : ot(K(
|
|
4714
|
+
function At(n, t) {
|
|
4715
|
+
const e = pt(n).scrollLeft;
|
|
4716
|
+
return t ? t.left + e : ot(K(n)).left + e;
|
|
4701
4717
|
}
|
|
4702
|
-
function Xi(
|
|
4703
|
-
const t = K(
|
|
4704
|
-
let o = -e.scrollLeft + At(
|
|
4705
|
-
const
|
|
4718
|
+
function Xi(n) {
|
|
4719
|
+
const t = K(n), e = pt(n), i = n.ownerDocument.body, s = U(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), r = U(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
4720
|
+
let o = -e.scrollLeft + At(n);
|
|
4721
|
+
const a = -e.scrollTop;
|
|
4706
4722
|
return F(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
|
|
4707
4723
|
width: s,
|
|
4708
4724
|
height: r,
|
|
4709
4725
|
x: o,
|
|
4710
|
-
y:
|
|
4726
|
+
y: a
|
|
4711
4727
|
};
|
|
4712
4728
|
}
|
|
4713
|
-
function Fi(
|
|
4714
|
-
const e = H(
|
|
4715
|
-
let r = i.clientWidth, o = i.clientHeight,
|
|
4729
|
+
function Fi(n, t) {
|
|
4730
|
+
const e = H(n), i = K(n), s = e.visualViewport;
|
|
4731
|
+
let r = i.clientWidth, o = i.clientHeight, a = 0, h = 0;
|
|
4716
4732
|
if (s) {
|
|
4717
4733
|
r = s.width, o = s.height;
|
|
4718
|
-
const
|
|
4719
|
-
(!
|
|
4734
|
+
const l = Dt();
|
|
4735
|
+
(!l || l && t === "fixed") && (a = s.offsetLeft, h = s.offsetTop);
|
|
4720
4736
|
}
|
|
4721
4737
|
return {
|
|
4722
4738
|
width: r,
|
|
4723
4739
|
height: o,
|
|
4724
|
-
x:
|
|
4725
|
-
y:
|
|
4740
|
+
x: a,
|
|
4741
|
+
y: h
|
|
4726
4742
|
};
|
|
4727
4743
|
}
|
|
4728
|
-
function ki(
|
|
4729
|
-
const e = ot(
|
|
4744
|
+
function ki(n, t) {
|
|
4745
|
+
const e = ot(n, !0, t === "fixed"), i = e.top + n.clientTop, s = e.left + n.clientLeft, r = N(n) ? Z(n) : V(1), o = n.clientWidth * r.x, a = n.clientHeight * r.y, h = s * r.x, l = i * r.y;
|
|
4730
4746
|
return {
|
|
4731
4747
|
width: o,
|
|
4732
|
-
height:
|
|
4733
|
-
x:
|
|
4734
|
-
y:
|
|
4748
|
+
height: a,
|
|
4749
|
+
x: h,
|
|
4750
|
+
y: l
|
|
4735
4751
|
};
|
|
4736
4752
|
}
|
|
4737
|
-
function
|
|
4753
|
+
function $t(n, t, e) {
|
|
4738
4754
|
let i;
|
|
4739
4755
|
if (t === "viewport")
|
|
4740
|
-
i = Fi(
|
|
4756
|
+
i = Fi(n, e);
|
|
4741
4757
|
else if (t === "document")
|
|
4742
|
-
i = Xi(K(
|
|
4758
|
+
i = Xi(K(n));
|
|
4743
4759
|
else if (X(t))
|
|
4744
4760
|
i = ki(t, e);
|
|
4745
4761
|
else {
|
|
4746
|
-
const s = de(
|
|
4762
|
+
const s = de(n);
|
|
4747
4763
|
i = {
|
|
4748
4764
|
...t,
|
|
4749
4765
|
x: t.x - s.x,
|
|
@@ -4752,70 +4768,70 @@ function qt(a, t, e) {
|
|
|
4752
4768
|
}
|
|
4753
4769
|
return ut(i);
|
|
4754
4770
|
}
|
|
4755
|
-
function fe(
|
|
4756
|
-
const e = z(
|
|
4771
|
+
function fe(n, t) {
|
|
4772
|
+
const e = z(n);
|
|
4757
4773
|
return e === t || !X(e) || Q(e) ? !1 : F(e).position === "fixed" || fe(e, t);
|
|
4758
4774
|
}
|
|
4759
|
-
function Ni(
|
|
4760
|
-
const e = t.get(
|
|
4775
|
+
function Ni(n, t) {
|
|
4776
|
+
const e = t.get(n);
|
|
4761
4777
|
if (e)
|
|
4762
4778
|
return e;
|
|
4763
|
-
let i =
|
|
4764
|
-
const r = F(
|
|
4765
|
-
let o = r ? z(
|
|
4779
|
+
let i = Tt(n, [], !1).filter((a) => X(a) && tt(a) !== "body"), s = null;
|
|
4780
|
+
const r = F(n).position === "fixed";
|
|
4781
|
+
let o = r ? z(n) : n;
|
|
4766
4782
|
for (; X(o) && !Q(o); ) {
|
|
4767
|
-
const
|
|
4768
|
-
!
|
|
4783
|
+
const a = F(o), h = Ht(o);
|
|
4784
|
+
!h && a.position === "fixed" && (s = null), (r ? !h && !s : !h && a.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || ht(o) && !h && fe(n, o)) ? i = i.filter((f) => f !== o) : s = a, o = z(o);
|
|
4769
4785
|
}
|
|
4770
|
-
return t.set(
|
|
4786
|
+
return t.set(n, i), i;
|
|
4771
4787
|
}
|
|
4772
|
-
function Yi(
|
|
4788
|
+
function Yi(n) {
|
|
4773
4789
|
let {
|
|
4774
4790
|
element: t,
|
|
4775
4791
|
boundary: e,
|
|
4776
4792
|
rootBoundary: i,
|
|
4777
4793
|
strategy: s
|
|
4778
|
-
} =
|
|
4779
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i],
|
|
4780
|
-
const d =
|
|
4781
|
-
return
|
|
4782
|
-
},
|
|
4794
|
+
} = n;
|
|
4795
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0], h = o.reduce((l, f) => {
|
|
4796
|
+
const d = $t(t, f, s);
|
|
4797
|
+
return l.top = U(d.top, l.top), l.right = rt(d.right, l.right), l.bottom = rt(d.bottom, l.bottom), l.left = U(d.left, l.left), l;
|
|
4798
|
+
}, $t(t, a, s));
|
|
4783
4799
|
return {
|
|
4784
|
-
width:
|
|
4785
|
-
height:
|
|
4786
|
-
x:
|
|
4787
|
-
y:
|
|
4800
|
+
width: h.right - h.left,
|
|
4801
|
+
height: h.bottom - h.top,
|
|
4802
|
+
x: h.left,
|
|
4803
|
+
y: h.top
|
|
4788
4804
|
};
|
|
4789
4805
|
}
|
|
4790
|
-
function Ki(
|
|
4806
|
+
function Ki(n) {
|
|
4791
4807
|
const {
|
|
4792
4808
|
width: t,
|
|
4793
4809
|
height: e
|
|
4794
|
-
} =
|
|
4810
|
+
} = he(n);
|
|
4795
4811
|
return {
|
|
4796
4812
|
width: t,
|
|
4797
4813
|
height: e
|
|
4798
4814
|
};
|
|
4799
4815
|
}
|
|
4800
|
-
function Bi(
|
|
4801
|
-
const i = N(t), s = K(t), r = e === "fixed", o = ot(
|
|
4802
|
-
let
|
|
4816
|
+
function Bi(n, t, e) {
|
|
4817
|
+
const i = N(t), s = K(t), r = e === "fixed", o = ot(n, !0, r, t);
|
|
4818
|
+
let a = {
|
|
4803
4819
|
scrollLeft: 0,
|
|
4804
4820
|
scrollTop: 0
|
|
4805
4821
|
};
|
|
4806
|
-
const
|
|
4822
|
+
const h = V(0);
|
|
4807
4823
|
if (i || !i && !r)
|
|
4808
|
-
if ((tt(t) !== "body" ||
|
|
4824
|
+
if ((tt(t) !== "body" || ht(s)) && (a = pt(t)), i) {
|
|
4809
4825
|
const u = ot(t, !0, r, t);
|
|
4810
|
-
|
|
4811
|
-
} else s && (
|
|
4812
|
-
let
|
|
4826
|
+
h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
|
|
4827
|
+
} else s && (h.x = At(s));
|
|
4828
|
+
let l = 0, f = 0;
|
|
4813
4829
|
if (s && !i && !r) {
|
|
4814
4830
|
const u = s.getBoundingClientRect();
|
|
4815
|
-
f = u.top +
|
|
4831
|
+
f = u.top + a.scrollTop, l = u.left + a.scrollLeft - // RTL <body> scrollbar.
|
|
4816
4832
|
At(s, u);
|
|
4817
4833
|
}
|
|
4818
|
-
const d = o.left +
|
|
4834
|
+
const d = o.left + a.scrollLeft - h.x - l, x = o.top + a.scrollTop - h.y - f;
|
|
4819
4835
|
return {
|
|
4820
4836
|
x: d,
|
|
4821
4837
|
y: x,
|
|
@@ -4823,23 +4839,23 @@ function Bi(a, t, e) {
|
|
|
4823
4839
|
height: o.height
|
|
4824
4840
|
};
|
|
4825
4841
|
}
|
|
4826
|
-
function mt(
|
|
4827
|
-
return F(
|
|
4842
|
+
function mt(n) {
|
|
4843
|
+
return F(n).position === "static";
|
|
4828
4844
|
}
|
|
4829
|
-
function
|
|
4830
|
-
if (!N(
|
|
4845
|
+
function qt(n, t) {
|
|
4846
|
+
if (!N(n) || F(n).position === "fixed")
|
|
4831
4847
|
return null;
|
|
4832
4848
|
if (t)
|
|
4833
|
-
return t(
|
|
4834
|
-
let e =
|
|
4835
|
-
return K(
|
|
4849
|
+
return t(n);
|
|
4850
|
+
let e = n.offsetParent;
|
|
4851
|
+
return K(n) === e && (e = e.ownerDocument.body), e;
|
|
4836
4852
|
}
|
|
4837
|
-
function xe(
|
|
4838
|
-
const e = H(
|
|
4839
|
-
if (wt(
|
|
4853
|
+
function xe(n, t) {
|
|
4854
|
+
const e = H(n);
|
|
4855
|
+
if (wt(n))
|
|
4840
4856
|
return e;
|
|
4841
|
-
if (!N(
|
|
4842
|
-
let s = z(
|
|
4857
|
+
if (!N(n)) {
|
|
4858
|
+
let s = z(n);
|
|
4843
4859
|
for (; s && !Q(s); ) {
|
|
4844
4860
|
if (X(s) && !mt(s))
|
|
4845
4861
|
return s;
|
|
@@ -4847,15 +4863,15 @@ function xe(a, t) {
|
|
|
4847
4863
|
}
|
|
4848
4864
|
return e;
|
|
4849
4865
|
}
|
|
4850
|
-
let i =
|
|
4851
|
-
for (; i &&
|
|
4852
|
-
i =
|
|
4853
|
-
return i && Q(i) && mt(i) && !
|
|
4866
|
+
let i = qt(n, t);
|
|
4867
|
+
for (; i && Si(i) && mt(i); )
|
|
4868
|
+
i = qt(i, t);
|
|
4869
|
+
return i && Q(i) && mt(i) && !Ht(i) ? e : i || Ai(n) || e;
|
|
4854
4870
|
}
|
|
4855
|
-
const Wi = async function(
|
|
4856
|
-
const t = this.getOffsetParent || xe, e = this.getDimensions, i = await e(
|
|
4871
|
+
const Wi = async function(n) {
|
|
4872
|
+
const t = this.getOffsetParent || xe, e = this.getDimensions, i = await e(n.floating);
|
|
4857
4873
|
return {
|
|
4858
|
-
reference: Bi(
|
|
4874
|
+
reference: Bi(n.reference, await t(n.floating), n.strategy),
|
|
4859
4875
|
floating: {
|
|
4860
4876
|
x: 0,
|
|
4861
4877
|
y: 0,
|
|
@@ -4864,8 +4880,8 @@ const Wi = async function(a) {
|
|
|
4864
4880
|
}
|
|
4865
4881
|
};
|
|
4866
4882
|
};
|
|
4867
|
-
function Pi(
|
|
4868
|
-
return F(
|
|
4883
|
+
function Pi(n) {
|
|
4884
|
+
return F(n).direction === "rtl";
|
|
4869
4885
|
}
|
|
4870
4886
|
const Vi = {
|
|
4871
4887
|
convertOffsetParentRelativeRectToViewportRelativeRect: Hi,
|
|
@@ -4878,7 +4894,7 @@ const Vi = {
|
|
|
4878
4894
|
getScale: Z,
|
|
4879
4895
|
isElement: X,
|
|
4880
4896
|
isRTL: Pi
|
|
4881
|
-
}, ue = Oi, ge =
|
|
4897
|
+
}, ue = Oi, ge = Ti, we = _i, zi = Ri, pe = (n, t, e) => {
|
|
4882
4898
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
4883
4899
|
platform: Vi,
|
|
4884
4900
|
...e
|
|
@@ -4886,7 +4902,7 @@ const Vi = {
|
|
|
4886
4902
|
...s.platform,
|
|
4887
4903
|
_c: i
|
|
4888
4904
|
};
|
|
4889
|
-
return vi(
|
|
4905
|
+
return vi(n, t, {
|
|
4890
4906
|
...s,
|
|
4891
4907
|
platform: r
|
|
4892
4908
|
});
|
|
@@ -4901,7 +4917,7 @@ let $i = class {
|
|
|
4901
4917
|
this.ctx = t;
|
|
4902
4918
|
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE: r, CSS_PREFIX: o } = this.ctx.config;
|
|
4903
4919
|
this.contentEl = document.createElement("div"), this.arrowEl = document.createElement("div"), this.floatingEl = document.createElement("div"), this.floatingEl.className = `${o}-tooltip`, this.contentEl.className = `${o}-tooltip-content`, this.arrowEl.className = `${o}-tooltip-arrow`;
|
|
4904
|
-
const
|
|
4920
|
+
const a = {
|
|
4905
4921
|
display: "none",
|
|
4906
4922
|
position: "absolute",
|
|
4907
4923
|
background: e,
|
|
@@ -4912,20 +4928,22 @@ let $i = class {
|
|
|
4912
4928
|
borderRadius: "4px",
|
|
4913
4929
|
fontSize: "12px",
|
|
4914
4930
|
...r
|
|
4915
|
-
},
|
|
4931
|
+
}, h = {
|
|
4916
4932
|
position: "absolute",
|
|
4917
4933
|
width: "10px",
|
|
4918
4934
|
height: "10px",
|
|
4919
|
-
background:
|
|
4920
|
-
backgroundColor:
|
|
4935
|
+
background: a.background,
|
|
4936
|
+
backgroundColor: a.backgroundColor,
|
|
4921
4937
|
transform: "rotate(45deg)",
|
|
4922
|
-
zIndex:
|
|
4938
|
+
zIndex: a.zIndex
|
|
4923
4939
|
};
|
|
4924
|
-
Object.assign(this.arrowEl.style,
|
|
4940
|
+
Object.assign(this.arrowEl.style, h), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
|
|
4925
4941
|
}
|
|
4926
4942
|
init() {
|
|
4927
4943
|
this.ctx.on("mousemove", (t) => {
|
|
4928
|
-
|
|
4944
|
+
if (!this.ctx.isTarget())
|
|
4945
|
+
return;
|
|
4946
|
+
const e = this.ctx.containerElement.getBoundingClientRect();
|
|
4929
4947
|
e && (t.clientX < e.x || t.clientX > e.x + e.width || t.clientY < e.y || t.clientY > e.y + e.height) && this.hide();
|
|
4930
4948
|
}), this.ctx.on("startEdit", () => {
|
|
4931
4949
|
this.hide();
|
|
@@ -4941,7 +4959,7 @@ let $i = class {
|
|
|
4941
4959
|
this.floatingEl.style.display = "block";
|
|
4942
4960
|
let e = t.getText();
|
|
4943
4961
|
t.message && (e = t.message);
|
|
4944
|
-
const i = this.ctx.
|
|
4962
|
+
const i = this.ctx.containerElement.getBoundingClientRect();
|
|
4945
4963
|
if (!i)
|
|
4946
4964
|
return;
|
|
4947
4965
|
this.enable = !0, this.contentEl.style.maxWidth = `${t.overflowTooltipMaxWidth || 500}px`, this.contentEl.style.width = "100%", this.contentEl.style.display = "inline-block", this.contentEl.style.wordBreak = "break-all", this.contentEl.style.lineHeight = "1.5", this.contentEl.innerText = e;
|
|
@@ -4962,11 +4980,11 @@ let $i = class {
|
|
|
4962
4980
|
}, this.floatingEl, {
|
|
4963
4981
|
placement: t.overflowTooltipPlacement,
|
|
4964
4982
|
middleware: [ge(), we(), ue(6), zi({ element: this.arrowEl })]
|
|
4965
|
-
}).then((
|
|
4966
|
-
const { x:
|
|
4983
|
+
}).then((a) => {
|
|
4984
|
+
const { x: h, y: l, placement: f, middlewareData: d } = a;
|
|
4967
4985
|
if (Object.assign(this.floatingEl.style, {
|
|
4968
|
-
top: `${
|
|
4969
|
-
left: `${
|
|
4986
|
+
top: `${l}px`,
|
|
4987
|
+
left: `${h}px`
|
|
4970
4988
|
}), d.arrow) {
|
|
4971
4989
|
const x = d.arrow;
|
|
4972
4990
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5056,9 +5074,9 @@ class qi {
|
|
|
5056
5074
|
});
|
|
5057
5075
|
}
|
|
5058
5076
|
initTextEditor() {
|
|
5059
|
-
this.inputEl = document.createElement("textarea"), this.inputEl.addEventListener("keydown", (t) => {
|
|
5077
|
+
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("keydown", (t) => {
|
|
5060
5078
|
if (this.enable) {
|
|
5061
|
-
if ((t.altKey || t.metaKey) && t.code === "Enter") {
|
|
5079
|
+
if (t.stopPropagation(), (t.altKey || t.metaKey) && t.code === "Enter") {
|
|
5062
5080
|
t.preventDefault();
|
|
5063
5081
|
const e = this.inputEl.selectionStart, i = this.inputEl.value.substring(0, e), s = this.inputEl.value.substring(e);
|
|
5064
5082
|
this.inputEl.value = i + `
|
|
@@ -5067,20 +5085,21 @@ class qi {
|
|
|
5067
5085
|
}
|
|
5068
5086
|
(t.code === "Escape" || t.code === "Enter") && (t.preventDefault(), this.inputEl.blur());
|
|
5069
5087
|
}
|
|
5088
|
+
}), this.inputEl.addEventListener("input", function() {
|
|
5089
|
+
this.style.height = "auto", this.style.height = `${this.scrollHeight}px`;
|
|
5070
5090
|
}), this.inputEl.addEventListener("blur", () => {
|
|
5071
5091
|
this.doneEdit();
|
|
5072
|
-
}), this.editorEl = document.createElement("div"), this.editorEl.className = "e-virt-table-editor", this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.
|
|
5092
|
+
}), this.editorEl = document.createElement("div"), this.editorEl.className = "e-virt-table-editor", this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
|
|
5073
5093
|
}
|
|
5074
5094
|
startEditByInput(t) {
|
|
5075
5095
|
if (t.editorType !== "text")
|
|
5076
5096
|
return;
|
|
5077
5097
|
const e = t.getValue(), { width: i } = t, s = t.getDrawX();
|
|
5078
5098
|
let r = t.getDrawY(), { height: o } = t;
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
this.inputEl.setSelectionRange(l, l);
|
|
5099
|
+
const { CELL_PADDING: a } = this.ctx.config;
|
|
5100
|
+
this.editorEl.style.left = `${s - 1.5}px`, this.editorEl.style.top = `${r - 1.5}px`, this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${this.ctx.body.visibleHeight - 1}px`, this.inputEl.style.width = `${i - 1}px`, this.inputEl.style.height = `${o - 1}px`, this.inputEl.style.padding = `${a}px`, e !== null && (this.inputEl.value = e), this.inputEl.focus();
|
|
5101
|
+
const h = this.inputEl.value.length;
|
|
5102
|
+
this.inputEl.setSelectionRange(h, h), this.inputEl.scrollHeight > o && (this.inputEl.style.height = this.inputEl.scrollHeight + "px");
|
|
5084
5103
|
}
|
|
5085
5104
|
doneEditByInput() {
|
|
5086
5105
|
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
@@ -5099,23 +5118,25 @@ class qi {
|
|
|
5099
5118
|
e && !r && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5100
5119
|
}
|
|
5101
5120
|
editCell(t, e) {
|
|
5102
|
-
const i = this.ctx.body.renderRows.find((
|
|
5121
|
+
const i = this.ctx.body.renderRows.find((l) => l.rowIndex === t);
|
|
5103
5122
|
if (!i)
|
|
5104
5123
|
return;
|
|
5105
|
-
const s = i.cells.find((
|
|
5124
|
+
const s = i.cells.find((l) => l.colIndex === e);
|
|
5106
5125
|
if (!s)
|
|
5107
5126
|
return;
|
|
5108
5127
|
this.ctx.emit("setSelectorCell", s);
|
|
5109
5128
|
const r = this.ctx.focusCell;
|
|
5110
5129
|
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5111
5130
|
return;
|
|
5112
|
-
const { rowKey: o, key:
|
|
5113
|
-
r && !
|
|
5131
|
+
const { rowKey: o, key: a } = r, h = this.ctx.database.getReadonly(o, a);
|
|
5132
|
+
r && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5114
5133
|
}
|
|
5115
5134
|
doneEdit() {
|
|
5116
|
-
this.enable && this.cellTarget && (this.ctx.emit("doneEdit", this.cellTarget), this.doneEditByInput(), this.enable = !1, this.ctx.
|
|
5135
|
+
this.enable && this.cellTarget && (this.ctx.emit("doneEdit", this.cellTarget), this.doneEditByInput(), this.enable = !1, this.ctx.stageElement.focus(), this.ctx.editing = !1, this.cellTarget = null, this.ctx.emit("draw"));
|
|
5117
5136
|
}
|
|
5118
5137
|
destroy() {
|
|
5138
|
+
var t;
|
|
5139
|
+
(t = this.editorEl) == null || t.remove();
|
|
5119
5140
|
}
|
|
5120
5141
|
}
|
|
5121
5142
|
class Gi {
|
|
@@ -5124,10 +5145,10 @@ class Gi {
|
|
|
5124
5145
|
c(this, "emptyEl");
|
|
5125
5146
|
this.ctx = t;
|
|
5126
5147
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX: r } = this.ctx.config;
|
|
5127
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.
|
|
5148
|
+
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: a, bodyHeight: h, footerHeight: l }) => {
|
|
5128
5149
|
if (i)
|
|
5129
5150
|
return;
|
|
5130
|
-
const f =
|
|
5151
|
+
const f = a + (h + l) / 2, d = {
|
|
5131
5152
|
display: o === "empty" ? "block" : "none",
|
|
5132
5153
|
position: "absolute",
|
|
5133
5154
|
fontSize: "14px",
|
|
@@ -5147,28 +5168,7 @@ class Gi {
|
|
|
5147
5168
|
class ji {
|
|
5148
5169
|
constructor(t) {
|
|
5149
5170
|
c(this, "ctx");
|
|
5150
|
-
this.ctx = t
|
|
5151
|
-
if (!this.ctx.config.ENABLE_HEADER_STICKY)
|
|
5152
|
-
return;
|
|
5153
|
-
const e = this.ctx.targetContainer.getBoundingClientRect();
|
|
5154
|
-
let i = !1, s = this.getHeader();
|
|
5155
|
-
e.top < 0 && e.top < -this.ctx.header.visibleHeight && e.top > -this.ctx.body.visibleHeight ? i = !0 : i = !1;
|
|
5156
|
-
const {
|
|
5157
|
-
config: { CSS_PREFIX: r }
|
|
5158
|
-
} = this.ctx, { visibleWidth: o } = this.ctx.body, n = {
|
|
5159
|
-
type: "header-sticky",
|
|
5160
|
-
class: `${r}-overlayer-header-sticky`,
|
|
5161
|
-
style: {
|
|
5162
|
-
position: "sticky",
|
|
5163
|
-
top: "0px",
|
|
5164
|
-
"z-index": 10,
|
|
5165
|
-
width: `${o}px`,
|
|
5166
|
-
display: i ? "block" : "none"
|
|
5167
|
-
},
|
|
5168
|
-
views: s.views
|
|
5169
|
-
};
|
|
5170
|
-
this.ctx.emit("headerStickyChange", n);
|
|
5171
|
-
});
|
|
5171
|
+
this.ctx = t;
|
|
5172
5172
|
}
|
|
5173
5173
|
draw() {
|
|
5174
5174
|
const t = this.getContainer();
|
|
@@ -5182,21 +5182,24 @@ class ji {
|
|
|
5182
5182
|
}
|
|
5183
5183
|
getContainer() {
|
|
5184
5184
|
const {
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5185
|
+
stageWidth: t,
|
|
5186
|
+
stageHeight: e,
|
|
5187
|
+
config: { SCROLLER_TRACK_SIZE: i }
|
|
5188
|
+
} = this.ctx, s = t - i, r = e - i, o = this.getHeader(), a = this.getBody(), h = this.getFooter();
|
|
5189
|
+
let l = [o, a, h];
|
|
5190
|
+
const { FOOTER_FIXED: f } = this.ctx.config;
|
|
5191
|
+
return f || (l = [o, a]), {
|
|
5191
5192
|
style: {
|
|
5192
5193
|
position: "absolute",
|
|
5193
5194
|
left: "0px",
|
|
5194
5195
|
top: "0px",
|
|
5195
|
-
|
|
5196
|
+
userSelect: "none",
|
|
5196
5197
|
overflow: "hidden",
|
|
5197
|
-
width: `${
|
|
5198
|
-
height: `${
|
|
5198
|
+
width: `${s}px`,
|
|
5199
|
+
height: `${r}px`,
|
|
5200
|
+
zIndex: 10
|
|
5199
5201
|
},
|
|
5202
|
+
class: "e-virt-table-overlayer",
|
|
5200
5203
|
views: l
|
|
5201
5204
|
};
|
|
5202
5205
|
}
|
|
@@ -5205,10 +5208,10 @@ class ji {
|
|
|
5205
5208
|
fixedLeftWidth: t,
|
|
5206
5209
|
fixedRightWidth: e,
|
|
5207
5210
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5208
|
-
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders:
|
|
5209
|
-
let
|
|
5210
|
-
|
|
5211
|
-
|
|
5211
|
+
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: a } = this.ctx.header;
|
|
5212
|
+
let h = [], l = [], f = [];
|
|
5213
|
+
a.forEach((p) => {
|
|
5214
|
+
p.render && (p.fixed === "left" ? l.push(p) : p.fixed === "right" ? f.push(p) : h.push(p));
|
|
5212
5215
|
});
|
|
5213
5216
|
const d = e - i, x = {
|
|
5214
5217
|
key: "left",
|
|
@@ -5220,7 +5223,7 @@ class ji {
|
|
|
5220
5223
|
width: `${t}px`,
|
|
5221
5224
|
height: `${o}px`
|
|
5222
5225
|
},
|
|
5223
|
-
cells:
|
|
5226
|
+
cells: l
|
|
5224
5227
|
}, u = {
|
|
5225
5228
|
key: "center",
|
|
5226
5229
|
style: {
|
|
@@ -5231,8 +5234,8 @@ class ji {
|
|
|
5231
5234
|
width: `${r - t - d + 1}px`,
|
|
5232
5235
|
height: `${o}px`
|
|
5233
5236
|
},
|
|
5234
|
-
cells:
|
|
5235
|
-
},
|
|
5237
|
+
cells: h
|
|
5238
|
+
}, g = {
|
|
5236
5239
|
key: "right",
|
|
5237
5240
|
style: {
|
|
5238
5241
|
position: "absolute",
|
|
@@ -5253,22 +5256,22 @@ class ji {
|
|
|
5253
5256
|
width: `${r}px`,
|
|
5254
5257
|
height: `${o}px`
|
|
5255
5258
|
},
|
|
5256
|
-
views: [x, u,
|
|
5259
|
+
views: [x, u, g]
|
|
5257
5260
|
};
|
|
5258
5261
|
}
|
|
5259
5262
|
getBody() {
|
|
5260
5263
|
const t = [], e = [], i = [];
|
|
5261
5264
|
let s = this.ctx.body.renderRows;
|
|
5262
|
-
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((
|
|
5263
|
-
|
|
5265
|
+
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((p) => {
|
|
5266
|
+
p.cells.forEach((y) => {
|
|
5264
5267
|
y.cellType === "footer" && (y.render = y.renderFooter), y.render && (y.fixed === "left" ? e.push(y) : y.fixed === "right" ? i.push(y) : t.push(y));
|
|
5265
5268
|
});
|
|
5266
5269
|
});
|
|
5267
5270
|
const {
|
|
5268
5271
|
fixedLeftWidth: r,
|
|
5269
5272
|
fixedRightWidth: o,
|
|
5270
|
-
config: { SCROLLER_TRACK_SIZE:
|
|
5271
|
-
} = this.ctx, { visibleWidth:
|
|
5273
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: h }
|
|
5274
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: f } = this.ctx.body, d = o - a, x = {
|
|
5272
5275
|
key: "left",
|
|
5273
5276
|
style: {
|
|
5274
5277
|
position: "absolute",
|
|
@@ -5284,13 +5287,13 @@ class ji {
|
|
|
5284
5287
|
style: {
|
|
5285
5288
|
position: "absolute",
|
|
5286
5289
|
top: `${0.5}px`,
|
|
5287
|
-
left: `${r
|
|
5290
|
+
left: `${r - 0.5}px`,
|
|
5288
5291
|
overflow: "hidden",
|
|
5289
|
-
width: `${
|
|
5292
|
+
width: `${l - r - d}px`,
|
|
5290
5293
|
height: `${f}px`
|
|
5291
5294
|
},
|
|
5292
5295
|
cells: t
|
|
5293
|
-
},
|
|
5296
|
+
}, g = {
|
|
5294
5297
|
key: "right",
|
|
5295
5298
|
style: {
|
|
5296
5299
|
position: "absolute",
|
|
@@ -5304,28 +5307,28 @@ class ji {
|
|
|
5304
5307
|
};
|
|
5305
5308
|
return {
|
|
5306
5309
|
type: "body",
|
|
5307
|
-
class: `${
|
|
5310
|
+
class: `${h}-overlayer-body`,
|
|
5308
5311
|
style: {
|
|
5309
5312
|
position: "relative",
|
|
5310
5313
|
overflow: "hidden",
|
|
5311
|
-
width: `${
|
|
5314
|
+
width: `${l}px`,
|
|
5312
5315
|
height: `${f}px`
|
|
5313
5316
|
},
|
|
5314
|
-
views: [x, u,
|
|
5317
|
+
views: [x, u, g]
|
|
5315
5318
|
};
|
|
5316
5319
|
}
|
|
5317
5320
|
getFooter() {
|
|
5318
5321
|
const t = [], e = [], i = [];
|
|
5319
|
-
this.ctx.footer.renderRows.forEach((
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
+
this.ctx.footer.renderRows.forEach((w) => {
|
|
5323
|
+
w.cells.forEach((p) => {
|
|
5324
|
+
p.cellType === "footer" && p.renderFooter && (p.render = p.renderFooter, p.fixed === "left" ? e.push(p) : p.fixed === "right" ? i.push(p) : t.push(p));
|
|
5322
5325
|
});
|
|
5323
5326
|
});
|
|
5324
5327
|
const {
|
|
5325
5328
|
fixedLeftWidth: s,
|
|
5326
5329
|
fixedRightWidth: r,
|
|
5327
|
-
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX:
|
|
5328
|
-
} = this.ctx, { visibleWidth:
|
|
5330
|
+
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: a }
|
|
5331
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: l } = this.ctx.footer, f = r - o, d = {
|
|
5329
5332
|
key: "left",
|
|
5330
5333
|
style: {
|
|
5331
5334
|
position: "absolute",
|
|
@@ -5333,7 +5336,7 @@ class ji {
|
|
|
5333
5336
|
left: `${0.5}px`,
|
|
5334
5337
|
overflow: "hidden",
|
|
5335
5338
|
width: `${s}px`,
|
|
5336
|
-
height: `${
|
|
5339
|
+
height: `${l}px`
|
|
5337
5340
|
},
|
|
5338
5341
|
cells: e
|
|
5339
5342
|
}, x = {
|
|
@@ -5341,10 +5344,10 @@ class ji {
|
|
|
5341
5344
|
style: {
|
|
5342
5345
|
position: "absolute",
|
|
5343
5346
|
top: `${0.5}px`,
|
|
5344
|
-
left: `${s
|
|
5347
|
+
left: `${s - 0.5}px`,
|
|
5345
5348
|
overflow: "hidden",
|
|
5346
|
-
width: `${
|
|
5347
|
-
height: `${
|
|
5349
|
+
width: `${h - s - f}px`,
|
|
5350
|
+
height: `${l}px`
|
|
5348
5351
|
},
|
|
5349
5352
|
cells: t
|
|
5350
5353
|
}, u = {
|
|
@@ -5355,18 +5358,18 @@ class ji {
|
|
|
5355
5358
|
right: `${0.5}px`,
|
|
5356
5359
|
overflow: "hidden",
|
|
5357
5360
|
width: `${f}px`,
|
|
5358
|
-
height: `${
|
|
5361
|
+
height: `${l}px`
|
|
5359
5362
|
},
|
|
5360
5363
|
cells: i
|
|
5361
5364
|
};
|
|
5362
5365
|
return {
|
|
5363
5366
|
type: "footer",
|
|
5364
|
-
class: `${
|
|
5367
|
+
class: `${a}-overlayer-footer`,
|
|
5365
5368
|
style: {
|
|
5366
5369
|
position: "relative",
|
|
5367
5370
|
overflow: "hidden",
|
|
5368
|
-
width: `${
|
|
5369
|
-
height: `${
|
|
5371
|
+
width: `${h}px`,
|
|
5372
|
+
height: `${l}px`
|
|
5370
5373
|
},
|
|
5371
5374
|
views: [d, x, u]
|
|
5372
5375
|
};
|
|
@@ -5382,8 +5385,8 @@ class Ui {
|
|
|
5382
5385
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5383
5386
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5384
5387
|
e.preventDefault();
|
|
5385
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [
|
|
5386
|
-
|
|
5388
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a, h] = s, { rowIndex: l, colIndex: f } = t;
|
|
5389
|
+
l >= a && l <= h && f >= r && f <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5387
5390
|
const x = {
|
|
5388
5391
|
getBoundingClientRect: () => ({
|
|
5389
5392
|
width: 0,
|
|
@@ -5400,14 +5403,14 @@ class Ui {
|
|
|
5400
5403
|
pe(x, this.contextMenuEl, {
|
|
5401
5404
|
placement: "right-start",
|
|
5402
5405
|
middleware: [ue(), ge(), we()]
|
|
5403
|
-
}).then(({ x: u, y:
|
|
5404
|
-
this.show(u,
|
|
5406
|
+
}).then(({ x: u, y: g }) => {
|
|
5407
|
+
this.show(u, g);
|
|
5405
5408
|
});
|
|
5406
5409
|
}), this.ctx.on("click", this.hide.bind(this)), this.ctx.on("onScroll", this.hide.bind(this)), this.ctx.on("resize", this.hide.bind(this));
|
|
5407
5410
|
}
|
|
5408
5411
|
//创建右键菜单,绑定子项点击事件
|
|
5409
5412
|
createContextMenu() {
|
|
5410
|
-
this.contextMenuEl.replaceChildren(), this.contextMenuEl.className = "e-virt-table-context-menu", this.ctx.
|
|
5413
|
+
this.contextMenuEl.replaceChildren(), this.contextMenuEl.className = "e-virt-table-context-menu", this.ctx.containerElement.appendChild(this.contextMenuEl);
|
|
5411
5414
|
const { CONTEXT_MENU: t } = this.ctx.config;
|
|
5412
5415
|
this.createContextMenuItems(t, (e) => {
|
|
5413
5416
|
switch (e.value) {
|
|
@@ -5457,8 +5460,6 @@ class Ui {
|
|
|
5457
5460
|
}
|
|
5458
5461
|
class Qi {
|
|
5459
5462
|
constructor(t, e) {
|
|
5460
|
-
c(this, "targetContainer");
|
|
5461
|
-
c(this, "target");
|
|
5462
5463
|
c(this, "options");
|
|
5463
5464
|
c(this, "scroller");
|
|
5464
5465
|
c(this, "header");
|
|
@@ -5472,11 +5473,27 @@ class Qi {
|
|
|
5472
5473
|
c(this, "overlayer");
|
|
5473
5474
|
c(this, "contextMenu");
|
|
5474
5475
|
c(this, "ctx");
|
|
5475
|
-
this.
|
|
5476
|
+
this.options = e;
|
|
5477
|
+
const { overlayerElement: i } = e, s = this.createContainer(t, i);
|
|
5478
|
+
this.ctx = new hi(s, this.options), this.header = new di(this.ctx), this.body = new fi(this.ctx), this.footer = new xi(this.ctx), this.scroller = new li(this.ctx), this.selector = new ui(this.ctx), this.autofill = new gi(this.ctx), this.tooltip = new $i(this.ctx), this.empty = new Gi(this.ctx), this.editor = new qi(this.ctx), this.overlayer = new ji(this.ctx), this.contextMenu = new Ui(this.ctx), this.ctx.on("draw", () => {
|
|
5479
|
+
this.draw();
|
|
5480
|
+
}), this.ctx.on("drawView", () => {
|
|
5481
|
+
this.draw(!0);
|
|
5482
|
+
}), this.draw();
|
|
5483
|
+
}
|
|
5484
|
+
createContainer(t, e) {
|
|
5485
|
+
t.className = "e-virt-table-container";
|
|
5486
|
+
const i = document.createElement("div"), s = document.createElement("canvas"), r = e || document.createElement("div");
|
|
5487
|
+
return i.className = "e-virt-table-stage", s.className = "e-virt-table-canvas", r.className = "e-virt-table-overlayer", i.appendChild(s), i.appendChild(r), t.appendChild(i), {
|
|
5488
|
+
containerElement: t,
|
|
5489
|
+
stageElement: i,
|
|
5490
|
+
canvasElement: s,
|
|
5491
|
+
overlayerElement: r
|
|
5492
|
+
};
|
|
5476
5493
|
}
|
|
5477
|
-
draw() {
|
|
5494
|
+
draw(t = !1) {
|
|
5478
5495
|
requestAnimationFrame(() => {
|
|
5479
|
-
this.header.update(), this.footer.update(), this.body.update(), this.ctx.paint.clear(), this.body.draw(), this.footer.draw(), this.header.draw(), this.scroller.draw(), this.overlayer.draw();
|
|
5496
|
+
this.header.update(), this.footer.update(), this.body.update(), this.ctx.paint.clear(), this.body.draw(), this.footer.draw(), this.header.draw(), this.scroller.draw(), t || this.overlayer.draw();
|
|
5480
5497
|
});
|
|
5481
5498
|
}
|
|
5482
5499
|
loadConfig(t) {
|
|
@@ -5536,8 +5553,8 @@ class Qi {
|
|
|
5536
5553
|
if (t && Array.isArray(s) && s.length) {
|
|
5537
5554
|
const [r] = s;
|
|
5538
5555
|
if (Array.isArray(r) && r.length) {
|
|
5539
|
-
const [o] = r, { rowKey:
|
|
5540
|
-
this.scrollToRowkey(
|
|
5556
|
+
const [o] = r, { rowKey: a, key: h } = o;
|
|
5557
|
+
this.scrollToRowkey(a), this.scrollToColkey(h);
|
|
5541
5558
|
}
|
|
5542
5559
|
}
|
|
5543
5560
|
i(s);
|
|
@@ -5561,8 +5578,8 @@ class Qi {
|
|
|
5561
5578
|
const i = this.ctx.database.getAllRowsData(), s = this.ctx.header.leafCellHeaders;
|
|
5562
5579
|
let r = [];
|
|
5563
5580
|
for (let o = 0; o < i.length; o++)
|
|
5564
|
-
for (let
|
|
5565
|
-
const
|
|
5581
|
+
for (let a = 0; a < s.length; a++) {
|
|
5582
|
+
const h = this.ctx.database.getRowKeyByItem(i[o]), f = s[a].key, d = await this.ctx.database.getValidator(h, f);
|
|
5566
5583
|
Array.isArray(d) && d.length && r.push(d);
|
|
5567
5584
|
}
|
|
5568
5585
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
@@ -5610,17 +5627,29 @@ class Qi {
|
|
|
5610
5627
|
toggleAllSelection() {
|
|
5611
5628
|
this.ctx.database.toggleAllSelection(), this.ctx.emit("draw");
|
|
5612
5629
|
}
|
|
5630
|
+
toggleRowExpand(t, e) {
|
|
5631
|
+
this.ctx.database.expandItem(t, e), this.ctx.emit("draw");
|
|
5632
|
+
}
|
|
5633
|
+
toggleExpandAll(t) {
|
|
5634
|
+
this.ctx.database.expandAll(t), this.ctx.emit("draw");
|
|
5635
|
+
}
|
|
5613
5636
|
getSelectionRows() {
|
|
5614
5637
|
return this.ctx.database.getSelectionRows();
|
|
5615
5638
|
}
|
|
5616
5639
|
getPositionForRowIndex(t) {
|
|
5617
5640
|
return this.ctx.database.getPositionForRowIndex(t);
|
|
5618
5641
|
}
|
|
5642
|
+
getCellValue(t, e) {
|
|
5643
|
+
return this.ctx.database.getItemValue(t, e);
|
|
5644
|
+
}
|
|
5645
|
+
getCellValueByIndex(t, e) {
|
|
5646
|
+
return this.ctx.database.getItemValueForRowIndexAndColIndex(t, e);
|
|
5647
|
+
}
|
|
5619
5648
|
/**
|
|
5620
5649
|
* 销毁
|
|
5621
5650
|
*/
|
|
5622
5651
|
destroy() {
|
|
5623
|
-
this.overlayer.destroy(), this.empty.destroy(), this.editor.destroy(), this.tooltip.destroy(), this.selector.destroy(), this.autofill.destroy(), this.contextMenu.destroy(), this.ctx.destroy(), this.
|
|
5652
|
+
this.overlayer.destroy(), this.empty.destroy(), this.editor.destroy(), this.tooltip.destroy(), this.selector.destroy(), this.autofill.destroy(), this.contextMenu.destroy(), this.ctx.destroy(), this.ctx.containerElement.remove();
|
|
5624
5653
|
}
|
|
5625
5654
|
}
|
|
5626
5655
|
export {
|