@wavemaker/app-ng-runtime 11.4.0-rc.5351 → 11.4.1-next.140982
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/components/basic/tree/bundles/index.umd.js +132 -236
- app-ng-runtime/components/basic/tree/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/basic/tree/esm2015/tree.component.js +135 -208
- app-ng-runtime/components/basic/tree/fesm2015/index.js +134 -207
- 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/tree.component.d.ts +25 -21
- app-ng-runtime/components/chart/bundles/index.umd.js +6 -1
- app-ng-runtime/components/chart/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/chart/esm2015/chart.component.js +7 -2
- app-ng-runtime/components/chart/fesm2015/index.js +6 -1
- app-ng-runtime/components/chart/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/chart/index.metadata.json +1 -1
- app-ng-runtime/components/containers/tabs/bundles/index.umd.js +6 -0
- 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 +7 -1
- app-ng-runtime/components/containers/tabs/fesm2015/index.js +6 -0
- app-ng-runtime/components/containers/tabs/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/containers/tabs/index.metadata.json +1 -1
- app-ng-runtime/components/containers/tabs/tab-pane/tab-pane.component.d.ts +2 -0
- app-ng-runtime/components/data/form/bundles/index.umd.js +9 -3
- app-ng-runtime/components/data/form/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/data/form/esm2015/form.component.js +11 -5
- app-ng-runtime/components/data/form/fesm2015/index.js +10 -4
- app-ng-runtime/components/data/form/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/data/form/index.metadata.json +1 -1
- app-ng-runtime/components/data/pagination/bundles/index.umd.js +0 -1
- app-ng-runtime/components/data/pagination/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/data/pagination/esm2015/pagination.component.js +1 -2
- app-ng-runtime/components/data/pagination/fesm2015/index.js +0 -1
- 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/input/default/bundles/index.umd.js +15 -2
- app-ng-runtime/components/input/default/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/input/default/checkbox/checkbox.component.d.ts +5 -0
- app-ng-runtime/components/input/default/esm2015/checkbox/checkbox.component.js +12 -2
- app-ng-runtime/components/input/default/esm2015/checkbox/checkbox.props.js +5 -2
- app-ng-runtime/components/input/default/fesm2015/index.js +15 -2
- app-ng-runtime/components/input/default/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/input/default/index.metadata.json +1 -1
- app-ng-runtime/package.json +1 -1
|
@@ -346,16 +346,17 @@
|
|
|
346
346
|
var defaultTreeIconClass = 'plus-minus';
|
|
347
347
|
var TreeComponent = /** @class */ (function (_super) {
|
|
348
348
|
__extends(TreeComponent, _super);
|
|
349
|
-
function TreeComponent(inj) {
|
|
349
|
+
function TreeComponent(inj, binddatavalue, bindnodelabel, bindnodeicon, bindnodechildren, bindnodeid) {
|
|
350
350
|
var _this = _super.call(this, inj, WIDGET_INFO) || this;
|
|
351
|
+
_this.binddatavalue = binddatavalue;
|
|
352
|
+
_this.bindnodelabel = bindnodelabel;
|
|
353
|
+
_this.bindnodeicon = bindnodeicon;
|
|
354
|
+
_this.bindnodechildren = bindnodechildren;
|
|
355
|
+
_this.bindnodeid = bindnodeid;
|
|
351
356
|
_this.setting = {
|
|
352
357
|
data: {
|
|
353
358
|
simpleData: {
|
|
354
359
|
enable: false
|
|
355
|
-
},
|
|
356
|
-
key: {
|
|
357
|
-
children: 'children',
|
|
358
|
-
name: 'label'
|
|
359
360
|
}
|
|
360
361
|
},
|
|
361
362
|
view: {
|
|
@@ -369,46 +370,46 @@
|
|
|
369
370
|
callback: {}
|
|
370
371
|
};
|
|
371
372
|
base.styler(_this.nativeElement, _this, base.APPLY_STYLES_TYPE.CONTAINER);
|
|
373
|
+
_this.setting.view['nodeClasses'] = _this.setNodeClasses;
|
|
374
|
+
_this.setting.callback["onClick"] = _this.onClick.bind(_this);
|
|
375
|
+
_this.setting.callback["onExpand"] = _this.onExpand.bind(_this);
|
|
376
|
+
_this.setting.callback["onCollapse"] = _this.onCollapse.bind(_this);
|
|
372
377
|
return _this;
|
|
373
378
|
}
|
|
374
379
|
TreeComponent.prototype.onPropertyChange = function (key, nv, ov) {
|
|
375
380
|
switch (key) {
|
|
376
381
|
case 'dataset':
|
|
377
382
|
this.nodes = this.getNodes(nv);
|
|
378
|
-
if (this.level > 0) {
|
|
379
|
-
this.expandTree(this.level, this.nodes, 0);
|
|
380
|
-
}
|
|
381
383
|
this.renderTree();
|
|
382
384
|
break;
|
|
383
385
|
case 'levels':
|
|
384
|
-
|
|
385
|
-
this.level = nv;
|
|
386
|
-
}
|
|
386
|
+
this.level = nv;
|
|
387
387
|
this.renderTree();
|
|
388
388
|
break;
|
|
389
|
-
case '
|
|
390
|
-
this.
|
|
389
|
+
case 'nodeicon':
|
|
390
|
+
this.nodeicon = nv;
|
|
391
391
|
this.renderTree();
|
|
392
392
|
break;
|
|
393
393
|
case 'nodelabel':
|
|
394
|
-
this.
|
|
394
|
+
this.nodelabel = nv;
|
|
395
395
|
this.renderTree();
|
|
396
396
|
break;
|
|
397
397
|
case 'nodechildren':
|
|
398
|
-
this.
|
|
398
|
+
this.nodechildren = nv;
|
|
399
399
|
this.renderTree();
|
|
400
400
|
break;
|
|
401
|
-
case '
|
|
402
|
-
this.
|
|
401
|
+
case 'orderby':
|
|
402
|
+
this.orderby = nv;
|
|
403
403
|
this.renderTree();
|
|
404
404
|
break;
|
|
405
|
-
case '
|
|
405
|
+
case 'treeicons':
|
|
406
|
+
this.treeicons = nv;
|
|
406
407
|
this.renderTree();
|
|
407
408
|
break;
|
|
408
409
|
case 'class':
|
|
409
410
|
this.treeClass = nv;
|
|
411
|
+
this.setTreeTemplate(this.treeClass);
|
|
410
412
|
this.renderTree();
|
|
411
|
-
break;
|
|
412
413
|
default:
|
|
413
414
|
_super.prototype.onPropertyChange.call(this, key, nv, ov);
|
|
414
415
|
break;
|
|
@@ -418,9 +419,9 @@
|
|
|
418
419
|
TreeComponent.prototype.expandTree = function (level, node, childLevel) {
|
|
419
420
|
var _this = this;
|
|
420
421
|
node.map(function (childNode) {
|
|
421
|
-
var children =
|
|
422
|
-
if (children &&
|
|
423
|
-
childNode
|
|
422
|
+
var children = childNode.children;
|
|
423
|
+
if (children && childLevel < level) {
|
|
424
|
+
childNode.open = true;
|
|
424
425
|
_this.expandTree(level, children, childLevel + 1);
|
|
425
426
|
}
|
|
426
427
|
else {
|
|
@@ -431,14 +432,15 @@
|
|
|
431
432
|
};
|
|
432
433
|
// sets the template for the tree based on the property selected.
|
|
433
434
|
TreeComponent.prototype.setTreeTemplate = function (value) {
|
|
434
|
-
|
|
435
|
+
var classList = value.split(" ");
|
|
436
|
+
if (classList.includes('Classic')) {
|
|
435
437
|
this.setting.check["enable"] = false;
|
|
436
438
|
}
|
|
437
|
-
else if (
|
|
439
|
+
else if (classList.includes('Checkbox')) {
|
|
438
440
|
this.setting.check["enable"] = true;
|
|
439
441
|
this.setting.check["chkStyle"] = 'checkbox';
|
|
440
442
|
}
|
|
441
|
-
else if (
|
|
443
|
+
else if (classList.includes('Radio')) {
|
|
442
444
|
this.setting.check["enable"] = true;
|
|
443
445
|
this.setting.check["chkStyle"] = 'radio';
|
|
444
446
|
this.setting.check["radioType"] = "all";
|
|
@@ -470,53 +472,10 @@
|
|
|
470
472
|
return nodes;
|
|
471
473
|
};
|
|
472
474
|
// adds class to the nodes inorder to add icons to respective node.
|
|
473
|
-
TreeComponent.prototype.
|
|
475
|
+
TreeComponent.prototype.setNodeClasses = function (treeId, treeNode) {
|
|
474
476
|
return treeNode.icon ? { add: ["" + treeNode.icon] } : '';
|
|
475
477
|
};
|
|
476
478
|
;
|
|
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
|
-
}
|
|
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
|
-
});
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
479
|
// adds tree icons to the nodes on load of the tree
|
|
521
480
|
TreeComponent.prototype.changeTreeIcons = function (nv) {
|
|
522
481
|
var eleClose = $('ul[name="' + this.name + '"] li span.button.switch');
|
|
@@ -529,31 +488,25 @@
|
|
|
529
488
|
});
|
|
530
489
|
});
|
|
531
490
|
};
|
|
491
|
+
// Returns the node path
|
|
532
492
|
TreeComponent.prototype.getPath = function (treeNode, path) {
|
|
533
493
|
if (treeNode.getParentNode() === null) {
|
|
534
|
-
path = "/" + treeNode
|
|
494
|
+
path = "/" + treeNode.name + path;
|
|
535
495
|
}
|
|
536
496
|
else {
|
|
537
|
-
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode
|
|
497
|
+
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode.name;
|
|
538
498
|
}
|
|
539
499
|
return path;
|
|
540
500
|
};
|
|
541
501
|
// binds the click event to all nodes to open the child nodes
|
|
542
502
|
TreeComponent.prototype.onClick = function (event, treeId, treeNode, clickFlag) {
|
|
543
503
|
if (this.nodeclick === "expand") {
|
|
544
|
-
var nodes = this.
|
|
504
|
+
var nodes = this.zTree.getSelectedNodes();
|
|
545
505
|
if (nodes.length > 0) {
|
|
546
506
|
this.expandNode(nodes[0], !nodes[0].open, true);
|
|
547
507
|
}
|
|
548
508
|
}
|
|
549
|
-
|
|
550
|
-
var eventParams = {
|
|
551
|
-
'$event': event,
|
|
552
|
-
"$item": treeNode,
|
|
553
|
-
"$path": path
|
|
554
|
-
};
|
|
555
|
-
this.setSelectedItem(treeNode);
|
|
556
|
-
this.invokeEventCallback('select', eventParams);
|
|
509
|
+
this.selectNode(event, treeNode);
|
|
557
510
|
};
|
|
558
511
|
// Adds tree icon classes to child nodes when expanded
|
|
559
512
|
TreeComponent.prototype.onExpand = function (event, treeId, treeNode) {
|
|
@@ -561,18 +514,18 @@
|
|
|
561
514
|
var path = this.getPath(treeNode, "");
|
|
562
515
|
var eventParams = {
|
|
563
516
|
'$event': event,
|
|
564
|
-
"$item": treeNode,
|
|
517
|
+
"$item": core.getClonedObject(treeNode.data),
|
|
565
518
|
"$path": path
|
|
566
519
|
};
|
|
567
520
|
this.invokeEventCallback('expand', eventParams);
|
|
568
|
-
var children =
|
|
521
|
+
var children = treeNode.children;
|
|
569
522
|
children === null || children === void 0 ? void 0 : children.map(function (el) {
|
|
570
523
|
if (el.isParent) {
|
|
571
524
|
var ele_1 = $("#" + el.tId + "_switch");
|
|
572
|
-
$(ele_1).addClass(self.
|
|
525
|
+
$(ele_1).addClass(self.treeicons || defaultTreeIconClass);
|
|
573
526
|
$(ele_1).on("click", function (e) {
|
|
574
527
|
setTimeout(function () {
|
|
575
|
-
$(ele_1).addClass(self.
|
|
528
|
+
$(ele_1).addClass(self.treeicons || defaultTreeIconClass);
|
|
576
529
|
}, 0);
|
|
577
530
|
});
|
|
578
531
|
}
|
|
@@ -582,186 +535,124 @@
|
|
|
582
535
|
var path = this.getPath(treeNode, "");
|
|
583
536
|
var eventParams = {
|
|
584
537
|
'$event': event,
|
|
585
|
-
"$item": treeNode,
|
|
538
|
+
"$item": core.getClonedObject(treeNode.data),
|
|
586
539
|
"$path": path
|
|
587
540
|
};
|
|
588
541
|
this.invokeEventCallback('collapse', eventParams);
|
|
589
542
|
};
|
|
590
|
-
TreeComponent.prototype.getChildren = function (node) {
|
|
591
|
-
return node[this.childrenKey];
|
|
592
|
-
};
|
|
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
543
|
// function to support backward compatibility of objects
|
|
634
|
-
TreeComponent.prototype.
|
|
544
|
+
TreeComponent.prototype.constructZTreeData = function (data, zTreeData) {
|
|
635
545
|
var _this = this;
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
|
|
546
|
+
data.forEach(function (node) {
|
|
547
|
+
var zNode = {};
|
|
548
|
+
var name = base.getEvaluatedData(node, { field: _this.nodelabel, bindExpression: _this.bindnodelabel }, _this.viewParent) || node.label;
|
|
549
|
+
var icon = base.getEvaluatedData(node, { field: _this.nodeicon, bindExpression: _this.bindnodeicon }, _this.viewParent) || node.icon;
|
|
550
|
+
var nodeId = base.getEvaluatedData(node, { field: _this.nodeid, bindExpression: _this.bindnodeid }, _this.viewParent);
|
|
551
|
+
var children = base.getEvaluatedData(node, { field: _this.nodechildren, bindExpression: _this.bindnodechildren }, _this.viewParent) || node.children;
|
|
552
|
+
zNode['name'] = name;
|
|
553
|
+
zNode['icon'] = icon;
|
|
554
|
+
zNode['nodeId'] = nodeId;
|
|
555
|
+
zNode['data'] = core.getClonedObject(node);
|
|
556
|
+
if (_.isArray(children) && children.length) {
|
|
557
|
+
zNode['children'] = [];
|
|
558
|
+
_this.constructZTreeData(children, zNode['children']);
|
|
641
559
|
}
|
|
560
|
+
zTreeData.push(zNode);
|
|
642
561
|
});
|
|
643
562
|
};
|
|
644
|
-
// sets the node children property to parent nodes
|
|
645
|
-
TreeComponent.prototype.setNodeChildren = function (nodes, depth, level, parentNode) {
|
|
646
|
-
var _this = this;
|
|
647
|
-
if (depth <= 0) {
|
|
648
|
-
return nodes;
|
|
649
|
-
}
|
|
650
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
651
|
-
var node = nodes[i];
|
|
652
|
-
if (depth === level) {
|
|
653
|
-
parentNode = nodes[i];
|
|
654
|
-
}
|
|
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
|
-
}
|
|
667
|
-
}
|
|
668
|
-
}
|
|
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
|
-
}
|
|
683
|
-
}
|
|
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; }
|
|
690
|
-
}
|
|
691
|
-
return count;
|
|
692
|
-
};
|
|
693
563
|
// Renders the tree on to the dom
|
|
694
564
|
TreeComponent.prototype.renderTree = function () {
|
|
695
|
-
|
|
565
|
+
var _a;
|
|
566
|
+
this.zTreeNodes = [];
|
|
567
|
+
if ((_a = this.nodes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
696
568
|
this.nativeElement.setAttribute('id', this.name);
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
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");
|
|
707
|
-
}
|
|
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
|
-
}
|
|
569
|
+
this.constructZTreeData(this.nodes, this.zTreeNodes);
|
|
570
|
+
if (this.level > 0) {
|
|
571
|
+
this.expandTree(this.level, this.zTreeNodes, 0);
|
|
720
572
|
}
|
|
721
573
|
}
|
|
722
|
-
this.
|
|
723
|
-
this.
|
|
724
|
-
this.
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
574
|
+
this.zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.zTreeNodes);
|
|
575
|
+
$.fn.zTreeKeyboardNavigation(this.zTree, $('ul[name="' + this.name + '"]'), null, this.treeicons || defaultTreeIconClass);
|
|
576
|
+
this.postRenderTree();
|
|
577
|
+
};
|
|
578
|
+
TreeComponent.prototype.setChecked = function (zNode, node) {
|
|
579
|
+
var _this = this;
|
|
580
|
+
node.checked = zNode.checked;
|
|
581
|
+
var children = base.getEvaluatedData(node, { field: this.nodechildren, bindExpression: this.bindnodechildren }, this.viewParent) || node.children;
|
|
582
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
583
|
+
children.forEach(function (node, index) {
|
|
584
|
+
_this.setChecked(zNode.children[index], node);
|
|
585
|
+
});
|
|
586
|
+
}
|
|
728
587
|
};
|
|
729
|
-
TreeComponent.prototype.
|
|
730
|
-
this.
|
|
731
|
-
this.selecteditem.path = this.getPath(treeNode, "");
|
|
732
|
-
var deSelectElm = $("li[treenode].selected");
|
|
588
|
+
TreeComponent.prototype.selectNode = function (event, node) {
|
|
589
|
+
var deSelectElm = $(".app-tree[name=" + this.name + "] li[treenode].selected");
|
|
733
590
|
deSelectElm.removeClass('selected');
|
|
734
|
-
|
|
591
|
+
if (!node) {
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
var selectElm = $("#" + node.tId + ":has(.curSelectedNode)");
|
|
735
595
|
selectElm.addClass('selected');
|
|
596
|
+
var classList = (this.treeClass || "").split(" ");
|
|
597
|
+
if (classList.includes('Checkbox') || classList.includes('Radio')) {
|
|
598
|
+
this.setChecked(node, node.data);
|
|
599
|
+
}
|
|
600
|
+
var path = this.getPath(node, "");
|
|
601
|
+
this.selecteditem = core.getClonedObject(node.data) || {};
|
|
602
|
+
this.selecteditem.path = path;
|
|
603
|
+
var eventParams = {
|
|
604
|
+
'$event': event,
|
|
605
|
+
"$item": core.getClonedObject(node.data),
|
|
606
|
+
"$path": path
|
|
607
|
+
};
|
|
608
|
+
//[Todo-CSP]: this data will be dynamic, can not generate function upfront
|
|
609
|
+
var nodeAction = node.data[this.nodeaction || 'action'];
|
|
610
|
+
if (nodeAction) {
|
|
611
|
+
core.$parseEvent(nodeAction)(this);
|
|
612
|
+
}
|
|
613
|
+
this.invokeEventCallback('select', eventParams);
|
|
736
614
|
};
|
|
737
615
|
TreeComponent.prototype.expandNode = function (node, expand, eventFlag) {
|
|
738
|
-
this.
|
|
616
|
+
this.zTree.expandNode(node, expand, false, false, eventFlag);
|
|
739
617
|
var el = $("#" + node.tId + "_switch");
|
|
740
|
-
$(el).addClass(this.
|
|
618
|
+
$(el).addClass(this.treeicons || defaultTreeIconClass);
|
|
741
619
|
};
|
|
742
|
-
TreeComponent.prototype.
|
|
620
|
+
TreeComponent.prototype.postRenderTree = function () {
|
|
743
621
|
var _this = this;
|
|
744
622
|
setTimeout(function () {
|
|
745
|
-
_this.changeTreeIcons(_this.
|
|
746
|
-
if (_this.datavalue) {
|
|
747
|
-
var nodes = _this.
|
|
748
|
-
var
|
|
749
|
-
if (
|
|
750
|
-
if (
|
|
751
|
-
|
|
623
|
+
_this.changeTreeIcons(_this.treeicons || defaultTreeIconClass);
|
|
624
|
+
if (_this.datavalue && !_this.selecteditem) {
|
|
625
|
+
var nodes = _this.zTree.getNodes();
|
|
626
|
+
var node = void 0;
|
|
627
|
+
if (nodes.length) {
|
|
628
|
+
if (_this.datavalue === 'FirstNode') {
|
|
629
|
+
node = nodes[0];
|
|
752
630
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
if (nodes.length) {
|
|
756
|
-
selectNode = nodes[nodes.length - 1];
|
|
631
|
+
if (_this.datavalue === 'LastNode') {
|
|
632
|
+
node = nodes[nodes.length - 1];
|
|
757
633
|
}
|
|
758
634
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
635
|
+
if (node) {
|
|
636
|
+
_this.zTree.selectNode(node, false);
|
|
637
|
+
_this.selectNode(undefined, node);
|
|
638
|
+
_this.expandNode(node, true, false);
|
|
639
|
+
}
|
|
762
640
|
}
|
|
763
641
|
}, 200);
|
|
764
642
|
};
|
|
643
|
+
TreeComponent.prototype.selectById = function (value) {
|
|
644
|
+
var _a;
|
|
645
|
+
var simpleNodes = (_a = this.zTree) === null || _a === void 0 ? void 0 : _a.transformToArray(this.zTree.getNodes());
|
|
646
|
+
var node = simpleNodes === null || simpleNodes === void 0 ? void 0 : simpleNodes.find(function (node) { return value === node.nodeId; });
|
|
647
|
+
if (node) {
|
|
648
|
+
this.zTree.selectNode(node, false);
|
|
649
|
+
this.selectNode(undefined, node);
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
TreeComponent.prototype.deselectById = function (value) {
|
|
653
|
+
this.selecteditem = {};
|
|
654
|
+
this.selectById();
|
|
655
|
+
};
|
|
765
656
|
return TreeComponent;
|
|
766
657
|
}(base.StylableComponent));
|
|
767
658
|
TreeComponent.initializeProps = registerProps();
|
|
@@ -776,7 +667,12 @@
|
|
|
776
667
|
},] }
|
|
777
668
|
];
|
|
778
669
|
TreeComponent.ctorParameters = function () { return [
|
|
779
|
-
{ type: core$1.Injector }
|
|
670
|
+
{ type: core$1.Injector },
|
|
671
|
+
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['datavalue.bind',] }] },
|
|
672
|
+
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['nodelabel.bind',] }] },
|
|
673
|
+
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['nodeicon.bind',] }] },
|
|
674
|
+
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['nodechildren.bind',] }] },
|
|
675
|
+
{ type: undefined, decorators: [{ type: core$1.Attribute, args: ['nodeid.bind',] }] }
|
|
780
676
|
]; };
|
|
781
677
|
|
|
782
678
|
var components = [
|