@ascentgl/ads-ui 21.67.0 → 21.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4129,6 +4129,18 @@ class AdsSearchDropdownComponent extends AbstractDropdownComponent {
|
|
|
4129
4129
|
}, 0);
|
|
4130
4130
|
}
|
|
4131
4131
|
}
|
|
4132
|
+
/** @ignore - Detect value changes when setValue is called with emitEvent: false */
|
|
4133
|
+
ngDoCheck() {
|
|
4134
|
+
// Check if valueControl value has changed (handles emitEvent: false cases)
|
|
4135
|
+
const currentValue = this.valueControl?.value;
|
|
4136
|
+
if (currentValue !== this.previousValueControlValue) {
|
|
4137
|
+
this.previousValueControlValue = currentValue;
|
|
4138
|
+
// Only sync if not set internally and component is initialized
|
|
4139
|
+
if (!this.isInternalValueSet && this.valueControl) {
|
|
4140
|
+
this.controlValueToDisplayedControlValue();
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4132
4144
|
/** @ignore */
|
|
4133
4145
|
ngOnDestroy() {
|
|
4134
4146
|
if (this.unsubscribeFromScroll)
|
|
@@ -4572,11 +4584,27 @@ class AdsSearchDropdownComponent extends AbstractDropdownComponent {
|
|
|
4572
4584
|
*/
|
|
4573
4585
|
const displayedValue = this.valueControl.value
|
|
4574
4586
|
? this.getDisplayedValue(this.valueControl.value)
|
|
4575
|
-
:
|
|
4587
|
+
: null;
|
|
4576
4588
|
/**
|
|
4577
4589
|
* use it to build displayedControl value
|
|
4578
4590
|
*/
|
|
4579
|
-
this.displayControl.setValue(displayedValue ? { key: this.valueControl.value, value: displayedValue } :
|
|
4591
|
+
this.displayControl.setValue(displayedValue ? { key: this.valueControl.value, value: displayedValue } : null, { emitEvent: false });
|
|
4592
|
+
// When value is cleared, also clear the input element directly and reset state
|
|
4593
|
+
if (!this.valueControl.value) {
|
|
4594
|
+
this.hasSearched = false;
|
|
4595
|
+
this.previousControlValue = '';
|
|
4596
|
+
// Clear displayed options when value is cleared
|
|
4597
|
+
if (!this.staticOptions) {
|
|
4598
|
+
this.displayedOptions = new Map();
|
|
4599
|
+
this.allOptions = new Map();
|
|
4600
|
+
}
|
|
4601
|
+
// Directly clear the input element to ensure UI reflects the cleared state
|
|
4602
|
+
if (this.input?.nativeElement) {
|
|
4603
|
+
this.input.nativeElement.value = '';
|
|
4604
|
+
}
|
|
4605
|
+
}
|
|
4606
|
+
// Trigger change detection to update UI
|
|
4607
|
+
this.cdr.detectChanges();
|
|
4580
4608
|
// Trigger textarea resize after DOM updates to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
4581
4609
|
if (this.wrapOptionText && this.input?.nativeElement instanceof HTMLTextAreaElement) {
|
|
4582
4610
|
Promise.resolve().then(() => {
|