stk-table-vue 0.6.17 → 0.7.0

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.
Files changed (39) hide show
  1. package/README.md +211 -213
  2. package/lib/src/StkTable/StkTable.vue.d.ts +43 -24
  3. package/lib/src/StkTable/components/TriangleIcon.vue.d.ts +2 -0
  4. package/lib/src/StkTable/const.d.ts +0 -1
  5. package/lib/src/StkTable/types/highlightDimOptions.d.ts +1 -5
  6. package/lib/src/StkTable/types/index.d.ts +26 -6
  7. package/lib/src/StkTable/useHighlight.d.ts +1 -1
  8. package/lib/src/StkTable/useRowExpand.d.ts +17 -0
  9. package/lib/src/StkTable/useTree.d.ts +20 -0
  10. package/lib/stk-table-vue.js +313 -163
  11. package/lib/style.css +29 -20
  12. package/package.json +75 -75
  13. package/src/StkTable/StkTable.vue +1557 -1550
  14. package/src/StkTable/components/DragHandle.vue +9 -9
  15. package/src/StkTable/components/SortIcon.vue +6 -6
  16. package/src/StkTable/components/TriangleIcon.vue +3 -0
  17. package/src/StkTable/const.ts +37 -37
  18. package/src/StkTable/index.ts +4 -4
  19. package/src/StkTable/style.less +567 -553
  20. package/src/StkTable/types/highlightDimOptions.ts +26 -26
  21. package/src/StkTable/types/index.ts +260 -239
  22. package/src/StkTable/useAutoResize.ts +91 -91
  23. package/src/StkTable/useColResize.ts +216 -216
  24. package/src/StkTable/useFixedCol.ts +148 -148
  25. package/src/StkTable/useFixedStyle.ts +75 -75
  26. package/src/StkTable/useGetFixedColPosition.ts +65 -65
  27. package/src/StkTable/useHighlight.ts +320 -318
  28. package/src/StkTable/useKeyboardArrowScroll.ts +112 -112
  29. package/src/StkTable/useRowExpand.ts +78 -0
  30. package/src/StkTable/useThDrag.ts +102 -102
  31. package/src/StkTable/useTrDrag.ts +118 -118
  32. package/src/StkTable/useTree.ts +158 -0
  33. package/src/StkTable/useVirtualScroll.ts +462 -462
  34. package/src/StkTable/utils/constRefUtils.ts +29 -29
  35. package/src/StkTable/utils/index.ts +213 -212
  36. package/src/StkTable/utils/useTriggerRef.ts +33 -33
  37. package/src/VirtualTree.vue +622 -622
  38. package/src/VirtualTreeSelect.vue +367 -367
  39. package/src/vite-env.d.ts +10 -10
package/README.md CHANGED
@@ -1,213 +1,211 @@
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 (Sticky Table) 是一个基于Vue 的高性能虚拟列表组件。
16
- > 用于实时数据展示,数据高亮动效。
17
-
18
- > Vue2.7支持引入源码(**ts**)使用。
19
-
20
- ## Doc
21
- 文档: [Stk Table Vue 高性能虚拟表格](https://ja-plus.github.io/stk-table-vue/)
22
-
23
- ## Repo:
24
- - [Github](https://github.com/ja-plus/stk-table-vue)
25
- - [Gitee](https://gitee.com/japlus/stk-table-vue) 🇨🇳
26
-
27
- ## Demo
28
-
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
- * [] 列筛选。
47
- * [x] 斑马纹。
48
- * [x] 拖动更改列顺序。
49
- * [x] 拖动调整列宽。
50
- * [x] 排序
51
- - [x] 支持配置 `null` | `undefined` 永远排最后。
52
- - [x] 支持配置 string 使用 `String.prototype.localCompare` 排序。
53
- * [x] 多级表头。
54
- - [] 横向虚拟滚动。
55
- * [x] 支持table-layout: fixed 配置。
56
- * [x] 鼠标悬浮在表格上,键盘滚动虚拟表格。
57
- - [x] 键盘 `ArrowUp`/`ArrowDown`/`ArrowLeft`/`ArrowRight`/`PageUp`/ `PageDown` 按键支持。
58
- * [] 非虚拟滚动时,大数据分批加载。
59
- * [x] vue2.7支持(引入源码使用)。
60
- - [x] `props.optimizeVue2Scroll` 优化vue2虚拟滚动流畅度。(`v0.2.0`)
61
- * [x] 支持配置序号列。`StkTableColumn['type']`。(`v0.3.0`)
62
- * [x] `props.cellHover`单元格悬浮样式。(`v0.3.2`)
63
- * [] 惯性滚动优化。
64
-
65
-
66
- ## Usage
67
- > npm install stk-table-vue
68
-
69
- ```html
70
- <script setup>
71
- import { StkTable } from 'stk-table-vue'
72
- import { ref, useTemplateRef } from 'vue'
73
- const stkTableRef = ref<InstanceType<typeof StkTable>>();
74
- // or Vue 3.5 useTemplateRef
75
- const stkTableRef = useTemplateRef('stkTableRef');
76
-
77
- // highlight row
78
- stkTableRef.value.setHighlightDimRow([rowKey],{
79
- method: 'css'|'js'|'animation',// 默认 animation。
80
- className: 'custom-class-name', // method css 时生效。
81
- keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}],//same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
82
- duration: 2000,// 动画时长。
83
- });
84
- // highlight cell
85
- stkTableRef.value.setHighlightDimCell(rowKey, colDataIndex, {
86
- method: 'css'|'animation',
87
- className:'custom-class-name', // method css 时生效。
88
- keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}], // method animation 时生效。
89
- duration: 2000,// 动画时长。
90
- });
91
-
92
- const columns = [
93
- {title: 'name', dataIndex: 'name'},
94
- {title: 'age', dataIndex: 'age'},
95
- {title: 'address', dataIndex: 'address'},
96
- ];
97
-
98
- const dataSource = [
99
- {id: 1, name: 'John', age: 32, address: 'New York'},
100
- {id: 2, name: 'Jim', age: 42, address: 'London'},
101
- {id: 3, name: 'Joe', age: 52, address: 'Tokyo'},
102
- {id: 4, name: 'Jack', age: 62, address: 'Sydney'},
103
- {id: 5, name: 'Jill', age: 72, address: 'Paris'},
104
- ]
105
-
106
- </script>
107
-
108
- <template>
109
- <StkTable ref='stkTableRef' row-key="id" :data-source="dataSource" :columns="columns"></StkTable>
110
- </template>
111
-
112
- ```
113
-
114
- ### Vue2.7 Usage
115
- [在vue2中使用](https://ja-plus.github.io/stk-table-vue/main/start/vue2-usage.html)
116
-
117
- ## Notice
118
- 注意,组件会改动 `props.columns` 中的对象。如果多个组件 `columns` 数组元素存在引用同一个 `StkTableColumn` 对象。则考虑赋值 `columns` 前进行深拷贝。
119
-
120
- ## API
121
- ### Props
122
- [Props 表格配置](https://ja-plus.github.io/stk-table-vue/main/api/table-props.html)
123
-
124
- ### Emits
125
- [Emits 事件](https://ja-plus.github.io/stk-table-vue/main/api/emits.html)
126
-
127
- ### Slots
128
- [Slots 插槽](https://ja-plus.github.io/stk-table-vue/main/api/slots.html)
129
-
130
- ### Expose
131
- [Expose 实例方法](https://ja-plus.github.io/stk-table-vue/main/api/expose.html)
132
-
133
- ### StkTableColumn 列配置
134
- [StkTableColumn 列配置](https://ja-plus.github.io/stk-table-vue/main/api/stk-table-column.html)
135
-
136
- ### setHighlightDimCell & setHighlightDimRow
137
- [高亮使用文档](https://ja-plus.github.io/stk-table-vue/main/api/expose.html#sethighlightdimcell)
138
-
139
-
140
- ### Example
141
- ```vue
142
- <template>
143
- <StkTable
144
- ref="stkTable"
145
- row-key="name"
146
- v-model:columns="columns"
147
- :style="{height:props.height}"
148
- theme='dark'
149
- height='200px'
150
- bordered="h"
151
- :row-height="28"
152
- :show-overflow="false"
153
- :show-header-overflow="false"
154
- :sort-remote="false"
155
- col-resizable
156
- header-drag
157
- virtual
158
- virtual-x
159
- no-data-full
160
- col-resizable
161
- auto-resize
162
- fixed-col-shadow
163
- :col-min-width="10"
164
- :headless="false"
165
- :data-source="dataSource"
166
- @current-change="onCurrentChange"
167
- @row-menu="onRowMenu"
168
- @header-row-menu="onHeaderRowMenu"
169
- @row-click="onRowClick"
170
- @row-dblclick="onRowDblclick"
171
- @sort-change="handleSortChange"
172
- @cell-click="onCellClick"
173
- @header-cell-click="onHeaderCellClick"
174
- @scroll="onTableScroll"
175
- @scroll-x="onTableScrollX"
176
- @col-order-change="onColOrderChange"
177
- />
178
- </template>
179
- <script setup>
180
- import { h, defineComponent } from 'vue';
181
- const columns = [
182
- {
183
- title: 'Name',
184
- dataIndex: 'name',
185
- fixed: 'left',
186
- width: '200px',
187
- headerClassName: 'my-th',
188
- className: 'my-td',
189
- sorter: true,
190
- customHeaderCell: function FunctionalComponent(props){
191
- return h(
192
- 'span',
193
- { style: 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
194
- props.col.title + '(render) text-overflow,',
195
- );
196
- },
197
- customCell: defineComponent({
198
- setup(){
199
- //...
200
- return () => <div></div> // vue jsx
201
- }
202
- })
203
- },
204
- ]
205
- </script>
206
- ```
207
-
208
-
209
- ## Other
210
- * `$*$` 兼容注释
211
-
212
- ### Planed removal APi
213
- * `setHighlightDimRow` 中的 `method="js"`。观察animation Api 是否足够满足使用场景。若足够满足计划在后期移除,并且可以移除 `d3-interpolate` 依赖。
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 (Sticky Table) 是一个基于Vue 的高性能虚拟列表组件。
16
+ > 用于实时数据展示,数据高亮动效。
17
+
18
+ > Vue2.7支持引入源码(**ts**)使用。
19
+
20
+ ## Doc
21
+ 文档: [Stk Table Vue 高性能虚拟表格](https://ja-plus.github.io/stk-table-vue/)
22
+
23
+ ## Repo:
24
+ - [Github](https://github.com/ja-plus/stk-table-vue)
25
+ - [Gitee](https://gitee.com/japlus/stk-table-vue) 🇨🇳
26
+
27
+ ## Demo
28
+
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
+ * [] 列筛选。
48
+ * [x] 斑马纹。
49
+ * [x] 拖动更改列顺序。
50
+ * [x] 拖动调整列宽。
51
+ * [x] 排序
52
+ - [x] 支持配置 `null` | `undefined` 永远排最后。
53
+ - [x] 支持配置 string 使用 `String.prototype.localCompare` 排序。
54
+ * [x] 多级表头。
55
+ - [] 横向虚拟滚动。
56
+ * [x] 支持table-layout: fixed 配置。
57
+ * [x] 鼠标悬浮在表格上,键盘滚动虚拟表格。
58
+ - [x] 键盘 `ArrowUp`/`ArrowDown`/`ArrowLeft`/`ArrowRight`/`PageUp`/ `PageDown` 按键支持。
59
+ * [] 非虚拟滚动时,大数据分批加载。
60
+ * [x] vue2.7支持(引入源码使用)。
61
+ - [x] `props.optimizeVue2Scroll` 优化vue2虚拟滚动流畅度。(`v0.2.0`)
62
+ * [x] 支持配置序号列。`StkTableColumn['type']`。(`v0.3.0`)
63
+ * [x] `props.cellHover`单元格悬浮样式。(`v0.3.2`)
64
+ * [] 惯性滚动优化。
65
+
66
+
67
+ ## Usage
68
+ > npm install stk-table-vue
69
+
70
+ ```html
71
+ <script setup>
72
+ import { StkTable } from 'stk-table-vue'
73
+ import { ref, useTemplateRef } from 'vue'
74
+ const stkTableRef = ref<InstanceType<typeof StkTable>>();
75
+ // or Vue 3.5 useTemplateRef
76
+ const stkTableRef = useTemplateRef('stkTableRef');
77
+
78
+ // highlight row
79
+ stkTableRef.value.setHighlightDimRow([rowKey],{
80
+ method: 'css'|'js'|'animation',// 默认 animation。
81
+ className: 'custom-class-name', // method css 时生效。
82
+ keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}],//same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
83
+ duration: 2000,// 动画时长。
84
+ });
85
+ // highlight cell
86
+ stkTableRef.value.setHighlightDimCell(rowKey, colDataIndex, {
87
+ method: 'css'|'animation',
88
+ className:'custom-class-name', // method css 时生效。
89
+ keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}], // method animation 时生效。
90
+ duration: 2000,// 动画时长。
91
+ });
92
+
93
+ const columns = [
94
+ {title: 'name', dataIndex: 'name'},
95
+ {title: 'age', dataIndex: 'age'},
96
+ {title: 'address', dataIndex: 'address'},
97
+ ];
98
+
99
+ const dataSource = [
100
+ {id: 1, name: 'John', age: 32, address: 'New York'},
101
+ {id: 2, name: 'Jim', age: 42, address: 'London'},
102
+ {id: 3, name: 'Joe', age: 52, address: 'Tokyo'},
103
+ {id: 4, name: 'Jack', age: 62, address: 'Sydney'},
104
+ {id: 5, name: 'Jill', age: 72, address: 'Paris'},
105
+ ]
106
+
107
+ </script>
108
+
109
+ <template>
110
+ <StkTable ref='stkTableRef' row-key="id" :data-source="dataSource" :columns="columns"></StkTable>
111
+ </template>
112
+
113
+ ```
114
+
115
+ ### Vue2.7 Usage
116
+ [在vue2中使用](https://ja-plus.github.io/stk-table-vue/main/start/vue2-usage.html)
117
+
118
+ ## Notice
119
+ 注意,组件会改动 `props.columns` 中的对象。如果多个组件 `columns` 数组元素存在引用同一个 `StkTableColumn` 对象。则考虑赋值 `columns` 前进行深拷贝。
120
+
121
+ ## API
122
+ ### Props
123
+ [Props 表格配置](https://ja-plus.github.io/stk-table-vue/main/api/table-props.html)
124
+
125
+ ### Emits
126
+ [Emits 事件](https://ja-plus.github.io/stk-table-vue/main/api/emits.html)
127
+
128
+ ### Slots
129
+ [Slots 插槽](https://ja-plus.github.io/stk-table-vue/main/api/slots.html)
130
+
131
+ ### Expose
132
+ [Expose 实例方法](https://ja-plus.github.io/stk-table-vue/main/api/expose.html)
133
+
134
+ ### StkTableColumn 列配置
135
+ [StkTableColumn 列配置](https://ja-plus.github.io/stk-table-vue/main/api/stk-table-column.html)
136
+
137
+ ### setHighlightDimCell & setHighlightDimRow
138
+ [高亮使用文档](https://ja-plus.github.io/stk-table-vue/main/api/expose.html#sethighlightdimcell)
139
+
140
+
141
+ ### Example
142
+ ```vue
143
+ <template>
144
+ <StkTable
145
+ ref="stkTable"
146
+ row-key="name"
147
+ v-model:columns="columns"
148
+ :style="{height:props.height}"
149
+ theme='dark'
150
+ height='200px'
151
+ bordered="h"
152
+ :row-height="28"
153
+ :show-overflow="false"
154
+ :show-header-overflow="false"
155
+ :sort-remote="false"
156
+ col-resizable
157
+ header-drag
158
+ virtual
159
+ virtual-x
160
+ no-data-full
161
+ col-resizable
162
+ auto-resize
163
+ fixed-col-shadow
164
+ :col-min-width="10"
165
+ :headless="false"
166
+ :data-source="dataSource"
167
+ @current-change="onCurrentChange"
168
+ @row-menu="onRowMenu"
169
+ @header-row-menu="onHeaderRowMenu"
170
+ @row-click="onRowClick"
171
+ @row-dblclick="onRowDblclick"
172
+ @sort-change="handleSortChange"
173
+ @cell-click="onCellClick"
174
+ @header-cell-click="onHeaderCellClick"
175
+ @scroll="onTableScroll"
176
+ @scroll-x="onTableScrollX"
177
+ @col-order-change="onColOrderChange"
178
+ />
179
+ </template>
180
+ <script setup>
181
+ import { h, defineComponent } from 'vue';
182
+ const columns = [
183
+ {
184
+ title: 'Name',
185
+ dataIndex: 'name',
186
+ fixed: 'left',
187
+ width: '200px',
188
+ headerClassName: 'my-th',
189
+ className: 'my-td',
190
+ sorter: true,
191
+ customHeaderCell: function FunctionalComponent(props){
192
+ return h(
193
+ 'span',
194
+ { style: 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
195
+ props.col.title + '(render) text-overflow,',
196
+ );
197
+ },
198
+ customCell: defineComponent({
199
+ setup(){
200
+ //...
201
+ return () => <div></div> // vue jsx
202
+ }
203
+ })
204
+ },
205
+ ]
206
+ </script>
207
+ ```
208
+
209
+
210
+ ## Other
211
+ * `$*$` 兼容注释
@@ -1,4 +1,4 @@
1
- import { AutoRowHeightConfig, DragRowConfig, ExpandConfig, HeaderDragConfig, HighlightConfig, Order, PrivateRowDT, SeqConfig, SortConfig, SortOption, StkTableColumn, UniqKeyProp, ColResizableConfig } from './types/index';
1
+ import { AutoRowHeightConfig, ColResizableConfig, DragRowConfig, ExpandConfig, HeaderDragConfig, HighlightConfig, Order, PrivateRowDT, SeqConfig, SortConfig, SortOption, StkTableColumn, TreeConfig, UniqKeyProp } from './types/index';
2
2
 
3
3
  /** Generic stands for DataType */
4
4
  type DT = any & PrivateRowDT;
@@ -52,17 +52,6 @@ declare function getSortColumns(): {
52
52
  key: string | number | symbol | undefined;
53
53
  order: "desc" | "asc";
54
54
  }[];
55
- /**
56
- *
57
- * @param rowKeyOrRow rowKey or row
58
- * @param expand expand or collapse
59
- * @param data { col?: StkTableColumn<DT> }
60
- * @param data.silent if set true, not emit `toggle-row-expand`, default:false
61
- */
62
- declare function setRowExpand(rowKeyOrRow: string | undefined | DT, expand?: boolean, data?: {
63
- col?: StkTableColumn<DT>;
64
- silent?: boolean;
65
- }): void;
66
55
  declare function __VLS_template(): {
67
56
  tableHeader?(_: {
68
57
  col: StkTableColumn<any>;
@@ -142,7 +131,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
142
131
  /** 单元格再次点击否可以取消选中 (cellActive=true)*/
143
132
  selectedCellRevokable?: boolean;
144
133
  /** 表头是否可拖动。支持回调函数。 */
145
- headerDrag?: HeaderDragConfig;
134
+ headerDrag?: boolean | HeaderDragConfig;
146
135
  /**
147
136
  * 给行附加className<br>
148
137
  * FIXME: 是否需要优化,因为不传此prop会使表格行一直执行空函数,是否有影响
@@ -187,6 +176,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
187
176
  expandConfig?: ExpandConfig;
188
177
  /** 行拖动配置 */
189
178
  dragRowConfig?: DragRowConfig;
179
+ /** 树形配置 */
180
+ treeConfig?: TreeConfig;
190
181
  /**
191
182
  * 固定头,固定列实现方式。(非响应式)
192
183
  *
@@ -224,7 +215,6 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
224
215
  columns: () => never[];
225
216
  dataSource: () => never[];
226
217
  rowKey: string;
227
- colKey: string;
228
218
  emptyCellText: string;
229
219
  noDataFull: boolean;
230
220
  showNoData: boolean;
@@ -252,6 +242,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
252
242
  seqConfig: () => {};
253
243
  expandConfig: () => {};
254
244
  dragRowConfig: () => {};
245
+ treeConfig: () => {};
255
246
  cellFixedMode: string;
256
247
  smoothScroll: boolean;
257
248
  scrollRowByRow: boolean;
@@ -352,7 +343,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
352
343
  * en: Set expanded rows
353
344
  * @see {@link setRowExpand}
354
345
  */
355
- setRowExpand: typeof setRowExpand;
346
+ setRowExpand: (rowKeyOrRow: string | undefined | PrivateRowDT, expand?: boolean, data?: {
347
+ col?: StkTableColumn<PrivateRowDT>;
348
+ silent?: boolean;
349
+ }) => void;
356
350
  /**
357
351
  * 不定行高时,如果行高有变化,则调用此方法更新行高。
358
352
  *
@@ -367,6 +361,19 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
367
361
  * @see {@link clearAllAutoHeight}
368
362
  */
369
363
  clearAllAutoHeight: () => void;
364
+ /**
365
+ * 设置树节点展开状态
366
+ *
367
+ * en: Set tree node expand state
368
+ * @see {@link setTreeExpand}
369
+ */
370
+ setTreeExpand: (row: (import('./types/index').UniqKey | (PrivateRowDT & {
371
+ children?: (PrivateRowDT & /*elided*/ any)[];
372
+ })) | (import('./types/index').UniqKey | (PrivateRowDT & {
373
+ children?: (PrivateRowDT & /*elided*/ any)[];
374
+ }))[], option?: {
375
+ expand? /** 是否高亮选中的行 */: boolean;
376
+ }) => void;
370
377
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
371
378
  "sort-change": (col: StkTableColumn<any> | null, order: Order, data: any[], sortConfig: SortConfig<any>) => void;
372
379
  "row-click": (ev: MouseEvent, row: any, data: {
@@ -412,6 +419,11 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
412
419
  row: DT;
413
420
  col: StkTableColumn<DT> | null;
414
421
  }) => void;
422
+ "toggle-tree-expand": (data: {
423
+ expanded: boolean;
424
+ row: DT;
425
+ col: StkTableColumn<DT> | null;
426
+ }) => void;
415
427
  "update:columns": (cols: StkTableColumn<any>[]) => void;
416
428
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
417
429
  width?: string;
@@ -481,7 +493,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
481
493
  /** 单元格再次点击否可以取消选中 (cellActive=true)*/
482
494
  selectedCellRevokable?: boolean;
483
495
  /** 表头是否可拖动。支持回调函数。 */
484
- headerDrag?: HeaderDragConfig;
496
+ headerDrag?: boolean | HeaderDragConfig;
485
497
  /**
486
498
  * 给行附加className<br>
487
499
  * FIXME: 是否需要优化,因为不传此prop会使表格行一直执行空函数,是否有影响
@@ -526,6 +538,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
526
538
  expandConfig?: ExpandConfig;
527
539
  /** 行拖动配置 */
528
540
  dragRowConfig?: DragRowConfig;
541
+ /** 树形配置 */
542
+ treeConfig?: TreeConfig;
529
543
  /**
530
544
  * 固定头,固定列实现方式。(非响应式)
531
545
  *
@@ -563,7 +577,6 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
563
577
  columns: () => never[];
564
578
  dataSource: () => never[];
565
579
  rowKey: string;
566
- colKey: string;
567
580
  emptyCellText: string;
568
581
  noDataFull: boolean;
569
582
  showNoData: boolean;
@@ -591,6 +604,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
591
604
  seqConfig: () => {};
592
605
  expandConfig: () => {};
593
606
  dragRowConfig: () => {};
607
+ treeConfig: () => {};
594
608
  cellFixedMode: string;
595
609
  smoothScroll: boolean;
596
610
  scrollRowByRow: boolean;
@@ -601,10 +615,20 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
601
615
  }) => any) | undefined;
602
616
  "onUpdate:columns"?: ((cols: StkTableColumn<any>[]) => any) | undefined;
603
617
  "onCol-resize"?: ((col: StkTableColumn<any>) => any) | undefined;
618
+ "onToggle-row-expand"?: ((data: {
619
+ expanded: boolean;
620
+ row: DT;
621
+ col: StkTableColumn<DT> | null;
622
+ }) => any) | undefined;
604
623
  "onTh-drag-start"?: ((dragStartKey: string) => any) | undefined;
605
624
  "onTh-drop"?: ((targetColKey: string) => any) | undefined;
606
625
  "onCol-order-change"?: ((dragStartKey: string, targetColKey: string) => any) | undefined;
607
626
  "onRow-order-change"?: ((dragStartKey: string, targetRowKey: string) => any) | undefined;
627
+ "onToggle-tree-expand"?: ((data: {
628
+ expanded: boolean;
629
+ row: DT;
630
+ col: StkTableColumn<DT> | null;
631
+ }) => any) | undefined;
608
632
  "onSort-change"?: ((col: StkTableColumn<any> | null, order: Order, data: any[], sortConfig: SortConfig<any>) => any) | undefined;
609
633
  "onRow-click"?: ((ev: MouseEvent, row: any, data: {
610
634
  rowIndex: number;
@@ -635,11 +659,6 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
635
659
  }) => any) | undefined;
636
660
  "onHeader-cell-click"?: ((ev: MouseEvent, col: StkTableColumn<any>) => any) | undefined;
637
661
  "onScroll-x"?: ((ev: Event) => any) | undefined;
638
- "onToggle-row-expand"?: ((data: {
639
- expanded: boolean;
640
- row: DT;
641
- col: StkTableColumn<DT> | null;
642
- }) => any) | undefined;
643
662
  }>, {
644
663
  width: string;
645
664
  minWidth: string;
@@ -652,7 +671,6 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
652
671
  optimizeVue2Scroll: boolean;
653
672
  rowKey: UniqKeyProp;
654
673
  headerRowHeight: number | null;
655
- colKey: UniqKeyProp;
656
674
  fixedMode: boolean;
657
675
  theme: "light" | "dark";
658
676
  rowHover: boolean;
@@ -675,7 +693,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
675
693
  cellHover: boolean;
676
694
  cellActive: boolean;
677
695
  selectedCellRevokable: boolean;
678
- headerDrag: HeaderDragConfig;
696
+ headerDrag: boolean | HeaderDragConfig;
679
697
  rowClassName: (row: DT, i: number) => string;
680
698
  colResizable: boolean | ColResizableConfig<DT>;
681
699
  colMinWidth: number;
@@ -687,6 +705,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
687
705
  seqConfig: SeqConfig;
688
706
  expandConfig: ExpandConfig;
689
707
  dragRowConfig: DragRowConfig;
708
+ treeConfig: TreeConfig;
690
709
  cellFixedMode: "sticky" | "relative";
691
710
  smoothScroll: boolean;
692
711
  scrollRowByRow: boolean;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -15,7 +15,6 @@ export declare const HIGHLIGHT_COLOR: {
15
15
  };
16
16
  export declare const HIGHLIGHT_DURATION = 2000;
17
17
  /** highlight change frequency 1000/30 -> 30FPS */
18
- export declare const HIGHLIGHT_FREQ: number;
19
18
  export declare const HIGHLIGHT_ROW_CLASS = "highlight-row";
20
19
  export declare const HIGHLIGHT_CELL_CLASS = "highlight-cell";
21
20
  /** legacy sticky compatible mode */
@@ -16,10 +16,6 @@ type HighlightDimCssOption = HighlightDimBaseOption & {
16
16
  /** control delay time to remove className */
17
17
  duration?: number;
18
18
  };
19
- type HighlightDimJsOption = HighlightDimBaseOption & {
20
- /** use d3-interpolate js to change background color */
21
- method: 'js';
22
- };
23
19
  export type HighlightDimCellOption = HighlightDimBaseOption | HighlightDimAnimationOption | HighlightDimCssOption;
24
- export type HighlightDimRowOption = HighlightDimBaseOption | HighlightDimAnimationOption | HighlightDimCssOption | HighlightDimJsOption;
20
+ export type HighlightDimRowOption = HighlightDimBaseOption | HighlightDimAnimationOption | HighlightDimCssOption;
25
21
  export {};