mmhglobal-dynamicform 1.2.0 → 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 +12 -1
- package/bundles/mmhglobal-dynamicform.umd.js +44 -37
- package/bundles/mmhglobal-dynamicform.umd.js.map +1 -1
- package/bundles/mmhglobal-dynamicform.umd.min.js +2 -2
- package/bundles/mmhglobal-dynamicform.umd.min.js.map +1 -1
- package/esm2015/lib/services/main.service.js +5 -16
- package/esm2015/lib/zgrid/zgrid.component.js +18 -9
- package/esm2015/lib/zselectmultiple/zselectmultiple.component.js +17 -12
- package/esm2015/lib/ztree/ztree.component.js +8 -3
- package/fesm2015/mmhglobal-dynamicform.js +44 -36
- package/fesm2015/mmhglobal-dynamicform.js.map +1 -1
- package/lib/ztree/ztree.component.d.ts +1 -0
- package/mmhglobal-dynamicform.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -1126,23 +1126,12 @@ class MainService {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
handleSuccess(res, successMsg) {
|
|
1128
1128
|
this.group.isTriggered = false;
|
|
1129
|
-
if (res
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
else if (res.Data !== undefined && res.ProcessingStatus !== undefined) {
|
|
1133
|
-
if (res.ProcessingStatus === true) {
|
|
1134
|
-
if (Array.isArray(res.Data)) {
|
|
1135
|
-
res.Data.map((s) => this.webApiService.showHttpResponseMessage(MESSAGETYPE.Success, `${successMsg} : ${s.CostCode}`, null));
|
|
1136
|
-
}
|
|
1137
|
-
else {
|
|
1138
|
-
this.webApiService.showHttpResponseMessage(MESSAGETYPE.Success, successMsg, null);
|
|
1139
|
-
}
|
|
1129
|
+
if (res) {
|
|
1130
|
+
if (res.ProcessingStatus) {
|
|
1131
|
+
this.webApiService.showHttpResponseMessage(MESSAGETYPE.Success, successMsg, null);
|
|
1140
1132
|
}
|
|
1133
|
+
return res;
|
|
1141
1134
|
}
|
|
1142
|
-
else {
|
|
1143
|
-
this.toastService.show(successMsg);
|
|
1144
|
-
}
|
|
1145
|
-
return res;
|
|
1146
1135
|
}
|
|
1147
1136
|
handleError(res) {
|
|
1148
1137
|
this.group.isTriggered = false;
|
|
@@ -5541,7 +5530,7 @@ class ZgridComponent {
|
|
|
5541
5530
|
const _zgrid = this.zgrid;
|
|
5542
5531
|
}
|
|
5543
5532
|
}
|
|
5544
|
-
/*
|
|
5533
|
+
/* grid command handler */
|
|
5545
5534
|
addHandler({ sender }) {
|
|
5546
5535
|
this.isNew = true;
|
|
5547
5536
|
// close any existing editor
|
|
@@ -5565,18 +5554,24 @@ class ZgridComponent {
|
|
|
5565
5554
|
}
|
|
5566
5555
|
saveHandler({ sender, rowIndex, formGroup, isNew }) {
|
|
5567
5556
|
// get grid data.
|
|
5568
|
-
const gridExistingData = this.gData ? this.gData : [];
|
|
5557
|
+
const gridExistingData = this.gData ? this.gData : this.gridData ? this.gridData.data : [];
|
|
5569
5558
|
// if valid
|
|
5570
5559
|
if (formGroup.valid) {
|
|
5571
5560
|
// check for duplicate UniqueKey
|
|
5572
|
-
let uniqueKeyExist
|
|
5561
|
+
let uniqueKeyExist;
|
|
5573
5562
|
const uniqueKey = this.data['UniqueKey'];
|
|
5574
5563
|
if (uniqueKey) {
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5564
|
+
const formUniqueKeyValue = formGroup.value[uniqueKey];
|
|
5565
|
+
if (isNew || (!isNew && (gridExistingData[rowIndex][uniqueKey] != formUniqueKeyValue))) {
|
|
5566
|
+
// if new...
|
|
5567
|
+
// if edit... if current field, uniquekey value changed. need to check.
|
|
5568
|
+
gridExistingData.forEach(data => {
|
|
5569
|
+
if (data[uniqueKey] === formUniqueKeyValue) {
|
|
5570
|
+
uniqueKeyExist = true;
|
|
5571
|
+
return;
|
|
5572
|
+
}
|
|
5573
|
+
});
|
|
5574
|
+
}
|
|
5580
5575
|
}
|
|
5581
5576
|
if (!uniqueKeyExist) {
|
|
5582
5577
|
if (isNew) {
|
|
@@ -5590,6 +5585,9 @@ class ZgridComponent {
|
|
|
5590
5585
|
this.setData(gridExistingData);
|
|
5591
5586
|
sender.closeRow(rowIndex);
|
|
5592
5587
|
}
|
|
5588
|
+
else {
|
|
5589
|
+
this.toastService.show('Error occur: Duplicated unique field entry.', 'top', true, 3000, 'danger');
|
|
5590
|
+
}
|
|
5593
5591
|
}
|
|
5594
5592
|
}
|
|
5595
5593
|
cancelHandler({ sender, rowIndex }) {
|
|
@@ -7572,18 +7570,23 @@ class ZselectmultipleComponent {
|
|
|
7572
7570
|
});
|
|
7573
7571
|
}
|
|
7574
7572
|
else {
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7573
|
+
if (Array.isArray(this.data.SelectOptions) && this.data.SelectOptions) {
|
|
7574
|
+
//skip eval if selectoptions is exist
|
|
7575
|
+
}
|
|
7576
|
+
else {
|
|
7577
|
+
const optionData = ZComponentHelper.getGroupEvalValue.call(this, this.itemDataField);
|
|
7578
|
+
// append data via timeout after data is loaded.
|
|
7579
|
+
if (optionData && optionData.length === 1 && !this.data.DisableAutoFirstSelection) {
|
|
7580
|
+
const thisComponent = this;
|
|
7581
|
+
setTimeout(function () {
|
|
7582
|
+
thisComponent.autoSelectFirstOption(isRequired, optionData[0], fieldValue, thisComponent.group.zModel.Id);
|
|
7583
|
+
if (this.group) {
|
|
7584
|
+
if (this.group.afterLoadzDataOptions) {
|
|
7585
|
+
this.group.afterLoadzDataOptions(this.group);
|
|
7586
|
+
}
|
|
7584
7587
|
}
|
|
7585
|
-
}
|
|
7586
|
-
}
|
|
7588
|
+
}, 100);
|
|
7589
|
+
}
|
|
7587
7590
|
}
|
|
7588
7591
|
this.isLoading = false;
|
|
7589
7592
|
}
|
|
@@ -8581,6 +8584,7 @@ class ZtreeComponent {
|
|
|
8581
8584
|
this.state = { expandedkeys: [] };
|
|
8582
8585
|
this.itemIndex = [];
|
|
8583
8586
|
this.selectedKeys = [];
|
|
8587
|
+
this.absoluteText = false;
|
|
8584
8588
|
this.componentProperties = new ZComponentProperties();
|
|
8585
8589
|
this.isExpanded = (dataItem, index) => {
|
|
8586
8590
|
// console.log(index);
|
|
@@ -8656,6 +8660,10 @@ class ZtreeComponent {
|
|
|
8656
8660
|
if (this.data.TreeviewExpandAll) {
|
|
8657
8661
|
this.expandAll();
|
|
8658
8662
|
}
|
|
8663
|
+
// fix text align issue
|
|
8664
|
+
if (this.data.OnAddNode || this.data.OnRemoveNode) {
|
|
8665
|
+
this.absoluteText = true;
|
|
8666
|
+
}
|
|
8659
8667
|
}
|
|
8660
8668
|
ngAfterViewInit() {
|
|
8661
8669
|
// const componentId = ZComponentHelper.getComponentId(this.data);
|
|
@@ -8920,8 +8928,8 @@ class ZtreeComponent {
|
|
|
8920
8928
|
ZtreeComponent.decorators = [
|
|
8921
8929
|
{ type: Component, args: [{
|
|
8922
8930
|
selector: "app-ztree",
|
|
8923
|
-
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)\"
|
|
8924
|
-
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-
|
|
8931
|
+
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",
|
|
8932
|
+
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}"]
|
|
8925
8933
|
},] }
|
|
8926
8934
|
];
|
|
8927
8935
|
ZtreeComponent.ctorParameters = () => [];
|