Merge branches 'fix-textare-autop' and 'nocobase-next' of https://github.com/nocobase/nocobase into nocobase-next

This commit is contained in:
Semmy 2022-03-30 15:40:40 +08:00
commit 9615141180
4 changed files with 102 additions and 86 deletions

View File

@ -13,7 +13,7 @@ import {
RemoteSchemaTemplateManagerProvider,
useDocumentTitle,
useRoute,
useSystemSettings,
useSystemSettings
} from '../../../';
const InternalAdminLayout = (props: any) => {
@ -58,6 +58,11 @@ const InternalAdminLayout = (props: any) => {
/>
{/* {result?.data?.data?.title} */}
</div>
<div
style={{
width: 'calc(100% - 590px)',
}}
>
<RemoteSchemaComponent
hidden={hidden}
uid={route.uiSchemaUid}
@ -89,6 +94,7 @@ const InternalAdminLayout = (props: any) => {
}}
/>
</div>
</div>
<div style={{ position: 'absolute', top: 0, right: 0 }}>
<PluginManager.Toolbar
items={[

View File

@ -134,6 +134,19 @@ const useSideMenuRef = () => {
const MenuItemDesignerContext = createContext(null);
const AddMenuItemButton = () => {
const schema = useFieldSchema();
const { render } = useSchemaInitializer(schema['x-initializer']);
const { designable } = useDesignable();
return (
designable && (
<AntdMenu.Item disabled style={{ padding: '0 8px', order: 9999 }}>
{render({ style: { background: 'none' } })}
</AntdMenu.Item>
)
);
};
export const Menu: ComposedMenu = observer((props) => {
let {
onSelect,
@ -192,19 +205,13 @@ export const Menu: ComposedMenu = observer((props) => {
<DndContext>
<MenuItemDesignerContext.Provider value={Designer}>
<MenuModeContext.Provider value={mode}>
<div
style={{
width: 'calc(100% - 200px - 390px)',
display: 'flex',
justifyContent: 'flex-start',
alignItems: 'center',
}}
>
<AntdMenu
{...others}
style={{
style={
{
// width: mode === 'mix' ? '100%' : undefined,
}}
}
}
className={css`
.ant-menu-item:hover {
> .ant-menu-title-content > div {
@ -249,9 +256,10 @@ export const Menu: ComposedMenu = observer((props) => {
mode={mode === 'mix' ? 'horizontal' : mode}
defaultOpenKeys={defaultOpenKeys}
defaultSelectedKeys={defaultSelectedKeys}
></AntdMenu>
{render({ style: { background: 'none' } })}
</div>
>
<AddMenuItemButton />
{props.children}
</AntdMenu>
{loading
? null
: mode === 'mix' &&

View File

@ -32,7 +32,8 @@ export const CurrentUser = () => {
<LanguageSettings />
<Menu.Divider />
<Menu.Item
onClick={() => {
onClick={async () => {
await api.resource('users').signout();
api.setBearerToken(null);
history.push('/signin');
}}

View File

@ -44,7 +44,8 @@ export async function signin(ctx: Context, next: Next) {
}
export async function signout(ctx: Context, next: Next) {
ctx.body = {};
await ctx.state.currentUser.update({ token: null });
ctx.body = ctx.state.currentUser;
await next();
}