RED-6973: Fixed enter not submitting the form.
This commit is contained in:
parent
45a36b8fb3
commit
7a8fb389b7
@ -40,7 +40,7 @@
|
||||
|
||||
<ng-template #input>
|
||||
<div [ngClass]="{ 'workflow-edit-input': mode === 'workflow' }" class="edit-input" iqserStopPropagation>
|
||||
<form [formGroup]="form">
|
||||
<form (ngSubmit)="form.valid && save()" [formGroup]="form">
|
||||
<iqser-dynamic-input
|
||||
(closedDatepicker)="closedDatepicker = $event"
|
||||
(keydown.escape)="close()"
|
||||
|
||||
@ -145,16 +145,20 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
|
||||
const fileAttributes = this.file.fileAttributes.attributeIdToValue;
|
||||
Object.keys(fileAttributes).forEach(key => {
|
||||
const attrValue = fileAttributes[key];
|
||||
config[key] = [
|
||||
dayjs(attrValue, 'YYYY-MM-DD', true).isValid() ? dayjs(attrValue).toDate() : attrValue,
|
||||
Validators.pattern(/^(\s+\S+\s*)*(?!\s).*$/),
|
||||
];
|
||||
config[key] = [dayjs(attrValue, 'YYYY-MM-DD', true).isValid() ? dayjs(attrValue).toDate() : attrValue];
|
||||
});
|
||||
return this._formBuilder.group(config, {
|
||||
validators: control =>
|
||||
control.get(this.fileAttribute.id).value &&
|
||||
!control.get(this.fileAttribute.id).value.trim().length &&
|
||||
!this.fileAttributeValue
|
||||
? { emptyString: true }
|
||||
: null,
|
||||
});
|
||||
return this._formBuilder.group(config);
|
||||
}
|
||||
|
||||
#formatAttributeValue(attrValue) {
|
||||
return this.isDate ? attrValue && dayjs(attrValue).format('YYYY-MM-DD') : attrValue.replaceAll(/\s\s+/g, ' ');
|
||||
return this.isDate ? attrValue && dayjs(attrValue).format('YYYY-MM-DD') : attrValue.trim().replaceAll(/\s\s+/g, ' ');
|
||||
}
|
||||
|
||||
#toggleEdit(): void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user