@ali-hm/angular-tree-component 19.1.2 → 20.0.3
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/README.md +2 -1
- package/fesm2022/ali-hm-angular-tree-component.mjs +346 -359
- package/fesm2022/ali-hm-angular-tree-component.mjs.map +1 -1
- package/index.d.ts +1109 -3
- package/package.json +3 -3
- package/lib/angular-tree-component.module.d.ts +0 -43
- package/lib/components/loading.component.d.ts +0 -9
- package/lib/components/tree-node-checkbox.component.d.ts +0 -7
- package/lib/components/tree-node-collection.component.d.ts +0 -34
- package/lib/components/tree-node-content.component.d.ts +0 -10
- package/lib/components/tree-node-drop-slot.component.d.ts +0 -10
- package/lib/components/tree-node-expander.component.d.ts +0 -7
- package/lib/components/tree-node-wrapper.component.d.ts +0 -9
- package/lib/components/tree-viewport.component.d.ts +0 -17
- package/lib/components/tree.component.d.ts +0 -47
- package/lib/constants/events.d.ts +0 -19
- package/lib/constants/keys.d.ts +0 -9
- package/lib/defs/api.d.ts +0 -611
- package/lib/directives/tree-animate-open.directive.d.ts +0 -20
- package/lib/directives/tree-drag.directive.d.ts +0 -21
- package/lib/directives/tree-drop.directive.d.ts +0 -33
- package/lib/mobx-angular/mobx-proxy.d.ts +0 -7
- package/lib/mobx-angular/tree-mobx-autorun.directive.d.ts +0 -17
- package/lib/models/tree-dragged-element.model.d.ts +0 -9
- package/lib/models/tree-node.model.d.ts +0 -83
- package/lib/models/tree-options.model.d.ts +0 -77
- package/lib/models/tree-virtual-scroll.model.d.ts +0 -27
- package/lib/models/tree.model.d.ts +0 -91
- package/public-api.d.ts +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { inject, TemplateRef, ViewContainerRef, Input, Directive, Injectable, ViewEncapsulation, Component, ElementRef, Renderer2, NgZone, 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 {
|
|
8
|
-
constructor(
|
|
9
|
-
this.templateRef =
|
|
10
|
-
this.viewContainer =
|
|
7
|
+
constructor() {
|
|
8
|
+
this.templateRef = inject(TemplateRef);
|
|
9
|
+
this.viewContainer = inject(ViewContainerRef);
|
|
11
10
|
this.templateBindings = {};
|
|
12
11
|
}
|
|
13
12
|
ngOnInit() {
|
|
@@ -31,16 +30,13 @@ class TreeMobxAutorunDirective {
|
|
|
31
30
|
this.dispose();
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
35
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
33
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeMobxAutorunDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
34
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: TreeMobxAutorunDirective, isStandalone: true, selector: "[treeMobxAutorun]", inputs: { treeMobxAutorun: "treeMobxAutorun" }, ngImport: i0 }); }
|
|
36
35
|
}
|
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeMobxAutorunDirective, decorators: [{
|
|
38
37
|
type: Directive,
|
|
39
|
-
args: [{
|
|
40
|
-
|
|
41
|
-
standalone: false
|
|
42
|
-
}]
|
|
43
|
-
}], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }], propDecorators: { treeMobxAutorun: [{
|
|
38
|
+
args: [{ selector: '[treeMobxAutorun]' }]
|
|
39
|
+
}], propDecorators: { treeMobxAutorun: [{
|
|
44
40
|
type: Input
|
|
45
41
|
}] } });
|
|
46
42
|
|
|
@@ -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: "
|
|
1049
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1044
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeModel, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1045
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", 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: "
|
|
1146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", 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: "
|
|
1168
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1163
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeDraggedElement, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1164
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeDraggedElement, providedIn: 'root' }); }
|
|
1169
1165
|
}
|
|
1170
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeDraggedElement, decorators: [{
|
|
1171
1167
|
type: Injectable,
|
|
1172
1168
|
args: [{
|
|
1173
1169
|
providedIn: 'root'
|
|
@@ -1189,12 +1185,13 @@ class TreeVirtualScroll {
|
|
|
1189
1185
|
get totalHeight() {
|
|
1190
1186
|
return this.treeModel.virtualRoot ? this.treeModel.virtualRoot.height : 0;
|
|
1191
1187
|
}
|
|
1192
|
-
constructor(
|
|
1193
|
-
this.treeModel =
|
|
1188
|
+
constructor() {
|
|
1189
|
+
this.treeModel = inject(TreeModel);
|
|
1194
1190
|
this.yBlocks = 0;
|
|
1195
1191
|
this.x = 0;
|
|
1196
1192
|
this.viewportHeight = null;
|
|
1197
1193
|
this.viewport = null;
|
|
1194
|
+
const treeModel = this.treeModel;
|
|
1198
1195
|
treeModel.virtualScroll = this;
|
|
1199
1196
|
this._dispose = [autorun(() => this.fixScroll())];
|
|
1200
1197
|
}
|
|
@@ -1315,8 +1312,8 @@ class TreeVirtualScroll {
|
|
|
1315
1312
|
if (this.y > maxY)
|
|
1316
1313
|
this._setYBlocks(maxY / Y_EPSILON);
|
|
1317
1314
|
}
|
|
1318
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1319
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1315
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeVirtualScroll, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1316
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeVirtualScroll }); }
|
|
1320
1317
|
}
|
|
1321
1318
|
__decorate$1([
|
|
1322
1319
|
observable$1
|
|
@@ -1345,9 +1342,9 @@ __decorate$1([
|
|
|
1345
1342
|
__decorate$1([
|
|
1346
1343
|
action$1
|
|
1347
1344
|
], TreeVirtualScroll.prototype, "scrollIntoView", null);
|
|
1348
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1345
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeVirtualScroll, decorators: [{
|
|
1349
1346
|
type: Injectable
|
|
1350
|
-
}], ctorParameters: () => [
|
|
1347
|
+
}], ctorParameters: () => [], propDecorators: { yBlocks: [], x: [], viewportHeight: [], y: [], totalHeight: [], _setYBlocks: [], recalcPositions: [], setViewport: [], scrollIntoView: [] } });
|
|
1351
1348
|
function binarySearch(nodes, condition, firstIndex = 0) {
|
|
1352
1349
|
let index = firstIndex;
|
|
1353
1350
|
let toIndex = nodes.length - 1;
|
|
@@ -1367,16 +1364,16 @@ function binarySearch(nodes, condition, firstIndex = 0) {
|
|
|
1367
1364
|
}
|
|
1368
1365
|
|
|
1369
1366
|
class LoadingComponent {
|
|
1370
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1371
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1367
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: LoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1368
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: LoadingComponent, isStandalone: true, selector: "tree-loading-component", inputs: { template: "template", node: "node" }, ngImport: i0, template: `
|
|
1372
1369
|
<span *ngIf="!template">loading...</span>
|
|
1373
1370
|
<ng-container
|
|
1374
1371
|
[ngTemplateOutlet]="template"
|
|
1375
1372
|
[ngTemplateOutletContext]="{ $implicit: node }">
|
|
1376
1373
|
</ng-container>
|
|
1377
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
1374
|
+
`, 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
1375
|
}
|
|
1379
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: LoadingComponent, decorators: [{
|
|
1380
1377
|
type: Component,
|
|
1381
1378
|
args: [{
|
|
1382
1379
|
encapsulation: ViewEncapsulation.None,
|
|
@@ -1388,7 +1385,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1388
1385
|
[ngTemplateOutletContext]="{ $implicit: node }">
|
|
1389
1386
|
</ng-container>
|
|
1390
1387
|
`,
|
|
1391
|
-
|
|
1388
|
+
imports: [NgIf, NgTemplateOutlet]
|
|
1392
1389
|
}]
|
|
1393
1390
|
}], propDecorators: { template: [{
|
|
1394
1391
|
type: Input
|
|
@@ -1396,6 +1393,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1396
1393
|
type: Input
|
|
1397
1394
|
}] } });
|
|
1398
1395
|
|
|
1396
|
+
class TreeViewportComponent {
|
|
1397
|
+
constructor() {
|
|
1398
|
+
this.elementRef = inject(ElementRef);
|
|
1399
|
+
this.virtualScroll = inject(TreeVirtualScroll);
|
|
1400
|
+
this.setViewport = this.throttle(() => {
|
|
1401
|
+
this.virtualScroll.setViewport(this.elementRef.nativeElement);
|
|
1402
|
+
}, 17);
|
|
1403
|
+
this.scrollEventHandler = this.setViewport.bind(this);
|
|
1404
|
+
}
|
|
1405
|
+
ngOnInit() {
|
|
1406
|
+
this.virtualScroll.init();
|
|
1407
|
+
}
|
|
1408
|
+
ngAfterViewInit() {
|
|
1409
|
+
setTimeout(() => {
|
|
1410
|
+
this.setViewport();
|
|
1411
|
+
this.virtualScroll.fireEvent({ eventName: TREE_EVENTS.initialized });
|
|
1412
|
+
});
|
|
1413
|
+
let el = this.elementRef.nativeElement;
|
|
1414
|
+
el.addEventListener('scroll', this.scrollEventHandler);
|
|
1415
|
+
}
|
|
1416
|
+
ngOnDestroy() {
|
|
1417
|
+
this.virtualScroll.clear();
|
|
1418
|
+
let el = this.elementRef.nativeElement;
|
|
1419
|
+
el.removeEventListener('scroll', this.scrollEventHandler);
|
|
1420
|
+
}
|
|
1421
|
+
getTotalHeight() {
|
|
1422
|
+
return ((this.virtualScroll.isEnabled() &&
|
|
1423
|
+
this.virtualScroll.totalHeight + 'px') ||
|
|
1424
|
+
'auto');
|
|
1425
|
+
}
|
|
1426
|
+
throttle(func, timeFrame) {
|
|
1427
|
+
let lastTime = 0;
|
|
1428
|
+
return function () {
|
|
1429
|
+
let now = Date.now();
|
|
1430
|
+
if (now - lastTime >= timeFrame) {
|
|
1431
|
+
func();
|
|
1432
|
+
lastTime = now;
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeViewportComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1437
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: TreeViewportComponent, isStandalone: true, selector: "tree-viewport", providers: [TreeVirtualScroll], ngImport: i0, template: `
|
|
1438
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1439
|
+
<div [style.height]="getTotalHeight()">
|
|
1440
|
+
<ng-content></ng-content>
|
|
1441
|
+
</div>
|
|
1442
|
+
</ng-container>
|
|
1443
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }] }); }
|
|
1444
|
+
}
|
|
1445
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeViewportComponent, decorators: [{
|
|
1446
|
+
type: Component,
|
|
1447
|
+
args: [{ selector: 'tree-viewport', providers: [TreeVirtualScroll], template: `
|
|
1448
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1449
|
+
<div [style.height]="getTotalHeight()">
|
|
1450
|
+
<ng-content></ng-content>
|
|
1451
|
+
</div>
|
|
1452
|
+
</ng-container>
|
|
1453
|
+
`, imports: [TreeMobxAutorunDirective] }]
|
|
1454
|
+
}], ctorParameters: () => [] });
|
|
1455
|
+
|
|
1456
|
+
// Re-export mobx operators to be able to use inside components with AOT:
|
|
1457
|
+
function actionInternal(...args) {
|
|
1458
|
+
return action$1(...args);
|
|
1459
|
+
}
|
|
1460
|
+
const action = Object.assign(actionInternal, action$1);
|
|
1461
|
+
function computedInternal(...args) {
|
|
1462
|
+
return computed$1(...args);
|
|
1463
|
+
}
|
|
1464
|
+
const computed = Object.assign(computedInternal, computed$1);
|
|
1465
|
+
function observableInternal(...args) {
|
|
1466
|
+
return observable$1(...args);
|
|
1467
|
+
}
|
|
1468
|
+
const observable = Object.assign(observableInternal, observable$1);
|
|
1469
|
+
|
|
1399
1470
|
const DRAG_OVER_CLASS$1 = 'is-dragging-over';
|
|
1400
1471
|
const DRAG_DISABLED_CLASS = 'is-dragging-over-disabled';
|
|
1401
1472
|
class TreeDropDirective {
|
|
@@ -1409,11 +1480,11 @@ class TreeDropDirective {
|
|
|
1409
1480
|
allowDrop($event) {
|
|
1410
1481
|
return this._allowDrop(this.treeDraggedElement.get(), $event);
|
|
1411
1482
|
}
|
|
1412
|
-
constructor(
|
|
1413
|
-
this.el =
|
|
1414
|
-
this.renderer =
|
|
1415
|
-
this.treeDraggedElement =
|
|
1416
|
-
this.ngZone =
|
|
1483
|
+
constructor() {
|
|
1484
|
+
this.el = inject(ElementRef);
|
|
1485
|
+
this.renderer = inject(Renderer2);
|
|
1486
|
+
this.treeDraggedElement = inject(TreeDraggedElement);
|
|
1487
|
+
this.ngZone = inject(NgZone);
|
|
1417
1488
|
this.allowDragoverStyling = true;
|
|
1418
1489
|
this.onDropCallback = new EventEmitter();
|
|
1419
1490
|
this.onDragOverCallback = new EventEmitter();
|
|
@@ -1491,16 +1562,13 @@ class TreeDropDirective {
|
|
|
1491
1562
|
removeDisabledClass() {
|
|
1492
1563
|
this.renderer.removeClass(this.el.nativeElement, DRAG_DISABLED_CLASS);
|
|
1493
1564
|
}
|
|
1494
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1495
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
1565
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1566
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", 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
1567
|
}
|
|
1497
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeDropDirective, decorators: [{
|
|
1498
1569
|
type: Directive,
|
|
1499
|
-
args: [{
|
|
1500
|
-
|
|
1501
|
-
standalone: false
|
|
1502
|
-
}]
|
|
1503
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: TreeDraggedElement }, { type: i0.NgZone }], propDecorators: { allowDragoverStyling: [{
|
|
1570
|
+
args: [{ selector: '[treeDrop]' }]
|
|
1571
|
+
}], ctorParameters: () => [], propDecorators: { allowDragoverStyling: [{
|
|
1504
1572
|
type: Input
|
|
1505
1573
|
}], onDropCallback: [{
|
|
1506
1574
|
type: Output,
|
|
@@ -1531,8 +1599,8 @@ class TreeNodeDropSlot {
|
|
|
1531
1599
|
allowDrop(element, $event) {
|
|
1532
1600
|
return this.node.options.allowDrop(element, { parent: this.node, index: this.dropIndex }, $event);
|
|
1533
1601
|
}
|
|
1534
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1535
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1602
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeDropSlot, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1603
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: TreeNodeDropSlot, isStandalone: true, selector: "TreeNodeDropSlot, tree-node-drop-slot", inputs: { node: "node", dropIndex: "dropIndex" }, ngImport: i0, template: `
|
|
1536
1604
|
<div
|
|
1537
1605
|
class="node-drop-slot"
|
|
1538
1606
|
(treeDrop)="onDrop($event)"
|
|
@@ -1541,7 +1609,7 @@ class TreeNodeDropSlot {
|
|
|
1541
1609
|
</div>
|
|
1542
1610
|
`, isInline: true, dependencies: [{ kind: "directive", type: TreeDropDirective, selector: "[treeDrop]", inputs: ["allowDragoverStyling", "treeAllowDrop"], outputs: ["treeDrop", "treeDropDragOver", "treeDropDragLeave", "treeDropDragEnter"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1543
1611
|
}
|
|
1544
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1612
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeDropSlot, decorators: [{
|
|
1545
1613
|
type: Component,
|
|
1546
1614
|
args: [{ selector: 'TreeNodeDropSlot, tree-node-drop-slot', encapsulation: ViewEncapsulation.None, template: `
|
|
1547
1615
|
<div
|
|
@@ -1550,164 +1618,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1550
1618
|
[treeAllowDrop]="allowDrop.bind(this)"
|
|
1551
1619
|
[allowDragoverStyling]="true">
|
|
1552
1620
|
</div>
|
|
1553
|
-
`,
|
|
1621
|
+
`, imports: [TreeDropDirective] }]
|
|
1554
1622
|
}], propDecorators: { node: [{
|
|
1555
1623
|
type: Input
|
|
1556
1624
|
}], dropIndex: [{
|
|
1557
1625
|
type: Input
|
|
1558
1626
|
}] } });
|
|
1559
1627
|
|
|
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.4", 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.4", type: TreeAnimateOpenDirective, isStandalone: false, selector: "[treeAnimateOpen]", inputs: { animateSpeed: ["treeAnimateOpenSpeed", "animateSpeed"], animateAcceleration: ["treeAnimateOpenAcceleration", "animateAcceleration"], isEnabled: ["treeAnimateOpenEnabled", "isEnabled"], isOpen: ["treeAnimateOpen", "isOpen"] }, ngImport: i0 }); }
|
|
1628
|
+
class TreeNodeCheckboxComponent {
|
|
1629
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1630
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: TreeNodeCheckboxComponent, isStandalone: true, selector: "tree-node-checkbox", inputs: { node: "node" }, ngImport: i0, template: `
|
|
1631
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1632
|
+
<input
|
|
1633
|
+
class="tree-node-checkbox"
|
|
1634
|
+
type="checkbox"
|
|
1635
|
+
(click)="node.mouseAction('checkboxClick', $event)"
|
|
1636
|
+
[checked]="node.isSelected"
|
|
1637
|
+
[indeterminate]="node.isPartiallySelected"
|
|
1638
|
+
/>
|
|
1639
|
+
</ng-container>
|
|
1640
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: TreeMobxAutorunDirective, selector: "[treeMobxAutorun]", inputs: ["treeMobxAutorun"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1653
1641
|
}
|
|
1654
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1655
|
-
type:
|
|
1656
|
-
args: [{
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
}], isOpen: [{
|
|
1670
|
-
type: Input,
|
|
1671
|
-
args: ['treeAnimateOpen']
|
|
1642
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeCheckboxComponent, decorators: [{
|
|
1643
|
+
type: Component,
|
|
1644
|
+
args: [{ selector: 'tree-node-checkbox', encapsulation: ViewEncapsulation.None, template: `
|
|
1645
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1646
|
+
<input
|
|
1647
|
+
class="tree-node-checkbox"
|
|
1648
|
+
type="checkbox"
|
|
1649
|
+
(click)="node.mouseAction('checkboxClick', $event)"
|
|
1650
|
+
[checked]="node.isSelected"
|
|
1651
|
+
[indeterminate]="node.isPartiallySelected"
|
|
1652
|
+
/>
|
|
1653
|
+
</ng-container>
|
|
1654
|
+
`, imports: [TreeMobxAutorunDirective] }]
|
|
1655
|
+
}], propDecorators: { node: [{
|
|
1656
|
+
type: Input
|
|
1672
1657
|
}] } });
|
|
1673
1658
|
|
|
1674
|
-
class
|
|
1675
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1676
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1659
|
+
class TreeNodeExpanderComponent {
|
|
1660
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeExpanderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1661
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: TreeNodeExpanderComponent, isStandalone: true, selector: "tree-node-expander", inputs: { node: "node" }, ngImport: i0, template: `
|
|
1662
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1663
|
+
<span
|
|
1664
|
+
*ngIf="node.hasChildren"
|
|
1665
|
+
[class.toggle-children-wrapper-expanded]="node.isExpanded"
|
|
1666
|
+
[class.toggle-children-wrapper-collapsed]="node.isCollapsed"
|
|
1667
|
+
class="toggle-children-wrapper"
|
|
1668
|
+
(click)="node.mouseAction('expanderClick', $event)"
|
|
1669
|
+
>
|
|
1670
|
+
<span class="toggle-children"></span>
|
|
1671
|
+
</span>
|
|
1672
|
+
<span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
|
|
1673
|
+
</span>
|
|
1674
|
+
</ng-container>
|
|
1675
|
+
`, 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
1676
|
}
|
|
1683
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1677
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeExpanderComponent, decorators: [{
|
|
1684
1678
|
type: Component,
|
|
1685
|
-
args: [{
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1679
|
+
args: [{ selector: 'tree-node-expander', encapsulation: ViewEncapsulation.None, template: `
|
|
1680
|
+
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1681
|
+
<span
|
|
1682
|
+
*ngIf="node.hasChildren"
|
|
1683
|
+
[class.toggle-children-wrapper-expanded]="node.isExpanded"
|
|
1684
|
+
[class.toggle-children-wrapper-collapsed]="node.isCollapsed"
|
|
1685
|
+
class="toggle-children-wrapper"
|
|
1686
|
+
(click)="node.mouseAction('expanderClick', $event)"
|
|
1687
|
+
>
|
|
1688
|
+
<span class="toggle-children"></span>
|
|
1689
|
+
</span>
|
|
1690
|
+
<span *ngIf="!node.hasChildren" class="toggle-children-placeholder">
|
|
1691
|
+
</span>
|
|
1692
|
+
</ng-container>
|
|
1693
|
+
`, imports: [TreeMobxAutorunDirective, NgIf] }]
|
|
1696
1694
|
}], propDecorators: { node: [{
|
|
1697
1695
|
type: Input
|
|
1698
|
-
}], index: [{
|
|
1699
|
-
type: Input
|
|
1700
|
-
}], template: [{
|
|
1701
|
-
type: Input
|
|
1702
1696
|
}] } });
|
|
1703
1697
|
|
|
1704
1698
|
const DRAG_OVER_CLASS = 'is-dragging-over';
|
|
1705
1699
|
class TreeDragDirective {
|
|
1706
|
-
constructor(
|
|
1707
|
-
this.el =
|
|
1708
|
-
this.renderer =
|
|
1709
|
-
this.treeDraggedElement =
|
|
1710
|
-
this.ngZone =
|
|
1700
|
+
constructor() {
|
|
1701
|
+
this.el = inject(ElementRef);
|
|
1702
|
+
this.renderer = inject(Renderer2);
|
|
1703
|
+
this.treeDraggedElement = inject(TreeDraggedElement);
|
|
1704
|
+
this.ngZone = inject(NgZone);
|
|
1711
1705
|
this.dragEventHandler = this.onDrag.bind(this);
|
|
1712
1706
|
}
|
|
1713
1707
|
ngAfterViewInit() {
|
|
@@ -1742,16 +1736,13 @@ class TreeDragDirective {
|
|
|
1742
1736
|
}
|
|
1743
1737
|
this.treeDraggedElement.set(null);
|
|
1744
1738
|
}
|
|
1745
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1746
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
1739
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeDragDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1740
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: TreeDragDirective, isStandalone: true, selector: "[treeDrag]", inputs: { draggedElement: ["treeDrag", "draggedElement"], treeDragEnabled: "treeDragEnabled" }, host: { listeners: { "dragstart": "onDragStart($event)", "dragend": "onDragEnd()" } }, ngImport: i0 }); }
|
|
1747
1741
|
}
|
|
1748
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeDragDirective, decorators: [{
|
|
1749
1743
|
type: Directive,
|
|
1750
|
-
args: [{
|
|
1751
|
-
|
|
1752
|
-
standalone: false
|
|
1753
|
-
}]
|
|
1754
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: TreeDraggedElement }, { type: i0.NgZone }], propDecorators: { draggedElement: [{
|
|
1744
|
+
args: [{ selector: '[treeDrag]' }]
|
|
1745
|
+
}], ctorParameters: () => [], propDecorators: { draggedElement: [{
|
|
1755
1746
|
type: Input,
|
|
1756
1747
|
args: ['treeDrag']
|
|
1757
1748
|
}], treeDragEnabled: [{
|
|
@@ -1764,79 +1755,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1764
1755
|
args: ['dragend']
|
|
1765
1756
|
}] } });
|
|
1766
1757
|
|
|
1767
|
-
class
|
|
1768
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1769
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
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 }); }
|
|
1758
|
+
class TreeNodeContent {
|
|
1759
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeContent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1760
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: TreeNodeContent, isStandalone: true, selector: "tree-node-content", inputs: { node: "node", index: "index", template: "template" }, ngImport: i0, template: `
|
|
1761
|
+
<span *ngIf="!template">{{ node.displayField }}</span>
|
|
1762
|
+
<ng-container
|
|
1763
|
+
[ngTemplateOutlet]="template"
|
|
1764
|
+
[ngTemplateOutletContext]="{ $implicit: node, node: node, index: index }">
|
|
1765
|
+
</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
1766
|
}
|
|
1785
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1767
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeContent, decorators: [{
|
|
1786
1768
|
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 }]
|
|
1769
|
+
args: [{
|
|
1770
|
+
selector: 'tree-node-content',
|
|
1771
|
+
encapsulation: ViewEncapsulation.None,
|
|
1772
|
+
template: `
|
|
1773
|
+
<span *ngIf="!template">{{ node.displayField }}</span>
|
|
1774
|
+
<ng-container
|
|
1775
|
+
[ngTemplateOutlet]="template"
|
|
1776
|
+
[ngTemplateOutletContext]="{ $implicit: node, node: node, index: index }">
|
|
1777
|
+
</ng-container>`,
|
|
1778
|
+
imports: [NgIf, NgTemplateOutlet]
|
|
1779
|
+
}]
|
|
1802
1780
|
}], propDecorators: { node: [{
|
|
1803
1781
|
type: Input
|
|
1804
|
-
}]
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: TreeNodeCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1808
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", 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.4", 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: [{
|
|
1782
|
+
}], index: [{
|
|
1783
|
+
type: Input
|
|
1784
|
+
}], template: [{
|
|
1834
1785
|
type: Input
|
|
1835
1786
|
}] } });
|
|
1836
1787
|
|
|
1837
1788
|
class TreeNodeWrapperComponent {
|
|
1838
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1839
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1789
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1790
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: TreeNodeWrapperComponent, isStandalone: true, selector: "tree-node-wrapper", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
|
|
1840
1791
|
<div *ngIf="!templates.treeNodeWrapperTemplate" class="node-wrapper" [style.padding-left]="node.getNodePadding()">
|
|
1841
1792
|
<tree-node-checkbox *ngIf="node.options.useCheckbox" [node]="node"></tree-node-checkbox>
|
|
1842
1793
|
<tree-node-expander [node]="node"></tree-node-expander>
|
|
@@ -1865,9 +1816,9 @@ class TreeNodeWrapperComponent {
|
|
|
1865
1816
|
[ngTemplateOutlet]="templates.treeNodeWrapperTemplate"
|
|
1866
1817
|
[ngTemplateOutletContext]="{ $implicit: node, node: node, index: index, templates: templates }">
|
|
1867
1818
|
</ng-container>
|
|
1868
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
1819
|
+
`, 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
1820
|
}
|
|
1870
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1821
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeWrapperComponent, decorators: [{
|
|
1871
1822
|
type: Component,
|
|
1872
1823
|
args: [{ selector: 'tree-node-wrapper', encapsulation: ViewEncapsulation.None, template: `
|
|
1873
1824
|
<div *ngIf="!templates.treeNodeWrapperTemplate" class="node-wrapper" [style.padding-left]="node.getNodePadding()">
|
|
@@ -1898,7 +1849,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1898
1849
|
[ngTemplateOutlet]="templates.treeNodeWrapperTemplate"
|
|
1899
1850
|
[ngTemplateOutletContext]="{ $implicit: node, node: node, index: index, templates: templates }">
|
|
1900
1851
|
</ng-container>
|
|
1901
|
-
`,
|
|
1852
|
+
`, imports: [NgIf, TreeNodeCheckboxComponent, TreeNodeExpanderComponent, TreeDragDirective, TreeDropDirective, TreeNodeContent, NgTemplateOutlet] }]
|
|
1902
1853
|
}], propDecorators: { node: [{
|
|
1903
1854
|
type: Input
|
|
1904
1855
|
}], index: [{
|
|
@@ -1907,6 +1858,103 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1907
1858
|
type: Input
|
|
1908
1859
|
}] } });
|
|
1909
1860
|
|
|
1861
|
+
const EASE_ACCELERATION = 1.005;
|
|
1862
|
+
class TreeAnimateOpenDirective {
|
|
1863
|
+
constructor() {
|
|
1864
|
+
this.renderer = inject(Renderer2);
|
|
1865
|
+
this.templateRef = inject(TemplateRef);
|
|
1866
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
1867
|
+
}
|
|
1868
|
+
set isOpen(value) {
|
|
1869
|
+
if (value) {
|
|
1870
|
+
this._show();
|
|
1871
|
+
if (this.isEnabled && this._isOpen === false) {
|
|
1872
|
+
this._animateOpen();
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
else {
|
|
1876
|
+
this.isEnabled ? this._animateClose() : this._hide();
|
|
1877
|
+
}
|
|
1878
|
+
this._isOpen = !!value;
|
|
1879
|
+
}
|
|
1880
|
+
;
|
|
1881
|
+
_show() {
|
|
1882
|
+
if (this.innerElement)
|
|
1883
|
+
return;
|
|
1884
|
+
// create child view
|
|
1885
|
+
this.innerElement = this.viewContainerRef.createEmbeddedView(this.templateRef).rootNodes[0];
|
|
1886
|
+
}
|
|
1887
|
+
_hide() {
|
|
1888
|
+
this.viewContainerRef.clear();
|
|
1889
|
+
this.innerElement = null;
|
|
1890
|
+
}
|
|
1891
|
+
_animateOpen() {
|
|
1892
|
+
let delta = this.animateSpeed;
|
|
1893
|
+
let ease = this.animateAcceleration;
|
|
1894
|
+
let maxHeight = 0;
|
|
1895
|
+
// set height to 0
|
|
1896
|
+
this.renderer.setStyle(this.innerElement, 'max-height', `0`);
|
|
1897
|
+
// increase maxHeight until height doesn't change
|
|
1898
|
+
setTimeout(() => {
|
|
1899
|
+
const i = setInterval(() => {
|
|
1900
|
+
if (!this._isOpen || !this.innerElement)
|
|
1901
|
+
return clearInterval(i);
|
|
1902
|
+
maxHeight += delta;
|
|
1903
|
+
const roundedMaxHeight = Math.round(maxHeight);
|
|
1904
|
+
this.renderer.setStyle(this.innerElement, 'max-height', `${roundedMaxHeight}px`);
|
|
1905
|
+
const height = this.innerElement.getBoundingClientRect ? this.innerElement.getBoundingClientRect().height : 0; // TBD use renderer
|
|
1906
|
+
delta *= ease;
|
|
1907
|
+
ease *= EASE_ACCELERATION;
|
|
1908
|
+
if (height < roundedMaxHeight) {
|
|
1909
|
+
// Make maxHeight auto because animation finished and container might change height later on
|
|
1910
|
+
this.renderer.setStyle(this.innerElement, 'max-height', null);
|
|
1911
|
+
clearInterval(i);
|
|
1912
|
+
}
|
|
1913
|
+
}, 17);
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
_animateClose() {
|
|
1917
|
+
if (!this.innerElement)
|
|
1918
|
+
return;
|
|
1919
|
+
let delta = this.animateSpeed;
|
|
1920
|
+
let ease = this.animateAcceleration;
|
|
1921
|
+
let height = this.innerElement.getBoundingClientRect().height; // TBD use renderer
|
|
1922
|
+
// slowly decrease maxHeight to 0, starting from current height
|
|
1923
|
+
const i = setInterval(() => {
|
|
1924
|
+
if (this._isOpen || !this.innerElement)
|
|
1925
|
+
return clearInterval(i);
|
|
1926
|
+
height -= delta;
|
|
1927
|
+
this.renderer.setStyle(this.innerElement, 'max-height', `${height}px`);
|
|
1928
|
+
delta *= ease;
|
|
1929
|
+
ease *= EASE_ACCELERATION;
|
|
1930
|
+
if (height <= 0) {
|
|
1931
|
+
// after animation complete - remove child element
|
|
1932
|
+
this.viewContainerRef.clear();
|
|
1933
|
+
this.innerElement = null;
|
|
1934
|
+
clearInterval(i);
|
|
1935
|
+
}
|
|
1936
|
+
}, 17);
|
|
1937
|
+
}
|
|
1938
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeAnimateOpenDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1939
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: TreeAnimateOpenDirective, isStandalone: true, selector: "[treeAnimateOpen]", inputs: { animateSpeed: ["treeAnimateOpenSpeed", "animateSpeed"], animateAcceleration: ["treeAnimateOpenAcceleration", "animateAcceleration"], isEnabled: ["treeAnimateOpenEnabled", "isEnabled"], isOpen: ["treeAnimateOpen", "isOpen"] }, ngImport: i0 }); }
|
|
1940
|
+
}
|
|
1941
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeAnimateOpenDirective, decorators: [{
|
|
1942
|
+
type: Directive,
|
|
1943
|
+
args: [{ selector: '[treeAnimateOpen]' }]
|
|
1944
|
+
}], propDecorators: { animateSpeed: [{
|
|
1945
|
+
type: Input,
|
|
1946
|
+
args: ['treeAnimateOpenSpeed']
|
|
1947
|
+
}], animateAcceleration: [{
|
|
1948
|
+
type: Input,
|
|
1949
|
+
args: ['treeAnimateOpenAcceleration']
|
|
1950
|
+
}], isEnabled: [{
|
|
1951
|
+
type: Input,
|
|
1952
|
+
args: ['treeAnimateOpenEnabled']
|
|
1953
|
+
}], isOpen: [{
|
|
1954
|
+
type: Input,
|
|
1955
|
+
args: ['treeAnimateOpen']
|
|
1956
|
+
}] } });
|
|
1957
|
+
|
|
1910
1958
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1911
1959
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1912
1960
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1914,8 +1962,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
1914
1962
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1915
1963
|
};
|
|
1916
1964
|
class TreeNodeChildrenComponent {
|
|
1917
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1918
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1965
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeChildrenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1966
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: TreeNodeChildrenComponent, isStandalone: true, selector: "tree-node-children", inputs: { node: "node", templates: "templates" }, ngImport: i0, template: `
|
|
1919
1967
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
1920
1968
|
<div
|
|
1921
1969
|
[class.tree-children]="true"
|
|
@@ -1943,9 +1991,9 @@ class TreeNodeChildrenComponent {
|
|
|
1943
1991
|
></tree-loading-component>
|
|
1944
1992
|
</div>
|
|
1945
1993
|
</ng-container>
|
|
1946
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() =>
|
|
1994
|
+
`, 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
1995
|
}
|
|
1948
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1996
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeChildrenComponent, decorators: [{
|
|
1949
1997
|
type: Component,
|
|
1950
1998
|
args: [{ selector: 'tree-node-children', encapsulation: ViewEncapsulation.None, template: `
|
|
1951
1999
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
@@ -1975,7 +2023,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
1975
2023
|
></tree-loading-component>
|
|
1976
2024
|
</div>
|
|
1977
2025
|
</ng-container>
|
|
1978
|
-
`,
|
|
2026
|
+
`, imports: [TreeMobxAutorunDirective, TreeAnimateOpenDirective, NgIf, forwardRef((() => TreeNodeCollectionComponent)), LoadingComponent] }]
|
|
1979
2027
|
}], propDecorators: { node: [{
|
|
1980
2028
|
type: Input
|
|
1981
2029
|
}], templates: [{
|
|
@@ -2025,8 +2073,8 @@ class TreeNodeCollectionComponent {
|
|
|
2025
2073
|
trackNode(index, node) {
|
|
2026
2074
|
return node.id;
|
|
2027
2075
|
}
|
|
2028
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2029
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
2076
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeCollectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2077
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: TreeNodeCollectionComponent, isStandalone: true, selector: "tree-node-collection", inputs: { nodes: "nodes", treeModel: "treeModel", templates: "templates" }, ngImport: i0, template: `
|
|
2030
2078
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
2031
2079
|
<div [style.margin-top]="marginTop">
|
|
2032
2080
|
<tree-node
|
|
@@ -2038,7 +2086,7 @@ class TreeNodeCollectionComponent {
|
|
|
2038
2086
|
</tree-node>
|
|
2039
2087
|
</div>
|
|
2040
2088
|
</ng-container>
|
|
2041
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() =>
|
|
2089
|
+
`, 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
2090
|
}
|
|
2043
2091
|
__decorate([
|
|
2044
2092
|
observable
|
|
@@ -2052,7 +2100,7 @@ __decorate([
|
|
|
2052
2100
|
__decorate([
|
|
2053
2101
|
action
|
|
2054
2102
|
], TreeNodeCollectionComponent.prototype, "setNodes", null);
|
|
2055
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeCollectionComponent, decorators: [{
|
|
2056
2104
|
type: Component,
|
|
2057
2105
|
args: [{
|
|
2058
2106
|
selector: 'tree-node-collection',
|
|
@@ -2070,7 +2118,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
2070
2118
|
</div>
|
|
2071
2119
|
</ng-container>
|
|
2072
2120
|
`,
|
|
2073
|
-
|
|
2121
|
+
imports: [TreeMobxAutorunDirective, NgFor, forwardRef((() => TreeNodeComponent))]
|
|
2074
2122
|
}]
|
|
2075
2123
|
}], propDecorators: { nodes: [{
|
|
2076
2124
|
type: Input
|
|
@@ -2080,8 +2128,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
2080
2128
|
type: Input
|
|
2081
2129
|
}], viewportNodes: [], marginTop: [], setNodes: [] } });
|
|
2082
2130
|
class TreeNodeComponent {
|
|
2083
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2084
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
2131
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2132
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: TreeNodeComponent, isStandalone: true, selector: "TreeNode, tree-node", inputs: { node: "node", index: "index", templates: "templates" }, ngImport: i0, template: `
|
|
2085
2133
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
2086
2134
|
<div
|
|
2087
2135
|
*ngIf="!templates.treeNodeFullTemplate"
|
|
@@ -2125,9 +2173,9 @@ class TreeNodeComponent {
|
|
|
2125
2173
|
>
|
|
2126
2174
|
</ng-container>
|
|
2127
2175
|
</ng-container>
|
|
2128
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
2176
|
+
`, 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
2177
|
}
|
|
2130
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeNodeComponent, decorators: [{
|
|
2131
2179
|
type: Component,
|
|
2132
2180
|
args: [{ selector: 'TreeNode, tree-node', encapsulation: ViewEncapsulation.None, template: `
|
|
2133
2181
|
<ng-container *treeMobxAutorun="{ dontDetach: true }">
|
|
@@ -2173,7 +2221,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
2173
2221
|
>
|
|
2174
2222
|
</ng-container>
|
|
2175
2223
|
</ng-container>
|
|
2176
|
-
`,
|
|
2224
|
+
`, imports: [TreeMobxAutorunDirective, NgIf, TreeNodeDropSlot, TreeNodeWrapperComponent, TreeNodeChildrenComponent, NgTemplateOutlet] }]
|
|
2177
2225
|
}], propDecorators: { node: [{
|
|
2178
2226
|
type: Input
|
|
2179
2227
|
}], index: [{
|
|
@@ -2182,66 +2230,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
2182
2230
|
type: Input
|
|
2183
2231
|
}] } });
|
|
2184
2232
|
|
|
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.4", 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.4", 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.4", 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
2233
|
class TreeComponent {
|
|
2246
2234
|
// Will be handled in ngOnChanges
|
|
2247
2235
|
set nodes(nodes) {
|
|
@@ -2256,9 +2244,10 @@ class TreeComponent {
|
|
|
2256
2244
|
set state(state) {
|
|
2257
2245
|
this.treeModel.setState(state);
|
|
2258
2246
|
}
|
|
2259
|
-
constructor(
|
|
2260
|
-
this.treeModel =
|
|
2261
|
-
this.treeDraggedElement =
|
|
2247
|
+
constructor() {
|
|
2248
|
+
this.treeModel = inject(TreeModel);
|
|
2249
|
+
this.treeDraggedElement = inject(TreeDraggedElement);
|
|
2250
|
+
const treeModel = this.treeModel;
|
|
2262
2251
|
treeModel.eventNames.forEach((name) => this[name] = new EventEmitter());
|
|
2263
2252
|
treeModel.subscribeToState((state) => this.stateChange.emit(state));
|
|
2264
2253
|
}
|
|
@@ -2298,8 +2287,8 @@ class TreeComponent {
|
|
|
2298
2287
|
return obj;
|
|
2299
2288
|
}, {});
|
|
2300
2289
|
}
|
|
2301
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2302
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
2290
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2291
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", 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
2292
|
<tree-viewport #viewport>
|
|
2304
2293
|
<div
|
|
2305
2294
|
class="angular-tree-component"
|
|
@@ -2324,9 +2313,9 @@ class TreeComponent {
|
|
|
2324
2313
|
</tree-node-drop-slot>
|
|
2325
2314
|
</div>
|
|
2326
2315
|
</tree-viewport>
|
|
2327
|
-
`, isInline: true, dependencies: [{ kind: "
|
|
2316
|
+
`, 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
2317
|
}
|
|
2329
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2318
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeComponent, decorators: [{
|
|
2330
2319
|
type: Component,
|
|
2331
2320
|
args: [{ selector: 'Tree, tree-root', providers: [TreeModel], template: `
|
|
2332
2321
|
<tree-viewport #viewport>
|
|
@@ -2353,8 +2342,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
2353
2342
|
</tree-node-drop-slot>
|
|
2354
2343
|
</div>
|
|
2355
2344
|
</tree-viewport>
|
|
2356
|
-
`,
|
|
2357
|
-
}], ctorParameters: () => [
|
|
2345
|
+
`, imports: [TreeViewportComponent, NgIf, TreeNodeCollectionComponent, TreeNodeDropSlot] }]
|
|
2346
|
+
}], ctorParameters: () => [], propDecorators: { loadingTemplate: [{
|
|
2358
2347
|
type: ContentChild,
|
|
2359
2348
|
args: ['loadingTemplate', { static: false }]
|
|
2360
2349
|
}], treeNodeTemplate: [{
|
|
@@ -2420,8 +2409,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
2420
2409
|
}] } });
|
|
2421
2410
|
|
|
2422
2411
|
class TreeModule {
|
|
2423
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2424
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
2412
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2413
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: TreeModule, imports: [CommonModule, TreeComponent,
|
|
2425
2414
|
TreeNodeComponent,
|
|
2426
2415
|
TreeNodeContent,
|
|
2427
2416
|
LoadingComponent,
|
|
@@ -2435,7 +2424,7 @@ class TreeModule {
|
|
|
2435
2424
|
TreeNodeWrapperComponent,
|
|
2436
2425
|
TreeNodeCheckboxComponent,
|
|
2437
2426
|
TreeAnimateOpenDirective,
|
|
2438
|
-
TreeMobxAutorunDirective],
|
|
2427
|
+
TreeMobxAutorunDirective], exports: [TreeComponent,
|
|
2439
2428
|
TreeNodeComponent,
|
|
2440
2429
|
TreeNodeContent,
|
|
2441
2430
|
LoadingComponent,
|
|
@@ -2450,12 +2439,13 @@ class TreeModule {
|
|
|
2450
2439
|
TreeNodeCheckboxComponent,
|
|
2451
2440
|
TreeAnimateOpenDirective,
|
|
2452
2441
|
TreeMobxAutorunDirective] }); }
|
|
2453
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
2442
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeModule, imports: [CommonModule] }); }
|
|
2454
2443
|
}
|
|
2455
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2444
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TreeModule, decorators: [{
|
|
2456
2445
|
type: NgModule,
|
|
2457
2446
|
args: [{
|
|
2458
|
-
declarations: [
|
|
2447
|
+
declarations: [],
|
|
2448
|
+
exports: [
|
|
2459
2449
|
TreeComponent,
|
|
2460
2450
|
TreeNodeComponent,
|
|
2461
2451
|
TreeNodeContent,
|
|
@@ -2472,8 +2462,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
2472
2462
|
TreeAnimateOpenDirective,
|
|
2473
2463
|
TreeMobxAutorunDirective
|
|
2474
2464
|
],
|
|
2475
|
-
|
|
2476
|
-
TreeComponent,
|
|
2465
|
+
imports: [CommonModule, TreeComponent,
|
|
2477
2466
|
TreeNodeComponent,
|
|
2478
2467
|
TreeNodeContent,
|
|
2479
2468
|
LoadingComponent,
|
|
@@ -2487,9 +2476,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
2487
2476
|
TreeNodeWrapperComponent,
|
|
2488
2477
|
TreeNodeCheckboxComponent,
|
|
2489
2478
|
TreeAnimateOpenDirective,
|
|
2490
|
-
TreeMobxAutorunDirective
|
|
2491
|
-
],
|
|
2492
|
-
imports: [CommonModule],
|
|
2479
|
+
TreeMobxAutorunDirective],
|
|
2493
2480
|
providers: []
|
|
2494
2481
|
}]
|
|
2495
2482
|
}] });
|