e-virt-table 1.0.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +337 -314
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Body.js +8 -7
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Context.d.ts +1 -0
- package/dist/lib/Context.js +7 -7
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/EVirtTable.js +4 -4
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.d.ts +2 -1
- package/dist/lib/Editor.js +65 -45
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/EventBrowser.d.ts +2 -0
- package/dist/lib/EventBrowser.js +11 -1
- package/dist/lib/EventBrowser.js.map +1 -1
- package/dist/lib/Scroller.d.ts +1 -1
- package/dist/lib/Scroller.js +10 -9
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.js +10 -2
- package/dist/lib/Selector.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -159,28 +159,28 @@ var kt = /* @__PURE__ */ function(a) {
|
|
|
159
159
|
}(/* @__PURE__ */ Ct(Error));
|
|
160
160
|
function Ae(a, t, e, i, s) {
|
|
161
161
|
if (t.first) {
|
|
162
|
-
var r = new Promise(function(
|
|
162
|
+
var r = new Promise(function(x, u) {
|
|
163
163
|
var p = function(y) {
|
|
164
|
-
return i(y), y.length ?
|
|
164
|
+
return i(y), y.length ? u(new kt(y, bt(y))) : x(s);
|
|
165
165
|
}, g = Le(a);
|
|
166
166
|
Xt(g, e, p);
|
|
167
167
|
});
|
|
168
|
-
return r.catch(function(
|
|
169
|
-
return
|
|
168
|
+
return r.catch(function(x) {
|
|
169
|
+
return x;
|
|
170
170
|
}), r;
|
|
171
171
|
}
|
|
172
|
-
var o = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a), h = n.length, c = 0, d = [], f = new Promise(function(
|
|
172
|
+
var o = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a), h = n.length, c = 0, d = [], f = new Promise(function(x, u) {
|
|
173
173
|
var p = function(w) {
|
|
174
174
|
if (d.push.apply(d, w), c++, c === h)
|
|
175
|
-
return i(d), d.length ?
|
|
175
|
+
return i(d), d.length ? u(new kt(d, bt(d))) : x(s);
|
|
176
176
|
};
|
|
177
|
-
n.length || (i(d),
|
|
177
|
+
n.length || (i(d), x(s)), n.forEach(function(g) {
|
|
178
178
|
var w = a[g];
|
|
179
179
|
o.indexOf(g) !== -1 ? Xt(w, e, p) : Se(w, e, p);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
|
-
return f.catch(function(
|
|
183
|
-
return
|
|
182
|
+
return f.catch(function(x) {
|
|
183
|
+
return x;
|
|
184
184
|
}), f;
|
|
185
185
|
}
|
|
186
186
|
function Te(a) {
|
|
@@ -242,7 +242,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
242
242
|
}, h.v6 = function(m) {
|
|
243
243
|
return m && m.exact ? n : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var c = "(?:(?:[a-z]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = h.v4().source,
|
|
245
|
+
var c = "(?:(?:[a-z]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = h.v4().source, x = h.v6().source, u = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", p = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", g = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?', E = "(?:" + c + "|www\\.)" + d + "(?:localhost|" + f + "|" + x + "|" + u + p + g + ")" + w + y;
|
|
246
246
|
return ct = new RegExp("(?:^" + E + "$)", "i"), ct;
|
|
247
247
|
}, Bt = {
|
|
248
248
|
// http://emailregex.com/
|
|
@@ -300,10 +300,10 @@ var Ut = 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(D(r.messages.types[n], t.fullField, t.type)) : n && typeof e !== t.type && s.push(D(r.messages.types[n], t.fullField, t.type));
|
|
302
302
|
}, Xe = function(t, e, i, s, r) {
|
|
303
|
-
var o = typeof t.len == "number", n = typeof t.min == "number", h = typeof t.max == "number", c = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, d = e, f = null,
|
|
304
|
-
if (
|
|
303
|
+
var o = typeof t.len == "number", n = typeof t.min == "number", h = typeof t.max == "number", c = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, d = e, f = null, x = typeof e == "number", u = typeof e == "string", p = Array.isArray(e);
|
|
304
|
+
if (x ? f = "number" : u ? f = "string" : p && (f = "array"), !f)
|
|
305
305
|
return !1;
|
|
306
|
-
p && (d = e.length),
|
|
306
|
+
p && (d = e.length), u && (d = e.replace(c, "_").length), o ? d !== t.len && s.push(D(r.messages[f].len, t.fullField, t.len)) : n && !h && d < t.min ? s.push(D(r.messages[f].min, t.fullField, t.min)) : h && !n && d > t.max ? s.push(D(r.messages[f].max, t.fullField, t.max)) : n && h && (d < t.min || d > t.max) && s.push(D(r.messages[f].range, t.fullField, t.min, t.max));
|
|
307
307
|
}, j = "enum", ke = function(t, e, i, s, r) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(D(r.messages[j], t.fullField, t[j].join(", ")));
|
|
309
309
|
}, Ne = function(t, e, i, s, r) {
|
|
@@ -554,14 +554,14 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
554
554
|
f === Rt && (f = vt()), Kt(f, h.messages), h.messages = f;
|
|
555
555
|
} else
|
|
556
556
|
h.messages = this.messages();
|
|
557
|
-
var
|
|
558
|
-
|
|
557
|
+
var x = {}, u = h.keys || Object.keys(this.rules);
|
|
558
|
+
u.forEach(function(g) {
|
|
559
559
|
var w = o.rules[g], y = n[g];
|
|
560
560
|
w.forEach(function(E) {
|
|
561
561
|
var m = E;
|
|
562
562
|
typeof m.transform == "function" && (n === i && (n = G({}, n)), y = n[g] = m.transform(y)), typeof m == "function" ? m = {
|
|
563
563
|
validator: m
|
|
564
|
-
} : m = G({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field = g, m.fullField = m.fullField || g, m.type = o.getType(m),
|
|
564
|
+
} : m = G({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field = g, m.fullField = m.fullField || g, m.type = o.getType(m), x[g] = x[g] || [], x[g].push({
|
|
565
565
|
rule: m,
|
|
566
566
|
value: y,
|
|
567
567
|
source: n,
|
|
@@ -570,7 +570,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
var p = {};
|
|
573
|
-
return Ae(
|
|
573
|
+
return Ae(x, h, function(g, w) {
|
|
574
574
|
var y = g.rule, E = (y.type === "object" || y.type === "array") && (typeof y.fields == "object" || typeof y.defaultField == "object");
|
|
575
575
|
E = E && (y.required || !y.required && g.value), y.field = g.field;
|
|
576
576
|
function m(R, S) {
|
|
@@ -1015,21 +1015,21 @@ class Tt extends se {
|
|
|
1015
1015
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
1016
1016
|
let r, o = 0, n = "";
|
|
1017
1017
|
if (this.type === "tree" && s === "body") {
|
|
1018
|
-
const h = this.ctx.database.getRowForRowKey(i), { expand: c = !1, hasChildren: d = !1, expandLoading: f = !1, level:
|
|
1018
|
+
const h = this.ctx.database.getRowForRowKey(i), { expand: c = !1, hasChildren: d = !1, expandLoading: f = !1, level: x = 0 } = h || {};
|
|
1019
1019
|
if (this.rowExpand = c, this.rowHasChildren = d, f) {
|
|
1020
1020
|
const g = this.ctx.icons.get("loading");
|
|
1021
|
-
n = "loading", r = g, o =
|
|
1021
|
+
n = "loading", r = g, o = x * 8;
|
|
1022
1022
|
} else if (d) {
|
|
1023
1023
|
const g = this.ctx.icons.get("expand"), w = this.ctx.icons.get("shrink");
|
|
1024
|
-
r = c ? w : g, n = c ? "shrink" : "expand", o =
|
|
1024
|
+
r = c ? w : g, n = c ? "shrink" : "expand", o = x * 8;
|
|
1025
1025
|
} else
|
|
1026
|
-
o =
|
|
1027
|
-
let
|
|
1026
|
+
o = x * 8;
|
|
1027
|
+
let u = 20, p = 20;
|
|
1028
1028
|
if (r) {
|
|
1029
1029
|
let g = this.drawX + o + e, w = this.drawY + (this.visibleHeight - p) / 2;
|
|
1030
|
-
this.ctx.paint.drawImage(r, g, w,
|
|
1030
|
+
this.ctx.paint.drawImage(r, g, w, u, p), this.drawImageX = g, this.drawImageY = w, this.drawImageWidth = u, this.drawImageHeight = p, this.drawImageName = n, this.drawImageSource = r;
|
|
1031
1031
|
}
|
|
1032
|
-
this.align = "left", this.drawTextX = o + this.drawX +
|
|
1032
|
+
this.align = "left", this.drawTextX = o + this.drawX + u - 0.5;
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
1035
1035
|
updateContainer() {
|
|
@@ -1060,9 +1060,9 @@ class Tt extends se {
|
|
|
1060
1060
|
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = y, this.drawTextColor = E;
|
|
1061
1061
|
return;
|
|
1062
1062
|
}
|
|
1063
|
-
let
|
|
1064
|
-
const
|
|
1065
|
-
d && (p == null ? void 0 : p.rowKey) === this.rowKey && (
|
|
1063
|
+
let x = "transparent";
|
|
1064
|
+
const u = this.ctx.focusCell, p = this.ctx.hoverCell;
|
|
1065
|
+
d && (p == null ? void 0 : p.rowKey) === this.rowKey && (x = f), h && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = c), this.drawCellSkyBgColor = x;
|
|
1066
1066
|
let g = e, w = o;
|
|
1067
1067
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
1068
1068
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
@@ -1084,9 +1084,9 @@ class Tt extends se {
|
|
|
1084
1084
|
updateSelection() {
|
|
1085
1085
|
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex: h, rowKey: c } = this;
|
|
1086
1086
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(n)) {
|
|
1087
|
-
const d = this.ctx.database.getRowSelection(c), f = this.ctx.database.getRowSelectable(c), { CHECKBOX_SIZE:
|
|
1087
|
+
const d = this.ctx.database.getRowSelection(c), f = this.ctx.database.getRowSelectable(c), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, p = this.drawY + (i - x) / 2;
|
|
1088
1088
|
let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
1089
|
-
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 === h || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX =
|
|
1089
|
+
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 === h || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g) : g && n === "selection" && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g);
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
1092
|
updateHoverIcon() {
|
|
@@ -1231,8 +1231,8 @@ class Tt extends se {
|
|
|
1231
1231
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: r } = this.ctx.config;
|
|
1232
1232
|
if (!s || !i)
|
|
1233
1233
|
return;
|
|
1234
|
-
const { xArr: o, yArr: n } = this.ctx.selector, h = o[1], c = n[1], { colIndex: d, rowIndex: f, drawX:
|
|
1235
|
-
d === h && f === c && this.ctx.paint.drawRect(
|
|
1234
|
+
const { xArr: o, yArr: n } = this.ctx.selector, h = o[1], c = n[1], { colIndex: d, rowIndex: f, drawX: x, drawY: u } = this;
|
|
1235
|
+
d === h && f === c && this.ctx.paint.drawRect(x + this.width - 6, u + this.height - 6, 6, 6, {
|
|
1236
1236
|
borderColor: r,
|
|
1237
1237
|
fillColor: e
|
|
1238
1238
|
});
|
|
@@ -1297,35 +1297,35 @@ class Tt extends se {
|
|
|
1297
1297
|
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: n } = this;
|
|
1298
1298
|
let h = i + 0.5, c = s + 0.5, d = this.height;
|
|
1299
1299
|
o === 0 && (c = this.y + 1, d = d - 1), n === this.ctx.maxColIndex && (h = h - 1);
|
|
1300
|
-
const { xArr: f, yArr:
|
|
1300
|
+
const { xArr: f, yArr: x, lineDash: u = [], borderWidth: p = 1, borderColor: g, fillColor: w } = e, y = f[0], E = f[1], m = x[0], C = x[1];
|
|
1301
1301
|
n >= y && n <= E && o === m && this.ctx.paint.drawLine([h, c, h + r - 2, c], {
|
|
1302
1302
|
borderColor: g,
|
|
1303
1303
|
fillColor: w,
|
|
1304
1304
|
borderWidth: p,
|
|
1305
1305
|
lineCap: "round",
|
|
1306
1306
|
lineJoin: "round",
|
|
1307
|
-
lineDash:
|
|
1307
|
+
lineDash: u
|
|
1308
1308
|
}), n >= y && n <= E && o === C && this.ctx.paint.drawLine([h, c + d - 1.5, h + r, c + d - 1.5], {
|
|
1309
1309
|
borderColor: g,
|
|
1310
1310
|
fillColor: w,
|
|
1311
1311
|
borderWidth: p,
|
|
1312
1312
|
lineCap: "round",
|
|
1313
1313
|
lineJoin: "round",
|
|
1314
|
-
lineDash:
|
|
1314
|
+
lineDash: u
|
|
1315
1315
|
}), n === y && o >= m && o <= C && this.ctx.paint.drawLine([h, c, h, c + d - 1], {
|
|
1316
1316
|
borderColor: g,
|
|
1317
1317
|
fillColor: w,
|
|
1318
1318
|
borderWidth: p,
|
|
1319
1319
|
lineCap: "round",
|
|
1320
1320
|
lineJoin: "round",
|
|
1321
|
-
lineDash:
|
|
1321
|
+
lineDash: u
|
|
1322
1322
|
}), n === E && o >= m && o <= C && this.ctx.paint.drawLine([h + r - 1.5, c, h + r - 1.5, c + d - 1.5], {
|
|
1323
1323
|
borderColor: g,
|
|
1324
1324
|
fillColor: w,
|
|
1325
1325
|
borderWidth: p,
|
|
1326
1326
|
lineCap: "round",
|
|
1327
1327
|
lineJoin: "round",
|
|
1328
|
-
lineDash:
|
|
1328
|
+
lineDash: u
|
|
1329
1329
|
});
|
|
1330
1330
|
}
|
|
1331
1331
|
}
|
|
@@ -1372,24 +1372,24 @@ class ni {
|
|
|
1372
1372
|
t.forEach((i, s) => {
|
|
1373
1373
|
let r = i._hasChildren || !1;
|
|
1374
1374
|
Array.isArray(i.children) && i.children.length && (r = !0, this.initData(i.children, e + 1));
|
|
1375
|
-
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: h, SELECTABLE_METHOD: c, CHECKBOX_KEY: d } = this.ctx.config, f = i[o],
|
|
1376
|
-
this.itemRowKeyMap.set(i,
|
|
1377
|
-
const
|
|
1375
|
+
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: h, SELECTABLE_METHOD: c, CHECKBOX_KEY: d } = this.ctx.config, f = i[o], x = f != null ? `${f}` : Zt();
|
|
1376
|
+
this.itemRowKeyMap.set(i, x);
|
|
1377
|
+
const u = i._height || h, p = i._readonly;
|
|
1378
1378
|
let g = !0;
|
|
1379
1379
|
if (typeof c == "function" && (g = c), d) {
|
|
1380
1380
|
const w = i[d];
|
|
1381
1381
|
if (this.checkboxKeyMap.has(w)) {
|
|
1382
1382
|
const y = this.checkboxKeyMap.get(w) || [];
|
|
1383
|
-
y.push(
|
|
1383
|
+
y.push(x), this.checkboxKeyMap.set(w, y);
|
|
1384
1384
|
} else
|
|
1385
|
-
this.checkboxKeyMap.set(w, [
|
|
1385
|
+
this.checkboxKeyMap.set(w, [x]);
|
|
1386
1386
|
}
|
|
1387
|
-
this.rowKeyMap.set(
|
|
1387
|
+
this.rowKeyMap.set(x, {
|
|
1388
1388
|
readonly: p,
|
|
1389
1389
|
index: s,
|
|
1390
1390
|
rowIndex: s,
|
|
1391
1391
|
level: e,
|
|
1392
|
-
height:
|
|
1392
|
+
height: u,
|
|
1393
1393
|
check: !1,
|
|
1394
1394
|
selectable: g,
|
|
1395
1395
|
expand: n,
|
|
@@ -1605,20 +1605,20 @@ class ni {
|
|
|
1605
1605
|
let r = t;
|
|
1606
1606
|
const { BEFORE_VALUE_CHANGE_METHOD: o } = this.ctx.config;
|
|
1607
1607
|
if (typeof o == "function") {
|
|
1608
|
-
const d = o, f = t.map((
|
|
1609
|
-
rowKey:
|
|
1610
|
-
key:
|
|
1611
|
-
value:
|
|
1612
|
-
oldValue: this.getItemValue(
|
|
1613
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
1608
|
+
const d = o, f = t.map((u) => ({
|
|
1609
|
+
rowKey: u.rowKey,
|
|
1610
|
+
key: u.key,
|
|
1611
|
+
value: u.value,
|
|
1612
|
+
oldValue: this.getItemValue(u.rowKey, u.key),
|
|
1613
|
+
row: this.ctx.database.getRowDataItemForRowKey(u.rowKey)
|
|
1614
1614
|
}));
|
|
1615
1615
|
r = await d(f);
|
|
1616
1616
|
}
|
|
1617
1617
|
r.forEach((d) => {
|
|
1618
|
-
const { value: f, rowKey:
|
|
1619
|
-
this.setItemValue(
|
|
1620
|
-
rowKey:
|
|
1621
|
-
key:
|
|
1618
|
+
const { value: f, rowKey: x, key: u } = d, p = this.getItemValue(x, u);
|
|
1619
|
+
this.setItemValue(x, u, f), s.add(x), i.push({
|
|
1620
|
+
rowKey: x,
|
|
1621
|
+
key: u,
|
|
1622
1622
|
oldValue: p,
|
|
1623
1623
|
newValue: f
|
|
1624
1624
|
});
|
|
@@ -1672,9 +1672,9 @@ class ni {
|
|
|
1672
1672
|
const d = this.originalDataMap.get(c);
|
|
1673
1673
|
let f = i;
|
|
1674
1674
|
if (o) {
|
|
1675
|
-
const { BEFORE_VALUE_CHANGE_METHOD:
|
|
1676
|
-
if (typeof
|
|
1677
|
-
const w = await
|
|
1675
|
+
const { BEFORE_VALUE_CHANGE_METHOD: x } = this.ctx.config;
|
|
1676
|
+
if (typeof x == "function") {
|
|
1677
|
+
const w = await x([
|
|
1678
1678
|
{
|
|
1679
1679
|
rowKey: t,
|
|
1680
1680
|
key: e,
|
|
@@ -1686,21 +1686,21 @@ class ni {
|
|
|
1686
1686
|
w && w.length && (f = w[0].value);
|
|
1687
1687
|
}
|
|
1688
1688
|
this.changedDataMap.set(c, f), n[e] = f;
|
|
1689
|
-
const
|
|
1689
|
+
const u = this.ctx.database.getRowDataItemForRowKey(t), p = {
|
|
1690
1690
|
rowKey: t,
|
|
1691
1691
|
key: e,
|
|
1692
1692
|
value: f,
|
|
1693
|
-
row:
|
|
1693
|
+
row: u
|
|
1694
1694
|
};
|
|
1695
1695
|
this.getValidator(t, e).then(() => {
|
|
1696
1696
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1697
|
-
}), this.ctx.emit("change", [p], [
|
|
1697
|
+
}), this.ctx.emit("change", [p], [u]), this.ctx.emit("editChange", {
|
|
1698
1698
|
rowKey: t,
|
|
1699
1699
|
key: e,
|
|
1700
1700
|
oldValue: h,
|
|
1701
1701
|
value: f,
|
|
1702
1702
|
originalValue: d,
|
|
1703
|
-
row:
|
|
1703
|
+
row: u
|
|
1704
1704
|
});
|
|
1705
1705
|
} else
|
|
1706
1706
|
this.changedDataMap.set(c, f), n[e] = f;
|
|
@@ -1971,14 +1971,14 @@ class ni {
|
|
|
1971
1971
|
if (h) {
|
|
1972
1972
|
let c = {}, d = {};
|
|
1973
1973
|
if (d[e] = this.getItemValue(t, e), Array.isArray(h)) {
|
|
1974
|
-
const
|
|
1975
|
-
...
|
|
1974
|
+
const x = h.map((u) => ({
|
|
1975
|
+
...u,
|
|
1976
1976
|
row: s.item,
|
|
1977
1977
|
column: n,
|
|
1978
1978
|
rowIndex: s.rowIndex,
|
|
1979
1979
|
colIndex: r.colIndex
|
|
1980
1980
|
}));
|
|
1981
|
-
c[e] =
|
|
1981
|
+
c[e] = x;
|
|
1982
1982
|
} else
|
|
1983
1983
|
c[e] = {
|
|
1984
1984
|
...h,
|
|
@@ -1989,15 +1989,15 @@ class ni {
|
|
|
1989
1989
|
};
|
|
1990
1990
|
new nt(c).validate(d).then(() => {
|
|
1991
1991
|
this.clearValidationError(t, e), i([]);
|
|
1992
|
-
}).catch(({ errors:
|
|
1993
|
-
const
|
|
1992
|
+
}).catch(({ errors: x }) => {
|
|
1993
|
+
const u = x.map((p) => ({
|
|
1994
1994
|
...p,
|
|
1995
1995
|
column: n,
|
|
1996
1996
|
key: e,
|
|
1997
1997
|
row: s.item,
|
|
1998
1998
|
rowKey: t
|
|
1999
1999
|
}));
|
|
2000
|
-
this.setValidationError(t, e,
|
|
2000
|
+
this.setValidationError(t, e, u), i(u);
|
|
2001
2001
|
});
|
|
2002
2002
|
} else
|
|
2003
2003
|
i([]);
|
|
@@ -2023,19 +2023,19 @@ class ni {
|
|
|
2023
2023
|
relationColKeys: c,
|
|
2024
2024
|
rowspan: d,
|
|
2025
2025
|
height: f,
|
|
2026
|
-
width:
|
|
2027
|
-
colspan:
|
|
2026
|
+
width: x,
|
|
2027
|
+
colspan: u,
|
|
2028
2028
|
mergeRow: p,
|
|
2029
2029
|
mergeCol: g
|
|
2030
2030
|
} = t;
|
|
2031
|
-
if (d === 1 &&
|
|
2031
|
+
if (d === 1 && u === 1)
|
|
2032
2032
|
return {
|
|
2033
2033
|
xArr: [n, n],
|
|
2034
2034
|
yArr: [e, e],
|
|
2035
2035
|
rowspan: d,
|
|
2036
|
-
colspan:
|
|
2036
|
+
colspan: u,
|
|
2037
2037
|
height: f,
|
|
2038
|
-
width:
|
|
2038
|
+
width: x,
|
|
2039
2039
|
offsetTop: 0,
|
|
2040
2040
|
offsetLeft: 0,
|
|
2041
2041
|
dataList: [
|
|
@@ -2049,7 +2049,7 @@ class ni {
|
|
|
2049
2049
|
};
|
|
2050
2050
|
let w = e, y = e, E = n, m = n, C = [], b = 0, R = 0, S = 0, L = 0;
|
|
2051
2051
|
if (d !== 1 && p) {
|
|
2052
|
-
L =
|
|
2052
|
+
L = x;
|
|
2053
2053
|
const I = h.reduce((v, A) => {
|
|
2054
2054
|
const O = this.getItemValue(s, A) ?? "";
|
|
2055
2055
|
return `${v}${O}`;
|
|
@@ -2090,7 +2090,7 @@ class ni {
|
|
|
2090
2090
|
});
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
|
-
if (
|
|
2093
|
+
if (u !== 1 && g) {
|
|
2094
2094
|
S = f;
|
|
2095
2095
|
for (let I = n - 1; I >= 0; I--) {
|
|
2096
2096
|
const v = this.getColumnByColIndex(I);
|
|
@@ -2134,7 +2134,7 @@ class ni {
|
|
|
2134
2134
|
xArr: [E, m],
|
|
2135
2135
|
yArr: [w, y],
|
|
2136
2136
|
rowspan: d,
|
|
2137
|
-
colspan:
|
|
2137
|
+
colspan: u,
|
|
2138
2138
|
height: S,
|
|
2139
2139
|
width: L,
|
|
2140
2140
|
offsetTop: b,
|
|
@@ -2248,7 +2248,7 @@ class li {
|
|
|
2248
2248
|
this.ctx = t, this.init();
|
|
2249
2249
|
}
|
|
2250
2250
|
init() {
|
|
2251
|
-
this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "mouseup", this.handleMouseUp.bind(this)), this.bind(window, "mousemove", this.handleMousemove.bind(this)), this.bind(this.ctx.stageElement, "click", this.handleClick.bind(this)), this.bind(window, "keydown", this.handleKeydown.bind(this)), this.bind(this.ctx.stageElement, "wheel", this.handleWheel.bind(this)), this.bind(this.ctx.stageElement, "touchstart", this.handleTouchstart.bind(this)), this.bind(this.ctx.stageElement, "touchend", this.handleTouchend.bind(this)), this.bind(this.ctx.stageElement, "touchmove", this.handleTouchmove.bind(this)), this.bind(this.ctx.stageElement, "contextmenu", this.handleContextMenu.bind(this)), this.bind(this.ctx.stageElement, "mousedown", this.handleMouseDown.bind(this)), this.bind(this.ctx.stageElement, "dblclick", this.handleDblclick.bind(this)), this.bind(this.ctx.stageElement, "mouseover", this.handleMouseover.bind(this)), this.bind(this.ctx.stageElement, "mouseout", this.handleMouseout.bind(this));
|
|
2251
|
+
this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "mouseup", this.handleMouseUp.bind(this)), this.bind(window, "mousemove", this.handleMousemove.bind(this)), this.bind(this.ctx.stageElement, "click", this.handleClick.bind(this)), this.bind(window, "keydown", this.handleKeydown.bind(this)), this.bind(this.ctx.stageElement, "wheel", this.handleWheel.bind(this)), this.bind(this.ctx.stageElement, "touchstart", this.handleTouchstart.bind(this)), this.bind(this.ctx.stageElement, "touchend", this.handleTouchend.bind(this)), this.bind(this.ctx.stageElement, "touchmove", this.handleTouchmove.bind(this)), this.bind(this.ctx.stageElement, "contextmenu", this.handleContextMenu.bind(this)), this.bind(this.ctx.stageElement, "mousedown", this.handleMouseDown.bind(this)), this.bind(this.ctx.stageElement, "dblclick", this.handleDblclick.bind(this)), this.bind(this.ctx.stageElement, "mouseover", this.handleMouseover.bind(this)), this.bind(this.ctx.stageElement, "mouseout", this.handleMouseout.bind(this)), this.bind(this.ctx.containerElement, "focusin", this.handleFocusin.bind(this)), this.bind(this.ctx.containerElement, "focusout", this.handleFocusout.bind(this));
|
|
2252
2252
|
}
|
|
2253
2253
|
destroy() {
|
|
2254
2254
|
this.eventTasks.forEach((t, e) => {
|
|
@@ -2293,11 +2293,17 @@ class li {
|
|
|
2293
2293
|
this.ctx.isInsideTargetContainer = !0, this.ctx.emit("mouseover", t);
|
|
2294
2294
|
}
|
|
2295
2295
|
handleMouseout(t) {
|
|
2296
|
-
this.ctx.
|
|
2296
|
+
this.ctx.emit("mouseout", t);
|
|
2297
2297
|
}
|
|
2298
2298
|
handleDblclick(t) {
|
|
2299
2299
|
this.ctx.emit("dblclick", t);
|
|
2300
2300
|
}
|
|
2301
|
+
handleFocusin(t) {
|
|
2302
|
+
this.ctx.isInsideTargetContainer = !0, this.ctx.emit("focusin", t);
|
|
2303
|
+
}
|
|
2304
|
+
handleFocusout(t) {
|
|
2305
|
+
this.ctx.isInsideTargetContainer = !1, this.ctx.emit("focusout", t);
|
|
2306
|
+
}
|
|
2301
2307
|
bind(t, e, i, s) {
|
|
2302
2308
|
t.addEventListener(e, i, s), this.eventTasks.set(e, i);
|
|
2303
2309
|
}
|
|
@@ -2418,8 +2424,8 @@ class ci {
|
|
|
2418
2424
|
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), h === 0)
|
|
2419
2425
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
2420
2426
|
else {
|
|
2421
|
-
const [c, d, f,
|
|
2422
|
-
this.ctx.moveTo(t + c, 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 -
|
|
2427
|
+
const [c, d, f, x] = typeof h == "number" ? [h, h, h, h] : h;
|
|
2428
|
+
this.ctx.moveTo(t + c, 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 + c, e, c);
|
|
2423
2429
|
}
|
|
2424
2430
|
n !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
2425
2431
|
}
|
|
@@ -2443,12 +2449,12 @@ class ci {
|
|
|
2443
2449
|
verticalAlign: f = "middle"
|
|
2444
2450
|
} = o;
|
|
2445
2451
|
this.ctx.font = n, this.ctx.fillStyle = c, this.ctx.textBaseline = f, this.ctx.textAlign = h;
|
|
2446
|
-
let u = 0;
|
|
2447
|
-
f === "top" ? u = i + d : f === "bottom" ? u = i + r - d : u = i + (r + 1) / 2;
|
|
2448
2452
|
let x = 0;
|
|
2449
|
-
|
|
2453
|
+
f === "top" ? x = i + d : f === "bottom" ? x = i + r - d : x = i + (r + 1) / 2;
|
|
2454
|
+
let u = 0;
|
|
2455
|
+
h === "left" ? u = e + d : h === "right" ? u = e + s - d : u = e + s / 2;
|
|
2450
2456
|
const { _text: p, ellipsis: g } = this.handleEllipsis(t, s, d, n);
|
|
2451
|
-
return this.ctx.fillText(p,
|
|
2457
|
+
return this.ctx.fillText(p, u, x), this.ctx.restore(), g;
|
|
2452
2458
|
}
|
|
2453
2459
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
2454
2460
|
let r = !1, o = t;
|
|
@@ -2826,8 +2832,8 @@ class re extends se {
|
|
|
2826
2832
|
const { width: e, height: i, type: s } = this;
|
|
2827
2833
|
if (["index-selection", "selection"].includes(s)) {
|
|
2828
2834
|
const { indeterminate: r, check: o, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: h = 0 } = this.ctx.config, c = this.drawX + (e - h) / 2, d = this.drawY + (i - h) / 2;
|
|
2829
|
-
let f = this.ctx.icons.get("checkbox-uncheck"),
|
|
2830
|
-
r ? (f = this.ctx.icons.get("checkbox-indeterminate"),
|
|
2835
|
+
let f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2836
|
+
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 = c, this.drawImageY = d, this.drawImageWidth = h, this.drawImageHeight = h, this.drawImageName = x, this.drawImageSource = f, this.ctx.paint.drawImage(
|
|
2831
2837
|
this.drawImageSource,
|
|
2832
2838
|
this.drawImageX,
|
|
2833
2839
|
this.drawImageY,
|
|
@@ -3161,13 +3167,10 @@ class xi {
|
|
|
3161
3167
|
this.focusCell !== t && (((e = this.focusCell) == null ? void 0 : e.rowKey) !== t.rowKey && (this.focusCell = t, this.emit("rowFocusChange", t)), this.focusCell = t, this.emit("cellFocusChange", t));
|
|
3162
3168
|
}
|
|
3163
3169
|
clearSelector() {
|
|
3164
|
-
this.selector =
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
xArrCopy: [-1, -1],
|
|
3169
|
-
yArrCopy: [-1, -1]
|
|
3170
|
-
};
|
|
3170
|
+
this.selector.enable = !1, this.selector.xArr = [-1, -1], this.selector.yArr = [-1, -1];
|
|
3171
|
+
}
|
|
3172
|
+
clearSelectorCopy() {
|
|
3173
|
+
this.selector.xArrCopy = [-1, -1], this.selector.yArrCopy = [-1, -1];
|
|
3171
3174
|
}
|
|
3172
3175
|
clearAutofill() {
|
|
3173
3176
|
this.autofill = {
|
|
@@ -3338,11 +3341,11 @@ class Pt {
|
|
|
3338
3341
|
stageHeight: i,
|
|
3339
3342
|
stageWidth: s,
|
|
3340
3343
|
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
3341
|
-
} = this.ctx, n = s, h = i, c = e.height, d = e.width, f = t.height,
|
|
3344
|
+
} = this.ctx, n = s, h = i, c = e.height, d = e.width, f = t.height, x = this.ctx.footer.height;
|
|
3342
3345
|
if (this.type === "vertical") {
|
|
3343
|
-
this.visibleDistance = h - r - c, this.distance = f - this.visibleDistance +
|
|
3344
|
-
const
|
|
3345
|
-
let p = Math.floor(
|
|
3346
|
+
this.visibleDistance = h - r - c, this.distance = f - this.visibleDistance + x, this.trackX = n - r, this.trackY = 0, this.splitPoints = [this.trackX, c, this.trackX + r, c], this.trackWidth = r, this.trackHeight = h, this.barX = this.trackX - 1 + (r - o) / 2, this.barWidth = o;
|
|
3347
|
+
const u = this.distance ? this.visibleDistance / (f + x) : 0;
|
|
3348
|
+
let p = Math.floor(u * this.visibleDistance);
|
|
3346
3349
|
p < 30 ? p = 30 : p > this.visibleDistance && (p = 0), this.barHeight = p, this.barY = c + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
3347
3350
|
} else {
|
|
3348
3351
|
this.visibleDistance = n - r, this.distance = d - this.visibleDistance, this.splitPoints = [
|
|
@@ -3351,8 +3354,8 @@ class Pt {
|
|
|
3351
3354
|
n - r,
|
|
3352
3355
|
h
|
|
3353
3356
|
], this.trackX = 0, this.trackY = h - r, this.trackWidth = n, this.trackHeight = r;
|
|
3354
|
-
const
|
|
3355
|
-
let p = Math.floor(
|
|
3357
|
+
const u = this.distance ? this.visibleDistance / d : 0;
|
|
3358
|
+
let p = Math.floor(u * this.visibleDistance);
|
|
3356
3359
|
this.barY = this.trackY - 1 + (r - o) / 2, p < 30 ? p = 30 : p >= this.visibleDistance && (p = 0), this.barWidth = p, this.barHeight = o, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
3357
3360
|
}
|
|
3358
3361
|
}
|
|
@@ -3388,30 +3391,30 @@ class ui {
|
|
|
3388
3391
|
});
|
|
3389
3392
|
}
|
|
3390
3393
|
onWheel(t) {
|
|
3391
|
-
this.verticalScrollbar.onWheel(t), this.horizontalScrollbar.onWheel(t), this.draw(
|
|
3394
|
+
this.verticalScrollbar.onWheel(t), this.horizontalScrollbar.onWheel(t), this.draw();
|
|
3392
3395
|
}
|
|
3393
3396
|
onTouchmove(t) {
|
|
3394
|
-
this.verticalScrollbar.onTouchmove(t), this.horizontalScrollbar.onTouchmove(t), this.draw(
|
|
3397
|
+
this.verticalScrollbar.onTouchmove(t), this.horizontalScrollbar.onTouchmove(t), this.draw();
|
|
3395
3398
|
}
|
|
3396
3399
|
onTouchstart(t) {
|
|
3397
|
-
this.verticalScrollbar.onTouchstart(t), this.horizontalScrollbar.onTouchstart(t), this.draw(
|
|
3400
|
+
this.verticalScrollbar.onTouchstart(t), this.horizontalScrollbar.onTouchstart(t), this.draw();
|
|
3398
3401
|
}
|
|
3399
3402
|
onMouseDown(t) {
|
|
3400
|
-
this.verticalScrollbar.onMouseDown(t), this.horizontalScrollbar.onMouseDown(t), this.draw(
|
|
3403
|
+
this.verticalScrollbar.onMouseDown(t), this.horizontalScrollbar.onMouseDown(t), this.draw();
|
|
3401
3404
|
}
|
|
3402
3405
|
onMouseMove(t) {
|
|
3403
|
-
this.verticalScrollbar.onMouseMove(t), this.horizontalScrollbar.onMouseMove(t), this.draw(
|
|
3406
|
+
this.verticalScrollbar.onMouseMove(t), this.horizontalScrollbar.onMouseMove(t), this.draw();
|
|
3404
3407
|
}
|
|
3405
3408
|
onMouseUp() {
|
|
3406
3409
|
this.verticalScrollbar.onMouseUp(), this.horizontalScrollbar.onMouseUp(), this.ctx.scrollerMove = !1;
|
|
3407
3410
|
}
|
|
3408
|
-
draw(
|
|
3411
|
+
draw() {
|
|
3409
3412
|
this.verticalScrollbar.draw(), this.horizontalScrollbar.draw();
|
|
3410
|
-
const
|
|
3411
|
-
(
|
|
3413
|
+
const t = Math.floor(this.horizontalScrollbar.scroll), e = Math.floor(this.verticalScrollbar.scroll);
|
|
3414
|
+
(t !== this.ctx.scrollX || e !== this.ctx.scrollY) && (this.ctx.emit("onScroll", t, e), t !== this.ctx.scrollX && this.ctx.emit("onScrollX", t), e !== this.ctx.scrollY && this.ctx.emit("onScrollY", e), this.ctx.scrollX = t, this.ctx.scrollY = e, this.ctx.emit("draw"));
|
|
3412
3415
|
}
|
|
3413
3416
|
setScroll(t, e) {
|
|
3414
|
-
this.horizontalScrollbar.scroll = t, this.verticalScrollbar.scroll = e, this.ctx.emit("draw");
|
|
3417
|
+
this.horizontalScrollbar.scroll = t, this.verticalScrollbar.scroll = e, this.ctx.emit("draw"), this.ctx.emit("onScroll", t, e);
|
|
3415
3418
|
}
|
|
3416
3419
|
setScrollX(t) {
|
|
3417
3420
|
this.horizontalScrollbar.scroll = t, this.ctx.emit("draw");
|
|
@@ -3486,7 +3489,7 @@ class gi {
|
|
|
3486
3489
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3487
3490
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3488
3491
|
const s = Qt(i), r = It(i);
|
|
3489
|
-
this.height = t * s, this.width = r.reduce((f,
|
|
3492
|
+
this.height = t * s, this.width = r.reduce((f, x) => f + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
3490
3493
|
const o = ti(te(i, s));
|
|
3491
3494
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3492
3495
|
const n = this.ctx.containerElement.getBoundingClientRect();
|
|
@@ -3497,9 +3500,9 @@ class gi {
|
|
|
3497
3500
|
this.resizeAllColumn(f);
|
|
3498
3501
|
}
|
|
3499
3502
|
const c = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
|
|
3500
|
-
this.ctx.fixedLeftWidth = c.reduce((f,
|
|
3503
|
+
this.ctx.fixedLeftWidth = c.reduce((f, x) => f + x.width, 0);
|
|
3501
3504
|
const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
|
|
3502
|
-
this.ctx.fixedRightWidth = d.reduce((f,
|
|
3505
|
+
this.ctx.fixedRightWidth = d.reduce((f, x) => f + 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;
|
|
3503
3506
|
}
|
|
3504
3507
|
// 调整表头的宽度
|
|
3505
3508
|
initResizeColumn() {
|
|
@@ -3584,7 +3587,7 @@ class gi {
|
|
|
3584
3587
|
for (let o = 0; o < i; o++) {
|
|
3585
3588
|
const n = t[o], h = r * (n.rowspan || 0), c = r * (n.level || 0);
|
|
3586
3589
|
let d = n.width || 100;
|
|
3587
|
-
n.children && (d = It(n.children).reduce((
|
|
3590
|
+
n.children && (d = It(n.children).reduce((u, p) => u + ((p == null ? void 0 : p.width) || 100), 0));
|
|
3588
3591
|
const f = new re(this.ctx, this.columnIndex, s, c, d, h, n);
|
|
3589
3592
|
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;
|
|
3590
3593
|
}
|
|
@@ -3737,14 +3740,14 @@ class wi {
|
|
|
3737
3740
|
MAX_HEIGHT: c = 0,
|
|
3738
3741
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3739
3742
|
OFFSET_HEIGHT: f = 0,
|
|
3740
|
-
FOOTER_POSITION:
|
|
3743
|
+
FOOTER_POSITION: x
|
|
3741
3744
|
}
|
|
3742
3745
|
} = this.ctx;
|
|
3743
3746
|
if (!e.width)
|
|
3744
3747
|
return;
|
|
3745
|
-
this.x = 0,
|
|
3746
|
-
const { data:
|
|
3747
|
-
this.height = p, this.data =
|
|
3748
|
+
this.x = 0, x === "top" && r ? this.y = e.height + i.height : this.y = e.height;
|
|
3749
|
+
const { data: u, sumHeight: p } = s.getData();
|
|
3750
|
+
this.height = p, this.data = u;
|
|
3748
3751
|
const { top: g } = t.getBoundingClientRect();
|
|
3749
3752
|
this.width = e.width, this.visibleWidth = this.ctx.stageWidth - o;
|
|
3750
3753
|
const w = this.ctx.footer.height;
|
|
@@ -3766,7 +3769,7 @@ class wi {
|
|
|
3766
3769
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3767
3770
|
))) : this.data.length && n ? m = n : this.data.length && c && E > c ? m = c : m = E, m > 0 && (this.ctx.stageHeight = Math.floor(m), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
|
|
3768
3771
|
let C = this.ctx.stageHeight - e.height - o;
|
|
3769
|
-
r ? this.visibleHeight = C - w : this.visibleHeight = C, 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 =
|
|
3772
|
+
r ? this.visibleHeight = C - w : this.visibleHeight = C, 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;
|
|
3770
3773
|
const b = window.devicePixelRatio || 1, R = this.ctx.stageWidth * b, S = this.ctx.stageHeight * b;
|
|
3771
3774
|
t.width = Math.floor(R), t.height = Math.floor(S), this.ctx.canvasElement.setAttribute(
|
|
3772
3775
|
"style",
|
|
@@ -3793,18 +3796,18 @@ class wi {
|
|
|
3793
3796
|
} = this.ctx;
|
|
3794
3797
|
if (this.isResizing && this.resizeTarget) {
|
|
3795
3798
|
const f = this.resizeTarget.height;
|
|
3796
|
-
let
|
|
3797
|
-
|
|
3799
|
+
let x = n - this.clientY;
|
|
3800
|
+
x + f < d && (x = -(f - d)), this.resizeDiff = x, this.ctx.emit("draw");
|
|
3798
3801
|
} else {
|
|
3799
3802
|
if (this.resizeTarget = null, this.isMouseDown || this.ctx.stageElement.style.cursor === "crosshair")
|
|
3800
3803
|
return;
|
|
3801
3804
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3802
3805
|
for (let f = 0; f < this.renderRows.length; f++) {
|
|
3803
|
-
const
|
|
3804
|
-
if (r >
|
|
3805
|
-
for (let p = 0; p <
|
|
3806
|
-
const g =
|
|
3807
|
-
o > g.drawX + 10 && o < g.drawX + g.width - 10 && g.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget =
|
|
3806
|
+
const x = this.renderRows[f];
|
|
3807
|
+
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r < h - 4)
|
|
3808
|
+
for (let p = 0; p < x.cells.length; p++) {
|
|
3809
|
+
const g = x.cells[p];
|
|
3810
|
+
o > g.drawX + 10 && o < g.drawX + g.width - 10 && g.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
3808
3811
|
}
|
|
3809
3812
|
}
|
|
3810
3813
|
}
|
|
@@ -3872,19 +3875,25 @@ class wi {
|
|
|
3872
3875
|
}
|
|
3873
3876
|
update() {
|
|
3874
3877
|
this.init();
|
|
3875
|
-
const {
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
const f =
|
|
3885
|
-
|
|
3878
|
+
const {
|
|
3879
|
+
header: t,
|
|
3880
|
+
database: e,
|
|
3881
|
+
scrollY: i,
|
|
3882
|
+
config: { CELL_HEIGHT: s }
|
|
3883
|
+
} = this.ctx, r = i, { data: o, positions: n } = e.getData();
|
|
3884
|
+
this.ctx.maxRowIndex = o.length - 1;
|
|
3885
|
+
let h = this.binarySearch(n, r), c = this.binarySearch(n, r + this.visibleHeight);
|
|
3886
|
+
if (c === -1 && (c = this.ctx.maxRowIndex), h === -1 && c === this.ctx.maxRowIndex) {
|
|
3887
|
+
const f = Math.floor(this.visibleHeight / s);
|
|
3888
|
+
h = this.ctx.maxRowIndex - f;
|
|
3889
|
+
}
|
|
3890
|
+
this.headIndex = Math.max(0, h), this.tailIndex = Math.min(this.ctx.maxRowIndex, c + 1), this.visibleRows = o.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3891
|
+
const d = [];
|
|
3892
|
+
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3893
|
+
const x = this.headIndex + f, u = this.visibleRows[f], { height: p, top: g } = this.ctx.database.getPositionForRowIndex(x), w = new oe(this.ctx, x, 0, g + this.y, t.width, p, u);
|
|
3894
|
+
d.push(w);
|
|
3886
3895
|
}
|
|
3887
|
-
this.renderRows =
|
|
3896
|
+
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
3888
3897
|
}
|
|
3889
3898
|
draw() {
|
|
3890
3899
|
this.renderRows.forEach((t) => {
|
|
@@ -3976,7 +3985,11 @@ class yi {
|
|
|
3976
3985
|
this.ctx = t, this.init();
|
|
3977
3986
|
}
|
|
3978
3987
|
init() {
|
|
3979
|
-
this.ctx.on(
|
|
3988
|
+
this.ctx.on("focusout", () => {
|
|
3989
|
+
this.ctx.clearSelector(), this.ctx.emit("drawView");
|
|
3990
|
+
}), this.ctx.on("setMoveFocus", (t) => {
|
|
3991
|
+
this.moveFocus(t);
|
|
3992
|
+
}), this.ctx.on(
|
|
3980
3993
|
"mousemove",
|
|
3981
3994
|
Jt((t) => {
|
|
3982
3995
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget() && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
|
|
@@ -4025,7 +4038,7 @@ class yi {
|
|
|
4025
4038
|
t.preventDefault(), this.moveFocus("LEFT");
|
|
4026
4039
|
return;
|
|
4027
4040
|
}
|
|
4028
|
-
if (t.code === "ArrowUp") {
|
|
4041
|
+
if (t.code === "ArrowUp" || t.shiftKey && t.code === "Enter") {
|
|
4029
4042
|
t.preventDefault(), this.moveFocus("TOP");
|
|
4030
4043
|
return;
|
|
4031
4044
|
}
|
|
@@ -4033,7 +4046,7 @@ class yi {
|
|
|
4033
4046
|
t.preventDefault(), this.moveFocus("RIGHT");
|
|
4034
4047
|
return;
|
|
4035
4048
|
}
|
|
4036
|
-
if (t.code === "ArrowDown") {
|
|
4049
|
+
if (t.code === "ArrowDown" || !t.shiftKey && t.code === "Enter") {
|
|
4037
4050
|
t.preventDefault(), this.moveFocus("BOTTOM");
|
|
4038
4051
|
return;
|
|
4039
4052
|
}
|
|
@@ -4078,16 +4091,16 @@ class yi {
|
|
|
4078
4091
|
SELECTOR_AREA_MIN_Y: c,
|
|
4079
4092
|
SELECTOR_AREA_MAX_Y: d,
|
|
4080
4093
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
4081
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4082
|
-
} = this.ctx.config,
|
|
4094
|
+
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
4095
|
+
} = this.ctx.config, u = n, p = h || this.ctx.maxColIndex - f, g = c, w = d || this.ctx.maxRowIndex - x;
|
|
4083
4096
|
let [y, E] = r, [m, C] = o;
|
|
4084
|
-
if (y <
|
|
4097
|
+
if (y < u || E > p || m < g || C > w)
|
|
4085
4098
|
return;
|
|
4086
4099
|
if (this.ctx.stageElement.focus(), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
4087
4100
|
const R = this.adjustMergeCells(r, o);
|
|
4088
4101
|
m = R.yArr[0], C = R.yArr[1], y = R.xArr[0], E = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
|
|
4089
4102
|
}
|
|
4090
|
-
y === E && m === C ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, r = [Math.max(
|
|
4103
|
+
y === E && m === C ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, r = [Math.max(u, y), Math.min(p, E)], o = [Math.max(g, m), Math.min(w, C)];
|
|
4091
4104
|
const { BEFORE_SET_SELECTOR_METHOD: b } = this.ctx.config;
|
|
4092
4105
|
if (typeof b == "function") {
|
|
4093
4106
|
const S = b({
|
|
@@ -4129,16 +4142,16 @@ class yi {
|
|
|
4129
4142
|
minX: r,
|
|
4130
4143
|
maxX: o
|
|
4131
4144
|
}
|
|
4132
|
-
), f = [d.minX, d.maxX],
|
|
4133
|
-
let
|
|
4145
|
+
), f = [d.minX, d.maxX], x = [c.minY, c.maxY];
|
|
4146
|
+
let u = !1;
|
|
4134
4147
|
if (d.minX !== d.maxX || c.minY !== c.maxY) {
|
|
4135
|
-
const g = JSON.stringify(f) + JSON.stringify(
|
|
4136
|
-
|
|
4148
|
+
const g = JSON.stringify(f) + JSON.stringify(x), w = (p = this.ctx.focusCell) == null ? void 0 : p.getSpanInfo();
|
|
4149
|
+
u = (w && JSON.stringify(w.xArr) + JSON.stringify(w.yArr)) === g;
|
|
4137
4150
|
}
|
|
4138
4151
|
return {
|
|
4139
4152
|
xArr: f,
|
|
4140
|
-
yArr:
|
|
4141
|
-
onlyMergeCell:
|
|
4153
|
+
yArr: x,
|
|
4154
|
+
onlyMergeCell: u
|
|
4142
4155
|
};
|
|
4143
4156
|
}
|
|
4144
4157
|
selectCols(t) {
|
|
@@ -4175,8 +4188,8 @@ class yi {
|
|
|
4175
4188
|
SELECTOR_AREA_MAX_Y: o,
|
|
4176
4189
|
SELECTOR_AREA_MAX_X_OFFSET: n,
|
|
4177
4190
|
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
4178
|
-
} = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r,
|
|
4179
|
-
this.setSelector(
|
|
4191
|
+
} = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r, x = o || this.ctx.maxRowIndex - h, u = [c, d], p = [f, x];
|
|
4192
|
+
this.setSelector(u, p);
|
|
4180
4193
|
}
|
|
4181
4194
|
}
|
|
4182
4195
|
selectRows(t, e = !0) {
|
|
@@ -4212,8 +4225,8 @@ class yi {
|
|
|
4212
4225
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
4213
4226
|
if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
|
|
4214
4227
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
4215
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e, h = Math.min(o, s), c = Math.max(o, s), d = Math.min(n, r), f = Math.max(n, r),
|
|
4216
|
-
this.setSelector(
|
|
4228
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e, h = Math.min(o, s), c = Math.max(o, s), d = Math.min(n, r), f = Math.max(n, r), x = [h, c], u = [d, f];
|
|
4229
|
+
this.setSelector(x, u);
|
|
4217
4230
|
} else {
|
|
4218
4231
|
this.ctx.emit("cellSelectedClick", e);
|
|
4219
4232
|
const s = [e.colIndex, e.colIndex], r = [e.rowIndex, e.rowIndex];
|
|
@@ -4281,10 +4294,10 @@ class yi {
|
|
|
4281
4294
|
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4282
4295
|
const c = n + e[0], d = h + t[0], f = this.ctx.database.getItemValueForRowIndexAndColIndex(c, d);
|
|
4283
4296
|
if (f) {
|
|
4284
|
-
const { rowKey:
|
|
4285
|
-
this.ctx.database.getReadonly(
|
|
4286
|
-
rowKey:
|
|
4287
|
-
key:
|
|
4297
|
+
const { rowKey: x, key: u } = f;
|
|
4298
|
+
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
4299
|
+
rowKey: x,
|
|
4300
|
+
key: u,
|
|
4288
4301
|
value: null,
|
|
4289
4302
|
row: {}
|
|
4290
4303
|
//内部有设置
|
|
@@ -4313,18 +4326,18 @@ class yi {
|
|
|
4313
4326
|
let o = ii(r);
|
|
4314
4327
|
const n = [i, i + o[0].length - 1], h = [e, e + o.length - 1], c = o.length === 1 && o[0].length === 1;
|
|
4315
4328
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
|
|
4316
|
-
const
|
|
4329
|
+
const u = {
|
|
4317
4330
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4318
4331
|
message: "Merged cells cannot span paste data"
|
|
4319
4332
|
};
|
|
4320
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4333
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", u) : alert(u.message);
|
|
4321
4334
|
return;
|
|
4322
4335
|
}
|
|
4323
4336
|
let d = [];
|
|
4324
|
-
for (let
|
|
4325
|
-
const p = o[
|
|
4337
|
+
for (let u = 0; u <= o.length - 1; u++) {
|
|
4338
|
+
const p = o[u].length;
|
|
4326
4339
|
for (let g = 0; g <= p - 1; g++) {
|
|
4327
|
-
const w =
|
|
4340
|
+
const w = u + e, y = g + i, E = o[u][g], m = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4328
4341
|
w,
|
|
4329
4342
|
y
|
|
4330
4343
|
);
|
|
@@ -4341,13 +4354,13 @@ class yi {
|
|
|
4341
4354
|
}
|
|
4342
4355
|
}
|
|
4343
4356
|
if (this.isCut) {
|
|
4344
|
-
const
|
|
4357
|
+
const u = this.clearSelectedData(
|
|
4345
4358
|
this.ctx.selector.xArrCopy,
|
|
4346
4359
|
this.ctx.selector.yArrCopy,
|
|
4347
4360
|
!0
|
|
4348
4361
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4349
4362
|
), p = d.map((g) => `${g.rowKey}-${g.key}`);
|
|
4350
|
-
|
|
4363
|
+
u.forEach((g) => {
|
|
4351
4364
|
p.includes(`${g.rowKey}-${g.key}`) || d.unshift(g);
|
|
4352
4365
|
}), this.isCut = !1;
|
|
4353
4366
|
}
|
|
@@ -4355,21 +4368,21 @@ class yi {
|
|
|
4355
4368
|
return;
|
|
4356
4369
|
const { BEFORE_PASTE_DATA_METHOD: f } = this.ctx.config;
|
|
4357
4370
|
if (typeof f == "function") {
|
|
4358
|
-
const
|
|
4371
|
+
const u = f, p = d.map((g) => ({
|
|
4359
4372
|
rowKey: g.rowKey,
|
|
4360
4373
|
key: g.key,
|
|
4361
4374
|
value: g.value,
|
|
4362
4375
|
oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
|
|
4363
4376
|
row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
|
|
4364
4377
|
}));
|
|
4365
|
-
if (d = await
|
|
4378
|
+
if (d = await u(p, n, h), d && !d.length)
|
|
4366
4379
|
return;
|
|
4367
4380
|
}
|
|
4368
4381
|
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4369
|
-
let
|
|
4370
|
-
s.forEach((
|
|
4371
|
-
|
|
4372
|
-
}), this.ctx.emit("pasteChange", d,
|
|
4382
|
+
let x = [];
|
|
4383
|
+
s.forEach((u) => {
|
|
4384
|
+
x.push(this.ctx.database.getRowDataItemForRowKey(u));
|
|
4385
|
+
}), this.ctx.emit("pasteChange", d, x);
|
|
4373
4386
|
}).catch((r) => {
|
|
4374
4387
|
console.error("Failed to get the clipboard content:", r);
|
|
4375
4388
|
});
|
|
@@ -4415,8 +4428,8 @@ class yi {
|
|
|
4415
4428
|
SELECTOR_AREA_MAX_Y: o,
|
|
4416
4429
|
SELECTOR_AREA_MAX_X_OFFSET: n,
|
|
4417
4430
|
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
4418
|
-
} = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r,
|
|
4419
|
-
return !(e < c || e > d || t < f || t >
|
|
4431
|
+
} = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r, x = o || this.ctx.maxRowIndex - h;
|
|
4432
|
+
return !(e < c || e > d || t < f || t > x);
|
|
4420
4433
|
}
|
|
4421
4434
|
/**
|
|
4422
4435
|
* 调整滚动条位置,让到达边界时自动滚动
|
|
@@ -4458,7 +4471,7 @@ class yi {
|
|
|
4458
4471
|
body: h,
|
|
4459
4472
|
scrollX: c,
|
|
4460
4473
|
scrollY: d,
|
|
4461
|
-
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED:
|
|
4474
|
+
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION: u, ENABLE_MERGE_CELL_LINK: p }
|
|
4462
4475
|
} = this.ctx;
|
|
4463
4476
|
if (!i)
|
|
4464
4477
|
return;
|
|
@@ -4467,7 +4480,7 @@ class yi {
|
|
|
4467
4480
|
let R = o.height - w, S = E;
|
|
4468
4481
|
S > h.visibleHeight && (S = h.visibleHeight);
|
|
4469
4482
|
let L = 0;
|
|
4470
|
-
|
|
4483
|
+
x && (u === "top" ? R = o.height + n.height - w : L = n.visibleHeight);
|
|
4471
4484
|
const I = w + S - (t - L - f);
|
|
4472
4485
|
let v = c, A = d;
|
|
4473
4486
|
b > 0 && !m ? v = Math.floor(c + b) : C > 0 && !m && (v = Math.floor(c - C)), R > 0 ? A = Math.floor(d - R) : I > 0 && (A = Math.floor(d + I)), (Math.abs(c - v) > 2 || Math.abs(d - A) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(v, A), this.ctx.emit("adjustBoundaryPosition", i));
|
|
@@ -4484,9 +4497,9 @@ class mi {
|
|
|
4484
4497
|
init() {
|
|
4485
4498
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
4486
4499
|
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
|
|
4487
|
-
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, n = r[1], h = o[1], { colIndex: c, rowIndex: d, drawX: f, drawY:
|
|
4500
|
+
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, n = r[1], h = o[1], { colIndex: c, rowIndex: d, drawX: f, drawY: x, width: u, height: p } = t;
|
|
4488
4501
|
if (this.ctx.config.ENABLE_AUTOFILL && c === n && d === h) {
|
|
4489
|
-
const w = f +
|
|
4502
|
+
const w = f + u - 6, y = x + p - 6;
|
|
4490
4503
|
i > w && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4491
4504
|
}
|
|
4492
4505
|
this.mouseenter(t);
|
|
@@ -4531,9 +4544,9 @@ class mi {
|
|
|
4531
4544
|
SELECTOR_AREA_MAX_X: c,
|
|
4532
4545
|
SELECTOR_AREA_MIN_Y: d,
|
|
4533
4546
|
SELECTOR_AREA_MAX_Y: f,
|
|
4534
|
-
SELECTOR_AREA_MAX_X_OFFSET:
|
|
4535
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4536
|
-
} = this.ctx.config, p = h, g = c || this.ctx.maxColIndex -
|
|
4547
|
+
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4548
|
+
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4549
|
+
} = this.ctx.config, p = h, g = c || this.ctx.maxColIndex - x, w = d, y = f || this.ctx.maxRowIndex - u;
|
|
4537
4550
|
let [E, m] = o, [C, b] = n;
|
|
4538
4551
|
if (E < p || C < w)
|
|
4539
4552
|
return;
|
|
@@ -4557,24 +4570,24 @@ class mi {
|
|
|
4557
4570
|
*/
|
|
4558
4571
|
async autofillData() {
|
|
4559
4572
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
4560
|
-
for (let
|
|
4573
|
+
for (let u = 0; u <= e.yArr[1] - e.yArr[0]; u++)
|
|
4561
4574
|
for (let p = 0; p <= e.xArr[1] - e.xArr[0]; p++) {
|
|
4562
|
-
const g =
|
|
4575
|
+
const g = u + e.yArr[0], w = p + e.xArr[0];
|
|
4563
4576
|
i.set(`${g}-${w}`, !0);
|
|
4564
4577
|
}
|
|
4565
4578
|
const { value: s } = e, r = s[0].length, o = s.length, n = this.ctx.autofill.xArr, h = this.ctx.autofill.yArr, c = r === 1 && o === 1;
|
|
4566
4579
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
|
|
4567
|
-
const
|
|
4580
|
+
const u = {
|
|
4568
4581
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
4569
4582
|
message: "Merged cells cannot span autofill data"
|
|
4570
4583
|
};
|
|
4571
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4584
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", u) : alert(u.message);
|
|
4572
4585
|
return;
|
|
4573
4586
|
}
|
|
4574
4587
|
let d = [];
|
|
4575
|
-
for (let
|
|
4588
|
+
for (let u = 0; u <= h[1] - h[0]; u++)
|
|
4576
4589
|
for (let p = 0; p <= n[1] - n[0]; p++) {
|
|
4577
|
-
const g = p + n[0], w =
|
|
4590
|
+
const g = p + n[0], w = u + h[0], y = s[u % o][p % r], E = this.ctx.database.getItemValueForRowIndexAndColIndex(w, g), m = `${w}-${g}`;
|
|
4578
4591
|
if (E && !i.has(m)) {
|
|
4579
4592
|
const { rowKey: C, key: b } = E;
|
|
4580
4593
|
this.ctx.database.getReadonly(C, b) || (t.add(C), d.push({
|
|
@@ -4590,21 +4603,21 @@ class mi {
|
|
|
4590
4603
|
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
|
|
4591
4604
|
const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
|
|
4592
4605
|
if (typeof f == "function") {
|
|
4593
|
-
const
|
|
4606
|
+
const u = f, p = d.map((g) => ({
|
|
4594
4607
|
rowKey: g.rowKey,
|
|
4595
4608
|
key: g.key,
|
|
4596
4609
|
value: g.value,
|
|
4597
4610
|
oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
|
|
4598
4611
|
row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
|
|
4599
4612
|
}));
|
|
4600
|
-
if (d = await
|
|
4613
|
+
if (d = await u(p, n, h), d && !d.length)
|
|
4601
4614
|
return;
|
|
4602
4615
|
}
|
|
4603
4616
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4604
|
-
let
|
|
4605
|
-
t.forEach((
|
|
4606
|
-
|
|
4607
|
-
}), this.ctx.emit("autofillChange", d,
|
|
4617
|
+
let x = [];
|
|
4618
|
+
t.forEach((u) => {
|
|
4619
|
+
x.push(this.ctx.database.getRowDataItemForRowKey(u));
|
|
4620
|
+
}), this.ctx.emit("autofillChange", d, x);
|
|
4608
4621
|
}
|
|
4609
4622
|
mouseenter(t) {
|
|
4610
4623
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4728,48 +4741,48 @@ function zt(a, t, e) {
|
|
|
4728
4741
|
reference: i,
|
|
4729
4742
|
floating: s
|
|
4730
4743
|
} = a;
|
|
4731
|
-
const r = J(t), o = Ht(t), n = Mt(o), h = q(t), c = r === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2,
|
|
4732
|
-
let
|
|
4744
|
+
const r = J(t), o = Ht(t), n = Mt(o), h = q(t), c = 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;
|
|
4745
|
+
let u;
|
|
4733
4746
|
switch (h) {
|
|
4734
4747
|
case "top":
|
|
4735
|
-
|
|
4748
|
+
u = {
|
|
4736
4749
|
x: d,
|
|
4737
4750
|
y: i.y - s.height
|
|
4738
4751
|
};
|
|
4739
4752
|
break;
|
|
4740
4753
|
case "bottom":
|
|
4741
|
-
|
|
4754
|
+
u = {
|
|
4742
4755
|
x: d,
|
|
4743
4756
|
y: i.y + i.height
|
|
4744
4757
|
};
|
|
4745
4758
|
break;
|
|
4746
4759
|
case "right":
|
|
4747
|
-
|
|
4760
|
+
u = {
|
|
4748
4761
|
x: i.x + i.width,
|
|
4749
4762
|
y: f
|
|
4750
4763
|
};
|
|
4751
4764
|
break;
|
|
4752
4765
|
case "left":
|
|
4753
|
-
|
|
4766
|
+
u = {
|
|
4754
4767
|
x: i.x - s.width,
|
|
4755
4768
|
y: f
|
|
4756
4769
|
};
|
|
4757
4770
|
break;
|
|
4758
4771
|
default:
|
|
4759
|
-
|
|
4772
|
+
u = {
|
|
4760
4773
|
x: i.x,
|
|
4761
4774
|
y: i.y
|
|
4762
4775
|
};
|
|
4763
4776
|
}
|
|
4764
4777
|
switch (lt(t)) {
|
|
4765
4778
|
case "start":
|
|
4766
|
-
|
|
4779
|
+
u[o] -= x * (e && c ? -1 : 1);
|
|
4767
4780
|
break;
|
|
4768
4781
|
case "end":
|
|
4769
|
-
|
|
4782
|
+
u[o] += x * (e && c ? -1 : 1);
|
|
4770
4783
|
break;
|
|
4771
4784
|
}
|
|
4772
|
-
return
|
|
4785
|
+
return u;
|
|
4773
4786
|
}
|
|
4774
4787
|
const Oi = async (a, t, e) => {
|
|
4775
4788
|
const {
|
|
@@ -4785,7 +4798,7 @@ const Oi = async (a, t, e) => {
|
|
|
4785
4798
|
}), {
|
|
4786
4799
|
x: d,
|
|
4787
4800
|
y: f
|
|
4788
|
-
} = zt(c, i, h),
|
|
4801
|
+
} = zt(c, i, h), x = i, u = {}, p = 0;
|
|
4789
4802
|
for (let g = 0; g < n.length; g++) {
|
|
4790
4803
|
const {
|
|
4791
4804
|
name: w,
|
|
@@ -4799,9 +4812,9 @@ const Oi = async (a, t, e) => {
|
|
|
4799
4812
|
x: d,
|
|
4800
4813
|
y: f,
|
|
4801
4814
|
initialPlacement: i,
|
|
4802
|
-
placement:
|
|
4815
|
+
placement: x,
|
|
4803
4816
|
strategy: s,
|
|
4804
|
-
middlewareData:
|
|
4817
|
+
middlewareData: u,
|
|
4805
4818
|
rects: c,
|
|
4806
4819
|
platform: o,
|
|
4807
4820
|
elements: {
|
|
@@ -4809,27 +4822,27 @@ const Oi = async (a, t, e) => {
|
|
|
4809
4822
|
floating: t
|
|
4810
4823
|
}
|
|
4811
4824
|
});
|
|
4812
|
-
d = E ?? d, f = m ?? f,
|
|
4813
|
-
...
|
|
4825
|
+
d = E ?? d, f = m ?? f, u = {
|
|
4826
|
+
...u,
|
|
4814
4827
|
[w]: {
|
|
4815
|
-
...
|
|
4828
|
+
...u[w],
|
|
4816
4829
|
...C
|
|
4817
4830
|
}
|
|
4818
|
-
}, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (
|
|
4831
|
+
}, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (x = b.placement), b.rects && (c = b.rects === !0 ? await o.getElementRects({
|
|
4819
4832
|
reference: a,
|
|
4820
4833
|
floating: t,
|
|
4821
4834
|
strategy: s
|
|
4822
4835
|
}) : b.rects), {
|
|
4823
4836
|
x: d,
|
|
4824
4837
|
y: f
|
|
4825
|
-
} = zt(c,
|
|
4838
|
+
} = zt(c, x, h)), g = -1);
|
|
4826
4839
|
}
|
|
4827
4840
|
return {
|
|
4828
4841
|
x: d,
|
|
4829
4842
|
y: f,
|
|
4830
|
-
placement:
|
|
4843
|
+
placement: x,
|
|
4831
4844
|
strategy: s,
|
|
4832
|
-
middlewareData:
|
|
4845
|
+
middlewareData: u
|
|
4833
4846
|
};
|
|
4834
4847
|
};
|
|
4835
4848
|
async function le(a, t) {
|
|
@@ -4846,9 +4859,9 @@ async function le(a, t) {
|
|
|
4846
4859
|
boundary: c = "clippingAncestors",
|
|
4847
4860
|
rootBoundary: d = "viewport",
|
|
4848
4861
|
elementContext: f = "floating",
|
|
4849
|
-
altBoundary:
|
|
4850
|
-
padding:
|
|
4851
|
-
} = at(t, a), p = ae(
|
|
4862
|
+
altBoundary: x = !1,
|
|
4863
|
+
padding: u = 0
|
|
4864
|
+
} = at(t, a), p = ae(u), w = n[x ? f === "floating" ? "reference" : "floating" : f], y = ut(await r.getClippingRect({
|
|
4852
4865
|
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)),
|
|
4853
4866
|
boundary: c,
|
|
4854
4867
|
rootBoundary: d,
|
|
@@ -4895,17 +4908,17 @@ const Si = (a) => ({
|
|
|
4895
4908
|
} = at(a, t) || {};
|
|
4896
4909
|
if (c == null)
|
|
4897
4910
|
return {};
|
|
4898
|
-
const f = ae(d),
|
|
4911
|
+
const f = ae(d), x = {
|
|
4899
4912
|
x: e,
|
|
4900
4913
|
y: i
|
|
4901
|
-
},
|
|
4914
|
+
}, u = Ht(s), p = Mt(u), g = await o.getDimensions(c), w = u === "y", y = w ? "top" : "left", E = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", C = r.reference[p] + r.reference[u] - x[u] - r.floating[p], b = x[u] - r.reference[u], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c));
|
|
4902
4915
|
let S = R ? R[m] : 0;
|
|
4903
4916
|
(!S || !await (o.isElement == null ? void 0 : o.isElement(R))) && (S = n.floating[m] || r.floating[p]);
|
|
4904
4917
|
const L = C / 2 - b / 2, I = S / 2 - g[p] / 2 - 1, v = rt(f[y], I), A = rt(f[E], I), O = v, M = S - g[p] - A, T = S / 2 - g[p] / 2 + L, N = _t(O, T, M), Y = !h.arrow && lt(s) != null && T !== N && r.reference[p] / 2 - (T < O ? v : A) - g[p] / 2 < 0, K = Y ? T < O ? T - O : T - M : 0;
|
|
4905
4918
|
return {
|
|
4906
|
-
[
|
|
4919
|
+
[u]: x[u] + K,
|
|
4907
4920
|
data: {
|
|
4908
|
-
[
|
|
4921
|
+
[u]: N,
|
|
4909
4922
|
centerOffset: T - N - K,
|
|
4910
4923
|
...Y && {
|
|
4911
4924
|
alignmentOffset: K
|
|
@@ -4930,16 +4943,16 @@ const Si = (a) => ({
|
|
|
4930
4943
|
} = t, {
|
|
4931
4944
|
mainAxis: d = !0,
|
|
4932
4945
|
crossAxis: f = !0,
|
|
4933
|
-
fallbackPlacements:
|
|
4934
|
-
fallbackStrategy:
|
|
4946
|
+
fallbackPlacements: x,
|
|
4947
|
+
fallbackStrategy: u = "bestFit",
|
|
4935
4948
|
fallbackAxisSideDirection: p = "none",
|
|
4936
4949
|
flipAlignment: g = !0,
|
|
4937
4950
|
...w
|
|
4938
4951
|
} = at(a, t);
|
|
4939
4952
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4940
4953
|
return {};
|
|
4941
|
-
const y = q(s), E = J(n), m = q(n) === n, C = await (h.isRTL == null ? void 0 : h.isRTL(c.floating)), b =
|
|
4942
|
-
!
|
|
4954
|
+
const y = q(s), E = J(n), m = q(n) === n, C = await (h.isRTL == null ? void 0 : h.isRTL(c.floating)), b = x || (m || !g ? [xt(n)] : vi(n)), R = p !== "none";
|
|
4955
|
+
!x && R && b.push(...Ii(n, g, p, C));
|
|
4943
4956
|
const S = [n, ...b], L = await le(t, w), I = [];
|
|
4944
4957
|
let v = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4945
4958
|
if (d && I.push(L[y]), f) {
|
|
@@ -4964,7 +4977,7 @@ const Si = (a) => ({
|
|
|
4964
4977
|
};
|
|
4965
4978
|
let Y = (O = v.filter((K) => K.overflows[0] <= 0).sort((K, W) => K.overflows[1] - W.overflows[1])[0]) == null ? void 0 : O.placement;
|
|
4966
4979
|
if (!Y)
|
|
4967
|
-
switch (
|
|
4980
|
+
switch (u) {
|
|
4968
4981
|
case "bestFit": {
|
|
4969
4982
|
var M;
|
|
4970
4983
|
const K = (M = v.filter((W) => {
|
|
@@ -5001,8 +5014,8 @@ async function Ai(a, t) {
|
|
|
5001
5014
|
elements: s
|
|
5002
5015
|
} = a, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), n = lt(e), h = J(e) === "y", c = ["left", "top"].includes(o) ? -1 : 1, d = r && h ? -1 : 1, f = at(t, a);
|
|
5003
5016
|
let {
|
|
5004
|
-
mainAxis:
|
|
5005
|
-
crossAxis:
|
|
5017
|
+
mainAxis: x,
|
|
5018
|
+
crossAxis: u,
|
|
5006
5019
|
alignmentAxis: p
|
|
5007
5020
|
} = typeof f == "number" ? {
|
|
5008
5021
|
mainAxis: f,
|
|
@@ -5013,12 +5026,12 @@ async function Ai(a, t) {
|
|
|
5013
5026
|
crossAxis: f.crossAxis || 0,
|
|
5014
5027
|
alignmentAxis: f.alignmentAxis
|
|
5015
5028
|
};
|
|
5016
|
-
return n && typeof p == "number" && (
|
|
5017
|
-
x:
|
|
5018
|
-
y:
|
|
5029
|
+
return n && typeof p == "number" && (u = n === "end" ? p * -1 : p), h ? {
|
|
5030
|
+
x: u * d,
|
|
5031
|
+
y: x * c
|
|
5019
5032
|
} : {
|
|
5020
|
-
x:
|
|
5021
|
-
y:
|
|
5033
|
+
x: x * c,
|
|
5034
|
+
y: u * d
|
|
5022
5035
|
};
|
|
5023
5036
|
}
|
|
5024
5037
|
const Ti = function(a) {
|
|
@@ -5071,11 +5084,11 @@ const Ti = function(a) {
|
|
|
5071
5084
|
} = at(a, t), c = {
|
|
5072
5085
|
x: e,
|
|
5073
5086
|
y: i
|
|
5074
|
-
}, d = await le(t, h), f = J(q(s)),
|
|
5075
|
-
let
|
|
5087
|
+
}, d = await le(t, h), f = J(q(s)), x = ne(f);
|
|
5088
|
+
let u = c[x], p = c[f];
|
|
5076
5089
|
if (r) {
|
|
5077
|
-
const w =
|
|
5078
|
-
|
|
5090
|
+
const w = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", E = u + d[w], m = u - d[y];
|
|
5091
|
+
u = _t(E, u, m);
|
|
5079
5092
|
}
|
|
5080
5093
|
if (o) {
|
|
5081
5094
|
const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", E = p + d[w], m = p - d[y];
|
|
@@ -5083,7 +5096,7 @@ const Ti = function(a) {
|
|
|
5083
5096
|
}
|
|
5084
5097
|
const g = n.fn({
|
|
5085
5098
|
...t,
|
|
5086
|
-
[
|
|
5099
|
+
[x]: u,
|
|
5087
5100
|
[f]: p
|
|
5088
5101
|
});
|
|
5089
5102
|
return {
|
|
@@ -5092,7 +5105,7 @@ const Ti = function(a) {
|
|
|
5092
5105
|
x: g.x - e,
|
|
5093
5106
|
y: g.y - i,
|
|
5094
5107
|
enabled: {
|
|
5095
|
-
[
|
|
5108
|
+
[x]: r,
|
|
5096
5109
|
[f]: o
|
|
5097
5110
|
}
|
|
5098
5111
|
}
|
|
@@ -5256,9 +5269,9 @@ function ot(a, t, e, i) {
|
|
|
5256
5269
|
const n = Xi(r, e, i) ? xe(r) : z(0);
|
|
5257
5270
|
let h = (s.left + n.x) / o.x, c = (s.top + n.y) / o.y, d = s.width / o.x, f = s.height / o.y;
|
|
5258
5271
|
if (r) {
|
|
5259
|
-
const
|
|
5260
|
-
let p =
|
|
5261
|
-
for (; g && i &&
|
|
5272
|
+
const x = F(r), u = i && X(i) ? F(i) : i;
|
|
5273
|
+
let p = x, g = Lt(p);
|
|
5274
|
+
for (; g && i && u !== p; ) {
|
|
5262
5275
|
const w = Z(g), y = g.getBoundingClientRect(), E = k(g), m = y.left + (g.clientLeft + parseFloat(E.paddingLeft)) * w.x, C = y.top + (g.clientTop + parseFloat(E.paddingTop)) * w.y;
|
|
5263
5276
|
h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c += C, p = F(g), g = Lt(p);
|
|
5264
5277
|
}
|
|
@@ -5286,8 +5299,8 @@ function ki(a) {
|
|
|
5286
5299
|
}, c = z(1);
|
|
5287
5300
|
const d = z(0), f = B(i);
|
|
5288
5301
|
if ((f || !f && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), B(i))) {
|
|
5289
|
-
const
|
|
5290
|
-
c = Z(i), d.x =
|
|
5302
|
+
const x = ot(i);
|
|
5303
|
+
c = Z(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5291
5304
|
}
|
|
5292
5305
|
return {
|
|
5293
5306
|
width: e.width * c.x,
|
|
@@ -5410,19 +5423,19 @@ function zi(a, t, e) {
|
|
|
5410
5423
|
const h = z(0);
|
|
5411
5424
|
if (i || !i && !r)
|
|
5412
5425
|
if ((tt(t) !== "body" || ht(s)) && (n = pt(t)), i) {
|
|
5413
|
-
const
|
|
5414
|
-
h.x =
|
|
5426
|
+
const u = ot(t, !0, r, t);
|
|
5427
|
+
h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
|
|
5415
5428
|
} else s && (h.x = At(s));
|
|
5416
5429
|
let c = 0, d = 0;
|
|
5417
5430
|
if (s && !i && !r) {
|
|
5418
|
-
const
|
|
5419
|
-
d =
|
|
5420
|
-
At(s,
|
|
5431
|
+
const u = s.getBoundingClientRect();
|
|
5432
|
+
d = u.top + n.scrollTop, c = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
5433
|
+
At(s, u);
|
|
5421
5434
|
}
|
|
5422
|
-
const f = o.left + n.scrollLeft - h.x - c,
|
|
5435
|
+
const f = o.left + n.scrollLeft - h.x - c, x = o.top + n.scrollTop - h.y - d;
|
|
5423
5436
|
return {
|
|
5424
5437
|
x: f,
|
|
5425
|
-
y:
|
|
5438
|
+
y: x,
|
|
5426
5439
|
width: o.width,
|
|
5427
5440
|
height: o.height
|
|
5428
5441
|
};
|
|
@@ -5574,26 +5587,26 @@ let Ui = class {
|
|
|
5574
5587
|
top: `${c}px`,
|
|
5575
5588
|
left: `${h}px`
|
|
5576
5589
|
}), f.arrow) {
|
|
5577
|
-
const
|
|
5590
|
+
const x = f.arrow;
|
|
5578
5591
|
["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
5579
|
-
top: `${
|
|
5592
|
+
top: `${x.y}px`,
|
|
5580
5593
|
bottom: "",
|
|
5581
5594
|
left: "",
|
|
5582
5595
|
right: "-5px"
|
|
5583
5596
|
}) : ["right", "right-start", "right-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
5584
|
-
top: `${
|
|
5597
|
+
top: `${x.y}px`,
|
|
5585
5598
|
bottom: "",
|
|
5586
5599
|
left: "-5px",
|
|
5587
5600
|
right: ""
|
|
5588
5601
|
}) : ["bottom", "bottom-start", "bottom-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
5589
5602
|
top: "-5px",
|
|
5590
5603
|
bottom: "",
|
|
5591
|
-
left: `${
|
|
5604
|
+
left: `${x.x}px`,
|
|
5592
5605
|
right: ""
|
|
5593
5606
|
}) : ["top", "top-start", "top-end"].includes(d) && Object.assign(this.arrowEl.style, {
|
|
5594
5607
|
top: "",
|
|
5595
5608
|
bottom: "-5px",
|
|
5596
|
-
left: `${
|
|
5609
|
+
left: `${x.x}px`,
|
|
5597
5610
|
right: ""
|
|
5598
5611
|
});
|
|
5599
5612
|
}
|
|
@@ -5616,17 +5629,45 @@ class Zi {
|
|
|
5616
5629
|
l(this, "ctx");
|
|
5617
5630
|
l(this, "drawY", 0);
|
|
5618
5631
|
l(this, "drawX", 0);
|
|
5632
|
+
l(this, "cancel", !1);
|
|
5619
5633
|
this.ctx = t, this.initTextEditor(), this.init();
|
|
5620
5634
|
}
|
|
5621
5635
|
init() {
|
|
5622
|
-
this.ctx.on("
|
|
5636
|
+
this.ctx.on("focusout", (t) => {
|
|
5637
|
+
t.target !== this.ctx.stageElement && (this.ctx.editing && this.doneEdit(), this.cellTarget = null);
|
|
5638
|
+
}), this.ctx.on("onScroll", () => {
|
|
5623
5639
|
this.enable && this.doneEdit();
|
|
5624
5640
|
}), this.ctx.on("cellHeaderMousedown", () => {
|
|
5625
5641
|
this.enable && this.doneEdit(), this.cellTarget = null;
|
|
5626
5642
|
}), this.ctx.on("keydown", (t) => {
|
|
5643
|
+
if (!this.ctx.isTarget())
|
|
5644
|
+
return;
|
|
5645
|
+
if (t.code === "Escape" && this.ctx.editing) {
|
|
5646
|
+
this.cancel = !0;
|
|
5647
|
+
const { focusCell: h } = this.ctx;
|
|
5648
|
+
h && (this.ctx.emit("setSelectorCell", h), this.cellTarget = h), this.doneEdit();
|
|
5649
|
+
return;
|
|
5650
|
+
}
|
|
5651
|
+
if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
|
|
5652
|
+
t.preventDefault();
|
|
5653
|
+
const h = this.inputEl.selectionStart, c = this.inputEl.value.substring(0, h), d = this.inputEl.value.substring(h);
|
|
5654
|
+
this.inputEl.value = c + `
|
|
5655
|
+
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = h + 1, this.autoSize();
|
|
5656
|
+
return;
|
|
5657
|
+
}
|
|
5658
|
+
if (t.code === "Enter" && this.ctx.editing) {
|
|
5659
|
+
t.preventDefault(), this.doneEdit();
|
|
5660
|
+
const { focusCell: h } = this.ctx;
|
|
5661
|
+
if (h && (this.ctx.emit("setSelectorCell", h), this.cellTarget = h), t.shiftKey) {
|
|
5662
|
+
this.ctx.emit("setMoveFocus", "TOP");
|
|
5663
|
+
return;
|
|
5664
|
+
}
|
|
5665
|
+
this.ctx.emit("setMoveFocus", "BOTTOM");
|
|
5666
|
+
return;
|
|
5667
|
+
}
|
|
5627
5668
|
const e = t.key, i = t.ctrlKey, s = t.altKey, r = t.shiftKey, o = t.metaKey;
|
|
5628
|
-
|
|
5629
|
-
|
|
5669
|
+
i || s || r || o || [
|
|
5670
|
+
"Enter",
|
|
5630
5671
|
"Escape",
|
|
5631
5672
|
"Tab",
|
|
5632
5673
|
"Backspace",
|
|
@@ -5652,13 +5693,7 @@ class Zi {
|
|
|
5652
5693
|
"F10",
|
|
5653
5694
|
"F11",
|
|
5654
5695
|
"F12"
|
|
5655
|
-
].includes(e))
|
|
5656
|
-
if (t.code === "Enter" && !this.enable) {
|
|
5657
|
-
t.preventDefault(), this.startEdit();
|
|
5658
|
-
return;
|
|
5659
|
-
}
|
|
5660
|
-
this.startEdit();
|
|
5661
|
-
}
|
|
5696
|
+
].includes(e) || this.startEdit(!0);
|
|
5662
5697
|
}), this.ctx.on("adjustBoundaryPosition", (t) => {
|
|
5663
5698
|
this.cellTarget = t;
|
|
5664
5699
|
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
@@ -5691,20 +5726,7 @@ class Zi {
|
|
|
5691
5726
|
return !(e < r || e > o || t < n || t > h);
|
|
5692
5727
|
}
|
|
5693
5728
|
initTextEditor() {
|
|
5694
|
-
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("
|
|
5695
|
-
if (!t.isComposing && this.enable) {
|
|
5696
|
-
if (t.stopPropagation(), (t.altKey || t.metaKey) && t.code === "Enter") {
|
|
5697
|
-
t.preventDefault();
|
|
5698
|
-
const e = this.inputEl.selectionStart, i = this.inputEl.value.substring(0, e), s = this.inputEl.value.substring(e);
|
|
5699
|
-
this.inputEl.value = i + `
|
|
5700
|
-
` + s, this.inputEl.selectionStart = this.inputEl.selectionEnd = e + 1, this.autoSize();
|
|
5701
|
-
return;
|
|
5702
|
-
}
|
|
5703
|
-
(t.code === "Escape" || t.code === "Enter") && (t.preventDefault(), this.inputEl.blur());
|
|
5704
|
-
}
|
|
5705
|
-
}), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
5706
|
-
this.doneEdit();
|
|
5707
|
-
}), this.editorEl = this.ctx.editorElement, this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
|
|
5729
|
+
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.editorEl = this.ctx.editorElement, this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
|
|
5708
5730
|
}
|
|
5709
5731
|
autoSize() {
|
|
5710
5732
|
this.inputEl.style.height = "auto";
|
|
@@ -5718,42 +5740,43 @@ class Zi {
|
|
|
5718
5740
|
} = this.ctx, n = i - s.height - o;
|
|
5719
5741
|
this.editorEl.style.bottom = "auto", this.drawY < r.height && (this.editorEl.style.top = `${r.height - 1}px`), this.drawY + t > n && (this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = "auto", this.editorEl.style.bottom = `${i - n}px`), this.inputEl.style.height = `${t}px`;
|
|
5720
5742
|
}
|
|
5721
|
-
startEditByInput(t) {
|
|
5722
|
-
const
|
|
5743
|
+
startEditByInput(t, e = !1) {
|
|
5744
|
+
const i = e ? null : t.getValue(), { editorType: s } = t;
|
|
5723
5745
|
this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
5724
|
-
let { drawX:
|
|
5725
|
-
this.drawX =
|
|
5746
|
+
let { drawX: r, drawY: o, height: n, width: h } = t;
|
|
5747
|
+
this.drawX = r, this.drawY = o;
|
|
5726
5748
|
const {
|
|
5727
|
-
config: { CELL_PADDING:
|
|
5728
|
-
header:
|
|
5749
|
+
config: { CELL_PADDING: c },
|
|
5750
|
+
header: d
|
|
5729
5751
|
} = this.ctx;
|
|
5730
|
-
let
|
|
5731
|
-
if (
|
|
5732
|
-
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${
|
|
5733
|
-
const
|
|
5734
|
-
this.inputEl.setSelectionRange(
|
|
5752
|
+
let f = this.ctx.body.visibleHeight;
|
|
5753
|
+
if (n > f && (n = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${r - 1}px`, this.editorEl.style.top = `${o - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
5754
|
+
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${h - 1}px`, this.inputEl.style.minHeight = `${n - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${h - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${c}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus();
|
|
5755
|
+
const x = this.inputEl.value.length;
|
|
5756
|
+
this.inputEl.setSelectionRange(x, x);
|
|
5735
5757
|
} else
|
|
5736
5758
|
this.inputEl.style.display = "none";
|
|
5737
|
-
(this.inputEl.scrollHeight >
|
|
5759
|
+
(this.inputEl.scrollHeight > n || o < d.height) && this.autoSize();
|
|
5738
5760
|
}
|
|
5739
5761
|
doneEditByInput() {
|
|
5740
5762
|
if (this.cellTarget && (this.editorEl.style.display = "none", this.cellTarget.editorType === "text")) {
|
|
5741
5763
|
const { rowKey: t, key: e } = this.cellTarget, i = this.cellTarget.getValue(), s = this.inputEl.value;
|
|
5742
|
-
s !== i && !(s === "" && i === null) && this.ctx.setItemValueByEditor(t, e, s, !0), this.inputEl.value = "";
|
|
5764
|
+
s !== i && !(s === "" && i === null) && !this.cancel && this.ctx.setItemValueByEditor(t, e, s, !0), this.inputEl.value = "";
|
|
5743
5765
|
}
|
|
5744
5766
|
}
|
|
5745
|
-
startEdit() {
|
|
5746
|
-
|
|
5747
|
-
|
|
5767
|
+
startEdit(t = !1) {
|
|
5768
|
+
this.cancel = !1;
|
|
5769
|
+
const { ENABLE_EDIT_CLICK_SELECTOR: e } = this.ctx.config;
|
|
5770
|
+
if (!e)
|
|
5748
5771
|
return;
|
|
5749
|
-
const
|
|
5750
|
-
if (!
|
|
5772
|
+
const i = this.ctx.focusCell;
|
|
5773
|
+
if (!i || ["index", "index-selection", "selection"].includes(i.type) || this.enable)
|
|
5751
5774
|
return;
|
|
5752
|
-
const { rowKey:
|
|
5753
|
-
if (
|
|
5775
|
+
const { rowKey: s, key: r, editorType: o } = i;
|
|
5776
|
+
if (o === "none")
|
|
5754
5777
|
return;
|
|
5755
|
-
const
|
|
5756
|
-
|
|
5778
|
+
const n = this.ctx.database.getReadonly(s, r);
|
|
5779
|
+
i && !n && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
|
|
5757
5780
|
}
|
|
5758
5781
|
editCell(t, e) {
|
|
5759
5782
|
const i = this.ctx.body.renderRows.find((c) => c.rowIndex === t);
|
|
@@ -5834,7 +5857,7 @@ class Qi {
|
|
|
5834
5857
|
n.forEach((w) => {
|
|
5835
5858
|
w.render && (w.fixed === "left" ? c.push(w) : w.fixed === "right" ? d.push(w) : h.push(w));
|
|
5836
5859
|
});
|
|
5837
|
-
const f = e - i,
|
|
5860
|
+
const f = e - i, x = {
|
|
5838
5861
|
key: "left",
|
|
5839
5862
|
style: {
|
|
5840
5863
|
position: "absolute",
|
|
@@ -5845,7 +5868,7 @@ class Qi {
|
|
|
5845
5868
|
height: `${o}px`
|
|
5846
5869
|
},
|
|
5847
5870
|
cells: c
|
|
5848
|
-
},
|
|
5871
|
+
}, u = {
|
|
5849
5872
|
key: "center",
|
|
5850
5873
|
style: {
|
|
5851
5874
|
position: "absolute",
|
|
@@ -5877,7 +5900,7 @@ class Qi {
|
|
|
5877
5900
|
width: `${r}px`,
|
|
5878
5901
|
height: `${o}px`
|
|
5879
5902
|
},
|
|
5880
|
-
views: [
|
|
5903
|
+
views: [x, u, p]
|
|
5881
5904
|
};
|
|
5882
5905
|
}
|
|
5883
5906
|
getBody() {
|
|
@@ -5892,7 +5915,7 @@ class Qi {
|
|
|
5892
5915
|
fixedLeftWidth: r,
|
|
5893
5916
|
fixedRightWidth: o,
|
|
5894
5917
|
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: h }
|
|
5895
|
-
} = this.ctx, { visibleWidth: c, visibleHeight: d } = this.ctx.body, f = o - n,
|
|
5918
|
+
} = this.ctx, { visibleWidth: c, visibleHeight: d } = this.ctx.body, f = o - n, x = {
|
|
5896
5919
|
key: "left",
|
|
5897
5920
|
style: {
|
|
5898
5921
|
position: "absolute",
|
|
@@ -5903,7 +5926,7 @@ class Qi {
|
|
|
5903
5926
|
height: `${d}px`
|
|
5904
5927
|
},
|
|
5905
5928
|
cells: e
|
|
5906
|
-
},
|
|
5929
|
+
}, u = {
|
|
5907
5930
|
key: "center",
|
|
5908
5931
|
style: {
|
|
5909
5932
|
position: "absolute",
|
|
@@ -5935,7 +5958,7 @@ class Qi {
|
|
|
5935
5958
|
width: `${c}px`,
|
|
5936
5959
|
height: `${d}px`
|
|
5937
5960
|
},
|
|
5938
|
-
views: [
|
|
5961
|
+
views: [x, u, p]
|
|
5939
5962
|
};
|
|
5940
5963
|
}
|
|
5941
5964
|
getFooter() {
|
|
@@ -5960,7 +5983,7 @@ class Qi {
|
|
|
5960
5983
|
height: `${c}px`
|
|
5961
5984
|
},
|
|
5962
5985
|
cells: e
|
|
5963
|
-
},
|
|
5986
|
+
}, x = {
|
|
5964
5987
|
key: "center",
|
|
5965
5988
|
style: {
|
|
5966
5989
|
position: "absolute",
|
|
@@ -5971,7 +5994,7 @@ class Qi {
|
|
|
5971
5994
|
height: `${c}px`
|
|
5972
5995
|
},
|
|
5973
5996
|
cells: t
|
|
5974
|
-
},
|
|
5997
|
+
}, u = {
|
|
5975
5998
|
key: "right",
|
|
5976
5999
|
style: {
|
|
5977
6000
|
position: "absolute",
|
|
@@ -5992,7 +6015,7 @@ class Qi {
|
|
|
5992
6015
|
width: `${h}px`,
|
|
5993
6016
|
height: `${c}px`
|
|
5994
6017
|
},
|
|
5995
|
-
views: [f,
|
|
6018
|
+
views: [f, x, u]
|
|
5996
6019
|
};
|
|
5997
6020
|
}
|
|
5998
6021
|
}
|
|
@@ -6009,7 +6032,7 @@ class ts {
|
|
|
6009
6032
|
e.preventDefault();
|
|
6010
6033
|
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n, h] = s, { rowIndex: c, colIndex: d } = t;
|
|
6011
6034
|
c >= n && c <= h && d >= r && d <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
6012
|
-
const
|
|
6035
|
+
const x = {
|
|
6013
6036
|
getBoundingClientRect: () => ({
|
|
6014
6037
|
width: 0,
|
|
6015
6038
|
height: 0,
|
|
@@ -6022,11 +6045,11 @@ class ts {
|
|
|
6022
6045
|
}),
|
|
6023
6046
|
contextElement: document.body
|
|
6024
6047
|
};
|
|
6025
|
-
me(
|
|
6048
|
+
me(x, this.contextMenuEl, {
|
|
6026
6049
|
placement: "right-start",
|
|
6027
6050
|
middleware: [we(), pe(), ye()]
|
|
6028
|
-
}).then(({ x, y: p }) => {
|
|
6029
|
-
this.show(
|
|
6051
|
+
}).then(({ x: u, y: p }) => {
|
|
6052
|
+
this.show(u, p);
|
|
6030
6053
|
});
|
|
6031
6054
|
}), this.ctx.on("click", this.hide.bind(this)), this.ctx.on("onScroll", this.hide.bind(this)), this.ctx.on("resize", this.hide.bind(this));
|
|
6032
6055
|
}
|
|
@@ -6112,7 +6135,7 @@ class ss {
|
|
|
6112
6135
|
createContainer(t, e, i, s, r) {
|
|
6113
6136
|
t.className = "e-virt-table-container";
|
|
6114
6137
|
const o = document.createElement("div"), n = document.createElement("canvas"), h = e || document.createElement("div");
|
|
6115
|
-
o.className = "e-virt-table-stage", n.className = "e-virt-table-canvas", h.className = "e-virt-table-overlayer";
|
|
6138
|
+
o.className = "e-virt-table-stage", t.tabIndex = 0, n.className = "e-virt-table-canvas", h.className = "e-virt-table-overlayer";
|
|
6116
6139
|
const c = i || document.createElement("div");
|
|
6117
6140
|
c.className = "e-virt-table-editor";
|
|
6118
6141
|
const d = s, f = r;
|
|
@@ -6227,10 +6250,10 @@ class ss {
|
|
|
6227
6250
|
return this.ctx.database.hasValidationError();
|
|
6228
6251
|
}
|
|
6229
6252
|
scrollTo(t, e) {
|
|
6230
|
-
this.
|
|
6253
|
+
this.scroller.setScroll(t, e);
|
|
6231
6254
|
}
|
|
6232
6255
|
scrollXTo(t) {
|
|
6233
|
-
this.
|
|
6256
|
+
this.scroller.setScrollX(t);
|
|
6234
6257
|
}
|
|
6235
6258
|
scrollToColkey(t) {
|
|
6236
6259
|
this.scroller.scrollToColkey(t);
|
|
@@ -6245,7 +6268,7 @@ class ss {
|
|
|
6245
6268
|
this.scroller.scrollToRowIndex(t);
|
|
6246
6269
|
}
|
|
6247
6270
|
scrollYTo(t) {
|
|
6248
|
-
this.
|
|
6271
|
+
this.scroller.setScrollY(t);
|
|
6249
6272
|
}
|
|
6250
6273
|
setExpandRowKeys(t, e = !0) {
|
|
6251
6274
|
this.ctx.database.setExpandRowKeys(t, e);
|