@rxap/tree 21.0.1-dev.0 → 21.0.1
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/CHANGELOG.md +57 -0
- package/compodoc/changelog.html +55 -0
- package/compodoc/components/TreeComponent.html +709 -758
- package/compodoc/dependencies.html +8 -8
- package/compodoc/directives/TreeContentDirective.html +4 -74
- package/compodoc/injectables/DefaultTreeApplyFilterMethod.html +13 -26
- package/compodoc/injectables/TreeDataSource.html +77 -191
- package/compodoc/interfaces/TreeApplyFilterParameter.html +8 -21
- package/compodoc/interfaces/TreeDataSourceMetadata.html +8 -21
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +1736 -1945
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/DefaultTreeApplyFilterMethod.html +2 -2
- package/docs/html/classes/SearchForm.html +2 -2
- package/docs/html/classes/TreeComponent.html +13 -21
- package/docs/html/classes/TreeContentDirective.html +2 -2
- package/docs/html/classes/TreeDataSource.html +16 -16
- package/docs/html/functions/FormFactory.html +1 -1
- package/docs/html/functions/flatTree.html +1 -1
- package/docs/html/functions/isSelectionChange.html +1 -1
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/ISearchForm.html +2 -2
- package/docs/html/interfaces/TreeApplyFilterParameter.html +2 -2
- package/docs/html/interfaces/TreeDataSourceMetadata.html +3 -3
- package/docs/html/modules.html +1 -1
- package/docs/html/variables/RXAP_TREE_CONTENT_EDITABLE_METHOD.html +1 -1
- package/docs/html/variables/RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD.html +1 -1
- package/docs/html/variables/RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD.html +1 -1
- package/docs/html/variables/RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD.html +1 -1
- package/docs/html/variables/SearchFormProviders.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/DefaultTreeApplyFilterMethod.md +5 -5
- package/docs/markdown/classes/SearchForm.md +5 -5
- package/docs/markdown/classes/TreeComponent.md +76 -126
- package/docs/markdown/classes/TreeContentDirective.md +4 -12
- package/docs/markdown/classes/TreeDataSource.md +89 -107
- package/docs/markdown/functions/FormFactory.md +2 -2
- package/docs/markdown/functions/flatTree.md +2 -2
- package/docs/markdown/functions/isSelectionChange.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/markdown/interfaces/ISearchForm.md +4 -4
- package/docs/markdown/interfaces/TreeApplyFilterParameter.md +5 -5
- package/docs/markdown/interfaces/TreeDataSourceMetadata.md +8 -8
- package/docs/markdown/variables/RXAP_TREE_CONTENT_EDITABLE_METHOD.md +2 -2
- package/docs/markdown/variables/RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD.md +2 -2
- package/docs/markdown/variables/RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD.md +2 -2
- package/docs/markdown/variables/RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD.md +2 -2
- package/docs/markdown/variables/SearchFormProviders.md +2 -2
- package/docs/wiki/Class.DefaultTreeApplyFilterMethod.md +4 -4
- package/docs/wiki/Class.SearchForm.md +4 -4
- package/docs/wiki/Class.TreeComponent.md +75 -125
- package/docs/wiki/Class.TreeContentDirective.md +3 -11
- package/docs/wiki/Class.TreeDataSource.md +88 -106
- package/docs/wiki/Function.FormFactory.md +1 -1
- package/docs/wiki/Function.flatTree.md +1 -1
- package/docs/wiki/Function.isSelectionChange.md +1 -1
- package/docs/wiki/Interface.ISearchForm.md +3 -3
- package/docs/wiki/Interface.TreeApplyFilterParameter.md +4 -4
- package/docs/wiki/Interface.TreeDataSourceMetadata.md +7 -7
- package/docs/wiki/Variable.RXAP_TREE_CONTENT_EDITABLE_METHOD.md +1 -1
- package/docs/wiki/Variable.RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD.md +1 -1
- package/docs/wiki/Variable.RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD.md +1 -1
- package/docs/wiki/Variable.RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD.md +1 -1
- package/docs/wiki/Variable.SearchFormProviders.md +1 -1
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-tree.mjs +164 -217
- package/fesm2022/rxap-tree.mjs.map +1 -1
- package/package.json +25 -25
- package/types/rxap-tree.d.ts +37 -38
package/fesm2022/rxap-tree.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { Injectable, INJECTOR, Optional, SkipSelf, InjectionToken,
|
|
3
|
+
import { Injectable, INJECTOR, Optional, SkipSelf, InjectionToken, inject, TemplateRef, Directive, ViewContainerRef, ElementRef, input, computed, contentChild, output, linkedSignal, signal, viewChild, effect, untracked, afterNextRender, isDevMode, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import { UseFormControl, RxapFormControl, RxapForm, RxapFormBuilder, RXAP_FORM_INITIAL_STATE, RXAP_FORM_DEFINITION } from '@rxap/forms';
|
|
5
5
|
import * as i8 from '@angular/cdk/portal';
|
|
6
6
|
import { TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
@@ -23,8 +23,8 @@ import { MatTreeModule } from '@angular/material/tree';
|
|
|
23
23
|
import { ContenteditableDirective } from '@rxap/contenteditable';
|
|
24
24
|
import { Node } from '@rxap/data-structure-tree';
|
|
25
25
|
import { IconDirective } from '@rxap/material-directives/icon';
|
|
26
|
-
import { coerceArray, getIdentifierPropertyValue, joinPath, Required
|
|
27
|
-
import {
|
|
26
|
+
import { DebounceCall, coerceArray, getIdentifierPropertyValue, joinPath, Required } from '@rxap/utilities';
|
|
27
|
+
import { map, startWith, tap, switchMap } from 'rxjs/operators';
|
|
28
28
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
29
29
|
import { BaseDataSource, RXAP_DATA_SOURCE_METADATA, RxapDataSource } from '@rxap/data-source';
|
|
30
30
|
import { ToggleSubject } from '@rxap/rxjs';
|
|
@@ -73,10 +73,10 @@ const SearchFormProviders = [
|
|
|
73
73
|
const RXAP_TREE_CONTENT_EDITABLE_METHOD = new InjectionToken('rxap/tree-content-editable-method');
|
|
74
74
|
|
|
75
75
|
class TreeContentDirective {
|
|
76
|
-
constructor(
|
|
77
|
-
this.template =
|
|
76
|
+
constructor() {
|
|
77
|
+
this.template = inject(TemplateRef);
|
|
78
78
|
}
|
|
79
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeContentDirective, deps: [
|
|
79
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
80
80
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: TreeContentDirective, isStandalone: true, selector: "ng-template[rxapTreeContent]", ngImport: i0 }); }
|
|
81
81
|
}
|
|
82
82
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeContentDirective, decorators: [{
|
|
@@ -85,10 +85,156 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
85
85
|
selector: 'ng-template[rxapTreeContent]',
|
|
86
86
|
standalone: true,
|
|
87
87
|
}]
|
|
88
|
-
}]
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
}] });
|
|
89
|
+
|
|
90
|
+
class TreeComponent {
|
|
91
|
+
constructor() {
|
|
92
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
93
|
+
this.elementRef = inject(ElementRef);
|
|
94
|
+
this.searchForm = inject(RXAP_FORM_DEFINITION, { optional: true });
|
|
95
|
+
this.dataSource = input.required(...(ngDevMode ? [{ debugName: "dataSource" }] : /* istanbul ignore next */ []));
|
|
96
|
+
this.contentEditableMethodInput = input(null, { ...(ngDevMode ? { debugName: "contentEditableMethodInput" } : /* istanbul ignore next */ {}), alias: 'contentEditableMethod' });
|
|
97
|
+
this.injectedContentEditableMethod = inject(RXAP_TREE_CONTENT_EDITABLE_METHOD, { optional: true });
|
|
98
|
+
this.contentEditableMethod = computed(() => this.contentEditableMethodInput() ?? this.injectedContentEditableMethod, ...(ngDevMode ? [{ debugName: "contentEditableMethod" }] : /* istanbul ignore next */ []));
|
|
99
|
+
this.toDisplay = input(...(ngDevMode ? [undefined, { debugName: "toDisplay" }] : /* istanbul ignore next */ []));
|
|
100
|
+
this.getIcon = input(...(ngDevMode ? [undefined, { debugName: "getIcon" }] : /* istanbul ignore next */ []));
|
|
101
|
+
this.getType = input(...(ngDevMode ? [undefined, { debugName: "getType" }] : /* istanbul ignore next */ []));
|
|
102
|
+
this.getStyle = input(...(ngDevMode ? [undefined, { debugName: "getStyle" }] : /* istanbul ignore next */ []));
|
|
103
|
+
this.multipleInput = input(false, { ...(ngDevMode ? { debugName: "multipleInput" } : /* istanbul ignore next */ {}), alias: 'multiple' });
|
|
104
|
+
this.multiple = computed(() => this.dataSource().metadata?.selectMultiple ?? this.multipleInput(), ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
105
|
+
this.hasDetails = input(...(ngDevMode ? [undefined, { debugName: "hasDetails" }] : /* istanbul ignore next */ []));
|
|
106
|
+
this.content = contentChild(TreeContentDirective, ...(ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []));
|
|
107
|
+
this.hideLeafIcon = input(false, ...(ngDevMode ? [{ debugName: "hideLeafIcon" }] : /* istanbul ignore next */ []));
|
|
108
|
+
this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
|
|
109
|
+
this.details = output();
|
|
110
|
+
this.dividerOffsetInput = input('256px', { ...(ngDevMode ? { debugName: "dividerOffsetInput" } : /* istanbul ignore next */ {}), alias: 'dividerOffset' });
|
|
111
|
+
this.dividerOffset = linkedSignal(() => this.dividerOffsetInput(), ...(ngDevMode ? [{ debugName: "dividerOffset" }] : /* istanbul ignore next */ []));
|
|
112
|
+
this.portal = signal(null, ...(ngDevMode ? [{ debugName: "portal" }] : /* istanbul ignore next */ []));
|
|
113
|
+
this.treeContainer = viewChild.required('treeContainer');
|
|
114
|
+
this.showTreeNavigation = signal(true, ...(ngDevMode ? [{ debugName: "showTreeNavigation" }] : /* istanbul ignore next */ []));
|
|
115
|
+
/**
|
|
116
|
+
* Indicates that the divider is moved with mouse down
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
this._moveDivider = false;
|
|
120
|
+
/**
|
|
121
|
+
* Holds the current tree container width.
|
|
122
|
+
* If null the move divider feature was not yet used and the initial
|
|
123
|
+
* container width is not calculated
|
|
124
|
+
* @private
|
|
125
|
+
*/
|
|
126
|
+
this._treeContainerWidth = null;
|
|
127
|
+
this.getLevel = (node) => node.depth;
|
|
128
|
+
this.isExpandable = (node) => node.hasChildren;
|
|
129
|
+
this.hasChild = (_, nodeData) => nodeData.hasChildren;
|
|
130
|
+
this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable);
|
|
131
|
+
effect(() => {
|
|
132
|
+
const dataSource = this.dataSource();
|
|
133
|
+
const toDisplay = this.toDisplay();
|
|
134
|
+
const getIcon = this.getIcon();
|
|
135
|
+
const hasDetails = this.hasDetails();
|
|
136
|
+
const getStyle = this.getStyle();
|
|
137
|
+
const getType = this.getType();
|
|
138
|
+
untracked(() => {
|
|
139
|
+
dataSource.searchForm = this.searchForm;
|
|
140
|
+
dataSource.setTreeControl(this.treeControl);
|
|
141
|
+
dataSource.setToDisplay(toDisplay);
|
|
142
|
+
dataSource.setGetIcon(getIcon);
|
|
143
|
+
dataSource.setHasDetails(hasDetails);
|
|
144
|
+
dataSource.setGetStyle(getStyle);
|
|
145
|
+
dataSource.setGetType(getType);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
effect((onCleanup) => {
|
|
149
|
+
const selected = this.dataSource().selected;
|
|
150
|
+
const subscription = untracked(() => selected.changed
|
|
151
|
+
.pipe(map(($event) => $event.source.selected), startWith(selected.selected), tap((nodes) => nodes.forEach((node) => this.openDetails(node))))
|
|
152
|
+
.subscribe());
|
|
153
|
+
onCleanup(() => subscription.unsubscribe());
|
|
154
|
+
});
|
|
155
|
+
afterNextRender(() => {
|
|
156
|
+
const cachedOffset = localStorage.getItem(this.cacheId);
|
|
157
|
+
if (cachedOffset && cachedOffset.match(/^(\d+\.)?\d+px$/)) {
|
|
158
|
+
this.dividerOffset.set(cachedOffset);
|
|
159
|
+
}
|
|
160
|
+
else if (isDevMode()) {
|
|
161
|
+
console.log('Divider offset cache is not available or invalid: ' + cachedOffset);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
get nodeDisplayEditable() {
|
|
166
|
+
return !!this.contentEditableMethod();
|
|
167
|
+
}
|
|
168
|
+
get cacheId() {
|
|
169
|
+
return ['rxap', 'tree', this.id()].join('/');
|
|
170
|
+
}
|
|
171
|
+
openDetails(node) {
|
|
172
|
+
const content = this.content();
|
|
173
|
+
if (content) {
|
|
174
|
+
this.portal.set(new TemplatePortal(content.template, this.viewContainerRef, {
|
|
175
|
+
$implicit: node.item,
|
|
176
|
+
node,
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
this.details.emit(node.item);
|
|
180
|
+
}
|
|
181
|
+
onContentEditableChange(value, node) {
|
|
182
|
+
return this.contentEditableMethod()?.call(value, node.item, node);
|
|
183
|
+
}
|
|
184
|
+
onMousedown() {
|
|
185
|
+
this._moveDivider = true;
|
|
186
|
+
}
|
|
187
|
+
onMouseup() {
|
|
188
|
+
this._moveDivider = false;
|
|
189
|
+
}
|
|
190
|
+
onMousemove($event) {
|
|
191
|
+
if (this._moveDivider) {
|
|
192
|
+
if (!this._treeContainerWidth) {
|
|
193
|
+
this._treeContainerWidth = this.treeContainer().nativeElement.clientWidth;
|
|
194
|
+
}
|
|
195
|
+
const rect = this.elementRef.nativeElement.getBoundingClientRect();
|
|
196
|
+
this._treeContainerWidth = Math.min(Math.max($event.clientX - (rect.left + 12), 128), rect.right - rect.left - 128);
|
|
197
|
+
const offset = this._treeContainerWidth + 'px';
|
|
198
|
+
this.setDividerOffset(offset);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
toggleTreeNavigation() {
|
|
202
|
+
this.showTreeNavigation.update((value) => !value);
|
|
203
|
+
}
|
|
204
|
+
setDividerOffset(offset) {
|
|
205
|
+
this.dividerOffset.set(offset);
|
|
206
|
+
localStorage.setItem(this.cacheId, offset);
|
|
207
|
+
}
|
|
208
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
209
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: TreeComponent, isStandalone: true, selector: "rxap-tree", inputs: { dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: true, isRequired: true, transformFunction: null }, contentEditableMethodInput: { classPropertyName: "contentEditableMethodInput", publicName: "contentEditableMethod", isSignal: true, isRequired: false, transformFunction: null }, toDisplay: { classPropertyName: "toDisplay", publicName: "toDisplay", isSignal: true, isRequired: false, transformFunction: null }, getIcon: { classPropertyName: "getIcon", publicName: "getIcon", isSignal: true, isRequired: false, transformFunction: null }, getType: { classPropertyName: "getType", publicName: "getType", isSignal: true, isRequired: false, transformFunction: null }, getStyle: { classPropertyName: "getStyle", publicName: "getStyle", isSignal: true, isRequired: false, transformFunction: null }, multipleInput: { classPropertyName: "multipleInput", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, hasDetails: { classPropertyName: "hasDetails", publicName: "hasDetails", isSignal: true, isRequired: false, transformFunction: null }, hideLeafIcon: { classPropertyName: "hideLeafIcon", publicName: "hideLeafIcon", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, dividerOffsetInput: { classPropertyName: "dividerOffsetInput", publicName: "dividerOffset", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { details: "details" }, host: { listeners: { "mouseup": "onMouseup()", "mousemove": "onMousemove($event)" } }, queries: [{ propertyName: "content", first: true, predicate: TreeContentDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "treeContainer", first: true, predicate: ["treeContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"grow flex flex-col gap-2 justify-start items-start\">\n <button (click)=\"toggleTreeNavigation()\" class=\"!justify-start\" mat-button type=\"button\">\n <span class=\"flex flex-row justify-start items-center gap-6\">\n @if (showTreeNavigation()) {\n <mat-icon>arrow_back</mat-icon>\n <span i18n>Hide tree navigation</span>\n }\n @if (!showTreeNavigation()) {\n <mat-icon>arrow_forward</mat-icon>\n <span i18n>Show tree navigation</span>\n }\n </span>\n </button>\n <div class=\"flex flex-row grow w-full\">\n <div #treeContainer [ngClass]=\"{ 'hidden': !showTreeNavigation() }\"\n [ngStyle]=\"{ maxWidth: dividerOffset(), minWidth: dividerOffset(), flexBasis: dividerOffset() }\"\n class=\"w-fit grow-0 overflow-y-auto\">\n @if (!dataSource() || (dataSource().loading$ | async)) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n <ng-content select=\"[searchHeader]\"></ng-content>\n @if (dataSource()) {\n <mat-tree [dataSource]=\"dataSource()\" [treeControl]=\"treeControl\">\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n <mat-icon [ngClass]=\"{ 'hidden': hideLeafIcon() }\">subdirectory_arrow_right</mat-icon>\n @if (node.icon?.length) {\n @for (icon of node.icon; track icon) {\n <mat-icon [rxapIcon]=\"$any(icon)\"></mat-icon>\n }\n }\n @if (multiple()) {\n <mat-checkbox\n (change)=\"node.toggleSelect()\"\n [checked]=\"node.selected\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\">\n {{ node.display }}\n </mat-checkbox>\n }\n @if (!multiple()) {\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n mat-button\n type=\"button\"\n >\n {{ node.display }}\n </button>\n }\n </div>\n </mat-tree-node>\n <!-- Node with children -->\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" matTreeNodePadding>\n <button [attr.aria-label]=\"'toggle ' + node.filename\" mat-icon-button matTreeNodeToggle type=\"button\">\n <mat-icon class=\"mat-icon-rtl-mirror\">\n {{ treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\n </mat-icon>\n </button>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n @if (node.icon?.length) {\n @for (icon of node.icon; track icon) {\n <mat-icon [rxapIcon]=\"$any(icon)\"></mat-icon>\n }\n } @else {\n <div></div>\n }\n @if (node.hasDetails) {\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n mat-button\n type=\"button\"\n >\n {{ node.display }}\n </button>\n } @else {\n <span\n (change)=\"onContentEditableChange($event, node)\"\n [disabled]=\"!nodeDisplayEditable\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n rxapContenteditable>\n {{ node.display }}\n </span>\n }\n @if (node.isLoading$ | async) {\n <mat-progress-spinner\n [diameter]=\"16\"\n class=\"grow-0 pl-4\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n }\n </div>\n </mat-tree-node>\n </mat-tree>\n } @else {\n Load data source\n }\n </div>\n\n @if (showTreeNavigation()) {\n <div (mousedown)=\"onMousedown()\"\n class=\"divider cursor-ew-resize px-3 grow-0\">\n <mat-divider [vertical]=\"true\" class=\"h-full\"></mat-divider>\n </div>\n }\n\n <div class=\"grow\">\n @if (portal(); as portal) {\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n }\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatTreeModule }, { kind: "directive", type: i2.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { kind: "directive", type: i2.MatTreeNodePadding, selector: "[matTreeNodePadding]", inputs: ["matTreeNodePadding", "matTreeNodePaddingIndent"] }, { kind: "directive", type: i2.MatTreeNodeToggle, selector: "[matTreeNodeToggle]", inputs: ["matTreeNodeToggleRecursive"] }, { kind: "component", type: i2.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { kind: "directive", type: i2.MatTreeNode, selector: "mat-tree-node", inputs: ["tabIndex", "disabled"], outputs: ["activation", "expandedChange"], exportAs: ["matTreeNode"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: IconDirective, selector: "mat-icon[rxapIcon]", inputs: ["rxapIcon"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i4.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: ContenteditableDirective, selector: "[rxapContenteditable]", inputs: ["rxapContenteditable", "disabled"], outputs: ["change"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i7.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i8.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
210
|
+
}
|
|
211
|
+
__decorate([
|
|
212
|
+
DebounceCall(100),
|
|
213
|
+
__metadata("design:type", Function),
|
|
214
|
+
__metadata("design:paramtypes", [Node]),
|
|
215
|
+
__metadata("design:returntype", void 0)
|
|
216
|
+
], TreeComponent.prototype, "openDetails", null);
|
|
217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeComponent, decorators: [{
|
|
218
|
+
type: Component,
|
|
219
|
+
args: [{ selector: 'rxap-tree', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
220
|
+
NgStyle,
|
|
221
|
+
MatProgressBarModule,
|
|
222
|
+
MatTreeModule,
|
|
223
|
+
MatIconModule,
|
|
224
|
+
IconDirective,
|
|
225
|
+
MatCheckboxModule,
|
|
226
|
+
MatButtonModule,
|
|
227
|
+
ContenteditableDirective,
|
|
228
|
+
MatProgressSpinnerModule,
|
|
229
|
+
MatDividerModule,
|
|
230
|
+
PortalModule,
|
|
231
|
+
AsyncPipe,
|
|
232
|
+
NgClass
|
|
233
|
+
], host: {
|
|
234
|
+
'(mouseup)': 'onMouseup()',
|
|
235
|
+
'(mousemove)': 'onMousemove($event)',
|
|
236
|
+
}, template: "<div class=\"grow flex flex-col gap-2 justify-start items-start\">\n <button (click)=\"toggleTreeNavigation()\" class=\"!justify-start\" mat-button type=\"button\">\n <span class=\"flex flex-row justify-start items-center gap-6\">\n @if (showTreeNavigation()) {\n <mat-icon>arrow_back</mat-icon>\n <span i18n>Hide tree navigation</span>\n }\n @if (!showTreeNavigation()) {\n <mat-icon>arrow_forward</mat-icon>\n <span i18n>Show tree navigation</span>\n }\n </span>\n </button>\n <div class=\"flex flex-row grow w-full\">\n <div #treeContainer [ngClass]=\"{ 'hidden': !showTreeNavigation() }\"\n [ngStyle]=\"{ maxWidth: dividerOffset(), minWidth: dividerOffset(), flexBasis: dividerOffset() }\"\n class=\"w-fit grow-0 overflow-y-auto\">\n @if (!dataSource() || (dataSource().loading$ | async)) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n <ng-content select=\"[searchHeader]\"></ng-content>\n @if (dataSource()) {\n <mat-tree [dataSource]=\"dataSource()\" [treeControl]=\"treeControl\">\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n <mat-icon [ngClass]=\"{ 'hidden': hideLeafIcon() }\">subdirectory_arrow_right</mat-icon>\n @if (node.icon?.length) {\n @for (icon of node.icon; track icon) {\n <mat-icon [rxapIcon]=\"$any(icon)\"></mat-icon>\n }\n }\n @if (multiple()) {\n <mat-checkbox\n (change)=\"node.toggleSelect()\"\n [checked]=\"node.selected\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\">\n {{ node.display }}\n </mat-checkbox>\n }\n @if (!multiple()) {\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n mat-button\n type=\"button\"\n >\n {{ node.display }}\n </button>\n }\n </div>\n </mat-tree-node>\n <!-- Node with children -->\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" matTreeNodePadding>\n <button [attr.aria-label]=\"'toggle ' + node.filename\" mat-icon-button matTreeNodeToggle type=\"button\">\n <mat-icon class=\"mat-icon-rtl-mirror\">\n {{ treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\n </mat-icon>\n </button>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n @if (node.icon?.length) {\n @for (icon of node.icon; track icon) {\n <mat-icon [rxapIcon]=\"$any(icon)\"></mat-icon>\n }\n } @else {\n <div></div>\n }\n @if (node.hasDetails) {\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n mat-button\n type=\"button\"\n >\n {{ node.display }}\n </button>\n } @else {\n <span\n (change)=\"onContentEditableChange($event, node)\"\n [disabled]=\"!nodeDisplayEditable\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n rxapContenteditable>\n {{ node.display }}\n </span>\n }\n @if (node.isLoading$ | async) {\n <mat-progress-spinner\n [diameter]=\"16\"\n class=\"grow-0 pl-4\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n }\n </div>\n </mat-tree-node>\n </mat-tree>\n } @else {\n Load data source\n }\n </div>\n\n @if (showTreeNavigation()) {\n <div (mousedown)=\"onMousedown()\"\n class=\"divider cursor-ew-resize px-3 grow-0\">\n <mat-divider [vertical]=\"true\" class=\"h-full\"></mat-divider>\n </div>\n }\n\n <div class=\"grow\">\n @if (portal(); as portal) {\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n }\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n" }]
|
|
237
|
+
}], ctorParameters: () => [], propDecorators: { dataSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataSource", required: true }] }], contentEditableMethodInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentEditableMethod", required: false }] }], toDisplay: [{ type: i0.Input, args: [{ isSignal: true, alias: "toDisplay", required: false }] }], getIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "getIcon", required: false }] }], getType: [{ type: i0.Input, args: [{ isSignal: true, alias: "getType", required: false }] }], getStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "getStyle", required: false }] }], multipleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], hasDetails: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasDetails", required: false }] }], content: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TreeContentDirective), { isSignal: true }] }], hideLeafIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideLeafIcon", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], details: [{ type: i0.Output, args: ["details"] }], dividerOffsetInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "dividerOffset", required: false }] }], treeContainer: [{ type: i0.ViewChild, args: ['treeContainer', { isSignal: true }] }], openDetails: [] } });
|
|
92
238
|
|
|
93
239
|
function isSelectionChange(obj) {
|
|
94
240
|
return !!obj && obj['added'] !== undefined && obj['removed'] !== undefined;
|
|
@@ -221,10 +367,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
221
367
|
type: Injectable
|
|
222
368
|
}] });
|
|
223
369
|
let TreeDataSource = class TreeDataSource extends BaseDataSource {
|
|
224
|
-
constructor(
|
|
370
|
+
constructor() {
|
|
371
|
+
const applyFilterMethod = inject(RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD, { optional: true }) ?? null;
|
|
372
|
+
const metadata = inject(RXAP_DATA_SOURCE_METADATA, { optional: true }) ?? null;
|
|
225
373
|
super(metadata);
|
|
226
|
-
this.rootRemoteMethod =
|
|
227
|
-
this.childrenRemoteMethod =
|
|
374
|
+
this.rootRemoteMethod = inject(RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD);
|
|
375
|
+
this.childrenRemoteMethod = inject(RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD, { optional: true }) ?? null;
|
|
228
376
|
this.tree$ = new BehaviorSubject([]);
|
|
229
377
|
// TODO : änlich problem wie bei der redundaten expand SelectionModel.
|
|
230
378
|
this.loading$ = new ToggleSubject(true);
|
|
@@ -601,7 +749,7 @@ let TreeDataSource = class TreeDataSource extends BaseDataSource {
|
|
|
601
749
|
.subscribe();
|
|
602
750
|
}
|
|
603
751
|
}
|
|
604
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeDataSource, deps: [
|
|
752
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeDataSource, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
605
753
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeDataSource }); }
|
|
606
754
|
};
|
|
607
755
|
__decorate([
|
|
@@ -610,212 +758,11 @@ __decorate([
|
|
|
610
758
|
], TreeDataSource.prototype, "treeControl", void 0);
|
|
611
759
|
TreeDataSource = __decorate([
|
|
612
760
|
RxapDataSource('tree'),
|
|
613
|
-
__metadata("design:paramtypes", [
|
|
761
|
+
__metadata("design:paramtypes", [])
|
|
614
762
|
], TreeDataSource);
|
|
615
763
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeDataSource, decorators: [{
|
|
616
764
|
type: Injectable
|
|
617
|
-
}], ctorParameters: () => [
|
|
618
|
-
type: Inject,
|
|
619
|
-
args: [RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD]
|
|
620
|
-
}] }, { type: undefined, decorators: [{
|
|
621
|
-
type: Optional
|
|
622
|
-
}, {
|
|
623
|
-
type: Inject,
|
|
624
|
-
args: [RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD]
|
|
625
|
-
}] }, { type: undefined, decorators: [{
|
|
626
|
-
type: Optional
|
|
627
|
-
}, {
|
|
628
|
-
type: Inject,
|
|
629
|
-
args: [RXAP_TREE_DATA_SOURCE_APPLY_FILTER_METHOD]
|
|
630
|
-
}] }, { type: undefined, decorators: [{
|
|
631
|
-
type: Optional
|
|
632
|
-
}, {
|
|
633
|
-
type: Inject,
|
|
634
|
-
args: [RXAP_DATA_SOURCE_METADATA]
|
|
635
|
-
}] }], propDecorators: { treeControl: [] } });
|
|
636
|
-
|
|
637
|
-
class TreeComponent {
|
|
638
|
-
constructor(viewContainerRef, cdr, contentEditableMethod, renderer, elementRef, searchForm) {
|
|
639
|
-
this.viewContainerRef = viewContainerRef;
|
|
640
|
-
this.cdr = cdr;
|
|
641
|
-
this.renderer = renderer;
|
|
642
|
-
this.elementRef = elementRef;
|
|
643
|
-
this.searchForm = searchForm;
|
|
644
|
-
this.multiple = false;
|
|
645
|
-
this.hideLeafIcon = false;
|
|
646
|
-
this.details = new EventEmitter();
|
|
647
|
-
this.dividerOffset = '256px';
|
|
648
|
-
this.portal = null;
|
|
649
|
-
this.showTreeNavigation = signal(true, ...(ngDevMode ? [{ debugName: "showTreeNavigation" }] : /* istanbul ignore next */ []));
|
|
650
|
-
/**
|
|
651
|
-
* Indicates that the divider is moved with mouse down
|
|
652
|
-
* @private
|
|
653
|
-
*/
|
|
654
|
-
this._moveDivider = false;
|
|
655
|
-
/**
|
|
656
|
-
* Holds the current tree container width.
|
|
657
|
-
* If null the move divider feature was not yet used and the initial
|
|
658
|
-
* container width is not calculated
|
|
659
|
-
* @private
|
|
660
|
-
*/
|
|
661
|
-
this._treeContainerWidth = null;
|
|
662
|
-
this.getLevel = (node) => node.depth;
|
|
663
|
-
this.isExpandable = (node) => node.hasChildren;
|
|
664
|
-
this.hasChild = (_, nodeData) => nodeData.hasChildren;
|
|
665
|
-
this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable);
|
|
666
|
-
this.contentEditableMethod = contentEditableMethod;
|
|
667
|
-
}
|
|
668
|
-
get nodeDisplayEditable() {
|
|
669
|
-
return !!this.contentEditableMethod;
|
|
670
|
-
}
|
|
671
|
-
get cacheId() {
|
|
672
|
-
return ['rxap', 'tree', this.id].join('/');
|
|
673
|
-
}
|
|
674
|
-
ngOnInit() {
|
|
675
|
-
this.dataSource.searchForm = this.searchForm;
|
|
676
|
-
this.dataSource.setTreeControl(this.treeControl);
|
|
677
|
-
this.dataSource.setToDisplay(this.toDisplay);
|
|
678
|
-
this.dataSource.setGetIcon(this.getIcon);
|
|
679
|
-
this.dataSource.setHasDetails(this.hasDetails);
|
|
680
|
-
this.dataSource.setGetStyle(this.getStyle);
|
|
681
|
-
this.dataSource.setGetType(this.getType);
|
|
682
|
-
this.multiple = this.dataSource.metadata.selectMultiple ?? this.multiple;
|
|
683
|
-
if (this.dataSource.selected.hasValue()) {
|
|
684
|
-
this.dataSource.selected.selected.forEach((node) => this.openDetails(node));
|
|
685
|
-
}
|
|
686
|
-
const cachedOffset = localStorage.getItem(this.cacheId);
|
|
687
|
-
if (cachedOffset && cachedOffset.match(/^(\d+\.)?\d+px$/)) {
|
|
688
|
-
this.setDividerOffset(cachedOffset);
|
|
689
|
-
}
|
|
690
|
-
else if (isDevMode()) {
|
|
691
|
-
console.log('Divider offset cache is not available or invalid: ' + cachedOffset);
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
ngAfterContentInit() {
|
|
695
|
-
this.dataSource.selected.changed
|
|
696
|
-
.pipe(map(($event) => $event.source.selected), startWith(this.dataSource.selected.selected), tap((selected) => selected.forEach((node) => this.openDetails(node))))
|
|
697
|
-
.subscribe();
|
|
698
|
-
}
|
|
699
|
-
openDetails(node) {
|
|
700
|
-
if (this.content) {
|
|
701
|
-
this.portal = new TemplatePortal(this.content.template, this.viewContainerRef, {
|
|
702
|
-
$implicit: node.item,
|
|
703
|
-
node,
|
|
704
|
-
});
|
|
705
|
-
this.cdr.markForCheck();
|
|
706
|
-
}
|
|
707
|
-
this.details.emit(node.item);
|
|
708
|
-
}
|
|
709
|
-
onContentEditableChange(value, node) {
|
|
710
|
-
return this.contentEditableMethod?.call(value, node.item, node);
|
|
711
|
-
}
|
|
712
|
-
onMousedown() {
|
|
713
|
-
this._moveDivider = true;
|
|
714
|
-
}
|
|
715
|
-
onMouseup() {
|
|
716
|
-
this._moveDivider = false;
|
|
717
|
-
}
|
|
718
|
-
onMousemove($event) {
|
|
719
|
-
if (this._moveDivider) {
|
|
720
|
-
if (!this._treeContainerWidth) {
|
|
721
|
-
this._treeContainerWidth = this.treeContainer.nativeElement.clientWidth;
|
|
722
|
-
}
|
|
723
|
-
const rect = this.elementRef.nativeElement.getBoundingClientRect();
|
|
724
|
-
this._treeContainerWidth = Math.min(Math.max($event.clientX - (rect.left + 12), 128), rect.right - rect.left - 128);
|
|
725
|
-
const offset = this._treeContainerWidth + 'px';
|
|
726
|
-
this.setDividerOffset(offset);
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
toggleTreeNavigation() {
|
|
730
|
-
this.showTreeNavigation.update((value) => !value);
|
|
731
|
-
}
|
|
732
|
-
setDividerOffset(offset) {
|
|
733
|
-
this.dividerOffset = offset;
|
|
734
|
-
this.renderer.setStyle(this.treeContainer.nativeElement, 'max-width', offset);
|
|
735
|
-
this.renderer.setStyle(this.treeContainer.nativeElement, 'min-width', offset);
|
|
736
|
-
this.renderer.setStyle(this.treeContainer.nativeElement, 'flex-basis', offset);
|
|
737
|
-
localStorage.setItem(this.cacheId, offset);
|
|
738
|
-
}
|
|
739
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeComponent, deps: [{ token: ViewContainerRef }, { token: ChangeDetectorRef }, { token: RXAP_TREE_CONTENT_EDITABLE_METHOD, optional: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: RXAP_FORM_DEFINITION, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
740
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: TreeComponent, isStandalone: true, selector: "rxap-tree", inputs: { dataSource: "dataSource", contentEditableMethod: "contentEditableMethod", toDisplay: "toDisplay", getIcon: "getIcon", getType: "getType", getStyle: "getStyle", multiple: "multiple", hasDetails: "hasDetails", hideLeafIcon: "hideLeafIcon", id: "id", dividerOffset: "dividerOffset" }, outputs: { details: "details" }, host: { listeners: { "mouseup": "onMouseup()", "mousemove": "onMousemove($event)" } }, queries: [{ propertyName: "content", first: true, predicate: TreeContentDirective, descendants: true, static: true }], viewQueries: [{ propertyName: "treeContainer", first: true, predicate: ["treeContainer"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"grow flex flex-col gap-2 justify-start items-start\">\n <button (click)=\"toggleTreeNavigation()\" class=\"!justify-start\" mat-button type=\"button\">\n <span class=\"flex flex-row justify-start items-center gap-6\">\n @if (showTreeNavigation()) {\n <mat-icon>arrow_back</mat-icon>\n <span i18n>Hide tree navigation</span>\n }\n @if (!showTreeNavigation()) {\n <mat-icon>arrow_forward</mat-icon>\n <span i18n>Show tree navigation</span>\n }\n </span>\n </button>\n <div class=\"flex flex-row grow w-full\">\n <div #treeContainer [ngClass]=\"{ 'hidden': !showTreeNavigation() }\"\n [ngStyle]=\"{ maxWidth: dividerOffset, minWidth: dividerOffset, flexBasis: dividerOffset }\"\n class=\"w-fit grow-0 overflow-y-auto\">\n @if (!dataSource || (dataSource.loading$ | async)) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n <ng-content select=\"[searchHeader]\"></ng-content>\n @if (dataSource) {\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\">\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n <mat-icon [ngClass]=\"{ 'hidden': hideLeafIcon }\">subdirectory_arrow_right</mat-icon>\n @if (node.icon?.length) {\n @for (icon of node.icon; track icon) {\n <mat-icon [rxapIcon]=\"$any(icon)\"></mat-icon>\n }\n }\n @if (multiple) {\n <mat-checkbox\n (change)=\"node.toggleSelect()\"\n [checked]=\"node.selected\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\">\n {{ node.display }}\n </mat-checkbox>\n }\n @if (!multiple) {\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n mat-button\n type=\"button\"\n >\n {{ node.display }}\n </button>\n }\n </div>\n </mat-tree-node>\n <!-- Node with children -->\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" matTreeNodePadding>\n <button [attr.aria-label]=\"'toggle ' + node.filename\" mat-icon-button matTreeNodeToggle type=\"button\">\n <mat-icon class=\"mat-icon-rtl-mirror\">\n {{ treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\n </mat-icon>\n </button>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n @if (node.icon?.length) {\n @for (icon of node.icon; track icon) {\n <mat-icon [rxapIcon]=\"$any(icon)\"></mat-icon>\n }\n } @else {\n <div></div>\n }\n @if (node.hasDetails) {\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n mat-button\n type=\"button\"\n >\n {{ node.display }}\n </button>\n } @else {\n <span\n (change)=\"onContentEditableChange($event, node)\"\n [disabled]=\"!nodeDisplayEditable\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n rxapContenteditable>\n {{ node.display }}\n </span>\n }\n @if (node.isLoading$ | async) {\n <mat-progress-spinner\n [diameter]=\"16\"\n class=\"grow-0 pl-4\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n }\n </div>\n </mat-tree-node>\n </mat-tree>\n } @else {\n Load data source\n }\n </div>\n\n @if (showTreeNavigation()) {\n <div (mousedown)=\"onMousedown()\"\n class=\"divider cursor-ew-resize px-3 grow-0\">\n <mat-divider [vertical]=\"true\" class=\"h-full\"></mat-divider>\n </div>\n }\n\n <div class=\"grow\">\n @if (portal) {\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n }\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatTreeModule }, { kind: "directive", type: i2.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { kind: "directive", type: i2.MatTreeNodePadding, selector: "[matTreeNodePadding]", inputs: ["matTreeNodePadding", "matTreeNodePaddingIndent"] }, { kind: "directive", type: i2.MatTreeNodeToggle, selector: "[matTreeNodeToggle]", inputs: ["matTreeNodeToggleRecursive"] }, { kind: "component", type: i2.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { kind: "directive", type: i2.MatTreeNode, selector: "mat-tree-node", inputs: ["tabIndex", "disabled"], outputs: ["activation", "expandedChange"], exportAs: ["matTreeNode"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: IconDirective, selector: "mat-icon[rxapIcon]", inputs: ["rxapIcon"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i4.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: ContenteditableDirective, selector: "[rxapContenteditable]", inputs: ["rxapContenteditable", "disabled"], outputs: ["change"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i7.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i8.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
741
|
-
}
|
|
742
|
-
__decorate([
|
|
743
|
-
DebounceCall(100),
|
|
744
|
-
__metadata("design:type", Function),
|
|
745
|
-
__metadata("design:paramtypes", [Node]),
|
|
746
|
-
__metadata("design:returntype", void 0)
|
|
747
|
-
], TreeComponent.prototype, "openDetails", null);
|
|
748
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TreeComponent, decorators: [{
|
|
749
|
-
type: Component,
|
|
750
|
-
args: [{ selector: 'rxap-tree', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
751
|
-
NgStyle,
|
|
752
|
-
MatProgressBarModule,
|
|
753
|
-
MatTreeModule,
|
|
754
|
-
MatIconModule,
|
|
755
|
-
IconDirective,
|
|
756
|
-
MatCheckboxModule,
|
|
757
|
-
MatButtonModule,
|
|
758
|
-
ContenteditableDirective,
|
|
759
|
-
MatProgressSpinnerModule,
|
|
760
|
-
MatDividerModule,
|
|
761
|
-
PortalModule,
|
|
762
|
-
AsyncPipe,
|
|
763
|
-
NgClass
|
|
764
|
-
], template: "<div class=\"grow flex flex-col gap-2 justify-start items-start\">\n <button (click)=\"toggleTreeNavigation()\" class=\"!justify-start\" mat-button type=\"button\">\n <span class=\"flex flex-row justify-start items-center gap-6\">\n @if (showTreeNavigation()) {\n <mat-icon>arrow_back</mat-icon>\n <span i18n>Hide tree navigation</span>\n }\n @if (!showTreeNavigation()) {\n <mat-icon>arrow_forward</mat-icon>\n <span i18n>Show tree navigation</span>\n }\n </span>\n </button>\n <div class=\"flex flex-row grow w-full\">\n <div #treeContainer [ngClass]=\"{ 'hidden': !showTreeNavigation() }\"\n [ngStyle]=\"{ maxWidth: dividerOffset, minWidth: dividerOffset, flexBasis: dividerOffset }\"\n class=\"w-fit grow-0 overflow-y-auto\">\n @if (!dataSource || (dataSource.loading$ | async)) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n <ng-content select=\"[searchHeader]\"></ng-content>\n @if (dataSource) {\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\">\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n <mat-icon [ngClass]=\"{ 'hidden': hideLeafIcon }\">subdirectory_arrow_right</mat-icon>\n @if (node.icon?.length) {\n @for (icon of node.icon; track icon) {\n <mat-icon [rxapIcon]=\"$any(icon)\"></mat-icon>\n }\n }\n @if (multiple) {\n <mat-checkbox\n (change)=\"node.toggleSelect()\"\n [checked]=\"node.selected\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\">\n {{ node.display }}\n </mat-checkbox>\n }\n @if (!multiple) {\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [disabled]=\"!node.hasDetails\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n mat-button\n type=\"button\"\n >\n {{ node.display }}\n </button>\n }\n </div>\n </mat-tree-node>\n <!-- Node with children -->\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" matTreeNodePadding>\n <button [attr.aria-label]=\"'toggle ' + node.filename\" mat-icon-button matTreeNodeToggle type=\"button\">\n <mat-icon class=\"mat-icon-rtl-mirror\">\n {{ treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\n </mat-icon>\n </button>\n <div class=\"flex flex-row justify-start items-center gap-2\">\n @if (node.icon?.length) {\n @for (icon of node.icon; track icon) {\n <mat-icon [rxapIcon]=\"$any(icon)\"></mat-icon>\n }\n } @else {\n <div></div>\n }\n @if (node.hasDetails) {\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n mat-button\n type=\"button\"\n >\n {{ node.display }}\n </button>\n } @else {\n <span\n (change)=\"onContentEditableChange($event, node)\"\n [disabled]=\"!nodeDisplayEditable\"\n [ngStyle]=\"node.style\"\n class=\"grow-0 truncate\"\n rxapContenteditable>\n {{ node.display }}\n </span>\n }\n @if (node.isLoading$ | async) {\n <mat-progress-spinner\n [diameter]=\"16\"\n class=\"grow-0 pl-4\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n }\n </div>\n </mat-tree-node>\n </mat-tree>\n } @else {\n Load data source\n }\n </div>\n\n @if (showTreeNavigation()) {\n <div (mousedown)=\"onMousedown()\"\n class=\"divider cursor-ew-resize px-3 grow-0\">\n <mat-divider [vertical]=\"true\" class=\"h-full\"></mat-divider>\n </div>\n }\n\n <div class=\"grow\">\n @if (portal) {\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n }\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n" }]
|
|
765
|
-
}], ctorParameters: () => [{ type: i0.ViewContainerRef, decorators: [{
|
|
766
|
-
type: Inject,
|
|
767
|
-
args: [ViewContainerRef]
|
|
768
|
-
}] }, { type: i0.ChangeDetectorRef, decorators: [{
|
|
769
|
-
type: Inject,
|
|
770
|
-
args: [ChangeDetectorRef]
|
|
771
|
-
}] }, { type: undefined, decorators: [{
|
|
772
|
-
type: Optional
|
|
773
|
-
}, {
|
|
774
|
-
type: Inject,
|
|
775
|
-
args: [RXAP_TREE_CONTENT_EDITABLE_METHOD]
|
|
776
|
-
}] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: SearchForm, decorators: [{
|
|
777
|
-
type: Optional
|
|
778
|
-
}, {
|
|
779
|
-
type: Inject,
|
|
780
|
-
args: [RXAP_FORM_DEFINITION]
|
|
781
|
-
}] }], propDecorators: { dataSource: [{
|
|
782
|
-
type: Input,
|
|
783
|
-
args: [{ required: true }]
|
|
784
|
-
}], contentEditableMethod: [{
|
|
785
|
-
type: Input
|
|
786
|
-
}], toDisplay: [{
|
|
787
|
-
type: Input
|
|
788
|
-
}], getIcon: [{
|
|
789
|
-
type: Input
|
|
790
|
-
}], getType: [{
|
|
791
|
-
type: Input
|
|
792
|
-
}], getStyle: [{
|
|
793
|
-
type: Input
|
|
794
|
-
}], multiple: [{
|
|
795
|
-
type: Input
|
|
796
|
-
}], hasDetails: [{
|
|
797
|
-
type: Input
|
|
798
|
-
}], content: [{
|
|
799
|
-
type: ContentChild,
|
|
800
|
-
args: [TreeContentDirective, { static: true }]
|
|
801
|
-
}], hideLeafIcon: [{
|
|
802
|
-
type: Input
|
|
803
|
-
}], id: [{
|
|
804
|
-
type: Input
|
|
805
|
-
}], details: [{
|
|
806
|
-
type: Output
|
|
807
|
-
}], dividerOffset: [{
|
|
808
|
-
type: Input
|
|
809
|
-
}], treeContainer: [{
|
|
810
|
-
type: ViewChild,
|
|
811
|
-
args: ['treeContainer', { static: true }]
|
|
812
|
-
}], openDetails: [], onMouseup: [{
|
|
813
|
-
type: HostListener,
|
|
814
|
-
args: ['mouseup']
|
|
815
|
-
}], onMousemove: [{
|
|
816
|
-
type: HostListener,
|
|
817
|
-
args: ['mousemove', ['$event']]
|
|
818
|
-
}] } });
|
|
765
|
+
}], ctorParameters: () => [], propDecorators: { treeControl: [] } });
|
|
819
766
|
|
|
820
767
|
// region
|
|
821
768
|
// endregion
|