@processpuzzle/base-entity 0.6.3 → 0.7.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.
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, Component, computed, effect, Inject, Directive,
|
|
2
|
+
import { inject, input, Component, computed, effect, InjectionToken, Inject, Directive, Injector, signal, HostBinding, Injectable, EventEmitter, Output, ViewChild, DestroyRef, untracked, isDevMode, runInInjectionContext } from '@angular/core';
|
|
3
3
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
4
|
import * as i1 from '@angular/common';
|
|
5
5
|
import { CommonModule, NgClass, NgStyle, NgIf, NgForOf, SlicePipe } from '@angular/common';
|
|
6
6
|
import { NavigationEnd, Router, ActivatedRoute, RouterOutlet, ROUTER_OUTLET_DATA } from '@angular/router';
|
|
7
7
|
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
|
8
|
-
import
|
|
8
|
+
import * as i2 from '@angular/material/toolbar';
|
|
9
|
+
import { MatToolbarModule, MatToolbar } from '@angular/material/toolbar';
|
|
9
10
|
import { MatIcon } from '@angular/material/icon';
|
|
10
11
|
import { MatButton, MatIconButton } from '@angular/material/button';
|
|
11
12
|
import * as i3 from '@angular/material/form-field';
|
|
12
|
-
import { MatFormField, MatFormFieldModule, MatLabel,
|
|
13
|
+
import { MatFormField, MatSuffix, MatFormFieldModule, MatLabel, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
13
14
|
import * as i4 from '@angular/material/input';
|
|
14
15
|
import { MatInput, MatInputModule } from '@angular/material/input';
|
|
15
16
|
import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
|
16
17
|
import { signalStore, withState, withMethods, patchState, withHooks, signalStoreFeature, withProps, watchState, withComputed } from '@ngrx/signals';
|
|
17
18
|
import { Stack, LayoutService, RUNTIME_CONFIGURATION } from '@processpuzzle/util';
|
|
18
19
|
import { __decorate, __param } from 'tslib';
|
|
19
|
-
import { map, filter, switchMap,
|
|
20
|
+
import { map, filter, switchMap, from, of, firstValueFrom, pipe, tap } from 'rxjs';
|
|
20
21
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
21
22
|
import { buildUrl } from 'build-url-ts';
|
|
22
23
|
import * as i1$1 from '@angular/forms';
|
|
23
24
|
import { ReactiveFormsModule, FormsModule, FormControl, Validators, FormBuilder } from '@angular/forms';
|
|
24
25
|
import { MatCard, MatCardContent, MatCardActions } from '@angular/material/card';
|
|
26
|
+
import { NGXLogger } from 'ngx-logging-kit';
|
|
27
|
+
import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
25
28
|
import { MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose, MatDialog } from '@angular/material/dialog';
|
|
26
29
|
import { TranslocoService, provideTranslocoScope } from '@jsverse/transloco';
|
|
27
30
|
import * as i5 from '@angular/material/datepicker';
|
|
28
31
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
29
|
-
import * as i2 from '@angular/material/select';
|
|
32
|
+
import * as i2$1 from '@angular/material/select';
|
|
30
33
|
import { MatSelectModule } from '@angular/material/select';
|
|
31
34
|
import { MatCheckbox } from '@angular/material/checkbox';
|
|
32
35
|
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
33
36
|
import { MatChipGrid, MatChipRow, MatChipInput, MatChipRemove } from '@angular/material/chips';
|
|
34
|
-
import
|
|
35
|
-
import * as i2$1 from '@angular/material/autocomplete';
|
|
37
|
+
import * as i2$2 from '@angular/material/autocomplete';
|
|
36
38
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
37
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
38
39
|
import { MatTableDataSource, MatTable, MatHeaderCell, MatHeaderRow, MatRow, MatCell, MatColumnDef, MatHeaderCellDef, MatCellDef, MatHeaderRowDef, MatRowDef } from '@angular/material/table';
|
|
39
40
|
import { MatSort, MatSortHeader } from '@angular/material/sort';
|
|
40
41
|
import { MatPaginator } from '@angular/material/paginator';
|
|
41
42
|
import { MatProgressBar } from '@angular/material/progress-bar';
|
|
42
43
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
44
|
+
import { Firestore, collection, doc, deleteDoc, getDoc, setDoc, orderBy, where, query, limit, getDocs, updateDoc } from '@angular/fire/firestore';
|
|
43
45
|
import { withDevtools } from '@angular-architects/ngrx-toolkit';
|
|
44
46
|
import { tapResponse } from '@ngrx/operators';
|
|
45
47
|
import { rxMethod } from '@ngrx/signals/rxjs-interop';
|
|
46
|
-
import { Firestore, collection, doc, deleteDoc, getDoc, setDoc, orderBy, where, query, limit, getDocs, updateDoc } from '@angular/fire/firestore';
|
|
47
48
|
import 'reflect-metadata';
|
|
48
49
|
|
|
49
50
|
var FormControlType;
|
|
@@ -335,12 +336,21 @@ class BaseEntityToolbarComponent {
|
|
|
335
336
|
this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, BaseUrlSegments.NewEntity);
|
|
336
337
|
}
|
|
337
338
|
onDeleteEntities() {
|
|
338
|
-
this.store.selectedEntities().forEach((entity) => this.store.delete(entity.id));
|
|
339
|
+
this.store.selectedEntities().forEach((entity) => void this.store.delete(entity.id));
|
|
340
|
+
}
|
|
341
|
+
onEditEntity() {
|
|
342
|
+
const entityId = this.store.currentEntity().id;
|
|
343
|
+
this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, entityId);
|
|
339
344
|
}
|
|
340
345
|
onDoFilter($event) {
|
|
341
346
|
const filterValue = $event.target.value;
|
|
342
347
|
this.store.doFilter(filterValue);
|
|
343
348
|
}
|
|
349
|
+
onClearFilter(input) {
|
|
350
|
+
input.value = '';
|
|
351
|
+
this.store.doFilter('');
|
|
352
|
+
this.store.load({});
|
|
353
|
+
}
|
|
344
354
|
// endregion
|
|
345
355
|
// public queries and mutators
|
|
346
356
|
isSmallDevice() {
|
|
@@ -349,12 +359,12 @@ class BaseEntityToolbarComponent {
|
|
|
349
359
|
// endregion
|
|
350
360
|
// protected, private helper methods
|
|
351
361
|
RouteSegments = RouteSegments;
|
|
352
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
353
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
362
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
363
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: BaseEntityToolbarComponent, isStandalone: true, selector: "base-entity-toolbar", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"formNavigator.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input #filterInput [attr.data-testid]=\"entityDescriptor().createTestId('filter')\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\n @if (filterInput.value) {\n <button [attr.data-testid]=\"entityDescriptor().createTestId('filter-clear')\" type=\"button\" mat-icon-button matSuffix aria-label=\"Clear filter\" (click)=\"onClearFilter(filterInput)\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n </mat-form-field>\n </div>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-menu-item [disabled]=\"store.selectedEntities().length != 1\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-menu-item [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-button [disabled]=\"store.selectedEntities().length != 1\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: 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: "component", type: 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: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: 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: MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }] });
|
|
354
364
|
}
|
|
355
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
365
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
|
|
356
366
|
type: Component,
|
|
357
|
-
args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule,
|
|
367
|
+
args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbarModule, MatIcon, MatFormField, MatInput, MatButton, MatIconButton, MatSuffix, MatMenu, MatMenuItem, MatMenuTrigger], template: "<mat-toolbar *ngIf=\"formNavigator.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input #filterInput [attr.data-testid]=\"entityDescriptor().createTestId('filter')\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\n @if (filterInput.value) {\n <button [attr.data-testid]=\"entityDescriptor().createTestId('filter-clear')\" type=\"button\" mat-icon-button matSuffix aria-label=\"Clear filter\" (click)=\"onClearFilter(filterInput)\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n </mat-form-field>\n </div>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-menu-item [disabled]=\"store.selectedEntities().length != 1\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-menu-item [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-button [disabled]=\"store.selectedEntities().length != 1\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>\n" }]
|
|
358
368
|
}], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
359
369
|
|
|
360
370
|
class BaseEntityStatusbarComponent {
|
|
@@ -374,12 +384,29 @@ class BaseEntityStatusbarComponent {
|
|
|
374
384
|
const fn = new Function('ctx', 'return ' + title.replace(/this\./g, 'ctx.'));
|
|
375
385
|
return fn(this);
|
|
376
386
|
}
|
|
377
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
378
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
387
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityStatusbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
388
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.13", type: BaseEntityStatusbarComponent, isStandalone: true, selector: "base-entity-statusbar", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
389
|
+
<mat-toolbar *ngIf="isVisible()">
|
|
390
|
+
<div>
|
|
391
|
+
<span>{{ entityTitle() }}</span>
|
|
392
|
+
</div>
|
|
393
|
+
</mat-toolbar>
|
|
394
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }] });
|
|
379
395
|
}
|
|
380
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
396
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityStatusbarComponent, decorators: [{
|
|
381
397
|
type: Component,
|
|
382
|
-
args: [{
|
|
398
|
+
args: [{
|
|
399
|
+
selector: 'base-entity-statusbar',
|
|
400
|
+
standalone: true,
|
|
401
|
+
imports: [CommonModule, MatToolbar],
|
|
402
|
+
template: `
|
|
403
|
+
<mat-toolbar *ngIf="isVisible()">
|
|
404
|
+
<div>
|
|
405
|
+
<span>{{ entityTitle() }}</span>
|
|
406
|
+
</div>
|
|
407
|
+
</mat-toolbar>
|
|
408
|
+
`,
|
|
409
|
+
}]
|
|
383
410
|
}], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
384
411
|
|
|
385
412
|
class BaseEntityTabsComponent {
|
|
@@ -428,11 +455,18 @@ class BaseEntityTabsComponent {
|
|
|
428
455
|
}
|
|
429
456
|
});
|
|
430
457
|
}
|
|
431
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
432
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
458
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
459
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.13", type: BaseEntityTabsComponent, isStandalone: true, selector: "base-entity-tabs", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
433
460
|
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
|
|
434
|
-
<a mat-tab-link (click)="onShowList()" [active]="store.currentTab() === listTabName()">{{ listTabName() }}</a>
|
|
435
|
-
<a
|
|
461
|
+
<a mat-tab-link [attr.data-testid]="entityDescriptor().createTestId('show-list')" (click)="onShowList()" [active]="store.currentTab() === listTabName()">{{ listTabName() }}</a>
|
|
462
|
+
<a
|
|
463
|
+
mat-tab-link
|
|
464
|
+
[attr.data-testid]="entityDescriptor().createTestId('show-details')"
|
|
465
|
+
[disabled]="store.currentEntity() === undefined"
|
|
466
|
+
(click)="onShowDetails()"
|
|
467
|
+
[active]="store.currentTab() === detailsTabName()"
|
|
468
|
+
>{{ detailsTabName() }}</a
|
|
469
|
+
>
|
|
436
470
|
</nav>
|
|
437
471
|
|
|
438
472
|
<mat-tab-nav-panel #tabPanel>
|
|
@@ -442,7 +476,7 @@ class BaseEntityTabsComponent {
|
|
|
442
476
|
</mat-tab-nav-panel>
|
|
443
477
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: MatTabNav, selector: "[mat-tab-nav-bar]", inputs: ["fitInkBarToContent", "mat-stretch-tabs", "animationDuration", "backgroundColor", "disableRipple", "color", "tabPanel"], exportAs: ["matTabNavBar", "matTabNav"] }, { kind: "component", type: MatTabLink, selector: "[mat-tab-link], [matTabLink]", inputs: ["active", "disabled", "disableRipple", "tabIndex", "id"], exportAs: ["matTabLink"] }, { kind: "component", type: MatTabNavPanel, selector: "mat-tab-nav-panel", inputs: ["id"], exportAs: ["matTabNavPanel"] }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: BaseEntityToolbarComponent, selector: "base-entity-toolbar", inputs: ["entityDescriptor"] }, { kind: "component", type: BaseEntityStatusbarComponent, selector: "base-entity-statusbar", inputs: ["entityDescriptor"] }] });
|
|
444
478
|
}
|
|
445
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityTabsComponent, decorators: [{
|
|
446
480
|
type: Component,
|
|
447
481
|
args: [{
|
|
448
482
|
selector: 'base-entity-tabs',
|
|
@@ -450,8 +484,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
450
484
|
imports: [CommonModule, MatTabNav, MatTabLink, MatTabNavPanel, RouterOutlet, BaseEntityToolbarComponent, BaseEntityStatusbarComponent],
|
|
451
485
|
template: `
|
|
452
486
|
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
|
|
453
|
-
<a mat-tab-link (click)="onShowList()" [active]="store.currentTab() === listTabName()">{{ listTabName() }}</a>
|
|
454
|
-
<a
|
|
487
|
+
<a mat-tab-link [attr.data-testid]="entityDescriptor().createTestId('show-list')" (click)="onShowList()" [active]="store.currentTab() === listTabName()">{{ listTabName() }}</a>
|
|
488
|
+
<a
|
|
489
|
+
mat-tab-link
|
|
490
|
+
[attr.data-testid]="entityDescriptor().createTestId('show-details')"
|
|
491
|
+
[disabled]="store.currentEntity() === undefined"
|
|
492
|
+
(click)="onShowDetails()"
|
|
493
|
+
[active]="store.currentTab() === detailsTabName()"
|
|
494
|
+
>{{ detailsTabName() }}</a
|
|
495
|
+
>
|
|
455
496
|
</nav>
|
|
456
497
|
|
|
457
498
|
<mat-tab-nav-panel #tabPanel>
|
|
@@ -463,50 +504,67 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
463
504
|
}]
|
|
464
505
|
}], ctorParameters: () => [], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
465
506
|
|
|
507
|
+
const ACTIVE_ENTITY_FACADE = new InjectionToken('ACTIVE_ENTITY_FACADE');
|
|
508
|
+
|
|
466
509
|
class BaseEntityContainerComponent {
|
|
467
|
-
entityDescriptor = input
|
|
510
|
+
entityDescriptor = input(undefined, ...(ngDevMode ? [{ debugName: "entityDescriptor" }] : /* istanbul ignore next */ []));
|
|
511
|
+
facade = input(undefined, ...(ngDevMode ? [{ debugName: "facade" }] : /* istanbul ignore next */ []));
|
|
512
|
+
injectedFacade = inject(ACTIVE_ENTITY_FACADE, { optional: true });
|
|
468
513
|
snackBar = inject(MatSnackBar);
|
|
469
514
|
store;
|
|
515
|
+
activeFacade = computed(() => this.facade() ?? this.injectedFacade ?? undefined, ...(ngDevMode ? [{ debugName: "activeFacade" }] : /* istanbul ignore next */ []));
|
|
516
|
+
resolvedDescriptor = computed(() => {
|
|
517
|
+
const f = this.activeFacade();
|
|
518
|
+
if (f)
|
|
519
|
+
return f.descriptor;
|
|
520
|
+
const descriptor = this.entityDescriptor();
|
|
521
|
+
if (!descriptor) {
|
|
522
|
+
throw new Error('BaseEntityContainerComponent requires either [facade], ACTIVE_ENTITY_FACADE provider, or [entityDescriptor]');
|
|
523
|
+
}
|
|
524
|
+
return descriptor;
|
|
525
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedDescriptor" }] : /* istanbul ignore next */ []));
|
|
470
526
|
constructor() {
|
|
471
527
|
this.registerEffects();
|
|
472
528
|
}
|
|
473
529
|
// region Angular lifecycle hooks
|
|
474
530
|
ngOnDestroy() {
|
|
475
|
-
this.store
|
|
531
|
+
this.store?.reset?.();
|
|
476
532
|
}
|
|
477
533
|
ngOnInit() {
|
|
478
|
-
this.store = this.
|
|
534
|
+
this.store = this.activeFacade()?.store ?? this.resolvedDescriptor().store;
|
|
479
535
|
}
|
|
480
536
|
// endregion
|
|
481
537
|
// region protected, private helper methods
|
|
482
538
|
registerEffects() {
|
|
483
539
|
effect(() => {
|
|
484
|
-
if (this.store
|
|
540
|
+
if (this.store?.error?.()) {
|
|
485
541
|
const errorMessage = this.store.error() ? this.store.error() : 'Undefined Error';
|
|
486
542
|
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
|
|
487
543
|
}
|
|
488
544
|
});
|
|
489
545
|
}
|
|
490
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
491
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
546
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
547
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.13", type: BaseEntityContainerComponent, isStandalone: true, selector: "base-entity-container", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: false, transformFunction: null }, facade: { classPropertyName: "facade", publicName: "facade", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
548
|
+
<ng-content></ng-content>
|
|
492
549
|
<div>
|
|
493
|
-
<base-entity-tabs [entityDescriptor]="
|
|
550
|
+
<base-entity-tabs [entityDescriptor]="resolvedDescriptor()"></base-entity-tabs>
|
|
494
551
|
</div>
|
|
495
552
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BaseEntityTabsComponent, selector: "base-entity-tabs", inputs: ["entityDescriptor"] }] });
|
|
496
553
|
}
|
|
497
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
554
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityContainerComponent, decorators: [{
|
|
498
555
|
type: Component,
|
|
499
556
|
args: [{
|
|
500
557
|
selector: 'base-entity-container',
|
|
501
558
|
standalone: true,
|
|
502
559
|
imports: [CommonModule, BaseEntityTabsComponent],
|
|
503
560
|
template: `
|
|
561
|
+
<ng-content></ng-content>
|
|
504
562
|
<div>
|
|
505
|
-
<base-entity-tabs [entityDescriptor]="
|
|
563
|
+
<base-entity-tabs [entityDescriptor]="resolvedDescriptor()"></base-entity-tabs>
|
|
506
564
|
</div>
|
|
507
565
|
`,
|
|
508
566
|
}]
|
|
509
|
-
}], ctorParameters: () => [], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
567
|
+
}], ctorParameters: () => [], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: false }] }], facade: [{ type: i0.Input, args: [{ isSignal: true, alias: "facade", required: false }] }] } });
|
|
510
568
|
|
|
511
569
|
const INITIAL_CONTAINER_STATE = {
|
|
512
570
|
filterKey: undefined,
|
|
@@ -542,7 +600,13 @@ let BaseEntityRestService = class BaseEntityRestService {
|
|
|
542
600
|
}
|
|
543
601
|
// region public accessor and mutator methods
|
|
544
602
|
delete(id) {
|
|
545
|
-
|
|
603
|
+
const pathParams = new Map([['id', String(id)]]);
|
|
604
|
+
const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}', { pathParams });
|
|
605
|
+
if (fullUrl) {
|
|
606
|
+
return this.httpClient.delete(fullUrl, { headers: this.headers });
|
|
607
|
+
}
|
|
608
|
+
else
|
|
609
|
+
throw new Error('Could not determine the full url');
|
|
546
610
|
}
|
|
547
611
|
deleteAll() {
|
|
548
612
|
return this.httpClient.delete(this.resourceUrl, { headers: this.headers });
|
|
@@ -694,10 +758,10 @@ class BaseFormHostDirective {
|
|
|
694
758
|
constructor(viewContainerRef) {
|
|
695
759
|
this.viewContainerRef = viewContainerRef;
|
|
696
760
|
}
|
|
697
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
698
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.
|
|
761
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseFormHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
762
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.13", type: BaseFormHostDirective, isStandalone: true, selector: "[baseFormHost]", ngImport: i0 });
|
|
699
763
|
}
|
|
700
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
764
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseFormHostDirective, decorators: [{
|
|
701
765
|
type: Directive,
|
|
702
766
|
args: [{
|
|
703
767
|
standalone: true,
|
|
@@ -705,9 +769,114 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
705
769
|
}]
|
|
706
770
|
}], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
|
|
707
771
|
|
|
708
|
-
|
|
772
|
+
var FlexDirection;
|
|
773
|
+
(function (FlexDirection) {
|
|
774
|
+
FlexDirection[FlexDirection["CONTAINER"] = 0] = "CONTAINER";
|
|
775
|
+
FlexDirection[FlexDirection["COLUMN"] = 1] = "COLUMN";
|
|
776
|
+
FlexDirection[FlexDirection["ROW"] = 2] = "ROW";
|
|
777
|
+
})(FlexDirection || (FlexDirection = {}));
|
|
778
|
+
class FlexboxDescriptor extends AbstractAttrDescriptor {
|
|
779
|
+
attrDescriptors;
|
|
780
|
+
direction;
|
|
781
|
+
constructor(attrDescriptors, direction) {
|
|
782
|
+
super('dummy', FormControlType.FLEX_BOX);
|
|
783
|
+
this.attrDescriptors = attrDescriptors;
|
|
784
|
+
this.direction = direction;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
function filterAttributeDescriptors(descriptors) {
|
|
789
|
+
let attrDescriptors = [];
|
|
790
|
+
descriptors.forEach((descriptor) => {
|
|
791
|
+
if (descriptor instanceof BaseEntityAttrDescriptor)
|
|
792
|
+
attrDescriptors.push(descriptor);
|
|
793
|
+
else if (descriptor instanceof FlexboxDescriptor) {
|
|
794
|
+
attrDescriptors = attrDescriptors.concat(filterAttributeDescriptors(descriptor.attrDescriptors));
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
return attrDescriptors;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
const BASE_ENTITY_FACADE_REGISTRY = new InjectionToken('BASE_ENTITY_FACADE_REGISTRY', {
|
|
709
801
|
factory: () => ({}),
|
|
710
802
|
});
|
|
803
|
+
class EntityRegistryComponent {
|
|
804
|
+
registry = inject(BASE_ENTITY_FACADE_REGISTRY);
|
|
805
|
+
injector = inject(Injector);
|
|
806
|
+
queryParams = toSignal(inject(ActivatedRoute).queryParamMap, { initialValue: null });
|
|
807
|
+
descriptors = signal(this.buildDescriptors(), ...(ngDevMode ? [{ debugName: "descriptors" }] : /* istanbul ignore next */ []));
|
|
808
|
+
registryJson = computed(() => {
|
|
809
|
+
const minified = this.queryParams()?.get('minified') === 'yes';
|
|
810
|
+
return minified ? JSON.stringify(this.descriptors(), null, 2) : JSON.stringify(this.descriptors(), null, 2);
|
|
811
|
+
}, ...(ngDevMode ? [{ debugName: "registryJson" }] : /* istanbul ignore next */ []));
|
|
812
|
+
buildDescriptors() {
|
|
813
|
+
return Object.entries(this.registry).map(([, facadeToken]) => {
|
|
814
|
+
const facade = this.injector.get(facadeToken);
|
|
815
|
+
const descriptor = facade.descriptor;
|
|
816
|
+
const attrDescriptors = filterAttributeDescriptors(facade.descriptor.attrDescriptors);
|
|
817
|
+
return {
|
|
818
|
+
entityName: descriptor.entityName,
|
|
819
|
+
entityTitle: descriptor.entityTitle,
|
|
820
|
+
attrDescriptors: attrDescriptors.map((attr) => this.serializeAttr(attr)),
|
|
821
|
+
};
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
serializeAttr(attr) {
|
|
825
|
+
const isBaseAttr = attr instanceof BaseEntityAttrDescriptor;
|
|
826
|
+
return {
|
|
827
|
+
attrName: attr.attrName,
|
|
828
|
+
formControlType: attr.formControlType,
|
|
829
|
+
disabled: attr.disabled,
|
|
830
|
+
style: attr.style,
|
|
831
|
+
...(isBaseAttr && {
|
|
832
|
+
label: attr.label,
|
|
833
|
+
description: attr.description,
|
|
834
|
+
styleClass: attr.styleClass,
|
|
835
|
+
labelClass: attr.labelClass,
|
|
836
|
+
format: attr.format,
|
|
837
|
+
isLinkToDetails: attr.isLinkToDetails,
|
|
838
|
+
selectables: attr.selectables,
|
|
839
|
+
visible: attr.visible,
|
|
840
|
+
hideInTable: attr.hideInTable,
|
|
841
|
+
isHeading: attr.isHeading,
|
|
842
|
+
placeholder: attr.placeholder,
|
|
843
|
+
lines: attr.lines,
|
|
844
|
+
options: attr.options,
|
|
845
|
+
required: attr.required,
|
|
846
|
+
linkedEntityType: attr.linkedEntityType ? { entityName: attr.linkedEntityType.entityName } : undefined,
|
|
847
|
+
}),
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: EntityRegistryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
851
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: EntityRegistryComponent, isStandalone: true, selector: "pp-entity-registry", ngImport: i0, template: ` <pre>{{ registryJson() }}</pre> `, isInline: true });
|
|
852
|
+
}
|
|
853
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: EntityRegistryComponent, decorators: [{
|
|
854
|
+
type: Component,
|
|
855
|
+
args: [{
|
|
856
|
+
selector: 'pp-entity-registry',
|
|
857
|
+
template: ` <pre>{{ registryJson() }}</pre> `,
|
|
858
|
+
}]
|
|
859
|
+
}] });
|
|
860
|
+
|
|
861
|
+
function entityNameFromType(entityType) {
|
|
862
|
+
return entityType.name ?? 'base-entity';
|
|
863
|
+
}
|
|
864
|
+
function createTestId(entity, suffix) {
|
|
865
|
+
const entityName = typeof entity === 'string' ? entity : entityNameFromType(entity);
|
|
866
|
+
const camelCaseName = toTestId(entityName);
|
|
867
|
+
return `${camelCaseName}-${suffix}`;
|
|
868
|
+
}
|
|
869
|
+
function createTestLocator(entity, suffix) {
|
|
870
|
+
const entityName = typeof entity === 'string' ? entity : entityNameFromType(entity);
|
|
871
|
+
const camelCaseName = toTestId(entityName);
|
|
872
|
+
return `[data-testid="${camelCaseName}-${suffix}"]`;
|
|
873
|
+
}
|
|
874
|
+
function toTestId(entityName) {
|
|
875
|
+
return entityName
|
|
876
|
+
.split(' ')
|
|
877
|
+
.map((word, i) => (i === 0 ? word.charAt(0).toLowerCase() + word.slice(1) : word.charAt(0).toUpperCase() + word.slice(1)))
|
|
878
|
+
.join('');
|
|
879
|
+
}
|
|
711
880
|
|
|
712
881
|
class BaseFormControlComponent {
|
|
713
882
|
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
@@ -715,17 +884,34 @@ class BaseFormControlComponent {
|
|
|
715
884
|
formGroup;
|
|
716
885
|
store;
|
|
717
886
|
style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
|
|
887
|
+
linkedEntityType = computed(() => {
|
|
888
|
+
const linkedEntityType = this.config().linkedEntityType;
|
|
889
|
+
if (linkedEntityType === undefined) {
|
|
890
|
+
this.logger.error(`linkedEntityType should be defined for '${this.config().attrName}'.`);
|
|
891
|
+
throw new Error(`linkedEntityType should be defined for '${this.config().attrName}'.`);
|
|
892
|
+
}
|
|
893
|
+
return linkedEntityType;
|
|
894
|
+
}, ...(ngDevMode ? [{ debugName: "linkedEntityType" }] : /* istanbul ignore next */ []));
|
|
718
895
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
896
|
+
get testId() {
|
|
897
|
+
const attrName = this.config()?.attrName;
|
|
898
|
+
const entity = this.entity();
|
|
899
|
+
if (!attrName || !entity)
|
|
900
|
+
return null;
|
|
901
|
+
return createTestId(entity.constructor, attrName);
|
|
902
|
+
}
|
|
903
|
+
logger = inject(NGXLogger);
|
|
719
904
|
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
720
905
|
injector = inject(Injector);
|
|
721
|
-
|
|
906
|
+
facadeRegistry = inject(BASE_ENTITY_FACADE_REGISTRY);
|
|
722
907
|
// region Angular lifecycle hooks
|
|
723
908
|
// endregion
|
|
724
909
|
resolveRelatedEntityStore() {
|
|
725
910
|
const entityName = this.config().linkedEntityType?.entityName;
|
|
726
|
-
const
|
|
727
|
-
if (
|
|
728
|
-
|
|
911
|
+
const facadeToken = entityName ? this.facadeRegistry[entityName] : undefined;
|
|
912
|
+
if (facadeToken) {
|
|
913
|
+
const facade = this.injector.get(facadeToken, undefined);
|
|
914
|
+
return facade?.store;
|
|
729
915
|
}
|
|
730
916
|
const store = this.config().linkedEntityType?.store;
|
|
731
917
|
if (!store) {
|
|
@@ -742,21 +928,22 @@ class BaseFormControlComponent {
|
|
|
742
928
|
}
|
|
743
929
|
}
|
|
744
930
|
isStoreInstance(store) {
|
|
745
|
-
return
|
|
746
|
-
(typeof store === 'object' || typeof store === 'function') &&
|
|
747
|
-
('load' in store || 'loadById' in store || 'entities' in store));
|
|
931
|
+
return !!store && (typeof store === 'object' || typeof store === 'function') && ('load' in store || 'loadById' in store || 'entities' in store);
|
|
748
932
|
}
|
|
749
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
750
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
933
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseFormControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
934
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.13", type: BaseFormControlComponent, isStandalone: true, selector: "ng-component", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, entity: { classPropertyName: "entity", publicName: "entity", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.data-testid": "this.testId" } }, ngImport: i0, template: ``, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }] });
|
|
751
935
|
}
|
|
752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
936
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseFormControlComponent, decorators: [{
|
|
753
937
|
type: Component,
|
|
754
938
|
args: [{
|
|
755
939
|
standalone: true,
|
|
756
940
|
template: ``,
|
|
757
941
|
imports: [ReactiveFormsModule],
|
|
758
942
|
}]
|
|
759
|
-
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }]
|
|
943
|
+
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], testId: [{
|
|
944
|
+
type: HostBinding,
|
|
945
|
+
args: ['attr.data-testid']
|
|
946
|
+
}] } });
|
|
760
947
|
|
|
761
948
|
class ObjectStoreService {
|
|
762
949
|
runtimeConfiguration = inject(RUNTIME_CONFIGURATION);
|
|
@@ -799,10 +986,10 @@ class ObjectStoreService {
|
|
|
799
986
|
const baseConfiguration = Reflect.get(this.runtimeConfiguration, 'BASE_CONFIGURATION');
|
|
800
987
|
return Reflect.get(baseConfiguration, 'OBJECT_STORE_SERVICE_ROOT') ?? Reflect.get(baseConfiguration, 'BACKEND_SERVICE_ROOT') ?? '';
|
|
801
988
|
}
|
|
802
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
803
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
989
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: ObjectStoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
990
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: ObjectStoreService, providedIn: 'root' });
|
|
804
991
|
}
|
|
805
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
992
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: ObjectStoreService, decorators: [{
|
|
806
993
|
type: Injectable,
|
|
807
994
|
args: [{ providedIn: 'root' }]
|
|
808
995
|
}] });
|
|
@@ -871,8 +1058,8 @@ class ArtifactSelectorComponent {
|
|
|
871
1058
|
};
|
|
872
1059
|
return mimeTypeByExtension[extension] ?? 'application/octet-stream';
|
|
873
1060
|
}
|
|
874
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
875
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1061
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: ArtifactSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1062
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: ArtifactSelectorComponent, isStandalone: true, selector: "app-artifact-selector", outputs: { artifactUploaded: "artifactUploaded" }, ngImport: i0, template: `
|
|
876
1063
|
<div class="artifact-selector">
|
|
877
1064
|
@if (!isSelectorVisible) {
|
|
878
1065
|
<button type="button" (click)="showSelector()">Upload file</button>
|
|
@@ -904,7 +1091,7 @@ class ArtifactSelectorComponent {
|
|
|
904
1091
|
</div>
|
|
905
1092
|
`, isInline: true, styles: [""], 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"] }] });
|
|
906
1093
|
}
|
|
907
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1094
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: ArtifactSelectorComponent, decorators: [{
|
|
908
1095
|
type: Component,
|
|
909
1096
|
args: [{ selector: 'app-artifact-selector', standalone: true, imports: [FormsModule], template: `
|
|
910
1097
|
<div class="artifact-selector">
|
|
@@ -947,8 +1134,8 @@ class DeleteArtifactConfirmationDialog {
|
|
|
947
1134
|
t(key, params) {
|
|
948
1135
|
return this.translocoService.translate(key, params);
|
|
949
1136
|
}
|
|
950
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
951
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1137
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: DeleteArtifactConfirmationDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1138
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: DeleteArtifactConfirmationDialog, isStandalone: true, selector: "app-delete-artifact-confirmation-dialog", providers: [provideTranslocoScope('base-entity')], ngImport: i0, template: `
|
|
952
1139
|
<h2 mat-dialog-title>{{ t(data.titleKey) }}</h2>
|
|
953
1140
|
<mat-dialog-content>{{ t(data.contentKey, data.contentParams) }}</mat-dialog-content>
|
|
954
1141
|
<mat-dialog-actions align="end">
|
|
@@ -957,7 +1144,7 @@ class DeleteArtifactConfirmationDialog {
|
|
|
957
1144
|
</mat-dialog-actions>
|
|
958
1145
|
`, isInline: true, dependencies: [{ kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: 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"] }] });
|
|
959
1146
|
}
|
|
960
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: DeleteArtifactConfirmationDialog, decorators: [{
|
|
961
1148
|
type: Component,
|
|
962
1149
|
args: [{
|
|
963
1150
|
selector: 'app-delete-artifact-confirmation-dialog',
|
|
@@ -1029,8 +1216,8 @@ class ArtifactComponent extends BaseFormControlComponent {
|
|
|
1029
1216
|
control?.markAsDirty();
|
|
1030
1217
|
control?.markAsTouched();
|
|
1031
1218
|
}
|
|
1032
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1033
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1219
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: ArtifactComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1220
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: ArtifactComponent, isStandalone: true, selector: "app-artifact", usesInheritance: true, ngImport: i0, template: `
|
|
1034
1221
|
@if (config().visible) {
|
|
1035
1222
|
@if (config().isHeading) {
|
|
1036
1223
|
<h3 [id]="config().attrName">{{ value() }}</h3>
|
|
@@ -1059,7 +1246,7 @@ class ArtifactComponent extends BaseFormControlComponent {
|
|
|
1059
1246
|
}
|
|
1060
1247
|
`, isInline: true, styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:20px}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ArtifactSelectorComponent, selector: "app-artifact-selector", outputs: ["artifactUploaded"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
1061
1248
|
}
|
|
1062
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: ArtifactComponent, decorators: [{
|
|
1063
1250
|
type: Component,
|
|
1064
1251
|
args: [{ selector: 'app-artifact', standalone: true, imports: [FormsModule, ReactiveFormsModule, NgClass, NgStyle, ArtifactSelectorComponent, MatIconButton, MatIcon], template: `
|
|
1065
1252
|
@if (config().visible) {
|
|
@@ -1092,19 +1279,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
1092
1279
|
}] });
|
|
1093
1280
|
|
|
1094
1281
|
class LabelComponent extends BaseFormControlComponent {
|
|
1095
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1096
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1282
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: LabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1283
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: LabelComponent, isStandalone: true, selector: "base-label", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <ng-container *ngIf=\"config().isHeading; else normalText\">\n <h3 [id]=\"config().attrName\">{{value()}}</h3>\n </ng-container>\n\n <ng-template #normalText>\n <p [id]=\"config().attrName\" [ngStyle]=\"config().style\">{{value()}}</p>\n </ng-template>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
1097
1284
|
}
|
|
1098
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: LabelComponent, decorators: [{
|
|
1099
1286
|
type: Component,
|
|
1100
1287
|
args: [{ selector: 'base-label', standalone: true, imports: [NgIf, NgStyle], template: "<ng-container *ngIf=\"config().visible\">\n <ng-container *ngIf=\"config().isHeading; else normalText\">\n <h3 [id]=\"config().attrName\">{{value()}}</h3>\n </ng-container>\n\n <ng-template #normalText>\n <p [id]=\"config().attrName\" [ngStyle]=\"config().style\">{{value()}}</p>\n </ng-template>\n</ng-container>" }]
|
|
1101
1288
|
}] });
|
|
1102
1289
|
|
|
1103
1290
|
class DatepickerComponent extends BaseFormControlComponent {
|
|
1104
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1105
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1291
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: DatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1292
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: DatepickerComponent, isStandalone: true, selector: "base-datepicker", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" style=\"margin-bottom: 10px\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" formControlName=\"{{config().attrName}}\">\n <mat-hint>MM-DD-YYYY</mat-hint>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n </div>\n</ng-container>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.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: MatDatepickerModule }, { kind: "component", type: i5.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
1106
1293
|
}
|
|
1107
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
1108
1295
|
type: Component,
|
|
1109
1296
|
args: [{ selector: 'base-datepicker', standalone: true, imports: [CommonModule, FormsModule, MatFormFieldModule, MatInputModule, MatDatepickerModule, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" style=\"margin-bottom: 10px\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" formControlName=\"{{config().attrName}}\">\n <mat-hint>MM-DD-YYYY</mat-hint>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n </div>\n</ng-container>\n" }]
|
|
1110
1297
|
}] });
|
|
@@ -1128,37 +1315,33 @@ class ForeignKeyComponent extends BaseFormControlComponent {
|
|
|
1128
1315
|
this.hasFocus.set(!!currentTarget && !!relatedTarget && currentTarget.contains(relatedTarget));
|
|
1129
1316
|
}
|
|
1130
1317
|
navigateToRelated() {
|
|
1131
|
-
|
|
1132
|
-
if (!relatedEntityName)
|
|
1133
|
-
return;
|
|
1134
|
-
this.formNavigator.navigateToRelated(relatedEntityName, this.foreignKeyId(), this.formNavigator.determineCurrentUrl());
|
|
1318
|
+
this.formNavigator.navigateToRelated(this.linkedEntityType().entityName, this.foreignKeyId(), this.formNavigator.determineCurrentUrl());
|
|
1135
1319
|
}
|
|
1136
1320
|
navigateToRelatedList() {
|
|
1137
|
-
|
|
1138
|
-
if (this.config().disabled || !relatedEntityName) {
|
|
1321
|
+
if (this.config().disabled) {
|
|
1139
1322
|
return;
|
|
1140
1323
|
}
|
|
1141
|
-
this.formNavigator.navigateToRelatedList(
|
|
1324
|
+
this.formNavigator.navigateToRelatedList(this.linkedEntityType().entityName, this.formNavigator.determineCurrentUrl(), {
|
|
1142
1325
|
command: NavigatorCommand.SELECT_OR_CREATE,
|
|
1143
1326
|
});
|
|
1144
1327
|
}
|
|
1145
1328
|
// endregion
|
|
1146
1329
|
selectEntityTitle() {
|
|
1147
|
-
return 'Select ' +
|
|
1330
|
+
return 'Select ' + this.linkedEntityType().entityName;
|
|
1148
1331
|
}
|
|
1149
1332
|
foreignKeyLabel() {
|
|
1150
|
-
return this.
|
|
1333
|
+
return this.linkedEntityType().entityName;
|
|
1151
1334
|
}
|
|
1152
1335
|
showSelectEntityButton() {
|
|
1153
|
-
return !this.config().disabled && this.hasFocus()
|
|
1336
|
+
return !this.config().disabled && this.hasFocus();
|
|
1154
1337
|
}
|
|
1155
1338
|
foreignKeyDisplayName() {
|
|
1156
1339
|
const relatedEntity = this.selectedEntity() ?? this.relatedEntityFromLinkedStore();
|
|
1157
1340
|
if (!relatedEntity) {
|
|
1158
1341
|
return this.foreignKeyId();
|
|
1159
1342
|
}
|
|
1160
|
-
const attrName = this.
|
|
1161
|
-
const componentName =
|
|
1343
|
+
const attrName = this.linkedEntityType().componentIdentification();
|
|
1344
|
+
const componentName = relatedEntity[attrName];
|
|
1162
1345
|
return componentName === undefined || componentName === null ? relatedEntity.id : String(componentName);
|
|
1163
1346
|
}
|
|
1164
1347
|
addSelectedComponentFromNavigatorResponse() {
|
|
@@ -1205,8 +1388,8 @@ class ForeignKeyComponent extends BaseFormControlComponent {
|
|
|
1205
1388
|
}
|
|
1206
1389
|
return undefined;
|
|
1207
1390
|
}
|
|
1208
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1209
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1391
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: ForeignKeyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1392
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: ForeignKeyComponent, isStandalone: true, selector: "base-foreign-key", usesInheritance: true, ngImport: i0, template: `
|
|
1210
1393
|
@if (config().visible) {
|
|
1211
1394
|
<div class="row" [formGroup]="formGroup" (focusin)="hasFocus.set(true)" (focusout)="onFocusOut($event)">
|
|
1212
1395
|
<div class="foreign-key-control">
|
|
@@ -1238,7 +1421,7 @@ class ForeignKeyComponent extends BaseFormControlComponent {
|
|
|
1238
1421
|
}
|
|
1239
1422
|
`, isInline: true, styles: [".foreign-key-control{display:inline-flex;flex-direction:column;align-items:stretch}.foreign-key-field{width:100%}.foreign-key-select-row{display:flex;min-height:28px;margin-top:-18px;padding:0 12px 0 16px;justify-content:flex-start}.foreign-key-select-button{height:28px;min-width:max-content;padding:0 8px;line-height:28px;white-space:nowrap}.foreign-key-select-button mat-icon{width:18px;height:18px;margin-right:4px;font-size:18px;line-height:18px}\n"], dependencies: [{ kind: "component", type: 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: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: 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: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
1240
1423
|
}
|
|
1241
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1424
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: ForeignKeyComponent, decorators: [{
|
|
1242
1425
|
type: Component,
|
|
1243
1426
|
args: [{ selector: 'base-foreign-key', standalone: true, template: `
|
|
1244
1427
|
@if (config().visible) {
|
|
@@ -1274,46 +1457,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
1274
1457
|
}] });
|
|
1275
1458
|
|
|
1276
1459
|
class TextboxComponent extends BaseFormControlComponent {
|
|
1277
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1278
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1460
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: TextboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1461
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: TextboxComponent, isStandalone: true, selector: "base-textbox", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <input matInput formControlName=\"{{config().attrName}}\">\n </mat-form-field>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: 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: "directive", type: MatLabel, selector: "mat-label" }, { 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.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
1279
1462
|
}
|
|
1280
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1463
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: TextboxComponent, decorators: [{
|
|
1281
1464
|
type: Component,
|
|
1282
1465
|
args: [{ selector: 'base-textbox', standalone: true, imports: [NgIf, MatFormField, MatInput, MatLabel, FormsModule, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <input matInput formControlName=\"{{config().attrName}}\">\n </mat-form-field>\n </div>\n</ng-container>" }]
|
|
1283
1466
|
}] });
|
|
1284
1467
|
|
|
1285
1468
|
class DropdownComponent extends BaseFormControlComponent {
|
|
1286
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1287
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1469
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: DropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1470
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: DropdownComponent, isStandalone: true, selector: "base-dropdown", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <mat-select formControlName=\"{{config().attrName}}\">\n @for (option of config().selectables; track option) {\n <mat-option [value]=\"option.value\">{{option.value}}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i2$1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i2$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] });
|
|
1288
1471
|
}
|
|
1289
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1472
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
1290
1473
|
type: Component,
|
|
1291
1474
|
args: [{ selector: 'base-dropdown', standalone: true, imports: [NgIf, ReactiveFormsModule, MatLabel, MatFormField, MatSelectModule], template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <mat-select formControlName=\"{{config().attrName}}\">\n @for (option of config().selectables; track option) {\n <mat-option [value]=\"option.value\">{{option.value}}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n</ng-container>" }]
|
|
1292
1475
|
}] });
|
|
1293
1476
|
|
|
1294
1477
|
class CheckboxComponent extends BaseFormControlComponent {
|
|
1295
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1296
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1478
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1479
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: CheckboxComponent, isStandalone: true, selector: "base-checkbox", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div [formGroup]=\"formGroup\" class=\"row\">\n <mat-checkbox [ngClass]=\"config().labelClass\" formControlName=\"{{config().attrName}}\">{{config().label}}</mat-checkbox>\n </div>\n</ng-container>", styles: ["mat-checkbox{margin-bottom:12px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: 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: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
1297
1480
|
}
|
|
1298
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1481
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
1299
1482
|
type: Component,
|
|
1300
1483
|
args: [{ selector: 'base-checkbox', standalone: true, imports: [NgClass, NgIf, MatCheckbox, FormsModule, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\n <div [formGroup]=\"formGroup\" class=\"row\">\n <mat-checkbox [ngClass]=\"config().labelClass\" formControlName=\"{{config().attrName}}\">{{config().label}}</mat-checkbox>\n </div>\n</ng-container>", styles: ["mat-checkbox{margin-bottom:12px}\n"] }]
|
|
1301
1484
|
}] });
|
|
1302
1485
|
|
|
1303
1486
|
class RadioComponent extends BaseFormControlComponent {
|
|
1304
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1305
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1487
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1488
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: RadioComponent, isStandalone: true, selector: "base-radio", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <ng-container *ngIf=\"config().label\">\n <label [for]=\"config().attrName\">{{config().label}}</label>\n </ng-container>\n <div \n [ngClass]=\"config().styleClass ? config().styleClass : ''\"\n *ngFor=\"let radio of config().selectables; let i = index\">\n <input type=\"radio\"\n class=\"form-check-input\"\n [name]=\"config().attrName\"\n [id]=\"config().attrName + i\"\n [value]=\"radio.value\"\n [checked]=\"radio.key === value()\"\n [disabled]=\"config().disabled\"\n >\n <label [for]=\"config().attrName\" [ngClass]=\"config().labelClass ? config().labelClass : ''\">{{radio.value}}</label>\n </div>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
1306
1489
|
}
|
|
1307
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: RadioComponent, decorators: [{
|
|
1308
1491
|
type: Component,
|
|
1309
1492
|
args: [{ selector: 'base-radio', standalone: true, imports: [NgIf, NgClass, NgForOf, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <ng-container *ngIf=\"config().label\">\n <label [for]=\"config().attrName\">{{config().label}}</label>\n </ng-container>\n <div \n [ngClass]=\"config().styleClass ? config().styleClass : ''\"\n *ngFor=\"let radio of config().selectables; let i = index\">\n <input type=\"radio\"\n class=\"form-check-input\"\n [name]=\"config().attrName\"\n [id]=\"config().attrName + i\"\n [value]=\"radio.value\"\n [checked]=\"radio.key === value()\"\n [disabled]=\"config().disabled\"\n >\n <label [for]=\"config().attrName\" [ngClass]=\"config().labelClass ? config().labelClass : ''\">{{radio.value}}</label>\n </div>\n </div>\n</ng-container>" }]
|
|
1310
1493
|
}] });
|
|
1311
1494
|
|
|
1312
1495
|
class TextareaComponent extends BaseFormControlComponent {
|
|
1313
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1314
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1496
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: TextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1497
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: TextareaComponent, isStandalone: true, selector: "base-textarea", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field [ngClass]=\"config().styleClass\">\n <mat-label [ngClass]=\"config().labelClass\">{{config().label}}</mat-label>\n <textarea matInput formControlName=\"{{config().attrName}}\" placeholder=\"Ex. It makes me feel...\"></textarea>\n </mat-form-field>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: 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: "directive", type: MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
1315
1498
|
}
|
|
1316
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
1317
1500
|
type: Component,
|
|
1318
1501
|
args: [{ selector: 'base-textarea', standalone: true, imports: [NgIf, NgClass, MatFormField, MatInput, MatLabel, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field [ngClass]=\"config().styleClass\">\n <mat-label [ngClass]=\"config().labelClass\">{{config().label}}</mat-label>\n <textarea matInput formControlName=\"{{config().attrName}}\" placeholder=\"Ex. It makes me feel...\"></textarea>\n </mat-form-field>\n </div>\n</ng-container>" }]
|
|
1319
1502
|
}] });
|
|
@@ -1323,10 +1506,10 @@ class FlexBoxHostDirective {
|
|
|
1323
1506
|
constructor(viewContainerRef) {
|
|
1324
1507
|
this.viewContainerRef = viewContainerRef;
|
|
1325
1508
|
}
|
|
1326
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1327
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.
|
|
1509
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: FlexBoxHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1510
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.13", type: FlexBoxHostDirective, isStandalone: true, selector: "[flexBoxHost]", ngImport: i0 });
|
|
1328
1511
|
}
|
|
1329
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1512
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: FlexBoxHostDirective, decorators: [{
|
|
1330
1513
|
type: Directive,
|
|
1331
1514
|
args: [{
|
|
1332
1515
|
standalone: true,
|
|
@@ -1334,22 +1517,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
1334
1517
|
}]
|
|
1335
1518
|
}], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
|
|
1336
1519
|
|
|
1337
|
-
var FlexDirection;
|
|
1338
|
-
(function (FlexDirection) {
|
|
1339
|
-
FlexDirection[FlexDirection["CONTAINER"] = 0] = "CONTAINER";
|
|
1340
|
-
FlexDirection[FlexDirection["COLUMN"] = 1] = "COLUMN";
|
|
1341
|
-
FlexDirection[FlexDirection["ROW"] = 2] = "ROW";
|
|
1342
|
-
})(FlexDirection || (FlexDirection = {}));
|
|
1343
|
-
class FlexboxDescriptor extends AbstractAttrDescriptor {
|
|
1344
|
-
attrDescriptors;
|
|
1345
|
-
direction;
|
|
1346
|
-
constructor(attrDescriptors, direction) {
|
|
1347
|
-
super('dummy', FormControlType.FLEX_BOX);
|
|
1348
|
-
this.attrDescriptors = attrDescriptors;
|
|
1349
|
-
this.direction = direction;
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
1520
|
class FlexBoxComponent extends BaseFormControlComponent {
|
|
1354
1521
|
flexBoxHost;
|
|
1355
1522
|
flexBoxClass = computed(() => this.calculateFlexStyle(this.config().direction), ...(ngDevMode ? [{ debugName: "flexBoxClass" }] : /* istanbul ignore next */ []));
|
|
@@ -1366,10 +1533,10 @@ class FlexBoxComponent extends BaseFormControlComponent {
|
|
|
1366
1533
|
throw new Error('Unknown flex direction');
|
|
1367
1534
|
}
|
|
1368
1535
|
}
|
|
1369
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1370
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1536
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: FlexBoxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1537
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: FlexBoxComponent, isStandalone: true, selector: "flex-box", viewQueries: [{ propertyName: "flexBoxHost", first: true, predicate: FlexBoxHostDirective, descendants: true, read: FlexBoxHostDirective, static: true }], usesInheritance: true, ngImport: i0, template: "<div [ngClass]=\"flexBoxClass()\" [ngStyle]=\"style()\">\n <ng-template flexBoxHost></ng-template>\n</div>\n", styles: [".flex-box-container{display:flex}.flex-box-container-columns{display:flex;flex-direction:column}.flex-box-container-rows{display:flex;flex-direction:row}\n"], dependencies: [{ kind: "directive", type: FlexBoxHostDirective, selector: "[flexBoxHost]" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
1371
1538
|
}
|
|
1372
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: FlexBoxComponent, decorators: [{
|
|
1373
1540
|
type: Component,
|
|
1374
1541
|
args: [{ selector: 'flex-box', imports: [FlexBoxHostDirective, NgClass, NgStyle], template: "<div [ngClass]=\"flexBoxClass()\" [ngStyle]=\"style()\">\n <ng-template flexBoxHost></ng-template>\n</div>\n", styles: [".flex-box-container{display:flex}.flex-box-container-columns{display:flex;flex-direction:column}.flex-box-container-rows{display:flex;flex-direction:row}\n"] }]
|
|
1375
1542
|
}], propDecorators: { flexBoxHost: [{
|
|
@@ -1413,8 +1580,8 @@ class TagsComponent extends BaseFormControlComponent {
|
|
|
1413
1580
|
control?.markAsDirty();
|
|
1414
1581
|
control?.markAsTouched();
|
|
1415
1582
|
}
|
|
1416
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1417
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1583
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: TagsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1584
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: TagsComponent, isStandalone: true, selector: "base-tags", usesInheritance: true, ngImport: i0, template: `
|
|
1418
1585
|
<ng-container *ngIf="config().visible">
|
|
1419
1586
|
<div class="row" [formGroup]="formGroup">
|
|
1420
1587
|
<mat-form-field>
|
|
@@ -1435,7 +1602,7 @@ class TagsComponent extends BaseFormControlComponent {
|
|
|
1435
1602
|
</ng-container>
|
|
1436
1603
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "component", type: MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "directive", type: MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
1437
1604
|
}
|
|
1438
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1605
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: TagsComponent, decorators: [{
|
|
1439
1606
|
type: Component,
|
|
1440
1607
|
args: [{
|
|
1441
1608
|
selector: 'base-tags',
|
|
@@ -1499,8 +1666,8 @@ class EntityComponentRefComponent {
|
|
|
1499
1666
|
control?.markAsDirty();
|
|
1500
1667
|
control?.markAsTouched();
|
|
1501
1668
|
}
|
|
1502
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1503
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1669
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: EntityComponentRefComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1670
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: EntityComponentRefComponent, isStandalone: true, selector: "app-entity-component-ref", inputs: { entity: { classPropertyName: "entity", publicName: "entity", isSignal: true, isRequired: true, transformFunction: null }, component: { classPropertyName: "component", publicName: "component", isSignal: true, isRequired: true, transformFunction: null }, componentNameAttr: { classPropertyName: "componentNameAttr", publicName: "componentNameAttr", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, linkedEntityType: { classPropertyName: "linkedEntityType", publicName: "linkedEntityType", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
1504
1671
|
<a href="" (click)="navigateToRelated($event)">{{ componentName() }}</a>
|
|
1505
1672
|
@if (!disabled()) {
|
|
1506
1673
|
<button type="button" mat-icon-button class="base-entity-form-delete-button" aria-label="Delete component reference" (click)="removeComponent()">
|
|
@@ -1509,7 +1676,7 @@ class EntityComponentRefComponent {
|
|
|
1509
1676
|
}
|
|
1510
1677
|
`, isInline: true, styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:20px}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}\n"], dependencies: [{ kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
1511
1678
|
}
|
|
1512
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1679
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: EntityComponentRefComponent, decorators: [{
|
|
1513
1680
|
type: Component,
|
|
1514
1681
|
args: [{ selector: 'app-entity-component-ref', standalone: true, imports: [MatIconButton, MatIcon], template: `
|
|
1515
1682
|
<a href="" (click)="navigateToRelated($event)">{{ componentName() }}</a>
|
|
@@ -1522,15 +1689,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
1522
1689
|
}], propDecorators: { entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: true }] }], component: [{ type: i0.Input, args: [{ isSignal: true, alias: "component", required: true }] }], componentNameAttr: [{ type: i0.Input, args: [{ isSignal: true, alias: "componentNameAttr", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], linkedEntityType: [{ type: i0.Input, args: [{ isSignal: true, alias: "linkedEntityType", required: true }] }] } });
|
|
1523
1690
|
|
|
1524
1691
|
class EntityComponentsListComponent extends BaseFormControlComponent {
|
|
1525
|
-
logger = inject(NGXLogger);
|
|
1526
|
-
linkedEntityType = computed(() => {
|
|
1527
|
-
this.logger.debug('config(): ', this.config());
|
|
1528
|
-
const linkedEntityType = this.config().linkedEntityType;
|
|
1529
|
-
if (linkedEntityType === undefined) {
|
|
1530
|
-
throw new Error('linkedEntityType should be defined for EntityComponentsListComponent.');
|
|
1531
|
-
}
|
|
1532
|
-
return linkedEntityType;
|
|
1533
|
-
}, ...(ngDevMode ? [{ debugName: "linkedEntityType" }] : /* istanbul ignore next */ []));
|
|
1534
1692
|
ngOnInit() {
|
|
1535
1693
|
this.addSelectedComponentFromNavigatorResponse();
|
|
1536
1694
|
}
|
|
@@ -1598,8 +1756,8 @@ class EntityComponentsListComponent extends BaseFormControlComponent {
|
|
|
1598
1756
|
invalidControls: controls.filter((control) => control.invalid),
|
|
1599
1757
|
};
|
|
1600
1758
|
}
|
|
1601
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1602
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1759
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: EntityComponentsListComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1760
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: EntityComponentsListComponent, isStandalone: true, selector: "app-component-list", usesInheritance: true, ngImport: i0, template: `
|
|
1603
1761
|
@if (config().visible) {
|
|
1604
1762
|
<div class="row">
|
|
1605
1763
|
<fieldset class="base-entity-form-field" [ngClass]="config().styleClass" [ngStyle]="config().style">
|
|
@@ -1629,7 +1787,7 @@ class EntityComponentsListComponent extends BaseFormControlComponent {
|
|
|
1629
1787
|
}
|
|
1630
1788
|
`, isInline: true, styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:20px}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: EntityComponentRefComponent, selector: "app-entity-component-ref", inputs: ["entity", "component", "componentNameAttr", "disabled", "formGroup", "linkedEntityType"] }, { kind: "component", type: 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: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
1631
1789
|
}
|
|
1632
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1790
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: EntityComponentsListComponent, decorators: [{
|
|
1633
1791
|
type: Component,
|
|
1634
1792
|
args: [{ selector: 'app-component-list', standalone: true, imports: [NgClass, NgStyle, EntityComponentRefComponent, MatButton, MatIcon], template: `
|
|
1635
1793
|
@if (config().visible) {
|
|
@@ -1703,8 +1861,8 @@ class LookupComponent extends BaseFormControlComponent {
|
|
|
1703
1861
|
}
|
|
1704
1862
|
});
|
|
1705
1863
|
}
|
|
1706
|
-
selectLookupItem(
|
|
1707
|
-
this.setLookupKey(String(
|
|
1864
|
+
selectLookupItem(selectedValue) {
|
|
1865
|
+
this.setLookupKey(String(selectedValue ?? ''));
|
|
1708
1866
|
this.restoreSelectedValue();
|
|
1709
1867
|
}
|
|
1710
1868
|
restoreSelectedValue() {
|
|
@@ -1714,15 +1872,14 @@ class LookupComponent extends BaseFormControlComponent {
|
|
|
1714
1872
|
this.filterText.set(displayValue);
|
|
1715
1873
|
}
|
|
1716
1874
|
navigateToRelated() {
|
|
1717
|
-
const relatedEntityName = this.config().linkedEntityType?.entityName;
|
|
1718
1875
|
const relatedEntityId = this.selectedLookupItem()?.id ?? this.lookupKey();
|
|
1719
|
-
if (!
|
|
1876
|
+
if (!relatedEntityId) {
|
|
1720
1877
|
return;
|
|
1721
1878
|
}
|
|
1722
|
-
this.formNavigator.navigateToRelated(
|
|
1879
|
+
this.formNavigator.navigateToRelated(this.linkedEntityType().entityName, relatedEntityId, this.formNavigator.determineCurrentUrl());
|
|
1723
1880
|
}
|
|
1724
1881
|
canNavigateToRelated() {
|
|
1725
|
-
return !!
|
|
1882
|
+
return !!(this.selectedLookupItem()?.id ?? this.lookupKey());
|
|
1726
1883
|
}
|
|
1727
1884
|
lookupDisplayValue(lookupItem) {
|
|
1728
1885
|
return lookupItem.value === undefined || lookupItem.value === null ? lookupItem.key : String(lookupItem.value);
|
|
@@ -1765,8 +1922,8 @@ class LookupComponent extends BaseFormControlComponent {
|
|
|
1765
1922
|
}
|
|
1766
1923
|
lookupStore.load({});
|
|
1767
1924
|
}
|
|
1768
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1769
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1925
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: LookupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1926
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: LookupComponent, isStandalone: true, selector: "lookup-control", usesInheritance: true, ngImport: i0, template: `
|
|
1770
1927
|
<ng-container *ngIf="config().visible">
|
|
1771
1928
|
<div class="row" [formGroup]="formGroup">
|
|
1772
1929
|
<mat-form-field>
|
|
@@ -1775,7 +1932,7 @@ class LookupComponent extends BaseFormControlComponent {
|
|
|
1775
1932
|
<button type="button" mat-icon-button matSuffix [disabled]="!canNavigateToRelated()" (click)="navigateToRelated()" aria-label="Related entity">
|
|
1776
1933
|
<mat-icon>link</mat-icon>
|
|
1777
1934
|
</button>
|
|
1778
|
-
<mat-autocomplete #lookupOptions="matAutocomplete" (optionSelected)="selectLookupItem($event)">
|
|
1935
|
+
<mat-autocomplete #lookupOptions="matAutocomplete" (optionSelected)="selectLookupItem($any($event).option.value)">
|
|
1779
1936
|
@for (lookupItem of filteredLookupItems(); track lookupItem.key) {
|
|
1780
1937
|
<mat-option [value]="lookupItem.key">{{ lookupDisplayValue(lookupItem) }}</mat-option>
|
|
1781
1938
|
}
|
|
@@ -1784,9 +1941,9 @@ class LookupComponent extends BaseFormControlComponent {
|
|
|
1784
1941
|
<input type="hidden" [formControlName]="config().attrName" />
|
|
1785
1942
|
</div>
|
|
1786
1943
|
</ng-container>
|
|
1787
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: 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: MatAutocompleteModule }, { kind: "component", type: i2$
|
|
1944
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: 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: MatAutocompleteModule }, { kind: "component", type: i2$2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i2$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i2$2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }] });
|
|
1788
1945
|
}
|
|
1789
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1946
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: LookupComponent, decorators: [{
|
|
1790
1947
|
type: Component,
|
|
1791
1948
|
args: [{
|
|
1792
1949
|
selector: 'lookup-control',
|
|
@@ -1800,7 +1957,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
1800
1957
|
<button type="button" mat-icon-button matSuffix [disabled]="!canNavigateToRelated()" (click)="navigateToRelated()" aria-label="Related entity">
|
|
1801
1958
|
<mat-icon>link</mat-icon>
|
|
1802
1959
|
</button>
|
|
1803
|
-
<mat-autocomplete #lookupOptions="matAutocomplete" (optionSelected)="selectLookupItem($event)">
|
|
1960
|
+
<mat-autocomplete #lookupOptions="matAutocomplete" (optionSelected)="selectLookupItem($any($event).option.value)">
|
|
1804
1961
|
@for (lookupItem of filteredLookupItems(); track lookupItem.key) {
|
|
1805
1962
|
<mat-option [value]="lookupItem.key">{{ lookupDisplayValue(lookupItem) }}</mat-option>
|
|
1806
1963
|
}
|
|
@@ -1843,10 +2000,8 @@ class BaseEntityFormBuilder {
|
|
|
1843
2000
|
componentRef.instance.store = store;
|
|
1844
2001
|
this.buildForm(componentRef.instance.flexBoxHost.viewContainerRef, baseEntityForm, store, column.attrDescriptors, entity);
|
|
1845
2002
|
}
|
|
1846
|
-
else
|
|
1847
|
-
|
|
1848
|
-
throw Error('Undefined subclass of AbstractAttrDescriptor.');
|
|
1849
|
-
}
|
|
2003
|
+
else
|
|
2004
|
+
throw Error('Undefined subclass of AbstractAttrDescriptor');
|
|
1850
2005
|
}
|
|
1851
2006
|
});
|
|
1852
2007
|
}
|
|
@@ -1892,15 +2047,13 @@ class BaseEntityFormBuilder {
|
|
|
1892
2047
|
else if (column.formControlType === FormControlType.TEXT_BOX) {
|
|
1893
2048
|
return TextboxComponent;
|
|
1894
2049
|
}
|
|
1895
|
-
else
|
|
1896
|
-
|
|
1897
|
-
throw Error('Undefined form control type.');
|
|
1898
|
-
}
|
|
2050
|
+
else
|
|
2051
|
+
throw Error('Undefined form control type');
|
|
1899
2052
|
}
|
|
1900
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1901
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
2053
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityFormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2054
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityFormBuilder, providedIn: 'root' });
|
|
1902
2055
|
}
|
|
1903
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
2056
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityFormBuilder, decorators: [{
|
|
1904
2057
|
type: Injectable,
|
|
1905
2058
|
args: [{ providedIn: 'root' }]
|
|
1906
2059
|
}] });
|
|
@@ -1910,12 +2063,12 @@ class BaseEntityFormComponent {
|
|
|
1910
2063
|
entityDescriptor = inject(ROUTER_OUTLET_DATA);
|
|
1911
2064
|
entity = computed(() => (this.isNewObject() ? this.store().createEntity() : this.store().loadById(this.entityId())), ...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
|
|
1912
2065
|
entityId = input.required(...(ngDevMode ? [{ debugName: "entityId" }] : /* istanbul ignore next */ []));
|
|
1913
|
-
|
|
2066
|
+
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : /* istanbul ignore next */ []));
|
|
1914
2067
|
store = computed(() => this.entityDescriptor().store, ...(ngDevMode ? [{ debugName: "store" }] : /* istanbul ignore next */ []));
|
|
2068
|
+
componentHost;
|
|
1915
2069
|
entityFormBuilder = inject((BaseEntityFormBuilder));
|
|
1916
2070
|
formBuilder = inject(FormBuilder);
|
|
1917
2071
|
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
1918
|
-
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : /* istanbul ignore next */ []));
|
|
1919
2072
|
logger = inject(NGXLogger);
|
|
1920
2073
|
constructor() {
|
|
1921
2074
|
this.registerEffects();
|
|
@@ -1933,15 +2086,19 @@ class BaseEntityFormComponent {
|
|
|
1933
2086
|
this.store().setCurrentEntity(undefined);
|
|
1934
2087
|
await this.formNavigator.navigateBack();
|
|
1935
2088
|
}
|
|
2089
|
+
async onDelete() {
|
|
2090
|
+
await this.store().delete(this.entityId());
|
|
2091
|
+
await this.formNavigator.navigateBack();
|
|
2092
|
+
}
|
|
1936
2093
|
async onSubmit() {
|
|
1937
2094
|
const objectToSave = { ...this.entity(), ...this.baseEntityForm.value };
|
|
2095
|
+
this.store().setCurrentEntity(undefined);
|
|
1938
2096
|
if (this.isNewObject()) {
|
|
1939
|
-
this.store().add(objectToSave);
|
|
2097
|
+
await this.store().add(objectToSave);
|
|
1940
2098
|
}
|
|
1941
2099
|
else {
|
|
1942
|
-
this.store().update(objectToSave
|
|
2100
|
+
await this.store().update(objectToSave);
|
|
1943
2101
|
}
|
|
1944
|
-
this.store().setCurrentEntity(undefined);
|
|
1945
2102
|
await this.formNavigator.navigateBack();
|
|
1946
2103
|
}
|
|
1947
2104
|
// endregion
|
|
@@ -1958,29 +2115,17 @@ class BaseEntityFormComponent {
|
|
|
1958
2115
|
this.store().setCurrentEntity(this.entity().id);
|
|
1959
2116
|
});
|
|
1960
2117
|
}
|
|
1961
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1962
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
2118
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2119
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.13", type: BaseEntityFormComponent, isStandalone: true, selector: "base-form", inputs: { entityId: { classPropertyName: "entityId", publicName: "entityId", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }], viewQueries: [{ propertyName: "componentHost", first: true, predicate: BaseFormHostDirective, descendants: true, read: BaseFormHostDirective, static: true }], ngImport: i0, template: "<mat-card appearance=\"outlined\" class=\"dense-3\">\n <mat-card-content>\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\">\n <ng-template baseFormHost></ng-template>\n </form>\n </mat-card-content>\n <mat-card-actions>\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\n <button id=\"delete\" [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-raised-button color=\"primary\" type=\"button\" [disabled]=\"isNewObject()\" (click)=\"onDelete()\">Delete</button>\n <button id=\"submit\" [attr.data-testid]=\"entityDescriptor().createTestId('save')\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"baseEntityForm.invalid || !baseEntityForm.dirty\" (click)=\"onSubmit()\">Save</button>\n </mat-card-actions>\n</mat-card>\n", dependencies: [{ kind: "directive", type: BaseFormHostDirective, selector: "[baseFormHost]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "component", type: 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"] }] });
|
|
1963
2120
|
}
|
|
1964
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
2121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityFormComponent, decorators: [{
|
|
1965
2122
|
type: Component,
|
|
1966
|
-
args: [{ selector: 'base-form', standalone: true, imports: [BaseFormHostDirective, ReactiveFormsModule, MatCard, MatCardContent, MatCardActions, MatButton], providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }], template: "<mat-card appearance=\"outlined\" class=\"dense-3\">\n <mat-card-content>\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\">\n <ng-template baseFormHost></ng-template>\n </form>\n </mat-card-content>\n <mat-card-actions>\n <button id=\"cancel\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\n <button id=\"submit\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"baseEntityForm.invalid || !baseEntityForm.dirty\" (click)=\"onSubmit()\">Save</button>\n </mat-card-actions>\n</mat-card>\n" }]
|
|
2123
|
+
args: [{ selector: 'base-form', standalone: true, imports: [BaseFormHostDirective, ReactiveFormsModule, MatCard, MatCardContent, MatCardActions, MatButton], providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }], template: "<mat-card appearance=\"outlined\" class=\"dense-3\">\n <mat-card-content>\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\">\n <ng-template baseFormHost></ng-template>\n </form>\n </mat-card-content>\n <mat-card-actions>\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\n <button id=\"delete\" [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-raised-button color=\"primary\" type=\"button\" [disabled]=\"isNewObject()\" (click)=\"onDelete()\">Delete</button>\n <button id=\"submit\" [attr.data-testid]=\"entityDescriptor().createTestId('save')\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"baseEntityForm.invalid || !baseEntityForm.dirty\" (click)=\"onSubmit()\">Save</button>\n </mat-card-actions>\n</mat-card>\n" }]
|
|
1967
2124
|
}], ctorParameters: () => [], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }], componentHost: [{
|
|
1968
2125
|
type: ViewChild,
|
|
1969
2126
|
args: [BaseFormHostDirective, { static: true, read: BaseFormHostDirective }]
|
|
1970
2127
|
}] } });
|
|
1971
2128
|
|
|
1972
|
-
function filterAttributeDescriptors(descriptors) {
|
|
1973
|
-
let attrDescriptors = [];
|
|
1974
|
-
descriptors.forEach((descriptor) => {
|
|
1975
|
-
if (descriptor instanceof BaseEntityAttrDescriptor)
|
|
1976
|
-
attrDescriptors.push(descriptor);
|
|
1977
|
-
else if (descriptor instanceof FlexboxDescriptor) {
|
|
1978
|
-
attrDescriptors = attrDescriptors.concat(filterAttributeDescriptors(descriptor.attrDescriptors));
|
|
1979
|
-
}
|
|
1980
|
-
});
|
|
1981
|
-
return attrDescriptors;
|
|
1982
|
-
}
|
|
1983
|
-
|
|
1984
2129
|
class BaseEntityDescriptor {
|
|
1985
2130
|
store;
|
|
1986
2131
|
attrDescriptors;
|
|
@@ -1992,6 +2137,9 @@ class BaseEntityDescriptor {
|
|
|
1992
2137
|
this.entityName = entityName;
|
|
1993
2138
|
this.entityTitle = entityTitle ?? '';
|
|
1994
2139
|
}
|
|
2140
|
+
createTestId(suffix) {
|
|
2141
|
+
return createTestId(this.entityName, suffix);
|
|
2142
|
+
}
|
|
1995
2143
|
componentIdentification() {
|
|
1996
2144
|
const attrDescriptor = filterAttributeDescriptors(this.attrDescriptors).find((attrDescriptor) => attrDescriptor.isLinkToDetails === true);
|
|
1997
2145
|
return attrDescriptor?.attrName ?? '';
|
|
@@ -2130,10 +2278,7 @@ class BaseEntityListComponent {
|
|
|
2130
2278
|
}
|
|
2131
2279
|
registerEffects() {
|
|
2132
2280
|
effect(() => (this.dataSource.data = this.store.entities()));
|
|
2133
|
-
effect(() =>
|
|
2134
|
-
if (this.store.filterKey())
|
|
2135
|
-
this.doFilter(this.store.filterKey());
|
|
2136
|
-
});
|
|
2281
|
+
effect(() => this.doFilter(this.store.filterKey() ?? ''));
|
|
2137
2282
|
}
|
|
2138
2283
|
// endregion
|
|
2139
2284
|
// region properties
|
|
@@ -2148,10 +2293,10 @@ class BaseEntityListComponent {
|
|
|
2148
2293
|
canSelectEntity() {
|
|
2149
2294
|
return this.selection.selected.length === 1;
|
|
2150
2295
|
}
|
|
2151
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
2152
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
2296
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2297
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: BaseEntityListComponent, isStandalone: true, selector: "base-list", viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<div class=\"base-entity-list mat-elevation-z8\">\n <mat-table [dataSource]=\"dataSource\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n\n @for (colDescriptor of columnDescriptors(); track colDescriptor.attrName; let i = $index) {\n <ng-container [matColumnDef]=\"colDescriptor.attrName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</mat-header-cell>\n <mat-cell (click)=\"onRowClick(element)\" *matCellDef=\"let element\">\n @if (colDescriptor.isLinkToDetails) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.formControlType === 'ARTIFACT' && element[colDescriptor.attrName] !== undefined ) {\n @let artifact = element[colDescriptor.attrName];\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.objectId ?? '') | slice:0:20) + ((artifact.name ?? artifact.objectId ?? '').length > 20 ? '...' : '') }}</a>\n } @else if (colDescriptor.formControlType === 'TAGS' && element[colDescriptor.attrName] !== undefined ) {\n {{ (element[colDescriptor.attrName].join(', ') | slice:0:20) + (element[colDescriptor.attrName].join(', ').length > 20 ? '...' : '') }}\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </mat-cell>\n </ng-container>\n }\n <mat-header-row *matHeaderRowDef=\"displayedColumns()\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns()\"></mat-row>\n </mat-table>\n <mat-paginator [pageSizeOptions]=\"[10, 20, 50]\" showFirstLastButtons></mat-paginator>\n</div>\n@if (selectOrCreateMode) {\n <div class=\"base-entity-list-actions\">\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" type=\"button\" mat-raised-button color=\"secondary\" (click)=\"onCancelSelectOrCreate()\">Cancel</button>\n <button id=\"select\" [attr.data-testid]=\"entityDescriptor().createTestId( 'select')\" type=\"button\" mat-raised-button color=\"primary\" [disabled]=\"!canSelectEntity()\" (click)=\"onSelectEntity()\">Select</button>\n </div>\n}\n", styles: [".base-entity-list{display:flex;flex-direction:column;max-height:500px;min-width:300px}.mat-table{overflow:auto;max-height:500px}.mat-column-select{overflow:visible}.mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}.base-entity-list-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}\n"], dependencies: [{ kind: "component", type: MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "component", type: MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: 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: "component", type: 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: "pipe", type: SlicePipe, name: "slice" }] });
|
|
2153
2298
|
}
|
|
2154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
2299
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityListComponent, decorators: [{
|
|
2155
2300
|
type: Component,
|
|
2156
2301
|
args: [{ selector: 'base-list', standalone: true, imports: [
|
|
2157
2302
|
MatTable,
|
|
@@ -2171,7 +2316,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
2171
2316
|
MatCheckbox,
|
|
2172
2317
|
SlicePipe,
|
|
2173
2318
|
MatButton,
|
|
2174
|
-
], template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<div class=\"base-entity-list mat-elevation-z8\">\n <mat-table [dataSource]=\"dataSource\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n\n @for (colDescriptor of columnDescriptors(); track colDescriptor.attrName; let i = $index) {\n <ng-container [matColumnDef]=\"colDescriptor.attrName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</mat-header-cell>\n <mat-cell (click)=\"onRowClick(element)\" *matCellDef=\"let element\">\n @if (colDescriptor.isLinkToDetails) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.formControlType === 'ARTIFACT' && element[colDescriptor.attrName] !== undefined ) {\n @let artifact = element[colDescriptor.attrName];\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.objectId ?? '') | slice:0:20) + ((artifact.name ?? artifact.objectId ?? '').length > 20 ? '...' : '') }}</a>\n } @else if (colDescriptor.formControlType === 'TAGS' && element[colDescriptor.attrName] !== undefined ) {\n {{ (element[colDescriptor.attrName].join(', ') | slice:0:20) + (element[colDescriptor.attrName].join(', ').length > 20 ? '...' : '') }}\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </mat-cell>\n </ng-container>\n }\n <mat-header-row *matHeaderRowDef=\"displayedColumns()\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns()\"></mat-row>\n </mat-table>\n <mat-paginator [pageSizeOptions]=\"[
|
|
2319
|
+
], template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<div class=\"base-entity-list mat-elevation-z8\">\n <mat-table [dataSource]=\"dataSource\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n\n @for (colDescriptor of columnDescriptors(); track colDescriptor.attrName; let i = $index) {\n <ng-container [matColumnDef]=\"colDescriptor.attrName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</mat-header-cell>\n <mat-cell (click)=\"onRowClick(element)\" *matCellDef=\"let element\">\n @if (colDescriptor.isLinkToDetails) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.formControlType === 'ARTIFACT' && element[colDescriptor.attrName] !== undefined ) {\n @let artifact = element[colDescriptor.attrName];\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.objectId ?? '') | slice:0:20) + ((artifact.name ?? artifact.objectId ?? '').length > 20 ? '...' : '') }}</a>\n } @else if (colDescriptor.formControlType === 'TAGS' && element[colDescriptor.attrName] !== undefined ) {\n {{ (element[colDescriptor.attrName].join(', ') | slice:0:20) + (element[colDescriptor.attrName].join(', ').length > 20 ? '...' : '') }}\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </mat-cell>\n </ng-container>\n }\n <mat-header-row *matHeaderRowDef=\"displayedColumns()\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns()\"></mat-row>\n </mat-table>\n <mat-paginator [pageSizeOptions]=\"[10, 20, 50]\" showFirstLastButtons></mat-paginator>\n</div>\n@if (selectOrCreateMode) {\n <div class=\"base-entity-list-actions\">\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" type=\"button\" mat-raised-button color=\"secondary\" (click)=\"onCancelSelectOrCreate()\">Cancel</button>\n <button id=\"select\" [attr.data-testid]=\"entityDescriptor().createTestId( 'select')\" type=\"button\" mat-raised-button color=\"primary\" [disabled]=\"!canSelectEntity()\" (click)=\"onSelectEntity()\">Select</button>\n </div>\n}\n", styles: [".base-entity-list{display:flex;flex-direction:column;max-height:500px;min-width:300px}.mat-table{overflow:auto;max-height:500px}.mat-column-select{overflow:visible}.mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}.base-entity-list-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}\n"] }]
|
|
2175
2320
|
}], ctorParameters: () => [], propDecorators: { sort: [{
|
|
2176
2321
|
type: ViewChild,
|
|
2177
2322
|
args: [MatSort]
|
|
@@ -2187,6 +2332,20 @@ var OrderByDirection;
|
|
|
2187
2332
|
})(OrderByDirection || (OrderByDirection = {}));
|
|
2188
2333
|
|
|
2189
2334
|
const BASE_ENTITY_MAPPER = new InjectionToken('BASE_ENTITY_MAPPER');
|
|
2335
|
+
class SimpleEntityMapper {
|
|
2336
|
+
entityType;
|
|
2337
|
+
constructor(entityType) {
|
|
2338
|
+
this.entityType = entityType;
|
|
2339
|
+
}
|
|
2340
|
+
fromDto(dto) {
|
|
2341
|
+
const entity = new this.entityType();
|
|
2342
|
+
Object.assign(entity, dto);
|
|
2343
|
+
return entity;
|
|
2344
|
+
}
|
|
2345
|
+
toDto(entity) {
|
|
2346
|
+
return { ...entity };
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2190
2349
|
function getEnumKeyByValue(myEnum, enumValue) {
|
|
2191
2350
|
return Object.values(myEnum)[enumValue];
|
|
2192
2351
|
}
|
|
@@ -2194,60 +2353,149 @@ function getEnumValueByKey(myEnum, enumKey) {
|
|
|
2194
2353
|
return myEnum[enumKey];
|
|
2195
2354
|
}
|
|
2196
2355
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2356
|
+
let BaseEntityFirestoreService = class BaseEntityFirestoreService {
|
|
2357
|
+
entityMapper;
|
|
2358
|
+
collectionName;
|
|
2359
|
+
collection;
|
|
2360
|
+
firestore = inject(Firestore);
|
|
2361
|
+
constructor(entityMapper, collectionName) {
|
|
2362
|
+
this.entityMapper = entityMapper;
|
|
2363
|
+
this.collectionName = collectionName;
|
|
2364
|
+
this.collection = collection(this.firestore, collectionName);
|
|
2365
|
+
}
|
|
2366
|
+
// region public accessors and mutators
|
|
2367
|
+
add(entity) {
|
|
2368
|
+
if (!entity)
|
|
2369
|
+
throw new Error('Entity cant be undefined');
|
|
2370
|
+
return from(this.addAsync(entity));
|
|
2371
|
+
}
|
|
2372
|
+
delete(id) {
|
|
2373
|
+
const docRef = doc(this.firestore, this.collectionName, id);
|
|
2374
|
+
return from(deleteDoc(docRef));
|
|
2375
|
+
}
|
|
2376
|
+
deleteAll() {
|
|
2377
|
+
return of(undefined);
|
|
2378
|
+
}
|
|
2379
|
+
findAll(page, pageSize) {
|
|
2380
|
+
return this.findByQuery({ page, pageSize });
|
|
2381
|
+
}
|
|
2382
|
+
findById(id) {
|
|
2383
|
+
const docRef = doc(this.firestore, this.collectionName, id);
|
|
2384
|
+
return from(getDoc(docRef)
|
|
2385
|
+
.then((document) => {
|
|
2386
|
+
return this.mapDocument(document.data());
|
|
2387
|
+
})
|
|
2388
|
+
.catch((error) => {
|
|
2389
|
+
throw new Error(`Error: ${error} occurred while finding document by id: ${id}`);
|
|
2390
|
+
}));
|
|
2391
|
+
}
|
|
2392
|
+
findByQuery(queryCondition) {
|
|
2393
|
+
return from(this.findByQueryAsync(queryCondition));
|
|
2394
|
+
}
|
|
2395
|
+
update(entity) {
|
|
2396
|
+
return from(this.updateAsync(entity));
|
|
2397
|
+
}
|
|
2398
|
+
// endregion
|
|
2399
|
+
// protected, private helper methods
|
|
2400
|
+
async addAsync(entity) {
|
|
2401
|
+
const newDoc = doc(this.collection, entity.id);
|
|
2402
|
+
await setDoc(newDoc, this.mapEntity(entity));
|
|
2403
|
+
return new Promise((resolve, reject) => {
|
|
2404
|
+
resolve(entity);
|
|
2405
|
+
reject(new Error('Failed to update entity: ' + entity));
|
|
2406
|
+
});
|
|
2407
|
+
}
|
|
2408
|
+
createQuery(queryCondition) {
|
|
2409
|
+
let orderBys = [];
|
|
2410
|
+
if (queryCondition.orderBys && queryCondition.orderBys?.length > 0) {
|
|
2411
|
+
orderBys = queryCondition.orderBys?.map((orderByCondition) => {
|
|
2412
|
+
const name = Object.keys(OrderByDirection).filter((key) => key === orderByCondition.direction);
|
|
2413
|
+
const direction = Object.values(OrderByDirection).filter((value) => value === name[0]);
|
|
2414
|
+
return orderBy(orderByCondition.property, direction[0]);
|
|
2415
|
+
});
|
|
2216
2416
|
}
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2417
|
+
let wheres = [];
|
|
2418
|
+
if (queryCondition.filters && queryCondition.filters?.length > 0) {
|
|
2419
|
+
wheres =
|
|
2420
|
+
queryCondition.filters?.map((filter) => {
|
|
2421
|
+
return where(filter.property, filter.operator, filter.value);
|
|
2422
|
+
}) ?? [];
|
|
2220
2423
|
}
|
|
2221
|
-
return
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
const
|
|
2424
|
+
return query(this.collection, ...wheres, ...orderBys, limit(queryCondition.pageSize ?? 99));
|
|
2425
|
+
}
|
|
2426
|
+
async findByQueryAsync(queryCondition) {
|
|
2427
|
+
const query = this.createQuery(queryCondition);
|
|
2428
|
+
const results = await getDocs(query);
|
|
2429
|
+
const content = [];
|
|
2430
|
+
results.docs.forEach((doc) => {
|
|
2431
|
+
content.push(this.mapDocument({ id: doc.id, ...doc.data() }));
|
|
2432
|
+
});
|
|
2433
|
+
return Promise.resolve({
|
|
2434
|
+
page: queryCondition.page,
|
|
2435
|
+
pageSize: queryCondition.pageSize,
|
|
2436
|
+
totalPageCount: 1,
|
|
2437
|
+
content,
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
mapCollection(collection) {
|
|
2441
|
+
const entities = [];
|
|
2442
|
+
collection.pipe(map((documents) => {
|
|
2443
|
+
documents.forEach((document) => entities.push(this.entityMapper.fromDto(document)));
|
|
2444
|
+
}));
|
|
2445
|
+
return entities;
|
|
2446
|
+
}
|
|
2447
|
+
mapDocument(document) {
|
|
2448
|
+
return this.entityMapper.fromDto(document);
|
|
2449
|
+
}
|
|
2450
|
+
mapEntity(entity) {
|
|
2451
|
+
return this.entityMapper.toDto(entity);
|
|
2452
|
+
}
|
|
2453
|
+
async updateAsync(entity) {
|
|
2454
|
+
if (!entity)
|
|
2455
|
+
throw new Error('Entity cant be undefined');
|
|
2456
|
+
const docRef = doc(this.firestore, this.collectionName, entity.id);
|
|
2457
|
+
await updateDoc(docRef, this.mapEntity(entity));
|
|
2458
|
+
return Promise.resolve(entity);
|
|
2459
|
+
}
|
|
2460
|
+
};
|
|
2461
|
+
BaseEntityFirestoreService = __decorate([
|
|
2462
|
+
__param(0, Inject('entityMapper'))
|
|
2463
|
+
], BaseEntityFirestoreService);
|
|
2226
2464
|
|
|
2227
2465
|
const addEntity = (store, repository) => {
|
|
2228
|
-
return
|
|
2466
|
+
return async (entity) => {
|
|
2229
2467
|
patchState(store, { isLoading: true, error: undefined });
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2468
|
+
try {
|
|
2469
|
+
const savedEntity = await firstValueFrom(repository.add(entity));
|
|
2470
|
+
patchState(store, { entities: store.entities().concat([savedEntity]), isLoading: false });
|
|
2471
|
+
return savedEntity;
|
|
2472
|
+
}
|
|
2473
|
+
catch (error) {
|
|
2474
|
+
patchState(store, { error: error.message, isLoading: false });
|
|
2475
|
+
return undefined;
|
|
2476
|
+
}
|
|
2477
|
+
};
|
|
2238
2478
|
};
|
|
2239
2479
|
|
|
2240
2480
|
const deleteEntity = (store, repository) => {
|
|
2241
|
-
return
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2481
|
+
return async (id) => {
|
|
2482
|
+
patchState(store, { isLoading: true, error: undefined });
|
|
2483
|
+
try {
|
|
2484
|
+
await firstValueFrom(repository.delete(id));
|
|
2485
|
+
const remainingEntities = store.entities().filter((entity) => entity.id !== id);
|
|
2486
|
+
const remainingSelectedEntities = store.selectedEntities().filter((entity) => entity.id !== id);
|
|
2487
|
+
patchState(store, {
|
|
2488
|
+
currentEntity: undefined,
|
|
2489
|
+
currentId: undefined,
|
|
2490
|
+
entities: remainingEntities,
|
|
2491
|
+
selectedEntities: remainingSelectedEntities,
|
|
2492
|
+
isLoading: false,
|
|
2493
|
+
});
|
|
2494
|
+
}
|
|
2495
|
+
catch (error) {
|
|
2496
|
+
patchState(store, { error: error.message, isLoading: false });
|
|
2497
|
+
}
|
|
2498
|
+
};
|
|
2251
2499
|
};
|
|
2252
2500
|
|
|
2253
2501
|
const deleteAllEntities = (store, repository) => {
|
|
@@ -2262,19 +2510,22 @@ const deleteAllEntities = (store, repository) => {
|
|
|
2262
2510
|
};
|
|
2263
2511
|
|
|
2264
2512
|
const updateEntity = (store, repository) => {
|
|
2265
|
-
return
|
|
2513
|
+
return async (entity) => {
|
|
2266
2514
|
patchState(store, { isLoading: true, error: undefined });
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2515
|
+
try {
|
|
2516
|
+
const updatedEntity = await firstValueFrom(repository.update(entity));
|
|
2517
|
+
const currentEntities = [...store.entities()];
|
|
2518
|
+
const indexToUpdate = currentEntities.findIndex((item) => item.id === entity.id);
|
|
2519
|
+
if (indexToUpdate >= 0)
|
|
2271
2520
|
currentEntities[indexToUpdate] = updatedEntity;
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2521
|
+
patchState(store, { entities: currentEntities, isLoading: false });
|
|
2522
|
+
return updatedEntity;
|
|
2523
|
+
}
|
|
2524
|
+
catch (error) {
|
|
2525
|
+
patchState(store, { error: error.message, isLoading: false });
|
|
2526
|
+
return undefined;
|
|
2527
|
+
}
|
|
2528
|
+
};
|
|
2278
2529
|
};
|
|
2279
2530
|
|
|
2280
2531
|
const findByQuery = (store, repository) => {
|
|
@@ -2310,10 +2561,7 @@ const findByQuery = (store, repository) => {
|
|
|
2310
2561
|
};
|
|
2311
2562
|
|
|
2312
2563
|
const BASE_ENTITY_STORE = new InjectionToken('BASE_ENTITY_STORE');
|
|
2313
|
-
function
|
|
2314
|
-
return entityType.name ?? 'base-entity';
|
|
2315
|
-
}
|
|
2316
|
-
function BaseEntityStore(entityType, repositoryType) {
|
|
2564
|
+
function BaseEntityStore(entityType, getRepository) {
|
|
2317
2565
|
return signalStoreFeature(withState({
|
|
2318
2566
|
entities: [],
|
|
2319
2567
|
page: 0,
|
|
@@ -2324,7 +2572,7 @@ function BaseEntityStore(entityType, repositoryType) {
|
|
|
2324
2572
|
isLoading: false,
|
|
2325
2573
|
error: undefined,
|
|
2326
2574
|
selectedEntities: [],
|
|
2327
|
-
}), withDevtools(entityNameFromType(entityType)), withMethods((store, repository =
|
|
2575
|
+
}), withDevtools(entityNameFromType(entityType)), withMethods((store, repository = getRepository()) => ({
|
|
2328
2576
|
clearCurrentEntity: () => patchState(store, { currentEntity: undefined }),
|
|
2329
2577
|
createEntity: () => new entityType(),
|
|
2330
2578
|
add: addEntity(store, repository),
|
|
@@ -2379,114 +2627,99 @@ function BaseEntityStore(entityType, repositoryType) {
|
|
|
2379
2627
|
})));
|
|
2380
2628
|
}
|
|
2381
2629
|
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
}
|
|
2392
|
-
// region public accessors and mutators
|
|
2393
|
-
add(entity) {
|
|
2394
|
-
if (!entity)
|
|
2395
|
-
throw new Error('Entity cant be undefined');
|
|
2396
|
-
return from(this.addAsync(entity));
|
|
2397
|
-
}
|
|
2398
|
-
delete(id) {
|
|
2399
|
-
const docRef = doc(this.firestore, this.collectionName, id);
|
|
2400
|
-
return from(deleteDoc(docRef));
|
|
2401
|
-
}
|
|
2402
|
-
deleteAll() {
|
|
2403
|
-
return of(undefined);
|
|
2404
|
-
}
|
|
2405
|
-
findAll(page, pageSize) {
|
|
2406
|
-
return this.findByQuery({ page, pageSize });
|
|
2407
|
-
}
|
|
2408
|
-
findById(id) {
|
|
2409
|
-
const docRef = doc(this.firestore, this.collectionName, id);
|
|
2410
|
-
return from(getDoc(docRef)
|
|
2411
|
-
.then((document) => {
|
|
2412
|
-
return this.mapDocument(document.data());
|
|
2413
|
-
})
|
|
2414
|
-
.catch((error) => {
|
|
2415
|
-
throw new Error(`Error: ${error} occurred while finding document by id: ${id}`);
|
|
2416
|
-
}));
|
|
2417
|
-
}
|
|
2418
|
-
findByQuery(queryCondition) {
|
|
2419
|
-
return from(this.findByQueryAsync(queryCondition));
|
|
2420
|
-
}
|
|
2421
|
-
update(entity) {
|
|
2422
|
-
return from(this.updateAsync(entity));
|
|
2423
|
-
}
|
|
2424
|
-
// endregion
|
|
2425
|
-
// protected, private helper methods
|
|
2426
|
-
async addAsync(entity) {
|
|
2427
|
-
const newDoc = doc(this.collection, entity.id);
|
|
2428
|
-
await setDoc(newDoc, this.mapEntity(entity));
|
|
2429
|
-
return new Promise((resolve, reject) => {
|
|
2430
|
-
resolve(entity);
|
|
2431
|
-
reject(new Error('Failed to update entity: ' + entity));
|
|
2432
|
-
});
|
|
2433
|
-
}
|
|
2434
|
-
createQuery(queryCondition) {
|
|
2435
|
-
let orderBys = [];
|
|
2436
|
-
if (queryCondition.orderBys && queryCondition.orderBys?.length > 0) {
|
|
2437
|
-
orderBys = queryCondition.orderBys?.map((orderByCondition) => {
|
|
2438
|
-
const name = Object.keys(OrderByDirection).filter((key) => key === orderByCondition.direction);
|
|
2439
|
-
const direction = Object.values(OrderByDirection).filter((value) => value === name[0]);
|
|
2440
|
-
return orderBy(orderByCondition.property, direction[0]);
|
|
2441
|
-
});
|
|
2630
|
+
const INITIAL_TABS_STATE = {
|
|
2631
|
+
activeTabs: [],
|
|
2632
|
+
currentTab: undefined,
|
|
2633
|
+
};
|
|
2634
|
+
function BaseEntityTabsStore() {
|
|
2635
|
+
return signalStoreFeature(withState(INITIAL_TABS_STATE), withMethods((store) => {
|
|
2636
|
+
function reset() {
|
|
2637
|
+
const activeTabs = [];
|
|
2638
|
+
patchState(store, { activeTabs, currentTab: undefined });
|
|
2442
2639
|
}
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2640
|
+
function tabIsActive(tabName) {
|
|
2641
|
+
let activeTabs;
|
|
2642
|
+
if (store.activeTabs().indexOf(tabName) == -1) {
|
|
2643
|
+
activeTabs = store.activeTabs().concat([tabName]);
|
|
2644
|
+
}
|
|
2645
|
+
else {
|
|
2646
|
+
activeTabs = store.activeTabs();
|
|
2647
|
+
}
|
|
2648
|
+
patchState(store, { activeTabs, currentTab: tabName });
|
|
2449
2649
|
}
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2650
|
+
function tabIsInactive(tabName) {
|
|
2651
|
+
const activeTabs = store.activeTabs().filter((tab) => tab !== tabName);
|
|
2652
|
+
patchState(store, { activeTabs, currentTab: undefined });
|
|
2653
|
+
}
|
|
2654
|
+
return { reset, tabIsActive, tabIsInactive };
|
|
2655
|
+
}));
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
class BaseEntityFacade {
|
|
2659
|
+
entityTitle = "this.store.currentEntity() ? this.store.currentEntity().name : ''";
|
|
2660
|
+
serviceKind = 'rest';
|
|
2661
|
+
endpoint;
|
|
2662
|
+
backendRoot;
|
|
2663
|
+
injector = inject(Injector);
|
|
2664
|
+
_mapper;
|
|
2665
|
+
_service;
|
|
2666
|
+
_storeClass;
|
|
2667
|
+
_storeInstance;
|
|
2668
|
+
_descriptor;
|
|
2669
|
+
get mapper() {
|
|
2670
|
+
return (this._mapper ??= this.createMapper());
|
|
2671
|
+
}
|
|
2672
|
+
get service() {
|
|
2673
|
+
return (this._service ??= this.createService(this.mapper));
|
|
2674
|
+
}
|
|
2675
|
+
get storeClass() {
|
|
2676
|
+
return (this._storeClass ??= this.createStoreClass());
|
|
2677
|
+
}
|
|
2678
|
+
get store() {
|
|
2679
|
+
return (this._storeInstance ??= runInInjectionContext(this.injector, () => inject(this.storeClass)));
|
|
2680
|
+
}
|
|
2681
|
+
get descriptor() {
|
|
2682
|
+
if (!this._descriptor) {
|
|
2683
|
+
this._descriptor = this.createDescriptor();
|
|
2684
|
+
this._descriptor.store = this.store;
|
|
2685
|
+
}
|
|
2686
|
+
return this._descriptor;
|
|
2687
|
+
}
|
|
2688
|
+
createMapper() {
|
|
2689
|
+
return new SimpleEntityMapper(this.entityType);
|
|
2690
|
+
}
|
|
2691
|
+
createService(mapper) {
|
|
2692
|
+
return runInInjectionContext(this.injector, () => {
|
|
2693
|
+
if (this.serviceKind === 'rest') {
|
|
2694
|
+
if (!this.backendRoot || !this.endpoint) {
|
|
2695
|
+
throw new Error(`${this.constructor.name}: REST facade requires backendRoot and endpoint`);
|
|
2696
|
+
}
|
|
2697
|
+
return new BaseEntityRestService(mapper, this.backendRoot, this.endpoint);
|
|
2698
|
+
}
|
|
2699
|
+
if (!this.endpoint) {
|
|
2700
|
+
throw new Error(`${this.constructor.name}: Firestore facade requires endpoint (collection name)`);
|
|
2701
|
+
}
|
|
2702
|
+
return new BaseEntityFirestoreService(mapper, this.endpoint);
|
|
2464
2703
|
});
|
|
2465
2704
|
}
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
collection.pipe(map((documents) => {
|
|
2469
|
-
documents.forEach((document) => entities.push(this.entityMapper.fromDto(document)));
|
|
2470
|
-
}));
|
|
2471
|
-
return entities;
|
|
2472
|
-
}
|
|
2473
|
-
mapDocument(document) {
|
|
2474
|
-
return this.entityMapper.fromDto(document);
|
|
2705
|
+
createStoreClass() {
|
|
2706
|
+
return signalStore({ providedIn: 'root' }, BaseEntityStore(this.entityType, () => this.service), BaseEntityTabsStore(), BaseEntityContainerStore());
|
|
2475
2707
|
}
|
|
2476
|
-
|
|
2477
|
-
return
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
const docRef = doc(this.firestore, this.collectionName, entity.id);
|
|
2483
|
-
await updateDoc(docRef, this.mapEntity(entity));
|
|
2484
|
-
return Promise.resolve(entity);
|
|
2708
|
+
createDescriptor() {
|
|
2709
|
+
return new BaseEntityDescriptor({
|
|
2710
|
+
entityName: this.entityName,
|
|
2711
|
+
entityTitle: this.entityTitle,
|
|
2712
|
+
attrDescriptors: this.attrDescriptors,
|
|
2713
|
+
});
|
|
2485
2714
|
}
|
|
2486
|
-
};
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2715
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2716
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityFacade });
|
|
2717
|
+
}
|
|
2718
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: BaseEntityFacade, decorators: [{
|
|
2719
|
+
type: Injectable
|
|
2720
|
+
}] });
|
|
2721
|
+
|
|
2722
|
+
const BASE_ENTITY_SERVICE = new InjectionToken('BASE_ENTITY_SERVICE');
|
|
2490
2723
|
|
|
2491
2724
|
// Symbol to store entity options on instance
|
|
2492
2725
|
const ENTITY_OPTIONS_KEY = Symbol('entityOptions');
|
|
@@ -2576,5 +2809,5 @@ const BASE_ENTITY_ROUTES = [
|
|
|
2576
2809
|
* Generated bundle index. Do not edit.
|
|
2577
2810
|
*/
|
|
2578
2811
|
|
|
2579
|
-
export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE,
|
|
2812
|
+
export { ACTIVE_ENTITY_FACADE, AbstractAttrDescriptor, BASE_ENTITY_FACADE_REGISTRY, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityDescriptor, BaseEntityFacade, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorSingletonStore, BaseFormNavigatorStore, Entity, EntityRegistryComponent, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, SimpleEntityMapper, getEntityIds, getEntityOptions, getEnumKeyByValue, getEnumValueByKey };
|
|
2580
2813
|
//# sourceMappingURL=processpuzzle-base-entity.mjs.map
|