Skip to content

refactor(components): [dialog] use type-based definitions#23432

Merged
btea merged 11 commits into
element-plus:devfrom
lw56777:refactor/dialog-ComponentProps-#23399
Jan 20, 2026
Merged

refactor(components): [dialog] use type-based definitions#23432
btea merged 11 commits into
element-plus:devfrom
lw56777:refactor/dialog-ComponentProps-#23399

Conversation

@lw56777
Copy link
Copy Markdown
Contributor

@lw56777 lw56777 commented Jan 18, 2026

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

修复:#23399

Summary by CodeRabbit

  • Refactor
    • Consolidated dialog prop definitions into explicit, strongly typed public contracts to improve type safety.
    • Introduced centralized default values for dialog content and dialog props, applied across components for consistent behavior.
    • Marked legacy/older prop shapes as deprecated while preserving runtime behavior and backward compatibility.

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

@pull-request-triage
Copy link
Copy Markdown

👋 @lw56777, seems like this is your first time contribution to element-plus.
Please make sure that you have read our guidelines and code of conduct before making a contribution.

@pull-request-triage pull-request-triage Bot added 1st contribution Their very first contribution Needs Review labels Jan 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 18, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 18, 2026

📝 Walkthrough

Walkthrough

Adds exported TypeScript prop interfaces (DialogContentProps, DialogProps), a dialogContentPropsDefaults constant, deprecates legacy public alias DialogPropsPublic, and migrates Vue components to typed defineProps<...>() with withDefaults(...) for defaults.

Changes

Cohort / File(s) Summary
Prop interfaces & defaults
packages/components/dialog/src/dialog-content.ts, packages/components/dialog/src/dialog.ts
Adds exported DialogContentProps and DialogProps (extends DialogContentProps), introduces dialogContentPropsDefaults, adds Vue Component type for closeIcon, consolidates type imports, and marks legacy DialogPropsPublic as deprecated.
Component prop usage
packages/components/dialog/src/dialog-content.vue, packages/components/dialog/src/dialog.vue
Replace runtime prop objects with defineProps<...>() + withDefaults(...); import type-only interfaces and dialogContentPropsDefaults; remove direct use of dialogContentProps/dialogProps; emits remain unchanged.

Sequence Diagram(s)

(omitted — refactor/typing only)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • btea
  • keeplearning66

Poem

🐇 I nudged props from night to light,
Typed them neat and set defaults right.
Deprecated echoes softly fade,
New interfaces hop into the glade.
🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main refactoring: converting dialog component props from runtime definitions to type-based definitions.
Description check ✅ Passed The description includes the required checklist items (all checked) and references issue #23399, but lacks substantive details about what was changed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 18, 2026

Open in StackBlitz

pnpm add https://pkg.pr.new/element-plus/element-plus@23432
npm i https://pkg.pr.new/element-plus/element-plus@23432
yarn add https://pkg.pr.new/element-plus/[email protected]

commit: ccd1787

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 18, 2026

🧪 Playground Preview: https://element-plus.run/?pr=23432
Please comment the example via this playground if needed.

@rzzf
Copy link
Copy Markdown
Member

rzzf commented Jan 18, 2026

https://github.com/element-plus/element-plus/actions/runs/21107548227/job/60701234788?pr=23432

Can you take a look at the failed CI?

Comment thread packages/components/dialog/src/dialog-content.ts Outdated
Comment thread packages/components/dialog/src/dialog-content.vue Outdated
Comment thread packages/components/dialog/src/dialog.ts
Comment thread packages/components/dialog/src/dialog.vue Outdated
Comment thread packages/components/dialog/src/dialog-content.ts Outdated
@btea btea merged commit 46dc569 into element-plus:dev Jan 20, 2026
19 of 21 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@lw56777 Thanks for your contribution! ❤️

@lw56777 lw56777 deleted the refactor/dialog-ComponentProps-#23399 branch January 20, 2026 10:26
@element-bot element-bot mentioned this pull request Jan 30, 2026
3 tasks
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.

4 participants