fix(amis): input-sub-form优先使用input-sub-form

This commit is contained in:
wibetter 2023-07-03 14:24:31 +08:00
parent 10ddff8199
commit eff7f8afb9
2 changed files with 17 additions and 10 deletions

View File

@ -13,7 +13,6 @@ import find from 'lodash/find';
import type {RendererConfig} from 'amis-core';
import type {MenuDivider, MenuItem} from 'amis-ui/lib/components/ContextMenu';
import type {BaseSchema, SchemaCollection} from 'amis';
import {DSFieldGroup} from './builder/DSBuilder';
/**
*

View File

@ -145,7 +145,7 @@ export default class SubFormControl extends React.PureComponent<
addButtonClassName: '',
itemClassName: '',
labelField: 'label',
btnLabel: 'SubForm.button',
defaultLabel: 'SubForm.button',
placeholder: 'placeholder.empty'
};
@ -397,6 +397,7 @@ export default class SubFormControl extends React.PureComponent<
disabled,
maxLength,
labelField,
defaultLabel,
value,
btnLabel,
render,
@ -434,10 +435,7 @@ export default class SubFormControl extends React.PureComponent<
) : null}
<span className={cx('SubForm-valueLabel')}>
{(item &&
labelField &&
item[labelField] &&
stripTag(item[labelField])) ||
{btnLabel &&
render(
'label',
{
@ -448,6 +446,12 @@ export default class SubFormControl extends React.PureComponent<
data: createObject(data, item)
}
)}
{!btnLabel &&
((item &&
labelField &&
item[labelField] &&
stripTag(item[labelField])) ||
defaultLabel)}
</span>
<a
data-index={key}
@ -514,6 +518,7 @@ export default class SubFormControl extends React.PureComponent<
disabled,
value,
labelField,
defaultLabel,
btnLabel,
render,
data,
@ -535,10 +540,7 @@ export default class SubFormControl extends React.PureComponent<
data-position="bottom"
>
<span className={cx('SubForm-valueLabel')}>
{(value &&
labelField &&
value[labelField] &&
stripTag(value[labelField])) ||
{btnLabel &&
render(
'label',
{
@ -549,6 +551,12 @@ export default class SubFormControl extends React.PureComponent<
data: createObject(data, value)
}
)}
{!btnLabel &&
((value &&
labelField &&
value[labelField] &&
stripTag(value[labelField])) ||
defaultLabel)}
</span>
<a className={cx('SubForm-valueEdit')}>
<Icon icon="pencil" className="icon" />