e-virt-table 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +5 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +290 -308
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Config.d.ts +0 -1
- package/dist/lib/Config.js +0 -6
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/EVirtTable.js +2 -0
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +13 -4
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/Header.d.ts +1 -1
- package/dist/lib/Header.js +26 -30
- package/dist/lib/Header.js.map +1 -1
- package/dist/lib/Scroller.js +0 -1
- package/dist/lib/Scroller.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -169,24 +169,24 @@ 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), l = n.length, h = 0,
|
|
172
|
+
var o = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a), l = n.length, h = 0, f = [], d = new Promise(function(x, u) {
|
|
173
173
|
var y = function(w) {
|
|
174
|
-
if (
|
|
175
|
-
return i(
|
|
174
|
+
if (f.push.apply(f, w), h++, h === l)
|
|
175
|
+
return i(f), f.length ? u(new Xt(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
|
-
n.length || (i(
|
|
177
|
+
n.length || (i(f), x(s)), n.forEach(function(g) {
|
|
178
178
|
var w = a[g];
|
|
179
179
|
o.indexOf(g) !== -1 ? Ft(w, e, y) : Re(w, e, y);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
|
-
return
|
|
182
|
+
return d.catch(function(x) {
|
|
183
183
|
return x;
|
|
184
|
-
}),
|
|
184
|
+
}), d;
|
|
185
185
|
}
|
|
186
186
|
function _e(a) {
|
|
187
187
|
return !!(a && a.message !== void 0);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Se(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 Te(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 = Se(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,7 +216,7 @@ 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
|
+
}, Te = function(t, e, i, s, r) {
|
|
220
220
|
(/^\s+$/.test(e) || e === "") && s.push(H(r.messages.whitespace, t.fullField));
|
|
221
221
|
}, ht, Le = function() {
|
|
222
222
|
if (ht)
|
|
@@ -242,7 +242,7 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
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 h = "(?:(?:[a-z]+:)?//)",
|
|
245
|
+
var h = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d = l.v4().source, x = l.v6().source, u = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", y = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", g = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", p = '(?:[/?#][^\\s"]*)?', E = "(?:" + h + "|www\\.)" + f + "(?:localhost|" + d + "|" + x + "|" + u + y + g + ")" + w + p;
|
|
246
246
|
return ht = new RegExp("(?:^" + E + "$)", "i"), ht;
|
|
247
247
|
}, Yt = {
|
|
248
248
|
// http://emailregex.com/
|
|
@@ -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", l = typeof t.max == "number", h = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
|
|
304
|
-
if (x ?
|
|
303
|
+
var o = typeof t.len == "number", n = typeof t.min == "number", l = typeof t.max == "number", h = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, f = e, d = null, x = typeof e == "number", u = typeof e == "string", y = Array.isArray(e);
|
|
304
|
+
if (x ? d = "number" : u ? d = "string" : y && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
|
-
y && (
|
|
306
|
+
y && (f = e.length), u && (f = e.replace(h, "_").length), o ? f !== t.len && s.push(H(r.messages[d].len, t.fullField, t.len)) : n && !l && f < t.min ? s.push(H(r.messages[d].min, t.fullField, t.min)) : l && !n && f > t.max ? s.push(H(r.messages[d].max, t.fullField, t.max)) : n && l && (f < t.min || f > t.max) && s.push(H(r.messages[d].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: Te,
|
|
321
321
|
type: Ae,
|
|
322
322
|
range: He,
|
|
323
323
|
enum: Me,
|
|
@@ -536,7 +536,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
536
536
|
var n = i, l = s, h = r;
|
|
537
537
|
if (typeof l == "function" && (h = l, l = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
538
|
return h && h(null, n), Promise.resolve(n);
|
|
539
|
-
function
|
|
539
|
+
function f(g) {
|
|
540
540
|
var w = [], p = {};
|
|
541
541
|
function E(b) {
|
|
542
542
|
if (Array.isArray(b)) {
|
|
@@ -550,8 +550,8 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
550
550
|
w.length ? (p = Ct(w), h(w, p)) : h(null, n);
|
|
551
551
|
}
|
|
552
552
|
if (l.messages) {
|
|
553
|
-
var
|
|
554
|
-
|
|
553
|
+
var d = this.messages();
|
|
554
|
+
d === Rt && (d = vt()), Kt(d, l.messages), l.messages = d;
|
|
555
555
|
} else
|
|
556
556
|
l.messages = this.messages();
|
|
557
557
|
var x = {}, u = l.keys || Object.keys(this.rules);
|
|
@@ -573,17 +573,17 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
573
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, T) {
|
|
577
|
+
return $({}, T, {
|
|
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
|
-
!l.suppressWarning &&
|
|
586
|
-
var L =
|
|
584
|
+
var T = Array.isArray(R) ? R : [R];
|
|
585
|
+
!l.suppressWarning && T.length && a.warning("async-validator:", T), T.length && p.message !== void 0 && (T = [].concat(p.message));
|
|
586
|
+
var L = T.map(Nt(p, n));
|
|
587
587
|
if (l.first && L.length)
|
|
588
588
|
return y[p.field] = 1, w(L);
|
|
589
589
|
if (!E)
|
|
@@ -597,13 +597,13 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
597
597
|
}), A = $({}, A, g.rule.fields);
|
|
598
598
|
var D = {};
|
|
599
599
|
Object.keys(A).forEach(function(O) {
|
|
600
|
-
var
|
|
600
|
+
var S = A[O], _ = Array.isArray(S) ? S : [S];
|
|
601
601
|
D[O] = _.map(m.bind(null, O));
|
|
602
602
|
});
|
|
603
603
|
var B = new a(D);
|
|
604
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
|
|
606
|
-
L && L.length &&
|
|
605
|
+
var S = [];
|
|
606
|
+
L && L.length && S.push.apply(S, L), O && O.length && S.push.apply(S, O), w(S.length ? S : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
}
|
|
@@ -626,7 +626,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
626
626
|
return b(R);
|
|
627
627
|
});
|
|
628
628
|
}, function(g) {
|
|
629
|
-
|
|
629
|
+
f(g);
|
|
630
630
|
}, n);
|
|
631
631
|
}, t.getType = function(i) {
|
|
632
632
|
if (i.type === void 0 && i.pattern instanceof RegExp && (i.type = "pattern"), typeof i.validator != "function" && i.type && !it.hasOwnProperty(i.type))
|
|
@@ -751,12 +751,12 @@ 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: l, SELECTABLE_METHOD: h, CHECKBOX_KEY:
|
|
754
|
+
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: l, SELECTABLE_METHOD: h, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d ?? At();
|
|
755
755
|
this.itemRowKeyMap.set(i, x);
|
|
756
756
|
const u = i._height || l, y = i._readonly;
|
|
757
757
|
let g = !0;
|
|
758
|
-
if (typeof h == "function" && (g = h),
|
|
759
|
-
const w = i[
|
|
758
|
+
if (typeof h == "function" && (g = h), f) {
|
|
759
|
+
const w = i[f];
|
|
760
760
|
if (this.checkboxKeyMap.has(w)) {
|
|
761
761
|
const p = this.checkboxKeyMap.get(w);
|
|
762
762
|
p.push(x), this.checkboxKeyMap.set(w, p);
|
|
@@ -835,10 +835,10 @@ 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: l, hasChildren: h, height:
|
|
839
|
-
this.sumHeight +=
|
|
840
|
-
top:
|
|
841
|
-
height:
|
|
838
|
+
const n = this.itemRowKeyMap.get(o), { expand: l, hasChildren: h, height: f } = this.rowKeyMap.get(n), d = this.sumHeight;
|
|
839
|
+
this.sumHeight += f, this.rowIndexRowKeyMap.set(e, n), this.positions.push({
|
|
840
|
+
top: d,
|
|
841
|
+
height: f,
|
|
842
842
|
bottom: this.sumHeight
|
|
843
843
|
}), e += 1, l && h && i(o.children);
|
|
844
844
|
});
|
|
@@ -963,11 +963,11 @@ class Ze {
|
|
|
963
963
|
let i = [];
|
|
964
964
|
const s = /* @__PURE__ */ new Set();
|
|
965
965
|
t.forEach((n) => {
|
|
966
|
-
const { value: l, rowKey: h, key:
|
|
966
|
+
const { value: l, rowKey: h, key: f } = n, { oldValue: d, newValue: x } = this.setItemValue(h, f, l);
|
|
967
967
|
s.add(h), i.push({
|
|
968
968
|
rowKey: h,
|
|
969
|
-
key:
|
|
970
|
-
oldValue:
|
|
969
|
+
key: f,
|
|
970
|
+
oldValue: d,
|
|
971
971
|
newValue: x
|
|
972
972
|
});
|
|
973
973
|
});
|
|
@@ -1013,19 +1013,19 @@ class Ze {
|
|
|
1013
1013
|
n[e] !== null && typeof n[e] == "object" && (l = JSON.parse(JSON.stringify(n[e])));
|
|
1014
1014
|
const h = `${t}_${e}`;
|
|
1015
1015
|
if (this.originalDataMap.has(h) || this.originalDataMap.set(h, l), this.changedDataMap.set(h, i), n[e] = i, o) {
|
|
1016
|
-
const
|
|
1016
|
+
const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
|
|
1017
1017
|
rowKey: t,
|
|
1018
1018
|
key: e,
|
|
1019
1019
|
value: i,
|
|
1020
|
-
row:
|
|
1020
|
+
row: f
|
|
1021
1021
|
};
|
|
1022
|
-
this.ctx.emit("change", [
|
|
1022
|
+
this.ctx.emit("change", [d], [f]), this.ctx.emit("editChange", {
|
|
1023
1023
|
rowKey: t,
|
|
1024
1024
|
key: e,
|
|
1025
1025
|
oldValue: l,
|
|
1026
1026
|
value: i,
|
|
1027
1027
|
originalValue: this.originalDataMap.get(h),
|
|
1028
|
-
row:
|
|
1028
|
+
row: f
|
|
1029
1029
|
});
|
|
1030
1030
|
}
|
|
1031
1031
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
@@ -1258,18 +1258,18 @@ class Ze {
|
|
|
1258
1258
|
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { CELL_RULES_METHOD: o } = this.ctx.config, n = r.column;
|
|
1259
1259
|
let l = n.rules;
|
|
1260
1260
|
if (typeof o == "function") {
|
|
1261
|
-
const
|
|
1261
|
+
const f = o({
|
|
1262
1262
|
row: s.item,
|
|
1263
1263
|
rowIndex: s.rowIndex,
|
|
1264
1264
|
colIndex: r.colIndex,
|
|
1265
1265
|
column: n,
|
|
1266
1266
|
value: this.getItemValue(t, e)
|
|
1267
1267
|
});
|
|
1268
|
-
|
|
1268
|
+
f && (l = f);
|
|
1269
1269
|
}
|
|
1270
1270
|
if (l) {
|
|
1271
|
-
let h = {},
|
|
1272
|
-
if (
|
|
1271
|
+
let h = {}, f = {};
|
|
1272
|
+
if (f[e] = this.getItemValue(t, e), Array.isArray(l) && l.length) {
|
|
1273
1273
|
const x = l.map((u) => ({
|
|
1274
1274
|
...u,
|
|
1275
1275
|
row: s.item,
|
|
@@ -1286,7 +1286,7 @@ class Ze {
|
|
|
1286
1286
|
rowIndex: s.rowIndex,
|
|
1287
1287
|
colIndex: r.colIndex
|
|
1288
1288
|
};
|
|
1289
|
-
new nt(h).validate(
|
|
1289
|
+
new nt(h).validate(f).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: l, colorStart: h, colorEnd:
|
|
1515
|
+
const { fillColor: o, side: n, shadowWidth: l, colorStart: h, colorEnd: f } = r;
|
|
1516
1516
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1517
|
-
let
|
|
1517
|
+
let d;
|
|
1518
1518
|
switch (n) {
|
|
1519
1519
|
case "left":
|
|
1520
|
-
|
|
1520
|
+
d = this.ctx.createLinearGradient(t - l, e, t, e), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t - l, e, l, s);
|
|
1521
1521
|
break;
|
|
1522
1522
|
case "right":
|
|
1523
|
-
|
|
1523
|
+
d = this.ctx.createLinearGradient(
|
|
1524
1524
|
t + i,
|
|
1525
1525
|
e,
|
|
1526
1526
|
t + i + l,
|
|
1527
1527
|
e
|
|
1528
|
-
),
|
|
1528
|
+
), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, l, s);
|
|
1529
1529
|
break;
|
|
1530
1530
|
case "top":
|
|
1531
|
-
|
|
1531
|
+
d = this.ctx.createLinearGradient(t, e - l, t, e), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e - l, i, l);
|
|
1532
1532
|
break;
|
|
1533
1533
|
case "bottom":
|
|
1534
|
-
|
|
1534
|
+
d = this.ctx.createLinearGradient(
|
|
1535
1535
|
t,
|
|
1536
1536
|
e + s,
|
|
1537
1537
|
t,
|
|
1538
1538
|
e + s + l
|
|
1539
|
-
),
|
|
1539
|
+
), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, l);
|
|
1540
1540
|
break;
|
|
1541
1541
|
default:
|
|
1542
1542
|
console.error("Invalid side specified for shadow");
|
|
@@ -1561,8 +1561,8 @@ class ei {
|
|
|
1561
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 [h,
|
|
1565
|
-
this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e +
|
|
1564
|
+
const [h, f, d, 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 + f, f), this.ctx.arcTo(t + i, e + s, t + i - d, e + s, d), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + h, e, h);
|
|
1566
1566
|
}
|
|
1567
1567
|
n !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1568
1568
|
}
|
|
@@ -1582,15 +1582,15 @@ class ei {
|
|
|
1582
1582
|
font: n = "12px Arial",
|
|
1583
1583
|
align: l = "center",
|
|
1584
1584
|
color: h = "#495060",
|
|
1585
|
-
padding:
|
|
1586
|
-
verticalAlign:
|
|
1585
|
+
padding: f = 0,
|
|
1586
|
+
verticalAlign: d = "middle"
|
|
1587
1587
|
} = o;
|
|
1588
|
-
this.ctx.font = n, this.ctx.fillStyle = h, this.ctx.textBaseline =
|
|
1588
|
+
this.ctx.font = n, this.ctx.fillStyle = h, this.ctx.textBaseline = d, this.ctx.textAlign = l;
|
|
1589
1589
|
let x = 0;
|
|
1590
|
-
|
|
1590
|
+
d === "top" ? x = i + f : d === "bottom" ? x = i + r - f : x = i + (r + f) / 2;
|
|
1591
1591
|
let u = 0;
|
|
1592
|
-
l === "left" ? u = e +
|
|
1593
|
-
const { _text: y, ellipsis: g } = this.handleEllipsis(t, s,
|
|
1592
|
+
l === "left" ? u = e + f : l === "right" ? u = e + s - f : u = e + s / 2;
|
|
1593
|
+
const { _text: y, ellipsis: g } = this.handleEllipsis(t, s, f);
|
|
1594
1594
|
return this.ctx.fillText(y, u, x), this.ctx.restore(), g;
|
|
1595
1595
|
}
|
|
1596
1596
|
handleEllipsis(t, e, i = 0) {
|
|
@@ -1679,8 +1679,6 @@ class Bt {
|
|
|
1679
1679
|
c(this, "ENABLE_SELECTOR", !1);
|
|
1680
1680
|
c(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
1681
1681
|
// 启用单点击立马编辑
|
|
1682
|
-
c(this, "ENABLE_EDIT_TEXT_ENTER", !0);
|
|
1683
|
-
// 启用文本编辑器回车键确认
|
|
1684
1682
|
c(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1685
1683
|
// 启用点击选择器编辑
|
|
1686
1684
|
c(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
@@ -1835,8 +1833,8 @@ class ii {
|
|
|
1835
1833
|
const o = new Image(), n = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1836
1834
|
type: "image/svg+xml"
|
|
1837
1835
|
}), l = URL.createObjectURL(n);
|
|
1838
|
-
return o.src = l, new Promise((h,
|
|
1839
|
-
o.onerror = () =>
|
|
1836
|
+
return o.src = l, new Promise((h, f) => {
|
|
1837
|
+
o.onerror = () => f(new Error("Failed to load image")), o.onload = () => {
|
|
1840
1838
|
h(o);
|
|
1841
1839
|
};
|
|
1842
1840
|
});
|
|
@@ -1883,8 +1881,8 @@ class Jt {
|
|
|
1883
1881
|
}
|
|
1884
1882
|
}
|
|
1885
1883
|
class Qt extends Jt {
|
|
1886
|
-
constructor(e, i, s, r, o, n, l, h,
|
|
1887
|
-
super(e, r, o, n, l, h.fixed,
|
|
1884
|
+
constructor(e, i, s, r, o, n, l, h, f, d = "body") {
|
|
1885
|
+
super(e, r, o, n, l, h.fixed, d);
|
|
1888
1886
|
c(this, "formatter");
|
|
1889
1887
|
c(this, "hoverIconName", "");
|
|
1890
1888
|
c(this, "align");
|
|
@@ -1929,7 +1927,7 @@ class Qt extends Jt {
|
|
|
1929
1927
|
c(this, "overflowTooltipShow", !0);
|
|
1930
1928
|
c(this, "overflowTooltipMaxWidth", 500);
|
|
1931
1929
|
c(this, "overflowTooltipPlacement", "top");
|
|
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 =
|
|
1930
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "text", this.editorType = h.editorType || "text", this.cellType = d, this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level, this.column = h, this.rules = h.rules, this.row = f, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.update();
|
|
1933
1931
|
}
|
|
1934
1932
|
getValidationMessage() {
|
|
1935
1933
|
const e = this.ctx.database.getValidationError(this.rowKey, this.key);
|
|
@@ -2023,11 +2021,11 @@ class Qt extends Jt {
|
|
|
2023
2021
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2024
2022
|
let r, o = 0, n = "";
|
|
2025
2023
|
if (this.type === "tree" && s === "body") {
|
|
2026
|
-
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren:
|
|
2027
|
-
if (
|
|
2024
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = l || {};
|
|
2025
|
+
if (d) {
|
|
2028
2026
|
const u = this.ctx.icons.get("loading");
|
|
2029
2027
|
n = "loading", r = u, o = x * 8;
|
|
2030
|
-
} else if (
|
|
2028
|
+
} else if (f) {
|
|
2031
2029
|
const u = this.ctx.icons.get("expand"), y = this.ctx.icons.get("shrink");
|
|
2032
2030
|
r = h ? y : u, n = h ? "shrink" : "expand", o = x * 8;
|
|
2033
2031
|
} else
|
|
@@ -2048,8 +2046,8 @@ class Qt extends Jt {
|
|
|
2048
2046
|
FOOTER_BG_COLOR: n,
|
|
2049
2047
|
HIGHLIGHT_SELECTED_ROW: l,
|
|
2050
2048
|
HIGHLIGHT_SELECTED_ROW_COLOR: h,
|
|
2051
|
-
HIGHLIGHT_HOVER_ROW:
|
|
2052
|
-
HIGHLIGHT_HOVER_ROW_COLOR:
|
|
2049
|
+
HIGHLIGHT_HOVER_ROW: f,
|
|
2050
|
+
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
2053
2051
|
} = this.ctx.config;
|
|
2054
2052
|
if (this.cellType === "footer") {
|
|
2055
2053
|
let p = n, E = o;
|
|
@@ -2068,7 +2066,7 @@ class Qt extends Jt {
|
|
|
2068
2066
|
}
|
|
2069
2067
|
let x = "transparent";
|
|
2070
2068
|
const u = this.ctx.focusCell, y = this.ctx.hoverCell;
|
|
2071
|
-
|
|
2069
|
+
f && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = d), l && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = h), this.drawCellSkyBgColor = x;
|
|
2072
2070
|
let g = e, w = o;
|
|
2073
2071
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2074
2072
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
@@ -2089,9 +2087,9 @@ class Qt extends Jt {
|
|
|
2089
2087
|
updateSelection() {
|
|
2090
2088
|
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex: l, rowKey: h } = this;
|
|
2091
2089
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(n)) {
|
|
2092
|
-
const
|
|
2090
|
+
const f = this.ctx.database.getRowSelection(h), d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, y = this.drawY + (i - x) / 2;
|
|
2093
2091
|
let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
2094
|
-
|
|
2092
|
+
f && d ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : f && d ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !f && d ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = u, this.drawImageY = y, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g) : g && n === "selection" && (this.drawImageX = u, this.drawImageY = y, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g);
|
|
2095
2093
|
}
|
|
2096
2094
|
}
|
|
2097
2095
|
updateHoverIcon() {
|
|
@@ -2221,8 +2219,8 @@ class Qt extends Jt {
|
|
|
2221
2219
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2222
2220
|
if (!s || !i)
|
|
2223
2221
|
return;
|
|
2224
|
-
const { xArr: r, yArr: o } = this.ctx.selector, n = r[1], l = o[1], { colIndex: h, rowIndex:
|
|
2225
|
-
h === n &&
|
|
2222
|
+
const { xArr: r, yArr: o } = this.ctx.selector, n = r[1], l = o[1], { colIndex: h, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2223
|
+
h === n && f === l && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2226
2224
|
borderColor: "#fff",
|
|
2227
2225
|
fillColor: e
|
|
2228
2226
|
});
|
|
@@ -2277,9 +2275,9 @@ class Qt extends Jt {
|
|
|
2277
2275
|
}
|
|
2278
2276
|
drawBorder(e) {
|
|
2279
2277
|
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: n } = this, l = i + 0.5;
|
|
2280
|
-
let h = s + 0.5,
|
|
2281
|
-
o === 0 && (h = this.y + 1,
|
|
2282
|
-
const { xArr:
|
|
2278
|
+
let h = s + 0.5, f = this.height;
|
|
2279
|
+
o === 0 && (h = this.y + 1, f = f - 1);
|
|
2280
|
+
const { xArr: d, yArr: x, lineDash: u = [], borderWidth: y = 1, borderColor: g, fillColor: w } = e, p = d[0], E = d[1], m = x[0], b = x[1];
|
|
2283
2281
|
n >= p && n <= E && o === m && this.ctx.paint.drawLine([l, h, l + r - 2, h], {
|
|
2284
2282
|
borderColor: g,
|
|
2285
2283
|
fillColor: w,
|
|
@@ -2287,21 +2285,21 @@ class Qt extends Jt {
|
|
|
2287
2285
|
lineCap: "round",
|
|
2288
2286
|
lineJoin: "round",
|
|
2289
2287
|
lineDash: u
|
|
2290
|
-
}), n >= p && n <= E && o === b && this.ctx.paint.drawLine([l, h +
|
|
2288
|
+
}), n >= p && n <= E && o === b && this.ctx.paint.drawLine([l, h + f - 1.5, l + r, h + f - 1.5], {
|
|
2291
2289
|
borderColor: g,
|
|
2292
2290
|
fillColor: w,
|
|
2293
2291
|
borderWidth: y,
|
|
2294
2292
|
lineCap: "round",
|
|
2295
2293
|
lineJoin: "round",
|
|
2296
2294
|
lineDash: u
|
|
2297
|
-
}), n === p && o >= m && o <= b && this.ctx.paint.drawLine([l, h, l, h +
|
|
2295
|
+
}), n === p && o >= m && o <= b && this.ctx.paint.drawLine([l, h, l, h + f - 1], {
|
|
2298
2296
|
borderColor: g,
|
|
2299
2297
|
fillColor: w,
|
|
2300
2298
|
borderWidth: y,
|
|
2301
2299
|
lineCap: "round",
|
|
2302
2300
|
lineJoin: "round",
|
|
2303
2301
|
lineDash: u
|
|
2304
|
-
}), n === E && o >= m && o <= b && this.ctx.paint.drawLine([l + r - 1, h, l + r - 1, h +
|
|
2302
|
+
}), n === E && o >= m && o <= b && this.ctx.paint.drawLine([l + r - 1, h, l + r - 1, h + f - 1], {
|
|
2305
2303
|
borderColor: g,
|
|
2306
2304
|
fillColor: w,
|
|
2307
2305
|
borderWidth: y,
|
|
@@ -2396,9 +2394,9 @@ class te extends Jt {
|
|
|
2396
2394
|
drawSelection() {
|
|
2397
2395
|
const { width: e, height: i, type: s } = this;
|
|
2398
2396
|
if (["index-selection", "selection"].includes(s)) {
|
|
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,
|
|
2400
|
-
let
|
|
2401
|
-
r ? (
|
|
2397
|
+
const { indeterminate: r, check: o, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: l = 0 } = this.ctx.config, h = this.drawX + (e - l) / 2, f = this.drawY + (i - l) / 2;
|
|
2398
|
+
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2399
|
+
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && n ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && n ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && n ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = h, this.drawImageY = f, this.drawImageWidth = l, this.drawImageHeight = l, this.drawImageName = x, this.drawImageSource = d, this.ctx.paint.drawImage(
|
|
2402
2400
|
this.drawImageSource,
|
|
2403
2401
|
this.drawImageX,
|
|
2404
2402
|
this.drawImageY,
|
|
@@ -2451,8 +2449,8 @@ class si {
|
|
|
2451
2449
|
for (const o of r) {
|
|
2452
2450
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2453
2451
|
for (const l of n) {
|
|
2454
|
-
const h = l.getDrawX(),
|
|
2455
|
-
if (i > h && i < h + l.width && e >
|
|
2452
|
+
const h = l.getDrawX(), f = l.getDrawY();
|
|
2453
|
+
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2456
2454
|
this.ctx.setFocusCell(l), this.ctx.emit("cellMousedown", l, t);
|
|
2457
2455
|
return;
|
|
2458
2456
|
}
|
|
@@ -2473,8 +2471,8 @@ class si {
|
|
|
2473
2471
|
for (const o of r) {
|
|
2474
2472
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2475
2473
|
for (const l of n) {
|
|
2476
|
-
const h = l.getDrawX(),
|
|
2477
|
-
if (i > h && i < h + l.width && e >
|
|
2474
|
+
const h = l.getDrawX(), f = l.getDrawY();
|
|
2475
|
+
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2478
2476
|
this.ctx.clickCell = l, this.ctx.emit("cellClick", l, t), this.selectionClick(l), this.treeClick(l);
|
|
2479
2477
|
return;
|
|
2480
2478
|
}
|
|
@@ -2495,8 +2493,8 @@ class si {
|
|
|
2495
2493
|
for (const o of r) {
|
|
2496
2494
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2497
2495
|
for (const l of n) {
|
|
2498
|
-
const h = l.getDrawX(),
|
|
2499
|
-
if (i > h && i < h + l.width && e >
|
|
2496
|
+
const h = l.getDrawX(), f = l.getDrawY();
|
|
2497
|
+
if (i > h && i < h + l.width && e > f && e < f + l.height) {
|
|
2500
2498
|
this.ctx.emit("cellContextMenuClick", l, t);
|
|
2501
2499
|
return;
|
|
2502
2500
|
}
|
|
@@ -2520,8 +2518,8 @@ class si {
|
|
|
2520
2518
|
for (const n of r) {
|
|
2521
2519
|
const l = n.fixedCells.concat(n.noFixedCells);
|
|
2522
2520
|
for (const h of l) {
|
|
2523
|
-
const
|
|
2524
|
-
if (i >
|
|
2521
|
+
const f = h.getDrawX(), d = h.getDrawY();
|
|
2522
|
+
if (i > f && i < f + h.visibleWidth && e > d && e < d + h.visibleHeight && (this.imageEnterAndLeave(h, t), this.visibleHoverCell !== h && (this.ctx.emit("visibleCellMouseleave", h, t), this.visibleHoverCell = h, this.ctx.emit("visibleCellHoverChange", h, t))), i > f && i < f + h.width && e > d && e < d + h.height) {
|
|
2525
2523
|
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
2524
|
((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);
|
|
2527
2525
|
return;
|
|
@@ -2715,8 +2713,8 @@ class ri {
|
|
|
2715
2713
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2716
2714
|
const o = [];
|
|
2717
2715
|
for (let n = 0; n <= i[1] - i[0]; n++) {
|
|
2718
|
-
const l = r + e[0], h = n + i[0],
|
|
2719
|
-
|
|
2716
|
+
const l = r + e[0], h = n + i[0], f = this.database.getItemValueForRowIndexAndColIndex(l, h);
|
|
2717
|
+
f && o.push(f.value);
|
|
2720
2718
|
}
|
|
2721
2719
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
2722
2720
|
}
|
|
@@ -2833,18 +2831,18 @@ class Wt {
|
|
|
2833
2831
|
}
|
|
2834
2832
|
updateScroll(t) {
|
|
2835
2833
|
const e = t.deltaX, i = t.deltaY;
|
|
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 ?
|
|
2834
|
+
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 ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.scroll = Math.max(0, Math.min(this.scroll + e, this.distance)));
|
|
2837
2835
|
}
|
|
2838
2836
|
updatedSize() {
|
|
2839
2837
|
const {
|
|
2840
2838
|
body: t,
|
|
2841
2839
|
header: e,
|
|
2842
2840
|
config: { SCROLLER_TRACK_SIZE: i = 0, SCROLLER_SIZE: s = 0 }
|
|
2843
|
-
} = this.ctx, r = this.ctx.target.width + 1, o = this.ctx.target.height, n = e.height, l = e.width, h = t.height,
|
|
2841
|
+
} = this.ctx, r = this.ctx.target.width + 1, o = this.ctx.target.height, n = e.height, l = e.width, h = t.height, f = this.ctx.footer.height;
|
|
2844
2842
|
if (this.type === "vertical") {
|
|
2845
|
-
this.visibleDistance = o - i - n, this.distance = h - this.visibleDistance +
|
|
2846
|
-
const
|
|
2847
|
-
let x = Math.floor(
|
|
2843
|
+
this.visibleDistance = o - i - n, this.distance = h - this.visibleDistance + f, 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;
|
|
2844
|
+
const d = this.distance ? this.visibleDistance / h : 0;
|
|
2845
|
+
let x = Math.floor(d * this.visibleDistance);
|
|
2848
2846
|
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));
|
|
2849
2847
|
} else {
|
|
2850
2848
|
this.visibleDistance = r - i, this.distance = l - this.visibleDistance, this.splitPoints = [
|
|
@@ -2853,8 +2851,8 @@ class Wt {
|
|
|
2853
2851
|
r - i,
|
|
2854
2852
|
o
|
|
2855
2853
|
], this.trackX = 0, this.trackY = o - i, this.trackWidth = r, this.trackHeight = i;
|
|
2856
|
-
const
|
|
2857
|
-
let x = Math.floor(
|
|
2854
|
+
const d = this.distance ? this.visibleDistance / l : 0;
|
|
2855
|
+
let x = Math.floor(d * this.visibleDistance);
|
|
2858
2856
|
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));
|
|
2859
2857
|
}
|
|
2860
2858
|
}
|
|
@@ -2980,31 +2978,20 @@ class ni {
|
|
|
2980
2978
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
2981
2979
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
2982
2980
|
const s = Ut(i), r = It(i);
|
|
2983
|
-
this.height = t * s, this.width = r.reduce(
|
|
2984
|
-
(d, f) => d + ((f == null ? void 0 : f.width) || 100),
|
|
2985
|
-
0
|
|
2986
|
-
), this.visibleHeight = this.height;
|
|
2981
|
+
this.height = t * s, this.width = r.reduce((d, x) => d + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
2987
2982
|
const o = Ue(Zt(i, s));
|
|
2988
2983
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
2989
2984
|
const n = this.ctx.targetContainer.getBoundingClientRect();
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2985
|
+
this.resizeNum > 0 ? this.ctx.target.width = n.width : this.ctx.target.width = this.width + e - 1, this.visibleWidth = this.ctx.target.width - e;
|
|
2986
|
+
const l = this.visibleWidth - this.width;
|
|
2987
|
+
if (this.resizeNum && l > 0) {
|
|
2988
|
+
const d = Math.floor(l / this.resizeNum * 100) / 100;
|
|
2989
|
+
this.resizeAllColumn(d);
|
|
2993
2990
|
}
|
|
2994
|
-
const
|
|
2995
|
-
|
|
2996
|
-
);
|
|
2997
|
-
this.ctx.
|
|
2998
|
-
(d, f) => d + f.width,
|
|
2999
|
-
0
|
|
3000
|
-
);
|
|
3001
|
-
const h = this.fixedRightCellHeaders.filter(
|
|
3002
|
-
(d) => !d.hasChildren
|
|
3003
|
-
);
|
|
3004
|
-
this.ctx.fixedRightWidth = h.reduce(
|
|
3005
|
-
(d, f) => d + f.width,
|
|
3006
|
-
e
|
|
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;
|
|
2991
|
+
const h = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
2992
|
+
this.ctx.fixedLeftWidth = h.reduce((d, x) => d + x.width, 0);
|
|
2993
|
+
const f = this.fixedRightCellHeaders.filter((d) => !d.hasChildren);
|
|
2994
|
+
this.ctx.fixedRightWidth = f.reduce((d, x) => d + x.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
3008
2995
|
}
|
|
3009
2996
|
// 调整表头的宽度
|
|
3010
2997
|
initResizeColumn() {
|
|
@@ -3029,10 +3016,7 @@ class ni {
|
|
|
3029
3016
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3030
3017
|
return;
|
|
3031
3018
|
this.ctx.target.style.cursor === "col-resize" && (this.ctx.target.style.cursor = "default");
|
|
3032
|
-
const r = [
|
|
3033
|
-
...this.renderFixedCellHeaders,
|
|
3034
|
-
...this.renderCenterCellHeaders
|
|
3035
|
-
];
|
|
3019
|
+
const r = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3036
3020
|
for (const o of r) {
|
|
3037
3021
|
const n = e.layerX, l = o.getDrawX();
|
|
3038
3022
|
n > l + o.width - 5 && n < l + o.width + 4 && n < i.width - 4 && // 视窗中最后一列不允许调整宽
|
|
@@ -3091,18 +3075,10 @@ class ni {
|
|
|
3091
3075
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3092
3076
|
for (let o = 0; o < i; o++) {
|
|
3093
3077
|
const n = t[o], l = r * (n.rowspan || 1), h = r * n.level;
|
|
3094
|
-
let
|
|
3095
|
-
n.children && (
|
|
3096
|
-
const
|
|
3097
|
-
|
|
3098
|
-
this.columnIndex,
|
|
3099
|
-
s,
|
|
3100
|
-
h,
|
|
3101
|
-
d,
|
|
3102
|
-
l,
|
|
3103
|
-
n
|
|
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;
|
|
3078
|
+
let f = n.width || 100;
|
|
3079
|
+
n.children && (f = It(n.children).reduce((u, y) => u + ((y == null ? void 0 : y.width) || 100), 0));
|
|
3080
|
+
const d = new te(this.ctx, this.columnIndex, s, h, f, l, n);
|
|
3081
|
+
this.ctx.database.setHeader(n.key, d), this.allCellHeaders.push(d), n.children || (this.leafCellHeaders.push(d), d.column.widthFillDisable || this.resizeNum++), n.fixed === "left" ? this.fixedLeftCellHeaders.push(d) : n.fixed === "right" ? this.fixedRightCellHeaders.push(d) : this.centerCellHeaders.push(d), !n.children && this.columnIndex++, n.children && this.render(n.children, s), s += f;
|
|
3106
3082
|
}
|
|
3107
3083
|
}
|
|
3108
3084
|
drawTipLine() {
|
|
@@ -3151,13 +3127,7 @@ class ni {
|
|
|
3151
3127
|
i.push(s), s.hasChildren || t.push(s);
|
|
3152
3128
|
}), this.fixedRightCellHeaders.forEach((s) => {
|
|
3153
3129
|
i.push(s), s.hasChildren || t.push(s);
|
|
3154
|
-
}), this.renderCenterCellHeaders = e, this.renderFixedCellHeaders = i, this.renderLeafCellHeaders = t.sort(
|
|
3155
|
-
(s, r) => s.x - r.x
|
|
3156
|
-
), this.visibleLeafColumns = this.renderLeafCellHeaders.map(
|
|
3157
|
-
(s) => s.column
|
|
3158
|
-
), this.ctx.header.visibleLeafColumns = this.visibleLeafColumns, this.ctx.header.leafCellHeaders = this.leafCellHeaders, this.ctx.header.renderLeafCellHeaders = this.renderLeafCellHeaders, this.ctx.header.renderCellHeaders = this.renderFixedCellHeaders.concat(
|
|
3159
|
-
this.renderCenterCellHeaders
|
|
3160
|
-
);
|
|
3130
|
+
}), this.renderCenterCellHeaders = e, this.renderFixedCellHeaders = i, this.renderLeafCellHeaders = t.sort((s, r) => s.x - r.x), this.visibleLeafColumns = this.renderLeafCellHeaders.map((s) => s.column), this.ctx.header.visibleLeafColumns = this.visibleLeafColumns, this.ctx.header.leafCellHeaders = this.leafCellHeaders, this.ctx.header.renderLeafCellHeaders = this.renderLeafCellHeaders, this.ctx.header.renderCellHeaders = this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders);
|
|
3161
3131
|
}
|
|
3162
3132
|
draw() {
|
|
3163
3133
|
this.renderCenterCellHeaders.forEach((t) => {
|
|
@@ -3257,8 +3227,8 @@ class ai {
|
|
|
3257
3227
|
BORDER_RADIUS: n,
|
|
3258
3228
|
HEIGHT: l,
|
|
3259
3229
|
EMPTY_BODY_HEIGHT: h = 0,
|
|
3260
|
-
MAX_HEIGHT:
|
|
3261
|
-
ENABLE_OFFSET_HEIGHT:
|
|
3230
|
+
MAX_HEIGHT: f = 0,
|
|
3231
|
+
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3262
3232
|
OFFSET_HEIGHT: x = 0
|
|
3263
3233
|
}
|
|
3264
3234
|
} = this.ctx;
|
|
@@ -3284,9 +3254,9 @@ class ai {
|
|
|
3284
3254
|
let E = this.height + e.height + r;
|
|
3285
3255
|
E += w;
|
|
3286
3256
|
let m = 0;
|
|
3287
|
-
this.data.length &&
|
|
3257
|
+
this.data.length && d ? (m = window.innerHeight - g - x, m < 0 && (m = 32, console.error(
|
|
3288
3258
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3289
|
-
))) : this.data.length && l ? m = l : this.data.length &&
|
|
3259
|
+
))) : this.data.length && l ? m = l : this.data.length && f && E > f ? m = f : m = E, m > 0 && (this.ctx.target.height = m);
|
|
3290
3260
|
let b = t.height - e.height - r;
|
|
3291
3261
|
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(
|
|
3292
3262
|
"style",
|
|
@@ -3322,8 +3292,8 @@ class ai {
|
|
|
3322
3292
|
for (let l = 0; l < this.renderRows.length; l++) {
|
|
3323
3293
|
const h = this.renderRows[l];
|
|
3324
3294
|
if (i > h.y - o + h.height - 1.5 && i < h.y - o + h.height + 1.5 && i < r.height - 4)
|
|
3325
|
-
for (let
|
|
3326
|
-
const x = h.cells[
|
|
3295
|
+
for (let d = 0; d < h.cells.length; d++) {
|
|
3296
|
+
const x = h.cells[d];
|
|
3327
3297
|
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget = h);
|
|
3328
3298
|
}
|
|
3329
3299
|
}
|
|
@@ -3398,8 +3368,8 @@ class ai {
|
|
|
3398
3368
|
let l = this.binarySearch(o, s + this.visibleHeight);
|
|
3399
3369
|
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
3370
|
const h = [];
|
|
3401
|
-
for (let
|
|
3402
|
-
const
|
|
3371
|
+
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3372
|
+
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: y } = this.ctx.database.getPositionForRowIndex(d), g = new ee(this.ctx, d, 0, y + this.y, t.width, u, x);
|
|
3403
3373
|
h.push(g);
|
|
3404
3374
|
}
|
|
3405
3375
|
this.renderRows = h, this.ctx.body.renderRows = h;
|
|
@@ -3647,15 +3617,15 @@ class li {
|
|
|
3647
3617
|
return;
|
|
3648
3618
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3649
3619
|
if (t && e && i) {
|
|
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),
|
|
3651
|
-
this.setSelector(
|
|
3620
|
+
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), f = [o, n], d = [l, h];
|
|
3621
|
+
this.setSelector(f, d);
|
|
3652
3622
|
}
|
|
3653
3623
|
}
|
|
3654
3624
|
click(t = !1) {
|
|
3655
3625
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3656
3626
|
if (e)
|
|
3657
3627
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3658
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e, l = Math.min(o, s), h = Math.max(o, s),
|
|
3628
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e, l = Math.min(o, s), h = Math.max(o, s), f = Math.min(n, r), d = Math.max(n, r), x = [l, h], u = [f, d];
|
|
3659
3629
|
this.setSelector(x, u);
|
|
3660
3630
|
} else {
|
|
3661
3631
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3693,9 +3663,9 @@ class li {
|
|
|
3693
3663
|
const r = /* @__PURE__ */ new Set();
|
|
3694
3664
|
for (let n = 0; n <= e[1] - e[0]; n++)
|
|
3695
3665
|
for (let l = 0; l <= t[1] - t[0]; l++) {
|
|
3696
|
-
const h = n + e[0],
|
|
3697
|
-
if (
|
|
3698
|
-
const { rowKey: x, key: u } =
|
|
3666
|
+
const h = n + e[0], f = l + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(h, f);
|
|
3667
|
+
if (d) {
|
|
3668
|
+
const { rowKey: x, key: u } = d;
|
|
3699
3669
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
3700
3670
|
rowKey: x,
|
|
3701
3671
|
key: u,
|
|
@@ -3727,12 +3697,12 @@ class li {
|
|
|
3727
3697
|
let o = [];
|
|
3728
3698
|
const n = r.split("\r");
|
|
3729
3699
|
n.length === 1 ? o = n[0].split(`
|
|
3730
|
-
`).map((
|
|
3700
|
+
`).map((d) => d.split(" ")) : o = n.map((f) => f.split(" "));
|
|
3731
3701
|
let l = [];
|
|
3732
|
-
for (let
|
|
3733
|
-
const
|
|
3734
|
-
for (let x = 0; x <=
|
|
3735
|
-
const u =
|
|
3702
|
+
for (let f = 0; f <= o.length - 1; f++) {
|
|
3703
|
+
const d = o[f].length;
|
|
3704
|
+
for (let x = 0; x <= d - 1; x++) {
|
|
3705
|
+
const u = f + e, y = x + i, g = o[f][x], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3736
3706
|
u,
|
|
3737
3707
|
y
|
|
3738
3708
|
);
|
|
@@ -3749,22 +3719,22 @@ class li {
|
|
|
3749
3719
|
}
|
|
3750
3720
|
}
|
|
3751
3721
|
if (this.isCut) {
|
|
3752
|
-
const
|
|
3722
|
+
const f = this.clearSelectedData(
|
|
3753
3723
|
this.ctx.selector.xArrCopy,
|
|
3754
3724
|
this.ctx.selector.yArrCopy,
|
|
3755
3725
|
!0
|
|
3756
3726
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3757
|
-
),
|
|
3758
|
-
|
|
3759
|
-
|
|
3727
|
+
), d = l.map((x) => `${x.rowKey}-${x.key}`);
|
|
3728
|
+
f.forEach((x) => {
|
|
3729
|
+
d.includes(`${x.rowKey}-${x.key}`) || l.unshift(x);
|
|
3760
3730
|
}), this.isCut = !1;
|
|
3761
3731
|
}
|
|
3762
3732
|
if (!l.length)
|
|
3763
3733
|
return;
|
|
3764
3734
|
this.ctx.database.batchSetItemValue(l, !0);
|
|
3765
3735
|
let h = [];
|
|
3766
|
-
s.forEach((
|
|
3767
|
-
h.push(this.ctx.database.getRowDataItemForRowKey(
|
|
3736
|
+
s.forEach((f) => {
|
|
3737
|
+
h.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
3768
3738
|
}), this.ctx.emit("pasteChange", l, h), this.clearCopyLine(), this.ctx.emit("draw");
|
|
3769
3739
|
}).catch((r) => {
|
|
3770
3740
|
console.error("获取剪贴板内容失败:", r);
|
|
@@ -3796,13 +3766,13 @@ class li {
|
|
|
3796
3766
|
s < l && s++;
|
|
3797
3767
|
break;
|
|
3798
3768
|
}
|
|
3799
|
-
const h = [i, i],
|
|
3800
|
-
if (
|
|
3801
|
-
if (["index", "index-selection", "selection"].includes(
|
|
3769
|
+
const h = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
3770
|
+
if (d) {
|
|
3771
|
+
if (["index", "index-selection", "selection"].includes(d.type))
|
|
3802
3772
|
return;
|
|
3803
|
-
this.ctx.setFocusCell(
|
|
3773
|
+
this.ctx.setFocusCell(d);
|
|
3804
3774
|
}
|
|
3805
|
-
this.setSelector(h,
|
|
3775
|
+
this.setSelector(h, f), this.adjustBoundaryPosition(), this.ctx.emit("draw");
|
|
3806
3776
|
}
|
|
3807
3777
|
stopAdjustPosition() {
|
|
3808
3778
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3839,10 +3809,10 @@ class li {
|
|
|
3839
3809
|
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: r, footer: o, scrollX: n, scrollY: l } = this.ctx;
|
|
3840
3810
|
if (!e)
|
|
3841
3811
|
return;
|
|
3842
|
-
const { SCROLLER_TRACK_SIZE: h = 0, FOOTER_FIXED:
|
|
3843
|
-
let
|
|
3844
|
-
|
|
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 -
|
|
3812
|
+
const { SCROLLER_TRACK_SIZE: h = 0, FOOTER_FIXED: f } = this.ctx.config;
|
|
3813
|
+
let d = 0;
|
|
3814
|
+
f && (d = o.visibleHeight);
|
|
3815
|
+
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 - d - h);
|
|
3846
3816
|
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);
|
|
3847
3817
|
}
|
|
3848
3818
|
destroy() {
|
|
@@ -3857,9 +3827,9 @@ class hi {
|
|
|
3857
3827
|
init() {
|
|
3858
3828
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3859
3829
|
this.ctx.target.style.cursor === "crosshair" && (this.ctx.target.style.cursor = "default");
|
|
3860
|
-
const { xArr: i, yArr: s } = this.ctx.selector, r = i[1], o = s[1], { colIndex: n, rowIndex: l, drawX: h, drawY:
|
|
3830
|
+
const { xArr: i, yArr: s } = this.ctx.selector, r = i[1], o = s[1], { colIndex: n, rowIndex: l, drawX: h, drawY: f, width: d, height: x } = t;
|
|
3861
3831
|
if (this.ctx.config.ENABLE_AUTOFILL && n === r && l === o) {
|
|
3862
|
-
const y = h +
|
|
3832
|
+
const y = h + d - 6, g = f + x - 6;
|
|
3863
3833
|
e.offsetX > y && e.offsetY > g && (this.ctx.target.style.cursor = "crosshair");
|
|
3864
3834
|
}
|
|
3865
3835
|
this.mouseenter(t);
|
|
@@ -3909,16 +3879,16 @@ class hi {
|
|
|
3909
3879
|
*/
|
|
3910
3880
|
autofillData() {
|
|
3911
3881
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
3912
|
-
for (let
|
|
3882
|
+
for (let d = 0; d <= e.yArr[1] - e.yArr[0]; d++)
|
|
3913
3883
|
for (let x = 0; x <= e.xArr[1] - e.xArr[0]; x++) {
|
|
3914
|
-
const u =
|
|
3884
|
+
const u = d + e.yArr[0], y = x + e.xArr[0];
|
|
3915
3885
|
i.set(`${u}-${y}`, !0);
|
|
3916
3886
|
}
|
|
3917
3887
|
const { value: s } = e, r = s[0].length, o = s.length, n = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr;
|
|
3918
3888
|
let h = [];
|
|
3919
|
-
for (let
|
|
3889
|
+
for (let d = 0; d <= l[1] - l[0]; d++)
|
|
3920
3890
|
for (let x = 0; x <= n[1] - n[0]; x++) {
|
|
3921
|
-
const u = x + n[0], y =
|
|
3891
|
+
const u = x + n[0], y = d + l[0], g = s[d % o][x % r], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3922
3892
|
y,
|
|
3923
3893
|
u
|
|
3924
3894
|
), p = `${y}-${u}`;
|
|
@@ -3935,10 +3905,10 @@ class hi {
|
|
|
3935
3905
|
if (!h.length)
|
|
3936
3906
|
return;
|
|
3937
3907
|
this.ctx.database.batchSetItemValue(h, !0);
|
|
3938
|
-
let
|
|
3939
|
-
t.forEach((
|
|
3940
|
-
|
|
3941
|
-
}), this.ctx.emit("autofillChange", h,
|
|
3908
|
+
let f = [];
|
|
3909
|
+
t.forEach((d) => {
|
|
3910
|
+
f.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
3911
|
+
}), this.ctx.emit("autofillChange", h, f), this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.emit("draw");
|
|
3942
3912
|
}
|
|
3943
3913
|
mouseenter(t) {
|
|
3944
3914
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4062,31 +4032,31 @@ function Pt(a, t, e) {
|
|
|
4062
4032
|
reference: i,
|
|
4063
4033
|
floating: s
|
|
4064
4034
|
} = a;
|
|
4065
|
-
const r = J(t), o = Mt(t), n = Ht(o), l = q(t), h = r === "y",
|
|
4035
|
+
const r = J(t), o = Mt(t), n = Ht(o), l = q(t), h = r === "y", f = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, x = i[n] / 2 - s[n] / 2;
|
|
4066
4036
|
let u;
|
|
4067
4037
|
switch (l) {
|
|
4068
4038
|
case "top":
|
|
4069
4039
|
u = {
|
|
4070
|
-
x:
|
|
4040
|
+
x: f,
|
|
4071
4041
|
y: i.y - s.height
|
|
4072
4042
|
};
|
|
4073
4043
|
break;
|
|
4074
4044
|
case "bottom":
|
|
4075
4045
|
u = {
|
|
4076
|
-
x:
|
|
4046
|
+
x: f,
|
|
4077
4047
|
y: i.y + i.height
|
|
4078
4048
|
};
|
|
4079
4049
|
break;
|
|
4080
4050
|
case "right":
|
|
4081
4051
|
u = {
|
|
4082
4052
|
x: i.x + i.width,
|
|
4083
|
-
y:
|
|
4053
|
+
y: d
|
|
4084
4054
|
};
|
|
4085
4055
|
break;
|
|
4086
4056
|
case "left":
|
|
4087
4057
|
u = {
|
|
4088
4058
|
x: i.x - s.width,
|
|
4089
|
-
y:
|
|
4059
|
+
y: d
|
|
4090
4060
|
};
|
|
4091
4061
|
break;
|
|
4092
4062
|
default:
|
|
@@ -4117,8 +4087,8 @@ const yi = async (a, t, e) => {
|
|
|
4117
4087
|
floating: t,
|
|
4118
4088
|
strategy: s
|
|
4119
4089
|
}), {
|
|
4120
|
-
x:
|
|
4121
|
-
y:
|
|
4090
|
+
x: f,
|
|
4091
|
+
y: d
|
|
4122
4092
|
} = Pt(h, i, l), x = i, u = {}, y = 0;
|
|
4123
4093
|
for (let g = 0; g < n.length; g++) {
|
|
4124
4094
|
const {
|
|
@@ -4130,8 +4100,8 @@ const yi = async (a, t, e) => {
|
|
|
4130
4100
|
data: b,
|
|
4131
4101
|
reset: C
|
|
4132
4102
|
} = await p({
|
|
4133
|
-
x:
|
|
4134
|
-
y:
|
|
4103
|
+
x: f,
|
|
4104
|
+
y: d,
|
|
4135
4105
|
initialPlacement: i,
|
|
4136
4106
|
placement: x,
|
|
4137
4107
|
strategy: s,
|
|
@@ -4143,7 +4113,7 @@ const yi = async (a, t, e) => {
|
|
|
4143
4113
|
floating: t
|
|
4144
4114
|
}
|
|
4145
4115
|
});
|
|
4146
|
-
|
|
4116
|
+
f = E ?? f, d = m ?? d, u = {
|
|
4147
4117
|
...u,
|
|
4148
4118
|
[w]: {
|
|
4149
4119
|
...u[w],
|
|
@@ -4154,13 +4124,13 @@ const yi = async (a, t, e) => {
|
|
|
4154
4124
|
floating: t,
|
|
4155
4125
|
strategy: s
|
|
4156
4126
|
}) : C.rects), {
|
|
4157
|
-
x:
|
|
4158
|
-
y:
|
|
4127
|
+
x: f,
|
|
4128
|
+
y: d
|
|
4159
4129
|
} = Pt(h, x, l)), g = -1);
|
|
4160
4130
|
}
|
|
4161
4131
|
return {
|
|
4162
|
-
x:
|
|
4163
|
-
y:
|
|
4132
|
+
x: f,
|
|
4133
|
+
y: d,
|
|
4164
4134
|
placement: x,
|
|
4165
4135
|
strategy: s,
|
|
4166
4136
|
middlewareData: u
|
|
@@ -4178,16 +4148,16 @@ async function re(a, t) {
|
|
|
4178
4148
|
strategy: l
|
|
4179
4149
|
} = a, {
|
|
4180
4150
|
boundary: h = "clippingAncestors",
|
|
4181
|
-
rootBoundary:
|
|
4182
|
-
elementContext:
|
|
4151
|
+
rootBoundary: f = "viewport",
|
|
4152
|
+
elementContext: d = "floating",
|
|
4183
4153
|
altBoundary: x = !1,
|
|
4184
4154
|
padding: u = 0
|
|
4185
|
-
} = at(t, a), y = se(u), w = n[x ?
|
|
4155
|
+
} = at(t, a), y = se(u), w = n[x ? d === "floating" ? "reference" : "floating" : d], p = ut(await r.getClippingRect({
|
|
4186
4156
|
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)),
|
|
4187
4157
|
boundary: h,
|
|
4188
|
-
rootBoundary:
|
|
4158
|
+
rootBoundary: f,
|
|
4189
4159
|
strategy: l
|
|
4190
|
-
})), E =
|
|
4160
|
+
})), E = d === "floating" ? {
|
|
4191
4161
|
x: i,
|
|
4192
4162
|
y: s,
|
|
4193
4163
|
width: o.floating.width,
|
|
@@ -4225,17 +4195,17 @@ const mi = (a) => ({
|
|
|
4225
4195
|
middlewareData: l
|
|
4226
4196
|
} = t, {
|
|
4227
4197
|
element: h,
|
|
4228
|
-
padding:
|
|
4198
|
+
padding: f = 0
|
|
4229
4199
|
} = at(a, t) || {};
|
|
4230
4200
|
if (h == null)
|
|
4231
4201
|
return {};
|
|
4232
|
-
const
|
|
4202
|
+
const d = se(f), x = {
|
|
4233
4203
|
x: e,
|
|
4234
4204
|
y: i
|
|
4235
4205
|
}, 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
|
|
4237
|
-
(!
|
|
4238
|
-
const L = b / 2 - C / 2, A =
|
|
4206
|
+
let T = R ? R[m] : 0;
|
|
4207
|
+
(!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T = n.floating[m] || r.floating[y]);
|
|
4208
|
+
const L = b / 2 - C / 2, A = T / 2 - g[y] / 2 - 1, D = rt(d[p], A), B = rt(d[E], A), O = D, S = T - g[y] - B, _ = T / 2 - g[y] / 2 + L, G = Ot(O, _, S), K = !l.arrow && ct(s) != null && _ !== G && r.reference[y] / 2 - (_ < O ? D : B) - g[y] / 2 < 0, X = K ? _ < O ? _ - O : _ - S : 0;
|
|
4239
4209
|
return {
|
|
4240
4210
|
[u]: x[u] + X,
|
|
4241
4211
|
data: {
|
|
@@ -4262,8 +4232,8 @@ const mi = (a) => ({
|
|
|
4262
4232
|
platform: l,
|
|
4263
4233
|
elements: h
|
|
4264
4234
|
} = t, {
|
|
4265
|
-
mainAxis:
|
|
4266
|
-
crossAxis:
|
|
4235
|
+
mainAxis: f = !0,
|
|
4236
|
+
crossAxis: d = !0,
|
|
4267
4237
|
fallbackPlacements: x,
|
|
4268
4238
|
fallbackStrategy: u = "bestFit",
|
|
4269
4239
|
fallbackAxisSideDirection: y = "none",
|
|
@@ -4274,9 +4244,9 @@ const mi = (a) => ({
|
|
|
4274
4244
|
return {};
|
|
4275
4245
|
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";
|
|
4276
4246
|
!x && R && C.push(...wi(n, g, y, b));
|
|
4277
|
-
const
|
|
4247
|
+
const T = [n, ...C], L = await re(t, w), A = [];
|
|
4278
4248
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4279
|
-
if (
|
|
4249
|
+
if (f && A.push(L[p]), d) {
|
|
4280
4250
|
const _ = xi(s, o, b);
|
|
4281
4251
|
A.push(L[_[0]], L[_[1]]);
|
|
4282
4252
|
}
|
|
@@ -4285,7 +4255,7 @@ const mi = (a) => ({
|
|
|
4285
4255
|
overflows: A
|
|
4286
4256
|
}], !A.every((_) => _ <= 0)) {
|
|
4287
4257
|
var B, O;
|
|
4288
|
-
const _ = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G =
|
|
4258
|
+
const _ = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G = T[_];
|
|
4289
4259
|
if (G)
|
|
4290
4260
|
return {
|
|
4291
4261
|
data: {
|
|
@@ -4300,8 +4270,8 @@ const mi = (a) => ({
|
|
|
4300
4270
|
if (!K)
|
|
4301
4271
|
switch (u) {
|
|
4302
4272
|
case "bestFit": {
|
|
4303
|
-
var
|
|
4304
|
-
const X = (
|
|
4273
|
+
var S;
|
|
4274
|
+
const X = (S = D.filter((W) => {
|
|
4305
4275
|
if (R) {
|
|
4306
4276
|
const P = J(W.placement);
|
|
4307
4277
|
return P === E || // Create a bias to the `y` side axis due to horizontal
|
|
@@ -4309,7 +4279,7 @@ const mi = (a) => ({
|
|
|
4309
4279
|
P === "y";
|
|
4310
4280
|
}
|
|
4311
4281
|
return !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 :
|
|
4282
|
+
}).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 : S[0];
|
|
4313
4283
|
X && (K = X);
|
|
4314
4284
|
break;
|
|
4315
4285
|
}
|
|
@@ -4333,26 +4303,26 @@ async function bi(a, t) {
|
|
|
4333
4303
|
placement: e,
|
|
4334
4304
|
platform: i,
|
|
4335
4305
|
elements: s
|
|
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,
|
|
4306
|
+
} = 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, f = r && l ? -1 : 1, d = at(t, a);
|
|
4337
4307
|
let {
|
|
4338
4308
|
mainAxis: x,
|
|
4339
4309
|
crossAxis: u,
|
|
4340
4310
|
alignmentAxis: y
|
|
4341
|
-
} = typeof
|
|
4342
|
-
mainAxis:
|
|
4311
|
+
} = typeof d == "number" ? {
|
|
4312
|
+
mainAxis: d,
|
|
4343
4313
|
crossAxis: 0,
|
|
4344
4314
|
alignmentAxis: null
|
|
4345
4315
|
} : {
|
|
4346
|
-
mainAxis:
|
|
4347
|
-
crossAxis:
|
|
4348
|
-
alignmentAxis:
|
|
4316
|
+
mainAxis: d.mainAxis || 0,
|
|
4317
|
+
crossAxis: d.crossAxis || 0,
|
|
4318
|
+
alignmentAxis: d.alignmentAxis
|
|
4349
4319
|
};
|
|
4350
4320
|
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y), l ? {
|
|
4351
|
-
x: u *
|
|
4321
|
+
x: u * f,
|
|
4352
4322
|
y: x * h
|
|
4353
4323
|
} : {
|
|
4354
4324
|
x: x * h,
|
|
4355
|
-
y: u *
|
|
4325
|
+
y: u * f
|
|
4356
4326
|
};
|
|
4357
4327
|
}
|
|
4358
4328
|
const Ci = function(a) {
|
|
@@ -4405,20 +4375,20 @@ const Ci = function(a) {
|
|
|
4405
4375
|
} = at(a, t), h = {
|
|
4406
4376
|
x: e,
|
|
4407
4377
|
y: i
|
|
4408
|
-
},
|
|
4409
|
-
let u = h[x], y = h[
|
|
4378
|
+
}, f = await re(t, l), d = J(q(s)), x = ie(d);
|
|
4379
|
+
let u = h[x], y = h[d];
|
|
4410
4380
|
if (r) {
|
|
4411
|
-
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u +
|
|
4381
|
+
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u + f[w], m = u - f[p];
|
|
4412
4382
|
u = Ot(E, u, m);
|
|
4413
4383
|
}
|
|
4414
4384
|
if (o) {
|
|
4415
|
-
const w =
|
|
4385
|
+
const w = d === "y" ? "top" : "left", p = d === "y" ? "bottom" : "right", E = y + f[w], m = y - f[p];
|
|
4416
4386
|
y = Ot(E, y, m);
|
|
4417
4387
|
}
|
|
4418
4388
|
const g = n.fn({
|
|
4419
4389
|
...t,
|
|
4420
4390
|
[x]: u,
|
|
4421
|
-
[
|
|
4391
|
+
[d]: y
|
|
4422
4392
|
});
|
|
4423
4393
|
return {
|
|
4424
4394
|
...g,
|
|
@@ -4427,7 +4397,7 @@ const Ci = function(a) {
|
|
|
4427
4397
|
y: g.y - i,
|
|
4428
4398
|
enabled: {
|
|
4429
4399
|
[x]: r,
|
|
4430
|
-
[
|
|
4400
|
+
[d]: o
|
|
4431
4401
|
}
|
|
4432
4402
|
}
|
|
4433
4403
|
};
|
|
@@ -4530,17 +4500,17 @@ function ne(a) {
|
|
|
4530
4500
|
const t = z(a);
|
|
4531
4501
|
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) && lt(t) ? t : ne(t);
|
|
4532
4502
|
}
|
|
4533
|
-
function
|
|
4503
|
+
function St(a, t, e) {
|
|
4534
4504
|
var i;
|
|
4535
4505
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4536
4506
|
const s = ne(a), r = s === ((i = a.ownerDocument) == null ? void 0 : i.body), o = M(s);
|
|
4537
4507
|
if (r) {
|
|
4538
|
-
const n =
|
|
4539
|
-
return t.concat(o, o.visualViewport || [], lt(s) ? s : [], n && e ?
|
|
4508
|
+
const n = Tt(o);
|
|
4509
|
+
return t.concat(o, o.visualViewport || [], lt(s) ? s : [], n && e ? St(n) : []);
|
|
4540
4510
|
}
|
|
4541
|
-
return t.concat(s,
|
|
4511
|
+
return t.concat(s, St(s, [], e));
|
|
4542
4512
|
}
|
|
4543
|
-
function
|
|
4513
|
+
function Tt(a) {
|
|
4544
4514
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
4545
4515
|
}
|
|
4546
4516
|
function ae(a) {
|
|
@@ -4588,23 +4558,23 @@ function ot(a, t, e, i) {
|
|
|
4588
4558
|
let o = V(1);
|
|
4589
4559
|
t && (i ? k(i) && (o = Z(i)) : o = Z(a));
|
|
4590
4560
|
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,
|
|
4561
|
+
let l = (s.left + n.x) / o.x, h = (s.top + n.y) / o.y, f = s.width / o.x, d = s.height / o.y;
|
|
4592
4562
|
if (r) {
|
|
4593
4563
|
const x = M(r), u = i && k(i) ? M(i) : i;
|
|
4594
|
-
let y = x, g =
|
|
4564
|
+
let y = x, g = Tt(y);
|
|
4595
4565
|
for (; g && i && u !== y; ) {
|
|
4596
4566
|
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;
|
|
4597
|
-
l *= w.x, h *= w.y,
|
|
4567
|
+
l *= w.x, h *= w.y, f *= w.x, d *= w.y, l += m, h += b, y = M(g), g = Tt(y);
|
|
4598
4568
|
}
|
|
4599
4569
|
}
|
|
4600
4570
|
return ut({
|
|
4601
|
-
width:
|
|
4602
|
-
height:
|
|
4571
|
+
width: f,
|
|
4572
|
+
height: d,
|
|
4603
4573
|
x: l,
|
|
4604
4574
|
y: h
|
|
4605
4575
|
});
|
|
4606
4576
|
}
|
|
4607
|
-
function
|
|
4577
|
+
function Si(a) {
|
|
4608
4578
|
let {
|
|
4609
4579
|
elements: t,
|
|
4610
4580
|
rect: e,
|
|
@@ -4618,19 +4588,19 @@ function Ti(a) {
|
|
|
4618
4588
|
scrollLeft: 0,
|
|
4619
4589
|
scrollTop: 0
|
|
4620
4590
|
}, h = V(1);
|
|
4621
|
-
const
|
|
4622
|
-
if ((
|
|
4591
|
+
const f = V(0), d = N(i);
|
|
4592
|
+
if ((d || !d && !r) && ((tt(i) !== "body" || lt(o)) && (l = pt(i)), N(i))) {
|
|
4623
4593
|
const x = ot(i);
|
|
4624
|
-
h = Z(i),
|
|
4594
|
+
h = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4625
4595
|
}
|
|
4626
4596
|
return {
|
|
4627
4597
|
width: e.width * h.x,
|
|
4628
4598
|
height: e.height * h.y,
|
|
4629
|
-
x: e.x * h.x - l.scrollLeft * h.x +
|
|
4630
|
-
y: e.y * h.y - l.scrollTop * h.y +
|
|
4599
|
+
x: e.x * h.x - l.scrollLeft * h.x + f.x,
|
|
4600
|
+
y: e.y * h.y - l.scrollTop * h.y + f.y
|
|
4631
4601
|
};
|
|
4632
4602
|
}
|
|
4633
|
-
function
|
|
4603
|
+
function Ti(a) {
|
|
4634
4604
|
return Array.from(a.getClientRects());
|
|
4635
4605
|
}
|
|
4636
4606
|
function Lt(a, t) {
|
|
@@ -4698,12 +4668,12 @@ function Mi(a, t) {
|
|
|
4698
4668
|
const e = t.get(a);
|
|
4699
4669
|
if (e)
|
|
4700
4670
|
return e;
|
|
4701
|
-
let i =
|
|
4671
|
+
let i = St(a, [], !1).filter((n) => k(n) && tt(n) !== "body"), s = null;
|
|
4702
4672
|
const r = F(a).position === "fixed";
|
|
4703
4673
|
let o = r ? z(a) : a;
|
|
4704
4674
|
for (; k(o) && !Q(o); ) {
|
|
4705
4675
|
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((
|
|
4676
|
+
!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((f) => f !== o) : s = n, o = z(o);
|
|
4707
4677
|
}
|
|
4708
4678
|
return t.set(a, i), i;
|
|
4709
4679
|
}
|
|
@@ -4714,9 +4684,9 @@ function Di(a) {
|
|
|
4714
4684
|
rootBoundary: i,
|
|
4715
4685
|
strategy: s
|
|
4716
4686
|
} = a;
|
|
4717
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Mi(t, this._c) : [].concat(e), i], n = o[0], l = o.reduce((h,
|
|
4718
|
-
const
|
|
4719
|
-
return h.top = U(
|
|
4687
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Mi(t, this._c) : [].concat(e), i], n = o[0], l = o.reduce((h, f) => {
|
|
4688
|
+
const d = zt(t, f, s);
|
|
4689
|
+
return h.top = U(d.top, h.top), h.right = rt(d.right, h.right), h.bottom = rt(d.bottom, h.bottom), h.left = U(d.left, h.left), h;
|
|
4720
4690
|
}, zt(t, n, s));
|
|
4721
4691
|
return {
|
|
4722
4692
|
width: l.right - l.left,
|
|
@@ -4747,15 +4717,15 @@ function Fi(a, t, e) {
|
|
|
4747
4717
|
const u = ot(t, !0, r, t);
|
|
4748
4718
|
l.x = u.x + t.clientLeft, l.y = u.y + t.clientTop;
|
|
4749
4719
|
} else s && (l.x = Lt(s));
|
|
4750
|
-
let h = 0,
|
|
4720
|
+
let h = 0, f = 0;
|
|
4751
4721
|
if (s && !i && !r) {
|
|
4752
4722
|
const u = s.getBoundingClientRect();
|
|
4753
|
-
|
|
4723
|
+
f = u.top + n.scrollTop, h = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
4754
4724
|
Lt(s, u);
|
|
4755
4725
|
}
|
|
4756
|
-
const
|
|
4726
|
+
const d = o.left + n.scrollLeft - l.x - h, x = o.top + n.scrollTop - l.y - f;
|
|
4757
4727
|
return {
|
|
4758
|
-
x:
|
|
4728
|
+
x: d,
|
|
4759
4729
|
y: x,
|
|
4760
4730
|
width: o.width,
|
|
4761
4731
|
height: o.height
|
|
@@ -4806,12 +4776,12 @@ function Ni(a) {
|
|
|
4806
4776
|
return F(a).direction === "rtl";
|
|
4807
4777
|
}
|
|
4808
4778
|
const Ki = {
|
|
4809
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
4779
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Si,
|
|
4810
4780
|
getDocumentElement: Y,
|
|
4811
4781
|
getClippingRect: Di,
|
|
4812
4782
|
getOffsetParent: de,
|
|
4813
4783
|
getElementRects: Xi,
|
|
4814
|
-
getClientRects:
|
|
4784
|
+
getClientRects: Ti,
|
|
4815
4785
|
getDimensions: ki,
|
|
4816
4786
|
getScale: Z,
|
|
4817
4787
|
isElement: k,
|
|
@@ -4901,28 +4871,28 @@ let Bi = class {
|
|
|
4901
4871
|
placement: t.overflowTooltipPlacement,
|
|
4902
4872
|
middleware: [xe(), ue(), fe(6), Yi({ element: this.arrowEl })]
|
|
4903
4873
|
}).then((n) => {
|
|
4904
|
-
const { x: l, y: h, placement:
|
|
4874
|
+
const { x: l, y: h, placement: f, middlewareData: d } = n;
|
|
4905
4875
|
if (Object.assign(this.floatingEl.style, {
|
|
4906
4876
|
top: `${h}px`,
|
|
4907
4877
|
left: `${l}px`
|
|
4908
|
-
}),
|
|
4909
|
-
const x =
|
|
4910
|
-
["left", "left-start", "left-end"].includes(
|
|
4878
|
+
}), d.arrow) {
|
|
4879
|
+
const x = d.arrow;
|
|
4880
|
+
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
4911
4881
|
top: `${x.y}px`,
|
|
4912
4882
|
bottom: "",
|
|
4913
4883
|
left: "",
|
|
4914
4884
|
right: "-5px"
|
|
4915
|
-
}) : ["right", "right-start", "right-end"].includes(
|
|
4885
|
+
}) : ["right", "right-start", "right-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
4916
4886
|
top: `${x.y}px`,
|
|
4917
4887
|
bottom: "",
|
|
4918
4888
|
left: "-5px",
|
|
4919
4889
|
right: ""
|
|
4920
|
-
}) : ["bottom", "bottom-start", "bottom-end"].includes(
|
|
4890
|
+
}) : ["bottom", "bottom-start", "bottom-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
4921
4891
|
top: "-5px",
|
|
4922
4892
|
bottom: "",
|
|
4923
4893
|
left: `${x.x}px`,
|
|
4924
4894
|
right: ""
|
|
4925
|
-
}) : ["top", "top-start", "top-end"].includes(
|
|
4895
|
+
}) : ["top", "top-start", "top-end"].includes(f) && Object.assign(this.arrowEl.style, {
|
|
4926
4896
|
top: "",
|
|
4927
4897
|
bottom: "-5px",
|
|
4928
4898
|
left: `${x.x}px`,
|
|
@@ -4994,13 +4964,25 @@ class Wi {
|
|
|
4994
4964
|
});
|
|
4995
4965
|
}
|
|
4996
4966
|
initTextEditor() {
|
|
4997
|
-
const { CSS_PREFIX: t, SELECT_BORDER_COLOR: e
|
|
4998
|
-
this.inputEl = document.createElement("div"), this.inputEl.addEventListener("keydown", (
|
|
4999
|
-
|
|
4967
|
+
const { CSS_PREFIX: t, SELECT_BORDER_COLOR: e } = this.ctx.config;
|
|
4968
|
+
this.inputEl = document.createElement("div"), this.inputEl.addEventListener("keydown", (o) => {
|
|
4969
|
+
if (this.enable) {
|
|
4970
|
+
if ((o.altKey || o.metaKey) && o.code === "Enter") {
|
|
4971
|
+
o.preventDefault();
|
|
4972
|
+
const n = this.inputEl.textContent;
|
|
4973
|
+
this.inputEl.textContent = `${n}
|
|
4974
|
+
|
|
4975
|
+
`;
|
|
4976
|
+
const l = window.getSelection();
|
|
4977
|
+
l == null || l.selectAllChildren(this.inputEl), l == null || l.collapseToEnd();
|
|
4978
|
+
return;
|
|
4979
|
+
}
|
|
4980
|
+
(o.code === "Escape" || o.code === "Enter") && (o.preventDefault(), this.inputEl.blur());
|
|
4981
|
+
}
|
|
5000
4982
|
}), this.inputEl.addEventListener("blur", () => {
|
|
5001
4983
|
this.doneEdit();
|
|
5002
4984
|
}), this.editorEl = document.createElement("div"), this.editorEl.className = `${t}-self-editor`, this.inputEl.className = `${t}-self-editor-input`;
|
|
5003
|
-
const
|
|
4985
|
+
const i = {
|
|
5004
4986
|
position: "absolute",
|
|
5005
4987
|
top: "-10000px",
|
|
5006
4988
|
left: "-10000px",
|
|
@@ -5016,8 +4998,8 @@ class Wi {
|
|
|
5016
4998
|
display: "flex",
|
|
5017
4999
|
alignItems: "center"
|
|
5018
5000
|
};
|
|
5019
|
-
Object.assign(this.editorEl.style,
|
|
5020
|
-
const
|
|
5001
|
+
Object.assign(this.editorEl.style, i);
|
|
5002
|
+
const s = {
|
|
5021
5003
|
width: "100%",
|
|
5022
5004
|
boxSizing: "border-box",
|
|
5023
5005
|
padding: "8px",
|
|
@@ -5033,9 +5015,9 @@ class Wi {
|
|
|
5033
5015
|
background: "#fff",
|
|
5034
5016
|
cursor: "text"
|
|
5035
5017
|
};
|
|
5036
|
-
Object.assign(this.inputEl.style,
|
|
5037
|
-
const
|
|
5038
|
-
this.inputEl.contentEditable =
|
|
5018
|
+
Object.assign(this.inputEl.style, s);
|
|
5019
|
+
const r = navigator.userAgent.toLowerCase().includes("firefox");
|
|
5020
|
+
this.inputEl.contentEditable = r ? "true" : "plaintext-only", this.editorEl.appendChild(this.inputEl), this.ctx.targetContainer.appendChild(this.editorEl);
|
|
5039
5021
|
}
|
|
5040
5022
|
startEditByInput(t) {
|
|
5041
5023
|
if (t.editorType !== "text")
|
|
@@ -5090,17 +5072,17 @@ class Pi {
|
|
|
5090
5072
|
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 }) => {
|
|
5091
5073
|
if (i)
|
|
5092
5074
|
return;
|
|
5093
|
-
const
|
|
5075
|
+
const f = n + (l + h) / 2, d = {
|
|
5094
5076
|
display: o === "empty" ? "block" : "none",
|
|
5095
5077
|
position: "absolute",
|
|
5096
5078
|
fontSize: "14px",
|
|
5097
5079
|
color: "#666",
|
|
5098
5080
|
left: "50%",
|
|
5099
|
-
top: `${
|
|
5081
|
+
top: `${f}px`,
|
|
5100
5082
|
transform: "translate(-50%, -50%)",
|
|
5101
5083
|
...s
|
|
5102
5084
|
};
|
|
5103
|
-
Object.assign(this.emptyEl.style,
|
|
5085
|
+
Object.assign(this.emptyEl.style, d);
|
|
5104
5086
|
});
|
|
5105
5087
|
}
|
|
5106
5088
|
destroy() {
|
|
@@ -5148,11 +5130,11 @@ class Vi {
|
|
|
5148
5130
|
fixedRightWidth: e,
|
|
5149
5131
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5150
5132
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: n } = this.ctx.header;
|
|
5151
|
-
let l = [], h = [],
|
|
5133
|
+
let l = [], h = [], f = [];
|
|
5152
5134
|
n.forEach((w) => {
|
|
5153
|
-
w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ?
|
|
5135
|
+
w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ? f.push(w) : l.push(w));
|
|
5154
5136
|
});
|
|
5155
|
-
const
|
|
5137
|
+
const d = e - i, x = {
|
|
5156
5138
|
key: "left",
|
|
5157
5139
|
style: {
|
|
5158
5140
|
position: "absolute",
|
|
@@ -5170,7 +5152,7 @@ class Vi {
|
|
|
5170
5152
|
top: `${0.5}px`,
|
|
5171
5153
|
left: `${t}px`,
|
|
5172
5154
|
overflow: "hidden",
|
|
5173
|
-
width: `${r - t -
|
|
5155
|
+
width: `${r - t - d}px`,
|
|
5174
5156
|
height: `${o}px`
|
|
5175
5157
|
},
|
|
5176
5158
|
cells: l
|
|
@@ -5181,10 +5163,10 @@ class Vi {
|
|
|
5181
5163
|
top: `${0.5}px`,
|
|
5182
5164
|
right: `${0.5}px`,
|
|
5183
5165
|
overflow: "hidden",
|
|
5184
|
-
width: `${
|
|
5166
|
+
width: `${d}px`,
|
|
5185
5167
|
height: `${o}px`
|
|
5186
5168
|
},
|
|
5187
|
-
cells:
|
|
5169
|
+
cells: f
|
|
5188
5170
|
};
|
|
5189
5171
|
return {
|
|
5190
5172
|
type: "header",
|
|
@@ -5210,7 +5192,7 @@ class Vi {
|
|
|
5210
5192
|
fixedLeftWidth: r,
|
|
5211
5193
|
fixedRightWidth: o,
|
|
5212
5194
|
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: l }
|
|
5213
|
-
} = this.ctx, { visibleWidth: h, visibleHeight:
|
|
5195
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: f } = this.ctx.body, d = o - n, x = {
|
|
5214
5196
|
key: "left",
|
|
5215
5197
|
style: {
|
|
5216
5198
|
position: "absolute",
|
|
@@ -5218,7 +5200,7 @@ class Vi {
|
|
|
5218
5200
|
left: `${0.5}px`,
|
|
5219
5201
|
overflow: "hidden",
|
|
5220
5202
|
width: `${r}px`,
|
|
5221
|
-
height: `${
|
|
5203
|
+
height: `${f}px`
|
|
5222
5204
|
},
|
|
5223
5205
|
cells: e
|
|
5224
5206
|
}, u = {
|
|
@@ -5228,8 +5210,8 @@ class Vi {
|
|
|
5228
5210
|
top: `${0.5}px`,
|
|
5229
5211
|
left: `${r + 0.5}px`,
|
|
5230
5212
|
overflow: "hidden",
|
|
5231
|
-
width: `${h - r -
|
|
5232
|
-
height: `${
|
|
5213
|
+
width: `${h - r - d}px`,
|
|
5214
|
+
height: `${f}px`
|
|
5233
5215
|
},
|
|
5234
5216
|
cells: t
|
|
5235
5217
|
}, y = {
|
|
@@ -5239,8 +5221,8 @@ class Vi {
|
|
|
5239
5221
|
top: "0px",
|
|
5240
5222
|
right: "0px",
|
|
5241
5223
|
overflow: "hidden",
|
|
5242
|
-
width: `${
|
|
5243
|
-
height: `${
|
|
5224
|
+
width: `${d}px`,
|
|
5225
|
+
height: `${f}px`
|
|
5244
5226
|
},
|
|
5245
5227
|
cells: i
|
|
5246
5228
|
};
|
|
@@ -5251,7 +5233,7 @@ class Vi {
|
|
|
5251
5233
|
position: "relative",
|
|
5252
5234
|
overflow: "hidden",
|
|
5253
5235
|
width: `${h}px`,
|
|
5254
|
-
height: `${
|
|
5236
|
+
height: `${f}px`
|
|
5255
5237
|
},
|
|
5256
5238
|
views: [x, u, y]
|
|
5257
5239
|
};
|
|
@@ -5267,7 +5249,7 @@ class Vi {
|
|
|
5267
5249
|
fixedLeftWidth: s,
|
|
5268
5250
|
fixedRightWidth: r,
|
|
5269
5251
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: n }
|
|
5270
|
-
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer,
|
|
5252
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, f = r - o, d = {
|
|
5271
5253
|
key: "left",
|
|
5272
5254
|
style: {
|
|
5273
5255
|
position: "absolute",
|
|
@@ -5285,7 +5267,7 @@ class Vi {
|
|
|
5285
5267
|
top: `${0.5}px`,
|
|
5286
5268
|
left: `${s + 0.5}px`,
|
|
5287
5269
|
overflow: "hidden",
|
|
5288
|
-
width: `${l - s -
|
|
5270
|
+
width: `${l - s - f}px`,
|
|
5289
5271
|
height: `${h}px`
|
|
5290
5272
|
},
|
|
5291
5273
|
cells: t
|
|
@@ -5296,7 +5278,7 @@ class Vi {
|
|
|
5296
5278
|
top: `${0.5}px`,
|
|
5297
5279
|
right: `${0.5}px`,
|
|
5298
5280
|
overflow: "hidden",
|
|
5299
|
-
width: `${
|
|
5281
|
+
width: `${f}px`,
|
|
5300
5282
|
height: `${h}px`
|
|
5301
5283
|
},
|
|
5302
5284
|
cells: i
|
|
@@ -5310,7 +5292,7 @@ class Vi {
|
|
|
5310
5292
|
width: `${l}px`,
|
|
5311
5293
|
height: `${h}px`
|
|
5312
5294
|
},
|
|
5313
|
-
views: [
|
|
5295
|
+
views: [d, x, u]
|
|
5314
5296
|
};
|
|
5315
5297
|
}
|
|
5316
5298
|
}
|
|
@@ -5324,8 +5306,8 @@ class zi {
|
|
|
5324
5306
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5325
5307
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5326
5308
|
e.preventDefault();
|
|
5327
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n, l] = s, { rowIndex: h, colIndex:
|
|
5328
|
-
h >= n && h <= l &&
|
|
5309
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n, l] = s, { rowIndex: h, colIndex: f } = t;
|
|
5310
|
+
h >= n && h <= l && f >= r && f <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5329
5311
|
const x = {
|
|
5330
5312
|
getBoundingClientRect: () => ({
|
|
5331
5313
|
width: 0,
|
|
@@ -5422,13 +5404,13 @@ class Gi {
|
|
|
5422
5404
|
});
|
|
5423
5405
|
}
|
|
5424
5406
|
loadConfig(t) {
|
|
5425
|
-
this.ctx.config.init(t), this.ctx.database.init(), this.contextMenu.updated(), this.ctx.emit("draw");
|
|
5407
|
+
this.ctx.config.init(t), this.ctx.database.init(), this.header.init(), this.contextMenu.updated(), this.ctx.emit("draw");
|
|
5426
5408
|
}
|
|
5427
5409
|
loadColumns(t) {
|
|
5428
5410
|
this.editor.doneEdit(), this.ctx.database.setColumns(t), this.header.init(), this.ctx.emit("draw");
|
|
5429
5411
|
}
|
|
5430
5412
|
loadData(t) {
|
|
5431
|
-
this.editor.doneEdit(), this.ctx.database.setData(t), this.ctx.emit("draw");
|
|
5413
|
+
this.editor.doneEdit(), this.ctx.database.setData(t), this.header.init(), this.ctx.emit("draw");
|
|
5432
5414
|
}
|
|
5433
5415
|
loadFooterData(t) {
|
|
5434
5416
|
this.ctx.database.setFooterData(t), this.ctx.emit("draw");
|
|
@@ -5504,8 +5486,8 @@ class Gi {
|
|
|
5504
5486
|
let r = [];
|
|
5505
5487
|
for (let o = 0; o < i.length; o++)
|
|
5506
5488
|
for (let n = 0; n < s.length; n++) {
|
|
5507
|
-
const l = this.ctx.database.getRowKeyByItem(i[o]),
|
|
5508
|
-
Array.isArray(
|
|
5489
|
+
const l = this.ctx.database.getRowKeyByItem(i[o]), f = s[n].key, d = await this.ctx.database.getValidator(l, f);
|
|
5490
|
+
Array.isArray(d) && d.length && r.push(d);
|
|
5509
5491
|
}
|
|
5510
5492
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
5511
5493
|
});
|