tree.js 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984
  1. "use strict";
  2. var __assign = (this && this.__assign) || function () {
  3. __assign = Object.assign || function(t) {
  4. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5. s = arguments[i];
  6. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  7. t[p] = s[p];
  8. }
  9. return t;
  10. };
  11. return __assign.apply(this, arguments);
  12. };
  13. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  14. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  15. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  16. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  17. return c > 3 && r && Object.defineProperty(target, key, r), r;
  18. };
  19. var __metadata = (this && this.__metadata) || function (k, v) {
  20. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  21. };
  22. var __param = (this && this.__param) || function (paramIndex, decorator) {
  23. return function (target, key) { decorator(target, key, paramIndex); }
  24. };
  25. Object.defineProperty(exports, "__esModule", { value: true });
  26. var core_1 = require("@angular/core");
  27. var core_2 = require("@angular/core");
  28. var common_1 = require("@angular/common");
  29. var shared_1 = require("../common/shared");
  30. var shared_2 = require("../common/shared");
  31. var treedragdropservice_1 = require("../common/treedragdropservice");
  32. var objectutils_1 = require("../utils/objectutils");
  33. var api_1 = require("../common/api");
  34. var UITreeNode = /** @class */ (function () {
  35. function UITreeNode(tree) {
  36. this.tree = tree;
  37. }
  38. UITreeNode_1 = UITreeNode;
  39. UITreeNode.prototype.ngOnInit = function () {
  40. this.node.parent = this.parentNode;
  41. if (this.parentNode) {
  42. this.tree.syncNodeOption(this.node, this.tree.value, 'parent', this.tree.getNodeWithKey(this.parentNode.key, this.tree.value));
  43. }
  44. };
  45. UITreeNode.prototype.getIcon = function () {
  46. var icon;
  47. if (this.node.icon)
  48. icon = this.node.icon;
  49. else
  50. icon = this.node.expanded && this.node.children && this.node.children.length ? this.node.expandedIcon : this.node.collapsedIcon;
  51. return UITreeNode_1.ICON_CLASS + ' ' + icon;
  52. };
  53. UITreeNode.prototype.isLeaf = function () {
  54. return this.tree.isNodeLeaf(this.node);
  55. };
  56. UITreeNode.prototype.toggle = function (event) {
  57. if (this.node.expanded)
  58. this.collapse(event);
  59. else
  60. this.expand(event);
  61. };
  62. UITreeNode.prototype.expand = function (event) {
  63. this.node.expanded = true;
  64. this.tree.onNodeExpand.emit({ originalEvent: event, node: this.node });
  65. };
  66. UITreeNode.prototype.collapse = function (event) {
  67. this.node.expanded = false;
  68. this.tree.onNodeCollapse.emit({ originalEvent: event, node: this.node });
  69. };
  70. UITreeNode.prototype.onNodeClick = function (event) {
  71. this.tree.onNodeClick(event, this.node);
  72. };
  73. UITreeNode.prototype.onNodeTouchEnd = function () {
  74. this.tree.onNodeTouchEnd();
  75. };
  76. UITreeNode.prototype.onNodeRightClick = function (event) {
  77. this.tree.onNodeRightClick(event, this.node);
  78. };
  79. UITreeNode.prototype.isSelected = function () {
  80. return this.tree.isSelected(this.node);
  81. };
  82. UITreeNode.prototype.onDropPoint = function (event, position) {
  83. var _this = this;
  84. event.preventDefault();
  85. var dragNode = this.tree.dragNode;
  86. var dragNodeIndex = this.tree.dragNodeIndex;
  87. var dragNodeScope = this.tree.dragNodeScope;
  88. var isValidDropPointIndex = this.tree.dragNodeTree === this.tree ? (position === 1 || dragNodeIndex !== this.index - 1) : true;
  89. if (this.tree.allowDrop(dragNode, this.node, dragNodeScope) && isValidDropPointIndex) {
  90. if (this.tree.validateDrop) {
  91. this.tree.onNodeDrop.emit({
  92. originalEvent: event,
  93. dragNode: dragNode,
  94. dropNode: this.node,
  95. dropIndex: this.index,
  96. accept: function () {
  97. _this.processPointDrop(dragNode, dragNodeIndex, position);
  98. }
  99. });
  100. }
  101. else {
  102. this.processPointDrop(dragNode, dragNodeIndex, position);
  103. this.tree.onNodeDrop.emit({
  104. originalEvent: event,
  105. dragNode: dragNode,
  106. dropNode: this.node,
  107. dropIndex: this.index
  108. });
  109. }
  110. }
  111. this.draghoverPrev = false;
  112. this.draghoverNext = false;
  113. };
  114. UITreeNode.prototype.processPointDrop = function (dragNode, dragNodeIndex, position) {
  115. var newNodeList = this.node.parent ? this.node.parent.children : this.tree.value;
  116. this.tree.dragNodeSubNodes.splice(dragNodeIndex, 1);
  117. var dropIndex = this.index;
  118. if (position < 0) {
  119. dropIndex = (this.tree.dragNodeSubNodes === newNodeList) ? ((this.tree.dragNodeIndex > this.index) ? this.index : this.index - 1) : this.index;
  120. newNodeList.splice(dropIndex, 0, dragNode);
  121. }
  122. else {
  123. dropIndex = newNodeList.length;
  124. newNodeList.push(dragNode);
  125. }
  126. this.tree.dragDropService.stopDrag({
  127. node: dragNode,
  128. subNodes: this.node.parent ? this.node.parent.children : this.tree.value,
  129. index: dragNodeIndex
  130. });
  131. };
  132. UITreeNode.prototype.onDropPointDragOver = function (event) {
  133. event.dataTransfer.dropEffect = 'move';
  134. event.preventDefault();
  135. };
  136. UITreeNode.prototype.onDropPointDragEnter = function (event, position) {
  137. if (this.tree.allowDrop(this.tree.dragNode, this.node, this.tree.dragNodeScope)) {
  138. if (position < 0)
  139. this.draghoverPrev = true;
  140. else
  141. this.draghoverNext = true;
  142. }
  143. };
  144. UITreeNode.prototype.onDropPointDragLeave = function (event) {
  145. this.draghoverPrev = false;
  146. this.draghoverNext = false;
  147. };
  148. UITreeNode.prototype.onDragStart = function (event) {
  149. if (this.tree.draggableNodes && this.node.draggable !== false) {
  150. event.dataTransfer.setData("text", "data");
  151. this.tree.dragDropService.startDrag({
  152. tree: this,
  153. node: this.node,
  154. subNodes: this.node.parent ? this.node.parent.children : this.tree.value,
  155. index: this.index,
  156. scope: this.tree.draggableScope
  157. });
  158. }
  159. else {
  160. event.preventDefault();
  161. }
  162. };
  163. UITreeNode.prototype.onDragStop = function (event) {
  164. this.tree.dragDropService.stopDrag({
  165. node: this.node,
  166. subNodes: this.node.parent ? this.node.parent.children : this.tree.value,
  167. index: this.index
  168. });
  169. };
  170. UITreeNode.prototype.onDropNodeDragOver = function (event) {
  171. event.dataTransfer.dropEffect = 'move';
  172. if (this.tree.droppableNodes) {
  173. event.preventDefault();
  174. event.stopPropagation();
  175. }
  176. };
  177. UITreeNode.prototype.onDropNode = function (event) {
  178. var _this = this;
  179. if (this.tree.droppableNodes && this.node.droppable !== false) {
  180. event.preventDefault();
  181. event.stopPropagation();
  182. var dragNode_1 = this.tree.dragNode;
  183. if (this.tree.allowDrop(dragNode_1, this.node, this.tree.dragNodeScope)) {
  184. if (this.tree.validateDrop) {
  185. this.tree.onNodeDrop.emit({
  186. originalEvent: event,
  187. dragNode: dragNode_1,
  188. dropNode: this.node,
  189. index: this.index,
  190. accept: function () {
  191. _this.processNodeDrop(dragNode_1);
  192. }
  193. });
  194. }
  195. else {
  196. this.processNodeDrop(dragNode_1);
  197. this.tree.onNodeDrop.emit({
  198. originalEvent: event,
  199. dragNode: dragNode_1,
  200. dropNode: this.node,
  201. index: this.index
  202. });
  203. }
  204. }
  205. }
  206. this.draghoverNode = false;
  207. };
  208. UITreeNode.prototype.processNodeDrop = function (dragNode) {
  209. var dragNodeIndex = this.tree.dragNodeIndex;
  210. this.tree.dragNodeSubNodes.splice(dragNodeIndex, 1);
  211. if (this.node.children)
  212. this.node.children.push(dragNode);
  213. else
  214. this.node.children = [dragNode];
  215. this.tree.dragDropService.stopDrag({
  216. node: dragNode,
  217. subNodes: this.node.parent ? this.node.parent.children : this.tree.value,
  218. index: this.tree.dragNodeIndex
  219. });
  220. };
  221. UITreeNode.prototype.onDropNodeDragEnter = function (event) {
  222. if (this.tree.droppableNodes && this.node.droppable !== false && this.tree.allowDrop(this.tree.dragNode, this.node, this.tree.dragNodeScope)) {
  223. this.draghoverNode = true;
  224. }
  225. };
  226. UITreeNode.prototype.onDropNodeDragLeave = function (event) {
  227. if (this.tree.droppableNodes) {
  228. var rect = event.currentTarget.getBoundingClientRect();
  229. if (event.x > rect.left + rect.width || event.x < rect.left || event.y >= Math.floor(rect.top + rect.height) || event.y < rect.top) {
  230. this.draghoverNode = false;
  231. }
  232. }
  233. };
  234. UITreeNode.prototype.onKeyDown = function (event) {
  235. var nodeElement = event.target.parentElement.parentElement;
  236. if (nodeElement.nodeName !== 'P-TREENODE') {
  237. return;
  238. }
  239. switch (event.which) {
  240. //down arrow
  241. case 40:
  242. var listElement = (this.tree.droppableNodes) ? nodeElement.children[1].children[1] : nodeElement.children[0].children[1];
  243. if (listElement && listElement.children.length > 0) {
  244. this.focusNode(listElement.children[0]);
  245. }
  246. else {
  247. var nextNodeElement = nodeElement.nextElementSibling;
  248. if (nextNodeElement) {
  249. this.focusNode(nextNodeElement);
  250. }
  251. else {
  252. var nextSiblingAncestor = this.findNextSiblingOfAncestor(nodeElement);
  253. if (nextSiblingAncestor) {
  254. this.focusNode(nextSiblingAncestor);
  255. }
  256. }
  257. }
  258. event.preventDefault();
  259. break;
  260. //up arrow
  261. case 38:
  262. if (nodeElement.previousElementSibling) {
  263. this.focusNode(this.findLastVisibleDescendant(nodeElement.previousElementSibling));
  264. }
  265. else {
  266. var parentNodeElement = this.getParentNodeElement(nodeElement);
  267. if (parentNodeElement) {
  268. this.focusNode(parentNodeElement);
  269. }
  270. }
  271. event.preventDefault();
  272. break;
  273. //right arrow
  274. case 39:
  275. if (!this.node.expanded) {
  276. this.expand(event);
  277. }
  278. event.preventDefault();
  279. break;
  280. //left arrow
  281. case 37:
  282. if (this.node.expanded) {
  283. this.collapse(event);
  284. }
  285. else {
  286. var parentNodeElement = this.getParentNodeElement(nodeElement);
  287. if (parentNodeElement) {
  288. this.focusNode(parentNodeElement);
  289. }
  290. }
  291. event.preventDefault();
  292. break;
  293. //enter
  294. case 13:
  295. this.tree.onNodeClick(event, this.node);
  296. event.preventDefault();
  297. break;
  298. default:
  299. //no op
  300. break;
  301. }
  302. };
  303. UITreeNode.prototype.findNextSiblingOfAncestor = function (nodeElement) {
  304. var parentNodeElement = this.getParentNodeElement(nodeElement);
  305. if (parentNodeElement) {
  306. if (parentNodeElement.nextElementSibling)
  307. return parentNodeElement.nextElementSibling;
  308. else
  309. return this.findNextSiblingOfAncestor(parentNodeElement);
  310. }
  311. else {
  312. return null;
  313. }
  314. };
  315. UITreeNode.prototype.findLastVisibleDescendant = function (nodeElement) {
  316. var childrenListElement = nodeElement.children[0].children[1];
  317. if (childrenListElement && childrenListElement.children.length > 0) {
  318. var lastChildElement = childrenListElement.children[childrenListElement.children.length - 1];
  319. return this.findLastVisibleDescendant(lastChildElement);
  320. }
  321. else {
  322. return nodeElement;
  323. }
  324. };
  325. UITreeNode.prototype.getParentNodeElement = function (nodeElement) {
  326. var parentNodeElement = nodeElement.parentElement.parentElement.parentElement;
  327. return parentNodeElement.tagName === 'P-TREENODE' ? parentNodeElement : null;
  328. };
  329. UITreeNode.prototype.focusNode = function (element) {
  330. if (this.tree.droppableNodes)
  331. element.children[1].children[0].focus();
  332. else
  333. element.children[0].children[0].focus();
  334. };
  335. var UITreeNode_1;
  336. UITreeNode.ICON_CLASS = 'ui-treenode-icon ';
  337. __decorate([
  338. core_1.Input(),
  339. __metadata("design:type", Object)
  340. ], UITreeNode.prototype, "node", void 0);
  341. __decorate([
  342. core_1.Input(),
  343. __metadata("design:type", Object)
  344. ], UITreeNode.prototype, "parentNode", void 0);
  345. __decorate([
  346. core_1.Input(),
  347. __metadata("design:type", Boolean)
  348. ], UITreeNode.prototype, "root", void 0);
  349. __decorate([
  350. core_1.Input(),
  351. __metadata("design:type", Number)
  352. ], UITreeNode.prototype, "index", void 0);
  353. __decorate([
  354. core_1.Input(),
  355. __metadata("design:type", Boolean)
  356. ], UITreeNode.prototype, "firstChild", void 0);
  357. __decorate([
  358. core_1.Input(),
  359. __metadata("design:type", Boolean)
  360. ], UITreeNode.prototype, "lastChild", void 0);
  361. UITreeNode = UITreeNode_1 = __decorate([
  362. core_1.Component({
  363. selector: 'p-treeNode',
  364. template: "\n <ng-template [ngIf]=\"node\">\n <li *ngIf=\"tree.droppableNodes\" class=\"ui-treenode-droppoint\" [ngClass]=\"{'ui-treenode-droppoint-active ui-state-highlight':draghoverPrev}\"\n (drop)=\"onDropPoint($event,-1)\" (dragover)=\"onDropPointDragOver($event)\" (dragenter)=\"onDropPointDragEnter($event,-1)\" (dragleave)=\"onDropPointDragLeave($event)\"></li>\n <li *ngIf=\"!tree.horizontal\" role=\"treeitem\" [ngClass]=\"['ui-treenode',node.styleClass||'', isLeaf() ? 'ui-treenode-leaf': '']\">\n <div class=\"ui-treenode-content\" (click)=\"onNodeClick($event)\" (contextmenu)=\"onNodeRightClick($event)\" (touchend)=\"onNodeTouchEnd()\"\n (drop)=\"onDropNode($event)\" (dragover)=\"onDropNodeDragOver($event)\" (dragenter)=\"onDropNodeDragEnter($event)\" (dragleave)=\"onDropNodeDragLeave($event)\"\n [draggable]=\"tree.draggableNodes\" (dragstart)=\"onDragStart($event)\" (dragend)=\"onDragStop($event)\" tabIndex=\"0\"\n [ngClass]=\"{'ui-treenode-selectable':tree.selectionMode && node.selectable !== false,'ui-treenode-dragover':draghoverNode, 'ui-treenode-content-selected':isSelected()}\" \n (keydown)=\"onKeyDown($event)\" [attr.aria-posinset]=\"this.index + 1\" [attr.aria-expanded]=\"this.node.expanded\" [attr.aria-selected]=\"isSelected()\">\n <span class=\"ui-tree-toggler pi pi-fw ui-unselectable-text\" [ngClass]=\"{'pi-caret-right':!node.expanded,'pi-caret-down':node.expanded}\"\n (click)=\"toggle($event)\"></span\n ><div class=\"ui-chkbox\" *ngIf=\"tree.selectionMode == 'checkbox'\"><div class=\"ui-chkbox-box ui-widget ui-corner-all ui-state-default\" [ngClass]=\"{'ui-state-disabled': node.selectable === false}\">\n <span class=\"ui-chkbox-icon ui-clickable pi\"\n [ngClass]=\"{'pi-check':isSelected(),'pi-minus':node.partialSelected}\"></span></div></div\n ><span [class]=\"getIcon()\" *ngIf=\"node.icon||node.expandedIcon||node.collapsedIcon\"></span\n ><span class=\"ui-treenode-label ui-corner-all\"\n [ngClass]=\"{'ui-state-highlight':isSelected()}\">\n <span *ngIf=\"!tree.getTemplateForNode(node)\">{{node.label}}</span>\n <span *ngIf=\"tree.getTemplateForNode(node)\">\n <ng-container *ngTemplateOutlet=\"tree.getTemplateForNode(node); context: {$implicit: node}\"></ng-container>\n </span>\n </span>\n </div>\n <ul class=\"ui-treenode-children\" style=\"display: none;\" *ngIf=\"node.children && node.expanded\" [style.display]=\"node.expanded ? 'block' : 'none'\" role=\"group\">\n <p-treeNode *ngFor=\"let childNode of node.children;let firstChild=first;let lastChild=last; let index=index; trackBy: tree.nodeTrackBy\" [node]=\"childNode\" [parentNode]=\"node\"\n [firstChild]=\"firstChild\" [lastChild]=\"lastChild\" [index]=\"index\"></p-treeNode>\n </ul>\n </li>\n <li *ngIf=\"tree.droppableNodes&&lastChild\" class=\"ui-treenode-droppoint\" [ngClass]=\"{'ui-treenode-droppoint-active ui-state-highlight':draghoverNext}\"\n (drop)=\"onDropPoint($event,1)\" (dragover)=\"onDropPointDragOver($event)\" (dragenter)=\"onDropPointDragEnter($event,1)\" (dragleave)=\"onDropPointDragLeave($event)\"></li>\n <table *ngIf=\"tree.horizontal\" [class]=\"node.styleClass\">\n <tbody>\n <tr>\n <td class=\"ui-treenode-connector\" *ngIf=\"!root\">\n <table class=\"ui-treenode-connector-table\">\n <tbody>\n <tr>\n <td [ngClass]=\"{'ui-treenode-connector-line':!firstChild}\"></td>\n </tr>\n <tr>\n <td [ngClass]=\"{'ui-treenode-connector-line':!lastChild}\"></td>\n </tr>\n </tbody>\n </table>\n </td>\n <td class=\"ui-treenode\" [ngClass]=\"{'ui-treenode-collapsed':!node.expanded}\">\n <div class=\"ui-treenode-content ui-state-default ui-corner-all\"\n [ngClass]=\"{'ui-treenode-selectable':tree.selectionMode,'ui-state-highlight':isSelected()}\" (click)=\"onNodeClick($event)\" (contextmenu)=\"onNodeRightClick($event)\"\n (touchend)=\"onNodeTouchEnd()\">\n <span class=\"ui-tree-toggler pi pi-fw ui-unselectable-text\" [ngClass]=\"{'pi-plus':!node.expanded,'pi-minus':node.expanded}\" *ngIf=\"!isLeaf()\"\n (click)=\"toggle($event)\"></span\n ><span [class]=\"getIcon()\" *ngIf=\"node.icon||node.expandedIcon||node.collapsedIcon\"></span\n ><span class=\"ui-treenode-label ui-corner-all\">\n <span *ngIf=\"!tree.getTemplateForNode(node)\">{{node.label}}</span>\n <span *ngIf=\"tree.getTemplateForNode(node)\">\n <ng-container *ngTemplateOutlet=\"tree.getTemplateForNode(node); context: {$implicit: node}\"></ng-container>\n </span>\n </span>\n </div>\n </td>\n <td class=\"ui-treenode-children-container\" *ngIf=\"node.children && node.expanded\" [style.display]=\"node.expanded ? 'table-cell' : 'none'\">\n <div class=\"ui-treenode-children\">\n <p-treeNode *ngFor=\"let childNode of node.children;let firstChild=first;let lastChild=last; trackBy: tree.nodeTrackBy\" [node]=\"childNode\"\n [firstChild]=\"firstChild\" [lastChild]=\"lastChild\"></p-treeNode>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </ng-template>\n "
  365. }),
  366. __param(0, core_1.Inject(core_1.forwardRef(function () { return Tree; }))),
  367. __metadata("design:paramtypes", [Object])
  368. ], UITreeNode);
  369. return UITreeNode;
  370. }());
  371. exports.UITreeNode = UITreeNode;
  372. var Tree = /** @class */ (function () {
  373. function Tree(el, dragDropService) {
  374. this.el = el;
  375. this.dragDropService = dragDropService;
  376. this.selectionChange = new core_1.EventEmitter();
  377. this.onNodeSelect = new core_1.EventEmitter();
  378. this.onNodeUnselect = new core_1.EventEmitter();
  379. this.onNodeExpand = new core_1.EventEmitter();
  380. this.onNodeCollapse = new core_1.EventEmitter();
  381. this.onNodeContextMenuSelect = new core_1.EventEmitter();
  382. this.onNodeDrop = new core_1.EventEmitter();
  383. this.layout = 'vertical';
  384. this.metaKeySelection = true;
  385. this.propagateSelectionUp = true;
  386. this.propagateSelectionDown = true;
  387. this.loadingIcon = 'pi pi-spinner';
  388. this.emptyMessage = 'No records found';
  389. this.filterBy = 'label';
  390. this.filterMode = 'lenient';
  391. this.nodeTrackBy = function (index, item) { return item; };
  392. }
  393. Tree.prototype.ngOnInit = function () {
  394. var _this = this;
  395. if (this.droppableNodes) {
  396. this.dragStartSubscription = this.dragDropService.dragStart$.subscribe(function (event) {
  397. _this.dragNodeTree = event.tree;
  398. _this.dragNode = event.node;
  399. _this.dragNodeSubNodes = event.subNodes;
  400. _this.dragNodeIndex = event.index;
  401. _this.dragNodeScope = event.scope;
  402. });
  403. this.dragStopSubscription = this.dragDropService.dragStop$.subscribe(function (event) {
  404. _this.dragNodeTree = null;
  405. _this.dragNode = null;
  406. _this.dragNodeSubNodes = null;
  407. _this.dragNodeIndex = null;
  408. _this.dragNodeScope = null;
  409. _this.dragHover = false;
  410. });
  411. }
  412. };
  413. Object.defineProperty(Tree.prototype, "horizontal", {
  414. get: function () {
  415. return this.layout == 'horizontal';
  416. },
  417. enumerable: true,
  418. configurable: true
  419. });
  420. Tree.prototype.ngAfterContentInit = function () {
  421. var _this = this;
  422. if (this.templates.length) {
  423. this.templateMap = {};
  424. }
  425. this.templates.forEach(function (item) {
  426. _this.templateMap[item.name] = item.template;
  427. });
  428. };
  429. Tree.prototype.onNodeClick = function (event, node) {
  430. var eventTarget = event.target;
  431. if (api_1.DomHandler.hasClass(eventTarget, 'ui-tree-toggler')) {
  432. return;
  433. }
  434. else if (this.selectionMode) {
  435. if (node.selectable === false) {
  436. return;
  437. }
  438. if (this.hasFilteredNodes()) {
  439. node = this.getNodeWithKey(node.key, this.value);
  440. if (!node) {
  441. return;
  442. }
  443. }
  444. var index_1 = this.findIndexInSelection(node);
  445. var selected = (index_1 >= 0);
  446. if (this.isCheckboxSelectionMode()) {
  447. if (selected) {
  448. if (this.propagateSelectionDown)
  449. this.propagateDown(node, false);
  450. else
  451. this.selection = this.selection.filter(function (val, i) { return i != index_1; });
  452. if (this.propagateSelectionUp && node.parent) {
  453. this.propagateUp(node.parent, false);
  454. }
  455. this.selectionChange.emit(this.selection);
  456. this.onNodeUnselect.emit({ originalEvent: event, node: node });
  457. }
  458. else {
  459. if (this.propagateSelectionDown)
  460. this.propagateDown(node, true);
  461. else
  462. this.selection = (this.selection || []).concat([node]);
  463. if (this.propagateSelectionUp && node.parent) {
  464. this.propagateUp(node.parent, true);
  465. }
  466. this.selectionChange.emit(this.selection);
  467. this.onNodeSelect.emit({ originalEvent: event, node: node });
  468. }
  469. }
  470. else {
  471. var metaSelection = this.nodeTouched ? false : this.metaKeySelection;
  472. if (metaSelection) {
  473. var metaKey = (event.metaKey || event.ctrlKey);
  474. if (selected && metaKey) {
  475. if (this.isSingleSelectionMode()) {
  476. this.selectionChange.emit(null);
  477. }
  478. else {
  479. this.selection = this.selection.filter(function (val, i) { return i != index_1; });
  480. this.selectionChange.emit(this.selection);
  481. }
  482. this.onNodeUnselect.emit({ originalEvent: event, node: node });
  483. }
  484. else {
  485. if (this.isSingleSelectionMode()) {
  486. this.selectionChange.emit(node);
  487. }
  488. else if (this.isMultipleSelectionMode()) {
  489. this.selection = (!metaKey) ? [] : this.selection || [];
  490. this.selection = this.selection.concat([node]);
  491. this.selectionChange.emit(this.selection);
  492. }
  493. this.onNodeSelect.emit({ originalEvent: event, node: node });
  494. }
  495. }
  496. else {
  497. if (this.isSingleSelectionMode()) {
  498. if (selected) {
  499. this.selection = null;
  500. this.onNodeUnselect.emit({ originalEvent: event, node: node });
  501. }
  502. else {
  503. this.selection = node;
  504. this.onNodeSelect.emit({ originalEvent: event, node: node });
  505. }
  506. }
  507. else {
  508. if (selected) {
  509. this.selection = this.selection.filter(function (val, i) { return i != index_1; });
  510. this.onNodeUnselect.emit({ originalEvent: event, node: node });
  511. }
  512. else {
  513. this.selection = (this.selection || []).concat([node]);
  514. this.onNodeSelect.emit({ originalEvent: event, node: node });
  515. }
  516. }
  517. this.selectionChange.emit(this.selection);
  518. }
  519. }
  520. }
  521. this.nodeTouched = false;
  522. };
  523. Tree.prototype.onNodeTouchEnd = function () {
  524. this.nodeTouched = true;
  525. };
  526. Tree.prototype.onNodeRightClick = function (event, node) {
  527. if (this.contextMenu) {
  528. var eventTarget = event.target;
  529. if (eventTarget.className && eventTarget.className.indexOf('ui-tree-toggler') === 0) {
  530. return;
  531. }
  532. else {
  533. var index = this.findIndexInSelection(node);
  534. var selected = (index >= 0);
  535. if (!selected) {
  536. if (this.isSingleSelectionMode())
  537. this.selectionChange.emit(node);
  538. else
  539. this.selectionChange.emit([node]);
  540. }
  541. this.contextMenu.show(event);
  542. this.onNodeContextMenuSelect.emit({ originalEvent: event, node: node });
  543. }
  544. }
  545. };
  546. Tree.prototype.findIndexInSelection = function (node) {
  547. var index = -1;
  548. if (this.selectionMode && this.selection) {
  549. if (this.isSingleSelectionMode()) {
  550. var areNodesEqual = (this.selection.key && this.selection.key === node.key) || this.selection == node;
  551. index = areNodesEqual ? 0 : -1;
  552. }
  553. else {
  554. for (var i = 0; i < this.selection.length; i++) {
  555. var selectedNode = this.selection[i];
  556. var areNodesEqual = (selectedNode.key && selectedNode.key === node.key) || selectedNode == node;
  557. if (areNodesEqual) {
  558. index = i;
  559. break;
  560. }
  561. }
  562. }
  563. }
  564. return index;
  565. };
  566. Tree.prototype.syncNodeOption = function (node, parentNodes, option, value) {
  567. // to synchronize the node option between the filtered nodes and the original nodes(this.value)
  568. var _node = this.hasFilteredNodes() ? this.getNodeWithKey(node.key, parentNodes) : null;
  569. if (_node) {
  570. _node[option] = value || node[option];
  571. }
  572. };
  573. Tree.prototype.hasFilteredNodes = function () {
  574. return this.filter && this.filteredNodes && this.filteredNodes.length;
  575. };
  576. Tree.prototype.getNodeWithKey = function (key, nodes) {
  577. for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
  578. var node = nodes_1[_i];
  579. if (node.key === key) {
  580. return node;
  581. }
  582. if (node.children) {
  583. var matchedNode = this.getNodeWithKey(key, node.children);
  584. if (matchedNode) {
  585. return matchedNode;
  586. }
  587. }
  588. }
  589. };
  590. Tree.prototype.propagateUp = function (node, select) {
  591. if (node.children && node.children.length) {
  592. var selectedCount = 0;
  593. var childPartialSelected = false;
  594. for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
  595. var child = _a[_i];
  596. if (this.isSelected(child)) {
  597. selectedCount++;
  598. }
  599. else if (child.partialSelected) {
  600. childPartialSelected = true;
  601. }
  602. }
  603. if (select && selectedCount == node.children.length) {
  604. this.selection = (this.selection || []).concat([node]);
  605. node.partialSelected = false;
  606. }
  607. else {
  608. if (!select) {
  609. var index_2 = this.findIndexInSelection(node);
  610. if (index_2 >= 0) {
  611. this.selection = this.selection.filter(function (val, i) { return i != index_2; });
  612. }
  613. }
  614. if (childPartialSelected || selectedCount > 0 && selectedCount != node.children.length)
  615. node.partialSelected = true;
  616. else
  617. node.partialSelected = false;
  618. }
  619. this.syncNodeOption(node, this.filteredNodes, 'partialSelected');
  620. }
  621. var parent = node.parent;
  622. if (parent) {
  623. this.propagateUp(parent, select);
  624. }
  625. };
  626. Tree.prototype.propagateDown = function (node, select) {
  627. var index = this.findIndexInSelection(node);
  628. if (select && index == -1) {
  629. this.selection = (this.selection || []).concat([node]);
  630. }
  631. else if (!select && index > -1) {
  632. this.selection = this.selection.filter(function (val, i) { return i != index; });
  633. }
  634. node.partialSelected = false;
  635. this.syncNodeOption(node, this.filteredNodes, 'partialSelected');
  636. if (node.children && node.children.length) {
  637. for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
  638. var child = _a[_i];
  639. this.propagateDown(child, select);
  640. }
  641. }
  642. };
  643. Tree.prototype.isSelected = function (node) {
  644. return this.findIndexInSelection(node) != -1;
  645. };
  646. Tree.prototype.isSingleSelectionMode = function () {
  647. return this.selectionMode && this.selectionMode == 'single';
  648. };
  649. Tree.prototype.isMultipleSelectionMode = function () {
  650. return this.selectionMode && this.selectionMode == 'multiple';
  651. };
  652. Tree.prototype.isCheckboxSelectionMode = function () {
  653. return this.selectionMode && this.selectionMode == 'checkbox';
  654. };
  655. Tree.prototype.isNodeLeaf = function (node) {
  656. return node.leaf == false ? false : !(node.children && node.children.length);
  657. };
  658. Tree.prototype.getRootNode = function () {
  659. return this.filteredNodes ? this.filteredNodes : this.value;
  660. };
  661. Tree.prototype.getTemplateForNode = function (node) {
  662. if (this.templateMap)
  663. return node.type ? this.templateMap[node.type] : this.templateMap['default'];
  664. else
  665. return null;
  666. };
  667. Tree.prototype.onDragOver = function (event) {
  668. if (this.droppableNodes && (!this.value || this.value.length === 0)) {
  669. event.dataTransfer.dropEffect = 'move';
  670. event.preventDefault();
  671. }
  672. };
  673. Tree.prototype.onDrop = function (event) {
  674. if (this.droppableNodes && (!this.value || this.value.length === 0)) {
  675. event.preventDefault();
  676. var dragNode = this.dragNode;
  677. if (this.allowDrop(dragNode, null, this.dragNodeScope)) {
  678. var dragNodeIndex = this.dragNodeIndex;
  679. this.dragNodeSubNodes.splice(dragNodeIndex, 1);
  680. this.value = this.value || [];
  681. this.value.push(dragNode);
  682. this.dragDropService.stopDrag({
  683. node: dragNode
  684. });
  685. }
  686. }
  687. };
  688. Tree.prototype.onDragEnter = function (event) {
  689. if (this.droppableNodes && this.allowDrop(this.dragNode, null, this.dragNodeScope)) {
  690. this.dragHover = true;
  691. }
  692. };
  693. Tree.prototype.onDragLeave = function (event) {
  694. if (this.droppableNodes) {
  695. var rect = event.currentTarget.getBoundingClientRect();
  696. if (event.x > rect.left + rect.width || event.x < rect.left || event.y > rect.top + rect.height || event.y < rect.top) {
  697. this.dragHover = false;
  698. }
  699. }
  700. };
  701. Tree.prototype.allowDrop = function (dragNode, dropNode, dragNodeScope) {
  702. if (!dragNode) {
  703. //prevent random html elements to be dragged
  704. return false;
  705. }
  706. else if (this.isValidDragScope(dragNodeScope)) {
  707. var allow = true;
  708. if (dropNode) {
  709. if (dragNode === dropNode) {
  710. allow = false;
  711. }
  712. else {
  713. var parent_1 = dropNode.parent;
  714. while (parent_1 != null) {
  715. if (parent_1 === dragNode) {
  716. allow = false;
  717. break;
  718. }
  719. parent_1 = parent_1.parent;
  720. }
  721. }
  722. }
  723. return allow;
  724. }
  725. else {
  726. return false;
  727. }
  728. };
  729. Tree.prototype.isValidDragScope = function (dragScope) {
  730. var dropScope = this.droppableScope;
  731. if (dropScope) {
  732. if (typeof dropScope === 'string') {
  733. if (typeof dragScope === 'string')
  734. return dropScope === dragScope;
  735. else if (dragScope instanceof Array)
  736. return dragScope.indexOf(dropScope) != -1;
  737. }
  738. else if (dropScope instanceof Array) {
  739. if (typeof dragScope === 'string') {
  740. return dropScope.indexOf(dragScope) != -1;
  741. }
  742. else if (dragScope instanceof Array) {
  743. for (var _i = 0, dropScope_1 = dropScope; _i < dropScope_1.length; _i++) {
  744. var s = dropScope_1[_i];
  745. for (var _a = 0, dragScope_1 = dragScope; _a < dragScope_1.length; _a++) {
  746. var ds = dragScope_1[_a];
  747. if (s === ds) {
  748. return true;
  749. }
  750. }
  751. }
  752. }
  753. }
  754. return false;
  755. }
  756. else {
  757. return true;
  758. }
  759. };
  760. Tree.prototype.onFilter = function (event) {
  761. var filterValue = event.target.value;
  762. if (filterValue === '') {
  763. this.filteredNodes = null;
  764. }
  765. else {
  766. this.filteredNodes = [];
  767. var searchFields = this.filterBy.split(',');
  768. var filterText = objectutils_1.ObjectUtils.removeAccents(filterValue).toLowerCase();
  769. var isStrictMode = this.filterMode === 'strict';
  770. for (var _i = 0, _a = this.value; _i < _a.length; _i++) {
  771. var node = _a[_i];
  772. var copyNode = __assign({}, node);
  773. var paramsWithoutNode = { searchFields: searchFields, filterText: filterText, isStrictMode: isStrictMode };
  774. if ((isStrictMode && (this.findFilteredNodes(copyNode, paramsWithoutNode) || this.isFilterMatched(copyNode, paramsWithoutNode))) ||
  775. (!isStrictMode && (this.isFilterMatched(copyNode, paramsWithoutNode) || this.findFilteredNodes(copyNode, paramsWithoutNode)))) {
  776. this.filteredNodes.push(copyNode);
  777. }
  778. }
  779. }
  780. };
  781. Tree.prototype.findFilteredNodes = function (node, paramsWithoutNode) {
  782. if (node) {
  783. var matched = false;
  784. if (node.children) {
  785. var childNodes = node.children.slice();
  786. node.children = [];
  787. for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) {
  788. var childNode = childNodes_1[_i];
  789. var copyChildNode = __assign({}, childNode);
  790. if (this.isFilterMatched(copyChildNode, paramsWithoutNode)) {
  791. matched = true;
  792. node.children.push(copyChildNode);
  793. }
  794. }
  795. }
  796. if (matched) {
  797. node.expanded = true;
  798. return true;
  799. }
  800. }
  801. };
  802. Tree.prototype.isFilterMatched = function (node, _a) {
  803. var searchFields = _a.searchFields, filterText = _a.filterText, isStrictMode = _a.isStrictMode;
  804. var matched = false;
  805. for (var _i = 0, searchFields_1 = searchFields; _i < searchFields_1.length; _i++) {
  806. var field = searchFields_1[_i];
  807. var fieldValue = objectutils_1.ObjectUtils.removeAccents(String(objectutils_1.ObjectUtils.resolveFieldData(node, field))).toLowerCase();
  808. if (fieldValue.indexOf(filterText) > -1) {
  809. matched = true;
  810. }
  811. }
  812. if (!matched || (isStrictMode && !this.isNodeLeaf(node))) {
  813. matched = this.findFilteredNodes(node, { searchFields: searchFields, filterText: filterText, isStrictMode: isStrictMode }) || matched;
  814. }
  815. return matched;
  816. };
  817. Tree.prototype.getBlockableElement = function () {
  818. return this.el.nativeElement.children[0];
  819. };
  820. Tree.prototype.ngOnDestroy = function () {
  821. if (this.dragStartSubscription) {
  822. this.dragStartSubscription.unsubscribe();
  823. }
  824. if (this.dragStopSubscription) {
  825. this.dragStopSubscription.unsubscribe();
  826. }
  827. };
  828. __decorate([
  829. core_1.Input(),
  830. __metadata("design:type", Array)
  831. ], Tree.prototype, "value", void 0);
  832. __decorate([
  833. core_1.Input(),
  834. __metadata("design:type", String)
  835. ], Tree.prototype, "selectionMode", void 0);
  836. __decorate([
  837. core_1.Input(),
  838. __metadata("design:type", Object)
  839. ], Tree.prototype, "selection", void 0);
  840. __decorate([
  841. core_1.Output(),
  842. __metadata("design:type", core_1.EventEmitter)
  843. ], Tree.prototype, "selectionChange", void 0);
  844. __decorate([
  845. core_1.Output(),
  846. __metadata("design:type", core_1.EventEmitter)
  847. ], Tree.prototype, "onNodeSelect", void 0);
  848. __decorate([
  849. core_1.Output(),
  850. __metadata("design:type", core_1.EventEmitter)
  851. ], Tree.prototype, "onNodeUnselect", void 0);
  852. __decorate([
  853. core_1.Output(),
  854. __metadata("design:type", core_1.EventEmitter)
  855. ], Tree.prototype, "onNodeExpand", void 0);
  856. __decorate([
  857. core_1.Output(),
  858. __metadata("design:type", core_1.EventEmitter)
  859. ], Tree.prototype, "onNodeCollapse", void 0);
  860. __decorate([
  861. core_1.Output(),
  862. __metadata("design:type", core_1.EventEmitter)
  863. ], Tree.prototype, "onNodeContextMenuSelect", void 0);
  864. __decorate([
  865. core_1.Output(),
  866. __metadata("design:type", core_1.EventEmitter)
  867. ], Tree.prototype, "onNodeDrop", void 0);
  868. __decorate([
  869. core_1.Input(),
  870. __metadata("design:type", Object)
  871. ], Tree.prototype, "style", void 0);
  872. __decorate([
  873. core_1.Input(),
  874. __metadata("design:type", String)
  875. ], Tree.prototype, "styleClass", void 0);
  876. __decorate([
  877. core_1.Input(),
  878. __metadata("design:type", Object)
  879. ], Tree.prototype, "contextMenu", void 0);
  880. __decorate([
  881. core_1.Input(),
  882. __metadata("design:type", String)
  883. ], Tree.prototype, "layout", void 0);
  884. __decorate([
  885. core_1.Input(),
  886. __metadata("design:type", Object)
  887. ], Tree.prototype, "draggableScope", void 0);
  888. __decorate([
  889. core_1.Input(),
  890. __metadata("design:type", Object)
  891. ], Tree.prototype, "droppableScope", void 0);
  892. __decorate([
  893. core_1.Input(),
  894. __metadata("design:type", Boolean)
  895. ], Tree.prototype, "draggableNodes", void 0);
  896. __decorate([
  897. core_1.Input(),
  898. __metadata("design:type", Boolean)
  899. ], Tree.prototype, "droppableNodes", void 0);
  900. __decorate([
  901. core_1.Input(),
  902. __metadata("design:type", Boolean)
  903. ], Tree.prototype, "metaKeySelection", void 0);
  904. __decorate([
  905. core_1.Input(),
  906. __metadata("design:type", Boolean)
  907. ], Tree.prototype, "propagateSelectionUp", void 0);
  908. __decorate([
  909. core_1.Input(),
  910. __metadata("design:type", Boolean)
  911. ], Tree.prototype, "propagateSelectionDown", void 0);
  912. __decorate([
  913. core_1.Input(),
  914. __metadata("design:type", Boolean)
  915. ], Tree.prototype, "loading", void 0);
  916. __decorate([
  917. core_1.Input(),
  918. __metadata("design:type", String)
  919. ], Tree.prototype, "loadingIcon", void 0);
  920. __decorate([
  921. core_1.Input(),
  922. __metadata("design:type", String)
  923. ], Tree.prototype, "emptyMessage", void 0);
  924. __decorate([
  925. core_1.Input(),
  926. __metadata("design:type", String)
  927. ], Tree.prototype, "ariaLabel", void 0);
  928. __decorate([
  929. core_1.Input(),
  930. __metadata("design:type", String)
  931. ], Tree.prototype, "ariaLabelledBy", void 0);
  932. __decorate([
  933. core_1.Input(),
  934. __metadata("design:type", Boolean)
  935. ], Tree.prototype, "validateDrop", void 0);
  936. __decorate([
  937. core_1.Input(),
  938. __metadata("design:type", Boolean)
  939. ], Tree.prototype, "filter", void 0);
  940. __decorate([
  941. core_1.Input(),
  942. __metadata("design:type", String)
  943. ], Tree.prototype, "filterBy", void 0);
  944. __decorate([
  945. core_1.Input(),
  946. __metadata("design:type", String)
  947. ], Tree.prototype, "filterMode", void 0);
  948. __decorate([
  949. core_1.Input(),
  950. __metadata("design:type", String)
  951. ], Tree.prototype, "filterPlaceholder", void 0);
  952. __decorate([
  953. core_1.Input(),
  954. __metadata("design:type", Function)
  955. ], Tree.prototype, "nodeTrackBy", void 0);
  956. __decorate([
  957. core_1.ContentChildren(shared_2.PrimeTemplate),
  958. __metadata("design:type", core_1.QueryList)
  959. ], Tree.prototype, "templates", void 0);
  960. Tree = __decorate([
  961. core_1.Component({
  962. selector: 'p-tree',
  963. template: "\n <div [ngClass]=\"{'ui-tree ui-widget ui-widget-content ui-corner-all':true,'ui-tree-selectable':selectionMode,'ui-treenode-dragover':dragHover,'ui-tree-loading': loading}\" [ngStyle]=\"style\" [class]=\"styleClass\" *ngIf=\"!horizontal\"\n (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\" (dragenter)=\"onDragEnter($event)\" (dragleave)=\"onDragLeave($event)\">\n <div class=\"ui-tree-loading-mask ui-widget-overlay\" *ngIf=\"loading\"></div>\n <div class=\"ui-tree-loading-content\" *ngIf=\"loading\">\n <i [class]=\"'ui-tree-loading-icon pi-spin ' + loadingIcon\"></i>\n </div>\n <div *ngIf=\"filter\" class=\"ui-tree-filter-container\">\n <input #filter type=\"text\" autocomplete=\"off\" class=\"ui-tree-filter ui-inputtext ui-widget ui-state-default ui-corner-all\" [attr.placeholder]=\"filterPlaceholder\"\n (keydown.enter)=\"$event.preventDefault()\" (input)=\"onFilter($event)\">\n <span class=\"ui-tree-filter-icon pi pi-search\"></span>\n </div>\n <ul class=\"ui-tree-container\" *ngIf=\"getRootNode()\" role=\"tree\" [attr.aria-label]=\"ariaLabel\" [attr.aria-labelledby]=\"ariaLabelledBy\">\n <p-treeNode *ngFor=\"let node of getRootNode(); let firstChild=first;let lastChild=last; let index=index; trackBy: nodeTrackBy\" [node]=\"node\"\n [firstChild]=\"firstChild\" [lastChild]=\"lastChild\" [index]=\"index\"></p-treeNode>\n </ul>\n <div class=\"ui-tree-empty-message\" *ngIf=\"!loading && (value == null || value.length === 0)\">{{emptyMessage}}</div>\n </div>\n <div [ngClass]=\"{'ui-tree ui-tree-horizontal ui-widget ui-widget-content ui-corner-all':true,'ui-tree-selectable':selectionMode}\" [ngStyle]=\"style\" [class]=\"styleClass\" *ngIf=\"horizontal\">\n <div class=\"ui-tree-loading ui-widget-overlay\" *ngIf=\"loading\"></div>\n <div class=\"ui-tree-loading-content\" *ngIf=\"loading\">\n <i [class]=\"'ui-tree-loading-icon pi-spin ' + loadingIcon\"></i>\n </div>\n <table *ngIf=\"value&&value[0]\">\n <p-treeNode [node]=\"value[0]\" [root]=\"true\"></p-treeNode>\n </table>\n <div class=\"ui-tree-empty-message\" *ngIf=\"!loading && (value == null || value.length === 0)\">{{emptyMessage}}</div>\n </div>\n "
  964. }),
  965. __param(1, core_2.Optional()),
  966. __metadata("design:paramtypes", [core_1.ElementRef, treedragdropservice_1.TreeDragDropService])
  967. ], Tree);
  968. return Tree;
  969. }());
  970. exports.Tree = Tree;
  971. var TreeModule = /** @class */ (function () {
  972. function TreeModule() {
  973. }
  974. TreeModule = __decorate([
  975. core_1.NgModule({
  976. imports: [common_1.CommonModule],
  977. exports: [Tree, shared_1.SharedModule],
  978. declarations: [Tree, UITreeNode]
  979. })
  980. ], TreeModule);
  981. return TreeModule;
  982. }());
  983. exports.TreeModule = TreeModule;
  984. //# sourceMappingURL=tree.js.map