Skip to content

Conversation

@Gino2333
Copy link

🤔 This is a ...

  • New feature
  • Bug fix
  • Performance optimization
  • Enhancement feature
  • TypeScript definition update
  • Test Case
  • Site / documentation update
  • Chore
  • Branch merge

🔗 Related issue link

💡 Background and solution

本 PR 汇总最近 22 次提交,聚焦在「数据操作能力增强 + 事件触发可控 + 过滤场景数据插入修复 + 搜索高亮性能优化」,并同步补齐类型/示例/测试与发布日志。

  • 数据源同步能力增强:新增 syncRecordOperationsToSourceRecords ,支持把增删改等操作同步回传入的源 records(并在过滤生效时重建过滤/排序状态)。
  • 表格数据操作事件可控: addRecord/addRecords/deleteRecords/updateRecords 增加 triggerEvent 控制是否触发对应事件( add_record/delete_record/update_record )。
  • 单元格修改能力增强:
    • 新增基于 recordIndex/field 的改单元格与批量改值 API: changeCellValueByRecord / changeCellValuesByRecords (并提供 changeCellValueBySource / changeCellValuesBySource 便捷调用)。
    • changeCellValue/changeCellValues/changeCellValuesByIds 增加 silentChangeCellValuesEvent ,用于抑制批量事件 change_cell_values (保留单点事件 change_cell_value )。
  • 过滤场景修复:修复“过滤状态下新增记录位置错误”,并补充相应测试与示例覆盖。
  • 搜索性能优化:SearchComponent 高亮更新改为批量写入自定义样式安排并按需刷新单元格内容,降低频繁搜索/跳转时的样式更新开销。
  • 其他:修复编辑 prepareEdit 的时序/状态问题;更新 README / release log / rush changelog 等文档与变更记录。

📝 Changelog

Language Changelog 🇺🇸 English Enhance ListTable data operations: add syncRecordOperationsToSourceRecords , make record CRUD events optional via triggerEvent , introduce recordIndex-based cell update APIs, add silentChangeCellValuesEvent to suppress change_cell_values , fix wrong insert position under filtering, and optimize search highlight latency. Update typings, tests, examples, and docs/release logs. 🇨🇳 Chinese 增强 ListTable 数据操作能力:新增 syncRecordOperationsToSourceRecords 支持操作同步到源数据;增删改记录接口新增 triggerEvent 控制事件触发;新增基于 recordIndex 的单元格改值/批量改值 API,并新增 silentChangeCellValuesEvent 用于抑制 change_cell_values ;修复过滤状态下新增记录位置错误;优化搜索高亮更新延迟。同步更新类型、测试、示例与发布/文档记录。

☑️ Self-Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

  • 新增 syncRecordOperationsToSourceRecords ,支持将增删改同步回源 records,并在过滤场景下保持插入位置与视图一致
  • 增删改记录 API 增加 triggerEvent ,可选择性触发 add_record/delete_record/update_record
  • 新增基于 recordIndex 的改值 API(单个/批量),并新增 silentChangeCellValuesEvent 以抑制 change_cell_values
  • 修复过滤状态下新增记录位置错误,补充对应测试与示例
  • 优化搜索组件高亮更新路径,降低搜索/跳转时的样式刷新开销

🔍 Walkthrough

copilot:walkthrough

  1. 数据源层:为 add/delete/update 等操作增加“是否同步到源 records”的分支处理,并在过滤生效时做视图索引到原始索引的映射与状态重建。
  2. 表格 API 层:
    • 记录增删改接口增加 triggerEvent ,只在需要时派发记录事件;
    • 增加 recordIndex/field 维度的改单元格与批量改值能力,并提供自动刷新与事件静默选项;
    • 原坐标改值接口支持 silentChangeCellValuesEvent ,减少批量事件带来的监听开销。
  3. 搜索组件:高亮更新改为批量安排自定义样式并按需刷新单元格内容,减少逐项调用带来的耗时。

zhanghao.gino and others added 22 commits December 30, 2025 21:07
允许 triggerEvent 参数接受 'change_cell_values' 字符串值,用于精确控制是否触发 CHANGE_CELL_VALUES 事件
为addRecord、addRecords、deleteRecords和updateRecords方法添加triggerEvent可选参数
当triggerEvent为false时,不触发对应的事件通知
…es_change

Feat/support cell values change
添加syncRecordOperationsToSourceRecords配置选项,当设置为true时,表格的增删改操作会同步到原始records数组
修改DataSource类实现源数据同步逻辑,包括添加、删除和更新记录时对原始数据的处理
添加相关测试用例验证同步功能
在示例中添加同步选项的UI控制
silentChangeCellValuesEvent?: boolean
) => Promise<boolean[][]> | boolean[][];
changeCellValueByRecord: (
recordIndex: number | number[],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是对应原始records的index吧

silentChangeCellValuesEvent?: boolean
) => void;
changeCellValuesBySource: (
changeValues: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有了syncto的配置 这两个接口可以去掉

/** 删除能力是否只应用到可编辑单元格 */
deleteWorkOnEditableCell?: boolean;
/** 删除范围时聚合成一次 change_cell_values 事件 */
aggregateDeleteToOneChangeCellValuesEvent?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

batchCallChangeCellValuesApi

value: string | number | null,
workOnEditableCell?: boolean,
triggerEvent?: boolean,
silentChangeCellValuesEvent?: boolean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noTriggerChangeCellValuesEvent

} = { clearRowHeightCache: true }
) {
this.scenegraph.clearCells();
(this.dataSource as any).clearForceVisibleRecords?.();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clear和create map对象的地方请写明接口适用场景和背景

@@ -0,0 +1,11 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新增的配置和接口 请同步更新到docs官网中

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants