@wavemaker/app-ng-runtime 11.4.0-next.28701 → 11.4.0-rc.5342
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.
- app-ng-runtime/build-task/basic/tree/tree.build.d.ts +1 -2
- app-ng-runtime/build-task/bundles/index.umd.js +7 -9
- app-ng-runtime/build-task/bundles/index.umd.js.map +1 -1
- app-ng-runtime/build-task/esm2015/basic/tree/tree.build.js +3 -4
- app-ng-runtime/build-task/esm2015/navigation/popover/popover.build.js +3 -3
- app-ng-runtime/build-task/fesm2015/index.js +7 -9
- app-ng-runtime/build-task/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/base/bundles/index.umd.js +7 -4
- app-ng-runtime/components/base/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/base/esm2015/utils/widget-utils.js +7 -4
- app-ng-runtime/components/base/esm2015/widgets/common/dialog/dialog.service.js +3 -3
- app-ng-runtime/components/base/fesm2015/index.js +8 -5
- app-ng-runtime/components/base/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/base/utils/widget-utils.d.ts +1 -1
- app-ng-runtime/components/basic/tree/bundles/index.umd.js +280 -256
- app-ng-runtime/components/basic/tree/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/basic/tree/esm2015/public_api.js +2 -2
- app-ng-runtime/components/basic/tree/esm2015/tree.component.js +322 -0
- app-ng-runtime/components/basic/tree/esm2015/tree.module.js +3 -3
- app-ng-runtime/components/basic/tree/fesm2015/index.js +260 -248
- app-ng-runtime/components/basic/tree/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/basic/tree/index.metadata.json +1 -1
- app-ng-runtime/components/basic/tree/public_api.d.ts +1 -1
- app-ng-runtime/components/basic/tree/tree.component.d.ts +34 -0
- app-ng-runtime/components/containers/tabs/bundles/index.umd.js +39 -23
- app-ng-runtime/components/containers/tabs/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/containers/tabs/esm2015/tab-pane/tab-pane.component.js +8 -1
- app-ng-runtime/components/containers/tabs/esm2015/tabs.animator.js +33 -13
- app-ng-runtime/components/containers/tabs/fesm2015/index.js +40 -13
- app-ng-runtime/components/containers/tabs/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/containers/tabs/tabs.animator.d.ts +5 -1
- app-ng-runtime/components/data/list/bundles/index.umd.js +51 -42
- app-ng-runtime/components/data/list/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/data/list/esm2015/list.component.js +51 -42
- app-ng-runtime/components/data/list/fesm2015/index.js +50 -41
- app-ng-runtime/components/data/list/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/data/list/index.metadata.json +1 -1
- app-ng-runtime/components/data/pagination/bundles/index.umd.js +21 -4
- app-ng-runtime/components/data/pagination/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/data/pagination/esm2015/pagination.component.js +22 -5
- app-ng-runtime/components/data/pagination/fesm2015/index.js +21 -4
- app-ng-runtime/components/data/pagination/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/data/pagination/index.metadata.json +1 -1
- app-ng-runtime/components/data/pagination/pagination.component.d.ts +1 -0
- app-ng-runtime/components/data/table/bundles/index.umd.js +7 -0
- app-ng-runtime/components/data/table/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/data/table/esm2015/table.component.js +8 -1
- app-ng-runtime/components/data/table/fesm2015/index.js +7 -0
- app-ng-runtime/components/data/table/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/data/table/index.metadata.json +1 -1
- app-ng-runtime/components/dialogs/default/base-dialog.d.ts +1 -0
- app-ng-runtime/components/dialogs/default/bundles/index.umd.js +13 -4
- app-ng-runtime/components/dialogs/default/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/dialogs/default/esm2015/base-dialog.js +14 -6
- app-ng-runtime/components/dialogs/default/fesm2015/index.js +13 -5
- app-ng-runtime/components/dialogs/default/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/dialogs/default/index.metadata.json +1 -1
- app-ng-runtime/components/input/epoch/bundles/index.umd.js +66 -29
- app-ng-runtime/components/input/epoch/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/input/epoch/date-time/date-time-picker.component.d.ts +1 -0
- app-ng-runtime/components/input/epoch/esm2015/base-date-time.component.js +43 -25
- app-ng-runtime/components/input/epoch/esm2015/date/date.component.js +3 -3
- app-ng-runtime/components/input/epoch/esm2015/date-time/date-time-picker.component.js +31 -11
- app-ng-runtime/components/input/epoch/esm2015/date-time/date-time.component.js +2 -2
- app-ng-runtime/components/input/epoch/fesm2015/index.js +75 -37
- app-ng-runtime/components/input/epoch/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/input/epoch/index.metadata.json +1 -1
- app-ng-runtime/components/navigation/popover/bundles/index.umd.js +3 -4
- app-ng-runtime/components/navigation/popover/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/navigation/popover/esm2015/popover.component.js +5 -6
- app-ng-runtime/components/navigation/popover/fesm2015/index.js +4 -5
- app-ng-runtime/components/navigation/popover/fesm2015/index.js.map +1 -1
- app-ng-runtime/mobile/components/page/default/bundles/index.umd.js +24 -6
- app-ng-runtime/mobile/components/page/default/bundles/index.umd.js.map +1 -1
- app-ng-runtime/mobile/components/page/default/esm2015/page.directive.js +20 -3
- app-ng-runtime/mobile/components/page/default/fesm2015/index.js +19 -2
- app-ng-runtime/mobile/components/page/default/fesm2015/index.js.map +1 -1
- app-ng-runtime/mobile/components/page/default/index.metadata.json +1 -1
- app-ng-runtime/mobile/components/page/default/page.directive.d.ts +4 -1
- app-ng-runtime/package.json +1 -1
- app-ng-runtime/scripts/datatable/datatable.js +23 -23
- app-ng-runtime/scripts/tree-keyboard-navigation/keyboard-navigation.js +251 -0
- app-ng-runtime/variables/bundles/index.umd.js +14 -4
- app-ng-runtime/variables/bundles/index.umd.js.map +1 -1
- app-ng-runtime/variables/esm2015/manager/action/notification-action.manager.js +5 -6
- app-ng-runtime/variables/esm2015/service/variables.service.js +8 -1
- app-ng-runtime/variables/fesm2015/index.js +11 -5
- app-ng-runtime/variables/fesm2015/index.js.map +1 -1
- app-ng-runtime/variables/index.metadata.json +1 -1
- app-ng-runtime/variables/service/variables.service.d.ts +4 -0
- app-ng-runtime/components/basic/tree/esm2015/tree.directive.js +0 -310
- app-ng-runtime/components/basic/tree/tree.directive.d.ts +0 -35
|
@@ -116,4 +116,4 @@ export declare const setFocusTrap: (container: any, allowOutsideClick: any, setR
|
|
|
116
116
|
* @param element {HTMLElement}
|
|
117
117
|
* @returns {Array}
|
|
118
118
|
*/
|
|
119
|
-
export declare const getKeyboardFocusableElements: (element: HTMLElement) =>
|
|
119
|
+
export declare const getKeyboardFocusableElements: (element: HTMLElement) => Element[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@wm/components/base')
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@wm/components/basic/tree', ['exports', '@angular/core', '@angular/common', '@wm/components/base'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.basic = global.wm.components.basic || {}, global.wm.components.basic.tree = {}), global.ng.core, global.ng.common, global.wm.components.base
|
|
5
|
-
})(this, (function (exports, core
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@wm/components/base')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@wm/components/basic/tree', ['exports', '@angular/core', '@angular/common', '@wm/components/base'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.basic = global.wm.components.basic || {}, global.wm.components.basic.tree = {}), global.ng.core, global.ng.common, global.wm.components.base));
|
|
5
|
+
})(this, (function (exports, core, common, base) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -342,321 +342,345 @@
|
|
|
342
342
|
]));
|
|
343
343
|
};
|
|
344
344
|
|
|
345
|
-
var defaultTreeIconClass = 'plus-minus';
|
|
346
|
-
var ICON_CLASSES = {
|
|
347
|
-
'folder': {
|
|
348
|
-
'expanded': 'wi-folder-open',
|
|
349
|
-
'collapsed': 'wi-folder'
|
|
350
|
-
},
|
|
351
|
-
'circle-plus-minus': {
|
|
352
|
-
'expanded': 'wi-remove-circle-outline',
|
|
353
|
-
'collapsed': 'wi-add-circle-outline'
|
|
354
|
-
},
|
|
355
|
-
'chevron': {
|
|
356
|
-
'expanded': 'wi-keyboard-arrow-down',
|
|
357
|
-
'collapsed': 'wi-keyboard-arrow-right'
|
|
358
|
-
},
|
|
359
|
-
'menu': {
|
|
360
|
-
'expanded': 'wi-arrow-down',
|
|
361
|
-
'collapsed': 'wi-arrow-right'
|
|
362
|
-
},
|
|
363
|
-
'triangle': {
|
|
364
|
-
'expanded': 'wi-arrow-drop-down-circle',
|
|
365
|
-
'collapsed': 'wi-play-circle-filled'
|
|
366
|
-
},
|
|
367
|
-
'expand-collapse': {
|
|
368
|
-
'expanded': 'wi-expand-less',
|
|
369
|
-
'collapsed': 'wi-expand-more'
|
|
370
|
-
},
|
|
371
|
-
'plus-minus': {
|
|
372
|
-
'expanded': 'wi-minus',
|
|
373
|
-
'collapsed': 'wi-plus'
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
345
|
var WIDGET_INFO = { widgetType: 'wm-tree', hostClass: 'app-tree' };
|
|
377
|
-
var
|
|
378
|
-
|
|
379
|
-
|
|
346
|
+
var defaultTreeIconClass = 'plus-minus';
|
|
347
|
+
var TreeComponent = /** @class */ (function (_super) {
|
|
348
|
+
__extends(TreeComponent, _super);
|
|
349
|
+
function TreeComponent(inj) {
|
|
380
350
|
var _this = _super.call(this, inj, WIDGET_INFO) || this;
|
|
381
|
-
_this.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
351
|
+
_this.setting = {
|
|
352
|
+
data: {
|
|
353
|
+
simpleData: {
|
|
354
|
+
enable: true
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
view: {
|
|
358
|
+
dblClickExpand: false,
|
|
359
|
+
fontCss: {
|
|
360
|
+
'font-awesome': true
|
|
361
|
+
},
|
|
362
|
+
switchIcon: {},
|
|
363
|
+
},
|
|
364
|
+
check: {},
|
|
365
|
+
callback: {}
|
|
366
|
+
};
|
|
386
367
|
base.styler(_this.nativeElement, _this, base.APPLY_STYLES_TYPE.CONTAINER);
|
|
387
|
-
_this.bindEvents();
|
|
388
368
|
return _this;
|
|
389
369
|
}
|
|
390
|
-
|
|
370
|
+
TreeComponent.prototype.onPropertyChange = function (key, nv, ov) {
|
|
391
371
|
switch (key) {
|
|
392
372
|
case 'dataset':
|
|
393
373
|
this.nodes = this.getNodes(nv);
|
|
394
|
-
this.
|
|
374
|
+
if (this.level > 0) {
|
|
375
|
+
this.expandTree(this.level, this.nodes, 0);
|
|
376
|
+
}
|
|
395
377
|
this.renderTree();
|
|
396
378
|
break;
|
|
397
|
-
case '
|
|
379
|
+
case 'levels':
|
|
380
|
+
if (nv > 0) {
|
|
381
|
+
this.level = nv;
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
case 'treeicons':
|
|
385
|
+
this.treeicon = nv;
|
|
386
|
+
break;
|
|
398
387
|
case 'nodelabel':
|
|
399
|
-
|
|
388
|
+
this.nodelabel = nv;
|
|
389
|
+
break;
|
|
390
|
+
case 'icon':
|
|
391
|
+
this.nodeicon = nv;
|
|
400
392
|
case 'orderby':
|
|
401
393
|
this.renderTree();
|
|
402
394
|
break;
|
|
403
|
-
case '
|
|
404
|
-
this.
|
|
405
|
-
break;
|
|
406
|
-
case 'datavalue':
|
|
407
|
-
this.selectById(nv);
|
|
395
|
+
case 'class':
|
|
396
|
+
this.treeClass = nv;
|
|
408
397
|
break;
|
|
409
398
|
default:
|
|
410
399
|
_super.prototype.onPropertyChange.call(this, key, nv, ov);
|
|
400
|
+
break;
|
|
411
401
|
}
|
|
412
402
|
};
|
|
413
|
-
|
|
403
|
+
// expands the tree nodes if the property is selected.
|
|
404
|
+
TreeComponent.prototype.expandTree = function (level, node, childLevel) {
|
|
414
405
|
var _this = this;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
_cls = levels > 0 ? ' expanded ' : ' collapsed ';
|
|
420
|
-
_iconCls = _cls + (levels > 0 ? _iconClses.expanded : _iconClses.collapsed);
|
|
421
|
-
deep = deep || 0;
|
|
422
|
-
parent.append($ul);
|
|
423
|
-
nodes.forEach(function (node, idx) {
|
|
424
|
-
var $li = $('<li></li>'), $iconNode = $('<i></i>'), nodeLabel = base.getEvaluatedData(node, { field: _this.nodelabel, bindExpression: _this.bindnodelabel }, _this.viewParent) || node.label, nodeIcon = base.getEvaluatedData(node, { field: _this.nodeicon, bindExpression: _this.bindnodeicon }, _this.viewParent) || node.icon, nodeChildren = base.getEvaluatedData(node, { field: _this.nodechildren, bindExpression: _this.bindnodechildren }, _this.viewParent) || node.children;
|
|
425
|
-
var nodeIdValue = base.getEvaluatedData(node, { field: _this.nodeid, bindExpression: _this.bindnodeid }, _this.viewParent);
|
|
426
|
-
if (nodeIdValue === undefined) {
|
|
427
|
-
nodeIdValue = node.children;
|
|
428
|
-
}
|
|
429
|
-
var isNodeMatched = false, expandCollapseIcon;
|
|
430
|
-
$li.data('nodedata', node)
|
|
431
|
-
.append($iconNode)
|
|
432
|
-
.append("<span class=\"title\">" + nodeLabel + "</span>")
|
|
433
|
-
.appendTo($ul);
|
|
434
|
-
// if datavalue(ie, expr) is provided select the tree node accordingly
|
|
435
|
-
// if datavalue === 'FirstNode' -- select the FirstNode at level 0
|
|
436
|
-
// if datavalue === 'LastNode' -- select the LastNode at level 0
|
|
437
|
-
// if datavalue is a bind expression evaluate the expression for each node of the tree till the condition is satisfied.
|
|
438
|
-
// if node identifier is present then verify the datavalue is bound expr or static value and compare with the node model
|
|
439
|
-
if (_this.bindnodeid || _this.nodeid) {
|
|
440
|
-
isNodeMatched = _this.binddatavalue ? nodeIdValue === _evalDataValue : nodeIdValue === _expr;
|
|
441
|
-
if (nodeIdValue !== undefined) {
|
|
442
|
-
$li.attr('id', nodeIdValue);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
else if (_this.binddatavalue) { // evaluate the expression only if it is bound (useExpression)
|
|
446
|
-
isNodeMatched = !!core.$parseExpr(_expr)(_this, node);
|
|
447
|
-
}
|
|
448
|
-
// Perform LastNode check only at level 0.(ie, deep = 0);
|
|
449
|
-
if (!_this._selectNode) {
|
|
450
|
-
if ((_expr === 'FirstNode' && idx === 0)
|
|
451
|
-
|| (!deep && _expr === 'LastNode' && idx === nodes.length - 1)
|
|
452
|
-
|| isNodeMatched) {
|
|
453
|
-
// save a reference of the node to be selected in `_selectNode`
|
|
454
|
-
_this._selectNode = $li;
|
|
455
|
-
_this.datavalue = nodeIdValue;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
if (nodeIcon) {
|
|
459
|
-
$iconNode.addClass(nodeIcon);
|
|
460
|
-
}
|
|
461
|
-
if (nodeChildren && nodeChildren.length) { // parent node
|
|
462
|
-
$li.addClass("parent-node " + _cls);
|
|
463
|
-
expandCollapseIcon = $("<i class=\"wi " + _iconCls + "\"></i>");
|
|
464
|
-
if (nodeIcon) {
|
|
465
|
-
$iconNode.addClass(nodeIcon);
|
|
466
|
-
}
|
|
467
|
-
$li.prepend(expandCollapseIcon);
|
|
468
|
-
_this.constructNodes(nodeChildren, $li, levels - 1, deep + 1, _evalDataValue);
|
|
406
|
+
node.map(function (childNode) {
|
|
407
|
+
if ("children" in childNode && !("open" in childNode) && childLevel < level) {
|
|
408
|
+
childNode["open"] = true;
|
|
409
|
+
_this.expandTree(level, childNode.children, childLevel + 1);
|
|
469
410
|
}
|
|
470
411
|
else {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
$li.addClass('leaf-node');
|
|
412
|
+
childLevel = 0;
|
|
413
|
+
return;
|
|
475
414
|
}
|
|
476
415
|
});
|
|
477
416
|
};
|
|
478
|
-
|
|
417
|
+
// sets the template for the tree based on the property selected.
|
|
418
|
+
TreeComponent.prototype.setTreeTemplate = function (value) {
|
|
419
|
+
if (value === 'Classic') {
|
|
420
|
+
this.setting.check["enable"] = false;
|
|
421
|
+
}
|
|
422
|
+
else if (value === 'Checkbox') {
|
|
423
|
+
this.setting.check["enable"] = true;
|
|
424
|
+
this.setting.check["chkStyle"] = 'checkbox';
|
|
425
|
+
}
|
|
426
|
+
else if (value === 'Radio') {
|
|
427
|
+
this.setting.check["enable"] = true;
|
|
428
|
+
this.setting.check["chkStyle"] = 'radio';
|
|
429
|
+
this.setting.check["radioType"] = "all";
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
// extracts nodes from string format
|
|
433
|
+
TreeComponent.prototype.getNodesFromString = function (value) {
|
|
479
434
|
return value.split(',').map(function (item) {
|
|
480
435
|
return {
|
|
481
|
-
'
|
|
436
|
+
'name': item && item.trim()
|
|
482
437
|
};
|
|
483
438
|
});
|
|
484
439
|
};
|
|
485
|
-
|
|
440
|
+
// gets the nodes and orders the nodes if required
|
|
441
|
+
TreeComponent.prototype.getNodes = function (newVal) {
|
|
486
442
|
var nodes;
|
|
487
|
-
if (_.
|
|
443
|
+
if (_.isArray(newVal)) {
|
|
444
|
+
nodes = base.getOrderedDataset(newVal, this.orderby);
|
|
445
|
+
}
|
|
446
|
+
else if (_.isObject(newVal)) {
|
|
447
|
+
nodes = [newVal];
|
|
448
|
+
}
|
|
449
|
+
else if (_.isString(newVal) && !_.isEmpty(newVal)) {
|
|
488
450
|
newVal = newVal.trim();
|
|
489
451
|
if (newVal) {
|
|
490
452
|
nodes = this.getNodesFromString(newVal);
|
|
491
453
|
}
|
|
492
454
|
}
|
|
493
|
-
else if (_.isArray(newVal)) {
|
|
494
|
-
newVal = base.getOrderedDataset(newVal, this.orderby);
|
|
495
|
-
nodes = newVal;
|
|
496
|
-
}
|
|
497
|
-
else if (_.isObject(newVal)) {
|
|
498
|
-
nodes = [newVal];
|
|
499
|
-
}
|
|
500
455
|
return nodes;
|
|
501
456
|
};
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
ov = ov || defaultTreeIconClass;
|
|
506
|
-
$el.find('i.expanded').removeClass(ICON_CLASSES[ov].expanded).addClass(ICON_CLASSES[nv].expanded);
|
|
507
|
-
$el.find('i.collapsed').removeClass(ICON_CLASSES[ov].collapsed).addClass(ICON_CLASSES[nv].collapsed);
|
|
457
|
+
// adds class to the nodes inorder to add icons to respective node.
|
|
458
|
+
TreeComponent.prototype.setNodeclasses = function (treeId, treeNode) {
|
|
459
|
+
return treeNode.icon ? { add: ["" + treeNode.icon] } : '';
|
|
508
460
|
};
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
var
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
461
|
+
;
|
|
462
|
+
// Sets the node label with any icon if bound to
|
|
463
|
+
TreeComponent.prototype.setNodeData = function (nodes, depth, level, parentNode, type) {
|
|
464
|
+
var _this = this;
|
|
465
|
+
if (depth === 0) {
|
|
466
|
+
nodes.map(function (node) {
|
|
467
|
+
if (node.children) {
|
|
468
|
+
_this.setNodeData(node.children, depth, level, parentNode, type);
|
|
469
|
+
}
|
|
470
|
+
if (node.icon && _this.nodelabel == 'icon') {
|
|
471
|
+
node[type] = node.icon;
|
|
472
|
+
}
|
|
473
|
+
else if (node.name && _this.nodelabel == 'name') {
|
|
474
|
+
node[type] = node.name;
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
});
|
|
528
480
|
}
|
|
529
|
-
else
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
481
|
+
else {
|
|
482
|
+
nodes.map(function (node) {
|
|
483
|
+
if (node.children && level > 1) {
|
|
484
|
+
if (depth === level) {
|
|
485
|
+
parentNode = node;
|
|
486
|
+
}
|
|
487
|
+
_this.setNodeData(node.children, depth, level - 1, parentNode, type);
|
|
488
|
+
}
|
|
489
|
+
if (level === 1 && (type === "name" ? _this.nodelabel.includes("label") || _this.nodelabel.includes("name") : _this.nodeicon.includes("label") || _this.nodeicon.includes("name"))) {
|
|
490
|
+
parentNode[type] = node.name || node.label;
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
else if (level === 1 && (node.icon !== undefined) && (type === "name" ? _this.nodelabel.includes("icon") : _this.nodeicon.includes("icon"))) {
|
|
494
|
+
parentNode[type] = node.icon;
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
});
|
|
533
501
|
}
|
|
534
502
|
};
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
var
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
503
|
+
// adds tree icons to the nodes on load of the tree
|
|
504
|
+
TreeComponent.prototype.changeTreeIcons = function (nv) {
|
|
505
|
+
var eleClose = $('ul[name="' + this.name + '"] li span.button.switch');
|
|
506
|
+
$(eleClose).map(function (idx, ele) {
|
|
507
|
+
$(ele).addClass(nv);
|
|
508
|
+
$(ele).on("click", function (e) {
|
|
509
|
+
setTimeout(function () {
|
|
510
|
+
$(ele).addClass(nv);
|
|
511
|
+
}, 0);
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
};
|
|
515
|
+
TreeComponent.prototype.getPath = function (treeNode, path) {
|
|
516
|
+
if (treeNode.getParentNode() === null) {
|
|
517
|
+
path = "/" + treeNode.name + path;
|
|
542
518
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
this.constructNodes(this.nodes, $(docFrag), levels, 0, this.datavalue);
|
|
546
|
-
$el.append(docFrag);
|
|
519
|
+
else {
|
|
520
|
+
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode.name;
|
|
547
521
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
522
|
+
return path;
|
|
523
|
+
};
|
|
524
|
+
// binds the click event to all nodes to open the child nodes
|
|
525
|
+
TreeComponent.prototype.onClick = function (event, treeId, treeNode, clickFlag) {
|
|
526
|
+
var treeObj = $.fn.zTree.getZTreeObj("" + this.name);
|
|
527
|
+
var path = this.getPath(treeNode, "");
|
|
528
|
+
var eventParams = {
|
|
529
|
+
'$event': event,
|
|
530
|
+
"$item": treeNode,
|
|
531
|
+
"$path": path
|
|
532
|
+
};
|
|
533
|
+
this.invokeEventCallback('select', eventParams);
|
|
534
|
+
};
|
|
535
|
+
// Adds tree icon classes to child nodes when expanded
|
|
536
|
+
TreeComponent.prototype.onExpand = function (event, treeId, treeNode) {
|
|
537
|
+
var self = this;
|
|
538
|
+
var path = this.getPath(treeNode, "");
|
|
539
|
+
var eventParams = {
|
|
540
|
+
'$event': event,
|
|
541
|
+
"$item": treeNode,
|
|
542
|
+
"$path": path
|
|
543
|
+
};
|
|
544
|
+
this.invokeEventCallback('expand', eventParams);
|
|
545
|
+
treeNode.children ? treeNode.children.map(function (el) {
|
|
546
|
+
if (el.isParent) {
|
|
547
|
+
var ele_1 = $("#" + el.tId + "_switch");
|
|
548
|
+
$(ele_1).addClass(self.treeicon || defaultTreeIconClass);
|
|
549
|
+
$(ele_1).on("click", function (e) {
|
|
550
|
+
setTimeout(function () {
|
|
551
|
+
$(ele_1).addClass(self.treeicon || defaultTreeIconClass);
|
|
552
|
+
}, 0);
|
|
553
|
+
});
|
|
555
554
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
555
|
+
}) : '';
|
|
556
|
+
};
|
|
557
|
+
TreeComponent.prototype.onCollapse = function (event, treeId, treeNode) {
|
|
558
|
+
var path = this.getPath(treeNode, "");
|
|
559
|
+
var eventParams = {
|
|
560
|
+
'$event': event,
|
|
561
|
+
"$item": treeNode,
|
|
562
|
+
"$path": path
|
|
563
|
+
};
|
|
564
|
+
this.invokeEventCallback('collapse', eventParams);
|
|
567
565
|
};
|
|
568
|
-
|
|
566
|
+
// function to support backward compatibility of objects
|
|
567
|
+
TreeComponent.prototype.modifyObjects = function (array) {
|
|
569
568
|
var _this = this;
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
nodeAction = data[this.nodeaction || 'action'];
|
|
579
|
-
// if the selectNode is initiated by click event then use the nativeElement target from event
|
|
580
|
-
$liPath = target ? target.parents('.app-tree li') : this.findSelectedNodeParent($li);
|
|
581
|
-
// construct the path of the node
|
|
582
|
-
$liPath
|
|
583
|
-
.each(function (i, el) {
|
|
584
|
-
var current = $(el).children('.title').text();
|
|
585
|
-
path = "/" + (current + path);
|
|
586
|
-
});
|
|
587
|
-
// expand the current node till the viewParent level which is collapsed
|
|
588
|
-
$li.parentsUntil($el, 'li.parent-node.collapsed')
|
|
589
|
-
.each(function (index, el) {
|
|
590
|
-
var $current = $(el), $i = $current.children('i.collapsed');
|
|
591
|
-
_this.toggleExpandCollapseNode(undefined, $i, $current);
|
|
569
|
+
array.forEach(function (obj) {
|
|
570
|
+
if (obj.label !== undefined) {
|
|
571
|
+
obj.name = obj.label;
|
|
572
|
+
delete obj.label;
|
|
573
|
+
}
|
|
574
|
+
if (obj.children !== undefined) {
|
|
575
|
+
_this.modifyObjects(obj.children);
|
|
576
|
+
}
|
|
592
577
|
});
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
578
|
+
return array;
|
|
579
|
+
};
|
|
580
|
+
// sets the node children property to parent nodes
|
|
581
|
+
TreeComponent.prototype.setNodeChildren = function (nodes, depth, level, parentNode) {
|
|
582
|
+
if (depth <= 0) {
|
|
583
|
+
return nodes;
|
|
584
|
+
}
|
|
585
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
586
|
+
var node = nodes[i];
|
|
587
|
+
if (depth === level) {
|
|
588
|
+
parentNode = nodes[i];
|
|
598
589
|
}
|
|
599
|
-
|
|
600
|
-
|
|
590
|
+
if (node.children && node.children.length > 0) {
|
|
591
|
+
if (level === 1) {
|
|
592
|
+
parentNode.children = node.children.map(function (child) { return ({ name: child.name, children: child === null || child === void 0 ? void 0 : child.children }); });
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
this.setNodeChildren(node.children, depth, level - 1, parentNode);
|
|
597
|
+
}
|
|
601
598
|
}
|
|
602
599
|
}
|
|
603
|
-
|
|
604
|
-
|
|
600
|
+
return nodes;
|
|
601
|
+
};
|
|
602
|
+
TreeComponent.prototype.countDepth = function (str) {
|
|
603
|
+
var e_1, _a;
|
|
604
|
+
var regex = /\[.*?\]/g;
|
|
605
|
+
var matches = str.match(regex);
|
|
606
|
+
var count = 1;
|
|
607
|
+
if (matches === null)
|
|
608
|
+
return count;
|
|
609
|
+
try {
|
|
610
|
+
for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
|
|
611
|
+
var match = matches_1_1.value;
|
|
612
|
+
count++;
|
|
613
|
+
}
|
|
605
614
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
615
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
616
|
+
finally {
|
|
617
|
+
try {
|
|
618
|
+
if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
|
|
619
|
+
}
|
|
620
|
+
finally { if (e_1) throw e_1.error; }
|
|
609
621
|
}
|
|
610
|
-
|
|
611
|
-
core.$appDigest();
|
|
622
|
+
return count;
|
|
612
623
|
};
|
|
613
|
-
//
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
624
|
+
// Renders the tree on to the dom
|
|
625
|
+
TreeComponent.prototype.renderTree = function () {
|
|
626
|
+
console.log(this.nodes, 'this.nodes');
|
|
627
|
+
if (this.nodes) {
|
|
628
|
+
this.nativeElement.setAttribute('id', this.name);
|
|
629
|
+
this.nodes = this.modifyObjects(this.nodes);
|
|
630
|
+
this.setTreeTemplate(this.treeClass);
|
|
631
|
+
if (this.nodelabel) {
|
|
632
|
+
var depth = 0;
|
|
633
|
+
if (this.nodelabel.includes("children")) {
|
|
634
|
+
depth = this.countDepth(this.nodelabel);
|
|
635
|
+
}
|
|
636
|
+
this.setNodeData(this.nodes, depth, depth, null, "name");
|
|
622
637
|
}
|
|
623
|
-
if (
|
|
624
|
-
|
|
638
|
+
if (this.nodeicon) {
|
|
639
|
+
var depth = 0;
|
|
640
|
+
if (this.nodeicon.includes("children")) {
|
|
641
|
+
depth = this.countDepth(this.nodeicon);
|
|
642
|
+
}
|
|
643
|
+
this.setNodeData(this.nodes, depth, depth, null, "icon");
|
|
625
644
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
645
|
+
if (this.nodechildren) {
|
|
646
|
+
var depth = this.countDepth(this.nodechildren);
|
|
647
|
+
if (depth > 1) {
|
|
648
|
+
this.nodes = this.setNodeChildren(this.nodes, depth, depth, null);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
this.setting.view['nodeClasses'] = this.setNodeclasses;
|
|
653
|
+
this.setting.callback["onClick"] = this.onClick.bind(this);
|
|
654
|
+
this.setting.callback["onExpand"] = this.onExpand.bind(this);
|
|
655
|
+
this.setting.callback["onCollapse"] = this.onCollapse.bind(this);
|
|
656
|
+
var zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.nodes);
|
|
657
|
+
$.fn.zTreeKeyboardNavigation(zTree, $('ul[name="' + this.name + '"]'), null, this.treeicon || defaultTreeIconClass);
|
|
633
658
|
};
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
659
|
+
TreeComponent.prototype.ngAfterViewInit = function () {
|
|
660
|
+
var _this = this;
|
|
661
|
+
setTimeout(function () {
|
|
662
|
+
_this.changeTreeIcons(_this.treeicon || defaultTreeIconClass);
|
|
663
|
+
}, 200);
|
|
637
664
|
};
|
|
638
|
-
return
|
|
665
|
+
return TreeComponent;
|
|
639
666
|
}(base.StylableComponent));
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
{ type: core
|
|
643
|
-
selector: '
|
|
667
|
+
TreeComponent.initializeProps = registerProps();
|
|
668
|
+
TreeComponent.decorators = [
|
|
669
|
+
{ type: core.Component, args: [{
|
|
670
|
+
selector: 'ul[wmTree]',
|
|
671
|
+
template: "<ul #wmTree class=\"ztree\" id=\"ztree\"></ul> ",
|
|
644
672
|
providers: [
|
|
645
|
-
base.provideAsWidgetRef(
|
|
646
|
-
]
|
|
673
|
+
base.provideAsWidgetRef(TreeComponent)
|
|
674
|
+
],
|
|
675
|
+
encapsulation: core.ViewEncapsulation.None
|
|
647
676
|
},] }
|
|
648
677
|
];
|
|
649
|
-
|
|
650
|
-
{ type: core
|
|
651
|
-
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['datavalue.bind',] }] },
|
|
652
|
-
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['nodelabel.bind',] }] },
|
|
653
|
-
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['nodeicon.bind',] }] },
|
|
654
|
-
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['nodechildren.bind',] }] },
|
|
655
|
-
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['nodeid.bind',] }] }
|
|
678
|
+
TreeComponent.ctorParameters = function () { return [
|
|
679
|
+
{ type: core.Injector }
|
|
656
680
|
]; };
|
|
657
681
|
|
|
658
682
|
var components = [
|
|
659
|
-
|
|
683
|
+
TreeComponent
|
|
660
684
|
];
|
|
661
685
|
var TreeModule = /** @class */ (function () {
|
|
662
686
|
function TreeModule() {
|
|
@@ -664,7 +688,7 @@
|
|
|
664
688
|
return TreeModule;
|
|
665
689
|
}());
|
|
666
690
|
TreeModule.decorators = [
|
|
667
|
-
{ type: core
|
|
691
|
+
{ type: core.NgModule, args: [{
|
|
668
692
|
imports: [
|
|
669
693
|
common.CommonModule,
|
|
670
694
|
base.WmComponentsModule
|
|
@@ -679,7 +703,7 @@
|
|
|
679
703
|
* Generated bundle index. Do not edit.
|
|
680
704
|
*/
|
|
681
705
|
|
|
682
|
-
exports.
|
|
706
|
+
exports.TreeComponent = TreeComponent;
|
|
683
707
|
exports.TreeModule = TreeModule;
|
|
684
708
|
exports["ɵa"] = registerProps;
|
|
685
709
|
|