From 5d516d1d95c9db74db25eeb0390f56b6e98ff762 Mon Sep 17 00:00:00 2001 From: shufufufu Date: Tue, 23 Dec 2025 13:37:36 +0800 Subject: [PATCH 1/6] fix: fix the issue with second-level display length --- packages/vtable-gantt/src/Gantt.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/vtable-gantt/src/Gantt.ts b/packages/vtable-gantt/src/Gantt.ts index 5cc41362d3..695e803c8a 100644 --- a/packages/vtable-gantt/src/Gantt.ts +++ b/packages/vtable-gantt/src/Gantt.ts @@ -924,9 +924,17 @@ export class Gantt extends EventTarget { startDate = createDateAtMidnight( Math.min(Math.max(this.parsedOptions._minDateTime, rawDateStartDateTime), this.parsedOptions._maxDateTime) ); + const rawEnd = taskRecord?.[endDateField]; + let hasTimeProvided = false; + if (typeof rawEnd === 'string') { + hasTimeProvided = /T|\d{2}:\d{2}/.test(rawEnd); + } else if (rawEnd instanceof Date || typeof rawEnd === 'number') { + hasTimeProvided = true; + } + const shouldForceMillisecond = !hasTimeProvided; endDate = createDateAtLastMillisecond( Math.max(Math.min(this.parsedOptions._maxDateTime, rawDateEndDateTime), this.parsedOptions._minDateTime), - true + shouldForceMillisecond ); // const minTimeSaleIsSecond = this.parsedOptions.reverseSortedTimelineScales[0].unit === 'second'; } else { From 8148629f5a42e00d8be00c2b307329aad125c2b4 Mon Sep 17 00:00:00 2001 From: shufufufu Date: Tue, 23 Dec 2025 22:32:01 +0800 Subject: [PATCH 2/6] docs: update changlog of rush --- .../vtable/fix-fix-secondsUnit_2025-12-23-14-32.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-fix-secondsUnit_2025-12-23-14-32.json diff --git a/common/changes/@visactor/vtable/fix-fix-secondsUnit_2025-12-23-14-32.json b/common/changes/@visactor/vtable/fix-fix-secondsUnit_2025-12-23-14-32.json new file mode 100644 index 0000000000..fec42511a0 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-fix-secondsUnit_2025-12-23-14-32.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix the issue with second-level display length\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "rem2248668357@163.com" +} \ No newline at end of file From e81fc6a1c1e9629c0bf5d018a0738556728b2139 Mon Sep 17 00:00:00 2001 From: shufufufu Date: Tue, 23 Dec 2025 22:38:47 +0800 Subject: [PATCH 3/6] fix: fix the issue with second-level display length --- packages/vtable-gantt/src/Gantt.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/vtable-gantt/src/Gantt.ts b/packages/vtable-gantt/src/Gantt.ts index 695e803c8a..d47afc62ad 100644 --- a/packages/vtable-gantt/src/Gantt.ts +++ b/packages/vtable-gantt/src/Gantt.ts @@ -924,7 +924,12 @@ export class Gantt extends EventTarget { startDate = createDateAtMidnight( Math.min(Math.max(this.parsedOptions._minDateTime, rawDateStartDateTime), this.parsedOptions._maxDateTime) ); + // 修复:当原始日期字符串已包含时分秒时,不应强制设置毫秒为999 + // 这会导致 '00:30:01' 变成 '00:30:01.999',使1秒任务显示为2秒 const rawEnd = taskRecord?.[endDateField]; + // 判断:是否“提供了时间部分” + // 字符串:包含 HH:MM(或 ISO 'T')即视为提供了时间; + // Date/number:视为已提供时间。 let hasTimeProvided = false; if (typeof rawEnd === 'string') { hasTimeProvided = /T|\d{2}:\d{2}/.test(rawEnd); From 6651c9b3b25c7bba0d27c807e26881fd9be299cd Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 25 Dec 2025 16:39:31 +0800 Subject: [PATCH 4/6] refactor: recognize millisecond for gantt taskbar --- packages/vtable-gantt/src/Gantt.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/vtable-gantt/src/Gantt.ts b/packages/vtable-gantt/src/Gantt.ts index d47afc62ad..5de83ccaf0 100644 --- a/packages/vtable-gantt/src/Gantt.ts +++ b/packages/vtable-gantt/src/Gantt.ts @@ -924,19 +924,18 @@ export class Gantt extends EventTarget { startDate = createDateAtMidnight( Math.min(Math.max(this.parsedOptions._minDateTime, rawDateStartDateTime), this.parsedOptions._maxDateTime) ); - // 修复:当原始日期字符串已包含时分秒时,不应强制设置毫秒为999 - // 这会导致 '00:30:01' 变成 '00:30:01.999',使1秒任务显示为2秒 + // 修复:当原始日期字符串已包含时毫秒时,不应强制设置毫秒为999 const rawEnd = taskRecord?.[endDateField]; - // 判断:是否“提供了时间部分” - // 字符串:包含 HH:MM(或 ISO 'T')即视为提供了时间; - // Date/number:视为已提供时间。 - let hasTimeProvided = false; + // 判断:是否"提供了毫秒部分" + // 字符串:检查是否包含毫秒(秒之后的小数点,如 :SS.SSS 或 :SS.SSSSSS) + // Date/number:视为已提供时间,但无法判断是否包含毫秒,保守处理为未提供 + let hasMillisecondProvided = false; if (typeof rawEnd === 'string') { - hasTimeProvided = /T|\d{2}:\d{2}/.test(rawEnd); - } else if (rawEnd instanceof Date || typeof rawEnd === 'number') { - hasTimeProvided = true; + // 匹配秒之后的小数点格式::SS.SSS 或 :SS.SSSSSS 等 + // 也匹配 ISO 格式:T12:30:45.123Z + hasMillisecondProvided = /:\d{2}\.\d+/.test(rawEnd); } - const shouldForceMillisecond = !hasTimeProvided; + const shouldForceMillisecond = !hasMillisecondProvided; endDate = createDateAtLastMillisecond( Math.max(Math.min(this.parsedOptions._maxDateTime, rawDateEndDateTime), this.parsedOptions._minDateTime), shouldForceMillisecond From c4b90822ee5483d59eef6a743e6610c2830b92f4 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 25 Dec 2025 16:39:58 +0800 Subject: [PATCH 5/6] docs: update changlog of rush --- .../fix-gantt-secondsUnit-parse_2025-12-25-08-39.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-gantt-secondsUnit-parse_2025-12-25-08-39.json diff --git a/common/changes/@visactor/vtable/fix-gantt-secondsUnit-parse_2025-12-25-08-39.json b/common/changes/@visactor/vtable/fix-gantt-secondsUnit-parse_2025-12-25-08-39.json new file mode 100644 index 0000000000..8b45c6d74c --- /dev/null +++ b/common/changes/@visactor/vtable/fix-gantt-secondsUnit-parse_2025-12-25-08-39.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "refactor: recognize millisecond for gantt taskbar\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From adef7a49fa55ec1d13ad2c7bd2a9fec01da2f932 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 26 Dec 2025 14:34:14 +0800 Subject: [PATCH 6/6] docs: update edit guide --- docs/assets/guide/en/edit/edit_cell.md | 7 +++++++ docs/assets/guide/zh/edit/edit_cell.md | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/docs/assets/guide/en/edit/edit_cell.md b/docs/assets/guide/en/edit/edit_cell.md index ca8e09db90..f08d9ee571 100644 --- a/docs/assets/guide/en/edit/edit_cell.md +++ b/docs/assets/guide/en/edit/edit_cell.md @@ -188,6 +188,8 @@ In the above example, we created a custom editor named `DateEditor` and implemen ```ts export interface IEditor { + /** Prepare the edit environment, when the edit trigger is keydown in vtable, the mouse click on the cell will call this method, otherwise the first character of the Chinese input method will be treated as an English character */ + prepareEdit?: (context: PrepareEditContext) => void; /** Called when cell enters edit mode. */ onStart?: (context: EditContext) => void; /** called when cell exits edit mode. */ @@ -331,6 +333,11 @@ The basic table supports editing the display title in the header. You can enable The source data corresponding to a specific cell can be obtained through the interface `getCellOriginRecord` + +## edit trigger timing is keydown notice + +If the first pinyin is recognized as an English character under the Chinese input method, please check if there is a prepareEdit function. When the edit trigger is keydown, the mouse click on the cell will call this method to create an input box in advance, and set the input box to invisible, waiting for user input. + ## Summary Through the above steps, you can create a table with editing functions, select the appropriate editor type according to business needs, customize the editor, listen to editing events, and obtain edited data. In this way, users can easily edit the data in the table, and you can process the edited data accordingly. diff --git a/docs/assets/guide/zh/edit/edit_cell.md b/docs/assets/guide/zh/edit/edit_cell.md index 82d331cd69..2790e1acd3 100644 --- a/docs/assets/guide/zh/edit/edit_cell.md +++ b/docs/assets/guide/zh/edit/edit_cell.md @@ -193,6 +193,8 @@ VTable.register.editor('custom-date', custom_date_editor); ```ts export interface IEditor { + /** 准备编辑环境,vtable中编辑时机eeditCellTrigger为keydown时,鼠标点击单元格将调用此方法,否则中文输入法第一个字符会被当做英文字符 */ + prepareEdit?: (context: PrepareEditContext) => void; /** * 单元格进入编辑状态时调用 */ onStart: (context: EditContext) => void; /** * 单元格退出编辑状态时调用 */ @@ -332,6 +334,9 @@ interface ListTableAPI { 具体单元格对应的源数据可以通过接口`getCellOriginRecord`来获取。 +## 编辑时机为keydown时注意事项 + 中文输入法下如果出现第一个拼音被识别成了英文字符,那么请检查是否有prepareEdit 函数。在编辑时机为keydown时,鼠标点击单元格将调用此方法,提前将创建输入框,并将输入框设置为不可见,等待用户输入。 + ## 总结 通过以上步骤,你可以创建一个具有编辑功能的表格,并根据业务需求选择合适的编辑器类型、自定义编辑器、监听编辑事件以及获取编辑后的数据。这样,用户就可以方便地编辑表格中的数据,并且你可以对编辑后的数据进行相应的处理。