mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:38:13 +00:00
Merge branch 'main' into next
This commit is contained in:
commit
0db386c704
@ -20,6 +20,7 @@ import {
|
||||
SchemaSettingsModalItem,
|
||||
SchemaSettingsRemove,
|
||||
SchemaSettingsSubMenu,
|
||||
SchemaSettingsSwitchItem,
|
||||
useAPIClient,
|
||||
useDesignable,
|
||||
useURLAndHTMLSchema,
|
||||
@ -373,6 +374,20 @@ export const MenuDesigner = () => {
|
||||
initialValues={initialValues}
|
||||
onSubmit={onEditSubmit}
|
||||
/>
|
||||
<SchemaSettingsSwitchItem
|
||||
title={t('Hidden')}
|
||||
checked={fieldSchema['x-component-props']?.hidden}
|
||||
onChange={(v) => {
|
||||
fieldSchema['x-component-props'].hidden = !!v;
|
||||
field.componentProps.hidden = !!v;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
'x-component-props': fieldSchema['x-component-props'],
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<SchemaSettingsModalItem
|
||||
title={t('Move to')}
|
||||
eventKey="move-to"
|
||||
|
@ -528,14 +528,16 @@ const menuItemTitleStyle = {
|
||||
Menu.Item = observer(
|
||||
(props) => {
|
||||
const { t } = useMenuTranslation();
|
||||
const { designable } = useDesignable();
|
||||
const { pushMenuItem } = useCollectMenuItems();
|
||||
const { icon, children, ...others } = props;
|
||||
const { icon, children, hidden, ...others } = props;
|
||||
const schema = useFieldSchema();
|
||||
const field = useField();
|
||||
const Designer = useContext(MenuItemDesignerContext);
|
||||
const item = useMemo(() => {
|
||||
return {
|
||||
...others,
|
||||
hidden: designable ? false : hidden,
|
||||
className: menuItemClass,
|
||||
key: schema.name,
|
||||
eventKey: schema.name,
|
||||
@ -620,7 +622,8 @@ const MenuURLButton = ({ href, params, icon }) => {
|
||||
Menu.URL = observer(
|
||||
(props) => {
|
||||
const { pushMenuItem } = useCollectMenuItems();
|
||||
const { icon, children, ...others } = props;
|
||||
const { designable } = useDesignable();
|
||||
const { icon, children, hidden, ...others } = props;
|
||||
const schema = useFieldSchema();
|
||||
const field = useField();
|
||||
const Designer = useContext(MenuItemDesignerContext);
|
||||
@ -633,6 +636,7 @@ Menu.URL = observer(
|
||||
const item = useMemo(() => {
|
||||
return {
|
||||
...others,
|
||||
hidden: designable ? false : hidden,
|
||||
className: menuItemClass,
|
||||
key: schema.name,
|
||||
eventKey: schema.name,
|
||||
@ -646,7 +650,7 @@ Menu.URL = observer(
|
||||
</SchemaContext.Provider>
|
||||
),
|
||||
};
|
||||
}, [field.title, icon, props.href, schema, JSON.stringify(props.params)]);
|
||||
}, [field.title, designable, hidden, icon, props.href, schema, JSON.stringify(props.params)]);
|
||||
|
||||
pushMenuItem(item);
|
||||
return null;
|
||||
@ -657,9 +661,10 @@ Menu.URL = observer(
|
||||
Menu.SubMenu = observer(
|
||||
(props) => {
|
||||
const { t } = useMenuTranslation();
|
||||
const { designable } = useDesignable();
|
||||
const { Component, getMenuItems } = useMenuItem();
|
||||
const { pushMenuItem } = useCollectMenuItems();
|
||||
const { icon, children, ...others } = props;
|
||||
const { icon, children, hidden, ...others } = props;
|
||||
const schema = useFieldSchema();
|
||||
const field = useField();
|
||||
const mode = useContext(MenuModeContext);
|
||||
@ -667,6 +672,7 @@ Menu.SubMenu = observer(
|
||||
const submenu = useMemo(() => {
|
||||
return {
|
||||
...others,
|
||||
hidden: designable ? false : hidden,
|
||||
className: menuItemClass,
|
||||
key: schema.name,
|
||||
eventKey: schema.name,
|
||||
|
Loading…
Reference in New Issue
Block a user