ngx-render-material-forms 1.3.4 → 1.3.6

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.
@@ -513,7 +513,12 @@ class MaterialTextfieldComponent extends MaterialComponent {
513
513
  this.controlHasError = this.control.hasError(msg.context.validator);
514
514
  }
515
515
  if (msg.context && this.controlHasError) {
516
- return this.instance.error.message;
516
+ if (this.instance && this.instance.parent && this.instance.parent.submission && this.instance.parent.submission.data) {
517
+ if (this.instance.parent.submission.data.submit) {
518
+ this.control.markAllAsTouched();
519
+ }
520
+ }
521
+ return this.instance.error ? this.instance.error.message : '';
517
522
  }
518
523
  }
519
524
  }
@@ -1056,6 +1061,16 @@ class MaterialTextareaComponent extends MaterialComponent {
1056
1061
  // Attach the element so the wysiwyg will work.
1057
1062
  this.instance.attachElement(this.textarea.nativeElement);
1058
1063
  }
1064
+ getErrorMessage() {
1065
+ // Check if instance and necessary properties exist
1066
+ if (this.instance && this.instance.parent && this.instance.parent.submission && this.instance.parent.submission.data) {
1067
+ if (this.instance.parent.submission.data.submit) {
1068
+ this.control.markAllAsTouched();
1069
+ }
1070
+ }
1071
+ // Return the error message if it exists
1072
+ return this.instance.error ? this.instance.error.message : '';
1073
+ }
1059
1074
  getValue() {
1060
1075
  return isNil(this.control.value) ? '' : this.control.value;
1061
1076
  }
@@ -1082,7 +1097,7 @@ MaterialTextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
1082
1097
  >
1083
1098
  </textarea>
1084
1099
  <span *ngIf="instance.component.suffix" matSuffix>{{ instance.component.suffix }}</span>
1085
- <mat-error *ngIf="instance.error">{{ instance.error.message }}</mat-error>
1100
+ <mat-error *ngIf="instance.error">{{ getErrorMessage() }}</mat-error>
1086
1101
  </mat-form-field>
1087
1102
  </ng-template>
1088
1103
  `, isInline: true, styles: [".mat-input-element{min-height:16px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i5.FlexFillDirective, selector: "[fxFill], [fxFlexFill]" }, { kind: "directive", type: i5.DefaultFlexAlignDirective, selector: " [fxFlexAlign], [fxFlexAlign.xs], [fxFlexAlign.sm], [fxFlexAlign.md], [fxFlexAlign.lg], [fxFlexAlign.xl], [fxFlexAlign.lt-sm], [fxFlexAlign.lt-md], [fxFlexAlign.lt-lg], [fxFlexAlign.lt-xl], [fxFlexAlign.gt-xs], [fxFlexAlign.gt-sm], [fxFlexAlign.gt-md], [fxFlexAlign.gt-lg]", inputs: ["fxFlexAlign", "fxFlexAlign.xs", "fxFlexAlign.sm", "fxFlexAlign.md", "fxFlexAlign.lg", "fxFlexAlign.xl", "fxFlexAlign.lt-sm", "fxFlexAlign.lt-md", "fxFlexAlign.lt-lg", "fxFlexAlign.lt-xl", "fxFlexAlign.gt-xs", "fxFlexAlign.gt-sm", "fxFlexAlign.gt-md", "fxFlexAlign.gt-lg"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "component", type: FormioFormFieldComponent, selector: "mat-formio-form-field", inputs: ["labelTemplate", "renderTopLabel", "showDescription", "renderElementOnly", "instance", "componentTemplate"] }, { kind: "component", type: LabelComponent, selector: "span[matFormioLabel]", inputs: ["instance"] }] });
@@ -1109,7 +1124,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
1109
1124
  >
1110
1125
  </textarea>
1111
1126
  <span *ngIf="instance.component.suffix" matSuffix>{{ instance.component.suffix }}</span>
1112
- <mat-error *ngIf="instance.error">{{ instance.error.message }}</mat-error>
1127
+ <mat-error *ngIf="instance.error">{{ getErrorMessage() }}</mat-error>
1113
1128
  </mat-form-field>
1114
1129
  </ng-template>
1115
1130
  `, styles: [".mat-input-element{min-height:16px}\n"] }]