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

Fix ue/main #615

Merged
merged 10 commits into from
Aug 26, 2024
Merged

Fix ue/main #615

merged 10 commits into from
Aug 26, 2024

Conversation

saint3347
Copy link
Collaborator

@saint3347 saint3347 commented Aug 23, 2024

Types of changes

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Others

Changelog

  • 修复Table固定列的阴影有1px的露底问题
  • 修复Tabs组件下渲染非Tabs.Panel子组件时报错的问题
  • 修复Table传了virtual但是容器没有定高导致的抖动问题
  • 优化Tabs组件的Header区域横向滚动的动画

Summary by CodeRabbit

  • 新功能

    • 更新了版本号至3.3.5,包含了新功能和改进。
    • 为日期选择器和时间选择器中的按钮添加了新的样式属性,提高了用户界面的可视性和交互性。
    • 改进了标签组件的渲染逻辑,仅渲染特定命名的组件,提高性能。
    • 为表格列项的宽度属性添加了灵活性,允许使用字符串指定宽度。
    • 引入了新的函数以增强对命名组件的识别能力。
  • 错误修复

    • 修复了标签组件中的错误,解决了渲染非Tabs.Panel子组件时导致的错误。
  • 样式

    • 更新了标签组件的滚动头部样式,改善了过渡效果。
  • 文档

    • 添加了版本3.3.5的变更日志条目,提供了bug修复的详细信息。

Copy link

coderabbitai bot commented Aug 23, 2024

Walkthrough

本次更新包含多个文件的修改,主要集中在版本号的增量、按钮组件的样式更新、Tabs 组件的渲染逻辑改进、表格使用的灵活性增强以及新工具函数的引入。还修复了与 Tabs 组件相关的错误,并更新了相关文档,确保整体性能和可维护性。

Changes

文件 更改摘要
package.json 版本号从 "3.3.3" 更新至 "3.3.5"
packages/base/src/date-picker/*.tsx 在按钮组件中新增 mode='text'type='primary' 属性
packages/base/src/tabs/tabs.tsx 新增 isNamedComponent 工具函数,改进子组件渲染逻辑
packages/hooks/src/components/use-table/*.tsx 修改 rowsInView 逻辑以动态响应滚动状态
packages/hooks/src/components/use-table.type.ts TableColumnItem 接口中的 width 属性更新为接受字符串或数字
packages/hooks/src/utils/is.ts 新增 isNamedComponent 函数
packages/shineout-style/src/tabs/tabs.ts 修改 headerScroll 样式的过渡效果
packages/shineout/src/tabs/__doc__/changelog.cn.md 新增 3.3.5 版本的变更日志,修复 Tabs 组件的错误
packages/shineout/src/tabs/__test__/tabs.spec.tsx 修改 Tabs 组件测试用例中类的预期长度

🐇 在代码的草地上,
小按钮跳跃,真欢快!
版本更新如春风,
Tabs 修复不再错,
我是兔子乐无边,
代码虽小心欢腾! 🐇


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

@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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 31beffb and 586f68a.

Files selected for processing (9)
  • package.json (1 hunks)
  • packages/base/src/date-picker/day.tsx (2 hunks)
  • packages/base/src/date-picker/time.tsx (1 hunks)
  • packages/base/src/tabs/tabs.tsx (3 hunks)
  • packages/hooks/src/components/use-table/use-table-virtual.tsx (1 hunks)
  • packages/hooks/src/components/use-table/use-table.type.ts (1 hunks)
  • packages/hooks/src/utils/is.ts (1 hunks)
  • packages/shineout-style/src/tabs/tabs.ts (1 hunks)
  • packages/shineout/src/tabs/doc/changelog.cn.md (1 hunks)
Files skipped from review due to trivial changes (2)
  • package.json
  • packages/shineout/src/tabs/doc/changelog.cn.md
Additional context used
Biome
packages/hooks/src/utils/is.ts

[error] 89-89: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)

Additional comments not posted (9)
packages/base/src/date-picker/time.tsx (1)

150-151: 按钮组件的属性更新看起来不错!

Button 组件添加 mode='text'type="primary" 属性可以增强按钮的样式和交互行为。

packages/base/src/tabs/tabs.tsx (2)

11-11: 导入 isNamedComponent 的更改看起来不错!

引入 isNamedComponent 函数有助于提高组件渲染逻辑的健壮性。


149-156: 验证 isNamedComponent 的使用

确保 isNamedComponent 函数在代码库中正确使用,以避免渲染不符合条件的组件。

运行以下脚本以验证 isNamedComponent 的使用:

Verification successful

验证通过:isNamedComponent 函数使用正确

在代码库中,isNamedComponent 函数用于检查组件的 displayName,确保只有符合条件的组件被渲染。此功能在 tabs.tsx 文件中的使用符合预期。

  • packages/base/src/tabs/tabs.tsx: isNamedComponent 函数用于验证 Chlid.typedisplayName
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `isNamedComponent` in the codebase.

# Test: Search for the function usage. Expect: Correct usage with displayName checks.
rg --type tsx -A 5 $'isNamedComponent'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify the usage of `isNamedComponent` in the codebase using a general search pattern.

# Test: Search for the function usage in .tsx files. Expect: Correct usage with displayName checks.
rg 'isNamedComponent' --glob '**/*.tsx' -A 5

Length of output: 842

packages/base/src/date-picker/day.tsx (2)

163-164: 确认 Button 组件支持的属性

请确保 Button 组件支持 mode='text'type="primary" 属性。这些属性的添加应该符合设计要求。


175-176: 确认 Button 组件支持的属性

请确保 Button 组件支持 mode='text'type="primary" 属性。这些属性的添加应该符合设计要求。

packages/hooks/src/components/use-table/use-table.type.ts (1)

267-267: 验证 width 属性的兼容性

请确保代码库中使用 TableColumnItem 接口的其他部分能够处理 width 属性为 number | string 的情况。检查相关逻辑是否支持这两种类型。

packages/hooks/src/components/use-table/use-table-virtual.tsx (2)

23-24: 检查 rowsInView 的逻辑

请确保在没有垂直滚动的情况下,rowsInView 被正确设置为 props.data.length。这段逻辑应该准确识别滚动状态。


25-29: 验证垂直滚动检测逻辑

请确认 withoutVerticalScroll 的计算逻辑准确无误,并且在没有垂直滚动时,rowsInView 被正确调整。

packages/shineout-style/src/tabs/tabs.ts (1)

542-542: 过渡效果更新为更平滑的动画

headerScroll 的过渡效果从 ease-out 改为 cubic-bezier(.34,.69,.1,1),这将使动画更平滑。该更改有助于改善用户体验。

Comment on lines +88 to +90
export function isNamedComponent(type: any): type is React.ForwardRefExoticComponent<unknown> {
return (isObject(type) || isFunc(type)) && type.hasOwnProperty('displayName');
}
Copy link

Choose a reason for hiding this comment

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

建议使用 Object.hasOwn()

isNamedComponent 函数中,建议用 Object.hasOwn(type, 'displayName') 替换 type.hasOwnProperty('displayName'),以避免直接从对象实例上调用 hasOwnProperty 方法。

应用以下代码修复:

 export function isNamedComponent(type: any): type is React.ForwardRefExoticComponent<unknown> {
-  return (isObject(type) || isFunc(type)) && type.hasOwnProperty('displayName');
+  return (isObject(type) || isFunc(type)) && Object.hasOwn(type, 'displayName');
}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function isNamedComponent(type: any): type is React.ForwardRefExoticComponent<unknown> {
return (isObject(type) || isFunc(type)) && type.hasOwnProperty('displayName');
}
export function isNamedComponent(type: any): type is React.ForwardRefExoticComponent<unknown> {
return (isObject(type) || isFunc(type)) && Object.hasOwn(type, 'displayName');
}
Tools
Biome

[error] 89-89: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)

Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 586f68a and 24f5b1e.

Files selected for processing (1)
  • packages/shineout/src/tabs/test/tabs.spec.tsx (1 hunks)
Additional comments not posted (1)
packages/shineout/src/tabs/__test__/tabs.spec.tsx (1)

359-359: 验证预期的更改

预期的.demo类元素数量从2变为0,表明测试场景或底层实现已更新。请确保此更改与组件的渲染行为或状态管理的预期一致。

请确认此更改是否符合预期的组件行为。

Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 24f5b1e and abd46ee.

Files selected for processing (1)
  • packages/shineout/src/tabs/test/tabs.spec.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/shineout/src/tabs/test/tabs.spec.tsx

Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between abd46ee and 145c376.

Files selected for processing (8)
  • packages/base/src/table/colgroup.tsx (1 hunks)
  • packages/base/src/table/tbody.type.ts (1 hunks)
  • packages/base/src/table/tfoot.tsx (2 hunks)
  • packages/base/src/table/tfoot.type.ts (1 hunks)
  • packages/base/src/table/thead.tsx (2 hunks)
  • packages/base/src/table/thead.type.ts (1 hunks)
  • packages/base/src/table/tr.tsx (3 hunks)
  • packages/shineout/src/table/example/test-001-sort-old.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/shineout/src/table/example/test-001-sort-old.tsx
Additional comments not posted (12)
packages/base/src/table/tfoot.type.ts (1)

10-10: 更改已批准,但请验证 colgroup 的使用情况。

此更改增强了 colgroup 属性的灵活性。请确保代码库中所有对 colgroup 的使用都与新类型兼容。

代码更改已批准。

运行以下脚本以验证 colgroup 的使用情况:

Verification successful

colgroup 属性的类型更改已在代码库中一致应用。

tfoot.type.tstbody.type.tsthead.type.ts 文件中,colgroup 的类型均已更新为 (number | string | undefined)[],没有发现不兼容的使用情况。

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `colgroup` match the new type.

# Test: Search for the `colgroup` usage. Expect: Only occurrences of the new type.
rg --type typescript -A 5 $'colgroup'

Length of output: 71


Script:

#!/bin/bash
# Description: Verify all usages of `colgroup` match the new type.

# Test: Search for the `colgroup` usage in TypeScript files.
rg --glob '*.ts' -A 5 'colgroup'

Length of output: 969

packages/base/src/table/colgroup.tsx (2)

2-2: 更改已批准,但请验证 colgroup 的使用情况。

此更改增强了 colgroup 属性的灵活性。请确保代码库中所有对 colgroup 的使用都与新类型兼容。

代码更改已批准。

运行以下脚本以验证 colgroup 的使用情况:

Verification successful

colgroup 属性的类型更改已在代码库中正确应用。

以下文件中使用了新的类型 (number | string | undefined)[],并且没有发现不兼容的用法:

  • packages/base/src/table/tfoot.type.ts
  • packages/base/src/table/tbody.type.ts
  • packages/base/src/table/thead.type.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `colgroup` match the new type.

# Test: Search for the `colgroup` usage. Expect: Only occurrences of the new type.
rg --type typescript -A 5 $'colgroup'

Length of output: 71


Script:

#!/bin/bash
# Description: Verify all usages of `colgroup` match the new type.

# Correct the search for `colgroup` usage in TypeScript files.
rg 'colgroup' --glob '*.ts' -A 5

Length of output: 969


3-3: 更改已批准,但请验证 columns 的使用情况。

此更改增强了 columns 属性的灵活性。请确保代码库中所有对 columns 的使用都与新类型兼容。

代码更改已批准。

运行以下脚本以验证 columns 的使用情况:

Verification successful

验证完成:columns 属性的使用兼容新类型

在代码库中检查了 columns 的使用情况,确认所有用法都兼容新的类型定义。未发现任何与 string 类型不兼容的用法。

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `columns` match the new type.

# Test: Search for the `columns` usage. Expect: Only occurrences of the new type.
rg --type typescript -A 5 $'columns'

Length of output: 70


Script:

#!/bin/bash
# Description: Verify all usages of `columns` match the new type.

# Test: Search for the `columns` usage. Expect: Only occurrences of the new type.
rg --type ts -A 5 $'columns'

Length of output: 294860

packages/base/src/table/thead.type.ts (1)

25-25: 更改已批准,但请验证 colgroup 的使用情况。

此更改增强了 colgroup 属性的灵活性。请确保代码库中所有对 colgroup 的使用都与新类型兼容。

代码更改已批准。

运行以下脚本以验证 colgroup 的使用情况:

Verification successful

colgroup 属性的类型更改已验证为兼容。

在代码库中对 colgroup 的使用与新类型 (number | string | undefined)[] 兼容,没有发现任何问题。所有相关操作均符合预期。

  • 相关文件包括:thead.tsxtr.tsxtbody.tsxtfoot.tsxcolgroup.tsx 等。
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `colgroup` match the new type.

# Test: Search for the `colgroup` usage. Expect: Only occurrences of the new type.
rg --type typescript -A 5 $'colgroup'

Length of output: 71


Script:

#!/bin/bash
# Description: Verify all usages of `colgroup` match the new type.

# Test: Search for the `colgroup` usage in TypeScript files. Expect: Only occurrences of the new type.
rg --type ts -A 5 $'colgroup'

Length of output: 17010

packages/base/src/table/tbody.type.ts (1)

29-29: 更改看起来不错,但请验证 colgroup 属性的使用情况。

colgroup 属性的类型扩展为包含字符串增强了其灵活性。请确保代码库中所有使用 colgroup 属性的地方都能正确处理新类型。

代码更改已批准。

运行以下脚本以验证 colgroup 属性的使用情况:

packages/base/src/table/tfoot.tsx (2)

25-25: 改进了计算的健壮性。

reduce 函数现在显式地将值转换为数字,确保所有值都被视为数字,从而提高了计算的健壮性。

代码更改已批准。


37-37: 改进了计算的健壮性。

reduce 函数现在显式地将值转换为数字,确保所有值都被视为数字,从而提高了计算的健壮性。

代码更改已批准。

packages/base/src/table/thead.tsx (2)

123-123: 改进了计算的健壮性。

reduce 函数现在显式地将值转换为数字,确保所有值都被视为数字,从而提高了计算的健壮性。

代码更改已批准。


135-135: 改进了计算的健壮性。

reduce 函数现在显式地将值转换为数字,确保所有值都被视为数字,从而提高了计算的健壮性。

代码更改已批准。

packages/base/src/table/tr.tsx (3)

43-43: 更改已批准:更新 colgroup 属性类型

colgroup 属性类型更新为 (number | string | undefined)[] 增强了灵活性。

代码更改已批准。


74-76: 更改已批准:显式转换为数字

getFixedStyle 函数中显式将值转换为 Number,确保所有元素都被视为数字,防止类型不匹配的潜在错误。

代码更改已批准。


86-88: 更改已批准:显式转换为数字

getFixedStyle 函数中显式将值转换为 Number,确保所有元素都被视为数字,防止类型不匹配的潜在错误。

代码更改已批准。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant