Merge remote-tracking branch 'amis/master'

This commit is contained in:
rickcole 2020-04-22 20:16:52 +08:00
commit 943c63f7e4
2 changed files with 18 additions and 6 deletions

View File

@ -435,7 +435,9 @@ const defaultOmitList = [
'disabled',
'disabledOn',
'component',
'detectField'
'detectField',
'required',
'requiredOn'
];
class SchemaRenderer extends React.Component<SchemaRendererProps, any> {

View File

@ -284,7 +284,9 @@ export class FormItemWrap extends React.Component<FormItemProps> {
>
<span>
{filter(label, data)}
{required ? <span className={cx(`Form-star`)}>*</span> : null}
{required && (label || labelRemark) ? (
<span className={cx(`Form-star`)}>*</span>
) : null}
{labelRemark
? render('label-remark', {
type: 'remark',
@ -387,7 +389,9 @@ export class FormItemWrap extends React.Component<FormItemProps> {
<label className={cx(`Form-label`, labelClassName)}>
<span>
{filter(label, data)}
{required ? <span className={cx(`Form-star`)}>*</span> : null}
{required && (label || labelRemark) ? (
<span className={cx(`Form-star`)}>*</span>
) : null}
{labelRemark
? render('label-remark', {
type: 'remark',
@ -480,7 +484,9 @@ export class FormItemWrap extends React.Component<FormItemProps> {
<label className={cx(`Form-label`, labelClassName)}>
<span>
{filter(label, data)}
{required ? <span className={cx(`Form-star`)}>*</span> : null}
{required && (label || labelRemark) ? (
<span className={cx(`Form-star`)}>*</span>
) : null}
{labelRemark
? render('label-remark', {
type: 'remark',
@ -579,7 +585,9 @@ export class FormItemWrap extends React.Component<FormItemProps> {
<label className={cx(`Form-label`, labelClassName)}>
<span>
{filter(label, data)}
{required ? <span className={cx(`Form-star`)}>*</span> : null}
{required && (label || labelRemark) ? (
<span className={cx(`Form-star`)}>*</span>
) : null}
{labelRemark
? render('label-remark', {
type: 'remark',
@ -854,7 +862,9 @@ export function asFormItem(config: Omit<FormItemConfig, 'component'>) {
{
'is-inline': !!rest.inline,
'is-error': model && !model.valid,
[`Form-control--withSize Form-control--size${ucFirst(controlSize)}`]:
[`Form-control--withSize Form-control--size${ucFirst(
controlSize
)}`]:
config.sizeMutable !== false &&
typeof controlSize === 'string' &&
!!controlSize &&