e-virt-table 0.0.8 → 0.0.10
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 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1167 -1169
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Autofill.d.ts +1 -1
- package/dist/lib/Autofill.js +30 -18
- package/dist/lib/Autofill.js.map +1 -1
- package/dist/lib/Cell.d.ts +1 -0
- package/dist/lib/Cell.js +7 -0
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +1 -0
- package/dist/lib/CellHeader.js +7 -0
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Config.d.ts +4 -1
- package/dist/lib/Config.js +23 -5
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/EVirtTable.js +2 -0
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +13 -4
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/Header.d.ts +1 -1
- package/dist/lib/Header.js +26 -31
- package/dist/lib/Header.js.map +1 -1
- package/dist/lib/Scroller.js +0 -1
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.js +32 -16
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -36,11 +36,11 @@ function Ee() {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
function dt(a, t, e) {
|
|
39
|
-
return Ee() ? dt = Reflect.construct.bind() : dt = function(s,
|
|
39
|
+
return Ee() ? dt = Reflect.construct.bind() : dt = function(s, o, r) {
|
|
40
40
|
var n = [null];
|
|
41
|
-
n.push.apply(n,
|
|
42
|
-
var
|
|
43
|
-
return
|
|
41
|
+
n.push.apply(n, o);
|
|
42
|
+
var h = Function.bind.apply(s, n), l = new h();
|
|
43
|
+
return r && st(l, r.prototype), l;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
46
46
|
function be(a) {
|
|
@@ -84,17 +84,17 @@ function Ct(a) {
|
|
|
84
84
|
t[i] = t[i] || [], t[i].push(e);
|
|
85
85
|
}), t;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function M(a) {
|
|
88
88
|
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
|
|
89
89
|
e[i - 1] = arguments[i];
|
|
90
|
-
var s = 0,
|
|
90
|
+
var s = 0, o = e.length;
|
|
91
91
|
if (typeof a == "function")
|
|
92
92
|
return a.apply(null, e);
|
|
93
93
|
if (typeof a == "string") {
|
|
94
|
-
var
|
|
94
|
+
var r = a.replace(Ce, function(n) {
|
|
95
95
|
if (n === "%%")
|
|
96
96
|
return "%";
|
|
97
|
-
if (s >=
|
|
97
|
+
if (s >= o)
|
|
98
98
|
return n;
|
|
99
99
|
switch (n) {
|
|
100
100
|
case "%s":
|
|
@@ -112,7 +112,7 @@ function H(a) {
|
|
|
112
112
|
return n;
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
|
-
return
|
|
115
|
+
return r;
|
|
116
116
|
}
|
|
117
117
|
return a;
|
|
118
118
|
}
|
|
@@ -123,25 +123,25 @@ function I(a, t) {
|
|
|
123
123
|
return !!(a == null || t === "array" && Array.isArray(a) && !a.length || ve(t) && typeof a == "string" && !a);
|
|
124
124
|
}
|
|
125
125
|
function Re(a, t, e) {
|
|
126
|
-
var i = [], s = 0,
|
|
127
|
-
function
|
|
128
|
-
i.push.apply(i, n || []), s++, s ===
|
|
126
|
+
var i = [], s = 0, o = a.length;
|
|
127
|
+
function r(n) {
|
|
128
|
+
i.push.apply(i, n || []), s++, s === o && e(i);
|
|
129
129
|
}
|
|
130
130
|
a.forEach(function(n) {
|
|
131
|
-
t(n,
|
|
131
|
+
t(n, r);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function kt(a, t, e) {
|
|
135
135
|
var i = 0, s = a.length;
|
|
136
|
-
function r
|
|
137
|
-
if (
|
|
138
|
-
e(
|
|
136
|
+
function o(r) {
|
|
137
|
+
if (r && r.length) {
|
|
138
|
+
e(r);
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
var n = i;
|
|
142
|
-
i = i + 1, n < s ? t(a[n],
|
|
142
|
+
i = i + 1, n < s ? t(a[n], o) : e([]);
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
o([]);
|
|
145
145
|
}
|
|
146
146
|
function Ie(a) {
|
|
147
147
|
var t = [];
|
|
@@ -149,7 +149,7 @@ function Ie(a) {
|
|
|
149
149
|
t.push.apply(t, a[e] || []);
|
|
150
150
|
}), t;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var Ft = /* @__PURE__ */ function(a) {
|
|
153
153
|
me(t, a);
|
|
154
154
|
function t(e, i) {
|
|
155
155
|
var s;
|
|
@@ -157,36 +157,36 @@ var Xt = /* @__PURE__ */ function(a) {
|
|
|
157
157
|
}
|
|
158
158
|
return t;
|
|
159
159
|
}(/* @__PURE__ */ bt(Error));
|
|
160
|
-
function
|
|
160
|
+
function _e(a, t, e, i, s) {
|
|
161
161
|
if (t.first) {
|
|
162
|
-
var
|
|
162
|
+
var o = new Promise(function(x, u) {
|
|
163
163
|
var y = function(p) {
|
|
164
|
-
return i(p), p.length ? u(new
|
|
164
|
+
return i(p), p.length ? u(new Ft(p, Ct(p))) : x(s);
|
|
165
165
|
}, g = Ie(a);
|
|
166
|
-
|
|
166
|
+
kt(g, e, y);
|
|
167
167
|
});
|
|
168
|
-
return
|
|
168
|
+
return o.catch(function(x) {
|
|
169
169
|
return x;
|
|
170
|
-
}),
|
|
170
|
+
}), o;
|
|
171
171
|
}
|
|
172
|
-
var
|
|
172
|
+
var r = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a), h = n.length, l = 0, f = [], d = new Promise(function(x, u) {
|
|
173
173
|
var y = function(w) {
|
|
174
|
-
if (
|
|
175
|
-
return i(
|
|
174
|
+
if (f.push.apply(f, w), l++, l === h)
|
|
175
|
+
return i(f), f.length ? u(new Ft(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
|
-
n.length || (i(
|
|
177
|
+
n.length || (i(f), x(s)), n.forEach(function(g) {
|
|
178
178
|
var w = a[g];
|
|
179
|
-
|
|
179
|
+
r.indexOf(g) !== -1 ? kt(w, e, y) : Re(w, e, y);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
|
-
return
|
|
182
|
+
return d.catch(function(x) {
|
|
183
183
|
return x;
|
|
184
|
-
}),
|
|
184
|
+
}), d;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Oe(a) {
|
|
187
187
|
return !!(a && a.message !== void 0);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Se(a, t) {
|
|
190
190
|
for (var e = a, i = 0; i < t.length; i++) {
|
|
191
191
|
if (e == null)
|
|
192
192
|
return e;
|
|
@@ -197,14 +197,14 @@ function Te(a, t) {
|
|
|
197
197
|
function Nt(a, t) {
|
|
198
198
|
return function(e) {
|
|
199
199
|
var i;
|
|
200
|
-
return a.fullFields ? i =
|
|
200
|
+
return a.fullFields ? i = Se(t, a.fullFields) : i = t[e.field || a.fullField], Oe(e) ? (e.field = e.field || a.fullField, e.fieldValue = i, e) : {
|
|
201
201
|
message: typeof e == "function" ? e() : e,
|
|
202
202
|
fieldValue: i,
|
|
203
203
|
field: e.field || a.fullField
|
|
204
204
|
};
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Yt(a, t) {
|
|
208
208
|
if (t) {
|
|
209
209
|
for (var e in t)
|
|
210
210
|
if (t.hasOwnProperty(e)) {
|
|
@@ -214,13 +214,13 @@ function Kt(a, t) {
|
|
|
214
214
|
}
|
|
215
215
|
return a;
|
|
216
216
|
}
|
|
217
|
-
var Gt = function(t, e, i, s,
|
|
218
|
-
t.required && (!i.hasOwnProperty(t.field) || I(e,
|
|
219
|
-
},
|
|
220
|
-
(/^\s+$/.test(e) || e === "") && s.push(
|
|
221
|
-
},
|
|
222
|
-
if (
|
|
223
|
-
return
|
|
217
|
+
var Gt = function(t, e, i, s, o, r) {
|
|
218
|
+
t.required && (!i.hasOwnProperty(t.field) || I(e, r || t.type)) && s.push(M(o.messages.required, t.fullField));
|
|
219
|
+
}, Te = function(t, e, i, s, o) {
|
|
220
|
+
(/^\s+$/.test(e) || e === "") && s.push(M(o.messages.whitespace, t.fullField));
|
|
221
|
+
}, lt, Le = function() {
|
|
222
|
+
if (lt)
|
|
223
|
+
return lt;
|
|
224
224
|
var a = "[a-fA-F\\d:]", t = function(b) {
|
|
225
225
|
return b && b.includeBoundaries ? "(?:(?<=\\s|^)(?=" + a + ")|(?<=" + a + ")(?=\\s|$))" : "";
|
|
226
226
|
}, e = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", i = "[a-fA-F\\d]{1,4}", s = (`
|
|
@@ -234,17 +234,17 @@ var Gt = 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(),
|
|
238
|
-
return b && b.exact ?
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), o = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), r = new RegExp("^" + e + "$"), n = new RegExp("^" + s + "$"), h = function(b) {
|
|
238
|
+
return b && b.exact ? o : new RegExp("(?:" + t(b) + e + t(b) + ")|(?:" + t(b) + s + t(b) + ")", "g");
|
|
239
239
|
};
|
|
240
|
-
|
|
241
|
-
return m && m.exact ?
|
|
242
|
-
},
|
|
240
|
+
h.v4 = function(m) {
|
|
241
|
+
return m && m.exact ? r : new RegExp("" + t(m) + e + t(m), "g");
|
|
242
|
+
}, h.v6 = function(m) {
|
|
243
243
|
return m && m.exact ? n : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var
|
|
246
|
-
return
|
|
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]+)", y = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", g = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", p = '(?:[/?#][^\\s"]*)?', E = "(?:" + l + "|www\\.)" + f + "(?:localhost|" + d + "|" + x + "|" + u + y + g + ")" + w + p;
|
|
246
|
+
return lt = new RegExp("(?:^" + E + "$)", "i"), lt;
|
|
247
|
+
}, Kt = {
|
|
248
248
|
// http://emailregex.com/
|
|
249
249
|
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
250
250
|
// url: new RegExp(
|
|
@@ -284,169 +284,169 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
284
284
|
return typeof t == "function";
|
|
285
285
|
},
|
|
286
286
|
email: function(t) {
|
|
287
|
-
return typeof t == "string" && t.length <= 320 && !!t.match(
|
|
287
|
+
return typeof t == "string" && t.length <= 320 && !!t.match(Kt.email);
|
|
288
288
|
},
|
|
289
289
|
url: function(t) {
|
|
290
290
|
return typeof t == "string" && t.length <= 2048 && !!t.match(Le());
|
|
291
291
|
},
|
|
292
292
|
hex: function(t) {
|
|
293
|
-
return typeof t == "string" && !!t.match(
|
|
293
|
+
return typeof t == "string" && !!t.match(Kt.hex);
|
|
294
294
|
}
|
|
295
|
-
}, Ae = function(t, e, i, s,
|
|
295
|
+
}, Ae = function(t, e, i, s, o) {
|
|
296
296
|
if (t.required && e === void 0) {
|
|
297
|
-
Gt(t, e, i, s,
|
|
297
|
+
Gt(t, e, i, s, o);
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
|
-
var
|
|
301
|
-
|
|
302
|
-
},
|
|
303
|
-
var
|
|
304
|
-
if (x ?
|
|
300
|
+
var r = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], n = t.type;
|
|
301
|
+
r.indexOf(n) > -1 ? et[n](e) || s.push(M(o.messages.types[n], t.fullField, t.type)) : n && typeof e !== t.type && s.push(M(o.messages.types[n], t.fullField, t.type));
|
|
302
|
+
}, Me = function(t, e, i, s, o) {
|
|
303
|
+
var r = typeof t.len == "number", n = 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", y = Array.isArray(e);
|
|
304
|
+
if (x ? d = "number" : u ? d = "string" : y && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
|
-
y && (
|
|
307
|
-
}, j = "enum",
|
|
308
|
-
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(
|
|
309
|
-
}, De = function(t, e, i, s,
|
|
306
|
+
y && (f = e.length), u && (f = e.replace(l, "_").length), r ? f !== t.len && s.push(M(o.messages[d].len, t.fullField, t.len)) : n && !h && f < t.min ? s.push(M(o.messages[d].min, t.fullField, t.min)) : h && !n && f > t.max ? s.push(M(o.messages[d].max, t.fullField, t.max)) : n && h && (f < t.min || f > t.max) && s.push(M(o.messages[d].range, t.fullField, t.min, t.max));
|
|
307
|
+
}, j = "enum", He = function(t, e, i, s, o) {
|
|
308
|
+
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(M(o.messages[j], t.fullField, t[j].join(", ")));
|
|
309
|
+
}, De = function(t, e, i, s, o) {
|
|
310
310
|
if (t.pattern) {
|
|
311
311
|
if (t.pattern instanceof RegExp)
|
|
312
|
-
t.pattern.lastIndex = 0, t.pattern.test(e) || s.push(
|
|
312
|
+
t.pattern.lastIndex = 0, t.pattern.test(e) || s.push(M(o.messages.pattern.mismatch, t.fullField, e, t.pattern));
|
|
313
313
|
else if (typeof t.pattern == "string") {
|
|
314
|
-
var
|
|
315
|
-
|
|
314
|
+
var r = new RegExp(t.pattern);
|
|
315
|
+
r.test(e) || s.push(M(o.messages.pattern.mismatch, t.fullField, e, t.pattern));
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}, v = {
|
|
319
319
|
required: Gt,
|
|
320
|
-
whitespace:
|
|
320
|
+
whitespace: Te,
|
|
321
321
|
type: Ae,
|
|
322
|
-
range:
|
|
323
|
-
enum:
|
|
322
|
+
range: Me,
|
|
323
|
+
enum: He,
|
|
324
324
|
pattern: De
|
|
325
|
-
},
|
|
326
|
-
var
|
|
325
|
+
}, Xe = function(t, e, i, s, o) {
|
|
326
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
327
327
|
if (n) {
|
|
328
328
|
if (I(e, "string") && !t.required)
|
|
329
329
|
return i();
|
|
330
|
-
v.required(t, e, s,
|
|
330
|
+
v.required(t, e, s, r, o, "string"), I(e, "string") || (v.type(t, e, s, r, o), v.range(t, e, s, r, o), v.pattern(t, e, s, r, o), t.whitespace === !0 && v.whitespace(t, e, s, r, o));
|
|
331
331
|
}
|
|
332
|
-
i(
|
|
333
|
-
},
|
|
334
|
-
var
|
|
332
|
+
i(r);
|
|
333
|
+
}, ke = function(t, e, i, s, o) {
|
|
334
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
335
335
|
if (n) {
|
|
336
336
|
if (I(e) && !t.required)
|
|
337
337
|
return i();
|
|
338
|
-
v.required(t, e, s,
|
|
338
|
+
v.required(t, e, s, r, o), e !== void 0 && v.type(t, e, s, r, o);
|
|
339
339
|
}
|
|
340
|
-
i(
|
|
341
|
-
},
|
|
342
|
-
var
|
|
340
|
+
i(r);
|
|
341
|
+
}, Fe = function(t, e, i, s, o) {
|
|
342
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
343
343
|
if (n) {
|
|
344
344
|
if (e === "" && (e = void 0), I(e) && !t.required)
|
|
345
345
|
return i();
|
|
346
|
-
v.required(t, e, s,
|
|
346
|
+
v.required(t, e, s, r, o), e !== void 0 && (v.type(t, e, s, r, o), v.range(t, e, s, r, o));
|
|
347
347
|
}
|
|
348
|
-
i(
|
|
349
|
-
}, Ne = function(t, e, i, s,
|
|
350
|
-
var
|
|
348
|
+
i(r);
|
|
349
|
+
}, Ne = function(t, e, i, s, o) {
|
|
350
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
351
351
|
if (n) {
|
|
352
352
|
if (I(e) && !t.required)
|
|
353
353
|
return i();
|
|
354
|
-
v.required(t, e, s,
|
|
354
|
+
v.required(t, e, s, r, o), e !== void 0 && v.type(t, e, s, r, o);
|
|
355
355
|
}
|
|
356
|
-
i(
|
|
357
|
-
},
|
|
358
|
-
var
|
|
356
|
+
i(r);
|
|
357
|
+
}, Ye = function(t, e, i, s, o) {
|
|
358
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
359
359
|
if (n) {
|
|
360
360
|
if (I(e) && !t.required)
|
|
361
361
|
return i();
|
|
362
|
-
v.required(t, e, s,
|
|
362
|
+
v.required(t, e, s, r, o), I(e) || v.type(t, e, s, r, o);
|
|
363
363
|
}
|
|
364
|
-
i(
|
|
365
|
-
},
|
|
366
|
-
var
|
|
364
|
+
i(r);
|
|
365
|
+
}, Ke = function(t, e, i, s, o) {
|
|
366
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
367
367
|
if (n) {
|
|
368
368
|
if (I(e) && !t.required)
|
|
369
369
|
return i();
|
|
370
|
-
v.required(t, e, s,
|
|
370
|
+
v.required(t, e, s, r, o), e !== void 0 && (v.type(t, e, s, r, o), v.range(t, e, s, r, o));
|
|
371
371
|
}
|
|
372
|
-
i(
|
|
373
|
-
}, Be = function(t, e, i, s,
|
|
374
|
-
var
|
|
372
|
+
i(r);
|
|
373
|
+
}, Be = function(t, e, i, s, o) {
|
|
374
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
375
375
|
if (n) {
|
|
376
376
|
if (I(e) && !t.required)
|
|
377
377
|
return i();
|
|
378
|
-
v.required(t, e, s,
|
|
378
|
+
v.required(t, e, s, r, o), e !== void 0 && (v.type(t, e, s, r, o), v.range(t, e, s, r, o));
|
|
379
379
|
}
|
|
380
|
-
i(
|
|
381
|
-
}, We = function(t, e, i, s,
|
|
382
|
-
var
|
|
380
|
+
i(r);
|
|
381
|
+
}, We = function(t, e, i, s, o) {
|
|
382
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
383
383
|
if (n) {
|
|
384
384
|
if (e == null && !t.required)
|
|
385
385
|
return i();
|
|
386
|
-
v.required(t, e, s,
|
|
386
|
+
v.required(t, e, s, r, o, "array"), e != null && (v.type(t, e, s, r, o), v.range(t, e, s, r, o));
|
|
387
387
|
}
|
|
388
|
-
i(
|
|
389
|
-
}, Pe = function(t, e, i, s,
|
|
390
|
-
var
|
|
388
|
+
i(r);
|
|
389
|
+
}, Pe = function(t, e, i, s, o) {
|
|
390
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
391
391
|
if (n) {
|
|
392
392
|
if (I(e) && !t.required)
|
|
393
393
|
return i();
|
|
394
|
-
v.required(t, e, s,
|
|
394
|
+
v.required(t, e, s, r, o), e !== void 0 && v.type(t, e, s, r, o);
|
|
395
395
|
}
|
|
396
|
-
i(
|
|
397
|
-
}, Ve = "enum", ze = function(t, e, i, s,
|
|
398
|
-
var
|
|
396
|
+
i(r);
|
|
397
|
+
}, Ve = "enum", ze = function(t, e, i, s, o) {
|
|
398
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
399
399
|
if (n) {
|
|
400
400
|
if (I(e) && !t.required)
|
|
401
401
|
return i();
|
|
402
|
-
v.required(t, e, s,
|
|
402
|
+
v.required(t, e, s, r, o), e !== void 0 && v[Ve](t, e, s, r, o);
|
|
403
403
|
}
|
|
404
|
-
i(
|
|
405
|
-
}, $e = function(t, e, i, s,
|
|
406
|
-
var
|
|
404
|
+
i(r);
|
|
405
|
+
}, $e = function(t, e, i, s, o) {
|
|
406
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
407
407
|
if (n) {
|
|
408
408
|
if (I(e, "string") && !t.required)
|
|
409
409
|
return i();
|
|
410
|
-
v.required(t, e, s,
|
|
410
|
+
v.required(t, e, s, r, o), I(e, "string") || v.pattern(t, e, s, r, o);
|
|
411
411
|
}
|
|
412
|
-
i(
|
|
413
|
-
}, qe = function(t, e, i, s,
|
|
414
|
-
var
|
|
412
|
+
i(r);
|
|
413
|
+
}, qe = function(t, e, i, s, o) {
|
|
414
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
415
415
|
if (n) {
|
|
416
416
|
if (I(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
|
-
if (v.required(t, e, s,
|
|
419
|
-
var
|
|
420
|
-
e instanceof Date ?
|
|
418
|
+
if (v.required(t, e, s, r, o), !I(e, "date")) {
|
|
419
|
+
var h;
|
|
420
|
+
e instanceof Date ? h = e : h = new Date(e), v.type(t, h, s, r, o), h && v.range(t, h.getTime(), s, r, o);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
i(
|
|
424
|
-
}, Ge = function(t, e, i, s,
|
|
425
|
-
var
|
|
426
|
-
v.required(t, e, s,
|
|
427
|
-
}, yt = function(t, e, i, s,
|
|
428
|
-
var
|
|
429
|
-
if (
|
|
430
|
-
if (I(e,
|
|
423
|
+
i(r);
|
|
424
|
+
}, Ge = function(t, e, i, s, o) {
|
|
425
|
+
var r = [], n = Array.isArray(e) ? "array" : typeof e;
|
|
426
|
+
v.required(t, e, s, r, o, n), i(r);
|
|
427
|
+
}, yt = function(t, e, i, s, o) {
|
|
428
|
+
var r = t.type, n = [], h = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (h) {
|
|
430
|
+
if (I(e, r) && !t.required)
|
|
431
431
|
return i();
|
|
432
|
-
v.required(t, e, s, n,
|
|
432
|
+
v.required(t, e, s, n, o, r), I(e, r) || v.type(t, e, s, n, o);
|
|
433
433
|
}
|
|
434
434
|
i(n);
|
|
435
|
-
}, je = function(t, e, i, s,
|
|
436
|
-
var
|
|
435
|
+
}, je = function(t, e, i, s, o) {
|
|
436
|
+
var r = [], n = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
437
437
|
if (n) {
|
|
438
438
|
if (I(e) && !t.required)
|
|
439
439
|
return i();
|
|
440
|
-
v.required(t, e, s,
|
|
440
|
+
v.required(t, e, s, r, o);
|
|
441
441
|
}
|
|
442
|
-
i(
|
|
442
|
+
i(r);
|
|
443
443
|
}, it = {
|
|
444
|
-
string:
|
|
445
|
-
method:
|
|
446
|
-
number:
|
|
444
|
+
string: Xe,
|
|
445
|
+
method: ke,
|
|
446
|
+
number: Fe,
|
|
447
447
|
boolean: Ne,
|
|
448
|
-
regexp:
|
|
449
|
-
integer:
|
|
448
|
+
regexp: Ye,
|
|
449
|
+
integer: Ke,
|
|
450
450
|
float: Be,
|
|
451
451
|
array: We,
|
|
452
452
|
object: Pe,
|
|
@@ -523,20 +523,20 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
523
523
|
throw new Error("Cannot configure a schema with no rules");
|
|
524
524
|
if (typeof i != "object" || Array.isArray(i))
|
|
525
525
|
throw new Error("Rules must be an object");
|
|
526
|
-
this.rules = {}, Object.keys(i).forEach(function(
|
|
527
|
-
var
|
|
528
|
-
s.rules[
|
|
526
|
+
this.rules = {}, Object.keys(i).forEach(function(o) {
|
|
527
|
+
var r = i[o];
|
|
528
|
+
s.rules[o] = Array.isArray(r) ? r : [r];
|
|
529
529
|
});
|
|
530
530
|
}, t.messages = function(i) {
|
|
531
|
-
return i && (this._messages =
|
|
532
|
-
}, t.validate = function(i, s,
|
|
533
|
-
var
|
|
534
|
-
s === void 0 && (s = {}),
|
|
531
|
+
return i && (this._messages = Yt(vt(), i)), this._messages;
|
|
532
|
+
}, t.validate = function(i, s, o) {
|
|
533
|
+
var r = this;
|
|
534
|
+
s === void 0 && (s = {}), o === void 0 && (o = function() {
|
|
535
535
|
});
|
|
536
|
-
var n = i,
|
|
537
|
-
if (typeof
|
|
538
|
-
return
|
|
539
|
-
function
|
|
536
|
+
var n = i, h = s, l = o;
|
|
537
|
+
if (typeof h == "function" && (l = h, h = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
|
+
return l && l(null, n), Promise.resolve(n);
|
|
539
|
+
function f(g) {
|
|
540
540
|
var w = [], p = {};
|
|
541
541
|
function E(b) {
|
|
542
542
|
if (Array.isArray(b)) {
|
|
@@ -547,21 +547,21 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
547
547
|
}
|
|
548
548
|
for (var m = 0; m < g.length; m++)
|
|
549
549
|
E(g[m]);
|
|
550
|
-
w.length ? (p = Ct(w),
|
|
550
|
+
w.length ? (p = Ct(w), l(w, p)) : l(null, n);
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
553
|
-
var
|
|
554
|
-
|
|
552
|
+
if (h.messages) {
|
|
553
|
+
var d = this.messages();
|
|
554
|
+
d === Rt && (d = vt()), Yt(d, h.messages), h.messages = d;
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
var x = {}, u =
|
|
556
|
+
h.messages = this.messages();
|
|
557
|
+
var x = {}, u = h.keys || Object.keys(this.rules);
|
|
558
558
|
u.forEach(function(g) {
|
|
559
|
-
var w =
|
|
559
|
+
var w = r.rules[g], p = n[g];
|
|
560
560
|
w.forEach(function(E) {
|
|
561
561
|
var m = E;
|
|
562
562
|
typeof m.transform == "function" && (n === i && (n = $({}, n)), p = n[g] = m.transform(p)), typeof m == "function" ? m = {
|
|
563
563
|
validator: m
|
|
564
|
-
} : m = $({}, m), m.validator =
|
|
564
|
+
} : m = $({}, m), m.validator = r.getValidationMethod(m), m.validator && (m.field = g, m.fullField = m.fullField || g, m.type = r.getType(m), x[g] = x[g] || [], x[g].push({
|
|
565
565
|
rule: m,
|
|
566
566
|
value: p,
|
|
567
567
|
source: n,
|
|
@@ -570,51 +570,51 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
var y = {};
|
|
573
|
-
return
|
|
573
|
+
return _e(x, h, function(g, w) {
|
|
574
574
|
var p = g.rule, E = (p.type === "object" || p.type === "array") && (typeof p.fields == "object" || typeof p.defaultField == "object");
|
|
575
575
|
E = E && (p.required || !p.required && g.value), p.field = g.field;
|
|
576
|
-
function m(R,
|
|
577
|
-
return $({},
|
|
576
|
+
function m(R, T) {
|
|
577
|
+
return $({}, T, {
|
|
578
578
|
fullField: p.fullField + "." + R,
|
|
579
579
|
fullFields: p.fullFields ? [].concat(p.fullFields, [R]) : [R]
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
582
|
function b(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
|
-
var
|
|
585
|
-
!
|
|
586
|
-
var L =
|
|
587
|
-
if (
|
|
584
|
+
var T = Array.isArray(R) ? R : [R];
|
|
585
|
+
!h.suppressWarning && T.length && a.warning("async-validator:", T), T.length && p.message !== void 0 && (T = [].concat(p.message));
|
|
586
|
+
var L = T.map(Nt(p, n));
|
|
587
|
+
if (h.first && L.length)
|
|
588
588
|
return y[p.field] = 1, w(L);
|
|
589
589
|
if (!E)
|
|
590
590
|
w(L);
|
|
591
591
|
else {
|
|
592
592
|
if (p.required && !g.value)
|
|
593
|
-
return p.message !== void 0 ? L = [].concat(p.message).map(Nt(p, n)) :
|
|
593
|
+
return p.message !== void 0 ? L = [].concat(p.message).map(Nt(p, n)) : h.error && (L = [h.error(p, M(h.messages.required, p.field))]), w(L);
|
|
594
594
|
var A = {};
|
|
595
|
-
p.defaultField && Object.keys(g.value).map(function(
|
|
596
|
-
A[
|
|
595
|
+
p.defaultField && Object.keys(g.value).map(function(_) {
|
|
596
|
+
A[_] = p.defaultField;
|
|
597
597
|
}), A = $({}, A, g.rule.fields);
|
|
598
598
|
var D = {};
|
|
599
|
-
Object.keys(A).forEach(function(
|
|
600
|
-
var
|
|
601
|
-
D[
|
|
599
|
+
Object.keys(A).forEach(function(_) {
|
|
600
|
+
var S = A[_], O = Array.isArray(S) ? S : [S];
|
|
601
|
+
D[_] = O.map(m.bind(null, _));
|
|
602
602
|
});
|
|
603
603
|
var B = new a(D);
|
|
604
|
-
B.messages(
|
|
605
|
-
var
|
|
606
|
-
L && L.length &&
|
|
604
|
+
B.messages(h.messages), g.rule.options && (g.rule.options.messages = h.messages, g.rule.options.error = h.error), B.validate(g.value, g.rule.options || h, function(_) {
|
|
605
|
+
var S = [];
|
|
606
|
+
L && L.length && S.push.apply(S, L), _ && _.length && S.push.apply(S, _), w(S.length ? S : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
610
|
var C;
|
|
611
611
|
if (p.asyncValidator)
|
|
612
|
-
C = p.asyncValidator(p, g.value, b, g.source,
|
|
612
|
+
C = p.asyncValidator(p, g.value, b, g.source, h);
|
|
613
613
|
else if (p.validator) {
|
|
614
614
|
try {
|
|
615
|
-
C = p.validator(p, g.value, b, g.source,
|
|
615
|
+
C = p.validator(p, g.value, b, g.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), b(R.message);
|
|
620
620
|
}
|
|
@@ -626,17 +626,17 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
626
626
|
return b(R);
|
|
627
627
|
});
|
|
628
628
|
}, function(g) {
|
|
629
|
-
|
|
629
|
+
f(g);
|
|
630
630
|
}, n);
|
|
631
631
|
}, t.getType = function(i) {
|
|
632
632
|
if (i.type === void 0 && i.pattern instanceof RegExp && (i.type = "pattern"), typeof i.validator != "function" && i.type && !it.hasOwnProperty(i.type))
|
|
633
|
-
throw new Error(
|
|
633
|
+
throw new Error(M("Unknown rule type %s", i.type));
|
|
634
634
|
return i.type || "string";
|
|
635
635
|
}, t.getValidationMethod = function(i) {
|
|
636
636
|
if (typeof i.validator == "function")
|
|
637
637
|
return i.validator;
|
|
638
|
-
var s = Object.keys(i),
|
|
639
|
-
return
|
|
638
|
+
var s = Object.keys(i), o = s.indexOf("message");
|
|
639
|
+
return o !== -1 && s.splice(o, 1), s.length === 1 && s[0] === "required" ? it.required : it[this.getType(i)] || void 0;
|
|
640
640
|
}, a;
|
|
641
641
|
}();
|
|
642
642
|
nt.register = function(t, e) {
|
|
@@ -656,10 +656,10 @@ function At() {
|
|
|
656
656
|
function jt(a, t) {
|
|
657
657
|
let e = 0, i;
|
|
658
658
|
return function(...s) {
|
|
659
|
-
const
|
|
660
|
-
!e ||
|
|
659
|
+
const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e;
|
|
660
|
+
!e || r >= t ? (a.apply(this, s), e = o) : i || (i = setTimeout(() => {
|
|
661
661
|
a.apply(this, s), e = (/* @__PURE__ */ new Date()).getTime(), i = void 0;
|
|
662
|
-
}, t -
|
|
662
|
+
}, t - r));
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
665
|
function Ut(a) {
|
|
@@ -670,20 +670,20 @@ function Ue(a = []) {
|
|
|
670
670
|
return a.forEach((s) => {
|
|
671
671
|
s.fixed === "left" ? t.push(s) : s.fixed === "right" ? i.push(s) : e.push(s);
|
|
672
672
|
}), [
|
|
673
|
-
...t.sort((s,
|
|
674
|
-
...e.sort((s,
|
|
675
|
-
...i.sort((s,
|
|
673
|
+
...t.sort((s, o) => s.sort - o.sort),
|
|
674
|
+
...e.sort((s, o) => s.sort - o.sort),
|
|
675
|
+
...i.sort((s, o) => s.sort - o.sort)
|
|
676
676
|
];
|
|
677
677
|
}
|
|
678
678
|
function Zt(a = [], t = 1, e = 0) {
|
|
679
679
|
return a.map((i) => {
|
|
680
680
|
if (i.children) {
|
|
681
|
-
let s = 0,
|
|
681
|
+
let s = 0, o = i.fixed;
|
|
682
682
|
i.children.forEach((n) => {
|
|
683
|
-
n.fixed =
|
|
683
|
+
n.fixed = o;
|
|
684
684
|
});
|
|
685
|
-
const
|
|
686
|
-
return
|
|
685
|
+
const r = Zt(i.children, t - 1, e + 1);
|
|
686
|
+
return r && r.forEach((n) => {
|
|
687
687
|
s += n.colspan;
|
|
688
688
|
}), {
|
|
689
689
|
...i,
|
|
@@ -691,7 +691,7 @@ function Zt(a = [], t = 1, e = 0) {
|
|
|
691
691
|
level: e,
|
|
692
692
|
rowspan: 1,
|
|
693
693
|
colspan: s,
|
|
694
|
-
children:
|
|
694
|
+
children: r
|
|
695
695
|
};
|
|
696
696
|
}
|
|
697
697
|
return {
|
|
@@ -730,8 +730,8 @@ class Ze {
|
|
|
730
730
|
c(this, "filterMethod");
|
|
731
731
|
c(this, "positions", []);
|
|
732
732
|
this.ctx = t;
|
|
733
|
-
const { data: i = [], columns: s = [], footerData:
|
|
734
|
-
this.data = i, this.footerData =
|
|
733
|
+
const { data: i = [], columns: s = [], footerData: o = [] } = e;
|
|
734
|
+
this.data = i, this.footerData = o, this.columns = s, this.setLoading(!0), this.init();
|
|
735
735
|
}
|
|
736
736
|
init() {
|
|
737
737
|
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear(), this.itemRowKeyMap = /* @__PURE__ */ new WeakMap(), this.initData(this.data);
|
|
@@ -749,14 +749,14 @@ class Ze {
|
|
|
749
749
|
*/
|
|
750
750
|
initData(t, e = 0) {
|
|
751
751
|
t.forEach((i, s) => {
|
|
752
|
-
let
|
|
753
|
-
Array.isArray(i.children) && (
|
|
754
|
-
const { ROW_KEY:
|
|
752
|
+
let o = !1;
|
|
753
|
+
Array.isArray(i.children) && (o = !0, this.initData(i.children, e + 1));
|
|
754
|
+
const { ROW_KEY: r = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: h, SELECTABLE_METHOD: l, CHECKBOX_KEY: f } = this.ctx.config, d = i[r], x = d ?? At();
|
|
755
755
|
this.itemRowKeyMap.set(i, x);
|
|
756
|
-
const u = i._height ||
|
|
756
|
+
const u = i._height || h, y = i._readonly;
|
|
757
757
|
let g = !0;
|
|
758
|
-
if (typeof
|
|
759
|
-
const w = i[
|
|
758
|
+
if (typeof l == "function" && (g = l), f) {
|
|
759
|
+
const w = i[f];
|
|
760
760
|
if (this.checkboxKeyMap.has(w)) {
|
|
761
761
|
const p = this.checkboxKeyMap.get(w);
|
|
762
762
|
p.push(x), this.checkboxKeyMap.set(w, p);
|
|
@@ -773,7 +773,7 @@ class Ze {
|
|
|
773
773
|
selectable: g,
|
|
774
774
|
expand: n,
|
|
775
775
|
expandLazy: !1,
|
|
776
|
-
hasChildren:
|
|
776
|
+
hasChildren: o,
|
|
777
777
|
expandLoading: !1,
|
|
778
778
|
item: i
|
|
779
779
|
});
|
|
@@ -804,8 +804,8 @@ class Ze {
|
|
|
804
804
|
filterColumns(t) {
|
|
805
805
|
return t.reduce((e, i) => {
|
|
806
806
|
if (!(typeof i.hide == "function" ? i.hide() : i.hide)) {
|
|
807
|
-
const
|
|
808
|
-
|
|
807
|
+
const o = { ...i };
|
|
808
|
+
o.children && Array.isArray(o.children) && (o.children = this.filterColumns(o.children)), e.push(o);
|
|
809
809
|
}
|
|
810
810
|
return e;
|
|
811
811
|
}, []);
|
|
@@ -832,15 +832,15 @@ class Ze {
|
|
|
832
832
|
};
|
|
833
833
|
let t = [], e = 0;
|
|
834
834
|
this.sumHeight = 0, this.positions = [];
|
|
835
|
-
const i = (
|
|
836
|
-
|
|
837
|
-
t.push(
|
|
838
|
-
const n = this.itemRowKeyMap.get(
|
|
839
|
-
this.sumHeight +=
|
|
840
|
-
top:
|
|
841
|
-
height:
|
|
835
|
+
const i = (o) => {
|
|
836
|
+
o.forEach((r) => {
|
|
837
|
+
t.push(r);
|
|
838
|
+
const n = this.itemRowKeyMap.get(r), { expand: h, hasChildren: l, height: f } = this.rowKeyMap.get(n), d = this.sumHeight;
|
|
839
|
+
this.sumHeight += f, this.rowIndexRowKeyMap.set(e, n), this.positions.push({
|
|
840
|
+
top: d,
|
|
841
|
+
height: f,
|
|
842
842
|
bottom: this.sumHeight
|
|
843
|
-
}), e += 1,
|
|
843
|
+
}), e += 1, h && l && i(r.children);
|
|
844
844
|
});
|
|
845
845
|
};
|
|
846
846
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -936,11 +936,11 @@ class Ze {
|
|
|
936
936
|
getItemValueForRowIndexAndColIndex(t, e) {
|
|
937
937
|
if (!(this.rowIndexRowKeyMap.has(t) && this.colIndexKeyMap.get(e)))
|
|
938
938
|
return null;
|
|
939
|
-
const s = this.rowIndexRowKeyMap.get(t),
|
|
939
|
+
const s = this.rowIndexRowKeyMap.get(t), o = this.colIndexKeyMap.get(e);
|
|
940
940
|
return {
|
|
941
941
|
rowKey: s,
|
|
942
|
-
key:
|
|
943
|
-
value: this.getItemValue(s,
|
|
942
|
+
key: o,
|
|
943
|
+
value: this.getItemValue(s, o)
|
|
944
944
|
};
|
|
945
945
|
}
|
|
946
946
|
/**
|
|
@@ -963,27 +963,27 @@ class Ze {
|
|
|
963
963
|
let i = [];
|
|
964
964
|
const s = /* @__PURE__ */ new Set();
|
|
965
965
|
t.forEach((n) => {
|
|
966
|
-
const { value:
|
|
967
|
-
s.add(
|
|
968
|
-
rowKey:
|
|
969
|
-
key:
|
|
970
|
-
oldValue:
|
|
966
|
+
const { value: h, rowKey: l, key: f } = n, { oldValue: d, newValue: x } = this.setItemValue(l, f, h);
|
|
967
|
+
s.add(l), i.push({
|
|
968
|
+
rowKey: l,
|
|
969
|
+
key: f,
|
|
970
|
+
oldValue: d,
|
|
971
971
|
newValue: x
|
|
972
972
|
});
|
|
973
973
|
});
|
|
974
|
-
let
|
|
975
|
-
const
|
|
976
|
-
const
|
|
974
|
+
let o = [];
|
|
975
|
+
const r = i.map((n) => {
|
|
976
|
+
const h = this.ctx.database.getRowDataItemForRowKey(n.rowKey);
|
|
977
977
|
return {
|
|
978
978
|
rowKey: n.rowKey,
|
|
979
979
|
key: n.key,
|
|
980
980
|
value: n.newValue,
|
|
981
|
-
row:
|
|
981
|
+
row: h
|
|
982
982
|
};
|
|
983
983
|
});
|
|
984
984
|
return s.forEach((n) => {
|
|
985
|
-
|
|
986
|
-
}), this.ctx.emit("change",
|
|
985
|
+
o.push(this.ctx.database.getRowDataItemForRowKey(n));
|
|
986
|
+
}), this.ctx.emit("change", r, o), e && this.ctx.history.pushState({
|
|
987
987
|
changeList: i,
|
|
988
988
|
scrollX: this.ctx.scrollX,
|
|
989
989
|
scrollY: this.ctx.scrollY,
|
|
@@ -1000,40 +1000,40 @@ class Ze {
|
|
|
1000
1000
|
* @param isEditor 是否是编辑器
|
|
1001
1001
|
* @returns
|
|
1002
1002
|
*/
|
|
1003
|
-
setItemValue(t, e, i, s = !1,
|
|
1003
|
+
setItemValue(t, e, i, s = !1, o = !1, r = !1) {
|
|
1004
1004
|
if (!this.rowKeyMap.has(t))
|
|
1005
1005
|
return {};
|
|
1006
1006
|
const { item: n } = this.rowKeyMap.get(t);
|
|
1007
|
-
let
|
|
1007
|
+
let h = n[e];
|
|
1008
1008
|
if (this.ctx.database.getReadonly(t, e))
|
|
1009
1009
|
return {
|
|
1010
|
-
oldValue:
|
|
1011
|
-
newValue:
|
|
1010
|
+
oldValue: h,
|
|
1011
|
+
newValue: h
|
|
1012
1012
|
};
|
|
1013
|
-
n[e] !== null && typeof n[e] == "object" && (
|
|
1014
|
-
const
|
|
1015
|
-
if (this.originalDataMap.has(
|
|
1016
|
-
const
|
|
1013
|
+
n[e] !== null && typeof n[e] == "object" && (h = JSON.parse(JSON.stringify(n[e])));
|
|
1014
|
+
const l = `${t}_${e}`;
|
|
1015
|
+
if (this.originalDataMap.has(l) || this.originalDataMap.set(l, h), this.changedDataMap.set(l, i), n[e] = i, r) {
|
|
1016
|
+
const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
|
|
1017
1017
|
rowKey: t,
|
|
1018
1018
|
key: e,
|
|
1019
1019
|
value: i,
|
|
1020
|
-
row:
|
|
1020
|
+
row: f
|
|
1021
1021
|
};
|
|
1022
|
-
this.ctx.emit("change", [
|
|
1022
|
+
this.ctx.emit("change", [d], [f]), this.ctx.emit("editChange", {
|
|
1023
1023
|
rowKey: t,
|
|
1024
1024
|
key: e,
|
|
1025
|
-
oldValue:
|
|
1025
|
+
oldValue: h,
|
|
1026
1026
|
value: i,
|
|
1027
|
-
originalValue: this.originalDataMap.get(
|
|
1028
|
-
row:
|
|
1027
|
+
originalValue: this.originalDataMap.get(l),
|
|
1028
|
+
row: f
|
|
1029
1029
|
});
|
|
1030
1030
|
}
|
|
1031
1031
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1032
1032
|
rowKey: t,
|
|
1033
1033
|
key: e,
|
|
1034
|
-
oldValue:
|
|
1034
|
+
oldValue: h,
|
|
1035
1035
|
value: i,
|
|
1036
|
-
originalValue: this.originalDataMap.get(
|
|
1036
|
+
originalValue: this.originalDataMap.get(l),
|
|
1037
1037
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
1038
1038
|
}), s && this.ctx.history.pushState({
|
|
1039
1039
|
type: "single",
|
|
@@ -1043,12 +1043,12 @@ class Ze {
|
|
|
1043
1043
|
{
|
|
1044
1044
|
rowKey: t,
|
|
1045
1045
|
key: e,
|
|
1046
|
-
oldValue:
|
|
1046
|
+
oldValue: h,
|
|
1047
1047
|
newValue: i
|
|
1048
1048
|
}
|
|
1049
1049
|
]
|
|
1050
|
-
}),
|
|
1051
|
-
oldValue:
|
|
1050
|
+
}), o && this.ctx.emit("draw"), {
|
|
1051
|
+
oldValue: h,
|
|
1052
1052
|
newValue: i
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
@@ -1073,10 +1073,10 @@ class Ze {
|
|
|
1073
1073
|
if (i) {
|
|
1074
1074
|
if (!this.rowKeyMap.has(t))
|
|
1075
1075
|
return !1;
|
|
1076
|
-
const { item: s } = this.rowKeyMap.get(t),
|
|
1077
|
-
this.checkboxKeyMap.has(
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1076
|
+
const { item: s } = this.rowKeyMap.get(t), o = s[i];
|
|
1077
|
+
this.checkboxKeyMap.has(o) && this.checkboxKeyMap.get(o).forEach((n) => {
|
|
1078
|
+
const h = this.rowKeyMap.get(n);
|
|
1079
|
+
h.check = e;
|
|
1080
1080
|
});
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
@@ -1161,12 +1161,12 @@ class Ze {
|
|
|
1161
1161
|
*/
|
|
1162
1162
|
getCheckedState() {
|
|
1163
1163
|
let t = 0, e = 0;
|
|
1164
|
-
this.rowKeyMap.forEach((
|
|
1165
|
-
|
|
1166
|
-
const n =
|
|
1164
|
+
this.rowKeyMap.forEach((r) => {
|
|
1165
|
+
r.check && (t += 1);
|
|
1166
|
+
const n = r.selectable;
|
|
1167
1167
|
typeof n == "function" ? n({
|
|
1168
|
-
row:
|
|
1169
|
-
rowIndex:
|
|
1168
|
+
row: r.item,
|
|
1169
|
+
rowIndex: r.rowIndex
|
|
1170
1170
|
}) && (e += 1) : n && (e += 1);
|
|
1171
1171
|
});
|
|
1172
1172
|
const i = e && e > t && t > 0;
|
|
@@ -1191,12 +1191,12 @@ class Ze {
|
|
|
1191
1191
|
getChangedData() {
|
|
1192
1192
|
let t = [];
|
|
1193
1193
|
return this.changedDataMap.forEach((e, i) => {
|
|
1194
|
-
const s = this.originalDataMap.get(i),
|
|
1194
|
+
const s = this.originalDataMap.get(i), o = i.split("_")[0], r = i.split("_")[1];
|
|
1195
1195
|
s !== e && t.push({
|
|
1196
|
-
rowKey:
|
|
1197
|
-
colKey:
|
|
1196
|
+
rowKey: o,
|
|
1197
|
+
colKey: r,
|
|
1198
1198
|
originalValue: s,
|
|
1199
|
-
row: this.rowKeyMap.get(
|
|
1199
|
+
row: this.rowKeyMap.get(o),
|
|
1200
1200
|
value: e
|
|
1201
1201
|
});
|
|
1202
1202
|
}), t;
|
|
@@ -1204,8 +1204,8 @@ class Ze {
|
|
|
1204
1204
|
getChangedRows() {
|
|
1205
1205
|
const t = /* @__PURE__ */ new Set();
|
|
1206
1206
|
this.changedDataMap.forEach((i, s) => {
|
|
1207
|
-
const
|
|
1208
|
-
|
|
1207
|
+
const o = this.originalDataMap.get(s), r = s.split("_")[0];
|
|
1208
|
+
o !== i && t.add(r);
|
|
1209
1209
|
});
|
|
1210
1210
|
let e = [];
|
|
1211
1211
|
return t.forEach((i) => {
|
|
@@ -1222,8 +1222,8 @@ class Ze {
|
|
|
1222
1222
|
const i = `${t}_${e}`;
|
|
1223
1223
|
if (!this.changedDataMap.has(i))
|
|
1224
1224
|
return !1;
|
|
1225
|
-
const s = this.originalDataMap.get(i),
|
|
1226
|
-
return s !==
|
|
1225
|
+
const s = this.originalDataMap.get(i), o = this.changedDataMap.get(i);
|
|
1226
|
+
return s !== o;
|
|
1227
1227
|
}
|
|
1228
1228
|
getPositionForRowIndex(t) {
|
|
1229
1229
|
return t < this.positions.length ? this.positions[t] : {
|
|
@@ -1236,57 +1236,57 @@ class Ze {
|
|
|
1236
1236
|
return t ? (this.headerMap.set(t, e), !0) : !1;
|
|
1237
1237
|
}
|
|
1238
1238
|
getReadonly(t, e) {
|
|
1239
|
-
const i = this.rowKeyMap.get(t), s = this.headerMap.get(e),
|
|
1239
|
+
const i = this.rowKeyMap.get(t), s = this.headerMap.get(e), o = i == null ? void 0 : i.readonly, r = s == null ? void 0 : s.readonly, { CELL_READONLY_METHOD: n } = this.ctx.config;
|
|
1240
1240
|
if (typeof n == "function") {
|
|
1241
|
-
const
|
|
1241
|
+
const l = n({
|
|
1242
1242
|
row: i.item,
|
|
1243
1243
|
rowIndex: i.rowIndex,
|
|
1244
1244
|
colIndex: s.colIndex,
|
|
1245
1245
|
column: s.column,
|
|
1246
1246
|
value: this.getItemValue(t, e)
|
|
1247
1247
|
});
|
|
1248
|
-
if (
|
|
1249
|
-
return
|
|
1248
|
+
if (l !== void 0)
|
|
1249
|
+
return l;
|
|
1250
1250
|
}
|
|
1251
|
-
return
|
|
1251
|
+
return r || o;
|
|
1252
1252
|
}
|
|
1253
1253
|
clearValidate() {
|
|
1254
1254
|
this.validationErrorMap.clear();
|
|
1255
1255
|
}
|
|
1256
1256
|
getValidator(t, e) {
|
|
1257
1257
|
return new Promise((i) => {
|
|
1258
|
-
const s = this.rowKeyMap.get(t),
|
|
1259
|
-
let
|
|
1260
|
-
if (typeof
|
|
1261
|
-
const
|
|
1258
|
+
const s = this.rowKeyMap.get(t), o = this.headerMap.get(e), { CELL_RULES_METHOD: r } = this.ctx.config, n = o.column;
|
|
1259
|
+
let h = n.rules;
|
|
1260
|
+
if (typeof r == "function") {
|
|
1261
|
+
const f = r({
|
|
1262
1262
|
row: s.item,
|
|
1263
1263
|
rowIndex: s.rowIndex,
|
|
1264
|
-
colIndex:
|
|
1264
|
+
colIndex: o.colIndex,
|
|
1265
1265
|
column: n,
|
|
1266
1266
|
value: this.getItemValue(t, e)
|
|
1267
1267
|
});
|
|
1268
|
-
|
|
1268
|
+
f && (h = f);
|
|
1269
1269
|
}
|
|
1270
|
-
if (
|
|
1271
|
-
let
|
|
1272
|
-
if (
|
|
1273
|
-
const x =
|
|
1270
|
+
if (h) {
|
|
1271
|
+
let l = {}, f = {};
|
|
1272
|
+
if (f[e] = this.getItemValue(t, e), Array.isArray(h) && h.length) {
|
|
1273
|
+
const x = h.map((u) => ({
|
|
1274
1274
|
...u,
|
|
1275
1275
|
row: s.item,
|
|
1276
1276
|
column: n,
|
|
1277
1277
|
rowIndex: s.rowIndex,
|
|
1278
|
-
colIndex:
|
|
1278
|
+
colIndex: o.colIndex
|
|
1279
1279
|
}));
|
|
1280
|
-
|
|
1280
|
+
l[e] = x;
|
|
1281
1281
|
} else
|
|
1282
|
-
|
|
1283
|
-
...
|
|
1282
|
+
l[e] = {
|
|
1283
|
+
...h,
|
|
1284
1284
|
row: s.item,
|
|
1285
1285
|
column: n,
|
|
1286
1286
|
rowIndex: s.rowIndex,
|
|
1287
|
-
colIndex:
|
|
1287
|
+
colIndex: o.colIndex
|
|
1288
1288
|
};
|
|
1289
|
-
new nt(
|
|
1289
|
+
new nt(l).validate(f).then(() => {
|
|
1290
1290
|
this.setValidationError(t, e, []), i([]);
|
|
1291
1291
|
}).catch(({ errors: x }) => {
|
|
1292
1292
|
const u = x.map((y) => ({
|
|
@@ -1305,8 +1305,8 @@ class Ze {
|
|
|
1305
1305
|
getHeightByRowIndexRowSpan(t, e) {
|
|
1306
1306
|
let i = 0;
|
|
1307
1307
|
for (let s = 0; s < e; s++) {
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1308
|
+
const o = this.positions[t + s];
|
|
1309
|
+
o && (i += o.height);
|
|
1310
1310
|
}
|
|
1311
1311
|
return i;
|
|
1312
1312
|
}
|
|
@@ -1317,12 +1317,12 @@ class Ze {
|
|
|
1317
1317
|
return this.loading;
|
|
1318
1318
|
}
|
|
1319
1319
|
setValidationErrorByRowIndex(t, e, i) {
|
|
1320
|
-
const
|
|
1320
|
+
const o = `${this.rowIndexRowKeyMap.get(t)}_${e}`, r = [
|
|
1321
1321
|
{
|
|
1322
1322
|
message: i
|
|
1323
1323
|
}
|
|
1324
1324
|
];
|
|
1325
|
-
this.validationErrorMap.set(
|
|
1325
|
+
this.validationErrorMap.set(o, r);
|
|
1326
1326
|
}
|
|
1327
1327
|
setValidationError(t, e, i) {
|
|
1328
1328
|
const s = `${t}_${e}`;
|
|
@@ -1360,10 +1360,10 @@ class Je {
|
|
|
1360
1360
|
backState() {
|
|
1361
1361
|
if (this.historyIndex >= 0) {
|
|
1362
1362
|
const { changeList: t, scrollX: e, scrollY: i } = this.history[this.historyIndex], s = t.map(
|
|
1363
|
-
(
|
|
1364
|
-
rowKey:
|
|
1365
|
-
key:
|
|
1366
|
-
value:
|
|
1363
|
+
(o) => ({
|
|
1364
|
+
rowKey: o.rowKey,
|
|
1365
|
+
key: o.key,
|
|
1366
|
+
value: o.oldValue,
|
|
1367
1367
|
row: {}
|
|
1368
1368
|
})
|
|
1369
1369
|
);
|
|
@@ -1511,32 +1511,32 @@ class ei {
|
|
|
1511
1511
|
* @param {number} shadowWidth - 阴影的宽度
|
|
1512
1512
|
* @param {string} color - 阴影的颜色
|
|
1513
1513
|
*/
|
|
1514
|
-
drawShadow(t, e, i, s,
|
|
1515
|
-
const { fillColor:
|
|
1516
|
-
this.ctx.save(),
|
|
1517
|
-
let
|
|
1514
|
+
drawShadow(t, e, i, s, o) {
|
|
1515
|
+
const { fillColor: r, side: n, shadowWidth: h, colorStart: l, colorEnd: f } = o;
|
|
1516
|
+
this.ctx.save(), r && (this.ctx.fillStyle = r, this.ctx.fillRect(t, e, i, s));
|
|
1517
|
+
let d;
|
|
1518
1518
|
switch (n) {
|
|
1519
1519
|
case "left":
|
|
1520
|
-
|
|
1520
|
+
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);
|
|
1521
1521
|
break;
|
|
1522
1522
|
case "right":
|
|
1523
|
-
|
|
1523
|
+
d = this.ctx.createLinearGradient(
|
|
1524
1524
|
t + i,
|
|
1525
1525
|
e,
|
|
1526
|
-
t + i +
|
|
1526
|
+
t + i + h,
|
|
1527
1527
|
e
|
|
1528
|
-
),
|
|
1528
|
+
), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, h, s);
|
|
1529
1529
|
break;
|
|
1530
1530
|
case "top":
|
|
1531
|
-
|
|
1531
|
+
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);
|
|
1532
1532
|
break;
|
|
1533
1533
|
case "bottom":
|
|
1534
|
-
|
|
1534
|
+
d = this.ctx.createLinearGradient(
|
|
1535
1535
|
t,
|
|
1536
1536
|
e + s,
|
|
1537
1537
|
t,
|
|
1538
|
-
e + s +
|
|
1539
|
-
),
|
|
1538
|
+
e + s + h
|
|
1539
|
+
), d.addColorStop(0, l), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, h);
|
|
1540
1540
|
break;
|
|
1541
1541
|
default:
|
|
1542
1542
|
console.error("Invalid side specified for shadow");
|
|
@@ -1550,21 +1550,21 @@ class ei {
|
|
|
1550
1550
|
this.ctx.save();
|
|
1551
1551
|
const { borderColor: i = "black", borderWidth: s = 1 } = e;
|
|
1552
1552
|
this.ctx.beginPath(), this.ctx.moveTo(t[0] + 0.5, t[1] + 0.5);
|
|
1553
|
-
for (let
|
|
1554
|
-
this.ctx.lineTo(t[
|
|
1553
|
+
for (let o = 2; o < t.length; o += 2)
|
|
1554
|
+
this.ctx.lineTo(t[o] + 0.5, t[o + 1] + 0.5);
|
|
1555
1555
|
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();
|
|
1556
1556
|
}
|
|
1557
|
-
drawImage(t, e, i, s,
|
|
1558
|
-
this.ctx.save(), this.ctx.drawImage(t, e, i, s,
|
|
1557
|
+
drawImage(t, e, i, s, o) {
|
|
1558
|
+
this.ctx.save(), this.ctx.drawImage(t, e, i, s, o), this.ctx.restore();
|
|
1559
1559
|
}
|
|
1560
|
-
drawRect(t, e, i, s, { borderWidth:
|
|
1561
|
-
if (this.ctx.save(), this.ctx.beginPath(), n !== void 0 && (this.ctx.fillStyle = n),
|
|
1560
|
+
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: n, radius: h = 0 } = {}) {
|
|
1561
|
+
if (this.ctx.save(), this.ctx.beginPath(), n !== void 0 && (this.ctx.fillStyle = n), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), h === 0)
|
|
1562
1562
|
this.ctx.rect(t + 0.5, e + 0.5, i, s);
|
|
1563
1563
|
else {
|
|
1564
|
-
const [
|
|
1565
|
-
this.ctx.moveTo(t +
|
|
1564
|
+
const [l, f, d, x] = typeof h == "number" ? [h, h, h, h] : h;
|
|
1565
|
+
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);
|
|
1566
1566
|
}
|
|
1567
|
-
n !== void 0 && this.ctx.fill(),
|
|
1567
|
+
n !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1568
1568
|
}
|
|
1569
1569
|
/**
|
|
1570
1570
|
* 画文本
|
|
@@ -1576,42 +1576,42 @@ class ei {
|
|
|
1576
1576
|
* @param options
|
|
1577
1577
|
* @returns 是否溢出
|
|
1578
1578
|
*/
|
|
1579
|
-
drawText(t = "", e, i, s,
|
|
1579
|
+
drawText(t = "", e, i, s, o, r = {}) {
|
|
1580
1580
|
this.ctx.save();
|
|
1581
1581
|
const {
|
|
1582
1582
|
font: n = "12px Arial",
|
|
1583
|
-
align:
|
|
1584
|
-
color:
|
|
1585
|
-
padding:
|
|
1586
|
-
verticalAlign:
|
|
1587
|
-
} =
|
|
1588
|
-
this.ctx.font = n, this.ctx.fillStyle =
|
|
1583
|
+
align: h = "center",
|
|
1584
|
+
color: l = "#495060",
|
|
1585
|
+
padding: f = 0,
|
|
1586
|
+
verticalAlign: d = "middle"
|
|
1587
|
+
} = r;
|
|
1588
|
+
this.ctx.font = n, this.ctx.fillStyle = l, this.ctx.textBaseline = d, this.ctx.textAlign = h;
|
|
1589
1589
|
let x = 0;
|
|
1590
|
-
|
|
1590
|
+
d === "top" ? x = i + f : d === "bottom" ? x = i + o - f : x = i + (o + f) / 2;
|
|
1591
1591
|
let u = 0;
|
|
1592
|
-
|
|
1593
|
-
const { _text: y, ellipsis: g } = this.handleEllipsis(t, s,
|
|
1592
|
+
h === "left" ? u = e + f : h === "right" ? u = e + s - f : u = e + s / 2;
|
|
1593
|
+
const { _text: y, ellipsis: g } = this.handleEllipsis(t, s, f);
|
|
1594
1594
|
return this.ctx.fillText(y, u, x), this.ctx.restore(), g;
|
|
1595
1595
|
}
|
|
1596
1596
|
handleEllipsis(t, e, i = 0) {
|
|
1597
|
-
let s = !1,
|
|
1597
|
+
let s = !1, o = t;
|
|
1598
1598
|
if (t == null || t === "")
|
|
1599
1599
|
return {
|
|
1600
1600
|
_text: "",
|
|
1601
1601
|
ellipsis: s
|
|
1602
1602
|
};
|
|
1603
|
-
const
|
|
1604
|
-
if (n && n +
|
|
1603
|
+
const r = this.ctx.measureText("...").width, n = this.ctx.measureText(t).width;
|
|
1604
|
+
if (n && n + r >= e - i * 2) {
|
|
1605
1605
|
s = !0;
|
|
1606
|
-
let
|
|
1607
|
-
for (let
|
|
1608
|
-
if (
|
|
1609
|
-
|
|
1606
|
+
let h = 0;
|
|
1607
|
+
for (let l = 0; l < t.length; l++)
|
|
1608
|
+
if (h += this.ctx.measureText(t[l]).width, h >= e - i * 2 - r) {
|
|
1609
|
+
o = t.slice(0, l) + "...";
|
|
1610
1610
|
break;
|
|
1611
1611
|
}
|
|
1612
1612
|
}
|
|
1613
1613
|
return {
|
|
1614
|
-
_text:
|
|
1614
|
+
_text: o,
|
|
1615
1615
|
ellipsis: s
|
|
1616
1616
|
};
|
|
1617
1617
|
}
|
|
@@ -1679,10 +1679,16 @@ class Bt {
|
|
|
1679
1679
|
c(this, "ENABLE_SELECTOR", !1);
|
|
1680
1680
|
c(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
1681
1681
|
// 启用单点击立马编辑
|
|
1682
|
-
c(this, "ENABLE_EDIT_TEXT_ENTER", !0);
|
|
1683
|
-
// 启用文本编辑器回车键确认
|
|
1684
1682
|
c(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1685
1683
|
// 启用点击选择器编辑
|
|
1684
|
+
c(this, "SELECTOR_AREA_MIN_X", 0);
|
|
1685
|
+
// 选择器X最小范围
|
|
1686
|
+
c(this, "SELECTOR_AREA_MAX_X", 0);
|
|
1687
|
+
// 选择器X最大范围,0默认最大colMax
|
|
1688
|
+
c(this, "SELECTOR_AREA_MIN_Y", 0);
|
|
1689
|
+
// 选择器Y最小范围
|
|
1690
|
+
c(this, "SELECTOR_AREA_MAX_Y", 0);
|
|
1691
|
+
// 选择器Y最大范围,0默认rowMax
|
|
1686
1692
|
c(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
1687
1693
|
c(this, "ENABLE_SELECTOR_SPAN_COL", !0);
|
|
1688
1694
|
c(this, "ENABLE_SELECTOR_SPAN_ROW", !0);
|
|
@@ -1809,35 +1815,35 @@ class ii {
|
|
|
1809
1815
|
const i = this.list[e];
|
|
1810
1816
|
let s = i.color;
|
|
1811
1817
|
if (i.configColorName) {
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1818
|
+
const r = this.ctx.config[i.configColorName];
|
|
1819
|
+
r && (s = r);
|
|
1814
1820
|
}
|
|
1815
|
-
const
|
|
1816
|
-
this.icons.set(i.name,
|
|
1821
|
+
const o = this.createImageFromSVG(i.svg, s).then((r) => {
|
|
1822
|
+
this.icons.set(i.name, r);
|
|
1817
1823
|
});
|
|
1818
|
-
t.push(
|
|
1824
|
+
t.push(o);
|
|
1819
1825
|
}
|
|
1820
1826
|
for (let e = 0; e < this.ctx.config.ICONS.length; e++) {
|
|
1821
1827
|
const i = this.ctx.config.ICONS[e];
|
|
1822
1828
|
let s = i.color;
|
|
1823
|
-
const
|
|
1824
|
-
this.icons.set(i.name,
|
|
1829
|
+
const o = this.createImageFromSVG(i.svg, s).then((r) => {
|
|
1830
|
+
this.icons.set(i.name, r);
|
|
1825
1831
|
});
|
|
1826
|
-
t.push(
|
|
1832
|
+
t.push(o);
|
|
1827
1833
|
}
|
|
1828
1834
|
await Promise.all(t), this.ctx.emit("draw");
|
|
1829
1835
|
}
|
|
1830
1836
|
async createImageFromSVG(t, e) {
|
|
1831
|
-
const
|
|
1832
|
-
e &&
|
|
1833
|
-
|
|
1837
|
+
const o = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
1838
|
+
e && o.querySelectorAll("*").forEach((l) => {
|
|
1839
|
+
l.setAttribute("fill", e);
|
|
1834
1840
|
});
|
|
1835
|
-
const
|
|
1841
|
+
const r = new Image(), n = new Blob([new XMLSerializer().serializeToString(o)], {
|
|
1836
1842
|
type: "image/svg+xml"
|
|
1837
|
-
}),
|
|
1838
|
-
return
|
|
1839
|
-
|
|
1840
|
-
|
|
1843
|
+
}), h = URL.createObjectURL(n);
|
|
1844
|
+
return r.src = h, new Promise((l, f) => {
|
|
1845
|
+
r.onerror = () => f(new Error("Failed to load image")), r.onload = () => {
|
|
1846
|
+
l(r);
|
|
1841
1847
|
};
|
|
1842
1848
|
});
|
|
1843
1849
|
}
|
|
@@ -1846,7 +1852,7 @@ class ii {
|
|
|
1846
1852
|
}
|
|
1847
1853
|
}
|
|
1848
1854
|
class Jt {
|
|
1849
|
-
constructor(t, e, i, s,
|
|
1855
|
+
constructor(t, e, i, s, o, r, n) {
|
|
1850
1856
|
c(this, "ctx");
|
|
1851
1857
|
c(this, "x", 0);
|
|
1852
1858
|
c(this, "y", 0);
|
|
@@ -1854,13 +1860,13 @@ class Jt {
|
|
|
1854
1860
|
c(this, "height", 0);
|
|
1855
1861
|
c(this, "fixed");
|
|
1856
1862
|
c(this, "cellType");
|
|
1857
|
-
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height =
|
|
1863
|
+
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = o, this.fixed = r, this.cellType = n;
|
|
1858
1864
|
}
|
|
1859
1865
|
isHorizontalVisible() {
|
|
1860
1866
|
if (this.fixed)
|
|
1861
1867
|
return !0;
|
|
1862
|
-
const { target: t, fixedLeftWidth: e, scrollX: i, fixedRightWidth: s } = this.ctx,
|
|
1863
|
-
return !(this.x + this.width - e - i <= 0 || this.x - i >=
|
|
1868
|
+
const { target: t, fixedLeftWidth: e, scrollX: i, fixedRightWidth: s } = this.ctx, o = t.width;
|
|
1869
|
+
return !(this.x + this.width - e - i <= 0 || this.x - i >= o - s);
|
|
1864
1870
|
}
|
|
1865
1871
|
isVerticalVisible() {
|
|
1866
1872
|
const { target: t, scrollY: e } = this.ctx, i = t.height;
|
|
@@ -1883,10 +1889,11 @@ class Jt {
|
|
|
1883
1889
|
}
|
|
1884
1890
|
}
|
|
1885
1891
|
class Qt extends Jt {
|
|
1886
|
-
constructor(e, i, s,
|
|
1887
|
-
super(e,
|
|
1892
|
+
constructor(e, i, s, o, r, n, h, l, f, d = "body") {
|
|
1893
|
+
super(e, o, r, n, h, l.fixed, d);
|
|
1888
1894
|
c(this, "formatter");
|
|
1889
1895
|
c(this, "hoverIconName", "");
|
|
1896
|
+
c(this, "operation", !1);
|
|
1890
1897
|
c(this, "align");
|
|
1891
1898
|
c(this, "verticalAlign");
|
|
1892
1899
|
c(this, "fixed");
|
|
@@ -1929,7 +1936,7 @@ class Qt extends Jt {
|
|
|
1929
1936
|
c(this, "overflowTooltipShow", !0);
|
|
1930
1937
|
c(this, "overflowTooltipMaxWidth", 500);
|
|
1931
1938
|
c(this, "overflowTooltipPlacement", "top");
|
|
1932
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
1939
|
+
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();
|
|
1933
1940
|
}
|
|
1934
1941
|
getValidationMessage() {
|
|
1935
1942
|
const e = this.ctx.database.getValidationError(this.rowKey, this.key);
|
|
@@ -1947,7 +1954,7 @@ class Qt extends Jt {
|
|
|
1947
1954
|
return;
|
|
1948
1955
|
const { SPAN_METHOD: e } = this.ctx.config;
|
|
1949
1956
|
if (typeof e == "function") {
|
|
1950
|
-
const i = e, { colspan: s = 1, rowspan:
|
|
1957
|
+
const i = e, { colspan: s = 1, rowspan: o = 1 } = i({
|
|
1951
1958
|
row: this.row,
|
|
1952
1959
|
rowIndex: this.rowIndex,
|
|
1953
1960
|
colIndex: this.colIndex,
|
|
@@ -1959,7 +1966,7 @@ class Qt extends Jt {
|
|
|
1959
1966
|
visibleLeafColumns: this.ctx.header.visibleLeafColumns,
|
|
1960
1967
|
rows: this.ctx.body.data
|
|
1961
1968
|
}) || {};
|
|
1962
|
-
this.colspan = s, this.rowspan =
|
|
1969
|
+
this.colspan = s, this.rowspan = o, this.visibleWidth = this.getWidthByColIndexColSpan(this.colIndex, this.colspan), this.visibleHeight = this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex, this.rowspan);
|
|
1963
1970
|
}
|
|
1964
1971
|
}
|
|
1965
1972
|
updateType() {
|
|
@@ -2021,20 +2028,20 @@ class Qt extends Jt {
|
|
|
2021
2028
|
}
|
|
2022
2029
|
updateTree() {
|
|
2023
2030
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2024
|
-
let
|
|
2031
|
+
let o, r = 0, n = "";
|
|
2025
2032
|
if (this.type === "tree" && s === "body") {
|
|
2026
|
-
const
|
|
2027
|
-
if (
|
|
2033
|
+
const h = this.ctx.database.getRowForRowKey(i), { expand: l = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = h || {};
|
|
2034
|
+
if (d) {
|
|
2028
2035
|
const u = this.ctx.icons.get("loading");
|
|
2029
|
-
n = "loading",
|
|
2030
|
-
} else if (
|
|
2036
|
+
n = "loading", o = u, r = x * 8;
|
|
2037
|
+
} else if (f) {
|
|
2031
2038
|
const u = this.ctx.icons.get("expand"), y = this.ctx.icons.get("shrink");
|
|
2032
|
-
|
|
2039
|
+
o = l ? y : u, n = l ? "shrink" : "expand", r = x * 8;
|
|
2033
2040
|
} else
|
|
2034
|
-
|
|
2035
|
-
if (
|
|
2036
|
-
let u = 20, y = 20, g = this.drawX +
|
|
2037
|
-
this.ctx.paint.drawImage(
|
|
2041
|
+
r = x * 8;
|
|
2042
|
+
if (o) {
|
|
2043
|
+
let u = 20, y = 20, g = this.drawX + r + e, w = this.drawY + (this.visibleHeight - y) / 2 + 2;
|
|
2044
|
+
this.ctx.paint.drawImage(o, g, w, u, y), this.drawImageX = g, this.drawImageY = w, this.drawImageWidth = u, this.drawImageHeight = y, this.drawImageName = n, this.drawImageSource = o, this.align = "left", this.drawTextX = r + this.drawX + u + 0.5;
|
|
2038
2045
|
}
|
|
2039
2046
|
}
|
|
2040
2047
|
}
|
|
@@ -2043,18 +2050,18 @@ class Qt extends Jt {
|
|
|
2043
2050
|
BODY_BG_COLOR: e,
|
|
2044
2051
|
EDIT_BG_COLOR: i,
|
|
2045
2052
|
BODY_CELL_STYLE_METHOD: s,
|
|
2046
|
-
FOOTER_CELL_STYLE_METHOD:
|
|
2047
|
-
READONLY_TEXT_COLOR:
|
|
2053
|
+
FOOTER_CELL_STYLE_METHOD: o,
|
|
2054
|
+
READONLY_TEXT_COLOR: r,
|
|
2048
2055
|
FOOTER_BG_COLOR: n,
|
|
2049
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2050
|
-
HIGHLIGHT_SELECTED_ROW_COLOR:
|
|
2051
|
-
HIGHLIGHT_HOVER_ROW:
|
|
2052
|
-
HIGHLIGHT_HOVER_ROW_COLOR:
|
|
2056
|
+
HIGHLIGHT_SELECTED_ROW: h,
|
|
2057
|
+
HIGHLIGHT_SELECTED_ROW_COLOR: l,
|
|
2058
|
+
HIGHLIGHT_HOVER_ROW: f,
|
|
2059
|
+
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
2053
2060
|
} = this.ctx.config;
|
|
2054
2061
|
if (this.cellType === "footer") {
|
|
2055
|
-
let p = n, E =
|
|
2056
|
-
if (typeof
|
|
2057
|
-
const m =
|
|
2062
|
+
let p = n, E = r;
|
|
2063
|
+
if (typeof o == "function") {
|
|
2064
|
+
const m = o, { backgroundColor: b, color: C } = m({
|
|
2058
2065
|
row: this.row,
|
|
2059
2066
|
rowIndex: this.rowIndex,
|
|
2060
2067
|
colIndex: this.colIndex,
|
|
@@ -2068,13 +2075,13 @@ class Qt extends Jt {
|
|
|
2068
2075
|
}
|
|
2069
2076
|
let x = "transparent";
|
|
2070
2077
|
const u = this.ctx.focusCell, y = this.ctx.hoverCell;
|
|
2071
|
-
|
|
2072
|
-
let g = e, w =
|
|
2078
|
+
f && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = d), h && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = l), this.drawCellSkyBgColor = x;
|
|
2079
|
+
let g = e, w = r;
|
|
2073
2080
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2074
|
-
this.drawCellBgColor = e, this.drawTextColor =
|
|
2081
|
+
this.drawCellBgColor = e, this.drawTextColor = r;
|
|
2075
2082
|
return;
|
|
2076
2083
|
}
|
|
2077
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (g = i, w =
|
|
2084
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (g = i, w = r), typeof s == "function") {
|
|
2078
2085
|
const p = s, { backgroundColor: E, color: m } = p({
|
|
2079
2086
|
row: this.row,
|
|
2080
2087
|
rowIndex: this.rowIndex,
|
|
@@ -2087,29 +2094,29 @@ class Qt extends Jt {
|
|
|
2087
2094
|
this.drawCellBgColor = g, this.drawTextColor = w;
|
|
2088
2095
|
}
|
|
2089
2096
|
updateSelection() {
|
|
2090
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan:
|
|
2091
|
-
if (!(s === 0 ||
|
|
2092
|
-
const
|
|
2097
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: n, rowIndex: h, rowKey: l } = this;
|
|
2098
|
+
if (!(s === 0 || o === 0) && r !== "footer" && ["index-selection", "selection"].includes(n)) {
|
|
2099
|
+
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, y = this.drawY + (i - x) / 2;
|
|
2093
2100
|
let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
2094
|
-
|
|
2101
|
+
f && d ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : f && d ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !f && d ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = u, this.drawImageY = y, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g) : g && n === "selection" && (this.drawImageX = u, this.drawImageY = y, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g);
|
|
2095
2102
|
}
|
|
2096
2103
|
}
|
|
2097
2104
|
updateHoverIcon() {
|
|
2098
2105
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2099
2106
|
if (typeof e == "function") {
|
|
2100
|
-
const
|
|
2107
|
+
const h = e({
|
|
2101
2108
|
row: this.row,
|
|
2102
2109
|
rowIndex: this.rowIndex,
|
|
2103
2110
|
colIndex: this.colIndex,
|
|
2104
2111
|
column: this.column,
|
|
2105
2112
|
value: this.getValue()
|
|
2106
2113
|
});
|
|
2107
|
-
|
|
2114
|
+
h !== void 0 && (this.hoverIconName = h);
|
|
2108
2115
|
}
|
|
2109
|
-
const
|
|
2116
|
+
const o = this.drawX + this.width - i - s, r = this.drawY + (this.height - i) / 2;
|
|
2110
2117
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
2111
2118
|
const n = this.ctx.icons.get(this.hoverIconName);
|
|
2112
|
-
this.drawImageX =
|
|
2119
|
+
this.drawImageX = o, this.drawImageY = r, this.drawImageWidth = i, this.drawImageHeight = i, this.drawImageName = this.hoverIconName, this.drawImageSource = n;
|
|
2113
2120
|
}
|
|
2114
2121
|
}
|
|
2115
2122
|
/**
|
|
@@ -2165,11 +2172,11 @@ class Qt extends Jt {
|
|
|
2165
2172
|
const {
|
|
2166
2173
|
paint: e,
|
|
2167
2174
|
config: { BORDER_COLOR: i }
|
|
2168
|
-
} = this.ctx, { drawX: s, drawY:
|
|
2169
|
-
e.drawRect(s,
|
|
2175
|
+
} = this.ctx, { drawX: s, drawY: o } = this;
|
|
2176
|
+
e.drawRect(s, o, this.visibleWidth, this.visibleHeight, {
|
|
2170
2177
|
borderColor: i,
|
|
2171
2178
|
fillColor: this.drawCellBgColor
|
|
2172
|
-
}), e.drawRect(s,
|
|
2179
|
+
}), e.drawRect(s, o, this.width, this.height, {
|
|
2173
2180
|
borderColor: "transparent",
|
|
2174
2181
|
borderWidth: 1,
|
|
2175
2182
|
fillColor: this.drawCellSkyBgColor
|
|
@@ -2183,9 +2190,9 @@ class Qt extends Jt {
|
|
|
2183
2190
|
if (i === 0)
|
|
2184
2191
|
return 0;
|
|
2185
2192
|
let s = 0;
|
|
2186
|
-
for (let
|
|
2187
|
-
const
|
|
2188
|
-
s +=
|
|
2193
|
+
for (let o = e; o < e + i; o++) {
|
|
2194
|
+
const r = this.ctx.header.leafCellHeaders[o];
|
|
2195
|
+
s += r.width;
|
|
2189
2196
|
}
|
|
2190
2197
|
return s;
|
|
2191
2198
|
}
|
|
@@ -2221,8 +2228,8 @@ class Qt extends Jt {
|
|
|
2221
2228
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2222
2229
|
if (!s || !i)
|
|
2223
2230
|
return;
|
|
2224
|
-
const { xArr:
|
|
2225
|
-
|
|
2231
|
+
const { xArr: o, yArr: r } = this.ctx.selector, n = o[1], h = r[1], { colIndex: l, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2232
|
+
l === n && f === h && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2226
2233
|
borderColor: "#fff",
|
|
2227
2234
|
fillColor: e
|
|
2228
2235
|
});
|
|
@@ -2233,10 +2240,10 @@ class Qt extends Jt {
|
|
|
2233
2240
|
const { ENABLE_SELECTOR: e } = this.ctx.config;
|
|
2234
2241
|
if (!e)
|
|
2235
2242
|
return;
|
|
2236
|
-
const { xArr: i, yArr: s, xArrCopy:
|
|
2243
|
+
const { xArr: i, yArr: s, xArrCopy: o, yArrCopy: r } = this.ctx.selector;
|
|
2237
2244
|
this.drawBorder({
|
|
2238
|
-
xArr:
|
|
2239
|
-
yArr:
|
|
2245
|
+
xArr: o,
|
|
2246
|
+
yArr: r,
|
|
2240
2247
|
borderColor: this.ctx.config.SELECT_BORDER_COLOR || "rgb(82,146,247)",
|
|
2241
2248
|
fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)",
|
|
2242
2249
|
borderWidth: 1,
|
|
@@ -2259,13 +2266,13 @@ class Qt extends Jt {
|
|
|
2259
2266
|
drawErrorTip() {
|
|
2260
2267
|
if (this.cellType === "footer" || !this.message)
|
|
2261
2268
|
return;
|
|
2262
|
-
const { ERROR_TIP_ICON_SIZE: e, ERROR_TIP_COLOR: i } = this.ctx.config, { width: s } = this,
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
+
const { ERROR_TIP_ICON_SIZE: e, ERROR_TIP_COLOR: i } = this.ctx.config, { width: s } = this, o = this.drawX, r = this.drawY, n = [
|
|
2270
|
+
o + s - e - 0.5,
|
|
2271
|
+
r,
|
|
2272
|
+
o + s - 0.5,
|
|
2273
|
+
r,
|
|
2274
|
+
o + s - 0.5,
|
|
2275
|
+
r + e
|
|
2269
2276
|
];
|
|
2270
2277
|
this.ctx.paint.drawLine(n, {
|
|
2271
2278
|
borderColor: i,
|
|
@@ -2276,32 +2283,32 @@ class Qt extends Jt {
|
|
|
2276
2283
|
});
|
|
2277
2284
|
}
|
|
2278
2285
|
drawBorder(e) {
|
|
2279
|
-
const { drawX: i, drawY: s, width:
|
|
2280
|
-
let
|
|
2281
|
-
|
|
2282
|
-
const { xArr:
|
|
2283
|
-
n >= p && n <= E &&
|
|
2286
|
+
const { drawX: i, drawY: s, width: o, rowIndex: r, colIndex: n } = this, h = i + 0.5;
|
|
2287
|
+
let l = s + 0.5, f = this.height;
|
|
2288
|
+
r === 0 && (l = this.y + 1, f = f - 1);
|
|
2289
|
+
const { xArr: d, yArr: x, lineDash: u = [], borderWidth: y = 1, borderColor: g, fillColor: w } = e, p = d[0], E = d[1], m = x[0], b = x[1];
|
|
2290
|
+
n >= p && n <= E && r === m && this.ctx.paint.drawLine([h, l, h + o - 2, l], {
|
|
2284
2291
|
borderColor: g,
|
|
2285
2292
|
fillColor: w,
|
|
2286
2293
|
borderWidth: y,
|
|
2287
2294
|
lineCap: "round",
|
|
2288
2295
|
lineJoin: "round",
|
|
2289
2296
|
lineDash: u
|
|
2290
|
-
}), n >= p && n <= E &&
|
|
2297
|
+
}), n >= p && n <= E && r === b && this.ctx.paint.drawLine([h, l + f - 1.5, h + o, l + f - 1.5], {
|
|
2291
2298
|
borderColor: g,
|
|
2292
2299
|
fillColor: w,
|
|
2293
2300
|
borderWidth: y,
|
|
2294
2301
|
lineCap: "round",
|
|
2295
2302
|
lineJoin: "round",
|
|
2296
2303
|
lineDash: u
|
|
2297
|
-
}), n === p &&
|
|
2304
|
+
}), n === p && r >= m && r <= b && this.ctx.paint.drawLine([h, l, h, l + f - 1], {
|
|
2298
2305
|
borderColor: g,
|
|
2299
2306
|
fillColor: w,
|
|
2300
2307
|
borderWidth: y,
|
|
2301
2308
|
lineCap: "round",
|
|
2302
2309
|
lineJoin: "round",
|
|
2303
2310
|
lineDash: u
|
|
2304
|
-
}), n === E &&
|
|
2311
|
+
}), n === E && r >= m && r <= b && this.ctx.paint.drawLine([h + o - 1, l, h + o - 1, l + f - 1], {
|
|
2305
2312
|
borderColor: g,
|
|
2306
2313
|
fillColor: w,
|
|
2307
2314
|
borderWidth: y,
|
|
@@ -2312,13 +2319,14 @@ class Qt extends Jt {
|
|
|
2312
2319
|
}
|
|
2313
2320
|
}
|
|
2314
2321
|
class te extends Jt {
|
|
2315
|
-
constructor(e, i, s,
|
|
2316
|
-
super(e, s,
|
|
2322
|
+
constructor(e, i, s, o, r, n, h) {
|
|
2323
|
+
super(e, s, o, r, n, h.fixed, "header");
|
|
2317
2324
|
c(this, "align");
|
|
2318
2325
|
c(this, "verticalAlign", "middle");
|
|
2319
2326
|
c(this, "fixed");
|
|
2320
2327
|
c(this, "widthFillDisable");
|
|
2321
2328
|
c(this, "type");
|
|
2329
|
+
c(this, "operation", !1);
|
|
2322
2330
|
c(this, "editorType");
|
|
2323
2331
|
c(this, "level");
|
|
2324
2332
|
c(this, "text");
|
|
@@ -2346,7 +2354,7 @@ class te extends Jt {
|
|
|
2346
2354
|
c(this, "drawImageHeight", 0);
|
|
2347
2355
|
c(this, "drawImageName", "");
|
|
2348
2356
|
c(this, "drawImageSource");
|
|
2349
|
-
this.ctx = e, this.x = s, this.y =
|
|
2357
|
+
this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = n, 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 = At(), this.hasChildren = h.children && h.children.length > 0 || !1, this.render = h.renderHeader;
|
|
2350
2358
|
}
|
|
2351
2359
|
/**
|
|
2352
2360
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2364,15 +2372,15 @@ class te extends Jt {
|
|
|
2364
2372
|
}
|
|
2365
2373
|
updateContainer() {
|
|
2366
2374
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2367
|
-
let
|
|
2375
|
+
let o = i, r = s;
|
|
2368
2376
|
if (typeof e == "function") {
|
|
2369
|
-
const n = e, { backgroundColor:
|
|
2377
|
+
const n = e, { backgroundColor: h, color: l } = n({
|
|
2370
2378
|
colIndex: this.colIndex,
|
|
2371
2379
|
column: this.column
|
|
2372
2380
|
}) || {};
|
|
2373
|
-
|
|
2381
|
+
h && (o = h), l && (r = l);
|
|
2374
2382
|
}
|
|
2375
|
-
this.drawCellBgColor =
|
|
2383
|
+
this.drawCellBgColor = o, this.drawTextColor = r;
|
|
2376
2384
|
}
|
|
2377
2385
|
update() {
|
|
2378
2386
|
this.updateContainer(), this.displayText = this.getText(), this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.updateStyle();
|
|
@@ -2380,13 +2388,13 @@ class te extends Jt {
|
|
|
2380
2388
|
draw() {
|
|
2381
2389
|
const {
|
|
2382
2390
|
paint: e,
|
|
2383
|
-
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT:
|
|
2384
|
-
} = this.ctx, { drawX:
|
|
2385
|
-
e.drawRect(
|
|
2391
|
+
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: o }
|
|
2392
|
+
} = this.ctx, { drawX: r, drawY: n, displayText: h } = this;
|
|
2393
|
+
e.drawRect(r, n, this.width, this.height, {
|
|
2386
2394
|
borderColor: i,
|
|
2387
2395
|
fillColor: this.drawCellBgColor
|
|
2388
|
-
}), e.drawText(
|
|
2389
|
-
font:
|
|
2396
|
+
}), e.drawText(h, r, n, this.width, this.height, {
|
|
2397
|
+
font: o,
|
|
2390
2398
|
padding: s,
|
|
2391
2399
|
color: this.drawTextColor,
|
|
2392
2400
|
align: this.align,
|
|
@@ -2396,9 +2404,9 @@ class te extends Jt {
|
|
|
2396
2404
|
drawSelection() {
|
|
2397
2405
|
const { width: e, height: i, type: s } = this;
|
|
2398
2406
|
if (["index-selection", "selection"].includes(s)) {
|
|
2399
|
-
const { indeterminate:
|
|
2400
|
-
let
|
|
2401
|
-
|
|
2407
|
+
const { indeterminate: o, check: r, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: h = 0 } = this.ctx.config, l = this.drawX + (e - h) / 2, f = this.drawY + (i - h) / 2;
|
|
2408
|
+
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2409
|
+
o ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : r && n ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : r && n ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !r && n ? (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(
|
|
2402
2410
|
this.drawImageSource,
|
|
2403
2411
|
this.drawImageX,
|
|
2404
2412
|
this.drawImageY,
|
|
@@ -2440,20 +2448,20 @@ class si {
|
|
|
2440
2448
|
if (t.button !== 0 || this.isBusy(t))
|
|
2441
2449
|
return;
|
|
2442
2450
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2443
|
-
for (const
|
|
2444
|
-
const n =
|
|
2445
|
-
if (i > n && i < n +
|
|
2446
|
-
this.ctx.focusCellHeader =
|
|
2451
|
+
for (const r of s) {
|
|
2452
|
+
const n = r.getDrawX(), h = r.getDrawY();
|
|
2453
|
+
if (i > n && i < n + r.width && e > h && e < h + r.height) {
|
|
2454
|
+
this.ctx.focusCellHeader = r, this.ctx.emit("cellHeaderMousedown", r, t);
|
|
2447
2455
|
return;
|
|
2448
2456
|
}
|
|
2449
2457
|
}
|
|
2450
|
-
const
|
|
2451
|
-
for (const
|
|
2452
|
-
const n =
|
|
2453
|
-
for (const
|
|
2454
|
-
const
|
|
2455
|
-
if (i >
|
|
2456
|
-
this.ctx.setFocusCell(
|
|
2458
|
+
const o = this.ctx.body.renderRows;
|
|
2459
|
+
for (const r of o) {
|
|
2460
|
+
const n = r.fixedCells.concat(r.noFixedCells);
|
|
2461
|
+
for (const h of n) {
|
|
2462
|
+
const l = h.getDrawX(), f = h.getDrawY();
|
|
2463
|
+
if (i > l && i < l + h.width && e > f && e < f + h.height) {
|
|
2464
|
+
this.ctx.setFocusCell(h), this.ctx.emit("cellMousedown", h, t);
|
|
2457
2465
|
return;
|
|
2458
2466
|
}
|
|
2459
2467
|
}
|
|
@@ -2462,20 +2470,20 @@ class si {
|
|
|
2462
2470
|
if (t.button !== 0 || this.isBusy(t))
|
|
2463
2471
|
return;
|
|
2464
2472
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2465
|
-
for (const
|
|
2466
|
-
const n =
|
|
2467
|
-
if (i > n && i < n +
|
|
2468
|
-
this.ctx.clickCellHeader =
|
|
2473
|
+
for (const r of s) {
|
|
2474
|
+
const n = r.getDrawX(), h = r.getDrawY();
|
|
2475
|
+
if (i > n && i < n + r.width && e > h && e < h + r.height) {
|
|
2476
|
+
this.ctx.clickCellHeader = r, this.ctx.emit("cellHeaderClick", r, t), this.selectionClick(r);
|
|
2469
2477
|
return;
|
|
2470
2478
|
}
|
|
2471
2479
|
}
|
|
2472
|
-
const
|
|
2473
|
-
for (const
|
|
2474
|
-
const n =
|
|
2475
|
-
for (const
|
|
2476
|
-
const
|
|
2477
|
-
if (i >
|
|
2478
|
-
this.ctx.clickCell =
|
|
2480
|
+
const o = this.ctx.body.renderRows;
|
|
2481
|
+
for (const r of o) {
|
|
2482
|
+
const n = r.fixedCells.concat(r.noFixedCells);
|
|
2483
|
+
for (const h of n) {
|
|
2484
|
+
const l = h.getDrawX(), f = h.getDrawY();
|
|
2485
|
+
if (i > l && i < l + h.width && e > f && e < f + h.height) {
|
|
2486
|
+
this.ctx.clickCell = h, this.ctx.emit("cellClick", h, t), this.selectionClick(h), this.treeClick(h);
|
|
2479
2487
|
return;
|
|
2480
2488
|
}
|
|
2481
2489
|
}
|
|
@@ -2484,46 +2492,46 @@ class si {
|
|
|
2484
2492
|
if (this.isBusy(t))
|
|
2485
2493
|
return;
|
|
2486
2494
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2487
|
-
for (const
|
|
2488
|
-
const n =
|
|
2489
|
-
if (i > n && i < n +
|
|
2490
|
-
this.ctx.emit("cellHeaderContextMenuClick",
|
|
2495
|
+
for (const r of s) {
|
|
2496
|
+
const n = r.getDrawX(), h = r.getDrawY();
|
|
2497
|
+
if (i > n && i < n + r.width && e > h && e < h + r.height) {
|
|
2498
|
+
this.ctx.emit("cellHeaderContextMenuClick", r, t);
|
|
2491
2499
|
return;
|
|
2492
2500
|
}
|
|
2493
2501
|
}
|
|
2494
|
-
const
|
|
2495
|
-
for (const
|
|
2496
|
-
const n =
|
|
2497
|
-
for (const
|
|
2498
|
-
const
|
|
2499
|
-
if (i >
|
|
2500
|
-
this.ctx.emit("cellContextMenuClick",
|
|
2502
|
+
const o = this.ctx.body.renderRows;
|
|
2503
|
+
for (const r of o) {
|
|
2504
|
+
const n = r.fixedCells.concat(r.noFixedCells);
|
|
2505
|
+
for (const h of n) {
|
|
2506
|
+
const l = h.getDrawX(), f = h.getDrawY();
|
|
2507
|
+
if (i > l && i < l + h.width && e > f && e < f + h.height) {
|
|
2508
|
+
this.ctx.emit("cellContextMenuClick", h, t);
|
|
2501
2509
|
return;
|
|
2502
2510
|
}
|
|
2503
2511
|
}
|
|
2504
2512
|
}
|
|
2505
2513
|
}), this.ctx.on("mousemove", (t) => {
|
|
2506
|
-
var
|
|
2514
|
+
var r;
|
|
2507
2515
|
if (this.isBusy(t))
|
|
2508
2516
|
return;
|
|
2509
2517
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2510
2518
|
for (const n of s) {
|
|
2511
|
-
const
|
|
2512
|
-
if (i >
|
|
2519
|
+
const h = n.getDrawX(), l = n.getDrawY();
|
|
2520
|
+
if (i > h && i < h + n.width && e > l && e < l + n.height) {
|
|
2513
2521
|
if (this.ctx.emit("cellHeaderMouseenter", n, t), this.ctx.hoverCellHeader && this.ctx.hoverCellHeader !== n && this.ctx.emit("cellHeaderMouseleave", this.ctx.hoverCellHeader, t), this.imageEnterAndLeave(n, t), this.ctx.hoverCellHeader === n)
|
|
2514
2522
|
return;
|
|
2515
2523
|
this.ctx.hoverCellHeader = n, this.ctx.emit("cellHeaderHoverChange", n);
|
|
2516
2524
|
return;
|
|
2517
2525
|
}
|
|
2518
2526
|
}
|
|
2519
|
-
const
|
|
2520
|
-
for (const n of
|
|
2521
|
-
const
|
|
2522
|
-
for (const
|
|
2523
|
-
const
|
|
2524
|
-
if (i >
|
|
2525
|
-
if (this.ctx.emit("cellMouseenter",
|
|
2526
|
-
((
|
|
2527
|
+
const o = this.ctx.body.renderRows;
|
|
2528
|
+
for (const n of o) {
|
|
2529
|
+
const h = n.fixedCells.concat(n.noFixedCells);
|
|
2530
|
+
for (const l of h) {
|
|
2531
|
+
const f = l.getDrawX(), d = l.getDrawY();
|
|
2532
|
+
if (i > f && i < f + l.visibleWidth && e > d && e < d + l.visibleHeight && (this.imageEnterAndLeave(l, t), this.visibleHoverCell !== l && (this.ctx.emit("visibleCellMouseleave", l, t), this.visibleHoverCell = l, this.ctx.emit("visibleCellHoverChange", l, t))), i > f && i < f + l.width && e > d && e < d + l.height) {
|
|
2533
|
+
if (this.ctx.emit("cellMouseenter", l, t), this.ctx.hoverCell && this.ctx.hoverCell !== l && this.ctx.emit("cellMouseleave", this.ctx.hoverCell, t), this.ctx.hoverCell === l) return;
|
|
2534
|
+
((r = this.ctx.hoverCell) == null ? void 0 : r.rowKey) !== l.rowKey && (this.ctx.hoverCell = l, this.ctx.hoverRow = this.ctx.body.renderRows.find((x) => x.rowKey === l.rowKey), this.ctx.emit("rowHoverChange", this.ctx.hoverRow, l, t), this.ctx.emit("draw")), this.ctx.hoverCell = l, this.ctx.emit("cellHoverChange", l, t);
|
|
2527
2535
|
return;
|
|
2528
2536
|
}
|
|
2529
2537
|
}
|
|
@@ -2550,18 +2558,18 @@ class si {
|
|
|
2550
2558
|
*/
|
|
2551
2559
|
treeClick(t) {
|
|
2552
2560
|
if (t.type === "tree" && this.ctx.isPointer) {
|
|
2553
|
-
const e = this.ctx.database.getRowForRowKey(t.rowKey), { expand: i = !1, expandLazy: s = !1 } = e || {}, { EXPAND_LAZY:
|
|
2554
|
-
if (
|
|
2555
|
-
typeof
|
|
2561
|
+
const e = this.ctx.database.getRowForRowKey(t.rowKey), { expand: i = !1, expandLazy: s = !1 } = e || {}, { EXPAND_LAZY: o, EXPAND_LAZY_METHOD: r } = this.ctx.config;
|
|
2562
|
+
if (o && r && !i && !s)
|
|
2563
|
+
typeof r == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), r({
|
|
2556
2564
|
row: t.row,
|
|
2557
2565
|
rowIndex: t.rowIndex,
|
|
2558
2566
|
colIndex: t.colIndex,
|
|
2559
2567
|
column: t.column,
|
|
2560
2568
|
value: t.getValue()
|
|
2561
|
-
}).then((
|
|
2562
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2563
|
-
}).catch((
|
|
2564
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2569
|
+
}).then((h) => {
|
|
2570
|
+
this.ctx.database.setExpandChildren(t.rowKey, h), this.ctx.database.expandLoading(t.rowKey, !1);
|
|
2571
|
+
}).catch((h) => {
|
|
2572
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(h);
|
|
2565
2573
|
}));
|
|
2566
2574
|
else {
|
|
2567
2575
|
const n = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2712,13 +2720,13 @@ class ri {
|
|
|
2712
2720
|
getSelectedData() {
|
|
2713
2721
|
const t = [], e = this.selector.yArr, i = this.selector.xArr;
|
|
2714
2722
|
let s = "";
|
|
2715
|
-
for (let
|
|
2716
|
-
const
|
|
2723
|
+
for (let o = 0; o <= e[1] - e[0]; o++) {
|
|
2724
|
+
const r = [];
|
|
2717
2725
|
for (let n = 0; n <= i[1] - i[0]; n++) {
|
|
2718
|
-
const
|
|
2719
|
-
|
|
2726
|
+
const h = o + e[0], l = n + i[0], f = this.database.getItemValueForRowIndexAndColIndex(h, l);
|
|
2727
|
+
f && r.push(f.value);
|
|
2720
2728
|
}
|
|
2721
|
-
s += `${
|
|
2729
|
+
s += `${r.join(" ")}\r`, t.push(r);
|
|
2722
2730
|
}
|
|
2723
2731
|
return s = s ? s.replace(/\r$/, "") : " ", {
|
|
2724
2732
|
xArr: i,
|
|
@@ -2731,9 +2739,9 @@ class ri {
|
|
|
2731
2739
|
let i = Math.floor(t);
|
|
2732
2740
|
const s = this.body.width - this.body.visibleWidth;
|
|
2733
2741
|
i < 0 ? i = 0 : i > s && (i = s);
|
|
2734
|
-
let
|
|
2735
|
-
const
|
|
2736
|
-
|
|
2742
|
+
let o = Math.floor(e);
|
|
2743
|
+
const r = this.body.height - this.body.visibleHeight - this.footer.height;
|
|
2744
|
+
o < 0 ? o = 0 : o > r && (o = r), this.emit("setScroll", i, o);
|
|
2737
2745
|
}
|
|
2738
2746
|
setScrollX(t) {
|
|
2739
2747
|
let e = Math.floor(t);
|
|
@@ -2800,13 +2808,13 @@ class Wt {
|
|
|
2800
2808
|
this.updateScroll(t);
|
|
2801
2809
|
}
|
|
2802
2810
|
onMouseDown(t) {
|
|
2803
|
-
const { offsetX: e, offsetY: i, clientX: s, clientY:
|
|
2804
|
-
if (!(s == this.clientX &&
|
|
2811
|
+
const { offsetX: e, offsetY: i, clientX: s, clientY: o } = t;
|
|
2812
|
+
if (!(s == this.clientX && o == this.clientY)) {
|
|
2805
2813
|
if (this.isOnScrollbar(e, i))
|
|
2806
|
-
this.clientX = s, this.clientY =
|
|
2814
|
+
this.clientX = s, this.clientY = o, this.isDragging = !0, this.ctx.scrollerMove = !0, this.isFocus = !0, this.dragStart = this.scroll;
|
|
2807
2815
|
else if (this.isOnTrack(e, i)) {
|
|
2808
|
-
let
|
|
2809
|
-
this.type === "vertical" ?
|
|
2816
|
+
let r = 0;
|
|
2817
|
+
this.type === "vertical" ? r = (i - this.ctx.header.height - this.barHeight / 2) / (this.visibleDistance - this.barHeight) * this.distance : r = (e - this.barWidth / 2) / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(r, this.distance));
|
|
2810
2818
|
}
|
|
2811
2819
|
}
|
|
2812
2820
|
}
|
|
@@ -2814,16 +2822,16 @@ class Wt {
|
|
|
2814
2822
|
this.isDragging = !1, this.isFocus = !1, this.clientX = 0, this.clientY = 0;
|
|
2815
2823
|
}
|
|
2816
2824
|
onMouseMove(t) {
|
|
2817
|
-
const { offsetX: e, offsetY: i, clientX: s, clientY:
|
|
2818
|
-
if (this.isOnScrollbar(e, i) && t.target === this.ctx.target ? this.isFocus = !0 : this.isFocus = !1, s == this.clientX &&
|
|
2819
|
-
let
|
|
2820
|
-
if (this.type === "horizontal" ?
|
|
2825
|
+
const { offsetX: e, offsetY: i, clientX: s, clientY: o } = t;
|
|
2826
|
+
if (this.isOnScrollbar(e, i) && t.target === this.ctx.target ? this.isFocus = !0 : this.isFocus = !1, s == this.clientX && o == this.clientY) return;
|
|
2827
|
+
let r = 0;
|
|
2828
|
+
if (this.type === "horizontal" ? r = s - this.clientX : r = o - this.clientY, this.isDragging && r !== 0) {
|
|
2821
2829
|
let n = 0;
|
|
2822
|
-
this.type === "vertical" ? n = this.dragStart +
|
|
2830
|
+
this.type === "vertical" ? n = this.dragStart + r / (this.visibleDistance - this.barHeight) * this.distance : n = this.dragStart + r / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(n, this.distance));
|
|
2823
2831
|
}
|
|
2824
2832
|
}
|
|
2825
|
-
isPointInElement(t, e, i, s,
|
|
2826
|
-
return t >= i && t <= i +
|
|
2833
|
+
isPointInElement(t, e, i, s, o, r) {
|
|
2834
|
+
return t >= i && t <= i + o && e >= s && e <= s + r;
|
|
2827
2835
|
}
|
|
2828
2836
|
isOnScrollbar(t, e) {
|
|
2829
2837
|
return this.isPointInElement(t, e, this.barX, this.barY, this.barWidth, this.barHeight);
|
|
@@ -2833,28 +2841,28 @@ class Wt {
|
|
|
2833
2841
|
}
|
|
2834
2842
|
updateScroll(t) {
|
|
2835
2843
|
const e = t.deltaX, i = t.deltaY;
|
|
2836
|
-
this.type === "vertical" && t.shiftKey === !1 ? (this.scroll === 0 && i < 0 || this.scroll === this.distance && i > 0 || t.preventDefault(), this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance))) : this.type === "horizontal" && (t.shiftKey ?
|
|
2844
|
+
this.type === "vertical" && t.shiftKey === !1 ? (this.scroll === 0 && i < 0 || this.scroll === this.distance && i > 0 || t.preventDefault(), this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance))) : this.type === "horizontal" && (t.shiftKey ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.scroll = Math.max(0, Math.min(this.scroll + e, this.distance)));
|
|
2837
2845
|
}
|
|
2838
2846
|
updatedSize() {
|
|
2839
2847
|
const {
|
|
2840
2848
|
body: t,
|
|
2841
2849
|
header: e,
|
|
2842
2850
|
config: { SCROLLER_TRACK_SIZE: i = 0, SCROLLER_SIZE: s = 0 }
|
|
2843
|
-
} = this.ctx,
|
|
2851
|
+
} = this.ctx, o = this.ctx.target.width + 1, r = this.ctx.target.height, n = e.height, h = e.width, l = t.height, f = this.ctx.footer.height;
|
|
2844
2852
|
if (this.type === "vertical") {
|
|
2845
|
-
this.visibleDistance =
|
|
2846
|
-
const
|
|
2847
|
-
let x = Math.floor(
|
|
2853
|
+
this.visibleDistance = r - i - n, this.distance = l - this.visibleDistance + f, this.trackX = o - i, this.trackY = 0, this.splitPoints = [this.trackX, n, this.trackX + i, n], this.trackWidth = i, this.trackHeight = r, this.barX = this.trackX + (i - s) / 2, this.barWidth = s;
|
|
2854
|
+
const d = this.distance ? this.visibleDistance / l : 0;
|
|
2855
|
+
let x = Math.floor(d * this.visibleDistance);
|
|
2848
2856
|
x < 30 ? x = 30 : x > this.visibleDistance && (x = 0), this.barHeight = x, this.barY = n + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2849
2857
|
} else {
|
|
2850
|
-
this.visibleDistance =
|
|
2851
|
-
r - i,
|
|
2858
|
+
this.visibleDistance = o - i, this.distance = h - this.visibleDistance, this.splitPoints = [
|
|
2852
2859
|
o - i,
|
|
2853
2860
|
r - i,
|
|
2854
|
-
o
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2861
|
+
o - i,
|
|
2862
|
+
r
|
|
2863
|
+
], this.trackX = 0, this.trackY = r - i, this.trackWidth = o, this.trackHeight = i;
|
|
2864
|
+
const d = this.distance ? this.visibleDistance / h : 0;
|
|
2865
|
+
let x = Math.floor(d * this.visibleDistance);
|
|
2858
2866
|
this.barY = this.trackY + 0.5 + (i - s) / 2, x < 30 ? x = 30 : x >= this.visibleDistance && (x = 0), this.barWidth = x, this.barHeight = s, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2859
2867
|
}
|
|
2860
2868
|
}
|
|
@@ -2926,8 +2934,8 @@ class oi {
|
|
|
2926
2934
|
s > e.visibleHeight && this.setScrollY(s - e.visibleHeight / 2);
|
|
2927
2935
|
}
|
|
2928
2936
|
scrollToRowKey(t) {
|
|
2929
|
-
const { body: e, database: i } = this.ctx, s = i.getRowIndexForRowKey(t), { top:
|
|
2930
|
-
this.setScrollY(
|
|
2937
|
+
const { body: e, database: i } = this.ctx, s = i.getRowIndexForRowKey(t), { top: o } = i.getPositionForRowIndex(s);
|
|
2938
|
+
this.setScrollY(o - e.visibleHeight / 2);
|
|
2931
2939
|
}
|
|
2932
2940
|
}
|
|
2933
2941
|
class ni {
|
|
@@ -2979,32 +2987,21 @@ class ni {
|
|
|
2979
2987
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
2980
2988
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
2981
2989
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
2982
|
-
const s = Ut(i),
|
|
2983
|
-
this.height = t * s, this.width =
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
), this.visibleHeight = this.height;
|
|
2987
|
-
const o = Ue(Zt(i, s));
|
|
2988
|
-
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
2990
|
+
const s = Ut(i), o = It(i);
|
|
2991
|
+
this.height = t * s, this.width = o.reduce((d, x) => d + ((x == null ? void 0 : x.width) || 100), 0), this.visibleHeight = this.height;
|
|
2992
|
+
const r = Ue(Zt(i, s));
|
|
2993
|
+
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
2989
2994
|
const n = this.ctx.targetContainer.getBoundingClientRect();
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2995
|
+
this.resizeNum > 0 ? this.ctx.target.width = n.width : this.ctx.target.width = this.width + e - 1, this.visibleWidth = this.ctx.target.width - e;
|
|
2996
|
+
const h = this.visibleWidth - this.width;
|
|
2997
|
+
if (this.resizeNum && h > 0) {
|
|
2998
|
+
const d = Math.floor(h / this.resizeNum * 100) / 100;
|
|
2999
|
+
this.resizeAllColumn(d);
|
|
2993
3000
|
}
|
|
2994
|
-
const l = this.fixedLeftCellHeaders.filter(
|
|
2995
|
-
|
|
2996
|
-
);
|
|
2997
|
-
this.ctx.
|
|
2998
|
-
(d, f) => d + f.width,
|
|
2999
|
-
0
|
|
3000
|
-
);
|
|
3001
|
-
const h = this.fixedRightCellHeaders.filter(
|
|
3002
|
-
(d) => !d.hasChildren
|
|
3003
|
-
);
|
|
3004
|
-
this.ctx.fixedRightWidth = h.reduce(
|
|
3005
|
-
(d, f) => d + f.width,
|
|
3006
|
-
e
|
|
3007
|
-
), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
3001
|
+
const l = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
3002
|
+
this.ctx.fixedLeftWidth = l.reduce((d, x) => d + x.width, 0);
|
|
3003
|
+
const f = this.fixedRightCellHeaders.filter((d) => !d.hasChildren);
|
|
3004
|
+
this.ctx.fixedRightWidth = f.reduce((d, x) => d + x.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
3008
3005
|
}
|
|
3009
3006
|
// 调整表头的宽度
|
|
3010
3007
|
initResizeColumn() {
|
|
@@ -3022,39 +3019,36 @@ class ni {
|
|
|
3022
3019
|
config: { RESIZE_COLUMN_MIN_WIDTH: s }
|
|
3023
3020
|
} = this.ctx;
|
|
3024
3021
|
if (this.isResizing && this.resizeTarget) {
|
|
3025
|
-
const
|
|
3026
|
-
let
|
|
3027
|
-
|
|
3022
|
+
const o = this.resizeTarget.width;
|
|
3023
|
+
let r = e.offsetX - this.offsetX;
|
|
3024
|
+
r + o < s && (r = -(o - s)), this.resizeDiff = r, this.ctx.emit("draw");
|
|
3028
3025
|
} else {
|
|
3029
3026
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3030
3027
|
return;
|
|
3031
3028
|
this.ctx.target.style.cursor === "col-resize" && (this.ctx.target.style.cursor = "default");
|
|
3032
|
-
const
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
const n = e.layerX, l = o.getDrawX();
|
|
3038
|
-
n > l + o.width - 5 && n < l + o.width + 4 && n < i.width - 4 && // 视窗中最后一列不允许调整宽
|
|
3039
|
-
o.colspan <= 1 && e.target instanceof HTMLCanvasElement && this.ctx.isTarget(e.target) && e.layerY <= this.height && (this.ctx.target.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3029
|
+
const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3030
|
+
for (const r of o) {
|
|
3031
|
+
const n = e.layerX, h = r.getDrawX();
|
|
3032
|
+
n > h + r.width - 5 && n < h + r.width + 4 && n < i.width - 4 && // 视窗中最后一列不允许调整宽
|
|
3033
|
+
r.colspan <= 1 && e.target instanceof HTMLCanvasElement && this.ctx.isTarget(e.target) && e.layerY <= this.height && (this.ctx.target.style.cursor = "col-resize", this.resizeTarget = r);
|
|
3040
3034
|
}
|
|
3041
3035
|
}
|
|
3042
3036
|
}));
|
|
3043
3037
|
}
|
|
3044
3038
|
resizeColumn(t, e) {
|
|
3045
|
-
const i = (
|
|
3046
|
-
|
|
3047
|
-
if (
|
|
3048
|
-
const n =
|
|
3049
|
-
|
|
3039
|
+
const i = (o) => {
|
|
3040
|
+
o.forEach((r) => {
|
|
3041
|
+
if (r.children && r.children.length > 0 && i(r.children), r.key === t.key) {
|
|
3042
|
+
const n = r.width || 100;
|
|
3043
|
+
r.width = n + e;
|
|
3050
3044
|
}
|
|
3051
3045
|
});
|
|
3052
3046
|
};
|
|
3053
3047
|
i(this.columns), this.ctx.database.setColumns(this.columns), this.init(), this.ctx.emit("draw");
|
|
3054
3048
|
let s = 0;
|
|
3055
3049
|
if (this.width < this.visibleWidth) {
|
|
3056
|
-
const
|
|
3057
|
-
s = Math.floor(
|
|
3050
|
+
const o = this.visibleWidth - this.width;
|
|
3051
|
+
s = Math.floor(o / this.resizeNum * 100) / 100, this.resizeAllColumn(s), this.ctx.emit("draw");
|
|
3058
3052
|
}
|
|
3059
3053
|
this.ctx.emit("resizeColumnChange", {
|
|
3060
3054
|
colIndex: t.colIndex,
|
|
@@ -3069,18 +3063,18 @@ class ni {
|
|
|
3069
3063
|
if (t === 0) return;
|
|
3070
3064
|
const e = /* @__PURE__ */ new Map();
|
|
3071
3065
|
let i = !0;
|
|
3072
|
-
for (const
|
|
3073
|
-
if (
|
|
3074
|
-
e.set(
|
|
3066
|
+
for (const o of this.allCellHeaders)
|
|
3067
|
+
if (o.widthFillDisable)
|
|
3068
|
+
e.set(o.key, o.width);
|
|
3075
3069
|
else {
|
|
3076
|
-
const
|
|
3077
|
-
e.set(
|
|
3070
|
+
const r = o.width + t * o.colspan;
|
|
3071
|
+
e.set(o.key, r), r < this.ctx.config.RESIZE_COLUMN_MIN_WIDTH && (i = !1);
|
|
3078
3072
|
}
|
|
3079
3073
|
if (!i)
|
|
3080
3074
|
return;
|
|
3081
|
-
const s = (
|
|
3082
|
-
|
|
3083
|
-
e.has(
|
|
3075
|
+
const s = (o) => {
|
|
3076
|
+
o.forEach((r) => {
|
|
3077
|
+
e.has(r.key) && (r.width = e.get(r.key)), r.children && r.children.length > 0 && s(r.children);
|
|
3084
3078
|
});
|
|
3085
3079
|
};
|
|
3086
3080
|
s(this.columns), this.ctx.database.setColumns(this.columns), this.init();
|
|
@@ -3088,21 +3082,13 @@ class ni {
|
|
|
3088
3082
|
render(t, e) {
|
|
3089
3083
|
const i = t.length;
|
|
3090
3084
|
let s = e;
|
|
3091
|
-
const { HEADER_HEIGHT:
|
|
3092
|
-
for (let
|
|
3093
|
-
const n = t[
|
|
3094
|
-
let
|
|
3095
|
-
n.children && (
|
|
3096
|
-
const
|
|
3097
|
-
|
|
3098
|
-
this.columnIndex,
|
|
3099
|
-
s,
|
|
3100
|
-
h,
|
|
3101
|
-
d,
|
|
3102
|
-
l,
|
|
3103
|
-
n
|
|
3104
|
-
);
|
|
3105
|
-
this.ctx.database.setHeader(n.key, f), this.allCellHeaders.push(f), n.children || (this.leafCellHeaders.push(f), f.column.widthFillDisable || this.resizeNum++), n.fixed === "left" ? this.fixedLeftCellHeaders.push(f) : n.fixed === "right" ? this.fixedRightCellHeaders.push(f) : this.centerCellHeaders.push(f), !n.children && this.columnIndex++, n.children && this.render(n.children, s), s += d;
|
|
3085
|
+
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
3086
|
+
for (let r = 0; r < i; r++) {
|
|
3087
|
+
const n = t[r], h = o * (n.rowspan || 1), l = o * n.level;
|
|
3088
|
+
let f = n.width || 100;
|
|
3089
|
+
n.children && (f = It(n.children).reduce((u, y) => u + ((y == null ? void 0 : y.width) || 100), 0));
|
|
3090
|
+
const d = new te(this.ctx, this.columnIndex, s, l, f, h, n);
|
|
3091
|
+
this.ctx.database.setHeader(n.key, d), this.allCellHeaders.push(d), n.children || (this.leafCellHeaders.push(d), d.column.widthFillDisable || this.resizeNum++), n.fixed === "left" ? this.fixedLeftCellHeaders.push(d) : n.fixed === "right" ? this.fixedRightCellHeaders.push(d) : this.centerCellHeaders.push(d), !n.children && this.columnIndex++, n.children && this.render(n.children, s), s += f;
|
|
3106
3092
|
}
|
|
3107
3093
|
}
|
|
3108
3094
|
drawTipLine() {
|
|
@@ -3110,8 +3096,8 @@ class ni {
|
|
|
3110
3096
|
const {
|
|
3111
3097
|
target: t,
|
|
3112
3098
|
config: { RESIZE_COLUMN_LINE_COLOR: e }
|
|
3113
|
-
} = this.ctx, i = this.resizeTarget.getDrawX(), s = this.resizeTarget.width,
|
|
3114
|
-
this.ctx.paint.drawLine(
|
|
3099
|
+
} = this.ctx, i = this.resizeTarget.getDrawX(), s = this.resizeTarget.width, o = i + s + this.resizeDiff - 0.5, r = [o + 0.5, 0, o + 0.5, t.height];
|
|
3100
|
+
this.ctx.paint.drawLine(r, {
|
|
3115
3101
|
borderColor: e,
|
|
3116
3102
|
borderWidth: 1
|
|
3117
3103
|
});
|
|
@@ -3123,19 +3109,19 @@ class ni {
|
|
|
3123
3109
|
fixedRightWidth: e,
|
|
3124
3110
|
scrollX: i,
|
|
3125
3111
|
header: s,
|
|
3126
|
-
target:
|
|
3127
|
-
config: { HEADER_BG_COLOR:
|
|
3112
|
+
target: o,
|
|
3113
|
+
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: n }
|
|
3128
3114
|
} = this.ctx;
|
|
3129
3115
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
3130
|
-
fillColor:
|
|
3116
|
+
fillColor: r,
|
|
3131
3117
|
side: "right",
|
|
3132
3118
|
shadowWidth: 4,
|
|
3133
3119
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3134
3120
|
colorEnd: "rgba(0,0,0,0)"
|
|
3135
3121
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3136
|
-
const
|
|
3137
|
-
this.ctx.paint.drawShadow(
|
|
3138
|
-
fillColor:
|
|
3122
|
+
const h = s.width - (this.x + this.width) + o.width - e;
|
|
3123
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3124
|
+
fillColor: r,
|
|
3139
3125
|
side: "left",
|
|
3140
3126
|
shadowWidth: 4,
|
|
3141
3127
|
colorStart: "rgba(0,0,0,0)",
|
|
@@ -3151,13 +3137,7 @@ class ni {
|
|
|
3151
3137
|
i.push(s), s.hasChildren || t.push(s);
|
|
3152
3138
|
}), this.fixedRightCellHeaders.forEach((s) => {
|
|
3153
3139
|
i.push(s), s.hasChildren || t.push(s);
|
|
3154
|
-
}), this.renderCenterCellHeaders = e, this.renderFixedCellHeaders = i, this.renderLeafCellHeaders = t.sort(
|
|
3155
|
-
(s, r) => s.x - r.x
|
|
3156
|
-
), this.visibleLeafColumns = this.renderLeafCellHeaders.map(
|
|
3157
|
-
(s) => s.column
|
|
3158
|
-
), this.ctx.header.visibleLeafColumns = this.visibleLeafColumns, this.ctx.header.leafCellHeaders = this.leafCellHeaders, this.ctx.header.renderLeafCellHeaders = this.renderLeafCellHeaders, this.ctx.header.renderCellHeaders = this.renderFixedCellHeaders.concat(
|
|
3159
|
-
this.renderCenterCellHeaders
|
|
3160
|
-
);
|
|
3140
|
+
}), this.renderCenterCellHeaders = e, this.renderFixedCellHeaders = i, this.renderLeafCellHeaders = t.sort((s, o) => s.x - o.x), this.visibleLeafColumns = this.renderLeafCellHeaders.map((s) => s.column), this.ctx.header.visibleLeafColumns = this.visibleLeafColumns, this.ctx.header.leafCellHeaders = this.leafCellHeaders, this.ctx.header.renderLeafCellHeaders = this.renderLeafCellHeaders, this.ctx.header.renderCellHeaders = this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders);
|
|
3161
3141
|
}
|
|
3162
3142
|
draw() {
|
|
3163
3143
|
this.renderCenterCellHeaders.forEach((t) => {
|
|
@@ -3168,7 +3148,7 @@ class ni {
|
|
|
3168
3148
|
}
|
|
3169
3149
|
}
|
|
3170
3150
|
class ee {
|
|
3171
|
-
constructor(t, e, i = 0, s = 0,
|
|
3151
|
+
constructor(t, e, i = 0, s = 0, o = 0, r = 0, n, h = "body") {
|
|
3172
3152
|
c(this, "ctx");
|
|
3173
3153
|
c(this, "x", 0);
|
|
3174
3154
|
c(this, "y", 0);
|
|
@@ -3181,24 +3161,24 @@ class ee {
|
|
|
3181
3161
|
c(this, "rowKey", "");
|
|
3182
3162
|
c(this, "rowType", "body");
|
|
3183
3163
|
c(this, "data");
|
|
3184
|
-
this.ctx = t, this.x = i, this.y = s, this.width =
|
|
3164
|
+
this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType = h, this.data = n, this.update();
|
|
3185
3165
|
}
|
|
3186
3166
|
update() {
|
|
3187
3167
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3188
|
-
t.renderLeafCellHeaders.forEach((
|
|
3189
|
-
const
|
|
3168
|
+
t.renderLeafCellHeaders.forEach((o) => {
|
|
3169
|
+
const r = new Qt(
|
|
3190
3170
|
this.ctx,
|
|
3191
3171
|
this.rowIndex,
|
|
3192
|
-
|
|
3193
|
-
|
|
3172
|
+
o.colIndex,
|
|
3173
|
+
o.x,
|
|
3194
3174
|
this.y,
|
|
3195
|
-
|
|
3175
|
+
o.width,
|
|
3196
3176
|
this.height,
|
|
3197
|
-
|
|
3177
|
+
o.column,
|
|
3198
3178
|
this.data,
|
|
3199
3179
|
this.rowType
|
|
3200
3180
|
);
|
|
3201
|
-
|
|
3181
|
+
r.fixed ? i.push(r) : s.push(r), e.push(r);
|
|
3202
3182
|
}), this.cells = e, this.fixedCells = i, this.noFixedCells = s;
|
|
3203
3183
|
}
|
|
3204
3184
|
drawCenter() {
|
|
@@ -3252,13 +3232,13 @@ class ai {
|
|
|
3252
3232
|
database: i,
|
|
3253
3233
|
config: {
|
|
3254
3234
|
FOOTER_FIXED: s,
|
|
3255
|
-
SCROLLER_TRACK_SIZE:
|
|
3256
|
-
BORDER_COLOR:
|
|
3235
|
+
SCROLLER_TRACK_SIZE: o = 0,
|
|
3236
|
+
BORDER_COLOR: r,
|
|
3257
3237
|
BORDER_RADIUS: n,
|
|
3258
|
-
HEIGHT:
|
|
3259
|
-
EMPTY_BODY_HEIGHT:
|
|
3260
|
-
MAX_HEIGHT:
|
|
3261
|
-
ENABLE_OFFSET_HEIGHT:
|
|
3238
|
+
HEIGHT: h,
|
|
3239
|
+
EMPTY_BODY_HEIGHT: l = 0,
|
|
3240
|
+
MAX_HEIGHT: f = 0,
|
|
3241
|
+
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3262
3242
|
OFFSET_HEIGHT: x = 0
|
|
3263
3243
|
}
|
|
3264
3244
|
} = this.ctx;
|
|
@@ -3268,9 +3248,9 @@ class ai {
|
|
|
3268
3248
|
const { data: u, sumHeight: y } = i.getData();
|
|
3269
3249
|
this.height = y, this.data = u;
|
|
3270
3250
|
const { top: g } = t.getBoundingClientRect();
|
|
3271
|
-
this.width = e.width, this.visibleWidth = t.width -
|
|
3251
|
+
this.width = e.width, this.visibleWidth = t.width - o;
|
|
3272
3252
|
const w = this.ctx.footer.height;
|
|
3273
|
-
this.data.length || (this.height =
|
|
3253
|
+
this.data.length || (this.height = l);
|
|
3274
3254
|
const p = this.data.length ? "not-empty" : "empty";
|
|
3275
3255
|
this.ctx.emit("emptyChange", {
|
|
3276
3256
|
isEmpty: p,
|
|
@@ -3279,18 +3259,18 @@ class ai {
|
|
|
3279
3259
|
bodyHeight: this.height,
|
|
3280
3260
|
footerHeight: w,
|
|
3281
3261
|
width: this.width,
|
|
3282
|
-
height: this.data.length ? 0 :
|
|
3262
|
+
height: this.data.length ? 0 : l + w
|
|
3283
3263
|
});
|
|
3284
|
-
let E = this.height + e.height +
|
|
3264
|
+
let E = this.height + e.height + o;
|
|
3285
3265
|
E += w;
|
|
3286
3266
|
let m = 0;
|
|
3287
|
-
this.data.length &&
|
|
3267
|
+
this.data.length && d ? (m = window.innerHeight - g - x, m < 0 && (m = 32, console.error(
|
|
3288
3268
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3289
|
-
))) : this.data.length &&
|
|
3290
|
-
let b = t.height - e.height -
|
|
3269
|
+
))) : this.data.length && h ? m = h : this.data.length && f && E > f ? m = f : m = E, m > 0 && (this.ctx.target.height = m);
|
|
3270
|
+
let b = t.height - e.height - o;
|
|
3291
3271
|
s ? this.visibleHeight = b - w : 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 = u, this.ctx.target.setAttribute(
|
|
3292
3272
|
"style",
|
|
3293
|
-
`outline: none; position: relative; border-radius: ${n}px; border: 1px solid ${
|
|
3273
|
+
`outline: none; position: relative; border-radius: ${n}px; border: 1px solid ${r}; height:${this.ctx.target.height}px;width:${this.ctx.target.width - 1}px;`
|
|
3294
3274
|
);
|
|
3295
3275
|
}
|
|
3296
3276
|
// 调整行的高度
|
|
@@ -3307,37 +3287,37 @@ class ai {
|
|
|
3307
3287
|
}), this.ctx.on("mousemove", (e) => {
|
|
3308
3288
|
if (this.ctx.editing) return;
|
|
3309
3289
|
const i = e.offsetY, s = e.offsetX, {
|
|
3310
|
-
target:
|
|
3311
|
-
scrollY:
|
|
3290
|
+
target: o,
|
|
3291
|
+
scrollY: r,
|
|
3312
3292
|
config: { RESIZE_ROW_MIN_HEIGHT: n = 0 }
|
|
3313
3293
|
} = this.ctx;
|
|
3314
3294
|
if (this.isResizing && this.resizeTarget) {
|
|
3315
|
-
const
|
|
3316
|
-
let
|
|
3317
|
-
|
|
3295
|
+
const h = this.resizeTarget.height;
|
|
3296
|
+
let l = i - this.offsetY;
|
|
3297
|
+
l + h < n && (l = -(h - n)), this.resizeDiff = l, this.ctx.emit("draw");
|
|
3318
3298
|
} else {
|
|
3319
3299
|
if (this.resizeTarget = null, this.isMouseDown || this.ctx.target.style.cursor === "crosshair")
|
|
3320
3300
|
return;
|
|
3321
3301
|
this.ctx.target.style.cursor === "row-resize" && (this.ctx.target.style.cursor = "default");
|
|
3322
|
-
for (let
|
|
3323
|
-
const
|
|
3324
|
-
if (i >
|
|
3325
|
-
for (let
|
|
3326
|
-
const x =
|
|
3327
|
-
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget =
|
|
3302
|
+
for (let h = 0; h < this.renderRows.length; h++) {
|
|
3303
|
+
const l = this.renderRows[h];
|
|
3304
|
+
if (i > l.y - r + l.height - 1.5 && i < l.y - r + l.height + 1.5 && i < o.height - 4)
|
|
3305
|
+
for (let d = 0; d < l.cells.length; d++) {
|
|
3306
|
+
const x = l.cells[d];
|
|
3307
|
+
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget = l);
|
|
3328
3308
|
}
|
|
3329
3309
|
}
|
|
3330
3310
|
}
|
|
3331
3311
|
}));
|
|
3332
3312
|
}
|
|
3333
3313
|
resizeRow(t, e) {
|
|
3334
|
-
const { rowIndex: i, height: s, rowKey:
|
|
3314
|
+
const { rowIndex: i, height: s, rowKey: o, data: r } = t;
|
|
3335
3315
|
this.ctx.database.setRowHeight(i, s + e), this.init(), this.ctx.emit("draw"), this.ctx.emit("resizeRowChange", {
|
|
3336
3316
|
rowIndex: i,
|
|
3337
3317
|
oldHeight: s,
|
|
3338
3318
|
height: s + e,
|
|
3339
|
-
rowKey:
|
|
3340
|
-
row:
|
|
3319
|
+
rowKey: o,
|
|
3320
|
+
row: r,
|
|
3341
3321
|
data: this.data
|
|
3342
3322
|
});
|
|
3343
3323
|
}
|
|
@@ -3347,7 +3327,7 @@ class ai {
|
|
|
3347
3327
|
target: t,
|
|
3348
3328
|
scrollY: e,
|
|
3349
3329
|
config: { RESIZE_ROW_LINE_COLOR: i }
|
|
3350
|
-
} = this.ctx, s = this.resizeTarget.y - e,
|
|
3330
|
+
} = this.ctx, s = this.resizeTarget.y - e, o = this.resizeTarget.height, r = s + o + this.resizeDiff - 0.5, n = [0, r + 0.5, t.width, r + 0.5];
|
|
3351
3331
|
this.ctx.paint.drawLine(n, {
|
|
3352
3332
|
borderColor: i,
|
|
3353
3333
|
borderWidth: 1
|
|
@@ -3360,19 +3340,19 @@ class ai {
|
|
|
3360
3340
|
fixedRightWidth: e,
|
|
3361
3341
|
scrollX: i,
|
|
3362
3342
|
header: s,
|
|
3363
|
-
target:
|
|
3364
|
-
config: { HEADER_BG_COLOR:
|
|
3343
|
+
target: o,
|
|
3344
|
+
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: n }
|
|
3365
3345
|
} = this.ctx;
|
|
3366
3346
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
3367
|
-
fillColor:
|
|
3347
|
+
fillColor: r,
|
|
3368
3348
|
side: "right",
|
|
3369
3349
|
shadowWidth: 4,
|
|
3370
3350
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3371
3351
|
colorEnd: "rgba(0,0,0,0)"
|
|
3372
3352
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3373
|
-
const
|
|
3374
|
-
this.ctx.paint.drawShadow(
|
|
3375
|
-
fillColor:
|
|
3353
|
+
const h = s.width - (this.x + this.width) + o.width - e;
|
|
3354
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3355
|
+
fillColor: r,
|
|
3376
3356
|
side: "left",
|
|
3377
3357
|
shadowWidth: 4,
|
|
3378
3358
|
colorStart: "rgba(0,0,0,0)",
|
|
@@ -3381,28 +3361,28 @@ class ai {
|
|
|
3381
3361
|
}
|
|
3382
3362
|
}
|
|
3383
3363
|
binarySearch(t, e) {
|
|
3384
|
-
let i = 0, s = t.length - 1,
|
|
3364
|
+
let i = 0, s = t.length - 1, o = -1;
|
|
3385
3365
|
for (; i <= s; ) {
|
|
3386
|
-
let
|
|
3366
|
+
let r = Math.floor((i + s) / 2), n = t[r].bottom;
|
|
3387
3367
|
if (n === e)
|
|
3388
|
-
return
|
|
3389
|
-
n < e ? i =
|
|
3368
|
+
return r;
|
|
3369
|
+
n < e ? i = r + 1 : (o = r, s = r - 1);
|
|
3390
3370
|
}
|
|
3391
|
-
return
|
|
3371
|
+
return o;
|
|
3392
3372
|
}
|
|
3393
3373
|
update() {
|
|
3394
3374
|
this.init();
|
|
3395
|
-
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data:
|
|
3396
|
-
this.ctx.maxRowIndex =
|
|
3397
|
-
const n = this.binarySearch(
|
|
3398
|
-
let
|
|
3399
|
-
|
|
3400
|
-
const
|
|
3401
|
-
for (let
|
|
3402
|
-
const
|
|
3403
|
-
|
|
3375
|
+
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: o, positions: r } = e.getData();
|
|
3376
|
+
this.ctx.maxRowIndex = o.length - 1;
|
|
3377
|
+
const n = this.binarySearch(r, s);
|
|
3378
|
+
let h = this.binarySearch(r, s + this.visibleHeight);
|
|
3379
|
+
h === -1 && (h = o.length), this.headIndex = Math.max(0, n), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = o.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3380
|
+
const l = [];
|
|
3381
|
+
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3382
|
+
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: y } = this.ctx.database.getPositionForRowIndex(d), g = new ee(this.ctx, d, 0, y + this.y, t.width, u, x);
|
|
3383
|
+
l.push(g);
|
|
3404
3384
|
}
|
|
3405
|
-
this.renderRows =
|
|
3385
|
+
this.renderRows = l, this.ctx.body.renderRows = l;
|
|
3406
3386
|
}
|
|
3407
3387
|
draw() {
|
|
3408
3388
|
this.renderRows.forEach((t) => {
|
|
@@ -3430,9 +3410,9 @@ class ci {
|
|
|
3430
3410
|
const {
|
|
3431
3411
|
header: t,
|
|
3432
3412
|
body: e,
|
|
3433
|
-
config: { CELL_FOOTER_HEIGHT: i, FOOTER_FIXED: s, SCROLLER_TRACK_SIZE:
|
|
3413
|
+
config: { CELL_FOOTER_HEIGHT: i, FOOTER_FIXED: s, SCROLLER_TRACK_SIZE: o }
|
|
3434
3414
|
} = this.ctx;
|
|
3435
|
-
this.width = t.width, this.visibleWidth = t.visibleWidth, this.height = this.data.reduce((
|
|
3415
|
+
this.width = t.width, this.visibleWidth = t.visibleWidth, this.height = this.data.reduce((r) => r + i, 0), this.visibleHeight = this.height, s ? this.y = this.ctx.target.height - this.height - o : 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;
|
|
3436
3416
|
}
|
|
3437
3417
|
drawFiexShadow() {
|
|
3438
3418
|
const {
|
|
@@ -3440,20 +3420,20 @@ class ci {
|
|
|
3440
3420
|
fixedRightWidth: e,
|
|
3441
3421
|
scrollX: i,
|
|
3442
3422
|
header: s,
|
|
3443
|
-
target:
|
|
3444
|
-
config: { HEADER_BG_COLOR:
|
|
3423
|
+
target: o,
|
|
3424
|
+
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: n }
|
|
3445
3425
|
} = this.ctx;
|
|
3446
|
-
let
|
|
3447
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3448
|
-
fillColor:
|
|
3426
|
+
let h = this.y;
|
|
3427
|
+
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, {
|
|
3428
|
+
fillColor: r,
|
|
3449
3429
|
side: "right",
|
|
3450
3430
|
shadowWidth: 4,
|
|
3451
3431
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3452
3432
|
colorEnd: "rgba(0,0,0,0)"
|
|
3453
3433
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3454
|
-
const
|
|
3455
|
-
this.ctx.paint.drawShadow(
|
|
3456
|
-
fillColor:
|
|
3434
|
+
const l = s.width - (this.x + this.width) + o.width - e;
|
|
3435
|
+
this.ctx.paint.drawShadow(l + 1, h, e, this.height, {
|
|
3436
|
+
fillColor: r,
|
|
3457
3437
|
side: "left",
|
|
3458
3438
|
shadowWidth: 4,
|
|
3459
3439
|
colorStart: "rgba(0,0,0,0)",
|
|
@@ -3466,10 +3446,10 @@ class ci {
|
|
|
3466
3446
|
const { CELL_FOOTER_HEIGHT: t } = this.ctx.config;
|
|
3467
3447
|
let e = this.y;
|
|
3468
3448
|
const i = [];
|
|
3469
|
-
this.data.forEach((s,
|
|
3470
|
-
const
|
|
3449
|
+
this.data.forEach((s, o) => {
|
|
3450
|
+
const r = new ee(
|
|
3471
3451
|
this.ctx,
|
|
3472
|
-
|
|
3452
|
+
o,
|
|
3473
3453
|
0,
|
|
3474
3454
|
e,
|
|
3475
3455
|
this.width,
|
|
@@ -3477,7 +3457,7 @@ class ci {
|
|
|
3477
3457
|
s,
|
|
3478
3458
|
"footer"
|
|
3479
3459
|
);
|
|
3480
|
-
e += t, i.push(
|
|
3460
|
+
e += t, i.push(r);
|
|
3481
3461
|
}), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
|
|
3482
3462
|
}
|
|
3483
3463
|
draw() {
|
|
@@ -3488,7 +3468,7 @@ class ci {
|
|
|
3488
3468
|
});
|
|
3489
3469
|
}
|
|
3490
3470
|
}
|
|
3491
|
-
class
|
|
3471
|
+
class hi {
|
|
3492
3472
|
// 垂直滚动定时器
|
|
3493
3473
|
constructor(t) {
|
|
3494
3474
|
c(this, "isCut", !1);
|
|
@@ -3510,7 +3490,7 @@ class li {
|
|
|
3510
3490
|
}, 100)
|
|
3511
3491
|
), this.ctx.on("cellHoverChange", (t) => {
|
|
3512
3492
|
if (!this.ctx.autofillMove) {
|
|
3513
|
-
if (
|
|
3493
|
+
if (t.operation) {
|
|
3514
3494
|
this.selectRows(t, !1);
|
|
3515
3495
|
return;
|
|
3516
3496
|
}
|
|
@@ -3518,7 +3498,7 @@ class li {
|
|
|
3518
3498
|
}
|
|
3519
3499
|
}), this.ctx.on("cellMousedown", (t, e) => {
|
|
3520
3500
|
if (this.ctx.isTarget(e.target) && this.ctx.target.style.cursor !== "pointer" && !this.ctx.isPointer && this.ctx.target.style.cursor !== "crosshair") {
|
|
3521
|
-
if (
|
|
3501
|
+
if (t.operation) {
|
|
3522
3502
|
this.isMultipleRow = !0, this.selectRows(t);
|
|
3523
3503
|
return;
|
|
3524
3504
|
}
|
|
@@ -3580,37 +3560,44 @@ class li {
|
|
|
3580
3560
|
}
|
|
3581
3561
|
setSelector(t, e) {
|
|
3582
3562
|
const { ENABLE_SELECTOR_SPAN_COL: i, ENABLE_SELECTOR_SPAN_ROW: s } = this.ctx.config;
|
|
3583
|
-
let
|
|
3563
|
+
let o = t, r = e;
|
|
3584
3564
|
if (!s) {
|
|
3565
|
+
const [n] = r;
|
|
3566
|
+
r = [n, n];
|
|
3567
|
+
}
|
|
3568
|
+
if (!i) {
|
|
3585
3569
|
const [n] = o;
|
|
3586
3570
|
o = [n, n];
|
|
3587
3571
|
}
|
|
3588
|
-
if (
|
|
3589
|
-
|
|
3590
|
-
|
|
3572
|
+
if (JSON.stringify(this.ctx.selector.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.selector.yArr) !== JSON.stringify(r)) {
|
|
3573
|
+
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3574
|
+
const { SELECTOR_AREA_MIN_X: n, SELECTOR_AREA_MAX_X: h, SELECTOR_AREA_MIN_Y: l, SELECTOR_AREA_MAX_Y: f } = this.ctx.config, d = n, x = h || this.ctx.maxColIndex, u = l, y = f || this.ctx.maxRowIndex;
|
|
3575
|
+
let [g, w] = o, [p, E] = r;
|
|
3576
|
+
if (g < d || p < u)
|
|
3577
|
+
return;
|
|
3578
|
+
this.ctx.selector.xArr = [Math.max(d, g), Math.min(x, w)], this.ctx.selector.yArr = [Math.max(u, p), Math.min(y, E)], this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("draw");
|
|
3591
3579
|
}
|
|
3592
|
-
(JSON.stringify(this.ctx.selector.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.selector.yArr) !== JSON.stringify(o)) && (this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0, this.ctx.selector.xArr = r, this.ctx.selector.yArr = o, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("draw"));
|
|
3593
3580
|
}
|
|
3594
3581
|
selectCols(t) {
|
|
3595
3582
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE || !this.ctx.config.ENABLE_SELECTOR_ALL_ROWS || this.ctx.autofillMove || this.ctx.columnResizing)
|
|
3596
3583
|
return;
|
|
3597
|
-
if (
|
|
3584
|
+
if (t.operation) {
|
|
3598
3585
|
this.selectAll();
|
|
3599
3586
|
return;
|
|
3600
3587
|
}
|
|
3601
|
-
const e =
|
|
3588
|
+
const { SELECTOR_AREA_MIN_Y: e, SELECTOR_AREA_MAX_Y: i } = this.ctx.config, s = e, o = i || this.ctx.maxRowIndex;
|
|
3602
3589
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3603
|
-
const { colIndex:
|
|
3604
|
-
if (t.colIndex >=
|
|
3605
|
-
const
|
|
3606
|
-
this.setSelector(
|
|
3590
|
+
const { colIndex: r } = this.ctx.focusCellHeader;
|
|
3591
|
+
if (t.colIndex >= r) {
|
|
3592
|
+
const n = [r, t.colIndex + t.colspan - 1], h = [s, o];
|
|
3593
|
+
this.setSelector(n, h);
|
|
3607
3594
|
} else {
|
|
3608
|
-
const
|
|
3609
|
-
this.setSelector(
|
|
3595
|
+
const n = [t.colIndex, r], h = [s, o];
|
|
3596
|
+
this.setSelector(n, h);
|
|
3610
3597
|
}
|
|
3611
3598
|
} else {
|
|
3612
|
-
const
|
|
3613
|
-
this.setSelector(
|
|
3599
|
+
const r = [t.colIndex, t.colIndex + t.colspan - 1], n = [s, o];
|
|
3600
|
+
this.setSelector(r, n);
|
|
3614
3601
|
}
|
|
3615
3602
|
}
|
|
3616
3603
|
selectAll() {
|
|
@@ -3618,27 +3605,27 @@ class li {
|
|
|
3618
3605
|
return;
|
|
3619
3606
|
const { ENABLE_SELECTOR_ALL_ROWS: t, ENABLE_SELECTOR_ALL_COLS: e } = this.ctx.config;
|
|
3620
3607
|
if (t && e) {
|
|
3621
|
-
const s = this.ctx.
|
|
3622
|
-
this.setSelector(
|
|
3608
|
+
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MIN_Y: o, SELECTOR_AREA_MAX_Y: r } = this.ctx.config, n = i, h = s || this.ctx.maxColIndex, l = o, f = r || this.ctx.maxRowIndex, d = [n, h], x = [l, f];
|
|
3609
|
+
this.setSelector(d, x);
|
|
3623
3610
|
}
|
|
3624
3611
|
}
|
|
3625
3612
|
selectRows(t, e = !0) {
|
|
3626
3613
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE || !this.ctx.config.ENABLE_SELECTOR_ALL_COLS || this.ctx.autofillMove)
|
|
3627
3614
|
return;
|
|
3628
|
-
const i = this.ctx.
|
|
3615
|
+
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s } = this.ctx.config, o = s || this.ctx.maxColIndex, r = i;
|
|
3629
3616
|
if (e) {
|
|
3630
3617
|
this.ctx.setFocusCell(t);
|
|
3631
|
-
const
|
|
3632
|
-
this.setSelector(
|
|
3618
|
+
const n = [r, o], h = [t.rowIndex, t.rowIndex];
|
|
3619
|
+
this.setSelector(n, h);
|
|
3633
3620
|
}
|
|
3634
3621
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3635
|
-
const { rowIndex:
|
|
3636
|
-
if (t.rowIndex >=
|
|
3637
|
-
const
|
|
3638
|
-
this.setSelector(
|
|
3622
|
+
const { rowIndex: n } = this.ctx.focusCell;
|
|
3623
|
+
if (t.rowIndex >= n) {
|
|
3624
|
+
const h = [r, o], l = [n, t.rowIndex];
|
|
3625
|
+
this.setSelector(h, l);
|
|
3639
3626
|
} else {
|
|
3640
|
-
const
|
|
3641
|
-
this.setSelector(
|
|
3627
|
+
const h = [r, o], l = [t.rowIndex, n];
|
|
3628
|
+
this.setSelector(h, l);
|
|
3642
3629
|
}
|
|
3643
3630
|
}
|
|
3644
3631
|
}
|
|
@@ -3647,20 +3634,20 @@ class li {
|
|
|
3647
3634
|
return;
|
|
3648
3635
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3649
3636
|
if (t && e && i) {
|
|
3650
|
-
const { rowIndex: s, colIndex:
|
|
3651
|
-
this.setSelector(
|
|
3637
|
+
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), n = Math.max(i.colIndex, o), h = Math.min(i.rowIndex, s), l = Math.max(i.rowIndex, s), f = [r, n], d = [h, l];
|
|
3638
|
+
this.setSelector(f, d);
|
|
3652
3639
|
}
|
|
3653
3640
|
}
|
|
3654
3641
|
click(t = !1) {
|
|
3655
3642
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3656
3643
|
if (e)
|
|
3657
3644
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3658
|
-
const { colIndex: s, rowIndex:
|
|
3645
|
+
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: n } = e, h = Math.min(r, s), l = Math.max(r, s), f = Math.min(n, o), d = Math.max(n, o), x = [h, l], u = [f, d];
|
|
3659
3646
|
this.setSelector(x, u);
|
|
3660
3647
|
} else {
|
|
3661
3648
|
this.ctx.emit("cellSelectedClick", e);
|
|
3662
|
-
const s = [e.colIndex, e.colIndex],
|
|
3663
|
-
this.setSelector(s,
|
|
3649
|
+
const s = [e.colIndex, e.colIndex], o = [e.rowIndex, e.rowIndex];
|
|
3650
|
+
this.setSelector(s, o), this.adjustBoundaryPosition();
|
|
3664
3651
|
}
|
|
3665
3652
|
}
|
|
3666
3653
|
clearCopyLine() {
|
|
@@ -3673,8 +3660,8 @@ class li {
|
|
|
3673
3660
|
* @returns
|
|
3674
3661
|
*/
|
|
3675
3662
|
getCell(t, e) {
|
|
3676
|
-
const i = this.ctx.body.renderRows.find((
|
|
3677
|
-
return i == null ? void 0 : i.cells.find((
|
|
3663
|
+
const i = this.ctx.body.renderRows.find((o) => o.rowIndex === t);
|
|
3664
|
+
return i == null ? void 0 : i.cells.find((o) => o.colIndex === e);
|
|
3678
3665
|
}
|
|
3679
3666
|
/**
|
|
3680
3667
|
* 复制
|
|
@@ -3690,13 +3677,13 @@ class li {
|
|
|
3690
3677
|
}
|
|
3691
3678
|
clearSelectedData(t, e, i = !1) {
|
|
3692
3679
|
let s = [];
|
|
3693
|
-
const
|
|
3680
|
+
const o = /* @__PURE__ */ new Set();
|
|
3694
3681
|
for (let n = 0; n <= e[1] - e[0]; n++)
|
|
3695
|
-
for (let
|
|
3696
|
-
const
|
|
3697
|
-
if (
|
|
3698
|
-
const { rowKey: x, key: u } =
|
|
3699
|
-
this.ctx.database.getReadonly(x, u) || (
|
|
3682
|
+
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
3683
|
+
const l = n + e[0], f = h + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(l, f);
|
|
3684
|
+
if (d) {
|
|
3685
|
+
const { rowKey: x, key: u } = d;
|
|
3686
|
+
this.ctx.database.getReadonly(x, u) || (o.add(x), s.push({
|
|
3700
3687
|
rowKey: x,
|
|
3701
3688
|
key: u,
|
|
3702
3689
|
value: null,
|
|
@@ -3710,10 +3697,10 @@ class li {
|
|
|
3710
3697
|
if (i)
|
|
3711
3698
|
return s;
|
|
3712
3699
|
this.ctx.database.batchSetItemValue(s, !0);
|
|
3713
|
-
let
|
|
3714
|
-
return
|
|
3715
|
-
|
|
3716
|
-
}), this.ctx.emit("clearSelectedDataChange", s,
|
|
3700
|
+
let r = [];
|
|
3701
|
+
return o.forEach((n) => {
|
|
3702
|
+
r.push(this.ctx.database.getRowDataItemForRowKey(n));
|
|
3703
|
+
}), this.ctx.emit("clearSelectedDataChange", s, r), this.ctx.emit("draw"), s;
|
|
3717
3704
|
}
|
|
3718
3705
|
paste() {
|
|
3719
3706
|
if (!navigator.clipboard) {
|
|
@@ -3723,22 +3710,22 @@ class li {
|
|
|
3723
3710
|
const { ENABLE_PASTER: t } = this.ctx.config;
|
|
3724
3711
|
if (this.ctx.selector.enable && t) {
|
|
3725
3712
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
3726
|
-
navigator.clipboard.readText().then((
|
|
3727
|
-
let
|
|
3728
|
-
const n =
|
|
3729
|
-
n.length === 1 ?
|
|
3730
|
-
`).map((
|
|
3731
|
-
let
|
|
3732
|
-
for (let
|
|
3733
|
-
const
|
|
3734
|
-
for (let x = 0; x <=
|
|
3735
|
-
const u =
|
|
3713
|
+
navigator.clipboard.readText().then((o) => {
|
|
3714
|
+
let r = [];
|
|
3715
|
+
const n = o.split("\r");
|
|
3716
|
+
n.length === 1 ? r = n[0].split(`
|
|
3717
|
+
`).map((d) => d.split(" ")) : r = n.map((f) => f.split(" "));
|
|
3718
|
+
let h = [];
|
|
3719
|
+
for (let f = 0; f <= r.length - 1; f++) {
|
|
3720
|
+
const d = r[f].length;
|
|
3721
|
+
for (let x = 0; x <= d - 1; x++) {
|
|
3722
|
+
const u = f + e, y = x + i, g = r[f][x], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3736
3723
|
u,
|
|
3737
3724
|
y
|
|
3738
3725
|
);
|
|
3739
3726
|
if (w) {
|
|
3740
3727
|
const { rowKey: p, key: E } = w;
|
|
3741
|
-
this.ctx.database.getReadonly(p, E) || (s.add(p),
|
|
3728
|
+
this.ctx.database.getReadonly(p, E) || (s.add(p), h.push({
|
|
3742
3729
|
rowKey: p,
|
|
3743
3730
|
key: E,
|
|
3744
3731
|
value: g,
|
|
@@ -3749,25 +3736,25 @@ class li {
|
|
|
3749
3736
|
}
|
|
3750
3737
|
}
|
|
3751
3738
|
if (this.isCut) {
|
|
3752
|
-
const
|
|
3739
|
+
const f = this.clearSelectedData(
|
|
3753
3740
|
this.ctx.selector.xArrCopy,
|
|
3754
3741
|
this.ctx.selector.yArrCopy,
|
|
3755
3742
|
!0
|
|
3756
3743
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3757
|
-
),
|
|
3758
|
-
|
|
3759
|
-
|
|
3744
|
+
), d = h.map((x) => `${x.rowKey}-${x.key}`);
|
|
3745
|
+
f.forEach((x) => {
|
|
3746
|
+
d.includes(`${x.rowKey}-${x.key}`) || h.unshift(x);
|
|
3760
3747
|
}), this.isCut = !1;
|
|
3761
3748
|
}
|
|
3762
|
-
if (!
|
|
3749
|
+
if (!h.length)
|
|
3763
3750
|
return;
|
|
3764
|
-
this.ctx.database.batchSetItemValue(
|
|
3765
|
-
let
|
|
3766
|
-
s.forEach((
|
|
3767
|
-
|
|
3768
|
-
}), this.ctx.emit("pasteChange",
|
|
3769
|
-
}).catch((
|
|
3770
|
-
console.error("获取剪贴板内容失败:",
|
|
3751
|
+
this.ctx.database.batchSetItemValue(h, !0);
|
|
3752
|
+
let l = [];
|
|
3753
|
+
s.forEach((f) => {
|
|
3754
|
+
l.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
3755
|
+
}), this.ctx.emit("pasteChange", h, l), this.clearCopyLine(), this.ctx.emit("draw");
|
|
3756
|
+
}).catch((o) => {
|
|
3757
|
+
console.error("获取剪贴板内容失败:", o);
|
|
3771
3758
|
});
|
|
3772
3759
|
}
|
|
3773
3760
|
}
|
|
@@ -3781,28 +3768,28 @@ class li {
|
|
|
3781
3768
|
if (!e)
|
|
3782
3769
|
return;
|
|
3783
3770
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3784
|
-
const
|
|
3771
|
+
const o = 0, r = 0, n = this.ctx.maxColIndex, h = this.ctx.maxRowIndex;
|
|
3785
3772
|
switch (t) {
|
|
3786
3773
|
case "LEFT":
|
|
3787
|
-
i >
|
|
3774
|
+
i > o && i--;
|
|
3788
3775
|
break;
|
|
3789
3776
|
case "TOP":
|
|
3790
|
-
s >
|
|
3777
|
+
s > r && s--;
|
|
3791
3778
|
break;
|
|
3792
3779
|
case "RIGHT":
|
|
3793
3780
|
i < n && i++;
|
|
3794
3781
|
break;
|
|
3795
3782
|
case "BOTTOM":
|
|
3796
|
-
s <
|
|
3783
|
+
s < h && s++;
|
|
3797
3784
|
break;
|
|
3798
3785
|
}
|
|
3799
|
-
const
|
|
3800
|
-
if (
|
|
3801
|
-
if (
|
|
3786
|
+
const l = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
3787
|
+
if (d) {
|
|
3788
|
+
if (d.operation)
|
|
3802
3789
|
return;
|
|
3803
|
-
this.ctx.setFocusCell(
|
|
3790
|
+
this.ctx.setFocusCell(d);
|
|
3804
3791
|
}
|
|
3805
|
-
this.setSelector(
|
|
3792
|
+
this.setSelector(l, f), this.adjustBoundaryPosition(), this.ctx.emit("draw");
|
|
3806
3793
|
}
|
|
3807
3794
|
stopAdjustPosition() {
|
|
3808
3795
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3812,23 +3799,23 @@ class li {
|
|
|
3812
3799
|
*/
|
|
3813
3800
|
startAdjustPosition(t) {
|
|
3814
3801
|
const { offsetX: e, offsetY: i } = t;
|
|
3815
|
-
let s = "",
|
|
3816
|
-
if (e < 0 ? s = "left" : e > this.ctx.body.visibleWidth && (s = "right"), i < this.ctx.header.visibleHeight ?
|
|
3802
|
+
let s = "", o = "";
|
|
3803
|
+
if (e < 0 ? s = "left" : e > this.ctx.body.visibleWidth && (s = "right"), i < this.ctx.header.visibleHeight ? o = "top" : i > this.ctx.header.visibleHeight + this.ctx.body.visibleHeight && (o = "bottom"), s && this.adjustPositionX !== s) {
|
|
3817
3804
|
this.adjustPositionX = s;
|
|
3818
3805
|
let n = 10 * (s === "left" ? -1 : 1);
|
|
3819
3806
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3820
3807
|
n *= 1.5;
|
|
3821
|
-
const { scrollX:
|
|
3822
|
-
(
|
|
3808
|
+
const { scrollX: h } = this.ctx, l = h + n;
|
|
3809
|
+
(l < 0 || l > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(l);
|
|
3823
3810
|
}, 100);
|
|
3824
3811
|
}
|
|
3825
|
-
if (
|
|
3826
|
-
this.adjustPositionY =
|
|
3827
|
-
let n = 10 * (
|
|
3812
|
+
if (o && this.adjustPositionY !== o) {
|
|
3813
|
+
this.adjustPositionY = o;
|
|
3814
|
+
let n = 10 * (o === "top" ? -1 : 1);
|
|
3828
3815
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3829
3816
|
n *= 1.5;
|
|
3830
|
-
const { scrollY:
|
|
3831
|
-
(
|
|
3817
|
+
const { scrollY: h } = this.ctx, l = h + n;
|
|
3818
|
+
(l < 0 || l > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(l);
|
|
3832
3819
|
}, 100);
|
|
3833
3820
|
}
|
|
3834
3821
|
}
|
|
@@ -3836,20 +3823,20 @@ class li {
|
|
|
3836
3823
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
3837
3824
|
*/
|
|
3838
3825
|
adjustBoundaryPosition() {
|
|
3839
|
-
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header:
|
|
3826
|
+
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: o, footer: r, scrollX: n, scrollY: h } = this.ctx;
|
|
3840
3827
|
if (!e)
|
|
3841
3828
|
return;
|
|
3842
|
-
const { SCROLLER_TRACK_SIZE:
|
|
3843
|
-
let
|
|
3844
|
-
|
|
3845
|
-
const x = s - e.drawX + 1, u = e.drawX + e.width - (t.width - i) + 1, y =
|
|
3846
|
-
u > 0 && !e.fixed ? this.ctx.setScrollX(n + u) : x > 0 && !e.fixed && this.ctx.setScrollX(n - x), y > 0 ? this.ctx.setScrollY(
|
|
3829
|
+
const { SCROLLER_TRACK_SIZE: l = 0, FOOTER_FIXED: f } = this.ctx.config;
|
|
3830
|
+
let d = 0;
|
|
3831
|
+
f && (d = r.visibleHeight);
|
|
3832
|
+
const x = s - e.drawX + 1, u = e.drawX + e.width - (t.width - i) + 1, y = o.height - e.drawY, g = e.drawY + e.height - (t.height - d - l);
|
|
3833
|
+
u > 0 && !e.fixed ? this.ctx.setScrollX(n + u) : x > 0 && !e.fixed && this.ctx.setScrollX(n - x), y > 0 ? this.ctx.setScrollY(h - y) : g > 0 && this.ctx.setScrollY(h + g);
|
|
3847
3834
|
}
|
|
3848
3835
|
destroy() {
|
|
3849
3836
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
3850
3837
|
}
|
|
3851
3838
|
}
|
|
3852
|
-
class
|
|
3839
|
+
class li {
|
|
3853
3840
|
constructor(t) {
|
|
3854
3841
|
c(this, "ctx");
|
|
3855
3842
|
this.ctx = t, this.init();
|
|
@@ -3857,9 +3844,9 @@ class hi {
|
|
|
3857
3844
|
init() {
|
|
3858
3845
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3859
3846
|
this.ctx.target.style.cursor === "crosshair" && (this.ctx.target.style.cursor = "default");
|
|
3860
|
-
const { xArr: i, yArr: s } = this.ctx.selector,
|
|
3861
|
-
if (this.ctx.config.ENABLE_AUTOFILL && n ===
|
|
3862
|
-
const y =
|
|
3847
|
+
const { xArr: i, yArr: s } = this.ctx.selector, o = i[1], r = s[1], { colIndex: n, rowIndex: h, drawX: l, drawY: f, width: d, height: x } = t;
|
|
3848
|
+
if (this.ctx.config.ENABLE_AUTOFILL && n === o && h === r) {
|
|
3849
|
+
const y = l + d - 6, g = f + x - 6;
|
|
3863
3850
|
e.offsetX > y && e.offsetY > g && (this.ctx.target.style.cursor = "crosshair");
|
|
3864
3851
|
}
|
|
3865
3852
|
this.mouseenter(t);
|
|
@@ -3886,45 +3873,44 @@ class hi {
|
|
|
3886
3873
|
this.isAutofillIng() && this.autofillData(), this.ctx.autofill.enable = !1, this.ctx.autofillMove = !1, this.ctx.autofill.xArr = [-1, -1], this.ctx.autofill.yArr = [-1, -1];
|
|
3887
3874
|
}
|
|
3888
3875
|
setAutofill(t, e) {
|
|
3889
|
-
const {
|
|
3890
|
-
ENABLE_AUTOFILL: i,
|
|
3891
|
-
ENABLE_SELECTOR_SPAN_COL: s,
|
|
3892
|
-
ENABLE_SELECTOR_SPAN_ROW: r
|
|
3893
|
-
} = this.ctx.config;
|
|
3876
|
+
const { ENABLE_AUTOFILL: i, ENABLE_SELECTOR_SPAN_COL: s, ENABLE_SELECTOR_SPAN_ROW: o } = this.ctx.config;
|
|
3894
3877
|
if (!i)
|
|
3895
3878
|
return;
|
|
3896
|
-
let
|
|
3897
|
-
if (!
|
|
3898
|
-
const [
|
|
3899
|
-
n = [
|
|
3879
|
+
let r = t, n = e;
|
|
3880
|
+
if (!o) {
|
|
3881
|
+
const [h] = n;
|
|
3882
|
+
n = [h, h];
|
|
3900
3883
|
}
|
|
3901
3884
|
if (!s) {
|
|
3902
|
-
const [
|
|
3903
|
-
|
|
3885
|
+
const [h] = r;
|
|
3886
|
+
r = [h, h];
|
|
3887
|
+
}
|
|
3888
|
+
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(n)) {
|
|
3889
|
+
const { SELECTOR_AREA_MIN_X: h, SELECTOR_AREA_MAX_X: l, SELECTOR_AREA_MIN_Y: f, SELECTOR_AREA_MAX_Y: d } = this.ctx.config, x = h, u = l || this.ctx.maxColIndex, y = f, g = d || this.ctx.maxRowIndex;
|
|
3890
|
+
let [w, p] = r, [E, m] = n;
|
|
3891
|
+
if (w < x || E < y)
|
|
3892
|
+
return;
|
|
3893
|
+
this.ctx.autofill.xArr = [Math.max(x, w), Math.min(u, p)], this.ctx.autofill.yArr = [Math.max(y, E), Math.min(g, m)], this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
3904
3894
|
}
|
|
3905
|
-
(JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(n)) && (this.ctx.autofill.xArr = o, this.ctx.autofill.yArr = n, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw"));
|
|
3906
3895
|
}
|
|
3907
3896
|
/**
|
|
3908
3897
|
* 填充数据
|
|
3909
3898
|
*/
|
|
3910
3899
|
autofillData() {
|
|
3911
3900
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
3912
|
-
for (let
|
|
3901
|
+
for (let d = 0; d <= e.yArr[1] - e.yArr[0]; d++)
|
|
3913
3902
|
for (let x = 0; x <= e.xArr[1] - e.xArr[0]; x++) {
|
|
3914
|
-
const u =
|
|
3903
|
+
const u = d + e.yArr[0], y = x + e.xArr[0];
|
|
3915
3904
|
i.set(`${u}-${y}`, !0);
|
|
3916
3905
|
}
|
|
3917
|
-
const { value: s } = e,
|
|
3918
|
-
let
|
|
3919
|
-
for (let
|
|
3906
|
+
const { value: s } = e, o = s[0].length, r = s.length, n = this.ctx.autofill.xArr, h = this.ctx.autofill.yArr;
|
|
3907
|
+
let l = [];
|
|
3908
|
+
for (let d = 0; d <= h[1] - h[0]; d++)
|
|
3920
3909
|
for (let x = 0; x <= n[1] - n[0]; x++) {
|
|
3921
|
-
const u = x + n[0], y =
|
|
3922
|
-
y,
|
|
3923
|
-
u
|
|
3924
|
-
), p = `${y}-${u}`;
|
|
3910
|
+
const u = x + n[0], y = d + h[0], g = s[d % r][x % o], w = this.ctx.database.getItemValueForRowIndexAndColIndex(y, u), p = `${y}-${u}`;
|
|
3925
3911
|
if (w && !i.has(p)) {
|
|
3926
3912
|
const { rowKey: E, key: m } = w;
|
|
3927
|
-
this.ctx.database.getReadonly(E, m) || (t.add(E),
|
|
3913
|
+
this.ctx.database.getReadonly(E, m) || (t.add(E), l.push({
|
|
3928
3914
|
rowKey: E,
|
|
3929
3915
|
key: m,
|
|
3930
3916
|
value: g,
|
|
@@ -3932,21 +3918,21 @@ class hi {
|
|
|
3932
3918
|
}));
|
|
3933
3919
|
}
|
|
3934
3920
|
}
|
|
3935
|
-
if (!
|
|
3921
|
+
if (!l.length)
|
|
3936
3922
|
return;
|
|
3937
|
-
this.ctx.database.batchSetItemValue(
|
|
3938
|
-
let
|
|
3939
|
-
t.forEach((
|
|
3940
|
-
|
|
3941
|
-
}), this.ctx.emit("autofillChange",
|
|
3923
|
+
this.ctx.database.batchSetItemValue(l, !0);
|
|
3924
|
+
let f = [];
|
|
3925
|
+
t.forEach((d) => {
|
|
3926
|
+
f.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
3927
|
+
}), this.ctx.emit("autofillChange", l, f), this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.emit("draw");
|
|
3942
3928
|
}
|
|
3943
3929
|
mouseenter(t) {
|
|
3944
3930
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
3945
3931
|
return;
|
|
3946
3932
|
const { selector: e, autofill: i } = this.ctx;
|
|
3947
3933
|
if (this.ctx.mousedown && e.enable && i.enable) {
|
|
3948
|
-
const { rowIndex: s, colIndex:
|
|
3949
|
-
s >= e.yArr[0] && s <= e.yArr[1] ?
|
|
3934
|
+
const { rowIndex: s, colIndex: o } = t, r = e.xArr.slice(), n = e.yArr.slice();
|
|
3935
|
+
s >= e.yArr[0] && s <= e.yArr[1] ? o > e.xArr[1] ? r.splice(1, 1, o) : o < e.xArr[0] && r.splice(0, 1, o) : s > e.yArr[1] ? n.splice(1, 1, s) : s < e.yArr[0] && n.splice(0, 1, s), this.setAutofill(r, n);
|
|
3950
3936
|
}
|
|
3951
3937
|
}
|
|
3952
3938
|
destroy() {
|
|
@@ -3964,7 +3950,7 @@ const rt = Math.min, U = Math.max, ft = Math.round, V = (a) => ({
|
|
|
3964
3950
|
start: "end",
|
|
3965
3951
|
end: "start"
|
|
3966
3952
|
};
|
|
3967
|
-
function
|
|
3953
|
+
function _t(a, t, e) {
|
|
3968
3954
|
return U(a, rt(t, e));
|
|
3969
3955
|
}
|
|
3970
3956
|
function at(a, t) {
|
|
@@ -3979,45 +3965,45 @@ function ct(a) {
|
|
|
3979
3965
|
function ie(a) {
|
|
3980
3966
|
return a === "x" ? "y" : "x";
|
|
3981
3967
|
}
|
|
3982
|
-
function
|
|
3968
|
+
function Mt(a) {
|
|
3983
3969
|
return a === "y" ? "height" : "width";
|
|
3984
3970
|
}
|
|
3985
3971
|
function J(a) {
|
|
3986
3972
|
return ["top", "bottom"].includes(q(a)) ? "y" : "x";
|
|
3987
3973
|
}
|
|
3988
|
-
function
|
|
3974
|
+
function Ht(a) {
|
|
3989
3975
|
return ie(J(a));
|
|
3990
3976
|
}
|
|
3991
3977
|
function xi(a, t, e) {
|
|
3992
3978
|
e === void 0 && (e = !1);
|
|
3993
|
-
const i = ct(a), s =
|
|
3994
|
-
let
|
|
3995
|
-
return t.reference[
|
|
3979
|
+
const i = ct(a), s = Ht(a), o = Mt(s);
|
|
3980
|
+
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
3981
|
+
return t.reference[o] > t.floating[o] && (r = xt(r)), [r, xt(r)];
|
|
3996
3982
|
}
|
|
3997
3983
|
function ui(a) {
|
|
3998
3984
|
const t = xt(a);
|
|
3999
|
-
return [
|
|
3985
|
+
return [Ot(a), t, Ot(t)];
|
|
4000
3986
|
}
|
|
4001
|
-
function
|
|
3987
|
+
function Ot(a) {
|
|
4002
3988
|
return a.replace(/start|end/g, (t) => fi[t]);
|
|
4003
3989
|
}
|
|
4004
3990
|
function gi(a, t, e) {
|
|
4005
|
-
const i = ["left", "right"], s = ["right", "left"],
|
|
3991
|
+
const i = ["left", "right"], s = ["right", "left"], o = ["top", "bottom"], r = ["bottom", "top"];
|
|
4006
3992
|
switch (a) {
|
|
4007
3993
|
case "top":
|
|
4008
3994
|
case "bottom":
|
|
4009
3995
|
return e ? t ? s : i : t ? i : s;
|
|
4010
3996
|
case "left":
|
|
4011
3997
|
case "right":
|
|
4012
|
-
return t ?
|
|
3998
|
+
return t ? o : r;
|
|
4013
3999
|
default:
|
|
4014
4000
|
return [];
|
|
4015
4001
|
}
|
|
4016
4002
|
}
|
|
4017
4003
|
function wi(a, t, e, i) {
|
|
4018
4004
|
const s = ct(a);
|
|
4019
|
-
let
|
|
4020
|
-
return s && (
|
|
4005
|
+
let o = gi(q(a), e === "start", i);
|
|
4006
|
+
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(Ot)))), o;
|
|
4021
4007
|
}
|
|
4022
4008
|
function xt(a) {
|
|
4023
4009
|
return a.replace(/left|right|bottom|top/g, (t) => di[t]);
|
|
@@ -4062,31 +4048,31 @@ function Pt(a, t, e) {
|
|
|
4062
4048
|
reference: i,
|
|
4063
4049
|
floating: s
|
|
4064
4050
|
} = a;
|
|
4065
|
-
const
|
|
4051
|
+
const o = J(t), r = Ht(t), n = Mt(r), h = q(t), l = o === "y", f = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, x = i[n] / 2 - s[n] / 2;
|
|
4066
4052
|
let u;
|
|
4067
|
-
switch (
|
|
4053
|
+
switch (h) {
|
|
4068
4054
|
case "top":
|
|
4069
4055
|
u = {
|
|
4070
|
-
x:
|
|
4056
|
+
x: f,
|
|
4071
4057
|
y: i.y - s.height
|
|
4072
4058
|
};
|
|
4073
4059
|
break;
|
|
4074
4060
|
case "bottom":
|
|
4075
4061
|
u = {
|
|
4076
|
-
x:
|
|
4062
|
+
x: f,
|
|
4077
4063
|
y: i.y + i.height
|
|
4078
4064
|
};
|
|
4079
4065
|
break;
|
|
4080
4066
|
case "right":
|
|
4081
4067
|
u = {
|
|
4082
4068
|
x: i.x + i.width,
|
|
4083
|
-
y:
|
|
4069
|
+
y: d
|
|
4084
4070
|
};
|
|
4085
4071
|
break;
|
|
4086
4072
|
case "left":
|
|
4087
4073
|
u = {
|
|
4088
4074
|
x: i.x - s.width,
|
|
4089
|
-
y:
|
|
4075
|
+
y: d
|
|
4090
4076
|
};
|
|
4091
4077
|
break;
|
|
4092
4078
|
default:
|
|
@@ -4097,10 +4083,10 @@ function Pt(a, t, e) {
|
|
|
4097
4083
|
}
|
|
4098
4084
|
switch (ct(t)) {
|
|
4099
4085
|
case "start":
|
|
4100
|
-
u[
|
|
4086
|
+
u[r] -= x * (e && l ? -1 : 1);
|
|
4101
4087
|
break;
|
|
4102
4088
|
case "end":
|
|
4103
|
-
u[
|
|
4089
|
+
u[r] += x * (e && l ? -1 : 1);
|
|
4104
4090
|
break;
|
|
4105
4091
|
}
|
|
4106
4092
|
return u;
|
|
@@ -4109,17 +4095,17 @@ const yi = async (a, t, e) => {
|
|
|
4109
4095
|
const {
|
|
4110
4096
|
placement: i = "bottom",
|
|
4111
4097
|
strategy: s = "absolute",
|
|
4112
|
-
middleware:
|
|
4113
|
-
platform:
|
|
4114
|
-
} = e, n =
|
|
4115
|
-
let
|
|
4098
|
+
middleware: o = [],
|
|
4099
|
+
platform: r
|
|
4100
|
+
} = e, n = o.filter(Boolean), h = await (r.isRTL == null ? void 0 : r.isRTL(t));
|
|
4101
|
+
let l = await r.getElementRects({
|
|
4116
4102
|
reference: a,
|
|
4117
4103
|
floating: t,
|
|
4118
4104
|
strategy: s
|
|
4119
4105
|
}), {
|
|
4120
|
-
x:
|
|
4121
|
-
y:
|
|
4122
|
-
} = Pt(
|
|
4106
|
+
x: f,
|
|
4107
|
+
y: d
|
|
4108
|
+
} = Pt(l, i, h), x = i, u = {}, y = 0;
|
|
4123
4109
|
for (let g = 0; g < n.length; g++) {
|
|
4124
4110
|
const {
|
|
4125
4111
|
name: w,
|
|
@@ -4130,37 +4116,37 @@ const yi = async (a, t, e) => {
|
|
|
4130
4116
|
data: b,
|
|
4131
4117
|
reset: C
|
|
4132
4118
|
} = await p({
|
|
4133
|
-
x:
|
|
4134
|
-
y:
|
|
4119
|
+
x: f,
|
|
4120
|
+
y: d,
|
|
4135
4121
|
initialPlacement: i,
|
|
4136
4122
|
placement: x,
|
|
4137
4123
|
strategy: s,
|
|
4138
4124
|
middlewareData: u,
|
|
4139
|
-
rects:
|
|
4140
|
-
platform:
|
|
4125
|
+
rects: l,
|
|
4126
|
+
platform: r,
|
|
4141
4127
|
elements: {
|
|
4142
4128
|
reference: a,
|
|
4143
4129
|
floating: t
|
|
4144
4130
|
}
|
|
4145
4131
|
});
|
|
4146
|
-
|
|
4132
|
+
f = E ?? f, d = m ?? d, u = {
|
|
4147
4133
|
...u,
|
|
4148
4134
|
[w]: {
|
|
4149
4135
|
...u[w],
|
|
4150
4136
|
...b
|
|
4151
4137
|
}
|
|
4152
|
-
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (
|
|
4138
|
+
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (l = C.rects === !0 ? await r.getElementRects({
|
|
4153
4139
|
reference: a,
|
|
4154
4140
|
floating: t,
|
|
4155
4141
|
strategy: s
|
|
4156
4142
|
}) : C.rects), {
|
|
4157
|
-
x:
|
|
4158
|
-
y:
|
|
4159
|
-
} = Pt(
|
|
4143
|
+
x: f,
|
|
4144
|
+
y: d
|
|
4145
|
+
} = Pt(l, x, h)), g = -1);
|
|
4160
4146
|
}
|
|
4161
4147
|
return {
|
|
4162
|
-
x:
|
|
4163
|
-
y:
|
|
4148
|
+
x: f,
|
|
4149
|
+
y: d,
|
|
4164
4150
|
placement: x,
|
|
4165
4151
|
strategy: s,
|
|
4166
4152
|
middlewareData: u
|
|
@@ -4172,37 +4158,37 @@ async function re(a, t) {
|
|
|
4172
4158
|
const {
|
|
4173
4159
|
x: i,
|
|
4174
4160
|
y: s,
|
|
4175
|
-
platform:
|
|
4176
|
-
rects:
|
|
4161
|
+
platform: o,
|
|
4162
|
+
rects: r,
|
|
4177
4163
|
elements: n,
|
|
4178
|
-
strategy:
|
|
4164
|
+
strategy: h
|
|
4179
4165
|
} = a, {
|
|
4180
|
-
boundary:
|
|
4181
|
-
rootBoundary:
|
|
4182
|
-
elementContext:
|
|
4166
|
+
boundary: l = "clippingAncestors",
|
|
4167
|
+
rootBoundary: f = "viewport",
|
|
4168
|
+
elementContext: d = "floating",
|
|
4183
4169
|
altBoundary: x = !1,
|
|
4184
4170
|
padding: u = 0
|
|
4185
|
-
} = at(t, a), y = se(u), w = n[x ?
|
|
4186
|
-
element: (e = await (
|
|
4187
|
-
boundary:
|
|
4188
|
-
rootBoundary:
|
|
4189
|
-
strategy:
|
|
4190
|
-
})), E =
|
|
4171
|
+
} = at(t, a), y = se(u), w = n[x ? d === "floating" ? "reference" : "floating" : d], p = ut(await o.getClippingRect({
|
|
4172
|
+
element: (e = await (o.isElement == null ? void 0 : o.isElement(w))) == null || e ? w : w.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(n.floating)),
|
|
4173
|
+
boundary: l,
|
|
4174
|
+
rootBoundary: f,
|
|
4175
|
+
strategy: h
|
|
4176
|
+
})), E = d === "floating" ? {
|
|
4191
4177
|
x: i,
|
|
4192
4178
|
y: s,
|
|
4193
|
-
width:
|
|
4194
|
-
height:
|
|
4195
|
-
} :
|
|
4179
|
+
width: r.floating.width,
|
|
4180
|
+
height: r.floating.height
|
|
4181
|
+
} : r.reference, m = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(n.floating)), b = await (o.isElement == null ? void 0 : o.isElement(m)) ? await (o.getScale == null ? void 0 : o.getScale(m)) || {
|
|
4196
4182
|
x: 1,
|
|
4197
4183
|
y: 1
|
|
4198
4184
|
} : {
|
|
4199
4185
|
x: 1,
|
|
4200
4186
|
y: 1
|
|
4201
|
-
}, C = ut(
|
|
4187
|
+
}, C = ut(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4202
4188
|
elements: n,
|
|
4203
4189
|
rect: E,
|
|
4204
4190
|
offsetParent: m,
|
|
4205
|
-
strategy:
|
|
4191
|
+
strategy: h
|
|
4206
4192
|
}) : E);
|
|
4207
4193
|
return {
|
|
4208
4194
|
top: (p.top - C.top + y.top) / b.y,
|
|
@@ -4219,33 +4205,33 @@ const mi = (a) => ({
|
|
|
4219
4205
|
x: e,
|
|
4220
4206
|
y: i,
|
|
4221
4207
|
placement: s,
|
|
4222
|
-
rects:
|
|
4223
|
-
platform:
|
|
4208
|
+
rects: o,
|
|
4209
|
+
platform: r,
|
|
4224
4210
|
elements: n,
|
|
4225
|
-
middlewareData:
|
|
4211
|
+
middlewareData: h
|
|
4226
4212
|
} = t, {
|
|
4227
|
-
element:
|
|
4228
|
-
padding:
|
|
4213
|
+
element: l,
|
|
4214
|
+
padding: f = 0
|
|
4229
4215
|
} = at(a, t) || {};
|
|
4230
|
-
if (
|
|
4216
|
+
if (l == null)
|
|
4231
4217
|
return {};
|
|
4232
|
-
const
|
|
4218
|
+
const d = se(f), x = {
|
|
4233
4219
|
x: e,
|
|
4234
4220
|
y: i
|
|
4235
|
-
}, u =
|
|
4236
|
-
let
|
|
4237
|
-
(!
|
|
4238
|
-
const L = b / 2 - C / 2, A =
|
|
4221
|
+
}, u = Ht(s), y = Mt(u), g = await r.getDimensions(l), w = u === "y", p = w ? "top" : "left", E = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", b = o.reference[y] + o.reference[u] - x[u] - o.floating[y], C = x[u] - o.reference[u], R = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(l));
|
|
4222
|
+
let T = R ? R[m] : 0;
|
|
4223
|
+
(!T || !await (r.isElement == null ? void 0 : r.isElement(R))) && (T = n.floating[m] || o.floating[y]);
|
|
4224
|
+
const L = b / 2 - C / 2, A = T / 2 - g[y] / 2 - 1, D = rt(d[p], A), B = rt(d[E], A), _ = D, S = T - g[y] - B, O = T / 2 - g[y] / 2 + L, G = _t(_, O, S), Y = !h.arrow && ct(s) != null && O !== G && o.reference[y] / 2 - (O < _ ? D : B) - g[y] / 2 < 0, F = Y ? O < _ ? O - _ : O - S : 0;
|
|
4239
4225
|
return {
|
|
4240
|
-
[u]: x[u] +
|
|
4226
|
+
[u]: x[u] + F,
|
|
4241
4227
|
data: {
|
|
4242
4228
|
[u]: G,
|
|
4243
|
-
centerOffset:
|
|
4244
|
-
...
|
|
4245
|
-
alignmentOffset:
|
|
4229
|
+
centerOffset: O - G - F,
|
|
4230
|
+
...Y && {
|
|
4231
|
+
alignmentOffset: F
|
|
4246
4232
|
}
|
|
4247
4233
|
},
|
|
4248
|
-
reset:
|
|
4234
|
+
reset: Y
|
|
4249
4235
|
};
|
|
4250
4236
|
}
|
|
4251
4237
|
}), Ei = function(a) {
|
|
@@ -4256,52 +4242,52 @@ const mi = (a) => ({
|
|
|
4256
4242
|
var e, i;
|
|
4257
4243
|
const {
|
|
4258
4244
|
placement: s,
|
|
4259
|
-
middlewareData:
|
|
4260
|
-
rects:
|
|
4245
|
+
middlewareData: o,
|
|
4246
|
+
rects: r,
|
|
4261
4247
|
initialPlacement: n,
|
|
4262
|
-
platform:
|
|
4263
|
-
elements:
|
|
4248
|
+
platform: h,
|
|
4249
|
+
elements: l
|
|
4264
4250
|
} = t, {
|
|
4265
|
-
mainAxis:
|
|
4266
|
-
crossAxis:
|
|
4251
|
+
mainAxis: f = !0,
|
|
4252
|
+
crossAxis: d = !0,
|
|
4267
4253
|
fallbackPlacements: x,
|
|
4268
4254
|
fallbackStrategy: u = "bestFit",
|
|
4269
4255
|
fallbackAxisSideDirection: y = "none",
|
|
4270
4256
|
flipAlignment: g = !0,
|
|
4271
4257
|
...w
|
|
4272
4258
|
} = at(a, t);
|
|
4273
|
-
if ((e =
|
|
4259
|
+
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
4274
4260
|
return {};
|
|
4275
|
-
const p = q(s), E = J(n), m = q(n) === n, b = await (
|
|
4261
|
+
const p = q(s), E = J(n), m = q(n) === n, b = await (h.isRTL == null ? void 0 : h.isRTL(l.floating)), C = x || (m || !g ? [xt(n)] : ui(n)), R = y !== "none";
|
|
4276
4262
|
!x && R && C.push(...wi(n, g, y, b));
|
|
4277
|
-
const
|
|
4278
|
-
let D = ((i =
|
|
4279
|
-
if (
|
|
4280
|
-
const
|
|
4281
|
-
A.push(L[
|
|
4263
|
+
const T = [n, ...C], L = await re(t, w), A = [];
|
|
4264
|
+
let D = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
4265
|
+
if (f && A.push(L[p]), d) {
|
|
4266
|
+
const O = xi(s, r, b);
|
|
4267
|
+
A.push(L[O[0]], L[O[1]]);
|
|
4282
4268
|
}
|
|
4283
4269
|
if (D = [...D, {
|
|
4284
4270
|
placement: s,
|
|
4285
4271
|
overflows: A
|
|
4286
|
-
}], !A.every((
|
|
4287
|
-
var B,
|
|
4288
|
-
const
|
|
4272
|
+
}], !A.every((O) => O <= 0)) {
|
|
4273
|
+
var B, _;
|
|
4274
|
+
const O = (((B = o.flip) == null ? void 0 : B.index) || 0) + 1, G = T[O];
|
|
4289
4275
|
if (G)
|
|
4290
4276
|
return {
|
|
4291
4277
|
data: {
|
|
4292
|
-
index:
|
|
4278
|
+
index: O,
|
|
4293
4279
|
overflows: D
|
|
4294
4280
|
},
|
|
4295
4281
|
reset: {
|
|
4296
4282
|
placement: G
|
|
4297
4283
|
}
|
|
4298
4284
|
};
|
|
4299
|
-
let
|
|
4300
|
-
if (!
|
|
4285
|
+
let Y = (_ = D.filter((F) => F.overflows[0] <= 0).sort((F, W) => F.overflows[1] - W.overflows[1])[0]) == null ? void 0 : _.placement;
|
|
4286
|
+
if (!Y)
|
|
4301
4287
|
switch (u) {
|
|
4302
4288
|
case "bestFit": {
|
|
4303
|
-
var
|
|
4304
|
-
const
|
|
4289
|
+
var S;
|
|
4290
|
+
const F = (S = D.filter((W) => {
|
|
4305
4291
|
if (R) {
|
|
4306
4292
|
const P = J(W.placement);
|
|
4307
4293
|
return P === E || // Create a bias to the `y` side axis due to horizontal
|
|
@@ -4309,18 +4295,18 @@ const mi = (a) => ({
|
|
|
4309
4295
|
P === "y";
|
|
4310
4296
|
}
|
|
4311
4297
|
return !0;
|
|
4312
|
-
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, we) => P + we, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 :
|
|
4313
|
-
|
|
4298
|
+
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, we) => P + we, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : S[0];
|
|
4299
|
+
F && (Y = F);
|
|
4314
4300
|
break;
|
|
4315
4301
|
}
|
|
4316
4302
|
case "initialPlacement":
|
|
4317
|
-
|
|
4303
|
+
Y = n;
|
|
4318
4304
|
break;
|
|
4319
4305
|
}
|
|
4320
|
-
if (s !==
|
|
4306
|
+
if (s !== Y)
|
|
4321
4307
|
return {
|
|
4322
4308
|
reset: {
|
|
4323
|
-
placement:
|
|
4309
|
+
placement: Y
|
|
4324
4310
|
}
|
|
4325
4311
|
};
|
|
4326
4312
|
}
|
|
@@ -4333,26 +4319,26 @@ async function bi(a, t) {
|
|
|
4333
4319
|
placement: e,
|
|
4334
4320
|
platform: i,
|
|
4335
4321
|
elements: s
|
|
4336
|
-
} = a,
|
|
4322
|
+
} = a, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = q(e), n = ct(e), h = J(e) === "y", l = ["left", "top"].includes(r) ? -1 : 1, f = o && h ? -1 : 1, d = at(t, a);
|
|
4337
4323
|
let {
|
|
4338
4324
|
mainAxis: x,
|
|
4339
4325
|
crossAxis: u,
|
|
4340
4326
|
alignmentAxis: y
|
|
4341
|
-
} = typeof
|
|
4342
|
-
mainAxis:
|
|
4327
|
+
} = typeof d == "number" ? {
|
|
4328
|
+
mainAxis: d,
|
|
4343
4329
|
crossAxis: 0,
|
|
4344
4330
|
alignmentAxis: null
|
|
4345
4331
|
} : {
|
|
4346
|
-
mainAxis:
|
|
4347
|
-
crossAxis:
|
|
4348
|
-
alignmentAxis:
|
|
4332
|
+
mainAxis: d.mainAxis || 0,
|
|
4333
|
+
crossAxis: d.crossAxis || 0,
|
|
4334
|
+
alignmentAxis: d.alignmentAxis
|
|
4349
4335
|
};
|
|
4350
|
-
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y),
|
|
4351
|
-
x: u *
|
|
4352
|
-
y: x *
|
|
4336
|
+
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y), h ? {
|
|
4337
|
+
x: u * f,
|
|
4338
|
+
y: x * l
|
|
4353
4339
|
} : {
|
|
4354
|
-
x: x *
|
|
4355
|
-
y: u *
|
|
4340
|
+
x: x * l,
|
|
4341
|
+
y: u * f
|
|
4356
4342
|
};
|
|
4357
4343
|
}
|
|
4358
4344
|
const Ci = function(a) {
|
|
@@ -4363,16 +4349,16 @@ const Ci = function(a) {
|
|
|
4363
4349
|
var e, i;
|
|
4364
4350
|
const {
|
|
4365
4351
|
x: s,
|
|
4366
|
-
y:
|
|
4367
|
-
placement:
|
|
4352
|
+
y: o,
|
|
4353
|
+
placement: r,
|
|
4368
4354
|
middlewareData: n
|
|
4369
|
-
} = t,
|
|
4370
|
-
return
|
|
4371
|
-
x: s +
|
|
4372
|
-
y:
|
|
4355
|
+
} = t, h = await bi(t, a);
|
|
4356
|
+
return r === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
|
|
4357
|
+
x: s + h.x,
|
|
4358
|
+
y: o + h.y,
|
|
4373
4359
|
data: {
|
|
4374
|
-
...
|
|
4375
|
-
placement:
|
|
4360
|
+
...h,
|
|
4361
|
+
placement: r
|
|
4376
4362
|
}
|
|
4377
4363
|
};
|
|
4378
4364
|
}
|
|
@@ -4387,8 +4373,8 @@ const Ci = function(a) {
|
|
|
4387
4373
|
y: i,
|
|
4388
4374
|
placement: s
|
|
4389
4375
|
} = t, {
|
|
4390
|
-
mainAxis:
|
|
4391
|
-
crossAxis:
|
|
4376
|
+
mainAxis: o = !0,
|
|
4377
|
+
crossAxis: r = !1,
|
|
4392
4378
|
limiter: n = {
|
|
4393
4379
|
fn: (w) => {
|
|
4394
4380
|
let {
|
|
@@ -4401,24 +4387,24 @@ const Ci = function(a) {
|
|
|
4401
4387
|
};
|
|
4402
4388
|
}
|
|
4403
4389
|
},
|
|
4404
|
-
...
|
|
4405
|
-
} = at(a, t),
|
|
4390
|
+
...h
|
|
4391
|
+
} = at(a, t), l = {
|
|
4406
4392
|
x: e,
|
|
4407
4393
|
y: i
|
|
4408
|
-
},
|
|
4409
|
-
let u =
|
|
4410
|
-
if (r) {
|
|
4411
|
-
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u + d[w], m = u - d[p];
|
|
4412
|
-
u = Ot(E, u, m);
|
|
4413
|
-
}
|
|
4394
|
+
}, f = await re(t, h), d = J(q(s)), x = ie(d);
|
|
4395
|
+
let u = l[x], y = l[d];
|
|
4414
4396
|
if (o) {
|
|
4415
|
-
const w =
|
|
4416
|
-
|
|
4397
|
+
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u + f[w], m = u - f[p];
|
|
4398
|
+
u = _t(E, u, m);
|
|
4399
|
+
}
|
|
4400
|
+
if (r) {
|
|
4401
|
+
const w = d === "y" ? "top" : "left", p = d === "y" ? "bottom" : "right", E = y + f[w], m = y - f[p];
|
|
4402
|
+
y = _t(E, y, m);
|
|
4417
4403
|
}
|
|
4418
4404
|
const g = n.fn({
|
|
4419
4405
|
...t,
|
|
4420
4406
|
[x]: u,
|
|
4421
|
-
[
|
|
4407
|
+
[d]: y
|
|
4422
4408
|
});
|
|
4423
4409
|
return {
|
|
4424
4410
|
...g,
|
|
@@ -4426,8 +4412,8 @@ const Ci = function(a) {
|
|
|
4426
4412
|
x: g.x - e,
|
|
4427
4413
|
y: g.y - i,
|
|
4428
4414
|
enabled: {
|
|
4429
|
-
[x]:
|
|
4430
|
-
[
|
|
4415
|
+
[x]: o,
|
|
4416
|
+
[d]: r
|
|
4431
4417
|
}
|
|
4432
4418
|
}
|
|
4433
4419
|
};
|
|
@@ -4440,33 +4426,33 @@ function gt() {
|
|
|
4440
4426
|
function tt(a) {
|
|
4441
4427
|
return oe(a) ? (a.nodeName || "").toLowerCase() : "#document";
|
|
4442
4428
|
}
|
|
4443
|
-
function
|
|
4429
|
+
function H(a) {
|
|
4444
4430
|
var t;
|
|
4445
4431
|
return (a == null || (t = a.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
4446
4432
|
}
|
|
4447
|
-
function
|
|
4433
|
+
function K(a) {
|
|
4448
4434
|
var t;
|
|
4449
4435
|
return (t = (oe(a) ? a.ownerDocument : a.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4450
4436
|
}
|
|
4451
4437
|
function oe(a) {
|
|
4452
|
-
return gt() ? a instanceof Node || a instanceof
|
|
4438
|
+
return gt() ? a instanceof Node || a instanceof H(a).Node : !1;
|
|
4453
4439
|
}
|
|
4454
|
-
function
|
|
4455
|
-
return gt() ? a instanceof Element || a instanceof
|
|
4440
|
+
function X(a) {
|
|
4441
|
+
return gt() ? a instanceof Element || a instanceof H(a).Element : !1;
|
|
4456
4442
|
}
|
|
4457
4443
|
function N(a) {
|
|
4458
|
-
return gt() ? a instanceof HTMLElement || a instanceof
|
|
4444
|
+
return gt() ? a instanceof HTMLElement || a instanceof H(a).HTMLElement : !1;
|
|
4459
4445
|
}
|
|
4460
4446
|
function Vt(a) {
|
|
4461
|
-
return !gt() || typeof ShadowRoot > "u" ? !1 : a instanceof ShadowRoot || a instanceof
|
|
4447
|
+
return !gt() || typeof ShadowRoot > "u" ? !1 : a instanceof ShadowRoot || a instanceof H(a).ShadowRoot;
|
|
4462
4448
|
}
|
|
4463
|
-
function
|
|
4449
|
+
function ht(a) {
|
|
4464
4450
|
const {
|
|
4465
4451
|
overflow: t,
|
|
4466
4452
|
overflowX: e,
|
|
4467
4453
|
overflowY: i,
|
|
4468
4454
|
display: s
|
|
4469
|
-
} =
|
|
4455
|
+
} = k(a);
|
|
4470
4456
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
4471
4457
|
}
|
|
4472
4458
|
function Ri(a) {
|
|
@@ -4482,7 +4468,7 @@ function wt(a) {
|
|
|
4482
4468
|
});
|
|
4483
4469
|
}
|
|
4484
4470
|
function Dt(a) {
|
|
4485
|
-
const t =
|
|
4471
|
+
const t = Xt(), e = X(a) ? k(a) : a;
|
|
4486
4472
|
return e.transform !== "none" || e.perspective !== "none" || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((i) => (e.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (e.contain || "").includes(i));
|
|
4487
4473
|
}
|
|
4488
4474
|
function Ii(a) {
|
|
@@ -4496,17 +4482,17 @@ function Ii(a) {
|
|
|
4496
4482
|
}
|
|
4497
4483
|
return null;
|
|
4498
4484
|
}
|
|
4499
|
-
function
|
|
4485
|
+
function Xt() {
|
|
4500
4486
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
4501
4487
|
}
|
|
4502
4488
|
function Q(a) {
|
|
4503
4489
|
return ["html", "body", "#document"].includes(tt(a));
|
|
4504
4490
|
}
|
|
4505
|
-
function
|
|
4506
|
-
return
|
|
4491
|
+
function k(a) {
|
|
4492
|
+
return H(a).getComputedStyle(a);
|
|
4507
4493
|
}
|
|
4508
4494
|
function pt(a) {
|
|
4509
|
-
return
|
|
4495
|
+
return X(a) ? {
|
|
4510
4496
|
scrollLeft: a.scrollLeft,
|
|
4511
4497
|
scrollTop: a.scrollTop
|
|
4512
4498
|
} : {
|
|
@@ -4522,39 +4508,39 @@ function z(a) {
|
|
|
4522
4508
|
a.assignedSlot || // DOM Element detected.
|
|
4523
4509
|
a.parentNode || // ShadowRoot detected.
|
|
4524
4510
|
Vt(a) && a.host || // Fallback.
|
|
4525
|
-
|
|
4511
|
+
K(a)
|
|
4526
4512
|
);
|
|
4527
4513
|
return Vt(t) ? t.host : t;
|
|
4528
4514
|
}
|
|
4529
4515
|
function ne(a) {
|
|
4530
4516
|
const t = z(a);
|
|
4531
|
-
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) &&
|
|
4517
|
+
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) && ht(t) ? t : ne(t);
|
|
4532
4518
|
}
|
|
4533
|
-
function
|
|
4519
|
+
function St(a, t, e) {
|
|
4534
4520
|
var i;
|
|
4535
4521
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4536
|
-
const s = ne(a),
|
|
4537
|
-
if (
|
|
4538
|
-
const n =
|
|
4539
|
-
return t.concat(
|
|
4522
|
+
const s = ne(a), o = s === ((i = a.ownerDocument) == null ? void 0 : i.body), r = H(s);
|
|
4523
|
+
if (o) {
|
|
4524
|
+
const n = Tt(r);
|
|
4525
|
+
return t.concat(r, r.visualViewport || [], ht(s) ? s : [], n && e ? St(n) : []);
|
|
4540
4526
|
}
|
|
4541
|
-
return t.concat(s,
|
|
4527
|
+
return t.concat(s, St(s, [], e));
|
|
4542
4528
|
}
|
|
4543
|
-
function
|
|
4529
|
+
function Tt(a) {
|
|
4544
4530
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
4545
4531
|
}
|
|
4546
4532
|
function ae(a) {
|
|
4547
|
-
const t =
|
|
4533
|
+
const t = k(a);
|
|
4548
4534
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4549
|
-
const s = N(a),
|
|
4550
|
-
return n && (e =
|
|
4535
|
+
const s = N(a), o = s ? a.offsetWidth : e, r = s ? a.offsetHeight : i, n = ft(e) !== o || ft(i) !== r;
|
|
4536
|
+
return n && (e = o, i = r), {
|
|
4551
4537
|
width: e,
|
|
4552
4538
|
height: i,
|
|
4553
4539
|
$: n
|
|
4554
4540
|
};
|
|
4555
4541
|
}
|
|
4556
4542
|
function ce(a) {
|
|
4557
|
-
return
|
|
4543
|
+
return X(a) ? a : a.contextElement;
|
|
4558
4544
|
}
|
|
4559
4545
|
function Z(a) {
|
|
4560
4546
|
const t = ce(a);
|
|
@@ -4563,113 +4549,113 @@ function Z(a) {
|
|
|
4563
4549
|
const e = t.getBoundingClientRect(), {
|
|
4564
4550
|
width: i,
|
|
4565
4551
|
height: s,
|
|
4566
|
-
$:
|
|
4552
|
+
$: o
|
|
4567
4553
|
} = ae(t);
|
|
4568
|
-
let
|
|
4569
|
-
return (!
|
|
4570
|
-
x:
|
|
4554
|
+
let r = (o ? ft(e.width) : e.width) / i, n = (o ? ft(e.height) : e.height) / s;
|
|
4555
|
+
return (!r || !Number.isFinite(r)) && (r = 1), (!n || !Number.isFinite(n)) && (n = 1), {
|
|
4556
|
+
x: r,
|
|
4571
4557
|
y: n
|
|
4572
4558
|
};
|
|
4573
4559
|
}
|
|
4574
|
-
const
|
|
4575
|
-
function
|
|
4576
|
-
const t =
|
|
4577
|
-
return !
|
|
4560
|
+
const _i = /* @__PURE__ */ V(0);
|
|
4561
|
+
function he(a) {
|
|
4562
|
+
const t = H(a);
|
|
4563
|
+
return !Xt() || !t.visualViewport ? _i : {
|
|
4578
4564
|
x: t.visualViewport.offsetLeft,
|
|
4579
4565
|
y: t.visualViewport.offsetTop
|
|
4580
4566
|
};
|
|
4581
4567
|
}
|
|
4582
|
-
function
|
|
4583
|
-
return t === void 0 && (t = !1), !e || t && e !==
|
|
4568
|
+
function Oi(a, t, e) {
|
|
4569
|
+
return t === void 0 && (t = !1), !e || t && e !== H(a) ? !1 : t;
|
|
4584
4570
|
}
|
|
4585
4571
|
function ot(a, t, e, i) {
|
|
4586
4572
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
4587
|
-
const s = a.getBoundingClientRect(),
|
|
4588
|
-
let
|
|
4589
|
-
t && (i ?
|
|
4590
|
-
const n =
|
|
4591
|
-
let
|
|
4592
|
-
if (
|
|
4593
|
-
const x =
|
|
4594
|
-
let y = x, g =
|
|
4573
|
+
const s = a.getBoundingClientRect(), o = ce(a);
|
|
4574
|
+
let r = V(1);
|
|
4575
|
+
t && (i ? X(i) && (r = Z(i)) : r = Z(a));
|
|
4576
|
+
const n = Oi(o, e, i) ? he(o) : V(0);
|
|
4577
|
+
let h = (s.left + n.x) / r.x, l = (s.top + n.y) / r.y, f = s.width / r.x, d = s.height / r.y;
|
|
4578
|
+
if (o) {
|
|
4579
|
+
const x = H(o), u = i && X(i) ? H(i) : i;
|
|
4580
|
+
let y = x, g = Tt(y);
|
|
4595
4581
|
for (; g && i && u !== y; ) {
|
|
4596
|
-
const w = Z(g), p = g.getBoundingClientRect(), E =
|
|
4597
|
-
|
|
4582
|
+
const w = Z(g), p = g.getBoundingClientRect(), E = k(g), m = p.left + (g.clientLeft + parseFloat(E.paddingLeft)) * w.x, b = p.top + (g.clientTop + parseFloat(E.paddingTop)) * w.y;
|
|
4583
|
+
h *= w.x, l *= w.y, f *= w.x, d *= w.y, h += m, l += b, y = H(g), g = Tt(y);
|
|
4598
4584
|
}
|
|
4599
4585
|
}
|
|
4600
4586
|
return ut({
|
|
4601
|
-
width:
|
|
4602
|
-
height:
|
|
4603
|
-
x:
|
|
4604
|
-
y:
|
|
4587
|
+
width: f,
|
|
4588
|
+
height: d,
|
|
4589
|
+
x: h,
|
|
4590
|
+
y: l
|
|
4605
4591
|
});
|
|
4606
4592
|
}
|
|
4607
|
-
function
|
|
4593
|
+
function Si(a) {
|
|
4608
4594
|
let {
|
|
4609
4595
|
elements: t,
|
|
4610
4596
|
rect: e,
|
|
4611
4597
|
offsetParent: i,
|
|
4612
4598
|
strategy: s
|
|
4613
4599
|
} = a;
|
|
4614
|
-
const
|
|
4615
|
-
if (i ===
|
|
4600
|
+
const o = s === "fixed", r = K(i), n = t ? wt(t.floating) : !1;
|
|
4601
|
+
if (i === r || n && o)
|
|
4616
4602
|
return e;
|
|
4617
|
-
let
|
|
4603
|
+
let h = {
|
|
4618
4604
|
scrollLeft: 0,
|
|
4619
4605
|
scrollTop: 0
|
|
4620
|
-
},
|
|
4621
|
-
const
|
|
4622
|
-
if ((
|
|
4606
|
+
}, l = V(1);
|
|
4607
|
+
const f = V(0), d = N(i);
|
|
4608
|
+
if ((d || !d && !o) && ((tt(i) !== "body" || ht(r)) && (h = pt(i)), N(i))) {
|
|
4623
4609
|
const x = ot(i);
|
|
4624
|
-
|
|
4610
|
+
l = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4625
4611
|
}
|
|
4626
4612
|
return {
|
|
4627
|
-
width: e.width *
|
|
4628
|
-
height: e.height *
|
|
4629
|
-
x: e.x *
|
|
4630
|
-
y: e.y *
|
|
4613
|
+
width: e.width * l.x,
|
|
4614
|
+
height: e.height * l.y,
|
|
4615
|
+
x: e.x * l.x - h.scrollLeft * l.x + f.x,
|
|
4616
|
+
y: e.y * l.y - h.scrollTop * l.y + f.y
|
|
4631
4617
|
};
|
|
4632
4618
|
}
|
|
4633
|
-
function
|
|
4619
|
+
function Ti(a) {
|
|
4634
4620
|
return Array.from(a.getClientRects());
|
|
4635
4621
|
}
|
|
4636
4622
|
function Lt(a, t) {
|
|
4637
4623
|
const e = pt(a).scrollLeft;
|
|
4638
|
-
return t ? t.left + e : ot(
|
|
4624
|
+
return t ? t.left + e : ot(K(a)).left + e;
|
|
4639
4625
|
}
|
|
4640
4626
|
function Li(a) {
|
|
4641
|
-
const t =
|
|
4642
|
-
let
|
|
4627
|
+
const t = K(a), e = pt(a), i = a.ownerDocument.body, s = U(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = U(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
4628
|
+
let r = -e.scrollLeft + Lt(a);
|
|
4643
4629
|
const n = -e.scrollTop;
|
|
4644
|
-
return
|
|
4630
|
+
return k(i).direction === "rtl" && (r += U(t.clientWidth, i.clientWidth) - s), {
|
|
4645
4631
|
width: s,
|
|
4646
|
-
height:
|
|
4647
|
-
x:
|
|
4632
|
+
height: o,
|
|
4633
|
+
x: r,
|
|
4648
4634
|
y: n
|
|
4649
4635
|
};
|
|
4650
4636
|
}
|
|
4651
4637
|
function Ai(a, t) {
|
|
4652
|
-
const e =
|
|
4653
|
-
let
|
|
4638
|
+
const e = H(a), i = K(a), s = e.visualViewport;
|
|
4639
|
+
let o = i.clientWidth, r = i.clientHeight, n = 0, h = 0;
|
|
4654
4640
|
if (s) {
|
|
4655
|
-
|
|
4656
|
-
const
|
|
4657
|
-
(!
|
|
4641
|
+
o = s.width, r = s.height;
|
|
4642
|
+
const l = Xt();
|
|
4643
|
+
(!l || l && t === "fixed") && (n = s.offsetLeft, h = s.offsetTop);
|
|
4658
4644
|
}
|
|
4659
4645
|
return {
|
|
4660
|
-
width:
|
|
4661
|
-
height:
|
|
4646
|
+
width: o,
|
|
4647
|
+
height: r,
|
|
4662
4648
|
x: n,
|
|
4663
|
-
y:
|
|
4649
|
+
y: h
|
|
4664
4650
|
};
|
|
4665
4651
|
}
|
|
4666
|
-
function
|
|
4667
|
-
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft,
|
|
4652
|
+
function Mi(a, t) {
|
|
4653
|
+
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, o = N(a) ? Z(a) : V(1), r = a.clientWidth * o.x, n = a.clientHeight * o.y, h = s * o.x, l = i * o.y;
|
|
4668
4654
|
return {
|
|
4669
|
-
width:
|
|
4655
|
+
width: r,
|
|
4670
4656
|
height: n,
|
|
4671
|
-
x:
|
|
4672
|
-
y:
|
|
4657
|
+
x: h,
|
|
4658
|
+
y: l
|
|
4673
4659
|
};
|
|
4674
4660
|
}
|
|
4675
4661
|
function zt(a, t, e) {
|
|
@@ -4677,11 +4663,11 @@ function zt(a, t, e) {
|
|
|
4677
4663
|
if (t === "viewport")
|
|
4678
4664
|
i = Ai(a, e);
|
|
4679
4665
|
else if (t === "document")
|
|
4680
|
-
i = Li(
|
|
4681
|
-
else if (
|
|
4682
|
-
i =
|
|
4666
|
+
i = Li(K(a));
|
|
4667
|
+
else if (X(t))
|
|
4668
|
+
i = Mi(t, e);
|
|
4683
4669
|
else {
|
|
4684
|
-
const s =
|
|
4670
|
+
const s = he(a);
|
|
4685
4671
|
i = {
|
|
4686
4672
|
...t,
|
|
4687
4673
|
x: t.x - s.x,
|
|
@@ -4690,20 +4676,20 @@ function zt(a, t, e) {
|
|
|
4690
4676
|
}
|
|
4691
4677
|
return ut(i);
|
|
4692
4678
|
}
|
|
4693
|
-
function
|
|
4679
|
+
function le(a, t) {
|
|
4694
4680
|
const e = z(a);
|
|
4695
|
-
return e === t || !
|
|
4681
|
+
return e === t || !X(e) || Q(e) ? !1 : k(e).position === "fixed" || le(e, t);
|
|
4696
4682
|
}
|
|
4697
|
-
function
|
|
4683
|
+
function Hi(a, t) {
|
|
4698
4684
|
const e = t.get(a);
|
|
4699
4685
|
if (e)
|
|
4700
4686
|
return e;
|
|
4701
|
-
let i =
|
|
4702
|
-
const
|
|
4703
|
-
let
|
|
4704
|
-
for (;
|
|
4705
|
-
const n =
|
|
4706
|
-
!
|
|
4687
|
+
let i = St(a, [], !1).filter((n) => X(n) && tt(n) !== "body"), s = null;
|
|
4688
|
+
const o = k(a).position === "fixed";
|
|
4689
|
+
let r = o ? z(a) : a;
|
|
4690
|
+
for (; X(r) && !Q(r); ) {
|
|
4691
|
+
const n = k(r), h = Dt(r);
|
|
4692
|
+
!h && n.position === "fixed" && (s = null), (o ? !h && !s : !h && n.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || ht(r) && !h && le(a, r)) ? i = i.filter((f) => f !== r) : s = n, r = z(r);
|
|
4707
4693
|
}
|
|
4708
4694
|
return t.set(a, i), i;
|
|
4709
4695
|
}
|
|
@@ -4714,18 +4700,18 @@ function Di(a) {
|
|
|
4714
4700
|
rootBoundary: i,
|
|
4715
4701
|
strategy: s
|
|
4716
4702
|
} = a;
|
|
4717
|
-
const
|
|
4718
|
-
const
|
|
4719
|
-
return
|
|
4703
|
+
const r = [...e === "clippingAncestors" ? wt(t) ? [] : Hi(t, this._c) : [].concat(e), i], n = r[0], h = r.reduce((l, f) => {
|
|
4704
|
+
const d = zt(t, f, s);
|
|
4705
|
+
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;
|
|
4720
4706
|
}, zt(t, n, s));
|
|
4721
4707
|
return {
|
|
4722
|
-
width:
|
|
4723
|
-
height:
|
|
4724
|
-
x:
|
|
4725
|
-
y:
|
|
4708
|
+
width: h.right - h.left,
|
|
4709
|
+
height: h.bottom - h.top,
|
|
4710
|
+
x: h.left,
|
|
4711
|
+
y: h.top
|
|
4726
4712
|
};
|
|
4727
4713
|
}
|
|
4728
|
-
function
|
|
4714
|
+
function Xi(a) {
|
|
4729
4715
|
const {
|
|
4730
4716
|
width: t,
|
|
4731
4717
|
height: e
|
|
@@ -4735,51 +4721,51 @@ function ki(a) {
|
|
|
4735
4721
|
height: e
|
|
4736
4722
|
};
|
|
4737
4723
|
}
|
|
4738
|
-
function
|
|
4739
|
-
const i = N(t), s =
|
|
4724
|
+
function ki(a, t, e) {
|
|
4725
|
+
const i = N(t), s = K(t), o = e === "fixed", r = ot(a, !0, o, t);
|
|
4740
4726
|
let n = {
|
|
4741
4727
|
scrollLeft: 0,
|
|
4742
4728
|
scrollTop: 0
|
|
4743
4729
|
};
|
|
4744
|
-
const
|
|
4745
|
-
if (i || !i && !
|
|
4746
|
-
if ((tt(t) !== "body" ||
|
|
4747
|
-
const u = ot(t, !0,
|
|
4748
|
-
|
|
4749
|
-
} else s && (
|
|
4750
|
-
let
|
|
4751
|
-
if (s && !i && !
|
|
4730
|
+
const h = V(0);
|
|
4731
|
+
if (i || !i && !o)
|
|
4732
|
+
if ((tt(t) !== "body" || ht(s)) && (n = pt(t)), i) {
|
|
4733
|
+
const u = ot(t, !0, o, t);
|
|
4734
|
+
h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
|
|
4735
|
+
} else s && (h.x = Lt(s));
|
|
4736
|
+
let l = 0, f = 0;
|
|
4737
|
+
if (s && !i && !o) {
|
|
4752
4738
|
const u = s.getBoundingClientRect();
|
|
4753
|
-
|
|
4739
|
+
f = u.top + n.scrollTop, l = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
4754
4740
|
Lt(s, u);
|
|
4755
4741
|
}
|
|
4756
|
-
const
|
|
4742
|
+
const d = r.left + n.scrollLeft - h.x - l, x = r.top + n.scrollTop - h.y - f;
|
|
4757
4743
|
return {
|
|
4758
|
-
x:
|
|
4744
|
+
x: d,
|
|
4759
4745
|
y: x,
|
|
4760
|
-
width:
|
|
4761
|
-
height:
|
|
4746
|
+
width: r.width,
|
|
4747
|
+
height: r.height
|
|
4762
4748
|
};
|
|
4763
4749
|
}
|
|
4764
4750
|
function mt(a) {
|
|
4765
|
-
return
|
|
4751
|
+
return k(a).position === "static";
|
|
4766
4752
|
}
|
|
4767
4753
|
function $t(a, t) {
|
|
4768
|
-
if (!N(a) ||
|
|
4754
|
+
if (!N(a) || k(a).position === "fixed")
|
|
4769
4755
|
return null;
|
|
4770
4756
|
if (t)
|
|
4771
4757
|
return t(a);
|
|
4772
4758
|
let e = a.offsetParent;
|
|
4773
|
-
return
|
|
4759
|
+
return K(a) === e && (e = e.ownerDocument.body), e;
|
|
4774
4760
|
}
|
|
4775
4761
|
function de(a, t) {
|
|
4776
|
-
const e =
|
|
4762
|
+
const e = H(a);
|
|
4777
4763
|
if (wt(a))
|
|
4778
4764
|
return e;
|
|
4779
4765
|
if (!N(a)) {
|
|
4780
4766
|
let s = z(a);
|
|
4781
4767
|
for (; s && !Q(s); ) {
|
|
4782
|
-
if (
|
|
4768
|
+
if (X(s) && !mt(s))
|
|
4783
4769
|
return s;
|
|
4784
4770
|
s = z(s);
|
|
4785
4771
|
}
|
|
@@ -4790,10 +4776,10 @@ function de(a, t) {
|
|
|
4790
4776
|
i = $t(i, t);
|
|
4791
4777
|
return i && Q(i) && mt(i) && !Dt(i) ? e : i || Ii(a) || e;
|
|
4792
4778
|
}
|
|
4793
|
-
const
|
|
4779
|
+
const Fi = async function(a) {
|
|
4794
4780
|
const t = this.getOffsetParent || de, e = this.getDimensions, i = await e(a.floating);
|
|
4795
4781
|
return {
|
|
4796
|
-
reference:
|
|
4782
|
+
reference: ki(a.reference, await t(a.floating), a.strategy),
|
|
4797
4783
|
floating: {
|
|
4798
4784
|
x: 0,
|
|
4799
4785
|
y: 0,
|
|
@@ -4803,30 +4789,30 @@ const Xi = async function(a) {
|
|
|
4803
4789
|
};
|
|
4804
4790
|
};
|
|
4805
4791
|
function Ni(a) {
|
|
4806
|
-
return
|
|
4792
|
+
return k(a).direction === "rtl";
|
|
4807
4793
|
}
|
|
4808
|
-
const
|
|
4809
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
4810
|
-
getDocumentElement:
|
|
4794
|
+
const Yi = {
|
|
4795
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Si,
|
|
4796
|
+
getDocumentElement: K,
|
|
4811
4797
|
getClippingRect: Di,
|
|
4812
4798
|
getOffsetParent: de,
|
|
4813
|
-
getElementRects:
|
|
4814
|
-
getClientRects:
|
|
4815
|
-
getDimensions:
|
|
4799
|
+
getElementRects: Fi,
|
|
4800
|
+
getClientRects: Ti,
|
|
4801
|
+
getDimensions: Xi,
|
|
4816
4802
|
getScale: Z,
|
|
4817
|
-
isElement:
|
|
4803
|
+
isElement: X,
|
|
4818
4804
|
isRTL: Ni
|
|
4819
|
-
}, fe = Ci, xe = vi, ue = Ei,
|
|
4805
|
+
}, fe = Ci, xe = vi, ue = Ei, Ki = mi, ge = (a, t, e) => {
|
|
4820
4806
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
4821
|
-
platform:
|
|
4807
|
+
platform: Yi,
|
|
4822
4808
|
...e
|
|
4823
|
-
},
|
|
4809
|
+
}, o = {
|
|
4824
4810
|
...s.platform,
|
|
4825
4811
|
_c: i
|
|
4826
4812
|
};
|
|
4827
4813
|
return yi(a, t, {
|
|
4828
4814
|
...s,
|
|
4829
|
-
platform:
|
|
4815
|
+
platform: o
|
|
4830
4816
|
});
|
|
4831
4817
|
};
|
|
4832
4818
|
let Bi = class {
|
|
@@ -4837,8 +4823,8 @@ let Bi = class {
|
|
|
4837
4823
|
c(this, "floatingEl");
|
|
4838
4824
|
c(this, "arrowEl");
|
|
4839
4825
|
this.ctx = t;
|
|
4840
|
-
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE:
|
|
4841
|
-
this.contentEl = document.createElement("div"), this.arrowEl = document.createElement("div"), this.floatingEl = document.createElement("div"), this.floatingEl.className = `${
|
|
4826
|
+
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE: o, CSS_PREFIX: r } = this.ctx.config;
|
|
4827
|
+
this.contentEl = document.createElement("div"), this.arrowEl = document.createElement("div"), this.floatingEl = document.createElement("div"), this.floatingEl.className = `${r}-tooltip`, this.contentEl.className = `${r}-tooltip-content`, this.arrowEl.className = `${r}-tooltip-arrow`;
|
|
4842
4828
|
const n = {
|
|
4843
4829
|
display: "none",
|
|
4844
4830
|
position: "absolute",
|
|
@@ -4849,8 +4835,8 @@ let Bi = class {
|
|
|
4849
4835
|
padding: "8px",
|
|
4850
4836
|
borderRadius: "4px",
|
|
4851
4837
|
fontSize: "12px",
|
|
4852
|
-
...
|
|
4853
|
-
},
|
|
4838
|
+
...o
|
|
4839
|
+
}, h = {
|
|
4854
4840
|
position: "absolute",
|
|
4855
4841
|
width: "10px",
|
|
4856
4842
|
height: "10px",
|
|
@@ -4859,7 +4845,7 @@ let Bi = class {
|
|
|
4859
4845
|
transform: "rotate(45deg)",
|
|
4860
4846
|
zIndex: n.zIndex
|
|
4861
4847
|
};
|
|
4862
|
-
Object.assign(this.arrowEl.style,
|
|
4848
|
+
Object.assign(this.arrowEl.style, h), Object.assign(this.floatingEl.style, n), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.targetContainer.appendChild(this.floatingEl), this.init();
|
|
4863
4849
|
}
|
|
4864
4850
|
init() {
|
|
4865
4851
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -4883,46 +4869,46 @@ let Bi = class {
|
|
|
4883
4869
|
if (!i)
|
|
4884
4870
|
return;
|
|
4885
4871
|
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;
|
|
4886
|
-
const s = t.drawX + i.x,
|
|
4872
|
+
const s = t.drawX + i.x, o = t.drawY + i.y;
|
|
4887
4873
|
ge({
|
|
4888
4874
|
getBoundingClientRect() {
|
|
4889
4875
|
return {
|
|
4890
4876
|
width: t.visibleWidth,
|
|
4891
4877
|
height: t.visibleHeight,
|
|
4892
4878
|
x: s,
|
|
4893
|
-
y:
|
|
4879
|
+
y: o,
|
|
4894
4880
|
left: s,
|
|
4895
4881
|
right: s + t.visibleWidth,
|
|
4896
|
-
top:
|
|
4897
|
-
bottom:
|
|
4882
|
+
top: o,
|
|
4883
|
+
bottom: o + t.visibleHeight
|
|
4898
4884
|
};
|
|
4899
4885
|
}
|
|
4900
4886
|
}, this.floatingEl, {
|
|
4901
4887
|
placement: t.overflowTooltipPlacement,
|
|
4902
|
-
middleware: [xe(), ue(), fe(6),
|
|
4888
|
+
middleware: [xe(), ue(), fe(6), Ki({ element: this.arrowEl })]
|
|
4903
4889
|
}).then((n) => {
|
|
4904
|
-
const { x:
|
|
4890
|
+
const { x: h, y: l, placement: f, middlewareData: d } = n;
|
|
4905
4891
|
if (Object.assign(this.floatingEl.style, {
|
|
4906
|
-
top: `${
|
|
4907
|
-
left: `${
|
|
4908
|
-
}),
|
|
4909
|
-
const x =
|
|
4910
|
-
["left", "left-start", "left-end"].includes(
|
|
4892
|
+
top: `${l}px`,
|
|
4893
|
+
left: `${h}px`
|
|
4894
|
+
}), d.arrow) {
|
|
4895
|
+
const x = d.arrow;
|
|
4896
|
+
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
4911
4897
|
top: `${x.y}px`,
|
|
4912
4898
|
bottom: "",
|
|
4913
4899
|
left: "",
|
|
4914
4900
|
right: "-5px"
|
|
4915
|
-
}) : ["right", "right-start", "right-end"].includes(
|
|
4901
|
+
}) : ["right", "right-start", "right-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
4916
4902
|
top: `${x.y}px`,
|
|
4917
4903
|
bottom: "",
|
|
4918
4904
|
left: "-5px",
|
|
4919
4905
|
right: ""
|
|
4920
|
-
}) : ["bottom", "bottom-start", "bottom-end"].includes(
|
|
4906
|
+
}) : ["bottom", "bottom-start", "bottom-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
4921
4907
|
top: "-5px",
|
|
4922
4908
|
bottom: "",
|
|
4923
4909
|
left: `${x.x}px`,
|
|
4924
4910
|
right: ""
|
|
4925
|
-
}) : ["top", "top-start", "top-end"].includes(
|
|
4911
|
+
}) : ["top", "top-start", "top-end"].includes(f) && Object.assign(this.arrowEl.style, {
|
|
4926
4912
|
top: "",
|
|
4927
4913
|
bottom: "-5px",
|
|
4928
4914
|
left: `${x.x}px`,
|
|
@@ -4953,8 +4939,8 @@ class Wi {
|
|
|
4953
4939
|
}), this.ctx.on("cellHeaderMousedown", () => {
|
|
4954
4940
|
this.enable && this.doneEdit();
|
|
4955
4941
|
}), this.ctx.on("keydown", (t) => {
|
|
4956
|
-
const e = t.key, i = t.ctrlKey, s = t.altKey,
|
|
4957
|
-
if (!(i || s ||
|
|
4942
|
+
const e = t.key, i = t.ctrlKey, s = t.altKey, o = t.shiftKey, r = t.metaKey;
|
|
4943
|
+
if (!(i || s || o || r || [
|
|
4958
4944
|
// "Enter",
|
|
4959
4945
|
"Escape",
|
|
4960
4946
|
"Tab",
|
|
@@ -4994,13 +4980,25 @@ class Wi {
|
|
|
4994
4980
|
});
|
|
4995
4981
|
}
|
|
4996
4982
|
initTextEditor() {
|
|
4997
|
-
const { CSS_PREFIX: t, SELECT_BORDER_COLOR: e
|
|
4998
|
-
this.inputEl = document.createElement("div"), this.inputEl.addEventListener("keydown", (
|
|
4999
|
-
|
|
4983
|
+
const { CSS_PREFIX: t, SELECT_BORDER_COLOR: e } = this.ctx.config;
|
|
4984
|
+
this.inputEl = document.createElement("div"), this.inputEl.addEventListener("keydown", (r) => {
|
|
4985
|
+
if (this.enable) {
|
|
4986
|
+
if ((r.altKey || r.metaKey) && r.code === "Enter") {
|
|
4987
|
+
r.preventDefault();
|
|
4988
|
+
const n = this.inputEl.textContent;
|
|
4989
|
+
this.inputEl.textContent = `${n}
|
|
4990
|
+
|
|
4991
|
+
`;
|
|
4992
|
+
const h = window.getSelection();
|
|
4993
|
+
h == null || h.selectAllChildren(this.inputEl), h == null || h.collapseToEnd();
|
|
4994
|
+
return;
|
|
4995
|
+
}
|
|
4996
|
+
(r.code === "Escape" || r.code === "Enter") && (r.preventDefault(), this.inputEl.blur());
|
|
4997
|
+
}
|
|
5000
4998
|
}), this.inputEl.addEventListener("blur", () => {
|
|
5001
4999
|
this.doneEdit();
|
|
5002
5000
|
}), this.editorEl = document.createElement("div"), this.editorEl.className = `${t}-self-editor`, this.inputEl.className = `${t}-self-editor-input`;
|
|
5003
|
-
const
|
|
5001
|
+
const i = {
|
|
5004
5002
|
position: "absolute",
|
|
5005
5003
|
top: "-10000px",
|
|
5006
5004
|
left: "-10000px",
|
|
@@ -5016,8 +5014,8 @@ class Wi {
|
|
|
5016
5014
|
display: "flex",
|
|
5017
5015
|
alignItems: "center"
|
|
5018
5016
|
};
|
|
5019
|
-
Object.assign(this.editorEl.style,
|
|
5020
|
-
const
|
|
5017
|
+
Object.assign(this.editorEl.style, i);
|
|
5018
|
+
const s = {
|
|
5021
5019
|
width: "100%",
|
|
5022
5020
|
boxSizing: "border-box",
|
|
5023
5021
|
padding: "8px",
|
|
@@ -5033,17 +5031,17 @@ class Wi {
|
|
|
5033
5031
|
background: "#fff",
|
|
5034
5032
|
cursor: "text"
|
|
5035
5033
|
};
|
|
5036
|
-
Object.assign(this.inputEl.style,
|
|
5034
|
+
Object.assign(this.inputEl.style, s);
|
|
5037
5035
|
const o = navigator.userAgent.toLowerCase().includes("firefox");
|
|
5038
5036
|
this.inputEl.contentEditable = o ? "true" : "plaintext-only", this.editorEl.appendChild(this.inputEl), this.ctx.targetContainer.appendChild(this.editorEl);
|
|
5039
5037
|
}
|
|
5040
5038
|
startEditByInput(t) {
|
|
5041
5039
|
if (t.editorType !== "text")
|
|
5042
5040
|
return;
|
|
5043
|
-
const e = t.getValue(), { width: i, height: s } = t,
|
|
5044
|
-
this.editorEl.style.left = `${
|
|
5045
|
-
const
|
|
5046
|
-
|
|
5041
|
+
const e = t.getValue(), { width: i, height: s } = t, o = t.getDrawX(), r = t.getDrawY(), { CELL_PADDING: n } = this.ctx.config;
|
|
5042
|
+
this.editorEl.style.left = `${o}px`, this.editorEl.style.top = `${r}px`, this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${s - 1}px`, this.inputEl.style.padding = `${n}px`, e !== null && (this.inputEl.textContent = e), this.inputEl.focus();
|
|
5043
|
+
const h = window.getSelection();
|
|
5044
|
+
h == null || h.selectAllChildren(this.inputEl), h == null || h.collapseToEnd();
|
|
5047
5045
|
}
|
|
5048
5046
|
doneEditByInput() {
|
|
5049
5047
|
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
@@ -5058,22 +5056,22 @@ class Wi {
|
|
|
5058
5056
|
const e = this.ctx.focusCell;
|
|
5059
5057
|
if (!e || ["index", "index-selection", "selection"].includes(e.type) || this.enable)
|
|
5060
5058
|
return;
|
|
5061
|
-
const { rowKey: i, key: s } = e,
|
|
5062
|
-
e && !
|
|
5059
|
+
const { rowKey: i, key: s } = e, o = this.ctx.database.getReadonly(i, s);
|
|
5060
|
+
e && !o && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5063
5061
|
}
|
|
5064
5062
|
editCell(t, e) {
|
|
5065
|
-
const i = this.ctx.body.renderRows.find((
|
|
5063
|
+
const i = this.ctx.body.renderRows.find((l) => l.rowIndex === t);
|
|
5066
5064
|
if (!i)
|
|
5067
5065
|
return;
|
|
5068
|
-
const s = i.cells.find((
|
|
5066
|
+
const s = i.cells.find((l) => l.colIndex === e);
|
|
5069
5067
|
if (!s)
|
|
5070
5068
|
return;
|
|
5071
5069
|
this.ctx.emit("setSelectorCell", s);
|
|
5072
|
-
const
|
|
5073
|
-
if (!
|
|
5070
|
+
const o = this.ctx.focusCell;
|
|
5071
|
+
if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
|
|
5074
5072
|
return;
|
|
5075
|
-
const { rowKey:
|
|
5076
|
-
|
|
5073
|
+
const { rowKey: r, key: n } = o, h = this.ctx.database.getReadonly(r, n);
|
|
5074
|
+
o && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5077
5075
|
}
|
|
5078
5076
|
doneEdit() {
|
|
5079
5077
|
this.enable && this.cellTarget && (this.ctx.emit("doneEdit", this.cellTarget), this.doneEditByInput(), this.enable = !1, this.ctx.target.focus(), this.ctx.editing = !1, this.cellTarget = null, this.ctx.emit("draw"));
|
|
@@ -5086,21 +5084,21 @@ class Pi {
|
|
|
5086
5084
|
c(this, "ctx");
|
|
5087
5085
|
c(this, "emptyEl");
|
|
5088
5086
|
this.ctx = t;
|
|
5089
|
-
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX:
|
|
5090
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${
|
|
5087
|
+
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX: o } = this.ctx.config;
|
|
5088
|
+
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${o}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.targetContainer.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: r, headerHeight: n, bodyHeight: h, footerHeight: l }) => {
|
|
5091
5089
|
if (i)
|
|
5092
5090
|
return;
|
|
5093
|
-
const
|
|
5094
|
-
display:
|
|
5091
|
+
const f = n + (h + l) / 2, d = {
|
|
5092
|
+
display: r === "empty" ? "block" : "none",
|
|
5095
5093
|
position: "absolute",
|
|
5096
5094
|
fontSize: "14px",
|
|
5097
5095
|
color: "#666",
|
|
5098
5096
|
left: "50%",
|
|
5099
|
-
top: `${
|
|
5097
|
+
top: `${f}px`,
|
|
5100
5098
|
transform: "translate(-50%, -50%)",
|
|
5101
5099
|
...s
|
|
5102
5100
|
};
|
|
5103
|
-
Object.assign(this.emptyEl.style,
|
|
5101
|
+
Object.assign(this.emptyEl.style, d);
|
|
5104
5102
|
});
|
|
5105
5103
|
}
|
|
5106
5104
|
destroy() {
|
|
@@ -5126,10 +5124,10 @@ class Vi {
|
|
|
5126
5124
|
const {
|
|
5127
5125
|
target: t,
|
|
5128
5126
|
config: { SCROLLER_TRACK_SIZE: e }
|
|
5129
|
-
} = this.ctx, i = t.width - e, s = t.height - e,
|
|
5130
|
-
let
|
|
5131
|
-
const { FOOTER_FIXED:
|
|
5132
|
-
return
|
|
5127
|
+
} = this.ctx, i = t.width - e, s = t.height - e, o = this.getHeader(), r = this.getBody(), n = this.getFooter();
|
|
5128
|
+
let h = [o, r, n];
|
|
5129
|
+
const { FOOTER_FIXED: l } = this.ctx.config;
|
|
5130
|
+
return l || (h = [o, r]), {
|
|
5133
5131
|
style: {
|
|
5134
5132
|
position: "absolute",
|
|
5135
5133
|
left: "0px",
|
|
@@ -5139,7 +5137,7 @@ class Vi {
|
|
|
5139
5137
|
width: `${i}px`,
|
|
5140
5138
|
height: `${s}px`
|
|
5141
5139
|
},
|
|
5142
|
-
views:
|
|
5140
|
+
views: h
|
|
5143
5141
|
};
|
|
5144
5142
|
}
|
|
5145
5143
|
getHeader() {
|
|
@@ -5147,12 +5145,12 @@ class Vi {
|
|
|
5147
5145
|
fixedLeftWidth: t,
|
|
5148
5146
|
fixedRightWidth: e,
|
|
5149
5147
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5150
|
-
} = this.ctx, { visibleWidth:
|
|
5151
|
-
let
|
|
5148
|
+
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: n } = this.ctx.header;
|
|
5149
|
+
let h = [], l = [], f = [];
|
|
5152
5150
|
n.forEach((w) => {
|
|
5153
|
-
w.render && (w.fixed === "left" ?
|
|
5151
|
+
w.render && (w.fixed === "left" ? l.push(w) : w.fixed === "right" ? f.push(w) : h.push(w));
|
|
5154
5152
|
});
|
|
5155
|
-
const
|
|
5153
|
+
const d = e - i, x = {
|
|
5156
5154
|
key: "left",
|
|
5157
5155
|
style: {
|
|
5158
5156
|
position: "absolute",
|
|
@@ -5160,9 +5158,9 @@ class Vi {
|
|
|
5160
5158
|
left: `${0.5}px`,
|
|
5161
5159
|
overflow: "hidden",
|
|
5162
5160
|
width: `${t}px`,
|
|
5163
|
-
height: `${
|
|
5161
|
+
height: `${r}px`
|
|
5164
5162
|
},
|
|
5165
|
-
cells:
|
|
5163
|
+
cells: l
|
|
5166
5164
|
}, u = {
|
|
5167
5165
|
key: "center",
|
|
5168
5166
|
style: {
|
|
@@ -5170,10 +5168,10 @@ class Vi {
|
|
|
5170
5168
|
top: `${0.5}px`,
|
|
5171
5169
|
left: `${t}px`,
|
|
5172
5170
|
overflow: "hidden",
|
|
5173
|
-
width: `${
|
|
5174
|
-
height: `${
|
|
5171
|
+
width: `${o - t - d}px`,
|
|
5172
|
+
height: `${r}px`
|
|
5175
5173
|
},
|
|
5176
|
-
cells:
|
|
5174
|
+
cells: h
|
|
5177
5175
|
}, y = {
|
|
5178
5176
|
key: "right",
|
|
5179
5177
|
style: {
|
|
@@ -5181,10 +5179,10 @@ class Vi {
|
|
|
5181
5179
|
top: `${0.5}px`,
|
|
5182
5180
|
right: `${0.5}px`,
|
|
5183
5181
|
overflow: "hidden",
|
|
5184
|
-
width: `${
|
|
5185
|
-
height: `${
|
|
5182
|
+
width: `${d}px`,
|
|
5183
|
+
height: `${r}px`
|
|
5186
5184
|
},
|
|
5187
|
-
cells:
|
|
5185
|
+
cells: f
|
|
5188
5186
|
};
|
|
5189
5187
|
return {
|
|
5190
5188
|
type: "header",
|
|
@@ -5192,8 +5190,8 @@ class Vi {
|
|
|
5192
5190
|
style: {
|
|
5193
5191
|
position: "relative",
|
|
5194
5192
|
overflow: "hidden",
|
|
5195
|
-
width: `${
|
|
5196
|
-
height: `${
|
|
5193
|
+
width: `${o}px`,
|
|
5194
|
+
height: `${r}px`
|
|
5197
5195
|
},
|
|
5198
5196
|
views: [x, u, y]
|
|
5199
5197
|
};
|
|
@@ -5207,18 +5205,18 @@ class Vi {
|
|
|
5207
5205
|
});
|
|
5208
5206
|
});
|
|
5209
5207
|
const {
|
|
5210
|
-
fixedLeftWidth:
|
|
5211
|
-
fixedRightWidth:
|
|
5212
|
-
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX:
|
|
5213
|
-
} = this.ctx, { visibleWidth:
|
|
5208
|
+
fixedLeftWidth: o,
|
|
5209
|
+
fixedRightWidth: r,
|
|
5210
|
+
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: h }
|
|
5211
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: f } = this.ctx.body, d = r - n, x = {
|
|
5214
5212
|
key: "left",
|
|
5215
5213
|
style: {
|
|
5216
5214
|
position: "absolute",
|
|
5217
5215
|
top: `${0.5}px`,
|
|
5218
5216
|
left: `${0.5}px`,
|
|
5219
5217
|
overflow: "hidden",
|
|
5220
|
-
width: `${
|
|
5221
|
-
height: `${
|
|
5218
|
+
width: `${o}px`,
|
|
5219
|
+
height: `${f}px`
|
|
5222
5220
|
},
|
|
5223
5221
|
cells: e
|
|
5224
5222
|
}, u = {
|
|
@@ -5226,10 +5224,10 @@ class Vi {
|
|
|
5226
5224
|
style: {
|
|
5227
5225
|
position: "absolute",
|
|
5228
5226
|
top: `${0.5}px`,
|
|
5229
|
-
left: `${
|
|
5227
|
+
left: `${o + 0.5}px`,
|
|
5230
5228
|
overflow: "hidden",
|
|
5231
|
-
width: `${
|
|
5232
|
-
height: `${
|
|
5229
|
+
width: `${l - o - d}px`,
|
|
5230
|
+
height: `${f}px`
|
|
5233
5231
|
},
|
|
5234
5232
|
cells: t
|
|
5235
5233
|
}, y = {
|
|
@@ -5239,19 +5237,19 @@ class Vi {
|
|
|
5239
5237
|
top: "0px",
|
|
5240
5238
|
right: "0px",
|
|
5241
5239
|
overflow: "hidden",
|
|
5242
|
-
width: `${
|
|
5243
|
-
height: `${
|
|
5240
|
+
width: `${d}px`,
|
|
5241
|
+
height: `${f}px`
|
|
5244
5242
|
},
|
|
5245
5243
|
cells: i
|
|
5246
5244
|
};
|
|
5247
5245
|
return {
|
|
5248
5246
|
type: "body",
|
|
5249
|
-
class: `${
|
|
5247
|
+
class: `${h}-overlayer-body`,
|
|
5250
5248
|
style: {
|
|
5251
5249
|
position: "relative",
|
|
5252
5250
|
overflow: "hidden",
|
|
5253
|
-
width: `${
|
|
5254
|
-
height: `${
|
|
5251
|
+
width: `${l}px`,
|
|
5252
|
+
height: `${f}px`
|
|
5255
5253
|
},
|
|
5256
5254
|
views: [x, u, y]
|
|
5257
5255
|
};
|
|
@@ -5265,9 +5263,9 @@ class Vi {
|
|
|
5265
5263
|
});
|
|
5266
5264
|
const {
|
|
5267
5265
|
fixedLeftWidth: s,
|
|
5268
|
-
fixedRightWidth:
|
|
5269
|
-
config: { SCROLLER_TRACK_SIZE:
|
|
5270
|
-
} = this.ctx, { visibleWidth:
|
|
5266
|
+
fixedRightWidth: o,
|
|
5267
|
+
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: n }
|
|
5268
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: l } = this.ctx.footer, f = o - r, d = {
|
|
5271
5269
|
key: "left",
|
|
5272
5270
|
style: {
|
|
5273
5271
|
position: "absolute",
|
|
@@ -5275,7 +5273,7 @@ class Vi {
|
|
|
5275
5273
|
left: `${0.5}px`,
|
|
5276
5274
|
overflow: "hidden",
|
|
5277
5275
|
width: `${s}px`,
|
|
5278
|
-
height: `${
|
|
5276
|
+
height: `${l}px`
|
|
5279
5277
|
},
|
|
5280
5278
|
cells: e
|
|
5281
5279
|
}, x = {
|
|
@@ -5285,8 +5283,8 @@ class Vi {
|
|
|
5285
5283
|
top: `${0.5}px`,
|
|
5286
5284
|
left: `${s + 0.5}px`,
|
|
5287
5285
|
overflow: "hidden",
|
|
5288
|
-
width: `${
|
|
5289
|
-
height: `${
|
|
5286
|
+
width: `${h - s - f}px`,
|
|
5287
|
+
height: `${l}px`
|
|
5290
5288
|
},
|
|
5291
5289
|
cells: t
|
|
5292
5290
|
}, u = {
|
|
@@ -5296,8 +5294,8 @@ class Vi {
|
|
|
5296
5294
|
top: `${0.5}px`,
|
|
5297
5295
|
right: `${0.5}px`,
|
|
5298
5296
|
overflow: "hidden",
|
|
5299
|
-
width: `${
|
|
5300
|
-
height: `${
|
|
5297
|
+
width: `${f}px`,
|
|
5298
|
+
height: `${l}px`
|
|
5301
5299
|
},
|
|
5302
5300
|
cells: i
|
|
5303
5301
|
};
|
|
@@ -5307,10 +5305,10 @@ class Vi {
|
|
|
5307
5305
|
style: {
|
|
5308
5306
|
position: "relative",
|
|
5309
5307
|
overflow: "hidden",
|
|
5310
|
-
width: `${
|
|
5311
|
-
height: `${
|
|
5308
|
+
width: `${h}px`,
|
|
5309
|
+
height: `${l}px`
|
|
5312
5310
|
},
|
|
5313
|
-
views: [
|
|
5311
|
+
views: [d, x, u]
|
|
5314
5312
|
};
|
|
5315
5313
|
}
|
|
5316
5314
|
}
|
|
@@ -5324,8 +5322,8 @@ class zi {
|
|
|
5324
5322
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5325
5323
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5326
5324
|
e.preventDefault();
|
|
5327
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [
|
|
5328
|
-
|
|
5325
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [n, h] = s, { rowIndex: l, colIndex: f } = t;
|
|
5326
|
+
l >= n && l <= h && f >= o && f <= r || this.ctx.emit("setSelectorCell", t, e);
|
|
5329
5327
|
const x = {
|
|
5330
5328
|
getBoundingClientRect: () => ({
|
|
5331
5329
|
width: 0,
|
|
@@ -5414,7 +5412,7 @@ class Gi {
|
|
|
5414
5412
|
c(this, "overlayer");
|
|
5415
5413
|
c(this, "contextMenu");
|
|
5416
5414
|
c(this, "ctx");
|
|
5417
|
-
this.target = document.createElement("canvas"), this.targetContainer = t, this.targetContainer.style.position = "relative", this.targetContainer.appendChild(this.target), this.options = e, this.ctx = new ri(this.targetContainer, this.target, this.options), this.header = new ni(this.ctx), this.body = new ai(this.ctx), this.footer = new ci(this.ctx), this.scroller = new oi(this.ctx), this.selector = new
|
|
5415
|
+
this.target = document.createElement("canvas"), this.targetContainer = t, this.targetContainer.style.position = "relative", this.targetContainer.appendChild(this.target), this.options = e, this.ctx = new ri(this.targetContainer, this.target, this.options), this.header = new ni(this.ctx), this.body = new ai(this.ctx), this.footer = new ci(this.ctx), this.scroller = new oi(this.ctx), this.selector = new hi(this.ctx), this.autofill = new li(this.ctx), this.tooltip = new Bi(this.ctx), this.empty = new Pi(this.ctx), this.editor = new Wi(this.ctx), this.overlayer = new Vi(this.ctx), this.contextMenu = new zi(this.ctx), this.ctx.on("draw", this.draw.bind(this)), this.draw();
|
|
5418
5416
|
}
|
|
5419
5417
|
draw() {
|
|
5420
5418
|
requestAnimationFrame(() => {
|
|
@@ -5422,13 +5420,13 @@ class Gi {
|
|
|
5422
5420
|
});
|
|
5423
5421
|
}
|
|
5424
5422
|
loadConfig(t) {
|
|
5425
|
-
this.ctx.config.init(t), this.ctx.database.init(), this.contextMenu.updated(), this.ctx.emit("draw");
|
|
5423
|
+
this.ctx.config.init(t), this.ctx.database.init(), this.header.init(), this.contextMenu.updated(), this.ctx.emit("draw");
|
|
5426
5424
|
}
|
|
5427
5425
|
loadColumns(t) {
|
|
5428
5426
|
this.editor.doneEdit(), this.ctx.database.setColumns(t), this.header.init(), this.ctx.emit("draw");
|
|
5429
5427
|
}
|
|
5430
5428
|
loadData(t) {
|
|
5431
|
-
this.editor.doneEdit(), this.ctx.database.setData(t), this.ctx.emit("draw");
|
|
5429
|
+
this.editor.doneEdit(), this.ctx.database.setData(t), this.header.init(), this.ctx.emit("draw");
|
|
5432
5430
|
}
|
|
5433
5431
|
loadFooterData(t) {
|
|
5434
5432
|
this.ctx.database.setFooterData(t), this.ctx.emit("draw");
|
|
@@ -5448,14 +5446,14 @@ class Gi {
|
|
|
5448
5446
|
editCell(t, e) {
|
|
5449
5447
|
this.editor.editCell(t, e);
|
|
5450
5448
|
}
|
|
5451
|
-
setItemValue(t, e, i, s = !0,
|
|
5452
|
-
this.ctx.database.setItemValue(t, e, i, s,
|
|
5449
|
+
setItemValue(t, e, i, s = !0, o = !0, r = !1) {
|
|
5450
|
+
this.ctx.database.setItemValue(t, e, i, s, o, r);
|
|
5453
5451
|
}
|
|
5454
5452
|
batchSetItemValue(t, e = !0, i = !0) {
|
|
5455
5453
|
this.ctx.database.batchSetItemValue(t, e), i && this.ctx.emit("draw");
|
|
5456
5454
|
}
|
|
5457
|
-
setItemValueByEditor(t, e, i, s = !0,
|
|
5458
|
-
this.ctx.database.setItemValue(t, e, i, s,
|
|
5455
|
+
setItemValueByEditor(t, e, i, s = !0, o = !0) {
|
|
5456
|
+
this.ctx.database.setItemValue(t, e, i, s, o, !0), this.editor.doneEdit();
|
|
5459
5457
|
}
|
|
5460
5458
|
doLayout() {
|
|
5461
5459
|
this.ctx.emit("draw");
|
|
@@ -5476,10 +5474,10 @@ class Gi {
|
|
|
5476
5474
|
e(s);
|
|
5477
5475
|
} catch (s) {
|
|
5478
5476
|
if (t && Array.isArray(s) && s.length) {
|
|
5479
|
-
const [
|
|
5480
|
-
if (Array.isArray(
|
|
5481
|
-
const [
|
|
5482
|
-
this.scrollToRowkey(n), this.scrollToColkey(
|
|
5477
|
+
const [o] = s;
|
|
5478
|
+
if (Array.isArray(o) && o.length) {
|
|
5479
|
+
const [r] = o, { rowKey: n, key: h } = r;
|
|
5480
|
+
this.scrollToRowkey(n), this.scrollToColkey(h);
|
|
5483
5481
|
}
|
|
5484
5482
|
}
|
|
5485
5483
|
i(s);
|
|
@@ -5488,8 +5486,8 @@ class Gi {
|
|
|
5488
5486
|
}
|
|
5489
5487
|
setValidations(t) {
|
|
5490
5488
|
if (t.forEach((e) => {
|
|
5491
|
-
const { rowIndex: i, key: s, message:
|
|
5492
|
-
this.ctx.database.setValidationErrorByRowIndex(i, s,
|
|
5489
|
+
const { rowIndex: i, key: s, message: o } = e;
|
|
5490
|
+
this.ctx.database.setValidationErrorByRowIndex(i, s, o);
|
|
5493
5491
|
}), t && Array.isArray(t) && t.length) {
|
|
5494
5492
|
const [e] = t;
|
|
5495
5493
|
if (e && e.rowIndex >= 0 && e.key) {
|
|
@@ -5501,13 +5499,13 @@ class Gi {
|
|
|
5501
5499
|
getValidations() {
|
|
5502
5500
|
return new Promise(async (t, e) => {
|
|
5503
5501
|
const i = this.ctx.database.getAllRowsData(), s = this.ctx.header.leafCellHeaders;
|
|
5504
|
-
let
|
|
5505
|
-
for (let
|
|
5502
|
+
let o = [];
|
|
5503
|
+
for (let r = 0; r < i.length; r++)
|
|
5506
5504
|
for (let n = 0; n < s.length; n++) {
|
|
5507
|
-
const
|
|
5508
|
-
Array.isArray(
|
|
5505
|
+
const h = this.ctx.database.getRowKeyByItem(i[r]), f = s[n].key, d = await this.ctx.database.getValidator(h, f);
|
|
5506
|
+
Array.isArray(d) && d.length && o.push(d);
|
|
5509
5507
|
}
|
|
5510
|
-
|
|
5508
|
+
o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
5511
5509
|
});
|
|
5512
5510
|
}
|
|
5513
5511
|
scrollTo(t, e) {
|