@pepperi/lib
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1.
834 lines (833 loc) • 232 kB
JavaScript
import { Component, ChangeDetectionStrategy, Input, Output, EventEmitter } from '@angular/core';
import { Validators } from '@angular/forms';
import { DialogData, DialogDataType } from '@pepperi/lib/dialog';
import { LAYOUT_TYPE, FIELD_TYPE, CustomizationService, PepperiTextboxField, PepperiSelectField, PepperiMenuField, PepperiQuantitySelectorField, PepperiAddressField, PepperiIndicatorsField, PepperiInternalPageField, PepperiButtonField, PepperiAttachmentField, PepperiSignatureField, PepperiImageField, PepperiImagesField, PepperiTextareaField, PepperiRichHtmlTextareaField, PepperiDateField, PepperiCheckboxField, PepperiSeparatorField, PepperiPlaceholderField, } from '@pepperi/lib';
import * as i0 from "@angular/core";
import * as i1 from "@pepperi/lib/dialog";
import * as i2 from "@pepperi/lib";
import * as i3 from "@ngx-translate/core";
import * as i4 from "@angular/forms";
import * as i5 from "@angular/common";
import * as i6 from "@angular/material/grid-list";
import * as i7 from "./field-generator.component";
import * as i8 from "@pepperi/lib/image";
import * as i9 from "@pepperi/lib/signature";
import * as i10 from "@pepperi/lib/checkbox";
import * as i11 from "@pepperi/lib/internal-button";
import * as i12 from "@pepperi/lib/textarea";
import * as i13 from "@pepperi/lib/quantity-selector";
function PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_pep_field_generator_1_Template(rf, ctx) { if (rf & 1) {
const _r11 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "pep-field-generator", 10);
i0.ɵɵlistener("valueChanged", function PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_valueChanged_0_listener($event) { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(4); return ctx_r10.onValueChanged($event); })("notifyChildClicked", function PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_notifyChildClicked_0_listener($event) { i0.ɵɵrestoreView(_r11); const ctx_r12 = i0.ɵɵnextContext(4); return ctx_r12.onChildClicked($event); })("childChanged", function PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_childChanged_0_listener($event) { i0.ɵɵrestoreView(_r11); const ctx_r13 = i0.ɵɵnextContext(4); return ctx_r13.onChildChanged($event); })("elementClicked", function PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_elementClicked_0_listener($event) { i0.ɵɵrestoreView(_r11); const ctx_r14 = i0.ɵɵnextContext(4); return ctx_r14.onClick($event); })("notifyMenuItemClicked", function PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_notifyMenuItemClicked_0_listener($event) { i0.ɵɵrestoreView(_r11); const ctx_r15 = i0.ɵɵnextContext(4); return ctx_r15.onMenuItemClicked($event); })("formValidationChanged", function PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_formValidationChanged_0_listener($event) { i0.ɵɵrestoreView(_r11); const ctx_r16 = i0.ɵɵnextContext(4); return ctx_r16.onFormValidationChanged($event); });
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r8 = i0.ɵɵnextContext().$implicit;
const ctx_r9 = i0.ɵɵnextContext(3);
i0.ɵɵproperty("form", ctx_r9.form)("layoutType", ctx_r9.layoutType)("checkForChanges", ctx_r9.checkForChanges)("objectId", ctx_r9.pepperiObjectInput.Data.UID)("hasHeightLimit", !ctx_r9.matrixIsLast)("field", field_r8)("showTitle", ctx_r9.showTitle);
} }
function PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "mat-grid-tile", 8);
i0.ɵɵtemplate(1, PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_pep_field_generator_1_Template, 1, 7, "pep-field-generator", 9);
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r8 = ctx.$implicit;
i0.ɵɵproperty("rowspan", field_r8.rowSpan)("colspan", field_r8.colSpan);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", field_r8.controlType != "placeholder");
} }
function PepperiFormComponent_fieldset_0_mat_grid_list_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "mat-grid-list", 6);
i0.ɵɵtemplate(1, PepperiFormComponent_fieldset_0_mat_grid_list_1_mat_grid_tile_1_Template, 2, 3, "mat-grid-tile", 7);
i0.ɵɵelementEnd();
} if (rf & 2) {
const ctx_r3 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("cols", ctx_r3.columns)("rowHeight", ctx_r3.rowHeight + "rem")("gutterSize", ctx_r3.formGutterSize);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngForOf", ctx_r3.fields);
} }
function PepperiFormComponent_fieldset_0_mat_grid_list_2_mat_grid_tile_1_pep_field_generator_1_Template(rf, ctx) { if (rf & 1) {
const _r22 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "pep-field-generator", 15);
i0.ɵɵlistener("valueChanged", function PepperiFormComponent_fieldset_0_mat_grid_list_2_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_valueChanged_0_listener($event) { i0.ɵɵrestoreView(_r22); const ctx_r21 = i0.ɵɵnextContext(4); return ctx_r21.onValueChanged($event); })("notifyChildClicked", function PepperiFormComponent_fieldset_0_mat_grid_list_2_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_notifyChildClicked_0_listener($event) { i0.ɵɵrestoreView(_r22); const ctx_r23 = i0.ɵɵnextContext(4); return ctx_r23.onChildClicked($event); })("childChanged", function PepperiFormComponent_fieldset_0_mat_grid_list_2_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_childChanged_0_listener($event) { i0.ɵɵrestoreView(_r22); const ctx_r24 = i0.ɵɵnextContext(4); return ctx_r24.onChildChanged($event); })("elementClicked", function PepperiFormComponent_fieldset_0_mat_grid_list_2_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_elementClicked_0_listener($event) { i0.ɵɵrestoreView(_r22); const ctx_r25 = i0.ɵɵnextContext(4); return ctx_r25.onClick($event); })("notifyMenuItemClicked", function PepperiFormComponent_fieldset_0_mat_grid_list_2_mat_grid_tile_1_pep_field_generator_1_Template_pep_field_generator_notifyMenuItemClicked_0_listener($event) { i0.ɵɵrestoreView(_r22); const ctx_r26 = i0.ɵɵnextContext(4); return ctx_r26.onMenuItemClicked($event); });
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r19 = i0.ɵɵnextContext().$implicit;
const ctx_r20 = i0.ɵɵnextContext(3);
i0.ɵɵproperty("form", ctx_r20.form)("layoutType", ctx_r20.layoutType)("isActive", ctx_r20.isActive)("checkForChanges", ctx_r20.checkForChanges)("objectId", ctx_r20.pepperiObjectInput.Data.UID)("hasHeightLimit", !ctx_r20.matrixIsLast)("field", field_r19)("showTitle", ctx_r20.showTitle);
} }
const _c0 = function (a0) { return { overflow: a0 }; };
function PepperiFormComponent_fieldset_0_mat_grid_list_2_mat_grid_tile_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "mat-grid-tile", 13);
i0.ɵɵtemplate(1, PepperiFormComponent_fieldset_0_mat_grid_list_2_mat_grid_tile_1_pep_field_generator_1_Template, 1, 8, "pep-field-generator", 14);
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r19 = ctx.$implicit;
i0.ɵɵproperty("rowspan", field_r19.rowSpan)("colspan", field_r19.colSpan)("ngStyle", i0.ɵɵpureFunction1(4, _c0, field_r19.type == "qs" ? "unset" : "hidden"));
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", field_r19.controlType != "placeholder");
} }
const _c1 = function (a0) { return { "lock-events": a0 }; };
function PepperiFormComponent_fieldset_0_mat_grid_list_2_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "mat-grid-list", 11);
i0.ɵɵtemplate(1, PepperiFormComponent_fieldset_0_mat_grid_list_2_mat_grid_tile_1_Template, 2, 6, "mat-grid-tile", 12);
i0.ɵɵelementEnd();
} if (rf & 2) {
const ctx_r4 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("cols", ctx_r4.columns)("rowHeight", ctx_r4.rowHeight + "rem")("gutterSize", ctx_r4.cardGutterSize)("ngClass", i0.ɵɵpureFunction1(5, _c1, ctx_r4.lockEvents));
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngForOf", ctx_r4.fields);
} }
function PepperiFormComponent_fieldset_0_ng_container_3_ng_container_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementContainer(0);
} }
function PepperiFormComponent_fieldset_0_ng_container_3_ng_template_2_ng_container_0_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementContainer(0);
} }
function PepperiFormComponent_fieldset_0_ng_container_3_ng_template_2_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵtemplate(0, PepperiFormComponent_fieldset_0_ng_container_3_ng_template_2_ng_container_0_Template, 1, 0, "ng-container", 19);
} if (rf & 2) {
i0.ɵɵnextContext(3);
const _r1 = i0.ɵɵreference(2);
i0.ɵɵproperty("ngTemplateOutlet", _r1);
} }
function PepperiFormComponent_fieldset_0_ng_container_3_ng_template_4_div_0_pep_field_generator_1_Template(rf, ctx) { if (rf & 1) {
const _r39 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "pep-field-generator", 23);
i0.ɵɵlistener("valueChanged", function PepperiFormComponent_fieldset_0_ng_container_3_ng_template_4_div_0_pep_field_generator_1_Template_pep_field_generator_valueChanged_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r38 = i0.ɵɵnextContext(5); return ctx_r38.onValueChanged($event); })("elementClicked", function PepperiFormComponent_fieldset_0_ng_container_3_ng_template_4_div_0_pep_field_generator_1_Template_pep_field_generator_elementClicked_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r40 = i0.ɵɵnextContext(5); return ctx_r40.onClick($event); })("notifyMenuItemClicked", function PepperiFormComponent_fieldset_0_ng_container_3_ng_template_4_div_0_pep_field_generator_1_Template_pep_field_generator_notifyMenuItemClicked_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r41 = i0.ɵɵnextContext(5); return ctx_r41.onMenuItemClicked($event); });
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r35 = i0.ɵɵnextContext().$implicit;
const ctx_r37 = i0.ɵɵnextContext(4);
i0.ɵɵproperty("checkForChanges", ctx_r37.checkForChanges)("objectId", ctx_r37.pepperiObjectInput.Data.UID)("field", field_r35)("form", ctx_r37.form)("layoutType", ctx_r37.layoutType)("showTitle", false)("isActive", ctx_r37.isActive);
} }
const _c2 = function (a0) { return [a0]; };
const _c3 = function (a0) { return { width: a0 }; };
function PepperiFormComponent_fieldset_0_ng_container_3_ng_template_4_div_0_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "div", 21);
i0.ɵɵtemplate(1, PepperiFormComponent_fieldset_0_ng_container_3_ng_template_4_div_0_pep_field_generator_1_Template, 1, 7, "pep-field-generator", 22);
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r35 = ctx.$implicit;
const j_r36 = ctx.index;
const ctx_r34 = i0.ɵɵnextContext(4);
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(3, _c2, "text-align-" + field_r35.xAlignment))("ngStyle", i0.ɵɵpureFunction1(5, _c3, ctx_r34.uiControlHeader == null ? null : ctx_r34.uiControlHeader.ControlFields[j_r36] == null ? null : ctx_r34.uiControlHeader.ControlFields[j_r36].calcColumnWidthString));
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", field_r35.controlType != "placeholder");
} }
function PepperiFormComponent_fieldset_0_ng_container_3_ng_template_4_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵtemplate(0, PepperiFormComponent_fieldset_0_ng_container_3_ng_template_4_div_0_Template, 2, 7, "div", 20);
} if (rf & 2) {
const ctx_r32 = i0.ɵɵnextContext(3);
i0.ɵɵproperty("ngForOf", ctx_r32.fields);
} }
function PepperiFormComponent_fieldset_0_ng_container_3_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementContainerStart(0);
i0.ɵɵtemplate(1, PepperiFormComponent_fieldset_0_ng_container_3_ng_container_1_Template, 1, 0, "ng-container", 16);
i0.ɵɵtemplate(2, PepperiFormComponent_fieldset_0_ng_container_3_ng_template_2_Template, 1, 1, "ng-template", null, 17, i0.ɵɵtemplateRefExtractor);
i0.ɵɵtemplate(4, PepperiFormComponent_fieldset_0_ng_container_3_ng_template_4_Template, 1, 1, "ng-template", null, 18, i0.ɵɵtemplateRefExtractor);
i0.ɵɵelementContainerEnd();
} if (rf & 2) {
const _r29 = i0.ɵɵreference(3);
const _r31 = i0.ɵɵreference(5);
const ctx_r5 = i0.ɵɵnextContext(2);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", ctx_r5.isReport)("ngIfThen", _r29)("ngIfElse", _r31);
} }
function PepperiFormComponent_fieldset_0_ng_container_4_div_1_pep_field_generator_1_Template(rf, ctx) { if (rf & 1) {
const _r48 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "pep-field-generator", 27);
i0.ɵɵlistener("valueChanged", function PepperiFormComponent_fieldset_0_ng_container_4_div_1_pep_field_generator_1_Template_pep_field_generator_valueChanged_0_listener($event) { i0.ɵɵrestoreView(_r48); const ctx_r47 = i0.ɵɵnextContext(4); return ctx_r47.onValueChanged($event); })("elementClicked", function PepperiFormComponent_fieldset_0_ng_container_4_div_1_pep_field_generator_1_Template_pep_field_generator_elementClicked_0_listener($event) { i0.ɵɵrestoreView(_r48); const ctx_r49 = i0.ɵɵnextContext(4); return ctx_r49.onClick($event); });
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r44 = i0.ɵɵnextContext().$implicit;
const ctx_r46 = i0.ɵɵnextContext(3);
i0.ɵɵproperty("checkForChanges", ctx_r46.checkForChanges)("objectId", ctx_r46.pepperiObjectInput.Data.UID)("field", field_r44)("form", ctx_r46.form)("layoutType", ctx_r46.layoutType)("showTitle", false)("isActive", ctx_r46.isActive);
} }
function PepperiFormComponent_fieldset_0_ng_container_4_div_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "div", 25);
i0.ɵɵtemplate(1, PepperiFormComponent_fieldset_0_ng_container_4_div_1_pep_field_generator_1_Template, 1, 7, "pep-field-generator", 26);
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r44 = ctx.$implicit;
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", field_r44.controlType != "placeholder");
} }
function PepperiFormComponent_fieldset_0_ng_container_4_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementContainerStart(0);
i0.ɵɵtemplate(1, PepperiFormComponent_fieldset_0_ng_container_4_div_1_Template, 2, 1, "div", 24);
i0.ɵɵelementContainerEnd();
} if (rf & 2) {
const ctx_r6 = i0.ɵɵnextContext(2);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngForOf", ctx_r6.fields);
} }
const _c4 = function (a0) { return { "background-color": a0 }; };
const _c5 = function (a0, a1) { return { "material-form": a0, cardView: a1 }; };
function PepperiFormComponent_fieldset_0_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "fieldset", 2);
i0.ɵɵtemplate(1, PepperiFormComponent_fieldset_0_mat_grid_list_1_Template, 2, 4, "mat-grid-list", 3);
i0.ɵɵtemplate(2, PepperiFormComponent_fieldset_0_mat_grid_list_2_Template, 2, 7, "mat-grid-list", 4);
i0.ɵɵtemplate(3, PepperiFormComponent_fieldset_0_ng_container_3_Template, 6, 3, "ng-container", 5);
i0.ɵɵtemplate(4, PepperiFormComponent_fieldset_0_ng_container_4_Template, 2, 1, "ng-container", 5);
i0.ɵɵelementEnd();
} if (rf & 2) {
const ctx_r0 = i0.ɵɵnextContext();
i0.ɵɵproperty("formGroup", ctx_r0.form)("disabled", ctx_r0.isLocked)("ngStyle", i0.ɵɵpureFunction1(8, _c4, ctx_r0.layoutType == ctx_r0.LAYOUT_TYPE.PepperiCard && (ctx_r0.pepperiObjectInput == null ? null : ctx_r0.pepperiObjectInput.Data == null ? null : ctx_r0.pepperiObjectInput.Data.BackgroundColor)))("ngClass", i0.ɵɵpureFunction2(10, _c5, ctx_r0.layoutType == ctx_r0.LAYOUT_TYPE.PepperiForm, ctx_r0.isCardView == true));
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", ctx_r0.layoutType == ctx_r0.LAYOUT_TYPE.PepperiForm);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", ctx_r0.layoutType == ctx_r0.LAYOUT_TYPE.PepperiCard);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", ctx_r0.layoutType == ctx_r0.LAYOUT_TYPE.PepperiTable);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", ctx_r0.layoutType == ctx_r0.LAYOUT_TYPE.Editmodal);
} }
function PepperiFormComponent_ng_template_1_div_0_pep_image_2_Template(rf, ctx) { if (rf & 1) {
const _r62 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "pep-image", 38);
i0.ɵɵlistener("elementClicked", function PepperiFormComponent_ng_template_1_div_0_pep_image_2_Template_pep_image_elementClicked_0_listener($event) { i0.ɵɵrestoreView(_r62); const ctx_r61 = i0.ɵɵnextContext(3); return ctx_r61.onClick($event); });
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r52 = i0.ɵɵnextContext().$implicit;
const ctx_r54 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("objectId", ctx_r54.objectId)("form", ctx_r54.form)("key", field_r52.key)("src", field_r52.formattedValue)("srcLarge", field_r52.value)("options", field_r52.options)("label", field_r52.label)("type", field_r52.type)("required", field_r52.required)("disabled", field_r52.disabled)("readonly", field_r52.readonly)("xAlignment", field_r52.xAlignment)("rowSpan", field_r52.rowSpan)("layoutType", ctx_r54.layoutType);
} }
function PepperiFormComponent_ng_template_1_div_0_pep_signature_3_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelement(0, "pep-signature", 39);
} if (rf & 2) {
const field_r52 = i0.ɵɵnextContext().$implicit;
const ctx_r55 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("form", ctx_r55.form)("key", field_r52.key)("src", field_r52.value)("label", field_r52.label)("required", field_r52.required)("disabled", field_r52.disabled)("readonly", field_r52.readonly)("xAlignment", field_r52.xAlignment)("rowSpan", field_r52.rowSpan)("layoutType", ctx_r55.layoutType);
} }
function PepperiFormComponent_ng_template_1_div_0_pep_checkbox_4_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelement(0, "pep-checkbox", 40);
} if (rf & 2) {
const field_r52 = i0.ɵɵnextContext().$implicit;
const ctx_r56 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("form", ctx_r56.form)("key", field_r52.key)("value", field_r52.value)("label", field_r52.label)("type", field_r52.type)("required", field_r52.required)("disabled", field_r52.disabled)("readonly", field_r52.readonly)("xAlignment", field_r52.xAlignment)("rowSpan", field_r52.rowSpan)("additionalValue", field_r52.additionalValue)("layoutType", ctx_r56.layoutType);
} }
function PepperiFormComponent_ng_template_1_div_0_pep_internal_button_5_Template(rf, ctx) { if (rf & 1) {
const _r67 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "pep-internal-button", 41);
i0.ɵɵlistener("elementClicked", function PepperiFormComponent_ng_template_1_div_0_pep_internal_button_5_Template_pep_internal_button_elementClicked_0_listener($event) { i0.ɵɵrestoreView(_r67); const ctx_r66 = i0.ɵɵnextContext(3); return ctx_r66.onClick($event); });
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r52 = i0.ɵɵnextContext().$implicit;
const ctx_r57 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("form", ctx_r57.form)("key", field_r52.key)("value", field_r52.value)("formattedValue", field_r52.formattedValue)("label", field_r52.label)("type", field_r52.type)("disabled", field_r52.disabled)("readonly", field_r52.readonly)("xAlignment", field_r52.xAlignment)("layoutType", ctx_r57.layoutType);
} }
function PepperiFormComponent_ng_template_1_div_0_pep_textarea_6_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelement(0, "pep-textarea", 42);
} if (rf & 2) {
const field_r52 = i0.ɵɵnextContext().$implicit;
const ctx_r58 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("form", ctx_r58.form)("key", field_r52.key)("value", field_r52.value)("label", field_r52.label)("required", field_r52.required)("disabled", field_r52.disabled)("readonly", field_r52.readonly)("maxFieldCharacters", field_r52.maxFieldCharacters)("textColor", field_r52.textColor)("xAlignment", field_r52.xAlignment)("rowSpan", field_r52.rowSpan)("layoutType", ctx_r58.layoutType);
} }
function PepperiFormComponent_ng_template_1_div_0_pep_quantity_selector_7_Template(rf, ctx) { if (rf & 1) {
const _r71 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "pep-quantity-selector", 43);
i0.ɵɵlistener("valueChanged", function PepperiFormComponent_ng_template_1_div_0_pep_quantity_selector_7_Template_pep_quantity_selector_valueChanged_0_listener($event) { i0.ɵɵrestoreView(_r71); const ctx_r70 = i0.ɵɵnextContext(3); return ctx_r70.onValueChanged($event); })("elementClicked", function PepperiFormComponent_ng_template_1_div_0_pep_quantity_selector_7_Template_pep_quantity_selector_elementClicked_0_listener($event) { i0.ɵɵrestoreView(_r71); const ctx_r72 = i0.ɵɵnextContext(3); return ctx_r72.onClick($event); });
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r52 = i0.ɵɵnextContext().$implicit;
const ctx_r59 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("id", field_r52.key)("form", ctx_r59.form)("key", field_r52.key)("value", field_r52.value)("formattedValue", field_r52.formattedValue)("label", field_r52.label)("type", field_r52.type)("required", field_r52.required)("disabled", field_r52.disabled)("readonly", field_r52.readonly)("textColor", field_r52.textColor)("xAlignment", field_r52.xAlignment)("rowSpan", field_r52.rowSpan)("layoutType", ctx_r59.layoutType);
} }
function PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_container_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementContainer(0);
} }
function PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_ng_container_0_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementContainer(0);
} }
function PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_ng_template_1_a_0_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "a", 49);
i0.ɵɵtext(1);
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r52 = i0.ɵɵnextContext(4).$implicit;
i0.ɵɵpropertyInterpolate("title", field_r52.formattedValue);
i0.ɵɵpropertyInterpolate("href", field_r52.value, i0.ɵɵsanitizeUrl);
i0.ɵɵproperty("id", field_r52.key);
i0.ɵɵadvance(1);
i0.ɵɵtextInterpolate(field_r52.formattedValue);
} }
function PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_ng_template_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵtemplate(0, PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_ng_template_1_a_0_Template, 2, 4, "a", 48);
} if (rf & 2) {
const field_r52 = i0.ɵɵnextContext(3).$implicit;
i0.ɵɵproperty("ngIf", field_r52.formattedValue != null);
} }
const _c6 = function (a0) { return { color: a0 }; };
function PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_ng_template_3_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "span", 50);
i0.ɵɵtext(1);
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r52 = i0.ɵɵnextContext(3).$implicit;
i0.ɵɵpropertyInterpolate("title", field_r52.formattedValue);
i0.ɵɵproperty("id", field_r52.key)("ngStyle", i0.ɵɵpureFunction1(4, _c6, field_r52.textColor));
i0.ɵɵadvance(1);
i0.ɵɵtextInterpolate(field_r52.formattedValue);
} }
function PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵtemplate(0, PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_ng_container_0_Template, 1, 0, "ng-container", 16);
i0.ɵɵtemplate(1, PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_ng_template_1_Template, 1, 1, "ng-template", null, 46, i0.ɵɵtemplateRefExtractor);
i0.ɵɵtemplate(3, PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_ng_template_3_Template, 2, 6, "ng-template", null, 47, i0.ɵɵtemplateRefExtractor);
} if (rf & 2) {
const _r80 = i0.ɵɵreference(2);
const _r82 = i0.ɵɵreference(4);
const field_r52 = i0.ɵɵnextContext(2).$implicit;
i0.ɵɵproperty("ngIf", field_r52.type === "attachment" || field_r52.type === "link")("ngIfThen", _r80)("ngIfElse", _r82);
} }
function PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_4_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "span");
i0.ɵɵtext(1, "\u00A0");
i0.ɵɵelementEnd();
} }
function PepperiFormComponent_ng_template_1_div_0_ng_container_8_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementContainerStart(0);
i0.ɵɵtemplate(1, PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_container_1_Template, 1, 0, "ng-container", 16);
i0.ɵɵtemplate(2, PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_2_Template, 5, 3, "ng-template", null, 44, i0.ɵɵtemplateRefExtractor);
i0.ɵɵtemplate(4, PepperiFormComponent_ng_template_1_div_0_ng_container_8_ng_template_4_Template, 2, 0, "ng-template", null, 45, i0.ɵɵtemplateRefExtractor);
i0.ɵɵelementContainerEnd();
} if (rf & 2) {
const _r75 = i0.ɵɵreference(3);
const _r77 = i0.ɵɵreference(5);
const field_r52 = i0.ɵɵnextContext().$implicit;
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", (field_r52.formattedValue == null ? null : field_r52.formattedValue.length) > 0)("ngIfThen", _r75)("ngIfElse", _r77);
} }
function PepperiFormComponent_ng_template_1_div_0_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵelementStart(0, "div", 29);
i0.ɵɵelementContainerStart(1, 30);
i0.ɵɵtemplate(2, PepperiFormComponent_ng_template_1_div_0_pep_image_2_Template, 1, 14, "pep-image", 31);
i0.ɵɵtemplate(3, PepperiFormComponent_ng_template_1_div_0_pep_signature_3_Template, 1, 10, "pep-signature", 32);
i0.ɵɵtemplate(4, PepperiFormComponent_ng_template_1_div_0_pep_checkbox_4_Template, 1, 12, "pep-checkbox", 33);
i0.ɵɵtemplate(5, PepperiFormComponent_ng_template_1_div_0_pep_internal_button_5_Template, 1, 10, "pep-internal-button", 34);
i0.ɵɵtemplate(6, PepperiFormComponent_ng_template_1_div_0_pep_textarea_6_Template, 1, 12, "pep-textarea", 35);
i0.ɵɵtemplate(7, PepperiFormComponent_ng_template_1_div_0_pep_quantity_selector_7_Template, 1, 14, "pep-quantity-selector", 36);
i0.ɵɵtemplate(8, PepperiFormComponent_ng_template_1_div_0_ng_container_8_Template, 6, 3, "ng-container", 37);
i0.ɵɵelementContainerEnd();
i0.ɵɵelementEnd();
} if (rf & 2) {
const field_r52 = ctx.$implicit;
const j_r53 = ctx.index;
const ctx_r51 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction1(9, _c3, ctx_r51.uiControlHeader == null ? null : ctx_r51.uiControlHeader.ControlFields[j_r53] == null ? null : ctx_r51.uiControlHeader.ControlFields[j_r53].calcColumnWidthString))("ngClass", i0.ɵɵpureFunction1(11, _c2, "text-align-" + field_r52.xAlignment));
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngSwitch", field_r52.controlType);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngSwitchCase", "image");
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngSwitchCase", "signature");
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngSwitchCase", "checkbox");
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngSwitchCase", "button");
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngSwitchCase", "textarea");
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngSwitchCase", "qs");
} }
function PepperiFormComponent_ng_template_1_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵtemplate(0, PepperiFormComponent_ng_template_1_div_0_Template, 9, 13, "div", 28);
} if (rf & 2) {
const ctx_r2 = i0.ɵɵnextContext();
i0.ɵɵproperty("ngForOf", ctx_r2.fields);
} }
export class PepperiObjectChangedData {
constructor(id, apiName, value, controlType = '') {
this.Id = id;
this.ApiName = apiName;
this.Value = value;
this.ControlType = controlType || '';
}
}
export class PepperiFieldClickedData {
constructor(id, apiName, idType, which, value, fieldType, otherData = null) {
this.Id = id;
this.ApiName = apiName;
this.IdType = idType;
this.FieldType = fieldType;
this.Which = which;
this.Value = value;
this.OtherData = otherData;
}
}
// tslint:disable-next-line: no-conflicting-lifecycle
export class PepperiFormComponent {
constructor(dialogService, customizationService, translate, fb, differs) {
this.dialogService = dialogService;
this.customizationService = customizationService;
this.translate = translate;
this.fb = fb;
this.isReport = false;
this.lockEvents = false;
this.canEditObject = true;
this.isActive = false;
this.layoutType = LAYOUT_TYPE.PepperiForm;
this.listType = '';
this.objectId = '0';
this.parentId = '0';
this.searchCode = '0';
this.showTitle = true;
this.firstFieldAsLink = false;
this.isCardView = false;
this.checkForChanges = null;
this.pageType = '';
this.notifyValueChanged = new EventEmitter();
this.formValidationChanged = new EventEmitter();
this.childClicked = new EventEmitter();
this.childChanged = new EventEmitter();
this.notifyFieldClicked = new EventEmitter();
this.notifyMenuItemClicked = new EventEmitter();
this.LAYOUT_TYPE = LAYOUT_TYPE;
this.isLocked = false;
this.matrixIsLast = false;
// payLoad = '';
this.rows = [];
this.fields = [];
this.columns = 1;
this.hasMenuFloatingOnOtherField = false;
this.indicatorsDataField = null;
this.shouldReloadForm = false;
this.jsonLib = JSON;
// store the initial value to compare with
this.differ = differs.find({}).create();
}
static convertAddressFields(controlField, addressFields, canEditObject) {
const fields = [];
addressFields.forEach(field => {
let customField;
const placeholder = field.ApiName;
if (field.ApiName.toLowerCase().indexOf('street') >= 0) {
customField = new PepperiTextboxField({
key: field.ApiName,
label: field.ApiName,
type: 'text',
placeholder,
readonly: !canEditObject,
disabled: !field.Enabled || !canEditObject,
hidden: false,
required: false,
value: field.Value,
formattedValue: field.FormattedValue,
row: 0,
rowSpan: 1,
col: 0,
colSpan: 2,
xAlignment: controlField.Layout.XAlignment,
yAlignment: controlField.Layout.YAlignment,
order: 0
});
}
else if (field.ApiName.toLowerCase().indexOf('city') >= 0) {
customField = new PepperiTextboxField({
key: field.ApiName,
label: field.ApiName,
type: 'text',
placeholder,
readonly: !canEditObject,
disabled: !field.Enabled || !canEditObject,
hidden: false,
required: false,
value: field.Value,
formattedValue: field.FormattedValue,
row: 0,
rowSpan: 1,
col: 2,
colSpan: 1,
xAlignment: controlField.Layout.XAlignment,
yAlignment: controlField.Layout.YAlignment,
order: 1
});
}
else if (field.ApiName.toLowerCase().indexOf('state') >= 0) {
customField = new PepperiSelectField({
key: field.ApiName,
label: field.ApiName,
placeholder,
options: field.OptionalValues,
readonly: !canEditObject,
disabled: !field.Enabled || !canEditObject,
hidden: false,
required: false,
value: field.Value,
formattedValue: field.FormattedValue,
row: 1,
rowSpan: 1,
col: 0,
colSpan: 1,
xAlignment: controlField.Layout.XAlignment,
yAlignment: controlField.Layout.YAlignment,
order: 2
});
}
else if (field.ApiName.toLowerCase().indexOf('zipcode') >= 0) {
customField = new PepperiTextboxField({
key: field.ApiName,
label: field.ApiName,
type: 'text',
placeholder,
readonly: !canEditObject,
disabled: !field.Enabled || !canEditObject,
hidden: false,
required: false,
value: field.Value,
formattedValue: field.FormattedValue,
row: 1,
rowSpan: 1,
col: 1,
colSpan: 1,
xAlignment: controlField.Layout.XAlignment,
yAlignment: controlField.Layout.YAlignment,
order: 3
});
}
else if (field.ApiName.toLowerCase().indexOf('country') >= 0) {
customField = new PepperiSelectField({
key: field.ApiName,
label: field.ApiName,
placeholder,
options: field.OptionalValues,
readonly: !canEditObject,
disabled: !field.Enabled || !canEditObject,
hidden: false,
required: false,
value: field.Value,
formattedValue: field.FormattedValue,
row: 2,
rowSpan: 1,
col: 2,
colSpan: 1,
xAlignment: controlField.Layout.XAlignment,
yAlignment: controlField.Layout.YAlignment,
order: 4
});
}
fields.push(customField);
});
return fields.sort((n1, n2) => (n1.order > n2.order ? 1 : n1.order < n2.order ? -1 : 0));
}
static isMatrixField(apiNameToCheck) {
return apiNameToCheck.indexOf('Matrix') >= 0;
}
static doesFieldHavaFloatingField(controlField, floatingField) {
let hasFloatingField = false;
if (floatingField.Layout.Y >= controlField.Layout.Y &&
floatingField.Layout.Y < controlField.Layout.Y + controlField.Layout.Height &&
floatingField.Layout.X >= controlField.Layout.X &&
floatingField.Layout.X < controlField.Layout.X + controlField.Layout.Width) {
hasFloatingField = true;
}
return hasFloatingField;
}
static getOptionsForCustomField(controlField, dataField, canEditObject) {
if (!controlField || !dataField) {
return;
}
const placeholder = controlField.ReadOnly || !canEditObject ? '' : controlField.Title;
return {
key: controlField.ApiName,
label: controlField.Title,
type: 'text',
accessory: dataField.Accessory,
placeholder,
readonly: controlField.ReadOnly || !canEditObject,
disabled: !dataField.Enabled || !canEditObject,
hidden: controlField.Hidden,
required: controlField.Mandatory,
value: dataField.Value,
formattedValue: dataField.FormattedValue,
additionalValue: dataField.AdditionalValue,
row: controlField.Layout.Y,
rowSpan: controlField.Layout.Height,
col: controlField.Layout.X,
colSpan: controlField.Layout.Width,
xAlignment: controlField.Layout.XAlignment,
yAlignment: controlField.Layout.YAlignment,
options: dataField.OptionalValues,
groupFields: undefined,
maxFieldCharacters: controlField.MaxFieldCharacters,
minValue: controlField.MinValue,
maxValue: controlField.MaxValue,
// hasMenu: hasMenu,
// hasCampaign: hasCampaign,
// hasIndicators: hasIndicators,
textColor: dataField.TextColor,
notificationInfo: dataField.NotificationInfo
};
}
static convertToCustomField(controlField, dataField, canEditObject, menuField, hasCampaignField, indicatorsField, objectId, parentId, searchCode) {
let customField;
const options = PepperiFormComponent.getOptionsForCustomField(controlField, dataField, canEditObject);
if (controlField.ApiName === 'ObjectMenu') {
options.type = 'menu';
if (dataField.TransactionItemType === 1 && dataField.OptionalValues.length > 0) {
const subMenuOptions = [{ Key: 'EditPackage', Value: 'Edit' }, { Key: 'DeletePackage', Value: 'Delete' }];
options.options = subMenuOptions.filter(option => option && dataField.OptionalValues.includes(option.Key));
}
else {
options.options = null;
}
customField = new PepperiMenuField(options);
}
else if (controlField.ApiName === 'QuantitySelector' ||
controlField.ApiName === 'UnitsQuantity' ||
controlField.ApiName.indexOf('size_') === 0) {
if (dataField.FieldType === FIELD_TYPE.InternalLink) {
options.type = 'button';
}
else if (dataField.FieldType === FIELD_TYPE.Package) {
options.type = 'packageButton';
}
else if (dataField.FieldType === FIELD_TYPE.NumberRealQuantitySelector ||
dataField.FieldType === FIELD_TYPE.NumberReal) {
options.type = 'qs';
options.alowDecimal = true;
}
else if (dataField.FieldType === FIELD_TYPE.NumberIntegerQuantitySelector ||
dataField.FieldType === FIELD_TYPE.NumberInteger) {
options.type = 'qs';
options.alowDecimal = false;
}
else if (dataField.FieldType === FIELD_TYPE.NumberIntegerForMatrix) {
options.type = 'qsForMatrix';
options.alowDecimal = false;
}
else if (dataField.FieldType === FIELD_TYPE.NumberRealForMatrix) {
options.type = 'qsForMatrix';
options.alowDecimal = true;
}
customField = new PepperiQuantitySelectorField(options);
}
else {
// Hack need to remove this..
if (dataField.FieldType === FIELD_TYPE.Indicators && PepperiFormComponent.isMatrixField(dataField.ApiName)) {
dataField.FieldType = FIELD_TYPE.InternalPage;
}
switch (dataField.FieldType) {
case FIELD_TYPE.Address: {
const canEditGroupObject = controlField.ReadOnly ? false : canEditObject;
options.groupFields = PepperiFormComponent.convertAddressFields(controlField, dataField.GroupFields, canEditGroupObject);
customField = new PepperiAddressField(options);
break;
}
case FIELD_TYPE.Indicators: {
// options['type'] = 'indicators'; // Not needed this is PepperiIndicatorsField.
customField = new PepperiIndicatorsField(options);
break;
}
case FIELD_TYPE.InternalPage: {
if (PepperiFormComponent.isMatrixField(controlField.ApiName)) {
options.rowSpan = controlField.Layout.Height;
options.objectId = objectId;
options.parentId = parentId;
options.searchCode = searchCode;
customField = new PepperiInternalPageField(options);
}
else {
// Not supported
}
break;
}
case FIELD_TYPE.Link: {
options.type = 'link';
customField = new PepperiTextboxField(options);
// DI-11292 - add changes for link field for the "Read Only display value" prop
customField.formattedValue = customField.disabled && customField.formattedValue !== '' &&
customField.value !== '' ? customField.formattedValue : customField.value;
break;
}
case FIELD_TYPE.InternalLink:
case FIELD_TYPE.Button: {
options.type = 'button';
customField = new PepperiButtonField(options);
break;
}
case FIELD_TYPE.Attachment: {
options.type = 'attachment';
customField = new PepperiAttachmentField(options);
break;
}
case FIELD_TYPE.Signature: {
options.type = 'signature';
customField = new PepperiSignatureField(options);
break;
}
case FIELD_TYPE.Image:
case FIELD_TYPE.ImageURL: {
options.type = 'image';
options.menuField = menuField && this.doesFieldHavaFloatingField(controlField, menuField) ? menuField : null;
options.hasCampaignField = hasCampaignField &&
this.doesFieldHavaFloatingField(controlField, hasCampaignField) ? hasCampaignField : null;
options.indicatorsField = indicatorsField &&
this.doesFieldHavaFloatingField(controlField, indicatorsField) ? indicatorsField : null;
customField = new PepperiImageField(options);
break;
}
case FIELD_TYPE.Images: {
options.type = 'images';
customField = new PepperiImagesField(options);
break;
}
case FIELD_TYPE.Email: {
options.type = 'email';
customField = new PepperiTextboxField(options);
break;
}
case FIELD_TYPE.Phone: {
options.type = 'phone';
customField = new PepperiTextboxField(options);
break;
}
case FIELD_TYPE.Duration: {
options.type = 'duration';
customField = new PepperiTextboxField(options);
break;
}
case FIELD_TYPE.Default:
case FIELD_TYPE.TextBox:
case FIELD_TYPE.LimitedLengthTextBox:
case FIELD_TYPE.TextHeader:
case FIELD_TYPE.CalculatedString:
case FIELD_TYPE.MapDataString: {
customField = new PepperiTextboxField(options);
break;
}
case FIELD_TYPE.TextArea: {
customField = new PepperiTextareaField(options);
break;
}
case FIELD_TYPE.RichTextHTML: {
customField = new PepperiRichHtmlTextareaField(options);
break;
}
case FIELD_TYPE.Date:
case FIELD_TYPE.LimitedDate:
case FIELD_TYPE.CalculatedDate:
case FIELD_TYPE.DateAndTime: {
options.type = dataField.FieldType === FIELD_TYPE.DateAndTime ? 'datetime' : 'date';
customField = new PepperiDateField(options);
break;
}
case FIELD_TYPE.NumberInteger:
case FIELD_TYPE.CalculatedInt:
case FIELD_TYPE.MapDataInt: {
options.type = 'int';
customField = new PepperiTextboxField(options);
break;
}
case FIELD_TYPE.Percentage: {
options.type = 'percentage';
customField = new PepperiTextboxField(options);
break;
}
case FIELD_TYPE.Currency: {
options.type = 'currency';
customField = new PepperiTextboxField(options);
break;
}
case FIELD_TYPE.NumberReal:
case FIELD_TYPE.CalculatedReal:
case FIELD_TYPE.MapDataReal:
case FIELD_TYPE.Sum:
case FIELD_TYPE.Totals: {
options.type = 'real';
customField = new PepperiTextboxField(options);
break;
}
case FIELD_TYPE.Boolean:
case FIELD_TYPE.CalculatedBool: {
customField = new PepperiCheckboxField(options);
break;
}
case FIELD_TYPE.BooleanText: {
options.type = 'booleanText';
customField = new PepperiCheckboxField(options);
break;
}
case FIELD_TYPE.ComboBox:
case FIELD_TYPE.EmptyComboBox:
case FIELD_TYPE.MapDataDropDown: {
// options.type = 'select';
customField = new PepperiSelectField(options);
break;
}
case FIELD_TYPE.MultiTickBox:
case FIELD_TYPE.MultiTickBoxToComboBox:
case FIELD_TYPE.EmptyMultiTickBox: {
options.type = 'multi';
customField = new PepperiSelectField(options);
break;
}
case FIELD_TYPE.GuidReferenceType: {
options.type = 'reference';
options.referenceObjectType = dataField.ReferenceObjectType;
options.referenceObjectSubType = dataField.ReferenceObjectSubType;
options.referenceObjectInternalType = dataField.ReferenceObjectInternalType;
customField = new PepperiButtonField(options);
break;
}
case FIELD_TYPE.ListOfObjects: {
options.type = 'listofobjects';
customField = new PepperiButtonField(options);
break;
}
case FIELD_TYPE.Separator: {
customField = new PepperiSeparatorField(options);
break;
}
/*
case FIELD_TYPE.Images: return that.field(value);
*/
case FIELD_TYPE.NumberRealQuantitySelector:
case FIELD_TYPE.NumberIntegerQuantitySelector: {
options.type = 'qs';
options.alowDecimal = dataField.FieldType === FIELD_TYPE.NumberRealQuantitySelector;
customField = new PepperiQuantitySelectorField(options);
break;
}
case FIELD_TYPE.Package: {
options.type = 'packageButton';
customField = new PepperiQuantitySelectorField(options);
break;
}
}
}
if (!customField) {
options.label = controlField.ApiName + ' is not supported!!!';
customField = new PepperiSeparatorField(options);
}
return customField;
}
static getFieldFormattedValue(field) {
let fieldFormattedValue = field.formattedValue;
// Fix for the custom check box component.
if (field.controlType === 'checkbox') {
fieldFormattedValue = fieldFormattedValue === 'true';
}
// Fix for the custom button component.
if (field.controlType === 'button') {
fieldFormattedValue = fieldFormattedValue === '0' ? '' : fieldFormattedValue;
}
return fieldFormattedValue;
}
static toControlGroup(fields, fb, customizationService) {
const group = {};
if (fields && fields.length > 0) {
fields.forEach(field => {
if (field.groupFields && field.groupFields.length > 0) {
const subGroup = {};
field.groupFields.forEach(groupField => {
if (groupField.required && (!field.readonly && !field.disabled)) {
subGroup[groupField.key] = [{
value: groupField.formattedValue || '',
disabled: field.readonly || field.disabled || groupField.disabled
}, [Validators.required]];
}
else {
subGroup[groupField.key] = [{
value: groupField.formattedValue || '',
disabled: field.readonly || field.disabled || groupField.disabled