mmhglobal-dynamicform 2.1.2 → 2.2.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/services/zcomponent.service.mjs +19 -2
- package/esm2020/lib/zselectmultiple/zselectmultiple.component.mjs +9 -3
- package/esm2020/lib/zudf/zudf.component.mjs +32 -9
- package/fesm2015/mmhglobal-dynamicform.mjs +55 -8
- package/fesm2015/mmhglobal-dynamicform.mjs.map +1 -1
- package/fesm2020/mmhglobal-dynamicform.mjs +54 -8
- package/fesm2020/mmhglobal-dynamicform.mjs.map +1 -1
- package/lib/services/zcomponent.service.d.ts +5 -0
- package/lib/zselectmultiple/zselectmultiple.component.d.ts +3 -1
- package/lib/zudf/zudf.component.d.ts +2 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Injectable, Component, Input, Directive, ViewChild, Inject, HostListener, Pipe, ViewContainerRef, TemplateRef, EventEmitter, Output, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/router';
|
|
4
4
|
import { NavigationStart, NavigationEnd, NavigationError, RouterModule } from '@angular/router';
|
|
5
|
-
import { of, switchMap, forkJoin, tap,
|
|
5
|
+
import { of, switchMap, forkJoin, tap, Subject, BehaviorSubject, map as map$1, isObservable, interval, takeWhile, from, delay as delay$1, filter as filter$1, first } from 'rxjs';
|
|
6
6
|
import { map, tap as tap$1, switchMap as switchMap$1, delay, take, filter, concatMap } from 'rxjs/operators';
|
|
7
7
|
import * as i2 from 'mmhglobal-zcore';
|
|
8
8
|
import { ZComponentHelper, ZComponentProperties, ZGroup, MESSAGETYPE, ZSelectPostApiParams, UploadMetaData, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
|
|
@@ -204,6 +204,8 @@ class ZComponentService {
|
|
|
204
204
|
this.componentObjectService = componentObjectService;
|
|
205
205
|
this.translateService = translateService;
|
|
206
206
|
this.zcoreService = zcoreService;
|
|
207
|
+
this.componentCounter = 0;
|
|
208
|
+
this.componentLoadSubject = new Subject();
|
|
207
209
|
this.DEFAULT_ISEDIT = true;
|
|
208
210
|
//#region DateTime Conversion
|
|
209
211
|
this.timePickerDateType = ['zuidatetime', 'ztime', 'zuitime'];
|
|
@@ -440,6 +442,21 @@ class ZComponentService {
|
|
|
440
442
|
const result = `${(Math.abs(num) / 60).toString().padStart(2, '0')}:00`;
|
|
441
443
|
return `${prefix}${result}`;
|
|
442
444
|
}
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region track component loaded
|
|
447
|
+
get componentLoaded$() {
|
|
448
|
+
return this.componentLoadSubject.asObservable();
|
|
449
|
+
}
|
|
450
|
+
incrementComponentCounter() {
|
|
451
|
+
this.componentCounter++;
|
|
452
|
+
}
|
|
453
|
+
decrementComponentCounter() {
|
|
454
|
+
this.componentCounter--;
|
|
455
|
+
if (this.componentCounter === 0) {
|
|
456
|
+
this.componentLoadSubject.next();
|
|
457
|
+
this.componentLoadSubject.complete();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
443
460
|
}
|
|
444
461
|
ZComponentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ZComponentService, deps: [{ token: i1.ComponentObjectService }, { token: i2.TranslationService }, { token: i2.ZCoreService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
445
462
|
ZComponentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ZComponentService, providedIn: 'root' });
|
|
@@ -6545,11 +6562,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
6545
6562
|
|
|
6546
6563
|
/********** Angular **********/
|
|
6547
6564
|
class ZselectmultipleComponent extends InputFieldBase {
|
|
6548
|
-
constructor(resourceApiService, webApiService, cacheService,
|
|
6549
|
-
super(
|
|
6565
|
+
constructor(resourceApiService, webApiService, cacheService, componentService) {
|
|
6566
|
+
super(componentService);
|
|
6550
6567
|
this.resourceApiService = resourceApiService;
|
|
6551
6568
|
this.webApiService = webApiService;
|
|
6552
6569
|
this.cacheService = cacheService;
|
|
6570
|
+
this.componentService = componentService;
|
|
6553
6571
|
this.items = [];
|
|
6554
6572
|
this.infinitezData = [];
|
|
6555
6573
|
this.infiniteSearchText = null;
|
|
@@ -6690,6 +6708,11 @@ class ZselectmultipleComponent extends InputFieldBase {
|
|
|
6690
6708
|
}
|
|
6691
6709
|
super.focusOnDefault(this.focus.bind(this));
|
|
6692
6710
|
}
|
|
6711
|
+
ngAfterViewInit() {
|
|
6712
|
+
if (this.data.SubType === 'zudf') {
|
|
6713
|
+
this.componentService.decrementComponentCounter();
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6693
6716
|
// Auto select first option (if required & only 1 option)
|
|
6694
6717
|
autoSelectFirstOption(required, data, zModelPropertyName, id) {
|
|
6695
6718
|
if (ZComponentHelper.isNullUndefinedEmpty(id) && required) {
|
|
@@ -11491,13 +11514,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
11491
11514
|
|
|
11492
11515
|
/********** Angular **********/
|
|
11493
11516
|
class ZudfComponent extends ContainerFieldBase {
|
|
11494
|
-
constructor(
|
|
11495
|
-
super(
|
|
11517
|
+
constructor(alertService, authService, fieldService, toastService, componentErrorHandlerService, componentService, cdr) {
|
|
11518
|
+
super(componentService);
|
|
11496
11519
|
this.alertService = alertService;
|
|
11497
11520
|
this.authService = authService;
|
|
11498
11521
|
this.fieldService = fieldService;
|
|
11499
11522
|
this.toastService = toastService;
|
|
11500
11523
|
this.componentErrorHandlerService = componentErrorHandlerService;
|
|
11524
|
+
this.componentService = componentService;
|
|
11501
11525
|
this.cdr = cdr;
|
|
11502
11526
|
// formFields: any[]; // populate using field element.
|
|
11503
11527
|
this.componentProperties = new ZComponentProperties();
|
|
@@ -11712,6 +11736,26 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11712
11736
|
this.data.Value = fieldElements;
|
|
11713
11737
|
this.group[this.componentScopeName].form = this.form;
|
|
11714
11738
|
this.group[this.componentScopeName]['loadedFieldsSequence'] = this.loadedFieldsSequence;
|
|
11739
|
+
this.componentService.componentLoaded$.subscribe(() => {
|
|
11740
|
+
// All components have finished loading
|
|
11741
|
+
const zudfGroup = this.group[this.componentScopeName];
|
|
11742
|
+
zudfGroup['linkedComponent'].forEach(item => {
|
|
11743
|
+
const linkedComponentSegments = item.value.split('_');
|
|
11744
|
+
const parentComponentName = linkedComponentSegments.slice(0, -1).join('_') + '_' + item.linkedComponent;
|
|
11745
|
+
const parentComponent = ZComponentHelper.getComponentByValue(this.group, parentComponentName);
|
|
11746
|
+
const childComponent = ZComponentHelper.getComponentByValue(this.group, item.value);
|
|
11747
|
+
if (parentComponent && childComponent) {
|
|
11748
|
+
const originalSelectOptions = childComponent.data['originalSelectOptions'] ?? Object.assign([], childComponent.data.SelectOptions);
|
|
11749
|
+
const filteredSelectionOptions = originalSelectOptions.filter(option => option.parentExpression == zudfGroup.zModel[parentComponentName]);
|
|
11750
|
+
// manually patch the component formcontrol value
|
|
11751
|
+
const zudfForm = zudfGroup.form;
|
|
11752
|
+
const componentFormControl = zudfForm.controls[item.value];
|
|
11753
|
+
childComponent.setSelectOption(filteredSelectionOptions);
|
|
11754
|
+
componentFormControl.patchValue(zudfGroup.zModel[item.value]);
|
|
11755
|
+
}
|
|
11756
|
+
});
|
|
11757
|
+
// To consider: Trigger the "onchange" event or perform any other necessary actions here
|
|
11758
|
+
});
|
|
11715
11759
|
}
|
|
11716
11760
|
}
|
|
11717
11761
|
generateFormControls(fieldArray, formControls, containerName, isMultiValueGroup = false, fieldValueGrouped = false, index = '') {
|
|
@@ -11748,7 +11792,6 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11748
11792
|
// this for later on, we can easily know this field belong to which zudf and under which container.
|
|
11749
11793
|
if (containerName) {
|
|
11750
11794
|
field['containerName'] = containerName;
|
|
11751
|
-
;
|
|
11752
11795
|
if (!zudfGroup[containerName]) {
|
|
11753
11796
|
zudfGroup[containerName] = [];
|
|
11754
11797
|
}
|
|
@@ -11760,6 +11803,9 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11760
11803
|
if (!this.loadedFieldsSequence) {
|
|
11761
11804
|
this.loadedFieldsSequence = {};
|
|
11762
11805
|
}
|
|
11806
|
+
if (field.Type === 'zuiselectmultiple') {
|
|
11807
|
+
this.componentService.incrementComponentCounter();
|
|
11808
|
+
}
|
|
11763
11809
|
field.Name = this.generateFormControlName(field.Name, containerName);
|
|
11764
11810
|
field.Value = this.generateFormControlName(field.Value, containerName);
|
|
11765
11811
|
this.loadedFieldsSequence[fieldIndex] = {
|
|
@@ -12344,12 +12390,12 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
12344
12390
|
}
|
|
12345
12391
|
}
|
|
12346
12392
|
}
|
|
12347
|
-
ZudfComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ZudfComponent, deps: [{ token:
|
|
12393
|
+
ZudfComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ZudfComponent, deps: [{ token: i2.AlertService }, { token: i2.AuthService }, { token: i2.FieldService }, { token: i2.ToastService }, { token: ComponentErrorHandlerService }, { token: ZComponentService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
12348
12394
|
ZudfComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: ZudfComponent, selector: "app-zudf", usesInheritance: true, ngImport: i0, template: "<div style=\"padding: 15px\" *ngIf=\"data.Title && (!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" class=\"zudf-container\">\r\n <kendo-card *ngIf=\"data.Title\">\r\n <kendo-card-header>\r\n <div>\r\n <ion-label class=\"card-header-title\">{{data.Title}}</ion-label>\r\n </div>\r\n </kendo-card-header>\r\n <kendo-card-body>\r\n <!-- <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of formFields | divzlayout: data.zlayout\"\r\n [field]=\"field\"\r\n [group]=\"group\"\r\n [form]=\"form\"\r\n id=\"{{field.Name}}\">\r\n </app-zformcontrol> -->\r\n <app-zdiv [data]=\"data\" [form]=\"form\" [group]=\"group\" [containerField]=\"containerField\"></app-zdiv>\r\n </kendo-card-body>\r\n </kendo-card>\r\n</div>\r\n\r\n<div *ngIf=\"!data.Title && (!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" [style]=\"data.Style\" class=\"zudf-container\">\r\n <form [formGroup]=\"form\" autocomplete=\"off\" *ngIf=\"!isLoading\">\r\n <!-- <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of formFields | divzlayout: data.zlayout\"\r\n [field]=\"field\"\r\n [group]=\"group\"\r\n [form]=\"form\"\r\n id=\"{{field.Name}}\">\r\n </app-zformcontrol> -->\r\n <app-zdiv [data]=\"data\" [form]=\"form\" [group]=\"group\" [containerField]=\"containerField\"></app-zdiv>\r\n </form>\r\n</div>\r\n", styles: [".card-header-title{color:#fff!important;font-weight:500;font-size:11pt}.zudf-container{width:100%}\n"], components: [{ type: i3$3.CardComponent, selector: "kendo-card", inputs: ["orientation", "width"] }, { type: i3$3.CardHeaderComponent, selector: "kendo-card-header" }, { type: i2$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { type: i3$3.CardBodyComponent, selector: "kendo-card-body" }, { type: ZdivComponent, selector: "app-zdiv" }], directives: [{ type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
12349
12395
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ZudfComponent, decorators: [{
|
|
12350
12396
|
type: Component,
|
|
12351
12397
|
args: [{ selector: 'app-zudf', template: "<div style=\"padding: 15px\" *ngIf=\"data.Title && (!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" class=\"zudf-container\">\r\n <kendo-card *ngIf=\"data.Title\">\r\n <kendo-card-header>\r\n <div>\r\n <ion-label class=\"card-header-title\">{{data.Title}}</ion-label>\r\n </div>\r\n </kendo-card-header>\r\n <kendo-card-body>\r\n <!-- <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of formFields | divzlayout: data.zlayout\"\r\n [field]=\"field\"\r\n [group]=\"group\"\r\n [form]=\"form\"\r\n id=\"{{field.Name}}\">\r\n </app-zformcontrol> -->\r\n <app-zdiv [data]=\"data\" [form]=\"form\" [group]=\"group\" [containerField]=\"containerField\"></app-zdiv>\r\n </kendo-card-body>\r\n </kendo-card>\r\n</div>\r\n\r\n<div *ngIf=\"!data.Title && (!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" [style]=\"data.Style\" class=\"zudf-container\">\r\n <form [formGroup]=\"form\" autocomplete=\"off\" *ngIf=\"!isLoading\">\r\n <!-- <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of formFields | divzlayout: data.zlayout\"\r\n [field]=\"field\"\r\n [group]=\"group\"\r\n [form]=\"form\"\r\n id=\"{{field.Name}}\">\r\n </app-zformcontrol> -->\r\n <app-zdiv [data]=\"data\" [form]=\"form\" [group]=\"group\" [containerField]=\"containerField\"></app-zdiv>\r\n </form>\r\n</div>\r\n", styles: [".card-header-title{color:#fff!important;font-weight:500;font-size:11pt}.zudf-container{width:100%}\n"] }]
|
|
12352
|
-
}], ctorParameters: function () { return [{ type:
|
|
12398
|
+
}], ctorParameters: function () { return [{ type: i2.AlertService }, { type: i2.AuthService }, { type: i2.FieldService }, { type: i2.ToastService }, { type: ComponentErrorHandlerService }, { type: ZComponentService }, { type: i0.ChangeDetectorRef }]; } });
|
|
12353
12399
|
var ComponentType;
|
|
12354
12400
|
(function (ComponentType) {
|
|
12355
12401
|
ComponentType["text"] = "text";
|