input with action mark for check on reset
This commit is contained in:
parent
c16328aa38
commit
f7d8b556d3
@ -1,4 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'iqser-input-with-action',
|
selector: 'iqser-input-with-action',
|
||||||
@ -16,6 +16,8 @@ export class InputWithActionComponent {
|
|||||||
@Output() readonly action = new EventEmitter<string>();
|
@Output() readonly action = new EventEmitter<string>();
|
||||||
@Output() readonly valueChange = new EventEmitter<string>();
|
@Output() readonly valueChange = new EventEmitter<string>();
|
||||||
|
|
||||||
|
constructor(private readonly _changeDetectorRef: ChangeDetectorRef) {}
|
||||||
|
|
||||||
get hasContent(): boolean {
|
get hasContent(): boolean {
|
||||||
return !!this.value?.length;
|
return !!this.value?.length;
|
||||||
}
|
}
|
||||||
@ -24,13 +26,14 @@ export class InputWithActionComponent {
|
|||||||
return this.width === 'full' ? '100%' : `${this.width}px`;
|
return this.width === 'full' ? '100%' : `${this.width}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isSearch(): boolean {
|
||||||
|
return this.action.observers.length === 0;
|
||||||
|
}
|
||||||
|
|
||||||
reset(): void {
|
reset(): void {
|
||||||
this.value = '';
|
this.value = '';
|
||||||
this.valueChange.emit(this.value);
|
this.valueChange.emit(this.value);
|
||||||
}
|
this._changeDetectorRef.markForCheck();
|
||||||
|
|
||||||
get isSearch(): boolean {
|
|
||||||
return this.action.observers.length === 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
executeAction($event: MouseEvent): void {
|
executeAction($event: MouseEvent): void {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user