stk-table-vue 1.2.4 → 1.2.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/README.md +194 -194
- package/lib/{Dropdown-D_9cB0rD.js → Dropdown-BAANgg_5.js} +2 -2
- package/lib/{StkTable-CVcmlZi9.js → StkTable-CGcxwpdb.js} +22 -6
- package/lib/src/StkTable/StkTable.vue.d.ts +18 -4
- package/lib/src/StkTable/types/index.d.ts +4 -1
- package/lib/src/StkTable/useVirtualScroll.d.ts +6 -1
- package/lib/stk-table-vue.js +3 -3
- package/lib/style.css +1 -1
- package/package.json +93 -93
- package/src/StkTable/StkTable.vue +2362 -2338
- package/src/StkTable/components/DragHandle.vue +9 -9
- package/src/StkTable/components/SortIcon.vue +6 -6
- package/src/StkTable/components/TreeNodeCell.vue +19 -19
- package/src/StkTable/components/TriangleIcon.vue +3 -3
- package/src/StkTable/const.ts +50 -50
- package/src/StkTable/custom-cells/ChangeCell/ChangeCell.less +34 -34
- package/src/StkTable/custom-cells/ChangeCell/createChangeCell.ts +90 -90
- package/src/StkTable/custom-cells/ChangeCell/index.ts +4 -4
- package/src/StkTable/custom-cells/CheckboxCell/CheckboxCell.less +14 -14
- package/src/StkTable/custom-cells/CheckboxCell/CheckboxCell.vue +56 -56
- package/src/StkTable/custom-cells/CheckboxCell/createCheckboxCell.ts +146 -146
- package/src/StkTable/custom-cells/CheckboxCell/index.ts +5 -5
- package/src/StkTable/custom-cells/FilterCell/Dropdown/index.ts +16 -16
- package/src/StkTable/custom-cells/FilterCell/Dropdown/index.vue +186 -186
- package/src/StkTable/custom-cells/FilterCell/Filter.less +118 -118
- package/src/StkTable/custom-cells/FilterCell/Filter.vue +66 -66
- package/src/StkTable/custom-cells/FilterCell/createFilterCell.ts +120 -120
- package/src/StkTable/custom-cells/FilterCell/index.ts +6 -6
- package/src/StkTable/custom-cells/FilterCell/types.ts +43 -43
- package/src/StkTable/custom-cells/NumberCell/createNumberCell.ts +43 -43
- package/src/StkTable/custom-cells/NumberCell/index.ts +2 -2
- package/src/StkTable/custom-cells/utils/formatNumber.ts +137 -137
- package/src/StkTable/features/const.ts +1 -1
- package/src/StkTable/features/index.ts +1 -1
- package/src/StkTable/features/useAreaSelection.ts +1240 -1239
- package/src/StkTable/index.ts +20 -20
- package/src/StkTable/mergeCellsCache.ts +69 -69
- package/src/StkTable/registerFeature.ts +40 -40
- package/src/StkTable/style.less +791 -791
- package/src/StkTable/types/highlightDimOptions.ts +28 -28
- package/src/StkTable/types/index.ts +503 -500
- package/src/StkTable/useAutoResize.ts +87 -87
- package/src/StkTable/useColResize.ts +202 -202
- package/src/StkTable/useFixedCol.ts +168 -168
- package/src/StkTable/useFixedStyle.ts +75 -75
- package/src/StkTable/useGetFixedColPosition.ts +63 -63
- package/src/StkTable/useHighlight.ts +270 -270
- package/src/StkTable/useIndexResolver.ts +29 -29
- package/src/StkTable/useKeyboardArrowScroll.ts +114 -114
- package/src/StkTable/useMaxRowSpan.ts +60 -60
- package/src/StkTable/useMergeCells.ts +541 -541
- package/src/StkTable/useRowExpand.ts +81 -81
- package/src/StkTable/useScrollRowByRow.ts +96 -96
- package/src/StkTable/useScrollbar.ts +177 -177
- package/src/StkTable/useSorter.ts +267 -267
- package/src/StkTable/useTableColumns.ts +142 -142
- package/src/StkTable/useThDrag.ts +94 -94
- package/src/StkTable/useTrDrag.ts +100 -100
- package/src/StkTable/useTree.ts +253 -253
- package/src/StkTable/useVirtualScroll.ts +1032 -1025
- package/src/StkTable/useWheeling.ts +23 -23
- package/src/StkTable/utils/constRefUtils.ts +29 -29
- package/src/StkTable/utils/index.ts +331 -331
- package/src/StkTable/utils/rowHeightFenwickTree.ts +74 -74
- 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/README.md
CHANGED
|
@@ -1,194 +1,194 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<a href="https://ja-plus.github.io/stk-table-vue/">
|
|
3
|
-
<img src="./docs-src/public/assets/logo.svg" width="152">
|
|
4
|
-
</a>
|
|
5
|
-
<h3 align='center'>Stk Table Vue</h3>
|
|
6
|
-
<p align="center">
|
|
7
|
-
<a href="https://www.npmjs.com/package/stk-table-vue"><img src="https://img.shields.io/npm/v/stk-table-vue"></a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/stk-table-vue"><img src="https://img.shields.io/npm/dw/stk-table-vue"></a>
|
|
9
|
-
<a href="https://github.com/ja-plus/stk-table-vue/stargazers"><img src="https://img.shields.io/github/stars/ja-plus/stk-table-vue.svg"></a>
|
|
10
|
-
<a href="https://raw.githubusercontent.com/ja-plus/stk-table-vue/master/LICENSE"><img src="https://img.shields.io/npm/l/stk-table-vue"></a>
|
|
11
|
-
<a href="https://github.com/ja-plus/stk-table-vue"><img src="https://img.shields.io/npm/types/stk-table-vue"></a>
|
|
12
|
-
</p>
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
Stk Table Vue(Sticky Table) is a high-performance virtual scrolling table component based on Vue 3 / Vue 2.7.
|
|
16
|
-
|
|
17
|
-
Smooth performance with tens of thousands of rows. Designed for real-time data display with built-in highlighting and animation effects.
|
|
18
|
-
|
|
19
|
-
- Vue 3 & Vue 2.7 support
|
|
20
|
-
- Virtual scrolling (X & Y axis)
|
|
21
|
-
- CSS `sticky` based fixed columns & fixed header
|
|
22
|
-
- Multi-level header with horizontal virtual scroll
|
|
23
|
-
- Tree table & expandable rows
|
|
24
|
-
- Area selection with keyboard navigation
|
|
25
|
-
- Cell highlighting with Animation API
|
|
26
|
-
- Built-in custom cells: Filter, Editable, Checkbox, Number, Change
|
|
27
|
-
- Column resize, header drag, row drag
|
|
28
|
-
- Merge cells (virtual mode, huge rowspan / colspan supported)
|
|
29
|
-
- Custom scrollbar
|
|
30
|
-
- Sortable & filterable
|
|
31
|
-
- Theme support (dark / light)
|
|
32
|
-
- CSS variables for easy customization
|
|
33
|
-
- Based on native `<table>` element
|
|
34
|
-
- Zero third-party runtime dependencies
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## Documentation
|
|
38
|
-
### [Stk Table Vue Official](https://ja-plus.github.io/stk-table-vue/)
|
|
39
|
-
### [Stk Table React Official](https://ja-plus.github.io/stk-table-react/)
|
|
40
|
-
### [Stk Table Svelte Official](https://ja-plus.github.io/stk-table-svelte/)
|
|
41
|
-
### [Stk Table Solid Official](https://ja-plus.github.io/stk-table-solid/)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## Repo:
|
|
45
|
-
- [Github](https://github.com/ja-plus/stk-table-vue)
|
|
46
|
-
- [Gitee](https://gitee.com/japlus/stk-table-vue)
|
|
47
|
-
|
|
48
|
-
## Demo
|
|
49
|
-
[<span style="font-size: 16px;font-weight: bold;">Online Demo in stackblitz</span>](https://stackblitz.com/edit/vitejs-vite-ad91hh?file=src%2FDemo%2Findex.vue)
|
|
50
|
-
|
|
51
|
-
## Usage
|
|
52
|
-
> npm install stk-table-vue
|
|
53
|
-
|
|
54
|
-
```html
|
|
55
|
-
<script setup>
|
|
56
|
-
import { StkTable } from 'stk-table-vue'
|
|
57
|
-
import { ref, useTemplateRef } from 'vue'
|
|
58
|
-
const stkTableRef = ref<InstanceType<typeof StkTable>>();
|
|
59
|
-
// or Vue 3.5 useTemplateRef
|
|
60
|
-
const stkTableRef = useTemplateRef('stkTableRef');
|
|
61
|
-
|
|
62
|
-
// highlight row
|
|
63
|
-
stkTableRef.value.setHighlightDimRow([rowKey], {
|
|
64
|
-
method: 'css' | 'animation', // default animation
|
|
65
|
-
className: 'custom-class-name', // for method 'css'
|
|
66
|
-
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
|
|
67
|
-
duration: 2000,
|
|
68
|
-
});
|
|
69
|
-
// highlight cell
|
|
70
|
-
stkTableRef.value.setHighlightDimCell(rowKey, colDataIndex, {
|
|
71
|
-
method: 'css' | 'animation',
|
|
72
|
-
className: 'custom-class-name', // for method 'css'
|
|
73
|
-
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // for method 'animation'
|
|
74
|
-
duration: 2000,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const columns = [
|
|
78
|
-
{title: 'name', dataIndex: 'name'},
|
|
79
|
-
{title: 'age', dataIndex: 'age'},
|
|
80
|
-
{title: 'address', dataIndex: 'address'},
|
|
81
|
-
];
|
|
82
|
-
|
|
83
|
-
const dataSource = [
|
|
84
|
-
{id: 1, name: 'John', age: 32, address: 'New York'},
|
|
85
|
-
{id: 2, name: 'Jim', age: 42, address: 'London'},
|
|
86
|
-
{id: 3, name: 'Joe', age: 52, address: 'Tokyo'},
|
|
87
|
-
{id: 4, name: 'Jack', age: 62, address: 'Sydney'},
|
|
88
|
-
{id: 5, name: 'Jill', age: 72, address: 'Paris'},
|
|
89
|
-
]
|
|
90
|
-
|
|
91
|
-
</script>
|
|
92
|
-
|
|
93
|
-
<template>
|
|
94
|
-
<StkTable ref='stkTableRef' row-key="id" :data-source="dataSource" :columns="columns"></StkTable>
|
|
95
|
-
</template>
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Vue2.7 Usage
|
|
100
|
-
[Vue2.7 Usage](https://ja-plus.github.io/stk-table-vue/main/start/vue2-usage.html)
|
|
101
|
-
|
|
102
|
-
## API
|
|
103
|
-
* [Props](https://ja-plus.github.io/stk-table-vue/main/api/table-props.html)
|
|
104
|
-
|
|
105
|
-
* [Emits](https://ja-plus.github.io/stk-table-vue/main/api/emits.html)
|
|
106
|
-
|
|
107
|
-
* [Slots](https://ja-plus.github.io/stk-table-vue/main/api/slots.html)
|
|
108
|
-
|
|
109
|
-
* [Expose](https://ja-plus.github.io/stk-table-vue/main/api/expose.html)
|
|
110
|
-
|
|
111
|
-
* [StkTableColumn: Define column type](https://ja-plus.github.io/stk-table-vue/main/api/stk-table-column.html)
|
|
112
|
-
|
|
113
|
-
* [Highlight: setHighlightDimCell & setHighlightDimRow](https://ja-plus.github.io/stk-table-vue/main/api/expose.html#sethighlightdimcell)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
### Example
|
|
117
|
-
```vue
|
|
118
|
-
<template>
|
|
119
|
-
<StkTable
|
|
120
|
-
ref="stkTable"
|
|
121
|
-
row-key="name"
|
|
122
|
-
v-model:columns="columns"
|
|
123
|
-
:style="{height:props.height}"
|
|
124
|
-
theme='dark'
|
|
125
|
-
height='200px'
|
|
126
|
-
bordered="h"
|
|
127
|
-
:row-height="28"
|
|
128
|
-
:show-overflow="false"
|
|
129
|
-
:show-header-overflow="false"
|
|
130
|
-
:sort-remote="false"
|
|
131
|
-
col-resizable
|
|
132
|
-
header-drag
|
|
133
|
-
virtual
|
|
134
|
-
virtual-x
|
|
135
|
-
no-data-full
|
|
136
|
-
col-resizable
|
|
137
|
-
auto-resize
|
|
138
|
-
fixed-col-shadow
|
|
139
|
-
:col-min-width="10"
|
|
140
|
-
:headless="false"
|
|
141
|
-
:data-source="dataSource"
|
|
142
|
-
@current-change="onCurrentChange"
|
|
143
|
-
@row-menu="onRowMenu"
|
|
144
|
-
@header-row-menu="onHeaderRowMenu"
|
|
145
|
-
@row-click="onRowClick"
|
|
146
|
-
@row-dblclick="onRowDblclick"
|
|
147
|
-
@sort-change="handleSortChange"
|
|
148
|
-
@cell-click="onCellClick"
|
|
149
|
-
@header-cell-click="onHeaderCellClick"
|
|
150
|
-
@scroll="onTableScroll"
|
|
151
|
-
@scroll-x="onTableScrollX"
|
|
152
|
-
@col-order-change="onColOrderChange"
|
|
153
|
-
/>
|
|
154
|
-
</template>
|
|
155
|
-
<script setup>
|
|
156
|
-
import { h, defineComponent } from 'vue';
|
|
157
|
-
const columns = [
|
|
158
|
-
{
|
|
159
|
-
title: 'Name',
|
|
160
|
-
dataIndex: 'name',
|
|
161
|
-
fixed: 'left',
|
|
162
|
-
width: '200px',
|
|
163
|
-
headerClassName: 'my-th',
|
|
164
|
-
className: 'my-td',
|
|
165
|
-
sorter: true,
|
|
166
|
-
customHeaderCell: function FunctionalComponent(props){
|
|
167
|
-
return h(
|
|
168
|
-
'span',
|
|
169
|
-
{ style: 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
|
|
170
|
-
props.col.title + '(render) text-overflow,',
|
|
171
|
-
);
|
|
172
|
-
},
|
|
173
|
-
customCell: defineComponent({
|
|
174
|
-
setup(){
|
|
175
|
-
//...
|
|
176
|
-
return () => <div></div> // vue jsx
|
|
177
|
-
}
|
|
178
|
-
})
|
|
179
|
-
},
|
|
180
|
-
]
|
|
181
|
-
</script>
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
## Compare
|
|
185
|
-
Compare performance with other vue table [vue-virtual-table-benchmark](https://github.com/ja-plus/vue-virtual-table-benchmark)
|
|
186
|
-
|
|
187
|
-
[Benchmark Result Page](https://ja-plus.github.io/vue-virtual-table-benchmark/perf-report.html)
|
|
188
|
-
|
|
189
|
-
## Changelog
|
|
190
|
-
[CHANGELOG](CHANGELOG.md)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
## License
|
|
194
|
-
[MIT](LICENSE)
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://ja-plus.github.io/stk-table-vue/">
|
|
3
|
+
<img src="./docs-src/public/assets/logo.svg" width="152">
|
|
4
|
+
</a>
|
|
5
|
+
<h3 align='center'>Stk Table Vue</h3>
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://www.npmjs.com/package/stk-table-vue"><img src="https://img.shields.io/npm/v/stk-table-vue"></a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/stk-table-vue"><img src="https://img.shields.io/npm/dw/stk-table-vue"></a>
|
|
9
|
+
<a href="https://github.com/ja-plus/stk-table-vue/stargazers"><img src="https://img.shields.io/github/stars/ja-plus/stk-table-vue.svg"></a>
|
|
10
|
+
<a href="https://raw.githubusercontent.com/ja-plus/stk-table-vue/master/LICENSE"><img src="https://img.shields.io/npm/l/stk-table-vue"></a>
|
|
11
|
+
<a href="https://github.com/ja-plus/stk-table-vue"><img src="https://img.shields.io/npm/types/stk-table-vue"></a>
|
|
12
|
+
</p>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
Stk Table Vue(Sticky Table) is a high-performance virtual scrolling table component based on Vue 3 / Vue 2.7.
|
|
16
|
+
|
|
17
|
+
Smooth performance with tens of thousands of rows. Designed for real-time data display with built-in highlighting and animation effects.
|
|
18
|
+
|
|
19
|
+
- Vue 3 & Vue 2.7 support
|
|
20
|
+
- Virtual scrolling (X & Y axis)
|
|
21
|
+
- CSS `sticky` based fixed columns & fixed header
|
|
22
|
+
- Multi-level header with horizontal virtual scroll
|
|
23
|
+
- Tree table & expandable rows
|
|
24
|
+
- Area selection with keyboard navigation
|
|
25
|
+
- Cell highlighting with Animation API
|
|
26
|
+
- Built-in custom cells: Filter, Editable, Checkbox, Number, Change
|
|
27
|
+
- Column resize, header drag, row drag
|
|
28
|
+
- Merge cells (virtual mode, huge rowspan / colspan supported)
|
|
29
|
+
- Custom scrollbar
|
|
30
|
+
- Sortable & filterable
|
|
31
|
+
- Theme support (dark / light)
|
|
32
|
+
- CSS variables for easy customization
|
|
33
|
+
- Based on native `<table>` element
|
|
34
|
+
- Zero third-party runtime dependencies
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
### [Stk Table Vue Official](https://ja-plus.github.io/stk-table-vue/)
|
|
39
|
+
### [Stk Table React Official](https://ja-plus.github.io/stk-table-react/)
|
|
40
|
+
### [Stk Table Svelte Official](https://ja-plus.github.io/stk-table-svelte/)
|
|
41
|
+
### [Stk Table Solid Official](https://ja-plus.github.io/stk-table-solid/)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Repo:
|
|
45
|
+
- [Github](https://github.com/ja-plus/stk-table-vue)
|
|
46
|
+
- [Gitee](https://gitee.com/japlus/stk-table-vue)
|
|
47
|
+
|
|
48
|
+
## Demo
|
|
49
|
+
[<span style="font-size: 16px;font-weight: bold;">Online Demo in stackblitz</span>](https://stackblitz.com/edit/vitejs-vite-ad91hh?file=src%2FDemo%2Findex.vue)
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
> npm install stk-table-vue
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<script setup>
|
|
56
|
+
import { StkTable } from 'stk-table-vue'
|
|
57
|
+
import { ref, useTemplateRef } from 'vue'
|
|
58
|
+
const stkTableRef = ref<InstanceType<typeof StkTable>>();
|
|
59
|
+
// or Vue 3.5 useTemplateRef
|
|
60
|
+
const stkTableRef = useTemplateRef('stkTableRef');
|
|
61
|
+
|
|
62
|
+
// highlight row
|
|
63
|
+
stkTableRef.value.setHighlightDimRow([rowKey], {
|
|
64
|
+
method: 'css' | 'animation', // default animation
|
|
65
|
+
className: 'custom-class-name', // for method 'css'
|
|
66
|
+
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
|
|
67
|
+
duration: 2000,
|
|
68
|
+
});
|
|
69
|
+
// highlight cell
|
|
70
|
+
stkTableRef.value.setHighlightDimCell(rowKey, colDataIndex, {
|
|
71
|
+
method: 'css' | 'animation',
|
|
72
|
+
className: 'custom-class-name', // for method 'css'
|
|
73
|
+
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // for method 'animation'
|
|
74
|
+
duration: 2000,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const columns = [
|
|
78
|
+
{title: 'name', dataIndex: 'name'},
|
|
79
|
+
{title: 'age', dataIndex: 'age'},
|
|
80
|
+
{title: 'address', dataIndex: 'address'},
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
const dataSource = [
|
|
84
|
+
{id: 1, name: 'John', age: 32, address: 'New York'},
|
|
85
|
+
{id: 2, name: 'Jim', age: 42, address: 'London'},
|
|
86
|
+
{id: 3, name: 'Joe', age: 52, address: 'Tokyo'},
|
|
87
|
+
{id: 4, name: 'Jack', age: 62, address: 'Sydney'},
|
|
88
|
+
{id: 5, name: 'Jill', age: 72, address: 'Paris'},
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<StkTable ref='stkTableRef' row-key="id" :data-source="dataSource" :columns="columns"></StkTable>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Vue2.7 Usage
|
|
100
|
+
[Vue2.7 Usage](https://ja-plus.github.io/stk-table-vue/main/start/vue2-usage.html)
|
|
101
|
+
|
|
102
|
+
## API
|
|
103
|
+
* [Props](https://ja-plus.github.io/stk-table-vue/main/api/table-props.html)
|
|
104
|
+
|
|
105
|
+
* [Emits](https://ja-plus.github.io/stk-table-vue/main/api/emits.html)
|
|
106
|
+
|
|
107
|
+
* [Slots](https://ja-plus.github.io/stk-table-vue/main/api/slots.html)
|
|
108
|
+
|
|
109
|
+
* [Expose](https://ja-plus.github.io/stk-table-vue/main/api/expose.html)
|
|
110
|
+
|
|
111
|
+
* [StkTableColumn: Define column type](https://ja-plus.github.io/stk-table-vue/main/api/stk-table-column.html)
|
|
112
|
+
|
|
113
|
+
* [Highlight: setHighlightDimCell & setHighlightDimRow](https://ja-plus.github.io/stk-table-vue/main/api/expose.html#sethighlightdimcell)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
### Example
|
|
117
|
+
```vue
|
|
118
|
+
<template>
|
|
119
|
+
<StkTable
|
|
120
|
+
ref="stkTable"
|
|
121
|
+
row-key="name"
|
|
122
|
+
v-model:columns="columns"
|
|
123
|
+
:style="{height:props.height}"
|
|
124
|
+
theme='dark'
|
|
125
|
+
height='200px'
|
|
126
|
+
bordered="h"
|
|
127
|
+
:row-height="28"
|
|
128
|
+
:show-overflow="false"
|
|
129
|
+
:show-header-overflow="false"
|
|
130
|
+
:sort-remote="false"
|
|
131
|
+
col-resizable
|
|
132
|
+
header-drag
|
|
133
|
+
virtual
|
|
134
|
+
virtual-x
|
|
135
|
+
no-data-full
|
|
136
|
+
col-resizable
|
|
137
|
+
auto-resize
|
|
138
|
+
fixed-col-shadow
|
|
139
|
+
:col-min-width="10"
|
|
140
|
+
:headless="false"
|
|
141
|
+
:data-source="dataSource"
|
|
142
|
+
@current-change="onCurrentChange"
|
|
143
|
+
@row-menu="onRowMenu"
|
|
144
|
+
@header-row-menu="onHeaderRowMenu"
|
|
145
|
+
@row-click="onRowClick"
|
|
146
|
+
@row-dblclick="onRowDblclick"
|
|
147
|
+
@sort-change="handleSortChange"
|
|
148
|
+
@cell-click="onCellClick"
|
|
149
|
+
@header-cell-click="onHeaderCellClick"
|
|
150
|
+
@scroll="onTableScroll"
|
|
151
|
+
@scroll-x="onTableScrollX"
|
|
152
|
+
@col-order-change="onColOrderChange"
|
|
153
|
+
/>
|
|
154
|
+
</template>
|
|
155
|
+
<script setup>
|
|
156
|
+
import { h, defineComponent } from 'vue';
|
|
157
|
+
const columns = [
|
|
158
|
+
{
|
|
159
|
+
title: 'Name',
|
|
160
|
+
dataIndex: 'name',
|
|
161
|
+
fixed: 'left',
|
|
162
|
+
width: '200px',
|
|
163
|
+
headerClassName: 'my-th',
|
|
164
|
+
className: 'my-td',
|
|
165
|
+
sorter: true,
|
|
166
|
+
customHeaderCell: function FunctionalComponent(props){
|
|
167
|
+
return h(
|
|
168
|
+
'span',
|
|
169
|
+
{ style: 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
|
|
170
|
+
props.col.title + '(render) text-overflow,',
|
|
171
|
+
);
|
|
172
|
+
},
|
|
173
|
+
customCell: defineComponent({
|
|
174
|
+
setup(){
|
|
175
|
+
//...
|
|
176
|
+
return () => <div></div> // vue jsx
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
},
|
|
180
|
+
]
|
|
181
|
+
</script>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Compare
|
|
185
|
+
Compare performance with other vue table [vue-virtual-table-benchmark](https://github.com/ja-plus/vue-virtual-table-benchmark)
|
|
186
|
+
|
|
187
|
+
[Benchmark Result Page](https://ja-plus.github.io/vue-virtual-table-benchmark/perf-report.html)
|
|
188
|
+
|
|
189
|
+
## Changelog
|
|
190
|
+
[CHANGELOG](CHANGELOG.md)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
[MIT](LICENSE)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.2.
|
|
3
|
+
* version: v1.2.6
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
7
7
|
* license: MIT
|
|
8
8
|
*/
|
|
9
|
-
import { t as StkTable_default } from "./StkTable-
|
|
9
|
+
import { t as StkTable_default } from "./StkTable-CGcxwpdb.js";
|
|
10
10
|
import { createElementBlock, createElementVNode, createVNode, defineComponent, h, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, withModifiers } from "vue";
|
|
11
11
|
//#region src/StkTable/custom-cells/FilterCell/Dropdown/index.vue?vue&type=script&setup=true&lang.ts
|
|
12
12
|
var DROPDOWN_DEFAULT_WIDTH = 300;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.2.
|
|
3
|
+
* version: v1.2.6
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
@@ -4093,6 +4093,7 @@ function useVirtualScroll(props, tableContainerRef, trRef, dataSourceCopy, table
|
|
|
4093
4093
|
/** fix: 滚动条不在顶部时,表格数据变少,导致滚动条位置有误 */
|
|
4094
4094
|
scrollTop = maxScrollTop;
|
|
4095
4095
|
assignVs(virtualScroll, {
|
|
4096
|
+
rowHeight,
|
|
4096
4097
|
containerHeight,
|
|
4097
4098
|
pageSize,
|
|
4098
4099
|
scrollHeight
|
|
@@ -4875,6 +4876,7 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4875
4876
|
if (props.autoResize) useAutoResize(tableContainerRef, () => {
|
|
4876
4877
|
initVirtualScroll();
|
|
4877
4878
|
updateFixedShadow();
|
|
4879
|
+
updateCustomScrollbar();
|
|
4878
4880
|
}, props, 200);
|
|
4879
4881
|
const [colResizeOn, isColResizing, onThResizeMouseDown] = useColResize(props, emits, tableContainerRef, tableHeaderLast, colResizeIndicatorRef, colKeyGen, fixedCols, clearColWidthCache);
|
|
4880
4882
|
const [toggleExpandRow, setRowExpand] = useRowExpand(emits, dataSourceCopy, rowKeyGen, onDataSourceChange);
|
|
@@ -4953,7 +4955,21 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4953
4955
|
watch(() => props.virtual, () => {
|
|
4954
4956
|
nextTick(initVirtualScrollY);
|
|
4955
4957
|
});
|
|
4956
|
-
|
|
4958
|
+
/**
|
|
4959
|
+
* 行高类配置变化后重算虚拟滚动几何。
|
|
4960
|
+
* 合并为一个 watcher:同一 tick 内多项同时变化只重算一次。
|
|
4961
|
+
* 必须无参调用 initVirtualScrollY(其首参是虚拟滚动容器高度,不能把行高值传入),
|
|
4962
|
+
* 且需 nextTick 等新的 --row-height / 表头行高等样式应用到 DOM 后再测量。
|
|
4963
|
+
*
|
|
4964
|
+
* 监听值拼接为单个原始值(字符串)而非返回数组:getter 返回数组时每次求值都是新数组,
|
|
4965
|
+
* 身份比较必然变化,父组件传入内联对象字面量(如 :expand-config="{ height: 40 }",官方示例即如此写法)
|
|
4966
|
+
* 会让本 watcher 在父组件每次重渲染时误触发;展开行/变高大表下误触发一次会连带行高树 O(n) 重建
|
|
4967
|
+
* (实测 50K 行每次父重渲染多付 ~10ms)。拼接为原始值后仅在值真正变化时触发,且兼容 Vue 2.7。
|
|
4968
|
+
*/
|
|
4969
|
+
watch(() => {
|
|
4970
|
+
var _props$expandConfig;
|
|
4971
|
+
return `${props.rowHeight}|${props.headerRowHeight}|${props.footerRowHeight}|${(_props$expandConfig = props.expandConfig) === null || _props$expandConfig === void 0 ? void 0 : _props$expandConfig.height}`;
|
|
4972
|
+
}, () => nextTick(initVirtualScrollY));
|
|
4957
4973
|
watch(() => props.virtualX, () => {
|
|
4958
4974
|
handleDealColumns();
|
|
4959
4975
|
nextTick(() => {
|
|
@@ -5168,7 +5184,7 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
5168
5184
|
return col.title || "";
|
|
5169
5185
|
}
|
|
5170
5186
|
function getTRProps(row, index) {
|
|
5171
|
-
var _props$
|
|
5187
|
+
var _props$expandConfig2;
|
|
5172
5188
|
const rowIndex = getAbsoluteRowIndex(index);
|
|
5173
5189
|
const rowKey = rowKeyGen(row);
|
|
5174
5190
|
const classList = [
|
|
@@ -5185,9 +5201,9 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
5185
5201
|
class: classList.filter(Boolean).join(" "),
|
|
5186
5202
|
style: null
|
|
5187
5203
|
};
|
|
5188
|
-
if ((row === null || row === void 0 ? void 0 : row.__EXP_R__) && props.virtual && ((_props$
|
|
5189
|
-
var _props$
|
|
5190
|
-
result.style = `--row-height: ${(_props$
|
|
5204
|
+
if ((row === null || row === void 0 ? void 0 : row.__EXP_R__) && props.virtual && ((_props$expandConfig2 = props.expandConfig) === null || _props$expandConfig2 === void 0 ? void 0 : _props$expandConfig2.height)) {
|
|
5205
|
+
var _props$expandConfig3;
|
|
5206
|
+
result.style = `--row-height: ${(_props$expandConfig3 = props.expandConfig) === null || _props$expandConfig3 === void 0 ? void 0 : _props$expandConfig3.height}px`;
|
|
5191
5207
|
}
|
|
5192
5208
|
return result;
|
|
5193
5209
|
}
|
|
@@ -20,6 +20,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<im
|
|
|
20
20
|
/**
|
|
21
21
|
* 行高
|
|
22
22
|
* - `props.autoRowHeight` 为 `true` 时,将表示为期望行高,用于计算。不再影响实际行高。
|
|
23
|
+
* - 支持动态修改,修改后自动重算可视区行数与滚动高度,并与 `--row-height` 保持同步。
|
|
23
24
|
*/
|
|
24
25
|
rowHeight?: number;
|
|
25
26
|
/**
|
|
@@ -35,9 +36,15 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<im
|
|
|
35
36
|
* @deprecated
|
|
36
37
|
*/
|
|
37
38
|
rowCurrentRevokable?: boolean;
|
|
38
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* 表头行高。default = rowHeight
|
|
41
|
+
* - 支持动态修改,表头占用的表体行数(pageSize)随之重算。
|
|
42
|
+
*/
|
|
39
43
|
headerRowHeight?: number | string;
|
|
40
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* 表尾行高。default = rowHeight
|
|
46
|
+
* - 支持动态修改。表尾行悬浮于滚动区底部,不计入虚拟滚动的总高度。
|
|
47
|
+
*/
|
|
41
48
|
footerRowHeight?: number | string;
|
|
42
49
|
/** 虚拟滚动 */
|
|
43
50
|
virtual?: boolean;
|
|
@@ -510,6 +517,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<im
|
|
|
510
517
|
/**
|
|
511
518
|
* 行高
|
|
512
519
|
* - `props.autoRowHeight` 为 `true` 时,将表示为期望行高,用于计算。不再影响实际行高。
|
|
520
|
+
* - 支持动态修改,修改后自动重算可视区行数与滚动高度,并与 `--row-height` 保持同步。
|
|
513
521
|
*/
|
|
514
522
|
rowHeight?: number;
|
|
515
523
|
/**
|
|
@@ -525,9 +533,15 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<im
|
|
|
525
533
|
* @deprecated
|
|
526
534
|
*/
|
|
527
535
|
rowCurrentRevokable?: boolean;
|
|
528
|
-
/**
|
|
536
|
+
/**
|
|
537
|
+
* 表头行高。default = rowHeight
|
|
538
|
+
* - 支持动态修改,表头占用的表体行数(pageSize)随之重算。
|
|
539
|
+
*/
|
|
529
540
|
headerRowHeight?: number | string;
|
|
530
|
-
/**
|
|
541
|
+
/**
|
|
542
|
+
* 表尾行高。default = rowHeight
|
|
543
|
+
* - 支持动态修改。表尾行悬浮于滚动区底部,不计入虚拟滚动的总高度。
|
|
544
|
+
*/
|
|
531
545
|
footerRowHeight?: number | string;
|
|
532
546
|
/** 虚拟滚动 */
|
|
533
547
|
virtual?: boolean;
|
|
@@ -297,7 +297,10 @@ export type SeqConfig = {
|
|
|
297
297
|
};
|
|
298
298
|
/** Configuration options for the expand column */
|
|
299
299
|
export type ExpandConfig = {
|
|
300
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* worked in virtual mode
|
|
302
|
+
* 展开行的行高,支持动态修改(修改后行高累计与虚拟滚动会一同重算)
|
|
303
|
+
*/
|
|
301
304
|
height?: number;
|
|
302
305
|
};
|
|
303
306
|
/** drag row config */
|
|
@@ -13,7 +13,12 @@ export type VirtualScrollStore = {
|
|
|
13
13
|
startIndex: number;
|
|
14
14
|
/** 数组结束位置 */
|
|
15
15
|
endIndex: number;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* 基准行高(px)。
|
|
18
|
+
* 由 initVirtualScrollY 随 props.rowHeight 同步(模板中的 --row-height 亦取此值,二者同源),
|
|
19
|
+
* 因此行高配置动态变化后此处不会是旧快照。
|
|
20
|
+
* 仅记录统一基准行高:变高模式(autoRowHeight)与展开行的行级高度不写入此字段。
|
|
21
|
+
*/
|
|
17
22
|
rowHeight: number;
|
|
18
23
|
/** 表格定位上边距 */
|
|
19
24
|
offsetTop: number;
|
package/lib/stk-table-vue.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.2.
|
|
3
|
+
* version: v1.2.6
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
7
7
|
* license: MIT
|
|
8
8
|
*/
|
|
9
|
-
import { a as insertToOrderedArray, i as binarySearch, n as registerFeature, o as strCompare, r as useAreaSelection, s as tableSort, t as StkTable_default } from "./StkTable-
|
|
9
|
+
import { a as insertToOrderedArray, i as binarySearch, n as registerFeature, o as strCompare, r as useAreaSelection, s as tableSort, t as StkTable_default } from "./StkTable-CGcxwpdb.js";
|
|
10
10
|
import { Fragment, computed, createApp, createBlock, createElementBlock, createElementVNode, createTextVNode, defineComponent, getCurrentInstance, h, markRaw, nextTick, normalizeClass, openBlock, ref, renderSlot, resolveDynamicComponent, toDisplayString, watch, withModifiers } from "vue";
|
|
11
11
|
//#region src/StkTable/custom-cells/FilterCell/Dropdown/index.ts
|
|
12
12
|
var DropdownIns = null;
|
|
@@ -15,7 +15,7 @@ async function getDropdownIns() {
|
|
|
15
15
|
const div = document.createElement("div");
|
|
16
16
|
div.classList.add("stk-filter-dropdown-wrapper");
|
|
17
17
|
document.body.appendChild(div);
|
|
18
|
-
DropdownIns = createApp(await import("./Dropdown-
|
|
18
|
+
DropdownIns = createApp(await import("./Dropdown-BAANgg_5.js").then((module) => module.default)).mount(div);
|
|
19
19
|
}
|
|
20
20
|
return DropdownIns;
|
|
21
21
|
}
|