stk-table-vue 0.8.13 → 0.8.15
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 +172 -180
- package/lib/src/StkTable/StkTable.vue.d.ts +7 -2
- package/lib/src/StkTable/utils/index.d.ts +3 -0
- package/lib/stk-table-vue.js +222 -139
- package/lib/style.css +9 -2
- package/package.json +74 -72
- package/src/StkTable/StkTable.vue +1665 -1653
- package/src/StkTable/components/DragHandle.vue +9 -9
- package/src/StkTable/components/SortIcon.vue +6 -6
- package/src/StkTable/components/TriangleIcon.vue +3 -3
- package/src/StkTable/const.ts +50 -50
- package/src/StkTable/index.ts +4 -4
- package/src/StkTable/style.less +579 -580
- package/src/StkTable/types/highlightDimOptions.ts +26 -26
- package/src/StkTable/types/index.ts +297 -297
- package/src/StkTable/useAutoResize.ts +91 -91
- package/src/StkTable/useColResize.ts +216 -216
- package/src/StkTable/useFixedCol.ts +150 -148
- package/src/StkTable/useFixedStyle.ts +75 -75
- package/src/StkTable/useGetFixedColPosition.ts +65 -65
- package/src/StkTable/useHighlight.ts +257 -257
- package/src/StkTable/useKeyboardArrowScroll.ts +112 -112
- package/src/StkTable/useMaxRowSpan.ts +55 -55
- package/src/StkTable/useMergeCells.ts +120 -123
- package/src/StkTable/useRowExpand.ts +88 -88
- package/src/StkTable/useScrollRowByRow.ts +114 -79
- package/src/StkTable/useThDrag.ts +102 -102
- package/src/StkTable/useTrDrag.ts +113 -118
- package/src/StkTable/useTree.ts +161 -161
- package/src/StkTable/useVirtualScroll.ts +494 -494
- package/src/StkTable/utils/constRefUtils.ts +29 -29
- package/src/StkTable/utils/index.ts +258 -242
- 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,180 +1,172 @@
|
|
|
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 list component based on Vue.
|
|
16
|
-
>
|
|
17
|
-
> Used for real-time data display, with data highlighting and dynamic effects
|
|
18
|
-
>
|
|
19
|
-
> Support Vue3 and Vue2.7
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## Documentation
|
|
23
|
-
### [Stk Table Vue Official en](https://ja-plus.github.io/stk-table-vue/en/)
|
|
24
|
-
### [Stk Table Vue Official zh-CN](https://ja-plus.github.io/stk-table-vue/)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Repo:
|
|
28
|
-
- [Github](https://github.com/ja-plus/stk-table-vue)
|
|
29
|
-
- [Gitee](https://gitee.com/japlus/stk-table-vue) 🇨🇳
|
|
30
|
-
|
|
31
|
-
## Demo
|
|
32
|
-
[<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)
|
|
33
|
-
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
[
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
[
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
:
|
|
123
|
-
:
|
|
124
|
-
:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
},
|
|
174
|
-
]
|
|
175
|
-
</script>
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
## Other
|
|
180
|
-
* `$*$`
|
|
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 list component based on Vue.
|
|
16
|
+
>
|
|
17
|
+
> Used for real-time data display, with data highlighting and dynamic effects
|
|
18
|
+
>
|
|
19
|
+
> Support Vue3 and Vue2.7
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Documentation
|
|
23
|
+
### [Stk Table Vue Official en](https://ja-plus.github.io/stk-table-vue/en/)
|
|
24
|
+
### [Stk Table Vue Official zh-CN](https://ja-plus.github.io/stk-table-vue/)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Repo:
|
|
28
|
+
- [Github](https://github.com/ja-plus/stk-table-vue)
|
|
29
|
+
- [Gitee](https://gitee.com/japlus/stk-table-vue) 🇨🇳
|
|
30
|
+
|
|
31
|
+
## Demo
|
|
32
|
+
[<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)
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
> npm install stk-table-vue
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<script setup>
|
|
39
|
+
import { StkTable } from 'stk-table-vue'
|
|
40
|
+
import { ref, useTemplateRef } from 'vue'
|
|
41
|
+
const stkTableRef = ref<InstanceType<typeof StkTable>>();
|
|
42
|
+
// or Vue 3.5 useTemplateRef
|
|
43
|
+
const stkTableRef = useTemplateRef('stkTableRef');
|
|
44
|
+
|
|
45
|
+
// highlight row
|
|
46
|
+
stkTableRef.value.setHighlightDimRow([rowKey],{
|
|
47
|
+
method: 'css'|'animation',// default animation。
|
|
48
|
+
className: 'custom-class-name', // method css。
|
|
49
|
+
keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}],//same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
|
|
50
|
+
duration: 2000,。
|
|
51
|
+
});
|
|
52
|
+
// highlight cell
|
|
53
|
+
stkTableRef.value.setHighlightDimCell(rowKey, colDataIndex, {
|
|
54
|
+
method: 'css'|'animation',
|
|
55
|
+
className:'custom-class-name', // method css。
|
|
56
|
+
keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}], // method animation。
|
|
57
|
+
duration: 2000,。
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const columns = [
|
|
61
|
+
{title: 'name', dataIndex: 'name'},
|
|
62
|
+
{title: 'age', dataIndex: 'age'},
|
|
63
|
+
{title: 'address', dataIndex: 'address'},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const dataSource = [
|
|
67
|
+
{id: 1, name: 'John', age: 32, address: 'New York'},
|
|
68
|
+
{id: 2, name: 'Jim', age: 42, address: 'London'},
|
|
69
|
+
{id: 3, name: 'Joe', age: 52, address: 'Tokyo'},
|
|
70
|
+
{id: 4, name: 'Jack', age: 62, address: 'Sydney'},
|
|
71
|
+
{id: 5, name: 'Jill', age: 72, address: 'Paris'},
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<StkTable ref='stkTableRef' row-key="id" :data-source="dataSource" :columns="columns"></StkTable>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Vue2.7 Usage
|
|
83
|
+
[Vue2.7 Usage](https://ja-plus.github.io/stk-table-vue/main/start/vue2-usage.html)
|
|
84
|
+
|
|
85
|
+
## API
|
|
86
|
+
* [Props](https://ja-plus.github.io/stk-table-vue/main/api/table-props.html)
|
|
87
|
+
|
|
88
|
+
* [Emits](https://ja-plus.github.io/stk-table-vue/main/api/emits.html)
|
|
89
|
+
|
|
90
|
+
* [Slots](https://ja-plus.github.io/stk-table-vue/main/api/slots.html)
|
|
91
|
+
|
|
92
|
+
* [Expose](https://ja-plus.github.io/stk-table-vue/main/api/expose.html)
|
|
93
|
+
|
|
94
|
+
* [StkTableColumn: Define column type](https://ja-plus.github.io/stk-table-vue/main/api/stk-table-column.html)
|
|
95
|
+
|
|
96
|
+
* [Highlight: setHighlightDimCell & setHighlightDimRow](https://ja-plus.github.io/stk-table-vue/main/api/expose.html#sethighlightdimcell)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Example
|
|
100
|
+
```vue
|
|
101
|
+
<template>
|
|
102
|
+
<StkTable
|
|
103
|
+
ref="stkTable"
|
|
104
|
+
row-key="name"
|
|
105
|
+
v-model:columns="columns"
|
|
106
|
+
:style="{height:props.height}"
|
|
107
|
+
theme='dark'
|
|
108
|
+
height='200px'
|
|
109
|
+
bordered="h"
|
|
110
|
+
:row-height="28"
|
|
111
|
+
:show-overflow="false"
|
|
112
|
+
:show-header-overflow="false"
|
|
113
|
+
:sort-remote="false"
|
|
114
|
+
col-resizable
|
|
115
|
+
header-drag
|
|
116
|
+
virtual
|
|
117
|
+
virtual-x
|
|
118
|
+
no-data-full
|
|
119
|
+
col-resizable
|
|
120
|
+
auto-resize
|
|
121
|
+
fixed-col-shadow
|
|
122
|
+
:col-min-width="10"
|
|
123
|
+
:headless="false"
|
|
124
|
+
:data-source="dataSource"
|
|
125
|
+
@current-change="onCurrentChange"
|
|
126
|
+
@row-menu="onRowMenu"
|
|
127
|
+
@header-row-menu="onHeaderRowMenu"
|
|
128
|
+
@row-click="onRowClick"
|
|
129
|
+
@row-dblclick="onRowDblclick"
|
|
130
|
+
@sort-change="handleSortChange"
|
|
131
|
+
@cell-click="onCellClick"
|
|
132
|
+
@header-cell-click="onHeaderCellClick"
|
|
133
|
+
@scroll="onTableScroll"
|
|
134
|
+
@scroll-x="onTableScrollX"
|
|
135
|
+
@col-order-change="onColOrderChange"
|
|
136
|
+
/>
|
|
137
|
+
</template>
|
|
138
|
+
<script setup>
|
|
139
|
+
import { h, defineComponent } from 'vue';
|
|
140
|
+
const columns = [
|
|
141
|
+
{
|
|
142
|
+
title: 'Name',
|
|
143
|
+
dataIndex: 'name',
|
|
144
|
+
fixed: 'left',
|
|
145
|
+
width: '200px',
|
|
146
|
+
headerClassName: 'my-th',
|
|
147
|
+
className: 'my-td',
|
|
148
|
+
sorter: true,
|
|
149
|
+
customHeaderCell: function FunctionalComponent(props){
|
|
150
|
+
return h(
|
|
151
|
+
'span',
|
|
152
|
+
{ style: 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
|
|
153
|
+
props.col.title + '(render) text-overflow,',
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
customCell: defineComponent({
|
|
157
|
+
setup(){
|
|
158
|
+
//...
|
|
159
|
+
return () => <div></div> // vue jsx
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
},
|
|
163
|
+
]
|
|
164
|
+
</script>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Compare
|
|
168
|
+
Compare performance with other vue table [vue-table-compare](https://github.com/ja-plus/vue-table-compare)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
## Other
|
|
172
|
+
* `$*$`
|
|
@@ -4,6 +4,8 @@ import { AutoRowHeightConfig, ColResizableConfig, DragRowConfig, ExpandConfig, H
|
|
|
4
4
|
type DT = any & PrivateRowDT;
|
|
5
5
|
/**
|
|
6
6
|
* 选中一行
|
|
7
|
+
*
|
|
8
|
+
* en: Select a row
|
|
7
9
|
* @param {string} rowKeyOrRow selected rowKey, undefined to unselect
|
|
8
10
|
* @param {boolean} option.silent if set true not emit `current-change`. default:false
|
|
9
11
|
* @param {boolean} option.deep if set true, deep search in children. default:false
|
|
@@ -381,7 +383,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
381
383
|
})) | (UniqKey | (PrivateRowDT & {
|
|
382
384
|
children?: (PrivateRowDT & /*elided*/ any)[];
|
|
383
385
|
}))[], option?: {
|
|
384
|
-
expand
|
|
386
|
+
expand? /**
|
|
387
|
+
* 是否可变行高
|
|
388
|
+
* - 设置为 `true` 时, `props.rowHeight` 将表示为期望行高,用于计算。不再影响实际行高。
|
|
389
|
+
*/: boolean;
|
|
385
390
|
}) => void;
|
|
386
391
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
387
392
|
"sort-change": (col: StkTableColumn<any> | null, order: Order, data: any[], sortConfig: SortConfig<any>) => void;
|
|
@@ -680,6 +685,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
680
685
|
minWidth: string;
|
|
681
686
|
maxWidth: string;
|
|
682
687
|
sortConfig: SortConfig<DT>;
|
|
688
|
+
colKey: UniqKeyProp;
|
|
683
689
|
rowHeight: number;
|
|
684
690
|
headless: boolean;
|
|
685
691
|
autoRowHeight: boolean | AutoRowHeightConfig<DT>;
|
|
@@ -687,7 +693,6 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
687
693
|
optimizeVue2Scroll: boolean;
|
|
688
694
|
rowKey: UniqKeyProp;
|
|
689
695
|
headerRowHeight: number | string | null;
|
|
690
|
-
colKey: UniqKeyProp;
|
|
691
696
|
fixedMode: boolean;
|
|
692
697
|
theme: "light" | "dark";
|
|
693
698
|
rowHover: boolean;
|
|
@@ -51,3 +51,6 @@ export declare function howDeepTheHeader(arr: StkTableColumn<any>[], level?: num
|
|
|
51
51
|
export declare function transformWidthToStr(width?: string | number): string | undefined;
|
|
52
52
|
export declare function getBrowsersVersion(browserName: string): number;
|
|
53
53
|
export declare function pureCellKeyGen(rowKey: UniqKey, colKey: UniqKey): string;
|
|
54
|
+
export declare function getClosestTr(e: MouseEvent): HTMLTableRowElement | null;
|
|
55
|
+
export declare function getClosestTrIndex(e: MouseEvent): number;
|
|
56
|
+
export declare function getClosestColKey(e: MouseEvent): string | undefined;
|