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 <Dropdown
overlay={ overlay={
<Menu onClick={onMenuCommand}> <Menu
<Menu.Item key="history" disabled={!workflow.allExecuted}>{lang('Execution history')}</Menu.Item> items={[
<Menu.Item key="revision" disabled={!revisionable}>{lang('Copy to new version')}</Menu.Item> { key: 'history', label: lang('Execution history'), disabled: !workflow.allExecuted },
</Menu> { key: 'revision', label: lang('Copy to new version'), disabled: !revisionable },
]}
onClick={onMenuCommand}
/>
} }
> >
<Button type="text" icon={<EllipsisOutlined />} /> <Button type="text" icon={<EllipsisOutlined />} />

View File

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