diff --git a/common/changes/@visactor/vtable/fix-click-edit-state-handling_2025-05-08-11-38.json b/common/changes/@visactor/vtable/fix-click-edit-state-handling_2025-05-08-11-38.json new file mode 100644 index 0000000000..47cd7ddf34 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-click-edit-state-handling_2025-05-08-11-38.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: unintended edit state activation on functional button clicks\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file diff --git a/packages/vtable/src/edit/edit-manager.ts b/packages/vtable/src/edit/edit-manager.ts index ef4ebe7ebe..c8993f1393 100644 --- a/packages/vtable/src/edit/edit-manager.ts +++ b/packages/vtable/src/edit/edit-manager.ts @@ -6,6 +6,7 @@ import { getCellEventArgsSet } from '../event/util'; import type { SimpleHeaderLayoutMap } from '../layout'; import { isPromise } from '../tools/helper'; import { isValid } from '@visactor/vutils'; +import type { IIconGraphicAttribute } from '../scenegraph/graphic/icon'; export class EditManager { table: BaseTableAPI; @@ -43,6 +44,10 @@ export class EditManager { // 如果是双击自动列宽 则编辑不开启 return; } + if ((e.target?.attribute as IIconGraphicAttribute)?.funcType) { + // 点击功能图标不进入编辑 + return; + } this.beginTriggerEditCellMode = 'doubleclick'; this.startEditCell(col, row); }); @@ -50,6 +55,10 @@ export class EditManager { const clickEventId = table.on(TABLE_EVENT_TYPE.CLICK_CELL, e => { const { editCellTrigger = 'doubleclick' } = table.options; if (editCellTrigger === 'click' || (Array.isArray(editCellTrigger) && editCellTrigger.includes('click'))) { + if ((e.target?.attribute as IIconGraphicAttribute)?.funcType) { + // 点击功能图标不进入编辑 + return; + } this.beginTriggerEditCellMode = 'click'; const { col, row } = e; this.startEditCell(col, row);