mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 04:15:19 +00:00
fix: left menu title modify (#3956)
This commit is contained in:
parent
89b73ba389
commit
606ef55db8
@ -126,18 +126,6 @@ const MenuEditor = (props) => {
|
||||
},
|
||||
);
|
||||
|
||||
const match = useMatch('/admin/:name');
|
||||
|
||||
useEffect(() => {
|
||||
if (match) {
|
||||
const schema = filterByACL(data?.data, ctx);
|
||||
const s = findByUid(schema, defaultSelectedUid);
|
||||
if (s) {
|
||||
setTitle(s.title);
|
||||
}
|
||||
}
|
||||
}, [data?.data, location.pathname, defaultSelectedUid]);
|
||||
|
||||
useEffect(() => {
|
||||
const properties = Object.values(current?.root?.properties || {}).shift()?.['properties'] || data?.data?.properties;
|
||||
if (sideMenuRef.current) {
|
||||
|
@ -4,7 +4,7 @@ import { ISchema, Schema, useField, useFieldSchema } from '@formily/react';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { findByUid } from '.';
|
||||
import { createDesignable } from '../..';
|
||||
import { createDesignable, useCompile } from '../..';
|
||||
import {
|
||||
GeneralSchemaDesigner,
|
||||
SchemaSettingsDivider,
|
||||
@ -208,6 +208,8 @@ export const MenuDesigner = () => {
|
||||
const { dn, refresh } = useDesignable();
|
||||
const { t } = useTranslation();
|
||||
const menuSchema = findMenuSchema(fieldSchema);
|
||||
const compile = useCompile();
|
||||
const onSelect = compile(menuSchema?.['x-component-props']?.['onSelect']);
|
||||
const items = toItems(menuSchema?.properties);
|
||||
const effects = (form) => {
|
||||
onFieldChange('target', (field: Field) => {
|
||||
@ -286,6 +288,7 @@ export const MenuDesigner = () => {
|
||||
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
||||
fieldSchema['x-component-props']['icon'] = icon;
|
||||
fieldSchema['x-component-props']['href'] = href;
|
||||
onSelect?.({ item: { props: { schema: fieldSchema } } });
|
||||
dn.emit('patch', {
|
||||
schema,
|
||||
});
|
||||
|
@ -24,6 +24,7 @@ import { ErrorFallback } from '../error-fallback';
|
||||
import FixedBlock from './FixedBlock';
|
||||
import { PageDesigner, PageTabDesigner } from './PageTabDesigner';
|
||||
import { useStyles } from './style';
|
||||
import { useRequest } from '../../../api-client';
|
||||
|
||||
export const Page = (props) => {
|
||||
const { children, ...others } = props;
|
||||
@ -62,11 +63,24 @@ export const Page = (props) => {
|
||||
const { wrapSSR, hashId, componentCls } = useStyles();
|
||||
const aclStyles = useAClStyles();
|
||||
|
||||
const pageHeaderTitle = hidePageTitle ? undefined : fieldSchema.title || compile(title);
|
||||
|
||||
useRequest(
|
||||
{
|
||||
url: `/uiSchemas:getParentJsonSchema/${fieldSchema['x-uid']}`,
|
||||
},
|
||||
{
|
||||
ready: !hidePageTitle && !pageHeaderTitle,
|
||||
onSuccess(data) {
|
||||
setTitle(data.data.title);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const handleErrors = (error) => {
|
||||
console.error(error);
|
||||
};
|
||||
|
||||
const pageHeaderTitle = hidePageTitle ? undefined : fieldSchema.title || compile(title);
|
||||
return wrapSSR(
|
||||
<div className={`${componentCls} ${hashId} ${aclStyles.styles}`}>
|
||||
<PageDesigner title={fieldSchema.title || title} />
|
||||
|
Loading…
Reference in New Issue
Block a user