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.
- package/esm2020/lib/classes/Classes.mjs +1 -1
- package/esm2020/lib/classes/TinCore.mjs +80 -1
- package/esm2020/lib/components/date/date.component.mjs +35 -17
- package/esm2020/lib/components/form/form.component.mjs +88 -44
- package/esm2020/lib/components/money/money.component.mjs +60 -16
- package/esm2020/lib/components/number/number.component.mjs +22 -6
- package/esm2020/lib/components/roles/roles.component.mjs +3 -3
- package/esm2020/lib/components/table/detailsDialog.component.mjs +20 -32
- package/esm2020/lib/components/table/table.component.mjs +21 -12
- package/esm2020/lib/components/text/text.component.mjs +7 -4
- package/esm2020/lib/modules/spa-admin.module.mjs +5 -7
- package/esm2020/lib/modules/spa-index.module.mjs +5 -7
- package/esm2020/lib/modules/spa-user.module.mjs +5 -7
- package/fesm2015/tin-spa.mjs +325 -134
- package/fesm2015/tin-spa.mjs.map +1 -1
- package/fesm2020/tin-spa.mjs +324 -134
- package/fesm2020/tin-spa.mjs.map +1 -1
- package/lib/classes/Classes.d.ts +14 -2
- package/lib/classes/TinCore.d.ts +6 -0
- package/lib/components/date/date.component.d.ts +9 -5
- package/lib/components/form/form.component.d.ts +16 -9
- package/lib/components/money/money.component.d.ts +15 -7
- package/lib/components/number/number.component.d.ts +3 -1
- package/lib/components/table/detailsDialog.component.d.ts +0 -2
- package/lib/components/text/text.component.d.ts +1 -1
- package/lib/modules/spa-admin.module.d.ts +1 -1
- package/lib/modules/spa-index.module.d.ts +1 -1
- package/lib/modules/spa-user.module.d.ts +1 -1
- package/package.json +1 -1
package/fesm2020/tin-spa.mjs
CHANGED
|
@@ -185,6 +185,85 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
185
185
|
}], ctorParameters: function () { return []; } });
|
|
186
186
|
|
|
187
187
|
class Core {
|
|
188
|
+
static camelToWords(value) {
|
|
189
|
+
if (!value)
|
|
190
|
+
return value;
|
|
191
|
+
if (typeof value !== 'string')
|
|
192
|
+
return value;
|
|
193
|
+
if (value.length == 0)
|
|
194
|
+
return value;
|
|
195
|
+
let v = value.charAt(0).toUpperCase() + value.substring(1);
|
|
196
|
+
return v.replace(/([A-Z]+)*([A-Z][a-z])/g, "$1 $2");
|
|
197
|
+
}
|
|
198
|
+
static generateObject(fields) {
|
|
199
|
+
let data = {};
|
|
200
|
+
fields.forEach(field => {
|
|
201
|
+
if (field.type != 'section' && field.type != 'blank') {
|
|
202
|
+
data[field.name] = this.getInitialValue(field);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
return data;
|
|
206
|
+
}
|
|
207
|
+
static resetObject(fields, data) {
|
|
208
|
+
fields.forEach(field => {
|
|
209
|
+
if (field.type != 'section' && field.type != 'blank') {
|
|
210
|
+
data[field.name] = this.getInitialValue(field);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
static validateObject(fields, data) {
|
|
215
|
+
console.log("Validations");
|
|
216
|
+
for (let field of fields) {
|
|
217
|
+
let name = this.camelToWords(field.name);
|
|
218
|
+
let d = data[field.name];
|
|
219
|
+
console.log(name);
|
|
220
|
+
if (field.required) {
|
|
221
|
+
if (!d)
|
|
222
|
+
return `${name} is required`;
|
|
223
|
+
if (field.type == 'text') {
|
|
224
|
+
if (d == '')
|
|
225
|
+
return `Please enter ${name}`;
|
|
226
|
+
if (field.min && d.length < field.min)
|
|
227
|
+
return `Minimum ${name} length is ${field.min}`;
|
|
228
|
+
if (field.max && d.length > field.max)
|
|
229
|
+
return `Maximum ${name} length is ${field.max}`;
|
|
230
|
+
}
|
|
231
|
+
else if (field.type == 'number' || field.type == 'money' || field.type == 'date') {
|
|
232
|
+
if (field.min && d < field.min)
|
|
233
|
+
return `Minimum ${name} is ${field.min}`;
|
|
234
|
+
if (field.max && d > field.max)
|
|
235
|
+
return `Maximum ${name} is ${field.max}`;
|
|
236
|
+
}
|
|
237
|
+
else if (field.type == 'select') {
|
|
238
|
+
if (d == '')
|
|
239
|
+
return `Please select ${name}`;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
;
|
|
244
|
+
return '';
|
|
245
|
+
}
|
|
246
|
+
static getInitialValue(field) {
|
|
247
|
+
if (field.defaultValue) {
|
|
248
|
+
return field.defaultValue;
|
|
249
|
+
}
|
|
250
|
+
switch (field.type) {
|
|
251
|
+
case 'text':
|
|
252
|
+
return '';
|
|
253
|
+
case 'money':
|
|
254
|
+
return 0;
|
|
255
|
+
case 'number':
|
|
256
|
+
return 0;
|
|
257
|
+
case 'date':
|
|
258
|
+
return '';
|
|
259
|
+
case 'checkbox':
|
|
260
|
+
return false;
|
|
261
|
+
case 'select':
|
|
262
|
+
return null;
|
|
263
|
+
default:
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
188
267
|
static getClone(x) {
|
|
189
268
|
return JSON.parse(JSON.stringify(x));
|
|
190
269
|
}
|
|
@@ -1015,7 +1094,7 @@ class TextComponent {
|
|
|
1015
1094
|
this.type = "";
|
|
1016
1095
|
this.leave = new EventEmitter();
|
|
1017
1096
|
this.enterPress = new EventEmitter();
|
|
1018
|
-
this.rows =
|
|
1097
|
+
this.rows = 1;
|
|
1019
1098
|
this.width = "100%";
|
|
1020
1099
|
//Autocomplete items
|
|
1021
1100
|
this.options = [];
|
|
@@ -1030,6 +1109,9 @@ class TextComponent {
|
|
|
1030
1109
|
this.control = new FormControl(this.value, [Validators.required, Validators.minLength(this.min), Validators.maxLength(this.max), Validators.pattern(this.regex)]);
|
|
1031
1110
|
}
|
|
1032
1111
|
ngOnInit() {
|
|
1112
|
+
if (!this.options) {
|
|
1113
|
+
this.options = [];
|
|
1114
|
+
}
|
|
1033
1115
|
if (this.options.length > 0) {
|
|
1034
1116
|
this.initFilter();
|
|
1035
1117
|
}
|
|
@@ -1110,10 +1192,10 @@ class TextComponent {
|
|
|
1110
1192
|
}
|
|
1111
1193
|
}
|
|
1112
1194
|
TextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1113
|
-
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 ==
|
|
1195
|
+
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" }] });
|
|
1114
1196
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TextComponent, decorators: [{
|
|
1115
1197
|
type: Component,
|
|
1116
|
-
args: [{ selector: 'spa-text', template: "\r\n<!-- General Text -->\r\n<mat-form-field *ngIf=\"rows ==
|
|
1198
|
+
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" }]
|
|
1117
1199
|
}], ctorParameters: function () { return []; }, propDecorators: { readonly: [{
|
|
1118
1200
|
type: Input
|
|
1119
1201
|
}], hint: [{
|
|
@@ -1206,54 +1288,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
1206
1288
|
|
|
1207
1289
|
class DateComponent {
|
|
1208
1290
|
constructor() {
|
|
1209
|
-
this.
|
|
1291
|
+
this.required = true;
|
|
1292
|
+
this.min = "2023-11-05";
|
|
1293
|
+
this.max = "9999-01-01";
|
|
1294
|
+
this.readonly = false;
|
|
1295
|
+
this.hint = "";
|
|
1210
1296
|
this.value = Core.nowDate(true);
|
|
1211
1297
|
this.display = "";
|
|
1212
|
-
this.
|
|
1298
|
+
this.placeholder = "";
|
|
1213
1299
|
this.width = "100%";
|
|
1214
|
-
this.min = "1900-01-01";
|
|
1215
|
-
this.max = "9999-01-01";
|
|
1216
1300
|
this.valueChange = new EventEmitter();
|
|
1301
|
+
this.control = new FormControl(new Date());
|
|
1217
1302
|
}
|
|
1218
1303
|
ngOnInit() {
|
|
1219
1304
|
this.minDate = new FormControl(new Date(this.min));
|
|
1220
1305
|
this.maxDate = new FormControl(new Date(this.max));
|
|
1221
1306
|
if (!this.value || this.value == "") {
|
|
1222
|
-
this.
|
|
1307
|
+
this.control = new FormControl(new Date());
|
|
1223
1308
|
;
|
|
1224
1309
|
}
|
|
1225
1310
|
setTimeout(() => { this.onChangeEvent(); }, 5);
|
|
1226
1311
|
if (this.readonly) {
|
|
1227
|
-
this.
|
|
1312
|
+
this.control.disable();
|
|
1228
1313
|
}
|
|
1229
1314
|
else {
|
|
1230
|
-
this.
|
|
1315
|
+
this.control.enable();
|
|
1231
1316
|
}
|
|
1232
1317
|
}
|
|
1233
1318
|
ngOnChanges() {
|
|
1234
|
-
this.
|
|
1319
|
+
this.control = new FormControl(new Date(this.value));
|
|
1235
1320
|
}
|
|
1236
1321
|
onChangeEvent() {
|
|
1237
|
-
let d = Core.getFormatedDate2(this.
|
|
1322
|
+
let d = Core.getFormatedDate2(this.control.value, true);
|
|
1238
1323
|
this.valueChange.emit(d);
|
|
1239
1324
|
}
|
|
1325
|
+
validate(control) {
|
|
1326
|
+
if (control.hasError('matDatepickerMin')) {
|
|
1327
|
+
return `Minimun date is ${this.min}`;
|
|
1328
|
+
}
|
|
1329
|
+
if (control.hasError('matDatepickerMax')) {
|
|
1330
|
+
return `Maximum date is ${this.max}`;
|
|
1331
|
+
}
|
|
1332
|
+
return "";
|
|
1333
|
+
}
|
|
1240
1334
|
}
|
|
1241
1335
|
DateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1242
|
-
DateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DateComponent, selector: "spa-date", inputs: {
|
|
1336
|
+
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"] }] });
|
|
1243
1337
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateComponent, decorators: [{
|
|
1244
1338
|
type: Component,
|
|
1245
|
-
args: [{ selector: 'spa-date', template: "\r\n<mat-form-field [ngStyle]=\"{'width':width}\">\r\n<input [formControl]=\"
|
|
1246
|
-
}], ctorParameters: function () { return []; }, propDecorators: {
|
|
1339
|
+
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" }]
|
|
1340
|
+
}], ctorParameters: function () { return []; }, propDecorators: { required: [{
|
|
1247
1341
|
type: Input
|
|
1248
|
-
}],
|
|
1342
|
+
}], min: [{
|
|
1343
|
+
type: Input
|
|
1344
|
+
}], max: [{
|
|
1249
1345
|
type: Input
|
|
1250
1346
|
}], readonly: [{
|
|
1251
1347
|
type: Input
|
|
1252
|
-
}],
|
|
1348
|
+
}], hint: [{
|
|
1253
1349
|
type: Input
|
|
1254
|
-
}],
|
|
1350
|
+
}], value: [{
|
|
1255
1351
|
type: Input
|
|
1256
|
-
}],
|
|
1352
|
+
}], display: [{
|
|
1353
|
+
type: Input
|
|
1354
|
+
}], placeholder: [{
|
|
1355
|
+
type: Input
|
|
1356
|
+
}], width: [{
|
|
1257
1357
|
type: Input
|
|
1258
1358
|
}], valueChange: [{
|
|
1259
1359
|
type: Output
|
|
@@ -1620,15 +1720,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
1620
1720
|
class MoneyComponent {
|
|
1621
1721
|
constructor() {
|
|
1622
1722
|
this.readonly = false;
|
|
1723
|
+
this.hint = "";
|
|
1623
1724
|
this.display = "";
|
|
1624
|
-
this.value = "";
|
|
1625
1725
|
this.placeholder = "";
|
|
1626
|
-
this.
|
|
1627
|
-
this.enterPress = new EventEmitter();
|
|
1628
|
-
this.leave = new EventEmitter();
|
|
1726
|
+
this.value = "";
|
|
1629
1727
|
this.width = "100%";
|
|
1630
|
-
this.hint = "";
|
|
1631
1728
|
this.currency = "";
|
|
1729
|
+
this.valueChange = new EventEmitter();
|
|
1730
|
+
this.leave = new EventEmitter();
|
|
1731
|
+
this.enterPress = new EventEmitter();
|
|
1732
|
+
//validation input
|
|
1733
|
+
this.required = true;
|
|
1734
|
+
this.min = 0;
|
|
1735
|
+
this.max = 9000000000000000; //Math.max 9000000000000000
|
|
1736
|
+
//validation
|
|
1737
|
+
this.control = new FormControl(this.value, [Validators.required, Validators.min(this.min), Validators.max(this.max)]);
|
|
1632
1738
|
}
|
|
1633
1739
|
ngOnInit() {
|
|
1634
1740
|
if (this.placeholder == "") {
|
|
@@ -1637,40 +1743,77 @@ class MoneyComponent {
|
|
|
1637
1743
|
}
|
|
1638
1744
|
ngOnChanges() {
|
|
1639
1745
|
}
|
|
1746
|
+
ngAfterViewInit() {
|
|
1747
|
+
this.initControl(this.control);
|
|
1748
|
+
}
|
|
1749
|
+
initControl(control) {
|
|
1750
|
+
if (this.readonly) {
|
|
1751
|
+
control.setValidators(null);
|
|
1752
|
+
control.updateValueAndValidity();
|
|
1753
|
+
}
|
|
1754
|
+
if (!this.required && !this.readonly) {
|
|
1755
|
+
control.setValidators([Validators.min(this.min), Validators.max(this.max)]);
|
|
1756
|
+
this.control.updateValueAndValidity();
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1640
1759
|
changed(x) {
|
|
1641
1760
|
this.valueChange.emit(x);
|
|
1642
1761
|
}
|
|
1762
|
+
leaved() {
|
|
1763
|
+
this.leave.emit();
|
|
1764
|
+
}
|
|
1643
1765
|
enterPressed() {
|
|
1644
1766
|
this.enterPress.emit();
|
|
1645
1767
|
}
|
|
1646
|
-
|
|
1647
|
-
this.
|
|
1768
|
+
validate(control) {
|
|
1769
|
+
if (this.required && control.hasError('required')) {
|
|
1770
|
+
return `Required`;
|
|
1771
|
+
}
|
|
1772
|
+
if (parseFloat(this.value) < this.min) {
|
|
1773
|
+
return `Minimun value is ${this.min}`;
|
|
1774
|
+
}
|
|
1775
|
+
if (parseFloat(this.value) > this.max) {
|
|
1776
|
+
return `Maximum value is ${this.max}`;
|
|
1777
|
+
}
|
|
1778
|
+
if (control.hasError('min')) {
|
|
1779
|
+
return `Minimun value is ${this.min}`;
|
|
1780
|
+
}
|
|
1781
|
+
if (control.hasError('max')) {
|
|
1782
|
+
return `Maximum value is ${this.max}`;
|
|
1783
|
+
}
|
|
1784
|
+
return "";
|
|
1648
1785
|
}
|
|
1649
1786
|
}
|
|
1650
1787
|
MoneyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MoneyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1651
|
-
MoneyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: MoneyComponent, selector: "spa-money", inputs: { readonly: "readonly",
|
|
1788
|
+
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}} </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]" }] });
|
|
1652
1789
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MoneyComponent, decorators: [{
|
|
1653
1790
|
type: Component,
|
|
1654
|
-
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}} </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"] }]
|
|
1791
|
+
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}} </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"] }]
|
|
1655
1792
|
}], ctorParameters: function () { return []; }, propDecorators: { readonly: [{
|
|
1656
1793
|
type: Input
|
|
1794
|
+
}], hint: [{
|
|
1795
|
+
type: Input
|
|
1657
1796
|
}], display: [{
|
|
1658
1797
|
type: Input
|
|
1798
|
+
}], placeholder: [{
|
|
1799
|
+
type: Input
|
|
1659
1800
|
}], value: [{
|
|
1660
1801
|
type: Input
|
|
1661
|
-
}],
|
|
1802
|
+
}], width: [{
|
|
1803
|
+
type: Input
|
|
1804
|
+
}], currency: [{
|
|
1662
1805
|
type: Input
|
|
1663
1806
|
}], valueChange: [{
|
|
1664
1807
|
type: Output
|
|
1665
|
-
}], enterPress: [{
|
|
1666
|
-
type: Output
|
|
1667
1808
|
}], leave: [{
|
|
1668
1809
|
type: Output
|
|
1669
|
-
}],
|
|
1810
|
+
}], enterPress: [{
|
|
1811
|
+
type: Output
|
|
1812
|
+
}], required: [{
|
|
1670
1813
|
type: Input
|
|
1671
|
-
}],
|
|
1814
|
+
}], min: [{
|
|
1672
1815
|
type: Input
|
|
1673
|
-
}],
|
|
1816
|
+
}], max: [{
|
|
1674
1817
|
type: Input
|
|
1675
1818
|
}] } });
|
|
1676
1819
|
|
|
@@ -2169,10 +2312,10 @@ class NumberComponent {
|
|
|
2169
2312
|
this.display = "";
|
|
2170
2313
|
this.placeholder = "";
|
|
2171
2314
|
this.value = 0;
|
|
2315
|
+
this.width = "100%";
|
|
2172
2316
|
this.valueChange = new EventEmitter();
|
|
2173
2317
|
this.leave = new EventEmitter();
|
|
2174
2318
|
this.enterPress = new EventEmitter();
|
|
2175
|
-
this.width = "100%";
|
|
2176
2319
|
//validation input
|
|
2177
2320
|
this.required = true;
|
|
2178
2321
|
this.min = 0;
|
|
@@ -2182,6 +2325,22 @@ class NumberComponent {
|
|
|
2182
2325
|
this.control = new FormControl(this.value, [Validators.required, Validators.min(this.min), Validators.max(this.max)]);
|
|
2183
2326
|
}
|
|
2184
2327
|
ngOnInit() {
|
|
2328
|
+
if (this.placeholder == "") {
|
|
2329
|
+
this.placeholder = "Enter " + this.display;
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
ngAfterViewInit() {
|
|
2333
|
+
this.initControl(this.control);
|
|
2334
|
+
}
|
|
2335
|
+
initControl(control) {
|
|
2336
|
+
if (this.readonly) {
|
|
2337
|
+
control.setValidators(null);
|
|
2338
|
+
control.updateValueAndValidity();
|
|
2339
|
+
}
|
|
2340
|
+
if (!this.required && !this.readonly) {
|
|
2341
|
+
control.setValidators([Validators.minLength(this.min), Validators.maxLength(this.max)]);
|
|
2342
|
+
this.control.updateValueAndValidity();
|
|
2343
|
+
}
|
|
2185
2344
|
}
|
|
2186
2345
|
changed() {
|
|
2187
2346
|
this.valueChange.emit(this.value);
|
|
@@ -2197,10 +2356,10 @@ class NumberComponent {
|
|
|
2197
2356
|
return `Required`;
|
|
2198
2357
|
}
|
|
2199
2358
|
if (control.hasError('min')) {
|
|
2200
|
-
return `Minimun
|
|
2359
|
+
return `Minimun value is ${this.min}`;
|
|
2201
2360
|
}
|
|
2202
2361
|
if (control.hasError('max')) {
|
|
2203
|
-
return `Maximum
|
|
2362
|
+
return `Maximum value is ${this.max}`;
|
|
2204
2363
|
}
|
|
2205
2364
|
return "";
|
|
2206
2365
|
}
|
|
@@ -2220,14 +2379,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2220
2379
|
type: Input
|
|
2221
2380
|
}], value: [{
|
|
2222
2381
|
type: Input
|
|
2382
|
+
}], width: [{
|
|
2383
|
+
type: Input
|
|
2223
2384
|
}], valueChange: [{
|
|
2224
2385
|
type: Output
|
|
2225
2386
|
}], leave: [{
|
|
2226
2387
|
type: Output
|
|
2227
2388
|
}], enterPress: [{
|
|
2228
2389
|
type: Output
|
|
2229
|
-
}], width: [{
|
|
2230
|
-
type: Input
|
|
2231
2390
|
}], required: [{
|
|
2232
2391
|
type: Input
|
|
2233
2392
|
}], min: [{
|
|
@@ -2260,55 +2419,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2260
2419
|
}] });
|
|
2261
2420
|
|
|
2262
2421
|
class FormComponent {
|
|
2263
|
-
constructor() {
|
|
2422
|
+
constructor(messageService, dataService) {
|
|
2423
|
+
this.messageService = messageService;
|
|
2424
|
+
this.dataService = dataService;
|
|
2425
|
+
this.buttonDisplay = "Submit";
|
|
2426
|
+
this.isProcessing = false;
|
|
2427
|
+
this.multiColumn = false;
|
|
2428
|
+
this.buttonClick = new EventEmitter();
|
|
2429
|
+
}
|
|
2264
2430
|
ngOnInit() {
|
|
2265
|
-
if (!this.fields) {
|
|
2266
|
-
this.
|
|
2431
|
+
if (!this.config.fields) {
|
|
2432
|
+
this.messageService.toast("Please Configure Form Fields");
|
|
2433
|
+
return;
|
|
2434
|
+
}
|
|
2435
|
+
if (!this.data) {
|
|
2436
|
+
this.messageService.toast("Please Configure Form Data");
|
|
2437
|
+
return;
|
|
2438
|
+
}
|
|
2439
|
+
this.fields = this.config.fields;
|
|
2440
|
+
if (this.config.multiColumn) {
|
|
2441
|
+
this.multiColumn = this.config.multiColumn;
|
|
2267
2442
|
}
|
|
2268
|
-
|
|
2269
|
-
this.
|
|
2443
|
+
else {
|
|
2444
|
+
this.multiColumn = this.fields.length > 2;
|
|
2445
|
+
}
|
|
2446
|
+
if (this.config?.button?.display) {
|
|
2447
|
+
this.buttonDisplay = this.config.button.display;
|
|
2270
2448
|
}
|
|
2271
2449
|
}
|
|
2272
2450
|
ngOnChanges() {
|
|
2273
2451
|
console.log("changed");
|
|
2274
2452
|
}
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
this.
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2453
|
+
buttonClicked() {
|
|
2454
|
+
console.log("Button Clicked");
|
|
2455
|
+
this.buttonClick.emit(this.data);
|
|
2456
|
+
console.log(this.data);
|
|
2457
|
+
let button = this.config.button;
|
|
2458
|
+
if (!button) {
|
|
2459
|
+
return;
|
|
2460
|
+
}
|
|
2461
|
+
//validation
|
|
2462
|
+
let resp = Core.validateObject(this.fields, this.data);
|
|
2463
|
+
if (resp != '') {
|
|
2464
|
+
this.messageService.toast(resp);
|
|
2465
|
+
return;
|
|
2466
|
+
}
|
|
2467
|
+
if (button.confirm) {
|
|
2468
|
+
this.messageService.confirm(`${button.confirm.message}`).subscribe((result) => {
|
|
2469
|
+
if (result == "yes") {
|
|
2470
|
+
this.processCall(button);
|
|
2471
|
+
}
|
|
2472
|
+
});
|
|
2473
|
+
}
|
|
2474
|
+
else {
|
|
2475
|
+
this.processCall(button);
|
|
2297
2476
|
}
|
|
2298
2477
|
}
|
|
2299
|
-
|
|
2300
|
-
|
|
2478
|
+
processCall(button) {
|
|
2479
|
+
if (!button.action)
|
|
2480
|
+
return;
|
|
2481
|
+
this.isProcessing = true;
|
|
2482
|
+
this.dataService.CallApi(button.action, this.data).subscribe((apiResponse) => {
|
|
2483
|
+
this.isProcessing = false;
|
|
2484
|
+
if (apiResponse.success) {
|
|
2485
|
+
if (button.action.successMessage) {
|
|
2486
|
+
this.messageService.toast(button.action.successMessage);
|
|
2487
|
+
}
|
|
2488
|
+
else {
|
|
2489
|
+
this.messageService.toast("Submitted");
|
|
2490
|
+
}
|
|
2491
|
+
if (this.config.reset) {
|
|
2492
|
+
Core.resetObject(this.fields, this.data);
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
else {
|
|
2496
|
+
this.messageService.toast("Error: " + apiResponse.message);
|
|
2497
|
+
}
|
|
2498
|
+
});
|
|
2301
2499
|
}
|
|
2302
2500
|
}
|
|
2303
|
-
FormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2304
|
-
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
|
|
2501
|
+
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 });
|
|
2502
|
+
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" }] });
|
|
2305
2503
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FormComponent, decorators: [{
|
|
2306
2504
|
type: Component,
|
|
2307
|
-
args: [{ selector: 'spa-form', template: "\n<div
|
|
2308
|
-
}], ctorParameters: function () { return []; }, propDecorators: { data: [{
|
|
2505
|
+
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"] }]
|
|
2506
|
+
}], ctorParameters: function () { return [{ type: MessageService }, { type: DataServiceLib }]; }, propDecorators: { data: [{
|
|
2309
2507
|
type: Input
|
|
2310
2508
|
}], config: [{
|
|
2311
2509
|
type: Input
|
|
2510
|
+
}], buttonClick: [{
|
|
2511
|
+
type: Output
|
|
2312
2512
|
}] } });
|
|
2313
2513
|
|
|
2314
2514
|
class detailsDialog {
|
|
@@ -2327,46 +2527,27 @@ class detailsDialog {
|
|
|
2327
2527
|
this.formConfig.mode = this.data.mode;
|
|
2328
2528
|
this.smallScreen = this.data.smallScreen;
|
|
2329
2529
|
if (this.formConfig.mode == "create") {
|
|
2330
|
-
this.details =
|
|
2530
|
+
this.details = Core.generateObject(this.formConfig.fields);
|
|
2331
2531
|
}
|
|
2332
2532
|
else {
|
|
2333
2533
|
this.details = this.data.details;
|
|
2334
2534
|
}
|
|
2335
2535
|
this.isLoadComplete = true;
|
|
2336
2536
|
}
|
|
2337
|
-
generateObject() {
|
|
2338
|
-
let d = {};
|
|
2339
|
-
this.formConfig.fields.forEach(property => {
|
|
2340
|
-
d[property.name] = this.getInitialValue(property.type);
|
|
2341
|
-
});
|
|
2342
|
-
return d;
|
|
2343
|
-
}
|
|
2344
2537
|
setMode(newMode) {
|
|
2345
2538
|
this.formConfig.mode = newMode;
|
|
2346
2539
|
}
|
|
2347
|
-
getInitialValue(type) {
|
|
2348
|
-
switch (type) {
|
|
2349
|
-
case 'text':
|
|
2350
|
-
return '';
|
|
2351
|
-
case 'money':
|
|
2352
|
-
return 0;
|
|
2353
|
-
case 'number':
|
|
2354
|
-
return 0;
|
|
2355
|
-
case 'date':
|
|
2356
|
-
return '';
|
|
2357
|
-
case 'checkbox':
|
|
2358
|
-
return false;
|
|
2359
|
-
case 'select':
|
|
2360
|
-
return null;
|
|
2361
|
-
default:
|
|
2362
|
-
return null;
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
2540
|
create() {
|
|
2366
2541
|
console.log(this.details);
|
|
2542
|
+
//validation
|
|
2543
|
+
let resp = Core.validateObject(this.formConfig.fields, this.details);
|
|
2544
|
+
if (resp != '') {
|
|
2545
|
+
this.messageService.toast(resp);
|
|
2546
|
+
return;
|
|
2547
|
+
}
|
|
2367
2548
|
let b = this.tableConfig.buttons.find(x => x.name == "create");
|
|
2368
|
-
if (!b) {
|
|
2369
|
-
this.dialogRef.close({ message: '
|
|
2549
|
+
if (!b || !b.action) {
|
|
2550
|
+
this.dialogRef.close({ message: 'emit', data: this.details });
|
|
2370
2551
|
return;
|
|
2371
2552
|
}
|
|
2372
2553
|
this.isProcessing = true;
|
|
@@ -2388,9 +2569,15 @@ class detailsDialog {
|
|
|
2388
2569
|
}
|
|
2389
2570
|
edit() {
|
|
2390
2571
|
console.log("Edit");
|
|
2572
|
+
//validation
|
|
2573
|
+
let resp = Core.validateObject(this.formConfig.fields, this.details);
|
|
2574
|
+
if (resp != '') {
|
|
2575
|
+
this.messageService.toast(resp);
|
|
2576
|
+
return;
|
|
2577
|
+
}
|
|
2391
2578
|
let b = this.tableConfig.buttons.find(x => x.name == "edit");
|
|
2392
|
-
if (!b) {
|
|
2393
|
-
this.dialogRef.close({ message: '
|
|
2579
|
+
if (!b || !b.action) {
|
|
2580
|
+
this.dialogRef.close({ message: 'emit', data: this.details });
|
|
2394
2581
|
return;
|
|
2395
2582
|
}
|
|
2396
2583
|
this.isProcessing = true;
|
|
@@ -2440,7 +2627,7 @@ class detailsDialog {
|
|
|
2440
2627
|
}
|
|
2441
2628
|
}
|
|
2442
2629
|
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 });
|
|
2443
|
-
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" }] });
|
|
2630
|
+
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" }] });
|
|
2444
2631
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: detailsDialog, decorators: [{
|
|
2445
2632
|
type: Component,
|
|
2446
2633
|
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"] }]
|
|
@@ -2590,12 +2777,12 @@ class TableComponent {
|
|
|
2590
2777
|
// this.doAction('view', x);
|
|
2591
2778
|
}
|
|
2592
2779
|
create(x) {
|
|
2593
|
-
console.log("Create");
|
|
2780
|
+
console.log("Create " + x);
|
|
2594
2781
|
this.createClick.emit(x);
|
|
2595
2782
|
this.doAction('create', x);
|
|
2596
2783
|
}
|
|
2597
2784
|
edit(x) {
|
|
2598
|
-
console.log("Edit");
|
|
2785
|
+
console.log("Edit " + x);
|
|
2599
2786
|
this.editClick.emit(x);
|
|
2600
2787
|
this.doAction('edit', x);
|
|
2601
2788
|
}
|
|
@@ -2654,10 +2841,13 @@ class TableComponent {
|
|
|
2654
2841
|
data: { mode: "create", config: this.config, smallScreen: this.smallScreen }
|
|
2655
2842
|
});
|
|
2656
2843
|
dialogRef.afterClosed().subscribe((result) => {
|
|
2657
|
-
if (result.message) {
|
|
2844
|
+
if (result.message == "success") {
|
|
2658
2845
|
this.create(result.data);
|
|
2659
2846
|
this.refreshClicked();
|
|
2660
2847
|
}
|
|
2848
|
+
else if (result.message == "emit") {
|
|
2849
|
+
this.create(result.data);
|
|
2850
|
+
}
|
|
2661
2851
|
});
|
|
2662
2852
|
}
|
|
2663
2853
|
editModel(row) {
|
|
@@ -2675,10 +2865,13 @@ class TableComponent {
|
|
|
2675
2865
|
data: { mode: "edit", config: this.config, details: row, smallScreen: this.smallScreen },
|
|
2676
2866
|
});
|
|
2677
2867
|
dialogRef.afterClosed().subscribe((result) => {
|
|
2678
|
-
if (result.message) {
|
|
2868
|
+
if (result.message == "success") {
|
|
2679
2869
|
this.edit(result.data);
|
|
2680
2870
|
this.refreshClicked();
|
|
2681
2871
|
}
|
|
2872
|
+
else if (result.message == "emit") {
|
|
2873
|
+
this.edit(result.data);
|
|
2874
|
+
}
|
|
2682
2875
|
});
|
|
2683
2876
|
}
|
|
2684
2877
|
deleteModel(row) {
|
|
@@ -2700,6 +2893,8 @@ class TableComponent {
|
|
|
2700
2893
|
return;
|
|
2701
2894
|
if (b.action && buttonName != 'delete')
|
|
2702
2895
|
return;
|
|
2896
|
+
if (!b.action)
|
|
2897
|
+
return;
|
|
2703
2898
|
this.dataService.CallApi(b.action, row).subscribe((apiResponse) => {
|
|
2704
2899
|
if (apiResponse.success) {
|
|
2705
2900
|
if (b.action.successMessage) {
|
|
@@ -2711,7 +2906,7 @@ class TableComponent {
|
|
|
2711
2906
|
this.refreshClicked();
|
|
2712
2907
|
}
|
|
2713
2908
|
else {
|
|
2714
|
-
this.messageService.toast("Error: " + apiResponse);
|
|
2909
|
+
this.messageService.toast("Error: " + apiResponse.message);
|
|
2715
2910
|
}
|
|
2716
2911
|
});
|
|
2717
2912
|
}
|
|
@@ -2722,12 +2917,13 @@ class TableComponent {
|
|
|
2722
2917
|
this.dataSource = apiResponse.data;
|
|
2723
2918
|
this.tableDataSource = new MatTableDataSource(apiResponse.data);
|
|
2724
2919
|
this.tableDataSource.paginator = this.tablePaginator;
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2920
|
+
if (apiResponse.success) {
|
|
2921
|
+
this.tableDataSource = new MatTableDataSource(apiResponse.data);
|
|
2922
|
+
this.tableDataSource.paginator = this.tablePaginator;
|
|
2923
|
+
}
|
|
2924
|
+
else {
|
|
2925
|
+
this.messageService.toast("Error: " + JSON.stringify(apiResponse));
|
|
2926
|
+
}
|
|
2731
2927
|
});
|
|
2732
2928
|
}
|
|
2733
2929
|
}
|
|
@@ -3034,10 +3230,9 @@ SpaIndexModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version:
|
|
|
3034
3230
|
SpaIndexModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: SpaIndexModule, declarations: [LoginComponent, SignupComponent, RecoverAccountComponent], imports: [i2.ReactiveFormsModule, CommonModule,
|
|
3035
3231
|
FormsModule,
|
|
3036
3232
|
ReactiveFormsModule,
|
|
3037
|
-
// SpaMatModule,
|
|
3038
3233
|
TinSpaModule], exports: [CommonModule,
|
|
3039
3234
|
FormsModule,
|
|
3040
|
-
|
|
3235
|
+
TinSpaModule,
|
|
3041
3236
|
LoginComponent,
|
|
3042
3237
|
SignupComponent,
|
|
3043
3238
|
RecoverAccountComponent] });
|
|
@@ -3045,9 +3240,9 @@ SpaIndexModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version:
|
|
|
3045
3240
|
CommonModule,
|
|
3046
3241
|
FormsModule,
|
|
3047
3242
|
ReactiveFormsModule,
|
|
3048
|
-
// SpaMatModule,
|
|
3049
3243
|
TinSpaModule, CommonModule,
|
|
3050
|
-
FormsModule
|
|
3244
|
+
FormsModule,
|
|
3245
|
+
TinSpaModule] });
|
|
3051
3246
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaIndexModule, decorators: [{
|
|
3052
3247
|
type: NgModule,
|
|
3053
3248
|
args: [{
|
|
@@ -3057,13 +3252,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3057
3252
|
CommonModule,
|
|
3058
3253
|
FormsModule,
|
|
3059
3254
|
ReactiveFormsModule,
|
|
3060
|
-
// SpaMatModule,
|
|
3061
3255
|
TinSpaModule
|
|
3062
3256
|
],
|
|
3063
3257
|
exports: [
|
|
3064
3258
|
CommonModule,
|
|
3065
3259
|
FormsModule,
|
|
3066
|
-
|
|
3260
|
+
TinSpaModule,
|
|
3067
3261
|
LoginComponent,
|
|
3068
3262
|
SignupComponent,
|
|
3069
3263
|
RecoverAccountComponent,
|
|
@@ -3238,19 +3432,18 @@ SpaUserModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
|
3238
3432
|
SpaUserModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: SpaUserModule, declarations: [ChangePasswordComponent, ProfileComponent], imports: [i2.ReactiveFormsModule, CommonModule,
|
|
3239
3433
|
FormsModule,
|
|
3240
3434
|
ReactiveFormsModule,
|
|
3241
|
-
// SpaMatModule,
|
|
3242
3435
|
TinSpaModule], exports: [CommonModule,
|
|
3243
3436
|
FormsModule,
|
|
3244
|
-
|
|
3437
|
+
TinSpaModule,
|
|
3245
3438
|
ChangePasswordComponent,
|
|
3246
3439
|
ProfileComponent] });
|
|
3247
3440
|
SpaUserModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUserModule, imports: [ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: "never" }),
|
|
3248
3441
|
CommonModule,
|
|
3249
3442
|
FormsModule,
|
|
3250
3443
|
ReactiveFormsModule,
|
|
3251
|
-
// SpaMatModule,
|
|
3252
3444
|
TinSpaModule, CommonModule,
|
|
3253
|
-
FormsModule
|
|
3445
|
+
FormsModule,
|
|
3446
|
+
TinSpaModule] });
|
|
3254
3447
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUserModule, decorators: [{
|
|
3255
3448
|
type: NgModule,
|
|
3256
3449
|
args: [{
|
|
@@ -3260,13 +3453,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3260
3453
|
CommonModule,
|
|
3261
3454
|
FormsModule,
|
|
3262
3455
|
ReactiveFormsModule,
|
|
3263
|
-
// SpaMatModule,
|
|
3264
3456
|
TinSpaModule
|
|
3265
3457
|
],
|
|
3266
3458
|
exports: [
|
|
3267
3459
|
CommonModule,
|
|
3268
3460
|
FormsModule,
|
|
3269
|
-
|
|
3461
|
+
TinSpaModule,
|
|
3270
3462
|
ChangePasswordComponent,
|
|
3271
3463
|
ProfileComponent,
|
|
3272
3464
|
],
|
|
@@ -3570,10 +3762,10 @@ class RolesComponent {
|
|
|
3570
3762
|
}
|
|
3571
3763
|
}
|
|
3572
3764
|
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 });
|
|
3573
|
-
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=\"
|
|
3765
|
+
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"] }] });
|
|
3574
3766
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: RolesComponent, decorators: [{
|
|
3575
3767
|
type: Component,
|
|
3576
|
-
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=\"
|
|
3768
|
+
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"] }]
|
|
3577
3769
|
}], ctorParameters: function () { return [{ type: HttpService }, { type: i1$3.Router }, { type: AuthService }, { type: DataServiceLib }, { type: i4.MatDialog }, { type: MessageService }]; } });
|
|
3578
3770
|
|
|
3579
3771
|
class CreateAccountComponent {
|
|
@@ -3647,10 +3839,9 @@ SpaAdminModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
|
|
|
3647
3839
|
SettingsComponent], imports: [i2.ReactiveFormsModule, CommonModule,
|
|
3648
3840
|
FormsModule,
|
|
3649
3841
|
ReactiveFormsModule,
|
|
3650
|
-
// SpaMatModule,
|
|
3651
3842
|
TinSpaModule], exports: [CommonModule,
|
|
3652
3843
|
FormsModule,
|
|
3653
|
-
|
|
3844
|
+
TinSpaModule,
|
|
3654
3845
|
UsersComponent,
|
|
3655
3846
|
RolesComponent,
|
|
3656
3847
|
addRoleDialog,
|
|
@@ -3661,9 +3852,9 @@ SpaAdminModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version:
|
|
|
3661
3852
|
CommonModule,
|
|
3662
3853
|
FormsModule,
|
|
3663
3854
|
ReactiveFormsModule,
|
|
3664
|
-
// SpaMatModule,
|
|
3665
3855
|
TinSpaModule, CommonModule,
|
|
3666
|
-
FormsModule
|
|
3856
|
+
FormsModule,
|
|
3857
|
+
TinSpaModule] });
|
|
3667
3858
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaAdminModule, decorators: [{
|
|
3668
3859
|
type: NgModule,
|
|
3669
3860
|
args: [{
|
|
@@ -3680,13 +3871,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3680
3871
|
CommonModule,
|
|
3681
3872
|
FormsModule,
|
|
3682
3873
|
ReactiveFormsModule,
|
|
3683
|
-
// SpaMatModule,
|
|
3684
3874
|
TinSpaModule
|
|
3685
3875
|
],
|
|
3686
3876
|
exports: [
|
|
3687
3877
|
CommonModule,
|
|
3688
3878
|
FormsModule,
|
|
3689
|
-
|
|
3879
|
+
TinSpaModule,
|
|
3690
3880
|
UsersComponent,
|
|
3691
3881
|
RolesComponent,
|
|
3692
3882
|
addRoleDialog,
|