[ACS-4985] Removed disableUpdateOnSubmit flag from search widgets

This commit is contained in:
swapnil.verma
2023-07-27 11:14:48 +05:30
committed by Jatin_Chugh
parent 0b8a4d9f0f
commit 5574aef240
9 changed files with 15 additions and 54 deletions
@@ -48,7 +48,6 @@ export class SearchCheckListComponent implements SearchWidget, OnInit {
pageSize = 5;
isActive = false;
enableChangeUpdate = true;
disableUpdateOnSubmit: boolean;
displayValue$: Subject<string> = new Subject<string>();
constructor(private translationService: TranslationService) {
@@ -95,9 +94,7 @@ export class SearchCheckListComponent implements SearchWidget, OnInit {
this.clearOptions();
if (this.id && this.context) {
this.updateDisplayValue();
if (!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
@@ -145,9 +142,7 @@ export class SearchCheckListComponent implements SearchWidget, OnInit {
if (this.id && this.context) {
this.context.queryFragments[this.id] = query;
this.updateDisplayValue();
if(!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
}
@@ -70,7 +70,6 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit, OnDestroy
isActive = false;
startValue: any;
enableChangeUpdate: boolean;
disableUpdateOnSubmit: boolean;
displayValue$: Subject<string> = new Subject<string>();
private onDestroy$ = new Subject<boolean>();
@@ -152,9 +151,7 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit, OnDestroy
this.context.queryFragments[this.id] = `${this.settings.field}:['${start}' TO '${end}']`;
this.updateDisplayValue();
if(!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
@@ -217,9 +214,7 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit, OnDestroy
private updateQuery() {
if (this.id && this.context) {
this.updateDisplayValue();
if (!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
@@ -65,7 +65,6 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
isActive = false;
startValue: any;
enableChangeUpdate: boolean;
disableUpdateOnSubmit: boolean;
displayValue$: Subject<string> = new Subject<string>();
private onDestroy$ = new Subject<boolean>();
@@ -139,9 +138,7 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
this.context.queryFragments[this.id] = `${this.settings.field}:['${start}' TO '${end}']`;
this.updateDisplayValue();
if(!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
@@ -205,9 +202,7 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
private updateQuery() {
if (this.id && this.context) {
this.updateDisplayValue();
if (!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
@@ -41,7 +41,6 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
id: string;
settings?: SearchWidgetSettings;
context?: SearchQueryBuilderService;
disableUpdateOnSubmit: boolean;
field: string;
format = '[{FROM} TO {TO}]';
@@ -99,9 +98,7 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
const value = this.formatString(this.format, map);
this.context.queryFragments[this.id] = `${this.field}:${value}`;
if (!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
@@ -161,10 +158,8 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
reset() {
this.clear();
if (!this.disableUpdateOnSubmit) {
if (this.id && this.context) {
this.context.update();
}
if (this.id && this.context) {
this.context.update();
}
}
}
@@ -50,7 +50,6 @@ export class SearchRadioComponent implements SearchWidget, OnInit {
isActive = false;
startValue: any;
enableChangeUpdate: boolean;
disableUpdateOnSubmit: boolean;
displayValue$: Subject<string> = new Subject<string>();
constructor() {
@@ -98,9 +97,7 @@ export class SearchRadioComponent implements SearchWidget, OnInit {
submitValues() {
this.setValue(this.value);
this.updateDisplayValue();
if(!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
hasValidValue() {
@@ -147,9 +144,7 @@ export class SearchRadioComponent implements SearchWidget, OnInit {
if (initialValue !== null) {
this.setValue(initialValue);
this.updateDisplayValue();
if (!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
}
@@ -41,7 +41,6 @@ export class SearchSliderComponent implements SearchWidget, OnInit {
max: number;
thumbLabel = false;
enableChangeUpdate: boolean;
disableUpdateOnSubmit: boolean;
displayValue$: Subject<string> = new Subject<string>();
/** The numeric value represented by the slider. */
@@ -91,9 +90,7 @@ export class SearchSliderComponent implements SearchWidget, OnInit {
}
submitValues() {
if(!this.disableUpdateOnSubmit) {
this.updateQuery(this.value);
}
this.updateQuery(this.value);
}
hasValidValue() {
@@ -117,9 +114,7 @@ export class SearchSliderComponent implements SearchWidget, OnInit {
} else {
this.context.queryFragments[this.id] = `${this.settings.field}:[0 TO ${value}]`;
}
if (!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
@@ -40,7 +40,6 @@ export class SearchTextComponent implements SearchWidget, OnInit {
startValue: string;
isActive = false;
enableChangeUpdate = true;
disableUpdateOnSubmit: boolean;
displayValue$: Subject<string> = new Subject<string>();
ngOnInit() {
@@ -87,16 +86,12 @@ export class SearchTextComponent implements SearchWidget, OnInit {
this.displayValue$.next(value);
if (this.context && this.settings && this.settings.field) {
this.context.queryFragments[this.id] = value ? `${this.settings.field}:'${this.getSearchPrefix()}${value}${this.getSearchSuffix()}'` : '';
if (!this.disableUpdateOnSubmit) {
this.context.update();
}
this.context.update();
}
}
submitValues() {
if(!this.disableUpdateOnSubmit) {
this.updateQuery(this.value);
}
this.updateQuery(this.value);
}
hasValidValue() {
@@ -57,8 +57,6 @@ export class SearchWidgetContainerComponent implements OnInit, OnDestroy, OnChan
@Input()
value: any;
@Input()
disableUpdateOnSubmit = false;
componentRef: ComponentRef<any>;
@@ -92,7 +90,6 @@ export class SearchWidgetContainerComponent implements OnInit, OnDestroy, OnChan
ref.instance.id = this.id;
ref.instance.settings = {...this.settings};
ref.instance.context = this.queryBuilder;
ref.instance.disableUpdateOnSubmit = this.disableUpdateOnSubmit;
if (this.value) {
ref.instance.isActive = true;
ref.instance.startValue = this.value;
@@ -25,7 +25,6 @@ export interface SearchWidget {
settings?: SearchWidgetSettings;
context?: SearchQueryBuilderService;
isActive?: boolean;
disableUpdateOnSubmit?: boolean;
startValue: any;
/* stream emit value on changes */
displayValue$: Subject<string>;