Skip to content

Commit

Permalink
feat: 支持 antd v5
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Nov 14, 2023
1 parent 25ce9b0 commit dbba47c
Show file tree
Hide file tree
Showing 22 changed files with 1,122 additions and 1,014 deletions.
14 changes: 7 additions & 7 deletions packages/s2-core/src/common/constant/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const TOOLTIP_POSITION_OFFSET: TooltipPosition = {
export const getTooltipOperatorHiddenColumnsMenu = (): TooltipOperatorMenu => {
return {
key: 'hiddenColumns',
text: i18n('隐藏'),
label: i18n('隐藏'),
icon: 'EyeOutlined',
};
};
Expand All @@ -31,32 +31,32 @@ export const getTooltipOperatorSortMenus = (): TooltipOperatorMenu[] => [
{
key: 'asc',
icon: 'groupAsc',
text: i18n('组内升序'),
label: i18n('组内升序'),
},
{
key: 'desc',
icon: 'groupDesc',
text: i18n('组内降序'),
label: i18n('组内降序'),
},
{
key: 'none',
text: i18n('不排序'),
label: i18n('不排序'),
},
];

export const getTooltipOperatorTableSortMenus = (): TooltipOperatorMenu[] => [
{
key: 'asc',
icon: 'groupAsc',
text: i18n('升序'),
label: i18n('升序'),
},
{
key: 'desc',
icon: 'groupDesc',
text: i18n('降序'),
label: i18n('降序'),
},
{
key: 'none',
text: i18n('不排序'),
label: i18n('不排序'),
},
];
2 changes: 1 addition & 1 deletion packages/s2-core/src/common/interface/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface TooltipOperatorMenu<Icon = Element | string, Text = string> {
/** 自定义 icon */
icon?: Icon;
/** 名称 */
text?: Text;
label?: Text;
/** 点击回调 */
onClick?: (cell: S2CellType) => void;
/** 是否显示 */
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"react-beautiful-dnd": "^13.1.1"
},
"devDependencies": {
"@ant-design/icons": "^4.8.1",
"@ant-design/icons": "^5.2.6",
"@antv/event-emitter": "^0.1.3",
"@antv/g": "^5.15.2",
"@antv/s2": "workspace:*",
Expand Down
29 changes: 29 additions & 0 deletions packages/s2-react/playground/components/EditableSheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { SpreadSheet } from '@antv/s2';
import React from 'react';
import {
SheetComponent,
type SheetComponentOptions,
type SheetComponentsProps,
} from '../../src/components';
import { tableSheetDataCfg } from '../config';
import { onSheetMounted } from '../utils';

export const options: SheetComponentOptions = {
width: 600,
height: 480,
tooltip: {
enable: false,
},
};

export const EditableSheet: React.FC<
Partial<SheetComponentsProps> & React.RefAttributes<SpreadSheet>
> = React.forwardRef((props, ref) => (
<SheetComponent
sheetType="editable"
dataCfg={tableSheetDataCfg}
options={options}
ref={ref}
onMounted={onSheetMounted}
/>
));
22 changes: 21 additions & 1 deletion packages/s2-react/playground/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,29 @@ export const s2Options: SheetComponentOptions = {
operation: {
hiddenColumns: true,
menus: [
{
key: 'trend-2',
label: '趋势',
icon: 'Trend',
onClick: (cell) => {
// eslint-disable-next-line no-console
console.log('趋势图 icon 点击: 2222', cell);
},
children: [
{
key: 'trend-3',
label: '趋势-3',
icon: 'Trend',
onClick: (cell) => {
// eslint-disable-next-line no-console
console.log('趋势图 icon 点击:3333 ', cell);
},
},
],
},
{
key: 'trend',
text: '趋势',
label: '趋势',
icon: 'Trend',
visible: (cell) => cell.cellType === CellType.DATA_CELL,
onClick: (cell) => {
Expand Down
Loading

0 comments on commit dbba47c

Please sign in to comment.