fix: avoid fixedblock height working in popup (#1621)
* fix: designer item should return null * fix: avoid fixedblock height working in popup
This commit is contained in:
parent
6b47597256
commit
35d34bb427
@ -42,17 +42,20 @@ export const FixedBlockWrapper: React.FC = (props) => {
|
|||||||
const fixedBlock = useFixedSchema();
|
const fixedBlock = useFixedSchema();
|
||||||
const { height, fixedBlockUID } = useFixedBlock();
|
const { height, fixedBlockUID } = useFixedBlock();
|
||||||
const record = useRecord();
|
const record = useRecord();
|
||||||
const isPopup = Object.keys(record);
|
const isPopup = Object.keys(record).length;
|
||||||
|
if (isPopup) {
|
||||||
|
return <>{props.children}</>;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* The fixedBlockUID of false means that the page has no fixed blocks
|
* The fixedBlockUID of false means that the page has no fixed blocks
|
||||||
* isPopup means that the FixedBlock is in the popup mode
|
* isPopup means that the FixedBlock is in the popup mode
|
||||||
*/
|
*/
|
||||||
if (!fixedBlock && fixedBlockUID && !isPopup) return null;
|
if (!fixedBlock && fixedBlockUID) return null;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="nb-fixed-block"
|
className="nb-fixed-block"
|
||||||
style={{
|
style={{
|
||||||
height: fixedBlockUID !== false ? `calc(100vh - ${height}px)` : undefined,
|
height: fixedBlockUID ? `calc(100vh - ${height}px)` : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
@ -67,9 +70,8 @@ export const FixedBlockDesignerItem = () => {
|
|||||||
const { dn } = useDesignable();
|
const { dn } = useDesignable();
|
||||||
const record = useRecord();
|
const record = useRecord();
|
||||||
|
|
||||||
return useMemo(() => {
|
|
||||||
if (Object.keys(record).length) {
|
if (Object.keys(record).length) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<SchemaSettings.SwitchItem
|
<SchemaSettings.SwitchItem
|
||||||
@ -90,7 +92,6 @@ export const FixedBlockDesignerItem = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}, [fieldSchema['x-decorator-props'], field.decoratorProps?.fixedBlock, dn, record]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface FixedBlockProps {
|
interface FixedBlockProps {
|
||||||
|
Loading…
Reference in New Issue
Block a user