mmhglobal-dynamicform 2.13.0 → 2.14.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 +7 -0
- package/esm2020/lib/services/main.service.mjs +6 -4
- package/esm2020/lib/services/zcomponent.debug.service.mjs +38 -48
- package/esm2020/lib/uiactionbutton/uiactionbutton.component.mjs +3 -3
- package/esm2020/lib/uipage/uipage.component.mjs +7 -7
- package/esm2020/lib/znumeric/znumeric.component.mjs +22 -18
- package/fesm2015/mmhglobal-dynamicform.mjs +71 -73
- package/fesm2015/mmhglobal-dynamicform.mjs.map +1 -1
- package/fesm2020/mmhglobal-dynamicform.mjs +69 -73
- package/fesm2020/mmhglobal-dynamicform.mjs.map +1 -1
- package/lib/services/main.service.d.ts +2 -2
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import { NavigationStart, NavigationEnd, NavigationError, RouterModule } from '@
|
|
|
7
7
|
import { BehaviorSubject, forkJoin, of, tap as tap$1, map as map$1, isObservable, switchMap as switchMap$1, interval, takeWhile, from, Subject, delay as delay$1, filter, first, auditTime } from 'rxjs';
|
|
8
8
|
import { tap, switchMap, map, take, delay, concatMap, ignoreElements } from 'rxjs/operators';
|
|
9
9
|
import * as i2 from 'mmhglobal-zcore';
|
|
10
|
-
import { ZGroup, ZComponentHelper, MESSAGETYPE, DefaultMessage, DefaultDialogTitle, ActionType, Delimiter, ZSelectPostApiParams,
|
|
10
|
+
import { ZGroup, FormType, ZComponentHelper, MESSAGETYPE, DefaultMessage, DefaultDialogTitle, ActionType, Delimiter, ZSelectPostApiParams, ZComponentProperties, ComponentType as ComponentType$1, InternalComponentType_DropDown, UploadMetaData, AttachmentConfig, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
|
|
11
11
|
import * as i2$1 from '@ionic/angular';
|
|
12
12
|
import { IonicModule } from '@ionic/angular';
|
|
13
13
|
import * as i3 from 'mmhglobal-zmodal';
|
|
@@ -183,19 +183,18 @@ class ZComponentDebugService {
|
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
loadDebugZModel(me) {
|
|
186
|
-
const d = me.group._debug;
|
|
187
186
|
const downloadList = [];
|
|
188
187
|
downloadList.push(this.getProjectId());
|
|
189
|
-
const formType = me.group.isListForm ?
|
|
188
|
+
const formType = me.group.isListForm ? FormType.listField : FormType.formField;
|
|
190
189
|
const fieldName = me.group.fieldName;
|
|
191
190
|
const fieldzModel = this.getFieldzModel(formType, fieldName);
|
|
192
191
|
downloadList.push(fieldzModel);
|
|
193
192
|
return forkJoin(downloadList);
|
|
194
193
|
}
|
|
195
194
|
getProjectId() {
|
|
196
|
-
const
|
|
195
|
+
const debuggerGroup = this.debug;
|
|
197
196
|
const url = this.resourceApiService.getURL('projectsURL');
|
|
198
|
-
return this.webApiService.getApi(url, {},
|
|
197
|
+
return this.webApiService.getApi(url, {}, debuggerGroup.zData, 'ProjectOptions', null, debuggerGroup, false);
|
|
199
198
|
}
|
|
200
199
|
getFieldzModel(type, activityName) {
|
|
201
200
|
if (type === 'FormField') {
|
|
@@ -206,34 +205,41 @@ class ZComponentDebugService {
|
|
|
206
205
|
}
|
|
207
206
|
}
|
|
208
207
|
getFormFieldzModel(activityName) {
|
|
209
|
-
const
|
|
210
|
-
const
|
|
211
|
-
return this.webApiService.httpGet$(
|
|
208
|
+
const debuggerGroup = this.debug;
|
|
209
|
+
const fieldUrl = this.resourceApiService.getURL('field');
|
|
210
|
+
return this.webApiService.httpGet$(fieldUrl, { name: activityName, type: 'FormField' }).pipe(tap((respData) => {
|
|
212
211
|
// console.log('respData: ', respData);
|
|
213
|
-
Object.assign(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const fields = JSON.parse(
|
|
217
|
-
Object.assign(
|
|
212
|
+
Object.assign(debuggerGroup.zModel, respData);
|
|
213
|
+
debuggerGroup.form.patchValue(debuggerGroup.zModel);
|
|
214
|
+
debuggerGroup.form.markAsPristine();
|
|
215
|
+
const fields = JSON.parse(debuggerGroup.zModel.Code);
|
|
216
|
+
Object.assign(debuggerGroup, {
|
|
218
217
|
treeModel: ZComponentHelper.convertTreeModel(fields)
|
|
219
218
|
});
|
|
220
219
|
}));
|
|
221
220
|
}
|
|
222
221
|
getListFieldzModel(activityName) {
|
|
223
|
-
const
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
return this.webApiService.httpGet$(
|
|
227
|
-
//
|
|
228
|
-
return this.webApiService.httpGet$(
|
|
222
|
+
const debuggerGroup = this.debug;
|
|
223
|
+
const fieldsMappingUrl = this.resourceApiService.getURL('fieldsMapping');
|
|
224
|
+
const fieldUrl = this.resourceApiService.getURL('field');
|
|
225
|
+
return this.webApiService.httpGet$(fieldsMappingUrl, { name: activityName }).pipe(switchMap((fieldMapping) => {
|
|
226
|
+
// Fetch field data based on FieldElementMasterId
|
|
227
|
+
return this.webApiService.httpGet$(fieldUrl, { id: fieldMapping.FieldElementMasterId });
|
|
229
228
|
}), tap((respData) => {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
229
|
+
// Update debuggerGroup with field data
|
|
230
|
+
Object.assign(debuggerGroup.zModel, respData);
|
|
231
|
+
debuggerGroup.form.patchValue(debuggerGroup.zModel);
|
|
232
|
+
debuggerGroup.form.markAsPristine();
|
|
233
|
+
// Parse and convert Code to treeModel
|
|
234
|
+
try {
|
|
235
|
+
const fields = JSON.parse(debuggerGroup.zModel.Code);
|
|
236
|
+
Object.assign(debuggerGroup, {
|
|
237
|
+
treeModel: ZComponentHelper.convertTreeModel(fields)
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
console.error('Error parsing JSON:', error);
|
|
242
|
+
}
|
|
237
243
|
}));
|
|
238
244
|
}
|
|
239
245
|
subjectEvent(event, group, me) {
|
|
@@ -247,7 +253,7 @@ class ZComponentDebugService {
|
|
|
247
253
|
// ZComponentHelper.getGroupValue(event.Target, group);
|
|
248
254
|
}
|
|
249
255
|
catch (error) {
|
|
250
|
-
console.warn(
|
|
256
|
+
console.warn(`Error in getGroupValue. Event target: ${event.target}. Error: ${error}`);
|
|
251
257
|
}
|
|
252
258
|
// callFunc(event);
|
|
253
259
|
if (typeof callFunc === "function") {
|
|
@@ -261,15 +267,7 @@ class ZComponentDebugService {
|
|
|
261
267
|
return;
|
|
262
268
|
}
|
|
263
269
|
if (event.type === "zgrid-cellClick") {
|
|
264
|
-
// (callFunc.startsWith('edit')) { zgrid-cellClick
|
|
265
270
|
const cName = callFunc.slice(4);
|
|
266
|
-
// debugger;
|
|
267
|
-
// const modalGroupParam: ModalPageParams = {};
|
|
268
|
-
// modalGroupParam.controllerName = cName;
|
|
269
|
-
// modalGroupParam.referId = event.data.Id;
|
|
270
|
-
// modalGroupParam.colFields$ = event.columnFields$;
|
|
271
|
-
// modalGroupParam.parentGroup = me.group;
|
|
272
|
-
// this.openModalForm(modalGroupParam);
|
|
273
271
|
this.showzModal({
|
|
274
272
|
fieldElementName: cName,
|
|
275
273
|
fieldElementObservable$: event.columnFields$,
|
|
@@ -287,14 +285,7 @@ class ZComponentDebugService {
|
|
|
287
285
|
this.router.navigate([url]);
|
|
288
286
|
return;
|
|
289
287
|
}
|
|
290
|
-
// const modalGroupParam: ModalPageParams = {};
|
|
291
|
-
// modalGroupParam.controllerName = callFunc.ctrlName;
|
|
292
|
-
// modalGroupParam.referId = event.data.Id;
|
|
293
|
-
// modalGroupParam.colFields$ = event.columnFields$;
|
|
294
|
-
// modalGroupParam.parentGroup = me.group;
|
|
295
|
-
// modalGroupParam.formHeader = callFunc.formHeader;
|
|
296
288
|
if (callFunc.formHeader) {
|
|
297
|
-
// this.openModalForm(modalGroupParam);
|
|
298
289
|
this.showzModal({
|
|
299
290
|
fieldElementName: callFunc.ctrlName,
|
|
300
291
|
fieldElementObservable$: event.columnFields$,
|
|
@@ -305,12 +296,11 @@ class ZComponentDebugService {
|
|
|
305
296
|
}).subscribe();
|
|
306
297
|
return;
|
|
307
298
|
}
|
|
308
|
-
console.warn(
|
|
299
|
+
console.warn(`Invalid callFunc type: ${callFunc}. Event target: ${event.target}`);
|
|
309
300
|
}
|
|
310
|
-
// this.openModalFormByComponent(callFunc.type, event.Data.Id);
|
|
311
301
|
}
|
|
312
302
|
else {
|
|
313
|
-
console.warn(
|
|
303
|
+
console.warn(`Function not defined in group. Target: ${event.target}. Event details: `, event);
|
|
314
304
|
}
|
|
315
305
|
}
|
|
316
306
|
gridActivityLogOnItemClick(event) {
|
|
@@ -607,7 +597,7 @@ class ZComponentDebugService {
|
|
|
607
597
|
const debug = this.debug;
|
|
608
598
|
const fg = this.debug.form;
|
|
609
599
|
if (!fg.dirty) {
|
|
610
|
-
console.warn("
|
|
600
|
+
console.warn("The debug form is not dirty, so the record is not saved.");
|
|
611
601
|
return;
|
|
612
602
|
}
|
|
613
603
|
if (!fg.valid) {
|
|
@@ -626,7 +616,7 @@ class ZComponentDebugService {
|
|
|
626
616
|
return this.webApiService.httpPut$(debug.resourceURL + "/" + debug.zModel.Id, debug.zModel)
|
|
627
617
|
.pipe(map(res => this.handleSuccess(res, "Record is updated successfully.")), map(res => this.signalrService.sendToClientGroup(this.groupsToSend, this.eventName, debug.zModel)));
|
|
628
618
|
}), switchMap((zmodel) => {
|
|
629
|
-
console.log("After Debug Form
|
|
619
|
+
console.log("After updating Debug Form, zModel:", zmodel);
|
|
630
620
|
if (zmodel && zmodel.Data) {
|
|
631
621
|
Object.assign(debug.zModel, zmodel.Data);
|
|
632
622
|
fg.patchValue(zmodel.Data);
|
|
@@ -838,8 +828,8 @@ class MainService {
|
|
|
838
828
|
getResourceServerData() {
|
|
839
829
|
return this.resourceApiService.loadData();
|
|
840
830
|
}
|
|
841
|
-
getGroupFields(
|
|
842
|
-
return this.fieldService.getFormFieldCode(
|
|
831
|
+
getGroupFields(fieldElementName, formType, group, propertyName) {
|
|
832
|
+
return this.fieldService.getFormFieldCode(fieldElementName, formType, group, propertyName);
|
|
843
833
|
}
|
|
844
834
|
initializeGroup(group, ctrlName, pageName, me) {
|
|
845
835
|
if (me.subscription) {
|
|
@@ -1847,7 +1837,9 @@ class MainService {
|
|
|
1847
1837
|
if (formId === ((_a = respResult.Id) === null || _a === void 0 ? void 0 : _a.toString()) && eventName === window.location.href) {
|
|
1848
1838
|
if (respResult.UserName === this.authService.e1Token.myProfile.UserName) {
|
|
1849
1839
|
if (respResult.Action === ActionType.Update) {
|
|
1850
|
-
this.
|
|
1840
|
+
this.webApiService.httpGet$(`${this.group.resourceURL}/${formId}`, null).subscribe(resp => {
|
|
1841
|
+
this.reloadDataAndWorkflowButton(resp);
|
|
1842
|
+
});
|
|
1851
1843
|
}
|
|
1852
1844
|
}
|
|
1853
1845
|
else {
|
|
@@ -3982,9 +3974,11 @@ class UipageComponent {
|
|
|
3982
3974
|
console.warn("routeParam is undefined.");
|
|
3983
3975
|
}
|
|
3984
3976
|
}), switchMap(() => {
|
|
3985
|
-
const formType = isListForm ?
|
|
3986
|
-
const
|
|
3987
|
-
this.group.fieldName =
|
|
3977
|
+
const formType = isListForm ? FormType.listField : FormType.formField;
|
|
3978
|
+
const fieldElementName = this.group.fieldName ? this.group.fieldName : ctrlName;
|
|
3979
|
+
this.group.fieldName = fieldElementName; // to be decprecated
|
|
3980
|
+
this.group.fieldElementName = fieldElementName;
|
|
3981
|
+
return this.mainService.getGroupFields(fieldElementName, formType, this.group, "fields");
|
|
3988
3982
|
//let formFieldName = this.group.fieldName ? this.group.fieldName : ctrlName;
|
|
3989
3983
|
//this.group.fieldName = formFieldName;
|
|
3990
3984
|
//if(UipageComponent.signalrEventSubscription){
|
|
@@ -4009,7 +4003,6 @@ class UipageComponent {
|
|
|
4009
4003
|
// this.mainService.clearFormListFields()
|
|
4010
4004
|
// })
|
|
4011
4005
|
//).subscribe();
|
|
4012
|
-
return this.mainService.getGroupFields(formFieldName, formType, this.group, "fields");
|
|
4013
4006
|
}), switchMap((fields) => {
|
|
4014
4007
|
return this.mainService.beforePageInitialise(this.group);
|
|
4015
4008
|
}), switchMap((fields) => {
|
|
@@ -4021,7 +4014,6 @@ class UipageComponent {
|
|
|
4021
4014
|
return of(fields);
|
|
4022
4015
|
}
|
|
4023
4016
|
}), switchMap(() => {
|
|
4024
|
-
// console.log('CtrName: ' + ctrlName + ' field Element: ', fields);
|
|
4025
4017
|
if (this.group.referenceId && this.group.referenceId !== "0") {
|
|
4026
4018
|
this.mainService.joinProjectSignalR();
|
|
4027
4019
|
if (this.group.subscribeToModificationAlert) {
|
|
@@ -4479,7 +4471,7 @@ class UiactionbuttonComponent extends ButtonFieldBase {
|
|
|
4479
4471
|
}
|
|
4480
4472
|
else {
|
|
4481
4473
|
// handle as zButton
|
|
4482
|
-
const field$ = this.fieldService.getFormFieldCode(this.data.Value,
|
|
4474
|
+
const field$ = this.fieldService.getFormFieldCode(this.data.Value, FormType.formField, null, null);
|
|
4483
4475
|
field$.subscribe((data) => {
|
|
4484
4476
|
this.actionBtnList = data;
|
|
4485
4477
|
this.reloadButtonList();
|
|
@@ -7902,33 +7894,39 @@ class ZnumericComponent extends InputFieldBase {
|
|
|
7902
7894
|
this.addMinAndMaxValidator();
|
|
7903
7895
|
}
|
|
7904
7896
|
addMinAndMaxValidator() {
|
|
7897
|
+
var _a;
|
|
7905
7898
|
// Setup form validator for ionic components only (Kendo component will be auto setup)
|
|
7906
7899
|
if (this.isMobileScreen()) {
|
|
7907
|
-
const control = this.form.controls[this.data.Value];
|
|
7908
|
-
if (
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7900
|
+
const control = (_a = this.form) === null || _a === void 0 ? void 0 : _a.controls[this.data.Value];
|
|
7901
|
+
if (control) {
|
|
7902
|
+
if (this.minValue != undefined) {
|
|
7903
|
+
this.minValidator = Validators.min(Number(this.minValue));
|
|
7904
|
+
control.addValidators(this.minValidator);
|
|
7905
|
+
}
|
|
7906
|
+
if (this.maxValue != undefined) {
|
|
7907
|
+
this.maxValidator = Validators.max(Number(this.maxValue));
|
|
7908
|
+
control.addValidators(this.maxValidator);
|
|
7909
|
+
}
|
|
7910
|
+
control.updateValueAndValidity();
|
|
7915
7911
|
}
|
|
7916
|
-
control.updateValueAndValidity();
|
|
7917
7912
|
}
|
|
7918
7913
|
}
|
|
7919
7914
|
removeMinAndMaxValidator() {
|
|
7915
|
+
var _a;
|
|
7920
7916
|
this.minValue = null;
|
|
7921
7917
|
this.maxValue = null;
|
|
7922
|
-
const control = this.form.controls[this.data.Value];
|
|
7923
|
-
if (
|
|
7924
|
-
if (
|
|
7925
|
-
control.
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
control.
|
|
7918
|
+
const control = (_a = this.form) === null || _a === void 0 ? void 0 : _a.controls[this.data.Value];
|
|
7919
|
+
if (control) {
|
|
7920
|
+
if (this.isMobileScreen()) {
|
|
7921
|
+
if (control.hasValidator(this.minValidator)) {
|
|
7922
|
+
control.removeValidators(this.minValidator);
|
|
7923
|
+
}
|
|
7924
|
+
if (control.hasValidator(this.maxValidator)) {
|
|
7925
|
+
control.removeValidators(this.maxValidator);
|
|
7926
|
+
}
|
|
7929
7927
|
}
|
|
7928
|
+
control.updateValueAndValidity();
|
|
7930
7929
|
}
|
|
7931
|
-
control.updateValueAndValidity();
|
|
7932
7930
|
}
|
|
7933
7931
|
}
|
|
7934
7932
|
ZnumericComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ZnumericComponent, deps: [{ token: ZComponentService }], target: i0.ɵɵFactoryTarget.Component });
|