stk-table-vue 0.8.3 → 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/README.md +21 -54
- package/lib/src/StkTable/useMaxRowSpan.d.ts +14 -0
- package/lib/src/StkTable/useMergeCells.d.ts +4 -2
- package/lib/src/StkTable/useVirtualScroll.d.ts +3 -2
- package/lib/stk-table-vue.js +2797 -2737
- package/lib/style.css +412 -410
- package/package.json +3 -3
- package/src/StkTable/StkTable.vue +25 -26
- package/src/StkTable/style.less +4 -2
- package/src/StkTable/useMaxRowSpan.ts +56 -0
- package/src/StkTable/useMergeCells.ts +18 -17
- package/src/StkTable/useVirtualScroll.ts +46 -10
package/README.md
CHANGED
|
@@ -12,57 +12,27 @@
|
|
|
12
12
|
</p>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
-
>
|
|
16
|
-
>
|
|
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
|
|
17
20
|
|
|
18
|
-
> Vue2.7支持引入源码(**ts**)使用。
|
|
19
21
|
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
+
## Documentation
|
|
23
|
+
### [Stk Table Vue Official CN](https://ja-plus.github.io/stk-table-vue/)
|
|
24
|
+
|
|
22
25
|
|
|
23
26
|
## Repo:
|
|
24
27
|
- [Github](https://github.com/ja-plus/stk-table-vue)
|
|
25
28
|
- [Gitee](https://gitee.com/japlus/stk-table-vue) 🇨🇳
|
|
26
29
|
|
|
27
30
|
## Demo
|
|
31
|
+
[<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)
|
|
32
|
+
|
|
33
|
+
## Compare
|
|
34
|
+
Compare performance with other vue table [vue-table-compare](https://github.com/ja-plus/vue-table-compare)
|
|
28
35
|
|
|
29
|
-
[<span style="font-size: 16px;font-weight: bold;">Online Demo</span>](https://stackblitz.com/edit/vitejs-vite-ad91hh?file=src%2FDemo%2Findex.vue)
|
|
30
|
-
|
|
31
|
-
## Feature TODO:
|
|
32
|
-
* [x] 高亮行,单元格。
|
|
33
|
-
- [x] 使用 `Web Animations API` 实现高亮。(`v0.3.4` 变更为默认值)
|
|
34
|
-
- [x] 支持配置高亮参数(持续时间,颜色,频率)。(`v0.2.9`)
|
|
35
|
-
- [x] `setHighlightDimRow`/`setHighlightCellRow`支持自定义高亮css类名。(`v0.2.9`)
|
|
36
|
-
* [x] 虚拟列表。
|
|
37
|
-
- [x] 纵向。
|
|
38
|
-
- [x] 横向(必须设置列宽)。
|
|
39
|
-
- [x] 支持不定行高。(`v0.6.0`)
|
|
40
|
-
* [x] 列固定。
|
|
41
|
-
- [x] 固定列阴影。
|
|
42
|
-
- [x] 多级表头固定列阴影。
|
|
43
|
-
- [x] sticky column 动态计算阴影位置。(`v0.4.0`)
|
|
44
|
-
* [x] 行展开。(`v0.5.0`)
|
|
45
|
-
* [x] 行拖动。(`v0.5.0`)
|
|
46
|
-
* [x] 树形。(`v0.7.0`)
|
|
47
|
-
* [x] 单元格合并。(`v0.8.0`)
|
|
48
|
-
* [] 列筛选。
|
|
49
|
-
* [x] 斑马纹。
|
|
50
|
-
* [x] 拖动更改列顺序。
|
|
51
|
-
* [x] 拖动调整列宽。
|
|
52
|
-
* [x] 排序
|
|
53
|
-
- [x] 支持配置 `null` | `undefined` 永远排最后。
|
|
54
|
-
- [x] 支持配置 string 使用 `String.prototype.localCompare` 排序。
|
|
55
|
-
* [x] 多级表头。
|
|
56
|
-
- [] 横向虚拟滚动。
|
|
57
|
-
* [x] 支持table-layout: fixed 配置。
|
|
58
|
-
* [x] 鼠标悬浮在表格上,键盘滚动虚拟表格。
|
|
59
|
-
- [x] 键盘 `ArrowUp`/`ArrowDown`/`ArrowLeft`/`ArrowRight`/`PageUp`/ `PageDown` 按键支持。
|
|
60
|
-
* [] 非虚拟滚动时,大数据分批加载。
|
|
61
|
-
* [x] vue2.7支持(引入源码使用)。
|
|
62
|
-
- [x] `props.optimizeVue2Scroll` 优化vue2虚拟滚动流畅度。(`v0.2.0`)
|
|
63
|
-
* [x] 支持配置序号列。`StkTableColumn['type']`。(`v0.3.0`)
|
|
64
|
-
* [x] `props.cellHover`单元格悬浮样式。(`v0.3.2`)
|
|
65
|
-
* [] 惯性滚动优化。
|
|
66
36
|
|
|
67
37
|
|
|
68
38
|
## Usage
|
|
@@ -78,17 +48,17 @@ const stkTableRef = useTemplateRef('stkTableRef');
|
|
|
78
48
|
|
|
79
49
|
// highlight row
|
|
80
50
|
stkTableRef.value.setHighlightDimRow([rowKey],{
|
|
81
|
-
method: 'css'|'animation',//
|
|
82
|
-
className: 'custom-class-name', // method css
|
|
51
|
+
method: 'css'|'animation',// default animation。
|
|
52
|
+
className: 'custom-class-name', // method css。
|
|
83
53
|
keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}],//same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
|
|
84
|
-
duration: 2000
|
|
54
|
+
duration: 2000,。
|
|
85
55
|
});
|
|
86
56
|
// highlight cell
|
|
87
57
|
stkTableRef.value.setHighlightDimCell(rowKey, colDataIndex, {
|
|
88
58
|
method: 'css'|'animation',
|
|
89
|
-
className:'custom-class-name', // method css
|
|
90
|
-
keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}], // method animation
|
|
91
|
-
duration: 2000
|
|
59
|
+
className:'custom-class-name', // method css。
|
|
60
|
+
keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}], // method animation。
|
|
61
|
+
duration: 2000,。
|
|
92
62
|
});
|
|
93
63
|
|
|
94
64
|
const columns = [
|
|
@@ -114,10 +84,7 @@ const dataSource = [
|
|
|
114
84
|
```
|
|
115
85
|
|
|
116
86
|
### Vue2.7 Usage
|
|
117
|
-
[
|
|
118
|
-
|
|
119
|
-
## Notice
|
|
120
|
-
注意,组件会改动 `props.columns` 中的对象。如果多个组件 `columns` 数组元素存在引用同一个 `StkTableColumn` 对象。则考虑赋值 `columns` 前进行深拷贝。
|
|
87
|
+
[Vue2.7 Usage](https://ja-plus.github.io/stk-table-vue/main/start/vue2-usage.html)
|
|
121
88
|
|
|
122
89
|
## API
|
|
123
90
|
### Props
|
|
@@ -136,7 +103,7 @@ const dataSource = [
|
|
|
136
103
|
[StkTableColumn 列配置](https://ja-plus.github.io/stk-table-vue/main/api/stk-table-column.html)
|
|
137
104
|
|
|
138
105
|
### setHighlightDimCell & setHighlightDimRow
|
|
139
|
-
[
|
|
106
|
+
[Highlight 高亮](https://ja-plus.github.io/stk-table-vue/main/api/expose.html#sethighlightdimcell)
|
|
140
107
|
|
|
141
108
|
|
|
142
109
|
### Example
|
|
@@ -209,4 +176,4 @@ const dataSource = [
|
|
|
209
176
|
|
|
210
177
|
|
|
211
178
|
## Other
|
|
212
|
-
* `$*$`
|
|
179
|
+
* `$*$`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ShallowRef } from 'vue';
|
|
2
|
+
import { PrivateStkTableColumn, RowKeyGen, UniqKey } from './types';
|
|
3
|
+
|
|
4
|
+
type Options = {
|
|
5
|
+
props: any;
|
|
6
|
+
tableHeaderLast: ShallowRef<PrivateStkTableColumn<any>[]>;
|
|
7
|
+
rowKeyGen: RowKeyGen;
|
|
8
|
+
dataSourceCopy: ShallowRef<any[]>;
|
|
9
|
+
};
|
|
10
|
+
export declare function useMaxRowSpan({ props, tableHeaderLast, rowKeyGen, dataSourceCopy }: Options): {
|
|
11
|
+
maxRowSpan: Map<UniqKey, number>;
|
|
12
|
+
updateMaxRowSpan: () => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ShallowRef } from 'vue';
|
|
2
2
|
import { ColKeyGen, MergeCellsParam, PrivateStkTableColumn, RowKeyGen, UniqKey } from './types';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type Options = {
|
|
5
5
|
props: any;
|
|
6
6
|
tableHeaderLast: ShallowRef<PrivateStkTableColumn<any>[]>;
|
|
7
7
|
rowKeyGen: RowKeyGen;
|
|
8
8
|
colKeyGen: ColKeyGen;
|
|
9
9
|
virtual_dataSourcePart: ShallowRef<any[]>;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
|
+
export declare function useMergeCells({ props, tableHeaderLast, rowKeyGen, colKeyGen, virtual_dataSourcePart, }: Options): {
|
|
11
12
|
hiddenCellMap: import('vue').Ref<Record<UniqKey, Set<UniqKey>>, Record<UniqKey, Set<UniqKey>>>;
|
|
12
13
|
mergeCellsWrapper: (row: MergeCellsParam<any>["row"], col: MergeCellsParam<any>["col"], rowIndex: MergeCellsParam<any>["rowIndex"], colIndex: MergeCellsParam<any>["colIndex"]) => {
|
|
13
14
|
colspan?: number;
|
|
@@ -18,3 +19,4 @@ export declare function useMergeCells({ props, tableHeaderLast, rowKeyGen, colKe
|
|
|
18
19
|
activeMergedCells: import('vue').Ref<Set<string> & Omit<Set<string>, keyof Set<any>>, Set<string> | (Set<string> & Omit<Set<string>, keyof Set<any>>)>;
|
|
19
20
|
updateActiveMergedCells: (clear?: boolean) => void;
|
|
20
21
|
};
|
|
22
|
+
export {};
|
|
@@ -9,6 +9,7 @@ type Option<DT extends Record<string, any>> = {
|
|
|
9
9
|
tableHeaderLast: ShallowRef<PrivateStkTableColumn<DT>[]>;
|
|
10
10
|
tableHeaders: ShallowRef<PrivateStkTableColumn<DT>[][]>;
|
|
11
11
|
rowKeyGen: RowKeyGen;
|
|
12
|
+
maxRowSpan: Map<UniqKey, number>;
|
|
12
13
|
};
|
|
13
14
|
/** 暂存纵向虚拟滚动的数据 */
|
|
14
15
|
export type VirtualScrollStore = {
|
|
@@ -45,11 +46,11 @@ export type VirtualScrollXStore = {
|
|
|
45
46
|
scrollLeft: number;
|
|
46
47
|
};
|
|
47
48
|
/**
|
|
48
|
-
*
|
|
49
|
+
* virtual scroll
|
|
49
50
|
* @param param0
|
|
50
51
|
* @returns
|
|
51
52
|
*/
|
|
52
|
-
export declare function useVirtualScroll<DT extends Record<string, any>>({ props, tableContainerRef, trRef, dataSourceCopy, tableHeaderLast, tableHeaders, rowKeyGen, }: Option<DT>): {
|
|
53
|
+
export declare function useVirtualScroll<DT extends Record<string, any>>({ props, tableContainerRef, trRef, dataSourceCopy, tableHeaderLast, tableHeaders, rowKeyGen, maxRowSpan, }: Option<DT>): {
|
|
53
54
|
virtualScroll: Ref<{
|
|
54
55
|
containerHeight: number;
|
|
55
56
|
pageSize: number;
|