e-virt-table 0.0.9 → 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 +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1021 -1005
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Autofill.d.ts +1 -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 -0
- package/dist/lib/Config.js +24 -0
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Header.js +0 -1
- package/dist/lib/Header.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,33 +157,33 @@ 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 (f.push.apply(f, w),
|
|
175
|
-
return i(f), f.length ? u(new
|
|
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
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
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
189
|
function Se(a, t) {
|
|
@@ -197,14 +197,14 @@ function Se(a, t) {
|
|
|
197
197
|
function Nt(a, t) {
|
|
198
198
|
return function(e) {
|
|
199
199
|
var i;
|
|
200
|
-
return a.fullFields ? i = Se(t, a.fullFields) : i = t[e.field || a.fullField],
|
|
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
|
-
}, Te = function(t, e, i, s,
|
|
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
|
|
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
304
|
if (x ? d = "number" : u ? d = "string" : y && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
|
-
y && (f = e.length), u && (f = e.replace(
|
|
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
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,19 +523,19 @@ 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
|
|
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
539
|
function f(g) {
|
|
540
540
|
var w = [], p = {};
|
|
541
541
|
function E(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 (
|
|
552
|
+
if (h.messages) {
|
|
553
553
|
var d = this.messages();
|
|
554
|
-
d === Rt && (d = vt()),
|
|
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,7 +570,7 @@ 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
576
|
function m(R, T) {
|
|
@@ -582,39 +582,39 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
582
582
|
function b(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
584
|
var T = Array.isArray(R) ? R : [R];
|
|
585
|
-
!
|
|
585
|
+
!h.suppressWarning && T.length && a.warning("async-validator:", T), T.length && p.message !== void 0 && (T = [].concat(p.message));
|
|
586
586
|
var L = T.map(Nt(p, n));
|
|
587
|
-
if (
|
|
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 S = A[
|
|
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(
|
|
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
605
|
var S = [];
|
|
606
|
-
L && L.length && S.push.apply(S, L),
|
|
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
|
}
|
|
@@ -630,13 +630,13 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
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,13 +749,13 @@ 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
|
|
758
|
+
if (typeof l == "function" && (g = l), f) {
|
|
759
759
|
const w = i[f];
|
|
760
760
|
if (this.checkboxKeyMap.has(w)) {
|
|
761
761
|
const p = this.checkboxKeyMap.get(w);
|
|
@@ -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(
|
|
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
839
|
this.sumHeight += f, this.rowIndexRowKeyMap.set(e, n), this.positions.push({
|
|
840
840
|
top: d,
|
|
841
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:
|
|
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
969
|
key: f,
|
|
970
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,19 +1000,19 @@ 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(
|
|
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
1016
|
const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
|
|
1017
1017
|
rowKey: t,
|
|
1018
1018
|
key: e,
|
|
@@ -1022,18 +1022,18 @@ class Ze {
|
|
|
1022
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(
|
|
1027
|
+
originalValue: this.originalDataMap.get(l),
|
|
1028
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 f =
|
|
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
|
-
f && (
|
|
1268
|
+
f && (h = f);
|
|
1269
1269
|
}
|
|
1270
|
-
if (
|
|
1271
|
-
let
|
|
1272
|
-
if (f[e] = this.getItemValue(t, e), Array.isArray(
|
|
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(),
|
|
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
1517
|
let d;
|
|
1518
1518
|
switch (n) {
|
|
1519
1519
|
case "left":
|
|
1520
|
-
d = this.ctx.createLinearGradient(t -
|
|
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
|
-
), d.addColorStop(0,
|
|
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
|
-
d = this.ctx.createLinearGradient(t, e -
|
|
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
|
-
), d.addColorStop(0,
|
|
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:
|
|
1583
|
+
align: h = "center",
|
|
1584
|
+
color: l = "#495060",
|
|
1585
1585
|
padding: f = 0,
|
|
1586
1586
|
verticalAlign: d = "middle"
|
|
1587
|
-
} =
|
|
1588
|
-
this.ctx.font = n, this.ctx.fillStyle =
|
|
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
|
-
d === "top" ? x = i + f : d === "bottom" ? x = i +
|
|
1590
|
+
d === "top" ? x = i + f : d === "bottom" ? x = i + o - f : x = i + (o + f) / 2;
|
|
1591
1591
|
let u = 0;
|
|
1592
|
-
|
|
1592
|
+
h === "left" ? u = e + f : h === "right" ? u = e + s - f : u = e + s / 2;
|
|
1593
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
|
}
|
|
@@ -1681,6 +1681,14 @@ class Bt {
|
|
|
1681
1681
|
// 启用单点击立马编辑
|
|
1682
1682
|
c(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1683
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
|
|
1684
1692
|
c(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
1685
1693
|
c(this, "ENABLE_SELECTOR_SPAN_COL", !0);
|
|
1686
1694
|
c(this, "ENABLE_SELECTOR_SPAN_ROW", !0);
|
|
@@ -1807,35 +1815,35 @@ class ii {
|
|
|
1807
1815
|
const i = this.list[e];
|
|
1808
1816
|
let s = i.color;
|
|
1809
1817
|
if (i.configColorName) {
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1818
|
+
const r = this.ctx.config[i.configColorName];
|
|
1819
|
+
r && (s = r);
|
|
1812
1820
|
}
|
|
1813
|
-
const
|
|
1814
|
-
this.icons.set(i.name,
|
|
1821
|
+
const o = this.createImageFromSVG(i.svg, s).then((r) => {
|
|
1822
|
+
this.icons.set(i.name, r);
|
|
1815
1823
|
});
|
|
1816
|
-
t.push(
|
|
1824
|
+
t.push(o);
|
|
1817
1825
|
}
|
|
1818
1826
|
for (let e = 0; e < this.ctx.config.ICONS.length; e++) {
|
|
1819
1827
|
const i = this.ctx.config.ICONS[e];
|
|
1820
1828
|
let s = i.color;
|
|
1821
|
-
const
|
|
1822
|
-
this.icons.set(i.name,
|
|
1829
|
+
const o = this.createImageFromSVG(i.svg, s).then((r) => {
|
|
1830
|
+
this.icons.set(i.name, r);
|
|
1823
1831
|
});
|
|
1824
|
-
t.push(
|
|
1832
|
+
t.push(o);
|
|
1825
1833
|
}
|
|
1826
1834
|
await Promise.all(t), this.ctx.emit("draw");
|
|
1827
1835
|
}
|
|
1828
1836
|
async createImageFromSVG(t, e) {
|
|
1829
|
-
const
|
|
1830
|
-
e &&
|
|
1831
|
-
|
|
1837
|
+
const o = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
1838
|
+
e && o.querySelectorAll("*").forEach((l) => {
|
|
1839
|
+
l.setAttribute("fill", e);
|
|
1832
1840
|
});
|
|
1833
|
-
const
|
|
1841
|
+
const r = new Image(), n = new Blob([new XMLSerializer().serializeToString(o)], {
|
|
1834
1842
|
type: "image/svg+xml"
|
|
1835
|
-
}),
|
|
1836
|
-
return
|
|
1837
|
-
|
|
1838
|
-
|
|
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);
|
|
1839
1847
|
};
|
|
1840
1848
|
});
|
|
1841
1849
|
}
|
|
@@ -1844,7 +1852,7 @@ class ii {
|
|
|
1844
1852
|
}
|
|
1845
1853
|
}
|
|
1846
1854
|
class Jt {
|
|
1847
|
-
constructor(t, e, i, s,
|
|
1855
|
+
constructor(t, e, i, s, o, r, n) {
|
|
1848
1856
|
c(this, "ctx");
|
|
1849
1857
|
c(this, "x", 0);
|
|
1850
1858
|
c(this, "y", 0);
|
|
@@ -1852,13 +1860,13 @@ class Jt {
|
|
|
1852
1860
|
c(this, "height", 0);
|
|
1853
1861
|
c(this, "fixed");
|
|
1854
1862
|
c(this, "cellType");
|
|
1855
|
-
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;
|
|
1856
1864
|
}
|
|
1857
1865
|
isHorizontalVisible() {
|
|
1858
1866
|
if (this.fixed)
|
|
1859
1867
|
return !0;
|
|
1860
|
-
const { target: t, fixedLeftWidth: e, scrollX: i, fixedRightWidth: s } = this.ctx,
|
|
1861
|
-
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);
|
|
1862
1870
|
}
|
|
1863
1871
|
isVerticalVisible() {
|
|
1864
1872
|
const { target: t, scrollY: e } = this.ctx, i = t.height;
|
|
@@ -1881,10 +1889,11 @@ class Jt {
|
|
|
1881
1889
|
}
|
|
1882
1890
|
}
|
|
1883
1891
|
class Qt extends Jt {
|
|
1884
|
-
constructor(e, i, s,
|
|
1885
|
-
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);
|
|
1886
1894
|
c(this, "formatter");
|
|
1887
1895
|
c(this, "hoverIconName", "");
|
|
1896
|
+
c(this, "operation", !1);
|
|
1888
1897
|
c(this, "align");
|
|
1889
1898
|
c(this, "verticalAlign");
|
|
1890
1899
|
c(this, "fixed");
|
|
@@ -1927,7 +1936,7 @@ class Qt extends Jt {
|
|
|
1927
1936
|
c(this, "overflowTooltipShow", !0);
|
|
1928
1937
|
c(this, "overflowTooltipMaxWidth", 500);
|
|
1929
1938
|
c(this, "overflowTooltipPlacement", "top");
|
|
1930
|
-
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();
|
|
1931
1940
|
}
|
|
1932
1941
|
getValidationMessage() {
|
|
1933
1942
|
const e = this.ctx.database.getValidationError(this.rowKey, this.key);
|
|
@@ -1945,7 +1954,7 @@ class Qt extends Jt {
|
|
|
1945
1954
|
return;
|
|
1946
1955
|
const { SPAN_METHOD: e } = this.ctx.config;
|
|
1947
1956
|
if (typeof e == "function") {
|
|
1948
|
-
const i = e, { colspan: s = 1, rowspan:
|
|
1957
|
+
const i = e, { colspan: s = 1, rowspan: o = 1 } = i({
|
|
1949
1958
|
row: this.row,
|
|
1950
1959
|
rowIndex: this.rowIndex,
|
|
1951
1960
|
colIndex: this.colIndex,
|
|
@@ -1957,7 +1966,7 @@ class Qt extends Jt {
|
|
|
1957
1966
|
visibleLeafColumns: this.ctx.header.visibleLeafColumns,
|
|
1958
1967
|
rows: this.ctx.body.data
|
|
1959
1968
|
}) || {};
|
|
1960
|
-
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);
|
|
1961
1970
|
}
|
|
1962
1971
|
}
|
|
1963
1972
|
updateType() {
|
|
@@ -2019,20 +2028,20 @@ class Qt extends Jt {
|
|
|
2019
2028
|
}
|
|
2020
2029
|
updateTree() {
|
|
2021
2030
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2022
|
-
let
|
|
2031
|
+
let o, r = 0, n = "";
|
|
2023
2032
|
if (this.type === "tree" && s === "body") {
|
|
2024
|
-
const
|
|
2033
|
+
const h = this.ctx.database.getRowForRowKey(i), { expand: l = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = h || {};
|
|
2025
2034
|
if (d) {
|
|
2026
2035
|
const u = this.ctx.icons.get("loading");
|
|
2027
|
-
n = "loading",
|
|
2036
|
+
n = "loading", o = u, r = x * 8;
|
|
2028
2037
|
} else if (f) {
|
|
2029
2038
|
const u = this.ctx.icons.get("expand"), y = this.ctx.icons.get("shrink");
|
|
2030
|
-
|
|
2039
|
+
o = l ? y : u, n = l ? "shrink" : "expand", r = x * 8;
|
|
2031
2040
|
} else
|
|
2032
|
-
|
|
2033
|
-
if (
|
|
2034
|
-
let u = 20, y = 20, g = this.drawX +
|
|
2035
|
-
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;
|
|
2036
2045
|
}
|
|
2037
2046
|
}
|
|
2038
2047
|
}
|
|
@@ -2041,18 +2050,18 @@ class Qt extends Jt {
|
|
|
2041
2050
|
BODY_BG_COLOR: e,
|
|
2042
2051
|
EDIT_BG_COLOR: i,
|
|
2043
2052
|
BODY_CELL_STYLE_METHOD: s,
|
|
2044
|
-
FOOTER_CELL_STYLE_METHOD:
|
|
2045
|
-
READONLY_TEXT_COLOR:
|
|
2053
|
+
FOOTER_CELL_STYLE_METHOD: o,
|
|
2054
|
+
READONLY_TEXT_COLOR: r,
|
|
2046
2055
|
FOOTER_BG_COLOR: n,
|
|
2047
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2048
|
-
HIGHLIGHT_SELECTED_ROW_COLOR:
|
|
2056
|
+
HIGHLIGHT_SELECTED_ROW: h,
|
|
2057
|
+
HIGHLIGHT_SELECTED_ROW_COLOR: l,
|
|
2049
2058
|
HIGHLIGHT_HOVER_ROW: f,
|
|
2050
2059
|
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
2051
2060
|
} = this.ctx.config;
|
|
2052
2061
|
if (this.cellType === "footer") {
|
|
2053
|
-
let p = n, E =
|
|
2054
|
-
if (typeof
|
|
2055
|
-
const m =
|
|
2062
|
+
let p = n, E = r;
|
|
2063
|
+
if (typeof o == "function") {
|
|
2064
|
+
const m = o, { backgroundColor: b, color: C } = m({
|
|
2056
2065
|
row: this.row,
|
|
2057
2066
|
rowIndex: this.rowIndex,
|
|
2058
2067
|
colIndex: this.colIndex,
|
|
@@ -2066,13 +2075,13 @@ class Qt extends Jt {
|
|
|
2066
2075
|
}
|
|
2067
2076
|
let x = "transparent";
|
|
2068
2077
|
const u = this.ctx.focusCell, y = this.ctx.hoverCell;
|
|
2069
|
-
f && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = d),
|
|
2070
|
-
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;
|
|
2071
2080
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2072
|
-
this.drawCellBgColor = e, this.drawTextColor =
|
|
2081
|
+
this.drawCellBgColor = e, this.drawTextColor = r;
|
|
2073
2082
|
return;
|
|
2074
2083
|
}
|
|
2075
|
-
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") {
|
|
2076
2085
|
const p = s, { backgroundColor: E, color: m } = p({
|
|
2077
2086
|
row: this.row,
|
|
2078
2087
|
rowIndex: this.rowIndex,
|
|
@@ -2085,29 +2094,29 @@ class Qt extends Jt {
|
|
|
2085
2094
|
this.drawCellBgColor = g, this.drawTextColor = w;
|
|
2086
2095
|
}
|
|
2087
2096
|
updateSelection() {
|
|
2088
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan:
|
|
2089
|
-
if (!(s === 0 ||
|
|
2090
|
-
const f = this.ctx.database.getRowSelection(
|
|
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;
|
|
2091
2100
|
let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
2092
|
-
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 ===
|
|
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);
|
|
2093
2102
|
}
|
|
2094
2103
|
}
|
|
2095
2104
|
updateHoverIcon() {
|
|
2096
2105
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2097
2106
|
if (typeof e == "function") {
|
|
2098
|
-
const
|
|
2107
|
+
const h = e({
|
|
2099
2108
|
row: this.row,
|
|
2100
2109
|
rowIndex: this.rowIndex,
|
|
2101
2110
|
colIndex: this.colIndex,
|
|
2102
2111
|
column: this.column,
|
|
2103
2112
|
value: this.getValue()
|
|
2104
2113
|
});
|
|
2105
|
-
|
|
2114
|
+
h !== void 0 && (this.hoverIconName = h);
|
|
2106
2115
|
}
|
|
2107
|
-
const
|
|
2116
|
+
const o = this.drawX + this.width - i - s, r = this.drawY + (this.height - i) / 2;
|
|
2108
2117
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
2109
2118
|
const n = this.ctx.icons.get(this.hoverIconName);
|
|
2110
|
-
this.drawImageX =
|
|
2119
|
+
this.drawImageX = o, this.drawImageY = r, this.drawImageWidth = i, this.drawImageHeight = i, this.drawImageName = this.hoverIconName, this.drawImageSource = n;
|
|
2111
2120
|
}
|
|
2112
2121
|
}
|
|
2113
2122
|
/**
|
|
@@ -2163,11 +2172,11 @@ class Qt extends Jt {
|
|
|
2163
2172
|
const {
|
|
2164
2173
|
paint: e,
|
|
2165
2174
|
config: { BORDER_COLOR: i }
|
|
2166
|
-
} = this.ctx, { drawX: s, drawY:
|
|
2167
|
-
e.drawRect(s,
|
|
2175
|
+
} = this.ctx, { drawX: s, drawY: o } = this;
|
|
2176
|
+
e.drawRect(s, o, this.visibleWidth, this.visibleHeight, {
|
|
2168
2177
|
borderColor: i,
|
|
2169
2178
|
fillColor: this.drawCellBgColor
|
|
2170
|
-
}), e.drawRect(s,
|
|
2179
|
+
}), e.drawRect(s, o, this.width, this.height, {
|
|
2171
2180
|
borderColor: "transparent",
|
|
2172
2181
|
borderWidth: 1,
|
|
2173
2182
|
fillColor: this.drawCellSkyBgColor
|
|
@@ -2181,9 +2190,9 @@ class Qt extends Jt {
|
|
|
2181
2190
|
if (i === 0)
|
|
2182
2191
|
return 0;
|
|
2183
2192
|
let s = 0;
|
|
2184
|
-
for (let
|
|
2185
|
-
const
|
|
2186
|
-
s +=
|
|
2193
|
+
for (let o = e; o < e + i; o++) {
|
|
2194
|
+
const r = this.ctx.header.leafCellHeaders[o];
|
|
2195
|
+
s += r.width;
|
|
2187
2196
|
}
|
|
2188
2197
|
return s;
|
|
2189
2198
|
}
|
|
@@ -2219,8 +2228,8 @@ class Qt extends Jt {
|
|
|
2219
2228
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2220
2229
|
if (!s || !i)
|
|
2221
2230
|
return;
|
|
2222
|
-
const { xArr:
|
|
2223
|
-
|
|
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, {
|
|
2224
2233
|
borderColor: "#fff",
|
|
2225
2234
|
fillColor: e
|
|
2226
2235
|
});
|
|
@@ -2231,10 +2240,10 @@ class Qt extends Jt {
|
|
|
2231
2240
|
const { ENABLE_SELECTOR: e } = this.ctx.config;
|
|
2232
2241
|
if (!e)
|
|
2233
2242
|
return;
|
|
2234
|
-
const { xArr: i, yArr: s, xArrCopy:
|
|
2243
|
+
const { xArr: i, yArr: s, xArrCopy: o, yArrCopy: r } = this.ctx.selector;
|
|
2235
2244
|
this.drawBorder({
|
|
2236
|
-
xArr:
|
|
2237
|
-
yArr:
|
|
2245
|
+
xArr: o,
|
|
2246
|
+
yArr: r,
|
|
2238
2247
|
borderColor: this.ctx.config.SELECT_BORDER_COLOR || "rgb(82,146,247)",
|
|
2239
2248
|
fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)",
|
|
2240
2249
|
borderWidth: 1,
|
|
@@ -2257,13 +2266,13 @@ class Qt extends Jt {
|
|
|
2257
2266
|
drawErrorTip() {
|
|
2258
2267
|
if (this.cellType === "footer" || !this.message)
|
|
2259
2268
|
return;
|
|
2260
|
-
const { ERROR_TIP_ICON_SIZE: e, ERROR_TIP_COLOR: i } = this.ctx.config, { width: s } = this,
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
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
|
|
2267
2276
|
];
|
|
2268
2277
|
this.ctx.paint.drawLine(n, {
|
|
2269
2278
|
borderColor: i,
|
|
@@ -2274,32 +2283,32 @@ class Qt extends Jt {
|
|
|
2274
2283
|
});
|
|
2275
2284
|
}
|
|
2276
2285
|
drawBorder(e) {
|
|
2277
|
-
const { drawX: i, drawY: s, width:
|
|
2278
|
-
let
|
|
2279
|
-
|
|
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);
|
|
2280
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];
|
|
2281
|
-
n >= p && n <= E &&
|
|
2290
|
+
n >= p && n <= E && r === m && this.ctx.paint.drawLine([h, l, h + o - 2, l], {
|
|
2282
2291
|
borderColor: g,
|
|
2283
2292
|
fillColor: w,
|
|
2284
2293
|
borderWidth: y,
|
|
2285
2294
|
lineCap: "round",
|
|
2286
2295
|
lineJoin: "round",
|
|
2287
2296
|
lineDash: u
|
|
2288
|
-
}), 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], {
|
|
2289
2298
|
borderColor: g,
|
|
2290
2299
|
fillColor: w,
|
|
2291
2300
|
borderWidth: y,
|
|
2292
2301
|
lineCap: "round",
|
|
2293
2302
|
lineJoin: "round",
|
|
2294
2303
|
lineDash: u
|
|
2295
|
-
}), n === p &&
|
|
2304
|
+
}), n === p && r >= m && r <= b && this.ctx.paint.drawLine([h, l, h, l + f - 1], {
|
|
2296
2305
|
borderColor: g,
|
|
2297
2306
|
fillColor: w,
|
|
2298
2307
|
borderWidth: y,
|
|
2299
2308
|
lineCap: "round",
|
|
2300
2309
|
lineJoin: "round",
|
|
2301
2310
|
lineDash: u
|
|
2302
|
-
}), n === E &&
|
|
2311
|
+
}), n === E && r >= m && r <= b && this.ctx.paint.drawLine([h + o - 1, l, h + o - 1, l + f - 1], {
|
|
2303
2312
|
borderColor: g,
|
|
2304
2313
|
fillColor: w,
|
|
2305
2314
|
borderWidth: y,
|
|
@@ -2310,13 +2319,14 @@ class Qt extends Jt {
|
|
|
2310
2319
|
}
|
|
2311
2320
|
}
|
|
2312
2321
|
class te extends Jt {
|
|
2313
|
-
constructor(e, i, s,
|
|
2314
|
-
super(e, s,
|
|
2322
|
+
constructor(e, i, s, o, r, n, h) {
|
|
2323
|
+
super(e, s, o, r, n, h.fixed, "header");
|
|
2315
2324
|
c(this, "align");
|
|
2316
2325
|
c(this, "verticalAlign", "middle");
|
|
2317
2326
|
c(this, "fixed");
|
|
2318
2327
|
c(this, "widthFillDisable");
|
|
2319
2328
|
c(this, "type");
|
|
2329
|
+
c(this, "operation", !1);
|
|
2320
2330
|
c(this, "editorType");
|
|
2321
2331
|
c(this, "level");
|
|
2322
2332
|
c(this, "text");
|
|
@@ -2344,7 +2354,7 @@ class te extends Jt {
|
|
|
2344
2354
|
c(this, "drawImageHeight", 0);
|
|
2345
2355
|
c(this, "drawImageName", "");
|
|
2346
2356
|
c(this, "drawImageSource");
|
|
2347
|
-
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;
|
|
2348
2358
|
}
|
|
2349
2359
|
/**
|
|
2350
2360
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2362,15 +2372,15 @@ class te extends Jt {
|
|
|
2362
2372
|
}
|
|
2363
2373
|
updateContainer() {
|
|
2364
2374
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2365
|
-
let
|
|
2375
|
+
let o = i, r = s;
|
|
2366
2376
|
if (typeof e == "function") {
|
|
2367
|
-
const n = e, { backgroundColor:
|
|
2377
|
+
const n = e, { backgroundColor: h, color: l } = n({
|
|
2368
2378
|
colIndex: this.colIndex,
|
|
2369
2379
|
column: this.column
|
|
2370
2380
|
}) || {};
|
|
2371
|
-
|
|
2381
|
+
h && (o = h), l && (r = l);
|
|
2372
2382
|
}
|
|
2373
|
-
this.drawCellBgColor =
|
|
2383
|
+
this.drawCellBgColor = o, this.drawTextColor = r;
|
|
2374
2384
|
}
|
|
2375
2385
|
update() {
|
|
2376
2386
|
this.updateContainer(), this.displayText = this.getText(), this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.updateStyle();
|
|
@@ -2378,13 +2388,13 @@ class te extends Jt {
|
|
|
2378
2388
|
draw() {
|
|
2379
2389
|
const {
|
|
2380
2390
|
paint: e,
|
|
2381
|
-
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT:
|
|
2382
|
-
} = this.ctx, { drawX:
|
|
2383
|
-
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, {
|
|
2384
2394
|
borderColor: i,
|
|
2385
2395
|
fillColor: this.drawCellBgColor
|
|
2386
|
-
}), e.drawText(
|
|
2387
|
-
font:
|
|
2396
|
+
}), e.drawText(h, r, n, this.width, this.height, {
|
|
2397
|
+
font: o,
|
|
2388
2398
|
padding: s,
|
|
2389
2399
|
color: this.drawTextColor,
|
|
2390
2400
|
align: this.align,
|
|
@@ -2394,9 +2404,9 @@ class te extends Jt {
|
|
|
2394
2404
|
drawSelection() {
|
|
2395
2405
|
const { width: e, height: i, type: s } = this;
|
|
2396
2406
|
if (["index-selection", "selection"].includes(s)) {
|
|
2397
|
-
const { indeterminate:
|
|
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;
|
|
2398
2408
|
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2399
|
-
|
|
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(
|
|
2400
2410
|
this.drawImageSource,
|
|
2401
2411
|
this.drawImageX,
|
|
2402
2412
|
this.drawImageY,
|
|
@@ -2438,20 +2448,20 @@ class si {
|
|
|
2438
2448
|
if (t.button !== 0 || this.isBusy(t))
|
|
2439
2449
|
return;
|
|
2440
2450
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2441
|
-
for (const
|
|
2442
|
-
const n =
|
|
2443
|
-
if (i > n && i < n +
|
|
2444
|
-
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);
|
|
2445
2455
|
return;
|
|
2446
2456
|
}
|
|
2447
2457
|
}
|
|
2448
|
-
const
|
|
2449
|
-
for (const
|
|
2450
|
-
const n =
|
|
2451
|
-
for (const
|
|
2452
|
-
const
|
|
2453
|
-
if (i >
|
|
2454
|
-
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);
|
|
2455
2465
|
return;
|
|
2456
2466
|
}
|
|
2457
2467
|
}
|
|
@@ -2460,20 +2470,20 @@ class si {
|
|
|
2460
2470
|
if (t.button !== 0 || this.isBusy(t))
|
|
2461
2471
|
return;
|
|
2462
2472
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2463
|
-
for (const
|
|
2464
|
-
const n =
|
|
2465
|
-
if (i > n && i < n +
|
|
2466
|
-
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);
|
|
2467
2477
|
return;
|
|
2468
2478
|
}
|
|
2469
2479
|
}
|
|
2470
|
-
const
|
|
2471
|
-
for (const
|
|
2472
|
-
const n =
|
|
2473
|
-
for (const
|
|
2474
|
-
const
|
|
2475
|
-
if (i >
|
|
2476
|
-
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);
|
|
2477
2487
|
return;
|
|
2478
2488
|
}
|
|
2479
2489
|
}
|
|
@@ -2482,46 +2492,46 @@ class si {
|
|
|
2482
2492
|
if (this.isBusy(t))
|
|
2483
2493
|
return;
|
|
2484
2494
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2485
|
-
for (const
|
|
2486
|
-
const n =
|
|
2487
|
-
if (i > n && i < n +
|
|
2488
|
-
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);
|
|
2489
2499
|
return;
|
|
2490
2500
|
}
|
|
2491
2501
|
}
|
|
2492
|
-
const
|
|
2493
|
-
for (const
|
|
2494
|
-
const n =
|
|
2495
|
-
for (const
|
|
2496
|
-
const
|
|
2497
|
-
if (i >
|
|
2498
|
-
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);
|
|
2499
2509
|
return;
|
|
2500
2510
|
}
|
|
2501
2511
|
}
|
|
2502
2512
|
}
|
|
2503
2513
|
}), this.ctx.on("mousemove", (t) => {
|
|
2504
|
-
var
|
|
2514
|
+
var r;
|
|
2505
2515
|
if (this.isBusy(t))
|
|
2506
2516
|
return;
|
|
2507
2517
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2508
2518
|
for (const n of s) {
|
|
2509
|
-
const
|
|
2510
|
-
if (i >
|
|
2519
|
+
const h = n.getDrawX(), l = n.getDrawY();
|
|
2520
|
+
if (i > h && i < h + n.width && e > l && e < l + n.height) {
|
|
2511
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)
|
|
2512
2522
|
return;
|
|
2513
2523
|
this.ctx.hoverCellHeader = n, this.ctx.emit("cellHeaderHoverChange", n);
|
|
2514
2524
|
return;
|
|
2515
2525
|
}
|
|
2516
2526
|
}
|
|
2517
|
-
const
|
|
2518
|
-
for (const n of
|
|
2519
|
-
const
|
|
2520
|
-
for (const
|
|
2521
|
-
const f =
|
|
2522
|
-
if (i > f && i < f +
|
|
2523
|
-
if (this.ctx.emit("cellMouseenter",
|
|
2524
|
-
((
|
|
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);
|
|
2525
2535
|
return;
|
|
2526
2536
|
}
|
|
2527
2537
|
}
|
|
@@ -2548,18 +2558,18 @@ class si {
|
|
|
2548
2558
|
*/
|
|
2549
2559
|
treeClick(t) {
|
|
2550
2560
|
if (t.type === "tree" && this.ctx.isPointer) {
|
|
2551
|
-
const e = this.ctx.database.getRowForRowKey(t.rowKey), { expand: i = !1, expandLazy: s = !1 } = e || {}, { EXPAND_LAZY:
|
|
2552
|
-
if (
|
|
2553
|
-
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({
|
|
2554
2564
|
row: t.row,
|
|
2555
2565
|
rowIndex: t.rowIndex,
|
|
2556
2566
|
colIndex: t.colIndex,
|
|
2557
2567
|
column: t.column,
|
|
2558
2568
|
value: t.getValue()
|
|
2559
|
-
}).then((
|
|
2560
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2561
|
-
}).catch((
|
|
2562
|
-
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);
|
|
2563
2573
|
}));
|
|
2564
2574
|
else {
|
|
2565
2575
|
const n = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2710,13 +2720,13 @@ class ri {
|
|
|
2710
2720
|
getSelectedData() {
|
|
2711
2721
|
const t = [], e = this.selector.yArr, i = this.selector.xArr;
|
|
2712
2722
|
let s = "";
|
|
2713
|
-
for (let
|
|
2714
|
-
const
|
|
2723
|
+
for (let o = 0; o <= e[1] - e[0]; o++) {
|
|
2724
|
+
const r = [];
|
|
2715
2725
|
for (let n = 0; n <= i[1] - i[0]; n++) {
|
|
2716
|
-
const
|
|
2717
|
-
f &&
|
|
2726
|
+
const h = o + e[0], l = n + i[0], f = this.database.getItemValueForRowIndexAndColIndex(h, l);
|
|
2727
|
+
f && r.push(f.value);
|
|
2718
2728
|
}
|
|
2719
|
-
s += `${
|
|
2729
|
+
s += `${r.join(" ")}\r`, t.push(r);
|
|
2720
2730
|
}
|
|
2721
2731
|
return s = s ? s.replace(/\r$/, "") : " ", {
|
|
2722
2732
|
xArr: i,
|
|
@@ -2729,9 +2739,9 @@ class ri {
|
|
|
2729
2739
|
let i = Math.floor(t);
|
|
2730
2740
|
const s = this.body.width - this.body.visibleWidth;
|
|
2731
2741
|
i < 0 ? i = 0 : i > s && (i = s);
|
|
2732
|
-
let
|
|
2733
|
-
const
|
|
2734
|
-
|
|
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);
|
|
2735
2745
|
}
|
|
2736
2746
|
setScrollX(t) {
|
|
2737
2747
|
let e = Math.floor(t);
|
|
@@ -2798,13 +2808,13 @@ class Wt {
|
|
|
2798
2808
|
this.updateScroll(t);
|
|
2799
2809
|
}
|
|
2800
2810
|
onMouseDown(t) {
|
|
2801
|
-
const { offsetX: e, offsetY: i, clientX: s, clientY:
|
|
2802
|
-
if (!(s == this.clientX &&
|
|
2811
|
+
const { offsetX: e, offsetY: i, clientX: s, clientY: o } = t;
|
|
2812
|
+
if (!(s == this.clientX && o == this.clientY)) {
|
|
2803
2813
|
if (this.isOnScrollbar(e, i))
|
|
2804
|
-
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;
|
|
2805
2815
|
else if (this.isOnTrack(e, i)) {
|
|
2806
|
-
let
|
|
2807
|
-
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));
|
|
2808
2818
|
}
|
|
2809
2819
|
}
|
|
2810
2820
|
}
|
|
@@ -2812,16 +2822,16 @@ class Wt {
|
|
|
2812
2822
|
this.isDragging = !1, this.isFocus = !1, this.clientX = 0, this.clientY = 0;
|
|
2813
2823
|
}
|
|
2814
2824
|
onMouseMove(t) {
|
|
2815
|
-
const { offsetX: e, offsetY: i, clientX: s, clientY:
|
|
2816
|
-
if (this.isOnScrollbar(e, i) && t.target === this.ctx.target ? this.isFocus = !0 : this.isFocus = !1, s == this.clientX &&
|
|
2817
|
-
let
|
|
2818
|
-
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) {
|
|
2819
2829
|
let n = 0;
|
|
2820
|
-
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));
|
|
2821
2831
|
}
|
|
2822
2832
|
}
|
|
2823
|
-
isPointInElement(t, e, i, s,
|
|
2824
|
-
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;
|
|
2825
2835
|
}
|
|
2826
2836
|
isOnScrollbar(t, e) {
|
|
2827
2837
|
return this.isPointInElement(t, e, this.barX, this.barY, this.barWidth, this.barHeight);
|
|
@@ -2838,20 +2848,20 @@ class Wt {
|
|
|
2838
2848
|
body: t,
|
|
2839
2849
|
header: e,
|
|
2840
2850
|
config: { SCROLLER_TRACK_SIZE: i = 0, SCROLLER_SIZE: s = 0 }
|
|
2841
|
-
} = 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;
|
|
2842
2852
|
if (this.type === "vertical") {
|
|
2843
|
-
this.visibleDistance =
|
|
2844
|
-
const d = this.distance ? this.visibleDistance /
|
|
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;
|
|
2845
2855
|
let x = Math.floor(d * this.visibleDistance);
|
|
2846
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));
|
|
2847
2857
|
} else {
|
|
2848
|
-
this.visibleDistance =
|
|
2849
|
-
r - i,
|
|
2858
|
+
this.visibleDistance = o - i, this.distance = h - this.visibleDistance, this.splitPoints = [
|
|
2850
2859
|
o - i,
|
|
2851
2860
|
r - i,
|
|
2852
|
-
o
|
|
2853
|
-
|
|
2854
|
-
|
|
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;
|
|
2855
2865
|
let x = Math.floor(d * this.visibleDistance);
|
|
2856
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));
|
|
2857
2867
|
}
|
|
@@ -2924,8 +2934,8 @@ class oi {
|
|
|
2924
2934
|
s > e.visibleHeight && this.setScrollY(s - e.visibleHeight / 2);
|
|
2925
2935
|
}
|
|
2926
2936
|
scrollToRowKey(t) {
|
|
2927
|
-
const { body: e, database: i } = this.ctx, s = i.getRowIndexForRowKey(t), { top:
|
|
2928
|
-
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);
|
|
2929
2939
|
}
|
|
2930
2940
|
}
|
|
2931
2941
|
class ni {
|
|
@@ -2977,19 +2987,19 @@ class ni {
|
|
|
2977
2987
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
2978
2988
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
2979
2989
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
2980
|
-
const s = Ut(i),
|
|
2981
|
-
this.height = t * s, this.width =
|
|
2982
|
-
const
|
|
2983
|
-
this.columnIndex = 0, this.resizeNum = 0, this.render(
|
|
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);
|
|
2984
2994
|
const n = this.ctx.targetContainer.getBoundingClientRect();
|
|
2985
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;
|
|
2986
|
-
const
|
|
2987
|
-
if (this.resizeNum &&
|
|
2988
|
-
const d = Math.floor(
|
|
2996
|
+
const h = this.visibleWidth - this.width;
|
|
2997
|
+
if (this.resizeNum && h > 0) {
|
|
2998
|
+
const d = Math.floor(h / this.resizeNum * 100) / 100;
|
|
2989
2999
|
this.resizeAllColumn(d);
|
|
2990
3000
|
}
|
|
2991
|
-
const
|
|
2992
|
-
this.ctx.fixedLeftWidth =
|
|
3001
|
+
const l = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
3002
|
+
this.ctx.fixedLeftWidth = l.reduce((d, x) => d + x.width, 0);
|
|
2993
3003
|
const f = this.fixedRightCellHeaders.filter((d) => !d.hasChildren);
|
|
2994
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;
|
|
2995
3005
|
}
|
|
@@ -3009,36 +3019,36 @@ class ni {
|
|
|
3009
3019
|
config: { RESIZE_COLUMN_MIN_WIDTH: s }
|
|
3010
3020
|
} = this.ctx;
|
|
3011
3021
|
if (this.isResizing && this.resizeTarget) {
|
|
3012
|
-
const
|
|
3013
|
-
let
|
|
3014
|
-
|
|
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");
|
|
3015
3025
|
} else {
|
|
3016
3026
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3017
3027
|
return;
|
|
3018
3028
|
this.ctx.target.style.cursor === "col-resize" && (this.ctx.target.style.cursor = "default");
|
|
3019
|
-
const
|
|
3020
|
-
for (const
|
|
3021
|
-
const n = e.layerX,
|
|
3022
|
-
n >
|
|
3023
|
-
|
|
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);
|
|
3024
3034
|
}
|
|
3025
3035
|
}
|
|
3026
3036
|
}));
|
|
3027
3037
|
}
|
|
3028
3038
|
resizeColumn(t, e) {
|
|
3029
|
-
const i = (
|
|
3030
|
-
|
|
3031
|
-
if (
|
|
3032
|
-
const n =
|
|
3033
|
-
|
|
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;
|
|
3034
3044
|
}
|
|
3035
3045
|
});
|
|
3036
3046
|
};
|
|
3037
3047
|
i(this.columns), this.ctx.database.setColumns(this.columns), this.init(), this.ctx.emit("draw");
|
|
3038
3048
|
let s = 0;
|
|
3039
3049
|
if (this.width < this.visibleWidth) {
|
|
3040
|
-
const
|
|
3041
|
-
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");
|
|
3042
3052
|
}
|
|
3043
3053
|
this.ctx.emit("resizeColumnChange", {
|
|
3044
3054
|
colIndex: t.colIndex,
|
|
@@ -3053,18 +3063,18 @@ class ni {
|
|
|
3053
3063
|
if (t === 0) return;
|
|
3054
3064
|
const e = /* @__PURE__ */ new Map();
|
|
3055
3065
|
let i = !0;
|
|
3056
|
-
for (const
|
|
3057
|
-
if (
|
|
3058
|
-
e.set(
|
|
3066
|
+
for (const o of this.allCellHeaders)
|
|
3067
|
+
if (o.widthFillDisable)
|
|
3068
|
+
e.set(o.key, o.width);
|
|
3059
3069
|
else {
|
|
3060
|
-
const
|
|
3061
|
-
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);
|
|
3062
3072
|
}
|
|
3063
3073
|
if (!i)
|
|
3064
3074
|
return;
|
|
3065
|
-
const s = (
|
|
3066
|
-
|
|
3067
|
-
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);
|
|
3068
3078
|
});
|
|
3069
3079
|
};
|
|
3070
3080
|
s(this.columns), this.ctx.database.setColumns(this.columns), this.init();
|
|
@@ -3072,12 +3082,12 @@ class ni {
|
|
|
3072
3082
|
render(t, e) {
|
|
3073
3083
|
const i = t.length;
|
|
3074
3084
|
let s = e;
|
|
3075
|
-
const { HEADER_HEIGHT:
|
|
3076
|
-
for (let
|
|
3077
|
-
const n = t[
|
|
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;
|
|
3078
3088
|
let f = n.width || 100;
|
|
3079
3089
|
n.children && (f = It(n.children).reduce((u, y) => u + ((y == null ? void 0 : y.width) || 100), 0));
|
|
3080
|
-
const d = new te(this.ctx, this.columnIndex, s,
|
|
3090
|
+
const d = new te(this.ctx, this.columnIndex, s, l, f, h, n);
|
|
3081
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;
|
|
3082
3092
|
}
|
|
3083
3093
|
}
|
|
@@ -3086,8 +3096,8 @@ class ni {
|
|
|
3086
3096
|
const {
|
|
3087
3097
|
target: t,
|
|
3088
3098
|
config: { RESIZE_COLUMN_LINE_COLOR: e }
|
|
3089
|
-
} = this.ctx, i = this.resizeTarget.getDrawX(), s = this.resizeTarget.width,
|
|
3090
|
-
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, {
|
|
3091
3101
|
borderColor: e,
|
|
3092
3102
|
borderWidth: 1
|
|
3093
3103
|
});
|
|
@@ -3099,19 +3109,19 @@ class ni {
|
|
|
3099
3109
|
fixedRightWidth: e,
|
|
3100
3110
|
scrollX: i,
|
|
3101
3111
|
header: s,
|
|
3102
|
-
target:
|
|
3103
|
-
config: { HEADER_BG_COLOR:
|
|
3112
|
+
target: o,
|
|
3113
|
+
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: n }
|
|
3104
3114
|
} = this.ctx;
|
|
3105
3115
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
3106
|
-
fillColor:
|
|
3116
|
+
fillColor: r,
|
|
3107
3117
|
side: "right",
|
|
3108
3118
|
shadowWidth: 4,
|
|
3109
3119
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3110
3120
|
colorEnd: "rgba(0,0,0,0)"
|
|
3111
3121
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3112
|
-
const
|
|
3113
|
-
this.ctx.paint.drawShadow(
|
|
3114
|
-
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,
|
|
3115
3125
|
side: "left",
|
|
3116
3126
|
shadowWidth: 4,
|
|
3117
3127
|
colorStart: "rgba(0,0,0,0)",
|
|
@@ -3127,7 +3137,7 @@ class ni {
|
|
|
3127
3137
|
i.push(s), s.hasChildren || t.push(s);
|
|
3128
3138
|
}), this.fixedRightCellHeaders.forEach((s) => {
|
|
3129
3139
|
i.push(s), s.hasChildren || t.push(s);
|
|
3130
|
-
}), this.renderCenterCellHeaders = e, this.renderFixedCellHeaders = i, this.renderLeafCellHeaders = t.sort((s,
|
|
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);
|
|
3131
3141
|
}
|
|
3132
3142
|
draw() {
|
|
3133
3143
|
this.renderCenterCellHeaders.forEach((t) => {
|
|
@@ -3138,7 +3148,7 @@ class ni {
|
|
|
3138
3148
|
}
|
|
3139
3149
|
}
|
|
3140
3150
|
class ee {
|
|
3141
|
-
constructor(t, e, i = 0, s = 0,
|
|
3151
|
+
constructor(t, e, i = 0, s = 0, o = 0, r = 0, n, h = "body") {
|
|
3142
3152
|
c(this, "ctx");
|
|
3143
3153
|
c(this, "x", 0);
|
|
3144
3154
|
c(this, "y", 0);
|
|
@@ -3151,24 +3161,24 @@ class ee {
|
|
|
3151
3161
|
c(this, "rowKey", "");
|
|
3152
3162
|
c(this, "rowType", "body");
|
|
3153
3163
|
c(this, "data");
|
|
3154
|
-
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();
|
|
3155
3165
|
}
|
|
3156
3166
|
update() {
|
|
3157
3167
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3158
|
-
t.renderLeafCellHeaders.forEach((
|
|
3159
|
-
const
|
|
3168
|
+
t.renderLeafCellHeaders.forEach((o) => {
|
|
3169
|
+
const r = new Qt(
|
|
3160
3170
|
this.ctx,
|
|
3161
3171
|
this.rowIndex,
|
|
3162
|
-
|
|
3163
|
-
|
|
3172
|
+
o.colIndex,
|
|
3173
|
+
o.x,
|
|
3164
3174
|
this.y,
|
|
3165
|
-
|
|
3175
|
+
o.width,
|
|
3166
3176
|
this.height,
|
|
3167
|
-
|
|
3177
|
+
o.column,
|
|
3168
3178
|
this.data,
|
|
3169
3179
|
this.rowType
|
|
3170
3180
|
);
|
|
3171
|
-
|
|
3181
|
+
r.fixed ? i.push(r) : s.push(r), e.push(r);
|
|
3172
3182
|
}), this.cells = e, this.fixedCells = i, this.noFixedCells = s;
|
|
3173
3183
|
}
|
|
3174
3184
|
drawCenter() {
|
|
@@ -3222,11 +3232,11 @@ class ai {
|
|
|
3222
3232
|
database: i,
|
|
3223
3233
|
config: {
|
|
3224
3234
|
FOOTER_FIXED: s,
|
|
3225
|
-
SCROLLER_TRACK_SIZE:
|
|
3226
|
-
BORDER_COLOR:
|
|
3235
|
+
SCROLLER_TRACK_SIZE: o = 0,
|
|
3236
|
+
BORDER_COLOR: r,
|
|
3227
3237
|
BORDER_RADIUS: n,
|
|
3228
|
-
HEIGHT:
|
|
3229
|
-
EMPTY_BODY_HEIGHT:
|
|
3238
|
+
HEIGHT: h,
|
|
3239
|
+
EMPTY_BODY_HEIGHT: l = 0,
|
|
3230
3240
|
MAX_HEIGHT: f = 0,
|
|
3231
3241
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3232
3242
|
OFFSET_HEIGHT: x = 0
|
|
@@ -3238,9 +3248,9 @@ class ai {
|
|
|
3238
3248
|
const { data: u, sumHeight: y } = i.getData();
|
|
3239
3249
|
this.height = y, this.data = u;
|
|
3240
3250
|
const { top: g } = t.getBoundingClientRect();
|
|
3241
|
-
this.width = e.width, this.visibleWidth = t.width -
|
|
3251
|
+
this.width = e.width, this.visibleWidth = t.width - o;
|
|
3242
3252
|
const w = this.ctx.footer.height;
|
|
3243
|
-
this.data.length || (this.height =
|
|
3253
|
+
this.data.length || (this.height = l);
|
|
3244
3254
|
const p = this.data.length ? "not-empty" : "empty";
|
|
3245
3255
|
this.ctx.emit("emptyChange", {
|
|
3246
3256
|
isEmpty: p,
|
|
@@ -3249,18 +3259,18 @@ class ai {
|
|
|
3249
3259
|
bodyHeight: this.height,
|
|
3250
3260
|
footerHeight: w,
|
|
3251
3261
|
width: this.width,
|
|
3252
|
-
height: this.data.length ? 0 :
|
|
3262
|
+
height: this.data.length ? 0 : l + w
|
|
3253
3263
|
});
|
|
3254
|
-
let E = this.height + e.height +
|
|
3264
|
+
let E = this.height + e.height + o;
|
|
3255
3265
|
E += w;
|
|
3256
3266
|
let m = 0;
|
|
3257
3267
|
this.data.length && d ? (m = window.innerHeight - g - x, m < 0 && (m = 32, console.error(
|
|
3258
3268
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3259
|
-
))) : this.data.length &&
|
|
3260
|
-
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;
|
|
3261
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(
|
|
3262
3272
|
"style",
|
|
3263
|
-
`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;`
|
|
3264
3274
|
);
|
|
3265
3275
|
}
|
|
3266
3276
|
// 调整行的高度
|
|
@@ -3277,37 +3287,37 @@ class ai {
|
|
|
3277
3287
|
}), this.ctx.on("mousemove", (e) => {
|
|
3278
3288
|
if (this.ctx.editing) return;
|
|
3279
3289
|
const i = e.offsetY, s = e.offsetX, {
|
|
3280
|
-
target:
|
|
3281
|
-
scrollY:
|
|
3290
|
+
target: o,
|
|
3291
|
+
scrollY: r,
|
|
3282
3292
|
config: { RESIZE_ROW_MIN_HEIGHT: n = 0 }
|
|
3283
3293
|
} = this.ctx;
|
|
3284
3294
|
if (this.isResizing && this.resizeTarget) {
|
|
3285
|
-
const
|
|
3286
|
-
let
|
|
3287
|
-
|
|
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");
|
|
3288
3298
|
} else {
|
|
3289
3299
|
if (this.resizeTarget = null, this.isMouseDown || this.ctx.target.style.cursor === "crosshair")
|
|
3290
3300
|
return;
|
|
3291
3301
|
this.ctx.target.style.cursor === "row-resize" && (this.ctx.target.style.cursor = "default");
|
|
3292
|
-
for (let
|
|
3293
|
-
const
|
|
3294
|
-
if (i >
|
|
3295
|
-
for (let d = 0; d <
|
|
3296
|
-
const x =
|
|
3297
|
-
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);
|
|
3298
3308
|
}
|
|
3299
3309
|
}
|
|
3300
3310
|
}
|
|
3301
3311
|
}));
|
|
3302
3312
|
}
|
|
3303
3313
|
resizeRow(t, e) {
|
|
3304
|
-
const { rowIndex: i, height: s, rowKey:
|
|
3314
|
+
const { rowIndex: i, height: s, rowKey: o, data: r } = t;
|
|
3305
3315
|
this.ctx.database.setRowHeight(i, s + e), this.init(), this.ctx.emit("draw"), this.ctx.emit("resizeRowChange", {
|
|
3306
3316
|
rowIndex: i,
|
|
3307
3317
|
oldHeight: s,
|
|
3308
3318
|
height: s + e,
|
|
3309
|
-
rowKey:
|
|
3310
|
-
row:
|
|
3319
|
+
rowKey: o,
|
|
3320
|
+
row: r,
|
|
3311
3321
|
data: this.data
|
|
3312
3322
|
});
|
|
3313
3323
|
}
|
|
@@ -3317,7 +3327,7 @@ class ai {
|
|
|
3317
3327
|
target: t,
|
|
3318
3328
|
scrollY: e,
|
|
3319
3329
|
config: { RESIZE_ROW_LINE_COLOR: i }
|
|
3320
|
-
} = 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];
|
|
3321
3331
|
this.ctx.paint.drawLine(n, {
|
|
3322
3332
|
borderColor: i,
|
|
3323
3333
|
borderWidth: 1
|
|
@@ -3330,19 +3340,19 @@ class ai {
|
|
|
3330
3340
|
fixedRightWidth: e,
|
|
3331
3341
|
scrollX: i,
|
|
3332
3342
|
header: s,
|
|
3333
|
-
target:
|
|
3334
|
-
config: { HEADER_BG_COLOR:
|
|
3343
|
+
target: o,
|
|
3344
|
+
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: n }
|
|
3335
3345
|
} = this.ctx;
|
|
3336
3346
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
3337
|
-
fillColor:
|
|
3347
|
+
fillColor: r,
|
|
3338
3348
|
side: "right",
|
|
3339
3349
|
shadowWidth: 4,
|
|
3340
3350
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3341
3351
|
colorEnd: "rgba(0,0,0,0)"
|
|
3342
3352
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3343
|
-
const
|
|
3344
|
-
this.ctx.paint.drawShadow(
|
|
3345
|
-
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,
|
|
3346
3356
|
side: "left",
|
|
3347
3357
|
shadowWidth: 4,
|
|
3348
3358
|
colorStart: "rgba(0,0,0,0)",
|
|
@@ -3351,28 +3361,28 @@ class ai {
|
|
|
3351
3361
|
}
|
|
3352
3362
|
}
|
|
3353
3363
|
binarySearch(t, e) {
|
|
3354
|
-
let i = 0, s = t.length - 1,
|
|
3364
|
+
let i = 0, s = t.length - 1, o = -1;
|
|
3355
3365
|
for (; i <= s; ) {
|
|
3356
|
-
let
|
|
3366
|
+
let r = Math.floor((i + s) / 2), n = t[r].bottom;
|
|
3357
3367
|
if (n === e)
|
|
3358
|
-
return
|
|
3359
|
-
n < e ? i =
|
|
3368
|
+
return r;
|
|
3369
|
+
n < e ? i = r + 1 : (o = r, s = r - 1);
|
|
3360
3370
|
}
|
|
3361
|
-
return
|
|
3371
|
+
return o;
|
|
3362
3372
|
}
|
|
3363
3373
|
update() {
|
|
3364
3374
|
this.init();
|
|
3365
|
-
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data:
|
|
3366
|
-
this.ctx.maxRowIndex =
|
|
3367
|
-
const n = this.binarySearch(
|
|
3368
|
-
let
|
|
3369
|
-
|
|
3370
|
-
const
|
|
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 = [];
|
|
3371
3381
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3372
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);
|
|
3373
|
-
|
|
3383
|
+
l.push(g);
|
|
3374
3384
|
}
|
|
3375
|
-
this.renderRows =
|
|
3385
|
+
this.renderRows = l, this.ctx.body.renderRows = l;
|
|
3376
3386
|
}
|
|
3377
3387
|
draw() {
|
|
3378
3388
|
this.renderRows.forEach((t) => {
|
|
@@ -3400,9 +3410,9 @@ class ci {
|
|
|
3400
3410
|
const {
|
|
3401
3411
|
header: t,
|
|
3402
3412
|
body: e,
|
|
3403
|
-
config: { CELL_FOOTER_HEIGHT: i, FOOTER_FIXED: s, SCROLLER_TRACK_SIZE:
|
|
3413
|
+
config: { CELL_FOOTER_HEIGHT: i, FOOTER_FIXED: s, SCROLLER_TRACK_SIZE: o }
|
|
3404
3414
|
} = this.ctx;
|
|
3405
|
-
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;
|
|
3406
3416
|
}
|
|
3407
3417
|
drawFiexShadow() {
|
|
3408
3418
|
const {
|
|
@@ -3410,20 +3420,20 @@ class ci {
|
|
|
3410
3420
|
fixedRightWidth: e,
|
|
3411
3421
|
scrollX: i,
|
|
3412
3422
|
header: s,
|
|
3413
|
-
target:
|
|
3414
|
-
config: { HEADER_BG_COLOR:
|
|
3423
|
+
target: o,
|
|
3424
|
+
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: n }
|
|
3415
3425
|
} = this.ctx;
|
|
3416
|
-
let
|
|
3417
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3418
|
-
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,
|
|
3419
3429
|
side: "right",
|
|
3420
3430
|
shadowWidth: 4,
|
|
3421
3431
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3422
3432
|
colorEnd: "rgba(0,0,0,0)"
|
|
3423
3433
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3424
|
-
const
|
|
3425
|
-
this.ctx.paint.drawShadow(
|
|
3426
|
-
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,
|
|
3427
3437
|
side: "left",
|
|
3428
3438
|
shadowWidth: 4,
|
|
3429
3439
|
colorStart: "rgba(0,0,0,0)",
|
|
@@ -3436,10 +3446,10 @@ class ci {
|
|
|
3436
3446
|
const { CELL_FOOTER_HEIGHT: t } = this.ctx.config;
|
|
3437
3447
|
let e = this.y;
|
|
3438
3448
|
const i = [];
|
|
3439
|
-
this.data.forEach((s,
|
|
3440
|
-
const
|
|
3449
|
+
this.data.forEach((s, o) => {
|
|
3450
|
+
const r = new ee(
|
|
3441
3451
|
this.ctx,
|
|
3442
|
-
|
|
3452
|
+
o,
|
|
3443
3453
|
0,
|
|
3444
3454
|
e,
|
|
3445
3455
|
this.width,
|
|
@@ -3447,7 +3457,7 @@ class ci {
|
|
|
3447
3457
|
s,
|
|
3448
3458
|
"footer"
|
|
3449
3459
|
);
|
|
3450
|
-
e += t, i.push(
|
|
3460
|
+
e += t, i.push(r);
|
|
3451
3461
|
}), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
|
|
3452
3462
|
}
|
|
3453
3463
|
draw() {
|
|
@@ -3458,7 +3468,7 @@ class ci {
|
|
|
3458
3468
|
});
|
|
3459
3469
|
}
|
|
3460
3470
|
}
|
|
3461
|
-
class
|
|
3471
|
+
class hi {
|
|
3462
3472
|
// 垂直滚动定时器
|
|
3463
3473
|
constructor(t) {
|
|
3464
3474
|
c(this, "isCut", !1);
|
|
@@ -3480,7 +3490,7 @@ class li {
|
|
|
3480
3490
|
}, 100)
|
|
3481
3491
|
), this.ctx.on("cellHoverChange", (t) => {
|
|
3482
3492
|
if (!this.ctx.autofillMove) {
|
|
3483
|
-
if (
|
|
3493
|
+
if (t.operation) {
|
|
3484
3494
|
this.selectRows(t, !1);
|
|
3485
3495
|
return;
|
|
3486
3496
|
}
|
|
@@ -3488,7 +3498,7 @@ class li {
|
|
|
3488
3498
|
}
|
|
3489
3499
|
}), this.ctx.on("cellMousedown", (t, e) => {
|
|
3490
3500
|
if (this.ctx.isTarget(e.target) && this.ctx.target.style.cursor !== "pointer" && !this.ctx.isPointer && this.ctx.target.style.cursor !== "crosshair") {
|
|
3491
|
-
if (
|
|
3501
|
+
if (t.operation) {
|
|
3492
3502
|
this.isMultipleRow = !0, this.selectRows(t);
|
|
3493
3503
|
return;
|
|
3494
3504
|
}
|
|
@@ -3550,37 +3560,44 @@ class li {
|
|
|
3550
3560
|
}
|
|
3551
3561
|
setSelector(t, e) {
|
|
3552
3562
|
const { ENABLE_SELECTOR_SPAN_COL: i, ENABLE_SELECTOR_SPAN_ROW: s } = this.ctx.config;
|
|
3553
|
-
let
|
|
3563
|
+
let o = t, r = e;
|
|
3554
3564
|
if (!s) {
|
|
3565
|
+
const [n] = r;
|
|
3566
|
+
r = [n, n];
|
|
3567
|
+
}
|
|
3568
|
+
if (!i) {
|
|
3555
3569
|
const [n] = o;
|
|
3556
3570
|
o = [n, n];
|
|
3557
3571
|
}
|
|
3558
|
-
if (
|
|
3559
|
-
|
|
3560
|
-
|
|
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");
|
|
3561
3579
|
}
|
|
3562
|
-
(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"));
|
|
3563
3580
|
}
|
|
3564
3581
|
selectCols(t) {
|
|
3565
3582
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE || !this.ctx.config.ENABLE_SELECTOR_ALL_ROWS || this.ctx.autofillMove || this.ctx.columnResizing)
|
|
3566
3583
|
return;
|
|
3567
|
-
if (
|
|
3584
|
+
if (t.operation) {
|
|
3568
3585
|
this.selectAll();
|
|
3569
3586
|
return;
|
|
3570
3587
|
}
|
|
3571
|
-
const e =
|
|
3588
|
+
const { SELECTOR_AREA_MIN_Y: e, SELECTOR_AREA_MAX_Y: i } = this.ctx.config, s = e, o = i || this.ctx.maxRowIndex;
|
|
3572
3589
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3573
|
-
const { colIndex:
|
|
3574
|
-
if (t.colIndex >=
|
|
3575
|
-
const
|
|
3576
|
-
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);
|
|
3577
3594
|
} else {
|
|
3578
|
-
const
|
|
3579
|
-
this.setSelector(
|
|
3595
|
+
const n = [t.colIndex, r], h = [s, o];
|
|
3596
|
+
this.setSelector(n, h);
|
|
3580
3597
|
}
|
|
3581
3598
|
} else {
|
|
3582
|
-
const
|
|
3583
|
-
this.setSelector(
|
|
3599
|
+
const r = [t.colIndex, t.colIndex + t.colspan - 1], n = [s, o];
|
|
3600
|
+
this.setSelector(r, n);
|
|
3584
3601
|
}
|
|
3585
3602
|
}
|
|
3586
3603
|
selectAll() {
|
|
@@ -3588,27 +3605,27 @@ class li {
|
|
|
3588
3605
|
return;
|
|
3589
3606
|
const { ENABLE_SELECTOR_ALL_ROWS: t, ENABLE_SELECTOR_ALL_COLS: e } = this.ctx.config;
|
|
3590
3607
|
if (t && e) {
|
|
3591
|
-
const s = this.ctx.
|
|
3592
|
-
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);
|
|
3593
3610
|
}
|
|
3594
3611
|
}
|
|
3595
3612
|
selectRows(t, e = !0) {
|
|
3596
3613
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE || !this.ctx.config.ENABLE_SELECTOR_ALL_COLS || this.ctx.autofillMove)
|
|
3597
3614
|
return;
|
|
3598
|
-
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;
|
|
3599
3616
|
if (e) {
|
|
3600
3617
|
this.ctx.setFocusCell(t);
|
|
3601
|
-
const
|
|
3602
|
-
this.setSelector(
|
|
3618
|
+
const n = [r, o], h = [t.rowIndex, t.rowIndex];
|
|
3619
|
+
this.setSelector(n, h);
|
|
3603
3620
|
}
|
|
3604
3621
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3605
|
-
const { rowIndex:
|
|
3606
|
-
if (t.rowIndex >=
|
|
3607
|
-
const
|
|
3608
|
-
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);
|
|
3609
3626
|
} else {
|
|
3610
|
-
const
|
|
3611
|
-
this.setSelector(
|
|
3627
|
+
const h = [r, o], l = [t.rowIndex, n];
|
|
3628
|
+
this.setSelector(h, l);
|
|
3612
3629
|
}
|
|
3613
3630
|
}
|
|
3614
3631
|
}
|
|
@@ -3617,7 +3634,7 @@ class li {
|
|
|
3617
3634
|
return;
|
|
3618
3635
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3619
3636
|
if (t && e && i) {
|
|
3620
|
-
const { rowIndex: s, colIndex:
|
|
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];
|
|
3621
3638
|
this.setSelector(f, d);
|
|
3622
3639
|
}
|
|
3623
3640
|
}
|
|
@@ -3625,12 +3642,12 @@ class li {
|
|
|
3625
3642
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3626
3643
|
if (e)
|
|
3627
3644
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3628
|
-
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];
|
|
3629
3646
|
this.setSelector(x, u);
|
|
3630
3647
|
} else {
|
|
3631
3648
|
this.ctx.emit("cellSelectedClick", e);
|
|
3632
|
-
const s = [e.colIndex, e.colIndex],
|
|
3633
|
-
this.setSelector(s,
|
|
3649
|
+
const s = [e.colIndex, e.colIndex], o = [e.rowIndex, e.rowIndex];
|
|
3650
|
+
this.setSelector(s, o), this.adjustBoundaryPosition();
|
|
3634
3651
|
}
|
|
3635
3652
|
}
|
|
3636
3653
|
clearCopyLine() {
|
|
@@ -3643,8 +3660,8 @@ class li {
|
|
|
3643
3660
|
* @returns
|
|
3644
3661
|
*/
|
|
3645
3662
|
getCell(t, e) {
|
|
3646
|
-
const i = this.ctx.body.renderRows.find((
|
|
3647
|
-
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);
|
|
3648
3665
|
}
|
|
3649
3666
|
/**
|
|
3650
3667
|
* 复制
|
|
@@ -3660,13 +3677,13 @@ class li {
|
|
|
3660
3677
|
}
|
|
3661
3678
|
clearSelectedData(t, e, i = !1) {
|
|
3662
3679
|
let s = [];
|
|
3663
|
-
const
|
|
3680
|
+
const o = /* @__PURE__ */ new Set();
|
|
3664
3681
|
for (let n = 0; n <= e[1] - e[0]; n++)
|
|
3665
|
-
for (let
|
|
3666
|
-
const
|
|
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);
|
|
3667
3684
|
if (d) {
|
|
3668
3685
|
const { rowKey: x, key: u } = d;
|
|
3669
|
-
this.ctx.database.getReadonly(x, u) || (
|
|
3686
|
+
this.ctx.database.getReadonly(x, u) || (o.add(x), s.push({
|
|
3670
3687
|
rowKey: x,
|
|
3671
3688
|
key: u,
|
|
3672
3689
|
value: null,
|
|
@@ -3680,10 +3697,10 @@ class li {
|
|
|
3680
3697
|
if (i)
|
|
3681
3698
|
return s;
|
|
3682
3699
|
this.ctx.database.batchSetItemValue(s, !0);
|
|
3683
|
-
let
|
|
3684
|
-
return
|
|
3685
|
-
|
|
3686
|
-
}), 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;
|
|
3687
3704
|
}
|
|
3688
3705
|
paste() {
|
|
3689
3706
|
if (!navigator.clipboard) {
|
|
@@ -3693,22 +3710,22 @@ class li {
|
|
|
3693
3710
|
const { ENABLE_PASTER: t } = this.ctx.config;
|
|
3694
3711
|
if (this.ctx.selector.enable && t) {
|
|
3695
3712
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
3696
|
-
navigator.clipboard.readText().then((
|
|
3697
|
-
let
|
|
3698
|
-
const n =
|
|
3699
|
-
n.length === 1 ?
|
|
3700
|
-
`).map((d) => d.split(" ")) :
|
|
3701
|
-
let
|
|
3702
|
-
for (let f = 0; f <=
|
|
3703
|
-
const d =
|
|
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;
|
|
3704
3721
|
for (let x = 0; x <= d - 1; x++) {
|
|
3705
|
-
const u = f + e, y = x + i, g =
|
|
3722
|
+
const u = f + e, y = x + i, g = r[f][x], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3706
3723
|
u,
|
|
3707
3724
|
y
|
|
3708
3725
|
);
|
|
3709
3726
|
if (w) {
|
|
3710
3727
|
const { rowKey: p, key: E } = w;
|
|
3711
|
-
this.ctx.database.getReadonly(p, E) || (s.add(p),
|
|
3728
|
+
this.ctx.database.getReadonly(p, E) || (s.add(p), h.push({
|
|
3712
3729
|
rowKey: p,
|
|
3713
3730
|
key: E,
|
|
3714
3731
|
value: g,
|
|
@@ -3724,20 +3741,20 @@ class li {
|
|
|
3724
3741
|
this.ctx.selector.yArrCopy,
|
|
3725
3742
|
!0
|
|
3726
3743
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3727
|
-
), d =
|
|
3744
|
+
), d = h.map((x) => `${x.rowKey}-${x.key}`);
|
|
3728
3745
|
f.forEach((x) => {
|
|
3729
|
-
d.includes(`${x.rowKey}-${x.key}`) ||
|
|
3746
|
+
d.includes(`${x.rowKey}-${x.key}`) || h.unshift(x);
|
|
3730
3747
|
}), this.isCut = !1;
|
|
3731
3748
|
}
|
|
3732
|
-
if (!
|
|
3749
|
+
if (!h.length)
|
|
3733
3750
|
return;
|
|
3734
|
-
this.ctx.database.batchSetItemValue(
|
|
3735
|
-
let
|
|
3751
|
+
this.ctx.database.batchSetItemValue(h, !0);
|
|
3752
|
+
let l = [];
|
|
3736
3753
|
s.forEach((f) => {
|
|
3737
|
-
|
|
3738
|
-
}), this.ctx.emit("pasteChange",
|
|
3739
|
-
}).catch((
|
|
3740
|
-
console.error("获取剪贴板内容失败:",
|
|
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);
|
|
3741
3758
|
});
|
|
3742
3759
|
}
|
|
3743
3760
|
}
|
|
@@ -3751,28 +3768,28 @@ class li {
|
|
|
3751
3768
|
if (!e)
|
|
3752
3769
|
return;
|
|
3753
3770
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3754
|
-
const
|
|
3771
|
+
const o = 0, r = 0, n = this.ctx.maxColIndex, h = this.ctx.maxRowIndex;
|
|
3755
3772
|
switch (t) {
|
|
3756
3773
|
case "LEFT":
|
|
3757
|
-
i >
|
|
3774
|
+
i > o && i--;
|
|
3758
3775
|
break;
|
|
3759
3776
|
case "TOP":
|
|
3760
|
-
s >
|
|
3777
|
+
s > r && s--;
|
|
3761
3778
|
break;
|
|
3762
3779
|
case "RIGHT":
|
|
3763
3780
|
i < n && i++;
|
|
3764
3781
|
break;
|
|
3765
3782
|
case "BOTTOM":
|
|
3766
|
-
s <
|
|
3783
|
+
s < h && s++;
|
|
3767
3784
|
break;
|
|
3768
3785
|
}
|
|
3769
|
-
const
|
|
3786
|
+
const l = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
3770
3787
|
if (d) {
|
|
3771
|
-
if (
|
|
3788
|
+
if (d.operation)
|
|
3772
3789
|
return;
|
|
3773
3790
|
this.ctx.setFocusCell(d);
|
|
3774
3791
|
}
|
|
3775
|
-
this.setSelector(
|
|
3792
|
+
this.setSelector(l, f), this.adjustBoundaryPosition(), this.ctx.emit("draw");
|
|
3776
3793
|
}
|
|
3777
3794
|
stopAdjustPosition() {
|
|
3778
3795
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3782,23 +3799,23 @@ class li {
|
|
|
3782
3799
|
*/
|
|
3783
3800
|
startAdjustPosition(t) {
|
|
3784
3801
|
const { offsetX: e, offsetY: i } = t;
|
|
3785
|
-
let s = "",
|
|
3786
|
-
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) {
|
|
3787
3804
|
this.adjustPositionX = s;
|
|
3788
3805
|
let n = 10 * (s === "left" ? -1 : 1);
|
|
3789
3806
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3790
3807
|
n *= 1.5;
|
|
3791
|
-
const { scrollX:
|
|
3792
|
-
(
|
|
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);
|
|
3793
3810
|
}, 100);
|
|
3794
3811
|
}
|
|
3795
|
-
if (
|
|
3796
|
-
this.adjustPositionY =
|
|
3797
|
-
let n = 10 * (
|
|
3812
|
+
if (o && this.adjustPositionY !== o) {
|
|
3813
|
+
this.adjustPositionY = o;
|
|
3814
|
+
let n = 10 * (o === "top" ? -1 : 1);
|
|
3798
3815
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3799
3816
|
n *= 1.5;
|
|
3800
|
-
const { scrollY:
|
|
3801
|
-
(
|
|
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);
|
|
3802
3819
|
}, 100);
|
|
3803
3820
|
}
|
|
3804
3821
|
}
|
|
@@ -3806,20 +3823,20 @@ class li {
|
|
|
3806
3823
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
3807
3824
|
*/
|
|
3808
3825
|
adjustBoundaryPosition() {
|
|
3809
|
-
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;
|
|
3810
3827
|
if (!e)
|
|
3811
3828
|
return;
|
|
3812
|
-
const { SCROLLER_TRACK_SIZE:
|
|
3829
|
+
const { SCROLLER_TRACK_SIZE: l = 0, FOOTER_FIXED: f } = this.ctx.config;
|
|
3813
3830
|
let d = 0;
|
|
3814
|
-
f && (d =
|
|
3815
|
-
const x = s - e.drawX + 1, u = e.drawX + e.width - (t.width - i) + 1, y =
|
|
3816
|
-
u > 0 && !e.fixed ? this.ctx.setScrollX(n + u) : x > 0 && !e.fixed && this.ctx.setScrollX(n - x), y > 0 ? this.ctx.setScrollY(
|
|
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);
|
|
3817
3834
|
}
|
|
3818
3835
|
destroy() {
|
|
3819
3836
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
3820
3837
|
}
|
|
3821
3838
|
}
|
|
3822
|
-
class
|
|
3839
|
+
class li {
|
|
3823
3840
|
constructor(t) {
|
|
3824
3841
|
c(this, "ctx");
|
|
3825
3842
|
this.ctx = t, this.init();
|
|
@@ -3827,9 +3844,9 @@ class hi {
|
|
|
3827
3844
|
init() {
|
|
3828
3845
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3829
3846
|
this.ctx.target.style.cursor === "crosshair" && (this.ctx.target.style.cursor = "default");
|
|
3830
|
-
const { xArr: i, yArr: s } = this.ctx.selector,
|
|
3831
|
-
if (this.ctx.config.ENABLE_AUTOFILL && n ===
|
|
3832
|
-
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;
|
|
3833
3850
|
e.offsetX > y && e.offsetY > g && (this.ctx.target.style.cursor = "crosshair");
|
|
3834
3851
|
}
|
|
3835
3852
|
this.mouseenter(t);
|
|
@@ -3856,23 +3873,25 @@ class hi {
|
|
|
3856
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];
|
|
3857
3874
|
}
|
|
3858
3875
|
setAutofill(t, e) {
|
|
3859
|
-
const {
|
|
3860
|
-
ENABLE_AUTOFILL: i,
|
|
3861
|
-
ENABLE_SELECTOR_SPAN_COL: s,
|
|
3862
|
-
ENABLE_SELECTOR_SPAN_ROW: r
|
|
3863
|
-
} = this.ctx.config;
|
|
3876
|
+
const { ENABLE_AUTOFILL: i, ENABLE_SELECTOR_SPAN_COL: s, ENABLE_SELECTOR_SPAN_ROW: o } = this.ctx.config;
|
|
3864
3877
|
if (!i)
|
|
3865
3878
|
return;
|
|
3866
|
-
let
|
|
3867
|
-
if (!
|
|
3868
|
-
const [
|
|
3869
|
-
n = [
|
|
3879
|
+
let r = t, n = e;
|
|
3880
|
+
if (!o) {
|
|
3881
|
+
const [h] = n;
|
|
3882
|
+
n = [h, h];
|
|
3870
3883
|
}
|
|
3871
3884
|
if (!s) {
|
|
3872
|
-
const [
|
|
3873
|
-
|
|
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");
|
|
3874
3894
|
}
|
|
3875
|
-
(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"));
|
|
3876
3895
|
}
|
|
3877
3896
|
/**
|
|
3878
3897
|
* 填充数据
|
|
@@ -3884,17 +3903,14 @@ class hi {
|
|
|
3884
3903
|
const u = d + e.yArr[0], y = x + e.xArr[0];
|
|
3885
3904
|
i.set(`${u}-${y}`, !0);
|
|
3886
3905
|
}
|
|
3887
|
-
const { value: s } = e,
|
|
3888
|
-
let
|
|
3889
|
-
for (let d = 0; d <=
|
|
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++)
|
|
3890
3909
|
for (let x = 0; x <= n[1] - n[0]; x++) {
|
|
3891
|
-
const u = x + n[0], y = d +
|
|
3892
|
-
y,
|
|
3893
|
-
u
|
|
3894
|
-
), 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}`;
|
|
3895
3911
|
if (w && !i.has(p)) {
|
|
3896
3912
|
const { rowKey: E, key: m } = w;
|
|
3897
|
-
this.ctx.database.getReadonly(E, m) || (t.add(E),
|
|
3913
|
+
this.ctx.database.getReadonly(E, m) || (t.add(E), l.push({
|
|
3898
3914
|
rowKey: E,
|
|
3899
3915
|
key: m,
|
|
3900
3916
|
value: g,
|
|
@@ -3902,21 +3918,21 @@ class hi {
|
|
|
3902
3918
|
}));
|
|
3903
3919
|
}
|
|
3904
3920
|
}
|
|
3905
|
-
if (!
|
|
3921
|
+
if (!l.length)
|
|
3906
3922
|
return;
|
|
3907
|
-
this.ctx.database.batchSetItemValue(
|
|
3923
|
+
this.ctx.database.batchSetItemValue(l, !0);
|
|
3908
3924
|
let f = [];
|
|
3909
3925
|
t.forEach((d) => {
|
|
3910
3926
|
f.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
3911
|
-
}), this.ctx.emit("autofillChange",
|
|
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");
|
|
3912
3928
|
}
|
|
3913
3929
|
mouseenter(t) {
|
|
3914
3930
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
3915
3931
|
return;
|
|
3916
3932
|
const { selector: e, autofill: i } = this.ctx;
|
|
3917
3933
|
if (this.ctx.mousedown && e.enable && i.enable) {
|
|
3918
|
-
const { rowIndex: s, colIndex:
|
|
3919
|
-
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);
|
|
3920
3936
|
}
|
|
3921
3937
|
}
|
|
3922
3938
|
destroy() {
|
|
@@ -3934,7 +3950,7 @@ const rt = Math.min, U = Math.max, ft = Math.round, V = (a) => ({
|
|
|
3934
3950
|
start: "end",
|
|
3935
3951
|
end: "start"
|
|
3936
3952
|
};
|
|
3937
|
-
function
|
|
3953
|
+
function _t(a, t, e) {
|
|
3938
3954
|
return U(a, rt(t, e));
|
|
3939
3955
|
}
|
|
3940
3956
|
function at(a, t) {
|
|
@@ -3949,45 +3965,45 @@ function ct(a) {
|
|
|
3949
3965
|
function ie(a) {
|
|
3950
3966
|
return a === "x" ? "y" : "x";
|
|
3951
3967
|
}
|
|
3952
|
-
function
|
|
3968
|
+
function Mt(a) {
|
|
3953
3969
|
return a === "y" ? "height" : "width";
|
|
3954
3970
|
}
|
|
3955
3971
|
function J(a) {
|
|
3956
3972
|
return ["top", "bottom"].includes(q(a)) ? "y" : "x";
|
|
3957
3973
|
}
|
|
3958
|
-
function
|
|
3974
|
+
function Ht(a) {
|
|
3959
3975
|
return ie(J(a));
|
|
3960
3976
|
}
|
|
3961
3977
|
function xi(a, t, e) {
|
|
3962
3978
|
e === void 0 && (e = !1);
|
|
3963
|
-
const i = ct(a), s =
|
|
3964
|
-
let
|
|
3965
|
-
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)];
|
|
3966
3982
|
}
|
|
3967
3983
|
function ui(a) {
|
|
3968
3984
|
const t = xt(a);
|
|
3969
|
-
return [
|
|
3985
|
+
return [Ot(a), t, Ot(t)];
|
|
3970
3986
|
}
|
|
3971
|
-
function
|
|
3987
|
+
function Ot(a) {
|
|
3972
3988
|
return a.replace(/start|end/g, (t) => fi[t]);
|
|
3973
3989
|
}
|
|
3974
3990
|
function gi(a, t, e) {
|
|
3975
|
-
const i = ["left", "right"], s = ["right", "left"],
|
|
3991
|
+
const i = ["left", "right"], s = ["right", "left"], o = ["top", "bottom"], r = ["bottom", "top"];
|
|
3976
3992
|
switch (a) {
|
|
3977
3993
|
case "top":
|
|
3978
3994
|
case "bottom":
|
|
3979
3995
|
return e ? t ? s : i : t ? i : s;
|
|
3980
3996
|
case "left":
|
|
3981
3997
|
case "right":
|
|
3982
|
-
return t ?
|
|
3998
|
+
return t ? o : r;
|
|
3983
3999
|
default:
|
|
3984
4000
|
return [];
|
|
3985
4001
|
}
|
|
3986
4002
|
}
|
|
3987
4003
|
function wi(a, t, e, i) {
|
|
3988
4004
|
const s = ct(a);
|
|
3989
|
-
let
|
|
3990
|
-
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;
|
|
3991
4007
|
}
|
|
3992
4008
|
function xt(a) {
|
|
3993
4009
|
return a.replace(/left|right|bottom|top/g, (t) => di[t]);
|
|
@@ -4032,9 +4048,9 @@ function Pt(a, t, e) {
|
|
|
4032
4048
|
reference: i,
|
|
4033
4049
|
floating: s
|
|
4034
4050
|
} = a;
|
|
4035
|
-
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;
|
|
4036
4052
|
let u;
|
|
4037
|
-
switch (
|
|
4053
|
+
switch (h) {
|
|
4038
4054
|
case "top":
|
|
4039
4055
|
u = {
|
|
4040
4056
|
x: f,
|
|
@@ -4067,10 +4083,10 @@ function Pt(a, t, e) {
|
|
|
4067
4083
|
}
|
|
4068
4084
|
switch (ct(t)) {
|
|
4069
4085
|
case "start":
|
|
4070
|
-
u[
|
|
4086
|
+
u[r] -= x * (e && l ? -1 : 1);
|
|
4071
4087
|
break;
|
|
4072
4088
|
case "end":
|
|
4073
|
-
u[
|
|
4089
|
+
u[r] += x * (e && l ? -1 : 1);
|
|
4074
4090
|
break;
|
|
4075
4091
|
}
|
|
4076
4092
|
return u;
|
|
@@ -4079,17 +4095,17 @@ const yi = async (a, t, e) => {
|
|
|
4079
4095
|
const {
|
|
4080
4096
|
placement: i = "bottom",
|
|
4081
4097
|
strategy: s = "absolute",
|
|
4082
|
-
middleware:
|
|
4083
|
-
platform:
|
|
4084
|
-
} = e, n =
|
|
4085
|
-
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({
|
|
4086
4102
|
reference: a,
|
|
4087
4103
|
floating: t,
|
|
4088
4104
|
strategy: s
|
|
4089
4105
|
}), {
|
|
4090
4106
|
x: f,
|
|
4091
4107
|
y: d
|
|
4092
|
-
} = Pt(
|
|
4108
|
+
} = Pt(l, i, h), x = i, u = {}, y = 0;
|
|
4093
4109
|
for (let g = 0; g < n.length; g++) {
|
|
4094
4110
|
const {
|
|
4095
4111
|
name: w,
|
|
@@ -4106,8 +4122,8 @@ const yi = async (a, t, e) => {
|
|
|
4106
4122
|
placement: x,
|
|
4107
4123
|
strategy: s,
|
|
4108
4124
|
middlewareData: u,
|
|
4109
|
-
rects:
|
|
4110
|
-
platform:
|
|
4125
|
+
rects: l,
|
|
4126
|
+
platform: r,
|
|
4111
4127
|
elements: {
|
|
4112
4128
|
reference: a,
|
|
4113
4129
|
floating: t
|
|
@@ -4119,14 +4135,14 @@ const yi = async (a, t, e) => {
|
|
|
4119
4135
|
...u[w],
|
|
4120
4136
|
...b
|
|
4121
4137
|
}
|
|
4122
|
-
}, 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({
|
|
4123
4139
|
reference: a,
|
|
4124
4140
|
floating: t,
|
|
4125
4141
|
strategy: s
|
|
4126
4142
|
}) : C.rects), {
|
|
4127
4143
|
x: f,
|
|
4128
4144
|
y: d
|
|
4129
|
-
} = Pt(
|
|
4145
|
+
} = Pt(l, x, h)), g = -1);
|
|
4130
4146
|
}
|
|
4131
4147
|
return {
|
|
4132
4148
|
x: f,
|
|
@@ -4142,37 +4158,37 @@ async function re(a, t) {
|
|
|
4142
4158
|
const {
|
|
4143
4159
|
x: i,
|
|
4144
4160
|
y: s,
|
|
4145
|
-
platform:
|
|
4146
|
-
rects:
|
|
4161
|
+
platform: o,
|
|
4162
|
+
rects: r,
|
|
4147
4163
|
elements: n,
|
|
4148
|
-
strategy:
|
|
4164
|
+
strategy: h
|
|
4149
4165
|
} = a, {
|
|
4150
|
-
boundary:
|
|
4166
|
+
boundary: l = "clippingAncestors",
|
|
4151
4167
|
rootBoundary: f = "viewport",
|
|
4152
4168
|
elementContext: d = "floating",
|
|
4153
4169
|
altBoundary: x = !1,
|
|
4154
4170
|
padding: u = 0
|
|
4155
|
-
} = at(t, a), y = se(u), w = n[x ? d === "floating" ? "reference" : "floating" : d], p = ut(await
|
|
4156
|
-
element: (e = await (
|
|
4157
|
-
boundary:
|
|
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,
|
|
4158
4174
|
rootBoundary: f,
|
|
4159
|
-
strategy:
|
|
4175
|
+
strategy: h
|
|
4160
4176
|
})), E = d === "floating" ? {
|
|
4161
4177
|
x: i,
|
|
4162
4178
|
y: s,
|
|
4163
|
-
width:
|
|
4164
|
-
height:
|
|
4165
|
-
} :
|
|
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)) || {
|
|
4166
4182
|
x: 1,
|
|
4167
4183
|
y: 1
|
|
4168
4184
|
} : {
|
|
4169
4185
|
x: 1,
|
|
4170
4186
|
y: 1
|
|
4171
|
-
}, C = ut(
|
|
4187
|
+
}, C = ut(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4172
4188
|
elements: n,
|
|
4173
4189
|
rect: E,
|
|
4174
4190
|
offsetParent: m,
|
|
4175
|
-
strategy:
|
|
4191
|
+
strategy: h
|
|
4176
4192
|
}) : E);
|
|
4177
4193
|
return {
|
|
4178
4194
|
top: (p.top - C.top + y.top) / b.y,
|
|
@@ -4189,33 +4205,33 @@ const mi = (a) => ({
|
|
|
4189
4205
|
x: e,
|
|
4190
4206
|
y: i,
|
|
4191
4207
|
placement: s,
|
|
4192
|
-
rects:
|
|
4193
|
-
platform:
|
|
4208
|
+
rects: o,
|
|
4209
|
+
platform: r,
|
|
4194
4210
|
elements: n,
|
|
4195
|
-
middlewareData:
|
|
4211
|
+
middlewareData: h
|
|
4196
4212
|
} = t, {
|
|
4197
|
-
element:
|
|
4213
|
+
element: l,
|
|
4198
4214
|
padding: f = 0
|
|
4199
4215
|
} = at(a, t) || {};
|
|
4200
|
-
if (
|
|
4216
|
+
if (l == null)
|
|
4201
4217
|
return {};
|
|
4202
4218
|
const d = se(f), x = {
|
|
4203
4219
|
x: e,
|
|
4204
4220
|
y: i
|
|
4205
|
-
}, u =
|
|
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));
|
|
4206
4222
|
let T = R ? R[m] : 0;
|
|
4207
|
-
(!T || !await (
|
|
4208
|
-
const L = b / 2 - C / 2, A = T / 2 - g[y] / 2 - 1, D = rt(d[p], A), B = rt(d[E], A),
|
|
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;
|
|
4209
4225
|
return {
|
|
4210
|
-
[u]: x[u] +
|
|
4226
|
+
[u]: x[u] + F,
|
|
4211
4227
|
data: {
|
|
4212
4228
|
[u]: G,
|
|
4213
|
-
centerOffset:
|
|
4214
|
-
...
|
|
4215
|
-
alignmentOffset:
|
|
4229
|
+
centerOffset: O - G - F,
|
|
4230
|
+
...Y && {
|
|
4231
|
+
alignmentOffset: F
|
|
4216
4232
|
}
|
|
4217
4233
|
},
|
|
4218
|
-
reset:
|
|
4234
|
+
reset: Y
|
|
4219
4235
|
};
|
|
4220
4236
|
}
|
|
4221
4237
|
}), Ei = function(a) {
|
|
@@ -4226,11 +4242,11 @@ const mi = (a) => ({
|
|
|
4226
4242
|
var e, i;
|
|
4227
4243
|
const {
|
|
4228
4244
|
placement: s,
|
|
4229
|
-
middlewareData:
|
|
4230
|
-
rects:
|
|
4245
|
+
middlewareData: o,
|
|
4246
|
+
rects: r,
|
|
4231
4247
|
initialPlacement: n,
|
|
4232
|
-
platform:
|
|
4233
|
-
elements:
|
|
4248
|
+
platform: h,
|
|
4249
|
+
elements: l
|
|
4234
4250
|
} = t, {
|
|
4235
4251
|
mainAxis: f = !0,
|
|
4236
4252
|
crossAxis: d = !0,
|
|
@@ -4240,38 +4256,38 @@ const mi = (a) => ({
|
|
|
4240
4256
|
flipAlignment: g = !0,
|
|
4241
4257
|
...w
|
|
4242
4258
|
} = at(a, t);
|
|
4243
|
-
if ((e =
|
|
4259
|
+
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
4244
4260
|
return {};
|
|
4245
|
-
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";
|
|
4246
4262
|
!x && R && C.push(...wi(n, g, y, b));
|
|
4247
4263
|
const T = [n, ...C], L = await re(t, w), A = [];
|
|
4248
|
-
let D = ((i =
|
|
4264
|
+
let D = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
4249
4265
|
if (f && A.push(L[p]), d) {
|
|
4250
|
-
const
|
|
4251
|
-
A.push(L[
|
|
4266
|
+
const O = xi(s, r, b);
|
|
4267
|
+
A.push(L[O[0]], L[O[1]]);
|
|
4252
4268
|
}
|
|
4253
4269
|
if (D = [...D, {
|
|
4254
4270
|
placement: s,
|
|
4255
4271
|
overflows: A
|
|
4256
|
-
}], !A.every((
|
|
4257
|
-
var B,
|
|
4258
|
-
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];
|
|
4259
4275
|
if (G)
|
|
4260
4276
|
return {
|
|
4261
4277
|
data: {
|
|
4262
|
-
index:
|
|
4278
|
+
index: O,
|
|
4263
4279
|
overflows: D
|
|
4264
4280
|
},
|
|
4265
4281
|
reset: {
|
|
4266
4282
|
placement: G
|
|
4267
4283
|
}
|
|
4268
4284
|
};
|
|
4269
|
-
let
|
|
4270
|
-
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)
|
|
4271
4287
|
switch (u) {
|
|
4272
4288
|
case "bestFit": {
|
|
4273
4289
|
var S;
|
|
4274
|
-
const
|
|
4290
|
+
const F = (S = D.filter((W) => {
|
|
4275
4291
|
if (R) {
|
|
4276
4292
|
const P = J(W.placement);
|
|
4277
4293
|
return P === E || // Create a bias to the `y` side axis due to horizontal
|
|
@@ -4280,17 +4296,17 @@ const mi = (a) => ({
|
|
|
4280
4296
|
}
|
|
4281
4297
|
return !0;
|
|
4282
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];
|
|
4283
|
-
|
|
4299
|
+
F && (Y = F);
|
|
4284
4300
|
break;
|
|
4285
4301
|
}
|
|
4286
4302
|
case "initialPlacement":
|
|
4287
|
-
|
|
4303
|
+
Y = n;
|
|
4288
4304
|
break;
|
|
4289
4305
|
}
|
|
4290
|
-
if (s !==
|
|
4306
|
+
if (s !== Y)
|
|
4291
4307
|
return {
|
|
4292
4308
|
reset: {
|
|
4293
|
-
placement:
|
|
4309
|
+
placement: Y
|
|
4294
4310
|
}
|
|
4295
4311
|
};
|
|
4296
4312
|
}
|
|
@@ -4303,7 +4319,7 @@ async function bi(a, t) {
|
|
|
4303
4319
|
placement: e,
|
|
4304
4320
|
platform: i,
|
|
4305
4321
|
elements: s
|
|
4306
|
-
} = 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);
|
|
4307
4323
|
let {
|
|
4308
4324
|
mainAxis: x,
|
|
4309
4325
|
crossAxis: u,
|
|
@@ -4317,11 +4333,11 @@ async function bi(a, t) {
|
|
|
4317
4333
|
crossAxis: d.crossAxis || 0,
|
|
4318
4334
|
alignmentAxis: d.alignmentAxis
|
|
4319
4335
|
};
|
|
4320
|
-
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y),
|
|
4336
|
+
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y), h ? {
|
|
4321
4337
|
x: u * f,
|
|
4322
|
-
y: x *
|
|
4338
|
+
y: x * l
|
|
4323
4339
|
} : {
|
|
4324
|
-
x: x *
|
|
4340
|
+
x: x * l,
|
|
4325
4341
|
y: u * f
|
|
4326
4342
|
};
|
|
4327
4343
|
}
|
|
@@ -4333,16 +4349,16 @@ const Ci = function(a) {
|
|
|
4333
4349
|
var e, i;
|
|
4334
4350
|
const {
|
|
4335
4351
|
x: s,
|
|
4336
|
-
y:
|
|
4337
|
-
placement:
|
|
4352
|
+
y: o,
|
|
4353
|
+
placement: r,
|
|
4338
4354
|
middlewareData: n
|
|
4339
|
-
} = t,
|
|
4340
|
-
return
|
|
4341
|
-
x: s +
|
|
4342
|
-
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,
|
|
4343
4359
|
data: {
|
|
4344
|
-
...
|
|
4345
|
-
placement:
|
|
4360
|
+
...h,
|
|
4361
|
+
placement: r
|
|
4346
4362
|
}
|
|
4347
4363
|
};
|
|
4348
4364
|
}
|
|
@@ -4357,8 +4373,8 @@ const Ci = function(a) {
|
|
|
4357
4373
|
y: i,
|
|
4358
4374
|
placement: s
|
|
4359
4375
|
} = t, {
|
|
4360
|
-
mainAxis:
|
|
4361
|
-
crossAxis:
|
|
4376
|
+
mainAxis: o = !0,
|
|
4377
|
+
crossAxis: r = !1,
|
|
4362
4378
|
limiter: n = {
|
|
4363
4379
|
fn: (w) => {
|
|
4364
4380
|
let {
|
|
@@ -4371,19 +4387,19 @@ const Ci = function(a) {
|
|
|
4371
4387
|
};
|
|
4372
4388
|
}
|
|
4373
4389
|
},
|
|
4374
|
-
...
|
|
4375
|
-
} = at(a, t),
|
|
4390
|
+
...h
|
|
4391
|
+
} = at(a, t), l = {
|
|
4376
4392
|
x: e,
|
|
4377
4393
|
y: i
|
|
4378
|
-
}, f = await re(t,
|
|
4379
|
-
let u =
|
|
4380
|
-
if (
|
|
4394
|
+
}, f = await re(t, h), d = J(q(s)), x = ie(d);
|
|
4395
|
+
let u = l[x], y = l[d];
|
|
4396
|
+
if (o) {
|
|
4381
4397
|
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u + f[w], m = u - f[p];
|
|
4382
|
-
u =
|
|
4398
|
+
u = _t(E, u, m);
|
|
4383
4399
|
}
|
|
4384
|
-
if (
|
|
4400
|
+
if (r) {
|
|
4385
4401
|
const w = d === "y" ? "top" : "left", p = d === "y" ? "bottom" : "right", E = y + f[w], m = y - f[p];
|
|
4386
|
-
y =
|
|
4402
|
+
y = _t(E, y, m);
|
|
4387
4403
|
}
|
|
4388
4404
|
const g = n.fn({
|
|
4389
4405
|
...t,
|
|
@@ -4396,8 +4412,8 @@ const Ci = function(a) {
|
|
|
4396
4412
|
x: g.x - e,
|
|
4397
4413
|
y: g.y - i,
|
|
4398
4414
|
enabled: {
|
|
4399
|
-
[x]:
|
|
4400
|
-
[d]:
|
|
4415
|
+
[x]: o,
|
|
4416
|
+
[d]: r
|
|
4401
4417
|
}
|
|
4402
4418
|
}
|
|
4403
4419
|
};
|
|
@@ -4410,33 +4426,33 @@ function gt() {
|
|
|
4410
4426
|
function tt(a) {
|
|
4411
4427
|
return oe(a) ? (a.nodeName || "").toLowerCase() : "#document";
|
|
4412
4428
|
}
|
|
4413
|
-
function
|
|
4429
|
+
function H(a) {
|
|
4414
4430
|
var t;
|
|
4415
4431
|
return (a == null || (t = a.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
4416
4432
|
}
|
|
4417
|
-
function
|
|
4433
|
+
function K(a) {
|
|
4418
4434
|
var t;
|
|
4419
4435
|
return (t = (oe(a) ? a.ownerDocument : a.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4420
4436
|
}
|
|
4421
4437
|
function oe(a) {
|
|
4422
|
-
return gt() ? a instanceof Node || a instanceof
|
|
4438
|
+
return gt() ? a instanceof Node || a instanceof H(a).Node : !1;
|
|
4423
4439
|
}
|
|
4424
|
-
function
|
|
4425
|
-
return gt() ? a instanceof Element || a instanceof
|
|
4440
|
+
function X(a) {
|
|
4441
|
+
return gt() ? a instanceof Element || a instanceof H(a).Element : !1;
|
|
4426
4442
|
}
|
|
4427
4443
|
function N(a) {
|
|
4428
|
-
return gt() ? a instanceof HTMLElement || a instanceof
|
|
4444
|
+
return gt() ? a instanceof HTMLElement || a instanceof H(a).HTMLElement : !1;
|
|
4429
4445
|
}
|
|
4430
4446
|
function Vt(a) {
|
|
4431
|
-
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;
|
|
4432
4448
|
}
|
|
4433
|
-
function
|
|
4449
|
+
function ht(a) {
|
|
4434
4450
|
const {
|
|
4435
4451
|
overflow: t,
|
|
4436
4452
|
overflowX: e,
|
|
4437
4453
|
overflowY: i,
|
|
4438
4454
|
display: s
|
|
4439
|
-
} =
|
|
4455
|
+
} = k(a);
|
|
4440
4456
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
4441
4457
|
}
|
|
4442
4458
|
function Ri(a) {
|
|
@@ -4452,7 +4468,7 @@ function wt(a) {
|
|
|
4452
4468
|
});
|
|
4453
4469
|
}
|
|
4454
4470
|
function Dt(a) {
|
|
4455
|
-
const t =
|
|
4471
|
+
const t = Xt(), e = X(a) ? k(a) : a;
|
|
4456
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));
|
|
4457
4473
|
}
|
|
4458
4474
|
function Ii(a) {
|
|
@@ -4466,17 +4482,17 @@ function Ii(a) {
|
|
|
4466
4482
|
}
|
|
4467
4483
|
return null;
|
|
4468
4484
|
}
|
|
4469
|
-
function
|
|
4485
|
+
function Xt() {
|
|
4470
4486
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
4471
4487
|
}
|
|
4472
4488
|
function Q(a) {
|
|
4473
4489
|
return ["html", "body", "#document"].includes(tt(a));
|
|
4474
4490
|
}
|
|
4475
|
-
function
|
|
4476
|
-
return
|
|
4491
|
+
function k(a) {
|
|
4492
|
+
return H(a).getComputedStyle(a);
|
|
4477
4493
|
}
|
|
4478
4494
|
function pt(a) {
|
|
4479
|
-
return
|
|
4495
|
+
return X(a) ? {
|
|
4480
4496
|
scrollLeft: a.scrollLeft,
|
|
4481
4497
|
scrollTop: a.scrollTop
|
|
4482
4498
|
} : {
|
|
@@ -4492,21 +4508,21 @@ function z(a) {
|
|
|
4492
4508
|
a.assignedSlot || // DOM Element detected.
|
|
4493
4509
|
a.parentNode || // ShadowRoot detected.
|
|
4494
4510
|
Vt(a) && a.host || // Fallback.
|
|
4495
|
-
|
|
4511
|
+
K(a)
|
|
4496
4512
|
);
|
|
4497
4513
|
return Vt(t) ? t.host : t;
|
|
4498
4514
|
}
|
|
4499
4515
|
function ne(a) {
|
|
4500
4516
|
const t = z(a);
|
|
4501
|
-
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);
|
|
4502
4518
|
}
|
|
4503
4519
|
function St(a, t, e) {
|
|
4504
4520
|
var i;
|
|
4505
4521
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4506
|
-
const s = ne(a),
|
|
4507
|
-
if (
|
|
4508
|
-
const n = Tt(
|
|
4509
|
-
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) : []);
|
|
4510
4526
|
}
|
|
4511
4527
|
return t.concat(s, St(s, [], e));
|
|
4512
4528
|
}
|
|
@@ -4514,17 +4530,17 @@ function Tt(a) {
|
|
|
4514
4530
|
return a.parent && Object.getPrototypeOf(a.parent) ? a.frameElement : null;
|
|
4515
4531
|
}
|
|
4516
4532
|
function ae(a) {
|
|
4517
|
-
const t =
|
|
4533
|
+
const t = k(a);
|
|
4518
4534
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4519
|
-
const s = N(a),
|
|
4520
|
-
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), {
|
|
4521
4537
|
width: e,
|
|
4522
4538
|
height: i,
|
|
4523
4539
|
$: n
|
|
4524
4540
|
};
|
|
4525
4541
|
}
|
|
4526
4542
|
function ce(a) {
|
|
4527
|
-
return
|
|
4543
|
+
return X(a) ? a : a.contextElement;
|
|
4528
4544
|
}
|
|
4529
4545
|
function Z(a) {
|
|
4530
4546
|
const t = ce(a);
|
|
@@ -4533,45 +4549,45 @@ function Z(a) {
|
|
|
4533
4549
|
const e = t.getBoundingClientRect(), {
|
|
4534
4550
|
width: i,
|
|
4535
4551
|
height: s,
|
|
4536
|
-
$:
|
|
4552
|
+
$: o
|
|
4537
4553
|
} = ae(t);
|
|
4538
|
-
let
|
|
4539
|
-
return (!
|
|
4540
|
-
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,
|
|
4541
4557
|
y: n
|
|
4542
4558
|
};
|
|
4543
4559
|
}
|
|
4544
|
-
const
|
|
4545
|
-
function
|
|
4546
|
-
const t =
|
|
4547
|
-
return !
|
|
4560
|
+
const _i = /* @__PURE__ */ V(0);
|
|
4561
|
+
function he(a) {
|
|
4562
|
+
const t = H(a);
|
|
4563
|
+
return !Xt() || !t.visualViewport ? _i : {
|
|
4548
4564
|
x: t.visualViewport.offsetLeft,
|
|
4549
4565
|
y: t.visualViewport.offsetTop
|
|
4550
4566
|
};
|
|
4551
4567
|
}
|
|
4552
|
-
function
|
|
4553
|
-
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;
|
|
4554
4570
|
}
|
|
4555
4571
|
function ot(a, t, e, i) {
|
|
4556
4572
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
4557
|
-
const s = a.getBoundingClientRect(),
|
|
4558
|
-
let
|
|
4559
|
-
t && (i ?
|
|
4560
|
-
const n =
|
|
4561
|
-
let
|
|
4562
|
-
if (
|
|
4563
|
-
const x =
|
|
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;
|
|
4564
4580
|
let y = x, g = Tt(y);
|
|
4565
4581
|
for (; g && i && u !== y; ) {
|
|
4566
|
-
const w = Z(g), p = g.getBoundingClientRect(), E =
|
|
4567
|
-
|
|
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);
|
|
4568
4584
|
}
|
|
4569
4585
|
}
|
|
4570
4586
|
return ut({
|
|
4571
4587
|
width: f,
|
|
4572
4588
|
height: d,
|
|
4573
|
-
x:
|
|
4574
|
-
y:
|
|
4589
|
+
x: h,
|
|
4590
|
+
y: l
|
|
4575
4591
|
});
|
|
4576
4592
|
}
|
|
4577
4593
|
function Si(a) {
|
|
@@ -4581,23 +4597,23 @@ function Si(a) {
|
|
|
4581
4597
|
offsetParent: i,
|
|
4582
4598
|
strategy: s
|
|
4583
4599
|
} = a;
|
|
4584
|
-
const
|
|
4585
|
-
if (i ===
|
|
4600
|
+
const o = s === "fixed", r = K(i), n = t ? wt(t.floating) : !1;
|
|
4601
|
+
if (i === r || n && o)
|
|
4586
4602
|
return e;
|
|
4587
|
-
let
|
|
4603
|
+
let h = {
|
|
4588
4604
|
scrollLeft: 0,
|
|
4589
4605
|
scrollTop: 0
|
|
4590
|
-
},
|
|
4606
|
+
}, l = V(1);
|
|
4591
4607
|
const f = V(0), d = N(i);
|
|
4592
|
-
if ((d || !d && !
|
|
4608
|
+
if ((d || !d && !o) && ((tt(i) !== "body" || ht(r)) && (h = pt(i)), N(i))) {
|
|
4593
4609
|
const x = ot(i);
|
|
4594
|
-
|
|
4610
|
+
l = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4595
4611
|
}
|
|
4596
4612
|
return {
|
|
4597
|
-
width: e.width *
|
|
4598
|
-
height: e.height *
|
|
4599
|
-
x: e.x *
|
|
4600
|
-
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
|
|
4601
4617
|
};
|
|
4602
4618
|
}
|
|
4603
4619
|
function Ti(a) {
|
|
@@ -4605,41 +4621,41 @@ function Ti(a) {
|
|
|
4605
4621
|
}
|
|
4606
4622
|
function Lt(a, t) {
|
|
4607
4623
|
const e = pt(a).scrollLeft;
|
|
4608
|
-
return t ? t.left + e : ot(
|
|
4624
|
+
return t ? t.left + e : ot(K(a)).left + e;
|
|
4609
4625
|
}
|
|
4610
4626
|
function Li(a) {
|
|
4611
|
-
const t =
|
|
4612
|
-
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);
|
|
4613
4629
|
const n = -e.scrollTop;
|
|
4614
|
-
return
|
|
4630
|
+
return k(i).direction === "rtl" && (r += U(t.clientWidth, i.clientWidth) - s), {
|
|
4615
4631
|
width: s,
|
|
4616
|
-
height:
|
|
4617
|
-
x:
|
|
4632
|
+
height: o,
|
|
4633
|
+
x: r,
|
|
4618
4634
|
y: n
|
|
4619
4635
|
};
|
|
4620
4636
|
}
|
|
4621
4637
|
function Ai(a, t) {
|
|
4622
|
-
const e =
|
|
4623
|
-
let
|
|
4638
|
+
const e = H(a), i = K(a), s = e.visualViewport;
|
|
4639
|
+
let o = i.clientWidth, r = i.clientHeight, n = 0, h = 0;
|
|
4624
4640
|
if (s) {
|
|
4625
|
-
|
|
4626
|
-
const
|
|
4627
|
-
(!
|
|
4641
|
+
o = s.width, r = s.height;
|
|
4642
|
+
const l = Xt();
|
|
4643
|
+
(!l || l && t === "fixed") && (n = s.offsetLeft, h = s.offsetTop);
|
|
4628
4644
|
}
|
|
4629
4645
|
return {
|
|
4630
|
-
width:
|
|
4631
|
-
height:
|
|
4646
|
+
width: o,
|
|
4647
|
+
height: r,
|
|
4632
4648
|
x: n,
|
|
4633
|
-
y:
|
|
4649
|
+
y: h
|
|
4634
4650
|
};
|
|
4635
4651
|
}
|
|
4636
|
-
function
|
|
4637
|
-
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;
|
|
4638
4654
|
return {
|
|
4639
|
-
width:
|
|
4655
|
+
width: r,
|
|
4640
4656
|
height: n,
|
|
4641
|
-
x:
|
|
4642
|
-
y:
|
|
4657
|
+
x: h,
|
|
4658
|
+
y: l
|
|
4643
4659
|
};
|
|
4644
4660
|
}
|
|
4645
4661
|
function zt(a, t, e) {
|
|
@@ -4647,11 +4663,11 @@ function zt(a, t, e) {
|
|
|
4647
4663
|
if (t === "viewport")
|
|
4648
4664
|
i = Ai(a, e);
|
|
4649
4665
|
else if (t === "document")
|
|
4650
|
-
i = Li(
|
|
4651
|
-
else if (
|
|
4652
|
-
i =
|
|
4666
|
+
i = Li(K(a));
|
|
4667
|
+
else if (X(t))
|
|
4668
|
+
i = Mi(t, e);
|
|
4653
4669
|
else {
|
|
4654
|
-
const s =
|
|
4670
|
+
const s = he(a);
|
|
4655
4671
|
i = {
|
|
4656
4672
|
...t,
|
|
4657
4673
|
x: t.x - s.x,
|
|
@@ -4660,20 +4676,20 @@ function zt(a, t, e) {
|
|
|
4660
4676
|
}
|
|
4661
4677
|
return ut(i);
|
|
4662
4678
|
}
|
|
4663
|
-
function
|
|
4679
|
+
function le(a, t) {
|
|
4664
4680
|
const e = z(a);
|
|
4665
|
-
return e === t || !
|
|
4681
|
+
return e === t || !X(e) || Q(e) ? !1 : k(e).position === "fixed" || le(e, t);
|
|
4666
4682
|
}
|
|
4667
|
-
function
|
|
4683
|
+
function Hi(a, t) {
|
|
4668
4684
|
const e = t.get(a);
|
|
4669
4685
|
if (e)
|
|
4670
4686
|
return e;
|
|
4671
|
-
let i = St(a, [], !1).filter((n) =>
|
|
4672
|
-
const
|
|
4673
|
-
let
|
|
4674
|
-
for (;
|
|
4675
|
-
const n =
|
|
4676
|
-
!
|
|
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);
|
|
4677
4693
|
}
|
|
4678
4694
|
return t.set(a, i), i;
|
|
4679
4695
|
}
|
|
@@ -4684,18 +4700,18 @@ function Di(a) {
|
|
|
4684
4700
|
rootBoundary: i,
|
|
4685
4701
|
strategy: s
|
|
4686
4702
|
} = a;
|
|
4687
|
-
const
|
|
4703
|
+
const r = [...e === "clippingAncestors" ? wt(t) ? [] : Hi(t, this._c) : [].concat(e), i], n = r[0], h = r.reduce((l, f) => {
|
|
4688
4704
|
const d = zt(t, f, s);
|
|
4689
|
-
return
|
|
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;
|
|
4690
4706
|
}, zt(t, n, s));
|
|
4691
4707
|
return {
|
|
4692
|
-
width:
|
|
4693
|
-
height:
|
|
4694
|
-
x:
|
|
4695
|
-
y:
|
|
4708
|
+
width: h.right - h.left,
|
|
4709
|
+
height: h.bottom - h.top,
|
|
4710
|
+
x: h.left,
|
|
4711
|
+
y: h.top
|
|
4696
4712
|
};
|
|
4697
4713
|
}
|
|
4698
|
-
function
|
|
4714
|
+
function Xi(a) {
|
|
4699
4715
|
const {
|
|
4700
4716
|
width: t,
|
|
4701
4717
|
height: e
|
|
@@ -4705,51 +4721,51 @@ function ki(a) {
|
|
|
4705
4721
|
height: e
|
|
4706
4722
|
};
|
|
4707
4723
|
}
|
|
4708
|
-
function
|
|
4709
|
-
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);
|
|
4710
4726
|
let n = {
|
|
4711
4727
|
scrollLeft: 0,
|
|
4712
4728
|
scrollTop: 0
|
|
4713
4729
|
};
|
|
4714
|
-
const
|
|
4715
|
-
if (i || !i && !
|
|
4716
|
-
if ((tt(t) !== "body" ||
|
|
4717
|
-
const u = ot(t, !0,
|
|
4718
|
-
|
|
4719
|
-
} else s && (
|
|
4720
|
-
let
|
|
4721
|
-
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) {
|
|
4722
4738
|
const u = s.getBoundingClientRect();
|
|
4723
|
-
f = u.top + n.scrollTop,
|
|
4739
|
+
f = u.top + n.scrollTop, l = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
4724
4740
|
Lt(s, u);
|
|
4725
4741
|
}
|
|
4726
|
-
const d =
|
|
4742
|
+
const d = r.left + n.scrollLeft - h.x - l, x = r.top + n.scrollTop - h.y - f;
|
|
4727
4743
|
return {
|
|
4728
4744
|
x: d,
|
|
4729
4745
|
y: x,
|
|
4730
|
-
width:
|
|
4731
|
-
height:
|
|
4746
|
+
width: r.width,
|
|
4747
|
+
height: r.height
|
|
4732
4748
|
};
|
|
4733
4749
|
}
|
|
4734
4750
|
function mt(a) {
|
|
4735
|
-
return
|
|
4751
|
+
return k(a).position === "static";
|
|
4736
4752
|
}
|
|
4737
4753
|
function $t(a, t) {
|
|
4738
|
-
if (!N(a) ||
|
|
4754
|
+
if (!N(a) || k(a).position === "fixed")
|
|
4739
4755
|
return null;
|
|
4740
4756
|
if (t)
|
|
4741
4757
|
return t(a);
|
|
4742
4758
|
let e = a.offsetParent;
|
|
4743
|
-
return
|
|
4759
|
+
return K(a) === e && (e = e.ownerDocument.body), e;
|
|
4744
4760
|
}
|
|
4745
4761
|
function de(a, t) {
|
|
4746
|
-
const e =
|
|
4762
|
+
const e = H(a);
|
|
4747
4763
|
if (wt(a))
|
|
4748
4764
|
return e;
|
|
4749
4765
|
if (!N(a)) {
|
|
4750
4766
|
let s = z(a);
|
|
4751
4767
|
for (; s && !Q(s); ) {
|
|
4752
|
-
if (
|
|
4768
|
+
if (X(s) && !mt(s))
|
|
4753
4769
|
return s;
|
|
4754
4770
|
s = z(s);
|
|
4755
4771
|
}
|
|
@@ -4760,10 +4776,10 @@ function de(a, t) {
|
|
|
4760
4776
|
i = $t(i, t);
|
|
4761
4777
|
return i && Q(i) && mt(i) && !Dt(i) ? e : i || Ii(a) || e;
|
|
4762
4778
|
}
|
|
4763
|
-
const
|
|
4779
|
+
const Fi = async function(a) {
|
|
4764
4780
|
const t = this.getOffsetParent || de, e = this.getDimensions, i = await e(a.floating);
|
|
4765
4781
|
return {
|
|
4766
|
-
reference:
|
|
4782
|
+
reference: ki(a.reference, await t(a.floating), a.strategy),
|
|
4767
4783
|
floating: {
|
|
4768
4784
|
x: 0,
|
|
4769
4785
|
y: 0,
|
|
@@ -4773,30 +4789,30 @@ const Xi = async function(a) {
|
|
|
4773
4789
|
};
|
|
4774
4790
|
};
|
|
4775
4791
|
function Ni(a) {
|
|
4776
|
-
return
|
|
4792
|
+
return k(a).direction === "rtl";
|
|
4777
4793
|
}
|
|
4778
|
-
const
|
|
4794
|
+
const Yi = {
|
|
4779
4795
|
convertOffsetParentRelativeRectToViewportRelativeRect: Si,
|
|
4780
|
-
getDocumentElement:
|
|
4796
|
+
getDocumentElement: K,
|
|
4781
4797
|
getClippingRect: Di,
|
|
4782
4798
|
getOffsetParent: de,
|
|
4783
|
-
getElementRects:
|
|
4799
|
+
getElementRects: Fi,
|
|
4784
4800
|
getClientRects: Ti,
|
|
4785
|
-
getDimensions:
|
|
4801
|
+
getDimensions: Xi,
|
|
4786
4802
|
getScale: Z,
|
|
4787
|
-
isElement:
|
|
4803
|
+
isElement: X,
|
|
4788
4804
|
isRTL: Ni
|
|
4789
|
-
}, fe = Ci, xe = vi, ue = Ei,
|
|
4805
|
+
}, fe = Ci, xe = vi, ue = Ei, Ki = mi, ge = (a, t, e) => {
|
|
4790
4806
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
4791
|
-
platform:
|
|
4807
|
+
platform: Yi,
|
|
4792
4808
|
...e
|
|
4793
|
-
},
|
|
4809
|
+
}, o = {
|
|
4794
4810
|
...s.platform,
|
|
4795
4811
|
_c: i
|
|
4796
4812
|
};
|
|
4797
4813
|
return yi(a, t, {
|
|
4798
4814
|
...s,
|
|
4799
|
-
platform:
|
|
4815
|
+
platform: o
|
|
4800
4816
|
});
|
|
4801
4817
|
};
|
|
4802
4818
|
let Bi = class {
|
|
@@ -4807,8 +4823,8 @@ let Bi = class {
|
|
|
4807
4823
|
c(this, "floatingEl");
|
|
4808
4824
|
c(this, "arrowEl");
|
|
4809
4825
|
this.ctx = t;
|
|
4810
|
-
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE:
|
|
4811
|
-
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`;
|
|
4812
4828
|
const n = {
|
|
4813
4829
|
display: "none",
|
|
4814
4830
|
position: "absolute",
|
|
@@ -4819,8 +4835,8 @@ let Bi = class {
|
|
|
4819
4835
|
padding: "8px",
|
|
4820
4836
|
borderRadius: "4px",
|
|
4821
4837
|
fontSize: "12px",
|
|
4822
|
-
...
|
|
4823
|
-
},
|
|
4838
|
+
...o
|
|
4839
|
+
}, h = {
|
|
4824
4840
|
position: "absolute",
|
|
4825
4841
|
width: "10px",
|
|
4826
4842
|
height: "10px",
|
|
@@ -4829,7 +4845,7 @@ let Bi = class {
|
|
|
4829
4845
|
transform: "rotate(45deg)",
|
|
4830
4846
|
zIndex: n.zIndex
|
|
4831
4847
|
};
|
|
4832
|
-
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();
|
|
4833
4849
|
}
|
|
4834
4850
|
init() {
|
|
4835
4851
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -4853,28 +4869,28 @@ let Bi = class {
|
|
|
4853
4869
|
if (!i)
|
|
4854
4870
|
return;
|
|
4855
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;
|
|
4856
|
-
const s = t.drawX + i.x,
|
|
4872
|
+
const s = t.drawX + i.x, o = t.drawY + i.y;
|
|
4857
4873
|
ge({
|
|
4858
4874
|
getBoundingClientRect() {
|
|
4859
4875
|
return {
|
|
4860
4876
|
width: t.visibleWidth,
|
|
4861
4877
|
height: t.visibleHeight,
|
|
4862
4878
|
x: s,
|
|
4863
|
-
y:
|
|
4879
|
+
y: o,
|
|
4864
4880
|
left: s,
|
|
4865
4881
|
right: s + t.visibleWidth,
|
|
4866
|
-
top:
|
|
4867
|
-
bottom:
|
|
4882
|
+
top: o,
|
|
4883
|
+
bottom: o + t.visibleHeight
|
|
4868
4884
|
};
|
|
4869
4885
|
}
|
|
4870
4886
|
}, this.floatingEl, {
|
|
4871
4887
|
placement: t.overflowTooltipPlacement,
|
|
4872
|
-
middleware: [xe(), ue(), fe(6),
|
|
4888
|
+
middleware: [xe(), ue(), fe(6), Ki({ element: this.arrowEl })]
|
|
4873
4889
|
}).then((n) => {
|
|
4874
|
-
const { x:
|
|
4890
|
+
const { x: h, y: l, placement: f, middlewareData: d } = n;
|
|
4875
4891
|
if (Object.assign(this.floatingEl.style, {
|
|
4876
|
-
top: `${
|
|
4877
|
-
left: `${
|
|
4892
|
+
top: `${l}px`,
|
|
4893
|
+
left: `${h}px`
|
|
4878
4894
|
}), d.arrow) {
|
|
4879
4895
|
const x = d.arrow;
|
|
4880
4896
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -4923,8 +4939,8 @@ class Wi {
|
|
|
4923
4939
|
}), this.ctx.on("cellHeaderMousedown", () => {
|
|
4924
4940
|
this.enable && this.doneEdit();
|
|
4925
4941
|
}), this.ctx.on("keydown", (t) => {
|
|
4926
|
-
const e = t.key, i = t.ctrlKey, s = t.altKey,
|
|
4927
|
-
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 || [
|
|
4928
4944
|
// "Enter",
|
|
4929
4945
|
"Escape",
|
|
4930
4946
|
"Tab",
|
|
@@ -4965,19 +4981,19 @@ class Wi {
|
|
|
4965
4981
|
}
|
|
4966
4982
|
initTextEditor() {
|
|
4967
4983
|
const { CSS_PREFIX: t, SELECT_BORDER_COLOR: e } = this.ctx.config;
|
|
4968
|
-
this.inputEl = document.createElement("div"), this.inputEl.addEventListener("keydown", (
|
|
4984
|
+
this.inputEl = document.createElement("div"), this.inputEl.addEventListener("keydown", (r) => {
|
|
4969
4985
|
if (this.enable) {
|
|
4970
|
-
if ((
|
|
4971
|
-
|
|
4986
|
+
if ((r.altKey || r.metaKey) && r.code === "Enter") {
|
|
4987
|
+
r.preventDefault();
|
|
4972
4988
|
const n = this.inputEl.textContent;
|
|
4973
4989
|
this.inputEl.textContent = `${n}
|
|
4974
4990
|
|
|
4975
4991
|
`;
|
|
4976
|
-
const
|
|
4977
|
-
|
|
4992
|
+
const h = window.getSelection();
|
|
4993
|
+
h == null || h.selectAllChildren(this.inputEl), h == null || h.collapseToEnd();
|
|
4978
4994
|
return;
|
|
4979
4995
|
}
|
|
4980
|
-
(
|
|
4996
|
+
(r.code === "Escape" || r.code === "Enter") && (r.preventDefault(), this.inputEl.blur());
|
|
4981
4997
|
}
|
|
4982
4998
|
}), this.inputEl.addEventListener("blur", () => {
|
|
4983
4999
|
this.doneEdit();
|
|
@@ -5016,16 +5032,16 @@ class Wi {
|
|
|
5016
5032
|
cursor: "text"
|
|
5017
5033
|
};
|
|
5018
5034
|
Object.assign(this.inputEl.style, s);
|
|
5019
|
-
const
|
|
5020
|
-
this.inputEl.contentEditable =
|
|
5035
|
+
const o = navigator.userAgent.toLowerCase().includes("firefox");
|
|
5036
|
+
this.inputEl.contentEditable = o ? "true" : "plaintext-only", this.editorEl.appendChild(this.inputEl), this.ctx.targetContainer.appendChild(this.editorEl);
|
|
5021
5037
|
}
|
|
5022
5038
|
startEditByInput(t) {
|
|
5023
5039
|
if (t.editorType !== "text")
|
|
5024
5040
|
return;
|
|
5025
|
-
const e = t.getValue(), { width: i, height: s } = t,
|
|
5026
|
-
this.editorEl.style.left = `${
|
|
5027
|
-
const
|
|
5028
|
-
|
|
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();
|
|
5029
5045
|
}
|
|
5030
5046
|
doneEditByInput() {
|
|
5031
5047
|
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
@@ -5040,22 +5056,22 @@ class Wi {
|
|
|
5040
5056
|
const e = this.ctx.focusCell;
|
|
5041
5057
|
if (!e || ["index", "index-selection", "selection"].includes(e.type) || this.enable)
|
|
5042
5058
|
return;
|
|
5043
|
-
const { rowKey: i, key: s } = e,
|
|
5044
|
-
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));
|
|
5045
5061
|
}
|
|
5046
5062
|
editCell(t, e) {
|
|
5047
|
-
const i = this.ctx.body.renderRows.find((
|
|
5063
|
+
const i = this.ctx.body.renderRows.find((l) => l.rowIndex === t);
|
|
5048
5064
|
if (!i)
|
|
5049
5065
|
return;
|
|
5050
|
-
const s = i.cells.find((
|
|
5066
|
+
const s = i.cells.find((l) => l.colIndex === e);
|
|
5051
5067
|
if (!s)
|
|
5052
5068
|
return;
|
|
5053
5069
|
this.ctx.emit("setSelectorCell", s);
|
|
5054
|
-
const
|
|
5055
|
-
if (!
|
|
5070
|
+
const o = this.ctx.focusCell;
|
|
5071
|
+
if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
|
|
5056
5072
|
return;
|
|
5057
|
-
const { rowKey:
|
|
5058
|
-
|
|
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));
|
|
5059
5075
|
}
|
|
5060
5076
|
doneEdit() {
|
|
5061
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"));
|
|
@@ -5068,12 +5084,12 @@ class Pi {
|
|
|
5068
5084
|
c(this, "ctx");
|
|
5069
5085
|
c(this, "emptyEl");
|
|
5070
5086
|
this.ctx = t;
|
|
5071
|
-
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX:
|
|
5072
|
-
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 }) => {
|
|
5073
5089
|
if (i)
|
|
5074
5090
|
return;
|
|
5075
|
-
const f = n + (
|
|
5076
|
-
display:
|
|
5091
|
+
const f = n + (h + l) / 2, d = {
|
|
5092
|
+
display: r === "empty" ? "block" : "none",
|
|
5077
5093
|
position: "absolute",
|
|
5078
5094
|
fontSize: "14px",
|
|
5079
5095
|
color: "#666",
|
|
@@ -5108,10 +5124,10 @@ class Vi {
|
|
|
5108
5124
|
const {
|
|
5109
5125
|
target: t,
|
|
5110
5126
|
config: { SCROLLER_TRACK_SIZE: e }
|
|
5111
|
-
} = this.ctx, i = t.width - e, s = t.height - e,
|
|
5112
|
-
let
|
|
5113
|
-
const { FOOTER_FIXED:
|
|
5114
|
-
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]), {
|
|
5115
5131
|
style: {
|
|
5116
5132
|
position: "absolute",
|
|
5117
5133
|
left: "0px",
|
|
@@ -5121,7 +5137,7 @@ class Vi {
|
|
|
5121
5137
|
width: `${i}px`,
|
|
5122
5138
|
height: `${s}px`
|
|
5123
5139
|
},
|
|
5124
|
-
views:
|
|
5140
|
+
views: h
|
|
5125
5141
|
};
|
|
5126
5142
|
}
|
|
5127
5143
|
getHeader() {
|
|
@@ -5129,10 +5145,10 @@ class Vi {
|
|
|
5129
5145
|
fixedLeftWidth: t,
|
|
5130
5146
|
fixedRightWidth: e,
|
|
5131
5147
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5132
|
-
} = this.ctx, { visibleWidth:
|
|
5133
|
-
let
|
|
5148
|
+
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: n } = this.ctx.header;
|
|
5149
|
+
let h = [], l = [], f = [];
|
|
5134
5150
|
n.forEach((w) => {
|
|
5135
|
-
w.render && (w.fixed === "left" ?
|
|
5151
|
+
w.render && (w.fixed === "left" ? l.push(w) : w.fixed === "right" ? f.push(w) : h.push(w));
|
|
5136
5152
|
});
|
|
5137
5153
|
const d = e - i, x = {
|
|
5138
5154
|
key: "left",
|
|
@@ -5142,9 +5158,9 @@ class Vi {
|
|
|
5142
5158
|
left: `${0.5}px`,
|
|
5143
5159
|
overflow: "hidden",
|
|
5144
5160
|
width: `${t}px`,
|
|
5145
|
-
height: `${
|
|
5161
|
+
height: `${r}px`
|
|
5146
5162
|
},
|
|
5147
|
-
cells:
|
|
5163
|
+
cells: l
|
|
5148
5164
|
}, u = {
|
|
5149
5165
|
key: "center",
|
|
5150
5166
|
style: {
|
|
@@ -5152,10 +5168,10 @@ class Vi {
|
|
|
5152
5168
|
top: `${0.5}px`,
|
|
5153
5169
|
left: `${t}px`,
|
|
5154
5170
|
overflow: "hidden",
|
|
5155
|
-
width: `${
|
|
5156
|
-
height: `${
|
|
5171
|
+
width: `${o - t - d}px`,
|
|
5172
|
+
height: `${r}px`
|
|
5157
5173
|
},
|
|
5158
|
-
cells:
|
|
5174
|
+
cells: h
|
|
5159
5175
|
}, y = {
|
|
5160
5176
|
key: "right",
|
|
5161
5177
|
style: {
|
|
@@ -5164,7 +5180,7 @@ class Vi {
|
|
|
5164
5180
|
right: `${0.5}px`,
|
|
5165
5181
|
overflow: "hidden",
|
|
5166
5182
|
width: `${d}px`,
|
|
5167
|
-
height: `${
|
|
5183
|
+
height: `${r}px`
|
|
5168
5184
|
},
|
|
5169
5185
|
cells: f
|
|
5170
5186
|
};
|
|
@@ -5174,8 +5190,8 @@ class Vi {
|
|
|
5174
5190
|
style: {
|
|
5175
5191
|
position: "relative",
|
|
5176
5192
|
overflow: "hidden",
|
|
5177
|
-
width: `${
|
|
5178
|
-
height: `${
|
|
5193
|
+
width: `${o}px`,
|
|
5194
|
+
height: `${r}px`
|
|
5179
5195
|
},
|
|
5180
5196
|
views: [x, u, y]
|
|
5181
5197
|
};
|
|
@@ -5189,17 +5205,17 @@ class Vi {
|
|
|
5189
5205
|
});
|
|
5190
5206
|
});
|
|
5191
5207
|
const {
|
|
5192
|
-
fixedLeftWidth:
|
|
5193
|
-
fixedRightWidth:
|
|
5194
|
-
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX:
|
|
5195
|
-
} = 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 = {
|
|
5196
5212
|
key: "left",
|
|
5197
5213
|
style: {
|
|
5198
5214
|
position: "absolute",
|
|
5199
5215
|
top: `${0.5}px`,
|
|
5200
5216
|
left: `${0.5}px`,
|
|
5201
5217
|
overflow: "hidden",
|
|
5202
|
-
width: `${
|
|
5218
|
+
width: `${o}px`,
|
|
5203
5219
|
height: `${f}px`
|
|
5204
5220
|
},
|
|
5205
5221
|
cells: e
|
|
@@ -5208,9 +5224,9 @@ class Vi {
|
|
|
5208
5224
|
style: {
|
|
5209
5225
|
position: "absolute",
|
|
5210
5226
|
top: `${0.5}px`,
|
|
5211
|
-
left: `${
|
|
5227
|
+
left: `${o + 0.5}px`,
|
|
5212
5228
|
overflow: "hidden",
|
|
5213
|
-
width: `${
|
|
5229
|
+
width: `${l - o - d}px`,
|
|
5214
5230
|
height: `${f}px`
|
|
5215
5231
|
},
|
|
5216
5232
|
cells: t
|
|
@@ -5228,11 +5244,11 @@ class Vi {
|
|
|
5228
5244
|
};
|
|
5229
5245
|
return {
|
|
5230
5246
|
type: "body",
|
|
5231
|
-
class: `${
|
|
5247
|
+
class: `${h}-overlayer-body`,
|
|
5232
5248
|
style: {
|
|
5233
5249
|
position: "relative",
|
|
5234
5250
|
overflow: "hidden",
|
|
5235
|
-
width: `${
|
|
5251
|
+
width: `${l}px`,
|
|
5236
5252
|
height: `${f}px`
|
|
5237
5253
|
},
|
|
5238
5254
|
views: [x, u, y]
|
|
@@ -5247,9 +5263,9 @@ class Vi {
|
|
|
5247
5263
|
});
|
|
5248
5264
|
const {
|
|
5249
5265
|
fixedLeftWidth: s,
|
|
5250
|
-
fixedRightWidth:
|
|
5251
|
-
config: { SCROLLER_TRACK_SIZE:
|
|
5252
|
-
} = 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 = {
|
|
5253
5269
|
key: "left",
|
|
5254
5270
|
style: {
|
|
5255
5271
|
position: "absolute",
|
|
@@ -5257,7 +5273,7 @@ class Vi {
|
|
|
5257
5273
|
left: `${0.5}px`,
|
|
5258
5274
|
overflow: "hidden",
|
|
5259
5275
|
width: `${s}px`,
|
|
5260
|
-
height: `${
|
|
5276
|
+
height: `${l}px`
|
|
5261
5277
|
},
|
|
5262
5278
|
cells: e
|
|
5263
5279
|
}, x = {
|
|
@@ -5267,8 +5283,8 @@ class Vi {
|
|
|
5267
5283
|
top: `${0.5}px`,
|
|
5268
5284
|
left: `${s + 0.5}px`,
|
|
5269
5285
|
overflow: "hidden",
|
|
5270
|
-
width: `${
|
|
5271
|
-
height: `${
|
|
5286
|
+
width: `${h - s - f}px`,
|
|
5287
|
+
height: `${l}px`
|
|
5272
5288
|
},
|
|
5273
5289
|
cells: t
|
|
5274
5290
|
}, u = {
|
|
@@ -5279,7 +5295,7 @@ class Vi {
|
|
|
5279
5295
|
right: `${0.5}px`,
|
|
5280
5296
|
overflow: "hidden",
|
|
5281
5297
|
width: `${f}px`,
|
|
5282
|
-
height: `${
|
|
5298
|
+
height: `${l}px`
|
|
5283
5299
|
},
|
|
5284
5300
|
cells: i
|
|
5285
5301
|
};
|
|
@@ -5289,8 +5305,8 @@ class Vi {
|
|
|
5289
5305
|
style: {
|
|
5290
5306
|
position: "relative",
|
|
5291
5307
|
overflow: "hidden",
|
|
5292
|
-
width: `${
|
|
5293
|
-
height: `${
|
|
5308
|
+
width: `${h}px`,
|
|
5309
|
+
height: `${l}px`
|
|
5294
5310
|
},
|
|
5295
5311
|
views: [d, x, u]
|
|
5296
5312
|
};
|
|
@@ -5306,8 +5322,8 @@ class zi {
|
|
|
5306
5322
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5307
5323
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5308
5324
|
e.preventDefault();
|
|
5309
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [
|
|
5310
|
-
|
|
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);
|
|
5311
5327
|
const x = {
|
|
5312
5328
|
getBoundingClientRect: () => ({
|
|
5313
5329
|
width: 0,
|
|
@@ -5396,7 +5412,7 @@ class Gi {
|
|
|
5396
5412
|
c(this, "overlayer");
|
|
5397
5413
|
c(this, "contextMenu");
|
|
5398
5414
|
c(this, "ctx");
|
|
5399
|
-
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();
|
|
5400
5416
|
}
|
|
5401
5417
|
draw() {
|
|
5402
5418
|
requestAnimationFrame(() => {
|
|
@@ -5430,14 +5446,14 @@ class Gi {
|
|
|
5430
5446
|
editCell(t, e) {
|
|
5431
5447
|
this.editor.editCell(t, e);
|
|
5432
5448
|
}
|
|
5433
|
-
setItemValue(t, e, i, s = !0,
|
|
5434
|
-
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);
|
|
5435
5451
|
}
|
|
5436
5452
|
batchSetItemValue(t, e = !0, i = !0) {
|
|
5437
5453
|
this.ctx.database.batchSetItemValue(t, e), i && this.ctx.emit("draw");
|
|
5438
5454
|
}
|
|
5439
|
-
setItemValueByEditor(t, e, i, s = !0,
|
|
5440
|
-
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();
|
|
5441
5457
|
}
|
|
5442
5458
|
doLayout() {
|
|
5443
5459
|
this.ctx.emit("draw");
|
|
@@ -5458,10 +5474,10 @@ class Gi {
|
|
|
5458
5474
|
e(s);
|
|
5459
5475
|
} catch (s) {
|
|
5460
5476
|
if (t && Array.isArray(s) && s.length) {
|
|
5461
|
-
const [
|
|
5462
|
-
if (Array.isArray(
|
|
5463
|
-
const [
|
|
5464
|
-
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);
|
|
5465
5481
|
}
|
|
5466
5482
|
}
|
|
5467
5483
|
i(s);
|
|
@@ -5470,8 +5486,8 @@ class Gi {
|
|
|
5470
5486
|
}
|
|
5471
5487
|
setValidations(t) {
|
|
5472
5488
|
if (t.forEach((e) => {
|
|
5473
|
-
const { rowIndex: i, key: s, message:
|
|
5474
|
-
this.ctx.database.setValidationErrorByRowIndex(i, s,
|
|
5489
|
+
const { rowIndex: i, key: s, message: o } = e;
|
|
5490
|
+
this.ctx.database.setValidationErrorByRowIndex(i, s, o);
|
|
5475
5491
|
}), t && Array.isArray(t) && t.length) {
|
|
5476
5492
|
const [e] = t;
|
|
5477
5493
|
if (e && e.rowIndex >= 0 && e.key) {
|
|
@@ -5483,13 +5499,13 @@ class Gi {
|
|
|
5483
5499
|
getValidations() {
|
|
5484
5500
|
return new Promise(async (t, e) => {
|
|
5485
5501
|
const i = this.ctx.database.getAllRowsData(), s = this.ctx.header.leafCellHeaders;
|
|
5486
|
-
let
|
|
5487
|
-
for (let
|
|
5502
|
+
let o = [];
|
|
5503
|
+
for (let r = 0; r < i.length; r++)
|
|
5488
5504
|
for (let n = 0; n < s.length; n++) {
|
|
5489
|
-
const
|
|
5490
|
-
Array.isArray(d) && d.length &&
|
|
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);
|
|
5491
5507
|
}
|
|
5492
|
-
|
|
5508
|
+
o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
5493
5509
|
});
|
|
5494
5510
|
}
|
|
5495
5511
|
scrollTo(t, e) {
|