chrv-components 1.12.222 → 1.12.223
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.
|
Binary file
|
|
@@ -4311,6 +4311,7 @@ class ChrInputComponent {
|
|
|
4311
4311
|
// public valueChanges = output<any>();
|
|
4312
4312
|
/* CODE */
|
|
4313
4313
|
constructor() {
|
|
4314
|
+
this.destroyRef = inject(DestroyRef);
|
|
4314
4315
|
/**
|
|
4315
4316
|
* Label of the input
|
|
4316
4317
|
*/
|
|
@@ -4483,7 +4484,7 @@ class ChrInputComponent {
|
|
|
4483
4484
|
// The Behavior Subject always has an initial value. Which means that subscribing to it will make it look like the input has a new value (initially null).
|
|
4484
4485
|
// Which is false, because we're only instanciating the object. This is why we need to skip the first value. Otherwise the form will receive a random null when this
|
|
4485
4486
|
// observable is subscribed to and set the value to said null.
|
|
4486
|
-
skip(1), debounceTime$1(this.debounceTime()))
|
|
4487
|
+
takeUntilDestroyed(this.destroyRef), skip(1), debounceTime$1(this.debounceTime()))
|
|
4487
4488
|
.subscribe((res) => {
|
|
4488
4489
|
this.debouncedInput.emit(res);
|
|
4489
4490
|
// If the value is an empty string, set the value to null to trigger validation and prevent an inconsitent value to be set (ex: for number type input)
|
|
@@ -4504,15 +4505,17 @@ class ChrInputComponent {
|
|
|
4504
4505
|
this.isFocused.set(true);
|
|
4505
4506
|
});
|
|
4506
4507
|
this.ngControl()
|
|
4507
|
-
?.control?.events.pipe(filter((e) => e instanceof TouchedChangeEvent), map((e) => e.touched),
|
|
4508
|
+
?.control?.events.pipe(takeUntilDestroyed(this.destroyRef), filter((e) => e instanceof TouchedChangeEvent), map((e) => e.touched),
|
|
4508
4509
|
// Start with will inject a starting value, it MUST be used after eventual transformation (here Event -> boolean)
|
|
4509
4510
|
// and contain the type of the final data
|
|
4510
4511
|
startWith(this.ngControl()?.control?.touched ?? false))
|
|
4511
4512
|
.subscribe((e) => this.isTouched.set(e));
|
|
4512
4513
|
this.ngControl()
|
|
4513
|
-
?.control?.events.pipe(filter((e) => e instanceof StatusChangeEvent), map((e) => e.status === 'DISABLED'), startWith(this.ngControl()?.control?.disabled ?? false))
|
|
4514
|
+
?.control?.events.pipe(takeUntilDestroyed(this.destroyRef), filter((e) => e instanceof StatusChangeEvent), map((e) => e.status === 'DISABLED'), startWith(this.ngControl()?.control?.disabled ?? false))
|
|
4514
4515
|
.subscribe((e) => this.isDisabled.set(e));
|
|
4515
|
-
this.ngControl()
|
|
4516
|
+
this.ngControl()
|
|
4517
|
+
?.statusChanges?.pipe(takeUntilDestroyed(this.destroyRef))
|
|
4518
|
+
.subscribe((data) => {
|
|
4516
4519
|
this.ensureState(data);
|
|
4517
4520
|
});
|
|
4518
4521
|
this.displayValue.subscribe((v) => {
|