stk-table-vue 0.8.4 → 0.8.6
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/lib/stk-table-vue.js +2797 -2800
- package/lib/style.css +4 -2
- package/package.json +3 -3
- package/src/StkTable/StkTable.vue +7 -16
- package/src/StkTable/style.less +4 -2
package/lib/style.css
CHANGED
|
@@ -265,7 +265,8 @@
|
|
|
265
265
|
background-color:inherit;
|
|
266
266
|
}
|
|
267
267
|
.stk-table .highlight-cell{
|
|
268
|
-
animation:stk-table-dim
|
|
268
|
+
animation-name:stk-table-dim;
|
|
269
|
+
animation-duration:var(--highlight-duration);
|
|
269
270
|
animation-timing-function:var(--highlight-timing-function);
|
|
270
271
|
}
|
|
271
272
|
.stk-table .seq-column{
|
|
@@ -357,7 +358,8 @@
|
|
|
357
358
|
right:0;
|
|
358
359
|
}
|
|
359
360
|
.stk-table .highlight-row{
|
|
360
|
-
animation:stk-table-dim
|
|
361
|
+
animation-name:stk-table-dim;
|
|
362
|
+
animation-duration:var(--highlight-duration);
|
|
361
363
|
animation-timing-function:var(--highlight-timing-function);
|
|
362
364
|
}
|
|
363
365
|
.stk-table .stk-table-no-data{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stk-table-vue",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"description": "Simple realtime virtual table for vue3 and vue2.7",
|
|
5
5
|
"main": "./lib/stk-table-vue.js",
|
|
6
6
|
"types": "./lib/src/StkTable/index.d.ts",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"typescript": "^5.8.3",
|
|
64
64
|
"vite": "^7.0.2",
|
|
65
65
|
"vite-plugin-dts": "3.9.1",
|
|
66
|
-
"vitepress": "^1.6.
|
|
66
|
+
"vitepress": "^1.6.4",
|
|
67
67
|
"vitepress-demo-plugin": "^1.4.5",
|
|
68
|
-
"vitepress-plugin-llms": "^1.7.
|
|
68
|
+
"vitepress-plugin-llms": "^1.7.5",
|
|
69
69
|
"vitest": "^3.2.4",
|
|
70
70
|
"vue": "^3.5.17",
|
|
71
71
|
"vue-eslint-parser": "^9.4.2"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
@scroll="onTableScroll"
|
|
37
37
|
@wheel="onTableWheel"
|
|
38
38
|
>
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
<div
|
|
41
41
|
v-if="isSRBRActive && virtual"
|
|
42
42
|
class="row-by-row-table-height"
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
></div>
|
|
45
45
|
|
|
46
46
|
<div v-if="colResizable" ref="colResizeIndicatorRef" class="column-resize-indicator"></div>
|
|
47
|
-
<!-- 表格主体 -->
|
|
48
47
|
<table
|
|
49
48
|
class="stk-table-main"
|
|
50
49
|
:style="{ width, minWidth, maxWidth }"
|
|
@@ -52,15 +51,13 @@
|
|
|
52
51
|
'fixed-mode': props.fixedMode,
|
|
53
52
|
}"
|
|
54
53
|
>
|
|
55
|
-
<thead v-if="!headless"
|
|
54
|
+
<thead v-if="!headless">
|
|
56
55
|
<tr v-for="(row, rowIndex) in tableHeaders" :key="rowIndex" @contextmenu="onHeaderMenu($event)">
|
|
57
|
-
<!-- 这个th用于横向虚拟滚动表格左边距,width、maxWidth 用于兼容低版本浏览器 -->
|
|
58
56
|
<th
|
|
59
57
|
v-if="virtualX_on"
|
|
60
58
|
class="vt-x-left"
|
|
61
59
|
:style="`min-width:${virtualScrollX.offsetLeft}px;width:${virtualScrollX.offsetLeft}px`"
|
|
62
60
|
></th>
|
|
63
|
-
<!-- v for中最后一行才用 切割。-->
|
|
64
61
|
<th
|
|
65
62
|
v-for="(col, colIndex) in virtualX_on && rowIndex === tableHeaders.length - 1 ? virtualX_columnPart : row"
|
|
66
63
|
:key="colKeyGen(col)"
|
|
@@ -86,7 +83,6 @@
|
|
|
86
83
|
@drop="onThDrop"
|
|
87
84
|
@dragover="onThDragOver"
|
|
88
85
|
>
|
|
89
|
-
<!-- 列宽拖动handler -->
|
|
90
86
|
<div
|
|
91
87
|
v-if="colResizeOn(col) && colIndex > 0"
|
|
92
88
|
class="table-header-resizer left"
|
|
@@ -101,17 +97,14 @@
|
|
|
101
97
|
</template>
|
|
102
98
|
<SortIcon v-if="col.sorter" class="table-header-sorter" />
|
|
103
99
|
</div>
|
|
104
|
-
<!-- 列宽拖动handler -->
|
|
105
100
|
<div v-if="colResizeOn(col)" class="table-header-resizer right" @mousedown="onThResizeMouseDown($event, col)"></div>
|
|
106
101
|
</th>
|
|
107
|
-
<!-- 这个th用于横向虚拟滚动表格右边距 width, min-width 用于兼容低版本浏览器-->
|
|
108
102
|
<th v-if="virtualX_on" class="vt-x-right" :style="`min-width:${virtualX_offsetRight}px;width:${virtualX_offsetRight}px`"></th>
|
|
109
103
|
</tr>
|
|
110
104
|
</thead>
|
|
111
105
|
|
|
112
106
|
<tbody class="stk-tbody-main" @dragover="onTrDragOver" @dragenter="onTrDragEnter" @dragend="onTrDragEnd">
|
|
113
107
|
<tr v-if="virtual_on && !isSRBRActive" :style="`height:${virtualScroll.offsetTop}px`" class="padding-top-tr">
|
|
114
|
-
<!--这个td用于配合虚拟滚动的th对应,防止列错位-->
|
|
115
108
|
<td v-if="virtualX_on && fixedMode && headless" class="vt-x-left"></td>
|
|
116
109
|
<template v-if="fixedMode && headless">
|
|
117
110
|
<td v-for="col in virtualX_columnPart" :key="colKeyGen(col)" :style="cellStyleMap[TagType.TD].get(colKeyGen(col))"></td>
|
|
@@ -141,10 +134,8 @@
|
|
|
141
134
|
@mouseleave="onTrMouseLeave($event)"
|
|
142
135
|
@drop="onTrDrop($event, getRowIndex(rowIndex))"
|
|
143
136
|
>
|
|
144
|
-
<!--这个td用于配合虚拟滚动的th对应,防止列错位-->
|
|
145
137
|
<td v-if="virtualX_on" class="vt-x-left"></td>
|
|
146
138
|
<td v-if="row && row.__EXPANDED_ROW__" :colspan="virtualX_columnPart.length">
|
|
147
|
-
<!-- TODO: support wheel -->
|
|
148
139
|
<div class="table-cell-wrapper">
|
|
149
140
|
<slot name="expand" :row="row.__EXPANDED_ROW__" :col="row.__EXPANDED_COL__">
|
|
150
141
|
{{ row.__EXPANDED_ROW__?.[row.__EXPANDED_COL__.dataIndex] ?? '' }}
|
|
@@ -650,7 +641,6 @@ const emits = defineEmits<{
|
|
|
650
641
|
// }>();
|
|
651
642
|
|
|
652
643
|
const tableContainerRef = ref<HTMLDivElement>();
|
|
653
|
-
const theadRef = ref<HTMLElement>();
|
|
654
644
|
const colResizeIndicatorRef = ref<HTMLDivElement>();
|
|
655
645
|
const trRef = ref<HTMLTableRowElement[]>();
|
|
656
646
|
|
|
@@ -1092,7 +1082,7 @@ const cellStyleMap = computed(() => {
|
|
|
1092
1082
|
});
|
|
1093
1083
|
|
|
1094
1084
|
function getRowIndex(rowIndex: number) {
|
|
1095
|
-
return rowIndex + (virtual_on ? virtualScroll.value.startIndex : 0);
|
|
1085
|
+
return rowIndex + (virtual_on.value ? virtualScroll.value.startIndex : 0);
|
|
1096
1086
|
}
|
|
1097
1087
|
|
|
1098
1088
|
/** th title */
|
|
@@ -1311,13 +1301,13 @@ function onTableWheel(e: WheelEvent) {
|
|
|
1311
1301
|
* 只有虚拟滚动时,才要用 wheel 代理scroll,防止滚动过快导致的白屏。
|
|
1312
1302
|
* 滚动条在边界情况时,not preventDefault 。因为会阻塞父级滚动条滚动。
|
|
1313
1303
|
*/
|
|
1314
|
-
if (virtual_on && deltaY) {
|
|
1304
|
+
if (virtual_on.value && deltaY) {
|
|
1315
1305
|
if ((deltaY > 0 && !isScrollBottom) || (deltaY < 0 && scrollTop > 0)) {
|
|
1316
1306
|
e.preventDefault();
|
|
1317
1307
|
}
|
|
1318
1308
|
dom.scrollTop += deltaY;
|
|
1319
1309
|
}
|
|
1320
|
-
if (virtualX_on && deltaX) {
|
|
1310
|
+
if (virtualX_on.value && deltaX) {
|
|
1321
1311
|
if ((deltaX > 0 && !isScrollRight) || (deltaX < 0 && scrollLeft > 0)) {
|
|
1322
1312
|
e.preventDefault();
|
|
1323
1313
|
}
|
|
@@ -1334,7 +1324,7 @@ function onTableScroll(e: Event) {
|
|
|
1334
1324
|
if (!e?.target) return;
|
|
1335
1325
|
|
|
1336
1326
|
const { scrollTop, scrollLeft } = e.target as HTMLElement;
|
|
1337
|
-
const { scrollTop: vScrollTop
|
|
1327
|
+
const { scrollTop: vScrollTop } = virtualScroll.value;
|
|
1338
1328
|
const { scrollLeft: vScrollLeft } = virtualScrollX.value;
|
|
1339
1329
|
const isYScroll = scrollTop !== vScrollTop;
|
|
1340
1330
|
const isXScroll = scrollLeft !== vScrollLeft;
|
|
@@ -1356,6 +1346,7 @@ function onTableScroll(e: Event) {
|
|
|
1356
1346
|
}
|
|
1357
1347
|
|
|
1358
1348
|
if (isYScroll) {
|
|
1349
|
+
const { startIndex, endIndex } = virtualScroll.value;
|
|
1359
1350
|
emits('scroll', e, { startIndex, endIndex });
|
|
1360
1351
|
}
|
|
1361
1352
|
if (isXScroll) {
|
package/src/StkTable/style.less
CHANGED
|
@@ -381,7 +381,8 @@
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
.highlight-cell {
|
|
384
|
-
animation: stk-table-dim
|
|
384
|
+
animation-name: stk-table-dim;
|
|
385
|
+
animation-duration: var(--highlight-duration);
|
|
385
386
|
animation-timing-function: var(--highlight-timing-function);
|
|
386
387
|
/* 必须分开写,否则var(step(x))不兼容旧浏览器*/
|
|
387
388
|
}
|
|
@@ -504,7 +505,8 @@
|
|
|
504
505
|
|
|
505
506
|
/* td inherit tr bgc*/
|
|
506
507
|
.highlight-row {
|
|
507
|
-
animation: stk-table-dim
|
|
508
|
+
animation-name: stk-table-dim;
|
|
509
|
+
animation-duration: var(--highlight-duration);
|
|
508
510
|
/* 必须分开写,否则var(step(x))不兼容旧浏览器*/
|
|
509
511
|
animation-timing-function: var(--highlight-timing-function);
|
|
510
512
|
}
|