diff --git a/packages/core/client/src/locale/en_US.ts b/packages/core/client/src/locale/en_US.ts index 97c5cd45a..e46cf8b4f 100644 --- a/packages/core/client/src/locale/en_US.ts +++ b/packages/core/client/src/locale/en_US.ts @@ -299,4 +299,7 @@ export default { 'After successful update': 'After successful update', 'Save record': 'Save record', 'After successful save': 'After successful save', + 'Button background color': 'Button background color', + 'Highlight': 'Highlight', + 'Danger red': 'Danger red' } diff --git a/packages/core/client/src/locale/zh_CN.ts b/packages/core/client/src/locale/zh_CN.ts index b93761ff7..dccaf78d9 100644 --- a/packages/core/client/src/locale/zh_CN.ts +++ b/packages/core/client/src/locale/zh_CN.ts @@ -506,4 +506,7 @@ export default { 'After successful save': '保存成功后', 'After clicking the custom button, the following field values will be assigned according to the following form.': '点击当前自定义按钮时,以下字段值将按照以下表单赋值。', 'After clicking the custom button, the following fields of the current record will be saved according to the following form.': '点击当前自定义按钮时,当前数据以下字段将按照以下表单保存。', + 'Button background color': '按钮颜色', + 'Highlight': '高亮', + 'Danger red': '红色' } diff --git a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx index 55cac46c8..fdd63a8a9 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx @@ -79,16 +79,35 @@ export const ActionDesigner = (props) => { 'x-component-props': {}, // description: `原字段标题:${collectionField?.uiSchema?.title}`, }, + type: { + 'x-decorator': 'FormItem', + 'x-component': 'Radio.Group', + title: t('Button background color'), + default: fieldSchema?.['x-component-props']?.danger + ? 'danger' + : fieldSchema?.['x-component-props']?.type === 'primary' + ? 'primary' + : 'default', + enum: [ + { value: 'default', label: '{{t("Default")}}' }, + { value: 'primary', label: '{{t("Highlight")}}' }, + { value: 'danger', label: '{{t("Danger red")}}' }, + ], + }, }, } as ISchema } - onSubmit={({ title, icon }) => { + onSubmit={({ title, icon, type }) => { if (title) { fieldSchema.title = title; field.title = title; field.componentProps.icon = icon; + field.componentProps.danger = type === 'danger'; + field.componentProps.type = type; fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {}; fieldSchema['x-component-props'].icon = icon; + fieldSchema['x-component-props'].danger = type === 'danger'; + fieldSchema['x-component-props'].type = type; dn.emit('patch', { schema: { ['x-uid']: fieldSchema['x-uid'],