From 53adffaceb8220d743efa1f7b8b179ac81f9918f Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Wed, 15 Nov 2023 15:47:25 +0800 Subject: [PATCH] feat: add cellKeydown #179 --- core | 2 +- src/doc/api.en-US.md | 13 +++++++++++++ src/doc/api.zh-CN.md | 13 +++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/core b/core index 7a5dae8..17553da 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 7a5dae8c5d944580a06324dbd31136987c7d7cae +Subproject commit 17553da44cc0c79356e39df573b07bf4a37970ea diff --git a/src/doc/api.en-US.md b/src/doc/api.en-US.md index fb68e31..692aa91 100644 --- a/src/doc/api.en-US.md +++ b/src/doc/api.en-US.md @@ -72,6 +72,7 @@ | resizeColumn | Triggered when the column is dragged. If you do not need to automatically change the width internally, you can return `false` | Function(width, column, action: 'start' \| 'move' \| 'end' ) => boolean \| void | 2.0.3 | | rowDragEnd | Triggered when the dragged row ends | (opt: [DragRowEventInfo](#dragroweventinfo)) => boolean \| Promise \| void | 2.1.0 | | columnDragEnd | Triggered when the drag column ends | (opt: [DragColumnEventInfo](#dragcolumneventinfo)) => boolean \| Promise \| void | 2.1.1 | +| cellKeydown | Cell keyboard event, when false is returned, internal processing of the component will be skipped, such as left and right switching, etc. | (event: KeyboardEvent, opt: [KeydownPayload](#keydownpayload)) => void | 4.2.1 | ### Method @@ -109,6 +110,18 @@ export interface AppendCellRange { } ``` +### KeydownPayload + +```ts +export interface KeydownPayload { + cellPosition: { + rowIndex: number; + column: Column; + }; + isEditing: boolean; +} +``` + #### customRow usage Same as `customRow` `customCell` `customHeaderCell`. Follow [Vue jsx](https://github.com/vuejs/babel-plugin-transform-vue-jsx) syntax。 diff --git a/src/doc/api.zh-CN.md b/src/doc/api.zh-CN.md index 0bea5c8..c0cfd5e 100644 --- a/src/doc/api.zh-CN.md +++ b/src/doc/api.zh-CN.md @@ -97,6 +97,7 @@ setConfig(config: { | resizeColumn | 拖动列时触发, 如果不需要内部自动更改宽度,可以返回 `false` | Function(width, column, action: 'start' \| 'move' \| 'end' ) => boolean \| void | 2.0.3 | | rowDragEnd | 拖拽行结束时触发 | (opt: [DragRowEventInfo](#dragroweventinfo)) => boolean \| Promise \| void | 2.1.0 | | columnDragEnd | 拖拽列结束时触发 | (opt: [DragColumnEventInfo](#dragcolumneventinfo)) => boolean \| Promise \| void | 2.1.1 | +| cellKeydown | 单元格键盘事件, 返回 false 时,将跳过组件内部处理,如左右切换等 | (event: KeyboardEvent, params: [KeydownPayload](#keydownpayload)) => void | 4.2.1 | ### 方法 @@ -136,6 +137,18 @@ export interface AppendCellRange { } ``` +### KeydownPayload + +```ts +export interface KeydownPayload { + cellPosition: { + rowIndex: number; + column: Column; + }; + isEditing: boolean; +} +``` + #### customRow 用法 适用于 `customRow` `customCell` `customHeaderCell`。遵循[Vue jsx](https://github.com/vuejs/babel-plugin-transform-vue-jsx)语法。