mmhglobal-dynamicform 2.5.0 → 2.5.2

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.
@@ -5,7 +5,7 @@ import { NavigationStart, NavigationEnd, NavigationError, RouterModule } from '@
5
5
  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';
6
6
  import { map, tap as tap$1, switchMap as switchMap$1, delay, take, filter, concatMap, ignoreElements } from 'rxjs/operators';
7
7
  import * as i2 from 'mmhglobal-zcore';
8
- import { ZComponentHelper, ZComponentProperties, ZGroup, MESSAGETYPE, ZSelectPostApiParams, UploadMetaData, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
8
+ import { ZComponentHelper, ZComponentProperties, ZGroup, MESSAGETYPE, DefaultMessage, DefaultDialogTitle, ZSelectPostApiParams, UploadMetaData, DefaultPageSettingParams, ZCoreModule } from 'mmhglobal-zcore';
9
9
  import * as i1$1 from '@progress/kendo-angular-dialog';
10
10
  import { DialogContentBase } from '@progress/kendo-angular-dialog';
11
11
  import * as i4 from 'mmhglobal-zmodal';
@@ -2764,8 +2764,8 @@ class MainService {
2764
2764
  isFormDirtyAndValid(fg, group, isSkipDirty = false, event) {
2765
2765
  if (!isSkipDirty && !fg.dirty) {
2766
2766
  console.warn("Form is not dirty hence record is not save.");
2767
- const message = event && event.data && event.data[`FormNotDirtyMessage`] ? event.data[`FormNotDirtyMessage`] : "Data has not been changed since it was last saved.";
2768
- this.alertService.showOkay("Nothing to update", message);
2767
+ const message = event && event.data && event.data[`FormNotDirtyMessage`] ? event.data[`FormNotDirtyMessage`] : DefaultMessage.notDirtyMessage;
2768
+ this.alertService.showOkay(DefaultDialogTitle.nothingToUpdate, message, ["col-5"]);
2769
2769
  return false;
2770
2770
  }
2771
2771
  if (!fg.valid) {
@@ -2785,7 +2785,7 @@ class MainService {
2785
2785
  }
2786
2786
  beforeDeleteModel(group) {
2787
2787
  if (!group.beforeDeleteModel) {
2788
- console.warn("group.beforeUpdateModel is undefined");
2788
+ console.warn("group.beforeDeleteModel is undefined");
2789
2789
  return of({});
2790
2790
  }
2791
2791
  return group.beforeDeleteModel(group);
@@ -2799,7 +2799,7 @@ class MainService {
2799
2799
  }
2800
2800
  beforeCreateModel(group) {
2801
2801
  if (!group.beforeCreateModel) {
2802
- console.warn("group.beforeUpdateModel is undefined");
2802
+ console.warn("group.beforeCreateModel is undefined");
2803
2803
  return of({});
2804
2804
  }
2805
2805
  return group.beforeCreateModel(group);
@@ -3128,37 +3128,44 @@ class ZGridBindingDirective extends DataBindingDirective {
3128
3128
  }
3129
3129
  generateGridColumns() {
3130
3130
  const columnFields$ = ZComponentHelper.getGroupValue(this.field.ColumnFields, this.grp);
3131
- columnFields$.pipe(tap$1((data) => {
3132
- const gridSetting = this.getGridSettings();
3133
- ZComponentHelper.getGridColumns(data, this.gridColumns, this.zgridbinding.group, gridSetting, this.usableColumns);
3134
- this.getFilterParamsColumns();
3135
- this.getFilter();
3136
- this.getFilterParams();
3137
- this.getSorting();
3138
- this.getGrantType();
3139
- this.setHiddenColumn(gridSetting);
3140
- this.params.referId = this.getFieldReferenceId() || this.grp.referenceId || null;
3141
- // }),
3142
- // switchMap(() => {
3143
- // //Get Session
3144
- // return this.getGridSessionFilter(this.grp, this);
3145
- // }),
3146
- // switchMap(() => {
3147
- // //Before get grid data
3148
- // return this.beforeGridGetData(this.grp, this);
3149
- // }),
3150
- // switchMap(() => {
3151
- // //Set grid data
3152
- // return this.setGridSessionFilter(this.grp, this);
3153
- })).subscribe(() => {
3154
- if (this.field['SkipLoadResourceURLData']) {
3155
- this.grid.loading = false;
3156
- this.gridSubject.next(this);
3157
- }
3158
- else {
3159
- this.getDataBinding();
3160
- }
3161
- });
3131
+ if (columnFields$) {
3132
+ columnFields$.pipe(tap$1((data) => {
3133
+ const gridSetting = this.getGridSettings();
3134
+ ZComponentHelper.getGridColumns(data, this.gridColumns, this.zgridbinding.group, gridSetting, this.usableColumns);
3135
+ this.getFilterParamsColumns();
3136
+ this.getFilter();
3137
+ this.getFilterParams();
3138
+ this.getSorting();
3139
+ this.getGrantType();
3140
+ this.setHiddenColumn(gridSetting);
3141
+ this.params.referId = this.getFieldReferenceId() || this.grp.referenceId || null;
3142
+ // }),
3143
+ // switchMap(() => {
3144
+ // //Get Session
3145
+ // return this.getGridSessionFilter(this.grp, this);
3146
+ // }),
3147
+ // switchMap(() => {
3148
+ // //Before get grid data
3149
+ // return this.beforeGridGetData(this.grp, this);
3150
+ // }),
3151
+ // switchMap(() => {
3152
+ // //Set grid data
3153
+ // return this.setGridSessionFilter(this.grp, this);
3154
+ })).subscribe(() => {
3155
+ if (this.field['SkipLoadResourceURLData']) {
3156
+ this.grid.loading = false;
3157
+ this.gridSubject.next(this);
3158
+ }
3159
+ else {
3160
+ this.getDataBinding();
3161
+ }
3162
+ });
3163
+ }
3164
+ else {
3165
+ console.log('Fail to generate grid column fields.');
3166
+ console.log(this.field.ColumnFields);
3167
+ console.log(this.grp);
3168
+ }
3162
3169
  }
3163
3170
  setSkipLoadResourceURLData(settingValue) {
3164
3171
  this.field['SkipLoadResourceURLData'] = !settingValue;
@@ -8217,6 +8224,11 @@ class ZgridComponent extends DataListingFieldBase {
8217
8224
  if (!this.data.ColumnFields) {
8218
8225
  console.warn('Invalid/Empty grid(' + this.data.Name + ') columnField');
8219
8226
  }
8227
+ if (!columnFields$) {
8228
+ console.log('Fail to generate grid column fields.');
8229
+ console.log(this.data.ColumnFields);
8230
+ console.log(this.group);
8231
+ }
8220
8232
  return columnFields$.pipe(tap$1(data => {
8221
8233
  if (!data) {
8222
8234
  console.warn('Invalid/Empty grid(' + this.data.Name + ') data to generate column');
@@ -11778,9 +11790,15 @@ class ZudfComponent extends ContainerFieldBase {
11778
11790
  // Manually patch the component form control value
11779
11791
  const zudfForm = zudfGroup.form;
11780
11792
  const componentFormControl = zudfForm.controls[item.value];
11781
- childComponent.setSelectOption(filteredSelectionOptions);
11782
- componentFormControl.patchValue(zudfGroup.zModel[item.value]);
11783
- this.cdr.detectChanges();
11793
+ if (componentFormControl) {
11794
+ childComponent.setSelectOption(filteredSelectionOptions);
11795
+ componentFormControl.patchValue(zudfGroup.zModel[item.value]);
11796
+ this.cdr.detectChanges();
11797
+ }
11798
+ else {
11799
+ console.log('Unable to get formcontrol for ' + item.value);
11800
+ console.log(zudfForm);
11801
+ }
11784
11802
  }
11785
11803
  });
11786
11804
  }