tin-spa 2.1.0 → 2.1.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.
Files changed (29) hide show
  1. package/esm2020/lib/classes/Classes.mjs +1 -1
  2. package/esm2020/lib/classes/TinCore.mjs +80 -1
  3. package/esm2020/lib/components/date/date.component.mjs +35 -17
  4. package/esm2020/lib/components/form/form.component.mjs +88 -44
  5. package/esm2020/lib/components/money/money.component.mjs +60 -16
  6. package/esm2020/lib/components/number/number.component.mjs +22 -6
  7. package/esm2020/lib/components/roles/roles.component.mjs +3 -3
  8. package/esm2020/lib/components/table/detailsDialog.component.mjs +20 -32
  9. package/esm2020/lib/components/table/table.component.mjs +21 -12
  10. package/esm2020/lib/components/text/text.component.mjs +7 -4
  11. package/esm2020/lib/modules/spa-admin.module.mjs +5 -7
  12. package/esm2020/lib/modules/spa-index.module.mjs +5 -7
  13. package/esm2020/lib/modules/spa-user.module.mjs +5 -7
  14. package/fesm2015/tin-spa.mjs +325 -134
  15. package/fesm2015/tin-spa.mjs.map +1 -1
  16. package/fesm2020/tin-spa.mjs +324 -134
  17. package/fesm2020/tin-spa.mjs.map +1 -1
  18. package/lib/classes/Classes.d.ts +14 -2
  19. package/lib/classes/TinCore.d.ts +6 -0
  20. package/lib/components/date/date.component.d.ts +9 -5
  21. package/lib/components/form/form.component.d.ts +16 -9
  22. package/lib/components/money/money.component.d.ts +15 -7
  23. package/lib/components/number/number.component.d.ts +3 -1
  24. package/lib/components/table/detailsDialog.component.d.ts +0 -2
  25. package/lib/components/text/text.component.d.ts +1 -1
  26. package/lib/modules/spa-admin.module.d.ts +1 -1
  27. package/lib/modules/spa-index.module.d.ts +1 -1
  28. package/lib/modules/spa-user.module.d.ts +1 -1
  29. package/package.json +1 -1
@@ -196,6 +196,85 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
196
196
  }], ctorParameters: function () { return []; } });
197
197
 
198
198
  class Core {
199
+ static camelToWords(value) {
200
+ if (!value)
201
+ return value;
202
+ if (typeof value !== 'string')
203
+ return value;
204
+ if (value.length == 0)
205
+ return value;
206
+ let v = value.charAt(0).toUpperCase() + value.substring(1);
207
+ return v.replace(/([A-Z]+)*([A-Z][a-z])/g, "$1 $2");
208
+ }
209
+ static generateObject(fields) {
210
+ let data = {};
211
+ fields.forEach(field => {
212
+ if (field.type != 'section' && field.type != 'blank') {
213
+ data[field.name] = this.getInitialValue(field);
214
+ }
215
+ });
216
+ return data;
217
+ }
218
+ static resetObject(fields, data) {
219
+ fields.forEach(field => {
220
+ if (field.type != 'section' && field.type != 'blank') {
221
+ data[field.name] = this.getInitialValue(field);
222
+ }
223
+ });
224
+ }
225
+ static validateObject(fields, data) {
226
+ console.log("Validations");
227
+ for (let field of fields) {
228
+ let name = this.camelToWords(field.name);
229
+ let d = data[field.name];
230
+ console.log(name);
231
+ if (field.required) {
232
+ if (!d)
233
+ return `${name} is required`;
234
+ if (field.type == 'text') {
235
+ if (d == '')
236
+ return `Please enter ${name}`;
237
+ if (field.min && d.length < field.min)
238
+ return `Minimum ${name} length is ${field.min}`;
239
+ if (field.max && d.length > field.max)
240
+ return `Maximum ${name} length is ${field.max}`;
241
+ }
242
+ else if (field.type == 'number' || field.type == 'money' || field.type == 'date') {
243
+ if (field.min && d < field.min)
244
+ return `Minimum ${name} is ${field.min}`;
245
+ if (field.max && d > field.max)
246
+ return `Maximum ${name} is ${field.max}`;
247
+ }
248
+ else if (field.type == 'select') {
249
+ if (d == '')
250
+ return `Please select ${name}`;
251
+ }
252
+ }
253
+ }
254
+ ;
255
+ return '';
256
+ }
257
+ static getInitialValue(field) {
258
+ if (field.defaultValue) {
259
+ return field.defaultValue;
260
+ }
261
+ switch (field.type) {
262
+ case 'text':
263
+ return '';
264
+ case 'money':
265
+ return 0;
266
+ case 'number':
267
+ return 0;
268
+ case 'date':
269
+ return '';
270
+ case 'checkbox':
271
+ return false;
272
+ case 'select':
273
+ return null;
274
+ default:
275
+ return null;
276
+ }
277
+ }
199
278
  static getClone(x) {
200
279
  return JSON.parse(JSON.stringify(x));
201
280
  }
@@ -1026,7 +1105,7 @@ class TextComponent {
1026
1105
  this.type = "";
1027
1106
  this.leave = new EventEmitter();
1028
1107
  this.enterPress = new EventEmitter();
1029
- this.rows = "";
1108
+ this.rows = 1;
1030
1109
  this.width = "100%";
1031
1110
  //Autocomplete items
1032
1111
  this.options = [];
@@ -1041,6 +1120,9 @@ class TextComponent {
1041
1120
  this.control = new FormControl(this.value, [Validators.required, Validators.minLength(this.min), Validators.maxLength(this.max), Validators.pattern(this.regex)]);
1042
1121
  }
1043
1122
  ngOnInit() {
1123
+ if (!this.options) {
1124
+ this.options = [];
1125
+ }
1044
1126
  if (this.options.length > 0) {
1045
1127
  this.initFilter();
1046
1128
  }
@@ -1121,10 +1203,10 @@ class TextComponent {
1121
1203
  }
1122
1204
  }
1123
1205
  TextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1124
- TextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TextComponent, selector: "spa-text", inputs: { readonly: "readonly", hint: "hint", display: "display", placeholder: "placeholder", value: "value", format: "format", type: "type", rows: "rows", width: "width", options: "options", optionValue: "optionValue", required: "required", min: "min", max: "max", regex: "regex" }, outputs: { valueChange: "valueChange", leave: "leave", enterPress: "enterPress" }, ngImport: i0, template: "\r\n<!-- General Text -->\r\n<mat-form-field *ngIf=\"rows == '' && (format=='text' || format =='date') && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\" >\r\n<mat-label *ngIf=\"format=='text'\">{{display}}</mat-label>\r\n<mat-label *ngIf=\"format=='date'\">{{display | date:'dd/MM/yyyy'}}</mat-label>\r\n<input matInput autocomplete=\"off\" [(ngModel)]=\"value\" (change)=\"changed()\" (blur)=\"leaved()\" (keyup.enter)=\"enterPressed()\" [type]=\"type\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"/>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n<!-- password -->\r\n<mat-form-field *ngIf=\"format=='password'\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input matInput [type]=\"hide ? 'password' : 'text'\" (keyup.enter)=\"enterPressed()\" (change)=\"changed()\" (blur)=\"leaved()\" [(ngModel)]=\"value\" autocomplete=\"off\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\">\r\n <mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n <button mat-icon-button matSuffix (click)=\"hide = !hide\" [attr.aria-label]=\"'Hide password'\" [attr.aria-pressed]=\"hide\">\r\n <mat-icon style=\"font-size: 18px;\">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>\r\n </button>\r\n</mat-form-field>\r\n\r\n\r\n<!-- TextArea copy - Only change input to textarea and change ngif to not -->\r\n\r\n<mat-form-field *ngIf=\"rows != '' && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n<mat-label>{{display}}</mat-label>\r\n<textarea matInput autocomplete=\"off\" [rows]=\"rows\" [(ngModel)]=\"value\" (change)=\"changed()\" (keyup.enter)=\"enterPressed()\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"></textarea>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n\r\n<!-- Auto Complete-->\r\n\r\n <mat-form-field *ngIf=\"rows == '' && format=='text' && options.length>0 \" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input [type]=\"type\" [placeholder]=\"placeholder\" (change)=\"changed()\" matInput [formControl]=\"myControl\" [matAutocomplete]=\"auto\" [required]=\"required\" [readonly]=\"readonly\">\r\n <mat-error *ngIf=\"control.invalid\">{{validate(myControl)}}</mat-error>\r\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"changed()\">\r\n\r\n <ng-container *ngIf=\"!multiDimension\">\r\n <mat-option *ngFor=\"let option of filteredOptions | async\" [value]=\"option\">\r\n {{option}}\r\n </mat-option>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"multiDimension\">\r\n <mat-option *ngFor=\"let row of filteredOptions | async\" [value]=\"row[optionValue]\">\r\n {{row[optionValue]}}\r\n </mat-option>\r\n </ng-container>\r\n\r\n\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4$1.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: "component", type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i8.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i8.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.DatePipe, name: "date" }] });
1206
+ TextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TextComponent, selector: "spa-text", inputs: { readonly: "readonly", hint: "hint", display: "display", placeholder: "placeholder", value: "value", format: "format", type: "type", rows: "rows", width: "width", options: "options", optionValue: "optionValue", required: "required", min: "min", max: "max", regex: "regex" }, outputs: { valueChange: "valueChange", leave: "leave", enterPress: "enterPress" }, ngImport: i0, template: "\r\n<!-- General Text -->\r\n<mat-form-field *ngIf=\"(!rows || rows == 1) && (format=='text' || format =='date') && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\" >\r\n<mat-label *ngIf=\"format=='text'\">{{display}}</mat-label>\r\n<mat-label *ngIf=\"format=='date'\">{{display | date:'dd/MM/yyyy'}}</mat-label>\r\n<input matInput autocomplete=\"off\" [(ngModel)]=\"value\" (change)=\"changed()\" (blur)=\"leaved()\" (keyup.enter)=\"enterPressed()\" [type]=\"type\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"/>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n<!-- password -->\r\n<mat-form-field *ngIf=\"format=='password'\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input matInput [type]=\"hide ? 'password' : 'text'\" (keyup.enter)=\"enterPressed()\" (change)=\"changed()\" (blur)=\"leaved()\" [(ngModel)]=\"value\" autocomplete=\"off\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\">\r\n <mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n <button mat-icon-button matSuffix (click)=\"hide = !hide\" [attr.aria-label]=\"'Hide password'\" [attr.aria-pressed]=\"hide\">\r\n <mat-icon style=\"font-size: 18px;\">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>\r\n </button>\r\n</mat-form-field>\r\n\r\n\r\n<!-- TextArea copy - Only change input to textarea and change ngif to not -->\r\n\r\n<mat-form-field *ngIf=\"rows > 1 && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n<mat-label>{{display}}</mat-label>\r\n<textarea matInput autocomplete=\"off\" [rows]=\"rows\" [(ngModel)]=\"value\" (change)=\"changed()\" (keyup.enter)=\"enterPressed()\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"></textarea>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n\r\n<!-- Auto Complete-->\r\n\r\n <mat-form-field *ngIf=\"(!rows || rows == 1) && format=='text' && options.length>0 \" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input [type]=\"type\" [placeholder]=\"placeholder\" (change)=\"changed()\" matInput [formControl]=\"myControl\" [matAutocomplete]=\"auto\" [required]=\"required\" [readonly]=\"readonly\">\r\n <mat-error *ngIf=\"control.invalid\">{{validate(myControl)}}</mat-error>\r\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"changed()\">\r\n\r\n <ng-container *ngIf=\"!multiDimension\">\r\n <mat-option *ngFor=\"let option of filteredOptions | async\" [value]=\"option\">\r\n {{option}}\r\n </mat-option>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"multiDimension\">\r\n <mat-option *ngFor=\"let row of filteredOptions | async\" [value]=\"row[optionValue]\">\r\n {{row[optionValue]}}\r\n </mat-option>\r\n </ng-container>\r\n\r\n\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4$1.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: "component", type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i8.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i8.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.DatePipe, name: "date" }] });
1125
1207
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TextComponent, decorators: [{
1126
1208
  type: Component,
1127
- args: [{ selector: 'spa-text', template: "\r\n<!-- General Text -->\r\n<mat-form-field *ngIf=\"rows == '' && (format=='text' || format =='date') && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\" >\r\n<mat-label *ngIf=\"format=='text'\">{{display}}</mat-label>\r\n<mat-label *ngIf=\"format=='date'\">{{display | date:'dd/MM/yyyy'}}</mat-label>\r\n<input matInput autocomplete=\"off\" [(ngModel)]=\"value\" (change)=\"changed()\" (blur)=\"leaved()\" (keyup.enter)=\"enterPressed()\" [type]=\"type\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"/>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n<!-- password -->\r\n<mat-form-field *ngIf=\"format=='password'\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input matInput [type]=\"hide ? 'password' : 'text'\" (keyup.enter)=\"enterPressed()\" (change)=\"changed()\" (blur)=\"leaved()\" [(ngModel)]=\"value\" autocomplete=\"off\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\">\r\n <mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n <button mat-icon-button matSuffix (click)=\"hide = !hide\" [attr.aria-label]=\"'Hide password'\" [attr.aria-pressed]=\"hide\">\r\n <mat-icon style=\"font-size: 18px;\">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>\r\n </button>\r\n</mat-form-field>\r\n\r\n\r\n<!-- TextArea copy - Only change input to textarea and change ngif to not -->\r\n\r\n<mat-form-field *ngIf=\"rows != '' && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n<mat-label>{{display}}</mat-label>\r\n<textarea matInput autocomplete=\"off\" [rows]=\"rows\" [(ngModel)]=\"value\" (change)=\"changed()\" (keyup.enter)=\"enterPressed()\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"></textarea>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n\r\n<!-- Auto Complete-->\r\n\r\n <mat-form-field *ngIf=\"rows == '' && format=='text' && options.length>0 \" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input [type]=\"type\" [placeholder]=\"placeholder\" (change)=\"changed()\" matInput [formControl]=\"myControl\" [matAutocomplete]=\"auto\" [required]=\"required\" [readonly]=\"readonly\">\r\n <mat-error *ngIf=\"control.invalid\">{{validate(myControl)}}</mat-error>\r\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"changed()\">\r\n\r\n <ng-container *ngIf=\"!multiDimension\">\r\n <mat-option *ngFor=\"let option of filteredOptions | async\" [value]=\"option\">\r\n {{option}}\r\n </mat-option>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"multiDimension\">\r\n <mat-option *ngFor=\"let row of filteredOptions | async\" [value]=\"row[optionValue]\">\r\n {{row[optionValue]}}\r\n </mat-option>\r\n </ng-container>\r\n\r\n\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n" }]
1209
+ args: [{ selector: 'spa-text', template: "\r\n<!-- General Text -->\r\n<mat-form-field *ngIf=\"(!rows || rows == 1) && (format=='text' || format =='date') && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\" >\r\n<mat-label *ngIf=\"format=='text'\">{{display}}</mat-label>\r\n<mat-label *ngIf=\"format=='date'\">{{display | date:'dd/MM/yyyy'}}</mat-label>\r\n<input matInput autocomplete=\"off\" [(ngModel)]=\"value\" (change)=\"changed()\" (blur)=\"leaved()\" (keyup.enter)=\"enterPressed()\" [type]=\"type\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"/>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n<!-- password -->\r\n<mat-form-field *ngIf=\"format=='password'\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input matInput [type]=\"hide ? 'password' : 'text'\" (keyup.enter)=\"enterPressed()\" (change)=\"changed()\" (blur)=\"leaved()\" [(ngModel)]=\"value\" autocomplete=\"off\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\">\r\n <mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n <button mat-icon-button matSuffix (click)=\"hide = !hide\" [attr.aria-label]=\"'Hide password'\" [attr.aria-pressed]=\"hide\">\r\n <mat-icon style=\"font-size: 18px;\">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>\r\n </button>\r\n</mat-form-field>\r\n\r\n\r\n<!-- TextArea copy - Only change input to textarea and change ngif to not -->\r\n\r\n<mat-form-field *ngIf=\"rows > 1 && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n<mat-label>{{display}}</mat-label>\r\n<textarea matInput autocomplete=\"off\" [rows]=\"rows\" [(ngModel)]=\"value\" (change)=\"changed()\" (keyup.enter)=\"enterPressed()\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"></textarea>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n\r\n<!-- Auto Complete-->\r\n\r\n <mat-form-field *ngIf=\"(!rows || rows == 1) && format=='text' && options.length>0 \" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input [type]=\"type\" [placeholder]=\"placeholder\" (change)=\"changed()\" matInput [formControl]=\"myControl\" [matAutocomplete]=\"auto\" [required]=\"required\" [readonly]=\"readonly\">\r\n <mat-error *ngIf=\"control.invalid\">{{validate(myControl)}}</mat-error>\r\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"changed()\">\r\n\r\n <ng-container *ngIf=\"!multiDimension\">\r\n <mat-option *ngFor=\"let option of filteredOptions | async\" [value]=\"option\">\r\n {{option}}\r\n </mat-option>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"multiDimension\">\r\n <mat-option *ngFor=\"let row of filteredOptions | async\" [value]=\"row[optionValue]\">\r\n {{row[optionValue]}}\r\n </mat-option>\r\n </ng-container>\r\n\r\n\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n" }]
1128
1210
  }], ctorParameters: function () { return []; }, propDecorators: { readonly: [{
1129
1211
  type: Input
1130
1212
  }], hint: [{
@@ -1217,54 +1299,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1217
1299
 
1218
1300
  class DateComponent {
1219
1301
  constructor() {
1220
- this.date = new FormControl(new Date());
1302
+ this.required = true;
1303
+ this.min = "2023-11-05";
1304
+ this.max = "9999-01-01";
1305
+ this.readonly = false;
1306
+ this.hint = "";
1221
1307
  this.value = Core.nowDate(true);
1222
1308
  this.display = "";
1223
- this.readonly = false;
1309
+ this.placeholder = "";
1224
1310
  this.width = "100%";
1225
- this.min = "1900-01-01";
1226
- this.max = "9999-01-01";
1227
1311
  this.valueChange = new EventEmitter();
1312
+ this.control = new FormControl(new Date());
1228
1313
  }
1229
1314
  ngOnInit() {
1230
1315
  this.minDate = new FormControl(new Date(this.min));
1231
1316
  this.maxDate = new FormControl(new Date(this.max));
1232
1317
  if (!this.value || this.value == "") {
1233
- this.date = new FormControl(new Date());
1318
+ this.control = new FormControl(new Date());
1234
1319
  ;
1235
1320
  }
1236
1321
  setTimeout(() => { this.onChangeEvent(); }, 5);
1237
1322
  if (this.readonly) {
1238
- this.date.disable();
1323
+ this.control.disable();
1239
1324
  }
1240
1325
  else {
1241
- this.date.enable();
1326
+ this.control.enable();
1242
1327
  }
1243
1328
  }
1244
1329
  ngOnChanges() {
1245
- this.date = new FormControl(new Date(this.value));
1330
+ this.control = new FormControl(new Date(this.value));
1246
1331
  }
1247
1332
  onChangeEvent() {
1248
- let d = Core.getFormatedDate2(this.date.value, true);
1333
+ let d = Core.getFormatedDate2(this.control.value, true);
1249
1334
  this.valueChange.emit(d);
1250
1335
  }
1336
+ validate(control) {
1337
+ if (control.hasError('matDatepickerMin')) {
1338
+ return `Minimun date is ${this.min}`;
1339
+ }
1340
+ if (control.hasError('matDatepickerMax')) {
1341
+ return `Maximum date is ${this.max}`;
1342
+ }
1343
+ return "";
1344
+ }
1251
1345
  }
1252
1346
  DateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1253
- DateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DateComponent, selector: "spa-date", inputs: { value: "value", display: "display", readonly: "readonly", width: "width", min: "min", max: "max" }, outputs: { valueChange: "valueChange" }, usesOnChanges: true, ngImport: i0, template: "\r\n<mat-form-field [ngStyle]=\"{'width':width}\">\r\n<input [formControl]=\"date\" [min]=\"minDate.value\" [max]=\"maxDate.value\" matInput [matDatepicker]=\"picker_date\" (dateInput)=\"onChangeEvent()\" [placeholder]=\"display\" [readonly]=\"true\" >\r\n<mat-datepicker-toggle matSuffix [for]=\"picker_date\"></mat-datepicker-toggle>\r\n<mat-datepicker #picker_date></mat-datepicker>\r\n</mat-form-field>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { 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: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4$1.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: "component", type: i5$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }] });
1347
+ DateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DateComponent, selector: "spa-date", inputs: { required: "required", min: "min", max: "max", readonly: "readonly", hint: "hint", value: "value", display: "display", placeholder: "placeholder", width: "width" }, outputs: { valueChange: "valueChange" }, usesOnChanges: true, ngImport: i0, template: "\r\n<mat-form-field [ngStyle]=\"{'width':width}\">\r\n<input [formControl]=\"control\" [min]=\"minDate.value\" [max]=\"maxDate.value\" matInput [matDatepicker]=\"picker_date\" (dateInput)=\"onChangeEvent()\" [placeholder]=\"display\" [readonly]=\"true\" >\r\n<mat-datepicker-toggle matSuffix [for]=\"picker_date\"></mat-datepicker-toggle>\r\n<mat-datepicker #picker_date></mat-datepicker>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { 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.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4$1.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: "component", type: i5$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }] });
1254
1348
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateComponent, decorators: [{
1255
1349
  type: Component,
1256
- args: [{ selector: 'spa-date', template: "\r\n<mat-form-field [ngStyle]=\"{'width':width}\">\r\n<input [formControl]=\"date\" [min]=\"minDate.value\" [max]=\"maxDate.value\" matInput [matDatepicker]=\"picker_date\" (dateInput)=\"onChangeEvent()\" [placeholder]=\"display\" [readonly]=\"true\" >\r\n<mat-datepicker-toggle matSuffix [for]=\"picker_date\"></mat-datepicker-toggle>\r\n<mat-datepicker #picker_date></mat-datepicker>\r\n</mat-form-field>\r\n" }]
1257
- }], ctorParameters: function () { return []; }, propDecorators: { value: [{
1350
+ args: [{ selector: 'spa-date', template: "\r\n<mat-form-field [ngStyle]=\"{'width':width}\">\r\n<input [formControl]=\"control\" [min]=\"minDate.value\" [max]=\"maxDate.value\" matInput [matDatepicker]=\"picker_date\" (dateInput)=\"onChangeEvent()\" [placeholder]=\"display\" [readonly]=\"true\" >\r\n<mat-datepicker-toggle matSuffix [for]=\"picker_date\"></mat-datepicker-toggle>\r\n<mat-datepicker #picker_date></mat-datepicker>\r\n<mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n" }]
1351
+ }], ctorParameters: function () { return []; }, propDecorators: { required: [{
1258
1352
  type: Input
1259
- }], display: [{
1353
+ }], min: [{
1354
+ type: Input
1355
+ }], max: [{
1260
1356
  type: Input
1261
1357
  }], readonly: [{
1262
1358
  type: Input
1263
- }], width: [{
1359
+ }], hint: [{
1264
1360
  type: Input
1265
- }], min: [{
1361
+ }], value: [{
1266
1362
  type: Input
1267
- }], max: [{
1363
+ }], display: [{
1364
+ type: Input
1365
+ }], placeholder: [{
1366
+ type: Input
1367
+ }], width: [{
1268
1368
  type: Input
1269
1369
  }], valueChange: [{
1270
1370
  type: Output
@@ -1631,15 +1731,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1631
1731
  class MoneyComponent {
1632
1732
  constructor() {
1633
1733
  this.readonly = false;
1734
+ this.hint = "";
1634
1735
  this.display = "";
1635
- this.value = "";
1636
1736
  this.placeholder = "";
1637
- this.valueChange = new EventEmitter();
1638
- this.enterPress = new EventEmitter();
1639
- this.leave = new EventEmitter();
1737
+ this.value = "";
1640
1738
  this.width = "100%";
1641
- this.hint = "";
1642
1739
  this.currency = "";
1740
+ this.valueChange = new EventEmitter();
1741
+ this.leave = new EventEmitter();
1742
+ this.enterPress = new EventEmitter();
1743
+ //validation input
1744
+ this.required = true;
1745
+ this.min = 0;
1746
+ this.max = 9000000000000000; //Math.max 9000000000000000
1747
+ //validation
1748
+ this.control = new FormControl(this.value, [Validators.required, Validators.min(this.min), Validators.max(this.max)]);
1643
1749
  }
1644
1750
  ngOnInit() {
1645
1751
  if (this.placeholder == "") {
@@ -1648,40 +1754,77 @@ class MoneyComponent {
1648
1754
  }
1649
1755
  ngOnChanges() {
1650
1756
  }
1757
+ ngAfterViewInit() {
1758
+ this.initControl(this.control);
1759
+ }
1760
+ initControl(control) {
1761
+ if (this.readonly) {
1762
+ control.setValidators(null);
1763
+ control.updateValueAndValidity();
1764
+ }
1765
+ if (!this.required && !this.readonly) {
1766
+ control.setValidators([Validators.min(this.min), Validators.max(this.max)]);
1767
+ this.control.updateValueAndValidity();
1768
+ }
1769
+ }
1651
1770
  changed(x) {
1652
1771
  this.valueChange.emit(x);
1653
1772
  }
1773
+ leaved() {
1774
+ this.leave.emit();
1775
+ }
1654
1776
  enterPressed() {
1655
1777
  this.enterPress.emit();
1656
1778
  }
1657
- leaved() {
1658
- this.leave.emit();
1779
+ validate(control) {
1780
+ if (this.required && control.hasError('required')) {
1781
+ return `Required`;
1782
+ }
1783
+ if (parseFloat(this.value) < this.min) {
1784
+ return `Minimun value is ${this.min}`;
1785
+ }
1786
+ if (parseFloat(this.value) > this.max) {
1787
+ return `Maximum value is ${this.max}`;
1788
+ }
1789
+ if (control.hasError('min')) {
1790
+ return `Minimun value is ${this.min}`;
1791
+ }
1792
+ if (control.hasError('max')) {
1793
+ return `Maximum value is ${this.max}`;
1794
+ }
1795
+ return "";
1659
1796
  }
1660
1797
  }
1661
1798
  MoneyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MoneyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1662
- MoneyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: MoneyComponent, selector: "spa-money", inputs: { readonly: "readonly", display: "display", value: "value", placeholder: "placeholder", width: "width", hint: "hint", currency: "currency" }, outputs: { valueChange: "valueChange", enterPress: "enterPress", leave: "leave" }, usesOnChanges: true, ngImport: i0, template: "\r\n\r\n<mat-form-field [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" hideRequiredMarker=\"true\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input matInput appCurrencyInputMask autocomplete=\"off\" style=\"text-align: right;\"\r\n\r\n [ngModel]=\"value\" (ngModelChange)=\"changed($event)\" (keyup.enter)=\"enterPressed()\" (blur)=\"leaved()\" [placeholder]=\"placeholder\" [readonly]=\"readonly\" />\r\n <span *ngIf=\"currency!=''\" matPrefix>{{currency}}&nbsp;</span>\r\n</mat-form-field>\r\n\r\n", styles: ["input.example-right-align{-moz-appearance:textfield}.example-right-align{text-align:right}input.example-right-align::-webkit-outer-spin-button,input.example-right-align::-webkit-inner-spin-button{display:none}.curr{background-color:red}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { 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: i4$1.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: CurrencyInputMaskDirective, selector: "[appCurrencyInputMask]" }] });
1799
+ MoneyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: MoneyComponent, selector: "spa-money", inputs: { readonly: "readonly", hint: "hint", display: "display", placeholder: "placeholder", value: "value", width: "width", currency: "currency", required: "required", min: "min", max: "max" }, outputs: { valueChange: "valueChange", leave: "leave", enterPress: "enterPress" }, usesOnChanges: true, ngImport: i0, template: "\r\n\r\n<mat-form-field hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" hideRequiredMarker=\"true\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input matInput appCurrencyInputMask autocomplete=\"off\" style=\"text-align: right;\"\r\n [min]=\"min\" [max]=\"max\"\r\n [ngModel]=\"value\" (ngModelChange)=\"changed($event)\" (keyup.enter)=\"enterPressed()\" (blur)=\"leaved()\" [placeholder]=\"placeholder\" [formControl]=\"control\" [readonly]=\"readonly\" />\r\n <span *ngIf=\"currency!=''\" matPrefix>{{currency}}&nbsp;</span>\r\n <mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n", styles: ["input.example-right-align{-moz-appearance:textfield}.example-right-align{text-align:right}input.example-right-align::-webkit-outer-spin-button,input.example-right-align::-webkit-inner-spin-button{display:none}.curr{background-color:red}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { 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: i4$1.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: CurrencyInputMaskDirective, selector: "[appCurrencyInputMask]" }] });
1663
1800
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MoneyComponent, decorators: [{
1664
1801
  type: Component,
1665
- args: [{ selector: 'spa-money', template: "\r\n\r\n<mat-form-field [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" hideRequiredMarker=\"true\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input matInput appCurrencyInputMask autocomplete=\"off\" style=\"text-align: right;\"\r\n\r\n [ngModel]=\"value\" (ngModelChange)=\"changed($event)\" (keyup.enter)=\"enterPressed()\" (blur)=\"leaved()\" [placeholder]=\"placeholder\" [readonly]=\"readonly\" />\r\n <span *ngIf=\"currency!=''\" matPrefix>{{currency}}&nbsp;</span>\r\n</mat-form-field>\r\n\r\n", styles: ["input.example-right-align{-moz-appearance:textfield}.example-right-align{text-align:right}input.example-right-align::-webkit-outer-spin-button,input.example-right-align::-webkit-inner-spin-button{display:none}.curr{background-color:red}\n"] }]
1802
+ args: [{ selector: 'spa-money', template: "\r\n\r\n<mat-form-field hideRequiredMarker=\"true\" [hintLabel]=\"hint\" [ngStyle]=\"{'width':width}\" hideRequiredMarker=\"true\" style=\"margin-right: 5px;\">\r\n <mat-label>{{display}}</mat-label>\r\n <input matInput appCurrencyInputMask autocomplete=\"off\" style=\"text-align: right;\"\r\n [min]=\"min\" [max]=\"max\"\r\n [ngModel]=\"value\" (ngModelChange)=\"changed($event)\" (keyup.enter)=\"enterPressed()\" (blur)=\"leaved()\" [placeholder]=\"placeholder\" [formControl]=\"control\" [readonly]=\"readonly\" />\r\n <span *ngIf=\"currency!=''\" matPrefix>{{currency}}&nbsp;</span>\r\n <mat-error *ngIf=\"control.invalid\">{{validate(control)}}</mat-error>\r\n</mat-form-field>\r\n\r\n", styles: ["input.example-right-align{-moz-appearance:textfield}.example-right-align{text-align:right}input.example-right-align::-webkit-outer-spin-button,input.example-right-align::-webkit-inner-spin-button{display:none}.curr{background-color:red}\n"] }]
1666
1803
  }], ctorParameters: function () { return []; }, propDecorators: { readonly: [{
1667
1804
  type: Input
1805
+ }], hint: [{
1806
+ type: Input
1668
1807
  }], display: [{
1669
1808
  type: Input
1809
+ }], placeholder: [{
1810
+ type: Input
1670
1811
  }], value: [{
1671
1812
  type: Input
1672
- }], placeholder: [{
1813
+ }], width: [{
1814
+ type: Input
1815
+ }], currency: [{
1673
1816
  type: Input
1674
1817
  }], valueChange: [{
1675
1818
  type: Output
1676
- }], enterPress: [{
1677
- type: Output
1678
1819
  }], leave: [{
1679
1820
  type: Output
1680
- }], width: [{
1821
+ }], enterPress: [{
1822
+ type: Output
1823
+ }], required: [{
1681
1824
  type: Input
1682
- }], hint: [{
1825
+ }], min: [{
1683
1826
  type: Input
1684
- }], currency: [{
1827
+ }], max: [{
1685
1828
  type: Input
1686
1829
  }] } });
1687
1830
 
@@ -2180,10 +2323,10 @@ class NumberComponent {
2180
2323
  this.display = "";
2181
2324
  this.placeholder = "";
2182
2325
  this.value = 0;
2326
+ this.width = "100%";
2183
2327
  this.valueChange = new EventEmitter();
2184
2328
  this.leave = new EventEmitter();
2185
2329
  this.enterPress = new EventEmitter();
2186
- this.width = "100%";
2187
2330
  //validation input
2188
2331
  this.required = true;
2189
2332
  this.min = 0;
@@ -2193,6 +2336,22 @@ class NumberComponent {
2193
2336
  this.control = new FormControl(this.value, [Validators.required, Validators.min(this.min), Validators.max(this.max)]);
2194
2337
  }
2195
2338
  ngOnInit() {
2339
+ if (this.placeholder == "") {
2340
+ this.placeholder = "Enter " + this.display;
2341
+ }
2342
+ }
2343
+ ngAfterViewInit() {
2344
+ this.initControl(this.control);
2345
+ }
2346
+ initControl(control) {
2347
+ if (this.readonly) {
2348
+ control.setValidators(null);
2349
+ control.updateValueAndValidity();
2350
+ }
2351
+ if (!this.required && !this.readonly) {
2352
+ control.setValidators([Validators.minLength(this.min), Validators.maxLength(this.max)]);
2353
+ this.control.updateValueAndValidity();
2354
+ }
2196
2355
  }
2197
2356
  changed() {
2198
2357
  this.valueChange.emit(this.value);
@@ -2208,10 +2367,10 @@ class NumberComponent {
2208
2367
  return `Required`;
2209
2368
  }
2210
2369
  if (control.hasError('min')) {
2211
- return `Minimun length is ${this.min}`;
2370
+ return `Minimun value is ${this.min}`;
2212
2371
  }
2213
2372
  if (control.hasError('max')) {
2214
- return `Maximum length is ${this.max}`;
2373
+ return `Maximum value is ${this.max}`;
2215
2374
  }
2216
2375
  return "";
2217
2376
  }
@@ -2231,14 +2390,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2231
2390
  type: Input
2232
2391
  }], value: [{
2233
2392
  type: Input
2393
+ }], width: [{
2394
+ type: Input
2234
2395
  }], valueChange: [{
2235
2396
  type: Output
2236
2397
  }], leave: [{
2237
2398
  type: Output
2238
2399
  }], enterPress: [{
2239
2400
  type: Output
2240
- }], width: [{
2241
- type: Input
2242
2401
  }], required: [{
2243
2402
  type: Input
2244
2403
  }], min: [{
@@ -2271,55 +2430,97 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2271
2430
  }] });
2272
2431
 
2273
2432
  class FormComponent {
2274
- constructor() { }
2433
+ constructor(messageService, dataService) {
2434
+ this.messageService = messageService;
2435
+ this.dataService = dataService;
2436
+ this.buttonDisplay = "Submit";
2437
+ this.isProcessing = false;
2438
+ this.multiColumn = false;
2439
+ this.buttonClick = new EventEmitter();
2440
+ }
2275
2441
  ngOnInit() {
2276
- if (!this.fields) {
2277
- this.fields = this.config.fields;
2442
+ var _a, _b;
2443
+ if (!this.config.fields) {
2444
+ this.messageService.toast("Please Configure Form Fields");
2445
+ return;
2446
+ }
2447
+ if (!this.data) {
2448
+ this.messageService.toast("Please Configure Form Data");
2449
+ return;
2278
2450
  }
2279
- if (this.config.mode == "create" && !this.data) {
2280
- this.generateObject();
2451
+ this.fields = this.config.fields;
2452
+ if (this.config.multiColumn) {
2453
+ this.multiColumn = this.config.multiColumn;
2454
+ }
2455
+ else {
2456
+ this.multiColumn = this.fields.length > 2;
2457
+ }
2458
+ if ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.button) === null || _b === void 0 ? void 0 : _b.display) {
2459
+ this.buttonDisplay = this.config.button.display;
2281
2460
  }
2282
2461
  }
2283
2462
  ngOnChanges() {
2284
2463
  console.log("changed");
2285
2464
  }
2286
- generateObject() {
2287
- this.data = {};
2288
- this.fields.forEach(field => {
2289
- this.data[field.name] = this.getInitialValue(field.type);
2290
- });
2291
- }
2292
- getInitialValue(type) {
2293
- switch (type) {
2294
- case 'text':
2295
- return '';
2296
- case 'money':
2297
- return 0;
2298
- case 'number':
2299
- return 0;
2300
- case 'date':
2301
- return '';
2302
- case 'checkbox':
2303
- return false;
2304
- case 'select':
2305
- return null;
2306
- default:
2307
- return null;
2465
+ buttonClicked() {
2466
+ console.log("Button Clicked");
2467
+ this.buttonClick.emit(this.data);
2468
+ console.log(this.data);
2469
+ let button = this.config.button;
2470
+ if (!button) {
2471
+ return;
2472
+ }
2473
+ //validation
2474
+ let resp = Core.validateObject(this.fields, this.data);
2475
+ if (resp != '') {
2476
+ this.messageService.toast(resp);
2477
+ return;
2478
+ }
2479
+ if (button.confirm) {
2480
+ this.messageService.confirm(`${button.confirm.message}`).subscribe((result) => {
2481
+ if (result == "yes") {
2482
+ this.processCall(button);
2483
+ }
2484
+ });
2485
+ }
2486
+ else {
2487
+ this.processCall(button);
2308
2488
  }
2309
2489
  }
2310
- createClicked() {
2311
- console.log(this.data);
2490
+ processCall(button) {
2491
+ if (!button.action)
2492
+ return;
2493
+ this.isProcessing = true;
2494
+ this.dataService.CallApi(button.action, this.data).subscribe((apiResponse) => {
2495
+ this.isProcessing = false;
2496
+ if (apiResponse.success) {
2497
+ if (button.action.successMessage) {
2498
+ this.messageService.toast(button.action.successMessage);
2499
+ }
2500
+ else {
2501
+ this.messageService.toast("Submitted");
2502
+ }
2503
+ if (this.config.reset) {
2504
+ Core.resetObject(this.fields, this.data);
2505
+ }
2506
+ }
2507
+ else {
2508
+ this.messageService.toast("Error: " + apiResponse.message);
2509
+ }
2510
+ });
2312
2511
  }
2313
2512
  }
2314
- FormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2315
- FormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: FormComponent, selector: "spa-form", inputs: { data: "data", config: "config" }, usesOnChanges: true, ngImport: i0, template: "\n<div class=\"tin-grid\">\n\n <div *ngFor=\"let field of fields\" >\n\n <ng-container [ngSwitch]=\"field.type\">\n\n <spa-text *ngSwitchCase=\"'text'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-text>\n\n <spa-number *ngSwitchCase=\"'number'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-number>\n\n <spa-money *ngSwitchCase=\"'money'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-money>\n\n <spa-check *ngSwitchCase=\"'checkbox'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-check>\n\n <spa-date *ngSwitchCase=\"'date'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\" ></spa-date>\n\n <spa-select *ngSwitchCase=\"'select'\"\n [display]=\"field.name | camelToWords\"\n [options]=\"field.options\" [optionDisplay]=\"field.optionDisplay\" [optionValue]=\"field.optionValue\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\" >\n </spa-select>\n\n <spa-text *ngSwitchDefault [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-text>\n\n </ng-container>\n\n </div>\n\n\n\n\n <div class=\"span-col-center\" *ngIf=\"config.button\">\n <button mat-raised-button color=\"primary\" (click)=\"createClicked()\" cdkFocusInitial>{{config.button.name}}</button>\n </div>\n\n\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: TextComponent, selector: "spa-text", inputs: ["readonly", "hint", "display", "placeholder", "value", "format", "type", "rows", "width", "options", "optionValue", "required", "min", "max", "regex"], outputs: ["valueChange", "leave", "enterPress"] }, { kind: "component", type: CheckComponent, selector: "spa-check", inputs: ["readonly", "display", "value"], outputs: ["valueChange", "click", "check", "uncheck"] }, { kind: "component", type: DateComponent, selector: "spa-date", inputs: ["value", "display", "readonly", "width", "min", "max"], outputs: ["valueChange"] }, { kind: "component", type: SelectComponent, selector: "spa-select", inputs: ["width", "readonly", "readonlyMode", "hint", "placeholder", "multiple", "display", "value", "options", "optionValue", "optionDisplay", "optionDisplayExtra"], outputs: ["valueChange"] }, { kind: "component", type: MoneyComponent, selector: "spa-money", inputs: ["readonly", "display", "value", "placeholder", "width", "hint", "currency"], outputs: ["valueChange", "enterPress", "leave"] }, { kind: "component", type: NumberComponent, selector: "spa-number", inputs: ["readonly", "hint", "display", "placeholder", "value", "width", "required", "min", "max", "step"], outputs: ["valueChange", "leave", "enterPress"] }, { kind: "pipe", type: CamelToWordsPipe, name: "camelToWords" }] });
2513
+ FormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FormComponent, deps: [{ token: MessageService }, { token: DataServiceLib }], target: i0.ɵɵFactoryTarget.Component });
2514
+ FormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: FormComponent, selector: "spa-form", inputs: { data: "data", config: "config" }, outputs: { buttonClick: "buttonClick" }, usesOnChanges: true, ngImport: i0, template: "\r\n<div [ngClass]=\"multiColumn ? 'tin-grid' : 'tin-col'\" >\r\n\r\n <div [ngClass]=\"field.span || field.type =='section' ? 'span-col' : ''\" *ngFor=\"let field of fields\">\r\n\r\n <ng-container [ngSwitch]=\"field.type\">\r\n\r\n <div *ngSwitchCase=\"'section'\" class=\"title\">\r\n <label style=\"font-size: larger;\">{{field.name | camelToWords}}</label>\r\n </div>\r\n\r\n <label *ngSwitchCase=\"'blank'\">.</label>\r\n\r\n <spa-text *ngSwitchCase=\"'text'\" [display]=\"field.name | camelToWords\" [options]=\"field.options\" [optionValue]=\"field.optionValue\" [rows]=\"field.rows\" [(value)]=\"data[field.name]\" [required]=\"field.required\" [min]=\"field.min\" [max]=\"field.max\" [readonly]=\"config.mode =='view'\"></spa-text>\r\n\r\n <spa-number *ngSwitchCase=\"'number'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [required]=\"field.required\" [min]=\"field.min\" [max]=\"field.max\" [readonly]=\"config.mode =='view'\"></spa-number>\r\n\r\n <spa-money *ngSwitchCase=\"'money'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [required]=\"field.required\" [min]=\"field.min\" [max]=\"field.max\" [readonly]=\"config.mode =='view'\"></spa-money>\r\n\r\n <spa-check *ngSwitchCase=\"'checkbox'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-check>\r\n\r\n <spa-date *ngSwitchCase=\"'date'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [min]=\"field?.min\" [max]=\"field?.max\" [readonly]=\"config.mode =='view'\" ></spa-date>\r\n\r\n <spa-select *ngSwitchCase=\"'select'\"\r\n [display]=\"field.name | camelToWords\"\r\n [options]=\"field.options\" [optionDisplay]=\"field.optionDisplay\" [optionValue]=\"field.optionValue\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\" >\r\n </spa-select>\r\n\r\n <spa-select *ngSwitchCase=\"'multi-select'\"\r\n [display]=\"field.name | camelToWords\"\r\n [options]=\"field.options\" [optionDisplay]=\"field.optionDisplay\" [optionValue]=\"field.optionValue\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\" [multiple]=\"true\">\r\n </spa-select>\r\n\r\n <spa-text *ngSwitchDefault [display]=\"field.name | camelToWords\" [options]=\"field.options\" [optionValue]=\"field.optionValue\" [rows]=\"field.rows\" [(value)]=\"data[field.name]\" [required]=\"field.required\" [min]=\"field.min\" [max]=\"field.max\" [readonly]=\"config.mode =='view'\"></spa-text>\r\n\r\n </ng-container>\r\n\r\n </div>\r\n\r\n\r\n <div class=\"span-col-center\" *ngIf=\"config.button\">\r\n <button mat-raised-button color=\"primary\" [disabled]=\"isProcessing\" (click)=\"buttonClicked()\" cdkFocusInitial>{{buttonDisplay}}</button>\r\n </div>\r\n\r\n\r\n</div>\r\n", styles: [".title{margin-top:1em;font-size:larger;font-weight:300}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: TextComponent, selector: "spa-text", inputs: ["readonly", "hint", "display", "placeholder", "value", "format", "type", "rows", "width", "options", "optionValue", "required", "min", "max", "regex"], outputs: ["valueChange", "leave", "enterPress"] }, { kind: "component", type: CheckComponent, selector: "spa-check", inputs: ["readonly", "display", "value"], outputs: ["valueChange", "click", "check", "uncheck"] }, { kind: "component", type: DateComponent, selector: "spa-date", inputs: ["required", "min", "max", "readonly", "hint", "value", "display", "placeholder", "width"], outputs: ["valueChange"] }, { kind: "component", type: SelectComponent, selector: "spa-select", inputs: ["width", "readonly", "readonlyMode", "hint", "placeholder", "multiple", "display", "value", "options", "optionValue", "optionDisplay", "optionDisplayExtra"], outputs: ["valueChange"] }, { kind: "component", type: MoneyComponent, selector: "spa-money", inputs: ["readonly", "hint", "display", "placeholder", "value", "width", "currency", "required", "min", "max"], outputs: ["valueChange", "leave", "enterPress"] }, { kind: "component", type: NumberComponent, selector: "spa-number", inputs: ["readonly", "hint", "display", "placeholder", "value", "width", "required", "min", "max", "step"], outputs: ["valueChange", "leave", "enterPress"] }, { kind: "pipe", type: CamelToWordsPipe, name: "camelToWords" }] });
2316
2515
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FormComponent, decorators: [{
2317
2516
  type: Component,
2318
- args: [{ selector: 'spa-form', template: "\n<div class=\"tin-grid\">\n\n <div *ngFor=\"let field of fields\" >\n\n <ng-container [ngSwitch]=\"field.type\">\n\n <spa-text *ngSwitchCase=\"'text'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-text>\n\n <spa-number *ngSwitchCase=\"'number'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-number>\n\n <spa-money *ngSwitchCase=\"'money'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-money>\n\n <spa-check *ngSwitchCase=\"'checkbox'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-check>\n\n <spa-date *ngSwitchCase=\"'date'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\" ></spa-date>\n\n <spa-select *ngSwitchCase=\"'select'\"\n [display]=\"field.name | camelToWords\"\n [options]=\"field.options\" [optionDisplay]=\"field.optionDisplay\" [optionValue]=\"field.optionValue\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\" >\n </spa-select>\n\n <spa-text *ngSwitchDefault [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-text>\n\n </ng-container>\n\n </div>\n\n\n\n\n <div class=\"span-col-center\" *ngIf=\"config.button\">\n <button mat-raised-button color=\"primary\" (click)=\"createClicked()\" cdkFocusInitial>{{config.button.name}}</button>\n </div>\n\n\n</div>\n" }]
2319
- }], ctorParameters: function () { return []; }, propDecorators: { data: [{
2517
+ args: [{ selector: 'spa-form', template: "\r\n<div [ngClass]=\"multiColumn ? 'tin-grid' : 'tin-col'\" >\r\n\r\n <div [ngClass]=\"field.span || field.type =='section' ? 'span-col' : ''\" *ngFor=\"let field of fields\">\r\n\r\n <ng-container [ngSwitch]=\"field.type\">\r\n\r\n <div *ngSwitchCase=\"'section'\" class=\"title\">\r\n <label style=\"font-size: larger;\">{{field.name | camelToWords}}</label>\r\n </div>\r\n\r\n <label *ngSwitchCase=\"'blank'\">.</label>\r\n\r\n <spa-text *ngSwitchCase=\"'text'\" [display]=\"field.name | camelToWords\" [options]=\"field.options\" [optionValue]=\"field.optionValue\" [rows]=\"field.rows\" [(value)]=\"data[field.name]\" [required]=\"field.required\" [min]=\"field.min\" [max]=\"field.max\" [readonly]=\"config.mode =='view'\"></spa-text>\r\n\r\n <spa-number *ngSwitchCase=\"'number'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [required]=\"field.required\" [min]=\"field.min\" [max]=\"field.max\" [readonly]=\"config.mode =='view'\"></spa-number>\r\n\r\n <spa-money *ngSwitchCase=\"'money'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [required]=\"field.required\" [min]=\"field.min\" [max]=\"field.max\" [readonly]=\"config.mode =='view'\"></spa-money>\r\n\r\n <spa-check *ngSwitchCase=\"'checkbox'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\"></spa-check>\r\n\r\n <spa-date *ngSwitchCase=\"'date'\" [display]=\"field.name | camelToWords\" [(value)]=\"data[field.name]\" [min]=\"field?.min\" [max]=\"field?.max\" [readonly]=\"config.mode =='view'\" ></spa-date>\r\n\r\n <spa-select *ngSwitchCase=\"'select'\"\r\n [display]=\"field.name | camelToWords\"\r\n [options]=\"field.options\" [optionDisplay]=\"field.optionDisplay\" [optionValue]=\"field.optionValue\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\" >\r\n </spa-select>\r\n\r\n <spa-select *ngSwitchCase=\"'multi-select'\"\r\n [display]=\"field.name | camelToWords\"\r\n [options]=\"field.options\" [optionDisplay]=\"field.optionDisplay\" [optionValue]=\"field.optionValue\" [(value)]=\"data[field.name]\" [readonly]=\"config.mode =='view'\" [multiple]=\"true\">\r\n </spa-select>\r\n\r\n <spa-text *ngSwitchDefault [display]=\"field.name | camelToWords\" [options]=\"field.options\" [optionValue]=\"field.optionValue\" [rows]=\"field.rows\" [(value)]=\"data[field.name]\" [required]=\"field.required\" [min]=\"field.min\" [max]=\"field.max\" [readonly]=\"config.mode =='view'\"></spa-text>\r\n\r\n </ng-container>\r\n\r\n </div>\r\n\r\n\r\n <div class=\"span-col-center\" *ngIf=\"config.button\">\r\n <button mat-raised-button color=\"primary\" [disabled]=\"isProcessing\" (click)=\"buttonClicked()\" cdkFocusInitial>{{buttonDisplay}}</button>\r\n </div>\r\n\r\n\r\n</div>\r\n", styles: [".title{margin-top:1em;font-size:larger;font-weight:300}\n"] }]
2518
+ }], ctorParameters: function () { return [{ type: MessageService }, { type: DataServiceLib }]; }, propDecorators: { data: [{
2320
2519
  type: Input
2321
2520
  }], config: [{
2322
2521
  type: Input
2522
+ }], buttonClick: [{
2523
+ type: Output
2323
2524
  }] } });
2324
2525
 
2325
2526
  class detailsDialog {
@@ -2338,46 +2539,27 @@ class detailsDialog {
2338
2539
  this.formConfig.mode = this.data.mode;
2339
2540
  this.smallScreen = this.data.smallScreen;
2340
2541
  if (this.formConfig.mode == "create") {
2341
- this.details = this.generateObject();
2542
+ this.details = Core.generateObject(this.formConfig.fields);
2342
2543
  }
2343
2544
  else {
2344
2545
  this.details = this.data.details;
2345
2546
  }
2346
2547
  this.isLoadComplete = true;
2347
2548
  }
2348
- generateObject() {
2349
- let d = {};
2350
- this.formConfig.fields.forEach(property => {
2351
- d[property.name] = this.getInitialValue(property.type);
2352
- });
2353
- return d;
2354
- }
2355
2549
  setMode(newMode) {
2356
2550
  this.formConfig.mode = newMode;
2357
2551
  }
2358
- getInitialValue(type) {
2359
- switch (type) {
2360
- case 'text':
2361
- return '';
2362
- case 'money':
2363
- return 0;
2364
- case 'number':
2365
- return 0;
2366
- case 'date':
2367
- return '';
2368
- case 'checkbox':
2369
- return false;
2370
- case 'select':
2371
- return null;
2372
- default:
2373
- return null;
2374
- }
2375
- }
2376
2552
  create() {
2377
2553
  console.log(this.details);
2554
+ //validation
2555
+ let resp = Core.validateObject(this.formConfig.fields, this.details);
2556
+ if (resp != '') {
2557
+ this.messageService.toast(resp);
2558
+ return;
2559
+ }
2378
2560
  let b = this.tableConfig.buttons.find(x => x.name == "create");
2379
- if (!b) {
2380
- this.dialogRef.close({ message: 'success', data: this.details });
2561
+ if (!b || !b.action) {
2562
+ this.dialogRef.close({ message: 'emit', data: this.details });
2381
2563
  return;
2382
2564
  }
2383
2565
  this.isProcessing = true;
@@ -2399,9 +2581,15 @@ class detailsDialog {
2399
2581
  }
2400
2582
  edit() {
2401
2583
  console.log("Edit");
2584
+ //validation
2585
+ let resp = Core.validateObject(this.formConfig.fields, this.details);
2586
+ if (resp != '') {
2587
+ this.messageService.toast(resp);
2588
+ return;
2589
+ }
2402
2590
  let b = this.tableConfig.buttons.find(x => x.name == "edit");
2403
- if (!b) {
2404
- this.dialogRef.close({ message: 'success', data: this.details });
2591
+ if (!b || !b.action) {
2592
+ this.dialogRef.close({ message: 'emit', data: this.details });
2405
2593
  return;
2406
2594
  }
2407
2595
  this.isProcessing = true;
@@ -2451,7 +2639,7 @@ class detailsDialog {
2451
2639
  }
2452
2640
  }
2453
2641
  detailsDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: detailsDialog, deps: [{ token: DataServiceLib }, { token: MessageService }, { token: i4.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
2454
- detailsDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: detailsDialog, selector: "app-viewModel", ngImport: i0, template: "\r\n<div class=\"row d-flex align-items-center mt-0\">\r\n\r\n <div class=\"col\">\r\n <h2 mat-dialog-title>{{formConfig.mode | titlecase}}</h2>\r\n </div>\r\n\r\n <div *ngIf=\"smallScreen && formConfig.mode=='view'\" class=\"col d-flex justify-content-end\">\r\n <button mat-mini-fab color=\"primary\" (click)=\"setMode('edit')\"><mat-icon>edit</mat-icon></button>\r\n </div>\r\n\r\n <div *ngIf=\"smallScreen && formConfig.mode=='edit'\" class=\"col d-flex justify-content-end\">\r\n <button mat-icon-button (click)=\"setMode('view')\"><mat-icon>done</mat-icon></button>\r\n </div>\r\n\r\n</div>\r\n<mat-dialog-content class=\"mat-typography\">\r\n\r\n<div class=\"tin-input\" style=\"font-size:14px\">\r\n\r\n\r\n<spa-form [data]=\"details\" [config]=\"formConfig\"></spa-form>\r\n\r\n</div>\r\n\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions>\r\n<div>\r\n<button mat-raised-button [disabled]=\"isProcessing\" color=\"primary\" *ngIf=\"formConfig.mode=='create'\" (click)=\"create()\" cdkFocusInitial>Submit</button>\r\n<button mat-raised-button [disabled]=\"isProcessing\" color=\"primary\" *ngIf=\"formConfig.mode=='edit'\" (click)=\"edit()\" cdkFocusInitial>Submit</button>\r\n<button mat-stroked-button color=\"primary\" mat-dialog-close>Cancel</button>\r\n</div>\r\n<div class=\"col d-flex justify-content-end\">\r\n<button mat-icon-button [disabled]=\"isProcessing\" style=\"color: red;\" (click)=\"delete()\" *ngIf=\"formConfig.mode!='create'\"><mat-icon>delete</mat-icon></button>\r\n</div>\r\n\r\n\r\n</mat-dialog-actions>\r\n\r\n\r\n\r\n", styles: [".top{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;align-items:center}.mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i4.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i4.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: FormComponent, selector: "spa-form", inputs: ["data", "config"] }, { kind: "pipe", type: i1.TitleCasePipe, name: "titlecase" }] });
2642
+ detailsDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: detailsDialog, selector: "app-viewModel", ngImport: i0, template: "\r\n<div class=\"row d-flex align-items-center mt-0\">\r\n\r\n <div class=\"col\">\r\n <h2 mat-dialog-title>{{formConfig.mode | titlecase}}</h2>\r\n </div>\r\n\r\n <div *ngIf=\"smallScreen && formConfig.mode=='view'\" class=\"col d-flex justify-content-end\">\r\n <button mat-mini-fab color=\"primary\" (click)=\"setMode('edit')\"><mat-icon>edit</mat-icon></button>\r\n </div>\r\n\r\n <div *ngIf=\"smallScreen && formConfig.mode=='edit'\" class=\"col d-flex justify-content-end\">\r\n <button mat-icon-button (click)=\"setMode('view')\"><mat-icon>done</mat-icon></button>\r\n </div>\r\n\r\n</div>\r\n<mat-dialog-content class=\"mat-typography\">\r\n\r\n<div class=\"tin-input\" style=\"font-size:14px\">\r\n\r\n\r\n<spa-form [data]=\"details\" [config]=\"formConfig\"></spa-form>\r\n\r\n</div>\r\n\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions>\r\n<div>\r\n<button mat-raised-button [disabled]=\"isProcessing\" color=\"primary\" *ngIf=\"formConfig.mode=='create'\" (click)=\"create()\" cdkFocusInitial>Submit</button>\r\n<button mat-raised-button [disabled]=\"isProcessing\" color=\"primary\" *ngIf=\"formConfig.mode=='edit'\" (click)=\"edit()\" cdkFocusInitial>Submit</button>\r\n<button mat-stroked-button color=\"primary\" mat-dialog-close>Cancel</button>\r\n</div>\r\n<div class=\"col d-flex justify-content-end\">\r\n<button mat-icon-button [disabled]=\"isProcessing\" style=\"color: red;\" (click)=\"delete()\" *ngIf=\"formConfig.mode!='create'\"><mat-icon>delete</mat-icon></button>\r\n</div>\r\n\r\n\r\n</mat-dialog-actions>\r\n\r\n\r\n\r\n", styles: [".top{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;align-items:center}.mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i4.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i4.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: FormComponent, selector: "spa-form", inputs: ["data", "config"], outputs: ["buttonClick"] }, { kind: "pipe", type: i1.TitleCasePipe, name: "titlecase" }] });
2455
2643
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: detailsDialog, decorators: [{
2456
2644
  type: Component,
2457
2645
  args: [{ selector: 'app-viewModel', template: "\r\n<div class=\"row d-flex align-items-center mt-0\">\r\n\r\n <div class=\"col\">\r\n <h2 mat-dialog-title>{{formConfig.mode | titlecase}}</h2>\r\n </div>\r\n\r\n <div *ngIf=\"smallScreen && formConfig.mode=='view'\" class=\"col d-flex justify-content-end\">\r\n <button mat-mini-fab color=\"primary\" (click)=\"setMode('edit')\"><mat-icon>edit</mat-icon></button>\r\n </div>\r\n\r\n <div *ngIf=\"smallScreen && formConfig.mode=='edit'\" class=\"col d-flex justify-content-end\">\r\n <button mat-icon-button (click)=\"setMode('view')\"><mat-icon>done</mat-icon></button>\r\n </div>\r\n\r\n</div>\r\n<mat-dialog-content class=\"mat-typography\">\r\n\r\n<div class=\"tin-input\" style=\"font-size:14px\">\r\n\r\n\r\n<spa-form [data]=\"details\" [config]=\"formConfig\"></spa-form>\r\n\r\n</div>\r\n\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions>\r\n<div>\r\n<button mat-raised-button [disabled]=\"isProcessing\" color=\"primary\" *ngIf=\"formConfig.mode=='create'\" (click)=\"create()\" cdkFocusInitial>Submit</button>\r\n<button mat-raised-button [disabled]=\"isProcessing\" color=\"primary\" *ngIf=\"formConfig.mode=='edit'\" (click)=\"edit()\" cdkFocusInitial>Submit</button>\r\n<button mat-stroked-button color=\"primary\" mat-dialog-close>Cancel</button>\r\n</div>\r\n<div class=\"col d-flex justify-content-end\">\r\n<button mat-icon-button [disabled]=\"isProcessing\" style=\"color: red;\" (click)=\"delete()\" *ngIf=\"formConfig.mode!='create'\"><mat-icon>delete</mat-icon></button>\r\n</div>\r\n\r\n\r\n</mat-dialog-actions>\r\n\r\n\r\n\r\n", styles: [".top{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;align-items:center}.mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}\n"] }]
@@ -2604,12 +2792,12 @@ class TableComponent {
2604
2792
  // this.doAction('view', x);
2605
2793
  }
2606
2794
  create(x) {
2607
- console.log("Create");
2795
+ console.log("Create " + x);
2608
2796
  this.createClick.emit(x);
2609
2797
  this.doAction('create', x);
2610
2798
  }
2611
2799
  edit(x) {
2612
- console.log("Edit");
2800
+ console.log("Edit " + x);
2613
2801
  this.editClick.emit(x);
2614
2802
  this.doAction('edit', x);
2615
2803
  }
@@ -2668,10 +2856,13 @@ class TableComponent {
2668
2856
  data: { mode: "create", config: this.config, smallScreen: this.smallScreen }
2669
2857
  });
2670
2858
  dialogRef.afterClosed().subscribe((result) => {
2671
- if (result.message) {
2859
+ if (result.message == "success") {
2672
2860
  this.create(result.data);
2673
2861
  this.refreshClicked();
2674
2862
  }
2863
+ else if (result.message == "emit") {
2864
+ this.create(result.data);
2865
+ }
2675
2866
  });
2676
2867
  }
2677
2868
  editModel(row) {
@@ -2689,10 +2880,13 @@ class TableComponent {
2689
2880
  data: { mode: "edit", config: this.config, details: row, smallScreen: this.smallScreen },
2690
2881
  });
2691
2882
  dialogRef.afterClosed().subscribe((result) => {
2692
- if (result.message) {
2883
+ if (result.message == "success") {
2693
2884
  this.edit(result.data);
2694
2885
  this.refreshClicked();
2695
2886
  }
2887
+ else if (result.message == "emit") {
2888
+ this.edit(result.data);
2889
+ }
2696
2890
  });
2697
2891
  }
2698
2892
  deleteModel(row) {
@@ -2714,6 +2908,8 @@ class TableComponent {
2714
2908
  return;
2715
2909
  if (b.action && buttonName != 'delete')
2716
2910
  return;
2911
+ if (!b.action)
2912
+ return;
2717
2913
  this.dataService.CallApi(b.action, row).subscribe((apiResponse) => {
2718
2914
  if (apiResponse.success) {
2719
2915
  if (b.action.successMessage) {
@@ -2725,7 +2921,7 @@ class TableComponent {
2725
2921
  this.refreshClicked();
2726
2922
  }
2727
2923
  else {
2728
- this.messageService.toast("Error: " + apiResponse);
2924
+ this.messageService.toast("Error: " + apiResponse.message);
2729
2925
  }
2730
2926
  });
2731
2927
  }
@@ -2736,12 +2932,13 @@ class TableComponent {
2736
2932
  this.dataSource = apiResponse.data;
2737
2933
  this.tableDataSource = new MatTableDataSource(apiResponse.data);
2738
2934
  this.tableDataSource.paginator = this.tablePaginator;
2739
- // if (apiResponse.success){
2740
- // this.tableDataSource = new MatTableDataSource(apiResponse.data);
2741
- // this.tableDataSource.paginator = this.tablePaginator;
2742
- // }else{
2743
- // this.messageService.toast("Error: " + JSON.stringify(apiResponse));
2744
- // }
2935
+ if (apiResponse.success) {
2936
+ this.tableDataSource = new MatTableDataSource(apiResponse.data);
2937
+ this.tableDataSource.paginator = this.tablePaginator;
2938
+ }
2939
+ else {
2940
+ this.messageService.toast("Error: " + JSON.stringify(apiResponse));
2941
+ }
2745
2942
  });
2746
2943
  }
2747
2944
  }
@@ -3048,10 +3245,9 @@ SpaIndexModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version:
3048
3245
  SpaIndexModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: SpaIndexModule, declarations: [LoginComponent, SignupComponent, RecoverAccountComponent], imports: [i2.ReactiveFormsModule, CommonModule,
3049
3246
  FormsModule,
3050
3247
  ReactiveFormsModule,
3051
- // SpaMatModule,
3052
3248
  TinSpaModule], exports: [CommonModule,
3053
3249
  FormsModule,
3054
- // SpaMatModule,
3250
+ TinSpaModule,
3055
3251
  LoginComponent,
3056
3252
  SignupComponent,
3057
3253
  RecoverAccountComponent] });
@@ -3059,9 +3255,9 @@ SpaIndexModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version:
3059
3255
  CommonModule,
3060
3256
  FormsModule,
3061
3257
  ReactiveFormsModule,
3062
- // SpaMatModule,
3063
3258
  TinSpaModule, CommonModule,
3064
- FormsModule] });
3259
+ FormsModule,
3260
+ TinSpaModule] });
3065
3261
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaIndexModule, decorators: [{
3066
3262
  type: NgModule,
3067
3263
  args: [{
@@ -3071,13 +3267,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3071
3267
  CommonModule,
3072
3268
  FormsModule,
3073
3269
  ReactiveFormsModule,
3074
- // SpaMatModule,
3075
3270
  TinSpaModule
3076
3271
  ],
3077
3272
  exports: [
3078
3273
  CommonModule,
3079
3274
  FormsModule,
3080
- // SpaMatModule,
3275
+ TinSpaModule,
3081
3276
  LoginComponent,
3082
3277
  SignupComponent,
3083
3278
  RecoverAccountComponent,
@@ -3253,19 +3448,18 @@ SpaUserModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
3253
3448
  SpaUserModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: SpaUserModule, declarations: [ChangePasswordComponent, ProfileComponent], imports: [i2.ReactiveFormsModule, CommonModule,
3254
3449
  FormsModule,
3255
3450
  ReactiveFormsModule,
3256
- // SpaMatModule,
3257
3451
  TinSpaModule], exports: [CommonModule,
3258
3452
  FormsModule,
3259
- // SpaMatModule,
3453
+ TinSpaModule,
3260
3454
  ChangePasswordComponent,
3261
3455
  ProfileComponent] });
3262
3456
  SpaUserModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUserModule, imports: [ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: "never" }),
3263
3457
  CommonModule,
3264
3458
  FormsModule,
3265
3459
  ReactiveFormsModule,
3266
- // SpaMatModule,
3267
3460
  TinSpaModule, CommonModule,
3268
- FormsModule] });
3461
+ FormsModule,
3462
+ TinSpaModule] });
3269
3463
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUserModule, decorators: [{
3270
3464
  type: NgModule,
3271
3465
  args: [{
@@ -3275,13 +3469,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3275
3469
  CommonModule,
3276
3470
  FormsModule,
3277
3471
  ReactiveFormsModule,
3278
- // SpaMatModule,
3279
3472
  TinSpaModule
3280
3473
  ],
3281
3474
  exports: [
3282
3475
  CommonModule,
3283
3476
  FormsModule,
3284
- // SpaMatModule,
3477
+ TinSpaModule,
3285
3478
  ChangePasswordComponent,
3286
3479
  ProfileComponent,
3287
3480
  ],
@@ -3587,10 +3780,10 @@ class RolesComponent {
3587
3780
  }
3588
3781
  }
3589
3782
  RolesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: RolesComponent, deps: [{ token: HttpService }, { token: i1$3.Router }, { token: AuthService }, { token: DataServiceLib }, { token: i4.MatDialog }, { token: MessageService }], target: i0.ɵɵFactoryTarget.Component });
3590
- RolesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: RolesComponent, selector: "spa-roles", ngImport: i0, template: "<h4> Roles </h4>\r\n<hr />\r\n\r\n<div class=\"container mb-5\">\r\n\r\n <div class=\"row justify-content-between\" style=\"padding-bottom: 10px;padding-left:10px\">\r\n <div class=\"col-2\">\r\n\r\n <button id=\"btnNewRole\" mat-raised-button color=\"primary\" (click)=\"addRole()\">New Role</button>\r\n </div>\r\n <div class=\"col-1\">\r\n\r\n <button id=\"btnRefresh\" mat-mini-fab color=\"primary\" (click)=\"refresh()\" style=\"margin-right:1em;margin-top:5px\" matTooltip=\"refresh data\" matTooltipPosition=\"right\"><mat-icon class=\"refreshIcon\">refresh</mat-icon></button>\r\n\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\" style=\"margin-left:10px\" *ngFor=\"let role of roles\">\r\n\r\n <mat-card class=\"mat-elevation-z8\" style=\"width:100%;padding-left:2em\">\r\n\r\n <h4>{{role.roleName}}</h4>\r\n <hr />\r\n\r\n <div class=\"row\" style=\"margin-left: 2em;\">\r\n\r\n\r\n <div class=\"row\" style=\"margin-right:20px;\" *ngFor=\"let capItem of appConfig.capItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\" font-size:12px; width: 200px;\" [(ngModel)]=\"role[capItem.name]\">{{capItem.display}}</mat-checkbox>\r\n\r\n <div class=\"row\" style=\"margin-right:20px;margin-left: 0px; \" *ngFor=\"let capSubItem of capItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\" font-size:12px; width: 200px;\" [(ngModel)]=\"role[capSubItem.name]\">{{capSubItem.display}}</mat-checkbox>\r\n\r\n <div class=\"row\" style=\"margin-right:20px;margin-left: 0px;\" *ngFor=\"let capSubSubItem of capSubItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"font-size:12px; width: 200px;\" [(ngModel)]=\"role[capSubSubItem.name]\">{{capSubSubItem.display}}</mat-checkbox>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <mat-card-actions>\r\n\r\n <button mat-mini-fab color=\"primary\" (click)=\"updateRole(role)\" style=\"margin-right:10px;\">\r\n <mat-icon>done_all</mat-icon>\r\n </button>\r\n\r\n <!-- <button mat-mini-fab color=\"warn\" (click)=\"editRole(role)\" style=\"margin-right:10px\">\r\n <mat-icon>edit</mat-icon>\r\n </button> -->\r\n\r\n <button mat-mini-fab color=\"warn\" (click)=\"deleteRole(role)\" style=\"margin-right:10px\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n\r\n </mat-card-actions>\r\n\r\n </mat-card>\r\n\r\n </div>\r\n\r\n\r\n</div>\r\n\r\n", styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.refreshIcon{font-size:22px!important;margin-top:-7px!important}\n"], dependencies: [{ kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i14.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i14.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
3783
+ RolesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: RolesComponent, selector: "spa-roles", ngImport: i0, template: "<h4> Roles </h4>\r\n<hr />\r\n\r\n<div class=\"container mb-5\">\r\n\r\n <div class=\"d-flex justify-content-between mb-2\">\r\n\r\n <div >\r\n <button id=\"btnNewRole\" mat-raised-button color=\"primary\" (click)=\"addRole()\">New Role</button>\r\n </div>\r\n\r\n <div class=\"d-flex justify-content-end\">\r\n <button id=\"btnRefresh\" mat-mini-fab color=\"primary\" (click)=\"refresh()\" matTooltip=\"refresh data\" matTooltipPosition=\"right\"><mat-icon class=\"refreshIcon\">refresh</mat-icon></button>\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\" *ngFor=\"let role of roles\">\r\n\r\n <mat-card class=\"mat-elevation-z8\" style=\"width:100%\">\r\n\r\n <h4>{{role.roleName}}</h4>\r\n <hr />\r\n\r\n <div class=\"tin-row\" style=\" font-size:12px;\">\r\n\r\n\r\n <div class=\"tin-row\" *ngFor=\"let capItem of appConfig.capItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"min-width: 200px;\" [(ngModel)]=\"role[capItem.name]\">{{capItem.display}}</mat-checkbox>\r\n\r\n <div class=\"tin-row\" *ngFor=\"let capSubItem of capItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"min-width: 200px;\" [(ngModel)]=\"role[capSubItem.name]\">{{capSubItem.display}}</mat-checkbox>\r\n\r\n <div class=\"tin-row\" *ngFor=\"let capSubSubItem of capSubItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"min-width: 200px;\" [(ngModel)]=\"role[capSubSubItem.name]\">{{capSubSubItem.display}}</mat-checkbox>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <mat-card-actions>\r\n\r\n <button mat-mini-fab color=\"primary\" (click)=\"updateRole(role)\" style=\"margin-right:10px;\">\r\n <mat-icon>done_all</mat-icon>\r\n </button>\r\n\r\n <button mat-mini-fab color=\"warn\" (click)=\"deleteRole(role)\" style=\"margin-right:10px\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n\r\n </mat-card-actions>\r\n\r\n </mat-card>\r\n\r\n </div>\r\n\r\n\r\n</div>\r\n\r\n", styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.refreshIcon{font-size:22px!important;margin-top:-7px!important}\n"], dependencies: [{ kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i14.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i14.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
3591
3784
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: RolesComponent, decorators: [{
3592
3785
  type: Component,
3593
- args: [{ selector: "spa-roles", template: "<h4> Roles </h4>\r\n<hr />\r\n\r\n<div class=\"container mb-5\">\r\n\r\n <div class=\"row justify-content-between\" style=\"padding-bottom: 10px;padding-left:10px\">\r\n <div class=\"col-2\">\r\n\r\n <button id=\"btnNewRole\" mat-raised-button color=\"primary\" (click)=\"addRole()\">New Role</button>\r\n </div>\r\n <div class=\"col-1\">\r\n\r\n <button id=\"btnRefresh\" mat-mini-fab color=\"primary\" (click)=\"refresh()\" style=\"margin-right:1em;margin-top:5px\" matTooltip=\"refresh data\" matTooltipPosition=\"right\"><mat-icon class=\"refreshIcon\">refresh</mat-icon></button>\r\n\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\" style=\"margin-left:10px\" *ngFor=\"let role of roles\">\r\n\r\n <mat-card class=\"mat-elevation-z8\" style=\"width:100%;padding-left:2em\">\r\n\r\n <h4>{{role.roleName}}</h4>\r\n <hr />\r\n\r\n <div class=\"row\" style=\"margin-left: 2em;\">\r\n\r\n\r\n <div class=\"row\" style=\"margin-right:20px;\" *ngFor=\"let capItem of appConfig.capItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\" font-size:12px; width: 200px;\" [(ngModel)]=\"role[capItem.name]\">{{capItem.display}}</mat-checkbox>\r\n\r\n <div class=\"row\" style=\"margin-right:20px;margin-left: 0px; \" *ngFor=\"let capSubItem of capItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\" font-size:12px; width: 200px;\" [(ngModel)]=\"role[capSubItem.name]\">{{capSubItem.display}}</mat-checkbox>\r\n\r\n <div class=\"row\" style=\"margin-right:20px;margin-left: 0px;\" *ngFor=\"let capSubSubItem of capSubItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"font-size:12px; width: 200px;\" [(ngModel)]=\"role[capSubSubItem.name]\">{{capSubSubItem.display}}</mat-checkbox>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <mat-card-actions>\r\n\r\n <button mat-mini-fab color=\"primary\" (click)=\"updateRole(role)\" style=\"margin-right:10px;\">\r\n <mat-icon>done_all</mat-icon>\r\n </button>\r\n\r\n <!-- <button mat-mini-fab color=\"warn\" (click)=\"editRole(role)\" style=\"margin-right:10px\">\r\n <mat-icon>edit</mat-icon>\r\n </button> -->\r\n\r\n <button mat-mini-fab color=\"warn\" (click)=\"deleteRole(role)\" style=\"margin-right:10px\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n\r\n </mat-card-actions>\r\n\r\n </mat-card>\r\n\r\n </div>\r\n\r\n\r\n</div>\r\n\r\n", styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.refreshIcon{font-size:22px!important;margin-top:-7px!important}\n"] }]
3786
+ args: [{ selector: "spa-roles", template: "<h4> Roles </h4>\r\n<hr />\r\n\r\n<div class=\"container mb-5\">\r\n\r\n <div class=\"d-flex justify-content-between mb-2\">\r\n\r\n <div >\r\n <button id=\"btnNewRole\" mat-raised-button color=\"primary\" (click)=\"addRole()\">New Role</button>\r\n </div>\r\n\r\n <div class=\"d-flex justify-content-end\">\r\n <button id=\"btnRefresh\" mat-mini-fab color=\"primary\" (click)=\"refresh()\" matTooltip=\"refresh data\" matTooltipPosition=\"right\"><mat-icon class=\"refreshIcon\">refresh</mat-icon></button>\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\" *ngFor=\"let role of roles\">\r\n\r\n <mat-card class=\"mat-elevation-z8\" style=\"width:100%\">\r\n\r\n <h4>{{role.roleName}}</h4>\r\n <hr />\r\n\r\n <div class=\"tin-row\" style=\" font-size:12px;\">\r\n\r\n\r\n <div class=\"tin-row\" *ngFor=\"let capItem of appConfig.capItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"min-width: 200px;\" [(ngModel)]=\"role[capItem.name]\">{{capItem.display}}</mat-checkbox>\r\n\r\n <div class=\"tin-row\" *ngFor=\"let capSubItem of capItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"min-width: 200px;\" [(ngModel)]=\"role[capSubItem.name]\">{{capSubItem.display}}</mat-checkbox>\r\n\r\n <div class=\"tin-row\" *ngFor=\"let capSubSubItem of capSubItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"min-width: 200px;\" [(ngModel)]=\"role[capSubSubItem.name]\">{{capSubSubItem.display}}</mat-checkbox>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <mat-card-actions>\r\n\r\n <button mat-mini-fab color=\"primary\" (click)=\"updateRole(role)\" style=\"margin-right:10px;\">\r\n <mat-icon>done_all</mat-icon>\r\n </button>\r\n\r\n <button mat-mini-fab color=\"warn\" (click)=\"deleteRole(role)\" style=\"margin-right:10px\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n\r\n </mat-card-actions>\r\n\r\n </mat-card>\r\n\r\n </div>\r\n\r\n\r\n</div>\r\n\r\n", styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.refreshIcon{font-size:22px!important;margin-top:-7px!important}\n"] }]
3594
3787
  }], ctorParameters: function () { return [{ type: HttpService }, { type: i1$3.Router }, { type: AuthService }, { type: DataServiceLib }, { type: i4.MatDialog }, { type: MessageService }]; } });
3595
3788
 
3596
3789
  class CreateAccountComponent {
@@ -3664,10 +3857,9 @@ SpaAdminModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
3664
3857
  SettingsComponent], imports: [i2.ReactiveFormsModule, CommonModule,
3665
3858
  FormsModule,
3666
3859
  ReactiveFormsModule,
3667
- // SpaMatModule,
3668
3860
  TinSpaModule], exports: [CommonModule,
3669
3861
  FormsModule,
3670
- // SpaMatModule,
3862
+ TinSpaModule,
3671
3863
  UsersComponent,
3672
3864
  RolesComponent,
3673
3865
  addRoleDialog,
@@ -3678,9 +3870,9 @@ SpaAdminModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version:
3678
3870
  CommonModule,
3679
3871
  FormsModule,
3680
3872
  ReactiveFormsModule,
3681
- // SpaMatModule,
3682
3873
  TinSpaModule, CommonModule,
3683
- FormsModule] });
3874
+ FormsModule,
3875
+ TinSpaModule] });
3684
3876
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaAdminModule, decorators: [{
3685
3877
  type: NgModule,
3686
3878
  args: [{
@@ -3697,13 +3889,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3697
3889
  CommonModule,
3698
3890
  FormsModule,
3699
3891
  ReactiveFormsModule,
3700
- // SpaMatModule,
3701
3892
  TinSpaModule
3702
3893
  ],
3703
3894
  exports: [
3704
3895
  CommonModule,
3705
3896
  FormsModule,
3706
- // SpaMatModule,
3897
+ TinSpaModule,
3707
3898
  UsersComponent,
3708
3899
  RolesComponent,
3709
3900
  addRoleDialog,