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
|
@@ -3,7 +3,7 @@ import * as i0 from '@angular/core';
|
|
|
3
3
|
import { Injectable, Component, Input, Directive, ViewChild, Inject, HostListener, Pipe, ViewContainerRef, TemplateRef, EventEmitter, Output, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
4
4
|
import * as i1$1 from '@angular/router';
|
|
5
5
|
import { NavigationStart, NavigationEnd, NavigationError, RouterModule } from '@angular/router';
|
|
6
|
-
import { of, switchMap, forkJoin, tap,
|
|
6
|
+
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';
|
|
7
7
|
import { map, tap as tap$1, switchMap as switchMap$1, delay, take, filter, concatMap } from 'rxjs/operators';
|
|
8
8
|
import * as i2 from 'mmhglobal-zcore';
|
|
9
9
|
import { ZComponentHelper, ZComponentProperties, ZGroup, MESSAGETYPE, ZSelectPostApiParams, UploadMetaData, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
|
|
@@ -205,6 +205,8 @@ class ZComponentService {
|
|
|
205
205
|
this.componentObjectService = componentObjectService;
|
|
206
206
|
this.translateService = translateService;
|
|
207
207
|
this.zcoreService = zcoreService;
|
|
208
|
+
this.componentCounter = 0;
|
|
209
|
+
this.componentLoadSubject = new Subject();
|
|
208
210
|
this.DEFAULT_ISEDIT = true;
|
|
209
211
|
//#region DateTime Conversion
|
|
210
212
|
this.timePickerDateType = ['zuidatetime', 'ztime', 'zuitime'];
|
|
@@ -441,6 +443,21 @@ class ZComponentService {
|
|
|
441
443
|
const result = `${(Math.abs(num) / 60).toString().padStart(2, '0')}:00`;
|
|
442
444
|
return `${prefix}${result}`;
|
|
443
445
|
}
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region track component loaded
|
|
448
|
+
get componentLoaded$() {
|
|
449
|
+
return this.componentLoadSubject.asObservable();
|
|
450
|
+
}
|
|
451
|
+
incrementComponentCounter() {
|
|
452
|
+
this.componentCounter++;
|
|
453
|
+
}
|
|
454
|
+
decrementComponentCounter() {
|
|
455
|
+
this.componentCounter--;
|
|
456
|
+
if (this.componentCounter === 0) {
|
|
457
|
+
this.componentLoadSubject.next();
|
|
458
|
+
this.componentLoadSubject.complete();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
444
461
|
}
|
|
445
462
|
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 });
|
|
446
463
|
ZComponentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ZComponentService, providedIn: 'root' });
|
|
@@ -6559,11 +6576,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
6559
6576
|
|
|
6560
6577
|
/********** Angular **********/
|
|
6561
6578
|
class ZselectmultipleComponent extends InputFieldBase {
|
|
6562
|
-
constructor(resourceApiService, webApiService, cacheService,
|
|
6563
|
-
super(
|
|
6579
|
+
constructor(resourceApiService, webApiService, cacheService, componentService) {
|
|
6580
|
+
super(componentService);
|
|
6564
6581
|
this.resourceApiService = resourceApiService;
|
|
6565
6582
|
this.webApiService = webApiService;
|
|
6566
6583
|
this.cacheService = cacheService;
|
|
6584
|
+
this.componentService = componentService;
|
|
6567
6585
|
this.items = [];
|
|
6568
6586
|
this.infinitezData = [];
|
|
6569
6587
|
this.infiniteSearchText = null;
|
|
@@ -6704,6 +6722,11 @@ class ZselectmultipleComponent extends InputFieldBase {
|
|
|
6704
6722
|
}
|
|
6705
6723
|
super.focusOnDefault(this.focus.bind(this));
|
|
6706
6724
|
}
|
|
6725
|
+
ngAfterViewInit() {
|
|
6726
|
+
if (this.data.SubType === 'zudf') {
|
|
6727
|
+
this.componentService.decrementComponentCounter();
|
|
6728
|
+
}
|
|
6729
|
+
}
|
|
6707
6730
|
// Auto select first option (if required & only 1 option)
|
|
6708
6731
|
autoSelectFirstOption(required, data, zModelPropertyName, id) {
|
|
6709
6732
|
if (ZComponentHelper.isNullUndefinedEmpty(id) && required) {
|
|
@@ -11510,13 +11533,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
11510
11533
|
|
|
11511
11534
|
/********** Angular **********/
|
|
11512
11535
|
class ZudfComponent extends ContainerFieldBase {
|
|
11513
|
-
constructor(
|
|
11514
|
-
super(
|
|
11536
|
+
constructor(alertService, authService, fieldService, toastService, componentErrorHandlerService, componentService, cdr) {
|
|
11537
|
+
super(componentService);
|
|
11515
11538
|
this.alertService = alertService;
|
|
11516
11539
|
this.authService = authService;
|
|
11517
11540
|
this.fieldService = fieldService;
|
|
11518
11541
|
this.toastService = toastService;
|
|
11519
11542
|
this.componentErrorHandlerService = componentErrorHandlerService;
|
|
11543
|
+
this.componentService = componentService;
|
|
11520
11544
|
this.cdr = cdr;
|
|
11521
11545
|
// formFields: any[]; // populate using field element.
|
|
11522
11546
|
this.componentProperties = new ZComponentProperties();
|
|
@@ -11732,6 +11756,27 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11732
11756
|
this.data.Value = fieldElements;
|
|
11733
11757
|
this.group[this.componentScopeName].form = this.form;
|
|
11734
11758
|
this.group[this.componentScopeName]['loadedFieldsSequence'] = this.loadedFieldsSequence;
|
|
11759
|
+
this.componentService.componentLoaded$.subscribe(() => {
|
|
11760
|
+
// All components have finished loading
|
|
11761
|
+
const zudfGroup = this.group[this.componentScopeName];
|
|
11762
|
+
zudfGroup['linkedComponent'].forEach(item => {
|
|
11763
|
+
var _a;
|
|
11764
|
+
const linkedComponentSegments = item.value.split('_');
|
|
11765
|
+
const parentComponentName = linkedComponentSegments.slice(0, -1).join('_') + '_' + item.linkedComponent;
|
|
11766
|
+
const parentComponent = ZComponentHelper.getComponentByValue(this.group, parentComponentName);
|
|
11767
|
+
const childComponent = ZComponentHelper.getComponentByValue(this.group, item.value);
|
|
11768
|
+
if (parentComponent && childComponent) {
|
|
11769
|
+
const originalSelectOptions = (_a = childComponent.data['originalSelectOptions']) !== null && _a !== void 0 ? _a : Object.assign([], childComponent.data.SelectOptions);
|
|
11770
|
+
const filteredSelectionOptions = originalSelectOptions.filter(option => option.parentExpression == zudfGroup.zModel[parentComponentName]);
|
|
11771
|
+
// manually patch the component formcontrol value
|
|
11772
|
+
const zudfForm = zudfGroup.form;
|
|
11773
|
+
const componentFormControl = zudfForm.controls[item.value];
|
|
11774
|
+
childComponent.setSelectOption(filteredSelectionOptions);
|
|
11775
|
+
componentFormControl.patchValue(zudfGroup.zModel[item.value]);
|
|
11776
|
+
}
|
|
11777
|
+
});
|
|
11778
|
+
// To consider: Trigger the "onchange" event or perform any other necessary actions here
|
|
11779
|
+
});
|
|
11735
11780
|
}
|
|
11736
11781
|
}
|
|
11737
11782
|
generateFormControls(fieldArray, formControls, containerName, isMultiValueGroup = false, fieldValueGrouped = false, index = '') {
|
|
@@ -11769,7 +11814,6 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11769
11814
|
// this for later on, we can easily know this field belong to which zudf and under which container.
|
|
11770
11815
|
if (containerName) {
|
|
11771
11816
|
field['containerName'] = containerName;
|
|
11772
|
-
;
|
|
11773
11817
|
if (!zudfGroup[containerName]) {
|
|
11774
11818
|
zudfGroup[containerName] = [];
|
|
11775
11819
|
}
|
|
@@ -11781,6 +11825,9 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11781
11825
|
if (!this.loadedFieldsSequence) {
|
|
11782
11826
|
this.loadedFieldsSequence = {};
|
|
11783
11827
|
}
|
|
11828
|
+
if (field.Type === 'zuiselectmultiple') {
|
|
11829
|
+
this.componentService.incrementComponentCounter();
|
|
11830
|
+
}
|
|
11784
11831
|
field.Name = this.generateFormControlName(field.Name, containerName);
|
|
11785
11832
|
field.Value = this.generateFormControlName(field.Value, containerName);
|
|
11786
11833
|
this.loadedFieldsSequence[fieldIndex] = {
|
|
@@ -12366,12 +12413,12 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
12366
12413
|
}
|
|
12367
12414
|
}
|
|
12368
12415
|
}
|
|
12369
|
-
ZudfComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ZudfComponent, deps: [{ token:
|
|
12416
|
+
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 });
|
|
12370
12417
|
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"] }] });
|
|
12371
12418
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ZudfComponent, decorators: [{
|
|
12372
12419
|
type: Component,
|
|
12373
12420
|
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"] }]
|
|
12374
|
-
}], ctorParameters: function () { return [{ type:
|
|
12421
|
+
}], ctorParameters: function () { return [{ type: i2.AlertService }, { type: i2.AuthService }, { type: i2.FieldService }, { type: i2.ToastService }, { type: ComponentErrorHandlerService }, { type: ZComponentService }, { type: i0.ChangeDetectorRef }]; } });
|
|
12375
12422
|
var ComponentType;
|
|
12376
12423
|
(function (ComponentType) {
|
|
12377
12424
|
ComponentType["text"] = "text";
|