mmhglobal-dynamicform 2.6.5 → 2.7.1
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 +8 -0
- package/esm2020/lib/services/main.service.mjs +60 -25
- package/esm2020/lib/zform/zform.component.mjs +8 -4
- package/esm2020/lib/zudf/zudf.component.mjs +6 -1
- package/fesm2015/mmhglobal-dynamicform.mjs +71 -28
- package/fesm2015/mmhglobal-dynamicform.mjs.map +1 -1
- package/fesm2020/mmhglobal-dynamicform.mjs +71 -28
- package/fesm2020/mmhglobal-dynamicform.mjs.map +1 -1
- package/lib/services/main.service.d.ts +14 -4
- package/lib/zudf/zudf.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
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
|
+
import { HttpParams, HttpEventType } from '@angular/common/http';
|
|
4
5
|
import * as i2$2 from '@angular/router';
|
|
5
6
|
import { NavigationStart, NavigationEnd, NavigationError, RouterModule } from '@angular/router';
|
|
6
7
|
import { of, switchMap, forkJoin, tap, BehaviorSubject, Subject, map as map$1, isObservable, interval, takeWhile, from, delay as delay$1, filter as filter$1, first } from 'rxjs';
|
|
7
8
|
import { map, tap as tap$1, switchMap as switchMap$1, delay, take, filter, concatMap, ignoreElements } from 'rxjs/operators';
|
|
8
|
-
import * as i2 from 'mmhglobal-zcore';
|
|
9
|
-
import { ZComponentHelper, ZComponentProperties, FieldType, ComponentType as ComponentType$1, ZGroup, MESSAGETYPE, DefaultMessage, DefaultDialogTitle, ZSelectPostApiParams, UploadMetaData, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
|
|
10
9
|
import * as i1$1 from '@progress/kendo-angular-dialog';
|
|
11
10
|
import { DialogContentBase } from '@progress/kendo-angular-dialog';
|
|
11
|
+
import * as i2 from 'mmhglobal-zcore';
|
|
12
|
+
import { ZComponentHelper, ZComponentProperties, FieldType, ComponentType as ComponentType$1, ZGroup, MESSAGETYPE, DefaultMessage, DefaultDialogTitle, ZSelectPostApiParams, UploadMetaData, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
|
|
12
13
|
import * as i4 from 'mmhglobal-zmodal';
|
|
13
14
|
import { ZmodalHelper, MmhglobalZmodalModule, ModalService } from 'mmhglobal-zmodal';
|
|
14
15
|
import * as i2$1 from '@ionic/angular';
|
|
@@ -20,7 +21,6 @@ import { Validators, FormGroup, FormControl, FormsModule, ReactiveFormsModule }
|
|
|
20
21
|
import * as i1 from 'mmhglobal-middleware';
|
|
21
22
|
import * as i5$1 from '@angular/common';
|
|
22
23
|
import { formatDate, CommonModule } from '@angular/common';
|
|
23
|
-
import { HttpParams, HttpEventType } from '@angular/common/http';
|
|
24
24
|
import * as i7 from '@angular/flex-layout/extended';
|
|
25
25
|
import * as i7$1 from '@progress/kendo-angular-grid';
|
|
26
26
|
import { DataBindingDirective, GridComponent, BaseFilterCellComponent, ExcelModule, GridModule } from '@progress/kendo-angular-grid';
|
|
@@ -1617,7 +1617,7 @@ class ZformComponent {
|
|
|
1617
1617
|
console.error('Field Name Duplication: ' + field.Name + '; ', field);
|
|
1618
1618
|
}
|
|
1619
1619
|
}
|
|
1620
|
-
getFormControls(fieldArray, formControls) {
|
|
1620
|
+
getFormControls(fieldArray, formControls, containerIsVisible = true) {
|
|
1621
1621
|
fieldArray.forEach(field => {
|
|
1622
1622
|
if (!field.SubType) {
|
|
1623
1623
|
this.addToFieldIndex(field);
|
|
@@ -1629,13 +1629,17 @@ class ZformComponent {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
else {
|
|
1631
1631
|
if (Array.isArray(field.Value)) {
|
|
1632
|
-
|
|
1632
|
+
const containerIsVisible = ZComponentHelper.isVisibleFormControl(this, field);
|
|
1633
|
+
this.getFormControls(field.Value, formControls, containerIsVisible);
|
|
1633
1634
|
}
|
|
1634
1635
|
else {
|
|
1635
|
-
this.fieldService.incrementComponentCounter(field.FieldElementName);
|
|
1636
1636
|
const isFormControl = ZComponentHelper.isFormControl(field);
|
|
1637
1637
|
const isVisible = ZComponentHelper.isVisibleFormControl(this, field);
|
|
1638
1638
|
const isRequired = ZComponentHelper.isRequiredFormControl(this, field);
|
|
1639
|
+
// if container || control visible == false, dont increase the counter.
|
|
1640
|
+
if (isVisible && containerIsVisible) {
|
|
1641
|
+
this.fieldService.incrementComponentCounter(field.FieldElementName);
|
|
1642
|
+
}
|
|
1639
1643
|
if (isFormControl === true) {
|
|
1640
1644
|
const validators = ZComponentHelper.getValidators(field, isVisible, isRequired);
|
|
1641
1645
|
formControls[field.Value] = new FormControl(this.group.zModel[field.Value], validators);
|
|
@@ -1936,11 +1940,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
1936
1940
|
type: Input
|
|
1937
1941
|
}] } });
|
|
1938
1942
|
|
|
1943
|
+
// import { ModalService } from '../zmodal/modal.service';
|
|
1939
1944
|
// import { ZmodalPage } from '../zmodal/zmodal.page';
|
|
1940
1945
|
// import { ZComponentHelper, ZComponentOutputEvent, ModalPageParams, ZGrid } from '../dynamicform/zcomponent.model';
|
|
1941
1946
|
// import { ZGroup, ZField } from '../model/zgroup.model';
|
|
1942
1947
|
class MainService {
|
|
1943
|
-
constructor(router, activatedRoute, modalCtrl, navController, alertService, cacheService, fieldService, resourceApiService, componentErrorHandler, webApiService, zcoreService, modalService, storageService, debugService, translationService) {
|
|
1948
|
+
constructor(router, activatedRoute, modalCtrl, navController, alertService, cacheService, fieldService, resourceApiService, componentErrorHandler, webApiService, zcoreService, modalService, storageService, debugService, translationService, signalr, dialogService, oauth2Service) {
|
|
1944
1949
|
this.router = router;
|
|
1945
1950
|
this.activatedRoute = activatedRoute;
|
|
1946
1951
|
this.modalCtrl = modalCtrl;
|
|
@@ -1956,6 +1961,9 @@ class MainService {
|
|
|
1956
1961
|
this.storageService = storageService;
|
|
1957
1962
|
this.debugService = debugService;
|
|
1958
1963
|
this.translationService = translationService;
|
|
1964
|
+
this.signalr = signalr;
|
|
1965
|
+
this.dialogService = dialogService;
|
|
1966
|
+
this.oauth2Service = oauth2Service;
|
|
1959
1967
|
this.backNavigationPath = [];
|
|
1960
1968
|
this.routeParam = [];
|
|
1961
1969
|
this.NAVIGATION_PARAMS_STORAGE_KEY = 'routeParam';
|
|
@@ -1964,6 +1972,16 @@ class MainService {
|
|
|
1964
1972
|
this.NAVIGATED_RELOAD_GRID_STORAGE_KEY = 'navigatedReloadGrid';
|
|
1965
1973
|
this.CLONE_NEW_MODEL_CACHE_KEY = 'cloneNewModel';
|
|
1966
1974
|
this.secretKey = 'my-secret-key';
|
|
1975
|
+
//#region for signalR alert
|
|
1976
|
+
this.getListFieldName = (fieldName) => {
|
|
1977
|
+
const params = new HttpParams().set("name", fieldName);
|
|
1978
|
+
return this.oauth2Service.httpGet$(this.fieldService.downloadListFieldUrl, params).pipe(map(res => res.FieldElementMasterId), switchMap$1(id => this.oauth2Service.httpGet$(this.fieldService.downloadFormFieldUrl, { id })), map(res => res.Name));
|
|
1979
|
+
};
|
|
1980
|
+
this.clearFormListFields = () => {
|
|
1981
|
+
this.fieldService.dataFormFields = {};
|
|
1982
|
+
this.fieldService.dataListFields = {};
|
|
1983
|
+
this.fieldService.dataListFieldItems = {};
|
|
1984
|
+
};
|
|
1967
1985
|
console.log('MainService constructor');
|
|
1968
1986
|
this.environment = this.zcoreService.getEnvironment();
|
|
1969
1987
|
this.oauthEnvironmentUrl = this.environment.e1OauthUrl + '/';
|
|
@@ -1973,10 +1991,7 @@ class MainService {
|
|
|
1973
1991
|
console.log(event);
|
|
1974
1992
|
// Reset the routeParam,backNavigationPath and related sessionStorage current page is startup page
|
|
1975
1993
|
if (this.getStartupPage() === event.url) {
|
|
1976
|
-
this.
|
|
1977
|
-
this.backNavigationPath = [];
|
|
1978
|
-
this.storageService.set(this.NAVIGATION_PARAMS_STORAGE_KEY, JSON.stringify(this.routeParam));
|
|
1979
|
-
this.storageService.set(this.BACK_NAVIGATION_PATH_STORAGE_KEY, JSON.stringify(this.backNavigationPath));
|
|
1994
|
+
this.resetRouteParam();
|
|
1980
1995
|
}
|
|
1981
1996
|
}
|
|
1982
1997
|
if (event instanceof NavigationEnd) {
|
|
@@ -1991,6 +2006,13 @@ class MainService {
|
|
|
1991
2006
|
}
|
|
1992
2007
|
});
|
|
1993
2008
|
}
|
|
2009
|
+
signalrGetEvent() {
|
|
2010
|
+
return this.signalr.getEvent();
|
|
2011
|
+
}
|
|
2012
|
+
dialogOpen(options) {
|
|
2013
|
+
return this.dialogService.open(options);
|
|
2014
|
+
}
|
|
2015
|
+
//#endregion
|
|
1994
2016
|
startUp() {
|
|
1995
2017
|
console.log('At main.service (StartUp) ...');
|
|
1996
2018
|
}
|
|
@@ -2293,6 +2315,19 @@ class MainService {
|
|
|
2293
2315
|
}
|
|
2294
2316
|
return false;
|
|
2295
2317
|
}
|
|
2318
|
+
navigateFromMenu(pageName) {
|
|
2319
|
+
const { startUpPage } = this.environment;
|
|
2320
|
+
this.setRouteParam([`${startUpPage}`]);
|
|
2321
|
+
this.backNavigationPath.push(this.getStartupPage());
|
|
2322
|
+
this.storageService.set(this.BACK_NAVIGATION_PATH_STORAGE_KEY, JSON.stringify([this.getStartupPage()]));
|
|
2323
|
+
this.router.navigate([pageName], { replaceUrl: true });
|
|
2324
|
+
}
|
|
2325
|
+
resetRouteParam() {
|
|
2326
|
+
this.routeParam = [];
|
|
2327
|
+
this.backNavigationPath = [];
|
|
2328
|
+
this.storageService.set(this.NAVIGATION_PARAMS_STORAGE_KEY, JSON.stringify(this.routeParam));
|
|
2329
|
+
this.storageService.set(this.BACK_NAVIGATION_PATH_STORAGE_KEY, JSON.stringify(this.backNavigationPath));
|
|
2330
|
+
}
|
|
2296
2331
|
getNavigationParams() {
|
|
2297
2332
|
this.routeParam = this.routeParam || [];
|
|
2298
2333
|
if (this.routeParam.length === 0) {
|
|
@@ -2395,6 +2430,16 @@ class MainService {
|
|
|
2395
2430
|
this.tryUpdateGroupTrigger(false);
|
|
2396
2431
|
const backNavigationPath = JSON.parse(sessionStorage.getItem(this.BACK_NAVIGATION_PATH_STORAGE_KEY));
|
|
2397
2432
|
const backNavigationURL = group.backNavigationPage || backNavigationPath[backNavigationPath.length - 1];
|
|
2433
|
+
//const backNavigationPathLastValue = backNavigationPath && backNavigationPath.length > 0 ? backNavigationPath[backNavigationPath.length - 1] : null;
|
|
2434
|
+
// if navated by external(prefixed url) when close, direct go to menu/startu page
|
|
2435
|
+
//const invalidSubstrings = ['?l=', '?f=', '?r=', '#'];
|
|
2436
|
+
//const containsAny = (str, substrings) => {
|
|
2437
|
+
// return substrings.some(substring => str.includes(substring));
|
|
2438
|
+
//};
|
|
2439
|
+
//if (containsAny(backNavigationPathLastValue, invalidSubstrings)) {
|
|
2440
|
+
// await this.router.navigateByUrl(this.getStartupPage(), { replaceUrl: true });
|
|
2441
|
+
//}
|
|
2442
|
+
//else {
|
|
2398
2443
|
if (!backNavigationURL) {
|
|
2399
2444
|
console.error("Error navigating back to previous page: backNavigationURL is not set.");
|
|
2400
2445
|
//throw new Error("BackNavigationPath not set.");
|
|
@@ -2420,6 +2465,7 @@ class MainService {
|
|
|
2420
2465
|
console.error(`Error navigating back to previous page: ${error.message}`);
|
|
2421
2466
|
//throw error;
|
|
2422
2467
|
}
|
|
2468
|
+
//}
|
|
2423
2469
|
});
|
|
2424
2470
|
}
|
|
2425
2471
|
getStartupPage() {
|
|
@@ -2477,8 +2523,7 @@ class MainService {
|
|
|
2477
2523
|
group.isTriggered = false;
|
|
2478
2524
|
}
|
|
2479
2525
|
newModel(event, group) {
|
|
2480
|
-
of([])
|
|
2481
|
-
.pipe(switchMap$1((zmodel) => {
|
|
2526
|
+
of([]).pipe(switchMap$1((zmodel) => {
|
|
2482
2527
|
console.log("Before new, zModel:", zmodel);
|
|
2483
2528
|
return this.beforeNewModel(group);
|
|
2484
2529
|
}), tap$1(() => {
|
|
@@ -2543,8 +2588,7 @@ class MainService {
|
|
|
2543
2588
|
this.afterNewModel(group);
|
|
2544
2589
|
}
|
|
2545
2590
|
}
|
|
2546
|
-
}))
|
|
2547
|
-
.subscribe();
|
|
2591
|
+
})).subscribe();
|
|
2548
2592
|
}
|
|
2549
2593
|
createModel(event, group) {
|
|
2550
2594
|
const fg = group.form;
|
|
@@ -2558,8 +2602,7 @@ class MainService {
|
|
|
2558
2602
|
this.componentErrorHandler.showFormGroupErrorMessage(group, fg);
|
|
2559
2603
|
return;
|
|
2560
2604
|
}
|
|
2561
|
-
of(group.zModel)
|
|
2562
|
-
.pipe(switchMap$1((zmodel) => {
|
|
2605
|
+
of(group.zModel).pipe(switchMap$1((zmodel) => {
|
|
2563
2606
|
console.log("Before create, zModel:", zmodel);
|
|
2564
2607
|
return this.beforeCreateModel(group);
|
|
2565
2608
|
}), tap$1(() => {
|
|
@@ -2569,9 +2612,7 @@ class MainService {
|
|
|
2569
2612
|
}), switchMap$1(() => {
|
|
2570
2613
|
const newModel = Object.assign({}, group.zModel);
|
|
2571
2614
|
ZComponentHelper.removeNullFields(newModel);
|
|
2572
|
-
return this.webApiService
|
|
2573
|
-
.httpPost$(group.resourceURL, newModel)
|
|
2574
|
-
.pipe(tap$1((resp) => {
|
|
2615
|
+
return this.webApiService.httpPost$(group.resourceURL, newModel).pipe(tap$1((resp) => {
|
|
2575
2616
|
createModelres = resp;
|
|
2576
2617
|
return resp;
|
|
2577
2618
|
}), tap$1((res) => {
|
|
@@ -2602,8 +2643,7 @@ class MainService {
|
|
|
2602
2643
|
}
|
|
2603
2644
|
// console.log("Done updateModel updated zModel:", fg.value);
|
|
2604
2645
|
// this.toastService.show("Record is created successfully.");
|
|
2605
|
-
}))
|
|
2606
|
-
.subscribe();
|
|
2646
|
+
})).subscribe();
|
|
2607
2647
|
}
|
|
2608
2648
|
updateModel(event, group) {
|
|
2609
2649
|
this.updateModelObservable(event, group).subscribe();
|
|
@@ -2618,14 +2658,12 @@ class MainService {
|
|
|
2618
2658
|
}
|
|
2619
2659
|
return of(false);
|
|
2620
2660
|
}
|
|
2621
|
-
updateAPIObservable = updateAPIObservable || this.webApiService.httpPut$(group.resourceURL + "/" + group.zModel.Id, group.zModel)
|
|
2622
|
-
.pipe(tap$1((res) => {
|
|
2661
|
+
updateAPIObservable = updateAPIObservable || this.webApiService.httpPut$(group.resourceURL + "/" + group.zModel.Id, group.zModel, false).pipe(tap$1((res) => {
|
|
2623
2662
|
this.handleSuccess(res, resMessage);
|
|
2624
2663
|
}
|
|
2625
2664
|
//this.handleSuccess(res, "Record is updated successfully.")
|
|
2626
2665
|
));
|
|
2627
|
-
return of(group.zModel)
|
|
2628
|
-
.pipe(switchMap$1((zmodel) => {
|
|
2666
|
+
return of(group.zModel).pipe(switchMap$1((zmodel) => {
|
|
2629
2667
|
console.log("Before update, zModel:", zmodel);
|
|
2630
2668
|
return this.beforeUpdateModel(group);
|
|
2631
2669
|
}), tap$1(() => {
|
|
@@ -3019,14 +3057,14 @@ class MainService {
|
|
|
3019
3057
|
}
|
|
3020
3058
|
}
|
|
3021
3059
|
}
|
|
3022
|
-
MainService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MainService, deps: [{ token: i2$2.Router }, { token: i2$2.ActivatedRoute }, { token: i2$1.ModalController }, { token: i2$1.NavController }, { token: i2.AlertService }, { token: i2.CacheService }, { token: i2.FieldService }, { token: i2.ResourceApiService }, { token: ComponentErrorHandlerService }, { token: i2.WebApiService }, { token: i2.ZCoreService }, { token: i4.ModalService }, { token: i2.StorageSessionService }, { token: ZComponentDebugService }, { token: i2.TranslationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3060
|
+
MainService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MainService, deps: [{ token: i2$2.Router }, { token: i2$2.ActivatedRoute }, { token: i2$1.ModalController }, { token: i2$1.NavController }, { token: i2.AlertService }, { token: i2.CacheService }, { token: i2.FieldService }, { token: i2.ResourceApiService }, { token: ComponentErrorHandlerService }, { token: i2.WebApiService }, { token: i2.ZCoreService }, { token: i4.ModalService }, { token: i2.StorageSessionService }, { token: ZComponentDebugService }, { token: i2.TranslationService }, { token: i2.SignalrService }, { token: i1$1.DialogService }, { token: i2.OAuth2Service }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3023
3061
|
MainService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MainService, providedIn: 'root' });
|
|
3024
3062
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MainService, decorators: [{
|
|
3025
3063
|
type: Injectable,
|
|
3026
3064
|
args: [{
|
|
3027
3065
|
providedIn: 'root',
|
|
3028
3066
|
}]
|
|
3029
|
-
}], ctorParameters: function () { return [{ type: i2$2.Router }, { type: i2$2.ActivatedRoute }, { type: i2$1.ModalController }, { type: i2$1.NavController }, { type: i2.AlertService }, { type: i2.CacheService }, { type: i2.FieldService }, { type: i2.ResourceApiService }, { type: ComponentErrorHandlerService }, { type: i2.WebApiService }, { type: i2.ZCoreService }, { type: i4.ModalService }, { type: i2.StorageSessionService }, { type: ZComponentDebugService }, { type: i2.TranslationService }]; } });
|
|
3067
|
+
}], ctorParameters: function () { return [{ type: i2$2.Router }, { type: i2$2.ActivatedRoute }, { type: i2$1.ModalController }, { type: i2$1.NavController }, { type: i2.AlertService }, { type: i2.CacheService }, { type: i2.FieldService }, { type: i2.ResourceApiService }, { type: ComponentErrorHandlerService }, { type: i2.WebApiService }, { type: i2.ZCoreService }, { type: i4.ModalService }, { type: i2.StorageSessionService }, { type: ZComponentDebugService }, { type: i2.TranslationService }, { type: i2.SignalrService }, { type: i1$1.DialogService }, { type: i2.OAuth2Service }]; } });
|
|
3030
3068
|
function refreshGrid(group) {
|
|
3031
3069
|
const zgridControl = group["gridOptions"];
|
|
3032
3070
|
if (zgridControl) {
|
|
@@ -11731,6 +11769,11 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11731
11769
|
this.isLoading = false;
|
|
11732
11770
|
})).subscribe();
|
|
11733
11771
|
}
|
|
11772
|
+
ngOnDestroy() {
|
|
11773
|
+
if (this.subscription) {
|
|
11774
|
+
this.subscription.unsubscribe();
|
|
11775
|
+
}
|
|
11776
|
+
}
|
|
11734
11777
|
/**
|
|
11735
11778
|
* Renders the field element and sets up the form.
|
|
11736
11779
|
*/
|