herum-shared 0.1.36 → 0.1.37
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.
|
@@ -1731,28 +1731,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
|
|
|
1731
1731
|
type: Input
|
|
1732
1732
|
}] } });
|
|
1733
1733
|
|
|
1734
|
-
class HerumFormControl extends FormControl {
|
|
1735
|
-
errorMessages = {};
|
|
1736
|
-
currentErrorMessage = '';
|
|
1737
|
-
destroySubject$ = new Subject();
|
|
1738
|
-
/**
|
|
1739
|
-
@comment The component that creates this class should have destroySubject$ so you can listen to its ngOnDestroy life cycle hook so you can unsubscribe statusChangesSubscription
|
|
1740
|
-
*/
|
|
1741
|
-
constructor(formState, validatorOrOpts, asyncValidator, errorMessages, componentReference) {
|
|
1742
|
-
super(formState, validatorOrOpts, asyncValidator);
|
|
1743
|
-
if (errorMessages)
|
|
1744
|
-
this.errorMessages = errorMessages;
|
|
1745
|
-
this.statusChanges.pipe(takeUntil(this.destroySubject$)).subscribe(() => this.setCurrentErrorMessage());
|
|
1746
|
-
componentReference.destroySubject$.pipe(takeUntil(this.destroySubject$)).subscribe(() => {
|
|
1747
|
-
this.destroySubject$.next(null);
|
|
1748
|
-
this.destroySubject$.complete();
|
|
1749
|
-
});
|
|
1750
|
-
}
|
|
1751
|
-
setCurrentErrorMessage() {
|
|
1752
|
-
this.currentErrorMessage = this.errors ? this.errorMessages[Object.keys(this.errors)[0]] : null;
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
1734
|
const emptyNumberInputValue = '0';
|
|
1757
1735
|
const numericTextType = 'numeric-text';
|
|
1758
1736
|
class HerumInputFieldComponent {
|
|
@@ -1823,12 +1801,9 @@ class HerumInputFieldComponent {
|
|
|
1823
1801
|
if (this.ngControl instanceof FormControlName)
|
|
1824
1802
|
this.formControlName = this.ngControl.name?.toString() || '';
|
|
1825
1803
|
this.ngControl.control.statusChanges.pipe(takeUntil(this.destroySubject$)).subscribe(status => {
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
console.log(this.ngControl.control.constructor.name === HerumFormControl.prototype.constructor.name);
|
|
1830
|
-
if (this.ngControl.control instanceof HerumFormControl)
|
|
1831
|
-
this.errorMsg = this.ngControl.control.currentErrorMessage;
|
|
1804
|
+
const controlWithErrorMessage = this.ngControl.control;
|
|
1805
|
+
if (!!controlWithErrorMessage.currentErrorMessage)
|
|
1806
|
+
this.errorMsg = controlWithErrorMessage.currentErrorMessage;
|
|
1832
1807
|
const controlStatus = this.ngControl.control.status;
|
|
1833
1808
|
this.isValid = controlStatus === formStatuses.valid;
|
|
1834
1809
|
this.isLoading = controlStatus === formStatuses.pending;
|
|
@@ -9670,6 +9645,28 @@ const openClose = trigger('openClose', [
|
|
|
9670
9645
|
])
|
|
9671
9646
|
]);
|
|
9672
9647
|
|
|
9648
|
+
class HerumFormControl extends FormControl {
|
|
9649
|
+
errorMessages = {};
|
|
9650
|
+
currentErrorMessage = '';
|
|
9651
|
+
destroySubject$ = new Subject();
|
|
9652
|
+
/**
|
|
9653
|
+
@comment The component that creates this class should have destroySubject$ so you can listen to its ngOnDestroy life cycle hook so you can unsubscribe statusChangesSubscription
|
|
9654
|
+
*/
|
|
9655
|
+
constructor(formState, validatorOrOpts, asyncValidator, errorMessages, componentReference) {
|
|
9656
|
+
super(formState, validatorOrOpts, asyncValidator);
|
|
9657
|
+
if (errorMessages)
|
|
9658
|
+
this.errorMessages = errorMessages;
|
|
9659
|
+
this.statusChanges.pipe(takeUntil(this.destroySubject$)).subscribe(() => this.setCurrentErrorMessage());
|
|
9660
|
+
componentReference.destroySubject$.pipe(takeUntil(this.destroySubject$)).subscribe(() => {
|
|
9661
|
+
this.destroySubject$.next(null);
|
|
9662
|
+
this.destroySubject$.complete();
|
|
9663
|
+
});
|
|
9664
|
+
}
|
|
9665
|
+
setCurrentErrorMessage() {
|
|
9666
|
+
this.currentErrorMessage = this.errors ? this.errorMessages[Object.keys(this.errors)[0]] : null;
|
|
9667
|
+
}
|
|
9668
|
+
}
|
|
9669
|
+
|
|
9673
9670
|
const suffixStorageKey = 'FETCHED_MESSAGE_HAS_SHOWN';
|
|
9674
9671
|
class FetchedMessageService {
|
|
9675
9672
|
http;
|