From 08fcee6d90dc7a09ab4484c14bc43d5787739fc7 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 11 Mar 2022 18:41:56 +0800 Subject: [PATCH] feat: improve code --- .../src/acl/Configuration/schemas/roleCollections.ts | 4 ++-- .../schema-component/antd/action/Action.Modal.tsx | 2 +- .../src/schema-component/antd/form-item/FormItem.tsx | 3 +++ .../client/src/schema-component/antd/kanban/utils.ts | 3 +++ .../client/src/schema-component/antd/menu/Menu.tsx | 12 +++++++++++- .../antd/table/Table.Column.Deigner.tsx | 3 +++ .../Initializers/TabPaneInitializers.tsx | 3 +++ packages/client/src/user/SwitchRole.tsx | 4 +++- packages/server/src/acl/available-action.ts | 1 + 9 files changed, 30 insertions(+), 5 deletions(-) diff --git a/packages/client/src/acl/Configuration/schemas/roleCollections.ts b/packages/client/src/acl/Configuration/schemas/roleCollections.ts index 77de01ddd..b2d584d90 100644 --- a/packages/client/src/acl/Configuration/schemas/roleCollections.ts +++ b/packages/client/src/acl/Configuration/schemas/roleCollections.ts @@ -69,8 +69,8 @@ export const roleCollectionsSchema: ISchema = { resource: 'roles.collections', action: 'list', params: { - pageSize: 5, - filter: {}, + pageSize: 20, + filter: { inherit: false }, sort: ['sort'], appends: [], }, diff --git a/packages/client/src/schema-component/antd/action/Action.Modal.tsx b/packages/client/src/schema-component/antd/action/Action.Modal.tsx index 825d24361..41261ec5d 100644 --- a/packages/client/src/schema-component/antd/action/Action.Modal.tsx +++ b/packages/client/src/schema-component/antd/action/Action.Modal.tsx @@ -21,7 +21,7 @@ export const ActionModal: ComposedActionDrawer = observer((props) => { <> {createPortal( { { title: '编辑字段', 'x-component': 'Action.Modal', + 'x-component-props': { + width: 520, + }, 'x-decorator': 'Form', 'x-decorator-props': { initialValue, diff --git a/packages/client/src/schema-component/antd/kanban/utils.ts b/packages/client/src/schema-component/antd/kanban/utils.ts index 55503a66a..26e7adb6f 100644 --- a/packages/client/src/schema-component/antd/kanban/utils.ts +++ b/packages/client/src/schema-component/antd/kanban/utils.ts @@ -26,5 +26,8 @@ export const toGroupDataSource = (groupField: IGroupField, dataSource: Array { - {field.title} + + {field.title} + diff --git a/packages/client/src/schema-component/antd/table/Table.Column.Deigner.tsx b/packages/client/src/schema-component/antd/table/Table.Column.Deigner.tsx index 3441379e1..825953221 100644 --- a/packages/client/src/schema-component/antd/table/Table.Column.Deigner.tsx +++ b/packages/client/src/schema-component/antd/table/Table.Column.Deigner.tsx @@ -39,6 +39,9 @@ export const TableColumnDeigner = (props) => { { title: '编辑字段', 'x-component': 'Action.Modal', + 'x-component-props': { + width: 520, + }, 'x-decorator': 'Form', 'x-decorator-props': { initialValue, diff --git a/packages/client/src/schema-initializer/Initializers/TabPaneInitializers.tsx b/packages/client/src/schema-initializer/Initializers/TabPaneInitializers.tsx index 2c8889b84..b3345267f 100644 --- a/packages/client/src/schema-initializer/Initializers/TabPaneInitializers.tsx +++ b/packages/client/src/schema-initializer/Initializers/TabPaneInitializers.tsx @@ -54,6 +54,9 @@ export const TabPaneInitializers = () => { drawer1: { 'x-decorator': 'Form', 'x-component': 'Action.Modal', + 'x-component-props': { + width: 520, + }, type: 'void', title: '{{t("Add tab")}}', properties: { diff --git a/packages/client/src/user/SwitchRole.tsx b/packages/client/src/user/SwitchRole.tsx index 45f5786e5..21b8d76df 100644 --- a/packages/client/src/user/SwitchRole.tsx +++ b/packages/client/src/user/SwitchRole.tsx @@ -1,6 +1,7 @@ import { useCookieState } from 'ahooks'; import { Menu, Select } from 'antd'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import { useCurrentUserContext } from './CurrentUserProvider'; const useCurrentRoles = () => { @@ -10,6 +11,7 @@ const useCurrentRoles = () => { export const SwitchRole = () => { const roles = useCurrentRoles(); + const { t } = useTranslation(); const [roleName, setRoleName] = useCookieState('currentRoleName', { defaultValue: roles?.find((role) => role.default)?.name, }); @@ -18,7 +20,7 @@ export const SwitchRole = () => { } return ( - 切换角色{' '} + {t('Switch role')}{' '}