Skip to content
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

chore: disable the default form configuration of vke-table #4794

Merged
merged 2 commits into from
Nov 2, 2024

Conversation

ORACLE128G
Copy link
Contributor

@ORACLE128G ORACLE128G commented Nov 2, 2024

Description

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

    • Introduced a new formConfig option in the grid configuration, allowing for enhanced control over form handling in vxe-table.
    • Global form configuration is now disabled by default, promoting the use of formOptions.
  • Bug Fixes

    • Updated initialization logic to prevent issues when multiple tables are used on the same page by providing warnings regarding unsupported configurations.
  • Documentation

    • Minor adjustments made to comments for clarity on form handling and initialization processes.

@ORACLE128G ORACLE128G requested review from anncwb, vince292007 and a team as code owners November 2, 2024 07:23
Copy link

changeset-bot bot commented Nov 2, 2024

⚠️ No Changeset found

Latest commit: 0d7a193

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

Copy link
Contributor

coderabbitai bot commented Nov 2, 2024

Walkthrough

The changes introduce a new formConfig object with an enabled property set to false in the setupVbenVxeTable function across multiple files. This configuration disables the global form handling for vxe-table, indicating that formOptions will be utilized instead. Additionally, modifications in the use-vxe-grid.vue file enhance the handling of form configurations and grid options, including a warning for unsupported configurations and adjustments to loading behavior.

Changes

File Path Change Summary
apps/web-antd/src/adapter/vxe-table.ts Added formConfig: { enabled: false } in setupVbenVxeTable function.
apps/web-ele/src/adapter/vxe-table.ts Added formConfig: { enabled: false } in setupVbenVxeTable function.
apps/web-naive/src/adapter/vxe-table.ts Added formConfig: { enabled: false } in setupVbenVxeTable function.
playground/src/adapter/vxe-table.ts Added formConfig: { enabled: false } in setupVbenVxeTable function.
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue Updated init function to include a warning for formConfig, refined options computed property, adjusted pagerConfig, and retained watch for formOptions. Updated interface and method signature contextually.

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • vince292007
  • anncwb

🐰 In the meadow, changes bloom,
A formConfig clears the room.
With options set to guide the way,
No more troubles in the fray.
So hop along, let’s celebrate,
For smoother forms, we can’t wait! 🌼


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
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: 0

🧹 Outside diff range and nitpick comments (3)
apps/web-antd/src/adapter/vxe-table.ts (1)

19-22: Consider translating the comment to English for better maintainability.

The configuration change looks good and achieves the objective of globally disabling vxe-table's form configuration. However, for better international collaboration, consider translating the Chinese comment to English.

 formConfig: {
-  // 全局禁用vxe-table的表单配置,使用formOptions
+  // Globally disable vxe-table's form configuration, use formOptions instead
   enabled: false,
 },
playground/src/adapter/vxe-table.ts (1)

19-22: Consider translating the Chinese comment to English for better maintainability.

The implementation looks good, but for consistency with the codebase and better maintainability, consider translating the comment to English.

-          // 全局禁用vxe-table的表单配置,使用formOptions
+          // Globally disable vxe-table's form configuration, use formOptions instead
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue (1)

223-225: LGTM! Consider enhancing the warning message.

The added comments effectively explain the edge case with multiple table instances. This supports the PR's objective of globally disabling vxe-table's default form configuration.

Consider enhancing the warning message to be more specific about why formConfig is not supported:

     console.warn(
-      '[Vben Vxe Table]: The formConfig in the grid is not supported, please use the `formOptions` props',
+      '[Vben Vxe Table]: The formConfig in the grid is not supported as form handling is managed by vben-form. Please use the `formOptions` props instead.',
     );
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between faf18d0 and 0d7a193.

📒 Files selected for processing (5)
  • apps/web-antd/src/adapter/vxe-table.ts (1 hunks)
  • apps/web-ele/src/adapter/vxe-table.ts (1 hunks)
  • apps/web-naive/src/adapter/vxe-table.ts (1 hunks)
  • packages/effects/plugins/src/vxe-table/use-vxe-grid.vue (1 hunks)
  • playground/src/adapter/vxe-table.ts (1 hunks)
🔇 Additional comments (4)
apps/web-antd/src/adapter/vxe-table.ts (1)

19-22: Verify impact on existing vxe-table form usage.

Since this change globally disables vxe-table's form configuration, we should verify that all existing form implementations are using formOptions instead.

✅ Verification successful

Let me check the actual usage patterns to verify if the configuration is consistently applied and if there are any potential issues.

This will help us verify:

  1. If the formConfig disabled setting is consistent across all web apps
  2. How formOptions is actually implemented in the core plugins package

Let me check the adapter files with the correct path pattern and look for any actual form implementations in the playground to ensure completeness.


Let me try one final verification with the exact paths we found earlier:


Configuration change is properly implemented and safe

The verification shows that:

  1. All web apps (antd, ele, naive) consistently disable vxe-table's form configuration
  2. The core package properly handles this by:
    • Providing formOptions as the supported alternative
    • Warning users when they try to use the deprecated formConfig
  3. Example implementation in playground correctly uses formOptions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for potential vxe-table form usage that might be affected by this change
echo "Checking for vxe-table form usage patterns..."

# Look for direct vxe-table form configurations
rg -l "vxe-form" 

# Look for form-related props in vxe-grid usage
rg -l "formConfig|form-config" 

# Look for formOptions usage to ensure the alternative is in place
rg -l "formOptions|form-options"

Length of output: 746


Script:

#!/bin/bash
# Check the formConfig settings in all adapter files
echo "Checking formConfig settings in adapter files:"
rg -A 3 "formConfig" "apps/web-*/src/adapter/vxe-table.ts"

echo -e "\nChecking actual form usage patterns:"
# Look for actual form implementations
rg -B 2 -A 2 "formOptions" "packages/effects/plugins/src/vxe-table/"

Length of output: 3544


Script:

#!/bin/bash
# Check formConfig in adapter files with correct path
echo "Checking formConfig settings in adapter files:"
rg -A 3 "formConfig" "apps/{web-antd,web-ele,web-naive}/src/adapter/vxe-table.ts"

echo -e "\nChecking form implementations in playground:"
rg -B 2 -A 2 "vxe-form|formConfig|formOptions" "playground/src/views/examples/vxe-table/form.vue"

Length of output: 635


Script:

#!/bin/bash
# Check formConfig in all adapter files using exact paths
echo "Checking formConfig in web-antd adapter:"
rg -A 3 "formConfig" "apps/web-antd/src/adapter/vxe-table.ts"

echo -e "\nChecking formConfig in web-ele adapter:"
rg -A 3 "formConfig" "apps/web-ele/src/adapter/vxe-table.ts"

echo -e "\nChecking formConfig in web-naive adapter:"
rg -A 3 "formConfig" "apps/web-naive/src/adapter/vxe-table.ts"

Length of output: 779

playground/src/adapter/vxe-table.ts (1)

19-22: Verify consistent implementation across related files.

The implementation looks correct. Let's verify that this change is consistently implemented across all related files mentioned in the summary.

✅ Verification successful

Implementation is consistent across all adapter files

The formConfig implementation with enabled: false is consistently implemented across all vxe-table adapter files:

  • playground/src/adapter/vxe-table.ts
  • apps/web-naive/src/adapter/vxe-table.ts
  • apps/web-ele/src/adapter/vxe-table.ts
  • apps/web-antd/src/adapter/vxe-table.ts

All files have identical configuration and comments, indicating proper synchronization across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent formConfig implementation across related files
# Expected: All files should have the same formConfig structure with enabled: false

# Search for formConfig implementation in related files
rg -U "formConfig.*?\{.*?enabled: false.*?\}" \
   --type ts \
   --glob "apps/web-*/src/adapter/vxe-table.ts"

Length of output: 102


Script:

#!/bin/bash
# Let's try a broader search to find any vxe-table adapter files and their formConfig implementations
# First, find all vxe-table adapter files
fd "vxe-table.ts" --type f

# Then search for formConfig patterns in these files
rg -U "formConfig" --type ts

Length of output: 495


Script:

#!/bin/bash
# Let's examine the formConfig implementation in each adapter file
echo "=== playground/src/adapter/vxe-table.ts ==="
rg -U "formConfig:.*?\{.*?\}" -A 2 playground/src/adapter/vxe-table.ts

echo -e "\n=== apps/web-naive/src/adapter/vxe-table.ts ==="
rg -U "formConfig:.*?\{.*?\}" -A 2 apps/web-naive/src/adapter/vxe-table.ts

echo -e "\n=== apps/web-ele/src/adapter/vxe-table.ts ==="
rg -U "formConfig:.*?\{.*?\}" -A 2 apps/web-ele/src/adapter/vxe-table.ts

echo -e "\n=== apps/web-antd/src/adapter/vxe-table.ts ==="
rg -U "formConfig:.*?\{.*?\}" -A 2 apps/web-antd/src/adapter/vxe-table.ts

Length of output: 724


Script:

#!/bin/bash
# Let's try a different approach with simpler pattern matching and more context
echo "=== playground/src/adapter/vxe-table.ts ==="
rg "formConfig" -B 2 -A 4 playground/src/adapter/vxe-table.ts

echo -e "\n=== apps/web-naive/src/adapter/vxe-table.ts ==="
rg "formConfig" -B 2 -A 4 apps/web-naive/src/adapter/vxe-table.ts

echo -e "\n=== apps/web-ele/src/adapter/vxe-table.ts ==="
rg "formConfig" -B 2 -A 4 apps/web-ele/src/adapter/vxe-table.ts

echo -e "\n=== apps/web-antd/src/adapter/vxe-table.ts ==="
rg "formConfig" -B 2 -A 4 apps/web-antd/src/adapter/vxe-table.ts

Length of output: 1310

apps/web-naive/src/adapter/vxe-table.ts (1)

19-22: Breaking Change: Verify impact of disabling vxe-table's form configuration.

The implementation correctly disables the default form configuration as intended, and the comment clearly explains the purpose. However, this is a breaking change that could affect existing implementations.

Let's verify the impact across the codebase:

Consider adding:

  1. Migration guide in the PR description
  2. Warning comment about the breaking nature of this change
apps/web-ele/src/adapter/vxe-table.ts (1)

19-22: LGTM! Consider translating the comment to English.

The addition of formConfig with enabled: false correctly implements the PR objective to globally disable vxe-table's default form configuration.

Consider translating the Chinese comment to English for consistency:

-        // 全局禁用vxe-table的表单配置,使用formOptions
+        // Globally disable vxe-table form configuration, use formOptions instead

Let's verify the impact of this change:

✅ Verification successful

The formConfig change is consistent across all apps and properly handled

The verification shows that:

  • The same formConfig change (enabled: false) is consistently applied across all app adapters:
    • apps/web-ele/src/adapter/vxe-table.ts
    • apps/web-naive/src/adapter/vxe-table.ts
    • apps/web-antd/src/adapter/vxe-table.ts
    • playground/src/adapter/vxe-table.ts
  • The packages/effects/plugins/src/vxe-table/use-vxe-grid.vue component already handles this configuration by:
    • Enforcing formConfig.enabled = false
    • Warning users when they try to use formConfig instead of formOptions
    • Providing proper fallback to vben-form
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any direct usage of vxe-table form configuration that might be affected by this change

# Search for form-related configurations in vue files
rg -t vue "formConfig|form-config" -A 5

# Search for potential form-related imports or configurations
ast-grep --pattern 'import { $_ } from "vxe-table"'

Length of output: 123


Script:

#!/bin/bash
# Let's try a broader search without file type restrictions
# Search for form-related configurations
rg "formConfig|form-config" -A 5

# Search for vxe-table imports and usage
rg "from ['|\"]vxe-table" -A 2

# Search for potential form configurations in .vue, .ts, and .js files
fd -e vue -e ts -e js --exec grep -l "formConfig\|form-config" {} \;

# Look for vxe-table configuration files
fd -g "*vxe*.{ts,js,vue}"

Length of output: 5575

@anncwb anncwb changed the title 全局禁用vxe-table默认的form配置 chore: disable the default form configuration of vke-table Nov 2, 2024
@anncwb anncwb merged commit a64a06b into vbenjs:main Nov 2, 2024
13 of 15 checks passed
GavinLucky pushed a commit to GavinLucky/vue-vben-admin that referenced this pull request Nov 4, 2024
* fix: 处理某个页面加载多个Table时,第2个之后的Table初始化报出警告

* fix: 使用vxe-table时全局禁用formConfig
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2024
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