feat: improve code

This commit is contained in:
chenos 2021-08-24 17:38:30 +08:00
parent 7733e4d5fa
commit 53fa47c56f
31 changed files with 142 additions and 130 deletions

View File

@ -80,12 +80,6 @@ const schema: ISchema = {
// accept: 'jpg,png' // accept: 'jpg,png'
}, },
}, },
showLogoOnly: {
type: 'boolean',
'x-decorator': 'FormItem',
'x-component': 'Checkbox',
'x-content': '只显示 LOGO',
},
}, },
}, },
}, },

View File

@ -316,16 +316,16 @@ const schema: ISchema = {
properties: { properties: {
title: { title: {
type: 'string', type: 'string',
title: '权限名称', title: '权限组名称',
'x-component': 'Input',
'x-decorator': 'FormilyFormItem',
},
name: {
type: 'string',
title: '权限标识',
'x-component': 'Input', 'x-component': 'Input',
'x-decorator': 'FormilyFormItem', 'x-decorator': 'FormilyFormItem',
}, },
// name: {
// type: 'string',
// title: '权限组标识',
// 'x-component': 'Input',
// 'x-decorator': 'FormilyFormItem',
// },
}, },
}, },
}, },
@ -334,7 +334,7 @@ const schema: ISchema = {
}, },
column1: { column1: {
type: 'void', type: 'void',
title: '权限名称', title: '权限名称',
'x-component': 'Table.Column', 'x-component': 'Table.Column',
properties: { properties: {
title: { title: {
@ -344,18 +344,18 @@ const schema: ISchema = {
}, },
}, },
}, },
column2: { // column2: {
type: 'void', // type: 'void',
title: '权限标识', // title: '权限标识',
'x-component': 'Table.Column', // 'x-component': 'Table.Column',
properties: { // properties: {
name: { // name: {
type: 'string', // type: 'string',
'x-component': 'Input', // 'x-component': 'Input',
'x-read-pretty': true, // 'x-read-pretty': true,
}, // },
}, // },
}, // },
[uid()]: { [uid()]: {
type: 'void', type: 'void',
title: '操作', title: '操作',
@ -382,7 +382,7 @@ const schema: ISchema = {
properties: { properties: {
[uid()]: { [uid()]: {
type: 'void', type: 'void',
title: '权限配置', title: '配置权限',
'x-decorator': 'RoleProvider', 'x-decorator': 'RoleProvider',
'x-component': 'Action.Drawer', 'x-component': 'Action.Drawer',
'x-component-props': { 'x-component-props': {
@ -431,7 +431,7 @@ const schema: ISchema = {
properties: { properties: {
[uid()]: { [uid()]: {
type: 'void', type: 'void',
title: '编辑数据', title: '编辑权限组',
'x-decorator': 'Form', 'x-decorator': 'Form',
'x-decorator-props': { 'x-decorator-props': {
useResource: useDetailsResource, useResource: useDetailsResource,
@ -443,7 +443,7 @@ const schema: ISchema = {
properties: { properties: {
title: { title: {
type: 'string', type: 'string',
title: '权限名称', title: '权限名称',
'x-component': 'Input', 'x-component': 'Input',
'x-decorator': 'FormilyFormItem', 'x-decorator': 'FormilyFormItem',
}, },

View File

@ -38,9 +38,6 @@ export const SiteTitle = () => {
{!loading && data?.logo?.url && ( {!loading && data?.logo?.url && (
<img className={'site-logo'} src={data?.logo?.url} /> <img className={'site-logo'} src={data?.logo?.url} />
)} )}
{!loading && !data?.showLogoOnly && data?.title && (
<div className={'site-title'}>{data.title}</div>
)}
</div> </div>
); );
}; };

View File

@ -130,7 +130,7 @@ function generateActionSchema(type) {
useResource: '{{ Table.useResource }}', useResource: '{{ Table.useResource }}',
useValues: '{{ Table.useTableRowRecord }}', useValues: '{{ Table.useTableRowRecord }}',
}, },
'x-component': 'Action.Modal', 'x-component': 'Action.Drawer',
'x-component-props': { 'x-component-props': {
useOkAction: '{{ Table.useTableUpdateAction }}', useOkAction: '{{ Table.useTableUpdateAction }}',
}, },
@ -175,12 +175,12 @@ function AddActionButton() {
} }
return ( return (
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={setVisible} onVisibleChange={setVisible}
overlay={ overlay={
<Menu> <Menu>
<Menu.ItemGroup title={'操作展示'}> <Menu.ItemGroup title={'启用操作'}>
{[ {[
{ title: '编辑', name: 'update' }, { title: '编辑', name: 'update' },
{ title: '删除', name: 'destroy' }, { title: '删除', name: 'destroy' },

View File

@ -180,6 +180,7 @@ Action.Modal = observer((props: any) => {
title={schema.title} title={schema.title}
destroyOnClose destroyOnClose
maskClosable maskClosable
width={'50%'}
footer={ footer={
isFormDecorator && !schema['x-read-pretty'] isFormDecorator && !schema['x-read-pretty']
? [ ? [
@ -192,7 +193,7 @@ Action.Modal = observer((props: any) => {
setVisible(false); setVisible(false);
}} }}
> >
Cancel
</Button>, </Button>,
<Button <Button
type={'primary'} type={'primary'}
@ -204,7 +205,7 @@ Action.Modal = observer((props: any) => {
setVisible(false); setVisible(false);
}} }}
> >
OK
</Button>, </Button>,
] ]
: null : null
@ -257,7 +258,7 @@ Action.Drawer = observer((props: any) => {
setVisible(false); setVisible(false);
}} }}
> >
Cancel
</Button> </Button>
<Button <Button
onClick={async (e) => { onClick={async (e) => {
@ -268,7 +269,7 @@ Action.Drawer = observer((props: any) => {
}} }}
type={'primary'} type={'primary'}
> >
OK
</Button> </Button>
</Space> </Space>
) )
@ -412,7 +413,7 @@ Action.DesignableBar = (props: any) => {
<Space size={2}> <Space size={2}>
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -421,7 +422,7 @@ Action.DesignableBar = (props: any) => {
<Menu> <Menu>
<Menu.Item <Menu.Item
onClick={async (e) => { onClick={async (e) => {
const values = await FormDialog('修改名称和图标', () => { const values = await FormDialog('编辑按钮', () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
<SchemaField <SchemaField
@ -460,7 +461,7 @@ Action.DesignableBar = (props: any) => {
refresh(); refresh();
}} }}
> >
</Menu.Item> </Menu.Item>
{isPopup && ( {isPopup && (
<Menu.Item> <Menu.Item>

View File

@ -365,7 +365,7 @@ function generateCardItemSchema(component) {
properties: { properties: {
create: { create: {
type: 'void', type: 'void',
title: '添加卡片', title: '新增卡片',
// 'x-designable-bar': 'Kanban.AddCardDesignableBar', // 'x-designable-bar': 'Kanban.AddCardDesignableBar',
'x-component': 'Kanban.Card.AddNew', 'x-component': 'Kanban.Card.AddNew',
// 'x-decorator': 'AddNew.Displayed', // 'x-decorator': 'AddNew.Displayed',
@ -939,7 +939,7 @@ AddNew.CardItem = observer((props: any) => {
const { collections = [], loading, refresh } = useCollectionsContext(); const { collections = [], loading, refresh } = useCollectionsContext();
return ( return (
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
overlayStyle={{ overlayStyle={{
minWidth: 200, minWidth: 200,
}} }}
@ -1357,7 +1357,7 @@ AddNew.FormItem = observer((props: any) => {
const displayed = useDisplayedMapContext(); const displayed = useDisplayedMapContext();
return ( return (
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={setVisible} onVisibleChange={setVisible}
overlayStyle={{ overlayStyle={{
@ -1365,7 +1365,7 @@ AddNew.FormItem = observer((props: any) => {
}} }}
overlay={ overlay={
<Menu> <Menu>
<Menu.ItemGroup className={'display-fields'} title={`字段展示`}> <Menu.ItemGroup className={'display-fields'} title={`显示字段`}>
{fields?.map((field) => ( {fields?.map((field) => (
<SwitchMenuItem <SwitchMenuItem
key={field.key} key={field.key}
@ -1548,7 +1548,7 @@ AddNew.PaneItem = observer((props: any) => {
console.log('AddNew.PaneItem.useResource', useResource); console.log('AddNew.PaneItem.useResource', useResource);
return ( return (
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={setVisible} onVisibleChange={setVisible}
overlayStyle={{ overlayStyle={{
@ -1735,7 +1735,6 @@ AddNew.PaneItem = observer((props: any) => {
<PlusOutlined /> <PlusOutlined />
) : ( ) : (
<Button <Button
block
className={'designable-btn designable-btn-dash'} className={'designable-btn designable-btn-dash'}
type={'dashed'} type={'dashed'}
icon={<PlusOutlined />} icon={<PlusOutlined />}

View File

@ -52,7 +52,7 @@ export const ActionDesignableBar = (props: any) => {
<Space size={2}> <Space size={2}>
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);

View File

@ -210,12 +210,12 @@ function AddActionButton() {
} }
return ( return (
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={setVisible} onVisibleChange={setVisible}
overlay={ overlay={
<Menu> <Menu>
<Menu.ItemGroup title={'操作展示'}> <Menu.ItemGroup title={'启用操作'}>
{[ {[
{ title: '今天', name: 'today' }, { title: '今天', name: 'today' },
{ title: '翻页', name: 'nav' }, { title: '翻页', name: 'nav' },

View File

@ -63,7 +63,7 @@ export const DesignableBar = observer((props) => {
<AddNew.CardItem defaultAction={'insertAfter'} ghost /> <AddNew.CardItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -173,7 +173,7 @@ export const DesignableBar = observer((props) => {
key={'defaultFilter'} key={'defaultFilter'}
onClick={async () => { onClick={async () => {
const { defaultFilter } = await FormDialog( const { defaultFilter } = await FormDialog(
'设置筛选范围', '设置数据范围',
() => { () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
@ -204,7 +204,7 @@ export const DesignableBar = observer((props) => {
await updateSchema(schema); await updateSchema(schema);
}} }}
> >
</Menu.Item> </Menu.Item>
<Menu.Divider /> <Menu.Divider />
<Menu.Item <Menu.Item

View File

@ -479,14 +479,14 @@ Calendar.Filter.DesignableBar = () => {
<Space> <Space>
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
}} }}
overlay={ overlay={
<Menu> <Menu>
<Menu.ItemGroup title={'筛选字段'}> <Menu.ItemGroup title={'筛选字段'}>
{fields {fields
.filter((collectionField) => { .filter((collectionField) => {
const option = interfaces.get(collectionField.interface); const option = interfaces.get(collectionField.interface);
@ -520,7 +520,7 @@ Calendar.Filter.DesignableBar = () => {
<Menu.Item <Menu.Item
onClick={async (e) => { onClick={async (e) => {
setVisible(false); setVisible(false);
const values = await FormDialog('修改名称和图标', () => { const values = await FormDialog('编辑按钮', () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
<SchemaField <SchemaField
@ -559,7 +559,7 @@ Calendar.Filter.DesignableBar = () => {
refresh(); refresh();
}} }}
> >
</Menu.Item> </Menu.Item>
<Menu.Divider /> <Menu.Divider />
<Menu.Item <Menu.Item

View File

@ -12,7 +12,7 @@ import { LoadingOutlined } from '@ant-design/icons';
import { CascaderOptionType } from 'antd/lib/cascader'; import { CascaderOptionType } from 'antd/lib/cascader';
import { ArrayField } from '@formily/core'; import { ArrayField } from '@formily/core';
import { toArr } from '@formily/shared'; import { toArr } from '@formily/shared';
import { omit } from 'lodash'; import { isBoolean, omit } from 'lodash';
const defaultFieldNames = { const defaultFieldNames = {
label: 'label', label: 'label',
@ -29,9 +29,11 @@ export const Cascader = connect(
loadData, loadData,
labelInValue, labelInValue,
fieldNames = defaultFieldNames, fieldNames = defaultFieldNames,
changeOnSelectLast,
changeOnSelect,
...others ...others
} = props; } = props;
console.log('Cascader', props); console.log('changeOnSelectLast', changeOnSelectLast);
// 兼容值为 object[] 的情况 // 兼容值为 object[] 的情况
const toValue = () => { const toValue = () => {
return toArr(value).map((item) => { return toArr(value).map((item) => {
@ -84,6 +86,9 @@ export const Cascader = connect(
return ( return (
<AntdCascader <AntdCascader
{...others} {...others}
changeOnSelect={
isBoolean(changeOnSelectLast) ? !changeOnSelectLast : changeOnSelect
}
value={toValue()} value={toValue()}
fieldNames={fieldNames} fieldNames={fieldNames}
displayRender={displayRender} displayRender={displayRender}

View File

@ -60,7 +60,7 @@ Chart.DesignableBar = observer((props) => {
<AddNew.CardItem defaultAction={'insertAfter'} ghost /> <AddNew.CardItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);

View File

@ -255,7 +255,7 @@ export const DatabaseCollection = observer((props) => {
setVisible(false); setVisible(false);
}} }}
footer={ footer={
<Space> <Space style={{ float: 'right' }}>
<Button <Button
onClick={() => { onClick={() => {
setVisible(false); setVisible(false);

View File

@ -17,7 +17,7 @@ export const chinaRegion: FieldOptions = {
// title, // title,
'x-component': 'Cascader', 'x-component': 'Cascader',
'x-component-props': { 'x-component-props': {
changeOnSelect: true, changeOnSelectLast: false,
loadData: '{{ ChinaRegion.loadData }}', loadData: '{{ ChinaRegion.loadData }}',
labelInValue: true, labelInValue: true,
maxLevel: 3, maxLevel: 3,
@ -48,10 +48,10 @@ export const chinaRegion: FieldOptions = {
{ value: 5, label: '村/居委会' }, { value: 5, label: '村/居委会' },
], ],
}, },
'uiSchema.x-component-props.changeOnSelect': { 'uiSchema.x-component-props.changeOnSelectLast': {
type: 'boolean', type: 'boolean',
'x-component': 'Checkbox', 'x-component': 'Checkbox',
'x-content': '无需选到最后一级', 'x-content': '必须选到最后一级',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
}, },
}, },

View File

@ -131,14 +131,16 @@ export function FilterList(props) {
); );
})} })}
</div> </div>
<div style={{ marginTop: 16 }}>
<a <a
onClick={() => { onClick={() => {
set(uid(), {}); set(uid(), {});
}} }}
> >
</a>{' '} </a>
<a <a
style={{ marginLeft: 16 }}
onClick={() => { onClick={() => {
set(uid(), { set(uid(), {
and: [{}], and: [{}],
@ -148,6 +150,7 @@ export function FilterList(props) {
</a> </a>
</div> </div>
</div>
); );
} }

View File

@ -46,7 +46,7 @@ FormItem.DesignableBar = () => {
<AddNew.FormItem defaultAction={'insertAfter'} ghost /> <AddNew.FormItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);

View File

@ -42,9 +42,11 @@ export const DesignableBar = observer((props) => {
const { collection } = useCollection({ collectionName }); const { collection } = useCollection({ collectionName });
return ( return (
<div className={cls('designable-bar', { active: visible })}> <div className={cls('designable-bar', { active: visible })}>
{collection && (
<div className={'designable-info'}> <div className={'designable-info'}>
{collection?.title || collection?.name} {collection?.title || collection?.name}
</div> </div>
)}
<span <span
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@ -55,7 +57,7 @@ export const DesignableBar = observer((props) => {
<AddNew.CardItem defaultAction={'insertAfter'} ghost /> <AddNew.CardItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);

View File

@ -68,7 +68,7 @@ export const FieldDesignableBar = observer((props) => {
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
placement={'bottomRight'} placement={'bottomRight'}
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);

View File

@ -51,7 +51,7 @@ export const DesignableBar = observer((props) => {
<AddNew.CardItem defaultAction={'appendChild'} ghost /> <AddNew.CardItem defaultAction={'appendChild'} ghost />
{/* <DragHandle /> */} {/* <DragHandle /> */}
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);

View File

@ -141,6 +141,7 @@ body.dragging {
pointer-events: none; pointer-events: none;
} }
} }
.nb-grid-row-divider { .nb-grid-row-divider {
// background-color: #ddd; // background-color: #ddd;
height: 24px; height: 24px;
@ -149,10 +150,15 @@ body.dragging {
margin-top: -24px; margin-top: -24px;
position: absolute; position: absolute;
z-index: 20; z-index: 20;
display: none;
// opacity: 0.5; // opacity: 0.5;
// background: #e6f7ff; // background: #e6f7ff;
} }
.nb-grid.active {
.nb-grid-row-divider {
display: block;
}
}
.nb-grid-col-divider { .nb-grid-col-divider {
&.resizable { &.resizable {
cursor: col-resize; cursor: col-resize;

View File

@ -62,7 +62,7 @@ Input.DesignableBar = observer((props) => {
<AddNew.CardItem defaultAction={'insertAfter'} ghost /> <AddNew.CardItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);

View File

@ -57,14 +57,14 @@ export const CardDesignableBar = observer((props) => {
> >
<Space size={2}> <Space size={2}>
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
}} }}
overlay={ overlay={
<Menu> <Menu>
<Menu.ItemGroup className={'display-fields'} title={`字段展示`}> <Menu.ItemGroup className={'display-fields'} title={`显示字段`}>
{fields?.map((field) => ( {fields?.map((field) => (
<SwitchMenuItem <SwitchMenuItem
key={field.key} key={field.key}

View File

@ -52,7 +52,7 @@ export const DesignableBar = observer((props) => {
<AddNew.CardItem defaultAction={'insertAfter'} ghost /> <AddNew.CardItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -71,7 +71,7 @@ export const DesignableBar = observer((props) => {
key={'defaultFilter'} key={'defaultFilter'}
onClick={async () => { onClick={async () => {
const { defaultFilter } = await FormDialog( const { defaultFilter } = await FormDialog(
'设置筛选范围', '设置数据范围',
() => { () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
@ -102,7 +102,7 @@ export const DesignableBar = observer((props) => {
await updateSchema(schema); await updateSchema(schema);
}} }}
> >
</Menu.Item> </Menu.Item>
<Menu.Divider /> <Menu.Divider />
<Menu.Item <Menu.Item

View File

@ -68,7 +68,7 @@ export const FieldDesignableBar = observer((props) => {
<DragHandle /> */} <DragHandle /> */}
<Dropdown <Dropdown
placement={'bottomRight'} placement={'bottomRight'}
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);

View File

@ -126,7 +126,7 @@ const schema: ISchema = {
properties: { properties: {
create: { create: {
type: 'void', type: 'void',
title: '添加卡片', title: '新增卡片',
// 'x-designable-bar': 'Kanban.AddCardDesignableBar', // 'x-designable-bar': 'Kanban.AddCardDesignableBar',
'x-component': 'Kanban.Card.AddNew', 'x-component': 'Kanban.Card.AddNew',
// 'x-decorator': 'AddNew.Displayed', // 'x-decorator': 'AddNew.Displayed',

View File

@ -124,7 +124,7 @@ Markdown.Void.DesignableBar = observer((props) => {
<AddNew.CardItem defaultAction={'insertAfter'} ghost /> <AddNew.CardItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -183,7 +183,7 @@ Markdown.DesignableBar = observer((props) => {
<AddNew.FormItem defaultAction={'insertAfter'} ghost /> <AddNew.FormItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);

View File

@ -961,7 +961,7 @@ Menu.DesignableBar = (props) => {
properties: { properties: {
roles: { roles: {
type: 'array', type: 'array',
title: '权限组', title: '可访问该菜单的权限组',
'x-reactions': [ 'x-reactions': [
'{{useAsyncDataSource(loadRoles)}}', '{{useAsyncDataSource(loadRoles)}}',
], ],

View File

@ -57,7 +57,7 @@ export const SimpleDesignableBar = observer((props) => {
<AddNew.CardItem defaultAction={'insertAfter'} ghost /> <AddNew.CardItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -68,7 +68,7 @@ export const SimpleDesignableBar = observer((props) => {
key={'defaultFilter'} key={'defaultFilter'}
onClick={async () => { onClick={async () => {
const { defaultFilter } = await FormDialog( const { defaultFilter } = await FormDialog(
'设置筛选范围', '设置数据范围',
() => { () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
@ -174,7 +174,7 @@ export const SimpleDesignableBar = observer((props) => {
await updateSchema(schema); await updateSchema(schema);
}} }}
> >
</Menu.Item> </Menu.Item>
<Menu.Item key={'defaultPageSize'}> <Menu.Item key={'defaultPageSize'}>
{' '} {' '}

View File

@ -435,12 +435,12 @@ function AddColumn() {
// const { service } = useTable(); // const { service } = useTable();
return ( return (
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={setVisible} onVisibleChange={setVisible}
overlay={ overlay={
<Menu> <Menu>
<Menu.ItemGroup className={'display-fields'} title={'字段展示'}> <Menu.ItemGroup className={'display-fields'} title={'显示字段'}>
{fields.map((field) => ( {fields.map((field) => (
<SwitchMenuItem <SwitchMenuItem
title={field?.uiSchema?.title} title={field?.uiSchema?.title}
@ -1066,12 +1066,12 @@ function AddActionButton() {
} }
return ( return (
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={setVisible} onVisibleChange={setVisible}
overlay={ overlay={
<Menu> <Menu>
<Menu.ItemGroup title={'操作展示'}> <Menu.ItemGroup title={'启用操作'}>
{[ {[
{ title: '筛选', name: 'filter' }, { title: '筛选', name: 'filter' },
{ title: '导出', name: 'export' }, { title: '导出', name: 'export' },
@ -1376,14 +1376,14 @@ Table.Filter.DesignableBar = () => {
<Space> <Space>
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
}} }}
overlay={ overlay={
<Menu> <Menu>
<Menu.ItemGroup title={'筛选字段'}> <Menu.ItemGroup title={'筛选字段'}>
{fields {fields
.filter((collectionField) => { .filter((collectionField) => {
const option = interfaces.get(collectionField.interface); const option = interfaces.get(collectionField.interface);
@ -1417,7 +1417,7 @@ Table.Filter.DesignableBar = () => {
<Menu.Item <Menu.Item
onClick={async (e) => { onClick={async (e) => {
setVisible(false); setVisible(false);
const values = await FormDialog('修改名称和图标', () => { const values = await FormDialog('编辑按钮', () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
<SchemaField <SchemaField
@ -1456,7 +1456,7 @@ Table.Filter.DesignableBar = () => {
refresh(); refresh();
}} }}
> >
</Menu.Item> </Menu.Item>
<Menu.Divider /> <Menu.Divider />
<Menu.Item <Menu.Item
@ -1505,7 +1505,7 @@ Table.ExportActionDesignableBar = () => {
<Space> <Space>
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -1540,7 +1540,7 @@ Table.ExportActionDesignableBar = () => {
<Menu.Item <Menu.Item
onClick={async (e) => { onClick={async (e) => {
setVisible(false); setVisible(false);
const values = await FormDialog('修改名称和图标', () => { const values = await FormDialog('编辑按钮', () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
<SchemaField <SchemaField
@ -1579,7 +1579,7 @@ Table.ExportActionDesignableBar = () => {
refresh(); refresh();
}} }}
> >
</Menu.Item> </Menu.Item>
<Menu.Divider /> <Menu.Divider />
<Menu.Item <Menu.Item
@ -1652,14 +1652,14 @@ Table.Operation.DesignableBar = () => {
<Space> <Space>
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
}} }}
overlay={ overlay={
<Menu> <Menu>
<Menu.ItemGroup title={'操作展示'}> <Menu.ItemGroup title={'启用操作'}>
{[ {[
{ title: '查看', name: 'view' }, { title: '查看', name: 'view' },
{ title: '编辑', name: 'update' }, { title: '编辑', name: 'update' },
@ -1721,7 +1721,7 @@ Table.Action.DesignableBar = () => {
<Space> <Space>
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -1731,7 +1731,7 @@ Table.Action.DesignableBar = () => {
<Menu.Item <Menu.Item
onClick={async (e) => { onClick={async (e) => {
setVisible(false); setVisible(false);
const values = await FormDialog('修改名称和图标', () => { const values = await FormDialog('编辑按钮', () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
<SchemaField <SchemaField
@ -1770,7 +1770,7 @@ Table.Action.DesignableBar = () => {
refresh(); refresh();
}} }}
> >
</Menu.Item> </Menu.Item>
{isPopup && ( {isPopup && (
<Menu.Item> <Menu.Item>
@ -1902,7 +1902,7 @@ Table.Column.DesignableBar = () => {
<Space> <Space>
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -1912,7 +1912,7 @@ Table.Column.DesignableBar = () => {
<Menu.Item <Menu.Item
onClick={async (e) => { onClick={async (e) => {
setVisible(false); setVisible(false);
const values = await FormDialog('修改列标题', () => { const values = await FormDialog('自定义列名称', () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
<SchemaField <SchemaField
@ -1928,7 +1928,7 @@ Table.Column.DesignableBar = () => {
}, },
title: { title: {
type: 'string', type: 'string',
title: '自定义列标题', title: '自定义列名称',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-component': 'Input', 'x-component': 'Input',
}, },
@ -1953,7 +1953,7 @@ Table.Column.DesignableBar = () => {
}); });
}} }}
> >
</Menu.Item> </Menu.Item>
<Menu.Divider /> <Menu.Divider />
<Menu.Item <Menu.Item
@ -2018,7 +2018,7 @@ Table.DesignableBar = observer((props) => {
<AddNew.CardItem defaultAction={'insertAfter'} ghost /> <AddNew.CardItem defaultAction={'insertAfter'} ghost />
<DragHandle /> <DragHandle />
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -2177,7 +2177,7 @@ Table.DesignableBar = observer((props) => {
key={'defaultFilter'} key={'defaultFilter'}
onClick={async () => { onClick={async () => {
const { defaultFilter } = await FormDialog( const { defaultFilter } = await FormDialog(
'设置筛选范围', '设置数据范围',
() => { () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
@ -2208,7 +2208,7 @@ Table.DesignableBar = observer((props) => {
await updateSchema(schema); await updateSchema(schema);
}} }}
> >
</Menu.Item> </Menu.Item>
<Menu.Item key={'defaultPageSize'}> <Menu.Item key={'defaultPageSize'}>
{' '} {' '}

View File

@ -107,6 +107,7 @@ export const Tabs: any = observer((props: any) => {
designable && designable &&
schema['x-designable-bar'] && ( schema['x-designable-bar'] && (
<Button <Button
className={'designable-btn designable-btn-dash'}
type={'dashed'} type={'dashed'}
icon={<PlusOutlined />} icon={<PlusOutlined />}
onClick={async () => { onClick={async () => {
@ -221,7 +222,7 @@ Tabs.DesignableBar = () => {
> >
<Space> <Space>
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
placement={'bottomRight'} placement={'bottomRight'}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
@ -271,7 +272,7 @@ Tabs.TabPane.DesignableBar = () => {
<Space> <Space>
<DragHandle />{' '} <DragHandle />{' '}
<Dropdown <Dropdown
trigger={['click']} trigger={['hover']}
visible={visible} visible={visible}
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
setVisible(visible); setVisible(visible);
@ -280,7 +281,7 @@ Tabs.TabPane.DesignableBar = () => {
<Menu> <Menu>
<Menu.Item <Menu.Item
onClick={async () => { onClick={async () => {
const values = await FormDialog('修改名称和图标', () => { const values = await FormDialog('编辑按钮', () => {
return ( return (
<FormLayout layout={'vertical'}> <FormLayout layout={'vertical'}>
<SchemaField <SchemaField
@ -320,7 +321,7 @@ Tabs.TabPane.DesignableBar = () => {
updateSchema(schema); updateSchema(schema);
}} }}
> >
</Menu.Item> </Menu.Item>
<Menu.Divider /> <Menu.Divider />
<Menu.Item <Menu.Item

View File

@ -18,6 +18,10 @@
&.active { &.active {
display: block; display: block;
} }
+ .ant-tabs {
position: relative;
z-index: 51;
}
.designable-bar-actions { .designable-bar-actions {
pointer-events: all; pointer-events: all;
position: absolute; position: absolute;