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

feat: table grid supports setting title and helpMessage #4732

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

anncwb
Copy link
Collaborator

@anncwb anncwb commented Oct 24, 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

Release Notes

  • New Features

    • Introduced tableTitle and tableTitleHelp properties for enhanced grid context.
    • Added support for resizable columns and improved overflow handling in tables.
  • Bug Fixes

    • Adjusted modal styling to ensure proper visual distinction based on the bordered property.
  • Style

    • Enhanced styling for disabled input elements with a new CSS variable.
  • Chores

    • Updated dependency versions to ensure compatibility and access to the latest features.

@anncwb anncwb added the feature label Oct 24, 2024
@anncwb anncwb requested review from vince292007 and a team as code owners October 24, 2024 14:43
Copy link

changeset-bot bot commented Oct 24, 2024

⚠️ No Changeset found

Latest commit: 3237dbb

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 Oct 24, 2024

Walkthrough

The pull request introduces multiple changes across various files, primarily focusing on the configuration of the setupVbenVxeTable function in different vxe-table.ts files. Key updates include altering the border property, adding a columnConfig with a resizable property, and introducing a showOverflow property. Additionally, modifications to modal components enhance their visual presentation and state management. The package.json for @vben/node-utils has had its devDependencies removed, and several dependency versions have been updated in the pnpm-workspace.yaml.

Changes

File Path Change Summary
apps/web-antd/src/adapter/vxe-table.ts Modified border, added columnConfig with resizable, and added showOverflow.
apps/web-ele/src/adapter/vxe-table.ts Modified border, added columnConfig with resizable, and added showOverflow.
apps/web-naive/src/adapter/vxe-table.ts Modified border, added columnConfig with resizable, and added showOverflow.
playground/src/adapter/vxe-table.ts Modified border, added columnConfig with resizable, and added showOverflow.
packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts Changed bordered property in defaultState from false to true, added connectedComponent.
packages/@core/ui-kit/popup-ui/src/modal/modal.vue Updated template and logic for DialogFooter and DialogContent, improved state handling.
packages/effects/plugins/src/vxe-table/theme.css Added new CSS variable --vxe-ui-input-disabled-color.
packages/effects/plugins/src/vxe-table/types.ts Added optional properties tableTitle and tableTitleHelp to VxeGridProps interface.
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue Added tableTitle and tableTitleHelp properties, modified toolbar management.
playground/src/views/examples/vxe-table/basic.vue Added table-title and table-title-help attributes to <Grid> component.
playground/src/views/examples/vxe-table/remote.vue Added table-title and table-title-help attributes to <Grid> component.
playground/src/views/examples/vxe-table/tree.vue Added table-title and table-title-help attributes to <Grid> component.
internal/node-utils/package.json Removed devDependencies section.
pnpm-workspace.yaml Updated versions for various dependencies.

Possibly related PRs

Suggested reviewers

  • vince292007

Poem

🐰 In the meadow where tables grow,
Borders fade, and columns flow.
With titles bright and hints so clear,
Our grids will dance, bring joy and cheer!
So hop along, let changes ring,
A better table, let us sing! 🌼


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.

@anncwb anncwb merged commit 6688a6b into main Oct 24, 2024
14 checks passed
@anncwb anncwb deleted the feature/table-title branch October 24, 2024 14:51
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: 3

🧹 Outside diff range and nitpick comments (12)
packages/effects/plugins/src/vxe-table/types.ts (1)

22-29: Documentation could be more descriptive and in English.

The implementation looks good, but consider enhancing the documentation for better clarity:

 /**
- * 标题
+ * Table title displayed above the grid
  */
 tableTitle?: string;
 /**
- * 标题帮助
+ * Help message/tooltip associated with the table title
  */
 tableTitleHelp?: string;
playground/src/views/examples/vxe-table/tree.vue (2)

53-53: Consider using i18n for internationalization.

The implementation of table title and help message looks good. However, consider using i18n for the hardcoded Chinese strings "数据列表" and "提示" to support multiple languages.

-    <Grid table-title="数据列表" table-title-help="提示">
+    <Grid :table-title="t('table.dataList')" :table-title-help="t('table.treeTableHint')">

53-53: Make the help message more descriptive.

The current help message "提示" (Hint) is quite generic. Consider providing more specific guidance about the tree table functionality, such as explaining the expand/collapse features or how to interact with the tree structure.

-    <Grid table-title="数据列表" table-title-help="提示">
+    <Grid table-title="数据列表" table-title-help="树形表格支持展开/折叠功能,点击行前的图标可以展开或折叠子项">
playground/src/adapter/vxe-table.ts (2)

30-30: LGTM. Consider documenting overflow behavior.

Setting showOverflow: true is a good default that ensures content visibility through ellipsis/tooltip when content exceeds cell dimensions.

Consider adding a code comment explaining the overflow behavior for future maintainers:

+ // Show ellipsis and tooltip for overflowing content
  showOverflow: true,

Based on the search results, I can now provide the final response:

The review comment is accurate - implementation for title and helpMessage features is missing

The search results confirm that while the types tableTitle and tableTitleHelp are defined in packages/effects/plugins/src/vxe-table/types.ts, there is no actual implementation of these features in any of the vxe-table adapter files. The grid configurations in all adapter files (playground, web-antd, web-ele, web-naive) only include basic settings like alignment, borders, and column resizing, but no title or help message implementation.

  • The types exist but are not used:
    tableTitle?: string;
    tableTitleHelp?: string;
  • None of the setupVbenVxeTable configurations in any adapter file implements these features
  • The PR's changes focus on other aspects of the table (borders, resizable columns, overflow) instead of the stated objective
🔗 Analysis chain

Line range hint 8-33: Misalignment between PR objective and implementation.

The PR's objective is to add support for setting title and helpMessage in the table grid, but the changes in this file focus on different aspects (borders, resizable columns, overflow). I don't see any implementation related to the title or helpMessage features.

Let's verify if the title and helpMessage implementation is missing:


Let me search specifically for title and helpMessage configurations in vxe-table related files:

The previous search showed the types exist in packages/effects/plugins/src/vxe-table/types.ts, but we need to verify if and how they are being used in the implementation.


Let me search for the implementation of these types and how they are used:

I want to verify if there's any implementation that uses these types, as they are defined but might not be implemented yet.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for title or helpMessage related configurations
echo "Searching for title/helpMessage implementations..."
rg -i "title|helpMessage" --type ts

# Search specifically in grid configurations
echo "Searching in grid configurations..."
ast-grep --pattern 'grid: {
  $$$
}'

Length of output: 26765


Script:

#!/bin/bash
# Search for vxe-table related files that might contain title/helpMessage configurations
echo "Searching in vxe-table related files..."
fd "vxe.*table" --type f

# Search for tableTitle and tableTitleHelp in the codebase
echo "Searching for tableTitle and tableTitleHelp..."
rg "tableTitle|tableTitleHelp" --type ts

# Look for any grid title configurations in vxe-table files
echo "Searching for grid title configurations..."
rg "title.*:|help.*:" --type ts $(fd "vxe.*table" --type f)

Length of output: 1058


Script:

#!/bin/bash
# Search for the implementation of VXETable configuration
echo "Searching for VXETable configuration implementation..."
ast-grep --pattern 'setupVbenVxeTable($$$)'

# Search for files importing the types
echo "Searching for files importing VXETable types..."
rg "from.*vxe-table/types" --type ts

# Search for any grid-related configurations
echo "Looking for grid configurations in VXETable setup..."
ast-grep --pattern 'grid: {
  $$$
  title: $_,
  $$$
}'

Length of output: 13789

playground/src/views/examples/vxe-table/basic.vue (1)

80-82: Remove commented-out code.

The commented-out toolbar actions template should be removed if it's no longer needed. Keeping commented-out code can lead to confusion and maintenance issues.

Apply this diff to clean up the code:

-      <!-- <template #toolbar-actions>
-        <Button class="mr-2" type="primary">左侧插槽</Button>
-      </template> -->
packages/effects/plugins/src/vxe-table/theme.css (1)

Line range hint 4-5: Consider standardizing commented color values.

The commented color values use RGB format while active values use HSL. For better maintainability and consistency, consider converting the commented RGB values to HSL format when they're needed in the future.

Example conversion:

- /* --vxe-ui-font-lighten-color: #babdc0; */
+ /* --vxe-ui-font-lighten-color: hsl(220, 4%, 74%); */

- /* --vxe-ui-base-popup-box-shadow: 0px 12px 30px 8px rgb(0 0 0 / 50%); */
+ /* --vxe-ui-base-popup-box-shadow: 0px 12px 30px 8px hsl(0, 0%, 0%, 50%); */

Also applies to: 13-14, 18-19, 22-23, 35-36

packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts (1)

Line range hint 7-8: Remove commented code.

The commented out private prevState!: ModalState; appears to be unused. Consider removing it to maintain code cleanliness.

-  // private prevState!: ModalState;
   private state!: ModalState;
packages/@core/ui-kit/popup-ui/src/modal/modal.vue (3)

Line range hint 89-104: Consider using CSS transform with Vue's reactivity system instead of direct DOM manipulation.

The watch effect directly manipulates the DOM style, which could lead to issues with Vue's virtual DOM reconciliation. Consider using a reactive style binding instead.

- dialogRef.value.style.transform = `translate(${offsetX}px, ${offsetY}px)`;
+ const transformStyle = computed(() => ({
+   transform: shouldDraggable.value ? `translate(${transform.offsetX}px, ${transform.offsetY}px)` : 'none'
+ }));

Then bind it in the template:

<DialogContent
  :style="transformStyle"
  ...
>

Line range hint 106-117: Add smooth scrolling for better UX.

The scroll behavior when loading could be smoother.

   if (v && wrapperRef.value) {
     wrapperRef.value.scrollTo({
-      // behavior: 'smooth',
+      behavior: 'smooth',
       top: 0,
     });
   }

Now I have enough context to provide the final response since I can see:

  1. The resetPosition function exists in use-modal-draggable.ts and properly resets both transform values and styles
  2. The modal state management in modal-api.ts shows the fullscreen state handling
  3. The original modal.vue shows the transform being applied based on draggable state

The position reset implementation is necessary and should be uncommented

The commented code should be restored and modified to use the existing resetPosition function from useModalDraggable. This ensures proper cleanup of transform values when switching to fullscreen mode.

 function handleFullscreen() {
   props.modalApi?.setState((prev) => {
-    // if (prev.fullscreen) {
-    //   resetPosition();
-    // }
+    if (prev.fullscreen) {
+      resetPosition();
+    }
     return { ...prev, fullscreen: !fullscreen.value };
   });
 }
  • The resetPosition function from useModalDraggable already handles both the transform state and DOM style reset
  • Without this reset, the modal could retain its dragged position when toggling fullscreen, leading to visual inconsistencies
🔗 Analysis chain

Line range hint 119-127: Implement position reset when toggling fullscreen.

The commented code suggests that position reset functionality was planned but not implemented. This could lead to positioning issues when toggling fullscreen mode.

Consider implementing the position reset:

 function handleFullscreen() {
   props.modalApi?.setState((prev) => {
-    // if (prev.fullscreen) {
-    //   resetPosition();
-    // }
+    if (prev.fullscreen) {
+      transform.offsetX = 0;
+      transform.offsetY = 0;
+    }
     return { ...prev, fullscreen: !fullscreen.value };
   });
 }

Let me try a different search strategy to gather more context about the modal implementation and position handling.

This will help us:

  1. Find all modal-related files
  2. Look for position-related code in the specific modal.vue file to understand the positioning logic and fullscreen handling

Let me check the modal draggable implementation since it seems to handle the transform logic.

This will help us understand:

  1. How the transform/position is managed in the draggable implementation
  2. How the modal state is managed through the API
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for related position reset implementations
rg -A 5 "resetPosition|handleFullscreen" --type ts --type vue

Length of output: 91


Script:

#!/bin/bash
# Search for files related to modal implementation
fd -e vue -e ts modal

# After finding the files, let's look for position-related code
rg "transform|position|fullscreen" packages/@core/ui-kit/popup-ui/src/modal/modal.vue

Length of output: 1270


Script:

#!/bin/bash
# Check the draggable implementation
cat packages/@core/ui-kit/popup-ui/src/modal/use-modal-draggable.ts

# Also check the modal API to understand state management
cat packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts

Length of output: 6088

packages/effects/plugins/src/vxe-table/use-vxe-grid.vue (1)

96-114: Consider extracting magic strings to constants.

The toolbar configuration is well-structured and documented. Consider extracting the slot names 'toolbar-actions' and 'toolbar-tools' to named constants for better maintainability.

+ const TOOLBAR_ACTIONS_SLOT = 'toolbar-actions';
+ const TOOLBAR_TOOLS_SLOT = 'toolbar-tools';

  return {
    toolbarConfig: {
      slots: {
-       ...(slotActions || showTableTitle.value ? { buttons: 'toolbar-actions' } : {}),
-       ...(slotTools ? { tools: 'toolbar-tools' } : {}),
+       ...(slotActions || showTableTitle.value ? { buttons: TOOLBAR_ACTIONS_SLOT } : {}),
+       ...(slotTools ? { tools: TOOLBAR_TOOLS_SLOT } : {}),
      },
    },
  };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 39e41d0 and 3237dbb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (14)
  • apps/web-antd/src/adapter/vxe-table.ts (2 hunks)
  • apps/web-ele/src/adapter/vxe-table.ts (2 hunks)
  • apps/web-naive/src/adapter/vxe-table.ts (2 hunks)
  • internal/node-utils/package.json (0 hunks)
  • packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts (1 hunks)
  • packages/@core/ui-kit/popup-ui/src/modal/modal.vue (1 hunks)
  • packages/effects/plugins/src/vxe-table/theme.css (1 hunks)
  • packages/effects/plugins/src/vxe-table/types.ts (1 hunks)
  • packages/effects/plugins/src/vxe-table/use-vxe-grid.vue (7 hunks)
  • playground/src/adapter/vxe-table.ts (2 hunks)
  • playground/src/views/examples/vxe-table/basic.vue (1 hunks)
  • playground/src/views/examples/vxe-table/remote.vue (1 hunks)
  • playground/src/views/examples/vxe-table/tree.vue (1 hunks)
  • pnpm-workspace.yaml (5 hunks)
💤 Files with no reviewable changes (1)
  • internal/node-utils/package.json
🔇 Additional comments (27)
packages/effects/plugins/src/vxe-table/types.ts (1)

22-29: Verify the implementation in components.

Let's verify that these new properties are properly implemented in the components.

✅ Verification successful

Let me try a different approach to verify the usage of these properties by searching for their occurrences in all files, not just Vue files, since the file type detection seems to be an issue.


Properties are properly implemented and used

The verification shows that both tableTitle and tableTitleHelp properties are well integrated:

  • They are properly defined in types.ts as optional string properties
  • They are correctly implemented in use-vxe-grid.vue where:
    • Properties are extracted using usePriorityValues
    • tableTitle has a computed property showTableTitle that handles both slot and prop cases
    • Both properties are used in the template with proper conditional rendering
    • tableTitleHelp is appropriately used within a VbenHelpTooltip component
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the usage of new properties in components

# Test 1: Find components using tableTitle
echo "=== Components using tableTitle ==="
rg -l "tableTitle|table-title" --type vue

# Test 2: Find components using tableTitleHelp
echo -e "\n=== Components using tableTitleHelp ==="
rg -l "tableTitleHelp|table-title-help" --type vue

# Test 3: Check if properties are properly typed in component props
echo -e "\n=== Type usage in components ==="
ast-grep --pattern 'defineProps<{
  $$$
  tableTitle?: string
  $$$
}>()'

Length of output: 485


Script:

#!/bin/bash
# Search for usage of these properties across all files
echo "=== Files containing tableTitle ==="
rg -l "tableTitle"

echo -e "\n=== Files containing tableTitleHelp ==="
rg -l "tableTitleHelp"

# Get more context around the usage
echo -e "\n=== Usage context for tableTitle ==="
rg "tableTitle" -C 2

echo -e "\n=== Usage context for tableTitleHelp ==="
rg "tableTitleHelp" -C 2

Length of output: 3936

apps/web-antd/src/adapter/vxe-table.ts (2)

30-30: Consider testing overflow behavior with various content types.

Setting showOverflow: true will show overflow content, which might affect table layout and readability.

Let's check if there are any existing overflow-related issues or patterns in the codebase:

#!/bin/bash
# Description: Look for potential overflow-related patterns or issues
# Search for table cells that might have overflow content

# Search for components with potentially long content
ast-grep --pattern 'cellRender: { $$ }'

# Look for existing overflow-related configurations
rg "overflow|ellipsis" --type ts

Consider adding a comment explaining the overflow behavior for future maintainers, especially if specific content types need special handling.


14-17: Verify the visual impact of border removal and column resizing.

The changes improve table customization but might affect visual clarity. Please ensure:

  1. Table content remains visually distinct without borders
  2. Column resizing works correctly with other table features

Let's verify if these configuration changes are consistent across the project:

✅ Verification successful

Let me try another search strategy to find vxe-table configurations:

This should help us find any vxe-table usage and configuration patterns across the codebase.


Let me try one final search to find grid configurations:

This should help us find any default or shared grid configurations to compare with the changes.


Based on the search results, I can now provide a final response:

Border removal and column resizing changes are consistent with theme configuration

The changes are well-aligned with the project's setup:

  • The theme file (packages/effects/plugins/src/vxe-table/theme.css) already handles table borders through CSS variables, making the border: false setting appropriate as styling is controlled via theme
  • Column resizing is supported by the theme as evidenced by the --vxe-ui-table-resizable-line-color variable, making the columnConfig.resizable: true setting valid

The configuration changes are safe and properly integrated with the existing theming system.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent table configuration across files
# Look for other vxe-table configuration files and their border/resizable settings

# Search for vxe-table.ts files and their grid configurations
rg -A 10 "grid:\s*{" --glob "**/vxe-table.ts"

Length of output: 2258


Script:

#!/bin/bash
# Search for vxe-table related configurations and imports
rg -A 5 "import.*['\"]vxe-table['\"]|from.*['\"]vxe-table['\"]" --type ts

# Also search for grid or table configurations
rg -A 10 "createGrid|useGrid|tableConfig" --type ts

Length of output: 1881


Script:

#!/bin/bash
# Search for grid configurations in the vxe-table related files
rg -A 10 "grid.*=.*{" packages/effects/plugins/src/vxe-table/ apps/web-antd/src/adapter/

# Also look for any other table configuration patterns
rg -A 10 "columnConfig|border.*:" packages/effects/plugins/src/vxe-table/ apps/web-antd/src/adapter/

Length of output: 4818

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

14-14: Verify the intention behind removing table borders.

This change removes the default borders from the table grid, which appears unrelated to the PR's objective of adding title and helpMessage support. While borderless tables can provide a cleaner look, they might affect content readability.

Please confirm if this is an intentional design change. Consider:

  1. Was this discussed in the design phase?
  2. How does this align with the project's UI/UX guidelines?

15-17: LGTM, but scope seems broader than PR objective.

Adding resizable columns is a good UX improvement, allowing users to adjust column widths based on content. However, this change appears to be outside the scope of adding title and helpMessage support.

Could you clarify if these additional enhancements were intended to be part of this PR?

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

Line range hint 19-28: Verify error handling in proxy configuration.

The proxy configuration handles successful responses, but there's no explicit error handling configuration. Consider adding error handling for failed requests.

#!/bin/bash
# Check for error handling patterns in related files
rg -g '*.{ts,vue}' -B 2 -A 2 'proxyConfig.*error|onLoadError'

14-14: Verify the visual impact of removing table borders.

The removal of borders might affect table readability, especially with dense data. Please ensure that the table remains visually distinct and cells are easily distinguishable.

✅ Verification successful

Let me try another verification approach to understand the table styling context better.


Let me check for any custom theme or style definitions that might be relevant.


Based on the gathered information, I can now provide a final response. The theme.css file and configuration setup provide clear evidence about the table's visual styling.

Removing borders is safe - table cells remain visually distinct

The removal of borders is acceptable because:

  1. The table has built-in visual separation through CSS variables that define distinct colors for:
    • Header background (--vxe-ui-table-header-background-color)
    • Row hover states (--vxe-ui-table-row-hover-background-color)
    • Striped rows (--vxe-ui-table-row-striped-background-color)
  2. The theme.css file implements a comprehensive styling system that maintains visual hierarchy and cell distinction without relying on borders.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any custom CSS styles that might compensate for the removed borders
rg -g '*.{css,scss,less}' -A 3 'vxe-table|table-grid'

Length of output: 163


Script:

#!/bin/bash
# Search for vxe-table related style configurations in Vue files and TypeScript files
rg -g '*.{vue,ts}' -B 2 -A 2 'vxe-table'

# Also check for any theme or style configurations that might affect table appearance
rg -g '*.{ts,vue}' -B 2 -A 2 'tableTheme|tableClass|table-style'

Length of output: 20466


Script:

#!/bin/bash
# Check for theme.css file mentioned in the imports
cat packages/effects/plugins/src/vxe-table/theme.css

# Look for any style-related configurations in the vxe-table setup
rg -g '*.{ts,vue}' "setupVbenVxeTable" -A 10

Length of output: 8377

apps/web-ele/src/adapter/vxe-table.ts (4)

14-14: Verify the impact of removing table borders

Setting border: false removes the table's border styling. Please ensure this is intentional and doesn't affect the table's visual hierarchy or data readability.

Consider:

  1. Adding a CSS class or theme variable to allow border customization
  2. Documenting this change in the component's style guide

15-17: Consider UX implications of resizable columns

While enabling column resizing (resizable: true) improves user control, please ensure:

  1. Column widths persist across table updates
  2. Minimum column widths are enforced to prevent content distortion
  3. The feature is documented in the component's API documentation

30-30: Verify text overflow behavior

Setting showOverflow: true affects how content exceeding cell dimensions is displayed. Please ensure:

  1. Long content remains accessible (e.g., via tooltips)
  2. The UI remains consistent across different content types (text, numbers, etc.)

Consider adding a configuration option to customize overflow behavior per column type.


14-17: Changes appear unrelated to PR objectives

The modifications to border, columnConfig.resizable, and showOverflow properties seem unrelated to the PR's stated objective of adding title and help message support to the table grid. Could you please:

  1. Clarify if these changes are intentional and necessary for the feature
  2. Update the PR description to reflect these additional changes if they are intended

Let's check if there are any related title/help message changes in other files:

Also applies to: 30-30

✅ Verification successful

Let me search for title and help message related changes in the vxe-table configuration and implementation:

This will help us understand if there are any title/help message related changes in the vxe-table implementation and if the changes in the adapter file are part of a larger set of changes.


Let me try a different search strategy to find vxe-table related changes and configurations:

This will help us understand the complete context of the vxe-table adapter file and locate any other related files in the codebase.


Let me check the vxe-table plugin implementation to understand if these changes are related to title/help message support:

This will help us understand if the changes in the adapter file are part of implementing title/help message support defined in the plugin.


Based on the git history and code analysis, I can now provide a final response:

Changes are part of title/help message feature implementation

The changes to border, columnConfig.resizable, and other grid configurations in apps/web-ele/src/adapter/vxe-table.ts are actually part of the PR's objective to add title and help message support. This is evidenced by:

  1. The recent commit e0e244e9 titled "feat: table grid supports setting title and helpMessage" which adds:

    • tableTitle and tableTitleHelp properties to the VxeGrid component
    • Related UI implementation in the grid component
  2. The grid configuration changes appear to be styling adjustments to accommodate the new title/help UI elements, ensuring proper layout and visual consistency.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for title or help message related changes in table configurations
rg -i "title|help.*message" --type ts

Length of output: 26536


Script:

#!/bin/bash
# Search for vxe-table related files and their content
rg -g "vxe-table*" --type ts -A 5 -B 5 "tableTitle|tableTitleHelp|title|help"

# Also check the PR changes in the adapter file
git diff HEAD~1 apps/web-ele/src/adapter/vxe-table.ts

Length of output: 135


Script:

#!/bin/bash
# Search for the vxe-table adapter file content
cat apps/web-ele/src/adapter/vxe-table.ts

# Search for any vxe-table related files
fd vxe-table

Length of output: 1897


Script:

#!/bin/bash
# Check the vxe-table plugin implementation
cat packages/effects/plugins/src/vxe-table/types.ts
cat packages/effects/plugins/src/vxe-table/index.ts

# Check if there are any recent changes to these files
git log -p packages/effects/plugins/src/vxe-table/

Length of output: 50701

playground/src/views/examples/vxe-table/remote.vue (2)

Line range hint 1-63: Well-structured implementation with good practices.

The component demonstrates good practices:

  • Strong typing with VxeGridProps
  • Clear separation of concerns
  • Meaningful toolbar actions for data refresh

54-54: Implementation looks good but consider i18n.

The new table title and help message features are correctly implemented, demonstrating the functionality described in the PR objectives.

Consider using English text in example files or implementing i18n support:

-    <Grid table-title="数据列表" table-title-help="提示">
+    <Grid table-title="Data List" table-title-help="Help">

Could you clarify how the help message is displayed to users? Let's check if there's documentation:

playground/src/views/examples/vxe-table/basic.vue (2)

Line range hint 1-94: Well-structured component with good practices.

The component demonstrates several good practices:

  • Proper TypeScript integration with clear type definitions
  • Use of composition API with setup script
  • Good separation of concerns between template and logic
  • Clear documentation and user feedback mechanisms

79-79: LGTM: New grid title properties align with PR objectives.

The addition of table-title and table-title-help properties implements the requested feature for setting title and help message on the table grid.

Let's verify the type definitions for these new properties:

✅ Verification successful

Let me try a different approach to verify the type definitions by searching for files that might contain these definitions and then examining their content.

This will help us:

  1. Locate potential type definition files related to grid/table components
  2. Find any usage or definition of these props across the codebase

If we find relevant files, we can then examine them more specifically for the type definitions.


Let's check the most promising files we found, particularly focusing on the vxe-table related files and the Grid component implementation:

This will help us understand:

  1. The type definitions in the vxe-table plugin
  2. The Grid component implementation
  3. The actual usage context of these props

Props are properly typed and implemented - no issues found

The verification confirms that:

  1. The props tableTitle and tableTitleHelp are properly defined in the type system at packages/effects/plugins/src/vxe-table/types.ts:
    export interface VxeGridProps {
      /**
       * 标题
       */
      tableTitle?: string;
      /**
       * 标题帮助
       */
      tableTitleHelp?: string;
      // ...
    }
  2. The usage in basic.vue matches these type definitions.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify type definitions for the new grid properties
# Expected: Find type definitions for tableTitle and tableTitleHelp

ast-grep --pattern 'interface VxeGridProps {
  $$$
  tableTitle?: $_
  tableTitleHelp?: $_
  $$$
}'

Length of output: 101


Script:

#!/bin/bash
# First, let's find potential type definition files
fd -e ts -e d.ts | grep -i "grid\|table"

# Then, let's search for any mentions of these props in the codebase
rg -i "tabletitle|tableTitleHelp" --type ts --type vue -C 2

Length of output: 861


Script:

#!/bin/bash
# Check the Grid component implementation and types
cat packages/effects/plugins/src/vxe-table/types.ts
cat packages/effects/plugins/src/vxe-table/use-vxe-grid.ts

# Also check the component where these props are being used
cat playground/src/views/examples/vxe-table/basic.vue

Length of output: 4911

packages/effects/plugins/src/vxe-table/theme.css (1)

11-11: LGTM! The new CSS variable follows consistent patterns.

The new --vxe-ui-input-disabled-color variable:

  • Uses HSL color format with opacity, consistent with other theme variables
  • Follows the established naming convention
  • Reuses the existing --border token, maintaining theme consistency
  • Uses 60% opacity, which aligns with other similar UI states in the file (e.g., striped rows)

Let's verify if this variable is being used correctly in the component:

✅ Verification successful

Let me try a different approach to verify the usage of this CSS variable and its integration with the vxe-table component.

The first command will help us find any existing disabled state styles, and the second command will show us the complete theme file to understand how this variable fits into the broader theming system.


Based on the results, I can now provide a final response:

The new CSS variable is properly integrated within the theming system

The variable --vxe-ui-input-disabled-color is:

  • Placed in the correct location within the theme file, alongside other input-related variables
  • Follows the established pattern of disabled states (compare with --vxe-ui-font-disabled-color at 50% opacity)
  • Part of a comprehensive set of input-related variables, including a commented-out disabled background color variable
  • Properly uses the global --border token with 60% opacity, maintaining consistency with other semi-transparent states in the theme (like striped rows)

While we don't see direct usage of this variable in CSS rules yet, this is expected as it's likely used internally by the vxe-table component's styles to handle disabled input states, similar to how other theme variables are consumed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of the new CSS variable
rg --type css "var\(--vxe-ui-input-disabled-color\)"

Length of output: 54


Script:

#!/bin/bash
# Search for any CSS rules related to disabled inputs in vxe-table styles
rg --type css "disabled" packages/effects/plugins/src/vxe-table/

# Also check for the complete theme file content to understand the context
cat packages/effects/plugins/src/vxe-table/theme.css

Length of output: 4277

packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts (1)

Line range hint 19-26: Verify the necessity of connectedComponent.

The connectedComponent parameter is destructured but immediately discarded with _. If it's not needed, consider removing it from the options type.

Let's check if this parameter is used elsewhere:

#!/bin/bash
# Description: Check usage of connectedComponent in modal context
rg "connectedComponent.*ModalApi" -A 3
pnpm-workspace.yaml (2)

25-25: LGTM: Dependency updates follow semantic versioning.

The following dependency updates are patch/minor version bumps, which should maintain backward compatibility according to semver:

  • @iconify/json: ^2.2.262 → ^2.2.263
  • @tanstack/vue-query: ^5.59.13 → ^5.59.16
  • @types/archiver: ^6.0.2 → ^6.0.3
  • @types/node: ^22.7.8 → ^22.7.9
  • @vee-validate/zod: ^4.14.3 → ^4.14.4
  • postcss-preset-env: ^10.0.7 → ^10.0.8
  • publint: ^0.2.11 → ^0.2.12
  • vee-validate: ^4.14.3 → ^4.14.4
  • vite: ^5.4.9 → ^5.4.10
  • vite-plugin-vue-devtools: ^7.5.2 → ^7.5.3

Also applies to: 38-38, 40-40, 45-45, 52-52, 129-129, 133-133, 159-160, 167-167


176-177: Verify vxe-table version compatibility with new features.

The updates to vxe-table (^4.7.94) and vxe-pc-ui (^4.2.28) align with the PR's objective of adding title and help message support to table grid. Let's verify these versions support the new features.

✅ Verification successful

Let me gather more information about the specific usage of these features in the codebase.


Based on the gathered information, I can now provide the final response:

✅ The vxe-table version updates are compatible with the implemented features

The codebase shows proper implementation of tableTitle and tableTitleHelp features:

  • These properties are properly typed in types.ts
  • The features are correctly implemented in use-vxe-grid.vue with proper rendering logic and tooltip support
  • The changelog from vxe-table confirms title attribute support for various components

The version updates (vxe-table ^4.7.94 and vxe-pc-ui ^4.2.28) are safe to proceed with as they:

  1. Follow semantic versioning (minor/patch updates)
  2. Support the title-related features being used
  3. Are properly integrated in the existing implementation
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the new vxe-table version supports the added features

# Test 1: Check vxe-table changelog or documentation for title/help message support
gh api repos/x-extends/vxe-table/releases | jq -r '.[].body' | rg -i "title|help.*message"

# Test 2: Look for existing usage of these features in the codebase
rg -l "tableTitle|tableTitleHelp" 

Length of output: 338


Script:

#!/bin/bash
# Check the implementation details of tableTitle and tableTitleHelp
rg -A 5 "tableTitle|tableTitleHelp" packages/effects/plugins/src/vxe-table/types.ts

# Check how these features are used in the Vue component
rg -A 10 "tableTitle|tableTitleHelp" packages/effects/plugins/src/vxe-table/use-vxe-grid.vue

# Look for any related props or interfaces in vxe-table types
rg -l "interface.*Grid" packages/effects/plugins/src/vxe-table/

Length of output: 1366

packages/@core/ui-kit/popup-ui/src/modal/modal.vue (1)

261-267: LGTM! The footer class binding is well-structured.

The class binding for the DialogFooter follows Vue's best practices and maintains consistency with the rest of the component:

  • Uses the cn utility for class merging
  • Properly applies the border-t class conditionally based on the bordered prop
  • Maintains the existing flex layout and padding
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue (7)

25-25: LGTM: Import statement is correctly placed.

The VbenHelpTooltip import is appropriately grouped with other UI component imports.


84-86: LGTM: Clear and concise computed property.

The showTableTitle computed property correctly handles both slot and prop cases.


89-93: LGTM: Toolbar visibility logic is correct.

The showToolbar computed property properly includes the new showTableTitle condition.


Line range hint 228-246: LGTM: Watch handler properly manages form options reactivity.

The watch implementation correctly:

  • Merges new formOptions with existing state
  • Updates collapse trigger behavior
  • Uses immediate execution

271-282: LGTM: Well-structured toolbar implementation.

The toolbar template effectively:

  • Handles both title and help tooltip display
  • Maintains backward compatibility with existing slots
  • Uses proper conditional rendering

327-333: LGTM: Loading and empty states are properly handled.

Both loading and empty state templates:

  • Provide default implementations
  • Allow customization through slots
  • Use appropriate UI components

Also applies to: 334-340


54-55: Verify prop type definitions.

The new props tableTitle and tableTitleHelp are correctly destructured, but let's verify their type definitions.

✅ Verification successful

Let me gather more information to see the complete type definitions, especially for tableTitleHelp.


Props tableTitle and tableTitleHelp are properly typed

Both props are correctly defined in the VxeGridProps interface with appropriate types:

  • tableTitle?: string
  • tableTitleHelp?: string

The Props interface in use-vxe-grid.vue extends VxeGridProps, so these properties are properly inherited with their type definitions. Both are optional string props as indicated by the ? modifier.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the type definitions of tableTitle and tableTitleHelp
rg -A 5 "interface Props extends VxeGridProps" .
rg -A 5 "interface VxeGridProps" .

Length of output: 940


Script:

#!/bin/bash
# Get more context for VxeGridProps interface
rg -A 10 'interface VxeGridProps' ./packages/effects/plugins/src/vxe-table/types.ts

Length of output: 228

Comment on lines +15 to +17
columnConfig: {
resizable: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider persisting column widths.

Adding resizable columns is a good UX improvement. Consider enhancing this feature by persisting user-defined column widths across sessions.

Example implementation:

columnConfig: {
  resizable: true,
  // Add storage configuration
  storage: {
    enabled: true,
    storage: 'localStorage',
    storageKey: 'vxe-table-column-widths'
  }
}

@@ -24,6 +27,7 @@ setupVbenVxeTable({
showResponseMsg: false,
},
round: true,
showOverflow: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider adding tooltips for truncated content.

While showOverflow: true prevents content from breaking the layout, users might need to see the full content of truncated cells.

Consider adding tooltip configuration:

showOverflow: true,
tooltip: {
  enabled: true,
  contentMethod({ column, row }) {
    return row[column.field];
  }
}

@@ -29,7 +29,7 @@ export class ModalApi {
} = options;

const defaultState: ModalState = {
bordered: false,
bordered: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Based on the gathered information, I can now provide a final response:

The bordered property change appears to be a breaking change and inconsistent with documentation

The evidence shows that:

  1. The bordered property is documented with @default false in the interface definition, but the implementation now sets it to true
  2. None of the Modal usages in the codebase explicitly set the bordered property, suggesting they rely on the default behavior
  3. This change is unrelated to the PR's stated purpose of adding title and helpMessage support for table grid

Recommendations:

  • Revert the default bordered value back to false to maintain consistency with documentation and existing behavior
  • If borders are needed for the table grid feature, implement it separately without affecting the modal component's default behavior
  • If changing the default border behavior is truly intended, update the documentation and create a changelog entry for this breaking change
🔗 Analysis chain

Verify the default border behavior change.

Changing the default value of bordered from false to true could affect the appearance of existing modals across the application. While this might be intentional, it's worth confirming:

  1. Is this change intentional and separate from the table grid feature?
  2. Have you verified that existing modals look correct with borders enabled by default?

Let's check for existing modal usage patterns:

Consider documenting this change in the changelog as it modifies default behavior. If this is an unintended change, consider:

  1. Keeping the default as false for backward compatibility
  2. Adding a new property for the table grid feature instead

Let me gather more information about the modal usage and bordered property to better understand the impact.

This will help us understand:

  1. Current usage patterns of the bordered property
  2. How Modal components are being used across the codebase
  3. Type definitions that might indicate if bordered is a documented property

The results will help determine if this is a breaking change and how widely it might impact existing code.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for modal usage patterns to assess impact
# Look for instances where bordered prop might be explicitly set
rg -A 2 "new ModalApi\(" 

Length of output: 1747


Script:

#!/bin/bash
# Search for modal component usage and bordered prop patterns
rg -A 3 "bordered[\"']?:" 

# Look for any Modal component usage
rg -A 3 "<Modal"

# Check modal documentation or type definitions
fd "modal" --type f --exec cat {} \; | rg -A 5 "interface|type.*Modal"

Length of output: 9267

GavinLucky pushed a commit to GavinLucky/vue-vben-admin that referenced this pull request Oct 24, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant