[Bug] 复制粘贴监听paste事件后,使用了changeCellValues来更新数据,数据量大时性能比较差,希望可以让用户拿到paste数据后,自己来处理数据更新的部分,现在也没法拦截事件冒泡
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 486
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 16
Description
Version
当前版本
Link to Minimal Reproduction
官方示例可重现
Steps to Reproduce
表格复制粘贴很多条数据,例如50行,12列单元格,因为官方监听了paste事件后,使用changeCellValues来更新数据的,这个api相比updateRecords性能会差很多,用updateRecords,50行数据,大概2秒就可以更新完,但是changeCellValues,大概需要20秒,所以希望可以自己监听到paste事件后,阻止冒泡,自己处理ctrl + v,目前没法做到:
table.getElement().addEventListener('paste', (e) => { console.log('event触发粘贴==', e); e.stopPropagation(); e.preventDefault(); }
以上代码并不能阻止源码里面:
handler.on(table.getElement(), 'paste', async (e: any) => {
const changedCellResults = await (table as ListTableAPI).changeCellValues(col, row, values);
}的触发,还是会造成每个单元格触发change事件。
希望可以让用户有自己监听ctrl + v处理的机会。
Current Behavior
官方ctrl + v的监听处理,使用changeCellValues性能比较差,希望可以提供给用户自定义更新数据的方法
Expected Behavior
希望可以用户自定义处理数据。
Environment
- OS:
- Browser:
- Framework:
Any additional comments?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the paste listener attached to table.getElement and trace how it invokes changeCellValues, comparing it with the updateRecords path described in the report. The work is complete when users have an interception or custom-handling point for pasted data and the built-in per-cell updates can be avoided, using the reported 50-by-12 paste scenario to verify behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100