stk-table-vue 0.9.1 → 0.9.2

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