Files
vxe-table/types/edit.d.ts
xuliangzhan 04083ef71e 优化表单
2022-05-28 23:50:24 +08:00

161 lines
4.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { VXEComponent, RecordInfo } from './component'
import { VxeTableDefines } from './table'
/**
* 表格扩展 - 编辑
*/
export const Edit: VXEComponent<{}>
export interface TableEditMethods {
/**
* 往表格插入临时数据,从第一行新增一行或多行新数据
* @param records 新数据
*/
insert(records: RecordInfo | RecordInfo[]): Promise<{ row: any, rows: any[] }>
/**
* 往表格指定行中插入临时数据
* 如果 row 为空则从插入到顶部,如果为树结构,则插入到目标节点顶部
* 如果 row 为 -1 则从插入到底部,如果为树结构,则插入到目标节点底部
* 如果 row 为有效行则插入到该行的位置,如果为树结构,则有插入到效的目标节点该行的位置
* @param {Object/Array} records 新的数据
* @param {Row} row 指定行
*/
insertAt(records: RecordInfo | RecordInfo[], row: any | -1 | null): Promise<{ row: any, rows: any[] }>
/**
* 删除指定行数据,指定 row 或 [row, ...] 删除多条数据,如果为空则删除所有数据
* @param rows 指定行
*/
remove(rows?: any | any[]): Promise<{ row: any, rows: any[] }>
/**
* 删除复选框选中的行数据
*/
removeCheckboxRow(): Promise<{ row: any, rows: any[] }>
/**
* 删除单选框选中的行数据
*/
removeRadioRow(): Promise<{ row: any, rows: any[] }>
/**
* 删除当前行选中的行数据
*/
removeCurrentRow(): Promise<{ row: any, rows: any[] }>
/**
* 获取表格数据集
* 获取新增、删除、更改的数据
*/
getRecordset(): {
insertRecords: any[]
removeRecords: any[]
updateRecords: any[]
}
/**
* 用于 edit-config获取新增的临时数据
*/
getInsertRecords(): any[]
/**
* 获取已删除的数据
*/
getRemoveRecords(): any[]
/**
* 用于 edit-config获取已修改的数据
*/
getUpdateRecords(): any[]
/**
* 请使用 getEditRecord
* @deprecated
*/
getActiveRecord(): {
row: any
rowIndex: number
$rowIndex: number
column: VxeTableDefines.ColumnInfo
columnIndex: number
$columnIndex: number
cell: HTMLElement
}
/**
* 用于 edit-config获取已激活的行数据
*/
getEditRecord(): {
row: any
rowIndex: number
$rowIndex: number
column: VxeTableDefines.ColumnInfo
columnIndex: number
$columnIndex: number
cell: HTMLElement
}
/**
* 用于 mouse-config.selected获取选中的单元格信息
*/
getSelectedCell(): {
row: any
column: VxeTableDefines.ColumnInfo
}
/**
* 请使用 clearEdit
* @deprecated
*/
clearActived(evnt?: Event): Promise<any>
/**
* 手动清除单元格激活状态
*/
clearEdit(evnt?: Event): Promise<any>
/**
* 手动清除单元格选中状态
*/
clearSelected(): Promise<any>
/**
* 请使用 isEditByRow
* @deprecated
*/
isActiveByRow(row: any): boolean
/**
* 用于 edit-config判断行是否为激活编辑状态
* @param row 指定行
*/
isEditByRow(row: any): boolean
/**
* 请使用 setEditRow
* @deprecated
*/
setActiveRow(row: any): Promise<any>
/**
* 用于 edit-config激活行编辑并激活第一个单元格
* @param row 指定行
*/
setEditRow(row: any): Promise<any>
/**
* 请使用 setEditCell
* @deprecated
*/
setActiveCell(row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo): Promise<any>
/**
* 用于 edit-config激活单元格编辑
* @param row 指定行
* @param field 字段名
*/
setEditCell(row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo): Promise<any>
/**
* 用于 mouse-config.mouse-config选中某个单元格
* @param row 指定行
* @param field 字段名
*/
setSelectCell(row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo): Promise<any>
}
export interface TableEditPrivateMethods {
handleActived(params: any, evnt?: any): Promise<any>
handleFocus(params: any, evnt?: any): void
handleSelected(params: any, evnt: any): Promise<any>
addCellSelectedClass(): void
}
declare module './grid' {
interface VxeGridMethods extends TableEditMethods { }
}
declare module './table' {
interface VxeTableMethods extends TableEditMethods { }
interface VxeTablePrivateMethods extends TableEditPrivateMethods { }
}