Editable input updates

This commit is contained in:
Adina Țeudan 2021-08-15 20:03:36 +03:00
parent 89376a6554
commit 0bb0e4454f
2 changed files with 7 additions and 4 deletions

View File

@ -1,10 +1,10 @@
<div *ngIf="!editing">
<div *ngIf="showPreview && !editing">
{{ value }}
</div>
<form (submit)="saveValue()" *ngIf="editing">
<div [class]="'red-input-group ' + class">
<input [(ngModel)]="newValue" name="name" />
<input [(ngModel)]="newValue" [placeholder]="placeholder" name="name" />
</div>
</form>

View File

@ -1,18 +1,21 @@
import { Component, EventEmitter, HostBinding, Input, Output } from '@angular/core';
import { ChangeDetectionStrategy, Component, EventEmitter, HostBinding, Input, Output } from '@angular/core';
import { Required } from '../../utils/decorators/required.decorator';
import { CircleButtonType } from '../../buttons/circle-button/circle-button.type';
@Component({
selector: 'iqser-editable-input',
templateUrl: './editable-input.component.html',
styleUrls: ['./editable-input.component.scss']
styleUrls: ['./editable-input.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class EditableInputComponent {
@Input() @Required() value!: string;
@Input() editTooltip?: string;
@Input() saveTooltip?: string;
@Input() cancelTooltip?: string;
@Input() placeholder?: string;
@Input() class?: string;
@Input() showPreview = true;
@Input() buttonsType?: CircleButtonType;
@Output() save = new EventEmitter<string>();
newValue = '';