-
Notifications
You must be signed in to change notification settings - Fork 8.4k
feat: form compact mode support #5165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
packages/@core/ui-kit/form-ui/src/components/form-actions.vueOops! Something went wrong! :( ESLint: 9.16.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/node_modules/@vben/eslint-config/dist/index.mjs' imported from /eslint.config.mjs WalkthroughThe pull request introduces a new Changes
Assessment against linked issues
Suggested Labels
Suggested Reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/@core/ui-kit/form-ui/src/form-render/form-field.vue (1)
284-287: Consider refactoring class bindings for better readabilityWhile the implementation is correct, the class bindings could be more concise using computed properties or the
cnutility that's already imported.Consider this refactor:
- :class="{ - 'form-valid-error': isInValid, - 'flex-col': isVertical, - 'flex-row items-center': !isVertical, - 'pb-6': !compact, - 'pb-2': compact, - }" - class="flex" + :class="cn( + 'flex', + { + 'form-valid-error': isInValid, + 'flex-col': isVertical, + 'flex-row items-center': !isVertical, + 'pb-6': !compact, + 'pb-2': compact, + } + )"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
docs/src/components/common-ui/vben-form.md(1 hunks)packages/@core/ui-kit/form-ui/src/components/form-actions.vue(1 hunks)packages/@core/ui-kit/form-ui/src/form-render/form-field.vue(2 hunks)packages/@core/ui-kit/form-ui/src/types.ts(1 hunks)packages/effects/plugins/src/vxe-table/use-vxe-grid.vue(3 hunks)
🔇 Additional comments (7)
packages/@core/ui-kit/form-ui/src/components/form-actions.vue (1)
141-145: LGTM! Padding adjustment for compact mode
The conditional padding adjustment aligns with the compact mode feature, providing appropriate spacing based on the form's mode.
packages/@core/ui-kit/form-ui/src/types.ts (1)
276-279: LGTM! Well-documented interface addition
The compact property is properly typed as optional and includes clear documentation explaining its purpose of removing validation message space.
packages/@core/ui-kit/form-ui/src/form-render/form-field.vue (1)
58-58: LGTM! Clean constant declaration
The compact constant is properly derived from formRenderProps, making the code more maintainable.
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue (3)
Line range hint 71-81: LGTM: Form initialization with compact mode and state management.
The implementation correctly maintains form state by setting latest submission values after submit/reset actions. This ensures the grid has access to the most recent form data.
288-290: LGTM: Clean computed property implementation.
The isCompactForm computed property provides a clean way to access the form's compact state.
346-346: LGTM: Proper class binding for compact mode.
The template correctly uses conditional class binding to adjust padding based on the compact state.
docs/src/components/common-ui/vben-form.md (1)
360-366: LGTM: Well-documented compact mode property.
The documentation clearly explains:
- Purpose of the compact mode
- Default values in different contexts
- Important considerations regarding validation
Description
为表单新增一个“紧凑模式”属性compact,将其设为true时,表单会移除每一个子项目底部为显示校验错误信息所预留的空间。
该属性适用于不需要显示校验信息的场合(如用作表格的搜索表单)
close #5161
Type of change
Please delete options that are not relevant.
pnpm-lock.yamlunless you introduce a new test example.Checklist
pnpm run docs:devcommand.pnpm test.feat:,fix:,perf:,docs:, orchore:.Summary by CodeRabbit
New Features
compactmode for forms, allowing for a more space-efficient layout.isCompactFormto manage form display styles.Documentation
compactproperty and enhanced examples fordependenciesandrules.Bug Fixes
Chores