feat: improve code
This commit is contained in:
parent
264a1e6c21
commit
08fcee6d90
@ -69,8 +69,8 @@ export const roleCollectionsSchema: ISchema = {
|
|||||||
resource: 'roles.collections',
|
resource: 'roles.collections',
|
||||||
action: 'list',
|
action: 'list',
|
||||||
params: {
|
params: {
|
||||||
pageSize: 5,
|
pageSize: 20,
|
||||||
filter: {},
|
filter: { inherit: false },
|
||||||
sort: ['sort'],
|
sort: ['sort'],
|
||||||
appends: [],
|
appends: [],
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,7 @@ export const ActionModal: ComposedActionDrawer = observer((props) => {
|
|||||||
<>
|
<>
|
||||||
{createPortal(
|
{createPortal(
|
||||||
<Modal
|
<Modal
|
||||||
// width={'50%'}
|
width={'80%'}
|
||||||
title={field.title}
|
title={field.title}
|
||||||
{...others}
|
{...others}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
|
@ -49,6 +49,9 @@ FormItem.Designer = () => {
|
|||||||
{
|
{
|
||||||
title: '编辑字段',
|
title: '编辑字段',
|
||||||
'x-component': 'Action.Modal',
|
'x-component': 'Action.Modal',
|
||||||
|
'x-component-props': {
|
||||||
|
width: 520,
|
||||||
|
},
|
||||||
'x-decorator': 'Form',
|
'x-decorator': 'Form',
|
||||||
'x-decorator-props': {
|
'x-decorator-props': {
|
||||||
initialValue,
|
initialValue,
|
||||||
|
@ -26,5 +26,8 @@ export const toGroupDataSource = (groupField: IGroupField, dataSource: Array<any
|
|||||||
groupDataSource.__unknown__.cards.push(ds);
|
groupDataSource.__unknown__.cards.push(ds);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (groupDataSource.__unknown__.cards.length === 0) {
|
||||||
|
delete groupDataSource.__unknown__;
|
||||||
|
}
|
||||||
return { columns: Object.values(groupDataSource) };
|
return { columns: Object.values(groupDataSource) };
|
||||||
};
|
};
|
||||||
|
@ -317,7 +317,17 @@ Menu.Item = observer((props) => {
|
|||||||
<AntdMenu.Item {...others} key={schema.name} eventKey={schema.name} schema={schema}>
|
<AntdMenu.Item {...others} key={schema.name} eventKey={schema.name} schema={schema}>
|
||||||
<SortableItem className={designerCss}>
|
<SortableItem className={designerCss}>
|
||||||
<Icon type={icon} style={{ marginRight: 5 }} />
|
<Icon type={icon} style={{ marginRight: 5 }} />
|
||||||
|
<span
|
||||||
|
className={css`
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
vertical-align: middle;
|
||||||
|
`}
|
||||||
|
>
|
||||||
{field.title}
|
{field.title}
|
||||||
|
</span>
|
||||||
<Designer />
|
<Designer />
|
||||||
</SortableItem>
|
</SortableItem>
|
||||||
</AntdMenu.Item>
|
</AntdMenu.Item>
|
||||||
|
@ -39,6 +39,9 @@ export const TableColumnDeigner = (props) => {
|
|||||||
{
|
{
|
||||||
title: '编辑字段',
|
title: '编辑字段',
|
||||||
'x-component': 'Action.Modal',
|
'x-component': 'Action.Modal',
|
||||||
|
'x-component-props': {
|
||||||
|
width: 520,
|
||||||
|
},
|
||||||
'x-decorator': 'Form',
|
'x-decorator': 'Form',
|
||||||
'x-decorator-props': {
|
'x-decorator-props': {
|
||||||
initialValue,
|
initialValue,
|
||||||
|
@ -54,6 +54,9 @@ export const TabPaneInitializers = () => {
|
|||||||
drawer1: {
|
drawer1: {
|
||||||
'x-decorator': 'Form',
|
'x-decorator': 'Form',
|
||||||
'x-component': 'Action.Modal',
|
'x-component': 'Action.Modal',
|
||||||
|
'x-component-props': {
|
||||||
|
width: 520,
|
||||||
|
},
|
||||||
type: 'void',
|
type: 'void',
|
||||||
title: '{{t("Add tab")}}',
|
title: '{{t("Add tab")}}',
|
||||||
properties: {
|
properties: {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { useCookieState } from 'ahooks';
|
import { useCookieState } from 'ahooks';
|
||||||
import { Menu, Select } from 'antd';
|
import { Menu, Select } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useCurrentUserContext } from './CurrentUserProvider';
|
import { useCurrentUserContext } from './CurrentUserProvider';
|
||||||
|
|
||||||
const useCurrentRoles = () => {
|
const useCurrentRoles = () => {
|
||||||
@ -10,6 +11,7 @@ const useCurrentRoles = () => {
|
|||||||
|
|
||||||
export const SwitchRole = () => {
|
export const SwitchRole = () => {
|
||||||
const roles = useCurrentRoles();
|
const roles = useCurrentRoles();
|
||||||
|
const { t } = useTranslation();
|
||||||
const [roleName, setRoleName] = useCookieState('currentRoleName', {
|
const [roleName, setRoleName] = useCookieState('currentRoleName', {
|
||||||
defaultValue: roles?.find((role) => role.default)?.name,
|
defaultValue: roles?.find((role) => role.default)?.name,
|
||||||
});
|
});
|
||||||
@ -18,7 +20,7 @@ export const SwitchRole = () => {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Menu.Item>
|
<Menu.Item>
|
||||||
切换角色{' '}
|
{t('Switch role')}{' '}
|
||||||
<Select
|
<Select
|
||||||
style={{ minWidth: 100 }}
|
style={{ minWidth: 100 }}
|
||||||
bordered={false}
|
bordered={false}
|
||||||
|
@ -28,6 +28,7 @@ const availableActions: {
|
|||||||
update: {
|
update: {
|
||||||
displayName: '{{t("Edit")}}',
|
displayName: '{{t("Edit")}}',
|
||||||
type: 'old-data',
|
type: 'old-data',
|
||||||
|
aliases: ['update', 'move'],
|
||||||
allowConfigureFields: true,
|
allowConfigureFields: true,
|
||||||
},
|
},
|
||||||
destroy: {
|
destroy: {
|
||||||
|
Loading…
Reference in New Issue
Block a user