mmhglobal-dynamicform 1.2.2 → 1.2.3

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 CHANGED
@@ -3,6 +3,11 @@
3
3
  This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.13.
4
4
 
5
5
  ## Changelog
6
+ `1.2.3`<br/>
7
+ [ztree] - fix ztree selected node ui when popup.
8
+ [zgrid] - enhance on grid command handler.
9
+ mainservice - fix successhandler.
10
+
6
11
  `1.2.2`<br/>
7
12
  [ztree] - fix ztree ui in when popup.
8
13
 
@@ -1451,25 +1451,13 @@
1451
1451
  }
1452
1452
  };
1453
1453
  MainService.prototype.handleSuccess = function (res, successMsg) {
1454
- var _this = this;
1455
1454
  this.group.isTriggered = false;
1456
- if (res == null) {
1457
- this.toastService.show(successMsg);
1458
- }
1459
- else if (res.Data !== undefined && res.ProcessingStatus !== undefined) {
1460
- if (res.ProcessingStatus === true) {
1461
- if (Array.isArray(res.Data)) {
1462
- res.Data.map(function (s) { return _this.webApiService.showHttpResponseMessage(i3.MESSAGETYPE.Success, successMsg + " : " + s.CostCode, null); });
1463
- }
1464
- else {
1465
- this.webApiService.showHttpResponseMessage(i3.MESSAGETYPE.Success, successMsg, null);
1466
- }
1455
+ if (res) {
1456
+ if (res.ProcessingStatus) {
1457
+ this.webApiService.showHttpResponseMessage(i3.MESSAGETYPE.Success, successMsg, null);
1467
1458
  }
1459
+ return res;
1468
1460
  }
1469
- else {
1470
- this.toastService.show(successMsg);
1471
- }
1472
- return res;
1473
1461
  };
1474
1462
  MainService.prototype.handleError = function (res) {
1475
1463
  this.group.isTriggered = false;
@@ -5955,7 +5943,7 @@
5955
5943
  var _zgrid = this.zgrid;
5956
5944
  }
5957
5945
  };
5958
- /* */
5946
+ /* grid command handler */
5959
5947
  ZgridComponent.prototype.addHandler = function (_a) {
5960
5948
  var sender = _a.sender;
5961
5949
  this.isNew = true;
@@ -5981,18 +5969,24 @@
5981
5969
  ZgridComponent.prototype.saveHandler = function (_a) {
5982
5970
  var sender = _a.sender, rowIndex = _a.rowIndex, formGroup = _a.formGroup, isNew = _a.isNew;
5983
5971
  // get grid data.
5984
- var gridExistingData = this.gData ? this.gData : [];
5972
+ var gridExistingData = this.gData ? this.gData : this.gridData ? this.gridData.data : [];
5985
5973
  // if valid
5986
5974
  if (formGroup.valid) {
5987
5975
  // check for duplicate UniqueKey
5988
- var uniqueKeyExist_1 = false;
5976
+ var uniqueKeyExist_1;
5989
5977
  var uniqueKey_1 = this.data['UniqueKey'];
5990
5978
  if (uniqueKey_1) {
5991
- gridExistingData.forEach(function (data) {
5992
- if (data[uniqueKey_1] === formGroup.value[uniqueKey_1]) {
5993
- uniqueKeyExist_1 = true;
5994
- }
5995
- });
5979
+ var formUniqueKeyValue_1 = formGroup.value[uniqueKey_1];
5980
+ if (isNew || (!isNew && (gridExistingData[rowIndex][uniqueKey_1] != formUniqueKeyValue_1))) {
5981
+ // if new...
5982
+ // if edit... if current field, uniquekey value changed. need to check.
5983
+ gridExistingData.forEach(function (data) {
5984
+ if (data[uniqueKey_1] === formUniqueKeyValue_1) {
5985
+ uniqueKeyExist_1 = true;
5986
+ return;
5987
+ }
5988
+ });
5989
+ }
5996
5990
  }
5997
5991
  if (!uniqueKeyExist_1) {
5998
5992
  if (isNew) {
@@ -6006,6 +6000,9 @@
6006
6000
  this.setData(gridExistingData);
6007
6001
  sender.closeRow(rowIndex);
6008
6002
  }
6003
+ else {
6004
+ this.toastService.show('Error occur: Duplicated unique field entry.', 'top', true, 3000, 'danger');
6005
+ }
6009
6006
  }
6010
6007
  };
6011
6008
  ZgridComponent.prototype.cancelHandler = function (_a) {
@@ -8058,18 +8055,23 @@
8058
8055
  });
8059
8056
  }
8060
8057
  else {
8061
- var optionData_1 = i3.ZComponentHelper.getGroupEvalValue.call(this, this.itemDataField);
8062
- // append data via timeout after data is loaded.
8063
- if (optionData_1 && optionData_1.length === 1 && !this.data.DisableAutoFirstSelection) {
8064
- var thisComponent_1 = this;
8065
- setTimeout(function () {
8066
- thisComponent_1.autoSelectFirstOption(isRequired_1, optionData_1[0], fieldValue, thisComponent_1.group.zModel.Id);
8067
- if (this.group) {
8068
- if (this.group.afterLoadzDataOptions) {
8069
- this.group.afterLoadzDataOptions(this.group);
8058
+ if (Array.isArray(this.data.SelectOptions) && this.data.SelectOptions) {
8059
+ //skip eval if selectoptions is exist
8060
+ }
8061
+ else {
8062
+ var optionData_1 = i3.ZComponentHelper.getGroupEvalValue.call(this, this.itemDataField);
8063
+ // append data via timeout after data is loaded.
8064
+ if (optionData_1 && optionData_1.length === 1 && !this.data.DisableAutoFirstSelection) {
8065
+ var thisComponent_1 = this;
8066
+ setTimeout(function () {
8067
+ thisComponent_1.autoSelectFirstOption(isRequired_1, optionData_1[0], fieldValue, thisComponent_1.group.zModel.Id);
8068
+ if (this.group) {
8069
+ if (this.group.afterLoadzDataOptions) {
8070
+ this.group.afterLoadzDataOptions(this.group);
8071
+ }
8070
8072
  }
8071
- }
8072
- }, 100);
8073
+ }, 100);
8074
+ }
8073
8075
  }
8074
8076
  this.isLoading = false;
8075
8077
  }
@@ -9445,7 +9447,7 @@
9445
9447
  { type: i0.Component, args: [{
9446
9448
  selector: "app-ztree",
9447
9449
  template: "<div style=\"width:100%\"\r\n *ngIf=\"(!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\">\r\n <kendo-treeview [nodes]=\"getItems()\"\r\n kendoTreeViewExpandable\r\n kendoTreeViewSelectable\r\n kendoTreeViewDragAndDrop\r\n kendoTreeViewDragAndDropEditing\r\n [isExpanded]=\"isExpanded\"\r\n (collapse)=\"handleCollapse($event)\"\r\n (expand)=\"handleExpand($event)\"\r\n (nodeDrop)=\"handleNodeDrop($event)\"\r\n (nodeDragEnd)=\"handleNodeDragEnd($event)\"\r\n (selectionChange)=\"onSelectionChange($event)\"\r\n [selectedKeys]=\"selectedKeys\"\r\n kendoTreeViewHierarchyBinding\r\n childrenField=\"Value\"\r\n [filterable]=\"data.Filterable\"\r\n textField=\"Name\"\r\n (filterChange)=\"handleFilter($event)\">\r\n\r\n <ng-template kendoTreeViewNodeTemplate let-dataItem #nodetemplate>\r\n\r\n <ion-button *ngIf=\"!!data.OnAddNode\"\r\n (click)=\"onAddNode($event, dataItem, data, group)\"\r\n style=\"zoom: 0.6; margin: 0 0 0 2px;\" mat-raised-button color=\"primary\" size=\"medium\"\r\n [hidden]=\"(!!dataItem.OnAddNodeVisible)\"> \r\n <fa-icon [icon]=\"'plus'\"></fa-icon>\r\n </ion-button>\r\n <ion-button *ngIf=\"!!data.OnRemoveNode\" (click)=\"onRemoveNode($event, dataItem, data, group)\"\r\n style=\"zoom: 0.6; margin: 0 15px 0 10px;\" color=\"danger\" mat-raised-button size=\"medium\"\r\n [hidden]=\"(!!dataItem.OnRemoveNodeVisible)\"> \r\n <fa-icon [icon]=\"'minus'\"></fa-icon>\r\n </ion-button>\r\n\r\n <ion-label *ngIf=\"absoluteText\" style=\"position: absolute; top: 14px;\">\r\n {{ getTemplate(dataItem, data, group) }}\r\n </ion-label>\r\n\r\n <ion-label *ngIf=\"!absoluteText\">\r\n {{ getTemplate(dataItem, data, group) }}\r\n </ion-label>\r\n </ng-template>\r\n </kendo-treeview>\r\n</div>\r\n",
9448
- styles: [":host{--ion-color-primary:#479400;--ion-color-primary-rgb:56,128,255;--ion-color-primary-contrast:#fff;--ion-color-primary-contrast-rgb:255,255,255;--ion-color-primary-shade:#3171e0;--ion-color-primary-tint:#4c8dff}:host ::ng-deep kendo-treeview .k-treeview-leaf{width:100%;margin:5px;padding:9px 20px 9px 8px;border-radius:3px;border:1px solid #c8dbf5;background-color:#e3ecf8;color:#0a45ab;font-size:13px;cursor:pointer}:host ::ng-deep kendo-treeview .k-treeview-leaf.k-state-selected{width:100%;margin:5px;padding:9px 20px 9px 8px;border-radius:3px;background-color:#a9c3e8;color:#0a45ab;font-size:13px;cursor:pointer}:host ::ng-deep kendo-treeview .k-treeview-leaf.k-state-hover,:host ::ng-deep kendo-treeview .k-treeview-leaf:hover{width:100%;margin:5px;padding:9px 20px 9px 8px;border-radius:3px;background-color:#c9daf2;color:#0a45ab;font-size:13px;cursor:pointer}"]
9450
+ styles: [":host{--ion-color-primary:#479400;--ion-color-primary-rgb:56,128,255;--ion-color-primary-contrast:#fff;--ion-color-primary-contrast-rgb:255,255,255;--ion-color-primary-shade:#3171e0;--ion-color-primary-tint:#4c8dff}:host ::ng-deep kendo-treeview .k-treeview-leaf{width:100%;margin:5px;padding:9px 20px 9px 8px;border-radius:3px;border:1px solid #c8dbf5;background-color:#e3ecf8;color:#0a45ab;font-size:13px;cursor:pointer}:host ::ng-deep kendo-treeview .k-treeview-leaf.k-selected{width:100%;margin:5px;padding:9px 20px 9px 8px;border-radius:3px;background-color:#a9c3e8!important;color:#0a45ab!important;font-size:13px;cursor:pointer}:host ::ng-deep kendo-treeview .k-treeview-leaf.k-state-hover,:host ::ng-deep kendo-treeview .k-treeview-leaf:hover{width:100%;margin:5px;padding:9px 20px 9px 8px;border-radius:3px;background-color:#c9daf2;color:#0a45ab;font-size:13px;cursor:pointer}"]
9449
9451
  },] }
9450
9452
  ];
9451
9453
  ZtreeComponent.ctorParameters = function () { return []; };