mmhglobal-dynamicform 1.1.42 → 1.1.43
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 +4 -1
- package/bundles/mmhglobal-dynamicform.umd.js +60 -1
- 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/ztree/ztree.component.js +60 -2
- package/fesm2015/mmhglobal-dynamicform.js +59 -1
- package/fesm2015/mmhglobal-dynamicform.js.map +1 -1
- package/lib/ztree/ztree.component.d.ts +5 -0
- package/mmhglobal-dynamicform.metadata.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
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.1.
|
|
6
|
+
`1.1.43`<br/>
|
|
7
|
+
[ztree] - enhance to have expand & select 1 node and collapse 1 node<br/>
|
|
8
|
+
|
|
9
|
+
`1.1.42`<br/>
|
|
7
10
|
[zselectmultiple] - enhance to support ButtonList for zselectmultiple.<br/>
|
|
8
11
|
|
|
9
12
|
`1.1.41`<br/>
|
|
@@ -9826,12 +9826,56 @@
|
|
|
9826
9826
|
this.nodeCounter = 1;
|
|
9827
9827
|
this.clickActName = null;
|
|
9828
9828
|
this.state = { expandedkeys: [] };
|
|
9829
|
+
this.itemIndex = [];
|
|
9830
|
+
this.selectedKeys = [];
|
|
9829
9831
|
this.componentProperties = new i3.ZComponentProperties();
|
|
9830
9832
|
this.isExpanded = function (dataItem, index) {
|
|
9831
9833
|
// console.log(index);
|
|
9832
9834
|
return _this.state.expandedkeys.indexOf(index) > -1;
|
|
9833
9835
|
// return true;
|
|
9834
9836
|
};
|
|
9837
|
+
this.expandNode = function (field, value, setAsSelected) {
|
|
9838
|
+
_this.itemIndex = [];
|
|
9839
|
+
var node = _this.getItems();
|
|
9840
|
+
_this.searchNodeIndex(node, value, '', field);
|
|
9841
|
+
var index = _this.itemIndex;
|
|
9842
|
+
if (setAsSelected) {
|
|
9843
|
+
_this.selectedKeys = index;
|
|
9844
|
+
}
|
|
9845
|
+
var indexArr = [];
|
|
9846
|
+
index.forEach(function (i) {
|
|
9847
|
+
var arr = i.split('_');
|
|
9848
|
+
var indexs = "";
|
|
9849
|
+
arr.forEach(function (x) {
|
|
9850
|
+
indexs = indexs.concat("_").concat(x);
|
|
9851
|
+
indexArr.push(indexs.substring(1));
|
|
9852
|
+
});
|
|
9853
|
+
});
|
|
9854
|
+
_this.state.expandedkeys = _this.state.expandedkeys.concat(indexArr);
|
|
9855
|
+
};
|
|
9856
|
+
this.collapseNode = function (field, value, collapseParent) {
|
|
9857
|
+
_this.itemIndex = [];
|
|
9858
|
+
var node = _this.getItems();
|
|
9859
|
+
_this.searchNodeIndex(node, value, '', field);
|
|
9860
|
+
var index = _this.itemIndex;
|
|
9861
|
+
var indexArr = [];
|
|
9862
|
+
if (collapseParent) {
|
|
9863
|
+
index.forEach(function (i) {
|
|
9864
|
+
var arr = i.split('_');
|
|
9865
|
+
var indexs = "";
|
|
9866
|
+
arr.forEach(function (x) {
|
|
9867
|
+
indexs = indexs.concat("_").concat(x);
|
|
9868
|
+
indexArr.push(indexs.substring(1));
|
|
9869
|
+
});
|
|
9870
|
+
});
|
|
9871
|
+
}
|
|
9872
|
+
else {
|
|
9873
|
+
indexArr = index;
|
|
9874
|
+
}
|
|
9875
|
+
_this.state.expandedkeys = _this.state.expandedkeys.filter(function (v) {
|
|
9876
|
+
return !indexArr.includes(v);
|
|
9877
|
+
});
|
|
9878
|
+
};
|
|
9835
9879
|
this.expandAll = function () {
|
|
9836
9880
|
var node = _this.getItems();
|
|
9837
9881
|
_this.expandAllNode(node, '');
|
|
@@ -9888,6 +9932,21 @@
|
|
|
9888
9932
|
// console.warn('ztree field Value is not set correctly. ', fieldValue);
|
|
9889
9933
|
// }
|
|
9890
9934
|
};
|
|
9935
|
+
ZtreeComponent.prototype.searchNodeIndex = function (node, value, key, field) {
|
|
9936
|
+
var _this = this;
|
|
9937
|
+
if (key) {
|
|
9938
|
+
key = key + '_';
|
|
9939
|
+
}
|
|
9940
|
+
node.forEach(function (d, i) {
|
|
9941
|
+
if (d[field] === Number(value) || d[field] === value) {
|
|
9942
|
+
_this.itemIndex = _this.itemIndex.concat(key + '' + i);
|
|
9943
|
+
}
|
|
9944
|
+
if (Array.isArray(d.Value)) {
|
|
9945
|
+
var k = key + '' + i;
|
|
9946
|
+
_this.searchNodeIndex(d.Value, value, k, field);
|
|
9947
|
+
}
|
|
9948
|
+
});
|
|
9949
|
+
};
|
|
9891
9950
|
ZtreeComponent.prototype.expandAllNode = function (node, key) {
|
|
9892
9951
|
var _this = this;
|
|
9893
9952
|
if (key) {
|
|
@@ -10112,7 +10171,7 @@
|
|
|
10112
10171
|
ZtreeComponent.decorators = [
|
|
10113
10172
|
{ type: i0.Component, args: [{
|
|
10114
10173
|
selector: "app-ztree",
|
|
10115
|
-
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 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 <!-- <ion-icon name=\"add\" slot=\"icon-only\"></ion-icon> -->\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 <!-- <ion-icon name=\"close\" slot=\"icon-only\"></ion-icon> -->\r\n <fa-icon [icon]=\"'minus'\"></fa-icon>\r\n </ion-button>\r\n\r\n {{ getTemplate(dataItem, data, group) }}\r\n\r\n </ng-template>\r\n </kendo-treeview>\r\n</div>\r\n",
|
|
10174
|
+
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 <!-- <ion-icon name=\"add\" slot=\"icon-only\"></ion-icon> -->\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 <!-- <ion-icon name=\"close\" slot=\"icon-only\"></ion-icon> -->\r\n <fa-icon [icon]=\"'minus'\"></fa-icon>\r\n </ion-button>\r\n\r\n {{ getTemplate(dataItem, data, group) }}\r\n\r\n </ng-template>\r\n </kendo-treeview>\r\n</div>\r\n",
|
|
10116
10175
|
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 .k-treeview .k-in{border-radius:2px;border:1px solid #c8dbf5;background-color:#e3ecf8}:host ::ng-deep .k-treeview .k-in,:host ::ng-deep .k-treeview .k-in.k-state-selected{width:100%;margin:5px;padding:9px 20px 9px 8px;color:#0a45ab;font-size:13px;cursor:pointer}:host ::ng-deep .k-treeview .k-in.k-state-selected{border-radius:2px;background-color:#a9c3e8}:host ::ng-deep .k-treeview .k-in.k-state-hover,:host ::ng-deep .k-treeview .k-in:hover{width:100%;margin:5px;padding:9px 20px 9px 8px;border-radius:2px;background-color:#c9daf2;color:#0a45ab;font-size:13px;cursor:pointer}"]
|
|
10117
10176
|
},] }
|
|
10118
10177
|
];
|