refactor(plugin-workflow): migrate menu items to options (#1724)

This commit is contained in:
Junyi 2023-04-18 20:46:59 +07:00 committed by GitHub
parent a3a91965c7
commit 422429e772
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 12 deletions

View File

@ -173,10 +173,13 @@ export function WorkflowCanvas() {
/>
<Dropdown
overlay={
<Menu onClick={onMenuCommand}>
<Menu.Item key="history" disabled={!workflow.allExecuted}>{lang('Execution history')}</Menu.Item>
<Menu.Item key="revision" disabled={!revisionable}>{lang('Copy to new version')}</Menu.Item>
</Menu>
<Menu
items={[
{ key: 'history', label: lang('Execution history'), disabled: !workflow.allExecuted },
{ key: 'revision', label: lang('Copy to new version'), disabled: !revisionable },
]}
onClick={onMenuCommand}
/>
}
>
<Button type="text" icon={<EllipsisOutlined />} />

View File

@ -117,14 +117,17 @@ export default observer(({ value, disabled, onChange }: any) => {
{unassignedFields.length
? (
<Dropdown overlay={
<Menu onClick={({ key }) => onChange({ ...value, [key]: null })} className={css`
max-height: 300px;
overflow-y: auto;
`}>
{unassignedFields.map(field => (
<Menu.Item key={field.name}>{compile(field.uiSchema?.title ?? field.name)}</Menu.Item>
))}
</Menu>
<Menu
items={unassignedFields.map(field => ({
key: field.name,
label: compile(field.uiSchema?.title ?? field.name),
}))}
onClick={({ key }) => onChange({ ...value, [key]: null })}
className={css`
max-height: 300px;
overflow-y: auto;
`}
/>
}>
<Button icon={<PlusOutlined />}>{t('Add field')}</Button>
</Dropdown>