e-virt-table 1.1.3 → 1.1.5
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 +810 -656
- 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/Autofill.d.ts +1 -0
- package/dist/lib/Autofill.js +30 -11
- package/dist/lib/Autofill.js.map +1 -1
- package/dist/lib/BaseCell.js +1 -1
- package/dist/lib/BaseCell.js.map +1 -1
- package/dist/lib/Body.d.ts +1 -1
- package/dist/lib/Body.js +10 -3
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Cell.d.ts +2 -1
- package/dist/lib/Cell.js +77 -57
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.js +3 -2
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Config.d.ts +4 -0
- package/dist/lib/Config.js +24 -0
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Context.d.ts +1 -0
- package/dist/lib/Context.js +10 -9
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/Database.d.ts +9 -5
- package/dist/lib/Database.js +217 -92
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +1 -0
- package/dist/lib/EVirtTable.js +5 -2
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +10 -4
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/EventTable.js +1 -1
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/Footer.d.ts +2 -1
- package/dist/lib/Footer.js +18 -3
- package/dist/lib/Footer.js.map +1 -1
- package/dist/lib/Header.d.ts +2 -1
- package/dist/lib/Header.js +17 -3
- package/dist/lib/Header.js.map +1 -1
- package/dist/lib/Row.d.ts +2 -1
- package/dist/lib/Row.js +5 -3
- package/dist/lib/Row.js.map +1 -1
- package/dist/lib/Scroller.js +11 -6
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.js +2 -2
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/types.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(":root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary: #333;--e-virt-table-text-color-regular: #666;--e-virt-table-text-color-secondary: #999;--e-virt-table-box-shadow: 0 2px 12px 0 #0000001a;--e-virt-table-editor-bg-color: #fff;--e-virt-table-border-color: #e1e6eb}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--e-virt-table-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--e-virt-table-editor-bg-color);border:2px solid var(--e-virt-table-color-primary);box-sizing:border-box;box-shadow:var(--e-virt-table-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var l = (a, t, e) =>
|
|
2
|
+
var Ce = Object.defineProperty;
|
|
3
|
+
var be = (a, t, e) => t in a ? Ce(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
4
|
+
var l = (a, t, e) => be(a, typeof t != "symbol" ? t + "" : t, e);
|
|
5
5
|
function G() {
|
|
6
6
|
return G = Object.assign ? Object.assign.bind() : function(a) {
|
|
7
7
|
for (var t = 1; t < arguments.length; t++) {
|
|
@@ -43,13 +43,13 @@ function dt(a, t, e) {
|
|
|
43
43
|
return o && st(c, o.prototype), c;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function _e(a) {
|
|
47
47
|
return Function.toString.call(a).indexOf("[native code]") !== -1;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function Ct(a) {
|
|
50
50
|
var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
51
|
-
return
|
|
52
|
-
if (i === null || !
|
|
51
|
+
return Ct = function(i) {
|
|
52
|
+
if (i === null || !_e(i)) return i;
|
|
53
53
|
if (typeof i != "function")
|
|
54
54
|
throw new TypeError("Super expression must either be null or a function");
|
|
55
55
|
if (typeof t < "u") {
|
|
@@ -67,16 +67,16 @@ function bt(a) {
|
|
|
67
67
|
configurable: !0
|
|
68
68
|
}
|
|
69
69
|
}), st(s, i);
|
|
70
|
-
},
|
|
70
|
+
}, Ct(a);
|
|
71
71
|
}
|
|
72
|
-
var
|
|
72
|
+
var Ie = /%[sdj%]/g, jt = function() {
|
|
73
73
|
};
|
|
74
74
|
typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (jt = function(t, e) {
|
|
75
75
|
typeof console < "u" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING > "u" && e.every(function(i) {
|
|
76
76
|
return typeof i == "string";
|
|
77
77
|
}) && console.warn(t, e);
|
|
78
78
|
});
|
|
79
|
-
function
|
|
79
|
+
function bt(a) {
|
|
80
80
|
if (!a || !a.length) return null;
|
|
81
81
|
var t = {};
|
|
82
82
|
return a.forEach(function(e) {
|
|
@@ -91,7 +91,7 @@ function D(a) {
|
|
|
91
91
|
if (typeof a == "function")
|
|
92
92
|
return a.apply(null, e);
|
|
93
93
|
if (typeof a == "string") {
|
|
94
|
-
var o = a.replace(
|
|
94
|
+
var o = a.replace(Ie, function(n) {
|
|
95
95
|
if (n === "%%")
|
|
96
96
|
return "%";
|
|
97
97
|
if (s >= r)
|
|
@@ -143,7 +143,7 @@ function Xt(a, t, e) {
|
|
|
143
143
|
}
|
|
144
144
|
r([]);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function Le(a) {
|
|
147
147
|
var t = [];
|
|
148
148
|
return Object.keys(a).forEach(function(e) {
|
|
149
149
|
t.push.apply(t, a[e] || []);
|
|
@@ -156,27 +156,27 @@ var kt = /* @__PURE__ */ function(a) {
|
|
|
156
156
|
return s = a.call(this, "Async Validation Error") || this, s.errors = e, s.fields = i, s;
|
|
157
157
|
}
|
|
158
158
|
return t;
|
|
159
|
-
}(/* @__PURE__ */
|
|
160
|
-
function
|
|
159
|
+
}(/* @__PURE__ */ Ct(Error));
|
|
160
|
+
function Ae(a, t, e, i, s) {
|
|
161
161
|
if (t.first) {
|
|
162
|
-
var r = new Promise(function(x,
|
|
162
|
+
var r = new Promise(function(x, g) {
|
|
163
163
|
var p = function(y) {
|
|
164
|
-
return i(y), y.length ?
|
|
165
|
-
},
|
|
166
|
-
Xt(
|
|
164
|
+
return i(y), y.length ? g(new kt(y, bt(y))) : x(s);
|
|
165
|
+
}, u = Le(a);
|
|
166
|
+
Xt(u, e, p);
|
|
167
167
|
});
|
|
168
168
|
return r.catch(function(x) {
|
|
169
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(x,
|
|
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, g) {
|
|
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 ? g(new kt(d, bt(d))) : x(s);
|
|
176
176
|
};
|
|
177
|
-
n.length || (i(d), x(s)), n.forEach(function(
|
|
178
|
-
var w = a[
|
|
179
|
-
o.indexOf(
|
|
177
|
+
n.length || (i(d), x(s)), n.forEach(function(u) {
|
|
178
|
+
var w = a[u];
|
|
179
|
+
o.indexOf(u) !== -1 ? Xt(w, e, p) : Se(w, e, p);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
return f.catch(function(x) {
|
|
@@ -204,7 +204,7 @@ function Nt(a, t) {
|
|
|
204
204
|
};
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Bt(a, t) {
|
|
208
208
|
if (t) {
|
|
209
209
|
for (var e in t)
|
|
210
210
|
if (t.hasOwnProperty(e)) {
|
|
@@ -221,8 +221,8 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
221
221
|
}, ct, De = function() {
|
|
222
222
|
if (ct)
|
|
223
223
|
return ct;
|
|
224
|
-
var a = "[a-fA-F\\d:]", t = function(
|
|
225
|
-
return
|
|
224
|
+
var a = "[a-fA-F\\d:]", t = function(E) {
|
|
225
|
+
return E && E.includeBoundaries ? "(?:(?<=\\s|^)(?=" + a + ")|(?<=" + a + ")(?=\\s|$))" : "";
|
|
226
226
|
}, e = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", i = "[a-fA-F\\d]{1,4}", s = (`
|
|
227
227
|
(?:
|
|
228
228
|
(?:` + i + ":){7}(?:" + i + `|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
@@ -234,17 +234,17 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
234
234
|
(?:` + i + ":){1}(?:(?::" + i + "){0,4}:" + e + "|(?::" + i + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
235
235
|
(?::(?:(?::` + i + "){0,5}:" + e + "|(?::" + i + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
236
236
|
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
237
|
-
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), n = new RegExp("^" + s + "$"), h = function(
|
|
238
|
-
return
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), n = new RegExp("^" + s + "$"), h = function(E) {
|
|
238
|
+
return E && E.exact ? r : new RegExp("(?:" + t(E) + e + t(E) + ")|(?:" + t(E) + s + t(E) + ")", "g");
|
|
239
239
|
};
|
|
240
240
|
h.v4 = function(m) {
|
|
241
241
|
return m && m.exact ? o : new RegExp("" + t(m) + e + t(m), "g");
|
|
242
242
|
}, h.v6 = function(m) {
|
|
243
243
|
return m && m.exact ? n : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var c = "(?:(?:[a-z]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = h.v4().source, x = h.v6().source,
|
|
246
|
-
return ct = new RegExp("(?:^" +
|
|
247
|
-
},
|
|
245
|
+
var c = "(?:(?:[a-z]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = h.v4().source, x = h.v6().source, g = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", p = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", u = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?', C = "(?:" + c + "|www\\.)" + d + "(?:localhost|" + f + "|" + x + "|" + g + p + u + ")" + w + y;
|
|
246
|
+
return ct = new RegExp("(?:^" + C + "$)", "i"), ct;
|
|
247
|
+
}, Kt = {
|
|
248
248
|
// http://emailregex.com/
|
|
249
249
|
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
250
250
|
// url: new RegExp(
|
|
@@ -284,13 +284,13 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
284
284
|
return typeof t == "function";
|
|
285
285
|
},
|
|
286
286
|
email: function(t) {
|
|
287
|
-
return typeof t == "string" && t.length <= 320 && !!t.match(
|
|
287
|
+
return typeof t == "string" && t.length <= 320 && !!t.match(Kt.email);
|
|
288
288
|
},
|
|
289
289
|
url: function(t) {
|
|
290
290
|
return typeof t == "string" && t.length <= 2048 && !!t.match(De());
|
|
291
291
|
},
|
|
292
292
|
hex: function(t) {
|
|
293
|
-
return typeof t == "string" && !!t.match(
|
|
293
|
+
return typeof t == "string" && !!t.match(Kt.hex);
|
|
294
294
|
}
|
|
295
295
|
}, Fe = function(t, e, i, s, r) {
|
|
296
296
|
if (t.required && e === void 0) {
|
|
@@ -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, x = typeof e == "number",
|
|
304
|
-
if (x ? f = "number" :
|
|
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", g = typeof e == "string", p = Array.isArray(e);
|
|
304
|
+
if (x ? f = "number" : g ? f = "string" : p && (f = "array"), !f)
|
|
305
305
|
return !1;
|
|
306
|
-
p && (d = e.length),
|
|
306
|
+
p && (d = e.length), g && (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) {
|
|
@@ -315,27 +315,27 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
315
315
|
o.test(e) || s.push(D(r.messages.pattern.mismatch, t.fullField, e, t.pattern));
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
},
|
|
318
|
+
}, I = {
|
|
319
319
|
required: Ut,
|
|
320
320
|
whitespace: He,
|
|
321
321
|
type: Fe,
|
|
322
322
|
range: Xe,
|
|
323
323
|
enum: ke,
|
|
324
324
|
pattern: Ne
|
|
325
|
-
},
|
|
325
|
+
}, Be = function(t, e, i, s, r) {
|
|
326
326
|
var o = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
327
327
|
if (n) {
|
|
328
328
|
if (H(e, "string") && !t.required)
|
|
329
329
|
return i();
|
|
330
|
-
|
|
330
|
+
I.required(t, e, s, o, r, "string"), H(e, "string") || (I.type(t, e, s, o, r), I.range(t, e, s, o, r), I.pattern(t, e, s, o, r), t.whitespace === !0 && I.whitespace(t, e, s, o, r));
|
|
331
331
|
}
|
|
332
332
|
i(o);
|
|
333
|
-
},
|
|
333
|
+
}, Ke = function(t, e, i, s, r) {
|
|
334
334
|
var o = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
335
335
|
if (n) {
|
|
336
336
|
if (H(e) && !t.required)
|
|
337
337
|
return i();
|
|
338
|
-
|
|
338
|
+
I.required(t, e, s, o, r), e !== void 0 && I.type(t, e, s, o, r);
|
|
339
339
|
}
|
|
340
340
|
i(o);
|
|
341
341
|
}, Ye = function(t, e, i, s, r) {
|
|
@@ -343,7 +343,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
343
343
|
if (n) {
|
|
344
344
|
if (e === "" && (e = void 0), H(e) && !t.required)
|
|
345
345
|
return i();
|
|
346
|
-
|
|
346
|
+
I.required(t, e, s, o, r), e !== void 0 && (I.type(t, e, s, o, r), I.range(t, e, s, o, r));
|
|
347
347
|
}
|
|
348
348
|
i(o);
|
|
349
349
|
}, Ve = function(t, e, i, s, r) {
|
|
@@ -351,7 +351,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
351
351
|
if (n) {
|
|
352
352
|
if (H(e) && !t.required)
|
|
353
353
|
return i();
|
|
354
|
-
|
|
354
|
+
I.required(t, e, s, o, r), e !== void 0 && I.type(t, e, s, o, r);
|
|
355
355
|
}
|
|
356
356
|
i(o);
|
|
357
357
|
}, We = function(t, e, i, s, r) {
|
|
@@ -359,7 +359,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
359
359
|
if (n) {
|
|
360
360
|
if (H(e) && !t.required)
|
|
361
361
|
return i();
|
|
362
|
-
|
|
362
|
+
I.required(t, e, s, o, r), H(e) || I.type(t, e, s, o, r);
|
|
363
363
|
}
|
|
364
364
|
i(o);
|
|
365
365
|
}, Pe = function(t, e, i, s, r) {
|
|
@@ -367,7 +367,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
367
367
|
if (n) {
|
|
368
368
|
if (H(e) && !t.required)
|
|
369
369
|
return i();
|
|
370
|
-
|
|
370
|
+
I.required(t, e, s, o, r), e !== void 0 && (I.type(t, e, s, o, r), I.range(t, e, s, o, r));
|
|
371
371
|
}
|
|
372
372
|
i(o);
|
|
373
373
|
}, ze = function(t, e, i, s, r) {
|
|
@@ -375,7 +375,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
375
375
|
if (n) {
|
|
376
376
|
if (H(e) && !t.required)
|
|
377
377
|
return i();
|
|
378
|
-
|
|
378
|
+
I.required(t, e, s, o, r), e !== void 0 && (I.type(t, e, s, o, r), I.range(t, e, s, o, r));
|
|
379
379
|
}
|
|
380
380
|
i(o);
|
|
381
381
|
}, $e = function(t, e, i, s, r) {
|
|
@@ -383,7 +383,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
383
383
|
if (n) {
|
|
384
384
|
if (e == null && !t.required)
|
|
385
385
|
return i();
|
|
386
|
-
|
|
386
|
+
I.required(t, e, s, o, r, "array"), e != null && (I.type(t, e, s, o, r), I.range(t, e, s, o, r));
|
|
387
387
|
}
|
|
388
388
|
i(o);
|
|
389
389
|
}, Ge = function(t, e, i, s, r) {
|
|
@@ -391,7 +391,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
391
391
|
if (n) {
|
|
392
392
|
if (H(e) && !t.required)
|
|
393
393
|
return i();
|
|
394
|
-
|
|
394
|
+
I.required(t, e, s, o, r), e !== void 0 && I.type(t, e, s, o, r);
|
|
395
395
|
}
|
|
396
396
|
i(o);
|
|
397
397
|
}, qe = "enum", je = function(t, e, i, s, r) {
|
|
@@ -399,7 +399,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
399
399
|
if (n) {
|
|
400
400
|
if (H(e) && !t.required)
|
|
401
401
|
return i();
|
|
402
|
-
|
|
402
|
+
I.required(t, e, s, o, r), e !== void 0 && I[qe](t, e, s, o, r);
|
|
403
403
|
}
|
|
404
404
|
i(o);
|
|
405
405
|
}, Ue = function(t, e, i, s, r) {
|
|
@@ -407,7 +407,7 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
407
407
|
if (n) {
|
|
408
408
|
if (H(e, "string") && !t.required)
|
|
409
409
|
return i();
|
|
410
|
-
|
|
410
|
+
I.required(t, e, s, o, r), H(e, "string") || I.pattern(t, e, s, o, r);
|
|
411
411
|
}
|
|
412
412
|
i(o);
|
|
413
413
|
}, Ze = function(t, e, i, s, r) {
|
|
@@ -415,21 +415,21 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
415
415
|
if (n) {
|
|
416
416
|
if (H(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
|
-
if (
|
|
418
|
+
if (I.required(t, e, s, o, r), !H(e, "date")) {
|
|
419
419
|
var h;
|
|
420
|
-
e instanceof Date ? h = e : h = new Date(e),
|
|
420
|
+
e instanceof Date ? h = e : h = new Date(e), I.type(t, h, s, o, r), h && I.range(t, h.getTime(), s, o, r);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
i(o);
|
|
424
424
|
}, Je = function(t, e, i, s, r) {
|
|
425
425
|
var o = [], n = Array.isArray(e) ? "array" : typeof e;
|
|
426
|
-
|
|
426
|
+
I.required(t, e, s, o, r, n), i(o);
|
|
427
427
|
}, yt = function(t, e, i, s, r) {
|
|
428
428
|
var o = t.type, n = [], h = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
429
|
if (h) {
|
|
430
430
|
if (H(e, o) && !t.required)
|
|
431
431
|
return i();
|
|
432
|
-
|
|
432
|
+
I.required(t, e, s, n, r, o), H(e, o) || I.type(t, e, s, n, r);
|
|
433
433
|
}
|
|
434
434
|
i(n);
|
|
435
435
|
}, Qe = function(t, e, i, s, r) {
|
|
@@ -437,12 +437,12 @@ var Ut = function(t, e, i, s, r, o) {
|
|
|
437
437
|
if (n) {
|
|
438
438
|
if (H(e) && !t.required)
|
|
439
439
|
return i();
|
|
440
|
-
|
|
440
|
+
I.required(t, e, s, o, r);
|
|
441
441
|
}
|
|
442
442
|
i(o);
|
|
443
443
|
}, it = {
|
|
444
|
-
string:
|
|
445
|
-
method:
|
|
444
|
+
string: Be,
|
|
445
|
+
method: Ke,
|
|
446
446
|
number: Ye,
|
|
447
447
|
boolean: Ve,
|
|
448
448
|
regexp: We,
|
|
@@ -528,7 +528,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
528
528
|
s.rules[r] = Array.isArray(o) ? o : [o];
|
|
529
529
|
});
|
|
530
530
|
}, t.messages = function(i) {
|
|
531
|
-
return i && (this._messages =
|
|
531
|
+
return i && (this._messages = Bt(vt(), i)), this._messages;
|
|
532
532
|
}, t.validate = function(i, s, r) {
|
|
533
533
|
var o = this;
|
|
534
534
|
s === void 0 && (s = {}), r === void 0 && (r = function() {
|
|
@@ -536,97 +536,97 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
536
536
|
var n = i, h = s, c = r;
|
|
537
537
|
if (typeof h == "function" && (c = h, h = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
538
|
return c && c(null, n), Promise.resolve(n);
|
|
539
|
-
function d(
|
|
539
|
+
function d(u) {
|
|
540
540
|
var w = [], y = {};
|
|
541
|
-
function E
|
|
542
|
-
if (Array.isArray(
|
|
543
|
-
var
|
|
544
|
-
w = (
|
|
541
|
+
function C(E) {
|
|
542
|
+
if (Array.isArray(E)) {
|
|
543
|
+
var b;
|
|
544
|
+
w = (b = w).concat.apply(b, E);
|
|
545
545
|
} else
|
|
546
|
-
w.push(
|
|
546
|
+
w.push(E);
|
|
547
547
|
}
|
|
548
|
-
for (var m = 0; m <
|
|
549
|
-
|
|
550
|
-
w.length ? (y =
|
|
548
|
+
for (var m = 0; m < u.length; m++)
|
|
549
|
+
C(u[m]);
|
|
550
|
+
w.length ? (y = bt(w), c(w, y)) : c(null, n);
|
|
551
551
|
}
|
|
552
552
|
if (h.messages) {
|
|
553
553
|
var f = this.messages();
|
|
554
|
-
f === Rt && (f = vt()),
|
|
554
|
+
f === Rt && (f = vt()), Bt(f, h.messages), h.messages = f;
|
|
555
555
|
} else
|
|
556
556
|
h.messages = this.messages();
|
|
557
|
-
var x = {},
|
|
558
|
-
|
|
559
|
-
var w = o.rules[
|
|
560
|
-
w.forEach(function(
|
|
561
|
-
var m =
|
|
562
|
-
typeof m.transform == "function" && (n === i && (n = G({}, n)), y = n[
|
|
557
|
+
var x = {}, g = h.keys || Object.keys(this.rules);
|
|
558
|
+
g.forEach(function(u) {
|
|
559
|
+
var w = o.rules[u], y = n[u];
|
|
560
|
+
w.forEach(function(C) {
|
|
561
|
+
var m = C;
|
|
562
|
+
typeof m.transform == "function" && (n === i && (n = G({}, n)), y = n[u] = m.transform(y)), typeof m == "function" ? m = {
|
|
563
563
|
validator: m
|
|
564
|
-
} : m = G({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field =
|
|
564
|
+
} : m = G({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field = u, m.fullField = m.fullField || u, m.type = o.getType(m), x[u] = x[u] || [], x[u].push({
|
|
565
565
|
rule: m,
|
|
566
566
|
value: y,
|
|
567
567
|
source: n,
|
|
568
|
-
field:
|
|
568
|
+
field: u
|
|
569
569
|
}));
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
var p = {};
|
|
573
|
-
return
|
|
574
|
-
var y =
|
|
575
|
-
|
|
576
|
-
function m(R,
|
|
577
|
-
return G({},
|
|
573
|
+
return Ae(x, h, function(u, w) {
|
|
574
|
+
var y = u.rule, C = (y.type === "object" || y.type === "array") && (typeof y.fields == "object" || typeof y.defaultField == "object");
|
|
575
|
+
C = C && (y.required || !y.required && u.value), y.field = u.field;
|
|
576
|
+
function m(R, O) {
|
|
577
|
+
return G({}, O, {
|
|
578
578
|
fullField: y.fullField + "." + R,
|
|
579
579
|
fullFields: y.fullFields ? [].concat(y.fullFields, [R]) : [R]
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
|
-
function
|
|
582
|
+
function E(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
|
-
var
|
|
585
|
-
!h.suppressWarning &&
|
|
586
|
-
var
|
|
587
|
-
if (h.first &&
|
|
588
|
-
return p[y.field] = 1, w(
|
|
589
|
-
if (!
|
|
590
|
-
w(
|
|
584
|
+
var O = Array.isArray(R) ? R : [R];
|
|
585
|
+
!h.suppressWarning && O.length && a.warning("async-validator:", O), O.length && y.message !== void 0 && (O = [].concat(y.message));
|
|
586
|
+
var L = O.map(Nt(y, n));
|
|
587
|
+
if (h.first && L.length)
|
|
588
|
+
return p[y.field] = 1, w(L);
|
|
589
|
+
if (!C)
|
|
590
|
+
w(L);
|
|
591
591
|
else {
|
|
592
|
-
if (y.required && !
|
|
593
|
-
return y.message !== void 0 ?
|
|
594
|
-
var
|
|
595
|
-
y.defaultField && Object.keys(
|
|
596
|
-
|
|
597
|
-
}),
|
|
592
|
+
if (y.required && !u.value)
|
|
593
|
+
return y.message !== void 0 ? L = [].concat(y.message).map(Nt(y, n)) : h.error && (L = [h.error(y, D(h.messages.required, y.field))]), w(L);
|
|
594
|
+
var _ = {};
|
|
595
|
+
y.defaultField && Object.keys(u.value).map(function(S) {
|
|
596
|
+
_[S] = y.defaultField;
|
|
597
|
+
}), _ = G({}, _, u.rule.fields);
|
|
598
598
|
var v = {};
|
|
599
|
-
Object.keys(
|
|
600
|
-
var M =
|
|
601
|
-
v[
|
|
599
|
+
Object.keys(_).forEach(function(S) {
|
|
600
|
+
var M = _[S], T = Array.isArray(M) ? M : [M];
|
|
601
|
+
v[S] = T.map(m.bind(null, S));
|
|
602
602
|
});
|
|
603
|
-
var
|
|
604
|
-
|
|
603
|
+
var A = new a(v);
|
|
604
|
+
A.messages(h.messages), u.rule.options && (u.rule.options.messages = h.messages, u.rule.options.error = h.error), A.validate(u.value, u.rule.options || h, function(S) {
|
|
605
605
|
var M = [];
|
|
606
|
-
|
|
606
|
+
L && L.length && M.push.apply(M, L), S && S.length && M.push.apply(M, S), w(M.length ? M : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
var
|
|
610
|
+
var b;
|
|
611
611
|
if (y.asyncValidator)
|
|
612
|
-
|
|
612
|
+
b = y.asyncValidator(y, u.value, E, u.source, h);
|
|
613
613
|
else if (y.validator) {
|
|
614
614
|
try {
|
|
615
|
-
|
|
615
|
+
b = y.validator(y, u.value, E, u.source, h);
|
|
616
616
|
} catch (R) {
|
|
617
617
|
console.error == null || console.error(R), h.suppressValidatorError || setTimeout(function() {
|
|
618
618
|
throw R;
|
|
619
|
-
}, 0),
|
|
619
|
+
}, 0), E(R.message);
|
|
620
620
|
}
|
|
621
|
-
|
|
621
|
+
b === !0 ? E() : b === !1 ? E(typeof y.message == "function" ? y.message(y.fullField || y.field) : y.message || (y.fullField || y.field) + " fails") : b instanceof Array ? E(b) : b instanceof Error && E(b.message);
|
|
622
622
|
}
|
|
623
|
-
|
|
624
|
-
return
|
|
623
|
+
b && b.then && b.then(function() {
|
|
624
|
+
return E();
|
|
625
625
|
}, function(R) {
|
|
626
|
-
return
|
|
626
|
+
return E(R);
|
|
627
627
|
});
|
|
628
|
-
}, function(
|
|
629
|
-
d(
|
|
628
|
+
}, function(u) {
|
|
629
|
+
d(u);
|
|
630
630
|
}, n);
|
|
631
631
|
}, t.getType = function(i) {
|
|
632
632
|
if (i.type === void 0 && i.pattern instanceof RegExp && (i.type = "pattern"), typeof i.validator != "function" && i.type && !it.hasOwnProperty(i.type))
|
|
@@ -702,10 +702,10 @@ function te(a = [], t = 1, e = 0) {
|
|
|
702
702
|
};
|
|
703
703
|
});
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function _t(a = []) {
|
|
706
706
|
let t = [];
|
|
707
707
|
return a.forEach((e) => {
|
|
708
|
-
e.children ? t = t.concat(
|
|
708
|
+
e.children ? t = t.concat(_t(e.children)) : t.push(e);
|
|
709
709
|
}), t;
|
|
710
710
|
}
|
|
711
711
|
const Yt = /^(\r\n|\n\r|\r|\n)/, ei = /^[^\t\r\n]+/, Vt = /^\t/;
|
|
@@ -826,7 +826,7 @@ class se {
|
|
|
826
826
|
stageWidth: t,
|
|
827
827
|
config: { SCROLLER_TRACK_SIZE: e }
|
|
828
828
|
} = this.ctx;
|
|
829
|
-
return t - (this.ctx.header.width - this.x) - e
|
|
829
|
+
return t - (this.ctx.header.width - this.x) - e;
|
|
830
830
|
}
|
|
831
831
|
return this.x - this.ctx.scrollX;
|
|
832
832
|
}
|
|
@@ -1017,19 +1017,19 @@ class Tt extends se {
|
|
|
1017
1017
|
if (this.type === "tree" && s === "body") {
|
|
1018
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
|
-
const
|
|
1021
|
-
n = "loading", r =
|
|
1020
|
+
const u = this.ctx.icons.get("loading");
|
|
1021
|
+
n = "loading", r = u, o = x * 8;
|
|
1022
1022
|
} else if (d) {
|
|
1023
|
-
const
|
|
1024
|
-
r = c ? w :
|
|
1023
|
+
const u = this.ctx.icons.get("expand"), w = this.ctx.icons.get("shrink");
|
|
1024
|
+
r = c ? w : u, n = c ? "shrink" : "expand", o = x * 8;
|
|
1025
1025
|
} else
|
|
1026
1026
|
o = x * 8;
|
|
1027
|
-
let
|
|
1027
|
+
let g = 20, p = 20;
|
|
1028
1028
|
if (r) {
|
|
1029
|
-
let
|
|
1030
|
-
this.ctx.paint.drawImage(r,
|
|
1029
|
+
let u = this.drawX + o + e, w = this.drawY + (this.visibleHeight - p) / 2;
|
|
1030
|
+
this.ctx.paint.drawImage(r, u, w, g, p), this.drawImageX = u, this.drawImageY = w, this.drawImageWidth = g, 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 + g - 0.5;
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
1035
1035
|
updateContainer() {
|
|
@@ -1043,33 +1043,35 @@ class Tt extends se {
|
|
|
1043
1043
|
HIGHLIGHT_SELECTED_ROW: h,
|
|
1044
1044
|
HIGHLIGHT_SELECTED_ROW_COLOR: c,
|
|
1045
1045
|
HIGHLIGHT_HOVER_ROW: d,
|
|
1046
|
-
HIGHLIGHT_HOVER_ROW_COLOR: f
|
|
1046
|
+
HIGHLIGHT_HOVER_ROW_COLOR: f,
|
|
1047
|
+
STRIPE: x,
|
|
1048
|
+
STRIPE_COLOR: g
|
|
1047
1049
|
} = this.ctx.config;
|
|
1048
1050
|
if (this.cellType === "footer") {
|
|
1049
|
-
let
|
|
1051
|
+
let m = n, E = o;
|
|
1050
1052
|
if (typeof r == "function") {
|
|
1051
|
-
const
|
|
1053
|
+
const b = r, { backgroundColor: R, color: O } = b({
|
|
1052
1054
|
row: this.row,
|
|
1053
1055
|
rowIndex: this.rowIndex,
|
|
1054
1056
|
colIndex: this.colIndex,
|
|
1055
1057
|
column: this.column,
|
|
1056
1058
|
value: this.getValue()
|
|
1057
1059
|
}) || {};
|
|
1058
|
-
|
|
1060
|
+
R && (m = R), O && (E = O);
|
|
1059
1061
|
}
|
|
1060
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor =
|
|
1062
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = m, this.drawTextColor = E;
|
|
1061
1063
|
return;
|
|
1062
1064
|
}
|
|
1063
|
-
let
|
|
1064
|
-
const u = this.ctx.focusCell,
|
|
1065
|
-
d && (
|
|
1066
|
-
let
|
|
1065
|
+
let p = "transparent";
|
|
1066
|
+
const u = this.ctx.focusCell, w = this.ctx.hoverCell;
|
|
1067
|
+
d && (w == null ? void 0 : w.rowKey) === this.rowKey && (p = f), h && (u == null ? void 0 : u.rowKey) === this.rowKey && (p = c), this.drawCellSkyBgColor = p;
|
|
1068
|
+
let y = e, C = o;
|
|
1067
1069
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
1068
1070
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
1069
1071
|
return;
|
|
1070
1072
|
}
|
|
1071
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (
|
|
1072
|
-
const
|
|
1073
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (y = i, C = o), x && (this.rowIndex % 2 ? y = g : y = e), typeof s == "function") {
|
|
1074
|
+
const m = s, { backgroundColor: E, color: b } = m({
|
|
1073
1075
|
row: this.row,
|
|
1074
1076
|
rowIndex: this.rowIndex,
|
|
1075
1077
|
colIndex: this.colIndex,
|
|
@@ -1077,16 +1079,16 @@ class Tt extends se {
|
|
|
1077
1079
|
isHasChanged: this.isHasChanged,
|
|
1078
1080
|
value: this.getValue()
|
|
1079
1081
|
}) || {};
|
|
1080
|
-
E && (
|
|
1082
|
+
E && (y = E), b && (C = b);
|
|
1081
1083
|
}
|
|
1082
|
-
this.drawCellBgColor =
|
|
1084
|
+
this.drawCellBgColor = y, this.drawTextColor = C;
|
|
1083
1085
|
}
|
|
1084
1086
|
updateSelection() {
|
|
1085
1087
|
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex: h, rowKey: c } = this;
|
|
1086
1088
|
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: x = 0 } = this.ctx.config,
|
|
1088
|
-
let
|
|
1089
|
-
d && f ? (
|
|
1089
|
+
const d = this.ctx.database.getRowSelection(c), f = this.ctx.database.getRowSelectable(c), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, g = this.drawX + (e - x) / 2, p = this.drawY + (i - x) / 2;
|
|
1090
|
+
let u = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
1091
|
+
d && f ? (u = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : d && f ? (u = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !d && f ? (u = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (u = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), u && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = g, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = u) : u && n === "selection" && (this.drawImageX = g, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = u);
|
|
1090
1092
|
}
|
|
1091
1093
|
}
|
|
1092
1094
|
updateHoverIcon() {
|
|
@@ -1171,19 +1173,45 @@ class Tt extends se {
|
|
|
1171
1173
|
userSelect: "none"
|
|
1172
1174
|
};
|
|
1173
1175
|
}
|
|
1174
|
-
|
|
1176
|
+
drawContainer() {
|
|
1175
1177
|
const {
|
|
1176
1178
|
paint: e,
|
|
1177
|
-
config: { BORDER_COLOR: i }
|
|
1178
|
-
} = this.ctx, { drawX:
|
|
1179
|
-
e.drawRect(
|
|
1180
|
-
borderColor: i,
|
|
1179
|
+
config: { BORDER_COLOR: i, BORDER: s }
|
|
1180
|
+
} = this.ctx, { drawX: r, drawY: o } = this;
|
|
1181
|
+
e.drawRect(r, o, this.visibleWidth, this.visibleHeight, {
|
|
1182
|
+
borderColor: s ? i : "transparent",
|
|
1181
1183
|
fillColor: this.drawCellBgColor
|
|
1182
|
-
}), e.drawRect(
|
|
1184
|
+
}), e.drawRect(r, o, this.width, this.height, {
|
|
1183
1185
|
borderColor: "transparent",
|
|
1184
|
-
borderWidth: 1,
|
|
1185
1186
|
fillColor: this.drawCellSkyBgColor
|
|
1186
|
-
}),
|
|
1187
|
+
}), s || this.ctx.paint.drawLine(
|
|
1188
|
+
[r, o + this.visibleHeight, r + this.visibleWidth, o + this.visibleHeight],
|
|
1189
|
+
{
|
|
1190
|
+
borderColor: i,
|
|
1191
|
+
fillColor: i,
|
|
1192
|
+
borderWidth: 1,
|
|
1193
|
+
lineCap: "round",
|
|
1194
|
+
lineJoin: "round"
|
|
1195
|
+
}
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
drawAutofillPiont() {
|
|
1199
|
+
if (this.cellType === "footer")
|
|
1200
|
+
return;
|
|
1201
|
+
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: r } = this.ctx.config;
|
|
1202
|
+
if (!s || !i || this.ctx.editing)
|
|
1203
|
+
return;
|
|
1204
|
+
const { xArr: o, yArr: n } = this.ctx.selector, h = o[1], c = n[1], { colIndex: d, rowIndex: f, drawX: x, drawY: g } = this;
|
|
1205
|
+
if (d === h && f === c) {
|
|
1206
|
+
const u = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
|
|
1207
|
+
this.ctx.paint.drawRect(x + this.width - u, g + this.height - u, 6, 6, {
|
|
1208
|
+
borderColor: r,
|
|
1209
|
+
fillColor: e
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
draw() {
|
|
1214
|
+
this.drawText(), this.drawImage(), this.drawSelector(), this.drawAutofillPiont(), this.drawErrorTip();
|
|
1187
1215
|
}
|
|
1188
1216
|
/**
|
|
1189
1217
|
* 根据列的索引获取列的宽度
|
|
@@ -1225,18 +1253,6 @@ class Tt extends se {
|
|
|
1225
1253
|
this.drawImageHeight
|
|
1226
1254
|
);
|
|
1227
1255
|
}
|
|
1228
|
-
drawAutofillPiont() {
|
|
1229
|
-
if (this.cellType === "footer")
|
|
1230
|
-
return;
|
|
1231
|
-
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: r } = this.ctx.config;
|
|
1232
|
-
if (!s || !i)
|
|
1233
|
-
return;
|
|
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
|
-
borderColor: r,
|
|
1237
|
-
fillColor: e
|
|
1238
|
-
});
|
|
1239
|
-
}
|
|
1240
1256
|
drawSelector() {
|
|
1241
1257
|
if (this.cellType === "footer")
|
|
1242
1258
|
return;
|
|
@@ -1294,39 +1310,53 @@ class Tt extends se {
|
|
|
1294
1310
|
});
|
|
1295
1311
|
}
|
|
1296
1312
|
drawBorder(e) {
|
|
1297
|
-
const { drawX: i, drawY: s,
|
|
1298
|
-
let
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1313
|
+
const { drawX: i, drawY: s, rowIndex: r, colIndex: o, height: n, width: h } = this;
|
|
1314
|
+
let c = i, d = s;
|
|
1315
|
+
const { xArr: f, yArr: x, lineDash: g = [], borderWidth: p = 1, borderColor: u, fillColor: w } = e, y = f[0], C = f[1], m = x[0], E = x[1];
|
|
1316
|
+
if (o >= y && o <= C && r === m) {
|
|
1317
|
+
const b = o === C ? 1 : 0, R = o === y ? 1 : 0;
|
|
1318
|
+
this.ctx.paint.drawLine([c + R, d + 1, c + h - b, d + 1], {
|
|
1319
|
+
borderColor: u,
|
|
1320
|
+
fillColor: w,
|
|
1321
|
+
borderWidth: p,
|
|
1322
|
+
lineCap: "round",
|
|
1323
|
+
lineJoin: "round",
|
|
1324
|
+
lineDash: g
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
if (o === C && r >= m && r <= E) {
|
|
1328
|
+
const b = r === m ? 1 : 0, R = r === E ? 1 : 0;
|
|
1329
|
+
this.ctx.paint.drawLine([c + h - 1, d + b, c + h - 1, d + n - R], {
|
|
1330
|
+
borderColor: u,
|
|
1331
|
+
fillColor: w,
|
|
1332
|
+
borderWidth: p,
|
|
1333
|
+
lineCap: "round",
|
|
1334
|
+
lineJoin: "round",
|
|
1335
|
+
lineDash: g
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
if (o >= y && o <= C && r === E) {
|
|
1339
|
+
const b = o === C ? 1 : 0, R = o === y ? 1 : 0;
|
|
1340
|
+
this.ctx.paint.drawLine([c + R, d + n - 1, c + h - b, d + n - 1], {
|
|
1341
|
+
borderColor: u,
|
|
1342
|
+
fillColor: w,
|
|
1343
|
+
borderWidth: p,
|
|
1344
|
+
lineCap: "round",
|
|
1345
|
+
lineJoin: "round",
|
|
1346
|
+
lineDash: g
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
if (o === y && r >= m && r <= E) {
|
|
1350
|
+
const b = r === E ? 1 : 0, R = r === m ? 1 : 0;
|
|
1351
|
+
this.ctx.paint.drawLine([c + 1, d + R, c + 1, d + n - b], {
|
|
1352
|
+
borderColor: u,
|
|
1353
|
+
fillColor: w,
|
|
1354
|
+
borderWidth: p,
|
|
1355
|
+
lineCap: "round",
|
|
1356
|
+
lineJoin: "round",
|
|
1357
|
+
lineDash: g
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1330
1360
|
}
|
|
1331
1361
|
}
|
|
1332
1362
|
class ni {
|
|
@@ -1342,11 +1372,18 @@ class ni {
|
|
|
1342
1372
|
l(this, "headerMap", /* @__PURE__ */ new Map());
|
|
1343
1373
|
l(this, "rowIndexRowKeyMap", /* @__PURE__ */ new Map());
|
|
1344
1374
|
l(this, "checkboxKeyMap", /* @__PURE__ */ new Map());
|
|
1375
|
+
l(this, "selectionMap", /* @__PURE__ */ new Map());
|
|
1345
1376
|
l(this, "originalDataMap", /* @__PURE__ */ new Map());
|
|
1346
1377
|
l(this, "changedDataMap", /* @__PURE__ */ new Map());
|
|
1347
1378
|
l(this, "validationErrorMap", /* @__PURE__ */ new Map());
|
|
1348
1379
|
l(this, "itemRowKeyMap", /* @__PURE__ */ new WeakMap());
|
|
1349
1380
|
l(this, "bufferData", []);
|
|
1381
|
+
l(this, "bufferCheckState", {
|
|
1382
|
+
buffer: !1,
|
|
1383
|
+
check: !1,
|
|
1384
|
+
indeterminate: !1,
|
|
1385
|
+
selectable: !0
|
|
1386
|
+
});
|
|
1350
1387
|
l(this, "sumHeight", 0);
|
|
1351
1388
|
l(this, "filterMethod");
|
|
1352
1389
|
l(this, "positions", []);
|
|
@@ -1355,7 +1392,9 @@ class ni {
|
|
|
1355
1392
|
this.data = i, this.footerData = r, this.columns = s, this.setLoading(!0), this.init();
|
|
1356
1393
|
}
|
|
1357
1394
|
init() {
|
|
1358
|
-
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear(), this.itemRowKeyMap = /* @__PURE__ */ new WeakMap()
|
|
1395
|
+
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear(), this.itemRowKeyMap = /* @__PURE__ */ new WeakMap();
|
|
1396
|
+
const { ROW_KEY: t, ENABLE_RESERVE_SELECTION: e } = this.ctx.config;
|
|
1397
|
+
e && t || this.selectionMap.clear(), this.initData(this.data), this.getData();
|
|
1359
1398
|
}
|
|
1360
1399
|
/**
|
|
1361
1400
|
* 清除缓存数据
|
|
@@ -1370,28 +1409,33 @@ class ni {
|
|
|
1370
1409
|
*/
|
|
1371
1410
|
initData(t, e = 0) {
|
|
1372
1411
|
t.forEach((i, s) => {
|
|
1412
|
+
var w;
|
|
1373
1413
|
let r = i._hasChildren || !1;
|
|
1374
1414
|
Array.isArray(i.children) && i.children.length && (r = !0, this.initData(i.children, e + 1));
|
|
1375
1415
|
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
1416
|
this.itemRowKeyMap.set(i, x);
|
|
1377
|
-
const
|
|
1378
|
-
let
|
|
1379
|
-
if (typeof c == "function" && (
|
|
1380
|
-
const
|
|
1381
|
-
if (this.checkboxKeyMap.has(
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1417
|
+
const g = i._height || h, p = i._readonly;
|
|
1418
|
+
let u = !0;
|
|
1419
|
+
if (typeof c == "function" && (u = c), d) {
|
|
1420
|
+
const y = i[d];
|
|
1421
|
+
if (this.checkboxKeyMap.has(y)) {
|
|
1422
|
+
const C = this.checkboxKeyMap.get(y) || [];
|
|
1423
|
+
C.push(x), this.checkboxKeyMap.set(y, C);
|
|
1384
1424
|
} else
|
|
1385
|
-
this.checkboxKeyMap.set(
|
|
1425
|
+
this.checkboxKeyMap.set(y, [x]);
|
|
1386
1426
|
}
|
|
1387
|
-
this.
|
|
1427
|
+
this.selectionMap.set(x, {
|
|
1428
|
+
key: d ? i[d] : x,
|
|
1429
|
+
row: i,
|
|
1430
|
+
check: ((w = this.selectionMap.get(x)) == null ? void 0 : w.check) || !1
|
|
1431
|
+
}), this.rowKeyMap.set(x, {
|
|
1388
1432
|
readonly: p,
|
|
1389
1433
|
index: s,
|
|
1390
1434
|
rowIndex: s,
|
|
1391
1435
|
level: e,
|
|
1392
|
-
height:
|
|
1436
|
+
height: g,
|
|
1393
1437
|
check: !1,
|
|
1394
|
-
selectable:
|
|
1438
|
+
selectable: u,
|
|
1395
1439
|
expand: n,
|
|
1396
1440
|
expandLazy: !1,
|
|
1397
1441
|
hasChildren: r,
|
|
@@ -1602,45 +1646,50 @@ class ni {
|
|
|
1602
1646
|
async batchSetItemValue(t, e = !1) {
|
|
1603
1647
|
let i = [];
|
|
1604
1648
|
const s = /* @__PURE__ */ new Set();
|
|
1605
|
-
let r = t
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
value:
|
|
1612
|
-
oldValue:
|
|
1613
|
-
row:
|
|
1614
|
-
}))
|
|
1615
|
-
|
|
1649
|
+
let r = [], o = t.map((d) => {
|
|
1650
|
+
const { rowKey: f, key: x } = d;
|
|
1651
|
+
let g = d.value, p = g;
|
|
1652
|
+
const u = this.getRowDataItemForRowKey(f), w = this.getItemValue(f, x), y = this.getVirtualBodyCellByKey(f, x);
|
|
1653
|
+
return (y == null ? void 0 : y.type) === "number" && (["", void 0, null].includes(g) ? p = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? p = Number(g) : (p = w, r.push({
|
|
1654
|
+
...d,
|
|
1655
|
+
value: p,
|
|
1656
|
+
oldValue: w,
|
|
1657
|
+
row: u
|
|
1658
|
+
}))), {
|
|
1659
|
+
...d,
|
|
1660
|
+
value: p,
|
|
1661
|
+
oldValue: w,
|
|
1662
|
+
row: u
|
|
1663
|
+
};
|
|
1664
|
+
});
|
|
1665
|
+
if (o = o.filter((d) => !r.some((f) => d.rowKey === f.rowKey && d.key === f.key)), r.length) {
|
|
1666
|
+
const d = {
|
|
1667
|
+
code: "ERR_BATCH_SET_NUMBER_VALUE",
|
|
1668
|
+
message: "Assignment failed, not a numeric type",
|
|
1669
|
+
data: r
|
|
1670
|
+
};
|
|
1671
|
+
this.ctx.emit("error", d);
|
|
1616
1672
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1673
|
+
if (!o.length)
|
|
1674
|
+
return;
|
|
1675
|
+
const { BEFORE_VALUE_CHANGE_METHOD: n } = this.ctx.config;
|
|
1676
|
+
typeof n == "function" && (o = await n(o)), o.forEach((d) => {
|
|
1677
|
+
const { value: f, rowKey: x, key: g, oldValue: p } = d;
|
|
1678
|
+
s.add(x), this.setItemValue(x, g, f), i.push({
|
|
1620
1679
|
rowKey: x,
|
|
1621
|
-
key:
|
|
1680
|
+
key: g,
|
|
1622
1681
|
oldValue: p,
|
|
1623
1682
|
newValue: f
|
|
1624
1683
|
});
|
|
1625
1684
|
});
|
|
1626
|
-
let
|
|
1627
|
-
const h = i.map((d) => {
|
|
1628
|
-
const f = this.ctx.database.getRowDataItemForRowKey(d.rowKey);
|
|
1629
|
-
return {
|
|
1630
|
-
rowKey: d.rowKey,
|
|
1631
|
-
key: d.key,
|
|
1632
|
-
value: d.newValue,
|
|
1633
|
-
oldValue: d.oldValue,
|
|
1634
|
-
row: f
|
|
1635
|
-
};
|
|
1636
|
-
});
|
|
1685
|
+
let h = [];
|
|
1637
1686
|
s.forEach((d) => {
|
|
1638
|
-
|
|
1687
|
+
h.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
1639
1688
|
});
|
|
1640
|
-
const c =
|
|
1689
|
+
const c = o.map(({ rowKey: d, key: f }) => this.getValidator(d, f));
|
|
1641
1690
|
Promise.all(c).then(() => {
|
|
1642
1691
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1643
|
-
}), this.ctx.emit("change",
|
|
1692
|
+
}), this.ctx.emit("change", o, h), e && this.ctx.history.pushState({
|
|
1644
1693
|
changeList: i,
|
|
1645
1694
|
scrollX: this.ctx.scrollX,
|
|
1646
1695
|
scrollY: this.ctx.scrollY,
|
|
@@ -1661,58 +1710,85 @@ class ni {
|
|
|
1661
1710
|
if (!this.rowKeyMap.has(t))
|
|
1662
1711
|
return {};
|
|
1663
1712
|
const { item: n } = this.rowKeyMap.get(t);
|
|
1664
|
-
let h = n[e];
|
|
1713
|
+
let h = n[e], c = i;
|
|
1665
1714
|
if (this.ctx.database.getReadonly(t, e))
|
|
1666
1715
|
return {
|
|
1667
1716
|
oldValue: h,
|
|
1668
1717
|
newValue: h
|
|
1669
1718
|
};
|
|
1670
1719
|
n[e] !== null && typeof n[e] == "object" && (h = JSON.parse(JSON.stringify(n[e])));
|
|
1671
|
-
const
|
|
1672
|
-
this.originalDataMap.has(
|
|
1673
|
-
const
|
|
1674
|
-
let f = i;
|
|
1720
|
+
const d = `${t}_${e}`;
|
|
1721
|
+
this.originalDataMap.has(d) || this.originalDataMap.set(d, h);
|
|
1722
|
+
const f = this.originalDataMap.get(d), x = this.getRowDataItemForRowKey(t);
|
|
1675
1723
|
if (o) {
|
|
1676
|
-
const
|
|
1677
|
-
if (
|
|
1678
|
-
|
|
1724
|
+
const g = this.getVirtualBodyCellByKey(t, e);
|
|
1725
|
+
if ((g == null ? void 0 : g.type) === "number")
|
|
1726
|
+
if (["", void 0, null].includes(i))
|
|
1727
|
+
c = null;
|
|
1728
|
+
else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
|
|
1729
|
+
c = Number(i);
|
|
1730
|
+
else {
|
|
1731
|
+
c = h;
|
|
1732
|
+
const w = {
|
|
1733
|
+
code: "ERR_SET_NUMBER_VALUE",
|
|
1734
|
+
message: "Assignment failed, not a numeric type",
|
|
1735
|
+
data: [
|
|
1736
|
+
{
|
|
1737
|
+
rowKey: t,
|
|
1738
|
+
key: e,
|
|
1739
|
+
value: c,
|
|
1740
|
+
oldValue: h,
|
|
1741
|
+
row: x
|
|
1742
|
+
}
|
|
1743
|
+
]
|
|
1744
|
+
};
|
|
1745
|
+
this.ctx.emit("error", w);
|
|
1746
|
+
}
|
|
1747
|
+
if (c === h)
|
|
1748
|
+
return {
|
|
1749
|
+
oldValue: h,
|
|
1750
|
+
newValue: h
|
|
1751
|
+
};
|
|
1752
|
+
const { BEFORE_VALUE_CHANGE_METHOD: p } = this.ctx.config;
|
|
1753
|
+
if (typeof p == "function") {
|
|
1754
|
+
const y = await p([
|
|
1679
1755
|
{
|
|
1680
1756
|
rowKey: t,
|
|
1681
1757
|
key: e,
|
|
1682
|
-
value:
|
|
1758
|
+
value: c,
|
|
1683
1759
|
oldValue: n[e],
|
|
1684
|
-
row:
|
|
1760
|
+
row: x
|
|
1685
1761
|
}
|
|
1686
1762
|
]);
|
|
1687
|
-
|
|
1763
|
+
y && y.length && (c = y[0].value);
|
|
1688
1764
|
}
|
|
1689
|
-
this.changedDataMap.set(
|
|
1690
|
-
const u =
|
|
1765
|
+
this.changedDataMap.set(d, c), n[e] = c;
|
|
1766
|
+
const u = {
|
|
1691
1767
|
rowKey: t,
|
|
1692
1768
|
key: e,
|
|
1693
1769
|
oldValue: h,
|
|
1694
|
-
value:
|
|
1695
|
-
row:
|
|
1770
|
+
value: c,
|
|
1771
|
+
row: x
|
|
1696
1772
|
};
|
|
1697
1773
|
this.getValidator(t, e).then(() => {
|
|
1698
1774
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1699
|
-
}), this.ctx.emit("change", [
|
|
1775
|
+
}), this.ctx.emit("change", [u], [x]), this.ctx.emit("editChange", {
|
|
1700
1776
|
rowKey: t,
|
|
1701
1777
|
key: e,
|
|
1702
1778
|
oldValue: h,
|
|
1703
|
-
value:
|
|
1704
|
-
originalValue:
|
|
1705
|
-
row:
|
|
1779
|
+
value: c,
|
|
1780
|
+
originalValue: f,
|
|
1781
|
+
row: x
|
|
1706
1782
|
});
|
|
1707
1783
|
} else
|
|
1708
|
-
this.changedDataMap.set(
|
|
1784
|
+
this.changedDataMap.set(d, c), n[e] = c;
|
|
1709
1785
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1710
1786
|
rowKey: t,
|
|
1711
1787
|
key: e,
|
|
1712
1788
|
oldValue: h,
|
|
1713
|
-
value:
|
|
1714
|
-
originalValue: this.originalDataMap.get(
|
|
1715
|
-
row:
|
|
1789
|
+
value: c,
|
|
1790
|
+
originalValue: this.originalDataMap.get(d),
|
|
1791
|
+
row: x
|
|
1716
1792
|
}), s && this.ctx.history.pushState({
|
|
1717
1793
|
type: "single",
|
|
1718
1794
|
scrollX: this.ctx.scrollX,
|
|
@@ -1722,12 +1798,12 @@ class ni {
|
|
|
1722
1798
|
rowKey: t,
|
|
1723
1799
|
key: e,
|
|
1724
1800
|
oldValue: h,
|
|
1725
|
-
newValue:
|
|
1801
|
+
newValue: c
|
|
1726
1802
|
}
|
|
1727
1803
|
]
|
|
1728
1804
|
}), r && this.ctx.emit("draw"), {
|
|
1729
1805
|
oldValue: h,
|
|
1730
|
-
newValue:
|
|
1806
|
+
newValue: c
|
|
1731
1807
|
};
|
|
1732
1808
|
}
|
|
1733
1809
|
/**
|
|
@@ -1753,8 +1829,8 @@ class ni {
|
|
|
1753
1829
|
return !1;
|
|
1754
1830
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1755
1831
|
this.checkboxKeyMap.has(r) && (this.checkboxKeyMap.get(r) || []).forEach((n) => {
|
|
1756
|
-
const h = this.
|
|
1757
|
-
h.check = e;
|
|
1832
|
+
const h = this.selectionMap.get(n);
|
|
1833
|
+
h && (h.check = e);
|
|
1758
1834
|
});
|
|
1759
1835
|
}
|
|
1760
1836
|
}
|
|
@@ -1763,25 +1839,29 @@ class ni {
|
|
|
1763
1839
|
* @param rowKey
|
|
1764
1840
|
*/
|
|
1765
1841
|
toggleRowSelection(t) {
|
|
1766
|
-
const e = this.rowKeyMap.get(t);
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
this.
|
|
1842
|
+
const e = this.rowKeyMap.get(t), i = this.selectionMap.get(t);
|
|
1843
|
+
if (!i)
|
|
1844
|
+
return;
|
|
1845
|
+
i.check = !i.check, this.setRowSelectionByCheckboxKey(t, i.check), this.ctx.emit("toggleRowSelection", e);
|
|
1846
|
+
const s = this.getSelectionRows();
|
|
1847
|
+
this.ctx.emit("selectionChange", s), this.bufferCheckState.buffer = !1, this.ctx.emit("draw");
|
|
1770
1848
|
}
|
|
1771
1849
|
/**
|
|
1772
1850
|
* 根据rowKey 设置选中状态
|
|
1773
1851
|
* @param rowKey
|
|
1774
1852
|
*/
|
|
1775
|
-
setRowSelection(t, e) {
|
|
1776
|
-
const
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
this.
|
|
1853
|
+
setRowSelection(t, e, i = !0) {
|
|
1854
|
+
const s = this.selectionMap.get(t);
|
|
1855
|
+
if (!s)
|
|
1856
|
+
return;
|
|
1857
|
+
s.check = e, this.setRowSelectionByCheckboxKey(t, s.check);
|
|
1858
|
+
const r = this.getSelectionRows();
|
|
1859
|
+
this.ctx.emit("setRowSelection", r), i && (this.bufferCheckState.buffer = !1, this.ctx.emit("draw"));
|
|
1780
1860
|
}
|
|
1781
1861
|
getSelectionRows() {
|
|
1782
1862
|
let t = [];
|
|
1783
|
-
return this.
|
|
1784
|
-
e.check && t.push(e.
|
|
1863
|
+
return this.selectionMap.forEach((e) => {
|
|
1864
|
+
e.check && t.push(e.row);
|
|
1785
1865
|
}), t;
|
|
1786
1866
|
}
|
|
1787
1867
|
/**
|
|
@@ -1789,8 +1869,8 @@ class ni {
|
|
|
1789
1869
|
* @param rowKey
|
|
1790
1870
|
*/
|
|
1791
1871
|
getRowSelection(t) {
|
|
1792
|
-
const
|
|
1793
|
-
return e;
|
|
1872
|
+
const e = this.selectionMap.get(t);
|
|
1873
|
+
return e ? e.check : !1;
|
|
1794
1874
|
}
|
|
1795
1875
|
/**
|
|
1796
1876
|
* 根据rowKey 获取选中状态
|
|
@@ -1808,50 +1888,59 @@ class ni {
|
|
|
1808
1888
|
* @param rowKey
|
|
1809
1889
|
*/
|
|
1810
1890
|
toggleAllSelection() {
|
|
1811
|
-
this.rowKeyMap.forEach((e) => {
|
|
1812
|
-
|
|
1813
|
-
typeof
|
|
1891
|
+
this.rowKeyMap.forEach((e, i) => {
|
|
1892
|
+
let s = e.selectable;
|
|
1893
|
+
typeof s == "function" && (s = s({
|
|
1814
1894
|
row: e.item,
|
|
1815
1895
|
rowIndex: e.rowIndex
|
|
1816
|
-
}) && (
|
|
1896
|
+
})), s && this.setRowSelection(i, !0, !1);
|
|
1817
1897
|
});
|
|
1818
1898
|
const t = this.getSelectionRows();
|
|
1819
|
-
this.ctx.emit("toggleAllSelection", t), this.ctx.emit("selectionChange", t), this.ctx.emit("draw");
|
|
1899
|
+
this.ctx.emit("toggleAllSelection", t), this.ctx.emit("selectionChange", t), this.bufferCheckState.buffer = !1, this.ctx.emit("draw");
|
|
1820
1900
|
}
|
|
1821
1901
|
/**
|
|
1822
1902
|
* 清除选中
|
|
1823
1903
|
* @param rowKey
|
|
1824
1904
|
*/
|
|
1825
|
-
clearSelection() {
|
|
1826
|
-
this.rowKeyMap.forEach((
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
rowIndex: e.rowIndex
|
|
1831
|
-
}) && (e.check = !1) : i && (e.check = !1);
|
|
1905
|
+
clearSelection(t = !1) {
|
|
1906
|
+
t ? this.rowKeyMap.forEach((i, s) => {
|
|
1907
|
+
this.setRowSelection(s, !1, !1);
|
|
1908
|
+
}) : this.selectionMap.forEach((i, s) => {
|
|
1909
|
+
this.setRowSelection(s, !1, !1);
|
|
1832
1910
|
});
|
|
1833
|
-
const
|
|
1834
|
-
this.ctx.emit("clearSelection"), this.ctx.emit("selectionChange",
|
|
1911
|
+
const e = this.getSelectionRows();
|
|
1912
|
+
this.ctx.emit("clearSelection"), this.ctx.emit("selectionChange", e), this.bufferCheckState.buffer = !1, this.ctx.emit("draw");
|
|
1835
1913
|
}
|
|
1836
1914
|
/**
|
|
1837
1915
|
* 获取选中状态,表头用
|
|
1838
1916
|
* @param rowKey
|
|
1839
1917
|
*/
|
|
1840
1918
|
getCheckedState() {
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1919
|
+
const { buffer: t, ...e } = this.bufferCheckState;
|
|
1920
|
+
if (t)
|
|
1921
|
+
return e;
|
|
1922
|
+
const i = this.rowKeyMap.size;
|
|
1923
|
+
let s = 0, r = 0;
|
|
1924
|
+
const o = this.selectionMap.size, n = Array.from(this.selectionMap.values()).some((x) => x.check);
|
|
1925
|
+
this.rowKeyMap.forEach((x, g) => {
|
|
1926
|
+
var u;
|
|
1927
|
+
(u = this.selectionMap.get(g)) != null && u.check && (s += 1);
|
|
1928
|
+
let p = x.selectable;
|
|
1929
|
+
typeof p == "function" && (p = p({
|
|
1930
|
+
row: x.item,
|
|
1931
|
+
rowIndex: x.rowIndex
|
|
1932
|
+
})), p && (r += 1);
|
|
1849
1933
|
});
|
|
1850
|
-
const i =
|
|
1851
|
-
return {
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1934
|
+
const h = o > i && s === 0 && n, c = r && r > s && s > 0 || h, d = r !== 0, f = !!r && r === s;
|
|
1935
|
+
return this.bufferCheckState = {
|
|
1936
|
+
buffer: !0,
|
|
1937
|
+
check: f,
|
|
1938
|
+
indeterminate: c,
|
|
1939
|
+
selectable: d
|
|
1940
|
+
}, {
|
|
1941
|
+
check: f,
|
|
1942
|
+
indeterminate: c,
|
|
1943
|
+
selectable: d
|
|
1855
1944
|
};
|
|
1856
1945
|
}
|
|
1857
1946
|
/**
|
|
@@ -1869,6 +1958,11 @@ class ni {
|
|
|
1869
1958
|
if (e && this.headerMap.has(e))
|
|
1870
1959
|
return (i = this.headerMap.get(e)) == null ? void 0 : i.column;
|
|
1871
1960
|
}
|
|
1961
|
+
getColumnByKey(t) {
|
|
1962
|
+
const e = this.headerMap.get(t);
|
|
1963
|
+
if (e)
|
|
1964
|
+
return e;
|
|
1965
|
+
}
|
|
1872
1966
|
getColIndexForKey(t) {
|
|
1873
1967
|
var e;
|
|
1874
1968
|
if (t && this.headerMap.has(t))
|
|
@@ -1973,8 +2067,8 @@ class ni {
|
|
|
1973
2067
|
if (h) {
|
|
1974
2068
|
let c = {}, d = {};
|
|
1975
2069
|
if (d[e] = this.getItemValue(t, e), Array.isArray(h)) {
|
|
1976
|
-
const x = h.map((
|
|
1977
|
-
...
|
|
2070
|
+
const x = h.map((g) => ({
|
|
2071
|
+
...g,
|
|
1978
2072
|
row: s.item,
|
|
1979
2073
|
column: n,
|
|
1980
2074
|
rowIndex: s.rowIndex,
|
|
@@ -1992,14 +2086,14 @@ class ni {
|
|
|
1992
2086
|
new nt(c).validate(d).then(() => {
|
|
1993
2087
|
this.clearValidationError(t, e), i([]);
|
|
1994
2088
|
}).catch(({ errors: x }) => {
|
|
1995
|
-
const
|
|
2089
|
+
const g = x.map((p) => ({
|
|
1996
2090
|
...p,
|
|
1997
2091
|
column: n,
|
|
1998
2092
|
key: e,
|
|
1999
2093
|
row: s.item,
|
|
2000
2094
|
rowKey: t
|
|
2001
2095
|
}));
|
|
2002
|
-
this.setValidationError(t, e,
|
|
2096
|
+
this.setValidationError(t, e, g), i(g);
|
|
2003
2097
|
});
|
|
2004
2098
|
} else
|
|
2005
2099
|
i([]);
|
|
@@ -2026,16 +2120,16 @@ class ni {
|
|
|
2026
2120
|
rowspan: d,
|
|
2027
2121
|
height: f,
|
|
2028
2122
|
width: x,
|
|
2029
|
-
colspan:
|
|
2123
|
+
colspan: g,
|
|
2030
2124
|
mergeRow: p,
|
|
2031
|
-
mergeCol:
|
|
2125
|
+
mergeCol: u
|
|
2032
2126
|
} = t;
|
|
2033
|
-
if (d === 1 &&
|
|
2127
|
+
if (d === 1 && g === 1)
|
|
2034
2128
|
return {
|
|
2035
2129
|
xArr: [n, n],
|
|
2036
2130
|
yArr: [e, e],
|
|
2037
2131
|
rowspan: d,
|
|
2038
|
-
colspan:
|
|
2132
|
+
colspan: g,
|
|
2039
2133
|
height: f,
|
|
2040
2134
|
width: x,
|
|
2041
2135
|
offsetTop: 0,
|
|
@@ -2049,82 +2143,82 @@ class ni {
|
|
|
2049
2143
|
}
|
|
2050
2144
|
]
|
|
2051
2145
|
};
|
|
2052
|
-
let w = e, y = e,
|
|
2146
|
+
let w = e, y = e, C = n, m = n, E = [], b = 0, R = 0, O = 0, L = 0;
|
|
2053
2147
|
if (d !== 1 && p) {
|
|
2054
|
-
|
|
2055
|
-
const
|
|
2056
|
-
const
|
|
2057
|
-
return `${v}${
|
|
2148
|
+
L = x;
|
|
2149
|
+
const _ = h.reduce((v, A) => {
|
|
2150
|
+
const S = this.getItemValue(s, A) ?? "";
|
|
2151
|
+
return `${v}${S}`;
|
|
2058
2152
|
}, "");
|
|
2059
2153
|
for (let v = e - 1; v >= 0; v--) {
|
|
2060
|
-
const
|
|
2061
|
-
const N = this.getItemValue(
|
|
2154
|
+
const A = this.rowIndexRowKeyMap.get(v) || "", S = h.reduce((M, T) => {
|
|
2155
|
+
const N = this.getItemValue(A, T) ?? "";
|
|
2062
2156
|
return `${M}${N}`;
|
|
2063
2157
|
}, "");
|
|
2064
|
-
if (
|
|
2158
|
+
if (_ === S)
|
|
2065
2159
|
w = v;
|
|
2066
2160
|
else
|
|
2067
2161
|
break;
|
|
2068
2162
|
}
|
|
2069
2163
|
for (let v = e; v <= this.ctx.maxRowIndex; v++) {
|
|
2070
|
-
const
|
|
2071
|
-
const N = this.getItemValue(
|
|
2164
|
+
const A = this.rowIndexRowKeyMap.get(v) || "", S = h.reduce((M, T) => {
|
|
2165
|
+
const N = this.getItemValue(A, T) ?? "";
|
|
2072
2166
|
return `${M}${N}`;
|
|
2073
2167
|
}, "");
|
|
2074
|
-
if (
|
|
2168
|
+
if (_ === S)
|
|
2075
2169
|
y = v;
|
|
2076
2170
|
else
|
|
2077
2171
|
break;
|
|
2078
2172
|
}
|
|
2079
2173
|
for (let v = w; v < e; v++) {
|
|
2080
|
-
const { height:
|
|
2081
|
-
|
|
2174
|
+
const { height: A } = this.positions[v];
|
|
2175
|
+
b += A;
|
|
2082
2176
|
}
|
|
2083
2177
|
for (let v = w; v <= y; v++) {
|
|
2084
|
-
const { height:
|
|
2085
|
-
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
rowKey:
|
|
2178
|
+
const { height: A } = this.positions[v];
|
|
2179
|
+
O += A;
|
|
2180
|
+
const S = this.rowIndexRowKeyMap.get(v) || "", { item: M } = this.rowKeyMap.get(S), T = this.getItemValue(S, i);
|
|
2181
|
+
E.push({
|
|
2182
|
+
rowKey: S,
|
|
2089
2183
|
key: i,
|
|
2090
2184
|
value: T,
|
|
2091
2185
|
row: M
|
|
2092
2186
|
});
|
|
2093
2187
|
}
|
|
2094
2188
|
}
|
|
2095
|
-
if (
|
|
2096
|
-
|
|
2097
|
-
for (let
|
|
2098
|
-
const v = this.getColumnByColIndex(
|
|
2189
|
+
if (g !== 1 && u) {
|
|
2190
|
+
O = f;
|
|
2191
|
+
for (let _ = n - 1; _ >= 0; _--) {
|
|
2192
|
+
const v = this.getColumnByColIndex(_);
|
|
2099
2193
|
if (!v)
|
|
2100
2194
|
break;
|
|
2101
|
-
const
|
|
2102
|
-
if (
|
|
2103
|
-
|
|
2195
|
+
const A = this.getItemValue(s, i), S = this.getItemValue(s, v.key);
|
|
2196
|
+
if (A === S && c.includes(v.key))
|
|
2197
|
+
C = _;
|
|
2104
2198
|
else
|
|
2105
2199
|
break;
|
|
2106
2200
|
}
|
|
2107
|
-
for (let
|
|
2108
|
-
const v = this.getColumnByColIndex(
|
|
2201
|
+
for (let _ = n; _ <= this.ctx.maxColIndex; _++) {
|
|
2202
|
+
const v = this.getColumnByColIndex(_);
|
|
2109
2203
|
if (!v)
|
|
2110
2204
|
break;
|
|
2111
|
-
const
|
|
2112
|
-
if (
|
|
2113
|
-
m =
|
|
2205
|
+
const A = this.getItemValue(s, i), S = this.getItemValue(s, v.key);
|
|
2206
|
+
if (A === S && c.includes(v.key))
|
|
2207
|
+
m = _;
|
|
2114
2208
|
else
|
|
2115
2209
|
break;
|
|
2116
2210
|
}
|
|
2117
|
-
for (let
|
|
2118
|
-
const v = this.getColumnByColIndex(
|
|
2211
|
+
for (let _ = C; _ < n; _++) {
|
|
2212
|
+
const v = this.getColumnByColIndex(_);
|
|
2119
2213
|
if (!v)
|
|
2120
2214
|
break;
|
|
2121
2215
|
R += v.width || 100;
|
|
2122
2216
|
}
|
|
2123
|
-
for (let
|
|
2124
|
-
const v = this.getColumnByColIndex(
|
|
2217
|
+
for (let _ = C; _ <= m; _++) {
|
|
2218
|
+
const v = this.getColumnByColIndex(_);
|
|
2125
2219
|
if (!v)
|
|
2126
2220
|
break;
|
|
2127
|
-
|
|
2221
|
+
L += v.width || 100, E.push({
|
|
2128
2222
|
rowKey: s,
|
|
2129
2223
|
key: v.key,
|
|
2130
2224
|
value: this.getItemValue(s, v.key),
|
|
@@ -2133,15 +2227,15 @@ class ni {
|
|
|
2133
2227
|
}
|
|
2134
2228
|
}
|
|
2135
2229
|
return {
|
|
2136
|
-
xArr: [
|
|
2230
|
+
xArr: [C, m],
|
|
2137
2231
|
yArr: [w, y],
|
|
2138
2232
|
rowspan: d,
|
|
2139
|
-
colspan:
|
|
2140
|
-
height:
|
|
2141
|
-
width:
|
|
2142
|
-
offsetTop:
|
|
2233
|
+
colspan: g,
|
|
2234
|
+
height: O,
|
|
2235
|
+
width: L,
|
|
2236
|
+
offsetTop: b,
|
|
2143
2237
|
offsetLeft: R,
|
|
2144
|
-
dataList:
|
|
2238
|
+
dataList: E
|
|
2145
2239
|
};
|
|
2146
2240
|
}
|
|
2147
2241
|
setLoading(t) {
|
|
@@ -2173,7 +2267,12 @@ class ni {
|
|
|
2173
2267
|
// 获取虚拟单元格
|
|
2174
2268
|
getVirtualBodyCell(t, e) {
|
|
2175
2269
|
const i = this.getColumnByColIndex(e), s = this.getRowForRowIndex(t);
|
|
2176
|
-
return !i || !s ? void 0 : new Tt(this.ctx, t, e, 0, 0, 0, 0, i, s, "body");
|
|
2270
|
+
return !i || !s ? void 0 : new Tt(this.ctx, t, e, 0, 0, 0, 0, i, s.item, "body");
|
|
2271
|
+
}
|
|
2272
|
+
getVirtualBodyCellByKey(t, e) {
|
|
2273
|
+
const i = this.getRowIndexForRowKey(t), s = this.getColIndexForKey(e);
|
|
2274
|
+
if (!(i === void 0 || s === void 0))
|
|
2275
|
+
return this.getVirtualBodyCell(i, s);
|
|
2177
2276
|
}
|
|
2178
2277
|
hasMergeCell(t, e) {
|
|
2179
2278
|
let i = !1;
|
|
@@ -2450,10 +2549,10 @@ class ci {
|
|
|
2450
2549
|
this.ctx.font = n, this.ctx.fillStyle = c, this.ctx.textBaseline = f, this.ctx.textAlign = h;
|
|
2451
2550
|
let x = 0;
|
|
2452
2551
|
f === "top" ? x = i + d : f === "bottom" ? x = i + r - d : x = i + (r + 1) / 2;
|
|
2453
|
-
let
|
|
2454
|
-
h === "left" ?
|
|
2455
|
-
const { _text: p, ellipsis:
|
|
2456
|
-
return this.ctx.fillText(p,
|
|
2552
|
+
let g = 0;
|
|
2553
|
+
h === "left" ? g = e + d : h === "right" ? g = e + s - d : g = e + s / 2;
|
|
2554
|
+
const { _text: p, ellipsis: u } = this.handleEllipsis(t, s, d, n);
|
|
2555
|
+
return this.ctx.fillText(p, g, x), this.ctx.restore(), u;
|
|
2457
2556
|
}
|
|
2458
2557
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
2459
2558
|
let r = !1, o = t;
|
|
@@ -2487,6 +2586,11 @@ class Wt {
|
|
|
2487
2586
|
//禁用编辑,优先等级最高
|
|
2488
2587
|
l(this, "HEADER_FONT", "12px normal Arial");
|
|
2489
2588
|
l(this, "BODY_FONT", "12px normal Arial");
|
|
2589
|
+
l(this, "BORDER", !0);
|
|
2590
|
+
l(this, "STRIPE", !1);
|
|
2591
|
+
//斑马纹
|
|
2592
|
+
l(this, "STRIPE_COLOR", "#fafafa");
|
|
2593
|
+
//斑马纹颜色
|
|
2490
2594
|
l(this, "BORDER_COLOR", "#e1e6eb");
|
|
2491
2595
|
l(this, "WIDTH", 0);
|
|
2492
2596
|
l(this, "RESIZE_MIN_WIDTH", 40);
|
|
@@ -2499,6 +2603,8 @@ class Wt {
|
|
|
2499
2603
|
l(this, "ENABLE_OFFSET_HEIGHT", !1);
|
|
2500
2604
|
l(this, "OFFSET_HEIGHT", 0);
|
|
2501
2605
|
l(this, "HEADER_HEIGHT", 36);
|
|
2606
|
+
l(this, "ENABLE_RESERVE_SELECTION", !1);
|
|
2607
|
+
// 启用保留选中行
|
|
2502
2608
|
l(this, "ENABLE_HEADER_STICKY", !1);
|
|
2503
2609
|
// 启用头部固定,需要外面实现覆盖层,或者所有表头都要是元素
|
|
2504
2610
|
l(this, "HEADER_BG_COLOR", "#F8FAFF");
|
|
@@ -2804,12 +2910,12 @@ class re extends se {
|
|
|
2804
2910
|
draw() {
|
|
2805
2911
|
const {
|
|
2806
2912
|
paint: e,
|
|
2807
|
-
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2808
|
-
} = this.ctx, { drawX:
|
|
2809
|
-
e.drawRect(
|
|
2810
|
-
borderColor: i,
|
|
2913
|
+
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r, BORDER: o }
|
|
2914
|
+
} = this.ctx, { drawX: n, drawY: h, displayText: c } = this;
|
|
2915
|
+
e.drawRect(n, h, this.width, this.height, {
|
|
2916
|
+
borderColor: o ? i : "transparent",
|
|
2811
2917
|
fillColor: this.drawCellBgColor
|
|
2812
|
-
}), e.drawText(
|
|
2918
|
+
}), e.drawText(c, n, h, this.width, this.height, {
|
|
2813
2919
|
font: r,
|
|
2814
2920
|
padding: s,
|
|
2815
2921
|
color: this.drawTextColor,
|
|
@@ -2934,7 +3040,7 @@ class fi {
|
|
|
2934
3040
|
selectionClick(t) {
|
|
2935
3041
|
if (["selection", "index-selection"].includes(t.type) && this.ctx.isPointer)
|
|
2936
3042
|
if (t instanceof re)
|
|
2937
|
-
t.drawImageName === "checkbox-uncheck" || t.drawImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawImageName === "checkbox-check" && this.ctx.database.clearSelection();
|
|
3043
|
+
t.drawImageName === "checkbox-uncheck" || t.drawImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawImageName === "checkbox-check" && this.ctx.database.clearSelection(!0);
|
|
2938
3044
|
else {
|
|
2939
3045
|
if (!this.ctx.database.getRowSelectable(t.rowKey))
|
|
2940
3046
|
return;
|
|
@@ -3059,6 +3165,7 @@ class xi {
|
|
|
3059
3165
|
l(this, "scrollX", 0);
|
|
3060
3166
|
l(this, "fixedLeftWidth", 0);
|
|
3061
3167
|
l(this, "fixedRightWidth", 0);
|
|
3168
|
+
l(this, "lastCenterColIndex", 0);
|
|
3062
3169
|
l(this, "maxColIndex", 0);
|
|
3063
3170
|
l(this, "maxRowIndex", 0);
|
|
3064
3171
|
l(this, "hoverRow");
|
|
@@ -3136,15 +3243,14 @@ class xi {
|
|
|
3136
3243
|
}
|
|
3137
3244
|
setItemValueByEditor(t, e, i, s = !0, r = !0) {
|
|
3138
3245
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
3139
|
-
const o = this.database.
|
|
3140
|
-
if (o
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
this.database.batchSetItemValue(d, s);
|
|
3246
|
+
const o = this.database.getVirtualBodyCellByKey(t, e);
|
|
3247
|
+
if (o && (o.mergeRow || o.mergeCol)) {
|
|
3248
|
+
const { dataList: n } = o.getSpanInfo(), h = n.map((c) => ({ ...c, value: i }));
|
|
3249
|
+
this.database.batchSetItemValue(h, s);
|
|
3250
|
+
return;
|
|
3145
3251
|
}
|
|
3146
|
-
}
|
|
3147
|
-
|
|
3252
|
+
}
|
|
3253
|
+
this.database.setItemValue(t, e, i, s, r, !0);
|
|
3148
3254
|
}
|
|
3149
3255
|
batchSetItemValueByEditor(t, e = !0) {
|
|
3150
3256
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
@@ -3335,37 +3441,41 @@ class Pt {
|
|
|
3335
3441
|
header: e,
|
|
3336
3442
|
stageHeight: i,
|
|
3337
3443
|
stageWidth: s,
|
|
3338
|
-
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
3339
|
-
} = this.ctx,
|
|
3444
|
+
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0, BORDER: n }
|
|
3445
|
+
} = this.ctx, h = s, c = i, d = e.height, f = e.width, x = t.height, g = this.ctx.footer.height;
|
|
3340
3446
|
if (this.type === "vertical") {
|
|
3341
|
-
this.visibleDistance =
|
|
3342
|
-
const
|
|
3343
|
-
let
|
|
3344
|
-
|
|
3447
|
+
this.visibleDistance = c - r - d, this.distance = x - this.visibleDistance + g, this.trackX = h - r, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + r, d], this.trackWidth = r, this.trackHeight = c, this.barX = this.trackX - 1 + (r - o) / 2, this.barWidth = o;
|
|
3448
|
+
const p = this.distance ? this.visibleDistance / (x + g) : 0;
|
|
3449
|
+
let u = Math.floor(p * this.visibleDistance);
|
|
3450
|
+
u < 30 ? u = 30 : u > this.visibleDistance && (u = 0), this.barHeight = u, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
3345
3451
|
} else {
|
|
3346
|
-
this.visibleDistance =
|
|
3347
|
-
|
|
3452
|
+
this.visibleDistance = h - r, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3453
|
+
h - r,
|
|
3454
|
+
c - r,
|
|
3348
3455
|
h - r,
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3456
|
+
c
|
|
3457
|
+
];
|
|
3458
|
+
const p = n ? 0 : 0.5;
|
|
3459
|
+
this.trackX = 0, this.trackY = c - r + p, this.trackWidth = h, this.trackHeight = r;
|
|
3460
|
+
const u = this.distance ? this.visibleDistance / f : 0;
|
|
3461
|
+
let w = Math.floor(u * this.visibleDistance);
|
|
3462
|
+
this.barY = this.trackY - 1 + (r - o) / 2, w < 30 ? w = 30 : w >= this.visibleDistance && (w = 0), this.barWidth = w, this.barHeight = o, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
3355
3463
|
}
|
|
3356
3464
|
}
|
|
3357
3465
|
draw() {
|
|
3358
3466
|
const {
|
|
3359
|
-
config: { SCROLLER_FOCUS_COLOR: t, SCROLLER_COLOR: e, BORDER_COLOR: i,
|
|
3467
|
+
config: { SCROLLER_FOCUS_COLOR: t, SCROLLER_COLOR: e, BORDER_COLOR: i, BORDER: s, SCROLLER_TRACK_COLOR: r }
|
|
3360
3468
|
} = this.ctx;
|
|
3361
|
-
this.updatedSize()
|
|
3362
|
-
|
|
3363
|
-
|
|
3469
|
+
this.updatedSize();
|
|
3470
|
+
let o = i;
|
|
3471
|
+
s || (o = "transparent"), this.ctx.paint.drawRect(this.trackX, this.trackY, this.trackWidth, this.trackHeight, {
|
|
3472
|
+
borderColor: o,
|
|
3473
|
+
fillColor: r
|
|
3364
3474
|
}), this.ctx.paint.drawRect(this.barX, this.barY, this.barWidth, this.barHeight, {
|
|
3365
3475
|
fillColor: this.isFocus || this.isDragging ? t : e,
|
|
3366
3476
|
radius: 4
|
|
3367
3477
|
}), this.splitPoints.length > 0 && this.ctx.paint.drawLine(this.splitPoints, {
|
|
3368
|
-
borderColor:
|
|
3478
|
+
borderColor: o,
|
|
3369
3479
|
borderWidth: 1
|
|
3370
3480
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
3371
3481
|
}
|
|
@@ -3483,7 +3593,7 @@ class gi {
|
|
|
3483
3593
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
3484
3594
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3485
3595
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3486
|
-
const s = Qt(i), r =
|
|
3596
|
+
const s = Qt(i), r = _t(i);
|
|
3487
3597
|
this.height = t * s, this.width = r.reduce((f, x) => f + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
3488
3598
|
const o = ti(te(i, s));
|
|
3489
3599
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
@@ -3586,7 +3696,7 @@ class gi {
|
|
|
3586
3696
|
for (let o = 0; o < i; o++) {
|
|
3587
3697
|
const n = t[o], h = r * (n.rowspan || 0), c = r * (n.level || 0);
|
|
3588
3698
|
let d = n.width || 100;
|
|
3589
|
-
n.children && (d =
|
|
3699
|
+
n.children && (d = _t(n.children).reduce((g, p) => g + ((p == null ? void 0 : p.width) || 100), 0));
|
|
3590
3700
|
const f = new re(this.ctx, this.columnIndex, s, c, d, h, n);
|
|
3591
3701
|
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;
|
|
3592
3702
|
}
|
|
@@ -3603,7 +3713,7 @@ class gi {
|
|
|
3603
3713
|
});
|
|
3604
3714
|
}
|
|
3605
3715
|
}
|
|
3606
|
-
|
|
3716
|
+
drawFixedShadow() {
|
|
3607
3717
|
const {
|
|
3608
3718
|
fixedLeftWidth: t,
|
|
3609
3719
|
fixedRightWidth: e,
|
|
@@ -3620,7 +3730,7 @@ class gi {
|
|
|
3620
3730
|
colorEnd: "rgba(0,0,0,0)"
|
|
3621
3731
|
}), i < Math.floor(s.width - r - 1) && e !== n) {
|
|
3622
3732
|
const h = s.width - (this.x + this.width) + r - e;
|
|
3623
|
-
this.ctx.paint.drawShadow(h
|
|
3733
|
+
this.ctx.paint.drawShadow(h, this.y, e, this.height, {
|
|
3624
3734
|
fillColor: o,
|
|
3625
3735
|
side: "left",
|
|
3626
3736
|
shadowWidth: 4,
|
|
@@ -3631,6 +3741,10 @@ class gi {
|
|
|
3631
3741
|
}
|
|
3632
3742
|
update() {
|
|
3633
3743
|
const t = [], e = [], i = [];
|
|
3744
|
+
if (this.centerCellHeaders.length) {
|
|
3745
|
+
const s = this.centerCellHeaders[this.centerCellHeaders.length - 1];
|
|
3746
|
+
this.ctx.lastCenterColIndex = s.colIndex;
|
|
3747
|
+
}
|
|
3634
3748
|
this.centerCellHeaders.forEach((s) => {
|
|
3635
3749
|
s.isHorizontalVisible() && s.isVerticalVisible() && (e.push(s), s.hasChildren || t.push(s));
|
|
3636
3750
|
}), this.fixedLeftCellHeaders.forEach((s) => {
|
|
@@ -3639,12 +3753,22 @@ class gi {
|
|
|
3639
3753
|
i.push(s), s.hasChildren || t.push(s);
|
|
3640
3754
|
}), this.renderCenterCellHeaders = e, this.renderFixedCellHeaders = i, this.renderLeafCellHeaders = t.sort((s, r) => s.x - r.x), this.visibleLeafColumns = this.renderLeafCellHeaders.map((s) => s.column), this.ctx.header.visibleLeafColumns = this.visibleLeafColumns, this.ctx.header.leafCellHeaders = this.leafCellHeaders, this.ctx.header.renderLeafCellHeaders = this.renderLeafCellHeaders, this.ctx.header.renderCellHeaders = this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders);
|
|
3641
3755
|
}
|
|
3756
|
+
drawBottomLine() {
|
|
3757
|
+
const {
|
|
3758
|
+
stageWidth: t,
|
|
3759
|
+
config: { BORDER_COLOR: e }
|
|
3760
|
+
} = this.ctx, i = [0, this.height, t, this.height];
|
|
3761
|
+
this.ctx.paint.drawLine(i, {
|
|
3762
|
+
borderColor: e,
|
|
3763
|
+
borderWidth: 1
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3642
3766
|
draw() {
|
|
3643
3767
|
this.renderCenterCellHeaders.forEach((t) => {
|
|
3644
3768
|
t.update(), t.draw();
|
|
3645
|
-
}), this.
|
|
3769
|
+
}), this.drawFixedShadow(), this.renderFixedCellHeaders.forEach((t) => {
|
|
3646
3770
|
t.update(), t.draw();
|
|
3647
|
-
}), this.drawTipLine();
|
|
3771
|
+
}), this.drawTipLine(), this.drawBottomLine();
|
|
3648
3772
|
}
|
|
3649
3773
|
}
|
|
3650
3774
|
class oe {
|
|
@@ -3691,11 +3815,14 @@ class oe {
|
|
|
3691
3815
|
t.draw();
|
|
3692
3816
|
});
|
|
3693
3817
|
}
|
|
3694
|
-
|
|
3818
|
+
drawContainer() {
|
|
3695
3819
|
this.noFixedCells.forEach((t) => {
|
|
3696
|
-
t.
|
|
3697
|
-
})
|
|
3698
|
-
|
|
3820
|
+
t.drawContainer();
|
|
3821
|
+
});
|
|
3822
|
+
}
|
|
3823
|
+
drawFixedContainer() {
|
|
3824
|
+
this.fixedCells.forEach((t) => {
|
|
3825
|
+
t.drawContainer();
|
|
3699
3826
|
});
|
|
3700
3827
|
}
|
|
3701
3828
|
}
|
|
@@ -3745,9 +3872,9 @@ class wi {
|
|
|
3745
3872
|
if (!e.width)
|
|
3746
3873
|
return;
|
|
3747
3874
|
this.x = 0, x === "top" && r ? this.y = e.height + i.height : this.y = e.height;
|
|
3748
|
-
const { data:
|
|
3749
|
-
this.height = p, this.data =
|
|
3750
|
-
const { top:
|
|
3875
|
+
const { data: g, sumHeight: p } = s.getData();
|
|
3876
|
+
this.height = p, this.data = g;
|
|
3877
|
+
const { top: u } = t.getBoundingClientRect();
|
|
3751
3878
|
this.width = e.width, this.visibleWidth = this.ctx.stageWidth - o;
|
|
3752
3879
|
const w = this.ctx.footer.height;
|
|
3753
3880
|
!this.data.length && !n ? this.height = h : !this.data.length && n && (this.height = n - e.height - w - o);
|
|
@@ -3761,19 +3888,19 @@ class wi {
|
|
|
3761
3888
|
width: this.width,
|
|
3762
3889
|
height: this.data.length ? 0 : h + w
|
|
3763
3890
|
});
|
|
3764
|
-
let
|
|
3765
|
-
|
|
3891
|
+
let C = this.height + e.height + o;
|
|
3892
|
+
C += w;
|
|
3766
3893
|
let m = 0;
|
|
3767
|
-
this.data.length && d ? (m = window.innerHeight -
|
|
3894
|
+
this.data.length && d ? (m = window.innerHeight - u - f, m < 0 && (m = 32, console.error(
|
|
3768
3895
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3769
|
-
))) : this.data.length && n ? m = n : this.data.length && c &&
|
|
3770
|
-
let
|
|
3771
|
-
r ? this.visibleHeight =
|
|
3772
|
-
const
|
|
3773
|
-
t.width = Math.floor(R), t.height = Math.floor(
|
|
3896
|
+
))) : this.data.length && n ? m = n : this.data.length && c && C > c ? m = c : m = C, m > 0 && (this.ctx.stageHeight = Math.floor(m), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
|
|
3897
|
+
let E = this.ctx.stageHeight - e.height - o;
|
|
3898
|
+
r ? this.visibleHeight = E - w : this.visibleHeight = E, this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = g;
|
|
3899
|
+
const b = window.devicePixelRatio || 1, R = this.ctx.stageWidth * b, O = this.ctx.stageHeight * b;
|
|
3900
|
+
t.width = Math.floor(R), t.height = Math.floor(O), this.ctx.canvasElement.setAttribute(
|
|
3774
3901
|
"style",
|
|
3775
3902
|
` height:${this.ctx.stageHeight}px;width:${this.ctx.stageWidth}px;`
|
|
3776
|
-
), this.ctx.paint.scale(
|
|
3903
|
+
), this.ctx.paint.scale(b);
|
|
3777
3904
|
}
|
|
3778
3905
|
// 调整行的高度
|
|
3779
3906
|
initResizeRow() {
|
|
@@ -3811,8 +3938,8 @@ class wi {
|
|
|
3811
3938
|
const x = this.renderRows[f];
|
|
3812
3939
|
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r < h - 4)
|
|
3813
3940
|
for (let p = 0; p < x.cells.length; p++) {
|
|
3814
|
-
const
|
|
3815
|
-
o >
|
|
3941
|
+
const u = x.cells[p];
|
|
3942
|
+
o > u.drawX + 10 && o < u.drawX + u.width - 10 && u.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
3816
3943
|
}
|
|
3817
3944
|
}
|
|
3818
3945
|
}
|
|
@@ -3842,7 +3969,7 @@ class wi {
|
|
|
3842
3969
|
});
|
|
3843
3970
|
}
|
|
3844
3971
|
}
|
|
3845
|
-
|
|
3972
|
+
drawFixedShadow() {
|
|
3846
3973
|
const {
|
|
3847
3974
|
fixedLeftWidth: t,
|
|
3848
3975
|
fixedRightWidth: e,
|
|
@@ -3859,7 +3986,7 @@ class wi {
|
|
|
3859
3986
|
colorEnd: "rgba(0,0,0,0)"
|
|
3860
3987
|
}), i < Math.floor(s.width - r - 1) && e !== n) {
|
|
3861
3988
|
const h = s.width - (this.x + this.width) + r - e;
|
|
3862
|
-
this.ctx.paint.drawShadow(h
|
|
3989
|
+
this.ctx.paint.drawShadow(h, this.y, e, this.height, {
|
|
3863
3990
|
fillColor: o,
|
|
3864
3991
|
side: "left",
|
|
3865
3992
|
shadowWidth: 4,
|
|
@@ -3895,15 +4022,19 @@ class wi {
|
|
|
3895
4022
|
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;
|
|
3896
4023
|
const d = [];
|
|
3897
4024
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3898
|
-
const x = this.headIndex + f,
|
|
4025
|
+
const x = this.headIndex + f, g = this.visibleRows[f], { height: p, top: u } = this.ctx.database.getPositionForRowIndex(x), w = new oe(this.ctx, x, 0, u + this.y, t.width, p, g);
|
|
3899
4026
|
d.push(w);
|
|
3900
4027
|
}
|
|
3901
4028
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
3902
4029
|
}
|
|
3903
4030
|
draw() {
|
|
3904
4031
|
this.renderRows.forEach((t) => {
|
|
4032
|
+
t.drawContainer();
|
|
4033
|
+
}), this.renderRows.forEach((t) => {
|
|
3905
4034
|
t.drawCenter();
|
|
3906
|
-
}), this.
|
|
4035
|
+
}), this.drawFixedShadow(), this.renderRows.forEach((t) => {
|
|
4036
|
+
t.drawFixedContainer();
|
|
4037
|
+
}), this.renderRows.forEach((t) => {
|
|
3907
4038
|
t.drawFixed();
|
|
3908
4039
|
}), this.drawTipLine();
|
|
3909
4040
|
}
|
|
@@ -3930,7 +4061,7 @@ class pi {
|
|
|
3930
4061
|
} = this.ctx;
|
|
3931
4062
|
this.width = t.width, this.visibleWidth = t.visibleWidth, this.height = this.data.reduce((n) => n + i, 0), this.visibleHeight = this.height, s ? o === "top" ? this.y = this.ctx.header.height : this.y = this.ctx.stageHeight - this.height - r : this.y = e.y + e.height, this.ctx.footer.x = this.x, this.ctx.footer.y = this.y, this.ctx.footer.height = this.height, this.ctx.footer.width = this.width, this.ctx.footer.visibleWidth = this.visibleWidth, this.ctx.footer.visibleHeight = this.visibleHeight;
|
|
3932
4063
|
}
|
|
3933
|
-
|
|
4064
|
+
drawFixedShadow() {
|
|
3934
4065
|
const {
|
|
3935
4066
|
fixedLeftWidth: t,
|
|
3936
4067
|
fixedRightWidth: e,
|
|
@@ -3948,7 +4079,7 @@ class pi {
|
|
|
3948
4079
|
colorEnd: "rgba(0,0,0,0)"
|
|
3949
4080
|
}), i < Math.floor(s.width - r - 1) && e !== n) {
|
|
3950
4081
|
const c = s.width - (this.x + this.width) + r - e;
|
|
3951
|
-
this.ctx.paint.drawShadow(c
|
|
4082
|
+
this.ctx.paint.drawShadow(c, h, e, this.height, {
|
|
3952
4083
|
fillColor: o,
|
|
3953
4084
|
side: "left",
|
|
3954
4085
|
shadowWidth: 4,
|
|
@@ -3967,12 +4098,26 @@ class pi {
|
|
|
3967
4098
|
e += t, i.push(o);
|
|
3968
4099
|
}), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
|
|
3969
4100
|
}
|
|
4101
|
+
drawTopLine() {
|
|
4102
|
+
const {
|
|
4103
|
+
stageWidth: t,
|
|
4104
|
+
config: { BORDER_COLOR: e }
|
|
4105
|
+
} = this.ctx, i = [0, this.y, t, this.y];
|
|
4106
|
+
this.ctx.paint.drawLine(i, {
|
|
4107
|
+
borderColor: e,
|
|
4108
|
+
borderWidth: 1
|
|
4109
|
+
});
|
|
4110
|
+
}
|
|
3970
4111
|
draw() {
|
|
3971
4112
|
this.renderRows.forEach((t) => {
|
|
4113
|
+
t.drawContainer();
|
|
4114
|
+
}), this.renderRows.forEach((t) => {
|
|
3972
4115
|
t.drawCenter();
|
|
3973
|
-
}), this.
|
|
4116
|
+
}), this.drawFixedShadow(), this.renderRows.forEach((t) => {
|
|
4117
|
+
t.drawFixedContainer();
|
|
4118
|
+
}), this.renderRows.forEach((t) => {
|
|
3974
4119
|
t.drawFixed();
|
|
3975
|
-
});
|
|
4120
|
+
}), this.drawTopLine();
|
|
3976
4121
|
}
|
|
3977
4122
|
}
|
|
3978
4123
|
class yi {
|
|
@@ -4041,7 +4186,7 @@ class yi {
|
|
|
4041
4186
|
t.preventDefault(), this.moveFocus("LEFT");
|
|
4042
4187
|
return;
|
|
4043
4188
|
}
|
|
4044
|
-
if (t.code === "ArrowUp"
|
|
4189
|
+
if (t.code === "ArrowUp") {
|
|
4045
4190
|
t.preventDefault(), this.moveFocus("TOP");
|
|
4046
4191
|
return;
|
|
4047
4192
|
}
|
|
@@ -4049,7 +4194,7 @@ class yi {
|
|
|
4049
4194
|
t.preventDefault(), this.moveFocus("RIGHT");
|
|
4050
4195
|
return;
|
|
4051
4196
|
}
|
|
4052
|
-
if (t.code === "ArrowDown"
|
|
4197
|
+
if (t.code === "ArrowDown") {
|
|
4053
4198
|
t.preventDefault(), this.moveFocus("BOTTOM");
|
|
4054
4199
|
return;
|
|
4055
4200
|
}
|
|
@@ -4095,25 +4240,25 @@ class yi {
|
|
|
4095
4240
|
SELECTOR_AREA_MAX_Y: d,
|
|
4096
4241
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
4097
4242
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
4098
|
-
} = this.ctx.config,
|
|
4099
|
-
let [y,
|
|
4100
|
-
if (y <
|
|
4243
|
+
} = this.ctx.config, g = n, p = h || this.ctx.maxColIndex - f, u = c, w = d || this.ctx.maxRowIndex - x;
|
|
4244
|
+
let [y, C] = r, [m, E] = o;
|
|
4245
|
+
if (y < g || C > p || m < u || E > w)
|
|
4101
4246
|
return;
|
|
4102
4247
|
if (this.ctx.stageElement.focus(), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
4103
4248
|
const R = this.adjustMergeCells(r, o);
|
|
4104
|
-
m = R.yArr[0],
|
|
4249
|
+
m = R.yArr[0], E = R.yArr[1], y = R.xArr[0], C = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
|
|
4105
4250
|
}
|
|
4106
|
-
y ===
|
|
4107
|
-
const { BEFORE_SET_SELECTOR_METHOD:
|
|
4108
|
-
if (typeof
|
|
4109
|
-
const
|
|
4251
|
+
y === C && m === E ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, r = [Math.max(g, y), Math.min(p, C)], o = [Math.max(u, m), Math.min(w, E)];
|
|
4252
|
+
const { BEFORE_SET_SELECTOR_METHOD: b } = this.ctx.config;
|
|
4253
|
+
if (typeof b == "function") {
|
|
4254
|
+
const O = b({
|
|
4110
4255
|
focusCell: this.ctx.focusCell,
|
|
4111
4256
|
xArr: r,
|
|
4112
4257
|
yArr: o
|
|
4113
4258
|
});
|
|
4114
|
-
if (!
|
|
4259
|
+
if (!O)
|
|
4115
4260
|
return;
|
|
4116
|
-
r =
|
|
4261
|
+
r = O.xArr, o = O.yArr;
|
|
4117
4262
|
}
|
|
4118
4263
|
this.ctx.selector.xArr = r, this.ctx.selector.yArr = o, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
|
|
4119
4264
|
}
|
|
@@ -4122,39 +4267,39 @@ class yi {
|
|
|
4122
4267
|
var p;
|
|
4123
4268
|
const [i, s] = e, [r, o] = t;
|
|
4124
4269
|
let n = [], h = [];
|
|
4125
|
-
for (let
|
|
4270
|
+
for (let u = 0; u <= e[1] - e[0]; u++)
|
|
4126
4271
|
for (let w = 0; w <= t[1] - t[0]; w++) {
|
|
4127
|
-
const y =
|
|
4128
|
-
m && ((y === i || y === s) && n.push(m), (
|
|
4272
|
+
const y = u + e[0], C = w + t[0], m = this.ctx.database.getVirtualBodyCell(y, C);
|
|
4273
|
+
m && ((y === i || y === s) && n.push(m), (C === r || C === o) && h.push(m));
|
|
4129
4274
|
}
|
|
4130
4275
|
const c = n.reduce(
|
|
4131
|
-
(
|
|
4132
|
-
const { yArr: y } = w.getSpanInfo(), [
|
|
4133
|
-
return
|
|
4276
|
+
(u, w) => {
|
|
4277
|
+
const { yArr: y } = w.getSpanInfo(), [C, m] = y;
|
|
4278
|
+
return u.minY = Math.min(u.minY, C), u.maxY = Math.max(u.maxY, m), u;
|
|
4134
4279
|
},
|
|
4135
4280
|
{
|
|
4136
4281
|
minY: i,
|
|
4137
4282
|
maxY: s
|
|
4138
4283
|
}
|
|
4139
4284
|
), d = h.reduce(
|
|
4140
|
-
(
|
|
4141
|
-
const { xArr: y } = w.getSpanInfo(), [
|
|
4142
|
-
return
|
|
4285
|
+
(u, w) => {
|
|
4286
|
+
const { xArr: y } = w.getSpanInfo(), [C, m] = y;
|
|
4287
|
+
return u.minX = Math.min(u.minX, C), u.maxX = Math.max(u.maxX, m), u;
|
|
4143
4288
|
},
|
|
4144
4289
|
{
|
|
4145
4290
|
minX: r,
|
|
4146
4291
|
maxX: o
|
|
4147
4292
|
}
|
|
4148
4293
|
), f = [d.minX, d.maxX], x = [c.minY, c.maxY];
|
|
4149
|
-
let
|
|
4294
|
+
let g = !1;
|
|
4150
4295
|
if (d.minX !== d.maxX || c.minY !== c.maxY) {
|
|
4151
|
-
const
|
|
4152
|
-
|
|
4296
|
+
const u = JSON.stringify(f) + JSON.stringify(x), w = (p = this.ctx.focusCell) == null ? void 0 : p.getSpanInfo();
|
|
4297
|
+
g = (w && JSON.stringify(w.xArr) + JSON.stringify(w.yArr)) === u;
|
|
4153
4298
|
}
|
|
4154
4299
|
return {
|
|
4155
4300
|
xArr: f,
|
|
4156
4301
|
yArr: x,
|
|
4157
|
-
onlyMergeCell:
|
|
4302
|
+
onlyMergeCell: g
|
|
4158
4303
|
};
|
|
4159
4304
|
}
|
|
4160
4305
|
selectCols(t) {
|
|
@@ -4191,8 +4336,8 @@ class yi {
|
|
|
4191
4336
|
SELECTOR_AREA_MAX_Y: o,
|
|
4192
4337
|
SELECTOR_AREA_MAX_X_OFFSET: n,
|
|
4193
4338
|
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
4194
|
-
} = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r, x = o || this.ctx.maxRowIndex - h,
|
|
4195
|
-
this.setSelector(
|
|
4339
|
+
} = this.ctx.config, c = i, d = s || this.ctx.maxColIndex - n, f = r, x = o || this.ctx.maxRowIndex - h, g = [c, d], p = [f, x];
|
|
4340
|
+
this.setSelector(g, p);
|
|
4196
4341
|
}
|
|
4197
4342
|
}
|
|
4198
4343
|
selectRows(t, e = !0) {
|
|
@@ -4230,8 +4375,8 @@ class yi {
|
|
|
4230
4375
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
4231
4376
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
|
|
4232
4377
|
return;
|
|
4233
|
-
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],
|
|
4234
|
-
this.setSelector(x,
|
|
4378
|
+
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], g = [d, f];
|
|
4379
|
+
this.setSelector(x, g);
|
|
4235
4380
|
} else {
|
|
4236
4381
|
this.ctx.emit("cellSelectedClick", e);
|
|
4237
4382
|
const s = [e.colIndex, e.colIndex], r = [e.rowIndex, e.rowIndex];
|
|
@@ -4299,10 +4444,10 @@ class yi {
|
|
|
4299
4444
|
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4300
4445
|
const c = n + e[0], d = h + t[0], f = this.ctx.database.getItemValueForRowIndexAndColIndex(c, d);
|
|
4301
4446
|
if (f) {
|
|
4302
|
-
const { rowKey: x, key:
|
|
4303
|
-
this.ctx.database.getReadonly(x,
|
|
4447
|
+
const { rowKey: x, key: g } = f;
|
|
4448
|
+
this.ctx.database.getReadonly(x, g) || (r.add(x), s.push({
|
|
4304
4449
|
rowKey: x,
|
|
4305
|
-
key:
|
|
4450
|
+
key: g,
|
|
4306
4451
|
value: null,
|
|
4307
4452
|
row: {}
|
|
4308
4453
|
//内部有设置
|
|
@@ -4331,27 +4476,27 @@ class yi {
|
|
|
4331
4476
|
let o = ii(r);
|
|
4332
4477
|
const n = [i, i + o[0].length - 1], h = [e, e + o.length - 1], c = o.length === 1 && o[0].length === 1;
|
|
4333
4478
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
|
|
4334
|
-
const
|
|
4479
|
+
const g = {
|
|
4335
4480
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4336
4481
|
message: "Merged cells cannot span paste data"
|
|
4337
4482
|
};
|
|
4338
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4483
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", g) : alert(g.message);
|
|
4339
4484
|
return;
|
|
4340
4485
|
}
|
|
4341
4486
|
let d = [];
|
|
4342
|
-
for (let
|
|
4343
|
-
const p = o[
|
|
4344
|
-
for (let
|
|
4345
|
-
const w =
|
|
4487
|
+
for (let g = 0; g <= o.length - 1; g++) {
|
|
4488
|
+
const p = o[g].length;
|
|
4489
|
+
for (let u = 0; u <= p - 1; u++) {
|
|
4490
|
+
const w = g + e, y = u + i, C = o[g][u], m = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4346
4491
|
w,
|
|
4347
4492
|
y
|
|
4348
4493
|
);
|
|
4349
4494
|
if (m) {
|
|
4350
|
-
const { rowKey:
|
|
4351
|
-
this.ctx.database.getReadonly(
|
|
4352
|
-
rowKey:
|
|
4353
|
-
key:
|
|
4354
|
-
value:
|
|
4495
|
+
const { rowKey: E, key: b } = m;
|
|
4496
|
+
this.ctx.database.getReadonly(E, b) || (s.add(E), d.push({
|
|
4497
|
+
rowKey: E,
|
|
4498
|
+
key: b,
|
|
4499
|
+
value: C,
|
|
4355
4500
|
row: {}
|
|
4356
4501
|
//内部有设置
|
|
4357
4502
|
}));
|
|
@@ -4359,34 +4504,34 @@ class yi {
|
|
|
4359
4504
|
}
|
|
4360
4505
|
}
|
|
4361
4506
|
if (this.isCut) {
|
|
4362
|
-
const
|
|
4507
|
+
const g = this.clearSelectedData(
|
|
4363
4508
|
this.ctx.selector.xArrCopy,
|
|
4364
4509
|
this.ctx.selector.yArrCopy,
|
|
4365
4510
|
!0
|
|
4366
4511
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4367
|
-
), p = d.map((
|
|
4368
|
-
|
|
4369
|
-
p.includes(`${
|
|
4512
|
+
), p = d.map((u) => `${u.rowKey}-${u.key}`);
|
|
4513
|
+
g.forEach((u) => {
|
|
4514
|
+
p.includes(`${u.rowKey}-${u.key}`) || d.unshift(u);
|
|
4370
4515
|
}), this.isCut = !1;
|
|
4371
4516
|
}
|
|
4372
4517
|
if (!d.length)
|
|
4373
4518
|
return;
|
|
4374
4519
|
const { BEFORE_PASTE_DATA_METHOD: f } = this.ctx.config;
|
|
4375
4520
|
if (typeof f == "function") {
|
|
4376
|
-
const
|
|
4377
|
-
rowKey:
|
|
4378
|
-
key:
|
|
4379
|
-
value:
|
|
4380
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4381
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
4521
|
+
const g = f, p = d.map((u) => ({
|
|
4522
|
+
rowKey: u.rowKey,
|
|
4523
|
+
key: u.key,
|
|
4524
|
+
value: u.value,
|
|
4525
|
+
oldValue: this.ctx.database.getItemValue(u.rowKey, u.key),
|
|
4526
|
+
row: this.ctx.database.getRowDataItemForRowKey(u.rowKey)
|
|
4382
4527
|
}));
|
|
4383
|
-
if (d = await
|
|
4528
|
+
if (d = await g(p, n, h), d && !d.length)
|
|
4384
4529
|
return;
|
|
4385
4530
|
}
|
|
4386
4531
|
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4387
4532
|
let x = [];
|
|
4388
|
-
s.forEach((
|
|
4389
|
-
x.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4533
|
+
s.forEach((g) => {
|
|
4534
|
+
x.push(this.ctx.database.getRowDataItemForRowKey(g));
|
|
4390
4535
|
}), this.ctx.emit("pasteChange", d, x);
|
|
4391
4536
|
}).catch((r) => {
|
|
4392
4537
|
console.error("Failed to get the clipboard content:", r);
|
|
@@ -4476,19 +4621,19 @@ class yi {
|
|
|
4476
4621
|
body: h,
|
|
4477
4622
|
scrollX: c,
|
|
4478
4623
|
scrollY: d,
|
|
4479
|
-
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION:
|
|
4624
|
+
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION: g, ENABLE_MERGE_CELL_LINK: p }
|
|
4480
4625
|
} = this.ctx;
|
|
4481
4626
|
if (!i)
|
|
4482
4627
|
return;
|
|
4483
4628
|
p && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
4484
|
-
const { drawX:
|
|
4485
|
-
let R = o.height - w,
|
|
4486
|
-
|
|
4487
|
-
let
|
|
4488
|
-
x && (
|
|
4489
|
-
const
|
|
4490
|
-
let v = c,
|
|
4491
|
-
|
|
4629
|
+
const { drawX: u, drawY: w, width: y, height: C, fixed: m } = i, E = r - u + 1, b = i.drawX + y - (e - s) + 1;
|
|
4630
|
+
let R = o.height - w, O = C;
|
|
4631
|
+
O > h.visibleHeight && (O = h.visibleHeight);
|
|
4632
|
+
let L = 0;
|
|
4633
|
+
x && (g === "top" ? R = o.height + n.height - w : L = n.visibleHeight);
|
|
4634
|
+
const _ = w + O - (t - L - f);
|
|
4635
|
+
let v = c, A = d;
|
|
4636
|
+
b > 0 && !m ? v = Math.floor(c + b) : E > 0 && !m && (v = Math.floor(c - E)), R > 0 ? A = Math.floor(d - R) : _ > 0 && (A = Math.floor(d + _)), (Math.abs(c - v) > 2 || Math.abs(d - A) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(v, A), this.ctx.emit("adjustBoundaryPosition", i));
|
|
4492
4637
|
}
|
|
4493
4638
|
destroy() {
|
|
4494
4639
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -4497,18 +4642,19 @@ class yi {
|
|
|
4497
4642
|
class mi {
|
|
4498
4643
|
constructor(t) {
|
|
4499
4644
|
l(this, "ctx");
|
|
4645
|
+
l(this, "maxColRowCell");
|
|
4500
4646
|
this.ctx = t, this.init();
|
|
4501
4647
|
}
|
|
4502
4648
|
init() {
|
|
4503
|
-
this.ctx.on("
|
|
4504
|
-
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default")
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
}
|
|
4510
|
-
this.mouseenter(t);
|
|
4511
|
-
}), this.ctx.on("
|
|
4649
|
+
this.ctx.on("mousemove", (t) => {
|
|
4650
|
+
if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
|
|
4651
|
+
return;
|
|
4652
|
+
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: r, drawX: o, drawY: n, width: h, height: c } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || r === this.ctx.maxRowIndex ? 0 : 2, x = o + h - d + f, g = n + c - d + f;
|
|
4653
|
+
e > x && i > g && e < x + d && i < g + d && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4654
|
+
}), this.ctx.on("cellMouseenter", (t) => {
|
|
4655
|
+
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], r = i[1], { colIndex: o, rowIndex: n } = t;
|
|
4656
|
+
this.ctx.config.ENABLE_AUTOFILL && o === s && n === r && (this.maxColRowCell = t), this.mouseenter(t);
|
|
4657
|
+
}), this.ctx.on("mousedown", () => {
|
|
4512
4658
|
this.ctx.stageElement.style.cursor === "crosshair" && this.setMousedown();
|
|
4513
4659
|
}), this.ctx.on("mouseup", () => {
|
|
4514
4660
|
this.setMouseUp();
|
|
@@ -4550,22 +4696,22 @@ class mi {
|
|
|
4550
4696
|
SELECTOR_AREA_MIN_Y: d,
|
|
4551
4697
|
SELECTOR_AREA_MAX_Y: f,
|
|
4552
4698
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4553
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4554
|
-
} = this.ctx.config, p = h,
|
|
4555
|
-
let [
|
|
4556
|
-
if (
|
|
4699
|
+
SELECTOR_AREA_MAX_Y_OFFSET: g
|
|
4700
|
+
} = this.ctx.config, p = h, u = c || this.ctx.maxColIndex - x, w = d, y = f || this.ctx.maxRowIndex - g;
|
|
4701
|
+
let [C, m] = o, [E, b] = n;
|
|
4702
|
+
if (C < p || E < w)
|
|
4557
4703
|
return;
|
|
4558
|
-
o = [Math.max(p,
|
|
4704
|
+
o = [Math.max(p, C), Math.min(u, m)], n = [Math.max(w, E), Math.min(y, b)];
|
|
4559
4705
|
const { BEFORE_SET_AUTOFILL_METHOD: R } = this.ctx.config;
|
|
4560
4706
|
if (typeof R == "function") {
|
|
4561
|
-
const
|
|
4707
|
+
const L = R({
|
|
4562
4708
|
focusCell: this.ctx.focusCell,
|
|
4563
4709
|
xArr: o,
|
|
4564
4710
|
yArr: n
|
|
4565
4711
|
});
|
|
4566
|
-
if (!
|
|
4712
|
+
if (!L)
|
|
4567
4713
|
return;
|
|
4568
|
-
o =
|
|
4714
|
+
o = L.xArr, n = L.yArr;
|
|
4569
4715
|
}
|
|
4570
4716
|
this.ctx.autofill.xArr = o, this.ctx.autofill.yArr = n, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
4571
4717
|
}
|
|
@@ -4575,29 +4721,29 @@ class mi {
|
|
|
4575
4721
|
*/
|
|
4576
4722
|
async autofillData() {
|
|
4577
4723
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
4578
|
-
for (let
|
|
4724
|
+
for (let g = 0; g <= e.yArr[1] - e.yArr[0]; g++)
|
|
4579
4725
|
for (let p = 0; p <= e.xArr[1] - e.xArr[0]; p++) {
|
|
4580
|
-
const
|
|
4581
|
-
i.set(`${
|
|
4726
|
+
const u = g + e.yArr[0], w = p + e.xArr[0];
|
|
4727
|
+
i.set(`${u}-${w}`, !0);
|
|
4582
4728
|
}
|
|
4583
4729
|
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;
|
|
4584
4730
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
|
|
4585
|
-
const
|
|
4731
|
+
const g = {
|
|
4586
4732
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
4587
4733
|
message: "Merged cells cannot span autofill data"
|
|
4588
4734
|
};
|
|
4589
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4735
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", g) : alert(g.message);
|
|
4590
4736
|
return;
|
|
4591
4737
|
}
|
|
4592
4738
|
let d = [];
|
|
4593
|
-
for (let
|
|
4739
|
+
for (let g = 0; g <= h[1] - h[0]; g++)
|
|
4594
4740
|
for (let p = 0; p <= n[1] - n[0]; p++) {
|
|
4595
|
-
const
|
|
4596
|
-
if (
|
|
4597
|
-
const { rowKey:
|
|
4598
|
-
this.ctx.database.getReadonly(
|
|
4599
|
-
rowKey:
|
|
4600
|
-
key:
|
|
4741
|
+
const u = p + n[0], w = g + h[0], y = s[g % o][p % r], C = this.ctx.database.getItemValueForRowIndexAndColIndex(w, u), m = `${w}-${u}`;
|
|
4742
|
+
if (C && !i.has(m)) {
|
|
4743
|
+
const { rowKey: E, key: b } = C;
|
|
4744
|
+
this.ctx.database.getReadonly(E, b) || (t.add(E), d.push({
|
|
4745
|
+
rowKey: E,
|
|
4746
|
+
key: b,
|
|
4601
4747
|
value: y,
|
|
4602
4748
|
row: {}
|
|
4603
4749
|
}));
|
|
@@ -4608,20 +4754,20 @@ class mi {
|
|
|
4608
4754
|
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
|
|
4609
4755
|
const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
|
|
4610
4756
|
if (typeof f == "function") {
|
|
4611
|
-
const
|
|
4612
|
-
rowKey:
|
|
4613
|
-
key:
|
|
4614
|
-
value:
|
|
4615
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4616
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
4757
|
+
const g = f, p = d.map((u) => ({
|
|
4758
|
+
rowKey: u.rowKey,
|
|
4759
|
+
key: u.key,
|
|
4760
|
+
value: u.value,
|
|
4761
|
+
oldValue: this.ctx.database.getItemValue(u.rowKey, u.key),
|
|
4762
|
+
row: this.ctx.database.getRowDataItemForRowKey(u.rowKey)
|
|
4617
4763
|
}));
|
|
4618
|
-
if (d = await
|
|
4764
|
+
if (d = await g(p, n, h), d && !d.length)
|
|
4619
4765
|
return;
|
|
4620
4766
|
}
|
|
4621
4767
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4622
4768
|
let x = [];
|
|
4623
|
-
t.forEach((
|
|
4624
|
-
x.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4769
|
+
t.forEach((g) => {
|
|
4770
|
+
x.push(this.ctx.database.getRowDataItemForRowKey(g));
|
|
4625
4771
|
}), this.ctx.emit("autofillChange", d, x);
|
|
4626
4772
|
}
|
|
4627
4773
|
mouseenter(t) {
|
|
@@ -4644,11 +4790,11 @@ const rt = Math.min, U = Math.max, ft = Math.round, z = (a) => ({
|
|
|
4644
4790
|
right: "left",
|
|
4645
4791
|
bottom: "top",
|
|
4646
4792
|
top: "bottom"
|
|
4647
|
-
},
|
|
4793
|
+
}, Ci = {
|
|
4648
4794
|
start: "end",
|
|
4649
4795
|
end: "start"
|
|
4650
4796
|
};
|
|
4651
|
-
function
|
|
4797
|
+
function It(a, t, e) {
|
|
4652
4798
|
return U(a, rt(t, e));
|
|
4653
4799
|
}
|
|
4654
4800
|
function at(a, t) {
|
|
@@ -4672,7 +4818,7 @@ function J(a) {
|
|
|
4672
4818
|
function Ht(a) {
|
|
4673
4819
|
return ne(J(a));
|
|
4674
4820
|
}
|
|
4675
|
-
function
|
|
4821
|
+
function bi(a, t, e) {
|
|
4676
4822
|
e === void 0 && (e = !1);
|
|
4677
4823
|
const i = lt(a), s = Ht(a), r = Mt(s);
|
|
4678
4824
|
let o = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
@@ -4683,7 +4829,7 @@ function vi(a) {
|
|
|
4683
4829
|
return [Ot(a), t, Ot(t)];
|
|
4684
4830
|
}
|
|
4685
4831
|
function Ot(a) {
|
|
4686
|
-
return a.replace(/start|end/g, (t) =>
|
|
4832
|
+
return a.replace(/start|end/g, (t) => Ci[t]);
|
|
4687
4833
|
}
|
|
4688
4834
|
function Ri(a, t, e) {
|
|
4689
4835
|
const i = ["left", "right"], s = ["right", "left"], r = ["top", "bottom"], o = ["bottom", "top"];
|
|
@@ -4698,7 +4844,7 @@ function Ri(a, t, e) {
|
|
|
4698
4844
|
return [];
|
|
4699
4845
|
}
|
|
4700
4846
|
}
|
|
4701
|
-
function
|
|
4847
|
+
function _i(a, t, e, i) {
|
|
4702
4848
|
const s = lt(a);
|
|
4703
4849
|
let r = Ri(q(a), e === "start", i);
|
|
4704
4850
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
@@ -4706,7 +4852,7 @@ function Ii(a, t, e, i) {
|
|
|
4706
4852
|
function xt(a) {
|
|
4707
4853
|
return a.replace(/left|right|bottom|top/g, (t) => Ei[t]);
|
|
4708
4854
|
}
|
|
4709
|
-
function
|
|
4855
|
+
function Ii(a) {
|
|
4710
4856
|
return {
|
|
4711
4857
|
top: 0,
|
|
4712
4858
|
right: 0,
|
|
@@ -4716,7 +4862,7 @@ function _i(a) {
|
|
|
4716
4862
|
};
|
|
4717
4863
|
}
|
|
4718
4864
|
function ae(a) {
|
|
4719
|
-
return typeof a != "number" ?
|
|
4865
|
+
return typeof a != "number" ? Ii(a) : {
|
|
4720
4866
|
top: a,
|
|
4721
4867
|
right: a,
|
|
4722
4868
|
bottom: a,
|
|
@@ -4747,47 +4893,47 @@ function zt(a, t, e) {
|
|
|
4747
4893
|
floating: s
|
|
4748
4894
|
} = a;
|
|
4749
4895
|
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;
|
|
4750
|
-
let
|
|
4896
|
+
let g;
|
|
4751
4897
|
switch (h) {
|
|
4752
4898
|
case "top":
|
|
4753
|
-
|
|
4899
|
+
g = {
|
|
4754
4900
|
x: d,
|
|
4755
4901
|
y: i.y - s.height
|
|
4756
4902
|
};
|
|
4757
4903
|
break;
|
|
4758
4904
|
case "bottom":
|
|
4759
|
-
|
|
4905
|
+
g = {
|
|
4760
4906
|
x: d,
|
|
4761
4907
|
y: i.y + i.height
|
|
4762
4908
|
};
|
|
4763
4909
|
break;
|
|
4764
4910
|
case "right":
|
|
4765
|
-
|
|
4911
|
+
g = {
|
|
4766
4912
|
x: i.x + i.width,
|
|
4767
4913
|
y: f
|
|
4768
4914
|
};
|
|
4769
4915
|
break;
|
|
4770
4916
|
case "left":
|
|
4771
|
-
|
|
4917
|
+
g = {
|
|
4772
4918
|
x: i.x - s.width,
|
|
4773
4919
|
y: f
|
|
4774
4920
|
};
|
|
4775
4921
|
break;
|
|
4776
4922
|
default:
|
|
4777
|
-
|
|
4923
|
+
g = {
|
|
4778
4924
|
x: i.x,
|
|
4779
4925
|
y: i.y
|
|
4780
4926
|
};
|
|
4781
4927
|
}
|
|
4782
4928
|
switch (lt(t)) {
|
|
4783
4929
|
case "start":
|
|
4784
|
-
|
|
4930
|
+
g[o] -= x * (e && c ? -1 : 1);
|
|
4785
4931
|
break;
|
|
4786
4932
|
case "end":
|
|
4787
|
-
|
|
4933
|
+
g[o] += x * (e && c ? -1 : 1);
|
|
4788
4934
|
break;
|
|
4789
4935
|
}
|
|
4790
|
-
return
|
|
4936
|
+
return g;
|
|
4791
4937
|
}
|
|
4792
4938
|
const Oi = async (a, t, e) => {
|
|
4793
4939
|
const {
|
|
@@ -4803,23 +4949,23 @@ const Oi = async (a, t, e) => {
|
|
|
4803
4949
|
}), {
|
|
4804
4950
|
x: d,
|
|
4805
4951
|
y: f
|
|
4806
|
-
} = zt(c, i, h), x = i,
|
|
4807
|
-
for (let
|
|
4952
|
+
} = zt(c, i, h), x = i, g = {}, p = 0;
|
|
4953
|
+
for (let u = 0; u < n.length; u++) {
|
|
4808
4954
|
const {
|
|
4809
4955
|
name: w,
|
|
4810
4956
|
fn: y
|
|
4811
|
-
} = n[
|
|
4812
|
-
x:
|
|
4957
|
+
} = n[u], {
|
|
4958
|
+
x: C,
|
|
4813
4959
|
y: m,
|
|
4814
|
-
data:
|
|
4815
|
-
reset:
|
|
4960
|
+
data: E,
|
|
4961
|
+
reset: b
|
|
4816
4962
|
} = await y({
|
|
4817
4963
|
x: d,
|
|
4818
4964
|
y: f,
|
|
4819
4965
|
initialPlacement: i,
|
|
4820
4966
|
placement: x,
|
|
4821
4967
|
strategy: s,
|
|
4822
|
-
middlewareData:
|
|
4968
|
+
middlewareData: g,
|
|
4823
4969
|
rects: c,
|
|
4824
4970
|
platform: o,
|
|
4825
4971
|
elements: {
|
|
@@ -4827,27 +4973,27 @@ const Oi = async (a, t, e) => {
|
|
|
4827
4973
|
floating: t
|
|
4828
4974
|
}
|
|
4829
4975
|
});
|
|
4830
|
-
d =
|
|
4831
|
-
...
|
|
4976
|
+
d = C ?? d, f = m ?? f, g = {
|
|
4977
|
+
...g,
|
|
4832
4978
|
[w]: {
|
|
4833
|
-
...
|
|
4834
|
-
...
|
|
4979
|
+
...g[w],
|
|
4980
|
+
...E
|
|
4835
4981
|
}
|
|
4836
|
-
},
|
|
4982
|
+
}, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (x = b.placement), b.rects && (c = b.rects === !0 ? await o.getElementRects({
|
|
4837
4983
|
reference: a,
|
|
4838
4984
|
floating: t,
|
|
4839
4985
|
strategy: s
|
|
4840
|
-
}) :
|
|
4986
|
+
}) : b.rects), {
|
|
4841
4987
|
x: d,
|
|
4842
4988
|
y: f
|
|
4843
|
-
} = zt(c, x, h)),
|
|
4989
|
+
} = zt(c, x, h)), u = -1);
|
|
4844
4990
|
}
|
|
4845
4991
|
return {
|
|
4846
4992
|
x: d,
|
|
4847
4993
|
y: f,
|
|
4848
4994
|
placement: x,
|
|
4849
4995
|
strategy: s,
|
|
4850
|
-
middlewareData:
|
|
4996
|
+
middlewareData: g
|
|
4851
4997
|
};
|
|
4852
4998
|
};
|
|
4853
4999
|
async function le(a, t) {
|
|
@@ -4865,34 +5011,34 @@ async function le(a, t) {
|
|
|
4865
5011
|
rootBoundary: d = "viewport",
|
|
4866
5012
|
elementContext: f = "floating",
|
|
4867
5013
|
altBoundary: x = !1,
|
|
4868
|
-
padding:
|
|
4869
|
-
} = at(t, a), p = ae(
|
|
5014
|
+
padding: g = 0
|
|
5015
|
+
} = at(t, a), p = ae(g), w = n[x ? f === "floating" ? "reference" : "floating" : f], y = ut(await r.getClippingRect({
|
|
4870
5016
|
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)),
|
|
4871
5017
|
boundary: c,
|
|
4872
5018
|
rootBoundary: d,
|
|
4873
5019
|
strategy: h
|
|
4874
|
-
})),
|
|
5020
|
+
})), C = f === "floating" ? {
|
|
4875
5021
|
x: i,
|
|
4876
5022
|
y: s,
|
|
4877
5023
|
width: o.floating.width,
|
|
4878
5024
|
height: o.floating.height
|
|
4879
|
-
} : o.reference, m = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(n.floating)),
|
|
5025
|
+
} : o.reference, m = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(n.floating)), E = await (r.isElement == null ? void 0 : r.isElement(m)) ? await (r.getScale == null ? void 0 : r.getScale(m)) || {
|
|
4880
5026
|
x: 1,
|
|
4881
5027
|
y: 1
|
|
4882
5028
|
} : {
|
|
4883
5029
|
x: 1,
|
|
4884
5030
|
y: 1
|
|
4885
|
-
},
|
|
5031
|
+
}, b = ut(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4886
5032
|
elements: n,
|
|
4887
|
-
rect:
|
|
5033
|
+
rect: C,
|
|
4888
5034
|
offsetParent: m,
|
|
4889
5035
|
strategy: h
|
|
4890
|
-
}) :
|
|
5036
|
+
}) : C);
|
|
4891
5037
|
return {
|
|
4892
|
-
top: (y.top -
|
|
4893
|
-
bottom: (
|
|
4894
|
-
left: (y.left -
|
|
4895
|
-
right: (
|
|
5038
|
+
top: (y.top - b.top + p.top) / E.y,
|
|
5039
|
+
bottom: (b.bottom - y.bottom + p.bottom) / E.y,
|
|
5040
|
+
left: (y.left - b.left + p.left) / E.x,
|
|
5041
|
+
right: (b.right - y.right + p.right) / E.x
|
|
4896
5042
|
};
|
|
4897
5043
|
}
|
|
4898
5044
|
const Si = (a) => ({
|
|
@@ -4916,23 +5062,23 @@ const Si = (a) => ({
|
|
|
4916
5062
|
const f = ae(d), x = {
|
|
4917
5063
|
x: e,
|
|
4918
5064
|
y: i
|
|
4919
|
-
},
|
|
4920
|
-
let
|
|
4921
|
-
(!
|
|
4922
|
-
const
|
|
5065
|
+
}, g = Ht(s), p = Mt(g), u = await o.getDimensions(c), w = g === "y", y = w ? "top" : "left", C = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", E = r.reference[p] + r.reference[g] - x[g] - r.floating[p], b = x[g] - r.reference[g], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c));
|
|
5066
|
+
let O = R ? R[m] : 0;
|
|
5067
|
+
(!O || !await (o.isElement == null ? void 0 : o.isElement(R))) && (O = n.floating[m] || r.floating[p]);
|
|
5068
|
+
const L = E / 2 - b / 2, _ = O / 2 - u[p] / 2 - 1, v = rt(f[y], _), A = rt(f[C], _), S = v, M = O - u[p] - A, T = O / 2 - u[p] / 2 + L, N = It(S, T, M), Y = !h.arrow && lt(s) != null && T !== N && r.reference[p] / 2 - (T < S ? v : A) - u[p] / 2 < 0, B = Y ? T < S ? T - S : T - M : 0;
|
|
4923
5069
|
return {
|
|
4924
|
-
[
|
|
5070
|
+
[g]: x[g] + B,
|
|
4925
5071
|
data: {
|
|
4926
|
-
[
|
|
4927
|
-
centerOffset: T - N -
|
|
5072
|
+
[g]: N,
|
|
5073
|
+
centerOffset: T - N - B,
|
|
4928
5074
|
...Y && {
|
|
4929
|
-
alignmentOffset:
|
|
5075
|
+
alignmentOffset: B
|
|
4930
5076
|
}
|
|
4931
5077
|
},
|
|
4932
5078
|
reset: Y
|
|
4933
5079
|
};
|
|
4934
5080
|
}
|
|
4935
|
-
}),
|
|
5081
|
+
}), Li = function(a) {
|
|
4936
5082
|
return a === void 0 && (a = {}), {
|
|
4937
5083
|
name: "flip",
|
|
4938
5084
|
options: a,
|
|
@@ -4949,27 +5095,27 @@ const Si = (a) => ({
|
|
|
4949
5095
|
mainAxis: d = !0,
|
|
4950
5096
|
crossAxis: f = !0,
|
|
4951
5097
|
fallbackPlacements: x,
|
|
4952
|
-
fallbackStrategy:
|
|
5098
|
+
fallbackStrategy: g = "bestFit",
|
|
4953
5099
|
fallbackAxisSideDirection: p = "none",
|
|
4954
|
-
flipAlignment:
|
|
5100
|
+
flipAlignment: u = !0,
|
|
4955
5101
|
...w
|
|
4956
5102
|
} = at(a, t);
|
|
4957
5103
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4958
5104
|
return {};
|
|
4959
|
-
const y = q(s),
|
|
4960
|
-
!x && R &&
|
|
4961
|
-
const
|
|
5105
|
+
const y = q(s), C = J(n), m = q(n) === n, E = await (h.isRTL == null ? void 0 : h.isRTL(c.floating)), b = x || (m || !u ? [xt(n)] : vi(n)), R = p !== "none";
|
|
5106
|
+
!x && R && b.push(..._i(n, u, p, E));
|
|
5107
|
+
const O = [n, ...b], L = await le(t, w), _ = [];
|
|
4962
5108
|
let v = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4963
|
-
if (d &&
|
|
4964
|
-
const T =
|
|
4965
|
-
|
|
5109
|
+
if (d && _.push(L[y]), f) {
|
|
5110
|
+
const T = bi(s, o, E);
|
|
5111
|
+
_.push(L[T[0]], L[T[1]]);
|
|
4966
5112
|
}
|
|
4967
5113
|
if (v = [...v, {
|
|
4968
5114
|
placement: s,
|
|
4969
|
-
overflows:
|
|
4970
|
-
}], !
|
|
4971
|
-
var
|
|
4972
|
-
const T = (((
|
|
5115
|
+
overflows: _
|
|
5116
|
+
}], !_.every((T) => T <= 0)) {
|
|
5117
|
+
var A, S;
|
|
5118
|
+
const T = (((A = r.flip) == null ? void 0 : A.index) || 0) + 1, N = O[T];
|
|
4973
5119
|
if (N)
|
|
4974
5120
|
return {
|
|
4975
5121
|
data: {
|
|
@@ -4980,21 +5126,21 @@ const Si = (a) => ({
|
|
|
4980
5126
|
placement: N
|
|
4981
5127
|
}
|
|
4982
5128
|
};
|
|
4983
|
-
let Y = (
|
|
5129
|
+
let Y = (S = v.filter((B) => B.overflows[0] <= 0).sort((B, W) => B.overflows[1] - W.overflows[1])[0]) == null ? void 0 : S.placement;
|
|
4984
5130
|
if (!Y)
|
|
4985
|
-
switch (
|
|
5131
|
+
switch (g) {
|
|
4986
5132
|
case "bestFit": {
|
|
4987
5133
|
var M;
|
|
4988
|
-
const
|
|
5134
|
+
const B = (M = v.filter((W) => {
|
|
4989
5135
|
if (R) {
|
|
4990
5136
|
const P = J(W.placement);
|
|
4991
|
-
return P ===
|
|
5137
|
+
return P === C || // Create a bias to the `y` side axis due to horizontal
|
|
4992
5138
|
// reading directions favoring greater width.
|
|
4993
5139
|
P === "y";
|
|
4994
5140
|
}
|
|
4995
5141
|
return !0;
|
|
4996
5142
|
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, Ee) => P + Ee, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : M[0];
|
|
4997
|
-
|
|
5143
|
+
B && (Y = B);
|
|
4998
5144
|
break;
|
|
4999
5145
|
}
|
|
5000
5146
|
case "initialPlacement":
|
|
@@ -5012,7 +5158,7 @@ const Si = (a) => ({
|
|
|
5012
5158
|
}
|
|
5013
5159
|
};
|
|
5014
5160
|
};
|
|
5015
|
-
async function
|
|
5161
|
+
async function Ai(a, t) {
|
|
5016
5162
|
const {
|
|
5017
5163
|
placement: e,
|
|
5018
5164
|
platform: i,
|
|
@@ -5020,7 +5166,7 @@ async function Li(a, t) {
|
|
|
5020
5166
|
} = 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);
|
|
5021
5167
|
let {
|
|
5022
5168
|
mainAxis: x,
|
|
5023
|
-
crossAxis:
|
|
5169
|
+
crossAxis: g,
|
|
5024
5170
|
alignmentAxis: p
|
|
5025
5171
|
} = typeof f == "number" ? {
|
|
5026
5172
|
mainAxis: f,
|
|
@@ -5031,12 +5177,12 @@ async function Li(a, t) {
|
|
|
5031
5177
|
crossAxis: f.crossAxis || 0,
|
|
5032
5178
|
alignmentAxis: f.alignmentAxis
|
|
5033
5179
|
};
|
|
5034
|
-
return n && typeof p == "number" && (
|
|
5035
|
-
x:
|
|
5180
|
+
return n && typeof p == "number" && (g = n === "end" ? p * -1 : p), h ? {
|
|
5181
|
+
x: g * d,
|
|
5036
5182
|
y: x * c
|
|
5037
5183
|
} : {
|
|
5038
5184
|
x: x * c,
|
|
5039
|
-
y:
|
|
5185
|
+
y: g * d
|
|
5040
5186
|
};
|
|
5041
5187
|
}
|
|
5042
5188
|
const Ti = function(a) {
|
|
@@ -5050,7 +5196,7 @@ const Ti = function(a) {
|
|
|
5050
5196
|
y: r,
|
|
5051
5197
|
placement: o,
|
|
5052
5198
|
middlewareData: n
|
|
5053
|
-
} = t, h = await
|
|
5199
|
+
} = t, h = await Ai(t, a);
|
|
5054
5200
|
return o === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
|
|
5055
5201
|
x: s + h.x,
|
|
5056
5202
|
y: r + h.y,
|
|
@@ -5077,11 +5223,11 @@ const Ti = function(a) {
|
|
|
5077
5223
|
fn: (w) => {
|
|
5078
5224
|
let {
|
|
5079
5225
|
x: y,
|
|
5080
|
-
y:
|
|
5226
|
+
y: C
|
|
5081
5227
|
} = w;
|
|
5082
5228
|
return {
|
|
5083
5229
|
x: y,
|
|
5084
|
-
y:
|
|
5230
|
+
y: C
|
|
5085
5231
|
};
|
|
5086
5232
|
}
|
|
5087
5233
|
},
|
|
@@ -5090,25 +5236,25 @@ const Ti = function(a) {
|
|
|
5090
5236
|
x: e,
|
|
5091
5237
|
y: i
|
|
5092
5238
|
}, d = await le(t, h), f = J(q(s)), x = ne(f);
|
|
5093
|
-
let
|
|
5239
|
+
let g = c[x], p = c[f];
|
|
5094
5240
|
if (r) {
|
|
5095
|
-
const w = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right",
|
|
5096
|
-
|
|
5241
|
+
const w = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", C = g + d[w], m = g - d[y];
|
|
5242
|
+
g = It(C, g, m);
|
|
5097
5243
|
}
|
|
5098
5244
|
if (o) {
|
|
5099
|
-
const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right",
|
|
5100
|
-
p =
|
|
5245
|
+
const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", C = p + d[w], m = p - d[y];
|
|
5246
|
+
p = It(C, p, m);
|
|
5101
5247
|
}
|
|
5102
|
-
const
|
|
5248
|
+
const u = n.fn({
|
|
5103
5249
|
...t,
|
|
5104
|
-
[x]:
|
|
5250
|
+
[x]: g,
|
|
5105
5251
|
[f]: p
|
|
5106
5252
|
});
|
|
5107
5253
|
return {
|
|
5108
|
-
...
|
|
5254
|
+
...u,
|
|
5109
5255
|
data: {
|
|
5110
|
-
x:
|
|
5111
|
-
y:
|
|
5256
|
+
x: u.x - e,
|
|
5257
|
+
y: u.y - i,
|
|
5112
5258
|
enabled: {
|
|
5113
5259
|
[x]: r,
|
|
5114
5260
|
[f]: o
|
|
@@ -5138,7 +5284,7 @@ function he(a) {
|
|
|
5138
5284
|
function X(a) {
|
|
5139
5285
|
return gt() ? a instanceof Element || a instanceof F(a).Element : !1;
|
|
5140
5286
|
}
|
|
5141
|
-
function
|
|
5287
|
+
function K(a) {
|
|
5142
5288
|
return gt() ? a instanceof HTMLElement || a instanceof F(a).HTMLElement : !1;
|
|
5143
5289
|
}
|
|
5144
5290
|
function $t(a) {
|
|
@@ -5171,7 +5317,7 @@ function Dt(a) {
|
|
|
5171
5317
|
}
|
|
5172
5318
|
function Di(a) {
|
|
5173
5319
|
let t = $(a);
|
|
5174
|
-
for (;
|
|
5320
|
+
for (; K(t) && !Q(t); ) {
|
|
5175
5321
|
if (Dt(t))
|
|
5176
5322
|
return t;
|
|
5177
5323
|
if (wt(t))
|
|
@@ -5212,25 +5358,25 @@ function $(a) {
|
|
|
5212
5358
|
}
|
|
5213
5359
|
function ce(a) {
|
|
5214
5360
|
const t = $(a);
|
|
5215
|
-
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body :
|
|
5361
|
+
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : K(t) && ht(t) ? t : ce(t);
|
|
5216
5362
|
}
|
|
5217
5363
|
function St(a, t, e) {
|
|
5218
5364
|
var i;
|
|
5219
5365
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
5220
5366
|
const s = ce(a), r = s === ((i = a.ownerDocument) == null ? void 0 : i.body), o = F(s);
|
|
5221
5367
|
if (r) {
|
|
5222
|
-
const n =
|
|
5368
|
+
const n = Lt(o);
|
|
5223
5369
|
return t.concat(o, o.visualViewport || [], ht(s) ? s : [], n && e ? St(n) : []);
|
|
5224
5370
|
}
|
|
5225
5371
|
return t.concat(s, St(s, [], e));
|
|
5226
5372
|
}
|
|
5227
|
-
function
|
|
5373
|
+
function Lt(a) {
|
|
5228
5374
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
5229
5375
|
}
|
|
5230
5376
|
function de(a) {
|
|
5231
5377
|
const t = k(a);
|
|
5232
5378
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
5233
|
-
const s =
|
|
5379
|
+
const s = K(a), r = s ? a.offsetWidth : e, o = s ? a.offsetHeight : i, n = ft(e) !== r || ft(i) !== o;
|
|
5234
5380
|
return n && (e = r, i = o), {
|
|
5235
5381
|
width: e,
|
|
5236
5382
|
height: i,
|
|
@@ -5242,7 +5388,7 @@ function fe(a) {
|
|
|
5242
5388
|
}
|
|
5243
5389
|
function Z(a) {
|
|
5244
5390
|
const t = fe(a);
|
|
5245
|
-
if (!
|
|
5391
|
+
if (!K(t))
|
|
5246
5392
|
return z(1);
|
|
5247
5393
|
const e = t.getBoundingClientRect(), {
|
|
5248
5394
|
width: i,
|
|
@@ -5274,11 +5420,11 @@ function ot(a, t, e, i) {
|
|
|
5274
5420
|
const n = Xi(r, e, i) ? xe(r) : z(0);
|
|
5275
5421
|
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;
|
|
5276
5422
|
if (r) {
|
|
5277
|
-
const x = F(r),
|
|
5278
|
-
let p = x,
|
|
5279
|
-
for (;
|
|
5280
|
-
const w = Z(
|
|
5281
|
-
h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c +=
|
|
5423
|
+
const x = F(r), g = i && X(i) ? F(i) : i;
|
|
5424
|
+
let p = x, u = Lt(p);
|
|
5425
|
+
for (; u && i && g !== p; ) {
|
|
5426
|
+
const w = Z(u), y = u.getBoundingClientRect(), C = k(u), m = y.left + (u.clientLeft + parseFloat(C.paddingLeft)) * w.x, E = y.top + (u.clientTop + parseFloat(C.paddingTop)) * w.y;
|
|
5427
|
+
h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c += E, p = F(u), u = Lt(p);
|
|
5282
5428
|
}
|
|
5283
5429
|
}
|
|
5284
5430
|
return ut({
|
|
@@ -5302,8 +5448,8 @@ function ki(a) {
|
|
|
5302
5448
|
scrollLeft: 0,
|
|
5303
5449
|
scrollTop: 0
|
|
5304
5450
|
}, c = z(1);
|
|
5305
|
-
const d = z(0), f =
|
|
5306
|
-
if ((f || !f && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)),
|
|
5451
|
+
const d = z(0), f = K(i);
|
|
5452
|
+
if ((f || !f && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), K(i))) {
|
|
5307
5453
|
const x = ot(i);
|
|
5308
5454
|
c = Z(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5309
5455
|
}
|
|
@@ -5317,13 +5463,13 @@ function ki(a) {
|
|
|
5317
5463
|
function Ni(a) {
|
|
5318
5464
|
return Array.from(a.getClientRects());
|
|
5319
5465
|
}
|
|
5320
|
-
function
|
|
5466
|
+
function At(a, t) {
|
|
5321
5467
|
const e = pt(a).scrollLeft;
|
|
5322
5468
|
return t ? t.left + e : ot(V(a)).left + e;
|
|
5323
5469
|
}
|
|
5324
|
-
function
|
|
5470
|
+
function Bi(a) {
|
|
5325
5471
|
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);
|
|
5326
|
-
let o = -e.scrollLeft +
|
|
5472
|
+
let o = -e.scrollLeft + At(a);
|
|
5327
5473
|
const n = -e.scrollTop;
|
|
5328
5474
|
return k(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
|
|
5329
5475
|
width: s,
|
|
@@ -5332,7 +5478,7 @@ function Ki(a) {
|
|
|
5332
5478
|
y: n
|
|
5333
5479
|
};
|
|
5334
5480
|
}
|
|
5335
|
-
function
|
|
5481
|
+
function Ki(a, t) {
|
|
5336
5482
|
const e = F(a), i = V(a), s = e.visualViewport;
|
|
5337
5483
|
let r = i.clientWidth, o = i.clientHeight, n = 0, h = 0;
|
|
5338
5484
|
if (s) {
|
|
@@ -5348,7 +5494,7 @@ function Bi(a, t) {
|
|
|
5348
5494
|
};
|
|
5349
5495
|
}
|
|
5350
5496
|
function Yi(a, t) {
|
|
5351
|
-
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, r =
|
|
5497
|
+
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, r = K(a) ? Z(a) : z(1), o = a.clientWidth * r.x, n = a.clientHeight * r.y, h = s * r.x, c = i * r.y;
|
|
5352
5498
|
return {
|
|
5353
5499
|
width: o,
|
|
5354
5500
|
height: n,
|
|
@@ -5359,9 +5505,9 @@ function Yi(a, t) {
|
|
|
5359
5505
|
function Gt(a, t, e) {
|
|
5360
5506
|
let i;
|
|
5361
5507
|
if (t === "viewport")
|
|
5362
|
-
i =
|
|
5508
|
+
i = Ki(a, e);
|
|
5363
5509
|
else if (t === "document")
|
|
5364
|
-
i =
|
|
5510
|
+
i = Bi(V(a));
|
|
5365
5511
|
else if (X(t))
|
|
5366
5512
|
i = Yi(t, e);
|
|
5367
5513
|
else {
|
|
@@ -5420,7 +5566,7 @@ function Pi(a) {
|
|
|
5420
5566
|
};
|
|
5421
5567
|
}
|
|
5422
5568
|
function zi(a, t, e) {
|
|
5423
|
-
const i =
|
|
5569
|
+
const i = K(t), s = V(t), r = e === "fixed", o = ot(a, !0, r, t);
|
|
5424
5570
|
let n = {
|
|
5425
5571
|
scrollLeft: 0,
|
|
5426
5572
|
scrollTop: 0
|
|
@@ -5428,14 +5574,14 @@ function zi(a, t, e) {
|
|
|
5428
5574
|
const h = z(0);
|
|
5429
5575
|
if (i || !i && !r)
|
|
5430
5576
|
if ((tt(t) !== "body" || ht(s)) && (n = pt(t)), i) {
|
|
5431
|
-
const
|
|
5432
|
-
h.x =
|
|
5433
|
-
} else s && (h.x =
|
|
5577
|
+
const g = ot(t, !0, r, t);
|
|
5578
|
+
h.x = g.x + t.clientLeft, h.y = g.y + t.clientTop;
|
|
5579
|
+
} else s && (h.x = At(s));
|
|
5434
5580
|
let c = 0, d = 0;
|
|
5435
5581
|
if (s && !i && !r) {
|
|
5436
|
-
const
|
|
5437
|
-
d =
|
|
5438
|
-
|
|
5582
|
+
const g = s.getBoundingClientRect();
|
|
5583
|
+
d = g.top + n.scrollTop, c = g.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
5584
|
+
At(s, g);
|
|
5439
5585
|
}
|
|
5440
5586
|
const f = o.left + n.scrollLeft - h.x - c, x = o.top + n.scrollTop - h.y - d;
|
|
5441
5587
|
return {
|
|
@@ -5449,7 +5595,7 @@ function mt(a) {
|
|
|
5449
5595
|
return k(a).position === "static";
|
|
5450
5596
|
}
|
|
5451
5597
|
function qt(a, t) {
|
|
5452
|
-
if (!
|
|
5598
|
+
if (!K(a) || k(a).position === "fixed")
|
|
5453
5599
|
return null;
|
|
5454
5600
|
if (t)
|
|
5455
5601
|
return t(a);
|
|
@@ -5460,7 +5606,7 @@ function ge(a, t) {
|
|
|
5460
5606
|
const e = F(a);
|
|
5461
5607
|
if (wt(a))
|
|
5462
5608
|
return e;
|
|
5463
|
-
if (!
|
|
5609
|
+
if (!K(a)) {
|
|
5464
5610
|
let s = $(a);
|
|
5465
5611
|
for (; s && !Q(s); ) {
|
|
5466
5612
|
if (X(s) && !mt(s))
|
|
@@ -5500,7 +5646,7 @@ const qi = {
|
|
|
5500
5646
|
getScale: Z,
|
|
5501
5647
|
isElement: X,
|
|
5502
5648
|
isRTL: Gi
|
|
5503
|
-
}, we = Ti, pe = Mi, ye =
|
|
5649
|
+
}, we = Ti, pe = Mi, ye = Li, ji = Si, me = (a, t, e) => {
|
|
5504
5650
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
5505
5651
|
platform: qi,
|
|
5506
5652
|
...e
|
|
@@ -5672,6 +5818,10 @@ class Zi {
|
|
|
5672
5818
|
this.ctx.emit("setMoveFocus", "BOTTOM");
|
|
5673
5819
|
return;
|
|
5674
5820
|
}
|
|
5821
|
+
if (t.code === "Enter" && !this.ctx.editing) {
|
|
5822
|
+
t.preventDefault(), this.startEdit();
|
|
5823
|
+
return;
|
|
5824
|
+
}
|
|
5675
5825
|
const e = t.key, i = t.ctrlKey, s = t.altKey, r = t.shiftKey, o = t.metaKey;
|
|
5676
5826
|
i || s || r || o || [
|
|
5677
5827
|
"Enter",
|
|
@@ -5751,21 +5901,21 @@ class Zi {
|
|
|
5751
5901
|
}
|
|
5752
5902
|
startEditByInput(t, e = !1) {
|
|
5753
5903
|
const i = e ? null : t.getValue(), { editorType: s } = t;
|
|
5754
|
-
this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
5755
|
-
let {
|
|
5756
|
-
this.drawX =
|
|
5904
|
+
t.update(), this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
5905
|
+
let { height: r, width: o, drawY: n, drawX: h } = t;
|
|
5906
|
+
this.drawX = h, this.drawY = n;
|
|
5757
5907
|
const {
|
|
5758
5908
|
config: { CELL_PADDING: c },
|
|
5759
5909
|
header: d
|
|
5760
5910
|
} = this.ctx;
|
|
5761
5911
|
let f = this.ctx.body.visibleHeight;
|
|
5762
|
-
if (
|
|
5763
|
-
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${
|
|
5912
|
+
if (r > f && (r = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
5913
|
+
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${o - 1}px`, this.inputEl.style.minHeight = `${r - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${o - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${c}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus();
|
|
5764
5914
|
const x = this.inputEl.value.length;
|
|
5765
5915
|
this.inputEl.setSelectionRange(x, x);
|
|
5766
5916
|
} else
|
|
5767
5917
|
this.inputEl.style.display = "none";
|
|
5768
|
-
(this.inputEl.scrollHeight >
|
|
5918
|
+
(this.inputEl.scrollHeight > r || this.drawY < d.height) && this.autoSize();
|
|
5769
5919
|
}
|
|
5770
5920
|
doneEditByInput() {
|
|
5771
5921
|
if (this.cellTarget && this.cellTarget.editorType === "text") {
|
|
@@ -5880,7 +6030,7 @@ class Qi {
|
|
|
5880
6030
|
height: `${o}px`
|
|
5881
6031
|
},
|
|
5882
6032
|
cells: c
|
|
5883
|
-
},
|
|
6033
|
+
}, g = {
|
|
5884
6034
|
key: "center",
|
|
5885
6035
|
style: {
|
|
5886
6036
|
position: "absolute",
|
|
@@ -5912,7 +6062,7 @@ class Qi {
|
|
|
5912
6062
|
width: `${r}px`,
|
|
5913
6063
|
height: `${o}px`
|
|
5914
6064
|
},
|
|
5915
|
-
views: [x,
|
|
6065
|
+
views: [x, g, p]
|
|
5916
6066
|
};
|
|
5917
6067
|
}
|
|
5918
6068
|
getBody() {
|
|
@@ -5938,7 +6088,7 @@ class Qi {
|
|
|
5938
6088
|
height: `${d}px`
|
|
5939
6089
|
},
|
|
5940
6090
|
cells: e
|
|
5941
|
-
},
|
|
6091
|
+
}, g = {
|
|
5942
6092
|
key: "center",
|
|
5943
6093
|
style: {
|
|
5944
6094
|
position: "absolute",
|
|
@@ -5970,13 +6120,13 @@ class Qi {
|
|
|
5970
6120
|
width: `${c}px`,
|
|
5971
6121
|
height: `${d}px`
|
|
5972
6122
|
},
|
|
5973
|
-
views: [x,
|
|
6123
|
+
views: [x, g, p]
|
|
5974
6124
|
};
|
|
5975
6125
|
}
|
|
5976
6126
|
getFooter() {
|
|
5977
6127
|
const t = [], e = [], i = [];
|
|
5978
|
-
this.ctx.footer.renderRows.forEach((
|
|
5979
|
-
|
|
6128
|
+
this.ctx.footer.renderRows.forEach((u) => {
|
|
6129
|
+
u.cells.forEach((w) => {
|
|
5980
6130
|
w.cellType === "footer" && w.renderFooter && (w.render = w.renderFooter, w.fixed === "left" ? e.push(w) : w.fixed === "right" ? i.push(w) : t.push(w));
|
|
5981
6131
|
});
|
|
5982
6132
|
});
|
|
@@ -6006,7 +6156,7 @@ class Qi {
|
|
|
6006
6156
|
height: `${c}px`
|
|
6007
6157
|
},
|
|
6008
6158
|
cells: t
|
|
6009
|
-
},
|
|
6159
|
+
}, g = {
|
|
6010
6160
|
key: "right",
|
|
6011
6161
|
style: {
|
|
6012
6162
|
position: "absolute",
|
|
@@ -6027,7 +6177,7 @@ class Qi {
|
|
|
6027
6177
|
width: `${h}px`,
|
|
6028
6178
|
height: `${c}px`
|
|
6029
6179
|
},
|
|
6030
|
-
views: [f, x,
|
|
6180
|
+
views: [f, x, g]
|
|
6031
6181
|
};
|
|
6032
6182
|
}
|
|
6033
6183
|
}
|
|
@@ -6060,8 +6210,8 @@ class ts {
|
|
|
6060
6210
|
me(x, this.contextMenuEl, {
|
|
6061
6211
|
placement: "right-start",
|
|
6062
6212
|
middleware: [we(), pe(), ye()]
|
|
6063
|
-
}).then(({ x:
|
|
6064
|
-
this.show(
|
|
6213
|
+
}).then(({ x: g, y: p }) => {
|
|
6214
|
+
this.show(g, p);
|
|
6065
6215
|
});
|
|
6066
6216
|
}), this.ctx.on("click", this.hide.bind(this)), this.ctx.on("onScroll", this.hide.bind(this)), this.ctx.on("resize", this.hide.bind(this));
|
|
6067
6217
|
}
|
|
@@ -6318,12 +6468,12 @@ class ss {
|
|
|
6318
6468
|
setSelectionByRows(t, e = !0) {
|
|
6319
6469
|
t.forEach((i) => {
|
|
6320
6470
|
const s = this.ctx.database.getRowKeyByItem(i);
|
|
6321
|
-
this.ctx.database.setRowSelection(s, e);
|
|
6471
|
+
this.ctx.database.setRowSelection(s, e, !1);
|
|
6322
6472
|
}), this.ctx.emit("selectionChange", this.getSelectionRows()), this.ctx.emit("draw");
|
|
6323
6473
|
}
|
|
6324
6474
|
setSelectionByRowKeys(t, e = !0) {
|
|
6325
6475
|
t.forEach((i) => {
|
|
6326
|
-
this.ctx.database.setRowSelection(i, e);
|
|
6476
|
+
this.ctx.database.setRowSelection(i, e, !1);
|
|
6327
6477
|
}), this.ctx.emit("selectionChange", this.getSelectionRows()), this.ctx.emit("draw");
|
|
6328
6478
|
}
|
|
6329
6479
|
toggleAllSelection() {
|
|
@@ -6358,6 +6508,10 @@ class ss {
|
|
|
6358
6508
|
getSpanObjByColumn: ie
|
|
6359
6509
|
};
|
|
6360
6510
|
}
|
|
6511
|
+
getColumnByKey(t) {
|
|
6512
|
+
var e;
|
|
6513
|
+
return (e = this.ctx.database.getColumnByKey(t)) == null ? void 0 : e.column;
|
|
6514
|
+
}
|
|
6361
6515
|
/**
|
|
6362
6516
|
* 销毁
|
|
6363
6517
|
*/
|