feat: add button color (#420)
This commit is contained in:
parent
17f33a58b3
commit
39c254a7db
@ -299,4 +299,7 @@ export default {
|
|||||||
'After successful update': 'After successful update',
|
'After successful update': 'After successful update',
|
||||||
'Save record': 'Save record',
|
'Save record': 'Save record',
|
||||||
'After successful save': 'After successful save',
|
'After successful save': 'After successful save',
|
||||||
|
'Button background color': 'Button background color',
|
||||||
|
'Highlight': 'Highlight',
|
||||||
|
'Danger red': 'Danger red'
|
||||||
}
|
}
|
||||||
|
@ -506,4 +506,7 @@ export default {
|
|||||||
'After successful save': '保存成功后',
|
'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 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.': '点击当前自定义按钮时,当前数据以下字段将按照以下表单保存。',
|
'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': '红色'
|
||||||
}
|
}
|
||||||
|
@ -79,16 +79,35 @@ export const ActionDesigner = (props) => {
|
|||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
// description: `原字段标题:${collectionField?.uiSchema?.title}`,
|
// 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
|
} as ISchema
|
||||||
}
|
}
|
||||||
onSubmit={({ title, icon }) => {
|
onSubmit={({ title, icon, type }) => {
|
||||||
if (title) {
|
if (title) {
|
||||||
fieldSchema.title = title;
|
fieldSchema.title = title;
|
||||||
field.title = title;
|
field.title = title;
|
||||||
field.componentProps.icon = icon;
|
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'] = fieldSchema['x-component-props'] || {};
|
||||||
fieldSchema['x-component-props'].icon = icon;
|
fieldSchema['x-component-props'].icon = icon;
|
||||||
|
fieldSchema['x-component-props'].danger = type === 'danger';
|
||||||
|
fieldSchema['x-component-props'].type = type;
|
||||||
dn.emit('patch', {
|
dn.emit('patch', {
|
||||||
schema: {
|
schema: {
|
||||||
['x-uid']: fieldSchema['x-uid'],
|
['x-uid']: fieldSchema['x-uid'],
|
||||||
|
Loading…
Reference in New Issue
Block a user