2021-07-17 22:35:50 +08:00
|
|
|
import { ISchema } from '@formily/react';
|
|
|
|
import { uid } from '@formily/shared';
|
|
|
|
|
2021-07-20 23:19:54 +08:00
|
|
|
export function generateDefaultSchema(component) {
|
|
|
|
const defaultSchemas: { [key: string]: ISchema } = {
|
|
|
|
MixMenu: {
|
|
|
|
type: 'void',
|
|
|
|
'x-component': 'Menu',
|
|
|
|
'x-designable-bar': 'Menu.DesignableBar',
|
|
|
|
'x-component-props': {
|
|
|
|
sideMenuRef: '{{ sideMenuRef }}',
|
|
|
|
mode: 'mix',
|
|
|
|
theme: 'dark',
|
|
|
|
// onSelect: '{{ onSelect }}',
|
|
|
|
},
|
2021-07-17 22:35:50 +08:00
|
|
|
},
|
2021-07-20 23:19:54 +08:00
|
|
|
'Menu.Item': {
|
|
|
|
type: 'void',
|
|
|
|
'x-designable-bar': 'Menu.DesignableBar',
|
|
|
|
'x-component': 'Menu.Item',
|
|
|
|
},
|
|
|
|
'Menu.Link': {
|
|
|
|
type: 'void',
|
|
|
|
'x-designable-bar': 'Menu.DesignableBar',
|
|
|
|
'x-component': 'Menu.Link',
|
|
|
|
properties: {
|
|
|
|
[uid()]: {
|
|
|
|
type: 'void',
|
2021-07-23 12:34:15 +08:00
|
|
|
async: true,
|
2021-07-20 23:19:54 +08:00
|
|
|
'x-component': 'Page',
|
|
|
|
properties: {
|
|
|
|
[uid()]: {
|
|
|
|
type: 'void',
|
|
|
|
'x-component': 'Grid',
|
|
|
|
'x-component-props': {
|
|
|
|
addNewComponent: 'AddNew.CardItem',
|
2021-07-17 22:35:50 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-07-20 23:19:54 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
'Menu.URL': {
|
|
|
|
type: 'void',
|
|
|
|
'x-designable-bar': 'Menu.DesignableBar',
|
|
|
|
'x-component': 'Menu.URL',
|
|
|
|
},
|
|
|
|
'Menu.SubMenu': {
|
|
|
|
type: 'void',
|
|
|
|
'x-designable-bar': 'Menu.DesignableBar',
|
|
|
|
'x-component': 'Menu.SubMenu',
|
|
|
|
},
|
|
|
|
'Menu.Action': {
|
|
|
|
type: 'void',
|
|
|
|
'x-designable-bar': 'Menu.DesignableBar',
|
|
|
|
'x-component': 'Menu.Action',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
return defaultSchemas[component];
|
|
|
|
}
|