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 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 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
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default defineConfig({
},
{
title: 'ProFormList',
link: '/en-US/components/group',
link: '/en-US/components/list',
},
{
title: 'ProFormDependency',
Expand Down Expand Up @@ -335,7 +335,7 @@ export default defineConfig({
},
{
title: 'ProFormList - 数据结构化',
link: '/components/group',
link: '/components/list',
},
{
title: 'ProFormDependency - 数据联动',
Expand Down
5 changes: 2 additions & 3 deletions .fatherrc.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ export default defineConfig({
esm: {
input: 'src', // 默认编译目录
output: 'es',
extraBabelPlugins: [[require.resolve('./scripts/replaceLib'), {}]],
platform: 'browser', // 默认构建为 Browser 环境的产物
transformer: 'babel', // 默认使用 babel 以提供更好的兼容性
transformer: 'esbuild', // 默认使用 babel 以提供更好的兼容性
},
// 以下为 cjs 配置项启用时的默认值,有自定义需求时才需配置
cjs: {
Expand All @@ -18,6 +17,6 @@ export default defineConfig({
input: 'src', // 默认编译目录
output: 'lib',
platform: 'browser', // 默认构建为 Node.js 环境的产物
transformer: 'babel', // 默认使用 esbuild 以获得更快的构建速度
transformer: 'esbuild', // 默认使用 esbuild 以获得更快的构建速度
},
});
2 changes: 1 addition & 1 deletion docs/components.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export type ProSchema<T = unknown, U = string, Extra = unknown> = {
* @name Customize the edit schema
* @description returns a node that will automatically wrap value and onChange
*/
renderFormItem?: (
formItemRender?: (
item: ProSchema<T, U, Extra>,
config: {
index?: number;
Expand Down
4 changes: 2 additions & 2 deletions docs/components/customization-value-type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default () => {
valueTypeMap={{
link: {
render: (text) => <a>{text}</a>,
renderFormItem: (text, props) => (
formItemRender: (text, props) => (
<Input placeholder="请输入链接" {...props?.fieldProps} />
),
},
Expand All @@ -174,7 +174,7 @@ export default () => {
</>
);
},
renderFormItem: (text, props) => (
formItemRender: (text, props) => (
<TagList {...props} {...props?.fieldProps} />
),
},
Expand Down
6 changes: 3 additions & 3 deletions docs/components/schema.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ In the `ProComponents`, we have used the same definition as tables for component
| `fieldProps` | `(form,config)=>fieldProps`\| `fieldProps` | Props passed to the rendering component. They are also passed when customizing |
| `formItemProps` | `(form,config)=>formItemProps` \| `formItemProps` | Configuration passed to Form.Item |
| `renderText` | `(text: any, record: Entity, index: number, action: ProCoreActionType) => any` | The modified data is consumed by the rendering component defined by valueType |
| `render` | `(dom,entity,index, action, schema) => React.ReactNode` | Custom DOM for read-only mode. The `render` method only manages read-only mode, while the editing mode should use `renderFormItem` |
| `renderFormItem` | `(schema,config,form) => React.ReactNode` | Custom editing mode that returns a ReactNode, automatically wrapping value and onChange |
| `render` | `(dom,entity,index, action, schema) => React.ReactNode` | Custom DOM for read-only mode. The `render` method only manages read-only mode, while the editing mode should use `formItemRender` |
| `formItemRender` | `(schema,config,form) => React.ReactNode` | Custom editing mode that returns a ReactNode, automatically wrapping value and onChange |
| `request` | `(params,props) => Promise<{label,value}[]>` | Requests network data remotely, usually used for selection-type components |
| `params` | `Record<string, any>` | Additional parameters passed to `request`. The component does not process them, but changes will trigger a new data request in `request` |
| `hideInForm` | `boolean` | Hidden in the form |
Expand Down Expand Up @@ -77,7 +77,7 @@ export type ProSchema<T = unknown, U = string, Extra = unknown> = {
*
* @name Custom edit mode
*/
renderFormItem?: (
formItemRender?: (
item: ProSchema<T, U, Extra>,
config: {
index?: number;
Expand Down
6 changes: 3 additions & 3 deletions docs/components/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ apiHeader:false
| `fieldProps` | `(form,config)=>fieldProps`\| `fieldProps` | 传给渲染的组件的 props,自定义的时候也会传递 |
| `formItemProps` | `(form,config)=>formItemProps` \| `formItemProps` | 传递给 Form.Item 的配置 |
| `renderText` | `(text: any, record: Entity, index: number, action: ProCoreActionType) => any` | 修改的数据是会被 valueType 定义的渲染组件消费 |
| `render` | `(dom,entity,index, action, schema) => React.ReactNode` | 自定义只读模式的 dom,`render` 方法只管理的只读模式,编辑模式需要使用 `renderFormItem` |
| `renderFormItem` | `(schema,config,form) => React.ReactNode` | 自定义编辑模式,返回一个 ReactNode,会自动包裹 value 和 onChange |
| `render` | `(dom,entity,index, action, schema) => React.ReactNode` | 自定义只读模式的 dom,`render` 方法只管理的只读模式,编辑模式需要使用 `formItemRender` |
| `formItemRender` | `(schema,config,form) => React.ReactNode` | 自定义编辑模式,返回一个 ReactNode,会自动包裹 value 和 onChange |
| `request` | `(params,props) => Promise<{label,value}[]>` | 从远程请求网络数据,一般用于选择类组件 |
| `params` | `Record<string, any>` | 额外传递给 `request` 的参数,组件不做处理,但是变化会引起`request` 重新请求数据 |
| `hideInForm` | `boolean` | 在 Form 中隐藏 |
Expand Down Expand Up @@ -77,7 +77,7 @@ export type ProSchema<T = unknown, U = string, Extra = unknown> = {
*
* @name 自定义编辑模式
*/
renderFormItem?: (
formItemRender?: (
item: ProSchema<T, U, Extra>,
config: {
index?: number;
Expand Down
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
2 changes: 1 addition & 1 deletion docs/playground/pro-form.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ ProForm 的主要功能是预设了很多 layout,如果需要切换只需要

## FormList

<code src="../../packages/form/src/components/Group/demos/customize.tsx" title="ProForm.List" ></code>
<code src="../../packages/form/src/components/FormItem/Group/demos/customize.tsx" title="ProForm.List" ></code>
2 changes: 1 addition & 1 deletion docs/playground/pro-form.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ ProForm 的主要功能是预设了很多 layout,如果需要切换只需要

## FormList

<code src="../../packages/form/src/components/Group/demos/customize.tsx" title="ProForm.List" ></code>
<code src="../../packages/form/src/components/FormItem/Group/demos/customize.tsx" title="ProForm.List" ></code>
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>
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
"site": "npm run build && cross-env SITE_DEPLOY='TRUE' dumi build",
"start": "npm run version && dumi dev",
"sync:tnpm": "node -e 'require(\"./scripts/syncTNPM\")()'",
"test:ui": "npm run version && cross-env TZ=UTC vitest --ui",
"test": "npm run version && cross-env TZ=UTC vitest --run",
"test:coverage": "npm run version && cross-env TZ=UTC TEST_LOG=none vitest --coverage",
"test:coverage": "npm run version && pnpm --filter \"@ant-design/**\" build && cross-env TZ=UTC TEST_LOG=none vitest --coverage",
"test:update": "npm run version && cross-env TZ=UTC vitest -u",
"tsc": "tsc --noEmit",
"tsc:duplicate": "tsc -p ./tests/tsconfig.duplicate.json",
Expand Down Expand Up @@ -68,7 +69,7 @@
"@octokit/rest": "^18.12.0",
"@testing-library/dom": "^8.20.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/react": "^16.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/chroma-js": "^2.4.4",
Expand All @@ -88,10 +89,12 @@
"@umijs/doctor": "^1.2.1",
"@umijs/fabric": "^4.0.1",
"@umijs/plugin-analytics": "^0.2.4",
"@umijs/test": "^3.5.43",
"@umijs/test-utils": "^3.5.43",
"@umijs/utils": "^4.3.27",
"@umijs/test": "^3.5.42",
"@umijs/test-utils": "^3.5.42",
"@umijs/utils": "^4.3.10",
"@vitest/browser": "^2.0.4",
"@vitest/coverage-istanbul": "^0.34.6",
"@vitest/ui": "^2.0.4",
"animated-scroll-to": "^2.3.0",
"antd": "^5.21.4",
"antd-style": "^3.7.0",
Expand All @@ -116,6 +119,7 @@
"father": "^4.5.0",
"gh-pages": "^5.0.0",
"glob": "^8.1.0",
"happy-dom": "^14.12.3",
"identity-obj-proxy": "^3.0.0",
"inquirer": "^8.2.6",
"jest-canvas-mock": "^2.5.2",
Expand All @@ -131,6 +135,7 @@
"np": "^6.5.0",
"nprogress": "^0.2.0",
"octokit": "^1.8.1",
"playwright": "^1.45.3",
"polished": "^4.3.1",
"prettier": "^2.8.8",
"prettier-plugin-organize-imports": "^3.2.4",
Expand Down Expand Up @@ -164,7 +169,7 @@
"umi-request": "^1.4.0",
"unified": "^11.0.5",
"unist-util-visit": "^5.0.0",
"vitest": "^1.6.0",
"vitest": "^2.0.4",
"write-pkg": "^4.0.0",
"xhr-mock": "^2.5.1",
"yorkie": "^2.0.0",
Expand Down
9 changes: 1 addition & 8 deletions packages/card/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
"main": "lib/index.js",
"module": "es/index.js",
"types": "es/index.d.ts",
"exports": {
".": {
"import": "./es/index.js",
"require": "./lib/index.js",
"types": "./es/index.d.ts"
}
},
"files": [
"lib",
"es",
Expand Down Expand Up @@ -55,7 +48,7 @@
"typescript": "^5.0.4"
},
"peerDependencies": {
"antd": "^4.24.15 || ^5.11.2",
"antd": "^5.11.2",
"react": ">=17.0.0"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/card/src/components/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ConfigProvider, Tabs } from 'antd';
import useBreakpoint from 'antd/es/grid/hooks/useBreakpoint';
import classNames from 'classnames';
import omit from 'omit.js';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import useMergedState from 'rc-util/es/hooks/useMergedState';
import React, { useContext } from 'react';
import type { Breakpoint, CardProps, Gutter } from '../../typing';
import Actions from '../Actions';
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
4 changes: 2 additions & 2 deletions packages/card/src/components/TabPane/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { TabPaneProps, TabsProps } from 'antd';
import { ConfigProvider, Tabs, version } from 'antd';
import classNames from 'classnames';
import toArray from 'rc-util/lib/Children/toArray';
import { noteOnce } from 'rc-util/lib/warning';
import toArray from 'rc-util/es/Children/toArray';
import { noteOnce } from 'rc-util/es/warning';
import React, { useContext } from 'react';
import type { ProCardTabPaneProps, ProCardTabsProps } from '../../typing';
import Card from '../Card';
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/card/src/typing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TabPaneProps, TabsProps } from 'antd';
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel';
import type { LabelTooltipType } from 'antd/es/form/FormItemLabel';
import type { ReactNode } from 'react';

export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
Expand Down
21 changes: 0 additions & 21 deletions packages/card/tsconfig.json

This file was deleted.

9 changes: 1 addition & 8 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
"unpkg": "dist/pro-components.min.js",
"module": "es/index.js",
"types": "es/index.d.ts",
"exports": {
".": {
"import": "./es/index.js",
"require": "./lib/index.js",
"types": "./es/index.d.ts"
}
},
"files": [
"dist",
"lib",
Expand Down Expand Up @@ -55,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
32 changes: 0 additions & 32 deletions packages/components/tsconfig.json

This file was deleted.

9 changes: 1 addition & 8 deletions packages/descriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
"main": "lib/index.js",
"module": "es/index.js",
"types": "es/index.d.ts",
"exports": {
".": {
"import": "./es/index.js",
"require": "./lib/index.js",
"types": "./es/index.d.ts"
}
},
"files": [
"es",
"dist",
Expand Down Expand Up @@ -54,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
4 changes: 2 additions & 2 deletions packages/descriptions/src/demos/customization-value-type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default () => {
valueTypeMap: {
link: {
render: (text) => <a>{text}</a>,
renderFormItem: (text, props) => (
formItemRender: (text, props) => (
<Input placeholder="请输入链接" {...props?.fieldProps} />
),
},
Expand All @@ -116,7 +116,7 @@ export default () => {
</>
);
},
renderFormItem: (text, props) => (
formItemRender: (text, props) => (
<TagList {...props} {...props?.fieldProps} />
),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/descriptions/src/demos/editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default () => {
title: '状态2',
key: 'state2',
dataIndex: 'state2',
renderFormItem: () => {
formItemRender: () => {
return <Input placeholder="输入 Success 切换分值" />;
},
},
Expand Down
Loading
Loading