优化 setEditRow 方法支持指定列

This commit is contained in:
xuliangzhan
2023-11-16 09:29:27 +08:00
parent ea95118ea9
commit acca5465bd
4 changed files with 12 additions and 5 deletions

View File

@@ -574,9 +574,13 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
/**
* 激活行编辑
*/
setEditRow (row) {
setEditRow (row, fieldOrColumn) {
const { visibleColumn } = internalData
return $xetable.setEditCell(row, XEUtils.find(visibleColumn, column => isEnableConf(column.editRender)))
let column: any = XEUtils.find(visibleColumn, column => isEnableConf(column.editRender))
if (fieldOrColumn) {
column = XEUtils.isString(fieldOrColumn) ? $xetable.getColumnByField(fieldOrColumn) : fieldOrColumn
}
return $xetable.setEditCell(row, column)
},
setActiveCell (row, fieldOrColumn) {
// if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {

View File

@@ -6,7 +6,8 @@ export default defineComponent({
name: 'VxeIcon',
props: {
name: String as PropType<VxeIconPropTypes.Name>,
roll: Boolean as PropType<VxeIconPropTypes.Roll>
roll: Boolean as PropType<VxeIconPropTypes.Roll>,
status: String as PropType<VxeIconPropTypes.Status>
},
emits: [
'click'

4
types/edit.d.ts vendored
View File

@@ -135,10 +135,10 @@ export interface TableEditMethods<D = VxeTableDataRow> {
*/
setActiveRow(row: any): Promise<void>
/**
* 用于 edit-config激活行编辑并激活第一个单元格
* 用于 edit-config激活行编辑并默认激活第一个列,也可以指定列
* @param row 指定行
*/
setEditRow(row: any): Promise<void>
setEditRow(row: any, fieldOrColumn?: string | VxeTableDefines.ColumnInfo<any>): Promise<void>
/**
* 请使用 setEditCell
* @deprecated

2
types/icon.d.ts vendored
View File

@@ -25,11 +25,13 @@ export interface VxeIconMethods extends IconMethods { }
export type VxeIconProps<D = any> = {
name?: VxeIconPropTypes.Name
roll?: VxeIconPropTypes.Roll
status?: VxeIconPropTypes.Status
}
export namespace VxeIconPropTypes {
export type Name = string
export type Roll = boolean
export type Status = string
}
export type VxeIconEmits = [