e-virt-table 0.0.10 → 0.0.12
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 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +628 -591
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Editor.js +1 -0
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/Scroller.js +7 -0
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.js +6 -11
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/util.d.ts +15 -1
- package/dist/lib/util.js +114 -1
- package/dist/lib/util.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
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-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);pointer-events:auto;display:flex;align-items:center}.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}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var c = (a, t, e) =>
|
|
2
|
+
var me = Object.defineProperty;
|
|
3
|
+
var Ee = (a, t, e) => t in a ? me(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
4
|
+
var c = (a, t, e) => Ee(a, typeof t != "symbol" ? t + "" : t, e);
|
|
5
5
|
function $() {
|
|
6
6
|
return $ = Object.assign ? Object.assign.bind() : function(a) {
|
|
7
7
|
for (var t = 1; t < arguments.length; t++) {
|
|
@@ -12,7 +12,7 @@ function $() {
|
|
|
12
12
|
return a;
|
|
13
13
|
}, $.apply(this, arguments);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function be(a, t) {
|
|
16
16
|
a.prototype = Object.create(t.prototype), a.prototype.constructor = a, st(a, t);
|
|
17
17
|
}
|
|
18
18
|
function Et(a) {
|
|
@@ -25,7 +25,7 @@ function st(a, t) {
|
|
|
25
25
|
return i.__proto__ = s, i;
|
|
26
26
|
}, st(a, 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 {
|
|
@@ -36,20 +36,20 @@ function Ee() {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
function dt(a, t, e) {
|
|
39
|
-
return
|
|
39
|
+
return Ce() ? dt = Reflect.construct.bind() : dt = function(s, o, r) {
|
|
40
40
|
var n = [null];
|
|
41
41
|
n.push.apply(n, o);
|
|
42
|
-
var
|
|
43
|
-
return r && st(
|
|
42
|
+
var l = Function.bind.apply(s, n), h = new l();
|
|
43
|
+
return r && st(h, r.prototype), h;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function ve(a) {
|
|
47
47
|
return Function.toString.call(a).indexOf("[native code]") !== -1;
|
|
48
48
|
}
|
|
49
49
|
function bt(a) {
|
|
50
50
|
var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
51
51
|
return bt = function(i) {
|
|
52
|
-
if (i === null || !
|
|
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");
|
|
55
55
|
if (typeof t < "u") {
|
|
@@ -69,9 +69,9 @@ function bt(a) {
|
|
|
69
69
|
}), st(s, i);
|
|
70
70
|
}, bt(a);
|
|
71
71
|
}
|
|
72
|
-
var
|
|
72
|
+
var Re = /%[sdj%]/g, jt = 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" && (jt = 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);
|
|
@@ -91,7 +91,7 @@ function M(a) {
|
|
|
91
91
|
if (typeof a == "function")
|
|
92
92
|
return a.apply(null, e);
|
|
93
93
|
if (typeof a == "string") {
|
|
94
|
-
var r = a.replace(
|
|
94
|
+
var r = a.replace(Re, function(n) {
|
|
95
95
|
if (n === "%%")
|
|
96
96
|
return "%";
|
|
97
97
|
if (s >= o)
|
|
@@ -116,13 +116,13 @@ function M(a) {
|
|
|
116
116
|
}
|
|
117
117
|
return a;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Ie(a) {
|
|
120
120
|
return a === "string" || a === "url" || a === "hex" || a === "email" || a === "date" || a === "pattern";
|
|
121
121
|
}
|
|
122
122
|
function I(a, t) {
|
|
123
|
-
return !!(a == null || t === "array" && Array.isArray(a) && !a.length ||
|
|
123
|
+
return !!(a == null || t === "array" && Array.isArray(a) && !a.length || Ie(t) && typeof a == "string" && !a);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function _e(a, t, e) {
|
|
126
126
|
var i = [], s = 0, o = a.length;
|
|
127
127
|
function r(n) {
|
|
128
128
|
i.push.apply(i, n || []), s++, s === o && e(i);
|
|
@@ -143,50 +143,50 @@ function kt(a, t, e) {
|
|
|
143
143
|
}
|
|
144
144
|
o([]);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function Oe(a) {
|
|
147
147
|
var t = [];
|
|
148
148
|
return Object.keys(a).forEach(function(e) {
|
|
149
149
|
t.push.apply(t, a[e] || []);
|
|
150
150
|
}), t;
|
|
151
151
|
}
|
|
152
152
|
var Ft = /* @__PURE__ */ function(a) {
|
|
153
|
-
|
|
153
|
+
be(t, a);
|
|
154
154
|
function t(e, i) {
|
|
155
155
|
var s;
|
|
156
156
|
return s = a.call(this, "Async Validation Error") || this, s.errors = e, s.fields = i, s;
|
|
157
157
|
}
|
|
158
158
|
return t;
|
|
159
159
|
}(/* @__PURE__ */ bt(Error));
|
|
160
|
-
function
|
|
160
|
+
function Se(a, t, e, i, s) {
|
|
161
161
|
if (t.first) {
|
|
162
162
|
var o = new Promise(function(x, u) {
|
|
163
163
|
var y = function(p) {
|
|
164
164
|
return i(p), p.length ? u(new Ft(p, Ct(p))) : x(s);
|
|
165
|
-
}, g =
|
|
165
|
+
}, g = Oe(a);
|
|
166
166
|
kt(g, e, y);
|
|
167
167
|
});
|
|
168
168
|
return o.catch(function(x) {
|
|
169
169
|
return x;
|
|
170
170
|
}), o;
|
|
171
171
|
}
|
|
172
|
-
var r = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a),
|
|
172
|
+
var r = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a), l = n.length, h = 0, f = [], d = new Promise(function(x, u) {
|
|
173
173
|
var y = function(w) {
|
|
174
|
-
if (f.push.apply(f, w),
|
|
174
|
+
if (f.push.apply(f, w), h++, h === l)
|
|
175
175
|
return i(f), f.length ? u(new Ft(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
177
|
n.length || (i(f), x(s)), n.forEach(function(g) {
|
|
178
178
|
var w = a[g];
|
|
179
|
-
r.indexOf(g) !== -1 ? kt(w, e, y) :
|
|
179
|
+
r.indexOf(g) !== -1 ? kt(w, e, y) : _e(w, e, y);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
return d.catch(function(x) {
|
|
183
183
|
return x;
|
|
184
184
|
}), d;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Te(a) {
|
|
187
187
|
return !!(a && a.message !== void 0);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Le(a, t) {
|
|
190
190
|
for (var e = a, i = 0; i < t.length; i++) {
|
|
191
191
|
if (e == null)
|
|
192
192
|
return e;
|
|
@@ -197,7 +197,7 @@ function Se(a, t) {
|
|
|
197
197
|
function Nt(a, t) {
|
|
198
198
|
return function(e) {
|
|
199
199
|
var i;
|
|
200
|
-
return a.fullFields ? i =
|
|
200
|
+
return a.fullFields ? i = Le(t, a.fullFields) : i = t[e.field || a.fullField], Te(e) ? (e.field = e.field || a.fullField, e.fieldValue = i, e) : {
|
|
201
201
|
message: typeof e == "function" ? e() : e,
|
|
202
202
|
fieldValue: i,
|
|
203
203
|
field: e.field || a.fullField
|
|
@@ -214,13 +214,13 @@ function Yt(a, t) {
|
|
|
214
214
|
}
|
|
215
215
|
return a;
|
|
216
216
|
}
|
|
217
|
-
var
|
|
217
|
+
var Ut = function(t, e, i, s, o, r) {
|
|
218
218
|
t.required && (!i.hasOwnProperty(t.field) || I(e, r || t.type)) && s.push(M(o.messages.required, t.fullField));
|
|
219
|
-
},
|
|
219
|
+
}, Ae = function(t, e, i, s, o) {
|
|
220
220
|
(/^\s+$/.test(e) || e === "") && s.push(M(o.messages.whitespace, t.fullField));
|
|
221
|
-
},
|
|
222
|
-
if (
|
|
223
|
-
return
|
|
221
|
+
}, ht, Me = function() {
|
|
222
|
+
if (ht)
|
|
223
|
+
return ht;
|
|
224
224
|
var a = "[a-fA-F\\d:]", t = function(b) {
|
|
225
225
|
return b && b.includeBoundaries ? "(?:(?<=\\s|^)(?=" + a + ")|(?<=" + a + ")(?=\\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 = (`
|
|
@@ -234,16 +234,16 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
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(), o = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), r = new RegExp("^" + e + "$"), n = new RegExp("^" + s + "$"),
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), o = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), r = new RegExp("^" + e + "$"), n = new RegExp("^" + s + "$"), l = function(b) {
|
|
238
238
|
return b && b.exact ? o : new RegExp("(?:" + t(b) + e + t(b) + ")|(?:" + t(b) + s + t(b) + ")", "g");
|
|
239
239
|
};
|
|
240
|
-
|
|
240
|
+
l.v4 = function(m) {
|
|
241
241
|
return m && m.exact ? r : new RegExp("" + t(m) + e + t(m), "g");
|
|
242
|
-
},
|
|
242
|
+
}, l.v6 = function(m) {
|
|
243
243
|
return m && m.exact ? n : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var
|
|
246
|
-
return
|
|
245
|
+
var h = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d = l.v4().source, x = l.v6().source, u = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", y = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", g = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", p = '(?:[/?#][^\\s"]*)?', E = "(?:" + h + "|www\\.)" + f + "(?:localhost|" + d + "|" + x + "|" + u + y + g + ")" + w + p;
|
|
246
|
+
return ht = new RegExp("(?:^" + E + "$)", "i"), ht;
|
|
247
247
|
}, Kt = {
|
|
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,}))$/,
|
|
@@ -287,26 +287,26 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
287
287
|
return typeof t == "string" && t.length <= 320 && !!t.match(Kt.email);
|
|
288
288
|
},
|
|
289
289
|
url: function(t) {
|
|
290
|
-
return typeof t == "string" && t.length <= 2048 && !!t.match(
|
|
290
|
+
return typeof t == "string" && t.length <= 2048 && !!t.match(Me());
|
|
291
291
|
},
|
|
292
292
|
hex: function(t) {
|
|
293
293
|
return typeof t == "string" && !!t.match(Kt.hex);
|
|
294
294
|
}
|
|
295
|
-
},
|
|
295
|
+
}, He = function(t, e, i, s, o) {
|
|
296
296
|
if (t.required && e === void 0) {
|
|
297
|
-
|
|
297
|
+
Ut(t, e, i, s, o);
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
var r = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], n = t.type;
|
|
301
301
|
r.indexOf(n) > -1 ? et[n](e) || s.push(M(o.messages.types[n], t.fullField, t.type)) : n && typeof e !== t.type && s.push(M(o.messages.types[n], t.fullField, t.type));
|
|
302
|
-
},
|
|
303
|
-
var r = typeof t.len == "number", n = typeof t.min == "number",
|
|
302
|
+
}, De = function(t, e, i, s, o) {
|
|
303
|
+
var r = typeof t.len == "number", n = typeof t.min == "number", l = typeof t.max == "number", h = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, f = e, d = null, x = typeof e == "number", u = typeof e == "string", y = Array.isArray(e);
|
|
304
304
|
if (x ? d = "number" : u ? d = "string" : y && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
|
-
y && (f = e.length), u && (f = e.replace(
|
|
307
|
-
}, j = "enum",
|
|
306
|
+
y && (f = e.length), u && (f = e.replace(h, "_").length), r ? f !== t.len && s.push(M(o.messages[d].len, t.fullField, t.len)) : n && !l && f < t.min ? s.push(M(o.messages[d].min, t.fullField, t.min)) : l && !n && f > t.max ? s.push(M(o.messages[d].max, t.fullField, t.max)) : n && l && (f < t.min || f > t.max) && s.push(M(o.messages[d].range, t.fullField, t.min, t.max));
|
|
307
|
+
}, j = "enum", Xe = function(t, e, i, s, o) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(M(o.messages[j], t.fullField, t[j].join(", ")));
|
|
309
|
-
},
|
|
309
|
+
}, ke = function(t, e, i, s, o) {
|
|
310
310
|
if (t.pattern) {
|
|
311
311
|
if (t.pattern instanceof RegExp)
|
|
312
312
|
t.pattern.lastIndex = 0, t.pattern.test(e) || s.push(M(o.messages.pattern.mismatch, t.fullField, e, t.pattern));
|
|
@@ -316,13 +316,13 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}, v = {
|
|
319
|
-
required:
|
|
320
|
-
whitespace:
|
|
321
|
-
type:
|
|
322
|
-
range:
|
|
323
|
-
enum:
|
|
324
|
-
pattern:
|
|
325
|
-
},
|
|
319
|
+
required: Ut,
|
|
320
|
+
whitespace: Ae,
|
|
321
|
+
type: He,
|
|
322
|
+
range: De,
|
|
323
|
+
enum: Xe,
|
|
324
|
+
pattern: ke
|
|
325
|
+
}, Fe = function(t, e, i, s, o) {
|
|
326
326
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
327
327
|
if (n) {
|
|
328
328
|
if (I(e, "string") && !t.required)
|
|
@@ -330,7 +330,7 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
330
330
|
v.required(t, e, s, r, o, "string"), I(e, "string") || (v.type(t, e, s, r, o), v.range(t, e, s, r, o), v.pattern(t, e, s, r, o), t.whitespace === !0 && v.whitespace(t, e, s, r, o));
|
|
331
331
|
}
|
|
332
332
|
i(r);
|
|
333
|
-
},
|
|
333
|
+
}, Ne = function(t, e, i, s, o) {
|
|
334
334
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
335
335
|
if (n) {
|
|
336
336
|
if (I(e) && !t.required)
|
|
@@ -338,7 +338,7 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
338
338
|
v.required(t, e, s, r, o), e !== void 0 && v.type(t, e, s, r, o);
|
|
339
339
|
}
|
|
340
340
|
i(r);
|
|
341
|
-
},
|
|
341
|
+
}, Ye = function(t, e, i, s, o) {
|
|
342
342
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
343
343
|
if (n) {
|
|
344
344
|
if (e === "" && (e = void 0), I(e) && !t.required)
|
|
@@ -346,7 +346,7 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
346
346
|
v.required(t, e, s, r, o), e !== void 0 && (v.type(t, e, s, r, o), v.range(t, e, s, r, o));
|
|
347
347
|
}
|
|
348
348
|
i(r);
|
|
349
|
-
},
|
|
349
|
+
}, Ke = function(t, e, i, s, o) {
|
|
350
350
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
351
351
|
if (n) {
|
|
352
352
|
if (I(e) && !t.required)
|
|
@@ -354,7 +354,7 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
354
354
|
v.required(t, e, s, r, o), e !== void 0 && v.type(t, e, s, r, o);
|
|
355
355
|
}
|
|
356
356
|
i(r);
|
|
357
|
-
},
|
|
357
|
+
}, Be = function(t, e, i, s, o) {
|
|
358
358
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
359
359
|
if (n) {
|
|
360
360
|
if (I(e) && !t.required)
|
|
@@ -362,7 +362,7 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
362
362
|
v.required(t, e, s, r, o), I(e) || v.type(t, e, s, r, o);
|
|
363
363
|
}
|
|
364
364
|
i(r);
|
|
365
|
-
},
|
|
365
|
+
}, We = function(t, e, i, s, o) {
|
|
366
366
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
367
367
|
if (n) {
|
|
368
368
|
if (I(e) && !t.required)
|
|
@@ -370,7 +370,7 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
370
370
|
v.required(t, e, s, r, o), e !== void 0 && (v.type(t, e, s, r, o), v.range(t, e, s, r, o));
|
|
371
371
|
}
|
|
372
372
|
i(r);
|
|
373
|
-
},
|
|
373
|
+
}, Pe = function(t, e, i, s, o) {
|
|
374
374
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
375
375
|
if (n) {
|
|
376
376
|
if (I(e) && !t.required)
|
|
@@ -378,7 +378,7 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
378
378
|
v.required(t, e, s, r, o), e !== void 0 && (v.type(t, e, s, r, o), v.range(t, e, s, r, o));
|
|
379
379
|
}
|
|
380
380
|
i(r);
|
|
381
|
-
},
|
|
381
|
+
}, Ve = function(t, e, i, s, o) {
|
|
382
382
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
383
383
|
if (n) {
|
|
384
384
|
if (e == null && !t.required)
|
|
@@ -386,7 +386,7 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
386
386
|
v.required(t, e, s, r, o, "array"), e != null && (v.type(t, e, s, r, o), v.range(t, e, s, r, o));
|
|
387
387
|
}
|
|
388
388
|
i(r);
|
|
389
|
-
},
|
|
389
|
+
}, ze = function(t, e, i, s, o) {
|
|
390
390
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
391
391
|
if (n) {
|
|
392
392
|
if (I(e) && !t.required)
|
|
@@ -394,15 +394,15 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
394
394
|
v.required(t, e, s, r, o), e !== void 0 && v.type(t, e, s, r, o);
|
|
395
395
|
}
|
|
396
396
|
i(r);
|
|
397
|
-
},
|
|
397
|
+
}, $e = "enum", qe = function(t, e, i, s, o) {
|
|
398
398
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
399
399
|
if (n) {
|
|
400
400
|
if (I(e) && !t.required)
|
|
401
401
|
return i();
|
|
402
|
-
v.required(t, e, s, r, o), e !== void 0 && v[
|
|
402
|
+
v.required(t, e, s, r, o), e !== void 0 && v[$e](t, e, s, r, o);
|
|
403
403
|
}
|
|
404
404
|
i(r);
|
|
405
|
-
},
|
|
405
|
+
}, Ge = function(t, e, i, s, o) {
|
|
406
406
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
407
407
|
if (n) {
|
|
408
408
|
if (I(e, "string") && !t.required)
|
|
@@ -410,29 +410,29 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
410
410
|
v.required(t, e, s, r, o), I(e, "string") || v.pattern(t, e, s, r, o);
|
|
411
411
|
}
|
|
412
412
|
i(r);
|
|
413
|
-
},
|
|
413
|
+
}, je = function(t, e, i, s, o) {
|
|
414
414
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
415
415
|
if (n) {
|
|
416
416
|
if (I(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
418
|
if (v.required(t, e, s, r, o), !I(e, "date")) {
|
|
419
|
-
var
|
|
420
|
-
e instanceof Date ?
|
|
419
|
+
var l;
|
|
420
|
+
e instanceof Date ? l = e : l = new Date(e), v.type(t, l, s, r, o), l && v.range(t, l.getTime(), s, r, o);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
i(r);
|
|
424
|
-
},
|
|
424
|
+
}, Ue = function(t, e, i, s, o) {
|
|
425
425
|
var r = [], n = Array.isArray(e) ? "array" : typeof e;
|
|
426
426
|
v.required(t, e, s, r, o, n), i(r);
|
|
427
427
|
}, yt = function(t, e, i, s, o) {
|
|
428
|
-
var r = t.type, n = [],
|
|
429
|
-
if (
|
|
428
|
+
var r = t.type, n = [], l = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (l) {
|
|
430
430
|
if (I(e, r) && !t.required)
|
|
431
431
|
return i();
|
|
432
432
|
v.required(t, e, s, n, o, r), I(e, r) || v.type(t, e, s, n, o);
|
|
433
433
|
}
|
|
434
434
|
i(n);
|
|
435
|
-
},
|
|
435
|
+
}, Ze = function(t, e, i, s, o) {
|
|
436
436
|
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
437
437
|
if (n) {
|
|
438
438
|
if (I(e) && !t.required)
|
|
@@ -441,23 +441,23 @@ var Gt = function(t, e, i, s, o, r) {
|
|
|
441
441
|
}
|
|
442
442
|
i(r);
|
|
443
443
|
}, it = {
|
|
444
|
-
string:
|
|
445
|
-
method:
|
|
446
|
-
number:
|
|
447
|
-
boolean:
|
|
448
|
-
regexp:
|
|
449
|
-
integer:
|
|
450
|
-
float:
|
|
451
|
-
array:
|
|
452
|
-
object:
|
|
453
|
-
enum:
|
|
454
|
-
pattern:
|
|
455
|
-
date:
|
|
444
|
+
string: Fe,
|
|
445
|
+
method: Ne,
|
|
446
|
+
number: Ye,
|
|
447
|
+
boolean: Ke,
|
|
448
|
+
regexp: Be,
|
|
449
|
+
integer: We,
|
|
450
|
+
float: Pe,
|
|
451
|
+
array: Ve,
|
|
452
|
+
object: ze,
|
|
453
|
+
enum: qe,
|
|
454
|
+
pattern: Ge,
|
|
455
|
+
date: je,
|
|
456
456
|
url: yt,
|
|
457
457
|
hex: yt,
|
|
458
458
|
email: yt,
|
|
459
|
-
required:
|
|
460
|
-
any:
|
|
459
|
+
required: Ue,
|
|
460
|
+
any: Ze
|
|
461
461
|
};
|
|
462
462
|
function vt() {
|
|
463
463
|
return {
|
|
@@ -533,9 +533,9 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
533
533
|
var r = this;
|
|
534
534
|
s === void 0 && (s = {}), o === void 0 && (o = function() {
|
|
535
535
|
});
|
|
536
|
-
var n = i,
|
|
537
|
-
if (typeof
|
|
538
|
-
return
|
|
536
|
+
var n = i, l = s, h = o;
|
|
537
|
+
if (typeof l == "function" && (h = l, l = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
|
+
return h && h(null, n), Promise.resolve(n);
|
|
539
539
|
function f(g) {
|
|
540
540
|
var w = [], p = {};
|
|
541
541
|
function E(b) {
|
|
@@ -547,14 +547,14 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
547
547
|
}
|
|
548
548
|
for (var m = 0; m < g.length; m++)
|
|
549
549
|
E(g[m]);
|
|
550
|
-
w.length ? (p = Ct(w),
|
|
550
|
+
w.length ? (p = Ct(w), h(w, p)) : h(null, n);
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
552
|
+
if (l.messages) {
|
|
553
553
|
var d = this.messages();
|
|
554
|
-
d === Rt && (d = vt()), Yt(d,
|
|
554
|
+
d === Rt && (d = vt()), Yt(d, l.messages), l.messages = d;
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
var x = {}, u =
|
|
556
|
+
l.messages = this.messages();
|
|
557
|
+
var x = {}, u = l.keys || Object.keys(this.rules);
|
|
558
558
|
u.forEach(function(g) {
|
|
559
559
|
var w = r.rules[g], p = n[g];
|
|
560
560
|
w.forEach(function(E) {
|
|
@@ -570,7 +570,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
var y = {};
|
|
573
|
-
return
|
|
573
|
+
return Se(x, l, function(g, w) {
|
|
574
574
|
var p = g.rule, E = (p.type === "object" || p.type === "array") && (typeof p.fields == "object" || typeof p.defaultField == "object");
|
|
575
575
|
E = E && (p.required || !p.required && g.value), p.field = g.field;
|
|
576
576
|
function m(R, T) {
|
|
@@ -582,15 +582,15 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
582
582
|
function b(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
584
|
var T = Array.isArray(R) ? R : [R];
|
|
585
|
-
!
|
|
585
|
+
!l.suppressWarning && T.length && a.warning("async-validator:", T), T.length && p.message !== void 0 && (T = [].concat(p.message));
|
|
586
586
|
var L = T.map(Nt(p, n));
|
|
587
|
-
if (
|
|
587
|
+
if (l.first && L.length)
|
|
588
588
|
return y[p.field] = 1, w(L);
|
|
589
589
|
if (!E)
|
|
590
590
|
w(L);
|
|
591
591
|
else {
|
|
592
592
|
if (p.required && !g.value)
|
|
593
|
-
return p.message !== void 0 ? L = [].concat(p.message).map(Nt(p, n)) :
|
|
593
|
+
return p.message !== void 0 ? L = [].concat(p.message).map(Nt(p, n)) : l.error && (L = [l.error(p, M(l.messages.required, p.field))]), w(L);
|
|
594
594
|
var A = {};
|
|
595
595
|
p.defaultField && Object.keys(g.value).map(function(_) {
|
|
596
596
|
A[_] = p.defaultField;
|
|
@@ -601,7 +601,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
601
601
|
D[_] = O.map(m.bind(null, _));
|
|
602
602
|
});
|
|
603
603
|
var B = new a(D);
|
|
604
|
-
B.messages(
|
|
604
|
+
B.messages(l.messages), g.rule.options && (g.rule.options.messages = l.messages, g.rule.options.error = l.error), B.validate(g.value, g.rule.options || l, function(_) {
|
|
605
605
|
var S = [];
|
|
606
606
|
L && L.length && S.push.apply(S, L), _ && _.length && S.push.apply(S, _), w(S.length ? S : null);
|
|
607
607
|
});
|
|
@@ -609,12 +609,12 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
609
609
|
}
|
|
610
610
|
var C;
|
|
611
611
|
if (p.asyncValidator)
|
|
612
|
-
C = p.asyncValidator(p, g.value, b, g.source,
|
|
612
|
+
C = p.asyncValidator(p, g.value, b, g.source, l);
|
|
613
613
|
else if (p.validator) {
|
|
614
614
|
try {
|
|
615
|
-
C = p.validator(p, g.value, b, g.source,
|
|
615
|
+
C = p.validator(p, g.value, b, g.source, l);
|
|
616
616
|
} catch (R) {
|
|
617
|
-
console.error == null || console.error(R),
|
|
617
|
+
console.error == null || console.error(R), l.suppressValidatorError || setTimeout(function() {
|
|
618
618
|
throw R;
|
|
619
619
|
}, 0), b(R.message);
|
|
620
620
|
}
|
|
@@ -644,7 +644,7 @@ nt.register = function(t, e) {
|
|
|
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 = jt;
|
|
648
648
|
nt.messages = Rt;
|
|
649
649
|
nt.validators = it;
|
|
650
650
|
function At() {
|
|
@@ -653,7 +653,7 @@ function At() {
|
|
|
653
653
|
return (a === "x" ? t : t & 3 | 8).toString(16);
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
|
-
function
|
|
656
|
+
function Zt(a, t) {
|
|
657
657
|
let e = 0, i;
|
|
658
658
|
return function(...s) {
|
|
659
659
|
const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e;
|
|
@@ -662,10 +662,10 @@ function jt(a, t) {
|
|
|
662
662
|
}, t - r));
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
|
-
function
|
|
666
|
-
return a ? a.map((t) =>
|
|
665
|
+
function Jt(a) {
|
|
666
|
+
return a ? a.map((t) => Jt(t.children) + 1).sort((t, e) => e - t)[0] : 0;
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function Je(a = []) {
|
|
669
669
|
let t = [], e = [], i = [];
|
|
670
670
|
return a.forEach((s) => {
|
|
671
671
|
s.fixed === "left" ? t.push(s) : s.fixed === "right" ? i.push(s) : e.push(s);
|
|
@@ -675,14 +675,14 @@ function Ue(a = []) {
|
|
|
675
675
|
...i.sort((s, o) => s.sort - o.sort)
|
|
676
676
|
];
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function Qt(a = [], t = 1, e = 0) {
|
|
679
679
|
return a.map((i) => {
|
|
680
680
|
if (i.children) {
|
|
681
681
|
let s = 0, o = i.fixed;
|
|
682
682
|
i.children.forEach((n) => {
|
|
683
683
|
n.fixed = o;
|
|
684
684
|
});
|
|
685
|
-
const r =
|
|
685
|
+
const r = Qt(i.children, t - 1, e + 1);
|
|
686
686
|
return r && r.forEach((n) => {
|
|
687
687
|
s += n.colspan;
|
|
688
688
|
}), {
|
|
@@ -708,7 +708,46 @@ function It(a = []) {
|
|
|
708
708
|
e.children ? t = t.concat(It(e.children)) : t.push(e);
|
|
709
709
|
}), t;
|
|
710
710
|
}
|
|
711
|
-
|
|
711
|
+
const Bt = /^(\r\n|\n\r|\r|\n)/, Qe = /^[^\t\r\n]+/, Wt = /^\t/;
|
|
712
|
+
function ti(a) {
|
|
713
|
+
let t = [[""]];
|
|
714
|
+
if (a.length === 0)
|
|
715
|
+
return t;
|
|
716
|
+
let e = 0, i = 0, s;
|
|
717
|
+
for (; a.length > 0 && s !== a.length; )
|
|
718
|
+
if (s = a.length, a.match(Wt))
|
|
719
|
+
a = a.replace(Wt, ""), e += 1, t[i][e] = "";
|
|
720
|
+
else if (a.match(Bt))
|
|
721
|
+
a = a.replace(Bt, ""), e = 0, i += 1, t[i] = [""];
|
|
722
|
+
else {
|
|
723
|
+
let o = "";
|
|
724
|
+
if (a.startsWith('"')) {
|
|
725
|
+
let r = 0, n = !0;
|
|
726
|
+
for (; n; ) {
|
|
727
|
+
const l = a.slice(0, 1);
|
|
728
|
+
l === '"' && (r += 1), o += l, a = a.slice(1), (a.length === 0 || a.match(/^[\t\r\n]/) && r % 2 === 0) && (n = !1);
|
|
729
|
+
}
|
|
730
|
+
o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (l) => new Array(Math.floor(l.length / 2)).fill('"').join(""));
|
|
731
|
+
} else {
|
|
732
|
+
const r = a.match(Qe);
|
|
733
|
+
o = r ? r[0] : "", a = a.slice(o.length);
|
|
734
|
+
}
|
|
735
|
+
t[i][e] = o;
|
|
736
|
+
}
|
|
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
|
+
}
|
|
739
|
+
function ei(a) {
|
|
740
|
+
let t, e, i, s, o = "", r;
|
|
741
|
+
for (t = 0, e = a.length; t < e; t += 1) {
|
|
742
|
+
for (s = a[t].length, i = 0; i < s; i += 1)
|
|
743
|
+
i > 0 && (o += " "), r = a[t][i], typeof r == "string" ? r.indexOf(`
|
|
744
|
+
`) > -1 ? o += `"${r.replace(/"/g, '""')}"` : o += r : r == null ? o += "" : o += r;
|
|
745
|
+
t !== e - 1 && (o += `
|
|
746
|
+
`);
|
|
747
|
+
}
|
|
748
|
+
return o;
|
|
749
|
+
}
|
|
750
|
+
class ii {
|
|
712
751
|
//虚拟滚动位置
|
|
713
752
|
constructor(t, e) {
|
|
714
753
|
c(this, "loading", !1);
|
|
@@ -751,11 +790,11 @@ class Ze {
|
|
|
751
790
|
t.forEach((i, s) => {
|
|
752
791
|
let o = !1;
|
|
753
792
|
Array.isArray(i.children) && (o = !0, this.initData(i.children, e + 1));
|
|
754
|
-
const { ROW_KEY: r = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT:
|
|
793
|
+
const { ROW_KEY: r = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: l, SELECTABLE_METHOD: h, CHECKBOX_KEY: f } = this.ctx.config, d = i[r], x = d ?? At();
|
|
755
794
|
this.itemRowKeyMap.set(i, x);
|
|
756
|
-
const u = i._height ||
|
|
795
|
+
const u = i._height || l, y = i._readonly;
|
|
757
796
|
let g = !0;
|
|
758
|
-
if (typeof
|
|
797
|
+
if (typeof h == "function" && (g = h), f) {
|
|
759
798
|
const w = i[f];
|
|
760
799
|
if (this.checkboxKeyMap.has(w)) {
|
|
761
800
|
const p = this.checkboxKeyMap.get(w);
|
|
@@ -835,12 +874,12 @@ class Ze {
|
|
|
835
874
|
const i = (o) => {
|
|
836
875
|
o.forEach((r) => {
|
|
837
876
|
t.push(r);
|
|
838
|
-
const n = this.itemRowKeyMap.get(r), { expand:
|
|
877
|
+
const n = this.itemRowKeyMap.get(r), { expand: l, hasChildren: h, height: f } = this.rowKeyMap.get(n), d = this.sumHeight;
|
|
839
878
|
this.sumHeight += f, this.rowIndexRowKeyMap.set(e, n), this.positions.push({
|
|
840
879
|
top: d,
|
|
841
880
|
height: f,
|
|
842
881
|
bottom: this.sumHeight
|
|
843
|
-
}), e += 1,
|
|
882
|
+
}), e += 1, l && h && i(r.children);
|
|
844
883
|
});
|
|
845
884
|
};
|
|
846
885
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -963,9 +1002,9 @@ class Ze {
|
|
|
963
1002
|
let i = [];
|
|
964
1003
|
const s = /* @__PURE__ */ new Set();
|
|
965
1004
|
t.forEach((n) => {
|
|
966
|
-
const { value:
|
|
967
|
-
s.add(
|
|
968
|
-
rowKey:
|
|
1005
|
+
const { value: l, rowKey: h, key: f } = n, { oldValue: d, newValue: x } = this.setItemValue(h, f, l);
|
|
1006
|
+
s.add(h), i.push({
|
|
1007
|
+
rowKey: h,
|
|
969
1008
|
key: f,
|
|
970
1009
|
oldValue: d,
|
|
971
1010
|
newValue: x
|
|
@@ -973,12 +1012,12 @@ class Ze {
|
|
|
973
1012
|
});
|
|
974
1013
|
let o = [];
|
|
975
1014
|
const r = i.map((n) => {
|
|
976
|
-
const
|
|
1015
|
+
const l = this.ctx.database.getRowDataItemForRowKey(n.rowKey);
|
|
977
1016
|
return {
|
|
978
1017
|
rowKey: n.rowKey,
|
|
979
1018
|
key: n.key,
|
|
980
1019
|
value: n.newValue,
|
|
981
|
-
row:
|
|
1020
|
+
row: l
|
|
982
1021
|
};
|
|
983
1022
|
});
|
|
984
1023
|
return s.forEach((n) => {
|
|
@@ -1004,15 +1043,15 @@ class Ze {
|
|
|
1004
1043
|
if (!this.rowKeyMap.has(t))
|
|
1005
1044
|
return {};
|
|
1006
1045
|
const { item: n } = this.rowKeyMap.get(t);
|
|
1007
|
-
let
|
|
1046
|
+
let l = n[e];
|
|
1008
1047
|
if (this.ctx.database.getReadonly(t, e))
|
|
1009
1048
|
return {
|
|
1010
|
-
oldValue:
|
|
1011
|
-
newValue:
|
|
1049
|
+
oldValue: l,
|
|
1050
|
+
newValue: l
|
|
1012
1051
|
};
|
|
1013
|
-
n[e] !== null && typeof n[e] == "object" && (
|
|
1014
|
-
const
|
|
1015
|
-
if (this.originalDataMap.has(
|
|
1052
|
+
n[e] !== null && typeof n[e] == "object" && (l = JSON.parse(JSON.stringify(n[e])));
|
|
1053
|
+
const h = `${t}_${e}`;
|
|
1054
|
+
if (this.originalDataMap.has(h) || this.originalDataMap.set(h, l), this.changedDataMap.set(h, i), n[e] = i, r) {
|
|
1016
1055
|
const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
|
|
1017
1056
|
rowKey: t,
|
|
1018
1057
|
key: e,
|
|
@@ -1022,18 +1061,18 @@ class Ze {
|
|
|
1022
1061
|
this.ctx.emit("change", [d], [f]), this.ctx.emit("editChange", {
|
|
1023
1062
|
rowKey: t,
|
|
1024
1063
|
key: e,
|
|
1025
|
-
oldValue:
|
|
1064
|
+
oldValue: l,
|
|
1026
1065
|
value: i,
|
|
1027
|
-
originalValue: this.originalDataMap.get(
|
|
1066
|
+
originalValue: this.originalDataMap.get(h),
|
|
1028
1067
|
row: f
|
|
1029
1068
|
});
|
|
1030
1069
|
}
|
|
1031
1070
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1032
1071
|
rowKey: t,
|
|
1033
1072
|
key: e,
|
|
1034
|
-
oldValue:
|
|
1073
|
+
oldValue: l,
|
|
1035
1074
|
value: i,
|
|
1036
|
-
originalValue: this.originalDataMap.get(
|
|
1075
|
+
originalValue: this.originalDataMap.get(h),
|
|
1037
1076
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
1038
1077
|
}), s && this.ctx.history.pushState({
|
|
1039
1078
|
type: "single",
|
|
@@ -1043,12 +1082,12 @@ class Ze {
|
|
|
1043
1082
|
{
|
|
1044
1083
|
rowKey: t,
|
|
1045
1084
|
key: e,
|
|
1046
|
-
oldValue:
|
|
1085
|
+
oldValue: l,
|
|
1047
1086
|
newValue: i
|
|
1048
1087
|
}
|
|
1049
1088
|
]
|
|
1050
1089
|
}), o && this.ctx.emit("draw"), {
|
|
1051
|
-
oldValue:
|
|
1090
|
+
oldValue: l,
|
|
1052
1091
|
newValue: i
|
|
1053
1092
|
};
|
|
1054
1093
|
}
|
|
@@ -1075,8 +1114,8 @@ class Ze {
|
|
|
1075
1114
|
return !1;
|
|
1076
1115
|
const { item: s } = this.rowKeyMap.get(t), o = s[i];
|
|
1077
1116
|
this.checkboxKeyMap.has(o) && this.checkboxKeyMap.get(o).forEach((n) => {
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1117
|
+
const l = this.rowKeyMap.get(n);
|
|
1118
|
+
l.check = e;
|
|
1080
1119
|
});
|
|
1081
1120
|
}
|
|
1082
1121
|
}
|
|
@@ -1238,15 +1277,15 @@ class Ze {
|
|
|
1238
1277
|
getReadonly(t, e) {
|
|
1239
1278
|
const i = this.rowKeyMap.get(t), s = this.headerMap.get(e), o = i == null ? void 0 : i.readonly, r = s == null ? void 0 : s.readonly, { CELL_READONLY_METHOD: n } = this.ctx.config;
|
|
1240
1279
|
if (typeof n == "function") {
|
|
1241
|
-
const
|
|
1280
|
+
const h = n({
|
|
1242
1281
|
row: i.item,
|
|
1243
1282
|
rowIndex: i.rowIndex,
|
|
1244
1283
|
colIndex: s.colIndex,
|
|
1245
1284
|
column: s.column,
|
|
1246
1285
|
value: this.getItemValue(t, e)
|
|
1247
1286
|
});
|
|
1248
|
-
if (
|
|
1249
|
-
return
|
|
1287
|
+
if (h !== void 0)
|
|
1288
|
+
return h;
|
|
1250
1289
|
}
|
|
1251
1290
|
return r || o;
|
|
1252
1291
|
}
|
|
@@ -1256,7 +1295,7 @@ class Ze {
|
|
|
1256
1295
|
getValidator(t, e) {
|
|
1257
1296
|
return new Promise((i) => {
|
|
1258
1297
|
const s = this.rowKeyMap.get(t), o = this.headerMap.get(e), { CELL_RULES_METHOD: r } = this.ctx.config, n = o.column;
|
|
1259
|
-
let
|
|
1298
|
+
let l = n.rules;
|
|
1260
1299
|
if (typeof r == "function") {
|
|
1261
1300
|
const f = r({
|
|
1262
1301
|
row: s.item,
|
|
@@ -1265,28 +1304,28 @@ class Ze {
|
|
|
1265
1304
|
column: n,
|
|
1266
1305
|
value: this.getItemValue(t, e)
|
|
1267
1306
|
});
|
|
1268
|
-
f && (
|
|
1307
|
+
f && (l = f);
|
|
1269
1308
|
}
|
|
1270
|
-
if (
|
|
1271
|
-
let
|
|
1272
|
-
if (f[e] = this.getItemValue(t, e), Array.isArray(
|
|
1273
|
-
const x =
|
|
1309
|
+
if (l) {
|
|
1310
|
+
let h = {}, f = {};
|
|
1311
|
+
if (f[e] = this.getItemValue(t, e), Array.isArray(l) && l.length) {
|
|
1312
|
+
const x = l.map((u) => ({
|
|
1274
1313
|
...u,
|
|
1275
1314
|
row: s.item,
|
|
1276
1315
|
column: n,
|
|
1277
1316
|
rowIndex: s.rowIndex,
|
|
1278
1317
|
colIndex: o.colIndex
|
|
1279
1318
|
}));
|
|
1280
|
-
|
|
1319
|
+
h[e] = x;
|
|
1281
1320
|
} else
|
|
1282
|
-
|
|
1283
|
-
...
|
|
1321
|
+
h[e] = {
|
|
1322
|
+
...l,
|
|
1284
1323
|
row: s.item,
|
|
1285
1324
|
column: n,
|
|
1286
1325
|
rowIndex: s.rowIndex,
|
|
1287
1326
|
colIndex: o.colIndex
|
|
1288
1327
|
};
|
|
1289
|
-
new nt(
|
|
1328
|
+
new nt(h).validate(f).then(() => {
|
|
1290
1329
|
this.setValidationError(t, e, []), i([]);
|
|
1291
1330
|
}).catch(({ errors: x }) => {
|
|
1292
1331
|
const u = x.map((y) => ({
|
|
@@ -1333,7 +1372,7 @@ class Ze {
|
|
|
1333
1372
|
return this.validationErrorMap.get(i) || [];
|
|
1334
1373
|
}
|
|
1335
1374
|
}
|
|
1336
|
-
class
|
|
1375
|
+
class si {
|
|
1337
1376
|
constructor(t) {
|
|
1338
1377
|
c(this, "ctx");
|
|
1339
1378
|
c(this, "history", []);
|
|
@@ -1390,7 +1429,7 @@ class Je {
|
|
|
1390
1429
|
this.history = [], this.historyIndex = -1;
|
|
1391
1430
|
}
|
|
1392
1431
|
}
|
|
1393
|
-
class
|
|
1432
|
+
class ri {
|
|
1394
1433
|
constructor(t) {
|
|
1395
1434
|
c(this, "eventTasks", /* @__PURE__ */ new Map());
|
|
1396
1435
|
c(this, "ctx");
|
|
@@ -1436,7 +1475,7 @@ class Qe {
|
|
|
1436
1475
|
t.removeEventListener(e, i), this.eventTasks.delete(e);
|
|
1437
1476
|
}
|
|
1438
1477
|
}
|
|
1439
|
-
class
|
|
1478
|
+
class oi {
|
|
1440
1479
|
constructor() {
|
|
1441
1480
|
c(this, "events", /* @__PURE__ */ new Map());
|
|
1442
1481
|
}
|
|
@@ -1474,7 +1513,7 @@ class ti {
|
|
|
1474
1513
|
this.events.clear();
|
|
1475
1514
|
}
|
|
1476
1515
|
}
|
|
1477
|
-
class
|
|
1516
|
+
class ni {
|
|
1478
1517
|
constructor(t) {
|
|
1479
1518
|
c(this, "ctx");
|
|
1480
1519
|
const e = t.getContext("2d");
|
|
@@ -1512,31 +1551,31 @@ class ei {
|
|
|
1512
1551
|
* @param {string} color - 阴影的颜色
|
|
1513
1552
|
*/
|
|
1514
1553
|
drawShadow(t, e, i, s, o) {
|
|
1515
|
-
const { fillColor: r, side: n, shadowWidth:
|
|
1554
|
+
const { fillColor: r, side: n, shadowWidth: l, colorStart: h, colorEnd: f } = o;
|
|
1516
1555
|
this.ctx.save(), r && (this.ctx.fillStyle = r, this.ctx.fillRect(t, e, i, s));
|
|
1517
1556
|
let d;
|
|
1518
1557
|
switch (n) {
|
|
1519
1558
|
case "left":
|
|
1520
|
-
d = this.ctx.createLinearGradient(t -
|
|
1559
|
+
d = this.ctx.createLinearGradient(t - l, e, t, e), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t - l, e, l, s);
|
|
1521
1560
|
break;
|
|
1522
1561
|
case "right":
|
|
1523
1562
|
d = this.ctx.createLinearGradient(
|
|
1524
1563
|
t + i,
|
|
1525
1564
|
e,
|
|
1526
|
-
t + i +
|
|
1565
|
+
t + i + l,
|
|
1527
1566
|
e
|
|
1528
|
-
), d.addColorStop(0,
|
|
1567
|
+
), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, l, s);
|
|
1529
1568
|
break;
|
|
1530
1569
|
case "top":
|
|
1531
|
-
d = this.ctx.createLinearGradient(t, e -
|
|
1570
|
+
d = this.ctx.createLinearGradient(t, e - l, t, e), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e - l, i, l);
|
|
1532
1571
|
break;
|
|
1533
1572
|
case "bottom":
|
|
1534
1573
|
d = this.ctx.createLinearGradient(
|
|
1535
1574
|
t,
|
|
1536
1575
|
e + s,
|
|
1537
1576
|
t,
|
|
1538
|
-
e + s +
|
|
1539
|
-
), d.addColorStop(0,
|
|
1577
|
+
e + s + l
|
|
1578
|
+
), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, l);
|
|
1540
1579
|
break;
|
|
1541
1580
|
default:
|
|
1542
1581
|
console.error("Invalid side specified for shadow");
|
|
@@ -1557,12 +1596,12 @@ class ei {
|
|
|
1557
1596
|
drawImage(t, e, i, s, o) {
|
|
1558
1597
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, o), this.ctx.restore();
|
|
1559
1598
|
}
|
|
1560
|
-
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: n, radius:
|
|
1561
|
-
if (this.ctx.save(), this.ctx.beginPath(), n !== void 0 && (this.ctx.fillStyle = n), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r),
|
|
1599
|
+
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: n, radius: l = 0 } = {}) {
|
|
1600
|
+
if (this.ctx.save(), this.ctx.beginPath(), n !== void 0 && (this.ctx.fillStyle = n), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), l === 0)
|
|
1562
1601
|
this.ctx.rect(t + 0.5, e + 0.5, i, s);
|
|
1563
1602
|
else {
|
|
1564
|
-
const [
|
|
1565
|
-
this.ctx.moveTo(t +
|
|
1603
|
+
const [h, f, d, x] = typeof l == "number" ? [l, l, l, l] : l;
|
|
1604
|
+
this.ctx.moveTo(t + h, 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 + h, e, h);
|
|
1566
1605
|
}
|
|
1567
1606
|
n !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1568
1607
|
}
|
|
@@ -1580,16 +1619,16 @@ class ei {
|
|
|
1580
1619
|
this.ctx.save();
|
|
1581
1620
|
const {
|
|
1582
1621
|
font: n = "12px Arial",
|
|
1583
|
-
align:
|
|
1584
|
-
color:
|
|
1622
|
+
align: l = "center",
|
|
1623
|
+
color: h = "#495060",
|
|
1585
1624
|
padding: f = 0,
|
|
1586
1625
|
verticalAlign: d = "middle"
|
|
1587
1626
|
} = r;
|
|
1588
|
-
this.ctx.font = n, this.ctx.fillStyle =
|
|
1627
|
+
this.ctx.font = n, this.ctx.fillStyle = h, this.ctx.textBaseline = d, this.ctx.textAlign = l;
|
|
1589
1628
|
let x = 0;
|
|
1590
1629
|
d === "top" ? x = i + f : d === "bottom" ? x = i + o - f : x = i + (o + f) / 2;
|
|
1591
1630
|
let u = 0;
|
|
1592
|
-
|
|
1631
|
+
l === "left" ? u = e + f : l === "right" ? u = e + s - f : u = e + s / 2;
|
|
1593
1632
|
const { _text: y, ellipsis: g } = this.handleEllipsis(t, s, f);
|
|
1594
1633
|
return this.ctx.fillText(y, u, x), this.ctx.restore(), g;
|
|
1595
1634
|
}
|
|
@@ -1603,10 +1642,10 @@ class ei {
|
|
|
1603
1642
|
const r = this.ctx.measureText("...").width, n = this.ctx.measureText(t).width;
|
|
1604
1643
|
if (n && n + r >= e - i * 2) {
|
|
1605
1644
|
s = !0;
|
|
1606
|
-
let
|
|
1607
|
-
for (let
|
|
1608
|
-
if (
|
|
1609
|
-
o = t.slice(0,
|
|
1645
|
+
let l = 0;
|
|
1646
|
+
for (let h = 0; h < t.length; h++)
|
|
1647
|
+
if (l += this.ctx.measureText(t[h]).width, l >= e - i * 2 - r) {
|
|
1648
|
+
o = t.slice(0, h) + "...";
|
|
1610
1649
|
break;
|
|
1611
1650
|
}
|
|
1612
1651
|
}
|
|
@@ -1616,7 +1655,7 @@ class ei {
|
|
|
1616
1655
|
};
|
|
1617
1656
|
}
|
|
1618
1657
|
}
|
|
1619
|
-
class
|
|
1658
|
+
class Pt {
|
|
1620
1659
|
constructor(t) {
|
|
1621
1660
|
c(this, "PROCESSOR_NUM", 50);
|
|
1622
1661
|
c(this, "CSS_PREFIX", "e-virt-table");
|
|
@@ -1741,7 +1780,7 @@ class Bt {
|
|
|
1741
1780
|
Object.assign(this, t);
|
|
1742
1781
|
}
|
|
1743
1782
|
}
|
|
1744
|
-
class
|
|
1783
|
+
class ai {
|
|
1745
1784
|
constructor(t) {
|
|
1746
1785
|
c(this, "ctx");
|
|
1747
1786
|
c(this, "list", [
|
|
@@ -1835,15 +1874,15 @@ class ii {
|
|
|
1835
1874
|
}
|
|
1836
1875
|
async createImageFromSVG(t, e) {
|
|
1837
1876
|
const o = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
1838
|
-
e && o.querySelectorAll("*").forEach((
|
|
1839
|
-
|
|
1877
|
+
e && o.querySelectorAll("*").forEach((h) => {
|
|
1878
|
+
h.setAttribute("fill", e);
|
|
1840
1879
|
});
|
|
1841
1880
|
const r = new Image(), n = new Blob([new XMLSerializer().serializeToString(o)], {
|
|
1842
1881
|
type: "image/svg+xml"
|
|
1843
|
-
}),
|
|
1844
|
-
return r.src =
|
|
1882
|
+
}), l = URL.createObjectURL(n);
|
|
1883
|
+
return r.src = l, new Promise((h, f) => {
|
|
1845
1884
|
r.onerror = () => f(new Error("Failed to load image")), r.onload = () => {
|
|
1846
|
-
|
|
1885
|
+
h(r);
|
|
1847
1886
|
};
|
|
1848
1887
|
});
|
|
1849
1888
|
}
|
|
@@ -1851,7 +1890,7 @@ class ii {
|
|
|
1851
1890
|
return this.icons.get(t);
|
|
1852
1891
|
}
|
|
1853
1892
|
}
|
|
1854
|
-
class
|
|
1893
|
+
class te {
|
|
1855
1894
|
constructor(t, e, i, s, o, r, n) {
|
|
1856
1895
|
c(this, "ctx");
|
|
1857
1896
|
c(this, "x", 0);
|
|
@@ -1888,9 +1927,9 @@ class Jt {
|
|
|
1888
1927
|
getRightFixedX() {
|
|
1889
1928
|
}
|
|
1890
1929
|
}
|
|
1891
|
-
class
|
|
1892
|
-
constructor(e, i, s, o, r, n,
|
|
1893
|
-
super(e, o, r, n,
|
|
1930
|
+
class ee extends te {
|
|
1931
|
+
constructor(e, i, s, o, r, n, l, h, f, d = "body") {
|
|
1932
|
+
super(e, o, r, n, l, h.fixed, d);
|
|
1894
1933
|
c(this, "formatter");
|
|
1895
1934
|
c(this, "hoverIconName", "");
|
|
1896
1935
|
c(this, "operation", !1);
|
|
@@ -1936,7 +1975,7 @@ class Qt extends Jt {
|
|
|
1936
1975
|
c(this, "overflowTooltipShow", !0);
|
|
1937
1976
|
c(this, "overflowTooltipMaxWidth", 500);
|
|
1938
1977
|
c(this, "overflowTooltipPlacement", "top");
|
|
1939
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
1978
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "text", this.editorType = h.editorType || "text", this.cellType = d, this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level, this.operation = h.operation || !1, this.column = h, this.rules = h.rules, this.row = f, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.update();
|
|
1940
1979
|
}
|
|
1941
1980
|
getValidationMessage() {
|
|
1942
1981
|
const e = this.ctx.database.getValidationError(this.rowKey, this.key);
|
|
@@ -2030,13 +2069,13 @@ class Qt extends Jt {
|
|
|
2030
2069
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2031
2070
|
let o, r = 0, n = "";
|
|
2032
2071
|
if (this.type === "tree" && s === "body") {
|
|
2033
|
-
const
|
|
2072
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = l || {};
|
|
2034
2073
|
if (d) {
|
|
2035
2074
|
const u = this.ctx.icons.get("loading");
|
|
2036
2075
|
n = "loading", o = u, r = x * 8;
|
|
2037
2076
|
} else if (f) {
|
|
2038
2077
|
const u = this.ctx.icons.get("expand"), y = this.ctx.icons.get("shrink");
|
|
2039
|
-
o =
|
|
2078
|
+
o = h ? y : u, n = h ? "shrink" : "expand", r = x * 8;
|
|
2040
2079
|
} else
|
|
2041
2080
|
r = x * 8;
|
|
2042
2081
|
if (o) {
|
|
@@ -2053,8 +2092,8 @@ class Qt extends Jt {
|
|
|
2053
2092
|
FOOTER_CELL_STYLE_METHOD: o,
|
|
2054
2093
|
READONLY_TEXT_COLOR: r,
|
|
2055
2094
|
FOOTER_BG_COLOR: n,
|
|
2056
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2057
|
-
HIGHLIGHT_SELECTED_ROW_COLOR:
|
|
2095
|
+
HIGHLIGHT_SELECTED_ROW: l,
|
|
2096
|
+
HIGHLIGHT_SELECTED_ROW_COLOR: h,
|
|
2058
2097
|
HIGHLIGHT_HOVER_ROW: f,
|
|
2059
2098
|
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
2060
2099
|
} = this.ctx.config;
|
|
@@ -2075,7 +2114,7 @@ class Qt extends Jt {
|
|
|
2075
2114
|
}
|
|
2076
2115
|
let x = "transparent";
|
|
2077
2116
|
const u = this.ctx.focusCell, y = this.ctx.hoverCell;
|
|
2078
|
-
f && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = d),
|
|
2117
|
+
f && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = d), l && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = h), this.drawCellSkyBgColor = x;
|
|
2079
2118
|
let g = e, w = r;
|
|
2080
2119
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2081
2120
|
this.drawCellBgColor = e, this.drawTextColor = r;
|
|
@@ -2094,24 +2133,24 @@ class Qt extends Jt {
|
|
|
2094
2133
|
this.drawCellBgColor = g, this.drawTextColor = w;
|
|
2095
2134
|
}
|
|
2096
2135
|
updateSelection() {
|
|
2097
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: n, rowIndex:
|
|
2136
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: n, rowIndex: l, rowKey: h } = this;
|
|
2098
2137
|
if (!(s === 0 || o === 0) && r !== "footer" && ["index-selection", "selection"].includes(n)) {
|
|
2099
|
-
const f = this.ctx.database.getRowSelection(
|
|
2138
|
+
const f = this.ctx.database.getRowSelection(h), d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, y = this.drawY + (i - x) / 2;
|
|
2100
2139
|
let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
2101
|
-
f && d ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : f && d ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !f && d ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex ===
|
|
2140
|
+
f && d ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : f && d ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !f && d ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = u, this.drawImageY = y, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g) : g && n === "selection" && (this.drawImageX = u, this.drawImageY = y, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g);
|
|
2102
2141
|
}
|
|
2103
2142
|
}
|
|
2104
2143
|
updateHoverIcon() {
|
|
2105
2144
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2106
2145
|
if (typeof e == "function") {
|
|
2107
|
-
const
|
|
2146
|
+
const l = e({
|
|
2108
2147
|
row: this.row,
|
|
2109
2148
|
rowIndex: this.rowIndex,
|
|
2110
2149
|
colIndex: this.colIndex,
|
|
2111
2150
|
column: this.column,
|
|
2112
2151
|
value: this.getValue()
|
|
2113
2152
|
});
|
|
2114
|
-
|
|
2153
|
+
l !== void 0 && (this.hoverIconName = l);
|
|
2115
2154
|
}
|
|
2116
2155
|
const o = this.drawX + this.width - i - s, r = this.drawY + (this.height - i) / 2;
|
|
2117
2156
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
@@ -2228,8 +2267,8 @@ class Qt extends Jt {
|
|
|
2228
2267
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2229
2268
|
if (!s || !i)
|
|
2230
2269
|
return;
|
|
2231
|
-
const { xArr: o, yArr: r } = this.ctx.selector, n = o[1],
|
|
2232
|
-
|
|
2270
|
+
const { xArr: o, yArr: r } = this.ctx.selector, n = o[1], l = r[1], { colIndex: h, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2271
|
+
h === n && f === l && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2233
2272
|
borderColor: "#fff",
|
|
2234
2273
|
fillColor: e
|
|
2235
2274
|
});
|
|
@@ -2283,32 +2322,32 @@ class Qt extends Jt {
|
|
|
2283
2322
|
});
|
|
2284
2323
|
}
|
|
2285
2324
|
drawBorder(e) {
|
|
2286
|
-
const { drawX: i, drawY: s, width: o, rowIndex: r, colIndex: n } = this,
|
|
2287
|
-
let
|
|
2288
|
-
r === 0 && (
|
|
2325
|
+
const { drawX: i, drawY: s, width: o, rowIndex: r, colIndex: n } = this, l = i + 0.5;
|
|
2326
|
+
let h = s + 0.5, f = this.height;
|
|
2327
|
+
r === 0 && (h = this.y + 1, f = f - 1);
|
|
2289
2328
|
const { xArr: d, yArr: x, lineDash: u = [], borderWidth: y = 1, borderColor: g, fillColor: w } = e, p = d[0], E = d[1], m = x[0], b = x[1];
|
|
2290
|
-
n >= p && n <= E && r === m && this.ctx.paint.drawLine([h, l
|
|
2329
|
+
n >= p && n <= E && r === m && this.ctx.paint.drawLine([l, h, l + o - 2, h], {
|
|
2291
2330
|
borderColor: g,
|
|
2292
2331
|
fillColor: w,
|
|
2293
2332
|
borderWidth: y,
|
|
2294
2333
|
lineCap: "round",
|
|
2295
2334
|
lineJoin: "round",
|
|
2296
2335
|
lineDash: u
|
|
2297
|
-
}), n >= p && n <= E && r === b && this.ctx.paint.drawLine([
|
|
2336
|
+
}), n >= p && n <= E && r === b && this.ctx.paint.drawLine([l, h + f - 1.5, l + o, h + f - 1.5], {
|
|
2298
2337
|
borderColor: g,
|
|
2299
2338
|
fillColor: w,
|
|
2300
2339
|
borderWidth: y,
|
|
2301
2340
|
lineCap: "round",
|
|
2302
2341
|
lineJoin: "round",
|
|
2303
2342
|
lineDash: u
|
|
2304
|
-
}), n === p && r >= m && r <= b && this.ctx.paint.drawLine([h, l, h
|
|
2343
|
+
}), n === p && r >= m && r <= b && this.ctx.paint.drawLine([l, h, l, h + f - 1], {
|
|
2305
2344
|
borderColor: g,
|
|
2306
2345
|
fillColor: w,
|
|
2307
2346
|
borderWidth: y,
|
|
2308
2347
|
lineCap: "round",
|
|
2309
2348
|
lineJoin: "round",
|
|
2310
2349
|
lineDash: u
|
|
2311
|
-
}), n === E && r >= m && r <= b && this.ctx.paint.drawLine([
|
|
2350
|
+
}), n === E && r >= m && r <= b && this.ctx.paint.drawLine([l + o - 1, h, l + o - 1, h + f - 1], {
|
|
2312
2351
|
borderColor: g,
|
|
2313
2352
|
fillColor: w,
|
|
2314
2353
|
borderWidth: y,
|
|
@@ -2318,9 +2357,9 @@ class Qt extends Jt {
|
|
|
2318
2357
|
});
|
|
2319
2358
|
}
|
|
2320
2359
|
}
|
|
2321
|
-
class
|
|
2322
|
-
constructor(e, i, s, o, r, n,
|
|
2323
|
-
super(e, s, o, r, n,
|
|
2360
|
+
class ie extends te {
|
|
2361
|
+
constructor(e, i, s, o, r, n, l) {
|
|
2362
|
+
super(e, s, o, r, n, l.fixed, "header");
|
|
2324
2363
|
c(this, "align");
|
|
2325
2364
|
c(this, "verticalAlign", "middle");
|
|
2326
2365
|
c(this, "fixed");
|
|
@@ -2354,7 +2393,7 @@ class te extends Jt {
|
|
|
2354
2393
|
c(this, "drawImageHeight", 0);
|
|
2355
2394
|
c(this, "drawImageName", "");
|
|
2356
2395
|
c(this, "drawImageSource");
|
|
2357
|
-
this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = n, this.colIndex = i, this.key =
|
|
2396
|
+
this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = n, this.colIndex = i, this.key = l.key, this.type = l.type, this.editorType = l.editorType || "text", this.align = l.align || "center", this.verticalAlign = l.verticalAlign || "middle", this.fixed = l.fixed, this.level = l.level, this.operation = l.operation || !1, this.text = l.title, this.column = l, this.colspan = l.colspan, this.widthFillDisable = l.widthFillDisable, this.rowspan = l.rowspan, this.rules = l.rules, this.readonly = l.readonly, this.required = l.required, this.rowKey = At(), this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
|
|
2358
2397
|
}
|
|
2359
2398
|
/**
|
|
2360
2399
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2374,11 +2413,11 @@ class te extends Jt {
|
|
|
2374
2413
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2375
2414
|
let o = i, r = s;
|
|
2376
2415
|
if (typeof e == "function") {
|
|
2377
|
-
const n = e, { backgroundColor:
|
|
2416
|
+
const n = e, { backgroundColor: l, color: h } = n({
|
|
2378
2417
|
colIndex: this.colIndex,
|
|
2379
2418
|
column: this.column
|
|
2380
2419
|
}) || {};
|
|
2381
|
-
|
|
2420
|
+
l && (o = l), h && (r = h);
|
|
2382
2421
|
}
|
|
2383
2422
|
this.drawCellBgColor = o, this.drawTextColor = r;
|
|
2384
2423
|
}
|
|
@@ -2389,11 +2428,11 @@ class te extends Jt {
|
|
|
2389
2428
|
const {
|
|
2390
2429
|
paint: e,
|
|
2391
2430
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: o }
|
|
2392
|
-
} = this.ctx, { drawX: r, drawY: n, displayText:
|
|
2431
|
+
} = this.ctx, { drawX: r, drawY: n, displayText: l } = this;
|
|
2393
2432
|
e.drawRect(r, n, this.width, this.height, {
|
|
2394
2433
|
borderColor: i,
|
|
2395
2434
|
fillColor: this.drawCellBgColor
|
|
2396
|
-
}), e.drawText(
|
|
2435
|
+
}), e.drawText(l, r, n, this.width, this.height, {
|
|
2397
2436
|
font: o,
|
|
2398
2437
|
padding: s,
|
|
2399
2438
|
color: this.drawTextColor,
|
|
@@ -2404,9 +2443,9 @@ class te extends Jt {
|
|
|
2404
2443
|
drawSelection() {
|
|
2405
2444
|
const { width: e, height: i, type: s } = this;
|
|
2406
2445
|
if (["index-selection", "selection"].includes(s)) {
|
|
2407
|
-
const { indeterminate: o, check: r, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE:
|
|
2446
|
+
const { indeterminate: o, check: r, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: l = 0 } = this.ctx.config, h = this.drawX + (e - l) / 2, f = this.drawY + (i - l) / 2;
|
|
2408
2447
|
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2409
|
-
o ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : r && n ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : r && n ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !r && n ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX =
|
|
2448
|
+
o ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : r && n ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : r && n ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !r && n ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = h, this.drawImageY = f, this.drawImageWidth = l, this.drawImageHeight = l, this.drawImageName = x, this.drawImageSource = d, this.ctx.paint.drawImage(
|
|
2410
2449
|
this.drawImageSource,
|
|
2411
2450
|
this.drawImageX,
|
|
2412
2451
|
this.drawImageY,
|
|
@@ -2434,7 +2473,7 @@ class te extends Jt {
|
|
|
2434
2473
|
};
|
|
2435
2474
|
}
|
|
2436
2475
|
}
|
|
2437
|
-
class
|
|
2476
|
+
class ci {
|
|
2438
2477
|
constructor(t) {
|
|
2439
2478
|
c(this, "ctx");
|
|
2440
2479
|
c(this, "visibleHoverCell");
|
|
@@ -2449,8 +2488,8 @@ class si {
|
|
|
2449
2488
|
return;
|
|
2450
2489
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2451
2490
|
for (const r of s) {
|
|
2452
|
-
const n = r.getDrawX(),
|
|
2453
|
-
if (i > n && i < n + r.width && e >
|
|
2491
|
+
const n = r.getDrawX(), l = r.getDrawY();
|
|
2492
|
+
if (i > n && i < n + r.width && e > l && e < l + r.height) {
|
|
2454
2493
|
this.ctx.focusCellHeader = r, this.ctx.emit("cellHeaderMousedown", r, t);
|
|
2455
2494
|
return;
|
|
2456
2495
|
}
|
|
@@ -2458,10 +2497,10 @@ class si {
|
|
|
2458
2497
|
const o = this.ctx.body.renderRows;
|
|
2459
2498
|
for (const r of o) {
|
|
2460
2499
|
const n = r.fixedCells.concat(r.noFixedCells);
|
|
2461
|
-
for (const
|
|
2462
|
-
const
|
|
2463
|
-
if (i >
|
|
2464
|
-
this.ctx.setFocusCell(
|
|
2500
|
+
for (const l of n) {
|
|
2501
|
+
const h = l.getDrawX(), f = l.getDrawY();
|
|
2502
|
+
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2503
|
+
this.ctx.setFocusCell(l), this.ctx.emit("cellMousedown", l, t);
|
|
2465
2504
|
return;
|
|
2466
2505
|
}
|
|
2467
2506
|
}
|
|
@@ -2471,8 +2510,8 @@ class si {
|
|
|
2471
2510
|
return;
|
|
2472
2511
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2473
2512
|
for (const r of s) {
|
|
2474
|
-
const n = r.getDrawX(),
|
|
2475
|
-
if (i > n && i < n + r.width && e >
|
|
2513
|
+
const n = r.getDrawX(), l = r.getDrawY();
|
|
2514
|
+
if (i > n && i < n + r.width && e > l && e < l + r.height) {
|
|
2476
2515
|
this.ctx.clickCellHeader = r, this.ctx.emit("cellHeaderClick", r, t), this.selectionClick(r);
|
|
2477
2516
|
return;
|
|
2478
2517
|
}
|
|
@@ -2480,10 +2519,10 @@ class si {
|
|
|
2480
2519
|
const o = this.ctx.body.renderRows;
|
|
2481
2520
|
for (const r of o) {
|
|
2482
2521
|
const n = r.fixedCells.concat(r.noFixedCells);
|
|
2483
|
-
for (const
|
|
2484
|
-
const
|
|
2485
|
-
if (i >
|
|
2486
|
-
this.ctx.clickCell =
|
|
2522
|
+
for (const l of n) {
|
|
2523
|
+
const h = l.getDrawX(), f = l.getDrawY();
|
|
2524
|
+
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2525
|
+
this.ctx.clickCell = l, this.ctx.emit("cellClick", l, t), this.selectionClick(l), this.treeClick(l);
|
|
2487
2526
|
return;
|
|
2488
2527
|
}
|
|
2489
2528
|
}
|
|
@@ -2493,8 +2532,8 @@ class si {
|
|
|
2493
2532
|
return;
|
|
2494
2533
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2495
2534
|
for (const r of s) {
|
|
2496
|
-
const n = r.getDrawX(),
|
|
2497
|
-
if (i > n && i < n + r.width && e >
|
|
2535
|
+
const n = r.getDrawX(), l = r.getDrawY();
|
|
2536
|
+
if (i > n && i < n + r.width && e > l && e < l + r.height) {
|
|
2498
2537
|
this.ctx.emit("cellHeaderContextMenuClick", r, t);
|
|
2499
2538
|
return;
|
|
2500
2539
|
}
|
|
@@ -2502,10 +2541,10 @@ class si {
|
|
|
2502
2541
|
const o = this.ctx.body.renderRows;
|
|
2503
2542
|
for (const r of o) {
|
|
2504
2543
|
const n = r.fixedCells.concat(r.noFixedCells);
|
|
2505
|
-
for (const
|
|
2506
|
-
const
|
|
2507
|
-
if (i >
|
|
2508
|
-
this.ctx.emit("cellContextMenuClick",
|
|
2544
|
+
for (const l of n) {
|
|
2545
|
+
const h = l.getDrawX(), f = l.getDrawY();
|
|
2546
|
+
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2547
|
+
this.ctx.emit("cellContextMenuClick", l, t);
|
|
2509
2548
|
return;
|
|
2510
2549
|
}
|
|
2511
2550
|
}
|
|
@@ -2516,8 +2555,8 @@ class si {
|
|
|
2516
2555
|
return;
|
|
2517
2556
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2518
2557
|
for (const n of s) {
|
|
2519
|
-
const
|
|
2520
|
-
if (i >
|
|
2558
|
+
const l = n.getDrawX(), h = n.getDrawY();
|
|
2559
|
+
if (i > l && i < l + n.width && e > h && e < h + n.height) {
|
|
2521
2560
|
if (this.ctx.emit("cellHeaderMouseenter", n, t), this.ctx.hoverCellHeader && this.ctx.hoverCellHeader !== n && this.ctx.emit("cellHeaderMouseleave", this.ctx.hoverCellHeader, t), this.imageEnterAndLeave(n, t), this.ctx.hoverCellHeader === n)
|
|
2522
2561
|
return;
|
|
2523
2562
|
this.ctx.hoverCellHeader = n, this.ctx.emit("cellHeaderHoverChange", n);
|
|
@@ -2526,12 +2565,12 @@ class si {
|
|
|
2526
2565
|
}
|
|
2527
2566
|
const o = this.ctx.body.renderRows;
|
|
2528
2567
|
for (const n of o) {
|
|
2529
|
-
const
|
|
2530
|
-
for (const
|
|
2531
|
-
const f =
|
|
2532
|
-
if (i > f && i < f +
|
|
2533
|
-
if (this.ctx.emit("cellMouseenter",
|
|
2534
|
-
((r = this.ctx.hoverCell) == null ? void 0 : r.rowKey) !==
|
|
2568
|
+
const l = n.fixedCells.concat(n.noFixedCells);
|
|
2569
|
+
for (const h of l) {
|
|
2570
|
+
const f = h.getDrawX(), d = h.getDrawY();
|
|
2571
|
+
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) {
|
|
2572
|
+
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;
|
|
2573
|
+
((r = this.ctx.hoverCell) == null ? void 0 : r.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);
|
|
2535
2574
|
return;
|
|
2536
2575
|
}
|
|
2537
2576
|
}
|
|
@@ -2544,7 +2583,7 @@ class si {
|
|
|
2544
2583
|
*/
|
|
2545
2584
|
selectionClick(t) {
|
|
2546
2585
|
if (["selection", "index-selection"].includes(t.type) && this.ctx.isPointer)
|
|
2547
|
-
if (t instanceof
|
|
2586
|
+
if (t instanceof ie)
|
|
2548
2587
|
t.drawImageName === "checkbox-uncheck" || t.drawImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawImageName === "checkbox-check" && this.ctx.database.clearSelection();
|
|
2549
2588
|
else {
|
|
2550
2589
|
if (!this.ctx.database.getRowSelectable(t.rowKey))
|
|
@@ -2566,10 +2605,10 @@ class si {
|
|
|
2566
2605
|
colIndex: t.colIndex,
|
|
2567
2606
|
column: t.column,
|
|
2568
2607
|
value: t.getValue()
|
|
2569
|
-
}).then((
|
|
2570
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2571
|
-
}).catch((
|
|
2572
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2608
|
+
}).then((l) => {
|
|
2609
|
+
this.ctx.database.setExpandChildren(t.rowKey, l), this.ctx.database.expandLoading(t.rowKey, !1);
|
|
2610
|
+
}).catch((l) => {
|
|
2611
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(l);
|
|
2573
2612
|
}));
|
|
2574
2613
|
else {
|
|
2575
2614
|
const n = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2584,7 +2623,7 @@ class si {
|
|
|
2584
2623
|
*/
|
|
2585
2624
|
imageEnterAndLeave(t, e) {
|
|
2586
2625
|
const i = e.offsetY, s = e.offsetX;
|
|
2587
|
-
s > t.drawImageX && s < t.drawImageX + t.drawImageWidth && i > t.drawImageY && i < t.drawImageY + t.drawImageHeight ? (this.ctx.target.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof
|
|
2626
|
+
s > t.drawImageX && s < t.drawImageX + t.drawImageWidth && i > t.drawImageY && i < t.drawImageY + t.drawImageHeight ? (this.ctx.target.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof ee && ["selection", "index-selection"].includes(t.type) && (this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.target.style.cursor = "not-allowed"))) : (this.ctx.isPointer = !1, this.ctx.target.style.cursor === "pointer" && (this.ctx.target.style.cursor = "default"));
|
|
2588
2627
|
}
|
|
2589
2628
|
isBusy(t) {
|
|
2590
2629
|
const e = t.offsetY, i = t.offsetX;
|
|
@@ -2597,7 +2636,7 @@ class si {
|
|
|
2597
2636
|
this.resizeObserver.unobserve(this.ctx.target);
|
|
2598
2637
|
}
|
|
2599
2638
|
}
|
|
2600
|
-
class
|
|
2639
|
+
class li {
|
|
2601
2640
|
constructor(t, e, i) {
|
|
2602
2641
|
c(this, "eventBus");
|
|
2603
2642
|
c(this, "eventBrowser");
|
|
@@ -2688,10 +2727,10 @@ class ri {
|
|
|
2688
2727
|
c(this, "database");
|
|
2689
2728
|
c(this, "history");
|
|
2690
2729
|
c(this, "config");
|
|
2691
|
-
this.target = e, this.targetContainer = t, this.target.setAttribute("uuid", this.uuid), this.config = new
|
|
2730
|
+
this.target = e, this.targetContainer = t, this.target.setAttribute("uuid", this.uuid), this.config = new Pt(i.config || {}), this.eventBus = new oi(), this.eventBrowser = new ri(this), this.eventTable = new ci(this), this.paint = new ni(e), this.database = new ii(this, i), this.history = new si(this), this.icons = new ai(this);
|
|
2692
2731
|
}
|
|
2693
2732
|
setConfig(t) {
|
|
2694
|
-
this.config = new
|
|
2733
|
+
this.config = new Pt(t);
|
|
2695
2734
|
}
|
|
2696
2735
|
setFocusCell(t) {
|
|
2697
2736
|
var e;
|
|
@@ -2723,7 +2762,7 @@ class ri {
|
|
|
2723
2762
|
for (let o = 0; o <= e[1] - e[0]; o++) {
|
|
2724
2763
|
const r = [];
|
|
2725
2764
|
for (let n = 0; n <= i[1] - i[0]; n++) {
|
|
2726
|
-
const
|
|
2765
|
+
const l = o + e[0], h = n + i[0], f = this.database.getItemValueForRowIndexAndColIndex(l, h);
|
|
2727
2766
|
f && r.push(f.value);
|
|
2728
2767
|
}
|
|
2729
2768
|
s += `${r.join(" ")}\r`, t.push(r);
|
|
@@ -2777,7 +2816,7 @@ class ri {
|
|
|
2777
2816
|
this.eventTable.destroy(), this.eventBrowser.destroy(), this.eventBus.destroy();
|
|
2778
2817
|
}
|
|
2779
2818
|
}
|
|
2780
|
-
class
|
|
2819
|
+
class Vt {
|
|
2781
2820
|
constructor(t, e) {
|
|
2782
2821
|
c(this, "ctx");
|
|
2783
2822
|
c(this, "type");
|
|
@@ -2808,6 +2847,8 @@ class Wt {
|
|
|
2808
2847
|
this.updateScroll(t);
|
|
2809
2848
|
}
|
|
2810
2849
|
onMouseDown(t) {
|
|
2850
|
+
if (!(t.target instanceof HTMLCanvasElement) || !this.ctx.isTarget(t.target))
|
|
2851
|
+
return;
|
|
2811
2852
|
const { offsetX: e, offsetY: i, clientX: s, clientY: o } = t;
|
|
2812
2853
|
if (!(s == this.clientX && o == this.clientY)) {
|
|
2813
2854
|
if (this.isOnScrollbar(e, i))
|
|
@@ -2848,20 +2889,20 @@ class Wt {
|
|
|
2848
2889
|
body: t,
|
|
2849
2890
|
header: e,
|
|
2850
2891
|
config: { SCROLLER_TRACK_SIZE: i = 0, SCROLLER_SIZE: s = 0 }
|
|
2851
|
-
} = this.ctx, o = this.ctx.target.width + 1, r = this.ctx.target.height, n = e.height,
|
|
2892
|
+
} = this.ctx, o = this.ctx.target.width + 1, r = this.ctx.target.height, n = e.height, l = e.width, h = t.height, f = this.ctx.footer.height;
|
|
2852
2893
|
if (this.type === "vertical") {
|
|
2853
|
-
this.visibleDistance = r - i - n, this.distance =
|
|
2854
|
-
const d = this.distance ? this.visibleDistance /
|
|
2894
|
+
this.visibleDistance = r - i - n, this.distance = h - this.visibleDistance + f, this.trackX = o - i, this.trackY = 0, this.splitPoints = [this.trackX, n, this.trackX + i, n], this.trackWidth = i, this.trackHeight = r, this.barX = this.trackX + (i - s) / 2, this.barWidth = s;
|
|
2895
|
+
const d = this.distance ? this.visibleDistance / h : 0;
|
|
2855
2896
|
let x = Math.floor(d * this.visibleDistance);
|
|
2856
2897
|
x < 30 ? x = 30 : x > this.visibleDistance && (x = 0), this.barHeight = x, this.barY = n + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2857
2898
|
} else {
|
|
2858
|
-
this.visibleDistance = o - i, this.distance =
|
|
2899
|
+
this.visibleDistance = o - i, this.distance = l - this.visibleDistance, this.splitPoints = [
|
|
2859
2900
|
o - i,
|
|
2860
2901
|
r - i,
|
|
2861
2902
|
o - i,
|
|
2862
2903
|
r
|
|
2863
2904
|
], this.trackX = 0, this.trackY = r - i, this.trackWidth = o, this.trackHeight = i;
|
|
2864
|
-
const d = this.distance ? this.visibleDistance /
|
|
2905
|
+
const d = this.distance ? this.visibleDistance / l : 0;
|
|
2865
2906
|
let x = Math.floor(d * this.visibleDistance);
|
|
2866
2907
|
this.barY = this.trackY + 0.5 + (i - s) / 2, x < 30 ? x = 30 : x >= this.visibleDistance && (x = 0), this.barWidth = x, this.barHeight = s, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2867
2908
|
}
|
|
@@ -2882,12 +2923,12 @@ class Wt {
|
|
|
2882
2923
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
2883
2924
|
}
|
|
2884
2925
|
}
|
|
2885
|
-
class
|
|
2926
|
+
class hi {
|
|
2886
2927
|
constructor(t) {
|
|
2887
2928
|
c(this, "ctx");
|
|
2888
2929
|
c(this, "verticalScrollbar");
|
|
2889
2930
|
c(this, "horizontalScrollbar");
|
|
2890
|
-
this.ctx = t, this.verticalScrollbar = new
|
|
2931
|
+
this.ctx = t, this.verticalScrollbar = new Vt(t, "vertical"), this.horizontalScrollbar = new Vt(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) => {
|
|
2891
2932
|
this.setScroll(e, i);
|
|
2892
2933
|
}), this.ctx.on("setScrollX", (e) => {
|
|
2893
2934
|
this.setScrollX(e);
|
|
@@ -2938,7 +2979,7 @@ class oi {
|
|
|
2938
2979
|
this.setScrollY(o - e.visibleHeight / 2);
|
|
2939
2980
|
}
|
|
2940
2981
|
}
|
|
2941
|
-
class
|
|
2982
|
+
class di {
|
|
2942
2983
|
constructor(t) {
|
|
2943
2984
|
c(this, "ctx");
|
|
2944
2985
|
// 上下文
|
|
@@ -2977,7 +3018,7 @@ class ni {
|
|
|
2977
3018
|
c(this, "renderFixedCellHeaders", []);
|
|
2978
3019
|
this.ctx = t, this.ctx.on(
|
|
2979
3020
|
"resetHeader",
|
|
2980
|
-
|
|
3021
|
+
Zt(() => {
|
|
2981
3022
|
this.init(), this.ctx.emit("draw");
|
|
2982
3023
|
}, 100)
|
|
2983
3024
|
), this.init(), this.initResizeColumn();
|
|
@@ -2987,19 +3028,19 @@ class ni {
|
|
|
2987
3028
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
2988
3029
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
2989
3030
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
2990
|
-
const s =
|
|
3031
|
+
const s = Jt(i), o = It(i);
|
|
2991
3032
|
this.height = t * s, this.width = o.reduce((d, x) => d + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
2992
|
-
const r =
|
|
3033
|
+
const r = Je(Qt(i, s));
|
|
2993
3034
|
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
2994
3035
|
const n = this.ctx.targetContainer.getBoundingClientRect();
|
|
2995
3036
|
this.resizeNum > 0 ? this.ctx.target.width = n.width : this.ctx.target.width = this.width + e - 1, this.visibleWidth = this.ctx.target.width - e;
|
|
2996
|
-
const
|
|
2997
|
-
if (this.resizeNum &&
|
|
2998
|
-
const d = Math.floor(
|
|
3037
|
+
const l = this.visibleWidth - this.width;
|
|
3038
|
+
if (this.resizeNum && l > 0) {
|
|
3039
|
+
const d = Math.floor(l / this.resizeNum * 100) / 100;
|
|
2999
3040
|
this.resizeAllColumn(d);
|
|
3000
3041
|
}
|
|
3001
|
-
const
|
|
3002
|
-
this.ctx.fixedLeftWidth =
|
|
3042
|
+
const h = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
3043
|
+
this.ctx.fixedLeftWidth = h.reduce((d, x) => d + x.width, 0);
|
|
3003
3044
|
const f = this.fixedRightCellHeaders.filter((d) => !d.hasChildren);
|
|
3004
3045
|
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;
|
|
3005
3046
|
}
|
|
@@ -3028,8 +3069,8 @@ class ni {
|
|
|
3028
3069
|
this.ctx.target.style.cursor === "col-resize" && (this.ctx.target.style.cursor = "default");
|
|
3029
3070
|
const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3030
3071
|
for (const r of o) {
|
|
3031
|
-
const n = e.layerX,
|
|
3032
|
-
n >
|
|
3072
|
+
const n = e.layerX, l = r.getDrawX();
|
|
3073
|
+
n > l + r.width - 5 && n < l + r.width + 4 && n < i.width - 4 && // 视窗中最后一列不允许调整宽
|
|
3033
3074
|
r.colspan <= 1 && e.target instanceof HTMLCanvasElement && this.ctx.isTarget(e.target) && e.layerY <= this.height && (this.ctx.target.style.cursor = "col-resize", this.resizeTarget = r);
|
|
3034
3075
|
}
|
|
3035
3076
|
}
|
|
@@ -3084,10 +3125,10 @@ class ni {
|
|
|
3084
3125
|
let s = e;
|
|
3085
3126
|
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
3086
3127
|
for (let r = 0; r < i; r++) {
|
|
3087
|
-
const n = t[r],
|
|
3128
|
+
const n = t[r], l = o * (n.rowspan || 1), h = o * n.level;
|
|
3088
3129
|
let f = n.width || 100;
|
|
3089
3130
|
n.children && (f = It(n.children).reduce((u, y) => u + ((y == null ? void 0 : y.width) || 100), 0));
|
|
3090
|
-
const d = new
|
|
3131
|
+
const d = new ie(this.ctx, this.columnIndex, s, h, f, l, n);
|
|
3091
3132
|
this.ctx.database.setHeader(n.key, d), this.allCellHeaders.push(d), n.children || (this.leafCellHeaders.push(d), d.column.widthFillDisable || this.resizeNum++), n.fixed === "left" ? this.fixedLeftCellHeaders.push(d) : n.fixed === "right" ? this.fixedRightCellHeaders.push(d) : this.centerCellHeaders.push(d), !n.children && this.columnIndex++, n.children && this.render(n.children, s), s += f;
|
|
3092
3133
|
}
|
|
3093
3134
|
}
|
|
@@ -3119,8 +3160,8 @@ class ni {
|
|
|
3119
3160
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3120
3161
|
colorEnd: "rgba(0,0,0,0)"
|
|
3121
3162
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3122
|
-
const
|
|
3123
|
-
this.ctx.paint.drawShadow(
|
|
3163
|
+
const l = s.width - (this.x + this.width) + o.width - e;
|
|
3164
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3124
3165
|
fillColor: r,
|
|
3125
3166
|
side: "left",
|
|
3126
3167
|
shadowWidth: 4,
|
|
@@ -3147,8 +3188,8 @@ class ni {
|
|
|
3147
3188
|
}), this.drawTipLine();
|
|
3148
3189
|
}
|
|
3149
3190
|
}
|
|
3150
|
-
class
|
|
3151
|
-
constructor(t, e, i = 0, s = 0, o = 0, r = 0, n,
|
|
3191
|
+
class se {
|
|
3192
|
+
constructor(t, e, i = 0, s = 0, o = 0, r = 0, n, l = "body") {
|
|
3152
3193
|
c(this, "ctx");
|
|
3153
3194
|
c(this, "x", 0);
|
|
3154
3195
|
c(this, "y", 0);
|
|
@@ -3161,12 +3202,12 @@ class ee {
|
|
|
3161
3202
|
c(this, "rowKey", "");
|
|
3162
3203
|
c(this, "rowType", "body");
|
|
3163
3204
|
c(this, "data");
|
|
3164
|
-
this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType =
|
|
3205
|
+
this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType = l, this.data = n, this.update();
|
|
3165
3206
|
}
|
|
3166
3207
|
update() {
|
|
3167
3208
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3168
3209
|
t.renderLeafCellHeaders.forEach((o) => {
|
|
3169
|
-
const r = new
|
|
3210
|
+
const r = new ee(
|
|
3170
3211
|
this.ctx,
|
|
3171
3212
|
this.rowIndex,
|
|
3172
3213
|
o.colIndex,
|
|
@@ -3199,7 +3240,7 @@ class ee {
|
|
|
3199
3240
|
});
|
|
3200
3241
|
}
|
|
3201
3242
|
}
|
|
3202
|
-
class
|
|
3243
|
+
class fi {
|
|
3203
3244
|
constructor(t) {
|
|
3204
3245
|
c(this, "resizeTarget", null);
|
|
3205
3246
|
//调整行大小的目标
|
|
@@ -3235,8 +3276,8 @@ class ai {
|
|
|
3235
3276
|
SCROLLER_TRACK_SIZE: o = 0,
|
|
3236
3277
|
BORDER_COLOR: r,
|
|
3237
3278
|
BORDER_RADIUS: n,
|
|
3238
|
-
HEIGHT:
|
|
3239
|
-
EMPTY_BODY_HEIGHT:
|
|
3279
|
+
HEIGHT: l,
|
|
3280
|
+
EMPTY_BODY_HEIGHT: h = 0,
|
|
3240
3281
|
MAX_HEIGHT: f = 0,
|
|
3241
3282
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3242
3283
|
OFFSET_HEIGHT: x = 0
|
|
@@ -3250,7 +3291,7 @@ class ai {
|
|
|
3250
3291
|
const { top: g } = t.getBoundingClientRect();
|
|
3251
3292
|
this.width = e.width, this.visibleWidth = t.width - o;
|
|
3252
3293
|
const w = this.ctx.footer.height;
|
|
3253
|
-
this.data.length || (this.height =
|
|
3294
|
+
this.data.length || (this.height = h);
|
|
3254
3295
|
const p = this.data.length ? "not-empty" : "empty";
|
|
3255
3296
|
this.ctx.emit("emptyChange", {
|
|
3256
3297
|
isEmpty: p,
|
|
@@ -3259,14 +3300,14 @@ class ai {
|
|
|
3259
3300
|
bodyHeight: this.height,
|
|
3260
3301
|
footerHeight: w,
|
|
3261
3302
|
width: this.width,
|
|
3262
|
-
height: this.data.length ? 0 :
|
|
3303
|
+
height: this.data.length ? 0 : h + w
|
|
3263
3304
|
});
|
|
3264
3305
|
let E = this.height + e.height + o;
|
|
3265
3306
|
E += w;
|
|
3266
3307
|
let m = 0;
|
|
3267
3308
|
this.data.length && d ? (m = window.innerHeight - g - x, m < 0 && (m = 32, console.error(
|
|
3268
3309
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3269
|
-
))) : this.data.length &&
|
|
3310
|
+
))) : this.data.length && l ? m = l : this.data.length && f && E > f ? m = f : m = E, m > 0 && (this.ctx.target.height = m);
|
|
3270
3311
|
let b = t.height - e.height - o;
|
|
3271
3312
|
s ? this.visibleHeight = b - w : 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 = u, this.ctx.target.setAttribute(
|
|
3272
3313
|
"style",
|
|
@@ -3292,19 +3333,19 @@ class ai {
|
|
|
3292
3333
|
config: { RESIZE_ROW_MIN_HEIGHT: n = 0 }
|
|
3293
3334
|
} = this.ctx;
|
|
3294
3335
|
if (this.isResizing && this.resizeTarget) {
|
|
3295
|
-
const
|
|
3296
|
-
let
|
|
3297
|
-
|
|
3336
|
+
const l = this.resizeTarget.height;
|
|
3337
|
+
let h = i - this.offsetY;
|
|
3338
|
+
h + l < n && (h = -(l - n)), this.resizeDiff = h, this.ctx.emit("draw");
|
|
3298
3339
|
} else {
|
|
3299
3340
|
if (this.resizeTarget = null, this.isMouseDown || this.ctx.target.style.cursor === "crosshair")
|
|
3300
3341
|
return;
|
|
3301
3342
|
this.ctx.target.style.cursor === "row-resize" && (this.ctx.target.style.cursor = "default");
|
|
3302
|
-
for (let
|
|
3303
|
-
const
|
|
3304
|
-
if (i >
|
|
3305
|
-
for (let d = 0; d <
|
|
3306
|
-
const x =
|
|
3307
|
-
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget =
|
|
3343
|
+
for (let l = 0; l < this.renderRows.length; l++) {
|
|
3344
|
+
const h = this.renderRows[l];
|
|
3345
|
+
if (i > h.y - r + h.height - 1.5 && i < h.y - r + h.height + 1.5 && i < o.height - 4)
|
|
3346
|
+
for (let d = 0; d < h.cells.length; d++) {
|
|
3347
|
+
const x = h.cells[d];
|
|
3348
|
+
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget = h);
|
|
3308
3349
|
}
|
|
3309
3350
|
}
|
|
3310
3351
|
}
|
|
@@ -3350,8 +3391,8 @@ class ai {
|
|
|
3350
3391
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3351
3392
|
colorEnd: "rgba(0,0,0,0)"
|
|
3352
3393
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3353
|
-
const
|
|
3354
|
-
this.ctx.paint.drawShadow(
|
|
3394
|
+
const l = s.width - (this.x + this.width) + o.width - e;
|
|
3395
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3355
3396
|
fillColor: r,
|
|
3356
3397
|
side: "left",
|
|
3357
3398
|
shadowWidth: 4,
|
|
@@ -3375,14 +3416,14 @@ class ai {
|
|
|
3375
3416
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: o, positions: r } = e.getData();
|
|
3376
3417
|
this.ctx.maxRowIndex = o.length - 1;
|
|
3377
3418
|
const n = this.binarySearch(r, s);
|
|
3378
|
-
let
|
|
3379
|
-
|
|
3380
|
-
const
|
|
3419
|
+
let l = this.binarySearch(r, s + this.visibleHeight);
|
|
3420
|
+
l === -1 && (l = o.length), this.headIndex = Math.max(0, n), this.tailIndex = Math.min(this.ctx.maxRowIndex, l + 1), this.visibleRows = o.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3421
|
+
const h = [];
|
|
3381
3422
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3382
|
-
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: y } = this.ctx.database.getPositionForRowIndex(d), g = new
|
|
3383
|
-
|
|
3423
|
+
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: y } = this.ctx.database.getPositionForRowIndex(d), g = new se(this.ctx, d, 0, y + this.y, t.width, u, x);
|
|
3424
|
+
h.push(g);
|
|
3384
3425
|
}
|
|
3385
|
-
this.renderRows =
|
|
3426
|
+
this.renderRows = h, this.ctx.body.renderRows = h;
|
|
3386
3427
|
}
|
|
3387
3428
|
draw() {
|
|
3388
3429
|
this.renderRows.forEach((t) => {
|
|
@@ -3392,7 +3433,7 @@ class ai {
|
|
|
3392
3433
|
}), this.drawTipLine();
|
|
3393
3434
|
}
|
|
3394
3435
|
}
|
|
3395
|
-
class
|
|
3436
|
+
class xi {
|
|
3396
3437
|
constructor(t) {
|
|
3397
3438
|
c(this, "ctx");
|
|
3398
3439
|
c(this, "renderRows", []);
|
|
@@ -3423,16 +3464,16 @@ class ci {
|
|
|
3423
3464
|
target: o,
|
|
3424
3465
|
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: n }
|
|
3425
3466
|
} = this.ctx;
|
|
3426
|
-
let
|
|
3427
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3467
|
+
let l = this.y;
|
|
3468
|
+
if (this.ctx.config.FOOTER_FIXED || (l = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, l, t, this.height, {
|
|
3428
3469
|
fillColor: r,
|
|
3429
3470
|
side: "right",
|
|
3430
3471
|
shadowWidth: 4,
|
|
3431
3472
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3432
3473
|
colorEnd: "rgba(0,0,0,0)"
|
|
3433
3474
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3434
|
-
const
|
|
3435
|
-
this.ctx.paint.drawShadow(
|
|
3475
|
+
const h = s.width - (this.x + this.width) + o.width - e;
|
|
3476
|
+
this.ctx.paint.drawShadow(h + 1, l, e, this.height, {
|
|
3436
3477
|
fillColor: r,
|
|
3437
3478
|
side: "left",
|
|
3438
3479
|
shadowWidth: 4,
|
|
@@ -3447,7 +3488,7 @@ class ci {
|
|
|
3447
3488
|
let e = this.y;
|
|
3448
3489
|
const i = [];
|
|
3449
3490
|
this.data.forEach((s, o) => {
|
|
3450
|
-
const r = new
|
|
3491
|
+
const r = new se(
|
|
3451
3492
|
this.ctx,
|
|
3452
3493
|
o,
|
|
3453
3494
|
0,
|
|
@@ -3468,7 +3509,7 @@ class ci {
|
|
|
3468
3509
|
});
|
|
3469
3510
|
}
|
|
3470
3511
|
}
|
|
3471
|
-
class
|
|
3512
|
+
class ui {
|
|
3472
3513
|
// 垂直滚动定时器
|
|
3473
3514
|
constructor(t) {
|
|
3474
3515
|
c(this, "isCut", !1);
|
|
@@ -3484,7 +3525,7 @@ class hi {
|
|
|
3484
3525
|
init() {
|
|
3485
3526
|
this.ctx.on(
|
|
3486
3527
|
"mousemove",
|
|
3487
|
-
|
|
3528
|
+
Zt((t) => {
|
|
3488
3529
|
const { offsetX: e, offsetY: i } = t, s = this.ctx.isTarget(t.target) && e > 0 && e < this.ctx.body.visibleWidth && i > this.ctx.header.visibleHeight && i < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
|
|
3489
3530
|
(this.ctx.selectorMove || this.ctx.autofillMove) && (s ? this.stopAdjustPosition() : this.startAdjustPosition(t));
|
|
3490
3531
|
}, 100)
|
|
@@ -3571,7 +3612,7 @@ class hi {
|
|
|
3571
3612
|
}
|
|
3572
3613
|
if (JSON.stringify(this.ctx.selector.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.selector.yArr) !== JSON.stringify(r)) {
|
|
3573
3614
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3574
|
-
const { SELECTOR_AREA_MIN_X: n, SELECTOR_AREA_MAX_X:
|
|
3615
|
+
const { SELECTOR_AREA_MIN_X: n, SELECTOR_AREA_MAX_X: l, SELECTOR_AREA_MIN_Y: h, SELECTOR_AREA_MAX_Y: f } = this.ctx.config, d = n, x = l || this.ctx.maxColIndex, u = h, y = f || this.ctx.maxRowIndex;
|
|
3575
3616
|
let [g, w] = o, [p, E] = r;
|
|
3576
3617
|
if (g < d || p < u)
|
|
3577
3618
|
return;
|
|
@@ -3588,12 +3629,12 @@ class hi {
|
|
|
3588
3629
|
const { SELECTOR_AREA_MIN_Y: e, SELECTOR_AREA_MAX_Y: i } = this.ctx.config, s = e, o = i || this.ctx.maxRowIndex;
|
|
3589
3630
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3590
3631
|
const { colIndex: r } = this.ctx.focusCellHeader;
|
|
3591
|
-
if (t.colIndex >= r) {
|
|
3592
|
-
const n = [r, t.colIndex + t.colspan - 1],
|
|
3593
|
-
this.setSelector(n,
|
|
3632
|
+
if (this.ctx.clearSelector(), t.colIndex >= r) {
|
|
3633
|
+
const n = [r, t.colIndex + t.colspan - 1], l = [s, o];
|
|
3634
|
+
this.setSelector(n, l);
|
|
3594
3635
|
} else {
|
|
3595
|
-
const n = [t.colIndex, r],
|
|
3596
|
-
this.setSelector(n,
|
|
3636
|
+
const n = [t.colIndex, r], l = [s, o];
|
|
3637
|
+
this.setSelector(n, l);
|
|
3597
3638
|
}
|
|
3598
3639
|
} else {
|
|
3599
3640
|
const r = [t.colIndex, t.colIndex + t.colspan - 1], n = [s, o];
|
|
@@ -3605,7 +3646,7 @@ class hi {
|
|
|
3605
3646
|
return;
|
|
3606
3647
|
const { ENABLE_SELECTOR_ALL_ROWS: t, ENABLE_SELECTOR_ALL_COLS: e } = this.ctx.config;
|
|
3607
3648
|
if (t && e) {
|
|
3608
|
-
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MIN_Y: o, SELECTOR_AREA_MAX_Y: r } = this.ctx.config, n = i,
|
|
3649
|
+
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MIN_Y: o, SELECTOR_AREA_MAX_Y: r } = this.ctx.config, n = i, l = s || this.ctx.maxColIndex, h = o, f = r || this.ctx.maxRowIndex, d = [n, l], x = [h, f];
|
|
3609
3650
|
this.setSelector(d, x);
|
|
3610
3651
|
}
|
|
3611
3652
|
}
|
|
@@ -3615,17 +3656,17 @@ class hi {
|
|
|
3615
3656
|
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s } = this.ctx.config, o = s || this.ctx.maxColIndex, r = i;
|
|
3616
3657
|
if (e) {
|
|
3617
3658
|
this.ctx.setFocusCell(t);
|
|
3618
|
-
const n = [r, o],
|
|
3619
|
-
this.setSelector(n,
|
|
3659
|
+
const n = [r, o], l = [t.rowIndex, t.rowIndex];
|
|
3660
|
+
this.setSelector(n, l);
|
|
3620
3661
|
}
|
|
3621
3662
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3622
3663
|
const { rowIndex: n } = this.ctx.focusCell;
|
|
3623
3664
|
if (t.rowIndex >= n) {
|
|
3624
|
-
const
|
|
3625
|
-
this.setSelector(
|
|
3665
|
+
const l = [r, o], h = [n, t.rowIndex];
|
|
3666
|
+
this.setSelector(l, h);
|
|
3626
3667
|
} else {
|
|
3627
|
-
const
|
|
3628
|
-
this.setSelector(
|
|
3668
|
+
const l = [r, o], h = [t.rowIndex, n];
|
|
3669
|
+
this.setSelector(l, h);
|
|
3629
3670
|
}
|
|
3630
3671
|
}
|
|
3631
3672
|
}
|
|
@@ -3634,7 +3675,7 @@ class hi {
|
|
|
3634
3675
|
return;
|
|
3635
3676
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3636
3677
|
if (t && e && i) {
|
|
3637
|
-
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), n = Math.max(i.colIndex, o),
|
|
3678
|
+
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), n = Math.max(i.colIndex, o), l = Math.min(i.rowIndex, s), h = Math.max(i.rowIndex, s), f = [r, n], d = [l, h];
|
|
3638
3679
|
this.setSelector(f, d);
|
|
3639
3680
|
}
|
|
3640
3681
|
}
|
|
@@ -3642,7 +3683,7 @@ class hi {
|
|
|
3642
3683
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3643
3684
|
if (e)
|
|
3644
3685
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3645
|
-
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: n } = e,
|
|
3686
|
+
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: n } = e, l = Math.min(r, s), h = Math.max(r, s), f = Math.min(n, o), d = Math.max(n, o), x = [l, h], u = [f, d];
|
|
3646
3687
|
this.setSelector(x, u);
|
|
3647
3688
|
} else {
|
|
3648
3689
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3670,17 +3711,17 @@ class hi {
|
|
|
3670
3711
|
copy() {
|
|
3671
3712
|
if (!this.ctx.config.ENABLE_COPY)
|
|
3672
3713
|
return;
|
|
3673
|
-
const {
|
|
3674
|
-
navigator.clipboard ? navigator.clipboard.writeText(
|
|
3714
|
+
const { value: t } = this.ctx.getSelectedData(), e = ei(t);
|
|
3715
|
+
navigator.clipboard ? navigator.clipboard.writeText(e).then(() => {
|
|
3675
3716
|
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("draw");
|
|
3676
|
-
}).catch((
|
|
3717
|
+
}).catch((i) => console.error("复制失败:", i)) : console.error("当前浏览器不支持Clipboard API");
|
|
3677
3718
|
}
|
|
3678
3719
|
clearSelectedData(t, e, i = !1) {
|
|
3679
3720
|
let s = [];
|
|
3680
3721
|
const o = /* @__PURE__ */ new Set();
|
|
3681
3722
|
for (let n = 0; n <= e[1] - e[0]; n++)
|
|
3682
|
-
for (let
|
|
3683
|
-
const
|
|
3723
|
+
for (let l = 0; l <= t[1] - t[0]; l++) {
|
|
3724
|
+
const h = n + e[0], f = l + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(h, f);
|
|
3684
3725
|
if (d) {
|
|
3685
3726
|
const { rowKey: x, key: u } = d;
|
|
3686
3727
|
this.ctx.database.getReadonly(x, u) || (o.add(x), s.push({
|
|
@@ -3711,24 +3752,20 @@ class hi {
|
|
|
3711
3752
|
if (this.ctx.selector.enable && t) {
|
|
3712
3753
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
3713
3754
|
navigator.clipboard.readText().then((o) => {
|
|
3714
|
-
let r = [];
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
for (let x = 0; x <= d - 1; x++) {
|
|
3722
|
-
const u = f + e, y = x + i, g = r[f][x], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3723
|
-
u,
|
|
3724
|
-
y
|
|
3755
|
+
let r = ti(o), n = [];
|
|
3756
|
+
for (let h = 0; h <= r.length - 1; h++) {
|
|
3757
|
+
const f = r[h].length;
|
|
3758
|
+
for (let d = 0; d <= f - 1; d++) {
|
|
3759
|
+
const x = h + e, u = d + i, y = r[h][d], g = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3760
|
+
x,
|
|
3761
|
+
u
|
|
3725
3762
|
);
|
|
3726
|
-
if (
|
|
3727
|
-
const { rowKey:
|
|
3728
|
-
this.ctx.database.getReadonly(
|
|
3729
|
-
rowKey:
|
|
3730
|
-
key:
|
|
3731
|
-
value:
|
|
3763
|
+
if (g) {
|
|
3764
|
+
const { rowKey: w, key: p } = g;
|
|
3765
|
+
this.ctx.database.getReadonly(w, p) || (s.add(w), n.push({
|
|
3766
|
+
rowKey: w,
|
|
3767
|
+
key: p,
|
|
3768
|
+
value: y,
|
|
3732
3769
|
row: {}
|
|
3733
3770
|
//内部有设置
|
|
3734
3771
|
}));
|
|
@@ -3736,23 +3773,23 @@ class hi {
|
|
|
3736
3773
|
}
|
|
3737
3774
|
}
|
|
3738
3775
|
if (this.isCut) {
|
|
3739
|
-
const
|
|
3776
|
+
const h = this.clearSelectedData(
|
|
3740
3777
|
this.ctx.selector.xArrCopy,
|
|
3741
3778
|
this.ctx.selector.yArrCopy,
|
|
3742
3779
|
!0
|
|
3743
3780
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3744
|
-
),
|
|
3745
|
-
|
|
3746
|
-
|
|
3781
|
+
), f = n.map((d) => `${d.rowKey}-${d.key}`);
|
|
3782
|
+
h.forEach((d) => {
|
|
3783
|
+
f.includes(`${d.rowKey}-${d.key}`) || n.unshift(d);
|
|
3747
3784
|
}), this.isCut = !1;
|
|
3748
3785
|
}
|
|
3749
|
-
if (!
|
|
3786
|
+
if (!n.length)
|
|
3750
3787
|
return;
|
|
3751
|
-
this.ctx.database.batchSetItemValue(
|
|
3788
|
+
this.ctx.database.batchSetItemValue(n, !0);
|
|
3752
3789
|
let l = [];
|
|
3753
|
-
s.forEach((
|
|
3754
|
-
l.push(this.ctx.database.getRowDataItemForRowKey(
|
|
3755
|
-
}), this.ctx.emit("pasteChange",
|
|
3790
|
+
s.forEach((h) => {
|
|
3791
|
+
l.push(this.ctx.database.getRowDataItemForRowKey(h));
|
|
3792
|
+
}), this.ctx.emit("pasteChange", n, l), this.clearCopyLine(), this.ctx.emit("draw");
|
|
3756
3793
|
}).catch((o) => {
|
|
3757
3794
|
console.error("获取剪贴板内容失败:", o);
|
|
3758
3795
|
});
|
|
@@ -3768,7 +3805,7 @@ class hi {
|
|
|
3768
3805
|
if (!e)
|
|
3769
3806
|
return;
|
|
3770
3807
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3771
|
-
const o = 0, r = 0, n = this.ctx.maxColIndex,
|
|
3808
|
+
const o = 0, r = 0, n = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
3772
3809
|
switch (t) {
|
|
3773
3810
|
case "LEFT":
|
|
3774
3811
|
i > o && i--;
|
|
@@ -3780,16 +3817,16 @@ class hi {
|
|
|
3780
3817
|
i < n && i++;
|
|
3781
3818
|
break;
|
|
3782
3819
|
case "BOTTOM":
|
|
3783
|
-
s <
|
|
3820
|
+
s < l && s++;
|
|
3784
3821
|
break;
|
|
3785
3822
|
}
|
|
3786
|
-
const
|
|
3823
|
+
const h = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
3787
3824
|
if (d) {
|
|
3788
3825
|
if (d.operation)
|
|
3789
3826
|
return;
|
|
3790
3827
|
this.ctx.setFocusCell(d);
|
|
3791
3828
|
}
|
|
3792
|
-
this.setSelector(
|
|
3829
|
+
this.setSelector(h, f), this.adjustBoundaryPosition(), this.ctx.emit("draw");
|
|
3793
3830
|
}
|
|
3794
3831
|
stopAdjustPosition() {
|
|
3795
3832
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3805,8 +3842,8 @@ class hi {
|
|
|
3805
3842
|
let n = 10 * (s === "left" ? -1 : 1);
|
|
3806
3843
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3807
3844
|
n *= 1.5;
|
|
3808
|
-
const { scrollX:
|
|
3809
|
-
(
|
|
3845
|
+
const { scrollX: l } = this.ctx, h = l + n;
|
|
3846
|
+
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
3810
3847
|
}, 100);
|
|
3811
3848
|
}
|
|
3812
3849
|
if (o && this.adjustPositionY !== o) {
|
|
@@ -3814,8 +3851,8 @@ class hi {
|
|
|
3814
3851
|
let n = 10 * (o === "top" ? -1 : 1);
|
|
3815
3852
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3816
3853
|
n *= 1.5;
|
|
3817
|
-
const { scrollY:
|
|
3818
|
-
(
|
|
3854
|
+
const { scrollY: l } = this.ctx, h = l + n;
|
|
3855
|
+
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
3819
3856
|
}, 100);
|
|
3820
3857
|
}
|
|
3821
3858
|
}
|
|
@@ -3823,20 +3860,20 @@ class hi {
|
|
|
3823
3860
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
3824
3861
|
*/
|
|
3825
3862
|
adjustBoundaryPosition() {
|
|
3826
|
-
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: o, footer: r, scrollX: n, scrollY:
|
|
3863
|
+
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: o, footer: r, scrollX: n, scrollY: l } = this.ctx;
|
|
3827
3864
|
if (!e)
|
|
3828
3865
|
return;
|
|
3829
|
-
const { SCROLLER_TRACK_SIZE:
|
|
3866
|
+
const { SCROLLER_TRACK_SIZE: h = 0, FOOTER_FIXED: f } = this.ctx.config;
|
|
3830
3867
|
let d = 0;
|
|
3831
3868
|
f && (d = r.visibleHeight);
|
|
3832
|
-
const x = s - e.drawX + 1, u = e.drawX + e.width - (t.width - i) + 1, y = o.height - e.drawY, g = e.drawY + e.height - (t.height - d -
|
|
3833
|
-
u > 0 && !e.fixed ? this.ctx.setScrollX(n + u) : x > 0 && !e.fixed && this.ctx.setScrollX(n - x), y > 0 ? this.ctx.setScrollY(
|
|
3869
|
+
const x = s - e.drawX + 1, u = e.drawX + e.width - (t.width - i) + 1, y = o.height - e.drawY, g = e.drawY + e.height - (t.height - d - h);
|
|
3870
|
+
u > 0 && !e.fixed ? this.ctx.setScrollX(n + u) : x > 0 && !e.fixed && this.ctx.setScrollX(n - x), y > 0 ? this.ctx.setScrollY(l - y) : g > 0 && this.ctx.setScrollY(l + g);
|
|
3834
3871
|
}
|
|
3835
3872
|
destroy() {
|
|
3836
3873
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
3837
3874
|
}
|
|
3838
3875
|
}
|
|
3839
|
-
class
|
|
3876
|
+
class gi {
|
|
3840
3877
|
constructor(t) {
|
|
3841
3878
|
c(this, "ctx");
|
|
3842
3879
|
this.ctx = t, this.init();
|
|
@@ -3844,9 +3881,9 @@ class li {
|
|
|
3844
3881
|
init() {
|
|
3845
3882
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3846
3883
|
this.ctx.target.style.cursor === "crosshair" && (this.ctx.target.style.cursor = "default");
|
|
3847
|
-
const { xArr: i, yArr: s } = this.ctx.selector, o = i[1], r = s[1], { colIndex: n, rowIndex:
|
|
3848
|
-
if (this.ctx.config.ENABLE_AUTOFILL && n === o &&
|
|
3849
|
-
const y =
|
|
3884
|
+
const { xArr: i, yArr: s } = this.ctx.selector, o = i[1], r = s[1], { colIndex: n, rowIndex: l, drawX: h, drawY: f, width: d, height: x } = t;
|
|
3885
|
+
if (this.ctx.config.ENABLE_AUTOFILL && n === o && l === r) {
|
|
3886
|
+
const y = h + d - 6, g = f + x - 6;
|
|
3850
3887
|
e.offsetX > y && e.offsetY > g && (this.ctx.target.style.cursor = "crosshair");
|
|
3851
3888
|
}
|
|
3852
3889
|
this.mouseenter(t);
|
|
@@ -3878,15 +3915,15 @@ class li {
|
|
|
3878
3915
|
return;
|
|
3879
3916
|
let r = t, n = e;
|
|
3880
3917
|
if (!o) {
|
|
3881
|
-
const [
|
|
3882
|
-
n = [
|
|
3918
|
+
const [l] = n;
|
|
3919
|
+
n = [l, l];
|
|
3883
3920
|
}
|
|
3884
3921
|
if (!s) {
|
|
3885
|
-
const [
|
|
3886
|
-
r = [
|
|
3922
|
+
const [l] = r;
|
|
3923
|
+
r = [l, l];
|
|
3887
3924
|
}
|
|
3888
3925
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(n)) {
|
|
3889
|
-
const { SELECTOR_AREA_MIN_X:
|
|
3926
|
+
const { SELECTOR_AREA_MIN_X: l, SELECTOR_AREA_MAX_X: h, SELECTOR_AREA_MIN_Y: f, SELECTOR_AREA_MAX_Y: d } = this.ctx.config, x = l, u = h || this.ctx.maxColIndex, y = f, g = d || this.ctx.maxRowIndex;
|
|
3890
3927
|
let [w, p] = r, [E, m] = n;
|
|
3891
3928
|
if (w < x || E < y)
|
|
3892
3929
|
return;
|
|
@@ -3903,14 +3940,14 @@ class li {
|
|
|
3903
3940
|
const u = d + e.yArr[0], y = x + e.xArr[0];
|
|
3904
3941
|
i.set(`${u}-${y}`, !0);
|
|
3905
3942
|
}
|
|
3906
|
-
const { value: s } = e, o = s[0].length, r = s.length, n = this.ctx.autofill.xArr,
|
|
3907
|
-
let
|
|
3908
|
-
for (let d = 0; d <=
|
|
3943
|
+
const { value: s } = e, o = s[0].length, r = s.length, n = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr;
|
|
3944
|
+
let h = [];
|
|
3945
|
+
for (let d = 0; d <= l[1] - l[0]; d++)
|
|
3909
3946
|
for (let x = 0; x <= n[1] - n[0]; x++) {
|
|
3910
|
-
const u = x + n[0], y = d +
|
|
3947
|
+
const u = x + n[0], y = d + l[0], g = s[d % r][x % o], w = this.ctx.database.getItemValueForRowIndexAndColIndex(y, u), p = `${y}-${u}`;
|
|
3911
3948
|
if (w && !i.has(p)) {
|
|
3912
3949
|
const { rowKey: E, key: m } = w;
|
|
3913
|
-
this.ctx.database.getReadonly(E, m) || (t.add(E),
|
|
3950
|
+
this.ctx.database.getReadonly(E, m) || (t.add(E), h.push({
|
|
3914
3951
|
rowKey: E,
|
|
3915
3952
|
key: m,
|
|
3916
3953
|
value: g,
|
|
@@ -3918,13 +3955,13 @@ class li {
|
|
|
3918
3955
|
}));
|
|
3919
3956
|
}
|
|
3920
3957
|
}
|
|
3921
|
-
if (!
|
|
3958
|
+
if (!h.length)
|
|
3922
3959
|
return;
|
|
3923
|
-
this.ctx.database.batchSetItemValue(
|
|
3960
|
+
this.ctx.database.batchSetItemValue(h, !0);
|
|
3924
3961
|
let f = [];
|
|
3925
3962
|
t.forEach((d) => {
|
|
3926
3963
|
f.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
3927
|
-
}), this.ctx.emit("autofillChange",
|
|
3964
|
+
}), this.ctx.emit("autofillChange", h, f), this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.emit("draw");
|
|
3928
3965
|
}
|
|
3929
3966
|
mouseenter(t) {
|
|
3930
3967
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -3941,12 +3978,12 @@ class li {
|
|
|
3941
3978
|
const rt = Math.min, U = Math.max, ft = Math.round, V = (a) => ({
|
|
3942
3979
|
x: a,
|
|
3943
3980
|
y: a
|
|
3944
|
-
}),
|
|
3981
|
+
}), wi = {
|
|
3945
3982
|
left: "right",
|
|
3946
3983
|
right: "left",
|
|
3947
3984
|
bottom: "top",
|
|
3948
3985
|
top: "bottom"
|
|
3949
|
-
},
|
|
3986
|
+
}, pi = {
|
|
3950
3987
|
start: "end",
|
|
3951
3988
|
end: "start"
|
|
3952
3989
|
};
|
|
@@ -3962,7 +3999,7 @@ function q(a) {
|
|
|
3962
3999
|
function ct(a) {
|
|
3963
4000
|
return a.split("-")[1];
|
|
3964
4001
|
}
|
|
3965
|
-
function
|
|
4002
|
+
function re(a) {
|
|
3966
4003
|
return a === "x" ? "y" : "x";
|
|
3967
4004
|
}
|
|
3968
4005
|
function Mt(a) {
|
|
@@ -3972,22 +4009,22 @@ function J(a) {
|
|
|
3972
4009
|
return ["top", "bottom"].includes(q(a)) ? "y" : "x";
|
|
3973
4010
|
}
|
|
3974
4011
|
function Ht(a) {
|
|
3975
|
-
return
|
|
4012
|
+
return re(J(a));
|
|
3976
4013
|
}
|
|
3977
|
-
function
|
|
4014
|
+
function yi(a, t, e) {
|
|
3978
4015
|
e === void 0 && (e = !1);
|
|
3979
4016
|
const i = ct(a), s = Ht(a), o = Mt(s);
|
|
3980
4017
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
3981
4018
|
return t.reference[o] > t.floating[o] && (r = xt(r)), [r, xt(r)];
|
|
3982
4019
|
}
|
|
3983
|
-
function
|
|
4020
|
+
function mi(a) {
|
|
3984
4021
|
const t = xt(a);
|
|
3985
4022
|
return [Ot(a), t, Ot(t)];
|
|
3986
4023
|
}
|
|
3987
4024
|
function Ot(a) {
|
|
3988
|
-
return a.replace(/start|end/g, (t) =>
|
|
4025
|
+
return a.replace(/start|end/g, (t) => pi[t]);
|
|
3989
4026
|
}
|
|
3990
|
-
function
|
|
4027
|
+
function Ei(a, t, e) {
|
|
3991
4028
|
const i = ["left", "right"], s = ["right", "left"], o = ["top", "bottom"], r = ["bottom", "top"];
|
|
3992
4029
|
switch (a) {
|
|
3993
4030
|
case "top":
|
|
@@ -4000,15 +4037,15 @@ function gi(a, t, e) {
|
|
|
4000
4037
|
return [];
|
|
4001
4038
|
}
|
|
4002
4039
|
}
|
|
4003
|
-
function
|
|
4040
|
+
function bi(a, t, e, i) {
|
|
4004
4041
|
const s = ct(a);
|
|
4005
|
-
let o =
|
|
4042
|
+
let o = Ei(q(a), e === "start", i);
|
|
4006
4043
|
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(Ot)))), o;
|
|
4007
4044
|
}
|
|
4008
4045
|
function xt(a) {
|
|
4009
|
-
return a.replace(/left|right|bottom|top/g, (t) =>
|
|
4046
|
+
return a.replace(/left|right|bottom|top/g, (t) => wi[t]);
|
|
4010
4047
|
}
|
|
4011
|
-
function
|
|
4048
|
+
function Ci(a) {
|
|
4012
4049
|
return {
|
|
4013
4050
|
top: 0,
|
|
4014
4051
|
right: 0,
|
|
@@ -4017,8 +4054,8 @@ function pi(a) {
|
|
|
4017
4054
|
...a
|
|
4018
4055
|
};
|
|
4019
4056
|
}
|
|
4020
|
-
function
|
|
4021
|
-
return typeof a != "number" ?
|
|
4057
|
+
function oe(a) {
|
|
4058
|
+
return typeof a != "number" ? Ci(a) : {
|
|
4022
4059
|
top: a,
|
|
4023
4060
|
right: a,
|
|
4024
4061
|
bottom: a,
|
|
@@ -4043,14 +4080,14 @@ function ut(a) {
|
|
|
4043
4080
|
y: e
|
|
4044
4081
|
};
|
|
4045
4082
|
}
|
|
4046
|
-
function
|
|
4083
|
+
function zt(a, t, e) {
|
|
4047
4084
|
let {
|
|
4048
4085
|
reference: i,
|
|
4049
4086
|
floating: s
|
|
4050
4087
|
} = a;
|
|
4051
|
-
const o = J(t), r = Ht(t), n = Mt(r),
|
|
4088
|
+
const o = J(t), r = Ht(t), n = Mt(r), l = q(t), h = o === "y", f = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, x = i[n] / 2 - s[n] / 2;
|
|
4052
4089
|
let u;
|
|
4053
|
-
switch (
|
|
4090
|
+
switch (l) {
|
|
4054
4091
|
case "top":
|
|
4055
4092
|
u = {
|
|
4056
4093
|
x: f,
|
|
@@ -4083,29 +4120,29 @@ function Pt(a, t, e) {
|
|
|
4083
4120
|
}
|
|
4084
4121
|
switch (ct(t)) {
|
|
4085
4122
|
case "start":
|
|
4086
|
-
u[r] -= x * (e &&
|
|
4123
|
+
u[r] -= x * (e && h ? -1 : 1);
|
|
4087
4124
|
break;
|
|
4088
4125
|
case "end":
|
|
4089
|
-
u[r] += x * (e &&
|
|
4126
|
+
u[r] += x * (e && h ? -1 : 1);
|
|
4090
4127
|
break;
|
|
4091
4128
|
}
|
|
4092
4129
|
return u;
|
|
4093
4130
|
}
|
|
4094
|
-
const
|
|
4131
|
+
const vi = async (a, t, e) => {
|
|
4095
4132
|
const {
|
|
4096
4133
|
placement: i = "bottom",
|
|
4097
4134
|
strategy: s = "absolute",
|
|
4098
4135
|
middleware: o = [],
|
|
4099
4136
|
platform: r
|
|
4100
|
-
} = e, n = o.filter(Boolean),
|
|
4101
|
-
let
|
|
4137
|
+
} = e, n = o.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(t));
|
|
4138
|
+
let h = await r.getElementRects({
|
|
4102
4139
|
reference: a,
|
|
4103
4140
|
floating: t,
|
|
4104
4141
|
strategy: s
|
|
4105
4142
|
}), {
|
|
4106
4143
|
x: f,
|
|
4107
4144
|
y: d
|
|
4108
|
-
} =
|
|
4145
|
+
} = zt(h, i, l), x = i, u = {}, y = 0;
|
|
4109
4146
|
for (let g = 0; g < n.length; g++) {
|
|
4110
4147
|
const {
|
|
4111
4148
|
name: w,
|
|
@@ -4122,7 +4159,7 @@ const yi = async (a, t, e) => {
|
|
|
4122
4159
|
placement: x,
|
|
4123
4160
|
strategy: s,
|
|
4124
4161
|
middlewareData: u,
|
|
4125
|
-
rects:
|
|
4162
|
+
rects: h,
|
|
4126
4163
|
platform: r,
|
|
4127
4164
|
elements: {
|
|
4128
4165
|
reference: a,
|
|
@@ -4135,14 +4172,14 @@ const yi = async (a, t, e) => {
|
|
|
4135
4172
|
...u[w],
|
|
4136
4173
|
...b
|
|
4137
4174
|
}
|
|
4138
|
-
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (
|
|
4175
|
+
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
4139
4176
|
reference: a,
|
|
4140
4177
|
floating: t,
|
|
4141
4178
|
strategy: s
|
|
4142
4179
|
}) : C.rects), {
|
|
4143
4180
|
x: f,
|
|
4144
4181
|
y: d
|
|
4145
|
-
} =
|
|
4182
|
+
} = zt(h, x, l)), g = -1);
|
|
4146
4183
|
}
|
|
4147
4184
|
return {
|
|
4148
4185
|
x: f,
|
|
@@ -4152,7 +4189,7 @@ const yi = async (a, t, e) => {
|
|
|
4152
4189
|
middlewareData: u
|
|
4153
4190
|
};
|
|
4154
4191
|
};
|
|
4155
|
-
async function
|
|
4192
|
+
async function ne(a, t) {
|
|
4156
4193
|
var e;
|
|
4157
4194
|
t === void 0 && (t = {});
|
|
4158
4195
|
const {
|
|
@@ -4161,18 +4198,18 @@ async function re(a, t) {
|
|
|
4161
4198
|
platform: o,
|
|
4162
4199
|
rects: r,
|
|
4163
4200
|
elements: n,
|
|
4164
|
-
strategy:
|
|
4201
|
+
strategy: l
|
|
4165
4202
|
} = a, {
|
|
4166
|
-
boundary:
|
|
4203
|
+
boundary: h = "clippingAncestors",
|
|
4167
4204
|
rootBoundary: f = "viewport",
|
|
4168
4205
|
elementContext: d = "floating",
|
|
4169
4206
|
altBoundary: x = !1,
|
|
4170
4207
|
padding: u = 0
|
|
4171
|
-
} = at(t, a), y =
|
|
4208
|
+
} = at(t, a), y = oe(u), w = n[x ? d === "floating" ? "reference" : "floating" : d], p = ut(await o.getClippingRect({
|
|
4172
4209
|
element: (e = await (o.isElement == null ? void 0 : o.isElement(w))) == null || e ? w : w.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(n.floating)),
|
|
4173
|
-
boundary:
|
|
4210
|
+
boundary: h,
|
|
4174
4211
|
rootBoundary: f,
|
|
4175
|
-
strategy:
|
|
4212
|
+
strategy: l
|
|
4176
4213
|
})), E = d === "floating" ? {
|
|
4177
4214
|
x: i,
|
|
4178
4215
|
y: s,
|
|
@@ -4188,7 +4225,7 @@ async function re(a, t) {
|
|
|
4188
4225
|
elements: n,
|
|
4189
4226
|
rect: E,
|
|
4190
4227
|
offsetParent: m,
|
|
4191
|
-
strategy:
|
|
4228
|
+
strategy: l
|
|
4192
4229
|
}) : E);
|
|
4193
4230
|
return {
|
|
4194
4231
|
top: (p.top - C.top + y.top) / b.y,
|
|
@@ -4197,7 +4234,7 @@ async function re(a, t) {
|
|
|
4197
4234
|
right: (C.right - p.right + y.right) / b.x
|
|
4198
4235
|
};
|
|
4199
4236
|
}
|
|
4200
|
-
const
|
|
4237
|
+
const Ri = (a) => ({
|
|
4201
4238
|
name: "arrow",
|
|
4202
4239
|
options: a,
|
|
4203
4240
|
async fn(t) {
|
|
@@ -4208,20 +4245,20 @@ const mi = (a) => ({
|
|
|
4208
4245
|
rects: o,
|
|
4209
4246
|
platform: r,
|
|
4210
4247
|
elements: n,
|
|
4211
|
-
middlewareData:
|
|
4248
|
+
middlewareData: l
|
|
4212
4249
|
} = t, {
|
|
4213
|
-
element:
|
|
4250
|
+
element: h,
|
|
4214
4251
|
padding: f = 0
|
|
4215
4252
|
} = at(a, t) || {};
|
|
4216
|
-
if (
|
|
4253
|
+
if (h == null)
|
|
4217
4254
|
return {};
|
|
4218
|
-
const d =
|
|
4255
|
+
const d = oe(f), x = {
|
|
4219
4256
|
x: e,
|
|
4220
4257
|
y: i
|
|
4221
|
-
}, u = Ht(s), y = Mt(u), g = await r.getDimensions(
|
|
4258
|
+
}, u = Ht(s), y = Mt(u), g = await r.getDimensions(h), w = u === "y", p = w ? "top" : "left", E = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", b = o.reference[y] + o.reference[u] - x[u] - o.floating[y], C = x[u] - o.reference[u], R = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
|
|
4222
4259
|
let T = R ? R[m] : 0;
|
|
4223
4260
|
(!T || !await (r.isElement == null ? void 0 : r.isElement(R))) && (T = n.floating[m] || o.floating[y]);
|
|
4224
|
-
const L = b / 2 - C / 2, A = T / 2 - g[y] / 2 - 1, D = rt(d[p], A), B = rt(d[E], A), _ = D, S = T - g[y] - B, O = T / 2 - g[y] / 2 + L, G = _t(_, O, S), Y = !
|
|
4261
|
+
const L = b / 2 - C / 2, A = T / 2 - g[y] / 2 - 1, D = rt(d[p], A), B = rt(d[E], A), _ = D, S = T - g[y] - B, O = T / 2 - g[y] / 2 + L, G = _t(_, O, S), Y = !l.arrow && ct(s) != null && O !== G && o.reference[y] / 2 - (O < _ ? D : B) - g[y] / 2 < 0, F = Y ? O < _ ? O - _ : O - S : 0;
|
|
4225
4262
|
return {
|
|
4226
4263
|
[u]: x[u] + F,
|
|
4227
4264
|
data: {
|
|
@@ -4234,7 +4271,7 @@ const mi = (a) => ({
|
|
|
4234
4271
|
reset: Y
|
|
4235
4272
|
};
|
|
4236
4273
|
}
|
|
4237
|
-
}),
|
|
4274
|
+
}), Ii = function(a) {
|
|
4238
4275
|
return a === void 0 && (a = {}), {
|
|
4239
4276
|
name: "flip",
|
|
4240
4277
|
options: a,
|
|
@@ -4245,8 +4282,8 @@ const mi = (a) => ({
|
|
|
4245
4282
|
middlewareData: o,
|
|
4246
4283
|
rects: r,
|
|
4247
4284
|
initialPlacement: n,
|
|
4248
|
-
platform:
|
|
4249
|
-
elements:
|
|
4285
|
+
platform: l,
|
|
4286
|
+
elements: h
|
|
4250
4287
|
} = t, {
|
|
4251
4288
|
mainAxis: f = !0,
|
|
4252
4289
|
crossAxis: d = !0,
|
|
@@ -4258,12 +4295,12 @@ const mi = (a) => ({
|
|
|
4258
4295
|
} = at(a, t);
|
|
4259
4296
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
4260
4297
|
return {};
|
|
4261
|
-
const p = q(s), E = J(n), m = q(n) === n, b = await (
|
|
4262
|
-
!x && R && C.push(...
|
|
4263
|
-
const T = [n, ...C], L = await
|
|
4298
|
+
const p = q(s), E = J(n), m = q(n) === n, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = x || (m || !g ? [xt(n)] : mi(n)), R = y !== "none";
|
|
4299
|
+
!x && R && C.push(...bi(n, g, y, b));
|
|
4300
|
+
const T = [n, ...C], L = await ne(t, w), A = [];
|
|
4264
4301
|
let D = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
4265
4302
|
if (f && A.push(L[p]), d) {
|
|
4266
|
-
const O =
|
|
4303
|
+
const O = yi(s, r, b);
|
|
4267
4304
|
A.push(L[O[0]], L[O[1]]);
|
|
4268
4305
|
}
|
|
4269
4306
|
if (D = [...D, {
|
|
@@ -4295,7 +4332,7 @@ const mi = (a) => ({
|
|
|
4295
4332
|
P === "y";
|
|
4296
4333
|
}
|
|
4297
4334
|
return !0;
|
|
4298
|
-
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P,
|
|
4335
|
+
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, ye) => P + ye, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : S[0];
|
|
4299
4336
|
F && (Y = F);
|
|
4300
4337
|
break;
|
|
4301
4338
|
}
|
|
@@ -4314,12 +4351,12 @@ const mi = (a) => ({
|
|
|
4314
4351
|
}
|
|
4315
4352
|
};
|
|
4316
4353
|
};
|
|
4317
|
-
async function
|
|
4354
|
+
async function _i(a, t) {
|
|
4318
4355
|
const {
|
|
4319
4356
|
placement: e,
|
|
4320
4357
|
platform: i,
|
|
4321
4358
|
elements: s
|
|
4322
|
-
} = a, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = q(e), n = ct(e),
|
|
4359
|
+
} = a, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = q(e), n = ct(e), l = J(e) === "y", h = ["left", "top"].includes(r) ? -1 : 1, f = o && l ? -1 : 1, d = at(t, a);
|
|
4323
4360
|
let {
|
|
4324
4361
|
mainAxis: x,
|
|
4325
4362
|
crossAxis: u,
|
|
@@ -4333,15 +4370,15 @@ async function bi(a, t) {
|
|
|
4333
4370
|
crossAxis: d.crossAxis || 0,
|
|
4334
4371
|
alignmentAxis: d.alignmentAxis
|
|
4335
4372
|
};
|
|
4336
|
-
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y),
|
|
4373
|
+
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y), l ? {
|
|
4337
4374
|
x: u * f,
|
|
4338
|
-
y: x *
|
|
4375
|
+
y: x * h
|
|
4339
4376
|
} : {
|
|
4340
|
-
x: x *
|
|
4377
|
+
x: x * h,
|
|
4341
4378
|
y: u * f
|
|
4342
4379
|
};
|
|
4343
4380
|
}
|
|
4344
|
-
const
|
|
4381
|
+
const Oi = function(a) {
|
|
4345
4382
|
return a === void 0 && (a = 0), {
|
|
4346
4383
|
name: "offset",
|
|
4347
4384
|
options: a,
|
|
@@ -4352,18 +4389,18 @@ const Ci = function(a) {
|
|
|
4352
4389
|
y: o,
|
|
4353
4390
|
placement: r,
|
|
4354
4391
|
middlewareData: n
|
|
4355
|
-
} = t,
|
|
4392
|
+
} = t, l = await _i(t, a);
|
|
4356
4393
|
return r === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
|
|
4357
|
-
x: s +
|
|
4358
|
-
y: o +
|
|
4394
|
+
x: s + l.x,
|
|
4395
|
+
y: o + l.y,
|
|
4359
4396
|
data: {
|
|
4360
|
-
...
|
|
4397
|
+
...l,
|
|
4361
4398
|
placement: r
|
|
4362
4399
|
}
|
|
4363
4400
|
};
|
|
4364
4401
|
}
|
|
4365
4402
|
};
|
|
4366
|
-
},
|
|
4403
|
+
}, Si = function(a) {
|
|
4367
4404
|
return a === void 0 && (a = {}), {
|
|
4368
4405
|
name: "shift",
|
|
4369
4406
|
options: a,
|
|
@@ -4387,12 +4424,12 @@ const Ci = function(a) {
|
|
|
4387
4424
|
};
|
|
4388
4425
|
}
|
|
4389
4426
|
},
|
|
4390
|
-
...
|
|
4391
|
-
} = at(a, t),
|
|
4427
|
+
...l
|
|
4428
|
+
} = at(a, t), h = {
|
|
4392
4429
|
x: e,
|
|
4393
4430
|
y: i
|
|
4394
|
-
}, f = await
|
|
4395
|
-
let u =
|
|
4431
|
+
}, f = await ne(t, l), d = J(q(s)), x = re(d);
|
|
4432
|
+
let u = h[x], y = h[d];
|
|
4396
4433
|
if (o) {
|
|
4397
4434
|
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u + f[w], m = u - f[p];
|
|
4398
4435
|
u = _t(E, u, m);
|
|
@@ -4424,7 +4461,7 @@ function gt() {
|
|
|
4424
4461
|
return typeof window < "u";
|
|
4425
4462
|
}
|
|
4426
4463
|
function tt(a) {
|
|
4427
|
-
return
|
|
4464
|
+
return ae(a) ? (a.nodeName || "").toLowerCase() : "#document";
|
|
4428
4465
|
}
|
|
4429
4466
|
function H(a) {
|
|
4430
4467
|
var t;
|
|
@@ -4432,9 +4469,9 @@ function H(a) {
|
|
|
4432
4469
|
}
|
|
4433
4470
|
function K(a) {
|
|
4434
4471
|
var t;
|
|
4435
|
-
return (t = (
|
|
4472
|
+
return (t = (ae(a) ? a.ownerDocument : a.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4436
4473
|
}
|
|
4437
|
-
function
|
|
4474
|
+
function ae(a) {
|
|
4438
4475
|
return gt() ? a instanceof Node || a instanceof H(a).Node : !1;
|
|
4439
4476
|
}
|
|
4440
4477
|
function X(a) {
|
|
@@ -4443,10 +4480,10 @@ function X(a) {
|
|
|
4443
4480
|
function N(a) {
|
|
4444
4481
|
return gt() ? a instanceof HTMLElement || a instanceof H(a).HTMLElement : !1;
|
|
4445
4482
|
}
|
|
4446
|
-
function
|
|
4483
|
+
function $t(a) {
|
|
4447
4484
|
return !gt() || typeof ShadowRoot > "u" ? !1 : a instanceof ShadowRoot || a instanceof H(a).ShadowRoot;
|
|
4448
4485
|
}
|
|
4449
|
-
function
|
|
4486
|
+
function lt(a) {
|
|
4450
4487
|
const {
|
|
4451
4488
|
overflow: t,
|
|
4452
4489
|
overflowX: e,
|
|
@@ -4455,7 +4492,7 @@ function ht(a) {
|
|
|
4455
4492
|
} = k(a);
|
|
4456
4493
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
4457
4494
|
}
|
|
4458
|
-
function
|
|
4495
|
+
function Ti(a) {
|
|
4459
4496
|
return ["table", "td", "th"].includes(tt(a));
|
|
4460
4497
|
}
|
|
4461
4498
|
function wt(a) {
|
|
@@ -4471,7 +4508,7 @@ function Dt(a) {
|
|
|
4471
4508
|
const t = Xt(), e = X(a) ? k(a) : a;
|
|
4472
4509
|
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));
|
|
4473
4510
|
}
|
|
4474
|
-
function
|
|
4511
|
+
function Li(a) {
|
|
4475
4512
|
let t = z(a);
|
|
4476
4513
|
for (; N(t) && !Q(t); ) {
|
|
4477
4514
|
if (Dt(t))
|
|
@@ -4507,29 +4544,29 @@ function z(a) {
|
|
|
4507
4544
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
4508
4545
|
a.assignedSlot || // DOM Element detected.
|
|
4509
4546
|
a.parentNode || // ShadowRoot detected.
|
|
4510
|
-
|
|
4547
|
+
$t(a) && a.host || // Fallback.
|
|
4511
4548
|
K(a)
|
|
4512
4549
|
);
|
|
4513
|
-
return
|
|
4550
|
+
return $t(t) ? t.host : t;
|
|
4514
4551
|
}
|
|
4515
|
-
function
|
|
4552
|
+
function ce(a) {
|
|
4516
4553
|
const t = z(a);
|
|
4517
|
-
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) &&
|
|
4554
|
+
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) && lt(t) ? t : ce(t);
|
|
4518
4555
|
}
|
|
4519
4556
|
function St(a, t, e) {
|
|
4520
4557
|
var i;
|
|
4521
4558
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4522
|
-
const s =
|
|
4559
|
+
const s = ce(a), o = s === ((i = a.ownerDocument) == null ? void 0 : i.body), r = H(s);
|
|
4523
4560
|
if (o) {
|
|
4524
4561
|
const n = Tt(r);
|
|
4525
|
-
return t.concat(r, r.visualViewport || [],
|
|
4562
|
+
return t.concat(r, r.visualViewport || [], lt(s) ? s : [], n && e ? St(n) : []);
|
|
4526
4563
|
}
|
|
4527
4564
|
return t.concat(s, St(s, [], e));
|
|
4528
4565
|
}
|
|
4529
4566
|
function Tt(a) {
|
|
4530
4567
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
4531
4568
|
}
|
|
4532
|
-
function
|
|
4569
|
+
function le(a) {
|
|
4533
4570
|
const t = k(a);
|
|
4534
4571
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4535
4572
|
const s = N(a), o = s ? a.offsetWidth : e, r = s ? a.offsetHeight : i, n = ft(e) !== o || ft(i) !== r;
|
|
@@ -4539,58 +4576,58 @@ function ae(a) {
|
|
|
4539
4576
|
$: n
|
|
4540
4577
|
};
|
|
4541
4578
|
}
|
|
4542
|
-
function
|
|
4579
|
+
function he(a) {
|
|
4543
4580
|
return X(a) ? a : a.contextElement;
|
|
4544
4581
|
}
|
|
4545
4582
|
function Z(a) {
|
|
4546
|
-
const t =
|
|
4583
|
+
const t = he(a);
|
|
4547
4584
|
if (!N(t))
|
|
4548
4585
|
return V(1);
|
|
4549
4586
|
const e = t.getBoundingClientRect(), {
|
|
4550
4587
|
width: i,
|
|
4551
4588
|
height: s,
|
|
4552
4589
|
$: o
|
|
4553
|
-
} =
|
|
4590
|
+
} = le(t);
|
|
4554
4591
|
let r = (o ? ft(e.width) : e.width) / i, n = (o ? ft(e.height) : e.height) / s;
|
|
4555
4592
|
return (!r || !Number.isFinite(r)) && (r = 1), (!n || !Number.isFinite(n)) && (n = 1), {
|
|
4556
4593
|
x: r,
|
|
4557
4594
|
y: n
|
|
4558
4595
|
};
|
|
4559
4596
|
}
|
|
4560
|
-
const
|
|
4561
|
-
function
|
|
4597
|
+
const Ai = /* @__PURE__ */ V(0);
|
|
4598
|
+
function de(a) {
|
|
4562
4599
|
const t = H(a);
|
|
4563
|
-
return !Xt() || !t.visualViewport ?
|
|
4600
|
+
return !Xt() || !t.visualViewport ? Ai : {
|
|
4564
4601
|
x: t.visualViewport.offsetLeft,
|
|
4565
4602
|
y: t.visualViewport.offsetTop
|
|
4566
4603
|
};
|
|
4567
4604
|
}
|
|
4568
|
-
function
|
|
4605
|
+
function Mi(a, t, e) {
|
|
4569
4606
|
return t === void 0 && (t = !1), !e || t && e !== H(a) ? !1 : t;
|
|
4570
4607
|
}
|
|
4571
4608
|
function ot(a, t, e, i) {
|
|
4572
4609
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
4573
|
-
const s = a.getBoundingClientRect(), o =
|
|
4610
|
+
const s = a.getBoundingClientRect(), o = he(a);
|
|
4574
4611
|
let r = V(1);
|
|
4575
4612
|
t && (i ? X(i) && (r = Z(i)) : r = Z(a));
|
|
4576
|
-
const n =
|
|
4577
|
-
let
|
|
4613
|
+
const n = Mi(o, e, i) ? de(o) : V(0);
|
|
4614
|
+
let l = (s.left + n.x) / r.x, h = (s.top + n.y) / r.y, f = s.width / r.x, d = s.height / r.y;
|
|
4578
4615
|
if (o) {
|
|
4579
4616
|
const x = H(o), u = i && X(i) ? H(i) : i;
|
|
4580
4617
|
let y = x, g = Tt(y);
|
|
4581
4618
|
for (; g && i && u !== y; ) {
|
|
4582
4619
|
const w = Z(g), p = g.getBoundingClientRect(), E = k(g), m = p.left + (g.clientLeft + parseFloat(E.paddingLeft)) * w.x, b = p.top + (g.clientTop + parseFloat(E.paddingTop)) * w.y;
|
|
4583
|
-
|
|
4620
|
+
l *= w.x, h *= w.y, f *= w.x, d *= w.y, l += m, h += b, y = H(g), g = Tt(y);
|
|
4584
4621
|
}
|
|
4585
4622
|
}
|
|
4586
4623
|
return ut({
|
|
4587
4624
|
width: f,
|
|
4588
4625
|
height: d,
|
|
4589
|
-
x:
|
|
4590
|
-
y:
|
|
4626
|
+
x: l,
|
|
4627
|
+
y: h
|
|
4591
4628
|
});
|
|
4592
4629
|
}
|
|
4593
|
-
function
|
|
4630
|
+
function Hi(a) {
|
|
4594
4631
|
let {
|
|
4595
4632
|
elements: t,
|
|
4596
4633
|
rect: e,
|
|
@@ -4600,30 +4637,30 @@ function Si(a) {
|
|
|
4600
4637
|
const o = s === "fixed", r = K(i), n = t ? wt(t.floating) : !1;
|
|
4601
4638
|
if (i === r || n && o)
|
|
4602
4639
|
return e;
|
|
4603
|
-
let
|
|
4640
|
+
let l = {
|
|
4604
4641
|
scrollLeft: 0,
|
|
4605
4642
|
scrollTop: 0
|
|
4606
|
-
},
|
|
4643
|
+
}, h = V(1);
|
|
4607
4644
|
const f = V(0), d = N(i);
|
|
4608
|
-
if ((d || !d && !o) && ((tt(i) !== "body" ||
|
|
4645
|
+
if ((d || !d && !o) && ((tt(i) !== "body" || lt(r)) && (l = pt(i)), N(i))) {
|
|
4609
4646
|
const x = ot(i);
|
|
4610
|
-
|
|
4647
|
+
h = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4611
4648
|
}
|
|
4612
4649
|
return {
|
|
4613
|
-
width: e.width *
|
|
4614
|
-
height: e.height *
|
|
4615
|
-
x: e.x *
|
|
4616
|
-
y: e.y *
|
|
4650
|
+
width: e.width * h.x,
|
|
4651
|
+
height: e.height * h.y,
|
|
4652
|
+
x: e.x * h.x - l.scrollLeft * h.x + f.x,
|
|
4653
|
+
y: e.y * h.y - l.scrollTop * h.y + f.y
|
|
4617
4654
|
};
|
|
4618
4655
|
}
|
|
4619
|
-
function
|
|
4656
|
+
function Di(a) {
|
|
4620
4657
|
return Array.from(a.getClientRects());
|
|
4621
4658
|
}
|
|
4622
4659
|
function Lt(a, t) {
|
|
4623
4660
|
const e = pt(a).scrollLeft;
|
|
4624
4661
|
return t ? t.left + e : ot(K(a)).left + e;
|
|
4625
4662
|
}
|
|
4626
|
-
function
|
|
4663
|
+
function Xi(a) {
|
|
4627
4664
|
const t = K(a), e = pt(a), i = a.ownerDocument.body, s = U(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = U(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
4628
4665
|
let r = -e.scrollLeft + Lt(a);
|
|
4629
4666
|
const n = -e.scrollTop;
|
|
@@ -4634,40 +4671,40 @@ function Li(a) {
|
|
|
4634
4671
|
y: n
|
|
4635
4672
|
};
|
|
4636
4673
|
}
|
|
4637
|
-
function
|
|
4674
|
+
function ki(a, t) {
|
|
4638
4675
|
const e = H(a), i = K(a), s = e.visualViewport;
|
|
4639
|
-
let o = i.clientWidth, r = i.clientHeight, n = 0,
|
|
4676
|
+
let o = i.clientWidth, r = i.clientHeight, n = 0, l = 0;
|
|
4640
4677
|
if (s) {
|
|
4641
4678
|
o = s.width, r = s.height;
|
|
4642
|
-
const
|
|
4643
|
-
(!
|
|
4679
|
+
const h = Xt();
|
|
4680
|
+
(!h || h && t === "fixed") && (n = s.offsetLeft, l = s.offsetTop);
|
|
4644
4681
|
}
|
|
4645
4682
|
return {
|
|
4646
4683
|
width: o,
|
|
4647
4684
|
height: r,
|
|
4648
4685
|
x: n,
|
|
4649
|
-
y:
|
|
4686
|
+
y: l
|
|
4650
4687
|
};
|
|
4651
4688
|
}
|
|
4652
|
-
function
|
|
4653
|
-
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, o = N(a) ? Z(a) : V(1), r = a.clientWidth * o.x, n = a.clientHeight * o.y,
|
|
4689
|
+
function Fi(a, t) {
|
|
4690
|
+
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, o = N(a) ? Z(a) : V(1), r = a.clientWidth * o.x, n = a.clientHeight * o.y, l = s * o.x, h = i * o.y;
|
|
4654
4691
|
return {
|
|
4655
4692
|
width: r,
|
|
4656
4693
|
height: n,
|
|
4657
|
-
x:
|
|
4658
|
-
y:
|
|
4694
|
+
x: l,
|
|
4695
|
+
y: h
|
|
4659
4696
|
};
|
|
4660
4697
|
}
|
|
4661
|
-
function
|
|
4698
|
+
function qt(a, t, e) {
|
|
4662
4699
|
let i;
|
|
4663
4700
|
if (t === "viewport")
|
|
4664
|
-
i =
|
|
4701
|
+
i = ki(a, e);
|
|
4665
4702
|
else if (t === "document")
|
|
4666
|
-
i =
|
|
4703
|
+
i = Xi(K(a));
|
|
4667
4704
|
else if (X(t))
|
|
4668
|
-
i =
|
|
4705
|
+
i = Fi(t, e);
|
|
4669
4706
|
else {
|
|
4670
|
-
const s =
|
|
4707
|
+
const s = de(a);
|
|
4671
4708
|
i = {
|
|
4672
4709
|
...t,
|
|
4673
4710
|
x: t.x - s.x,
|
|
@@ -4676,11 +4713,11 @@ function zt(a, t, e) {
|
|
|
4676
4713
|
}
|
|
4677
4714
|
return ut(i);
|
|
4678
4715
|
}
|
|
4679
|
-
function
|
|
4716
|
+
function fe(a, t) {
|
|
4680
4717
|
const e = z(a);
|
|
4681
|
-
return e === t || !X(e) || Q(e) ? !1 : k(e).position === "fixed" ||
|
|
4718
|
+
return e === t || !X(e) || Q(e) ? !1 : k(e).position === "fixed" || fe(e, t);
|
|
4682
4719
|
}
|
|
4683
|
-
function
|
|
4720
|
+
function Ni(a, t) {
|
|
4684
4721
|
const e = t.get(a);
|
|
4685
4722
|
if (e)
|
|
4686
4723
|
return e;
|
|
@@ -4688,58 +4725,58 @@ function Hi(a, t) {
|
|
|
4688
4725
|
const o = k(a).position === "fixed";
|
|
4689
4726
|
let r = o ? z(a) : a;
|
|
4690
4727
|
for (; X(r) && !Q(r); ) {
|
|
4691
|
-
const n = k(r),
|
|
4692
|
-
!
|
|
4728
|
+
const n = k(r), l = Dt(r);
|
|
4729
|
+
!l && n.position === "fixed" && (s = null), (o ? !l && !s : !l && n.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || lt(r) && !l && fe(a, r)) ? i = i.filter((f) => f !== r) : s = n, r = z(r);
|
|
4693
4730
|
}
|
|
4694
4731
|
return t.set(a, i), i;
|
|
4695
4732
|
}
|
|
4696
|
-
function
|
|
4733
|
+
function Yi(a) {
|
|
4697
4734
|
let {
|
|
4698
4735
|
element: t,
|
|
4699
4736
|
boundary: e,
|
|
4700
4737
|
rootBoundary: i,
|
|
4701
4738
|
strategy: s
|
|
4702
4739
|
} = a;
|
|
4703
|
-
const r = [...e === "clippingAncestors" ? wt(t) ? [] :
|
|
4704
|
-
const d =
|
|
4705
|
-
return
|
|
4706
|
-
},
|
|
4740
|
+
const r = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], n = r[0], l = r.reduce((h, f) => {
|
|
4741
|
+
const d = qt(t, f, s);
|
|
4742
|
+
return h.top = U(d.top, h.top), h.right = rt(d.right, h.right), h.bottom = rt(d.bottom, h.bottom), h.left = U(d.left, h.left), h;
|
|
4743
|
+
}, qt(t, n, s));
|
|
4707
4744
|
return {
|
|
4708
|
-
width:
|
|
4709
|
-
height:
|
|
4710
|
-
x:
|
|
4711
|
-
y:
|
|
4745
|
+
width: l.right - l.left,
|
|
4746
|
+
height: l.bottom - l.top,
|
|
4747
|
+
x: l.left,
|
|
4748
|
+
y: l.top
|
|
4712
4749
|
};
|
|
4713
4750
|
}
|
|
4714
|
-
function
|
|
4751
|
+
function Ki(a) {
|
|
4715
4752
|
const {
|
|
4716
4753
|
width: t,
|
|
4717
4754
|
height: e
|
|
4718
|
-
} =
|
|
4755
|
+
} = le(a);
|
|
4719
4756
|
return {
|
|
4720
4757
|
width: t,
|
|
4721
4758
|
height: e
|
|
4722
4759
|
};
|
|
4723
4760
|
}
|
|
4724
|
-
function
|
|
4761
|
+
function Bi(a, t, e) {
|
|
4725
4762
|
const i = N(t), s = K(t), o = e === "fixed", r = ot(a, !0, o, t);
|
|
4726
4763
|
let n = {
|
|
4727
4764
|
scrollLeft: 0,
|
|
4728
4765
|
scrollTop: 0
|
|
4729
4766
|
};
|
|
4730
|
-
const
|
|
4767
|
+
const l = V(0);
|
|
4731
4768
|
if (i || !i && !o)
|
|
4732
|
-
if ((tt(t) !== "body" ||
|
|
4769
|
+
if ((tt(t) !== "body" || lt(s)) && (n = pt(t)), i) {
|
|
4733
4770
|
const u = ot(t, !0, o, t);
|
|
4734
|
-
|
|
4735
|
-
} else s && (
|
|
4736
|
-
let
|
|
4771
|
+
l.x = u.x + t.clientLeft, l.y = u.y + t.clientTop;
|
|
4772
|
+
} else s && (l.x = Lt(s));
|
|
4773
|
+
let h = 0, f = 0;
|
|
4737
4774
|
if (s && !i && !o) {
|
|
4738
4775
|
const u = s.getBoundingClientRect();
|
|
4739
|
-
f = u.top + n.scrollTop,
|
|
4776
|
+
f = u.top + n.scrollTop, h = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
4740
4777
|
Lt(s, u);
|
|
4741
4778
|
}
|
|
4742
|
-
const d = r.left + n.scrollLeft -
|
|
4779
|
+
const d = r.left + n.scrollLeft - l.x - h, x = r.top + n.scrollTop - l.y - f;
|
|
4743
4780
|
return {
|
|
4744
4781
|
x: d,
|
|
4745
4782
|
y: x,
|
|
@@ -4750,7 +4787,7 @@ function ki(a, t, e) {
|
|
|
4750
4787
|
function mt(a) {
|
|
4751
4788
|
return k(a).position === "static";
|
|
4752
4789
|
}
|
|
4753
|
-
function
|
|
4790
|
+
function Gt(a, t) {
|
|
4754
4791
|
if (!N(a) || k(a).position === "fixed")
|
|
4755
4792
|
return null;
|
|
4756
4793
|
if (t)
|
|
@@ -4758,7 +4795,7 @@ function $t(a, t) {
|
|
|
4758
4795
|
let e = a.offsetParent;
|
|
4759
4796
|
return K(a) === e && (e = e.ownerDocument.body), e;
|
|
4760
4797
|
}
|
|
4761
|
-
function
|
|
4798
|
+
function xe(a, t) {
|
|
4762
4799
|
const e = H(a);
|
|
4763
4800
|
if (wt(a))
|
|
4764
4801
|
return e;
|
|
@@ -4771,15 +4808,15 @@ function de(a, t) {
|
|
|
4771
4808
|
}
|
|
4772
4809
|
return e;
|
|
4773
4810
|
}
|
|
4774
|
-
let i =
|
|
4775
|
-
for (; i &&
|
|
4776
|
-
i =
|
|
4777
|
-
return i && Q(i) && mt(i) && !Dt(i) ? e : i ||
|
|
4811
|
+
let i = Gt(a, t);
|
|
4812
|
+
for (; i && Ti(i) && mt(i); )
|
|
4813
|
+
i = Gt(i, t);
|
|
4814
|
+
return i && Q(i) && mt(i) && !Dt(i) ? e : i || Li(a) || e;
|
|
4778
4815
|
}
|
|
4779
|
-
const
|
|
4780
|
-
const t = this.getOffsetParent ||
|
|
4816
|
+
const Wi = async function(a) {
|
|
4817
|
+
const t = this.getOffsetParent || xe, e = this.getDimensions, i = await e(a.floating);
|
|
4781
4818
|
return {
|
|
4782
|
-
reference:
|
|
4819
|
+
reference: Bi(a.reference, await t(a.floating), a.strategy),
|
|
4783
4820
|
floating: {
|
|
4784
4821
|
x: 0,
|
|
4785
4822
|
y: 0,
|
|
@@ -4788,34 +4825,34 @@ const Fi = async function(a) {
|
|
|
4788
4825
|
}
|
|
4789
4826
|
};
|
|
4790
4827
|
};
|
|
4791
|
-
function
|
|
4828
|
+
function Pi(a) {
|
|
4792
4829
|
return k(a).direction === "rtl";
|
|
4793
4830
|
}
|
|
4794
|
-
const
|
|
4795
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
4831
|
+
const Vi = {
|
|
4832
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Hi,
|
|
4796
4833
|
getDocumentElement: K,
|
|
4797
|
-
getClippingRect:
|
|
4798
|
-
getOffsetParent:
|
|
4799
|
-
getElementRects:
|
|
4800
|
-
getClientRects:
|
|
4801
|
-
getDimensions:
|
|
4834
|
+
getClippingRect: Yi,
|
|
4835
|
+
getOffsetParent: xe,
|
|
4836
|
+
getElementRects: Wi,
|
|
4837
|
+
getClientRects: Di,
|
|
4838
|
+
getDimensions: Ki,
|
|
4802
4839
|
getScale: Z,
|
|
4803
4840
|
isElement: X,
|
|
4804
|
-
isRTL:
|
|
4805
|
-
},
|
|
4841
|
+
isRTL: Pi
|
|
4842
|
+
}, ue = Oi, ge = Si, we = Ii, zi = Ri, pe = (a, t, e) => {
|
|
4806
4843
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
4807
|
-
platform:
|
|
4844
|
+
platform: Vi,
|
|
4808
4845
|
...e
|
|
4809
4846
|
}, o = {
|
|
4810
4847
|
...s.platform,
|
|
4811
4848
|
_c: i
|
|
4812
4849
|
};
|
|
4813
|
-
return
|
|
4850
|
+
return vi(a, t, {
|
|
4814
4851
|
...s,
|
|
4815
4852
|
platform: o
|
|
4816
4853
|
});
|
|
4817
4854
|
};
|
|
4818
|
-
let
|
|
4855
|
+
let $i = class {
|
|
4819
4856
|
constructor(t) {
|
|
4820
4857
|
c(this, "ctx");
|
|
4821
4858
|
c(this, "enable", !1);
|
|
@@ -4836,7 +4873,7 @@ let Bi = class {
|
|
|
4836
4873
|
borderRadius: "4px",
|
|
4837
4874
|
fontSize: "12px",
|
|
4838
4875
|
...o
|
|
4839
|
-
},
|
|
4876
|
+
}, l = {
|
|
4840
4877
|
position: "absolute",
|
|
4841
4878
|
width: "10px",
|
|
4842
4879
|
height: "10px",
|
|
@@ -4845,7 +4882,7 @@ let Bi = class {
|
|
|
4845
4882
|
transform: "rotate(45deg)",
|
|
4846
4883
|
zIndex: n.zIndex
|
|
4847
4884
|
};
|
|
4848
|
-
Object.assign(this.arrowEl.style,
|
|
4885
|
+
Object.assign(this.arrowEl.style, l), Object.assign(this.floatingEl.style, n), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.targetContainer.appendChild(this.floatingEl), this.init();
|
|
4849
4886
|
}
|
|
4850
4887
|
init() {
|
|
4851
4888
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -4870,7 +4907,7 @@ let Bi = class {
|
|
|
4870
4907
|
return;
|
|
4871
4908
|
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;
|
|
4872
4909
|
const s = t.drawX + i.x, o = t.drawY + i.y;
|
|
4873
|
-
|
|
4910
|
+
pe({
|
|
4874
4911
|
getBoundingClientRect() {
|
|
4875
4912
|
return {
|
|
4876
4913
|
width: t.visibleWidth,
|
|
@@ -4885,12 +4922,12 @@ let Bi = class {
|
|
|
4885
4922
|
}
|
|
4886
4923
|
}, this.floatingEl, {
|
|
4887
4924
|
placement: t.overflowTooltipPlacement,
|
|
4888
|
-
middleware: [
|
|
4925
|
+
middleware: [ge(), we(), ue(6), zi({ element: this.arrowEl })]
|
|
4889
4926
|
}).then((n) => {
|
|
4890
|
-
const { x:
|
|
4927
|
+
const { x: l, y: h, placement: f, middlewareData: d } = n;
|
|
4891
4928
|
if (Object.assign(this.floatingEl.style, {
|
|
4892
|
-
top: `${
|
|
4893
|
-
left: `${
|
|
4929
|
+
top: `${h}px`,
|
|
4930
|
+
left: `${l}px`
|
|
4894
4931
|
}), d.arrow) {
|
|
4895
4932
|
const x = d.arrow;
|
|
4896
4933
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -4924,7 +4961,7 @@ let Bi = class {
|
|
|
4924
4961
|
this.contentEl.remove(), this.arrowEl.remove(), this.floatingEl.remove();
|
|
4925
4962
|
}
|
|
4926
4963
|
};
|
|
4927
|
-
class
|
|
4964
|
+
class qi {
|
|
4928
4965
|
constructor(t) {
|
|
4929
4966
|
c(this, "editorEl");
|
|
4930
4967
|
c(this, "inputEl");
|
|
@@ -4937,7 +4974,7 @@ class Wi {
|
|
|
4937
4974
|
this.ctx.on("onScroll", () => {
|
|
4938
4975
|
this.enable && this.doneEdit();
|
|
4939
4976
|
}), this.ctx.on("cellHeaderMousedown", () => {
|
|
4940
|
-
this.enable && this.doneEdit();
|
|
4977
|
+
this.enable && this.doneEdit(), this.cellTarget = null;
|
|
4941
4978
|
}), this.ctx.on("keydown", (t) => {
|
|
4942
4979
|
const e = t.key, i = t.ctrlKey, s = t.altKey, o = t.shiftKey, r = t.metaKey;
|
|
4943
4980
|
if (!(i || s || o || r || [
|
|
@@ -4989,8 +5026,8 @@ class Wi {
|
|
|
4989
5026
|
this.inputEl.textContent = `${n}
|
|
4990
5027
|
|
|
4991
5028
|
`;
|
|
4992
|
-
const
|
|
4993
|
-
|
|
5029
|
+
const l = window.getSelection();
|
|
5030
|
+
l == null || l.selectAllChildren(this.inputEl), l == null || l.collapseToEnd();
|
|
4994
5031
|
return;
|
|
4995
5032
|
}
|
|
4996
5033
|
(r.code === "Escape" || r.code === "Enter") && (r.preventDefault(), this.inputEl.blur());
|
|
@@ -5040,8 +5077,8 @@ class Wi {
|
|
|
5040
5077
|
return;
|
|
5041
5078
|
const e = t.getValue(), { width: i, height: s } = t, o = t.getDrawX(), r = t.getDrawY(), { CELL_PADDING: n } = this.ctx.config;
|
|
5042
5079
|
this.editorEl.style.left = `${o}px`, this.editorEl.style.top = `${r}px`, this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${s - 1}px`, this.inputEl.style.padding = `${n}px`, e !== null && (this.inputEl.textContent = e), this.inputEl.focus();
|
|
5043
|
-
const
|
|
5044
|
-
|
|
5080
|
+
const l = window.getSelection();
|
|
5081
|
+
l == null || l.selectAllChildren(this.inputEl), l == null || l.collapseToEnd();
|
|
5045
5082
|
}
|
|
5046
5083
|
doneEditByInput() {
|
|
5047
5084
|
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
@@ -5060,18 +5097,18 @@ class Wi {
|
|
|
5060
5097
|
e && !o && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5061
5098
|
}
|
|
5062
5099
|
editCell(t, e) {
|
|
5063
|
-
const i = this.ctx.body.renderRows.find((
|
|
5100
|
+
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
5064
5101
|
if (!i)
|
|
5065
5102
|
return;
|
|
5066
|
-
const s = i.cells.find((
|
|
5103
|
+
const s = i.cells.find((h) => h.colIndex === e);
|
|
5067
5104
|
if (!s)
|
|
5068
5105
|
return;
|
|
5069
5106
|
this.ctx.emit("setSelectorCell", s);
|
|
5070
5107
|
const o = this.ctx.focusCell;
|
|
5071
5108
|
if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
|
|
5072
5109
|
return;
|
|
5073
|
-
const { rowKey: r, key: n } = o,
|
|
5074
|
-
o && !
|
|
5110
|
+
const { rowKey: r, key: n } = o, l = this.ctx.database.getReadonly(r, n);
|
|
5111
|
+
o && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5075
5112
|
}
|
|
5076
5113
|
doneEdit() {
|
|
5077
5114
|
this.enable && this.cellTarget && (this.ctx.emit("doneEdit", this.cellTarget), this.doneEditByInput(), this.enable = !1, this.ctx.target.focus(), this.ctx.editing = !1, this.cellTarget = null, this.ctx.emit("draw"));
|
|
@@ -5079,16 +5116,16 @@ class Wi {
|
|
|
5079
5116
|
destroy() {
|
|
5080
5117
|
}
|
|
5081
5118
|
}
|
|
5082
|
-
class
|
|
5119
|
+
class Gi {
|
|
5083
5120
|
constructor(t) {
|
|
5084
5121
|
c(this, "ctx");
|
|
5085
5122
|
c(this, "emptyEl");
|
|
5086
5123
|
this.ctx = t;
|
|
5087
5124
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX: o } = this.ctx.config;
|
|
5088
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${o}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.targetContainer.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: r, headerHeight: n, bodyHeight:
|
|
5125
|
+
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${o}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.targetContainer.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: r, headerHeight: n, bodyHeight: l, footerHeight: h }) => {
|
|
5089
5126
|
if (i)
|
|
5090
5127
|
return;
|
|
5091
|
-
const f = n + (
|
|
5128
|
+
const f = n + (l + h) / 2, d = {
|
|
5092
5129
|
display: r === "empty" ? "block" : "none",
|
|
5093
5130
|
position: "absolute",
|
|
5094
5131
|
fontSize: "14px",
|
|
@@ -5105,7 +5142,7 @@ class Pi {
|
|
|
5105
5142
|
this.emptyEl.remove();
|
|
5106
5143
|
}
|
|
5107
5144
|
}
|
|
5108
|
-
class
|
|
5145
|
+
class ji {
|
|
5109
5146
|
constructor(t) {
|
|
5110
5147
|
c(this, "ctx");
|
|
5111
5148
|
this.ctx = t;
|
|
@@ -5125,9 +5162,9 @@ class Vi {
|
|
|
5125
5162
|
target: t,
|
|
5126
5163
|
config: { SCROLLER_TRACK_SIZE: e }
|
|
5127
5164
|
} = this.ctx, i = t.width - e, s = t.height - e, o = this.getHeader(), r = this.getBody(), n = this.getFooter();
|
|
5128
|
-
let
|
|
5129
|
-
const { FOOTER_FIXED:
|
|
5130
|
-
return
|
|
5165
|
+
let l = [o, r, n];
|
|
5166
|
+
const { FOOTER_FIXED: h } = this.ctx.config;
|
|
5167
|
+
return h || (l = [o, r]), {
|
|
5131
5168
|
style: {
|
|
5132
5169
|
position: "absolute",
|
|
5133
5170
|
left: "0px",
|
|
@@ -5137,7 +5174,7 @@ class Vi {
|
|
|
5137
5174
|
width: `${i}px`,
|
|
5138
5175
|
height: `${s}px`
|
|
5139
5176
|
},
|
|
5140
|
-
views:
|
|
5177
|
+
views: l
|
|
5141
5178
|
};
|
|
5142
5179
|
}
|
|
5143
5180
|
getHeader() {
|
|
@@ -5146,9 +5183,9 @@ class Vi {
|
|
|
5146
5183
|
fixedRightWidth: e,
|
|
5147
5184
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5148
5185
|
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: n } = this.ctx.header;
|
|
5149
|
-
let
|
|
5186
|
+
let l = [], h = [], f = [];
|
|
5150
5187
|
n.forEach((w) => {
|
|
5151
|
-
w.render && (w.fixed === "left" ?
|
|
5188
|
+
w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ? f.push(w) : l.push(w));
|
|
5152
5189
|
});
|
|
5153
5190
|
const d = e - i, x = {
|
|
5154
5191
|
key: "left",
|
|
@@ -5160,7 +5197,7 @@ class Vi {
|
|
|
5160
5197
|
width: `${t}px`,
|
|
5161
5198
|
height: `${r}px`
|
|
5162
5199
|
},
|
|
5163
|
-
cells:
|
|
5200
|
+
cells: h
|
|
5164
5201
|
}, u = {
|
|
5165
5202
|
key: "center",
|
|
5166
5203
|
style: {
|
|
@@ -5171,7 +5208,7 @@ class Vi {
|
|
|
5171
5208
|
width: `${o - t - d}px`,
|
|
5172
5209
|
height: `${r}px`
|
|
5173
5210
|
},
|
|
5174
|
-
cells:
|
|
5211
|
+
cells: l
|
|
5175
5212
|
}, y = {
|
|
5176
5213
|
key: "right",
|
|
5177
5214
|
style: {
|
|
@@ -5207,8 +5244,8 @@ class Vi {
|
|
|
5207
5244
|
const {
|
|
5208
5245
|
fixedLeftWidth: o,
|
|
5209
5246
|
fixedRightWidth: r,
|
|
5210
|
-
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX:
|
|
5211
|
-
} = this.ctx, { visibleWidth:
|
|
5247
|
+
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: l }
|
|
5248
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: f } = this.ctx.body, d = r - n, x = {
|
|
5212
5249
|
key: "left",
|
|
5213
5250
|
style: {
|
|
5214
5251
|
position: "absolute",
|
|
@@ -5226,7 +5263,7 @@ class Vi {
|
|
|
5226
5263
|
top: `${0.5}px`,
|
|
5227
5264
|
left: `${o + 0.5}px`,
|
|
5228
5265
|
overflow: "hidden",
|
|
5229
|
-
width: `${
|
|
5266
|
+
width: `${h - o - d}px`,
|
|
5230
5267
|
height: `${f}px`
|
|
5231
5268
|
},
|
|
5232
5269
|
cells: t
|
|
@@ -5244,11 +5281,11 @@ class Vi {
|
|
|
5244
5281
|
};
|
|
5245
5282
|
return {
|
|
5246
5283
|
type: "body",
|
|
5247
|
-
class: `${
|
|
5284
|
+
class: `${l}-overlayer-body`,
|
|
5248
5285
|
style: {
|
|
5249
5286
|
position: "relative",
|
|
5250
5287
|
overflow: "hidden",
|
|
5251
|
-
width: `${
|
|
5288
|
+
width: `${h}px`,
|
|
5252
5289
|
height: `${f}px`
|
|
5253
5290
|
},
|
|
5254
5291
|
views: [x, u, y]
|
|
@@ -5265,7 +5302,7 @@ class Vi {
|
|
|
5265
5302
|
fixedLeftWidth: s,
|
|
5266
5303
|
fixedRightWidth: o,
|
|
5267
5304
|
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: n }
|
|
5268
|
-
} = this.ctx, { visibleWidth:
|
|
5305
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, f = o - r, d = {
|
|
5269
5306
|
key: "left",
|
|
5270
5307
|
style: {
|
|
5271
5308
|
position: "absolute",
|
|
@@ -5273,7 +5310,7 @@ class Vi {
|
|
|
5273
5310
|
left: `${0.5}px`,
|
|
5274
5311
|
overflow: "hidden",
|
|
5275
5312
|
width: `${s}px`,
|
|
5276
|
-
height: `${
|
|
5313
|
+
height: `${h}px`
|
|
5277
5314
|
},
|
|
5278
5315
|
cells: e
|
|
5279
5316
|
}, x = {
|
|
@@ -5283,8 +5320,8 @@ class Vi {
|
|
|
5283
5320
|
top: `${0.5}px`,
|
|
5284
5321
|
left: `${s + 0.5}px`,
|
|
5285
5322
|
overflow: "hidden",
|
|
5286
|
-
width: `${
|
|
5287
|
-
height: `${
|
|
5323
|
+
width: `${l - s - f}px`,
|
|
5324
|
+
height: `${h}px`
|
|
5288
5325
|
},
|
|
5289
5326
|
cells: t
|
|
5290
5327
|
}, u = {
|
|
@@ -5295,7 +5332,7 @@ class Vi {
|
|
|
5295
5332
|
right: `${0.5}px`,
|
|
5296
5333
|
overflow: "hidden",
|
|
5297
5334
|
width: `${f}px`,
|
|
5298
|
-
height: `${
|
|
5335
|
+
height: `${h}px`
|
|
5299
5336
|
},
|
|
5300
5337
|
cells: i
|
|
5301
5338
|
};
|
|
@@ -5305,14 +5342,14 @@ class Vi {
|
|
|
5305
5342
|
style: {
|
|
5306
5343
|
position: "relative",
|
|
5307
5344
|
overflow: "hidden",
|
|
5308
|
-
width: `${
|
|
5309
|
-
height: `${
|
|
5345
|
+
width: `${l}px`,
|
|
5346
|
+
height: `${h}px`
|
|
5310
5347
|
},
|
|
5311
5348
|
views: [d, x, u]
|
|
5312
5349
|
};
|
|
5313
5350
|
}
|
|
5314
5351
|
}
|
|
5315
|
-
class
|
|
5352
|
+
class Ui {
|
|
5316
5353
|
constructor(t) {
|
|
5317
5354
|
c(this, "ctx");
|
|
5318
5355
|
c(this, "contextMenuEl");
|
|
@@ -5322,8 +5359,8 @@ class zi {
|
|
|
5322
5359
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5323
5360
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5324
5361
|
e.preventDefault();
|
|
5325
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [n,
|
|
5326
|
-
|
|
5362
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [n, l] = s, { rowIndex: h, colIndex: f } = t;
|
|
5363
|
+
h >= n && h <= l && f >= o && f <= r || this.ctx.emit("setSelectorCell", t, e);
|
|
5327
5364
|
const x = {
|
|
5328
5365
|
getBoundingClientRect: () => ({
|
|
5329
5366
|
width: 0,
|
|
@@ -5337,9 +5374,9 @@ class zi {
|
|
|
5337
5374
|
}),
|
|
5338
5375
|
contextElement: document.body
|
|
5339
5376
|
};
|
|
5340
|
-
|
|
5377
|
+
pe(x, this.contextMenuEl, {
|
|
5341
5378
|
placement: "right-start",
|
|
5342
|
-
middleware: [
|
|
5379
|
+
middleware: [ue(), ge(), we()]
|
|
5343
5380
|
}).then(({ x: u, y }) => {
|
|
5344
5381
|
this.show(u, y);
|
|
5345
5382
|
});
|
|
@@ -5395,7 +5432,7 @@ class zi {
|
|
|
5395
5432
|
this.contextMenuEl.remove();
|
|
5396
5433
|
}
|
|
5397
5434
|
}
|
|
5398
|
-
class
|
|
5435
|
+
class Qi {
|
|
5399
5436
|
constructor(t, e) {
|
|
5400
5437
|
c(this, "targetContainer");
|
|
5401
5438
|
c(this, "target");
|
|
@@ -5412,7 +5449,7 @@ class Gi {
|
|
|
5412
5449
|
c(this, "overlayer");
|
|
5413
5450
|
c(this, "contextMenu");
|
|
5414
5451
|
c(this, "ctx");
|
|
5415
|
-
this.target = document.createElement("canvas"), this.targetContainer = t, this.targetContainer.style.position = "relative", this.targetContainer.appendChild(this.target), this.options = e, this.ctx = new
|
|
5452
|
+
this.target = document.createElement("canvas"), this.targetContainer = t, this.targetContainer.style.position = "relative", this.targetContainer.appendChild(this.target), this.options = e, this.ctx = new li(this.targetContainer, this.target, this.options), this.header = new di(this.ctx), this.body = new fi(this.ctx), this.footer = new xi(this.ctx), this.scroller = new hi(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", this.draw.bind(this)), this.draw();
|
|
5416
5453
|
}
|
|
5417
5454
|
draw() {
|
|
5418
5455
|
requestAnimationFrame(() => {
|
|
@@ -5476,8 +5513,8 @@ class Gi {
|
|
|
5476
5513
|
if (t && Array.isArray(s) && s.length) {
|
|
5477
5514
|
const [o] = s;
|
|
5478
5515
|
if (Array.isArray(o) && o.length) {
|
|
5479
|
-
const [r] = o, { rowKey: n, key:
|
|
5480
|
-
this.scrollToRowkey(n), this.scrollToColkey(
|
|
5516
|
+
const [r] = o, { rowKey: n, key: l } = r;
|
|
5517
|
+
this.scrollToRowkey(n), this.scrollToColkey(l);
|
|
5481
5518
|
}
|
|
5482
5519
|
}
|
|
5483
5520
|
i(s);
|
|
@@ -5502,7 +5539,7 @@ class Gi {
|
|
|
5502
5539
|
let o = [];
|
|
5503
5540
|
for (let r = 0; r < i.length; r++)
|
|
5504
5541
|
for (let n = 0; n < s.length; n++) {
|
|
5505
|
-
const
|
|
5542
|
+
const l = this.ctx.database.getRowKeyByItem(i[r]), f = s[n].key, d = await this.ctx.database.getValidator(l, f);
|
|
5506
5543
|
Array.isArray(d) && d.length && o.push(d);
|
|
5507
5544
|
}
|
|
5508
5545
|
o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
@@ -5564,6 +5601,6 @@ class Gi {
|
|
|
5564
5601
|
}
|
|
5565
5602
|
}
|
|
5566
5603
|
export {
|
|
5567
|
-
|
|
5604
|
+
Qi as default
|
|
5568
5605
|
};
|
|
5569
5606
|
//# sourceMappingURL=index.es.js.map
|