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
|
@@ -6,7 +6,7 @@ import { NavigationStart, NavigationEnd, NavigationError, RouterModule } from '@
|
|
|
6
6
|
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';
|
|
7
7
|
import { tap, switchMap, map, take, delay, concatMap, ignoreElements } from 'rxjs/operators';
|
|
8
8
|
import * as i2 from 'mmhglobal-zcore';
|
|
9
|
-
import { ZGroup, ZComponentHelper, MESSAGETYPE, DefaultMessage, DefaultDialogTitle, ActionType, Delimiter, ZSelectPostApiParams,
|
|
9
|
+
import { ZGroup, FormType, ZComponentHelper, MESSAGETYPE, DefaultMessage, DefaultDialogTitle, ActionType, Delimiter, ZSelectPostApiParams, ZComponentProperties, ComponentType as ComponentType$1, InternalComponentType_DropDown, UploadMetaData, AttachmentConfig, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
|
|
10
10
|
import * as i2$1 from '@ionic/angular';
|
|
11
11
|
import { IonicModule } from '@ionic/angular';
|
|
12
12
|
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) {
|
|
@@ -602,7 +592,7 @@ class ZComponentDebugService {
|
|
|
602
592
|
const debug = this.debug;
|
|
603
593
|
const fg = this.debug.form;
|
|
604
594
|
if (!fg.dirty) {
|
|
605
|
-
console.warn("
|
|
595
|
+
console.warn("The debug form is not dirty, so the record is not saved.");
|
|
606
596
|
return;
|
|
607
597
|
}
|
|
608
598
|
if (!fg.valid) {
|
|
@@ -621,7 +611,7 @@ class ZComponentDebugService {
|
|
|
621
611
|
return this.webApiService.httpPut$(debug.resourceURL + "/" + debug.zModel.Id, debug.zModel)
|
|
622
612
|
.pipe(map(res => this.handleSuccess(res, "Record is updated successfully.")), map(res => this.signalrService.sendToClientGroup(this.groupsToSend, this.eventName, debug.zModel)));
|
|
623
613
|
}), switchMap((zmodel) => {
|
|
624
|
-
console.log("After Debug Form
|
|
614
|
+
console.log("After updating Debug Form, zModel:", zmodel);
|
|
625
615
|
if (zmodel && zmodel.Data) {
|
|
626
616
|
Object.assign(debug.zModel, zmodel.Data);
|
|
627
617
|
fg.patchValue(zmodel.Data);
|
|
@@ -833,8 +823,8 @@ class MainService {
|
|
|
833
823
|
getResourceServerData() {
|
|
834
824
|
return this.resourceApiService.loadData();
|
|
835
825
|
}
|
|
836
|
-
getGroupFields(
|
|
837
|
-
return this.fieldService.getFormFieldCode(
|
|
826
|
+
getGroupFields(fieldElementName, formType, group, propertyName) {
|
|
827
|
+
return this.fieldService.getFormFieldCode(fieldElementName, formType, group, propertyName);
|
|
838
828
|
}
|
|
839
829
|
initializeGroup(group, ctrlName, pageName, me) {
|
|
840
830
|
if (me.subscription) {
|
|
@@ -1835,7 +1825,9 @@ class MainService {
|
|
|
1835
1825
|
if (formId === respResult.Id?.toString() && eventName === window.location.href) {
|
|
1836
1826
|
if (respResult.UserName === this.authService.e1Token.myProfile.UserName) {
|
|
1837
1827
|
if (respResult.Action === ActionType.Update) {
|
|
1838
|
-
this.
|
|
1828
|
+
this.webApiService.httpGet$(`${this.group.resourceURL}/${formId}`, null).subscribe(resp => {
|
|
1829
|
+
this.reloadDataAndWorkflowButton(resp);
|
|
1830
|
+
});
|
|
1839
1831
|
}
|
|
1840
1832
|
}
|
|
1841
1833
|
else {
|
|
@@ -3958,9 +3950,11 @@ class UipageComponent {
|
|
|
3958
3950
|
console.warn("routeParam is undefined.");
|
|
3959
3951
|
}
|
|
3960
3952
|
}), switchMap(() => {
|
|
3961
|
-
const formType = isListForm ?
|
|
3962
|
-
const
|
|
3963
|
-
this.group.fieldName =
|
|
3953
|
+
const formType = isListForm ? FormType.listField : FormType.formField;
|
|
3954
|
+
const fieldElementName = this.group.fieldName ? this.group.fieldName : ctrlName;
|
|
3955
|
+
this.group.fieldName = fieldElementName; // to be decprecated
|
|
3956
|
+
this.group.fieldElementName = fieldElementName;
|
|
3957
|
+
return this.mainService.getGroupFields(fieldElementName, formType, this.group, "fields");
|
|
3964
3958
|
//let formFieldName = this.group.fieldName ? this.group.fieldName : ctrlName;
|
|
3965
3959
|
//this.group.fieldName = formFieldName;
|
|
3966
3960
|
//if(UipageComponent.signalrEventSubscription){
|
|
@@ -3985,7 +3979,6 @@ class UipageComponent {
|
|
|
3985
3979
|
// this.mainService.clearFormListFields()
|
|
3986
3980
|
// })
|
|
3987
3981
|
//).subscribe();
|
|
3988
|
-
return this.mainService.getGroupFields(formFieldName, formType, this.group, "fields");
|
|
3989
3982
|
}), switchMap((fields) => {
|
|
3990
3983
|
return this.mainService.beforePageInitialise(this.group);
|
|
3991
3984
|
}), switchMap((fields) => {
|
|
@@ -3997,7 +3990,6 @@ class UipageComponent {
|
|
|
3997
3990
|
return of(fields);
|
|
3998
3991
|
}
|
|
3999
3992
|
}), switchMap(() => {
|
|
4000
|
-
// console.log('CtrName: ' + ctrlName + ' field Element: ', fields);
|
|
4001
3993
|
if (this.group.referenceId && this.group.referenceId !== "0") {
|
|
4002
3994
|
this.mainService.joinProjectSignalR();
|
|
4003
3995
|
if (this.group.subscribeToModificationAlert) {
|
|
@@ -4454,7 +4446,7 @@ class UiactionbuttonComponent extends ButtonFieldBase {
|
|
|
4454
4446
|
}
|
|
4455
4447
|
else {
|
|
4456
4448
|
// handle as zButton
|
|
4457
|
-
const field$ = this.fieldService.getFormFieldCode(this.data.Value,
|
|
4449
|
+
const field$ = this.fieldService.getFormFieldCode(this.data.Value, FormType.formField, null, null);
|
|
4458
4450
|
field$.subscribe((data) => {
|
|
4459
4451
|
this.actionBtnList = data;
|
|
4460
4452
|
this.reloadButtonList();
|
|
@@ -7883,31 +7875,35 @@ class ZnumericComponent extends InputFieldBase {
|
|
|
7883
7875
|
addMinAndMaxValidator() {
|
|
7884
7876
|
// Setup form validator for ionic components only (Kendo component will be auto setup)
|
|
7885
7877
|
if (this.isMobileScreen()) {
|
|
7886
|
-
const control = this.form
|
|
7887
|
-
if (
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7878
|
+
const control = this.form?.controls[this.data.Value];
|
|
7879
|
+
if (control) {
|
|
7880
|
+
if (this.minValue != undefined) {
|
|
7881
|
+
this.minValidator = Validators.min(Number(this.minValue));
|
|
7882
|
+
control.addValidators(this.minValidator);
|
|
7883
|
+
}
|
|
7884
|
+
if (this.maxValue != undefined) {
|
|
7885
|
+
this.maxValidator = Validators.max(Number(this.maxValue));
|
|
7886
|
+
control.addValidators(this.maxValidator);
|
|
7887
|
+
}
|
|
7888
|
+
control.updateValueAndValidity();
|
|
7894
7889
|
}
|
|
7895
|
-
control.updateValueAndValidity();
|
|
7896
7890
|
}
|
|
7897
7891
|
}
|
|
7898
7892
|
removeMinAndMaxValidator() {
|
|
7899
7893
|
this.minValue = null;
|
|
7900
7894
|
this.maxValue = null;
|
|
7901
|
-
const control = this.form
|
|
7902
|
-
if (
|
|
7903
|
-
if (
|
|
7904
|
-
control.
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
control.
|
|
7895
|
+
const control = this.form?.controls[this.data.Value];
|
|
7896
|
+
if (control) {
|
|
7897
|
+
if (this.isMobileScreen()) {
|
|
7898
|
+
if (control.hasValidator(this.minValidator)) {
|
|
7899
|
+
control.removeValidators(this.minValidator);
|
|
7900
|
+
}
|
|
7901
|
+
if (control.hasValidator(this.maxValidator)) {
|
|
7902
|
+
control.removeValidators(this.maxValidator);
|
|
7903
|
+
}
|
|
7908
7904
|
}
|
|
7905
|
+
control.updateValueAndValidity();
|
|
7909
7906
|
}
|
|
7910
|
-
control.updateValueAndValidity();
|
|
7911
7907
|
}
|
|
7912
7908
|
}
|
|
7913
7909
|
ZnumericComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ZnumericComponent, deps: [{ token: ZComponentService }], target: i0.ɵɵFactoryTarget.Component });
|