fix: action area (#1188)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1188
This commit is contained in:
sealday 2024-06-14 00:56:04 +08:00
parent 0be9252807
commit 96c9f954e7
3 changed files with 57 additions and 16 deletions

View File

@ -1,7 +1,30 @@
import { createStyles } from 'antd-style';
export const useStyles = createStyles(({ css, token }) => {
return css`
return {
container: css`
padding-top: ${token.padding}px;
`;
`,
footer: css`
display: flex;
justify-content: flex-end;
width: 100%;
flex-shrink: 0;
padding-bottom: ${token.padding}px;
border-bottom: 1px solid rgba(5, 5, 5, 0.06);
.ant-btn {
margin-right: ${token.margin}px;
}
.title {
flex: 1;
margin: 0;
color: rgba(0, 0, 0, 0.88);
font-weight: 600;
font-size: ${token.fontSizeHeading3}px;
line-height: ${token.lineHeightHeading3};
padding-right: 24px;
}
`,
};
});

View File

@ -32,11 +32,13 @@ export const ActionAreaStub = () => {
export const ActionAreaPlayer = ({ children }) => {
const { visible, setVisible } = useActionContext();
const { prevSetVisible, setPrevSetVisible, ref = { current: null } } = useContext(ActionAreaContext);
const { prevSetVisible, setPrevSetVisible, ref } = useContext(ActionAreaContext);
useEffect(() => {
if (visible) {
setPrevSetVisible?.(() => {
prevSetVisible?.(false);
// 因为无法判断是不是自己之前的那个 setVisible如果是同一个 setVisible 那么上面那个设置会导致不显示
setVisible(true);
return setVisible;
});
}
@ -47,13 +49,28 @@ export const ActionAreaPlayer = ({ children }) => {
export const ActionArea: ComposedActionDrawer = observer(
(props) => {
const { footerNodeName = 'Action.Drawer.Footer' } = props;
const { footerNodeName = 'ActionArea.Footer' } = props;
const schema = useFieldSchema();
const field = useField();
const { styles } = useStyles();
const Current = () => (
<div className={styles}>
<>
<div className={styles.footer}>
<div className="title">
<strong>{field.title}</strong>
</div>
<RecursionField
basePath={field.address}
schema={schema}
onlyRenderProperties
filterProperties={(s) => {
return s['x-component'] === footerNodeName;
}}
/>
</div>
<div className={styles.container}>
<RecursionField
basePath={field.address}
schema={schema}
@ -63,6 +80,7 @@ export const ActionArea: ComposedActionDrawer = observer(
}}
/>
</div>
</>
);
return (

View File

@ -45,7 +45,7 @@ const useStyles = createStyles(({ css, token }) => {
overflow-y: scroll;
padding: 8px;
background-color: white;
width: 800px;
width: 600px;
}
.workflow-canvas-wrapper {