From 53fa47c56f6aba36b151c71331a0f0ac9c801ea6 Mon Sep 17 00:00:00 2001 From: chenos Date: Tue, 24 Aug 2021 17:38:30 +0800 Subject: [PATCH] feat: improve code --- .../src/components/admin-layout/More.tsx | 6 --- .../admin-layout/Permissions/index.tsx | 46 +++++++++---------- .../src/components/admin-layout/SiteTitle.tsx | 3 -- .../client/src/schemas/action/ActionBar.tsx | 6 +-- packages/client/src/schemas/action/index.tsx | 15 +++--- packages/client/src/schemas/add-new/index.tsx | 11 ++--- .../client/src/schemas/calendar/Action.tsx | 2 +- .../client/src/schemas/calendar/ActionBar.tsx | 4 +- .../src/schemas/calendar/DesignableBar.tsx | 6 +-- .../client/src/schemas/calendar/index.tsx | 8 ++-- .../client/src/schemas/cascader/index.tsx | 9 +++- packages/client/src/schemas/chart/index.tsx | 2 +- .../src/schemas/database-field/index.tsx | 2 +- .../database-field/interfaces/chinaRegion.ts | 6 +-- packages/client/src/schemas/filter/index.tsx | 35 +++++++------- .../client/src/schemas/form-item/index.tsx | 2 +- .../client/src/schemas/form/DesignableBar.tsx | 10 ++-- .../src/schemas/form/Field.DesignableBar.tsx | 2 +- .../client/src/schemas/grid/DesignableBar.tsx | 2 +- packages/client/src/schemas/grid/style.less | 8 +++- packages/client/src/schemas/input/index.tsx | 2 +- .../src/schemas/kanban/CardDesignableBar.tsx | 4 +- .../src/schemas/kanban/DesignableBar.tsx | 6 +-- .../src/schemas/kanban/FieldDesignableBar.tsx | 2 +- .../client/src/schemas/kanban/demos/demo1.tsx | 2 +- .../client/src/schemas/markdown/index.tsx | 4 +- packages/client/src/schemas/menu/index.tsx | 2 +- .../src/schemas/table/SimpleDesignableBar.tsx | 6 +-- packages/client/src/schemas/table/index.tsx | 46 +++++++++---------- packages/client/src/schemas/tabs/index.tsx | 9 ++-- packages/client/src/schemas/tabs/style.less | 4 ++ 31 files changed, 142 insertions(+), 130 deletions(-) diff --git a/packages/client/src/components/admin-layout/More.tsx b/packages/client/src/components/admin-layout/More.tsx index 4367d20627..133ad71d5a 100644 --- a/packages/client/src/components/admin-layout/More.tsx +++ b/packages/client/src/components/admin-layout/More.tsx @@ -80,12 +80,6 @@ const schema: ISchema = { // accept: 'jpg,png' }, }, - showLogoOnly: { - type: 'boolean', - 'x-decorator': 'FormItem', - 'x-component': 'Checkbox', - 'x-content': '只显示 LOGO', - }, }, }, }, diff --git a/packages/client/src/components/admin-layout/Permissions/index.tsx b/packages/client/src/components/admin-layout/Permissions/index.tsx index 2b3740ea0b..397f869ebf 100644 --- a/packages/client/src/components/admin-layout/Permissions/index.tsx +++ b/packages/client/src/components/admin-layout/Permissions/index.tsx @@ -316,16 +316,16 @@ const schema: ISchema = { properties: { title: { type: 'string', - title: '权限名称', - 'x-component': 'Input', - 'x-decorator': 'FormilyFormItem', - }, - name: { - type: 'string', - title: '权限标识', + title: '权限组名称', 'x-component': 'Input', 'x-decorator': 'FormilyFormItem', }, + // name: { + // type: 'string', + // title: '权限组标识', + // 'x-component': 'Input', + // 'x-decorator': 'FormilyFormItem', + // }, }, }, }, @@ -334,7 +334,7 @@ const schema: ISchema = { }, column1: { type: 'void', - title: '权限名称', + title: '权限组名称', 'x-component': 'Table.Column', properties: { title: { @@ -344,18 +344,18 @@ const schema: ISchema = { }, }, }, - column2: { - type: 'void', - title: '权限标识', - 'x-component': 'Table.Column', - properties: { - name: { - type: 'string', - 'x-component': 'Input', - 'x-read-pretty': true, - }, - }, - }, + // column2: { + // type: 'void', + // title: '权限组标识', + // 'x-component': 'Table.Column', + // properties: { + // name: { + // type: 'string', + // 'x-component': 'Input', + // 'x-read-pretty': true, + // }, + // }, + // }, [uid()]: { type: 'void', title: '操作', @@ -382,7 +382,7 @@ const schema: ISchema = { properties: { [uid()]: { type: 'void', - title: '权限配置', + title: '配置权限', 'x-decorator': 'RoleProvider', 'x-component': 'Action.Drawer', 'x-component-props': { @@ -431,7 +431,7 @@ const schema: ISchema = { properties: { [uid()]: { type: 'void', - title: '编辑数据', + title: '编辑权限组', 'x-decorator': 'Form', 'x-decorator-props': { useResource: useDetailsResource, @@ -443,7 +443,7 @@ const schema: ISchema = { properties: { title: { type: 'string', - title: '权限名称', + title: '权限组名称', 'x-component': 'Input', 'x-decorator': 'FormilyFormItem', }, diff --git a/packages/client/src/components/admin-layout/SiteTitle.tsx b/packages/client/src/components/admin-layout/SiteTitle.tsx index 4f5f9beb1d..324bc895d1 100644 --- a/packages/client/src/components/admin-layout/SiteTitle.tsx +++ b/packages/client/src/components/admin-layout/SiteTitle.tsx @@ -38,9 +38,6 @@ export const SiteTitle = () => { {!loading && data?.logo?.url && ( )} - {!loading && !data?.showLogoOnly && data?.title && ( -
{data.title}
- )} ); }; diff --git a/packages/client/src/schemas/action/ActionBar.tsx b/packages/client/src/schemas/action/ActionBar.tsx index 9b6ab9b7cb..8438a74ed1 100644 --- a/packages/client/src/schemas/action/ActionBar.tsx +++ b/packages/client/src/schemas/action/ActionBar.tsx @@ -130,7 +130,7 @@ function generateActionSchema(type) { useResource: '{{ Table.useResource }}', useValues: '{{ Table.useTableRowRecord }}', }, - 'x-component': 'Action.Modal', + 'x-component': 'Action.Drawer', 'x-component-props': { useOkAction: '{{ Table.useTableUpdateAction }}', }, @@ -175,12 +175,12 @@ function AddActionButton() { } return ( - + {[ { title: '编辑', name: 'update' }, { title: '删除', name: 'destroy' }, diff --git a/packages/client/src/schemas/action/index.tsx b/packages/client/src/schemas/action/index.tsx index 61d51cafe3..888bb8f61b 100644 --- a/packages/client/src/schemas/action/index.tsx +++ b/packages/client/src/schemas/action/index.tsx @@ -180,6 +180,7 @@ Action.Modal = observer((props: any) => { title={schema.title} destroyOnClose maskClosable + width={'50%'} footer={ isFormDecorator && !schema['x-read-pretty'] ? [ @@ -192,7 +193,7 @@ Action.Modal = observer((props: any) => { setVisible(false); }} > - Cancel + 取消 , , ] : null @@ -257,7 +258,7 @@ Action.Drawer = observer((props: any) => { setVisible(false); }} > - Cancel + 取消 ) @@ -412,7 +413,7 @@ Action.DesignableBar = (props: any) => { { setVisible(visible); @@ -421,7 +422,7 @@ Action.DesignableBar = (props: any) => { { - const values = await FormDialog('修改名称和图标', () => { + const values = await FormDialog('编辑按钮', () => { return ( { refresh(); }} > - 修改名称和图标 + 编辑按钮 {isPopup && ( diff --git a/packages/client/src/schemas/add-new/index.tsx b/packages/client/src/schemas/add-new/index.tsx index 0d8982d7c0..4b070c2cc8 100644 --- a/packages/client/src/schemas/add-new/index.tsx +++ b/packages/client/src/schemas/add-new/index.tsx @@ -365,7 +365,7 @@ function generateCardItemSchema(component) { properties: { create: { type: 'void', - title: '添加卡片', + title: '新增卡片', // 'x-designable-bar': 'Kanban.AddCardDesignableBar', 'x-component': 'Kanban.Card.AddNew', // 'x-decorator': 'AddNew.Displayed', @@ -939,7 +939,7 @@ AddNew.CardItem = observer((props: any) => { const { collections = [], loading, refresh } = useCollectionsContext(); return ( { const displayed = useDisplayedMapContext(); return ( { }} overlay={ - + {fields?.map((field) => ( { console.log('AddNew.PaneItem.useResource', useResource); return ( { ) : (