@wavemaker/app-ng-runtime 11.5.0-next.40002 → 11.5.0-next.40301
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/search/bundles/index.umd.js +7 -0
- app-ng-runtime/components/basic/search/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/basic/search/esm2015/search.component.js +7 -1
- app-ng-runtime/components/basic/search/fesm2015/index.js +6 -0
- app-ng-runtime/components/basic/search/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/basic/tree/bundles/index.umd.js +236 -132
- app-ng-runtime/components/basic/tree/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/basic/tree/esm2015/tree.component.js +208 -135
- app-ng-runtime/components/basic/tree/fesm2015/index.js +207 -134
- 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 +21 -25
- app-ng-runtime/components/chart/bundles/index.umd.js +1 -7
- app-ng-runtime/components/chart/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/chart/esm2015/chart.component.js +2 -8
- app-ng-runtime/components/chart/fesm2015/index.js +1 -7
- 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 +0 -6
- 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 +1 -7
- app-ng-runtime/components/containers/tabs/fesm2015/index.js +0 -6
- 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 +0 -2
- app-ng-runtime/components/data/form/bundles/index.umd.js +3 -9
- app-ng-runtime/components/data/form/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/data/form/esm2015/form.component.js +5 -11
- app-ng-runtime/components/data/form/fesm2015/index.js +4 -10
- 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/input/calendar/bundles/index.umd.js +1 -11
- app-ng-runtime/components/input/calendar/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/input/calendar/calendar.component.d.ts +2 -4
- app-ng-runtime/components/input/calendar/esm2015/calendar.component.js +2 -12
- app-ng-runtime/components/input/calendar/fesm2015/index.js +1 -11
- app-ng-runtime/components/input/calendar/fesm2015/index.js.map +1 -1
- app-ng-runtime/components/input/calendar/index.metadata.json +1 -1
- app-ng-runtime/components/input/default/bundles/index.umd.js +3 -9
- app-ng-runtime/components/input/default/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/input/default/dataset-aware-form.component.d.ts +2 -4
- app-ng-runtime/components/input/default/esm2015/base-form-custom.component.js +4 -2
- app-ng-runtime/components/input/default/esm2015/dataset-aware-form.component.js +1 -9
- app-ng-runtime/components/input/default/fesm2015/index.js +3 -9
- 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/components/input/epoch/base-date-time.component.d.ts +0 -1
- app-ng-runtime/components/input/epoch/bundles/index.umd.js +24 -25
- app-ng-runtime/components/input/epoch/bundles/index.umd.js.map +1 -1
- app-ng-runtime/components/input/epoch/esm2015/base-date-time.component.js +19 -17
- app-ng-runtime/components/input/epoch/esm2015/date/date.component.js +3 -5
- app-ng-runtime/components/input/epoch/esm2015/date-time/date-time-picker.component.js +10 -10
- app-ng-runtime/components/input/epoch/esm2015/date-time/date-time.component.js +2 -2
- app-ng-runtime/components/input/epoch/esm2015/time/time.component.js +2 -2
- app-ng-runtime/components/input/epoch/fesm2015/index.js +31 -31
- 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/core/bundles/index.umd.js +8 -12
- app-ng-runtime/core/bundles/index.umd.js.map +1 -1
- app-ng-runtime/core/esm2015/services/state-persistence.service.js +2 -4
- app-ng-runtime/core/esm2015/services/viewport.service.js +7 -9
- app-ng-runtime/core/esm2015/utils/utils.js +2 -2
- app-ng-runtime/core/fesm2015/index.js +8 -12
- app-ng-runtime/core/fesm2015/index.js.map +1 -1
- app-ng-runtime/mobile/components/basic/default/bundles/index.umd.js +1 -1
- app-ng-runtime/mobile/components/basic/default/bundles/index.umd.js.map +1 -1
- app-ng-runtime/mobile/components/basic/default/esm2015/image-cache/image-cache.directive.js +2 -2
- app-ng-runtime/mobile/components/basic/default/fesm2015/index.js +1 -1
- app-ng-runtime/mobile/components/basic/default/fesm2015/index.js.map +1 -1
- app-ng-runtime/mobile/components/basic/default/index.metadata.json +1 -1
- app-ng-runtime/package.json +1 -1
- app-ng-runtime/runtime/base/bundles/index.umd.js +2 -35
- app-ng-runtime/runtime/base/bundles/index.umd.js.map +1 -1
- app-ng-runtime/runtime/base/esm2015/services/i18n.service.js +3 -35
- app-ng-runtime/runtime/base/fesm2015/index.js +2 -34
- 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/services/i18n.service.d.ts +0 -2
|
@@ -346,17 +346,16 @@
|
|
|
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) {
|
|
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;
|
|
356
351
|
_this.setting = {
|
|
357
352
|
data: {
|
|
358
353
|
simpleData: {
|
|
359
354
|
enable: false
|
|
355
|
+
},
|
|
356
|
+
key: {
|
|
357
|
+
children: 'children',
|
|
358
|
+
name: 'label'
|
|
360
359
|
}
|
|
361
360
|
},
|
|
362
361
|
view: {
|
|
@@ -370,46 +369,46 @@
|
|
|
370
369
|
callback: {}
|
|
371
370
|
};
|
|
372
371
|
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);
|
|
377
372
|
return _this;
|
|
378
373
|
}
|
|
379
374
|
TreeComponent.prototype.onPropertyChange = function (key, nv, ov) {
|
|
380
375
|
switch (key) {
|
|
381
376
|
case 'dataset':
|
|
382
377
|
this.nodes = this.getNodes(nv);
|
|
378
|
+
if (this.level > 0) {
|
|
379
|
+
this.expandTree(this.level, this.nodes, 0);
|
|
380
|
+
}
|
|
383
381
|
this.renderTree();
|
|
384
382
|
break;
|
|
385
383
|
case 'levels':
|
|
386
|
-
|
|
384
|
+
if (nv > 0) {
|
|
385
|
+
this.level = nv;
|
|
386
|
+
}
|
|
387
387
|
this.renderTree();
|
|
388
388
|
break;
|
|
389
|
-
case '
|
|
390
|
-
this.
|
|
389
|
+
case 'treeicons':
|
|
390
|
+
this.treeicon = nv;
|
|
391
391
|
this.renderTree();
|
|
392
392
|
break;
|
|
393
393
|
case 'nodelabel':
|
|
394
|
-
this.
|
|
394
|
+
this.setting.data.key.name = this.labelKey;
|
|
395
395
|
this.renderTree();
|
|
396
396
|
break;
|
|
397
397
|
case 'nodechildren':
|
|
398
|
-
this.
|
|
398
|
+
this.setting.data.key.children = this.childrenKey;
|
|
399
399
|
this.renderTree();
|
|
400
400
|
break;
|
|
401
|
-
case '
|
|
402
|
-
this.
|
|
401
|
+
case 'nodeicon':
|
|
402
|
+
this.nodeicon = this.iconKey;
|
|
403
403
|
this.renderTree();
|
|
404
404
|
break;
|
|
405
|
-
case '
|
|
406
|
-
this.treeicons = nv;
|
|
405
|
+
case 'orderby':
|
|
407
406
|
this.renderTree();
|
|
408
407
|
break;
|
|
409
408
|
case 'class':
|
|
410
409
|
this.treeClass = nv;
|
|
411
|
-
this.setTreeTemplate(this.treeClass);
|
|
412
410
|
this.renderTree();
|
|
411
|
+
break;
|
|
413
412
|
default:
|
|
414
413
|
_super.prototype.onPropertyChange.call(this, key, nv, ov);
|
|
415
414
|
break;
|
|
@@ -419,9 +418,9 @@
|
|
|
419
418
|
TreeComponent.prototype.expandTree = function (level, node, childLevel) {
|
|
420
419
|
var _this = this;
|
|
421
420
|
node.map(function (childNode) {
|
|
422
|
-
var children = childNode
|
|
423
|
-
if (children && childLevel < level) {
|
|
424
|
-
childNode
|
|
421
|
+
var children = _this.getChildren(childNode);
|
|
422
|
+
if (children && !("open" in childNode) && childLevel < level) {
|
|
423
|
+
childNode["open"] = true;
|
|
425
424
|
_this.expandTree(level, children, childLevel + 1);
|
|
426
425
|
}
|
|
427
426
|
else {
|
|
@@ -432,15 +431,14 @@
|
|
|
432
431
|
};
|
|
433
432
|
// sets the template for the tree based on the property selected.
|
|
434
433
|
TreeComponent.prototype.setTreeTemplate = function (value) {
|
|
435
|
-
|
|
436
|
-
if (classList.includes('Classic')) {
|
|
434
|
+
if (value === 'Classic') {
|
|
437
435
|
this.setting.check["enable"] = false;
|
|
438
436
|
}
|
|
439
|
-
else if (
|
|
437
|
+
else if (value === 'Checkbox') {
|
|
440
438
|
this.setting.check["enable"] = true;
|
|
441
439
|
this.setting.check["chkStyle"] = 'checkbox';
|
|
442
440
|
}
|
|
443
|
-
else if (
|
|
441
|
+
else if (value === 'Radio') {
|
|
444
442
|
this.setting.check["enable"] = true;
|
|
445
443
|
this.setting.check["chkStyle"] = 'radio';
|
|
446
444
|
this.setting.check["radioType"] = "all";
|
|
@@ -472,10 +470,53 @@
|
|
|
472
470
|
return nodes;
|
|
473
471
|
};
|
|
474
472
|
// adds class to the nodes inorder to add icons to respective node.
|
|
475
|
-
TreeComponent.prototype.
|
|
473
|
+
TreeComponent.prototype.setNodeclasses = function (treeId, treeNode) {
|
|
476
474
|
return treeNode.icon ? { add: ["" + treeNode.icon] } : '';
|
|
477
475
|
};
|
|
478
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
|
+
}
|
|
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
|
+
};
|
|
479
520
|
// adds tree icons to the nodes on load of the tree
|
|
480
521
|
TreeComponent.prototype.changeTreeIcons = function (nv) {
|
|
481
522
|
var eleClose = $('ul[name="' + this.name + '"] li span.button.switch');
|
|
@@ -488,25 +529,31 @@
|
|
|
488
529
|
});
|
|
489
530
|
});
|
|
490
531
|
};
|
|
491
|
-
// Returns the node path
|
|
492
532
|
TreeComponent.prototype.getPath = function (treeNode, path) {
|
|
493
533
|
if (treeNode.getParentNode() === null) {
|
|
494
|
-
path = "/" + treeNode.
|
|
534
|
+
path = "/" + treeNode[this.labelKey] + path;
|
|
495
535
|
}
|
|
496
536
|
else {
|
|
497
|
-
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode.
|
|
537
|
+
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode[this.labelKey];
|
|
498
538
|
}
|
|
499
539
|
return path;
|
|
500
540
|
};
|
|
501
541
|
// binds the click event to all nodes to open the child nodes
|
|
502
542
|
TreeComponent.prototype.onClick = function (event, treeId, treeNode, clickFlag) {
|
|
503
543
|
if (this.nodeclick === "expand") {
|
|
504
|
-
var nodes = this.
|
|
544
|
+
var nodes = this.treeObj.getSelectedNodes();
|
|
505
545
|
if (nodes.length > 0) {
|
|
506
546
|
this.expandNode(nodes[0], !nodes[0].open, true);
|
|
507
547
|
}
|
|
508
548
|
}
|
|
509
|
-
this.
|
|
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);
|
|
510
557
|
};
|
|
511
558
|
// Adds tree icon classes to child nodes when expanded
|
|
512
559
|
TreeComponent.prototype.onExpand = function (event, treeId, treeNode) {
|
|
@@ -514,18 +561,18 @@
|
|
|
514
561
|
var path = this.getPath(treeNode, "");
|
|
515
562
|
var eventParams = {
|
|
516
563
|
'$event': event,
|
|
517
|
-
"$item":
|
|
564
|
+
"$item": treeNode,
|
|
518
565
|
"$path": path
|
|
519
566
|
};
|
|
520
567
|
this.invokeEventCallback('expand', eventParams);
|
|
521
|
-
var children = treeNode
|
|
568
|
+
var children = this.getChildren(treeNode);
|
|
522
569
|
children === null || children === void 0 ? void 0 : children.map(function (el) {
|
|
523
570
|
if (el.isParent) {
|
|
524
571
|
var ele_1 = $("#" + el.tId + "_switch");
|
|
525
|
-
$(ele_1).addClass(self.
|
|
572
|
+
$(ele_1).addClass(self.treeicon || defaultTreeIconClass);
|
|
526
573
|
$(ele_1).on("click", function (e) {
|
|
527
574
|
setTimeout(function () {
|
|
528
|
-
$(ele_1).addClass(self.
|
|
575
|
+
$(ele_1).addClass(self.treeicon || defaultTreeIconClass);
|
|
529
576
|
}, 0);
|
|
530
577
|
});
|
|
531
578
|
}
|
|
@@ -535,124 +582,186 @@
|
|
|
535
582
|
var path = this.getPath(treeNode, "");
|
|
536
583
|
var eventParams = {
|
|
537
584
|
'$event': event,
|
|
538
|
-
"$item":
|
|
585
|
+
"$item": treeNode,
|
|
539
586
|
"$path": path
|
|
540
587
|
};
|
|
541
588
|
this.invokeEventCallback('collapse', eventParams);
|
|
542
589
|
};
|
|
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
|
+
});
|
|
543
633
|
// function to support backward compatibility of objects
|
|
544
|
-
TreeComponent.prototype.
|
|
634
|
+
TreeComponent.prototype.modifyObjects = function (array) {
|
|
545
635
|
var _this = this;
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
var
|
|
549
|
-
|
|
550
|
-
|
|
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']);
|
|
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);
|
|
559
641
|
}
|
|
560
|
-
zTreeData.push(zNode);
|
|
561
642
|
});
|
|
562
643
|
};
|
|
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
|
+
};
|
|
563
693
|
// Renders the tree on to the dom
|
|
564
694
|
TreeComponent.prototype.renderTree = function () {
|
|
565
|
-
|
|
566
|
-
this.zTreeNodes = [];
|
|
567
|
-
if ((_a = this.nodes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
695
|
+
if (this.nodes) {
|
|
568
696
|
this.nativeElement.setAttribute('id', this.name);
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
697
|
+
if (this.nodeicon && this.nodeicon !== 'icon') {
|
|
698
|
+
this.modifyObjects(this.nodes);
|
|
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
|
+
}
|
|
572
720
|
}
|
|
573
721
|
}
|
|
574
|
-
this.
|
|
575
|
-
|
|
576
|
-
this.
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
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
|
-
}
|
|
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);
|
|
587
728
|
};
|
|
588
|
-
TreeComponent.prototype.
|
|
589
|
-
|
|
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");
|
|
590
733
|
deSelectElm.removeClass('selected');
|
|
591
|
-
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
var selectElm = $("#" + node.tId + ":has(.curSelectedNode)");
|
|
734
|
+
var selectElm = $("#" + treeNode.tId + ":has(.curSelectedNode)");
|
|
595
735
|
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);
|
|
614
736
|
};
|
|
615
737
|
TreeComponent.prototype.expandNode = function (node, expand, eventFlag) {
|
|
616
|
-
this.
|
|
738
|
+
this.treeObj.expandNode(node, expand, false, false, eventFlag);
|
|
617
739
|
var el = $("#" + node.tId + "_switch");
|
|
618
|
-
$(el).addClass(this.
|
|
740
|
+
$(el).addClass(this.treeicon || defaultTreeIconClass);
|
|
619
741
|
};
|
|
620
|
-
TreeComponent.prototype.
|
|
742
|
+
TreeComponent.prototype.ngAfterViewInit = function () {
|
|
621
743
|
var _this = this;
|
|
622
744
|
setTimeout(function () {
|
|
623
|
-
_this.changeTreeIcons(_this.
|
|
624
|
-
if (_this.datavalue
|
|
625
|
-
var nodes = _this.
|
|
626
|
-
var
|
|
627
|
-
if (
|
|
628
|
-
if (
|
|
629
|
-
|
|
630
|
-
}
|
|
631
|
-
if (_this.datavalue === 'LastNode') {
|
|
632
|
-
node = nodes[nodes.length - 1];
|
|
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];
|
|
633
752
|
}
|
|
634
753
|
}
|
|
635
|
-
if (
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
754
|
+
if (_this.datavalue === 'LastNode') {
|
|
755
|
+
if (nodes.length) {
|
|
756
|
+
selectNode = nodes[nodes.length - 1];
|
|
757
|
+
}
|
|
639
758
|
}
|
|
759
|
+
_this.treeObj.selectNode(selectNode, false);
|
|
760
|
+
_this.setSelectedItem(selectNode);
|
|
761
|
+
_this.expandNode(selectNode, true, false);
|
|
640
762
|
}
|
|
641
763
|
}, 200);
|
|
642
764
|
};
|
|
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
|
-
};
|
|
656
765
|
return TreeComponent;
|
|
657
766
|
}(base.StylableComponent));
|
|
658
767
|
TreeComponent.initializeProps = registerProps();
|
|
@@ -667,12 +776,7 @@
|
|
|
667
776
|
},] }
|
|
668
777
|
];
|
|
669
778
|
TreeComponent.ctorParameters = function () { return [
|
|
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',] }] }
|
|
779
|
+
{ type: core$1.Injector }
|
|
676
780
|
]; };
|
|
677
781
|
|
|
678
782
|
var components = [
|