e-virt-table 1.0.9 → 1.1.1
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 +407 -370
- 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 +1 -1
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Context.d.ts +2 -2
- package/dist/lib/Context.js +7 -4
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/Database.js +2 -0
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +3 -1
- package/dist/lib/EVirtTable.js +32 -0
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.d.ts +3 -1
- package/dist/lib/Editor.js +68 -51
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/EventBrowser.d.ts +0 -2
- package/dist/lib/EventBrowser.js +9 -13
- package/dist/lib/EventBrowser.js.map +1 -1
- package/dist/lib/EventTable.js +1 -1
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/Header.js +2 -2
- package/dist/lib/Header.js.map +1 -1
- package/dist/lib/Scroller.js +1 -1
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.js +5 -9
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/Tooltip.js +1 -1
- package/dist/lib/Tooltip.js.map +1 -1
- package/dist/lib/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -143,7 +143,7 @@ function Xt(a, t, e) {
|
|
|
143
143
|
}
|
|
144
144
|
r([]);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function Ae(a) {
|
|
147
147
|
var t = [];
|
|
148
148
|
return Object.keys(a).forEach(function(e) {
|
|
149
149
|
t.push.apply(t, a[e] || []);
|
|
@@ -157,33 +157,33 @@ var kt = /* @__PURE__ */ function(a) {
|
|
|
157
157
|
}
|
|
158
158
|
return t;
|
|
159
159
|
}(/* @__PURE__ */ Ct(Error));
|
|
160
|
-
function
|
|
160
|
+
function Te(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 ?
|
|
165
|
-
}, g =
|
|
164
|
+
return i(y), y.length ? u(new kt(y, bt(y))) : x(s);
|
|
165
|
+
}, g = Ae(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
|
-
function
|
|
186
|
+
function Le(a) {
|
|
187
187
|
return !!(a && a.message !== void 0);
|
|
188
188
|
}
|
|
189
189
|
function Me(a, t) {
|
|
@@ -197,7 +197,7 @@ function Me(a, t) {
|
|
|
197
197
|
function Nt(a, t) {
|
|
198
198
|
return function(e) {
|
|
199
199
|
var i;
|
|
200
|
-
return a.fullFields ? i = Me(t, a.fullFields) : i = t[e.field || a.fullField],
|
|
200
|
+
return a.fullFields ? i = Me(t, a.fullFields) : i = t[e.field || a.fullField], Le(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
|
|
@@ -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
|
|
573
|
+
return Te(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) {
|
|
@@ -583,27 +583,27 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
584
|
var S = Array.isArray(R) ? R : [R];
|
|
585
585
|
!h.suppressWarning && S.length && a.warning("async-validator:", S), S.length && y.message !== void 0 && (S = [].concat(y.message));
|
|
586
|
-
var
|
|
587
|
-
if (h.first &&
|
|
588
|
-
return p[y.field] = 1, w(
|
|
586
|
+
var A = S.map(Nt(y, n));
|
|
587
|
+
if (h.first && A.length)
|
|
588
|
+
return p[y.field] = 1, w(A);
|
|
589
589
|
if (!E)
|
|
590
|
-
w(
|
|
590
|
+
w(A);
|
|
591
591
|
else {
|
|
592
592
|
if (y.required && !g.value)
|
|
593
|
-
return y.message !== void 0 ?
|
|
593
|
+
return y.message !== void 0 ? A = [].concat(y.message).map(Nt(y, n)) : h.error && (A = [h.error(y, D(h.messages.required, y.field))]), w(A);
|
|
594
594
|
var I = {};
|
|
595
595
|
y.defaultField && Object.keys(g.value).map(function(O) {
|
|
596
596
|
I[O] = y.defaultField;
|
|
597
597
|
}), I = G({}, I, g.rule.fields);
|
|
598
598
|
var v = {};
|
|
599
599
|
Object.keys(I).forEach(function(O) {
|
|
600
|
-
var M = I[O],
|
|
601
|
-
v[O] =
|
|
600
|
+
var M = I[O], L = Array.isArray(M) ? M : [M];
|
|
601
|
+
v[O] = L.map(m.bind(null, O));
|
|
602
602
|
});
|
|
603
|
-
var
|
|
604
|
-
|
|
603
|
+
var T = new a(v);
|
|
604
|
+
T.messages(h.messages), g.rule.options && (g.rule.options.messages = h.messages, g.rule.options.error = h.error), T.validate(g.value, g.rule.options || h, function(O) {
|
|
605
605
|
var M = [];
|
|
606
|
-
|
|
606
|
+
A && A.length && M.push.apply(M, A), O && O.length && M.push.apply(M, O), w(M.length ? M : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
}
|
|
@@ -843,7 +843,7 @@ class se {
|
|
|
843
843
|
getRightFixedX() {
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
|
-
class
|
|
846
|
+
class Lt extends se {
|
|
847
847
|
constructor(e, i, s, r, o, n, h, c, d, f = "body") {
|
|
848
848
|
super(e, r, o, n, h, f, c.fixed);
|
|
849
849
|
l(this, "formatter");
|
|
@@ -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
|
});
|
|
@@ -1630,6 +1630,7 @@ class ni {
|
|
|
1630
1630
|
rowKey: d.rowKey,
|
|
1631
1631
|
key: d.key,
|
|
1632
1632
|
value: d.newValue,
|
|
1633
|
+
oldValue: d.oldValue,
|
|
1633
1634
|
row: f
|
|
1634
1635
|
};
|
|
1635
1636
|
});
|
|
@@ -1672,9 +1673,9 @@ class ni {
|
|
|
1672
1673
|
const d = this.originalDataMap.get(c);
|
|
1673
1674
|
let f = i;
|
|
1674
1675
|
if (o) {
|
|
1675
|
-
const { BEFORE_VALUE_CHANGE_METHOD:
|
|
1676
|
-
if (typeof
|
|
1677
|
-
const w = await
|
|
1676
|
+
const { BEFORE_VALUE_CHANGE_METHOD: x } = this.ctx.config;
|
|
1677
|
+
if (typeof x == "function") {
|
|
1678
|
+
const w = await x([
|
|
1678
1679
|
{
|
|
1679
1680
|
rowKey: t,
|
|
1680
1681
|
key: e,
|
|
@@ -1686,21 +1687,22 @@ class ni {
|
|
|
1686
1687
|
w && w.length && (f = w[0].value);
|
|
1687
1688
|
}
|
|
1688
1689
|
this.changedDataMap.set(c, f), n[e] = f;
|
|
1689
|
-
const
|
|
1690
|
+
const u = this.ctx.database.getRowDataItemForRowKey(t), p = {
|
|
1690
1691
|
rowKey: t,
|
|
1691
1692
|
key: e,
|
|
1693
|
+
oldValue: h,
|
|
1692
1694
|
value: f,
|
|
1693
|
-
row:
|
|
1695
|
+
row: u
|
|
1694
1696
|
};
|
|
1695
1697
|
this.getValidator(t, e).then(() => {
|
|
1696
1698
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1697
|
-
}), this.ctx.emit("change", [p], [
|
|
1699
|
+
}), this.ctx.emit("change", [p], [u]), this.ctx.emit("editChange", {
|
|
1698
1700
|
rowKey: t,
|
|
1699
1701
|
key: e,
|
|
1700
1702
|
oldValue: h,
|
|
1701
1703
|
value: f,
|
|
1702
1704
|
originalValue: d,
|
|
1703
|
-
row:
|
|
1705
|
+
row: u
|
|
1704
1706
|
});
|
|
1705
1707
|
} else
|
|
1706
1708
|
this.changedDataMap.set(c, f), n[e] = f;
|
|
@@ -1971,14 +1973,14 @@ class ni {
|
|
|
1971
1973
|
if (h) {
|
|
1972
1974
|
let c = {}, d = {};
|
|
1973
1975
|
if (d[e] = this.getItemValue(t, e), Array.isArray(h)) {
|
|
1974
|
-
const
|
|
1975
|
-
...
|
|
1976
|
+
const x = h.map((u) => ({
|
|
1977
|
+
...u,
|
|
1976
1978
|
row: s.item,
|
|
1977
1979
|
column: n,
|
|
1978
1980
|
rowIndex: s.rowIndex,
|
|
1979
1981
|
colIndex: r.colIndex
|
|
1980
1982
|
}));
|
|
1981
|
-
c[e] =
|
|
1983
|
+
c[e] = x;
|
|
1982
1984
|
} else
|
|
1983
1985
|
c[e] = {
|
|
1984
1986
|
...h,
|
|
@@ -1989,15 +1991,15 @@ class ni {
|
|
|
1989
1991
|
};
|
|
1990
1992
|
new nt(c).validate(d).then(() => {
|
|
1991
1993
|
this.clearValidationError(t, e), i([]);
|
|
1992
|
-
}).catch(({ errors:
|
|
1993
|
-
const
|
|
1994
|
+
}).catch(({ errors: x }) => {
|
|
1995
|
+
const u = x.map((p) => ({
|
|
1994
1996
|
...p,
|
|
1995
1997
|
column: n,
|
|
1996
1998
|
key: e,
|
|
1997
1999
|
row: s.item,
|
|
1998
2000
|
rowKey: t
|
|
1999
2001
|
}));
|
|
2000
|
-
this.setValidationError(t, e,
|
|
2002
|
+
this.setValidationError(t, e, u), i(u);
|
|
2001
2003
|
});
|
|
2002
2004
|
} else
|
|
2003
2005
|
i([]);
|
|
@@ -2023,19 +2025,19 @@ class ni {
|
|
|
2023
2025
|
relationColKeys: c,
|
|
2024
2026
|
rowspan: d,
|
|
2025
2027
|
height: f,
|
|
2026
|
-
width:
|
|
2027
|
-
colspan:
|
|
2028
|
+
width: x,
|
|
2029
|
+
colspan: u,
|
|
2028
2030
|
mergeRow: p,
|
|
2029
2031
|
mergeCol: g
|
|
2030
2032
|
} = t;
|
|
2031
|
-
if (d === 1 &&
|
|
2033
|
+
if (d === 1 && u === 1)
|
|
2032
2034
|
return {
|
|
2033
2035
|
xArr: [n, n],
|
|
2034
2036
|
yArr: [e, e],
|
|
2035
2037
|
rowspan: d,
|
|
2036
|
-
colspan:
|
|
2038
|
+
colspan: u,
|
|
2037
2039
|
height: f,
|
|
2038
|
-
width:
|
|
2040
|
+
width: x,
|
|
2039
2041
|
offsetTop: 0,
|
|
2040
2042
|
offsetLeft: 0,
|
|
2041
2043
|
dataList: [
|
|
@@ -2047,16 +2049,16 @@ class ni {
|
|
|
2047
2049
|
}
|
|
2048
2050
|
]
|
|
2049
2051
|
};
|
|
2050
|
-
let w = e, y = e, E = n, m = n, C = [], b = 0, R = 0, S = 0,
|
|
2052
|
+
let w = e, y = e, E = n, m = n, C = [], b = 0, R = 0, S = 0, A = 0;
|
|
2051
2053
|
if (d !== 1 && p) {
|
|
2052
|
-
|
|
2053
|
-
const I = h.reduce((v,
|
|
2054
|
-
const O = this.getItemValue(s,
|
|
2054
|
+
A = x;
|
|
2055
|
+
const I = h.reduce((v, T) => {
|
|
2056
|
+
const O = this.getItemValue(s, T) ?? "";
|
|
2055
2057
|
return `${v}${O}`;
|
|
2056
2058
|
}, "");
|
|
2057
2059
|
for (let v = e - 1; v >= 0; v--) {
|
|
2058
|
-
const
|
|
2059
|
-
const N = this.getItemValue(
|
|
2060
|
+
const T = this.rowIndexRowKeyMap.get(v) || "", O = h.reduce((M, L) => {
|
|
2061
|
+
const N = this.getItemValue(T, L) ?? "";
|
|
2060
2062
|
return `${M}${N}`;
|
|
2061
2063
|
}, "");
|
|
2062
2064
|
if (I === O)
|
|
@@ -2065,8 +2067,8 @@ class ni {
|
|
|
2065
2067
|
break;
|
|
2066
2068
|
}
|
|
2067
2069
|
for (let v = e; v <= this.ctx.maxRowIndex; v++) {
|
|
2068
|
-
const
|
|
2069
|
-
const N = this.getItemValue(
|
|
2070
|
+
const T = this.rowIndexRowKeyMap.get(v) || "", O = h.reduce((M, L) => {
|
|
2071
|
+
const N = this.getItemValue(T, L) ?? "";
|
|
2070
2072
|
return `${M}${N}`;
|
|
2071
2073
|
}, "");
|
|
2072
2074
|
if (I === O)
|
|
@@ -2075,29 +2077,29 @@ class ni {
|
|
|
2075
2077
|
break;
|
|
2076
2078
|
}
|
|
2077
2079
|
for (let v = w; v < e; v++) {
|
|
2078
|
-
const { height:
|
|
2079
|
-
b +=
|
|
2080
|
+
const { height: T } = this.positions[v];
|
|
2081
|
+
b += T;
|
|
2080
2082
|
}
|
|
2081
2083
|
for (let v = w; v <= y; v++) {
|
|
2082
|
-
const { height:
|
|
2083
|
-
S +=
|
|
2084
|
-
const O = this.rowIndexRowKeyMap.get(v) || "", { item: M } = this.rowKeyMap.get(O),
|
|
2084
|
+
const { height: T } = this.positions[v];
|
|
2085
|
+
S += T;
|
|
2086
|
+
const O = this.rowIndexRowKeyMap.get(v) || "", { item: M } = this.rowKeyMap.get(O), L = this.getItemValue(O, i);
|
|
2085
2087
|
C.push({
|
|
2086
2088
|
rowKey: O,
|
|
2087
2089
|
key: i,
|
|
2088
|
-
value:
|
|
2090
|
+
value: L,
|
|
2089
2091
|
row: M
|
|
2090
2092
|
});
|
|
2091
2093
|
}
|
|
2092
2094
|
}
|
|
2093
|
-
if (
|
|
2095
|
+
if (u !== 1 && g) {
|
|
2094
2096
|
S = f;
|
|
2095
2097
|
for (let I = n - 1; I >= 0; I--) {
|
|
2096
2098
|
const v = this.getColumnByColIndex(I);
|
|
2097
2099
|
if (!v)
|
|
2098
2100
|
break;
|
|
2099
|
-
const
|
|
2100
|
-
if (
|
|
2101
|
+
const T = this.getItemValue(s, i), O = this.getItemValue(s, v.key);
|
|
2102
|
+
if (T === O && c.includes(v.key))
|
|
2101
2103
|
E = I;
|
|
2102
2104
|
else
|
|
2103
2105
|
break;
|
|
@@ -2106,8 +2108,8 @@ class ni {
|
|
|
2106
2108
|
const v = this.getColumnByColIndex(I);
|
|
2107
2109
|
if (!v)
|
|
2108
2110
|
break;
|
|
2109
|
-
const
|
|
2110
|
-
if (
|
|
2111
|
+
const T = this.getItemValue(s, i), O = this.getItemValue(s, v.key);
|
|
2112
|
+
if (T === O && c.includes(v.key))
|
|
2111
2113
|
m = I;
|
|
2112
2114
|
else
|
|
2113
2115
|
break;
|
|
@@ -2122,7 +2124,7 @@ class ni {
|
|
|
2122
2124
|
const v = this.getColumnByColIndex(I);
|
|
2123
2125
|
if (!v)
|
|
2124
2126
|
break;
|
|
2125
|
-
|
|
2127
|
+
A += v.width || 100, C.push({
|
|
2126
2128
|
rowKey: s,
|
|
2127
2129
|
key: v.key,
|
|
2128
2130
|
value: this.getItemValue(s, v.key),
|
|
@@ -2134,9 +2136,9 @@ class ni {
|
|
|
2134
2136
|
xArr: [E, m],
|
|
2135
2137
|
yArr: [w, y],
|
|
2136
2138
|
rowspan: d,
|
|
2137
|
-
colspan:
|
|
2139
|
+
colspan: u,
|
|
2138
2140
|
height: S,
|
|
2139
|
-
width:
|
|
2141
|
+
width: A,
|
|
2140
2142
|
offsetTop: b,
|
|
2141
2143
|
offsetLeft: R,
|
|
2142
2144
|
dataList: C
|
|
@@ -2171,7 +2173,7 @@ class ni {
|
|
|
2171
2173
|
// 获取虚拟单元格
|
|
2172
2174
|
getVirtualBodyCell(t, e) {
|
|
2173
2175
|
const i = this.getColumnByColIndex(e), s = this.getRowForRowIndex(t);
|
|
2174
|
-
return !i || !s ? void 0 : new
|
|
2176
|
+
return !i || !s ? void 0 : new Lt(this.ctx, t, e, 0, 0, 0, 0, i, s, "body");
|
|
2175
2177
|
}
|
|
2176
2178
|
hasMergeCell(t, e) {
|
|
2177
2179
|
let i = !1;
|
|
@@ -2248,7 +2250,9 @@ class li {
|
|
|
2248
2250
|
this.ctx = t, this.init();
|
|
2249
2251
|
}
|
|
2250
2252
|
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(
|
|
2253
|
+
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(window, "mousedown", (t) => {
|
|
2254
|
+
this.ctx.containerElement.contains(t.target) || this.ctx.emit("outsideMousedown", t);
|
|
2255
|
+
}), 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));
|
|
2252
2256
|
}
|
|
2253
2257
|
destroy() {
|
|
2254
2258
|
this.eventTasks.forEach((t, e) => {
|
|
@@ -2272,7 +2276,7 @@ class li {
|
|
|
2272
2276
|
}
|
|
2273
2277
|
handleKeydown(t) {
|
|
2274
2278
|
const { ENABLE_KEYBOARD: e } = this.ctx.config;
|
|
2275
|
-
e && this.ctx.isTarget() && this.ctx.emit("keydown", t);
|
|
2279
|
+
e && this.ctx.isTarget(t) && this.ctx.emit("keydown", t);
|
|
2276
2280
|
}
|
|
2277
2281
|
handleWheel(t) {
|
|
2278
2282
|
this.ctx.emit("wheel", t);
|
|
@@ -2290,20 +2294,14 @@ class li {
|
|
|
2290
2294
|
this.ctx.emit("contextMenu", t);
|
|
2291
2295
|
}
|
|
2292
2296
|
handleMouseover(t) {
|
|
2293
|
-
this.ctx.
|
|
2297
|
+
this.ctx.isMouseoverTargetContainer = !0, this.ctx.emit("mouseover", t);
|
|
2294
2298
|
}
|
|
2295
2299
|
handleMouseout(t) {
|
|
2296
|
-
this.ctx.emit("mouseout", t);
|
|
2300
|
+
this.ctx.isMouseoverTargetContainer = !1, this.ctx.emit("mouseout", t);
|
|
2297
2301
|
}
|
|
2298
2302
|
handleDblclick(t) {
|
|
2299
2303
|
this.ctx.emit("dblclick", t);
|
|
2300
2304
|
}
|
|
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
|
-
}
|
|
2307
2305
|
bind(t, e, i, s) {
|
|
2308
2306
|
t.addEventListener(e, i, s), this.eventTasks.set(e, i);
|
|
2309
2307
|
}
|
|
@@ -2424,8 +2422,8 @@ class ci {
|
|
|
2424
2422
|
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)
|
|
2425
2423
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
2426
2424
|
else {
|
|
2427
|
-
const [c, d, f,
|
|
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 -
|
|
2425
|
+
const [c, d, f, x] = typeof h == "number" ? [h, h, h, h] : h;
|
|
2426
|
+
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);
|
|
2429
2427
|
}
|
|
2430
2428
|
n !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
2431
2429
|
}
|
|
@@ -2449,12 +2447,12 @@ class ci {
|
|
|
2449
2447
|
verticalAlign: f = "middle"
|
|
2450
2448
|
} = o;
|
|
2451
2449
|
this.ctx.font = n, this.ctx.fillStyle = c, this.ctx.textBaseline = f, this.ctx.textAlign = h;
|
|
2452
|
-
let u = 0;
|
|
2453
|
-
f === "top" ? u = i + d : f === "bottom" ? u = i + r - d : u = i + (r + 1) / 2;
|
|
2454
2450
|
let x = 0;
|
|
2455
|
-
|
|
2451
|
+
f === "top" ? x = i + d : f === "bottom" ? x = i + r - d : x = i + (r + 1) / 2;
|
|
2452
|
+
let u = 0;
|
|
2453
|
+
h === "left" ? u = e + d : h === "right" ? u = e + s - d : u = e + s / 2;
|
|
2456
2454
|
const { _text: p, ellipsis: g } = this.handleEllipsis(t, s, d, n);
|
|
2457
|
-
return this.ctx.fillText(p,
|
|
2455
|
+
return this.ctx.fillText(p, u, x), this.ctx.restore(), g;
|
|
2458
2456
|
}
|
|
2459
2457
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
2460
2458
|
let r = !1, o = t;
|
|
@@ -2832,8 +2830,8 @@ class re extends se {
|
|
|
2832
2830
|
const { width: e, height: i, type: s } = this;
|
|
2833
2831
|
if (["index-selection", "selection"].includes(s)) {
|
|
2834
2832
|
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;
|
|
2835
|
-
let f = this.ctx.icons.get("checkbox-uncheck"),
|
|
2836
|
-
r ? (f = this.ctx.icons.get("checkbox-indeterminate"),
|
|
2833
|
+
let f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2834
|
+
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(
|
|
2837
2835
|
this.drawImageSource,
|
|
2838
2836
|
this.drawImageX,
|
|
2839
2837
|
this.drawImageY,
|
|
@@ -2974,11 +2972,11 @@ class fi {
|
|
|
2974
2972
|
*/
|
|
2975
2973
|
imageEnterAndLeave(t, e) {
|
|
2976
2974
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s;
|
|
2977
|
-
o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight ? (this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof
|
|
2975
|
+
o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight ? (this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof Lt && ["selection", "index-selection"].includes(t.type) && (this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.stageElement.style.cursor = "not-allowed"))) : (this.ctx.isPointer = !1, this.ctx.stageElement.style.cursor === "pointer" && (this.ctx.stageElement.style.cursor = "default"));
|
|
2978
2976
|
}
|
|
2979
2977
|
isBusy(t) {
|
|
2980
2978
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, r = i;
|
|
2981
|
-
if (!this.ctx.isTarget() || this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize" || this.ctx.columnResizing || this.ctx.rowResizing)
|
|
2979
|
+
if (!this.ctx.isTarget(t) || this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize" || this.ctx.columnResizing || this.ctx.rowResizing)
|
|
2982
2980
|
return !0;
|
|
2983
2981
|
const { SCROLLER_TRACK_SIZE: o } = this.ctx.config;
|
|
2984
2982
|
return !!(this.ctx.scrollerMove || this.ctx.scrollerFocus || s > this.ctx.stageHeight - o || r > this.ctx.stageWidth - o);
|
|
@@ -3033,7 +3031,7 @@ class xi {
|
|
|
3033
3031
|
l(this, "stageHeight", 0);
|
|
3034
3032
|
l(this, "paint");
|
|
3035
3033
|
l(this, "icons");
|
|
3036
|
-
l(this, "
|
|
3034
|
+
l(this, "isMouseoverTargetContainer", !1);
|
|
3037
3035
|
l(this, "mousedown", !1);
|
|
3038
3036
|
l(this, "isPointer", !1);
|
|
3039
3037
|
l(this, "rowResizing", !1);
|
|
@@ -3167,7 +3165,7 @@ class xi {
|
|
|
3167
3165
|
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));
|
|
3168
3166
|
}
|
|
3169
3167
|
clearSelector() {
|
|
3170
|
-
this.selector.enable = !1, this.selector.xArr = [-1, -1], this.selector.yArr = [-1, -1];
|
|
3168
|
+
this.selector.enable = !1, this.selector.xArr = [-1, -1], this.selector.yArr = [-1, -1], this.emit("clearSelector");
|
|
3171
3169
|
}
|
|
3172
3170
|
clearSelectorCopy() {
|
|
3173
3171
|
this.selector.xArrCopy = [-1, -1], this.selector.yArrCopy = [-1, -1];
|
|
@@ -3219,8 +3217,8 @@ class xi {
|
|
|
3219
3217
|
const s = this.body.height - this.body.visibleHeight + i;
|
|
3220
3218
|
e < 0 ? e = 0 : e > s && (e = s), this.emit("setScrollY", e);
|
|
3221
3219
|
}
|
|
3222
|
-
isTarget() {
|
|
3223
|
-
return this.
|
|
3220
|
+
isTarget(t) {
|
|
3221
|
+
return !!this.containerElement.contains(t.target);
|
|
3224
3222
|
}
|
|
3225
3223
|
getOffset(t) {
|
|
3226
3224
|
const { left: e, top: i } = this.containerElement.getBoundingClientRect();
|
|
@@ -3288,7 +3286,7 @@ class Pt {
|
|
|
3288
3286
|
this.clientX = i, this.clientY = e, this.dragStart = this.scroll;
|
|
3289
3287
|
}
|
|
3290
3288
|
onMouseDown(t) {
|
|
3291
|
-
if (!(t.target instanceof Element) || !this.ctx.isTarget())
|
|
3289
|
+
if (!(t.target instanceof Element) || !this.ctx.isTarget(t))
|
|
3292
3290
|
return;
|
|
3293
3291
|
if (this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize")
|
|
3294
3292
|
return !0;
|
|
@@ -3341,11 +3339,11 @@ class Pt {
|
|
|
3341
3339
|
stageHeight: i,
|
|
3342
3340
|
stageWidth: s,
|
|
3343
3341
|
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
3344
|
-
} = this.ctx, n = s, h = i, c = e.height, d = e.width, f = t.height,
|
|
3342
|
+
} = this.ctx, n = s, h = i, c = e.height, d = e.width, f = t.height, x = this.ctx.footer.height;
|
|
3345
3343
|
if (this.type === "vertical") {
|
|
3346
|
-
this.visibleDistance = h - r - c, this.distance = f - this.visibleDistance +
|
|
3347
|
-
const
|
|
3348
|
-
let p = Math.floor(
|
|
3344
|
+
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;
|
|
3345
|
+
const u = this.distance ? this.visibleDistance / (f + x) : 0;
|
|
3346
|
+
let p = Math.floor(u * this.visibleDistance);
|
|
3349
3347
|
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));
|
|
3350
3348
|
} else {
|
|
3351
3349
|
this.visibleDistance = n - r, this.distance = d - this.visibleDistance, this.splitPoints = [
|
|
@@ -3354,8 +3352,8 @@ class Pt {
|
|
|
3354
3352
|
n - r,
|
|
3355
3353
|
h
|
|
3356
3354
|
], this.trackX = 0, this.trackY = h - r, this.trackWidth = n, this.trackHeight = r;
|
|
3357
|
-
const
|
|
3358
|
-
let p = Math.floor(
|
|
3355
|
+
const u = this.distance ? this.visibleDistance / d : 0;
|
|
3356
|
+
let p = Math.floor(u * this.visibleDistance);
|
|
3359
3357
|
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));
|
|
3360
3358
|
}
|
|
3361
3359
|
}
|
|
@@ -3489,7 +3487,7 @@ class gi {
|
|
|
3489
3487
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3490
3488
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3491
3489
|
const s = Qt(i), r = It(i);
|
|
3492
|
-
this.height = t * s, this.width = r.reduce((f,
|
|
3490
|
+
this.height = t * s, this.width = r.reduce((f, x) => f + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
3493
3491
|
const o = ti(te(i, s));
|
|
3494
3492
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3495
3493
|
const n = this.ctx.containerElement.getBoundingClientRect();
|
|
@@ -3500,9 +3498,9 @@ class gi {
|
|
|
3500
3498
|
this.resizeAllColumn(f);
|
|
3501
3499
|
}
|
|
3502
3500
|
const c = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
|
|
3503
|
-
this.ctx.fixedLeftWidth = c.reduce((f,
|
|
3501
|
+
this.ctx.fixedLeftWidth = c.reduce((f, x) => f + x.width, 0);
|
|
3504
3502
|
const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
|
|
3505
|
-
this.ctx.fixedRightWidth = d.reduce((f,
|
|
3503
|
+
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;
|
|
3506
3504
|
}
|
|
3507
3505
|
// 调整表头的宽度
|
|
3508
3506
|
initResizeColumn() {
|
|
@@ -3510,7 +3508,7 @@ class gi {
|
|
|
3510
3508
|
config: { ENABLE_RESIZE_COLUMN: t }
|
|
3511
3509
|
} = this.ctx;
|
|
3512
3510
|
t && (this.ctx.on("mousedown", (e) => {
|
|
3513
|
-
this.ctx.isTarget() && (this.clientX = e.clientX, this.resizeTarget ? (this.isResizing = !0, this.ctx.columnResizing = !0) : this.isResizing = !1, this.isMouseDown = !0);
|
|
3511
|
+
this.ctx.isTarget(e) && (this.clientX = e.clientX, this.resizeTarget ? (this.isResizing = !0, this.ctx.columnResizing = !0) : this.isResizing = !1, this.isMouseDown = !0);
|
|
3514
3512
|
}), this.ctx.on("mouseup", () => {
|
|
3515
3513
|
this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeColumn(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.isResizing = !1, this.ctx.columnResizing = !1, this.clientX = 0;
|
|
3516
3514
|
}), this.ctx.on("mousemove", (e) => {
|
|
@@ -3531,7 +3529,7 @@ class gi {
|
|
|
3531
3529
|
for (const o of r) {
|
|
3532
3530
|
const { offsetX: n, offsetY: h } = this.ctx.getOffset(e), c = n, d = o.getDrawX();
|
|
3533
3531
|
c > d + o.width - 5 && c < d + o.width + 4 && c < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3534
|
-
o.colspan <= 1 && this.ctx.isTarget() && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3532
|
+
o.colspan <= 1 && this.ctx.isTarget(e) && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3535
3533
|
}
|
|
3536
3534
|
}
|
|
3537
3535
|
}));
|
|
@@ -3587,7 +3585,7 @@ class gi {
|
|
|
3587
3585
|
for (let o = 0; o < i; o++) {
|
|
3588
3586
|
const n = t[o], h = r * (n.rowspan || 0), c = r * (n.level || 0);
|
|
3589
3587
|
let d = n.width || 100;
|
|
3590
|
-
n.children && (d = It(n.children).reduce((
|
|
3588
|
+
n.children && (d = It(n.children).reduce((u, p) => u + ((p == null ? void 0 : p.width) || 100), 0));
|
|
3591
3589
|
const f = new re(this.ctx, this.columnIndex, s, c, d, h, n);
|
|
3592
3590
|
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;
|
|
3593
3591
|
}
|
|
@@ -3667,7 +3665,7 @@ class oe {
|
|
|
3667
3665
|
update() {
|
|
3668
3666
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3669
3667
|
t.renderLeafCellHeaders.forEach((r) => {
|
|
3670
|
-
const o = new
|
|
3668
|
+
const o = new Lt(
|
|
3671
3669
|
this.ctx,
|
|
3672
3670
|
this.rowIndex,
|
|
3673
3671
|
r.colIndex,
|
|
@@ -3740,14 +3738,14 @@ class wi {
|
|
|
3740
3738
|
MAX_HEIGHT: c = 0,
|
|
3741
3739
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3742
3740
|
OFFSET_HEIGHT: f = 0,
|
|
3743
|
-
FOOTER_POSITION:
|
|
3741
|
+
FOOTER_POSITION: x
|
|
3744
3742
|
}
|
|
3745
3743
|
} = this.ctx;
|
|
3746
3744
|
if (!e.width)
|
|
3747
3745
|
return;
|
|
3748
|
-
this.x = 0,
|
|
3749
|
-
const { data:
|
|
3750
|
-
this.height = p, this.data =
|
|
3746
|
+
this.x = 0, x === "top" && r ? this.y = e.height + i.height : this.y = e.height;
|
|
3747
|
+
const { data: u, sumHeight: p } = s.getData();
|
|
3748
|
+
this.height = p, this.data = u;
|
|
3751
3749
|
const { top: g } = t.getBoundingClientRect();
|
|
3752
3750
|
this.width = e.width, this.visibleWidth = this.ctx.stageWidth - o;
|
|
3753
3751
|
const w = this.ctx.footer.height;
|
|
@@ -3769,7 +3767,7 @@ class wi {
|
|
|
3769
3767
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3770
3768
|
))) : 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`);
|
|
3771
3769
|
let C = this.ctx.stageHeight - e.height - o;
|
|
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 =
|
|
3770
|
+
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;
|
|
3773
3771
|
const b = window.devicePixelRatio || 1, R = this.ctx.stageWidth * b, S = this.ctx.stageHeight * b;
|
|
3774
3772
|
t.width = Math.floor(R), t.height = Math.floor(S), this.ctx.canvasElement.setAttribute(
|
|
3775
3773
|
"style",
|
|
@@ -3786,7 +3784,7 @@ class wi {
|
|
|
3786
3784
|
this.ctx.rowResizing = !1;
|
|
3787
3785
|
}, 0), this.clientY = 0;
|
|
3788
3786
|
}), this.ctx.on("mousedown", (e) => {
|
|
3789
|
-
this.ctx.isTarget() && (this.clientY = e.clientY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : (this.isResizing = !1, this.ctx.rowResizing = !1), this.isMouseDown = !0);
|
|
3787
|
+
this.ctx.isTarget(e) && (this.clientY = e.clientY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : (this.isResizing = !1, this.ctx.rowResizing = !1), this.isMouseDown = !0);
|
|
3790
3788
|
}), this.ctx.on("mousemove", (e) => {
|
|
3791
3789
|
if (this.ctx.editing) return;
|
|
3792
3790
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s, n = e.clientY, {
|
|
@@ -3796,18 +3794,18 @@ class wi {
|
|
|
3796
3794
|
} = this.ctx;
|
|
3797
3795
|
if (this.isResizing && this.resizeTarget) {
|
|
3798
3796
|
const f = this.resizeTarget.height;
|
|
3799
|
-
let
|
|
3800
|
-
|
|
3797
|
+
let x = n - this.clientY;
|
|
3798
|
+
x + f < d && (x = -(f - d)), this.resizeDiff = x, this.ctx.emit("draw");
|
|
3801
3799
|
} else {
|
|
3802
3800
|
if (this.resizeTarget = null, this.isMouseDown || this.ctx.stageElement.style.cursor === "crosshair")
|
|
3803
3801
|
return;
|
|
3804
3802
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3805
3803
|
for (let f = 0; f < this.renderRows.length; f++) {
|
|
3806
|
-
const
|
|
3807
|
-
if (r >
|
|
3808
|
-
for (let p = 0; p <
|
|
3809
|
-
const g =
|
|
3810
|
-
o > g.drawX + 10 && o < g.drawX + g.width - 10 && g.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget =
|
|
3804
|
+
const x = this.renderRows[f];
|
|
3805
|
+
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r < h - 4)
|
|
3806
|
+
for (let p = 0; p < x.cells.length; p++) {
|
|
3807
|
+
const g = x.cells[p];
|
|
3808
|
+
o > g.drawX + 10 && o < g.drawX + g.width - 10 && g.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
3811
3809
|
}
|
|
3812
3810
|
}
|
|
3813
3811
|
}
|
|
@@ -3890,7 +3888,7 @@ class wi {
|
|
|
3890
3888
|
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
3889
|
const d = [];
|
|
3892
3890
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3893
|
-
const
|
|
3891
|
+
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
3892
|
d.push(w);
|
|
3895
3893
|
}
|
|
3896
3894
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
@@ -3985,14 +3983,12 @@ class yi {
|
|
|
3985
3983
|
this.ctx = t, this.init();
|
|
3986
3984
|
}
|
|
3987
3985
|
init() {
|
|
3988
|
-
this.ctx.on("
|
|
3989
|
-
this.ctx.clearSelector(), this.ctx.emit("draw");
|
|
3990
|
-
}), this.ctx.on("setMoveFocus", (t) => {
|
|
3986
|
+
this.ctx.on("setMoveFocus", (t) => {
|
|
3991
3987
|
this.moveFocus(t);
|
|
3992
3988
|
}), this.ctx.on(
|
|
3993
3989
|
"mousemove",
|
|
3994
3990
|
Jt((t) => {
|
|
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;
|
|
3991
|
+
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget(t) && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
|
|
3996
3992
|
(this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
|
|
3997
3993
|
}, 100)
|
|
3998
3994
|
), this.ctx.on("cellHoverChange", (t) => {
|
|
@@ -4004,7 +4000,7 @@ class yi {
|
|
|
4004
4000
|
this.isMultipleRow || this.mouseenter();
|
|
4005
4001
|
}
|
|
4006
4002
|
}), this.ctx.on("cellMousedown", (t, e) => {
|
|
4007
|
-
if (this.ctx.isTarget() && this.ctx.stageElement.style.cursor !== "pointer" && !this.ctx.isPointer && this.ctx.stageElement.style.cursor !== "crosshair") {
|
|
4003
|
+
if (this.ctx.isTarget(e) && this.ctx.stageElement.style.cursor !== "pointer" && !this.ctx.isPointer && this.ctx.stageElement.style.cursor !== "crosshair") {
|
|
4008
4004
|
if (t.operation) {
|
|
4009
4005
|
this.isMultipleRow = !0, this.selectRows(t);
|
|
4010
4006
|
return;
|
|
@@ -4038,7 +4034,7 @@ class yi {
|
|
|
4038
4034
|
t.preventDefault(), this.moveFocus("LEFT");
|
|
4039
4035
|
return;
|
|
4040
4036
|
}
|
|
4041
|
-
if (t.code === "ArrowUp") {
|
|
4037
|
+
if (t.code === "ArrowUp" || t.shiftKey && t.code === "Enter") {
|
|
4042
4038
|
t.preventDefault(), this.moveFocus("TOP");
|
|
4043
4039
|
return;
|
|
4044
4040
|
}
|
|
@@ -4046,7 +4042,7 @@ class yi {
|
|
|
4046
4042
|
t.preventDefault(), this.moveFocus("RIGHT");
|
|
4047
4043
|
return;
|
|
4048
4044
|
}
|
|
4049
|
-
if (t.code === "ArrowDown" || t.code === "Enter") {
|
|
4045
|
+
if (t.code === "ArrowDown" || !t.shiftKey && t.code === "Enter") {
|
|
4050
4046
|
t.preventDefault(), this.moveFocus("BOTTOM");
|
|
4051
4047
|
return;
|
|
4052
4048
|
}
|
|
@@ -4091,16 +4087,16 @@ class yi {
|
|
|
4091
4087
|
SELECTOR_AREA_MIN_Y: c,
|
|
4092
4088
|
SELECTOR_AREA_MAX_Y: d,
|
|
4093
4089
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
4094
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4095
|
-
} = this.ctx.config,
|
|
4090
|
+
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
4091
|
+
} = this.ctx.config, u = n, p = h || this.ctx.maxColIndex - f, g = c, w = d || this.ctx.maxRowIndex - x;
|
|
4096
4092
|
let [y, E] = r, [m, C] = o;
|
|
4097
|
-
if (y <
|
|
4093
|
+
if (y < u || E > p || m < g || C > w)
|
|
4098
4094
|
return;
|
|
4099
4095
|
if (this.ctx.stageElement.focus(), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
4100
4096
|
const R = this.adjustMergeCells(r, o);
|
|
4101
4097
|
m = R.yArr[0], C = R.yArr[1], y = R.xArr[0], E = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
|
|
4102
4098
|
}
|
|
4103
|
-
y === E && m === C ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, r = [Math.max(
|
|
4099
|
+
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)];
|
|
4104
4100
|
const { BEFORE_SET_SELECTOR_METHOD: b } = this.ctx.config;
|
|
4105
4101
|
if (typeof b == "function") {
|
|
4106
4102
|
const S = b({
|
|
@@ -4142,16 +4138,16 @@ class yi {
|
|
|
4142
4138
|
minX: r,
|
|
4143
4139
|
maxX: o
|
|
4144
4140
|
}
|
|
4145
|
-
), f = [d.minX, d.maxX],
|
|
4146
|
-
let
|
|
4141
|
+
), f = [d.minX, d.maxX], x = [c.minY, c.maxY];
|
|
4142
|
+
let u = !1;
|
|
4147
4143
|
if (d.minX !== d.maxX || c.minY !== c.maxY) {
|
|
4148
|
-
const g = JSON.stringify(f) + JSON.stringify(
|
|
4149
|
-
|
|
4144
|
+
const g = JSON.stringify(f) + JSON.stringify(x), w = (p = this.ctx.focusCell) == null ? void 0 : p.getSpanInfo();
|
|
4145
|
+
u = (w && JSON.stringify(w.xArr) + JSON.stringify(w.yArr)) === g;
|
|
4150
4146
|
}
|
|
4151
4147
|
return {
|
|
4152
4148
|
xArr: f,
|
|
4153
|
-
yArr:
|
|
4154
|
-
onlyMergeCell:
|
|
4149
|
+
yArr: x,
|
|
4150
|
+
onlyMergeCell: u
|
|
4155
4151
|
};
|
|
4156
4152
|
}
|
|
4157
4153
|
selectCols(t) {
|
|
@@ -4188,8 +4184,8 @@ class yi {
|
|
|
4188
4184
|
SELECTOR_AREA_MAX_Y: o,
|
|
4189
4185
|
SELECTOR_AREA_MAX_X_OFFSET: n,
|
|
4190
4186
|
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
4191
|
-
} = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r,
|
|
4192
|
-
this.setSelector(
|
|
4187
|
+
} = 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];
|
|
4188
|
+
this.setSelector(u, p);
|
|
4193
4189
|
}
|
|
4194
4190
|
}
|
|
4195
4191
|
selectRows(t, e = !0) {
|
|
@@ -4225,8 +4221,8 @@ class yi {
|
|
|
4225
4221
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
4226
4222
|
if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
|
|
4227
4223
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
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),
|
|
4229
|
-
this.setSelector(
|
|
4224
|
+
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];
|
|
4225
|
+
this.setSelector(x, u);
|
|
4230
4226
|
} else {
|
|
4231
4227
|
this.ctx.emit("cellSelectedClick", e);
|
|
4232
4228
|
const s = [e.colIndex, e.colIndex], r = [e.rowIndex, e.rowIndex];
|
|
@@ -4294,10 +4290,10 @@ class yi {
|
|
|
4294
4290
|
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4295
4291
|
const c = n + e[0], d = h + t[0], f = this.ctx.database.getItemValueForRowIndexAndColIndex(c, d);
|
|
4296
4292
|
if (f) {
|
|
4297
|
-
const { rowKey:
|
|
4298
|
-
this.ctx.database.getReadonly(
|
|
4299
|
-
rowKey:
|
|
4300
|
-
key:
|
|
4293
|
+
const { rowKey: x, key: u } = f;
|
|
4294
|
+
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
4295
|
+
rowKey: x,
|
|
4296
|
+
key: u,
|
|
4301
4297
|
value: null,
|
|
4302
4298
|
row: {}
|
|
4303
4299
|
//内部有设置
|
|
@@ -4326,18 +4322,18 @@ class yi {
|
|
|
4326
4322
|
let o = ii(r);
|
|
4327
4323
|
const n = [i, i + o[0].length - 1], h = [e, e + o.length - 1], c = o.length === 1 && o[0].length === 1;
|
|
4328
4324
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
|
|
4329
|
-
const
|
|
4325
|
+
const u = {
|
|
4330
4326
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4331
4327
|
message: "Merged cells cannot span paste data"
|
|
4332
4328
|
};
|
|
4333
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4329
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", u) : alert(u.message);
|
|
4334
4330
|
return;
|
|
4335
4331
|
}
|
|
4336
4332
|
let d = [];
|
|
4337
|
-
for (let
|
|
4338
|
-
const p = o[
|
|
4333
|
+
for (let u = 0; u <= o.length - 1; u++) {
|
|
4334
|
+
const p = o[u].length;
|
|
4339
4335
|
for (let g = 0; g <= p - 1; g++) {
|
|
4340
|
-
const w =
|
|
4336
|
+
const w = u + e, y = g + i, E = o[u][g], m = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4341
4337
|
w,
|
|
4342
4338
|
y
|
|
4343
4339
|
);
|
|
@@ -4354,13 +4350,13 @@ class yi {
|
|
|
4354
4350
|
}
|
|
4355
4351
|
}
|
|
4356
4352
|
if (this.isCut) {
|
|
4357
|
-
const
|
|
4353
|
+
const u = this.clearSelectedData(
|
|
4358
4354
|
this.ctx.selector.xArrCopy,
|
|
4359
4355
|
this.ctx.selector.yArrCopy,
|
|
4360
4356
|
!0
|
|
4361
4357
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4362
4358
|
), p = d.map((g) => `${g.rowKey}-${g.key}`);
|
|
4363
|
-
|
|
4359
|
+
u.forEach((g) => {
|
|
4364
4360
|
p.includes(`${g.rowKey}-${g.key}`) || d.unshift(g);
|
|
4365
4361
|
}), this.isCut = !1;
|
|
4366
4362
|
}
|
|
@@ -4368,21 +4364,21 @@ class yi {
|
|
|
4368
4364
|
return;
|
|
4369
4365
|
const { BEFORE_PASTE_DATA_METHOD: f } = this.ctx.config;
|
|
4370
4366
|
if (typeof f == "function") {
|
|
4371
|
-
const
|
|
4367
|
+
const u = f, p = d.map((g) => ({
|
|
4372
4368
|
rowKey: g.rowKey,
|
|
4373
4369
|
key: g.key,
|
|
4374
4370
|
value: g.value,
|
|
4375
4371
|
oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
|
|
4376
4372
|
row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
|
|
4377
4373
|
}));
|
|
4378
|
-
if (d = await
|
|
4374
|
+
if (d = await u(p, n, h), d && !d.length)
|
|
4379
4375
|
return;
|
|
4380
4376
|
}
|
|
4381
4377
|
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4382
|
-
let
|
|
4383
|
-
s.forEach((
|
|
4384
|
-
|
|
4385
|
-
}), this.ctx.emit("pasteChange", d,
|
|
4378
|
+
let x = [];
|
|
4379
|
+
s.forEach((u) => {
|
|
4380
|
+
x.push(this.ctx.database.getRowDataItemForRowKey(u));
|
|
4381
|
+
}), this.ctx.emit("pasteChange", d, x);
|
|
4386
4382
|
}).catch((r) => {
|
|
4387
4383
|
console.error("Failed to get the clipboard content:", r);
|
|
4388
4384
|
});
|
|
@@ -4414,7 +4410,7 @@ class yi {
|
|
|
4414
4410
|
break;
|
|
4415
4411
|
}
|
|
4416
4412
|
const c = [i, i], d = [s, s], f = this.getCell(s, i);
|
|
4417
|
-
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(c, d), this.adjustBoundaryPosition(), this.ctx.emit("draw")));
|
|
4413
|
+
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(c, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
|
|
4418
4414
|
}
|
|
4419
4415
|
stopAdjustPosition() {
|
|
4420
4416
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -4428,8 +4424,8 @@ class yi {
|
|
|
4428
4424
|
SELECTOR_AREA_MAX_Y: o,
|
|
4429
4425
|
SELECTOR_AREA_MAX_X_OFFSET: n,
|
|
4430
4426
|
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
4431
|
-
} = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r,
|
|
4432
|
-
return !(e < c || e > d || t < f || t >
|
|
4427
|
+
} = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r, x = o || this.ctx.maxRowIndex - h;
|
|
4428
|
+
return !(e < c || e > d || t < f || t > x);
|
|
4433
4429
|
}
|
|
4434
4430
|
/**
|
|
4435
4431
|
* 调整滚动条位置,让到达边界时自动滚动
|
|
@@ -4471,7 +4467,7 @@ class yi {
|
|
|
4471
4467
|
body: h,
|
|
4472
4468
|
scrollX: c,
|
|
4473
4469
|
scrollY: d,
|
|
4474
|
-
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED:
|
|
4470
|
+
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION: u, ENABLE_MERGE_CELL_LINK: p }
|
|
4475
4471
|
} = this.ctx;
|
|
4476
4472
|
if (!i)
|
|
4477
4473
|
return;
|
|
@@ -4479,11 +4475,11 @@ class yi {
|
|
|
4479
4475
|
const { drawX: g, drawY: w, width: y, height: E, fixed: m } = i, C = r - g + 1, b = i.drawX + y - (e - s) + 1;
|
|
4480
4476
|
let R = o.height - w, S = E;
|
|
4481
4477
|
S > h.visibleHeight && (S = h.visibleHeight);
|
|
4482
|
-
let
|
|
4483
|
-
|
|
4484
|
-
const I = w + S - (t -
|
|
4485
|
-
let v = c,
|
|
4486
|
-
b > 0 && !m ? v = Math.floor(c + b) : C > 0 && !m && (v = Math.floor(c - C)), R > 0 ?
|
|
4478
|
+
let A = 0;
|
|
4479
|
+
x && (u === "top" ? R = o.height + n.height - w : A = n.visibleHeight);
|
|
4480
|
+
const I = w + S - (t - A - f);
|
|
4481
|
+
let v = c, T = d;
|
|
4482
|
+
b > 0 && !m ? v = Math.floor(c + b) : C > 0 && !m && (v = Math.floor(c - C)), R > 0 ? T = Math.floor(d - R) : I > 0 && (T = Math.floor(d + I)), (Math.abs(c - v) > 2 || Math.abs(d - T) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(v, T), this.ctx.emit("adjustBoundaryPosition", i));
|
|
4487
4483
|
}
|
|
4488
4484
|
destroy() {
|
|
4489
4485
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -4497,9 +4493,9 @@ class mi {
|
|
|
4497
4493
|
init() {
|
|
4498
4494
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
4499
4495
|
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
|
|
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:
|
|
4496
|
+
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;
|
|
4501
4497
|
if (this.ctx.config.ENABLE_AUTOFILL && c === n && d === h) {
|
|
4502
|
-
const w = f +
|
|
4498
|
+
const w = f + u - 6, y = x + p - 6;
|
|
4503
4499
|
i > w && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4504
4500
|
}
|
|
4505
4501
|
this.mouseenter(t);
|
|
@@ -4544,23 +4540,23 @@ class mi {
|
|
|
4544
4540
|
SELECTOR_AREA_MAX_X: c,
|
|
4545
4541
|
SELECTOR_AREA_MIN_Y: d,
|
|
4546
4542
|
SELECTOR_AREA_MAX_Y: f,
|
|
4547
|
-
SELECTOR_AREA_MAX_X_OFFSET:
|
|
4548
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4549
|
-
} = this.ctx.config, p = h, g = c || this.ctx.maxColIndex -
|
|
4543
|
+
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4544
|
+
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4545
|
+
} = this.ctx.config, p = h, g = c || this.ctx.maxColIndex - x, w = d, y = f || this.ctx.maxRowIndex - u;
|
|
4550
4546
|
let [E, m] = o, [C, b] = n;
|
|
4551
4547
|
if (E < p || C < w)
|
|
4552
4548
|
return;
|
|
4553
4549
|
o = [Math.max(p, E), Math.min(g, m)], n = [Math.max(w, C), Math.min(y, b)];
|
|
4554
4550
|
const { BEFORE_SET_AUTOFILL_METHOD: R } = this.ctx.config;
|
|
4555
4551
|
if (typeof R == "function") {
|
|
4556
|
-
const
|
|
4552
|
+
const A = R({
|
|
4557
4553
|
focusCell: this.ctx.focusCell,
|
|
4558
4554
|
xArr: o,
|
|
4559
4555
|
yArr: n
|
|
4560
4556
|
});
|
|
4561
|
-
if (!
|
|
4557
|
+
if (!A)
|
|
4562
4558
|
return;
|
|
4563
|
-
o =
|
|
4559
|
+
o = A.xArr, n = A.yArr;
|
|
4564
4560
|
}
|
|
4565
4561
|
this.ctx.autofill.xArr = o, this.ctx.autofill.yArr = n, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
4566
4562
|
}
|
|
@@ -4570,24 +4566,24 @@ class mi {
|
|
|
4570
4566
|
*/
|
|
4571
4567
|
async autofillData() {
|
|
4572
4568
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
4573
|
-
for (let
|
|
4569
|
+
for (let u = 0; u <= e.yArr[1] - e.yArr[0]; u++)
|
|
4574
4570
|
for (let p = 0; p <= e.xArr[1] - e.xArr[0]; p++) {
|
|
4575
|
-
const g =
|
|
4571
|
+
const g = u + e.yArr[0], w = p + e.xArr[0];
|
|
4576
4572
|
i.set(`${g}-${w}`, !0);
|
|
4577
4573
|
}
|
|
4578
4574
|
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;
|
|
4579
4575
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
|
|
4580
|
-
const
|
|
4576
|
+
const u = {
|
|
4581
4577
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
4582
4578
|
message: "Merged cells cannot span autofill data"
|
|
4583
4579
|
};
|
|
4584
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4580
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", u) : alert(u.message);
|
|
4585
4581
|
return;
|
|
4586
4582
|
}
|
|
4587
4583
|
let d = [];
|
|
4588
|
-
for (let
|
|
4584
|
+
for (let u = 0; u <= h[1] - h[0]; u++)
|
|
4589
4585
|
for (let p = 0; p <= n[1] - n[0]; p++) {
|
|
4590
|
-
const g = p + n[0], w =
|
|
4586
|
+
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}`;
|
|
4591
4587
|
if (E && !i.has(m)) {
|
|
4592
4588
|
const { rowKey: C, key: b } = E;
|
|
4593
4589
|
this.ctx.database.getReadonly(C, b) || (t.add(C), d.push({
|
|
@@ -4603,21 +4599,21 @@ class mi {
|
|
|
4603
4599
|
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
|
|
4604
4600
|
const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
|
|
4605
4601
|
if (typeof f == "function") {
|
|
4606
|
-
const
|
|
4602
|
+
const u = f, p = d.map((g) => ({
|
|
4607
4603
|
rowKey: g.rowKey,
|
|
4608
4604
|
key: g.key,
|
|
4609
4605
|
value: g.value,
|
|
4610
4606
|
oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
|
|
4611
4607
|
row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
|
|
4612
4608
|
}));
|
|
4613
|
-
if (d = await
|
|
4609
|
+
if (d = await u(p, n, h), d && !d.length)
|
|
4614
4610
|
return;
|
|
4615
4611
|
}
|
|
4616
4612
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4617
|
-
let
|
|
4618
|
-
t.forEach((
|
|
4619
|
-
|
|
4620
|
-
}), this.ctx.emit("autofillChange", d,
|
|
4613
|
+
let x = [];
|
|
4614
|
+
t.forEach((u) => {
|
|
4615
|
+
x.push(this.ctx.database.getRowDataItemForRowKey(u));
|
|
4616
|
+
}), this.ctx.emit("autofillChange", d, x);
|
|
4621
4617
|
}
|
|
4622
4618
|
mouseenter(t) {
|
|
4623
4619
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4741,48 +4737,48 @@ function zt(a, t, e) {
|
|
|
4741
4737
|
reference: i,
|
|
4742
4738
|
floating: s
|
|
4743
4739
|
} = a;
|
|
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,
|
|
4745
|
-
let
|
|
4740
|
+
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;
|
|
4741
|
+
let u;
|
|
4746
4742
|
switch (h) {
|
|
4747
4743
|
case "top":
|
|
4748
|
-
|
|
4744
|
+
u = {
|
|
4749
4745
|
x: d,
|
|
4750
4746
|
y: i.y - s.height
|
|
4751
4747
|
};
|
|
4752
4748
|
break;
|
|
4753
4749
|
case "bottom":
|
|
4754
|
-
|
|
4750
|
+
u = {
|
|
4755
4751
|
x: d,
|
|
4756
4752
|
y: i.y + i.height
|
|
4757
4753
|
};
|
|
4758
4754
|
break;
|
|
4759
4755
|
case "right":
|
|
4760
|
-
|
|
4756
|
+
u = {
|
|
4761
4757
|
x: i.x + i.width,
|
|
4762
4758
|
y: f
|
|
4763
4759
|
};
|
|
4764
4760
|
break;
|
|
4765
4761
|
case "left":
|
|
4766
|
-
|
|
4762
|
+
u = {
|
|
4767
4763
|
x: i.x - s.width,
|
|
4768
4764
|
y: f
|
|
4769
4765
|
};
|
|
4770
4766
|
break;
|
|
4771
4767
|
default:
|
|
4772
|
-
|
|
4768
|
+
u = {
|
|
4773
4769
|
x: i.x,
|
|
4774
4770
|
y: i.y
|
|
4775
4771
|
};
|
|
4776
4772
|
}
|
|
4777
4773
|
switch (lt(t)) {
|
|
4778
4774
|
case "start":
|
|
4779
|
-
|
|
4775
|
+
u[o] -= x * (e && c ? -1 : 1);
|
|
4780
4776
|
break;
|
|
4781
4777
|
case "end":
|
|
4782
|
-
|
|
4778
|
+
u[o] += x * (e && c ? -1 : 1);
|
|
4783
4779
|
break;
|
|
4784
4780
|
}
|
|
4785
|
-
return
|
|
4781
|
+
return u;
|
|
4786
4782
|
}
|
|
4787
4783
|
const Oi = async (a, t, e) => {
|
|
4788
4784
|
const {
|
|
@@ -4798,7 +4794,7 @@ const Oi = async (a, t, e) => {
|
|
|
4798
4794
|
}), {
|
|
4799
4795
|
x: d,
|
|
4800
4796
|
y: f
|
|
4801
|
-
} = zt(c, i, h),
|
|
4797
|
+
} = zt(c, i, h), x = i, u = {}, p = 0;
|
|
4802
4798
|
for (let g = 0; g < n.length; g++) {
|
|
4803
4799
|
const {
|
|
4804
4800
|
name: w,
|
|
@@ -4812,9 +4808,9 @@ const Oi = async (a, t, e) => {
|
|
|
4812
4808
|
x: d,
|
|
4813
4809
|
y: f,
|
|
4814
4810
|
initialPlacement: i,
|
|
4815
|
-
placement:
|
|
4811
|
+
placement: x,
|
|
4816
4812
|
strategy: s,
|
|
4817
|
-
middlewareData:
|
|
4813
|
+
middlewareData: u,
|
|
4818
4814
|
rects: c,
|
|
4819
4815
|
platform: o,
|
|
4820
4816
|
elements: {
|
|
@@ -4822,27 +4818,27 @@ const Oi = async (a, t, e) => {
|
|
|
4822
4818
|
floating: t
|
|
4823
4819
|
}
|
|
4824
4820
|
});
|
|
4825
|
-
d = E ?? d, f = m ?? f,
|
|
4826
|
-
...
|
|
4821
|
+
d = E ?? d, f = m ?? f, u = {
|
|
4822
|
+
...u,
|
|
4827
4823
|
[w]: {
|
|
4828
|
-
...
|
|
4824
|
+
...u[w],
|
|
4829
4825
|
...C
|
|
4830
4826
|
}
|
|
4831
|
-
}, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (
|
|
4827
|
+
}, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (x = b.placement), b.rects && (c = b.rects === !0 ? await o.getElementRects({
|
|
4832
4828
|
reference: a,
|
|
4833
4829
|
floating: t,
|
|
4834
4830
|
strategy: s
|
|
4835
4831
|
}) : b.rects), {
|
|
4836
4832
|
x: d,
|
|
4837
4833
|
y: f
|
|
4838
|
-
} = zt(c,
|
|
4834
|
+
} = zt(c, x, h)), g = -1);
|
|
4839
4835
|
}
|
|
4840
4836
|
return {
|
|
4841
4837
|
x: d,
|
|
4842
4838
|
y: f,
|
|
4843
|
-
placement:
|
|
4839
|
+
placement: x,
|
|
4844
4840
|
strategy: s,
|
|
4845
|
-
middlewareData:
|
|
4841
|
+
middlewareData: u
|
|
4846
4842
|
};
|
|
4847
4843
|
};
|
|
4848
4844
|
async function le(a, t) {
|
|
@@ -4859,9 +4855,9 @@ async function le(a, t) {
|
|
|
4859
4855
|
boundary: c = "clippingAncestors",
|
|
4860
4856
|
rootBoundary: d = "viewport",
|
|
4861
4857
|
elementContext: f = "floating",
|
|
4862
|
-
altBoundary:
|
|
4863
|
-
padding:
|
|
4864
|
-
} = at(t, a), p = ae(
|
|
4858
|
+
altBoundary: x = !1,
|
|
4859
|
+
padding: u = 0
|
|
4860
|
+
} = at(t, a), p = ae(u), w = n[x ? f === "floating" ? "reference" : "floating" : f], y = ut(await r.getClippingRect({
|
|
4865
4861
|
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)),
|
|
4866
4862
|
boundary: c,
|
|
4867
4863
|
rootBoundary: d,
|
|
@@ -4908,18 +4904,18 @@ const Si = (a) => ({
|
|
|
4908
4904
|
} = at(a, t) || {};
|
|
4909
4905
|
if (c == null)
|
|
4910
4906
|
return {};
|
|
4911
|
-
const f = ae(d),
|
|
4907
|
+
const f = ae(d), x = {
|
|
4912
4908
|
x: e,
|
|
4913
4909
|
y: i
|
|
4914
|
-
},
|
|
4910
|
+
}, 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));
|
|
4915
4911
|
let S = R ? R[m] : 0;
|
|
4916
4912
|
(!S || !await (o.isElement == null ? void 0 : o.isElement(R))) && (S = n.floating[m] || r.floating[p]);
|
|
4917
|
-
const
|
|
4913
|
+
const A = C / 2 - b / 2, I = S / 2 - g[p] / 2 - 1, v = rt(f[y], I), T = rt(f[E], I), O = v, M = S - g[p] - T, L = S / 2 - g[p] / 2 + A, N = _t(O, L, M), Y = !h.arrow && lt(s) != null && L !== N && r.reference[p] / 2 - (L < O ? v : T) - g[p] / 2 < 0, K = Y ? L < O ? L - O : L - M : 0;
|
|
4918
4914
|
return {
|
|
4919
|
-
[
|
|
4915
|
+
[u]: x[u] + K,
|
|
4920
4916
|
data: {
|
|
4921
|
-
[
|
|
4922
|
-
centerOffset:
|
|
4917
|
+
[u]: N,
|
|
4918
|
+
centerOffset: L - N - K,
|
|
4923
4919
|
...Y && {
|
|
4924
4920
|
alignmentOffset: K
|
|
4925
4921
|
}
|
|
@@ -4927,7 +4923,7 @@ const Si = (a) => ({
|
|
|
4927
4923
|
reset: Y
|
|
4928
4924
|
};
|
|
4929
4925
|
}
|
|
4930
|
-
}),
|
|
4926
|
+
}), Ai = function(a) {
|
|
4931
4927
|
return a === void 0 && (a = {}), {
|
|
4932
4928
|
name: "flip",
|
|
4933
4929
|
options: a,
|
|
@@ -4943,32 +4939,32 @@ const Si = (a) => ({
|
|
|
4943
4939
|
} = t, {
|
|
4944
4940
|
mainAxis: d = !0,
|
|
4945
4941
|
crossAxis: f = !0,
|
|
4946
|
-
fallbackPlacements:
|
|
4947
|
-
fallbackStrategy:
|
|
4942
|
+
fallbackPlacements: x,
|
|
4943
|
+
fallbackStrategy: u = "bestFit",
|
|
4948
4944
|
fallbackAxisSideDirection: p = "none",
|
|
4949
4945
|
flipAlignment: g = !0,
|
|
4950
4946
|
...w
|
|
4951
4947
|
} = at(a, t);
|
|
4952
4948
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4953
4949
|
return {};
|
|
4954
|
-
const y = q(s), E = J(n), m = q(n) === n, C = await (h.isRTL == null ? void 0 : h.isRTL(c.floating)), b =
|
|
4955
|
-
!
|
|
4956
|
-
const S = [n, ...b],
|
|
4950
|
+
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";
|
|
4951
|
+
!x && R && b.push(...Ii(n, g, p, C));
|
|
4952
|
+
const S = [n, ...b], A = await le(t, w), I = [];
|
|
4957
4953
|
let v = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4958
|
-
if (d && I.push(
|
|
4959
|
-
const
|
|
4960
|
-
I.push(L[
|
|
4954
|
+
if (d && I.push(A[y]), f) {
|
|
4955
|
+
const L = bi(s, o, C);
|
|
4956
|
+
I.push(A[L[0]], A[L[1]]);
|
|
4961
4957
|
}
|
|
4962
4958
|
if (v = [...v, {
|
|
4963
4959
|
placement: s,
|
|
4964
4960
|
overflows: I
|
|
4965
|
-
}], !I.every((
|
|
4966
|
-
var
|
|
4967
|
-
const
|
|
4961
|
+
}], !I.every((L) => L <= 0)) {
|
|
4962
|
+
var T, O;
|
|
4963
|
+
const L = (((T = r.flip) == null ? void 0 : T.index) || 0) + 1, N = S[L];
|
|
4968
4964
|
if (N)
|
|
4969
4965
|
return {
|
|
4970
4966
|
data: {
|
|
4971
|
-
index:
|
|
4967
|
+
index: L,
|
|
4972
4968
|
overflows: v
|
|
4973
4969
|
},
|
|
4974
4970
|
reset: {
|
|
@@ -4977,7 +4973,7 @@ const Si = (a) => ({
|
|
|
4977
4973
|
};
|
|
4978
4974
|
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;
|
|
4979
4975
|
if (!Y)
|
|
4980
|
-
switch (
|
|
4976
|
+
switch (u) {
|
|
4981
4977
|
case "bestFit": {
|
|
4982
4978
|
var M;
|
|
4983
4979
|
const K = (M = v.filter((W) => {
|
|
@@ -5007,15 +5003,15 @@ const Si = (a) => ({
|
|
|
5007
5003
|
}
|
|
5008
5004
|
};
|
|
5009
5005
|
};
|
|
5010
|
-
async function
|
|
5006
|
+
async function Ti(a, t) {
|
|
5011
5007
|
const {
|
|
5012
5008
|
placement: e,
|
|
5013
5009
|
platform: i,
|
|
5014
5010
|
elements: s
|
|
5015
5011
|
} = 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);
|
|
5016
5012
|
let {
|
|
5017
|
-
mainAxis:
|
|
5018
|
-
crossAxis:
|
|
5013
|
+
mainAxis: x,
|
|
5014
|
+
crossAxis: u,
|
|
5019
5015
|
alignmentAxis: p
|
|
5020
5016
|
} = typeof f == "number" ? {
|
|
5021
5017
|
mainAxis: f,
|
|
@@ -5026,15 +5022,15 @@ async function Ai(a, t) {
|
|
|
5026
5022
|
crossAxis: f.crossAxis || 0,
|
|
5027
5023
|
alignmentAxis: f.alignmentAxis
|
|
5028
5024
|
};
|
|
5029
|
-
return n && typeof p == "number" && (
|
|
5030
|
-
x:
|
|
5031
|
-
y:
|
|
5025
|
+
return n && typeof p == "number" && (u = n === "end" ? p * -1 : p), h ? {
|
|
5026
|
+
x: u * d,
|
|
5027
|
+
y: x * c
|
|
5032
5028
|
} : {
|
|
5033
|
-
x:
|
|
5034
|
-
y:
|
|
5029
|
+
x: x * c,
|
|
5030
|
+
y: u * d
|
|
5035
5031
|
};
|
|
5036
5032
|
}
|
|
5037
|
-
const
|
|
5033
|
+
const Li = function(a) {
|
|
5038
5034
|
return a === void 0 && (a = 0), {
|
|
5039
5035
|
name: "offset",
|
|
5040
5036
|
options: a,
|
|
@@ -5045,7 +5041,7 @@ const Ti = function(a) {
|
|
|
5045
5041
|
y: r,
|
|
5046
5042
|
placement: o,
|
|
5047
5043
|
middlewareData: n
|
|
5048
|
-
} = t, h = await
|
|
5044
|
+
} = t, h = await Ti(t, a);
|
|
5049
5045
|
return o === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
|
|
5050
5046
|
x: s + h.x,
|
|
5051
5047
|
y: r + h.y,
|
|
@@ -5084,11 +5080,11 @@ const Ti = function(a) {
|
|
|
5084
5080
|
} = at(a, t), c = {
|
|
5085
5081
|
x: e,
|
|
5086
5082
|
y: i
|
|
5087
|
-
}, d = await le(t, h), f = J(q(s)),
|
|
5088
|
-
let
|
|
5083
|
+
}, d = await le(t, h), f = J(q(s)), x = ne(f);
|
|
5084
|
+
let u = c[x], p = c[f];
|
|
5089
5085
|
if (r) {
|
|
5090
|
-
const w =
|
|
5091
|
-
|
|
5086
|
+
const w = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", E = u + d[w], m = u - d[y];
|
|
5087
|
+
u = _t(E, u, m);
|
|
5092
5088
|
}
|
|
5093
5089
|
if (o) {
|
|
5094
5090
|
const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", E = p + d[w], m = p - d[y];
|
|
@@ -5096,7 +5092,7 @@ const Ti = function(a) {
|
|
|
5096
5092
|
}
|
|
5097
5093
|
const g = n.fn({
|
|
5098
5094
|
...t,
|
|
5099
|
-
[
|
|
5095
|
+
[x]: u,
|
|
5100
5096
|
[f]: p
|
|
5101
5097
|
});
|
|
5102
5098
|
return {
|
|
@@ -5105,7 +5101,7 @@ const Ti = function(a) {
|
|
|
5105
5101
|
x: g.x - e,
|
|
5106
5102
|
y: g.y - i,
|
|
5107
5103
|
enabled: {
|
|
5108
|
-
[
|
|
5104
|
+
[x]: r,
|
|
5109
5105
|
[f]: o
|
|
5110
5106
|
}
|
|
5111
5107
|
}
|
|
@@ -5214,12 +5210,12 @@ function St(a, t, e) {
|
|
|
5214
5210
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
5215
5211
|
const s = ce(a), r = s === ((i = a.ownerDocument) == null ? void 0 : i.body), o = F(s);
|
|
5216
5212
|
if (r) {
|
|
5217
|
-
const n =
|
|
5213
|
+
const n = At(o);
|
|
5218
5214
|
return t.concat(o, o.visualViewport || [], ht(s) ? s : [], n && e ? St(n) : []);
|
|
5219
5215
|
}
|
|
5220
5216
|
return t.concat(s, St(s, [], e));
|
|
5221
5217
|
}
|
|
5222
|
-
function
|
|
5218
|
+
function At(a) {
|
|
5223
5219
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
5224
5220
|
}
|
|
5225
5221
|
function de(a) {
|
|
@@ -5269,11 +5265,11 @@ function ot(a, t, e, i) {
|
|
|
5269
5265
|
const n = Xi(r, e, i) ? xe(r) : z(0);
|
|
5270
5266
|
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;
|
|
5271
5267
|
if (r) {
|
|
5272
|
-
const
|
|
5273
|
-
let p =
|
|
5274
|
-
for (; g && i &&
|
|
5268
|
+
const x = F(r), u = i && X(i) ? F(i) : i;
|
|
5269
|
+
let p = x, g = At(p);
|
|
5270
|
+
for (; g && i && u !== p; ) {
|
|
5275
5271
|
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;
|
|
5276
|
-
h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c += C, p = F(g), g =
|
|
5272
|
+
h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c += C, p = F(g), g = At(p);
|
|
5277
5273
|
}
|
|
5278
5274
|
}
|
|
5279
5275
|
return ut({
|
|
@@ -5299,8 +5295,8 @@ function ki(a) {
|
|
|
5299
5295
|
}, c = z(1);
|
|
5300
5296
|
const d = z(0), f = B(i);
|
|
5301
5297
|
if ((f || !f && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), B(i))) {
|
|
5302
|
-
const
|
|
5303
|
-
c = Z(i), d.x =
|
|
5298
|
+
const x = ot(i);
|
|
5299
|
+
c = Z(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5304
5300
|
}
|
|
5305
5301
|
return {
|
|
5306
5302
|
width: e.width * c.x,
|
|
@@ -5312,13 +5308,13 @@ function ki(a) {
|
|
|
5312
5308
|
function Ni(a) {
|
|
5313
5309
|
return Array.from(a.getClientRects());
|
|
5314
5310
|
}
|
|
5315
|
-
function
|
|
5311
|
+
function Tt(a, t) {
|
|
5316
5312
|
const e = pt(a).scrollLeft;
|
|
5317
5313
|
return t ? t.left + e : ot(V(a)).left + e;
|
|
5318
5314
|
}
|
|
5319
5315
|
function Ki(a) {
|
|
5320
5316
|
const t = V(a), e = pt(a), i = a.ownerDocument.body, s = U(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), r = U(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
5321
|
-
let o = -e.scrollLeft +
|
|
5317
|
+
let o = -e.scrollLeft + Tt(a);
|
|
5322
5318
|
const n = -e.scrollTop;
|
|
5323
5319
|
return k(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
|
|
5324
5320
|
width: s,
|
|
@@ -5423,19 +5419,19 @@ function zi(a, t, e) {
|
|
|
5423
5419
|
const h = z(0);
|
|
5424
5420
|
if (i || !i && !r)
|
|
5425
5421
|
if ((tt(t) !== "body" || ht(s)) && (n = pt(t)), i) {
|
|
5426
|
-
const
|
|
5427
|
-
h.x =
|
|
5428
|
-
} else s && (h.x =
|
|
5422
|
+
const u = ot(t, !0, r, t);
|
|
5423
|
+
h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
|
|
5424
|
+
} else s && (h.x = Tt(s));
|
|
5429
5425
|
let c = 0, d = 0;
|
|
5430
5426
|
if (s && !i && !r) {
|
|
5431
|
-
const
|
|
5432
|
-
d =
|
|
5433
|
-
|
|
5427
|
+
const u = s.getBoundingClientRect();
|
|
5428
|
+
d = u.top + n.scrollTop, c = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
5429
|
+
Tt(s, u);
|
|
5434
5430
|
}
|
|
5435
|
-
const f = o.left + n.scrollLeft - h.x - c,
|
|
5431
|
+
const f = o.left + n.scrollLeft - h.x - c, x = o.top + n.scrollTop - h.y - d;
|
|
5436
5432
|
return {
|
|
5437
5433
|
x: f,
|
|
5438
|
-
y:
|
|
5434
|
+
y: x,
|
|
5439
5435
|
width: o.width,
|
|
5440
5436
|
height: o.height
|
|
5441
5437
|
};
|
|
@@ -5495,7 +5491,7 @@ const qi = {
|
|
|
5495
5491
|
getScale: Z,
|
|
5496
5492
|
isElement: X,
|
|
5497
5493
|
isRTL: Gi
|
|
5498
|
-
}, we =
|
|
5494
|
+
}, we = Li, pe = Mi, ye = Ai, ji = Si, me = (a, t, e) => {
|
|
5499
5495
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
5500
5496
|
platform: qi,
|
|
5501
5497
|
...e
|
|
@@ -5542,7 +5538,7 @@ let Ui = class {
|
|
|
5542
5538
|
}
|
|
5543
5539
|
init() {
|
|
5544
5540
|
this.ctx.on("mousemove", (t) => {
|
|
5545
|
-
if (!this.ctx.isTarget())
|
|
5541
|
+
if (!this.ctx.isTarget(t))
|
|
5546
5542
|
return;
|
|
5547
5543
|
const e = this.ctx.containerElement.getBoundingClientRect();
|
|
5548
5544
|
e && (t.clientX < e.x || t.clientX > e.x + e.width || t.clientY < e.y || t.clientY > e.y + e.height) && this.hide();
|
|
@@ -5587,26 +5583,26 @@ let Ui = class {
|
|
|
5587
5583
|
top: `${c}px`,
|
|
5588
5584
|
left: `${h}px`
|
|
5589
5585
|
}), f.arrow) {
|
|
5590
|
-
const
|
|
5586
|
+
const x = f.arrow;
|
|
5591
5587
|
["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
5592
|
-
top: `${
|
|
5588
|
+
top: `${x.y}px`,
|
|
5593
5589
|
bottom: "",
|
|
5594
5590
|
left: "",
|
|
5595
5591
|
right: "-5px"
|
|
5596
5592
|
}) : ["right", "right-start", "right-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
5597
|
-
top: `${
|
|
5593
|
+
top: `${x.y}px`,
|
|
5598
5594
|
bottom: "",
|
|
5599
5595
|
left: "-5px",
|
|
5600
5596
|
right: ""
|
|
5601
5597
|
}) : ["bottom", "bottom-start", "bottom-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
5602
5598
|
top: "-5px",
|
|
5603
5599
|
bottom: "",
|
|
5604
|
-
left: `${
|
|
5600
|
+
left: `${x.x}px`,
|
|
5605
5601
|
right: ""
|
|
5606
5602
|
}) : ["top", "top-start", "top-end"].includes(d) && Object.assign(this.arrowEl.style, {
|
|
5607
5603
|
top: "",
|
|
5608
5604
|
bottom: "-5px",
|
|
5609
|
-
left: `${
|
|
5605
|
+
left: `${x.x}px`,
|
|
5610
5606
|
right: ""
|
|
5611
5607
|
});
|
|
5612
5608
|
}
|
|
@@ -5629,21 +5625,47 @@ class Zi {
|
|
|
5629
5625
|
l(this, "ctx");
|
|
5630
5626
|
l(this, "drawY", 0);
|
|
5631
5627
|
l(this, "drawX", 0);
|
|
5628
|
+
l(this, "cancel", !1);
|
|
5632
5629
|
this.ctx = t, this.initTextEditor(), this.init();
|
|
5633
5630
|
}
|
|
5634
5631
|
init() {
|
|
5635
|
-
this.ctx.on("
|
|
5636
|
-
this.
|
|
5632
|
+
this.ctx.on("outsideMousedown", () => {
|
|
5633
|
+
this.cellTarget && this.cellTarget.editorType === "text" && this.clearEditor();
|
|
5634
|
+
}), this.ctx.on("moveFocus", (t) => {
|
|
5635
|
+
this.cellTarget = t;
|
|
5636
|
+
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
5637
|
+
this.selectorArrStr = JSON.stringify(e) + JSON.stringify(i);
|
|
5637
5638
|
}), this.ctx.on("onScroll", () => {
|
|
5638
5639
|
this.enable && this.doneEdit();
|
|
5639
5640
|
}), this.ctx.on("cellHeaderMousedown", () => {
|
|
5640
5641
|
this.enable && this.doneEdit(), this.cellTarget = null;
|
|
5641
5642
|
}), this.ctx.on("keydown", (t) => {
|
|
5642
|
-
if (!this.ctx.isTarget())
|
|
5643
|
+
if (!this.ctx.isTarget(t))
|
|
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
|
+
if (t.preventDefault(), this.doneEdit(), t.shiftKey) {
|
|
5660
|
+
this.ctx.emit("setMoveFocus", "TOP");
|
|
5661
|
+
return;
|
|
5662
|
+
}
|
|
5663
|
+
this.ctx.emit("setMoveFocus", "BOTTOM");
|
|
5643
5664
|
return;
|
|
5665
|
+
}
|
|
5644
5666
|
const e = t.key, i = t.ctrlKey, s = t.altKey, r = t.shiftKey, o = t.metaKey;
|
|
5645
5667
|
i || s || r || o || [
|
|
5646
|
-
|
|
5668
|
+
"Enter",
|
|
5647
5669
|
"Escape",
|
|
5648
5670
|
"Tab",
|
|
5649
5671
|
"Backspace",
|
|
@@ -5668,9 +5690,8 @@ class Zi {
|
|
|
5668
5690
|
"F9",
|
|
5669
5691
|
"F10",
|
|
5670
5692
|
"F11",
|
|
5671
|
-
"F12"
|
|
5672
|
-
|
|
5673
|
-
].includes(e) || this.startEdit();
|
|
5693
|
+
"F12"
|
|
5694
|
+
].includes(e) || this.startEdit(!0);
|
|
5674
5695
|
}), this.ctx.on("adjustBoundaryPosition", (t) => {
|
|
5675
5696
|
this.cellTarget = t;
|
|
5676
5697
|
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
@@ -5703,19 +5724,8 @@ class Zi {
|
|
|
5703
5724
|
return !(e < r || e > o || t < n || t > h);
|
|
5704
5725
|
}
|
|
5705
5726
|
initTextEditor() {
|
|
5706
|
-
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("
|
|
5707
|
-
|
|
5708
|
-
if (t.stopPropagation(), (t.altKey || t.metaKey) && t.code === "Enter") {
|
|
5709
|
-
t.preventDefault();
|
|
5710
|
-
const e = this.inputEl.selectionStart, i = this.inputEl.value.substring(0, e), s = this.inputEl.value.substring(e);
|
|
5711
|
-
this.inputEl.value = i + `
|
|
5712
|
-
` + s, this.inputEl.selectionStart = this.inputEl.selectionEnd = e + 1, this.autoSize();
|
|
5713
|
-
return;
|
|
5714
|
-
}
|
|
5715
|
-
(t.code === "Escape" || t.code === "Enter") && (t.preventDefault(), this.inputEl.blur(), this.ctx.emit("setMoveFocus", "BOTTOM"));
|
|
5716
|
-
}
|
|
5717
|
-
}), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
5718
|
-
this.doneEdit();
|
|
5727
|
+
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
5728
|
+
this.doneEdit(), this.cellTarget = null;
|
|
5719
5729
|
}), this.editorEl = this.ctx.editorElement, this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
|
|
5720
5730
|
}
|
|
5721
5731
|
autoSize() {
|
|
@@ -5730,42 +5740,43 @@ class Zi {
|
|
|
5730
5740
|
} = this.ctx, n = i - s.height - o;
|
|
5731
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`;
|
|
5732
5742
|
}
|
|
5733
|
-
startEditByInput(t) {
|
|
5734
|
-
const
|
|
5743
|
+
startEditByInput(t, e = !1) {
|
|
5744
|
+
const i = e ? null : t.getValue(), { editorType: s } = t;
|
|
5735
5745
|
this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
5736
|
-
let { drawX:
|
|
5737
|
-
this.drawX =
|
|
5746
|
+
let { drawX: r, drawY: o, height: n, width: h } = t;
|
|
5747
|
+
this.drawX = r, this.drawY = o;
|
|
5738
5748
|
const {
|
|
5739
|
-
config: { CELL_PADDING:
|
|
5740
|
-
header:
|
|
5749
|
+
config: { CELL_PADDING: c },
|
|
5750
|
+
header: d
|
|
5741
5751
|
} = this.ctx;
|
|
5742
|
-
let
|
|
5743
|
-
if (
|
|
5744
|
-
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${
|
|
5745
|
-
const
|
|
5746
|
-
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);
|
|
5747
5757
|
} else
|
|
5748
5758
|
this.inputEl.style.display = "none";
|
|
5749
|
-
(this.inputEl.scrollHeight >
|
|
5759
|
+
(this.inputEl.scrollHeight > n || o < d.height) && this.autoSize();
|
|
5750
5760
|
}
|
|
5751
5761
|
doneEditByInput() {
|
|
5752
|
-
if (this.cellTarget &&
|
|
5762
|
+
if (this.cellTarget && this.cellTarget.editorType === "text") {
|
|
5753
5763
|
const { rowKey: t, key: e } = this.cellTarget, i = this.cellTarget.getValue(), s = this.inputEl.value;
|
|
5754
|
-
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 = "";
|
|
5755
5765
|
}
|
|
5756
5766
|
}
|
|
5757
|
-
startEdit() {
|
|
5758
|
-
|
|
5759
|
-
|
|
5767
|
+
startEdit(t = !1) {
|
|
5768
|
+
this.cancel = !1;
|
|
5769
|
+
const { ENABLE_EDIT_CLICK_SELECTOR: e } = this.ctx.config;
|
|
5770
|
+
if (!e)
|
|
5760
5771
|
return;
|
|
5761
|
-
const
|
|
5762
|
-
if (!
|
|
5772
|
+
const i = this.ctx.focusCell;
|
|
5773
|
+
if (!i || ["index", "index-selection", "selection"].includes(i.type) || this.enable)
|
|
5763
5774
|
return;
|
|
5764
|
-
const { rowKey:
|
|
5765
|
-
if (
|
|
5775
|
+
const { rowKey: s, key: r, editorType: o } = i;
|
|
5776
|
+
if (o === "none")
|
|
5766
5777
|
return;
|
|
5767
|
-
const
|
|
5768
|
-
|
|
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));
|
|
5769
5780
|
}
|
|
5770
5781
|
editCell(t, e) {
|
|
5771
5782
|
const i = this.ctx.body.renderRows.find((c) => c.rowIndex === t);
|
|
@@ -5782,7 +5793,10 @@ class Zi {
|
|
|
5782
5793
|
r && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5783
5794
|
}
|
|
5784
5795
|
doneEdit() {
|
|
5785
|
-
this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.emit("drawView"));
|
|
5796
|
+
this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.containerElement.focus(), this.editorEl.style.display = "none", this.ctx.emit("drawView"));
|
|
5797
|
+
}
|
|
5798
|
+
clearEditor() {
|
|
5799
|
+
this.doneEdit(), this.cellTarget = null, this.selectorArrStr = "", this.ctx.clearSelector(), this.ctx.emit("drawView");
|
|
5786
5800
|
}
|
|
5787
5801
|
destroy() {
|
|
5788
5802
|
var t;
|
|
@@ -5846,7 +5860,7 @@ class Qi {
|
|
|
5846
5860
|
n.forEach((w) => {
|
|
5847
5861
|
w.render && (w.fixed === "left" ? c.push(w) : w.fixed === "right" ? d.push(w) : h.push(w));
|
|
5848
5862
|
});
|
|
5849
|
-
const f = e - i,
|
|
5863
|
+
const f = e - i, x = {
|
|
5850
5864
|
key: "left",
|
|
5851
5865
|
style: {
|
|
5852
5866
|
position: "absolute",
|
|
@@ -5857,7 +5871,7 @@ class Qi {
|
|
|
5857
5871
|
height: `${o}px`
|
|
5858
5872
|
},
|
|
5859
5873
|
cells: c
|
|
5860
|
-
},
|
|
5874
|
+
}, u = {
|
|
5861
5875
|
key: "center",
|
|
5862
5876
|
style: {
|
|
5863
5877
|
position: "absolute",
|
|
@@ -5889,7 +5903,7 @@ class Qi {
|
|
|
5889
5903
|
width: `${r}px`,
|
|
5890
5904
|
height: `${o}px`
|
|
5891
5905
|
},
|
|
5892
|
-
views: [
|
|
5906
|
+
views: [x, u, p]
|
|
5893
5907
|
};
|
|
5894
5908
|
}
|
|
5895
5909
|
getBody() {
|
|
@@ -5904,7 +5918,7 @@ class Qi {
|
|
|
5904
5918
|
fixedLeftWidth: r,
|
|
5905
5919
|
fixedRightWidth: o,
|
|
5906
5920
|
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: h }
|
|
5907
|
-
} = this.ctx, { visibleWidth: c, visibleHeight: d } = this.ctx.body, f = o - n,
|
|
5921
|
+
} = this.ctx, { visibleWidth: c, visibleHeight: d } = this.ctx.body, f = o - n, x = {
|
|
5908
5922
|
key: "left",
|
|
5909
5923
|
style: {
|
|
5910
5924
|
position: "absolute",
|
|
@@ -5915,7 +5929,7 @@ class Qi {
|
|
|
5915
5929
|
height: `${d}px`
|
|
5916
5930
|
},
|
|
5917
5931
|
cells: e
|
|
5918
|
-
},
|
|
5932
|
+
}, u = {
|
|
5919
5933
|
key: "center",
|
|
5920
5934
|
style: {
|
|
5921
5935
|
position: "absolute",
|
|
@@ -5947,7 +5961,7 @@ class Qi {
|
|
|
5947
5961
|
width: `${c}px`,
|
|
5948
5962
|
height: `${d}px`
|
|
5949
5963
|
},
|
|
5950
|
-
views: [
|
|
5964
|
+
views: [x, u, p]
|
|
5951
5965
|
};
|
|
5952
5966
|
}
|
|
5953
5967
|
getFooter() {
|
|
@@ -5972,7 +5986,7 @@ class Qi {
|
|
|
5972
5986
|
height: `${c}px`
|
|
5973
5987
|
},
|
|
5974
5988
|
cells: e
|
|
5975
|
-
},
|
|
5989
|
+
}, x = {
|
|
5976
5990
|
key: "center",
|
|
5977
5991
|
style: {
|
|
5978
5992
|
position: "absolute",
|
|
@@ -5983,7 +5997,7 @@ class Qi {
|
|
|
5983
5997
|
height: `${c}px`
|
|
5984
5998
|
},
|
|
5985
5999
|
cells: t
|
|
5986
|
-
},
|
|
6000
|
+
}, u = {
|
|
5987
6001
|
key: "right",
|
|
5988
6002
|
style: {
|
|
5989
6003
|
position: "absolute",
|
|
@@ -6004,7 +6018,7 @@ class Qi {
|
|
|
6004
6018
|
width: `${h}px`,
|
|
6005
6019
|
height: `${c}px`
|
|
6006
6020
|
},
|
|
6007
|
-
views: [f,
|
|
6021
|
+
views: [f, x, u]
|
|
6008
6022
|
};
|
|
6009
6023
|
}
|
|
6010
6024
|
}
|
|
@@ -6021,7 +6035,7 @@ class ts {
|
|
|
6021
6035
|
e.preventDefault();
|
|
6022
6036
|
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n, h] = s, { rowIndex: c, colIndex: d } = t;
|
|
6023
6037
|
c >= n && c <= h && d >= r && d <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
6024
|
-
const
|
|
6038
|
+
const x = {
|
|
6025
6039
|
getBoundingClientRect: () => ({
|
|
6026
6040
|
width: 0,
|
|
6027
6041
|
height: 0,
|
|
@@ -6034,11 +6048,11 @@ class ts {
|
|
|
6034
6048
|
}),
|
|
6035
6049
|
contextElement: document.body
|
|
6036
6050
|
};
|
|
6037
|
-
me(
|
|
6051
|
+
me(x, this.contextMenuEl, {
|
|
6038
6052
|
placement: "right-start",
|
|
6039
6053
|
middleware: [we(), pe(), ye()]
|
|
6040
|
-
}).then(({ x, y: p }) => {
|
|
6041
|
-
this.show(
|
|
6054
|
+
}).then(({ x: u, y: p }) => {
|
|
6055
|
+
this.show(u, p);
|
|
6042
6056
|
});
|
|
6043
6057
|
}), this.ctx.on("click", this.hide.bind(this)), this.ctx.on("onScroll", this.hide.bind(this)), this.ctx.on("resize", this.hide.bind(this));
|
|
6044
6058
|
}
|
|
@@ -6182,6 +6196,9 @@ class ss {
|
|
|
6182
6196
|
setItemValueByEditor(t, e, i, s = !0, r = !0) {
|
|
6183
6197
|
this.ctx.setItemValueByEditor(t, e, i, s, r), this.editor.doneEdit();
|
|
6184
6198
|
}
|
|
6199
|
+
clearEditor() {
|
|
6200
|
+
this.editor.clearEditor();
|
|
6201
|
+
}
|
|
6185
6202
|
doLayout() {
|
|
6186
6203
|
this.ctx.emit("draw");
|
|
6187
6204
|
}
|
|
@@ -6194,6 +6211,26 @@ class ss {
|
|
|
6194
6211
|
clearValidate() {
|
|
6195
6212
|
this.ctx.database.clearValidate(), this.ctx.emit("draw");
|
|
6196
6213
|
}
|
|
6214
|
+
validateFields(t, e = !0) {
|
|
6215
|
+
return new Promise(async (i, s) => {
|
|
6216
|
+
let r = [];
|
|
6217
|
+
for (let o = 0; o < t.length; o++) {
|
|
6218
|
+
const { rowKey: n, key: h } = t[o], c = await this.ctx.database.getValidator(n, h);
|
|
6219
|
+
Array.isArray(c) && c.length && r.push(c);
|
|
6220
|
+
}
|
|
6221
|
+
if (r.length) {
|
|
6222
|
+
if (s(r), e) {
|
|
6223
|
+
const [o] = r;
|
|
6224
|
+
if (Array.isArray(o) && o.length) {
|
|
6225
|
+
const [n] = o, { rowKey: h, key: c } = n;
|
|
6226
|
+
this.scrollToRowkey(h), this.scrollToColkey(c);
|
|
6227
|
+
}
|
|
6228
|
+
}
|
|
6229
|
+
this.ctx.emit("draw");
|
|
6230
|
+
} else
|
|
6231
|
+
i([]), this.ctx.emit("draw");
|
|
6232
|
+
});
|
|
6233
|
+
}
|
|
6197
6234
|
async validate(t = !0) {
|
|
6198
6235
|
return this.editor.doneEdit(), new Promise(async (e, i) => {
|
|
6199
6236
|
try {
|