@ali-hm/angular-tree-component 19.1.0 → 19.2.5
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.
- package/fesm2022/ali-hm-angular-tree-component.mjs +321 -336
- package/fesm2022/ali-hm-angular-tree-component.mjs.map +1 -1
- package/lib/angular-tree-component.module.d.ts +15 -15
- package/lib/components/loading.component.d.ts +1 -1
- package/lib/components/tree-node-checkbox.component.d.ts +1 -1
- package/lib/components/tree-node-collection.component.d.ts +3 -3
- package/lib/components/tree-node-content.component.d.ts +1 -1
- package/lib/components/tree-node-drop-slot.component.d.ts +1 -1
- package/lib/components/tree-node-expander.component.d.ts +1 -1
- package/lib/components/tree-node-wrapper.component.d.ts +1 -1
- package/lib/components/tree-viewport.component.d.ts +1 -1
- package/lib/components/tree.component.d.ts +1 -1
- package/lib/directives/tree-animate-open.directive.d.ts +1 -1
- package/lib/directives/tree-drag.directive.d.ts +1 -1
- package/lib/directives/tree-drop.directive.d.ts +1 -1
- package/lib/mobx-angular/tree-mobx-autorun.directive.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Input, Directive, Injectable, ViewEncapsulation, Component, EventEmitter, HostListener, Output, forwardRef, ViewChild, ContentChild, NgModule } from '@angular/core';
|
|
3
|
+
import { NgIf, NgTemplateOutlet, NgFor, CommonModule } from '@angular/common';
|
|
5
4
|
import { autorun, reaction, computed as computed$1, observable as observable$1, action as action$1 } from 'mobx';
|
|
6
5
|
|
|
7
6
|
class TreeMobxAutorunDirective {
|
|
@@ -31,15 +30,12 @@ class TreeMobxAutorunDirective {
|
|
|
31
30
|
this.dispose();
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
35
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.
|
|
33
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeMobxAutorunDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
34
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.5", type: TreeMobxAutorunDirective, isStandalone: true, selector: "[treeMobxAutorun]", inputs: { treeMobxAutorun: "treeMobxAutorun" }, ngImport: i0 }); }
|
|
36
35
|
}
|
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeMobxAutorunDirective, decorators: [{
|
|
38
37
|
type: Directive,
|
|
39
|
-
args: [{
|
|
40
|
-
selector: '[treeMobxAutorun]',
|
|
41
|
-
standalone: false
|
|
42
|
-
}]
|
|
38
|
+
args: [{ selector: '[treeMobxAutorun]' }]
|
|
43
39
|
}], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }], propDecorators: { treeMobxAutorun: [{
|
|
44
40
|
type: Input
|
|
45
41
|
}] } });
|
|
@@ -1045,8 +1041,8 @@ class TreeModel {
|
|
|
1045
1041
|
_setActiveNodeMulti(node, value) {
|
|
1046
1042
|
this.activeNodeIds = Object.assign({}, this.activeNodeIds, { [node.id]: value });
|
|
1047
1043
|
}
|
|
1048
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1049
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
1044
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeModel, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1045
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeModel }); }
|
|
1050
1046
|
}
|
|
1051
1047
|
__decorate$2([
|
|
1052
1048
|
observable$1
|
|
@@ -1147,7 +1143,7 @@ __decorate$2([
|
|
|
1147
1143
|
__decorate$2([
|
|
1148
1144
|
action$1
|
|
1149
1145
|
], TreeModel.prototype, "setState", null);
|
|
1150
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeModel, decorators: [{
|
|
1151
1147
|
type: Injectable
|
|
1152
1148
|
}], propDecorators: { roots: [], expandedNodeIds: [], selectedLeafNodeIds: [], activeNodeIds: [], hiddenNodeIds: [], focusedNodeId: [], virtualRoot: [], focusedNode: [], expandedNodes: [], activeNodes: [], hiddenNodes: [], selectedLeafNodes: [], setData: [], update: [], setFocusedNode: [], setFocus: [], doForAll: [], focusNextNode: [], focusPreviousNode: [], focusDrillDown: [], focusDrillUp: [], setActiveNode: [], setSelectedNode: [], setExpandedNode: [], expandAll: [], collapseAll: [], setIsHidden: [], setHiddenNodeIds: [], filterNodes: [], clearFilter: [], moveNode: [], copyNode: [], setState: [] } });
|
|
1153
1149
|
|
|
@@ -1164,10 +1160,10 @@ class TreeDraggedElement {
|
|
|
1164
1160
|
isDragging() {
|
|
1165
1161
|
return !!this.get();
|
|
1166
1162
|
}
|
|
1167
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1168
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
1163
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeDraggedElement, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1164
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeDraggedElement, providedIn: 'root' }); }
|
|
1169
1165
|
}
|
|
1170
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeDraggedElement, decorators: [{
|
|
1171
1167
|
type: Injectable,
|
|
1172
1168
|
args: [{
|
|
1173
1169
|
providedIn: 'root'
|
|
@@ -1315,8 +1311,8 @@ class TreeVirtualScroll {
|
|
|
1315
1311
|
if (this.y > maxY)
|
|
1316
1312
|
this._setYBlocks(maxY / Y_EPSILON);
|
|
1317
1313
|
}
|
|
1318
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1319
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
1314
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeVirtualScroll, deps: [{ token: TreeModel }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1315
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeVirtualScroll }); }
|
|
1320
1316
|
}
|
|
1321
1317
|
__decorate$1([
|
|
1322
1318
|
observable$1
|
|
@@ -1345,7 +1341,7 @@ __decorate$1([
|
|
|
1345
1341
|
__decorate$1([
|
|
1346
1342
|
action$1
|
|
1347
1343
|
], TreeVirtualScroll.prototype, "scrollIntoView", null);
|
|
1348
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeVirtualScroll, decorators: [{
|
|
1349
1345
|
type: Injectable
|
|
1350
1346
|
}], ctorParameters: () => [{ type: TreeModel }], propDecorators: { yBlocks: [], x: [], viewportHeight: [], y: [], totalHeight: [], _setYBlocks: [], recalcPositions: [], setViewport: [], scrollIntoView: [] } });
|
|
1351
1347
|
function binarySearch(nodes, condition, firstIndex = 0) {
|
|
@@ -1367,16 +1363,16 @@ function binarySearch(nodes, condition, firstIndex = 0) {
|
|
|
1367
1363
|
}
|
|
1368
1364
|
|
|
1369
1365
|
class LoadingComponent {
|
|
1370
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1371
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.
|
|
1366
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: LoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1367
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: LoadingComponent, isStandalone: true, selector: "tree-loading-component", inputs: { template: "template", node: "node" }, ngImport: i0, template: `
|
|
1372
1368
|
<span *ngIf="!template">loading...</span>
|
|
1373
1369
|
<ng-container
|
|
1374
1370
|
[ngTemplateOutlet]="template"
|
|
1375
1371
|
[ngTemplateOutletContext]="{ $implicit: node }">
|
|
1376
1372
|
</ng-container>
|
|
1377
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
1373
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1378
1374
|
}
|
|
1379
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: LoadingComponent, decorators: [{
|
|
1380
1376
|
type: Component,
|
|
1381
1377
|
args: [{
|
|
1382
1378
|
encapsulation: ViewEncapsulation.None,
|
|
@@ -1388,7 +1384,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
1388
1384
|
[ngTemplateOutletContext]="{ $implicit: node }">
|
|
1389
1385
|
</ng-container>
|
|
1390
1386
|
`,
|
|
1391
|
-
|
|
1387
|
+
imports: [NgIf, NgTemplateOutlet]
|
|
1392
1388
|
}]
|
|
1393
1389
|
}], propDecorators: { template: [{
|
|
1394
1390
|
type: Input
|
|
@@ -1396,6 +1392,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
1396
1392
|
type: Input
|
|
1397
1393
|
}] } });
|
|
1398
1394
|
|
|
1395
|
+
class TreeViewportComponent {
|
|
1396
|
+
constructor(elementRef, virtualScroll) {
|
|
1397
|
+
this.elementRef = elementRef;
|
|
1398
|
+
this.virtualScroll = virtualScroll;
|
|
1399
|
+
this.setViewport = this.throttle(() => {
|
|
1400
|
+
this.virtualScroll.setViewport(this.elementRef.nativeElement);
|
|
1401
|
+
}, 17);
|
|
1402
|
+
this.scrollEventHandler = this.setViewport.bind(this);
|
|
1403
|
+
}
|
|
1404
|
+
ngOnInit() {
|
|
1405
|
+
this.virtualScroll.init();
|
|
1406
|
+
}
|
|
1407
|
+
ngAfterViewInit() {
|
|
1408
|
+
setTimeout(() => {
|
|
1409
|
+
this.setViewport();
|
|
1410
|
+
this.virtualScroll.fireEvent({ eventName: TREE_EVENTS.initialized });
|
|
1411
|
+
});
|
|
1412
|
+
let el = this.elementRef.nativeElement;
|
|
1413
|
+
el.addEventListener('scroll', this.scrollEventHandler);
|
|
1414
|
+
}
|
|
1415
|
+
ngOnDestroy() {
|
|
1416
|
+
this.virtualScroll.clear();
|
|
1417
|
+
let el = this.elementRef.nativeElement;
|
|
1418
|
+
el.removeEventListener('scroll', this.scrollEventHandler);
|
|
1419
|
+
}
|
|
1420
|
+
getTotalHeight() {
|
|
1421
|
+
return ((this.virtualScroll.isEnabled() &&
|
|
1422
|
+
this.virtualScroll.totalHeight + 'px') ||
|
|
1423
|
+
'auto');
|
|
1424
|
+
}
|
|
1425
|
+
throttle(func, timeFrame) {
|
|
1426
|
+
let lastTime = 0;
|
|
1427
|
+
return function () {
|
|
1428
|
+
let now = Date.now();
|
|
1429
|
+
if (now - lastTime >= timeFrame) {
|
|
1430
|
+
func();
|
|
1431
|
+
lastTime = now;
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeViewportComponent, deps: [{ token: i0.ElementRef }, { token: TreeVirtualScroll }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1436
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeViewportComponent, isStandalone: true, selector: "tree-viewport", providers: [TreeVirtualScroll], ngImport: i0, template: `
|
|
1437
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1438
|
+
<div [style.height]="getTotalHeight()">
|
|
1439
|
+
<ng-content></ng-content>
|
|
1440
|
+
</div>
|
|
1441
|
+
</ng-container>
|
|
1442
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }] }); }
|
|
1443
|
+
}
|
|
1444
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeViewportComponent, decorators: [{
|
|
1445
|
+
type: Component,
|
|
1446
|
+
args: [{ selector: 'tree-viewport', providers: [TreeVirtualScroll], template: `
|
|
1447
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1448
|
+
<div [style.height]="getTotalHeight()">
|
|
1449
|
+
<ng-content></ng-content>
|
|
1450
|
+
</div>
|
|
1451
|
+
</ng-container>
|
|
1452
|
+
`, imports: [TreeMobxAutorunDirective] }]
|
|
1453
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: TreeVirtualScroll }] });
|
|
1454
|
+
|
|
1455
|
+
// Re-export mobx operators to be able to use inside components with AOT:
|
|
1456
|
+
function actionInternal(...args) {
|
|
1457
|
+
return action$1(...args);
|
|
1458
|
+
}
|
|
1459
|
+
const action = Object.assign(actionInternal, action$1);
|
|
1460
|
+
function computedInternal(...args) {
|
|
1461
|
+
return computed$1(...args);
|
|
1462
|
+
}
|
|
1463
|
+
const computed = Object.assign(computedInternal, computed$1);
|
|
1464
|
+
function observableInternal(...args) {
|
|
1465
|
+
return observable$1(...args);
|
|
1466
|
+
}
|
|
1467
|
+
const observable = Object.assign(observableInternal, observable$1);
|
|
1468
|
+
|
|
1399
1469
|
const DRAG_OVER_CLASS$1 = 'is-dragging-over';
|
|
1400
1470
|
const DRAG_DISABLED_CLASS = 'is-dragging-over-disabled';
|
|
1401
1471
|
class TreeDropDirective {
|
|
@@ -1491,15 +1561,12 @@ class TreeDropDirective {
|
|
|
1491
1561
|
removeDisabledClass() {
|
|
1492
1562
|
this.renderer.removeClass(this.el.nativeElement, DRAG_DISABLED_CLASS);
|
|
1493
1563
|
}
|
|
1494
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1495
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.
|
|
1564
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeDropDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: TreeDraggedElement }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1565
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.5", type: TreeDropDirective, isStandalone: true, selector: "[treeDrop]", inputs: { allowDragoverStyling: "allowDragoverStyling", treeAllowDrop: "treeAllowDrop" }, outputs: { onDropCallback: "treeDrop", onDragOverCallback: "treeDropDragOver", onDragLeaveCallback: "treeDropDragLeave", onDragEnterCallback: "treeDropDragEnter" }, host: { listeners: { "drop": "onDrop($event)" } }, ngImport: i0 }); }
|
|
1496
1566
|
}
|
|
1497
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1567
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeDropDirective, decorators: [{
|
|
1498
1568
|
type: Directive,
|
|
1499
|
-
args: [{
|
|
1500
|
-
selector: '[treeDrop]',
|
|
1501
|
-
standalone: false
|
|
1502
|
-
}]
|
|
1569
|
+
args: [{ selector: '[treeDrop]' }]
|
|
1503
1570
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: TreeDraggedElement }, { type: i0.NgZone }], propDecorators: { allowDragoverStyling: [{
|
|
1504
1571
|
type: Input
|
|
1505
1572
|
}], onDropCallback: [{
|
|
@@ -1531,8 +1598,8 @@ class TreeNodeDropSlot {
|
|
|
1531
1598
|
allowDrop(element, $event) {
|
|
1532
1599
|
return this.node.options.allowDrop(element, { parent: this.node, index: this.dropIndex }, $event);
|
|
1533
1600
|
}
|
|
1534
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1535
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.
|
|
1601
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeDropSlot, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1602
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeNodeDropSlot, isStandalone: true, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: { node: "node", dropIndex: "dropIndex" }, ngImport: i0, template: `
|
|
1536
1603
|
<div
|
|
1537
1604
|
class="node-drop-slot"
|
|
1538
1605
|
(treeDrop)="onDrop($event)"
|
|
@@ -1541,7 +1608,7 @@ class TreeNodeDropSlot {
|
|
|
1541
1608
|
</div>
|
|
1542
1609
|
`, isInline: true, dependencies: [{ kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1543
1610
|
}
|
|
1544
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeDropSlot, decorators: [{
|
|
1545
1612
|
type: Component,
|
|
1546
1613
|
args: [{ selector: 'TreeNodeDropSlot, tree-node-drop-slot', encapsulation: ViewEncapsulation.None, template: `
|
|
1547
1614
|
<div
|
|
@@ -1550,155 +1617,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
1550
1617
|
[treeAllowDrop]="allowDrop.bind(this)"
|
|
1551
1618
|
[allowDragoverStyling]="true">
|
|
1552
1619
|
</div>
|
|
1553
|
-
`,
|
|
1620
|
+
`, imports: [TreeDropDirective] }]
|
|
1554
1621
|
}], propDecorators: { node: [{
|
|
1555
1622
|
type: Input
|
|
1556
1623
|
}], dropIndex: [{
|
|
1557
1624
|
type: Input
|
|
1558
1625
|
}] } });
|
|
1559
1626
|
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
const EASE_ACCELERATION = 1.005;
|
|
1575
|
-
class TreeAnimateOpenDirective {
|
|
1576
|
-
set isOpen(value) {
|
|
1577
|
-
if (value) {
|
|
1578
|
-
this._show();
|
|
1579
|
-
if (this.isEnabled && this._isOpen === false) {
|
|
1580
|
-
this._animateOpen();
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
else {
|
|
1584
|
-
this.isEnabled ? this._animateClose() : this._hide();
|
|
1585
|
-
}
|
|
1586
|
-
this._isOpen = !!value;
|
|
1587
|
-
}
|
|
1588
|
-
;
|
|
1589
|
-
constructor(renderer, templateRef, viewContainerRef) {
|
|
1590
|
-
this.renderer = renderer;
|
|
1591
|
-
this.templateRef = templateRef;
|
|
1592
|
-
this.viewContainerRef = viewContainerRef;
|
|
1593
|
-
}
|
|
1594
|
-
_show() {
|
|
1595
|
-
if (this.innerElement)
|
|
1596
|
-
return;
|
|
1597
|
-
// create child view
|
|
1598
|
-
this.innerElement = this.viewContainerRef.createEmbeddedView(this.templateRef).rootNodes[0];
|
|
1599
|
-
}
|
|
1600
|
-
_hide() {
|
|
1601
|
-
this.viewContainerRef.clear();
|
|
1602
|
-
this.innerElement = null;
|
|
1603
|
-
}
|
|
1604
|
-
_animateOpen() {
|
|
1605
|
-
let delta = this.animateSpeed;
|
|
1606
|
-
let ease = this.animateAcceleration;
|
|
1607
|
-
let maxHeight = 0;
|
|
1608
|
-
// set height to 0
|
|
1609
|
-
this.renderer.setStyle(this.innerElement, 'max-height', `0`);
|
|
1610
|
-
// increase maxHeight until height doesn't change
|
|
1611
|
-
setTimeout(() => {
|
|
1612
|
-
const i = setInterval(() => {
|
|
1613
|
-
if (!this._isOpen || !this.innerElement)
|
|
1614
|
-
return clearInterval(i);
|
|
1615
|
-
maxHeight += delta;
|
|
1616
|
-
const roundedMaxHeight = Math.round(maxHeight);
|
|
1617
|
-
this.renderer.setStyle(this.innerElement, 'max-height', `${roundedMaxHeight}px`);
|
|
1618
|
-
const height = this.innerElement.getBoundingClientRect ? this.innerElement.getBoundingClientRect().height : 0; // TBD use renderer
|
|
1619
|
-
delta *= ease;
|
|
1620
|
-
ease *= EASE_ACCELERATION;
|
|
1621
|
-
if (height < roundedMaxHeight) {
|
|
1622
|
-
// Make maxHeight auto because animation finished and container might change height later on
|
|
1623
|
-
this.renderer.setStyle(this.innerElement, 'max-height', null);
|
|
1624
|
-
clearInterval(i);
|
|
1625
|
-
}
|
|
1626
|
-
}, 17);
|
|
1627
|
-
});
|
|
1628
|
-
}
|
|
1629
|
-
_animateClose() {
|
|
1630
|
-
if (!this.innerElement)
|
|
1631
|
-
return;
|
|
1632
|
-
let delta = this.animateSpeed;
|
|
1633
|
-
let ease = this.animateAcceleration;
|
|
1634
|
-
let height = this.innerElement.getBoundingClientRect().height; // TBD use renderer
|
|
1635
|
-
// slowly decrease maxHeight to 0, starting from current height
|
|
1636
|
-
const i = setInterval(() => {
|
|
1637
|
-
if (this._isOpen || !this.innerElement)
|
|
1638
|
-
return clearInterval(i);
|
|
1639
|
-
height -= delta;
|
|
1640
|
-
this.renderer.setStyle(this.innerElement, 'max-height', `${height}px`);
|
|
1641
|
-
delta *= ease;
|
|
1642
|
-
ease *= EASE_ACCELERATION;
|
|
1643
|
-
if (height <= 0) {
|
|
1644
|
-
// after animation complete - remove child element
|
|
1645
|
-
this.viewContainerRef.clear();
|
|
1646
|
-
this.innerElement = null;
|
|
1647
|
-
clearInterval(i);
|
|
1648
|
-
}
|
|
1649
|
-
}, 17);
|
|
1650
|
-
}
|
|
1651
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TreeAnimateOpenDirective, deps: [{ token: i0.Renderer2 }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1652
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.1", type: TreeAnimateOpenDirective, isStandalone: false, selector: "[treeAnimateOpen]", inputs: { animateSpeed: ["treeAnimateOpenSpeed", "animateSpeed"], animateAcceleration: ["treeAnimateOpenAcceleration", "animateAcceleration"], isEnabled: ["treeAnimateOpenEnabled", "isEnabled"], isOpen: ["treeAnimateOpen", "isOpen"] }, ngImport: i0 }); }
|
|
1627
|
+
class TreeNodeCheckboxComponent {
|
|
1628
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1629
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeNodeCheckboxComponent, isStandalone: true, selector: "tree-node-checkbox", inputs: { node: "node" }, ngImport: i0, template: `
|
|
1630
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1631
|
+
<input
|
|
1632
|
+
class="tree-node-checkbox"
|
|
1633
|
+
type="checkbox"
|
|
1634
|
+
(click)="node.mouseAction('checkboxClick', $event)"
|
|
1635
|
+
[checked]="node.isSelected"
|
|
1636
|
+
[indeterminate]="node.isPartiallySelected"
|
|
1637
|
+
/>
|
|
1638
|
+
</ng-container>
|
|
1639
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1653
1640
|
}
|
|
1654
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1655
|
-
type:
|
|
1656
|
-
args: [{
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
}], isOpen: [{
|
|
1670
|
-
type: Input,
|
|
1671
|
-
args: ['treeAnimateOpen']
|
|
1641
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeCheckboxComponent, decorators: [{
|
|
1642
|
+
type: Component,
|
|
1643
|
+
args: [{ selector: 'tree-node-checkbox', encapsulation: ViewEncapsulation.None, template: `
|
|
1644
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1645
|
+
<input
|
|
1646
|
+
class="tree-node-checkbox"
|
|
1647
|
+
type="checkbox"
|
|
1648
|
+
(click)="node.mouseAction('checkboxClick', $event)"
|
|
1649
|
+
[checked]="node.isSelected"
|
|
1650
|
+
[indeterminate]="node.isPartiallySelected"
|
|
1651
|
+
/>
|
|
1652
|
+
</ng-container>
|
|
1653
|
+
`, imports: [TreeMobxAutorunDirective] }]
|
|
1654
|
+
}], propDecorators: { node: [{
|
|
1655
|
+
type: Input
|
|
1672
1656
|
}] } });
|
|
1673
1657
|
|
|
1674
|
-
class
|
|
1675
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1676
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1658
|
+
class TreeNodeExpanderComponent {
|
|
1659
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeExpanderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1660
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeNodeExpanderComponent, isStandalone: true, selector: "tree-node-expander", inputs: { node: "node" }, ngImport: i0, template: `
|
|
1661
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1662
|
+
<span
|
|
1663
|
+
*ngIf="node.hasChildren"
|
|
1664
|
+
[class.toggle-children-wrapper-expanded]="node.isExpanded"
|
|
1665
|
+
[class.toggle-children-wrapper-collapsed]="node.isCollapsed"
|
|
1666
|
+
class="toggle-children-wrapper"
|
|
1667
|
+
(click)="node.mouseAction('expanderClick', $event)"
|
|
1668
|
+
>
|
|
1669
|
+
<span class="toggle-children"></span>
|
|
1670
|
+
</span>
|
|
1671
|
+
<span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
|
|
1672
|
+
</span>
|
|
1673
|
+
</ng-container>
|
|
1674
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1682
1675
|
}
|
|
1683
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1676
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeExpanderComponent, decorators: [{
|
|
1684
1677
|
type: Component,
|
|
1685
|
-
args: [{
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1678
|
+
args: [{ selector: 'tree-node-expander', encapsulation: ViewEncapsulation.None, template: `
|
|
1679
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1680
|
+
<span
|
|
1681
|
+
*ngIf="node.hasChildren"
|
|
1682
|
+
[class.toggle-children-wrapper-expanded]="node.isExpanded"
|
|
1683
|
+
[class.toggle-children-wrapper-collapsed]="node.isCollapsed"
|
|
1684
|
+
class="toggle-children-wrapper"
|
|
1685
|
+
(click)="node.mouseAction('expanderClick', $event)"
|
|
1686
|
+
>
|
|
1687
|
+
<span class="toggle-children"></span>
|
|
1688
|
+
</span>
|
|
1689
|
+
<span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
|
|
1690
|
+
</span>
|
|
1691
|
+
</ng-container>
|
|
1692
|
+
`, imports: [TreeMobxAutorunDirective, NgIf] }]
|
|
1696
1693
|
}], propDecorators: { node: [{
|
|
1697
1694
|
type: Input
|
|
1698
|
-
}], index: [{
|
|
1699
|
-
type: Input
|
|
1700
|
-
}], template: [{
|
|
1701
|
-
type: Input
|
|
1702
1695
|
}] } });
|
|
1703
1696
|
|
|
1704
1697
|
const DRAG_OVER_CLASS = 'is-dragging-over';
|
|
@@ -1742,15 +1735,12 @@ class TreeDragDirective {
|
|
|
1742
1735
|
}
|
|
1743
1736
|
this.treeDraggedElement.set(null);
|
|
1744
1737
|
}
|
|
1745
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1746
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.
|
|
1738
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeDragDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: TreeDraggedElement }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1739
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.5", type: TreeDragDirective, isStandalone: true, selector: "[treeDrag]", inputs: { draggedElement: ["treeDrag", "draggedElement"], treeDragEnabled: "treeDragEnabled" }, host: { listeners: { "dragstart": "onDragStart($event)", "dragend": "onDragEnd()" } }, ngImport: i0 }); }
|
|
1747
1740
|
}
|
|
1748
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1741
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeDragDirective, decorators: [{
|
|
1749
1742
|
type: Directive,
|
|
1750
|
-
args: [{
|
|
1751
|
-
selector: '[treeDrag]',
|
|
1752
|
-
standalone: false
|
|
1753
|
-
}]
|
|
1743
|
+
args: [{ selector: '[treeDrag]' }]
|
|
1754
1744
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: TreeDraggedElement }, { type: i0.NgZone }], propDecorators: { draggedElement: [{
|
|
1755
1745
|
type: Input,
|
|
1756
1746
|
args: ['treeDrag']
|
|
@@ -1764,79 +1754,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
1764
1754
|
args: ['dragend']
|
|
1765
1755
|
}] } });
|
|
1766
1756
|
|
|
1767
|
-
class
|
|
1768
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1769
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
class="toggle-children-wrapper"
|
|
1776
|
-
(click)="node.mouseAction('expanderClick', $event)"
|
|
1777
|
-
>
|
|
1778
|
-
<span class="toggle-children"></span>
|
|
1779
|
-
</span>
|
|
1780
|
-
<span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
|
|
1781
|
-
</span>
|
|
1782
|
-
</ng-container>
|
|
1783
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1757
|
+
class TreeNodeContent {
|
|
1758
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeContent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1759
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeNodeContent, isStandalone: true, selector: "tree-node-content", inputs: { node: "node", index: "index", template: "template" }, ngImport: i0, template: `
|
|
1760
|
+
<span *ngIf="!template">{{ node.displayField }}</span>
|
|
1761
|
+
<ng-container
|
|
1762
|
+
[ngTemplateOutlet]="template"
|
|
1763
|
+
[ngTemplateOutletContext]="{ $implicit: node, node: node, index: index }">
|
|
1764
|
+
</ng-container>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1784
1765
|
}
|
|
1785
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1766
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeContent, decorators: [{
|
|
1786
1767
|
type: Component,
|
|
1787
|
-
args: [{
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
<span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
|
|
1799
|
-
</span>
|
|
1800
|
-
</ng-container>
|
|
1801
|
-
`, standalone: false }]
|
|
1768
|
+
args: [{
|
|
1769
|
+
selector: 'tree-node-content',
|
|
1770
|
+
encapsulation: ViewEncapsulation.None,
|
|
1771
|
+
template: `
|
|
1772
|
+
<span *ngIf="!template">{{ node.displayField }}</span>
|
|
1773
|
+
<ng-container
|
|
1774
|
+
[ngTemplateOutlet]="template"
|
|
1775
|
+
[ngTemplateOutletContext]="{ $implicit: node, node: node, index: index }">
|
|
1776
|
+
</ng-container>`,
|
|
1777
|
+
imports: [NgIf, NgTemplateOutlet]
|
|
1778
|
+
}]
|
|
1802
1779
|
}], propDecorators: { node: [{
|
|
1803
1780
|
type: Input
|
|
1804
|
-
}]
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TreeNodeCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1808
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: TreeNodeCheckboxComponent, isStandalone: false, selector: "tree-node-checkbox", inputs: { node: "node" }, ngImport: i0, template: `
|
|
1809
|
-
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1810
|
-
<input
|
|
1811
|
-
class="tree-node-checkbox"
|
|
1812
|
-
type="checkbox"
|
|
1813
|
-
(click)="node.mouseAction('checkboxClick', $event)"
|
|
1814
|
-
[checked]="node.isSelected"
|
|
1815
|
-
[indeterminate]="node.isPartiallySelected"
|
|
1816
|
-
/>
|
|
1817
|
-
</ng-container>
|
|
1818
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1819
|
-
}
|
|
1820
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TreeNodeCheckboxComponent, decorators: [{
|
|
1821
|
-
type: Component,
|
|
1822
|
-
args: [{ selector: 'tree-node-checkbox', encapsulation: ViewEncapsulation.None, template: `
|
|
1823
|
-
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1824
|
-
<input
|
|
1825
|
-
class="tree-node-checkbox"
|
|
1826
|
-
type="checkbox"
|
|
1827
|
-
(click)="node.mouseAction('checkboxClick', $event)"
|
|
1828
|
-
[checked]="node.isSelected"
|
|
1829
|
-
[indeterminate]="node.isPartiallySelected"
|
|
1830
|
-
/>
|
|
1831
|
-
</ng-container>
|
|
1832
|
-
`, standalone: false }]
|
|
1833
|
-
}], propDecorators: { node: [{
|
|
1781
|
+
}], index: [{
|
|
1782
|
+
type: Input
|
|
1783
|
+
}], template: [{
|
|
1834
1784
|
type: Input
|
|
1835
1785
|
}] } });
|
|
1836
1786
|
|
|
1837
1787
|
class TreeNodeWrapperComponent {
|
|
1838
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1839
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.
|
|
1788
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1789
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeNodeWrapperComponent, isStandalone: true, selector: "tree-node-wrapper", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
|
|
1840
1790
|
<div *ngIf="!templates.treeNodeWrapperTemplate" class="node-wrapper" [style.padding-left]="node.getNodePadding()">
|
|
1841
1791
|
<tree-node-checkbox *ngIf="node.options.useCheckbox" [node]="node"></tree-node-checkbox>
|
|
1842
1792
|
<tree-node-expander [node]="node"></tree-node-expander>
|
|
@@ -1865,9 +1815,9 @@ class TreeNodeWrapperComponent {
|
|
|
1865
1815
|
[ngTemplateOutlet]="templates.treeNodeWrapperTemplate"
|
|
1866
1816
|
[ngTemplateOutletContext]="{ $implicit: node, node: node, index: index, templates: templates }">
|
|
1867
1817
|
</ng-container>
|
|
1868
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
1818
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TreeNodeCheckboxComponent, selector: "tree-node-checkbox", inputs: ["node"] }, { kind: "component", type: TreeNodeExpanderComponent, selector: "tree-node-expander", inputs: ["node"] }, { kind: "directive", type: TreeDragDirective, selector: "[treeDrag]", inputs: ["treeDrag", "treeDragEnabled"] }, { kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }, { kind: "component", type: TreeNodeContent, selector: "tree-node-content", inputs: ["node", "index", "template"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1869
1819
|
}
|
|
1870
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1820
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeWrapperComponent, decorators: [{
|
|
1871
1821
|
type: Component,
|
|
1872
1822
|
args: [{ selector: 'tree-node-wrapper', encapsulation: ViewEncapsulation.None, template: `
|
|
1873
1823
|
<div *ngIf="!templates.treeNodeWrapperTemplate" class="node-wrapper" [style.padding-left]="node.getNodePadding()">
|
|
@@ -1898,7 +1848,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
1898
1848
|
[ngTemplateOutlet]="templates.treeNodeWrapperTemplate"
|
|
1899
1849
|
[ngTemplateOutletContext]="{ $implicit: node, node: node, index: index, templates: templates }">
|
|
1900
1850
|
</ng-container>
|
|
1901
|
-
`,
|
|
1851
|
+
`, imports: [NgIf, TreeNodeCheckboxComponent, TreeNodeExpanderComponent, TreeDragDirective, TreeDropDirective, TreeNodeContent, NgTemplateOutlet] }]
|
|
1902
1852
|
}], propDecorators: { node: [{
|
|
1903
1853
|
type: Input
|
|
1904
1854
|
}], index: [{
|
|
@@ -1907,6 +1857,103 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
1907
1857
|
type: Input
|
|
1908
1858
|
}] } });
|
|
1909
1859
|
|
|
1860
|
+
const EASE_ACCELERATION = 1.005;
|
|
1861
|
+
class TreeAnimateOpenDirective {
|
|
1862
|
+
set isOpen(value) {
|
|
1863
|
+
if (value) {
|
|
1864
|
+
this._show();
|
|
1865
|
+
if (this.isEnabled && this._isOpen === false) {
|
|
1866
|
+
this._animateOpen();
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
else {
|
|
1870
|
+
this.isEnabled ? this._animateClose() : this._hide();
|
|
1871
|
+
}
|
|
1872
|
+
this._isOpen = !!value;
|
|
1873
|
+
}
|
|
1874
|
+
;
|
|
1875
|
+
constructor(renderer, templateRef, viewContainerRef) {
|
|
1876
|
+
this.renderer = renderer;
|
|
1877
|
+
this.templateRef = templateRef;
|
|
1878
|
+
this.viewContainerRef = viewContainerRef;
|
|
1879
|
+
}
|
|
1880
|
+
_show() {
|
|
1881
|
+
if (this.innerElement)
|
|
1882
|
+
return;
|
|
1883
|
+
// create child view
|
|
1884
|
+
this.innerElement = this.viewContainerRef.createEmbeddedView(this.templateRef).rootNodes[0];
|
|
1885
|
+
}
|
|
1886
|
+
_hide() {
|
|
1887
|
+
this.viewContainerRef.clear();
|
|
1888
|
+
this.innerElement = null;
|
|
1889
|
+
}
|
|
1890
|
+
_animateOpen() {
|
|
1891
|
+
let delta = this.animateSpeed;
|
|
1892
|
+
let ease = this.animateAcceleration;
|
|
1893
|
+
let maxHeight = 0;
|
|
1894
|
+
// set height to 0
|
|
1895
|
+
this.renderer.setStyle(this.innerElement, 'max-height', `0`);
|
|
1896
|
+
// increase maxHeight until height doesn't change
|
|
1897
|
+
setTimeout(() => {
|
|
1898
|
+
const i = setInterval(() => {
|
|
1899
|
+
if (!this._isOpen || !this.innerElement)
|
|
1900
|
+
return clearInterval(i);
|
|
1901
|
+
maxHeight += delta;
|
|
1902
|
+
const roundedMaxHeight = Math.round(maxHeight);
|
|
1903
|
+
this.renderer.setStyle(this.innerElement, 'max-height', `${roundedMaxHeight}px`);
|
|
1904
|
+
const height = this.innerElement.getBoundingClientRect ? this.innerElement.getBoundingClientRect().height : 0; // TBD use renderer
|
|
1905
|
+
delta *= ease;
|
|
1906
|
+
ease *= EASE_ACCELERATION;
|
|
1907
|
+
if (height < roundedMaxHeight) {
|
|
1908
|
+
// Make maxHeight auto because animation finished and container might change height later on
|
|
1909
|
+
this.renderer.setStyle(this.innerElement, 'max-height', null);
|
|
1910
|
+
clearInterval(i);
|
|
1911
|
+
}
|
|
1912
|
+
}, 17);
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
_animateClose() {
|
|
1916
|
+
if (!this.innerElement)
|
|
1917
|
+
return;
|
|
1918
|
+
let delta = this.animateSpeed;
|
|
1919
|
+
let ease = this.animateAcceleration;
|
|
1920
|
+
let height = this.innerElement.getBoundingClientRect().height; // TBD use renderer
|
|
1921
|
+
// slowly decrease maxHeight to 0, starting from current height
|
|
1922
|
+
const i = setInterval(() => {
|
|
1923
|
+
if (this._isOpen || !this.innerElement)
|
|
1924
|
+
return clearInterval(i);
|
|
1925
|
+
height -= delta;
|
|
1926
|
+
this.renderer.setStyle(this.innerElement, 'max-height', `${height}px`);
|
|
1927
|
+
delta *= ease;
|
|
1928
|
+
ease *= EASE_ACCELERATION;
|
|
1929
|
+
if (height <= 0) {
|
|
1930
|
+
// after animation complete - remove child element
|
|
1931
|
+
this.viewContainerRef.clear();
|
|
1932
|
+
this.innerElement = null;
|
|
1933
|
+
clearInterval(i);
|
|
1934
|
+
}
|
|
1935
|
+
}, 17);
|
|
1936
|
+
}
|
|
1937
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeAnimateOpenDirective, deps: [{ token: i0.Renderer2 }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1938
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.5", type: TreeAnimateOpenDirective, isStandalone: true, selector: "[treeAnimateOpen]", inputs: { animateSpeed: ["treeAnimateOpenSpeed", "animateSpeed"], animateAcceleration: ["treeAnimateOpenAcceleration", "animateAcceleration"], isEnabled: ["treeAnimateOpenEnabled", "isEnabled"], isOpen: ["treeAnimateOpen", "isOpen"] }, ngImport: i0 }); }
|
|
1939
|
+
}
|
|
1940
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeAnimateOpenDirective, decorators: [{
|
|
1941
|
+
type: Directive,
|
|
1942
|
+
args: [{ selector: '[treeAnimateOpen]' }]
|
|
1943
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }], propDecorators: { animateSpeed: [{
|
|
1944
|
+
type: Input,
|
|
1945
|
+
args: ['treeAnimateOpenSpeed']
|
|
1946
|
+
}], animateAcceleration: [{
|
|
1947
|
+
type: Input,
|
|
1948
|
+
args: ['treeAnimateOpenAcceleration']
|
|
1949
|
+
}], isEnabled: [{
|
|
1950
|
+
type: Input,
|
|
1951
|
+
args: ['treeAnimateOpenEnabled']
|
|
1952
|
+
}], isOpen: [{
|
|
1953
|
+
type: Input,
|
|
1954
|
+
args: ['treeAnimateOpen']
|
|
1955
|
+
}] } });
|
|
1956
|
+
|
|
1910
1957
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1911
1958
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1912
1959
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1914,8 +1961,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
1914
1961
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1915
1962
|
};
|
|
1916
1963
|
class TreeNodeChildrenComponent {
|
|
1917
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
1918
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.
|
|
1964
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeChildrenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1965
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeNodeChildrenComponent, isStandalone: true, selector: "tree-node-children", inputs: { node: "node", templates: "templates" }, ngImport: i0, template: `
|
|
1919
1966
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1920
1967
|
<div
|
|
1921
1968
|
[class.tree-children]="true"
|
|
@@ -1943,9 +1990,9 @@ class TreeNodeChildrenComponent {
|
|
|
1943
1990
|
></tree-loading-component>
|
|
1944
1991
|
</div>
|
|
1945
1992
|
</ng-container>
|
|
1946
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() =>
|
|
1993
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => TreeMobxAutorunDirective), selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }, { kind: "directive", type: i0.forwardRef(() => TreeAnimateOpenDirective), selector: "[treeAnimateOpen]", inputs: ["treeAnimateOpenSpeed", "treeAnimateOpenAcceleration", "treeAnimateOpenEnabled", "treeAnimateOpen"] }, { kind: "directive", type: i0.forwardRef(() => NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i0.forwardRef(() => TreeNodeCollectionComponent), selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "component", type: i0.forwardRef(() => LoadingComponent), selector: "tree-loading-component", inputs: ["template", "node"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1947
1994
|
}
|
|
1948
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1995
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeChildrenComponent, decorators: [{
|
|
1949
1996
|
type: Component,
|
|
1950
1997
|
args: [{ selector: 'tree-node-children', encapsulation: ViewEncapsulation.None, template: `
|
|
1951
1998
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
@@ -1975,7 +2022,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
1975
2022
|
></tree-loading-component>
|
|
1976
2023
|
</div>
|
|
1977
2024
|
</ng-container>
|
|
1978
|
-
`,
|
|
2025
|
+
`, imports: [TreeMobxAutorunDirective, TreeAnimateOpenDirective, NgIf, forwardRef((() => TreeNodeCollectionComponent)), LoadingComponent] }]
|
|
1979
2026
|
}], propDecorators: { node: [{
|
|
1980
2027
|
type: Input
|
|
1981
2028
|
}], templates: [{
|
|
@@ -2025,8 +2072,8 @@ class TreeNodeCollectionComponent {
|
|
|
2025
2072
|
trackNode(index, node) {
|
|
2026
2073
|
return node.id;
|
|
2027
2074
|
}
|
|
2028
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
2029
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.
|
|
2075
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeCollectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2076
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeNodeCollectionComponent, isStandalone: true, selector: "tree-node-collection", inputs: { nodes: "nodes", treeModel: "treeModel", templates: "templates" }, ngImport: i0, template: `
|
|
2030
2077
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
2031
2078
|
<div [style.margin-top]="marginTop">
|
|
2032
2079
|
<tree-node
|
|
@@ -2038,7 +2085,7 @@ class TreeNodeCollectionComponent {
|
|
|
2038
2085
|
</tree-node>
|
|
2039
2086
|
</div>
|
|
2040
2087
|
</ng-container>
|
|
2041
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() =>
|
|
2088
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => TreeMobxAutorunDirective), selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }, { kind: "directive", type: i0.forwardRef(() => NgFor), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i0.forwardRef(() => TreeNodeComponent), selector: "TreeNode, tree-node", inputs: ["node", "index", "templates"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2042
2089
|
}
|
|
2043
2090
|
__decorate([
|
|
2044
2091
|
observable
|
|
@@ -2052,7 +2099,7 @@ __decorate([
|
|
|
2052
2099
|
__decorate([
|
|
2053
2100
|
action
|
|
2054
2101
|
], TreeNodeCollectionComponent.prototype, "setNodes", null);
|
|
2055
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
2102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeCollectionComponent, decorators: [{
|
|
2056
2103
|
type: Component,
|
|
2057
2104
|
args: [{
|
|
2058
2105
|
selector: 'tree-node-collection',
|
|
@@ -2070,7 +2117,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
2070
2117
|
</div>
|
|
2071
2118
|
</ng-container>
|
|
2072
2119
|
`,
|
|
2073
|
-
|
|
2120
|
+
imports: [TreeMobxAutorunDirective, NgFor, forwardRef((() => TreeNodeComponent))]
|
|
2074
2121
|
}]
|
|
2075
2122
|
}], propDecorators: { nodes: [{
|
|
2076
2123
|
type: Input
|
|
@@ -2080,8 +2127,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
2080
2127
|
type: Input
|
|
2081
2128
|
}], viewportNodes: [], marginTop: [], setNodes: [] } });
|
|
2082
2129
|
class TreeNodeComponent {
|
|
2083
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
2084
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.
|
|
2130
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2131
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeNodeComponent, isStandalone: true, selector: "TreeNode, tree-node", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
|
|
2085
2132
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
2086
2133
|
<div
|
|
2087
2134
|
*ngIf="!templates.treeNodeFullTemplate"
|
|
@@ -2125,9 +2172,9 @@ class TreeNodeComponent {
|
|
|
2125
2172
|
>
|
|
2126
2173
|
</ng-container>
|
|
2127
2174
|
</ng-container>
|
|
2128
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
2175
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: ["node", "dropIndex"] }, { kind: "component", type: TreeNodeWrapperComponent, selector: "tree-node-wrapper", inputs: ["node", "index", "templates"] }, { kind: "component", type: TreeNodeChildrenComponent, selector: "tree-node-children", inputs: ["node", "templates"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2129
2176
|
}
|
|
2130
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
2177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeNodeComponent, decorators: [{
|
|
2131
2178
|
type: Component,
|
|
2132
2179
|
args: [{ selector: 'TreeNode, tree-node', encapsulation: ViewEncapsulation.None, template: `
|
|
2133
2180
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
@@ -2173,7 +2220,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
2173
2220
|
>
|
|
2174
2221
|
</ng-container>
|
|
2175
2222
|
</ng-container>
|
|
2176
|
-
`,
|
|
2223
|
+
`, imports: [TreeMobxAutorunDirective, NgIf, TreeNodeDropSlot, TreeNodeWrapperComponent, TreeNodeChildrenComponent, NgTemplateOutlet] }]
|
|
2177
2224
|
}], propDecorators: { node: [{
|
|
2178
2225
|
type: Input
|
|
2179
2226
|
}], index: [{
|
|
@@ -2182,66 +2229,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
2182
2229
|
type: Input
|
|
2183
2230
|
}] } });
|
|
2184
2231
|
|
|
2185
|
-
class TreeViewportComponent {
|
|
2186
|
-
constructor(elementRef, virtualScroll) {
|
|
2187
|
-
this.elementRef = elementRef;
|
|
2188
|
-
this.virtualScroll = virtualScroll;
|
|
2189
|
-
this.setViewport = this.throttle(() => {
|
|
2190
|
-
this.virtualScroll.setViewport(this.elementRef.nativeElement);
|
|
2191
|
-
}, 17);
|
|
2192
|
-
this.scrollEventHandler = this.setViewport.bind(this);
|
|
2193
|
-
}
|
|
2194
|
-
ngOnInit() {
|
|
2195
|
-
this.virtualScroll.init();
|
|
2196
|
-
}
|
|
2197
|
-
ngAfterViewInit() {
|
|
2198
|
-
setTimeout(() => {
|
|
2199
|
-
this.setViewport();
|
|
2200
|
-
this.virtualScroll.fireEvent({ eventName: TREE_EVENTS.initialized });
|
|
2201
|
-
});
|
|
2202
|
-
let el = this.elementRef.nativeElement;
|
|
2203
|
-
el.addEventListener('scroll', this.scrollEventHandler);
|
|
2204
|
-
}
|
|
2205
|
-
ngOnDestroy() {
|
|
2206
|
-
this.virtualScroll.clear();
|
|
2207
|
-
let el = this.elementRef.nativeElement;
|
|
2208
|
-
el.removeEventListener('scroll', this.scrollEventHandler);
|
|
2209
|
-
}
|
|
2210
|
-
getTotalHeight() {
|
|
2211
|
-
return ((this.virtualScroll.isEnabled() &&
|
|
2212
|
-
this.virtualScroll.totalHeight + 'px') ||
|
|
2213
|
-
'auto');
|
|
2214
|
-
}
|
|
2215
|
-
throttle(func, timeFrame) {
|
|
2216
|
-
let lastTime = 0;
|
|
2217
|
-
return function () {
|
|
2218
|
-
let now = Date.now();
|
|
2219
|
-
if (now - lastTime >= timeFrame) {
|
|
2220
|
-
func();
|
|
2221
|
-
lastTime = now;
|
|
2222
|
-
}
|
|
2223
|
-
};
|
|
2224
|
-
}
|
|
2225
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TreeViewportComponent, deps: [{ token: i0.ElementRef }, { token: TreeVirtualScroll }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2226
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: TreeViewportComponent, isStandalone: false, selector: "tree-viewport", providers: [TreeVirtualScroll], ngImport: i0, template: `
|
|
2227
|
-
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
2228
|
-
<div [style.height]="getTotalHeight()">
|
|
2229
|
-
<ng-content></ng-content>
|
|
2230
|
-
</div>
|
|
2231
|
-
</ng-container>
|
|
2232
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }] }); }
|
|
2233
|
-
}
|
|
2234
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TreeViewportComponent, decorators: [{
|
|
2235
|
-
type: Component,
|
|
2236
|
-
args: [{ selector: 'tree-viewport', providers: [TreeVirtualScroll], template: `
|
|
2237
|
-
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
2238
|
-
<div [style.height]="getTotalHeight()">
|
|
2239
|
-
<ng-content></ng-content>
|
|
2240
|
-
</div>
|
|
2241
|
-
</ng-container>
|
|
2242
|
-
`, standalone: false }]
|
|
2243
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: TreeVirtualScroll }] });
|
|
2244
|
-
|
|
2245
2232
|
class TreeComponent {
|
|
2246
2233
|
// Will be handled in ngOnChanges
|
|
2247
2234
|
set nodes(nodes) {
|
|
@@ -2298,8 +2285,8 @@ class TreeComponent {
|
|
|
2298
2285
|
return obj;
|
|
2299
2286
|
}, {});
|
|
2300
2287
|
}
|
|
2301
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
2302
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.
|
|
2288
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeComponent, deps: [{ token: TreeModel }, { token: TreeDraggedElement }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2289
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TreeComponent, isStandalone: true, selector: "Tree, tree-root", inputs: { nodes: "nodes", options: "options", focused: "focused", state: "state" }, outputs: { toggleExpanded: "toggleExpanded", activate: "activate", deactivate: "deactivate", nodeActivate: "nodeActivate", nodeDeactivate: "nodeDeactivate", select: "select", deselect: "deselect", focus: "focus", blur: "blur", updateData: "updateData", initialized: "initialized", moveNode: "moveNode", copyNode: "copyNode", loadNodeChildren: "loadNodeChildren", changeFilter: "changeFilter", event: "event", stateChange: "stateChange" }, host: { listeners: { "body: keydown": "onKeydown($event)", "body: mousedown": "onMousedown($event)" } }, providers: [TreeModel], queries: [{ propertyName: "loadingTemplate", first: true, predicate: ["loadingTemplate"], descendants: true }, { propertyName: "treeNodeTemplate", first: true, predicate: ["treeNodeTemplate"], descendants: true }, { propertyName: "treeNodeWrapperTemplate", first: true, predicate: ["treeNodeWrapperTemplate"], descendants: true }, { propertyName: "treeNodeFullTemplate", first: true, predicate: ["treeNodeFullTemplate"], descendants: true }], viewQueries: [{ propertyName: "viewportComponent", first: true, predicate: ["viewport"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
2303
2290
|
<tree-viewport #viewport>
|
|
2304
2291
|
<div
|
|
2305
2292
|
class="angular-tree-component"
|
|
@@ -2324,9 +2311,9 @@ class TreeComponent {
|
|
|
2324
2311
|
</tree-node-drop-slot>
|
|
2325
2312
|
</div>
|
|
2326
2313
|
</tree-viewport>
|
|
2327
|
-
`, isInline: true, dependencies: [{ kind: "
|
|
2314
|
+
`, isInline: true, dependencies: [{ kind: "component", type: TreeViewportComponent, selector: "tree-viewport" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TreeNodeCollectionComponent, selector: "tree-node-collection", inputs: ["nodes", "treeModel", "templates"] }, { kind: "component", type: TreeNodeDropSlot, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: ["node", "dropIndex"] }] }); }
|
|
2328
2315
|
}
|
|
2329
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
2316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeComponent, decorators: [{
|
|
2330
2317
|
type: Component,
|
|
2331
2318
|
args: [{ selector: 'Tree, tree-root', providers: [TreeModel], template: `
|
|
2332
2319
|
<tree-viewport #viewport>
|
|
@@ -2353,7 +2340,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
2353
2340
|
</tree-node-drop-slot>
|
|
2354
2341
|
</div>
|
|
2355
2342
|
</tree-viewport>
|
|
2356
|
-
`,
|
|
2343
|
+
`, imports: [TreeViewportComponent, NgIf, TreeNodeCollectionComponent, TreeNodeDropSlot] }]
|
|
2357
2344
|
}], ctorParameters: () => [{ type: TreeModel }, { type: TreeDraggedElement }], propDecorators: { loadingTemplate: [{
|
|
2358
2345
|
type: ContentChild,
|
|
2359
2346
|
args: ['loadingTemplate', { static: false }]
|
|
@@ -2420,8 +2407,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
2420
2407
|
}] } });
|
|
2421
2408
|
|
|
2422
2409
|
class TreeModule {
|
|
2423
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
2424
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
|
2410
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2411
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: TreeModule, imports: [CommonModule, TreeComponent,
|
|
2425
2412
|
TreeNodeComponent,
|
|
2426
2413
|
TreeNodeContent,
|
|
2427
2414
|
LoadingComponent,
|
|
@@ -2435,7 +2422,7 @@ class TreeModule {
|
|
|
2435
2422
|
TreeNodeWrapperComponent,
|
|
2436
2423
|
TreeNodeCheckboxComponent,
|
|
2437
2424
|
TreeAnimateOpenDirective,
|
|
2438
|
-
TreeMobxAutorunDirective],
|
|
2425
|
+
TreeMobxAutorunDirective], exports: [TreeComponent,
|
|
2439
2426
|
TreeNodeComponent,
|
|
2440
2427
|
TreeNodeContent,
|
|
2441
2428
|
LoadingComponent,
|
|
@@ -2450,12 +2437,13 @@ class TreeModule {
|
|
|
2450
2437
|
TreeNodeCheckboxComponent,
|
|
2451
2438
|
TreeAnimateOpenDirective,
|
|
2452
2439
|
TreeMobxAutorunDirective] }); }
|
|
2453
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
|
2440
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeModule, imports: [CommonModule] }); }
|
|
2454
2441
|
}
|
|
2455
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
2442
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TreeModule, decorators: [{
|
|
2456
2443
|
type: NgModule,
|
|
2457
2444
|
args: [{
|
|
2458
|
-
declarations: [
|
|
2445
|
+
declarations: [],
|
|
2446
|
+
exports: [
|
|
2459
2447
|
TreeComponent,
|
|
2460
2448
|
TreeNodeComponent,
|
|
2461
2449
|
TreeNodeContent,
|
|
@@ -2472,8 +2460,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
2472
2460
|
TreeAnimateOpenDirective,
|
|
2473
2461
|
TreeMobxAutorunDirective
|
|
2474
2462
|
],
|
|
2475
|
-
|
|
2476
|
-
TreeComponent,
|
|
2463
|
+
imports: [CommonModule, TreeComponent,
|
|
2477
2464
|
TreeNodeComponent,
|
|
2478
2465
|
TreeNodeContent,
|
|
2479
2466
|
LoadingComponent,
|
|
@@ -2487,9 +2474,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
2487
2474
|
TreeNodeWrapperComponent,
|
|
2488
2475
|
TreeNodeCheckboxComponent,
|
|
2489
2476
|
TreeAnimateOpenDirective,
|
|
2490
|
-
TreeMobxAutorunDirective
|
|
2491
|
-
],
|
|
2492
|
-
imports: [CommonModule],
|
|
2477
|
+
TreeMobxAutorunDirective],
|
|
2493
2478
|
providers: []
|
|
2494
2479
|
}]
|
|
2495
2480
|
}] });
|