@processpuzzle/base-entity 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { inject, input, Component, computed, effect, Inject, Directive, ViewChild, signal, Injectable, untracked, InjectionToken } from '@angular/core';
|
|
3
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
|
+
import * as i1 from '@angular/common';
|
|
5
|
+
import { CommonModule, NgIf, NgStyle, NgClass, NgForOf } from '@angular/common';
|
|
6
|
+
import { Router, ActivatedRoute, RouterOutlet, ROUTER_OUTLET_DATA } from '@angular/router';
|
|
7
|
+
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
|
8
|
+
import { MatToolbar } from '@angular/material/toolbar';
|
|
9
|
+
import { MatIcon } from '@angular/material/icon';
|
|
10
|
+
import { MatButton } from '@angular/material/button';
|
|
11
|
+
import * as i3 from '@angular/material/form-field';
|
|
12
|
+
import { MatFormField, MatFormFieldModule, MatLabel, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
13
|
+
import * as i4 from '@angular/material/input';
|
|
14
|
+
import { MatInput, MatInputModule } from '@angular/material/input';
|
|
15
|
+
import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
|
16
|
+
import { signalStoreFeature, withState, withMethods, patchState, withHooks, withComputed } from '@ngrx/signals';
|
|
17
|
+
import { LayoutService, RUNTIME_CONFIGURATION } from '@processpuzzle/util';
|
|
18
|
+
import { __decorate, __param } from 'tslib';
|
|
19
|
+
import { map, pipe, switchMap, tap, from, of } from 'rxjs';
|
|
20
|
+
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
21
|
+
import { buildUrl } from 'build-url-ts';
|
|
3
22
|
import * as i1$1 from '@angular/forms';
|
|
4
23
|
import { ReactiveFormsModule, FormsModule, FormControl, Validators, FormBuilder } from '@angular/forms';
|
|
5
|
-
import { ROUTER_OUTLET_DATA, Router, ActivatedRoute, RouterOutlet } from '@angular/router';
|
|
6
24
|
import { MatCard, MatCardContent, MatCardActions } from '@angular/material/card';
|
|
7
|
-
import * as i3 from '@angular/material/form-field';
|
|
8
|
-
import { MatFormFieldModule, MatLabel, MatFormField, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
9
|
-
import { MatButton } from '@angular/material/button';
|
|
10
|
-
import * as i1 from '@angular/common';
|
|
11
|
-
import { NgIf, NgStyle, CommonModule, NgClass, NgForOf } from '@angular/common';
|
|
12
25
|
import * as i5 from '@angular/material/datepicker';
|
|
13
26
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
14
|
-
import * as i4 from '@angular/material/input';
|
|
15
|
-
import { MatInputModule, MatInput } from '@angular/material/input';
|
|
16
|
-
import { MatIcon } from '@angular/material/icon';
|
|
17
27
|
import * as i2 from '@angular/material/select';
|
|
18
28
|
import { MatSelectModule } from '@angular/material/select';
|
|
19
29
|
import { MatCheckbox } from '@angular/material/checkbox';
|
|
@@ -22,16 +32,6 @@ import { MatSort, MatSortHeader } from '@angular/material/sort';
|
|
|
22
32
|
import { MatPaginator } from '@angular/material/paginator';
|
|
23
33
|
import { MatProgressBar } from '@angular/material/progress-bar';
|
|
24
34
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
25
|
-
import { signalStoreFeature, withState, withMethods, patchState, withHooks, withComputed } from '@ngrx/signals';
|
|
26
|
-
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
|
27
|
-
import { MatToolbar } from '@angular/material/toolbar';
|
|
28
|
-
import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
|
29
|
-
import { LayoutService, RUNTIME_CONFIGURATION } from '@processpuzzle/util';
|
|
30
|
-
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
31
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
32
|
-
import { map, pipe, switchMap, tap, from, of } from 'rxjs';
|
|
33
|
-
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
34
|
-
import { buildUrl } from 'build-url-ts';
|
|
35
35
|
import { tapResponse } from '@ngrx/operators';
|
|
36
36
|
import { rxMethod } from '@ngrx/signals/rxjs-interop';
|
|
37
37
|
import { Firestore, collection, doc, deleteDoc, getDoc, setDoc, orderBy, where, query, limit, getDocs, updateDoc } from '@angular/fire/firestore';
|
|
@@ -61,15 +61,460 @@ class AbstractAttrDescriptor {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
var BaseUrlSegments;
|
|
65
|
+
(function (BaseUrlSegments) {
|
|
66
|
+
BaseUrlSegments["DetailsForm"] = "details";
|
|
67
|
+
BaseUrlSegments["Feed"] = "feed";
|
|
68
|
+
BaseUrlSegments["ListForm"] = "list";
|
|
69
|
+
BaseUrlSegments["NewEntity"] = "new";
|
|
70
|
+
BaseUrlSegments["UnknownEntity"] = "unknown";
|
|
71
|
+
})(BaseUrlSegments || (BaseUrlSegments = {}));
|
|
72
|
+
|
|
73
|
+
var RouteSegments;
|
|
74
|
+
(function (RouteSegments) {
|
|
75
|
+
RouteSegments["LIST_ROUTE"] = "LIST_ROUTE";
|
|
76
|
+
RouteSegments["DETAILS_ROUTE"] = "DETAILS_ROUTE";
|
|
77
|
+
})(RouteSegments || (RouteSegments = {}));
|
|
78
|
+
const INITIAL_NAVIGATION_STATE = {
|
|
79
|
+
activeRouteSegment: RouteSegments.LIST_ROUTE,
|
|
80
|
+
entityName: '',
|
|
81
|
+
navigationError: undefined,
|
|
82
|
+
navigateTo: '',
|
|
83
|
+
returnTo: '',
|
|
84
|
+
};
|
|
85
|
+
function snakeCaseName(entityName) {
|
|
86
|
+
return entityName
|
|
87
|
+
.split(/(?=[A-Z])/)
|
|
88
|
+
.join('-')
|
|
89
|
+
.toLowerCase();
|
|
90
|
+
}
|
|
91
|
+
function BaseFormNavigatorStore(entityName) {
|
|
92
|
+
return signalStoreFeature(withState(INITIAL_NAVIGATION_STATE), withMethods((store, router = inject(Router), route = inject(ActivatedRoute)) => {
|
|
93
|
+
function determineActiveRouteSegment() {
|
|
94
|
+
const currentUrl = Reflect.get(route, '_routerState').snapshot.url;
|
|
95
|
+
if (currentUrl.endsWith(BaseUrlSegments.ListForm)) {
|
|
96
|
+
patchState(store, { activeRouteSegment: RouteSegments.LIST_ROUTE });
|
|
97
|
+
}
|
|
98
|
+
else if (currentUrl.endsWith(BaseUrlSegments.DetailsForm)) {
|
|
99
|
+
patchState(store, { activeRouteSegment: RouteSegments.DETAILS_ROUTE });
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
patchState(store, { activeRouteSegment: undefined });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function determineBaseUrl() {
|
|
106
|
+
determineActiveRouteSegment();
|
|
107
|
+
const currentUrl = determineCurrentUrl();
|
|
108
|
+
return store.activeRouteSegment() === RouteSegments.DETAILS_ROUTE ? levelUpUrl(levelUpUrl(levelUpUrl(currentUrl))) : levelUpUrl(levelUpUrl(currentUrl));
|
|
109
|
+
}
|
|
110
|
+
function determineCurrentUrl() {
|
|
111
|
+
return Reflect.get(route, '_routerState').snapshot.url;
|
|
112
|
+
}
|
|
113
|
+
function levelUpUrl(currentUrl) {
|
|
114
|
+
return currentUrl.substring(0, currentUrl.lastIndexOf('/'));
|
|
115
|
+
}
|
|
116
|
+
async function navigateBack(defaultUrl) {
|
|
117
|
+
const goTo = store.returnTo() ? store.returnTo() : defaultUrl;
|
|
118
|
+
patchState(store, { returnTo: '' });
|
|
119
|
+
if (goTo) {
|
|
120
|
+
await router
|
|
121
|
+
.navigateByUrl(goTo)
|
|
122
|
+
.then()
|
|
123
|
+
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
124
|
+
}
|
|
125
|
+
else
|
|
126
|
+
await navigateToList();
|
|
127
|
+
}
|
|
128
|
+
async function navigateToDetails(id, returnTo) {
|
|
129
|
+
if (store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
130
|
+
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
131
|
+
const baseUrl = determineBaseUrl();
|
|
132
|
+
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
133
|
+
await navigateToUrl(detailsFormPath, returnTo);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async function navigateToList(returnTo) {
|
|
137
|
+
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
138
|
+
const baseUrl = determineBaseUrl();
|
|
139
|
+
const goToUrl = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
140
|
+
if (store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
141
|
+
await navigateToUrl(goToUrl, returnTo);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async function navigateToRelated(relatedTypeName, id, returnTo) {
|
|
145
|
+
const snakeCaseEntityName = snakeCaseName(relatedTypeName);
|
|
146
|
+
const baseUrl = determineBaseUrl();
|
|
147
|
+
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
148
|
+
await navigateToUrl(detailsFormPath, returnTo);
|
|
149
|
+
}
|
|
150
|
+
async function navigateToUrl(url, returnTo) {
|
|
151
|
+
if (returnTo) {
|
|
152
|
+
patchState(store, { returnTo });
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
patchState(store, { returnTo: router.url });
|
|
156
|
+
}
|
|
157
|
+
patchState(store, { navigateTo: url });
|
|
158
|
+
await router
|
|
159
|
+
.navigateByUrl(url)
|
|
160
|
+
.then(() => determineActiveRouteSegment())
|
|
161
|
+
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
162
|
+
}
|
|
163
|
+
return { determineCurrentUrl, determineActiveRouteSegment, navigateBack, navigateToDetails, navigateToList, navigateToRelated, navigateToUrl };
|
|
164
|
+
}), withHooks((store) => ({
|
|
165
|
+
onInit: () => {
|
|
166
|
+
store.determineActiveRouteSegment();
|
|
167
|
+
},
|
|
168
|
+
})));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
class BaseEntityToolbarComponent {
|
|
172
|
+
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : /* istanbul ignore next */ []));
|
|
173
|
+
layoutService = inject(LayoutService);
|
|
174
|
+
store;
|
|
175
|
+
// region Angular lifecycle hooks
|
|
176
|
+
ngOnInit() {
|
|
177
|
+
this.store = this.baseEntityListOptions().store;
|
|
178
|
+
}
|
|
179
|
+
// endregion
|
|
180
|
+
// event handling methods
|
|
181
|
+
onAddEntity() {
|
|
182
|
+
this.store.navigateToDetails(BaseUrlSegments.NewEntity);
|
|
183
|
+
}
|
|
184
|
+
onDeleteEntities() {
|
|
185
|
+
this.store.selectedEntities().forEach((entity) => this.store.delete(entity.id));
|
|
186
|
+
}
|
|
187
|
+
onDoFilter($event) {
|
|
188
|
+
const filterValue = $event.target.value;
|
|
189
|
+
this.store.doFilter(filterValue);
|
|
190
|
+
}
|
|
191
|
+
// endregion
|
|
192
|
+
// public queries and mutators
|
|
193
|
+
isSmallDevice() {
|
|
194
|
+
return this.layoutService.isSmallDevice();
|
|
195
|
+
}
|
|
196
|
+
// endregion
|
|
197
|
+
// protected, private helper methods
|
|
198
|
+
RouteSegments = RouteSegments;
|
|
199
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
200
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: BaseEntityToolbarComponent, isStandalone: true, selector: "base-entity-toolbar", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"store.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input test-id=\"filter-input\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\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 test-id=\"menu\" #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button test-id=\"add\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"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 test-id=\"add\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>", 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: "component", type: 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: 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"] }] });
|
|
201
|
+
}
|
|
202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
|
|
203
|
+
type: Component,
|
|
204
|
+
args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbar, MatIcon, MatFormField, MatInput, MatButton, MatMenu, MatMenuItem, MatMenuTrigger], template: "<mat-toolbar *ngIf=\"store.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input test-id=\"filter-input\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\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 test-id=\"menu\" #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button test-id=\"add\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"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 test-id=\"add\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>" }]
|
|
205
|
+
}], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
206
|
+
|
|
207
|
+
class BaseEntityStatusbarComponent {
|
|
208
|
+
store;
|
|
209
|
+
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : /* istanbul ignore next */ []));
|
|
210
|
+
entityTitle = computed(() => this.evaluateEntityTitle(this.baseEntityListOptions().entityTitle), ...(ngDevMode ? [{ debugName: "entityTitle" }] : /* istanbul ignore next */ []));
|
|
211
|
+
isVisible = computed(() => this.store.currentEntity() != undefined || this.store.selectedEntities().length == 1, ...(ngDevMode ? [{ debugName: "isVisible" }] : /* istanbul ignore next */ []));
|
|
212
|
+
// region Angular lifecycle hooks
|
|
213
|
+
ngOnInit() {
|
|
214
|
+
this.store = this.baseEntityListOptions().store;
|
|
215
|
+
}
|
|
216
|
+
// endregion
|
|
217
|
+
// event handling methods
|
|
218
|
+
// endregion
|
|
219
|
+
// protected, private helper methods
|
|
220
|
+
evaluateEntityTitle(title) {
|
|
221
|
+
const fn = new Function('ctx', 'return ' + title.replace(/this\./g, 'ctx.'));
|
|
222
|
+
return fn(this);
|
|
223
|
+
}
|
|
224
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityStatusbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
225
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: BaseEntityStatusbarComponent, isStandalone: true, selector: "base-entity-statusbar", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"isVisible()\">\n <div>\n <span>{{entityTitle()}}</span>\n </div>\n</mat-toolbar>", 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"] }] });
|
|
226
|
+
}
|
|
227
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityStatusbarComponent, decorators: [{
|
|
228
|
+
type: Component,
|
|
229
|
+
args: [{ selector: 'base-entity-statusbar', standalone: true, imports: [CommonModule, MatToolbar], template: "<mat-toolbar *ngIf=\"isVisible()\">\n <div>\n <span>{{entityTitle()}}</span>\n </div>\n</mat-toolbar>" }]
|
|
230
|
+
}], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
231
|
+
|
|
232
|
+
class BaseEntityTabsComponent {
|
|
233
|
+
store;
|
|
234
|
+
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : /* istanbul ignore next */ []));
|
|
235
|
+
selectedEntityId = computed(() => (this.store.currentId() ? this.store.currentId() : BaseUrlSegments.NewEntity), ...(ngDevMode ? [{ debugName: "selectedEntityId" }] : /* istanbul ignore next */ []));
|
|
236
|
+
detailsTabName = computed(() => this.baseEntityListOptions().entityName + ' - details', ...(ngDevMode ? [{ debugName: "detailsTabName" }] : /* istanbul ignore next */ []));
|
|
237
|
+
listTabName = computed(() => this.baseEntityListOptions().entityName + ' - list', ...(ngDevMode ? [{ debugName: "listTabName" }] : /* istanbul ignore next */ []));
|
|
238
|
+
constructor() {
|
|
239
|
+
this.registerEffects();
|
|
240
|
+
}
|
|
241
|
+
// region angular lifecycle hooks
|
|
242
|
+
ngOnDestroy() {
|
|
243
|
+
this.store.tabIsInactive(this.listTabName());
|
|
244
|
+
this.store.tabIsInactive(this.detailsTabName());
|
|
245
|
+
}
|
|
246
|
+
ngOnInit() {
|
|
247
|
+
this.store = this.baseEntityListOptions().store;
|
|
248
|
+
}
|
|
249
|
+
// endregion
|
|
250
|
+
// region event handlers
|
|
251
|
+
async onShowDetails() {
|
|
252
|
+
if (this.store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
253
|
+
const id = this.selectedEntityId() ? this.selectedEntityId() : BaseUrlSegments.NewEntity;
|
|
254
|
+
await this.store.navigateToDetails(id);
|
|
255
|
+
this.store.tabIsActive(this.detailsTabName());
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
async onShowList() {
|
|
259
|
+
if (this.store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
260
|
+
await this.store.navigateToList(this.baseEntityListOptions().entityName);
|
|
261
|
+
this.store.tabIsActive(this.listTabName());
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// endregion
|
|
265
|
+
// region protected, private helper methods
|
|
266
|
+
registerEffects() {
|
|
267
|
+
effect(() => {
|
|
268
|
+
if (this.store.activeRouteSegment() === RouteSegments.DETAILS_ROUTE) {
|
|
269
|
+
this.store.tabIsActive(this.detailsTabName());
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
this.store.tabIsActive(this.listTabName());
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
277
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: BaseEntityTabsComponent, isStandalone: true, selector: "base-entity-tabs", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<nav mat-tab-nav-bar [tabPanel]=\"tabPanel\">\n <a mat-tab-link (click)=\"onShowList()\" [active]=\"store.currentTab() === listTabName()\">{{listTabName()}}</a>\n <a mat-tab-link [disabled]=\"store.currentEntity() === undefined\" (click)=\"onShowDetails()\" [active]=\"store.currentTab() === detailsTabName()\">{{detailsTabName()}}</a>\n</nav>\n\n<mat-tab-nav-panel #tabPanel>\n <base-entity-statusbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <base-entity-toolbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <router-outlet [routerOutletData]=\"baseEntityListOptions()\"/>\n</mat-tab-nav-panel>", 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: ["baseEntityListOptions"] }, { kind: "component", type: BaseEntityStatusbarComponent, selector: "base-entity-statusbar", inputs: ["baseEntityListOptions"] }] });
|
|
278
|
+
}
|
|
279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityTabsComponent, decorators: [{
|
|
280
|
+
type: Component,
|
|
281
|
+
args: [{ selector: 'base-entity-tabs', standalone: true, imports: [CommonModule, MatTabNav, MatTabLink, MatTabNavPanel, RouterOutlet, BaseEntityToolbarComponent, BaseEntityStatusbarComponent], template: "<nav mat-tab-nav-bar [tabPanel]=\"tabPanel\">\n <a mat-tab-link (click)=\"onShowList()\" [active]=\"store.currentTab() === listTabName()\">{{listTabName()}}</a>\n <a mat-tab-link [disabled]=\"store.currentEntity() === undefined\" (click)=\"onShowDetails()\" [active]=\"store.currentTab() === detailsTabName()\">{{detailsTabName()}}</a>\n</nav>\n\n<mat-tab-nav-panel #tabPanel>\n <base-entity-statusbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <base-entity-toolbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <router-outlet [routerOutletData]=\"baseEntityListOptions()\"/>\n</mat-tab-nav-panel>" }]
|
|
282
|
+
}], ctorParameters: () => [], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
283
|
+
|
|
284
|
+
class BaseEntityContainerComponent {
|
|
285
|
+
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : /* istanbul ignore next */ []));
|
|
286
|
+
snackBar = inject(MatSnackBar);
|
|
287
|
+
store;
|
|
288
|
+
constructor() {
|
|
289
|
+
this.registerEffects();
|
|
290
|
+
}
|
|
291
|
+
// region Angular lifecycle hooks
|
|
292
|
+
ngOnDestroy() {
|
|
293
|
+
this.store.reset();
|
|
294
|
+
}
|
|
295
|
+
ngOnInit() {
|
|
296
|
+
this.store = this.baseEntityListOptions().store;
|
|
297
|
+
}
|
|
298
|
+
// endregion
|
|
299
|
+
// region protected, private helper methods
|
|
300
|
+
registerEffects() {
|
|
301
|
+
effect(() => {
|
|
302
|
+
if (this.store.error()) {
|
|
303
|
+
const errorMessage = this.store.error() ? this.store.error() : 'Undefined Error';
|
|
304
|
+
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
309
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: BaseEntityContainerComponent, isStandalone: true, selector: "base-entity-container", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
310
|
+
<div>
|
|
311
|
+
<base-entity-tabs [baseEntityListOptions]="baseEntityListOptions()"></base-entity-tabs>
|
|
312
|
+
</div>
|
|
313
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BaseEntityTabsComponent, selector: "base-entity-tabs", inputs: ["baseEntityListOptions"] }] });
|
|
314
|
+
}
|
|
315
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityContainerComponent, decorators: [{
|
|
316
|
+
type: Component,
|
|
317
|
+
args: [{
|
|
318
|
+
selector: 'base-entity-container',
|
|
319
|
+
standalone: true,
|
|
320
|
+
imports: [CommonModule, BaseEntityTabsComponent],
|
|
321
|
+
template: `
|
|
322
|
+
<div>
|
|
323
|
+
<base-entity-tabs [baseEntityListOptions]="baseEntityListOptions()"></base-entity-tabs>
|
|
324
|
+
</div>
|
|
325
|
+
`,
|
|
326
|
+
}]
|
|
327
|
+
}], ctorParameters: () => [], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
328
|
+
|
|
329
|
+
const INITIAL_CONTAINER_STATE = {
|
|
330
|
+
filterKey: undefined,
|
|
331
|
+
};
|
|
332
|
+
function BaseEntityContainerStore() {
|
|
333
|
+
return signalStoreFeature(withState(INITIAL_CONTAINER_STATE), withMethods((store) => {
|
|
334
|
+
function doFilter(filterKey) {
|
|
335
|
+
patchState(store, { filterKey });
|
|
336
|
+
}
|
|
337
|
+
return { doFilter };
|
|
338
|
+
}));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
let BaseEntityRestService = class BaseEntityRestService {
|
|
342
|
+
entityMapper;
|
|
343
|
+
urlProperty;
|
|
344
|
+
resourceUrl;
|
|
345
|
+
runtimeConfiguration = inject(RUNTIME_CONFIGURATION);
|
|
346
|
+
baseUrl;
|
|
347
|
+
httpClient = inject(HttpClient);
|
|
348
|
+
headers = new HttpHeaders({
|
|
349
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
350
|
+
'Access-Control-Allow-Methods': 'GET, HEAD, PUT, PATCH, POST, DELETE',
|
|
351
|
+
'Access-Control-Allow-Origin-Credentials': 'true',
|
|
352
|
+
'Access-Control-Allow-Headers': 'Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers',
|
|
353
|
+
});
|
|
354
|
+
constructor(entityMapper, urlProperty, resourceUrl) {
|
|
355
|
+
this.entityMapper = entityMapper;
|
|
356
|
+
this.urlProperty = urlProperty;
|
|
357
|
+
this.resourceUrl = resourceUrl;
|
|
358
|
+
const baseConf = Reflect.get(this.runtimeConfiguration, 'BASE_CONFIGURATION');
|
|
359
|
+
this.baseUrl = Reflect.get(baseConf, urlProperty);
|
|
360
|
+
}
|
|
361
|
+
// region public accessor and mutator methods
|
|
362
|
+
delete(id) {
|
|
363
|
+
return this.httpClient.delete(this.resourceUrl + `/${id}`, { headers: this.headers });
|
|
364
|
+
}
|
|
365
|
+
deleteAll() {
|
|
366
|
+
return this.httpClient.delete(this.resourceUrl, { headers: this.headers });
|
|
367
|
+
}
|
|
368
|
+
findAll(page) {
|
|
369
|
+
return this.findByQuery({ page });
|
|
370
|
+
}
|
|
371
|
+
findByQuery(queryCondition) {
|
|
372
|
+
const fullUrl = this.buildFullUrl(this.resourceUrl, queryCondition);
|
|
373
|
+
if (fullUrl) {
|
|
374
|
+
return this.httpClient.get(fullUrl, { headers: this.headers }).pipe(map((httpResponse) => {
|
|
375
|
+
return queryCondition.page ? this.mapPagedResponse(httpResponse) : this.mapSimpleResponse(httpResponse);
|
|
376
|
+
}));
|
|
377
|
+
}
|
|
378
|
+
else
|
|
379
|
+
throw new Error('Could not determine the full url');
|
|
380
|
+
}
|
|
381
|
+
findById(id) {
|
|
382
|
+
const queryCondition = { pathParams: new Map([['id', id]]) };
|
|
383
|
+
const fullUrl = this.buildFullUrl(this.resourceUrl, queryCondition);
|
|
384
|
+
if (fullUrl) {
|
|
385
|
+
return this.httpClient.get(fullUrl, { headers: this.headers }).pipe(map((httpResponse) => {
|
|
386
|
+
return this.mapSimpleResponse(httpResponse);
|
|
387
|
+
}));
|
|
388
|
+
}
|
|
389
|
+
else
|
|
390
|
+
throw new Error('Could not determine the full url');
|
|
391
|
+
}
|
|
392
|
+
add(entity, id) {
|
|
393
|
+
const dto = this.entityMapper.toDto(entity);
|
|
394
|
+
const fullUrl = this.buildFullUrl(this.resourceUrl, {});
|
|
395
|
+
if (fullUrl) {
|
|
396
|
+
return this.httpClient.post(fullUrl, dto, { headers: this.headers }).pipe(map((response) => {
|
|
397
|
+
return this.entityMapper.fromDto(response, id);
|
|
398
|
+
}));
|
|
399
|
+
}
|
|
400
|
+
else
|
|
401
|
+
throw new Error('Could not determine the full url');
|
|
402
|
+
}
|
|
403
|
+
update(entity) {
|
|
404
|
+
const dto = this.entityMapper.toDto(entity);
|
|
405
|
+
const pathParams = new Map([['id', String(entity.id)]]);
|
|
406
|
+
const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}', { pathParams });
|
|
407
|
+
if (fullUrl) {
|
|
408
|
+
return this.httpClient.put(fullUrl, dto, { headers: this.headers }).pipe(map((response) => {
|
|
409
|
+
return this.entityMapper.fromDto(response);
|
|
410
|
+
}));
|
|
411
|
+
}
|
|
412
|
+
else
|
|
413
|
+
throw new Error('Could not determine the full url');
|
|
414
|
+
}
|
|
415
|
+
// endregion
|
|
416
|
+
// region protected, private helper methods
|
|
417
|
+
buildFullUrl(resourceUri, queryCondition) {
|
|
418
|
+
const queryParams = new Map();
|
|
419
|
+
if (queryCondition.page)
|
|
420
|
+
queryParams.set('page', queryCondition.page.toString());
|
|
421
|
+
if (queryCondition.filters !== undefined && queryCondition.filters.length != 0) {
|
|
422
|
+
queryCondition.filters.forEach((filter) => queryParams.set(filter.property, filter.value));
|
|
423
|
+
}
|
|
424
|
+
let params = {};
|
|
425
|
+
if (queryParams.size > 0) {
|
|
426
|
+
for (const [key, value] of queryParams) {
|
|
427
|
+
params = { ...params, [key]: value };
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
else
|
|
431
|
+
params = null;
|
|
432
|
+
if (queryCondition.pathParams !== undefined && queryCondition.pathParams.size != 0) {
|
|
433
|
+
queryCondition.pathParams.forEach((value, key) => {
|
|
434
|
+
const pathParam = '%{' + key + '}';
|
|
435
|
+
resourceUri = resourceUri.replace(pathParam, value);
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
const urlOptions = {
|
|
439
|
+
path: resourceUri,
|
|
440
|
+
hash: queryCondition.hash,
|
|
441
|
+
queryParams: params,
|
|
442
|
+
};
|
|
443
|
+
return buildUrl(this.baseUrl, urlOptions);
|
|
444
|
+
}
|
|
445
|
+
mapPagedResponse(response) {
|
|
446
|
+
const subjectPage = response[0];
|
|
447
|
+
const content = subjectPage.content.map((dto, index) => {
|
|
448
|
+
return this.entityMapper.fromDto(dto, index);
|
|
449
|
+
});
|
|
450
|
+
return {
|
|
451
|
+
page: subjectPage.page,
|
|
452
|
+
pageSize: subjectPage.pageSize,
|
|
453
|
+
totalPageCount: subjectPage.totalPageCount,
|
|
454
|
+
content,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
mapSimpleResponse(response) {
|
|
458
|
+
if (Object.prototype.toString.call(response) === '[object Array]') {
|
|
459
|
+
return response.map((dto, index) => {
|
|
460
|
+
return this.entityMapper.fromDto(dto, index);
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
return new Array(this.entityMapper.fromDto(response));
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
BaseEntityRestService = __decorate([
|
|
469
|
+
__param(0, Inject('entityMapper'))
|
|
470
|
+
], BaseEntityRestService);
|
|
471
|
+
|
|
472
|
+
class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
473
|
+
description;
|
|
474
|
+
styleClass = '';
|
|
475
|
+
labelClass = '';
|
|
476
|
+
format;
|
|
477
|
+
isLinkToDetails;
|
|
478
|
+
selectables;
|
|
479
|
+
visible = true;
|
|
480
|
+
isHeading;
|
|
481
|
+
placeholder;
|
|
482
|
+
lines;
|
|
483
|
+
options;
|
|
484
|
+
_label;
|
|
485
|
+
_linkedEntityType;
|
|
486
|
+
constructor(attrName, formControlType, label, selectables, isLinkToDetails, options) {
|
|
487
|
+
super(attrName, formControlType);
|
|
488
|
+
this.attrName = attrName;
|
|
489
|
+
this._label = label;
|
|
490
|
+
this.selectables = selectables;
|
|
491
|
+
this.isLinkToDetails = isLinkToDetails;
|
|
492
|
+
this.options = { inputType: 'text', ...options };
|
|
493
|
+
}
|
|
494
|
+
// region properties
|
|
495
|
+
get label() {
|
|
496
|
+
return this._label ? this._label : this.attrName;
|
|
497
|
+
}
|
|
498
|
+
set label(label) {
|
|
499
|
+
this._label = label;
|
|
500
|
+
}
|
|
501
|
+
get linkedEntityType() {
|
|
502
|
+
return this._linkedEntityType;
|
|
503
|
+
}
|
|
504
|
+
set linkedEntityType(linkedEntityType) {
|
|
505
|
+
this._linkedEntityType = linkedEntityType;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
64
509
|
class BaseFormHostDirective {
|
|
65
510
|
viewContainerRef;
|
|
66
511
|
constructor(viewContainerRef) {
|
|
67
512
|
this.viewContainerRef = viewContainerRef;
|
|
68
513
|
}
|
|
69
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
70
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
514
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseFormHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
515
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: BaseFormHostDirective, isStandalone: true, selector: "[baseFormHost]", ngImport: i0 });
|
|
71
516
|
}
|
|
72
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseFormHostDirective, decorators: [{
|
|
73
518
|
type: Directive,
|
|
74
519
|
args: [{
|
|
75
520
|
standalone: true,
|
|
@@ -77,26 +522,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
77
522
|
}]
|
|
78
523
|
}], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
|
|
79
524
|
|
|
80
|
-
var BaseUrlSegments;
|
|
81
|
-
(function (BaseUrlSegments) {
|
|
82
|
-
BaseUrlSegments["DetailsForm"] = "details";
|
|
83
|
-
BaseUrlSegments["Feed"] = "feed";
|
|
84
|
-
BaseUrlSegments["ListForm"] = "list";
|
|
85
|
-
BaseUrlSegments["NewEntity"] = "new";
|
|
86
|
-
BaseUrlSegments["UnknownEntity"] = "unknown";
|
|
87
|
-
})(BaseUrlSegments || (BaseUrlSegments = {}));
|
|
88
|
-
|
|
89
525
|
class BaseFormControlComponent {
|
|
90
|
-
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
91
|
-
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
526
|
+
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
527
|
+
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
|
|
92
528
|
formGroup;
|
|
93
529
|
store;
|
|
94
|
-
style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : []));
|
|
95
|
-
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
96
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
97
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
530
|
+
style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
|
|
531
|
+
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
532
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseFormControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
533
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", 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 } }, ngImport: i0, template: ``, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }] });
|
|
98
534
|
}
|
|
99
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
535
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseFormControlComponent, decorators: [{
|
|
100
536
|
type: Component,
|
|
101
537
|
args: [{
|
|
102
538
|
standalone: true,
|
|
@@ -106,19 +542,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
106
542
|
}], 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 }] }] } });
|
|
107
543
|
|
|
108
544
|
class LabelComponent extends BaseFormControlComponent {
|
|
109
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
110
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
545
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: LabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
546
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", 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"] }] });
|
|
111
547
|
}
|
|
112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
548
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: LabelComponent, decorators: [{
|
|
113
549
|
type: Component,
|
|
114
550
|
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>" }]
|
|
115
551
|
}] });
|
|
116
552
|
|
|
117
553
|
class DatepickerComponent extends BaseFormControlComponent {
|
|
118
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
119
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
554
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
555
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", 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"] }] });
|
|
120
556
|
}
|
|
121
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
557
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
122
558
|
type: Component,
|
|
123
559
|
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" }]
|
|
124
560
|
}] });
|
|
@@ -128,55 +564,55 @@ class ForeignKeyComponent extends BaseFormControlComponent {
|
|
|
128
564
|
navigateToRelated() {
|
|
129
565
|
this.store.navigateToRelated(this.config().linkedEntityType, this.value());
|
|
130
566
|
}
|
|
131
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
132
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
567
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ForeignKeyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
568
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: ForeignKeyComponent, isStandalone: true, selector: "base-foreign-key", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{ config().attrName }}</mat-label>\n <input matInput formControlName=\"{{config().attrName}}\">\n </mat-form-field>\n <a (click)=\"navigateToRelated()\" aria-label=\"Related entity\">\n <mat-icon>link</mat-icon>\n </a>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: "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"] }] });
|
|
133
569
|
}
|
|
134
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
570
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ForeignKeyComponent, decorators: [{
|
|
135
571
|
type: Component,
|
|
136
572
|
args: [{ selector: 'base-foreign-key', standalone: true, imports: [NgIf, MatIcon, MatLabel, MatFormField, MatInput, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{ config().attrName }}</mat-label>\n <input matInput formControlName=\"{{config().attrName}}\">\n </mat-form-field>\n <a (click)=\"navigateToRelated()\" aria-label=\"Related entity\">\n <mat-icon>link</mat-icon>\n </a>\n </div>\n</ng-container>" }]
|
|
137
573
|
}] });
|
|
138
574
|
|
|
139
575
|
class TextboxComponent extends BaseFormControlComponent {
|
|
140
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
141
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
576
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
577
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", 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"] }] });
|
|
142
578
|
}
|
|
143
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
579
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextboxComponent, decorators: [{
|
|
144
580
|
type: Component,
|
|
145
581
|
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>" }]
|
|
146
582
|
}] });
|
|
147
583
|
|
|
148
584
|
class DropdownComponent extends BaseFormControlComponent {
|
|
149
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
150
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
585
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
586
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", 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.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.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] });
|
|
151
587
|
}
|
|
152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
153
589
|
type: Component,
|
|
154
590
|
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>" }]
|
|
155
591
|
}] });
|
|
156
592
|
|
|
157
593
|
class CheckboxComponent extends BaseFormControlComponent {
|
|
158
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
159
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
594
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
595
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", 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"] }] });
|
|
160
596
|
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
597
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
162
598
|
type: Component,
|
|
163
599
|
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"] }]
|
|
164
600
|
}] });
|
|
165
601
|
|
|
166
602
|
class RadioComponent extends BaseFormControlComponent {
|
|
167
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
168
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
603
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
604
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", 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"] }] });
|
|
169
605
|
}
|
|
170
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
606
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: RadioComponent, decorators: [{
|
|
171
607
|
type: Component,
|
|
172
608
|
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>" }]
|
|
173
609
|
}] });
|
|
174
610
|
|
|
175
611
|
class TextareaComponent extends BaseFormControlComponent {
|
|
176
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
177
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
612
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
613
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", 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"] }] });
|
|
178
614
|
}
|
|
179
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
615
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
180
616
|
type: Component,
|
|
181
617
|
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>" }]
|
|
182
618
|
}] });
|
|
@@ -186,10 +622,10 @@ class FlexBoxHostDirective {
|
|
|
186
622
|
constructor(viewContainerRef) {
|
|
187
623
|
this.viewContainerRef = viewContainerRef;
|
|
188
624
|
}
|
|
189
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
190
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
625
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FlexBoxHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
626
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: FlexBoxHostDirective, isStandalone: true, selector: "[flexBoxHost]", ngImport: i0 });
|
|
191
627
|
}
|
|
192
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
628
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FlexBoxHostDirective, decorators: [{
|
|
193
629
|
type: Directive,
|
|
194
630
|
args: [{
|
|
195
631
|
standalone: true,
|
|
@@ -215,7 +651,7 @@ class FlexboxDescriptor extends AbstractAttrDescriptor {
|
|
|
215
651
|
|
|
216
652
|
class FlexBoxComponent extends BaseFormControlComponent {
|
|
217
653
|
flexBoxHost;
|
|
218
|
-
flexBoxClass = computed(() => this.calculateFlexStyle(this.config().direction), ...(ngDevMode ? [{ debugName: "flexBoxClass" }] : []));
|
|
654
|
+
flexBoxClass = computed(() => this.calculateFlexStyle(this.config().direction), ...(ngDevMode ? [{ debugName: "flexBoxClass" }] : /* istanbul ignore next */ []));
|
|
219
655
|
// region protected, private helper methods
|
|
220
656
|
calculateFlexStyle(direction) {
|
|
221
657
|
switch (direction) {
|
|
@@ -229,53 +665,16 @@ class FlexBoxComponent extends BaseFormControlComponent {
|
|
|
229
665
|
throw new Error('Unknown flex direction');
|
|
230
666
|
}
|
|
231
667
|
}
|
|
232
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
233
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
668
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FlexBoxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
669
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", 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"] }] });
|
|
234
670
|
}
|
|
235
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
671
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FlexBoxComponent, decorators: [{
|
|
236
672
|
type: Component,
|
|
237
|
-
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"] }]
|
|
238
|
-
}], propDecorators: { flexBoxHost: [{
|
|
239
|
-
type: ViewChild,
|
|
240
|
-
args: [FlexBoxHostDirective, { static: true, read: FlexBoxHostDirective }]
|
|
241
|
-
}] } });
|
|
242
|
-
|
|
243
|
-
class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
244
|
-
description;
|
|
245
|
-
styleClass = '';
|
|
246
|
-
labelClass = '';
|
|
247
|
-
format;
|
|
248
|
-
isLinkToDetails;
|
|
249
|
-
selectables;
|
|
250
|
-
visible = true;
|
|
251
|
-
isHeading;
|
|
252
|
-
placeholder;
|
|
253
|
-
lines;
|
|
254
|
-
options;
|
|
255
|
-
_label;
|
|
256
|
-
_linkedEntityType;
|
|
257
|
-
constructor(attrName, formControlType, label, selectables, isLinkToDetails, options) {
|
|
258
|
-
super(attrName, formControlType);
|
|
259
|
-
this.attrName = attrName;
|
|
260
|
-
this._label = label;
|
|
261
|
-
this.selectables = selectables;
|
|
262
|
-
this.isLinkToDetails = isLinkToDetails;
|
|
263
|
-
this.options = { inputType: 'text', ...options };
|
|
264
|
-
}
|
|
265
|
-
// region properties
|
|
266
|
-
get label() {
|
|
267
|
-
return this._label ? this._label : this.attrName;
|
|
268
|
-
}
|
|
269
|
-
set label(label) {
|
|
270
|
-
this._label = label;
|
|
271
|
-
}
|
|
272
|
-
get linkedEntityType() {
|
|
273
|
-
return this._linkedEntityType;
|
|
274
|
-
}
|
|
275
|
-
set linkedEntityType(linkedEntityType) {
|
|
276
|
-
this._linkedEntityType = linkedEntityType;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
673
|
+
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"] }]
|
|
674
|
+
}], propDecorators: { flexBoxHost: [{
|
|
675
|
+
type: ViewChild,
|
|
676
|
+
args: [FlexBoxHostDirective, { static: true, read: FlexBoxHostDirective }]
|
|
677
|
+
}] } });
|
|
279
678
|
|
|
280
679
|
class BaseEntityFormBuilder {
|
|
281
680
|
// region public methods
|
|
@@ -285,13 +684,13 @@ class BaseEntityFormBuilder {
|
|
|
285
684
|
const formControlType = this.createFormControl(column);
|
|
286
685
|
if (formControlType) {
|
|
287
686
|
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
288
|
-
componentRef.instance.config = signal(column, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
687
|
+
componentRef.instance.config = signal(column, ...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
289
688
|
componentRef.instance.entity = entity;
|
|
290
689
|
componentRef.instance.formGroup = baseEntityForm;
|
|
291
690
|
componentRef.instance.store = store;
|
|
292
691
|
if (column instanceof BaseEntityAttrDescriptor) {
|
|
293
692
|
const currentAttrValue = Reflect.get(entity(), column.attrName);
|
|
294
|
-
componentRef.instance.value = signal(currentAttrValue, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
693
|
+
componentRef.instance.value = signal(currentAttrValue, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
295
694
|
const formControl = new FormControl({ value: currentAttrValue, disabled: column.disabled }, Validators.required);
|
|
296
695
|
baseEntityForm.addControl(column.attrName, formControl);
|
|
297
696
|
}
|
|
@@ -336,10 +735,10 @@ class BaseEntityFormBuilder {
|
|
|
336
735
|
else
|
|
337
736
|
throw Error('Undefined form control type');
|
|
338
737
|
}
|
|
339
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
340
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
738
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
739
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormBuilder, providedIn: 'root' });
|
|
341
740
|
}
|
|
342
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
741
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormBuilder, decorators: [{
|
|
343
742
|
type: Injectable,
|
|
344
743
|
args: [{ providedIn: 'root' }]
|
|
345
744
|
}] });
|
|
@@ -347,13 +746,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
347
746
|
class BaseEntityFormComponent {
|
|
348
747
|
baseEntityForm;
|
|
349
748
|
baseEntityListOptions = inject(ROUTER_OUTLET_DATA);
|
|
350
|
-
entity = computed(() => (this.isNewObject() ? this.store().createEntity() : this.store().loadById(this.entityId())), ...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
351
|
-
entityId = input.required(...(ngDevMode ? [{ debugName: "entityId" }] : []));
|
|
749
|
+
entity = computed(() => (this.isNewObject() ? this.store().createEntity() : this.store().loadById(this.entityId())), ...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
|
|
750
|
+
entityId = input.required(...(ngDevMode ? [{ debugName: "entityId" }] : /* istanbul ignore next */ []));
|
|
352
751
|
componentHost;
|
|
353
|
-
store = computed(() => this.baseEntityListOptions().store, ...(ngDevMode ? [{ debugName: "store" }] : []));
|
|
752
|
+
store = computed(() => this.baseEntityListOptions().store, ...(ngDevMode ? [{ debugName: "store" }] : /* istanbul ignore next */ []));
|
|
354
753
|
entityFormBuilder = inject((BaseEntityFormBuilder));
|
|
355
754
|
formBuilder = inject(FormBuilder);
|
|
356
|
-
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : []));
|
|
755
|
+
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : /* istanbul ignore next */ []));
|
|
357
756
|
constructor() {
|
|
358
757
|
this.registerEffects();
|
|
359
758
|
}
|
|
@@ -393,10 +792,10 @@ class BaseEntityFormComponent {
|
|
|
393
792
|
this.store().setCurrentEntity(this.entity().id);
|
|
394
793
|
});
|
|
395
794
|
}
|
|
396
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
397
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
795
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
796
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", 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\" 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", 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"] }] });
|
|
398
797
|
}
|
|
399
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
798
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormComponent, decorators: [{
|
|
400
799
|
type: Component,
|
|
401
800
|
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" }]
|
|
402
801
|
}], ctorParameters: () => [], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }], componentHost: [{
|
|
@@ -423,12 +822,12 @@ class BaseEntityListComponent {
|
|
|
423
822
|
entityDescriptor = inject(ROUTER_OUTLET_DATA);
|
|
424
823
|
columnDescriptors = computed(() => {
|
|
425
824
|
return filterAttributeDescriptors(this.entityDescriptor().attrDescriptors);
|
|
426
|
-
}, ...(ngDevMode ? [{ debugName: "columnDescriptors" }] : []));
|
|
825
|
+
}, ...(ngDevMode ? [{ debugName: "columnDescriptors" }] : /* istanbul ignore next */ []));
|
|
427
826
|
displayedColumns = computed(() => {
|
|
428
827
|
const columns = this.columnDescriptors().map((column) => column.attrName);
|
|
429
828
|
columns.unshift('select');
|
|
430
829
|
return columns;
|
|
431
|
-
}, ...(ngDevMode ? [{ debugName: "displayedColumns" }] : []));
|
|
830
|
+
}, ...(ngDevMode ? [{ debugName: "displayedColumns" }] : /* istanbul ignore next */ []));
|
|
432
831
|
sort = {};
|
|
433
832
|
paginator = {};
|
|
434
833
|
store;
|
|
@@ -461,360 +860,90 @@ class BaseEntityListComponent {
|
|
|
461
860
|
}
|
|
462
861
|
onNavigateToDetails(entity) {
|
|
463
862
|
this.store.navigateToDetails(entity.id);
|
|
464
|
-
this.store.setCurrentEntity(entity.id);
|
|
465
|
-
}
|
|
466
|
-
onNavigateToRelated(config, entity) {
|
|
467
|
-
this.store.navigateToRelated(config.linkedEntityType, this.getPropertyValue(entity, config.attrName));
|
|
468
|
-
}
|
|
469
|
-
onRowClick(entity) {
|
|
470
|
-
this.selection.toggle(entity);
|
|
471
|
-
this.onChangeSelection(entity);
|
|
472
|
-
}
|
|
473
|
-
onToggleAllRows() {
|
|
474
|
-
if (this.isAllSelected()) {
|
|
475
|
-
this.cancelSelections();
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
this.dataSource.data.forEach((entity) => {
|
|
479
|
-
this.selection.select(entity);
|
|
480
|
-
this.store.selectEntity(entity.id);
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
// endregion
|
|
485
|
-
// region protected, private helper methods
|
|
486
|
-
cancelSelections() {
|
|
487
|
-
this.store.deselectAll();
|
|
488
|
-
this.selection.clear();
|
|
489
|
-
}
|
|
490
|
-
doFilter(filterKey) {
|
|
491
|
-
this.dataSource.filter = filterKey.trim().toLocaleLowerCase();
|
|
492
|
-
}
|
|
493
|
-
getPropertyValue(entity, property) {
|
|
494
|
-
return Reflect.get(entity, property);
|
|
495
|
-
}
|
|
496
|
-
loadAllData() {
|
|
497
|
-
const pathParams = new Map([]);
|
|
498
|
-
const filters = [];
|
|
499
|
-
this.store.load({ pathParams, filters });
|
|
500
|
-
}
|
|
501
|
-
registerEffects() {
|
|
502
|
-
effect(() => (this.dataSource.data = this.store.entities()));
|
|
503
|
-
effect(() => {
|
|
504
|
-
if (this.store.filterKey())
|
|
505
|
-
this.doFilter(this.store.filterKey());
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
// endregion
|
|
509
|
-
// region properties
|
|
510
|
-
isAllSelected() {
|
|
511
|
-
const numSelected = this.selection.selected.length;
|
|
512
|
-
const numRows = this.dataSource.data.length;
|
|
513
|
-
return numSelected == numRows;
|
|
514
|
-
}
|
|
515
|
-
isSelected(row) {
|
|
516
|
-
return this.selection.isSelected(row);
|
|
517
|
-
}
|
|
518
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
519
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", 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<table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 demo-table\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <th mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </th>\n <td 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 </td>\n </ng-container>\n\n <ng-container *ngFor=\"let colDescriptor of columnDescriptors(); index as i\" [matColumnDef]=\"colDescriptor.attrName\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</th>\n <!-- //NOSONAR --><td (click)=\"onRowClick(element)\" *matCellDef=\"let element\" mat-cell>\n @if (colDescriptor.isLinkToDetails === true) {\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 {\n {{ element[colDescriptor.attrName] }}\n }\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns()\"></tr>\n</table>\n<mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\n", styles: [".mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}\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: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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"] }] });
|
|
520
|
-
}
|
|
521
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityListComponent, decorators: [{
|
|
522
|
-
type: Component,
|
|
523
|
-
args: [{ selector: 'base-list', standalone: true, imports: [
|
|
524
|
-
MatTable,
|
|
525
|
-
MatSort,
|
|
526
|
-
MatHeaderCell,
|
|
527
|
-
MatPaginator,
|
|
528
|
-
MatHeaderRow,
|
|
529
|
-
MatRow,
|
|
530
|
-
MatCell,
|
|
531
|
-
MatColumnDef,
|
|
532
|
-
NgForOf,
|
|
533
|
-
MatHeaderCellDef,
|
|
534
|
-
MatCellDef,
|
|
535
|
-
MatHeaderRowDef,
|
|
536
|
-
MatRowDef,
|
|
537
|
-
MatSortHeader,
|
|
538
|
-
MatProgressBar,
|
|
539
|
-
MatCheckbox,
|
|
540
|
-
], template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 demo-table\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <th mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </th>\n <td 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 </td>\n </ng-container>\n\n <ng-container *ngFor=\"let colDescriptor of columnDescriptors(); index as i\" [matColumnDef]=\"colDescriptor.attrName\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</th>\n <!-- //NOSONAR --><td (click)=\"onRowClick(element)\" *matCellDef=\"let element\" mat-cell>\n @if (colDescriptor.isLinkToDetails === true) {\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 {\n {{ element[colDescriptor.attrName] }}\n }\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns()\"></tr>\n</table>\n<mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\n", styles: [".mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}\n"] }]
|
|
541
|
-
}], ctorParameters: () => [], propDecorators: { sort: [{
|
|
542
|
-
type: ViewChild,
|
|
543
|
-
args: [MatSort]
|
|
544
|
-
}], paginator: [{
|
|
545
|
-
type: ViewChild,
|
|
546
|
-
args: [MatPaginator]
|
|
547
|
-
}] } });
|
|
548
|
-
|
|
549
|
-
const BASE_ENTITY_ROUTES = [
|
|
550
|
-
{ path: '', redirectTo: 'list', pathMatch: 'full' },
|
|
551
|
-
{ path: ':id/details', component: BaseEntityFormComponent },
|
|
552
|
-
{ path: 'list', component: BaseEntityListComponent },
|
|
553
|
-
];
|
|
554
|
-
|
|
555
|
-
const INITIAL_CONTAINER_STATE = {
|
|
556
|
-
filterKey: undefined,
|
|
557
|
-
};
|
|
558
|
-
function BaseEntityContainerStore() {
|
|
559
|
-
return signalStoreFeature(withState(INITIAL_CONTAINER_STATE), withMethods((store) => {
|
|
560
|
-
function doFilter(filterKey) {
|
|
561
|
-
patchState(store, { filterKey });
|
|
562
|
-
}
|
|
563
|
-
return { doFilter };
|
|
564
|
-
}));
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
var RouteSegments;
|
|
568
|
-
(function (RouteSegments) {
|
|
569
|
-
RouteSegments["LIST_ROUTE"] = "LIST_ROUTE";
|
|
570
|
-
RouteSegments["DETAILS_ROUTE"] = "DETAILS_ROUTE";
|
|
571
|
-
})(RouteSegments || (RouteSegments = {}));
|
|
572
|
-
const INITIAL_NAVIGATION_STATE = {
|
|
573
|
-
activeRouteSegment: RouteSegments.LIST_ROUTE,
|
|
574
|
-
entityName: '',
|
|
575
|
-
navigateTo: '',
|
|
576
|
-
returnTo: '',
|
|
577
|
-
};
|
|
578
|
-
function snakeCaseName(entityName) {
|
|
579
|
-
return entityName
|
|
580
|
-
.split(/(?=[A-Z])/)
|
|
581
|
-
.join('-')
|
|
582
|
-
.toLowerCase();
|
|
583
|
-
}
|
|
584
|
-
function BaseFormNavigatorStore(entityName) {
|
|
585
|
-
return signalStoreFeature(withState(INITIAL_NAVIGATION_STATE), withMethods((store, router = inject(Router), route = inject(ActivatedRoute)) => {
|
|
586
|
-
function determineActiveRouteSegment() {
|
|
587
|
-
const currentUrl = Reflect.get(route, '_routerState').snapshot.url;
|
|
588
|
-
if (currentUrl.endsWith(BaseUrlSegments.ListForm)) {
|
|
589
|
-
patchState(store, { activeRouteSegment: RouteSegments.LIST_ROUTE });
|
|
590
|
-
}
|
|
591
|
-
else if (currentUrl.endsWith(BaseUrlSegments.DetailsForm)) {
|
|
592
|
-
patchState(store, { activeRouteSegment: RouteSegments.DETAILS_ROUTE });
|
|
593
|
-
}
|
|
594
|
-
else {
|
|
595
|
-
patchState(store, { activeRouteSegment: undefined });
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
function determineBaseUrl() {
|
|
599
|
-
determineActiveRouteSegment();
|
|
600
|
-
const currentUrl = determineCurrentUrl();
|
|
601
|
-
return store.activeRouteSegment() === RouteSegments.DETAILS_ROUTE ? levelUpUrl(levelUpUrl(levelUpUrl(currentUrl))) : levelUpUrl(levelUpUrl(currentUrl));
|
|
602
|
-
}
|
|
603
|
-
function determineCurrentUrl() {
|
|
604
|
-
return Reflect.get(route, '_routerState').snapshot.url;
|
|
605
|
-
}
|
|
606
|
-
function levelUpUrl(currentUrl) {
|
|
607
|
-
return currentUrl.substring(0, currentUrl.lastIndexOf('/'));
|
|
608
|
-
}
|
|
609
|
-
async function navigateBack(defaultUrl) {
|
|
610
|
-
const goTo = store.returnTo() ? store.returnTo() : defaultUrl;
|
|
611
|
-
patchState(store, { returnTo: '' });
|
|
612
|
-
if (goTo) {
|
|
613
|
-
router
|
|
614
|
-
.navigateByUrl(goTo)
|
|
615
|
-
.then()
|
|
616
|
-
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
617
|
-
}
|
|
618
|
-
else
|
|
619
|
-
await navigateToList();
|
|
620
|
-
}
|
|
621
|
-
async function navigateToDetails(id, returnTo) {
|
|
622
|
-
if (store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
623
|
-
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
624
|
-
const baseUrl = determineBaseUrl();
|
|
625
|
-
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
626
|
-
await navigateToUrl(detailsFormPath, returnTo);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
async function navigateToList(returnTo) {
|
|
630
|
-
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
631
|
-
const baseUrl = determineBaseUrl();
|
|
632
|
-
const goToUrl = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
633
|
-
if (store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
634
|
-
await navigateToUrl(goToUrl, returnTo);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
async function navigateToRelated(relatedTypeName, id, returnTo) {
|
|
638
|
-
const snakeCaseEntityName = snakeCaseName(relatedTypeName);
|
|
639
|
-
const baseUrl = determineBaseUrl();
|
|
640
|
-
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
641
|
-
await navigateToUrl(detailsFormPath, returnTo);
|
|
642
|
-
}
|
|
643
|
-
async function navigateToUrl(url, returnTo) {
|
|
644
|
-
if (!returnTo)
|
|
645
|
-
patchState(store, { returnTo: router.url });
|
|
646
|
-
else
|
|
647
|
-
patchState(store, { returnTo });
|
|
648
|
-
patchState(store, { navigateTo: url });
|
|
649
|
-
await router
|
|
650
|
-
.navigateByUrl(url)
|
|
651
|
-
.then(() => determineActiveRouteSegment())
|
|
652
|
-
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
653
|
-
}
|
|
654
|
-
return { determineCurrentUrl, determineActiveRouteSegment, navigateBack, navigateToDetails, navigateToList, navigateToRelated, navigateToUrl };
|
|
655
|
-
}), withHooks((store) => ({
|
|
656
|
-
onInit: () => {
|
|
657
|
-
store.determineActiveRouteSegment();
|
|
658
|
-
},
|
|
659
|
-
})));
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
class BaseEntityToolbarComponent {
|
|
663
|
-
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : []));
|
|
664
|
-
layoutService = inject(LayoutService);
|
|
665
|
-
store;
|
|
666
|
-
// region Angular lifecycle hooks
|
|
667
|
-
ngOnInit() {
|
|
668
|
-
this.store = this.baseEntityListOptions().store;
|
|
669
|
-
}
|
|
670
|
-
// endregion
|
|
671
|
-
// event handling methods
|
|
672
|
-
onAddEntity() {
|
|
673
|
-
this.store.navigateToDetails(BaseUrlSegments.NewEntity);
|
|
674
|
-
}
|
|
675
|
-
onDeleteEntities() {
|
|
676
|
-
this.store.selectedEntities().forEach((entity) => this.store.delete(entity.id));
|
|
677
|
-
}
|
|
678
|
-
onDoFilter($event) {
|
|
679
|
-
const filterValue = $event.target.value;
|
|
680
|
-
this.store.doFilter(filterValue);
|
|
681
|
-
}
|
|
682
|
-
// endregion
|
|
683
|
-
// public queries and mutators
|
|
684
|
-
isSmallDevice() {
|
|
685
|
-
return this.layoutService.isSmallDevice();
|
|
686
|
-
}
|
|
687
|
-
// endregion
|
|
688
|
-
// protected, private helper methods
|
|
689
|
-
RouteSegments = RouteSegments;
|
|
690
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
691
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: BaseEntityToolbarComponent, isStandalone: true, selector: "base-entity-toolbar", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"store.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input test-id=\"filter-input\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\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 test-id=\"menu\" #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button test-id=\"add\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"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 test-id=\"add\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>", 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: "component", type: 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: 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"] }] });
|
|
692
|
-
}
|
|
693
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
|
|
694
|
-
type: Component,
|
|
695
|
-
args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbar, MatIcon, MatFormField, MatInput, MatButton, MatMenu, MatMenuItem, MatMenuTrigger], template: "<mat-toolbar *ngIf=\"store.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input test-id=\"filter-input\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\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 test-id=\"menu\" #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button test-id=\"add\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"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 test-id=\"add\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>" }]
|
|
696
|
-
}], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
697
|
-
|
|
698
|
-
class BaseEntityStatusbarComponent {
|
|
699
|
-
store;
|
|
700
|
-
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : []));
|
|
701
|
-
entityTitle = computed(() => this.evaluateEntityTitle(this.baseEntityListOptions().entityTitle), ...(ngDevMode ? [{ debugName: "entityTitle" }] : []));
|
|
702
|
-
isVisible = computed(() => this.store.currentEntity() != undefined || this.store.selectedEntities().length == 1, ...(ngDevMode ? [{ debugName: "isVisible" }] : []));
|
|
703
|
-
// region Angular lifecycle hooks
|
|
704
|
-
ngOnInit() {
|
|
705
|
-
this.store = this.baseEntityListOptions().store;
|
|
706
|
-
}
|
|
707
|
-
// endregion
|
|
708
|
-
// event handling methods
|
|
709
|
-
// endregion
|
|
710
|
-
// protected, private helper methods
|
|
711
|
-
evaluateEntityTitle(title) {
|
|
712
|
-
return eval(title); //NOSONAR the value title comes from a trusted source
|
|
713
|
-
}
|
|
714
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityStatusbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
715
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.9", type: BaseEntityStatusbarComponent, isStandalone: true, selector: "base-entity-statusbar", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"isVisible()\">\n <div>\n <span>{{entityTitle()}}</span>\n </div>\n</mat-toolbar>", 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"] }] });
|
|
716
|
-
}
|
|
717
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityStatusbarComponent, decorators: [{
|
|
718
|
-
type: Component,
|
|
719
|
-
args: [{ selector: 'base-entity-statusbar', standalone: true, imports: [CommonModule, MatToolbar], template: "<mat-toolbar *ngIf=\"isVisible()\">\n <div>\n <span>{{entityTitle()}}</span>\n </div>\n</mat-toolbar>" }]
|
|
720
|
-
}], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
721
|
-
|
|
722
|
-
class BaseEntityTabsComponent {
|
|
723
|
-
store;
|
|
724
|
-
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : []));
|
|
725
|
-
selectedEntityId = computed(() => (this.store.currentId() ? this.store.currentId() : BaseUrlSegments.NewEntity), ...(ngDevMode ? [{ debugName: "selectedEntityId" }] : []));
|
|
726
|
-
detailsTabName = computed(() => this.baseEntityListOptions().entityName + ' - details', ...(ngDevMode ? [{ debugName: "detailsTabName" }] : []));
|
|
727
|
-
listTabName = computed(() => this.baseEntityListOptions().entityName + ' - list', ...(ngDevMode ? [{ debugName: "listTabName" }] : []));
|
|
728
|
-
constructor() {
|
|
729
|
-
this.registerEffects();
|
|
730
|
-
}
|
|
731
|
-
// region angular lifecycle hooks
|
|
732
|
-
ngOnDestroy() {
|
|
733
|
-
this.store.tabIsInactive(this.listTabName());
|
|
734
|
-
this.store.tabIsInactive(this.detailsTabName());
|
|
863
|
+
this.store.setCurrentEntity(entity.id);
|
|
735
864
|
}
|
|
736
|
-
|
|
737
|
-
this.store
|
|
865
|
+
onNavigateToRelated(config, entity) {
|
|
866
|
+
this.store.navigateToRelated(config.linkedEntityType, this.getPropertyValue(entity, config.attrName));
|
|
738
867
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
if (this.store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
743
|
-
const id = this.selectedEntityId() ? this.selectedEntityId() : BaseUrlSegments.NewEntity;
|
|
744
|
-
await this.store.navigateToDetails(id);
|
|
745
|
-
this.store.tabIsActive(this.detailsTabName());
|
|
746
|
-
}
|
|
868
|
+
onRowClick(entity) {
|
|
869
|
+
this.selection.toggle(entity);
|
|
870
|
+
this.onChangeSelection(entity);
|
|
747
871
|
}
|
|
748
|
-
|
|
749
|
-
if (this.
|
|
750
|
-
|
|
751
|
-
|
|
872
|
+
onToggleAllRows() {
|
|
873
|
+
if (this.isAllSelected()) {
|
|
874
|
+
this.cancelSelections();
|
|
875
|
+
}
|
|
876
|
+
else {
|
|
877
|
+
this.dataSource.data.forEach((entity) => {
|
|
878
|
+
this.selection.select(entity);
|
|
879
|
+
this.store.selectEntity(entity.id);
|
|
880
|
+
});
|
|
752
881
|
}
|
|
753
882
|
}
|
|
754
883
|
// endregion
|
|
755
884
|
// region protected, private helper methods
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
this.store.tabIsActive(this.detailsTabName());
|
|
760
|
-
}
|
|
761
|
-
else {
|
|
762
|
-
this.store.tabIsActive(this.listTabName());
|
|
763
|
-
}
|
|
764
|
-
});
|
|
885
|
+
cancelSelections() {
|
|
886
|
+
this.store.deselectAll();
|
|
887
|
+
this.selection.clear();
|
|
765
888
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
}
|
|
769
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityTabsComponent, decorators: [{
|
|
770
|
-
type: Component,
|
|
771
|
-
args: [{ selector: 'base-entity-tabs', standalone: true, imports: [CommonModule, MatTabNav, MatTabLink, MatTabNavPanel, RouterOutlet, BaseEntityToolbarComponent, BaseEntityStatusbarComponent], template: "<nav mat-tab-nav-bar [tabPanel]=\"tabPanel\">\n <a mat-tab-link (click)=\"onShowList()\" [active]=\"store.currentTab() === listTabName()\">{{listTabName()}}</a>\n <a mat-tab-link [disabled]=\"store.currentEntity() === undefined\" (click)=\"onShowDetails()\" [active]=\"store.currentTab() === detailsTabName()\">{{detailsTabName()}}</a>\n</nav>\n\n<mat-tab-nav-panel #tabPanel>\n <base-entity-statusbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <base-entity-toolbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <router-outlet [routerOutletData]=\"baseEntityListOptions()\"/>\n</mat-tab-nav-panel>" }]
|
|
772
|
-
}], ctorParameters: () => [], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
773
|
-
|
|
774
|
-
class BaseEntityContainerComponent {
|
|
775
|
-
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : []));
|
|
776
|
-
snackBar = inject(MatSnackBar);
|
|
777
|
-
store;
|
|
778
|
-
constructor() {
|
|
779
|
-
this.registerEffects();
|
|
889
|
+
doFilter(filterKey) {
|
|
890
|
+
this.dataSource.filter = filterKey.trim().toLocaleLowerCase();
|
|
780
891
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
this.store.reset();
|
|
892
|
+
getPropertyValue(entity, property) {
|
|
893
|
+
return Reflect.get(entity, property);
|
|
784
894
|
}
|
|
785
|
-
|
|
786
|
-
|
|
895
|
+
loadAllData() {
|
|
896
|
+
const pathParams = new Map([]);
|
|
897
|
+
const filters = [];
|
|
898
|
+
this.store.load({ pathParams, filters });
|
|
787
899
|
}
|
|
788
|
-
// endregion
|
|
789
|
-
// region protected, private helper methods
|
|
790
900
|
registerEffects() {
|
|
901
|
+
effect(() => (this.dataSource.data = this.store.entities()));
|
|
791
902
|
effect(() => {
|
|
792
|
-
if (this.store.
|
|
793
|
-
|
|
794
|
-
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
|
|
795
|
-
}
|
|
903
|
+
if (this.store.filterKey())
|
|
904
|
+
this.doFilter(this.store.filterKey());
|
|
796
905
|
});
|
|
797
906
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
907
|
+
// endregion
|
|
908
|
+
// region properties
|
|
909
|
+
isAllSelected() {
|
|
910
|
+
const numSelected = this.selection.selected.length;
|
|
911
|
+
const numRows = this.dataSource.data.length;
|
|
912
|
+
return numSelected == numRows;
|
|
913
|
+
}
|
|
914
|
+
isSelected(row) {
|
|
915
|
+
return this.selection.isSelected(row);
|
|
916
|
+
}
|
|
917
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
918
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", 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<table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 demo-table\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <th mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </th>\n <td 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 </td>\n </ng-container>\n\n <ng-container *ngFor=\"let colDescriptor of columnDescriptors(); index as i\" [matColumnDef]=\"colDescriptor.attrName\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</th>\n <!-- //NOSONAR --><td (click)=\"onRowClick(element)\" *matCellDef=\"let element\" mat-cell>\n @if (colDescriptor.isLinkToDetails === true) {\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 {\n {{ element[colDescriptor.attrName] }}\n }\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns()\"></tr>\n</table>\n<mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\n", styles: [".mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}\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: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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"] }] });
|
|
804
919
|
}
|
|
805
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
920
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityListComponent, decorators: [{
|
|
806
921
|
type: Component,
|
|
807
|
-
args: [{
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
922
|
+
args: [{ selector: 'base-list', standalone: true, imports: [
|
|
923
|
+
MatTable,
|
|
924
|
+
MatSort,
|
|
925
|
+
MatHeaderCell,
|
|
926
|
+
MatPaginator,
|
|
927
|
+
MatHeaderRow,
|
|
928
|
+
MatRow,
|
|
929
|
+
MatCell,
|
|
930
|
+
MatColumnDef,
|
|
931
|
+
NgForOf,
|
|
932
|
+
MatHeaderCellDef,
|
|
933
|
+
MatCellDef,
|
|
934
|
+
MatHeaderRowDef,
|
|
935
|
+
MatRowDef,
|
|
936
|
+
MatSortHeader,
|
|
937
|
+
MatProgressBar,
|
|
938
|
+
MatCheckbox,
|
|
939
|
+
], template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 demo-table\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <th mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </th>\n <td 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 </td>\n </ng-container>\n\n <ng-container *ngFor=\"let colDescriptor of columnDescriptors(); index as i\" [matColumnDef]=\"colDescriptor.attrName\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</th>\n <!-- //NOSONAR --><td (click)=\"onRowClick(element)\" *matCellDef=\"let element\" mat-cell>\n @if (colDescriptor.isLinkToDetails === true) {\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 {\n {{ element[colDescriptor.attrName] }}\n }\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns()\"></tr>\n</table>\n<mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\n", styles: [".mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}\n"] }]
|
|
940
|
+
}], ctorParameters: () => [], propDecorators: { sort: [{
|
|
941
|
+
type: ViewChild,
|
|
942
|
+
args: [MatSort]
|
|
943
|
+
}], paginator: [{
|
|
944
|
+
type: ViewChild,
|
|
945
|
+
args: [MatPaginator]
|
|
946
|
+
}] } });
|
|
818
947
|
|
|
819
948
|
var OrderByDirection;
|
|
820
949
|
(function (OrderByDirection) {
|
|
@@ -822,138 +951,6 @@ var OrderByDirection;
|
|
|
822
951
|
OrderByDirection["DESC"] = "desc";
|
|
823
952
|
})(OrderByDirection || (OrderByDirection = {}));
|
|
824
953
|
|
|
825
|
-
let BaseEntityRestService = class BaseEntityRestService {
|
|
826
|
-
entityMapper;
|
|
827
|
-
urlProperty;
|
|
828
|
-
resourceUrl;
|
|
829
|
-
runtimeConfiguration = inject(RUNTIME_CONFIGURATION);
|
|
830
|
-
baseUrl;
|
|
831
|
-
httpClient = inject(HttpClient);
|
|
832
|
-
headers = new HttpHeaders({
|
|
833
|
-
'Content-Type': 'application/json; charset=utf-8',
|
|
834
|
-
'Access-Control-Allow-Methods': 'GET, HEAD, PUT, PATCH, POST, DELETE',
|
|
835
|
-
'Access-Control-Allow-Origin-Credentials': 'true',
|
|
836
|
-
'Access-Control-Allow-Headers': 'Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, X-BRZ-User-ID',
|
|
837
|
-
'X-BRZ-User-ID': 'zsolt.zsuffa@extern.brz.gv.at',
|
|
838
|
-
});
|
|
839
|
-
constructor(entityMapper, urlProperty, resourceUrl) {
|
|
840
|
-
this.entityMapper = entityMapper;
|
|
841
|
-
this.urlProperty = urlProperty;
|
|
842
|
-
this.resourceUrl = resourceUrl;
|
|
843
|
-
this.baseUrl = Reflect.get(this.runtimeConfiguration, urlProperty);
|
|
844
|
-
}
|
|
845
|
-
// region public accessor and mutator methods
|
|
846
|
-
delete(id) {
|
|
847
|
-
return this.httpClient.delete(this.resourceUrl + `/${id}`, { headers: this.headers });
|
|
848
|
-
}
|
|
849
|
-
deleteAll() {
|
|
850
|
-
return this.httpClient.delete(this.resourceUrl, { headers: this.headers });
|
|
851
|
-
}
|
|
852
|
-
findAll(page) {
|
|
853
|
-
return this.findByQuery({ page });
|
|
854
|
-
}
|
|
855
|
-
findByQuery(queryCondition) {
|
|
856
|
-
const fullUrl = this.buildFullUrl(this.resourceUrl, queryCondition);
|
|
857
|
-
if (fullUrl) {
|
|
858
|
-
return this.httpClient.get(fullUrl, { headers: this.headers }).pipe(map((httpResponse) => {
|
|
859
|
-
return queryCondition.page ? this.mapPagedResponse(httpResponse) : this.mapSimpleResponse(httpResponse);
|
|
860
|
-
}));
|
|
861
|
-
}
|
|
862
|
-
else
|
|
863
|
-
throw new Error('Could not determine the full url');
|
|
864
|
-
}
|
|
865
|
-
findById(id) {
|
|
866
|
-
const queryCondition = { pathParams: new Map([['id', id]]) };
|
|
867
|
-
const fullUrl = this.buildFullUrl(this.resourceUrl, queryCondition);
|
|
868
|
-
if (fullUrl) {
|
|
869
|
-
return this.httpClient.get(fullUrl, { headers: this.headers }).pipe(map((httpResponse) => {
|
|
870
|
-
return this.mapSimpleResponse(httpResponse);
|
|
871
|
-
}));
|
|
872
|
-
}
|
|
873
|
-
else
|
|
874
|
-
throw new Error('Could not determine the full url');
|
|
875
|
-
}
|
|
876
|
-
add(entity, id) {
|
|
877
|
-
const dto = this.entityMapper.toDto(entity);
|
|
878
|
-
const fullUrl = this.buildFullUrl(this.resourceUrl, {});
|
|
879
|
-
if (fullUrl) {
|
|
880
|
-
return this.httpClient.post(fullUrl, dto, { headers: this.headers }).pipe(map((response) => {
|
|
881
|
-
return this.entityMapper.fromDto(response, id);
|
|
882
|
-
}));
|
|
883
|
-
}
|
|
884
|
-
else
|
|
885
|
-
throw new Error('Could not determine the full url');
|
|
886
|
-
}
|
|
887
|
-
update(entity) {
|
|
888
|
-
const dto = this.entityMapper.toDto(entity);
|
|
889
|
-
const pathParams = new Map([['id', String(entity.id)]]);
|
|
890
|
-
const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}', { pathParams });
|
|
891
|
-
if (fullUrl) {
|
|
892
|
-
return this.httpClient.put(fullUrl, dto, { headers: this.headers }).pipe(map((response) => {
|
|
893
|
-
return this.entityMapper.fromDto(response);
|
|
894
|
-
}));
|
|
895
|
-
}
|
|
896
|
-
else
|
|
897
|
-
throw new Error('Could not determine the full url');
|
|
898
|
-
}
|
|
899
|
-
// endregion
|
|
900
|
-
// region protected, private helper methods
|
|
901
|
-
buildFullUrl(resourceUri, queryCondition) {
|
|
902
|
-
const queryParams = new Map();
|
|
903
|
-
if (queryCondition.page)
|
|
904
|
-
queryParams.set('page', queryCondition.page.toString());
|
|
905
|
-
if (queryCondition.filters !== undefined && queryCondition.filters.length != 0) {
|
|
906
|
-
queryCondition.filters.forEach((filter) => queryParams.set(filter.property, filter.value));
|
|
907
|
-
}
|
|
908
|
-
let params = {};
|
|
909
|
-
if (queryParams.size > 0) {
|
|
910
|
-
for (const [key, value] of queryParams) {
|
|
911
|
-
params = { ...params, [key]: value };
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
else
|
|
915
|
-
params = null;
|
|
916
|
-
if (queryCondition.pathParams !== undefined && queryCondition.pathParams.size != 0) {
|
|
917
|
-
queryCondition.pathParams.forEach((value, key) => {
|
|
918
|
-
const pathParam = '%{' + key + '}';
|
|
919
|
-
resourceUri = resourceUri.replace(pathParam, value);
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
const urlOptions = {
|
|
923
|
-
path: resourceUri,
|
|
924
|
-
hash: queryCondition.hash,
|
|
925
|
-
queryParams: params,
|
|
926
|
-
};
|
|
927
|
-
return buildUrl(this.baseUrl, urlOptions);
|
|
928
|
-
}
|
|
929
|
-
mapPagedResponse(response) {
|
|
930
|
-
const subjectPage = response[0];
|
|
931
|
-
const content = subjectPage.content.map((dto, index) => {
|
|
932
|
-
return this.entityMapper.fromDto(dto, index);
|
|
933
|
-
});
|
|
934
|
-
return {
|
|
935
|
-
page: subjectPage.page,
|
|
936
|
-
pageSize: subjectPage.pageSize,
|
|
937
|
-
totalPageCount: subjectPage.totalPageCount,
|
|
938
|
-
content,
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
mapSimpleResponse(response) {
|
|
942
|
-
if (Object.prototype.toString.call(response) === '[object Array]') {
|
|
943
|
-
return response.map((dto, index) => {
|
|
944
|
-
return this.entityMapper.fromDto(dto, index);
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
else {
|
|
948
|
-
return new Array(this.entityMapper.fromDto(response));
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
};
|
|
952
|
-
BaseEntityRestService = __decorate([
|
|
953
|
-
__param(0, Inject('entityMapper')),
|
|
954
|
-
__metadata("design:paramtypes", [Object, String, String])
|
|
955
|
-
], BaseEntityRestService);
|
|
956
|
-
|
|
957
954
|
const INITIAL_TABS_STATE = {
|
|
958
955
|
activeTabs: [],
|
|
959
956
|
currentTab: undefined,
|
|
@@ -1237,8 +1234,7 @@ let BaseEntityFirestoreService = class BaseEntityFirestoreService {
|
|
|
1237
1234
|
}
|
|
1238
1235
|
};
|
|
1239
1236
|
BaseEntityFirestoreService = __decorate([
|
|
1240
|
-
__param(0, Inject('entityMapper'))
|
|
1241
|
-
__metadata("design:paramtypes", [Object, String])
|
|
1237
|
+
__param(0, Inject('entityMapper'))
|
|
1242
1238
|
], BaseEntityFirestoreService);
|
|
1243
1239
|
|
|
1244
1240
|
// Symbol to store entity options on instance
|
|
@@ -1317,6 +1313,12 @@ function getEntityIds(instance) {
|
|
|
1317
1313
|
return Reflect.getMetadata(ENTITY_ID_PROPERTIES_KEY, constructor) || [];
|
|
1318
1314
|
}
|
|
1319
1315
|
|
|
1316
|
+
const BASE_ENTITY_ROUTES = [
|
|
1317
|
+
{ path: '', redirectTo: 'list', pathMatch: 'full' },
|
|
1318
|
+
{ path: ':id/details', component: BaseEntityFormComponent },
|
|
1319
|
+
{ path: 'list', component: BaseEntityListComponent },
|
|
1320
|
+
];
|
|
1321
|
+
|
|
1320
1322
|
// Public API Surface of @processpuzzle/base-entity
|
|
1321
1323
|
|
|
1322
1324
|
/**
|