mmhglobal-dynamicform 2.6.4 → 2.7.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 +6 -0
- package/esm2020/lib/services/main.service.mjs +60 -25
- package/esm2020/lib/zudf/zudf.component.mjs +4 -4
- package/fesm2015/mmhglobal-dynamicform.mjs +62 -28
- package/fesm2015/mmhglobal-dynamicform.mjs.map +1 -1
- package/fesm2020/mmhglobal-dynamicform.mjs +62 -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 +2 -2
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
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
|
+
import { HttpParams, HttpEventType } from '@angular/common/http';
|
|
3
4
|
import * as i2$2 from '@angular/router';
|
|
4
5
|
import { NavigationStart, NavigationEnd, NavigationError, RouterModule } from '@angular/router';
|
|
5
6
|
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';
|
|
6
7
|
import { map, tap as tap$1, switchMap as switchMap$1, delay, take, filter, concatMap, ignoreElements } from 'rxjs/operators';
|
|
7
|
-
import * as i2 from 'mmhglobal-zcore';
|
|
8
|
-
import { ZComponentHelper, ZComponentProperties, FieldType, ComponentType as ComponentType$1, ZGroup, MESSAGETYPE, DefaultMessage, DefaultDialogTitle, ZSelectPostApiParams, UploadMetaData, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
|
|
9
8
|
import * as i1$1 from '@progress/kendo-angular-dialog';
|
|
10
9
|
import { DialogContentBase } from '@progress/kendo-angular-dialog';
|
|
10
|
+
import * as i2 from 'mmhglobal-zcore';
|
|
11
|
+
import { ZComponentHelper, ZComponentProperties, FieldType, ComponentType as ComponentType$1, ZGroup, MESSAGETYPE, DefaultMessage, DefaultDialogTitle, ZSelectPostApiParams, UploadMetaData, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
|
|
11
12
|
import * as i4 from 'mmhglobal-zmodal';
|
|
12
13
|
import { ZmodalHelper, MmhglobalZmodalModule, ModalService } from 'mmhglobal-zmodal';
|
|
13
14
|
import * as i2$1 from '@ionic/angular';
|
|
@@ -19,7 +20,6 @@ import { Validators, FormGroup, FormControl, FormsModule, ReactiveFormsModule }
|
|
|
19
20
|
import * as i1 from 'mmhglobal-middleware';
|
|
20
21
|
import * as i5$1 from '@angular/common';
|
|
21
22
|
import { formatDate, CommonModule } from '@angular/common';
|
|
22
|
-
import { HttpParams, HttpEventType } from '@angular/common/http';
|
|
23
23
|
import * as i7 from '@angular/flex-layout/extended';
|
|
24
24
|
import * as i7$1 from '@progress/kendo-angular-grid';
|
|
25
25
|
import { DataBindingDirective, GridComponent, BaseFilterCellComponent, ExcelModule, GridModule } from '@progress/kendo-angular-grid';
|
|
@@ -1931,11 +1931,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
1931
1931
|
}] } });
|
|
1932
1932
|
|
|
1933
1933
|
/********** Angular **********/
|
|
1934
|
+
// import { ModalService } from '../zmodal/modal.service';
|
|
1934
1935
|
// import { ZmodalPage } from '../zmodal/zmodal.page';
|
|
1935
1936
|
// import { ZComponentHelper, ZComponentOutputEvent, ModalPageParams, ZGrid } from '../dynamicform/zcomponent.model';
|
|
1936
1937
|
// import { ZGroup, ZField } from '../model/zgroup.model';
|
|
1937
1938
|
class MainService {
|
|
1938
|
-
constructor(router, activatedRoute, modalCtrl, navController, alertService, cacheService, fieldService, resourceApiService, componentErrorHandler, webApiService, zcoreService, modalService, storageService, debugService, translationService) {
|
|
1939
|
+
constructor(router, activatedRoute, modalCtrl, navController, alertService, cacheService, fieldService, resourceApiService, componentErrorHandler, webApiService, zcoreService, modalService, storageService, debugService, translationService, signalr, dialogService, oauth2Service) {
|
|
1939
1940
|
this.router = router;
|
|
1940
1941
|
this.activatedRoute = activatedRoute;
|
|
1941
1942
|
this.modalCtrl = modalCtrl;
|
|
@@ -1951,6 +1952,9 @@ class MainService {
|
|
|
1951
1952
|
this.storageService = storageService;
|
|
1952
1953
|
this.debugService = debugService;
|
|
1953
1954
|
this.translationService = translationService;
|
|
1955
|
+
this.signalr = signalr;
|
|
1956
|
+
this.dialogService = dialogService;
|
|
1957
|
+
this.oauth2Service = oauth2Service;
|
|
1954
1958
|
this.backNavigationPath = [];
|
|
1955
1959
|
this.routeParam = [];
|
|
1956
1960
|
this.NAVIGATION_PARAMS_STORAGE_KEY = 'routeParam';
|
|
@@ -1959,6 +1963,16 @@ class MainService {
|
|
|
1959
1963
|
this.NAVIGATED_RELOAD_GRID_STORAGE_KEY = 'navigatedReloadGrid';
|
|
1960
1964
|
this.CLONE_NEW_MODEL_CACHE_KEY = 'cloneNewModel';
|
|
1961
1965
|
this.secretKey = 'my-secret-key';
|
|
1966
|
+
//#region for signalR alert
|
|
1967
|
+
this.getListFieldName = (fieldName) => {
|
|
1968
|
+
const params = new HttpParams().set("name", fieldName);
|
|
1969
|
+
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));
|
|
1970
|
+
};
|
|
1971
|
+
this.clearFormListFields = () => {
|
|
1972
|
+
this.fieldService.dataFormFields = {};
|
|
1973
|
+
this.fieldService.dataListFields = {};
|
|
1974
|
+
this.fieldService.dataListFieldItems = {};
|
|
1975
|
+
};
|
|
1962
1976
|
console.log('MainService constructor');
|
|
1963
1977
|
this.environment = this.zcoreService.getEnvironment();
|
|
1964
1978
|
this.oauthEnvironmentUrl = this.environment.e1OauthUrl + '/';
|
|
@@ -1968,10 +1982,7 @@ class MainService {
|
|
|
1968
1982
|
console.log(event);
|
|
1969
1983
|
// Reset the routeParam,backNavigationPath and related sessionStorage current page is startup page
|
|
1970
1984
|
if (this.getStartupPage() === event.url) {
|
|
1971
|
-
this.
|
|
1972
|
-
this.backNavigationPath = [];
|
|
1973
|
-
this.storageService.set(this.NAVIGATION_PARAMS_STORAGE_KEY, JSON.stringify(this.routeParam));
|
|
1974
|
-
this.storageService.set(this.BACK_NAVIGATION_PATH_STORAGE_KEY, JSON.stringify(this.backNavigationPath));
|
|
1985
|
+
this.resetRouteParam();
|
|
1975
1986
|
}
|
|
1976
1987
|
}
|
|
1977
1988
|
if (event instanceof NavigationEnd) {
|
|
@@ -1986,6 +1997,13 @@ class MainService {
|
|
|
1986
1997
|
}
|
|
1987
1998
|
});
|
|
1988
1999
|
}
|
|
2000
|
+
signalrGetEvent() {
|
|
2001
|
+
return this.signalr.getEvent();
|
|
2002
|
+
}
|
|
2003
|
+
dialogOpen(options) {
|
|
2004
|
+
return this.dialogService.open(options);
|
|
2005
|
+
}
|
|
2006
|
+
//#endregion
|
|
1989
2007
|
startUp() {
|
|
1990
2008
|
console.log('At main.service (StartUp) ...');
|
|
1991
2009
|
}
|
|
@@ -2287,6 +2305,19 @@ class MainService {
|
|
|
2287
2305
|
}
|
|
2288
2306
|
return false;
|
|
2289
2307
|
}
|
|
2308
|
+
navigateFromMenu(pageName) {
|
|
2309
|
+
const { startUpPage } = this.environment;
|
|
2310
|
+
this.setRouteParam([`${startUpPage}`]);
|
|
2311
|
+
this.backNavigationPath.push(this.getStartupPage());
|
|
2312
|
+
this.storageService.set(this.BACK_NAVIGATION_PATH_STORAGE_KEY, JSON.stringify([this.getStartupPage()]));
|
|
2313
|
+
this.router.navigate([pageName], { replaceUrl: true });
|
|
2314
|
+
}
|
|
2315
|
+
resetRouteParam() {
|
|
2316
|
+
this.routeParam = [];
|
|
2317
|
+
this.backNavigationPath = [];
|
|
2318
|
+
this.storageService.set(this.NAVIGATION_PARAMS_STORAGE_KEY, JSON.stringify(this.routeParam));
|
|
2319
|
+
this.storageService.set(this.BACK_NAVIGATION_PATH_STORAGE_KEY, JSON.stringify(this.backNavigationPath));
|
|
2320
|
+
}
|
|
2290
2321
|
getNavigationParams() {
|
|
2291
2322
|
this.routeParam = this.routeParam || [];
|
|
2292
2323
|
if (this.routeParam.length === 0) {
|
|
@@ -2388,6 +2419,16 @@ class MainService {
|
|
|
2388
2419
|
this.tryUpdateGroupTrigger(false);
|
|
2389
2420
|
const backNavigationPath = JSON.parse(sessionStorage.getItem(this.BACK_NAVIGATION_PATH_STORAGE_KEY));
|
|
2390
2421
|
const backNavigationURL = group.backNavigationPage || backNavigationPath[backNavigationPath.length - 1];
|
|
2422
|
+
//const backNavigationPathLastValue = backNavigationPath && backNavigationPath.length > 0 ? backNavigationPath[backNavigationPath.length - 1] : null;
|
|
2423
|
+
// if navated by external(prefixed url) when close, direct go to menu/startu page
|
|
2424
|
+
//const invalidSubstrings = ['?l=', '?f=', '?r=', '#'];
|
|
2425
|
+
//const containsAny = (str, substrings) => {
|
|
2426
|
+
// return substrings.some(substring => str.includes(substring));
|
|
2427
|
+
//};
|
|
2428
|
+
//if (containsAny(backNavigationPathLastValue, invalidSubstrings)) {
|
|
2429
|
+
// await this.router.navigateByUrl(this.getStartupPage(), { replaceUrl: true });
|
|
2430
|
+
//}
|
|
2431
|
+
//else {
|
|
2391
2432
|
if (!backNavigationURL) {
|
|
2392
2433
|
console.error("Error navigating back to previous page: backNavigationURL is not set.");
|
|
2393
2434
|
//throw new Error("BackNavigationPath not set.");
|
|
@@ -2413,6 +2454,7 @@ class MainService {
|
|
|
2413
2454
|
console.error(`Error navigating back to previous page: ${error.message}`);
|
|
2414
2455
|
//throw error;
|
|
2415
2456
|
}
|
|
2457
|
+
//}
|
|
2416
2458
|
}
|
|
2417
2459
|
getStartupPage() {
|
|
2418
2460
|
const { startUpPage } = this.environment;
|
|
@@ -2469,8 +2511,7 @@ class MainService {
|
|
|
2469
2511
|
group.isTriggered = false;
|
|
2470
2512
|
}
|
|
2471
2513
|
newModel(event, group) {
|
|
2472
|
-
of([])
|
|
2473
|
-
.pipe(switchMap$1((zmodel) => {
|
|
2514
|
+
of([]).pipe(switchMap$1((zmodel) => {
|
|
2474
2515
|
console.log("Before new, zModel:", zmodel);
|
|
2475
2516
|
return this.beforeNewModel(group);
|
|
2476
2517
|
}), tap$1(() => {
|
|
@@ -2535,8 +2576,7 @@ class MainService {
|
|
|
2535
2576
|
this.afterNewModel(group);
|
|
2536
2577
|
}
|
|
2537
2578
|
}
|
|
2538
|
-
}))
|
|
2539
|
-
.subscribe();
|
|
2579
|
+
})).subscribe();
|
|
2540
2580
|
}
|
|
2541
2581
|
createModel(event, group) {
|
|
2542
2582
|
const fg = group.form;
|
|
@@ -2550,8 +2590,7 @@ class MainService {
|
|
|
2550
2590
|
this.componentErrorHandler.showFormGroupErrorMessage(group, fg);
|
|
2551
2591
|
return;
|
|
2552
2592
|
}
|
|
2553
|
-
of(group.zModel)
|
|
2554
|
-
.pipe(switchMap$1((zmodel) => {
|
|
2593
|
+
of(group.zModel).pipe(switchMap$1((zmodel) => {
|
|
2555
2594
|
console.log("Before create, zModel:", zmodel);
|
|
2556
2595
|
return this.beforeCreateModel(group);
|
|
2557
2596
|
}), tap$1(() => {
|
|
@@ -2561,9 +2600,7 @@ class MainService {
|
|
|
2561
2600
|
}), switchMap$1(() => {
|
|
2562
2601
|
const newModel = Object.assign({}, group.zModel);
|
|
2563
2602
|
ZComponentHelper.removeNullFields(newModel);
|
|
2564
|
-
return this.webApiService
|
|
2565
|
-
.httpPost$(group.resourceURL, newModel)
|
|
2566
|
-
.pipe(tap$1((resp) => {
|
|
2603
|
+
return this.webApiService.httpPost$(group.resourceURL, newModel).pipe(tap$1((resp) => {
|
|
2567
2604
|
createModelres = resp;
|
|
2568
2605
|
return resp;
|
|
2569
2606
|
}), tap$1((res) => {
|
|
@@ -2594,8 +2631,7 @@ class MainService {
|
|
|
2594
2631
|
}
|
|
2595
2632
|
// console.log("Done updateModel updated zModel:", fg.value);
|
|
2596
2633
|
// this.toastService.show("Record is created successfully.");
|
|
2597
|
-
}))
|
|
2598
|
-
.subscribe();
|
|
2634
|
+
})).subscribe();
|
|
2599
2635
|
}
|
|
2600
2636
|
updateModel(event, group) {
|
|
2601
2637
|
this.updateModelObservable(event, group).subscribe();
|
|
@@ -2610,14 +2646,12 @@ class MainService {
|
|
|
2610
2646
|
}
|
|
2611
2647
|
return of(false);
|
|
2612
2648
|
}
|
|
2613
|
-
updateAPIObservable = updateAPIObservable || this.webApiService.httpPut$(group.resourceURL + "/" + group.zModel.Id, group.zModel)
|
|
2614
|
-
.pipe(tap$1((res) => {
|
|
2649
|
+
updateAPIObservable = updateAPIObservable || this.webApiService.httpPut$(group.resourceURL + "/" + group.zModel.Id, group.zModel, false, event).pipe(tap$1((res) => {
|
|
2615
2650
|
this.handleSuccess(res, resMessage);
|
|
2616
2651
|
}
|
|
2617
2652
|
//this.handleSuccess(res, "Record is updated successfully.")
|
|
2618
2653
|
));
|
|
2619
|
-
return of(group.zModel)
|
|
2620
|
-
.pipe(switchMap$1((zmodel) => {
|
|
2654
|
+
return of(group.zModel).pipe(switchMap$1((zmodel) => {
|
|
2621
2655
|
console.log("Before update, zModel:", zmodel);
|
|
2622
2656
|
return this.beforeUpdateModel(group);
|
|
2623
2657
|
}), tap$1(() => {
|
|
@@ -3002,14 +3036,14 @@ class MainService {
|
|
|
3002
3036
|
}
|
|
3003
3037
|
}
|
|
3004
3038
|
}
|
|
3005
|
-
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 });
|
|
3039
|
+
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 });
|
|
3006
3040
|
MainService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MainService, providedIn: 'root' });
|
|
3007
3041
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MainService, decorators: [{
|
|
3008
3042
|
type: Injectable,
|
|
3009
3043
|
args: [{
|
|
3010
3044
|
providedIn: 'root',
|
|
3011
3045
|
}]
|
|
3012
|
-
}], 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 }]; } });
|
|
3046
|
+
}], 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 }]; } });
|
|
3013
3047
|
function refreshGrid(group) {
|
|
3014
3048
|
const zgridControl = group["gridOptions"];
|
|
3015
3049
|
if (zgridControl) {
|
|
@@ -12437,13 +12471,13 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
12437
12471
|
}
|
|
12438
12472
|
/**
|
|
12439
12473
|
* Validates a form and returns its ZModel if it is valid.
|
|
12440
|
-
*
|
|
12474
|
+
* @param skipRemoveMvgFieldValue Whether to skip removing the values of mvg fields from the zModel object.
|
|
12441
12475
|
* @returns The form's ZModel if it is valid, or undefined otherwise.
|
|
12442
12476
|
*/
|
|
12443
|
-
getValidatedFormZModel() {
|
|
12477
|
+
getValidatedFormZModel(skipRemovePrefix, skipRemoveMvgFieldValue) {
|
|
12444
12478
|
const isValidForm = this.validateAndShowErrorMessage();
|
|
12445
12479
|
if (isValidForm) {
|
|
12446
|
-
return this.getZModel();
|
|
12480
|
+
return this.getZModel(skipRemovePrefix, skipRemoveMvgFieldValue);
|
|
12447
12481
|
}
|
|
12448
12482
|
return undefined;
|
|
12449
12483
|
}
|