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(react-componnets): 分析配置组件包初始化 #2751

Merged
merged 11 commits into from
Jun 3, 2024

Conversation

lijinke666
Copy link
Member

@lijinke666 lijinke666 commented May 29, 2024

👀 PR includes

🔧 Chore

  • Test case
  • Docs / demos update
  • CI / workflow
  • Release version
  • Other ( @antv/s2-react-componnets 初始化)

📝 Description

确定的点:

  • 新增 主题风格配置面板/宽高调整面板/文本对齐 三个配置组件

后面可以做的 (待讨论的点):

  • 现有分析组件 (行列切换/高级排序) 等从 s2-react 迁移至 s2-react-components 中, 很多人其实不需要用到这些, 包解耦, 减少体积

image

  • 移除 SheetComponents 的 header (switcher/advanceSort) 配置, 只保留导出, 如果需要使用分析组件, 自行组合使用即可.

该 PR 改动点:

  • 初始化 s2-react-components 包
  • React 升级到 18.3, 移除废弃的 defaultProps 写法
  • 新增 prettier-plugin-packagejsonprettier-plugin-organize-imports 插件, 自动移除未使用的导入 (全量格式化)
  • 修复 pnpm 和 typescript 类型 reference 问题

🖼️ Screenshot

Before After

🔗 Related issue link

🔍 Self-Check before the merge

  • Add or update relevant docs.
  • Add or update relevant demos.
  • Add or update test case.
  • Add or update relevant TypeScript definitions.

Copy link

vercel bot commented May 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
antvis-s2 ❌ Failed (Inspect) Jun 3, 2024 9:05am

@github-actions github-actions bot added the next 2.0-next 版本的问题 label May 29, 2024
@github-actions github-actions bot requested review from wjgogogo and wuhaiyang May 29, 2024 09:00
Copy link
Contributor

github-actions bot commented May 29, 2024

你好, @lijinke666 CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。

Hello, @lijinke666 CI run failed, please click the [Details] button for detailed log information and fix it.

@github-actions github-actions bot added 🚨 lint failed 静态检查失败 🚨 test failed 单元测试挂了 labels May 29, 2024
Copy link
Contributor

github-actions bot commented May 29, 2024

Size Change: -1.11 kB (-0.34%)

Total Size: 322 kB

Filename Size Change
./packages/s2-core/dist/index.min.js 226 kB -432 B (-0.19%)
./packages/s2-react/dist/index.min.js 68.8 kB -550 B (-0.79%)
./packages/s2-react/dist/style.min.css 3.92 kB -7 B (-0.18%)
./packages/s2-vue/dist/index.min.js 20.9 kB -121 B (-0.58%)
ℹ️ View Unchanged
Filename Size
./packages/s2-core/dist/style.min.css 402 B
./packages/s2-vue/dist/style.min.css 1.99 kB

compressed-size-action

@lijinke666 lijinke666 changed the title [WIP] chore(react-componnets): 分析配置组件包初始化 chore(react-componnets): 分析配置组件包初始化 May 30, 2024
@github-actions github-actions bot added the pr(chore) configuration changes label May 30, 2024

let sheetInstance: SpreadSheet;

function MainLayout() {
const options: SheetComponentsProps['options'] = {
Copy link
Member Author

Choose a reason for hiding this comment

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

类型名一直是错的, 多了一个 s, 和 SheetComponentOptions 保持一致

@@ -1,12 +1,11 @@
import { TOOLTIP_PREFIX_CLS } from '@antv/s2';
import { Menu } from 'antd';
import type { ItemType } from 'antd/lib/menu/hooks/useItems';
Copy link
Member Author

Choose a reason for hiding this comment

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

新版本的 antd 可以通过 GetProp 工具体操取内部未导出的 props 了

@@ -79,8 +80,3 @@ export const TooltipOperator: React.FC<Required<TooltipOperatorProps>> =
});

TooltipOperator.displayName = 'TooltipOperator';
TooltipOperator.defaultProps = {
Copy link
Member Author

Choose a reason for hiding this comment

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

React 18.3.0 废弃了 defaultProps


const DEFAULT_PAGE_SIZE = 10;
const DEFAULT_PAGE_NUMBER = 1;

export const usePagination = (s2: SpreadSheet, props: SheetComponentsProps) => {
export const usePagination = (
Copy link
Member Author

@lijinke666 lijinke666 May 30, 2024

Choose a reason for hiding this comment

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

这里 typescript 自动推导有问题, 会导致打包错误, 之前的这个方案不稳定, 而且会引一个额外的包.

修改为显式声明

image

@wjgogogo
Copy link
Contributor

ref: #1790,看看这个是不是可以顺带优化

@lijinke666
Copy link
Member Author

ref: #1790,看看这个是不是可以顺带优化

可以, 后面分不同的 PR 优化吧, 这个 PR 只做初始化和代码格式化

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 97.67442% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 80.16%. Comparing base (ecdc9c8) to head (15ae8bd).
Report is 380 commits behind head on next.

Files Patch % Lines
packages/s2-core/src/cell/data-cell.ts 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2751      +/-   ##
==========================================
+ Coverage   75.77%   80.16%   +4.39%     
==========================================
  Files         257      176      -81     
  Lines       11994    10210    -1784     
  Branches     2464     2311     -153     
==========================================
- Hits         9088     8185     -903     
+ Misses       1398      599     -799     
+ Partials     1508     1426      -82     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lijinke666 lijinke666 merged commit afd48ac into next Jun 3, 2024
8 of 9 checks passed
@lijinke666 lijinke666 deleted the chore-init-react-componnets branch June 3, 2024 09:47
@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-v2.0.0-next.24 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-react-v2.0.0-next.23 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-vue-v2.0.0-next.15 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-react-components-v1.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next 2.0-next 版本的问题 pr(chore) configuration changes released on @next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants