-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: s2-react 移除 antd 的依赖, 相关分析组件迁移到 s2-react-components
中 只保留 drill-down, pagination, tooltip 三个基础能力组件 BREAKING CHANGE: 移除 header props 参数 (不再内置行列切换, 导出, 高级排序), 移除 antd ConfigProvider 包裹
- Loading branch information
1 parent
7f13ab1
commit 11c08ef
Showing
45 changed files
with
17,518 additions
and
12,674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s2-react/src/components/header/index.less → ...t-components/playground/Header/index.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
packages/s2-react-components/playground/Header/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* eslint-disable no-console */ | ||
import { ExportOutlined } from '@ant-design/icons'; | ||
import { getLang, type SpreadSheet } from '@antv/s2'; | ||
import reactPkg from '@antv/s2-react/package.json'; | ||
import corePkg from '@antv/s2/package.json'; | ||
import { version as AntdVersion, App, Button, Space, Tag } from 'antd'; | ||
import cx from 'classnames'; | ||
import React from 'react'; | ||
import pkg from '../../package.json'; | ||
import { AdvancedSort, Export, Switcher, type SwitcherProps } from '../../src'; | ||
import './index.less'; | ||
|
||
export interface HeaderProps { | ||
sheetInstance: SpreadSheet; | ||
} | ||
|
||
const switcherFields: SwitcherProps = { | ||
rows: { | ||
items: [{ id: 'province' }, { id: 'city' }], | ||
allowEmpty: false, | ||
}, | ||
columns: { | ||
items: [{ id: 'type', displayName: '类型 (type)' }], | ||
}, | ||
values: { | ||
selectable: true, | ||
items: [ | ||
{ id: 'price', checked: true }, | ||
{ id: 'cost', checked: false }, | ||
], | ||
}, | ||
title: '行列切换', | ||
onSubmit(result) { | ||
console.log('result:', result); | ||
}, | ||
}; | ||
|
||
export const SheetHeader: React.FC<HeaderProps> = React.memo((props) => { | ||
const { sheetInstance } = props; | ||
const PRE_CLASS = `sheet-header`; | ||
|
||
const renderExtra = () => ( | ||
<Space align="center"> | ||
<Switcher {...switcherFields} /> | ||
<AdvancedSort | ||
sheetInstance={sheetInstance} | ||
onSortConfirm={(ruleValues, sortParams) => { | ||
console.log('AdvancedSort:', ruleValues, sortParams); | ||
}} | ||
/> | ||
<Export sheetInstance={sheetInstance}> | ||
<Button type="text" icon={<ExportOutlined />}> | ||
导出数据 | ||
</Button> | ||
</Export> | ||
<Export sheetInstance={sheetInstance} /> | ||
</Space> | ||
); | ||
|
||
return ( | ||
<App> | ||
<div | ||
className={cx(PRE_CLASS)} | ||
style={{ | ||
width: sheetInstance?.options.width, | ||
}} | ||
> | ||
<div className={`${PRE_CLASS}-heading`}> | ||
<div className={`${PRE_CLASS}-heading-left`}> | ||
<div className={`${PRE_CLASS}-heading-title`}> | ||
<a href="https://github.com/antvis/S2">{pkg.name} playground</a> | ||
</div> | ||
</div> | ||
<div className={`${PRE_CLASS}-heading-extra`}>{renderExtra()}</div> | ||
</div> | ||
<div className={`${PRE_CLASS}-content`}> | ||
<Space> | ||
<span> | ||
{pkg.name}: <Tag>{pkg.version}</Tag> | ||
</span> | ||
<span> | ||
{corePkg.name}: <Tag>{corePkg.version}</Tag> | ||
</span> | ||
<span> | ||
{reactPkg.name}: <Tag>{reactPkg.version}</Tag> | ||
</span> | ||
<span> | ||
antd: <Tag>{AntdVersion}</Tag> | ||
</span> | ||
<span> | ||
react: <Tag>{React.version}</Tag> | ||
</span> | ||
<span> | ||
lang: <Tag>{getLang()}</Tag> | ||
</span> | ||
</Space> | ||
</div> | ||
</div> | ||
</App> | ||
); | ||
}); | ||
|
||
SheetHeader.displayName = 'SheetHeader'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ | |
.config { | ||
display: flex; | ||
align-items: flex-start; | ||
margin-bottom: 20px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
packages/s2-react-components/src/components/analysis/advanced-sort/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { AdvancedSort } from './advanced-sort'; | ||
|
||
export * from './interface'; |
Oops, something went wrong.