mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-01 11:38:03 +08:00
fix: 测试:【组件优化第五批】穿梭框表格形式下添加表格行只对表格下的最后一行为空进行校验; amis-saas-7219
Change-Id: Ia0580c95853e98bc1776bd927a49cde455773b18
This commit is contained in:
parent
53f9805b81
commit
c9d53b9a85
@ -285,13 +285,15 @@ function BaseOptionControl(Cmpt: React.JSXElementConstructor<any>) {
|
||||
const renderInput = (
|
||||
name: string,
|
||||
placeholder: string,
|
||||
required: boolean = true
|
||||
required: boolean = true,
|
||||
unique: Boolean = false
|
||||
) => {
|
||||
return {
|
||||
type: 'input-text',
|
||||
name,
|
||||
placeholder: placeholder,
|
||||
required
|
||||
required,
|
||||
unique
|
||||
};
|
||||
};
|
||||
|
||||
@ -412,17 +414,24 @@ export default class TransferTableOption extends React.Component<
|
||||
this.handleChange(args[2].options, 'options'),
|
||||
body: [
|
||||
{
|
||||
name: 'options',
|
||||
type: 'combo',
|
||||
multiple: true,
|
||||
draggable: true,
|
||||
addButtonText: '新增',
|
||||
value: options,
|
||||
items: [
|
||||
...columns.map((item: Option) =>
|
||||
renderInput(item.name, item.label ?? '')
|
||||
),
|
||||
renderInput('value', '值', true)
|
||||
type: 'form',
|
||||
wrapWithPanel: false,
|
||||
mode: 'normal',
|
||||
body: [
|
||||
{
|
||||
name: 'options',
|
||||
type: 'combo',
|
||||
multiple: true,
|
||||
draggable: true,
|
||||
addButtonText: '新增',
|
||||
value: options,
|
||||
items: [
|
||||
...columns.map((item: Option) =>
|
||||
renderInput(item.name, item.label ?? '', true)
|
||||
),
|
||||
renderInput('value', '值', true, true)
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -437,6 +446,19 @@ export default class TransferTableOption extends React.Component<
|
||||
const {data} = this.props;
|
||||
const {onBulkChange, onValueChange} = this.props;
|
||||
data[type] = value;
|
||||
if (type === 'columns') {
|
||||
const keys = value.map(item => item.name);
|
||||
data.options = data.options.map((item: Option) => {
|
||||
const obj = {
|
||||
...keys.reduce((pv, cv, idx) => {
|
||||
pv[cv] = item[cv];
|
||||
return pv;
|
||||
},
|
||||
{value: item.value})
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
}
|
||||
onValueChange && onValueChange(type, data, onBulkChange);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user