Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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"
}
7 changes: 7 additions & 0 deletions docs/assets/guide/en/edit/edit_cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ In the above example, we created a custom editor named `DateEditor` and implemen

```ts
export interface IEditor<V = any> {
/** 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<V>) => void;
/** Called when cell enters edit mode. */
onStart?: (context: EditContext<V>) => void;
/** called when cell exits edit mode. */
Expand Down Expand Up @@ -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.
5 changes: 5 additions & 0 deletions docs/assets/guide/zh/edit/edit_cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ VTable.register.editor('custom-date', custom_date_editor);

```ts
export interface IEditor<V = any> {
/** 准备编辑环境,vtable中编辑时机eeditCellTrigger为keydown时,鼠标点击单元格将调用此方法,否则中文输入法第一个字符会被当做英文字符 */
prepareEdit?: (context: PrepareEditContext<V>) => void;
/** * 单元格进入编辑状态时调用 */
onStart: (context: EditContext<V>) => void;
/** * 单元格退出编辑状态时调用 */
Expand Down Expand Up @@ -332,6 +334,9 @@ interface ListTableAPI {

具体单元格对应的源数据可以通过接口`getCellOriginRecord`来获取。

## 编辑时机为keydown时注意事项
中文输入法下如果出现第一个拼音被识别成了英文字符,那么请检查是否有prepareEdit 函数。在编辑时机为keydown时,鼠标点击单元格将调用此方法,提前将创建输入框,并将输入框设置为不可见,等待用户输入。

## 总结

通过以上步骤,你可以创建一个具有编辑功能的表格,并根据业务需求选择合适的编辑器类型、自定义编辑器、监听编辑事件以及获取编辑后的数据。这样,用户就可以方便地编辑表格中的数据,并且你可以对编辑后的数据进行相应的处理。
14 changes: 13 additions & 1 deletion packages/vtable-gantt/src/Gantt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,9 +924,21 @@ export class Gantt extends EventTarget {
startDate = createDateAtMidnight(
Math.min(Math.max(this.parsedOptions._minDateTime, rawDateStartDateTime), this.parsedOptions._maxDateTime)
);
// 修复:当原始日期字符串已包含时毫秒时,不应强制设置毫秒为999
const rawEnd = taskRecord?.[endDateField];
// 判断:是否"提供了毫秒部分"
// 字符串:检查是否包含毫秒(秒之后的小数点,如 :SS.SSS 或 :SS.SSSSSS)
// Date/number:视为已提供时间,但无法判断是否包含毫秒,保守处理为未提供
let hasMillisecondProvided = false;
if (typeof rawEnd === 'string') {
// 匹配秒之后的小数点格式::SS.SSS 或 :SS.SSSSSS 等
// 也匹配 ISO 格式:T12:30:45.123Z
hasMillisecondProvided = /:\d{2}\.\d+/.test(rawEnd);
}
const shouldForceMillisecond = !hasMillisecondProvided;
endDate = createDateAtLastMillisecond(
Math.max(Math.min(this.parsedOptions._maxDateTime, rawDateEndDateTime), this.parsedOptions._minDateTime),
true
shouldForceMillisecond
);
// const minTimeSaleIsSecond = this.parsedOptions.reverseSortedTimelineScales[0].unit === 'second';
} else {
Expand Down
Loading