@pepperi-addons/ngx-lib 0.2.51-beta.21 → 0.2.51-beta.25
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/bundles/pepperi-addons-ngx-lib-form.umd.js +78 -69
- package/bundles/pepperi-addons-ngx-lib-form.umd.js.map +1 -1
- package/esm2015/form/field-generator.component.js +7 -1
- package/esm2015/form/form.component.js +24 -24
- package/fesm2015/pepperi-addons-ngx-lib-form.js +29 -24
- package/fesm2015/pepperi-addons-ngx-lib-form.js.map +1 -1
- package/form/field-generator.component.d.ts +3 -1
- package/form/form.component.d.ts +4 -0
- package/form/pepperi-addons-ngx-lib-form.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -347,6 +347,7 @@
|
|
|
347
347
|
// payLoad = '';
|
|
348
348
|
this.rows = [];
|
|
349
349
|
this.fields = [];
|
|
350
|
+
this._fieldsSubject = new rxjs.BehaviorSubject([]);
|
|
350
351
|
this.columns = 1;
|
|
351
352
|
this.hasMenuFloatingOnOtherField = false;
|
|
352
353
|
this.indicatorsDataField = null;
|
|
@@ -372,6 +373,13 @@
|
|
|
372
373
|
enumerable: false,
|
|
373
374
|
configurable: true
|
|
374
375
|
});
|
|
376
|
+
Object.defineProperty(PepFormComponent.prototype, "fields$", {
|
|
377
|
+
get: function () {
|
|
378
|
+
return this._fieldsSubject.asObservable();
|
|
379
|
+
},
|
|
380
|
+
enumerable: false,
|
|
381
|
+
configurable: true
|
|
382
|
+
});
|
|
375
383
|
Object.defineProperty(PepFormComponent.prototype, "shouldReloadForm", {
|
|
376
384
|
get: function () {
|
|
377
385
|
return this._shouldReloadForm;
|
|
@@ -1027,6 +1035,7 @@
|
|
|
1027
1035
|
// this.layoutType === 'form' ||
|
|
1028
1036
|
this.layoutType === 'table') {
|
|
1029
1037
|
this.fields = fields;
|
|
1038
|
+
this._fieldsSubject.next(fields);
|
|
1030
1039
|
this.rows = [];
|
|
1031
1040
|
for (var i = 0; i <= maxRow; i++) {
|
|
1032
1041
|
this.rows[i] = [];
|
|
@@ -1138,19 +1147,21 @@
|
|
|
1138
1147
|
: f1.col < f2.col
|
|
1139
1148
|
? -1
|
|
1140
1149
|
: 0; });
|
|
1150
|
+
this._fieldsSubject.next(fields);
|
|
1141
1151
|
}
|
|
1142
1152
|
}
|
|
1143
1153
|
};
|
|
1144
1154
|
PepFormComponent.prototype.setForm = function (isForUpdate) {
|
|
1145
|
-
var e_4, _b, e_5, _c;
|
|
1155
|
+
var e_4, _b, e_5, _c, e_6, _d;
|
|
1156
|
+
var _this = this;
|
|
1146
1157
|
if (isForUpdate === void 0) { isForUpdate = false; }
|
|
1147
1158
|
var _a;
|
|
1148
1159
|
var allFieldsAreReadOnly = true;
|
|
1149
1160
|
if (!isForUpdate) {
|
|
1150
1161
|
var fields = [];
|
|
1151
1162
|
try {
|
|
1152
|
-
for (var
|
|
1153
|
-
var currentField =
|
|
1163
|
+
for (var _e = __values(this.fields), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1164
|
+
var currentField = _f.value;
|
|
1154
1165
|
// Add all fields except 'internalPage' (for children).
|
|
1155
1166
|
if (currentField.controlType !== 'internalPage') {
|
|
1156
1167
|
fields.push(currentField);
|
|
@@ -1163,81 +1174,64 @@
|
|
|
1163
1174
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1164
1175
|
finally {
|
|
1165
1176
|
try {
|
|
1166
|
-
if (
|
|
1177
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1167
1178
|
}
|
|
1168
1179
|
finally { if (e_4) throw e_4.error; }
|
|
1169
1180
|
}
|
|
1170
1181
|
this.form = this.toControlGroup(fields);
|
|
1171
1182
|
}
|
|
1172
1183
|
else {
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
// let currentGroupField = currentField.groupFields[j];
|
|
1181
|
-
for (var _j = (e_6 = void 0, __values(currentField.groupFields)), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1182
|
-
var currentGroupField = _k.value;
|
|
1183
|
-
var fieldFormattedValue = this_1.getFieldFormattedValue(currentGroupField);
|
|
1184
|
-
this_1.customizationService.updateFormField(this_1.form, currentGroupField, fieldFormattedValue, currentField);
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1188
|
-
finally {
|
|
1184
|
+
try {
|
|
1185
|
+
// Update form values if changed by calculated fields.
|
|
1186
|
+
for (var _g = __values(this.fields), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1187
|
+
var currentField = _h.value;
|
|
1188
|
+
if (currentField.controlType !== 'internalPage') {
|
|
1189
|
+
if (currentField.groupFields &&
|
|
1190
|
+
currentField.groupFields.length > 0) {
|
|
1189
1191
|
try {
|
|
1190
|
-
|
|
1192
|
+
// for (let j = 0; j < currentField.groupFields.length; j++) {
|
|
1193
|
+
// let currentGroupField = currentField.groupFields[j];
|
|
1194
|
+
for (var _j = (e_6 = void 0, __values(currentField.groupFields)), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1195
|
+
var currentGroupField = _k.value;
|
|
1196
|
+
var fieldFormattedValue = this.getFieldFormattedValue(currentGroupField);
|
|
1197
|
+
this.customizationService.updateFormField(this.form, currentGroupField, fieldFormattedValue, currentField);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1201
|
+
finally {
|
|
1202
|
+
try {
|
|
1203
|
+
if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
|
|
1204
|
+
}
|
|
1205
|
+
finally { if (e_6) throw e_6.error; }
|
|
1191
1206
|
}
|
|
1192
|
-
finally { if (e_6) throw e_6.error; }
|
|
1193
1207
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
currentField = null;
|
|
1203
|
-
setTimeout(function () {
|
|
1204
|
-
// const customField: PepFieldBase = this.convertToCustomField(
|
|
1205
|
-
// field,
|
|
1206
|
-
// dataField,
|
|
1207
|
-
// this.canEditObject,
|
|
1208
|
-
// this.menuDataField,
|
|
1209
|
-
// this.hasCampaignDataField,
|
|
1210
|
-
// this.indicatorsDataField,
|
|
1211
|
-
// this.objectId,
|
|
1212
|
-
// this.parentId,
|
|
1213
|
-
// this.searchCode
|
|
1214
|
-
// );
|
|
1215
|
-
currentField = tmp_1;
|
|
1216
|
-
}, 0);
|
|
1208
|
+
else {
|
|
1209
|
+
var fieldFormattedValue = this.getFieldFormattedValue(currentField);
|
|
1210
|
+
// this.form.controls[currentField.key].setValue(fieldFormattedValue);
|
|
1211
|
+
this.customizationService.updateFormField(this.form, currentField, fieldFormattedValue);
|
|
1212
|
+
// // Hack to override (update) the field.
|
|
1213
|
+
// if (currentField.controlType === 'internalCarusel') {
|
|
1214
|
+
// currentField = this.createCopyField(currentField);
|
|
1215
|
+
// }
|
|
1217
1216
|
}
|
|
1218
1217
|
}
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
}
|
|
1223
|
-
};
|
|
1224
|
-
var this_1 = this;
|
|
1225
|
-
try {
|
|
1226
|
-
// Update form values if changed by calculated fields.
|
|
1227
|
-
for (var _f = __values(this.fields), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1228
|
-
var currentField = _g.value;
|
|
1229
|
-
_loop_1(currentField);
|
|
1218
|
+
if (!currentField.readonly) {
|
|
1219
|
+
allFieldsAreReadOnly = false;
|
|
1220
|
+
}
|
|
1230
1221
|
}
|
|
1231
1222
|
}
|
|
1232
1223
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1233
1224
|
finally {
|
|
1234
1225
|
try {
|
|
1235
|
-
if (
|
|
1226
|
+
if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
|
|
1236
1227
|
}
|
|
1237
1228
|
finally { if (e_5) throw e_5.error; }
|
|
1238
1229
|
}
|
|
1239
|
-
//
|
|
1240
|
-
|
|
1230
|
+
// Hack to override (update) the fields.
|
|
1231
|
+
this._fieldsSubject.next(null);
|
|
1232
|
+
setTimeout(function () {
|
|
1233
|
+
_this._fieldsSubject.next(_this.fields);
|
|
1234
|
+
}, 0);
|
|
1241
1235
|
}
|
|
1242
1236
|
var isFormValid = (_a = this.form) === null || _a === void 0 ? void 0 : _a.valid;
|
|
1243
1237
|
// Change validation to true if all fields are read only.
|
|
@@ -1248,6 +1242,12 @@
|
|
|
1248
1242
|
// Set it to false to enable all fields.
|
|
1249
1243
|
this.isLocked = false;
|
|
1250
1244
|
};
|
|
1245
|
+
PepFormComponent.prototype.createCopyField = function (baseField) {
|
|
1246
|
+
var uiControlField = this.getUiControlFields().find(function (cf) { return cf.ApiName === baseField.key; });
|
|
1247
|
+
var dataField = this.data.Fields.find(function (df) { return df.ApiName === baseField.key; });
|
|
1248
|
+
var customField = this.convertToCustomField(uiControlField, dataField, this.canEditObject, this.menuDataField, this.hasCampaignDataField, this.indicatorsDataField, this.objectId, this.parentId, this.searchCode);
|
|
1249
|
+
return customField;
|
|
1250
|
+
};
|
|
1251
1251
|
PepFormComponent.prototype.initForm = function () {
|
|
1252
1252
|
if (this.data && this.data.Fields) {
|
|
1253
1253
|
var fields = this.convertCustomFields(this.getUiControlFields(), this.data.Fields);
|
|
@@ -1288,33 +1288,32 @@
|
|
|
1288
1288
|
options.pageInfo = updatedField.UIPageInfo;
|
|
1289
1289
|
}
|
|
1290
1290
|
customField.update(options);
|
|
1291
|
-
// customField = JSON.parse(JSON.stringify(customField));
|
|
1292
1291
|
};
|
|
1293
1292
|
PepFormComponent.prototype.updateForm = function () {
|
|
1294
1293
|
var e_7, _b;
|
|
1295
1294
|
if (this.data && this.data.Fields) {
|
|
1296
|
-
var
|
|
1295
|
+
var _loop_1 = function (currentField) {
|
|
1297
1296
|
var e_8, _e;
|
|
1298
|
-
var customField =
|
|
1297
|
+
var customField = this_1.fields.filter(function (f) { return f.key === currentField.ApiName; })[0];
|
|
1299
1298
|
// Update all fields except 'internalPage' type (for children).
|
|
1300
1299
|
if (customField && customField.controlType !== 'internalPage') {
|
|
1301
|
-
|
|
1300
|
+
this_1.updateField(customField, currentField);
|
|
1302
1301
|
// Update the group fields.
|
|
1303
1302
|
if (customField.controlType === 'address' &&
|
|
1304
1303
|
currentField.GroupFields) {
|
|
1305
|
-
var
|
|
1304
|
+
var _loop_2 = function (currentGroupField) {
|
|
1306
1305
|
currentGroupField.Enabled = !currentField.Enabled
|
|
1307
1306
|
? false
|
|
1308
1307
|
: currentGroupField.Enabled;
|
|
1309
1308
|
var customGroupField = customField.groupFields.filter(function (f) { return f.key === currentGroupField.ApiName; })[0];
|
|
1310
|
-
|
|
1309
|
+
this_1.updateField(customGroupField, currentGroupField);
|
|
1311
1310
|
};
|
|
1312
1311
|
try {
|
|
1313
1312
|
// for (let j = 0; j < currentField.GroupFields.length; j++) {
|
|
1314
1313
|
// let currentGroupField = currentField.GroupFields[j];
|
|
1315
1314
|
for (var _f = (e_8 = void 0, __values(currentField.GroupFields)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1316
1315
|
var currentGroupField = _g.value;
|
|
1317
|
-
|
|
1316
|
+
_loop_2(currentGroupField);
|
|
1318
1317
|
}
|
|
1319
1318
|
}
|
|
1320
1319
|
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
@@ -1327,11 +1326,11 @@
|
|
|
1327
1326
|
}
|
|
1328
1327
|
}
|
|
1329
1328
|
};
|
|
1330
|
-
var
|
|
1329
|
+
var this_1 = this;
|
|
1331
1330
|
try {
|
|
1332
1331
|
for (var _c = __values(this.data.Fields), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1333
1332
|
var currentField = _d.value;
|
|
1334
|
-
|
|
1333
|
+
_loop_1(currentField);
|
|
1335
1334
|
}
|
|
1336
1335
|
}
|
|
1337
1336
|
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
@@ -1615,7 +1614,7 @@
|
|
|
1615
1614
|
PepFormComponent.decorators = [
|
|
1616
1615
|
{ type: core.Component, args: [{
|
|
1617
1616
|
selector: 'pep-form',
|
|
1618
|
-
template: "<fieldset *ngIf=\"form\" [formGroup]=\"form\" [disabled]=\"isLocked\" class=\"pep-form\"\n [ngStyle]=\"{ 'background-color': layoutType == 'card' && data?.BackgroundColor }\">\n <!-- New Form -->\n <mat-grid-list *ngIf=\"layoutType == 'form'\" [cols]=\"columns\" [rowHeight]=\"rowHeight + 'rem'\"\n [gutterSize]=\"formGutterSize\">\n <mat-grid-tile *ngFor=\"let field of fields\" [rowspan]=\"field.rowSpan\" [colspan]=\"field.colSpan\">\n <pep-field-generator *ngIf=\"field.controlType != 'placeholder'\" [form]=\"form\" [layoutType]=\"layoutType\"\n [checkForChanges]=\"checkForChanges\" [uid]=\"data?.UID\" [field]=\"field\" [showTitle]=\"showTitle\"\n (valueChange)=\"onValueChanged($event)\" (elementClick)=\"onClick($event)\"\n (internalFormFieldClick)=\"onInternalFormFieldClicked($event)\"\n (internalFormFieldChange)=\"onInternalFormFieldChanged($event)\"\n (formValueChange)=\"onFormValueChanged($event)\" (formFieldClick)=\"onFormFieldClick($event)\"\n (formValidationChange)=\"onFormValidationChanged($event)\">\n </pep-field-generator>\n </mat-grid-tile>\n </mat-grid-list>\n\n <!-- Thumbnails -->\n <mat-grid-list *ngIf=\"layoutType == 'card'\" [cols]=\"columns\" [rowHeight]=\"rowHeight + 'rem'\"\n [gutterSize]=\"cardGutterSize\" class=\"card-spacing\">\n <mat-grid-tile *ngFor=\"let field of fields\" [rowspan]=\"field.rowSpan\" [colspan]=\"field.colSpan\"\n [ngStyle]=\"{ overflow: field.type == 'qs' ? 'unset' : 'hidden' }\">\n <pep-field-generator *ngIf=\"field.controlType != 'placeholder'\" [form]=\"form\" [layoutType]=\"layoutType\"\n [ngClass]=\"{ 'lock-events': lockEvents }\" [isActive]=\"isActive\" [checkForChanges]=\"checkForChanges\"\n [uid]=\"data?.UID\" [field]=\"field\" [showTitle]=\"showTitle\" (valueChange)=\"onValueChanged($event)\"\n (elementClick)=\"onClick($event)\" (internalFormFieldClick)=\"onInternalFormFieldClicked($event)\"\n (internalFormFieldChange)=\"onInternalFormFieldChanged($event)\"\n (formValueChange)=\"onFormValueChanged($event)\" (formFieldClick)=\"onFormFieldClick($event)\">\n </pep-field-generator>\n </mat-grid-tile>\n </mat-grid-list>\n\n <ng-container *ngIf=\"layoutType == 'table'\">\n <ng-container *ngIf=\"isReport; then reportBlock; else notReportBlock\"></ng-container>\n <ng-template #reportBlock>\n <ng-container *ngTemplateOutlet=\"report\"></ng-container>\n </ng-template>\n <ng-template #notReportBlock>\n <div *ngFor=\"let field of fields; let j = index\" class=\"pull-left flip table-cell \"\n [ngClass]=\"['text-align-' + field.xAlignment]\" style=\"height: 100%\"\n [ngStyle]=\"{ width: (layout?.ControlFields)[j]?.calcColumnWidthString}\">\n <pep-field-generator *ngIf=\"field.controlType != 'placeholder'\" [checkForChanges]=\"checkForChanges\"\n [uid]=\"data?.UID\" [field]=\"field\" [form]=\"form\" [layoutType]=\"layoutType\" [showTitle]=\"false\"\n (elementClick)=\"onClick($event)\" (valueChange)=\"onValueChanged($event)\"\n (formValueChange)=\"onFormValueChanged($event)\" (formFieldClick)=\"onFormFieldClick($event)\"\n [isActive]=\"isActive\">\n </pep-field-generator>\n </div>\n </ng-template>\n </ng-container>\n\n <!------- For testing ------------\n {{ form.value | json }}\n {{ form.valid }}\n ---------------------------------->\n</fieldset>\n\n<ng-template #report>\n <div *ngFor=\"let field of fields; let j = index\" class=\"pull-left flip pep-report-fields\"\n [ngStyle]=\"{ width: (layout?.ControlFields)[j]?.calcColumnWidthString }\"\n [ngClass]=\"['text-align-' + field.xAlignment]\">\n <ng-container [ngSwitch]=\"field.controlType\">\n <pep-image *ngSwitchCase=\"'image'\" [uid]=\"data?.UID\" [form]=\"form\" [key]=\"field.key\"\n [src]=\"field.formattedValue\" [srcLarge]=\"field.value\" [options]=\"field.options\" [label]=\"field.label\"\n [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\" [readonly]=\"field.readonly\"\n [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\" [layoutType]=\"layoutType\"\n (elementClick)=\"onClick($event)\">\n </pep-image>\n\n <pep-signature *ngSwitchCase=\"'signature'\" [form]=\"form\" [key]=\"field.key\" [src]=\"field.value\"\n [label]=\"field.label\" [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\"\n [readonly]=\"field.readonly\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [layoutType]=\"layoutType\">\n </pep-signature>\n\n <pep-checkbox *ngSwitchCase=\"'checkbox'\" [form]=\"form\" [key]=\"field.key\"\n [value]=\"(field.value | lowercase) == 'true' || field.value == '1' ? true : false\" [label]=\"field.label\"\n [type]=\"field.type\" [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\"\n [readonly]=\"field.readonly\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [additionalValue]=\"field.additionalValue\" [layoutType]=\"layoutType\">\n </pep-checkbox>\n\n <pep-date *ngSwitchCase=\"'date'\" [form]=\"form\" [key]=\"field.key\" [value]=\"field.value\"\n [formattedValue]=\"field.formattedValue\" [label]=\"field.label\" [type]=\"field.type\"\n [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\" [readonly]=\"field.readonly\"\n [textColor]=\"field.textColor\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [minValue]=\"field.minValue\" [maxValue]=\"field.maxValue\" [layoutType]=\"layoutType\">\n </pep-date>\n\n <pep-internal-button *ngSwitchCase=\"'button'\" [form]=\"form\" [key]=\"field.key\" [value]=\"field.value\"\n [formattedValue]=\"field.formattedValue\" [label]=\"field.label\" [type]=\"field.type\"\n [disabled]=\"field.disabled\" [readonly]=\"field.readonly\" [xAlignment]=\"field.xAlignment\"\n [layoutType]=\"layoutType\" (elementClick)=\"onClick($event)\">\n </pep-internal-button>\n\n <pep-textarea *ngSwitchCase=\"'textarea'\" [form]=\"form\" [key]=\"field.key\" [value]=\"field.value\"\n [label]=\"field.label\" [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\"\n [readonly]=\"field.readonly\" [maxFieldCharacters]=\"field.maxFieldCharacters\"\n [textColor]=\"field.textColor\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [layoutType]=\"layoutType\">\n </pep-textarea>\n\n <pep-quantity-selector *ngSwitchCase=\"'qs'\" [id]=\"field.key\" [form]=\"form\" [key]=\"field.key\"\n [value]=\"field.value\" [formattedValue]=\"field.formattedValue\" [label]=\"field.label\" [type]=\"field.type\"\n [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\" [readonly]=\"field.readonly\"\n [textColor]=\"field.textColor\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [layoutType]=\"layoutType\" (valueChange)=\"onValueChanged($event)\" (elementClick)=\"onClick($event)\">\n </pep-quantity-selector>\n\n <ng-container *ngSwitchDefault>\n <ng-container *ngIf=\"field.formattedValue?.length > 0; then notEmptyBlock; else emptyBlock\">\n </ng-container>\n <ng-template #notEmptyBlock>\n <ng-container\n *ngIf=\"field.controlType === 'attachment' || field.type === 'link'; then linkBlock; else notLinkBlock\">\n </ng-container>\n <ng-template #linkBlock>\n <a [id]=\"field.key\" class=\"color-link body-sm pep-report-input readonly\"\n *ngIf=\"field.formattedValue != null\" title=\"{{ field.formattedValue }}\" target=\"_blank\"\n href=\"{{ field.value }}\">{{ field.formattedValue }}</a>\n </ng-template>\n <ng-template #notLinkBlock>\n <span [id]=\"field.key\" class=\"body-sm pep-report-input readonly\"\n title=\"{{ field.formattedValue }}\" [ngStyle]=\"{ color: field.textColor }\">{{\n field.formattedValue }}</span>\n </ng-template>\n </ng-template>\n <ng-template #emptyBlock>\n <span> </span>\n </ng-template>\n </ng-container>\n </ng-container>\n </div>\n</ng-template>",
|
|
1617
|
+
template: "<fieldset *ngIf=\"form\" [formGroup]=\"form\" [disabled]=\"isLocked\" class=\"pep-form\"\n [ngStyle]=\"{ 'background-color': layoutType == 'card' && data?.BackgroundColor }\">\n <!-- New Form -->\n <mat-grid-list *ngIf=\"layoutType == 'form'\" [cols]=\"columns\" [rowHeight]=\"rowHeight + 'rem'\"\n [gutterSize]=\"formGutterSize\">\n <mat-grid-tile *ngFor=\"let field of fields$ | async\" [rowspan]=\"field.rowSpan\" [colspan]=\"field.colSpan\">\n <pep-field-generator *ngIf=\"field.controlType != 'placeholder'\" [form]=\"form\" [layoutType]=\"layoutType\"\n [checkForChanges]=\"checkForChanges\" [uid]=\"data?.UID\" [field]=\"field\" [showTitle]=\"showTitle\"\n (valueChange)=\"onValueChanged($event)\" (elementClick)=\"onClick($event)\"\n (internalFormFieldClick)=\"onInternalFormFieldClicked($event)\"\n (internalFormFieldChange)=\"onInternalFormFieldChanged($event)\"\n (formValueChange)=\"onFormValueChanged($event)\" (formFieldClick)=\"onFormFieldClick($event)\"\n (formValidationChange)=\"onFormValidationChanged($event)\">\n </pep-field-generator>\n </mat-grid-tile>\n </mat-grid-list>\n\n <!-- Thumbnails -->\n <mat-grid-list *ngIf=\"layoutType == 'card'\" [cols]=\"columns\" [rowHeight]=\"rowHeight + 'rem'\"\n [gutterSize]=\"cardGutterSize\" class=\"card-spacing\">\n <mat-grid-tile *ngFor=\"let field of fields$ | async\" [rowspan]=\"field.rowSpan\" [colspan]=\"field.colSpan\"\n [ngStyle]=\"{ overflow: field.type == 'qs' ? 'unset' : 'hidden' }\">\n <pep-field-generator *ngIf=\"field.controlType != 'placeholder'\" [form]=\"form\" [layoutType]=\"layoutType\"\n [ngClass]=\"{ 'lock-events': lockEvents }\" [isActive]=\"isActive\" [checkForChanges]=\"checkForChanges\"\n [uid]=\"data?.UID\" [field]=\"field\" [showTitle]=\"showTitle\" (valueChange)=\"onValueChanged($event)\"\n (elementClick)=\"onClick($event)\" (internalFormFieldClick)=\"onInternalFormFieldClicked($event)\"\n (internalFormFieldChange)=\"onInternalFormFieldChanged($event)\"\n (formValueChange)=\"onFormValueChanged($event)\" (formFieldClick)=\"onFormFieldClick($event)\">\n </pep-field-generator>\n </mat-grid-tile>\n </mat-grid-list>\n\n <ng-container *ngIf=\"layoutType == 'table'\">\n <ng-container *ngIf=\"isReport; then reportBlock; else notReportBlock\"></ng-container>\n <ng-template #reportBlock>\n <ng-container *ngTemplateOutlet=\"report\"></ng-container>\n </ng-template>\n <ng-template #notReportBlock>\n <div *ngFor=\"let field of fields$ | async; let j = index\" class=\"pull-left flip table-cell \"\n [ngClass]=\"['text-align-' + field.xAlignment]\" style=\"height: 100%\"\n [ngStyle]=\"{ width: (layout?.ControlFields)[j]?.calcColumnWidthString}\">\n <pep-field-generator *ngIf=\"field.controlType != 'placeholder'\" [checkForChanges]=\"checkForChanges\"\n [uid]=\"data?.UID\" [field]=\"field\" [form]=\"form\" [layoutType]=\"layoutType\" [showTitle]=\"false\"\n (elementClick)=\"onClick($event)\" (valueChange)=\"onValueChanged($event)\"\n (formValueChange)=\"onFormValueChanged($event)\" (formFieldClick)=\"onFormFieldClick($event)\"\n [isActive]=\"isActive\">\n </pep-field-generator>\n </div>\n </ng-template>\n </ng-container>\n\n <!------- For testing ------------\n {{ form.value | json }}\n {{ form.valid }}\n ---------------------------------->\n</fieldset>\n\n<ng-template #report>\n <div *ngFor=\"let field of fields$ | async; let j = index\" class=\"pull-left flip pep-report-fields\"\n [ngStyle]=\"{ width: (layout?.ControlFields)[j]?.calcColumnWidthString }\"\n [ngClass]=\"['text-align-' + field.xAlignment]\">\n <ng-container [ngSwitch]=\"field.controlType\">\n <pep-image *ngSwitchCase=\"'image'\" [uid]=\"data?.UID\" [form]=\"form\" [key]=\"field.key\"\n [src]=\"field.formattedValue\" [srcLarge]=\"field.value\" [options]=\"field.options\" [label]=\"field.label\"\n [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\" [readonly]=\"field.readonly\"\n [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\" [layoutType]=\"layoutType\"\n (elementClick)=\"onClick($event)\">\n </pep-image>\n\n <pep-signature *ngSwitchCase=\"'signature'\" [form]=\"form\" [key]=\"field.key\" [src]=\"field.value\"\n [label]=\"field.label\" [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\"\n [readonly]=\"field.readonly\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [layoutType]=\"layoutType\">\n </pep-signature>\n\n <pep-checkbox *ngSwitchCase=\"'checkbox'\" [form]=\"form\" [key]=\"field.key\"\n [value]=\"(field.value | lowercase) == 'true' || field.value == '1' ? true : false\" [label]=\"field.label\"\n [type]=\"field.type\" [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\"\n [readonly]=\"field.readonly\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [additionalValue]=\"field.additionalValue\" [layoutType]=\"layoutType\">\n </pep-checkbox>\n\n <pep-date *ngSwitchCase=\"'date'\" [form]=\"form\" [key]=\"field.key\" [value]=\"field.value\"\n [formattedValue]=\"field.formattedValue\" [label]=\"field.label\" [type]=\"field.type\"\n [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\" [readonly]=\"field.readonly\"\n [textColor]=\"field.textColor\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [minValue]=\"field.minValue\" [maxValue]=\"field.maxValue\" [layoutType]=\"layoutType\">\n </pep-date>\n\n <pep-internal-button *ngSwitchCase=\"'button'\" [form]=\"form\" [key]=\"field.key\" [value]=\"field.value\"\n [formattedValue]=\"field.formattedValue\" [label]=\"field.label\" [type]=\"field.type\"\n [disabled]=\"field.disabled\" [readonly]=\"field.readonly\" [xAlignment]=\"field.xAlignment\"\n [layoutType]=\"layoutType\" (elementClick)=\"onClick($event)\">\n </pep-internal-button>\n\n <pep-textarea *ngSwitchCase=\"'textarea'\" [form]=\"form\" [key]=\"field.key\" [value]=\"field.value\"\n [label]=\"field.label\" [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\"\n [readonly]=\"field.readonly\" [maxFieldCharacters]=\"field.maxFieldCharacters\"\n [textColor]=\"field.textColor\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [layoutType]=\"layoutType\">\n </pep-textarea>\n\n <pep-quantity-selector *ngSwitchCase=\"'qs'\" [id]=\"field.key\" [form]=\"form\" [key]=\"field.key\"\n [value]=\"field.value\" [formattedValue]=\"field.formattedValue\" [label]=\"field.label\" [type]=\"field.type\"\n [mandatory]=\"field.mandatory\" [disabled]=\"field.disabled\" [readonly]=\"field.readonly\"\n [textColor]=\"field.textColor\" [xAlignment]=\"field.xAlignment\" [rowSpan]=\"field.rowSpan\"\n [layoutType]=\"layoutType\" (valueChange)=\"onValueChanged($event)\" (elementClick)=\"onClick($event)\">\n </pep-quantity-selector>\n\n <ng-container *ngSwitchDefault>\n <ng-container *ngIf=\"field.formattedValue?.length > 0; then notEmptyBlock; else emptyBlock\">\n </ng-container>\n <ng-template #notEmptyBlock>\n <ng-container\n *ngIf=\"field.controlType === 'attachment' || field.type === 'link'; then linkBlock; else notLinkBlock\">\n </ng-container>\n <ng-template #linkBlock>\n <a [id]=\"field.key\" class=\"color-link body-sm pep-report-input readonly\"\n *ngIf=\"field.formattedValue != null\" title=\"{{ field.formattedValue }}\" target=\"_blank\"\n href=\"{{ field.value }}\">{{ field.formattedValue }}</a>\n </ng-template>\n <ng-template #notLinkBlock>\n <span [id]=\"field.key\" class=\"body-sm pep-report-input readonly\"\n title=\"{{ field.formattedValue }}\" [ngStyle]=\"{ color: field.textColor }\">{{\n field.formattedValue }}</span>\n </ng-template>\n </ng-template>\n <ng-template #emptyBlock>\n <span> </span>\n </ng-template>\n </ng-container>\n </ng-container>\n </div>\n</ng-template>",
|
|
1619
1618
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
1620
1619
|
styles: [":host{display:grid}"]
|
|
1621
1620
|
},] }
|
|
@@ -1664,6 +1663,16 @@
|
|
|
1664
1663
|
this.formValueChange = new core.EventEmitter();
|
|
1665
1664
|
this.formFieldClick = new core.EventEmitter();
|
|
1666
1665
|
}
|
|
1666
|
+
Object.defineProperty(PepFieldGeneratorComponent.prototype, "field", {
|
|
1667
|
+
get: function () {
|
|
1668
|
+
return this._field;
|
|
1669
|
+
},
|
|
1670
|
+
set: function (value) {
|
|
1671
|
+
this._field = value;
|
|
1672
|
+
},
|
|
1673
|
+
enumerable: false,
|
|
1674
|
+
configurable: true
|
|
1675
|
+
});
|
|
1667
1676
|
Object.defineProperty(PepFieldGeneratorComponent.prototype, "isValid", {
|
|
1668
1677
|
get: function () {
|
|
1669
1678
|
if (this.field.readonly || this.field.disabled) {
|