Skip to content

feat(api-component): api-component组件的options支持指定disabled值 - #6991

Merged
jinmao88 merged 1 commit into
vbenjs:mainfrom
jyqwq:feature/api-component组件的options支持disabled值
Dec 3, 2025

Hidden character warning

The head ref may contain hidden characters: "feature/api-component\u7ec4\u4ef6\u7684options\u652f\u6301disabled\u503c"
Merged

jinmao88 merged 1 commit into
vbenjs:mainfrom
jyqwq:feature/api-component组件的options支持disabled值

Conversation

@jyqwq

@jyqwq jyqwq commented Dec 2, 2025 •

Copy link
Copy Markdown
Contributor

Description

apiSelect 组件目前无法支持options选项的disabled状态,在api-component添加disabledField参数让动态数据支持disabled状态。

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [ ✅ ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

  • [ ✅ ] If you introduce new functionality, document it. You can run documentation with pnpm run docs:dev command.
  • [ ✅ ] Run the tests with pnpm test.
  • [ ✅ ] Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.
  • [ ✅ ] My code follows the style guidelines of this project
  • [ ✅ ] I have performed a self-review of my own code
  • [ ✅ ] I have commented my code, particularly in hard-to-understand areas
  • [ ✅ ] I have made corresponding changes to the documentation
  • [ ✅ ] My changes generate no new warnings
  • [ ✅ ] I have added tests that prove my fix is effective or that my feature works
  • [ ✅ ] New and existing unit tests pass locally with my changes
  • [ ✅ ] Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features
    • Added support for configurable disabled field mapping in options. Options can now be marked as disabled based on item data properties, enabling more flexible option rendering.

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

@changeset-bot

changeset-bot Bot commented Dec 2, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bd6719c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Dec 2, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

A new disabledField prop is introduced to the ApiComponent to allow customization of which data field indicates disabled state. The prop is integrated into the getOptions computation and transformData function to propagate disabled values through the option transformation pipeline.

Changes

Cohort / File(s) Change Summary
ApiComponent disabled field customization
packages/effects/common-ui/src/components/api-component/api-component.vue
Added disabledField prop with default value 'disabled'. Updated getOptions computation to destructure and use the prop. Modified transformData to read disabled state from each item using the configurable field and explicitly assign the disabled property to transformed options.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Single file modification with straightforward prop addition
  • Consistent pattern: prop definition → computation usage → data transformation application
  • No complex control flow or multi-component interactions
  • Clear, self-contained change scope

Possibly related PRs

Suggested labels

feature

Suggested reviewers

  • mynetfan
  • anncwb
  • jinmao88
  • vince292007

Poem

🐰 A field for the disabled, now customizable and free,
No longer locked to one name, it's as flexible as can be!
Through options and transformations, the state flows just right,
One little prop brings clarity and disables with delight! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding support for specifying disabled values for options in the api-component.
Description check ✅ Passed The description follows the template structure with a clear explanation of the feature, correct type selection, and completed checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c76db7d and bd6719c.

📒 Files selected for processing (1)
  • packages/effects/common-ui/src/components/api-component/api-component.vue (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: mynetfan
Repo: vbenjs/vue-vben-admin PR: 5075
File: packages/effects/common-ui/src/components/api-select/api-select.vue:61-62
Timestamp: 2024-12-09T04:41:58.914Z
Learning: 在文件 `packages/effects/common-ui/src/components/api-select/api-select.vue` 的组件 `ApiSelect` 中,`childrenField` 的默认值设置为空字符串是有意的,因为并非所有组件都使用树形数据。
📚 Learning: 2024-12-09T04:41:58.914Z
Learnt from: mynetfan
Repo: vbenjs/vue-vben-admin PR: 5075
File: packages/effects/common-ui/src/components/api-select/api-select.vue:61-62
Timestamp: 2024-12-09T04:41:58.914Z
Learning: 在文件 `packages/effects/common-ui/src/components/api-select/api-select.vue` 的组件 `ApiSelect` 中,`childrenField` 的默认值设置为空字符串是有意的,因为并非所有组件都使用树形数据。

Applied to files:

  • packages/effects/common-ui/src/components/api-component/api-component.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). (6)
  • GitHub Check: Lint (windows-latest)
  • GitHub Check: Lint (ubuntu-latest)
  • GitHub Check: Test (windows-latest)
  • GitHub Check: Check (windows-latest)
  • GitHub Check: post-update (ubuntu-latest)
  • GitHub Check: post-update (windows-latest)
🔇 Additional comments (3)
packages/effects/common-ui/src/components/api-component/api-component.vue (3)

39-40: LGTM!

The prop definition for disabledField follows the established pattern for field name props and is correctly documented.


80-80: LGTM!

The default value 'disabled' follows the same naming convention as other field defaults and is appropriate.


114-143: I cannot rewrite this review comment as presented because:

  1. Incomplete context: The review comment references a "critical bug" on line 129 but never defines what the bug actually is within the comment text itself. The code snippet shows disabled: get(item, disabledField), but the underlying problem is not explained.

  2. Verification impossible: The repository cannot be accessed to execute the verification shell script. Without access to the codebase, I cannot:

    • Confirm whether similar patterns exist in api-select or api-tree-select components
    • Verify if the same issue appears elsewhere
    • Validate the suggestion
  3. Comment structure unclear: The comment appears to be in draft state, ending with a `` tag and shell script rather than a finalized review directive.

To proceed, please provide:

  • The actual problem statement (what is the bug on line 129?)
  • Clarification of what should be changed in the code
  • Or grant repository access for verification

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.

@jinmao88
jinmao88 merged commit 9105d4d into vbenjs:main Dec 3, 2025
14 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants