@wavemaker/app-runtime-wm-build 11.4.0-next.24576 → 11.4.0-next.24578

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.
@@ -13440,21 +13440,19 @@
13440
13440
  __proto__: null,
13441
13441
  default: search_build
13442
13442
  });
13443
- var tagName$1o = "div";
13443
+ var tagName$1o = "ul";
13444
13444
  transpiler.register("wm-tree", (function() {
13445
13445
  return {
13446
13446
  pre: function(attrs) {
13447
- return "<" + tagName$1o + " wmTree " + transpiler.getAttrMarkup(attrs) + ">";
13447
+ return "<" + tagName$1o + ' wmTree class="ztree" ' + transpiler.getAttrMarkup(attrs) + ">";
13448
13448
  },
13449
13449
  post: function() {
13450
13450
  return "</" + tagName$1o + ">";
13451
13451
  }
13452
13452
  };
13453
13453
  }));
13454
- var tree_build = function() {};
13455
- var tree_build$1 = Object.freeze({
13456
- __proto__: null,
13457
- default: tree_build
13454
+ var tree_build = Object.freeze({
13455
+ __proto__: null
13458
13456
  });
13459
13457
  var tagName$1n = "div";
13460
13458
  transpiler.register("wm-card", (function() {
@@ -16435,7 +16433,7 @@
16435
16433
  exports.tileBuild = tile_build$1;
16436
16434
  exports.timeBuild = time_build$1;
16437
16435
  exports.topNavBuild = topNav_build$1;
16438
- exports.treeBuild = tree_build$1;
16436
+ exports.treeBuild = tree_build;
16439
16437
  exports.videoBuild = video_build$1;
16440
16438
  exports.wizardBuild = wizard_build$1;
16441
16439
  exports.wizardStepBuild = wizardStep_build$1;
@@ -22781,10 +22779,10 @@
22781
22779
  }));
22782
22780
 
22783
22781
  (function(global, factory) {
22784
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@angular/core"), require("@angular/common"), require("@wm/components/base"), require("@wm/core")) : typeof define === "function" && define.amd ? define("@wm/components/basic/tree", [ "exports", "@angular/core", "@angular/common", "@wm/components/base", "@wm/core" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
22782
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@angular/core"), require("@angular/common"), require("@wm/components/base")) : typeof define === "function" && define.amd ? define("@wm/components/basic/tree", [ "exports", "@angular/core", "@angular/common", "@wm/components/base" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
22785
22783
  factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {},
22786
- global.wm.components.basic = global.wm.components.basic || {}, global.wm.components.basic.tree = {}), global.ng.core, global.ng.common, global.wm.components.base, global.wm.core));
22787
- })(this, (function(exports, core$1, common, base, core) {
22784
+ global.wm.components.basic = global.wm.components.basic || {}, global.wm.components.basic.tree = {}), global.ng.core, global.ng.common, global.wm.components.base));
22785
+ })(this, (function(exports, core, common, base) {
22788
22786
  "use strict";
22789
22787
  /*! *****************************************************************************
22790
22788
  Copyright (c) Microsoft Corporation.
@@ -23161,352 +23159,333 @@
23161
23159
  value: 0
23162
23160
  }, base.PROP_NUMBER) ], [ "treeicons", base.PROP_STRING ] ]));
23163
23161
  };
23164
- var defaultTreeIconClass = "plus-minus";
23165
- var ICON_CLASSES = {
23166
- folder: {
23167
- expanded: "wi-folder-open",
23168
- collapsed: "wi-folder"
23169
- },
23170
- "circle-plus-minus": {
23171
- expanded: "wi-remove-circle-outline",
23172
- collapsed: "wi-add-circle-outline"
23173
- },
23174
- chevron: {
23175
- expanded: "wi-keyboard-arrow-down",
23176
- collapsed: "wi-keyboard-arrow-right"
23177
- },
23178
- menu: {
23179
- expanded: "wi-arrow-down",
23180
- collapsed: "wi-arrow-right"
23181
- },
23182
- triangle: {
23183
- expanded: "wi-arrow-drop-down-circle",
23184
- collapsed: "wi-play-circle-filled"
23185
- },
23186
- "expand-collapse": {
23187
- expanded: "wi-expand-less",
23188
- collapsed: "wi-expand-more"
23189
- },
23190
- "plus-minus": {
23191
- expanded: "wi-minus",
23192
- collapsed: "wi-plus"
23193
- }
23194
- };
23195
23162
  var WIDGET_INFO = {
23196
23163
  widgetType: "wm-tree",
23197
23164
  hostClass: "app-tree"
23198
23165
  };
23199
- var TreeDirective = function(_super) {
23200
- __extends(TreeDirective, _super);
23201
- function TreeDirective(inj, binddatavalue, bindnodelabel, bindnodeicon, bindnodechildren, bindnodeid) {
23166
+ var defaultTreeIconClass = "plus-minus";
23167
+ var TreeComponent = function(_super) {
23168
+ __extends(TreeComponent, _super);
23169
+ function TreeComponent(inj) {
23202
23170
  var _this = _super.call(this, inj, WIDGET_INFO) || this;
23203
- _this.binddatavalue = binddatavalue;
23204
- _this.bindnodelabel = bindnodelabel;
23205
- _this.bindnodeicon = bindnodeicon;
23206
- _this.bindnodechildren = bindnodechildren;
23207
- _this.bindnodeid = bindnodeid;
23171
+ _this.setting = {
23172
+ data: {
23173
+ simpleData: {
23174
+ enable: true
23175
+ }
23176
+ },
23177
+ view: {
23178
+ dblClickExpand: false,
23179
+ fontCss: {
23180
+ "font-awesome": true
23181
+ },
23182
+ switchIcon: {}
23183
+ },
23184
+ check: {},
23185
+ callback: {}
23186
+ };
23208
23187
  base.styler(_this.nativeElement, _this, base.APPLY_STYLES_TYPE.CONTAINER);
23209
- _this.bindEvents();
23210
23188
  return _this;
23211
23189
  }
23212
- TreeDirective.prototype.onPropertyChange = function(key, nv, ov) {
23190
+ TreeComponent.prototype.onPropertyChange = function(key, nv, ov) {
23213
23191
  switch (key) {
23214
23192
  case "dataset":
23215
23193
  this.nodes = this.getNodes(nv);
23216
- this._selectNode = undefined;
23194
+ if (this.level > 0) {
23195
+ this.expandTree(this.level, this.nodes, 0);
23196
+ }
23217
23197
  this.renderTree();
23218
23198
  break;
23219
23199
 
23220
- case "nodeicon":
23221
- case "nodelabel":
23222
- case "nodechildren":
23223
- case "orderby":
23224
- this.renderTree();
23200
+ case "levels":
23201
+ if (nv > 0) {
23202
+ this.level = nv;
23203
+ }
23225
23204
  break;
23226
23205
 
23227
23206
  case "treeicons":
23228
- this.changeTreeIcons(nv, ov);
23207
+ this.treeicon = nv;
23229
23208
  break;
23230
23209
 
23231
- case "datavalue":
23232
- this.selectById(nv);
23210
+ case "nodelabel":
23211
+ this.nodelabel = nv;
23212
+ break;
23213
+
23214
+ case "icon":
23215
+ this.nodeicon = nv;
23216
+
23217
+ case "orderby":
23218
+ this.renderTree();
23219
+ break;
23220
+
23221
+ case "class":
23222
+ this.treeClass = nv;
23233
23223
  break;
23234
23224
 
23235
23225
  default:
23236
23226
  _super.prototype.onPropertyChange.call(this, key, nv, ov);
23227
+ break;
23237
23228
  }
23238
23229
  };
23239
- TreeDirective.prototype.constructNodes = function(nodes, parent, levels, deep, _evalDataValue) {
23230
+ TreeComponent.prototype.expandTree = function(level, node, childLevel) {
23240
23231
  var _this = this;
23241
- var $ul = $("<ul></ul>");
23242
- var _iconClses = ICON_CLASSES[this.treeicons || defaultTreeIconClass];
23243
- var _expr = this.binddatavalue || this.datavalue;
23244
- var _iconCls, _cls;
23245
- _cls = levels > 0 ? " expanded " : " collapsed ";
23246
- _iconCls = _cls + (levels > 0 ? _iconClses.expanded : _iconClses.collapsed);
23247
- deep = deep || 0;
23248
- parent.append($ul);
23249
- nodes.forEach((function(node, idx) {
23250
- var $li = $("<li></li>"), $iconNode = $("<i></i>"), nodeLabel = base.getEvaluatedData(node, {
23251
- field: _this.nodelabel,
23252
- bindExpression: _this.bindnodelabel
23253
- }, _this.viewParent) || node.label, nodeIcon = base.getEvaluatedData(node, {
23254
- field: _this.nodeicon,
23255
- bindExpression: _this.bindnodeicon
23256
- }, _this.viewParent) || node.icon, nodeChildren = base.getEvaluatedData(node, {
23257
- field: _this.nodechildren,
23258
- bindExpression: _this.bindnodechildren
23259
- }, _this.viewParent) || node.children;
23260
- var nodeIdValue = base.getEvaluatedData(node, {
23261
- field: _this.nodeid,
23262
- bindExpression: _this.bindnodeid
23263
- }, _this.viewParent);
23264
- if (nodeIdValue === undefined) {
23265
- nodeIdValue = node.children;
23266
- }
23267
- var isNodeMatched = false, expandCollapseIcon;
23268
- $li.data("nodedata", node).append($iconNode).append('<span class="title">' + nodeLabel + "</span>").appendTo($ul);
23269
- if (_this.bindnodeid || _this.nodeid) {
23270
- isNodeMatched = _this.binddatavalue ? nodeIdValue === _evalDataValue : nodeIdValue === _expr;
23271
- if (nodeIdValue !== undefined) {
23272
- $li.attr("id", nodeIdValue);
23273
- }
23274
- } else if (_this.binddatavalue) {
23275
- isNodeMatched = !!core.$parseExpr(_expr)(_this, node);
23276
- }
23277
- if (!_this._selectNode) {
23278
- if (_expr === "FirstNode" && idx === 0 || !deep && _expr === "LastNode" && idx === nodes.length - 1 || isNodeMatched) {
23279
- _this._selectNode = $li;
23280
- _this.datavalue = nodeIdValue;
23281
- }
23282
- }
23283
- if (nodeIcon) {
23284
- $iconNode.addClass(nodeIcon);
23285
- }
23286
- if (nodeChildren && nodeChildren.length) {
23287
- $li.addClass("parent-node " + _cls);
23288
- expandCollapseIcon = $('<i class="wi ' + _iconCls + '"></i>');
23289
- if (nodeIcon) {
23290
- $iconNode.addClass(nodeIcon);
23291
- }
23292
- $li.prepend(expandCollapseIcon);
23293
- _this.constructNodes(nodeChildren, $li, levels - 1, deep + 1, _evalDataValue);
23232
+ node.map((function(childNode) {
23233
+ if ("children" in childNode && !("open" in childNode) && childLevel < level) {
23234
+ childNode["open"] = true;
23235
+ _this.expandTree(level, childNode.children, childLevel + 1);
23294
23236
  } else {
23295
- if (!nodeIcon) {
23296
- $iconNode.addClass("leaf-node");
23297
- }
23298
- $li.addClass("leaf-node");
23237
+ childLevel = 0;
23238
+ return;
23299
23239
  }
23300
23240
  }));
23301
23241
  };
23302
- TreeDirective.prototype.getNodesFromString = function(value) {
23242
+ TreeComponent.prototype.setTreeTemplate = function(value) {
23243
+ if (value === "Classic") {
23244
+ this.setting.check["enable"] = false;
23245
+ } else if (value === "Checkbox") {
23246
+ this.setting.check["enable"] = true;
23247
+ this.setting.check["chkStyle"] = "checkbox";
23248
+ } else if (value === "Radio") {
23249
+ this.setting.check["enable"] = true;
23250
+ this.setting.check["chkStyle"] = "radio";
23251
+ this.setting.check["radioType"] = "all";
23252
+ }
23253
+ };
23254
+ TreeComponent.prototype.getNodesFromString = function(value) {
23303
23255
  return value.split(",").map((function(item) {
23304
23256
  return {
23305
- label: item && item.trim()
23257
+ name: item && item.trim()
23306
23258
  };
23307
23259
  }));
23308
23260
  };
23309
- TreeDirective.prototype.getNodes = function(newVal) {
23261
+ TreeComponent.prototype.getNodes = function(newVal) {
23310
23262
  var nodes;
23311
- if (_.isString(newVal) && !_.isEmpty(newVal)) {
23263
+ if (_.isArray(newVal)) {
23264
+ nodes = base.getOrderedDataset(newVal, this.orderby);
23265
+ } else if (_.isObject(newVal)) {
23266
+ nodes = [ newVal ];
23267
+ } else if (_.isString(newVal) && !_.isEmpty(newVal)) {
23312
23268
  newVal = newVal.trim();
23313
23269
  if (newVal) {
23314
23270
  nodes = this.getNodesFromString(newVal);
23315
23271
  }
23316
- } else if (_.isArray(newVal)) {
23317
- newVal = base.getOrderedDataset(newVal, this.orderby);
23318
- nodes = newVal;
23319
- } else if (_.isObject(newVal)) {
23320
- nodes = [ newVal ];
23321
23272
  }
23322
23273
  return nodes;
23323
23274
  };
23324
- TreeDirective.prototype.changeTreeIcons = function(nv, ov) {
23325
- var $el = $(this.nativeElement);
23326
- nv = nv || defaultTreeIconClass;
23327
- ov = ov || defaultTreeIconClass;
23328
- $el.find("i.expanded").removeClass(ICON_CLASSES[ov].expanded).addClass(ICON_CLASSES[nv].expanded);
23329
- $el.find("i.collapsed").removeClass(ICON_CLASSES[ov].collapsed).addClass(ICON_CLASSES[nv].collapsed);
23330
- };
23331
- TreeDirective.prototype.toggleExpandCollapseNode = function($event, $i, $li) {
23332
- var treeIcons = ICON_CLASSES[this.treeicons || defaultTreeIconClass];
23333
- var $liPath = this.findSelectedNodeParent($li);
23334
- var path = "";
23335
- $liPath.each((function(i, el) {
23336
- var current = $(el).children(".title").text();
23337
- path = "/" + (current + path);
23338
- }));
23339
- var eventParams = {
23340
- $event: $event,
23341
- $item: $li.data("nodedata"),
23342
- $path: path
23343
- };
23344
- if ($i.hasClass("collapsed")) {
23345
- $i.removeClass("collapsed " + treeIcons.collapsed).addClass("expanded " + treeIcons.expanded);
23346
- $li.removeClass("collapsed").addClass("expanded");
23347
- this.invokeEventCallback("expand", eventParams);
23348
- } else if ($i.hasClass("expanded")) {
23349
- $i.removeClass("expanded " + treeIcons.expanded).addClass("collapsed " + treeIcons.collapsed);
23350
- $li.removeClass("expanded").addClass("collapsed");
23351
- this.invokeEventCallback("collapse", eventParams);
23352
- }
23275
+ TreeComponent.prototype.setNodeclasses = function(treeId, treeNode) {
23276
+ return treeNode.icon ? {
23277
+ add: [ "" + treeNode.icon ]
23278
+ } : "";
23353
23279
  };
23354
- TreeDirective.prototype.renderTree = function(forceRender) {
23280
+ TreeComponent.prototype.setNodeData = function(nodes, depth, level, parentNode, type) {
23355
23281
  var _this = this;
23356
- var docFrag, $li, $liPath, data, path = "";
23357
- var levels = +this.nativeElement.getAttribute("levels") || 0, $el = $(this.nativeElement);
23358
- $el.empty();
23359
- if (forceRender) {
23360
- this._selectNode = undefined;
23361
- }
23362
- if (this.nodes && this.nodes.length) {
23363
- docFrag = document.createDocumentFragment();
23364
- this.constructNodes(this.nodes, $(docFrag), levels, 0, this.datavalue);
23365
- $el.append(docFrag);
23366
- }
23367
- if (this._selectNode) {
23368
- $li = this._selectNode;
23369
- $li.addClass("selected");
23370
- data = $li.data("nodedata");
23371
- $liPath = this.findSelectedNodeParent($li);
23372
- if (!$liPath.length) {
23373
- $liPath = $li;
23374
- }
23375
- $liPath.each((function(i, el) {
23376
- var $current = $(el), $i = $current.children("i.collapsed"), $title = $current.children(".title");
23377
- _this.toggleExpandCollapseNode(undefined, $i, $current);
23378
- path = "/" + ($title.text() + path);
23282
+ if (depth === 0) {
23283
+ nodes.map((function(node) {
23284
+ if (node.children) {
23285
+ _this.setNodeData(node.children, depth, level, parentNode, type);
23286
+ }
23287
+ if (node.icon && _this.nodelabel == "icon") {
23288
+ node[type] = node.icon;
23289
+ } else if (node.name && _this.nodelabel == "name") {
23290
+ node[type] = node.name;
23291
+ } else {
23292
+ return;
23293
+ }
23294
+ }));
23295
+ } else {
23296
+ nodes.map((function(node) {
23297
+ if (node.children && level > 1) {
23298
+ if (depth === level) {
23299
+ parentNode = node;
23300
+ }
23301
+ _this.setNodeData(node.children, depth, level - 1, parentNode, type);
23302
+ }
23303
+ if (level === 1 && (type === "name" ? _this.nodelabel.includes("label") || _this.nodelabel.includes("name") : _this.nodeicon.includes("label") || _this.nodeicon.includes("name"))) {
23304
+ parentNode[type] = node.name || node.label;
23305
+ return;
23306
+ } else if (level === 1 && node.icon !== undefined && (type === "name" ? _this.nodelabel.includes("icon") : _this.nodeicon.includes("icon"))) {
23307
+ parentNode[type] = node.icon;
23308
+ return;
23309
+ } else {
23310
+ return;
23311
+ }
23379
23312
  }));
23380
- this.selecteditem = core.getClonedObject(data) || {};
23381
- this.selecteditem.path = path;
23382
- this.invokeEventCallback("select", {
23383
- $event: undefined,
23384
- $item: data,
23385
- $path: path
23386
- });
23387
- core.$appDigest();
23388
23313
  }
23389
23314
  };
23390
- TreeDirective.prototype.selectNode = function(evt, value) {
23391
- var _this = this;
23392
- var target = evt && $(evt.target), $el = $(this.nativeElement), $li = _.isObject(value) ? value : $el.find('li[id="' + value + '"]').first();
23393
- var data, path = "", $liPath, nodeAction;
23394
- $el.find(".selected").removeClass("selected");
23395
- if (!$li.length) {
23396
- return;
23397
- }
23398
- $li.addClass("selected");
23399
- data = $li.data("nodedata");
23400
- nodeAction = data[this.nodeaction || "action"];
23401
- $liPath = target ? target.parents(".app-tree li") : this.findSelectedNodeParent($li);
23402
- $liPath.each((function(i, el) {
23403
- var current = $(el).children(".title").text();
23404
- path = "/" + (current + path);
23405
- }));
23406
- $li.parentsUntil($el, "li.parent-node.collapsed").each((function(index, el) {
23407
- var $current = $(el), $i = $current.children("i.collapsed");
23408
- _this.toggleExpandCollapseNode(undefined, $i, $current);
23409
- }));
23410
- this.selecteditem = core.getClonedObject(data) || {};
23411
- this.selecteditem.path = path;
23412
- if (target) {
23413
- if (this.nodeid || this.bindnodeid) {
23414
- this.datavalue = base.getEvaluatedData(data, {
23415
- field: this.nodeid,
23416
- bindExpression: this.bindnodeid
23417
- }, this.viewParent);
23418
- } else {
23419
- this.datavalue = core.getClonedObject(data) || {};
23420
- }
23315
+ TreeComponent.prototype.changeTreeIcons = function(nv) {
23316
+ var eleClose = $('ul[name="' + this.name + '"] li span.button.switch');
23317
+ $(eleClose).map((function(idx, ele) {
23318
+ $(ele).addClass(nv);
23319
+ $(ele).on("click", (function(e) {
23320
+ setTimeout((function() {
23321
+ $(ele).addClass(nv);
23322
+ }), 0);
23323
+ }));
23324
+ }));
23325
+ };
23326
+ TreeComponent.prototype.getPath = function(treeNode, path) {
23327
+ if (treeNode.getParentNode() === null) {
23328
+ path = "/" + treeNode.name + path;
23421
23329
  } else {
23422
- this.datavalue = value;
23330
+ path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode.name;
23423
23331
  }
23424
- if (nodeAction) {
23425
- core.$parseEvent(nodeAction)(this);
23332
+ return path;
23333
+ };
23334
+ TreeComponent.prototype.onClick = function(event, treeId, treeNode, clickFlag) {
23335
+ var treeObj = $.fn.zTree.getZTreeObj("" + this.name);
23336
+ if (this.nodeclick === "expand") {
23337
+ treeObj.expandNode(treeNode, treeNode.open ? false : true, false, true);
23338
+ this.changeTreeIcons(this.treeicon || defaultTreeIconClass);
23339
+ var path = this.getPath(treeNode, "");
23340
+ var eventParams = {
23341
+ $event: event,
23342
+ $item: treeNode,
23343
+ $path: path
23344
+ };
23345
+ this.invokeEventCallback("select", eventParams);
23346
+ if (treeNode.open) {} else {
23347
+ this.invokeEventCallback("collapse", eventParams);
23348
+ }
23426
23349
  }
23427
- this.invokeEventCallback("select", {
23428
- $event: evt,
23429
- $item: data,
23430
- $path: path
23431
- });
23432
- core.$appDigest();
23433
23350
  };
23434
- TreeDirective.prototype.bindEvents = function() {
23351
+ TreeComponent.prototype.onExpand = function(event, treeId, treeNode) {
23352
+ var self = this;
23353
+ treeNode.children ? treeNode.children.map((function(el) {
23354
+ if (el.isParent) {
23355
+ var ele_1 = $("#" + el.tId + "_switch");
23356
+ $(ele_1).addClass(self.treeicon || defaultTreeIconClass);
23357
+ $(ele_1).on("click", (function(e) {
23358
+ setTimeout((function() {
23359
+ $(ele_1).addClass(self.treeicon || defaultTreeIconClass);
23360
+ }), 0);
23361
+ }));
23362
+ }
23363
+ })) : "";
23364
+ };
23365
+ TreeComponent.prototype.modifyObjects = function(array) {
23435
23366
  var _this = this;
23436
- $(this.nativeElement).on("click", (function(evt) {
23437
- var target = $(evt.target), li = target.closest("li"), $i = target.is("i") ? target : target.siblings("i.collapsed,i.expanded");
23438
- evt.stopPropagation();
23439
- if (target.is("span.title")) {
23440
- _this.selecteditem = {};
23441
- _this.selectNode(evt, li);
23367
+ array.forEach((function(obj) {
23368
+ if (obj.label !== undefined) {
23369
+ obj.name = obj.label;
23370
+ delete obj.label;
23442
23371
  }
23443
- if (target.is("i") || target.is("span.title") && _this.nodeclick === "expand") {
23444
- _this.toggleExpandCollapseNode(evt, $i, li);
23372
+ if (obj.children !== undefined) {
23373
+ _this.modifyObjects(obj.children);
23445
23374
  }
23446
23375
  }));
23376
+ return array;
23447
23377
  };
23448
- TreeDirective.prototype.findSelectedNodeParent = function($li) {
23449
- return $li.find("> span.title").parents(".app-tree li");
23378
+ TreeComponent.prototype.setNodeChildren = function(nodes, depth, level, parentNode) {
23379
+ if (depth <= 0) {
23380
+ return nodes;
23381
+ }
23382
+ for (var i = 0; i < nodes.length; i++) {
23383
+ var node = nodes[i];
23384
+ if (depth === level) {
23385
+ parentNode = nodes[i];
23386
+ }
23387
+ if (node.children && node.children.length > 0) {
23388
+ if (level === 1) {
23389
+ parentNode.children = node.children.map((function(child) {
23390
+ return {
23391
+ name: child.name,
23392
+ children: child === null || child === void 0 ? void 0 : child.children
23393
+ };
23394
+ }));
23395
+ return;
23396
+ } else {
23397
+ this.setNodeChildren(node.children, depth, level - 1, parentNode);
23398
+ }
23399
+ }
23400
+ }
23401
+ return nodes;
23402
+ };
23403
+ TreeComponent.prototype.countDepth = function(str) {
23404
+ var e_1, _a;
23405
+ var regex = /\[.*?\]/g;
23406
+ var matches = str.match(regex);
23407
+ var count = 1;
23408
+ if (matches === null) return count;
23409
+ try {
23410
+ for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
23411
+ var match = matches_1_1.value;
23412
+ count++;
23413
+ }
23414
+ } catch (e_1_1) {
23415
+ e_1 = {
23416
+ error: e_1_1
23417
+ };
23418
+ } finally {
23419
+ try {
23420
+ if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
23421
+ } finally {
23422
+ if (e_1) throw e_1.error;
23423
+ }
23424
+ }
23425
+ return count;
23450
23426
  };
23451
- TreeDirective.prototype.selectById = function(value) {
23452
- this.selectNode(undefined, value);
23427
+ TreeComponent.prototype.renderTree = function() {
23428
+ if (this.nodes) {
23429
+ this.nativeElement.setAttribute("id", this.name);
23430
+ this.nodes = this.modifyObjects(this.nodes);
23431
+ this.setTreeTemplate(this.treeClass);
23432
+ if (this.nodelabel) {
23433
+ var depth = 0;
23434
+ if (this.nodelabel.includes("children")) {
23435
+ depth = this.countDepth(this.nodelabel);
23436
+ }
23437
+ this.setNodeData(this.nodes, depth, depth, null, "name");
23438
+ }
23439
+ if (this.nodeicon) {
23440
+ var depth = 0;
23441
+ if (this.nodeicon.includes("children")) {
23442
+ depth = this.countDepth(this.nodeicon);
23443
+ }
23444
+ this.setNodeData(this.nodes, depth, depth, null, "icon");
23445
+ }
23446
+ if (this.nodechildren) {
23447
+ var depth = this.countDepth(this.nodechildren);
23448
+ if (depth > 1) {
23449
+ this.nodes = this.setNodeChildren(this.nodes, depth, depth, null);
23450
+ }
23451
+ }
23452
+ }
23453
+ this.setting.view["nodeClasses"] = this.setNodeclasses;
23454
+ this.setting.callback["onClick"] = this.onClick.bind(this);
23455
+ this.setting.callback["onExpand"] = this.onExpand.bind(this);
23456
+ var zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.nodes);
23457
+ $.fn.zTreeKeyboardNavigation(zTree, $('ul[name="' + this.name + '"]'), null, this.treeicon || defaultTreeIconClass);
23453
23458
  };
23454
- TreeDirective.prototype.deselectById = function(value) {
23455
- this.selecteditem = {};
23456
- this.selectById();
23459
+ TreeComponent.prototype.ngAfterViewInit = function() {
23460
+ var _this = this;
23461
+ setTimeout((function() {
23462
+ _this.changeTreeIcons(_this.treeicon || defaultTreeIconClass);
23463
+ }), 200);
23457
23464
  };
23458
- return TreeDirective;
23465
+ return TreeComponent;
23459
23466
  }(base.StylableComponent);
23460
- TreeDirective.initializeProps = registerProps();
23461
- TreeDirective.decorators = [ {
23462
- type: core$1.Directive,
23467
+ TreeComponent.initializeProps = registerProps();
23468
+ TreeComponent.decorators = [ {
23469
+ type: core.Component,
23463
23470
  args: [ {
23464
- selector: "div[wmTree]",
23465
- providers: [ base.provideAsWidgetRef(TreeDirective) ]
23471
+ selector: "ul[wmTree]",
23472
+ template: '<ul #wmTree class="ztree" id="ztree"></ul> ',
23473
+ providers: [ base.provideAsWidgetRef(TreeComponent) ],
23474
+ encapsulation: core.ViewEncapsulation.None
23466
23475
  } ]
23467
23476
  } ];
23468
- TreeDirective.ctorParameters = function() {
23477
+ TreeComponent.ctorParameters = function() {
23469
23478
  return [ {
23470
- type: core$1.Injector
23471
- }, {
23472
- type: undefined,
23473
- decorators: [ {
23474
- type: core$1.Attribute,
23475
- args: [ "datavalue.bind" ]
23476
- } ]
23477
- }, {
23478
- type: undefined,
23479
- decorators: [ {
23480
- type: core$1.Attribute,
23481
- args: [ "nodelabel.bind" ]
23482
- } ]
23483
- }, {
23484
- type: undefined,
23485
- decorators: [ {
23486
- type: core$1.Attribute,
23487
- args: [ "nodeicon.bind" ]
23488
- } ]
23489
- }, {
23490
- type: undefined,
23491
- decorators: [ {
23492
- type: core$1.Attribute,
23493
- args: [ "nodechildren.bind" ]
23494
- } ]
23495
- }, {
23496
- type: undefined,
23497
- decorators: [ {
23498
- type: core$1.Attribute,
23499
- args: [ "nodeid.bind" ]
23500
- } ]
23479
+ type: core.Injector
23501
23480
  } ];
23502
23481
  };
23503
- var components = [ TreeDirective ];
23482
+ var components = [ TreeComponent ];
23504
23483
  var TreeModule = function() {
23505
23484
  function TreeModule() {}
23506
23485
  return TreeModule;
23507
23486
  }();
23508
23487
  TreeModule.decorators = [ {
23509
- type: core$1.NgModule,
23488
+ type: core.NgModule,
23510
23489
  args: [ {
23511
23490
  imports: [ common.CommonModule, base.WmComponentsModule ],
23512
23491
  declarations: __spreadArray([], __read(components)),
@@ -23514,7 +23493,7 @@
23514
23493
  entryComponents: []
23515
23494
  } ]
23516
23495
  } ];
23517
- exports.TreeDirective = TreeDirective;
23496
+ exports.TreeComponent = TreeComponent;
23518
23497
  exports.TreeModule = TreeModule;
23519
23498
  exports["\u0275a"] = registerProps;
23520
23499
  Object.defineProperty(exports, "__esModule", {