Skip to content

Conversation

@gausszhou
Copy link
Contributor

@gausszhou gausszhou commented Dec 18, 2025

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

不支持设置 headerDragable 属性

Issue Number: N/A

What is the new behavior?

支持设置 headerDragable 属性

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

其实这里 Dragable 是个错别字,为了和旧 API footerDragale 风格保持一致,将错就错。

Summary by CodeRabbit

  • New Features

    • Added a header-dragable option to modals to control whether the header can be dragged (enabled by default).
  • Changes

    • Footer dragging now disabled by default.
    • Alert/example usage updated to disable header dragging for alert modals.
  • Documentation

    • Modal docs updated to describe header-dragable and footer-dragable behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the enhancement New feature or request (功能增强) label Dec 18, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

Adds a new headerDragable prop to the modal (core default true), conditions header mousedown binding, updates API docs and demos, and sets the API footer-dragable default to false.

Changes

Cohort / File(s) Summary
Core Modal Component Implementation
packages/vue/src/modal/src/index.ts, packages/vue/src/modal/src/pc.vue
Added headerDragable prop (Boolean, default: true) to modalProps; header mousedown binding now conditional: mousedown: this.headerDragable ? this.mousedownEvent : () => {}.
API Definition
examples/sites/demos/apis/modal.js
Introduced public prop header-dragable (boolean, default: true) with localized descriptions; changed footer-dragable defaultValue from true to false.
Demo Implementation
examples/sites/demos/pc/app/modal/modal-header.vue
Demo usage updated to explicitly disable header drag: header-dragable="false" on TinyModal, and Modal.alert call now includes headerDragable: false.
Documentation / Webdoc
examples/sites/demos/pc/app/modal/webdoc/modal.js
Added header-dragable docs (zh-CN / en-US), migrated/renamed footer drag docs to footer-dragable, adjusted descriptions and formatting to reflect new props and defaults.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰
A tiny hop, a gentle pull—now headers may roam or stay,
A prop to choose, a demo set, I fiddle in the play.
I tweak the docs, I bind the mouse, then nibble on a carrot—cheer!
Modal moves when you command; the rabbit's work is clear. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding support for the headerDragable property to the modal component, which is reflected across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35e9403 and efe2045.

📒 Files selected for processing (5)
  • examples/sites/demos/apis/modal.js
  • examples/sites/demos/pc/app/modal/modal-header.vue
  • examples/sites/demos/pc/app/modal/webdoc/modal.js
  • packages/vue/src/modal/src/index.ts
  • packages/vue/src/modal/src/pc.vue
🚧 Files skipped from review as they are similar to previous changes (3)
  • examples/sites/demos/apis/modal.js
  • packages/vue/src/modal/src/pc.vue
  • examples/sites/demos/pc/app/modal/modal-header.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (3)
examples/sites/demos/pc/app/modal/webdoc/modal.js (2)

80-81: Documentation accurately reflects the new feature.

The documentation correctly describes the header-dragable property and its default value of true, which matches the component definition in index.ts.


99-102: Footer drag documentation is clear and accurate.

The documentation for footer-dragable correctly states:

  • Default value is false (footer not draggable by default)
  • Explains that by default only the title bar is draggable
  • Consistent between Chinese (lines 99-102) and English (line 109) versions

This aligns with the component definition where footerDragable: Boolean defaults to false.

Also applies to: 109-109

packages/vue/src/modal/src/index.ts (1)

99-99: Verify that all modal documentation is consistent with headerDragable default value.

The headerDragable prop with default: true follows existing patterns and provides a reasonable UX default. To complete this review, verify that examples/sites/demos/apis/modal.js and all related webdoc files consistently document headerDragable with a default of true. This ensures the component definition matches the API documentation.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
examples/sites/demos/pc/app/modal/webdoc/modal.js (1)

79-87: Documentation inconsistency: default value conflict.

The Chinese documentation states the default value for header-dragable is true (line 81), which matches the component definition but conflicts with the API documentation in examples/sites/demos/apis/modal.js that specifies defaultValue: 'false'.

Additionally, the English translation (lines 84-87) is incomplete and doesn't mention the header-dragable property at all.

Action required:

  1. Align the default value documentation with the actual component behavior
  2. Add complete English translation for the header-dragable property
🔎 Update English documentation:
         'en-US': `
           Use the <code>show-header</code> property to set whether to display headers. The default value is <code>true</code><br>
+          Use the <code>header-dragable</code> property to set whether the header can be dragged. The default value is <code>true</code><br>
           Set the title of the window through the <code>title</code> property. <br>
         `
🧹 Nitpick comments (1)
packages/vue/src/modal/src/index.ts (1)

99-99: Fix misspelling: "Dragable" should be "Draggable"

This is not an intentional naming convention. Verification shows the entire codebase uses the correct "Draggable" spelling: tree, dialog-box, popeditor, toggle-menu, tabs, tree-menu, drawer, and 15+ other components all use "draggable". The modal component is the only outlier with the misspelled "dragable" variant.

Rename headerDragable to headerDraggable and footerDragable to footerDraggable across:

  • Component props in packages/vue/src/modal/src/index.ts
  • Template usage in packages/vue/src/modal/src/pc.vue
  • Demo files and API documentation
  • Type definitions
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 851cab3 and 35e9403.

📒 Files selected for processing (5)
  • examples/sites/demos/apis/modal.js (1 hunks)
  • examples/sites/demos/pc/app/modal/modal-header.vue (2 hunks)
  • examples/sites/demos/pc/app/modal/webdoc/modal.js (2 hunks)
  • packages/vue/src/modal/src/index.ts (1 hunks)
  • packages/vue/src/modal/src/pc.vue (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (4)
packages/vue/src/modal/src/pc.vue (2)

69-69: LGTM: Prop correctly added to component.

The headerDragable prop is properly included in the props array.


178-178: LGTM: Conditional drag behavior implemented correctly.

The mousedown handler is correctly bound conditionally based on the headerDragable prop value. When headerDragable is true, the header can be dragged via this.mousedownEvent; when false, an empty function disables dragging.

This implementation is consistent with the footerDragable pattern at line 289.

examples/sites/demos/pc/app/modal/webdoc/modal.js (1)

98-111: LGTM: footer-dragable documentation updated consistently.

The documentation correctly describes the footer-dragable property and its default value of false in both Chinese and English, with proper formatting and clear explanations.

examples/sites/demos/apis/modal.js (1)

116-125: Review the default value type for footer-dragable in the API documentation.

The footer-dragable property has defaultValue: 'false' as a string instead of the boolean false. The component prop definition in index.ts declares it as footerDragable: Boolean, so the API documentation should use a boolean value for consistency. Additionally, existing demos that use this feature (e.g., modal-footer.vue) explicitly set footerDragable: true, which suggests the documented default of false is intentional and already aligned with current behavior.

Comment on lines +10 to +18
<tiny-modal
v-model="show"
title="自定义弹窗标题"
message="窗口内容"
show-header
show-footer
:header-dragable="false"
>
</tiny-modal>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Demo disables the feature it's meant to showcase.

The demo sets :header-dragable="false", which disables header dragging. If the purpose of this demo is to showcase the new header-dragable feature, it would be more intuitive to demonstrate the feature enabled (set to true) so users can interact with draggable headers.

Recommendation: Consider one of these approaches:

  1. Set header-dragable="true" to demonstrate the dragging capability
  2. Show both enabled and disabled states with two separate modals
  3. Add explanatory text indicating this demo shows how to disable dragging
🔎 Option 1: Enable the feature in the demo:
       <tiny-modal
         v-model="show"
         title="自定义弹窗标题"
         message="窗口内容"
         show-header
         show-footer
-        :header-dragable="false"
+        :header-dragable="true"
       >
       </tiny-modal>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<tiny-modal
v-model="show"
title="自定义弹窗标题"
message="窗口内容"
show-header
show-footer
:header-dragable="false"
>
</tiny-modal>
<tiny-modal
v-model="show"
title="自定义弹窗标题"
message="窗口内容"
show-header
show-footer
:header-dragable="true"
>
</tiny-modal>
🤖 Prompt for AI Agents
In examples/sites/demos/pc/app/modal/modal-header.vue around lines 10 to 18 the
demo unnecessarily disables the feature it intends to showcase by setting
:header-dragable="false"; change the demo to demonstrate the draggable header by
setting header-dragable to true (or add a second modal demonstrating both true
and false, or add text explaining this one shows the disabled state) so users
can see the drag behavior — update the prop to true or add the alternate
modal/text accordingly.

Comment on lines +38 to +44
Modal.alert({
message: '窗口内容',
title: '自定义弹窗标题',
showHeader: true,
showFooter: true,
headerDragable: false
})
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Demo disables the feature in functional call as well.

Similar to the template usage, the functional call also sets headerDragable: false, which disables the dragging feature. For a feature introduction demo, it would be more effective to show the feature enabled.

🔎 Consider enabling the feature:
       Modal.alert({
         message: '窗口内容',
         title: '自定义弹窗标题',
         showHeader: true,
         showFooter: true,
-        headerDragable: false
+        headerDragable: true
       })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Modal.alert({
message: '窗口内容',
title: '自定义弹窗标题',
showHeader: true,
showFooter: true,
headerDragable: false
})
Modal.alert({
message: '窗口内容',
title: '自定义弹窗标题',
showHeader: true,
showFooter: true,
headerDragable: true
})
🤖 Prompt for AI Agents
In examples/sites/demos/pc/app/modal/modal-header.vue around lines 38 to 44, the
functional demo call disables dragging by setting headerDragable: false; update
this to enable the feature (set headerDragable: true or remove the property if
true is the default) so the demo demonstrates draggable headers as intended.

{
name: 'header-dragable',
type: 'boolean',
defaultValue: 'false',
Copy link
Member

Choose a reason for hiding this comment

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

你好,这里的默认值应该是true,还有新加的特性需要补充下版本信息哈

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

@gausszhou gausszhou force-pushed the feature/modal_header branch from 35e9403 to efe2045 Compare December 23, 2025 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request (功能增强)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants