@wavemaker/app-ng-runtime 11.4.0-next.28701 → 11.4.0-rc.121
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 +22 -8
- app-ng-runtime/components/base/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/base/esm2015/directives/show-in-device.directive.js +16 -5
- 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 +23 -9
- 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 +369 -245
- 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 +403 -0
- app-ng-runtime/components/basic/tree/esm2015/tree.module.js +3 -3
- app-ng-runtime/components/basic/tree/fesm2015/index.js +333 -240
- 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 +43 -0
- app-ng-runtime/components/chart/bundles/index.umd.js +1 -1
- app-ng-runtime/components/chart/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/chart/esm2015/chart.component.js +2 -2
- app-ng-runtime/components/chart/fesm2015/index.js +1 -1
- app-ng-runtime/components/chart/fesm2015/index.js.map +1 -1
- 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/containers/wizard/bundles/index.umd.js +43 -2
- app-ng-runtime/components/containers/wizard/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/containers/wizard/esm2015/wizard-step/wizard-step.props.js +3 -2
- app-ng-runtime/components/containers/wizard/esm2015/wizard.component.js +42 -2
- app-ng-runtime/components/containers/wizard/fesm2015/index.js +43 -2
- app-ng-runtime/components/containers/wizard/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/containers/wizard/index.metadata.json +1 -1
- app-ng-runtime/components/containers/wizard/wizard.component.d.ts +2 -0
- 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/core/bundles/index.umd.js +12 -2
- app-ng-runtime/core/bundles/index.umd.js.map +1 -1
- app-ng-runtime/core/esm2015/services/viewport.service.js +6 -4
- app-ng-runtime/core/esm2015/utils/utils.js +11 -3
- app-ng-runtime/core/fesm2015/index.js +15 -5
- app-ng-runtime/core/fesm2015/index.js.map +1 -1
- app-ng-runtime/core/index.metadata.json +1 -1
- app-ng-runtime/core/utils/utils.d.ts +2 -2
- 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/runtime/base/bundles/index.umd.js +164 -133
- app-ng-runtime/runtime/base/bundles/index.umd.js.map +1 -1
- app-ng-runtime/runtime/base/esm2015/components/app-component/app.component.js +2 -2
- app-ng-runtime/runtime/base/esm2015/public_api.js +2 -1
- app-ng-runtime/runtime/base/esm2015/runtime-base.module.js +3 -1
- app-ng-runtime/runtime/base/esm2015/services/app.service.js +3 -1
- app-ng-runtime/runtime/base/esm2015/services/pipe.service.js +33 -0
- app-ng-runtime/runtime/base/fesm2015/index.js +149 -120
- app-ng-runtime/runtime/base/fesm2015/index.js.map +1 -1
- app-ng-runtime/runtime/base/index.metadata.json +1 -1
- app-ng-runtime/runtime/base/public_api.d.ts +1 -0
- app-ng-runtime/runtime/base/services/pipe.service.d.ts +9 -0
- 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 +37 -22
- app-ng-runtime/variables/bundles/index.umd.js.map +1 -1
- app-ng-runtime/variables/esm2015/manager/action/notification-action.manager.js +29 -24
- app-ng-runtime/variables/esm2015/service/variables.service.js +8 -1
- app-ng-runtime/variables/fesm2015/index.js +35 -24
- app-ng-runtime/variables/fesm2015/index.js.map +1 -1
- app-ng-runtime/variables/index.metadata.json +1 -1
- app-ng-runtime/variables/manager/action/notification-action.manager.d.ts +1 -0
- 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
|
@@ -342,321 +342,445 @@
|
|
|
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: false
|
|
355
|
+
},
|
|
356
|
+
key: {
|
|
357
|
+
children: 'children',
|
|
358
|
+
name: 'label'
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
view: {
|
|
362
|
+
dblClickExpand: false,
|
|
363
|
+
fontCss: {
|
|
364
|
+
'font-awesome': true
|
|
365
|
+
},
|
|
366
|
+
switchIcon: {},
|
|
367
|
+
},
|
|
368
|
+
check: {},
|
|
369
|
+
callback: {}
|
|
370
|
+
};
|
|
386
371
|
base.styler(_this.nativeElement, _this, base.APPLY_STYLES_TYPE.CONTAINER);
|
|
387
|
-
_this.bindEvents();
|
|
388
372
|
return _this;
|
|
389
373
|
}
|
|
390
|
-
|
|
374
|
+
TreeComponent.prototype.onPropertyChange = function (key, nv, ov) {
|
|
391
375
|
switch (key) {
|
|
392
376
|
case 'dataset':
|
|
393
377
|
this.nodes = this.getNodes(nv);
|
|
394
|
-
this.
|
|
378
|
+
if (this.level > 0) {
|
|
379
|
+
this.expandTree(this.level, this.nodes, 0);
|
|
380
|
+
}
|
|
381
|
+
this.renderTree();
|
|
382
|
+
break;
|
|
383
|
+
case 'levels':
|
|
384
|
+
if (nv > 0) {
|
|
385
|
+
this.level = nv;
|
|
386
|
+
}
|
|
387
|
+
this.renderTree();
|
|
388
|
+
break;
|
|
389
|
+
case 'treeicons':
|
|
390
|
+
this.treeicon = nv;
|
|
395
391
|
this.renderTree();
|
|
396
392
|
break;
|
|
397
|
-
case 'nodeicon':
|
|
398
393
|
case 'nodelabel':
|
|
394
|
+
this.setting.data.key.name = this.labelKey;
|
|
395
|
+
this.renderTree();
|
|
396
|
+
break;
|
|
399
397
|
case 'nodechildren':
|
|
400
|
-
|
|
398
|
+
this.setting.data.key.children = this.childrenKey;
|
|
401
399
|
this.renderTree();
|
|
402
400
|
break;
|
|
403
|
-
case '
|
|
404
|
-
this.
|
|
401
|
+
case 'nodeicon':
|
|
402
|
+
this.nodeicon = this.iconKey;
|
|
403
|
+
this.renderTree();
|
|
405
404
|
break;
|
|
406
|
-
case '
|
|
407
|
-
this.
|
|
405
|
+
case 'orderby':
|
|
406
|
+
this.renderTree();
|
|
407
|
+
break;
|
|
408
|
+
case 'class':
|
|
409
|
+
this.treeClass = nv;
|
|
410
|
+
this.renderTree();
|
|
408
411
|
break;
|
|
409
412
|
default:
|
|
410
413
|
_super.prototype.onPropertyChange.call(this, key, nv, ov);
|
|
414
|
+
break;
|
|
411
415
|
}
|
|
412
416
|
};
|
|
413
|
-
|
|
417
|
+
// expands the tree nodes if the property is selected.
|
|
418
|
+
TreeComponent.prototype.expandTree = function (level, node, childLevel) {
|
|
414
419
|
var _this = this;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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);
|
|
420
|
+
node.map(function (childNode) {
|
|
421
|
+
var children = _this.getChildren(childNode);
|
|
422
|
+
if (children && !("open" in childNode) && childLevel < level) {
|
|
423
|
+
childNode["open"] = true;
|
|
424
|
+
_this.expandTree(level, children, childLevel + 1);
|
|
469
425
|
}
|
|
470
426
|
else {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
$li.addClass('leaf-node');
|
|
427
|
+
childLevel = 0;
|
|
428
|
+
return;
|
|
475
429
|
}
|
|
476
430
|
});
|
|
477
431
|
};
|
|
478
|
-
|
|
432
|
+
// sets the template for the tree based on the property selected.
|
|
433
|
+
TreeComponent.prototype.setTreeTemplate = function (value) {
|
|
434
|
+
if (value === 'Classic') {
|
|
435
|
+
this.setting.check["enable"] = false;
|
|
436
|
+
}
|
|
437
|
+
else if (value === 'Checkbox') {
|
|
438
|
+
this.setting.check["enable"] = true;
|
|
439
|
+
this.setting.check["chkStyle"] = 'checkbox';
|
|
440
|
+
}
|
|
441
|
+
else if (value === 'Radio') {
|
|
442
|
+
this.setting.check["enable"] = true;
|
|
443
|
+
this.setting.check["chkStyle"] = 'radio';
|
|
444
|
+
this.setting.check["radioType"] = "all";
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
// extracts nodes from string format
|
|
448
|
+
TreeComponent.prototype.getNodesFromString = function (value) {
|
|
479
449
|
return value.split(',').map(function (item) {
|
|
480
450
|
return {
|
|
481
451
|
'label': item && item.trim()
|
|
482
452
|
};
|
|
483
453
|
});
|
|
484
454
|
};
|
|
485
|
-
|
|
455
|
+
// gets the nodes and orders the nodes if required
|
|
456
|
+
TreeComponent.prototype.getNodes = function (newVal) {
|
|
486
457
|
var nodes;
|
|
487
|
-
if (_.
|
|
458
|
+
if (_.isArray(newVal)) {
|
|
459
|
+
nodes = base.getOrderedDataset(newVal, this.orderby);
|
|
460
|
+
}
|
|
461
|
+
else if (_.isObject(newVal)) {
|
|
462
|
+
nodes = [newVal];
|
|
463
|
+
}
|
|
464
|
+
else if (_.isString(newVal) && !_.isEmpty(newVal)) {
|
|
488
465
|
newVal = newVal.trim();
|
|
489
466
|
if (newVal) {
|
|
490
467
|
nodes = this.getNodesFromString(newVal);
|
|
491
468
|
}
|
|
492
469
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
470
|
+
return nodes;
|
|
471
|
+
};
|
|
472
|
+
// adds class to the nodes inorder to add icons to respective node.
|
|
473
|
+
TreeComponent.prototype.setNodeclasses = function (treeId, treeNode) {
|
|
474
|
+
return treeNode.icon ? { add: ["" + treeNode.icon] } : '';
|
|
475
|
+
};
|
|
476
|
+
;
|
|
477
|
+
// Sets the node label with any icon if bound to
|
|
478
|
+
TreeComponent.prototype.setNodeData = function (nodes, depth, level, parentNode, type) {
|
|
479
|
+
var _this = this;
|
|
480
|
+
if (depth === 0) {
|
|
481
|
+
nodes.map(function (node) {
|
|
482
|
+
var children = _this.getChildren(node);
|
|
483
|
+
if (children) {
|
|
484
|
+
_this.setNodeData(children, depth, level, parentNode, type);
|
|
485
|
+
}
|
|
486
|
+
if (node.icon && _this.nodelabel == 'icon') {
|
|
487
|
+
node[type] = node.icon;
|
|
488
|
+
}
|
|
489
|
+
else if (node.name && _this.nodelabel == 'name') {
|
|
490
|
+
node[type] = node.name;
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
496
|
}
|
|
497
|
-
else
|
|
498
|
-
nodes
|
|
497
|
+
else {
|
|
498
|
+
nodes.map(function (node) {
|
|
499
|
+
var children = _this.getChildren(node);
|
|
500
|
+
if (children && level > 1) {
|
|
501
|
+
if (depth === level) {
|
|
502
|
+
parentNode = node;
|
|
503
|
+
}
|
|
504
|
+
_this.setNodeData(children, depth, level - 1, parentNode, type);
|
|
505
|
+
}
|
|
506
|
+
if (level === 1 && (type === "name" ? _this.nodelabel.includes("label") || _this.nodelabel.includes("name") : _this.nodeicon.includes("label") || _this.nodeicon.includes("name"))) {
|
|
507
|
+
parentNode[type] = node.name || node.label;
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
else if (level === 1 && (node.icon !== undefined) && (type === "name" ? _this.nodelabel.includes("icon") : _this.nodeicon.includes("icon"))) {
|
|
511
|
+
parentNode[type] = node.icon;
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
});
|
|
499
518
|
}
|
|
500
|
-
return nodes;
|
|
501
519
|
};
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
520
|
+
// adds tree icons to the nodes on load of the tree
|
|
521
|
+
TreeComponent.prototype.changeTreeIcons = function (nv) {
|
|
522
|
+
var eleClose = $('ul[name="' + this.name + '"] li span.button.switch');
|
|
523
|
+
$(eleClose).map(function (idx, ele) {
|
|
524
|
+
$(ele).addClass(nv);
|
|
525
|
+
$(ele).on("click", function (e) {
|
|
526
|
+
setTimeout(function () {
|
|
527
|
+
$(ele).addClass(nv);
|
|
528
|
+
}, 0);
|
|
529
|
+
});
|
|
530
|
+
});
|
|
531
|
+
};
|
|
532
|
+
TreeComponent.prototype.getPath = function (treeNode, path) {
|
|
533
|
+
if (treeNode.getParentNode() === null) {
|
|
534
|
+
path = "/" + treeNode[this.labelKey] + path;
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode[this.labelKey];
|
|
538
|
+
}
|
|
539
|
+
return path;
|
|
508
540
|
};
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
541
|
+
// binds the click event to all nodes to open the child nodes
|
|
542
|
+
TreeComponent.prototype.onClick = function (event, treeId, treeNode, clickFlag) {
|
|
543
|
+
if (this.nodeclick === "expand") {
|
|
544
|
+
var nodes = this.treeObj.getSelectedNodes();
|
|
545
|
+
if (nodes.length > 0) {
|
|
546
|
+
this.expandNode(nodes[0], !nodes[0].open, true);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
var path = this.getPath(treeNode, "");
|
|
550
|
+
var eventParams = {
|
|
551
|
+
'$event': event,
|
|
552
|
+
"$item": treeNode,
|
|
553
|
+
"$path": path
|
|
554
|
+
};
|
|
555
|
+
this.setSelectedItem(treeNode);
|
|
556
|
+
this.invokeEventCallback('select', eventParams);
|
|
557
|
+
};
|
|
558
|
+
// Adds tree icon classes to child nodes when expanded
|
|
559
|
+
TreeComponent.prototype.onExpand = function (event, treeId, treeNode) {
|
|
560
|
+
var self = this;
|
|
561
|
+
var path = this.getPath(treeNode, "");
|
|
562
|
+
var eventParams = {
|
|
563
|
+
'$event': event,
|
|
564
|
+
"$item": treeNode,
|
|
565
|
+
"$path": path
|
|
566
|
+
};
|
|
567
|
+
this.invokeEventCallback('expand', eventParams);
|
|
568
|
+
var children = this.getChildren(treeNode);
|
|
569
|
+
children === null || children === void 0 ? void 0 : children.map(function (el) {
|
|
570
|
+
if (el.isParent) {
|
|
571
|
+
var ele_1 = $("#" + el.tId + "_switch");
|
|
572
|
+
$(ele_1).addClass(self.treeicon || defaultTreeIconClass);
|
|
573
|
+
$(ele_1).on("click", function (e) {
|
|
574
|
+
setTimeout(function () {
|
|
575
|
+
$(ele_1).addClass(self.treeicon || defaultTreeIconClass);
|
|
576
|
+
}, 0);
|
|
577
|
+
});
|
|
578
|
+
}
|
|
518
579
|
});
|
|
580
|
+
};
|
|
581
|
+
TreeComponent.prototype.onCollapse = function (event, treeId, treeNode) {
|
|
582
|
+
var path = this.getPath(treeNode, "");
|
|
519
583
|
var eventParams = {
|
|
520
|
-
'$event':
|
|
521
|
-
"$item":
|
|
584
|
+
'$event': event,
|
|
585
|
+
"$item": treeNode,
|
|
522
586
|
"$path": path
|
|
523
587
|
};
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
else if ($i.hasClass('expanded')) {
|
|
530
|
-
$i.removeClass("expanded " + treeIcons.expanded).addClass("collapsed " + treeIcons.collapsed);
|
|
531
|
-
$li.removeClass('expanded').addClass('collapsed');
|
|
532
|
-
this.invokeEventCallback('collapse', eventParams);
|
|
533
|
-
}
|
|
588
|
+
this.invokeEventCallback('collapse', eventParams);
|
|
589
|
+
};
|
|
590
|
+
TreeComponent.prototype.getChildren = function (node) {
|
|
591
|
+
return node[this.childrenKey];
|
|
534
592
|
};
|
|
535
|
-
|
|
593
|
+
Object.defineProperty(TreeComponent.prototype, "childrenKey", {
|
|
594
|
+
get: function () {
|
|
595
|
+
if (!this.nodechildren) {
|
|
596
|
+
return 'children';
|
|
597
|
+
}
|
|
598
|
+
var depth = this.countDepth(this.nodechildren);
|
|
599
|
+
return depth ? this.nodechildren.split('.').pop() : this.nodechildren;
|
|
600
|
+
},
|
|
601
|
+
enumerable: false,
|
|
602
|
+
configurable: true
|
|
603
|
+
});
|
|
604
|
+
Object.defineProperty(TreeComponent.prototype, "labelKey", {
|
|
605
|
+
get: function () {
|
|
606
|
+
if (!this.nodelabel) {
|
|
607
|
+
return 'label';
|
|
608
|
+
}
|
|
609
|
+
var depth = this.countDepth(this.nodelabel);
|
|
610
|
+
return depth ? this.nodelabel.split('.').pop() : this.nodelabel;
|
|
611
|
+
},
|
|
612
|
+
enumerable: false,
|
|
613
|
+
configurable: true
|
|
614
|
+
});
|
|
615
|
+
Object.defineProperty(TreeComponent.prototype, "iconKey", {
|
|
616
|
+
get: function () {
|
|
617
|
+
if (!this.nodeicon) {
|
|
618
|
+
return 'icon';
|
|
619
|
+
}
|
|
620
|
+
var depth = this.countDepth(this.nodeicon);
|
|
621
|
+
return depth ? this.nodeicon.split('.').pop() : this.nodeicon;
|
|
622
|
+
},
|
|
623
|
+
enumerable: false,
|
|
624
|
+
configurable: true
|
|
625
|
+
});
|
|
626
|
+
Object.defineProperty(TreeComponent.prototype, "treeObj", {
|
|
627
|
+
get: function () {
|
|
628
|
+
return $.fn.zTree.getZTreeObj("" + this.name);
|
|
629
|
+
},
|
|
630
|
+
enumerable: false,
|
|
631
|
+
configurable: true
|
|
632
|
+
});
|
|
633
|
+
// function to support backward compatibility of objects
|
|
634
|
+
TreeComponent.prototype.modifyObjects = function (array) {
|
|
536
635
|
var _this = this;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
if (this.nodes && this.nodes.length) {
|
|
544
|
-
docFrag = document.createDocumentFragment();
|
|
545
|
-
this.constructNodes(this.nodes, $(docFrag), levels, 0, this.datavalue);
|
|
546
|
-
$el.append(docFrag);
|
|
547
|
-
}
|
|
548
|
-
if (this._selectNode) {
|
|
549
|
-
$li = this._selectNode;
|
|
550
|
-
$li.addClass('selected');
|
|
551
|
-
data = $li.data('nodedata');
|
|
552
|
-
$liPath = this.findSelectedNodeParent($li);
|
|
553
|
-
if (!$liPath.length) {
|
|
554
|
-
$liPath = $li;
|
|
636
|
+
array.forEach(function (obj) {
|
|
637
|
+
obj.icon = obj[_this.nodeicon];
|
|
638
|
+
var children = _this.getChildren(obj);
|
|
639
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
640
|
+
_this.modifyObjects(children);
|
|
555
641
|
}
|
|
556
|
-
|
|
557
|
-
.each(function (i, el) {
|
|
558
|
-
var $current = $(el), $i = $current.children('i.collapsed'), $title = $current.children('.title');
|
|
559
|
-
_this.toggleExpandCollapseNode(undefined, $i, $current);
|
|
560
|
-
path = "/" + ($title.text() + path);
|
|
561
|
-
});
|
|
562
|
-
this.selecteditem = core.getClonedObject(data) || {};
|
|
563
|
-
this.selecteditem.path = path;
|
|
564
|
-
this.invokeEventCallback('select', { $event: undefined, $item: data, $path: path });
|
|
565
|
-
core.$appDigest();
|
|
566
|
-
}
|
|
642
|
+
});
|
|
567
643
|
};
|
|
568
|
-
|
|
644
|
+
// sets the node children property to parent nodes
|
|
645
|
+
TreeComponent.prototype.setNodeChildren = function (nodes, depth, level, parentNode) {
|
|
569
646
|
var _this = this;
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
$el.find('.selected').removeClass('selected');
|
|
573
|
-
if (!$li.length) {
|
|
574
|
-
return;
|
|
647
|
+
if (depth <= 0) {
|
|
648
|
+
return nodes;
|
|
575
649
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
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);
|
|
592
|
-
});
|
|
593
|
-
this.selecteditem = core.getClonedObject(data) || {};
|
|
594
|
-
this.selecteditem.path = path;
|
|
595
|
-
if (target) {
|
|
596
|
-
if (this.nodeid || this.bindnodeid) {
|
|
597
|
-
this.datavalue = base.getEvaluatedData(data, { field: this.nodeid, bindExpression: this.bindnodeid }, this.viewParent);
|
|
650
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
651
|
+
var node = nodes[i];
|
|
652
|
+
if (depth === level) {
|
|
653
|
+
parentNode = nodes[i];
|
|
598
654
|
}
|
|
599
|
-
|
|
600
|
-
|
|
655
|
+
var children = this.getChildren(node);
|
|
656
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
657
|
+
if (level === 1) {
|
|
658
|
+
parentNode[this.childrenKey] = children.map(function (child) {
|
|
659
|
+
var _a;
|
|
660
|
+
return (_a = {}, _a[_this.labelKey] = child[_this.labelKey], _a[_this.childrenKey] = _this.getChildren(child), _a.icon = child[_this.iconKey], _a);
|
|
661
|
+
});
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
this.setNodeChildren(children, depth, level - 1, parentNode);
|
|
666
|
+
}
|
|
601
667
|
}
|
|
602
668
|
}
|
|
603
|
-
|
|
604
|
-
|
|
669
|
+
return nodes;
|
|
670
|
+
};
|
|
671
|
+
TreeComponent.prototype.countDepth = function (str) {
|
|
672
|
+
var e_1, _a;
|
|
673
|
+
var regex = /\[.*?\]/g;
|
|
674
|
+
var matches = str.match(regex);
|
|
675
|
+
var count = 1;
|
|
676
|
+
if (matches === null)
|
|
677
|
+
return count;
|
|
678
|
+
try {
|
|
679
|
+
for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
|
|
680
|
+
var match = matches_1_1.value;
|
|
681
|
+
count++;
|
|
682
|
+
}
|
|
605
683
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
684
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
685
|
+
finally {
|
|
686
|
+
try {
|
|
687
|
+
if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
|
|
688
|
+
}
|
|
689
|
+
finally { if (e_1) throw e_1.error; }
|
|
609
690
|
}
|
|
610
|
-
|
|
611
|
-
core.$appDigest();
|
|
691
|
+
return count;
|
|
612
692
|
};
|
|
613
|
-
//
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
if (target.is('span.title')) { // select the node only if it is nodelabel
|
|
620
|
-
_this.selecteditem = {};
|
|
621
|
-
_this.selectNode(evt, li);
|
|
693
|
+
// Renders the tree on to the dom
|
|
694
|
+
TreeComponent.prototype.renderTree = function () {
|
|
695
|
+
if (this.nodes) {
|
|
696
|
+
this.nativeElement.setAttribute('id', this.name);
|
|
697
|
+
if (this.nodeicon && this.nodeicon !== 'icon') {
|
|
698
|
+
this.modifyObjects(this.nodes);
|
|
622
699
|
}
|
|
623
|
-
|
|
624
|
-
|
|
700
|
+
this.setTreeTemplate(this.treeClass);
|
|
701
|
+
if (this.nodelabel) {
|
|
702
|
+
var depth = 0;
|
|
703
|
+
if (this.nodelabel.includes("children")) {
|
|
704
|
+
depth = this.countDepth(this.nodelabel);
|
|
705
|
+
}
|
|
706
|
+
this.setNodeData(this.nodes, depth, depth, null, "name");
|
|
625
707
|
}
|
|
626
|
-
|
|
708
|
+
if (this.nodeicon) {
|
|
709
|
+
var depth = 0;
|
|
710
|
+
if (this.nodeicon.includes("children")) {
|
|
711
|
+
depth = this.countDepth(this.nodeicon);
|
|
712
|
+
}
|
|
713
|
+
this.setNodeData(this.nodes, depth, depth, null, "icon");
|
|
714
|
+
}
|
|
715
|
+
if (this.nodechildren) {
|
|
716
|
+
var depth = this.countDepth(this.nodechildren);
|
|
717
|
+
if (depth > 1) {
|
|
718
|
+
this.nodes = this.setNodeChildren(this.nodes, depth, depth, null);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
this.setting.view['nodeClasses'] = this.setNodeclasses;
|
|
723
|
+
this.setting.callback["onClick"] = this.onClick.bind(this);
|
|
724
|
+
this.setting.callback["onExpand"] = this.onExpand.bind(this);
|
|
725
|
+
this.setting.callback["onCollapse"] = this.onCollapse.bind(this);
|
|
726
|
+
var zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.nodes);
|
|
727
|
+
$.fn.zTreeKeyboardNavigation(zTree, $('ul[name="' + this.name + '"]'), null, this.treeicon || defaultTreeIconClass);
|
|
627
728
|
};
|
|
628
|
-
|
|
629
|
-
|
|
729
|
+
TreeComponent.prototype.setSelectedItem = function (treeNode) {
|
|
730
|
+
this.selecteditem = core.getClonedObject(treeNode) || {};
|
|
731
|
+
this.selecteditem.path = this.getPath(treeNode, "");
|
|
732
|
+
var deSelectElm = $("li[treenode].selected");
|
|
733
|
+
deSelectElm.removeClass('selected');
|
|
734
|
+
var selectElm = $("#" + treeNode.tId + ":has(.curSelectedNode)");
|
|
735
|
+
selectElm.addClass('selected');
|
|
630
736
|
};
|
|
631
|
-
|
|
632
|
-
this.
|
|
737
|
+
TreeComponent.prototype.expandNode = function (node, expand, eventFlag) {
|
|
738
|
+
this.treeObj.expandNode(node, expand, false, false, eventFlag);
|
|
739
|
+
var el = $("#" + node.tId + "_switch");
|
|
740
|
+
$(el).addClass(this.treeicon || defaultTreeIconClass);
|
|
633
741
|
};
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
742
|
+
TreeComponent.prototype.ngAfterViewInit = function () {
|
|
743
|
+
var _this = this;
|
|
744
|
+
setTimeout(function () {
|
|
745
|
+
_this.changeTreeIcons(_this.treeicon || defaultTreeIconClass);
|
|
746
|
+
if (_this.datavalue) {
|
|
747
|
+
var nodes = _this.treeObj.getNodes();
|
|
748
|
+
var selectNode = void 0;
|
|
749
|
+
if (_this.datavalue === 'FirstNode') {
|
|
750
|
+
if (nodes.length) {
|
|
751
|
+
selectNode = nodes[0];
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
if (_this.datavalue === 'LastNode') {
|
|
755
|
+
if (nodes.length) {
|
|
756
|
+
selectNode = nodes[nodes.length - 1];
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
_this.treeObj.selectNode(selectNode, false);
|
|
760
|
+
_this.setSelectedItem(selectNode);
|
|
761
|
+
_this.expandNode(selectNode, true, false);
|
|
762
|
+
}
|
|
763
|
+
}, 200);
|
|
637
764
|
};
|
|
638
|
-
return
|
|
765
|
+
return TreeComponent;
|
|
639
766
|
}(base.StylableComponent));
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
{ type: core$1.
|
|
643
|
-
selector: '
|
|
767
|
+
TreeComponent.initializeProps = registerProps();
|
|
768
|
+
TreeComponent.decorators = [
|
|
769
|
+
{ type: core$1.Component, args: [{
|
|
770
|
+
selector: 'ul[wmTree]',
|
|
771
|
+
template: "<ul #wmTree class=\"ztree\" id=\"ztree\"></ul> ",
|
|
644
772
|
providers: [
|
|
645
|
-
base.provideAsWidgetRef(
|
|
646
|
-
]
|
|
773
|
+
base.provideAsWidgetRef(TreeComponent)
|
|
774
|
+
],
|
|
775
|
+
encapsulation: core$1.ViewEncapsulation.None
|
|
647
776
|
},] }
|
|
648
777
|
];
|
|
649
|
-
|
|
650
|
-
{ type: core$1.Injector }
|
|
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',] }] }
|
|
778
|
+
TreeComponent.ctorParameters = function () { return [
|
|
779
|
+
{ type: core$1.Injector }
|
|
656
780
|
]; };
|
|
657
781
|
|
|
658
782
|
var components = [
|
|
659
|
-
|
|
783
|
+
TreeComponent
|
|
660
784
|
];
|
|
661
785
|
var TreeModule = /** @class */ (function () {
|
|
662
786
|
function TreeModule() {
|
|
@@ -679,7 +803,7 @@
|
|
|
679
803
|
* Generated bundle index. Do not edit.
|
|
680
804
|
*/
|
|
681
805
|
|
|
682
|
-
exports.
|
|
806
|
+
exports.TreeComponent = TreeComponent;
|
|
683
807
|
exports.TreeModule = TreeModule;
|
|
684
808
|
exports["ɵa"] = registerProps;
|
|
685
809
|
|