Use disabled instead of canEditInput in dynamic input

This commit is contained in:
Adina Țeudan 2023-10-19 21:58:09 +03:00
parent df01d0a910
commit bfaae5adf6
2 changed files with 6 additions and 11 deletions

View File

@ -5,10 +5,9 @@
<input
(ngModelChange)="onChange($event)"
[(ngModel)]="input"
[disabled]="!canEditInput"
[disabled]="disabled"
[id]="id"
[matDatepicker]="picker"
[name]="name"
[placeholder]="placeholder || 'dd/mm/yy'"
iqserStopPropagation
/>
@ -22,9 +21,8 @@
(ngModelChange)="onChange($event)"
*ngIf="isText"
[(ngModel)]="input"
[disabled]="!canEditInput"
[disabled]="disabled"
[id]="id"
[name]="name"
[placeholder]="placeholder || ''"
iqserStopPropagation
type="text"
@ -34,9 +32,8 @@
(ngModelChange)="onChange($event)"
*ngIf="isNumber"
[(ngModel)]="input"
[disabled]="!canEditInput"
[disabled]="disabled"
[id]="id"
[name]="name"
iqserStopPropagation
type="number"
/>

View File

@ -19,7 +19,7 @@ export type InputType = keyof typeof InputTypes;
type DynamicInput = number | string | Date;
@Component({
selector: 'iqser-dynamic-input [type]',
selector: 'iqser-dynamic-input',
templateUrl: './dynamic-input.component.html',
styleUrls: ['./dynamic-input.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
@ -40,13 +40,11 @@ type DynamicInput = number | string | Date;
})
export class DynamicInputComponent extends FormFieldComponent<DynamicInput> {
@Input() label?: string;
@Input() type!: InputType;
@Input({ required: true }) type!: InputType;
@Input() placeholder?: string;
@Input() id?: string;
@Input() name?: string;
@Input() classList?: string = '';
@Input() classList = '';
@Input() input!: DynamicInput;
@Input() canEditInput = true;
@Output() readonly closedDatepicker = new EventEmitter<boolean>();
get isDate() {