From 162fd959c59563643b9f43e59324673023e1d035 Mon Sep 17 00:00:00 2001 From: yarnb Date: Sun, 14 Apr 2024 18:40:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20SmartDescriptions?= =?UTF-8?q?=20=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BREAKING CHANGE: 改名 ProDescriptions 为 SmartDescriptions --- src/FullscreenImage/demos/basic.tsx | 6 +++--- src/FullscreenImage/demos/icon.tsx | 2 +- src/SchemaDescriptions/index.md | 2 +- src/SearchTable/demos/basic.tsx | 6 +++--- src/SearchTable/demos/requestData.tsx | 6 +++--- src/SearchTable/demos/row-selection.tsx | 6 +++--- src/SearchTable/demos/throwError.tsx | 6 +++--- src/SelectableTable/demos/basic.tsx | 6 +++--- src/SelectableTable/demos/methods.tsx | 6 +++--- src/SelectableTable/demos/params.tsx | 6 +++--- src/SelectableTable/demos/radioSelect.tsx | 6 +++--- .../demos/basic.tsx | 10 +++++----- .../demos/schema.tsx | 6 +++--- .../index.md | 2 +- .../index.tsx | 14 +++++++------- src/Store/demos/nested.tsx | 6 +++--- src/Store/demos/requestData.tsx | 8 ++++---- src/index.ts | 2 +- 18 files changed, 53 insertions(+), 53 deletions(-) rename src/{ProDescriptions => SmartDescriptions}/demos/basic.tsx (83%) rename src/{ProDescriptions => SmartDescriptions}/demos/schema.tsx (98%) rename src/{ProDescriptions => SmartDescriptions}/index.md (87%) rename src/{ProDescriptions => SmartDescriptions}/index.tsx (86%) diff --git a/src/FullscreenImage/demos/basic.tsx b/src/FullscreenImage/demos/basic.tsx index c3082f8..5185c66 100644 --- a/src/FullscreenImage/demos/basic.tsx +++ b/src/FullscreenImage/demos/basic.tsx @@ -1,6 +1,6 @@ import { Button, Cascader, Form, Icon, Input, Tooltip } from 'antd'; import React from 'react'; -import { DrawerForm, FullscreenImage, ProDescriptions, SearchTable } from 'widgets-v3'; +import { DrawerForm, FullscreenImage, SmartDescriptions, SearchTable } from 'widgets-v3'; import delay from 'delay'; import img1 from './img1.webp'; import img2 from './img2.webp'; @@ -81,7 +81,7 @@ export default () => ( trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -161,7 +161,7 @@ export default () => ( }, ]; }} - + ); }} > diff --git a/src/FullscreenImage/demos/icon.tsx b/src/FullscreenImage/demos/icon.tsx index 09fbc42..9c467b4 100644 --- a/src/FullscreenImage/demos/icon.tsx +++ b/src/FullscreenImage/demos/icon.tsx @@ -1,6 +1,6 @@ import { Button, Cascader, Form, Icon, Input, Tooltip } from 'antd'; import React from 'react'; -import { DrawerForm, FullscreenImage, ProDescriptions, SearchTable } from 'widgets-v3'; +import { DrawerForm, FullscreenImage, SmartDescriptions, SearchTable } from 'widgets-v3'; import delay from 'delay'; import img1 from './img1.webp'; diff --git a/src/SchemaDescriptions/index.md b/src/SchemaDescriptions/index.md index afd1f94..1167644 100644 --- a/src/SchemaDescriptions/index.md +++ b/src/SchemaDescriptions/index.md @@ -6,7 +6,7 @@ group: # SchemaDescriptions -内部组件,请用 ProDescriptions +内部组件,请用 SmartDescriptions 目标是用 json 来描述展示数据的视图 diff --git a/src/SearchTable/demos/basic.tsx b/src/SearchTable/demos/basic.tsx index c750f0f..89571ce 100644 --- a/src/SearchTable/demos/basic.tsx +++ b/src/SearchTable/demos/basic.tsx @@ -1,6 +1,6 @@ import { Button, Cascader, Form, Icon, Input, Tooltip } from 'antd'; import React from 'react'; -import { DrawerForm, ProDescriptions, SearchTable } from 'widgets-v3'; +import { DrawerForm, SmartDescriptions, SearchTable } from 'widgets-v3'; import delay from 'delay'; const residences = [ @@ -72,7 +72,7 @@ export default () => ( trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -152,7 +152,7 @@ export default () => ( }, ]; }} - + ); }} > diff --git a/src/SearchTable/demos/requestData.tsx b/src/SearchTable/demos/requestData.tsx index 2ea1833..a83e8e9 100644 --- a/src/SearchTable/demos/requestData.tsx +++ b/src/SearchTable/demos/requestData.tsx @@ -1,6 +1,6 @@ import { Button, Cascader, Form, Icon, Input, Tooltip } from 'antd'; import React from 'react'; -import { DrawerForm, ProDescriptions, SearchTable } from 'widgets-v3'; +import { DrawerForm, SmartDescriptions, SearchTable } from 'widgets-v3'; import delay from 'delay'; const residences = [ @@ -80,7 +80,7 @@ export default () => ( trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -160,7 +160,7 @@ export default () => ( }, ]; }} - + ); }} > diff --git a/src/SearchTable/demos/row-selection.tsx b/src/SearchTable/demos/row-selection.tsx index 2819ccb..43f58ab 100644 --- a/src/SearchTable/demos/row-selection.tsx +++ b/src/SearchTable/demos/row-selection.tsx @@ -1,6 +1,6 @@ import { Button, Cascader, Form, Icon, Input, Tooltip } from 'antd'; import React from 'react'; -import { Action, DrawerForm, ProDescriptions, SearchTable } from 'widgets-v3'; +import { Action, DrawerForm, SmartDescriptions, SearchTable } from 'widgets-v3'; import delay from 'delay'; const residences = [ @@ -131,7 +131,7 @@ export default () => ( trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -211,7 +211,7 @@ export default () => ( }, ]; }} - + ); }} > diff --git a/src/SearchTable/demos/throwError.tsx b/src/SearchTable/demos/throwError.tsx index fcaa211..c786fa3 100644 --- a/src/SearchTable/demos/throwError.tsx +++ b/src/SearchTable/demos/throwError.tsx @@ -1,6 +1,6 @@ import { Button, Cascader, Form, Icon, Input, Tooltip } from 'antd'; import React from 'react'; -import { DrawerForm, ProDescriptions, SearchTable } from 'widgets-v3'; +import { DrawerForm, SmartDescriptions, SearchTable } from 'widgets-v3'; import delay from 'delay'; const residences = [ @@ -72,7 +72,7 @@ export default () => ( trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -152,7 +152,7 @@ export default () => ( }, ]; }} - + ); }} > diff --git a/src/SelectableTable/demos/basic.tsx b/src/SelectableTable/demos/basic.tsx index 9b6690c..9d3ecac 100644 --- a/src/SelectableTable/demos/basic.tsx +++ b/src/SelectableTable/demos/basic.tsx @@ -11,7 +11,7 @@ import { EditableGroups, GroupsForm, SelectableTable, - ProDescriptions, + SmartDescriptions, } from 'widgets-v3'; import delay from 'delay'; @@ -127,7 +127,7 @@ export default () => ( trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -219,7 +219,7 @@ export default () => ( }, ]; }} - + ); }} > diff --git a/src/SelectableTable/demos/methods.tsx b/src/SelectableTable/demos/methods.tsx index df7db4f..0f89166 100644 --- a/src/SelectableTable/demos/methods.tsx +++ b/src/SelectableTable/demos/methods.tsx @@ -11,7 +11,7 @@ import { EditableGroups, GroupsForm, SelectableTable, - ProDescriptions, + SmartDescriptions, SelectableTableMethods, } from 'widgets-v3'; import delay from 'delay'; @@ -132,7 +132,7 @@ export default () => { trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -224,7 +224,7 @@ export default () => { }, ]; }} - + ); }} > diff --git a/src/SelectableTable/demos/params.tsx b/src/SelectableTable/demos/params.tsx index c826db5..5f7f79a 100644 --- a/src/SelectableTable/demos/params.tsx +++ b/src/SelectableTable/demos/params.tsx @@ -4,7 +4,7 @@ import React, { useState } from 'react'; import { BackendFilteredSelectListItem, DrawerForm, - ProDescriptions, + SmartDescriptions, SmartForm, SelectableTable, } from 'widgets-v3'; @@ -91,7 +91,7 @@ export default () => { trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -183,7 +183,7 @@ export default () => { }, ]; }} - + ); }} > diff --git a/src/SelectableTable/demos/radioSelect.tsx b/src/SelectableTable/demos/radioSelect.tsx index cc17a79..09276a2 100644 --- a/src/SelectableTable/demos/radioSelect.tsx +++ b/src/SelectableTable/demos/radioSelect.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { BackendFilteredSelectListItem, DrawerForm, - ProDescriptions, + SmartDescriptions, SmartForm, SelectableTable, } from 'widgets-v3'; @@ -124,7 +124,7 @@ export default () => ( trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -216,7 +216,7 @@ export default () => ( }, ]; }} - + ); }} > diff --git a/src/ProDescriptions/demos/basic.tsx b/src/SmartDescriptions/demos/basic.tsx similarity index 83% rename from src/ProDescriptions/demos/basic.tsx rename to src/SmartDescriptions/demos/basic.tsx index 1513de8..6642dc2 100644 --- a/src/ProDescriptions/demos/basic.tsx +++ b/src/SmartDescriptions/demos/basic.tsx @@ -1,11 +1,11 @@ import { Button, Cascader, Form, Icon, Input, Tooltip } from 'antd'; import delay from 'delay'; import React from 'react'; -import { ProDescriptions } from 'widgets-v3'; +import { SmartDescriptions } from 'widgets-v3'; export default () => ( <> - { await delay(1000); return { @@ -18,9 +18,9 @@ export default () => ( {(data) => { return
{JSON.stringify(data)}
; }} -
+ - { await delay(1000); return { @@ -33,6 +33,6 @@ export default () => ( {(data) => { return [
{JSON.stringify(data)}
,
{JSON.stringify(data)}
]; }} -
+ ); diff --git a/src/ProDescriptions/demos/schema.tsx b/src/SmartDescriptions/demos/schema.tsx similarity index 98% rename from src/ProDescriptions/demos/schema.tsx rename to src/SmartDescriptions/demos/schema.tsx index 0b9b45c..9ed3651 100644 --- a/src/ProDescriptions/demos/schema.tsx +++ b/src/SmartDescriptions/demos/schema.tsx @@ -1,10 +1,10 @@ import { Button, Cascader, Form, Icon, Input, Tooltip } from 'antd'; import delay from 'delay'; import React from 'react'; -import { ProDescriptions } from 'widgets-v3'; +import { SmartDescriptions } from 'widgets-v3'; export default () => ( - { await delay(1000); return { @@ -121,5 +121,5 @@ export default () => ( }, ]; }} - + ); diff --git a/src/ProDescriptions/index.md b/src/SmartDescriptions/index.md similarity index 87% rename from src/ProDescriptions/index.md rename to src/SmartDescriptions/index.md index 5906325..b39b85a 100644 --- a/src/ProDescriptions/index.md +++ b/src/SmartDescriptions/index.md @@ -4,7 +4,7 @@ group: order: 6 --- -# ProDescriptions +# SmartDescriptions ## 基本使用 diff --git a/src/ProDescriptions/index.tsx b/src/SmartDescriptions/index.tsx similarity index 86% rename from src/ProDescriptions/index.tsx rename to src/SmartDescriptions/index.tsx index 663eabb..875c5d8 100644 --- a/src/ProDescriptions/index.tsx +++ b/src/SmartDescriptions/index.tsx @@ -14,17 +14,17 @@ export interface RequestParams {} export interface RequestResult {} -export type ProDescriptionsProps = { +export type SmartDescriptionsProps = { request?: (params: RequestParams) => Promise>; children?: (dataSource?: Record) => ReactNode | DescriptionsComponentSchema[]; }; -export type ProDescriptionsMethods = {}; +export type SmartDescriptionsMethods = {}; -const ProDescriptions = forwardRef( +const SmartDescriptions = forwardRef( ( - { request, children, ...tableProps }: ProDescriptionsProps, - ref: ForwardedRef>, + { request, children, ...tableProps }: SmartDescriptionsProps, + ref: ForwardedRef>, ) => { const [loading, setLoading] = useState(false); const [dataSource, setDataSource] = useState>(); @@ -41,7 +41,7 @@ const ProDescriptions = forwardRef( }; // 在组件内部创建methods对象 - const methods: ProDescriptionsMethods = {}; + const methods: SmartDescriptionsMethods = {}; // 更新useImperativeHandle钩子,直接使用methods对象 useImperativeHandle(ref, () => methods); @@ -86,4 +86,4 @@ const ProDescriptions = forwardRef( }, ); -export default ProDescriptions; +export default SmartDescriptions; diff --git a/src/Store/demos/nested.tsx b/src/Store/demos/nested.tsx index cd18d1a..12ffa93 100644 --- a/src/Store/demos/nested.tsx +++ b/src/Store/demos/nested.tsx @@ -1,7 +1,7 @@ import { Button, Form, Icon, Input, Tooltip } from 'antd'; import delay from 'delay'; import React from 'react'; -import { DrawerForm, ProDescriptions, SearchTable, Store, useStore } from 'widgets-v3'; +import { DrawerForm, SmartDescriptions, SearchTable, Store, useStore } from 'widgets-v3'; const User = () => { const global = useStore('global'); @@ -121,7 +121,7 @@ export default () => ( trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -213,7 +213,7 @@ export default () => ( }, ]; }} - + ); }} > diff --git a/src/Store/demos/requestData.tsx b/src/Store/demos/requestData.tsx index 47093c6..d717305 100644 --- a/src/Store/demos/requestData.tsx +++ b/src/Store/demos/requestData.tsx @@ -1,7 +1,7 @@ import { Button, Cascader, Form, Icon, Input, Tooltip } from 'antd'; -import React from 'react'; -import { DrawerForm, ProDescriptions, SearchTable, Store } from 'widgets-v3'; import delay from 'delay'; +import React from 'react'; +import { DrawerForm, SearchTable, SmartDescriptions, Store } from 'widgets-v3'; const residences = [ { @@ -96,7 +96,7 @@ export default () => ( trigger={} renderFormItems={() => { return ( - { await delay(1000); return { @@ -176,7 +176,7 @@ export default () => ( }, ]; }} - + ); }} > diff --git a/src/index.ts b/src/index.ts index 1fc2755..2bbd47a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ export { default as BackendFilteredSelect } from './BackendFilteredSelect'; export { default as FrontendFilteredSelect } from './FrontendFilteredSelect'; export { default as SmartForm } from './SmartForm'; export { default as EllipsisTooltip } from './EllipsisTooltip'; -export { default as ProDescriptions } from './ProDescriptions'; +export { default as SmartDescriptions } from './SmartDescriptions'; export { default as DialogForm } from './DialogForm'; export { default as DrawerForm } from './DrawerForm'; export { default as SchemaDescriptions } from './SchemaDescriptions';