Skip to content

refactor(components): [calendar] use type-based definitions#23419

Merged
btea merged 10 commits into
element-plus:devfrom
zhongli-kira:components/calendar
Jan 18, 2026
Merged

refactor(components): [calendar] use type-based definitions#23419
btea merged 10 commits into
element-plus:devfrom
zhongli-kira:components/calendar

Conversation

@zhongli-kira
Copy link
Copy Markdown
Contributor

@zhongli-kira zhongli-kira commented Jan 17, 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.

Summary by CodeRabbit

  • Refactor
    • Unified and strengthened prop interfaces across calendar components for a clearer, more stable public API.
    • Components now use explicit typed prop interfaces with sensible defaults (controller defaulted to "button"; header behavior standardized).
    • Legacy implicit prop aliases are deprecated in favor of the new public interfaces to simplify usage and migration.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 17, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 17, 2026

Warning

Rate limit exceeded

@rzzf has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 8d99705 and af1229d.

📒 Files selected for processing (3)
  • packages/components/calendar/src/calendar.ts
  • packages/components/calendar/src/date-table.ts
  • packages/components/calendar/src/select-controller.ts
📝 Walkthrough

Walkthrough

Replaced runtime ExtractPropTypes-based exported prop aliases with explicit TypeScript interfaces for Calendar, DateTable, and SelectController; updated .vue components to use defineProps() (withDefaults where applicable) and removed ExtractPropTypes imports while keeping ExtractPublicPropTypes and adding deprecation notes.

Changes

Cohort / File(s) Summary
Calendar core types
packages/components/calendar/src/calendar.ts
Added exported CalendarProps interface; removed ExtractPropTypes import and the ExtractPropTypes-based exported alias; retained ExtractPublicPropTypes and added deprecation notice for the old public alias and runtime calendarProps.
Calendar component
packages/components/calendar/src/calendar.vue
Switched from defineProps(calendarProps) to defineProps<CalendarProps>() (type import) and applied withDefaults({ controllerType: 'button' }); removed runtime calendarProps import.
Date table core types
packages/components/calendar/src/date-table.ts
Added exported DateTableProps interface; removed ExtractPropTypes-based exported alias and trimmed vue type imports.
Date table component
packages/components/calendar/src/date-table.vue
Switched from defineProps(dateTableProps) to defineProps<DateTableProps>() (type import); removed runtime dateTableProps import.
Select controller core types
packages/components/calendar/src/select-controller.ts
Added exported SelectControllerProps interface; removed ExtractPropTypes-based exported alias and cleaned up vue type imports.
Select controller component
packages/components/calendar/src/select-controller.vue
Switched from defineProps(selectControllerProps) to defineProps<SelectControllerProps>() (type import); removed runtime selectControllerProps import and adjusted emits import.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • rzzf
  • btea
  • keeplearning66

Poem

🐰 I hopped through props both old and new,
I traded extracts for interfaces true,
Defaults snug with withDefaults in sight,
Types now tidy, components light,
A little hop — the build stays bright.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains an unchecked template checklist without any actual description, implementation details, or reference to related issues as required by the template. Add a meaningful description explaining the refactoring rationale, benefits, and breaking changes. Reference any related issues. Check off the contributing guide and branch verification items.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor(components): [calendar] use type-based definitions' clearly and specifically describes the main change: converting the calendar component from runtime props to type-based definitions.
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.


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
Copy Markdown
Contributor

@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: 1

🤖 Fix all issues with AI agents
In `@packages/components/calendar/src/select-controller.ts`:
- Around line 11-14: SelectControllerProps currently declares date as optional
but the runtime prop validation (selectControllerProps) marks it required;
update the interface so date is non-optional (remove the ? on date in
SelectControllerProps) to match the runtime contract and avoid undefined types,
and then check any callers of SelectControllerProps/SelectController (or
functions referencing props.date) to ensure they supply a Dayjs instance to
satisfy the new type.

Comment thread packages/components/calendar/src/select-controller.ts
@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@23419
npm i https://pkg.pr.new/element-plus/element-plus@23419
yarn add https://pkg.pr.new/element-plus/[email protected]

commit: af1229d

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 18, 2026

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

Comment thread packages/components/calendar/src/date-table.ts
@btea btea merged commit e60c87f into element-plus:dev Jan 18, 2026
16 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@zhongli-kira Thanks for your contribution! ❤️

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.

3 participants