Skip to content

feat: 增加table 帮助信息help通过表单values动态展示内容 - #7712

Merged
jinmao88 merged 1 commit into
vbenjs:mainfrom
xueyitt:merge/feat2
Mar 24, 2026
Merged

jinmao88 merged 1 commit into
vbenjs:mainfrom
xueyitt:merge/feat2

Conversation

@xueyitt

@xueyitt xueyitt commented Mar 23, 2026 •

Copy link
Copy Markdown
Contributor

table 帮助信息help支持通过表单values动态展示内容

Summary by CodeRabbit

Release Notes

  • New Features

    • Form field help text now supports dynamic, context-aware messages that reference current form values and available actions for conditional user assistance.
  • Documentation

    • Added example demonstrating dynamic help text functionality in form fields.

@changeset-bot

changeset-bot Bot commented Mar 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d724e33

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.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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 Mar 23, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The changes add support for dynamic, context-aware form help text. The help prop in form schemas now accepts functions that receive current form values and FormActions, enabling conditional help rendering. A new CustomParamsRenderType was introduced to support this enhanced help signature across the form system.

Changes

Cohort / File(s) Summary
Form Help Enhancement
packages/@core/ui-kit/form-ui/src/form-render/form-field.vue, packages/@core/ui-kit/form-ui/src/types.ts
Introduced computed help resolution allowing help text to be defined as functions receiving form values and actions. Added CustomParamsRenderType to support parameterized help functions, and updated FormSchema.help type accordingly. FormLabel now binds to computed help instead of raw prop.
Example Usage
playground/src/views/examples/form/basic.vue
Added practical demonstration of function-based help feature on DatePicker field, showing how to dynamically embed form values (specifically values?.rate) into rendered help content.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #5572: Directly modifies form help rendering system with similar help prop changes and form-field component updates.
  • #5580: Modifies form rendering components and adjusts how props are resolved and passed to FormLabel component.

Suggested labels

feature

Suggested reviewers

  • anncwb
  • mynetfan
  • jinmao88

Poem

🐰 Help text now dances with form's gentle flow,
Functions and values in tandem they go,
Context aware, dynamically bright,
Forms bloom with awareness—a helpful delight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is minimal and lacks required template sections such as detailed description, type of change checklist, and verification checklist items. Expand the description by adding context about the feature, selecting the appropriate type of change checkbox, and confirming completion of the checklist items.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title refers to adding dynamic help display through form values, which matches the core functionality implemented in the changeset.
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 unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/@core/ui-kit/form-ui/src/form-render/form-field.vue (1)

178-188: Consider defensive handling for formApi in onHelpFunc.

The formApi! non-null assertion on line 187 assumes formApi is always defined when onHelpFunc is invoked. However, formApi is derived from formRenderProps.form (line 63), which could be undefined. Other parts of this file use getFormApi() which throws a descriptive error when formApi is missing.

For consistency and safer error handling:

♻️ Suggested improvement
 const onHelpFunc = () => {
   if (!help) {
     return undefined;
   }
-  return isFunction(help) ? help(values.value, formApi!) : help;
+  return isFunction(help) ? help(values.value, getFormApi()) : help;
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/`@core/ui-kit/form-ui/src/form-render/form-field.vue around lines
178 - 188, The onHelpFunc currently uses a non-null assertion on formApi
(formApi!) which can be undefined; change onHelpFunc to retrieve formApi safely
like other parts of the file (use getFormApi() or explicitly check formApi
before using it) so it throws the same descriptive error when missing; update
references in computedHelp/onHelpFunc to call getFormApi() or guard against
undefined before calling help(values.value, formApi) so behavior and error
messaging are consistent with the rest of the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/`@core/ui-kit/form-ui/src/form-render/form-field.vue:
- Around line 178-188: The onHelpFunc currently uses a non-null assertion on
formApi (formApi!) which can be undefined; change onHelpFunc to retrieve formApi
safely like other parts of the file (use getFormApi() or explicitly check
formApi before using it) so it throws the same descriptive error when missing;
update references in computedHelp/onHelpFunc to call getFormApi() or guard
against undefined before calling help(values.value, formApi) so behavior and
error messaging are consistent with the rest of the file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09fbea0a-e379-4a6a-ae0f-e1b96a68a5e4

📥 Commits

Reviewing files that changed from the base of the PR and between 3528517 and d724e33.

📒 Files selected for processing (3)
  • packages/@core/ui-kit/form-ui/src/form-render/form-field.vue
  • packages/@core/ui-kit/form-ui/src/types.ts
  • playground/src/views/examples/form/basic.vue

@jinmao88
jinmao88 merged commit 2aced2f into vbenjs:main Mar 24, 2026
10 of 14 checks passed
@doraemonxxx

Copy link
Copy Markdown
Contributor

@xueyitt pls fix the type issue

Read: #7723

@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
@xueyitt
xueyitt deleted the merge/feat2 branch June 16, 2026 01:28
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.

3 participants