mn-angular-lib 2.0.1 → 2.0.2
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.
|
@@ -335,6 +335,15 @@ class MnInputField {
|
|
|
335
335
|
this.ngControl.valueAccessor = this;
|
|
336
336
|
}
|
|
337
337
|
ngOnInit() {
|
|
338
|
+
// `showError` reads the control's touched/dirty/invalid state straight off the form.
|
|
339
|
+
// Those move from the forms API — `markAllAsTouched()` when the user tries to submit, a
|
|
340
|
+
// programmatic `setErrors` — never through an event on this component, so under OnPush
|
|
341
|
+
// the message would never appear. `events` covers value, status, touched and pristine.
|
|
342
|
+
const formControl = this.ngControl?.control;
|
|
343
|
+
if (formControl) {
|
|
344
|
+
const stateSub = formControl.events.subscribe(() => this.cdr.markForCheck());
|
|
345
|
+
this.destroyRef.onDestroy(() => stateSub.unsubscribe());
|
|
346
|
+
}
|
|
338
347
|
this.resolveConfig();
|
|
339
348
|
const sub = this.lang.locale$.pipe(skip(1)).subscribe(() => {
|
|
340
349
|
this.resolveConfig();
|
|
@@ -711,6 +720,15 @@ class MnCheckbox {
|
|
|
711
720
|
this.ngControl.valueAccessor = this;
|
|
712
721
|
}
|
|
713
722
|
ngOnInit() {
|
|
723
|
+
// `showError` reads the control's touched/dirty/invalid state straight off the form.
|
|
724
|
+
// Those move from the forms API — `markAllAsTouched()` when the user tries to submit, a
|
|
725
|
+
// programmatic `setErrors` — never through an event on this component, so under OnPush
|
|
726
|
+
// the message would never appear. `events` covers value, status, touched and pristine.
|
|
727
|
+
const formControl = this.ngControl?.control;
|
|
728
|
+
if (formControl) {
|
|
729
|
+
const stateSub = formControl.events.subscribe(() => this.cdr.markForCheck());
|
|
730
|
+
this.destroyRef.onDestroy(() => stateSub.unsubscribe());
|
|
731
|
+
}
|
|
714
732
|
this.resolveConfig();
|
|
715
733
|
const sub = this.lang.locale$.pipe(skip(1)).subscribe(() => {
|
|
716
734
|
this.resolveConfig();
|
|
@@ -959,6 +977,15 @@ class MnTextarea {
|
|
|
959
977
|
this.ngControl.valueAccessor = this;
|
|
960
978
|
}
|
|
961
979
|
ngOnInit() {
|
|
980
|
+
// `showError` reads the control's touched/dirty/invalid state straight off the form.
|
|
981
|
+
// Those move from the forms API — `markAllAsTouched()` when the user tries to submit, a
|
|
982
|
+
// programmatic `setErrors` — never through an event on this component, so under OnPush
|
|
983
|
+
// the message would never appear. `events` covers value, status, touched and pristine.
|
|
984
|
+
const formControl = this.ngControl?.control;
|
|
985
|
+
if (formControl) {
|
|
986
|
+
const stateSub = formControl.events.subscribe(() => this.cdr.markForCheck());
|
|
987
|
+
this.destroyRef.onDestroy(() => stateSub.unsubscribe());
|
|
988
|
+
}
|
|
962
989
|
this.resolveConfig();
|
|
963
990
|
const sub = this.lang.locale$.pipe(skip(1)).subscribe(() => {
|
|
964
991
|
this.resolveConfig();
|
|
@@ -1241,6 +1268,15 @@ class MnDatetime {
|
|
|
1241
1268
|
this.ngControl.valueAccessor = this;
|
|
1242
1269
|
}
|
|
1243
1270
|
ngOnInit() {
|
|
1271
|
+
// `showError` reads the control's touched/dirty/invalid state straight off the form.
|
|
1272
|
+
// Those move from the forms API — `markAllAsTouched()` when the user tries to submit, a
|
|
1273
|
+
// programmatic `setErrors` — never through an event on this component, so under OnPush
|
|
1274
|
+
// the message would never appear. `events` covers value, status, touched and pristine.
|
|
1275
|
+
const formControl = this.ngControl?.control;
|
|
1276
|
+
if (formControl) {
|
|
1277
|
+
const stateSub = formControl.events.subscribe(() => this.cdr.markForCheck());
|
|
1278
|
+
this.destroyRef.onDestroy(() => stateSub.unsubscribe());
|
|
1279
|
+
}
|
|
1244
1280
|
this.resolveConfig();
|
|
1245
1281
|
const sub = this.lang.locale$.pipe(skip(1)).subscribe(() => {
|
|
1246
1282
|
this.resolveConfig();
|
|
@@ -1685,6 +1721,15 @@ class MnFileInput {
|
|
|
1685
1721
|
return this.resolveControlError(this.pickErrorKey(errors), errors);
|
|
1686
1722
|
}
|
|
1687
1723
|
ngOnInit() {
|
|
1724
|
+
// `showError` reads the control's touched/dirty/invalid state straight off the form.
|
|
1725
|
+
// Those move from the forms API — `markAllAsTouched()` when the user tries to submit, a
|
|
1726
|
+
// programmatic `setErrors` — never through an event on this component, so under OnPush
|
|
1727
|
+
// the message would never appear. `events` covers value, status, touched and pristine.
|
|
1728
|
+
const formControl = this.ngControl?.control;
|
|
1729
|
+
if (formControl) {
|
|
1730
|
+
const stateSub = formControl.events.subscribe(() => this.cdr.markForCheck());
|
|
1731
|
+
this.destroyRef.onDestroy(() => stateSub.unsubscribe());
|
|
1732
|
+
}
|
|
1688
1733
|
this.resolveConfig();
|
|
1689
1734
|
const sub = this.lang.locale$.pipe(skip(1)).subscribe(() => {
|
|
1690
1735
|
this.resolveConfig();
|
|
@@ -2398,6 +2443,15 @@ class MnSelect {
|
|
|
2398
2443
|
}
|
|
2399
2444
|
// ========== Lifecycle ==========
|
|
2400
2445
|
ngOnInit() {
|
|
2446
|
+
// `showError` reads the control's touched/dirty/invalid state straight off the form.
|
|
2447
|
+
// Those move from the forms API — `markAllAsTouched()` when the user tries to submit, a
|
|
2448
|
+
// programmatic `setErrors` — never through an event on this component, so under OnPush
|
|
2449
|
+
// the message would never appear. `events` covers value, status, touched and pristine.
|
|
2450
|
+
const formControl = this.ngControl?.control;
|
|
2451
|
+
if (formControl) {
|
|
2452
|
+
const stateSub = formControl.events.subscribe(() => this.cdr.markForCheck());
|
|
2453
|
+
this.destroyRef.onDestroy(() => stateSub.unsubscribe());
|
|
2454
|
+
}
|
|
2401
2455
|
this.resolveConfig();
|
|
2402
2456
|
this.startWatchingViewport();
|
|
2403
2457
|
const sub = this.lang.locale$.pipe(skip(1)).subscribe(() => {
|
|
@@ -3095,6 +3149,15 @@ class MnMultiSelect {
|
|
|
3095
3149
|
this.sheetMediaListener = null;
|
|
3096
3150
|
}
|
|
3097
3151
|
ngOnInit() {
|
|
3152
|
+
// `showError` reads the control's touched/dirty/invalid state straight off the form.
|
|
3153
|
+
// Those move from the forms API — `markAllAsTouched()` when the user tries to submit, a
|
|
3154
|
+
// programmatic `setErrors` — never through an event on this component, so under OnPush
|
|
3155
|
+
// the message would never appear. `events` covers value, status, touched and pristine.
|
|
3156
|
+
const formControl = this.ngControl?.control;
|
|
3157
|
+
if (formControl) {
|
|
3158
|
+
const stateSub = formControl.events.subscribe(() => this.cdr.markForCheck());
|
|
3159
|
+
this.destroyRef.onDestroy(() => stateSub.unsubscribe());
|
|
3160
|
+
}
|
|
3098
3161
|
this.resolveConfig();
|
|
3099
3162
|
this.startWatchingViewport();
|
|
3100
3163
|
const sub = this.lang.locale$.pipe(skip(1)).subscribe(() => {
|