mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:17:23 +00:00
refactor(plugin-workflow): adjust branch styles (#2922)
This commit is contained in:
parent
3b02c6e6e1
commit
e86c5a7636
@ -9,11 +9,13 @@ export function Branch({
|
|||||||
entry = null,
|
entry = null,
|
||||||
branchIndex = null,
|
branchIndex = null,
|
||||||
controller = null,
|
controller = null,
|
||||||
|
className,
|
||||||
}: {
|
}: {
|
||||||
from?: any;
|
from?: any;
|
||||||
entry?: any;
|
entry?: any;
|
||||||
branchIndex?: number | null;
|
branchIndex?: number | null;
|
||||||
controller?: any;
|
controller?: React.ReactNode;
|
||||||
|
className?: string;
|
||||||
}) {
|
}) {
|
||||||
const { styles } = useStyles();
|
const { styles } = useStyles();
|
||||||
|
|
||||||
@ -23,7 +25,7 @@ export function Branch({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cx(styles.branchClass)}>
|
<div className={cx(styles.branchClass, className)}>
|
||||||
<div className="workflow-branch-lines" />
|
<div className="workflow-branch-lines" />
|
||||||
{controller}
|
{controller}
|
||||||
<AddButton upstream={from} branchIndex={branchIndex} />
|
<AddButton upstream={from} branchIndex={branchIndex} />
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import { cx, css } from '@nocobase/client';
|
||||||
|
|
||||||
import { Branch } from './Branch';
|
import { Branch } from './Branch';
|
||||||
import { lang } from './locale';
|
import { lang } from './locale';
|
||||||
import useStyles from './style';
|
import useStyles from './style';
|
||||||
@ -16,7 +19,14 @@ export function CanvasContent({ entry }) {
|
|||||||
<Alert type="warning" message={lang('Executed workflow cannot be modified')} showIcon />
|
<Alert type="warning" message={lang('Executed workflow cannot be modified')} showIcon />
|
||||||
) : null}
|
) : null}
|
||||||
<TriggerConfig />
|
<TriggerConfig />
|
||||||
<div className={styles.branchBlockClass}>
|
<div
|
||||||
|
className={cx(
|
||||||
|
styles.branchBlockClass,
|
||||||
|
css`
|
||||||
|
margin-top: 0 !important;
|
||||||
|
`,
|
||||||
|
)}
|
||||||
|
>
|
||||||
<Branch entry={entry} />
|
<Branch entry={entry} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.terminalClass}>{lang('End')}</div>
|
<div className={styles.terminalClass}>{lang('End')}</div>
|
||||||
|
@ -4,6 +4,7 @@ export * from './FlowContext';
|
|||||||
export * from './nodes';
|
export * from './nodes';
|
||||||
export { triggers, useTrigger, getTriggersOptions } from './triggers';
|
export { triggers, useTrigger, getTriggersOptions } from './triggers';
|
||||||
export { useWorkflowVariableOptions, getCollectionFieldOptions } from './variable';
|
export { useWorkflowVariableOptions, getCollectionFieldOptions } from './variable';
|
||||||
|
export { default as useStyles } from './style';
|
||||||
|
|
||||||
import { Plugin } from '@nocobase/client';
|
import { Plugin } from '@nocobase/client';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
@ -423,19 +423,8 @@ export default {
|
|||||||
return (
|
return (
|
||||||
<NodeDefaultView data={data}>
|
<NodeDefaultView data={data}>
|
||||||
{rejectOnFalse ? null : (
|
{rejectOnFalse ? null : (
|
||||||
<div className={cx(styles.nodeSubtreeClass)}>
|
<div className={styles.nodeSubtreeClass}>
|
||||||
<div
|
<div className={styles.branchBlockClass}>
|
||||||
className={cx(
|
|
||||||
styles.branchBlockClass,
|
|
||||||
css`
|
|
||||||
> * > .workflow-branch-lines {
|
|
||||||
> button {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<Branch from={data} entry={falseEntry} branchIndex={0} />
|
<Branch from={data} entry={falseEntry} branchIndex={0} />
|
||||||
<Branch from={data} entry={trueEntry} branchIndex={1} />
|
<Branch from={data} entry={trueEntry} branchIndex={1} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -91,12 +91,6 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
className={css`
|
|
||||||
position: relative;
|
|
||||||
height: 2em;
|
|
||||||
`}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</NodeDefaultView>
|
</NodeDefaultView>
|
||||||
);
|
);
|
||||||
|
@ -65,8 +65,8 @@ export default {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeDefaultView data={data}>
|
<NodeDefaultView data={data}>
|
||||||
<div className={cx(styles.nodeSubtreeClass)}>
|
<div className={styles.nodeSubtreeClass}>
|
||||||
<div className={cx(styles.branchBlockClass)}>
|
<div className={styles.branchBlockClass}>
|
||||||
{branches.map((branch) => (
|
{branches.map((branch) => (
|
||||||
<Branch key={branch.id} from={data} entry={branch} branchIndex={branch.branchIndex} />
|
<Branch key={branch.id} from={data} entry={branch} branchIndex={branch.branchIndex} />
|
||||||
))}
|
))}
|
||||||
@ -100,12 +100,6 @@ export default {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
className={css`
|
|
||||||
position: relative;
|
|
||||||
height: 2em;
|
|
||||||
`}
|
|
||||||
>
|
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={lang('Add branch')}
|
title={lang('Add branch')}
|
||||||
className={css`
|
className={css`
|
||||||
@ -115,11 +109,13 @@ export default {
|
|||||||
<Button
|
<Button
|
||||||
icon={<PlusOutlined />}
|
icon={<PlusOutlined />}
|
||||||
className={css`
|
className={css`
|
||||||
position: absolute;
|
position: relative;
|
||||||
top: calc(50% - 1px);
|
top: 1em;
|
||||||
transform: translateX(-50%) rotate(45deg);
|
transform-origin: center;
|
||||||
|
transform: rotate(45deg);
|
||||||
|
|
||||||
.anticon {
|
.anticon {
|
||||||
|
transform-origin: center;
|
||||||
transform: rotate(-45deg);
|
transform: rotate(-45deg);
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
@ -128,7 +124,6 @@ export default {
|
|||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</NodeDefaultView>
|
</NodeDefaultView>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -110,6 +110,7 @@ const useStyles = createStyles(({ css, token }) => {
|
|||||||
branchBlockClass: css`
|
branchBlockClass: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-top: 2em;
|
||||||
|
|
||||||
:before {
|
:before {
|
||||||
content: '';
|
content: '';
|
||||||
@ -330,7 +331,6 @@ const useStyles = createStyles(({ css, token }) => {
|
|||||||
|
|
||||||
conditionClass: css`
|
conditionClass: css`
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 2em;
|
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
|
|
||||||
> span {
|
> span {
|
||||||
|
Loading…
Reference in New Issue
Block a user