e-virt-table 1.1.3 → 1.1.4
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 +817 -677
- 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 +7 -4
- package/dist/lib/Database.js +184 -90
- 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,40 +143,40 @@ 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] || []);
|
|
150
150
|
}), t;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var Nt = /* @__PURE__ */ function(a) {
|
|
153
153
|
ve(t, a);
|
|
154
154
|
function t(e, i) {
|
|
155
155
|
var s;
|
|
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 Nt(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 Nt(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) {
|
|
@@ -194,7 +194,7 @@ function Me(a, t) {
|
|
|
194
194
|
}
|
|
195
195
|
return e;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Bt(a, t) {
|
|
198
198
|
return function(e) {
|
|
199
199
|
var i;
|
|
200
200
|
return a.fullFields ? i = Me(t, a.fullFields) : i = t[e.field || a.fullField], Te(e) ? (e.field = e.field || a.fullField, e.fieldValue = i, e) : {
|
|
@@ -204,7 +204,7 @@ function Nt(a, t) {
|
|
|
204
204
|
};
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function kt(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,13 +300,13 @@ 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),
|
|
307
|
-
}, j = "enum",
|
|
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
|
+
}, j = "enum", Ne = 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
|
+
}, Be = function(t, e, i, s, r) {
|
|
310
310
|
if (t.pattern) {
|
|
311
311
|
if (t.pattern instanceof RegExp)
|
|
312
312
|
t.pattern.lastIndex = 0, t.pattern.test(e) || s.push(D(r.messages.pattern.mismatch, t.fullField, e, t.pattern));
|
|
@@ -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
|
-
enum:
|
|
324
|
-
pattern:
|
|
325
|
-
},
|
|
323
|
+
enum: Ne,
|
|
324
|
+
pattern: Be
|
|
325
|
+
}, ke = 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: ke,
|
|
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 = kt(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()), kt(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(Bt(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(Bt(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,6 +1372,7 @@ 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());
|
|
@@ -1355,7 +1386,9 @@ class ni {
|
|
|
1355
1386
|
this.data = i, this.footerData = r, this.columns = s, this.setLoading(!0), this.init();
|
|
1356
1387
|
}
|
|
1357
1388
|
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()
|
|
1389
|
+
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();
|
|
1390
|
+
const { ROW_KEY: t, ENABLE_RESERVE_SELECTION: e } = this.ctx.config;
|
|
1391
|
+
e && t || this.selectionMap.clear(), this.initData(this.data), this.getData();
|
|
1359
1392
|
}
|
|
1360
1393
|
/**
|
|
1361
1394
|
* 清除缓存数据
|
|
@@ -1370,28 +1403,33 @@ class ni {
|
|
|
1370
1403
|
*/
|
|
1371
1404
|
initData(t, e = 0) {
|
|
1372
1405
|
t.forEach((i, s) => {
|
|
1406
|
+
var w;
|
|
1373
1407
|
let r = i._hasChildren || !1;
|
|
1374
1408
|
Array.isArray(i.children) && i.children.length && (r = !0, this.initData(i.children, e + 1));
|
|
1375
1409
|
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
1410
|
this.itemRowKeyMap.set(i, x);
|
|
1377
|
-
const
|
|
1378
|
-
let
|
|
1379
|
-
if (typeof c == "function" && (
|
|
1380
|
-
const
|
|
1381
|
-
if (this.checkboxKeyMap.has(
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1411
|
+
const g = i._height || h, p = i._readonly;
|
|
1412
|
+
let u = !0;
|
|
1413
|
+
if (typeof c == "function" && (u = c), d) {
|
|
1414
|
+
const y = i[d];
|
|
1415
|
+
if (this.checkboxKeyMap.has(y)) {
|
|
1416
|
+
const C = this.checkboxKeyMap.get(y) || [];
|
|
1417
|
+
C.push(x), this.checkboxKeyMap.set(y, C);
|
|
1384
1418
|
} else
|
|
1385
|
-
this.checkboxKeyMap.set(
|
|
1419
|
+
this.checkboxKeyMap.set(y, [x]);
|
|
1386
1420
|
}
|
|
1387
|
-
this.
|
|
1421
|
+
this.selectionMap.set(x, {
|
|
1422
|
+
key: d ? i[d] : x,
|
|
1423
|
+
row: i,
|
|
1424
|
+
check: ((w = this.selectionMap.get(x)) == null ? void 0 : w.check) || !1
|
|
1425
|
+
}), this.rowKeyMap.set(x, {
|
|
1388
1426
|
readonly: p,
|
|
1389
1427
|
index: s,
|
|
1390
1428
|
rowIndex: s,
|
|
1391
1429
|
level: e,
|
|
1392
|
-
height:
|
|
1430
|
+
height: g,
|
|
1393
1431
|
check: !1,
|
|
1394
|
-
selectable:
|
|
1432
|
+
selectable: u,
|
|
1395
1433
|
expand: n,
|
|
1396
1434
|
expandLazy: !1,
|
|
1397
1435
|
hasChildren: r,
|
|
@@ -1602,45 +1640,50 @@ class ni {
|
|
|
1602
1640
|
async batchSetItemValue(t, e = !1) {
|
|
1603
1641
|
let i = [];
|
|
1604
1642
|
const s = /* @__PURE__ */ new Set();
|
|
1605
|
-
let r = t
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
value:
|
|
1612
|
-
oldValue:
|
|
1613
|
-
row:
|
|
1614
|
-
}))
|
|
1615
|
-
|
|
1643
|
+
let r = [], o = t.map((d) => {
|
|
1644
|
+
const { rowKey: f, key: x } = d;
|
|
1645
|
+
let g = d.value, p = g;
|
|
1646
|
+
const u = this.getRowDataItemForRowKey(f), w = this.getItemValue(f, x), y = this.getVirtualBodyCellByKey(f, x);
|
|
1647
|
+
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({
|
|
1648
|
+
...d,
|
|
1649
|
+
value: p,
|
|
1650
|
+
oldValue: w,
|
|
1651
|
+
row: u
|
|
1652
|
+
}))), {
|
|
1653
|
+
...d,
|
|
1654
|
+
value: p,
|
|
1655
|
+
oldValue: w,
|
|
1656
|
+
row: u
|
|
1657
|
+
};
|
|
1658
|
+
});
|
|
1659
|
+
if (o = o.filter((d) => !r.some((f) => d.rowKey === f.rowKey && d.key === f.key)), r.length) {
|
|
1660
|
+
const d = {
|
|
1661
|
+
code: "ERR_BATCH_SET_NUMBER_VALUE",
|
|
1662
|
+
message: "Assignment failed, not a numeric type",
|
|
1663
|
+
data: r
|
|
1664
|
+
};
|
|
1665
|
+
this.ctx.emit("error", d);
|
|
1616
1666
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1667
|
+
if (!o.length)
|
|
1668
|
+
return;
|
|
1669
|
+
const { BEFORE_VALUE_CHANGE_METHOD: n } = this.ctx.config;
|
|
1670
|
+
typeof n == "function" && (o = await n(o)), o.forEach((d) => {
|
|
1671
|
+
const { value: f, rowKey: x, key: g, oldValue: p } = d;
|
|
1672
|
+
s.add(x), this.setItemValue(x, g, f), i.push({
|
|
1620
1673
|
rowKey: x,
|
|
1621
|
-
key:
|
|
1674
|
+
key: g,
|
|
1622
1675
|
oldValue: p,
|
|
1623
1676
|
newValue: f
|
|
1624
1677
|
});
|
|
1625
1678
|
});
|
|
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
|
-
});
|
|
1679
|
+
let h = [];
|
|
1637
1680
|
s.forEach((d) => {
|
|
1638
|
-
|
|
1681
|
+
h.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
1639
1682
|
});
|
|
1640
|
-
const c =
|
|
1683
|
+
const c = o.map(({ rowKey: d, key: f }) => this.getValidator(d, f));
|
|
1641
1684
|
Promise.all(c).then(() => {
|
|
1642
1685
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1643
|
-
}), this.ctx.emit("change",
|
|
1686
|
+
}), this.ctx.emit("change", o, h), e && this.ctx.history.pushState({
|
|
1644
1687
|
changeList: i,
|
|
1645
1688
|
scrollX: this.ctx.scrollX,
|
|
1646
1689
|
scrollY: this.ctx.scrollY,
|
|
@@ -1661,58 +1704,85 @@ class ni {
|
|
|
1661
1704
|
if (!this.rowKeyMap.has(t))
|
|
1662
1705
|
return {};
|
|
1663
1706
|
const { item: n } = this.rowKeyMap.get(t);
|
|
1664
|
-
let h = n[e];
|
|
1707
|
+
let h = n[e], c = i;
|
|
1665
1708
|
if (this.ctx.database.getReadonly(t, e))
|
|
1666
1709
|
return {
|
|
1667
1710
|
oldValue: h,
|
|
1668
1711
|
newValue: h
|
|
1669
1712
|
};
|
|
1670
1713
|
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;
|
|
1714
|
+
const d = `${t}_${e}`;
|
|
1715
|
+
this.originalDataMap.has(d) || this.originalDataMap.set(d, h);
|
|
1716
|
+
const f = this.originalDataMap.get(d), x = this.getRowDataItemForRowKey(t);
|
|
1675
1717
|
if (o) {
|
|
1676
|
-
const
|
|
1677
|
-
if (
|
|
1678
|
-
|
|
1718
|
+
const g = this.getVirtualBodyCellByKey(t, e);
|
|
1719
|
+
if ((g == null ? void 0 : g.type) === "number")
|
|
1720
|
+
if (["", void 0, null].includes(i))
|
|
1721
|
+
c = null;
|
|
1722
|
+
else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
|
|
1723
|
+
c = Number(i);
|
|
1724
|
+
else {
|
|
1725
|
+
c = h;
|
|
1726
|
+
const w = {
|
|
1727
|
+
code: "ERR_SET_NUMBER_VALUE",
|
|
1728
|
+
message: "Assignment failed, not a numeric type",
|
|
1729
|
+
data: [
|
|
1730
|
+
{
|
|
1731
|
+
rowKey: t,
|
|
1732
|
+
key: e,
|
|
1733
|
+
value: c,
|
|
1734
|
+
oldValue: h,
|
|
1735
|
+
row: x
|
|
1736
|
+
}
|
|
1737
|
+
]
|
|
1738
|
+
};
|
|
1739
|
+
this.ctx.emit("error", w);
|
|
1740
|
+
}
|
|
1741
|
+
if (c === h)
|
|
1742
|
+
return {
|
|
1743
|
+
oldValue: h,
|
|
1744
|
+
newValue: h
|
|
1745
|
+
};
|
|
1746
|
+
const { BEFORE_VALUE_CHANGE_METHOD: p } = this.ctx.config;
|
|
1747
|
+
if (typeof p == "function") {
|
|
1748
|
+
const y = await p([
|
|
1679
1749
|
{
|
|
1680
1750
|
rowKey: t,
|
|
1681
1751
|
key: e,
|
|
1682
|
-
value:
|
|
1752
|
+
value: c,
|
|
1683
1753
|
oldValue: n[e],
|
|
1684
|
-
row:
|
|
1754
|
+
row: x
|
|
1685
1755
|
}
|
|
1686
1756
|
]);
|
|
1687
|
-
|
|
1757
|
+
y && y.length && (c = y[0].value);
|
|
1688
1758
|
}
|
|
1689
|
-
this.changedDataMap.set(
|
|
1690
|
-
const u =
|
|
1759
|
+
this.changedDataMap.set(d, c), n[e] = c;
|
|
1760
|
+
const u = {
|
|
1691
1761
|
rowKey: t,
|
|
1692
1762
|
key: e,
|
|
1693
1763
|
oldValue: h,
|
|
1694
|
-
value:
|
|
1695
|
-
row:
|
|
1764
|
+
value: c,
|
|
1765
|
+
row: x
|
|
1696
1766
|
};
|
|
1697
1767
|
this.getValidator(t, e).then(() => {
|
|
1698
1768
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1699
|
-
}), this.ctx.emit("change", [
|
|
1769
|
+
}), this.ctx.emit("change", [u], [x]), this.ctx.emit("editChange", {
|
|
1700
1770
|
rowKey: t,
|
|
1701
1771
|
key: e,
|
|
1702
1772
|
oldValue: h,
|
|
1703
|
-
value:
|
|
1704
|
-
originalValue:
|
|
1705
|
-
row:
|
|
1773
|
+
value: c,
|
|
1774
|
+
originalValue: f,
|
|
1775
|
+
row: x
|
|
1706
1776
|
});
|
|
1707
1777
|
} else
|
|
1708
|
-
this.changedDataMap.set(
|
|
1778
|
+
this.changedDataMap.set(d, c), n[e] = c;
|
|
1709
1779
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1710
1780
|
rowKey: t,
|
|
1711
1781
|
key: e,
|
|
1712
1782
|
oldValue: h,
|
|
1713
|
-
value:
|
|
1714
|
-
originalValue: this.originalDataMap.get(
|
|
1715
|
-
row:
|
|
1783
|
+
value: c,
|
|
1784
|
+
originalValue: this.originalDataMap.get(d),
|
|
1785
|
+
row: x
|
|
1716
1786
|
}), s && this.ctx.history.pushState({
|
|
1717
1787
|
type: "single",
|
|
1718
1788
|
scrollX: this.ctx.scrollX,
|
|
@@ -1722,12 +1792,12 @@ class ni {
|
|
|
1722
1792
|
rowKey: t,
|
|
1723
1793
|
key: e,
|
|
1724
1794
|
oldValue: h,
|
|
1725
|
-
newValue:
|
|
1795
|
+
newValue: c
|
|
1726
1796
|
}
|
|
1727
1797
|
]
|
|
1728
1798
|
}), r && this.ctx.emit("draw"), {
|
|
1729
1799
|
oldValue: h,
|
|
1730
|
-
newValue:
|
|
1800
|
+
newValue: c
|
|
1731
1801
|
};
|
|
1732
1802
|
}
|
|
1733
1803
|
/**
|
|
@@ -1753,8 +1823,8 @@ class ni {
|
|
|
1753
1823
|
return !1;
|
|
1754
1824
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1755
1825
|
this.checkboxKeyMap.has(r) && (this.checkboxKeyMap.get(r) || []).forEach((n) => {
|
|
1756
|
-
const h = this.
|
|
1757
|
-
h.check = e;
|
|
1826
|
+
const h = this.selectionMap.get(n);
|
|
1827
|
+
h && (h.check = e);
|
|
1758
1828
|
});
|
|
1759
1829
|
}
|
|
1760
1830
|
}
|
|
@@ -1763,25 +1833,29 @@ class ni {
|
|
|
1763
1833
|
* @param rowKey
|
|
1764
1834
|
*/
|
|
1765
1835
|
toggleRowSelection(t) {
|
|
1766
|
-
const e = this.rowKeyMap.get(t);
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
this.
|
|
1836
|
+
const e = this.rowKeyMap.get(t), i = this.selectionMap.get(t);
|
|
1837
|
+
if (!i)
|
|
1838
|
+
return;
|
|
1839
|
+
i.check = !i.check, this.setRowSelectionByCheckboxKey(t, i.check), this.ctx.emit("toggleRowSelection", e);
|
|
1840
|
+
const s = this.getSelectionRows();
|
|
1841
|
+
this.ctx.emit("selectionChange", s), this.ctx.emit("draw");
|
|
1770
1842
|
}
|
|
1771
1843
|
/**
|
|
1772
1844
|
* 根据rowKey 设置选中状态
|
|
1773
1845
|
* @param rowKey
|
|
1774
1846
|
*/
|
|
1775
|
-
setRowSelection(t, e) {
|
|
1776
|
-
const
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
this.
|
|
1847
|
+
setRowSelection(t, e, i = !0) {
|
|
1848
|
+
const s = this.selectionMap.get(t);
|
|
1849
|
+
if (!s)
|
|
1850
|
+
return;
|
|
1851
|
+
s.check = e, this.setRowSelectionByCheckboxKey(t, s.check);
|
|
1852
|
+
const r = this.getSelectionRows();
|
|
1853
|
+
this.ctx.emit("setRowSelection", r), i && this.ctx.emit("draw");
|
|
1780
1854
|
}
|
|
1781
1855
|
getSelectionRows() {
|
|
1782
1856
|
let t = [];
|
|
1783
|
-
return this.
|
|
1784
|
-
e.check && t.push(e.
|
|
1857
|
+
return this.selectionMap.forEach((e) => {
|
|
1858
|
+
e.check && t.push(e.row);
|
|
1785
1859
|
}), t;
|
|
1786
1860
|
}
|
|
1787
1861
|
/**
|
|
@@ -1789,8 +1863,8 @@ class ni {
|
|
|
1789
1863
|
* @param rowKey
|
|
1790
1864
|
*/
|
|
1791
1865
|
getRowSelection(t) {
|
|
1792
|
-
const
|
|
1793
|
-
return e;
|
|
1866
|
+
const e = this.selectionMap.get(t);
|
|
1867
|
+
return e ? e.check : !1;
|
|
1794
1868
|
}
|
|
1795
1869
|
/**
|
|
1796
1870
|
* 根据rowKey 获取选中状态
|
|
@@ -1808,12 +1882,12 @@ class ni {
|
|
|
1808
1882
|
* @param rowKey
|
|
1809
1883
|
*/
|
|
1810
1884
|
toggleAllSelection() {
|
|
1811
|
-
this.rowKeyMap.forEach((e) => {
|
|
1812
|
-
|
|
1813
|
-
typeof
|
|
1885
|
+
this.rowKeyMap.forEach((e, i) => {
|
|
1886
|
+
let s = e.selectable;
|
|
1887
|
+
typeof s == "function" && (s = s({
|
|
1814
1888
|
row: e.item,
|
|
1815
1889
|
rowIndex: e.rowIndex
|
|
1816
|
-
}) && (
|
|
1890
|
+
})), s && this.setRowSelection(i, !0, !1);
|
|
1817
1891
|
});
|
|
1818
1892
|
const t = this.getSelectionRows();
|
|
1819
1893
|
this.ctx.emit("toggleAllSelection", t), this.ctx.emit("selectionChange", t), this.ctx.emit("draw");
|
|
@@ -1822,36 +1896,37 @@ class ni {
|
|
|
1822
1896
|
* 清除选中
|
|
1823
1897
|
* @param rowKey
|
|
1824
1898
|
*/
|
|
1825
|
-
clearSelection() {
|
|
1826
|
-
this.rowKeyMap.forEach((
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
rowIndex: e.rowIndex
|
|
1831
|
-
}) && (e.check = !1) : i && (e.check = !1);
|
|
1899
|
+
clearSelection(t = !1) {
|
|
1900
|
+
t ? this.rowKeyMap.forEach((i, s) => {
|
|
1901
|
+
this.setRowSelection(s, !1, !1);
|
|
1902
|
+
}) : this.selectionMap.forEach((i, s) => {
|
|
1903
|
+
this.setRowSelection(s, !1, !1);
|
|
1832
1904
|
});
|
|
1833
|
-
const
|
|
1834
|
-
this.ctx.emit("clearSelection"), this.ctx.emit("selectionChange",
|
|
1905
|
+
const e = this.getSelectionRows();
|
|
1906
|
+
this.ctx.emit("clearSelection"), this.ctx.emit("selectionChange", e), this.ctx.emit("draw");
|
|
1835
1907
|
}
|
|
1836
1908
|
/**
|
|
1837
1909
|
* 获取选中状态,表头用
|
|
1838
1910
|
* @param rowKey
|
|
1839
1911
|
*/
|
|
1840
1912
|
getCheckedState() {
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1913
|
+
const t = this.rowKeyMap.size;
|
|
1914
|
+
let e = 0, i = 0;
|
|
1915
|
+
const s = this.selectionMap.size, r = Array.from(this.selectionMap.values()).some((d) => d.check);
|
|
1916
|
+
this.rowKeyMap.forEach((d, f) => {
|
|
1917
|
+
var g;
|
|
1918
|
+
(g = this.selectionMap.get(f)) != null && g.check && (e += 1);
|
|
1919
|
+
let x = d.selectable;
|
|
1920
|
+
typeof x == "function" && (x = x({
|
|
1921
|
+
row: d.item,
|
|
1922
|
+
rowIndex: d.rowIndex
|
|
1923
|
+
})), x && (i += 1);
|
|
1849
1924
|
});
|
|
1850
|
-
const
|
|
1925
|
+
const o = s > t && e === 0 && r, n = i && i > e && e > 0 || o;
|
|
1851
1926
|
return {
|
|
1852
|
-
check:
|
|
1853
|
-
indeterminate:
|
|
1854
|
-
selectable:
|
|
1927
|
+
check: i && i === e,
|
|
1928
|
+
indeterminate: n,
|
|
1929
|
+
selectable: i !== 0
|
|
1855
1930
|
};
|
|
1856
1931
|
}
|
|
1857
1932
|
/**
|
|
@@ -1869,6 +1944,11 @@ class ni {
|
|
|
1869
1944
|
if (e && this.headerMap.has(e))
|
|
1870
1945
|
return (i = this.headerMap.get(e)) == null ? void 0 : i.column;
|
|
1871
1946
|
}
|
|
1947
|
+
getColumnByKey(t) {
|
|
1948
|
+
const e = this.headerMap.get(t);
|
|
1949
|
+
if (e)
|
|
1950
|
+
return e;
|
|
1951
|
+
}
|
|
1872
1952
|
getColIndexForKey(t) {
|
|
1873
1953
|
var e;
|
|
1874
1954
|
if (t && this.headerMap.has(t))
|
|
@@ -1973,8 +2053,8 @@ class ni {
|
|
|
1973
2053
|
if (h) {
|
|
1974
2054
|
let c = {}, d = {};
|
|
1975
2055
|
if (d[e] = this.getItemValue(t, e), Array.isArray(h)) {
|
|
1976
|
-
const x = h.map((
|
|
1977
|
-
...
|
|
2056
|
+
const x = h.map((g) => ({
|
|
2057
|
+
...g,
|
|
1978
2058
|
row: s.item,
|
|
1979
2059
|
column: n,
|
|
1980
2060
|
rowIndex: s.rowIndex,
|
|
@@ -1992,14 +2072,14 @@ class ni {
|
|
|
1992
2072
|
new nt(c).validate(d).then(() => {
|
|
1993
2073
|
this.clearValidationError(t, e), i([]);
|
|
1994
2074
|
}).catch(({ errors: x }) => {
|
|
1995
|
-
const
|
|
2075
|
+
const g = x.map((p) => ({
|
|
1996
2076
|
...p,
|
|
1997
2077
|
column: n,
|
|
1998
2078
|
key: e,
|
|
1999
2079
|
row: s.item,
|
|
2000
2080
|
rowKey: t
|
|
2001
2081
|
}));
|
|
2002
|
-
this.setValidationError(t, e,
|
|
2082
|
+
this.setValidationError(t, e, g), i(g);
|
|
2003
2083
|
});
|
|
2004
2084
|
} else
|
|
2005
2085
|
i([]);
|
|
@@ -2026,16 +2106,16 @@ class ni {
|
|
|
2026
2106
|
rowspan: d,
|
|
2027
2107
|
height: f,
|
|
2028
2108
|
width: x,
|
|
2029
|
-
colspan:
|
|
2109
|
+
colspan: g,
|
|
2030
2110
|
mergeRow: p,
|
|
2031
|
-
mergeCol:
|
|
2111
|
+
mergeCol: u
|
|
2032
2112
|
} = t;
|
|
2033
|
-
if (d === 1 &&
|
|
2113
|
+
if (d === 1 && g === 1)
|
|
2034
2114
|
return {
|
|
2035
2115
|
xArr: [n, n],
|
|
2036
2116
|
yArr: [e, e],
|
|
2037
2117
|
rowspan: d,
|
|
2038
|
-
colspan:
|
|
2118
|
+
colspan: g,
|
|
2039
2119
|
height: f,
|
|
2040
2120
|
width: x,
|
|
2041
2121
|
offsetTop: 0,
|
|
@@ -2049,82 +2129,82 @@ class ni {
|
|
|
2049
2129
|
}
|
|
2050
2130
|
]
|
|
2051
2131
|
};
|
|
2052
|
-
let w = e, y = e,
|
|
2132
|
+
let w = e, y = e, C = n, m = n, E = [], b = 0, R = 0, O = 0, L = 0;
|
|
2053
2133
|
if (d !== 1 && p) {
|
|
2054
|
-
|
|
2055
|
-
const
|
|
2056
|
-
const
|
|
2057
|
-
return `${v}${
|
|
2134
|
+
L = x;
|
|
2135
|
+
const _ = h.reduce((v, A) => {
|
|
2136
|
+
const S = this.getItemValue(s, A) ?? "";
|
|
2137
|
+
return `${v}${S}`;
|
|
2058
2138
|
}, "");
|
|
2059
2139
|
for (let v = e - 1; v >= 0; v--) {
|
|
2060
|
-
const
|
|
2061
|
-
const
|
|
2062
|
-
return `${M}${
|
|
2140
|
+
const A = this.rowIndexRowKeyMap.get(v) || "", S = h.reduce((M, T) => {
|
|
2141
|
+
const B = this.getItemValue(A, T) ?? "";
|
|
2142
|
+
return `${M}${B}`;
|
|
2063
2143
|
}, "");
|
|
2064
|
-
if (
|
|
2144
|
+
if (_ === S)
|
|
2065
2145
|
w = v;
|
|
2066
2146
|
else
|
|
2067
2147
|
break;
|
|
2068
2148
|
}
|
|
2069
2149
|
for (let v = e; v <= this.ctx.maxRowIndex; v++) {
|
|
2070
|
-
const
|
|
2071
|
-
const
|
|
2072
|
-
return `${M}${
|
|
2150
|
+
const A = this.rowIndexRowKeyMap.get(v) || "", S = h.reduce((M, T) => {
|
|
2151
|
+
const B = this.getItemValue(A, T) ?? "";
|
|
2152
|
+
return `${M}${B}`;
|
|
2073
2153
|
}, "");
|
|
2074
|
-
if (
|
|
2154
|
+
if (_ === S)
|
|
2075
2155
|
y = v;
|
|
2076
2156
|
else
|
|
2077
2157
|
break;
|
|
2078
2158
|
}
|
|
2079
2159
|
for (let v = w; v < e; v++) {
|
|
2080
|
-
const { height:
|
|
2081
|
-
|
|
2160
|
+
const { height: A } = this.positions[v];
|
|
2161
|
+
b += A;
|
|
2082
2162
|
}
|
|
2083
2163
|
for (let v = w; v <= y; v++) {
|
|
2084
|
-
const { height:
|
|
2085
|
-
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
rowKey:
|
|
2164
|
+
const { height: A } = this.positions[v];
|
|
2165
|
+
O += A;
|
|
2166
|
+
const S = this.rowIndexRowKeyMap.get(v) || "", { item: M } = this.rowKeyMap.get(S), T = this.getItemValue(S, i);
|
|
2167
|
+
E.push({
|
|
2168
|
+
rowKey: S,
|
|
2089
2169
|
key: i,
|
|
2090
2170
|
value: T,
|
|
2091
2171
|
row: M
|
|
2092
2172
|
});
|
|
2093
2173
|
}
|
|
2094
2174
|
}
|
|
2095
|
-
if (
|
|
2096
|
-
|
|
2097
|
-
for (let
|
|
2098
|
-
const v = this.getColumnByColIndex(
|
|
2175
|
+
if (g !== 1 && u) {
|
|
2176
|
+
O = f;
|
|
2177
|
+
for (let _ = n - 1; _ >= 0; _--) {
|
|
2178
|
+
const v = this.getColumnByColIndex(_);
|
|
2099
2179
|
if (!v)
|
|
2100
2180
|
break;
|
|
2101
|
-
const
|
|
2102
|
-
if (
|
|
2103
|
-
|
|
2181
|
+
const A = this.getItemValue(s, i), S = this.getItemValue(s, v.key);
|
|
2182
|
+
if (A === S && c.includes(v.key))
|
|
2183
|
+
C = _;
|
|
2104
2184
|
else
|
|
2105
2185
|
break;
|
|
2106
2186
|
}
|
|
2107
|
-
for (let
|
|
2108
|
-
const v = this.getColumnByColIndex(
|
|
2187
|
+
for (let _ = n; _ <= this.ctx.maxColIndex; _++) {
|
|
2188
|
+
const v = this.getColumnByColIndex(_);
|
|
2109
2189
|
if (!v)
|
|
2110
2190
|
break;
|
|
2111
|
-
const
|
|
2112
|
-
if (
|
|
2113
|
-
m =
|
|
2191
|
+
const A = this.getItemValue(s, i), S = this.getItemValue(s, v.key);
|
|
2192
|
+
if (A === S && c.includes(v.key))
|
|
2193
|
+
m = _;
|
|
2114
2194
|
else
|
|
2115
2195
|
break;
|
|
2116
2196
|
}
|
|
2117
|
-
for (let
|
|
2118
|
-
const v = this.getColumnByColIndex(
|
|
2197
|
+
for (let _ = C; _ < n; _++) {
|
|
2198
|
+
const v = this.getColumnByColIndex(_);
|
|
2119
2199
|
if (!v)
|
|
2120
2200
|
break;
|
|
2121
2201
|
R += v.width || 100;
|
|
2122
2202
|
}
|
|
2123
|
-
for (let
|
|
2124
|
-
const v = this.getColumnByColIndex(
|
|
2203
|
+
for (let _ = C; _ <= m; _++) {
|
|
2204
|
+
const v = this.getColumnByColIndex(_);
|
|
2125
2205
|
if (!v)
|
|
2126
2206
|
break;
|
|
2127
|
-
|
|
2207
|
+
L += v.width || 100, E.push({
|
|
2128
2208
|
rowKey: s,
|
|
2129
2209
|
key: v.key,
|
|
2130
2210
|
value: this.getItemValue(s, v.key),
|
|
@@ -2133,15 +2213,15 @@ class ni {
|
|
|
2133
2213
|
}
|
|
2134
2214
|
}
|
|
2135
2215
|
return {
|
|
2136
|
-
xArr: [
|
|
2216
|
+
xArr: [C, m],
|
|
2137
2217
|
yArr: [w, y],
|
|
2138
2218
|
rowspan: d,
|
|
2139
|
-
colspan:
|
|
2140
|
-
height:
|
|
2141
|
-
width:
|
|
2142
|
-
offsetTop:
|
|
2219
|
+
colspan: g,
|
|
2220
|
+
height: O,
|
|
2221
|
+
width: L,
|
|
2222
|
+
offsetTop: b,
|
|
2143
2223
|
offsetLeft: R,
|
|
2144
|
-
dataList:
|
|
2224
|
+
dataList: E
|
|
2145
2225
|
};
|
|
2146
2226
|
}
|
|
2147
2227
|
setLoading(t) {
|
|
@@ -2175,6 +2255,11 @@ class ni {
|
|
|
2175
2255
|
const i = this.getColumnByColIndex(e), s = this.getRowForRowIndex(t);
|
|
2176
2256
|
return !i || !s ? void 0 : new Tt(this.ctx, t, e, 0, 0, 0, 0, i, s, "body");
|
|
2177
2257
|
}
|
|
2258
|
+
getVirtualBodyCellByKey(t, e) {
|
|
2259
|
+
const i = this.getRowIndexForRowKey(t), s = this.getColIndexForKey(e);
|
|
2260
|
+
if (!(i === void 0 || s === void 0))
|
|
2261
|
+
return this.getVirtualBodyCell(i, s);
|
|
2262
|
+
}
|
|
2178
2263
|
hasMergeCell(t, e) {
|
|
2179
2264
|
let i = !1;
|
|
2180
2265
|
for (let s = e[0]; s <= e[1]; s++)
|
|
@@ -2450,10 +2535,10 @@ class ci {
|
|
|
2450
2535
|
this.ctx.font = n, this.ctx.fillStyle = c, this.ctx.textBaseline = f, this.ctx.textAlign = h;
|
|
2451
2536
|
let x = 0;
|
|
2452
2537
|
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,
|
|
2538
|
+
let g = 0;
|
|
2539
|
+
h === "left" ? g = e + d : h === "right" ? g = e + s - d : g = e + s / 2;
|
|
2540
|
+
const { _text: p, ellipsis: u } = this.handleEllipsis(t, s, d, n);
|
|
2541
|
+
return this.ctx.fillText(p, g, x), this.ctx.restore(), u;
|
|
2457
2542
|
}
|
|
2458
2543
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
2459
2544
|
let r = !1, o = t;
|
|
@@ -2487,6 +2572,11 @@ class Wt {
|
|
|
2487
2572
|
//禁用编辑,优先等级最高
|
|
2488
2573
|
l(this, "HEADER_FONT", "12px normal Arial");
|
|
2489
2574
|
l(this, "BODY_FONT", "12px normal Arial");
|
|
2575
|
+
l(this, "BORDER", !0);
|
|
2576
|
+
l(this, "STRIPE", !1);
|
|
2577
|
+
//斑马纹
|
|
2578
|
+
l(this, "STRIPE_COLOR", "#fafafa");
|
|
2579
|
+
//斑马纹颜色
|
|
2490
2580
|
l(this, "BORDER_COLOR", "#e1e6eb");
|
|
2491
2581
|
l(this, "WIDTH", 0);
|
|
2492
2582
|
l(this, "RESIZE_MIN_WIDTH", 40);
|
|
@@ -2499,6 +2589,8 @@ class Wt {
|
|
|
2499
2589
|
l(this, "ENABLE_OFFSET_HEIGHT", !1);
|
|
2500
2590
|
l(this, "OFFSET_HEIGHT", 0);
|
|
2501
2591
|
l(this, "HEADER_HEIGHT", 36);
|
|
2592
|
+
l(this, "ENABLE_RESERVE_SELECTION", !1);
|
|
2593
|
+
// 启用保留选中行
|
|
2502
2594
|
l(this, "ENABLE_HEADER_STICKY", !1);
|
|
2503
2595
|
// 启用头部固定,需要外面实现覆盖层,或者所有表头都要是元素
|
|
2504
2596
|
l(this, "HEADER_BG_COLOR", "#F8FAFF");
|
|
@@ -2804,12 +2896,12 @@ class re extends se {
|
|
|
2804
2896
|
draw() {
|
|
2805
2897
|
const {
|
|
2806
2898
|
paint: e,
|
|
2807
|
-
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2808
|
-
} = this.ctx, { drawX:
|
|
2809
|
-
e.drawRect(
|
|
2810
|
-
borderColor: i,
|
|
2899
|
+
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r, BORDER: o }
|
|
2900
|
+
} = this.ctx, { drawX: n, drawY: h, displayText: c } = this;
|
|
2901
|
+
e.drawRect(n, h, this.width, this.height, {
|
|
2902
|
+
borderColor: o ? i : "transparent",
|
|
2811
2903
|
fillColor: this.drawCellBgColor
|
|
2812
|
-
}), e.drawText(
|
|
2904
|
+
}), e.drawText(c, n, h, this.width, this.height, {
|
|
2813
2905
|
font: r,
|
|
2814
2906
|
padding: s,
|
|
2815
2907
|
color: this.drawTextColor,
|
|
@@ -2934,7 +3026,7 @@ class fi {
|
|
|
2934
3026
|
selectionClick(t) {
|
|
2935
3027
|
if (["selection", "index-selection"].includes(t.type) && this.ctx.isPointer)
|
|
2936
3028
|
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();
|
|
3029
|
+
t.drawImageName === "checkbox-uncheck" || t.drawImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawImageName === "checkbox-check" && this.ctx.database.clearSelection(!0);
|
|
2938
3030
|
else {
|
|
2939
3031
|
if (!this.ctx.database.getRowSelectable(t.rowKey))
|
|
2940
3032
|
return;
|
|
@@ -3059,6 +3151,7 @@ class xi {
|
|
|
3059
3151
|
l(this, "scrollX", 0);
|
|
3060
3152
|
l(this, "fixedLeftWidth", 0);
|
|
3061
3153
|
l(this, "fixedRightWidth", 0);
|
|
3154
|
+
l(this, "lastCenterColIndex", 0);
|
|
3062
3155
|
l(this, "maxColIndex", 0);
|
|
3063
3156
|
l(this, "maxRowIndex", 0);
|
|
3064
3157
|
l(this, "hoverRow");
|
|
@@ -3136,15 +3229,14 @@ class xi {
|
|
|
3136
3229
|
}
|
|
3137
3230
|
setItemValueByEditor(t, e, i, s = !0, r = !0) {
|
|
3138
3231
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
3139
|
-
const o = this.database.
|
|
3140
|
-
if (o
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
this.database.batchSetItemValue(d, s);
|
|
3232
|
+
const o = this.database.getVirtualBodyCellByKey(t, e);
|
|
3233
|
+
if (o && (o.mergeRow || o.mergeCol)) {
|
|
3234
|
+
const { dataList: n } = o.getSpanInfo(), h = n.map((c) => ({ ...c, value: i }));
|
|
3235
|
+
this.database.batchSetItemValue(h, s);
|
|
3236
|
+
return;
|
|
3145
3237
|
}
|
|
3146
|
-
}
|
|
3147
|
-
|
|
3238
|
+
}
|
|
3239
|
+
this.database.setItemValue(t, e, i, s, r, !0);
|
|
3148
3240
|
}
|
|
3149
3241
|
batchSetItemValueByEditor(t, e = !0) {
|
|
3150
3242
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
@@ -3335,37 +3427,41 @@ class Pt {
|
|
|
3335
3427
|
header: e,
|
|
3336
3428
|
stageHeight: i,
|
|
3337
3429
|
stageWidth: s,
|
|
3338
|
-
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
3339
|
-
} = this.ctx,
|
|
3430
|
+
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0, BORDER: n }
|
|
3431
|
+
} = this.ctx, h = s, c = i, d = e.height, f = e.width, x = t.height, g = this.ctx.footer.height;
|
|
3340
3432
|
if (this.type === "vertical") {
|
|
3341
|
-
this.visibleDistance =
|
|
3342
|
-
const
|
|
3343
|
-
let
|
|
3344
|
-
|
|
3433
|
+
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;
|
|
3434
|
+
const p = this.distance ? this.visibleDistance / (x + g) : 0;
|
|
3435
|
+
let u = Math.floor(p * this.visibleDistance);
|
|
3436
|
+
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
3437
|
} else {
|
|
3346
|
-
this.visibleDistance =
|
|
3347
|
-
|
|
3438
|
+
this.visibleDistance = h - r, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3439
|
+
h - r,
|
|
3440
|
+
c - r,
|
|
3348
3441
|
h - r,
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3442
|
+
c
|
|
3443
|
+
];
|
|
3444
|
+
const p = n ? 0 : 0.5;
|
|
3445
|
+
this.trackX = 0, this.trackY = c - r + p, this.trackWidth = h, this.trackHeight = r;
|
|
3446
|
+
const u = this.distance ? this.visibleDistance / f : 0;
|
|
3447
|
+
let w = Math.floor(u * this.visibleDistance);
|
|
3448
|
+
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
3449
|
}
|
|
3356
3450
|
}
|
|
3357
3451
|
draw() {
|
|
3358
3452
|
const {
|
|
3359
|
-
config: { SCROLLER_FOCUS_COLOR: t, SCROLLER_COLOR: e, BORDER_COLOR: i,
|
|
3453
|
+
config: { SCROLLER_FOCUS_COLOR: t, SCROLLER_COLOR: e, BORDER_COLOR: i, BORDER: s, SCROLLER_TRACK_COLOR: r }
|
|
3360
3454
|
} = this.ctx;
|
|
3361
|
-
this.updatedSize()
|
|
3362
|
-
|
|
3363
|
-
|
|
3455
|
+
this.updatedSize();
|
|
3456
|
+
let o = i;
|
|
3457
|
+
s || (o = "transparent"), this.ctx.paint.drawRect(this.trackX, this.trackY, this.trackWidth, this.trackHeight, {
|
|
3458
|
+
borderColor: o,
|
|
3459
|
+
fillColor: r
|
|
3364
3460
|
}), this.ctx.paint.drawRect(this.barX, this.barY, this.barWidth, this.barHeight, {
|
|
3365
3461
|
fillColor: this.isFocus || this.isDragging ? t : e,
|
|
3366
3462
|
radius: 4
|
|
3367
3463
|
}), this.splitPoints.length > 0 && this.ctx.paint.drawLine(this.splitPoints, {
|
|
3368
|
-
borderColor:
|
|
3464
|
+
borderColor: o,
|
|
3369
3465
|
borderWidth: 1
|
|
3370
3466
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
3371
3467
|
}
|
|
@@ -3483,7 +3579,7 @@ class gi {
|
|
|
3483
3579
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
3484
3580
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3485
3581
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3486
|
-
const s = Qt(i), r =
|
|
3582
|
+
const s = Qt(i), r = _t(i);
|
|
3487
3583
|
this.height = t * s, this.width = r.reduce((f, x) => f + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
3488
3584
|
const o = ti(te(i, s));
|
|
3489
3585
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
@@ -3586,7 +3682,7 @@ class gi {
|
|
|
3586
3682
|
for (let o = 0; o < i; o++) {
|
|
3587
3683
|
const n = t[o], h = r * (n.rowspan || 0), c = r * (n.level || 0);
|
|
3588
3684
|
let d = n.width || 100;
|
|
3589
|
-
n.children && (d =
|
|
3685
|
+
n.children && (d = _t(n.children).reduce((g, p) => g + ((p == null ? void 0 : p.width) || 100), 0));
|
|
3590
3686
|
const f = new re(this.ctx, this.columnIndex, s, c, d, h, n);
|
|
3591
3687
|
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
3688
|
}
|
|
@@ -3603,7 +3699,7 @@ class gi {
|
|
|
3603
3699
|
});
|
|
3604
3700
|
}
|
|
3605
3701
|
}
|
|
3606
|
-
|
|
3702
|
+
drawFixedShadow() {
|
|
3607
3703
|
const {
|
|
3608
3704
|
fixedLeftWidth: t,
|
|
3609
3705
|
fixedRightWidth: e,
|
|
@@ -3620,7 +3716,7 @@ class gi {
|
|
|
3620
3716
|
colorEnd: "rgba(0,0,0,0)"
|
|
3621
3717
|
}), i < Math.floor(s.width - r - 1) && e !== n) {
|
|
3622
3718
|
const h = s.width - (this.x + this.width) + r - e;
|
|
3623
|
-
this.ctx.paint.drawShadow(h
|
|
3719
|
+
this.ctx.paint.drawShadow(h, this.y, e, this.height, {
|
|
3624
3720
|
fillColor: o,
|
|
3625
3721
|
side: "left",
|
|
3626
3722
|
shadowWidth: 4,
|
|
@@ -3631,6 +3727,10 @@ class gi {
|
|
|
3631
3727
|
}
|
|
3632
3728
|
update() {
|
|
3633
3729
|
const t = [], e = [], i = [];
|
|
3730
|
+
if (this.centerCellHeaders.length) {
|
|
3731
|
+
const s = this.centerCellHeaders[this.centerCellHeaders.length - 1];
|
|
3732
|
+
this.ctx.lastCenterColIndex = s.colIndex;
|
|
3733
|
+
}
|
|
3634
3734
|
this.centerCellHeaders.forEach((s) => {
|
|
3635
3735
|
s.isHorizontalVisible() && s.isVerticalVisible() && (e.push(s), s.hasChildren || t.push(s));
|
|
3636
3736
|
}), this.fixedLeftCellHeaders.forEach((s) => {
|
|
@@ -3639,12 +3739,22 @@ class gi {
|
|
|
3639
3739
|
i.push(s), s.hasChildren || t.push(s);
|
|
3640
3740
|
}), 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
3741
|
}
|
|
3742
|
+
drawBottomLine() {
|
|
3743
|
+
const {
|
|
3744
|
+
stageWidth: t,
|
|
3745
|
+
config: { BORDER_COLOR: e }
|
|
3746
|
+
} = this.ctx, i = [0, this.height, t, this.height];
|
|
3747
|
+
this.ctx.paint.drawLine(i, {
|
|
3748
|
+
borderColor: e,
|
|
3749
|
+
borderWidth: 1
|
|
3750
|
+
});
|
|
3751
|
+
}
|
|
3642
3752
|
draw() {
|
|
3643
3753
|
this.renderCenterCellHeaders.forEach((t) => {
|
|
3644
3754
|
t.update(), t.draw();
|
|
3645
|
-
}), this.
|
|
3755
|
+
}), this.drawFixedShadow(), this.renderFixedCellHeaders.forEach((t) => {
|
|
3646
3756
|
t.update(), t.draw();
|
|
3647
|
-
}), this.drawTipLine();
|
|
3757
|
+
}), this.drawTipLine(), this.drawBottomLine();
|
|
3648
3758
|
}
|
|
3649
3759
|
}
|
|
3650
3760
|
class oe {
|
|
@@ -3691,11 +3801,14 @@ class oe {
|
|
|
3691
3801
|
t.draw();
|
|
3692
3802
|
});
|
|
3693
3803
|
}
|
|
3694
|
-
|
|
3804
|
+
drawContainer() {
|
|
3695
3805
|
this.noFixedCells.forEach((t) => {
|
|
3696
|
-
t.
|
|
3697
|
-
})
|
|
3698
|
-
|
|
3806
|
+
t.drawContainer();
|
|
3807
|
+
});
|
|
3808
|
+
}
|
|
3809
|
+
drawFixedContainer() {
|
|
3810
|
+
this.fixedCells.forEach((t) => {
|
|
3811
|
+
t.drawContainer();
|
|
3699
3812
|
});
|
|
3700
3813
|
}
|
|
3701
3814
|
}
|
|
@@ -3745,9 +3858,9 @@ class wi {
|
|
|
3745
3858
|
if (!e.width)
|
|
3746
3859
|
return;
|
|
3747
3860
|
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:
|
|
3861
|
+
const { data: g, sumHeight: p } = s.getData();
|
|
3862
|
+
this.height = p, this.data = g;
|
|
3863
|
+
const { top: u } = t.getBoundingClientRect();
|
|
3751
3864
|
this.width = e.width, this.visibleWidth = this.ctx.stageWidth - o;
|
|
3752
3865
|
const w = this.ctx.footer.height;
|
|
3753
3866
|
!this.data.length && !n ? this.height = h : !this.data.length && n && (this.height = n - e.height - w - o);
|
|
@@ -3761,19 +3874,19 @@ class wi {
|
|
|
3761
3874
|
width: this.width,
|
|
3762
3875
|
height: this.data.length ? 0 : h + w
|
|
3763
3876
|
});
|
|
3764
|
-
let
|
|
3765
|
-
|
|
3877
|
+
let C = this.height + e.height + o;
|
|
3878
|
+
C += w;
|
|
3766
3879
|
let m = 0;
|
|
3767
|
-
this.data.length && d ? (m = window.innerHeight -
|
|
3880
|
+
this.data.length && d ? (m = window.innerHeight - u - f, m < 0 && (m = 32, console.error(
|
|
3768
3881
|
"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(
|
|
3882
|
+
))) : 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`);
|
|
3883
|
+
let E = this.ctx.stageHeight - e.height - o;
|
|
3884
|
+
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;
|
|
3885
|
+
const b = window.devicePixelRatio || 1, R = this.ctx.stageWidth * b, O = this.ctx.stageHeight * b;
|
|
3886
|
+
t.width = Math.floor(R), t.height = Math.floor(O), this.ctx.canvasElement.setAttribute(
|
|
3774
3887
|
"style",
|
|
3775
3888
|
` height:${this.ctx.stageHeight}px;width:${this.ctx.stageWidth}px;`
|
|
3776
|
-
), this.ctx.paint.scale(
|
|
3889
|
+
), this.ctx.paint.scale(b);
|
|
3777
3890
|
}
|
|
3778
3891
|
// 调整行的高度
|
|
3779
3892
|
initResizeRow() {
|
|
@@ -3811,8 +3924,8 @@ class wi {
|
|
|
3811
3924
|
const x = this.renderRows[f];
|
|
3812
3925
|
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r < h - 4)
|
|
3813
3926
|
for (let p = 0; p < x.cells.length; p++) {
|
|
3814
|
-
const
|
|
3815
|
-
o >
|
|
3927
|
+
const u = x.cells[p];
|
|
3928
|
+
o > u.drawX + 10 && o < u.drawX + u.width - 10 && u.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
3816
3929
|
}
|
|
3817
3930
|
}
|
|
3818
3931
|
}
|
|
@@ -3842,7 +3955,7 @@ class wi {
|
|
|
3842
3955
|
});
|
|
3843
3956
|
}
|
|
3844
3957
|
}
|
|
3845
|
-
|
|
3958
|
+
drawFixedShadow() {
|
|
3846
3959
|
const {
|
|
3847
3960
|
fixedLeftWidth: t,
|
|
3848
3961
|
fixedRightWidth: e,
|
|
@@ -3859,7 +3972,7 @@ class wi {
|
|
|
3859
3972
|
colorEnd: "rgba(0,0,0,0)"
|
|
3860
3973
|
}), i < Math.floor(s.width - r - 1) && e !== n) {
|
|
3861
3974
|
const h = s.width - (this.x + this.width) + r - e;
|
|
3862
|
-
this.ctx.paint.drawShadow(h
|
|
3975
|
+
this.ctx.paint.drawShadow(h, this.y, e, this.height, {
|
|
3863
3976
|
fillColor: o,
|
|
3864
3977
|
side: "left",
|
|
3865
3978
|
shadowWidth: 4,
|
|
@@ -3895,15 +4008,19 @@ class wi {
|
|
|
3895
4008
|
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
4009
|
const d = [];
|
|
3897
4010
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3898
|
-
const x = this.headIndex + f,
|
|
4011
|
+
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
4012
|
d.push(w);
|
|
3900
4013
|
}
|
|
3901
4014
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
3902
4015
|
}
|
|
3903
4016
|
draw() {
|
|
3904
4017
|
this.renderRows.forEach((t) => {
|
|
4018
|
+
t.drawContainer();
|
|
4019
|
+
}), this.renderRows.forEach((t) => {
|
|
3905
4020
|
t.drawCenter();
|
|
3906
|
-
}), this.
|
|
4021
|
+
}), this.drawFixedShadow(), this.renderRows.forEach((t) => {
|
|
4022
|
+
t.drawFixedContainer();
|
|
4023
|
+
}), this.renderRows.forEach((t) => {
|
|
3907
4024
|
t.drawFixed();
|
|
3908
4025
|
}), this.drawTipLine();
|
|
3909
4026
|
}
|
|
@@ -3930,7 +4047,7 @@ class pi {
|
|
|
3930
4047
|
} = this.ctx;
|
|
3931
4048
|
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
4049
|
}
|
|
3933
|
-
|
|
4050
|
+
drawFixedShadow() {
|
|
3934
4051
|
const {
|
|
3935
4052
|
fixedLeftWidth: t,
|
|
3936
4053
|
fixedRightWidth: e,
|
|
@@ -3948,7 +4065,7 @@ class pi {
|
|
|
3948
4065
|
colorEnd: "rgba(0,0,0,0)"
|
|
3949
4066
|
}), i < Math.floor(s.width - r - 1) && e !== n) {
|
|
3950
4067
|
const c = s.width - (this.x + this.width) + r - e;
|
|
3951
|
-
this.ctx.paint.drawShadow(c
|
|
4068
|
+
this.ctx.paint.drawShadow(c, h, e, this.height, {
|
|
3952
4069
|
fillColor: o,
|
|
3953
4070
|
side: "left",
|
|
3954
4071
|
shadowWidth: 4,
|
|
@@ -3967,12 +4084,26 @@ class pi {
|
|
|
3967
4084
|
e += t, i.push(o);
|
|
3968
4085
|
}), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
|
|
3969
4086
|
}
|
|
4087
|
+
drawTopLine() {
|
|
4088
|
+
const {
|
|
4089
|
+
stageWidth: t,
|
|
4090
|
+
config: { BORDER_COLOR: e }
|
|
4091
|
+
} = this.ctx, i = [0, this.y, t, this.y];
|
|
4092
|
+
this.ctx.paint.drawLine(i, {
|
|
4093
|
+
borderColor: e,
|
|
4094
|
+
borderWidth: 1
|
|
4095
|
+
});
|
|
4096
|
+
}
|
|
3970
4097
|
draw() {
|
|
3971
4098
|
this.renderRows.forEach((t) => {
|
|
4099
|
+
t.drawContainer();
|
|
4100
|
+
}), this.renderRows.forEach((t) => {
|
|
3972
4101
|
t.drawCenter();
|
|
3973
|
-
}), this.
|
|
4102
|
+
}), this.drawFixedShadow(), this.renderRows.forEach((t) => {
|
|
4103
|
+
t.drawFixedContainer();
|
|
4104
|
+
}), this.renderRows.forEach((t) => {
|
|
3974
4105
|
t.drawFixed();
|
|
3975
|
-
});
|
|
4106
|
+
}), this.drawTopLine();
|
|
3976
4107
|
}
|
|
3977
4108
|
}
|
|
3978
4109
|
class yi {
|
|
@@ -4041,7 +4172,7 @@ class yi {
|
|
|
4041
4172
|
t.preventDefault(), this.moveFocus("LEFT");
|
|
4042
4173
|
return;
|
|
4043
4174
|
}
|
|
4044
|
-
if (t.code === "ArrowUp"
|
|
4175
|
+
if (t.code === "ArrowUp") {
|
|
4045
4176
|
t.preventDefault(), this.moveFocus("TOP");
|
|
4046
4177
|
return;
|
|
4047
4178
|
}
|
|
@@ -4049,7 +4180,7 @@ class yi {
|
|
|
4049
4180
|
t.preventDefault(), this.moveFocus("RIGHT");
|
|
4050
4181
|
return;
|
|
4051
4182
|
}
|
|
4052
|
-
if (t.code === "ArrowDown"
|
|
4183
|
+
if (t.code === "ArrowDown") {
|
|
4053
4184
|
t.preventDefault(), this.moveFocus("BOTTOM");
|
|
4054
4185
|
return;
|
|
4055
4186
|
}
|
|
@@ -4095,25 +4226,25 @@ class yi {
|
|
|
4095
4226
|
SELECTOR_AREA_MAX_Y: d,
|
|
4096
4227
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
4097
4228
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
4098
|
-
} = this.ctx.config,
|
|
4099
|
-
let [y,
|
|
4100
|
-
if (y <
|
|
4229
|
+
} = this.ctx.config, g = n, p = h || this.ctx.maxColIndex - f, u = c, w = d || this.ctx.maxRowIndex - x;
|
|
4230
|
+
let [y, C] = r, [m, E] = o;
|
|
4231
|
+
if (y < g || C > p || m < u || E > w)
|
|
4101
4232
|
return;
|
|
4102
4233
|
if (this.ctx.stageElement.focus(), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
4103
4234
|
const R = this.adjustMergeCells(r, o);
|
|
4104
|
-
m = R.yArr[0],
|
|
4235
|
+
m = R.yArr[0], E = R.yArr[1], y = R.xArr[0], C = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
|
|
4105
4236
|
}
|
|
4106
|
-
y ===
|
|
4107
|
-
const { BEFORE_SET_SELECTOR_METHOD:
|
|
4108
|
-
if (typeof
|
|
4109
|
-
const
|
|
4237
|
+
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)];
|
|
4238
|
+
const { BEFORE_SET_SELECTOR_METHOD: b } = this.ctx.config;
|
|
4239
|
+
if (typeof b == "function") {
|
|
4240
|
+
const O = b({
|
|
4110
4241
|
focusCell: this.ctx.focusCell,
|
|
4111
4242
|
xArr: r,
|
|
4112
4243
|
yArr: o
|
|
4113
4244
|
});
|
|
4114
|
-
if (!
|
|
4245
|
+
if (!O)
|
|
4115
4246
|
return;
|
|
4116
|
-
r =
|
|
4247
|
+
r = O.xArr, o = O.yArr;
|
|
4117
4248
|
}
|
|
4118
4249
|
this.ctx.selector.xArr = r, this.ctx.selector.yArr = o, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
|
|
4119
4250
|
}
|
|
@@ -4122,39 +4253,39 @@ class yi {
|
|
|
4122
4253
|
var p;
|
|
4123
4254
|
const [i, s] = e, [r, o] = t;
|
|
4124
4255
|
let n = [], h = [];
|
|
4125
|
-
for (let
|
|
4256
|
+
for (let u = 0; u <= e[1] - e[0]; u++)
|
|
4126
4257
|
for (let w = 0; w <= t[1] - t[0]; w++) {
|
|
4127
|
-
const y =
|
|
4128
|
-
m && ((y === i || y === s) && n.push(m), (
|
|
4258
|
+
const y = u + e[0], C = w + t[0], m = this.ctx.database.getVirtualBodyCell(y, C);
|
|
4259
|
+
m && ((y === i || y === s) && n.push(m), (C === r || C === o) && h.push(m));
|
|
4129
4260
|
}
|
|
4130
4261
|
const c = n.reduce(
|
|
4131
|
-
(
|
|
4132
|
-
const { yArr: y } = w.getSpanInfo(), [
|
|
4133
|
-
return
|
|
4262
|
+
(u, w) => {
|
|
4263
|
+
const { yArr: y } = w.getSpanInfo(), [C, m] = y;
|
|
4264
|
+
return u.minY = Math.min(u.minY, C), u.maxY = Math.max(u.maxY, m), u;
|
|
4134
4265
|
},
|
|
4135
4266
|
{
|
|
4136
4267
|
minY: i,
|
|
4137
4268
|
maxY: s
|
|
4138
4269
|
}
|
|
4139
4270
|
), d = h.reduce(
|
|
4140
|
-
(
|
|
4141
|
-
const { xArr: y } = w.getSpanInfo(), [
|
|
4142
|
-
return
|
|
4271
|
+
(u, w) => {
|
|
4272
|
+
const { xArr: y } = w.getSpanInfo(), [C, m] = y;
|
|
4273
|
+
return u.minX = Math.min(u.minX, C), u.maxX = Math.max(u.maxX, m), u;
|
|
4143
4274
|
},
|
|
4144
4275
|
{
|
|
4145
4276
|
minX: r,
|
|
4146
4277
|
maxX: o
|
|
4147
4278
|
}
|
|
4148
4279
|
), f = [d.minX, d.maxX], x = [c.minY, c.maxY];
|
|
4149
|
-
let
|
|
4280
|
+
let g = !1;
|
|
4150
4281
|
if (d.minX !== d.maxX || c.minY !== c.maxY) {
|
|
4151
|
-
const
|
|
4152
|
-
|
|
4282
|
+
const u = JSON.stringify(f) + JSON.stringify(x), w = (p = this.ctx.focusCell) == null ? void 0 : p.getSpanInfo();
|
|
4283
|
+
g = (w && JSON.stringify(w.xArr) + JSON.stringify(w.yArr)) === u;
|
|
4153
4284
|
}
|
|
4154
4285
|
return {
|
|
4155
4286
|
xArr: f,
|
|
4156
4287
|
yArr: x,
|
|
4157
|
-
onlyMergeCell:
|
|
4288
|
+
onlyMergeCell: g
|
|
4158
4289
|
};
|
|
4159
4290
|
}
|
|
4160
4291
|
selectCols(t) {
|
|
@@ -4191,8 +4322,8 @@ class yi {
|
|
|
4191
4322
|
SELECTOR_AREA_MAX_Y: o,
|
|
4192
4323
|
SELECTOR_AREA_MAX_X_OFFSET: n,
|
|
4193
4324
|
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(
|
|
4325
|
+
} = 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];
|
|
4326
|
+
this.setSelector(g, p);
|
|
4196
4327
|
}
|
|
4197
4328
|
}
|
|
4198
4329
|
selectRows(t, e = !0) {
|
|
@@ -4230,8 +4361,8 @@ class yi {
|
|
|
4230
4361
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
4231
4362
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
|
|
4232
4363
|
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,
|
|
4364
|
+
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];
|
|
4365
|
+
this.setSelector(x, g);
|
|
4235
4366
|
} else {
|
|
4236
4367
|
this.ctx.emit("cellSelectedClick", e);
|
|
4237
4368
|
const s = [e.colIndex, e.colIndex], r = [e.rowIndex, e.rowIndex];
|
|
@@ -4299,10 +4430,10 @@ class yi {
|
|
|
4299
4430
|
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4300
4431
|
const c = n + e[0], d = h + t[0], f = this.ctx.database.getItemValueForRowIndexAndColIndex(c, d);
|
|
4301
4432
|
if (f) {
|
|
4302
|
-
const { rowKey: x, key:
|
|
4303
|
-
this.ctx.database.getReadonly(x,
|
|
4433
|
+
const { rowKey: x, key: g } = f;
|
|
4434
|
+
this.ctx.database.getReadonly(x, g) || (r.add(x), s.push({
|
|
4304
4435
|
rowKey: x,
|
|
4305
|
-
key:
|
|
4436
|
+
key: g,
|
|
4306
4437
|
value: null,
|
|
4307
4438
|
row: {}
|
|
4308
4439
|
//内部有设置
|
|
@@ -4331,27 +4462,27 @@ class yi {
|
|
|
4331
4462
|
let o = ii(r);
|
|
4332
4463
|
const n = [i, i + o[0].length - 1], h = [e, e + o.length - 1], c = o.length === 1 && o[0].length === 1;
|
|
4333
4464
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
|
|
4334
|
-
const
|
|
4465
|
+
const g = {
|
|
4335
4466
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4336
4467
|
message: "Merged cells cannot span paste data"
|
|
4337
4468
|
};
|
|
4338
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4469
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", g) : alert(g.message);
|
|
4339
4470
|
return;
|
|
4340
4471
|
}
|
|
4341
4472
|
let d = [];
|
|
4342
|
-
for (let
|
|
4343
|
-
const p = o[
|
|
4344
|
-
for (let
|
|
4345
|
-
const w =
|
|
4473
|
+
for (let g = 0; g <= o.length - 1; g++) {
|
|
4474
|
+
const p = o[g].length;
|
|
4475
|
+
for (let u = 0; u <= p - 1; u++) {
|
|
4476
|
+
const w = g + e, y = u + i, C = o[g][u], m = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4346
4477
|
w,
|
|
4347
4478
|
y
|
|
4348
4479
|
);
|
|
4349
4480
|
if (m) {
|
|
4350
|
-
const { rowKey:
|
|
4351
|
-
this.ctx.database.getReadonly(
|
|
4352
|
-
rowKey:
|
|
4353
|
-
key:
|
|
4354
|
-
value:
|
|
4481
|
+
const { rowKey: E, key: b } = m;
|
|
4482
|
+
this.ctx.database.getReadonly(E, b) || (s.add(E), d.push({
|
|
4483
|
+
rowKey: E,
|
|
4484
|
+
key: b,
|
|
4485
|
+
value: C,
|
|
4355
4486
|
row: {}
|
|
4356
4487
|
//内部有设置
|
|
4357
4488
|
}));
|
|
@@ -4359,34 +4490,34 @@ class yi {
|
|
|
4359
4490
|
}
|
|
4360
4491
|
}
|
|
4361
4492
|
if (this.isCut) {
|
|
4362
|
-
const
|
|
4493
|
+
const g = this.clearSelectedData(
|
|
4363
4494
|
this.ctx.selector.xArrCopy,
|
|
4364
4495
|
this.ctx.selector.yArrCopy,
|
|
4365
4496
|
!0
|
|
4366
4497
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4367
|
-
), p = d.map((
|
|
4368
|
-
|
|
4369
|
-
p.includes(`${
|
|
4498
|
+
), p = d.map((u) => `${u.rowKey}-${u.key}`);
|
|
4499
|
+
g.forEach((u) => {
|
|
4500
|
+
p.includes(`${u.rowKey}-${u.key}`) || d.unshift(u);
|
|
4370
4501
|
}), this.isCut = !1;
|
|
4371
4502
|
}
|
|
4372
4503
|
if (!d.length)
|
|
4373
4504
|
return;
|
|
4374
4505
|
const { BEFORE_PASTE_DATA_METHOD: f } = this.ctx.config;
|
|
4375
4506
|
if (typeof f == "function") {
|
|
4376
|
-
const
|
|
4377
|
-
rowKey:
|
|
4378
|
-
key:
|
|
4379
|
-
value:
|
|
4380
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4381
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
4507
|
+
const g = f, p = d.map((u) => ({
|
|
4508
|
+
rowKey: u.rowKey,
|
|
4509
|
+
key: u.key,
|
|
4510
|
+
value: u.value,
|
|
4511
|
+
oldValue: this.ctx.database.getItemValue(u.rowKey, u.key),
|
|
4512
|
+
row: this.ctx.database.getRowDataItemForRowKey(u.rowKey)
|
|
4382
4513
|
}));
|
|
4383
|
-
if (d = await
|
|
4514
|
+
if (d = await g(p, n, h), d && !d.length)
|
|
4384
4515
|
return;
|
|
4385
4516
|
}
|
|
4386
4517
|
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4387
4518
|
let x = [];
|
|
4388
|
-
s.forEach((
|
|
4389
|
-
x.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4519
|
+
s.forEach((g) => {
|
|
4520
|
+
x.push(this.ctx.database.getRowDataItemForRowKey(g));
|
|
4390
4521
|
}), this.ctx.emit("pasteChange", d, x);
|
|
4391
4522
|
}).catch((r) => {
|
|
4392
4523
|
console.error("Failed to get the clipboard content:", r);
|
|
@@ -4476,19 +4607,19 @@ class yi {
|
|
|
4476
4607
|
body: h,
|
|
4477
4608
|
scrollX: c,
|
|
4478
4609
|
scrollY: d,
|
|
4479
|
-
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION:
|
|
4610
|
+
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION: g, ENABLE_MERGE_CELL_LINK: p }
|
|
4480
4611
|
} = this.ctx;
|
|
4481
4612
|
if (!i)
|
|
4482
4613
|
return;
|
|
4483
4614
|
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
|
-
|
|
4615
|
+
const { drawX: u, drawY: w, width: y, height: C, fixed: m } = i, E = r - u + 1, b = i.drawX + y - (e - s) + 1;
|
|
4616
|
+
let R = o.height - w, O = C;
|
|
4617
|
+
O > h.visibleHeight && (O = h.visibleHeight);
|
|
4618
|
+
let L = 0;
|
|
4619
|
+
x && (g === "top" ? R = o.height + n.height - w : L = n.visibleHeight);
|
|
4620
|
+
const _ = w + O - (t - L - f);
|
|
4621
|
+
let v = c, A = d;
|
|
4622
|
+
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
4623
|
}
|
|
4493
4624
|
destroy() {
|
|
4494
4625
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -4497,18 +4628,19 @@ class yi {
|
|
|
4497
4628
|
class mi {
|
|
4498
4629
|
constructor(t) {
|
|
4499
4630
|
l(this, "ctx");
|
|
4631
|
+
l(this, "maxColRowCell");
|
|
4500
4632
|
this.ctx = t, this.init();
|
|
4501
4633
|
}
|
|
4502
4634
|
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("
|
|
4635
|
+
this.ctx.on("mousemove", (t) => {
|
|
4636
|
+
if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
|
|
4637
|
+
return;
|
|
4638
|
+
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;
|
|
4639
|
+
e > x && i > g && e < x + d && i < g + d && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4640
|
+
}), this.ctx.on("cellMouseenter", (t) => {
|
|
4641
|
+
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], r = i[1], { colIndex: o, rowIndex: n } = t;
|
|
4642
|
+
this.ctx.config.ENABLE_AUTOFILL && o === s && n === r && (this.maxColRowCell = t), this.mouseenter(t);
|
|
4643
|
+
}), this.ctx.on("mousedown", () => {
|
|
4512
4644
|
this.ctx.stageElement.style.cursor === "crosshair" && this.setMousedown();
|
|
4513
4645
|
}), this.ctx.on("mouseup", () => {
|
|
4514
4646
|
this.setMouseUp();
|
|
@@ -4550,22 +4682,22 @@ class mi {
|
|
|
4550
4682
|
SELECTOR_AREA_MIN_Y: d,
|
|
4551
4683
|
SELECTOR_AREA_MAX_Y: f,
|
|
4552
4684
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4553
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4554
|
-
} = this.ctx.config, p = h,
|
|
4555
|
-
let [
|
|
4556
|
-
if (
|
|
4685
|
+
SELECTOR_AREA_MAX_Y_OFFSET: g
|
|
4686
|
+
} = this.ctx.config, p = h, u = c || this.ctx.maxColIndex - x, w = d, y = f || this.ctx.maxRowIndex - g;
|
|
4687
|
+
let [C, m] = o, [E, b] = n;
|
|
4688
|
+
if (C < p || E < w)
|
|
4557
4689
|
return;
|
|
4558
|
-
o = [Math.max(p,
|
|
4690
|
+
o = [Math.max(p, C), Math.min(u, m)], n = [Math.max(w, E), Math.min(y, b)];
|
|
4559
4691
|
const { BEFORE_SET_AUTOFILL_METHOD: R } = this.ctx.config;
|
|
4560
4692
|
if (typeof R == "function") {
|
|
4561
|
-
const
|
|
4693
|
+
const L = R({
|
|
4562
4694
|
focusCell: this.ctx.focusCell,
|
|
4563
4695
|
xArr: o,
|
|
4564
4696
|
yArr: n
|
|
4565
4697
|
});
|
|
4566
|
-
if (!
|
|
4698
|
+
if (!L)
|
|
4567
4699
|
return;
|
|
4568
|
-
o =
|
|
4700
|
+
o = L.xArr, n = L.yArr;
|
|
4569
4701
|
}
|
|
4570
4702
|
this.ctx.autofill.xArr = o, this.ctx.autofill.yArr = n, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
4571
4703
|
}
|
|
@@ -4575,29 +4707,29 @@ class mi {
|
|
|
4575
4707
|
*/
|
|
4576
4708
|
async autofillData() {
|
|
4577
4709
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
4578
|
-
for (let
|
|
4710
|
+
for (let g = 0; g <= e.yArr[1] - e.yArr[0]; g++)
|
|
4579
4711
|
for (let p = 0; p <= e.xArr[1] - e.xArr[0]; p++) {
|
|
4580
|
-
const
|
|
4581
|
-
i.set(`${
|
|
4712
|
+
const u = g + e.yArr[0], w = p + e.xArr[0];
|
|
4713
|
+
i.set(`${u}-${w}`, !0);
|
|
4582
4714
|
}
|
|
4583
4715
|
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
4716
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(n, h) && !c) {
|
|
4585
|
-
const
|
|
4717
|
+
const g = {
|
|
4586
4718
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
4587
4719
|
message: "Merged cells cannot span autofill data"
|
|
4588
4720
|
};
|
|
4589
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4721
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", g) : alert(g.message);
|
|
4590
4722
|
return;
|
|
4591
4723
|
}
|
|
4592
4724
|
let d = [];
|
|
4593
|
-
for (let
|
|
4725
|
+
for (let g = 0; g <= h[1] - h[0]; g++)
|
|
4594
4726
|
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:
|
|
4727
|
+
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}`;
|
|
4728
|
+
if (C && !i.has(m)) {
|
|
4729
|
+
const { rowKey: E, key: b } = C;
|
|
4730
|
+
this.ctx.database.getReadonly(E, b) || (t.add(E), d.push({
|
|
4731
|
+
rowKey: E,
|
|
4732
|
+
key: b,
|
|
4601
4733
|
value: y,
|
|
4602
4734
|
row: {}
|
|
4603
4735
|
}));
|
|
@@ -4608,20 +4740,20 @@ class mi {
|
|
|
4608
4740
|
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
|
|
4609
4741
|
const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
|
|
4610
4742
|
if (typeof f == "function") {
|
|
4611
|
-
const
|
|
4612
|
-
rowKey:
|
|
4613
|
-
key:
|
|
4614
|
-
value:
|
|
4615
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4616
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
4743
|
+
const g = f, p = d.map((u) => ({
|
|
4744
|
+
rowKey: u.rowKey,
|
|
4745
|
+
key: u.key,
|
|
4746
|
+
value: u.value,
|
|
4747
|
+
oldValue: this.ctx.database.getItemValue(u.rowKey, u.key),
|
|
4748
|
+
row: this.ctx.database.getRowDataItemForRowKey(u.rowKey)
|
|
4617
4749
|
}));
|
|
4618
|
-
if (d = await
|
|
4750
|
+
if (d = await g(p, n, h), d && !d.length)
|
|
4619
4751
|
return;
|
|
4620
4752
|
}
|
|
4621
4753
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4622
4754
|
let x = [];
|
|
4623
|
-
t.forEach((
|
|
4624
|
-
x.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4755
|
+
t.forEach((g) => {
|
|
4756
|
+
x.push(this.ctx.database.getRowDataItemForRowKey(g));
|
|
4625
4757
|
}), this.ctx.emit("autofillChange", d, x);
|
|
4626
4758
|
}
|
|
4627
4759
|
mouseenter(t) {
|
|
@@ -4644,11 +4776,11 @@ const rt = Math.min, U = Math.max, ft = Math.round, z = (a) => ({
|
|
|
4644
4776
|
right: "left",
|
|
4645
4777
|
bottom: "top",
|
|
4646
4778
|
top: "bottom"
|
|
4647
|
-
},
|
|
4779
|
+
}, Ci = {
|
|
4648
4780
|
start: "end",
|
|
4649
4781
|
end: "start"
|
|
4650
4782
|
};
|
|
4651
|
-
function
|
|
4783
|
+
function It(a, t, e) {
|
|
4652
4784
|
return U(a, rt(t, e));
|
|
4653
4785
|
}
|
|
4654
4786
|
function at(a, t) {
|
|
@@ -4672,7 +4804,7 @@ function J(a) {
|
|
|
4672
4804
|
function Ht(a) {
|
|
4673
4805
|
return ne(J(a));
|
|
4674
4806
|
}
|
|
4675
|
-
function
|
|
4807
|
+
function bi(a, t, e) {
|
|
4676
4808
|
e === void 0 && (e = !1);
|
|
4677
4809
|
const i = lt(a), s = Ht(a), r = Mt(s);
|
|
4678
4810
|
let o = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
@@ -4683,7 +4815,7 @@ function vi(a) {
|
|
|
4683
4815
|
return [Ot(a), t, Ot(t)];
|
|
4684
4816
|
}
|
|
4685
4817
|
function Ot(a) {
|
|
4686
|
-
return a.replace(/start|end/g, (t) =>
|
|
4818
|
+
return a.replace(/start|end/g, (t) => Ci[t]);
|
|
4687
4819
|
}
|
|
4688
4820
|
function Ri(a, t, e) {
|
|
4689
4821
|
const i = ["left", "right"], s = ["right", "left"], r = ["top", "bottom"], o = ["bottom", "top"];
|
|
@@ -4698,7 +4830,7 @@ function Ri(a, t, e) {
|
|
|
4698
4830
|
return [];
|
|
4699
4831
|
}
|
|
4700
4832
|
}
|
|
4701
|
-
function
|
|
4833
|
+
function _i(a, t, e, i) {
|
|
4702
4834
|
const s = lt(a);
|
|
4703
4835
|
let r = Ri(q(a), e === "start", i);
|
|
4704
4836
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
@@ -4706,7 +4838,7 @@ function Ii(a, t, e, i) {
|
|
|
4706
4838
|
function xt(a) {
|
|
4707
4839
|
return a.replace(/left|right|bottom|top/g, (t) => Ei[t]);
|
|
4708
4840
|
}
|
|
4709
|
-
function
|
|
4841
|
+
function Ii(a) {
|
|
4710
4842
|
return {
|
|
4711
4843
|
top: 0,
|
|
4712
4844
|
right: 0,
|
|
@@ -4716,7 +4848,7 @@ function _i(a) {
|
|
|
4716
4848
|
};
|
|
4717
4849
|
}
|
|
4718
4850
|
function ae(a) {
|
|
4719
|
-
return typeof a != "number" ?
|
|
4851
|
+
return typeof a != "number" ? Ii(a) : {
|
|
4720
4852
|
top: a,
|
|
4721
4853
|
right: a,
|
|
4722
4854
|
bottom: a,
|
|
@@ -4747,47 +4879,47 @@ function zt(a, t, e) {
|
|
|
4747
4879
|
floating: s
|
|
4748
4880
|
} = a;
|
|
4749
4881
|
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
|
|
4882
|
+
let g;
|
|
4751
4883
|
switch (h) {
|
|
4752
4884
|
case "top":
|
|
4753
|
-
|
|
4885
|
+
g = {
|
|
4754
4886
|
x: d,
|
|
4755
4887
|
y: i.y - s.height
|
|
4756
4888
|
};
|
|
4757
4889
|
break;
|
|
4758
4890
|
case "bottom":
|
|
4759
|
-
|
|
4891
|
+
g = {
|
|
4760
4892
|
x: d,
|
|
4761
4893
|
y: i.y + i.height
|
|
4762
4894
|
};
|
|
4763
4895
|
break;
|
|
4764
4896
|
case "right":
|
|
4765
|
-
|
|
4897
|
+
g = {
|
|
4766
4898
|
x: i.x + i.width,
|
|
4767
4899
|
y: f
|
|
4768
4900
|
};
|
|
4769
4901
|
break;
|
|
4770
4902
|
case "left":
|
|
4771
|
-
|
|
4903
|
+
g = {
|
|
4772
4904
|
x: i.x - s.width,
|
|
4773
4905
|
y: f
|
|
4774
4906
|
};
|
|
4775
4907
|
break;
|
|
4776
4908
|
default:
|
|
4777
|
-
|
|
4909
|
+
g = {
|
|
4778
4910
|
x: i.x,
|
|
4779
4911
|
y: i.y
|
|
4780
4912
|
};
|
|
4781
4913
|
}
|
|
4782
4914
|
switch (lt(t)) {
|
|
4783
4915
|
case "start":
|
|
4784
|
-
|
|
4916
|
+
g[o] -= x * (e && c ? -1 : 1);
|
|
4785
4917
|
break;
|
|
4786
4918
|
case "end":
|
|
4787
|
-
|
|
4919
|
+
g[o] += x * (e && c ? -1 : 1);
|
|
4788
4920
|
break;
|
|
4789
4921
|
}
|
|
4790
|
-
return
|
|
4922
|
+
return g;
|
|
4791
4923
|
}
|
|
4792
4924
|
const Oi = async (a, t, e) => {
|
|
4793
4925
|
const {
|
|
@@ -4803,23 +4935,23 @@ const Oi = async (a, t, e) => {
|
|
|
4803
4935
|
}), {
|
|
4804
4936
|
x: d,
|
|
4805
4937
|
y: f
|
|
4806
|
-
} = zt(c, i, h), x = i,
|
|
4807
|
-
for (let
|
|
4938
|
+
} = zt(c, i, h), x = i, g = {}, p = 0;
|
|
4939
|
+
for (let u = 0; u < n.length; u++) {
|
|
4808
4940
|
const {
|
|
4809
4941
|
name: w,
|
|
4810
4942
|
fn: y
|
|
4811
|
-
} = n[
|
|
4812
|
-
x:
|
|
4943
|
+
} = n[u], {
|
|
4944
|
+
x: C,
|
|
4813
4945
|
y: m,
|
|
4814
|
-
data:
|
|
4815
|
-
reset:
|
|
4946
|
+
data: E,
|
|
4947
|
+
reset: b
|
|
4816
4948
|
} = await y({
|
|
4817
4949
|
x: d,
|
|
4818
4950
|
y: f,
|
|
4819
4951
|
initialPlacement: i,
|
|
4820
4952
|
placement: x,
|
|
4821
4953
|
strategy: s,
|
|
4822
|
-
middlewareData:
|
|
4954
|
+
middlewareData: g,
|
|
4823
4955
|
rects: c,
|
|
4824
4956
|
platform: o,
|
|
4825
4957
|
elements: {
|
|
@@ -4827,27 +4959,27 @@ const Oi = async (a, t, e) => {
|
|
|
4827
4959
|
floating: t
|
|
4828
4960
|
}
|
|
4829
4961
|
});
|
|
4830
|
-
d =
|
|
4831
|
-
...
|
|
4962
|
+
d = C ?? d, f = m ?? f, g = {
|
|
4963
|
+
...g,
|
|
4832
4964
|
[w]: {
|
|
4833
|
-
...
|
|
4834
|
-
...
|
|
4965
|
+
...g[w],
|
|
4966
|
+
...E
|
|
4835
4967
|
}
|
|
4836
|
-
},
|
|
4968
|
+
}, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (x = b.placement), b.rects && (c = b.rects === !0 ? await o.getElementRects({
|
|
4837
4969
|
reference: a,
|
|
4838
4970
|
floating: t,
|
|
4839
4971
|
strategy: s
|
|
4840
|
-
}) :
|
|
4972
|
+
}) : b.rects), {
|
|
4841
4973
|
x: d,
|
|
4842
4974
|
y: f
|
|
4843
|
-
} = zt(c, x, h)),
|
|
4975
|
+
} = zt(c, x, h)), u = -1);
|
|
4844
4976
|
}
|
|
4845
4977
|
return {
|
|
4846
4978
|
x: d,
|
|
4847
4979
|
y: f,
|
|
4848
4980
|
placement: x,
|
|
4849
4981
|
strategy: s,
|
|
4850
|
-
middlewareData:
|
|
4982
|
+
middlewareData: g
|
|
4851
4983
|
};
|
|
4852
4984
|
};
|
|
4853
4985
|
async function le(a, t) {
|
|
@@ -4865,34 +4997,34 @@ async function le(a, t) {
|
|
|
4865
4997
|
rootBoundary: d = "viewport",
|
|
4866
4998
|
elementContext: f = "floating",
|
|
4867
4999
|
altBoundary: x = !1,
|
|
4868
|
-
padding:
|
|
4869
|
-
} = at(t, a), p = ae(
|
|
5000
|
+
padding: g = 0
|
|
5001
|
+
} = at(t, a), p = ae(g), w = n[x ? f === "floating" ? "reference" : "floating" : f], y = ut(await r.getClippingRect({
|
|
4870
5002
|
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
5003
|
boundary: c,
|
|
4872
5004
|
rootBoundary: d,
|
|
4873
5005
|
strategy: h
|
|
4874
|
-
})),
|
|
5006
|
+
})), C = f === "floating" ? {
|
|
4875
5007
|
x: i,
|
|
4876
5008
|
y: s,
|
|
4877
5009
|
width: o.floating.width,
|
|
4878
5010
|
height: o.floating.height
|
|
4879
|
-
} : o.reference, m = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(n.floating)),
|
|
5011
|
+
} : 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
5012
|
x: 1,
|
|
4881
5013
|
y: 1
|
|
4882
5014
|
} : {
|
|
4883
5015
|
x: 1,
|
|
4884
5016
|
y: 1
|
|
4885
|
-
},
|
|
5017
|
+
}, b = ut(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4886
5018
|
elements: n,
|
|
4887
|
-
rect:
|
|
5019
|
+
rect: C,
|
|
4888
5020
|
offsetParent: m,
|
|
4889
5021
|
strategy: h
|
|
4890
|
-
}) :
|
|
5022
|
+
}) : C);
|
|
4891
5023
|
return {
|
|
4892
|
-
top: (y.top -
|
|
4893
|
-
bottom: (
|
|
4894
|
-
left: (y.left -
|
|
4895
|
-
right: (
|
|
5024
|
+
top: (y.top - b.top + p.top) / E.y,
|
|
5025
|
+
bottom: (b.bottom - y.bottom + p.bottom) / E.y,
|
|
5026
|
+
left: (y.left - b.left + p.left) / E.x,
|
|
5027
|
+
right: (b.right - y.right + p.right) / E.x
|
|
4896
5028
|
};
|
|
4897
5029
|
}
|
|
4898
5030
|
const Si = (a) => ({
|
|
@@ -4916,23 +5048,23 @@ const Si = (a) => ({
|
|
|
4916
5048
|
const f = ae(d), x = {
|
|
4917
5049
|
x: e,
|
|
4918
5050
|
y: i
|
|
4919
|
-
},
|
|
4920
|
-
let
|
|
4921
|
-
(!
|
|
4922
|
-
const
|
|
5051
|
+
}, 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));
|
|
5052
|
+
let O = R ? R[m] : 0;
|
|
5053
|
+
(!O || !await (o.isElement == null ? void 0 : o.isElement(R))) && (O = n.floating[m] || r.floating[p]);
|
|
5054
|
+
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, B = It(S, T, M), Y = !h.arrow && lt(s) != null && T !== B && r.reference[p] / 2 - (T < S ? v : A) - u[p] / 2 < 0, k = Y ? T < S ? T - S : T - M : 0;
|
|
4923
5055
|
return {
|
|
4924
|
-
[
|
|
5056
|
+
[g]: x[g] + k,
|
|
4925
5057
|
data: {
|
|
4926
|
-
[
|
|
4927
|
-
centerOffset: T -
|
|
5058
|
+
[g]: B,
|
|
5059
|
+
centerOffset: T - B - k,
|
|
4928
5060
|
...Y && {
|
|
4929
|
-
alignmentOffset:
|
|
5061
|
+
alignmentOffset: k
|
|
4930
5062
|
}
|
|
4931
5063
|
},
|
|
4932
5064
|
reset: Y
|
|
4933
5065
|
};
|
|
4934
5066
|
}
|
|
4935
|
-
}),
|
|
5067
|
+
}), Li = function(a) {
|
|
4936
5068
|
return a === void 0 && (a = {}), {
|
|
4937
5069
|
name: "flip",
|
|
4938
5070
|
options: a,
|
|
@@ -4949,52 +5081,52 @@ const Si = (a) => ({
|
|
|
4949
5081
|
mainAxis: d = !0,
|
|
4950
5082
|
crossAxis: f = !0,
|
|
4951
5083
|
fallbackPlacements: x,
|
|
4952
|
-
fallbackStrategy:
|
|
5084
|
+
fallbackStrategy: g = "bestFit",
|
|
4953
5085
|
fallbackAxisSideDirection: p = "none",
|
|
4954
|
-
flipAlignment:
|
|
5086
|
+
flipAlignment: u = !0,
|
|
4955
5087
|
...w
|
|
4956
5088
|
} = at(a, t);
|
|
4957
5089
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4958
5090
|
return {};
|
|
4959
|
-
const y = q(s),
|
|
4960
|
-
!x && R &&
|
|
4961
|
-
const
|
|
5091
|
+
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";
|
|
5092
|
+
!x && R && b.push(..._i(n, u, p, E));
|
|
5093
|
+
const O = [n, ...b], L = await le(t, w), _ = [];
|
|
4962
5094
|
let v = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4963
|
-
if (d &&
|
|
4964
|
-
const T =
|
|
4965
|
-
|
|
5095
|
+
if (d && _.push(L[y]), f) {
|
|
5096
|
+
const T = bi(s, o, E);
|
|
5097
|
+
_.push(L[T[0]], L[T[1]]);
|
|
4966
5098
|
}
|
|
4967
5099
|
if (v = [...v, {
|
|
4968
5100
|
placement: s,
|
|
4969
|
-
overflows:
|
|
4970
|
-
}], !
|
|
4971
|
-
var
|
|
4972
|
-
const T = (((
|
|
4973
|
-
if (
|
|
5101
|
+
overflows: _
|
|
5102
|
+
}], !_.every((T) => T <= 0)) {
|
|
5103
|
+
var A, S;
|
|
5104
|
+
const T = (((A = r.flip) == null ? void 0 : A.index) || 0) + 1, B = O[T];
|
|
5105
|
+
if (B)
|
|
4974
5106
|
return {
|
|
4975
5107
|
data: {
|
|
4976
5108
|
index: T,
|
|
4977
5109
|
overflows: v
|
|
4978
5110
|
},
|
|
4979
5111
|
reset: {
|
|
4980
|
-
placement:
|
|
5112
|
+
placement: B
|
|
4981
5113
|
}
|
|
4982
5114
|
};
|
|
4983
|
-
let Y = (
|
|
5115
|
+
let Y = (S = v.filter((k) => k.overflows[0] <= 0).sort((k, W) => k.overflows[1] - W.overflows[1])[0]) == null ? void 0 : S.placement;
|
|
4984
5116
|
if (!Y)
|
|
4985
|
-
switch (
|
|
5117
|
+
switch (g) {
|
|
4986
5118
|
case "bestFit": {
|
|
4987
5119
|
var M;
|
|
4988
|
-
const
|
|
5120
|
+
const k = (M = v.filter((W) => {
|
|
4989
5121
|
if (R) {
|
|
4990
5122
|
const P = J(W.placement);
|
|
4991
|
-
return P ===
|
|
5123
|
+
return P === C || // Create a bias to the `y` side axis due to horizontal
|
|
4992
5124
|
// reading directions favoring greater width.
|
|
4993
5125
|
P === "y";
|
|
4994
5126
|
}
|
|
4995
5127
|
return !0;
|
|
4996
5128
|
}).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
|
-
|
|
5129
|
+
k && (Y = k);
|
|
4998
5130
|
break;
|
|
4999
5131
|
}
|
|
5000
5132
|
case "initialPlacement":
|
|
@@ -5012,7 +5144,7 @@ const Si = (a) => ({
|
|
|
5012
5144
|
}
|
|
5013
5145
|
};
|
|
5014
5146
|
};
|
|
5015
|
-
async function
|
|
5147
|
+
async function Ai(a, t) {
|
|
5016
5148
|
const {
|
|
5017
5149
|
placement: e,
|
|
5018
5150
|
platform: i,
|
|
@@ -5020,7 +5152,7 @@ async function Li(a, t) {
|
|
|
5020
5152
|
} = 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
5153
|
let {
|
|
5022
5154
|
mainAxis: x,
|
|
5023
|
-
crossAxis:
|
|
5155
|
+
crossAxis: g,
|
|
5024
5156
|
alignmentAxis: p
|
|
5025
5157
|
} = typeof f == "number" ? {
|
|
5026
5158
|
mainAxis: f,
|
|
@@ -5031,12 +5163,12 @@ async function Li(a, t) {
|
|
|
5031
5163
|
crossAxis: f.crossAxis || 0,
|
|
5032
5164
|
alignmentAxis: f.alignmentAxis
|
|
5033
5165
|
};
|
|
5034
|
-
return n && typeof p == "number" && (
|
|
5035
|
-
x:
|
|
5166
|
+
return n && typeof p == "number" && (g = n === "end" ? p * -1 : p), h ? {
|
|
5167
|
+
x: g * d,
|
|
5036
5168
|
y: x * c
|
|
5037
5169
|
} : {
|
|
5038
5170
|
x: x * c,
|
|
5039
|
-
y:
|
|
5171
|
+
y: g * d
|
|
5040
5172
|
};
|
|
5041
5173
|
}
|
|
5042
5174
|
const Ti = function(a) {
|
|
@@ -5050,7 +5182,7 @@ const Ti = function(a) {
|
|
|
5050
5182
|
y: r,
|
|
5051
5183
|
placement: o,
|
|
5052
5184
|
middlewareData: n
|
|
5053
|
-
} = t, h = await
|
|
5185
|
+
} = t, h = await Ai(t, a);
|
|
5054
5186
|
return o === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
|
|
5055
5187
|
x: s + h.x,
|
|
5056
5188
|
y: r + h.y,
|
|
@@ -5077,11 +5209,11 @@ const Ti = function(a) {
|
|
|
5077
5209
|
fn: (w) => {
|
|
5078
5210
|
let {
|
|
5079
5211
|
x: y,
|
|
5080
|
-
y:
|
|
5212
|
+
y: C
|
|
5081
5213
|
} = w;
|
|
5082
5214
|
return {
|
|
5083
5215
|
x: y,
|
|
5084
|
-
y:
|
|
5216
|
+
y: C
|
|
5085
5217
|
};
|
|
5086
5218
|
}
|
|
5087
5219
|
},
|
|
@@ -5090,25 +5222,25 @@ const Ti = function(a) {
|
|
|
5090
5222
|
x: e,
|
|
5091
5223
|
y: i
|
|
5092
5224
|
}, d = await le(t, h), f = J(q(s)), x = ne(f);
|
|
5093
|
-
let
|
|
5225
|
+
let g = c[x], p = c[f];
|
|
5094
5226
|
if (r) {
|
|
5095
|
-
const w = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right",
|
|
5096
|
-
|
|
5227
|
+
const w = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", C = g + d[w], m = g - d[y];
|
|
5228
|
+
g = It(C, g, m);
|
|
5097
5229
|
}
|
|
5098
5230
|
if (o) {
|
|
5099
|
-
const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right",
|
|
5100
|
-
p =
|
|
5231
|
+
const w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", C = p + d[w], m = p - d[y];
|
|
5232
|
+
p = It(C, p, m);
|
|
5101
5233
|
}
|
|
5102
|
-
const
|
|
5234
|
+
const u = n.fn({
|
|
5103
5235
|
...t,
|
|
5104
|
-
[x]:
|
|
5236
|
+
[x]: g,
|
|
5105
5237
|
[f]: p
|
|
5106
5238
|
});
|
|
5107
5239
|
return {
|
|
5108
|
-
...
|
|
5240
|
+
...u,
|
|
5109
5241
|
data: {
|
|
5110
|
-
x:
|
|
5111
|
-
y:
|
|
5242
|
+
x: u.x - e,
|
|
5243
|
+
y: u.y - i,
|
|
5112
5244
|
enabled: {
|
|
5113
5245
|
[x]: r,
|
|
5114
5246
|
[f]: o
|
|
@@ -5138,7 +5270,7 @@ function he(a) {
|
|
|
5138
5270
|
function X(a) {
|
|
5139
5271
|
return gt() ? a instanceof Element || a instanceof F(a).Element : !1;
|
|
5140
5272
|
}
|
|
5141
|
-
function
|
|
5273
|
+
function K(a) {
|
|
5142
5274
|
return gt() ? a instanceof HTMLElement || a instanceof F(a).HTMLElement : !1;
|
|
5143
5275
|
}
|
|
5144
5276
|
function $t(a) {
|
|
@@ -5150,7 +5282,7 @@ function ht(a) {
|
|
|
5150
5282
|
overflowX: e,
|
|
5151
5283
|
overflowY: i,
|
|
5152
5284
|
display: s
|
|
5153
|
-
} =
|
|
5285
|
+
} = N(a);
|
|
5154
5286
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
5155
5287
|
}
|
|
5156
5288
|
function Hi(a) {
|
|
@@ -5166,12 +5298,12 @@ function wt(a) {
|
|
|
5166
5298
|
});
|
|
5167
5299
|
}
|
|
5168
5300
|
function Dt(a) {
|
|
5169
|
-
const t = Ft(), e = X(a) ?
|
|
5301
|
+
const t = Ft(), e = X(a) ? N(a) : a;
|
|
5170
5302
|
return e.transform !== "none" || e.perspective !== "none" || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((i) => (e.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (e.contain || "").includes(i));
|
|
5171
5303
|
}
|
|
5172
5304
|
function Di(a) {
|
|
5173
5305
|
let t = $(a);
|
|
5174
|
-
for (;
|
|
5306
|
+
for (; K(t) && !Q(t); ) {
|
|
5175
5307
|
if (Dt(t))
|
|
5176
5308
|
return t;
|
|
5177
5309
|
if (wt(t))
|
|
@@ -5186,7 +5318,7 @@ function Ft() {
|
|
|
5186
5318
|
function Q(a) {
|
|
5187
5319
|
return ["html", "body", "#document"].includes(tt(a));
|
|
5188
5320
|
}
|
|
5189
|
-
function
|
|
5321
|
+
function N(a) {
|
|
5190
5322
|
return F(a).getComputedStyle(a);
|
|
5191
5323
|
}
|
|
5192
5324
|
function pt(a) {
|
|
@@ -5212,25 +5344,25 @@ function $(a) {
|
|
|
5212
5344
|
}
|
|
5213
5345
|
function ce(a) {
|
|
5214
5346
|
const t = $(a);
|
|
5215
|
-
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body :
|
|
5347
|
+
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : K(t) && ht(t) ? t : ce(t);
|
|
5216
5348
|
}
|
|
5217
5349
|
function St(a, t, e) {
|
|
5218
5350
|
var i;
|
|
5219
5351
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
5220
5352
|
const s = ce(a), r = s === ((i = a.ownerDocument) == null ? void 0 : i.body), o = F(s);
|
|
5221
5353
|
if (r) {
|
|
5222
|
-
const n =
|
|
5354
|
+
const n = Lt(o);
|
|
5223
5355
|
return t.concat(o, o.visualViewport || [], ht(s) ? s : [], n && e ? St(n) : []);
|
|
5224
5356
|
}
|
|
5225
5357
|
return t.concat(s, St(s, [], e));
|
|
5226
5358
|
}
|
|
5227
|
-
function
|
|
5359
|
+
function Lt(a) {
|
|
5228
5360
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
5229
5361
|
}
|
|
5230
5362
|
function de(a) {
|
|
5231
|
-
const t =
|
|
5363
|
+
const t = N(a);
|
|
5232
5364
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
5233
|
-
const s =
|
|
5365
|
+
const s = K(a), r = s ? a.offsetWidth : e, o = s ? a.offsetHeight : i, n = ft(e) !== r || ft(i) !== o;
|
|
5234
5366
|
return n && (e = r, i = o), {
|
|
5235
5367
|
width: e,
|
|
5236
5368
|
height: i,
|
|
@@ -5242,7 +5374,7 @@ function fe(a) {
|
|
|
5242
5374
|
}
|
|
5243
5375
|
function Z(a) {
|
|
5244
5376
|
const t = fe(a);
|
|
5245
|
-
if (!
|
|
5377
|
+
if (!K(t))
|
|
5246
5378
|
return z(1);
|
|
5247
5379
|
const e = t.getBoundingClientRect(), {
|
|
5248
5380
|
width: i,
|
|
@@ -5274,11 +5406,11 @@ function ot(a, t, e, i) {
|
|
|
5274
5406
|
const n = Xi(r, e, i) ? xe(r) : z(0);
|
|
5275
5407
|
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
5408
|
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 +=
|
|
5409
|
+
const x = F(r), g = i && X(i) ? F(i) : i;
|
|
5410
|
+
let p = x, u = Lt(p);
|
|
5411
|
+
for (; u && i && g !== p; ) {
|
|
5412
|
+
const w = Z(u), y = u.getBoundingClientRect(), C = N(u), m = y.left + (u.clientLeft + parseFloat(C.paddingLeft)) * w.x, E = y.top + (u.clientTop + parseFloat(C.paddingTop)) * w.y;
|
|
5413
|
+
h *= w.x, c *= w.y, d *= w.x, f *= w.y, h += m, c += E, p = F(u), u = Lt(p);
|
|
5282
5414
|
}
|
|
5283
5415
|
}
|
|
5284
5416
|
return ut({
|
|
@@ -5288,7 +5420,7 @@ function ot(a, t, e, i) {
|
|
|
5288
5420
|
y: c
|
|
5289
5421
|
});
|
|
5290
5422
|
}
|
|
5291
|
-
function
|
|
5423
|
+
function Ni(a) {
|
|
5292
5424
|
let {
|
|
5293
5425
|
elements: t,
|
|
5294
5426
|
rect: e,
|
|
@@ -5302,8 +5434,8 @@ function ki(a) {
|
|
|
5302
5434
|
scrollLeft: 0,
|
|
5303
5435
|
scrollTop: 0
|
|
5304
5436
|
}, c = z(1);
|
|
5305
|
-
const d = z(0), f =
|
|
5306
|
-
if ((f || !f && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)),
|
|
5437
|
+
const d = z(0), f = K(i);
|
|
5438
|
+
if ((f || !f && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), K(i))) {
|
|
5307
5439
|
const x = ot(i);
|
|
5308
5440
|
c = Z(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5309
5441
|
}
|
|
@@ -5314,25 +5446,25 @@ function ki(a) {
|
|
|
5314
5446
|
y: e.y * c.y - h.scrollTop * c.y + d.y
|
|
5315
5447
|
};
|
|
5316
5448
|
}
|
|
5317
|
-
function
|
|
5449
|
+
function Bi(a) {
|
|
5318
5450
|
return Array.from(a.getClientRects());
|
|
5319
5451
|
}
|
|
5320
|
-
function
|
|
5452
|
+
function At(a, t) {
|
|
5321
5453
|
const e = pt(a).scrollLeft;
|
|
5322
5454
|
return t ? t.left + e : ot(V(a)).left + e;
|
|
5323
5455
|
}
|
|
5324
|
-
function
|
|
5456
|
+
function ki(a) {
|
|
5325
5457
|
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 +
|
|
5458
|
+
let o = -e.scrollLeft + At(a);
|
|
5327
5459
|
const n = -e.scrollTop;
|
|
5328
|
-
return
|
|
5460
|
+
return N(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
|
|
5329
5461
|
width: s,
|
|
5330
5462
|
height: r,
|
|
5331
5463
|
x: o,
|
|
5332
5464
|
y: n
|
|
5333
5465
|
};
|
|
5334
5466
|
}
|
|
5335
|
-
function
|
|
5467
|
+
function Ki(a, t) {
|
|
5336
5468
|
const e = F(a), i = V(a), s = e.visualViewport;
|
|
5337
5469
|
let r = i.clientWidth, o = i.clientHeight, n = 0, h = 0;
|
|
5338
5470
|
if (s) {
|
|
@@ -5348,7 +5480,7 @@ function Bi(a, t) {
|
|
|
5348
5480
|
};
|
|
5349
5481
|
}
|
|
5350
5482
|
function Yi(a, t) {
|
|
5351
|
-
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, r =
|
|
5483
|
+
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
5484
|
return {
|
|
5353
5485
|
width: o,
|
|
5354
5486
|
height: n,
|
|
@@ -5359,9 +5491,9 @@ function Yi(a, t) {
|
|
|
5359
5491
|
function Gt(a, t, e) {
|
|
5360
5492
|
let i;
|
|
5361
5493
|
if (t === "viewport")
|
|
5362
|
-
i =
|
|
5494
|
+
i = Ki(a, e);
|
|
5363
5495
|
else if (t === "document")
|
|
5364
|
-
i =
|
|
5496
|
+
i = ki(V(a));
|
|
5365
5497
|
else if (X(t))
|
|
5366
5498
|
i = Yi(t, e);
|
|
5367
5499
|
else {
|
|
@@ -5376,17 +5508,17 @@ function Gt(a, t, e) {
|
|
|
5376
5508
|
}
|
|
5377
5509
|
function ue(a, t) {
|
|
5378
5510
|
const e = $(a);
|
|
5379
|
-
return e === t || !X(e) || Q(e) ? !1 :
|
|
5511
|
+
return e === t || !X(e) || Q(e) ? !1 : N(e).position === "fixed" || ue(e, t);
|
|
5380
5512
|
}
|
|
5381
5513
|
function Vi(a, t) {
|
|
5382
5514
|
const e = t.get(a);
|
|
5383
5515
|
if (e)
|
|
5384
5516
|
return e;
|
|
5385
5517
|
let i = St(a, [], !1).filter((n) => X(n) && tt(n) !== "body"), s = null;
|
|
5386
|
-
const r =
|
|
5518
|
+
const r = N(a).position === "fixed";
|
|
5387
5519
|
let o = r ? $(a) : a;
|
|
5388
5520
|
for (; X(o) && !Q(o); ) {
|
|
5389
|
-
const n =
|
|
5521
|
+
const n = N(o), h = Dt(o);
|
|
5390
5522
|
!h && n.position === "fixed" && (s = null), (r ? !h && !s : !h && n.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || ht(o) && !h && ue(a, o)) ? i = i.filter((d) => d !== o) : s = n, o = $(o);
|
|
5391
5523
|
}
|
|
5392
5524
|
return t.set(a, i), i;
|
|
@@ -5420,7 +5552,7 @@ function Pi(a) {
|
|
|
5420
5552
|
};
|
|
5421
5553
|
}
|
|
5422
5554
|
function zi(a, t, e) {
|
|
5423
|
-
const i =
|
|
5555
|
+
const i = K(t), s = V(t), r = e === "fixed", o = ot(a, !0, r, t);
|
|
5424
5556
|
let n = {
|
|
5425
5557
|
scrollLeft: 0,
|
|
5426
5558
|
scrollTop: 0
|
|
@@ -5428,14 +5560,14 @@ function zi(a, t, e) {
|
|
|
5428
5560
|
const h = z(0);
|
|
5429
5561
|
if (i || !i && !r)
|
|
5430
5562
|
if ((tt(t) !== "body" || ht(s)) && (n = pt(t)), i) {
|
|
5431
|
-
const
|
|
5432
|
-
h.x =
|
|
5433
|
-
} else s && (h.x =
|
|
5563
|
+
const g = ot(t, !0, r, t);
|
|
5564
|
+
h.x = g.x + t.clientLeft, h.y = g.y + t.clientTop;
|
|
5565
|
+
} else s && (h.x = At(s));
|
|
5434
5566
|
let c = 0, d = 0;
|
|
5435
5567
|
if (s && !i && !r) {
|
|
5436
|
-
const
|
|
5437
|
-
d =
|
|
5438
|
-
|
|
5568
|
+
const g = s.getBoundingClientRect();
|
|
5569
|
+
d = g.top + n.scrollTop, c = g.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
5570
|
+
At(s, g);
|
|
5439
5571
|
}
|
|
5440
5572
|
const f = o.left + n.scrollLeft - h.x - c, x = o.top + n.scrollTop - h.y - d;
|
|
5441
5573
|
return {
|
|
@@ -5446,10 +5578,10 @@ function zi(a, t, e) {
|
|
|
5446
5578
|
};
|
|
5447
5579
|
}
|
|
5448
5580
|
function mt(a) {
|
|
5449
|
-
return
|
|
5581
|
+
return N(a).position === "static";
|
|
5450
5582
|
}
|
|
5451
5583
|
function qt(a, t) {
|
|
5452
|
-
if (!
|
|
5584
|
+
if (!K(a) || N(a).position === "fixed")
|
|
5453
5585
|
return null;
|
|
5454
5586
|
if (t)
|
|
5455
5587
|
return t(a);
|
|
@@ -5460,7 +5592,7 @@ function ge(a, t) {
|
|
|
5460
5592
|
const e = F(a);
|
|
5461
5593
|
if (wt(a))
|
|
5462
5594
|
return e;
|
|
5463
|
-
if (!
|
|
5595
|
+
if (!K(a)) {
|
|
5464
5596
|
let s = $(a);
|
|
5465
5597
|
for (; s && !Q(s); ) {
|
|
5466
5598
|
if (X(s) && !mt(s))
|
|
@@ -5487,20 +5619,20 @@ const $i = async function(a) {
|
|
|
5487
5619
|
};
|
|
5488
5620
|
};
|
|
5489
5621
|
function Gi(a) {
|
|
5490
|
-
return
|
|
5622
|
+
return N(a).direction === "rtl";
|
|
5491
5623
|
}
|
|
5492
5624
|
const qi = {
|
|
5493
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
5625
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Ni,
|
|
5494
5626
|
getDocumentElement: V,
|
|
5495
5627
|
getClippingRect: Wi,
|
|
5496
5628
|
getOffsetParent: ge,
|
|
5497
5629
|
getElementRects: $i,
|
|
5498
|
-
getClientRects:
|
|
5630
|
+
getClientRects: Bi,
|
|
5499
5631
|
getDimensions: Pi,
|
|
5500
5632
|
getScale: Z,
|
|
5501
5633
|
isElement: X,
|
|
5502
5634
|
isRTL: Gi
|
|
5503
|
-
}, we = Ti, pe = Mi, ye =
|
|
5635
|
+
}, we = Ti, pe = Mi, ye = Li, ji = Si, me = (a, t, e) => {
|
|
5504
5636
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
5505
5637
|
platform: qi,
|
|
5506
5638
|
...e
|
|
@@ -5672,6 +5804,10 @@ class Zi {
|
|
|
5672
5804
|
this.ctx.emit("setMoveFocus", "BOTTOM");
|
|
5673
5805
|
return;
|
|
5674
5806
|
}
|
|
5807
|
+
if (t.code === "Enter" && !this.ctx.editing) {
|
|
5808
|
+
t.preventDefault(), this.startEdit();
|
|
5809
|
+
return;
|
|
5810
|
+
}
|
|
5675
5811
|
const e = t.key, i = t.ctrlKey, s = t.altKey, r = t.shiftKey, o = t.metaKey;
|
|
5676
5812
|
i || s || r || o || [
|
|
5677
5813
|
"Enter",
|
|
@@ -5751,21 +5887,21 @@ class Zi {
|
|
|
5751
5887
|
}
|
|
5752
5888
|
startEditByInput(t, e = !1) {
|
|
5753
5889
|
const i = e ? null : t.getValue(), { editorType: s } = t;
|
|
5754
|
-
this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
5755
|
-
let {
|
|
5756
|
-
this.drawX =
|
|
5890
|
+
t.update(), this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
5891
|
+
let { height: r, width: o, drawY: n, drawX: h } = t;
|
|
5892
|
+
this.drawX = h, this.drawY = n;
|
|
5757
5893
|
const {
|
|
5758
5894
|
config: { CELL_PADDING: c },
|
|
5759
5895
|
header: d
|
|
5760
5896
|
} = this.ctx;
|
|
5761
5897
|
let f = this.ctx.body.visibleHeight;
|
|
5762
|
-
if (
|
|
5763
|
-
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${
|
|
5898
|
+
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") {
|
|
5899
|
+
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
5900
|
const x = this.inputEl.value.length;
|
|
5765
5901
|
this.inputEl.setSelectionRange(x, x);
|
|
5766
5902
|
} else
|
|
5767
5903
|
this.inputEl.style.display = "none";
|
|
5768
|
-
(this.inputEl.scrollHeight >
|
|
5904
|
+
(this.inputEl.scrollHeight > r || this.drawY < d.height) && this.autoSize();
|
|
5769
5905
|
}
|
|
5770
5906
|
doneEditByInput() {
|
|
5771
5907
|
if (this.cellTarget && this.cellTarget.editorType === "text") {
|
|
@@ -5880,7 +6016,7 @@ class Qi {
|
|
|
5880
6016
|
height: `${o}px`
|
|
5881
6017
|
},
|
|
5882
6018
|
cells: c
|
|
5883
|
-
},
|
|
6019
|
+
}, g = {
|
|
5884
6020
|
key: "center",
|
|
5885
6021
|
style: {
|
|
5886
6022
|
position: "absolute",
|
|
@@ -5912,7 +6048,7 @@ class Qi {
|
|
|
5912
6048
|
width: `${r}px`,
|
|
5913
6049
|
height: `${o}px`
|
|
5914
6050
|
},
|
|
5915
|
-
views: [x,
|
|
6051
|
+
views: [x, g, p]
|
|
5916
6052
|
};
|
|
5917
6053
|
}
|
|
5918
6054
|
getBody() {
|
|
@@ -5938,7 +6074,7 @@ class Qi {
|
|
|
5938
6074
|
height: `${d}px`
|
|
5939
6075
|
},
|
|
5940
6076
|
cells: e
|
|
5941
|
-
},
|
|
6077
|
+
}, g = {
|
|
5942
6078
|
key: "center",
|
|
5943
6079
|
style: {
|
|
5944
6080
|
position: "absolute",
|
|
@@ -5970,13 +6106,13 @@ class Qi {
|
|
|
5970
6106
|
width: `${c}px`,
|
|
5971
6107
|
height: `${d}px`
|
|
5972
6108
|
},
|
|
5973
|
-
views: [x,
|
|
6109
|
+
views: [x, g, p]
|
|
5974
6110
|
};
|
|
5975
6111
|
}
|
|
5976
6112
|
getFooter() {
|
|
5977
6113
|
const t = [], e = [], i = [];
|
|
5978
|
-
this.ctx.footer.renderRows.forEach((
|
|
5979
|
-
|
|
6114
|
+
this.ctx.footer.renderRows.forEach((u) => {
|
|
6115
|
+
u.cells.forEach((w) => {
|
|
5980
6116
|
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
6117
|
});
|
|
5982
6118
|
});
|
|
@@ -6006,7 +6142,7 @@ class Qi {
|
|
|
6006
6142
|
height: `${c}px`
|
|
6007
6143
|
},
|
|
6008
6144
|
cells: t
|
|
6009
|
-
},
|
|
6145
|
+
}, g = {
|
|
6010
6146
|
key: "right",
|
|
6011
6147
|
style: {
|
|
6012
6148
|
position: "absolute",
|
|
@@ -6027,7 +6163,7 @@ class Qi {
|
|
|
6027
6163
|
width: `${h}px`,
|
|
6028
6164
|
height: `${c}px`
|
|
6029
6165
|
},
|
|
6030
|
-
views: [f, x,
|
|
6166
|
+
views: [f, x, g]
|
|
6031
6167
|
};
|
|
6032
6168
|
}
|
|
6033
6169
|
}
|
|
@@ -6060,8 +6196,8 @@ class ts {
|
|
|
6060
6196
|
me(x, this.contextMenuEl, {
|
|
6061
6197
|
placement: "right-start",
|
|
6062
6198
|
middleware: [we(), pe(), ye()]
|
|
6063
|
-
}).then(({ x:
|
|
6064
|
-
this.show(
|
|
6199
|
+
}).then(({ x: g, y: p }) => {
|
|
6200
|
+
this.show(g, p);
|
|
6065
6201
|
});
|
|
6066
6202
|
}), 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
6203
|
}
|
|
@@ -6318,12 +6454,12 @@ class ss {
|
|
|
6318
6454
|
setSelectionByRows(t, e = !0) {
|
|
6319
6455
|
t.forEach((i) => {
|
|
6320
6456
|
const s = this.ctx.database.getRowKeyByItem(i);
|
|
6321
|
-
this.ctx.database.setRowSelection(s, e);
|
|
6457
|
+
this.ctx.database.setRowSelection(s, e, !1);
|
|
6322
6458
|
}), this.ctx.emit("selectionChange", this.getSelectionRows()), this.ctx.emit("draw");
|
|
6323
6459
|
}
|
|
6324
6460
|
setSelectionByRowKeys(t, e = !0) {
|
|
6325
6461
|
t.forEach((i) => {
|
|
6326
|
-
this.ctx.database.setRowSelection(i, e);
|
|
6462
|
+
this.ctx.database.setRowSelection(i, e, !1);
|
|
6327
6463
|
}), this.ctx.emit("selectionChange", this.getSelectionRows()), this.ctx.emit("draw");
|
|
6328
6464
|
}
|
|
6329
6465
|
toggleAllSelection() {
|
|
@@ -6358,6 +6494,10 @@ class ss {
|
|
|
6358
6494
|
getSpanObjByColumn: ie
|
|
6359
6495
|
};
|
|
6360
6496
|
}
|
|
6497
|
+
getColumnByKey(t) {
|
|
6498
|
+
var e;
|
|
6499
|
+
return (e = this.ctx.database.getColumnByKey(t)) == null ? void 0 : e.column;
|
|
6500
|
+
}
|
|
6361
6501
|
/**
|
|
6362
6502
|
* 销毁
|
|
6363
6503
|
*/
|