mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:08:55 +08:00
fix: 修改禁用和隐藏的schema配置面板不实时更新 (#7690)
* fix: 修改禁用和隐藏的schema配置面板不实时更新 * perf: 配置面板form增加labelAlign配置 * fix: 修改禁用和隐藏的schema配置面板不实时更新 * fix: card&picker&formItem面板配置问题修复 --------- Co-authored-by: huangying11 <huangying11@baidu.com>
This commit is contained in:
parent
654baa846e
commit
2b9bcdf894
@ -130,6 +130,11 @@ export class CardPlugin extends BasePlugin {
|
||||
label: '图片地址',
|
||||
description: '支持模板语法如: <code>\\${xxx}</code>'
|
||||
},
|
||||
{
|
||||
name: 'href',
|
||||
type: 'input-text',
|
||||
label: '打开外部链接'
|
||||
},
|
||||
getSchemaTpl('cardDesc'),
|
||||
{
|
||||
name: 'header.highlight',
|
||||
|
@ -106,11 +106,6 @@ export class CardsPlugin extends BasePlugin {
|
||||
type: 'divider'
|
||||
},
|
||||
getSchemaTpl('title'),
|
||||
{
|
||||
name: 'href',
|
||||
type: 'input-text',
|
||||
label: '打开外部链接'
|
||||
},
|
||||
|
||||
isCRUDBody
|
||||
? null
|
||||
|
@ -873,6 +873,25 @@ export class FormPlugin extends BasePlugin {
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
name: 'labelAlign',
|
||||
label: '标签对齐方式',
|
||||
type: 'button-group-select',
|
||||
size: 'sm',
|
||||
visibleOn: "${mode === 'horizontal'}",
|
||||
pipeIn: defaultValue('right', false),
|
||||
options: [
|
||||
{
|
||||
label: '左对齐',
|
||||
value: 'left'
|
||||
},
|
||||
{
|
||||
label: '右对齐',
|
||||
value: 'right'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
getSchemaTpl('horizontal', {
|
||||
visibleOn: 'this.mode == "horizontal"'
|
||||
}),
|
||||
|
@ -105,16 +105,7 @@ export class ItemPlugin extends BasePlugin {
|
||||
label: '只读模式'
|
||||
})
|
||||
: null,
|
||||
getSchemaTpl('switch', {
|
||||
name: 'disabled',
|
||||
label: '禁用',
|
||||
mode: 'horizontal',
|
||||
horizontal: {
|
||||
justify: true,
|
||||
left: 8
|
||||
},
|
||||
inputClassName: 'is-inline '
|
||||
}),
|
||||
getSchemaTpl('disabled'),
|
||||
ignoreValidator ? null : getSchemaTpl('required'),
|
||||
getSchemaTpl('description'),
|
||||
getSchemaTpl('placeholder'),
|
||||
@ -173,8 +164,6 @@ export class ItemPlugin extends BasePlugin {
|
||||
{
|
||||
title: '显隐',
|
||||
body: [
|
||||
// TODO: 有些表单项没有 disabled
|
||||
getSchemaTpl('disabled'),
|
||||
getSchemaTpl('visible'),
|
||||
supportStatic ? getSchemaTpl('static') : null,
|
||||
getSchemaTpl('switch', {
|
||||
|
@ -189,9 +189,6 @@ export class PickerControlPlugin extends BasePlugin {
|
||||
|
||||
getSchemaTpl('strictMode'),
|
||||
getSchemaTpl('multiple'),
|
||||
getSchemaTpl('joinValues'),
|
||||
getSchemaTpl('delimiter'),
|
||||
getSchemaTpl('extractValue'),
|
||||
getSchemaTpl('autoFillApi', {
|
||||
visibleOn:
|
||||
'!this.autoFill || this.autoFill.scene && this.autoFill.action'
|
||||
|
@ -93,13 +93,25 @@ export class StatusControl extends React.Component<
|
||||
@autobind
|
||||
handleSwitch(value: boolean) {
|
||||
const {trueValue, falseValue} = this.props;
|
||||
const {expression, statusType = 1} = this.state.formData || {};
|
||||
this.setState({checked: value == trueValue ? true : false}, () => {
|
||||
const {onBulkChange, noBulkChange, onDataChange, expressionName, name} =
|
||||
this.props;
|
||||
const newData = {
|
||||
[name]: value == trueValue ? trueValue : falseValue,
|
||||
|
||||
const newData: Record<string, any> = {
|
||||
[name]: value == falseValue ? falseValue : undefined,
|
||||
[expressionName]: undefined
|
||||
};
|
||||
if (value == trueValue) {
|
||||
switch (statusType) {
|
||||
case 1:
|
||||
newData[name] = trueValue;
|
||||
break;
|
||||
case 2:
|
||||
newData[expressionName] = expression;
|
||||
break;
|
||||
}
|
||||
}
|
||||
!noBulkChange && onBulkChange && onBulkChange(newData);
|
||||
onDataChange && onDataChange(newData);
|
||||
});
|
||||
|
@ -564,7 +564,7 @@
|
||||
}
|
||||
}
|
||||
.#{$ns}TransferDropDown-content {
|
||||
min-width: px2rem(400px);
|
||||
min-width: px2rem(40px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: var(--gap-xs) 0;
|
||||
|
Loading…
Reference in New Issue
Block a user