e-virt-table 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +429 -406
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Body.js +5 -1
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Config.d.ts +1 -0
- package/dist/lib/Config.js +6 -0
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +1 -0
- package/dist/lib/EVirtTable.js +3 -0
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.d.ts +1 -0
- package/dist/lib/Editor.js +36 -0
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/EventTable.d.ts +1 -1
- package/dist/lib/EventTable.js +46 -76
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/Scroller.js +17 -13
- package/dist/lib/Scroller.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -39,8 +39,8 @@ function dt(a, t, e) {
|
|
|
39
39
|
return Ee() ? dt = Reflect.construct.bind() : dt = function(s, r, o) {
|
|
40
40
|
var n = [null];
|
|
41
41
|
n.push.apply(n, r);
|
|
42
|
-
var
|
|
43
|
-
return o && st(
|
|
42
|
+
var l = Function.bind.apply(s, n), h = new l();
|
|
43
|
+
return o && st(h, o.prototype), h;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
46
46
|
function be(a) {
|
|
@@ -169,9 +169,9 @@ function Oe(a, t, e, i, s) {
|
|
|
169
169
|
return x;
|
|
170
170
|
}), r;
|
|
171
171
|
}
|
|
172
|
-
var o = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a),
|
|
172
|
+
var o = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a), l = n.length, h = 0, d = [], f = new Promise(function(x, u) {
|
|
173
173
|
var y = function(w) {
|
|
174
|
-
if (d.push.apply(d, w),
|
|
174
|
+
if (d.push.apply(d, w), h++, h === l)
|
|
175
175
|
return i(d), d.length ? u(new Xt(d, Ct(d))) : x(s);
|
|
176
176
|
};
|
|
177
177
|
n.length || (i(d), x(s)), n.forEach(function(g) {
|
|
@@ -186,7 +186,7 @@ function Oe(a, t, e, i, s) {
|
|
|
186
186
|
function _e(a) {
|
|
187
187
|
return !!(a && a.message !== void 0);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Te(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 = Te(t, a.fullFields) : i = t[e.field || a.fullField], _e(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
|
|
@@ -216,11 +216,11 @@ function Kt(a, t) {
|
|
|
216
216
|
}
|
|
217
217
|
var Gt = function(t, e, i, s, r, o) {
|
|
218
218
|
t.required && (!i.hasOwnProperty(t.field) || I(e, o || t.type)) && s.push(H(r.messages.required, t.fullField));
|
|
219
|
-
},
|
|
219
|
+
}, Se = function(t, e, i, s, r) {
|
|
220
220
|
(/^\s+$/.test(e) || e === "") && s.push(H(r.messages.whitespace, t.fullField));
|
|
221
|
-
},
|
|
222
|
-
if (
|
|
223
|
-
return
|
|
221
|
+
}, ht, Le = 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, 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 + "$"),
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), n = new RegExp("^" + s + "$"), l = function(b) {
|
|
238
238
|
return b && b.exact ? r : 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 ? o : 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]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = 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\\.)" + d + "(?:localhost|" + f + "|" + x + "|" + u + y + g + ")" + w + p;
|
|
246
|
+
return ht = new RegExp("(?:^" + E + "$)", "i"), ht;
|
|
247
247
|
}, Yt = {
|
|
248
248
|
// http://emailregex.com/
|
|
249
249
|
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
@@ -300,10 +300,10 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
300
300
|
var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], n = t.type;
|
|
301
301
|
o.indexOf(n) > -1 ? et[n](e) || s.push(H(r.messages.types[n], t.fullField, t.type)) : n && typeof e !== t.type && s.push(H(r.messages.types[n], t.fullField, t.type));
|
|
302
302
|
}, He = function(t, e, i, s, r) {
|
|
303
|
-
var o = typeof t.len == "number", n = typeof t.min == "number",
|
|
303
|
+
var o = typeof t.len == "number", n = typeof t.min == "number", l = typeof t.max == "number", h = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, d = e, f = null, x = typeof e == "number", u = typeof e == "string", y = Array.isArray(e);
|
|
304
304
|
if (x ? f = "number" : u ? f = "string" : y && (f = "array"), !f)
|
|
305
305
|
return !1;
|
|
306
|
-
y && (d = e.length), u && (d = e.replace(
|
|
306
|
+
y && (d = e.length), u && (d = e.replace(h, "_").length), o ? d !== t.len && s.push(H(r.messages[f].len, t.fullField, t.len)) : n && !l && d < t.min ? s.push(H(r.messages[f].min, t.fullField, t.min)) : l && !n && d > t.max ? s.push(H(r.messages[f].max, t.fullField, t.max)) : n && l && (d < t.min || d > t.max) && s.push(H(r.messages[f].range, t.fullField, t.min, t.max));
|
|
307
307
|
}, j = "enum", Me = function(t, e, i, s, r) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(H(r.messages[j], t.fullField, t[j].join(", ")));
|
|
309
309
|
}, De = function(t, e, i, s, r) {
|
|
@@ -317,7 +317,7 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
317
317
|
}
|
|
318
318
|
}, v = {
|
|
319
319
|
required: Gt,
|
|
320
|
-
whitespace:
|
|
320
|
+
whitespace: Se,
|
|
321
321
|
type: Ae,
|
|
322
322
|
range: He,
|
|
323
323
|
enum: Me,
|
|
@@ -416,8 +416,8 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
416
416
|
if (I(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
418
|
if (v.required(t, e, s, o, r), !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, o, r), l && v.range(t, l.getTime(), s, o, r);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
i(o);
|
|
@@ -425,8 +425,8 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
425
425
|
var o = [], n = Array.isArray(e) ? "array" : typeof e;
|
|
426
426
|
v.required(t, e, s, o, r, n), i(o);
|
|
427
427
|
}, yt = function(t, e, i, s, r) {
|
|
428
|
-
var o = t.type, n = [],
|
|
429
|
-
if (
|
|
428
|
+
var o = t.type, n = [], l = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (l) {
|
|
430
430
|
if (I(e, o) && !t.required)
|
|
431
431
|
return i();
|
|
432
432
|
v.required(t, e, s, n, r, o), I(e, o) || v.type(t, e, s, n, r);
|
|
@@ -533,9 +533,9 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
533
533
|
var o = this;
|
|
534
534
|
s === void 0 && (s = {}), r === void 0 && (r = function() {
|
|
535
535
|
});
|
|
536
|
-
var n = i,
|
|
537
|
-
if (typeof
|
|
538
|
-
return
|
|
536
|
+
var n = i, l = s, h = r;
|
|
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 d(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 f = this.messages();
|
|
554
|
-
f === Rt && (f = vt()), Kt(f,
|
|
554
|
+
f === Rt && (f = vt()), Kt(f, l.messages), l.messages = f;
|
|
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 = o.rules[g], p = n[g];
|
|
560
560
|
w.forEach(function(E) {
|
|
@@ -570,51 +570,51 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
var y = {};
|
|
573
|
-
return Oe(x,
|
|
573
|
+
return Oe(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
|
-
function m(R,
|
|
577
|
-
return $({},
|
|
576
|
+
function m(R, S) {
|
|
577
|
+
return $({}, S, {
|
|
578
578
|
fullField: p.fullField + "." + R,
|
|
579
579
|
fullFields: p.fullFields ? [].concat(p.fullFields, [R]) : [R]
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
582
|
function b(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
|
-
var
|
|
585
|
-
!
|
|
586
|
-
var L =
|
|
587
|
-
if (
|
|
584
|
+
var S = Array.isArray(R) ? R : [R];
|
|
585
|
+
!l.suppressWarning && S.length && a.warning("async-validator:", S), S.length && p.message !== void 0 && (S = [].concat(p.message));
|
|
586
|
+
var L = S.map(Nt(p, n));
|
|
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, H(l.messages.required, p.field))]), w(L);
|
|
594
594
|
var A = {};
|
|
595
595
|
p.defaultField && Object.keys(g.value).map(function(O) {
|
|
596
596
|
A[O] = p.defaultField;
|
|
597
597
|
}), A = $({}, A, g.rule.fields);
|
|
598
598
|
var D = {};
|
|
599
599
|
Object.keys(A).forEach(function(O) {
|
|
600
|
-
var
|
|
600
|
+
var T = A[O], _ = Array.isArray(T) ? T : [T];
|
|
601
601
|
D[O] = _.map(m.bind(null, O));
|
|
602
602
|
});
|
|
603
603
|
var B = new a(D);
|
|
604
|
-
B.messages(
|
|
605
|
-
var
|
|
606
|
-
L && L.length &&
|
|
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(O) {
|
|
605
|
+
var T = [];
|
|
606
|
+
L && L.length && T.push.apply(T, L), O && O.length && T.push.apply(T, O), w(T.length ? T : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
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
|
}
|
|
@@ -751,11 +751,11 @@ class Ze {
|
|
|
751
751
|
t.forEach((i, s) => {
|
|
752
752
|
let r = !1;
|
|
753
753
|
Array.isArray(i.children) && (r = !0, this.initData(i.children, e + 1));
|
|
754
|
-
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT:
|
|
754
|
+
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: l, SELECTABLE_METHOD: h, CHECKBOX_KEY: d } = this.ctx.config, f = i[o], x = f ?? At();
|
|
755
755
|
this.itemRowKeyMap.set(i, x);
|
|
756
|
-
const u = i._height ||
|
|
756
|
+
const u = i._height || l, y = i._readonly;
|
|
757
757
|
let g = !0;
|
|
758
|
-
if (typeof
|
|
758
|
+
if (typeof h == "function" && (g = h), d) {
|
|
759
759
|
const w = i[d];
|
|
760
760
|
if (this.checkboxKeyMap.has(w)) {
|
|
761
761
|
const p = this.checkboxKeyMap.get(w);
|
|
@@ -835,12 +835,12 @@ class Ze {
|
|
|
835
835
|
const i = (r) => {
|
|
836
836
|
r.forEach((o) => {
|
|
837
837
|
t.push(o);
|
|
838
|
-
const n = this.itemRowKeyMap.get(o), { expand:
|
|
838
|
+
const n = this.itemRowKeyMap.get(o), { expand: l, hasChildren: h, height: d } = this.rowKeyMap.get(n), f = this.sumHeight;
|
|
839
839
|
this.sumHeight += d, this.rowIndexRowKeyMap.set(e, n), this.positions.push({
|
|
840
840
|
top: f,
|
|
841
841
|
height: d,
|
|
842
842
|
bottom: this.sumHeight
|
|
843
|
-
}), e += 1,
|
|
843
|
+
}), e += 1, l && h && i(o.children);
|
|
844
844
|
});
|
|
845
845
|
};
|
|
846
846
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -963,9 +963,9 @@ class Ze {
|
|
|
963
963
|
let i = [];
|
|
964
964
|
const s = /* @__PURE__ */ new Set();
|
|
965
965
|
t.forEach((n) => {
|
|
966
|
-
const { value:
|
|
967
|
-
s.add(
|
|
968
|
-
rowKey:
|
|
966
|
+
const { value: l, rowKey: h, key: d } = n, { oldValue: f, newValue: x } = this.setItemValue(h, d, l);
|
|
967
|
+
s.add(h), i.push({
|
|
968
|
+
rowKey: h,
|
|
969
969
|
key: d,
|
|
970
970
|
oldValue: f,
|
|
971
971
|
newValue: x
|
|
@@ -973,12 +973,12 @@ class Ze {
|
|
|
973
973
|
});
|
|
974
974
|
let r = [];
|
|
975
975
|
const o = i.map((n) => {
|
|
976
|
-
const
|
|
976
|
+
const l = this.ctx.database.getRowDataItemForRowKey(n.rowKey);
|
|
977
977
|
return {
|
|
978
978
|
rowKey: n.rowKey,
|
|
979
979
|
key: n.key,
|
|
980
980
|
value: n.newValue,
|
|
981
|
-
row:
|
|
981
|
+
row: l
|
|
982
982
|
};
|
|
983
983
|
});
|
|
984
984
|
return s.forEach((n) => {
|
|
@@ -1004,15 +1004,15 @@ class Ze {
|
|
|
1004
1004
|
if (!this.rowKeyMap.has(t))
|
|
1005
1005
|
return {};
|
|
1006
1006
|
const { item: n } = this.rowKeyMap.get(t);
|
|
1007
|
-
let
|
|
1007
|
+
let l = n[e];
|
|
1008
1008
|
if (this.ctx.database.getReadonly(t, e))
|
|
1009
1009
|
return {
|
|
1010
|
-
oldValue:
|
|
1011
|
-
newValue:
|
|
1010
|
+
oldValue: l,
|
|
1011
|
+
newValue: l
|
|
1012
1012
|
};
|
|
1013
|
-
n[e] !== null && typeof n[e] == "object" && (
|
|
1014
|
-
const
|
|
1015
|
-
if (this.originalDataMap.has(
|
|
1013
|
+
n[e] !== null && typeof n[e] == "object" && (l = JSON.parse(JSON.stringify(n[e])));
|
|
1014
|
+
const h = `${t}_${e}`;
|
|
1015
|
+
if (this.originalDataMap.has(h) || this.originalDataMap.set(h, l), this.changedDataMap.set(h, i), n[e] = i, o) {
|
|
1016
1016
|
const d = this.ctx.database.getRowDataItemForRowKey(t), f = {
|
|
1017
1017
|
rowKey: t,
|
|
1018
1018
|
key: e,
|
|
@@ -1022,18 +1022,18 @@ class Ze {
|
|
|
1022
1022
|
this.ctx.emit("change", [f], [d]), this.ctx.emit("editChange", {
|
|
1023
1023
|
rowKey: t,
|
|
1024
1024
|
key: e,
|
|
1025
|
-
oldValue:
|
|
1025
|
+
oldValue: l,
|
|
1026
1026
|
value: i,
|
|
1027
|
-
originalValue: this.originalDataMap.get(
|
|
1027
|
+
originalValue: this.originalDataMap.get(h),
|
|
1028
1028
|
row: d
|
|
1029
1029
|
});
|
|
1030
1030
|
}
|
|
1031
1031
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1032
1032
|
rowKey: t,
|
|
1033
1033
|
key: e,
|
|
1034
|
-
oldValue:
|
|
1034
|
+
oldValue: l,
|
|
1035
1035
|
value: i,
|
|
1036
|
-
originalValue: this.originalDataMap.get(
|
|
1036
|
+
originalValue: this.originalDataMap.get(h),
|
|
1037
1037
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
1038
1038
|
}), s && this.ctx.history.pushState({
|
|
1039
1039
|
type: "single",
|
|
@@ -1043,12 +1043,12 @@ class Ze {
|
|
|
1043
1043
|
{
|
|
1044
1044
|
rowKey: t,
|
|
1045
1045
|
key: e,
|
|
1046
|
-
oldValue:
|
|
1046
|
+
oldValue: l,
|
|
1047
1047
|
newValue: i
|
|
1048
1048
|
}
|
|
1049
1049
|
]
|
|
1050
1050
|
}), r && this.ctx.emit("draw"), {
|
|
1051
|
-
oldValue:
|
|
1051
|
+
oldValue: l,
|
|
1052
1052
|
newValue: i
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
@@ -1075,8 +1075,8 @@ class Ze {
|
|
|
1075
1075
|
return !1;
|
|
1076
1076
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1077
1077
|
this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((n) => {
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1078
|
+
const l = this.rowKeyMap.get(n);
|
|
1079
|
+
l.check = e;
|
|
1080
1080
|
});
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
@@ -1238,15 +1238,15 @@ class Ze {
|
|
|
1238
1238
|
getReadonly(t, e) {
|
|
1239
1239
|
const i = this.rowKeyMap.get(t), s = this.headerMap.get(e), r = i == null ? void 0 : i.readonly, o = s == null ? void 0 : s.readonly, { CELL_READONLY_METHOD: n } = this.ctx.config;
|
|
1240
1240
|
if (typeof n == "function") {
|
|
1241
|
-
const
|
|
1241
|
+
const h = n({
|
|
1242
1242
|
row: i.item,
|
|
1243
1243
|
rowIndex: i.rowIndex,
|
|
1244
1244
|
colIndex: s.colIndex,
|
|
1245
1245
|
column: s.column,
|
|
1246
1246
|
value: this.getItemValue(t, e)
|
|
1247
1247
|
});
|
|
1248
|
-
if (
|
|
1249
|
-
return
|
|
1248
|
+
if (h !== void 0)
|
|
1249
|
+
return h;
|
|
1250
1250
|
}
|
|
1251
1251
|
return o || r;
|
|
1252
1252
|
}
|
|
@@ -1256,7 +1256,7 @@ class Ze {
|
|
|
1256
1256
|
getValidator(t, e) {
|
|
1257
1257
|
return new Promise((i) => {
|
|
1258
1258
|
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { CELL_RULES_METHOD: o } = this.ctx.config, n = r.column;
|
|
1259
|
-
let
|
|
1259
|
+
let l = n.rules;
|
|
1260
1260
|
if (typeof o == "function") {
|
|
1261
1261
|
const d = o({
|
|
1262
1262
|
row: s.item,
|
|
@@ -1265,28 +1265,28 @@ class Ze {
|
|
|
1265
1265
|
column: n,
|
|
1266
1266
|
value: this.getItemValue(t, e)
|
|
1267
1267
|
});
|
|
1268
|
-
d && (
|
|
1268
|
+
d && (l = d);
|
|
1269
1269
|
}
|
|
1270
|
-
if (
|
|
1271
|
-
let
|
|
1272
|
-
if (d[e] = this.getItemValue(t, e), Array.isArray(
|
|
1273
|
-
const x =
|
|
1270
|
+
if (l) {
|
|
1271
|
+
let h = {}, d = {};
|
|
1272
|
+
if (d[e] = this.getItemValue(t, e), Array.isArray(l) && l.length) {
|
|
1273
|
+
const x = l.map((u) => ({
|
|
1274
1274
|
...u,
|
|
1275
1275
|
row: s.item,
|
|
1276
1276
|
column: n,
|
|
1277
1277
|
rowIndex: s.rowIndex,
|
|
1278
1278
|
colIndex: r.colIndex
|
|
1279
1279
|
}));
|
|
1280
|
-
|
|
1280
|
+
h[e] = x;
|
|
1281
1281
|
} else
|
|
1282
|
-
|
|
1283
|
-
...
|
|
1282
|
+
h[e] = {
|
|
1283
|
+
...l,
|
|
1284
1284
|
row: s.item,
|
|
1285
1285
|
column: n,
|
|
1286
1286
|
rowIndex: s.rowIndex,
|
|
1287
1287
|
colIndex: r.colIndex
|
|
1288
1288
|
};
|
|
1289
|
-
new nt(
|
|
1289
|
+
new nt(h).validate(d).then(() => {
|
|
1290
1290
|
this.setValidationError(t, e, []), i([]);
|
|
1291
1291
|
}).catch(({ errors: x }) => {
|
|
1292
1292
|
const u = x.map((y) => ({
|
|
@@ -1512,31 +1512,31 @@ class ei {
|
|
|
1512
1512
|
* @param {string} color - 阴影的颜色
|
|
1513
1513
|
*/
|
|
1514
1514
|
drawShadow(t, e, i, s, r) {
|
|
1515
|
-
const { fillColor: o, side: n, shadowWidth:
|
|
1515
|
+
const { fillColor: o, side: n, shadowWidth: l, colorStart: h, colorEnd: d } = r;
|
|
1516
1516
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1517
1517
|
let f;
|
|
1518
1518
|
switch (n) {
|
|
1519
1519
|
case "left":
|
|
1520
|
-
f = this.ctx.createLinearGradient(t -
|
|
1520
|
+
f = this.ctx.createLinearGradient(t - l, e, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t - l, e, l, s);
|
|
1521
1521
|
break;
|
|
1522
1522
|
case "right":
|
|
1523
1523
|
f = this.ctx.createLinearGradient(
|
|
1524
1524
|
t + i,
|
|
1525
1525
|
e,
|
|
1526
|
-
t + i +
|
|
1526
|
+
t + i + l,
|
|
1527
1527
|
e
|
|
1528
|
-
), f.addColorStop(0,
|
|
1528
|
+
), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t + i, e, l, s);
|
|
1529
1529
|
break;
|
|
1530
1530
|
case "top":
|
|
1531
|
-
f = this.ctx.createLinearGradient(t, e -
|
|
1531
|
+
f = this.ctx.createLinearGradient(t, e - l, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e - l, i, l);
|
|
1532
1532
|
break;
|
|
1533
1533
|
case "bottom":
|
|
1534
1534
|
f = this.ctx.createLinearGradient(
|
|
1535
1535
|
t,
|
|
1536
1536
|
e + s,
|
|
1537
1537
|
t,
|
|
1538
|
-
e + s +
|
|
1539
|
-
), f.addColorStop(0,
|
|
1538
|
+
e + s + l
|
|
1539
|
+
), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e + s, i, l);
|
|
1540
1540
|
break;
|
|
1541
1541
|
default:
|
|
1542
1542
|
console.error("Invalid side specified for shadow");
|
|
@@ -1557,12 +1557,12 @@ class ei {
|
|
|
1557
1557
|
drawImage(t, e, i, s, r) {
|
|
1558
1558
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, r), this.ctx.restore();
|
|
1559
1559
|
}
|
|
1560
|
-
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: n, radius:
|
|
1561
|
-
if (this.ctx.save(), this.ctx.beginPath(), n !== void 0 && (this.ctx.fillStyle = n), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o),
|
|
1560
|
+
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: n, radius: l = 0 } = {}) {
|
|
1561
|
+
if (this.ctx.save(), this.ctx.beginPath(), n !== void 0 && (this.ctx.fillStyle = n), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o), l === 0)
|
|
1562
1562
|
this.ctx.rect(t + 0.5, e + 0.5, i, s);
|
|
1563
1563
|
else {
|
|
1564
|
-
const [
|
|
1565
|
-
this.ctx.moveTo(t +
|
|
1564
|
+
const [h, d, f, x] = typeof l == "number" ? [l, l, l, l] : l;
|
|
1565
|
+
this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + h, e, h);
|
|
1566
1566
|
}
|
|
1567
1567
|
n !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1568
1568
|
}
|
|
@@ -1580,16 +1580,16 @@ class ei {
|
|
|
1580
1580
|
this.ctx.save();
|
|
1581
1581
|
const {
|
|
1582
1582
|
font: n = "12px Arial",
|
|
1583
|
-
align:
|
|
1584
|
-
color:
|
|
1583
|
+
align: l = "center",
|
|
1584
|
+
color: h = "#495060",
|
|
1585
1585
|
padding: d = 0,
|
|
1586
1586
|
verticalAlign: f = "middle"
|
|
1587
1587
|
} = o;
|
|
1588
|
-
this.ctx.font = n, this.ctx.fillStyle =
|
|
1588
|
+
this.ctx.font = n, this.ctx.fillStyle = h, this.ctx.textBaseline = f, this.ctx.textAlign = l;
|
|
1589
1589
|
let x = 0;
|
|
1590
1590
|
f === "top" ? x = i + d : f === "bottom" ? x = i + r - d : x = i + (r + d) / 2;
|
|
1591
1591
|
let u = 0;
|
|
1592
|
-
|
|
1592
|
+
l === "left" ? u = e + d : l === "right" ? u = e + s - d : u = e + s / 2;
|
|
1593
1593
|
const { _text: y, ellipsis: g } = this.handleEllipsis(t, s, d);
|
|
1594
1594
|
return this.ctx.fillText(y, u, x), this.ctx.restore(), g;
|
|
1595
1595
|
}
|
|
@@ -1603,10 +1603,10 @@ class ei {
|
|
|
1603
1603
|
const o = this.ctx.measureText("...").width, n = this.ctx.measureText(t).width;
|
|
1604
1604
|
if (n && n + o >= e - i * 2) {
|
|
1605
1605
|
s = !0;
|
|
1606
|
-
let
|
|
1607
|
-
for (let
|
|
1608
|
-
if (
|
|
1609
|
-
r = t.slice(0,
|
|
1606
|
+
let l = 0;
|
|
1607
|
+
for (let h = 0; h < t.length; h++)
|
|
1608
|
+
if (l += this.ctx.measureText(t[h]).width, l >= e - i * 2 - o) {
|
|
1609
|
+
r = t.slice(0, h) + "...";
|
|
1610
1610
|
break;
|
|
1611
1611
|
}
|
|
1612
1612
|
}
|
|
@@ -1681,6 +1681,8 @@ class Bt {
|
|
|
1681
1681
|
// 启用单点击立马编辑
|
|
1682
1682
|
c(this, "ENABLE_EDIT_TEXT_ENTER", !0);
|
|
1683
1683
|
// 启用文本编辑器回车键确认
|
|
1684
|
+
c(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1685
|
+
// 启用点击选择器编辑
|
|
1684
1686
|
c(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
1685
1687
|
c(this, "ENABLE_SELECTOR_SPAN_COL", !0);
|
|
1686
1688
|
c(this, "ENABLE_SELECTOR_SPAN_ROW", !0);
|
|
@@ -1827,15 +1829,15 @@ class ii {
|
|
|
1827
1829
|
}
|
|
1828
1830
|
async createImageFromSVG(t, e) {
|
|
1829
1831
|
const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
1830
|
-
e && r.querySelectorAll("*").forEach((
|
|
1831
|
-
|
|
1832
|
+
e && r.querySelectorAll("*").forEach((h) => {
|
|
1833
|
+
h.setAttribute("fill", e);
|
|
1832
1834
|
});
|
|
1833
1835
|
const o = new Image(), n = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1834
1836
|
type: "image/svg+xml"
|
|
1835
|
-
}),
|
|
1836
|
-
return o.src =
|
|
1837
|
+
}), l = URL.createObjectURL(n);
|
|
1838
|
+
return o.src = l, new Promise((h, d) => {
|
|
1837
1839
|
o.onerror = () => d(new Error("Failed to load image")), o.onload = () => {
|
|
1838
|
-
|
|
1840
|
+
h(o);
|
|
1839
1841
|
};
|
|
1840
1842
|
});
|
|
1841
1843
|
}
|
|
@@ -1881,8 +1883,8 @@ class Jt {
|
|
|
1881
1883
|
}
|
|
1882
1884
|
}
|
|
1883
1885
|
class Qt extends Jt {
|
|
1884
|
-
constructor(e, i, s, r, o, n,
|
|
1885
|
-
super(e, r, o, n,
|
|
1886
|
+
constructor(e, i, s, r, o, n, l, h, d, f = "body") {
|
|
1887
|
+
super(e, r, o, n, l, h.fixed, f);
|
|
1886
1888
|
c(this, "formatter");
|
|
1887
1889
|
c(this, "hoverIconName", "");
|
|
1888
1890
|
c(this, "align");
|
|
@@ -1927,7 +1929,7 @@ class Qt extends Jt {
|
|
|
1927
1929
|
c(this, "overflowTooltipShow", !0);
|
|
1928
1930
|
c(this, "overflowTooltipMaxWidth", 500);
|
|
1929
1931
|
c(this, "overflowTooltipPlacement", "top");
|
|
1930
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
1932
|
+
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 = f, this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level, this.column = h, this.rules = h.rules, this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.update();
|
|
1931
1933
|
}
|
|
1932
1934
|
getValidationMessage() {
|
|
1933
1935
|
const e = this.ctx.database.getValidationError(this.rowKey, this.key);
|
|
@@ -2021,13 +2023,13 @@ class Qt extends Jt {
|
|
|
2021
2023
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2022
2024
|
let r, o = 0, n = "";
|
|
2023
2025
|
if (this.type === "tree" && s === "body") {
|
|
2024
|
-
const
|
|
2026
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: x = 0 } = l || {};
|
|
2025
2027
|
if (f) {
|
|
2026
2028
|
const u = this.ctx.icons.get("loading");
|
|
2027
2029
|
n = "loading", r = u, o = x * 8;
|
|
2028
2030
|
} else if (d) {
|
|
2029
2031
|
const u = this.ctx.icons.get("expand"), y = this.ctx.icons.get("shrink");
|
|
2030
|
-
r =
|
|
2032
|
+
r = h ? y : u, n = h ? "shrink" : "expand", o = x * 8;
|
|
2031
2033
|
} else
|
|
2032
2034
|
o = x * 8;
|
|
2033
2035
|
if (r) {
|
|
@@ -2044,8 +2046,8 @@ class Qt extends Jt {
|
|
|
2044
2046
|
FOOTER_CELL_STYLE_METHOD: r,
|
|
2045
2047
|
READONLY_TEXT_COLOR: o,
|
|
2046
2048
|
FOOTER_BG_COLOR: n,
|
|
2047
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2048
|
-
HIGHLIGHT_SELECTED_ROW_COLOR:
|
|
2049
|
+
HIGHLIGHT_SELECTED_ROW: l,
|
|
2050
|
+
HIGHLIGHT_SELECTED_ROW_COLOR: h,
|
|
2049
2051
|
HIGHLIGHT_HOVER_ROW: d,
|
|
2050
2052
|
HIGHLIGHT_HOVER_ROW_COLOR: f
|
|
2051
2053
|
} = this.ctx.config;
|
|
@@ -2066,7 +2068,7 @@ class Qt extends Jt {
|
|
|
2066
2068
|
}
|
|
2067
2069
|
let x = "transparent";
|
|
2068
2070
|
const u = this.ctx.focusCell, y = this.ctx.hoverCell;
|
|
2069
|
-
d && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = f),
|
|
2071
|
+
d && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = f), l && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = h), this.drawCellSkyBgColor = x;
|
|
2070
2072
|
let g = e, w = o;
|
|
2071
2073
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2072
2074
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
@@ -2085,24 +2087,24 @@ class Qt extends Jt {
|
|
|
2085
2087
|
this.drawCellBgColor = g, this.drawTextColor = w;
|
|
2086
2088
|
}
|
|
2087
2089
|
updateSelection() {
|
|
2088
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex:
|
|
2090
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex: l, rowKey: h } = this;
|
|
2089
2091
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(n)) {
|
|
2090
|
-
const d = this.ctx.database.getRowSelection(
|
|
2092
|
+
const d = this.ctx.database.getRowSelection(h), f = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, y = this.drawY + (i - x) / 2;
|
|
2091
2093
|
let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
2092
|
-
d && f ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : d && f ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !d && f ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex ===
|
|
2094
|
+
d && f ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : d && f ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !d && f ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && 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);
|
|
2093
2095
|
}
|
|
2094
2096
|
}
|
|
2095
2097
|
updateHoverIcon() {
|
|
2096
2098
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2097
2099
|
if (typeof e == "function") {
|
|
2098
|
-
const
|
|
2100
|
+
const l = e({
|
|
2099
2101
|
row: this.row,
|
|
2100
2102
|
rowIndex: this.rowIndex,
|
|
2101
2103
|
colIndex: this.colIndex,
|
|
2102
2104
|
column: this.column,
|
|
2103
2105
|
value: this.getValue()
|
|
2104
2106
|
});
|
|
2105
|
-
|
|
2107
|
+
l !== void 0 && (this.hoverIconName = l);
|
|
2106
2108
|
}
|
|
2107
2109
|
const r = this.drawX + this.width - i - s, o = this.drawY + (this.height - i) / 2;
|
|
2108
2110
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
@@ -2219,8 +2221,8 @@ class Qt extends Jt {
|
|
|
2219
2221
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2220
2222
|
if (!s || !i)
|
|
2221
2223
|
return;
|
|
2222
|
-
const { xArr: r, yArr: o } = this.ctx.selector, n = r[1],
|
|
2223
|
-
|
|
2224
|
+
const { xArr: r, yArr: o } = this.ctx.selector, n = r[1], l = o[1], { colIndex: h, rowIndex: d, drawX: f, drawY: x } = this;
|
|
2225
|
+
h === n && d === l && this.ctx.paint.drawRect(f + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2224
2226
|
borderColor: "#fff",
|
|
2225
2227
|
fillColor: e
|
|
2226
2228
|
});
|
|
@@ -2274,32 +2276,32 @@ class Qt extends Jt {
|
|
|
2274
2276
|
});
|
|
2275
2277
|
}
|
|
2276
2278
|
drawBorder(e) {
|
|
2277
|
-
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: n } = this,
|
|
2278
|
-
let
|
|
2279
|
-
o === 0 && (
|
|
2279
|
+
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: n } = this, l = i + 0.5;
|
|
2280
|
+
let h = s + 0.5, d = this.height;
|
|
2281
|
+
o === 0 && (h = this.y + 1, d = d - 1);
|
|
2280
2282
|
const { xArr: f, yArr: x, lineDash: u = [], borderWidth: y = 1, borderColor: g, fillColor: w } = e, p = f[0], E = f[1], m = x[0], b = x[1];
|
|
2281
|
-
n >= p && n <= E && o === m && this.ctx.paint.drawLine([h, l
|
|
2283
|
+
n >= p && n <= E && o === m && this.ctx.paint.drawLine([l, h, l + r - 2, h], {
|
|
2282
2284
|
borderColor: g,
|
|
2283
2285
|
fillColor: w,
|
|
2284
2286
|
borderWidth: y,
|
|
2285
2287
|
lineCap: "round",
|
|
2286
2288
|
lineJoin: "round",
|
|
2287
2289
|
lineDash: u
|
|
2288
|
-
}), n >= p && n <= E && o === b && this.ctx.paint.drawLine([
|
|
2290
|
+
}), n >= p && n <= E && o === b && this.ctx.paint.drawLine([l, h + d - 1.5, l + r, h + d - 1.5], {
|
|
2289
2291
|
borderColor: g,
|
|
2290
2292
|
fillColor: w,
|
|
2291
2293
|
borderWidth: y,
|
|
2292
2294
|
lineCap: "round",
|
|
2293
2295
|
lineJoin: "round",
|
|
2294
2296
|
lineDash: u
|
|
2295
|
-
}), n === p && o >= m && o <= b && this.ctx.paint.drawLine([h, l, h
|
|
2297
|
+
}), n === p && o >= m && o <= b && this.ctx.paint.drawLine([l, h, l, h + d - 1], {
|
|
2296
2298
|
borderColor: g,
|
|
2297
2299
|
fillColor: w,
|
|
2298
2300
|
borderWidth: y,
|
|
2299
2301
|
lineCap: "round",
|
|
2300
2302
|
lineJoin: "round",
|
|
2301
2303
|
lineDash: u
|
|
2302
|
-
}), n === E && o >= m && o <= b && this.ctx.paint.drawLine([
|
|
2304
|
+
}), n === E && o >= m && o <= b && this.ctx.paint.drawLine([l + r - 1, h, l + r - 1, h + d - 1], {
|
|
2303
2305
|
borderColor: g,
|
|
2304
2306
|
fillColor: w,
|
|
2305
2307
|
borderWidth: y,
|
|
@@ -2310,8 +2312,8 @@ class Qt extends Jt {
|
|
|
2310
2312
|
}
|
|
2311
2313
|
}
|
|
2312
2314
|
class te extends Jt {
|
|
2313
|
-
constructor(e, i, s, r, o, n,
|
|
2314
|
-
super(e, s, r, o, n,
|
|
2315
|
+
constructor(e, i, s, r, o, n, l) {
|
|
2316
|
+
super(e, s, r, o, n, l.fixed, "header");
|
|
2315
2317
|
c(this, "align");
|
|
2316
2318
|
c(this, "verticalAlign", "middle");
|
|
2317
2319
|
c(this, "fixed");
|
|
@@ -2344,7 +2346,7 @@ class te extends Jt {
|
|
|
2344
2346
|
c(this, "drawImageHeight", 0);
|
|
2345
2347
|
c(this, "drawImageName", "");
|
|
2346
2348
|
c(this, "drawImageSource");
|
|
2347
|
-
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = n, this.colIndex = i, this.key =
|
|
2349
|
+
this.ctx = e, this.x = s, this.y = r, this.width = o, 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.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;
|
|
2348
2350
|
}
|
|
2349
2351
|
/**
|
|
2350
2352
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2364,11 +2366,11 @@ class te extends Jt {
|
|
|
2364
2366
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2365
2367
|
let r = i, o = s;
|
|
2366
2368
|
if (typeof e == "function") {
|
|
2367
|
-
const n = e, { backgroundColor:
|
|
2369
|
+
const n = e, { backgroundColor: l, color: h } = n({
|
|
2368
2370
|
colIndex: this.colIndex,
|
|
2369
2371
|
column: this.column
|
|
2370
2372
|
}) || {};
|
|
2371
|
-
|
|
2373
|
+
l && (r = l), h && (o = h);
|
|
2372
2374
|
}
|
|
2373
2375
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2374
2376
|
}
|
|
@@ -2379,11 +2381,11 @@ class te extends Jt {
|
|
|
2379
2381
|
const {
|
|
2380
2382
|
paint: e,
|
|
2381
2383
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2382
|
-
} = this.ctx, { drawX: o, drawY: n, displayText:
|
|
2384
|
+
} = this.ctx, { drawX: o, drawY: n, displayText: l } = this;
|
|
2383
2385
|
e.drawRect(o, n, this.width, this.height, {
|
|
2384
2386
|
borderColor: i,
|
|
2385
2387
|
fillColor: this.drawCellBgColor
|
|
2386
|
-
}), e.drawText(
|
|
2388
|
+
}), e.drawText(l, o, n, this.width, this.height, {
|
|
2387
2389
|
font: r,
|
|
2388
2390
|
padding: s,
|
|
2389
2391
|
color: this.drawTextColor,
|
|
@@ -2394,9 +2396,9 @@ class te extends Jt {
|
|
|
2394
2396
|
drawSelection() {
|
|
2395
2397
|
const { width: e, height: i, type: s } = this;
|
|
2396
2398
|
if (["index-selection", "selection"].includes(s)) {
|
|
2397
|
-
const { indeterminate: r, check: o, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE:
|
|
2399
|
+
const { indeterminate: r, check: o, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: l = 0 } = this.ctx.config, h = this.drawX + (e - l) / 2, d = this.drawY + (i - l) / 2;
|
|
2398
2400
|
let f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2399
|
-
r ? (f = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && n ? (f = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && n ? (f = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && n ? (f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (f = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), f && (this.drawImageX =
|
|
2401
|
+
r ? (f = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && n ? (f = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && n ? (f = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && n ? (f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (f = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), f && (this.drawImageX = h, this.drawImageY = d, this.drawImageWidth = l, this.drawImageHeight = l, this.drawImageName = x, this.drawImageSource = f, this.ctx.paint.drawImage(
|
|
2400
2402
|
this.drawImageSource,
|
|
2401
2403
|
this.drawImageX,
|
|
2402
2404
|
this.drawImageY,
|
|
@@ -2439,8 +2441,8 @@ class si {
|
|
|
2439
2441
|
return;
|
|
2440
2442
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2441
2443
|
for (const o of s) {
|
|
2442
|
-
const n = o.getDrawX(),
|
|
2443
|
-
if (i > n && i < n + o.width && e >
|
|
2444
|
+
const n = o.getDrawX(), l = o.getDrawY();
|
|
2445
|
+
if (i > n && i < n + o.width && e > l && e < l + o.height) {
|
|
2444
2446
|
this.ctx.focusCellHeader = o, this.ctx.emit("cellHeaderMousedown", o, t);
|
|
2445
2447
|
return;
|
|
2446
2448
|
}
|
|
@@ -2448,10 +2450,10 @@ class si {
|
|
|
2448
2450
|
const r = this.ctx.body.renderRows;
|
|
2449
2451
|
for (const o of r) {
|
|
2450
2452
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2451
|
-
for (const
|
|
2452
|
-
const
|
|
2453
|
-
if (i >
|
|
2454
|
-
this.ctx.setFocusCell(
|
|
2453
|
+
for (const l of n) {
|
|
2454
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
2455
|
+
if (i > h && i < h + l.width && e > d && e < d + l.height) {
|
|
2456
|
+
this.ctx.setFocusCell(l), this.ctx.emit("cellMousedown", l, t);
|
|
2455
2457
|
return;
|
|
2456
2458
|
}
|
|
2457
2459
|
}
|
|
@@ -2461,8 +2463,8 @@ class si {
|
|
|
2461
2463
|
return;
|
|
2462
2464
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2463
2465
|
for (const o of s) {
|
|
2464
|
-
const n = o.getDrawX(),
|
|
2465
|
-
if (i > n && i < n + o.width && e >
|
|
2466
|
+
const n = o.getDrawX(), l = o.getDrawY();
|
|
2467
|
+
if (i > n && i < n + o.width && e > l && e < l + o.height) {
|
|
2466
2468
|
this.ctx.clickCellHeader = o, this.ctx.emit("cellHeaderClick", o, t), this.selectionClick(o);
|
|
2467
2469
|
return;
|
|
2468
2470
|
}
|
|
@@ -2470,10 +2472,10 @@ class si {
|
|
|
2470
2472
|
const r = this.ctx.body.renderRows;
|
|
2471
2473
|
for (const o of r) {
|
|
2472
2474
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2473
|
-
for (const
|
|
2474
|
-
const
|
|
2475
|
-
if (i >
|
|
2476
|
-
this.ctx.clickCell =
|
|
2475
|
+
for (const l of n) {
|
|
2476
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
2477
|
+
if (i > h && i < h + l.width && e > d && e < d + l.height) {
|
|
2478
|
+
this.ctx.clickCell = l, this.ctx.emit("cellClick", l, t), this.selectionClick(l), this.treeClick(l);
|
|
2477
2479
|
return;
|
|
2478
2480
|
}
|
|
2479
2481
|
}
|
|
@@ -2483,8 +2485,8 @@ class si {
|
|
|
2483
2485
|
return;
|
|
2484
2486
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2485
2487
|
for (const o of s) {
|
|
2486
|
-
const n = o.getDrawX(),
|
|
2487
|
-
if (i > n && i < n + o.width && e >
|
|
2488
|
+
const n = o.getDrawX(), l = o.getDrawY();
|
|
2489
|
+
if (i > n && i < n + o.width && e > l && e < l + o.height) {
|
|
2488
2490
|
this.ctx.emit("cellHeaderContextMenuClick", o, t);
|
|
2489
2491
|
return;
|
|
2490
2492
|
}
|
|
@@ -2492,10 +2494,10 @@ class si {
|
|
|
2492
2494
|
const r = this.ctx.body.renderRows;
|
|
2493
2495
|
for (const o of r) {
|
|
2494
2496
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2495
|
-
for (const
|
|
2496
|
-
const
|
|
2497
|
-
if (i >
|
|
2498
|
-
this.ctx.emit("cellContextMenuClick",
|
|
2497
|
+
for (const l of n) {
|
|
2498
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
2499
|
+
if (i > h && i < h + l.width && e > d && e < d + l.height) {
|
|
2500
|
+
this.ctx.emit("cellContextMenuClick", l, t);
|
|
2499
2501
|
return;
|
|
2500
2502
|
}
|
|
2501
2503
|
}
|
|
@@ -2506,8 +2508,8 @@ class si {
|
|
|
2506
2508
|
return;
|
|
2507
2509
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2508
2510
|
for (const n of s) {
|
|
2509
|
-
const
|
|
2510
|
-
if (i >
|
|
2511
|
+
const l = n.getDrawX(), h = n.getDrawY();
|
|
2512
|
+
if (i > l && i < l + n.width && e > h && e < h + n.height) {
|
|
2511
2513
|
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)
|
|
2512
2514
|
return;
|
|
2513
2515
|
this.ctx.hoverCellHeader = n, this.ctx.emit("cellHeaderHoverChange", n);
|
|
@@ -2516,12 +2518,12 @@ class si {
|
|
|
2516
2518
|
}
|
|
2517
2519
|
const r = this.ctx.body.renderRows;
|
|
2518
2520
|
for (const n of r) {
|
|
2519
|
-
const
|
|
2520
|
-
for (const
|
|
2521
|
-
const d =
|
|
2522
|
-
if (i > d && i < d +
|
|
2523
|
-
if (this.ctx.emit("cellMouseenter",
|
|
2524
|
-
((o = this.ctx.hoverCell) == null ? void 0 : o.rowKey) !==
|
|
2521
|
+
const l = n.fixedCells.concat(n.noFixedCells);
|
|
2522
|
+
for (const h of l) {
|
|
2523
|
+
const d = h.getDrawX(), f = h.getDrawY();
|
|
2524
|
+
if (i > d && i < d + h.visibleWidth && e > f && e < f + 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 > d && i < d + h.width && e > f && e < f + h.height) {
|
|
2525
|
+
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;
|
|
2526
|
+
((o = this.ctx.hoverCell) == null ? void 0 : o.rowKey) !== h.rowKey && (this.ctx.hoverCell = h, this.ctx.hoverRow = this.ctx.body.renderRows.find((x) => x.rowKey === h.rowKey), this.ctx.emit("rowHoverChange", this.ctx.hoverRow, h, t), this.ctx.emit("draw")), this.ctx.hoverCell = h, this.ctx.emit("cellHoverChange", h, t);
|
|
2525
2527
|
return;
|
|
2526
2528
|
}
|
|
2527
2529
|
}
|
|
@@ -2556,10 +2558,10 @@ class si {
|
|
|
2556
2558
|
colIndex: t.colIndex,
|
|
2557
2559
|
column: t.column,
|
|
2558
2560
|
value: t.getValue()
|
|
2559
|
-
}).then((
|
|
2560
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2561
|
-
}).catch((
|
|
2562
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2561
|
+
}).then((l) => {
|
|
2562
|
+
this.ctx.database.setExpandChildren(t.rowKey, l), this.ctx.database.expandLoading(t.rowKey, !1);
|
|
2563
|
+
}).catch((l) => {
|
|
2564
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(l);
|
|
2563
2565
|
}));
|
|
2564
2566
|
else {
|
|
2565
2567
|
const n = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2713,7 +2715,7 @@ class ri {
|
|
|
2713
2715
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2714
2716
|
const o = [];
|
|
2715
2717
|
for (let n = 0; n <= i[1] - i[0]; n++) {
|
|
2716
|
-
const
|
|
2718
|
+
const l = r + e[0], h = n + i[0], d = this.database.getItemValueForRowIndexAndColIndex(l, h);
|
|
2717
2719
|
d && o.push(d.value);
|
|
2718
2720
|
}
|
|
2719
2721
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
@@ -2786,8 +2788,8 @@ class Wt {
|
|
|
2786
2788
|
// 滚动条的长度
|
|
2787
2789
|
c(this, "visibleDistance", 0);
|
|
2788
2790
|
//可见区域的长度
|
|
2789
|
-
c(this, "
|
|
2790
|
-
c(this, "
|
|
2791
|
+
c(this, "clientX", 0);
|
|
2792
|
+
c(this, "clientY", 0);
|
|
2791
2793
|
c(this, "dragStart", 0);
|
|
2792
2794
|
// 拖拽开始的位置
|
|
2793
2795
|
c(this, "isDragging", !1);
|
|
@@ -2798,26 +2800,26 @@ class Wt {
|
|
|
2798
2800
|
this.updateScroll(t);
|
|
2799
2801
|
}
|
|
2800
2802
|
onMouseDown(t) {
|
|
2801
|
-
const { offsetX: e, offsetY: i } = t;
|
|
2802
|
-
if (!(
|
|
2803
|
+
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2804
|
+
if (!(s == this.clientX && r == this.clientY)) {
|
|
2803
2805
|
if (this.isOnScrollbar(e, i))
|
|
2804
|
-
this.
|
|
2806
|
+
this.clientX = s, this.clientY = r, this.isDragging = !0, this.ctx.scrollerMove = !0, this.isFocus = !0, this.dragStart = this.scroll;
|
|
2805
2807
|
else if (this.isOnTrack(e, i)) {
|
|
2806
|
-
let
|
|
2807
|
-
this.type === "vertical" ?
|
|
2808
|
+
let o = 0;
|
|
2809
|
+
this.type === "vertical" ? o = (i - this.ctx.header.height - this.barHeight / 2) / (this.visibleDistance - this.barHeight) * this.distance : o = (e - this.barWidth / 2) / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(o, this.distance));
|
|
2808
2810
|
}
|
|
2809
2811
|
}
|
|
2810
2812
|
}
|
|
2811
2813
|
onMouseUp() {
|
|
2812
|
-
this.isDragging = !1, this.isFocus = !1, this.
|
|
2814
|
+
this.isDragging = !1, this.isFocus = !1, this.clientX = 0, this.clientY = 0;
|
|
2813
2815
|
}
|
|
2814
2816
|
onMouseMove(t) {
|
|
2815
|
-
const { offsetX: e, offsetY: i } = t;
|
|
2816
|
-
if (this.isOnScrollbar(e, i) && t.target === this.ctx.target ? this.isFocus = !0 : this.isFocus = !1,
|
|
2817
|
-
let
|
|
2818
|
-
if (this.type === "horizontal" ?
|
|
2819
|
-
let
|
|
2820
|
-
this.type === "vertical" ?
|
|
2817
|
+
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2818
|
+
if (this.isOnScrollbar(e, i) && t.target === this.ctx.target ? this.isFocus = !0 : this.isFocus = !1, s == this.clientX && r == this.clientY) return;
|
|
2819
|
+
let o = 0;
|
|
2820
|
+
if (this.type === "horizontal" ? o = s - this.clientX : o = r - this.clientY, this.isDragging && o !== 0) {
|
|
2821
|
+
let n = 0;
|
|
2822
|
+
this.type === "vertical" ? n = this.dragStart + o / (this.visibleDistance - this.barHeight) * this.distance : n = this.dragStart + o / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(n, this.distance));
|
|
2821
2823
|
}
|
|
2822
2824
|
}
|
|
2823
2825
|
isPointInElement(t, e, i, s, r, o) {
|
|
@@ -2830,29 +2832,28 @@ class Wt {
|
|
|
2830
2832
|
return this.isPointInElement(t, e, this.trackX, this.trackY, this.trackWidth, this.trackHeight);
|
|
2831
2833
|
}
|
|
2832
2834
|
updateScroll(t) {
|
|
2833
|
-
t.preventDefault();
|
|
2834
2835
|
const e = t.deltaX, i = t.deltaY;
|
|
2835
|
-
this.type === "vertical" && t.shiftKey === !1 ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.type === "horizontal" && (t.shiftKey ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.scroll = Math.max(0, Math.min(this.scroll + e, this.distance)));
|
|
2836
|
+
this.type === "vertical" && t.shiftKey === !1 ? (this.scroll === 0 && i < 0 || this.scroll === this.distance && i > 0 || t.preventDefault(), this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance))) : this.type === "horizontal" && (t.shiftKey ? (console.log("jinlai"), this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance))) : this.scroll = Math.max(0, Math.min(this.scroll + e, this.distance)));
|
|
2836
2837
|
}
|
|
2837
2838
|
updatedSize() {
|
|
2838
2839
|
const {
|
|
2839
2840
|
body: t,
|
|
2840
2841
|
header: e,
|
|
2841
2842
|
config: { SCROLLER_TRACK_SIZE: i = 0, SCROLLER_SIZE: s = 0 }
|
|
2842
|
-
} = this.ctx, r = this.ctx.target.width + 1, o = this.ctx.target.height, n = e.height,
|
|
2843
|
+
} = this.ctx, r = this.ctx.target.width + 1, o = this.ctx.target.height, n = e.height, l = e.width, h = t.height, d = this.ctx.footer.height;
|
|
2843
2844
|
if (this.type === "vertical") {
|
|
2844
|
-
this.visibleDistance = o - i - n, this.distance =
|
|
2845
|
-
const f = this.distance ? this.visibleDistance /
|
|
2845
|
+
this.visibleDistance = o - i - n, this.distance = h - this.visibleDistance + d, this.trackX = r - i, this.trackY = 0, this.splitPoints = [this.trackX, n, this.trackX + i, n], this.trackWidth = i, this.trackHeight = o, this.barX = this.trackX + (i - s) / 2, this.barWidth = s;
|
|
2846
|
+
const f = this.distance ? this.visibleDistance / h : 0;
|
|
2846
2847
|
let x = Math.floor(f * this.visibleDistance);
|
|
2847
2848
|
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));
|
|
2848
2849
|
} else {
|
|
2849
|
-
this.visibleDistance = r - i, this.distance =
|
|
2850
|
+
this.visibleDistance = r - i, this.distance = l - this.visibleDistance, this.splitPoints = [
|
|
2850
2851
|
r - i,
|
|
2851
2852
|
o - i,
|
|
2852
2853
|
r - i,
|
|
2853
2854
|
o
|
|
2854
2855
|
], this.trackX = 0, this.trackY = o - i, this.trackWidth = r, this.trackHeight = i;
|
|
2855
|
-
const f = this.distance ? this.visibleDistance /
|
|
2856
|
+
const f = this.distance ? this.visibleDistance / l : 0;
|
|
2856
2857
|
let x = Math.floor(f * this.visibleDistance);
|
|
2857
2858
|
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));
|
|
2858
2859
|
}
|
|
@@ -2990,17 +2991,17 @@ class ni {
|
|
|
2990
2991
|
const d = this.visibleWidth - this.width, f = Math.floor(d / this.resizeNum * 100) / 100;
|
|
2991
2992
|
this.resizeAllColumn(f);
|
|
2992
2993
|
}
|
|
2993
|
-
const
|
|
2994
|
+
const l = this.fixedLeftCellHeaders.filter(
|
|
2994
2995
|
(d) => !d.hasChildren
|
|
2995
2996
|
);
|
|
2996
|
-
this.ctx.fixedLeftWidth =
|
|
2997
|
+
this.ctx.fixedLeftWidth = l.reduce(
|
|
2997
2998
|
(d, f) => d + f.width,
|
|
2998
2999
|
0
|
|
2999
3000
|
);
|
|
3000
|
-
const
|
|
3001
|
+
const h = this.fixedRightCellHeaders.filter(
|
|
3001
3002
|
(d) => !d.hasChildren
|
|
3002
3003
|
);
|
|
3003
|
-
this.ctx.fixedRightWidth =
|
|
3004
|
+
this.ctx.fixedRightWidth = h.reduce(
|
|
3004
3005
|
(d, f) => d + f.width,
|
|
3005
3006
|
e
|
|
3006
3007
|
), 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;
|
|
@@ -3033,8 +3034,8 @@ class ni {
|
|
|
3033
3034
|
...this.renderCenterCellHeaders
|
|
3034
3035
|
];
|
|
3035
3036
|
for (const o of r) {
|
|
3036
|
-
const n = e.layerX,
|
|
3037
|
-
n >
|
|
3037
|
+
const n = e.layerX, l = o.getDrawX();
|
|
3038
|
+
n > l + o.width - 5 && n < l + o.width + 4 && n < i.width - 4 && // 视窗中最后一列不允许调整宽
|
|
3038
3039
|
o.colspan <= 1 && e.target instanceof HTMLCanvasElement && this.ctx.isTarget(e.target) && e.layerY <= this.height && (this.ctx.target.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3039
3040
|
}
|
|
3040
3041
|
}
|
|
@@ -3089,16 +3090,16 @@ class ni {
|
|
|
3089
3090
|
let s = e;
|
|
3090
3091
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3091
3092
|
for (let o = 0; o < i; o++) {
|
|
3092
|
-
const n = t[o],
|
|
3093
|
+
const n = t[o], l = r * (n.rowspan || 1), h = r * n.level;
|
|
3093
3094
|
let d = n.width || 100;
|
|
3094
3095
|
n.children && (d = It(n.children).reduce((u, y) => u + ((y == null ? void 0 : y.width) || 100), 0));
|
|
3095
3096
|
const f = new te(
|
|
3096
3097
|
this.ctx,
|
|
3097
3098
|
this.columnIndex,
|
|
3098
3099
|
s,
|
|
3099
|
-
l,
|
|
3100
|
-
d,
|
|
3101
3100
|
h,
|
|
3101
|
+
d,
|
|
3102
|
+
l,
|
|
3102
3103
|
n
|
|
3103
3104
|
);
|
|
3104
3105
|
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;
|
|
@@ -3132,8 +3133,8 @@ class ni {
|
|
|
3132
3133
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3133
3134
|
colorEnd: "rgba(0,0,0,0)"
|
|
3134
3135
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3135
|
-
const
|
|
3136
|
-
this.ctx.paint.drawShadow(
|
|
3136
|
+
const l = s.width - (this.x + this.width) + r.width - e;
|
|
3137
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3137
3138
|
fillColor: o,
|
|
3138
3139
|
side: "left",
|
|
3139
3140
|
shadowWidth: 4,
|
|
@@ -3167,7 +3168,7 @@ class ni {
|
|
|
3167
3168
|
}
|
|
3168
3169
|
}
|
|
3169
3170
|
class ee {
|
|
3170
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0, n,
|
|
3171
|
+
constructor(t, e, i = 0, s = 0, r = 0, o = 0, n, l = "body") {
|
|
3171
3172
|
c(this, "ctx");
|
|
3172
3173
|
c(this, "x", 0);
|
|
3173
3174
|
c(this, "y", 0);
|
|
@@ -3180,7 +3181,7 @@ class ee {
|
|
|
3180
3181
|
c(this, "rowKey", "");
|
|
3181
3182
|
c(this, "rowType", "body");
|
|
3182
3183
|
c(this, "data");
|
|
3183
|
-
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType =
|
|
3184
|
+
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType = l, this.data = n, this.update();
|
|
3184
3185
|
}
|
|
3185
3186
|
update() {
|
|
3186
3187
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
@@ -3254,8 +3255,8 @@ class ai {
|
|
|
3254
3255
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3255
3256
|
BORDER_COLOR: o,
|
|
3256
3257
|
BORDER_RADIUS: n,
|
|
3257
|
-
HEIGHT:
|
|
3258
|
-
EMPTY_BODY_HEIGHT:
|
|
3258
|
+
HEIGHT: l,
|
|
3259
|
+
EMPTY_BODY_HEIGHT: h = 0,
|
|
3259
3260
|
MAX_HEIGHT: d = 0,
|
|
3260
3261
|
ENABLE_OFFSET_HEIGHT: f = 0,
|
|
3261
3262
|
OFFSET_HEIGHT: x = 0
|
|
@@ -3269,7 +3270,7 @@ class ai {
|
|
|
3269
3270
|
const { top: g } = t.getBoundingClientRect();
|
|
3270
3271
|
this.width = e.width, this.visibleWidth = t.width - r;
|
|
3271
3272
|
const w = this.ctx.footer.height;
|
|
3272
|
-
this.data.length || (this.height =
|
|
3273
|
+
this.data.length || (this.height = h);
|
|
3273
3274
|
const p = this.data.length ? "not-empty" : "empty";
|
|
3274
3275
|
this.ctx.emit("emptyChange", {
|
|
3275
3276
|
isEmpty: p,
|
|
@@ -3278,14 +3279,14 @@ class ai {
|
|
|
3278
3279
|
bodyHeight: this.height,
|
|
3279
3280
|
footerHeight: w,
|
|
3280
3281
|
width: this.width,
|
|
3281
|
-
height: this.data.length ? 0 :
|
|
3282
|
+
height: this.data.length ? 0 : h + w
|
|
3282
3283
|
});
|
|
3283
3284
|
let E = this.height + e.height + r;
|
|
3284
3285
|
E += w;
|
|
3285
3286
|
let m = 0;
|
|
3286
3287
|
this.data.length && f ? (m = window.innerHeight - g - x, m < 0 && (m = 32, console.error(
|
|
3287
3288
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3288
|
-
))) : this.data.length &&
|
|
3289
|
+
))) : this.data.length && l ? m = l : this.data.length && d && E > d ? m = d : m = E, m > 0 && (this.ctx.target.height = m);
|
|
3289
3290
|
let b = t.height - e.height - r;
|
|
3290
3291
|
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(
|
|
3291
3292
|
"style",
|
|
@@ -3298,9 +3299,11 @@ class ai {
|
|
|
3298
3299
|
config: { ENABLE_RESIZE_ROW: t }
|
|
3299
3300
|
} = this.ctx;
|
|
3300
3301
|
t && (this.ctx.on("mouseup", () => {
|
|
3301
|
-
this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeRow(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.resizeDiff = 0, this.isResizing = !1,
|
|
3302
|
+
this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeRow(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.resizeDiff = 0, this.isResizing = !1, setTimeout(() => {
|
|
3303
|
+
this.ctx.rowResizing = !1;
|
|
3304
|
+
}, 0), this.offsetY = 0;
|
|
3302
3305
|
}), this.ctx.on("mousedown", (e) => {
|
|
3303
|
-
this.ctx.isTarget(e.target) && (this.offsetY = e.offsetY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : this.isResizing = !1, this.isMouseDown = !0);
|
|
3306
|
+
this.ctx.isTarget(e.target) && (this.offsetY = e.offsetY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : (this.isResizing = !1, this.ctx.rowResizing = !1), this.isMouseDown = !0);
|
|
3304
3307
|
}), this.ctx.on("mousemove", (e) => {
|
|
3305
3308
|
if (this.ctx.editing) return;
|
|
3306
3309
|
const i = e.offsetY, s = e.offsetX, {
|
|
@@ -3309,19 +3312,19 @@ class ai {
|
|
|
3309
3312
|
config: { RESIZE_ROW_MIN_HEIGHT: n = 0 }
|
|
3310
3313
|
} = this.ctx;
|
|
3311
3314
|
if (this.isResizing && this.resizeTarget) {
|
|
3312
|
-
const
|
|
3313
|
-
let
|
|
3314
|
-
|
|
3315
|
+
const l = this.resizeTarget.height;
|
|
3316
|
+
let h = i - this.offsetY;
|
|
3317
|
+
h + l < n && (h = -(l - n)), this.resizeDiff = h, this.ctx.emit("draw");
|
|
3315
3318
|
} else {
|
|
3316
3319
|
if (this.resizeTarget = null, this.isMouseDown || this.ctx.target.style.cursor === "crosshair")
|
|
3317
3320
|
return;
|
|
3318
3321
|
this.ctx.target.style.cursor === "row-resize" && (this.ctx.target.style.cursor = "default");
|
|
3319
|
-
for (let
|
|
3320
|
-
const
|
|
3321
|
-
if (i >
|
|
3322
|
-
for (let f = 0; f <
|
|
3323
|
-
const x =
|
|
3324
|
-
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget =
|
|
3322
|
+
for (let l = 0; l < this.renderRows.length; l++) {
|
|
3323
|
+
const h = this.renderRows[l];
|
|
3324
|
+
if (i > h.y - o + h.height - 1.5 && i < h.y - o + h.height + 1.5 && i < r.height - 4)
|
|
3325
|
+
for (let f = 0; f < h.cells.length; f++) {
|
|
3326
|
+
const x = h.cells[f];
|
|
3327
|
+
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget = h);
|
|
3325
3328
|
}
|
|
3326
3329
|
}
|
|
3327
3330
|
}
|
|
@@ -3367,8 +3370,8 @@ class ai {
|
|
|
3367
3370
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3368
3371
|
colorEnd: "rgba(0,0,0,0)"
|
|
3369
3372
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3370
|
-
const
|
|
3371
|
-
this.ctx.paint.drawShadow(
|
|
3373
|
+
const l = s.width - (this.x + this.width) + r.width - e;
|
|
3374
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3372
3375
|
fillColor: o,
|
|
3373
3376
|
side: "left",
|
|
3374
3377
|
shadowWidth: 4,
|
|
@@ -3392,14 +3395,14 @@ class ai {
|
|
|
3392
3395
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3393
3396
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3394
3397
|
const n = this.binarySearch(o, s);
|
|
3395
|
-
let
|
|
3396
|
-
|
|
3397
|
-
const
|
|
3398
|
+
let l = this.binarySearch(o, s + this.visibleHeight);
|
|
3399
|
+
l === -1 && (l = r.length), this.headIndex = Math.max(0, n), this.tailIndex = Math.min(this.ctx.maxRowIndex, l + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3400
|
+
const h = [];
|
|
3398
3401
|
for (let d = 0; d < this.visibleRows.length; d++) {
|
|
3399
3402
|
const f = this.headIndex + d, x = this.visibleRows[d], { height: u, top: y } = this.ctx.database.getPositionForRowIndex(f), g = new ee(this.ctx, f, 0, y + this.y, t.width, u, x);
|
|
3400
|
-
|
|
3403
|
+
h.push(g);
|
|
3401
3404
|
}
|
|
3402
|
-
this.renderRows =
|
|
3405
|
+
this.renderRows = h, this.ctx.body.renderRows = h;
|
|
3403
3406
|
}
|
|
3404
3407
|
draw() {
|
|
3405
3408
|
this.renderRows.forEach((t) => {
|
|
@@ -3440,16 +3443,16 @@ class ci {
|
|
|
3440
3443
|
target: r,
|
|
3441
3444
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: n }
|
|
3442
3445
|
} = this.ctx;
|
|
3443
|
-
let
|
|
3444
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3446
|
+
let l = this.y;
|
|
3447
|
+
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, {
|
|
3445
3448
|
fillColor: o,
|
|
3446
3449
|
side: "right",
|
|
3447
3450
|
shadowWidth: 4,
|
|
3448
3451
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3449
3452
|
colorEnd: "rgba(0,0,0,0)"
|
|
3450
3453
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3451
|
-
const
|
|
3452
|
-
this.ctx.paint.drawShadow(
|
|
3454
|
+
const h = s.width - (this.x + this.width) + r.width - e;
|
|
3455
|
+
this.ctx.paint.drawShadow(h + 1, l, e, this.height, {
|
|
3453
3456
|
fillColor: o,
|
|
3454
3457
|
side: "left",
|
|
3455
3458
|
shadowWidth: 4,
|
|
@@ -3485,7 +3488,7 @@ class ci {
|
|
|
3485
3488
|
});
|
|
3486
3489
|
}
|
|
3487
3490
|
}
|
|
3488
|
-
class
|
|
3491
|
+
class li {
|
|
3489
3492
|
// 垂直滚动定时器
|
|
3490
3493
|
constructor(t) {
|
|
3491
3494
|
c(this, "isCut", !1);
|
|
@@ -3615,8 +3618,8 @@ class hi {
|
|
|
3615
3618
|
return;
|
|
3616
3619
|
const { ENABLE_SELECTOR_ALL_ROWS: t, ENABLE_SELECTOR_ALL_COLS: e } = this.ctx.config;
|
|
3617
3620
|
if (t && e) {
|
|
3618
|
-
const s = this.ctx.maxColIndex, r = 0, o = this.ctx.maxRowIndex, n = [1, s],
|
|
3619
|
-
this.setSelector(n,
|
|
3621
|
+
const s = this.ctx.maxColIndex, r = 0, o = this.ctx.maxRowIndex, n = [1, s], l = [r, o];
|
|
3622
|
+
this.setSelector(n, l);
|
|
3620
3623
|
}
|
|
3621
3624
|
}
|
|
3622
3625
|
selectRows(t, e = !0) {
|
|
@@ -3644,7 +3647,7 @@ class hi {
|
|
|
3644
3647
|
return;
|
|
3645
3648
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3646
3649
|
if (t && e && i) {
|
|
3647
|
-
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), n = Math.max(i.colIndex, r),
|
|
3650
|
+
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), n = Math.max(i.colIndex, r), l = Math.min(i.rowIndex, s), h = Math.max(i.rowIndex, s), d = [o, n], f = [l, h];
|
|
3648
3651
|
this.setSelector(d, f);
|
|
3649
3652
|
}
|
|
3650
3653
|
}
|
|
@@ -3652,7 +3655,7 @@ class hi {
|
|
|
3652
3655
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3653
3656
|
if (e)
|
|
3654
3657
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3655
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e,
|
|
3658
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e, l = Math.min(o, s), h = Math.max(o, s), d = Math.min(n, r), f = Math.max(n, r), x = [l, h], u = [d, f];
|
|
3656
3659
|
this.setSelector(x, u);
|
|
3657
3660
|
} else {
|
|
3658
3661
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3689,8 +3692,8 @@ class hi {
|
|
|
3689
3692
|
let s = [];
|
|
3690
3693
|
const r = /* @__PURE__ */ new Set();
|
|
3691
3694
|
for (let n = 0; n <= e[1] - e[0]; n++)
|
|
3692
|
-
for (let
|
|
3693
|
-
const
|
|
3695
|
+
for (let l = 0; l <= t[1] - t[0]; l++) {
|
|
3696
|
+
const h = n + e[0], d = l + t[0], f = this.ctx.database.getItemValueForRowIndexAndColIndex(h, d);
|
|
3694
3697
|
if (f) {
|
|
3695
3698
|
const { rowKey: x, key: u } = f;
|
|
3696
3699
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
@@ -3725,7 +3728,7 @@ class hi {
|
|
|
3725
3728
|
const n = r.split("\r");
|
|
3726
3729
|
n.length === 1 ? o = n[0].split(`
|
|
3727
3730
|
`).map((f) => f.split(" ")) : o = n.map((d) => d.split(" "));
|
|
3728
|
-
let
|
|
3731
|
+
let l = [];
|
|
3729
3732
|
for (let d = 0; d <= o.length - 1; d++) {
|
|
3730
3733
|
const f = o[d].length;
|
|
3731
3734
|
for (let x = 0; x <= f - 1; x++) {
|
|
@@ -3735,7 +3738,7 @@ class hi {
|
|
|
3735
3738
|
);
|
|
3736
3739
|
if (w) {
|
|
3737
3740
|
const { rowKey: p, key: E } = w;
|
|
3738
|
-
this.ctx.database.getReadonly(p, E) || (s.add(p),
|
|
3741
|
+
this.ctx.database.getReadonly(p, E) || (s.add(p), l.push({
|
|
3739
3742
|
rowKey: p,
|
|
3740
3743
|
key: E,
|
|
3741
3744
|
value: g,
|
|
@@ -3751,18 +3754,18 @@ class hi {
|
|
|
3751
3754
|
this.ctx.selector.yArrCopy,
|
|
3752
3755
|
!0
|
|
3753
3756
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3754
|
-
), f =
|
|
3757
|
+
), f = l.map((x) => `${x.rowKey}-${x.key}`);
|
|
3755
3758
|
d.forEach((x) => {
|
|
3756
|
-
f.includes(`${x.rowKey}-${x.key}`) ||
|
|
3759
|
+
f.includes(`${x.rowKey}-${x.key}`) || l.unshift(x);
|
|
3757
3760
|
}), this.isCut = !1;
|
|
3758
3761
|
}
|
|
3759
|
-
if (!
|
|
3762
|
+
if (!l.length)
|
|
3760
3763
|
return;
|
|
3761
|
-
this.ctx.database.batchSetItemValue(
|
|
3762
|
-
let
|
|
3764
|
+
this.ctx.database.batchSetItemValue(l, !0);
|
|
3765
|
+
let h = [];
|
|
3763
3766
|
s.forEach((d) => {
|
|
3764
|
-
|
|
3765
|
-
}), this.ctx.emit("pasteChange",
|
|
3767
|
+
h.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
3768
|
+
}), this.ctx.emit("pasteChange", l, h), this.clearCopyLine(), this.ctx.emit("draw");
|
|
3766
3769
|
}).catch((r) => {
|
|
3767
3770
|
console.error("获取剪贴板内容失败:", r);
|
|
3768
3771
|
});
|
|
@@ -3778,7 +3781,7 @@ class hi {
|
|
|
3778
3781
|
if (!e)
|
|
3779
3782
|
return;
|
|
3780
3783
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3781
|
-
const r = 0, o = 0, n = this.ctx.maxColIndex,
|
|
3784
|
+
const r = 0, o = 0, n = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
3782
3785
|
switch (t) {
|
|
3783
3786
|
case "LEFT":
|
|
3784
3787
|
i > r && i--;
|
|
@@ -3790,16 +3793,16 @@ class hi {
|
|
|
3790
3793
|
i < n && i++;
|
|
3791
3794
|
break;
|
|
3792
3795
|
case "BOTTOM":
|
|
3793
|
-
s <
|
|
3796
|
+
s < l && s++;
|
|
3794
3797
|
break;
|
|
3795
3798
|
}
|
|
3796
|
-
const
|
|
3799
|
+
const h = [i, i], d = [s, s], f = this.getCell(s, i);
|
|
3797
3800
|
if (f) {
|
|
3798
3801
|
if (["index", "index-selection", "selection"].includes(f.type))
|
|
3799
3802
|
return;
|
|
3800
3803
|
this.ctx.setFocusCell(f);
|
|
3801
3804
|
}
|
|
3802
|
-
this.setSelector(
|
|
3805
|
+
this.setSelector(h, d), this.adjustBoundaryPosition(), this.ctx.emit("draw");
|
|
3803
3806
|
}
|
|
3804
3807
|
stopAdjustPosition() {
|
|
3805
3808
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3815,8 +3818,8 @@ class hi {
|
|
|
3815
3818
|
let n = 10 * (s === "left" ? -1 : 1);
|
|
3816
3819
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3817
3820
|
n *= 1.5;
|
|
3818
|
-
const { scrollX:
|
|
3819
|
-
(
|
|
3821
|
+
const { scrollX: l } = this.ctx, h = l + n;
|
|
3822
|
+
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
3820
3823
|
}, 100);
|
|
3821
3824
|
}
|
|
3822
3825
|
if (r && this.adjustPositionY !== r) {
|
|
@@ -3824,8 +3827,8 @@ class hi {
|
|
|
3824
3827
|
let n = 10 * (r === "top" ? -1 : 1);
|
|
3825
3828
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3826
3829
|
n *= 1.5;
|
|
3827
|
-
const { scrollY:
|
|
3828
|
-
(
|
|
3830
|
+
const { scrollY: l } = this.ctx, h = l + n;
|
|
3831
|
+
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
3829
3832
|
}, 100);
|
|
3830
3833
|
}
|
|
3831
3834
|
}
|
|
@@ -3833,20 +3836,20 @@ class hi {
|
|
|
3833
3836
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
3834
3837
|
*/
|
|
3835
3838
|
adjustBoundaryPosition() {
|
|
3836
|
-
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: r, footer: o, scrollX: n, scrollY:
|
|
3839
|
+
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: r, footer: o, scrollX: n, scrollY: l } = this.ctx;
|
|
3837
3840
|
if (!e)
|
|
3838
3841
|
return;
|
|
3839
|
-
const { SCROLLER_TRACK_SIZE:
|
|
3842
|
+
const { SCROLLER_TRACK_SIZE: h = 0, FOOTER_FIXED: d } = this.ctx.config;
|
|
3840
3843
|
let f = 0;
|
|
3841
3844
|
d && (f = o.visibleHeight);
|
|
3842
|
-
const x = s - e.drawX + 1, u = e.drawX + e.width - (t.width - i) + 1, y = r.height - e.drawY, g = e.drawY + e.height - (t.height - f -
|
|
3843
|
-
u > 0 && !e.fixed ? this.ctx.setScrollX(n + u) : x > 0 && !e.fixed && this.ctx.setScrollX(n - x), y > 0 ? this.ctx.setScrollY(
|
|
3845
|
+
const x = s - e.drawX + 1, u = e.drawX + e.width - (t.width - i) + 1, y = r.height - e.drawY, g = e.drawY + e.height - (t.height - f - h);
|
|
3846
|
+
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);
|
|
3844
3847
|
}
|
|
3845
3848
|
destroy() {
|
|
3846
3849
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
3847
3850
|
}
|
|
3848
3851
|
}
|
|
3849
|
-
class
|
|
3852
|
+
class hi {
|
|
3850
3853
|
constructor(t) {
|
|
3851
3854
|
c(this, "ctx");
|
|
3852
3855
|
this.ctx = t, this.init();
|
|
@@ -3854,9 +3857,9 @@ class li {
|
|
|
3854
3857
|
init() {
|
|
3855
3858
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3856
3859
|
this.ctx.target.style.cursor === "crosshair" && (this.ctx.target.style.cursor = "default");
|
|
3857
|
-
const { xArr: i, yArr: s } = this.ctx.selector, r = i[1], o = s[1], { colIndex: n, rowIndex:
|
|
3858
|
-
if (this.ctx.config.ENABLE_AUTOFILL && n === r &&
|
|
3859
|
-
const y =
|
|
3860
|
+
const { xArr: i, yArr: s } = this.ctx.selector, r = i[1], o = s[1], { colIndex: n, rowIndex: l, drawX: h, drawY: d, width: f, height: x } = t;
|
|
3861
|
+
if (this.ctx.config.ENABLE_AUTOFILL && n === r && l === o) {
|
|
3862
|
+
const y = h + f - 6, g = d + x - 6;
|
|
3860
3863
|
e.offsetX > y && e.offsetY > g && (this.ctx.target.style.cursor = "crosshair");
|
|
3861
3864
|
}
|
|
3862
3865
|
this.mouseenter(t);
|
|
@@ -3892,12 +3895,12 @@ class li {
|
|
|
3892
3895
|
return;
|
|
3893
3896
|
let o = t, n = e;
|
|
3894
3897
|
if (!r) {
|
|
3895
|
-
const [
|
|
3896
|
-
n = [
|
|
3898
|
+
const [l] = n;
|
|
3899
|
+
n = [l, l];
|
|
3897
3900
|
}
|
|
3898
3901
|
if (!s) {
|
|
3899
|
-
const [
|
|
3900
|
-
o = [
|
|
3902
|
+
const [l] = o;
|
|
3903
|
+
o = [l, l];
|
|
3901
3904
|
}
|
|
3902
3905
|
(JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(n)) && (this.ctx.autofill.xArr = o, this.ctx.autofill.yArr = n, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw"));
|
|
3903
3906
|
}
|
|
@@ -3911,17 +3914,17 @@ class li {
|
|
|
3911
3914
|
const u = f + e.yArr[0], y = x + e.xArr[0];
|
|
3912
3915
|
i.set(`${u}-${y}`, !0);
|
|
3913
3916
|
}
|
|
3914
|
-
const { value: s } = e, r = s[0].length, o = s.length, n = this.ctx.autofill.xArr,
|
|
3915
|
-
let
|
|
3916
|
-
for (let f = 0; f <=
|
|
3917
|
+
const { value: s } = e, r = s[0].length, o = s.length, n = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr;
|
|
3918
|
+
let h = [];
|
|
3919
|
+
for (let f = 0; f <= l[1] - l[0]; f++)
|
|
3917
3920
|
for (let x = 0; x <= n[1] - n[0]; x++) {
|
|
3918
|
-
const u = x + n[0], y = f +
|
|
3921
|
+
const u = x + n[0], y = f + l[0], g = s[f % o][x % r], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3919
3922
|
y,
|
|
3920
3923
|
u
|
|
3921
3924
|
), p = `${y}-${u}`;
|
|
3922
3925
|
if (w && !i.has(p)) {
|
|
3923
3926
|
const { rowKey: E, key: m } = w;
|
|
3924
|
-
this.ctx.database.getReadonly(E, m) || (t.add(E),
|
|
3927
|
+
this.ctx.database.getReadonly(E, m) || (t.add(E), h.push({
|
|
3925
3928
|
rowKey: E,
|
|
3926
3929
|
key: m,
|
|
3927
3930
|
value: g,
|
|
@@ -3929,13 +3932,13 @@ class li {
|
|
|
3929
3932
|
}));
|
|
3930
3933
|
}
|
|
3931
3934
|
}
|
|
3932
|
-
if (!
|
|
3935
|
+
if (!h.length)
|
|
3933
3936
|
return;
|
|
3934
|
-
this.ctx.database.batchSetItemValue(
|
|
3937
|
+
this.ctx.database.batchSetItemValue(h, !0);
|
|
3935
3938
|
let d = [];
|
|
3936
3939
|
t.forEach((f) => {
|
|
3937
3940
|
d.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
3938
|
-
}), this.ctx.emit("autofillChange",
|
|
3941
|
+
}), this.ctx.emit("autofillChange", h, d), this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.emit("draw");
|
|
3939
3942
|
}
|
|
3940
3943
|
mouseenter(t) {
|
|
3941
3944
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4059,9 +4062,9 @@ function Pt(a, t, e) {
|
|
|
4059
4062
|
reference: i,
|
|
4060
4063
|
floating: s
|
|
4061
4064
|
} = a;
|
|
4062
|
-
const r = J(t), o = Mt(t), n = Ht(o),
|
|
4065
|
+
const r = J(t), o = Mt(t), n = Ht(o), l = q(t), h = r === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, x = i[n] / 2 - s[n] / 2;
|
|
4063
4066
|
let u;
|
|
4064
|
-
switch (
|
|
4067
|
+
switch (l) {
|
|
4065
4068
|
case "top":
|
|
4066
4069
|
u = {
|
|
4067
4070
|
x: d,
|
|
@@ -4094,10 +4097,10 @@ function Pt(a, t, e) {
|
|
|
4094
4097
|
}
|
|
4095
4098
|
switch (ct(t)) {
|
|
4096
4099
|
case "start":
|
|
4097
|
-
u[o] -= x * (e &&
|
|
4100
|
+
u[o] -= x * (e && h ? -1 : 1);
|
|
4098
4101
|
break;
|
|
4099
4102
|
case "end":
|
|
4100
|
-
u[o] += x * (e &&
|
|
4103
|
+
u[o] += x * (e && h ? -1 : 1);
|
|
4101
4104
|
break;
|
|
4102
4105
|
}
|
|
4103
4106
|
return u;
|
|
@@ -4108,15 +4111,15 @@ const yi = async (a, t, e) => {
|
|
|
4108
4111
|
strategy: s = "absolute",
|
|
4109
4112
|
middleware: r = [],
|
|
4110
4113
|
platform: o
|
|
4111
|
-
} = e, n = r.filter(Boolean),
|
|
4112
|
-
let
|
|
4114
|
+
} = e, n = r.filter(Boolean), l = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4115
|
+
let h = await o.getElementRects({
|
|
4113
4116
|
reference: a,
|
|
4114
4117
|
floating: t,
|
|
4115
4118
|
strategy: s
|
|
4116
4119
|
}), {
|
|
4117
4120
|
x: d,
|
|
4118
4121
|
y: f
|
|
4119
|
-
} = Pt(
|
|
4122
|
+
} = Pt(h, i, l), x = i, u = {}, y = 0;
|
|
4120
4123
|
for (let g = 0; g < n.length; g++) {
|
|
4121
4124
|
const {
|
|
4122
4125
|
name: w,
|
|
@@ -4133,7 +4136,7 @@ const yi = async (a, t, e) => {
|
|
|
4133
4136
|
placement: x,
|
|
4134
4137
|
strategy: s,
|
|
4135
4138
|
middlewareData: u,
|
|
4136
|
-
rects:
|
|
4139
|
+
rects: h,
|
|
4137
4140
|
platform: o,
|
|
4138
4141
|
elements: {
|
|
4139
4142
|
reference: a,
|
|
@@ -4146,14 +4149,14 @@ const yi = async (a, t, e) => {
|
|
|
4146
4149
|
...u[w],
|
|
4147
4150
|
...b
|
|
4148
4151
|
}
|
|
4149
|
-
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (
|
|
4152
|
+
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await o.getElementRects({
|
|
4150
4153
|
reference: a,
|
|
4151
4154
|
floating: t,
|
|
4152
4155
|
strategy: s
|
|
4153
4156
|
}) : C.rects), {
|
|
4154
4157
|
x: d,
|
|
4155
4158
|
y: f
|
|
4156
|
-
} = Pt(
|
|
4159
|
+
} = Pt(h, x, l)), g = -1);
|
|
4157
4160
|
}
|
|
4158
4161
|
return {
|
|
4159
4162
|
x: d,
|
|
@@ -4172,18 +4175,18 @@ async function re(a, t) {
|
|
|
4172
4175
|
platform: r,
|
|
4173
4176
|
rects: o,
|
|
4174
4177
|
elements: n,
|
|
4175
|
-
strategy:
|
|
4178
|
+
strategy: l
|
|
4176
4179
|
} = a, {
|
|
4177
|
-
boundary:
|
|
4180
|
+
boundary: h = "clippingAncestors",
|
|
4178
4181
|
rootBoundary: d = "viewport",
|
|
4179
4182
|
elementContext: f = "floating",
|
|
4180
4183
|
altBoundary: x = !1,
|
|
4181
4184
|
padding: u = 0
|
|
4182
4185
|
} = at(t, a), y = se(u), w = n[x ? f === "floating" ? "reference" : "floating" : f], p = ut(await r.getClippingRect({
|
|
4183
4186
|
element: (e = await (r.isElement == null ? void 0 : r.isElement(w))) == null || e ? w : w.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(n.floating)),
|
|
4184
|
-
boundary:
|
|
4187
|
+
boundary: h,
|
|
4185
4188
|
rootBoundary: d,
|
|
4186
|
-
strategy:
|
|
4189
|
+
strategy: l
|
|
4187
4190
|
})), E = f === "floating" ? {
|
|
4188
4191
|
x: i,
|
|
4189
4192
|
y: s,
|
|
@@ -4199,7 +4202,7 @@ async function re(a, t) {
|
|
|
4199
4202
|
elements: n,
|
|
4200
4203
|
rect: E,
|
|
4201
4204
|
offsetParent: m,
|
|
4202
|
-
strategy:
|
|
4205
|
+
strategy: l
|
|
4203
4206
|
}) : E);
|
|
4204
4207
|
return {
|
|
4205
4208
|
top: (p.top - C.top + y.top) / b.y,
|
|
@@ -4219,20 +4222,20 @@ const mi = (a) => ({
|
|
|
4219
4222
|
rects: r,
|
|
4220
4223
|
platform: o,
|
|
4221
4224
|
elements: n,
|
|
4222
|
-
middlewareData:
|
|
4225
|
+
middlewareData: l
|
|
4223
4226
|
} = t, {
|
|
4224
|
-
element:
|
|
4227
|
+
element: h,
|
|
4225
4228
|
padding: d = 0
|
|
4226
4229
|
} = at(a, t) || {};
|
|
4227
|
-
if (
|
|
4230
|
+
if (h == null)
|
|
4228
4231
|
return {};
|
|
4229
4232
|
const f = se(d), x = {
|
|
4230
4233
|
x: e,
|
|
4231
4234
|
y: i
|
|
4232
|
-
}, u = Mt(s), y = Ht(u), g = await o.getDimensions(
|
|
4233
|
-
let
|
|
4234
|
-
(!
|
|
4235
|
-
const L = b / 2 - C / 2, A =
|
|
4235
|
+
}, u = Mt(s), y = Ht(u), g = await o.getDimensions(h), w = u === "y", p = w ? "top" : "left", E = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", b = r.reference[y] + r.reference[u] - x[u] - r.floating[y], C = x[u] - r.reference[u], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(h));
|
|
4236
|
+
let S = R ? R[m] : 0;
|
|
4237
|
+
(!S || !await (o.isElement == null ? void 0 : o.isElement(R))) && (S = n.floating[m] || r.floating[y]);
|
|
4238
|
+
const L = b / 2 - C / 2, A = S / 2 - g[y] / 2 - 1, D = rt(f[p], A), B = rt(f[E], A), O = D, T = S - g[y] - B, _ = S / 2 - g[y] / 2 + L, G = Ot(O, _, T), K = !l.arrow && ct(s) != null && _ !== G && r.reference[y] / 2 - (_ < O ? D : B) - g[y] / 2 < 0, X = K ? _ < O ? _ - O : _ - T : 0;
|
|
4236
4239
|
return {
|
|
4237
4240
|
[u]: x[u] + X,
|
|
4238
4241
|
data: {
|
|
@@ -4256,8 +4259,8 @@ const mi = (a) => ({
|
|
|
4256
4259
|
middlewareData: r,
|
|
4257
4260
|
rects: o,
|
|
4258
4261
|
initialPlacement: n,
|
|
4259
|
-
platform:
|
|
4260
|
-
elements:
|
|
4262
|
+
platform: l,
|
|
4263
|
+
elements: h
|
|
4261
4264
|
} = t, {
|
|
4262
4265
|
mainAxis: d = !0,
|
|
4263
4266
|
crossAxis: f = !0,
|
|
@@ -4269,9 +4272,9 @@ const mi = (a) => ({
|
|
|
4269
4272
|
} = at(a, t);
|
|
4270
4273
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4271
4274
|
return {};
|
|
4272
|
-
const p = q(s), E = J(n), m = q(n) === n, b = await (
|
|
4275
|
+
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)] : ui(n)), R = y !== "none";
|
|
4273
4276
|
!x && R && C.push(...wi(n, g, y, b));
|
|
4274
|
-
const
|
|
4277
|
+
const S = [n, ...C], L = await re(t, w), A = [];
|
|
4275
4278
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4276
4279
|
if (d && A.push(L[p]), f) {
|
|
4277
4280
|
const _ = xi(s, o, b);
|
|
@@ -4282,7 +4285,7 @@ const mi = (a) => ({
|
|
|
4282
4285
|
overflows: A
|
|
4283
4286
|
}], !A.every((_) => _ <= 0)) {
|
|
4284
4287
|
var B, O;
|
|
4285
|
-
const _ = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G =
|
|
4288
|
+
const _ = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G = S[_];
|
|
4286
4289
|
if (G)
|
|
4287
4290
|
return {
|
|
4288
4291
|
data: {
|
|
@@ -4297,8 +4300,8 @@ const mi = (a) => ({
|
|
|
4297
4300
|
if (!K)
|
|
4298
4301
|
switch (u) {
|
|
4299
4302
|
case "bestFit": {
|
|
4300
|
-
var
|
|
4301
|
-
const X = (
|
|
4303
|
+
var T;
|
|
4304
|
+
const X = (T = D.filter((W) => {
|
|
4302
4305
|
if (R) {
|
|
4303
4306
|
const P = J(W.placement);
|
|
4304
4307
|
return P === E || // Create a bias to the `y` side axis due to horizontal
|
|
@@ -4306,7 +4309,7 @@ const mi = (a) => ({
|
|
|
4306
4309
|
P === "y";
|
|
4307
4310
|
}
|
|
4308
4311
|
return !0;
|
|
4309
|
-
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, we) => P + we, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 :
|
|
4312
|
+
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, we) => P + we, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : T[0];
|
|
4310
4313
|
X && (K = X);
|
|
4311
4314
|
break;
|
|
4312
4315
|
}
|
|
@@ -4330,7 +4333,7 @@ async function bi(a, t) {
|
|
|
4330
4333
|
placement: e,
|
|
4331
4334
|
platform: i,
|
|
4332
4335
|
elements: s
|
|
4333
|
-
} = a, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), n = ct(e),
|
|
4336
|
+
} = a, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), n = ct(e), l = J(e) === "y", h = ["left", "top"].includes(o) ? -1 : 1, d = r && l ? -1 : 1, f = at(t, a);
|
|
4334
4337
|
let {
|
|
4335
4338
|
mainAxis: x,
|
|
4336
4339
|
crossAxis: u,
|
|
@@ -4344,11 +4347,11 @@ async function bi(a, t) {
|
|
|
4344
4347
|
crossAxis: f.crossAxis || 0,
|
|
4345
4348
|
alignmentAxis: f.alignmentAxis
|
|
4346
4349
|
};
|
|
4347
|
-
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y),
|
|
4350
|
+
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y), l ? {
|
|
4348
4351
|
x: u * d,
|
|
4349
|
-
y: x *
|
|
4352
|
+
y: x * h
|
|
4350
4353
|
} : {
|
|
4351
|
-
x: x *
|
|
4354
|
+
x: x * h,
|
|
4352
4355
|
y: u * d
|
|
4353
4356
|
};
|
|
4354
4357
|
}
|
|
@@ -4363,12 +4366,12 @@ const Ci = function(a) {
|
|
|
4363
4366
|
y: r,
|
|
4364
4367
|
placement: o,
|
|
4365
4368
|
middlewareData: n
|
|
4366
|
-
} = t,
|
|
4369
|
+
} = t, l = await bi(t, a);
|
|
4367
4370
|
return o === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
|
|
4368
|
-
x: s +
|
|
4369
|
-
y: r +
|
|
4371
|
+
x: s + l.x,
|
|
4372
|
+
y: r + l.y,
|
|
4370
4373
|
data: {
|
|
4371
|
-
...
|
|
4374
|
+
...l,
|
|
4372
4375
|
placement: o
|
|
4373
4376
|
}
|
|
4374
4377
|
};
|
|
@@ -4398,12 +4401,12 @@ const Ci = function(a) {
|
|
|
4398
4401
|
};
|
|
4399
4402
|
}
|
|
4400
4403
|
},
|
|
4401
|
-
...
|
|
4402
|
-
} = at(a, t),
|
|
4404
|
+
...l
|
|
4405
|
+
} = at(a, t), h = {
|
|
4403
4406
|
x: e,
|
|
4404
4407
|
y: i
|
|
4405
|
-
}, d = await re(t,
|
|
4406
|
-
let u =
|
|
4408
|
+
}, d = await re(t, l), f = J(q(s)), x = ie(f);
|
|
4409
|
+
let u = h[x], y = h[f];
|
|
4407
4410
|
if (r) {
|
|
4408
4411
|
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u + d[w], m = u - d[p];
|
|
4409
4412
|
u = Ot(E, u, m);
|
|
@@ -4457,7 +4460,7 @@ function N(a) {
|
|
|
4457
4460
|
function Vt(a) {
|
|
4458
4461
|
return !gt() || typeof ShadowRoot > "u" ? !1 : a instanceof ShadowRoot || a instanceof M(a).ShadowRoot;
|
|
4459
4462
|
}
|
|
4460
|
-
function
|
|
4463
|
+
function lt(a) {
|
|
4461
4464
|
const {
|
|
4462
4465
|
overflow: t,
|
|
4463
4466
|
overflowX: e,
|
|
@@ -4525,19 +4528,19 @@ function z(a) {
|
|
|
4525
4528
|
}
|
|
4526
4529
|
function ne(a) {
|
|
4527
4530
|
const t = z(a);
|
|
4528
|
-
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) &&
|
|
4531
|
+
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) && lt(t) ? t : ne(t);
|
|
4529
4532
|
}
|
|
4530
|
-
function
|
|
4533
|
+
function Tt(a, t, e) {
|
|
4531
4534
|
var i;
|
|
4532
4535
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4533
4536
|
const s = ne(a), r = s === ((i = a.ownerDocument) == null ? void 0 : i.body), o = M(s);
|
|
4534
4537
|
if (r) {
|
|
4535
|
-
const n =
|
|
4536
|
-
return t.concat(o, o.visualViewport || [],
|
|
4538
|
+
const n = St(o);
|
|
4539
|
+
return t.concat(o, o.visualViewport || [], lt(s) ? s : [], n && e ? Tt(n) : []);
|
|
4537
4540
|
}
|
|
4538
|
-
return t.concat(s,
|
|
4541
|
+
return t.concat(s, Tt(s, [], e));
|
|
4539
4542
|
}
|
|
4540
|
-
function
|
|
4543
|
+
function St(a) {
|
|
4541
4544
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
4542
4545
|
}
|
|
4543
4546
|
function ae(a) {
|
|
@@ -4569,7 +4572,7 @@ function Z(a) {
|
|
|
4569
4572
|
};
|
|
4570
4573
|
}
|
|
4571
4574
|
const Oi = /* @__PURE__ */ V(0);
|
|
4572
|
-
function
|
|
4575
|
+
function le(a) {
|
|
4573
4576
|
const t = M(a);
|
|
4574
4577
|
return !kt() || !t.visualViewport ? Oi : {
|
|
4575
4578
|
x: t.visualViewport.offsetLeft,
|
|
@@ -4584,24 +4587,24 @@ function ot(a, t, e, i) {
|
|
|
4584
4587
|
const s = a.getBoundingClientRect(), r = ce(a);
|
|
4585
4588
|
let o = V(1);
|
|
4586
4589
|
t && (i ? k(i) && (o = Z(i)) : o = Z(a));
|
|
4587
|
-
const n = _i(r, e, i) ?
|
|
4588
|
-
let
|
|
4590
|
+
const n = _i(r, e, i) ? le(r) : V(0);
|
|
4591
|
+
let l = (s.left + n.x) / o.x, h = (s.top + n.y) / o.y, d = s.width / o.x, f = s.height / o.y;
|
|
4589
4592
|
if (r) {
|
|
4590
4593
|
const x = M(r), u = i && k(i) ? M(i) : i;
|
|
4591
|
-
let y = x, g =
|
|
4594
|
+
let y = x, g = St(y);
|
|
4592
4595
|
for (; g && i && u !== y; ) {
|
|
4593
4596
|
const w = Z(g), p = g.getBoundingClientRect(), E = F(g), m = p.left + (g.clientLeft + parseFloat(E.paddingLeft)) * w.x, b = p.top + (g.clientTop + parseFloat(E.paddingTop)) * w.y;
|
|
4594
|
-
|
|
4597
|
+
l *= w.x, h *= w.y, d *= w.x, f *= w.y, l += m, h += b, y = M(g), g = St(y);
|
|
4595
4598
|
}
|
|
4596
4599
|
}
|
|
4597
4600
|
return ut({
|
|
4598
4601
|
width: d,
|
|
4599
4602
|
height: f,
|
|
4600
|
-
x:
|
|
4601
|
-
y:
|
|
4603
|
+
x: l,
|
|
4604
|
+
y: h
|
|
4602
4605
|
});
|
|
4603
4606
|
}
|
|
4604
|
-
function
|
|
4607
|
+
function Ti(a) {
|
|
4605
4608
|
let {
|
|
4606
4609
|
elements: t,
|
|
4607
4610
|
rect: e,
|
|
@@ -4611,23 +4614,23 @@ function Si(a) {
|
|
|
4611
4614
|
const r = s === "fixed", o = Y(i), n = t ? wt(t.floating) : !1;
|
|
4612
4615
|
if (i === o || n && r)
|
|
4613
4616
|
return e;
|
|
4614
|
-
let
|
|
4617
|
+
let l = {
|
|
4615
4618
|
scrollLeft: 0,
|
|
4616
4619
|
scrollTop: 0
|
|
4617
|
-
},
|
|
4620
|
+
}, h = V(1);
|
|
4618
4621
|
const d = V(0), f = N(i);
|
|
4619
|
-
if ((f || !f && !r) && ((tt(i) !== "body" ||
|
|
4622
|
+
if ((f || !f && !r) && ((tt(i) !== "body" || lt(o)) && (l = pt(i)), N(i))) {
|
|
4620
4623
|
const x = ot(i);
|
|
4621
|
-
|
|
4624
|
+
h = Z(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
4622
4625
|
}
|
|
4623
4626
|
return {
|
|
4624
|
-
width: e.width *
|
|
4625
|
-
height: e.height *
|
|
4626
|
-
x: e.x *
|
|
4627
|
-
y: e.y *
|
|
4627
|
+
width: e.width * h.x,
|
|
4628
|
+
height: e.height * h.y,
|
|
4629
|
+
x: e.x * h.x - l.scrollLeft * h.x + d.x,
|
|
4630
|
+
y: e.y * h.y - l.scrollTop * h.y + d.y
|
|
4628
4631
|
};
|
|
4629
4632
|
}
|
|
4630
|
-
function
|
|
4633
|
+
function Si(a) {
|
|
4631
4634
|
return Array.from(a.getClientRects());
|
|
4632
4635
|
}
|
|
4633
4636
|
function Lt(a, t) {
|
|
@@ -4647,26 +4650,26 @@ function Li(a) {
|
|
|
4647
4650
|
}
|
|
4648
4651
|
function Ai(a, t) {
|
|
4649
4652
|
const e = M(a), i = Y(a), s = e.visualViewport;
|
|
4650
|
-
let r = i.clientWidth, o = i.clientHeight, n = 0,
|
|
4653
|
+
let r = i.clientWidth, o = i.clientHeight, n = 0, l = 0;
|
|
4651
4654
|
if (s) {
|
|
4652
4655
|
r = s.width, o = s.height;
|
|
4653
|
-
const
|
|
4654
|
-
(!
|
|
4656
|
+
const h = kt();
|
|
4657
|
+
(!h || h && t === "fixed") && (n = s.offsetLeft, l = s.offsetTop);
|
|
4655
4658
|
}
|
|
4656
4659
|
return {
|
|
4657
4660
|
width: r,
|
|
4658
4661
|
height: o,
|
|
4659
4662
|
x: n,
|
|
4660
|
-
y:
|
|
4663
|
+
y: l
|
|
4661
4664
|
};
|
|
4662
4665
|
}
|
|
4663
4666
|
function Hi(a, t) {
|
|
4664
|
-
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, r = N(a) ? Z(a) : V(1), o = a.clientWidth * r.x, n = a.clientHeight * r.y,
|
|
4667
|
+
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, r = N(a) ? Z(a) : V(1), o = a.clientWidth * r.x, n = a.clientHeight * r.y, l = s * r.x, h = i * r.y;
|
|
4665
4668
|
return {
|
|
4666
4669
|
width: o,
|
|
4667
4670
|
height: n,
|
|
4668
|
-
x:
|
|
4669
|
-
y:
|
|
4671
|
+
x: l,
|
|
4672
|
+
y: h
|
|
4670
4673
|
};
|
|
4671
4674
|
}
|
|
4672
4675
|
function zt(a, t, e) {
|
|
@@ -4678,7 +4681,7 @@ function zt(a, t, e) {
|
|
|
4678
4681
|
else if (k(t))
|
|
4679
4682
|
i = Hi(t, e);
|
|
4680
4683
|
else {
|
|
4681
|
-
const s =
|
|
4684
|
+
const s = le(a);
|
|
4682
4685
|
i = {
|
|
4683
4686
|
...t,
|
|
4684
4687
|
x: t.x - s.x,
|
|
@@ -4687,20 +4690,20 @@ function zt(a, t, e) {
|
|
|
4687
4690
|
}
|
|
4688
4691
|
return ut(i);
|
|
4689
4692
|
}
|
|
4690
|
-
function
|
|
4693
|
+
function he(a, t) {
|
|
4691
4694
|
const e = z(a);
|
|
4692
|
-
return e === t || !k(e) || Q(e) ? !1 : F(e).position === "fixed" ||
|
|
4695
|
+
return e === t || !k(e) || Q(e) ? !1 : F(e).position === "fixed" || he(e, t);
|
|
4693
4696
|
}
|
|
4694
4697
|
function Mi(a, t) {
|
|
4695
4698
|
const e = t.get(a);
|
|
4696
4699
|
if (e)
|
|
4697
4700
|
return e;
|
|
4698
|
-
let i =
|
|
4701
|
+
let i = Tt(a, [], !1).filter((n) => k(n) && tt(n) !== "body"), s = null;
|
|
4699
4702
|
const r = F(a).position === "fixed";
|
|
4700
4703
|
let o = r ? z(a) : a;
|
|
4701
4704
|
for (; k(o) && !Q(o); ) {
|
|
4702
|
-
const n = F(o),
|
|
4703
|
-
!
|
|
4705
|
+
const n = F(o), l = Dt(o);
|
|
4706
|
+
!l && n.position === "fixed" && (s = null), (r ? !l && !s : !l && n.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || lt(o) && !l && he(a, o)) ? i = i.filter((d) => d !== o) : s = n, o = z(o);
|
|
4704
4707
|
}
|
|
4705
4708
|
return t.set(a, i), i;
|
|
4706
4709
|
}
|
|
@@ -4711,15 +4714,15 @@ function Di(a) {
|
|
|
4711
4714
|
rootBoundary: i,
|
|
4712
4715
|
strategy: s
|
|
4713
4716
|
} = a;
|
|
4714
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Mi(t, this._c) : [].concat(e), i], n = o[0],
|
|
4717
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Mi(t, this._c) : [].concat(e), i], n = o[0], l = o.reduce((h, d) => {
|
|
4715
4718
|
const f = zt(t, d, s);
|
|
4716
|
-
return
|
|
4719
|
+
return h.top = U(f.top, h.top), h.right = rt(f.right, h.right), h.bottom = rt(f.bottom, h.bottom), h.left = U(f.left, h.left), h;
|
|
4717
4720
|
}, zt(t, n, s));
|
|
4718
4721
|
return {
|
|
4719
|
-
width:
|
|
4720
|
-
height:
|
|
4721
|
-
x:
|
|
4722
|
-
y:
|
|
4722
|
+
width: l.right - l.left,
|
|
4723
|
+
height: l.bottom - l.top,
|
|
4724
|
+
x: l.left,
|
|
4725
|
+
y: l.top
|
|
4723
4726
|
};
|
|
4724
4727
|
}
|
|
4725
4728
|
function ki(a) {
|
|
@@ -4738,19 +4741,19 @@ function Fi(a, t, e) {
|
|
|
4738
4741
|
scrollLeft: 0,
|
|
4739
4742
|
scrollTop: 0
|
|
4740
4743
|
};
|
|
4741
|
-
const
|
|
4744
|
+
const l = V(0);
|
|
4742
4745
|
if (i || !i && !r)
|
|
4743
|
-
if ((tt(t) !== "body" ||
|
|
4746
|
+
if ((tt(t) !== "body" || lt(s)) && (n = pt(t)), i) {
|
|
4744
4747
|
const u = ot(t, !0, r, t);
|
|
4745
|
-
|
|
4746
|
-
} else s && (
|
|
4747
|
-
let
|
|
4748
|
+
l.x = u.x + t.clientLeft, l.y = u.y + t.clientTop;
|
|
4749
|
+
} else s && (l.x = Lt(s));
|
|
4750
|
+
let h = 0, d = 0;
|
|
4748
4751
|
if (s && !i && !r) {
|
|
4749
4752
|
const u = s.getBoundingClientRect();
|
|
4750
|
-
d = u.top + n.scrollTop,
|
|
4753
|
+
d = u.top + n.scrollTop, h = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
4751
4754
|
Lt(s, u);
|
|
4752
4755
|
}
|
|
4753
|
-
const f = o.left + n.scrollLeft -
|
|
4756
|
+
const f = o.left + n.scrollLeft - l.x - h, x = o.top + n.scrollTop - l.y - d;
|
|
4754
4757
|
return {
|
|
4755
4758
|
x: f,
|
|
4756
4759
|
y: x,
|
|
@@ -4803,12 +4806,12 @@ function Ni(a) {
|
|
|
4803
4806
|
return F(a).direction === "rtl";
|
|
4804
4807
|
}
|
|
4805
4808
|
const Ki = {
|
|
4806
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
4809
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Ti,
|
|
4807
4810
|
getDocumentElement: Y,
|
|
4808
4811
|
getClippingRect: Di,
|
|
4809
4812
|
getOffsetParent: de,
|
|
4810
4813
|
getElementRects: Xi,
|
|
4811
|
-
getClientRects:
|
|
4814
|
+
getClientRects: Si,
|
|
4812
4815
|
getDimensions: ki,
|
|
4813
4816
|
getScale: Z,
|
|
4814
4817
|
isElement: k,
|
|
@@ -4847,7 +4850,7 @@ let Bi = class {
|
|
|
4847
4850
|
borderRadius: "4px",
|
|
4848
4851
|
fontSize: "12px",
|
|
4849
4852
|
...r
|
|
4850
|
-
},
|
|
4853
|
+
}, l = {
|
|
4851
4854
|
position: "absolute",
|
|
4852
4855
|
width: "10px",
|
|
4853
4856
|
height: "10px",
|
|
@@ -4856,7 +4859,7 @@ let Bi = class {
|
|
|
4856
4859
|
transform: "rotate(45deg)",
|
|
4857
4860
|
zIndex: n.zIndex
|
|
4858
4861
|
};
|
|
4859
|
-
Object.assign(this.arrowEl.style,
|
|
4862
|
+
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();
|
|
4860
4863
|
}
|
|
4861
4864
|
init() {
|
|
4862
4865
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -4898,10 +4901,10 @@ let Bi = class {
|
|
|
4898
4901
|
placement: t.overflowTooltipPlacement,
|
|
4899
4902
|
middleware: [xe(), ue(), fe(6), Yi({ element: this.arrowEl })]
|
|
4900
4903
|
}).then((n) => {
|
|
4901
|
-
const { x:
|
|
4904
|
+
const { x: l, y: h, placement: d, middlewareData: f } = n;
|
|
4902
4905
|
if (Object.assign(this.floatingEl.style, {
|
|
4903
|
-
top: `${
|
|
4904
|
-
left: `${
|
|
4906
|
+
top: `${h}px`,
|
|
4907
|
+
left: `${l}px`
|
|
4905
4908
|
}), f.arrow) {
|
|
4906
4909
|
const x = f.arrow;
|
|
4907
4910
|
["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5039,8 +5042,8 @@ class Wi {
|
|
|
5039
5042
|
return;
|
|
5040
5043
|
const e = t.getValue(), { width: i, height: s } = t, r = t.getDrawX(), o = t.getDrawY(), { CELL_PADDING: n } = this.ctx.config;
|
|
5041
5044
|
this.editorEl.style.left = `${r}px`, this.editorEl.style.top = `${o}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();
|
|
5042
|
-
const
|
|
5043
|
-
|
|
5045
|
+
const l = window.getSelection();
|
|
5046
|
+
l == null || l.selectAllChildren(this.inputEl), l == null || l.collapseToEnd();
|
|
5044
5047
|
}
|
|
5045
5048
|
doneEditByInput() {
|
|
5046
5049
|
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
@@ -5049,11 +5052,28 @@ class Wi {
|
|
|
5049
5052
|
s !== i && !(s === "" && i === null) && this.ctx.database.setItemValue(t, e, s, !0, !0, !0), this.inputEl.textContent = null, this.editorEl.style.left = "-10000px", this.editorEl.style.top = "-10000px";
|
|
5050
5053
|
}
|
|
5051
5054
|
startEdit() {
|
|
5052
|
-
const t = this.ctx.
|
|
5053
|
-
if (!t
|
|
5055
|
+
const { ENABLE_EDIT_CLICK_SELECTOR: t } = this.ctx.config;
|
|
5056
|
+
if (!t)
|
|
5057
|
+
return;
|
|
5058
|
+
const e = this.ctx.focusCell;
|
|
5059
|
+
if (!e || ["index", "index-selection", "selection"].includes(e.type) || this.enable)
|
|
5060
|
+
return;
|
|
5061
|
+
const { rowKey: i, key: s } = e, r = this.ctx.database.getReadonly(i, s);
|
|
5062
|
+
e && !r && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5063
|
+
}
|
|
5064
|
+
editCell(t, e) {
|
|
5065
|
+
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
5066
|
+
if (!i)
|
|
5067
|
+
return;
|
|
5068
|
+
const s = i.cells.find((h) => h.colIndex === e);
|
|
5069
|
+
if (!s)
|
|
5070
|
+
return;
|
|
5071
|
+
this.ctx.emit("setSelectorCell", s);
|
|
5072
|
+
const r = this.ctx.focusCell;
|
|
5073
|
+
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5054
5074
|
return;
|
|
5055
|
-
const { rowKey:
|
|
5056
|
-
|
|
5075
|
+
const { rowKey: o, key: n } = r, l = this.ctx.database.getReadonly(o, n);
|
|
5076
|
+
r && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5057
5077
|
}
|
|
5058
5078
|
doneEdit() {
|
|
5059
5079
|
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"));
|
|
@@ -5067,10 +5087,10 @@ class Pi {
|
|
|
5067
5087
|
c(this, "emptyEl");
|
|
5068
5088
|
this.ctx = t;
|
|
5069
5089
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX: r } = this.ctx.config;
|
|
5070
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.targetContainer.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: n, bodyHeight:
|
|
5090
|
+
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.targetContainer.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: n, bodyHeight: l, footerHeight: h }) => {
|
|
5071
5091
|
if (i)
|
|
5072
5092
|
return;
|
|
5073
|
-
const d = n + (
|
|
5093
|
+
const d = n + (l + h) / 2, f = {
|
|
5074
5094
|
display: o === "empty" ? "block" : "none",
|
|
5075
5095
|
position: "absolute",
|
|
5076
5096
|
fontSize: "14px",
|
|
@@ -5107,9 +5127,9 @@ class Vi {
|
|
|
5107
5127
|
target: t,
|
|
5108
5128
|
config: { SCROLLER_TRACK_SIZE: e }
|
|
5109
5129
|
} = this.ctx, i = t.width - e, s = t.height - e, r = this.getHeader(), o = this.getBody(), n = this.getFooter();
|
|
5110
|
-
let
|
|
5111
|
-
const { FOOTER_FIXED:
|
|
5112
|
-
return
|
|
5130
|
+
let l = [r, o, n];
|
|
5131
|
+
const { FOOTER_FIXED: h } = this.ctx.config;
|
|
5132
|
+
return h || (l = [r, o]), {
|
|
5113
5133
|
style: {
|
|
5114
5134
|
position: "absolute",
|
|
5115
5135
|
left: "0px",
|
|
@@ -5119,7 +5139,7 @@ class Vi {
|
|
|
5119
5139
|
width: `${i}px`,
|
|
5120
5140
|
height: `${s}px`
|
|
5121
5141
|
},
|
|
5122
|
-
views:
|
|
5142
|
+
views: l
|
|
5123
5143
|
};
|
|
5124
5144
|
}
|
|
5125
5145
|
getHeader() {
|
|
@@ -5128,9 +5148,9 @@ class Vi {
|
|
|
5128
5148
|
fixedRightWidth: e,
|
|
5129
5149
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5130
5150
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: n } = this.ctx.header;
|
|
5131
|
-
let
|
|
5151
|
+
let l = [], h = [], d = [];
|
|
5132
5152
|
n.forEach((w) => {
|
|
5133
|
-
w.render && (w.fixed === "left" ?
|
|
5153
|
+
w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ? d.push(w) : l.push(w));
|
|
5134
5154
|
});
|
|
5135
5155
|
const f = e - i, x = {
|
|
5136
5156
|
key: "left",
|
|
@@ -5142,7 +5162,7 @@ class Vi {
|
|
|
5142
5162
|
width: `${t}px`,
|
|
5143
5163
|
height: `${o}px`
|
|
5144
5164
|
},
|
|
5145
|
-
cells:
|
|
5165
|
+
cells: h
|
|
5146
5166
|
}, u = {
|
|
5147
5167
|
key: "center",
|
|
5148
5168
|
style: {
|
|
@@ -5153,7 +5173,7 @@ class Vi {
|
|
|
5153
5173
|
width: `${r - t - f}px`,
|
|
5154
5174
|
height: `${o}px`
|
|
5155
5175
|
},
|
|
5156
|
-
cells:
|
|
5176
|
+
cells: l
|
|
5157
5177
|
}, y = {
|
|
5158
5178
|
key: "right",
|
|
5159
5179
|
style: {
|
|
@@ -5189,8 +5209,8 @@ class Vi {
|
|
|
5189
5209
|
const {
|
|
5190
5210
|
fixedLeftWidth: r,
|
|
5191
5211
|
fixedRightWidth: o,
|
|
5192
|
-
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX:
|
|
5193
|
-
} = this.ctx, { visibleWidth:
|
|
5212
|
+
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: l }
|
|
5213
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = o - n, x = {
|
|
5194
5214
|
key: "left",
|
|
5195
5215
|
style: {
|
|
5196
5216
|
position: "absolute",
|
|
@@ -5208,7 +5228,7 @@ class Vi {
|
|
|
5208
5228
|
top: `${0.5}px`,
|
|
5209
5229
|
left: `${r + 0.5}px`,
|
|
5210
5230
|
overflow: "hidden",
|
|
5211
|
-
width: `${
|
|
5231
|
+
width: `${h - r - f}px`,
|
|
5212
5232
|
height: `${d}px`
|
|
5213
5233
|
},
|
|
5214
5234
|
cells: t
|
|
@@ -5226,11 +5246,11 @@ class Vi {
|
|
|
5226
5246
|
};
|
|
5227
5247
|
return {
|
|
5228
5248
|
type: "body",
|
|
5229
|
-
class: `${
|
|
5249
|
+
class: `${l}-overlayer-body`,
|
|
5230
5250
|
style: {
|
|
5231
5251
|
position: "relative",
|
|
5232
5252
|
overflow: "hidden",
|
|
5233
|
-
width: `${
|
|
5253
|
+
width: `${h}px`,
|
|
5234
5254
|
height: `${d}px`
|
|
5235
5255
|
},
|
|
5236
5256
|
views: [x, u, y]
|
|
@@ -5247,7 +5267,7 @@ class Vi {
|
|
|
5247
5267
|
fixedLeftWidth: s,
|
|
5248
5268
|
fixedRightWidth: r,
|
|
5249
5269
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: n }
|
|
5250
|
-
} = this.ctx, { visibleWidth:
|
|
5270
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, d = r - o, f = {
|
|
5251
5271
|
key: "left",
|
|
5252
5272
|
style: {
|
|
5253
5273
|
position: "absolute",
|
|
@@ -5255,7 +5275,7 @@ class Vi {
|
|
|
5255
5275
|
left: `${0.5}px`,
|
|
5256
5276
|
overflow: "hidden",
|
|
5257
5277
|
width: `${s}px`,
|
|
5258
|
-
height: `${
|
|
5278
|
+
height: `${h}px`
|
|
5259
5279
|
},
|
|
5260
5280
|
cells: e
|
|
5261
5281
|
}, x = {
|
|
@@ -5265,8 +5285,8 @@ class Vi {
|
|
|
5265
5285
|
top: `${0.5}px`,
|
|
5266
5286
|
left: `${s + 0.5}px`,
|
|
5267
5287
|
overflow: "hidden",
|
|
5268
|
-
width: `${
|
|
5269
|
-
height: `${
|
|
5288
|
+
width: `${l - s - d}px`,
|
|
5289
|
+
height: `${h}px`
|
|
5270
5290
|
},
|
|
5271
5291
|
cells: t
|
|
5272
5292
|
}, u = {
|
|
@@ -5277,7 +5297,7 @@ class Vi {
|
|
|
5277
5297
|
right: `${0.5}px`,
|
|
5278
5298
|
overflow: "hidden",
|
|
5279
5299
|
width: `${d}px`,
|
|
5280
|
-
height: `${
|
|
5300
|
+
height: `${h}px`
|
|
5281
5301
|
},
|
|
5282
5302
|
cells: i
|
|
5283
5303
|
};
|
|
@@ -5287,8 +5307,8 @@ class Vi {
|
|
|
5287
5307
|
style: {
|
|
5288
5308
|
position: "relative",
|
|
5289
5309
|
overflow: "hidden",
|
|
5290
|
-
width: `${
|
|
5291
|
-
height: `${
|
|
5310
|
+
width: `${l}px`,
|
|
5311
|
+
height: `${h}px`
|
|
5292
5312
|
},
|
|
5293
5313
|
views: [f, x, u]
|
|
5294
5314
|
};
|
|
@@ -5304,8 +5324,8 @@ class zi {
|
|
|
5304
5324
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5305
5325
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5306
5326
|
e.preventDefault();
|
|
5307
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n,
|
|
5308
|
-
|
|
5327
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n, l] = s, { rowIndex: h, colIndex: d } = t;
|
|
5328
|
+
h >= n && h <= l && d >= r && d <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5309
5329
|
const x = {
|
|
5310
5330
|
getBoundingClientRect: () => ({
|
|
5311
5331
|
width: 0,
|
|
@@ -5394,7 +5414,7 @@ class Gi {
|
|
|
5394
5414
|
c(this, "overlayer");
|
|
5395
5415
|
c(this, "contextMenu");
|
|
5396
5416
|
c(this, "ctx");
|
|
5397
|
-
this.target = document.createElement("canvas"), this.targetContainer = t, this.targetContainer.style.position = "relative", this.targetContainer.appendChild(this.target), this.options = e, this.ctx = new ri(this.targetContainer, this.target, this.options), this.header = new ni(this.ctx), this.body = new ai(this.ctx), this.footer = new ci(this.ctx), this.scroller = new oi(this.ctx), this.selector = new
|
|
5417
|
+
this.target = document.createElement("canvas"), this.targetContainer = t, this.targetContainer.style.position = "relative", this.targetContainer.appendChild(this.target), this.options = e, this.ctx = new ri(this.targetContainer, this.target, this.options), this.header = new ni(this.ctx), this.body = new ai(this.ctx), this.footer = new ci(this.ctx), this.scroller = new oi(this.ctx), this.selector = new li(this.ctx), this.autofill = new hi(this.ctx), this.tooltip = new Bi(this.ctx), this.empty = new Pi(this.ctx), this.editor = new Wi(this.ctx), this.overlayer = new Vi(this.ctx), this.contextMenu = new zi(this.ctx), this.ctx.on("draw", this.draw.bind(this)), this.draw();
|
|
5398
5418
|
}
|
|
5399
5419
|
draw() {
|
|
5400
5420
|
requestAnimationFrame(() => {
|
|
@@ -5425,6 +5445,9 @@ class Gi {
|
|
|
5425
5445
|
filterMethod(t) {
|
|
5426
5446
|
this.ctx.setScrollY(0), this.ctx.setScrollX(0), this.ctx.database.init(), this.ctx.database.setFilterMethod(t), this.ctx.emit("draw");
|
|
5427
5447
|
}
|
|
5448
|
+
editCell(t, e) {
|
|
5449
|
+
this.editor.editCell(t, e);
|
|
5450
|
+
}
|
|
5428
5451
|
setItemValue(t, e, i, s = !0, r = !0, o = !1) {
|
|
5429
5452
|
this.ctx.database.setItemValue(t, e, i, s, r, o);
|
|
5430
5453
|
}
|
|
@@ -5455,8 +5478,8 @@ class Gi {
|
|
|
5455
5478
|
if (t && Array.isArray(s) && s.length) {
|
|
5456
5479
|
const [r] = s;
|
|
5457
5480
|
if (Array.isArray(r) && r.length) {
|
|
5458
|
-
const [o] = r, { rowKey: n, key:
|
|
5459
|
-
this.scrollToRowkey(n), this.scrollToColkey(
|
|
5481
|
+
const [o] = r, { rowKey: n, key: l } = o;
|
|
5482
|
+
this.scrollToRowkey(n), this.scrollToColkey(l);
|
|
5460
5483
|
}
|
|
5461
5484
|
}
|
|
5462
5485
|
i(s);
|
|
@@ -5481,7 +5504,7 @@ class Gi {
|
|
|
5481
5504
|
let r = [];
|
|
5482
5505
|
for (let o = 0; o < i.length; o++)
|
|
5483
5506
|
for (let n = 0; n < s.length; n++) {
|
|
5484
|
-
const
|
|
5507
|
+
const l = this.ctx.database.getRowKeyByItem(i[o]), d = s[n].key, f = await this.ctx.database.getValidator(l, d);
|
|
5485
5508
|
Array.isArray(f) && f.length && r.push(f);
|
|
5486
5509
|
}
|
|
5487
5510
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|