e-virt-table 1.1.5 → 1.1.7
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 +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +320 -291
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Body.d.ts +1 -0
- package/dist/lib/Body.js +22 -11
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Cell.js +71 -19
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/Config.d.ts +1 -0
- package/dist/lib/Config.js +7 -1
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Database.js +7 -4
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/Editor.js +19 -2
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/EventBrowser.js +1 -0
- package/dist/lib/EventBrowser.js.map +1 -1
- package/dist/lib/EventTable.d.ts +2 -0
- package/dist/lib/EventTable.js +34 -8
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -43,13 +43,13 @@ function dt(a, t, e) {
|
|
|
43
43
|
return o && st(c, o.prototype), c;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Ie(a) {
|
|
47
47
|
return Function.toString.call(a).indexOf("[native code]") !== -1;
|
|
48
48
|
}
|
|
49
49
|
function Ct(a) {
|
|
50
50
|
var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
51
51
|
return Ct = function(i) {
|
|
52
|
-
if (i === null || !
|
|
52
|
+
if (i === null || !Ie(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,7 +69,7 @@ function Ct(a) {
|
|
|
69
69
|
}), st(s, i);
|
|
70
70
|
}, Ct(a);
|
|
71
71
|
}
|
|
72
|
-
var
|
|
72
|
+
var _e = /%[sdj%]/g, jt = function() {
|
|
73
73
|
};
|
|
74
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) {
|
|
@@ -91,7 +91,7 @@ function D(a) {
|
|
|
91
91
|
if (typeof a == "function")
|
|
92
92
|
return a.apply(null, e);
|
|
93
93
|
if (typeof a == "string") {
|
|
94
|
-
var o = a.replace(
|
|
94
|
+
var o = a.replace(_e, function(n) {
|
|
95
95
|
if (n === "%%")
|
|
96
96
|
return "%";
|
|
97
97
|
if (s >= r)
|
|
@@ -221,8 +221,8 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
221
221
|
}, ct, De = function() {
|
|
222
222
|
if (ct)
|
|
223
223
|
return ct;
|
|
224
|
-
var a = "[a-fA-F\\d:]", t = function(
|
|
225
|
-
return
|
|
224
|
+
var a = "[a-fA-F\\d:]", t = function(C) {
|
|
225
|
+
return C && C.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 = (`
|
|
227
227
|
(?:
|
|
228
228
|
(?:` + i + ":){7}(?:" + i + `|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
@@ -234,16 +234,16 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
234
234
|
(?:` + i + ":){1}(?:(?::" + i + "){0,4}:" + e + "|(?::" + i + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
235
235
|
(?::(?:(?::` + i + "){0,5}:" + e + "|(?::" + i + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
236
236
|
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
237
|
-
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), n = new RegExp("^" + s + "$"), h = function(
|
|
238
|
-
return
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), n = new RegExp("^" + s + "$"), h = function(C) {
|
|
238
|
+
return C && C.exact ? r : new RegExp("(?:" + t(C) + e + t(C) + ")|(?:" + t(C) + s + t(C) + ")", "g");
|
|
239
239
|
};
|
|
240
240
|
h.v4 = function(m) {
|
|
241
241
|
return m && m.exact ? o : new RegExp("" + t(m) + e + t(m), "g");
|
|
242
242
|
}, h.v6 = function(m) {
|
|
243
243
|
return m && m.exact ? n : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var c = "(?:(?:[a-z]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = h.v4().source, x = h.v6().source, g = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", p = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", u = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?',
|
|
246
|
-
return ct = new RegExp("(?:^" +
|
|
245
|
+
var c = "(?:(?:[a-z]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = h.v4().source, x = h.v6().source, g = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", p = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", u = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?', E = "(?:" + c + "|www\\.)" + d + "(?:localhost|" + f + "|" + x + "|" + g + p + u + ")" + w + y;
|
|
246
|
+
return ct = new RegExp("(?:^" + E + "$)", "i"), ct;
|
|
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,}))$/,
|
|
@@ -315,7 +315,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
315
315
|
o.test(e) || s.push(D(r.messages.pattern.mismatch, t.fullField, e, t.pattern));
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
},
|
|
318
|
+
}, _ = {
|
|
319
319
|
required: Ut,
|
|
320
320
|
whitespace: He,
|
|
321
321
|
type: Fe,
|
|
@@ -327,7 +327,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
327
327
|
if (n) {
|
|
328
328
|
if (H(e, "string") && !t.required)
|
|
329
329
|
return i();
|
|
330
|
-
|
|
330
|
+
_.required(t, e, s, o, r, "string"), H(e, "string") || (_.type(t, e, s, o, r), _.range(t, e, s, o, r), _.pattern(t, e, s, o, r), t.whitespace === !0 && _.whitespace(t, e, s, o, r));
|
|
331
331
|
}
|
|
332
332
|
i(o);
|
|
333
333
|
}, Ke = function(t, e, i, s, r) {
|
|
@@ -335,7 +335,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
335
335
|
if (n) {
|
|
336
336
|
if (H(e) && !t.required)
|
|
337
337
|
return i();
|
|
338
|
-
|
|
338
|
+
_.required(t, e, s, o, r), e !== void 0 && _.type(t, e, s, o, r);
|
|
339
339
|
}
|
|
340
340
|
i(o);
|
|
341
341
|
}, Ye = function(t, e, i, s, r) {
|
|
@@ -343,7 +343,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
343
343
|
if (n) {
|
|
344
344
|
if (e === "" && (e = void 0), H(e) && !t.required)
|
|
345
345
|
return i();
|
|
346
|
-
|
|
346
|
+
_.required(t, e, s, o, r), e !== void 0 && (_.type(t, e, s, o, r), _.range(t, e, s, o, r));
|
|
347
347
|
}
|
|
348
348
|
i(o);
|
|
349
349
|
}, Ve = function(t, e, i, s, r) {
|
|
@@ -351,7 +351,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
351
351
|
if (n) {
|
|
352
352
|
if (H(e) && !t.required)
|
|
353
353
|
return i();
|
|
354
|
-
|
|
354
|
+
_.required(t, e, s, o, r), e !== void 0 && _.type(t, e, s, o, r);
|
|
355
355
|
}
|
|
356
356
|
i(o);
|
|
357
357
|
}, We = function(t, e, i, s, r) {
|
|
@@ -359,7 +359,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
359
359
|
if (n) {
|
|
360
360
|
if (H(e) && !t.required)
|
|
361
361
|
return i();
|
|
362
|
-
|
|
362
|
+
_.required(t, e, s, o, r), H(e) || _.type(t, e, s, o, r);
|
|
363
363
|
}
|
|
364
364
|
i(o);
|
|
365
365
|
}, Pe = function(t, e, i, s, r) {
|
|
@@ -367,7 +367,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
367
367
|
if (n) {
|
|
368
368
|
if (H(e) && !t.required)
|
|
369
369
|
return i();
|
|
370
|
-
|
|
370
|
+
_.required(t, e, s, o, r), e !== void 0 && (_.type(t, e, s, o, r), _.range(t, e, s, o, r));
|
|
371
371
|
}
|
|
372
372
|
i(o);
|
|
373
373
|
}, ze = function(t, e, i, s, r) {
|
|
@@ -375,7 +375,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
375
375
|
if (n) {
|
|
376
376
|
if (H(e) && !t.required)
|
|
377
377
|
return i();
|
|
378
|
-
|
|
378
|
+
_.required(t, e, s, o, r), e !== void 0 && (_.type(t, e, s, o, r), _.range(t, e, s, o, r));
|
|
379
379
|
}
|
|
380
380
|
i(o);
|
|
381
381
|
}, $e = function(t, e, i, s, r) {
|
|
@@ -383,7 +383,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
383
383
|
if (n) {
|
|
384
384
|
if (e == null && !t.required)
|
|
385
385
|
return i();
|
|
386
|
-
|
|
386
|
+
_.required(t, e, s, o, r, "array"), e != null && (_.type(t, e, s, o, r), _.range(t, e, s, o, r));
|
|
387
387
|
}
|
|
388
388
|
i(o);
|
|
389
389
|
}, Ge = function(t, e, i, s, r) {
|
|
@@ -391,7 +391,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
391
391
|
if (n) {
|
|
392
392
|
if (H(e) && !t.required)
|
|
393
393
|
return i();
|
|
394
|
-
|
|
394
|
+
_.required(t, e, s, o, r), e !== void 0 && _.type(t, e, s, o, r);
|
|
395
395
|
}
|
|
396
396
|
i(o);
|
|
397
397
|
}, qe = "enum", je = function(t, e, i, s, r) {
|
|
@@ -399,7 +399,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
399
399
|
if (n) {
|
|
400
400
|
if (H(e) && !t.required)
|
|
401
401
|
return i();
|
|
402
|
-
|
|
402
|
+
_.required(t, e, s, o, r), e !== void 0 && _[qe](t, e, s, o, r);
|
|
403
403
|
}
|
|
404
404
|
i(o);
|
|
405
405
|
}, Ue = function(t, e, i, s, r) {
|
|
@@ -407,7 +407,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
407
407
|
if (n) {
|
|
408
408
|
if (H(e, "string") && !t.required)
|
|
409
409
|
return i();
|
|
410
|
-
|
|
410
|
+
_.required(t, e, s, o, r), H(e, "string") || _.pattern(t, e, s, o, r);
|
|
411
411
|
}
|
|
412
412
|
i(o);
|
|
413
413
|
}, Ze = function(t, e, i, s, r) {
|
|
@@ -415,21 +415,21 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
415
415
|
if (n) {
|
|
416
416
|
if (H(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
|
-
if (
|
|
418
|
+
if (_.required(t, e, s, o, r), !H(e, "date")) {
|
|
419
419
|
var h;
|
|
420
|
-
e instanceof Date ? h = e : h = new Date(e),
|
|
420
|
+
e instanceof Date ? h = e : h = new Date(e), _.type(t, h, s, o, r), h && _.range(t, h.getTime(), s, o, r);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
i(o);
|
|
424
424
|
}, Je = function(t, e, i, s, r) {
|
|
425
425
|
var o = [], n = Array.isArray(e) ? "array" : typeof e;
|
|
426
|
-
|
|
426
|
+
_.required(t, e, s, o, r, n), i(o);
|
|
427
427
|
}, yt = function(t, e, i, s, r) {
|
|
428
428
|
var o = t.type, n = [], h = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
429
|
if (h) {
|
|
430
430
|
if (H(e, o) && !t.required)
|
|
431
431
|
return i();
|
|
432
|
-
|
|
432
|
+
_.required(t, e, s, n, r, o), H(e, o) || _.type(t, e, s, n, r);
|
|
433
433
|
}
|
|
434
434
|
i(n);
|
|
435
435
|
}, Qe = function(t, e, i, s, r) {
|
|
@@ -437,7 +437,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
437
437
|
if (n) {
|
|
438
438
|
if (H(e) && !t.required)
|
|
439
439
|
return i();
|
|
440
|
-
|
|
440
|
+
_.required(t, e, s, o, r);
|
|
441
441
|
}
|
|
442
442
|
i(o);
|
|
443
443
|
}, it = {
|
|
@@ -538,15 +538,15 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
538
538
|
return c && c(null, n), Promise.resolve(n);
|
|
539
539
|
function d(u) {
|
|
540
540
|
var w = [], y = {};
|
|
541
|
-
function C
|
|
542
|
-
if (Array.isArray(
|
|
541
|
+
function E(C) {
|
|
542
|
+
if (Array.isArray(C)) {
|
|
543
543
|
var b;
|
|
544
|
-
w = (b = w).concat.apply(b,
|
|
544
|
+
w = (b = w).concat.apply(b, C);
|
|
545
545
|
} else
|
|
546
|
-
w.push(
|
|
546
|
+
w.push(C);
|
|
547
547
|
}
|
|
548
548
|
for (var m = 0; m < u.length; m++)
|
|
549
|
-
|
|
549
|
+
E(u[m]);
|
|
550
550
|
w.length ? (y = bt(w), c(w, y)) : c(null, n);
|
|
551
551
|
}
|
|
552
552
|
if (h.messages) {
|
|
@@ -557,8 +557,8 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
557
557
|
var x = {}, g = h.keys || Object.keys(this.rules);
|
|
558
558
|
g.forEach(function(u) {
|
|
559
559
|
var w = o.rules[u], y = n[u];
|
|
560
|
-
w.forEach(function(
|
|
561
|
-
var m =
|
|
560
|
+
w.forEach(function(E) {
|
|
561
|
+
var m = E;
|
|
562
562
|
typeof m.transform == "function" && (n === i && (n = G({}, n)), y = n[u] = m.transform(y)), typeof m == "function" ? m = {
|
|
563
563
|
validator: m
|
|
564
564
|
} : m = G({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field = u, m.fullField = m.fullField || u, m.type = o.getType(m), x[u] = x[u] || [], x[u].push({
|
|
@@ -571,59 +571,59 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
571
571
|
});
|
|
572
572
|
var p = {};
|
|
573
573
|
return Ae(x, h, function(u, w) {
|
|
574
|
-
var y = u.rule,
|
|
575
|
-
|
|
576
|
-
function m(
|
|
574
|
+
var y = u.rule, E = (y.type === "object" || y.type === "array") && (typeof y.fields == "object" || typeof y.defaultField == "object");
|
|
575
|
+
E = E && (y.required || !y.required && u.value), y.field = u.field;
|
|
576
|
+
function m(v, O) {
|
|
577
577
|
return G({}, O, {
|
|
578
|
-
fullField: y.fullField + "." +
|
|
579
|
-
fullFields: y.fullFields ? [].concat(y.fullFields, [
|
|
578
|
+
fullField: y.fullField + "." + v,
|
|
579
|
+
fullFields: y.fullFields ? [].concat(y.fullFields, [v]) : [v]
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
|
-
function
|
|
583
|
-
|
|
584
|
-
var O = Array.isArray(
|
|
582
|
+
function C(v) {
|
|
583
|
+
v === void 0 && (v = []);
|
|
584
|
+
var O = Array.isArray(v) ? v : [v];
|
|
585
585
|
!h.suppressWarning && O.length && a.warning("async-validator:", O), O.length && y.message !== void 0 && (O = [].concat(y.message));
|
|
586
|
-
var
|
|
587
|
-
if (h.first &&
|
|
588
|
-
return p[y.field] = 1, w(
|
|
589
|
-
if (!
|
|
590
|
-
w(
|
|
586
|
+
var S = O.map(Nt(y, n));
|
|
587
|
+
if (h.first && S.length)
|
|
588
|
+
return p[y.field] = 1, w(S);
|
|
589
|
+
if (!E)
|
|
590
|
+
w(S);
|
|
591
591
|
else {
|
|
592
592
|
if (y.required && !u.value)
|
|
593
|
-
return y.message !== void 0 ?
|
|
594
|
-
var
|
|
595
|
-
y.defaultField && Object.keys(u.value).map(function(
|
|
596
|
-
|
|
597
|
-
}),
|
|
598
|
-
var
|
|
599
|
-
Object.keys(
|
|
600
|
-
var M =
|
|
601
|
-
|
|
593
|
+
return y.message !== void 0 ? S = [].concat(y.message).map(Nt(y, n)) : h.error && (S = [h.error(y, D(h.messages.required, y.field))]), w(S);
|
|
594
|
+
var I = {};
|
|
595
|
+
y.defaultField && Object.keys(u.value).map(function(L) {
|
|
596
|
+
I[L] = y.defaultField;
|
|
597
|
+
}), I = G({}, I, u.rule.fields);
|
|
598
|
+
var R = {};
|
|
599
|
+
Object.keys(I).forEach(function(L) {
|
|
600
|
+
var M = I[L], T = Array.isArray(M) ? M : [M];
|
|
601
|
+
R[L] = T.map(m.bind(null, L));
|
|
602
602
|
});
|
|
603
|
-
var A = new a(
|
|
604
|
-
A.messages(h.messages), u.rule.options && (u.rule.options.messages = h.messages, u.rule.options.error = h.error), A.validate(u.value, u.rule.options || h, function(
|
|
603
|
+
var A = new a(R);
|
|
604
|
+
A.messages(h.messages), u.rule.options && (u.rule.options.messages = h.messages, u.rule.options.error = h.error), A.validate(u.value, u.rule.options || h, function(L) {
|
|
605
605
|
var M = [];
|
|
606
|
-
|
|
606
|
+
S && S.length && M.push.apply(M, S), L && L.length && M.push.apply(M, L), w(M.length ? M : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
610
|
var b;
|
|
611
611
|
if (y.asyncValidator)
|
|
612
|
-
b = y.asyncValidator(y, u.value,
|
|
612
|
+
b = y.asyncValidator(y, u.value, C, u.source, h);
|
|
613
613
|
else if (y.validator) {
|
|
614
614
|
try {
|
|
615
|
-
b = y.validator(y, u.value,
|
|
616
|
-
} catch (
|
|
617
|
-
console.error == null || console.error(
|
|
618
|
-
throw
|
|
619
|
-
}, 0),
|
|
615
|
+
b = y.validator(y, u.value, C, u.source, h);
|
|
616
|
+
} catch (v) {
|
|
617
|
+
console.error == null || console.error(v), h.suppressValidatorError || setTimeout(function() {
|
|
618
|
+
throw v;
|
|
619
|
+
}, 0), C(v.message);
|
|
620
620
|
}
|
|
621
|
-
b === !0 ?
|
|
621
|
+
b === !0 ? C() : b === !1 ? C(typeof y.message == "function" ? y.message(y.fullField || y.field) : y.message || (y.fullField || y.field) + " fails") : b instanceof Array ? C(b) : b instanceof Error && C(b.message);
|
|
622
622
|
}
|
|
623
623
|
b && b.then && b.then(function() {
|
|
624
|
-
return
|
|
625
|
-
}, function(
|
|
626
|
-
return
|
|
624
|
+
return C();
|
|
625
|
+
}, function(v) {
|
|
626
|
+
return C(v);
|
|
627
627
|
});
|
|
628
628
|
}, function(u) {
|
|
629
629
|
d(u);
|
|
@@ -702,10 +702,10 @@ function te(a = [], t = 1, e = 0) {
|
|
|
702
702
|
};
|
|
703
703
|
});
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function It(a = []) {
|
|
706
706
|
let t = [];
|
|
707
707
|
return a.forEach((e) => {
|
|
708
|
-
e.children ? t = t.concat(
|
|
708
|
+
e.children ? t = t.concat(It(e.children)) : t.push(e);
|
|
709
709
|
}), t;
|
|
710
710
|
}
|
|
711
711
|
const Yt = /^(\r\n|\n\r|\r|\n)/, ei = /^[^\t\r\n]+/, Vt = /^\t/;
|
|
@@ -1048,30 +1048,35 @@ class Tt extends se {
|
|
|
1048
1048
|
STRIPE_COLOR: g
|
|
1049
1049
|
} = this.ctx.config;
|
|
1050
1050
|
if (this.cellType === "footer") {
|
|
1051
|
-
let
|
|
1051
|
+
let b = n, v = o;
|
|
1052
1052
|
if (typeof r == "function") {
|
|
1053
|
-
const
|
|
1053
|
+
const O = r, { backgroundColor: S, color: I } = O({
|
|
1054
1054
|
row: this.row,
|
|
1055
1055
|
rowIndex: this.rowIndex,
|
|
1056
1056
|
colIndex: this.colIndex,
|
|
1057
1057
|
column: this.column,
|
|
1058
1058
|
value: this.getValue()
|
|
1059
1059
|
}) || {};
|
|
1060
|
-
|
|
1060
|
+
S && (b = S), I && (v = I);
|
|
1061
1061
|
}
|
|
1062
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor =
|
|
1062
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = b, this.drawTextColor = v;
|
|
1063
1063
|
return;
|
|
1064
1064
|
}
|
|
1065
1065
|
let p = "transparent";
|
|
1066
1066
|
const u = this.ctx.focusCell, w = this.ctx.hoverCell;
|
|
1067
|
-
|
|
1068
|
-
|
|
1067
|
+
let y = this.rowIndex, E = this.rowIndex;
|
|
1068
|
+
if (this.rowspan !== 1 && (d || h)) {
|
|
1069
|
+
const b = this.getSpanInfo(), { yArr: v } = b;
|
|
1070
|
+
y = v[0], E = v[1];
|
|
1071
|
+
}
|
|
1072
|
+
d && w && (w.rowKey === this.rowKey && (p = f), w.rowIndex >= y && w.rowIndex <= E && (p = f)), h && u && (u.rowKey === this.rowKey && (p = c), u.rowIndex >= y && u.rowIndex <= E && (p = c)), this.drawCellSkyBgColor = p;
|
|
1073
|
+
let m = e, C = o;
|
|
1069
1074
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
1070
1075
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
1071
1076
|
return;
|
|
1072
1077
|
}
|
|
1073
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (
|
|
1074
|
-
const
|
|
1078
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (m = i, C = o), x && (this.rowIndex % 2 ? m = g : m = e), typeof s == "function") {
|
|
1079
|
+
const b = s, { backgroundColor: v, color: O } = b({
|
|
1075
1080
|
row: this.row,
|
|
1076
1081
|
rowIndex: this.rowIndex,
|
|
1077
1082
|
colIndex: this.colIndex,
|
|
@@ -1079,9 +1084,9 @@ class Tt extends se {
|
|
|
1079
1084
|
isHasChanged: this.isHasChanged,
|
|
1080
1085
|
value: this.getValue()
|
|
1081
1086
|
}) || {};
|
|
1082
|
-
|
|
1087
|
+
v && (m = v), O && (C = O);
|
|
1083
1088
|
}
|
|
1084
|
-
this.drawCellBgColor =
|
|
1089
|
+
this.drawCellBgColor = m, this.drawTextColor = C;
|
|
1085
1090
|
}
|
|
1086
1091
|
updateSelection() {
|
|
1087
1092
|
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex: h, rowKey: c } = this;
|
|
@@ -1092,21 +1097,31 @@ class Tt extends se {
|
|
|
1092
1097
|
}
|
|
1093
1098
|
}
|
|
1094
1099
|
updateHoverIcon() {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1100
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key))
|
|
1101
|
+
return;
|
|
1102
|
+
const { BODY_CELL_HOVER_ICON_METHOD: i, CELL_HOVER_ICON_SIZE: s, CELL_PADDING: r, ENABLE_MERGE_CELL_LINK: o } = this.ctx.config;
|
|
1103
|
+
if (typeof i == "function") {
|
|
1104
|
+
const c = i({
|
|
1098
1105
|
row: this.row,
|
|
1099
1106
|
rowIndex: this.rowIndex,
|
|
1100
1107
|
colIndex: this.colIndex,
|
|
1101
1108
|
column: this.column,
|
|
1102
1109
|
value: this.getValue()
|
|
1103
1110
|
});
|
|
1104
|
-
|
|
1111
|
+
c !== void 0 && (this.hoverIconName = c);
|
|
1105
1112
|
}
|
|
1106
|
-
const
|
|
1107
|
-
if (this.hoverIconName && this.ctx.
|
|
1108
|
-
|
|
1109
|
-
this.
|
|
1113
|
+
const { hoverCell: n } = this.ctx;
|
|
1114
|
+
if (this.hoverIconName && !this.ctx.editing && n) {
|
|
1115
|
+
let h = 0, c = 0;
|
|
1116
|
+
if (n.rowKey === this.rowKey && (h = this.drawX + this.width - s - r, c = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && o) {
|
|
1117
|
+
const f = this.getSpanInfo(), { yArr: x } = f, g = x[0], p = x[1];
|
|
1118
|
+
if (n.rowIndex >= g && n.rowIndex <= p) {
|
|
1119
|
+
const { width: u, height: w, offsetTop: y, offsetLeft: E } = f;
|
|
1120
|
+
h = this.drawX - E + u - s - r, c = this.drawY - y + (w - s) / 2;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
const d = this.ctx.icons.get(this.hoverIconName);
|
|
1124
|
+
this.drawImageX = h, this.drawImageY = c, this.drawImageWidth = s, this.drawImageHeight = s, this.drawImageName = this.hoverIconName, this.drawImageSource = d;
|
|
1110
1125
|
}
|
|
1111
1126
|
}
|
|
1112
1127
|
// 过去跨度配置
|
|
@@ -1228,21 +1243,17 @@ class Tt extends se {
|
|
|
1228
1243
|
return s;
|
|
1229
1244
|
}
|
|
1230
1245
|
drawText() {
|
|
1231
|
-
const { CELL_PADDING: e, BODY_FONT: i } = this.ctx.config, { ellipsis:
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
verticalAlign: this.verticalAlign,
|
|
1243
|
-
color: this.drawTextColor
|
|
1244
|
-
}
|
|
1245
|
-
);
|
|
1246
|
+
const { CELL_PADDING: e, BODY_FONT: i, PLACEHOLDER_COLOR: s } = this.ctx.config, { ellipsis: r } = this.ctx.paint.handleEllipsis(this.text, this.width, e, i);
|
|
1247
|
+
this.ellipsis = r;
|
|
1248
|
+
const { placeholder: o } = this.column;
|
|
1249
|
+
let n = this.displayText, h = this.drawTextColor;
|
|
1250
|
+
return !this.ctx.database.getReadonly(this.rowKey, this.key) && o && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (n = o, h = s), this.ctx.paint.drawText(n, this.drawTextX, this.drawTextY, this.visibleWidth, this.visibleHeight, {
|
|
1251
|
+
font: i,
|
|
1252
|
+
padding: e,
|
|
1253
|
+
align: this.align,
|
|
1254
|
+
verticalAlign: this.verticalAlign,
|
|
1255
|
+
color: h
|
|
1256
|
+
});
|
|
1246
1257
|
}
|
|
1247
1258
|
drawImage() {
|
|
1248
1259
|
this.drawImageSource && this.ctx.paint.drawImage(
|
|
@@ -1312,10 +1323,10 @@ class Tt extends se {
|
|
|
1312
1323
|
drawBorder(e) {
|
|
1313
1324
|
const { drawX: i, drawY: s, rowIndex: r, colIndex: o, height: n, width: h } = this;
|
|
1314
1325
|
let c = i, d = s;
|
|
1315
|
-
const { xArr: f, yArr: x, lineDash: g = [], borderWidth: p = 1, borderColor: u, fillColor: w } = e, y = f[0],
|
|
1316
|
-
if (o >= y && o <=
|
|
1317
|
-
const b = o ===
|
|
1318
|
-
this.ctx.paint.drawLine([c +
|
|
1326
|
+
const { xArr: f, yArr: x, lineDash: g = [], borderWidth: p = 1, borderColor: u, fillColor: w } = e, y = f[0], E = f[1], m = x[0], C = x[1];
|
|
1327
|
+
if (o >= y && o <= E && r === m) {
|
|
1328
|
+
const b = o === E ? 1 : 0, v = o === y ? 1 : 0;
|
|
1329
|
+
this.ctx.paint.drawLine([c + v, d + 1, c + h - b, d + 1], {
|
|
1319
1330
|
borderColor: u,
|
|
1320
1331
|
fillColor: w,
|
|
1321
1332
|
borderWidth: p,
|
|
@@ -1324,9 +1335,9 @@ class Tt extends se {
|
|
|
1324
1335
|
lineDash: g
|
|
1325
1336
|
});
|
|
1326
1337
|
}
|
|
1327
|
-
if (o ===
|
|
1328
|
-
const b = r === m ? 1 : 0,
|
|
1329
|
-
this.ctx.paint.drawLine([c + h - 1, d + b, c + h - 1, d + n -
|
|
1338
|
+
if (o === E && r >= m && r <= C) {
|
|
1339
|
+
const b = r === m ? 1 : 0, v = r === C ? 1 : 0;
|
|
1340
|
+
this.ctx.paint.drawLine([c + h - 1, d + b, c + h - 1, d + n - v], {
|
|
1330
1341
|
borderColor: u,
|
|
1331
1342
|
fillColor: w,
|
|
1332
1343
|
borderWidth: p,
|
|
@@ -1335,9 +1346,9 @@ class Tt extends se {
|
|
|
1335
1346
|
lineDash: g
|
|
1336
1347
|
});
|
|
1337
1348
|
}
|
|
1338
|
-
if (o >= y && o <=
|
|
1339
|
-
const b = o ===
|
|
1340
|
-
this.ctx.paint.drawLine([c +
|
|
1349
|
+
if (o >= y && o <= E && r === C) {
|
|
1350
|
+
const b = o === E ? 1 : 0, v = o === y ? 1 : 0;
|
|
1351
|
+
this.ctx.paint.drawLine([c + v, d + n - 1, c + h - b, d + n - 1], {
|
|
1341
1352
|
borderColor: u,
|
|
1342
1353
|
fillColor: w,
|
|
1343
1354
|
borderWidth: p,
|
|
@@ -1346,9 +1357,9 @@ class Tt extends se {
|
|
|
1346
1357
|
lineDash: g
|
|
1347
1358
|
});
|
|
1348
1359
|
}
|
|
1349
|
-
if (o === y && r >= m && r <=
|
|
1350
|
-
const b = r ===
|
|
1351
|
-
this.ctx.paint.drawLine([c + 1, d +
|
|
1360
|
+
if (o === y && r >= m && r <= C) {
|
|
1361
|
+
const b = r === C ? 1 : 0, v = r === m ? 1 : 0;
|
|
1362
|
+
this.ctx.paint.drawLine([c + 1, d + v, c + 1, d + n - b], {
|
|
1352
1363
|
borderColor: u,
|
|
1353
1364
|
fillColor: w,
|
|
1354
1365
|
borderWidth: p,
|
|
@@ -1394,7 +1405,7 @@ class ni {
|
|
|
1394
1405
|
init() {
|
|
1395
1406
|
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear(), this.itemRowKeyMap = /* @__PURE__ */ new WeakMap();
|
|
1396
1407
|
const { ROW_KEY: t, ENABLE_RESERVE_SELECTION: e } = this.ctx.config;
|
|
1397
|
-
e && t || this.selectionMap.clear(), this.initData(this.data), this.getData();
|
|
1408
|
+
e && t || this.selectionMap.clear(), this.initData(this.data), this.getData(), this.bufferCheckState.buffer = !1;
|
|
1398
1409
|
}
|
|
1399
1410
|
/**
|
|
1400
1411
|
* 清除缓存数据
|
|
@@ -1419,8 +1430,8 @@ class ni {
|
|
|
1419
1430
|
if (typeof c == "function" && (u = c), d) {
|
|
1420
1431
|
const y = i[d];
|
|
1421
1432
|
if (this.checkboxKeyMap.has(y)) {
|
|
1422
|
-
const
|
|
1423
|
-
|
|
1433
|
+
const E = this.checkboxKeyMap.get(y) || [];
|
|
1434
|
+
E.push(x), this.checkboxKeyMap.set(y, E);
|
|
1424
1435
|
} else
|
|
1425
1436
|
this.checkboxKeyMap.set(y, [x]);
|
|
1426
1437
|
}
|
|
@@ -1852,11 +1863,7 @@ class ni {
|
|
|
1852
1863
|
*/
|
|
1853
1864
|
setRowSelection(t, e, i = !0) {
|
|
1854
1865
|
const s = this.selectionMap.get(t);
|
|
1855
|
-
|
|
1856
|
-
return;
|
|
1857
|
-
s.check = e, this.setRowSelectionByCheckboxKey(t, s.check);
|
|
1858
|
-
const r = this.getSelectionRows();
|
|
1859
|
-
this.ctx.emit("setRowSelection", r), i && (this.bufferCheckState.buffer = !1, this.ctx.emit("draw"));
|
|
1866
|
+
s && (s.check = e, this.setRowSelectionByCheckboxKey(t, s.check), this.ctx.emit("setRowSelection", e, s.row), i && (this.bufferCheckState.buffer = !1, this.ctx.emit("draw")));
|
|
1860
1867
|
}
|
|
1861
1868
|
getSelectionRows() {
|
|
1862
1869
|
let t = [];
|
|
@@ -2027,7 +2034,10 @@ class ni {
|
|
|
2027
2034
|
const { DISABLED: i } = this.ctx.config;
|
|
2028
2035
|
if (i)
|
|
2029
2036
|
return !0;
|
|
2030
|
-
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e)
|
|
2037
|
+
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e);
|
|
2038
|
+
if (!s || !r)
|
|
2039
|
+
return !0;
|
|
2040
|
+
const o = s.readonly, n = r.readonly, { BODY_CELL_READONLY_METHOD: h } = this.ctx.config;
|
|
2031
2041
|
if (typeof h == "function" && r) {
|
|
2032
2042
|
const d = h({
|
|
2033
2043
|
row: s.item,
|
|
@@ -2143,43 +2153,43 @@ class ni {
|
|
|
2143
2153
|
}
|
|
2144
2154
|
]
|
|
2145
2155
|
};
|
|
2146
|
-
let w = e, y = e,
|
|
2156
|
+
let w = e, y = e, E = n, m = n, C = [], b = 0, v = 0, O = 0, S = 0;
|
|
2147
2157
|
if (d !== 1 && p) {
|
|
2148
|
-
|
|
2149
|
-
const
|
|
2150
|
-
const
|
|
2151
|
-
return `${
|
|
2158
|
+
S = x;
|
|
2159
|
+
const I = h.reduce((R, A) => {
|
|
2160
|
+
const L = this.getItemValue(s, A) ?? "";
|
|
2161
|
+
return `${R}${L}`;
|
|
2152
2162
|
}, "");
|
|
2153
|
-
for (let
|
|
2154
|
-
const A = this.rowIndexRowKeyMap.get(
|
|
2163
|
+
for (let R = e - 1; R >= 0; R--) {
|
|
2164
|
+
const A = this.rowIndexRowKeyMap.get(R) || "", L = h.reduce((M, T) => {
|
|
2155
2165
|
const N = this.getItemValue(A, T) ?? "";
|
|
2156
2166
|
return `${M}${N}`;
|
|
2157
2167
|
}, "");
|
|
2158
|
-
if (
|
|
2159
|
-
w =
|
|
2168
|
+
if (I === L)
|
|
2169
|
+
w = R;
|
|
2160
2170
|
else
|
|
2161
2171
|
break;
|
|
2162
2172
|
}
|
|
2163
|
-
for (let
|
|
2164
|
-
const A = this.rowIndexRowKeyMap.get(
|
|
2173
|
+
for (let R = e; R <= this.ctx.maxRowIndex; R++) {
|
|
2174
|
+
const A = this.rowIndexRowKeyMap.get(R) || "", L = h.reduce((M, T) => {
|
|
2165
2175
|
const N = this.getItemValue(A, T) ?? "";
|
|
2166
2176
|
return `${M}${N}`;
|
|
2167
2177
|
}, "");
|
|
2168
|
-
if (
|
|
2169
|
-
y =
|
|
2178
|
+
if (I === L)
|
|
2179
|
+
y = R;
|
|
2170
2180
|
else
|
|
2171
2181
|
break;
|
|
2172
2182
|
}
|
|
2173
|
-
for (let
|
|
2174
|
-
const { height: A } = this.positions[
|
|
2183
|
+
for (let R = w; R < e; R++) {
|
|
2184
|
+
const { height: A } = this.positions[R];
|
|
2175
2185
|
b += A;
|
|
2176
2186
|
}
|
|
2177
|
-
for (let
|
|
2178
|
-
const { height: A } = this.positions[
|
|
2187
|
+
for (let R = w; R <= y; R++) {
|
|
2188
|
+
const { height: A } = this.positions[R];
|
|
2179
2189
|
O += A;
|
|
2180
|
-
const
|
|
2181
|
-
|
|
2182
|
-
rowKey:
|
|
2190
|
+
const L = this.rowIndexRowKeyMap.get(R) || "", { item: M } = this.rowKeyMap.get(L), T = this.getItemValue(L, i);
|
|
2191
|
+
C.push({
|
|
2192
|
+
rowKey: L,
|
|
2183
2193
|
key: i,
|
|
2184
2194
|
value: T,
|
|
2185
2195
|
row: M
|
|
@@ -2188,54 +2198,54 @@ class ni {
|
|
|
2188
2198
|
}
|
|
2189
2199
|
if (g !== 1 && u) {
|
|
2190
2200
|
O = f;
|
|
2191
|
-
for (let
|
|
2192
|
-
const
|
|
2193
|
-
if (!
|
|
2201
|
+
for (let I = n - 1; I >= 0; I--) {
|
|
2202
|
+
const R = this.getColumnByColIndex(I);
|
|
2203
|
+
if (!R)
|
|
2194
2204
|
break;
|
|
2195
|
-
const A = this.getItemValue(s, i),
|
|
2196
|
-
if (A ===
|
|
2197
|
-
|
|
2205
|
+
const A = this.getItemValue(s, i), L = this.getItemValue(s, R.key);
|
|
2206
|
+
if (A === L && c.includes(R.key))
|
|
2207
|
+
E = I;
|
|
2198
2208
|
else
|
|
2199
2209
|
break;
|
|
2200
2210
|
}
|
|
2201
|
-
for (let
|
|
2202
|
-
const
|
|
2203
|
-
if (!
|
|
2211
|
+
for (let I = n; I <= this.ctx.maxColIndex; I++) {
|
|
2212
|
+
const R = this.getColumnByColIndex(I);
|
|
2213
|
+
if (!R)
|
|
2204
2214
|
break;
|
|
2205
|
-
const A = this.getItemValue(s, i),
|
|
2206
|
-
if (A ===
|
|
2207
|
-
m =
|
|
2215
|
+
const A = this.getItemValue(s, i), L = this.getItemValue(s, R.key);
|
|
2216
|
+
if (A === L && c.includes(R.key))
|
|
2217
|
+
m = I;
|
|
2208
2218
|
else
|
|
2209
2219
|
break;
|
|
2210
2220
|
}
|
|
2211
|
-
for (let
|
|
2212
|
-
const
|
|
2213
|
-
if (!
|
|
2221
|
+
for (let I = E; I < n; I++) {
|
|
2222
|
+
const R = this.getColumnByColIndex(I);
|
|
2223
|
+
if (!R)
|
|
2214
2224
|
break;
|
|
2215
|
-
|
|
2225
|
+
v += R.width || 100;
|
|
2216
2226
|
}
|
|
2217
|
-
for (let
|
|
2218
|
-
const
|
|
2219
|
-
if (!
|
|
2227
|
+
for (let I = E; I <= m; I++) {
|
|
2228
|
+
const R = this.getColumnByColIndex(I);
|
|
2229
|
+
if (!R)
|
|
2220
2230
|
break;
|
|
2221
|
-
|
|
2231
|
+
S += R.width || 100, C.push({
|
|
2222
2232
|
rowKey: s,
|
|
2223
|
-
key:
|
|
2224
|
-
value: this.getItemValue(s,
|
|
2233
|
+
key: R.key,
|
|
2234
|
+
value: this.getItemValue(s, R.key),
|
|
2225
2235
|
row: r
|
|
2226
2236
|
});
|
|
2227
2237
|
}
|
|
2228
2238
|
}
|
|
2229
2239
|
return {
|
|
2230
|
-
xArr: [
|
|
2240
|
+
xArr: [E, m],
|
|
2231
2241
|
yArr: [w, y],
|
|
2232
2242
|
rowspan: d,
|
|
2233
2243
|
colspan: g,
|
|
2234
2244
|
height: O,
|
|
2235
|
-
width:
|
|
2245
|
+
width: S,
|
|
2236
2246
|
offsetTop: b,
|
|
2237
|
-
offsetLeft:
|
|
2238
|
-
dataList:
|
|
2247
|
+
offsetLeft: v,
|
|
2248
|
+
dataList: C
|
|
2239
2249
|
};
|
|
2240
2250
|
}
|
|
2241
2251
|
setLoading(t) {
|
|
@@ -2360,7 +2370,7 @@ class li {
|
|
|
2360
2370
|
this.ctx.emit("resetHeader", t), this.ctx.emit("resize", t);
|
|
2361
2371
|
}
|
|
2362
2372
|
handleMouseDown(t) {
|
|
2363
|
-
t.button === 0 && (this.ctx.mousedown = !0), this.ctx.emit("mousedown", t);
|
|
2373
|
+
t.button === 0 && (this.ctx.mousedown = !0), this.ctx.containerElement.focus(), this.ctx.emit("mousedown", t);
|
|
2364
2374
|
}
|
|
2365
2375
|
handleMousemove(t) {
|
|
2366
2376
|
this.ctx.emit("mousemove", t);
|
|
@@ -2595,6 +2605,7 @@ class Wt {
|
|
|
2595
2605
|
l(this, "WIDTH", 0);
|
|
2596
2606
|
l(this, "RESIZE_MIN_WIDTH", 40);
|
|
2597
2607
|
l(this, "HEIGHT", 0);
|
|
2608
|
+
l(this, "PLACEHOLDER_COLOR", "#CDD0DC");
|
|
2598
2609
|
l(this, "EMPTY_BODY_HEIGHT", 120);
|
|
2599
2610
|
l(this, "EMPTY_CUSTOM_STYLE", {});
|
|
2600
2611
|
l(this, "EMPTY_TEXT", "暂无数据");
|
|
@@ -2648,7 +2659,7 @@ class Wt {
|
|
|
2648
2659
|
l(this, "FOOTER_FIXED", !0);
|
|
2649
2660
|
l(this, "FOOTER_POSITION", "bottom");
|
|
2650
2661
|
l(this, "CELL_FOOTER_HEIGHT", 36);
|
|
2651
|
-
l(this, "ENABLE_SELECTOR", !
|
|
2662
|
+
l(this, "ENABLE_SELECTOR", !0);
|
|
2652
2663
|
l(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
2653
2664
|
// 启用单点击立马编辑
|
|
2654
2665
|
l(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
@@ -2993,7 +3004,7 @@ class fi {
|
|
|
2993
3004
|
this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
|
|
2994
3005
|
this.ctx.clickCellHeader = s, this.ctx.emit("cellHeaderClick", s, t), this.selectionClick(s);
|
|
2995
3006
|
}), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
|
|
2996
|
-
this.ctx.clickCell = s, this.ctx.emit("cellClick", s, t), this.selectionClick(s), this.treeClick(s);
|
|
3007
|
+
this.ctx.clickCell = s, this.ctx.emit("cellClick", s, t), this.selectionClick(s), this.treeClick(s), this.hoverIconClick(s);
|
|
2997
3008
|
});
|
|
2998
3009
|
}), this.ctx.on("dblclick", (t) => {
|
|
2999
3010
|
if (t.button !== 0 || this.isBusy(t))
|
|
@@ -3013,9 +3024,12 @@ class fi {
|
|
|
3013
3024
|
}), this.handleBodyEvent(r, s, this.ctx.body.renderRows, (o) => {
|
|
3014
3025
|
this.ctx.emit("cellContextMenuClick", o, t);
|
|
3015
3026
|
});
|
|
3027
|
+
}), this.ctx.on("mouseout", (t) => {
|
|
3028
|
+
!this.ctx.containerElement.contains(t.relatedTarget) && this.ctx.hoverCell !== void 0 && (this.ctx.hoverRow = void 0, this.ctx.hoverCell = void 0, this.ctx.emit("draw"));
|
|
3016
3029
|
}), this.ctx.on("mousemove", (t) => {
|
|
3017
3030
|
if (this.isBusy(t))
|
|
3018
3031
|
return;
|
|
3032
|
+
this.ctx.isPointer = !1, this.ctx.stageElement.style.cursor === "pointer" && (this.ctx.stageElement.style.cursor = "default");
|
|
3019
3033
|
const e = this.ctx.getOffset(t).offsetY, i = this.ctx.getOffset(t).offsetX;
|
|
3020
3034
|
this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
|
|
3021
3035
|
this.ctx.emit("cellHeaderMouseenter", s, t), this.ctx.hoverCellHeader && this.ctx.hoverCellHeader !== s && this.ctx.emit("cellHeaderMouseleave", this.ctx.hoverCellHeader, t), this.imageEnterAndLeave(s, t), this.ctx.hoverCellHeader !== s && (this.ctx.hoverCellHeader = s, this.ctx.emit("cellHeaderHoverChange", s));
|
|
@@ -3024,15 +3038,18 @@ class fi {
|
|
|
3024
3038
|
e,
|
|
3025
3039
|
this.ctx.body.renderRows,
|
|
3026
3040
|
(s) => {
|
|
3027
|
-
this.
|
|
3041
|
+
this.selectionEnterAndLeave(s, t), this.visibleHoverCell !== s && (this.ctx.emit("visibleCellMouseleave", s, t), this.visibleHoverCell = s, this.ctx.emit("visibleCellHoverChange", s, t));
|
|
3028
3042
|
},
|
|
3029
3043
|
!0
|
|
3030
3044
|
), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
|
|
3031
3045
|
var r;
|
|
3032
|
-
this.ctx.emit("cellMouseenter", s, t), this.ctx.hoverCell && this.ctx.hoverCell !== s && this.ctx.emit("cellMouseleave",
|
|
3046
|
+
this.imageEnterAndLeave(s, t), this.ctx.emit("cellMouseenter", s, t), this.ctx.hoverCell && this.ctx.hoverCell !== s && this.ctx.emit("cellMouseleave", s, t), this.ctx.hoverCell !== s && (((r = this.ctx.hoverCell) == null ? void 0 : r.rowKey) !== s.rowKey && (this.ctx.hoverCell = s, this.ctx.hoverRow = this.ctx.body.renderRows.find((o) => o.rowKey === s.rowKey), this.ctx.emit("rowHoverChange", this.ctx.hoverRow, s, t), this.ctx.emit("drawView")), this.ctx.hoverCell = s, this.ctx.emit("cellHoverChange", s, t));
|
|
3033
3047
|
});
|
|
3034
3048
|
});
|
|
3035
3049
|
}
|
|
3050
|
+
hoverIconClick(t) {
|
|
3051
|
+
t.hoverIconName && this.ctx.isPointer && this.ctx.emit("hoverIconClick", t);
|
|
3052
|
+
}
|
|
3036
3053
|
/**
|
|
3037
3054
|
*选中点击
|
|
3038
3055
|
* @param cell
|
|
@@ -3079,7 +3096,11 @@ class fi {
|
|
|
3079
3096
|
*/
|
|
3080
3097
|
imageEnterAndLeave(t, e) {
|
|
3081
3098
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s;
|
|
3082
|
-
o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight
|
|
3099
|
+
o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight && (this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0);
|
|
3100
|
+
}
|
|
3101
|
+
selectionEnterAndLeave(t, e) {
|
|
3102
|
+
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s;
|
|
3103
|
+
o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight && t instanceof Tt && ["selection", "index-selection"].includes(t.type) && (this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.stageElement.style.cursor = "not-allowed"));
|
|
3083
3104
|
}
|
|
3084
3105
|
isBusy(t) {
|
|
3085
3106
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, r = i;
|
|
@@ -3593,7 +3614,7 @@ class gi {
|
|
|
3593
3614
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
3594
3615
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3595
3616
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3596
|
-
const s = Qt(i), r =
|
|
3617
|
+
const s = Qt(i), r = It(i);
|
|
3597
3618
|
this.height = t * s, this.width = r.reduce((f, x) => f + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
3598
3619
|
const o = ti(te(i, s));
|
|
3599
3620
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
@@ -3696,7 +3717,7 @@ class gi {
|
|
|
3696
3717
|
for (let o = 0; o < i; o++) {
|
|
3697
3718
|
const n = t[o], h = r * (n.rowspan || 0), c = r * (n.level || 0);
|
|
3698
3719
|
let d = n.width || 100;
|
|
3699
|
-
n.children && (d =
|
|
3720
|
+
n.children && (d = It(n.children).reduce((g, p) => g + ((p == null ? void 0 : p.width) || 100), 0));
|
|
3700
3721
|
const f = new re(this.ctx, this.columnIndex, s, c, d, h, n);
|
|
3701
3722
|
this.ctx.database.setHeader(n.key, f), this.allCellHeaders.push(f), n.children || (this.leafCellHeaders.push(f), f.column.widthFillDisable || this.resizeNum++), n.fixed === "left" ? this.fixedLeftCellHeaders.push(f) : n.fixed === "right" ? this.fixedRightCellHeaders.push(f) : this.centerCellHeaders.push(f), !n.children && this.columnIndex++, n.children && this.render(n.children, s), s += d;
|
|
3702
3723
|
}
|
|
@@ -3849,6 +3870,7 @@ class wi {
|
|
|
3849
3870
|
l(this, "visibleRows", []);
|
|
3850
3871
|
l(this, "visibleHeight", 0);
|
|
3851
3872
|
l(this, "visibleWidth", 0);
|
|
3873
|
+
l(this, "containerRect");
|
|
3852
3874
|
l(this, "data", []);
|
|
3853
3875
|
this.ctx = t, this.init(), this.initResizeRow();
|
|
3854
3876
|
}
|
|
@@ -3873,41 +3895,46 @@ class wi {
|
|
|
3873
3895
|
return;
|
|
3874
3896
|
this.x = 0, x === "top" && r ? this.y = e.height + i.height : this.y = e.height;
|
|
3875
3897
|
const { data: g, sumHeight: p } = s.getData();
|
|
3876
|
-
this.height = p, this.data = g;
|
|
3877
|
-
const
|
|
3878
|
-
this.
|
|
3879
|
-
const w = this.
|
|
3880
|
-
!this.data.length && !n ? this.height = h : !this.data.length && n && (this.height = n - e.height - w - o);
|
|
3881
|
-
const y = this.data.length ? "not-empty" : "empty";
|
|
3898
|
+
this.height = p, this.data = g, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - o;
|
|
3899
|
+
const u = this.ctx.footer.height;
|
|
3900
|
+
!this.data.length && !n ? this.height = h : !this.data.length && n && (this.height = n - e.height - u - o);
|
|
3901
|
+
const w = this.data.length ? "not-empty" : "empty";
|
|
3882
3902
|
this.ctx.emit("emptyChange", {
|
|
3883
|
-
isEmpty:
|
|
3884
|
-
type:
|
|
3903
|
+
isEmpty: w,
|
|
3904
|
+
type: w,
|
|
3885
3905
|
headerHeight: e.height,
|
|
3886
3906
|
bodyHeight: this.height,
|
|
3887
|
-
footerHeight:
|
|
3907
|
+
footerHeight: u,
|
|
3888
3908
|
width: this.width,
|
|
3889
|
-
height: this.data.length ? 0 : h +
|
|
3909
|
+
height: this.data.length ? 0 : h + u
|
|
3890
3910
|
});
|
|
3891
|
-
let
|
|
3892
|
-
|
|
3893
|
-
let
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3911
|
+
let y = this.height + e.height + o;
|
|
3912
|
+
y += u;
|
|
3913
|
+
let E = y;
|
|
3914
|
+
const m = window.innerHeight, { top: C } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
|
|
3915
|
+
if (this.data.length && m > C && d && !n) {
|
|
3916
|
+
const R = m - C - f;
|
|
3917
|
+
R > e.height + o ? E = R : y > c && (E = c);
|
|
3918
|
+
} else this.data.length && n ? E = n : this.data.length && c && y > c && (E = c);
|
|
3919
|
+
E > 0 && (this.ctx.stageHeight = Math.floor(E), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
|
|
3920
|
+
let b = this.ctx.stageHeight - e.height - o;
|
|
3921
|
+
r ? this.visibleHeight = b - u : 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 = g;
|
|
3922
|
+
const v = window.devicePixelRatio || 1, O = this.ctx.stageWidth * v, S = this.ctx.stageHeight * v;
|
|
3923
|
+
t.width = Math.floor(O), t.height = Math.floor(S), this.ctx.canvasElement.setAttribute(
|
|
3901
3924
|
"style",
|
|
3902
3925
|
` height:${this.ctx.stageHeight}px;width:${this.ctx.stageWidth}px;`
|
|
3903
|
-
), this.ctx.paint.scale(
|
|
3926
|
+
), this.ctx.paint.scale(v);
|
|
3904
3927
|
}
|
|
3905
3928
|
// 调整行的高度
|
|
3906
3929
|
initResizeRow() {
|
|
3907
3930
|
const {
|
|
3908
3931
|
config: { ENABLE_RESIZE_ROW: t }
|
|
3909
3932
|
} = this.ctx;
|
|
3910
|
-
t && (this.ctx.on("
|
|
3933
|
+
t && (this.ctx.on("resize", () => {
|
|
3934
|
+
this.containerRect = this.ctx.containerElement.getBoundingClientRect();
|
|
3935
|
+
}), this.ctx.on("resizeObserver", () => {
|
|
3936
|
+
this.containerRect = this.ctx.containerElement.getBoundingClientRect();
|
|
3937
|
+
}), this.ctx.on("mouseup", () => {
|
|
3911
3938
|
this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeRow(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.resizeDiff = 0, this.isResizing = !1, setTimeout(() => {
|
|
3912
3939
|
this.ctx.rowResizing = !1;
|
|
3913
3940
|
}, 0), this.clientY = 0;
|
|
@@ -4241,14 +4268,14 @@ class yi {
|
|
|
4241
4268
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
4242
4269
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
4243
4270
|
} = this.ctx.config, g = n, p = h || this.ctx.maxColIndex - f, u = c, w = d || this.ctx.maxRowIndex - x;
|
|
4244
|
-
let [y,
|
|
4245
|
-
if (y < g ||
|
|
4271
|
+
let [y, E] = r, [m, C] = o;
|
|
4272
|
+
if (y < g || E > p || m < u || C > w)
|
|
4246
4273
|
return;
|
|
4247
4274
|
if (this.ctx.stageElement.focus(), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
4248
|
-
const
|
|
4249
|
-
m =
|
|
4275
|
+
const v = this.adjustMergeCells(r, o);
|
|
4276
|
+
m = v.yArr[0], C = v.yArr[1], y = v.xArr[0], E = v.xArr[1], this.ctx.onlyMergeCell = v.onlyMergeCell;
|
|
4250
4277
|
}
|
|
4251
|
-
y ===
|
|
4278
|
+
y === E && m === C ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, r = [Math.max(g, y), Math.min(p, E)], o = [Math.max(u, m), Math.min(w, C)];
|
|
4252
4279
|
const { BEFORE_SET_SELECTOR_METHOD: b } = this.ctx.config;
|
|
4253
4280
|
if (typeof b == "function") {
|
|
4254
4281
|
const O = b({
|
|
@@ -4269,13 +4296,13 @@ class yi {
|
|
|
4269
4296
|
let n = [], h = [];
|
|
4270
4297
|
for (let u = 0; u <= e[1] - e[0]; u++)
|
|
4271
4298
|
for (let w = 0; w <= t[1] - t[0]; w++) {
|
|
4272
|
-
const y = u + e[0],
|
|
4273
|
-
m && ((y === i || y === s) && n.push(m), (
|
|
4299
|
+
const y = u + e[0], E = w + t[0], m = this.ctx.database.getVirtualBodyCell(y, E);
|
|
4300
|
+
m && ((y === i || y === s) && n.push(m), (E === r || E === o) && h.push(m));
|
|
4274
4301
|
}
|
|
4275
4302
|
const c = n.reduce(
|
|
4276
4303
|
(u, w) => {
|
|
4277
|
-
const { yArr: y } = w.getSpanInfo(), [
|
|
4278
|
-
return u.minY = Math.min(u.minY,
|
|
4304
|
+
const { yArr: y } = w.getSpanInfo(), [E, m] = y;
|
|
4305
|
+
return u.minY = Math.min(u.minY, E), u.maxY = Math.max(u.maxY, m), u;
|
|
4279
4306
|
},
|
|
4280
4307
|
{
|
|
4281
4308
|
minY: i,
|
|
@@ -4283,8 +4310,8 @@ class yi {
|
|
|
4283
4310
|
}
|
|
4284
4311
|
), d = h.reduce(
|
|
4285
4312
|
(u, w) => {
|
|
4286
|
-
const { xArr: y } = w.getSpanInfo(), [
|
|
4287
|
-
return u.minX = Math.min(u.minX,
|
|
4313
|
+
const { xArr: y } = w.getSpanInfo(), [E, m] = y;
|
|
4314
|
+
return u.minX = Math.min(u.minX, E), u.maxX = Math.max(u.maxX, m), u;
|
|
4288
4315
|
},
|
|
4289
4316
|
{
|
|
4290
4317
|
minX: r,
|
|
@@ -4487,16 +4514,16 @@ class yi {
|
|
|
4487
4514
|
for (let g = 0; g <= o.length - 1; g++) {
|
|
4488
4515
|
const p = o[g].length;
|
|
4489
4516
|
for (let u = 0; u <= p - 1; u++) {
|
|
4490
|
-
const w = g + e, y = u + i,
|
|
4517
|
+
const w = g + e, y = u + i, E = o[g][u], m = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4491
4518
|
w,
|
|
4492
4519
|
y
|
|
4493
4520
|
);
|
|
4494
4521
|
if (m) {
|
|
4495
|
-
const { rowKey:
|
|
4496
|
-
this.ctx.database.getReadonly(
|
|
4497
|
-
rowKey:
|
|
4522
|
+
const { rowKey: C, key: b } = m;
|
|
4523
|
+
this.ctx.database.getReadonly(C, b) || (s.add(C), d.push({
|
|
4524
|
+
rowKey: C,
|
|
4498
4525
|
key: b,
|
|
4499
|
-
value:
|
|
4526
|
+
value: E,
|
|
4500
4527
|
row: {}
|
|
4501
4528
|
//内部有设置
|
|
4502
4529
|
}));
|
|
@@ -4626,14 +4653,14 @@ class yi {
|
|
|
4626
4653
|
if (!i)
|
|
4627
4654
|
return;
|
|
4628
4655
|
p && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
4629
|
-
const { drawX: u, drawY: w, width: y, height:
|
|
4630
|
-
let
|
|
4656
|
+
const { drawX: u, drawY: w, width: y, height: E, fixed: m } = i, C = r - u + 1, b = i.drawX + y - (e - s) + 1;
|
|
4657
|
+
let v = o.height - w, O = E;
|
|
4631
4658
|
O > h.visibleHeight && (O = h.visibleHeight);
|
|
4632
|
-
let
|
|
4633
|
-
x && (g === "top" ?
|
|
4634
|
-
const
|
|
4635
|
-
let
|
|
4636
|
-
b > 0 && !m ?
|
|
4659
|
+
let S = 0;
|
|
4660
|
+
x && (g === "top" ? v = o.height + n.height - w : S = n.visibleHeight);
|
|
4661
|
+
const I = w + O - (t - S - f);
|
|
4662
|
+
let R = c, A = d;
|
|
4663
|
+
b > 0 && !m ? R = Math.floor(c + b) : C > 0 && !m && (R = Math.floor(c - C)), v > 0 ? A = Math.floor(d - v) : I > 0 && (A = Math.floor(d + I)), (Math.abs(c - R) > 2 || Math.abs(d - A) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(R, A), this.ctx.emit("adjustBoundaryPosition", i));
|
|
4637
4664
|
}
|
|
4638
4665
|
destroy() {
|
|
4639
4666
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -4698,20 +4725,20 @@ class mi {
|
|
|
4698
4725
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4699
4726
|
SELECTOR_AREA_MAX_Y_OFFSET: g
|
|
4700
4727
|
} = this.ctx.config, p = h, u = c || this.ctx.maxColIndex - x, w = d, y = f || this.ctx.maxRowIndex - g;
|
|
4701
|
-
let [
|
|
4702
|
-
if (
|
|
4728
|
+
let [E, m] = o, [C, b] = n;
|
|
4729
|
+
if (E < p || C < w)
|
|
4703
4730
|
return;
|
|
4704
|
-
o = [Math.max(p,
|
|
4705
|
-
const { BEFORE_SET_AUTOFILL_METHOD:
|
|
4706
|
-
if (typeof
|
|
4707
|
-
const
|
|
4731
|
+
o = [Math.max(p, E), Math.min(u, m)], n = [Math.max(w, C), Math.min(y, b)];
|
|
4732
|
+
const { BEFORE_SET_AUTOFILL_METHOD: v } = this.ctx.config;
|
|
4733
|
+
if (typeof v == "function") {
|
|
4734
|
+
const S = v({
|
|
4708
4735
|
focusCell: this.ctx.focusCell,
|
|
4709
4736
|
xArr: o,
|
|
4710
4737
|
yArr: n
|
|
4711
4738
|
});
|
|
4712
|
-
if (!
|
|
4739
|
+
if (!S)
|
|
4713
4740
|
return;
|
|
4714
|
-
o =
|
|
4741
|
+
o = S.xArr, n = S.yArr;
|
|
4715
4742
|
}
|
|
4716
4743
|
this.ctx.autofill.xArr = o, this.ctx.autofill.yArr = n, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
4717
4744
|
}
|
|
@@ -4738,11 +4765,11 @@ class mi {
|
|
|
4738
4765
|
let d = [];
|
|
4739
4766
|
for (let g = 0; g <= h[1] - h[0]; g++)
|
|
4740
4767
|
for (let p = 0; p <= n[1] - n[0]; p++) {
|
|
4741
|
-
const u = p + n[0], w = g + h[0], y = s[g % o][p % r],
|
|
4742
|
-
if (
|
|
4743
|
-
const { rowKey:
|
|
4744
|
-
this.ctx.database.getReadonly(
|
|
4745
|
-
rowKey:
|
|
4768
|
+
const u = p + n[0], w = g + h[0], y = s[g % o][p % r], E = this.ctx.database.getItemValueForRowIndexAndColIndex(w, u), m = `${w}-${u}`;
|
|
4769
|
+
if (E && !i.has(m)) {
|
|
4770
|
+
const { rowKey: C, key: b } = E;
|
|
4771
|
+
this.ctx.database.getReadonly(C, b) || (t.add(C), d.push({
|
|
4772
|
+
rowKey: C,
|
|
4746
4773
|
key: b,
|
|
4747
4774
|
value: y,
|
|
4748
4775
|
row: {}
|
|
@@ -4794,7 +4821,7 @@ const rt = Math.min, U = Math.max, ft = Math.round, z = (a) => ({
|
|
|
4794
4821
|
start: "end",
|
|
4795
4822
|
end: "start"
|
|
4796
4823
|
};
|
|
4797
|
-
function
|
|
4824
|
+
function _t(a, t, e) {
|
|
4798
4825
|
return U(a, rt(t, e));
|
|
4799
4826
|
}
|
|
4800
4827
|
function at(a, t) {
|
|
@@ -4844,7 +4871,7 @@ function Ri(a, t, e) {
|
|
|
4844
4871
|
return [];
|
|
4845
4872
|
}
|
|
4846
4873
|
}
|
|
4847
|
-
function
|
|
4874
|
+
function Ii(a, t, e, i) {
|
|
4848
4875
|
const s = lt(a);
|
|
4849
4876
|
let r = Ri(q(a), e === "start", i);
|
|
4850
4877
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
@@ -4852,7 +4879,7 @@ function _i(a, t, e, i) {
|
|
|
4852
4879
|
function xt(a) {
|
|
4853
4880
|
return a.replace(/left|right|bottom|top/g, (t) => Ei[t]);
|
|
4854
4881
|
}
|
|
4855
|
-
function
|
|
4882
|
+
function _i(a) {
|
|
4856
4883
|
return {
|
|
4857
4884
|
top: 0,
|
|
4858
4885
|
right: 0,
|
|
@@ -4862,7 +4889,7 @@ function Ii(a) {
|
|
|
4862
4889
|
};
|
|
4863
4890
|
}
|
|
4864
4891
|
function ae(a) {
|
|
4865
|
-
return typeof a != "number" ?
|
|
4892
|
+
return typeof a != "number" ? _i(a) : {
|
|
4866
4893
|
top: a,
|
|
4867
4894
|
right: a,
|
|
4868
4895
|
bottom: a,
|
|
@@ -4955,9 +4982,9 @@ const Oi = async (a, t, e) => {
|
|
|
4955
4982
|
name: w,
|
|
4956
4983
|
fn: y
|
|
4957
4984
|
} = n[u], {
|
|
4958
|
-
x:
|
|
4985
|
+
x: E,
|
|
4959
4986
|
y: m,
|
|
4960
|
-
data:
|
|
4987
|
+
data: C,
|
|
4961
4988
|
reset: b
|
|
4962
4989
|
} = await y({
|
|
4963
4990
|
x: d,
|
|
@@ -4973,11 +5000,11 @@ const Oi = async (a, t, e) => {
|
|
|
4973
5000
|
floating: t
|
|
4974
5001
|
}
|
|
4975
5002
|
});
|
|
4976
|
-
d =
|
|
5003
|
+
d = E ?? d, f = m ?? f, g = {
|
|
4977
5004
|
...g,
|
|
4978
5005
|
[w]: {
|
|
4979
5006
|
...g[w],
|
|
4980
|
-
...
|
|
5007
|
+
...C
|
|
4981
5008
|
}
|
|
4982
5009
|
}, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (x = b.placement), b.rects && (c = b.rects === !0 ? await o.getElementRects({
|
|
4983
5010
|
reference: a,
|
|
@@ -5017,12 +5044,12 @@ async function le(a, t) {
|
|
|
5017
5044
|
boundary: c,
|
|
5018
5045
|
rootBoundary: d,
|
|
5019
5046
|
strategy: h
|
|
5020
|
-
})),
|
|
5047
|
+
})), E = f === "floating" ? {
|
|
5021
5048
|
x: i,
|
|
5022
5049
|
y: s,
|
|
5023
5050
|
width: o.floating.width,
|
|
5024
5051
|
height: o.floating.height
|
|
5025
|
-
} : o.reference, m = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(n.floating)),
|
|
5052
|
+
} : o.reference, m = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(n.floating)), C = await (r.isElement == null ? void 0 : r.isElement(m)) ? await (r.getScale == null ? void 0 : r.getScale(m)) || {
|
|
5026
5053
|
x: 1,
|
|
5027
5054
|
y: 1
|
|
5028
5055
|
} : {
|
|
@@ -5030,15 +5057,15 @@ async function le(a, t) {
|
|
|
5030
5057
|
y: 1
|
|
5031
5058
|
}, b = ut(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
5032
5059
|
elements: n,
|
|
5033
|
-
rect:
|
|
5060
|
+
rect: E,
|
|
5034
5061
|
offsetParent: m,
|
|
5035
5062
|
strategy: h
|
|
5036
|
-
}) :
|
|
5063
|
+
}) : E);
|
|
5037
5064
|
return {
|
|
5038
|
-
top: (y.top - b.top + p.top) /
|
|
5039
|
-
bottom: (b.bottom - y.bottom + p.bottom) /
|
|
5040
|
-
left: (y.left - b.left + p.left) /
|
|
5041
|
-
right: (b.right - y.right + p.right) /
|
|
5065
|
+
top: (y.top - b.top + p.top) / C.y,
|
|
5066
|
+
bottom: (b.bottom - y.bottom + p.bottom) / C.y,
|
|
5067
|
+
left: (y.left - b.left + p.left) / C.x,
|
|
5068
|
+
right: (b.right - y.right + p.right) / C.x
|
|
5042
5069
|
};
|
|
5043
5070
|
}
|
|
5044
5071
|
const Si = (a) => ({
|
|
@@ -5062,10 +5089,10 @@ const Si = (a) => ({
|
|
|
5062
5089
|
const f = ae(d), x = {
|
|
5063
5090
|
x: e,
|
|
5064
5091
|
y: i
|
|
5065
|
-
}, g = Ht(s), p = Mt(g), u = await o.getDimensions(c), w = g === "y", y = w ? "top" : "left",
|
|
5066
|
-
let O =
|
|
5067
|
-
(!O || !await (o.isElement == null ? void 0 : o.isElement(
|
|
5068
|
-
const
|
|
5092
|
+
}, g = Ht(s), p = Mt(g), u = await o.getDimensions(c), w = g === "y", y = w ? "top" : "left", E = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", C = r.reference[p] + r.reference[g] - x[g] - r.floating[p], b = x[g] - r.reference[g], v = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c));
|
|
5093
|
+
let O = v ? v[m] : 0;
|
|
5094
|
+
(!O || !await (o.isElement == null ? void 0 : o.isElement(v))) && (O = n.floating[m] || r.floating[p]);
|
|
5095
|
+
const S = C / 2 - b / 2, I = O / 2 - u[p] / 2 - 1, R = rt(f[y], I), A = rt(f[E], I), L = R, M = O - u[p] - A, T = O / 2 - u[p] / 2 + S, N = _t(L, T, M), Y = !h.arrow && lt(s) != null && T !== N && r.reference[p] / 2 - (T < L ? R : A) - u[p] / 2 < 0, B = Y ? T < L ? T - L : T - M : 0;
|
|
5069
5096
|
return {
|
|
5070
5097
|
[g]: x[g] + B,
|
|
5071
5098
|
data: {
|
|
@@ -5102,39 +5129,39 @@ const Si = (a) => ({
|
|
|
5102
5129
|
} = at(a, t);
|
|
5103
5130
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
5104
5131
|
return {};
|
|
5105
|
-
const y = q(s),
|
|
5106
|
-
!x &&
|
|
5107
|
-
const O = [n, ...b],
|
|
5108
|
-
let
|
|
5109
|
-
if (d &&
|
|
5110
|
-
const T = bi(s, o,
|
|
5111
|
-
|
|
5132
|
+
const y = q(s), E = J(n), m = q(n) === n, C = await (h.isRTL == null ? void 0 : h.isRTL(c.floating)), b = x || (m || !u ? [xt(n)] : vi(n)), v = p !== "none";
|
|
5133
|
+
!x && v && b.push(...Ii(n, u, p, C));
|
|
5134
|
+
const O = [n, ...b], S = await le(t, w), I = [];
|
|
5135
|
+
let R = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
5136
|
+
if (d && I.push(S[y]), f) {
|
|
5137
|
+
const T = bi(s, o, C);
|
|
5138
|
+
I.push(S[T[0]], S[T[1]]);
|
|
5112
5139
|
}
|
|
5113
|
-
if (
|
|
5140
|
+
if (R = [...R, {
|
|
5114
5141
|
placement: s,
|
|
5115
|
-
overflows:
|
|
5116
|
-
}], !
|
|
5117
|
-
var A,
|
|
5142
|
+
overflows: I
|
|
5143
|
+
}], !I.every((T) => T <= 0)) {
|
|
5144
|
+
var A, L;
|
|
5118
5145
|
const T = (((A = r.flip) == null ? void 0 : A.index) || 0) + 1, N = O[T];
|
|
5119
5146
|
if (N)
|
|
5120
5147
|
return {
|
|
5121
5148
|
data: {
|
|
5122
5149
|
index: T,
|
|
5123
|
-
overflows:
|
|
5150
|
+
overflows: R
|
|
5124
5151
|
},
|
|
5125
5152
|
reset: {
|
|
5126
5153
|
placement: N
|
|
5127
5154
|
}
|
|
5128
5155
|
};
|
|
5129
|
-
let Y = (
|
|
5156
|
+
let Y = (L = R.filter((B) => B.overflows[0] <= 0).sort((B, W) => B.overflows[1] - W.overflows[1])[0]) == null ? void 0 : L.placement;
|
|
5130
5157
|
if (!Y)
|
|
5131
5158
|
switch (g) {
|
|
5132
5159
|
case "bestFit": {
|
|
5133
5160
|
var M;
|
|
5134
|
-
const B = (M =
|
|
5135
|
-
if (
|
|
5161
|
+
const B = (M = R.filter((W) => {
|
|
5162
|
+
if (v) {
|
|
5136
5163
|
const P = J(W.placement);
|
|
5137
|
-
return P ===
|
|
5164
|
+
return P === E || // Create a bias to the `y` side axis due to horizontal
|
|
5138
5165
|
// reading directions favoring greater width.
|
|
5139
5166
|
P === "y";
|
|
5140
5167
|
}
|
|
@@ -5223,11 +5250,11 @@ const Ti = function(a) {
|
|
|
5223
5250
|
fn: (w) => {
|
|
5224
5251
|
let {
|
|
5225
5252
|
x: y,
|
|
5226
|
-
y:
|
|
5253
|
+
y: E
|
|
5227
5254
|
} = w;
|
|
5228
5255
|
return {
|
|
5229
5256
|
x: y,
|
|
5230
|
-
y:
|
|
5257
|
+
y: E
|
|
5231
5258
|
};
|
|
5232
5259
|
}
|
|
5233
5260
|
},
|
|
@@ -5238,12 +5265,12 @@ const Ti = function(a) {
|
|
|
5238
5265
|
}, d = await le(t, h), f = J(q(s)), x = ne(f);
|
|
5239
5266
|
let g = c[x], p = c[f];
|
|
5240
5267
|
if (r) {
|
|
5241
|
-
const w = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right",
|
|
5242
|
-
g =
|
|
5268
|
+
const w = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", E = g + d[w], m = g - d[y];
|
|
5269
|
+
g = _t(E, g, m);
|
|
5243
5270
|
}
|
|
5244
5271
|
if (o) {
|
|
5245
|
-
const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right",
|
|
5246
|
-
p =
|
|
5272
|
+
const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", E = p + d[w], m = p - d[y];
|
|
5273
|
+
p = _t(E, p, m);
|
|
5247
5274
|
}
|
|
5248
5275
|
const u = n.fn({
|
|
5249
5276
|
...t,
|
|
@@ -5423,8 +5450,8 @@ function ot(a, t, e, i) {
|
|
|
5423
5450
|
const x = F(r), g = i && X(i) ? F(i) : i;
|
|
5424
5451
|
let p = x, u = Lt(p);
|
|
5425
5452
|
for (; u && i && g !== p; ) {
|
|
5426
|
-
const w = Z(u), y = u.getBoundingClientRect(),
|
|
5427
|
-
h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c +=
|
|
5453
|
+
const w = Z(u), y = u.getBoundingClientRect(), E = k(u), m = y.left + (u.clientLeft + parseFloat(E.paddingLeft)) * w.x, C = y.top + (u.clientTop + parseFloat(E.paddingTop)) * w.y;
|
|
5454
|
+
h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c += C, p = F(u), u = Lt(p);
|
|
5428
5455
|
}
|
|
5429
5456
|
}
|
|
5430
5457
|
return ut({
|
|
@@ -5794,8 +5821,10 @@ class Zi {
|
|
|
5794
5821
|
this.enable && this.doneEdit();
|
|
5795
5822
|
}), this.ctx.on("cellHeaderMousedown", () => {
|
|
5796
5823
|
this.enable && this.doneEdit(), this.cellTarget = null;
|
|
5824
|
+
}), this.ctx.on("hoverIconClick", (t) => {
|
|
5825
|
+
t.editorType !== "none" && this.editCell(t.rowIndex, t.colIndex);
|
|
5797
5826
|
}), this.ctx.on("keydown", (t) => {
|
|
5798
|
-
if (!this.ctx.isTarget(t))
|
|
5827
|
+
if (!this.ctx.isTarget(t) || !this.ctx.focusCell)
|
|
5799
5828
|
return;
|
|
5800
5829
|
if (t.code === "Escape" && this.ctx.editing) {
|
|
5801
5830
|
this.cancel = !0;
|
|
@@ -5884,7 +5913,7 @@ class Zi {
|
|
|
5884
5913
|
}
|
|
5885
5914
|
initTextEditor() {
|
|
5886
5915
|
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
5887
|
-
this.doneEdit()
|
|
5916
|
+
this.doneEdit();
|
|
5888
5917
|
}), this.editorEl = this.ctx.editorElement, this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
|
|
5889
5918
|
}
|
|
5890
5919
|
autoSize() {
|
|
@@ -5924,18 +5953,18 @@ class Zi {
|
|
|
5924
5953
|
}
|
|
5925
5954
|
}
|
|
5926
5955
|
startEdit(t = !1) {
|
|
5927
|
-
this.cancel = !1;
|
|
5956
|
+
this.ctx.emit("draw"), this.cancel = !1;
|
|
5928
5957
|
const { ENABLE_EDIT_CLICK_SELECTOR: e } = this.ctx.config;
|
|
5929
5958
|
if (!e)
|
|
5930
5959
|
return;
|
|
5931
5960
|
const i = this.ctx.focusCell;
|
|
5932
|
-
if (!i || ["index", "index-selection", "selection"].includes(i.type) || this.enable)
|
|
5961
|
+
if (!i || ["index", "index-selection", "selection"].includes(i.type) || this.enable || !(i.isVerticalVisible() && i.isHorizontalVisible()))
|
|
5933
5962
|
return;
|
|
5934
|
-
const { rowKey:
|
|
5935
|
-
if (
|
|
5963
|
+
const { rowKey: r, key: o, editorType: n } = i;
|
|
5964
|
+
if (n === "none")
|
|
5936
5965
|
return;
|
|
5937
|
-
const
|
|
5938
|
-
i && !
|
|
5966
|
+
const h = this.ctx.database.getReadonly(r, o);
|
|
5967
|
+
i && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
|
|
5939
5968
|
}
|
|
5940
5969
|
editCell(t, e) {
|
|
5941
5970
|
const i = this.ctx.body.renderRows.find((c) => c.rowIndex === t);
|
|
@@ -5955,7 +5984,7 @@ class Zi {
|
|
|
5955
5984
|
this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.containerElement.focus(), this.editorEl.style.display = "none", this.ctx.emit("drawView"));
|
|
5956
5985
|
}
|
|
5957
5986
|
clearEditor() {
|
|
5958
|
-
this.doneEdit(), this.cellTarget = null, this.selectorArrStr = "", this.ctx.clearSelector(), this.ctx.emit("drawView");
|
|
5987
|
+
this.doneEdit(), this.cellTarget = null, this.selectorArrStr = "", this.ctx.clearSelector(), this.ctx.focusCell = void 0, this.ctx.emit("drawView");
|
|
5959
5988
|
}
|
|
5960
5989
|
destroy() {
|
|
5961
5990
|
var t;
|