stk-table-vue 0.8.4 → 0.8.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stk-table-vue",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
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.3",
66
+ "vitepress": "^1.6.4",
67
67
  "vitepress-demo-plugin": "^1.4.5",
68
- "vitepress-plugin-llms": "^1.7.0",
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,15 +36,14 @@
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"
43
43
  :style="{ height: dataSourceCopy.length * virtualScroll.rowHeight + 'px' }"
44
- ></div>
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" ref="theadRef">
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)"
@@ -101,17 +98,14 @@
101
98
  </template>
102
99
  <SortIcon v-if="col.sorter" class="table-header-sorter" />
103
100
  </div>
104
- <!-- 列宽拖动handler -->
105
101
  <div v-if="colResizeOn(col)" class="table-header-resizer right" @mousedown="onThResizeMouseDown($event, col)"></div>
106
102
  </th>
107
- <!-- 这个th用于横向虚拟滚动表格右边距 width, min-width 用于兼容低版本浏览器-->
108
103
  <th v-if="virtualX_on" class="vt-x-right" :style="`min-width:${virtualX_offsetRight}px;width:${virtualX_offsetRight}px`"></th>
109
104
  </tr>
110
105
  </thead>
111
106
 
112
107
  <tbody class="stk-tbody-main" @dragover="onTrDragOver" @dragenter="onTrDragEnter" @dragend="onTrDragEnd">
113
108
  <tr v-if="virtual_on && !isSRBRActive" :style="`height:${virtualScroll.offsetTop}px`" class="padding-top-tr">
114
- <!--这个td用于配合虚拟滚动的th对应,防止列错位-->
115
109
  <td v-if="virtualX_on && fixedMode && headless" class="vt-x-left"></td>
116
110
  <template v-if="fixedMode && headless">
117
111
  <td v-for="col in virtualX_columnPart" :key="colKeyGen(col)" :style="cellStyleMap[TagType.TD].get(colKeyGen(col))"></td>
@@ -141,10 +135,8 @@
141
135
  @mouseleave="onTrMouseLeave($event)"
142
136
  @drop="onTrDrop($event, getRowIndex(rowIndex))"
143
137
  >
144
- <!--这个td用于配合虚拟滚动的th对应,防止列错位-->
145
138
  <td v-if="virtualX_on" class="vt-x-left"></td>
146
139
  <td v-if="row && row.__EXPANDED_ROW__" :colspan="virtualX_columnPart.length">
147
- <!-- TODO: support wheel -->
148
140
  <div class="table-cell-wrapper">
149
141
  <slot name="expand" :row="row.__EXPANDED_ROW__" :col="row.__EXPANDED_COL__">
150
142
  {{ row.__EXPANDED_ROW__?.[row.__EXPANDED_COL__.dataIndex] ?? '' }}
@@ -650,7 +642,6 @@ const emits = defineEmits<{
650
642
  // }>();
651
643
 
652
644
  const tableContainerRef = ref<HTMLDivElement>();
653
- const theadRef = ref<HTMLElement>();
654
645
  const colResizeIndicatorRef = ref<HTMLDivElement>();
655
646
  const trRef = ref<HTMLTableRowElement[]>();
656
647
 
@@ -1334,7 +1325,7 @@ function onTableScroll(e: Event) {
1334
1325
  if (!e?.target) return;
1335
1326
 
1336
1327
  const { scrollTop, scrollLeft } = e.target as HTMLElement;
1337
- const { scrollTop: vScrollTop, startIndex, endIndex } = virtualScroll.value;
1328
+ const { scrollTop: vScrollTop } = virtualScroll.value;
1338
1329
  const { scrollLeft: vScrollLeft } = virtualScrollX.value;
1339
1330
  const isYScroll = scrollTop !== vScrollTop;
1340
1331
  const isXScroll = scrollLeft !== vScrollLeft;
@@ -1356,6 +1347,7 @@ function onTableScroll(e: Event) {
1356
1347
  }
1357
1348
 
1358
1349
  if (isYScroll) {
1350
+ const { startIndex, endIndex } = virtualScroll.value;
1359
1351
  emits('scroll', e, { startIndex, endIndex });
1360
1352
  }
1361
1353
  if (isXScroll) {
@@ -381,7 +381,8 @@
381
381
  }
382
382
 
383
383
  .highlight-cell {
384
- animation: stk-table-dim var(--highlight-duration);
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 var(--highlight-duration);
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
  }