stk-table-vue 0.8.8 → 0.8.9

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.
@@ -1,749 +1,753 @@
1
- import { AutoRowHeightConfig, ColResizableConfig, DragRowConfig, ExpandConfig, HeaderDragConfig, HighlightConfig, Order, PrivateRowDT, PrivateStkTableColumn, SeqConfig, SortConfig, SortOption, StkTableColumn, TreeConfig, UniqKey, UniqKeyProp } from './types/index';
2
-
3
- /** Generic stands for DataType */
4
- type DT = any & PrivateRowDT;
5
- /**
6
- * 选中一行
7
- * @param {string} rowKeyOrRow selected rowKey, undefined to unselect
8
- * @param {boolean} option.silent if set true not emit `current-change`. default:false
9
- * @param {boolean} option.deep if set true, deep search in children. default:false
10
- */
11
- declare function setCurrentRow(rowKeyOrRow: string | undefined | DT, option?: {
12
- silent: boolean;
13
- deep: boolean;
14
- }): void;
15
- /**
16
- * set highlight active cell (props.cellActive=true)
17
- * @param row row if undefined, clear highlight
18
- * @param col column
19
- * @param option.silent if emit current-change. default:false(not emit `current-change`)
20
- */
21
- declare function setSelectedCell(row?: DT, col?: StkTableColumn<DT>, option?: {
22
- silent: boolean;
23
- }): void;
24
- /**
25
- * 设置表头排序状态。
26
- * @param colKey 列唯一键字段。如果你想要取消排序状态,请使用`resetSorter`
27
- * @param order 正序倒序
28
- * @param option.sortOption 指定排序参数。同 StkTableColumn 中排序相关字段。建议从columns中find得到。
29
- * @param option.sort 是否触发排序-默认true
30
- * @param option.silent 是否禁止触发回调-默认true
31
- * @param option.force 是否触发排序-默认true
32
- * @return 表格数据
33
- */
34
- declare function setSorter(colKey: string, order: Order, option?: {
35
- sortOption?: SortOption<DT>;
36
- force?: boolean;
37
- silent?: boolean;
38
- sort?: boolean;
39
- }): any[];
40
- declare function resetSorter(): void;
41
- /**
42
- * set scroll bar position
43
- * @param top null to not change
44
- * @param left null to not change
45
- */
46
- declare function scrollTo(top?: number | null, left?: number | null): void;
47
- /** get current table data */
48
- declare function getTableData(): any[];
49
- /**
50
- * get current sort info
51
- * @return {{key:string,order:Order}[]}
52
- */
53
- declare function getSortColumns(): {
54
- key: string | number | symbol | undefined;
55
- order: "desc" | "asc";
56
- }[];
57
- declare function __VLS_template(): {
58
- tableHeader?(_: {
59
- col: PrivateStkTableColumn<any>;
60
- }): any;
61
- expand?(_: {
62
- row: any;
63
- col: any;
64
- }): any;
65
- empty?(_: {}): any;
66
- customBottom?(_: {}): any;
67
- };
68
- declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
69
- width?: string;
70
- /** 最小表格宽度 */
71
- minWidth?: string;
72
- /** 表格最大宽度*/
73
- maxWidth?: string;
74
- /** 斑马线条纹 */
75
- stripe?: boolean;
76
- /** 是否使用 table-layout:fixed(低版本浏览器需要设置table) */
77
- fixedMode?: boolean;
78
- /** 是否隐藏表头 */
79
- headless?: boolean;
80
- /** 主题,亮、暗 */
81
- theme?: "light" | "dark";
82
- /**
83
- * 行高
84
- * - `props.autoRowHeight` 为 `true` 时,将表示为期望行高,用于计算。不再影响实际行高。
85
- */
86
- rowHeight?: number;
87
- /**
88
- * 是否可变行高
89
- * - 设置为 `true` 时, `props.rowHeight` 将表示为期望行高,用于计算。不再影响实际行高。
90
- */
91
- autoRowHeight?: boolean | AutoRowHeightConfig<DT>;
92
- /** 是否高亮鼠标悬浮的行 */
93
- rowHover?: boolean;
94
- /** 是否高亮选中的行 */
95
- rowActive?: boolean;
96
- /** 当前行再次点击否可以取消 (rowActive=true)*/
97
- rowCurrentRevokable?: boolean;
98
- /** 表头行高。default = rowHeight */
99
- headerRowHeight?: number | string | null;
100
- /** 虚拟滚动 */
101
- virtual?: boolean;
102
- /** x轴虚拟滚动(必须设置列宽)*/
103
- virtualX?: boolean;
104
- /** 表格列配置 */
105
- columns?: StkTableColumn<DT>[];
106
- /** 表格数据源 */
107
- dataSource?: DT[];
108
- /** 行唯一键 (行唯一值不能为undefined) */
109
- rowKey?: UniqKeyProp;
110
- /** 列唯一键 */
111
- colKey?: UniqKeyProp;
112
- /** 空值展示文字 */
113
- emptyCellText?: string | ((option: {
114
- row: DT;
115
- col: StkTableColumn<DT>;
116
- }) => string);
117
- /** 暂无数据兜底高度是否撑满 */
118
- noDataFull?: boolean;
119
- /** 是否展示暂无数据 */
120
- showNoData?: boolean;
121
- /** 是否服务端排序,true则不排序数据 */
122
- sortRemote?: boolean;
123
- /** 表头是否溢出展示... */
124
- showHeaderOverflow?: boolean;
125
- /** 表体溢出是否展示... */
126
- showOverflow?: boolean;
127
- /** 是否增加行hover class $*$ rename*/
128
- showTrHoverClass?: boolean;
129
- /** 是否高亮鼠标悬浮的单元格 */
130
- cellHover?: boolean;
131
- /** 是否高亮选中的单元格 */
132
- cellActive?: boolean;
133
- /** 单元格再次点击否可以取消选中 (cellActive=true)*/
134
- selectedCellRevokable?: boolean;
135
- /** 表头是否可拖动。支持回调函数。 */
136
- headerDrag?: boolean | HeaderDragConfig;
137
- /**
138
- * 给行附加className<br>
139
- * FIXME: 是否需要优化,因为不传此prop会使表格行一直执行空函数,是否有影响
140
- */
141
- rowClassName?: (row: DT, i: number) => string | undefined;
142
- /**
143
- * 列宽是否可拖动(需要设置v-model:columns)<br>
144
- * **不要设置**列minWidth,**必须**设置width<br>
145
- * 列宽拖动时,每一列都必须要有width,且minWidth/maxWidth不生效。table width会变为"fit-content"。
146
- * - 会自动更新props.columns中的with属性
147
- */
148
- colResizable?: boolean | ColResizableConfig<DT>;
149
- /** 可拖动至最小的列宽 */
150
- colMinWidth?: number;
151
- /**
152
- * 单元格分割线。
153
- * 默认横竖都有
154
- * "h" - 仅展示横线
155
- * "v" - 仅展示竖线
156
- * "body-v" - 仅表体展示竖线
157
- */
158
- bordered?: boolean | "h" | "v" | "body-v";
159
- /**
160
- * 自动重新计算虚拟滚动高度宽度。默认true
161
- * [非响应式]
162
- * 传入方法表示resize后的回调
163
- */
164
- autoResize?: boolean | (() => void);
165
- /** 是否展示固定列阴影。为节省性能,默认false。 */
166
- fixedColShadow?: boolean;
167
- /** 优化vue2 滚动 */
168
- optimizeVue2Scroll?: boolean;
169
- /** 排序配置 */
170
- sortConfig?: SortConfig<DT>;
171
- /** 隐藏头部title。可传入colKey数组 */
172
- hideHeaderTitle?: boolean | string[];
173
- /** 高亮配置 */
174
- highlightConfig?: HighlightConfig;
175
- /** 序号列配置 */
176
- seqConfig?: SeqConfig;
177
- /** 展开行配置 */
178
- expandConfig?: ExpandConfig;
179
- /** 行拖动配置 */
180
- dragRowConfig?: DragRowConfig;
181
- /** 树形配置 */
182
- treeConfig?: TreeConfig;
183
- /**
184
- * 固定头,固定列实现方式。(非响应式)
185
- *
186
- * relative:固定列只会放在props.columns的两侧。
187
- * - 如果列宽会变动则谨慎使用。
188
- * - 多级表头固定列慎用
189
- *
190
- * 低版本浏览器强制为'relative',
191
- */
192
- cellFixedMode?: "sticky" | "relative";
193
- /**
194
- * 是否平滑滚动。default: chrome < 85 || chrome > 120 ? true : false
195
- * - false: 使用 onwheel 滚动。为了防止滚动过快导致白屏。
196
- * - true: 不使用 onwheel 滚动。鼠标滚轮滚动时更加平滑。滚动过快时会白屏。
197
- */
198
- smoothScroll?: boolean;
199
- /**
200
- * 按整数行纵向滚动
201
- * - scrollbar:仅拖动滚动条生效
202
- */
203
- scrollRowByRow?: boolean | "scrollbar";
204
- }>, {
205
- width: string;
206
- fixedMode: boolean;
207
- stripe: boolean;
208
- minWidth: string;
209
- maxWidth: string;
210
- headless: boolean;
211
- theme: string;
212
- rowHeight: number;
213
- autoRowHeight: boolean;
214
- rowHover: boolean;
215
- rowActive: boolean;
216
- rowCurrentRevokable: boolean;
217
- headerRowHeight: number;
218
- virtual: boolean;
219
- virtualX: boolean;
220
- columns: () => never[];
221
- dataSource: () => never[];
222
- rowKey: string;
223
- colKey: undefined;
224
- emptyCellText: string;
225
- noDataFull: boolean;
226
- showNoData: boolean;
227
- sortRemote: boolean;
228
- showHeaderOverflow: boolean;
229
- showOverflow: boolean;
230
- showTrHoverClass: boolean;
231
- cellHover: boolean;
232
- cellActive: boolean;
233
- selectedCellRevokable: boolean;
234
- headerDrag: boolean;
235
- rowClassName: () => "";
236
- colResizable: boolean;
237
- colMinWidth: number;
238
- bordered: boolean;
239
- autoResize: boolean;
240
- fixedColShadow: boolean;
241
- optimizeVue2Scroll: boolean;
242
- sortConfig: () => {
243
- emptyToBottom: false;
244
- stringLocaleCompare: false;
245
- sortChildren: false;
246
- };
247
- hideHeaderTitle: boolean;
248
- highlightConfig: () => {};
249
- seqConfig: () => {};
250
- expandConfig: () => {};
251
- dragRowConfig: () => {};
252
- treeConfig: () => {};
253
- cellFixedMode: string;
254
- smoothScroll: boolean;
255
- scrollRowByRow: boolean;
256
- }>>, {
257
- /**
258
- * 重新计算虚拟列表宽高
259
- *
260
- * en: calc virtual scroll x & y info
261
- * @see {@link initVirtualScroll}
262
- */
263
- initVirtualScroll: (height?: number) => void;
264
- /**
265
- * 重新计算虚拟列表宽度
266
- *
267
- * en: calc virtual scroll x
268
- * @see {@link initVirtualScrollX}
269
- */
270
- initVirtualScrollX: () => void;
271
- /**
272
- * 重新计算虚拟列表高度
273
- *
274
- * en: calc virtual scroll y
275
- * @see {@link initVirtualScrollY}
276
- */
277
- initVirtualScrollY: (height?: number) => void;
278
- /**
279
- * 选中一行
280
- *
281
- * en:select a row
282
- * @see {@link setCurrentRow}
283
- */
284
- setCurrentRow: typeof setCurrentRow;
285
- /**
286
- * 取消选中单元格
287
- *
288
- * en: set highlight active cell (props.cellActive=true)
289
- * @see {@link setSelectedCell}
290
- */
291
- setSelectedCell: typeof setSelectedCell;
292
- /**
293
- * 设置高亮单元格
294
- *
295
- * en: Set highlight cell
296
- * @see {@link setHighlightDimCell}
297
- */
298
- setHighlightDimCell: (rowKeyValue: UniqKey, colKeyValue: string, option?: import('./types/highlightDimOptions').HighlightDimCellOption) => void;
299
- /**
300
- * 设置高亮行
301
- *
302
- * en: Set highlight row
303
- * @see {@link setHighlightDimRow}
304
- */
305
- setHighlightDimRow: (rowKeyValues: UniqKey[], option?: import('./types/highlightDimOptions').HighlightDimRowOption) => void;
306
- /**
307
- * 表格排序列colKey
308
- *
309
- * en: Table sort column colKey
310
- */
311
- sortCol: import('vue').Ref<string | number | symbol | undefined, string | number | symbol | undefined>;
312
- /**
313
- * 表格排序列顺序
314
- *
315
- * en: get current sort info
316
- * @see {@link getSortColumns}
317
- */
318
- getSortColumns: typeof getSortColumns;
319
- /**
320
- * 设置表头排序状态
321
- *
322
- * en: Set the sort status of the table header
323
- * @see {@link setSorter}
324
- */
325
- setSorter: typeof setSorter;
326
- /**
327
- * 重置sorter状态
328
- *
329
- * en: Reset the sorter status
330
- * @see {@link resetSorter}
331
- */
332
- resetSorter: typeof resetSorter;
333
- /**
334
- * 滚动至
335
- *
336
- * en: Scroll to
337
- * @see {@link scrollTo}
338
- */
339
- scrollTo: typeof scrollTo;
340
- /**
341
- * 获取表格数据
342
- *
343
- * en: Get table data
344
- * @see {@link getTableData}
345
- */
346
- getTableData: typeof getTableData;
347
- /**
348
- * 设置展开的行
349
- *
350
- * en: Set expanded rows
351
- * @see {@link setRowExpand}
352
- */
353
- setRowExpand: (rowKeyOrRow: string | undefined | PrivateRowDT, expand?: boolean | null, data?: {
354
- col?: StkTableColumn<PrivateRowDT>;
355
- silent?: boolean;
356
- }) => void;
357
- /**
358
- * 不定行高时,如果行高有变化,则调用此方法更新行高。
359
- *
360
- * en: When the row height is not fixed, call this method to update the row height if the row height changes.
361
- * @see {@link setAutoHeight}
362
- */
363
- setAutoHeight: (rowKey: UniqKey, height?: number | null) => void;
364
- /**
365
- * 清除所有行高
366
- *
367
- * en: Clear all row heights
368
- * @see {@link clearAllAutoHeight}
369
- */
370
- clearAllAutoHeight: () => void;
371
- /**
372
- * 设置树节点展开状态
373
- *
374
- * en: Set tree node expand state
375
- * @see {@link setTreeExpand}
376
- */
377
- setTreeExpand: (row: (UniqKey | (PrivateRowDT & {
378
- children?: (PrivateRowDT & /*elided*/ any)[];
379
- })) | (UniqKey | (PrivateRowDT & {
380
- children?: (PrivateRowDT & /*elided*/ any)[];
381
- }))[], option?: {
382
- expand?: boolean;
383
- }) => void;
384
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
385
- "sort-change": (col: StkTableColumn<any> | null, order: Order, data: any[], sortConfig: SortConfig<any>) => void;
386
- "row-click": (ev: MouseEvent, row: any, data: {
387
- rowIndex: number;
388
- }) => void;
389
- "current-change": (ev: MouseEvent | null, row: any, data: {
390
- select: boolean;
391
- }) => void;
392
- "cell-selected": (ev: MouseEvent | null, data: {
393
- select: boolean;
394
- row: DT | undefined;
395
- col: StkTableColumn<DT> | undefined;
396
- }) => void;
397
- "row-dblclick": (ev: MouseEvent, row: any, data: {
398
- rowIndex: number;
399
- }) => void;
400
- "header-row-menu": (ev: MouseEvent) => void;
401
- "row-menu": (ev: MouseEvent, row: any, data: {
402
- rowIndex: number;
403
- }) => void;
404
- "cell-click": (ev: MouseEvent, row: any, col: StkTableColumn<any>, data: {
405
- rowIndex: number;
406
- }) => void;
407
- "cell-mouseenter": (ev: MouseEvent, row: any, col: StkTableColumn<any>) => void;
408
- "cell-mouseleave": (ev: MouseEvent, row: any, col: StkTableColumn<any>) => void;
409
- "cell-mouseover": (ev: MouseEvent, row: any, col: StkTableColumn<any>) => void;
410
- "cell-mousedown": (ev: MouseEvent, row: any, col: StkTableColumn<any>, data: {
411
- rowIndex: number;
412
- }) => void;
413
- "header-cell-click": (ev: MouseEvent, col: StkTableColumn<any>) => void;
414
- scroll: (ev: Event, data: {
415
- startIndex: number;
416
- endIndex: number;
417
- }) => void;
418
- "scroll-x": (ev: Event) => void;
419
- "col-order-change": (dragStartKey: string, targetColKey: string) => void;
420
- "th-drag-start": (dragStartKey: string) => void;
421
- "th-drop": (targetColKey: string) => void;
422
- "row-order-change": (dragStartKey: string, targetRowKey: string) => void;
423
- "col-resize": (col: StkTableColumn<any>) => void;
424
- "toggle-row-expand": (data: {
425
- expanded: boolean;
426
- row: DT;
427
- col: StkTableColumn<DT> | null;
428
- }) => void;
429
- "toggle-tree-expand": (data: {
430
- expanded: boolean;
431
- row: DT;
432
- col: StkTableColumn<DT> | null;
433
- }) => void;
434
- "update:columns": (cols: StkTableColumn<any>[]) => void;
435
- }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
436
- width?: string;
437
- /** 最小表格宽度 */
438
- minWidth?: string;
439
- /** 表格最大宽度*/
440
- maxWidth?: string;
441
- /** 斑马线条纹 */
442
- stripe?: boolean;
443
- /** 是否使用 table-layout:fixed(低版本浏览器需要设置table) */
444
- fixedMode?: boolean;
445
- /** 是否隐藏表头 */
446
- headless?: boolean;
447
- /** 主题,亮、暗 */
448
- theme?: "light" | "dark";
449
- /**
450
- * 行高
451
- * - `props.autoRowHeight` 为 `true` 时,将表示为期望行高,用于计算。不再影响实际行高。
452
- */
453
- rowHeight?: number;
454
- /**
455
- * 是否可变行高
456
- * - 设置为 `true` 时, `props.rowHeight` 将表示为期望行高,用于计算。不再影响实际行高。
457
- */
458
- autoRowHeight?: boolean | AutoRowHeightConfig<DT>;
459
- /** 是否高亮鼠标悬浮的行 */
460
- rowHover?: boolean;
461
- /** 是否高亮选中的行 */
462
- rowActive?: boolean;
463
- /** 当前行再次点击否可以取消 (rowActive=true)*/
464
- rowCurrentRevokable?: boolean;
465
- /** 表头行高。default = rowHeight */
466
- headerRowHeight?: number | string | null;
467
- /** 虚拟滚动 */
468
- virtual?: boolean;
469
- /** x轴虚拟滚动(必须设置列宽)*/
470
- virtualX?: boolean;
471
- /** 表格列配置 */
472
- columns?: StkTableColumn<DT>[];
473
- /** 表格数据源 */
474
- dataSource?: DT[];
475
- /** 行唯一键 (行唯一值不能为undefined) */
476
- rowKey?: UniqKeyProp;
477
- /** 列唯一键 */
478
- colKey?: UniqKeyProp;
479
- /** 空值展示文字 */
480
- emptyCellText?: string | ((option: {
481
- row: DT;
482
- col: StkTableColumn<DT>;
483
- }) => string);
484
- /** 暂无数据兜底高度是否撑满 */
485
- noDataFull?: boolean;
486
- /** 是否展示暂无数据 */
487
- showNoData?: boolean;
488
- /** 是否服务端排序,true则不排序数据 */
489
- sortRemote?: boolean;
490
- /** 表头是否溢出展示... */
491
- showHeaderOverflow?: boolean;
492
- /** 表体溢出是否展示... */
493
- showOverflow?: boolean;
494
- /** 是否增加行hover class $*$ rename*/
495
- showTrHoverClass?: boolean;
496
- /** 是否高亮鼠标悬浮的单元格 */
497
- cellHover?: boolean;
498
- /** 是否高亮选中的单元格 */
499
- cellActive?: boolean;
500
- /** 单元格再次点击否可以取消选中 (cellActive=true)*/
501
- selectedCellRevokable?: boolean;
502
- /** 表头是否可拖动。支持回调函数。 */
503
- headerDrag?: boolean | HeaderDragConfig;
504
- /**
505
- * 给行附加className<br>
506
- * FIXME: 是否需要优化,因为不传此prop会使表格行一直执行空函数,是否有影响
507
- */
508
- rowClassName?: (row: DT, i: number) => string | undefined;
509
- /**
510
- * 列宽是否可拖动(需要设置v-model:columns)<br>
511
- * **不要设置**列minWidth,**必须**设置width<br>
512
- * 列宽拖动时,每一列都必须要有width,且minWidth/maxWidth不生效。table width会变为"fit-content"。
513
- * - 会自动更新props.columns中的with属性
514
- */
515
- colResizable?: boolean | ColResizableConfig<DT>;
516
- /** 可拖动至最小的列宽 */
517
- colMinWidth?: number;
518
- /**
519
- * 单元格分割线。
520
- * 默认横竖都有
521
- * "h" - 仅展示横线
522
- * "v" - 仅展示竖线
523
- * "body-v" - 仅表体展示竖线
524
- */
525
- bordered?: boolean | "h" | "v" | "body-v";
526
- /**
527
- * 自动重新计算虚拟滚动高度宽度。默认true
528
- * [非响应式]
529
- * 传入方法表示resize后的回调
530
- */
531
- autoResize?: boolean | (() => void);
532
- /** 是否展示固定列阴影。为节省性能,默认false。 */
533
- fixedColShadow?: boolean;
534
- /** 优化vue2 滚动 */
535
- optimizeVue2Scroll?: boolean;
536
- /** 排序配置 */
537
- sortConfig?: SortConfig<DT>;
538
- /** 隐藏头部title。可传入colKey数组 */
539
- hideHeaderTitle?: boolean | string[];
540
- /** 高亮配置 */
541
- highlightConfig?: HighlightConfig;
542
- /** 序号列配置 */
543
- seqConfig?: SeqConfig;
544
- /** 展开行配置 */
545
- expandConfig?: ExpandConfig;
546
- /** 行拖动配置 */
547
- dragRowConfig?: DragRowConfig;
548
- /** 树形配置 */
549
- treeConfig?: TreeConfig;
550
- /**
551
- * 固定头,固定列实现方式。(非响应式)
552
- *
553
- * relative:固定列只会放在props.columns的两侧。
554
- * - 如果列宽会变动则谨慎使用。
555
- * - 多级表头固定列慎用
556
- *
557
- * 低版本浏览器强制为'relative',
558
- */
559
- cellFixedMode?: "sticky" | "relative";
560
- /**
561
- * 是否平滑滚动。default: chrome < 85 || chrome > 120 ? true : false
562
- * - false: 使用 onwheel 滚动。为了防止滚动过快导致白屏。
563
- * - true: 不使用 onwheel 滚动。鼠标滚轮滚动时更加平滑。滚动过快时会白屏。
564
- */
565
- smoothScroll?: boolean;
566
- /**
567
- * 按整数行纵向滚动
568
- * - scrollbar:仅拖动滚动条生效
569
- */
570
- scrollRowByRow?: boolean | "scrollbar";
571
- }>, {
572
- width: string;
573
- fixedMode: boolean;
574
- stripe: boolean;
575
- minWidth: string;
576
- maxWidth: string;
577
- headless: boolean;
578
- theme: string;
579
- rowHeight: number;
580
- autoRowHeight: boolean;
581
- rowHover: boolean;
582
- rowActive: boolean;
583
- rowCurrentRevokable: boolean;
584
- headerRowHeight: number;
585
- virtual: boolean;
586
- virtualX: boolean;
587
- columns: () => never[];
588
- dataSource: () => never[];
589
- rowKey: string;
590
- colKey: undefined;
591
- emptyCellText: string;
592
- noDataFull: boolean;
593
- showNoData: boolean;
594
- sortRemote: boolean;
595
- showHeaderOverflow: boolean;
596
- showOverflow: boolean;
597
- showTrHoverClass: boolean;
598
- cellHover: boolean;
599
- cellActive: boolean;
600
- selectedCellRevokable: boolean;
601
- headerDrag: boolean;
602
- rowClassName: () => "";
603
- colResizable: boolean;
604
- colMinWidth: number;
605
- bordered: boolean;
606
- autoResize: boolean;
607
- fixedColShadow: boolean;
608
- optimizeVue2Scroll: boolean;
609
- sortConfig: () => {
610
- emptyToBottom: false;
611
- stringLocaleCompare: false;
612
- sortChildren: false;
613
- };
614
- hideHeaderTitle: boolean;
615
- highlightConfig: () => {};
616
- seqConfig: () => {};
617
- expandConfig: () => {};
618
- dragRowConfig: () => {};
619
- treeConfig: () => {};
620
- cellFixedMode: string;
621
- smoothScroll: boolean;
622
- scrollRowByRow: boolean;
623
- }>>> & Readonly<{
624
- onScroll?: ((ev: Event, data: {
625
- startIndex: number;
626
- endIndex: number;
627
- }) => any) | undefined;
628
- "onUpdate:columns"?: ((cols: StkTableColumn<any>[]) => any) | undefined;
629
- "onCol-resize"?: ((col: StkTableColumn<any>) => any) | undefined;
630
- "onToggle-row-expand"?: ((data: {
631
- expanded: boolean;
632
- row: DT;
633
- col: StkTableColumn<DT> | null;
634
- }) => any) | undefined;
635
- "onTh-drag-start"?: ((dragStartKey: string) => any) | undefined;
636
- "onTh-drop"?: ((targetColKey: string) => any) | undefined;
637
- "onCol-order-change"?: ((dragStartKey: string, targetColKey: string) => any) | undefined;
638
- "onRow-order-change"?: ((dragStartKey: string, targetRowKey: string) => any) | undefined;
639
- "onToggle-tree-expand"?: ((data: {
640
- expanded: boolean;
641
- row: DT;
642
- col: StkTableColumn<DT> | null;
643
- }) => any) | undefined;
644
- "onSort-change"?: ((col: StkTableColumn<any> | null, order: Order, data: any[], sortConfig: SortConfig<any>) => any) | undefined;
645
- "onRow-click"?: ((ev: MouseEvent, row: any, data: {
646
- rowIndex: number;
647
- }) => any) | undefined;
648
- "onCurrent-change"?: ((ev: MouseEvent | null, row: any, data: {
649
- select: boolean;
650
- }) => any) | undefined;
651
- "onCell-selected"?: ((ev: MouseEvent | null, data: {
652
- select: boolean;
653
- row: DT | undefined;
654
- col: StkTableColumn<DT> | undefined;
655
- }) => any) | undefined;
656
- "onRow-dblclick"?: ((ev: MouseEvent, row: any, data: {
657
- rowIndex: number;
658
- }) => any) | undefined;
659
- "onHeader-row-menu"?: ((ev: MouseEvent) => any) | undefined;
660
- "onRow-menu"?: ((ev: MouseEvent, row: any, data: {
661
- rowIndex: number;
662
- }) => any) | undefined;
663
- "onCell-click"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>, data: {
664
- rowIndex: number;
665
- }) => any) | undefined;
666
- "onCell-mouseenter"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>) => any) | undefined;
667
- "onCell-mouseleave"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>) => any) | undefined;
668
- "onCell-mouseover"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>) => any) | undefined;
669
- "onCell-mousedown"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>, data: {
670
- rowIndex: number;
671
- }) => any) | undefined;
672
- "onHeader-cell-click"?: ((ev: MouseEvent, col: StkTableColumn<any>) => any) | undefined;
673
- "onScroll-x"?: ((ev: Event) => any) | undefined;
674
- }>, {
675
- width: string;
676
- minWidth: string;
677
- maxWidth: string;
678
- sortConfig: SortConfig<DT>;
679
- rowHeight: number;
680
- headless: boolean;
681
- autoRowHeight: boolean | AutoRowHeightConfig<DT>;
682
- stripe: boolean;
683
- optimizeVue2Scroll: boolean;
684
- rowKey: UniqKeyProp;
685
- headerRowHeight: number | string | null;
686
- colKey: UniqKeyProp;
687
- fixedMode: boolean;
688
- theme: "light" | "dark";
689
- rowHover: boolean;
690
- rowActive: boolean;
691
- rowCurrentRevokable: boolean;
692
- virtual: boolean;
693
- virtualX: boolean;
694
- columns: StkTableColumn<DT>[];
695
- dataSource: DT[];
696
- emptyCellText: string | ((option: {
697
- row: DT;
698
- col: StkTableColumn<DT>;
699
- }) => string);
700
- noDataFull: boolean;
701
- showNoData: boolean;
702
- sortRemote: boolean;
703
- showHeaderOverflow: boolean;
704
- showOverflow: boolean;
705
- showTrHoverClass: boolean;
706
- cellHover: boolean;
707
- cellActive: boolean;
708
- selectedCellRevokable: boolean;
709
- headerDrag: boolean | HeaderDragConfig;
710
- rowClassName: (row: DT, i: number) => string | undefined;
711
- colResizable: boolean | ColResizableConfig<DT>;
712
- colMinWidth: number;
713
- bordered: boolean | "h" | "v" | "body-v";
714
- autoResize: boolean | (() => void);
715
- fixedColShadow: boolean;
716
- hideHeaderTitle: boolean | string[];
717
- highlightConfig: HighlightConfig;
718
- seqConfig: SeqConfig;
719
- expandConfig: ExpandConfig;
720
- dragRowConfig: DragRowConfig;
721
- treeConfig: TreeConfig;
722
- cellFixedMode: "sticky" | "relative";
723
- smoothScroll: boolean;
724
- scrollRowByRow: boolean | "scrollbar";
725
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
726
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
727
- export default _default;
728
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
729
- type __VLS_TypePropsToRuntimeProps<T> = {
730
- [K in keyof T]-?: {} extends Pick<T, K> ? {
731
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
732
- } : {
733
- type: import('vue').PropType<T[K]>;
734
- required: true;
735
- };
736
- };
737
- type __VLS_WithDefaults<P, D> = {
738
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
739
- default: D[K];
740
- }> : P[K];
741
- };
742
- type __VLS_Prettify<T> = {
743
- [K in keyof T]: T[K];
744
- } & {};
745
- type __VLS_WithTemplateSlots<T, S> = T & {
746
- new (): {
747
- $slots: S;
748
- };
749
- };
1
+ import { AutoRowHeightConfig, ColResizableConfig, DragRowConfig, ExpandConfig, HeaderDragConfig, HighlightConfig, Order, PrivateRowDT, PrivateStkTableColumn, RowActiveOption, SeqConfig, SortConfig, SortOption, StkTableColumn, TreeConfig, UniqKey, UniqKeyProp } from './types/index';
2
+
3
+ /** Generic stands for DataType */
4
+ type DT = any & PrivateRowDT;
5
+ /**
6
+ * 选中一行
7
+ * @param {string} rowKeyOrRow selected rowKey, undefined to unselect
8
+ * @param {boolean} option.silent if set true not emit `current-change`. default:false
9
+ * @param {boolean} option.deep if set true, deep search in children. default:false
10
+ */
11
+ declare function setCurrentRow(rowKeyOrRow: string | undefined | DT, option?: {
12
+ silent?: boolean;
13
+ deep?: boolean;
14
+ }): void;
15
+ /**
16
+ * set highlight active cell (props.cellActive=true)
17
+ * @param row row if undefined, clear highlight
18
+ * @param col column
19
+ * @param option.silent if emit current-change. default:false(not emit `current-change`)
20
+ */
21
+ declare function setSelectedCell(row?: DT, col?: StkTableColumn<DT>, option?: {
22
+ silent: boolean;
23
+ }): void;
24
+ /**
25
+ * 设置表头排序状态。
26
+ * @param colKey 列唯一键字段。如果你想要取消排序状态,请使用`resetSorter`
27
+ * @param order 正序倒序
28
+ * @param option.sortOption 指定排序参数。同 StkTableColumn 中排序相关字段。建议从columns中find得到。
29
+ * @param option.sort 是否触发排序-默认true
30
+ * @param option.silent 是否禁止触发回调-默认true
31
+ * @param option.force 是否触发排序-默认true
32
+ * @return 表格数据
33
+ */
34
+ declare function setSorter(colKey: string, order: Order, option?: {
35
+ sortOption?: SortOption<DT>;
36
+ force?: boolean;
37
+ silent?: boolean;
38
+ sort?: boolean;
39
+ }): any[];
40
+ declare function resetSorter(): void;
41
+ /**
42
+ * set scroll bar position
43
+ * @param top null to not change
44
+ * @param left null to not change
45
+ */
46
+ declare function scrollTo(top?: number | null, left?: number | null): void;
47
+ /** get current table data */
48
+ declare function getTableData(): any[];
49
+ /**
50
+ * get current sort info
51
+ * @return {{key:string,order:Order}[]}
52
+ */
53
+ declare function getSortColumns(): {
54
+ key: string | number | symbol | undefined;
55
+ order: "desc" | "asc";
56
+ }[];
57
+ declare function __VLS_template(): {
58
+ tableHeader?(_: {
59
+ col: PrivateStkTableColumn<any>;
60
+ }): any;
61
+ expand?(_: {
62
+ row: any;
63
+ col: any;
64
+ }): any;
65
+ empty?(_: {}): any;
66
+ customBottom?(_: {}): any;
67
+ };
68
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
69
+ width?: string;
70
+ /** 最小表格宽度 */
71
+ minWidth?: string;
72
+ /** 表格最大宽度*/
73
+ maxWidth?: string;
74
+ /** 斑马线条纹 */
75
+ stripe?: boolean;
76
+ /** 是否使用 table-layout:fixed(低版本浏览器需要设置table) */
77
+ fixedMode?: boolean;
78
+ /** 是否隐藏表头 */
79
+ headless?: boolean;
80
+ /** 主题,亮、暗 */
81
+ theme?: "light" | "dark";
82
+ /**
83
+ * 行高
84
+ * - `props.autoRowHeight` 为 `true` 时,将表示为期望行高,用于计算。不再影响实际行高。
85
+ */
86
+ rowHeight?: number;
87
+ /**
88
+ * 是否可变行高
89
+ * - 设置为 `true` 时, `props.rowHeight` 将表示为期望行高,用于计算。不再影响实际行高。
90
+ */
91
+ autoRowHeight?: boolean | AutoRowHeightConfig<DT>;
92
+ /** 是否高亮鼠标悬浮的行 */
93
+ rowHover?: boolean;
94
+ /** 是否高亮选中的行 */
95
+ rowActive?: boolean | RowActiveOption<DT>;
96
+ /**
97
+ * @deprecated
98
+ */
99
+ rowCurrentRevokable?: boolean;
100
+ /** 表头行高。default = rowHeight */
101
+ headerRowHeight?: number | string | null;
102
+ /** 虚拟滚动 */
103
+ virtual?: boolean;
104
+ /** x轴虚拟滚动(必须设置列宽)*/
105
+ virtualX?: boolean;
106
+ /** 表格列配置 */
107
+ columns?: StkTableColumn<DT>[];
108
+ /** 表格数据源 */
109
+ dataSource?: DT[];
110
+ /** 行唯一键 (行唯一值不能为undefined) */
111
+ rowKey?: UniqKeyProp;
112
+ /** 列唯一键 */
113
+ colKey?: UniqKeyProp;
114
+ /** 空值展示文字 */
115
+ emptyCellText?: string | ((option: {
116
+ row: DT;
117
+ col: StkTableColumn<DT>;
118
+ }) => string);
119
+ /** 暂无数据兜底高度是否撑满 */
120
+ noDataFull?: boolean;
121
+ /** 是否展示暂无数据 */
122
+ showNoData?: boolean;
123
+ /** 是否服务端排序,true则不排序数据 */
124
+ sortRemote?: boolean;
125
+ /** 表头是否溢出展示... */
126
+ showHeaderOverflow?: boolean;
127
+ /** 表体溢出是否展示... */
128
+ showOverflow?: boolean;
129
+ /** 是否增加行hover class $*$ rename*/
130
+ showTrHoverClass?: boolean;
131
+ /** 是否高亮鼠标悬浮的单元格 */
132
+ cellHover?: boolean;
133
+ /** 是否高亮选中的单元格 */
134
+ cellActive?: boolean;
135
+ /** 单元格再次点击否可以取消选中 (cellActive=true)*/
136
+ selectedCellRevokable?: boolean;
137
+ /** 表头是否可拖动。支持回调函数。 */
138
+ headerDrag?: boolean | HeaderDragConfig;
139
+ /**
140
+ * 给行附加className<br>
141
+ * FIXME: 是否需要优化,因为不传此prop会使表格行一直执行空函数,是否有影响
142
+ */
143
+ rowClassName?: (row: DT, i: number) => string | undefined;
144
+ /**
145
+ * 列宽是否可拖动(需要设置v-model:columns)<br>
146
+ * **不要设置**列minWidth,**必须**设置width<br>
147
+ * 列宽拖动时,每一列都必须要有width,且minWidth/maxWidth不生效。table width会变为"fit-content"。
148
+ * - 会自动更新props.columns中的with属性
149
+ */
150
+ colResizable?: boolean | ColResizableConfig<DT>;
151
+ /** 可拖动至最小的列宽 */
152
+ colMinWidth?: number;
153
+ /**
154
+ * 单元格分割线。
155
+ * 默认横竖都有
156
+ * "h" - 仅展示横线
157
+ * "v" - 仅展示竖线
158
+ * "body-v" - 仅表体展示竖线
159
+ */
160
+ bordered?: boolean | "h" | "v" | "body-v";
161
+ /**
162
+ * 自动重新计算虚拟滚动高度宽度。默认true
163
+ * [非响应式]
164
+ * 传入方法表示resize后的回调
165
+ */
166
+ autoResize?: boolean | (() => void);
167
+ /** 是否展示固定列阴影。为节省性能,默认false。 */
168
+ fixedColShadow?: boolean;
169
+ /** 优化vue2 滚动 */
170
+ optimizeVue2Scroll?: boolean;
171
+ /** 排序配置 */
172
+ sortConfig?: SortConfig<DT>;
173
+ /** 隐藏头部title。可传入colKey数组 */
174
+ hideHeaderTitle?: boolean | string[];
175
+ /** 高亮配置 */
176
+ highlightConfig?: HighlightConfig;
177
+ /** 序号列配置 */
178
+ seqConfig?: SeqConfig;
179
+ /** 展开行配置 */
180
+ expandConfig?: ExpandConfig;
181
+ /** 行拖动配置 */
182
+ dragRowConfig?: DragRowConfig;
183
+ /** 树形配置 */
184
+ treeConfig?: TreeConfig;
185
+ /**
186
+ * 固定头,固定列实现方式。(非响应式)
187
+ *
188
+ * relative:固定列只会放在props.columns的两侧。
189
+ * - 如果列宽会变动则谨慎使用。
190
+ * - 多级表头固定列慎用
191
+ *
192
+ * 低版本浏览器强制为'relative',
193
+ */
194
+ cellFixedMode?: "sticky" | "relative";
195
+ /**
196
+ * 是否平滑滚动。default: chrome < 85 || chrome > 120 ? true : false
197
+ * - false: 使用 onwheel 滚动。为了防止滚动过快导致白屏。
198
+ * - true: 不使用 onwheel 滚动。鼠标滚轮滚动时更加平滑。滚动过快时会白屏。
199
+ */
200
+ smoothScroll?: boolean;
201
+ /**
202
+ * 按整数行纵向滚动
203
+ * - scrollbar:仅拖动滚动条生效
204
+ */
205
+ scrollRowByRow?: boolean | "scrollbar";
206
+ }>, {
207
+ width: string;
208
+ fixedMode: boolean;
209
+ stripe: boolean;
210
+ minWidth: string;
211
+ maxWidth: string;
212
+ headless: boolean;
213
+ theme: string;
214
+ rowHeight: number;
215
+ autoRowHeight: boolean;
216
+ rowHover: boolean;
217
+ rowActive: boolean;
218
+ rowCurrentRevokable: boolean;
219
+ headerRowHeight: number;
220
+ virtual: boolean;
221
+ virtualX: boolean;
222
+ columns: () => never[];
223
+ dataSource: () => never[];
224
+ rowKey: string;
225
+ colKey: undefined;
226
+ emptyCellText: string;
227
+ noDataFull: boolean;
228
+ showNoData: boolean;
229
+ sortRemote: boolean;
230
+ showHeaderOverflow: boolean;
231
+ showOverflow: boolean;
232
+ showTrHoverClass: boolean;
233
+ cellHover: boolean;
234
+ cellActive: boolean;
235
+ selectedCellRevokable: boolean;
236
+ headerDrag: boolean;
237
+ rowClassName: () => "";
238
+ colResizable: boolean;
239
+ colMinWidth: number;
240
+ bordered: boolean;
241
+ autoResize: boolean;
242
+ fixedColShadow: boolean;
243
+ optimizeVue2Scroll: boolean;
244
+ sortConfig: () => {
245
+ emptyToBottom: false;
246
+ stringLocaleCompare: false;
247
+ sortChildren: false;
248
+ };
249
+ hideHeaderTitle: boolean;
250
+ highlightConfig: () => {};
251
+ seqConfig: () => {};
252
+ expandConfig: () => {};
253
+ dragRowConfig: () => {};
254
+ treeConfig: () => {};
255
+ cellFixedMode: string;
256
+ smoothScroll: boolean;
257
+ scrollRowByRow: boolean;
258
+ }>>, {
259
+ /**
260
+ * 重新计算虚拟列表宽高
261
+ *
262
+ * en: calc virtual scroll x & y info
263
+ * @see {@link initVirtualScroll}
264
+ */
265
+ initVirtualScroll: (height?: number) => void;
266
+ /**
267
+ * 重新计算虚拟列表宽度
268
+ *
269
+ * en: calc virtual scroll x
270
+ * @see {@link initVirtualScrollX}
271
+ */
272
+ initVirtualScrollX: () => void;
273
+ /**
274
+ * 重新计算虚拟列表高度
275
+ *
276
+ * en: calc virtual scroll y
277
+ * @see {@link initVirtualScrollY}
278
+ */
279
+ initVirtualScrollY: (height?: number) => void;
280
+ /**
281
+ * 选中一行
282
+ *
283
+ * en:select a row
284
+ * @see {@link setCurrentRow}
285
+ */
286
+ setCurrentRow: typeof setCurrentRow;
287
+ /**
288
+ * 取消选中单元格
289
+ *
290
+ * en: set highlight active cell (props.cellActive=true)
291
+ * @see {@link setSelectedCell}
292
+ */
293
+ setSelectedCell: typeof setSelectedCell;
294
+ /**
295
+ * 设置高亮单元格
296
+ *
297
+ * en: Set highlight cell
298
+ * @see {@link setHighlightDimCell}
299
+ */
300
+ setHighlightDimCell: (rowKeyValue: UniqKey, colKeyValue: string, option?: import('./types/highlightDimOptions').HighlightDimCellOption) => void;
301
+ /**
302
+ * 设置高亮行
303
+ *
304
+ * en: Set highlight row
305
+ * @see {@link setHighlightDimRow}
306
+ */
307
+ setHighlightDimRow: (rowKeyValues: UniqKey[], option?: import('./types/highlightDimOptions').HighlightDimRowOption) => void;
308
+ /**
309
+ * 表格排序列colKey
310
+ *
311
+ * en: Table sort column colKey
312
+ */
313
+ sortCol: import('vue').Ref<string | number | symbol | undefined, string | number | symbol | undefined>;
314
+ /**
315
+ * 表格排序列顺序
316
+ *
317
+ * en: get current sort info
318
+ * @see {@link getSortColumns}
319
+ */
320
+ getSortColumns: typeof getSortColumns;
321
+ /**
322
+ * 设置表头排序状态
323
+ *
324
+ * en: Set the sort status of the table header
325
+ * @see {@link setSorter}
326
+ */
327
+ setSorter: typeof setSorter;
328
+ /**
329
+ * 重置sorter状态
330
+ *
331
+ * en: Reset the sorter status
332
+ * @see {@link resetSorter}
333
+ */
334
+ resetSorter: typeof resetSorter;
335
+ /**
336
+ * 滚动至
337
+ *
338
+ * en: Scroll to
339
+ * @see {@link scrollTo}
340
+ */
341
+ scrollTo: typeof scrollTo;
342
+ /**
343
+ * 获取表格数据
344
+ *
345
+ * en: Get table data
346
+ * @see {@link getTableData}
347
+ */
348
+ getTableData: typeof getTableData;
349
+ /**
350
+ * 设置展开的行
351
+ *
352
+ * en: Set expanded rows
353
+ * @see {@link setRowExpand}
354
+ */
355
+ setRowExpand: (rowKeyOrRow: string | undefined | PrivateRowDT, expand?: boolean | null, data?: {
356
+ col?: StkTableColumn<PrivateRowDT>;
357
+ silent?: boolean;
358
+ }) => void;
359
+ /**
360
+ * 不定行高时,如果行高有变化,则调用此方法更新行高。
361
+ *
362
+ * en: When the row height is not fixed, call this method to update the row height if the row height changes.
363
+ * @see {@link setAutoHeight}
364
+ */
365
+ setAutoHeight: (rowKey: UniqKey, height?: number | null) => void;
366
+ /**
367
+ * 清除所有行高
368
+ *
369
+ * en: Clear all row heights
370
+ * @see {@link clearAllAutoHeight}
371
+ */
372
+ clearAllAutoHeight: () => void;
373
+ /**
374
+ * 设置树节点展开状态
375
+ *
376
+ * en: Set tree node expand state
377
+ * @see {@link setTreeExpand}
378
+ */
379
+ setTreeExpand: (row: (UniqKey | (PrivateRowDT & {
380
+ children?: (PrivateRowDT & /*elided*/ any)[];
381
+ })) | (UniqKey | (PrivateRowDT & {
382
+ children?: (PrivateRowDT & /*elided*/ any)[];
383
+ }))[], option?: {
384
+ expand?: boolean;
385
+ }) => void;
386
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
387
+ "sort-change": (col: StkTableColumn<any> | null, order: Order, data: any[], sortConfig: SortConfig<any>) => void;
388
+ "row-click": (ev: MouseEvent, row: any, data: {
389
+ rowIndex: number;
390
+ }) => void;
391
+ "current-change": (ev: MouseEvent | null, row: any, data: {
392
+ select: boolean;
393
+ }) => void;
394
+ "cell-selected": (ev: MouseEvent | null, data: {
395
+ select: boolean;
396
+ row: DT | undefined;
397
+ col: StkTableColumn<DT> | undefined;
398
+ }) => void;
399
+ "row-dblclick": (ev: MouseEvent, row: any, data: {
400
+ rowIndex: number;
401
+ }) => void;
402
+ "header-row-menu": (ev: MouseEvent) => void;
403
+ "row-menu": (ev: MouseEvent, row: any, data: {
404
+ rowIndex: number;
405
+ }) => void;
406
+ "cell-click": (ev: MouseEvent, row: any, col: StkTableColumn<any>, data: {
407
+ rowIndex: number;
408
+ }) => void;
409
+ "cell-mouseenter": (ev: MouseEvent, row: any, col: StkTableColumn<any>) => void;
410
+ "cell-mouseleave": (ev: MouseEvent, row: any, col: StkTableColumn<any>) => void;
411
+ "cell-mouseover": (ev: MouseEvent, row: any, col: StkTableColumn<any>) => void;
412
+ "cell-mousedown": (ev: MouseEvent, row: any, col: StkTableColumn<any>, data: {
413
+ rowIndex: number;
414
+ }) => void;
415
+ "header-cell-click": (ev: MouseEvent, col: StkTableColumn<any>) => void;
416
+ scroll: (ev: Event, data: {
417
+ startIndex: number;
418
+ endIndex: number;
419
+ }) => void;
420
+ "scroll-x": (ev: Event) => void;
421
+ "col-order-change": (dragStartKey: string, targetColKey: string) => void;
422
+ "th-drag-start": (dragStartKey: string) => void;
423
+ "th-drop": (targetColKey: string) => void;
424
+ "row-order-change": (dragStartKey: string, targetRowKey: string) => void;
425
+ "col-resize": (col: StkTableColumn<any>) => void;
426
+ "toggle-row-expand": (data: {
427
+ expanded: boolean;
428
+ row: DT;
429
+ col: StkTableColumn<DT> | null;
430
+ }) => void;
431
+ "toggle-tree-expand": (data: {
432
+ expanded: boolean;
433
+ row: DT;
434
+ col: StkTableColumn<DT> | null;
435
+ }) => void;
436
+ "update:columns": (cols: StkTableColumn<any>[]) => void;
437
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
438
+ width?: string;
439
+ /** 最小表格宽度 */
440
+ minWidth?: string;
441
+ /** 表格最大宽度*/
442
+ maxWidth?: string;
443
+ /** 斑马线条纹 */
444
+ stripe?: boolean;
445
+ /** 是否使用 table-layout:fixed(低版本浏览器需要设置table) */
446
+ fixedMode?: boolean;
447
+ /** 是否隐藏表头 */
448
+ headless?: boolean;
449
+ /** 主题,亮、暗 */
450
+ theme?: "light" | "dark";
451
+ /**
452
+ * 行高
453
+ * - `props.autoRowHeight` 为 `true` 时,将表示为期望行高,用于计算。不再影响实际行高。
454
+ */
455
+ rowHeight?: number;
456
+ /**
457
+ * 是否可变行高
458
+ * - 设置为 `true` 时, `props.rowHeight` 将表示为期望行高,用于计算。不再影响实际行高。
459
+ */
460
+ autoRowHeight?: boolean | AutoRowHeightConfig<DT>;
461
+ /** 是否高亮鼠标悬浮的行 */
462
+ rowHover?: boolean;
463
+ /** 是否高亮选中的行 */
464
+ rowActive?: boolean | RowActiveOption<DT>;
465
+ /**
466
+ * @deprecated
467
+ */
468
+ rowCurrentRevokable?: boolean;
469
+ /** 表头行高。default = rowHeight */
470
+ headerRowHeight?: number | string | null;
471
+ /** 虚拟滚动 */
472
+ virtual?: boolean;
473
+ /** x轴虚拟滚动(必须设置列宽)*/
474
+ virtualX?: boolean;
475
+ /** 表格列配置 */
476
+ columns?: StkTableColumn<DT>[];
477
+ /** 表格数据源 */
478
+ dataSource?: DT[];
479
+ /** 行唯一键 (行唯一值不能为undefined) */
480
+ rowKey?: UniqKeyProp;
481
+ /** 列唯一键 */
482
+ colKey?: UniqKeyProp;
483
+ /** 空值展示文字 */
484
+ emptyCellText?: string | ((option: {
485
+ row: DT;
486
+ col: StkTableColumn<DT>;
487
+ }) => string);
488
+ /** 暂无数据兜底高度是否撑满 */
489
+ noDataFull?: boolean;
490
+ /** 是否展示暂无数据 */
491
+ showNoData?: boolean;
492
+ /** 是否服务端排序,true则不排序数据 */
493
+ sortRemote?: boolean;
494
+ /** 表头是否溢出展示... */
495
+ showHeaderOverflow?: boolean;
496
+ /** 表体溢出是否展示... */
497
+ showOverflow?: boolean;
498
+ /** 是否增加行hover class $*$ rename*/
499
+ showTrHoverClass?: boolean;
500
+ /** 是否高亮鼠标悬浮的单元格 */
501
+ cellHover?: boolean;
502
+ /** 是否高亮选中的单元格 */
503
+ cellActive?: boolean;
504
+ /** 单元格再次点击否可以取消选中 (cellActive=true)*/
505
+ selectedCellRevokable?: boolean;
506
+ /** 表头是否可拖动。支持回调函数。 */
507
+ headerDrag?: boolean | HeaderDragConfig;
508
+ /**
509
+ * 给行附加className<br>
510
+ * FIXME: 是否需要优化,因为不传此prop会使表格行一直执行空函数,是否有影响
511
+ */
512
+ rowClassName?: (row: DT, i: number) => string | undefined;
513
+ /**
514
+ * 列宽是否可拖动(需要设置v-model:columns)<br>
515
+ * **不要设置**列minWidth,**必须**设置width<br>
516
+ * 列宽拖动时,每一列都必须要有width,且minWidth/maxWidth不生效。table width会变为"fit-content"。
517
+ * - 会自动更新props.columns中的with属性
518
+ */
519
+ colResizable?: boolean | ColResizableConfig<DT>;
520
+ /** 可拖动至最小的列宽 */
521
+ colMinWidth?: number;
522
+ /**
523
+ * 单元格分割线。
524
+ * 默认横竖都有
525
+ * "h" - 仅展示横线
526
+ * "v" - 仅展示竖线
527
+ * "body-v" - 仅表体展示竖线
528
+ */
529
+ bordered?: boolean | "h" | "v" | "body-v";
530
+ /**
531
+ * 自动重新计算虚拟滚动高度宽度。默认true
532
+ * [非响应式]
533
+ * 传入方法表示resize后的回调
534
+ */
535
+ autoResize?: boolean | (() => void);
536
+ /** 是否展示固定列阴影。为节省性能,默认false。 */
537
+ fixedColShadow?: boolean;
538
+ /** 优化vue2 滚动 */
539
+ optimizeVue2Scroll?: boolean;
540
+ /** 排序配置 */
541
+ sortConfig?: SortConfig<DT>;
542
+ /** 隐藏头部title。可传入colKey数组 */
543
+ hideHeaderTitle?: boolean | string[];
544
+ /** 高亮配置 */
545
+ highlightConfig?: HighlightConfig;
546
+ /** 序号列配置 */
547
+ seqConfig?: SeqConfig;
548
+ /** 展开行配置 */
549
+ expandConfig?: ExpandConfig;
550
+ /** 行拖动配置 */
551
+ dragRowConfig?: DragRowConfig;
552
+ /** 树形配置 */
553
+ treeConfig?: TreeConfig;
554
+ /**
555
+ * 固定头,固定列实现方式。(非响应式)
556
+ *
557
+ * relative:固定列只会放在props.columns的两侧。
558
+ * - 如果列宽会变动则谨慎使用。
559
+ * - 多级表头固定列慎用
560
+ *
561
+ * 低版本浏览器强制为'relative',
562
+ */
563
+ cellFixedMode?: "sticky" | "relative";
564
+ /**
565
+ * 是否平滑滚动。default: chrome < 85 || chrome > 120 ? true : false
566
+ * - false: 使用 onwheel 滚动。为了防止滚动过快导致白屏。
567
+ * - true: 不使用 onwheel 滚动。鼠标滚轮滚动时更加平滑。滚动过快时会白屏。
568
+ */
569
+ smoothScroll?: boolean;
570
+ /**
571
+ * 按整数行纵向滚动
572
+ * - scrollbar:仅拖动滚动条生效
573
+ */
574
+ scrollRowByRow?: boolean | "scrollbar";
575
+ }>, {
576
+ width: string;
577
+ fixedMode: boolean;
578
+ stripe: boolean;
579
+ minWidth: string;
580
+ maxWidth: string;
581
+ headless: boolean;
582
+ theme: string;
583
+ rowHeight: number;
584
+ autoRowHeight: boolean;
585
+ rowHover: boolean;
586
+ rowActive: boolean;
587
+ rowCurrentRevokable: boolean;
588
+ headerRowHeight: number;
589
+ virtual: boolean;
590
+ virtualX: boolean;
591
+ columns: () => never[];
592
+ dataSource: () => never[];
593
+ rowKey: string;
594
+ colKey: undefined;
595
+ emptyCellText: string;
596
+ noDataFull: boolean;
597
+ showNoData: boolean;
598
+ sortRemote: boolean;
599
+ showHeaderOverflow: boolean;
600
+ showOverflow: boolean;
601
+ showTrHoverClass: boolean;
602
+ cellHover: boolean;
603
+ cellActive: boolean;
604
+ selectedCellRevokable: boolean;
605
+ headerDrag: boolean;
606
+ rowClassName: () => "";
607
+ colResizable: boolean;
608
+ colMinWidth: number;
609
+ bordered: boolean;
610
+ autoResize: boolean;
611
+ fixedColShadow: boolean;
612
+ optimizeVue2Scroll: boolean;
613
+ sortConfig: () => {
614
+ emptyToBottom: false;
615
+ stringLocaleCompare: false;
616
+ sortChildren: false;
617
+ };
618
+ hideHeaderTitle: boolean;
619
+ highlightConfig: () => {};
620
+ seqConfig: () => {};
621
+ expandConfig: () => {};
622
+ dragRowConfig: () => {};
623
+ treeConfig: () => {};
624
+ cellFixedMode: string;
625
+ smoothScroll: boolean;
626
+ scrollRowByRow: boolean;
627
+ }>>> & Readonly<{
628
+ onScroll?: ((ev: Event, data: {
629
+ startIndex: number;
630
+ endIndex: number;
631
+ }) => any) | undefined;
632
+ "onUpdate:columns"?: ((cols: StkTableColumn<any>[]) => any) | undefined;
633
+ "onCol-resize"?: ((col: StkTableColumn<any>) => any) | undefined;
634
+ "onToggle-row-expand"?: ((data: {
635
+ expanded: boolean;
636
+ row: DT;
637
+ col: StkTableColumn<DT> | null;
638
+ }) => any) | undefined;
639
+ "onTh-drag-start"?: ((dragStartKey: string) => any) | undefined;
640
+ "onTh-drop"?: ((targetColKey: string) => any) | undefined;
641
+ "onCol-order-change"?: ((dragStartKey: string, targetColKey: string) => any) | undefined;
642
+ "onRow-order-change"?: ((dragStartKey: string, targetRowKey: string) => any) | undefined;
643
+ "onToggle-tree-expand"?: ((data: {
644
+ expanded: boolean;
645
+ row: DT;
646
+ col: StkTableColumn<DT> | null;
647
+ }) => any) | undefined;
648
+ "onSort-change"?: ((col: StkTableColumn<any> | null, order: Order, data: any[], sortConfig: SortConfig<any>) => any) | undefined;
649
+ "onRow-click"?: ((ev: MouseEvent, row: any, data: {
650
+ rowIndex: number;
651
+ }) => any) | undefined;
652
+ "onCurrent-change"?: ((ev: MouseEvent | null, row: any, data: {
653
+ select: boolean;
654
+ }) => any) | undefined;
655
+ "onCell-selected"?: ((ev: MouseEvent | null, data: {
656
+ select: boolean;
657
+ row: DT | undefined;
658
+ col: StkTableColumn<DT> | undefined;
659
+ }) => any) | undefined;
660
+ "onRow-dblclick"?: ((ev: MouseEvent, row: any, data: {
661
+ rowIndex: number;
662
+ }) => any) | undefined;
663
+ "onHeader-row-menu"?: ((ev: MouseEvent) => any) | undefined;
664
+ "onRow-menu"?: ((ev: MouseEvent, row: any, data: {
665
+ rowIndex: number;
666
+ }) => any) | undefined;
667
+ "onCell-click"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>, data: {
668
+ rowIndex: number;
669
+ }) => any) | undefined;
670
+ "onCell-mouseenter"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>) => any) | undefined;
671
+ "onCell-mouseleave"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>) => any) | undefined;
672
+ "onCell-mouseover"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>) => any) | undefined;
673
+ "onCell-mousedown"?: ((ev: MouseEvent, row: any, col: StkTableColumn<any>, data: {
674
+ rowIndex: number;
675
+ }) => any) | undefined;
676
+ "onHeader-cell-click"?: ((ev: MouseEvent, col: StkTableColumn<any>) => any) | undefined;
677
+ "onScroll-x"?: ((ev: Event) => any) | undefined;
678
+ }>, {
679
+ width: string;
680
+ minWidth: string;
681
+ maxWidth: string;
682
+ sortConfig: SortConfig<DT>;
683
+ rowHeight: number;
684
+ headless: boolean;
685
+ autoRowHeight: boolean | AutoRowHeightConfig<DT>;
686
+ stripe: boolean;
687
+ optimizeVue2Scroll: boolean;
688
+ rowKey: UniqKeyProp;
689
+ headerRowHeight: number | string | null;
690
+ colKey: UniqKeyProp;
691
+ fixedMode: boolean;
692
+ theme: "light" | "dark";
693
+ rowHover: boolean;
694
+ rowActive: boolean | RowActiveOption<DT>;
695
+ rowCurrentRevokable: boolean;
696
+ virtual: boolean;
697
+ virtualX: boolean;
698
+ columns: StkTableColumn<DT>[];
699
+ dataSource: DT[];
700
+ emptyCellText: string | ((option: {
701
+ row: DT;
702
+ col: StkTableColumn<DT>;
703
+ }) => string);
704
+ noDataFull: boolean;
705
+ showNoData: boolean;
706
+ sortRemote: boolean;
707
+ showHeaderOverflow: boolean;
708
+ showOverflow: boolean;
709
+ showTrHoverClass: boolean;
710
+ cellHover: boolean;
711
+ cellActive: boolean;
712
+ selectedCellRevokable: boolean;
713
+ headerDrag: boolean | HeaderDragConfig;
714
+ rowClassName: (row: DT, i: number) => string | undefined;
715
+ colResizable: boolean | ColResizableConfig<DT>;
716
+ colMinWidth: number;
717
+ bordered: boolean | "h" | "v" | "body-v";
718
+ autoResize: boolean | (() => void);
719
+ fixedColShadow: boolean;
720
+ hideHeaderTitle: boolean | string[];
721
+ highlightConfig: HighlightConfig;
722
+ seqConfig: SeqConfig;
723
+ expandConfig: ExpandConfig;
724
+ dragRowConfig: DragRowConfig;
725
+ treeConfig: TreeConfig;
726
+ cellFixedMode: "sticky" | "relative";
727
+ smoothScroll: boolean;
728
+ scrollRowByRow: boolean | "scrollbar";
729
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
730
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
731
+ export default _default;
732
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
733
+ type __VLS_TypePropsToRuntimeProps<T> = {
734
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
735
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
736
+ } : {
737
+ type: import('vue').PropType<T[K]>;
738
+ required: true;
739
+ };
740
+ };
741
+ type __VLS_WithDefaults<P, D> = {
742
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
743
+ default: D[K];
744
+ }> : P[K];
745
+ };
746
+ type __VLS_Prettify<T> = {
747
+ [K in keyof T]: T[K];
748
+ } & {};
749
+ type __VLS_WithTemplateSlots<T, S> = T & {
750
+ new (): {
751
+ $slots: S;
752
+ };
753
+ };