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.
- package/README.md +3 -0
- package/esm2020/lib/mmhglobal-dynamicform.module.mjs +10 -5
- package/esm2020/lib/zform/zform.component.mjs +2 -2
- package/esm2020/lib/zloop/zloop.component.mjs +116 -0
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/mmhglobal-dynamicform.mjs +116 -6
- package/fesm2015/mmhglobal-dynamicform.mjs.map +1 -1
- package/fesm2020/mmhglobal-dynamicform.mjs +116 -6
- package/fesm2020/mmhglobal-dynamicform.mjs.map +1 -1
- package/lib/mmhglobal-dynamicform.module.d.ts +37 -36
- package/lib/zloop/zloop.component.d.ts +23 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -1505,7 +1505,7 @@ class ZformComponent {
|
|
|
1505
1505
|
}
|
|
1506
1506
|
getFormControls(fieldArray, formControls, containerIsVisible = true) {
|
|
1507
1507
|
fieldArray.forEach(field => {
|
|
1508
|
-
if (!field.SubType) {
|
|
1508
|
+
if (!field.SubType && field.Type != 'zloop') {
|
|
1509
1509
|
this.addToFieldIndex(field);
|
|
1510
1510
|
this.fieldService.patchFieldProperty(field);
|
|
1511
1511
|
if (typeof field.Value === "string" && field.Value.indexOf(".") !== -1) {
|
|
@@ -13228,6 +13228,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
13228
13228
|
type: Input
|
|
13229
13229
|
}] } });
|
|
13230
13230
|
|
|
13231
|
+
/********** Angular **********/
|
|
13232
|
+
class ZloopComponent extends ContainerFieldBase {
|
|
13233
|
+
constructor(componentService, fieldService) {
|
|
13234
|
+
super(componentService);
|
|
13235
|
+
this.componentService = componentService;
|
|
13236
|
+
this.fieldService = fieldService;
|
|
13237
|
+
this.clonedFields = [];
|
|
13238
|
+
this.clonedFormControlList = new Array();
|
|
13239
|
+
this.initField = {};
|
|
13240
|
+
this.conponentTypesToNotUpdateValue = ['zbuttons'];
|
|
13241
|
+
}
|
|
13242
|
+
ngOnInit() {
|
|
13243
|
+
this.initField = ZComponentHelper.deepClone(this.data);
|
|
13244
|
+
this.setupLoopingElement();
|
|
13245
|
+
super.initComponent().subscribe(() => { this.isLoading = false; });
|
|
13246
|
+
}
|
|
13247
|
+
refreshFieldElement() {
|
|
13248
|
+
this.data = ZComponentHelper.deepClone(this.initField);
|
|
13249
|
+
this.setupLoopingElement();
|
|
13250
|
+
}
|
|
13251
|
+
setupLoopingElement() {
|
|
13252
|
+
if (this.data.LoopingElementConfig) {
|
|
13253
|
+
// Remove previously cloned fields from form controls (if any)
|
|
13254
|
+
if (this.clonedFormControlList.length > 0) {
|
|
13255
|
+
for (const fgName of this.clonedFormControlList) {
|
|
13256
|
+
this.group.form.removeControl(fgName);
|
|
13257
|
+
}
|
|
13258
|
+
}
|
|
13259
|
+
// Clone zloop's child
|
|
13260
|
+
this.clonedFields = this.cloneFieldElementChild(this.data);
|
|
13261
|
+
// Append cloned fields to group.fields for error message displaying
|
|
13262
|
+
const thisField = ZComponentHelper.getFieldFromFieldsByName(this.group.fields, this.data.Name);
|
|
13263
|
+
thisField.Value = this.clonedFields;
|
|
13264
|
+
}
|
|
13265
|
+
}
|
|
13266
|
+
cloneFieldElementChild(field) {
|
|
13267
|
+
const loopingElementConfig = typeof field.LoopingElementConfig == 'string' ? ZComponentHelper.getGroupValue(field.LoopingElementConfig, this.group) : field.LoopingElementConfig;
|
|
13268
|
+
if (loopingElementConfig == undefined) {
|
|
13269
|
+
return field.Value;
|
|
13270
|
+
}
|
|
13271
|
+
let fieldToInsert = new Array();
|
|
13272
|
+
for (let configIndex = 0; configIndex < loopingElementConfig.Count; configIndex++) {
|
|
13273
|
+
const clonedFields = JSON.parse(JSON.stringify(field.Value));
|
|
13274
|
+
this.updateFieldPropertiesToMakeThemDistinct(clonedFields, loopingElementConfig, configIndex);
|
|
13275
|
+
fieldToInsert = fieldToInsert.concat(clonedFields);
|
|
13276
|
+
}
|
|
13277
|
+
return fieldToInsert;
|
|
13278
|
+
}
|
|
13279
|
+
updateFieldPropertiesToMakeThemDistinct(fields, loopingElementConfig, index) {
|
|
13280
|
+
for (const field of fields) {
|
|
13281
|
+
const elementConfig = loopingElementConfig.ToReplace.find(x => x.ElementName == field.Name);
|
|
13282
|
+
const elementConfigProperty = elementConfig && elementConfig.Property && elementConfig.Property.length > index ? elementConfig.Property[index] : {};
|
|
13283
|
+
field.Name = `${field.Name}_${index + 1}`;
|
|
13284
|
+
if (field.Label) {
|
|
13285
|
+
field.Label = `${field.Label}`;
|
|
13286
|
+
}
|
|
13287
|
+
if (Array.isArray(field.Value)) {
|
|
13288
|
+
this.updateFieldPropertiesToMakeThemDistinct(field.Value, loopingElementConfig, index);
|
|
13289
|
+
}
|
|
13290
|
+
else {
|
|
13291
|
+
if (elementConfigProperty.Value != undefined) {
|
|
13292
|
+
field.Value = elementConfigProperty.Value;
|
|
13293
|
+
}
|
|
13294
|
+
else if (!this.conponentTypesToNotUpdateValue.includes(field.Type)) {
|
|
13295
|
+
field.Value = `${field.Value}_${index + 1}`;
|
|
13296
|
+
}
|
|
13297
|
+
}
|
|
13298
|
+
for (const key of Object.keys(elementConfigProperty)) {
|
|
13299
|
+
field[key] = elementConfigProperty[key];
|
|
13300
|
+
}
|
|
13301
|
+
this.setClonedFieldsToFormControls(field);
|
|
13302
|
+
}
|
|
13303
|
+
}
|
|
13304
|
+
setClonedFieldsToFormControls(field) {
|
|
13305
|
+
if (!field.SubType) {
|
|
13306
|
+
this.fieldService.patchFieldProperty(field);
|
|
13307
|
+
if (typeof field.Value === "string" && field.Value.indexOf(".") !== -1) {
|
|
13308
|
+
if (['zgrid', 'ztree', 'textareajson'].indexOf(field.Type) === -1) {
|
|
13309
|
+
console.warn("FormControl - invalid field value", field.Value);
|
|
13310
|
+
}
|
|
13311
|
+
}
|
|
13312
|
+
else {
|
|
13313
|
+
const isFormControl = ZComponentHelper.isFormControl(field);
|
|
13314
|
+
const isVisible = ZComponentHelper.isVisibleFormControl(this, field);
|
|
13315
|
+
const isRequired = ZComponentHelper.isRequiredFormControl(this, field);
|
|
13316
|
+
if (isFormControl === true) {
|
|
13317
|
+
const validators = ZComponentHelper.getValidators(field, isVisible, isRequired);
|
|
13318
|
+
this.group.form.addControl(field.Value, new FormControl(this.group.zModel[field.Value], validators));
|
|
13319
|
+
this.clonedFormControlList.push(field.Value);
|
|
13320
|
+
if (ZComponentHelper.hasCCField(field.Type)) {
|
|
13321
|
+
const ccValidators = ZComponentHelper.getCCValidators(field, isVisible, isRequired);
|
|
13322
|
+
this.group.form.addControl(field.CCValue, new FormControl(this.group.zModel[field.CCValue], ccValidators));
|
|
13323
|
+
this.clonedFormControlList.push(field.CCValue);
|
|
13324
|
+
}
|
|
13325
|
+
}
|
|
13326
|
+
}
|
|
13327
|
+
}
|
|
13328
|
+
}
|
|
13329
|
+
}
|
|
13330
|
+
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 });
|
|
13331
|
+
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"] }] });
|
|
13332
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ZloopComponent, decorators: [{
|
|
13333
|
+
type: Component,
|
|
13334
|
+
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: [""] }]
|
|
13335
|
+
}], ctorParameters: function () { return [{ type: ZComponentService }, { type: i2.FieldService }]; } });
|
|
13336
|
+
|
|
13231
13337
|
/********** Angular **********/
|
|
13232
13338
|
class MmhglobalDynamicformModule {
|
|
13233
13339
|
}
|
|
@@ -13306,7 +13412,8 @@ MmhglobalDynamicformModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.
|
|
|
13306
13412
|
DateKendoFormatParser,
|
|
13307
13413
|
DateIonicFormatParser,
|
|
13308
13414
|
DateIonicMinMaxParser,
|
|
13309
|
-
SfquerybuilderComponent
|
|
13415
|
+
SfquerybuilderComponent,
|
|
13416
|
+
ZloopComponent], imports: [IonicModule,
|
|
13310
13417
|
IonicSelectableModule,
|
|
13311
13418
|
CommonModule,
|
|
13312
13419
|
RouterModule,
|
|
@@ -13422,7 +13529,8 @@ MmhglobalDynamicformModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.
|
|
|
13422
13529
|
DateKendoFormatParser,
|
|
13423
13530
|
DateIonicFormatParser,
|
|
13424
13531
|
DateIonicMinMaxParser,
|
|
13425
|
-
SfquerybuilderComponent
|
|
13532
|
+
SfquerybuilderComponent,
|
|
13533
|
+
ZloopComponent] });
|
|
13426
13534
|
MmhglobalDynamicformModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MmhglobalDynamicformModule, providers: [
|
|
13427
13535
|
ModalService
|
|
13428
13536
|
], imports: [[
|
|
@@ -13549,7 +13657,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
13549
13657
|
DateKendoFormatParser,
|
|
13550
13658
|
DateIonicFormatParser,
|
|
13551
13659
|
DateIonicMinMaxParser,
|
|
13552
|
-
SfquerybuilderComponent
|
|
13660
|
+
SfquerybuilderComponent,
|
|
13661
|
+
ZloopComponent
|
|
13553
13662
|
],
|
|
13554
13663
|
imports: [
|
|
13555
13664
|
IonicModule,
|
|
@@ -13671,7 +13780,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
13671
13780
|
DateKendoFormatParser,
|
|
13672
13781
|
DateIonicFormatParser,
|
|
13673
13782
|
DateIonicMinMaxParser,
|
|
13674
|
-
SfquerybuilderComponent
|
|
13783
|
+
SfquerybuilderComponent,
|
|
13784
|
+
ZloopComponent
|
|
13675
13785
|
],
|
|
13676
13786
|
providers: [
|
|
13677
13787
|
ModalService
|
|
@@ -13688,5 +13798,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
13688
13798
|
* Generated bundle index. Do not edit.
|
|
13689
13799
|
*/
|
|
13690
13800
|
|
|
13691
|
-
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 };
|
|
13801
|
+
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 };
|
|
13692
13802
|
//# sourceMappingURL=mmhglobal-dynamicform.mjs.map
|