mmhglobal-dynamicform 2.9.1 → 2.10.0

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.
@@ -1499,7 +1499,7 @@ class ZformComponent {
1499
1499
  }
1500
1500
  getFormControls(fieldArray, formControls, containerIsVisible = true) {
1501
1501
  fieldArray.forEach(field => {
1502
- if (!field.SubType) {
1502
+ if (!field.SubType && field.Type != 'zloop') {
1503
1503
  this.addToFieldIndex(field);
1504
1504
  this.fieldService.patchFieldProperty(field);
1505
1505
  if (typeof field.Value === "string" && field.Value.indexOf(".") !== -1) {
@@ -13203,6 +13203,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13203
13203
  type: Input
13204
13204
  }] } });
13205
13205
 
13206
+ /********** Angular **********/
13207
+ class ZloopComponent extends ContainerFieldBase {
13208
+ constructor(componentService, fieldService) {
13209
+ super(componentService);
13210
+ this.componentService = componentService;
13211
+ this.fieldService = fieldService;
13212
+ this.clonedFields = [];
13213
+ this.clonedFormControlList = new Array();
13214
+ this.initField = {};
13215
+ this.conponentTypesToNotUpdateValue = ['zbuttons'];
13216
+ }
13217
+ ngOnInit() {
13218
+ this.initField = ZComponentHelper.deepClone(this.data);
13219
+ this.setupLoopingElement();
13220
+ super.initComponent().subscribe(() => { this.isLoading = false; });
13221
+ }
13222
+ refreshFieldElement() {
13223
+ this.data = ZComponentHelper.deepClone(this.initField);
13224
+ this.setupLoopingElement();
13225
+ }
13226
+ setupLoopingElement() {
13227
+ if (this.data.LoopingElementConfig) {
13228
+ // Remove previously cloned fields from form controls (if any)
13229
+ if (this.clonedFormControlList.length > 0) {
13230
+ for (const fgName of this.clonedFormControlList) {
13231
+ this.group.form.removeControl(fgName);
13232
+ }
13233
+ }
13234
+ // Clone zloop's child
13235
+ this.clonedFields = this.cloneFieldElementChild(this.data);
13236
+ // Append cloned fields to group.fields for error message displaying
13237
+ const thisField = ZComponentHelper.getFieldFromFieldsByName(this.group.fields, this.data.Name);
13238
+ thisField.Value = this.clonedFields;
13239
+ }
13240
+ }
13241
+ cloneFieldElementChild(field) {
13242
+ const loopingElementConfig = typeof field.LoopingElementConfig == 'string' ? ZComponentHelper.getGroupValue(field.LoopingElementConfig, this.group) : field.LoopingElementConfig;
13243
+ if (loopingElementConfig == undefined) {
13244
+ return field.Value;
13245
+ }
13246
+ let fieldToInsert = new Array();
13247
+ for (let configIndex = 0; configIndex < loopingElementConfig.Count; configIndex++) {
13248
+ const clonedFields = JSON.parse(JSON.stringify(field.Value));
13249
+ this.updateFieldPropertiesToMakeThemDistinct(clonedFields, loopingElementConfig, configIndex);
13250
+ fieldToInsert = fieldToInsert.concat(clonedFields);
13251
+ }
13252
+ return fieldToInsert;
13253
+ }
13254
+ updateFieldPropertiesToMakeThemDistinct(fields, loopingElementConfig, index) {
13255
+ for (const field of fields) {
13256
+ const elementConfig = loopingElementConfig.ToReplace.find(x => x.ElementName == field.Name);
13257
+ const elementConfigProperty = elementConfig && elementConfig.Property && elementConfig.Property.length > index ? elementConfig.Property[index] : {};
13258
+ field.Name = `${field.Name}_${index + 1}`;
13259
+ if (field.Label) {
13260
+ field.Label = `${field.Label}`;
13261
+ }
13262
+ if (Array.isArray(field.Value)) {
13263
+ this.updateFieldPropertiesToMakeThemDistinct(field.Value, loopingElementConfig, index);
13264
+ }
13265
+ else {
13266
+ if (elementConfigProperty.Value != undefined) {
13267
+ field.Value = elementConfigProperty.Value;
13268
+ }
13269
+ else if (!this.conponentTypesToNotUpdateValue.includes(field.Type)) {
13270
+ field.Value = `${field.Value}_${index + 1}`;
13271
+ }
13272
+ }
13273
+ for (const key of Object.keys(elementConfigProperty)) {
13274
+ field[key] = elementConfigProperty[key];
13275
+ }
13276
+ this.setClonedFieldsToFormControls(field);
13277
+ }
13278
+ }
13279
+ setClonedFieldsToFormControls(field) {
13280
+ if (!field.SubType) {
13281
+ this.fieldService.patchFieldProperty(field);
13282
+ if (typeof field.Value === "string" && field.Value.indexOf(".") !== -1) {
13283
+ if (['zgrid', 'ztree', 'textareajson'].indexOf(field.Type) === -1) {
13284
+ console.warn("FormControl - invalid field value", field.Value);
13285
+ }
13286
+ }
13287
+ else {
13288
+ const isFormControl = ZComponentHelper.isFormControl(field);
13289
+ const isVisible = ZComponentHelper.isVisibleFormControl(this, field);
13290
+ const isRequired = ZComponentHelper.isRequiredFormControl(this, field);
13291
+ if (isFormControl === true) {
13292
+ const validators = ZComponentHelper.getValidators(field, isVisible, isRequired);
13293
+ this.group.form.addControl(field.Value, new FormControl(this.group.zModel[field.Value], validators));
13294
+ this.clonedFormControlList.push(field.Value);
13295
+ if (ZComponentHelper.hasCCField(field.Type)) {
13296
+ const ccValidators = ZComponentHelper.getCCValidators(field, isVisible, isRequired);
13297
+ this.group.form.addControl(field.CCValue, new FormControl(this.group.zModel[field.CCValue], ccValidators));
13298
+ this.clonedFormControlList.push(field.CCValue);
13299
+ }
13300
+ }
13301
+ }
13302
+ }
13303
+ }
13304
+ }
13305
+ ZloopComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ZloopComponent, deps: [{ token: ZComponentService }, { token: i2.FieldService }], target: i0.ɵɵFactoryTarget.Component });
13306
+ ZloopComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ZloopComponent, selector: "app-zloop", usesInheritance: true, ngImport: i0, template: "<div [style]=\"componentProperties.containerStyle.style\" class=\"e1tag-container-style\"\r\n *ngIf=\"(!!componentProperties.isVisibleField? group[componentProperties.isVisibleField] : componentProperties.isVisible)\">\r\n <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of clonedFields\"\r\n [field]=\"field\"\r\n [containerField]=\"data\" [group]=\"group\" [form]=\"form\" id=\"{{field.Type}}-{{field.Name}}\"\r\n [style]=\"componentProperties.style.style1\" class=\"e1tag-style1\">\r\n </app-zformcontrol>\r\n</div>\r\n\r\n", styles: [""], components: [{ type: ZformcontrolComponent, selector: "app-zformcontrol", inputs: ["field", "group", "form", "containerField"] }], directives: [{ type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i7.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }] });
13307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ZloopComponent, decorators: [{
13308
+ type: Component,
13309
+ args: [{ selector: 'app-zloop', template: "<div [style]=\"componentProperties.containerStyle.style\" class=\"e1tag-container-style\"\r\n *ngIf=\"(!!componentProperties.isVisibleField? group[componentProperties.isVisibleField] : componentProperties.isVisible)\">\r\n <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of clonedFields\"\r\n [field]=\"field\"\r\n [containerField]=\"data\" [group]=\"group\" [form]=\"form\" id=\"{{field.Type}}-{{field.Name}}\"\r\n [style]=\"componentProperties.style.style1\" class=\"e1tag-style1\">\r\n </app-zformcontrol>\r\n</div>\r\n\r\n", styles: [""] }]
13310
+ }], ctorParameters: function () { return [{ type: ZComponentService }, { type: i2.FieldService }]; } });
13311
+
13206
13312
  /********** Angular **********/
13207
13313
  class MmhglobalDynamicformModule {
13208
13314
  }
@@ -13281,7 +13387,8 @@ MmhglobalDynamicformModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.
13281
13387
  DateKendoFormatParser,
13282
13388
  DateIonicFormatParser,
13283
13389
  DateIonicMinMaxParser,
13284
- SfquerybuilderComponent], imports: [IonicModule,
13390
+ SfquerybuilderComponent,
13391
+ ZloopComponent], imports: [IonicModule,
13285
13392
  IonicSelectableModule,
13286
13393
  CommonModule,
13287
13394
  RouterModule,
@@ -13397,7 +13504,8 @@ MmhglobalDynamicformModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.
13397
13504
  DateKendoFormatParser,
13398
13505
  DateIonicFormatParser,
13399
13506
  DateIonicMinMaxParser,
13400
- SfquerybuilderComponent] });
13507
+ SfquerybuilderComponent,
13508
+ ZloopComponent] });
13401
13509
  MmhglobalDynamicformModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MmhglobalDynamicformModule, providers: [
13402
13510
  ModalService
13403
13511
  ], imports: [[
@@ -13524,7 +13632,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13524
13632
  DateKendoFormatParser,
13525
13633
  DateIonicFormatParser,
13526
13634
  DateIonicMinMaxParser,
13527
- SfquerybuilderComponent
13635
+ SfquerybuilderComponent,
13636
+ ZloopComponent
13528
13637
  ],
13529
13638
  imports: [
13530
13639
  IonicModule,
@@ -13646,7 +13755,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13646
13755
  DateKendoFormatParser,
13647
13756
  DateIonicFormatParser,
13648
13757
  DateIonicMinMaxParser,
13649
- SfquerybuilderComponent
13758
+ SfquerybuilderComponent,
13759
+ ZloopComponent
13650
13760
  ],
13651
13761
  providers: [
13652
13762
  ModalService
@@ -13663,5 +13773,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13663
13773
  * Generated bundle index. Do not edit.
13664
13774
  */
13665
13775
 
13666
- export { ButtonFieldBase, ContainerFieldBase, DataListingFieldBase, DateIonicFormatParser, DateIonicMinMaxParser, DateKendoFormatParser, DateParserFilter, DateRangeFilterCellComponent, DivzLayout, EditorFilter, ElementContainerDirective, FieldBase, FieldElementDirective, HtmlSanitizePipe, InputErrorMessageComponent, InputFieldAddOnsComponent, InputFieldBase, KcardComponent, MainService, MmhglobalDynamicformModule, MyFileInfo, OpenOnFocusDirective, PageLoaderComponent, ProcessingRecordLoaderComponent, ScrollbarThemeDirective, SfquerybuilderComponent, TabFilter, UiactionbuttonComponent, UiappmenucontentComponent, UibulletinComponent, UicontainerComponent, UicontentComponent, UiheaderComponent, UimenubuttonComponent, UimenucontentComponent, UipageComponent, UivalidationmessageComponent, ZBulletComponent, ZChipComponent, ZGridBindingDirective, ZGridPopupAnchorDirective, ZInputContainerComponent, ZInputParser, ZNumericParser, ZSchedulerToolBarComponent, ZSelectTranslationParser, ZTreeListOptions, ZbuttonsComponent, ZcardComponent, ZchartComponent, ZcheckboxComponent, ZcodeeditorComponent, ZdaterangeComponent, ZdatetimeComponent, ZdivComponent, ZformComponent, ZformcontrolComponent, ZgaugeComponent, ZgridComponent, ZgridContainerComponent, ZimgComponent, ZkcardComponent, ZlabelComponent, ZmfbComponent, ZmodalComponent, ZmodalMobileComponent, ZnumericComponent, ZpostselectinputComponent, ZprogressbarComponent, ZquerybuilderComponent, ZreportComponent, ZschedulerComponent, ZselectmultipleComponent, ZtabComponent, ZtextComponent, ZtextareaComponent, ZtexteditorComponent, ZtreeComponent, ZtreelistComponent, ZtrendcardComponent, ZudfComponent, ZunknownComponent, ZuploadComponent, ZworkflowbuttonsComponent, refreshGrid, toQueryRule };
13776
+ export { ButtonFieldBase, ContainerFieldBase, DataListingFieldBase, DateIonicFormatParser, DateIonicMinMaxParser, DateKendoFormatParser, DateParserFilter, DateRangeFilterCellComponent, DivzLayout, EditorFilter, ElementContainerDirective, FieldBase, FieldElementDirective, HtmlSanitizePipe, InputErrorMessageComponent, InputFieldAddOnsComponent, InputFieldBase, KcardComponent, MainService, MmhglobalDynamicformModule, MyFileInfo, OpenOnFocusDirective, PageLoaderComponent, ProcessingRecordLoaderComponent, ScrollbarThemeDirective, SfquerybuilderComponent, TabFilter, UiactionbuttonComponent, UiappmenucontentComponent, UibulletinComponent, UicontainerComponent, UicontentComponent, UiheaderComponent, UimenubuttonComponent, UimenucontentComponent, UipageComponent, UivalidationmessageComponent, ZBulletComponent, ZChipComponent, ZGridBindingDirective, ZGridPopupAnchorDirective, ZInputContainerComponent, ZInputParser, ZNumericParser, ZSchedulerToolBarComponent, ZSelectTranslationParser, ZTreeListOptions, ZbuttonsComponent, ZcardComponent, ZchartComponent, ZcheckboxComponent, ZcodeeditorComponent, ZdaterangeComponent, ZdatetimeComponent, ZdivComponent, ZformComponent, ZformcontrolComponent, ZgaugeComponent, ZgridComponent, ZgridContainerComponent, ZimgComponent, ZkcardComponent, ZlabelComponent, ZloopComponent, ZmfbComponent, ZmodalComponent, ZmodalMobileComponent, ZnumericComponent, ZpostselectinputComponent, ZprogressbarComponent, ZquerybuilderComponent, ZreportComponent, ZschedulerComponent, ZselectmultipleComponent, ZtabComponent, ZtextComponent, ZtextareaComponent, ZtexteditorComponent, ZtreeComponent, ZtreelistComponent, ZtrendcardComponent, ZudfComponent, ZunknownComponent, ZuploadComponent, ZworkflowbuttonsComponent, refreshGrid, toQueryRule };
13667
13777
  //# sourceMappingURL=mmhglobal-dynamicform.mjs.map