feat: improve code

This commit is contained in:
chenos 2022-03-11 18:41:56 +08:00
parent 264a1e6c21
commit 08fcee6d90
9 changed files with 30 additions and 5 deletions

View File

@ -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: [],
},

View File

@ -21,7 +21,7 @@ export const ActionModal: ComposedActionDrawer = observer((props) => {
<>
{createPortal(
<Modal
// width={'50%'}
width={'80%'}
title={field.title}
{...others}
destroyOnClose

View File

@ -49,6 +49,9 @@ FormItem.Designer = () => {
{
title: '编辑字段',
'x-component': 'Action.Modal',
'x-component-props': {
width: 520,
},
'x-decorator': 'Form',
'x-decorator-props': {
initialValue,

View File

@ -26,5 +26,8 @@ export const toGroupDataSource = (groupField: IGroupField, dataSource: Array<any
groupDataSource.__unknown__.cards.push(ds);
}
});
if (groupDataSource.__unknown__.cards.length === 0) {
delete groupDataSource.__unknown__;
}
return { columns: Object.values(groupDataSource) };
};

View File

@ -317,7 +317,17 @@ Menu.Item = observer((props) => {
<AntdMenu.Item {...others} key={schema.name} eventKey={schema.name} schema={schema}>
<SortableItem className={designerCss}>
<Icon type={icon} style={{ marginRight: 5 }} />
<span
className={css`
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
width: 100%;
vertical-align: middle;
`}
>
{field.title}
</span>
<Designer />
</SortableItem>
</AntdMenu.Item>

View File

@ -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,

View File

@ -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: {

View File

@ -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 (
<Menu.Item>
{' '}
{t('Switch role')}{' '}
<Select
style={{ minWidth: 100 }}
bordered={false}

View File

@ -28,6 +28,7 @@ const availableActions: {
update: {
displayName: '{{t("Edit")}}',
type: 'old-data',
aliases: ['update', 'move'],
allowConfigureFields: true,
},
destroy: {