@aimerthyr/virtual-table 1.4.0 → 1.4.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.
- package/CHANGELOG.md +15 -0
- package/README.en.md +14 -0
- package/README.md +19 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +46 -3
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -0
- package/dist/virtual-table.css +1 -1
- package/package.json +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -69,7 +69,12 @@ export declare interface VTableBodyCellProps<TData = any> {
|
|
|
69
69
|
column: VTableColumn;
|
|
70
70
|
row: TData;
|
|
71
71
|
rowIndex: number;
|
|
72
|
-
|
|
72
|
+
/** 编辑模式
|
|
73
|
+
* row => 整行编辑
|
|
74
|
+
* cell => 单元格编辑
|
|
75
|
+
* null => 未处于编辑态
|
|
76
|
+
* */
|
|
77
|
+
isEditingMode: 'row' | 'cell' | null;
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
/** 表体样式配置 */
|
|
@@ -144,6 +149,8 @@ export declare interface VTableColumn<TData = any> {
|
|
|
144
149
|
columnMinWidth?: number;
|
|
145
150
|
/** 子列(用于表头分组) */
|
|
146
151
|
columnChildren?: VTableColumn<TData>[];
|
|
152
|
+
/** 汇总计算方式 (sum 汇总 agv 平均值 count 统计 max 最大值 min 最小值) */
|
|
153
|
+
columnSummary?: VTableSummaryType<TData>;
|
|
147
154
|
}
|
|
148
155
|
|
|
149
156
|
/** 筛选状态 */
|
|
@@ -176,6 +183,7 @@ export declare const vTableDefaultProps: {
|
|
|
176
183
|
loadMoreConfig?: ((props: VTableProps<any>) => VTableLoadMoreConfig) | undefined;
|
|
177
184
|
paginationConfig?: ((props: VTableProps<any>) => VTablePaginationConfig) | undefined;
|
|
178
185
|
treeConfig?: ((props: VTableProps<any>) => VTableTreeConfig) | undefined;
|
|
186
|
+
summaryConfig?: ((props: VTableProps<any>) => VTableSummaryConfig<any>) | undefined;
|
|
179
187
|
enableExpandRow?: boolean | ((props: VTableProps<any>) => boolean) | undefined;
|
|
180
188
|
enableRowHover?: boolean | ((props: VTableProps<any>) => boolean) | undefined;
|
|
181
189
|
adaptiveColumnWidth?: number | ((props: VTableProps<any>) => number) | undefined;
|
|
@@ -241,8 +249,12 @@ export declare interface VTableInstance<TData = any> {
|
|
|
241
249
|
tanstackTable: Table<TData>;
|
|
242
250
|
/** 滚动到指定下标(从 0 开始,默认是平滑滚动) */
|
|
243
251
|
scrollToIndex: (index: number, behavior?: 'auto' | 'smooth') => void;
|
|
244
|
-
/**
|
|
245
|
-
|
|
252
|
+
/** 设置编辑状态
|
|
253
|
+
* 1. columnKey 为空,则为行编辑
|
|
254
|
+
* 2. columnKey 不为空,则为单元格编辑
|
|
255
|
+
* 3. rowId 传 null,清除编辑状态
|
|
256
|
+
*/
|
|
257
|
+
setEditingState: (rowId: string | number | null, columnKey?: string | null) => void;
|
|
246
258
|
}
|
|
247
259
|
|
|
248
260
|
export declare interface VTableLoadMoreConfig {
|
|
@@ -266,6 +278,14 @@ export declare interface VTablePaginationConfig {
|
|
|
266
278
|
}
|
|
267
279
|
|
|
268
280
|
export declare interface VTablePaginationExtraProps {
|
|
281
|
+
/** 是否显示总计 */
|
|
282
|
+
showTotal?: boolean;
|
|
283
|
+
/** 是否显示每页条数选择器 */
|
|
284
|
+
showSizeChanger?: boolean;
|
|
285
|
+
/** 总计文本 */
|
|
286
|
+
totalText?: string;
|
|
287
|
+
/** 每页条数选择器文本 */
|
|
288
|
+
pageSizeText?: string;
|
|
269
289
|
}
|
|
270
290
|
|
|
271
291
|
/**
|
|
@@ -325,6 +345,8 @@ export declare interface VTableProps<TData = any> {
|
|
|
325
345
|
paginationConfig?: VTablePaginationConfig;
|
|
326
346
|
/** 树形结构配置 */
|
|
327
347
|
treeConfig?: VTableTreeConfig;
|
|
348
|
+
/** 汇总行配置 */
|
|
349
|
+
summaryConfig?: VTableSummaryConfig<TData>;
|
|
328
350
|
/** 是否启用展开行功能 */
|
|
329
351
|
enableExpandRow?: boolean;
|
|
330
352
|
/** 是否启用行 hover 高亮 */
|
|
@@ -451,6 +473,12 @@ export declare interface VTableSlots<TData = any> {
|
|
|
451
473
|
customExpandIcon?: (props: VTableExpandIconProps) => VNode_2[];
|
|
452
474
|
/** 自定义排序图标 */
|
|
453
475
|
customSorterIcon?: (props: VTableSorterIconProps) => VNode_2[];
|
|
476
|
+
/** 自定义汇总单元格 */
|
|
477
|
+
summaryCell?: (props: {
|
|
478
|
+
columnKey: string;
|
|
479
|
+
column: VTableColumn;
|
|
480
|
+
summaryValue: any;
|
|
481
|
+
}) => VNode_2[];
|
|
454
482
|
[key: string]: ((...args: any[]) => VNode_2[]) | undefined;
|
|
455
483
|
}
|
|
456
484
|
|
|
@@ -462,6 +490,21 @@ export declare interface VTableSorterIconProps {
|
|
|
462
490
|
/** 排序状态 */
|
|
463
491
|
export declare type VTableSortingState = SortingState;
|
|
464
492
|
|
|
493
|
+
/** 汇总配置 */
|
|
494
|
+
export declare interface VTableSummaryConfig<TData = any> {
|
|
495
|
+
/** 是否显示汇总行 */
|
|
496
|
+
enabled?: boolean;
|
|
497
|
+
/** 汇总行固定(不随表格滚动) */
|
|
498
|
+
fixed?: boolean;
|
|
499
|
+
/** 自定义汇总计算函数(优先级高于列配置) */
|
|
500
|
+
customSummary?: (column: VTableColumn, data: TData[]) => any;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
export declare type VTableSummaryFn<TData = any> = (data: TData[], column: VTableColumn) => any;
|
|
504
|
+
|
|
505
|
+
/** 汇总类型 */
|
|
506
|
+
export declare type VTableSummaryType<TData> = 'sum' | 'avg' | 'count' | 'max' | 'min' | VTableSummaryFn<TData>;
|
|
507
|
+
|
|
465
508
|
/** 表格主题配置 */
|
|
466
509
|
export declare interface VTableThemeConfig {
|
|
467
510
|
/** 主色 */
|