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

ProComponents 3.0 开发 #8179

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9ce02a8
删除 兼容代码
chenshuai2144 Feb 21, 2024
50c78d0
删除 4.0 的依赖
chenshuai2144 Feb 21, 2024
f90e5e9
remove test code
chenshuai2144 Feb 21, 2024
b7d2fd4
删除兼容性代码
chenshuai2144 Feb 21, 2024
52ed901
删除水印组件
chenshuai2144 Feb 21, 2024
8e20d26
fix test
chenshuai2144 Feb 21, 2024
b4633fc
update snapshot
chenshuai2144 Feb 21, 2024
e5e3b3c
update
chenshuai2144 Feb 21, 2024
fc84bb5
删除无用的代码
chenshuai2144 Feb 22, 2024
b67b70e
增加新的测试用例
chenshuai2144 Feb 22, 2024
3614db7
增加测试用例
chenshuai2144 Feb 23, 2024
48c98d5
优化测试用例
chenshuai2144 Feb 23, 2024
a7ea63b
add more test
chenshuai2144 Feb 24, 2024
ed37590
add more test
chenshuai2144 Feb 24, 2024
db0602f
add more test
chenshuai2144 Feb 24, 2024
0c7bd4f
fix build
chenshuai2144 Feb 24, 2024
c28e8c6
fix build
chenshuai2144 Feb 24, 2024
e49f37c
fix build
chenshuai2144 Feb 24, 2024
bd08d39
fix build
chenshuai2144 Feb 24, 2024
5af61e1
fix build
chenshuai2144 Feb 25, 2024
ad60d5d
fix build
chenshuai2144 Feb 25, 2024
10f4034
fix build
chenshuai2144 Feb 25, 2024
f946a06
fix build
chenshuai2144 Feb 25, 2024
f5edbbe
fix build
chenshuai2144 Feb 25, 2024
641ecc7
fix build
chenshuai2144 Feb 25, 2024
89bcaa6
merge master
chenshuai2144 Apr 7, 2024
e78e87f
重写 transform
chenshuai2144 Apr 11, 2024
5c86b19
重写 transform
chenshuai2144 Apr 11, 2024
fceffed
merge master
chenshuai2144 Apr 21, 2024
d14356c
merge master
chenshuai2144 Apr 21, 2024
cb80e0c
merge master
chenshuai2144 May 20, 2024
3b32268
new
chenshuai2144 May 20, 2024
e7fd708
merge
chenshuai2144 Jun 6, 2024
f1cac12
merge
chenshuai2144 Jun 6, 2024
9f92a0f
merge
chenshuai2144 Jun 6, 2024
b3770ab
merge
chenshuai2144 Jun 6, 2024
39d5de8
renderFormItem change to formItemRender
chenshuai2144 Jun 6, 2024
c3d65b3
fix snapshot build error
chenshuai2144 Jun 6, 2024
2236c11
fix snapshot build error
chenshuai2144 Jun 6, 2024
0749099
merge
chenshuai2144 Jun 27, 2024
06371a4
remove
chenshuai2144 Jun 27, 2024
4a8f063
remove
chenshuai2144 Jun 27, 2024
04e7617
chore: update snapshot
chenshuai2144 Jul 29, 2024
cd974c6
chore: update snapshot
chenshuai2144 Jul 29, 2024
50ad090
减少button的宽度
chenshuai2144 Jul 30, 2024
3104b23
fix test
chenshuai2144 Jul 30, 2024
34b57a9
fix test
chenshuai2144 Jul 30, 2024
356c990
修复测试问题
chenshuai2144 Jul 30, 2024
4bfe7bc
merge master
chenshuai2144 Sep 26, 2024
664b932
merge
chenshuai2144 Sep 26, 2024
e1ba3c1
refactor: replace lodash.merge with lodash-es.merge in multiple files
chenshuai2144 Sep 26, 2024
f96f049
refactor: update type definitions and improve lodash imports across m…
chenshuai2144 Oct 17, 2024
81b8af5
优化编辑器体验
chenshuai2144 Nov 1, 2024
2bee4a9
feat: add valueType map for table (#8866)
keanrain Nov 14, 2024
e435fad
fix(tests): 修复 ProFormFieldSet 测试中的重复断言
chenshuai2144 Nov 15, 2024
842576f
fix editor error
chenshuai2144 Nov 16, 2024
06705ac
fix editor error
chenshuai2144 Nov 16, 2024
fa96660
Dev/v3.0 (#8874)
keanrain Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .fatherrc.base.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { defineConfig } from 'father';

const siteBuild = process.env.SITE_DEPLOY === 'TRUE';

console.log(siteBuild);

export default defineConfig({
// 以下为 esm 配置项启用时的默认值,有自定义需求时才需配置
esm: {
input: 'src', // 默认编译目录
output: 'es',
extraBabelPlugins: [[require.resolve('./scripts/replaceLib'), {}]],
platform: 'browser', // 默认构建为 Browser 环境的产物
transformer: 'babel', // 默认使用 babel 以提供更好的兼容性
transformer: siteBuild ? 'babel' : 'esbuild', // 默认使用 babel 以提供更好的兼容性
},
// 以下为 cjs 配置项启用时的默认值,有自定义需求时才需配置
cjs: {
extraBabelPlugins: [[require.resolve('./scripts/replaceEs'), {}]],
input: 'src', // 默认编译目录
output: 'lib',
platform: 'browser', // 默认构建为 Node.js 环境的产物
transformer: 'babel', // 默认使用 esbuild 以获得更快的构建速度
transformer: siteBuild ? 'babel' : 'esbuild', // 默认使用 esbuild 以获得更快的构建速度
},
});
2 changes: 1 addition & 1 deletion docs/components/valueType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const valueEnum = {
all: { text: '全部', status: 'Default' },
open: {
text: '未解决',
status: 'Error',
status: 'Warning',
},
closed: {
text: '已解决',
Expand Down
4 changes: 0 additions & 4 deletions docs/playground/pro-layout.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ nav:
## Layout 自定义

<code src="../../packages/layout/src/demos/dynamic-settings.tsx" background="var(--main-bg-color)" title="属性展示"></code>

## 水印自定义

<code src="../../packages/layout/src/components/WaterMark/demos/custom.tsx" background="var(--main-bg-color)"></code>
4 changes: 0 additions & 4 deletions docs/playground/pro-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@ nav:
## Layout 自定义

<code src="../../packages/layout/src/demos/dynamic-settings.tsx" background="var(--main-bg-color)" iframe="500" title="属性展示"></code>

## 水印自定义

<code src="../../packages/layout/src/components/WaterMark/demos/custom.tsx" background="var(--main-bg-color)" iframe="500"></code>
2 changes: 1 addition & 1 deletion packages/card/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"typescript": "^5.0.4"
},
"peerDependencies": {
"antd": "^4.24.15 || ^5.11.2",
"antd": "^5.11.2",
"react": ">=17.0.0"
},
"publishConfig": {
Expand Down
3 changes: 0 additions & 3 deletions packages/card/src/components/StatisticCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import type { StatisticProps } from '../Statistic';
import Statistic from '../Statistic';
import { useStyle } from './style';

import 'antd/lib/divider/style';
import 'antd/lib/statistic/style';

export type StatisticCardProps = {
/** 图表配置 */
chart?: React.ReactNode;
Expand Down
2 changes: 0 additions & 2 deletions packages/card/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import type { ProCardProps } from './ProCard';
import ProCard from './ProCard';
import type { ProCardTabsProps } from './typing';

import 'antd/lib/card/style';

export { CheckCard, ProCard, Statistic, StatisticCard };
export type {
CheckCardGroupProps,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@babel/runtime": "^7.16.3"
},
"peerDependencies": {
"antd": "^4.24.15 || ^5.11.2",
"antd": "^5.11.2",
"react": ">=17.0.0",
"react-dom": ">=17.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/descriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"typescript": "^5.0.4"
},
"peerDependencies": {
"antd": "^4.24.15 || ^5.11.2",
"antd": "^5.11.2",
"react": ">=17.0.0"
},
"publishConfig": {
Expand Down
63 changes: 18 additions & 45 deletions packages/descriptions/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,23 @@ import {
ErrorBoundary,
InlineErrorFormItem,
LabelIconTip,
compareVersions,
genCopyable,
getFieldPropsOrFormItemProps,
stringify,
useEditableMap,
} from '@ant-design/pro-utils';
import type { DescriptionsProps, FormInstance, FormProps } from 'antd';
import { ConfigProvider, Descriptions, Space, version } from 'antd';
import { ConfigProvider, Descriptions, Space } from 'antd';
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel';
import toArray from 'rc-util/lib/Children/toArray';
import get from 'rc-util/lib/utils/get';
import React, { useContext, useEffect } from 'react';
import type { RequestData } from './useFetchData';
import useFetchData from './useFetchData';

// 兼容代码-----------
import type { ProFieldFCMode } from '@ant-design/pro-provider';
import { proTheme } from '@ant-design/pro-provider';
import type { DescriptionsItemType } from 'antd/es/descriptions';
import 'antd/lib/descriptions/style';
//----------------------

// todo remove it
export interface DescriptionsItemProps {
Expand Down Expand Up @@ -328,16 +324,13 @@ const schemaToDescriptionsItem = (
emptyText?: React.ReactNode,
) => {
const options: JSX.Element[] = [];
const isBigger58 = compareVersions(version, '5.8.0') >= 0;
// 因为 Descriptions 只是个语法糖,children 是不会执行的,所以需要这里处理一下
const children = items
?.map?.((item, index) => {
if (React.isValidElement(item)) {
return isBigger58
? {
children: item,
}
: item;
return {
children: item,
};
}
const {
valueEnum,
Expand Down Expand Up @@ -388,18 +381,20 @@ const schemaToDescriptionsItem = (
const contentDom: React.ReactNode =
fieldMode === 'edit' ? text : genCopyable(text, item, text);

const key = restItem.key || restItem.label?.toString() || index;
const label = (title || restItem.label || restItem.tooltip) && (
<LabelIconTip
label={title || restItem.label}
tooltip={restItem.tooltip}
ellipsis={item.ellipsis}
/>
);
const field: DescriptionsItemType | JSX.Element =
isBigger58 && valueType !== 'option'
valueType !== 'option'
? ({
...restItem,
key: restItem.key || restItem.label?.toString() || index,
label: (title || restItem.label || restItem.tooltip) && (
<LabelIconTip
label={title || restItem.label}
tooltip={restItem.tooltip}
ellipsis={item.ellipsis}
/>
),
key,
label,
children: (
<Component>
<FieldRender
Expand All @@ -426,19 +421,7 @@ const schemaToDescriptionsItem = (
),
} as DescriptionsItemType)
: ((
<Descriptions.Item
{...restItem}
key={restItem.key || restItem.label?.toString() || index}
label={
(title || restItem.label || restItem.tooltip) && (
<LabelIconTip
label={title || restItem.label}
tooltip={restItem.tooltip}
ellipsis={item.ellipsis}
/>
)
}
>
<Descriptions.Item {...restItem} key={key} label={label}>
<Component>
<FieldRender
{...item}
Expand All @@ -451,13 +434,6 @@ const schemaToDescriptionsItem = (
action={action}
editableUtils={editableUtils}
/>
{showEditIcon && valueType !== 'option' && (
<EditOutlined
onClick={() => {
editableUtils?.startEditable(dataIndex || index);
}}
/>
)}
</Component>
</Descriptions.Item>
) as JSX.Element);
Expand Down Expand Up @@ -625,7 +601,6 @@ const ProDescriptions = <
}

const className = context.getPrefixCls('pro-descriptions');
const isBigger58 = compareVersions(version, '5.8.0') >= 0;
return (
<ErrorBoundary>
<FormComponent
Expand Down Expand Up @@ -654,10 +629,8 @@ const ProDescriptions = <
)
}
title={title}
items={isBigger58 ? (children as DescriptionsItemType[]) : undefined}
>
{isBigger58 ? null : (children as JSX.Element[])}
</Descriptions>
items={children as DescriptionsItemType[]}
/>
</FormComponent>
</ErrorBoundary>
);
Expand Down
3 changes: 1 addition & 2 deletions packages/field/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"@ant-design/pro-provider": "2.14.7",
"@ant-design/pro-utils": "2.15.13",
"@babel/runtime": "^7.18.0",
"@chenshuai2144/sketch-color": "^1.0.8",
"classnames": "^2.3.2",
"dayjs": "^1.11.10",
"lodash.tonumber": "^4.0.3",
Expand All @@ -48,7 +47,7 @@
"typescript": "^5.0.4"
},
"peerDependencies": {
"antd": "^4.24.15 || ^5.11.2",
"antd": "^5.11.2",
"react": ">=17.0.0"
}
}
Loading
Loading