e-virt-table 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1090 -1043
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Autofill.js +4 -4
- package/dist/lib/Autofill.js.map +1 -1
- package/dist/lib/BaseCell.d.ts +2 -2
- package/dist/lib/BaseCell.js +11 -11
- package/dist/lib/BaseCell.js.map +1 -1
- package/dist/lib/Body.js +25 -18
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Cell.js +8 -4
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.js +3 -3
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Context.d.ts +13 -4
- package/dist/lib/Context.js +34 -11
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/ContextMenu.js +1 -1
- package/dist/lib/ContextMenu.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +1 -2
- package/dist/lib/EVirtTable.js +22 -18
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.d.ts +1 -0
- package/dist/lib/Editor.js +37 -21
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/Empty.js +1 -1
- package/dist/lib/Empty.js.map +1 -1
- package/dist/lib/EventBrowser.d.ts +1 -3
- package/dist/lib/EventBrowser.js +7 -7
- package/dist/lib/EventBrowser.js.map +1 -1
- package/dist/lib/EventTable.js +10 -12
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/Footer.js +4 -4
- package/dist/lib/Footer.js.map +1 -1
- package/dist/lib/Header.js +17 -14
- package/dist/lib/Header.js.map +1 -1
- package/dist/lib/Overlayer.js +5 -5
- package/dist/lib/Overlayer.js.map +1 -1
- package/dist/lib/Paint.d.ts +1 -0
- package/dist/lib/Paint.js +7 -4
- package/dist/lib/Paint.js.map +1 -1
- package/dist/lib/Scroller.js +8 -8
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.js +10 -6
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/Tooltip.js +3 -3
- package/dist/lib/Tooltip.js.map +1 -1
- package/dist/lib/types.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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:
|
|
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;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}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;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:10}.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
2
|
var me = Object.defineProperty;
|
|
3
3
|
var Ee = (n, t, e) => t in n ? me(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
4
|
-
var
|
|
4
|
+
var c = (n, t, e) => Ee(n, typeof t != "symbol" ? t + "" : t, e);
|
|
5
5
|
function $() {
|
|
6
6
|
return $ = Object.assign ? Object.assign.bind() : function(n) {
|
|
7
7
|
for (var t = 1; t < arguments.length; t++) {
|
|
@@ -12,7 +12,7 @@ function $() {
|
|
|
12
12
|
return n;
|
|
13
13
|
}, $.apply(this, arguments);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function be(n, t) {
|
|
16
16
|
n.prototype = Object.create(t.prototype), n.prototype.constructor = n, st(n, t);
|
|
17
17
|
}
|
|
18
18
|
function Et(n) {
|
|
@@ -25,7 +25,7 @@ function st(n, t) {
|
|
|
25
25
|
return i.__proto__ = s, i;
|
|
26
26
|
}, st(n, t);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Ce() {
|
|
29
29
|
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
30
30
|
if (typeof Proxy == "function") return !0;
|
|
31
31
|
try {
|
|
@@ -36,19 +36,19 @@ function be() {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
function dt(n, t, e) {
|
|
39
|
-
return
|
|
39
|
+
return Ce() ? dt = Reflect.construct.bind() : dt = function(s, r, o) {
|
|
40
40
|
var a = [null];
|
|
41
41
|
a.push.apply(a, r);
|
|
42
|
-
var
|
|
42
|
+
var h = Function.bind.apply(s, a), l = new h();
|
|
43
43
|
return o && st(l, o.prototype), l;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
46
46
|
function ve(n) {
|
|
47
47
|
return Function.toString.call(n).indexOf("[native code]") !== -1;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function bt(n) {
|
|
50
50
|
var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
51
|
-
return
|
|
51
|
+
return bt = function(i) {
|
|
52
52
|
if (i === null || !ve(i)) return i;
|
|
53
53
|
if (typeof i != "function")
|
|
54
54
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -67,16 +67,16 @@ function Ct(n) {
|
|
|
67
67
|
configurable: !0
|
|
68
68
|
}
|
|
69
69
|
}), st(s, i);
|
|
70
|
-
},
|
|
70
|
+
}, bt(n);
|
|
71
71
|
}
|
|
72
|
-
var Re = /%[sdj%]/g,
|
|
72
|
+
var Re = /%[sdj%]/g, Jt = function() {
|
|
73
73
|
};
|
|
74
|
-
typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (
|
|
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 Ct(n) {
|
|
80
80
|
if (!n || !n.length) return null;
|
|
81
81
|
var t = {};
|
|
82
82
|
return n.forEach(function(e) {
|
|
@@ -131,7 +131,7 @@ function Ie(n, t, e) {
|
|
|
131
131
|
t(a, o);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Yt(n, t, e) {
|
|
135
135
|
var i = 0, s = n.length;
|
|
136
136
|
function r(o) {
|
|
137
137
|
if (o && o.length) {
|
|
@@ -149,34 +149,34 @@ function Oe(n) {
|
|
|
149
149
|
t.push.apply(t, n[e] || []);
|
|
150
150
|
}), t;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
153
|
-
|
|
152
|
+
var Kt = /* @__PURE__ */ function(n) {
|
|
153
|
+
be(t, n);
|
|
154
154
|
function t(e, i) {
|
|
155
155
|
var s;
|
|
156
156
|
return s = n.call(this, "Async Validation Error") || this, s.errors = e, s.fields = i, s;
|
|
157
157
|
}
|
|
158
158
|
return t;
|
|
159
|
-
}(/* @__PURE__ */
|
|
159
|
+
}(/* @__PURE__ */ bt(Error));
|
|
160
160
|
function Te(n, t, e, i, s) {
|
|
161
161
|
if (t.first) {
|
|
162
162
|
var r = new Promise(function(x, u) {
|
|
163
|
-
var
|
|
164
|
-
return i(y), y.length ? u(new
|
|
165
|
-
},
|
|
166
|
-
|
|
163
|
+
var g = function(y) {
|
|
164
|
+
return i(y), y.length ? u(new Kt(y, Ct(y))) : x(s);
|
|
165
|
+
}, w = Oe(n);
|
|
166
|
+
Yt(w, e, g);
|
|
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(n) : t.firstFields || [], a = Object.keys(n),
|
|
173
|
-
var
|
|
174
|
-
if (f.push.apply(f,
|
|
175
|
-
return i(f), f.length ? u(new
|
|
172
|
+
var o = t.firstFields === !0 ? Object.keys(n) : t.firstFields || [], a = Object.keys(n), h = a.length, l = 0, f = [], d = new Promise(function(x, u) {
|
|
173
|
+
var g = function(p) {
|
|
174
|
+
if (f.push.apply(f, p), l++, l === h)
|
|
175
|
+
return i(f), f.length ? u(new Kt(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
|
-
a.length || (i(f), x(s)), a.forEach(function(
|
|
178
|
-
var
|
|
179
|
-
o.indexOf(
|
|
177
|
+
a.length || (i(f), x(s)), a.forEach(function(w) {
|
|
178
|
+
var p = n[w];
|
|
179
|
+
o.indexOf(w) !== -1 ? Yt(p, e, g) : Ie(p, e, g);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
return d.catch(function(x) {
|
|
@@ -194,7 +194,7 @@ function Ae(n, t) {
|
|
|
194
194
|
}
|
|
195
195
|
return e;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Bt(n, t) {
|
|
198
198
|
return function(e) {
|
|
199
199
|
var i;
|
|
200
200
|
return n.fullFields ? i = Ae(t, n.fullFields) : i = t[e.field || n.fullField], Se(e) ? (e.field = e.field || n.fullField, e.fieldValue = i, e) : {
|
|
@@ -204,7 +204,7 @@ function kt(n, t) {
|
|
|
204
204
|
};
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Wt(n, t) {
|
|
208
208
|
if (t) {
|
|
209
209
|
for (var e in t)
|
|
210
210
|
if (t.hasOwnProperty(e)) {
|
|
@@ -214,7 +214,7 @@ function Nt(n, t) {
|
|
|
214
214
|
}
|
|
215
215
|
return n;
|
|
216
216
|
}
|
|
217
|
-
var
|
|
217
|
+
var Qt = function(t, e, i, s, r, o) {
|
|
218
218
|
t.required && (!i.hasOwnProperty(t.field) || _(e, o || t.type)) && s.push(M(r.messages.required, t.fullField));
|
|
219
219
|
}, Le = function(t, e, i, s, r) {
|
|
220
220
|
(/^\s+$/.test(e) || e === "") && s.push(M(r.messages.whitespace, t.fullField));
|
|
@@ -234,17 +234,17 @@ var jt = 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 + "$"), a = new RegExp("^" + s + "$"),
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), a = new RegExp("^" + s + "$"), h = function(E) {
|
|
238
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 ? a : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var l = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d =
|
|
246
|
-
return lt = new RegExp("(?:^" +
|
|
247
|
-
},
|
|
245
|
+
var l = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d = h.v4().source, x = h.v6().source, u = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", g = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", w = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", p = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?', b = "(?:" + l + "|www\\.)" + f + "(?:localhost|" + d + "|" + x + "|" + u + g + w + ")" + p + y;
|
|
246
|
+
return lt = new RegExp("(?:^" + b + "$)", "i"), lt;
|
|
247
|
+
}, Pt = {
|
|
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,26 +284,26 @@ var jt = 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(Pt.email);
|
|
288
288
|
},
|
|
289
289
|
url: function(t) {
|
|
290
290
|
return typeof t == "string" && t.length <= 2048 && !!t.match(Me());
|
|
291
291
|
},
|
|
292
292
|
hex: function(t) {
|
|
293
|
-
return typeof t == "string" && !!t.match(
|
|
293
|
+
return typeof t == "string" && !!t.match(Pt.hex);
|
|
294
294
|
}
|
|
295
295
|
}, He = function(t, e, i, s, r) {
|
|
296
296
|
if (t.required && e === void 0) {
|
|
297
|
-
|
|
297
|
+
Qt(t, e, i, s, r);
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], a = t.type;
|
|
301
301
|
o.indexOf(a) > -1 ? et[a](e) || s.push(M(r.messages.types[a], t.fullField, t.type)) : a && typeof e !== t.type && s.push(M(r.messages.types[a], t.fullField, t.type));
|
|
302
302
|
}, De = function(t, e, i, s, r) {
|
|
303
|
-
var o = typeof t.len == "number", a = typeof t.min == "number",
|
|
304
|
-
if (x ? d = "number" : u ? d = "string" :
|
|
303
|
+
var o = typeof t.len == "number", a = typeof t.min == "number", h = typeof t.max == "number", l = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, f = e, d = null, x = typeof e == "number", u = typeof e == "string", g = Array.isArray(e);
|
|
304
|
+
if (x ? d = "number" : u ? d = "string" : g && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
|
-
|
|
306
|
+
g && (f = e.length), u && (f = e.replace(l, "_").length), o ? f !== t.len && s.push(M(r.messages[d].len, t.fullField, t.len)) : a && !h && f < t.min ? s.push(M(r.messages[d].min, t.fullField, t.min)) : h && !a && f > t.max ? s.push(M(r.messages[d].max, t.fullField, t.max)) : a && h && (f < t.min || f > t.max) && s.push(M(r.messages[d].range, t.fullField, t.min, t.max));
|
|
307
307
|
}, j = "enum", Xe = function(t, e, i, s, r) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(M(r.messages[j], t.fullField, t[j].join(", ")));
|
|
309
309
|
}, Fe = function(t, e, i, s, r) {
|
|
@@ -316,7 +316,7 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}, v = {
|
|
319
|
-
required:
|
|
319
|
+
required: Qt,
|
|
320
320
|
whitespace: Le,
|
|
321
321
|
type: He,
|
|
322
322
|
range: De,
|
|
@@ -416,8 +416,8 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
416
416
|
if (_(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
418
|
if (v.required(t, e, s, o, r), !_(e, "date")) {
|
|
419
|
-
var
|
|
420
|
-
e instanceof Date ?
|
|
419
|
+
var h;
|
|
420
|
+
e instanceof Date ? h = e : h = new Date(e), v.type(t, h, s, o, r), h && v.range(t, h.getTime(), s, o, r);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
i(o);
|
|
@@ -425,8 +425,8 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
425
425
|
var o = [], a = Array.isArray(e) ? "array" : typeof e;
|
|
426
426
|
v.required(t, e, s, o, r, a), i(o);
|
|
427
427
|
}, yt = function(t, e, i, s, r) {
|
|
428
|
-
var o = t.type, a = [],
|
|
429
|
-
if (
|
|
428
|
+
var o = t.type, a = [], h = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (h) {
|
|
430
430
|
if (_(e, o) && !t.required)
|
|
431
431
|
return i();
|
|
432
432
|
v.required(t, e, s, a, r, o), _(e, o) || v.type(t, e, s, a, r);
|
|
@@ -528,105 +528,105 @@ 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 = Wt(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() {
|
|
535
535
|
});
|
|
536
|
-
var a = i,
|
|
537
|
-
if (typeof
|
|
536
|
+
var a = i, h = s, l = r;
|
|
537
|
+
if (typeof h == "function" && (l = h, h = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
538
|
return l && l(null, a), Promise.resolve(a);
|
|
539
|
-
function f(
|
|
540
|
-
var
|
|
541
|
-
function
|
|
539
|
+
function f(w) {
|
|
540
|
+
var p = [], y = {};
|
|
541
|
+
function b(E) {
|
|
542
542
|
if (Array.isArray(E)) {
|
|
543
|
-
var
|
|
544
|
-
|
|
543
|
+
var C;
|
|
544
|
+
p = (C = p).concat.apply(C, E);
|
|
545
545
|
} else
|
|
546
|
-
|
|
546
|
+
p.push(E);
|
|
547
547
|
}
|
|
548
|
-
for (var m = 0; m <
|
|
549
|
-
|
|
550
|
-
|
|
548
|
+
for (var m = 0; m < w.length; m++)
|
|
549
|
+
b(w[m]);
|
|
550
|
+
p.length ? (y = Ct(p), l(p, y)) : l(null, a);
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
552
|
+
if (h.messages) {
|
|
553
553
|
var d = this.messages();
|
|
554
|
-
d === Rt && (d = vt()),
|
|
554
|
+
d === Rt && (d = vt()), Wt(d, h.messages), h.messages = d;
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
var x = {}, u =
|
|
558
|
-
u.forEach(function(
|
|
559
|
-
var
|
|
560
|
-
|
|
561
|
-
var m =
|
|
562
|
-
typeof m.transform == "function" && (a === i && (a = $({}, a)), y = a[
|
|
556
|
+
h.messages = this.messages();
|
|
557
|
+
var x = {}, u = h.keys || Object.keys(this.rules);
|
|
558
|
+
u.forEach(function(w) {
|
|
559
|
+
var p = o.rules[w], y = a[w];
|
|
560
|
+
p.forEach(function(b) {
|
|
561
|
+
var m = b;
|
|
562
|
+
typeof m.transform == "function" && (a === i && (a = $({}, a)), y = a[w] = m.transform(y)), typeof m == "function" ? m = {
|
|
563
563
|
validator: m
|
|
564
|
-
} : m = $({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field =
|
|
564
|
+
} : m = $({}, m), m.validator = o.getValidationMethod(m), m.validator && (m.field = w, m.fullField = m.fullField || w, m.type = o.getType(m), x[w] = x[w] || [], x[w].push({
|
|
565
565
|
rule: m,
|
|
566
566
|
value: y,
|
|
567
567
|
source: a,
|
|
568
|
-
field:
|
|
568
|
+
field: w
|
|
569
569
|
}));
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
|
-
var
|
|
573
|
-
return Te(x,
|
|
574
|
-
var y =
|
|
575
|
-
|
|
576
|
-
function m(R,
|
|
577
|
-
return $({},
|
|
572
|
+
var g = {};
|
|
573
|
+
return Te(x, h, function(w, p) {
|
|
574
|
+
var y = w.rule, b = (y.type === "object" || y.type === "array") && (typeof y.fields == "object" || typeof y.defaultField == "object");
|
|
575
|
+
b = b && (y.required || !y.required && w.value), y.field = w.field;
|
|
576
|
+
function m(R, T) {
|
|
577
|
+
return $({}, T, {
|
|
578
578
|
fullField: y.fullField + "." + R,
|
|
579
579
|
fullFields: y.fullFields ? [].concat(y.fullFields, [R]) : [R]
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
582
|
function E(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
|
-
var
|
|
585
|
-
!
|
|
586
|
-
var A =
|
|
587
|
-
if (
|
|
588
|
-
return
|
|
589
|
-
if (!
|
|
590
|
-
|
|
584
|
+
var T = Array.isArray(R) ? R : [R];
|
|
585
|
+
!h.suppressWarning && T.length && n.warning("async-validator:", T), T.length && y.message !== void 0 && (T = [].concat(y.message));
|
|
586
|
+
var A = T.map(Bt(y, a));
|
|
587
|
+
if (h.first && A.length)
|
|
588
|
+
return g[y.field] = 1, p(A);
|
|
589
|
+
if (!b)
|
|
590
|
+
p(A);
|
|
591
591
|
else {
|
|
592
|
-
if (y.required && !
|
|
593
|
-
return y.message !== void 0 ? A = [].concat(y.message).map(
|
|
592
|
+
if (y.required && !w.value)
|
|
593
|
+
return y.message !== void 0 ? A = [].concat(y.message).map(Bt(y, a)) : h.error && (A = [h.error(y, M(h.messages.required, y.field))]), p(A);
|
|
594
594
|
var L = {};
|
|
595
|
-
y.defaultField && Object.keys(
|
|
595
|
+
y.defaultField && Object.keys(w.value).map(function(I) {
|
|
596
596
|
L[I] = y.defaultField;
|
|
597
|
-
}), L = $({}, L,
|
|
597
|
+
}), L = $({}, L, w.rule.fields);
|
|
598
598
|
var D = {};
|
|
599
599
|
Object.keys(L).forEach(function(I) {
|
|
600
|
-
var
|
|
600
|
+
var S = L[I], O = Array.isArray(S) ? S : [S];
|
|
601
601
|
D[I] = O.map(m.bind(null, I));
|
|
602
602
|
});
|
|
603
603
|
var B = new n(D);
|
|
604
|
-
B.messages(
|
|
605
|
-
var
|
|
606
|
-
A && A.length &&
|
|
604
|
+
B.messages(h.messages), w.rule.options && (w.rule.options.messages = h.messages, w.rule.options.error = h.error), B.validate(w.value, w.rule.options || h, function(I) {
|
|
605
|
+
var S = [];
|
|
606
|
+
A && A.length && S.push.apply(S, A), I && I.length && S.push.apply(S, I), p(S.length ? S : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
var
|
|
610
|
+
var C;
|
|
611
611
|
if (y.asyncValidator)
|
|
612
|
-
|
|
612
|
+
C = y.asyncValidator(y, w.value, E, w.source, h);
|
|
613
613
|
else if (y.validator) {
|
|
614
614
|
try {
|
|
615
|
-
|
|
615
|
+
C = y.validator(y, w.value, E, w.source, h);
|
|
616
616
|
} catch (R) {
|
|
617
|
-
console.error == null || console.error(R),
|
|
617
|
+
console.error == null || console.error(R), h.suppressValidatorError || setTimeout(function() {
|
|
618
618
|
throw R;
|
|
619
619
|
}, 0), E(R.message);
|
|
620
620
|
}
|
|
621
|
-
|
|
621
|
+
C === !0 ? E() : C === !1 ? E(typeof y.message == "function" ? y.message(y.fullField || y.field) : y.message || (y.fullField || y.field) + " fails") : C instanceof Array ? E(C) : C instanceof Error && E(C.message);
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
C && C.then && C.then(function() {
|
|
624
624
|
return E();
|
|
625
625
|
}, function(R) {
|
|
626
626
|
return E(R);
|
|
627
627
|
});
|
|
628
|
-
}, function(
|
|
629
|
-
f(
|
|
628
|
+
}, function(w) {
|
|
629
|
+
f(w);
|
|
630
630
|
}, a);
|
|
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))
|
|
@@ -644,16 +644,16 @@ nt.register = function(t, e) {
|
|
|
644
644
|
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
645
645
|
it[t] = e;
|
|
646
646
|
};
|
|
647
|
-
nt.warning =
|
|
647
|
+
nt.warning = Jt;
|
|
648
648
|
nt.messages = Rt;
|
|
649
649
|
nt.validators = it;
|
|
650
|
-
function
|
|
650
|
+
function te() {
|
|
651
651
|
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(n) {
|
|
652
652
|
const t = Math.random() * 16 | 0;
|
|
653
653
|
return (n === "x" ? t : t & 3 | 8).toString(16);
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
|
-
function
|
|
656
|
+
function ee(n, t) {
|
|
657
657
|
let e = 0, i;
|
|
658
658
|
return function(...s) {
|
|
659
659
|
const r = (/* @__PURE__ */ new Date()).getTime(), o = r - e;
|
|
@@ -662,8 +662,8 @@ function Zt(n, t) {
|
|
|
662
662
|
}, t - o));
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
|
-
function
|
|
666
|
-
return n ? n.map((t) =>
|
|
665
|
+
function ie(n) {
|
|
666
|
+
return n ? n.map((t) => ie(t.children) + 1).sort((t, e) => e - t)[0] : 0;
|
|
667
667
|
}
|
|
668
668
|
function Je(n = []) {
|
|
669
669
|
let t = [], e = [], i = [];
|
|
@@ -675,14 +675,14 @@ function Je(n = []) {
|
|
|
675
675
|
...i.sort((s, r) => s.sort - r.sort)
|
|
676
676
|
];
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function se(n = [], t = 1, e = 0) {
|
|
679
679
|
return n.map((i) => {
|
|
680
680
|
if (i.children) {
|
|
681
681
|
let s = 0, r = i.fixed;
|
|
682
682
|
i.children.forEach((a) => {
|
|
683
683
|
a.fixed = r;
|
|
684
684
|
});
|
|
685
|
-
const o =
|
|
685
|
+
const o = se(i.children, t - 1, e + 1);
|
|
686
686
|
return o && o.forEach((a) => {
|
|
687
687
|
s += a.colspan;
|
|
688
688
|
}), {
|
|
@@ -708,26 +708,26 @@ function _t(n = []) {
|
|
|
708
708
|
e.children ? t = t.concat(_t(e.children)) : t.push(e);
|
|
709
709
|
}), t;
|
|
710
710
|
}
|
|
711
|
-
const
|
|
711
|
+
const Vt = /^(\r\n|\n\r|\r|\n)/, Qe = /^[^\t\r\n]+/, zt = /^\t/;
|
|
712
712
|
function ti(n) {
|
|
713
713
|
let t = [[""]];
|
|
714
714
|
if (n.length === 0)
|
|
715
715
|
return t;
|
|
716
716
|
let e = 0, i = 0, s;
|
|
717
717
|
for (; n.length > 0 && s !== n.length; )
|
|
718
|
-
if (s = n.length, n.match(
|
|
719
|
-
n = n.replace(
|
|
720
|
-
else if (n.match(
|
|
721
|
-
n = n.replace(
|
|
718
|
+
if (s = n.length, n.match(zt))
|
|
719
|
+
n = n.replace(zt, ""), e += 1, t[i][e] = "";
|
|
720
|
+
else if (n.match(Vt))
|
|
721
|
+
n = n.replace(Vt, ""), e = 0, i += 1, t[i] = [""];
|
|
722
722
|
else {
|
|
723
723
|
let r = "";
|
|
724
724
|
if (n.startsWith('"')) {
|
|
725
725
|
let o = 0, a = !0;
|
|
726
726
|
for (; a; ) {
|
|
727
|
-
const
|
|
728
|
-
|
|
727
|
+
const h = n.slice(0, 1);
|
|
728
|
+
h === '"' && (o += 1), r += h, n = n.slice(1), (n.length === 0 || n.match(/^[\t\r\n]/) && o % 2 === 0) && (a = !1);
|
|
729
729
|
}
|
|
730
|
-
r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (
|
|
730
|
+
r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (h) => new Array(Math.floor(h.length / 2)).fill('"').join(""));
|
|
731
731
|
} else {
|
|
732
732
|
const o = n.match(Qe);
|
|
733
733
|
r = o ? o[0] : "", n = n.slice(r.length);
|
|
@@ -750,24 +750,24 @@ function ei(n) {
|
|
|
750
750
|
class ii {
|
|
751
751
|
//虚拟滚动位置
|
|
752
752
|
constructor(t, e) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
753
|
+
c(this, "loading", !1);
|
|
754
|
+
c(this, "ctx");
|
|
755
|
+
c(this, "data");
|
|
756
|
+
c(this, "columns");
|
|
757
|
+
c(this, "footerData", []);
|
|
758
|
+
c(this, "rowKeyMap", /* @__PURE__ */ new Map());
|
|
759
|
+
c(this, "colIndexKeyMap", /* @__PURE__ */ new Map());
|
|
760
|
+
c(this, "headerMap", /* @__PURE__ */ new Map());
|
|
761
|
+
c(this, "rowIndexRowKeyMap", /* @__PURE__ */ new Map());
|
|
762
|
+
c(this, "checkboxKeyMap", /* @__PURE__ */ new Map());
|
|
763
|
+
c(this, "originalDataMap", /* @__PURE__ */ new Map());
|
|
764
|
+
c(this, "changedDataMap", /* @__PURE__ */ new Map());
|
|
765
|
+
c(this, "validationErrorMap", /* @__PURE__ */ new Map());
|
|
766
|
+
c(this, "itemRowKeyMap", /* @__PURE__ */ new WeakMap());
|
|
767
|
+
c(this, "bufferData", []);
|
|
768
|
+
c(this, "sumHeight", 0);
|
|
769
|
+
c(this, "filterMethod");
|
|
770
|
+
c(this, "positions", []);
|
|
771
771
|
this.ctx = t;
|
|
772
772
|
const { data: i = [], columns: s = [], footerData: r = [] } = e;
|
|
773
773
|
this.data = i, this.footerData = r, this.columns = s, this.setLoading(!0), this.init();
|
|
@@ -790,26 +790,26 @@ class ii {
|
|
|
790
790
|
t.forEach((i, s) => {
|
|
791
791
|
let r = !1;
|
|
792
792
|
Array.isArray(i.children) && (r = !0, this.initData(i.children, e + 1));
|
|
793
|
-
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT:
|
|
793
|
+
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT: h, SELECTABLE_METHOD: l, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d ?? te();
|
|
794
794
|
this.itemRowKeyMap.set(i, x);
|
|
795
|
-
const u = i._height ||
|
|
796
|
-
let
|
|
797
|
-
if (typeof l == "function" && (
|
|
798
|
-
const
|
|
799
|
-
if (this.checkboxKeyMap.has(
|
|
800
|
-
const y = this.checkboxKeyMap.get(
|
|
801
|
-
y.push(x), this.checkboxKeyMap.set(
|
|
795
|
+
const u = i._height || h, g = i._readonly;
|
|
796
|
+
let w = !0;
|
|
797
|
+
if (typeof l == "function" && (w = l), f) {
|
|
798
|
+
const p = i[f];
|
|
799
|
+
if (this.checkboxKeyMap.has(p)) {
|
|
800
|
+
const y = this.checkboxKeyMap.get(p);
|
|
801
|
+
y.push(x), this.checkboxKeyMap.set(p, y);
|
|
802
802
|
} else
|
|
803
|
-
this.checkboxKeyMap.set(
|
|
803
|
+
this.checkboxKeyMap.set(p, [x]);
|
|
804
804
|
}
|
|
805
805
|
this.rowKeyMap.set(x, {
|
|
806
|
-
readonly:
|
|
806
|
+
readonly: g,
|
|
807
807
|
index: s,
|
|
808
808
|
rowIndex: s,
|
|
809
809
|
level: e,
|
|
810
810
|
height: u,
|
|
811
811
|
check: !1,
|
|
812
|
-
selectable:
|
|
812
|
+
selectable: w,
|
|
813
813
|
expand: a,
|
|
814
814
|
expandLazy: !1,
|
|
815
815
|
hasChildren: r,
|
|
@@ -874,12 +874,12 @@ class ii {
|
|
|
874
874
|
const i = (r) => {
|
|
875
875
|
r.forEach((o) => {
|
|
876
876
|
t.push(o);
|
|
877
|
-
const a = this.itemRowKeyMap.get(o), { expand:
|
|
877
|
+
const a = this.itemRowKeyMap.get(o), { expand: h, hasChildren: l, height: f } = this.rowKeyMap.get(a), d = this.sumHeight;
|
|
878
878
|
this.sumHeight += f, this.rowIndexRowKeyMap.set(e, a), this.positions.push({
|
|
879
879
|
top: d,
|
|
880
880
|
height: f,
|
|
881
881
|
bottom: this.sumHeight
|
|
882
|
-
}), e += 1,
|
|
882
|
+
}), e += 1, h && l && i(o.children);
|
|
883
883
|
});
|
|
884
884
|
};
|
|
885
885
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -1002,7 +1002,7 @@ class ii {
|
|
|
1002
1002
|
let i = [];
|
|
1003
1003
|
const s = /* @__PURE__ */ new Set();
|
|
1004
1004
|
t.forEach((a) => {
|
|
1005
|
-
const { value:
|
|
1005
|
+
const { value: h, rowKey: l, key: f } = a, { oldValue: d, newValue: x } = this.setItemValue(l, f, h);
|
|
1006
1006
|
s.add(l), i.push({
|
|
1007
1007
|
rowKey: l,
|
|
1008
1008
|
key: f,
|
|
@@ -1012,12 +1012,12 @@ class ii {
|
|
|
1012
1012
|
});
|
|
1013
1013
|
let r = [];
|
|
1014
1014
|
const o = i.map((a) => {
|
|
1015
|
-
const
|
|
1015
|
+
const h = this.ctx.database.getRowDataItemForRowKey(a.rowKey);
|
|
1016
1016
|
return {
|
|
1017
1017
|
rowKey: a.rowKey,
|
|
1018
1018
|
key: a.key,
|
|
1019
1019
|
value: a.newValue,
|
|
1020
|
-
row:
|
|
1020
|
+
row: h
|
|
1021
1021
|
};
|
|
1022
1022
|
});
|
|
1023
1023
|
return s.forEach((a) => {
|
|
@@ -1043,15 +1043,15 @@ class ii {
|
|
|
1043
1043
|
if (!this.rowKeyMap.has(t))
|
|
1044
1044
|
return {};
|
|
1045
1045
|
const { item: a } = this.rowKeyMap.get(t);
|
|
1046
|
-
let
|
|
1046
|
+
let h = a[e];
|
|
1047
1047
|
if (this.ctx.database.getReadonly(t, e))
|
|
1048
1048
|
return {
|
|
1049
|
-
oldValue:
|
|
1050
|
-
newValue:
|
|
1049
|
+
oldValue: h,
|
|
1050
|
+
newValue: h
|
|
1051
1051
|
};
|
|
1052
|
-
a[e] !== null && typeof a[e] == "object" && (
|
|
1052
|
+
a[e] !== null && typeof a[e] == "object" && (h = JSON.parse(JSON.stringify(a[e])));
|
|
1053
1053
|
const l = `${t}_${e}`;
|
|
1054
|
-
if (this.originalDataMap.has(l) || this.originalDataMap.set(l,
|
|
1054
|
+
if (this.originalDataMap.has(l) || this.originalDataMap.set(l, h), this.changedDataMap.set(l, i), a[e] = i, o) {
|
|
1055
1055
|
const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
|
|
1056
1056
|
rowKey: t,
|
|
1057
1057
|
key: e,
|
|
@@ -1061,7 +1061,7 @@ class ii {
|
|
|
1061
1061
|
this.ctx.emit("change", [d], [f]), this.ctx.emit("editChange", {
|
|
1062
1062
|
rowKey: t,
|
|
1063
1063
|
key: e,
|
|
1064
|
-
oldValue:
|
|
1064
|
+
oldValue: h,
|
|
1065
1065
|
value: i,
|
|
1066
1066
|
originalValue: this.originalDataMap.get(l),
|
|
1067
1067
|
row: f
|
|
@@ -1070,7 +1070,7 @@ class ii {
|
|
|
1070
1070
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1071
1071
|
rowKey: t,
|
|
1072
1072
|
key: e,
|
|
1073
|
-
oldValue:
|
|
1073
|
+
oldValue: h,
|
|
1074
1074
|
value: i,
|
|
1075
1075
|
originalValue: this.originalDataMap.get(l),
|
|
1076
1076
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
@@ -1082,12 +1082,12 @@ class ii {
|
|
|
1082
1082
|
{
|
|
1083
1083
|
rowKey: t,
|
|
1084
1084
|
key: e,
|
|
1085
|
-
oldValue:
|
|
1085
|
+
oldValue: h,
|
|
1086
1086
|
newValue: i
|
|
1087
1087
|
}
|
|
1088
1088
|
]
|
|
1089
1089
|
}), r && this.ctx.emit("draw"), {
|
|
1090
|
-
oldValue:
|
|
1090
|
+
oldValue: h,
|
|
1091
1091
|
newValue: i
|
|
1092
1092
|
};
|
|
1093
1093
|
}
|
|
@@ -1114,8 +1114,8 @@ class ii {
|
|
|
1114
1114
|
return !1;
|
|
1115
1115
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1116
1116
|
this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((a) => {
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1117
|
+
const h = this.rowKeyMap.get(a);
|
|
1118
|
+
h.check = e;
|
|
1119
1119
|
});
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
@@ -1295,7 +1295,7 @@ class ii {
|
|
|
1295
1295
|
getValidator(t, e) {
|
|
1296
1296
|
return new Promise((i) => {
|
|
1297
1297
|
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { CELL_RULES_METHOD: o } = this.ctx.config, a = r.column;
|
|
1298
|
-
let
|
|
1298
|
+
let h = a.rules;
|
|
1299
1299
|
if (typeof o == "function") {
|
|
1300
1300
|
const f = o({
|
|
1301
1301
|
row: s.item,
|
|
@@ -1304,12 +1304,12 @@ class ii {
|
|
|
1304
1304
|
column: a,
|
|
1305
1305
|
value: this.getItemValue(t, e)
|
|
1306
1306
|
});
|
|
1307
|
-
f && (
|
|
1307
|
+
f && (h = f);
|
|
1308
1308
|
}
|
|
1309
|
-
if (
|
|
1309
|
+
if (h) {
|
|
1310
1310
|
let l = {}, f = {};
|
|
1311
|
-
if (f[e] = this.getItemValue(t, e), Array.isArray(
|
|
1312
|
-
const x =
|
|
1311
|
+
if (f[e] = this.getItemValue(t, e), Array.isArray(h) && h.length) {
|
|
1312
|
+
const x = h.map((u) => ({
|
|
1313
1313
|
...u,
|
|
1314
1314
|
row: s.item,
|
|
1315
1315
|
column: a,
|
|
@@ -1319,7 +1319,7 @@ class ii {
|
|
|
1319
1319
|
l[e] = x;
|
|
1320
1320
|
} else
|
|
1321
1321
|
l[e] = {
|
|
1322
|
-
...
|
|
1322
|
+
...h,
|
|
1323
1323
|
row: s.item,
|
|
1324
1324
|
column: a,
|
|
1325
1325
|
rowIndex: s.rowIndex,
|
|
@@ -1328,8 +1328,8 @@ class ii {
|
|
|
1328
1328
|
new nt(l).validate(f).then(() => {
|
|
1329
1329
|
this.setValidationError(t, e, []), i([]);
|
|
1330
1330
|
}).catch(({ errors: x }) => {
|
|
1331
|
-
const u = x.map((
|
|
1332
|
-
...
|
|
1331
|
+
const u = x.map((g) => ({
|
|
1332
|
+
...g,
|
|
1333
1333
|
column: a,
|
|
1334
1334
|
key: e,
|
|
1335
1335
|
row: s.item,
|
|
@@ -1374,9 +1374,9 @@ class ii {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
class si {
|
|
1376
1376
|
constructor(t) {
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1377
|
+
c(this, "ctx");
|
|
1378
|
+
c(this, "history", []);
|
|
1379
|
+
c(this, "historyIndex", -1);
|
|
1380
1380
|
this.ctx = t, this.init();
|
|
1381
1381
|
}
|
|
1382
1382
|
init() {
|
|
@@ -1431,12 +1431,12 @@ class si {
|
|
|
1431
1431
|
}
|
|
1432
1432
|
class ri {
|
|
1433
1433
|
constructor(t) {
|
|
1434
|
-
|
|
1435
|
-
|
|
1434
|
+
c(this, "eventTasks", /* @__PURE__ */ new Map());
|
|
1435
|
+
c(this, "ctx");
|
|
1436
1436
|
this.ctx = t, this.init();
|
|
1437
1437
|
}
|
|
1438
1438
|
init() {
|
|
1439
|
-
this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "mouseup", this.handleMouseUp.bind(this)), this.bind(window, "mousemove", this.handleMousemove.bind(this)), this.bind(this.ctx.
|
|
1439
|
+
this.bind(window, "resize", this.handleResize.bind(this)), this.bind(window, "mouseup", this.handleMouseUp.bind(this)), this.bind(window, "mousemove", this.handleMousemove.bind(this)), this.bind(this.ctx.stageElement, "click", this.handleClick.bind(this)), this.bind(window, "keydown", this.handleKeydown.bind(this)), this.bind(this.ctx.stageElement, "wheel", this.handleWheel.bind(this)), this.bind(this.ctx.stageElement, "contextmenu", this.handleContextMenu.bind(this)), this.bind(this.ctx.stageElement, "mousedown", this.handleMouseDown.bind(this)), this.bind(this.ctx.stageElement, "mouseenter", this.handleMouseEnter.bind(this)), this.bind(this.ctx.stageElement, "mouseleave", this.handleMouseLeave.bind(this)), this.bind(this.ctx.stageElement, "dblclick", this.handleDblclick.bind(this));
|
|
1440
1440
|
}
|
|
1441
1441
|
destroy() {
|
|
1442
1442
|
this.eventTasks.forEach((t, e) => {
|
|
@@ -1486,7 +1486,7 @@ class ri {
|
|
|
1486
1486
|
}
|
|
1487
1487
|
class oi {
|
|
1488
1488
|
constructor() {
|
|
1489
|
-
|
|
1489
|
+
c(this, "events", /* @__PURE__ */ new Map());
|
|
1490
1490
|
}
|
|
1491
1491
|
has(t) {
|
|
1492
1492
|
return this.events.has(t);
|
|
@@ -1524,11 +1524,14 @@ class oi {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
class ni {
|
|
1526
1526
|
constructor(t) {
|
|
1527
|
-
|
|
1527
|
+
c(this, "ctx");
|
|
1528
1528
|
const e = t.getContext("2d");
|
|
1529
1529
|
if (!e) throw new Error("canvas context not found");
|
|
1530
1530
|
this.ctx = e;
|
|
1531
1531
|
}
|
|
1532
|
+
scale(t) {
|
|
1533
|
+
this.ctx.scale(t, t);
|
|
1534
|
+
}
|
|
1532
1535
|
save() {
|
|
1533
1536
|
this.ctx.save();
|
|
1534
1537
|
}
|
|
@@ -1555,21 +1558,21 @@ class ni {
|
|
|
1555
1558
|
* @param {string} color - 阴影的颜色
|
|
1556
1559
|
*/
|
|
1557
1560
|
drawShadow(t, e, i, s, r) {
|
|
1558
|
-
const { fillColor: o, side: a, shadowWidth:
|
|
1561
|
+
const { fillColor: o, side: a, shadowWidth: h, colorStart: l, colorEnd: f } = r;
|
|
1559
1562
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1560
1563
|
let d;
|
|
1561
1564
|
switch (a) {
|
|
1562
1565
|
case "left":
|
|
1563
|
-
d = this.ctx.createLinearGradient(t -
|
|
1566
|
+
d = this.ctx.createLinearGradient(t - h, e, t, e), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t - h, e, h, s);
|
|
1564
1567
|
break;
|
|
1565
1568
|
case "right":
|
|
1566
|
-
d = this.ctx.createLinearGradient(t + i, e, t + i +
|
|
1569
|
+
d = this.ctx.createLinearGradient(t + i, e, t + i + h, e), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, h, s);
|
|
1567
1570
|
break;
|
|
1568
1571
|
case "top":
|
|
1569
|
-
d = this.ctx.createLinearGradient(t, e -
|
|
1572
|
+
d = this.ctx.createLinearGradient(t, e - h, t, e), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e - h, i, h);
|
|
1570
1573
|
break;
|
|
1571
1574
|
case "bottom":
|
|
1572
|
-
d = this.ctx.createLinearGradient(t, e + s, t, e + s +
|
|
1575
|
+
d = this.ctx.createLinearGradient(t, e + s, t, e + s + h), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, h);
|
|
1573
1576
|
break;
|
|
1574
1577
|
default:
|
|
1575
1578
|
console.error("Invalid side specified for shadow");
|
|
@@ -1582,19 +1585,19 @@ class ni {
|
|
|
1582
1585
|
throw new Error("A valid array of points is required to draw a line");
|
|
1583
1586
|
this.ctx.save();
|
|
1584
1587
|
const { borderColor: i = "black", borderWidth: s = 1 } = e;
|
|
1585
|
-
this.ctx.beginPath(), this.ctx.moveTo(t[0]
|
|
1588
|
+
this.ctx.beginPath(), this.ctx.moveTo(t[0] - 0.5, t[1] - 0.5);
|
|
1586
1589
|
for (let r = 2; r < t.length; r += 2)
|
|
1587
|
-
this.ctx.lineTo(t[r]
|
|
1590
|
+
this.ctx.lineTo(t[r] - 0.5, t[r + 1] - 0.5);
|
|
1588
1591
|
this.ctx.strokeStyle = i, this.ctx.lineWidth = s, e.lineDash && (this.ctx.lineDashOffset = 4, this.ctx.setLineDash(e.lineDash)), e.fillColor && (this.ctx.fillStyle = e.fillColor, this.ctx.fill()), e.borderColor && (this.ctx.strokeStyle = e.borderColor), this.ctx.stroke(), this.ctx.closePath(), this.ctx.restore();
|
|
1589
1592
|
}
|
|
1590
1593
|
drawImage(t, e, i, s, r) {
|
|
1591
1594
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, r), this.ctx.restore();
|
|
1592
1595
|
}
|
|
1593
|
-
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius:
|
|
1594
|
-
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o),
|
|
1595
|
-
this.ctx.rect(t
|
|
1596
|
+
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius: h = 0 } = {}) {
|
|
1597
|
+
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o), h === 0)
|
|
1598
|
+
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
1596
1599
|
else {
|
|
1597
|
-
const [l, f, d, x] = typeof
|
|
1600
|
+
const [l, f, d, x] = typeof h == "number" ? [h, h, h, h] : h;
|
|
1598
1601
|
this.ctx.moveTo(t + l, e), this.ctx.arcTo(t + i, e, t + i, e + f, f), this.ctx.arcTo(t + i, e + s, t + i - d, e + s, d), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + l, e, l);
|
|
1599
1602
|
}
|
|
1600
1603
|
a !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
@@ -1613,18 +1616,18 @@ class ni {
|
|
|
1613
1616
|
this.ctx.save();
|
|
1614
1617
|
const {
|
|
1615
1618
|
font: a = "12px Arial",
|
|
1616
|
-
align:
|
|
1619
|
+
align: h = "center",
|
|
1617
1620
|
color: l = "#495060",
|
|
1618
1621
|
padding: f = 0,
|
|
1619
1622
|
verticalAlign: d = "middle"
|
|
1620
1623
|
} = o;
|
|
1621
|
-
this.ctx.font = a, this.ctx.fillStyle = l, this.ctx.textBaseline = d, this.ctx.textAlign =
|
|
1624
|
+
this.ctx.font = a, this.ctx.fillStyle = l, this.ctx.textBaseline = d, this.ctx.textAlign = h;
|
|
1622
1625
|
let x = 0;
|
|
1623
1626
|
d === "top" ? x = i + f : d === "bottom" ? x = i + r - f : x = i + (r + 1) / 2;
|
|
1624
1627
|
let u = 0;
|
|
1625
|
-
|
|
1626
|
-
const { _text:
|
|
1627
|
-
return this.ctx.fillText(
|
|
1628
|
+
h === "left" ? u = e + f : h === "right" ? u = e + s - f : u = e + s / 2;
|
|
1629
|
+
const { _text: g, ellipsis: w } = this.handleEllipsis(t, s, f, a);
|
|
1630
|
+
return this.ctx.fillText(g, u, x), this.ctx.restore(), w;
|
|
1628
1631
|
}
|
|
1629
1632
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
1630
1633
|
let r = !1, o = t;
|
|
@@ -1633,8 +1636,8 @@ class ni {
|
|
|
1633
1636
|
_text: "",
|
|
1634
1637
|
ellipsis: r
|
|
1635
1638
|
};
|
|
1636
|
-
const a = this.ctx.measureText("...").width,
|
|
1637
|
-
if (
|
|
1639
|
+
const a = this.ctx.measureText("...").width, h = this.ctx.measureText(t).width;
|
|
1640
|
+
if (h && h + a >= e - i * 2) {
|
|
1638
1641
|
r = !0;
|
|
1639
1642
|
let l = 0;
|
|
1640
1643
|
for (let f = 0; f < t.length; f++)
|
|
@@ -1649,131 +1652,131 @@ class ni {
|
|
|
1649
1652
|
};
|
|
1650
1653
|
}
|
|
1651
1654
|
}
|
|
1652
|
-
class
|
|
1655
|
+
class $t {
|
|
1653
1656
|
constructor(t) {
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1657
|
+
c(this, "PROCESSOR_NUM", 50);
|
|
1658
|
+
c(this, "CSS_PREFIX", "e-virt-table");
|
|
1659
|
+
c(this, "ICONS", []);
|
|
1660
|
+
c(this, "ROW_KEY", "");
|
|
1661
|
+
c(this, "HEADER_FONT", "12px normal Arial");
|
|
1662
|
+
c(this, "BODY_FONT", "12px normal Arial");
|
|
1663
|
+
c(this, "BORDER_COLOR", "#e1e6eb");
|
|
1664
|
+
c(this, "WIDTH", 0);
|
|
1665
|
+
c(this, "RESIZE_MIN_WIDTH", 40);
|
|
1666
|
+
c(this, "HEIGHT", 0);
|
|
1667
|
+
c(this, "EMPTY_BODY_HEIGHT", 120);
|
|
1668
|
+
c(this, "EMPTY_CUSTOM", !1);
|
|
1669
|
+
c(this, "EMPTY_CUSTOM_STYLE", {});
|
|
1670
|
+
c(this, "EMPTY_TEXT", "暂无数据");
|
|
1671
|
+
c(this, "MAX_HEIGHT", 1e3);
|
|
1672
|
+
c(this, "BORDER_RADIUS", 8);
|
|
1673
|
+
c(this, "ENABLE_OFFSET_HEIGHT", !1);
|
|
1674
|
+
c(this, "OFFSET_HEIGHT", 0);
|
|
1675
|
+
c(this, "HEADER_HEIGHT", 36);
|
|
1676
|
+
c(this, "ENABLE_HEADER_STICKY", !1);
|
|
1674
1677
|
// 启用头部固定,需要外面实现覆盖层,或者所有表头都要是元素
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1678
|
+
c(this, "HEADER_BG_COLOR", "#F8FAFF");
|
|
1679
|
+
c(this, "BODY_BG_COLOR", "#FFF");
|
|
1680
|
+
c(this, "HEADER_TEXT_COLOR", "#1D2129");
|
|
1681
|
+
c(this, "LOADING_ICON_SVG", "");
|
|
1682
|
+
c(this, "LOADING_ICON_COLOR", "#4E5969");
|
|
1683
|
+
c(this, "EXPAND_ICON_SVG", "");
|
|
1684
|
+
c(this, "SHRINK_ICON_SVG", "");
|
|
1685
|
+
c(this, "EXPAND_ICON_COLOR", "#4E5969");
|
|
1686
|
+
c(this, "SHRINK_ICON_COLOR", "#4E5969");
|
|
1687
|
+
c(this, "ERROR_TIP_ICON_COLOR", "red");
|
|
1688
|
+
c(this, "ERROR_TIP_ICON_SIZE", 6);
|
|
1689
|
+
c(this, "EXPAND_LAZY", !0);
|
|
1690
|
+
c(this, "DEFAULT_EXPAND_ALL", !1);
|
|
1691
|
+
c(this, "CELL_WIDTH", 100);
|
|
1692
|
+
c(this, "CELL_HEIGHT", 36);
|
|
1693
|
+
c(this, "CELL_PADDING", 8);
|
|
1694
|
+
c(this, "CELL_HOVER_ICON_SIZE", 20);
|
|
1695
|
+
c(this, "SCROLLER_TRACK_SIZE", 14);
|
|
1696
|
+
c(this, "SCROLLER_SIZE", 8);
|
|
1697
|
+
c(this, "SCROLLER_COLOR", "#dee0e3");
|
|
1698
|
+
c(this, "SCROLLER_TRACK_COLOR", "#fff");
|
|
1699
|
+
c(this, "SCROLLER_FOCUS_COLOR", "#bbbec4");
|
|
1700
|
+
c(this, "SELECT_BORDER_COLOR", "rgb(82,146,247)");
|
|
1701
|
+
c(this, "SELECT_AREA_COLOR", "rgba(82,146,247,0.1)");
|
|
1702
|
+
c(this, "SELECT_BG_COLOR", "rgba(82,146,247,0.1)");
|
|
1703
|
+
c(this, "EDIT_BG_COLOR", "#fcf6ed");
|
|
1704
|
+
c(this, "CHECKBOX_KEY", "");
|
|
1705
|
+
c(this, "CHECKBOX_COLOR", "rgb(82,146,247)");
|
|
1706
|
+
c(this, "CHECKBOX_SIZE", 20);
|
|
1707
|
+
c(this, "CHECKBOX_DISABLED_SVG", "");
|
|
1708
|
+
c(this, "CHECKBOX_CHECK_SVG", "");
|
|
1709
|
+
c(this, "CHECKBOX_UNCHECK_SVG", "");
|
|
1710
|
+
c(this, "CHECKBOX_INDETERMINATE_SVG", "");
|
|
1711
|
+
c(this, "READONLY_COLOR", "#fff");
|
|
1712
|
+
c(this, "READONLY_TEXT_COLOR", "#4E5969");
|
|
1713
|
+
c(this, "ERROR_TIP_COLOR", "#ED3F14");
|
|
1714
|
+
c(this, "FOOTER_BG_COLOR", "#fafafa");
|
|
1715
|
+
c(this, "FOOTER_FIXED", !0);
|
|
1716
|
+
c(this, "CELL_FOOTER_HEIGHT", 36);
|
|
1717
|
+
c(this, "ENABLE_SELECTOR", !1);
|
|
1718
|
+
c(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
1716
1719
|
// 启用单点击立马编辑
|
|
1717
|
-
|
|
1720
|
+
c(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1718
1721
|
// 启用点击选择器编辑
|
|
1719
|
-
|
|
1722
|
+
c(this, "SELECTOR_AREA_MIN_X", 0);
|
|
1720
1723
|
// 选择器X最小范围
|
|
1721
|
-
|
|
1724
|
+
c(this, "SELECTOR_AREA_MAX_X_OFFSET", 0);
|
|
1722
1725
|
// 选择器X最大范围colMax - offset
|
|
1723
|
-
|
|
1726
|
+
c(this, "SELECTOR_AREA_MAX_X", 0);
|
|
1724
1727
|
// 选择器X最大范围,0默认最大colMax
|
|
1725
|
-
|
|
1728
|
+
c(this, "SELECTOR_AREA_MIN_Y", 0);
|
|
1726
1729
|
// 选择器Y最小范围
|
|
1727
|
-
|
|
1730
|
+
c(this, "SELECTOR_AREA_MAX_Y", 0);
|
|
1728
1731
|
// 选择器Y最大范围,0默认rowMax
|
|
1729
|
-
|
|
1732
|
+
c(this, "SELECTOR_AREA_MAX_Y_OFFSET", 0);
|
|
1730
1733
|
// 选择器Y最大范围,0默认rowMax
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1734
|
+
c(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
1735
|
+
c(this, "ENABLE_SELECTOR_SPAN_COL", !0);
|
|
1736
|
+
c(this, "ENABLE_SELECTOR_SPAN_ROW", !0);
|
|
1737
|
+
c(this, "ENABLE_SELECTOR_ALL_ROWS", !0);
|
|
1738
|
+
c(this, "ENABLE_SELECTOR_ALL_COLS", !0);
|
|
1739
|
+
c(this, "ENABLE_AUTOFILL", !1);
|
|
1740
|
+
c(this, "ENABLE_CONTEXT_MENU", !1);
|
|
1741
|
+
c(this, "ENABLE_COPY", !0);
|
|
1742
|
+
c(this, "ENABLE_PASTER", !0);
|
|
1743
|
+
c(this, "ENABLE_RESIZE_ROW", !0);
|
|
1744
|
+
c(this, "ENABLE_RESIZE_COLUMN", !0);
|
|
1745
|
+
c(this, "RESIZE_ROW_LINE_COLOR", "#e1e6eb");
|
|
1746
|
+
c(this, "RESIZE_COLUMN_LINE_COLOR", "#e1e6eb");
|
|
1747
|
+
c(this, "RESIZE_ROW_MIN_HEIGHT", 36);
|
|
1748
|
+
c(this, "RESIZE_COLUMN_MIN_WIDTH", 40);
|
|
1749
|
+
c(this, "ENABLE_KEYBOARD", !0);
|
|
1750
|
+
c(this, "ENABLE_HISTORY", !1);
|
|
1751
|
+
c(this, "ENABLE_VALIDATOR_IMMEDIATE", !0);
|
|
1752
|
+
c(this, "HISTORY_NUM", 50);
|
|
1753
|
+
c(this, "HIGHLIGHT_HOVER_ROW", !1);
|
|
1754
|
+
c(this, "HIGHLIGHT_HOVER_ROW_COLOR", "rgba(186,203,231,0.1)");
|
|
1755
|
+
c(this, "HIGHLIGHT_SELECTED_ROW", !1);
|
|
1756
|
+
c(this, "HIGHLIGHT_SELECTED_ROW_COLOR", "rgba(82,146,247,0.1)");
|
|
1757
|
+
c(this, "TOOLTIP_BG_COLOR", "#303133");
|
|
1758
|
+
c(this, "TOOLTIP_TEXT_COLOR", "#fff");
|
|
1759
|
+
c(this, "TOOLTIP_ZINDEX", 3e3);
|
|
1760
|
+
c(this, "TOOLTIP_CUSTOM_STYLE", {});
|
|
1761
|
+
c(this, "CONTEXT_MENU", [
|
|
1759
1762
|
{ label: "复制", value: "copy" },
|
|
1760
1763
|
{ label: "剪切", value: "cut" },
|
|
1761
1764
|
{ label: "粘贴", value: "paste" },
|
|
1762
1765
|
{ label: "清空选中内容", value: "clearSelected" }
|
|
1763
1766
|
]);
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1767
|
+
c(this, "HEADER_CELL_STYLE_METHOD");
|
|
1768
|
+
c(this, "BODY_CELL_STYLE_METHOD");
|
|
1769
|
+
c(this, "FOOTER_CELL_STYLE_METHOD");
|
|
1770
|
+
c(this, "CELL_READONLY_METHOD");
|
|
1771
|
+
c(this, "CELL_FORMATTER_METHOD");
|
|
1772
|
+
c(this, "CELL_RULES_METHOD");
|
|
1773
|
+
c(this, "CELL_TYPE_METHOD");
|
|
1774
|
+
c(this, "CELL_EDITOR_TYPE_METHOD");
|
|
1775
|
+
c(this, "CELL_RENDER_METHOD");
|
|
1776
|
+
c(this, "CELL_HOVER_ICON_METHOD");
|
|
1777
|
+
c(this, "SPAN_METHOD");
|
|
1778
|
+
c(this, "SELECTABLE_METHOD");
|
|
1779
|
+
c(this, "EXPAND_LAZY_METHOD");
|
|
1777
1780
|
Object.assign(this, t);
|
|
1778
1781
|
}
|
|
1779
1782
|
init(t) {
|
|
@@ -1782,8 +1785,8 @@ class Wt {
|
|
|
1782
1785
|
}
|
|
1783
1786
|
class ai {
|
|
1784
1787
|
constructor(t) {
|
|
1785
|
-
|
|
1786
|
-
|
|
1788
|
+
c(this, "ctx");
|
|
1789
|
+
c(this, "list", [
|
|
1787
1790
|
{
|
|
1788
1791
|
name: "loading",
|
|
1789
1792
|
configName: "LOADING_ICON_SVG",
|
|
@@ -1845,7 +1848,7 @@ class ai {
|
|
|
1845
1848
|
color: ""
|
|
1846
1849
|
}
|
|
1847
1850
|
]);
|
|
1848
|
-
|
|
1851
|
+
c(this, "icons", /* @__PURE__ */ new Map());
|
|
1849
1852
|
this.ctx = t, this.init();
|
|
1850
1853
|
}
|
|
1851
1854
|
async init() {
|
|
@@ -1879,8 +1882,8 @@ class ai {
|
|
|
1879
1882
|
});
|
|
1880
1883
|
const o = new Image(), a = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1881
1884
|
type: "image/svg+xml"
|
|
1882
|
-
}),
|
|
1883
|
-
return o.src =
|
|
1885
|
+
}), h = URL.createObjectURL(a);
|
|
1886
|
+
return o.src = h, new Promise((l, f) => {
|
|
1884
1887
|
o.onerror = () => f(new Error("Failed to load image")), o.onload = () => {
|
|
1885
1888
|
l(o);
|
|
1886
1889
|
};
|
|
@@ -1890,29 +1893,38 @@ class ai {
|
|
|
1890
1893
|
return this.icons.get(t);
|
|
1891
1894
|
}
|
|
1892
1895
|
}
|
|
1893
|
-
class
|
|
1896
|
+
class re {
|
|
1894
1897
|
constructor(t, e, i, s, r, o, a) {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1898
|
+
c(this, "ctx");
|
|
1899
|
+
c(this, "x", 0);
|
|
1900
|
+
c(this, "y", 0);
|
|
1901
|
+
c(this, "width", 0);
|
|
1902
|
+
c(this, "height", 0);
|
|
1903
|
+
c(this, "fixed");
|
|
1904
|
+
c(this, "cellType");
|
|
1902
1905
|
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = r, this.fixed = o, this.cellType = a;
|
|
1903
1906
|
}
|
|
1904
1907
|
isHorizontalVisible() {
|
|
1905
1908
|
if (this.fixed)
|
|
1906
1909
|
return !0;
|
|
1907
|
-
const {
|
|
1910
|
+
const { stageWidth: t, fixedLeftWidth: e, scrollX: i, fixedRightWidth: s } = this.ctx, r = t;
|
|
1908
1911
|
return !(this.x + this.width - e - i <= 0 || this.x - i >= r - s);
|
|
1909
1912
|
}
|
|
1910
1913
|
isVerticalVisible() {
|
|
1911
|
-
const {
|
|
1914
|
+
const { stageHeight: t, scrollY: e } = this.ctx, i = t;
|
|
1912
1915
|
return !(this.y + this.height - e <= 0 || this.y - e >= i);
|
|
1913
1916
|
}
|
|
1914
1917
|
getDrawX() {
|
|
1915
|
-
|
|
1918
|
+
if (this.fixed === "left")
|
|
1919
|
+
return this.x;
|
|
1920
|
+
if (this.fixed === "right") {
|
|
1921
|
+
const {
|
|
1922
|
+
stageWidth: t,
|
|
1923
|
+
config: { SCROLLER_TRACK_SIZE: e }
|
|
1924
|
+
} = this.ctx;
|
|
1925
|
+
return t - (this.ctx.header.width - this.x) - e + 1;
|
|
1926
|
+
}
|
|
1927
|
+
return this.x - this.ctx.scrollX;
|
|
1916
1928
|
}
|
|
1917
1929
|
getDrawY() {
|
|
1918
1930
|
return this.cellType === "header" ? this.y : this.cellType === "footer" && this.ctx.config.FOOTER_FIXED ? this.y : this.y - this.ctx.scrollY;
|
|
@@ -1927,56 +1939,56 @@ class te {
|
|
|
1927
1939
|
getRightFixedX() {
|
|
1928
1940
|
}
|
|
1929
1941
|
}
|
|
1930
|
-
class
|
|
1931
|
-
constructor(e, i, s, r, o, a,
|
|
1932
|
-
super(e, r, o, a,
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1942
|
+
class oe extends re {
|
|
1943
|
+
constructor(e, i, s, r, o, a, h, l, f, d = "body") {
|
|
1944
|
+
super(e, r, o, a, h, l.fixed, d);
|
|
1945
|
+
c(this, "formatter");
|
|
1946
|
+
c(this, "hoverIconName", "");
|
|
1947
|
+
c(this, "operation", !1);
|
|
1948
|
+
c(this, "align");
|
|
1949
|
+
c(this, "verticalAlign");
|
|
1950
|
+
c(this, "fixed");
|
|
1951
|
+
c(this, "type");
|
|
1952
|
+
c(this, "editorType");
|
|
1953
|
+
c(this, "cellType");
|
|
1954
|
+
c(this, "level");
|
|
1955
|
+
c(this, "colspan", 1);
|
|
1956
|
+
c(this, "rowspan", 1);
|
|
1957
|
+
c(this, "key");
|
|
1958
|
+
c(this, "column");
|
|
1959
|
+
c(this, "rowIndex");
|
|
1960
|
+
c(this, "colIndex");
|
|
1961
|
+
c(this, "rowKey");
|
|
1962
|
+
c(this, "row");
|
|
1963
|
+
c(this, "value");
|
|
1964
|
+
c(this, "render");
|
|
1965
|
+
c(this, "renderFooter");
|
|
1966
|
+
c(this, "style", {});
|
|
1967
|
+
c(this, "rules", {});
|
|
1968
|
+
c(this, "message", "");
|
|
1969
|
+
c(this, "text", "");
|
|
1970
|
+
c(this, "displayText", "");
|
|
1971
|
+
c(this, "visibleWidth", 0);
|
|
1972
|
+
c(this, "visibleHeight", 0);
|
|
1973
|
+
c(this, "drawX", 0);
|
|
1974
|
+
c(this, "drawY", 0);
|
|
1975
|
+
c(this, "drawCellBgColor", "");
|
|
1976
|
+
c(this, "drawCellSkyBgColor", "");
|
|
1977
|
+
c(this, "drawTextColor", "");
|
|
1978
|
+
c(this, "drawTextX", 0);
|
|
1979
|
+
c(this, "drawTextY", 0);
|
|
1980
|
+
c(this, "drawImageX", 0);
|
|
1981
|
+
c(this, "drawImageY", 0);
|
|
1982
|
+
c(this, "drawImageWidth", 0);
|
|
1983
|
+
c(this, "drawImageHeight", 0);
|
|
1984
|
+
c(this, "drawImageName", "");
|
|
1985
|
+
c(this, "drawImageSource");
|
|
1986
|
+
c(this, "ellipsis", !1);
|
|
1987
|
+
c(this, "rowExpand", !1);
|
|
1988
|
+
c(this, "rowHasChildren", !1);
|
|
1989
|
+
c(this, "overflowTooltipShow", !0);
|
|
1990
|
+
c(this, "overflowTooltipMaxWidth", 500);
|
|
1991
|
+
c(this, "overflowTooltipPlacement", "top");
|
|
1980
1992
|
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = l.key, this.type = l.type || "text", this.editorType = l.editorType || "text", this.cellType = d, this.align = l.align || "center", this.verticalAlign = l.verticalAlign || "middle", this.fixed = l.fixed, this.level = l.level, this.operation = l.operation || !1, this.column = l, this.rules = l.rules, this.row = f, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = l.render, this.overflowTooltipShow = l.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = l.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = l.overflowTooltipPlacement || "top", this.renderFooter = l.renderFooter, this.hoverIconName = l.hoverIconName, this.formatter = l.formatter, this.update();
|
|
1981
1993
|
}
|
|
1982
1994
|
getValidationMessage() {
|
|
@@ -2071,18 +2083,18 @@ class ee extends te {
|
|
|
2071
2083
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2072
2084
|
let r, o = 0, a = "";
|
|
2073
2085
|
if (this.type === "tree" && s === "body") {
|
|
2074
|
-
const
|
|
2086
|
+
const h = this.ctx.database.getRowForRowKey(i), { expand: l = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = h || {};
|
|
2075
2087
|
if (this.rowExpand = l, this.rowHasChildren = f, d) {
|
|
2076
2088
|
const u = this.ctx.icons.get("loading");
|
|
2077
2089
|
a = "loading", r = u, o = x * 8;
|
|
2078
2090
|
} else if (f) {
|
|
2079
|
-
const u = this.ctx.icons.get("expand"),
|
|
2080
|
-
r = l ?
|
|
2091
|
+
const u = this.ctx.icons.get("expand"), g = this.ctx.icons.get("shrink");
|
|
2092
|
+
r = l ? g : u, a = l ? "shrink" : "expand", o = x * 8;
|
|
2081
2093
|
} else
|
|
2082
2094
|
o = x * 8;
|
|
2083
2095
|
if (r) {
|
|
2084
|
-
let u = 20,
|
|
2085
|
-
this.ctx.paint.drawImage(r,
|
|
2096
|
+
let u = 20, g = 20, w = this.drawX + o + e, p = this.drawY + (this.visibleHeight - g) / 2;
|
|
2097
|
+
this.ctx.paint.drawImage(r, w, p, u, g), this.drawImageX = w, this.drawImageY = p, this.drawImageWidth = u, this.drawImageHeight = g, this.drawImageName = a, this.drawImageSource = r, this.align = "left", this.drawTextX = o + this.drawX + u - 0.5;
|
|
2086
2098
|
}
|
|
2087
2099
|
}
|
|
2088
2100
|
}
|
|
@@ -2094,65 +2106,65 @@ class ee extends te {
|
|
|
2094
2106
|
FOOTER_CELL_STYLE_METHOD: r,
|
|
2095
2107
|
READONLY_TEXT_COLOR: o,
|
|
2096
2108
|
FOOTER_BG_COLOR: a,
|
|
2097
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2109
|
+
HIGHLIGHT_SELECTED_ROW: h,
|
|
2098
2110
|
HIGHLIGHT_SELECTED_ROW_COLOR: l,
|
|
2099
2111
|
HIGHLIGHT_HOVER_ROW: f,
|
|
2100
2112
|
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
2101
2113
|
} = this.ctx.config;
|
|
2102
2114
|
if (this.cellType === "footer") {
|
|
2103
|
-
let y = a,
|
|
2115
|
+
let y = a, b = o;
|
|
2104
2116
|
if (typeof r == "function") {
|
|
2105
|
-
const m = r, { backgroundColor: E, color:
|
|
2117
|
+
const m = r, { backgroundColor: E, color: C } = m({
|
|
2106
2118
|
row: this.row,
|
|
2107
2119
|
rowIndex: this.rowIndex,
|
|
2108
2120
|
colIndex: this.colIndex,
|
|
2109
2121
|
column: this.column,
|
|
2110
2122
|
value: this.getValue()
|
|
2111
2123
|
}) || {};
|
|
2112
|
-
E && (y = E),
|
|
2124
|
+
E && (y = E), C && (b = C);
|
|
2113
2125
|
}
|
|
2114
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = y, this.drawTextColor =
|
|
2126
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = y, this.drawTextColor = b;
|
|
2115
2127
|
return;
|
|
2116
2128
|
}
|
|
2117
2129
|
let x = "transparent";
|
|
2118
|
-
const u = this.ctx.focusCell,
|
|
2119
|
-
f && (
|
|
2120
|
-
let
|
|
2130
|
+
const u = this.ctx.focusCell, g = this.ctx.hoverCell;
|
|
2131
|
+
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d), h && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = l), this.drawCellSkyBgColor = x;
|
|
2132
|
+
let w = e, p = o;
|
|
2121
2133
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2122
2134
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
2123
2135
|
return;
|
|
2124
2136
|
}
|
|
2125
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (
|
|
2126
|
-
const y = s, { backgroundColor:
|
|
2137
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (w = i, p = o), typeof s == "function") {
|
|
2138
|
+
const y = s, { backgroundColor: b, color: m } = y({
|
|
2127
2139
|
row: this.row,
|
|
2128
2140
|
rowIndex: this.rowIndex,
|
|
2129
2141
|
colIndex: this.colIndex,
|
|
2130
2142
|
column: this.column,
|
|
2131
2143
|
value: this.getValue()
|
|
2132
2144
|
}) || {};
|
|
2133
|
-
|
|
2145
|
+
b && (w = b), m && (p = m);
|
|
2134
2146
|
}
|
|
2135
|
-
this.drawCellBgColor =
|
|
2147
|
+
this.drawCellBgColor = w, this.drawTextColor = p;
|
|
2136
2148
|
}
|
|
2137
2149
|
updateSelection() {
|
|
2138
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex:
|
|
2150
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex: h, rowKey: l } = this;
|
|
2139
2151
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(a)) {
|
|
2140
|
-
const f = this.ctx.database.getRowSelection(l), d = this.ctx.database.getRowSelectable(l), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2,
|
|
2141
|
-
let
|
|
2142
|
-
f && d ? (
|
|
2152
|
+
const f = this.ctx.database.getRowSelection(l), d = this.ctx.database.getRowSelectable(l), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, g = this.drawY + (i - x) / 2;
|
|
2153
|
+
let w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
2154
|
+
f && d ? (w = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : f && d ? (w = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !f && d ? (w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled"), w && a == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w) : w && a === "selection" && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w);
|
|
2143
2155
|
}
|
|
2144
2156
|
}
|
|
2145
2157
|
updateHoverIcon() {
|
|
2146
2158
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2147
2159
|
if (typeof e == "function") {
|
|
2148
|
-
const
|
|
2160
|
+
const h = e({
|
|
2149
2161
|
row: this.row,
|
|
2150
2162
|
rowIndex: this.rowIndex,
|
|
2151
2163
|
colIndex: this.colIndex,
|
|
2152
2164
|
column: this.column,
|
|
2153
2165
|
value: this.getValue()
|
|
2154
2166
|
});
|
|
2155
|
-
|
|
2167
|
+
h !== void 0 && (this.hoverIconName = h);
|
|
2156
2168
|
}
|
|
2157
2169
|
const r = this.drawX + this.width - i - s, o = this.drawY + (this.height - i) / 2;
|
|
2158
2170
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
@@ -2199,7 +2211,7 @@ class ee extends te {
|
|
|
2199
2211
|
*/
|
|
2200
2212
|
getOverlayerViewsStyle() {
|
|
2201
2213
|
let e = `${this.drawX - this.ctx.fixedLeftWidth}px`, i = `${this.drawY - this.ctx.body.y}px`;
|
|
2202
|
-
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" && (e = `${this.drawX - (this.ctx.
|
|
2214
|
+
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" && (e = `${this.drawX - (this.ctx.stageWidth - this.ctx.fixedRightWidth)}px`), this.cellType === "footer" && this.ctx.config.FOOTER_FIXED && (i = `${this.drawY - this.ctx.footer.y}px`), {
|
|
2203
2215
|
position: "absolute",
|
|
2204
2216
|
overflow: "hidden",
|
|
2205
2217
|
left: e,
|
|
@@ -2268,8 +2280,8 @@ class ee extends te {
|
|
|
2268
2280
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2269
2281
|
if (!s || !i)
|
|
2270
2282
|
return;
|
|
2271
|
-
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
2272
|
-
l === a && f ===
|
|
2283
|
+
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1], h = o[1], { colIndex: l, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2284
|
+
l === a && f === h && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2273
2285
|
borderColor: "#fff",
|
|
2274
2286
|
fillColor: e
|
|
2275
2287
|
});
|
|
@@ -2323,85 +2335,85 @@ class ee extends te {
|
|
|
2323
2335
|
});
|
|
2324
2336
|
}
|
|
2325
2337
|
drawBorder(e) {
|
|
2326
|
-
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: a } = this
|
|
2327
|
-
let l = s + 0.5, f = this.height;
|
|
2328
|
-
o === 0 && (l = this.y + 1, f = f - 1);
|
|
2329
|
-
const { xArr: d, yArr: x, lineDash: u = [], borderWidth:
|
|
2330
|
-
a >= y && a <=
|
|
2331
|
-
borderColor:
|
|
2332
|
-
fillColor:
|
|
2333
|
-
borderWidth:
|
|
2338
|
+
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: a } = this;
|
|
2339
|
+
let h = i + 0.5, l = s + 0.5, f = this.height;
|
|
2340
|
+
o === 0 && (l = this.y + 1, f = f - 1), a === this.ctx.maxColIndex && (h = h - 1);
|
|
2341
|
+
const { xArr: d, yArr: x, lineDash: u = [], borderWidth: g = 1, borderColor: w, fillColor: p } = e, y = d[0], b = d[1], m = x[0], E = x[1];
|
|
2342
|
+
a >= y && a <= b && o === m && this.ctx.paint.drawLine([h, l, h + r - 2, l], {
|
|
2343
|
+
borderColor: w,
|
|
2344
|
+
fillColor: p,
|
|
2345
|
+
borderWidth: g,
|
|
2334
2346
|
lineCap: "round",
|
|
2335
2347
|
lineJoin: "round",
|
|
2336
2348
|
lineDash: u
|
|
2337
|
-
}), a >= y && a <=
|
|
2338
|
-
borderColor:
|
|
2339
|
-
fillColor:
|
|
2340
|
-
borderWidth:
|
|
2349
|
+
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([h, l + f - 1.5, h + r, l + f - 1.5], {
|
|
2350
|
+
borderColor: w,
|
|
2351
|
+
fillColor: p,
|
|
2352
|
+
borderWidth: g,
|
|
2341
2353
|
lineCap: "round",
|
|
2342
2354
|
lineJoin: "round",
|
|
2343
2355
|
lineDash: u
|
|
2344
|
-
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([
|
|
2345
|
-
borderColor:
|
|
2346
|
-
fillColor:
|
|
2347
|
-
borderWidth:
|
|
2356
|
+
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([h, l, h, l + f - 1], {
|
|
2357
|
+
borderColor: w,
|
|
2358
|
+
fillColor: p,
|
|
2359
|
+
borderWidth: g,
|
|
2348
2360
|
lineCap: "round",
|
|
2349
2361
|
lineJoin: "round",
|
|
2350
2362
|
lineDash: u
|
|
2351
|
-
}), a ===
|
|
2352
|
-
borderColor:
|
|
2353
|
-
fillColor:
|
|
2354
|
-
borderWidth:
|
|
2363
|
+
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([h + r - 1.5, l, h + r - 1.5, l + f - 1.5], {
|
|
2364
|
+
borderColor: w,
|
|
2365
|
+
fillColor: p,
|
|
2366
|
+
borderWidth: g,
|
|
2355
2367
|
lineCap: "round",
|
|
2356
2368
|
lineJoin: "round",
|
|
2357
2369
|
lineDash: u
|
|
2358
2370
|
});
|
|
2359
2371
|
}
|
|
2360
2372
|
}
|
|
2361
|
-
class
|
|
2362
|
-
constructor(e, i, s, r, o, a,
|
|
2363
|
-
super(e, s, r, o, a,
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key =
|
|
2373
|
+
class ne extends re {
|
|
2374
|
+
constructor(e, i, s, r, o, a, h) {
|
|
2375
|
+
super(e, s, r, o, a, h.fixed, "header");
|
|
2376
|
+
c(this, "align");
|
|
2377
|
+
c(this, "verticalAlign", "middle");
|
|
2378
|
+
c(this, "fixed");
|
|
2379
|
+
c(this, "widthFillDisable");
|
|
2380
|
+
c(this, "type");
|
|
2381
|
+
c(this, "operation", !1);
|
|
2382
|
+
c(this, "editorType");
|
|
2383
|
+
c(this, "level");
|
|
2384
|
+
c(this, "text");
|
|
2385
|
+
c(this, "displayText", "");
|
|
2386
|
+
c(this, "colspan");
|
|
2387
|
+
c(this, "rowspan");
|
|
2388
|
+
c(this, "key");
|
|
2389
|
+
c(this, "required", !1);
|
|
2390
|
+
c(this, "readonly", !1);
|
|
2391
|
+
c(this, "children", []);
|
|
2392
|
+
c(this, "column");
|
|
2393
|
+
c(this, "colIndex");
|
|
2394
|
+
c(this, "rowKey");
|
|
2395
|
+
c(this, "rules");
|
|
2396
|
+
c(this, "hasChildren");
|
|
2397
|
+
c(this, "render");
|
|
2398
|
+
c(this, "style", {});
|
|
2399
|
+
c(this, "drawX", 0);
|
|
2400
|
+
c(this, "drawY", 0);
|
|
2401
|
+
c(this, "drawCellBgColor", "");
|
|
2402
|
+
c(this, "drawTextColor", "");
|
|
2403
|
+
c(this, "drawImageX", 0);
|
|
2404
|
+
c(this, "drawImageY", 0);
|
|
2405
|
+
c(this, "drawImageWidth", 0);
|
|
2406
|
+
c(this, "drawImageHeight", 0);
|
|
2407
|
+
c(this, "drawImageName", "");
|
|
2408
|
+
c(this, "drawImageSource");
|
|
2409
|
+
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key = h.key, this.type = h.type, this.editorType = h.editorType || "text", this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level, this.operation = h.operation || !1, this.text = h.title, this.column = h, this.colspan = h.colspan, this.widthFillDisable = h.widthFillDisable, this.rowspan = h.rowspan, this.rules = h.rules, this.readonly = h.readonly, this.required = h.required, this.rowKey = te(), this.hasChildren = h.children && h.children.length > 0 || !1, this.render = h.renderHeader;
|
|
2398
2410
|
}
|
|
2399
2411
|
/**
|
|
2400
2412
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
2401
2413
|
* @returns
|
|
2402
2414
|
*/
|
|
2403
2415
|
isVerticalVisible() {
|
|
2404
|
-
const {
|
|
2416
|
+
const { stageHeight: e } = this.ctx, i = e;
|
|
2405
2417
|
return !(this.y + this.height <= 0 || this.y >= i);
|
|
2406
2418
|
}
|
|
2407
2419
|
/**
|
|
@@ -2414,11 +2426,11 @@ class ie extends te {
|
|
|
2414
2426
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2415
2427
|
let r = i, o = s;
|
|
2416
2428
|
if (typeof e == "function") {
|
|
2417
|
-
const a = e, { backgroundColor:
|
|
2429
|
+
const a = e, { backgroundColor: h, color: l } = a({
|
|
2418
2430
|
colIndex: this.colIndex,
|
|
2419
2431
|
column: this.column
|
|
2420
2432
|
}) || {};
|
|
2421
|
-
|
|
2433
|
+
h && (r = h), l && (o = l);
|
|
2422
2434
|
}
|
|
2423
2435
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2424
2436
|
}
|
|
@@ -2429,11 +2441,11 @@ class ie extends te {
|
|
|
2429
2441
|
const {
|
|
2430
2442
|
paint: e,
|
|
2431
2443
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2432
|
-
} = this.ctx, { drawX: o, drawY: a, displayText:
|
|
2444
|
+
} = this.ctx, { drawX: o, drawY: a, displayText: h } = this;
|
|
2433
2445
|
e.drawRect(o, a, this.width, this.height, {
|
|
2434
2446
|
borderColor: i,
|
|
2435
2447
|
fillColor: this.drawCellBgColor
|
|
2436
|
-
}), e.drawText(
|
|
2448
|
+
}), e.drawText(h, o, a, this.width, this.height, {
|
|
2437
2449
|
font: r,
|
|
2438
2450
|
padding: s,
|
|
2439
2451
|
color: this.drawTextColor,
|
|
@@ -2444,9 +2456,9 @@ class ie extends te {
|
|
|
2444
2456
|
drawSelection() {
|
|
2445
2457
|
const { width: e, height: i, type: s } = this;
|
|
2446
2458
|
if (["index-selection", "selection"].includes(s)) {
|
|
2447
|
-
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE:
|
|
2459
|
+
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: h = 0 } = this.ctx.config, l = this.drawX + (e - h) / 2, f = this.drawY + (i - h) / 2;
|
|
2448
2460
|
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2449
|
-
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && a ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && a ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && a ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = l, this.drawImageY = f, this.drawImageWidth =
|
|
2461
|
+
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && a ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && a ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && a ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = l, this.drawImageY = f, this.drawImageWidth = h, this.drawImageHeight = h, this.drawImageName = x, this.drawImageSource = d, this.ctx.paint.drawImage(
|
|
2450
2462
|
this.drawImageSource,
|
|
2451
2463
|
this.drawImageX,
|
|
2452
2464
|
this.drawImageY,
|
|
@@ -2463,7 +2475,7 @@ class ie extends te {
|
|
|
2463
2475
|
*/
|
|
2464
2476
|
getOverlayerViewsStyle() {
|
|
2465
2477
|
let e = "";
|
|
2466
|
-
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" ? e = `${this.drawX - (this.ctx.
|
|
2478
|
+
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" ? e = `${this.drawX - (this.ctx.stageWidth - this.ctx.fixedRightWidth)}px` : e = `${this.drawX - this.ctx.fixedLeftWidth}px`, {
|
|
2467
2479
|
position: "absolute",
|
|
2468
2480
|
overflow: "hidden",
|
|
2469
2481
|
left: e,
|
|
@@ -2473,17 +2485,17 @@ class ie extends te {
|
|
|
2473
2485
|
};
|
|
2474
2486
|
}
|
|
2475
2487
|
}
|
|
2476
|
-
class
|
|
2488
|
+
class ci {
|
|
2477
2489
|
constructor(t) {
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2490
|
+
c(this, "ctx");
|
|
2491
|
+
c(this, "visibleHoverCell");
|
|
2492
|
+
c(this, "resizeObserver");
|
|
2481
2493
|
this.ctx = t, this.init();
|
|
2482
2494
|
}
|
|
2483
2495
|
init() {
|
|
2484
2496
|
this.resizeObserver = new ResizeObserver(() => {
|
|
2485
2497
|
this.ctx.emit("resetHeader"), this.ctx.emit("resizeObserver");
|
|
2486
|
-
}), this.
|
|
2498
|
+
}), this.resizeObserver.observe(this.ctx.stageElement), this.ctx.on("mousedown", (t) => {
|
|
2487
2499
|
if (t.button !== 0 || this.isBusy(t))
|
|
2488
2500
|
return;
|
|
2489
2501
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, r = i;
|
|
@@ -2545,7 +2557,7 @@ class hi {
|
|
|
2545
2557
|
*/
|
|
2546
2558
|
selectionClick(t) {
|
|
2547
2559
|
if (["selection", "index-selection"].includes(t.type) && this.ctx.isPointer)
|
|
2548
|
-
if (t instanceof
|
|
2560
|
+
if (t instanceof ne)
|
|
2549
2561
|
t.drawImageName === "checkbox-uncheck" || t.drawImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawImageName === "checkbox-check" && this.ctx.database.clearSelection();
|
|
2550
2562
|
else {
|
|
2551
2563
|
if (!this.ctx.database.getRowSelectable(t.rowKey))
|
|
@@ -2567,10 +2579,10 @@ class hi {
|
|
|
2567
2579
|
colIndex: t.colIndex,
|
|
2568
2580
|
column: t.column,
|
|
2569
2581
|
value: t.getValue()
|
|
2570
|
-
}).then((
|
|
2571
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2572
|
-
}).catch((
|
|
2573
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2582
|
+
}).then((h) => {
|
|
2583
|
+
this.ctx.database.setExpandChildren(t.rowKey, h), this.ctx.database.expandLoading(t.rowKey, !1);
|
|
2584
|
+
}).catch((h) => {
|
|
2585
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(h);
|
|
2574
2586
|
}));
|
|
2575
2587
|
else {
|
|
2576
2588
|
const a = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2585,27 +2597,27 @@ class hi {
|
|
|
2585
2597
|
*/
|
|
2586
2598
|
imageEnterAndLeave(t, e) {
|
|
2587
2599
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s;
|
|
2588
|
-
o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight ? (this.ctx.
|
|
2600
|
+
o > t.drawImageX && o < t.drawImageX + t.drawImageWidth && r > t.drawImageY && r < t.drawImageY + t.drawImageHeight ? (this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof oe && ["selection", "index-selection"].includes(t.type) && (this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.stageElement.style.cursor = "not-allowed"))) : (this.ctx.isPointer = !1, this.ctx.stageElement.style.cursor === "pointer" && (this.ctx.stageElement.style.cursor = "default"));
|
|
2589
2601
|
}
|
|
2590
2602
|
isBusy(t) {
|
|
2591
2603
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, r = i;
|
|
2592
|
-
if (!this.ctx.isTarget() || this.ctx.
|
|
2604
|
+
if (!this.ctx.isTarget() || this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize" || this.ctx.columnResizing || this.ctx.rowResizing)
|
|
2593
2605
|
return !0;
|
|
2594
2606
|
const { SCROLLER_TRACK_SIZE: o } = this.ctx.config;
|
|
2595
|
-
return !!(this.ctx.scrollerMove || this.ctx.scrollerFocus || s > this.ctx.
|
|
2607
|
+
return !!(this.ctx.scrollerMove || this.ctx.scrollerFocus || s > this.ctx.stageHeight - o || r > this.ctx.stageWidth - o);
|
|
2596
2608
|
}
|
|
2597
2609
|
handleBodyEvent(t, e, i, s, r = !1) {
|
|
2598
2610
|
for (const o of i) {
|
|
2599
2611
|
const a = o.fixedCells.concat(o.noFixedCells);
|
|
2600
|
-
for (const
|
|
2601
|
-
const l =
|
|
2612
|
+
for (const h of a) {
|
|
2613
|
+
const l = h.getDrawX(), f = h.getDrawY();
|
|
2602
2614
|
if (r) {
|
|
2603
|
-
if (t > l && t < l +
|
|
2604
|
-
s(
|
|
2615
|
+
if (t > l && t < l + h.visibleWidth && e > f && e < f + h.visibleHeight) {
|
|
2616
|
+
s(h);
|
|
2605
2617
|
return;
|
|
2606
2618
|
}
|
|
2607
|
-
} else if (t > l && t < l +
|
|
2608
|
-
s(
|
|
2619
|
+
} else if (t > l && t < l + h.width && e > f && e < f + h.height) {
|
|
2620
|
+
s(h);
|
|
2609
2621
|
return;
|
|
2610
2622
|
}
|
|
2611
2623
|
}
|
|
@@ -2621,49 +2633,53 @@ class hi {
|
|
|
2621
2633
|
}
|
|
2622
2634
|
}
|
|
2623
2635
|
destroy() {
|
|
2624
|
-
this.resizeObserver.unobserve(this.ctx.
|
|
2636
|
+
this.resizeObserver.unobserve(this.ctx.stageElement);
|
|
2625
2637
|
}
|
|
2626
2638
|
}
|
|
2627
|
-
class
|
|
2628
|
-
constructor(t, e
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2639
|
+
class hi {
|
|
2640
|
+
constructor(t, e) {
|
|
2641
|
+
c(this, "eventBus");
|
|
2642
|
+
c(this, "eventBrowser");
|
|
2643
|
+
c(this, "eventTable");
|
|
2644
|
+
c(this, "containerElement");
|
|
2645
|
+
c(this, "stageElement");
|
|
2646
|
+
c(this, "canvasElement");
|
|
2647
|
+
c(this, "overlayerElement");
|
|
2648
|
+
c(this, "stageWidth", 0);
|
|
2649
|
+
c(this, "stageHeight", 0);
|
|
2650
|
+
c(this, "paint");
|
|
2651
|
+
c(this, "icons");
|
|
2652
|
+
c(this, "isInsideTargetContainer", !1);
|
|
2653
|
+
c(this, "mousedown", !1);
|
|
2654
|
+
c(this, "isPointer", !1);
|
|
2655
|
+
c(this, "rowResizing", !1);
|
|
2640
2656
|
// 行调整大小中
|
|
2641
|
-
|
|
2657
|
+
c(this, "columnResizing", !1);
|
|
2642
2658
|
// 列调整大小中
|
|
2643
|
-
|
|
2659
|
+
c(this, "scrollerMove", !1);
|
|
2644
2660
|
// 滚动条移动中
|
|
2645
|
-
|
|
2661
|
+
c(this, "scrollerFocus", !1);
|
|
2646
2662
|
// 滚动条focus中
|
|
2647
|
-
|
|
2663
|
+
c(this, "autofillMove", !1);
|
|
2648
2664
|
// 自动填充移动中
|
|
2649
|
-
|
|
2665
|
+
c(this, "selectorMove", !1);
|
|
2650
2666
|
// 选择器移动中
|
|
2651
|
-
|
|
2667
|
+
c(this, "editing", !1);
|
|
2652
2668
|
// 编辑中
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2669
|
+
c(this, "scrollY", 0);
|
|
2670
|
+
c(this, "scrollX", 0);
|
|
2671
|
+
c(this, "fixedLeftWidth", 0);
|
|
2672
|
+
c(this, "fixedRightWidth", 0);
|
|
2673
|
+
c(this, "maxColIndex", 0);
|
|
2674
|
+
c(this, "maxRowIndex", 0);
|
|
2675
|
+
c(this, "hoverRow");
|
|
2676
|
+
c(this, "clickCell");
|
|
2677
|
+
c(this, "focusCell");
|
|
2678
|
+
c(this, "hoverCell");
|
|
2679
|
+
c(this, "clickCellHeader");
|
|
2680
|
+
c(this, "focusCellHeader");
|
|
2681
|
+
c(this, "hoverCellHeader");
|
|
2682
|
+
c(this, "body", {
|
|
2667
2683
|
x: 0,
|
|
2668
2684
|
y: 0,
|
|
2669
2685
|
width: 0,
|
|
@@ -2676,7 +2692,7 @@ class ci {
|
|
|
2676
2692
|
renderRows: [],
|
|
2677
2693
|
data: []
|
|
2678
2694
|
});
|
|
2679
|
-
|
|
2695
|
+
c(this, "footer", {
|
|
2680
2696
|
x: 0,
|
|
2681
2697
|
y: 0,
|
|
2682
2698
|
width: 0,
|
|
@@ -2685,7 +2701,7 @@ class ci {
|
|
|
2685
2701
|
visibleWidth: 0,
|
|
2686
2702
|
renderRows: []
|
|
2687
2703
|
});
|
|
2688
|
-
|
|
2704
|
+
c(this, "header", {
|
|
2689
2705
|
x: 0,
|
|
2690
2706
|
y: 0,
|
|
2691
2707
|
width: 0,
|
|
@@ -2700,25 +2716,26 @@ class ci {
|
|
|
2700
2716
|
fixedRightCellHeaders: [],
|
|
2701
2717
|
renderCenterCellHeaders: []
|
|
2702
2718
|
});
|
|
2703
|
-
|
|
2719
|
+
c(this, "selector", {
|
|
2704
2720
|
enable: !1,
|
|
2705
2721
|
xArr: [-1, -1],
|
|
2706
2722
|
yArr: [-1, -1],
|
|
2707
2723
|
xArrCopy: [-1, -1],
|
|
2708
2724
|
yArrCopy: [-1, -1]
|
|
2709
2725
|
});
|
|
2710
|
-
|
|
2726
|
+
c(this, "autofill", {
|
|
2711
2727
|
enable: !1,
|
|
2712
2728
|
xArr: [-1, -1],
|
|
2713
2729
|
yArr: [-1, -1]
|
|
2714
2730
|
});
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2731
|
+
c(this, "database");
|
|
2732
|
+
c(this, "history");
|
|
2733
|
+
c(this, "config");
|
|
2734
|
+
const { containerElement: i, stageElement: s, canvasElement: r, overlayerElement: o } = t;
|
|
2735
|
+
this.containerElement = i, this.stageElement = s, this.canvasElement = r, this.overlayerElement = o, this.config = new $t(e.config || {}), this.eventBus = new oi(), this.eventBrowser = new ri(this), this.eventTable = new ci(this), this.paint = new ni(this.canvasElement), this.database = new ii(this, e), this.history = new si(this), this.icons = new ai(this);
|
|
2719
2736
|
}
|
|
2720
2737
|
setConfig(t) {
|
|
2721
|
-
this.config = new
|
|
2738
|
+
this.config = new $t(t);
|
|
2722
2739
|
}
|
|
2723
2740
|
setFocusCell(t) {
|
|
2724
2741
|
var e;
|
|
@@ -2750,7 +2767,7 @@ class ci {
|
|
|
2750
2767
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2751
2768
|
const o = [];
|
|
2752
2769
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
2753
|
-
const
|
|
2770
|
+
const h = r + e[0], l = a + i[0], f = this.database.getItemValueForRowIndexAndColIndex(h, l);
|
|
2754
2771
|
f && o.push(f.value);
|
|
2755
2772
|
}
|
|
2756
2773
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
@@ -2784,16 +2801,12 @@ class ci {
|
|
|
2784
2801
|
return this.isInsideTargetContainer;
|
|
2785
2802
|
}
|
|
2786
2803
|
getOffset(t) {
|
|
2787
|
-
const { left: e, top: i } = this.
|
|
2804
|
+
const { left: e, top: i } = this.containerElement.getBoundingClientRect();
|
|
2788
2805
|
return {
|
|
2789
2806
|
offsetX: t.clientX - e,
|
|
2790
2807
|
offsetY: t.clientY - i
|
|
2791
2808
|
};
|
|
2792
2809
|
}
|
|
2793
|
-
getAllEventBrowserNames() {
|
|
2794
|
-
const t = this.eventBrowser.eventTasks.keys();
|
|
2795
|
-
return Array.from(t);
|
|
2796
|
-
}
|
|
2797
2810
|
hasEvent(t) {
|
|
2798
2811
|
return this.eventBus.has(t);
|
|
2799
2812
|
}
|
|
@@ -2813,31 +2826,31 @@ class ci {
|
|
|
2813
2826
|
this.eventTable.destroy(), this.eventBrowser.destroy(), this.eventBus.destroy();
|
|
2814
2827
|
}
|
|
2815
2828
|
}
|
|
2816
|
-
class
|
|
2829
|
+
class qt {
|
|
2817
2830
|
constructor(t, e) {
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2831
|
+
c(this, "ctx");
|
|
2832
|
+
c(this, "type");
|
|
2833
|
+
c(this, "isFocus", !1);
|
|
2834
|
+
c(this, "trackX", 0);
|
|
2835
|
+
c(this, "trackY", 0);
|
|
2836
|
+
c(this, "trackWidth", 0);
|
|
2837
|
+
c(this, "trackHeight", 0);
|
|
2838
|
+
c(this, "splitPoints", []);
|
|
2826
2839
|
//分割线
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2840
|
+
c(this, "barX", 0);
|
|
2841
|
+
c(this, "barY", 0);
|
|
2842
|
+
c(this, "barWidth", 0);
|
|
2843
|
+
c(this, "barHeight", 0);
|
|
2844
|
+
c(this, "distance", 0);
|
|
2832
2845
|
// 滚动条的长度
|
|
2833
|
-
|
|
2846
|
+
c(this, "visibleDistance", 0);
|
|
2834
2847
|
//可见区域的长度
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2848
|
+
c(this, "clientX", 0);
|
|
2849
|
+
c(this, "clientY", 0);
|
|
2850
|
+
c(this, "dragStart", 0);
|
|
2838
2851
|
// 拖拽开始的位置
|
|
2839
|
-
|
|
2840
|
-
|
|
2852
|
+
c(this, "isDragging", !1);
|
|
2853
|
+
c(this, "scroll", 0);
|
|
2841
2854
|
this.ctx = t, this.type = e, this.type === "vertical" ? this.scroll = this.ctx.scrollY : this.scroll = this.ctx.scrollX;
|
|
2842
2855
|
}
|
|
2843
2856
|
onWheel(t) {
|
|
@@ -2846,7 +2859,7 @@ class Pt {
|
|
|
2846
2859
|
onMouseDown(t) {
|
|
2847
2860
|
if (!(t.target instanceof Element) || !this.ctx.isTarget())
|
|
2848
2861
|
return;
|
|
2849
|
-
if (this.ctx.
|
|
2862
|
+
if (this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize")
|
|
2850
2863
|
return !0;
|
|
2851
2864
|
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2852
2865
|
if (!(s == this.clientX && r == this.clientY)) {
|
|
@@ -2863,7 +2876,7 @@ class Pt {
|
|
|
2863
2876
|
}
|
|
2864
2877
|
onMouseMove(t) {
|
|
2865
2878
|
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2866
|
-
if (this.isOnScrollbar(e, i) && t.target === this.ctx.
|
|
2879
|
+
if (this.isOnScrollbar(e, i) && t.target === this.ctx.canvasElement ? this.isFocus = !0 : this.isFocus = !1, s == this.clientX && r == this.clientY) return;
|
|
2867
2880
|
let o = 0;
|
|
2868
2881
|
if (this.type === "horizontal" ? o = s - this.clientX : o = r - this.clientY, this.isDragging && o !== 0) {
|
|
2869
2882
|
let a = 0;
|
|
@@ -2887,23 +2900,25 @@ class Pt {
|
|
|
2887
2900
|
const {
|
|
2888
2901
|
body: t,
|
|
2889
2902
|
header: e,
|
|
2890
|
-
|
|
2891
|
-
|
|
2903
|
+
stageHeight: i,
|
|
2904
|
+
stageWidth: s,
|
|
2905
|
+
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
2906
|
+
} = this.ctx, a = s, h = i, l = e.height, f = e.width, d = t.height, x = this.ctx.footer.height;
|
|
2892
2907
|
if (this.type === "vertical") {
|
|
2893
|
-
this.visibleDistance =
|
|
2894
|
-
const
|
|
2895
|
-
let
|
|
2896
|
-
|
|
2908
|
+
this.visibleDistance = h - r - l, this.distance = d - this.visibleDistance + x, this.trackX = a - r, this.trackY = 0, this.splitPoints = [this.trackX, l, this.trackX + r, l], this.trackWidth = r, this.trackHeight = h, this.barX = this.trackX - 0.5 + (r - o) / 2, this.barWidth = o;
|
|
2909
|
+
const u = this.distance ? this.visibleDistance / d : 0;
|
|
2910
|
+
let g = Math.floor(u * this.visibleDistance);
|
|
2911
|
+
g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY = l + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2897
2912
|
} else {
|
|
2898
|
-
this.visibleDistance =
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
], this.trackX = 0, this.trackY =
|
|
2904
|
-
const
|
|
2905
|
-
let
|
|
2906
|
-
this.barY = this.trackY
|
|
2913
|
+
this.visibleDistance = a - r, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
2914
|
+
a - r,
|
|
2915
|
+
h - r,
|
|
2916
|
+
a - r,
|
|
2917
|
+
h
|
|
2918
|
+
], this.trackX = 0, this.trackY = h - r, this.trackWidth = a, this.trackHeight = r;
|
|
2919
|
+
const u = this.distance ? this.visibleDistance / f : 0;
|
|
2920
|
+
let g = Math.floor(u * this.visibleDistance);
|
|
2921
|
+
this.barY = this.trackY - 0.5 + (r - o) / 2, g < 30 ? g = 30 : g >= this.visibleDistance && (g = 0), this.barWidth = g, this.barHeight = o, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2907
2922
|
}
|
|
2908
2923
|
}
|
|
2909
2924
|
draw() {
|
|
@@ -2924,10 +2939,10 @@ class Pt {
|
|
|
2924
2939
|
}
|
|
2925
2940
|
class li {
|
|
2926
2941
|
constructor(t) {
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
this.ctx = t, this.verticalScrollbar = new
|
|
2942
|
+
c(this, "ctx");
|
|
2943
|
+
c(this, "verticalScrollbar");
|
|
2944
|
+
c(this, "horizontalScrollbar");
|
|
2945
|
+
this.ctx = t, this.verticalScrollbar = new qt(t, "vertical"), this.horizontalScrollbar = new qt(t, "horizontal"), this.ctx.on("wheel", (e) => this.onWheel(e)), this.ctx.on("mousedown", (e) => this.onMouseDown(e)), this.ctx.on("mousemove", (e) => this.onMouseMove(e)), this.ctx.on("mouseup", () => this.onMouseUp()), this.ctx.on("setScroll", (e, i) => {
|
|
2931
2946
|
this.setScroll(e, i);
|
|
2932
2947
|
}), this.ctx.on("setScrollX", (e) => {
|
|
2933
2948
|
this.setScrollX(e);
|
|
@@ -2980,44 +2995,44 @@ class li {
|
|
|
2980
2995
|
}
|
|
2981
2996
|
class di {
|
|
2982
2997
|
constructor(t) {
|
|
2983
|
-
|
|
2998
|
+
c(this, "ctx");
|
|
2984
2999
|
// 上下文
|
|
2985
|
-
|
|
3000
|
+
c(this, "x", 0);
|
|
2986
3001
|
// x坐标
|
|
2987
|
-
|
|
3002
|
+
c(this, "y", 0);
|
|
2988
3003
|
// y坐标
|
|
2989
|
-
|
|
3004
|
+
c(this, "width", 0);
|
|
2990
3005
|
// 宽度
|
|
2991
|
-
|
|
3006
|
+
c(this, "height", 0);
|
|
2992
3007
|
// 高度
|
|
2993
|
-
|
|
3008
|
+
c(this, "resizeTarget", null);
|
|
2994
3009
|
//调整表头
|
|
2995
|
-
|
|
3010
|
+
c(this, "resizeNum", 0);
|
|
2996
3011
|
// 调整列的数量
|
|
2997
|
-
|
|
3012
|
+
c(this, "isResizing", !1);
|
|
2998
3013
|
// 是否移动中
|
|
2999
|
-
|
|
3014
|
+
c(this, "clientX", 0);
|
|
3000
3015
|
// 鼠标按下时的x轴位置
|
|
3001
|
-
|
|
3016
|
+
c(this, "resizeDiff", 0);
|
|
3002
3017
|
// 是否移动中
|
|
3003
|
-
|
|
3004
|
-
|
|
3018
|
+
c(this, "columnIndex", 0);
|
|
3019
|
+
c(this, "isMouseDown", !1);
|
|
3005
3020
|
// 是否按下
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3021
|
+
c(this, "columns");
|
|
3022
|
+
c(this, "visibleLeafColumns", []);
|
|
3023
|
+
c(this, "visibleHeight", 0);
|
|
3024
|
+
c(this, "visibleWidth", 0);
|
|
3025
|
+
c(this, "allCellHeaders", []);
|
|
3026
|
+
c(this, "leafCellHeaders", []);
|
|
3027
|
+
c(this, "renderLeafCellHeaders", []);
|
|
3028
|
+
c(this, "fixedLeftCellHeaders", []);
|
|
3029
|
+
c(this, "centerCellHeaders", []);
|
|
3030
|
+
c(this, "fixedRightCellHeaders", []);
|
|
3031
|
+
c(this, "renderCenterCellHeaders", []);
|
|
3032
|
+
c(this, "renderFixedCellHeaders", []);
|
|
3018
3033
|
this.ctx = t, this.ctx.on(
|
|
3019
3034
|
"resetHeader",
|
|
3020
|
-
|
|
3035
|
+
ee(() => {
|
|
3021
3036
|
this.init(), this.ctx.emit("draw");
|
|
3022
3037
|
}, 100)
|
|
3023
3038
|
), this.init(), this.initResizeColumn();
|
|
@@ -3027,15 +3042,15 @@ class di {
|
|
|
3027
3042
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
3028
3043
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3029
3044
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3030
|
-
const s =
|
|
3045
|
+
const s = ie(i), r = _t(i);
|
|
3031
3046
|
this.height = t * s, this.width = r.reduce((d, x) => d + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
3032
|
-
const o = Je(
|
|
3047
|
+
const o = Je(se(i, s));
|
|
3033
3048
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3034
|
-
const a = this.ctx.
|
|
3035
|
-
this.resizeNum > 0 ? this.ctx.
|
|
3036
|
-
const
|
|
3037
|
-
if (this.resizeNum &&
|
|
3038
|
-
const d = Math.floor(
|
|
3049
|
+
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3050
|
+
this.resizeNum > 0 ? this.ctx.stageWidth = Math.floor(a.width) : this.ctx.stageWidth = Math.floor(this.width + e), this.ctx.stageElement.style.width = this.ctx.stageWidth - 0.5 + "px", this.visibleWidth = this.ctx.stageWidth - e;
|
|
3051
|
+
const h = this.visibleWidth - this.width;
|
|
3052
|
+
if (this.resizeNum && h > 0) {
|
|
3053
|
+
const d = Math.floor(h / this.resizeNum * 100) / 100;
|
|
3039
3054
|
this.resizeAllColumn(d);
|
|
3040
3055
|
}
|
|
3041
3056
|
const l = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
@@ -3055,7 +3070,7 @@ class di {
|
|
|
3055
3070
|
}), this.ctx.on("mousemove", (e) => {
|
|
3056
3071
|
if (this.ctx.editing) return;
|
|
3057
3072
|
const {
|
|
3058
|
-
|
|
3073
|
+
stageWidth: i,
|
|
3059
3074
|
config: { RESIZE_COLUMN_MIN_WIDTH: s }
|
|
3060
3075
|
} = this.ctx;
|
|
3061
3076
|
if (this.isResizing && this.resizeTarget) {
|
|
@@ -3065,12 +3080,12 @@ class di {
|
|
|
3065
3080
|
} else {
|
|
3066
3081
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3067
3082
|
return;
|
|
3068
|
-
this.ctx.
|
|
3083
|
+
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3069
3084
|
const r = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3070
3085
|
for (const o of r) {
|
|
3071
|
-
const { offsetX: a, offsetY:
|
|
3072
|
-
l > f + o.width - 5 && l < f + o.width + 4 && l < i
|
|
3073
|
-
o.colspan <= 1 && this.ctx.isTarget() &&
|
|
3086
|
+
const { offsetX: a, offsetY: h } = this.ctx.getOffset(e), l = a, f = o.getDrawX();
|
|
3087
|
+
l > f + o.width - 5 && l < f + o.width + 4 && l < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3088
|
+
o.colspan <= 1 && this.ctx.isTarget() && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3074
3089
|
}
|
|
3075
3090
|
}
|
|
3076
3091
|
}));
|
|
@@ -3124,19 +3139,19 @@ class di {
|
|
|
3124
3139
|
let s = e;
|
|
3125
3140
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3126
3141
|
for (let o = 0; o < i; o++) {
|
|
3127
|
-
const a = t[o],
|
|
3142
|
+
const a = t[o], h = r * (a.rowspan || 1), l = r * a.level;
|
|
3128
3143
|
let f = a.width || 100;
|
|
3129
|
-
a.children && (f = _t(a.children).reduce((u,
|
|
3130
|
-
const d = new
|
|
3144
|
+
a.children && (f = _t(a.children).reduce((u, g) => u + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3145
|
+
const d = new ne(this.ctx, this.columnIndex, s, l, f, h, a);
|
|
3131
3146
|
this.ctx.database.setHeader(a.key, d), this.allCellHeaders.push(d), a.children || (this.leafCellHeaders.push(d), d.column.widthFillDisable || this.resizeNum++), a.fixed === "left" ? this.fixedLeftCellHeaders.push(d) : a.fixed === "right" ? this.fixedRightCellHeaders.push(d) : this.centerCellHeaders.push(d), !a.children && this.columnIndex++, a.children && this.render(a.children, s), s += f;
|
|
3132
3147
|
}
|
|
3133
3148
|
}
|
|
3134
3149
|
drawTipLine() {
|
|
3135
3150
|
if (this.isResizing && this.resizeTarget) {
|
|
3136
3151
|
const {
|
|
3137
|
-
|
|
3152
|
+
stageHeight: t,
|
|
3138
3153
|
config: { RESIZE_COLUMN_LINE_COLOR: e }
|
|
3139
|
-
} = this.ctx, i = this.resizeTarget.getDrawX(), s = this.resizeTarget.width, r = i + s + this.resizeDiff - 0.5, o = [r
|
|
3154
|
+
} = this.ctx, i = this.resizeTarget.getDrawX(), s = this.resizeTarget.width, r = i + s + this.resizeDiff - 0.5, o = [r - 0.5, 0, r - 0.5, t];
|
|
3140
3155
|
this.ctx.paint.drawLine(o, {
|
|
3141
3156
|
borderColor: e,
|
|
3142
3157
|
borderWidth: 1
|
|
@@ -3149,7 +3164,7 @@ class di {
|
|
|
3149
3164
|
fixedRightWidth: e,
|
|
3150
3165
|
scrollX: i,
|
|
3151
3166
|
header: s,
|
|
3152
|
-
|
|
3167
|
+
stageWidth: r,
|
|
3153
3168
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3154
3169
|
} = this.ctx;
|
|
3155
3170
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
@@ -3158,9 +3173,9 @@ class di {
|
|
|
3158
3173
|
shadowWidth: 4,
|
|
3159
3174
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3160
3175
|
colorEnd: "rgba(0,0,0,0)"
|
|
3161
|
-
}), i < Math.floor(s.width -
|
|
3162
|
-
const
|
|
3163
|
-
this.ctx.paint.drawShadow(
|
|
3176
|
+
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3177
|
+
const h = s.width - (this.x + this.width) + r - e;
|
|
3178
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3164
3179
|
fillColor: o,
|
|
3165
3180
|
side: "left",
|
|
3166
3181
|
shadowWidth: 4,
|
|
@@ -3187,26 +3202,26 @@ class di {
|
|
|
3187
3202
|
}), this.drawTipLine();
|
|
3188
3203
|
}
|
|
3189
3204
|
}
|
|
3190
|
-
class
|
|
3191
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a,
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType =
|
|
3205
|
+
class ae {
|
|
3206
|
+
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a, h = "body") {
|
|
3207
|
+
c(this, "ctx");
|
|
3208
|
+
c(this, "x", 0);
|
|
3209
|
+
c(this, "y", 0);
|
|
3210
|
+
c(this, "width", 0);
|
|
3211
|
+
c(this, "height");
|
|
3212
|
+
c(this, "cells", []);
|
|
3213
|
+
c(this, "fixedCells", []);
|
|
3214
|
+
c(this, "noFixedCells", []);
|
|
3215
|
+
c(this, "rowIndex", 0);
|
|
3216
|
+
c(this, "rowKey", "");
|
|
3217
|
+
c(this, "rowType", "body");
|
|
3218
|
+
c(this, "data");
|
|
3219
|
+
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType = h, this.data = a, this.update();
|
|
3205
3220
|
}
|
|
3206
3221
|
update() {
|
|
3207
3222
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3208
3223
|
t.renderLeafCellHeaders.forEach((r) => {
|
|
3209
|
-
const o = new
|
|
3224
|
+
const o = new oe(
|
|
3210
3225
|
this.ctx,
|
|
3211
3226
|
this.rowIndex,
|
|
3212
3227
|
r.colIndex,
|
|
@@ -3241,77 +3256,77 @@ class se {
|
|
|
3241
3256
|
}
|
|
3242
3257
|
class fi {
|
|
3243
3258
|
constructor(t) {
|
|
3244
|
-
|
|
3259
|
+
c(this, "resizeTarget", null);
|
|
3245
3260
|
//调整行大小的目标
|
|
3246
|
-
|
|
3261
|
+
c(this, "isMouseDown", !1);
|
|
3247
3262
|
// 是否按下
|
|
3248
|
-
|
|
3263
|
+
c(this, "resizeDiff", 0);
|
|
3249
3264
|
// 是否移动中
|
|
3250
|
-
|
|
3265
|
+
c(this, "clientY", 0);
|
|
3251
3266
|
// 鼠标按下时的y轴位置
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3267
|
+
c(this, "ctx");
|
|
3268
|
+
c(this, "x", 0);
|
|
3269
|
+
c(this, "y", 0);
|
|
3270
|
+
c(this, "width", 0);
|
|
3271
|
+
c(this, "height", 0);
|
|
3272
|
+
c(this, "headIndex", 0);
|
|
3273
|
+
c(this, "tailIndex", 0);
|
|
3274
|
+
c(this, "isResizing", !1);
|
|
3260
3275
|
//是否正在调整大小
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3276
|
+
c(this, "renderRows", []);
|
|
3277
|
+
c(this, "visibleRows", []);
|
|
3278
|
+
c(this, "visibleHeight", 0);
|
|
3279
|
+
c(this, "visibleWidth", 0);
|
|
3280
|
+
c(this, "data", []);
|
|
3266
3281
|
this.ctx = t, this.init(), this.initResizeRow();
|
|
3267
3282
|
}
|
|
3268
3283
|
init() {
|
|
3269
3284
|
const {
|
|
3270
|
-
|
|
3285
|
+
canvasElement: t,
|
|
3271
3286
|
header: e,
|
|
3272
3287
|
database: i,
|
|
3273
3288
|
config: {
|
|
3274
3289
|
FOOTER_FIXED: s,
|
|
3275
3290
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3282
|
-
OFFSET_HEIGHT: x = 0
|
|
3291
|
+
HEIGHT: o,
|
|
3292
|
+
EMPTY_BODY_HEIGHT: a = 0,
|
|
3293
|
+
MAX_HEIGHT: h = 0,
|
|
3294
|
+
ENABLE_OFFSET_HEIGHT: l = 0,
|
|
3295
|
+
OFFSET_HEIGHT: f = 0
|
|
3283
3296
|
}
|
|
3284
3297
|
} = this.ctx;
|
|
3285
3298
|
if (!e.width)
|
|
3286
3299
|
return;
|
|
3287
3300
|
this.x = 0, this.y = e.height;
|
|
3288
|
-
const { data:
|
|
3289
|
-
this.height =
|
|
3290
|
-
const { top:
|
|
3291
|
-
this.width = e.width, this.visibleWidth =
|
|
3292
|
-
const
|
|
3293
|
-
this.data.length || (this.height =
|
|
3294
|
-
const
|
|
3301
|
+
const { data: d, sumHeight: x } = i.getData();
|
|
3302
|
+
this.height = x, this.data = d;
|
|
3303
|
+
const { top: u } = t.getBoundingClientRect();
|
|
3304
|
+
this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
3305
|
+
const g = this.ctx.footer.height;
|
|
3306
|
+
this.data.length || (this.height = a);
|
|
3307
|
+
const w = this.data.length ? "not-empty" : "empty";
|
|
3295
3308
|
this.ctx.emit("emptyChange", {
|
|
3296
|
-
isEmpty:
|
|
3297
|
-
type:
|
|
3309
|
+
isEmpty: w,
|
|
3310
|
+
type: w,
|
|
3298
3311
|
headerHeight: e.height,
|
|
3299
3312
|
bodyHeight: this.height,
|
|
3300
|
-
footerHeight:
|
|
3313
|
+
footerHeight: g,
|
|
3301
3314
|
width: this.width,
|
|
3302
|
-
height: this.data.length ? 0 :
|
|
3315
|
+
height: this.data.length ? 0 : a + g
|
|
3303
3316
|
});
|
|
3304
|
-
let
|
|
3305
|
-
|
|
3306
|
-
let
|
|
3307
|
-
this.data.length &&
|
|
3317
|
+
let p = this.height + e.height + r;
|
|
3318
|
+
p += g;
|
|
3319
|
+
let y = 0;
|
|
3320
|
+
this.data.length && l ? (y = window.innerHeight - u - f, y < 0 && (y = 32, console.error(
|
|
3308
3321
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3309
|
-
))) : this.data.length &&
|
|
3310
|
-
let
|
|
3311
|
-
s ? this.visibleHeight =
|
|
3322
|
+
))) : this.data.length && o ? y = o : this.data.length && h && p > h ? y = h : y = p, y > 0 && (this.ctx.stageHeight = Math.floor(y), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
|
|
3323
|
+
let b = this.ctx.stageHeight - e.height - r;
|
|
3324
|
+
s ? this.visibleHeight = b - g : this.visibleHeight = b, this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = d;
|
|
3325
|
+
const m = window.devicePixelRatio || 1, E = this.ctx.stageWidth * m, C = this.ctx.stageHeight * m;
|
|
3326
|
+
t.width = Math.floor(E), t.height = Math.floor(C), this.ctx.canvasElement.setAttribute(
|
|
3312
3327
|
"style",
|
|
3313
|
-
`
|
|
3314
|
-
);
|
|
3328
|
+
` height:${this.ctx.stageHeight}px;width:${this.ctx.stageWidth}px;`
|
|
3329
|
+
), this.ctx.paint.scale(m);
|
|
3315
3330
|
}
|
|
3316
3331
|
// 调整行的高度
|
|
3317
3332
|
initResizeRow() {
|
|
@@ -3327,7 +3342,7 @@ class fi {
|
|
|
3327
3342
|
}), this.ctx.on("mousemove", (e) => {
|
|
3328
3343
|
if (this.ctx.editing) return;
|
|
3329
3344
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s, a = e.clientY, {
|
|
3330
|
-
|
|
3345
|
+
stageHeight: h,
|
|
3331
3346
|
scrollY: l,
|
|
3332
3347
|
config: { RESIZE_ROW_MIN_HEIGHT: f = 0 }
|
|
3333
3348
|
} = this.ctx;
|
|
@@ -3336,15 +3351,15 @@ class fi {
|
|
|
3336
3351
|
let x = a - this.clientY;
|
|
3337
3352
|
x + d < f && (x = -(d - f)), this.resizeDiff = x, this.ctx.emit("draw");
|
|
3338
3353
|
} else {
|
|
3339
|
-
if (this.resizeTarget = null, this.isMouseDown || this.ctx.
|
|
3354
|
+
if (this.resizeTarget = null, this.isMouseDown || this.ctx.stageElement.style.cursor === "crosshair")
|
|
3340
3355
|
return;
|
|
3341
|
-
this.ctx.
|
|
3356
|
+
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3342
3357
|
for (let d = 0; d < this.renderRows.length; d++) {
|
|
3343
3358
|
const x = this.renderRows[d];
|
|
3344
|
-
if (r > x.y - l + x.height - 1.5 && r < x.y - l + x.height + 1.5 && r <
|
|
3345
|
-
for (let
|
|
3346
|
-
const
|
|
3347
|
-
o >
|
|
3359
|
+
if (r > x.y - l + x.height - 1.5 && r < x.y - l + x.height + 1.5 && r < h - 4)
|
|
3360
|
+
for (let g = 0; g < x.cells.length; g++) {
|
|
3361
|
+
const w = x.cells[g];
|
|
3362
|
+
o > w.drawX + 10 && o < w.drawX + w.width - 10 && w.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
3348
3363
|
}
|
|
3349
3364
|
}
|
|
3350
3365
|
}
|
|
@@ -3364,10 +3379,10 @@ class fi {
|
|
|
3364
3379
|
drawTipLine() {
|
|
3365
3380
|
if (this.isResizing && this.resizeTarget) {
|
|
3366
3381
|
const {
|
|
3367
|
-
|
|
3382
|
+
stageWidth: t,
|
|
3368
3383
|
scrollY: e,
|
|
3369
3384
|
config: { RESIZE_ROW_LINE_COLOR: i }
|
|
3370
|
-
} = this.ctx, s = this.resizeTarget.y - e, r = this.resizeTarget.height, o = s + r + this.resizeDiff - 0.5, a = [0, o
|
|
3385
|
+
} = this.ctx, s = this.resizeTarget.y - e, r = this.resizeTarget.height, o = s + r + this.resizeDiff - 0.5, a = [0, o - 0.5, t, o - 0.5];
|
|
3371
3386
|
this.ctx.paint.drawLine(a, {
|
|
3372
3387
|
borderColor: i,
|
|
3373
3388
|
borderWidth: 1
|
|
@@ -3380,7 +3395,7 @@ class fi {
|
|
|
3380
3395
|
fixedRightWidth: e,
|
|
3381
3396
|
scrollX: i,
|
|
3382
3397
|
header: s,
|
|
3383
|
-
|
|
3398
|
+
stageWidth: r,
|
|
3384
3399
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3385
3400
|
} = this.ctx;
|
|
3386
3401
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
@@ -3389,9 +3404,9 @@ class fi {
|
|
|
3389
3404
|
shadowWidth: 4,
|
|
3390
3405
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3391
3406
|
colorEnd: "rgba(0,0,0,0)"
|
|
3392
|
-
}), i < Math.floor(s.width -
|
|
3393
|
-
const
|
|
3394
|
-
this.ctx.paint.drawShadow(
|
|
3407
|
+
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3408
|
+
const h = s.width - (this.x + this.width) + r - e;
|
|
3409
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3395
3410
|
fillColor: o,
|
|
3396
3411
|
side: "left",
|
|
3397
3412
|
shadowWidth: 4,
|
|
@@ -3415,12 +3430,12 @@ class fi {
|
|
|
3415
3430
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3416
3431
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3417
3432
|
const a = this.binarySearch(o, s);
|
|
3418
|
-
let
|
|
3419
|
-
|
|
3433
|
+
let h = this.binarySearch(o, s + this.visibleHeight);
|
|
3434
|
+
h === -1 && (h = r.length), this.headIndex = Math.max(0, a), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3420
3435
|
const l = [];
|
|
3421
3436
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3422
|
-
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top:
|
|
3423
|
-
l.push(
|
|
3437
|
+
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: g } = this.ctx.database.getPositionForRowIndex(d), w = new ae(this.ctx, d, 0, g + this.y, t.width, u, x);
|
|
3438
|
+
l.push(w);
|
|
3424
3439
|
}
|
|
3425
3440
|
this.renderRows = l, this.ctx.body.renderRows = l;
|
|
3426
3441
|
}
|
|
@@ -3434,15 +3449,15 @@ class fi {
|
|
|
3434
3449
|
}
|
|
3435
3450
|
class xi {
|
|
3436
3451
|
constructor(t) {
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3452
|
+
c(this, "ctx");
|
|
3453
|
+
c(this, "renderRows", []);
|
|
3454
|
+
c(this, "data", []);
|
|
3455
|
+
c(this, "x", 0);
|
|
3456
|
+
c(this, "y", 0);
|
|
3457
|
+
c(this, "width", 0);
|
|
3458
|
+
c(this, "height", 0);
|
|
3459
|
+
c(this, "visibleWidth", 0);
|
|
3460
|
+
c(this, "visibleHeight", 0);
|
|
3446
3461
|
this.ctx = t, this.init();
|
|
3447
3462
|
}
|
|
3448
3463
|
init() {
|
|
@@ -3452,7 +3467,7 @@ class xi {
|
|
|
3452
3467
|
body: e,
|
|
3453
3468
|
config: { CELL_FOOTER_HEIGHT: i, FOOTER_FIXED: s, SCROLLER_TRACK_SIZE: r }
|
|
3454
3469
|
} = this.ctx;
|
|
3455
|
-
this.width = t.width, this.visibleWidth = t.visibleWidth, this.height = this.data.reduce((o) => o + i, 0), this.visibleHeight = this.height, s ? this.y = this.ctx.
|
|
3470
|
+
this.width = t.width, this.visibleWidth = t.visibleWidth, this.height = this.data.reduce((o) => o + i, 0), this.visibleHeight = this.height, s ? 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;
|
|
3456
3471
|
}
|
|
3457
3472
|
drawFiexShadow() {
|
|
3458
3473
|
const {
|
|
@@ -3460,19 +3475,19 @@ class xi {
|
|
|
3460
3475
|
fixedRightWidth: e,
|
|
3461
3476
|
scrollX: i,
|
|
3462
3477
|
header: s,
|
|
3463
|
-
|
|
3478
|
+
stageWidth: r,
|
|
3464
3479
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3465
3480
|
} = this.ctx;
|
|
3466
|
-
let
|
|
3467
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3481
|
+
let h = this.y;
|
|
3482
|
+
if (this.ctx.config.FOOTER_FIXED || (h = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, h, t, this.height, {
|
|
3468
3483
|
fillColor: o,
|
|
3469
3484
|
side: "right",
|
|
3470
3485
|
shadowWidth: 4,
|
|
3471
3486
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3472
3487
|
colorEnd: "rgba(0,0,0,0)"
|
|
3473
|
-
}), i < Math.floor(s.width -
|
|
3474
|
-
const l = s.width - (this.x + this.width) + r
|
|
3475
|
-
this.ctx.paint.drawShadow(l + 1,
|
|
3488
|
+
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3489
|
+
const l = s.width - (this.x + this.width) + r - e;
|
|
3490
|
+
this.ctx.paint.drawShadow(l + 1, h, e, this.height, {
|
|
3476
3491
|
fillColor: o,
|
|
3477
3492
|
side: "left",
|
|
3478
3493
|
shadowWidth: 4,
|
|
@@ -3487,7 +3502,7 @@ class xi {
|
|
|
3487
3502
|
let e = this.y;
|
|
3488
3503
|
const i = [];
|
|
3489
3504
|
this.data.forEach((s, r) => {
|
|
3490
|
-
const o = new
|
|
3505
|
+
const o = new ae(
|
|
3491
3506
|
this.ctx,
|
|
3492
3507
|
r,
|
|
3493
3508
|
0,
|
|
@@ -3510,22 +3525,22 @@ class xi {
|
|
|
3510
3525
|
}
|
|
3511
3526
|
class ui {
|
|
3512
3527
|
constructor(t) {
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3528
|
+
c(this, "isCut", !1);
|
|
3529
|
+
c(this, "isMultipleRow", !1);
|
|
3530
|
+
c(this, "ctx");
|
|
3531
|
+
c(this, "adjustPositionX", "");
|
|
3532
|
+
c(this, "adjustPositionY", "");
|
|
3533
|
+
c(this, "timerX", 0);
|
|
3519
3534
|
// 水平滚动定时器
|
|
3520
|
-
|
|
3535
|
+
c(this, "timerY", 0);
|
|
3521
3536
|
// 垂直滚动定时器
|
|
3522
|
-
|
|
3537
|
+
c(this, "adjustTimer", 0);
|
|
3523
3538
|
this.ctx = t, this.init();
|
|
3524
3539
|
}
|
|
3525
3540
|
init() {
|
|
3526
3541
|
this.ctx.on(
|
|
3527
3542
|
"mousemove",
|
|
3528
|
-
|
|
3543
|
+
ee((t) => {
|
|
3529
3544
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget() && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
|
|
3530
3545
|
(this.ctx.selectorMove || this.ctx.autofillMove) && (s ? this.stopAdjustPosition() : this.startAdjustPosition(t));
|
|
3531
3546
|
}, 100)
|
|
@@ -3538,7 +3553,7 @@ class ui {
|
|
|
3538
3553
|
this.isMultipleRow || this.mouseenter();
|
|
3539
3554
|
}
|
|
3540
3555
|
}), this.ctx.on("cellMousedown", (t, e) => {
|
|
3541
|
-
if (this.ctx.isTarget() && this.ctx.
|
|
3556
|
+
if (this.ctx.isTarget() && this.ctx.stageElement.style.cursor !== "pointer" && !this.ctx.isPointer && this.ctx.stageElement.style.cursor !== "crosshair") {
|
|
3542
3557
|
if (t.operation) {
|
|
3543
3558
|
this.isMultipleRow = !0, this.selectRows(t);
|
|
3544
3559
|
return;
|
|
@@ -3548,7 +3563,7 @@ class ui {
|
|
|
3548
3563
|
}), this.ctx.on("cellHeaderHoverChange", (t) => {
|
|
3549
3564
|
this.ctx.mousedown && this.selectCols(t);
|
|
3550
3565
|
}), this.ctx.on("cellHeaderMousedown", (t) => {
|
|
3551
|
-
this.ctx.
|
|
3566
|
+
this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || this.selectCols(t));
|
|
3552
3567
|
}), this.ctx.on("keydown", (t) => {
|
|
3553
3568
|
if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
|
|
3554
3569
|
this.paste();
|
|
@@ -3614,16 +3629,16 @@ class ui {
|
|
|
3614
3629
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3615
3630
|
const {
|
|
3616
3631
|
SELECTOR_AREA_MIN_X: a,
|
|
3617
|
-
SELECTOR_AREA_MAX_X:
|
|
3632
|
+
SELECTOR_AREA_MAX_X: h,
|
|
3618
3633
|
SELECTOR_AREA_MIN_Y: l,
|
|
3619
3634
|
SELECTOR_AREA_MAX_Y: f,
|
|
3620
3635
|
SELECTOR_AREA_MAX_X_OFFSET: d,
|
|
3621
3636
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
3622
|
-
} = this.ctx.config, u = a,
|
|
3623
|
-
let [y,
|
|
3624
|
-
if (y < u ||
|
|
3637
|
+
} = this.ctx.config, u = a, g = h || this.ctx.maxColIndex - d, w = l, p = f || this.ctx.maxRowIndex - x;
|
|
3638
|
+
let [y, b] = r, [m, E] = o;
|
|
3639
|
+
if (y < u || b > g || m < w || E > p)
|
|
3625
3640
|
return;
|
|
3626
|
-
this.ctx.selector.xArr = [Math.max(u, y), Math.min(
|
|
3641
|
+
this.ctx.selector.xArr = [Math.max(u, y), Math.min(g, b)], this.ctx.selector.yArr = [Math.max(w, m), Math.min(p, E)], this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
|
|
3627
3642
|
}
|
|
3628
3643
|
}
|
|
3629
3644
|
selectCols(t) {
|
|
@@ -3637,15 +3652,15 @@ class ui {
|
|
|
3637
3652
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3638
3653
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
3639
3654
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
3640
|
-
const
|
|
3641
|
-
this.setSelector(
|
|
3655
|
+
const h = [a, t.colIndex + t.colspan - 1], l = [r, o];
|
|
3656
|
+
this.setSelector(h, l);
|
|
3642
3657
|
} else {
|
|
3643
|
-
const
|
|
3644
|
-
this.setSelector(
|
|
3658
|
+
const h = [t.colIndex, a], l = [r, o];
|
|
3659
|
+
this.setSelector(h, l);
|
|
3645
3660
|
}
|
|
3646
3661
|
} else {
|
|
3647
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
3648
|
-
this.setSelector(a,
|
|
3662
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], h = [r, o];
|
|
3663
|
+
this.setSelector(a, h);
|
|
3649
3664
|
}
|
|
3650
3665
|
}
|
|
3651
3666
|
selectAll() {
|
|
@@ -3659,9 +3674,9 @@ class ui {
|
|
|
3659
3674
|
SELECTOR_AREA_MIN_Y: r,
|
|
3660
3675
|
SELECTOR_AREA_MAX_Y: o,
|
|
3661
3676
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3662
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3663
|
-
} = this.ctx.config, l = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex -
|
|
3664
|
-
this.setSelector(u,
|
|
3677
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
3678
|
+
} = this.ctx.config, l = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - h, u = [l, f], g = [d, x];
|
|
3679
|
+
this.setSelector(u, g);
|
|
3665
3680
|
}
|
|
3666
3681
|
}
|
|
3667
3682
|
selectRows(t, e = !0) {
|
|
@@ -3670,16 +3685,16 @@ class ui {
|
|
|
3670
3685
|
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: r } = this.ctx.config, o = s || this.ctx.maxColIndex - r, a = i;
|
|
3671
3686
|
if (e) {
|
|
3672
3687
|
this.ctx.setFocusCell(t);
|
|
3673
|
-
const
|
|
3674
|
-
this.setSelector(
|
|
3688
|
+
const h = [a, o], l = [t.rowIndex, t.rowIndex];
|
|
3689
|
+
this.setSelector(h, l);
|
|
3675
3690
|
}
|
|
3676
3691
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3677
|
-
const { rowIndex:
|
|
3678
|
-
if (t.rowIndex >=
|
|
3679
|
-
const l = [a, o], f = [
|
|
3692
|
+
const { rowIndex: h } = this.ctx.focusCell;
|
|
3693
|
+
if (t.rowIndex >= h) {
|
|
3694
|
+
const l = [a, o], f = [h, t.rowIndex];
|
|
3680
3695
|
this.setSelector(l, f);
|
|
3681
3696
|
} else {
|
|
3682
|
-
const l = [a, o], f = [t.rowIndex,
|
|
3697
|
+
const l = [a, o], f = [t.rowIndex, h];
|
|
3683
3698
|
this.setSelector(l, f);
|
|
3684
3699
|
}
|
|
3685
3700
|
}
|
|
@@ -3689,7 +3704,7 @@ class ui {
|
|
|
3689
3704
|
return;
|
|
3690
3705
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3691
3706
|
if (t && e && i) {
|
|
3692
|
-
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r),
|
|
3707
|
+
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r), h = Math.min(i.rowIndex, s), l = Math.max(i.rowIndex, s), f = [o, a], d = [h, l];
|
|
3693
3708
|
this.setSelector(f, d);
|
|
3694
3709
|
}
|
|
3695
3710
|
}
|
|
@@ -3697,7 +3712,7 @@ class ui {
|
|
|
3697
3712
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3698
3713
|
if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
|
|
3699
3714
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3700
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e,
|
|
3715
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e, h = Math.min(o, s), l = Math.max(o, s), f = Math.min(a, r), d = Math.max(a, r), x = [h, l], u = [f, d];
|
|
3701
3716
|
this.setSelector(x, u);
|
|
3702
3717
|
} else {
|
|
3703
3718
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3734,8 +3749,8 @@ class ui {
|
|
|
3734
3749
|
let s = [];
|
|
3735
3750
|
const r = /* @__PURE__ */ new Set();
|
|
3736
3751
|
for (let a = 0; a <= e[1] - e[0]; a++)
|
|
3737
|
-
for (let
|
|
3738
|
-
const l = a + e[0], f =
|
|
3752
|
+
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
3753
|
+
const l = a + e[0], f = h + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(l, f);
|
|
3739
3754
|
if (d) {
|
|
3740
3755
|
const { rowKey: x, key: u } = d;
|
|
3741
3756
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
@@ -3770,16 +3785,16 @@ class ui {
|
|
|
3770
3785
|
for (let l = 0; l <= o.length - 1; l++) {
|
|
3771
3786
|
const f = o[l].length;
|
|
3772
3787
|
for (let d = 0; d <= f - 1; d++) {
|
|
3773
|
-
const x = l + e, u = d + i,
|
|
3788
|
+
const x = l + e, u = d + i, g = o[l][d], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3774
3789
|
x,
|
|
3775
3790
|
u
|
|
3776
3791
|
);
|
|
3777
|
-
if (
|
|
3778
|
-
const { rowKey:
|
|
3779
|
-
this.ctx.database.getReadonly(
|
|
3780
|
-
rowKey:
|
|
3792
|
+
if (w) {
|
|
3793
|
+
const { rowKey: p, key: y } = w;
|
|
3794
|
+
this.ctx.database.getReadonly(p, y) || (s.add(p), a.push({
|
|
3795
|
+
rowKey: p,
|
|
3781
3796
|
key: y,
|
|
3782
|
-
value:
|
|
3797
|
+
value: g,
|
|
3783
3798
|
row: {}
|
|
3784
3799
|
//内部有设置
|
|
3785
3800
|
}));
|
|
@@ -3800,10 +3815,10 @@ class ui {
|
|
|
3800
3815
|
if (!a.length)
|
|
3801
3816
|
return;
|
|
3802
3817
|
this.ctx.database.batchSetItemValue(a, !0);
|
|
3803
|
-
let
|
|
3818
|
+
let h = [];
|
|
3804
3819
|
s.forEach((l) => {
|
|
3805
|
-
|
|
3806
|
-
}), this.ctx.emit("pasteChange", a,
|
|
3820
|
+
h.push(this.ctx.database.getRowDataItemForRowKey(l));
|
|
3821
|
+
}), this.ctx.emit("pasteChange", a, h), this.clearCopyLine(), this.ctx.emit("drawView");
|
|
3807
3822
|
}).catch((r) => {
|
|
3808
3823
|
console.error("获取剪贴板内容失败:", r);
|
|
3809
3824
|
});
|
|
@@ -3819,7 +3834,7 @@ class ui {
|
|
|
3819
3834
|
if (!e)
|
|
3820
3835
|
return;
|
|
3821
3836
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3822
|
-
const r = 0, o = 0, a = this.ctx.maxColIndex,
|
|
3837
|
+
const r = 0, o = 0, a = this.ctx.maxColIndex, h = this.ctx.maxRowIndex;
|
|
3823
3838
|
switch (t) {
|
|
3824
3839
|
case "LEFT":
|
|
3825
3840
|
i > r && i--;
|
|
@@ -3831,7 +3846,7 @@ class ui {
|
|
|
3831
3846
|
i < a && i++;
|
|
3832
3847
|
break;
|
|
3833
3848
|
case "BOTTOM":
|
|
3834
|
-
s <
|
|
3849
|
+
s < h && s++;
|
|
3835
3850
|
break;
|
|
3836
3851
|
}
|
|
3837
3852
|
const l = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
@@ -3848,8 +3863,8 @@ class ui {
|
|
|
3848
3863
|
SELECTOR_AREA_MIN_Y: r,
|
|
3849
3864
|
SELECTOR_AREA_MAX_Y: o,
|
|
3850
3865
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3851
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3852
|
-
} = this.ctx.config, l = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex -
|
|
3866
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
3867
|
+
} = this.ctx.config, l = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - h;
|
|
3853
3868
|
return !(e < l || e > f || t < d || t > x);
|
|
3854
3869
|
}
|
|
3855
3870
|
/**
|
|
@@ -3863,7 +3878,7 @@ class ui {
|
|
|
3863
3878
|
let a = 10 * (s === "left" ? -1 : 1);
|
|
3864
3879
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3865
3880
|
a *= 1.5;
|
|
3866
|
-
const { scrollX:
|
|
3881
|
+
const { scrollX: h } = this.ctx, l = h + a;
|
|
3867
3882
|
(l < 0 || l > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(l);
|
|
3868
3883
|
}, 100);
|
|
3869
3884
|
}
|
|
@@ -3872,7 +3887,7 @@ class ui {
|
|
|
3872
3887
|
let a = 10 * (r === "top" ? -1 : 1);
|
|
3873
3888
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3874
3889
|
a *= 1.5;
|
|
3875
|
-
const { scrollY:
|
|
3890
|
+
const { scrollY: h } = this.ctx, l = h + a;
|
|
3876
3891
|
(l < 0 || l > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(l);
|
|
3877
3892
|
}, 100);
|
|
3878
3893
|
}
|
|
@@ -3882,23 +3897,24 @@ class ui {
|
|
|
3882
3897
|
*/
|
|
3883
3898
|
adjustBoundaryPosition() {
|
|
3884
3899
|
const {
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3900
|
+
stageHeight: t,
|
|
3901
|
+
stageWidth: e,
|
|
3902
|
+
focusCell: i,
|
|
3903
|
+
fixedRightWidth: s,
|
|
3904
|
+
fixedLeftWidth: r,
|
|
3905
|
+
header: o,
|
|
3906
|
+
footer: a,
|
|
3907
|
+
scrollX: h,
|
|
3908
|
+
scrollY: l
|
|
3893
3909
|
} = this.ctx;
|
|
3894
|
-
if (!
|
|
3910
|
+
if (!i)
|
|
3895
3911
|
return;
|
|
3896
|
-
const { SCROLLER_TRACK_SIZE:
|
|
3897
|
-
let
|
|
3898
|
-
|
|
3899
|
-
const
|
|
3912
|
+
const { SCROLLER_TRACK_SIZE: f = 0, FOOTER_FIXED: d } = this.ctx.config;
|
|
3913
|
+
let x = 0;
|
|
3914
|
+
d && (x = a.visibleHeight);
|
|
3915
|
+
const u = r - i.drawX + 1, g = i.drawX + i.width - (e - s) + 1, w = o.height - i.drawY, p = i.drawY + i.height - (t - x - f);
|
|
3900
3916
|
this.adjustTimer && (clearTimeout(this.adjustTimer), this.adjustTimer = 0), this.adjustTimer = setTimeout(() => {
|
|
3901
|
-
|
|
3917
|
+
this.ctx.editing || (g > 0 && !i.fixed ? this.ctx.setScrollX(h + g) : u > 0 && !i.fixed && this.ctx.setScrollX(h - u), w > 0 ? this.ctx.setScrollY(l - w) : p > 0 && this.ctx.setScrollY(l + p));
|
|
3902
3918
|
}, 167);
|
|
3903
3919
|
}
|
|
3904
3920
|
destroy() {
|
|
@@ -3907,20 +3923,20 @@ class ui {
|
|
|
3907
3923
|
}
|
|
3908
3924
|
class gi {
|
|
3909
3925
|
constructor(t) {
|
|
3910
|
-
|
|
3926
|
+
c(this, "ctx");
|
|
3911
3927
|
this.ctx = t, this.init();
|
|
3912
3928
|
}
|
|
3913
3929
|
init() {
|
|
3914
3930
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3915
|
-
this.ctx.
|
|
3916
|
-
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
3917
|
-
if (this.ctx.config.ENABLE_AUTOFILL && l === a && f ===
|
|
3918
|
-
const
|
|
3919
|
-
i >
|
|
3931
|
+
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
|
|
3932
|
+
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1], h = o[1], { colIndex: l, rowIndex: f, drawX: d, drawY: x, width: u, height: g } = t;
|
|
3933
|
+
if (this.ctx.config.ENABLE_AUTOFILL && l === a && f === h) {
|
|
3934
|
+
const p = d + u - 6, y = x + g - 6;
|
|
3935
|
+
i > p && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
3920
3936
|
}
|
|
3921
3937
|
this.mouseenter(t);
|
|
3922
3938
|
}), this.ctx.on("cellMousedown", () => {
|
|
3923
|
-
this.ctx.
|
|
3939
|
+
this.ctx.stageElement.style.cursor === "crosshair" && this.setMousedown();
|
|
3924
3940
|
}), this.ctx.on("mouseup", () => {
|
|
3925
3941
|
this.setMouseUp();
|
|
3926
3942
|
});
|
|
@@ -3947,26 +3963,26 @@ class gi {
|
|
|
3947
3963
|
return;
|
|
3948
3964
|
let o = t, a = e;
|
|
3949
3965
|
if (!r) {
|
|
3950
|
-
const [
|
|
3951
|
-
a = [
|
|
3966
|
+
const [h] = a;
|
|
3967
|
+
a = [h, h];
|
|
3952
3968
|
}
|
|
3953
3969
|
if (!s) {
|
|
3954
|
-
const [
|
|
3955
|
-
o = [
|
|
3970
|
+
const [h] = o;
|
|
3971
|
+
o = [h, h];
|
|
3956
3972
|
}
|
|
3957
3973
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
3958
3974
|
const {
|
|
3959
|
-
SELECTOR_AREA_MIN_X:
|
|
3975
|
+
SELECTOR_AREA_MIN_X: h,
|
|
3960
3976
|
SELECTOR_AREA_MAX_X: l,
|
|
3961
3977
|
SELECTOR_AREA_MIN_Y: f,
|
|
3962
3978
|
SELECTOR_AREA_MAX_Y: d,
|
|
3963
3979
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
3964
3980
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
3965
|
-
} = this.ctx.config,
|
|
3966
|
-
let [
|
|
3967
|
-
if (
|
|
3981
|
+
} = this.ctx.config, g = h, w = l || this.ctx.maxColIndex - x, p = f, y = d || this.ctx.maxRowIndex - u;
|
|
3982
|
+
let [b, m] = o, [E, C] = a;
|
|
3983
|
+
if (b < g || E < p)
|
|
3968
3984
|
return;
|
|
3969
|
-
this.ctx.autofill.xArr = [Math.max(
|
|
3985
|
+
this.ctx.autofill.xArr = [Math.max(g, b), Math.min(w, m)], this.ctx.autofill.yArr = [Math.max(p, E), Math.min(y, C)], this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
3970
3986
|
}
|
|
3971
3987
|
}
|
|
3972
3988
|
/**
|
|
@@ -3976,20 +3992,20 @@ class gi {
|
|
|
3976
3992
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
3977
3993
|
for (let d = 0; d <= e.yArr[1] - e.yArr[0]; d++)
|
|
3978
3994
|
for (let x = 0; x <= e.xArr[1] - e.xArr[0]; x++) {
|
|
3979
|
-
const u = d + e.yArr[0],
|
|
3980
|
-
i.set(`${u}-${
|
|
3995
|
+
const u = d + e.yArr[0], g = x + e.xArr[0];
|
|
3996
|
+
i.set(`${u}-${g}`, !0);
|
|
3981
3997
|
}
|
|
3982
|
-
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr,
|
|
3998
|
+
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr, h = this.ctx.autofill.yArr;
|
|
3983
3999
|
let l = [];
|
|
3984
|
-
for (let d = 0; d <=
|
|
4000
|
+
for (let d = 0; d <= h[1] - h[0]; d++)
|
|
3985
4001
|
for (let x = 0; x <= a[1] - a[0]; x++) {
|
|
3986
|
-
const u = x + a[0],
|
|
3987
|
-
if (
|
|
3988
|
-
const { rowKey:
|
|
3989
|
-
this.ctx.database.getReadonly(
|
|
3990
|
-
rowKey:
|
|
4002
|
+
const u = x + a[0], g = d + h[0], w = s[d % o][x % r], p = this.ctx.database.getItemValueForRowIndexAndColIndex(g, u), y = `${g}-${u}`;
|
|
4003
|
+
if (p && !i.has(y)) {
|
|
4004
|
+
const { rowKey: b, key: m } = p;
|
|
4005
|
+
this.ctx.database.getReadonly(b, m) || (t.add(b), l.push({
|
|
4006
|
+
rowKey: b,
|
|
3991
4007
|
key: m,
|
|
3992
|
-
value:
|
|
4008
|
+
value: w,
|
|
3993
4009
|
row: {}
|
|
3994
4010
|
}));
|
|
3995
4011
|
}
|
|
@@ -4035,10 +4051,10 @@ function at(n, t) {
|
|
|
4035
4051
|
function q(n) {
|
|
4036
4052
|
return n.split("-")[0];
|
|
4037
4053
|
}
|
|
4038
|
-
function
|
|
4054
|
+
function ct(n) {
|
|
4039
4055
|
return n.split("-")[1];
|
|
4040
4056
|
}
|
|
4041
|
-
function
|
|
4057
|
+
function ce(n) {
|
|
4042
4058
|
return n === "x" ? "y" : "x";
|
|
4043
4059
|
}
|
|
4044
4060
|
function Lt(n) {
|
|
@@ -4048,11 +4064,11 @@ function J(n) {
|
|
|
4048
4064
|
return ["top", "bottom"].includes(q(n)) ? "y" : "x";
|
|
4049
4065
|
}
|
|
4050
4066
|
function Mt(n) {
|
|
4051
|
-
return
|
|
4067
|
+
return ce(J(n));
|
|
4052
4068
|
}
|
|
4053
4069
|
function yi(n, t, e) {
|
|
4054
4070
|
e === void 0 && (e = !1);
|
|
4055
|
-
const i =
|
|
4071
|
+
const i = ct(n), s = Mt(n), r = Lt(s);
|
|
4056
4072
|
let o = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4057
4073
|
return t.reference[r] > t.floating[r] && (o = xt(o)), [o, xt(o)];
|
|
4058
4074
|
}
|
|
@@ -4076,15 +4092,15 @@ function Ei(n, t, e) {
|
|
|
4076
4092
|
return [];
|
|
4077
4093
|
}
|
|
4078
4094
|
}
|
|
4079
|
-
function
|
|
4080
|
-
const s =
|
|
4095
|
+
function bi(n, t, e, i) {
|
|
4096
|
+
const s = ct(n);
|
|
4081
4097
|
let r = Ei(q(n), e === "start", i);
|
|
4082
4098
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
4083
4099
|
}
|
|
4084
4100
|
function xt(n) {
|
|
4085
4101
|
return n.replace(/left|right|bottom|top/g, (t) => wi[t]);
|
|
4086
4102
|
}
|
|
4087
|
-
function
|
|
4103
|
+
function Ci(n) {
|
|
4088
4104
|
return {
|
|
4089
4105
|
top: 0,
|
|
4090
4106
|
right: 0,
|
|
@@ -4093,8 +4109,8 @@ function bi(n) {
|
|
|
4093
4109
|
...n
|
|
4094
4110
|
};
|
|
4095
4111
|
}
|
|
4096
|
-
function
|
|
4097
|
-
return typeof n != "number" ?
|
|
4112
|
+
function he(n) {
|
|
4113
|
+
return typeof n != "number" ? Ci(n) : {
|
|
4098
4114
|
top: n,
|
|
4099
4115
|
right: n,
|
|
4100
4116
|
bottom: n,
|
|
@@ -4119,14 +4135,14 @@ function ut(n) {
|
|
|
4119
4135
|
y: e
|
|
4120
4136
|
};
|
|
4121
4137
|
}
|
|
4122
|
-
function
|
|
4138
|
+
function Gt(n, t, e) {
|
|
4123
4139
|
let {
|
|
4124
4140
|
reference: i,
|
|
4125
4141
|
floating: s
|
|
4126
4142
|
} = n;
|
|
4127
|
-
const r = J(t), o = Mt(t), a = Lt(o),
|
|
4143
|
+
const r = J(t), o = Mt(t), a = Lt(o), h = q(t), l = r === "y", f = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, x = i[a] / 2 - s[a] / 2;
|
|
4128
4144
|
let u;
|
|
4129
|
-
switch (
|
|
4145
|
+
switch (h) {
|
|
4130
4146
|
case "top":
|
|
4131
4147
|
u = {
|
|
4132
4148
|
x: f,
|
|
@@ -4157,7 +4173,7 @@ function Vt(n, t, e) {
|
|
|
4157
4173
|
y: i.y
|
|
4158
4174
|
};
|
|
4159
4175
|
}
|
|
4160
|
-
switch (
|
|
4176
|
+
switch (ct(t)) {
|
|
4161
4177
|
case "start":
|
|
4162
4178
|
u[o] -= x * (e && l ? -1 : 1);
|
|
4163
4179
|
break;
|
|
@@ -4173,7 +4189,7 @@ const vi = async (n, t, e) => {
|
|
|
4173
4189
|
strategy: s = "absolute",
|
|
4174
4190
|
middleware: r = [],
|
|
4175
4191
|
platform: o
|
|
4176
|
-
} = e, a = r.filter(Boolean),
|
|
4192
|
+
} = e, a = r.filter(Boolean), h = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4177
4193
|
let l = await o.getElementRects({
|
|
4178
4194
|
reference: n,
|
|
4179
4195
|
floating: t,
|
|
@@ -4181,16 +4197,16 @@ const vi = async (n, t, e) => {
|
|
|
4181
4197
|
}), {
|
|
4182
4198
|
x: f,
|
|
4183
4199
|
y: d
|
|
4184
|
-
} =
|
|
4185
|
-
for (let
|
|
4200
|
+
} = Gt(l, i, h), x = i, u = {}, g = 0;
|
|
4201
|
+
for (let w = 0; w < a.length; w++) {
|
|
4186
4202
|
const {
|
|
4187
|
-
name:
|
|
4203
|
+
name: p,
|
|
4188
4204
|
fn: y
|
|
4189
|
-
} = a[
|
|
4190
|
-
x:
|
|
4205
|
+
} = a[w], {
|
|
4206
|
+
x: b,
|
|
4191
4207
|
y: m,
|
|
4192
4208
|
data: E,
|
|
4193
|
-
reset:
|
|
4209
|
+
reset: C
|
|
4194
4210
|
} = await y({
|
|
4195
4211
|
x: f,
|
|
4196
4212
|
y: d,
|
|
@@ -4205,20 +4221,20 @@ const vi = async (n, t, e) => {
|
|
|
4205
4221
|
floating: t
|
|
4206
4222
|
}
|
|
4207
4223
|
});
|
|
4208
|
-
f =
|
|
4224
|
+
f = b ?? f, d = m ?? d, u = {
|
|
4209
4225
|
...u,
|
|
4210
|
-
[
|
|
4211
|
-
...u[
|
|
4226
|
+
[p]: {
|
|
4227
|
+
...u[p],
|
|
4212
4228
|
...E
|
|
4213
4229
|
}
|
|
4214
|
-
},
|
|
4230
|
+
}, C && g <= 50 && (g++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (l = C.rects === !0 ? await o.getElementRects({
|
|
4215
4231
|
reference: n,
|
|
4216
4232
|
floating: t,
|
|
4217
4233
|
strategy: s
|
|
4218
|
-
}) :
|
|
4234
|
+
}) : C.rects), {
|
|
4219
4235
|
x: f,
|
|
4220
4236
|
y: d
|
|
4221
|
-
} =
|
|
4237
|
+
} = Gt(l, x, h)), w = -1);
|
|
4222
4238
|
}
|
|
4223
4239
|
return {
|
|
4224
4240
|
x: f,
|
|
@@ -4228,7 +4244,7 @@ const vi = async (n, t, e) => {
|
|
|
4228
4244
|
middlewareData: u
|
|
4229
4245
|
};
|
|
4230
4246
|
};
|
|
4231
|
-
async function
|
|
4247
|
+
async function le(n, t) {
|
|
4232
4248
|
var e;
|
|
4233
4249
|
t === void 0 && (t = {});
|
|
4234
4250
|
const {
|
|
@@ -4237,19 +4253,19 @@ async function ne(n, t) {
|
|
|
4237
4253
|
platform: r,
|
|
4238
4254
|
rects: o,
|
|
4239
4255
|
elements: a,
|
|
4240
|
-
strategy:
|
|
4256
|
+
strategy: h
|
|
4241
4257
|
} = n, {
|
|
4242
4258
|
boundary: l = "clippingAncestors",
|
|
4243
4259
|
rootBoundary: f = "viewport",
|
|
4244
4260
|
elementContext: d = "floating",
|
|
4245
4261
|
altBoundary: x = !1,
|
|
4246
4262
|
padding: u = 0
|
|
4247
|
-
} = at(t, n),
|
|
4248
|
-
element: (e = await (r.isElement == null ? void 0 : r.isElement(
|
|
4263
|
+
} = at(t, n), g = he(u), p = a[x ? d === "floating" ? "reference" : "floating" : d], y = ut(await r.getClippingRect({
|
|
4264
|
+
element: (e = await (r.isElement == null ? void 0 : r.isElement(p))) == null || e ? p : p.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(a.floating)),
|
|
4249
4265
|
boundary: l,
|
|
4250
4266
|
rootBoundary: f,
|
|
4251
|
-
strategy:
|
|
4252
|
-
})),
|
|
4267
|
+
strategy: h
|
|
4268
|
+
})), b = d === "floating" ? {
|
|
4253
4269
|
x: i,
|
|
4254
4270
|
y: s,
|
|
4255
4271
|
width: o.floating.width,
|
|
@@ -4260,17 +4276,17 @@ async function ne(n, t) {
|
|
|
4260
4276
|
} : {
|
|
4261
4277
|
x: 1,
|
|
4262
4278
|
y: 1
|
|
4263
|
-
},
|
|
4279
|
+
}, C = ut(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4264
4280
|
elements: a,
|
|
4265
|
-
rect:
|
|
4281
|
+
rect: b,
|
|
4266
4282
|
offsetParent: m,
|
|
4267
|
-
strategy:
|
|
4268
|
-
}) :
|
|
4283
|
+
strategy: h
|
|
4284
|
+
}) : b);
|
|
4269
4285
|
return {
|
|
4270
|
-
top: (y.top -
|
|
4271
|
-
bottom: (
|
|
4272
|
-
left: (y.left -
|
|
4273
|
-
right: (
|
|
4286
|
+
top: (y.top - C.top + g.top) / E.y,
|
|
4287
|
+
bottom: (C.bottom - y.bottom + g.bottom) / E.y,
|
|
4288
|
+
left: (y.left - C.left + g.left) / E.x,
|
|
4289
|
+
right: (C.right - y.right + g.right) / E.x
|
|
4274
4290
|
};
|
|
4275
4291
|
}
|
|
4276
4292
|
const Ri = (n) => ({
|
|
@@ -4284,20 +4300,20 @@ const Ri = (n) => ({
|
|
|
4284
4300
|
rects: r,
|
|
4285
4301
|
platform: o,
|
|
4286
4302
|
elements: a,
|
|
4287
|
-
middlewareData:
|
|
4303
|
+
middlewareData: h
|
|
4288
4304
|
} = t, {
|
|
4289
4305
|
element: l,
|
|
4290
4306
|
padding: f = 0
|
|
4291
4307
|
} = at(n, t) || {};
|
|
4292
4308
|
if (l == null)
|
|
4293
4309
|
return {};
|
|
4294
|
-
const d =
|
|
4310
|
+
const d = he(f), x = {
|
|
4295
4311
|
x: e,
|
|
4296
4312
|
y: i
|
|
4297
|
-
}, u = Mt(s),
|
|
4298
|
-
let
|
|
4299
|
-
(!
|
|
4300
|
-
const A = E / 2 -
|
|
4313
|
+
}, u = Mt(s), g = Lt(u), w = await o.getDimensions(l), p = u === "y", y = p ? "top" : "left", b = p ? "bottom" : "right", m = p ? "clientHeight" : "clientWidth", E = r.reference[g] + r.reference[u] - x[u] - r.floating[g], C = x[u] - r.reference[u], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l));
|
|
4314
|
+
let T = R ? R[m] : 0;
|
|
4315
|
+
(!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T = a.floating[m] || r.floating[g]);
|
|
4316
|
+
const A = E / 2 - C / 2, L = T / 2 - w[g] / 2 - 1, D = rt(d[y], L), B = rt(d[b], L), I = D, S = T - w[g] - B, O = T / 2 - w[g] / 2 + A, G = It(I, O, S), Y = !h.arrow && ct(s) != null && O !== G && r.reference[g] / 2 - (O < I ? D : B) - w[g] / 2 < 0, k = Y ? O < I ? O - I : O - S : 0;
|
|
4301
4317
|
return {
|
|
4302
4318
|
[u]: x[u] + k,
|
|
4303
4319
|
data: {
|
|
@@ -4321,22 +4337,22 @@ const Ri = (n) => ({
|
|
|
4321
4337
|
middlewareData: r,
|
|
4322
4338
|
rects: o,
|
|
4323
4339
|
initialPlacement: a,
|
|
4324
|
-
platform:
|
|
4340
|
+
platform: h,
|
|
4325
4341
|
elements: l
|
|
4326
4342
|
} = t, {
|
|
4327
4343
|
mainAxis: f = !0,
|
|
4328
4344
|
crossAxis: d = !0,
|
|
4329
4345
|
fallbackPlacements: x,
|
|
4330
4346
|
fallbackStrategy: u = "bestFit",
|
|
4331
|
-
fallbackAxisSideDirection:
|
|
4332
|
-
flipAlignment:
|
|
4333
|
-
...
|
|
4347
|
+
fallbackAxisSideDirection: g = "none",
|
|
4348
|
+
flipAlignment: w = !0,
|
|
4349
|
+
...p
|
|
4334
4350
|
} = at(n, t);
|
|
4335
4351
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4336
4352
|
return {};
|
|
4337
|
-
const y = q(s),
|
|
4338
|
-
!x && R &&
|
|
4339
|
-
const
|
|
4353
|
+
const y = q(s), b = J(a), m = q(a) === a, E = await (h.isRTL == null ? void 0 : h.isRTL(l.floating)), C = x || (m || !w ? [xt(a)] : mi(a)), R = g !== "none";
|
|
4354
|
+
!x && R && C.push(...bi(a, w, g, E));
|
|
4355
|
+
const T = [a, ...C], A = await le(t, p), L = [];
|
|
4340
4356
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4341
4357
|
if (f && L.push(A[y]), d) {
|
|
4342
4358
|
const O = yi(s, o, E);
|
|
@@ -4347,7 +4363,7 @@ const Ri = (n) => ({
|
|
|
4347
4363
|
overflows: L
|
|
4348
4364
|
}], !L.every((O) => O <= 0)) {
|
|
4349
4365
|
var B, I;
|
|
4350
|
-
const O = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G =
|
|
4366
|
+
const O = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G = T[O];
|
|
4351
4367
|
if (G)
|
|
4352
4368
|
return {
|
|
4353
4369
|
data: {
|
|
@@ -4362,16 +4378,16 @@ const Ri = (n) => ({
|
|
|
4362
4378
|
if (!Y)
|
|
4363
4379
|
switch (u) {
|
|
4364
4380
|
case "bestFit": {
|
|
4365
|
-
var
|
|
4366
|
-
const k = (
|
|
4381
|
+
var S;
|
|
4382
|
+
const k = (S = D.filter((W) => {
|
|
4367
4383
|
if (R) {
|
|
4368
4384
|
const P = J(W.placement);
|
|
4369
|
-
return P ===
|
|
4385
|
+
return P === b || // Create a bias to the `y` side axis due to horizontal
|
|
4370
4386
|
// reading directions favoring greater width.
|
|
4371
4387
|
P === "y";
|
|
4372
4388
|
}
|
|
4373
4389
|
return !0;
|
|
4374
|
-
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, ye) => P + ye, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 :
|
|
4390
|
+
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, ye) => P + ye, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : S[0];
|
|
4375
4391
|
k && (Y = k);
|
|
4376
4392
|
break;
|
|
4377
4393
|
}
|
|
@@ -4395,11 +4411,11 @@ async function Ii(n, t) {
|
|
|
4395
4411
|
placement: e,
|
|
4396
4412
|
platform: i,
|
|
4397
4413
|
elements: s
|
|
4398
|
-
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a =
|
|
4414
|
+
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a = ct(e), h = J(e) === "y", l = ["left", "top"].includes(o) ? -1 : 1, f = r && h ? -1 : 1, d = at(t, n);
|
|
4399
4415
|
let {
|
|
4400
4416
|
mainAxis: x,
|
|
4401
4417
|
crossAxis: u,
|
|
4402
|
-
alignmentAxis:
|
|
4418
|
+
alignmentAxis: g
|
|
4403
4419
|
} = typeof d == "number" ? {
|
|
4404
4420
|
mainAxis: d,
|
|
4405
4421
|
crossAxis: 0,
|
|
@@ -4409,7 +4425,7 @@ async function Ii(n, t) {
|
|
|
4409
4425
|
crossAxis: d.crossAxis || 0,
|
|
4410
4426
|
alignmentAxis: d.alignmentAxis
|
|
4411
4427
|
};
|
|
4412
|
-
return a && typeof
|
|
4428
|
+
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g), h ? {
|
|
4413
4429
|
x: u * f,
|
|
4414
4430
|
y: x * l
|
|
4415
4431
|
} : {
|
|
@@ -4428,12 +4444,12 @@ const Oi = function(n) {
|
|
|
4428
4444
|
y: r,
|
|
4429
4445
|
placement: o,
|
|
4430
4446
|
middlewareData: a
|
|
4431
|
-
} = t,
|
|
4447
|
+
} = t, h = await Ii(t, n);
|
|
4432
4448
|
return o === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
4433
|
-
x: s +
|
|
4434
|
-
y: r +
|
|
4449
|
+
x: s + h.x,
|
|
4450
|
+
y: r + h.y,
|
|
4435
4451
|
data: {
|
|
4436
|
-
...
|
|
4452
|
+
...h,
|
|
4437
4453
|
placement: o
|
|
4438
4454
|
}
|
|
4439
4455
|
};
|
|
@@ -4452,41 +4468,41 @@ const Oi = function(n) {
|
|
|
4452
4468
|
mainAxis: r = !0,
|
|
4453
4469
|
crossAxis: o = !1,
|
|
4454
4470
|
limiter: a = {
|
|
4455
|
-
fn: (
|
|
4471
|
+
fn: (p) => {
|
|
4456
4472
|
let {
|
|
4457
4473
|
x: y,
|
|
4458
|
-
y:
|
|
4459
|
-
} =
|
|
4474
|
+
y: b
|
|
4475
|
+
} = p;
|
|
4460
4476
|
return {
|
|
4461
4477
|
x: y,
|
|
4462
|
-
y:
|
|
4478
|
+
y: b
|
|
4463
4479
|
};
|
|
4464
4480
|
}
|
|
4465
4481
|
},
|
|
4466
|
-
...
|
|
4482
|
+
...h
|
|
4467
4483
|
} = at(n, t), l = {
|
|
4468
4484
|
x: e,
|
|
4469
4485
|
y: i
|
|
4470
|
-
}, f = await
|
|
4471
|
-
let u = l[x],
|
|
4486
|
+
}, f = await le(t, h), d = J(q(s)), x = ce(d);
|
|
4487
|
+
let u = l[x], g = l[d];
|
|
4472
4488
|
if (r) {
|
|
4473
|
-
const
|
|
4474
|
-
u = It(
|
|
4489
|
+
const p = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", b = u + f[p], m = u - f[y];
|
|
4490
|
+
u = It(b, u, m);
|
|
4475
4491
|
}
|
|
4476
4492
|
if (o) {
|
|
4477
|
-
const
|
|
4478
|
-
|
|
4493
|
+
const p = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", b = g + f[p], m = g - f[y];
|
|
4494
|
+
g = It(b, g, m);
|
|
4479
4495
|
}
|
|
4480
|
-
const
|
|
4496
|
+
const w = a.fn({
|
|
4481
4497
|
...t,
|
|
4482
4498
|
[x]: u,
|
|
4483
|
-
[d]:
|
|
4499
|
+
[d]: g
|
|
4484
4500
|
});
|
|
4485
4501
|
return {
|
|
4486
|
-
...
|
|
4502
|
+
...w,
|
|
4487
4503
|
data: {
|
|
4488
|
-
x:
|
|
4489
|
-
y:
|
|
4504
|
+
x: w.x - e,
|
|
4505
|
+
y: w.y - i,
|
|
4490
4506
|
enabled: {
|
|
4491
4507
|
[x]: r,
|
|
4492
4508
|
[d]: o
|
|
@@ -4500,7 +4516,7 @@ function gt() {
|
|
|
4500
4516
|
return typeof window < "u";
|
|
4501
4517
|
}
|
|
4502
4518
|
function tt(n) {
|
|
4503
|
-
return
|
|
4519
|
+
return de(n) ? (n.nodeName || "").toLowerCase() : "#document";
|
|
4504
4520
|
}
|
|
4505
4521
|
function H(n) {
|
|
4506
4522
|
var t;
|
|
@@ -4508,9 +4524,9 @@ function H(n) {
|
|
|
4508
4524
|
}
|
|
4509
4525
|
function K(n) {
|
|
4510
4526
|
var t;
|
|
4511
|
-
return (t = (
|
|
4527
|
+
return (t = (de(n) ? n.ownerDocument : n.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4512
4528
|
}
|
|
4513
|
-
function
|
|
4529
|
+
function de(n) {
|
|
4514
4530
|
return gt() ? n instanceof Node || n instanceof H(n).Node : !1;
|
|
4515
4531
|
}
|
|
4516
4532
|
function X(n) {
|
|
@@ -4519,10 +4535,10 @@ function X(n) {
|
|
|
4519
4535
|
function N(n) {
|
|
4520
4536
|
return gt() ? n instanceof HTMLElement || n instanceof H(n).HTMLElement : !1;
|
|
4521
4537
|
}
|
|
4522
|
-
function
|
|
4538
|
+
function jt(n) {
|
|
4523
4539
|
return !gt() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof H(n).ShadowRoot;
|
|
4524
4540
|
}
|
|
4525
|
-
function
|
|
4541
|
+
function ht(n) {
|
|
4526
4542
|
const {
|
|
4527
4543
|
overflow: t,
|
|
4528
4544
|
overflowX: e,
|
|
@@ -4583,29 +4599,29 @@ function z(n) {
|
|
|
4583
4599
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
4584
4600
|
n.assignedSlot || // DOM Element detected.
|
|
4585
4601
|
n.parentNode || // ShadowRoot detected.
|
|
4586
|
-
|
|
4602
|
+
jt(n) && n.host || // Fallback.
|
|
4587
4603
|
K(n)
|
|
4588
4604
|
);
|
|
4589
|
-
return
|
|
4605
|
+
return jt(t) ? t.host : t;
|
|
4590
4606
|
}
|
|
4591
|
-
function
|
|
4607
|
+
function fe(n) {
|
|
4592
4608
|
const t = z(n);
|
|
4593
|
-
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) &&
|
|
4609
|
+
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) && ht(t) ? t : fe(t);
|
|
4594
4610
|
}
|
|
4595
4611
|
function Tt(n, t, e) {
|
|
4596
4612
|
var i;
|
|
4597
4613
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4598
|
-
const s =
|
|
4614
|
+
const s = fe(n), r = s === ((i = n.ownerDocument) == null ? void 0 : i.body), o = H(s);
|
|
4599
4615
|
if (r) {
|
|
4600
4616
|
const a = St(o);
|
|
4601
|
-
return t.concat(o, o.visualViewport || [],
|
|
4617
|
+
return t.concat(o, o.visualViewport || [], ht(s) ? s : [], a && e ? Tt(a) : []);
|
|
4602
4618
|
}
|
|
4603
4619
|
return t.concat(s, Tt(s, [], e));
|
|
4604
4620
|
}
|
|
4605
4621
|
function St(n) {
|
|
4606
4622
|
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
|
|
4607
4623
|
}
|
|
4608
|
-
function
|
|
4624
|
+
function xe(n) {
|
|
4609
4625
|
const t = F(n);
|
|
4610
4626
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4611
4627
|
const s = N(n), r = s ? n.offsetWidth : e, o = s ? n.offsetHeight : i, a = ft(e) !== r || ft(i) !== o;
|
|
@@ -4615,18 +4631,18 @@ function ce(n) {
|
|
|
4615
4631
|
$: a
|
|
4616
4632
|
};
|
|
4617
4633
|
}
|
|
4618
|
-
function
|
|
4634
|
+
function ue(n) {
|
|
4619
4635
|
return X(n) ? n : n.contextElement;
|
|
4620
4636
|
}
|
|
4621
4637
|
function Z(n) {
|
|
4622
|
-
const t =
|
|
4638
|
+
const t = ue(n);
|
|
4623
4639
|
if (!N(t))
|
|
4624
4640
|
return V(1);
|
|
4625
4641
|
const e = t.getBoundingClientRect(), {
|
|
4626
4642
|
width: i,
|
|
4627
4643
|
height: s,
|
|
4628
4644
|
$: r
|
|
4629
|
-
} =
|
|
4645
|
+
} = xe(t);
|
|
4630
4646
|
let o = (r ? ft(e.width) : e.width) / i, a = (r ? ft(e.height) : e.height) / s;
|
|
4631
4647
|
return (!o || !Number.isFinite(o)) && (o = 1), (!a || !Number.isFinite(a)) && (a = 1), {
|
|
4632
4648
|
x: o,
|
|
@@ -4634,7 +4650,7 @@ function Z(n) {
|
|
|
4634
4650
|
};
|
|
4635
4651
|
}
|
|
4636
4652
|
const Li = /* @__PURE__ */ V(0);
|
|
4637
|
-
function
|
|
4653
|
+
function ge(n) {
|
|
4638
4654
|
const t = H(n);
|
|
4639
4655
|
return !Dt() || !t.visualViewport ? Li : {
|
|
4640
4656
|
x: t.visualViewport.offsetLeft,
|
|
@@ -4646,23 +4662,23 @@ function Mi(n, t, e) {
|
|
|
4646
4662
|
}
|
|
4647
4663
|
function ot(n, t, e, i) {
|
|
4648
4664
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
4649
|
-
const s = n.getBoundingClientRect(), r =
|
|
4665
|
+
const s = n.getBoundingClientRect(), r = ue(n);
|
|
4650
4666
|
let o = V(1);
|
|
4651
4667
|
t && (i ? X(i) && (o = Z(i)) : o = Z(n));
|
|
4652
|
-
const a = Mi(r, e, i) ?
|
|
4653
|
-
let
|
|
4668
|
+
const a = Mi(r, e, i) ? ge(r) : V(0);
|
|
4669
|
+
let h = (s.left + a.x) / o.x, l = (s.top + a.y) / o.y, f = s.width / o.x, d = s.height / o.y;
|
|
4654
4670
|
if (r) {
|
|
4655
4671
|
const x = H(r), u = i && X(i) ? H(i) : i;
|
|
4656
|
-
let
|
|
4657
|
-
for (;
|
|
4658
|
-
const
|
|
4659
|
-
|
|
4672
|
+
let g = x, w = St(g);
|
|
4673
|
+
for (; w && i && u !== g; ) {
|
|
4674
|
+
const p = Z(w), y = w.getBoundingClientRect(), b = F(w), m = y.left + (w.clientLeft + parseFloat(b.paddingLeft)) * p.x, E = y.top + (w.clientTop + parseFloat(b.paddingTop)) * p.y;
|
|
4675
|
+
h *= p.x, l *= p.y, f *= p.x, d *= p.y, h += m, l += E, g = H(w), w = St(g);
|
|
4660
4676
|
}
|
|
4661
4677
|
}
|
|
4662
4678
|
return ut({
|
|
4663
4679
|
width: f,
|
|
4664
4680
|
height: d,
|
|
4665
|
-
x:
|
|
4681
|
+
x: h,
|
|
4666
4682
|
y: l
|
|
4667
4683
|
});
|
|
4668
4684
|
}
|
|
@@ -4676,20 +4692,20 @@ function Hi(n) {
|
|
|
4676
4692
|
const r = s === "fixed", o = K(i), a = t ? wt(t.floating) : !1;
|
|
4677
4693
|
if (i === o || a && r)
|
|
4678
4694
|
return e;
|
|
4679
|
-
let
|
|
4695
|
+
let h = {
|
|
4680
4696
|
scrollLeft: 0,
|
|
4681
4697
|
scrollTop: 0
|
|
4682
4698
|
}, l = V(1);
|
|
4683
4699
|
const f = V(0), d = N(i);
|
|
4684
|
-
if ((d || !d && !r) && ((tt(i) !== "body" ||
|
|
4700
|
+
if ((d || !d && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), N(i))) {
|
|
4685
4701
|
const x = ot(i);
|
|
4686
4702
|
l = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4687
4703
|
}
|
|
4688
4704
|
return {
|
|
4689
4705
|
width: e.width * l.x,
|
|
4690
4706
|
height: e.height * l.y,
|
|
4691
|
-
x: e.x * l.x -
|
|
4692
|
-
y: e.y * l.y -
|
|
4707
|
+
x: e.x * l.x - h.scrollLeft * l.x + f.x,
|
|
4708
|
+
y: e.y * l.y - h.scrollTop * l.y + f.y
|
|
4693
4709
|
};
|
|
4694
4710
|
}
|
|
4695
4711
|
function Di(n) {
|
|
@@ -4712,29 +4728,29 @@ function Xi(n) {
|
|
|
4712
4728
|
}
|
|
4713
4729
|
function Fi(n, t) {
|
|
4714
4730
|
const e = H(n), i = K(n), s = e.visualViewport;
|
|
4715
|
-
let r = i.clientWidth, o = i.clientHeight, a = 0,
|
|
4731
|
+
let r = i.clientWidth, o = i.clientHeight, a = 0, h = 0;
|
|
4716
4732
|
if (s) {
|
|
4717
4733
|
r = s.width, o = s.height;
|
|
4718
4734
|
const l = Dt();
|
|
4719
|
-
(!l || l && t === "fixed") && (a = s.offsetLeft,
|
|
4735
|
+
(!l || l && t === "fixed") && (a = s.offsetLeft, h = s.offsetTop);
|
|
4720
4736
|
}
|
|
4721
4737
|
return {
|
|
4722
4738
|
width: r,
|
|
4723
4739
|
height: o,
|
|
4724
4740
|
x: a,
|
|
4725
|
-
y:
|
|
4741
|
+
y: h
|
|
4726
4742
|
};
|
|
4727
4743
|
}
|
|
4728
4744
|
function ki(n, t) {
|
|
4729
|
-
const e = ot(n, !0, t === "fixed"), i = e.top + n.clientTop, s = e.left + n.clientLeft, r = N(n) ? Z(n) : V(1), o = n.clientWidth * r.x, a = n.clientHeight * r.y,
|
|
4745
|
+
const e = ot(n, !0, t === "fixed"), i = e.top + n.clientTop, s = e.left + n.clientLeft, r = N(n) ? Z(n) : V(1), o = n.clientWidth * r.x, a = n.clientHeight * r.y, h = s * r.x, l = i * r.y;
|
|
4730
4746
|
return {
|
|
4731
4747
|
width: o,
|
|
4732
4748
|
height: a,
|
|
4733
|
-
x:
|
|
4749
|
+
x: h,
|
|
4734
4750
|
y: l
|
|
4735
4751
|
};
|
|
4736
4752
|
}
|
|
4737
|
-
function
|
|
4753
|
+
function Ut(n, t, e) {
|
|
4738
4754
|
let i;
|
|
4739
4755
|
if (t === "viewport")
|
|
4740
4756
|
i = Fi(n, e);
|
|
@@ -4743,7 +4759,7 @@ function $t(n, t, e) {
|
|
|
4743
4759
|
else if (X(t))
|
|
4744
4760
|
i = ki(t, e);
|
|
4745
4761
|
else {
|
|
4746
|
-
const s =
|
|
4762
|
+
const s = ge(n);
|
|
4747
4763
|
i = {
|
|
4748
4764
|
...t,
|
|
4749
4765
|
x: t.x - s.x,
|
|
@@ -4752,9 +4768,9 @@ function $t(n, t, e) {
|
|
|
4752
4768
|
}
|
|
4753
4769
|
return ut(i);
|
|
4754
4770
|
}
|
|
4755
|
-
function
|
|
4771
|
+
function we(n, t) {
|
|
4756
4772
|
const e = z(n);
|
|
4757
|
-
return e === t || !X(e) || Q(e) ? !1 : F(e).position === "fixed" ||
|
|
4773
|
+
return e === t || !X(e) || Q(e) ? !1 : F(e).position === "fixed" || we(e, t);
|
|
4758
4774
|
}
|
|
4759
4775
|
function Ni(n, t) {
|
|
4760
4776
|
const e = t.get(n);
|
|
@@ -4764,8 +4780,8 @@ function Ni(n, t) {
|
|
|
4764
4780
|
const r = F(n).position === "fixed";
|
|
4765
4781
|
let o = r ? z(n) : n;
|
|
4766
4782
|
for (; X(o) && !Q(o); ) {
|
|
4767
|
-
const a = F(o),
|
|
4768
|
-
!
|
|
4783
|
+
const a = F(o), h = Ht(o);
|
|
4784
|
+
!h && a.position === "fixed" && (s = null), (r ? !h && !s : !h && a.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || ht(o) && !h && we(n, o)) ? i = i.filter((f) => f !== o) : s = a, o = z(o);
|
|
4769
4785
|
}
|
|
4770
4786
|
return t.set(n, i), i;
|
|
4771
4787
|
}
|
|
@@ -4776,22 +4792,22 @@ function Yi(n) {
|
|
|
4776
4792
|
rootBoundary: i,
|
|
4777
4793
|
strategy: s
|
|
4778
4794
|
} = n;
|
|
4779
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0],
|
|
4780
|
-
const d =
|
|
4795
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0], h = o.reduce((l, f) => {
|
|
4796
|
+
const d = Ut(t, f, s);
|
|
4781
4797
|
return l.top = U(d.top, l.top), l.right = rt(d.right, l.right), l.bottom = rt(d.bottom, l.bottom), l.left = U(d.left, l.left), l;
|
|
4782
|
-
},
|
|
4798
|
+
}, Ut(t, a, s));
|
|
4783
4799
|
return {
|
|
4784
|
-
width:
|
|
4785
|
-
height:
|
|
4786
|
-
x:
|
|
4787
|
-
y:
|
|
4800
|
+
width: h.right - h.left,
|
|
4801
|
+
height: h.bottom - h.top,
|
|
4802
|
+
x: h.left,
|
|
4803
|
+
y: h.top
|
|
4788
4804
|
};
|
|
4789
4805
|
}
|
|
4790
4806
|
function Ki(n) {
|
|
4791
4807
|
const {
|
|
4792
4808
|
width: t,
|
|
4793
4809
|
height: e
|
|
4794
|
-
} =
|
|
4810
|
+
} = xe(n);
|
|
4795
4811
|
return {
|
|
4796
4812
|
width: t,
|
|
4797
4813
|
height: e
|
|
@@ -4803,19 +4819,19 @@ function Bi(n, t, e) {
|
|
|
4803
4819
|
scrollLeft: 0,
|
|
4804
4820
|
scrollTop: 0
|
|
4805
4821
|
};
|
|
4806
|
-
const
|
|
4822
|
+
const h = V(0);
|
|
4807
4823
|
if (i || !i && !r)
|
|
4808
|
-
if ((tt(t) !== "body" ||
|
|
4824
|
+
if ((tt(t) !== "body" || ht(s)) && (a = pt(t)), i) {
|
|
4809
4825
|
const u = ot(t, !0, r, t);
|
|
4810
|
-
|
|
4811
|
-
} else s && (
|
|
4826
|
+
h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
|
|
4827
|
+
} else s && (h.x = At(s));
|
|
4812
4828
|
let l = 0, f = 0;
|
|
4813
4829
|
if (s && !i && !r) {
|
|
4814
4830
|
const u = s.getBoundingClientRect();
|
|
4815
4831
|
f = u.top + a.scrollTop, l = u.left + a.scrollLeft - // RTL <body> scrollbar.
|
|
4816
4832
|
At(s, u);
|
|
4817
4833
|
}
|
|
4818
|
-
const d = o.left + a.scrollLeft -
|
|
4834
|
+
const d = o.left + a.scrollLeft - h.x - l, x = o.top + a.scrollTop - h.y - f;
|
|
4819
4835
|
return {
|
|
4820
4836
|
x: d,
|
|
4821
4837
|
y: x,
|
|
@@ -4826,7 +4842,7 @@ function Bi(n, t, e) {
|
|
|
4826
4842
|
function mt(n) {
|
|
4827
4843
|
return F(n).position === "static";
|
|
4828
4844
|
}
|
|
4829
|
-
function
|
|
4845
|
+
function Zt(n, t) {
|
|
4830
4846
|
if (!N(n) || F(n).position === "fixed")
|
|
4831
4847
|
return null;
|
|
4832
4848
|
if (t)
|
|
@@ -4834,7 +4850,7 @@ function qt(n, t) {
|
|
|
4834
4850
|
let e = n.offsetParent;
|
|
4835
4851
|
return K(n) === e && (e = e.ownerDocument.body), e;
|
|
4836
4852
|
}
|
|
4837
|
-
function
|
|
4853
|
+
function pe(n, t) {
|
|
4838
4854
|
const e = H(n);
|
|
4839
4855
|
if (wt(n))
|
|
4840
4856
|
return e;
|
|
@@ -4847,13 +4863,13 @@ function xe(n, t) {
|
|
|
4847
4863
|
}
|
|
4848
4864
|
return e;
|
|
4849
4865
|
}
|
|
4850
|
-
let i =
|
|
4866
|
+
let i = Zt(n, t);
|
|
4851
4867
|
for (; i && Si(i) && mt(i); )
|
|
4852
|
-
i =
|
|
4868
|
+
i = Zt(i, t);
|
|
4853
4869
|
return i && Q(i) && mt(i) && !Ht(i) ? e : i || Ai(n) || e;
|
|
4854
4870
|
}
|
|
4855
4871
|
const Wi = async function(n) {
|
|
4856
|
-
const t = this.getOffsetParent ||
|
|
4872
|
+
const t = this.getOffsetParent || pe, e = this.getDimensions, i = await e(n.floating);
|
|
4857
4873
|
return {
|
|
4858
4874
|
reference: Bi(n.reference, await t(n.floating), n.strategy),
|
|
4859
4875
|
floating: {
|
|
@@ -4871,14 +4887,14 @@ const Vi = {
|
|
|
4871
4887
|
convertOffsetParentRelativeRectToViewportRelativeRect: Hi,
|
|
4872
4888
|
getDocumentElement: K,
|
|
4873
4889
|
getClippingRect: Yi,
|
|
4874
|
-
getOffsetParent:
|
|
4890
|
+
getOffsetParent: pe,
|
|
4875
4891
|
getElementRects: Wi,
|
|
4876
4892
|
getClientRects: Di,
|
|
4877
4893
|
getDimensions: Ki,
|
|
4878
4894
|
getScale: Z,
|
|
4879
4895
|
isElement: X,
|
|
4880
4896
|
isRTL: Pi
|
|
4881
|
-
},
|
|
4897
|
+
}, Xt = Oi, Ft = Ti, kt = _i, zi = Ri, Nt = (n, t, e) => {
|
|
4882
4898
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
4883
4899
|
platform: Vi,
|
|
4884
4900
|
...e
|
|
@@ -4893,11 +4909,11 @@ const Vi = {
|
|
|
4893
4909
|
};
|
|
4894
4910
|
let $i = class {
|
|
4895
4911
|
constructor(t) {
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4912
|
+
c(this, "ctx");
|
|
4913
|
+
c(this, "enable", !1);
|
|
4914
|
+
c(this, "contentEl");
|
|
4915
|
+
c(this, "floatingEl");
|
|
4916
|
+
c(this, "arrowEl");
|
|
4901
4917
|
this.ctx = t;
|
|
4902
4918
|
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE: r, CSS_PREFIX: o } = this.ctx.config;
|
|
4903
4919
|
this.contentEl = document.createElement("div"), this.arrowEl = document.createElement("div"), this.floatingEl = document.createElement("div"), this.floatingEl.className = `${o}-tooltip`, this.contentEl.className = `${o}-tooltip-content`, this.arrowEl.className = `${o}-tooltip-arrow`;
|
|
@@ -4912,7 +4928,7 @@ let $i = class {
|
|
|
4912
4928
|
borderRadius: "4px",
|
|
4913
4929
|
fontSize: "12px",
|
|
4914
4930
|
...r
|
|
4915
|
-
},
|
|
4931
|
+
}, h = {
|
|
4916
4932
|
position: "absolute",
|
|
4917
4933
|
width: "10px",
|
|
4918
4934
|
height: "10px",
|
|
@@ -4921,13 +4937,13 @@ let $i = class {
|
|
|
4921
4937
|
transform: "rotate(45deg)",
|
|
4922
4938
|
zIndex: a.zIndex
|
|
4923
4939
|
};
|
|
4924
|
-
Object.assign(this.arrowEl.style,
|
|
4940
|
+
Object.assign(this.arrowEl.style, h), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
|
|
4925
4941
|
}
|
|
4926
4942
|
init() {
|
|
4927
4943
|
this.ctx.on("mousemove", (t) => {
|
|
4928
4944
|
if (!this.ctx.isTarget())
|
|
4929
4945
|
return;
|
|
4930
|
-
const e = this.ctx.
|
|
4946
|
+
const e = this.ctx.containerElement.getBoundingClientRect();
|
|
4931
4947
|
e && (t.clientX < e.x || t.clientX > e.x + e.width || t.clientY < e.y || t.clientY > e.y + e.height) && this.hide();
|
|
4932
4948
|
}), this.ctx.on("startEdit", () => {
|
|
4933
4949
|
this.hide();
|
|
@@ -4943,12 +4959,12 @@ let $i = class {
|
|
|
4943
4959
|
this.floatingEl.style.display = "block";
|
|
4944
4960
|
let e = t.getText();
|
|
4945
4961
|
t.message && (e = t.message);
|
|
4946
|
-
const i = this.ctx.
|
|
4962
|
+
const i = this.ctx.containerElement.getBoundingClientRect();
|
|
4947
4963
|
if (!i)
|
|
4948
4964
|
return;
|
|
4949
4965
|
this.enable = !0, this.contentEl.style.maxWidth = `${t.overflowTooltipMaxWidth || 500}px`, this.contentEl.style.width = "100%", this.contentEl.style.display = "inline-block", this.contentEl.style.wordBreak = "break-all", this.contentEl.style.lineHeight = "1.5", this.contentEl.innerText = e;
|
|
4950
4966
|
const s = t.drawX + i.x, r = t.drawY + i.y;
|
|
4951
|
-
|
|
4967
|
+
Nt({
|
|
4952
4968
|
getBoundingClientRect() {
|
|
4953
4969
|
return {
|
|
4954
4970
|
width: t.visibleWidth,
|
|
@@ -4963,12 +4979,12 @@ let $i = class {
|
|
|
4963
4979
|
}
|
|
4964
4980
|
}, this.floatingEl, {
|
|
4965
4981
|
placement: t.overflowTooltipPlacement,
|
|
4966
|
-
middleware: [
|
|
4982
|
+
middleware: [Ft(), kt(), Xt(6), zi({ element: this.arrowEl })]
|
|
4967
4983
|
}).then((a) => {
|
|
4968
|
-
const { x:
|
|
4984
|
+
const { x: h, y: l, placement: f, middlewareData: d } = a;
|
|
4969
4985
|
if (Object.assign(this.floatingEl.style, {
|
|
4970
4986
|
top: `${l}px`,
|
|
4971
|
-
left: `${
|
|
4987
|
+
left: `${h}px`
|
|
4972
4988
|
}), d.arrow) {
|
|
4973
4989
|
const x = d.arrow;
|
|
4974
4990
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5004,11 +5020,11 @@ let $i = class {
|
|
|
5004
5020
|
};
|
|
5005
5021
|
class qi {
|
|
5006
5022
|
constructor(t) {
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5023
|
+
c(this, "editorEl");
|
|
5024
|
+
c(this, "inputEl");
|
|
5025
|
+
c(this, "enable", !1);
|
|
5026
|
+
c(this, "cellTarget", null);
|
|
5027
|
+
c(this, "ctx");
|
|
5012
5028
|
this.ctx = t, this.initTextEditor(), this.init();
|
|
5013
5029
|
}
|
|
5014
5030
|
init() {
|
|
@@ -5058,36 +5074,56 @@ class qi {
|
|
|
5058
5074
|
});
|
|
5059
5075
|
}
|
|
5060
5076
|
initTextEditor() {
|
|
5061
|
-
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("keydown", (
|
|
5077
|
+
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("keydown", (t) => {
|
|
5062
5078
|
if (this.enable) {
|
|
5063
|
-
if (
|
|
5064
|
-
|
|
5065
|
-
const
|
|
5066
|
-
this.inputEl.value =
|
|
5067
|
-
` +
|
|
5079
|
+
if (t.stopPropagation(), (t.altKey || t.metaKey) && t.code === "Enter") {
|
|
5080
|
+
t.preventDefault();
|
|
5081
|
+
const e = this.inputEl.selectionStart, i = this.inputEl.value.substring(0, e), s = this.inputEl.value.substring(e);
|
|
5082
|
+
this.inputEl.value = i + `
|
|
5083
|
+
` + s, this.inputEl.selectionStart = this.inputEl.selectionEnd = e + 1;
|
|
5068
5084
|
return;
|
|
5069
5085
|
}
|
|
5070
|
-
(
|
|
5086
|
+
(t.code === "Escape" || t.code === "Enter") && (t.preventDefault(), this.inputEl.blur());
|
|
5071
5087
|
}
|
|
5072
|
-
}), this.inputEl.addEventListener("input",
|
|
5073
|
-
this.style.height = "auto", this.style.height = `${this.scrollHeight}px`;
|
|
5074
|
-
}), this.inputEl.addEventListener("blur", () => {
|
|
5088
|
+
}), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
5075
5089
|
this.doneEdit();
|
|
5076
|
-
}), this.editorEl = document.createElement("div"), this.editorEl.className = "e-virt-table-editor", this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5090
|
+
}), this.editorEl = document.createElement("div"), this.editorEl.className = "e-virt-table-editor", this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
|
|
5091
|
+
}
|
|
5092
|
+
autoSize() {
|
|
5093
|
+
const t = this.inputEl.scrollHeight;
|
|
5094
|
+
this.inputEl.style.height = "auto", this.inputEl.style.height = `${t}px`;
|
|
5081
5095
|
}
|
|
5082
5096
|
startEditByInput(t) {
|
|
5083
5097
|
if (t.editorType !== "text")
|
|
5084
5098
|
return;
|
|
5085
5099
|
const e = t.getValue(), { width: i } = t, s = t.getDrawX();
|
|
5086
5100
|
let r = t.getDrawY(), { height: o } = t;
|
|
5087
|
-
const {
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5101
|
+
const {
|
|
5102
|
+
config: { CELL_PADDING: a }
|
|
5103
|
+
} = this.ctx;
|
|
5104
|
+
let h = window.innerHeight / 2;
|
|
5105
|
+
h > this.ctx.body.visibleHeight && (h = this.ctx.body.visibleHeight), this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${h}px`, this.inputEl.style.width = `${i - 1}px`, this.inputEl.style.height = `${o - 1}px`, this.inputEl.style.padding = `${a}px`, e !== null && (this.inputEl.value = e), this.inputEl.focus();
|
|
5106
|
+
const l = this.inputEl.value.length;
|
|
5107
|
+
this.inputEl.setSelectionRange(l, l);
|
|
5108
|
+
const { left: f, top: d } = this.ctx.containerElement.getBoundingClientRect(), x = {
|
|
5109
|
+
getBoundingClientRect: () => ({
|
|
5110
|
+
width: 0,
|
|
5111
|
+
height: 0,
|
|
5112
|
+
top: d + r,
|
|
5113
|
+
left: f + s,
|
|
5114
|
+
right: f + s,
|
|
5115
|
+
bottom: d + r,
|
|
5116
|
+
x: s,
|
|
5117
|
+
y: r
|
|
5118
|
+
}),
|
|
5119
|
+
contextElement: document.body
|
|
5120
|
+
};
|
|
5121
|
+
Nt(x, this.editorEl, {
|
|
5122
|
+
placement: "right-start",
|
|
5123
|
+
middleware: [Xt(), Ft(), kt()]
|
|
5124
|
+
}).then(({ x: u, y: g }) => {
|
|
5125
|
+
this.editorEl.style.left = `${u}px`, this.editorEl.style.top = `${g}px`;
|
|
5126
|
+
}), this.inputEl.scrollHeight > o && this.autoSize();
|
|
5091
5127
|
}
|
|
5092
5128
|
doneEditByInput() {
|
|
5093
5129
|
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
@@ -5116,11 +5152,11 @@ class qi {
|
|
|
5116
5152
|
const r = this.ctx.focusCell;
|
|
5117
5153
|
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5118
5154
|
return;
|
|
5119
|
-
const { rowKey: o, key: a } = r,
|
|
5120
|
-
r && !
|
|
5155
|
+
const { rowKey: o, key: a } = r, h = this.ctx.database.getReadonly(o, a);
|
|
5156
|
+
r && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5121
5157
|
}
|
|
5122
5158
|
doneEdit() {
|
|
5123
|
-
this.enable && this.cellTarget && (this.ctx.emit("doneEdit", this.cellTarget), this.doneEditByInput(), this.enable = !1, this.ctx.
|
|
5159
|
+
this.enable && this.cellTarget && (this.ctx.emit("doneEdit", this.cellTarget), this.doneEditByInput(), this.enable = !1, this.ctx.stageElement.focus(), this.ctx.editing = !1, this.cellTarget = null, this.ctx.emit("draw"));
|
|
5124
5160
|
}
|
|
5125
5161
|
destroy() {
|
|
5126
5162
|
var t;
|
|
@@ -5129,14 +5165,14 @@ class qi {
|
|
|
5129
5165
|
}
|
|
5130
5166
|
class Gi {
|
|
5131
5167
|
constructor(t) {
|
|
5132
|
-
|
|
5133
|
-
|
|
5168
|
+
c(this, "ctx");
|
|
5169
|
+
c(this, "emptyEl");
|
|
5134
5170
|
this.ctx = t;
|
|
5135
5171
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX: r } = this.ctx.config;
|
|
5136
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.
|
|
5172
|
+
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: a, bodyHeight: h, footerHeight: l }) => {
|
|
5137
5173
|
if (i)
|
|
5138
5174
|
return;
|
|
5139
|
-
const f = a + (
|
|
5175
|
+
const f = a + (h + l) / 2, d = {
|
|
5140
5176
|
display: o === "empty" ? "block" : "none",
|
|
5141
5177
|
position: "absolute",
|
|
5142
5178
|
fontSize: "14px",
|
|
@@ -5155,7 +5191,7 @@ class Gi {
|
|
|
5155
5191
|
}
|
|
5156
5192
|
class ji {
|
|
5157
5193
|
constructor(t) {
|
|
5158
|
-
|
|
5194
|
+
c(this, "ctx");
|
|
5159
5195
|
this.ctx = t;
|
|
5160
5196
|
}
|
|
5161
5197
|
draw() {
|
|
@@ -5170,24 +5206,25 @@ class ji {
|
|
|
5170
5206
|
}
|
|
5171
5207
|
getContainer() {
|
|
5172
5208
|
const {
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5209
|
+
stageWidth: t,
|
|
5210
|
+
stageHeight: e,
|
|
5211
|
+
config: { SCROLLER_TRACK_SIZE: i }
|
|
5212
|
+
} = this.ctx, s = t - i, r = e - i, o = this.getHeader(), a = this.getBody(), h = this.getFooter();
|
|
5213
|
+
let l = [o, a, h];
|
|
5214
|
+
const { FOOTER_FIXED: f } = this.ctx.config;
|
|
5215
|
+
return f || (l = [o, a]), {
|
|
5179
5216
|
style: {
|
|
5180
5217
|
position: "absolute",
|
|
5181
5218
|
left: "0px",
|
|
5182
5219
|
top: "0px",
|
|
5183
5220
|
userSelect: "none",
|
|
5184
5221
|
overflow: "hidden",
|
|
5185
|
-
width: `${
|
|
5186
|
-
height: `${
|
|
5222
|
+
width: `${s}px`,
|
|
5223
|
+
height: `${r}px`,
|
|
5187
5224
|
zIndex: 10
|
|
5188
5225
|
},
|
|
5189
5226
|
class: "e-virt-table-overlayer",
|
|
5190
|
-
views:
|
|
5227
|
+
views: l
|
|
5191
5228
|
};
|
|
5192
5229
|
}
|
|
5193
5230
|
getHeader() {
|
|
@@ -5196,9 +5233,9 @@ class ji {
|
|
|
5196
5233
|
fixedRightWidth: e,
|
|
5197
5234
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5198
5235
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: a } = this.ctx.header;
|
|
5199
|
-
let
|
|
5200
|
-
a.forEach((
|
|
5201
|
-
|
|
5236
|
+
let h = [], l = [], f = [];
|
|
5237
|
+
a.forEach((p) => {
|
|
5238
|
+
p.render && (p.fixed === "left" ? l.push(p) : p.fixed === "right" ? f.push(p) : h.push(p));
|
|
5202
5239
|
});
|
|
5203
5240
|
const d = e - i, x = {
|
|
5204
5241
|
key: "left",
|
|
@@ -5221,8 +5258,8 @@ class ji {
|
|
|
5221
5258
|
width: `${r - t - d + 1}px`,
|
|
5222
5259
|
height: `${o}px`
|
|
5223
5260
|
},
|
|
5224
|
-
cells:
|
|
5225
|
-
},
|
|
5261
|
+
cells: h
|
|
5262
|
+
}, g = {
|
|
5226
5263
|
key: "right",
|
|
5227
5264
|
style: {
|
|
5228
5265
|
position: "absolute",
|
|
@@ -5243,21 +5280,21 @@ class ji {
|
|
|
5243
5280
|
width: `${r}px`,
|
|
5244
5281
|
height: `${o}px`
|
|
5245
5282
|
},
|
|
5246
|
-
views: [x, u,
|
|
5283
|
+
views: [x, u, g]
|
|
5247
5284
|
};
|
|
5248
5285
|
}
|
|
5249
5286
|
getBody() {
|
|
5250
5287
|
const t = [], e = [], i = [];
|
|
5251
5288
|
let s = this.ctx.body.renderRows;
|
|
5252
|
-
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((
|
|
5253
|
-
|
|
5289
|
+
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((p) => {
|
|
5290
|
+
p.cells.forEach((y) => {
|
|
5254
5291
|
y.cellType === "footer" && (y.render = y.renderFooter), y.render && (y.fixed === "left" ? e.push(y) : y.fixed === "right" ? i.push(y) : t.push(y));
|
|
5255
5292
|
});
|
|
5256
5293
|
});
|
|
5257
5294
|
const {
|
|
5258
5295
|
fixedLeftWidth: r,
|
|
5259
5296
|
fixedRightWidth: o,
|
|
5260
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
5297
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: h }
|
|
5261
5298
|
} = this.ctx, { visibleWidth: l, visibleHeight: f } = this.ctx.body, d = o - a, x = {
|
|
5262
5299
|
key: "left",
|
|
5263
5300
|
style: {
|
|
@@ -5274,13 +5311,13 @@ class ji {
|
|
|
5274
5311
|
style: {
|
|
5275
5312
|
position: "absolute",
|
|
5276
5313
|
top: `${0.5}px`,
|
|
5277
|
-
left: `${r
|
|
5314
|
+
left: `${r - 0.5}px`,
|
|
5278
5315
|
overflow: "hidden",
|
|
5279
5316
|
width: `${l - r - d}px`,
|
|
5280
5317
|
height: `${f}px`
|
|
5281
5318
|
},
|
|
5282
5319
|
cells: t
|
|
5283
|
-
},
|
|
5320
|
+
}, g = {
|
|
5284
5321
|
key: "right",
|
|
5285
5322
|
style: {
|
|
5286
5323
|
position: "absolute",
|
|
@@ -5294,28 +5331,28 @@ class ji {
|
|
|
5294
5331
|
};
|
|
5295
5332
|
return {
|
|
5296
5333
|
type: "body",
|
|
5297
|
-
class: `${
|
|
5334
|
+
class: `${h}-overlayer-body`,
|
|
5298
5335
|
style: {
|
|
5299
5336
|
position: "relative",
|
|
5300
5337
|
overflow: "hidden",
|
|
5301
5338
|
width: `${l}px`,
|
|
5302
5339
|
height: `${f}px`
|
|
5303
5340
|
},
|
|
5304
|
-
views: [x, u,
|
|
5341
|
+
views: [x, u, g]
|
|
5305
5342
|
};
|
|
5306
5343
|
}
|
|
5307
5344
|
getFooter() {
|
|
5308
5345
|
const t = [], e = [], i = [];
|
|
5309
|
-
this.ctx.footer.renderRows.forEach((
|
|
5310
|
-
|
|
5311
|
-
|
|
5346
|
+
this.ctx.footer.renderRows.forEach((w) => {
|
|
5347
|
+
w.cells.forEach((p) => {
|
|
5348
|
+
p.cellType === "footer" && p.renderFooter && (p.render = p.renderFooter, p.fixed === "left" ? e.push(p) : p.fixed === "right" ? i.push(p) : t.push(p));
|
|
5312
5349
|
});
|
|
5313
5350
|
});
|
|
5314
5351
|
const {
|
|
5315
5352
|
fixedLeftWidth: s,
|
|
5316
5353
|
fixedRightWidth: r,
|
|
5317
5354
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: a }
|
|
5318
|
-
} = this.ctx, { visibleWidth:
|
|
5355
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: l } = this.ctx.footer, f = r - o, d = {
|
|
5319
5356
|
key: "left",
|
|
5320
5357
|
style: {
|
|
5321
5358
|
position: "absolute",
|
|
@@ -5331,9 +5368,9 @@ class ji {
|
|
|
5331
5368
|
style: {
|
|
5332
5369
|
position: "absolute",
|
|
5333
5370
|
top: `${0.5}px`,
|
|
5334
|
-
left: `${s
|
|
5371
|
+
left: `${s - 0.5}px`,
|
|
5335
5372
|
overflow: "hidden",
|
|
5336
|
-
width: `${
|
|
5373
|
+
width: `${h - s - f}px`,
|
|
5337
5374
|
height: `${l}px`
|
|
5338
5375
|
},
|
|
5339
5376
|
cells: t
|
|
@@ -5355,7 +5392,7 @@ class ji {
|
|
|
5355
5392
|
style: {
|
|
5356
5393
|
position: "relative",
|
|
5357
5394
|
overflow: "hidden",
|
|
5358
|
-
width: `${
|
|
5395
|
+
width: `${h}px`,
|
|
5359
5396
|
height: `${l}px`
|
|
5360
5397
|
},
|
|
5361
5398
|
views: [d, x, u]
|
|
@@ -5364,16 +5401,16 @@ class ji {
|
|
|
5364
5401
|
}
|
|
5365
5402
|
class Ui {
|
|
5366
5403
|
constructor(t) {
|
|
5367
|
-
|
|
5368
|
-
|
|
5404
|
+
c(this, "ctx");
|
|
5405
|
+
c(this, "contextMenuEl");
|
|
5369
5406
|
this.ctx = t, this.contextMenuEl = document.createElement("div"), this.createContextMenu(), this.init();
|
|
5370
5407
|
}
|
|
5371
5408
|
init() {
|
|
5372
5409
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5373
5410
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5374
5411
|
e.preventDefault();
|
|
5375
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a,
|
|
5376
|
-
l >= a && l <=
|
|
5412
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a, h] = s, { rowIndex: l, colIndex: f } = t;
|
|
5413
|
+
l >= a && l <= h && f >= r && f <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5377
5414
|
const x = {
|
|
5378
5415
|
getBoundingClientRect: () => ({
|
|
5379
5416
|
width: 0,
|
|
@@ -5387,17 +5424,17 @@ class Ui {
|
|
|
5387
5424
|
}),
|
|
5388
5425
|
contextElement: document.body
|
|
5389
5426
|
};
|
|
5390
|
-
|
|
5427
|
+
Nt(x, this.contextMenuEl, {
|
|
5391
5428
|
placement: "right-start",
|
|
5392
|
-
middleware: [
|
|
5393
|
-
}).then(({ x: u, y:
|
|
5394
|
-
this.show(u,
|
|
5429
|
+
middleware: [Xt(), Ft(), kt()]
|
|
5430
|
+
}).then(({ x: u, y: g }) => {
|
|
5431
|
+
this.show(u, g);
|
|
5395
5432
|
});
|
|
5396
5433
|
}), this.ctx.on("click", this.hide.bind(this)), this.ctx.on("onScroll", this.hide.bind(this)), this.ctx.on("resize", this.hide.bind(this));
|
|
5397
5434
|
}
|
|
5398
5435
|
//创建右键菜单,绑定子项点击事件
|
|
5399
5436
|
createContextMenu() {
|
|
5400
|
-
this.contextMenuEl.replaceChildren(), this.contextMenuEl.className = "e-virt-table-context-menu", this.ctx.
|
|
5437
|
+
this.contextMenuEl.replaceChildren(), this.contextMenuEl.className = "e-virt-table-context-menu", this.ctx.containerElement.appendChild(this.contextMenuEl);
|
|
5401
5438
|
const { CONTEXT_MENU: t } = this.ctx.config;
|
|
5402
5439
|
this.createContextMenuItems(t, (e) => {
|
|
5403
5440
|
switch (e.value) {
|
|
@@ -5447,27 +5484,37 @@ class Ui {
|
|
|
5447
5484
|
}
|
|
5448
5485
|
class Qi {
|
|
5449
5486
|
constructor(t, e) {
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
this.
|
|
5487
|
+
c(this, "options");
|
|
5488
|
+
c(this, "scroller");
|
|
5489
|
+
c(this, "header");
|
|
5490
|
+
c(this, "body");
|
|
5491
|
+
c(this, "footer");
|
|
5492
|
+
c(this, "selector");
|
|
5493
|
+
c(this, "autofill");
|
|
5494
|
+
c(this, "tooltip");
|
|
5495
|
+
c(this, "editor");
|
|
5496
|
+
c(this, "empty");
|
|
5497
|
+
c(this, "overlayer");
|
|
5498
|
+
c(this, "contextMenu");
|
|
5499
|
+
c(this, "ctx");
|
|
5500
|
+
this.options = e;
|
|
5501
|
+
const { overlayerElement: i } = e, s = this.createContainer(t, i);
|
|
5502
|
+
this.ctx = new hi(s, this.options), this.header = new di(this.ctx), this.body = new fi(this.ctx), this.footer = new xi(this.ctx), this.scroller = new li(this.ctx), this.selector = new ui(this.ctx), this.autofill = new gi(this.ctx), this.tooltip = new $i(this.ctx), this.empty = new Gi(this.ctx), this.editor = new qi(this.ctx), this.overlayer = new ji(this.ctx), this.contextMenu = new Ui(this.ctx), this.ctx.on("draw", () => {
|
|
5466
5503
|
this.draw();
|
|
5467
5504
|
}), this.ctx.on("drawView", () => {
|
|
5468
5505
|
this.draw(!0);
|
|
5469
5506
|
}), this.draw();
|
|
5470
5507
|
}
|
|
5508
|
+
createContainer(t, e) {
|
|
5509
|
+
t.className = "e-virt-table-container";
|
|
5510
|
+
const i = document.createElement("div"), s = document.createElement("canvas"), r = e || document.createElement("div");
|
|
5511
|
+
return i.className = "e-virt-table-stage", s.className = "e-virt-table-canvas", r.className = "e-virt-table-overlayer", i.appendChild(s), i.appendChild(r), t.appendChild(i), {
|
|
5512
|
+
containerElement: t,
|
|
5513
|
+
stageElement: i,
|
|
5514
|
+
canvasElement: s,
|
|
5515
|
+
overlayerElement: r
|
|
5516
|
+
};
|
|
5517
|
+
}
|
|
5471
5518
|
draw(t = !1) {
|
|
5472
5519
|
requestAnimationFrame(() => {
|
|
5473
5520
|
this.header.update(), this.footer.update(), this.body.update(), this.ctx.paint.clear(), this.body.draw(), this.footer.draw(), this.header.draw(), this.scroller.draw(), t || this.overlayer.draw();
|
|
@@ -5530,8 +5577,8 @@ class Qi {
|
|
|
5530
5577
|
if (t && Array.isArray(s) && s.length) {
|
|
5531
5578
|
const [r] = s;
|
|
5532
5579
|
if (Array.isArray(r) && r.length) {
|
|
5533
|
-
const [o] = r, { rowKey: a, key:
|
|
5534
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
5580
|
+
const [o] = r, { rowKey: a, key: h } = o;
|
|
5581
|
+
this.scrollToRowkey(a), this.scrollToColkey(h);
|
|
5535
5582
|
}
|
|
5536
5583
|
}
|
|
5537
5584
|
i(s);
|
|
@@ -5556,7 +5603,7 @@ class Qi {
|
|
|
5556
5603
|
let r = [];
|
|
5557
5604
|
for (let o = 0; o < i.length; o++)
|
|
5558
5605
|
for (let a = 0; a < s.length; a++) {
|
|
5559
|
-
const
|
|
5606
|
+
const h = this.ctx.database.getRowKeyByItem(i[o]), f = s[a].key, d = await this.ctx.database.getValidator(h, f);
|
|
5560
5607
|
Array.isArray(d) && d.length && r.push(d);
|
|
5561
5608
|
}
|
|
5562
5609
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
@@ -5626,7 +5673,7 @@ class Qi {
|
|
|
5626
5673
|
* 销毁
|
|
5627
5674
|
*/
|
|
5628
5675
|
destroy() {
|
|
5629
|
-
this.overlayer.destroy(), this.empty.destroy(), this.editor.destroy(), this.tooltip.destroy(), this.selector.destroy(), this.autofill.destroy(), this.contextMenu.destroy(), this.ctx.destroy(), this.
|
|
5676
|
+
this.overlayer.destroy(), this.empty.destroy(), this.editor.destroy(), this.tooltip.destroy(), this.selector.destroy(), this.autofill.destroy(), this.contextMenu.destroy(), this.ctx.destroy(), this.ctx.containerElement.remove();
|
|
5630
5677
|
}
|
|
5631
5678
|
}
|
|
5632
5679
|
export {
|