stk-table-vue 0.11.9 → 0.11.11
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 +10 -10
- package/lib/index-C40Rz-HL.js +1 -1
- package/lib/src/StkTable/StkTable.vue.d.ts +84 -122
- package/lib/src/StkTable/features/useAreaSelection.d.ts +3 -11
- package/lib/src/StkTable/types/index.d.ts +43 -4
- package/lib/src/StkTable/useRowExpand.d.ts +1 -1
- package/lib/src/StkTable/useTree.d.ts +1 -1
- package/lib/stk-table-vue.js +251 -142
- package/lib/style.css +23 -2
- package/package.json +1 -1
- package/src/StkTable/StkTable.vue +52 -27
- package/src/StkTable/components/Filter/Filter.vue +1 -1
- package/src/StkTable/features/useAreaSelection.ts +250 -131
- package/src/StkTable/registerFeature.ts +8 -4
- package/src/StkTable/style.less +27 -2
- package/src/StkTable/types/index.ts +37 -4
- package/src/StkTable/useFixedCol.ts +7 -4
- package/src/StkTable/useHighlight.ts +9 -5
- package/src/StkTable/useRowExpand.ts +3 -2
- package/src/StkTable/useTree.ts +3 -2
package/README.md
CHANGED
|
@@ -44,18 +44,18 @@ const stkTableRef = ref<InstanceType<typeof StkTable>>();
|
|
|
44
44
|
const stkTableRef = useTemplateRef('stkTableRef');
|
|
45
45
|
|
|
46
46
|
// highlight row
|
|
47
|
-
stkTableRef.value.setHighlightDimRow([rowKey]
|
|
48
|
-
method: 'css'|'animation'
|
|
49
|
-
className: 'custom-class-name', // method css
|
|
50
|
-
keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}]
|
|
51
|
-
duration: 2000
|
|
47
|
+
stkTableRef.value.setHighlightDimRow([rowKey], {
|
|
48
|
+
method: 'css' | 'animation', // default animation
|
|
49
|
+
className: 'custom-class-name', // for method 'css'
|
|
50
|
+
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
|
|
51
|
+
duration: 2000,
|
|
52
52
|
});
|
|
53
|
-
|
|
53
|
+
// highlight cell
|
|
54
54
|
stkTableRef.value.setHighlightDimCell(rowKey, colDataIndex, {
|
|
55
|
-
method: 'css'|'animation',
|
|
56
|
-
className:'custom-class-name', // method css
|
|
57
|
-
keyframe: [{backgroundColor:'#aaa'}, {backgroundColor: '#222'}], // method animation
|
|
58
|
-
duration: 2000
|
|
55
|
+
method: 'css' | 'animation',
|
|
56
|
+
className: 'custom-class-name', // for method 'css'
|
|
57
|
+
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // for method 'animation'
|
|
58
|
+
duration: 2000,
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
const columns = [
|
package/lib/index-C40Rz-HL.js
CHANGED
|
@@ -2,52 +2,7 @@ import { FilterStatus } from './components/Filter/types';
|
|
|
2
2
|
import { AreaSelectionConfig, AreaSelectionRange, AutoRowHeightConfig, ColResizableConfig, DragRowConfig, ExpandConfig, ExperimentalConfig, FooterConfig, HeaderDragConfig, HighlightConfig, Order, PrivateRowDT, PrivateStkTableColumn, RowActiveOption, SeqConfig, SortConfig, StkTableColumn, TreeConfig, UniqKey, UniqKeyProp } from './types/index';
|
|
3
3
|
import { ScrollbarOptions } from './useScrollbar';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
type DT = any & PrivateRowDT;
|
|
7
|
-
declare function setFilter(status: Record<UniqKey, FilterStatus> | null, option?: {
|
|
8
|
-
remote?: boolean;
|
|
9
|
-
}): void;
|
|
10
|
-
/**
|
|
11
|
-
* 选中一行
|
|
12
|
-
*
|
|
13
|
-
* en: Select a row
|
|
14
|
-
* @param {string} rowKeyOrRow selected rowKey, undefined to unselect
|
|
15
|
-
* @param {boolean} option.silent if set true not emit `current-change`. default:false
|
|
16
|
-
* @param {boolean} option.deep if set true, deep search in children. default:false
|
|
17
|
-
*/
|
|
18
|
-
declare function setCurrentRow(rowKeyOrRow: string | undefined | DT, option?: {
|
|
19
|
-
silent?: boolean;
|
|
20
|
-
deep?: boolean;
|
|
21
|
-
}): void;
|
|
22
|
-
/**
|
|
23
|
-
* set highlight active cell (props.cellActive=true)
|
|
24
|
-
* @param row row if undefined, clear highlight
|
|
25
|
-
* @param col column
|
|
26
|
-
* @param option.silent if emit current-change. default:false(not emit `current-change`)
|
|
27
|
-
*/
|
|
28
|
-
declare function setSelectedCell(row?: DT, col?: StkTableColumn<DT>, option?: {
|
|
29
|
-
silent: boolean;
|
|
30
|
-
}): void;
|
|
31
|
-
/**
|
|
32
|
-
* set scroll bar position
|
|
33
|
-
* @param top null to not change
|
|
34
|
-
* @param left null to not change
|
|
35
|
-
*/
|
|
36
|
-
declare function scrollTo(top?: number | null, left?: number | null): void;
|
|
37
|
-
/** get current table data */
|
|
38
|
-
declare function getTableData(): any[];
|
|
39
|
-
declare function __VLS_template(): {
|
|
40
|
-
tableHeader?(_: {
|
|
41
|
-
col: PrivateStkTableColumn<PrivateRowDT>;
|
|
42
|
-
}): any;
|
|
43
|
-
expand?(_: {
|
|
44
|
-
row: any;
|
|
45
|
-
col: StkTableColumn<any> | undefined;
|
|
46
|
-
}): any;
|
|
47
|
-
empty?(_: {}): any;
|
|
48
|
-
customBottom?(_: {}): any;
|
|
49
|
-
};
|
|
50
|
-
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
51
6
|
/** 表格宽度*/
|
|
52
7
|
width?: string;
|
|
53
8
|
/** 最小表格宽度 @deprecated*/
|
|
@@ -71,35 +26,35 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
71
26
|
* 是否可变行高
|
|
72
27
|
* - 设置为 `true` 时, `props.rowHeight` 将表示为期望行高,用于计算。不再影响实际行高。
|
|
73
28
|
*/
|
|
74
|
-
autoRowHeight?: boolean | AutoRowHeightConfig<
|
|
29
|
+
autoRowHeight?: boolean | AutoRowHeightConfig<any>;
|
|
75
30
|
/** 是否高亮鼠标悬浮的行 */
|
|
76
31
|
rowHover?: boolean;
|
|
77
32
|
/** 是否高亮选中的行 */
|
|
78
|
-
rowActive?: boolean | RowActiveOption<
|
|
33
|
+
rowActive?: boolean | RowActiveOption<any>;
|
|
79
34
|
/**
|
|
80
35
|
* @deprecated
|
|
81
36
|
*/
|
|
82
37
|
rowCurrentRevokable?: boolean;
|
|
83
38
|
/** 表头行高。default = rowHeight */
|
|
84
|
-
headerRowHeight?: number | string
|
|
39
|
+
headerRowHeight?: number | string;
|
|
85
40
|
/** 表尾行高。default = rowHeight */
|
|
86
|
-
footerRowHeight?: number | string
|
|
41
|
+
footerRowHeight?: number | string;
|
|
87
42
|
/** 虚拟滚动 */
|
|
88
43
|
virtual?: boolean;
|
|
89
44
|
/** x轴虚拟滚动(必须设置列宽)*/
|
|
90
45
|
virtualX?: boolean;
|
|
91
46
|
/** 表格列配置 */
|
|
92
|
-
columns?: StkTableColumn<
|
|
47
|
+
columns?: StkTableColumn<any>[];
|
|
93
48
|
/** 表格数据源 */
|
|
94
|
-
dataSource?:
|
|
49
|
+
dataSource?: any[];
|
|
95
50
|
/** 行唯一键 (行唯一值不能为undefined) */
|
|
96
51
|
rowKey?: UniqKeyProp;
|
|
97
52
|
/** 列唯一键 */
|
|
98
53
|
colKey?: UniqKeyProp;
|
|
99
54
|
/** 空值展示文字 */
|
|
100
55
|
emptyCellText?: string | ((option: {
|
|
101
|
-
row:
|
|
102
|
-
col: StkTableColumn<
|
|
56
|
+
row: any;
|
|
57
|
+
col: StkTableColumn<any>;
|
|
103
58
|
}) => string);
|
|
104
59
|
/** 暂无数据兜底高度是否撑满 */
|
|
105
60
|
noDataFull?: boolean;
|
|
@@ -122,19 +77,19 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
122
77
|
/** 是否启用单元格范围选中(拖拽选区) */
|
|
123
78
|
areaSelection?: boolean | AreaSelectionConfig;
|
|
124
79
|
/** 表头是否可拖动。支持回调函数。 */
|
|
125
|
-
headerDrag?: boolean | HeaderDragConfig<
|
|
80
|
+
headerDrag?: boolean | HeaderDragConfig<any>;
|
|
126
81
|
/**
|
|
127
82
|
* 给行附加className<br>
|
|
128
83
|
* FIXME: 是否需要优化,因为不传此prop会使表格行一直执行空函数,是否有影响
|
|
129
84
|
*/
|
|
130
|
-
rowClassName?: (row:
|
|
85
|
+
rowClassName?: (row: any, i: number) => string | undefined;
|
|
131
86
|
/**
|
|
132
87
|
* 列宽是否可拖动(需要设置v-model:columns)<br>
|
|
133
88
|
* **不要设置**列minWidth,**必须**设置width<br>
|
|
134
89
|
* 列宽拖动时,每一列都必须要有width,且minWidth/maxWidth不生效。table width会变为"fit-content"。
|
|
135
90
|
* - 会自动更新props.columns中的with属性
|
|
136
91
|
*/
|
|
137
|
-
colResizable?: boolean | ColResizableConfig<
|
|
92
|
+
colResizable?: boolean | ColResizableConfig<any>;
|
|
138
93
|
/** 可拖动至最小的列宽 */
|
|
139
94
|
colMinWidth?: number;
|
|
140
95
|
/**
|
|
@@ -156,7 +111,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
156
111
|
/** 优化vue2 滚动 */
|
|
157
112
|
optimizeVue2Scroll?: boolean;
|
|
158
113
|
/** 排序配置 */
|
|
159
|
-
sortConfig?: SortConfig<
|
|
114
|
+
sortConfig?: SortConfig<any>;
|
|
160
115
|
/** 隐藏头部title。可传入colKey数组 */
|
|
161
116
|
hideHeaderTitle?: boolean | string[];
|
|
162
117
|
/** 高亮配置 */
|
|
@@ -202,7 +157,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
202
157
|
*/
|
|
203
158
|
experimental?: ExperimentalConfig;
|
|
204
159
|
/** 表格底部合计行数据 */
|
|
205
|
-
footerData?:
|
|
160
|
+
footerData?: any[];
|
|
206
161
|
/** 表格底部配置 */
|
|
207
162
|
footerConfig?: FooterConfig;
|
|
208
163
|
}>, {
|
|
@@ -293,14 +248,19 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
293
248
|
* en:select a row
|
|
294
249
|
* @see {@link setCurrentRow}
|
|
295
250
|
*/
|
|
296
|
-
setCurrentRow:
|
|
251
|
+
setCurrentRow: (rowKeyOrRow: string | undefined | any, option?: {
|
|
252
|
+
silent?: boolean;
|
|
253
|
+
deep?: boolean;
|
|
254
|
+
}) => void;
|
|
297
255
|
/**
|
|
298
256
|
* 取消选中单元格
|
|
299
257
|
*
|
|
300
258
|
* en: set highlight active cell (props.cellActive=true)
|
|
301
259
|
* @see {@link setSelectedCell}
|
|
302
260
|
*/
|
|
303
|
-
setSelectedCell:
|
|
261
|
+
setSelectedCell: (row?: any, col?: StkTableColumn<any>, option?: {
|
|
262
|
+
silent: boolean;
|
|
263
|
+
}) => void;
|
|
304
264
|
/**
|
|
305
265
|
* 设置高亮单元格
|
|
306
266
|
*
|
|
@@ -375,14 +335,14 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
375
335
|
* en: Scroll to
|
|
376
336
|
* @see {@link scrollTo}
|
|
377
337
|
*/
|
|
378
|
-
scrollTo:
|
|
338
|
+
scrollTo: (top?: number | null, left?: number | null) => void;
|
|
379
339
|
/**
|
|
380
340
|
* 获取表格数据
|
|
381
341
|
*
|
|
382
342
|
* en: Get table data
|
|
383
343
|
* @see {@link getTableData}
|
|
384
344
|
*/
|
|
385
|
-
getTableData:
|
|
345
|
+
getTableData: () => any[];
|
|
386
346
|
/**
|
|
387
347
|
* 设置展开的行
|
|
388
348
|
*
|
|
@@ -429,16 +389,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
429
389
|
getSelectedArea: () => {
|
|
430
390
|
rows: any[];
|
|
431
391
|
cols: StkTableColumn<any>[];
|
|
432
|
-
|
|
433
|
-
} | {
|
|
434
|
-
rows: any[];
|
|
435
|
-
cols: StkTableColumn<any>[];
|
|
436
|
-
range: {
|
|
437
|
-
startRowIndex: number;
|
|
438
|
-
startColIndex: number;
|
|
439
|
-
endRowIndex: number;
|
|
440
|
-
endColIndex: number;
|
|
441
|
-
};
|
|
392
|
+
ranges: AreaSelectionRange[];
|
|
442
393
|
};
|
|
443
394
|
/**
|
|
444
395
|
* 清空拖选选区
|
|
@@ -454,7 +405,15 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
454
405
|
* @see {@link copySelectedArea}
|
|
455
406
|
*/
|
|
456
407
|
copySelectedArea: () => string;
|
|
457
|
-
|
|
408
|
+
/**
|
|
409
|
+
* 设置筛选状态
|
|
410
|
+
*
|
|
411
|
+
* en: Set filter status
|
|
412
|
+
* @see {@link setFilter}
|
|
413
|
+
*/
|
|
414
|
+
setFilter: (status: Record<UniqKey, FilterStatus> | null, option?: {
|
|
415
|
+
remote?: boolean;
|
|
416
|
+
}) => void;
|
|
458
417
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
459
418
|
"sort-change": (col: StkTableColumn<any> | null, order: Order, data: any[], sortConfig: SortConfig<any>) => void;
|
|
460
419
|
"row-click": (ev: MouseEvent, row: any, data: {
|
|
@@ -465,8 +424,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
465
424
|
}) => void;
|
|
466
425
|
"cell-selected": (ev: MouseEvent | null, data: {
|
|
467
426
|
select: boolean;
|
|
468
|
-
row:
|
|
469
|
-
col: StkTableColumn<
|
|
427
|
+
row: any | undefined;
|
|
428
|
+
col: StkTableColumn<any> | undefined;
|
|
470
429
|
}) => void;
|
|
471
430
|
"row-dblclick": (ev: MouseEvent, row: any, data: {
|
|
472
431
|
rowIndex: number;
|
|
@@ -497,18 +456,15 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
497
456
|
"col-resize": (col: StkTableColumn<any>) => void;
|
|
498
457
|
"toggle-row-expand": (data: {
|
|
499
458
|
expanded: boolean;
|
|
500
|
-
row:
|
|
501
|
-
col: StkTableColumn<
|
|
459
|
+
row: any;
|
|
460
|
+
col: StkTableColumn<any> | null;
|
|
502
461
|
}) => void;
|
|
503
462
|
"toggle-tree-expand": (data: {
|
|
504
463
|
expanded: boolean;
|
|
505
|
-
row:
|
|
506
|
-
col: StkTableColumn<
|
|
507
|
-
}) => void;
|
|
508
|
-
"area-selection-change": (range: AreaSelectionRange | null, data: {
|
|
509
|
-
rows: DT[];
|
|
510
|
-
cols: StkTableColumn<DT>[];
|
|
464
|
+
row: any;
|
|
465
|
+
col: StkTableColumn<any> | null;
|
|
511
466
|
}) => void;
|
|
467
|
+
"area-selection-change": (ranges: AreaSelectionRange[]) => void;
|
|
512
468
|
"filter-change": (status: Record<UniqKey, FilterStatus>) => void;
|
|
513
469
|
"update:columns": (cols: StkTableColumn<any>[]) => void;
|
|
514
470
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
@@ -535,35 +491,35 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
535
491
|
* 是否可变行高
|
|
536
492
|
* - 设置为 `true` 时, `props.rowHeight` 将表示为期望行高,用于计算。不再影响实际行高。
|
|
537
493
|
*/
|
|
538
|
-
autoRowHeight?: boolean | AutoRowHeightConfig<
|
|
494
|
+
autoRowHeight?: boolean | AutoRowHeightConfig<any>;
|
|
539
495
|
/** 是否高亮鼠标悬浮的行 */
|
|
540
496
|
rowHover?: boolean;
|
|
541
497
|
/** 是否高亮选中的行 */
|
|
542
|
-
rowActive?: boolean | RowActiveOption<
|
|
498
|
+
rowActive?: boolean | RowActiveOption<any>;
|
|
543
499
|
/**
|
|
544
500
|
* @deprecated
|
|
545
501
|
*/
|
|
546
502
|
rowCurrentRevokable?: boolean;
|
|
547
503
|
/** 表头行高。default = rowHeight */
|
|
548
|
-
headerRowHeight?: number | string
|
|
504
|
+
headerRowHeight?: number | string;
|
|
549
505
|
/** 表尾行高。default = rowHeight */
|
|
550
|
-
footerRowHeight?: number | string
|
|
506
|
+
footerRowHeight?: number | string;
|
|
551
507
|
/** 虚拟滚动 */
|
|
552
508
|
virtual?: boolean;
|
|
553
509
|
/** x轴虚拟滚动(必须设置列宽)*/
|
|
554
510
|
virtualX?: boolean;
|
|
555
511
|
/** 表格列配置 */
|
|
556
|
-
columns?: StkTableColumn<
|
|
512
|
+
columns?: StkTableColumn<any>[];
|
|
557
513
|
/** 表格数据源 */
|
|
558
|
-
dataSource?:
|
|
514
|
+
dataSource?: any[];
|
|
559
515
|
/** 行唯一键 (行唯一值不能为undefined) */
|
|
560
516
|
rowKey?: UniqKeyProp;
|
|
561
517
|
/** 列唯一键 */
|
|
562
518
|
colKey?: UniqKeyProp;
|
|
563
519
|
/** 空值展示文字 */
|
|
564
520
|
emptyCellText?: string | ((option: {
|
|
565
|
-
row:
|
|
566
|
-
col: StkTableColumn<
|
|
521
|
+
row: any;
|
|
522
|
+
col: StkTableColumn<any>;
|
|
567
523
|
}) => string);
|
|
568
524
|
/** 暂无数据兜底高度是否撑满 */
|
|
569
525
|
noDataFull?: boolean;
|
|
@@ -586,19 +542,19 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
586
542
|
/** 是否启用单元格范围选中(拖拽选区) */
|
|
587
543
|
areaSelection?: boolean | AreaSelectionConfig;
|
|
588
544
|
/** 表头是否可拖动。支持回调函数。 */
|
|
589
|
-
headerDrag?: boolean | HeaderDragConfig<
|
|
545
|
+
headerDrag?: boolean | HeaderDragConfig<any>;
|
|
590
546
|
/**
|
|
591
547
|
* 给行附加className<br>
|
|
592
548
|
* FIXME: 是否需要优化,因为不传此prop会使表格行一直执行空函数,是否有影响
|
|
593
549
|
*/
|
|
594
|
-
rowClassName?: (row:
|
|
550
|
+
rowClassName?: (row: any, i: number) => string | undefined;
|
|
595
551
|
/**
|
|
596
552
|
* 列宽是否可拖动(需要设置v-model:columns)<br>
|
|
597
553
|
* **不要设置**列minWidth,**必须**设置width<br>
|
|
598
554
|
* 列宽拖动时,每一列都必须要有width,且minWidth/maxWidth不生效。table width会变为"fit-content"。
|
|
599
555
|
* - 会自动更新props.columns中的with属性
|
|
600
556
|
*/
|
|
601
|
-
colResizable?: boolean | ColResizableConfig<
|
|
557
|
+
colResizable?: boolean | ColResizableConfig<any>;
|
|
602
558
|
/** 可拖动至最小的列宽 */
|
|
603
559
|
colMinWidth?: number;
|
|
604
560
|
/**
|
|
@@ -620,7 +576,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
620
576
|
/** 优化vue2 滚动 */
|
|
621
577
|
optimizeVue2Scroll?: boolean;
|
|
622
578
|
/** 排序配置 */
|
|
623
|
-
sortConfig?: SortConfig<
|
|
579
|
+
sortConfig?: SortConfig<any>;
|
|
624
580
|
/** 隐藏头部title。可传入colKey数组 */
|
|
625
581
|
hideHeaderTitle?: boolean | string[];
|
|
626
582
|
/** 高亮配置 */
|
|
@@ -666,7 +622,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
666
622
|
*/
|
|
667
623
|
experimental?: ExperimentalConfig;
|
|
668
624
|
/** 表格底部合计行数据 */
|
|
669
|
-
footerData?:
|
|
625
|
+
footerData?: any[];
|
|
670
626
|
/** 表格底部配置 */
|
|
671
627
|
footerConfig?: FooterConfig;
|
|
672
628
|
}>, {
|
|
@@ -734,16 +690,13 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
734
690
|
startIndex: number;
|
|
735
691
|
endIndex: number;
|
|
736
692
|
}) => any) | undefined;
|
|
737
|
-
"onArea-selection-change"?: ((
|
|
738
|
-
rows: DT[];
|
|
739
|
-
cols: StkTableColumn<DT>[];
|
|
740
|
-
}) => any) | undefined;
|
|
693
|
+
"onArea-selection-change"?: ((ranges: AreaSelectionRange[]) => any) | undefined;
|
|
741
694
|
"onUpdate:columns"?: ((cols: StkTableColumn<any>[]) => any) | undefined;
|
|
742
695
|
"onCol-resize"?: ((col: StkTableColumn<any>) => any) | undefined;
|
|
743
696
|
"onToggle-row-expand"?: ((data: {
|
|
744
697
|
expanded: boolean;
|
|
745
|
-
row:
|
|
746
|
-
col: StkTableColumn<
|
|
698
|
+
row: any;
|
|
699
|
+
col: StkTableColumn<any> | null;
|
|
747
700
|
}) => any) | undefined;
|
|
748
701
|
"onSort-change"?: ((col: StkTableColumn<any> | null, order: Order, data: any[], sortConfig: SortConfig<any>) => any) | undefined;
|
|
749
702
|
"onTh-drag-start"?: ((dragStartKey: string) => any) | undefined;
|
|
@@ -752,8 +705,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
752
705
|
"onRow-order-change"?: ((dragStartKey: string, targetRowKey: string) => any) | undefined;
|
|
753
706
|
"onToggle-tree-expand"?: ((data: {
|
|
754
707
|
expanded: boolean;
|
|
755
|
-
row:
|
|
756
|
-
col: StkTableColumn<
|
|
708
|
+
row: any;
|
|
709
|
+
col: StkTableColumn<any> | null;
|
|
757
710
|
}) => any) | undefined;
|
|
758
711
|
"onRow-click"?: ((ev: MouseEvent, row: any, data: {
|
|
759
712
|
rowIndex: number;
|
|
@@ -763,8 +716,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
763
716
|
}) => any) | undefined;
|
|
764
717
|
"onCell-selected"?: ((ev: MouseEvent | null, data: {
|
|
765
718
|
select: boolean;
|
|
766
|
-
row:
|
|
767
|
-
col: StkTableColumn<
|
|
719
|
+
row: any | undefined;
|
|
720
|
+
col: StkTableColumn<any> | undefined;
|
|
768
721
|
}) => any) | undefined;
|
|
769
722
|
"onRow-dblclick"?: ((ev: MouseEvent, row: any, data: {
|
|
770
723
|
rowIndex: number;
|
|
@@ -789,29 +742,29 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
789
742
|
width: string;
|
|
790
743
|
minWidth: string;
|
|
791
744
|
maxWidth: string;
|
|
792
|
-
sortConfig: SortConfig<
|
|
745
|
+
sortConfig: SortConfig<any>;
|
|
793
746
|
colKey: UniqKeyProp;
|
|
794
747
|
rowHeight: number;
|
|
795
748
|
headless: boolean;
|
|
796
|
-
autoRowHeight: boolean | AutoRowHeightConfig<
|
|
749
|
+
autoRowHeight: boolean | AutoRowHeightConfig<any>;
|
|
797
750
|
stripe: boolean;
|
|
798
751
|
optimizeVue2Scroll: boolean;
|
|
799
752
|
rowKey: UniqKeyProp;
|
|
800
|
-
headerRowHeight: number | string
|
|
753
|
+
headerRowHeight: number | string;
|
|
801
754
|
scrollbar: boolean | ScrollbarOptions;
|
|
802
755
|
fixedMode: boolean;
|
|
803
756
|
theme: "light" | "dark";
|
|
804
757
|
rowHover: boolean;
|
|
805
|
-
rowActive: boolean | RowActiveOption<
|
|
758
|
+
rowActive: boolean | RowActiveOption<any>;
|
|
806
759
|
rowCurrentRevokable: boolean;
|
|
807
|
-
footerRowHeight: number | string
|
|
760
|
+
footerRowHeight: number | string;
|
|
808
761
|
virtual: boolean;
|
|
809
762
|
virtualX: boolean;
|
|
810
|
-
columns: StkTableColumn<
|
|
811
|
-
dataSource:
|
|
763
|
+
columns: StkTableColumn<any>[];
|
|
764
|
+
dataSource: any[];
|
|
812
765
|
emptyCellText: string | ((option: {
|
|
813
|
-
row:
|
|
814
|
-
col: StkTableColumn<
|
|
766
|
+
row: any;
|
|
767
|
+
col: StkTableColumn<any>;
|
|
815
768
|
}) => string);
|
|
816
769
|
noDataFull: boolean;
|
|
817
770
|
showNoData: boolean;
|
|
@@ -823,9 +776,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
823
776
|
cellActive: boolean;
|
|
824
777
|
selectedCellRevokable: boolean;
|
|
825
778
|
areaSelection: boolean | AreaSelectionConfig;
|
|
826
|
-
headerDrag: boolean | HeaderDragConfig<
|
|
827
|
-
rowClassName: (row:
|
|
828
|
-
colResizable: boolean | ColResizableConfig<
|
|
779
|
+
headerDrag: boolean | HeaderDragConfig<any>;
|
|
780
|
+
rowClassName: (row: any, i: number) => string | undefined;
|
|
781
|
+
colResizable: boolean | ColResizableConfig<any>;
|
|
829
782
|
colMinWidth: number;
|
|
830
783
|
bordered: boolean | "h" | "v" | "body-v" | "body-h";
|
|
831
784
|
autoResize: boolean | (() => void);
|
|
@@ -840,10 +793,19 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
840
793
|
smoothScroll: boolean;
|
|
841
794
|
scrollRowByRow: boolean | "scrollbar";
|
|
842
795
|
experimental: ExperimentalConfig;
|
|
843
|
-
footerData:
|
|
796
|
+
footerData: any[];
|
|
844
797
|
footerConfig: FooterConfig;
|
|
845
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any
|
|
846
|
-
|
|
798
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>, {
|
|
799
|
+
tableHeader?(_: {
|
|
800
|
+
col: PrivateStkTableColumn<PrivateRowDT>;
|
|
801
|
+
}): any;
|
|
802
|
+
expand?(_: {
|
|
803
|
+
row: any;
|
|
804
|
+
col: StkTableColumn<any> | undefined;
|
|
805
|
+
}): any;
|
|
806
|
+
empty?(_: {}): any;
|
|
807
|
+
customBottom?(_: {}): any;
|
|
808
|
+
}>;
|
|
847
809
|
export default _default;
|
|
848
810
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
849
811
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref, ShallowRef } from 'vue';
|
|
2
|
-
import { AreaSelectionConfig, CellKeyGen, ColKeyGen, StkTableColumn, UniqKey } from '../types';
|
|
2
|
+
import { AreaSelectionConfig, AreaSelectionRange, CellKeyGen, ColKeyGen, StkTableColumn, UniqKey } from '../types';
|
|
3
3
|
import { VirtualScrollStore, VirtualScrollXStore } from '../useVirtualScroll';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -11,19 +11,11 @@ export declare function useAreaSelection<DT extends Record<string, any>>(props:
|
|
|
11
11
|
config: import('vue').ComputedRef<AreaSelectionConfig>;
|
|
12
12
|
isSelecting: Ref<boolean, boolean>;
|
|
13
13
|
getClass: (cellKey: string, absoluteRowIndex: number, colKey: UniqKey) => string[];
|
|
14
|
+
getRowClass: (absoluteRowIndex: number) => string[];
|
|
14
15
|
get: () => {
|
|
15
16
|
rows: DT[];
|
|
16
17
|
cols: StkTableColumn<DT>[];
|
|
17
|
-
|
|
18
|
-
} | {
|
|
19
|
-
rows: DT[];
|
|
20
|
-
cols: StkTableColumn<DT>[];
|
|
21
|
-
range: {
|
|
22
|
-
startRowIndex: number;
|
|
23
|
-
startColIndex: number;
|
|
24
|
-
endRowIndex: number;
|
|
25
|
-
endColIndex: number;
|
|
26
|
-
};
|
|
18
|
+
ranges: AreaSelectionRange[];
|
|
27
19
|
};
|
|
28
20
|
clear: () => void;
|
|
29
21
|
copy: () => string;
|
|
@@ -319,10 +319,22 @@ export type RowActiveOption<DT> = {
|
|
|
319
319
|
};
|
|
320
320
|
/** 单元格选区范围 */
|
|
321
321
|
export type AreaSelectionRange = {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
322
|
+
index: {
|
|
323
|
+
/** column index range @deprecated */
|
|
324
|
+
x: [number, number];
|
|
325
|
+
/** row index range @deprecated */
|
|
326
|
+
y: [number, number];
|
|
327
|
+
/** start point index*/
|
|
328
|
+
begin: {
|
|
329
|
+
row: number;
|
|
330
|
+
col: number;
|
|
331
|
+
};
|
|
332
|
+
/** end point index */
|
|
333
|
+
end: {
|
|
334
|
+
row: number;
|
|
335
|
+
col: number;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
326
338
|
};
|
|
327
339
|
/** 单元格选区配置 */
|
|
328
340
|
export type AreaSelectionConfig<T extends Record<string, any> = any> = {
|
|
@@ -344,6 +356,33 @@ export type AreaSelectionConfig<T extends Record<string, any> = any> = {
|
|
|
344
356
|
* @default false
|
|
345
357
|
*/
|
|
346
358
|
keyboard?: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* 是否启用 Ctrl 多选功能。
|
|
361
|
+
* 启用后,按住 Ctrl/Cmd 键点击可以选择多个不连续的区域。
|
|
362
|
+
* @default true
|
|
363
|
+
*/
|
|
364
|
+
ctrl?: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* 是否启用 Shift 扩选功能。
|
|
367
|
+
* 启用后,按住 Shift 键点击可以从锚点扩展到当前位置。
|
|
368
|
+
* @default true
|
|
369
|
+
*/
|
|
370
|
+
shift?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* 高亮配置
|
|
373
|
+
*/
|
|
374
|
+
highlight?: {
|
|
375
|
+
/**
|
|
376
|
+
* 是否启用单元格高亮与选中边框。
|
|
377
|
+
* @default true
|
|
378
|
+
*/
|
|
379
|
+
cell?: boolean;
|
|
380
|
+
/**
|
|
381
|
+
* 是否启用行高亮(单元格跨越的整行都会高亮)。
|
|
382
|
+
* @default false
|
|
383
|
+
*/
|
|
384
|
+
row?: boolean;
|
|
385
|
+
};
|
|
347
386
|
};
|
|
348
387
|
/** 实验性功能配置 */
|
|
349
388
|
export type ExperimentalConfig = {
|
|
@@ -2,7 +2,7 @@ import { ShallowRef } from 'vue';
|
|
|
2
2
|
import { PrivateRowDT, RowKeyGen, StkTableColumn } from './types';
|
|
3
3
|
|
|
4
4
|
type DT = PrivateRowDT;
|
|
5
|
-
export declare function useRowExpand(emits: any, dataSourceCopy: ShallowRef<DT[]>, rowKeyGen: RowKeyGen): readonly [(row: DT, col: StkTableColumn<DT>) => void, (rowKeyOrRow: string | undefined | DT, expand?: boolean | null, data?: {
|
|
5
|
+
export declare function useRowExpand(emits: any, dataSourceCopy: ShallowRef<DT[]>, rowKeyGen: RowKeyGen, onDataSourceChange: () => void): readonly [(row: DT, col: StkTableColumn<DT>) => void, (rowKeyOrRow: string | undefined | DT, expand?: boolean | null, data?: {
|
|
6
6
|
col?: StkTableColumn<DT>;
|
|
7
7
|
silent?: boolean;
|
|
8
8
|
}) => void];
|
|
@@ -4,7 +4,7 @@ import { PrivateRowDT, RowKeyGen, UniqKey } from './types';
|
|
|
4
4
|
type DT = PrivateRowDT & {
|
|
5
5
|
children?: DT[];
|
|
6
6
|
};
|
|
7
|
-
export declare function useTree(props: any, dataSourceCopy: ShallowRef<DT[]>, rowKeyGen: RowKeyGen, emits: any): readonly [(row: DT, col: any) => void, (row: (UniqKey | DT) | (UniqKey | DT)[], option?: {
|
|
7
|
+
export declare function useTree(props: any, dataSourceCopy: ShallowRef<DT[]>, rowKeyGen: RowKeyGen, emits: any, onDataSourceChange: () => void): readonly [(row: DT, col: any) => void, (row: (UniqKey | DT) | (UniqKey | DT)[], option?: {
|
|
8
8
|
expand?: boolean;
|
|
9
9
|
}) => void, (data: DT[]) => DT[]];
|
|
10
10
|
export {};
|