stk-table-vue 0.2.9 → 0.3.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.
- package/README.md +79 -7
- package/lib/src/StkTable/StkTable.vue.d.ts +16 -3
- package/lib/src/StkTable/const.d.ts +2 -1
- package/lib/src/StkTable/types/index.d.ts +13 -12
- package/lib/src/StkTable/useAutoResize.d.ts +2 -2
- package/lib/src/StkTable/useColResize.d.ts +5 -5
- package/lib/src/StkTable/useFixedCol.d.ts +5 -5
- package/lib/src/StkTable/useFixedStyle.d.ts +3 -3
- package/lib/src/StkTable/useHighlight.d.ts +11 -11
- package/lib/src/StkTable/useKeyboardArrowScroll.d.ts +4 -3
- package/lib/src/StkTable/useVirtualScroll.d.ts +4 -4
- package/lib/src/StkTable/utils.d.ts +11 -3
- package/lib/stk-table-vue.js +317 -187
- package/lib/style.css +7 -2
- package/package.json +4 -5
- package/src/StkTable/StkTable.vue +70 -43
- package/src/StkTable/const.ts +3 -1
- package/src/StkTable/style.less +10 -6
- package/src/StkTable/types/index.ts +14 -6
- package/src/StkTable/useAutoResize.ts +5 -5
- package/src/StkTable/useColResize.ts +18 -18
- package/src/StkTable/useFixedCol.ts +6 -6
- package/src/StkTable/useFixedStyle.ts +11 -8
- package/src/StkTable/useHighlight.ts +252 -107
- package/src/StkTable/useKeyboardArrowScroll.ts +19 -7
- package/src/StkTable/useVirtualScroll.ts +14 -11
- package/src/StkTable/utils.ts +27 -9
- package/src/vite-env.d.ts +4 -0
package/README.md
CHANGED
|
@@ -12,10 +12,11 @@ repo:
|
|
|
12
12
|
* [x] props.dataSource 为 shallowRef 时,高亮行不生效。(bug:2024.02.21)(resolved:0.2.3)
|
|
13
13
|
|
|
14
14
|
## Feature TODO:
|
|
15
|
-
* [x] 高亮行,单元格。使用css
|
|
16
|
-
- [x] 虚拟滚动默认通过js计算行高亮背景色,可通过 `useCss` 设置为css keyframe实现 。
|
|
15
|
+
* [x] 高亮行,单元格。使用css @keyframes实现。
|
|
16
|
+
- [x] 虚拟滚动默认通过js计算行高亮背景色,可通过 `useCss` 设置为css @keyframe实现 。
|
|
17
17
|
- [x] 支持配置高亮参数(持续时间,颜色,频率(虚拟滚动))。(`v0.2.9`)
|
|
18
18
|
- [x] `setHighlightDimRow`/`setHighlightCellRow`支持自定义高亮css类名。(`v0.2.9`)
|
|
19
|
+
- [x] 使用 `Web Animations API` 实现高亮。
|
|
19
20
|
* [x] 虚拟滚动。
|
|
20
21
|
- [x] 纵向。
|
|
21
22
|
- [x] 横向(必须设置列宽)。
|
|
@@ -43,7 +44,8 @@ repo:
|
|
|
43
44
|
* [] 非虚拟滚动时,大数据分批加载。
|
|
44
45
|
* [x] vue2.7支持(引入源码使用)。
|
|
45
46
|
- [x] `props.optimizeVue2Scroll` 优化vue2虚拟滚动流畅度。(`v0.2.0`)
|
|
46
|
-
* [x]
|
|
47
|
+
* [x] 支持配置序号列。`StkTableColumn['type']`。(`v0.3.0`)
|
|
48
|
+
|
|
47
49
|
|
|
48
50
|
|
|
49
51
|
|
|
@@ -55,9 +57,21 @@ repo:
|
|
|
55
57
|
import { StkTable } from 'stk-table-vue'
|
|
56
58
|
import { ref } from 'vue'
|
|
57
59
|
const stkTable = ref<InstanceType<typeof StkTable>>();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
stkTable.value.
|
|
60
|
+
|
|
61
|
+
// highlight row
|
|
62
|
+
stkTable.value.setHighlightDimRow([rowKey],{
|
|
63
|
+
method: 'css'|'js'|'animation',// 是否使用css @keyframe实现。虚拟滚动下默认false。
|
|
64
|
+
className: 'custom-class-name',// useCss 为true时生效。
|
|
65
|
+
keyframe: [{backgroundColor:'#aaa'},{backgroundColor: '#222'}],//same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
|
|
66
|
+
duration: 2000,// 动画时长。
|
|
67
|
+
});
|
|
68
|
+
// highlight cell
|
|
69
|
+
stkTable.value.setHighlightDimCell(rowKey, colDataIndex, {
|
|
70
|
+
method: 'css'|'animation',
|
|
71
|
+
className:'custom-class-name',// method css 时生效。
|
|
72
|
+
keyframe: [{backgroundColor:'#aaa'},{backgroundColor: '#222'}], // method animation 时生效。
|
|
73
|
+
duration: 2000,// 动画时长。
|
|
74
|
+
})
|
|
61
75
|
</script>
|
|
62
76
|
|
|
63
77
|
<template>
|
|
@@ -128,7 +142,7 @@ export type StkProps = {
|
|
|
128
142
|
headerRowHeight?: number | null;
|
|
129
143
|
/** 虚拟滚动 */
|
|
130
144
|
virtual?: boolean;
|
|
131
|
-
/** x轴虚拟滚动
|
|
145
|
+
/** x轴虚拟滚动(必须设置列宽)*/
|
|
132
146
|
virtualX?: boolean;
|
|
133
147
|
/** 表格列配置 */
|
|
134
148
|
columns?: StkTableColumn<any>[];
|
|
@@ -214,6 +228,11 @@ export type StkProps = {
|
|
|
214
228
|
/** 高亮帧率(虚拟滚动生效) */
|
|
215
229
|
fps?: number;
|
|
216
230
|
};
|
|
231
|
+
/** 序号列配置 */
|
|
232
|
+
seqConfig?: {
|
|
233
|
+
/** 序号列起始下标 用于适配分页 */
|
|
234
|
+
startIndex?: number;
|
|
235
|
+
};
|
|
217
236
|
};
|
|
218
237
|
```
|
|
219
238
|
#### Emits
|
|
@@ -324,6 +343,11 @@ defineExpose({
|
|
|
324
343
|
type Sorter<T> = boolean | ((data: T[], option: { order: Order; column: any }) => T[]);
|
|
325
344
|
/** 表格列配置 */
|
|
326
345
|
export type StkTableColumn<T extends Record<string, any>> = {
|
|
346
|
+
/**
|
|
347
|
+
* 列类型
|
|
348
|
+
* - seq 序号列
|
|
349
|
+
*/
|
|
350
|
+
type?: 'seq';
|
|
327
351
|
/** 取值id */
|
|
328
352
|
dataIndex: keyof T & string;
|
|
329
353
|
/** 表头文字 */
|
|
@@ -386,6 +410,51 @@ export type SortConfig<T extends Record<string, any>> = {
|
|
|
386
410
|
};
|
|
387
411
|
```
|
|
388
412
|
|
|
413
|
+
### setHighlightDimCell & setHighlightDimRow
|
|
414
|
+
#### setHighlightDimCell
|
|
415
|
+
```ts
|
|
416
|
+
setHighlightDimCell(
|
|
417
|
+
rowKeyValues: UniqKey[],
|
|
418
|
+
option: {
|
|
419
|
+
method?: 'css' | 'animation' | 'js';
|
|
420
|
+
/** @deprecated 请使用method */
|
|
421
|
+
useCss?: boolean;
|
|
422
|
+
className?: string;
|
|
423
|
+
keyframe?: Parameters<Animatable['animate']>['0'];
|
|
424
|
+
duration?: number;
|
|
425
|
+
} = {},
|
|
426
|
+
)
|
|
427
|
+
```
|
|
428
|
+
#### setHighlightDimRow
|
|
429
|
+
```ts
|
|
430
|
+
setHighlightDimRow(
|
|
431
|
+
rowKeyValues: UniqKey[],
|
|
432
|
+
option: {
|
|
433
|
+
method?: 'css' | 'animation' | 'js';
|
|
434
|
+
/** @deprecated 请使用method */
|
|
435
|
+
useCss?: boolean;
|
|
436
|
+
className?: string;
|
|
437
|
+
keyframe?: Parameters<Animatable['animate']>['0'];
|
|
438
|
+
duration?: number;
|
|
439
|
+
}
|
|
440
|
+
)
|
|
441
|
+
```
|
|
442
|
+
#### option
|
|
443
|
+
| key |value| desc |
|
|
444
|
+
| ---- | ---- | ---- |
|
|
445
|
+
| method | `css` `animation` `js` | 设置高亮方式。虚拟滚动默认js。否则css |
|
|
446
|
+
| ~~useCss~~ `deprecated` | `boolean`| ~~是否使用css~~ |
|
|
447
|
+
| className | `string` | 设置高亮样式。method == 'css' 生效 |
|
|
448
|
+
| keyframe | `Parameters<Animatable['animate']>['0']` | 设置高亮动画。method == 'animation' 生效。 |
|
|
449
|
+
| duration | `number` | 设置高亮动画持续时间。 method='css'状态下,用于移除class,如果传入了className则需要与自定义的动画时间一致。|
|
|
450
|
+
|
|
451
|
+
##### option.method
|
|
452
|
+
| `option.method`| desc |
|
|
453
|
+
| ---- | ---- |
|
|
454
|
+
| css | 使用css class 实现高亮。 |
|
|
455
|
+
| animation | 使用 animation api 实现高亮。 |
|
|
456
|
+
| js | 使用 js 循环计算颜色实现高亮。虚拟滚动默认使用js。 |
|
|
457
|
+
|
|
389
458
|
### Example
|
|
390
459
|
```vue
|
|
391
460
|
<template>
|
|
@@ -458,6 +527,9 @@ export type SortConfig<T extends Record<string, any>> = {
|
|
|
458
527
|
### 鼠标悬浮表头时,不展示title
|
|
459
528
|
* 将 `StkTableColumn` 中的 `title` 字段置为 "" 空字符串。这样th中就没有title了。
|
|
460
529
|
* 使用 `StkTableColumn` 中的 `customHeaderCell` 属性中,自定义表头渲染。
|
|
530
|
+
### 虚拟滚动高亮性能
|
|
531
|
+
* 虚拟滚动下,高亮默认由js计算背景实现。好处是滚动不影响高亮状态。
|
|
532
|
+
* 在虚拟滚动下,高亮强制使用css @keyframes 实现动画。`setHighlightDimRow`/`setHighlightCellRow` 最后一个参数传入 `{useCss: true}` 即可。
|
|
461
533
|
|
|
462
534
|
|
|
463
535
|
## Other
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HighlightConfig, Order, SortConfig, SortOption, SortState, StkTableColumn, UniqKeyProp } from './types/index';
|
|
1
|
+
import { HighlightConfig, Order, SeqConfig, SortConfig, SortOption, SortState, StkTableColumn, UniqKeyProp } from './types/index';
|
|
2
2
|
/** Generic stands for DataType */
|
|
3
3
|
type DT = any;
|
|
4
4
|
/**
|
|
@@ -56,7 +56,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
56
56
|
headerRowHeight?: number | null | undefined;
|
|
57
57
|
/** 虚拟滚动 */
|
|
58
58
|
virtual?: boolean | undefined;
|
|
59
|
-
/** x轴虚拟滚动
|
|
59
|
+
/** x轴虚拟滚动(必须设置列宽)*/
|
|
60
60
|
virtualX?: boolean | undefined;
|
|
61
61
|
/** 表格列配置 */
|
|
62
62
|
columns?: StkTableColumn<any>[] | undefined;
|
|
@@ -122,6 +122,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
122
122
|
hideHeaderTitle?: boolean | string[] | undefined;
|
|
123
123
|
/** 高亮配置 */
|
|
124
124
|
highlightConfig?: HighlightConfig | undefined;
|
|
125
|
+
/** 序号列配置 */
|
|
126
|
+
seqConfig?: SeqConfig | undefined;
|
|
125
127
|
}>, {
|
|
126
128
|
width: string;
|
|
127
129
|
fixedMode: boolean;
|
|
@@ -159,6 +161,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
159
161
|
};
|
|
160
162
|
hideHeaderTitle: boolean;
|
|
161
163
|
highlightConfig: () => {};
|
|
164
|
+
seqConfig: () => {};
|
|
162
165
|
}>, {
|
|
163
166
|
/** 初始化横向纵向虚拟滚动 */
|
|
164
167
|
initVirtualScroll: (height?: number | undefined) => void;
|
|
@@ -171,11 +174,17 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
171
174
|
/** 设置高亮渐暗单元格 */
|
|
172
175
|
setHighlightDimCell: (rowKeyValue: string, dataIndex: string, option?: {
|
|
173
176
|
className?: string | undefined;
|
|
177
|
+
method?: "css" | "animation" | undefined;
|
|
178
|
+
keyframe?: Keyframe[] | PropertyIndexedKeyframes | null | undefined;
|
|
179
|
+
duration?: number | undefined;
|
|
174
180
|
}) => void;
|
|
175
181
|
/** 设置高亮渐暗行 */
|
|
176
182
|
setHighlightDimRow: (rowKeyValues: import("./types/index").UniqKey[], option?: {
|
|
183
|
+
method?: "css" | "animation" | "js" | undefined;
|
|
177
184
|
useCss?: boolean | undefined;
|
|
178
185
|
className?: string | undefined;
|
|
186
|
+
keyframe?: Keyframe[] | PropertyIndexedKeyframes | null | undefined; /** v-model:columns col resize 时更新宽度*/
|
|
187
|
+
duration?: number | undefined;
|
|
179
188
|
}) => void;
|
|
180
189
|
/** 表格排序列dataIndex */
|
|
181
190
|
sortCol: import("vue").Ref<string | null | undefined>;
|
|
@@ -227,7 +236,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
227
236
|
headerRowHeight?: number | null | undefined;
|
|
228
237
|
/** 虚拟滚动 */
|
|
229
238
|
virtual?: boolean | undefined;
|
|
230
|
-
/** x轴虚拟滚动
|
|
239
|
+
/** x轴虚拟滚动(必须设置列宽)*/
|
|
231
240
|
virtualX?: boolean | undefined;
|
|
232
241
|
/** 表格列配置 */
|
|
233
242
|
columns?: StkTableColumn<any>[] | undefined;
|
|
@@ -293,6 +302,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
293
302
|
hideHeaderTitle?: boolean | string[] | undefined;
|
|
294
303
|
/** 高亮配置 */
|
|
295
304
|
highlightConfig?: HighlightConfig | undefined;
|
|
305
|
+
/** 序号列配置 */
|
|
306
|
+
seqConfig?: SeqConfig | undefined;
|
|
296
307
|
}>, {
|
|
297
308
|
width: string;
|
|
298
309
|
fixedMode: boolean;
|
|
@@ -330,6 +341,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
330
341
|
};
|
|
331
342
|
hideHeaderTitle: boolean;
|
|
332
343
|
highlightConfig: () => {};
|
|
344
|
+
seqConfig: () => {};
|
|
333
345
|
}>>> & {
|
|
334
346
|
onScroll?: ((ev: Event, data: {
|
|
335
347
|
startIndex: number;
|
|
@@ -385,6 +397,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
385
397
|
sortConfig: SortConfig<any>;
|
|
386
398
|
hideHeaderTitle: boolean | string[];
|
|
387
399
|
highlightConfig: HighlightConfig;
|
|
400
|
+
seqConfig: SeqConfig;
|
|
388
401
|
}, {}>, {
|
|
389
402
|
tableHeader?(_: {
|
|
390
403
|
col: StkTableColumn<any>;
|
|
@@ -16,10 +16,11 @@ export declare const HIGHLIGHT_COLOR: {
|
|
|
16
16
|
/** 高亮持续时间 */
|
|
17
17
|
export declare const HIGHLIGHT_DURATION = 2000;
|
|
18
18
|
/** 高亮变更频率 */
|
|
19
|
-
export declare const HIGHLIGHT_FREQ
|
|
19
|
+
export declare const HIGHLIGHT_FREQ: number;
|
|
20
20
|
/** 高亮行class */
|
|
21
21
|
export declare const HIGHLIGHT_ROW_CLASS = "highlight-row";
|
|
22
22
|
/** 高连单元格class */
|
|
23
23
|
export declare const HIGHLIGHT_CELL_CLASS = "highlight-cell";
|
|
24
24
|
/** 是否兼容低版本模式 */
|
|
25
25
|
export declare const IS_LEGACY_MODE: boolean;
|
|
26
|
+
export declare const STK_ID_PREFIX = "stk";
|
|
@@ -15,6 +15,11 @@ export type CustomHeaderCellFunc<T extends Record<string, any>> = (props: {
|
|
|
15
15
|
}) => VNode;
|
|
16
16
|
/** 表格列配置 */
|
|
17
17
|
export type StkTableColumn<T extends Record<string, any>> = {
|
|
18
|
+
/**
|
|
19
|
+
* 列类型
|
|
20
|
+
* - seq 序号列
|
|
21
|
+
*/
|
|
22
|
+
type?: 'seq';
|
|
18
23
|
/** 取值id */
|
|
19
24
|
dataIndex: keyof T & string;
|
|
20
25
|
/** 表头文字 */
|
|
@@ -62,6 +67,8 @@ export type StkTableColumn<T extends Record<string, any>> = {
|
|
|
62
67
|
children?: StkTableColumn<T>[];
|
|
63
68
|
/** 父节点引用 */
|
|
64
69
|
__PARENT__?: StkTableColumn<T> | null;
|
|
70
|
+
/** 保存计算的宽度。横向虚拟滚动用。 */
|
|
71
|
+
__WIDTH__?: number;
|
|
65
72
|
};
|
|
66
73
|
export type SortOption<T extends Record<string, any>> = Pick<StkTableColumn<T>, 'sorter' | 'dataIndex' | 'sortField' | 'sortType'>;
|
|
67
74
|
/** 排序状态 */
|
|
@@ -103,18 +110,12 @@ export declare const enum TagType {
|
|
|
103
110
|
export type HighlightConfig = {
|
|
104
111
|
/** 高亮持续时间(s) */
|
|
105
112
|
duration?: number;
|
|
106
|
-
/**
|
|
107
|
-
color?: {
|
|
108
|
-
light?: {
|
|
109
|
-
from: string;
|
|
110
|
-
to: string;
|
|
111
|
-
};
|
|
112
|
-
dark?: {
|
|
113
|
-
from: string;
|
|
114
|
-
to: string;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
/** 高亮帧率(虚拟滚动生效) */
|
|
113
|
+
/** 高亮帧率 */
|
|
118
114
|
fps?: number;
|
|
119
115
|
};
|
|
116
|
+
/** 序号列配置 */
|
|
117
|
+
export type SeqConfig = {
|
|
118
|
+
/** 序号列起始下标 用于适配分页 */
|
|
119
|
+
startIndex?: number;
|
|
120
|
+
};
|
|
120
121
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
type Options = {
|
|
3
3
|
props: any;
|
|
4
|
-
|
|
4
|
+
tableContainerRef: Ref<HTMLElement | undefined>;
|
|
5
5
|
initVirtualScroll: () => void;
|
|
6
6
|
/** 防抖延时 */
|
|
7
7
|
debounceMs: number;
|
|
@@ -10,5 +10,5 @@ type Options = {
|
|
|
10
10
|
* 窗口变化自动重置虚拟滚动
|
|
11
11
|
* @param param0
|
|
12
12
|
*/
|
|
13
|
-
export declare function useAutoResize({
|
|
13
|
+
export declare function useAutoResize({ tableContainerRef, initVirtualScroll, props, debounceMs }: Options): void;
|
|
14
14
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
1
|
+
import { Ref, ShallowRef } from 'vue';
|
|
2
2
|
import { StkTableColumn } from './types';
|
|
3
3
|
type Params<DT extends Record<string, any>> = {
|
|
4
4
|
props: any;
|
|
5
5
|
emits: any;
|
|
6
|
-
|
|
7
|
-
tableHeaderLast:
|
|
8
|
-
|
|
6
|
+
tableContainerRef: Ref<HTMLElement | undefined>;
|
|
7
|
+
tableHeaderLast: ShallowRef<StkTableColumn<DT>[]>;
|
|
8
|
+
colResizeIndicatorRef: Ref<HTMLElement | undefined>;
|
|
9
9
|
colKeyGen: (p: any) => string;
|
|
10
10
|
};
|
|
11
11
|
/** 列宽拖动 */
|
|
12
|
-
export declare function useColResize<DT extends Record<string, any>>({
|
|
12
|
+
export declare function useColResize<DT extends Record<string, any>>({ tableContainerRef, tableHeaderLast, colResizeIndicatorRef, props, emits, colKeyGen, }: Params<DT>): {
|
|
13
13
|
isColResizing: Ref<boolean>;
|
|
14
14
|
onThResizeMouseDown: (e: MouseEvent, col: StkTableColumn<DT>, isPrev?: boolean) => void;
|
|
15
15
|
onThResizeMouseMove: (e: MouseEvent) => void;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
1
|
+
import { Ref, ShallowRef } from 'vue';
|
|
2
2
|
import { StkTableColumn } from './types';
|
|
3
3
|
type Params<T extends Record<string, any>> = {
|
|
4
4
|
props: any;
|
|
5
5
|
colKeyGen: (col: StkTableColumn<T>) => string;
|
|
6
|
-
tableHeaders:
|
|
7
|
-
tableHeaderLast:
|
|
8
|
-
|
|
6
|
+
tableHeaders: ShallowRef<StkTableColumn<T>[][]>;
|
|
7
|
+
tableHeaderLast: ShallowRef<StkTableColumn<T>[]>;
|
|
8
|
+
tableContainerRef: Ref<HTMLDivElement | undefined>;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* 固定列处理
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
export declare function useFixedCol<DT extends Record<string, any>>({ props, colKeyGen, tableHeaders, tableHeaderLast,
|
|
14
|
+
export declare function useFixedCol<DT extends Record<string, any>>({ props, colKeyGen, tableHeaders, tableHeaderLast, tableContainerRef }: Params<DT>): {
|
|
15
15
|
/** 固定列class */
|
|
16
16
|
fixedColClassMap: import("vue").ComputedRef<Map<any, any>>;
|
|
17
17
|
/** 处理固定列阴影 */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CSSProperties, Ref } from 'vue';
|
|
1
|
+
import { CSSProperties, Ref, ShallowRef } from 'vue';
|
|
2
2
|
import { StkTableColumn, TagType } from './types';
|
|
3
3
|
import { VirtualScrollStore, VirtualScrollXStore } from './useVirtualScroll';
|
|
4
4
|
type Options<T extends Record<string, any>> = {
|
|
5
5
|
props: any;
|
|
6
|
-
tableHeaders:
|
|
6
|
+
tableHeaders: ShallowRef<StkTableColumn<T>[][]>;
|
|
7
7
|
virtualScroll: Ref<VirtualScrollStore>;
|
|
8
8
|
virtualScrollX: Ref<VirtualScrollXStore>;
|
|
9
9
|
virtualX_on: Ref<boolean>;
|
|
@@ -15,6 +15,6 @@ type Options<T extends Record<string, any>> = {
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
export declare function useFixedStyle<DT extends Record<string, any>>({ props, tableHeaders, virtualScroll, virtualScrollX, virtualX_on, virtualX_offsetRight, }: Options<DT>): {
|
|
18
|
-
getFixedStyle: (tagType: TagType, col: StkTableColumn<DT>, depth?: number) => CSSProperties;
|
|
18
|
+
getFixedStyle: (tagType: TagType, col: StkTableColumn<DT>, depth?: number) => CSSProperties | null;
|
|
19
19
|
};
|
|
20
20
|
export {};
|
|
@@ -2,27 +2,27 @@ import { Ref } from 'vue';
|
|
|
2
2
|
import { UniqKey } from './types';
|
|
3
3
|
type Params = {
|
|
4
4
|
props: any;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** 高亮行保存的东西 */
|
|
8
|
-
type HighlightRowStore = {
|
|
9
|
-
bgc: string;
|
|
10
|
-
bgc_progress_ms: number;
|
|
11
|
-
bgc_progress: number;
|
|
5
|
+
stkTableId: string;
|
|
6
|
+
tableContainerRef: Ref<HTMLDivElement | undefined>;
|
|
12
7
|
};
|
|
13
8
|
/**
|
|
14
9
|
* 高亮单元格,行
|
|
15
|
-
* row中新增_bgc_progress_ms 属性控制高亮状态,_bgc控制颜色
|
|
16
10
|
*/
|
|
17
|
-
export declare function useHighlight({ props,
|
|
18
|
-
|
|
19
|
-
highlightFrom: import("vue").ComputedRef<string>;
|
|
11
|
+
export declare function useHighlight({ props, stkTableId, tableContainerRef }: Params): {
|
|
12
|
+
highlightSteps: number;
|
|
20
13
|
setHighlightDimRow: (rowKeyValues: UniqKey[], option?: {
|
|
14
|
+
method?: 'css' | 'animation' | 'js';
|
|
15
|
+
/** @deprecated 请使用method */
|
|
21
16
|
useCss?: boolean;
|
|
22
17
|
className?: string;
|
|
18
|
+
keyframe?: Parameters<Animatable['animate']>['0'];
|
|
19
|
+
duration?: number;
|
|
23
20
|
}) => void;
|
|
24
21
|
setHighlightDimCell: (rowKeyValue: string, dataIndex: string, option?: {
|
|
25
22
|
className?: string;
|
|
23
|
+
method?: 'css' | 'animation';
|
|
24
|
+
keyframe?: Parameters<Animatable['animate']>['0'];
|
|
25
|
+
duration?: number;
|
|
26
26
|
}) => void;
|
|
27
27
|
};
|
|
28
28
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
1
|
+
import { ComputedRef, Ref, ShallowRef } from 'vue';
|
|
2
2
|
import { StkTableColumn } from './types';
|
|
3
3
|
import { VirtualScrollStore, VirtualScrollXStore } from './useVirtualScroll';
|
|
4
4
|
type Options<DT extends Record<string, any>> = {
|
|
@@ -6,12 +6,13 @@ type Options<DT extends Record<string, any>> = {
|
|
|
6
6
|
scrollTo: (y: number | null, x: number | null) => void;
|
|
7
7
|
virtualScroll: Ref<VirtualScrollStore>;
|
|
8
8
|
virtualScrollX: Ref<VirtualScrollXStore>;
|
|
9
|
-
tableHeaders:
|
|
9
|
+
tableHeaders: ShallowRef<StkTableColumn<DT>[][]>;
|
|
10
|
+
virtual_on: ComputedRef<boolean>;
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* 按下键盘箭头滚动。只有悬浮在表体上才能生效键盘。
|
|
13
14
|
*
|
|
14
15
|
* 在低版本浏览器中,虚拟滚动时,使用键盘滚动,等选中的行消失在视口外时,滚动会失效。
|
|
15
16
|
*/
|
|
16
|
-
export declare function useKeyboardArrowScroll<DT extends Record<string, any>>(targetElement: Ref<HTMLElement | undefined>, { props, scrollTo, virtualScroll, virtualScrollX, tableHeaders }: Options<DT>): void;
|
|
17
|
+
export declare function useKeyboardArrowScroll<DT extends Record<string, any>>(targetElement: Ref<HTMLElement | undefined>, { props, scrollTo, virtualScroll, virtualScrollX, tableHeaders, virtual_on }: Options<DT>): void;
|
|
17
18
|
export {};
|
|
@@ -2,10 +2,10 @@ import { Ref, ShallowRef } from 'vue';
|
|
|
2
2
|
import { StkTableColumn } from './types';
|
|
3
3
|
type Option<DT extends Record<string, any>> = {
|
|
4
4
|
props: any;
|
|
5
|
-
|
|
5
|
+
tableContainerRef: Ref<HTMLElement | undefined>;
|
|
6
6
|
dataSourceCopy: ShallowRef<DT[]>;
|
|
7
|
-
tableHeaderLast:
|
|
8
|
-
tableHeaders:
|
|
7
|
+
tableHeaderLast: ShallowRef<StkTableColumn<DT>[]>;
|
|
8
|
+
tableHeaders: ShallowRef<StkTableColumn<DT>[][]>;
|
|
9
9
|
};
|
|
10
10
|
/** 暂存纵向虚拟滚动的数据 */
|
|
11
11
|
export type VirtualScrollStore = {
|
|
@@ -42,7 +42,7 @@ export type VirtualScrollXStore = {
|
|
|
42
42
|
* @param param0
|
|
43
43
|
* @returns
|
|
44
44
|
*/
|
|
45
|
-
export declare function useVirtualScroll<DT extends Record<string, any>>({ props,
|
|
45
|
+
export declare function useVirtualScroll<DT extends Record<string, any>>({ props, tableContainerRef, dataSourceCopy, tableHeaderLast, tableHeaders, }: Option<DT>): {
|
|
46
46
|
virtualScroll: Ref<{
|
|
47
47
|
containerHeight: number;
|
|
48
48
|
pageSize: number;
|
|
@@ -23,7 +23,15 @@ export declare function insertToOrderedArray<T extends object>(sortState: SortSt
|
|
|
23
23
|
export declare function tableSort<T extends Record<string, any>>(sortOption: SortOption<T>, order: Order, dataSource: T[], sortConfig?: SortConfig<T>): T[];
|
|
24
24
|
/** 表头column配置的层级 */
|
|
25
25
|
export declare function howDeepTheHeader(arr: StkTableColumn<any>[], level?: number): number;
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* 获取列宽
|
|
28
|
+
*
|
|
29
|
+
* 关于列宽的操作往往在横向滚动中使用。既然已经有横向滚动了,则列宽会被压缩至minWidth,所以优先取minWidth
|
|
30
|
+
*/
|
|
27
31
|
export declare function getColWidth(col: StkTableColumn<any> | null): number;
|
|
28
|
-
/**
|
|
29
|
-
export declare function
|
|
32
|
+
/** 获取计算后的宽度 */
|
|
33
|
+
export declare function getCalculatedColWidth(col: StkTableColumn<any> | null): number;
|
|
34
|
+
/** number列宽+px */
|
|
35
|
+
export declare function transformWidthToStr(width?: string | number): string | undefined;
|
|
36
|
+
/** 创建组件唯一标识 */
|
|
37
|
+
export declare function createStkTableId(): string;
|