-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(grid): [grid] Fix bug where dragging and dropping in the expanded state of the table cannot render correctly #2901
base: dev
Are you sure you want to change the base?
Conversation
WalkthroughThis change updates key assignment logic in the grid body component and refines drag-and-drop row handling. In the body component, key generation in Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant DragHandler as createHandlerOnEnd
participant Grid as Grid Component
User->>DragHandler: Ends drag event on row
DragHandler->>Grid: Retrieve target <tr> element's previous sibling
Grid-->>DragHandler: Return previousElementSibling
DragHandler->>DragHandler: Check if element has 'tiny-grid-body__expanded-row' class
DragHandler->>Grid: If expanded, retrieve its previous sibling
DragHandler->>DragHandler: Validate drag operation (prevent self-child insertion)
DragHandler-->>User: Finalize drag-and-drop operation
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
packages/vue/src/grid/src/body/src/body.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. packages/vue/src/grid/src/dragger/src/rowDrop.tsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (4)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Walkthrough此PR修复了在表格展开状态下拖拽无法正确渲染的问题。主要修改包括调整表格行的 Changes
|
WalkthroughThis PR fixes the issue where dragging and dropping cannot render correctly when the table is expanded. The main modifications include adjusting the Changes
|
@@ -897,7 +897,8 @@ export default defineComponent({ | |||
render() { | |||
let { $parent: $table } = this as any | |||
let { $grid, isCenterEmpty, keyboardConfig = {}, mouseConfig = {}, renderEmpty } = $table | |||
let { scrollLoad, tableColumn, tableData, tableLayout } = $table | |||
let { scrollLoad, tableColumn, tableLayout } = $table | |||
const tableData = $table.$grid.data || $table.tableData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处不应该修改,在编辑场景,$table.$grid.data是旧数据,$table.tableData是表格内置数据,两者是不一样的。拖拽的主要问题是因为key
@@ -608,7 +608,7 @@ function renderRowExpanded(args) { | |||
'tr', | |||
{ | |||
class: 'tiny-grid-body__expanded-row', | |||
key: `expand_${rowid}`, | |||
key: `expand_${rowid}${rowIndex}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要再加Index了吧,rowid已经可以正确区分key了。
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #1995
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit