mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 05:25:52 +00:00
fix: cannot access 'ActionPage' before initialization (#5125)
This commit is contained in:
parent
7ff13ff39e
commit
ffcc60cadf
@ -15,45 +15,41 @@ import { BackButtonUsedInSubPage } from '../page/BackButtonUsedInSubPage';
|
|||||||
import { TabsContextProvider, useTabsContext } from '../tabs/context';
|
import { TabsContextProvider, useTabsContext } from '../tabs/context';
|
||||||
import { useActionPageStyle } from './Action.Page.style';
|
import { useActionPageStyle } from './Action.Page.style';
|
||||||
import { usePopupOrSubpagesContainerDOM } from './hooks/usePopupSlotDOM';
|
import { usePopupOrSubpagesContainerDOM } from './hooks/usePopupSlotDOM';
|
||||||
import { ComposedActionDrawer } from './types';
|
|
||||||
|
|
||||||
export const ActionPage: ComposedActionDrawer = observer(
|
export function ActionPage({ level }) {
|
||||||
({ level }) => {
|
const filedSchema = useFieldSchema();
|
||||||
const filedSchema = useFieldSchema();
|
const ctx = useActionContext();
|
||||||
const ctx = useActionContext();
|
const { getContainerDOM } = usePopupOrSubpagesContainerDOM();
|
||||||
const { getContainerDOM } = usePopupOrSubpagesContainerDOM();
|
const { styles } = useActionPageStyle();
|
||||||
const { styles } = useActionPageStyle();
|
const tabContext = useTabsContext();
|
||||||
const tabContext = useTabsContext();
|
|
||||||
|
|
||||||
const style = useMemo(() => {
|
const style = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
// 20 is the z-index value of the main page
|
// 20 is the z-index value of the main page
|
||||||
zIndex: 20 + level,
|
zIndex: 20 + level,
|
||||||
};
|
};
|
||||||
}, [level]);
|
}, [level]);
|
||||||
|
|
||||||
if (!ctx.visible) {
|
if (!ctx.visible) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const actionPageNode = (
|
const actionPageNode = (
|
||||||
<div className={styles.container} style={style}>
|
<div className={styles.container} style={style}>
|
||||||
<TabsContextProvider {...tabContext} tabBarExtraContent={<BackButtonUsedInSubPage />}>
|
<TabsContextProvider {...tabContext} tabBarExtraContent={<BackButtonUsedInSubPage />}>
|
||||||
<RecursionField schema={filedSchema} onlyRenderProperties />
|
<RecursionField schema={filedSchema} onlyRenderProperties />
|
||||||
</TabsContextProvider>
|
</TabsContextProvider>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const container = getContainerDOM();
|
const container = getContainerDOM();
|
||||||
|
|
||||||
if (container) {
|
if (container) {
|
||||||
return createPortal(actionPageNode, container);
|
return createPortal(actionPageNode, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
return actionPageNode;
|
return actionPageNode;
|
||||||
},
|
}
|
||||||
{ displayName: 'ActionPage' },
|
|
||||||
);
|
|
||||||
|
|
||||||
ActionPage.Footer = observer(
|
ActionPage.Footer = observer(
|
||||||
() => {
|
() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user