stk-table-vue 0.6.9 → 0.6.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/README.md +201 -201
- package/lib/src/StkTable/StkTable.vue.d.ts +697 -695
- package/lib/src/StkTable/const.d.ts +2 -0
- package/lib/stk-table-vue.js +2367 -2374
- package/lib/style.css +395 -395
- package/package.json +74 -74
- package/src/StkTable/StkTable.vue +1541 -1530
- package/src/StkTable/components/DragHandle.vue +9 -9
- package/src/StkTable/components/SortIcon.vue +6 -6
- package/src/StkTable/const.ts +37 -34
- package/src/StkTable/index.ts +4 -4
- package/src/StkTable/style.less +553 -555
- package/src/StkTable/types/highlightDimOptions.ts +26 -26
- package/src/StkTable/types/index.ts +239 -239
- package/src/StkTable/useAutoResize.ts +91 -91
- package/src/StkTable/useColResize.ts +216 -213
- package/src/StkTable/useFixedCol.ts +148 -142
- package/src/StkTable/useFixedStyle.ts +75 -76
- package/src/StkTable/useGetFixedColPosition.ts +65 -64
- package/src/StkTable/useHighlight.ts +318 -318
- package/src/StkTable/useKeyboardArrowScroll.ts +106 -106
- package/src/StkTable/useThDrag.ts +102 -102
- package/src/StkTable/useTrDrag.ts +118 -118
- package/src/StkTable/useVirtualScroll.ts +447 -449
- package/src/StkTable/utils/constRefUtils.ts +29 -29
- package/src/StkTable/utils/index.ts +212 -212
- package/src/StkTable/utils/useTriggerRef.ts +33 -33
- package/src/VirtualTree.vue +622 -622
- package/src/VirtualTreeSelect.vue +367 -367
- package/src/vite-env.d.ts +10 -10
package/lib/stk-table-vue.js
CHANGED
|
@@ -1,2374 +1,2367 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { interpolateRgb } from "d3-interpolate";
|
|
3
|
-
const _export_sfc = (sfc, props) => {
|
|
4
|
-
const target = sfc.__vccOpts || sfc;
|
|
5
|
-
for (const [key, val] of props) {
|
|
6
|
-
target[key] = val;
|
|
7
|
-
}
|
|
8
|
-
return target;
|
|
9
|
-
};
|
|
10
|
-
const _sfc_main$2 = {};
|
|
11
|
-
const _hoisted_1$2 = {
|
|
12
|
-
class: "drag-row-handle",
|
|
13
|
-
draggable: "true"
|
|
14
|
-
};
|
|
15
|
-
function _sfc_render$1(_ctx, _cache) {
|
|
16
|
-
return openBlock(), createElementBlock("span", _hoisted_1$2, _cache[0] || (_cache[0] = [
|
|
17
|
-
createElementVNode("svg", {
|
|
18
|
-
viewBox: "0 0 1024 1024",
|
|
19
|
-
width: "16",
|
|
20
|
-
height: "16",
|
|
21
|
-
fill: "currentColor"
|
|
22
|
-
}, [
|
|
23
|
-
createElementVNode("path", { d: "M640 853.3a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z m-256 0a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z m256-256a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z m-256 0a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z m256-256a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3zM384 341.3a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z" })
|
|
24
|
-
], -1)
|
|
25
|
-
]));
|
|
26
|
-
}
|
|
27
|
-
const DragHandle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
|
|
28
|
-
const _sfc_main$1 = {};
|
|
29
|
-
const _hoisted_1$1 = {
|
|
30
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
-
width: "16px",
|
|
32
|
-
height: "16px",
|
|
33
|
-
viewBox: "0 0 16 16"
|
|
34
|
-
};
|
|
35
|
-
function _sfc_render(_ctx, _cache) {
|
|
36
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [
|
|
37
|
-
createElementVNode("polygon", {
|
|
38
|
-
class: "arrow-up",
|
|
39
|
-
fill: "#757699",
|
|
40
|
-
points: "8 2 4.8 6 11.2 6"
|
|
41
|
-
}, null, -1),
|
|
42
|
-
createElementVNode("polygon", {
|
|
43
|
-
class: "arrow-down",
|
|
44
|
-
transform: "translate(8, 12) rotate(-180) translate(-8, -12) ",
|
|
45
|
-
points: "8 10 4.8 14 11.2 14"
|
|
46
|
-
}, null, -1)
|
|
47
|
-
]));
|
|
48
|
-
}
|
|
49
|
-
const SortIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
|
|
50
|
-
function isEmptyValue(val, isNumber) {
|
|
51
|
-
let isEmpty = val === null || val === void 0;
|
|
52
|
-
if (isNumber) {
|
|
53
|
-
isEmpty = isEmpty || typeof val === "boolean" || Number.isNaN(+val);
|
|
54
|
-
}
|
|
55
|
-
return isEmpty;
|
|
56
|
-
}
|
|
57
|
-
function insertToOrderedArray(sortState, newItem, targetArray, sortConfig = {}) {
|
|
58
|
-
const { dataIndex, order } = sortState;
|
|
59
|
-
sortConfig = { emptyToBottom: false, ...sortConfig };
|
|
60
|
-
let { sortType } = sortState;
|
|
61
|
-
if (!sortType) sortType = typeof newItem[dataIndex];
|
|
62
|
-
const data =
|
|
63
|
-
if (!order || !data.length) {
|
|
64
|
-
data.unshift(newItem);
|
|
65
|
-
return data;
|
|
66
|
-
}
|
|
67
|
-
if (sortConfig.emptyToBottom && isEmptyValue(newItem)) {
|
|
68
|
-
data.push(newItem);
|
|
69
|
-
}
|
|
70
|
-
const isNumber = sortType === "number";
|
|
71
|
-
const targetVal = newItem[dataIndex];
|
|
72
|
-
const sIndex = binarySearch(data, (midIndex) => {
|
|
73
|
-
const midVal = data[midIndex][dataIndex];
|
|
74
|
-
const compareRes = strCompare(midVal, targetVal, isNumber, sortConfig.stringLocaleCompare);
|
|
75
|
-
return order === "asc" ? compareRes : -compareRes;
|
|
76
|
-
});
|
|
77
|
-
data.splice(sIndex, 0, newItem);
|
|
78
|
-
return data;
|
|
79
|
-
}
|
|
80
|
-
function binarySearch(searchArray, compareCallback) {
|
|
81
|
-
let sIndex = 0;
|
|
82
|
-
let eIndex = searchArray.length - 1;
|
|
83
|
-
while (sIndex <= eIndex) {
|
|
84
|
-
const midIndex = Math.floor((sIndex + eIndex) / 2);
|
|
85
|
-
const compareRes = compareCallback(midIndex);
|
|
86
|
-
if (compareRes === 0) {
|
|
87
|
-
sIndex = midIndex;
|
|
88
|
-
break;
|
|
89
|
-
} else if (compareRes < 0) {
|
|
90
|
-
sIndex = midIndex + 1;
|
|
91
|
-
} else {
|
|
92
|
-
eIndex = midIndex - 1;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return sIndex;
|
|
96
|
-
}
|
|
97
|
-
function strCompare(a, b, isNumber, localeCompare = false) {
|
|
98
|
-
let _a = a;
|
|
99
|
-
let _b = b;
|
|
100
|
-
if (isNumber) {
|
|
101
|
-
_a = +a;
|
|
102
|
-
_b = +b;
|
|
103
|
-
} else if (localeCompare) {
|
|
104
|
-
return String(a).localeCompare(b);
|
|
105
|
-
}
|
|
106
|
-
if (_a > _b) return 1;
|
|
107
|
-
else if (_a === _b) return 0;
|
|
108
|
-
else return -1;
|
|
109
|
-
}
|
|
110
|
-
function separatedData(sortOption, targetDataSource, isNumber) {
|
|
111
|
-
const emptyArr = [];
|
|
112
|
-
const valueArr = [];
|
|
113
|
-
for (let i = 0; i < targetDataSource.length; i++) {
|
|
114
|
-
const row = targetDataSource[i];
|
|
115
|
-
const sortField = sortOption.sortField || sortOption.dataIndex;
|
|
116
|
-
const isEmpty = isEmptyValue(row == null ? void 0 : row[sortField], isNumber);
|
|
117
|
-
if (isEmpty) {
|
|
118
|
-
emptyArr.push(row);
|
|
119
|
-
} else {
|
|
120
|
-
valueArr.push(row);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return [valueArr, emptyArr];
|
|
124
|
-
}
|
|
125
|
-
function tableSort(sortOption, order, dataSource, sortConfig = {}) {
|
|
126
|
-
if (!(dataSource == null ? void 0 : dataSource.length) || !sortOption) return dataSource || [];
|
|
127
|
-
sortConfig = { emptyToBottom: false, ...sortConfig };
|
|
128
|
-
let targetDataSource =
|
|
129
|
-
let sortField = sortOption.sortField || sortOption.dataIndex;
|
|
130
|
-
if (!order && sortConfig.defaultSort) {
|
|
131
|
-
order = sortConfig.defaultSort.order;
|
|
132
|
-
sortField = sortConfig.defaultSort.dataIndex;
|
|
133
|
-
}
|
|
134
|
-
if (typeof sortOption.sorter === "function") {
|
|
135
|
-
const customSorterData = sortOption.sorter(targetDataSource, { order, column: sortOption });
|
|
136
|
-
if (customSorterData) targetDataSource = customSorterData;
|
|
137
|
-
} else if (order) {
|
|
138
|
-
let { sortType } = sortOption;
|
|
139
|
-
if (!sortType) sortType = typeof dataSource[0][sortField];
|
|
140
|
-
const isNumber = sortType === "number";
|
|
141
|
-
const [valueArr, emptyArr] = separatedData(sortOption, targetDataSource, isNumber);
|
|
142
|
-
if (order === "asc") {
|
|
143
|
-
valueArr.sort((a, b) => strCompare(a[sortField], b[sortField], isNumber, sortConfig.stringLocaleCompare));
|
|
144
|
-
} else {
|
|
145
|
-
valueArr.sort((a, b) => strCompare(b[sortField], a[sortField], isNumber, sortConfig.stringLocaleCompare));
|
|
146
|
-
}
|
|
147
|
-
if (order === "desc" || sortConfig.emptyToBottom) {
|
|
148
|
-
targetDataSource =
|
|
149
|
-
} else {
|
|
150
|
-
targetDataSource =
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return targetDataSource;
|
|
154
|
-
}
|
|
155
|
-
function howDeepTheHeader(arr, level = 0) {
|
|
156
|
-
const levels = [level];
|
|
157
|
-
arr.forEach((item) => {
|
|
158
|
-
var _a;
|
|
159
|
-
if ((_a = item.children) == null ? void 0 : _a.length) {
|
|
160
|
-
levels.push(howDeepTheHeader(item.children, level + 1));
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
return Math.max(...levels);
|
|
164
|
-
}
|
|
165
|
-
function transformWidthToStr(width) {
|
|
166
|
-
if (width === void 0) return;
|
|
167
|
-
const numberWidth = Number(width);
|
|
168
|
-
return width + (!Number.isNaN(numberWidth) ? "px" : "");
|
|
169
|
-
}
|
|
170
|
-
function getBrowsersVersion(browserName) {
|
|
171
|
-
try {
|
|
172
|
-
const reg = new RegExp(`${browserName}/\\d+`, "i");
|
|
173
|
-
const userAgent = navigator.userAgent.match(reg);
|
|
174
|
-
if (userAgent) {
|
|
175
|
-
return +userAgent[0].split("/")[1];
|
|
176
|
-
}
|
|
177
|
-
} catch (e) {
|
|
178
|
-
console.error("Cannot get version", e);
|
|
179
|
-
}
|
|
180
|
-
return 100;
|
|
181
|
-
}
|
|
182
|
-
const DEFAULT_COL_WIDTH = "100";
|
|
183
|
-
const DEFAULT_TABLE_HEIGHT = 100;
|
|
184
|
-
const DEFAULT_TABLE_WIDTH = 200;
|
|
185
|
-
const DEFAULT_ROW_HEIGHT = 28;
|
|
186
|
-
const HIGHLIGHT_COLOR = {
|
|
187
|
-
light: { from: "#71a2fd", to: "#fff" },
|
|
188
|
-
dark: { from: "#1e4c99", to: "#181c21" }
|
|
189
|
-
};
|
|
190
|
-
const HIGHLIGHT_DURATION = 2e3;
|
|
191
|
-
const HIGHLIGHT_FREQ = 1e3 / 30;
|
|
192
|
-
const HIGHLIGHT_ROW_CLASS = "highlight-row";
|
|
193
|
-
const HIGHLIGHT_CELL_CLASS = "highlight-cell";
|
|
194
|
-
const _chromeVersion = getBrowsersVersion("chrome");
|
|
195
|
-
const _firefoxVersion = getBrowsersVersion("firefox");
|
|
196
|
-
const IS_LEGACY_MODE = _chromeVersion < 56 || _firefoxVersion < 59;
|
|
197
|
-
const DEFAULT_SMOOTH_SCROLL = _chromeVersion < 85;
|
|
198
|
-
const STK_ID_PREFIX = "stk";
|
|
199
|
-
const EXPANDED_ROW_KEY_PREFIX = "expanded-";
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
TagType2[TagType2["
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
let
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
() =>
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
resizeObserver
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
resizeObserver
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
id
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
window.addEventListener("
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
window.removeEventListener("
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
e.
|
|
336
|
-
|
|
337
|
-
const {
|
|
338
|
-
const {
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
style
|
|
371
|
-
style.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
if (
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
style
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
} =
|
|
476
|
-
clientWidth = cw;
|
|
477
|
-
scrollLeft = sl;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
fixedCols
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
const
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
const
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
const
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
ScrollCodes2["
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
(
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
return
|
|
958
|
-
}
|
|
959
|
-
function
|
|
960
|
-
|
|
961
|
-
const tr =
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
if (
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
if (
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
return dataSourceCopy.value.
|
|
1078
|
-
});
|
|
1079
|
-
const
|
|
1080
|
-
if (!virtual_on.value) return
|
|
1081
|
-
const { startIndex,
|
|
1082
|
-
return
|
|
1083
|
-
});
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
if (
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
return (row) => row
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
offsetTop =
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
if (
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1342
|
-
const
|
|
1343
|
-
const
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
const
|
|
1359
|
-
const
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
}) },
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
const
|
|
1419
|
-
const
|
|
1420
|
-
const
|
|
1421
|
-
const
|
|
1422
|
-
const
|
|
1423
|
-
const
|
|
1424
|
-
const
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1429
|
-
let
|
|
1430
|
-
const
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
const
|
|
1434
|
-
const
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
return (
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
() =>
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
if (
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
const
|
|
1671
|
-
const
|
|
1672
|
-
tableHeaders.value.forEach((cols, depth) => {
|
|
1673
|
-
cols.forEach((col) => {
|
|
1674
|
-
const colKey = colKeyGen.value(col);
|
|
1675
|
-
const width =
|
|
1676
|
-
const style = {
|
|
1677
|
-
width
|
|
1678
|
-
};
|
|
1679
|
-
if (
|
|
1680
|
-
style.minWidth = width;
|
|
1681
|
-
style.maxWidth = width;
|
|
1682
|
-
} else {
|
|
1683
|
-
style.minWidth = transformWidthToStr(col.minWidth) ?? width;
|
|
1684
|
-
style.maxWidth = transformWidthToStr(col.maxWidth) ?? width;
|
|
1685
|
-
}
|
|
1686
|
-
thMap.set(colKey, {
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
})
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
const
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
return;
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
}
|
|
1818
|
-
const
|
|
1819
|
-
|
|
1820
|
-
const {
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
}
|
|
1923
|
-
function
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
}
|
|
1928
|
-
function
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
return
|
|
1935
|
-
}
|
|
1936
|
-
function
|
|
1937
|
-
const
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
rowKey
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
*
|
|
1991
|
-
*
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
*
|
|
1998
|
-
*
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
*
|
|
2005
|
-
*
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
*
|
|
2019
|
-
*
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
*
|
|
2026
|
-
*
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
*
|
|
2033
|
-
*
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
*
|
|
2039
|
-
*
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
*
|
|
2046
|
-
*
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
*
|
|
2053
|
-
*
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
*
|
|
2060
|
-
*
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
*
|
|
2067
|
-
*
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
*
|
|
2074
|
-
*
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
*
|
|
2081
|
-
*
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
*
|
|
2088
|
-
*
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
"
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
"
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
"
|
|
2113
|
-
"
|
|
2114
|
-
"
|
|
2115
|
-
|
|
2116
|
-
"
|
|
2117
|
-
"
|
|
2118
|
-
"row-
|
|
2119
|
-
"row-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
"
|
|
2123
|
-
"
|
|
2124
|
-
"
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
key:
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
unref(virtualX_on) ? (
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
col
|
|
2180
|
-
|
|
2181
|
-
]
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
createElementVNode("div", {
|
|
2194
|
-
class: "table-header-cell-wrapper",
|
|
2195
|
-
style: normalizeStyle({ "--row-span": unref(virtualX_on) ? 1 : col.rowSpan })
|
|
2196
|
-
}, [
|
|
2197
|
-
col.customHeaderCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customHeaderCell), {
|
|
2198
|
-
key: 0,
|
|
2199
|
-
col,
|
|
2200
|
-
colIndex,
|
|
2201
|
-
rowIndex
|
|
2202
|
-
}, null, 8, ["col", "colIndex", "rowIndex"])) :
|
|
2203
|
-
key:
|
|
2204
|
-
col
|
|
2205
|
-
}, () => [
|
|
2206
|
-
createElementVNode("span", _hoisted_3, toDisplayString(col.title), 1)
|
|
2207
|
-
]),
|
|
2208
|
-
col.sorter ? (openBlock(),
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
(...args) => unref(
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
"
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
createTextVNode(toDisplayString((
|
|
2336
|
-
], 64))
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
}
|
|
2368
|
-
export {
|
|
2369
|
-
_sfc_main as StkTable,
|
|
2370
|
-
binarySearch,
|
|
2371
|
-
insertToOrderedArray,
|
|
2372
|
-
strCompare,
|
|
2373
|
-
tableSort
|
|
2374
|
-
};
|
|
1
|
+
import { createElementBlock, openBlock, createElementVNode, watch, onMounted, onBeforeUnmount, ref, computed, shallowRef, defineComponent, nextTick, toRaw, normalizeStyle, normalizeClass, unref, createCommentVNode, renderSlot, Fragment, renderList, createBlock, resolveDynamicComponent, toDisplayString, createTextVNode, createVNode } from "vue";
|
|
2
|
+
import { interpolateRgb } from "d3-interpolate";
|
|
3
|
+
const _export_sfc = (sfc, props) => {
|
|
4
|
+
const target = sfc.__vccOpts || sfc;
|
|
5
|
+
for (const [key, val] of props) {
|
|
6
|
+
target[key] = val;
|
|
7
|
+
}
|
|
8
|
+
return target;
|
|
9
|
+
};
|
|
10
|
+
const _sfc_main$2 = {};
|
|
11
|
+
const _hoisted_1$2 = {
|
|
12
|
+
class: "drag-row-handle",
|
|
13
|
+
draggable: "true"
|
|
14
|
+
};
|
|
15
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
16
|
+
return openBlock(), createElementBlock("span", _hoisted_1$2, _cache[0] || (_cache[0] = [
|
|
17
|
+
createElementVNode("svg", {
|
|
18
|
+
viewBox: "0 0 1024 1024",
|
|
19
|
+
width: "16",
|
|
20
|
+
height: "16",
|
|
21
|
+
fill: "currentColor"
|
|
22
|
+
}, [
|
|
23
|
+
createElementVNode("path", { d: "M640 853.3a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z m-256 0a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z m256-256a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z m-256 0a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z m256-256a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3zM384 341.3a85.3 85.3 0 1 1 85.3-85.3 85.3 85.3 0 0 1-85.3 85.3z" })
|
|
24
|
+
], -1)
|
|
25
|
+
]));
|
|
26
|
+
}
|
|
27
|
+
const DragHandle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
|
|
28
|
+
const _sfc_main$1 = {};
|
|
29
|
+
const _hoisted_1$1 = {
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
+
width: "16px",
|
|
32
|
+
height: "16px",
|
|
33
|
+
viewBox: "0 0 16 16"
|
|
34
|
+
};
|
|
35
|
+
function _sfc_render(_ctx, _cache) {
|
|
36
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [
|
|
37
|
+
createElementVNode("polygon", {
|
|
38
|
+
class: "arrow-up",
|
|
39
|
+
fill: "#757699",
|
|
40
|
+
points: "8 2 4.8 6 11.2 6"
|
|
41
|
+
}, null, -1),
|
|
42
|
+
createElementVNode("polygon", {
|
|
43
|
+
class: "arrow-down",
|
|
44
|
+
transform: "translate(8, 12) rotate(-180) translate(-8, -12) ",
|
|
45
|
+
points: "8 10 4.8 14 11.2 14"
|
|
46
|
+
}, null, -1)
|
|
47
|
+
]));
|
|
48
|
+
}
|
|
49
|
+
const SortIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
|
|
50
|
+
function isEmptyValue(val, isNumber) {
|
|
51
|
+
let isEmpty = val === null || val === void 0;
|
|
52
|
+
if (isNumber) {
|
|
53
|
+
isEmpty = isEmpty || typeof val === "boolean" || Number.isNaN(+val);
|
|
54
|
+
}
|
|
55
|
+
return isEmpty;
|
|
56
|
+
}
|
|
57
|
+
function insertToOrderedArray(sortState, newItem, targetArray, sortConfig = {}) {
|
|
58
|
+
const { dataIndex, order } = sortState;
|
|
59
|
+
sortConfig = { emptyToBottom: false, ...sortConfig };
|
|
60
|
+
let { sortType } = sortState;
|
|
61
|
+
if (!sortType) sortType = typeof newItem[dataIndex];
|
|
62
|
+
const data = targetArray.slice();
|
|
63
|
+
if (!order || !data.length) {
|
|
64
|
+
data.unshift(newItem);
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
if (sortConfig.emptyToBottom && isEmptyValue(newItem)) {
|
|
68
|
+
data.push(newItem);
|
|
69
|
+
}
|
|
70
|
+
const isNumber = sortType === "number";
|
|
71
|
+
const targetVal = newItem[dataIndex];
|
|
72
|
+
const sIndex = binarySearch(data, (midIndex) => {
|
|
73
|
+
const midVal = data[midIndex][dataIndex];
|
|
74
|
+
const compareRes = strCompare(midVal, targetVal, isNumber, sortConfig.stringLocaleCompare);
|
|
75
|
+
return order === "asc" ? compareRes : -compareRes;
|
|
76
|
+
});
|
|
77
|
+
data.splice(sIndex, 0, newItem);
|
|
78
|
+
return data;
|
|
79
|
+
}
|
|
80
|
+
function binarySearch(searchArray, compareCallback) {
|
|
81
|
+
let sIndex = 0;
|
|
82
|
+
let eIndex = searchArray.length - 1;
|
|
83
|
+
while (sIndex <= eIndex) {
|
|
84
|
+
const midIndex = Math.floor((sIndex + eIndex) / 2);
|
|
85
|
+
const compareRes = compareCallback(midIndex);
|
|
86
|
+
if (compareRes === 0) {
|
|
87
|
+
sIndex = midIndex;
|
|
88
|
+
break;
|
|
89
|
+
} else if (compareRes < 0) {
|
|
90
|
+
sIndex = midIndex + 1;
|
|
91
|
+
} else {
|
|
92
|
+
eIndex = midIndex - 1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return sIndex;
|
|
96
|
+
}
|
|
97
|
+
function strCompare(a, b, isNumber, localeCompare = false) {
|
|
98
|
+
let _a = a;
|
|
99
|
+
let _b = b;
|
|
100
|
+
if (isNumber) {
|
|
101
|
+
_a = +a;
|
|
102
|
+
_b = +b;
|
|
103
|
+
} else if (localeCompare) {
|
|
104
|
+
return String(a).localeCompare(b);
|
|
105
|
+
}
|
|
106
|
+
if (_a > _b) return 1;
|
|
107
|
+
else if (_a === _b) return 0;
|
|
108
|
+
else return -1;
|
|
109
|
+
}
|
|
110
|
+
function separatedData(sortOption, targetDataSource, isNumber) {
|
|
111
|
+
const emptyArr = [];
|
|
112
|
+
const valueArr = [];
|
|
113
|
+
for (let i = 0; i < targetDataSource.length; i++) {
|
|
114
|
+
const row = targetDataSource[i];
|
|
115
|
+
const sortField = sortOption.sortField || sortOption.dataIndex;
|
|
116
|
+
const isEmpty = isEmptyValue(row == null ? void 0 : row[sortField], isNumber);
|
|
117
|
+
if (isEmpty) {
|
|
118
|
+
emptyArr.push(row);
|
|
119
|
+
} else {
|
|
120
|
+
valueArr.push(row);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return [valueArr, emptyArr];
|
|
124
|
+
}
|
|
125
|
+
function tableSort(sortOption, order, dataSource, sortConfig = {}) {
|
|
126
|
+
if (!(dataSource == null ? void 0 : dataSource.length) || !sortOption) return dataSource || [];
|
|
127
|
+
sortConfig = { emptyToBottom: false, ...sortConfig };
|
|
128
|
+
let targetDataSource = dataSource.slice();
|
|
129
|
+
let sortField = sortOption.sortField || sortOption.dataIndex;
|
|
130
|
+
if (!order && sortConfig.defaultSort) {
|
|
131
|
+
order = sortConfig.defaultSort.order;
|
|
132
|
+
sortField = sortConfig.defaultSort.dataIndex;
|
|
133
|
+
}
|
|
134
|
+
if (typeof sortOption.sorter === "function") {
|
|
135
|
+
const customSorterData = sortOption.sorter(targetDataSource, { order, column: sortOption });
|
|
136
|
+
if (customSorterData) targetDataSource = customSorterData;
|
|
137
|
+
} else if (order) {
|
|
138
|
+
let { sortType } = sortOption;
|
|
139
|
+
if (!sortType) sortType = typeof dataSource[0][sortField];
|
|
140
|
+
const isNumber = sortType === "number";
|
|
141
|
+
const [valueArr, emptyArr] = separatedData(sortOption, targetDataSource, isNumber);
|
|
142
|
+
if (order === "asc") {
|
|
143
|
+
valueArr.sort((a, b) => strCompare(a[sortField], b[sortField], isNumber, sortConfig.stringLocaleCompare));
|
|
144
|
+
} else {
|
|
145
|
+
valueArr.sort((a, b) => strCompare(b[sortField], a[sortField], isNumber, sortConfig.stringLocaleCompare));
|
|
146
|
+
}
|
|
147
|
+
if (order === "desc" || sortConfig.emptyToBottom) {
|
|
148
|
+
targetDataSource = valueArr.concat(emptyArr);
|
|
149
|
+
} else {
|
|
150
|
+
targetDataSource = emptyArr.concat(valueArr);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return targetDataSource;
|
|
154
|
+
}
|
|
155
|
+
function howDeepTheHeader(arr, level = 0) {
|
|
156
|
+
const levels = [level];
|
|
157
|
+
arr.forEach((item) => {
|
|
158
|
+
var _a;
|
|
159
|
+
if ((_a = item.children) == null ? void 0 : _a.length) {
|
|
160
|
+
levels.push(howDeepTheHeader(item.children, level + 1));
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return Math.max(...levels);
|
|
164
|
+
}
|
|
165
|
+
function transformWidthToStr(width) {
|
|
166
|
+
if (width === void 0) return;
|
|
167
|
+
const numberWidth = Number(width);
|
|
168
|
+
return width + (!Number.isNaN(numberWidth) ? "px" : "");
|
|
169
|
+
}
|
|
170
|
+
function getBrowsersVersion(browserName) {
|
|
171
|
+
try {
|
|
172
|
+
const reg = new RegExp(`${browserName}/\\d+`, "i");
|
|
173
|
+
const userAgent = navigator.userAgent.match(reg);
|
|
174
|
+
if (userAgent) {
|
|
175
|
+
return +userAgent[0].split("/")[1];
|
|
176
|
+
}
|
|
177
|
+
} catch (e) {
|
|
178
|
+
console.error("Cannot get version", e);
|
|
179
|
+
}
|
|
180
|
+
return 100;
|
|
181
|
+
}
|
|
182
|
+
const DEFAULT_COL_WIDTH = "100";
|
|
183
|
+
const DEFAULT_TABLE_HEIGHT = 100;
|
|
184
|
+
const DEFAULT_TABLE_WIDTH = 200;
|
|
185
|
+
const DEFAULT_ROW_HEIGHT = 28;
|
|
186
|
+
const HIGHLIGHT_COLOR = {
|
|
187
|
+
light: { from: "#71a2fd", to: "#fff" },
|
|
188
|
+
dark: { from: "#1e4c99", to: "#181c21" }
|
|
189
|
+
};
|
|
190
|
+
const HIGHLIGHT_DURATION = 2e3;
|
|
191
|
+
const HIGHLIGHT_FREQ = 1e3 / 30;
|
|
192
|
+
const HIGHLIGHT_ROW_CLASS = "highlight-row";
|
|
193
|
+
const HIGHLIGHT_CELL_CLASS = "highlight-cell";
|
|
194
|
+
const _chromeVersion = getBrowsersVersion("chrome");
|
|
195
|
+
const _firefoxVersion = getBrowsersVersion("firefox");
|
|
196
|
+
const IS_LEGACY_MODE = _chromeVersion < 56 || _firefoxVersion < 59;
|
|
197
|
+
const DEFAULT_SMOOTH_SCROLL = _chromeVersion < 85;
|
|
198
|
+
const STK_ID_PREFIX = "stk";
|
|
199
|
+
const EXPANDED_ROW_KEY_PREFIX = "expanded-";
|
|
200
|
+
const CELL_KEY_SEPARATE = "--";
|
|
201
|
+
var TagType = /* @__PURE__ */ ((TagType2) => {
|
|
202
|
+
TagType2[TagType2["TH"] = 0] = "TH";
|
|
203
|
+
TagType2[TagType2["TD"] = 1] = "TD";
|
|
204
|
+
return TagType2;
|
|
205
|
+
})(TagType || {});
|
|
206
|
+
function useAutoResize({ tableContainerRef, initVirtualScroll, props, debounceMs }) {
|
|
207
|
+
let resizeObserver = null;
|
|
208
|
+
let isObserved = false;
|
|
209
|
+
watch(
|
|
210
|
+
() => props.virtual,
|
|
211
|
+
(v) => {
|
|
212
|
+
if (v) initResizeObserver();
|
|
213
|
+
else removeResizeObserver();
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
watch(
|
|
217
|
+
() => props.virtualX,
|
|
218
|
+
(v) => {
|
|
219
|
+
if (v) initResizeObserver();
|
|
220
|
+
else removeResizeObserver();
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
onMounted(() => {
|
|
224
|
+
if (props.virtual || props.virtualX) {
|
|
225
|
+
initResizeObserver();
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
onBeforeUnmount(() => {
|
|
229
|
+
removeResizeObserver();
|
|
230
|
+
});
|
|
231
|
+
function initResizeObserver() {
|
|
232
|
+
if (isObserved) {
|
|
233
|
+
removeResizeObserver();
|
|
234
|
+
}
|
|
235
|
+
if (window.ResizeObserver) {
|
|
236
|
+
if (!tableContainerRef.value) {
|
|
237
|
+
const watchDom = watch(
|
|
238
|
+
() => tableContainerRef,
|
|
239
|
+
() => {
|
|
240
|
+
initResizeObserver();
|
|
241
|
+
watchDom();
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
resizeObserver = new ResizeObserver(resizeCallback);
|
|
247
|
+
resizeObserver.observe(tableContainerRef.value);
|
|
248
|
+
} else {
|
|
249
|
+
window.addEventListener("resize", resizeCallback);
|
|
250
|
+
}
|
|
251
|
+
isObserved = true;
|
|
252
|
+
}
|
|
253
|
+
function removeResizeObserver() {
|
|
254
|
+
if (!isObserved) return;
|
|
255
|
+
if (resizeObserver) {
|
|
256
|
+
resizeObserver.disconnect();
|
|
257
|
+
resizeObserver = null;
|
|
258
|
+
} else {
|
|
259
|
+
window.removeEventListener("resize", resizeCallback);
|
|
260
|
+
}
|
|
261
|
+
isObserved = false;
|
|
262
|
+
}
|
|
263
|
+
let debounceTime = 0;
|
|
264
|
+
function resizeCallback() {
|
|
265
|
+
if (debounceTime) {
|
|
266
|
+
window.clearTimeout(debounceTime);
|
|
267
|
+
}
|
|
268
|
+
debounceTime = window.setTimeout(() => {
|
|
269
|
+
if (props.autoResize) {
|
|
270
|
+
initVirtualScroll();
|
|
271
|
+
if (typeof props.autoResize === "function") {
|
|
272
|
+
props.autoResize();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
debounceTime = 0;
|
|
276
|
+
}, debounceMs);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function getColWidth(col) {
|
|
280
|
+
const val = (col == null ? void 0 : col.minWidth) ?? (col == null ? void 0 : col.width) ?? DEFAULT_COL_WIDTH;
|
|
281
|
+
if (typeof val === "number") {
|
|
282
|
+
return Math.floor(val);
|
|
283
|
+
}
|
|
284
|
+
return parseInt(val);
|
|
285
|
+
}
|
|
286
|
+
function getCalculatedColWidth(col) {
|
|
287
|
+
return (col && col.__WIDTH__) ?? 100;
|
|
288
|
+
}
|
|
289
|
+
function createStkTableId() {
|
|
290
|
+
let id = window.__STK_TB_ID_COUNT__;
|
|
291
|
+
if (!id) id = 0;
|
|
292
|
+
id += 1;
|
|
293
|
+
window.__STK_TB_ID_COUNT__ = id;
|
|
294
|
+
return STK_ID_PREFIX + id.toString(36);
|
|
295
|
+
}
|
|
296
|
+
function useColResize({
|
|
297
|
+
tableContainerRef,
|
|
298
|
+
tableHeaderLast,
|
|
299
|
+
colResizeIndicatorRef,
|
|
300
|
+
props,
|
|
301
|
+
emits,
|
|
302
|
+
colKeyGen,
|
|
303
|
+
fixedCols
|
|
304
|
+
}) {
|
|
305
|
+
const isColResizing = ref(false);
|
|
306
|
+
let colResizeState = {
|
|
307
|
+
currentCol: null,
|
|
308
|
+
lastCol: null,
|
|
309
|
+
startX: 0,
|
|
310
|
+
startOffsetTableX: 0,
|
|
311
|
+
revertMoveX: false
|
|
312
|
+
};
|
|
313
|
+
const colResizeOn = computed(() => {
|
|
314
|
+
if (Object.prototype.toString.call(props.colResizable) === "[object Object]") {
|
|
315
|
+
return (col) => !props.colResizable.disabled(col);
|
|
316
|
+
}
|
|
317
|
+
return () => props.colResizable;
|
|
318
|
+
});
|
|
319
|
+
onMounted(() => {
|
|
320
|
+
initColResizeEvent();
|
|
321
|
+
});
|
|
322
|
+
onBeforeUnmount(() => {
|
|
323
|
+
clearColResizeEvent();
|
|
324
|
+
});
|
|
325
|
+
function initColResizeEvent() {
|
|
326
|
+
window.addEventListener("mousemove", onThResizeMouseMove);
|
|
327
|
+
window.addEventListener("mouseup", onThResizeMouseUp);
|
|
328
|
+
}
|
|
329
|
+
function clearColResizeEvent() {
|
|
330
|
+
window.removeEventListener("mousemove", onThResizeMouseMove);
|
|
331
|
+
window.removeEventListener("mouseup", onThResizeMouseUp);
|
|
332
|
+
}
|
|
333
|
+
function onThResizeMouseDown(e, col, leftHandle = false) {
|
|
334
|
+
if (!tableContainerRef.value) return;
|
|
335
|
+
e.stopPropagation();
|
|
336
|
+
e.preventDefault();
|
|
337
|
+
const { clientX } = e;
|
|
338
|
+
const { scrollLeft, scrollTop } = tableContainerRef.value;
|
|
339
|
+
const { left } = tableContainerRef.value.getBoundingClientRect();
|
|
340
|
+
const tableHeaderLastValue = tableHeaderLast.value;
|
|
341
|
+
let revertMoveX = false;
|
|
342
|
+
const colKey = colKeyGen.value;
|
|
343
|
+
const colIndex = tableHeaderLastValue.findIndex((it) => colKey(it) === colKey(col));
|
|
344
|
+
const fixedIndex = fixedCols.value.indexOf(col);
|
|
345
|
+
const isFixed = fixedIndex !== -1;
|
|
346
|
+
if (leftHandle) {
|
|
347
|
+
if (isFixed && col.fixed === "right") {
|
|
348
|
+
revertMoveX = true;
|
|
349
|
+
} else {
|
|
350
|
+
if (colIndex - 1 >= 0) {
|
|
351
|
+
col = tableHeaderLastValue[colIndex - 1];
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
if (isFixed && col.fixed === "right") {
|
|
356
|
+
revertMoveX = true;
|
|
357
|
+
col = fixedCols.value[fixedIndex + 1] || col;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const offsetTableX = clientX - left + scrollLeft;
|
|
361
|
+
isColResizing.value = true;
|
|
362
|
+
Object.assign(colResizeState, {
|
|
363
|
+
currentCol: col,
|
|
364
|
+
lastCol: findLastChildCol(col),
|
|
365
|
+
startX: clientX,
|
|
366
|
+
startOffsetTableX: offsetTableX,
|
|
367
|
+
revertMoveX
|
|
368
|
+
});
|
|
369
|
+
if (colResizeIndicatorRef.value) {
|
|
370
|
+
const style = colResizeIndicatorRef.value.style;
|
|
371
|
+
style.display = "block";
|
|
372
|
+
style.left = offsetTableX + "px";
|
|
373
|
+
style.top = scrollTop + "px";
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function onThResizeMouseMove(e) {
|
|
377
|
+
if (!isColResizing.value) return;
|
|
378
|
+
e.stopPropagation();
|
|
379
|
+
e.preventDefault();
|
|
380
|
+
const { lastCol, startX, startOffsetTableX } = colResizeState;
|
|
381
|
+
const { clientX } = e;
|
|
382
|
+
let moveX = clientX - startX;
|
|
383
|
+
const currentColWidth = getCalculatedColWidth(lastCol);
|
|
384
|
+
const minWidth = (lastCol == null ? void 0 : lastCol.minWidth) ?? props.colMinWidth;
|
|
385
|
+
if (currentColWidth + moveX < minWidth) {
|
|
386
|
+
moveX = -currentColWidth;
|
|
387
|
+
}
|
|
388
|
+
const offsetTableX = startOffsetTableX + moveX;
|
|
389
|
+
if (!colResizeIndicatorRef.value) return;
|
|
390
|
+
colResizeIndicatorRef.value.style.left = offsetTableX + "px";
|
|
391
|
+
}
|
|
392
|
+
function onThResizeMouseUp(e) {
|
|
393
|
+
if (!isColResizing.value) return;
|
|
394
|
+
const { startX, lastCol, revertMoveX } = colResizeState;
|
|
395
|
+
const { clientX } = e;
|
|
396
|
+
const moveX = revertMoveX ? startX - clientX : clientX - startX;
|
|
397
|
+
let width = getCalculatedColWidth(lastCol) + moveX;
|
|
398
|
+
if (width < props.colMinWidth) width = props.colMinWidth;
|
|
399
|
+
const colKey = colKeyGen.value;
|
|
400
|
+
const curCol = tableHeaderLast.value.find((it) => colKey(it) === colKey(lastCol));
|
|
401
|
+
if (!curCol) return;
|
|
402
|
+
curCol.width = width + "px";
|
|
403
|
+
emits("update:columns", props.columns.slice());
|
|
404
|
+
emits("col-resize", { ...curCol });
|
|
405
|
+
if (colResizeIndicatorRef.value) {
|
|
406
|
+
const style = colResizeIndicatorRef.value.style;
|
|
407
|
+
style.display = "none";
|
|
408
|
+
style.left = "0";
|
|
409
|
+
style.top = "0";
|
|
410
|
+
}
|
|
411
|
+
isColResizing.value = false;
|
|
412
|
+
colResizeState = {
|
|
413
|
+
currentCol: null,
|
|
414
|
+
lastCol: null,
|
|
415
|
+
startX: 0,
|
|
416
|
+
startOffsetTableX: 0,
|
|
417
|
+
revertMoveX: false
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
function findLastChildCol(column) {
|
|
421
|
+
var _a;
|
|
422
|
+
if ((_a = column == null ? void 0 : column.children) == null ? void 0 : _a.length) {
|
|
423
|
+
const lastChild = column.children.at(-1);
|
|
424
|
+
return findLastChildCol(lastChild);
|
|
425
|
+
}
|
|
426
|
+
return column;
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
colResizeOn,
|
|
430
|
+
isColResizing,
|
|
431
|
+
onThResizeMouseDown
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function useFixedCol({
|
|
435
|
+
props,
|
|
436
|
+
colKeyGen,
|
|
437
|
+
getFixedColPosition,
|
|
438
|
+
tableHeaders,
|
|
439
|
+
tableHeadersForCalc,
|
|
440
|
+
tableContainerRef
|
|
441
|
+
}) {
|
|
442
|
+
const fixedShadowCols = shallowRef([]);
|
|
443
|
+
const fixedCols = shallowRef([]);
|
|
444
|
+
const fixedColClassMap = computed(() => {
|
|
445
|
+
const colMap = /* @__PURE__ */ new Map();
|
|
446
|
+
const fixedShadowColsValue = fixedShadowCols.value;
|
|
447
|
+
const fixedColsValue = fixedCols.value;
|
|
448
|
+
const colKey = colKeyGen.value;
|
|
449
|
+
const fixedColShadow = props.fixedColShadow;
|
|
450
|
+
tableHeaders.value.forEach((cols) => {
|
|
451
|
+
cols.forEach((col) => {
|
|
452
|
+
const fixed = col.fixed;
|
|
453
|
+
const showShadow = fixedColShadow && fixed && fixedShadowColsValue.includes(col);
|
|
454
|
+
const classObj = {
|
|
455
|
+
"fixed-cell--active": fixedColsValue.includes(col)
|
|
456
|
+
// 表示该列正在被固定
|
|
457
|
+
};
|
|
458
|
+
if (fixed) {
|
|
459
|
+
classObj["fixed-cell"] = true;
|
|
460
|
+
classObj["fixed-cell--" + fixed] = true;
|
|
461
|
+
}
|
|
462
|
+
if (showShadow) {
|
|
463
|
+
classObj["fixed-cell--shadow"] = true;
|
|
464
|
+
}
|
|
465
|
+
colMap.set(colKey(col), classObj);
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
return colMap;
|
|
469
|
+
});
|
|
470
|
+
function updateFixedShadow(virtualScrollX) {
|
|
471
|
+
const fixedColsTemp = [];
|
|
472
|
+
const getFixedColPositionValue = getFixedColPosition.value;
|
|
473
|
+
let clientWidth, scrollLeft;
|
|
474
|
+
if (virtualScrollX == null ? void 0 : virtualScrollX.value) {
|
|
475
|
+
const { containerWidth: cw, scrollLeft: sl } = virtualScrollX.value;
|
|
476
|
+
clientWidth = cw;
|
|
477
|
+
scrollLeft = sl;
|
|
478
|
+
} else {
|
|
479
|
+
const { clientWidth: cw, scrollLeft: sl } = tableContainerRef.value;
|
|
480
|
+
clientWidth = cw;
|
|
481
|
+
scrollLeft = sl;
|
|
482
|
+
}
|
|
483
|
+
const leftShadowCol = [];
|
|
484
|
+
const rightShadowCol = [];
|
|
485
|
+
tableHeadersForCalc.value.forEach((row, level) => {
|
|
486
|
+
let left = 0;
|
|
487
|
+
row.forEach((col) => {
|
|
488
|
+
const position = getFixedColPositionValue(col);
|
|
489
|
+
const isFixedLeft = col.fixed === "left";
|
|
490
|
+
const isFixedRight = col.fixed === "right";
|
|
491
|
+
if (isFixedLeft && position + scrollLeft > left) {
|
|
492
|
+
fixedColsTemp.push(col);
|
|
493
|
+
leftShadowCol[level] = col;
|
|
494
|
+
}
|
|
495
|
+
left += getCalculatedColWidth(col);
|
|
496
|
+
if (isFixedRight && scrollLeft + clientWidth - left < position) {
|
|
497
|
+
fixedColsTemp.push(col);
|
|
498
|
+
if (!rightShadowCol[level]) {
|
|
499
|
+
rightShadowCol[level] = col;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
if (props.fixedColShadow) {
|
|
505
|
+
fixedShadowCols.value = leftShadowCol.concat(rightShadowCol).filter(Boolean);
|
|
506
|
+
}
|
|
507
|
+
fixedCols.value = fixedColsTemp;
|
|
508
|
+
}
|
|
509
|
+
return {
|
|
510
|
+
/** 正在被固定的列 */
|
|
511
|
+
fixedCols,
|
|
512
|
+
/** 固定列class */
|
|
513
|
+
fixedColClassMap,
|
|
514
|
+
/** 滚动条变化时,更新需要展示阴影的列 */
|
|
515
|
+
updateFixedShadow
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
function useFixedStyle({
|
|
519
|
+
props,
|
|
520
|
+
isRelativeMode,
|
|
521
|
+
getFixedColPosition,
|
|
522
|
+
virtualScroll,
|
|
523
|
+
virtualScrollX,
|
|
524
|
+
virtualX_on,
|
|
525
|
+
virtualX_offsetRight
|
|
526
|
+
}) {
|
|
527
|
+
function getFixedStyle(tagType, col, depth = 0) {
|
|
528
|
+
const { fixed } = col;
|
|
529
|
+
if (tagType === TagType.TD && !fixed) return null;
|
|
530
|
+
const style = {};
|
|
531
|
+
const { headerRowHeight, rowHeight } = props;
|
|
532
|
+
const isFixedLeft = fixed === "left";
|
|
533
|
+
const { scrollLeft, scrollWidth, offsetLeft, containerWidth } = virtualScrollX.value;
|
|
534
|
+
const scrollRight = scrollWidth - containerWidth - scrollLeft;
|
|
535
|
+
if (tagType === TagType.TH) {
|
|
536
|
+
if (isRelativeMode.value) {
|
|
537
|
+
style.top = virtualScroll.value.scrollTop + "px";
|
|
538
|
+
} else {
|
|
539
|
+
style.top = depth * (headerRowHeight ?? rowHeight) + "px";
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (fixed === "left" || fixed === "right") {
|
|
543
|
+
if (isRelativeMode.value) {
|
|
544
|
+
if (isFixedLeft) {
|
|
545
|
+
style.left = scrollLeft - (virtualX_on.value ? offsetLeft : 0) + "px";
|
|
546
|
+
} else {
|
|
547
|
+
style.right = Math.max(scrollRight - (virtualX_on.value ? virtualX_offsetRight.value : 0), 0) + "px";
|
|
548
|
+
}
|
|
549
|
+
} else {
|
|
550
|
+
const lr = getFixedColPosition.value(col) + "px";
|
|
551
|
+
if (isFixedLeft) {
|
|
552
|
+
style.left = lr;
|
|
553
|
+
} else {
|
|
554
|
+
style.right = lr;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return style;
|
|
559
|
+
}
|
|
560
|
+
return getFixedStyle;
|
|
561
|
+
}
|
|
562
|
+
function useGetFixedColPosition({ tableHeadersForCalc, colKeyGen }) {
|
|
563
|
+
const getFixedColPosition = computed(() => {
|
|
564
|
+
const colKeyStore = {};
|
|
565
|
+
const refStore = /* @__PURE__ */ new WeakMap();
|
|
566
|
+
const colKeyGenValue = colKeyGen.value;
|
|
567
|
+
tableHeadersForCalc.value.forEach((cols) => {
|
|
568
|
+
let left = 0;
|
|
569
|
+
let rightStartIndex = 0;
|
|
570
|
+
for (let i = 0; i < cols.length; i++) {
|
|
571
|
+
const item = cols[i];
|
|
572
|
+
if (item.fixed === "left") {
|
|
573
|
+
const colKey = colKeyGenValue(item);
|
|
574
|
+
if (colKey) {
|
|
575
|
+
colKeyStore[colKey] = left;
|
|
576
|
+
} else {
|
|
577
|
+
refStore.set(item, left);
|
|
578
|
+
}
|
|
579
|
+
left += getCalculatedColWidth(item);
|
|
580
|
+
}
|
|
581
|
+
if (!rightStartIndex && item.fixed === "right") {
|
|
582
|
+
rightStartIndex = i;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
let right = 0;
|
|
586
|
+
for (let i = cols.length - 1; i >= rightStartIndex; i--) {
|
|
587
|
+
const item = cols[i];
|
|
588
|
+
const colKey = colKeyGenValue(item);
|
|
589
|
+
if (item.fixed === "right") {
|
|
590
|
+
if (colKey) {
|
|
591
|
+
colKeyStore[colKey] = right;
|
|
592
|
+
} else {
|
|
593
|
+
refStore.set(item, right);
|
|
594
|
+
}
|
|
595
|
+
right += getCalculatedColWidth(item);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
return (col) => {
|
|
600
|
+
const colKey = colKeyGenValue(col);
|
|
601
|
+
return colKey ? colKeyStore[colKey] : refStore.get(col) || 0;
|
|
602
|
+
};
|
|
603
|
+
});
|
|
604
|
+
return getFixedColPosition;
|
|
605
|
+
}
|
|
606
|
+
function useHighlight({ props, stkTableId, tableContainerRef }) {
|
|
607
|
+
const config = props.highlightConfig;
|
|
608
|
+
const highlightColor = {
|
|
609
|
+
light: HIGHLIGHT_COLOR.light,
|
|
610
|
+
dark: HIGHLIGHT_COLOR.dark
|
|
611
|
+
};
|
|
612
|
+
const highlightDuration = config.duration ? config.duration * 1e3 : HIGHLIGHT_DURATION;
|
|
613
|
+
const highlightFrequency = config.fps && config.fps > 0 ? 1e3 / config.fps : null;
|
|
614
|
+
const highlightSteps = highlightFrequency ? Math.round(highlightDuration / highlightFrequency) : null;
|
|
615
|
+
const highlightFrom = computed(() => highlightColor[props.theme].from);
|
|
616
|
+
const highlightTo = computed(() => highlightColor[props.theme].to);
|
|
617
|
+
const highlightInter = computed(() => interpolateRgb(highlightFrom.value, highlightTo.value));
|
|
618
|
+
const highlightDimRowsJs = /* @__PURE__ */ new Map();
|
|
619
|
+
let calcHighlightDimLoopJs = false;
|
|
620
|
+
const highlightDimRowsAnimation = /* @__PURE__ */ new Map();
|
|
621
|
+
let calcHighlightDimLoopAnimation = false;
|
|
622
|
+
const highlightDimRowsTimeout = /* @__PURE__ */ new Map();
|
|
623
|
+
const highlightDimCellsTimeout = /* @__PURE__ */ new Map();
|
|
624
|
+
const defaultHighlightDimOption = (() => {
|
|
625
|
+
const keyframe = { backgroundColor: [highlightFrom.value, ""] };
|
|
626
|
+
if (highlightSteps) {
|
|
627
|
+
keyframe.easing = `steps(${highlightSteps})`;
|
|
628
|
+
}
|
|
629
|
+
return { duration: highlightDuration, keyframe };
|
|
630
|
+
})();
|
|
631
|
+
function calcRowHighlightLoop() {
|
|
632
|
+
if (calcHighlightDimLoopAnimation) return;
|
|
633
|
+
calcHighlightDimLoopAnimation = true;
|
|
634
|
+
const recursion = () => {
|
|
635
|
+
window.requestAnimationFrame(
|
|
636
|
+
() => {
|
|
637
|
+
const nowTs = Date.now();
|
|
638
|
+
highlightDimRowsAnimation.forEach((store, rowKeyValue) => {
|
|
639
|
+
const { ts, duration } = store;
|
|
640
|
+
const timeOffset = nowTs - ts;
|
|
641
|
+
if (nowTs - ts < duration) {
|
|
642
|
+
updateRowAnimation(rowKeyValue, store, timeOffset);
|
|
643
|
+
} else {
|
|
644
|
+
highlightDimRowsAnimation.delete(rowKeyValue);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
if (highlightDimRowsAnimation.size > 0) {
|
|
648
|
+
recursion();
|
|
649
|
+
} else {
|
|
650
|
+
calcHighlightDimLoopAnimation = false;
|
|
651
|
+
highlightDimRowsAnimation.clear();
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
);
|
|
655
|
+
};
|
|
656
|
+
recursion();
|
|
657
|
+
}
|
|
658
|
+
function calcRowHighlightLoopJs() {
|
|
659
|
+
if (calcHighlightDimLoopJs) return;
|
|
660
|
+
calcHighlightDimLoopJs = true;
|
|
661
|
+
const recursion = () => {
|
|
662
|
+
window.setTimeout(() => {
|
|
663
|
+
const nowTs = Date.now();
|
|
664
|
+
highlightDimRowsJs.forEach((highlightStart, rowKeyValue) => {
|
|
665
|
+
const progress = (nowTs - highlightStart) / highlightDuration;
|
|
666
|
+
let bgc = "";
|
|
667
|
+
if (0 <= progress && progress <= 1) {
|
|
668
|
+
bgc = highlightInter.value(progress);
|
|
669
|
+
} else {
|
|
670
|
+
highlightDimRowsJs.delete(rowKeyValue);
|
|
671
|
+
}
|
|
672
|
+
updateRowBgcJs(rowKeyValue, bgc);
|
|
673
|
+
});
|
|
674
|
+
if (highlightDimRowsJs.size > 0) {
|
|
675
|
+
recursion();
|
|
676
|
+
} else {
|
|
677
|
+
calcHighlightDimLoopJs = false;
|
|
678
|
+
highlightDimRowsJs.clear();
|
|
679
|
+
}
|
|
680
|
+
}, highlightFrequency || HIGHLIGHT_FREQ);
|
|
681
|
+
};
|
|
682
|
+
recursion();
|
|
683
|
+
}
|
|
684
|
+
function setHighlightDimCell(rowKeyValue, colKeyValue, option = {}) {
|
|
685
|
+
var _a;
|
|
686
|
+
const cellEl = (_a = tableContainerRef.value) == null ? void 0 : _a.querySelector(`[data-cell-key="${rowKeyValue}--${colKeyValue}"]`);
|
|
687
|
+
const { className, method, duration, keyframe } = {
|
|
688
|
+
className: HIGHLIGHT_CELL_CLASS,
|
|
689
|
+
method: "animation",
|
|
690
|
+
...defaultHighlightDimOption,
|
|
691
|
+
...option
|
|
692
|
+
};
|
|
693
|
+
if (!cellEl) return;
|
|
694
|
+
if (method === "animation") {
|
|
695
|
+
cellEl.animate(keyframe, duration);
|
|
696
|
+
} else {
|
|
697
|
+
highlightCellsInCssKeyFrame(cellEl, rowKeyValue, className, duration);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
function setHighlightDimRow(rowKeyValues, option = {}) {
|
|
701
|
+
if (!Array.isArray(rowKeyValues)) rowKeyValues = [rowKeyValues];
|
|
702
|
+
const { className, method, keyframe, duration } = {
|
|
703
|
+
className: HIGHLIGHT_ROW_CLASS,
|
|
704
|
+
method: "animation",
|
|
705
|
+
...defaultHighlightDimOption,
|
|
706
|
+
...option
|
|
707
|
+
};
|
|
708
|
+
if (method === "css") {
|
|
709
|
+
highlightRowsInCssKeyframe(rowKeyValues, className, duration);
|
|
710
|
+
} else if (method === "animation") {
|
|
711
|
+
if (props.virtual) {
|
|
712
|
+
const nowTs = Date.now();
|
|
713
|
+
for (let i = 0; i < rowKeyValues.length; i++) {
|
|
714
|
+
const rowKeyValue = rowKeyValues[i];
|
|
715
|
+
const store = { ts: nowTs, visible: false, keyframe, duration };
|
|
716
|
+
highlightDimRowsAnimation.set(rowKeyValue, store);
|
|
717
|
+
updateRowAnimation(rowKeyValue, store, 0);
|
|
718
|
+
}
|
|
719
|
+
calcRowHighlightLoop();
|
|
720
|
+
} else {
|
|
721
|
+
for (let i = 0; i < rowKeyValues.length; i++) {
|
|
722
|
+
const rowEl = document.getElementById(stkTableId + "-" + String(rowKeyValues[i]));
|
|
723
|
+
if (!rowEl) continue;
|
|
724
|
+
rowEl.animate(keyframe, duration);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
} else if (method === "js") {
|
|
728
|
+
const nowTs = Date.now();
|
|
729
|
+
for (let i = 0; i < rowKeyValues.length; i++) {
|
|
730
|
+
const rowKeyValue = rowKeyValues[i];
|
|
731
|
+
highlightDimRowsJs.set(rowKeyValue, nowTs);
|
|
732
|
+
updateRowBgcJs(rowKeyValue, highlightFrom.value);
|
|
733
|
+
}
|
|
734
|
+
calcRowHighlightLoopJs();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
function highlightRowsInCssKeyframe(rowKeyValues, className, duration) {
|
|
738
|
+
var _a;
|
|
739
|
+
let needRepaint = false;
|
|
740
|
+
const rowElTemp = [];
|
|
741
|
+
for (let i = 0; i < rowKeyValues.length; i++) {
|
|
742
|
+
const rowKeyValue = rowKeyValues[i];
|
|
743
|
+
const rowEl = document.getElementById(stkTableId + "-" + String(rowKeyValue));
|
|
744
|
+
if (!rowEl) continue;
|
|
745
|
+
if (rowEl.classList.contains(className)) {
|
|
746
|
+
rowEl.classList.remove(className);
|
|
747
|
+
needRepaint = true;
|
|
748
|
+
}
|
|
749
|
+
rowElTemp.push(rowEl);
|
|
750
|
+
window.clearTimeout(highlightDimRowsTimeout.get(rowKeyValue));
|
|
751
|
+
highlightDimRowsTimeout.set(
|
|
752
|
+
rowKeyValue,
|
|
753
|
+
window.setTimeout(() => {
|
|
754
|
+
rowEl.classList.remove(className);
|
|
755
|
+
highlightDimRowsTimeout.delete(rowKeyValue);
|
|
756
|
+
}, duration)
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
if (needRepaint) {
|
|
760
|
+
void ((_a = tableContainerRef.value) == null ? void 0 : _a.offsetWidth);
|
|
761
|
+
}
|
|
762
|
+
rowElTemp.forEach((el) => el.classList.add(className));
|
|
763
|
+
}
|
|
764
|
+
function highlightCellsInCssKeyFrame(cellEl, rowKeyValue, className, duration) {
|
|
765
|
+
if (cellEl.classList.contains(className)) {
|
|
766
|
+
cellEl.classList.remove(className);
|
|
767
|
+
void cellEl.offsetHeight;
|
|
768
|
+
}
|
|
769
|
+
cellEl.classList.add(className);
|
|
770
|
+
window.clearTimeout(highlightDimCellsTimeout.get(rowKeyValue));
|
|
771
|
+
highlightDimCellsTimeout.set(
|
|
772
|
+
rowKeyValue,
|
|
773
|
+
window.setTimeout(() => {
|
|
774
|
+
cellEl.classList.remove(className);
|
|
775
|
+
highlightDimCellsTimeout.delete(rowKeyValue);
|
|
776
|
+
}, duration)
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
function updateRowAnimation(rowKeyValue, store, timeOffset) {
|
|
780
|
+
const rowEl = document.getElementById(stkTableId + "-" + String(rowKeyValue));
|
|
781
|
+
const { visible, keyframe, duration: initialDuration } = store;
|
|
782
|
+
if (!rowEl) {
|
|
783
|
+
if (visible) {
|
|
784
|
+
store.visible = false;
|
|
785
|
+
}
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
if (!visible) {
|
|
789
|
+
store.visible = true;
|
|
790
|
+
const iterationStart = timeOffset / initialDuration;
|
|
791
|
+
rowEl.animate(keyframe, {
|
|
792
|
+
duration: initialDuration - timeOffset,
|
|
793
|
+
/** 从什么时候开始,0-1 */
|
|
794
|
+
iterationStart,
|
|
795
|
+
/** 持续多久 0-1 */
|
|
796
|
+
iterations: 1 - iterationStart
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function updateRowBgcJs(rowKeyValue, color) {
|
|
801
|
+
const rowEl = document.getElementById(stkTableId + "-" + String(rowKeyValue));
|
|
802
|
+
if (!rowEl) return;
|
|
803
|
+
rowEl.style.backgroundColor = color;
|
|
804
|
+
}
|
|
805
|
+
return {
|
|
806
|
+
highlightSteps,
|
|
807
|
+
setHighlightDimRow,
|
|
808
|
+
setHighlightDimCell
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
var ScrollCodes = /* @__PURE__ */ ((ScrollCodes2) => {
|
|
812
|
+
ScrollCodes2["ArrowUp"] = "ArrowUp";
|
|
813
|
+
ScrollCodes2["ArrowRight"] = "ArrowRight";
|
|
814
|
+
ScrollCodes2["ArrowDown"] = "ArrowDown";
|
|
815
|
+
ScrollCodes2["ArrowLeft"] = "ArrowLeft";
|
|
816
|
+
ScrollCodes2["PageUp"] = "PageUp";
|
|
817
|
+
ScrollCodes2["PageDown"] = "PageDown";
|
|
818
|
+
return ScrollCodes2;
|
|
819
|
+
})(ScrollCodes || {});
|
|
820
|
+
const ScrollCodesValues = Object.values(ScrollCodes);
|
|
821
|
+
function useKeyboardArrowScroll(targetElement, { props, scrollTo, virtualScroll, virtualScrollX, tableHeaders, virtual_on }) {
|
|
822
|
+
let isMouseOver = false;
|
|
823
|
+
watch(virtual_on, (val) => {
|
|
824
|
+
if (!val) {
|
|
825
|
+
removeListeners();
|
|
826
|
+
} else {
|
|
827
|
+
addEventListeners();
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
onMounted(addEventListeners);
|
|
831
|
+
onBeforeUnmount(removeListeners);
|
|
832
|
+
function addEventListeners() {
|
|
833
|
+
var _a, _b, _c;
|
|
834
|
+
window.addEventListener("keydown", handleKeydown);
|
|
835
|
+
(_a = targetElement.value) == null ? void 0 : _a.addEventListener("mouseenter", handleMouseEnter);
|
|
836
|
+
(_b = targetElement.value) == null ? void 0 : _b.addEventListener("mouseleave", handleMouseLeave);
|
|
837
|
+
(_c = targetElement.value) == null ? void 0 : _c.addEventListener("mousedown", handleMouseDown);
|
|
838
|
+
}
|
|
839
|
+
function removeListeners() {
|
|
840
|
+
var _a, _b, _c;
|
|
841
|
+
window.removeEventListener("keydown", handleKeydown);
|
|
842
|
+
(_a = targetElement.value) == null ? void 0 : _a.removeEventListener("mouseenter", handleMouseEnter);
|
|
843
|
+
(_b = targetElement.value) == null ? void 0 : _b.removeEventListener("mouseleave", handleMouseLeave);
|
|
844
|
+
(_c = targetElement.value) == null ? void 0 : _c.removeEventListener("mousedown", handleMouseDown);
|
|
845
|
+
}
|
|
846
|
+
function handleKeydown(e) {
|
|
847
|
+
if (!virtual_on.value) return;
|
|
848
|
+
if (!ScrollCodesValues.includes(e.code)) return;
|
|
849
|
+
if (!isMouseOver) return;
|
|
850
|
+
e.preventDefault();
|
|
851
|
+
const { scrollTop, rowHeight, containerHeight } = virtualScroll.value;
|
|
852
|
+
const { scrollLeft } = virtualScrollX.value;
|
|
853
|
+
const { headless, headerRowHeight } = props;
|
|
854
|
+
const headerHeight = headless ? 0 : tableHeaders.value.length * (headerRowHeight || rowHeight);
|
|
855
|
+
const bodyPageSize = Math.floor((containerHeight - headerHeight) / rowHeight);
|
|
856
|
+
if (e.code === "ArrowUp") {
|
|
857
|
+
scrollTo(scrollTop - rowHeight, null);
|
|
858
|
+
} else if (e.code === "ArrowRight") {
|
|
859
|
+
scrollTo(null, scrollLeft + rowHeight);
|
|
860
|
+
} else if (e.code === "ArrowDown") {
|
|
861
|
+
scrollTo(scrollTop + rowHeight, null);
|
|
862
|
+
} else if (e.code === "ArrowLeft") {
|
|
863
|
+
scrollTo(null, scrollLeft - rowHeight);
|
|
864
|
+
} else if (e.code === "PageUp") {
|
|
865
|
+
scrollTo(scrollTop - rowHeight * bodyPageSize + headerHeight, null);
|
|
866
|
+
} else if (e.code === "PageDown") {
|
|
867
|
+
scrollTo(scrollTop + rowHeight * bodyPageSize - headerHeight, null);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
function handleMouseEnter() {
|
|
871
|
+
isMouseOver = true;
|
|
872
|
+
}
|
|
873
|
+
function handleMouseLeave() {
|
|
874
|
+
isMouseOver = false;
|
|
875
|
+
}
|
|
876
|
+
function handleMouseDown() {
|
|
877
|
+
if (!isMouseOver) isMouseOver = true;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
function useThDrag({ props, emits, colKeyGen }) {
|
|
881
|
+
const findParentTH = (e) => e.target.closest("th");
|
|
882
|
+
const dragConfig = computed(() => {
|
|
883
|
+
const headerDrag = props.headerDrag;
|
|
884
|
+
const draggable = headerDrag !== false;
|
|
885
|
+
return {
|
|
886
|
+
draggable,
|
|
887
|
+
mode: "insert",
|
|
888
|
+
disabled: () => false,
|
|
889
|
+
...headerDrag
|
|
890
|
+
};
|
|
891
|
+
});
|
|
892
|
+
function onThDragStart(e) {
|
|
893
|
+
const th = findParentTH(e);
|
|
894
|
+
if (!th) return;
|
|
895
|
+
const dragStartKey = th.dataset.colKey || "";
|
|
896
|
+
const dt = e.dataTransfer;
|
|
897
|
+
if (dt) {
|
|
898
|
+
dt.effectAllowed = "move";
|
|
899
|
+
dt.setData("text/plain", dragStartKey);
|
|
900
|
+
}
|
|
901
|
+
emits("th-drag-start", dragStartKey);
|
|
902
|
+
}
|
|
903
|
+
function onThDragOver(e) {
|
|
904
|
+
const th = findParentTH(e);
|
|
905
|
+
if (!th) return;
|
|
906
|
+
const isHeaderDraggable = th.getAttribute("draggable") === "true";
|
|
907
|
+
if (!isHeaderDraggable) return;
|
|
908
|
+
const dt = e.dataTransfer;
|
|
909
|
+
if (dt) {
|
|
910
|
+
dt.dropEffect = "move";
|
|
911
|
+
}
|
|
912
|
+
e.preventDefault();
|
|
913
|
+
}
|
|
914
|
+
function onThDrop(e) {
|
|
915
|
+
var _a;
|
|
916
|
+
const th = findParentTH(e);
|
|
917
|
+
if (!th) return;
|
|
918
|
+
const dragStartKey = (_a = e.dataTransfer) == null ? void 0 : _a.getData("text");
|
|
919
|
+
if (dragStartKey !== th.dataset.colKey) {
|
|
920
|
+
handleColOrderChange(dragStartKey, th.dataset.colKey);
|
|
921
|
+
}
|
|
922
|
+
emits("th-drop", th.dataset.colKey);
|
|
923
|
+
}
|
|
924
|
+
function handleColOrderChange(dragStartKey, dragEndKey) {
|
|
925
|
+
if (isEmptyValue(dragStartKey) || isEmptyValue(dragEndKey)) return;
|
|
926
|
+
if (dragConfig.value.mode !== "none") {
|
|
927
|
+
const columns = props.columns.slice();
|
|
928
|
+
const dragStartIndex = columns.findIndex((col) => colKeyGen.value(col) === dragStartKey);
|
|
929
|
+
const dragEndIndex = columns.findIndex((col) => colKeyGen.value(col) === dragEndKey);
|
|
930
|
+
if (dragStartIndex === -1 || dragEndIndex === -1) return;
|
|
931
|
+
const dragStartCol = columns[dragStartIndex];
|
|
932
|
+
if (dragConfig.value.mode === "swap") {
|
|
933
|
+
columns[dragStartIndex] = columns[dragEndIndex];
|
|
934
|
+
columns[dragEndIndex] = dragStartCol;
|
|
935
|
+
} else {
|
|
936
|
+
columns.splice(dragStartIndex, 1);
|
|
937
|
+
columns.splice(dragEndIndex, 0, dragStartCol);
|
|
938
|
+
}
|
|
939
|
+
emits("update:columns", columns);
|
|
940
|
+
}
|
|
941
|
+
emits("col-order-change", dragStartKey, dragEndKey);
|
|
942
|
+
}
|
|
943
|
+
return {
|
|
944
|
+
onThDragStart,
|
|
945
|
+
onThDragOver,
|
|
946
|
+
onThDrop,
|
|
947
|
+
/** 是否可拖拽 */
|
|
948
|
+
isHeaderDraggable: (col) => dragConfig.value.draggable && !dragConfig.value.disabled(col)
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
const TR_DRAGGING_CLASS = "tr-dragging";
|
|
952
|
+
const TR_DRAG_OVER_CLASS = "tr-dragging-over";
|
|
953
|
+
const DATA_TRANSFER_FORMAT = "text/plain";
|
|
954
|
+
function useTrDrag({ props, emits, dataSourceCopy }) {
|
|
955
|
+
let trDragFlag = false;
|
|
956
|
+
const dragRowConfig = computed(() => {
|
|
957
|
+
return { mode: "insert", ...props.dragRowConfig };
|
|
958
|
+
});
|
|
959
|
+
function getClosestTr(e) {
|
|
960
|
+
const target = e.target;
|
|
961
|
+
const tr = target == null ? void 0 : target.closest("tr");
|
|
962
|
+
return tr;
|
|
963
|
+
}
|
|
964
|
+
function onTrDragStart(e, rowIndex) {
|
|
965
|
+
var _a;
|
|
966
|
+
const tr = getClosestTr(e);
|
|
967
|
+
if (tr) {
|
|
968
|
+
const trRect = tr.getBoundingClientRect();
|
|
969
|
+
const x = e.clientX - (trRect.left ?? 0);
|
|
970
|
+
(_a = e.dataTransfer) == null ? void 0 : _a.setDragImage(tr, x, trRect.height / 2);
|
|
971
|
+
tr.classList.add(TR_DRAGGING_CLASS);
|
|
972
|
+
}
|
|
973
|
+
const dt = e.dataTransfer;
|
|
974
|
+
if (dt) {
|
|
975
|
+
dt.effectAllowed = "move";
|
|
976
|
+
dt.setData(DATA_TRANSFER_FORMAT, String(rowIndex));
|
|
977
|
+
}
|
|
978
|
+
trDragFlag = true;
|
|
979
|
+
}
|
|
980
|
+
function onTrDragOver(e) {
|
|
981
|
+
if (!trDragFlag) return;
|
|
982
|
+
e.preventDefault();
|
|
983
|
+
const dt = e.dataTransfer;
|
|
984
|
+
if (dt) {
|
|
985
|
+
dt.dropEffect = "move";
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
let oldTr = null;
|
|
989
|
+
function onTrDragEnter(e) {
|
|
990
|
+
if (!trDragFlag) return;
|
|
991
|
+
e.preventDefault();
|
|
992
|
+
const tr = getClosestTr(e);
|
|
993
|
+
if (oldTr && oldTr !== tr) {
|
|
994
|
+
oldTr.classList.remove(TR_DRAG_OVER_CLASS);
|
|
995
|
+
}
|
|
996
|
+
if (tr) {
|
|
997
|
+
oldTr = tr;
|
|
998
|
+
tr.classList.add(TR_DRAG_OVER_CLASS);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
function onTrDragEnd(e) {
|
|
1002
|
+
if (!trDragFlag) return;
|
|
1003
|
+
const tr = getClosestTr(e);
|
|
1004
|
+
if (tr) {
|
|
1005
|
+
tr.classList.remove(TR_DRAGGING_CLASS);
|
|
1006
|
+
}
|
|
1007
|
+
if (oldTr) {
|
|
1008
|
+
oldTr.classList.remove(TR_DRAG_OVER_CLASS);
|
|
1009
|
+
oldTr = null;
|
|
1010
|
+
}
|
|
1011
|
+
trDragFlag = false;
|
|
1012
|
+
}
|
|
1013
|
+
function onTrDrop(e, rowIndex) {
|
|
1014
|
+
if (!trDragFlag) return;
|
|
1015
|
+
const dt = e.dataTransfer;
|
|
1016
|
+
if (!dt) return;
|
|
1017
|
+
const mode = dragRowConfig.value.mode;
|
|
1018
|
+
const sourceIndex = Number(dt.getData(DATA_TRANSFER_FORMAT));
|
|
1019
|
+
const endIndex = rowIndex;
|
|
1020
|
+
if (sourceIndex === endIndex) return;
|
|
1021
|
+
if (mode !== "none") {
|
|
1022
|
+
const dataSourceTemp = dataSourceCopy.value.slice();
|
|
1023
|
+
const sourceRow = dataSourceTemp[sourceIndex];
|
|
1024
|
+
if (mode === "swap") {
|
|
1025
|
+
dataSourceTemp[sourceIndex] = dataSourceTemp[endIndex];
|
|
1026
|
+
dataSourceTemp[endIndex] = sourceRow;
|
|
1027
|
+
} else {
|
|
1028
|
+
dataSourceTemp.splice(sourceIndex, 1);
|
|
1029
|
+
dataSourceTemp.splice(endIndex, 0, sourceRow);
|
|
1030
|
+
}
|
|
1031
|
+
dataSourceCopy.value = dataSourceTemp;
|
|
1032
|
+
}
|
|
1033
|
+
emits("row-order-change", sourceIndex, endIndex);
|
|
1034
|
+
}
|
|
1035
|
+
return {
|
|
1036
|
+
dragRowConfig,
|
|
1037
|
+
onTrDragStart,
|
|
1038
|
+
onTrDragEnter,
|
|
1039
|
+
onTrDragOver,
|
|
1040
|
+
onTrDrop,
|
|
1041
|
+
onTrDragEnd
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
const VUE2_SCROLL_TIMEOUT_MS = 200;
|
|
1045
|
+
function useVirtualScroll({
|
|
1046
|
+
props,
|
|
1047
|
+
tableContainerRef,
|
|
1048
|
+
trRef,
|
|
1049
|
+
dataSourceCopy,
|
|
1050
|
+
tableHeaderLast,
|
|
1051
|
+
tableHeaders,
|
|
1052
|
+
rowKeyGen
|
|
1053
|
+
}) {
|
|
1054
|
+
const tableHeaderHeight = ref(props.headerRowHeight);
|
|
1055
|
+
const virtualScroll = ref({
|
|
1056
|
+
containerHeight: 0,
|
|
1057
|
+
rowHeight: props.rowHeight,
|
|
1058
|
+
pageSize: 10,
|
|
1059
|
+
startIndex: 0,
|
|
1060
|
+
endIndex: 0,
|
|
1061
|
+
offsetTop: 0,
|
|
1062
|
+
scrollTop: 0,
|
|
1063
|
+
scrollHeight: 0
|
|
1064
|
+
});
|
|
1065
|
+
const virtualScrollX = ref({
|
|
1066
|
+
containerWidth: 0,
|
|
1067
|
+
scrollWidth: 0,
|
|
1068
|
+
startIndex: 0,
|
|
1069
|
+
endIndex: 0,
|
|
1070
|
+
offsetLeft: 0,
|
|
1071
|
+
scrollLeft: 0
|
|
1072
|
+
});
|
|
1073
|
+
const hasExpandCol = computed(() => {
|
|
1074
|
+
return tableHeaderLast.value.some((col) => col.type === "expand");
|
|
1075
|
+
});
|
|
1076
|
+
const virtual_on = computed(() => {
|
|
1077
|
+
return props.virtual && dataSourceCopy.value.length > virtualScroll.value.pageSize * 2;
|
|
1078
|
+
});
|
|
1079
|
+
const virtual_dataSourcePart = computed(() => {
|
|
1080
|
+
if (!virtual_on.value) return dataSourceCopy.value;
|
|
1081
|
+
const { startIndex, endIndex } = virtualScroll.value;
|
|
1082
|
+
return dataSourceCopy.value.slice(startIndex, endIndex + 1);
|
|
1083
|
+
});
|
|
1084
|
+
const virtual_offsetBottom = computed(() => {
|
|
1085
|
+
if (!virtual_on.value) return 0;
|
|
1086
|
+
const { startIndex, rowHeight } = virtualScroll.value;
|
|
1087
|
+
return (dataSourceCopy.value.length - startIndex - virtual_dataSourcePart.value.length) * rowHeight;
|
|
1088
|
+
});
|
|
1089
|
+
const virtualX_on = computed(() => {
|
|
1090
|
+
return props.virtualX && tableHeaderLast.value.reduce((sum, col) => sum += getCalculatedColWidth(col), 0) > virtualScrollX.value.containerWidth + 100;
|
|
1091
|
+
});
|
|
1092
|
+
const virtualX_columnPart = computed(() => {
|
|
1093
|
+
const tableHeaderLastValue = tableHeaderLast.value;
|
|
1094
|
+
if (virtualX_on.value) {
|
|
1095
|
+
const leftCols = [];
|
|
1096
|
+
const rightCols = [];
|
|
1097
|
+
const { startIndex, endIndex } = virtualScrollX.value;
|
|
1098
|
+
for (let i = 0; i < startIndex; i++) {
|
|
1099
|
+
const col = tableHeaderLastValue[i];
|
|
1100
|
+
if ((col == null ? void 0 : col.fixed) === "left") leftCols.push(col);
|
|
1101
|
+
}
|
|
1102
|
+
for (let i = endIndex; i < tableHeaderLastValue.length; i++) {
|
|
1103
|
+
const col = tableHeaderLastValue[i];
|
|
1104
|
+
if ((col == null ? void 0 : col.fixed) === "right") rightCols.push(col);
|
|
1105
|
+
}
|
|
1106
|
+
const mainColumns = tableHeaderLastValue.slice(startIndex, endIndex);
|
|
1107
|
+
return leftCols.concat(mainColumns).concat(rightCols);
|
|
1108
|
+
}
|
|
1109
|
+
return tableHeaderLastValue;
|
|
1110
|
+
});
|
|
1111
|
+
const virtualX_offsetRight = computed(() => {
|
|
1112
|
+
if (!virtualX_on.value) return 0;
|
|
1113
|
+
let width = 0;
|
|
1114
|
+
const tableHeaderLastValue = tableHeaderLast.value;
|
|
1115
|
+
for (let i = virtualScrollX.value.endIndex; i < tableHeaderLastValue.length; i++) {
|
|
1116
|
+
const col = tableHeaderLastValue[i];
|
|
1117
|
+
if (col.fixed !== "right") {
|
|
1118
|
+
width += getCalculatedColWidth(col);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
return width;
|
|
1122
|
+
});
|
|
1123
|
+
function getTableHeaderHeight() {
|
|
1124
|
+
const { headerRowHeight } = props;
|
|
1125
|
+
return headerRowHeight * tableHeaders.value.length;
|
|
1126
|
+
}
|
|
1127
|
+
function initVirtualScroll(height) {
|
|
1128
|
+
initVirtualScrollY(height);
|
|
1129
|
+
initVirtualScrollX();
|
|
1130
|
+
}
|
|
1131
|
+
function initVirtualScrollY(height) {
|
|
1132
|
+
var _a;
|
|
1133
|
+
if (height !== void 0 && typeof height !== "number") {
|
|
1134
|
+
console.warn("initVirtualScrollY: height must be a number");
|
|
1135
|
+
height = 0;
|
|
1136
|
+
}
|
|
1137
|
+
if (!virtual_on.value) return;
|
|
1138
|
+
const { offsetHeight, scrollHeight } = tableContainerRef.value || {};
|
|
1139
|
+
let scrollTop = ((_a = tableContainerRef.value) == null ? void 0 : _a.scrollTop) || 0;
|
|
1140
|
+
const { rowHeight } = virtualScroll.value;
|
|
1141
|
+
const containerHeight = height || offsetHeight || DEFAULT_TABLE_HEIGHT;
|
|
1142
|
+
const { headless } = props;
|
|
1143
|
+
let pageSize = Math.ceil(containerHeight / rowHeight);
|
|
1144
|
+
const headerHeight = getTableHeaderHeight();
|
|
1145
|
+
tableHeaderHeight.value = headerHeight;
|
|
1146
|
+
if (!headless) {
|
|
1147
|
+
const headerToBodyRowHeightCount = Math.floor(headerHeight / rowHeight);
|
|
1148
|
+
pageSize -= headerToBodyRowHeightCount;
|
|
1149
|
+
}
|
|
1150
|
+
const maxScrollTop = dataSourceCopy.value.length * rowHeight + tableHeaderHeight.value - containerHeight;
|
|
1151
|
+
if (scrollTop > maxScrollTop) {
|
|
1152
|
+
scrollTop = maxScrollTop;
|
|
1153
|
+
}
|
|
1154
|
+
Object.assign(virtualScroll.value, { containerHeight, pageSize, scrollHeight });
|
|
1155
|
+
updateVirtualScrollY(scrollTop);
|
|
1156
|
+
}
|
|
1157
|
+
function initVirtualScrollX() {
|
|
1158
|
+
const { clientWidth, scrollLeft, scrollWidth } = tableContainerRef.value || {};
|
|
1159
|
+
virtualScrollX.value.containerWidth = clientWidth || DEFAULT_TABLE_WIDTH;
|
|
1160
|
+
virtualScrollX.value.scrollWidth = scrollWidth || DEFAULT_TABLE_WIDTH;
|
|
1161
|
+
updateVirtualScrollX(scrollLeft);
|
|
1162
|
+
}
|
|
1163
|
+
let vue2ScrollYTimeout = null;
|
|
1164
|
+
const autoRowHeightMap = /* @__PURE__ */ new Map();
|
|
1165
|
+
function setAutoHeight(rowKey, height) {
|
|
1166
|
+
if (!height) {
|
|
1167
|
+
autoRowHeightMap.delete(rowKey);
|
|
1168
|
+
} else {
|
|
1169
|
+
autoRowHeightMap.set(rowKey, height);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
function clearAllAutoHeight() {
|
|
1173
|
+
autoRowHeightMap.clear();
|
|
1174
|
+
}
|
|
1175
|
+
function getAutoRowHeight(row) {
|
|
1176
|
+
var _a;
|
|
1177
|
+
const rowKey = String(rowKeyGen(row));
|
|
1178
|
+
const storedHeight = autoRowHeightMap.get(rowKey);
|
|
1179
|
+
if (storedHeight) {
|
|
1180
|
+
return storedHeight;
|
|
1181
|
+
}
|
|
1182
|
+
const expectedHeight = (_a = props.autoRowHeight) == null ? void 0 : _a.expectedHeight;
|
|
1183
|
+
if (expectedHeight) {
|
|
1184
|
+
if (typeof expectedHeight === "function") {
|
|
1185
|
+
return expectedHeight(row);
|
|
1186
|
+
} else {
|
|
1187
|
+
return expectedHeight;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return props.rowHeight || DEFAULT_ROW_HEIGHT;
|
|
1191
|
+
}
|
|
1192
|
+
function createGetRowHeightFn() {
|
|
1193
|
+
var _a;
|
|
1194
|
+
if (props.autoRowHeight) {
|
|
1195
|
+
return (row) => getAutoRowHeight(row);
|
|
1196
|
+
}
|
|
1197
|
+
if (hasExpandCol.value) {
|
|
1198
|
+
const { rowHeight } = virtualScroll.value;
|
|
1199
|
+
const expandedRowHeight = ((_a = props.expandConfig) == null ? void 0 : _a.height) || rowHeight;
|
|
1200
|
+
return (row) => row.__EXPANDED_ROW__ ? expandedRowHeight : rowHeight;
|
|
1201
|
+
}
|
|
1202
|
+
return () => props.rowHeight || DEFAULT_ROW_HEIGHT;
|
|
1203
|
+
}
|
|
1204
|
+
function updateVirtualScrollY(sTop = 0) {
|
|
1205
|
+
var _a;
|
|
1206
|
+
const { rowHeight, pageSize, scrollTop, startIndex: oldStartIndex, endIndex: oldEndIndex } = virtualScroll.value;
|
|
1207
|
+
virtualScroll.value.scrollTop = sTop;
|
|
1208
|
+
if (!virtual_on.value) {
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
const dataSourceCopyTemp = dataSourceCopy.value;
|
|
1212
|
+
const { autoRowHeight, stripe, optimizeVue2Scroll } = props;
|
|
1213
|
+
let startIndex = 0;
|
|
1214
|
+
let autoRowHeightTop = 0;
|
|
1215
|
+
let getRowHeight = null;
|
|
1216
|
+
const dataLength = dataSourceCopyTemp.length;
|
|
1217
|
+
if (autoRowHeight || hasExpandCol.value) {
|
|
1218
|
+
if (autoRowHeight) {
|
|
1219
|
+
(_a = trRef.value) == null ? void 0 : _a.forEach((tr) => {
|
|
1220
|
+
const { rowKey } = tr.dataset;
|
|
1221
|
+
if (!rowKey || autoRowHeightMap.has(rowKey)) return;
|
|
1222
|
+
autoRowHeightMap.set(rowKey, tr.offsetHeight);
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
getRowHeight = createGetRowHeightFn();
|
|
1226
|
+
for (let i = 0; i < dataLength; i++) {
|
|
1227
|
+
const height = getRowHeight(dataSourceCopyTemp[i]);
|
|
1228
|
+
autoRowHeightTop += height;
|
|
1229
|
+
if (autoRowHeightTop >= sTop) {
|
|
1230
|
+
startIndex = i;
|
|
1231
|
+
autoRowHeightTop -= height;
|
|
1232
|
+
break;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
} else {
|
|
1236
|
+
startIndex = Math.floor(sTop / rowHeight);
|
|
1237
|
+
}
|
|
1238
|
+
let endIndex = startIndex + pageSize;
|
|
1239
|
+
if (stripe && startIndex > 0 && startIndex % 2) {
|
|
1240
|
+
startIndex -= 1;
|
|
1241
|
+
if (autoRowHeight || hasExpandCol.value) {
|
|
1242
|
+
const height = getRowHeight(dataSourceCopyTemp[startIndex]);
|
|
1243
|
+
autoRowHeightTop -= height;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
startIndex = Math.max(0, startIndex);
|
|
1247
|
+
endIndex = Math.min(endIndex, dataLength);
|
|
1248
|
+
if (startIndex >= endIndex) {
|
|
1249
|
+
startIndex = endIndex - pageSize;
|
|
1250
|
+
}
|
|
1251
|
+
if (vue2ScrollYTimeout) {
|
|
1252
|
+
window.clearTimeout(vue2ScrollYTimeout);
|
|
1253
|
+
}
|
|
1254
|
+
let offsetTop = 0;
|
|
1255
|
+
if (autoRowHeight || hasExpandCol.value) {
|
|
1256
|
+
offsetTop = autoRowHeightTop;
|
|
1257
|
+
} else {
|
|
1258
|
+
if (oldStartIndex === startIndex && oldEndIndex === endIndex) {
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
offsetTop = startIndex * rowHeight;
|
|
1262
|
+
}
|
|
1263
|
+
if (!optimizeVue2Scroll || sTop <= scrollTop || Math.abs(oldStartIndex - startIndex) >= pageSize) {
|
|
1264
|
+
Object.assign(virtualScroll.value, { startIndex, endIndex, offsetTop });
|
|
1265
|
+
} else {
|
|
1266
|
+
virtualScroll.value.endIndex = endIndex;
|
|
1267
|
+
vue2ScrollYTimeout = window.setTimeout(() => {
|
|
1268
|
+
Object.assign(virtualScroll.value, { startIndex, offsetTop });
|
|
1269
|
+
}, VUE2_SCROLL_TIMEOUT_MS);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
let vue2ScrollXTimeout = null;
|
|
1273
|
+
function updateVirtualScrollX(sLeft = 0) {
|
|
1274
|
+
if (!props.virtualX) return;
|
|
1275
|
+
const tableHeaderLastValue = tableHeaderLast.value;
|
|
1276
|
+
const headerLength = tableHeaderLastValue == null ? void 0 : tableHeaderLastValue.length;
|
|
1277
|
+
if (!headerLength) return;
|
|
1278
|
+
const { scrollLeft, containerWidth } = virtualScrollX.value;
|
|
1279
|
+
let startIndex = 0;
|
|
1280
|
+
let offsetLeft = 0;
|
|
1281
|
+
let colWidthSum = 0;
|
|
1282
|
+
let leftColWidthSum = 0;
|
|
1283
|
+
let leftFirstColRestWidth = 0;
|
|
1284
|
+
for (let colIndex = 0; colIndex < headerLength; colIndex++) {
|
|
1285
|
+
const col = tableHeaderLastValue[colIndex];
|
|
1286
|
+
const colWidth = getCalculatedColWidth(col);
|
|
1287
|
+
startIndex++;
|
|
1288
|
+
if (col.fixed === "left") {
|
|
1289
|
+
leftColWidthSum += colWidth;
|
|
1290
|
+
continue;
|
|
1291
|
+
}
|
|
1292
|
+
colWidthSum += colWidth;
|
|
1293
|
+
if (colWidthSum >= sLeft) {
|
|
1294
|
+
offsetLeft = colWidthSum - colWidth;
|
|
1295
|
+
startIndex--;
|
|
1296
|
+
leftFirstColRestWidth = colWidthSum - sLeft;
|
|
1297
|
+
break;
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
colWidthSum = leftFirstColRestWidth;
|
|
1301
|
+
const containerW = containerWidth - leftColWidthSum;
|
|
1302
|
+
let endIndex = headerLength;
|
|
1303
|
+
for (let colIndex = startIndex + 1; colIndex < headerLength; colIndex++) {
|
|
1304
|
+
const col = tableHeaderLastValue[colIndex];
|
|
1305
|
+
colWidthSum += getCalculatedColWidth(col);
|
|
1306
|
+
if (colWidthSum >= containerW) {
|
|
1307
|
+
endIndex = colIndex + 1;
|
|
1308
|
+
break;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
endIndex = Math.min(endIndex, headerLength);
|
|
1312
|
+
if (vue2ScrollXTimeout) {
|
|
1313
|
+
window.clearTimeout(vue2ScrollXTimeout);
|
|
1314
|
+
}
|
|
1315
|
+
if (!props.optimizeVue2Scroll || sLeft <= scrollLeft) {
|
|
1316
|
+
Object.assign(virtualScrollX.value, { startIndex, endIndex, offsetLeft, scrollLeft: sLeft });
|
|
1317
|
+
} else {
|
|
1318
|
+
Object.assign(virtualScrollX.value, { endIndex, scrollLeft: sLeft });
|
|
1319
|
+
vue2ScrollXTimeout = window.setTimeout(() => {
|
|
1320
|
+
Object.assign(virtualScrollX.value, { startIndex, offsetLeft });
|
|
1321
|
+
}, VUE2_SCROLL_TIMEOUT_MS);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return {
|
|
1325
|
+
virtualScroll,
|
|
1326
|
+
virtualScrollX,
|
|
1327
|
+
virtual_on,
|
|
1328
|
+
virtual_dataSourcePart,
|
|
1329
|
+
virtual_offsetBottom,
|
|
1330
|
+
virtualX_on,
|
|
1331
|
+
virtualX_columnPart,
|
|
1332
|
+
virtualX_offsetRight,
|
|
1333
|
+
initVirtualScroll,
|
|
1334
|
+
initVirtualScrollY,
|
|
1335
|
+
initVirtualScrollX,
|
|
1336
|
+
updateVirtualScrollY,
|
|
1337
|
+
updateVirtualScrollX,
|
|
1338
|
+
setAutoHeight,
|
|
1339
|
+
clearAllAutoHeight
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
const _hoisted_1 = ["data-col-key", "draggable", "rowspan", "colspan", "title", "onClick"];
|
|
1343
|
+
const _hoisted_2 = ["onMousedown"];
|
|
1344
|
+
const _hoisted_3 = { class: "table-header-title" };
|
|
1345
|
+
const _hoisted_4 = ["onMousedown"];
|
|
1346
|
+
const _hoisted_5 = {
|
|
1347
|
+
key: 0,
|
|
1348
|
+
class: "vt-x-left"
|
|
1349
|
+
};
|
|
1350
|
+
const _hoisted_6 = ["id", "data-row-key", "onClick", "onDblclick", "onContextmenu", "onMouseover", "onDrop"];
|
|
1351
|
+
const _hoisted_7 = {
|
|
1352
|
+
key: 0,
|
|
1353
|
+
class: "vt-x-left"
|
|
1354
|
+
};
|
|
1355
|
+
const _hoisted_8 = ["colspan"];
|
|
1356
|
+
const _hoisted_9 = { class: "table-cell-wrapper" };
|
|
1357
|
+
const _hoisted_10 = ["data-cell-key", "onClick", "onMousedown", "onMouseenter", "onMouseleave", "onMouseover"];
|
|
1358
|
+
const _hoisted_11 = ["title"];
|
|
1359
|
+
const _hoisted_12 = { key: 1 };
|
|
1360
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1361
|
+
__name: "StkTable",
|
|
1362
|
+
props: {
|
|
1363
|
+
width: { default: "" },
|
|
1364
|
+
minWidth: { default: "" },
|
|
1365
|
+
maxWidth: { default: "" },
|
|
1366
|
+
stripe: { type: Boolean, default: false },
|
|
1367
|
+
fixedMode: { type: Boolean, default: false },
|
|
1368
|
+
headless: { type: Boolean, default: false },
|
|
1369
|
+
theme: { default: "light" },
|
|
1370
|
+
rowHeight: { default: DEFAULT_ROW_HEIGHT },
|
|
1371
|
+
autoRowHeight: { type: Boolean, default: false },
|
|
1372
|
+
rowHover: { type: Boolean, default: true },
|
|
1373
|
+
rowActive: { type: Boolean, default: true },
|
|
1374
|
+
rowCurrentRevokable: { type: Boolean, default: true },
|
|
1375
|
+
headerRowHeight: { default: DEFAULT_ROW_HEIGHT },
|
|
1376
|
+
virtual: { type: Boolean, default: false },
|
|
1377
|
+
virtualX: { type: Boolean, default: false },
|
|
1378
|
+
columns: { default: () => [] },
|
|
1379
|
+
dataSource: { default: () => [] },
|
|
1380
|
+
rowKey: { type: [String, Number, Function], default: "" },
|
|
1381
|
+
colKey: { type: [String, Number, Function], default: "dataIndex" },
|
|
1382
|
+
emptyCellText: { type: [String, Function], default: "--" },
|
|
1383
|
+
noDataFull: { type: Boolean, default: false },
|
|
1384
|
+
showNoData: { type: Boolean, default: true },
|
|
1385
|
+
sortRemote: { type: Boolean, default: false },
|
|
1386
|
+
showHeaderOverflow: { type: Boolean, default: false },
|
|
1387
|
+
showOverflow: { type: Boolean, default: false },
|
|
1388
|
+
showTrHoverClass: { type: Boolean, default: false },
|
|
1389
|
+
cellHover: { type: Boolean, default: false },
|
|
1390
|
+
cellActive: { type: Boolean, default: false },
|
|
1391
|
+
selectedCellRevokable: { type: Boolean, default: true },
|
|
1392
|
+
headerDrag: { default: false },
|
|
1393
|
+
rowClassName: { type: Function, default: () => "" },
|
|
1394
|
+
colResizable: { type: Boolean, default: false },
|
|
1395
|
+
colMinWidth: { default: 10 },
|
|
1396
|
+
bordered: { type: [Boolean, String], default: true },
|
|
1397
|
+
autoResize: { type: [Boolean, Function], default: true },
|
|
1398
|
+
fixedColShadow: { type: Boolean, default: false },
|
|
1399
|
+
optimizeVue2Scroll: { type: Boolean, default: false },
|
|
1400
|
+
sortConfig: { default: () => ({
|
|
1401
|
+
emptyToBottom: false,
|
|
1402
|
+
stringLocaleCompare: false
|
|
1403
|
+
}) },
|
|
1404
|
+
hideHeaderTitle: { type: [Boolean, Array], default: false },
|
|
1405
|
+
highlightConfig: { default: () => ({}) },
|
|
1406
|
+
seqConfig: { default: () => ({}) },
|
|
1407
|
+
expandConfig: { default: () => ({}) },
|
|
1408
|
+
dragRowConfig: { default: () => ({}) },
|
|
1409
|
+
cellFixedMode: { default: "sticky" },
|
|
1410
|
+
smoothScroll: { type: Boolean, default: DEFAULT_SMOOTH_SCROLL },
|
|
1411
|
+
scrollRowByRow: { type: Boolean, default: false }
|
|
1412
|
+
},
|
|
1413
|
+
emits: ["sort-change", "row-click", "current-change", "cell-selected", "row-dblclick", "header-row-menu", "row-menu", "cell-click", "cell-mouseenter", "cell-mouseleave", "cell-mouseover", "cell-mousedown", "header-cell-click", "scroll", "scroll-x", "col-order-change", "th-drag-start", "th-drop", "row-order-change", "col-resize", "toggle-row-expand", "update:columns"],
|
|
1414
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1415
|
+
const stkTableId = createStkTableId();
|
|
1416
|
+
const props = __props;
|
|
1417
|
+
const emits = __emit;
|
|
1418
|
+
const tableContainerRef = ref();
|
|
1419
|
+
const theadRef = ref();
|
|
1420
|
+
const colResizeIndicatorRef = ref();
|
|
1421
|
+
const trRef = ref();
|
|
1422
|
+
const isRelativeMode = ref(IS_LEGACY_MODE ? true : props.cellFixedMode === "relative");
|
|
1423
|
+
const currentRow = shallowRef();
|
|
1424
|
+
const currentRowKey = ref(void 0);
|
|
1425
|
+
const currentSelectedCellKey = ref(void 0);
|
|
1426
|
+
let currentHoverRow = null;
|
|
1427
|
+
const currentHoverRowKey = ref(null);
|
|
1428
|
+
let sortCol = ref();
|
|
1429
|
+
let sortOrderIndex = ref(0);
|
|
1430
|
+
const sortSwitchOrder = [null, "desc", "asc"];
|
|
1431
|
+
const tableHeaders = shallowRef([]);
|
|
1432
|
+
const tableHeadersForCalc = shallowRef([]);
|
|
1433
|
+
const tableHeaderLast = computed(() => tableHeadersForCalc.value.at(-1) || []);
|
|
1434
|
+
const dataSourceCopy = shallowRef(props.dataSource.slice());
|
|
1435
|
+
const rowKeyGenComputed = computed(() => {
|
|
1436
|
+
const { rowKey } = props;
|
|
1437
|
+
if (typeof rowKey === "function") {
|
|
1438
|
+
return (row) => rowKey(row);
|
|
1439
|
+
} else {
|
|
1440
|
+
return (row) => row[rowKey];
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
const colKeyGen = computed(() => {
|
|
1444
|
+
const { colKey } = props;
|
|
1445
|
+
if (typeof colKey === "function") {
|
|
1446
|
+
return (col) => colKey(col);
|
|
1447
|
+
} else {
|
|
1448
|
+
return (col) => col[colKey];
|
|
1449
|
+
}
|
|
1450
|
+
});
|
|
1451
|
+
const getEmptyCellText = computed(() => {
|
|
1452
|
+
const { emptyCellText } = props;
|
|
1453
|
+
if (typeof emptyCellText === "string") {
|
|
1454
|
+
return () => emptyCellText;
|
|
1455
|
+
} else {
|
|
1456
|
+
return (col, row) => emptyCellText({ row, col });
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
const rowKeyGenStore = /* @__PURE__ */ new WeakMap();
|
|
1460
|
+
const { onThDragStart, onThDragOver, onThDrop, isHeaderDraggable } = useThDrag({ props, emits, colKeyGen });
|
|
1461
|
+
const { onTrDragStart, onTrDrop, onTrDragOver, onTrDragEnd, onTrDragEnter } = useTrDrag({ props, emits, dataSourceCopy });
|
|
1462
|
+
const {
|
|
1463
|
+
virtualScroll,
|
|
1464
|
+
virtualScrollX,
|
|
1465
|
+
virtual_on,
|
|
1466
|
+
virtual_dataSourcePart,
|
|
1467
|
+
virtual_offsetBottom,
|
|
1468
|
+
virtualX_on,
|
|
1469
|
+
virtualX_columnPart,
|
|
1470
|
+
virtualX_offsetRight,
|
|
1471
|
+
initVirtualScroll,
|
|
1472
|
+
initVirtualScrollY,
|
|
1473
|
+
initVirtualScrollX,
|
|
1474
|
+
updateVirtualScrollY,
|
|
1475
|
+
updateVirtualScrollX,
|
|
1476
|
+
setAutoHeight,
|
|
1477
|
+
clearAllAutoHeight
|
|
1478
|
+
} = useVirtualScroll({ tableContainerRef, trRef, props, dataSourceCopy, tableHeaderLast, tableHeaders, rowKeyGen });
|
|
1479
|
+
const getFixedColPosition = useGetFixedColPosition({ colKeyGen, tableHeadersForCalc });
|
|
1480
|
+
const getFixedStyle = useFixedStyle({
|
|
1481
|
+
props,
|
|
1482
|
+
isRelativeMode,
|
|
1483
|
+
getFixedColPosition,
|
|
1484
|
+
virtualScroll,
|
|
1485
|
+
virtualScrollX,
|
|
1486
|
+
virtualX_on,
|
|
1487
|
+
virtualX_offsetRight
|
|
1488
|
+
});
|
|
1489
|
+
const { highlightSteps, setHighlightDimCell, setHighlightDimRow } = useHighlight({ props, stkTableId, tableContainerRef });
|
|
1490
|
+
if (props.autoResize) {
|
|
1491
|
+
useAutoResize({ tableContainerRef, initVirtualScroll, props, debounceMs: 200 });
|
|
1492
|
+
}
|
|
1493
|
+
useKeyboardArrowScroll(tableContainerRef, {
|
|
1494
|
+
props,
|
|
1495
|
+
scrollTo,
|
|
1496
|
+
virtualScroll,
|
|
1497
|
+
virtualScrollX,
|
|
1498
|
+
tableHeaders,
|
|
1499
|
+
virtual_on
|
|
1500
|
+
});
|
|
1501
|
+
const { fixedCols, fixedColClassMap, updateFixedShadow } = useFixedCol({
|
|
1502
|
+
props,
|
|
1503
|
+
colKeyGen,
|
|
1504
|
+
getFixedColPosition,
|
|
1505
|
+
tableContainerRef,
|
|
1506
|
+
tableHeaders,
|
|
1507
|
+
tableHeadersForCalc
|
|
1508
|
+
});
|
|
1509
|
+
const { isColResizing, onThResizeMouseDown, colResizeOn } = useColResize({
|
|
1510
|
+
props,
|
|
1511
|
+
emits,
|
|
1512
|
+
colKeyGen,
|
|
1513
|
+
colResizeIndicatorRef,
|
|
1514
|
+
tableContainerRef,
|
|
1515
|
+
tableHeaderLast,
|
|
1516
|
+
fixedCols
|
|
1517
|
+
});
|
|
1518
|
+
watch(
|
|
1519
|
+
() => props.columns,
|
|
1520
|
+
() => {
|
|
1521
|
+
dealColumns();
|
|
1522
|
+
nextTick(() => {
|
|
1523
|
+
initVirtualScrollX();
|
|
1524
|
+
updateFixedShadow();
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
);
|
|
1528
|
+
watch(
|
|
1529
|
+
() => props.virtual,
|
|
1530
|
+
() => {
|
|
1531
|
+
nextTick(() => {
|
|
1532
|
+
initVirtualScrollY();
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
);
|
|
1536
|
+
watch(
|
|
1537
|
+
() => props.virtualX,
|
|
1538
|
+
() => {
|
|
1539
|
+
dealColumns();
|
|
1540
|
+
nextTick(() => {
|
|
1541
|
+
initVirtualScrollX();
|
|
1542
|
+
updateFixedShadow();
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
);
|
|
1546
|
+
watch(
|
|
1547
|
+
() => props.dataSource,
|
|
1548
|
+
(val) => {
|
|
1549
|
+
if (!val) {
|
|
1550
|
+
console.warn("invalid dataSource");
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
let needInitVirtualScrollY = false;
|
|
1554
|
+
if (dataSourceCopy.value.length !== val.length) {
|
|
1555
|
+
needInitVirtualScrollY = true;
|
|
1556
|
+
}
|
|
1557
|
+
dataSourceCopy.value = val.slice();
|
|
1558
|
+
if (needInitVirtualScrollY) {
|
|
1559
|
+
nextTick(() => initVirtualScrollY());
|
|
1560
|
+
}
|
|
1561
|
+
const sortColValue = sortCol.value;
|
|
1562
|
+
if (sortColValue) {
|
|
1563
|
+
const colKey = colKeyGen.value;
|
|
1564
|
+
const column = tableHeaderLast.value.find((it) => colKey(it) === sortColValue);
|
|
1565
|
+
onColumnSort(column, false);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
);
|
|
1569
|
+
watch(
|
|
1570
|
+
() => props.fixedColShadow,
|
|
1571
|
+
() => updateFixedShadow()
|
|
1572
|
+
);
|
|
1573
|
+
dealColumns();
|
|
1574
|
+
onMounted(() => {
|
|
1575
|
+
initVirtualScroll();
|
|
1576
|
+
updateFixedShadow();
|
|
1577
|
+
dealDefaultSorter();
|
|
1578
|
+
});
|
|
1579
|
+
function dealDefaultSorter() {
|
|
1580
|
+
if (!props.sortConfig.defaultSort) return;
|
|
1581
|
+
const { key, dataIndex, order, silent } = { silent: false, ...props.sortConfig.defaultSort };
|
|
1582
|
+
setSorter(key || dataIndex, order, { force: false, silent });
|
|
1583
|
+
}
|
|
1584
|
+
function dealColumns() {
|
|
1585
|
+
const tableHeadersTemp = [];
|
|
1586
|
+
const tableHeadersForCalcTemp = [];
|
|
1587
|
+
let copyColumn = props.columns;
|
|
1588
|
+
if (isRelativeMode.value) {
|
|
1589
|
+
let leftCol = [];
|
|
1590
|
+
let centerCol = [];
|
|
1591
|
+
let rightCol = [];
|
|
1592
|
+
copyColumn.forEach((col) => {
|
|
1593
|
+
if (col.fixed === "left") {
|
|
1594
|
+
leftCol.push(col);
|
|
1595
|
+
} else if (col.fixed === "right") {
|
|
1596
|
+
rightCol.push(col);
|
|
1597
|
+
} else {
|
|
1598
|
+
centerCol.push(col);
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
copyColumn = leftCol.concat(centerCol).concat(rightCol);
|
|
1602
|
+
}
|
|
1603
|
+
const maxDeep = howDeepTheHeader(copyColumn);
|
|
1604
|
+
if (maxDeep > 0 && props.virtualX) {
|
|
1605
|
+
console.error("StkTableVue:多级表头不支持横向虚拟滚动!");
|
|
1606
|
+
}
|
|
1607
|
+
for (let i = 0; i <= maxDeep; i++) {
|
|
1608
|
+
tableHeadersTemp[i] = [];
|
|
1609
|
+
tableHeadersForCalcTemp[i] = [];
|
|
1610
|
+
}
|
|
1611
|
+
function flat(arr, parent, depth = 0) {
|
|
1612
|
+
let allChildrenLen = 0;
|
|
1613
|
+
let allChildrenWidthSum = 0;
|
|
1614
|
+
arr.forEach((col) => {
|
|
1615
|
+
col.__PARENT__ = parent;
|
|
1616
|
+
let colChildrenLen = 1;
|
|
1617
|
+
let colWidth = 0;
|
|
1618
|
+
if (col.children) {
|
|
1619
|
+
const [len, widthSum] = flat(
|
|
1620
|
+
col.children,
|
|
1621
|
+
col,
|
|
1622
|
+
depth + 1
|
|
1623
|
+
/* , col.fixed */
|
|
1624
|
+
);
|
|
1625
|
+
colChildrenLen = len;
|
|
1626
|
+
colWidth = widthSum;
|
|
1627
|
+
tableHeadersForCalcTemp[depth].push(col);
|
|
1628
|
+
} else {
|
|
1629
|
+
colWidth = getColWidth(col);
|
|
1630
|
+
for (let i = depth; i <= maxDeep; i++) {
|
|
1631
|
+
tableHeadersForCalcTemp[i].push(col);
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
col.__WIDTH__ = colWidth;
|
|
1635
|
+
tableHeadersTemp[depth].push(col);
|
|
1636
|
+
const rowSpan = col.children ? 1 : maxDeep - depth + 1;
|
|
1637
|
+
const colSpan = colChildrenLen;
|
|
1638
|
+
if (rowSpan > 1) {
|
|
1639
|
+
col.rowSpan = rowSpan;
|
|
1640
|
+
}
|
|
1641
|
+
if (colSpan > 1) {
|
|
1642
|
+
col.colSpan = colSpan;
|
|
1643
|
+
}
|
|
1644
|
+
allChildrenLen += colChildrenLen;
|
|
1645
|
+
allChildrenWidthSum += colWidth;
|
|
1646
|
+
});
|
|
1647
|
+
return [allChildrenLen, allChildrenWidthSum];
|
|
1648
|
+
}
|
|
1649
|
+
flat(copyColumn, null);
|
|
1650
|
+
tableHeaders.value = tableHeadersTemp;
|
|
1651
|
+
tableHeadersForCalc.value = tableHeadersForCalcTemp;
|
|
1652
|
+
}
|
|
1653
|
+
function rowKeyGen(row) {
|
|
1654
|
+
if (!row) return row;
|
|
1655
|
+
let key = rowKeyGenStore.get(row) || row.__ROW_KEY__;
|
|
1656
|
+
if (!key) {
|
|
1657
|
+
key = rowKeyGenComputed.value(row);
|
|
1658
|
+
if (key === void 0) {
|
|
1659
|
+
key = Math.random().toString();
|
|
1660
|
+
}
|
|
1661
|
+
rowKeyGenStore.set(row, key);
|
|
1662
|
+
}
|
|
1663
|
+
return key;
|
|
1664
|
+
}
|
|
1665
|
+
function cellKeyGen(row, col) {
|
|
1666
|
+
return rowKeyGen(row) + CELL_KEY_SEPARATE + colKeyGen.value(col);
|
|
1667
|
+
}
|
|
1668
|
+
const cellStyleMap = computed(() => {
|
|
1669
|
+
const thMap = /* @__PURE__ */ new Map();
|
|
1670
|
+
const tdMap = /* @__PURE__ */ new Map();
|
|
1671
|
+
const { virtualX, colResizable } = props;
|
|
1672
|
+
tableHeaders.value.forEach((cols, depth) => {
|
|
1673
|
+
cols.forEach((col) => {
|
|
1674
|
+
const colKey = colKeyGen.value(col);
|
|
1675
|
+
const width = virtualX ? getCalculatedColWidth(col) + "px" : transformWidthToStr(col.width);
|
|
1676
|
+
const style = {
|
|
1677
|
+
width
|
|
1678
|
+
};
|
|
1679
|
+
if (colResizable) {
|
|
1680
|
+
style.minWidth = width;
|
|
1681
|
+
style.maxWidth = width;
|
|
1682
|
+
} else {
|
|
1683
|
+
style.minWidth = transformWidthToStr(col.minWidth) ?? width;
|
|
1684
|
+
style.maxWidth = transformWidthToStr(col.maxWidth) ?? width;
|
|
1685
|
+
}
|
|
1686
|
+
thMap.set(colKey, Object.assign({ textAlign: col.headerAlign }, style, getFixedStyle(TagType.TH, col, depth)));
|
|
1687
|
+
tdMap.set(colKey, Object.assign({ textAlign: col.align }, style, getFixedStyle(TagType.TD, col, depth), { textAlign: col.align }));
|
|
1688
|
+
});
|
|
1689
|
+
});
|
|
1690
|
+
return {
|
|
1691
|
+
[TagType.TH]: thMap,
|
|
1692
|
+
[TagType.TD]: tdMap
|
|
1693
|
+
};
|
|
1694
|
+
});
|
|
1695
|
+
function getHeaderTitle(col) {
|
|
1696
|
+
const colKey = colKeyGen.value(col);
|
|
1697
|
+
if (props.hideHeaderTitle === true || Array.isArray(props.hideHeaderTitle) && props.hideHeaderTitle.includes(colKey)) {
|
|
1698
|
+
return "";
|
|
1699
|
+
}
|
|
1700
|
+
return col.title || "";
|
|
1701
|
+
}
|
|
1702
|
+
function onColumnSort(col, click = true, options = {}) {
|
|
1703
|
+
if (!col) {
|
|
1704
|
+
console.warn("onColumnSort: not found col:", col);
|
|
1705
|
+
return;
|
|
1706
|
+
}
|
|
1707
|
+
if (!col.sorter && click) {
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
options = { force: false, emit: false, ...options };
|
|
1711
|
+
const colKey = colKeyGen.value(col);
|
|
1712
|
+
if (sortCol.value !== colKey) {
|
|
1713
|
+
sortCol.value = colKey;
|
|
1714
|
+
sortOrderIndex.value = 0;
|
|
1715
|
+
}
|
|
1716
|
+
if (click) sortOrderIndex.value++;
|
|
1717
|
+
sortOrderIndex.value = sortOrderIndex.value % 3;
|
|
1718
|
+
let order = sortSwitchOrder[sortOrderIndex.value];
|
|
1719
|
+
const sortConfig = { ...props.sortConfig, ...col.sortConfig };
|
|
1720
|
+
const defaultSort = sortConfig.defaultSort;
|
|
1721
|
+
const colKeyGenValue = colKeyGen.value;
|
|
1722
|
+
if (!order && defaultSort) {
|
|
1723
|
+
const colKey2 = defaultSort.key || defaultSort.dataIndex;
|
|
1724
|
+
if (!colKey2) {
|
|
1725
|
+
console.error("sortConfig.defaultSort key or dataIndex is required");
|
|
1726
|
+
return;
|
|
1727
|
+
}
|
|
1728
|
+
order = defaultSort.order || "desc";
|
|
1729
|
+
sortOrderIndex.value = sortSwitchOrder.indexOf(order);
|
|
1730
|
+
sortCol.value = colKey2;
|
|
1731
|
+
col = null;
|
|
1732
|
+
for (const row of tableHeaders.value) {
|
|
1733
|
+
const c = row.find((item) => colKeyGenValue(item) === colKey2);
|
|
1734
|
+
if (c) {
|
|
1735
|
+
col = c;
|
|
1736
|
+
break;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
if (!props.sortRemote || options.force) {
|
|
1741
|
+
const sortOption = col || defaultSort;
|
|
1742
|
+
if (sortOption) {
|
|
1743
|
+
dataSourceCopy.value = tableSort(sortOption, order, props.dataSource, sortConfig);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
if (click || options.emit) {
|
|
1747
|
+
emits("sort-change", col, order, toRaw(dataSourceCopy.value), sortConfig);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
function onRowClick(e, row) {
|
|
1751
|
+
emits("row-click", e, row);
|
|
1752
|
+
const isCurrentRow = props.rowKey ? currentRowKey.value === rowKeyGen(row) : currentRow.value === row;
|
|
1753
|
+
if (isCurrentRow) {
|
|
1754
|
+
if (!props.rowCurrentRevokable) {
|
|
1755
|
+
return;
|
|
1756
|
+
}
|
|
1757
|
+
currentRow.value = void 0;
|
|
1758
|
+
currentRowKey.value = void 0;
|
|
1759
|
+
} else {
|
|
1760
|
+
currentRow.value = row;
|
|
1761
|
+
currentRowKey.value = rowKeyGen(row);
|
|
1762
|
+
}
|
|
1763
|
+
emits("current-change", e, row, { select: !isCurrentRow });
|
|
1764
|
+
}
|
|
1765
|
+
function onRowDblclick(e, row) {
|
|
1766
|
+
emits("row-dblclick", e, row);
|
|
1767
|
+
}
|
|
1768
|
+
function onHeaderMenu(e) {
|
|
1769
|
+
emits("header-row-menu", e);
|
|
1770
|
+
}
|
|
1771
|
+
function onRowMenu(e, row) {
|
|
1772
|
+
emits("row-menu", e, row);
|
|
1773
|
+
}
|
|
1774
|
+
function onCellClick(e, row, col) {
|
|
1775
|
+
if (col.type === "expand") {
|
|
1776
|
+
toggleExpandRow(row, col);
|
|
1777
|
+
}
|
|
1778
|
+
if (props.cellActive) {
|
|
1779
|
+
const cellKey = cellKeyGen(row, col);
|
|
1780
|
+
const result = { row, col, select: false };
|
|
1781
|
+
if (props.selectedCellRevokable && currentSelectedCellKey.value === cellKey) {
|
|
1782
|
+
currentSelectedCellKey.value = void 0;
|
|
1783
|
+
} else {
|
|
1784
|
+
currentSelectedCellKey.value = cellKey;
|
|
1785
|
+
result.select = true;
|
|
1786
|
+
}
|
|
1787
|
+
emits("cell-selected", e, result);
|
|
1788
|
+
}
|
|
1789
|
+
emits("cell-click", e, row, col);
|
|
1790
|
+
}
|
|
1791
|
+
function onHeaderCellClick(e, col) {
|
|
1792
|
+
emits("header-cell-click", e, col);
|
|
1793
|
+
}
|
|
1794
|
+
function onCellMouseEnter(e, row, col) {
|
|
1795
|
+
emits("cell-mouseenter", e, row, col);
|
|
1796
|
+
}
|
|
1797
|
+
function onCellMouseLeave(e, row, col) {
|
|
1798
|
+
emits("cell-mouseleave", e, row, col);
|
|
1799
|
+
}
|
|
1800
|
+
function onCellMouseOver(e, row, col) {
|
|
1801
|
+
emits("cell-mouseover", e, row, col);
|
|
1802
|
+
}
|
|
1803
|
+
function onCellMouseDown(e, row, col) {
|
|
1804
|
+
emits("cell-mousedown", e, row, col);
|
|
1805
|
+
}
|
|
1806
|
+
function onTableWheel(e) {
|
|
1807
|
+
if (props.smoothScroll) {
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
if (isColResizing.value) {
|
|
1811
|
+
e.stopPropagation();
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
const dom = tableContainerRef.value;
|
|
1815
|
+
if (!dom) return;
|
|
1816
|
+
const { containerHeight, scrollTop, scrollHeight } = virtualScroll.value;
|
|
1817
|
+
const { containerWidth, scrollLeft, scrollWidth } = virtualScrollX.value;
|
|
1818
|
+
const isScrollBottom = scrollHeight - containerHeight - scrollTop < 10;
|
|
1819
|
+
const isScrollRight = scrollWidth - containerWidth - scrollLeft < 10;
|
|
1820
|
+
const { deltaY, deltaX } = e;
|
|
1821
|
+
if (virtual_on && deltaY) {
|
|
1822
|
+
if (deltaY > 0 && !isScrollBottom || deltaY < 0 && scrollTop > 0) {
|
|
1823
|
+
e.preventDefault();
|
|
1824
|
+
}
|
|
1825
|
+
dom.scrollTop += deltaY;
|
|
1826
|
+
}
|
|
1827
|
+
if (virtualX_on && deltaX) {
|
|
1828
|
+
if (deltaX > 0 && !isScrollRight || deltaX < 0 && scrollLeft > 0) {
|
|
1829
|
+
e.preventDefault();
|
|
1830
|
+
}
|
|
1831
|
+
dom.scrollLeft += deltaX;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
function onTableScroll(e) {
|
|
1835
|
+
if (!(e == null ? void 0 : e.target)) return;
|
|
1836
|
+
const { scrollTop, scrollLeft } = e.target;
|
|
1837
|
+
const { scrollTop: vScrollTop, startIndex, endIndex } = virtualScroll.value;
|
|
1838
|
+
const { scrollLeft: vScrollLeft } = virtualScrollX.value;
|
|
1839
|
+
const isYScroll = scrollTop !== vScrollTop;
|
|
1840
|
+
const isXScroll = scrollLeft !== vScrollLeft;
|
|
1841
|
+
if (isYScroll) {
|
|
1842
|
+
updateVirtualScrollY(scrollTop);
|
|
1843
|
+
}
|
|
1844
|
+
if (isXScroll) {
|
|
1845
|
+
if (virtualX_on.value) {
|
|
1846
|
+
updateVirtualScrollX(scrollLeft);
|
|
1847
|
+
} else {
|
|
1848
|
+
virtualScrollX.value.scrollLeft = scrollLeft;
|
|
1849
|
+
}
|
|
1850
|
+
updateFixedShadow(virtualScrollX);
|
|
1851
|
+
}
|
|
1852
|
+
if (isYScroll) {
|
|
1853
|
+
emits("scroll", e, { startIndex, endIndex });
|
|
1854
|
+
}
|
|
1855
|
+
if (isXScroll) {
|
|
1856
|
+
emits("scroll-x", e);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
function onTrMouseOver(_e, row) {
|
|
1860
|
+
if (currentHoverRow === row) return;
|
|
1861
|
+
currentHoverRow = row;
|
|
1862
|
+
currentHoverRowKey.value = rowKeyGen(row);
|
|
1863
|
+
}
|
|
1864
|
+
function setCurrentRow(rowKeyOrRow, option = { silent: false }) {
|
|
1865
|
+
if (!dataSourceCopy.value.length) return;
|
|
1866
|
+
const select = rowKeyOrRow !== void 0;
|
|
1867
|
+
if (!select) {
|
|
1868
|
+
currentRow.value = void 0;
|
|
1869
|
+
currentRowKey.value = void 0;
|
|
1870
|
+
} else if (typeof rowKeyOrRow === "string") {
|
|
1871
|
+
const row = dataSourceCopy.value.find((it) => rowKeyGen(it) === rowKeyOrRow);
|
|
1872
|
+
if (!row) {
|
|
1873
|
+
console.warn("setCurrentRow failed.rowKey:", rowKeyOrRow);
|
|
1874
|
+
return;
|
|
1875
|
+
}
|
|
1876
|
+
currentRow.value = row;
|
|
1877
|
+
currentRowKey.value = rowKeyOrRow;
|
|
1878
|
+
} else {
|
|
1879
|
+
currentRow.value = rowKeyOrRow;
|
|
1880
|
+
currentRowKey.value = rowKeyGen(rowKeyOrRow);
|
|
1881
|
+
}
|
|
1882
|
+
if (!option.silent) {
|
|
1883
|
+
emits(
|
|
1884
|
+
"current-change",
|
|
1885
|
+
/** no Event */
|
|
1886
|
+
null,
|
|
1887
|
+
currentRow.value,
|
|
1888
|
+
{ select }
|
|
1889
|
+
);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
function setSelectedCell(row, col, option = { silent: false }) {
|
|
1893
|
+
if (!dataSourceCopy.value.length) return;
|
|
1894
|
+
const select = row !== void 0 && col !== void 0;
|
|
1895
|
+
currentSelectedCellKey.value = select ? cellKeyGen(row, col) : void 0;
|
|
1896
|
+
if (!option.silent) {
|
|
1897
|
+
emits(
|
|
1898
|
+
"cell-selected",
|
|
1899
|
+
/** no Event */
|
|
1900
|
+
null,
|
|
1901
|
+
{ row, col, select }
|
|
1902
|
+
);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
function setSorter(colKey, order, option = {}) {
|
|
1906
|
+
var _a;
|
|
1907
|
+
const newOption = { silent: true, sortOption: null, sort: true, ...option };
|
|
1908
|
+
sortCol.value = colKey;
|
|
1909
|
+
sortOrderIndex.value = sortSwitchOrder.indexOf(order);
|
|
1910
|
+
const colKeyGenValue = colKeyGen.value;
|
|
1911
|
+
if (newOption.sort && ((_a = dataSourceCopy.value) == null ? void 0 : _a.length)) {
|
|
1912
|
+
const column = newOption.sortOption || tableHeaderLast.value.find((it) => colKeyGenValue(it) === sortCol.value);
|
|
1913
|
+
if (column) onColumnSort(column, false, { force: option.force ?? true, emit: !newOption.silent });
|
|
1914
|
+
else console.warn("Can not find column by key:", sortCol.value);
|
|
1915
|
+
}
|
|
1916
|
+
return dataSourceCopy.value;
|
|
1917
|
+
}
|
|
1918
|
+
function resetSorter() {
|
|
1919
|
+
sortCol.value = void 0;
|
|
1920
|
+
sortOrderIndex.value = 0;
|
|
1921
|
+
dataSourceCopy.value = props.dataSource.slice();
|
|
1922
|
+
}
|
|
1923
|
+
function scrollTo(top = 0, left = 0) {
|
|
1924
|
+
if (!tableContainerRef.value) return;
|
|
1925
|
+
if (top !== null) tableContainerRef.value.scrollTop = top;
|
|
1926
|
+
if (left !== null) tableContainerRef.value.scrollLeft = left;
|
|
1927
|
+
}
|
|
1928
|
+
function getTableData() {
|
|
1929
|
+
return toRaw(dataSourceCopy.value);
|
|
1930
|
+
}
|
|
1931
|
+
function getSortColumns() {
|
|
1932
|
+
const sortOrder = sortSwitchOrder[sortOrderIndex.value];
|
|
1933
|
+
if (!sortOrder) return [];
|
|
1934
|
+
return [{ key: sortCol.value, order: sortOrder }];
|
|
1935
|
+
}
|
|
1936
|
+
function toggleExpandRow(row, col) {
|
|
1937
|
+
const isExpand = (row == null ? void 0 : row.__EXPANDED__) === col ? !(row == null ? void 0 : row.__EXPANDED__) : true;
|
|
1938
|
+
setRowExpand(row, isExpand, { col });
|
|
1939
|
+
}
|
|
1940
|
+
function setRowExpand(rowKeyOrRow, expand, data) {
|
|
1941
|
+
let rowKey;
|
|
1942
|
+
if (typeof rowKeyOrRow === "string") {
|
|
1943
|
+
rowKey = rowKeyOrRow;
|
|
1944
|
+
} else {
|
|
1945
|
+
rowKey = rowKeyGen(rowKeyOrRow);
|
|
1946
|
+
}
|
|
1947
|
+
const tempData = dataSourceCopy.value.slice();
|
|
1948
|
+
const index = tempData.findIndex((it) => rowKeyGen(it) === rowKey);
|
|
1949
|
+
if (index === -1) {
|
|
1950
|
+
console.warn("expandRow failed.rowKey:", rowKey);
|
|
1951
|
+
return;
|
|
1952
|
+
}
|
|
1953
|
+
for (let i = index + 1; i < tempData.length; i++) {
|
|
1954
|
+
const item = tempData[i];
|
|
1955
|
+
const rowKey2 = item.__ROW_KEY__;
|
|
1956
|
+
if (rowKey2 == null ? void 0 : rowKey2.startsWith(EXPANDED_ROW_KEY_PREFIX)) {
|
|
1957
|
+
tempData.splice(i, 1);
|
|
1958
|
+
i--;
|
|
1959
|
+
} else {
|
|
1960
|
+
break;
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
const row = tempData[index];
|
|
1964
|
+
const col = (data == null ? void 0 : data.col) || null;
|
|
1965
|
+
if (expand) {
|
|
1966
|
+
const newExpandRow = {
|
|
1967
|
+
__ROW_KEY__: EXPANDED_ROW_KEY_PREFIX + rowKey,
|
|
1968
|
+
__EXPANDED_ROW__: row,
|
|
1969
|
+
__EXPANDED_COL__: col
|
|
1970
|
+
};
|
|
1971
|
+
tempData.splice(index + 1, 0, newExpandRow);
|
|
1972
|
+
}
|
|
1973
|
+
if (row) {
|
|
1974
|
+
row.__EXPANDED__ = expand ? col : null;
|
|
1975
|
+
}
|
|
1976
|
+
dataSourceCopy.value = tempData;
|
|
1977
|
+
if (!(data == null ? void 0 : data.silent)) {
|
|
1978
|
+
emits("toggle-row-expand", { expanded: Boolean(expand), row, col });
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
__expose({
|
|
1982
|
+
/**
|
|
1983
|
+
* 重新计算虚拟列表宽高
|
|
1984
|
+
*
|
|
1985
|
+
* en: calc virtual scroll x & y info
|
|
1986
|
+
* @see {@link initVirtualScroll}
|
|
1987
|
+
*/
|
|
1988
|
+
initVirtualScroll,
|
|
1989
|
+
/**
|
|
1990
|
+
* 重新计算虚拟列表宽度
|
|
1991
|
+
*
|
|
1992
|
+
* en: calc virtual scroll x
|
|
1993
|
+
* @see {@link initVirtualScrollX}
|
|
1994
|
+
*/
|
|
1995
|
+
initVirtualScrollX,
|
|
1996
|
+
/**
|
|
1997
|
+
* 重新计算虚拟列表高度
|
|
1998
|
+
*
|
|
1999
|
+
* en: calc virtual scroll y
|
|
2000
|
+
* @see {@link initVirtualScrollY}
|
|
2001
|
+
*/
|
|
2002
|
+
initVirtualScrollY,
|
|
2003
|
+
/**
|
|
2004
|
+
* 选中一行
|
|
2005
|
+
*
|
|
2006
|
+
* en:select a row
|
|
2007
|
+
* @see {@link setCurrentRow}
|
|
2008
|
+
*/
|
|
2009
|
+
setCurrentRow,
|
|
2010
|
+
/**
|
|
2011
|
+
* 取消选中单元格
|
|
2012
|
+
*
|
|
2013
|
+
* en: set highlight active cell (props.cellActive=true)
|
|
2014
|
+
* @see {@link setSelectedCell}
|
|
2015
|
+
*/
|
|
2016
|
+
setSelectedCell,
|
|
2017
|
+
/**
|
|
2018
|
+
* 设置高亮单元格
|
|
2019
|
+
*
|
|
2020
|
+
* en: Set highlight cell
|
|
2021
|
+
* @see {@link setHighlightDimCell}
|
|
2022
|
+
*/
|
|
2023
|
+
setHighlightDimCell,
|
|
2024
|
+
/**
|
|
2025
|
+
* 设置高亮行
|
|
2026
|
+
*
|
|
2027
|
+
* en: Set highlight row
|
|
2028
|
+
* @see {@link setHighlightDimRow}
|
|
2029
|
+
*/
|
|
2030
|
+
setHighlightDimRow,
|
|
2031
|
+
/**
|
|
2032
|
+
* 表格排序列colKey
|
|
2033
|
+
*
|
|
2034
|
+
* en: Table sort column colKey
|
|
2035
|
+
*/
|
|
2036
|
+
sortCol,
|
|
2037
|
+
/**
|
|
2038
|
+
* 表格排序列顺序
|
|
2039
|
+
*
|
|
2040
|
+
* en: get current sort info
|
|
2041
|
+
* @see {@link getSortColumns}
|
|
2042
|
+
*/
|
|
2043
|
+
getSortColumns,
|
|
2044
|
+
/**
|
|
2045
|
+
* 设置表头排序状态
|
|
2046
|
+
*
|
|
2047
|
+
* en: Set the sort status of the table header
|
|
2048
|
+
* @see {@link setSorter}
|
|
2049
|
+
*/
|
|
2050
|
+
setSorter,
|
|
2051
|
+
/**
|
|
2052
|
+
* 重置sorter状态
|
|
2053
|
+
*
|
|
2054
|
+
* en: Reset the sorter status
|
|
2055
|
+
* @see {@link resetSorter}
|
|
2056
|
+
*/
|
|
2057
|
+
resetSorter,
|
|
2058
|
+
/**
|
|
2059
|
+
* 滚动至
|
|
2060
|
+
*
|
|
2061
|
+
* en: Scroll to
|
|
2062
|
+
* @see {@link scrollTo}
|
|
2063
|
+
*/
|
|
2064
|
+
scrollTo,
|
|
2065
|
+
/**
|
|
2066
|
+
* 获取表格数据
|
|
2067
|
+
*
|
|
2068
|
+
* en: Get table data
|
|
2069
|
+
* @see {@link getTableData}
|
|
2070
|
+
*/
|
|
2071
|
+
getTableData,
|
|
2072
|
+
/**
|
|
2073
|
+
* 设置展开的行
|
|
2074
|
+
*
|
|
2075
|
+
* en: Set expanded rows
|
|
2076
|
+
* @see {@link setRowExpand}
|
|
2077
|
+
*/
|
|
2078
|
+
setRowExpand,
|
|
2079
|
+
/**
|
|
2080
|
+
* 不定行高时,如果行高有变化,则调用此方法更新行高。
|
|
2081
|
+
*
|
|
2082
|
+
* en: When the row height is not fixed, call this method to update the row height if the row height changes.
|
|
2083
|
+
* @see {@link setAutoHeight}
|
|
2084
|
+
*/
|
|
2085
|
+
setAutoHeight,
|
|
2086
|
+
/**
|
|
2087
|
+
* 清除所有行高
|
|
2088
|
+
*
|
|
2089
|
+
* en: Clear all row heights
|
|
2090
|
+
* @see {@link clearAllAutoHeight}
|
|
2091
|
+
*/
|
|
2092
|
+
clearAllAutoHeight
|
|
2093
|
+
});
|
|
2094
|
+
return (_ctx, _cache) => {
|
|
2095
|
+
return openBlock(), createElementBlock("div", {
|
|
2096
|
+
ref_key: "tableContainerRef",
|
|
2097
|
+
ref: tableContainerRef,
|
|
2098
|
+
class: normalizeClass(["stk-table", {
|
|
2099
|
+
virtual: _ctx.virtual,
|
|
2100
|
+
"virtual-x": _ctx.virtualX,
|
|
2101
|
+
"vt-on": unref(virtual_on),
|
|
2102
|
+
dark: _ctx.theme === "dark",
|
|
2103
|
+
headless: _ctx.headless,
|
|
2104
|
+
"is-col-resizing": unref(isColResizing),
|
|
2105
|
+
"col-resizable": props.colResizable,
|
|
2106
|
+
border: props.bordered,
|
|
2107
|
+
"border-h": props.bordered === "h",
|
|
2108
|
+
"border-v": props.bordered === "v",
|
|
2109
|
+
"border-body-v": props.bordered === "body-v",
|
|
2110
|
+
stripe: props.stripe,
|
|
2111
|
+
"cell-hover": props.cellHover,
|
|
2112
|
+
"cell-active": props.cellActive,
|
|
2113
|
+
"row-hover": props.rowHover,
|
|
2114
|
+
"row-active": props.rowActive,
|
|
2115
|
+
"text-overflow": props.showOverflow,
|
|
2116
|
+
"header-text-overflow": props.showHeaderOverflow,
|
|
2117
|
+
"fixed-relative-mode": isRelativeMode.value,
|
|
2118
|
+
"auto-row-height": props.autoRowHeight,
|
|
2119
|
+
"scroll-row-by-row": props.scrollRowByRow
|
|
2120
|
+
}]),
|
|
2121
|
+
style: normalizeStyle({
|
|
2122
|
+
"--row-height": props.autoRowHeight ? void 0 : unref(virtualScroll).rowHeight + "px",
|
|
2123
|
+
"--header-row-height": props.headerRowHeight + "px",
|
|
2124
|
+
"--highlight-duration": props.highlightConfig.duration && props.highlightConfig.duration + "s",
|
|
2125
|
+
"--highlight-timing-function": unref(highlightSteps) ? `steps(${unref(highlightSteps)})` : ""
|
|
2126
|
+
}),
|
|
2127
|
+
onScroll: onTableScroll,
|
|
2128
|
+
onWheel: onTableWheel
|
|
2129
|
+
}, [
|
|
2130
|
+
props.scrollRowByRow && _ctx.virtual ? (openBlock(), createElementBlock("div", {
|
|
2131
|
+
key: 0,
|
|
2132
|
+
class: "row-by-row-table-height",
|
|
2133
|
+
style: normalizeStyle({ height: dataSourceCopy.value.length * unref(virtualScroll).rowHeight + "px" })
|
|
2134
|
+
}, null, 4)) : createCommentVNode("", true),
|
|
2135
|
+
_ctx.colResizable ? (openBlock(), createElementBlock("div", {
|
|
2136
|
+
key: 1,
|
|
2137
|
+
ref_key: "colResizeIndicatorRef",
|
|
2138
|
+
ref: colResizeIndicatorRef,
|
|
2139
|
+
class: "column-resize-indicator"
|
|
2140
|
+
}, null, 512)) : createCommentVNode("", true),
|
|
2141
|
+
createElementVNode("table", {
|
|
2142
|
+
class: normalizeClass(["stk-table-main", {
|
|
2143
|
+
"fixed-mode": props.fixedMode
|
|
2144
|
+
}]),
|
|
2145
|
+
style: normalizeStyle({ width: _ctx.width, minWidth: _ctx.minWidth, maxWidth: _ctx.maxWidth })
|
|
2146
|
+
}, [
|
|
2147
|
+
!_ctx.headless ? (openBlock(), createElementBlock("thead", {
|
|
2148
|
+
key: 0,
|
|
2149
|
+
ref_key: "theadRef",
|
|
2150
|
+
ref: theadRef
|
|
2151
|
+
}, [
|
|
2152
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeaders.value, (row, rowIndex) => {
|
|
2153
|
+
return openBlock(), createElementBlock("tr", {
|
|
2154
|
+
key: rowIndex,
|
|
2155
|
+
onContextmenu: _cache[3] || (_cache[3] = (e) => onHeaderMenu(e))
|
|
2156
|
+
}, [
|
|
2157
|
+
unref(virtualX_on) ? (openBlock(), createElementBlock("th", {
|
|
2158
|
+
key: 0,
|
|
2159
|
+
class: "vt-x-left",
|
|
2160
|
+
style: normalizeStyle(`min-width:${unref(virtualScrollX).offsetLeft}px;width:${unref(virtualScrollX).offsetLeft}px`)
|
|
2161
|
+
}, null, 4)) : createCommentVNode("", true),
|
|
2162
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtualX_on) && rowIndex === tableHeaders.value.length - 1 ? unref(virtualX_columnPart) : row, (col, colIndex) => {
|
|
2163
|
+
return openBlock(), createElementBlock("th", {
|
|
2164
|
+
key: colKeyGen.value(col),
|
|
2165
|
+
"data-col-key": colKeyGen.value(col),
|
|
2166
|
+
draggable: unref(isHeaderDraggable)(col) ? "true" : "false",
|
|
2167
|
+
rowspan: unref(virtualX_on) ? 1 : col.rowSpan,
|
|
2168
|
+
colspan: col.colSpan,
|
|
2169
|
+
style: normalizeStyle(cellStyleMap.value[unref(TagType).TH].get(colKeyGen.value(col))),
|
|
2170
|
+
title: getHeaderTitle(col),
|
|
2171
|
+
class: normalizeClass([
|
|
2172
|
+
col.sorter ? "sortable" : "",
|
|
2173
|
+
colKeyGen.value(col) === unref(sortCol) && unref(sortOrderIndex) !== 0 && "sorter-" + sortSwitchOrder[unref(sortOrderIndex)],
|
|
2174
|
+
col.headerClassName,
|
|
2175
|
+
unref(fixedColClassMap).get(colKeyGen.value(col))
|
|
2176
|
+
]),
|
|
2177
|
+
onClick: (e) => {
|
|
2178
|
+
onColumnSort(col);
|
|
2179
|
+
onHeaderCellClick(e, col);
|
|
2180
|
+
},
|
|
2181
|
+
onDragstart: _cache[0] || (_cache[0] = //@ts-ignore
|
|
2182
|
+
(...args) => unref(onThDragStart) && unref(onThDragStart)(...args)),
|
|
2183
|
+
onDrop: _cache[1] || (_cache[1] = //@ts-ignore
|
|
2184
|
+
(...args) => unref(onThDrop) && unref(onThDrop)(...args)),
|
|
2185
|
+
onDragover: _cache[2] || (_cache[2] = //@ts-ignore
|
|
2186
|
+
(...args) => unref(onThDragOver) && unref(onThDragOver)(...args))
|
|
2187
|
+
}, [
|
|
2188
|
+
unref(colResizeOn)(col) && colIndex > 0 ? (openBlock(), createElementBlock("div", {
|
|
2189
|
+
key: 0,
|
|
2190
|
+
class: "table-header-resizer left",
|
|
2191
|
+
onMousedown: (e) => unref(onThResizeMouseDown)(e, col, true)
|
|
2192
|
+
}, null, 40, _hoisted_2)) : createCommentVNode("", true),
|
|
2193
|
+
createElementVNode("div", {
|
|
2194
|
+
class: "table-header-cell-wrapper",
|
|
2195
|
+
style: normalizeStyle({ "--row-span": unref(virtualX_on) ? 1 : col.rowSpan })
|
|
2196
|
+
}, [
|
|
2197
|
+
col.customHeaderCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customHeaderCell), {
|
|
2198
|
+
key: 0,
|
|
2199
|
+
col,
|
|
2200
|
+
colIndex,
|
|
2201
|
+
rowIndex
|
|
2202
|
+
}, null, 8, ["col", "colIndex", "rowIndex"])) : renderSlot(_ctx.$slots, "tableHeader", {
|
|
2203
|
+
key: 1,
|
|
2204
|
+
col
|
|
2205
|
+
}, () => [
|
|
2206
|
+
createElementVNode("span", _hoisted_3, toDisplayString(col.title), 1)
|
|
2207
|
+
]),
|
|
2208
|
+
col.sorter ? (openBlock(), createBlock(SortIcon, {
|
|
2209
|
+
key: 2,
|
|
2210
|
+
class: "table-header-sorter"
|
|
2211
|
+
})) : createCommentVNode("", true)
|
|
2212
|
+
], 4),
|
|
2213
|
+
unref(colResizeOn)(col) ? (openBlock(), createElementBlock("div", {
|
|
2214
|
+
key: 1,
|
|
2215
|
+
class: "table-header-resizer right",
|
|
2216
|
+
onMousedown: (e) => unref(onThResizeMouseDown)(e, col)
|
|
2217
|
+
}, null, 40, _hoisted_4)) : createCommentVNode("", true)
|
|
2218
|
+
], 46, _hoisted_1);
|
|
2219
|
+
}), 128)),
|
|
2220
|
+
unref(virtualX_on) ? (openBlock(), createElementBlock("th", {
|
|
2221
|
+
key: 1,
|
|
2222
|
+
class: "vt-x-right",
|
|
2223
|
+
style: normalizeStyle(`min-width:${unref(virtualX_offsetRight)}px;width:${unref(virtualX_offsetRight)}px`)
|
|
2224
|
+
}, null, 4)) : createCommentVNode("", true)
|
|
2225
|
+
], 32);
|
|
2226
|
+
}), 128))
|
|
2227
|
+
], 512)) : createCommentVNode("", true),
|
|
2228
|
+
createElementVNode("tbody", {
|
|
2229
|
+
class: "stk-tbody-main",
|
|
2230
|
+
onDragover: _cache[4] || (_cache[4] = //@ts-ignore
|
|
2231
|
+
(...args) => unref(onTrDragOver) && unref(onTrDragOver)(...args)),
|
|
2232
|
+
onDragenter: _cache[5] || (_cache[5] = //@ts-ignore
|
|
2233
|
+
(...args) => unref(onTrDragEnter) && unref(onTrDragEnter)(...args)),
|
|
2234
|
+
onDragend: _cache[6] || (_cache[6] = //@ts-ignore
|
|
2235
|
+
(...args) => unref(onTrDragEnd) && unref(onTrDragEnd)(...args))
|
|
2236
|
+
}, [
|
|
2237
|
+
unref(virtual_on) && !props.scrollRowByRow ? (openBlock(), createElementBlock("tr", {
|
|
2238
|
+
key: 0,
|
|
2239
|
+
style: normalizeStyle(`height:${unref(virtualScroll).offsetTop}px`),
|
|
2240
|
+
class: "padding-top-tr"
|
|
2241
|
+
}, [
|
|
2242
|
+
unref(virtualX_on) && _ctx.fixedMode && _ctx.headless ? (openBlock(), createElementBlock("td", _hoisted_5)) : createCommentVNode("", true),
|
|
2243
|
+
_ctx.fixedMode && _ctx.headless ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(virtualX_columnPart), (col) => {
|
|
2244
|
+
return openBlock(), createElementBlock("td", {
|
|
2245
|
+
key: colKeyGen.value(col),
|
|
2246
|
+
style: normalizeStyle(cellStyleMap.value[unref(TagType).TD].get(colKeyGen.value(col)))
|
|
2247
|
+
}, null, 4);
|
|
2248
|
+
}), 128)) : createCommentVNode("", true)
|
|
2249
|
+
], 4)) : createCommentVNode("", true),
|
|
2250
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtual_dataSourcePart), (row, rowIndex) => {
|
|
2251
|
+
var _a, _b;
|
|
2252
|
+
return openBlock(), createElementBlock("tr", {
|
|
2253
|
+
id: unref(stkTableId) + "-" + (_ctx.rowKey ? rowKeyGen(row) : (unref(virtual_on) ? unref(virtualScroll).startIndex : 0) + rowIndex),
|
|
2254
|
+
ref_for: true,
|
|
2255
|
+
ref_key: "trRef",
|
|
2256
|
+
ref: trRef,
|
|
2257
|
+
key: _ctx.rowKey ? rowKeyGen(row) : (unref(virtual_on) ? unref(virtualScroll).startIndex : 0) + rowIndex,
|
|
2258
|
+
"data-row-key": _ctx.rowKey ? rowKeyGen(row) : (unref(virtual_on) ? unref(virtualScroll).startIndex : 0) + rowIndex,
|
|
2259
|
+
class: normalizeClass({
|
|
2260
|
+
active: _ctx.rowKey ? rowKeyGen(row) === currentRowKey.value : row === currentRow.value,
|
|
2261
|
+
hover: props.showTrHoverClass && (_ctx.rowKey ? rowKeyGen(row) === currentHoverRowKey.value : row === currentHoverRowKey.value),
|
|
2262
|
+
[_ctx.rowClassName(row, (unref(virtual_on) ? unref(virtualScroll).startIndex : 0) + rowIndex)]: true,
|
|
2263
|
+
expanded: row == null ? void 0 : row.__EXPANDED__,
|
|
2264
|
+
"expanded-row": row && row.__EXPANDED_ROW__
|
|
2265
|
+
}),
|
|
2266
|
+
style: normalizeStyle({
|
|
2267
|
+
"--row-height": row && row.__EXPANDED_ROW__ && props.virtual && ((_a = props.expandConfig) == null ? void 0 : _a.height) && ((_b = props.expandConfig) == null ? void 0 : _b.height) + "px"
|
|
2268
|
+
}),
|
|
2269
|
+
onClick: (e) => onRowClick(e, row),
|
|
2270
|
+
onDblclick: (e) => onRowDblclick(e, row),
|
|
2271
|
+
onContextmenu: (e) => onRowMenu(e, row),
|
|
2272
|
+
onMouseover: (e) => onTrMouseOver(e, row),
|
|
2273
|
+
onDrop: (e) => unref(onTrDrop)(e, (unref(virtual_on) ? unref(virtualScroll).startIndex : 0) + rowIndex)
|
|
2274
|
+
}, [
|
|
2275
|
+
unref(virtualX_on) ? (openBlock(), createElementBlock("td", _hoisted_7)) : createCommentVNode("", true),
|
|
2276
|
+
row && row.__EXPANDED_ROW__ ? (openBlock(), createElementBlock("td", {
|
|
2277
|
+
key: 1,
|
|
2278
|
+
colspan: unref(virtualX_columnPart).length
|
|
2279
|
+
}, [
|
|
2280
|
+
createElementVNode("div", _hoisted_9, [
|
|
2281
|
+
renderSlot(_ctx.$slots, "expand", {
|
|
2282
|
+
row: row.__EXPANDED_ROW__,
|
|
2283
|
+
col: row.__EXPANDED_COL__
|
|
2284
|
+
}, () => {
|
|
2285
|
+
var _a2;
|
|
2286
|
+
return [
|
|
2287
|
+
createTextVNode(toDisplayString(((_a2 = row.__EXPANDED_ROW__) == null ? void 0 : _a2[row.__EXPANDED_COL__.dataIndex]) ?? ""), 1)
|
|
2288
|
+
];
|
|
2289
|
+
})
|
|
2290
|
+
])
|
|
2291
|
+
], 8, _hoisted_8)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(unref(virtualX_columnPart), (col, colIndex) => {
|
|
2292
|
+
return openBlock(), createElementBlock("td", {
|
|
2293
|
+
key: colKeyGen.value(col),
|
|
2294
|
+
"data-cell-key": cellKeyGen(row, col),
|
|
2295
|
+
style: normalizeStyle(cellStyleMap.value[unref(TagType).TD].get(colKeyGen.value(col))),
|
|
2296
|
+
class: normalizeClass([
|
|
2297
|
+
col.className,
|
|
2298
|
+
unref(fixedColClassMap).get(colKeyGen.value(col)),
|
|
2299
|
+
{
|
|
2300
|
+
"seq-column": col.type === "seq",
|
|
2301
|
+
active: currentSelectedCellKey.value === cellKeyGen(row, col),
|
|
2302
|
+
"expand-cell": col.type === "expand",
|
|
2303
|
+
expanded: col.type === "expand" && colKeyGen.value(row == null ? void 0 : row.__EXPANDED__) === colKeyGen.value(col),
|
|
2304
|
+
"drag-row-cell": col.type === "dragRow"
|
|
2305
|
+
}
|
|
2306
|
+
]),
|
|
2307
|
+
onClick: (e) => onCellClick(e, row, col),
|
|
2308
|
+
onMousedown: (e) => onCellMouseDown(e, row, col),
|
|
2309
|
+
onMouseenter: (e) => onCellMouseEnter(e, row, col),
|
|
2310
|
+
onMouseleave: (e) => onCellMouseLeave(e, row, col),
|
|
2311
|
+
onMouseover: (e) => onCellMouseOver(e, row, col)
|
|
2312
|
+
}, [
|
|
2313
|
+
col.customCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customCell), {
|
|
2314
|
+
key: 0,
|
|
2315
|
+
class: "table-cell-wrapper",
|
|
2316
|
+
col,
|
|
2317
|
+
row,
|
|
2318
|
+
rowIndex: (unref(virtual_on) ? unref(virtualScroll).startIndex : 0) + rowIndex,
|
|
2319
|
+
colIndex,
|
|
2320
|
+
cellValue: row == null ? void 0 : row[col.dataIndex],
|
|
2321
|
+
expanded: (row == null ? void 0 : row.__EXPANDED__) || null
|
|
2322
|
+
}, null, 8, ["col", "row", "rowIndex", "colIndex", "cellValue", "expanded"])) : (openBlock(), createElementBlock("div", {
|
|
2323
|
+
key: 1,
|
|
2324
|
+
class: normalizeClass(["table-cell-wrapper", { "expanded-cell-wrapper": col.type === "expand" }]),
|
|
2325
|
+
title: col.type !== "seq" ? row == null ? void 0 : row[col.dataIndex] : ""
|
|
2326
|
+
}, [
|
|
2327
|
+
col.type === "seq" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2328
|
+
createTextVNode(toDisplayString((props.seqConfig.startIndex || 0) + (unref(virtual_on) ? unref(virtualScroll).startIndex : 0) + rowIndex + 1), 1)
|
|
2329
|
+
], 64)) : col.type === "expand" ? (openBlock(), createElementBlock("span", _hoisted_12, toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? ""), 1)) : col.type === "dragRow" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2330
|
+
createVNode(DragHandle, {
|
|
2331
|
+
onDragstart: (e) => unref(onTrDragStart)(e, (unref(virtual_on) ? unref(virtualScroll).startIndex : 0) + rowIndex)
|
|
2332
|
+
}, null, 8, ["onDragstart"]),
|
|
2333
|
+
createElementVNode("span", null, toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? ""), 1)
|
|
2334
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
2335
|
+
createTextVNode(toDisplayString((row == null ? void 0 : row[col.dataIndex]) ?? getEmptyCellText.value(col, row)), 1)
|
|
2336
|
+
], 64))
|
|
2337
|
+
], 10, _hoisted_11))
|
|
2338
|
+
], 46, _hoisted_10);
|
|
2339
|
+
}), 128))
|
|
2340
|
+
], 46, _hoisted_6);
|
|
2341
|
+
}), 128)),
|
|
2342
|
+
unref(virtual_on) && !props.scrollRowByRow ? (openBlock(), createElementBlock("tr", {
|
|
2343
|
+
key: 1,
|
|
2344
|
+
style: normalizeStyle(`height: ${unref(virtual_offsetBottom)}px`)
|
|
2345
|
+
}, null, 4)) : createCommentVNode("", true)
|
|
2346
|
+
], 32)
|
|
2347
|
+
], 6),
|
|
2348
|
+
(!dataSourceCopy.value || !dataSourceCopy.value.length) && _ctx.showNoData ? (openBlock(), createElementBlock("div", {
|
|
2349
|
+
key: 2,
|
|
2350
|
+
class: normalizeClass(["stk-table-no-data", { "no-data-full": _ctx.noDataFull }])
|
|
2351
|
+
}, [
|
|
2352
|
+
renderSlot(_ctx.$slots, "empty", {}, () => [
|
|
2353
|
+
_cache[7] || (_cache[7] = createTextVNode("暂无数据"))
|
|
2354
|
+
])
|
|
2355
|
+
], 2)) : createCommentVNode("", true),
|
|
2356
|
+
renderSlot(_ctx.$slots, "customBottom")
|
|
2357
|
+
], 38);
|
|
2358
|
+
};
|
|
2359
|
+
}
|
|
2360
|
+
});
|
|
2361
|
+
export {
|
|
2362
|
+
_sfc_main as StkTable,
|
|
2363
|
+
binarySearch,
|
|
2364
|
+
insertToOrderedArray,
|
|
2365
|
+
strCompare,
|
|
2366
|
+
tableSort
|
|
2367
|
+
};
|