ngssm-tree 21.0.0 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ngssm-tree.mjs +121 -876
- package/fesm2022/ngssm-tree.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngssm-tree.d.ts +3 -223
package/fesm2022/ngssm-tree.mjs
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, Injectable, input, signal, effect, untracked, ChangeDetectionStrategy, Component, viewChild, ViewContainerRef, ChangeDetectorRef, makeEnvironmentProviders
|
|
2
|
+
import { InjectionToken, inject, Injectable, input, signal, effect, untracked, ChangeDetectionStrategy, Component, viewChild, ViewContainerRef, ChangeDetectorRef, makeEnvironmentProviders } from '@angular/core';
|
|
3
3
|
import { NgSsmFeatureState, Logger, Store, createSignal, provideReducers, provideEffects } from 'ngssm-store';
|
|
4
4
|
import { DataStatus } from 'ngssm-remote-data';
|
|
5
5
|
import { __decorate } from 'tslib';
|
|
6
6
|
import update from 'immutability-helper';
|
|
7
|
-
import * as i4 from '@angular/material/dialog';
|
|
7
|
+
import * as i4$1 from '@angular/material/dialog';
|
|
8
8
|
import { MatDialogModule, MatDialog } from '@angular/material/dialog';
|
|
9
|
-
import { defaultRegexEditorValidator
|
|
9
|
+
import { defaultRegexEditorValidator } from 'ngssm-toolkit';
|
|
10
10
|
import * as i1 from '@angular/common';
|
|
11
11
|
import { CommonModule } from '@angular/common';
|
|
12
12
|
import * as i2 from '@angular/cdk/scrolling';
|
|
13
13
|
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
14
14
|
import * as i6 from '@angular/material/card';
|
|
15
|
-
import { MatCardModule
|
|
16
|
-
import * as
|
|
17
|
-
import { MatIconModule
|
|
15
|
+
import { MatCardModule } from '@angular/material/card';
|
|
16
|
+
import * as i4 from '@angular/material/icon';
|
|
17
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
18
18
|
import * as i5 from '@angular/material/progress-spinner';
|
|
19
19
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
20
20
|
import * as i2$1 from '@angular/material/button';
|
|
21
21
|
import { MatButtonModule } from '@angular/material/button';
|
|
22
|
-
import * as i1$
|
|
22
|
+
import * as i1$1 from '@angular/forms';
|
|
23
23
|
import { FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
24
24
|
import * as i2$2 from '@angular/material/form-field';
|
|
25
25
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
26
26
|
import * as i3 from '@angular/material/input';
|
|
27
27
|
import { MatInputModule } from '@angular/material/input';
|
|
28
|
-
import * as i3$1 from '@angular/material/divider';
|
|
29
|
-
import { MatDividerModule, MatDivider } from '@angular/material/divider';
|
|
30
|
-
import * as i2$3 from '@angular/material/menu';
|
|
31
|
-
import { MatMenuModule } from '@angular/material/menu';
|
|
32
28
|
|
|
33
29
|
var NgssmTreeActionType;
|
|
34
30
|
(function (NgssmTreeActionType) {
|
|
@@ -47,6 +43,8 @@ var NgssmTreeActionType;
|
|
|
47
43
|
})(NgssmTreeActionType || (NgssmTreeActionType = {}));
|
|
48
44
|
|
|
49
45
|
class TreeAction {
|
|
46
|
+
type;
|
|
47
|
+
treeId;
|
|
50
48
|
constructor(type, treeId) {
|
|
51
49
|
this.type = type;
|
|
52
50
|
this.treeId = treeId;
|
|
@@ -54,6 +52,8 @@ class TreeAction {
|
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
class InitNgssmTreeAction extends TreeAction {
|
|
55
|
+
treeType;
|
|
56
|
+
root;
|
|
57
57
|
constructor(treeId, treeType, root) {
|
|
58
58
|
super(NgssmTreeActionType.initNgssmTree, treeId);
|
|
59
59
|
this.treeType = treeType;
|
|
@@ -62,6 +62,7 @@ class InitNgssmTreeAction extends TreeAction {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
class TreeNodeAction extends TreeAction {
|
|
65
|
+
nodeId;
|
|
65
66
|
constructor(actionType, treeId, nodeId) {
|
|
66
67
|
super(actionType, treeId);
|
|
67
68
|
this.nodeId = nodeId;
|
|
@@ -75,16 +76,21 @@ class ExpandNodeAction extends TreeNodeAction {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
class RegisterNodesAction {
|
|
79
|
+
dataStatus;
|
|
80
|
+
treeId;
|
|
81
|
+
parentNodeId;
|
|
82
|
+
nodes;
|
|
83
|
+
type = NgssmTreeActionType.registerNodes;
|
|
78
84
|
constructor(dataStatus, treeId, parentNodeId, nodes = []) {
|
|
79
85
|
this.dataStatus = dataStatus;
|
|
80
86
|
this.treeId = treeId;
|
|
81
87
|
this.parentNodeId = parentNodeId;
|
|
82
88
|
this.nodes = nodes;
|
|
83
|
-
this.type = NgssmTreeActionType.registerNodes;
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
class CollapseNodeAction extends TreeAction {
|
|
93
|
+
nodeId;
|
|
88
94
|
constructor(treeId, nodeId) {
|
|
89
95
|
super(NgssmTreeActionType.collapseNode, treeId);
|
|
90
96
|
this.nodeId = nodeId;
|
|
@@ -104,6 +110,7 @@ class DeleteNgssmTreeAction extends TreeAction {
|
|
|
104
110
|
}
|
|
105
111
|
|
|
106
112
|
class DisplaySearchDialogAction extends TreeAction {
|
|
113
|
+
startNodeId;
|
|
107
114
|
constructor(treeId, startNodeId) {
|
|
108
115
|
super(NgssmTreeActionType.displaySearchDialog, treeId);
|
|
109
116
|
this.startNodeId = startNodeId;
|
|
@@ -111,17 +118,20 @@ class DisplaySearchDialogAction extends TreeAction {
|
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
class SearchTreeNodesAction {
|
|
121
|
+
searchPattern;
|
|
122
|
+
type = NgssmTreeActionType.searchTreeNodes;
|
|
114
123
|
constructor(searchPattern) {
|
|
115
124
|
this.searchPattern = searchPattern;
|
|
116
|
-
this.type = NgssmTreeActionType.searchTreeNodes;
|
|
117
125
|
}
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
class RegisterPartialSearchResultsAction {
|
|
129
|
+
matchingNodes;
|
|
130
|
+
nodesToProcess;
|
|
131
|
+
type = NgssmTreeActionType.registerPartialSearchResults;
|
|
121
132
|
constructor(matchingNodes, nodesToProcess) {
|
|
122
133
|
this.matchingNodes = matchingNodes;
|
|
123
134
|
this.nodesToProcess = nodesToProcess;
|
|
124
|
-
this.type = NgssmTreeActionType.registerPartialSearchResults;
|
|
125
135
|
}
|
|
126
136
|
}
|
|
127
137
|
|
|
@@ -173,11 +183,11 @@ const updateNgssmTreeState = (state, command) => update(state, {
|
|
|
173
183
|
[NgssmTreeStateSpecification.featureStateKey]: command
|
|
174
184
|
});
|
|
175
185
|
let NgssmTreeStateSpecification = class NgssmTreeStateSpecification {
|
|
176
|
-
static
|
|
177
|
-
static
|
|
186
|
+
static featureStateKey = 'ngssm-tree-state';
|
|
187
|
+
static initialState = {
|
|
178
188
|
trees: {},
|
|
179
189
|
treeNodesSearch: getDefaultTreeNodesSearch()
|
|
180
|
-
};
|
|
190
|
+
};
|
|
181
191
|
};
|
|
182
192
|
NgssmTreeStateSpecification = __decorate([
|
|
183
193
|
NgSsmFeatureState({
|
|
@@ -190,15 +200,13 @@ const selectNgssmTreeNode = (state, treeId, nodeId) => selectNgssmTreeState(stat
|
|
|
190
200
|
const selectNgssmTreeNodeChildren = (state, treeId, nodeId) => selectNgssmTreeState(state).trees[treeId]?.nodes.filter((n) => n.node.parentNodeId === nodeId) ?? [];
|
|
191
201
|
|
|
192
202
|
class TreeNodeLoadingEffect {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
this.logger = inject(Logger);
|
|
201
|
-
}
|
|
203
|
+
processedActions = [
|
|
204
|
+
NgssmTreeActionType.expandNode,
|
|
205
|
+
NgssmTreeActionType.selectNode,
|
|
206
|
+
NgssmTreeActionType.loadChildrenOfNode
|
|
207
|
+
];
|
|
208
|
+
dataServices = inject(NGSSM_TREE_DATA_SERVICE, { optional: true }) ?? [];
|
|
209
|
+
logger = inject(Logger);
|
|
202
210
|
processAction(actiondispatcher, state, action) {
|
|
203
211
|
const treeNodeAction = action;
|
|
204
212
|
if (!selectNgssmTreeState(state).trees[treeNodeAction.treeId]) {
|
|
@@ -223,22 +231,22 @@ class TreeNodeLoadingEffect {
|
|
|
223
231
|
}
|
|
224
232
|
});
|
|
225
233
|
}
|
|
226
|
-
static
|
|
227
|
-
static
|
|
234
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodeLoadingEffect, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
235
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodeLoadingEffect });
|
|
228
236
|
}
|
|
229
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
237
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodeLoadingEffect, decorators: [{
|
|
230
238
|
type: Injectable
|
|
231
239
|
}] });
|
|
232
240
|
|
|
233
241
|
class NgssmTreeComponent {
|
|
242
|
+
treeConfig = input(...(ngDevMode ? [undefined, { debugName: "treeConfig" }] : []));
|
|
243
|
+
dataStatus = DataStatus;
|
|
244
|
+
displayedItems = signal([], ...(ngDevMode ? [{ debugName: "displayedItems" }] : []));
|
|
245
|
+
selectedNodeId = signal(undefined, ...(ngDevMode ? [{ debugName: "selectedNodeId" }] : []));
|
|
246
|
+
store = inject(Store);
|
|
247
|
+
trees = createSignal((state) => selectNgssmTreeState(state).trees);
|
|
248
|
+
tree = signal(undefined, ...(ngDevMode ? [{ debugName: "tree" }] : []));
|
|
234
249
|
constructor() {
|
|
235
|
-
this.treeConfig = input(...(ngDevMode ? [undefined, { debugName: "treeConfig" }] : []));
|
|
236
|
-
this.dataStatus = DataStatus;
|
|
237
|
-
this.displayedItems = signal([], ...(ngDevMode ? [{ debugName: "displayedItems" }] : []));
|
|
238
|
-
this.selectedNodeId = signal(undefined, ...(ngDevMode ? [{ debugName: "selectedNodeId" }] : []));
|
|
239
|
-
this.store = inject(Store);
|
|
240
|
-
this.trees = createSignal((state) => selectNgssmTreeState(state).trees);
|
|
241
|
-
this.tree = signal(undefined, ...(ngDevMode ? [{ debugName: "tree" }] : []));
|
|
242
250
|
effect(() => {
|
|
243
251
|
const currentConfig = this.treeConfig();
|
|
244
252
|
const currentTrees = this.trees();
|
|
@@ -328,20 +336,20 @@ class NgssmTreeComponent {
|
|
|
328
336
|
this.store.dispatchAction(new DisplaySearchDialogAction(treeId, node.node.nodeId));
|
|
329
337
|
}
|
|
330
338
|
}
|
|
331
|
-
static
|
|
332
|
-
static
|
|
339
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: NgssmTreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
340
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: NgssmTreeComponent, isStandalone: true, selector: "ngssm-tree", inputs: { treeConfig: { classPropertyName: "treeConfig", publicName: "treeConfig", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mat-card class=\"flex-column-stretch fxFlex\">\n @if (treeConfig(); as config) {\n <mat-card-content class=\"flex-column-stretch fxFlex\">\n <cdk-virtual-scroll-viewport itemSize=\"30\" class=\"fxFlex\">\n <div\n *cdkVirtualFor=\"let item of displayedItems(); trackBy: getItemId\"\n class=\"ngssm-tree-node\"\n [style.padding-left.px]=\"item.node.level * 20\"\n (click)=\"selectNode(item.node)\"\n aria-hidden=\"true\"\n (keyup.enter)=\"selectNode(item.node)\"\n [ngClass]=\"{ selected: selectedNodeId() === item.node.node.nodeId }\">\n @if (item.node.node.isExpandable) {\n @if (item.node.status === dataStatus.loading) {\n <mat-spinner diameter=\"20\"></mat-spinner>\n } @else {\n @if (item.node.isExpanded) {\n <mat-icon class=\"fa-solid fa-chevron-down\" (click)=\"$event.stopPropagation(); collapse(item.node)\"></mat-icon>\n } @else {\n <mat-icon class=\"fa-solid fa-chevron-right\" (click)=\"$event.stopPropagation(); expand(item.node)\"></mat-icon>\n }\n }\n } @else {\n <span class=\"not-expandable-padding\"></span>\n }\n\n <mat-icon class=\"{{ config.iconClasses[item.node.node.type] }}\" color=\"primary\"></mat-icon>\n\n <span class=\"ngssm-tree-node-label\">\n {{ item.node.node.label }}\n </span>\n <span class=\"fxFlex\"></span>\n @if (item.canSearch) {\n <i class=\"fa-solid fa-magnifying-glass search-icon\" (click)=\"$event.stopPropagation(); displaySearchDialog(item.node)\"> </i>\n }\n </div>\n </cdk-virtual-scroll-viewport>\n </mat-card-content>\n }\n</mat-card>\n", styles: [":host{display:flex;flex-direction:column}:host .ngssm-tree-node{height:30px;display:flex;flex-direction:row;align-items:center;padding-right:12px}:host .ngssm-tree-node .fa-folder{margin-right:4px}:host .ngssm-tree-node .fa-chevron-right:hover{cursor:pointer}:host .ngssm-tree-node.selected{background-color:#e4e6f1}:host .ngssm-tree-node:hover{cursor:pointer}:host .ngssm-tree-node:hover .search-icon{display:unset}:host .ngssm-tree-node:hover:not(.selected){background-color:#f3f3f3}:host .not-expandable-padding{width:24px}:host .search-icon{font-size:12px;display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i2.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i2.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i2.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i6.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i6.MatCardContent, selector: "mat-card-content" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i5.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
333
341
|
}
|
|
334
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: NgssmTreeComponent, decorators: [{
|
|
335
343
|
type: Component,
|
|
336
344
|
args: [{ selector: 'ngssm-tree', imports: [CommonModule, ScrollingModule, MatCardModule, MatIconModule, MatProgressSpinnerModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-card class=\"flex-column-stretch fxFlex\">\n @if (treeConfig(); as config) {\n <mat-card-content class=\"flex-column-stretch fxFlex\">\n <cdk-virtual-scroll-viewport itemSize=\"30\" class=\"fxFlex\">\n <div\n *cdkVirtualFor=\"let item of displayedItems(); trackBy: getItemId\"\n class=\"ngssm-tree-node\"\n [style.padding-left.px]=\"item.node.level * 20\"\n (click)=\"selectNode(item.node)\"\n aria-hidden=\"true\"\n (keyup.enter)=\"selectNode(item.node)\"\n [ngClass]=\"{ selected: selectedNodeId() === item.node.node.nodeId }\">\n @if (item.node.node.isExpandable) {\n @if (item.node.status === dataStatus.loading) {\n <mat-spinner diameter=\"20\"></mat-spinner>\n } @else {\n @if (item.node.isExpanded) {\n <mat-icon class=\"fa-solid fa-chevron-down\" (click)=\"$event.stopPropagation(); collapse(item.node)\"></mat-icon>\n } @else {\n <mat-icon class=\"fa-solid fa-chevron-right\" (click)=\"$event.stopPropagation(); expand(item.node)\"></mat-icon>\n }\n }\n } @else {\n <span class=\"not-expandable-padding\"></span>\n }\n\n <mat-icon class=\"{{ config.iconClasses[item.node.node.type] }}\" color=\"primary\"></mat-icon>\n\n <span class=\"ngssm-tree-node-label\">\n {{ item.node.node.label }}\n </span>\n <span class=\"fxFlex\"></span>\n @if (item.canSearch) {\n <i class=\"fa-solid fa-magnifying-glass search-icon\" (click)=\"$event.stopPropagation(); displaySearchDialog(item.node)\"> </i>\n }\n </div>\n </cdk-virtual-scroll-viewport>\n </mat-card-content>\n }\n</mat-card>\n", styles: [":host{display:flex;flex-direction:column}:host .ngssm-tree-node{height:30px;display:flex;flex-direction:row;align-items:center;padding-right:12px}:host .ngssm-tree-node .fa-folder{margin-right:4px}:host .ngssm-tree-node .fa-chevron-right:hover{cursor:pointer}:host .ngssm-tree-node.selected{background-color:#e4e6f1}:host .ngssm-tree-node:hover{cursor:pointer}:host .ngssm-tree-node:hover .search-icon{display:unset}:host .ngssm-tree-node:hover:not(.selected){background-color:#f3f3f3}:host .not-expandable-padding{width:24px}:host .search-icon{font-size:12px;display:none}\n"] }]
|
|
337
345
|
}], ctorParameters: () => [], propDecorators: { treeConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeConfig", required: false }] }] } });
|
|
338
346
|
|
|
339
347
|
class NgssmBreadcrumbComponent {
|
|
348
|
+
treeId = input(undefined, ...(ngDevMode ? [{ debugName: "treeId" }] : []));
|
|
349
|
+
nodes = signal([], ...(ngDevMode ? [{ debugName: "nodes" }] : []));
|
|
350
|
+
store = inject(Store);
|
|
351
|
+
treeState = createSignal((state) => selectNgssmTreeState(state));
|
|
340
352
|
constructor() {
|
|
341
|
-
this.treeId = input(undefined, ...(ngDevMode ? [{ debugName: "treeId" }] : []));
|
|
342
|
-
this.nodes = signal([], ...(ngDevMode ? [{ debugName: "nodes" }] : []));
|
|
343
|
-
this.store = inject(Store);
|
|
344
|
-
this.treeState = createSignal((state) => selectNgssmTreeState(state));
|
|
345
353
|
effect(() => {
|
|
346
354
|
const currentTreeId = this.treeId();
|
|
347
355
|
if (!currentTreeId) {
|
|
@@ -373,30 +381,30 @@ class NgssmBreadcrumbComponent {
|
|
|
373
381
|
this.store.dispatchAction(new SelectNodeAction(treeId, node.nodeId));
|
|
374
382
|
}
|
|
375
383
|
}
|
|
376
|
-
static
|
|
377
|
-
static
|
|
384
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: NgssmBreadcrumbComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
385
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: NgssmBreadcrumbComponent, isStandalone: true, selector: "ngssm-breadcrumb", inputs: { treeId: { classPropertyName: "treeId", publicName: "treeId", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex-row-center\">\n <mat-icon class=\"fa-solid fa-folder-tree\" color=\"primary\"></mat-icon>\n @for (node of nodes(); track node; let last = $last) {\n <span class=\"flex-row-center\">\n <button mat-button [disabled]=\"last\" (click)=\"selectNode(node)\">\n {{ node.label }}\n </button>\n\n @if (!last) {\n <div class=\"ngssm-breadcrumb-separator\">/</div>\n }\n </span>\n }\n</div>\n", styles: [".ngssm-breadcrumb-separator{font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
378
386
|
}
|
|
379
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: NgssmBreadcrumbComponent, decorators: [{
|
|
380
388
|
type: Component,
|
|
381
389
|
args: [{ selector: 'ngssm-breadcrumb', imports: [MatIconModule, MatButtonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex-row-center\">\n <mat-icon class=\"fa-solid fa-folder-tree\" color=\"primary\"></mat-icon>\n @for (node of nodes(); track node; let last = $last) {\n <span class=\"flex-row-center\">\n <button mat-button [disabled]=\"last\" (click)=\"selectNode(node)\">\n {{ node.label }}\n </button>\n\n @if (!last) {\n <div class=\"ngssm-breadcrumb-separator\">/</div>\n }\n </span>\n }\n</div>\n", styles: [".ngssm-breadcrumb-separator{font-weight:700}\n"] }]
|
|
382
390
|
}], ctorParameters: () => [], propDecorators: { treeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeId", required: false }] }] } });
|
|
383
391
|
|
|
384
392
|
class NgssmTreeSearchDialogComponent {
|
|
393
|
+
resultsViewerContainer = viewChild('resultsViewerContainer', { ...(ngDevMode ? { debugName: "resultsViewerContainer" } : {}), read: ViewContainerRef });
|
|
394
|
+
searchStatus = SearchStatus;
|
|
395
|
+
searchRootPath = createSignal((state) => selectNgssmTreeState(state).treeNodesSearch.rootSearchPath ?? '');
|
|
396
|
+
currentSearchedPath = createSignal((state) => selectNgssmTreeState(state).treeNodesSearch.toProcess[0]?.fullPath ?? '');
|
|
397
|
+
currentSearchStatus = createSignal((state) => selectNgssmTreeState(state).treeNodesSearch.searchStatus);
|
|
398
|
+
searchPatternControl = new FormControl(undefined, [
|
|
399
|
+
Validators.required,
|
|
400
|
+
(c) => this.validatedRegex(c)
|
|
401
|
+
]);
|
|
402
|
+
store = inject(Store);
|
|
403
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
404
|
+
dataServices = inject(NGSSM_TREE_DATA_SERVICE, {
|
|
405
|
+
optional: true
|
|
406
|
+
});
|
|
385
407
|
constructor() {
|
|
386
|
-
this.resultsViewerContainer = viewChild('resultsViewerContainer', ...(ngDevMode ? [{ debugName: "resultsViewerContainer", read: ViewContainerRef }] : [{ read: ViewContainerRef }]));
|
|
387
|
-
this.searchStatus = SearchStatus;
|
|
388
|
-
this.searchRootPath = createSignal((state) => selectNgssmTreeState(state).treeNodesSearch.rootSearchPath ?? '');
|
|
389
|
-
this.currentSearchedPath = createSignal((state) => selectNgssmTreeState(state).treeNodesSearch.toProcess[0]?.fullPath ?? '');
|
|
390
|
-
this.currentSearchStatus = createSignal((state) => selectNgssmTreeState(state).treeNodesSearch.searchStatus);
|
|
391
|
-
this.searchPatternControl = new FormControl(undefined, [
|
|
392
|
-
Validators.required,
|
|
393
|
-
(c) => this.validatedRegex(c)
|
|
394
|
-
]);
|
|
395
|
-
this.store = inject(Store);
|
|
396
|
-
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
397
|
-
this.dataServices = inject(NGSSM_TREE_DATA_SERVICE, {
|
|
398
|
-
optional: true
|
|
399
|
-
});
|
|
400
408
|
const effectRef = effect(() => {
|
|
401
409
|
const container = this.resultsViewerContainer();
|
|
402
410
|
if (!container) {
|
|
@@ -441,10 +449,10 @@ class NgssmTreeSearchDialogComponent {
|
|
|
441
449
|
regex: result.error
|
|
442
450
|
};
|
|
443
451
|
}
|
|
444
|
-
static
|
|
445
|
-
static
|
|
452
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: NgssmTreeSearchDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
453
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: NgssmTreeSearchDialogComponent, isStandalone: true, selector: "ngssm-ngssm-tree-search-dialog", viewQueries: [{ propertyName: "resultsViewerContainer", first: true, predicate: ["resultsViewerContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<h1 mat-dialog-title>Tree search dialog</h1>\n@let searchInProgress = currentSearchStatus() === searchStatus.inProgress;\n<mat-dialog-content class=\"flex-column-stretch fxFlex\">\n <mat-card class=\"flex-column-stretch\">\n <mat-card-content class=\"flex-row-center\">\n <mat-form-field class=\"with-margin-right-12 fxFlex\">\n <mat-label>Starts search in</mat-label>\n <input matInput readonly [ngModel]=\"searchRootPath()\" />\n </mat-form-field>\n\n <mat-form-field class=\"fxFlex with-margin-right-12\">\n <mat-label>Search pattern</mat-label>\n <input matInput [formControl]=\"searchPatternControl\" />\n @if (searchPatternControl.errors?.['regex']; as error) {\n <mat-error>\n {{ error }}\n </mat-error>\n }\n </mat-form-field>\n\n @if (!searchInProgress) {\n <button mat-stroked-button color=\"primary\" [disabled]=\"searchPatternControl.invalid\" (click)=\"search()\">\n <mat-icon class=\"fa-solid fa-magnifying-glass\"></mat-icon>\n Search\n </button>\n } @else {\n <button mat-raised-button color=\"accent\" (click)=\"abort()\">\n <mat-icon class=\"fa-solid fa-ban\"></mat-icon>\n Abort\n </button>\n }\n </mat-card-content>\n @if (searchInProgress) {\n <mat-card-footer class=\"flex-row-center\">\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n {{ currentSearchedPath() }}\n </mat-card-footer>\n }\n </mat-card>\n <mat-card class=\"flex-column-stretch fxFlex with-margin-top-8\">\n <ng-container #resultsViewerContainer></ng-container>\n </mat-card>\n</mat-dialog-content>\n<mat-dialog-actions class=\"flex-row-center\">\n <span class=\"fxFlex\"></span>\n <button mat-button (click)=\"close()\">Close</button>\n</mat-dialog-actions>\n", styles: [":host{display:flex;flex-direction:column;height:100%}:host .mat-mdc-dialog-content{max-height:unset!important}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i4$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i4$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.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: "ngmodule", type: MatCardModule }, { kind: "component", type: i6.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i6.MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: i6.MatCardFooter, selector: "mat-card-footer" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i5.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
446
454
|
}
|
|
447
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
455
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: NgssmTreeSearchDialogComponent, decorators: [{
|
|
448
456
|
type: Component,
|
|
449
457
|
args: [{ selector: 'ngssm-ngssm-tree-search-dialog', imports: [
|
|
450
458
|
FormsModule,
|
|
@@ -460,17 +468,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
|
|
|
460
468
|
}], ctorParameters: () => [], propDecorators: { resultsViewerContainer: [{ type: i0.ViewChild, args: ['resultsViewerContainer', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
461
469
|
|
|
462
470
|
class TreeNodesSearchingEffect {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
471
|
+
processedActions = [
|
|
472
|
+
NgssmTreeActionType.displaySearchDialog,
|
|
473
|
+
NgssmTreeActionType.closeSearchDialog,
|
|
474
|
+
NgssmTreeActionType.searchTreeNodes,
|
|
475
|
+
NgssmTreeActionType.registerNodes,
|
|
476
|
+
NgssmTreeActionType.registerPartialSearchResults
|
|
477
|
+
];
|
|
478
|
+
matDialog = inject(MatDialog);
|
|
479
|
+
logger = inject(Logger);
|
|
480
|
+
dialog;
|
|
474
481
|
processAction(actiondispatcher, state, action) {
|
|
475
482
|
switch (action.type) {
|
|
476
483
|
case NgssmTreeActionType.displaySearchDialog: {
|
|
@@ -525,22 +532,20 @@ class TreeNodesSearchingEffect {
|
|
|
525
532
|
this.dialog?.close();
|
|
526
533
|
this.dialog = undefined;
|
|
527
534
|
}
|
|
528
|
-
static
|
|
529
|
-
static
|
|
535
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodesSearchingEffect, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
536
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodesSearchingEffect });
|
|
530
537
|
}
|
|
531
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
538
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodesSearchingEffect, decorators: [{
|
|
532
539
|
type: Injectable
|
|
533
540
|
}] });
|
|
534
541
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
];
|
|
543
|
-
}
|
|
542
|
+
class TreeNodeExpandReducer {
|
|
543
|
+
processedActions = [
|
|
544
|
+
NgssmTreeActionType.expandNode,
|
|
545
|
+
NgssmTreeActionType.collapseNode,
|
|
546
|
+
NgssmTreeActionType.selectNode,
|
|
547
|
+
NgssmTreeActionType.loadChildrenOfNode
|
|
548
|
+
];
|
|
544
549
|
updateState(state, action) {
|
|
545
550
|
switch (action.type) {
|
|
546
551
|
case NgssmTreeActionType.expandNode: {
|
|
@@ -650,17 +655,15 @@ let TreeNodeExpandReducer$1 = class TreeNodeExpandReducer {
|
|
|
650
655
|
}
|
|
651
656
|
return state;
|
|
652
657
|
}
|
|
653
|
-
static
|
|
654
|
-
static
|
|
655
|
-
}
|
|
656
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
658
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodeExpandReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
659
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodeExpandReducer });
|
|
660
|
+
}
|
|
661
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodeExpandReducer, decorators: [{
|
|
657
662
|
type: Injectable
|
|
658
663
|
}] });
|
|
659
664
|
|
|
660
665
|
class TreeNodeSelectionReducer {
|
|
661
|
-
|
|
662
|
-
this.processedActions = [NgssmTreeActionType.selectNode];
|
|
663
|
-
}
|
|
666
|
+
processedActions = [NgssmTreeActionType.selectNode];
|
|
664
667
|
updateState(state, action) {
|
|
665
668
|
switch (action.type) {
|
|
666
669
|
case NgssmTreeActionType.selectNode: {
|
|
@@ -676,23 +679,21 @@ class TreeNodeSelectionReducer {
|
|
|
676
679
|
}
|
|
677
680
|
return state;
|
|
678
681
|
}
|
|
679
|
-
static
|
|
680
|
-
static
|
|
682
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodeSelectionReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
683
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodeSelectionReducer });
|
|
681
684
|
}
|
|
682
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
685
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodeSelectionReducer, decorators: [{
|
|
683
686
|
type: Injectable
|
|
684
687
|
}] });
|
|
685
688
|
|
|
686
689
|
class TreeNodesSearchReducer {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
];
|
|
695
|
-
}
|
|
690
|
+
processedActions = [
|
|
691
|
+
NgssmTreeActionType.displaySearchDialog,
|
|
692
|
+
NgssmTreeActionType.closeSearchDialog,
|
|
693
|
+
NgssmTreeActionType.searchTreeNodes,
|
|
694
|
+
NgssmTreeActionType.registerPartialSearchResults,
|
|
695
|
+
NgssmTreeActionType.abortTreeNodesSearch
|
|
696
|
+
];
|
|
696
697
|
updateState(state, action) {
|
|
697
698
|
switch (action.type) {
|
|
698
699
|
case NgssmTreeActionType.displaySearchDialog: {
|
|
@@ -760,17 +761,15 @@ class TreeNodesSearchReducer {
|
|
|
760
761
|
}
|
|
761
762
|
return state;
|
|
762
763
|
}
|
|
763
|
-
static
|
|
764
|
-
static
|
|
764
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodesSearchReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
765
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodesSearchReducer });
|
|
765
766
|
}
|
|
766
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
767
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodesSearchReducer, decorators: [{
|
|
767
768
|
type: Injectable
|
|
768
769
|
}] });
|
|
769
770
|
|
|
770
771
|
class TreeNodesReducer {
|
|
771
|
-
|
|
772
|
-
this.processedActions = [NgssmTreeActionType.registerNodes];
|
|
773
|
-
}
|
|
772
|
+
processedActions = [NgssmTreeActionType.registerNodes];
|
|
774
773
|
updateState(state, action) {
|
|
775
774
|
switch (action.type) {
|
|
776
775
|
case NgssmTreeActionType.registerNodes: {
|
|
@@ -807,17 +806,15 @@ class TreeNodesReducer {
|
|
|
807
806
|
}
|
|
808
807
|
return state;
|
|
809
808
|
}
|
|
810
|
-
static
|
|
811
|
-
static
|
|
809
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodesReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
810
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodesReducer });
|
|
812
811
|
}
|
|
813
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
812
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreeNodesReducer, decorators: [{
|
|
814
813
|
type: Injectable
|
|
815
814
|
}] });
|
|
816
815
|
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
this.processedActions = [NgssmTreeActionType.initNgssmTree, NgssmTreeActionType.deleteNgssmTree];
|
|
820
|
-
}
|
|
816
|
+
class TreesReducer {
|
|
817
|
+
processedActions = [NgssmTreeActionType.initNgssmTree, NgssmTreeActionType.deleteNgssmTree];
|
|
821
818
|
updateState(state, action) {
|
|
822
819
|
switch (action.type) {
|
|
823
820
|
case NgssmTreeActionType.initNgssmTree: {
|
|
@@ -849,772 +846,20 @@ let TreesReducer$1 = class TreesReducer {
|
|
|
849
846
|
}
|
|
850
847
|
return state;
|
|
851
848
|
}
|
|
852
|
-
static
|
|
853
|
-
static
|
|
854
|
-
}
|
|
855
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
849
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreesReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
850
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreesReducer });
|
|
851
|
+
}
|
|
852
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TreesReducer, decorators: [{
|
|
856
853
|
type: Injectable
|
|
857
854
|
}] });
|
|
858
855
|
|
|
859
856
|
const provideNgssmTree = () => {
|
|
860
857
|
return makeEnvironmentProviders([
|
|
861
|
-
provideReducers(TreeNodeExpandReducer
|
|
858
|
+
provideReducers(TreeNodeExpandReducer, TreeNodeSelectionReducer, TreeNodesSearchReducer, TreeNodesReducer, TreesReducer),
|
|
862
859
|
provideEffects(TreeNodeLoadingEffect, TreeNodesSearchingEffect)
|
|
863
860
|
]);
|
|
864
861
|
};
|
|
865
862
|
|
|
866
|
-
var NgssmExpressionTreeActionType;
|
|
867
|
-
(function (NgssmExpressionTreeActionType) {
|
|
868
|
-
// List of trees management
|
|
869
|
-
NgssmExpressionTreeActionType["ngssmInitExpressionTree"] = "[NgssmExpressionTreeActionType] ngssmInitExpressionTree";
|
|
870
|
-
NgssmExpressionTreeActionType["ngssmClearExpressionTree"] = "[NgssmExpressionTreeActionType] ngssmClearExpressionTree";
|
|
871
|
-
// Manage expand/collapse
|
|
872
|
-
NgssmExpressionTreeActionType["ngssmCollapseExpressionTreeNode"] = "[NgssmExpressionTreeActionType] ngssmCollapseExpressionTreeNode";
|
|
873
|
-
NgssmExpressionTreeActionType["ngssmExpandExpressionTreeNode"] = "[NgssmExpressionTreeActionType] ngssmExpandExpressionTreeNode";
|
|
874
|
-
NgssmExpressionTreeActionType["ngssmCollapseAllExpressionTreeNodes"] = "[NgssmExpressionTreeActionType] ngssmCollapseAllExpressionTreeNodes";
|
|
875
|
-
NgssmExpressionTreeActionType["ngssmExpandAllExpressionTreeNodes"] = "[NgssmExpressionTreeActionType] ngssmExpandAllExpressionTreeNodes";
|
|
876
|
-
// Node edition
|
|
877
|
-
NgssmExpressionTreeActionType["ngssmAddExpressionTreeNode"] = "[NgssmExpressionTreeActionType] ngssmAddExpressionTreeNode";
|
|
878
|
-
NgssmExpressionTreeActionType["ngssmAddExpressionTreeNodes"] = "[NgssmExpressionTreeActionType] ngssmAddExpressionTreeNodes";
|
|
879
|
-
NgssmExpressionTreeActionType["ngssmDeleteExpressionTreeNode"] = "[NgssmExpressionTreeActionType] ngssmDeleteExpressionTreeNode";
|
|
880
|
-
NgssmExpressionTreeActionType["ngssmUpdateExpressionTreeNode"] = "[NgssmExpressionTreeActionType] ngssmUpdateExpressionTreeNode";
|
|
881
|
-
// Cut/Paste
|
|
882
|
-
NgssmExpressionTreeActionType["ngssmCutExpressionTreeNode"] = "[NgssmExpressionTreeActionType] ngssmCutExpressionTreeNode";
|
|
883
|
-
NgssmExpressionTreeActionType["ngssmPasteExpressionTreeNode"] = "[NgssmExpressionTreeActionType] ngssmPasteExpressionTreeNode";
|
|
884
|
-
NgssmExpressionTreeActionType["ngssmCancelCutExpressionTreeNode"] = "[NgssmExpressionTreeActionType] ngssmCancelCutExpressionTreeNode";
|
|
885
|
-
})(NgssmExpressionTreeActionType || (NgssmExpressionTreeActionType = {}));
|
|
886
|
-
|
|
887
|
-
class NgssmExpressionTreeAction {
|
|
888
|
-
constructor(type, treeId) {
|
|
889
|
-
this.type = type;
|
|
890
|
-
this.treeId = treeId;
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
class NgssmClearExpressionTreeAction extends NgssmExpressionTreeAction {
|
|
895
|
-
constructor(treeId) {
|
|
896
|
-
super(NgssmExpressionTreeActionType.ngssmClearExpressionTree, treeId);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
class NgssmInitExpressionTreeAction extends NgssmExpressionTreeAction {
|
|
901
|
-
constructor(treeId, nodes) {
|
|
902
|
-
super(NgssmExpressionTreeActionType.ngssmInitExpressionTree, treeId);
|
|
903
|
-
this.nodes = nodes;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
class NgssmExpressionTreeNodeAction extends NgssmExpressionTreeAction {
|
|
908
|
-
constructor(type, treeId, nodeId) {
|
|
909
|
-
super(type, treeId);
|
|
910
|
-
this.nodeId = nodeId;
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
class NgssmExpandExpressionTreeNodeAction extends NgssmExpressionTreeNodeAction {
|
|
915
|
-
constructor(treeId, nodeId) {
|
|
916
|
-
super(NgssmExpressionTreeActionType.ngssmExpandExpressionTreeNode, treeId, nodeId);
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
class NgssmCollapseExpressionTreeNodeAction extends NgssmExpressionTreeNodeAction {
|
|
921
|
-
constructor(treeId, nodeId) {
|
|
922
|
-
super(NgssmExpressionTreeActionType.ngssmCollapseExpressionTreeNode, treeId, nodeId);
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
class NgssmAddExpressionTreeNodeAction extends NgssmExpressionTreeAction {
|
|
927
|
-
constructor(treeId, node) {
|
|
928
|
-
super(NgssmExpressionTreeActionType.ngssmAddExpressionTreeNode, treeId);
|
|
929
|
-
this.node = node;
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
class NgssmDeleteExpressionTreeNodeAction extends NgssmExpressionTreeNodeAction {
|
|
934
|
-
constructor(treeId, nodeId) {
|
|
935
|
-
super(NgssmExpressionTreeActionType.ngssmDeleteExpressionTreeNode, treeId, nodeId);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
class NgssmUpdateExpressionTreeNodeAction extends NgssmExpressionTreeNodeAction {
|
|
940
|
-
constructor(treeId, nodeId, data) {
|
|
941
|
-
super(NgssmExpressionTreeActionType.ngssmUpdateExpressionTreeNode, treeId, nodeId);
|
|
942
|
-
this.data = data;
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
class NgssmCollapseAllExpressionTreeNodesAction extends NgssmExpressionTreeAction {
|
|
947
|
-
constructor(treeId) {
|
|
948
|
-
super(NgssmExpressionTreeActionType.ngssmCollapseAllExpressionTreeNodes, treeId);
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
class NgssmExpandAllExpressionTreeNodesAction extends NgssmExpressionTreeAction {
|
|
953
|
-
constructor(treeId) {
|
|
954
|
-
super(NgssmExpressionTreeActionType.ngssmExpandAllExpressionTreeNodes, treeId);
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
class NgssmAddExpressionTreeNodesAction extends NgssmExpressionTreeAction {
|
|
959
|
-
constructor(treeId, nodes) {
|
|
960
|
-
super(NgssmExpressionTreeActionType.ngssmAddExpressionTreeNodes, treeId);
|
|
961
|
-
this.nodes = nodes;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
class NgssmCutExpressionTreeNodeAction extends NgssmExpressionTreeNodeAction {
|
|
966
|
-
constructor(treeId, nodeId) {
|
|
967
|
-
super(NgssmExpressionTreeActionType.ngssmCutExpressionTreeNode, treeId, nodeId);
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
class NgssmPasteExpressionTreeNodeAction extends NgssmExpressionTreeNodeAction {
|
|
972
|
-
constructor(treeId, nodeId, target) {
|
|
973
|
-
super(NgssmExpressionTreeActionType.ngssmPasteExpressionTreeNode, treeId, nodeId);
|
|
974
|
-
this.target = target;
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
class NgssmCancelCutExpressionTreeNodeAction extends NgssmExpressionTreeAction {
|
|
979
|
-
constructor(treeId) {
|
|
980
|
-
super(NgssmExpressionTreeActionType.ngssmCancelCutExpressionTreeNode, treeId);
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
const createNgssmExpressionTreeFromNodes = (nodes) => {
|
|
985
|
-
const tree = {
|
|
986
|
-
nodes: [],
|
|
987
|
-
data: {}
|
|
988
|
-
};
|
|
989
|
-
let path = [];
|
|
990
|
-
nodes.forEach((node) => {
|
|
991
|
-
if (!node.parentId) {
|
|
992
|
-
path = [];
|
|
993
|
-
}
|
|
994
|
-
else {
|
|
995
|
-
const parentIdIndex = path.indexOf(node.parentId);
|
|
996
|
-
if (parentIdIndex === -1) {
|
|
997
|
-
path.push(node.parentId);
|
|
998
|
-
}
|
|
999
|
-
else {
|
|
1000
|
-
path.splice(parentIdIndex + 1);
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
tree.nodes.push({
|
|
1004
|
-
path: [...path],
|
|
1005
|
-
data: node,
|
|
1006
|
-
isExpanded: node.isExpandable === true
|
|
1007
|
-
});
|
|
1008
|
-
tree.data[node.id] = node.data;
|
|
1009
|
-
});
|
|
1010
|
-
return tree;
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
|
-
const selectNgssmExpressionTreeState = (state) => state[NgssmExpressionTreeStateSpecification.featureStateKey];
|
|
1014
|
-
const updateNgssmExpressionTreeState = (state, command) => update(state, {
|
|
1015
|
-
[NgssmExpressionTreeStateSpecification.featureStateKey]: command
|
|
1016
|
-
});
|
|
1017
|
-
let NgssmExpressionTreeStateSpecification = class NgssmExpressionTreeStateSpecification {
|
|
1018
|
-
static { this.featureStateKey = 'ngssm-expression-tree-state'; }
|
|
1019
|
-
static { this.initialState = {
|
|
1020
|
-
trees: {}
|
|
1021
|
-
}; }
|
|
1022
|
-
};
|
|
1023
|
-
NgssmExpressionTreeStateSpecification = __decorate([
|
|
1024
|
-
NgSsmFeatureState({
|
|
1025
|
-
featureStateKey: NgssmExpressionTreeStateSpecification.featureStateKey,
|
|
1026
|
-
initialState: NgssmExpressionTreeStateSpecification.initialState
|
|
1027
|
-
})
|
|
1028
|
-
], NgssmExpressionTreeStateSpecification);
|
|
1029
|
-
|
|
1030
|
-
class TreesReducer {
|
|
1031
|
-
constructor() {
|
|
1032
|
-
this.processedActions = [
|
|
1033
|
-
NgssmExpressionTreeActionType.ngssmInitExpressionTree,
|
|
1034
|
-
NgssmExpressionTreeActionType.ngssmClearExpressionTree
|
|
1035
|
-
];
|
|
1036
|
-
}
|
|
1037
|
-
updateState(state, action) {
|
|
1038
|
-
switch (action.type) {
|
|
1039
|
-
case NgssmExpressionTreeActionType.ngssmInitExpressionTree: {
|
|
1040
|
-
const ngssmInitExpressionTreeAction = action;
|
|
1041
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1042
|
-
trees: {
|
|
1043
|
-
[ngssmInitExpressionTreeAction.treeId]: {
|
|
1044
|
-
$set: createNgssmExpressionTreeFromNodes(ngssmInitExpressionTreeAction.nodes)
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
case NgssmExpressionTreeActionType.ngssmClearExpressionTree: {
|
|
1050
|
-
const ngssmClearExpressionTreeAction = action;
|
|
1051
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1052
|
-
trees: {
|
|
1053
|
-
$unset: [ngssmClearExpressionTreeAction.treeId]
|
|
1054
|
-
}
|
|
1055
|
-
});
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
return state;
|
|
1059
|
-
}
|
|
1060
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreesReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1061
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreesReducer }); }
|
|
1062
|
-
}
|
|
1063
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreesReducer, decorators: [{
|
|
1064
|
-
type: Injectable
|
|
1065
|
-
}] });
|
|
1066
|
-
|
|
1067
|
-
class TreeNodeExpandReducer {
|
|
1068
|
-
constructor() {
|
|
1069
|
-
this.processedActions = [
|
|
1070
|
-
NgssmExpressionTreeActionType.ngssmExpandExpressionTreeNode,
|
|
1071
|
-
NgssmExpressionTreeActionType.ngssmCollapseExpressionTreeNode,
|
|
1072
|
-
NgssmExpressionTreeActionType.ngssmCollapseAllExpressionTreeNodes,
|
|
1073
|
-
NgssmExpressionTreeActionType.ngssmExpandAllExpressionTreeNodes
|
|
1074
|
-
];
|
|
1075
|
-
}
|
|
1076
|
-
updateState(state, action) {
|
|
1077
|
-
switch (action.type) {
|
|
1078
|
-
case NgssmExpressionTreeActionType.ngssmExpandExpressionTreeNode: {
|
|
1079
|
-
const ngssmExpandExpressionTreeNodeAction = action;
|
|
1080
|
-
return this.setIsExpanded(state, ngssmExpandExpressionTreeNodeAction.treeId, ngssmExpandExpressionTreeNodeAction.nodeId, true);
|
|
1081
|
-
}
|
|
1082
|
-
case NgssmExpressionTreeActionType.ngssmCollapseExpressionTreeNode: {
|
|
1083
|
-
const ngssmCollapseExpressionTreeNodeAction = action;
|
|
1084
|
-
return this.setIsExpanded(state, ngssmCollapseExpressionTreeNodeAction.treeId, ngssmCollapseExpressionTreeNodeAction.nodeId, false);
|
|
1085
|
-
}
|
|
1086
|
-
case NgssmExpressionTreeActionType.ngssmCollapseAllExpressionTreeNodes: {
|
|
1087
|
-
const ngssmExpressionTreeAction = action;
|
|
1088
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1089
|
-
trees: {
|
|
1090
|
-
[ngssmExpressionTreeAction.treeId]: {
|
|
1091
|
-
nodes: {
|
|
1092
|
-
$apply: (values) => {
|
|
1093
|
-
const output = [];
|
|
1094
|
-
values.forEach((value) => output.push({
|
|
1095
|
-
...value,
|
|
1096
|
-
isExpanded: false
|
|
1097
|
-
}));
|
|
1098
|
-
return output;
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
});
|
|
1104
|
-
}
|
|
1105
|
-
case NgssmExpressionTreeActionType.ngssmExpandAllExpressionTreeNodes: {
|
|
1106
|
-
const ngssmExpressionTreeAction = action;
|
|
1107
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1108
|
-
trees: {
|
|
1109
|
-
[ngssmExpressionTreeAction.treeId]: {
|
|
1110
|
-
nodes: {
|
|
1111
|
-
$apply: (values) => {
|
|
1112
|
-
const output = [];
|
|
1113
|
-
values.forEach((value) => output.push({
|
|
1114
|
-
...value,
|
|
1115
|
-
isExpanded: true
|
|
1116
|
-
}));
|
|
1117
|
-
return output;
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
});
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
return state;
|
|
1126
|
-
}
|
|
1127
|
-
setIsExpanded(state, treeId, nodeId, isExpanded) {
|
|
1128
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1129
|
-
trees: {
|
|
1130
|
-
[treeId]: {
|
|
1131
|
-
nodes: {
|
|
1132
|
-
$apply: (values) => {
|
|
1133
|
-
const output = [...values];
|
|
1134
|
-
const index = output.findIndex((n) => n.data.id === nodeId);
|
|
1135
|
-
if (index !== -1) {
|
|
1136
|
-
output.splice(index, 1, update(output[index], { isExpanded: { $set: isExpanded } }));
|
|
1137
|
-
}
|
|
1138
|
-
return output;
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeExpandReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1146
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeExpandReducer }); }
|
|
1147
|
-
}
|
|
1148
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeExpandReducer, decorators: [{
|
|
1149
|
-
type: Injectable
|
|
1150
|
-
}] });
|
|
1151
|
-
|
|
1152
|
-
class TreeNodeEditionReducer {
|
|
1153
|
-
constructor() {
|
|
1154
|
-
this.processedActions = [
|
|
1155
|
-
NgssmExpressionTreeActionType.ngssmAddExpressionTreeNode,
|
|
1156
|
-
NgssmExpressionTreeActionType.ngssmDeleteExpressionTreeNode,
|
|
1157
|
-
NgssmExpressionTreeActionType.ngssmUpdateExpressionTreeNode,
|
|
1158
|
-
NgssmExpressionTreeActionType.ngssmAddExpressionTreeNodes
|
|
1159
|
-
];
|
|
1160
|
-
}
|
|
1161
|
-
updateState(state, action) {
|
|
1162
|
-
switch (action.type) {
|
|
1163
|
-
case NgssmExpressionTreeActionType.ngssmAddExpressionTreeNode: {
|
|
1164
|
-
const ngssmAddExpressionTreeNodeAction = action;
|
|
1165
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1166
|
-
trees: {
|
|
1167
|
-
[ngssmAddExpressionTreeNodeAction.treeId]: {
|
|
1168
|
-
data: {
|
|
1169
|
-
[ngssmAddExpressionTreeNodeAction.node.id]: { $set: ngssmAddExpressionTreeNodeAction.node.data }
|
|
1170
|
-
},
|
|
1171
|
-
nodes: {
|
|
1172
|
-
$apply: (values) => {
|
|
1173
|
-
const output = [...values];
|
|
1174
|
-
this.addNodeToList(ngssmAddExpressionTreeNodeAction.node, output);
|
|
1175
|
-
return output;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
case NgssmExpressionTreeActionType.ngssmAddExpressionTreeNodes: {
|
|
1183
|
-
const ngssmAddExpressionTreeNodesAction = action;
|
|
1184
|
-
const newProps = {};
|
|
1185
|
-
ngssmAddExpressionTreeNodesAction.nodes.forEach((node) => (newProps[node.id] = node.data));
|
|
1186
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1187
|
-
trees: {
|
|
1188
|
-
[ngssmAddExpressionTreeNodesAction.treeId]: {
|
|
1189
|
-
data: { $merge: newProps },
|
|
1190
|
-
nodes: {
|
|
1191
|
-
$apply: (values) => {
|
|
1192
|
-
const output = [...values];
|
|
1193
|
-
ngssmAddExpressionTreeNodesAction.nodes.forEach((node) => this.addNodeToList(node, output));
|
|
1194
|
-
return output;
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
case NgssmExpressionTreeActionType.ngssmDeleteExpressionTreeNode: {
|
|
1202
|
-
const ngssmDeleteExpressionTreeNodeAction = action;
|
|
1203
|
-
const nodeIdsToDelete = selectNgssmExpressionTreeState(state)
|
|
1204
|
-
.trees[ngssmDeleteExpressionTreeNodeAction.treeId].nodes.filter((n) => n.path.includes(ngssmDeleteExpressionTreeNodeAction.nodeId))
|
|
1205
|
-
.map((n) => n.data.id);
|
|
1206
|
-
nodeIdsToDelete.push(ngssmDeleteExpressionTreeNodeAction.nodeId);
|
|
1207
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1208
|
-
trees: {
|
|
1209
|
-
[ngssmDeleteExpressionTreeNodeAction.treeId]: {
|
|
1210
|
-
nodes: { $apply: (values) => values.filter((v) => !nodeIdsToDelete.includes(v.data.id)) },
|
|
1211
|
-
data: { $unset: nodeIdsToDelete }
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
case NgssmExpressionTreeActionType.ngssmUpdateExpressionTreeNode: {
|
|
1217
|
-
const ngssmUpdateExpressionTreeNodeAction = action;
|
|
1218
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1219
|
-
trees: {
|
|
1220
|
-
[ngssmUpdateExpressionTreeNodeAction.treeId]: {
|
|
1221
|
-
data: {
|
|
1222
|
-
[ngssmUpdateExpressionTreeNodeAction.nodeId]: { $set: ngssmUpdateExpressionTreeNodeAction.data }
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
});
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
return state;
|
|
1230
|
-
}
|
|
1231
|
-
addNodeToList(node, nodeList) {
|
|
1232
|
-
if (node.parentId === undefined) {
|
|
1233
|
-
nodeList.push({
|
|
1234
|
-
path: [],
|
|
1235
|
-
data: node,
|
|
1236
|
-
isExpanded: true
|
|
1237
|
-
});
|
|
1238
|
-
return;
|
|
1239
|
-
}
|
|
1240
|
-
let parentNode;
|
|
1241
|
-
let insertionIndex = -1;
|
|
1242
|
-
for (let i = 0; i < nodeList.length; i++) {
|
|
1243
|
-
if (parentNode) {
|
|
1244
|
-
if (nodeList[i].path.includes(node.parentId)) {
|
|
1245
|
-
insertionIndex = i + 1;
|
|
1246
|
-
}
|
|
1247
|
-
else {
|
|
1248
|
-
break;
|
|
1249
|
-
}
|
|
1250
|
-
continue;
|
|
1251
|
-
}
|
|
1252
|
-
if (nodeList[i].data.id === node.parentId) {
|
|
1253
|
-
parentNode = nodeList[i];
|
|
1254
|
-
insertionIndex = i + 1;
|
|
1255
|
-
continue;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
if (!parentNode || insertionIndex === -1) {
|
|
1259
|
-
throw new Error('Invalid parent id');
|
|
1260
|
-
}
|
|
1261
|
-
nodeList.splice(insertionIndex, 0, {
|
|
1262
|
-
path: [...parentNode.path, parentNode.data.id],
|
|
1263
|
-
data: node,
|
|
1264
|
-
isExpanded: true
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeEditionReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1268
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeEditionReducer }); }
|
|
1269
|
-
}
|
|
1270
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: TreeNodeEditionReducer, decorators: [{
|
|
1271
|
-
type: Injectable
|
|
1272
|
-
}] });
|
|
1273
|
-
|
|
1274
|
-
class CutAndPasteReducer {
|
|
1275
|
-
constructor() {
|
|
1276
|
-
this.processedActions = [
|
|
1277
|
-
NgssmExpressionTreeActionType.ngssmCutExpressionTreeNode,
|
|
1278
|
-
NgssmExpressionTreeActionType.ngssmCancelCutExpressionTreeNode,
|
|
1279
|
-
NgssmExpressionTreeActionType.ngssmPasteExpressionTreeNode
|
|
1280
|
-
];
|
|
1281
|
-
}
|
|
1282
|
-
updateState(state, action) {
|
|
1283
|
-
switch (action.type) {
|
|
1284
|
-
case NgssmExpressionTreeActionType.ngssmCutExpressionTreeNode: {
|
|
1285
|
-
const ngssmCutExpressionTreeNodeAction = action;
|
|
1286
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1287
|
-
trees: {
|
|
1288
|
-
[ngssmCutExpressionTreeNodeAction.treeId]: {
|
|
1289
|
-
nodeCut: {
|
|
1290
|
-
$set: selectNgssmExpressionTreeState(state).trees[ngssmCutExpressionTreeNodeAction.treeId]?.nodes.find((n) => n.data.id === ngssmCutExpressionTreeNodeAction.nodeId)
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
case NgssmExpressionTreeActionType.ngssmCancelCutExpressionTreeNode: {
|
|
1297
|
-
const ngssmCancelCutExpressionTreeNodeAction = action;
|
|
1298
|
-
return this.resetCutAndPaste(state, ngssmCancelCutExpressionTreeNodeAction.treeId);
|
|
1299
|
-
}
|
|
1300
|
-
case NgssmExpressionTreeActionType.ngssmPasteExpressionTreeNode: {
|
|
1301
|
-
const ngssmPasteExpressionTreeNodeAction = action;
|
|
1302
|
-
const tree = selectNgssmExpressionTreeState(state).trees[ngssmPasteExpressionTreeNodeAction.treeId];
|
|
1303
|
-
const cutNode = tree.nodeCut;
|
|
1304
|
-
if (!cutNode) {
|
|
1305
|
-
return state;
|
|
1306
|
-
}
|
|
1307
|
-
const currentIndex = tree.nodes.findIndex((n) => n.data.id === cutNode.data.id);
|
|
1308
|
-
if (currentIndex === -1) {
|
|
1309
|
-
return this.resetCutAndPaste(state, ngssmPasteExpressionTreeNodeAction.treeId);
|
|
1310
|
-
}
|
|
1311
|
-
const targetNode = tree.nodes.find((n) => n.data.id === ngssmPasteExpressionTreeNodeAction.nodeId);
|
|
1312
|
-
if (!targetNode) {
|
|
1313
|
-
return this.resetCutAndPaste(state, ngssmPasteExpressionTreeNodeAction.treeId);
|
|
1314
|
-
}
|
|
1315
|
-
let targetIndex = tree.nodes.findIndex((n) => n.data.id === ngssmPasteExpressionTreeNodeAction.nodeId);
|
|
1316
|
-
if (ngssmPasteExpressionTreeNodeAction.target === 'Inside') {
|
|
1317
|
-
targetIndex = targetIndex + 1;
|
|
1318
|
-
}
|
|
1319
|
-
else {
|
|
1320
|
-
for (let index = targetIndex; index < tree.nodes.length; index++) {
|
|
1321
|
-
if (!(tree.nodes[index + 1]?.path ?? []).includes(ngssmPasteExpressionTreeNodeAction.nodeId)) {
|
|
1322
|
-
targetIndex = index + 1;
|
|
1323
|
-
break;
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
const newBasePath = ngssmPasteExpressionTreeNodeAction.target === 'After' ? targetNode.path : [...targetNode.path, targetNode.data.id];
|
|
1328
|
-
const pathPartsToRemove = cutNode.path.length;
|
|
1329
|
-
if (newBasePath === cutNode.path && currentIndex === targetIndex) {
|
|
1330
|
-
return this.resetCutAndPaste(state, ngssmPasteExpressionTreeNodeAction.treeId);
|
|
1331
|
-
}
|
|
1332
|
-
const movedNode = update(cutNode, {
|
|
1333
|
-
path: { $set: newBasePath },
|
|
1334
|
-
data: {
|
|
1335
|
-
parentId: { $set: ngssmPasteExpressionTreeNodeAction.target === 'After' ? targetNode.data.parentId : targetNode.data.id }
|
|
1336
|
-
}
|
|
1337
|
-
});
|
|
1338
|
-
const nodesToMove = tree.nodes
|
|
1339
|
-
.filter((n) => n.path.includes(cutNode.data.id))
|
|
1340
|
-
.map((node) => ({
|
|
1341
|
-
...node,
|
|
1342
|
-
path: [...newBasePath, ...node.path.slice(pathPartsToRemove)]
|
|
1343
|
-
}));
|
|
1344
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1345
|
-
trees: {
|
|
1346
|
-
[ngssmPasteExpressionTreeNodeAction.treeId]: {
|
|
1347
|
-
nodes: {
|
|
1348
|
-
$apply: (nodes) => {
|
|
1349
|
-
const output = [...nodes];
|
|
1350
|
-
if (targetIndex > currentIndex) {
|
|
1351
|
-
output.splice(targetIndex, 0, movedNode, ...nodesToMove);
|
|
1352
|
-
output.splice(currentIndex, nodesToMove.length + 1);
|
|
1353
|
-
return output;
|
|
1354
|
-
}
|
|
1355
|
-
output.splice(currentIndex, nodesToMove.length + 1);
|
|
1356
|
-
output.splice(targetIndex, 0, movedNode, ...nodesToMove);
|
|
1357
|
-
return output;
|
|
1358
|
-
}
|
|
1359
|
-
},
|
|
1360
|
-
nodeCut: { $set: undefined }
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
});
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
return state;
|
|
1367
|
-
}
|
|
1368
|
-
resetCutAndPaste(state, treeId) {
|
|
1369
|
-
return updateNgssmExpressionTreeState(state, {
|
|
1370
|
-
trees: {
|
|
1371
|
-
[treeId]: { $unset: ['nodeCut'] }
|
|
1372
|
-
}
|
|
1373
|
-
});
|
|
1374
|
-
}
|
|
1375
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: CutAndPasteReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1376
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: CutAndPasteReducer }); }
|
|
1377
|
-
}
|
|
1378
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: CutAndPasteReducer, decorators: [{
|
|
1379
|
-
type: Injectable
|
|
1380
|
-
}] });
|
|
1381
|
-
|
|
1382
|
-
const provideNgssmExpressionTree = () => {
|
|
1383
|
-
return makeEnvironmentProviders([provideReducers(CutAndPasteReducer, TreeNodeEditionReducer, TreeNodeExpandReducer, TreesReducer)]);
|
|
1384
|
-
};
|
|
1385
|
-
|
|
1386
|
-
const getDefaultCutAndPaste = () => ({
|
|
1387
|
-
isCutAndPasteInProgress: false,
|
|
1388
|
-
isPartOfCut: false,
|
|
1389
|
-
canCut: false,
|
|
1390
|
-
canPasteInside: false,
|
|
1391
|
-
canPasteAfter: false
|
|
1392
|
-
});
|
|
1393
|
-
class NgssmExpressionTreeNodeComponent {
|
|
1394
|
-
constructor() {
|
|
1395
|
-
this.nodeId = input(...(ngDevMode ? [undefined, { debugName: "nodeId" }] : []));
|
|
1396
|
-
this.treeConfig = input(undefined, ...(ngDevMode ? [{ debugName: "treeConfig" }] : []));
|
|
1397
|
-
this.nodeLabel = signal('', ...(ngDevMode ? [{ debugName: "nodeLabel" }] : []));
|
|
1398
|
-
this.nodeCssIcon = signal(undefined, ...(ngDevMode ? [{ debugName: "nodeCssIcon" }] : []));
|
|
1399
|
-
this.nodeDescription = signal(undefined, ...(ngDevMode ? [{ debugName: "nodeDescription" }] : []));
|
|
1400
|
-
this.cutAndPaste = signal(getDefaultCutAndPaste(), ...(ngDevMode ? [{ debugName: "cutAndPaste" }] : []));
|
|
1401
|
-
this.componentAction = signal(undefined, ...(ngDevMode ? [{ debugName: "componentAction" }] : []));
|
|
1402
|
-
this.componentToDisplay = signal(undefined, ...(ngDevMode ? [{ debugName: "componentToDisplay" }] : []));
|
|
1403
|
-
this.store = inject(Store);
|
|
1404
|
-
this.trees = createSignal((state) => selectNgssmExpressionTreeState(state).trees);
|
|
1405
|
-
this.tree = signal(undefined, ...(ngDevMode ? [{ debugName: "tree" }] : []));
|
|
1406
|
-
effect(() => {
|
|
1407
|
-
const currentNodeId = this.nodeId();
|
|
1408
|
-
const config = this.treeConfig();
|
|
1409
|
-
if (!currentNodeId || !config) {
|
|
1410
|
-
this.tree.set(undefined);
|
|
1411
|
-
return;
|
|
1412
|
-
}
|
|
1413
|
-
this.tree.set(this.trees()[config.treeId]);
|
|
1414
|
-
});
|
|
1415
|
-
effect(() => {
|
|
1416
|
-
const currentNodeId = this.nodeId();
|
|
1417
|
-
const config = this.treeConfig();
|
|
1418
|
-
if (!currentNodeId || !config) {
|
|
1419
|
-
return;
|
|
1420
|
-
}
|
|
1421
|
-
this.componentAction.set((c) => c.setup(config.treeId, currentNodeId));
|
|
1422
|
-
this.componentToDisplay.set(config.nodeDescriptionComponent);
|
|
1423
|
-
});
|
|
1424
|
-
effect(() => {
|
|
1425
|
-
const currentTree = this.tree();
|
|
1426
|
-
const currentNodeId = untracked(() => this.nodeId());
|
|
1427
|
-
const currentConfig = untracked(() => this.treeConfig());
|
|
1428
|
-
if (!currentNodeId || !currentTree || !currentConfig) {
|
|
1429
|
-
return;
|
|
1430
|
-
}
|
|
1431
|
-
const node = currentTree.nodes.find((v) => v.data.id === currentNodeId);
|
|
1432
|
-
const nodeValue = currentTree.data[currentNodeId];
|
|
1433
|
-
const cutAndPaste = getDefaultCutAndPaste();
|
|
1434
|
-
const nodeCut = currentTree.nodeCut;
|
|
1435
|
-
if (node && currentConfig && nodeValue) {
|
|
1436
|
-
this.nodeLabel.set(currentConfig.getNodeLabel?.(node, nodeValue) ?? '');
|
|
1437
|
-
this.nodeCssIcon.set(currentConfig.getNodeCssIcon?.(node, nodeValue) ?? undefined);
|
|
1438
|
-
this.nodeDescription.set(currentConfig.getNodeDescription?.(node, nodeValue));
|
|
1439
|
-
cutAndPaste.canCut = currentConfig.canCut?.(node) ?? true;
|
|
1440
|
-
if (nodeCut) {
|
|
1441
|
-
cutAndPaste.isPartOfCut = nodeCut.data.id === node.data.id || node.path.includes(nodeCut.data.id);
|
|
1442
|
-
if (!cutAndPaste.isPartOfCut) {
|
|
1443
|
-
cutAndPaste.canPasteInside = currentConfig.canPaste?.(nodeCut, node, 'Inside') ?? false;
|
|
1444
|
-
cutAndPaste.canPasteAfter = currentConfig.canPaste?.(nodeCut, node, 'After') ?? false;
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
cutAndPaste.isCutAndPasteInProgress = !!nodeCut;
|
|
1449
|
-
this.cutAndPaste.set(cutAndPaste);
|
|
1450
|
-
});
|
|
1451
|
-
}
|
|
1452
|
-
expandAll() {
|
|
1453
|
-
const treeId = this.treeConfig()?.treeId;
|
|
1454
|
-
if (treeId) {
|
|
1455
|
-
this.store.dispatchAction(new NgssmExpandAllExpressionTreeNodesAction(treeId));
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
collapseAll() {
|
|
1459
|
-
const treeId = this.treeConfig()?.treeId;
|
|
1460
|
-
if (treeId) {
|
|
1461
|
-
this.store.dispatchAction(new NgssmCollapseAllExpressionTreeNodesAction(treeId));
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
cut() {
|
|
1465
|
-
const treeId = this.treeConfig()?.treeId;
|
|
1466
|
-
const nodeId = this.nodeId();
|
|
1467
|
-
if (treeId && nodeId) {
|
|
1468
|
-
this.store.dispatchAction(new NgssmCutExpressionTreeNodeAction(treeId, nodeId));
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
cancelCut() {
|
|
1472
|
-
const treeId = this.treeConfig()?.treeId;
|
|
1473
|
-
if (treeId) {
|
|
1474
|
-
this.store.dispatchAction(new NgssmCancelCutExpressionTreeNodeAction(treeId));
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
paste(target) {
|
|
1478
|
-
const treeId = this.treeConfig()?.treeId;
|
|
1479
|
-
const nodeId = this.nodeId();
|
|
1480
|
-
if (treeId && nodeId) {
|
|
1481
|
-
this.store.dispatchAction(new NgssmPasteExpressionTreeNodeAction(treeId, nodeId, target));
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmExpressionTreeNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1485
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: NgssmExpressionTreeNodeComponent, isStandalone: true, selector: "ngssm-expression-tree-node", inputs: { nodeId: { classPropertyName: "nodeId", publicName: "nodeId", isSignal: true, isRequired: false, transformFunction: null }, treeConfig: { classPropertyName: "treeConfig", publicName: "treeConfig", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (nodeCssIcon(); as css) {\n <div class=\"ngssm-expression-tree-node-icon\" id=\"treeNodeIcon\">\n <mat-icon class=\"{{ css }}\"></mat-icon>\n </div>\n}\n\n<div\n class=\"ngssm-expression-tree-node-label\"\n [matMenuTriggerFor]=\"contextMenu\"\n [class.ngssm-expression-tree-node-to-cut]=\"cutAndPaste().isPartOfCut === true\"\n id=\"treeNodeLabel\">\n {{ nodeLabel() }}\n</div>\n\n<div class=\"ngssm-expression-tree-node-description\" [innerHTML]=\"nodeDescription()\"></div>\n\n@let component = componentToDisplay();\n@if (component) {\n <div\n class=\"ngssm-expression-tree-node-description-component\"\n [ngssmComponentDisplay]=\"component\"\n [ngssmComponentAction]=\"componentAction()\"></div>\n}\n\n<mat-menu #contextMenu=\"matMenu\" [class]=\"'ngssm-expression-tree-popup-menu'\">\n @let cutAndPasteSetup = cutAndPaste();\n @if (treeConfig()?.displayCutAndPasteMenus === true && cutAndPasteSetup) {\n <div class=\"flex-column-stretch\">\n @if (cutAndPasteSetup.isCutAndPasteInProgress === false) {\n <button mat-menu-item (click)=\"cut()\" [disabled]=\"cutAndPasteSetup.canCut !== true\">\n <mat-icon class=\"fa-solid fa-scissors\"></mat-icon>\n <span>Cut</span>\n </button>\n } @else {\n <button mat-menu-item (click)=\"cancelCut()\">\n <mat-icon class=\"fa-solid fa-slash\"></mat-icon>\n <span>Cancel cut</span>\n </button>\n }\n\n <button mat-menu-item [disabled]=\"cutAndPasteSetup.canPasteInside !== true\" (click)=\"paste('Inside')\">\n <mat-icon class=\"fa-solid fa-paste\"></mat-icon>\n <span>Paste inside</span>\n </button>\n <button mat-menu-item [disabled]=\"cutAndPasteSetup.canPasteAfter !== true\" (click)=\"paste('After')\">\n <mat-icon class=\"fa-solid fa-paste\"></mat-icon>\n <span>Paste after</span>\n </button>\n <mat-divider></mat-divider>\n </div>\n }\n\n <button mat-menu-item (click)=\"expandAll()\">\n <mat-icon class=\"fa-solid fa-up-right-and-down-left-from-center\"></mat-icon>\n <span>Expand all</span>\n </button>\n <button mat-menu-item (click)=\"collapseAll()\">\n <mat-icon class=\"fa-solid fa-down-left-and-up-right-to-center\"></mat-icon>\n <span>Collapse all</span>\n </button>\n</mat-menu>\n", styles: [":host{display:flex;flex-direction:row;align-items:center;flex:1}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i2$3.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i2$3.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2$3.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i3$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: NgssmComponentDisplayDirective, selector: "[ngssmComponentDisplay]", inputs: ["ngssmComponentDisplay", "ngssmComponentAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1486
|
-
}
|
|
1487
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmExpressionTreeNodeComponent, decorators: [{
|
|
1488
|
-
type: Component,
|
|
1489
|
-
args: [{ selector: 'ngssm-expression-tree-node', imports: [MatIconModule, MatMenuModule, MatDividerModule, NgssmComponentDisplayDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (nodeCssIcon(); as css) {\n <div class=\"ngssm-expression-tree-node-icon\" id=\"treeNodeIcon\">\n <mat-icon class=\"{{ css }}\"></mat-icon>\n </div>\n}\n\n<div\n class=\"ngssm-expression-tree-node-label\"\n [matMenuTriggerFor]=\"contextMenu\"\n [class.ngssm-expression-tree-node-to-cut]=\"cutAndPaste().isPartOfCut === true\"\n id=\"treeNodeLabel\">\n {{ nodeLabel() }}\n</div>\n\n<div class=\"ngssm-expression-tree-node-description\" [innerHTML]=\"nodeDescription()\"></div>\n\n@let component = componentToDisplay();\n@if (component) {\n <div\n class=\"ngssm-expression-tree-node-description-component\"\n [ngssmComponentDisplay]=\"component\"\n [ngssmComponentAction]=\"componentAction()\"></div>\n}\n\n<mat-menu #contextMenu=\"matMenu\" [class]=\"'ngssm-expression-tree-popup-menu'\">\n @let cutAndPasteSetup = cutAndPaste();\n @if (treeConfig()?.displayCutAndPasteMenus === true && cutAndPasteSetup) {\n <div class=\"flex-column-stretch\">\n @if (cutAndPasteSetup.isCutAndPasteInProgress === false) {\n <button mat-menu-item (click)=\"cut()\" [disabled]=\"cutAndPasteSetup.canCut !== true\">\n <mat-icon class=\"fa-solid fa-scissors\"></mat-icon>\n <span>Cut</span>\n </button>\n } @else {\n <button mat-menu-item (click)=\"cancelCut()\">\n <mat-icon class=\"fa-solid fa-slash\"></mat-icon>\n <span>Cancel cut</span>\n </button>\n }\n\n <button mat-menu-item [disabled]=\"cutAndPasteSetup.canPasteInside !== true\" (click)=\"paste('Inside')\">\n <mat-icon class=\"fa-solid fa-paste\"></mat-icon>\n <span>Paste inside</span>\n </button>\n <button mat-menu-item [disabled]=\"cutAndPasteSetup.canPasteAfter !== true\" (click)=\"paste('After')\">\n <mat-icon class=\"fa-solid fa-paste\"></mat-icon>\n <span>Paste after</span>\n </button>\n <mat-divider></mat-divider>\n </div>\n }\n\n <button mat-menu-item (click)=\"expandAll()\">\n <mat-icon class=\"fa-solid fa-up-right-and-down-left-from-center\"></mat-icon>\n <span>Expand all</span>\n </button>\n <button mat-menu-item (click)=\"collapseAll()\">\n <mat-icon class=\"fa-solid fa-down-left-and-up-right-to-center\"></mat-icon>\n <span>Collapse all</span>\n </button>\n</mat-menu>\n", styles: [":host{display:flex;flex-direction:row;align-items:center;flex:1}\n"] }]
|
|
1490
|
-
}], ctorParameters: () => [], propDecorators: { nodeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeId", required: false }] }], treeConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeConfig", required: false }] }] } });
|
|
1491
|
-
|
|
1492
|
-
class NgssmExpressionTreeNodeDetailsComponent {
|
|
1493
|
-
constructor() {
|
|
1494
|
-
this.nodeId = input(...(ngDevMode ? [undefined, { debugName: "nodeId" }] : []));
|
|
1495
|
-
this.treeConfig = input(...(ngDevMode ? [undefined, { debugName: "treeConfig" }] : []));
|
|
1496
|
-
this.heightChanged = output();
|
|
1497
|
-
this.componentAction = signal(undefined, ...(ngDevMode ? [{ debugName: "componentAction" }] : []));
|
|
1498
|
-
this.componentToDisplay = signal(undefined, ...(ngDevMode ? [{ debugName: "componentToDisplay" }] : []));
|
|
1499
|
-
this.elementRef = inject(ElementRef);
|
|
1500
|
-
effect(() => {
|
|
1501
|
-
const currentNodeId = this.nodeId();
|
|
1502
|
-
const currentConfig = this.treeConfig();
|
|
1503
|
-
if (!currentNodeId || !currentConfig) {
|
|
1504
|
-
return;
|
|
1505
|
-
}
|
|
1506
|
-
this.componentAction.set((c) => c.setup(currentConfig.treeId, currentNodeId));
|
|
1507
|
-
this.componentToDisplay.set(currentConfig.nodeDetailComponent);
|
|
1508
|
-
setTimeout(() => {
|
|
1509
|
-
this.heightChanged.emit(this.elementRef?.nativeElement.getBoundingClientRect().height ?? 0);
|
|
1510
|
-
});
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmExpressionTreeNodeDetailsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1514
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: NgssmExpressionTreeNodeDetailsComponent, isStandalone: true, selector: "ngssm-expression-tree-node-details", inputs: { nodeId: { classPropertyName: "nodeId", publicName: "nodeId", isSignal: true, isRequired: false, transformFunction: null }, treeConfig: { classPropertyName: "treeConfig", publicName: "treeConfig", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { heightChanged: "heightChanged" }, ngImport: i0, template: "@if (componentToDisplay(); as component) {\n <div [ngssmComponentDisplay]=\"component\" [ngssmComponentAction]=\"componentAction()\"></div>\n}\n", styles: [""], dependencies: [{ kind: "directive", type: NgssmComponentDisplayDirective, selector: "[ngssmComponentDisplay]", inputs: ["ngssmComponentDisplay", "ngssmComponentAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1515
|
-
}
|
|
1516
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmExpressionTreeNodeDetailsComponent, decorators: [{
|
|
1517
|
-
type: Component,
|
|
1518
|
-
args: [{ selector: 'ngssm-expression-tree-node-details', imports: [NgssmComponentDisplayDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (componentToDisplay(); as component) {\n <div [ngssmComponentDisplay]=\"component\" [ngssmComponentAction]=\"componentAction()\"></div>\n}\n" }]
|
|
1519
|
-
}], ctorParameters: () => [], propDecorators: { nodeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeId", required: false }] }], treeConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeConfig", required: false }] }], heightChanged: [{ type: i0.Output, args: ["heightChanged"] }] } });
|
|
1520
|
-
|
|
1521
|
-
class NgssmExpressionTreeComponent {
|
|
1522
|
-
constructor() {
|
|
1523
|
-
this.treeConfig = input(undefined, ...(ngDevMode ? [{ debugName: "treeConfig", transform: (value) => {
|
|
1524
|
-
if (!value) {
|
|
1525
|
-
return value;
|
|
1526
|
-
}
|
|
1527
|
-
const config = {
|
|
1528
|
-
...value
|
|
1529
|
-
};
|
|
1530
|
-
if (!config.getNodeLabel) {
|
|
1531
|
-
config.getNodeLabel = (node) => node.data.id;
|
|
1532
|
-
}
|
|
1533
|
-
if (!config.expandIconClass) {
|
|
1534
|
-
config.expandIconClass = 'fa-solid fa-chevron-right';
|
|
1535
|
-
}
|
|
1536
|
-
if (!config.collapseIconClass) {
|
|
1537
|
-
config.collapseIconClass = 'fa-solid fa-chevron-down';
|
|
1538
|
-
}
|
|
1539
|
-
return config;
|
|
1540
|
-
} }] : [{
|
|
1541
|
-
transform: (value) => {
|
|
1542
|
-
if (!value) {
|
|
1543
|
-
return value;
|
|
1544
|
-
}
|
|
1545
|
-
const config = {
|
|
1546
|
-
...value
|
|
1547
|
-
};
|
|
1548
|
-
if (!config.getNodeLabel) {
|
|
1549
|
-
config.getNodeLabel = (node) => node.data.id;
|
|
1550
|
-
}
|
|
1551
|
-
if (!config.expandIconClass) {
|
|
1552
|
-
config.expandIconClass = 'fa-solid fa-chevron-right';
|
|
1553
|
-
}
|
|
1554
|
-
if (!config.collapseIconClass) {
|
|
1555
|
-
config.collapseIconClass = 'fa-solid fa-chevron-down';
|
|
1556
|
-
}
|
|
1557
|
-
return config;
|
|
1558
|
-
}
|
|
1559
|
-
}]));
|
|
1560
|
-
this.displayedNodes = signal([], ...(ngDevMode ? [{ debugName: "displayedNodes" }] : []));
|
|
1561
|
-
this.store = inject(Store);
|
|
1562
|
-
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
1563
|
-
this.trees = createSignal((state) => selectNgssmExpressionTreeState(state).trees);
|
|
1564
|
-
effect(() => {
|
|
1565
|
-
const config = this.treeConfig();
|
|
1566
|
-
if (!config) {
|
|
1567
|
-
this.displayedNodes.set([]);
|
|
1568
|
-
return;
|
|
1569
|
-
}
|
|
1570
|
-
const nodes = [];
|
|
1571
|
-
const collapsedNodes = new Set();
|
|
1572
|
-
(this.trees()[config.treeId]?.nodes ?? []).forEach((node) => {
|
|
1573
|
-
if (node.data.isExpandable === true && node.isExpanded === false) {
|
|
1574
|
-
collapsedNodes.add(node.data.id);
|
|
1575
|
-
}
|
|
1576
|
-
if (!node.data.parentId || node.path.findIndex((p) => collapsedNodes.has(p)) === -1) {
|
|
1577
|
-
nodes.push(node);
|
|
1578
|
-
}
|
|
1579
|
-
});
|
|
1580
|
-
this.displayedNodes.set(nodes);
|
|
1581
|
-
});
|
|
1582
|
-
}
|
|
1583
|
-
getItemId(_, node) {
|
|
1584
|
-
return node.data.id;
|
|
1585
|
-
}
|
|
1586
|
-
expand(node) {
|
|
1587
|
-
const treeId = this.treeConfig()?.treeId;
|
|
1588
|
-
if (treeId) {
|
|
1589
|
-
this.store.dispatchAction(new NgssmExpandExpressionTreeNodeAction(treeId, node.data.id));
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
collapse(node) {
|
|
1593
|
-
const treeId = this.treeConfig()?.treeId;
|
|
1594
|
-
if (treeId) {
|
|
1595
|
-
this.store.dispatchAction(new NgssmCollapseExpressionTreeNodeAction(treeId, node.data.id));
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
forceRefresh() {
|
|
1599
|
-
this.changeDetectorRef.markForCheck();
|
|
1600
|
-
}
|
|
1601
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmExpressionTreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1602
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: NgssmExpressionTreeComponent, isStandalone: true, selector: "ngssm-expression-tree", inputs: { treeConfig: { classPropertyName: "treeConfig", publicName: "treeConfig", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let defaultPadding = treeConfig()?.nodePadding ?? 20;\n\n<mat-card class=\"flex-column-stretch fxFlex ngssm-expression-tree\">\n @if (treeConfig(); as config) {\n <mat-card-content class=\"flex-column-stretch fxFlex ngssm-expression-tree-content\">\n @if (config.disableVirtualization) {\n <div class=\"ngssm-expression-tree-nodes-container\">\n @for (item of displayedNodes(); track item.data.id) {\n <div class=\"ngssm-expression-tree-node\" id=\"{{ 'node_' + item.data.id }}\">\n <ng-container *ngTemplateOutlet=\"nodeTemplate; context: { config, item }\"></ng-container>\n </div>\n }\n </div>\n } @else {\n <cdk-virtual-scroll-viewport [itemSize]=\"config.rowSize ?? 30\" class=\"fxFlex\">\n <div\n *cdkVirtualFor=\"let item of displayedNodes(); trackBy: getItemId\"\n class=\"ngssm-expression-tree-node\"\n id=\"{{ 'node_' + item.data.id }}\">\n <ng-container *ngTemplateOutlet=\"nodeTemplate; context: { config, item }\"></ng-container>\n </div>\n </cdk-virtual-scroll-viewport>\n }\n </mat-card-content>\n }\n</mat-card>\n\n<ng-template #nodeTemplate let-config=\"config\" let-item=\"item\">\n <div class=\"flex-row-center fxFlex\" [style.height.px]=\"config.rowSize ?? 30\">\n @for (part of item.path; track part) {\n <mat-divider\n [vertical]=\"true\"\n class=\"ngssm-expression-tree-node-divider\"\n [style.height.px]=\"config.rowSize ?? 30\"\n [style.margin-right.px]=\"defaultPadding\">\n </mat-divider>\n }\n @if ((item.data.isExpandable || item.data.hasRowDetail) && item.isExpanded === false) {\n <mat-icon class=\"{{ config.expandIconClass }}\" (click)=\"$event.stopPropagation(); expand(item)\" id=\"expandIcon\"> </mat-icon>\n }\n\n @if ((item.data.isExpandable || item.data.hasRowDetail) && item.isExpanded === true) {\n <mat-icon class=\"{{ config.collapseIconClass }}\" (click)=\"$event.stopPropagation(); collapse(item)\" id=\"collapseIcon\"> </mat-icon>\n }\n\n <ngssm-expression-tree-node [nodeId]=\"item.data.id\" [treeConfig]=\"config\"> </ngssm-expression-tree-node>\n </div>\n @if (item.data.hasRowDetail === true && item.isExpanded === true) {\n <div class=\"flex-row-center fxFlex\">\n @for (part of item.path; track part) {\n <mat-divider\n [vertical]=\"true\"\n class=\"ngssm-expression-tree-node-divider\"\n [style.height.px]=\"detailContainer.getBoundingClientRect().height\"\n [style.margin-right.px]=\"defaultPadding\">\n </mat-divider>\n }\n\n <div #detailContainer class=\"ngssm-expression-tree-node-detail-component\">\n <ngssm-expression-tree-node-details [nodeId]=\"item.data.id\" [treeConfig]=\"config\" (heightChanged)=\"forceRefresh()\">\n </ngssm-expression-tree-node-details>\n </div>\n </div>\n }\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i2.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i2.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i2.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { kind: "component", type: MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: NgssmExpressionTreeNodeComponent, selector: "ngssm-expression-tree-node", inputs: ["nodeId", "treeConfig"] }, { kind: "component", type: NgssmExpressionTreeNodeDetailsComponent, selector: "ngssm-expression-tree-node-details", inputs: ["nodeId", "treeConfig"], outputs: ["heightChanged"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1603
|
-
}
|
|
1604
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmExpressionTreeComponent, decorators: [{
|
|
1605
|
-
type: Component,
|
|
1606
|
-
args: [{ selector: 'ngssm-expression-tree', imports: [
|
|
1607
|
-
CommonModule,
|
|
1608
|
-
ScrollingModule,
|
|
1609
|
-
MatCard,
|
|
1610
|
-
MatCardContent,
|
|
1611
|
-
MatDivider,
|
|
1612
|
-
MatIcon,
|
|
1613
|
-
NgssmExpressionTreeNodeComponent,
|
|
1614
|
-
NgssmExpressionTreeNodeDetailsComponent
|
|
1615
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let defaultPadding = treeConfig()?.nodePadding ?? 20;\n\n<mat-card class=\"flex-column-stretch fxFlex ngssm-expression-tree\">\n @if (treeConfig(); as config) {\n <mat-card-content class=\"flex-column-stretch fxFlex ngssm-expression-tree-content\">\n @if (config.disableVirtualization) {\n <div class=\"ngssm-expression-tree-nodes-container\">\n @for (item of displayedNodes(); track item.data.id) {\n <div class=\"ngssm-expression-tree-node\" id=\"{{ 'node_' + item.data.id }}\">\n <ng-container *ngTemplateOutlet=\"nodeTemplate; context: { config, item }\"></ng-container>\n </div>\n }\n </div>\n } @else {\n <cdk-virtual-scroll-viewport [itemSize]=\"config.rowSize ?? 30\" class=\"fxFlex\">\n <div\n *cdkVirtualFor=\"let item of displayedNodes(); trackBy: getItemId\"\n class=\"ngssm-expression-tree-node\"\n id=\"{{ 'node_' + item.data.id }}\">\n <ng-container *ngTemplateOutlet=\"nodeTemplate; context: { config, item }\"></ng-container>\n </div>\n </cdk-virtual-scroll-viewport>\n }\n </mat-card-content>\n }\n</mat-card>\n\n<ng-template #nodeTemplate let-config=\"config\" let-item=\"item\">\n <div class=\"flex-row-center fxFlex\" [style.height.px]=\"config.rowSize ?? 30\">\n @for (part of item.path; track part) {\n <mat-divider\n [vertical]=\"true\"\n class=\"ngssm-expression-tree-node-divider\"\n [style.height.px]=\"config.rowSize ?? 30\"\n [style.margin-right.px]=\"defaultPadding\">\n </mat-divider>\n }\n @if ((item.data.isExpandable || item.data.hasRowDetail) && item.isExpanded === false) {\n <mat-icon class=\"{{ config.expandIconClass }}\" (click)=\"$event.stopPropagation(); expand(item)\" id=\"expandIcon\"> </mat-icon>\n }\n\n @if ((item.data.isExpandable || item.data.hasRowDetail) && item.isExpanded === true) {\n <mat-icon class=\"{{ config.collapseIconClass }}\" (click)=\"$event.stopPropagation(); collapse(item)\" id=\"collapseIcon\"> </mat-icon>\n }\n\n <ngssm-expression-tree-node [nodeId]=\"item.data.id\" [treeConfig]=\"config\"> </ngssm-expression-tree-node>\n </div>\n @if (item.data.hasRowDetail === true && item.isExpanded === true) {\n <div class=\"flex-row-center fxFlex\">\n @for (part of item.path; track part) {\n <mat-divider\n [vertical]=\"true\"\n class=\"ngssm-expression-tree-node-divider\"\n [style.height.px]=\"detailContainer.getBoundingClientRect().height\"\n [style.margin-right.px]=\"defaultPadding\">\n </mat-divider>\n }\n\n <div #detailContainer class=\"ngssm-expression-tree-node-detail-component\">\n <ngssm-expression-tree-node-details [nodeId]=\"item.data.id\" [treeConfig]=\"config\" (heightChanged)=\"forceRefresh()\">\n </ngssm-expression-tree-node-details>\n </div>\n </div>\n }\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column}\n"] }]
|
|
1616
|
-
}], ctorParameters: () => [], propDecorators: { treeConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeConfig", required: false }] }] } });
|
|
1617
|
-
|
|
1618
863
|
/*
|
|
1619
864
|
* Public API Surface of ngssm-tree
|
|
1620
865
|
*/
|
|
@@ -1623,5 +868,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
|
|
|
1623
868
|
* Generated bundle index. Do not edit.
|
|
1624
869
|
*/
|
|
1625
870
|
|
|
1626
|
-
export { CollapseNodeAction, DeleteNgssmTreeAction, DisplaySearchDialogAction, ExpandNodeAction, InitNgssmTreeAction, LoadChildrenOfNodeAction, NGSSM_TREE_DATA_SERVICE,
|
|
871
|
+
export { CollapseNodeAction, DeleteNgssmTreeAction, DisplaySearchDialogAction, ExpandNodeAction, InitNgssmTreeAction, LoadChildrenOfNodeAction, NGSSM_TREE_DATA_SERVICE, NgssmBreadcrumbComponent, NgssmTreeActionType, NgssmTreeComponent, NgssmTreeSearchDialogComponent, NgssmTreeStateSpecification, RegisterNodesAction, RegisterPartialSearchResultsAction, SearchStatus, SearchTreeNodesAction, SelectNodeAction, TreeAction, TreeNodeAction, getDefaultTreeNodesSearch, getNgssmTreeNodeFullPath, getNgssmTreePath, provideNgssmTree, selectNgssmTreeNode, selectNgssmTreeNodeChildren, selectNgssmTreeState, updateNgssmTreeState };
|
|
1627
872
|
//# sourceMappingURL=ngssm-tree.mjs.map
|