UNPKG

43.7 kBTypeScriptView Raw
1import { VXETableComponent, RowInfo, RecordInfo } from './component'
2import { ColumnOptions, ColumnInfo } from './column'
3import { ColumnCellRenderParams, TableEmptyRender } from './v-x-e-table'
4import { TableExportConfig, TableImportConfig, TablePrintConfig, SaveFileOptions, ReadFileOptions, ReadFileParams } from './export'
5import { ColumnFilterOption } from './filter'
6import { ColumnEditRule, ColumnEditValidErrMapParams } from './validator'
7import { ColumnFooterRenderParams } from './footer'
8import { MenuOptions, MenuFirstOption } from './menu'
9
10/**
11 * 表格
12 */
13export declare class Table extends VXETableComponent {
14 /**
15 * 唯一标识
16 */
17 id?: string;
18 /**
19 * 数据
20 */
21 data?: any[];
22 /**
23 * 表格的高度
24 */
25 height?: number | string;
26 /**
27 * 表格的最大高度
28 */
29 maxHeight?: number | string;
30 /**
31 * 所有列是否允许拖动列宽调整大小
32 */
33 resizable?: boolean;
34 /**
35 * 是否带有斑马纹
36 */
37 stripe?: boolean;
38 /**
39 * 是否带有纵向边框
40 */
41 border?: TableBorder;
42 /**
43 * 表格是否加载中
44 */
45 loading?: boolean;
46 /**
47 * 所有的列对其方式
48 */
49 align?: TableAlign;
50 /**
51 * 所有的表头列的对齐方式
52 */
53 headerAlign?: TableAlign;
54 /**
55 * 所有的表尾列的对齐方式
56 */
57 footerAlign?: TableAlign;
58 /**
59 * 是否显示表头
60 */
61 showHeader?: boolean;
62 /**
63 * 是否要高亮当前选中行
64 */
65 highlightCurrentRow?: boolean;
66 /**
67 * 鼠标移到行是否要高亮显示
68 */
69 highlightHoverRow?: boolean;
70 /**
71 * 是否要高亮当前选中列
72 */
73 highlightCurrentColumn?: boolean;
74 /**
75 * 鼠标移到列是否要高亮显示
76 */
77 highlightHoverColumn?: boolean;
78 /**
79 * 激活单元格编辑时是否高亮显示
80 */
81 highlightCell?: boolean;
82 /**
83 * 是否显示表尾
84 */
85 showFooter?: boolean;
86 /**
87 * 表尾数据获取的方法
88 */
89 footerMethod?: typeof TableFooterMethod;
90 /**
91 * 给行附加 className
92 */
93 rowClassName?: string | Function;
94 /**
95 * 给单元格附加 className
96 */
97 cellClassName?: string | Function;
98 /**
99 * 给表头的行附加 className
100 */
101 headerRowClassName?: string | Function;
102 /**
103 * 给表头的单元格附加 className
104 */
105 headerCellClassName?: string | Function;
106 /**
107 * 给表尾的行附加 className
108 */
109 footerRowClassName?: string | Function;
110 /**
111 * 给表尾的单元格附加 className
112 */
113 footerCellClassName?: string | Function;
114 /**
115 * 给单元格附加样式
116 */
117 cellStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
118 /**
119 * 给表头单元格附加样式
120 */
121 headerCellStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
122 /**
123 * 给表尾单元格附加样式
124 */
125 footerCellStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
126 /**
127 * 给行附加样式
128 */
129 rowStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
130 /**
131 * 给表头行附加样式
132 */
133 headerRowStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
134 /**
135 * 给表尾行附加样式
136 */
137 footerRowStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
138 /**
139 * 临时合并单元格
140 */
141 mergeCells: TableMergeConfig[];
142 /**
143 * 临时合并表尾
144 */
145 mergeFooterItems: TableMergeConfig[];
146 /**
147 * 自定义单元格合并方法
148 */
149 spanMethod?: typeof TableSpanMethod;
150 /**
151 * 自定义表尾合并方法
152 */
153 footerSpanMethod?: typeof TableFooterSpanMethod;
154 /**
155 * 设置所有内容过长时显示为省略号
156 */
157 showOverflow?: TableOverflow;
158 /**
159 * 设置表头所有内容过长时显示为省略号
160 */
161 showHeaderOverflow?: TableOverflow;
162 /**
163 * 设置表尾所有内容过长时显示为省略号
164 */
165 showFooterOverflow?: TableOverflow;
166
167 /** 高级属性 */
168 // 主键配置
169 columnKey?: boolean;
170 rowKey?: boolean;
171 rowId?: string;
172 zIndex?: number;
173 keepSource?: boolean;
174 // 是否自动监听父容器变化去更新响应式表格宽高
175 autoResize?: boolean;
176 // 是否自动根据状态属性去更新响应式表格宽高
177 syncResize?: boolean | string | number;
178 // 列的默认参数
179 columnConfig?: TableColumnConfig;
180 // 序号配置项
181 seqConfig?: TableSeqConfig;
182 // 排序配置项
183 sortConfig?: TableSortConfig;
184 // 筛选配置项
185 filterConfig?: TableFilterConfig;
186 // 单选框配置
187 radioConfig?: TableRadioConfig;
188 // 复选框配置项
189 checkboxConfig?: TableCheckboxConfig;
190 checkboxOpts: TableCheckboxConfig;
191 // 提示信息配置项
192 tooltipConfig?: TableTooltipConfig;
193 tooltipOpts: TableTooltipConfig;
194 // 导出配置项
195 exportConfig?: TableExportConfig;
196 exportOpts: TableExportConfig;
197 // 导入配置项
198 importConfig?: TableImportConfig;
199 importOpts: TableImportConfig;
200 // 打印配置项
201 printConfig?: TablePrintConfig;
202 printOpts: TablePrintConfig;
203 // 展开行配置项
204 expandConfig?: TableExpandConfig;
205 expandOpts: TableExpandConfig;
206 // 树形结构配置项
207 treeConfig?: TableTreeConfig;
208 treeOpts: TreeOpts;
209 // 快捷菜单配置项
210 menuConfig?: TableMenuConfig;
211 /**
212 * 即将废弃,请使用 menu-config
213 * @deprecated
214 */
215 contextMenu?: TableMenuConfig;
216 // 鼠标配置项
217 mouseConfig?: TableMouseConfig;
218 mouseOpts: TableMouseConfig;
219 // 按键配置项
220 keyboardConfig?: TableKeyboardConfig;
221 keyboardOpts: TableKeyboardConfig;
222 clipConfig?: TableClipConfig;
223 // 编辑配置项
224 editConfig?: TableEditConfig;
225 editOpts: TableEditConfig;
226 // 校验配置项
227 validConfig?: TableValidConfig;
228 // 校验规则配置项
229 editRules?: EditVaildRules;
230 emptyText?: string;
231 // 空内容渲染配置项
232 emptyRender?: TableEmptyRender;
233 animat?: boolean;
234 delayHover?: number;
235 /**
236 * 横向虚拟滚动配置
237 */
238 scrollX?: {
239 /**
240 * 指定大于指定列时自动启动横向虚拟滚动,如果为 0 则总是启用,如果为 -1 则关闭
241 */
242 gt?: number;
243 /**
244 * 指定每次渲染的数据偏移量,偏移量越大渲染次数就越少,但每次渲染耗时就越久
245 */
246 oSize?: number;
247 [key: string]: any;
248 };
249 /**
250 * 纵向虚拟滚动配置
251 */
252 scrollY?: {
253 /**
254 * 指定大于指定行时自动启动纵向虚拟滚动,如果为 0 则总是启用,如果为 -1 则关闭
255 */
256 gt?: number;
257 /**
258 * 指定每次渲染的数据偏移量,偏移量越大渲染次数就越少,但每次渲染耗时就越久
259 */
260 oSize?: number;
261 [key: string]: any;
262 };
263 // 额外的参数
264 params?: any;
265
266 // methods
267 /**
268 * 手动清除表格所有条件,还原到初始状态
269 * 对于增删改查的场景中可能会用到,比如在数据保存之后清除表格缓存
270 */
271 clearAll(): Promise<any>;
272 /**
273 * 同步 data 数据;如果用了该方法,那么组件将不再记录增删改的状态,只能自行实现对应逻辑
274 * 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
275 */
276 syncData(): Promise<any>;
277 /**
278 * 手动处理数据
279 * 对于手动更改了排序、筛选...等条件后需要重新处理数据时可能会用到
280 */
281 updateData(): Promise<any>;
282 /**
283 * 加载数据
284 * @param data 数据
285 */
286 loadData(data: RecordInfo[]): Promise<any>;
287 /**
288 * 加载数据并恢复到初始状态
289 * @param data 数据
290 */
291 reloadData(data: RecordInfo[]): Promise<any>;
292 /**
293 * 局部加载行数据并恢复到初始状态
294 * @param rows 行对象
295 * @param record 新数据
296 * @param field 指定字段名
297 */
298 reloadRow(rows: RowInfo | RowInfo[], record?: RecordInfo, field?: string): Promise<any>;
299 /**
300 * 加载列配置
301 * @param columns 列对象
302 */
303 loadColumn(columns: ColumnOptions[]): Promise<any>;
304 /**
305 * 加载列配置并恢复到初始状态
306 * @param columns 列对象
307 */
308 reloadColumn(columns: ColumnOptions[]): Promise<any>;
309 /**
310 * 根据 tr 元素获取对应的 row 信息
311 * @param tr 行节点元素
312 */
313 getRowNode(trElem: HTMLElement): {
314 rowid: string;
315 item: RowInfo;
316 items: RowInfo[];
317 index: number;
318 parent?: RowInfo;
319 };
320 /**
321 * 根据 th/td 元素获取对应的 column 信息
322 * @param cell 单元格节点元素
323 */
324 getColumnNode(cellElem: HTMLElement): {
325 colid: string;
326 item: ColumnInfo;
327 items: ColumnInfo[];
328 index: number;
329 parent?: ColumnInfo;
330 };
331 /**
332 * 根据 row 获取相对于 data 中的索引
333 * @param row 行对象
334 */
335 getRowIndex(row: RowInfo): number;
336 /**
337 * 根据 row 获取相对于当前数据中的索引
338 * @param row 行对象
339 */
340 getVTRowIndex(row: RowInfo): number;
341 /**
342 * 根据 row 获取渲染中的虚拟索引
343 * @param row 行对象
344 */
345 getVMRowIndex(row: RowInfo): number;
346 /**
347 * 根据 column 获取相对于 columns 中的索引
348 * @param column 列对象
349 */
350 getColumnIndex(column: ColumnInfo): number;
351 /**
352 * 根据 column 获取相对于当前表格列中的索引
353 * @param column 列对象
354 */
355 getVTColumnIndex(column: ColumnInfo): number;
356 /**
357 * 根据 column 获取渲染中的虚拟索引
358 * @param column 列对象
359 */
360 getVMColumnIndex(column: ColumnInfo): number;
361 /**
362 * 创建 data 对象
363 * 对于某些特殊场景可能会用到,会自动对数据的字段名进行检测,如果不存在就自动定义
364 * @param records 数据
365 */
366 createData(records: any[]): Promise<any[]>;
367 /**
368 * 创建 Row|Rows 对象
369 * 对于某些特殊场景需要对数据进行手动插入时可能会用到
370 * @param records 数据
371 */
372 createRow(records: any | any[]): Promise<any | any[]>;
373 /**
374 * 只对 keep-source 开启有效,还原指定行 row 或者整个表格的数据
375 * @param rows 指定行
376 * @param field 字段名
377 */
378 revertData(rows?: RowInfo | RowInfo[], field?: string): Promise<any>;
379 /**
380 * 手动清空单元格内容,如果不传参数,则清空整个表格内容,如果传了行则清空指定行内容,如果传了指定字段,则清空该字段内容
381 * @param rows 指定行
382 * @param field 字段名
383 */
384 clearData(rows?: RowInfo | RowInfo[], field?: string): Promise<any>;
385 /**
386 * 用于 edit-config,判断行是否为新增的临时数据
387 * @param row 指定行
388 */
389 isInsertByRow(row: RowInfo): boolean;
390 /**
391 * 只对 keep-source 开启有效,判断行数据是否发生改变
392 * @param row 指定行
393 */
394 isUpdateByRow(row: any, field?: string): boolean;
395 /**
396 * 获取表格的可视列,也可以指定索引获取列
397 * @param columnIndex 列索引
398 */
399 getColumns(columnIndex?: number): ColumnInfo | ColumnInfo[];
400 /**
401 * 根据列的唯一主键获取列
402 * @param colid 列主键
403 */
404 getColumnById(colid: string): ColumnInfo;
405 /**
406 * 根据列的字段名获取列
407 * @param field 字段名
408 */
409 getColumnByField(field: string): ColumnInfo;
410 /**
411 * 获取当前表格的列
412 * 收集到的全量列、全量表头列、处理条件之后的全量表头列、当前渲染中的表头列
413 */
414 getTableColumn(): {
415 collectColumn: ColumnInfo[];
416 fullColumn: ColumnInfo[];
417 visibleColumn: ColumnInfo[];
418 tableColumn: ColumnInfo[];
419 };
420 /**
421 * 获取数据,和 data 的行为一致,也可以指定索引获取数据
422 */
423 getData(rowIndex?: number): RowInfo[];
424 /**
425 * 用于 type=checkbox,获取已选中的行数据
426 */
427 getCheckboxRecords(isFull?: boolean): RowInfo[];
428 /**
429 * 根据行的唯一主键获取行
430 * @param rowid 行主键
431 */
432 getRowById(rowid: string | number): RowInfo;
433 /**
434 * 获取当前表格的数据
435 * 完整的全量表体数据、处理条件之后的全量表体数据、当前渲染中的表体数据、当前渲染中的表尾数据
436 */
437 getTableData(): {
438 fullData: RowInfo[];
439 visibleData: RowInfo[];
440 tableData: RowInfo[];
441 footerData: any[][];
442 };
443 /**
444 * 隐藏指定列
445 * @param column 列对象
446 */
447 hideColumn(column: ColumnInfo): Promise<any>;
448 /**
449 * 显示指定列
450 * @param column 列对象
451 */
452 showColumn(column: ColumnInfo): Promise<any>;
453 /**
454 * 手动重置列的显示隐藏、列宽拖动的状态;如果为 true 则重置所有状态
455 * 如果已关联工具栏,则会同步更新
456 * @param options 可选参数
457 */
458 resetColumn(options: boolean | { visible?: boolean, resizable?: boolean }): Promise<any>;
459 /**
460 * 刷新列配置
461 * 对于动态修改属性、显示/隐藏列等场景下可能会用到
462 */
463 refreshColumn(): Promise<any>;
464 /**
465 * 刷新滚动操作,手动同步滚动相关位置
466 * 对于某些特殊的操作,比如滚动条错位、固定列不同步
467 */
468 refreshScroll(): Promise<any>;
469 /**
470 * 重新计算表格,如果传 true 则进行完整计算
471 * 对于某些特殊场景可能会用到,比如隐藏的表格、重新计算列宽...等
472 */
473 recalculate(refull?: boolean): Promise<any>;
474 /**
475 * 打开 tooltip 提示
476 * @param target 目标元素
477 * @param content 内容
478 */
479 openTooltip (target: HTMLElement, content: string | number): Promise<any>;
480 /**
481 * 手动关闭 tooltip 提示
482 */
483 closeTooltip(): Promise<any>;
484 /**
485 * 用于 type=checkbox,设置行为选中状态,第二个参数为选中与否
486 * @param rows 指定行
487 * @param checked 是否选中
488 */
489 setCheckboxRow(rows: RowInfo | RowInfo[], checked: boolean): Promise<any>;
490 /**
491 * 用于 type=checkbox,判断列头复选框是否被选中
492 */
493 isAllCheckboxChecked(): boolean;
494 /**
495 * 用于 type=checkbox,判断列头复选框是否被半选
496 */
497 isAllCheckboxIndeterminate(): boolean;
498 /**
499 * 用于 type=checkbox,判断复选行数据是否勾选
500 * @param row 指定行
501 */
502 isCheckedByCheckboxRow(row: RowInfo): boolean;
503 /**
504 * 用于 type=checkbox,切换某一行的选中状态
505 * @param row 指定行
506 */
507 toggleCheckboxRow(row: RowInfo): Promise<any>;
508 /**
509 * 用于 type=checkbox,设置所有行的选中状态
510 * @param checked 是否选中
511 */
512 setAllCheckboxRow(checked: boolean): Promise<any>;
513 /**
514 * 用于 radio-config.reserve,获取已保留选中的行数据
515 */
516 getRadioReserveRecord(isFull?: boolean): RowInfo[];
517 /**
518 * 用于 radio-config.reserve,手动清空用户保留选中的行数据
519 */
520 clearRadioReserve(): Promise<any>;
521 /**
522 * 用于 checkbox-config.reserve,获取已保留选中的行数据
523 */
524 getCheckboxReserveRecords(isFull?: boolean): RowInfo[];
525 /**
526 * 用于 type=checkbox,获取半选状态的行数据
527 */
528 getCheckboxIndeterminateRecords(isFull?: boolean): RowInfo[]
529 /**
530 * 用于 checkbox-config.reserve,手动清空用户保留选中的行数据
531 */
532 clearCheckboxReserve(): Promise<any>;
533 /**
534 * 用于 type=checkbox,切换所有行的选中状态
535 */
536 toggleAllCheckboxRow(): Promise<any>;
537 /**
538 * 用于 type=checkbox,手动清空用户的选择
539 */
540 clearCheckboxRow(): Promise<any>;
541 /**
542 * 用于 highlight-current-row,设置某一行为高亮状态
543 * @param row 指定行
544 */
545 setCurrentRow(row: RowInfo): Promise<any>;
546 /**
547 * 用于 type=radio,判断单选行数据是否勾选
548 * @param row 指定行
549 */
550 isCheckedByRadioRow(row: RowInfo): boolean;
551 /**
552 * 用于 type=radio,设置某一行为选中状态
553 * @param row 指定行
554 */
555 setRadioRow(row: RowInfo): Promise<any>;
556 /**
557 * 手动清除临时合并的单元格
558 */
559 clearMergeCells(): Promise<any>;
560 /**
561 * 手动清除临时合并的表尾
562 */
563 clearMergeFooterItems(): Promise<any>;
564 /**
565 * 用于 highlight-current-row,手动清空当前高亮的状态
566 */
567 clearCurrentRow(): Promise<any>;
568 /**
569 * 用于 type=radio,手动清空用户的选择
570 */
571 clearRadioRow(): Promise<any>;
572 /**
573 * 获取临时合并的单元格
574 */
575 getMergeCells(): MergeItem[];
576 /**
577 * 获取临时合并的表尾
578 */
579 getMergeFooterItems(): MergeItem[];
580 /**
581 * 用于 highlight-current-column,获取当前列
582 */
583 getCurrentColumn(): ColumnInfo | null;
584 /**
585 * 用于 highlight-current-row,获取当前行的行数据
586 */
587 getCurrentRecord(): RowInfo;
588 /**
589 * 用于 type=radio,获取当已选中的行数据
590 */
591 getRadioRecord(isFull?: boolean): RowInfo;
592 /**
593 * 用于 highlight-current-column,设置某列行为高亮状态
594 * @param column 列对象
595 */
596 setCurrentColumn(column: ColumnInfo): Promise<any>;
597 /**
598 * 用于 highlight-current-column,手动清空当前高亮的状态
599 */
600 clearCurrentColumn(): Promise<any>;
601 /**
602 * 手动对表格进行排序
603 * @param sortConfs 字段名、多列排序
604 * @param order 排序方式
605 */
606 sort(sortConfs: string | TableSortConfs | TableSortConfs[], order?: TableSortOrder): Promise<any>;
607 /**
608 * 手动清空排序条件,数据会恢复成未排序的状态
609 */
610 clearSort(fieldOrColumn?: string | ColumnInfo | null): Promise<any>;
611 /**
612 * 获取当前排序的 column 信息
613 */
614 getSortColumn(): ColumnInfo;
615 /**
616 * 手动关闭筛选面板
617 */
618 closeFilter(): Promise<any>;
619 /**
620 * 判断指定列是否为筛选状态,如果为空则判断所有列
621 * @param column 列对象
622 */
623 isFilter(column: ColumnInfo): boolean;
624 /**
625 * 用于 expand-config.lazy,用于懒加载展开行,判断展开行是否懒加载完成
626 * @param row 指定行
627 */
628 isRowExpandLoaded(row: RowInfo): boolean;
629 /**
630 * 用于 expand-config.lazy,手动清空懒加载展开行的状态,数据会恢复成未展开的状态,当再次展开时会重新加载
631 */
632 clearRowExpandLoaded(row: any): Promise<any>;
633 /**
634 * 用于懒加载展开行,重新加载展开行的内容
635 * @param rows 指定行
636 */
637 reloadRowExpand(rows: RowInfo | RowInfo[]): Promise<any>;
638 /**
639 * 用于 type=expand,切换展开行的状态
640 * @param row 指定行
641 */
642 toggleRowExpand(row: RowInfo): Promise<any>;
643 /**
644 * 用于 expand-config,设置所有行的展开与否
645 * 如果是关闭所有行,可以使用 clearRowExpand 快速清除
646 * @param checked 是否选中
647 */
648 setAllRowExpand(checked: boolean): Promise<any>;
649 /**
650 * 用于 expand-config,设置展开行,二个参数设置这一行展开与否
651 * @param rows 指定行
652 * @param checked 是否选中
653 */
654 setRowExpand(rows: RowInfo | RowInfo[], checked: boolean): Promise<any>;
655 /**
656 * 用于 expand-config,判断行是否为展开状态
657 * @param row 指定行
658 */
659 isExpandByRow(row: RowInfo): boolean;
660 /**
661 * 用于 type=expand,手动清空展开行状态,数据会恢复成未展开的状态
662 */
663 clearRowExpand(): Promise<any>;
664 /**
665 * 用于 expand-config,用于展开行,获取已展开的行数据
666 */
667 getRowExpandRecords(): RowInfo[];
668 /**
669 * 用于 tree-config,用于树表格,获取已展开的节点
670 * 注意,即使父节点被收起,只要该节点还处于展开状态都能获取到
671 */
672 getTreeExpandRecords(): RowInfo[];
673 /**
674 * 用于 tree-config.lazy,用于懒加载树表格,判断树节点是否懒加载完成
675 */
676 isTreeExpandLoaded(row: RowInfo): boolean;
677 /**
678 * 用于 tree-config.lazy,手动清空懒加载树节点的状态,数据会恢复成未展开的状态,当再次展开时会重新加载
679 */
680 clearTreeExpandLoaded(row: any): Promise<any>;
681 /**
682 * 用于懒加载树表格,重新加载子节点
683 * @param rows 指定行
684 */
685 reloadTreeChilds(rows: RowInfo | RowInfo[]): Promise<any>;
686 /**
687 * 用于 tree-config,切换展开树形节点的状态
688 * @param row 指定行
689 */
690 toggleTreeExpand(row: RowInfo): Promise<any>;
691 /**
692 * 用于 tree-config,设置所有树节点的展开与否
693 * 如果是关闭所有树节点,可以使用 clearTreeExpand 快速清除
694 * @param checked 是否选中
695 */
696 setAllTreeExpand(checked: boolean): Promise<any>;
697 /**
698 * 用于 tree-config,设置展开树形节点,二个参数设置这一行展开与否
699 * @param rows 指定行
700 * @param checked 是否选中
701 */
702 setTreeExpand(rows: RowInfo | RowInfo, checked: boolean): Promise<any>;
703 /**
704 * 用于 tree-config,判断行是否为树形节点展开状态
705 * @param row 指定行
706 */
707 isTreeExpandByRow(row: RowInfo): boolean;
708 /**
709 * 用于 tree-config,手动清空树形节点的展开状态,数据会恢复成未展开的状态
710 */
711 clearTreeExpand(): Promise<any>;
712 /**
713 * 获取表格的滚动状态
714 */
715 getScroll(): {
716 virtualX: boolean;
717 virtualY: boolean;
718 scrollTop: number;
719 scrollLeft: number;
720 };
721 /**
722 * 如果有滚动条,则滚动到对应的位置
723 * @param scrollLeft 左边距离
724 * @param scrollTop 顶部距离
725 */
726 scrollTo(scrollLeft: number, scrollTop?: number): Promise<any>;
727 /**
728 * 如果有滚动条,则滚动到对应的行
729 * @param row 指定行
730 * @param column 列对象
731 */
732 scrollToRow(row: RowInfo, column?: ColumnInfo): Promise<any>;
733 /**
734 * 如果有滚动条,则滚动到对应的列
735 * @param column 列对象
736 */
737 scrollToColumn(column: ColumnInfo): Promise<any>;
738 /**
739 * 手动清除滚动相关信息,还原到初始状态
740 */
741 clearScroll(): Promise<any>;
742 /**
743 * 手动更新表尾
744 */
745 updateFooter(): Promise<any>;
746 /**
747 * 更新单元格状态
748 * @param params 插槽对象
749 */
750 updateStatus(
751 params: {
752 row: RowInfo;
753 column: ColumnInfo;
754 }
755 ): Promise<any>;
756 /**
757 * 用于 filters,修改筛选列表
758 * 在筛选条件更新之后可以调用 updateData 函数处理表格数据
759 * @param column 列对象
760 * @param options 选项列表
761 */
762 setFilter(column: ColumnInfo, options: ColumnFilterOption[]): Promise<any>;
763 /**
764 * 手动清空筛选条件
765 * 如果不传 column 则清空所有筛选条件,数据会恢复成未筛选的状态
766 * @param column 字段名
767 */
768 clearFilter(column?: ColumnInfo): Promise<any>;
769 /**
770 * 手动关闭快捷菜单
771 */
772 closeMenu(): Promise<any>;
773 /**
774 * 用于 mouse-config.selected,获取选中的单元格信息
775 */
776 getSelectedCell(): {
777 row: RowInfo;
778 column: ColumnInfo;
779 };
780 /**
781 * 用于 mouse-config.area,用于获取鼠标选择的区域
782 */
783 getCellAreas(): MouseCellArea[];
784 /**
785 * 用于 mouse-config.area,复制指定区域,返回转换后的文本
786 */
787 copyCellArea(): { text: string, html: string };
788 /**
789 * 用于 mouse-config.area,剪贴指定区域,返回转换后的文本
790 */
791 cutCellArea(): { text: string, html: string };
792 /**
793 * 用于 mouse-config.area,粘贴从表格中被复制的数据,如果不是从表格中操作,则无法粘贴
794 */
795 pasteCellArea(): Promise<any>;
796 /**
797 * 手动清除单元格选中状态
798 */
799 clearSelected(): Promise<any>;
800 /**
801 * 往表格插入临时数据,从第一行新增一行或多行新数据
802 * @param records 新数据
803 */
804 insert(records: RecordInfo | RecordInfo[]): Promise<{ row: RowInfo, rows: RowInfo[] }>;
805 /**
806 * 往表格指定行中插入临时数据
807 * 如果 row 为空则从插入到顶部,如果为树结构,则插入到目标节点顶部
808 * 如果 row 为 -1 则从插入到底部,如果为树结构,则插入到目标节点底部
809 * 如果 row 为有效行则插入到该行的位置,如果为树结构,则有插入到效的目标节点该行的位置
810 * @param {Object/Array} records 新的数据
811 * @param {Row} row 指定行
812 */
813 insertAt(records: RecordInfo | RecordInfo[], row: RowInfo | -1 | null): Promise<{ row: RowInfo, rows: RowInfo[] }>;
814 /**
815 * 删除指定行数据,指定 row 或 [row, ...] 删除多条数据,如果为空则删除所有数据
816 * @param rows 指定行
817 */
818 remove(rows?: RowInfo | RowInfo[]): Promise<{ row: RowInfo, rows: RowInfo[] }>;
819 /**
820 * 删除复选框选中的行数据
821 */
822 removeCheckboxRow(): Promise<{ row: RowInfo, rows: RowInfo[] }>;
823 /**
824 * 删除单选框选中的行数据
825 */
826 removeRadioRow(): Promise<{ row: RowInfo, rows: RowInfo[] }>;
827 /**
828 * 删除当前行选中的行数据
829 */
830 removeCurrentRow(): Promise<{ row: RowInfo, rows: RowInfo[] }>;
831 /**
832 * 取消单元格的临时合并状态,如果为数组,则取消多个合并
833 */
834 removeMergeCells(merges: TableMergeConfig | TableMergeConfig[]): Promise<MergeItem[]>;
835 /**
836 * 取消表尾的临时合并状态,如果为数组,则取消多个合并
837 */
838 removeMergeFooterItems(merges: TableMergeConfig | TableMergeConfig[]): Promise<MergeItem[]>;
839 /**
840 * 获取表格数据集
841 * 获取新增、删除、更改的数据
842 */
843 getRecordset(): {
844 insertRecords: RowInfo[];
845 removeRecords: RowInfo[];
846 updateRecords: RowInfo[];
847 };
848 /**
849 * 用于 edit-config,获取新增的临时数据
850 */
851 getInsertRecords(): RowInfo[];
852 /**
853 * 获取已删除的数据
854 */
855 getRemoveRecords(): RowInfo[];
856 /**
857 * 用于 edit-config,获取已修改的数据
858 */
859 getUpdateRecords(): RowInfo[];
860 /**
861 * 手动清除单元格激活状态
862 */
863 clearActived(): Promise<any>;
864 /**
865 * 用于 mouse-config.area,用于清除鼠标选择的区域,可以指定清除的区域
866 */
867 clearCellAreas(area?: number | MouseCellArea): Promise<any>;
868 /**
869 * 用于 edit-config,获取已激活的行数据
870 */
871 getActiveRecord(): {
872 row: RowInfo;
873 rowIndex: number;
874 $rowIndex: number;
875 column: ColumnInfo;
876 columnIndex: number;
877 $columnIndex: number;
878 cell: HTMLElement;
879 };
880 /**
881 * 用于 edit-config,判断行是否为激活编辑状态
882 * @param row 指定行
883 */
884 isActiveByRow(row: RowInfo): boolean;
885 /**
886 * 用于 edit-config,激活行编辑并激活第一个单元格
887 * @param row 指定行
888 */
889 setActiveRow(row: RowInfo): Promise<any>;
890 /**
891 * 用于 edit-config,激活单元格编辑
892 * @param row 指定行
893 * @param field 字段名
894 */
895 setActiveCell(row: RowInfo, field: string): Promise<any>;
896 /**
897 * 用于 mouse-config.mouse-config,选中某个单元格
898 * @param row 指定行
899 * @param field 字段名
900 */
901 setSelectCell(row: RowInfo, field: string): Promise<any>;
902 /**
903 * 用于 mouse-config.area,选取指定区域的单元格
904 * @param areaConfigs 指定区域
905 */
906 setCellAreas(areaConfigs: CellAreaConfig[], activeArea?: {
907 area?: number | MouseCellArea;
908 column?: number | ColumnInfo;
909 row?: number | RowInfo;
910 }): Promise<any>;
911 /**
912 * 用于 mouse-config.area,设置活动的区域的单元格
913 * @param activeArea
914 */
915 setActiveCellArea(activeArea: {
916 area: MouseCellArea;
917 column: number | ColumnInfo;
918 row: number | RowInfo;
919 }): Promise<any>;
920 /**
921 * 临时合并单元格,如果为数组则合并多个
922 */
923 setMergeCells(merges: TableMergeConfig | TableMergeConfig[]): Promise<any>;
924 /**
925 * 临时合并表尾,如果为数组则合并多个
926 */
927 setMergeFooterItems(merges: TableMergeConfig | TableMergeConfig[]): Promise<any>;
928 /**
929 * 手动清除校验
930 */
931 clearValidate(): Promise<any>;
932 /**
933 * 完整校验,和 validate 的区别就是默认校验当前表格数据并且给有效数据中的每一行进行校验
934 * @param rows 指定行
935 * @param callback 回调函数
936 */
937 fullValidate(rows?: boolean | RowInfo | RowInfo[] | ((errMap?: ColumnEditValidErrMapParams) => void), callback?: (errMap: ColumnEditValidErrMapParams) => void): Promise<ColumnEditValidErrMapParams>;
938 /**
939 * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外);如果第一个参数为 true 则校验当前表格数据,如果指定 row 或 rows 则校验指定一行或多行,如果不指定数据,则默认只校验临时变动的数据,例如新增或修改。该回调函数会在校验结束后被调用 callback(errMap)。若不传入回调函数,则会返回一个 promise
940 * @param rows 指定行
941 * @param callback 回调函数
942 */
943 validate(rows?: boolean | RowInfo | RowInfo[] | ((errMap?: ColumnEditValidErrMapParams) => void), callback?: (errMap?: ColumnEditValidErrMapParams) => void): Promise<ColumnEditValidErrMapParams>;
944 /**
945 * 打开高级导出
946 * @param options 参数
947 */
948 openExport(options?: TableExportConfig): Promise<any>;
949 /**
950 * 将表格数据导出
951 * @param options 参数
952 */
953 exportData(options?: TableExportConfig): Promise<any>;
954 /**
955 * 打开高级导入
956 * @param options 参数
957 */
958 openImport(options?: TableImportConfig): Promise<any>;
959 /**
960 * 将数据导入表格
961 * @param options 参数
962 */
963 importData(options?: TableImportConfig): Promise<any>;
964 /**
965 * 保存文件到本地
966 * @param options
967 */
968 saveFile(options: SaveFileOptions): Promise<any>;
969 /**
970 * 读取本地文件
971 * @param options 参数
972 */
973 readFile(options?: ReadFileOptions): Promise<ReadFileParams>;
974 /**
975 * 打印表格数据
976 * @param options 参数
977 */
978 print(options?: TablePrintConfig): Promise<any>;
979 /**
980 * 打开高级打印
981 * @param options 参数
982 */
983 openPrint(options?: TablePrintConfig): Promise<any>;
984 /**
985 * 用于 mouse-config.area,打开单元格查找功能
986 */
987 openFind(): Promise<any>;
988 /**
989 * 用于 mouse-config.area,打开单元格替换功能
990 */
991 openReplace(): Promise<any>;
992 /**
993 * 连接工具栏
994 * @param toolbar 工具栏组件实例
995 */
996 connect(toolbar: any): Promise<any>;
997 /**
998 * 使表格获取焦点
999 */
1000 focus(): Promise<any>;
1001 /**
1002 * 使表格失去焦点
1003 */
1004 blur(): Promise<any>;
1005 [key: string]: any;
1006}
1007
1008export type TableBorder = boolean | 'default' | 'full' | 'outer' | 'inner' | 'none';
1009export type TableAlign = 'left' | 'center' | 'right' | null;
1010export type TableOverflow = boolean | 'ellipsis' | 'title' | 'tooltip' | null;
1011
1012export interface TableFooterMethodParams {
1013 $table: Table;
1014 columns: ColumnInfo[];
1015 data: any[];
1016}
1017export function TableFooterMethod(params: TableFooterMethodParams): Array<string | number | null>[];
1018
1019export interface TableSpanMethodParams extends ColumnCellRenderParams {}
1020export function TableSpanMethod(params: TableSpanMethodParams): { rowspan: number, colspan: number }
1021
1022export interface TableFooterSpanMethodParams extends ColumnFooterRenderParams {}
1023export function TableFooterSpanMethod(params: TableFooterSpanMethodParams): { rowspan: number, colspan: number }
1024
1025export interface TableOptions {
1026 id?: string;
1027 data?: any[];
1028 height?: number | string;
1029 maxHeight?: number | string;
1030 resizable?: boolean;
1031 stripe?: boolean;
1032 border?: TableBorder;
1033 loading?: boolean;
1034 align?: TableAlign;
1035 headerAlign?: TableAlign;
1036 footerAlign?: TableAlign;
1037 showHeader?: boolean;
1038 highlightCurrentRow?: boolean;
1039 highlightHoverRow?: boolean;
1040 highlightCurrentColumn?: boolean;
1041 highlightHoverColumn?: boolean;
1042 highlightCell?: boolean;
1043 showFooter?: boolean;
1044 footerMethod?: typeof TableFooterMethod;
1045 rowClassName?: string | Function;
1046 cellClassName?: string | Function;
1047 headerRowClassName?: string | Function;
1048 headerCellClassName?: string | Function;
1049 footerRowClassName?: string | Function;
1050 footerCellClassName?: string | Function;
1051 cellStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
1052 headerCellStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
1053 footerCellStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
1054 rowStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
1055 headerRowStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
1056 footerRowStyle?: { [key: string]: any } | Array<string | number | boolean | { [key: string]: any }> | Function;
1057 mergeCells?: TableMergeConfig[];
1058 mergeFooterItems?: TableMergeConfig[];
1059 spanMethod?: typeof TableSpanMethod;
1060 footerSpanMethod?: typeof TableFooterSpanMethod;
1061 showOverflow?: TableOverflow;
1062 showHeaderOverflow?: TableOverflow;
1063 showFooterOverflow?: TableOverflow;
1064 columnKey?: boolean;
1065 rowKey?: boolean;
1066 rowId?: string;
1067 keepSource?: boolean;
1068 autoResize?: boolean;
1069 syncResize?: boolean | string | number;
1070 columnConfig?: TableColumnConfig;
1071 customConfig?: TableCustomConfig;
1072 seqConfig?: TableSeqConfig;
1073 sortConfig?: TableSortConfig;
1074 filterConfig?: TableFilterConfig;
1075 radioConfig?: TableRadioConfig;
1076 checkboxConfig?: TableCheckboxConfig;
1077 tooltipConfig?: TableTooltipConfig;
1078 exportConfig?: TableExportConfig;
1079 importConfig?: TableImportConfig;
1080 printConfig?: TablePrintConfig;
1081 expandConfig?: TableExpandConfig;
1082 treeConfig?: TableTreeConfig;
1083 menuConfig?: TableMenuConfig;
1084 /**
1085 * 即将废弃,请使用 menu-config
1086 * @deprecated
1087 */
1088 contextMenu?: TableMenuConfig;
1089 mouseConfig?: TableMouseConfig;
1090 keyboardConfig?: TableKeyboardConfig;
1091 clipConfig?: TableClipConfig;
1092 editConfig?: TableEditConfig;
1093 validConfig?: TableValidConfig;
1094 editRules?: EditVaildRules;
1095 emptyText?: string;
1096 emptyRender?: TableEmptyRender;
1097 animat?: boolean;
1098 delayHover?: number;
1099 scrollX?: {
1100 gt?: number;
1101 oSize?: number;
1102 [key: string]: any;
1103 };
1104 scrollY?: {
1105 gt?: number;
1106 oSize?: number;
1107 [key: string]: any;
1108 };
1109 params?: any;
1110 [key: string]: any;
1111}
1112
1113/**
1114 * 列的默认配置
1115 */
1116export interface TableColumnConfig {
1117 width?: number;
1118 minWidth?: number;
1119}
1120export interface ColumnDefaultConfig extends TableColumnConfig {}
1121
1122/**
1123 * 自定义列配置项
1124 */
1125export interface TableCustomConfig {
1126 storage?: boolean | {
1127 visible?: boolean;
1128 resizable?: boolean;
1129 };
1130 checkMethod?(params: { column: ColumnInfo }): boolean;
1131}
1132export interface CustomConfig extends TableCustomConfig {}
1133
1134/**
1135 * 序号配置项
1136 */
1137export interface TableSeqConfig {
1138 startIndex?: number;
1139 seqMethod?(params: ColumnCellRenderParams): number;
1140}
1141export interface SeqConfig extends TableSeqConfig {}
1142
1143export interface TableSortConfs {
1144 field: string;
1145 order?: TableSortOrder;
1146}
1147
1148export type TableSortOrder = 'asc' | 'desc' | null;
1149
1150/**
1151 * 排序配置项
1152 */
1153export interface TableSortConfig {
1154 defaultSort?: {
1155 field: string;
1156 order: TableSortOrder;
1157 };
1158 orders?: TableSortOrder[];
1159 sortMethod?(params: { data: any[], column: ColumnInfo, property: string, order: string }): any[];
1160 remote?: boolean;
1161 trigger?: 'default' | 'cell';
1162 showIcon: boolean;
1163 iconAsc?: string;
1164 iconDesc?: string;
1165}
1166export interface SortConfig extends TableSortConfig {}
1167
1168/**
1169 * 筛选配置项
1170 */
1171export interface TableFilterConfig {
1172 remote?: boolean;
1173 showIcon?: string;
1174 iconNone?: string;
1175 iconMatch?: string;
1176}
1177export interface FilterConfig extends TableFilterConfig {}
1178
1179/**
1180 * 单选框配置
1181 */
1182export interface TableRadioConfig {
1183 reserve?: boolean;
1184 labelField?: string;
1185 checkRowKey?: string | number;
1186 checkMethod?(params: { row: RowInfo }): boolean;
1187 trigger?: 'default' | 'cell' | 'row';
1188 highlight?: boolean;
1189}
1190export interface RadioConfig extends TableRadioConfig {}
1191
1192/**
1193 * 复选框配置项
1194 */
1195export interface TableCheckboxConfig {
1196 reserve?: boolean;
1197 labelField?: string;
1198 checkField?: string;
1199 halfField?: string;
1200 showHeader?: boolean;
1201 checkAll?: boolean;
1202 checkRowKeys?: string[] | number[];
1203 checkStrictly?: boolean;
1204 strict?: boolean;
1205 checkMethod?(params: { row: RowInfo }): boolean;
1206 trigger?: 'default' | 'cell' | 'row';
1207 highlight?: boolean;
1208 range?: boolean;
1209}
1210export interface CheckboxConfig extends TableCheckboxConfig {}
1211
1212/**
1213 * 提示信息配置项
1214 */
1215export interface TableTooltipConfig {
1216 enabled?: boolean;
1217 theme?: 'dark' | 'light';
1218 enterable?: boolean;
1219 leaveDelay?: number;
1220 contentMethod?(params: { items: any[], row: RowInfo, rowIndex: number, $rowIndex: number, column: ColumnInfo, columnIndex: number, $columnIndex: number, type: 'header' | 'body' | 'footer', cell: HTMLElement, $event: any }): string | null | void;
1221}
1222export interface TooltipConfig extends TableTooltipConfig {}
1223
1224/**
1225 * 展开行配置项
1226 */
1227export interface TableExpandConfig {
1228 labelField?: string;
1229 expandAll?: boolean;
1230 expandRowKeys?: string[] | number[];
1231 accordion?: boolean;
1232 trigger?: 'default' | 'cell' | 'row';
1233 lazy?: boolean;
1234 loadMethod?(params: { row: RowInfo, rowIndex: number, $rowIndex: number }): Promise<any>;
1235 toggleMethod?(params: { expanded: boolean, row: RowInfo, column: ColumnInfo, columnIndex: number, $columnIndex: number }): boolean;
1236 visibleMethod?(params: { expanded: boolean, row: RowInfo, column: ColumnInfo, columnIndex: number, $columnIndex: number }): boolean;
1237 showIcon?: boolean;
1238 iconOpen?: string;
1239 iconClose?: string;
1240 iconLoaded?: string;
1241}
1242export interface ExpandConfig extends TableExpandConfig {}
1243
1244/**
1245 * 树形结构配置项
1246 */
1247export interface TableTreeConfig {
1248 children?: string;
1249 indent?: number;
1250 line?: boolean;
1251 expandAll?: boolean;
1252 expandRowKeys?: string[] | number[];
1253 accordion?: boolean;
1254 trigger?: 'default' | 'cell' | 'row';
1255 lazy?: boolean;
1256 hasChild?: string;
1257 loadMethod?(params: { row: RowInfo }): Promise<any[]>;
1258 toggleMethod?(params: { expanded: boolean, row: RowInfo, column: ColumnInfo, columnIndex: number, $columnIndex: number }): boolean;
1259 showIcon?: boolean;
1260 iconOpen?: string;
1261 iconClose?: string;
1262 iconLoaded?: string;
1263}
1264export interface TreeConfig extends TableTreeConfig {}
1265
1266export interface TreeOpts {
1267 children: string;
1268 indent: number;
1269 line?: boolean;
1270 expandAll?: boolean;
1271 expandRowKeys?: string[] | number[];
1272 accordion?: boolean;
1273 trigger?: 'default' | 'cell' | 'row';
1274 lazy?: boolean;
1275 hasChild: string;
1276 loadMethod?(params: { row: RowInfo }): Promise<any[]>;
1277 toggleMethod?(params: { expanded: boolean, row: RowInfo, column: ColumnInfo, columnIndex: number, $columnIndex: number }): boolean;
1278 showIcon: boolean;
1279 iconOpen: string;
1280 iconClose: string;
1281 iconLoaded: string;
1282}
1283
1284/**
1285 * 快捷菜单配置项
1286 */
1287export interface TableMenuConfig {
1288 header?: MenuOptions;
1289 body?: MenuOptions;
1290 footer?: MenuOptions;
1291 trigger?: 'default' | 'cell';
1292 visibleMethod?(params: { type: string, options: MenuFirstOption[], columns: ColumnInfo[], row?: RowInfo, rowIndex?: number, column?: ColumnInfo, columnIndex?: number }): boolean;
1293 className?: string;
1294}
1295export interface TableContextMenu extends TableMenuConfig {}
1296export interface ContextMenuConfig extends TableContextMenu {}
1297
1298/**
1299 * 鼠标配置项
1300 */
1301export interface TableMouseConfig {
1302 selected?: boolean;
1303 /**
1304 * 如果功能被支持,则开启单元格区域选取功能,非连续的区域,按住 Ctrl 键,用鼠标逐一选取
1305 */
1306 area?: boolean;
1307}
1308export interface MouseConfig extends TableMouseConfig {}
1309
1310export interface MouseCellArea {
1311 main: boolean;
1312 rows: RowInfo[];
1313 cols: ColumnInfo[];
1314 top: number;
1315 left: number;
1316 width: number;
1317 height: number;
1318}
1319
1320export type CELL_AREA_TYPE = 'main' | 'copy' | 'extend' | 'multi' | 'active'
1321
1322export interface CellAreaConfig {
1323 type?: CELL_AREA_TYPE;
1324 startColumn: ColumnInfo;
1325 endColumn: ColumnInfo;
1326 startRow: RowInfo;
1327 endRow: RowInfo;
1328}
1329
1330export interface TableMergeConfig {
1331 row: RowInfo | number;
1332 col: ColumnInfo | number;
1333 rowspan: number;
1334 colspan: number;
1335}
1336export interface MergeOptions extends TableMergeConfig {}
1337
1338export interface MergeItem {
1339 row: number;
1340 col: number;
1341 rowspan: number;
1342 colspan: number;
1343 [key: string]: any;
1344}
1345
1346/**
1347 * 按键配置项
1348 */
1349export interface TableKeyboardConfig {
1350 /**
1351 * 是否开启非编辑状态下,上下左右移动功能
1352 */
1353 isArrow?: boolean;
1354 /**
1355 * 是否开启删除键功能
1356 */
1357 isDel?: boolean;
1358 /**
1359 * 是否开启回车移动上下行移动
1360 */
1361 isEnter?: boolean;
1362 /**
1363 * 是否开启TAB键左右移动功能
1364 */
1365 isTab?: boolean;
1366 /**
1367 * 是否开启单元格选择编辑
1368 */
1369 isEdit?: boolean;
1370 /**
1371 * 用于 mouse-config.area,开启复制/剪贴/粘贴功能
1372 */
1373 isClip?: boolean;
1374 /**
1375 * 用于 mouse-config.area & column.type=checkbox|radio,开启空格键切换复选框或单选框状态功能
1376 */
1377 isChecked?: boolean;
1378 /**
1379 * 用于 mouse-config.area,是否将回车键行为改成 Tab 键行为
1380 */
1381 enterToTab?: boolean;
1382 /**
1383 * 只对 isEdit=true 有效,用于重写选中编辑处理逻辑,可以返回 false 来阻止默认行为
1384 */
1385 editMethod?(params: { row: RowInfo, rowIndex: number, column: ColumnInfo, columnIndex: number, cell: HTMLElement }): boolean;
1386}
1387export interface KeyboardConfig extends TableKeyboardConfig {}
1388
1389/**
1390 * 复制粘贴配置项
1391 */
1392export interface TableClipConfig {
1393 getMethod?(params: {
1394 row: any;
1395 column: ColumnInfo;
1396 }): string;
1397 beforeGetMethod?(params: {
1398 targetAreas: any[];
1399 }): boolean;
1400 setMethod?(params: {
1401 row: any,
1402 column: ColumnInfo;
1403 cellValue: any;
1404 }): void;
1405 beforeSetMethod?(params: {
1406 currentAreas: any[];
1407 targetAreas: any[];
1408 cellValues: any[][];
1409 }): boolean;
1410}
1411
1412/**
1413 * 编辑配置项
1414 */
1415export interface TableEditConfig {
1416 trigger?: 'manual' | 'click' | 'dblclick';
1417 mode?: string;
1418 showIcon?: boolean;
1419 showStatus?: boolean;
1420 autoClear?: boolean;
1421 /**
1422 * 该方法的返回值用来决定该单元格是否允许编辑
1423 */
1424 activeMethod?(params: { row: RowInfo, rowIndex: number, column: ColumnInfo, columnIndex: number }): boolean;
1425}
1426export interface EditConfig extends TableEditConfig {}
1427
1428/**
1429 * 校验配置项
1430 */
1431export interface TableValidConfig {
1432 autoPos?: boolean;
1433 message?: string;
1434 maxWidth?: number;
1435}
1436export interface ValidConfig extends TableValidConfig {}
1437
1438/**
1439 * 校验规则配置项
1440 */
1441export interface EditVaildRules {
1442 [field: string]: ColumnEditRule[];
1443}
1444export interface VaildRules extends EditVaildRules {}