@wavemaker/app-runtime-wm-build 11.4.0-next.25735 → 11.4.0-next.25736
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.
|
@@ -23185,8 +23185,9 @@
|
|
|
23185
23185
|
var defaultTreeIconClass = "plus-minus";
|
|
23186
23186
|
var TreeComponent = function(_super) {
|
|
23187
23187
|
__extends(TreeComponent, _super);
|
|
23188
|
-
function TreeComponent(inj) {
|
|
23188
|
+
function TreeComponent(inj, bindnodeid) {
|
|
23189
23189
|
var _this = _super.call(this, inj, WIDGET_INFO) || this;
|
|
23190
|
+
_this.bindnodeid = bindnodeid;
|
|
23190
23191
|
_this.setting = {
|
|
23191
23192
|
data: {
|
|
23192
23193
|
simpleData: {
|
|
@@ -23375,14 +23376,7 @@
|
|
|
23375
23376
|
this.expandNode(nodes[0], !nodes[0].open, true);
|
|
23376
23377
|
}
|
|
23377
23378
|
}
|
|
23378
|
-
|
|
23379
|
-
var eventParams = {
|
|
23380
|
-
$event: event,
|
|
23381
|
-
$item: treeNode,
|
|
23382
|
-
$path: path
|
|
23383
|
-
};
|
|
23384
|
-
this.setSelectedItem(treeNode);
|
|
23385
|
-
this.invokeEventCallback("select", eventParams);
|
|
23379
|
+
this.selectNode(event, treeNode);
|
|
23386
23380
|
};
|
|
23387
23381
|
TreeComponent.prototype.onExpand = function(event, treeId, treeNode) {
|
|
23388
23382
|
var self = this;
|
|
@@ -23552,43 +23546,72 @@
|
|
|
23552
23546
|
this.setting.callback["onCollapse"] = this.onCollapse.bind(this);
|
|
23553
23547
|
var zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.nodes);
|
|
23554
23548
|
$.fn.zTreeKeyboardNavigation(zTree, $('ul[name="' + this.name + '"]'), null, this.treeicon || defaultTreeIconClass);
|
|
23549
|
+
this.postRenderTree();
|
|
23555
23550
|
};
|
|
23556
|
-
TreeComponent.prototype.
|
|
23557
|
-
this.
|
|
23558
|
-
this.selecteditem.path = this.getPath(treeNode, "");
|
|
23559
|
-
var deSelectElm = $("li[treenode].selected");
|
|
23551
|
+
TreeComponent.prototype.selectNode = function(event, node) {
|
|
23552
|
+
var deSelectElm = $(".app-tree[name=" + this.name + "] li[treenode].selected");
|
|
23560
23553
|
deSelectElm.removeClass("selected");
|
|
23561
|
-
|
|
23554
|
+
if (!node) {
|
|
23555
|
+
return;
|
|
23556
|
+
}
|
|
23557
|
+
var selectElm = $("#" + node.tId + ":has(.curSelectedNode)");
|
|
23562
23558
|
selectElm.addClass("selected");
|
|
23559
|
+
var path = this.getPath(node, "");
|
|
23560
|
+
this.selecteditem = core.getClonedObject(node) || {};
|
|
23561
|
+
this.selecteditem.path = path;
|
|
23562
|
+
var eventParams = {
|
|
23563
|
+
$event: event,
|
|
23564
|
+
$item: node,
|
|
23565
|
+
$path: path
|
|
23566
|
+
};
|
|
23567
|
+
this.invokeEventCallback("select", eventParams);
|
|
23563
23568
|
};
|
|
23564
23569
|
TreeComponent.prototype.expandNode = function(node, expand, eventFlag) {
|
|
23565
23570
|
this.treeObj.expandNode(node, expand, false, false, eventFlag);
|
|
23566
23571
|
var el = $("#" + node.tId + "_switch");
|
|
23567
23572
|
$(el).addClass(this.treeicon || defaultTreeIconClass);
|
|
23568
23573
|
};
|
|
23569
|
-
TreeComponent.prototype.
|
|
23574
|
+
TreeComponent.prototype.postRenderTree = function() {
|
|
23570
23575
|
var _this = this;
|
|
23571
23576
|
setTimeout((function() {
|
|
23572
23577
|
_this.changeTreeIcons(_this.treeicon || defaultTreeIconClass);
|
|
23573
|
-
if (_this.datavalue) {
|
|
23578
|
+
if (_this.datavalue && !_this.selecteditem) {
|
|
23574
23579
|
var nodes = _this.treeObj.getNodes();
|
|
23575
|
-
var
|
|
23576
|
-
if (
|
|
23577
|
-
if (
|
|
23578
|
-
|
|
23580
|
+
var node = void 0;
|
|
23581
|
+
if (nodes.length) {
|
|
23582
|
+
if (_this.datavalue === "FirstNode") {
|
|
23583
|
+
node = nodes[0];
|
|
23579
23584
|
}
|
|
23580
|
-
|
|
23581
|
-
|
|
23582
|
-
if (nodes.length) {
|
|
23583
|
-
selectNode = nodes[nodes.length - 1];
|
|
23585
|
+
if (_this.datavalue === "LastNode") {
|
|
23586
|
+
node = nodes[nodes.length - 1];
|
|
23584
23587
|
}
|
|
23585
23588
|
}
|
|
23586
|
-
|
|
23587
|
-
|
|
23588
|
-
|
|
23589
|
+
if (node) {
|
|
23590
|
+
_this.treeObj.selectNode(node, false);
|
|
23591
|
+
_this.selectNode(undefined, node);
|
|
23592
|
+
_this.expandNode(node, true, false);
|
|
23593
|
+
}
|
|
23589
23594
|
}
|
|
23590
23595
|
}), 200);
|
|
23591
23596
|
};
|
|
23597
|
+
TreeComponent.prototype.selectById = function(value) {
|
|
23598
|
+
var _this = this;
|
|
23599
|
+
var simpleNodes = this.treeObj.transformToArray(this.treeObj.getNodes());
|
|
23600
|
+
var node = simpleNodes.find((function(node) {
|
|
23601
|
+
return value === base.getEvaluatedData(node, {
|
|
23602
|
+
field: _this.nodeid,
|
|
23603
|
+
bindExpression: _this.bindnodeid
|
|
23604
|
+
}, _this.viewParent);
|
|
23605
|
+
}));
|
|
23606
|
+
if (node) {
|
|
23607
|
+
this.treeObj.selectNode(node, false);
|
|
23608
|
+
this.selectNode(undefined, node);
|
|
23609
|
+
}
|
|
23610
|
+
};
|
|
23611
|
+
TreeComponent.prototype.deselectById = function(value) {
|
|
23612
|
+
this.selecteditem = {};
|
|
23613
|
+
this.selectById();
|
|
23614
|
+
};
|
|
23592
23615
|
return TreeComponent;
|
|
23593
23616
|
}(base.StylableComponent);
|
|
23594
23617
|
TreeComponent.initializeProps = registerProps();
|
|
@@ -23604,6 +23627,12 @@
|
|
|
23604
23627
|
TreeComponent.ctorParameters = function() {
|
|
23605
23628
|
return [ {
|
|
23606
23629
|
type: core$1.Injector
|
|
23630
|
+
}, {
|
|
23631
|
+
type: undefined,
|
|
23632
|
+
decorators: [ {
|
|
23633
|
+
type: core$1.Attribute,
|
|
23634
|
+
args: [ "nodeid.bind" ]
|
|
23635
|
+
} ]
|
|
23607
23636
|
} ];
|
|
23608
23637
|
};
|
|
23609
23638
|
var components = [ TreeComponent ];
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
125
125
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
126
126
|
PERFORMANCE OF THIS SOFTWARE.
|
|
127
|
-
***************************************************************************** */var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function r(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,a=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)r.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return r}function l(e,t,n){if(n||2===arguments.length)for(var i,o=0,a=t.length;o<a;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var c=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},p={widgetType:"wm-tree",hostClass:"app-tree"},d="plus-minus",u=function(e){function t(t){var n=e.call(this,t,p)||this;return n.setting={data:{simpleData:{enable:!1},key:{children:"children",name:"label"}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(n.nativeElement,n,i.APPLY_STYLES_TYPE.CONTAINER),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.level>0&&this.expandTree(this.level,this.nodes,0),this.renderTree();break;case"levels":n>0&&(this.level=n),this.renderTree();break;case"treeicons":this.treeicon=n,this.renderTree();break;case"nodelabel":this.setting.data.key.name=this.labelKey,this.renderTree();break;case"nodechildren":this.setting.data.key.children=this.childrenKey,this.renderTree();break;case"nodeicon":this.nodeicon=this.iconKey,this.renderTree();break;case"orderby":this.renderTree();break;case"class":this.treeClass=n,this.renderTree();break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=i.getChildren(t);o&&!("open"in t)&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){"Classic"===e?this.setting.check.enable=!1:"Checkbox"===e?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):"Radio"===e&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeclasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.setNodeData=function(e,t,n,i,o){var a=this;0===t?e.map((function(e){var r=a.getChildren(e);if(r&&a.setNodeData(r,t,n,i,o),e.icon&&"icon"==a.nodelabel)e[o]=e.icon;else{if(!e.name||"name"!=a.nodelabel)return;e[o]=e.name}})):e.map((function(e){var r=a.getChildren(e);return r&&n>1&&(t===n&&(i=e),a.setNodeData(r,t,n-1,i,o)),1===n&&("name"===o?a.nodelabel.includes("label")||a.nodelabel.includes("name"):a.nodeicon.includes("label")||a.nodeicon.includes("name"))?void(i[o]=e.name||e.label):1===n&&void 0!==e.icon&&("name"===o?a.nodelabel.includes("icon"):a.nodeicon.includes("icon"))?void(i[o]=e.icon):void 0}))},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e[this.labelKey]+t:this.getPath(e.getParentNode(),t)+"/"+e[this.labelKey]},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.treeObj.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}var a={$event:e,$item:n,$path:this.getPath(n,"")};this.setSelectedItem(n),this.invokeEventCallback("select",a)},t.prototype.onExpand=function(e,t,n){var i=this,o={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("expand",o);var a=this.getChildren(n);null==a||a.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicon||d),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicon||d)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("collapse",i)},t.prototype.getChildren=function(e){return e[this.childrenKey]},Object.defineProperty(t.prototype,"childrenKey",{get:function(){return this.nodechildren?this.countDepth(this.nodechildren)?this.nodechildren.split(".").pop():this.nodechildren:"children"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelKey",{get:function(){return this.nodelabel?this.countDepth(this.nodelabel)?this.nodelabel.split(".").pop():this.nodelabel:"label"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconKey",{get:function(){return this.nodeicon?this.countDepth(this.nodeicon)?this.nodeicon.split(".").pop():this.nodeicon:"icon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"treeObj",{get:function(){return $.fn.zTree.getZTreeObj(""+this.name)},enumerable:!1,configurable:!0}),t.prototype.modifyObjects=function(e){var t=this;e.forEach((function(e){e.icon=e[t.nodeicon];var n=t.getChildren(e);(null==n?void 0:n.length)&&t.modifyObjects(n)}))},t.prototype.setNodeChildren=function(e,t,n,i){var o=this;if(t<=0)return e;for(var a=0;a<e.length;a++){var r=e[a];t===n&&(i=e[a]);var s=this.getChildren(r);if(null==s?void 0:s.length){if(1===n)return void(i[this.childrenKey]=s.map((function(e){var t;return(t={})[o.labelKey]=e[o.labelKey],t[o.childrenKey]=o.getChildren(e),t.icon=e[o.iconKey],t})));this.setNodeChildren(s,t,n-1,i)}}return e},t.prototype.countDepth=function(e){var t,n,i=e.match(/\[.*?\]/g),o=1;if(null===i)return o;try{for(var a=r(i),s=a.next();!s.done;s=a.next()){s.value;o++}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},t.prototype.renderTree=function(){if(this.nodes){if(this.nativeElement.setAttribute("id",this.name),this.nodeicon&&"icon"!==this.nodeicon&&this.modifyObjects(this.nodes),this.setTreeTemplate(this.treeClass),this.nodelabel){var e=0;this.nodelabel.includes("children")&&(e=this.countDepth(this.nodelabel)),this.setNodeData(this.nodes,e,e,null,"name")}if(this.nodeicon){e=0;this.nodeicon.includes("children")&&(e=this.countDepth(this.nodeicon)),this.setNodeData(this.nodes,e,e,null,"icon")}if(this.nodechildren)(e=this.countDepth(this.nodechildren))>1&&(this.nodes=this.setNodeChildren(this.nodes,e,e,null))}this.setting.view.nodeClasses=this.setNodeclasses,this.setting.callback.onClick=this.onClick.bind(this),this.setting.callback.onExpand=this.onExpand.bind(this),this.setting.callback.onCollapse=this.onCollapse.bind(this);var t=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.nodes);$.fn.zTreeKeyboardNavigation(t,$('ul[name="'+this.name+'"]'),null,this.treeicon||d)},t.prototype.setSelectedItem=function(e){this.selecteditem=o.getClonedObject(e)||{},this.selecteditem.path=this.getPath(e,""),$("li[treenode].selected").removeClass("selected"),$("#"+e.tId+":has(.curSelectedNode)").addClass("selected")},t.prototype.expandNode=function(e,t,n){this.treeObj.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicon||d)},t.prototype.ngAfterViewInit=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicon||d),e.datavalue){var t=e.treeObj.getNodes(),n=void 0;"FirstNode"===e.datavalue&&t.length&&(n=t[0]),"LastNode"===e.datavalue&&t.length&&(n=t[t.length-1]),e.treeObj.selectNode(n,!1),e.setSelectedItem(n),e.expandNode(n,!0,!1)}}),200)},t}(i.StylableComponent);u.initializeProps=c(),u.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(u)],encapsulation:t.ViewEncapsulation.None}]}],u.ctorParameters=function(){return[{type:t.Injector}]};var h=[u],m=function(){};m.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:l([],s(h)),exports:l([],s(h)),entryComponents:[]}]}],e.TreeComponent=u,e.TreeModule=m,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,a,r){"use strict";
|
|
127
|
+
***************************************************************************** */var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function r(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,a=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)r.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return r}function l(e,t,n){if(n||2===arguments.length)for(var i,o=0,a=t.length;o<a;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var c=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},p={widgetType:"wm-tree",hostClass:"app-tree"},d="plus-minus",u=function(e){function t(t,n){var o=e.call(this,t,p)||this;return o.bindnodeid=n,o.setting={data:{simpleData:{enable:!1},key:{children:"children",name:"label"}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(o.nativeElement,o,i.APPLY_STYLES_TYPE.CONTAINER),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.level>0&&this.expandTree(this.level,this.nodes,0),this.renderTree();break;case"levels":n>0&&(this.level=n),this.renderTree();break;case"treeicons":this.treeicon=n,this.renderTree();break;case"nodelabel":this.setting.data.key.name=this.labelKey,this.renderTree();break;case"nodechildren":this.setting.data.key.children=this.childrenKey,this.renderTree();break;case"nodeicon":this.nodeicon=this.iconKey,this.renderTree();break;case"orderby":this.renderTree();break;case"class":this.treeClass=n,this.renderTree();break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=i.getChildren(t);o&&!("open"in t)&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){"Classic"===e?this.setting.check.enable=!1:"Checkbox"===e?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):"Radio"===e&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeclasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.setNodeData=function(e,t,n,i,o){var a=this;0===t?e.map((function(e){var r=a.getChildren(e);if(r&&a.setNodeData(r,t,n,i,o),e.icon&&"icon"==a.nodelabel)e[o]=e.icon;else{if(!e.name||"name"!=a.nodelabel)return;e[o]=e.name}})):e.map((function(e){var r=a.getChildren(e);return r&&n>1&&(t===n&&(i=e),a.setNodeData(r,t,n-1,i,o)),1===n&&("name"===o?a.nodelabel.includes("label")||a.nodelabel.includes("name"):a.nodeicon.includes("label")||a.nodeicon.includes("name"))?void(i[o]=e.name||e.label):1===n&&void 0!==e.icon&&("name"===o?a.nodelabel.includes("icon"):a.nodeicon.includes("icon"))?void(i[o]=e.icon):void 0}))},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e[this.labelKey]+t:this.getPath(e.getParentNode(),t)+"/"+e[this.labelKey]},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.treeObj.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}this.selectNode(e,n)},t.prototype.onExpand=function(e,t,n){var i=this,o={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("expand",o);var a=this.getChildren(n);null==a||a.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicon||d),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicon||d)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("collapse",i)},t.prototype.getChildren=function(e){return e[this.childrenKey]},Object.defineProperty(t.prototype,"childrenKey",{get:function(){return this.nodechildren?this.countDepth(this.nodechildren)?this.nodechildren.split(".").pop():this.nodechildren:"children"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelKey",{get:function(){return this.nodelabel?this.countDepth(this.nodelabel)?this.nodelabel.split(".").pop():this.nodelabel:"label"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconKey",{get:function(){return this.nodeicon?this.countDepth(this.nodeicon)?this.nodeicon.split(".").pop():this.nodeicon:"icon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"treeObj",{get:function(){return $.fn.zTree.getZTreeObj(""+this.name)},enumerable:!1,configurable:!0}),t.prototype.modifyObjects=function(e){var t=this;e.forEach((function(e){e.icon=e[t.nodeicon];var n=t.getChildren(e);(null==n?void 0:n.length)&&t.modifyObjects(n)}))},t.prototype.setNodeChildren=function(e,t,n,i){var o=this;if(t<=0)return e;for(var a=0;a<e.length;a++){var r=e[a];t===n&&(i=e[a]);var s=this.getChildren(r);if(null==s?void 0:s.length){if(1===n)return void(i[this.childrenKey]=s.map((function(e){var t;return(t={})[o.labelKey]=e[o.labelKey],t[o.childrenKey]=o.getChildren(e),t.icon=e[o.iconKey],t})));this.setNodeChildren(s,t,n-1,i)}}return e},t.prototype.countDepth=function(e){var t,n,i=e.match(/\[.*?\]/g),o=1;if(null===i)return o;try{for(var a=r(i),s=a.next();!s.done;s=a.next()){s.value;o++}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},t.prototype.renderTree=function(){if(this.nodes){if(this.nativeElement.setAttribute("id",this.name),this.nodeicon&&"icon"!==this.nodeicon&&this.modifyObjects(this.nodes),this.setTreeTemplate(this.treeClass),this.nodelabel){var e=0;this.nodelabel.includes("children")&&(e=this.countDepth(this.nodelabel)),this.setNodeData(this.nodes,e,e,null,"name")}if(this.nodeicon){e=0;this.nodeicon.includes("children")&&(e=this.countDepth(this.nodeicon)),this.setNodeData(this.nodes,e,e,null,"icon")}if(this.nodechildren)(e=this.countDepth(this.nodechildren))>1&&(this.nodes=this.setNodeChildren(this.nodes,e,e,null))}this.setting.view.nodeClasses=this.setNodeclasses,this.setting.callback.onClick=this.onClick.bind(this),this.setting.callback.onExpand=this.onExpand.bind(this),this.setting.callback.onCollapse=this.onCollapse.bind(this);var t=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.nodes);$.fn.zTreeKeyboardNavigation(t,$('ul[name="'+this.name+'"]'),null,this.treeicon||d),this.postRenderTree()},t.prototype.selectNode=function(e,t){if($(".app-tree[name="+this.name+"] li[treenode].selected").removeClass("selected"),t){$("#"+t.tId+":has(.curSelectedNode)").addClass("selected");var n=this.getPath(t,"");this.selecteditem=o.getClonedObject(t)||{},this.selecteditem.path=n;var i={$event:e,$item:t,$path:n};this.invokeEventCallback("select",i)}},t.prototype.expandNode=function(e,t,n){this.treeObj.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicon||d)},t.prototype.postRenderTree=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicon||d),e.datavalue&&!e.selecteditem){var t=e.treeObj.getNodes(),n=void 0;t.length&&("FirstNode"===e.datavalue&&(n=t[0]),"LastNode"===e.datavalue&&(n=t[t.length-1])),n&&(e.treeObj.selectNode(n,!1),e.selectNode(void 0,n),e.expandNode(n,!0,!1))}}),200)},t.prototype.selectById=function(e){var t=this,n=this.treeObj.transformToArray(this.treeObj.getNodes()).find((function(n){return e===i.getEvaluatedData(n,{field:t.nodeid,bindExpression:t.bindnodeid},t.viewParent)}));n&&(this.treeObj.selectNode(n,!1),this.selectNode(void 0,n))},t.prototype.deselectById=function(e){this.selecteditem={},this.selectById()},t}(i.StylableComponent);u.initializeProps=c(),u.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(u)],encapsulation:t.ViewEncapsulation.None}]}],u.ctorParameters=function(){return[{type:t.Injector},{type:void 0,decorators:[{type:t.Attribute,args:["nodeid.bind"]}]}]};var h=[u],m=function(){};m.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:l([],s(h)),exports:l([],s(h)),entryComponents:[]}]}],e.TreeComponent=u,e.TreeModule=m,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,a,r){"use strict";
|
|
128
128
|
/*! *****************************************************************************
|
|
129
129
|
Copyright (c) Microsoft Corporation.
|
|
130
130
|
|
|
@@ -23185,8 +23185,9 @@
|
|
|
23185
23185
|
var defaultTreeIconClass = "plus-minus";
|
|
23186
23186
|
var TreeComponent = function(_super) {
|
|
23187
23187
|
__extends(TreeComponent, _super);
|
|
23188
|
-
function TreeComponent(inj) {
|
|
23188
|
+
function TreeComponent(inj, bindnodeid) {
|
|
23189
23189
|
var _this = _super.call(this, inj, WIDGET_INFO) || this;
|
|
23190
|
+
_this.bindnodeid = bindnodeid;
|
|
23190
23191
|
_this.setting = {
|
|
23191
23192
|
data: {
|
|
23192
23193
|
simpleData: {
|
|
@@ -23375,14 +23376,7 @@
|
|
|
23375
23376
|
this.expandNode(nodes[0], !nodes[0].open, true);
|
|
23376
23377
|
}
|
|
23377
23378
|
}
|
|
23378
|
-
|
|
23379
|
-
var eventParams = {
|
|
23380
|
-
$event: event,
|
|
23381
|
-
$item: treeNode,
|
|
23382
|
-
$path: path
|
|
23383
|
-
};
|
|
23384
|
-
this.setSelectedItem(treeNode);
|
|
23385
|
-
this.invokeEventCallback("select", eventParams);
|
|
23379
|
+
this.selectNode(event, treeNode);
|
|
23386
23380
|
};
|
|
23387
23381
|
TreeComponent.prototype.onExpand = function(event, treeId, treeNode) {
|
|
23388
23382
|
var self = this;
|
|
@@ -23552,43 +23546,72 @@
|
|
|
23552
23546
|
this.setting.callback["onCollapse"] = this.onCollapse.bind(this);
|
|
23553
23547
|
var zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.nodes);
|
|
23554
23548
|
$.fn.zTreeKeyboardNavigation(zTree, $('ul[name="' + this.name + '"]'), null, this.treeicon || defaultTreeIconClass);
|
|
23549
|
+
this.postRenderTree();
|
|
23555
23550
|
};
|
|
23556
|
-
TreeComponent.prototype.
|
|
23557
|
-
this.
|
|
23558
|
-
this.selecteditem.path = this.getPath(treeNode, "");
|
|
23559
|
-
var deSelectElm = $("li[treenode].selected");
|
|
23551
|
+
TreeComponent.prototype.selectNode = function(event, node) {
|
|
23552
|
+
var deSelectElm = $(".app-tree[name=" + this.name + "] li[treenode].selected");
|
|
23560
23553
|
deSelectElm.removeClass("selected");
|
|
23561
|
-
|
|
23554
|
+
if (!node) {
|
|
23555
|
+
return;
|
|
23556
|
+
}
|
|
23557
|
+
var selectElm = $("#" + node.tId + ":has(.curSelectedNode)");
|
|
23562
23558
|
selectElm.addClass("selected");
|
|
23559
|
+
var path = this.getPath(node, "");
|
|
23560
|
+
this.selecteditem = core.getClonedObject(node) || {};
|
|
23561
|
+
this.selecteditem.path = path;
|
|
23562
|
+
var eventParams = {
|
|
23563
|
+
$event: event,
|
|
23564
|
+
$item: node,
|
|
23565
|
+
$path: path
|
|
23566
|
+
};
|
|
23567
|
+
this.invokeEventCallback("select", eventParams);
|
|
23563
23568
|
};
|
|
23564
23569
|
TreeComponent.prototype.expandNode = function(node, expand, eventFlag) {
|
|
23565
23570
|
this.treeObj.expandNode(node, expand, false, false, eventFlag);
|
|
23566
23571
|
var el = $("#" + node.tId + "_switch");
|
|
23567
23572
|
$(el).addClass(this.treeicon || defaultTreeIconClass);
|
|
23568
23573
|
};
|
|
23569
|
-
TreeComponent.prototype.
|
|
23574
|
+
TreeComponent.prototype.postRenderTree = function() {
|
|
23570
23575
|
var _this = this;
|
|
23571
23576
|
setTimeout((function() {
|
|
23572
23577
|
_this.changeTreeIcons(_this.treeicon || defaultTreeIconClass);
|
|
23573
|
-
if (_this.datavalue) {
|
|
23578
|
+
if (_this.datavalue && !_this.selecteditem) {
|
|
23574
23579
|
var nodes = _this.treeObj.getNodes();
|
|
23575
|
-
var
|
|
23576
|
-
if (
|
|
23577
|
-
if (
|
|
23578
|
-
|
|
23580
|
+
var node = void 0;
|
|
23581
|
+
if (nodes.length) {
|
|
23582
|
+
if (_this.datavalue === "FirstNode") {
|
|
23583
|
+
node = nodes[0];
|
|
23579
23584
|
}
|
|
23580
|
-
|
|
23581
|
-
|
|
23582
|
-
if (nodes.length) {
|
|
23583
|
-
selectNode = nodes[nodes.length - 1];
|
|
23585
|
+
if (_this.datavalue === "LastNode") {
|
|
23586
|
+
node = nodes[nodes.length - 1];
|
|
23584
23587
|
}
|
|
23585
23588
|
}
|
|
23586
|
-
|
|
23587
|
-
|
|
23588
|
-
|
|
23589
|
+
if (node) {
|
|
23590
|
+
_this.treeObj.selectNode(node, false);
|
|
23591
|
+
_this.selectNode(undefined, node);
|
|
23592
|
+
_this.expandNode(node, true, false);
|
|
23593
|
+
}
|
|
23589
23594
|
}
|
|
23590
23595
|
}), 200);
|
|
23591
23596
|
};
|
|
23597
|
+
TreeComponent.prototype.selectById = function(value) {
|
|
23598
|
+
var _this = this;
|
|
23599
|
+
var simpleNodes = this.treeObj.transformToArray(this.treeObj.getNodes());
|
|
23600
|
+
var node = simpleNodes.find((function(node) {
|
|
23601
|
+
return value === base.getEvaluatedData(node, {
|
|
23602
|
+
field: _this.nodeid,
|
|
23603
|
+
bindExpression: _this.bindnodeid
|
|
23604
|
+
}, _this.viewParent);
|
|
23605
|
+
}));
|
|
23606
|
+
if (node) {
|
|
23607
|
+
this.treeObj.selectNode(node, false);
|
|
23608
|
+
this.selectNode(undefined, node);
|
|
23609
|
+
}
|
|
23610
|
+
};
|
|
23611
|
+
TreeComponent.prototype.deselectById = function(value) {
|
|
23612
|
+
this.selecteditem = {};
|
|
23613
|
+
this.selectById();
|
|
23614
|
+
};
|
|
23592
23615
|
return TreeComponent;
|
|
23593
23616
|
}(base.StylableComponent);
|
|
23594
23617
|
TreeComponent.initializeProps = registerProps();
|
|
@@ -23604,6 +23627,12 @@
|
|
|
23604
23627
|
TreeComponent.ctorParameters = function() {
|
|
23605
23628
|
return [ {
|
|
23606
23629
|
type: core$1.Injector
|
|
23630
|
+
}, {
|
|
23631
|
+
type: undefined,
|
|
23632
|
+
decorators: [ {
|
|
23633
|
+
type: core$1.Attribute,
|
|
23634
|
+
args: [ "nodeid.bind" ]
|
|
23635
|
+
} ]
|
|
23607
23636
|
} ];
|
|
23608
23637
|
};
|
|
23609
23638
|
var components = [ TreeComponent ];
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
125
125
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
126
126
|
PERFORMANCE OF THIS SOFTWARE.
|
|
127
|
-
***************************************************************************** */var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function a(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function l(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var c=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},p={widgetType:"wm-tree",hostClass:"app-tree"},u="plus-minus",d=function(e){function t(t){var n=e.call(this,t,p)||this;return n.setting={data:{simpleData:{enable:!1},key:{children:"children",name:"label"}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(n.nativeElement,n,i.APPLY_STYLES_TYPE.CONTAINER),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.level>0&&this.expandTree(this.level,this.nodes,0),this.renderTree();break;case"levels":n>0&&(this.level=n),this.renderTree();break;case"treeicons":this.treeicon=n,this.renderTree();break;case"nodelabel":this.setting.data.key.name=this.labelKey,this.renderTree();break;case"nodechildren":this.setting.data.key.children=this.childrenKey,this.renderTree();break;case"nodeicon":this.nodeicon=this.iconKey,this.renderTree();break;case"orderby":this.renderTree();break;case"class":this.treeClass=n,this.renderTree();break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=i.getChildren(t);o&&!("open"in t)&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){"Classic"===e?this.setting.check.enable=!1:"Checkbox"===e?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):"Radio"===e&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeclasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.setNodeData=function(e,t,n,i,o){var r=this;0===t?e.map((function(e){var a=r.getChildren(e);if(a&&r.setNodeData(a,t,n,i,o),e.icon&&"icon"==r.nodelabel)e[o]=e.icon;else{if(!e.name||"name"!=r.nodelabel)return;e[o]=e.name}})):e.map((function(e){var a=r.getChildren(e);return a&&n>1&&(t===n&&(i=e),r.setNodeData(a,t,n-1,i,o)),1===n&&("name"===o?r.nodelabel.includes("label")||r.nodelabel.includes("name"):r.nodeicon.includes("label")||r.nodeicon.includes("name"))?void(i[o]=e.name||e.label):1===n&&void 0!==e.icon&&("name"===o?r.nodelabel.includes("icon"):r.nodeicon.includes("icon"))?void(i[o]=e.icon):void 0}))},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e[this.labelKey]+t:this.getPath(e.getParentNode(),t)+"/"+e[this.labelKey]},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.treeObj.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}var r={$event:e,$item:n,$path:this.getPath(n,"")};this.setSelectedItem(n),this.invokeEventCallback("select",r)},t.prototype.onExpand=function(e,t,n){var i=this,o={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("expand",o);var r=this.getChildren(n);null==r||r.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicon||u),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicon||u)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("collapse",i)},t.prototype.getChildren=function(e){return e[this.childrenKey]},Object.defineProperty(t.prototype,"childrenKey",{get:function(){return this.nodechildren?this.countDepth(this.nodechildren)?this.nodechildren.split(".").pop():this.nodechildren:"children"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelKey",{get:function(){return this.nodelabel?this.countDepth(this.nodelabel)?this.nodelabel.split(".").pop():this.nodelabel:"label"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconKey",{get:function(){return this.nodeicon?this.countDepth(this.nodeicon)?this.nodeicon.split(".").pop():this.nodeicon:"icon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"treeObj",{get:function(){return $.fn.zTree.getZTreeObj(""+this.name)},enumerable:!1,configurable:!0}),t.prototype.modifyObjects=function(e){var t=this;e.forEach((function(e){e.icon=e[t.nodeicon];var n=t.getChildren(e);(null==n?void 0:n.length)&&t.modifyObjects(n)}))},t.prototype.setNodeChildren=function(e,t,n,i){var o=this;if(t<=0)return e;for(var r=0;r<e.length;r++){var a=e[r];t===n&&(i=e[r]);var s=this.getChildren(a);if(null==s?void 0:s.length){if(1===n)return void(i[this.childrenKey]=s.map((function(e){var t;return(t={})[o.labelKey]=e[o.labelKey],t[o.childrenKey]=o.getChildren(e),t.icon=e[o.iconKey],t})));this.setNodeChildren(s,t,n-1,i)}}return e},t.prototype.countDepth=function(e){var t,n,i=e.match(/\[.*?\]/g),o=1;if(null===i)return o;try{for(var r=a(i),s=r.next();!s.done;s=r.next()){s.value;o++}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return o},t.prototype.renderTree=function(){if(this.nodes){if(this.nativeElement.setAttribute("id",this.name),this.nodeicon&&"icon"!==this.nodeicon&&this.modifyObjects(this.nodes),this.setTreeTemplate(this.treeClass),this.nodelabel){var e=0;this.nodelabel.includes("children")&&(e=this.countDepth(this.nodelabel)),this.setNodeData(this.nodes,e,e,null,"name")}if(this.nodeicon){e=0;this.nodeicon.includes("children")&&(e=this.countDepth(this.nodeicon)),this.setNodeData(this.nodes,e,e,null,"icon")}if(this.nodechildren)(e=this.countDepth(this.nodechildren))>1&&(this.nodes=this.setNodeChildren(this.nodes,e,e,null))}this.setting.view.nodeClasses=this.setNodeclasses,this.setting.callback.onClick=this.onClick.bind(this),this.setting.callback.onExpand=this.onExpand.bind(this),this.setting.callback.onCollapse=this.onCollapse.bind(this);var t=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.nodes);$.fn.zTreeKeyboardNavigation(t,$('ul[name="'+this.name+'"]'),null,this.treeicon||u)},t.prototype.setSelectedItem=function(e){this.selecteditem=o.getClonedObject(e)||{},this.selecteditem.path=this.getPath(e,""),$("li[treenode].selected").removeClass("selected"),$("#"+e.tId+":has(.curSelectedNode)").addClass("selected")},t.prototype.expandNode=function(e,t,n){this.treeObj.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicon||u)},t.prototype.ngAfterViewInit=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicon||u),e.datavalue){var t=e.treeObj.getNodes(),n=void 0;"FirstNode"===e.datavalue&&t.length&&(n=t[0]),"LastNode"===e.datavalue&&t.length&&(n=t[t.length-1]),e.treeObj.selectNode(n,!1),e.setSelectedItem(n),e.expandNode(n,!0,!1)}}),200)},t}(i.StylableComponent);d.initializeProps=c(),d.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(d)],encapsulation:t.ViewEncapsulation.None}]}],d.ctorParameters=function(){return[{type:t.Injector}]};var h=[d],m=function(){};m.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:l([],s(h)),exports:l([],s(h)),entryComponents:[]}]}],e.TreeComponent=d,e.TreeModule=m,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,r,a){"use strict";
|
|
127
|
+
***************************************************************************** */var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function a(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function l(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var c=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},p={widgetType:"wm-tree",hostClass:"app-tree"},u="plus-minus",d=function(e){function t(t,n){var o=e.call(this,t,p)||this;return o.bindnodeid=n,o.setting={data:{simpleData:{enable:!1},key:{children:"children",name:"label"}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(o.nativeElement,o,i.APPLY_STYLES_TYPE.CONTAINER),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.level>0&&this.expandTree(this.level,this.nodes,0),this.renderTree();break;case"levels":n>0&&(this.level=n),this.renderTree();break;case"treeicons":this.treeicon=n,this.renderTree();break;case"nodelabel":this.setting.data.key.name=this.labelKey,this.renderTree();break;case"nodechildren":this.setting.data.key.children=this.childrenKey,this.renderTree();break;case"nodeicon":this.nodeicon=this.iconKey,this.renderTree();break;case"orderby":this.renderTree();break;case"class":this.treeClass=n,this.renderTree();break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=i.getChildren(t);o&&!("open"in t)&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){"Classic"===e?this.setting.check.enable=!1:"Checkbox"===e?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):"Radio"===e&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeclasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.setNodeData=function(e,t,n,i,o){var r=this;0===t?e.map((function(e){var a=r.getChildren(e);if(a&&r.setNodeData(a,t,n,i,o),e.icon&&"icon"==r.nodelabel)e[o]=e.icon;else{if(!e.name||"name"!=r.nodelabel)return;e[o]=e.name}})):e.map((function(e){var a=r.getChildren(e);return a&&n>1&&(t===n&&(i=e),r.setNodeData(a,t,n-1,i,o)),1===n&&("name"===o?r.nodelabel.includes("label")||r.nodelabel.includes("name"):r.nodeicon.includes("label")||r.nodeicon.includes("name"))?void(i[o]=e.name||e.label):1===n&&void 0!==e.icon&&("name"===o?r.nodelabel.includes("icon"):r.nodeicon.includes("icon"))?void(i[o]=e.icon):void 0}))},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e[this.labelKey]+t:this.getPath(e.getParentNode(),t)+"/"+e[this.labelKey]},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.treeObj.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}this.selectNode(e,n)},t.prototype.onExpand=function(e,t,n){var i=this,o={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("expand",o);var r=this.getChildren(n);null==r||r.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicon||u),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicon||u)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("collapse",i)},t.prototype.getChildren=function(e){return e[this.childrenKey]},Object.defineProperty(t.prototype,"childrenKey",{get:function(){return this.nodechildren?this.countDepth(this.nodechildren)?this.nodechildren.split(".").pop():this.nodechildren:"children"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelKey",{get:function(){return this.nodelabel?this.countDepth(this.nodelabel)?this.nodelabel.split(".").pop():this.nodelabel:"label"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconKey",{get:function(){return this.nodeicon?this.countDepth(this.nodeicon)?this.nodeicon.split(".").pop():this.nodeicon:"icon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"treeObj",{get:function(){return $.fn.zTree.getZTreeObj(""+this.name)},enumerable:!1,configurable:!0}),t.prototype.modifyObjects=function(e){var t=this;e.forEach((function(e){e.icon=e[t.nodeicon];var n=t.getChildren(e);(null==n?void 0:n.length)&&t.modifyObjects(n)}))},t.prototype.setNodeChildren=function(e,t,n,i){var o=this;if(t<=0)return e;for(var r=0;r<e.length;r++){var a=e[r];t===n&&(i=e[r]);var s=this.getChildren(a);if(null==s?void 0:s.length){if(1===n)return void(i[this.childrenKey]=s.map((function(e){var t;return(t={})[o.labelKey]=e[o.labelKey],t[o.childrenKey]=o.getChildren(e),t.icon=e[o.iconKey],t})));this.setNodeChildren(s,t,n-1,i)}}return e},t.prototype.countDepth=function(e){var t,n,i=e.match(/\[.*?\]/g),o=1;if(null===i)return o;try{for(var r=a(i),s=r.next();!s.done;s=r.next()){s.value;o++}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return o},t.prototype.renderTree=function(){if(this.nodes){if(this.nativeElement.setAttribute("id",this.name),this.nodeicon&&"icon"!==this.nodeicon&&this.modifyObjects(this.nodes),this.setTreeTemplate(this.treeClass),this.nodelabel){var e=0;this.nodelabel.includes("children")&&(e=this.countDepth(this.nodelabel)),this.setNodeData(this.nodes,e,e,null,"name")}if(this.nodeicon){e=0;this.nodeicon.includes("children")&&(e=this.countDepth(this.nodeicon)),this.setNodeData(this.nodes,e,e,null,"icon")}if(this.nodechildren)(e=this.countDepth(this.nodechildren))>1&&(this.nodes=this.setNodeChildren(this.nodes,e,e,null))}this.setting.view.nodeClasses=this.setNodeclasses,this.setting.callback.onClick=this.onClick.bind(this),this.setting.callback.onExpand=this.onExpand.bind(this),this.setting.callback.onCollapse=this.onCollapse.bind(this);var t=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.nodes);$.fn.zTreeKeyboardNavigation(t,$('ul[name="'+this.name+'"]'),null,this.treeicon||u),this.postRenderTree()},t.prototype.selectNode=function(e,t){if($(".app-tree[name="+this.name+"] li[treenode].selected").removeClass("selected"),t){$("#"+t.tId+":has(.curSelectedNode)").addClass("selected");var n=this.getPath(t,"");this.selecteditem=o.getClonedObject(t)||{},this.selecteditem.path=n;var i={$event:e,$item:t,$path:n};this.invokeEventCallback("select",i)}},t.prototype.expandNode=function(e,t,n){this.treeObj.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicon||u)},t.prototype.postRenderTree=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicon||u),e.datavalue&&!e.selecteditem){var t=e.treeObj.getNodes(),n=void 0;t.length&&("FirstNode"===e.datavalue&&(n=t[0]),"LastNode"===e.datavalue&&(n=t[t.length-1])),n&&(e.treeObj.selectNode(n,!1),e.selectNode(void 0,n),e.expandNode(n,!0,!1))}}),200)},t.prototype.selectById=function(e){var t=this,n=this.treeObj.transformToArray(this.treeObj.getNodes()).find((function(n){return e===i.getEvaluatedData(n,{field:t.nodeid,bindExpression:t.bindnodeid},t.viewParent)}));n&&(this.treeObj.selectNode(n,!1),this.selectNode(void 0,n))},t.prototype.deselectById=function(e){this.selecteditem={},this.selectById()},t}(i.StylableComponent);d.initializeProps=c(),d.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(d)],encapsulation:t.ViewEncapsulation.None}]}],d.ctorParameters=function(){return[{type:t.Injector},{type:void 0,decorators:[{type:t.Attribute,args:["nodeid.bind"]}]}]};var h=[d],m=function(){};m.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:l([],s(h)),exports:l([],s(h)),entryComponents:[]}]}],e.TreeComponent=d,e.TreeModule=m,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,r,a){"use strict";
|
|
128
128
|
/*! *****************************************************************************
|
|
129
129
|
Copyright (c) Microsoft Corporation.
|
|
130
130
|
|