e-virt-table 0.0.10 → 0.0.11
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 +626 -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/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");
|
|
@@ -2848,20 +2887,20 @@ class Wt {
|
|
|
2848
2887
|
body: t,
|
|
2849
2888
|
header: e,
|
|
2850
2889
|
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,
|
|
2890
|
+
} = 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
2891
|
if (this.type === "vertical") {
|
|
2853
|
-
this.visibleDistance = r - i - n, this.distance =
|
|
2854
|
-
const d = this.distance ? this.visibleDistance /
|
|
2892
|
+
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;
|
|
2893
|
+
const d = this.distance ? this.visibleDistance / h : 0;
|
|
2855
2894
|
let x = Math.floor(d * this.visibleDistance);
|
|
2856
2895
|
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
2896
|
} else {
|
|
2858
|
-
this.visibleDistance = o - i, this.distance =
|
|
2897
|
+
this.visibleDistance = o - i, this.distance = l - this.visibleDistance, this.splitPoints = [
|
|
2859
2898
|
o - i,
|
|
2860
2899
|
r - i,
|
|
2861
2900
|
o - i,
|
|
2862
2901
|
r
|
|
2863
2902
|
], this.trackX = 0, this.trackY = r - i, this.trackWidth = o, this.trackHeight = i;
|
|
2864
|
-
const d = this.distance ? this.visibleDistance /
|
|
2903
|
+
const d = this.distance ? this.visibleDistance / l : 0;
|
|
2865
2904
|
let x = Math.floor(d * this.visibleDistance);
|
|
2866
2905
|
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
2906
|
}
|
|
@@ -2882,12 +2921,12 @@ class Wt {
|
|
|
2882
2921
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
2883
2922
|
}
|
|
2884
2923
|
}
|
|
2885
|
-
class
|
|
2924
|
+
class hi {
|
|
2886
2925
|
constructor(t) {
|
|
2887
2926
|
c(this, "ctx");
|
|
2888
2927
|
c(this, "verticalScrollbar");
|
|
2889
2928
|
c(this, "horizontalScrollbar");
|
|
2890
|
-
this.ctx = t, this.verticalScrollbar = new
|
|
2929
|
+
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
2930
|
this.setScroll(e, i);
|
|
2892
2931
|
}), this.ctx.on("setScrollX", (e) => {
|
|
2893
2932
|
this.setScrollX(e);
|
|
@@ -2938,7 +2977,7 @@ class oi {
|
|
|
2938
2977
|
this.setScrollY(o - e.visibleHeight / 2);
|
|
2939
2978
|
}
|
|
2940
2979
|
}
|
|
2941
|
-
class
|
|
2980
|
+
class di {
|
|
2942
2981
|
constructor(t) {
|
|
2943
2982
|
c(this, "ctx");
|
|
2944
2983
|
// 上下文
|
|
@@ -2977,7 +3016,7 @@ class ni {
|
|
|
2977
3016
|
c(this, "renderFixedCellHeaders", []);
|
|
2978
3017
|
this.ctx = t, this.ctx.on(
|
|
2979
3018
|
"resetHeader",
|
|
2980
|
-
|
|
3019
|
+
Zt(() => {
|
|
2981
3020
|
this.init(), this.ctx.emit("draw");
|
|
2982
3021
|
}, 100)
|
|
2983
3022
|
), this.init(), this.initResizeColumn();
|
|
@@ -2987,19 +3026,19 @@ class ni {
|
|
|
2987
3026
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
2988
3027
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
2989
3028
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
2990
|
-
const s =
|
|
3029
|
+
const s = Jt(i), o = It(i);
|
|
2991
3030
|
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 =
|
|
3031
|
+
const r = Je(Qt(i, s));
|
|
2993
3032
|
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
2994
3033
|
const n = this.ctx.targetContainer.getBoundingClientRect();
|
|
2995
3034
|
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(
|
|
3035
|
+
const l = this.visibleWidth - this.width;
|
|
3036
|
+
if (this.resizeNum && l > 0) {
|
|
3037
|
+
const d = Math.floor(l / this.resizeNum * 100) / 100;
|
|
2999
3038
|
this.resizeAllColumn(d);
|
|
3000
3039
|
}
|
|
3001
|
-
const
|
|
3002
|
-
this.ctx.fixedLeftWidth =
|
|
3040
|
+
const h = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
3041
|
+
this.ctx.fixedLeftWidth = h.reduce((d, x) => d + x.width, 0);
|
|
3003
3042
|
const f = this.fixedRightCellHeaders.filter((d) => !d.hasChildren);
|
|
3004
3043
|
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
3044
|
}
|
|
@@ -3028,8 +3067,8 @@ class ni {
|
|
|
3028
3067
|
this.ctx.target.style.cursor === "col-resize" && (this.ctx.target.style.cursor = "default");
|
|
3029
3068
|
const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3030
3069
|
for (const r of o) {
|
|
3031
|
-
const n = e.layerX,
|
|
3032
|
-
n >
|
|
3070
|
+
const n = e.layerX, l = r.getDrawX();
|
|
3071
|
+
n > l + r.width - 5 && n < l + r.width + 4 && n < i.width - 4 && // 视窗中最后一列不允许调整宽
|
|
3033
3072
|
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
3073
|
}
|
|
3035
3074
|
}
|
|
@@ -3084,10 +3123,10 @@ class ni {
|
|
|
3084
3123
|
let s = e;
|
|
3085
3124
|
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
3086
3125
|
for (let r = 0; r < i; r++) {
|
|
3087
|
-
const n = t[r],
|
|
3126
|
+
const n = t[r], l = o * (n.rowspan || 1), h = o * n.level;
|
|
3088
3127
|
let f = n.width || 100;
|
|
3089
3128
|
n.children && (f = It(n.children).reduce((u, y) => u + ((y == null ? void 0 : y.width) || 100), 0));
|
|
3090
|
-
const d = new
|
|
3129
|
+
const d = new ie(this.ctx, this.columnIndex, s, h, f, l, n);
|
|
3091
3130
|
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
3131
|
}
|
|
3093
3132
|
}
|
|
@@ -3119,8 +3158,8 @@ class ni {
|
|
|
3119
3158
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3120
3159
|
colorEnd: "rgba(0,0,0,0)"
|
|
3121
3160
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3122
|
-
const
|
|
3123
|
-
this.ctx.paint.drawShadow(
|
|
3161
|
+
const l = s.width - (this.x + this.width) + o.width - e;
|
|
3162
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3124
3163
|
fillColor: r,
|
|
3125
3164
|
side: "left",
|
|
3126
3165
|
shadowWidth: 4,
|
|
@@ -3147,8 +3186,8 @@ class ni {
|
|
|
3147
3186
|
}), this.drawTipLine();
|
|
3148
3187
|
}
|
|
3149
3188
|
}
|
|
3150
|
-
class
|
|
3151
|
-
constructor(t, e, i = 0, s = 0, o = 0, r = 0, n,
|
|
3189
|
+
class se {
|
|
3190
|
+
constructor(t, e, i = 0, s = 0, o = 0, r = 0, n, l = "body") {
|
|
3152
3191
|
c(this, "ctx");
|
|
3153
3192
|
c(this, "x", 0);
|
|
3154
3193
|
c(this, "y", 0);
|
|
@@ -3161,12 +3200,12 @@ class ee {
|
|
|
3161
3200
|
c(this, "rowKey", "");
|
|
3162
3201
|
c(this, "rowType", "body");
|
|
3163
3202
|
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 =
|
|
3203
|
+
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
3204
|
}
|
|
3166
3205
|
update() {
|
|
3167
3206
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3168
3207
|
t.renderLeafCellHeaders.forEach((o) => {
|
|
3169
|
-
const r = new
|
|
3208
|
+
const r = new ee(
|
|
3170
3209
|
this.ctx,
|
|
3171
3210
|
this.rowIndex,
|
|
3172
3211
|
o.colIndex,
|
|
@@ -3199,7 +3238,7 @@ class ee {
|
|
|
3199
3238
|
});
|
|
3200
3239
|
}
|
|
3201
3240
|
}
|
|
3202
|
-
class
|
|
3241
|
+
class fi {
|
|
3203
3242
|
constructor(t) {
|
|
3204
3243
|
c(this, "resizeTarget", null);
|
|
3205
3244
|
//调整行大小的目标
|
|
@@ -3235,8 +3274,8 @@ class ai {
|
|
|
3235
3274
|
SCROLLER_TRACK_SIZE: o = 0,
|
|
3236
3275
|
BORDER_COLOR: r,
|
|
3237
3276
|
BORDER_RADIUS: n,
|
|
3238
|
-
HEIGHT:
|
|
3239
|
-
EMPTY_BODY_HEIGHT:
|
|
3277
|
+
HEIGHT: l,
|
|
3278
|
+
EMPTY_BODY_HEIGHT: h = 0,
|
|
3240
3279
|
MAX_HEIGHT: f = 0,
|
|
3241
3280
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3242
3281
|
OFFSET_HEIGHT: x = 0
|
|
@@ -3250,7 +3289,7 @@ class ai {
|
|
|
3250
3289
|
const { top: g } = t.getBoundingClientRect();
|
|
3251
3290
|
this.width = e.width, this.visibleWidth = t.width - o;
|
|
3252
3291
|
const w = this.ctx.footer.height;
|
|
3253
|
-
this.data.length || (this.height =
|
|
3292
|
+
this.data.length || (this.height = h);
|
|
3254
3293
|
const p = this.data.length ? "not-empty" : "empty";
|
|
3255
3294
|
this.ctx.emit("emptyChange", {
|
|
3256
3295
|
isEmpty: p,
|
|
@@ -3259,14 +3298,14 @@ class ai {
|
|
|
3259
3298
|
bodyHeight: this.height,
|
|
3260
3299
|
footerHeight: w,
|
|
3261
3300
|
width: this.width,
|
|
3262
|
-
height: this.data.length ? 0 :
|
|
3301
|
+
height: this.data.length ? 0 : h + w
|
|
3263
3302
|
});
|
|
3264
3303
|
let E = this.height + e.height + o;
|
|
3265
3304
|
E += w;
|
|
3266
3305
|
let m = 0;
|
|
3267
3306
|
this.data.length && d ? (m = window.innerHeight - g - x, m < 0 && (m = 32, console.error(
|
|
3268
3307
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3269
|
-
))) : this.data.length &&
|
|
3308
|
+
))) : this.data.length && l ? m = l : this.data.length && f && E > f ? m = f : m = E, m > 0 && (this.ctx.target.height = m);
|
|
3270
3309
|
let b = t.height - e.height - o;
|
|
3271
3310
|
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
3311
|
"style",
|
|
@@ -3292,19 +3331,19 @@ class ai {
|
|
|
3292
3331
|
config: { RESIZE_ROW_MIN_HEIGHT: n = 0 }
|
|
3293
3332
|
} = this.ctx;
|
|
3294
3333
|
if (this.isResizing && this.resizeTarget) {
|
|
3295
|
-
const
|
|
3296
|
-
let
|
|
3297
|
-
|
|
3334
|
+
const l = this.resizeTarget.height;
|
|
3335
|
+
let h = i - this.offsetY;
|
|
3336
|
+
h + l < n && (h = -(l - n)), this.resizeDiff = h, this.ctx.emit("draw");
|
|
3298
3337
|
} else {
|
|
3299
3338
|
if (this.resizeTarget = null, this.isMouseDown || this.ctx.target.style.cursor === "crosshair")
|
|
3300
3339
|
return;
|
|
3301
3340
|
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 =
|
|
3341
|
+
for (let l = 0; l < this.renderRows.length; l++) {
|
|
3342
|
+
const h = this.renderRows[l];
|
|
3343
|
+
if (i > h.y - r + h.height - 1.5 && i < h.y - r + h.height + 1.5 && i < o.height - 4)
|
|
3344
|
+
for (let d = 0; d < h.cells.length; d++) {
|
|
3345
|
+
const x = h.cells[d];
|
|
3346
|
+
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget = h);
|
|
3308
3347
|
}
|
|
3309
3348
|
}
|
|
3310
3349
|
}
|
|
@@ -3350,8 +3389,8 @@ class ai {
|
|
|
3350
3389
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3351
3390
|
colorEnd: "rgba(0,0,0,0)"
|
|
3352
3391
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3353
|
-
const
|
|
3354
|
-
this.ctx.paint.drawShadow(
|
|
3392
|
+
const l = s.width - (this.x + this.width) + o.width - e;
|
|
3393
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3355
3394
|
fillColor: r,
|
|
3356
3395
|
side: "left",
|
|
3357
3396
|
shadowWidth: 4,
|
|
@@ -3375,14 +3414,14 @@ class ai {
|
|
|
3375
3414
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: o, positions: r } = e.getData();
|
|
3376
3415
|
this.ctx.maxRowIndex = o.length - 1;
|
|
3377
3416
|
const n = this.binarySearch(r, s);
|
|
3378
|
-
let
|
|
3379
|
-
|
|
3380
|
-
const
|
|
3417
|
+
let l = this.binarySearch(r, s + this.visibleHeight);
|
|
3418
|
+
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;
|
|
3419
|
+
const h = [];
|
|
3381
3420
|
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
|
-
|
|
3421
|
+
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);
|
|
3422
|
+
h.push(g);
|
|
3384
3423
|
}
|
|
3385
|
-
this.renderRows =
|
|
3424
|
+
this.renderRows = h, this.ctx.body.renderRows = h;
|
|
3386
3425
|
}
|
|
3387
3426
|
draw() {
|
|
3388
3427
|
this.renderRows.forEach((t) => {
|
|
@@ -3392,7 +3431,7 @@ class ai {
|
|
|
3392
3431
|
}), this.drawTipLine();
|
|
3393
3432
|
}
|
|
3394
3433
|
}
|
|
3395
|
-
class
|
|
3434
|
+
class xi {
|
|
3396
3435
|
constructor(t) {
|
|
3397
3436
|
c(this, "ctx");
|
|
3398
3437
|
c(this, "renderRows", []);
|
|
@@ -3423,16 +3462,16 @@ class ci {
|
|
|
3423
3462
|
target: o,
|
|
3424
3463
|
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: n }
|
|
3425
3464
|
} = this.ctx;
|
|
3426
|
-
let
|
|
3427
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3465
|
+
let l = this.y;
|
|
3466
|
+
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
3467
|
fillColor: r,
|
|
3429
3468
|
side: "right",
|
|
3430
3469
|
shadowWidth: 4,
|
|
3431
3470
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3432
3471
|
colorEnd: "rgba(0,0,0,0)"
|
|
3433
3472
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3434
|
-
const
|
|
3435
|
-
this.ctx.paint.drawShadow(
|
|
3473
|
+
const h = s.width - (this.x + this.width) + o.width - e;
|
|
3474
|
+
this.ctx.paint.drawShadow(h + 1, l, e, this.height, {
|
|
3436
3475
|
fillColor: r,
|
|
3437
3476
|
side: "left",
|
|
3438
3477
|
shadowWidth: 4,
|
|
@@ -3447,7 +3486,7 @@ class ci {
|
|
|
3447
3486
|
let e = this.y;
|
|
3448
3487
|
const i = [];
|
|
3449
3488
|
this.data.forEach((s, o) => {
|
|
3450
|
-
const r = new
|
|
3489
|
+
const r = new se(
|
|
3451
3490
|
this.ctx,
|
|
3452
3491
|
o,
|
|
3453
3492
|
0,
|
|
@@ -3468,7 +3507,7 @@ class ci {
|
|
|
3468
3507
|
});
|
|
3469
3508
|
}
|
|
3470
3509
|
}
|
|
3471
|
-
class
|
|
3510
|
+
class ui {
|
|
3472
3511
|
// 垂直滚动定时器
|
|
3473
3512
|
constructor(t) {
|
|
3474
3513
|
c(this, "isCut", !1);
|
|
@@ -3484,7 +3523,7 @@ class hi {
|
|
|
3484
3523
|
init() {
|
|
3485
3524
|
this.ctx.on(
|
|
3486
3525
|
"mousemove",
|
|
3487
|
-
|
|
3526
|
+
Zt((t) => {
|
|
3488
3527
|
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
3528
|
(this.ctx.selectorMove || this.ctx.autofillMove) && (s ? this.stopAdjustPosition() : this.startAdjustPosition(t));
|
|
3490
3529
|
}, 100)
|
|
@@ -3571,7 +3610,7 @@ class hi {
|
|
|
3571
3610
|
}
|
|
3572
3611
|
if (JSON.stringify(this.ctx.selector.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.selector.yArr) !== JSON.stringify(r)) {
|
|
3573
3612
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3574
|
-
const { SELECTOR_AREA_MIN_X: n, SELECTOR_AREA_MAX_X:
|
|
3613
|
+
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
3614
|
let [g, w] = o, [p, E] = r;
|
|
3576
3615
|
if (g < d || p < u)
|
|
3577
3616
|
return;
|
|
@@ -3588,12 +3627,12 @@ class hi {
|
|
|
3588
3627
|
const { SELECTOR_AREA_MIN_Y: e, SELECTOR_AREA_MAX_Y: i } = this.ctx.config, s = e, o = i || this.ctx.maxRowIndex;
|
|
3589
3628
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3590
3629
|
const { colIndex: r } = this.ctx.focusCellHeader;
|
|
3591
|
-
if (t.colIndex >= r) {
|
|
3592
|
-
const n = [r, t.colIndex + t.colspan - 1],
|
|
3593
|
-
this.setSelector(n,
|
|
3630
|
+
if (this.ctx.clearSelector(), t.colIndex >= r) {
|
|
3631
|
+
const n = [r, t.colIndex + t.colspan - 1], l = [s, o];
|
|
3632
|
+
this.setSelector(n, l);
|
|
3594
3633
|
} else {
|
|
3595
|
-
const n = [t.colIndex, r],
|
|
3596
|
-
this.setSelector(n,
|
|
3634
|
+
const n = [t.colIndex, r], l = [s, o];
|
|
3635
|
+
this.setSelector(n, l);
|
|
3597
3636
|
}
|
|
3598
3637
|
} else {
|
|
3599
3638
|
const r = [t.colIndex, t.colIndex + t.colspan - 1], n = [s, o];
|
|
@@ -3605,7 +3644,7 @@ class hi {
|
|
|
3605
3644
|
return;
|
|
3606
3645
|
const { ENABLE_SELECTOR_ALL_ROWS: t, ENABLE_SELECTOR_ALL_COLS: e } = this.ctx.config;
|
|
3607
3646
|
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,
|
|
3647
|
+
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
3648
|
this.setSelector(d, x);
|
|
3610
3649
|
}
|
|
3611
3650
|
}
|
|
@@ -3615,17 +3654,17 @@ class hi {
|
|
|
3615
3654
|
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s } = this.ctx.config, o = s || this.ctx.maxColIndex, r = i;
|
|
3616
3655
|
if (e) {
|
|
3617
3656
|
this.ctx.setFocusCell(t);
|
|
3618
|
-
const n = [r, o],
|
|
3619
|
-
this.setSelector(n,
|
|
3657
|
+
const n = [r, o], l = [t.rowIndex, t.rowIndex];
|
|
3658
|
+
this.setSelector(n, l);
|
|
3620
3659
|
}
|
|
3621
3660
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3622
3661
|
const { rowIndex: n } = this.ctx.focusCell;
|
|
3623
3662
|
if (t.rowIndex >= n) {
|
|
3624
|
-
const
|
|
3625
|
-
this.setSelector(
|
|
3663
|
+
const l = [r, o], h = [n, t.rowIndex];
|
|
3664
|
+
this.setSelector(l, h);
|
|
3626
3665
|
} else {
|
|
3627
|
-
const
|
|
3628
|
-
this.setSelector(
|
|
3666
|
+
const l = [r, o], h = [t.rowIndex, n];
|
|
3667
|
+
this.setSelector(l, h);
|
|
3629
3668
|
}
|
|
3630
3669
|
}
|
|
3631
3670
|
}
|
|
@@ -3634,7 +3673,7 @@ class hi {
|
|
|
3634
3673
|
return;
|
|
3635
3674
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3636
3675
|
if (t && e && i) {
|
|
3637
|
-
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), n = Math.max(i.colIndex, o),
|
|
3676
|
+
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
3677
|
this.setSelector(f, d);
|
|
3639
3678
|
}
|
|
3640
3679
|
}
|
|
@@ -3642,7 +3681,7 @@ class hi {
|
|
|
3642
3681
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3643
3682
|
if (e)
|
|
3644
3683
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3645
|
-
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: n } = e,
|
|
3684
|
+
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
3685
|
this.setSelector(x, u);
|
|
3647
3686
|
} else {
|
|
3648
3687
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3670,17 +3709,17 @@ class hi {
|
|
|
3670
3709
|
copy() {
|
|
3671
3710
|
if (!this.ctx.config.ENABLE_COPY)
|
|
3672
3711
|
return;
|
|
3673
|
-
const {
|
|
3674
|
-
navigator.clipboard ? navigator.clipboard.writeText(
|
|
3712
|
+
const { value: t } = this.ctx.getSelectedData(), e = ei(t);
|
|
3713
|
+
navigator.clipboard ? navigator.clipboard.writeText(e).then(() => {
|
|
3675
3714
|
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((
|
|
3715
|
+
}).catch((i) => console.error("复制失败:", i)) : console.error("当前浏览器不支持Clipboard API");
|
|
3677
3716
|
}
|
|
3678
3717
|
clearSelectedData(t, e, i = !1) {
|
|
3679
3718
|
let s = [];
|
|
3680
3719
|
const o = /* @__PURE__ */ new Set();
|
|
3681
3720
|
for (let n = 0; n <= e[1] - e[0]; n++)
|
|
3682
|
-
for (let
|
|
3683
|
-
const
|
|
3721
|
+
for (let l = 0; l <= t[1] - t[0]; l++) {
|
|
3722
|
+
const h = n + e[0], f = l + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(h, f);
|
|
3684
3723
|
if (d) {
|
|
3685
3724
|
const { rowKey: x, key: u } = d;
|
|
3686
3725
|
this.ctx.database.getReadonly(x, u) || (o.add(x), s.push({
|
|
@@ -3711,24 +3750,20 @@ class hi {
|
|
|
3711
3750
|
if (this.ctx.selector.enable && t) {
|
|
3712
3751
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
3713
3752
|
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
|
|
3753
|
+
let r = ti(o), n = [];
|
|
3754
|
+
for (let h = 0; h <= r.length - 1; h++) {
|
|
3755
|
+
const f = r[h].length;
|
|
3756
|
+
for (let d = 0; d <= f - 1; d++) {
|
|
3757
|
+
const x = h + e, u = d + i, y = r[h][d], g = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3758
|
+
x,
|
|
3759
|
+
u
|
|
3725
3760
|
);
|
|
3726
|
-
if (
|
|
3727
|
-
const { rowKey:
|
|
3728
|
-
this.ctx.database.getReadonly(
|
|
3729
|
-
rowKey:
|
|
3730
|
-
key:
|
|
3731
|
-
value:
|
|
3761
|
+
if (g) {
|
|
3762
|
+
const { rowKey: w, key: p } = g;
|
|
3763
|
+
this.ctx.database.getReadonly(w, p) || (s.add(w), n.push({
|
|
3764
|
+
rowKey: w,
|
|
3765
|
+
key: p,
|
|
3766
|
+
value: y,
|
|
3732
3767
|
row: {}
|
|
3733
3768
|
//内部有设置
|
|
3734
3769
|
}));
|
|
@@ -3736,23 +3771,23 @@ class hi {
|
|
|
3736
3771
|
}
|
|
3737
3772
|
}
|
|
3738
3773
|
if (this.isCut) {
|
|
3739
|
-
const
|
|
3774
|
+
const h = this.clearSelectedData(
|
|
3740
3775
|
this.ctx.selector.xArrCopy,
|
|
3741
3776
|
this.ctx.selector.yArrCopy,
|
|
3742
3777
|
!0
|
|
3743
3778
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3744
|
-
),
|
|
3745
|
-
|
|
3746
|
-
|
|
3779
|
+
), f = n.map((d) => `${d.rowKey}-${d.key}`);
|
|
3780
|
+
h.forEach((d) => {
|
|
3781
|
+
f.includes(`${d.rowKey}-${d.key}`) || n.unshift(d);
|
|
3747
3782
|
}), this.isCut = !1;
|
|
3748
3783
|
}
|
|
3749
|
-
if (!
|
|
3784
|
+
if (!n.length)
|
|
3750
3785
|
return;
|
|
3751
|
-
this.ctx.database.batchSetItemValue(
|
|
3786
|
+
this.ctx.database.batchSetItemValue(n, !0);
|
|
3752
3787
|
let l = [];
|
|
3753
|
-
s.forEach((
|
|
3754
|
-
l.push(this.ctx.database.getRowDataItemForRowKey(
|
|
3755
|
-
}), this.ctx.emit("pasteChange",
|
|
3788
|
+
s.forEach((h) => {
|
|
3789
|
+
l.push(this.ctx.database.getRowDataItemForRowKey(h));
|
|
3790
|
+
}), this.ctx.emit("pasteChange", n, l), this.clearCopyLine(), this.ctx.emit("draw");
|
|
3756
3791
|
}).catch((o) => {
|
|
3757
3792
|
console.error("获取剪贴板内容失败:", o);
|
|
3758
3793
|
});
|
|
@@ -3768,7 +3803,7 @@ class hi {
|
|
|
3768
3803
|
if (!e)
|
|
3769
3804
|
return;
|
|
3770
3805
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3771
|
-
const o = 0, r = 0, n = this.ctx.maxColIndex,
|
|
3806
|
+
const o = 0, r = 0, n = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
3772
3807
|
switch (t) {
|
|
3773
3808
|
case "LEFT":
|
|
3774
3809
|
i > o && i--;
|
|
@@ -3780,16 +3815,16 @@ class hi {
|
|
|
3780
3815
|
i < n && i++;
|
|
3781
3816
|
break;
|
|
3782
3817
|
case "BOTTOM":
|
|
3783
|
-
s <
|
|
3818
|
+
s < l && s++;
|
|
3784
3819
|
break;
|
|
3785
3820
|
}
|
|
3786
|
-
const
|
|
3821
|
+
const h = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
3787
3822
|
if (d) {
|
|
3788
3823
|
if (d.operation)
|
|
3789
3824
|
return;
|
|
3790
3825
|
this.ctx.setFocusCell(d);
|
|
3791
3826
|
}
|
|
3792
|
-
this.setSelector(
|
|
3827
|
+
this.setSelector(h, f), this.adjustBoundaryPosition(), this.ctx.emit("draw");
|
|
3793
3828
|
}
|
|
3794
3829
|
stopAdjustPosition() {
|
|
3795
3830
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3805,8 +3840,8 @@ class hi {
|
|
|
3805
3840
|
let n = 10 * (s === "left" ? -1 : 1);
|
|
3806
3841
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3807
3842
|
n *= 1.5;
|
|
3808
|
-
const { scrollX:
|
|
3809
|
-
(
|
|
3843
|
+
const { scrollX: l } = this.ctx, h = l + n;
|
|
3844
|
+
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
3810
3845
|
}, 100);
|
|
3811
3846
|
}
|
|
3812
3847
|
if (o && this.adjustPositionY !== o) {
|
|
@@ -3814,8 +3849,8 @@ class hi {
|
|
|
3814
3849
|
let n = 10 * (o === "top" ? -1 : 1);
|
|
3815
3850
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3816
3851
|
n *= 1.5;
|
|
3817
|
-
const { scrollY:
|
|
3818
|
-
(
|
|
3852
|
+
const { scrollY: l } = this.ctx, h = l + n;
|
|
3853
|
+
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
3819
3854
|
}, 100);
|
|
3820
3855
|
}
|
|
3821
3856
|
}
|
|
@@ -3823,20 +3858,20 @@ class hi {
|
|
|
3823
3858
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
3824
3859
|
*/
|
|
3825
3860
|
adjustBoundaryPosition() {
|
|
3826
|
-
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: o, footer: r, scrollX: n, scrollY:
|
|
3861
|
+
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: o, footer: r, scrollX: n, scrollY: l } = this.ctx;
|
|
3827
3862
|
if (!e)
|
|
3828
3863
|
return;
|
|
3829
|
-
const { SCROLLER_TRACK_SIZE:
|
|
3864
|
+
const { SCROLLER_TRACK_SIZE: h = 0, FOOTER_FIXED: f } = this.ctx.config;
|
|
3830
3865
|
let d = 0;
|
|
3831
3866
|
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(
|
|
3867
|
+
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);
|
|
3868
|
+
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
3869
|
}
|
|
3835
3870
|
destroy() {
|
|
3836
3871
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
3837
3872
|
}
|
|
3838
3873
|
}
|
|
3839
|
-
class
|
|
3874
|
+
class gi {
|
|
3840
3875
|
constructor(t) {
|
|
3841
3876
|
c(this, "ctx");
|
|
3842
3877
|
this.ctx = t, this.init();
|
|
@@ -3844,9 +3879,9 @@ class li {
|
|
|
3844
3879
|
init() {
|
|
3845
3880
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3846
3881
|
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 =
|
|
3882
|
+
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;
|
|
3883
|
+
if (this.ctx.config.ENABLE_AUTOFILL && n === o && l === r) {
|
|
3884
|
+
const y = h + d - 6, g = f + x - 6;
|
|
3850
3885
|
e.offsetX > y && e.offsetY > g && (this.ctx.target.style.cursor = "crosshair");
|
|
3851
3886
|
}
|
|
3852
3887
|
this.mouseenter(t);
|
|
@@ -3878,15 +3913,15 @@ class li {
|
|
|
3878
3913
|
return;
|
|
3879
3914
|
let r = t, n = e;
|
|
3880
3915
|
if (!o) {
|
|
3881
|
-
const [
|
|
3882
|
-
n = [
|
|
3916
|
+
const [l] = n;
|
|
3917
|
+
n = [l, l];
|
|
3883
3918
|
}
|
|
3884
3919
|
if (!s) {
|
|
3885
|
-
const [
|
|
3886
|
-
r = [
|
|
3920
|
+
const [l] = r;
|
|
3921
|
+
r = [l, l];
|
|
3887
3922
|
}
|
|
3888
3923
|
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:
|
|
3924
|
+
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
3925
|
let [w, p] = r, [E, m] = n;
|
|
3891
3926
|
if (w < x || E < y)
|
|
3892
3927
|
return;
|
|
@@ -3903,14 +3938,14 @@ class li {
|
|
|
3903
3938
|
const u = d + e.yArr[0], y = x + e.xArr[0];
|
|
3904
3939
|
i.set(`${u}-${y}`, !0);
|
|
3905
3940
|
}
|
|
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 <=
|
|
3941
|
+
const { value: s } = e, o = s[0].length, r = s.length, n = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr;
|
|
3942
|
+
let h = [];
|
|
3943
|
+
for (let d = 0; d <= l[1] - l[0]; d++)
|
|
3909
3944
|
for (let x = 0; x <= n[1] - n[0]; x++) {
|
|
3910
|
-
const u = x + n[0], y = d +
|
|
3945
|
+
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
3946
|
if (w && !i.has(p)) {
|
|
3912
3947
|
const { rowKey: E, key: m } = w;
|
|
3913
|
-
this.ctx.database.getReadonly(E, m) || (t.add(E),
|
|
3948
|
+
this.ctx.database.getReadonly(E, m) || (t.add(E), h.push({
|
|
3914
3949
|
rowKey: E,
|
|
3915
3950
|
key: m,
|
|
3916
3951
|
value: g,
|
|
@@ -3918,13 +3953,13 @@ class li {
|
|
|
3918
3953
|
}));
|
|
3919
3954
|
}
|
|
3920
3955
|
}
|
|
3921
|
-
if (!
|
|
3956
|
+
if (!h.length)
|
|
3922
3957
|
return;
|
|
3923
|
-
this.ctx.database.batchSetItemValue(
|
|
3958
|
+
this.ctx.database.batchSetItemValue(h, !0);
|
|
3924
3959
|
let f = [];
|
|
3925
3960
|
t.forEach((d) => {
|
|
3926
3961
|
f.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
3927
|
-
}), this.ctx.emit("autofillChange",
|
|
3962
|
+
}), 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
3963
|
}
|
|
3929
3964
|
mouseenter(t) {
|
|
3930
3965
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -3941,12 +3976,12 @@ class li {
|
|
|
3941
3976
|
const rt = Math.min, U = Math.max, ft = Math.round, V = (a) => ({
|
|
3942
3977
|
x: a,
|
|
3943
3978
|
y: a
|
|
3944
|
-
}),
|
|
3979
|
+
}), wi = {
|
|
3945
3980
|
left: "right",
|
|
3946
3981
|
right: "left",
|
|
3947
3982
|
bottom: "top",
|
|
3948
3983
|
top: "bottom"
|
|
3949
|
-
},
|
|
3984
|
+
}, pi = {
|
|
3950
3985
|
start: "end",
|
|
3951
3986
|
end: "start"
|
|
3952
3987
|
};
|
|
@@ -3962,7 +3997,7 @@ function q(a) {
|
|
|
3962
3997
|
function ct(a) {
|
|
3963
3998
|
return a.split("-")[1];
|
|
3964
3999
|
}
|
|
3965
|
-
function
|
|
4000
|
+
function re(a) {
|
|
3966
4001
|
return a === "x" ? "y" : "x";
|
|
3967
4002
|
}
|
|
3968
4003
|
function Mt(a) {
|
|
@@ -3972,22 +4007,22 @@ function J(a) {
|
|
|
3972
4007
|
return ["top", "bottom"].includes(q(a)) ? "y" : "x";
|
|
3973
4008
|
}
|
|
3974
4009
|
function Ht(a) {
|
|
3975
|
-
return
|
|
4010
|
+
return re(J(a));
|
|
3976
4011
|
}
|
|
3977
|
-
function
|
|
4012
|
+
function yi(a, t, e) {
|
|
3978
4013
|
e === void 0 && (e = !1);
|
|
3979
4014
|
const i = ct(a), s = Ht(a), o = Mt(s);
|
|
3980
4015
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
3981
4016
|
return t.reference[o] > t.floating[o] && (r = xt(r)), [r, xt(r)];
|
|
3982
4017
|
}
|
|
3983
|
-
function
|
|
4018
|
+
function mi(a) {
|
|
3984
4019
|
const t = xt(a);
|
|
3985
4020
|
return [Ot(a), t, Ot(t)];
|
|
3986
4021
|
}
|
|
3987
4022
|
function Ot(a) {
|
|
3988
|
-
return a.replace(/start|end/g, (t) =>
|
|
4023
|
+
return a.replace(/start|end/g, (t) => pi[t]);
|
|
3989
4024
|
}
|
|
3990
|
-
function
|
|
4025
|
+
function Ei(a, t, e) {
|
|
3991
4026
|
const i = ["left", "right"], s = ["right", "left"], o = ["top", "bottom"], r = ["bottom", "top"];
|
|
3992
4027
|
switch (a) {
|
|
3993
4028
|
case "top":
|
|
@@ -4000,15 +4035,15 @@ function gi(a, t, e) {
|
|
|
4000
4035
|
return [];
|
|
4001
4036
|
}
|
|
4002
4037
|
}
|
|
4003
|
-
function
|
|
4038
|
+
function bi(a, t, e, i) {
|
|
4004
4039
|
const s = ct(a);
|
|
4005
|
-
let o =
|
|
4040
|
+
let o = Ei(q(a), e === "start", i);
|
|
4006
4041
|
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(Ot)))), o;
|
|
4007
4042
|
}
|
|
4008
4043
|
function xt(a) {
|
|
4009
|
-
return a.replace(/left|right|bottom|top/g, (t) =>
|
|
4044
|
+
return a.replace(/left|right|bottom|top/g, (t) => wi[t]);
|
|
4010
4045
|
}
|
|
4011
|
-
function
|
|
4046
|
+
function Ci(a) {
|
|
4012
4047
|
return {
|
|
4013
4048
|
top: 0,
|
|
4014
4049
|
right: 0,
|
|
@@ -4017,8 +4052,8 @@ function pi(a) {
|
|
|
4017
4052
|
...a
|
|
4018
4053
|
};
|
|
4019
4054
|
}
|
|
4020
|
-
function
|
|
4021
|
-
return typeof a != "number" ?
|
|
4055
|
+
function oe(a) {
|
|
4056
|
+
return typeof a != "number" ? Ci(a) : {
|
|
4022
4057
|
top: a,
|
|
4023
4058
|
right: a,
|
|
4024
4059
|
bottom: a,
|
|
@@ -4043,14 +4078,14 @@ function ut(a) {
|
|
|
4043
4078
|
y: e
|
|
4044
4079
|
};
|
|
4045
4080
|
}
|
|
4046
|
-
function
|
|
4081
|
+
function zt(a, t, e) {
|
|
4047
4082
|
let {
|
|
4048
4083
|
reference: i,
|
|
4049
4084
|
floating: s
|
|
4050
4085
|
} = a;
|
|
4051
|
-
const o = J(t), r = Ht(t), n = Mt(r),
|
|
4086
|
+
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
4087
|
let u;
|
|
4053
|
-
switch (
|
|
4088
|
+
switch (l) {
|
|
4054
4089
|
case "top":
|
|
4055
4090
|
u = {
|
|
4056
4091
|
x: f,
|
|
@@ -4083,29 +4118,29 @@ function Pt(a, t, e) {
|
|
|
4083
4118
|
}
|
|
4084
4119
|
switch (ct(t)) {
|
|
4085
4120
|
case "start":
|
|
4086
|
-
u[r] -= x * (e &&
|
|
4121
|
+
u[r] -= x * (e && h ? -1 : 1);
|
|
4087
4122
|
break;
|
|
4088
4123
|
case "end":
|
|
4089
|
-
u[r] += x * (e &&
|
|
4124
|
+
u[r] += x * (e && h ? -1 : 1);
|
|
4090
4125
|
break;
|
|
4091
4126
|
}
|
|
4092
4127
|
return u;
|
|
4093
4128
|
}
|
|
4094
|
-
const
|
|
4129
|
+
const vi = async (a, t, e) => {
|
|
4095
4130
|
const {
|
|
4096
4131
|
placement: i = "bottom",
|
|
4097
4132
|
strategy: s = "absolute",
|
|
4098
4133
|
middleware: o = [],
|
|
4099
4134
|
platform: r
|
|
4100
|
-
} = e, n = o.filter(Boolean),
|
|
4101
|
-
let
|
|
4135
|
+
} = e, n = o.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(t));
|
|
4136
|
+
let h = await r.getElementRects({
|
|
4102
4137
|
reference: a,
|
|
4103
4138
|
floating: t,
|
|
4104
4139
|
strategy: s
|
|
4105
4140
|
}), {
|
|
4106
4141
|
x: f,
|
|
4107
4142
|
y: d
|
|
4108
|
-
} =
|
|
4143
|
+
} = zt(h, i, l), x = i, u = {}, y = 0;
|
|
4109
4144
|
for (let g = 0; g < n.length; g++) {
|
|
4110
4145
|
const {
|
|
4111
4146
|
name: w,
|
|
@@ -4122,7 +4157,7 @@ const yi = async (a, t, e) => {
|
|
|
4122
4157
|
placement: x,
|
|
4123
4158
|
strategy: s,
|
|
4124
4159
|
middlewareData: u,
|
|
4125
|
-
rects:
|
|
4160
|
+
rects: h,
|
|
4126
4161
|
platform: r,
|
|
4127
4162
|
elements: {
|
|
4128
4163
|
reference: a,
|
|
@@ -4135,14 +4170,14 @@ const yi = async (a, t, e) => {
|
|
|
4135
4170
|
...u[w],
|
|
4136
4171
|
...b
|
|
4137
4172
|
}
|
|
4138
|
-
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (
|
|
4173
|
+
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
4139
4174
|
reference: a,
|
|
4140
4175
|
floating: t,
|
|
4141
4176
|
strategy: s
|
|
4142
4177
|
}) : C.rects), {
|
|
4143
4178
|
x: f,
|
|
4144
4179
|
y: d
|
|
4145
|
-
} =
|
|
4180
|
+
} = zt(h, x, l)), g = -1);
|
|
4146
4181
|
}
|
|
4147
4182
|
return {
|
|
4148
4183
|
x: f,
|
|
@@ -4152,7 +4187,7 @@ const yi = async (a, t, e) => {
|
|
|
4152
4187
|
middlewareData: u
|
|
4153
4188
|
};
|
|
4154
4189
|
};
|
|
4155
|
-
async function
|
|
4190
|
+
async function ne(a, t) {
|
|
4156
4191
|
var e;
|
|
4157
4192
|
t === void 0 && (t = {});
|
|
4158
4193
|
const {
|
|
@@ -4161,18 +4196,18 @@ async function re(a, t) {
|
|
|
4161
4196
|
platform: o,
|
|
4162
4197
|
rects: r,
|
|
4163
4198
|
elements: n,
|
|
4164
|
-
strategy:
|
|
4199
|
+
strategy: l
|
|
4165
4200
|
} = a, {
|
|
4166
|
-
boundary:
|
|
4201
|
+
boundary: h = "clippingAncestors",
|
|
4167
4202
|
rootBoundary: f = "viewport",
|
|
4168
4203
|
elementContext: d = "floating",
|
|
4169
4204
|
altBoundary: x = !1,
|
|
4170
4205
|
padding: u = 0
|
|
4171
|
-
} = at(t, a), y =
|
|
4206
|
+
} = at(t, a), y = oe(u), w = n[x ? d === "floating" ? "reference" : "floating" : d], p = ut(await o.getClippingRect({
|
|
4172
4207
|
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:
|
|
4208
|
+
boundary: h,
|
|
4174
4209
|
rootBoundary: f,
|
|
4175
|
-
strategy:
|
|
4210
|
+
strategy: l
|
|
4176
4211
|
})), E = d === "floating" ? {
|
|
4177
4212
|
x: i,
|
|
4178
4213
|
y: s,
|
|
@@ -4188,7 +4223,7 @@ async function re(a, t) {
|
|
|
4188
4223
|
elements: n,
|
|
4189
4224
|
rect: E,
|
|
4190
4225
|
offsetParent: m,
|
|
4191
|
-
strategy:
|
|
4226
|
+
strategy: l
|
|
4192
4227
|
}) : E);
|
|
4193
4228
|
return {
|
|
4194
4229
|
top: (p.top - C.top + y.top) / b.y,
|
|
@@ -4197,7 +4232,7 @@ async function re(a, t) {
|
|
|
4197
4232
|
right: (C.right - p.right + y.right) / b.x
|
|
4198
4233
|
};
|
|
4199
4234
|
}
|
|
4200
|
-
const
|
|
4235
|
+
const Ri = (a) => ({
|
|
4201
4236
|
name: "arrow",
|
|
4202
4237
|
options: a,
|
|
4203
4238
|
async fn(t) {
|
|
@@ -4208,20 +4243,20 @@ const mi = (a) => ({
|
|
|
4208
4243
|
rects: o,
|
|
4209
4244
|
platform: r,
|
|
4210
4245
|
elements: n,
|
|
4211
|
-
middlewareData:
|
|
4246
|
+
middlewareData: l
|
|
4212
4247
|
} = t, {
|
|
4213
|
-
element:
|
|
4248
|
+
element: h,
|
|
4214
4249
|
padding: f = 0
|
|
4215
4250
|
} = at(a, t) || {};
|
|
4216
|
-
if (
|
|
4251
|
+
if (h == null)
|
|
4217
4252
|
return {};
|
|
4218
|
-
const d =
|
|
4253
|
+
const d = oe(f), x = {
|
|
4219
4254
|
x: e,
|
|
4220
4255
|
y: i
|
|
4221
|
-
}, u = Ht(s), y = Mt(u), g = await r.getDimensions(
|
|
4256
|
+
}, 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
4257
|
let T = R ? R[m] : 0;
|
|
4223
4258
|
(!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 = !
|
|
4259
|
+
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
4260
|
return {
|
|
4226
4261
|
[u]: x[u] + F,
|
|
4227
4262
|
data: {
|
|
@@ -4234,7 +4269,7 @@ const mi = (a) => ({
|
|
|
4234
4269
|
reset: Y
|
|
4235
4270
|
};
|
|
4236
4271
|
}
|
|
4237
|
-
}),
|
|
4272
|
+
}), Ii = function(a) {
|
|
4238
4273
|
return a === void 0 && (a = {}), {
|
|
4239
4274
|
name: "flip",
|
|
4240
4275
|
options: a,
|
|
@@ -4245,8 +4280,8 @@ const mi = (a) => ({
|
|
|
4245
4280
|
middlewareData: o,
|
|
4246
4281
|
rects: r,
|
|
4247
4282
|
initialPlacement: n,
|
|
4248
|
-
platform:
|
|
4249
|
-
elements:
|
|
4283
|
+
platform: l,
|
|
4284
|
+
elements: h
|
|
4250
4285
|
} = t, {
|
|
4251
4286
|
mainAxis: f = !0,
|
|
4252
4287
|
crossAxis: d = !0,
|
|
@@ -4258,12 +4293,12 @@ const mi = (a) => ({
|
|
|
4258
4293
|
} = at(a, t);
|
|
4259
4294
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
4260
4295
|
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
|
|
4296
|
+
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";
|
|
4297
|
+
!x && R && C.push(...bi(n, g, y, b));
|
|
4298
|
+
const T = [n, ...C], L = await ne(t, w), A = [];
|
|
4264
4299
|
let D = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
4265
4300
|
if (f && A.push(L[p]), d) {
|
|
4266
|
-
const O =
|
|
4301
|
+
const O = yi(s, r, b);
|
|
4267
4302
|
A.push(L[O[0]], L[O[1]]);
|
|
4268
4303
|
}
|
|
4269
4304
|
if (D = [...D, {
|
|
@@ -4295,7 +4330,7 @@ const mi = (a) => ({
|
|
|
4295
4330
|
P === "y";
|
|
4296
4331
|
}
|
|
4297
4332
|
return !0;
|
|
4298
|
-
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P,
|
|
4333
|
+
}).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
4334
|
F && (Y = F);
|
|
4300
4335
|
break;
|
|
4301
4336
|
}
|
|
@@ -4314,12 +4349,12 @@ const mi = (a) => ({
|
|
|
4314
4349
|
}
|
|
4315
4350
|
};
|
|
4316
4351
|
};
|
|
4317
|
-
async function
|
|
4352
|
+
async function _i(a, t) {
|
|
4318
4353
|
const {
|
|
4319
4354
|
placement: e,
|
|
4320
4355
|
platform: i,
|
|
4321
4356
|
elements: s
|
|
4322
|
-
} = a, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = q(e), n = ct(e),
|
|
4357
|
+
} = 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
4358
|
let {
|
|
4324
4359
|
mainAxis: x,
|
|
4325
4360
|
crossAxis: u,
|
|
@@ -4333,15 +4368,15 @@ async function bi(a, t) {
|
|
|
4333
4368
|
crossAxis: d.crossAxis || 0,
|
|
4334
4369
|
alignmentAxis: d.alignmentAxis
|
|
4335
4370
|
};
|
|
4336
|
-
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y),
|
|
4371
|
+
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y), l ? {
|
|
4337
4372
|
x: u * f,
|
|
4338
|
-
y: x *
|
|
4373
|
+
y: x * h
|
|
4339
4374
|
} : {
|
|
4340
|
-
x: x *
|
|
4375
|
+
x: x * h,
|
|
4341
4376
|
y: u * f
|
|
4342
4377
|
};
|
|
4343
4378
|
}
|
|
4344
|
-
const
|
|
4379
|
+
const Oi = function(a) {
|
|
4345
4380
|
return a === void 0 && (a = 0), {
|
|
4346
4381
|
name: "offset",
|
|
4347
4382
|
options: a,
|
|
@@ -4352,18 +4387,18 @@ const Ci = function(a) {
|
|
|
4352
4387
|
y: o,
|
|
4353
4388
|
placement: r,
|
|
4354
4389
|
middlewareData: n
|
|
4355
|
-
} = t,
|
|
4390
|
+
} = t, l = await _i(t, a);
|
|
4356
4391
|
return r === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
|
|
4357
|
-
x: s +
|
|
4358
|
-
y: o +
|
|
4392
|
+
x: s + l.x,
|
|
4393
|
+
y: o + l.y,
|
|
4359
4394
|
data: {
|
|
4360
|
-
...
|
|
4395
|
+
...l,
|
|
4361
4396
|
placement: r
|
|
4362
4397
|
}
|
|
4363
4398
|
};
|
|
4364
4399
|
}
|
|
4365
4400
|
};
|
|
4366
|
-
},
|
|
4401
|
+
}, Si = function(a) {
|
|
4367
4402
|
return a === void 0 && (a = {}), {
|
|
4368
4403
|
name: "shift",
|
|
4369
4404
|
options: a,
|
|
@@ -4387,12 +4422,12 @@ const Ci = function(a) {
|
|
|
4387
4422
|
};
|
|
4388
4423
|
}
|
|
4389
4424
|
},
|
|
4390
|
-
...
|
|
4391
|
-
} = at(a, t),
|
|
4425
|
+
...l
|
|
4426
|
+
} = at(a, t), h = {
|
|
4392
4427
|
x: e,
|
|
4393
4428
|
y: i
|
|
4394
|
-
}, f = await
|
|
4395
|
-
let u =
|
|
4429
|
+
}, f = await ne(t, l), d = J(q(s)), x = re(d);
|
|
4430
|
+
let u = h[x], y = h[d];
|
|
4396
4431
|
if (o) {
|
|
4397
4432
|
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u + f[w], m = u - f[p];
|
|
4398
4433
|
u = _t(E, u, m);
|
|
@@ -4424,7 +4459,7 @@ function gt() {
|
|
|
4424
4459
|
return typeof window < "u";
|
|
4425
4460
|
}
|
|
4426
4461
|
function tt(a) {
|
|
4427
|
-
return
|
|
4462
|
+
return ae(a) ? (a.nodeName || "").toLowerCase() : "#document";
|
|
4428
4463
|
}
|
|
4429
4464
|
function H(a) {
|
|
4430
4465
|
var t;
|
|
@@ -4432,9 +4467,9 @@ function H(a) {
|
|
|
4432
4467
|
}
|
|
4433
4468
|
function K(a) {
|
|
4434
4469
|
var t;
|
|
4435
|
-
return (t = (
|
|
4470
|
+
return (t = (ae(a) ? a.ownerDocument : a.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4436
4471
|
}
|
|
4437
|
-
function
|
|
4472
|
+
function ae(a) {
|
|
4438
4473
|
return gt() ? a instanceof Node || a instanceof H(a).Node : !1;
|
|
4439
4474
|
}
|
|
4440
4475
|
function X(a) {
|
|
@@ -4443,10 +4478,10 @@ function X(a) {
|
|
|
4443
4478
|
function N(a) {
|
|
4444
4479
|
return gt() ? a instanceof HTMLElement || a instanceof H(a).HTMLElement : !1;
|
|
4445
4480
|
}
|
|
4446
|
-
function
|
|
4481
|
+
function $t(a) {
|
|
4447
4482
|
return !gt() || typeof ShadowRoot > "u" ? !1 : a instanceof ShadowRoot || a instanceof H(a).ShadowRoot;
|
|
4448
4483
|
}
|
|
4449
|
-
function
|
|
4484
|
+
function lt(a) {
|
|
4450
4485
|
const {
|
|
4451
4486
|
overflow: t,
|
|
4452
4487
|
overflowX: e,
|
|
@@ -4455,7 +4490,7 @@ function ht(a) {
|
|
|
4455
4490
|
} = k(a);
|
|
4456
4491
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
4457
4492
|
}
|
|
4458
|
-
function
|
|
4493
|
+
function Ti(a) {
|
|
4459
4494
|
return ["table", "td", "th"].includes(tt(a));
|
|
4460
4495
|
}
|
|
4461
4496
|
function wt(a) {
|
|
@@ -4471,7 +4506,7 @@ function Dt(a) {
|
|
|
4471
4506
|
const t = Xt(), e = X(a) ? k(a) : a;
|
|
4472
4507
|
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
4508
|
}
|
|
4474
|
-
function
|
|
4509
|
+
function Li(a) {
|
|
4475
4510
|
let t = z(a);
|
|
4476
4511
|
for (; N(t) && !Q(t); ) {
|
|
4477
4512
|
if (Dt(t))
|
|
@@ -4507,29 +4542,29 @@ function z(a) {
|
|
|
4507
4542
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
4508
4543
|
a.assignedSlot || // DOM Element detected.
|
|
4509
4544
|
a.parentNode || // ShadowRoot detected.
|
|
4510
|
-
|
|
4545
|
+
$t(a) && a.host || // Fallback.
|
|
4511
4546
|
K(a)
|
|
4512
4547
|
);
|
|
4513
|
-
return
|
|
4548
|
+
return $t(t) ? t.host : t;
|
|
4514
4549
|
}
|
|
4515
|
-
function
|
|
4550
|
+
function ce(a) {
|
|
4516
4551
|
const t = z(a);
|
|
4517
|
-
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) &&
|
|
4552
|
+
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) && lt(t) ? t : ce(t);
|
|
4518
4553
|
}
|
|
4519
4554
|
function St(a, t, e) {
|
|
4520
4555
|
var i;
|
|
4521
4556
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4522
|
-
const s =
|
|
4557
|
+
const s = ce(a), o = s === ((i = a.ownerDocument) == null ? void 0 : i.body), r = H(s);
|
|
4523
4558
|
if (o) {
|
|
4524
4559
|
const n = Tt(r);
|
|
4525
|
-
return t.concat(r, r.visualViewport || [],
|
|
4560
|
+
return t.concat(r, r.visualViewport || [], lt(s) ? s : [], n && e ? St(n) : []);
|
|
4526
4561
|
}
|
|
4527
4562
|
return t.concat(s, St(s, [], e));
|
|
4528
4563
|
}
|
|
4529
4564
|
function Tt(a) {
|
|
4530
4565
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
4531
4566
|
}
|
|
4532
|
-
function
|
|
4567
|
+
function le(a) {
|
|
4533
4568
|
const t = k(a);
|
|
4534
4569
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4535
4570
|
const s = N(a), o = s ? a.offsetWidth : e, r = s ? a.offsetHeight : i, n = ft(e) !== o || ft(i) !== r;
|
|
@@ -4539,58 +4574,58 @@ function ae(a) {
|
|
|
4539
4574
|
$: n
|
|
4540
4575
|
};
|
|
4541
4576
|
}
|
|
4542
|
-
function
|
|
4577
|
+
function he(a) {
|
|
4543
4578
|
return X(a) ? a : a.contextElement;
|
|
4544
4579
|
}
|
|
4545
4580
|
function Z(a) {
|
|
4546
|
-
const t =
|
|
4581
|
+
const t = he(a);
|
|
4547
4582
|
if (!N(t))
|
|
4548
4583
|
return V(1);
|
|
4549
4584
|
const e = t.getBoundingClientRect(), {
|
|
4550
4585
|
width: i,
|
|
4551
4586
|
height: s,
|
|
4552
4587
|
$: o
|
|
4553
|
-
} =
|
|
4588
|
+
} = le(t);
|
|
4554
4589
|
let r = (o ? ft(e.width) : e.width) / i, n = (o ? ft(e.height) : e.height) / s;
|
|
4555
4590
|
return (!r || !Number.isFinite(r)) && (r = 1), (!n || !Number.isFinite(n)) && (n = 1), {
|
|
4556
4591
|
x: r,
|
|
4557
4592
|
y: n
|
|
4558
4593
|
};
|
|
4559
4594
|
}
|
|
4560
|
-
const
|
|
4561
|
-
function
|
|
4595
|
+
const Ai = /* @__PURE__ */ V(0);
|
|
4596
|
+
function de(a) {
|
|
4562
4597
|
const t = H(a);
|
|
4563
|
-
return !Xt() || !t.visualViewport ?
|
|
4598
|
+
return !Xt() || !t.visualViewport ? Ai : {
|
|
4564
4599
|
x: t.visualViewport.offsetLeft,
|
|
4565
4600
|
y: t.visualViewport.offsetTop
|
|
4566
4601
|
};
|
|
4567
4602
|
}
|
|
4568
|
-
function
|
|
4603
|
+
function Mi(a, t, e) {
|
|
4569
4604
|
return t === void 0 && (t = !1), !e || t && e !== H(a) ? !1 : t;
|
|
4570
4605
|
}
|
|
4571
4606
|
function ot(a, t, e, i) {
|
|
4572
4607
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
4573
|
-
const s = a.getBoundingClientRect(), o =
|
|
4608
|
+
const s = a.getBoundingClientRect(), o = he(a);
|
|
4574
4609
|
let r = V(1);
|
|
4575
4610
|
t && (i ? X(i) && (r = Z(i)) : r = Z(a));
|
|
4576
|
-
const n =
|
|
4577
|
-
let
|
|
4611
|
+
const n = Mi(o, e, i) ? de(o) : V(0);
|
|
4612
|
+
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
4613
|
if (o) {
|
|
4579
4614
|
const x = H(o), u = i && X(i) ? H(i) : i;
|
|
4580
4615
|
let y = x, g = Tt(y);
|
|
4581
4616
|
for (; g && i && u !== y; ) {
|
|
4582
4617
|
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
|
-
|
|
4618
|
+
l *= w.x, h *= w.y, f *= w.x, d *= w.y, l += m, h += b, y = H(g), g = Tt(y);
|
|
4584
4619
|
}
|
|
4585
4620
|
}
|
|
4586
4621
|
return ut({
|
|
4587
4622
|
width: f,
|
|
4588
4623
|
height: d,
|
|
4589
|
-
x:
|
|
4590
|
-
y:
|
|
4624
|
+
x: l,
|
|
4625
|
+
y: h
|
|
4591
4626
|
});
|
|
4592
4627
|
}
|
|
4593
|
-
function
|
|
4628
|
+
function Hi(a) {
|
|
4594
4629
|
let {
|
|
4595
4630
|
elements: t,
|
|
4596
4631
|
rect: e,
|
|
@@ -4600,30 +4635,30 @@ function Si(a) {
|
|
|
4600
4635
|
const o = s === "fixed", r = K(i), n = t ? wt(t.floating) : !1;
|
|
4601
4636
|
if (i === r || n && o)
|
|
4602
4637
|
return e;
|
|
4603
|
-
let
|
|
4638
|
+
let l = {
|
|
4604
4639
|
scrollLeft: 0,
|
|
4605
4640
|
scrollTop: 0
|
|
4606
|
-
},
|
|
4641
|
+
}, h = V(1);
|
|
4607
4642
|
const f = V(0), d = N(i);
|
|
4608
|
-
if ((d || !d && !o) && ((tt(i) !== "body" ||
|
|
4643
|
+
if ((d || !d && !o) && ((tt(i) !== "body" || lt(r)) && (l = pt(i)), N(i))) {
|
|
4609
4644
|
const x = ot(i);
|
|
4610
|
-
|
|
4645
|
+
h = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4611
4646
|
}
|
|
4612
4647
|
return {
|
|
4613
|
-
width: e.width *
|
|
4614
|
-
height: e.height *
|
|
4615
|
-
x: e.x *
|
|
4616
|
-
y: e.y *
|
|
4648
|
+
width: e.width * h.x,
|
|
4649
|
+
height: e.height * h.y,
|
|
4650
|
+
x: e.x * h.x - l.scrollLeft * h.x + f.x,
|
|
4651
|
+
y: e.y * h.y - l.scrollTop * h.y + f.y
|
|
4617
4652
|
};
|
|
4618
4653
|
}
|
|
4619
|
-
function
|
|
4654
|
+
function Di(a) {
|
|
4620
4655
|
return Array.from(a.getClientRects());
|
|
4621
4656
|
}
|
|
4622
4657
|
function Lt(a, t) {
|
|
4623
4658
|
const e = pt(a).scrollLeft;
|
|
4624
4659
|
return t ? t.left + e : ot(K(a)).left + e;
|
|
4625
4660
|
}
|
|
4626
|
-
function
|
|
4661
|
+
function Xi(a) {
|
|
4627
4662
|
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
4663
|
let r = -e.scrollLeft + Lt(a);
|
|
4629
4664
|
const n = -e.scrollTop;
|
|
@@ -4634,40 +4669,40 @@ function Li(a) {
|
|
|
4634
4669
|
y: n
|
|
4635
4670
|
};
|
|
4636
4671
|
}
|
|
4637
|
-
function
|
|
4672
|
+
function ki(a, t) {
|
|
4638
4673
|
const e = H(a), i = K(a), s = e.visualViewport;
|
|
4639
|
-
let o = i.clientWidth, r = i.clientHeight, n = 0,
|
|
4674
|
+
let o = i.clientWidth, r = i.clientHeight, n = 0, l = 0;
|
|
4640
4675
|
if (s) {
|
|
4641
4676
|
o = s.width, r = s.height;
|
|
4642
|
-
const
|
|
4643
|
-
(!
|
|
4677
|
+
const h = Xt();
|
|
4678
|
+
(!h || h && t === "fixed") && (n = s.offsetLeft, l = s.offsetTop);
|
|
4644
4679
|
}
|
|
4645
4680
|
return {
|
|
4646
4681
|
width: o,
|
|
4647
4682
|
height: r,
|
|
4648
4683
|
x: n,
|
|
4649
|
-
y:
|
|
4684
|
+
y: l
|
|
4650
4685
|
};
|
|
4651
4686
|
}
|
|
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,
|
|
4687
|
+
function Fi(a, t) {
|
|
4688
|
+
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
4689
|
return {
|
|
4655
4690
|
width: r,
|
|
4656
4691
|
height: n,
|
|
4657
|
-
x:
|
|
4658
|
-
y:
|
|
4692
|
+
x: l,
|
|
4693
|
+
y: h
|
|
4659
4694
|
};
|
|
4660
4695
|
}
|
|
4661
|
-
function
|
|
4696
|
+
function qt(a, t, e) {
|
|
4662
4697
|
let i;
|
|
4663
4698
|
if (t === "viewport")
|
|
4664
|
-
i =
|
|
4699
|
+
i = ki(a, e);
|
|
4665
4700
|
else if (t === "document")
|
|
4666
|
-
i =
|
|
4701
|
+
i = Xi(K(a));
|
|
4667
4702
|
else if (X(t))
|
|
4668
|
-
i =
|
|
4703
|
+
i = Fi(t, e);
|
|
4669
4704
|
else {
|
|
4670
|
-
const s =
|
|
4705
|
+
const s = de(a);
|
|
4671
4706
|
i = {
|
|
4672
4707
|
...t,
|
|
4673
4708
|
x: t.x - s.x,
|
|
@@ -4676,11 +4711,11 @@ function zt(a, t, e) {
|
|
|
4676
4711
|
}
|
|
4677
4712
|
return ut(i);
|
|
4678
4713
|
}
|
|
4679
|
-
function
|
|
4714
|
+
function fe(a, t) {
|
|
4680
4715
|
const e = z(a);
|
|
4681
|
-
return e === t || !X(e) || Q(e) ? !1 : k(e).position === "fixed" ||
|
|
4716
|
+
return e === t || !X(e) || Q(e) ? !1 : k(e).position === "fixed" || fe(e, t);
|
|
4682
4717
|
}
|
|
4683
|
-
function
|
|
4718
|
+
function Ni(a, t) {
|
|
4684
4719
|
const e = t.get(a);
|
|
4685
4720
|
if (e)
|
|
4686
4721
|
return e;
|
|
@@ -4688,58 +4723,58 @@ function Hi(a, t) {
|
|
|
4688
4723
|
const o = k(a).position === "fixed";
|
|
4689
4724
|
let r = o ? z(a) : a;
|
|
4690
4725
|
for (; X(r) && !Q(r); ) {
|
|
4691
|
-
const n = k(r),
|
|
4692
|
-
!
|
|
4726
|
+
const n = k(r), l = Dt(r);
|
|
4727
|
+
!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
4728
|
}
|
|
4694
4729
|
return t.set(a, i), i;
|
|
4695
4730
|
}
|
|
4696
|
-
function
|
|
4731
|
+
function Yi(a) {
|
|
4697
4732
|
let {
|
|
4698
4733
|
element: t,
|
|
4699
4734
|
boundary: e,
|
|
4700
4735
|
rootBoundary: i,
|
|
4701
4736
|
strategy: s
|
|
4702
4737
|
} = a;
|
|
4703
|
-
const r = [...e === "clippingAncestors" ? wt(t) ? [] :
|
|
4704
|
-
const d =
|
|
4705
|
-
return
|
|
4706
|
-
},
|
|
4738
|
+
const r = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], n = r[0], l = r.reduce((h, f) => {
|
|
4739
|
+
const d = qt(t, f, s);
|
|
4740
|
+
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;
|
|
4741
|
+
}, qt(t, n, s));
|
|
4707
4742
|
return {
|
|
4708
|
-
width:
|
|
4709
|
-
height:
|
|
4710
|
-
x:
|
|
4711
|
-
y:
|
|
4743
|
+
width: l.right - l.left,
|
|
4744
|
+
height: l.bottom - l.top,
|
|
4745
|
+
x: l.left,
|
|
4746
|
+
y: l.top
|
|
4712
4747
|
};
|
|
4713
4748
|
}
|
|
4714
|
-
function
|
|
4749
|
+
function Ki(a) {
|
|
4715
4750
|
const {
|
|
4716
4751
|
width: t,
|
|
4717
4752
|
height: e
|
|
4718
|
-
} =
|
|
4753
|
+
} = le(a);
|
|
4719
4754
|
return {
|
|
4720
4755
|
width: t,
|
|
4721
4756
|
height: e
|
|
4722
4757
|
};
|
|
4723
4758
|
}
|
|
4724
|
-
function
|
|
4759
|
+
function Bi(a, t, e) {
|
|
4725
4760
|
const i = N(t), s = K(t), o = e === "fixed", r = ot(a, !0, o, t);
|
|
4726
4761
|
let n = {
|
|
4727
4762
|
scrollLeft: 0,
|
|
4728
4763
|
scrollTop: 0
|
|
4729
4764
|
};
|
|
4730
|
-
const
|
|
4765
|
+
const l = V(0);
|
|
4731
4766
|
if (i || !i && !o)
|
|
4732
|
-
if ((tt(t) !== "body" ||
|
|
4767
|
+
if ((tt(t) !== "body" || lt(s)) && (n = pt(t)), i) {
|
|
4733
4768
|
const u = ot(t, !0, o, t);
|
|
4734
|
-
|
|
4735
|
-
} else s && (
|
|
4736
|
-
let
|
|
4769
|
+
l.x = u.x + t.clientLeft, l.y = u.y + t.clientTop;
|
|
4770
|
+
} else s && (l.x = Lt(s));
|
|
4771
|
+
let h = 0, f = 0;
|
|
4737
4772
|
if (s && !i && !o) {
|
|
4738
4773
|
const u = s.getBoundingClientRect();
|
|
4739
|
-
f = u.top + n.scrollTop,
|
|
4774
|
+
f = u.top + n.scrollTop, h = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
4740
4775
|
Lt(s, u);
|
|
4741
4776
|
}
|
|
4742
|
-
const d = r.left + n.scrollLeft -
|
|
4777
|
+
const d = r.left + n.scrollLeft - l.x - h, x = r.top + n.scrollTop - l.y - f;
|
|
4743
4778
|
return {
|
|
4744
4779
|
x: d,
|
|
4745
4780
|
y: x,
|
|
@@ -4750,7 +4785,7 @@ function ki(a, t, e) {
|
|
|
4750
4785
|
function mt(a) {
|
|
4751
4786
|
return k(a).position === "static";
|
|
4752
4787
|
}
|
|
4753
|
-
function
|
|
4788
|
+
function Gt(a, t) {
|
|
4754
4789
|
if (!N(a) || k(a).position === "fixed")
|
|
4755
4790
|
return null;
|
|
4756
4791
|
if (t)
|
|
@@ -4758,7 +4793,7 @@ function $t(a, t) {
|
|
|
4758
4793
|
let e = a.offsetParent;
|
|
4759
4794
|
return K(a) === e && (e = e.ownerDocument.body), e;
|
|
4760
4795
|
}
|
|
4761
|
-
function
|
|
4796
|
+
function xe(a, t) {
|
|
4762
4797
|
const e = H(a);
|
|
4763
4798
|
if (wt(a))
|
|
4764
4799
|
return e;
|
|
@@ -4771,15 +4806,15 @@ function de(a, t) {
|
|
|
4771
4806
|
}
|
|
4772
4807
|
return e;
|
|
4773
4808
|
}
|
|
4774
|
-
let i =
|
|
4775
|
-
for (; i &&
|
|
4776
|
-
i =
|
|
4777
|
-
return i && Q(i) && mt(i) && !Dt(i) ? e : i ||
|
|
4809
|
+
let i = Gt(a, t);
|
|
4810
|
+
for (; i && Ti(i) && mt(i); )
|
|
4811
|
+
i = Gt(i, t);
|
|
4812
|
+
return i && Q(i) && mt(i) && !Dt(i) ? e : i || Li(a) || e;
|
|
4778
4813
|
}
|
|
4779
|
-
const
|
|
4780
|
-
const t = this.getOffsetParent ||
|
|
4814
|
+
const Wi = async function(a) {
|
|
4815
|
+
const t = this.getOffsetParent || xe, e = this.getDimensions, i = await e(a.floating);
|
|
4781
4816
|
return {
|
|
4782
|
-
reference:
|
|
4817
|
+
reference: Bi(a.reference, await t(a.floating), a.strategy),
|
|
4783
4818
|
floating: {
|
|
4784
4819
|
x: 0,
|
|
4785
4820
|
y: 0,
|
|
@@ -4788,34 +4823,34 @@ const Fi = async function(a) {
|
|
|
4788
4823
|
}
|
|
4789
4824
|
};
|
|
4790
4825
|
};
|
|
4791
|
-
function
|
|
4826
|
+
function Pi(a) {
|
|
4792
4827
|
return k(a).direction === "rtl";
|
|
4793
4828
|
}
|
|
4794
|
-
const
|
|
4795
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
4829
|
+
const Vi = {
|
|
4830
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Hi,
|
|
4796
4831
|
getDocumentElement: K,
|
|
4797
|
-
getClippingRect:
|
|
4798
|
-
getOffsetParent:
|
|
4799
|
-
getElementRects:
|
|
4800
|
-
getClientRects:
|
|
4801
|
-
getDimensions:
|
|
4832
|
+
getClippingRect: Yi,
|
|
4833
|
+
getOffsetParent: xe,
|
|
4834
|
+
getElementRects: Wi,
|
|
4835
|
+
getClientRects: Di,
|
|
4836
|
+
getDimensions: Ki,
|
|
4802
4837
|
getScale: Z,
|
|
4803
4838
|
isElement: X,
|
|
4804
|
-
isRTL:
|
|
4805
|
-
},
|
|
4839
|
+
isRTL: Pi
|
|
4840
|
+
}, ue = Oi, ge = Si, we = Ii, zi = Ri, pe = (a, t, e) => {
|
|
4806
4841
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
4807
|
-
platform:
|
|
4842
|
+
platform: Vi,
|
|
4808
4843
|
...e
|
|
4809
4844
|
}, o = {
|
|
4810
4845
|
...s.platform,
|
|
4811
4846
|
_c: i
|
|
4812
4847
|
};
|
|
4813
|
-
return
|
|
4848
|
+
return vi(a, t, {
|
|
4814
4849
|
...s,
|
|
4815
4850
|
platform: o
|
|
4816
4851
|
});
|
|
4817
4852
|
};
|
|
4818
|
-
let
|
|
4853
|
+
let $i = class {
|
|
4819
4854
|
constructor(t) {
|
|
4820
4855
|
c(this, "ctx");
|
|
4821
4856
|
c(this, "enable", !1);
|
|
@@ -4836,7 +4871,7 @@ let Bi = class {
|
|
|
4836
4871
|
borderRadius: "4px",
|
|
4837
4872
|
fontSize: "12px",
|
|
4838
4873
|
...o
|
|
4839
|
-
},
|
|
4874
|
+
}, l = {
|
|
4840
4875
|
position: "absolute",
|
|
4841
4876
|
width: "10px",
|
|
4842
4877
|
height: "10px",
|
|
@@ -4845,7 +4880,7 @@ let Bi = class {
|
|
|
4845
4880
|
transform: "rotate(45deg)",
|
|
4846
4881
|
zIndex: n.zIndex
|
|
4847
4882
|
};
|
|
4848
|
-
Object.assign(this.arrowEl.style,
|
|
4883
|
+
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
4884
|
}
|
|
4850
4885
|
init() {
|
|
4851
4886
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -4870,7 +4905,7 @@ let Bi = class {
|
|
|
4870
4905
|
return;
|
|
4871
4906
|
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
4907
|
const s = t.drawX + i.x, o = t.drawY + i.y;
|
|
4873
|
-
|
|
4908
|
+
pe({
|
|
4874
4909
|
getBoundingClientRect() {
|
|
4875
4910
|
return {
|
|
4876
4911
|
width: t.visibleWidth,
|
|
@@ -4885,12 +4920,12 @@ let Bi = class {
|
|
|
4885
4920
|
}
|
|
4886
4921
|
}, this.floatingEl, {
|
|
4887
4922
|
placement: t.overflowTooltipPlacement,
|
|
4888
|
-
middleware: [
|
|
4923
|
+
middleware: [ge(), we(), ue(6), zi({ element: this.arrowEl })]
|
|
4889
4924
|
}).then((n) => {
|
|
4890
|
-
const { x:
|
|
4925
|
+
const { x: l, y: h, placement: f, middlewareData: d } = n;
|
|
4891
4926
|
if (Object.assign(this.floatingEl.style, {
|
|
4892
|
-
top: `${
|
|
4893
|
-
left: `${
|
|
4927
|
+
top: `${h}px`,
|
|
4928
|
+
left: `${l}px`
|
|
4894
4929
|
}), d.arrow) {
|
|
4895
4930
|
const x = d.arrow;
|
|
4896
4931
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -4924,7 +4959,7 @@ let Bi = class {
|
|
|
4924
4959
|
this.contentEl.remove(), this.arrowEl.remove(), this.floatingEl.remove();
|
|
4925
4960
|
}
|
|
4926
4961
|
};
|
|
4927
|
-
class
|
|
4962
|
+
class qi {
|
|
4928
4963
|
constructor(t) {
|
|
4929
4964
|
c(this, "editorEl");
|
|
4930
4965
|
c(this, "inputEl");
|
|
@@ -4937,7 +4972,7 @@ class Wi {
|
|
|
4937
4972
|
this.ctx.on("onScroll", () => {
|
|
4938
4973
|
this.enable && this.doneEdit();
|
|
4939
4974
|
}), this.ctx.on("cellHeaderMousedown", () => {
|
|
4940
|
-
this.enable && this.doneEdit();
|
|
4975
|
+
this.enable && this.doneEdit(), this.cellTarget = null;
|
|
4941
4976
|
}), this.ctx.on("keydown", (t) => {
|
|
4942
4977
|
const e = t.key, i = t.ctrlKey, s = t.altKey, o = t.shiftKey, r = t.metaKey;
|
|
4943
4978
|
if (!(i || s || o || r || [
|
|
@@ -4989,8 +5024,8 @@ class Wi {
|
|
|
4989
5024
|
this.inputEl.textContent = `${n}
|
|
4990
5025
|
|
|
4991
5026
|
`;
|
|
4992
|
-
const
|
|
4993
|
-
|
|
5027
|
+
const l = window.getSelection();
|
|
5028
|
+
l == null || l.selectAllChildren(this.inputEl), l == null || l.collapseToEnd();
|
|
4994
5029
|
return;
|
|
4995
5030
|
}
|
|
4996
5031
|
(r.code === "Escape" || r.code === "Enter") && (r.preventDefault(), this.inputEl.blur());
|
|
@@ -5040,8 +5075,8 @@ class Wi {
|
|
|
5040
5075
|
return;
|
|
5041
5076
|
const e = t.getValue(), { width: i, height: s } = t, o = t.getDrawX(), r = t.getDrawY(), { CELL_PADDING: n } = this.ctx.config;
|
|
5042
5077
|
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
|
-
|
|
5078
|
+
const l = window.getSelection();
|
|
5079
|
+
l == null || l.selectAllChildren(this.inputEl), l == null || l.collapseToEnd();
|
|
5045
5080
|
}
|
|
5046
5081
|
doneEditByInput() {
|
|
5047
5082
|
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
@@ -5060,18 +5095,18 @@ class Wi {
|
|
|
5060
5095
|
e && !o && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5061
5096
|
}
|
|
5062
5097
|
editCell(t, e) {
|
|
5063
|
-
const i = this.ctx.body.renderRows.find((
|
|
5098
|
+
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
5064
5099
|
if (!i)
|
|
5065
5100
|
return;
|
|
5066
|
-
const s = i.cells.find((
|
|
5101
|
+
const s = i.cells.find((h) => h.colIndex === e);
|
|
5067
5102
|
if (!s)
|
|
5068
5103
|
return;
|
|
5069
5104
|
this.ctx.emit("setSelectorCell", s);
|
|
5070
5105
|
const o = this.ctx.focusCell;
|
|
5071
5106
|
if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
|
|
5072
5107
|
return;
|
|
5073
|
-
const { rowKey: r, key: n } = o,
|
|
5074
|
-
o && !
|
|
5108
|
+
const { rowKey: r, key: n } = o, l = this.ctx.database.getReadonly(r, n);
|
|
5109
|
+
o && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5075
5110
|
}
|
|
5076
5111
|
doneEdit() {
|
|
5077
5112
|
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 +5114,16 @@ class Wi {
|
|
|
5079
5114
|
destroy() {
|
|
5080
5115
|
}
|
|
5081
5116
|
}
|
|
5082
|
-
class
|
|
5117
|
+
class Gi {
|
|
5083
5118
|
constructor(t) {
|
|
5084
5119
|
c(this, "ctx");
|
|
5085
5120
|
c(this, "emptyEl");
|
|
5086
5121
|
this.ctx = t;
|
|
5087
5122
|
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:
|
|
5123
|
+
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
5124
|
if (i)
|
|
5090
5125
|
return;
|
|
5091
|
-
const f = n + (
|
|
5126
|
+
const f = n + (l + h) / 2, d = {
|
|
5092
5127
|
display: r === "empty" ? "block" : "none",
|
|
5093
5128
|
position: "absolute",
|
|
5094
5129
|
fontSize: "14px",
|
|
@@ -5105,7 +5140,7 @@ class Pi {
|
|
|
5105
5140
|
this.emptyEl.remove();
|
|
5106
5141
|
}
|
|
5107
5142
|
}
|
|
5108
|
-
class
|
|
5143
|
+
class ji {
|
|
5109
5144
|
constructor(t) {
|
|
5110
5145
|
c(this, "ctx");
|
|
5111
5146
|
this.ctx = t;
|
|
@@ -5125,9 +5160,9 @@ class Vi {
|
|
|
5125
5160
|
target: t,
|
|
5126
5161
|
config: { SCROLLER_TRACK_SIZE: e }
|
|
5127
5162
|
} = 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
|
|
5163
|
+
let l = [o, r, n];
|
|
5164
|
+
const { FOOTER_FIXED: h } = this.ctx.config;
|
|
5165
|
+
return h || (l = [o, r]), {
|
|
5131
5166
|
style: {
|
|
5132
5167
|
position: "absolute",
|
|
5133
5168
|
left: "0px",
|
|
@@ -5137,7 +5172,7 @@ class Vi {
|
|
|
5137
5172
|
width: `${i}px`,
|
|
5138
5173
|
height: `${s}px`
|
|
5139
5174
|
},
|
|
5140
|
-
views:
|
|
5175
|
+
views: l
|
|
5141
5176
|
};
|
|
5142
5177
|
}
|
|
5143
5178
|
getHeader() {
|
|
@@ -5146,9 +5181,9 @@ class Vi {
|
|
|
5146
5181
|
fixedRightWidth: e,
|
|
5147
5182
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5148
5183
|
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: n } = this.ctx.header;
|
|
5149
|
-
let
|
|
5184
|
+
let l = [], h = [], f = [];
|
|
5150
5185
|
n.forEach((w) => {
|
|
5151
|
-
w.render && (w.fixed === "left" ?
|
|
5186
|
+
w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ? f.push(w) : l.push(w));
|
|
5152
5187
|
});
|
|
5153
5188
|
const d = e - i, x = {
|
|
5154
5189
|
key: "left",
|
|
@@ -5160,7 +5195,7 @@ class Vi {
|
|
|
5160
5195
|
width: `${t}px`,
|
|
5161
5196
|
height: `${r}px`
|
|
5162
5197
|
},
|
|
5163
|
-
cells:
|
|
5198
|
+
cells: h
|
|
5164
5199
|
}, u = {
|
|
5165
5200
|
key: "center",
|
|
5166
5201
|
style: {
|
|
@@ -5171,7 +5206,7 @@ class Vi {
|
|
|
5171
5206
|
width: `${o - t - d}px`,
|
|
5172
5207
|
height: `${r}px`
|
|
5173
5208
|
},
|
|
5174
|
-
cells:
|
|
5209
|
+
cells: l
|
|
5175
5210
|
}, y = {
|
|
5176
5211
|
key: "right",
|
|
5177
5212
|
style: {
|
|
@@ -5207,8 +5242,8 @@ class Vi {
|
|
|
5207
5242
|
const {
|
|
5208
5243
|
fixedLeftWidth: o,
|
|
5209
5244
|
fixedRightWidth: r,
|
|
5210
|
-
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX:
|
|
5211
|
-
} = this.ctx, { visibleWidth:
|
|
5245
|
+
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: l }
|
|
5246
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: f } = this.ctx.body, d = r - n, x = {
|
|
5212
5247
|
key: "left",
|
|
5213
5248
|
style: {
|
|
5214
5249
|
position: "absolute",
|
|
@@ -5226,7 +5261,7 @@ class Vi {
|
|
|
5226
5261
|
top: `${0.5}px`,
|
|
5227
5262
|
left: `${o + 0.5}px`,
|
|
5228
5263
|
overflow: "hidden",
|
|
5229
|
-
width: `${
|
|
5264
|
+
width: `${h - o - d}px`,
|
|
5230
5265
|
height: `${f}px`
|
|
5231
5266
|
},
|
|
5232
5267
|
cells: t
|
|
@@ -5244,11 +5279,11 @@ class Vi {
|
|
|
5244
5279
|
};
|
|
5245
5280
|
return {
|
|
5246
5281
|
type: "body",
|
|
5247
|
-
class: `${
|
|
5282
|
+
class: `${l}-overlayer-body`,
|
|
5248
5283
|
style: {
|
|
5249
5284
|
position: "relative",
|
|
5250
5285
|
overflow: "hidden",
|
|
5251
|
-
width: `${
|
|
5286
|
+
width: `${h}px`,
|
|
5252
5287
|
height: `${f}px`
|
|
5253
5288
|
},
|
|
5254
5289
|
views: [x, u, y]
|
|
@@ -5265,7 +5300,7 @@ class Vi {
|
|
|
5265
5300
|
fixedLeftWidth: s,
|
|
5266
5301
|
fixedRightWidth: o,
|
|
5267
5302
|
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: n }
|
|
5268
|
-
} = this.ctx, { visibleWidth:
|
|
5303
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, f = o - r, d = {
|
|
5269
5304
|
key: "left",
|
|
5270
5305
|
style: {
|
|
5271
5306
|
position: "absolute",
|
|
@@ -5273,7 +5308,7 @@ class Vi {
|
|
|
5273
5308
|
left: `${0.5}px`,
|
|
5274
5309
|
overflow: "hidden",
|
|
5275
5310
|
width: `${s}px`,
|
|
5276
|
-
height: `${
|
|
5311
|
+
height: `${h}px`
|
|
5277
5312
|
},
|
|
5278
5313
|
cells: e
|
|
5279
5314
|
}, x = {
|
|
@@ -5283,8 +5318,8 @@ class Vi {
|
|
|
5283
5318
|
top: `${0.5}px`,
|
|
5284
5319
|
left: `${s + 0.5}px`,
|
|
5285
5320
|
overflow: "hidden",
|
|
5286
|
-
width: `${
|
|
5287
|
-
height: `${
|
|
5321
|
+
width: `${l - s - f}px`,
|
|
5322
|
+
height: `${h}px`
|
|
5288
5323
|
},
|
|
5289
5324
|
cells: t
|
|
5290
5325
|
}, u = {
|
|
@@ -5295,7 +5330,7 @@ class Vi {
|
|
|
5295
5330
|
right: `${0.5}px`,
|
|
5296
5331
|
overflow: "hidden",
|
|
5297
5332
|
width: `${f}px`,
|
|
5298
|
-
height: `${
|
|
5333
|
+
height: `${h}px`
|
|
5299
5334
|
},
|
|
5300
5335
|
cells: i
|
|
5301
5336
|
};
|
|
@@ -5305,14 +5340,14 @@ class Vi {
|
|
|
5305
5340
|
style: {
|
|
5306
5341
|
position: "relative",
|
|
5307
5342
|
overflow: "hidden",
|
|
5308
|
-
width: `${
|
|
5309
|
-
height: `${
|
|
5343
|
+
width: `${l}px`,
|
|
5344
|
+
height: `${h}px`
|
|
5310
5345
|
},
|
|
5311
5346
|
views: [d, x, u]
|
|
5312
5347
|
};
|
|
5313
5348
|
}
|
|
5314
5349
|
}
|
|
5315
|
-
class
|
|
5350
|
+
class Ui {
|
|
5316
5351
|
constructor(t) {
|
|
5317
5352
|
c(this, "ctx");
|
|
5318
5353
|
c(this, "contextMenuEl");
|
|
@@ -5322,8 +5357,8 @@ class zi {
|
|
|
5322
5357
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5323
5358
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5324
5359
|
e.preventDefault();
|
|
5325
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [n,
|
|
5326
|
-
|
|
5360
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [n, l] = s, { rowIndex: h, colIndex: f } = t;
|
|
5361
|
+
h >= n && h <= l && f >= o && f <= r || this.ctx.emit("setSelectorCell", t, e);
|
|
5327
5362
|
const x = {
|
|
5328
5363
|
getBoundingClientRect: () => ({
|
|
5329
5364
|
width: 0,
|
|
@@ -5337,9 +5372,9 @@ class zi {
|
|
|
5337
5372
|
}),
|
|
5338
5373
|
contextElement: document.body
|
|
5339
5374
|
};
|
|
5340
|
-
|
|
5375
|
+
pe(x, this.contextMenuEl, {
|
|
5341
5376
|
placement: "right-start",
|
|
5342
|
-
middleware: [
|
|
5377
|
+
middleware: [ue(), ge(), we()]
|
|
5343
5378
|
}).then(({ x: u, y }) => {
|
|
5344
5379
|
this.show(u, y);
|
|
5345
5380
|
});
|
|
@@ -5395,7 +5430,7 @@ class zi {
|
|
|
5395
5430
|
this.contextMenuEl.remove();
|
|
5396
5431
|
}
|
|
5397
5432
|
}
|
|
5398
|
-
class
|
|
5433
|
+
class Qi {
|
|
5399
5434
|
constructor(t, e) {
|
|
5400
5435
|
c(this, "targetContainer");
|
|
5401
5436
|
c(this, "target");
|
|
@@ -5412,7 +5447,7 @@ class Gi {
|
|
|
5412
5447
|
c(this, "overlayer");
|
|
5413
5448
|
c(this, "contextMenu");
|
|
5414
5449
|
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
|
|
5450
|
+
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
5451
|
}
|
|
5417
5452
|
draw() {
|
|
5418
5453
|
requestAnimationFrame(() => {
|
|
@@ -5476,8 +5511,8 @@ class Gi {
|
|
|
5476
5511
|
if (t && Array.isArray(s) && s.length) {
|
|
5477
5512
|
const [o] = s;
|
|
5478
5513
|
if (Array.isArray(o) && o.length) {
|
|
5479
|
-
const [r] = o, { rowKey: n, key:
|
|
5480
|
-
this.scrollToRowkey(n), this.scrollToColkey(
|
|
5514
|
+
const [r] = o, { rowKey: n, key: l } = r;
|
|
5515
|
+
this.scrollToRowkey(n), this.scrollToColkey(l);
|
|
5481
5516
|
}
|
|
5482
5517
|
}
|
|
5483
5518
|
i(s);
|
|
@@ -5502,7 +5537,7 @@ class Gi {
|
|
|
5502
5537
|
let o = [];
|
|
5503
5538
|
for (let r = 0; r < i.length; r++)
|
|
5504
5539
|
for (let n = 0; n < s.length; n++) {
|
|
5505
|
-
const
|
|
5540
|
+
const l = this.ctx.database.getRowKeyByItem(i[r]), f = s[n].key, d = await this.ctx.database.getValidator(l, f);
|
|
5506
5541
|
Array.isArray(d) && d.length && o.push(d);
|
|
5507
5542
|
}
|
|
5508
5543
|
o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
@@ -5564,6 +5599,6 @@ class Gi {
|
|
|
5564
5599
|
}
|
|
5565
5600
|
}
|
|
5566
5601
|
export {
|
|
5567
|
-
|
|
5602
|
+
Qi as default
|
|
5568
5603
|
};
|
|
5569
5604
|
//# sourceMappingURL=index.es.js.map
|