@processpuzzle/base-entity 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, Component, computed, effect, Inject, Directive, Injectable, EventEmitter, Output, ViewChild,
|
|
2
|
+
import { inject, input, Component, computed, effect, Inject, Directive, InjectionToken, Injector, Injectable, EventEmitter, Output, signal, ViewChild, DestroyRef, untracked, isDevMode } from '@angular/core';
|
|
3
3
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
4
|
import * as i1 from '@angular/common';
|
|
5
|
-
import { CommonModule, NgStyle, NgIf,
|
|
6
|
-
import { Router, ActivatedRoute, RouterOutlet, ROUTER_OUTLET_DATA } from '@angular/router';
|
|
5
|
+
import { CommonModule, NgClass, NgStyle, NgIf, NgForOf, SlicePipe } from '@angular/common';
|
|
6
|
+
import { NavigationEnd, Router, ActivatedRoute, RouterOutlet, ROUTER_OUTLET_DATA } from '@angular/router';
|
|
7
7
|
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
|
8
8
|
import { MatToolbar } from '@angular/material/toolbar';
|
|
9
9
|
import { MatIcon } from '@angular/material/icon';
|
|
10
|
-
import { MatButton } from '@angular/material/button';
|
|
10
|
+
import { MatButton, MatIconButton } from '@angular/material/button';
|
|
11
11
|
import * as i3 from '@angular/material/form-field';
|
|
12
|
-
import { MatFormField, MatFormFieldModule, MatLabel, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
12
|
+
import { MatFormField, MatFormFieldModule, MatLabel, MatSuffix, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
13
13
|
import * as i4 from '@angular/material/input';
|
|
14
14
|
import { MatInput, MatInputModule } from '@angular/material/input';
|
|
15
15
|
import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
|
16
|
-
import {
|
|
17
|
-
import { LayoutService, RUNTIME_CONFIGURATION } from '@processpuzzle/util';
|
|
16
|
+
import { signalStore, withState, withMethods, patchState, withHooks, signalStoreFeature, withProps, watchState, withComputed } from '@ngrx/signals';
|
|
17
|
+
import { Stack, LayoutService, RUNTIME_CONFIGURATION } from '@processpuzzle/util';
|
|
18
18
|
import { __decorate, __param } from 'tslib';
|
|
19
|
-
import { map,
|
|
19
|
+
import { map, filter, switchMap, pipe, tap, from, of } from 'rxjs';
|
|
20
20
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
21
21
|
import { buildUrl } from 'build-url-ts';
|
|
22
22
|
import * as i1$1 from '@angular/forms';
|
|
23
23
|
import { ReactiveFormsModule, FormsModule, FormControl, Validators, FormBuilder } from '@angular/forms';
|
|
24
24
|
import { MatCard, MatCardContent, MatCardActions } from '@angular/material/card';
|
|
25
|
+
import { MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose, MatDialog } from '@angular/material/dialog';
|
|
26
|
+
import { TranslocoService, provideTranslocoScope } from '@jsverse/transloco';
|
|
25
27
|
import * as i5 from '@angular/material/datepicker';
|
|
26
28
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
27
29
|
import * as i2 from '@angular/material/select';
|
|
@@ -30,11 +32,15 @@ import { MatCheckbox } from '@angular/material/checkbox';
|
|
|
30
32
|
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
31
33
|
import { MatChipGrid, MatChipRow, MatChipInput, MatChipRemove } from '@angular/material/chips';
|
|
32
34
|
import { NGXLogger } from 'ngx-logging-kit';
|
|
35
|
+
import * as i2$1 from '@angular/material/autocomplete';
|
|
36
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
37
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
33
38
|
import { MatTableDataSource, MatTable, MatHeaderCell, MatHeaderRow, MatRow, MatCell, MatColumnDef, MatHeaderCellDef, MatCellDef, MatHeaderRowDef, MatRowDef } from '@angular/material/table';
|
|
34
39
|
import { MatSort, MatSortHeader } from '@angular/material/sort';
|
|
35
40
|
import { MatPaginator } from '@angular/material/paginator';
|
|
36
41
|
import { MatProgressBar } from '@angular/material/progress-bar';
|
|
37
42
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
43
|
+
import { withDevtools } from '@angular-architects/ngrx-toolkit';
|
|
38
44
|
import { tapResponse } from '@ngrx/operators';
|
|
39
45
|
import { rxMethod } from '@ngrx/signals/rxjs-interop';
|
|
40
46
|
import { Firestore, collection, doc, deleteDoc, getDoc, setDoc, orderBy, where, query, limit, getDocs, updateDoc } from '@angular/fire/firestore';
|
|
@@ -44,11 +50,13 @@ var FormControlType;
|
|
|
44
50
|
(function (FormControlType) {
|
|
45
51
|
FormControlType["ARTIFACT"] = "ARTIFACT";
|
|
46
52
|
FormControlType["CHECKBOX"] = "CHECKBOX";
|
|
53
|
+
FormControlType["COMPONENTS"] = "COMPONENTS";
|
|
47
54
|
FormControlType["DATE"] = "DATE";
|
|
48
55
|
FormControlType["DROPDOWN"] = "DROPDOWN";
|
|
49
56
|
FormControlType["FLEX_BOX"] = "FLEX_BOX";
|
|
50
57
|
FormControlType["FOREIGN_KEY"] = "FOREIGN_KEY";
|
|
51
58
|
FormControlType["LABEL"] = "LABEL";
|
|
59
|
+
FormControlType["LOOKUP"] = "LOOKUP";
|
|
52
60
|
FormControlType["RADIO"] = "RADIO";
|
|
53
61
|
FormControlType["TAGS"] = "TAGS";
|
|
54
62
|
FormControlType["TITLE"] = "TITLE";
|
|
@@ -69,6 +77,7 @@ class AbstractAttrDescriptor {
|
|
|
69
77
|
var BaseUrlSegments;
|
|
70
78
|
(function (BaseUrlSegments) {
|
|
71
79
|
BaseUrlSegments["DetailsForm"] = "details";
|
|
80
|
+
BaseUrlSegments["EntityID"] = "entityId";
|
|
72
81
|
BaseUrlSegments["Feed"] = "feed";
|
|
73
82
|
BaseUrlSegments["ListForm"] = "list";
|
|
74
83
|
BaseUrlSegments["NewEntity"] = "new";
|
|
@@ -85,106 +94,245 @@ const INITIAL_NAVIGATION_STATE = {
|
|
|
85
94
|
entityName: '',
|
|
86
95
|
navigationError: undefined,
|
|
87
96
|
navigateTo: '',
|
|
97
|
+
responsePayloads: new Stack(),
|
|
98
|
+
requestPayloads: new Stack(),
|
|
88
99
|
returnTo: '',
|
|
89
100
|
};
|
|
90
101
|
function snakeCaseName(entityName) {
|
|
91
102
|
return entityName
|
|
103
|
+
.replace(/\s+/g, '')
|
|
92
104
|
.split(/(?=[A-Z])/)
|
|
93
105
|
.join('-')
|
|
94
106
|
.toLowerCase();
|
|
95
107
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
const BaseFormNavigatorSingletonStore = signalStore({ providedIn: 'root' }, withState(INITIAL_NAVIGATION_STATE), withMethods((store, router = inject(Router), route = inject(ActivatedRoute)) => {
|
|
109
|
+
let pendingNavigatorUrl;
|
|
110
|
+
let routerEventsSubscription;
|
|
111
|
+
function clearPayloadStacks() {
|
|
112
|
+
patchState(store, {
|
|
113
|
+
requestPayloads: new Stack(),
|
|
114
|
+
responsePayloads: new Stack(),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function determineActiveRouteSegment() {
|
|
118
|
+
const currentUrl = Reflect.get(route, '_routerState').snapshot.url;
|
|
119
|
+
if (currentUrl.endsWith(BaseUrlSegments.ListForm)) {
|
|
120
|
+
patchState(store, { activeRouteSegment: RouteSegments.LIST_ROUTE });
|
|
121
|
+
}
|
|
122
|
+
else if (currentUrl.endsWith(BaseUrlSegments.DetailsForm)) {
|
|
123
|
+
patchState(store, { activeRouteSegment: RouteSegments.DETAILS_ROUTE });
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
patchState(store, { activeRouteSegment: undefined });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function determineBaseUrl() {
|
|
130
|
+
determineActiveRouteSegment();
|
|
131
|
+
const currentUrl = determineCurrentUrl();
|
|
132
|
+
return store.activeRouteSegment() === RouteSegments.DETAILS_ROUTE ? levelUpUrl(levelUpUrl(levelUpUrl(currentUrl))) : levelUpUrl(levelUpUrl(currentUrl));
|
|
133
|
+
}
|
|
134
|
+
function determineCurrentUrl() {
|
|
135
|
+
return Reflect.get(route, '_routerState').snapshot.url;
|
|
136
|
+
}
|
|
137
|
+
function levelUpUrl(currentUrl) {
|
|
138
|
+
return currentUrl.substring(0, currentUrl.lastIndexOf('/'));
|
|
139
|
+
}
|
|
140
|
+
function normalizeUrl(url) {
|
|
141
|
+
return url.startsWith('/') ? url : '/' + url;
|
|
142
|
+
}
|
|
143
|
+
function isPendingNavigatorUrl(navigationEnd) {
|
|
144
|
+
if (!pendingNavigatorUrl) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
const normalizedPendingUrl = normalizeUrl(pendingNavigatorUrl);
|
|
148
|
+
return [navigationEnd.url, navigationEnd.urlAfterRedirects].some((url) => normalizeUrl(url) === normalizedPendingUrl);
|
|
149
|
+
}
|
|
150
|
+
function initializeNavigationTracking() {
|
|
151
|
+
routerEventsSubscription ??= router.events.subscribe((event) => {
|
|
152
|
+
if (!(event instanceof NavigationEnd)) {
|
|
153
|
+
return;
|
|
102
154
|
}
|
|
103
|
-
|
|
104
|
-
|
|
155
|
+
if (isPendingNavigatorUrl(event)) {
|
|
156
|
+
pendingNavigatorUrl = undefined;
|
|
105
157
|
}
|
|
106
158
|
else {
|
|
107
|
-
|
|
159
|
+
clearPayloadStacks();
|
|
108
160
|
}
|
|
109
|
-
}
|
|
110
|
-
function determineBaseUrl() {
|
|
111
161
|
determineActiveRouteSegment();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
async function navigateToDetails(id, returnTo) {
|
|
134
|
-
if (store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
135
|
-
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
136
|
-
const baseUrl = determineBaseUrl();
|
|
137
|
-
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
138
|
-
await navigateToUrl(detailsFormPath, returnTo);
|
|
139
|
-
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function destroyNavigationTracking() {
|
|
165
|
+
routerEventsSubscription?.unsubscribe();
|
|
166
|
+
routerEventsSubscription = undefined;
|
|
167
|
+
}
|
|
168
|
+
async function navigateBack(defaultUrl) {
|
|
169
|
+
const goTo = store.returnTo() ? store.returnTo() : defaultUrl;
|
|
170
|
+
const navigatorPayloads = new Stack(store.requestPayloads().toArray());
|
|
171
|
+
navigatorPayloads.pop();
|
|
172
|
+
patchState(store, { requestPayloads: navigatorPayloads, returnTo: '' });
|
|
173
|
+
if (goTo) {
|
|
174
|
+
pendingNavigatorUrl = goTo;
|
|
175
|
+
await router
|
|
176
|
+
.navigateByUrl(goTo)
|
|
177
|
+
.then()
|
|
178
|
+
.catch((error) => {
|
|
179
|
+
pendingNavigatorUrl = undefined;
|
|
180
|
+
patchState(store, { navigationError: error.message });
|
|
181
|
+
});
|
|
140
182
|
}
|
|
141
|
-
|
|
183
|
+
else
|
|
184
|
+
await navigateToList(store.entityName());
|
|
185
|
+
}
|
|
186
|
+
async function navigateToDetails(entityName, id, returnTo, payload) {
|
|
187
|
+
patchState(store, { entityName });
|
|
188
|
+
pushPayload(payload);
|
|
189
|
+
if (store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
142
190
|
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
143
191
|
const baseUrl = determineBaseUrl();
|
|
144
|
-
const goToUrl = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
145
|
-
if (store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
146
|
-
await navigateToUrl(goToUrl, returnTo);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
async function navigateToRelated(relatedTypeName, id, returnTo) {
|
|
150
|
-
const snakeCaseEntityName = snakeCaseName(relatedTypeName);
|
|
151
|
-
const baseUrl = determineBaseUrl();
|
|
152
192
|
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
153
193
|
await navigateToUrl(detailsFormPath, returnTo);
|
|
154
194
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
await
|
|
164
|
-
.navigateByUrl(url)
|
|
165
|
-
.then(() => determineActiveRouteSegment())
|
|
166
|
-
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
195
|
+
}
|
|
196
|
+
async function navigateToList(entityName, returnTo, payload) {
|
|
197
|
+
patchState(store, { entityName });
|
|
198
|
+
pushPayload(payload);
|
|
199
|
+
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
200
|
+
const baseUrl = determineBaseUrl();
|
|
201
|
+
const goToUrl = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
202
|
+
if (store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
203
|
+
await navigateToUrl(goToUrl, returnTo);
|
|
167
204
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
205
|
+
}
|
|
206
|
+
async function navigateToRelated(relatedTypeName, id, returnTo, payload) {
|
|
207
|
+
patchState(store, { entityName: relatedTypeName });
|
|
208
|
+
pushPayload(payload);
|
|
209
|
+
const snakeCaseEntityName = snakeCaseName(relatedTypeName);
|
|
210
|
+
const baseUrl = determineBaseUrl();
|
|
211
|
+
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
212
|
+
await navigateToUrl(detailsFormPath, returnTo);
|
|
213
|
+
}
|
|
214
|
+
async function navigateToRelatedList(relatedTypeName, returnTo, payload) {
|
|
215
|
+
patchState(store, { entityName: relatedTypeName });
|
|
216
|
+
pushPayload(payload);
|
|
217
|
+
const snakeCaseEntityName = snakeCaseName(relatedTypeName);
|
|
218
|
+
const baseUrl = determineBaseUrl();
|
|
219
|
+
const listPath = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
220
|
+
await navigateToUrl(listPath, returnTo);
|
|
221
|
+
}
|
|
222
|
+
function setEntityName(entityName) {
|
|
223
|
+
patchState(store, { entityName });
|
|
224
|
+
}
|
|
225
|
+
function pushPayload(payload) {
|
|
226
|
+
if (payload) {
|
|
227
|
+
const navigatorPayloads = new Stack(store.requestPayloads().toArray());
|
|
228
|
+
navigatorPayloads.push(payload);
|
|
229
|
+
patchState(store, { requestPayloads: navigatorPayloads });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function popRequestPayload() {
|
|
233
|
+
const navigatorPayloads = new Stack(store.requestPayloads().toArray());
|
|
234
|
+
const payload = navigatorPayloads.pop();
|
|
235
|
+
patchState(store, { requestPayloads: navigatorPayloads });
|
|
236
|
+
return payload;
|
|
237
|
+
}
|
|
238
|
+
function popResponsePayload(command) {
|
|
239
|
+
const responsePayloadArray = store.responsePayloads().toArray();
|
|
240
|
+
const payloadIndex = command === undefined ? responsePayloadArray.length - 1 : responsePayloadArray.map((payload) => payload.command).lastIndexOf(command);
|
|
241
|
+
if (payloadIndex < 0) {
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
const [payload] = responsePayloadArray.splice(payloadIndex, 1);
|
|
245
|
+
patchState(store, { responsePayloads: new Stack(responsePayloadArray) });
|
|
246
|
+
return payload;
|
|
247
|
+
}
|
|
248
|
+
function pushResponsePayload(payload) {
|
|
249
|
+
const responsePayloads = new Stack(store.responsePayloads().toArray());
|
|
250
|
+
responsePayloads.push(payload);
|
|
251
|
+
patchState(store, { responsePayloads });
|
|
252
|
+
}
|
|
253
|
+
async function navigateToUrl(url, returnTo) {
|
|
254
|
+
if (returnTo) {
|
|
255
|
+
patchState(store, { returnTo });
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
patchState(store, { returnTo: router.url });
|
|
259
|
+
}
|
|
260
|
+
pendingNavigatorUrl = url;
|
|
261
|
+
patchState(store, { navigateTo: url });
|
|
262
|
+
await router
|
|
263
|
+
.navigateByUrl(url)
|
|
264
|
+
.then(() => determineActiveRouteSegment())
|
|
265
|
+
.catch((error) => {
|
|
266
|
+
pendingNavigatorUrl = undefined;
|
|
267
|
+
patchState(store, { navigationError: error.message });
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
determineCurrentUrl,
|
|
272
|
+
determineActiveRouteSegment,
|
|
273
|
+
navigateBack,
|
|
274
|
+
navigateToDetails,
|
|
275
|
+
navigateToList,
|
|
276
|
+
navigateToRelated,
|
|
277
|
+
navigateToRelatedList,
|
|
278
|
+
navigateToUrl,
|
|
279
|
+
destroyNavigationTracking,
|
|
280
|
+
initializeNavigationTracking,
|
|
281
|
+
popRequestPayload,
|
|
282
|
+
popResponsePayload,
|
|
283
|
+
pushResponsePayload,
|
|
284
|
+
setEntityName,
|
|
285
|
+
};
|
|
286
|
+
}), withHooks((store) => ({
|
|
287
|
+
onInit: () => {
|
|
288
|
+
store.determineActiveRouteSegment();
|
|
289
|
+
store.initializeNavigationTracking();
|
|
290
|
+
},
|
|
291
|
+
onDestroy: () => {
|
|
292
|
+
store.destroyNavigationTracking();
|
|
293
|
+
},
|
|
294
|
+
})));
|
|
295
|
+
function BaseFormNavigatorStore(entityName) {
|
|
296
|
+
return signalStoreFeature(withProps((_, navigatorStore = inject(BaseFormNavigatorSingletonStore)) => {
|
|
297
|
+
navigatorStore.setEntityName(entityName);
|
|
298
|
+
return {
|
|
299
|
+
activeRouteSegment: navigatorStore.activeRouteSegment,
|
|
300
|
+
entityName: navigatorStore.entityName,
|
|
301
|
+
navigationError: navigatorStore.navigationError,
|
|
302
|
+
navigateTo: navigatorStore.navigateTo,
|
|
303
|
+
navigatorPayloads: navigatorStore.requestPayloads,
|
|
304
|
+
requestPayloads: navigatorStore.requestPayloads,
|
|
305
|
+
responsePayloads: navigatorStore.responsePayloads,
|
|
306
|
+
returnTo: navigatorStore.returnTo,
|
|
307
|
+
determineActiveRouteSegment: navigatorStore.determineActiveRouteSegment,
|
|
308
|
+
determineCurrentUrl: navigatorStore.determineCurrentUrl,
|
|
309
|
+
navigateBack: navigatorStore.navigateBack,
|
|
310
|
+
navigateToDetails: (id, returnTo, payload) => navigatorStore.navigateToDetails(entityName, id, returnTo, payload),
|
|
311
|
+
navigateToList: (returnTo, payload) => navigatorStore.navigateToList(entityName, returnTo, payload),
|
|
312
|
+
navigateToRelated: navigatorStore.navigateToRelated,
|
|
313
|
+
navigateToRelatedList: navigatorStore.navigateToRelatedList,
|
|
314
|
+
navigateToUrl: navigatorStore.navigateToUrl,
|
|
315
|
+
popRequestPayload: navigatorStore.popRequestPayload,
|
|
316
|
+
popResponsePayload: navigatorStore.popResponsePayload,
|
|
317
|
+
pushResponsePayload: navigatorStore.pushResponsePayload,
|
|
318
|
+
};
|
|
319
|
+
}));
|
|
174
320
|
}
|
|
175
321
|
|
|
176
322
|
class BaseEntityToolbarComponent {
|
|
177
323
|
entityDescriptor = input.required(...(ngDevMode ? [{ debugName: "entityDescriptor" }] : /* istanbul ignore next */ []));
|
|
178
324
|
layoutService = inject(LayoutService);
|
|
325
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
179
326
|
store;
|
|
180
327
|
// region Angular lifecycle hooks
|
|
181
328
|
ngOnInit() {
|
|
182
329
|
this.store = this.entityDescriptor().store;
|
|
330
|
+
this.formNavigator.setEntityName(this.entityDescriptor().entityName);
|
|
183
331
|
}
|
|
184
332
|
// endregion
|
|
185
333
|
// event handling methods
|
|
186
334
|
onAddEntity() {
|
|
187
|
-
this.
|
|
335
|
+
this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, BaseUrlSegments.NewEntity);
|
|
188
336
|
}
|
|
189
337
|
onDeleteEntities() {
|
|
190
338
|
this.store.selectedEntities().forEach((entity) => this.store.delete(entity.id));
|
|
@@ -201,12 +349,12 @@ class BaseEntityToolbarComponent {
|
|
|
201
349
|
// endregion
|
|
202
350
|
// protected, private helper methods
|
|
203
351
|
RouteSegments = RouteSegments;
|
|
204
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
205
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
352
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
353
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: BaseEntityToolbarComponent, isStandalone: true, selector: "base-entity-toolbar", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"formNavigator.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input 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>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "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"] }] });
|
|
206
354
|
}
|
|
207
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
|
|
208
356
|
type: Component,
|
|
209
|
-
args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbar, MatIcon, MatFormField, MatInput, MatButton, MatMenu, MatMenuItem, MatMenuTrigger], template: "<mat-toolbar *ngIf=\"
|
|
357
|
+
args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbar, MatIcon, MatFormField, MatInput, MatButton, MatMenu, MatMenuItem, MatMenuTrigger], template: "<mat-toolbar *ngIf=\"formNavigator.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input 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>\n" }]
|
|
210
358
|
}], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
211
359
|
|
|
212
360
|
class BaseEntityStatusbarComponent {
|
|
@@ -226,10 +374,10 @@ class BaseEntityStatusbarComponent {
|
|
|
226
374
|
const fn = new Function('ctx', 'return ' + title.replace(/this\./g, 'ctx.'));
|
|
227
375
|
return fn(this);
|
|
228
376
|
}
|
|
229
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
230
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
377
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityStatusbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
378
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: BaseEntityStatusbarComponent, isStandalone: true, selector: "base-entity-statusbar", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", 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"] }] });
|
|
231
379
|
}
|
|
232
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
380
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityStatusbarComponent, decorators: [{
|
|
233
381
|
type: Component,
|
|
234
382
|
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>" }]
|
|
235
383
|
}], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
@@ -240,6 +388,7 @@ class BaseEntityTabsComponent {
|
|
|
240
388
|
selectedEntityId = computed(() => (this.store.currentId() ? this.store.currentId() : BaseUrlSegments.NewEntity), ...(ngDevMode ? [{ debugName: "selectedEntityId" }] : /* istanbul ignore next */ []));
|
|
241
389
|
detailsTabName = computed(() => this.entityDescriptor().entityName + ' - details', ...(ngDevMode ? [{ debugName: "detailsTabName" }] : /* istanbul ignore next */ []));
|
|
242
390
|
listTabName = computed(() => this.entityDescriptor().entityName + ' - list', ...(ngDevMode ? [{ debugName: "listTabName" }] : /* istanbul ignore next */ []));
|
|
391
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
243
392
|
constructor() {
|
|
244
393
|
this.registerEffects();
|
|
245
394
|
}
|
|
@@ -250,19 +399,20 @@ class BaseEntityTabsComponent {
|
|
|
250
399
|
}
|
|
251
400
|
ngOnInit() {
|
|
252
401
|
this.store = this.entityDescriptor().store;
|
|
402
|
+
this.formNavigator.setEntityName(this.entityDescriptor().entityName);
|
|
253
403
|
}
|
|
254
404
|
// endregion
|
|
255
405
|
// region event handlers
|
|
256
406
|
async onShowDetails() {
|
|
257
|
-
if (this.
|
|
258
|
-
const id = this.selectedEntityId()
|
|
259
|
-
await this.
|
|
407
|
+
if (this.formNavigator.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
408
|
+
const id = this.selectedEntityId() ?? BaseUrlSegments.NewEntity;
|
|
409
|
+
await this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, id);
|
|
260
410
|
this.store.tabIsActive(this.detailsTabName());
|
|
261
411
|
}
|
|
262
412
|
}
|
|
263
413
|
async onShowList() {
|
|
264
|
-
if (this.
|
|
265
|
-
await this.
|
|
414
|
+
if (this.formNavigator.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
415
|
+
await this.formNavigator.navigateToList(this.entityDescriptor().entityName);
|
|
266
416
|
this.store.tabIsActive(this.listTabName());
|
|
267
417
|
}
|
|
268
418
|
}
|
|
@@ -270,7 +420,7 @@ class BaseEntityTabsComponent {
|
|
|
270
420
|
// region protected, private helper methods
|
|
271
421
|
registerEffects() {
|
|
272
422
|
effect(() => {
|
|
273
|
-
if (this.
|
|
423
|
+
if (this.formNavigator.activeRouteSegment() === RouteSegments.DETAILS_ROUTE) {
|
|
274
424
|
this.store.tabIsActive(this.detailsTabName());
|
|
275
425
|
}
|
|
276
426
|
else {
|
|
@@ -278,8 +428,8 @@ class BaseEntityTabsComponent {
|
|
|
278
428
|
}
|
|
279
429
|
});
|
|
280
430
|
}
|
|
281
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
282
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
431
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
432
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: BaseEntityTabsComponent, isStandalone: true, selector: "base-entity-tabs", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
283
433
|
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
|
|
284
434
|
<a mat-tab-link (click)="onShowList()" [active]="store.currentTab() === listTabName()">{{ listTabName() }}</a>
|
|
285
435
|
<a mat-tab-link [disabled]="store.currentEntity() === undefined" (click)="onShowDetails()" [active]="store.currentTab() === detailsTabName()">{{ detailsTabName() }}</a>
|
|
@@ -292,7 +442,7 @@ class BaseEntityTabsComponent {
|
|
|
292
442
|
</mat-tab-nav-panel>
|
|
293
443
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: MatTabNav, selector: "[mat-tab-nav-bar]", inputs: ["fitInkBarToContent", "mat-stretch-tabs", "animationDuration", "backgroundColor", "disableRipple", "color", "tabPanel"], exportAs: ["matTabNavBar", "matTabNav"] }, { kind: "component", type: MatTabLink, selector: "[mat-tab-link], [matTabLink]", inputs: ["active", "disabled", "disableRipple", "tabIndex", "id"], exportAs: ["matTabLink"] }, { kind: "component", type: MatTabNavPanel, selector: "mat-tab-nav-panel", inputs: ["id"], exportAs: ["matTabNavPanel"] }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: BaseEntityToolbarComponent, selector: "base-entity-toolbar", inputs: ["entityDescriptor"] }, { kind: "component", type: BaseEntityStatusbarComponent, selector: "base-entity-statusbar", inputs: ["entityDescriptor"] }] });
|
|
294
444
|
}
|
|
295
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
445
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityTabsComponent, decorators: [{
|
|
296
446
|
type: Component,
|
|
297
447
|
args: [{
|
|
298
448
|
selector: 'base-entity-tabs',
|
|
@@ -337,14 +487,14 @@ class BaseEntityContainerComponent {
|
|
|
337
487
|
}
|
|
338
488
|
});
|
|
339
489
|
}
|
|
340
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
341
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
490
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
491
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: BaseEntityContainerComponent, isStandalone: true, selector: "base-entity-container", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
342
492
|
<div>
|
|
343
493
|
<base-entity-tabs [entityDescriptor]="entityDescriptor()"></base-entity-tabs>
|
|
344
494
|
</div>
|
|
345
495
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BaseEntityTabsComponent, selector: "base-entity-tabs", inputs: ["entityDescriptor"] }] });
|
|
346
496
|
}
|
|
347
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
497
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityContainerComponent, decorators: [{
|
|
348
498
|
type: Component,
|
|
349
499
|
args: [{
|
|
350
500
|
selector: 'base-entity-container',
|
|
@@ -514,11 +664,11 @@ class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
|
514
664
|
placeholder;
|
|
515
665
|
lines;
|
|
516
666
|
options;
|
|
667
|
+
required = false;
|
|
517
668
|
_label;
|
|
518
669
|
_linkedEntityType;
|
|
519
670
|
constructor(attrName, formControlType, label, selectables, isLinkToDetails, options) {
|
|
520
671
|
super(attrName, formControlType);
|
|
521
|
-
this.attrName = attrName;
|
|
522
672
|
this._label = label;
|
|
523
673
|
this.selectables = selectables;
|
|
524
674
|
this.isLinkToDetails = isLinkToDetails;
|
|
@@ -544,10 +694,10 @@ class BaseFormHostDirective {
|
|
|
544
694
|
constructor(viewContainerRef) {
|
|
545
695
|
this.viewContainerRef = viewContainerRef;
|
|
546
696
|
}
|
|
547
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
548
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.
|
|
697
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseFormHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
698
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.12", type: BaseFormHostDirective, isStandalone: true, selector: "[baseFormHost]", ngImport: i0 });
|
|
549
699
|
}
|
|
550
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
700
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseFormHostDirective, decorators: [{
|
|
551
701
|
type: Directive,
|
|
552
702
|
args: [{
|
|
553
703
|
standalone: true,
|
|
@@ -555,6 +705,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
555
705
|
}]
|
|
556
706
|
}], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
|
|
557
707
|
|
|
708
|
+
const BASE_ENTITY_STORE_REGISTRY = new InjectionToken('BASE_ENTITY_STORE_REGISTRY', {
|
|
709
|
+
factory: () => ({}),
|
|
710
|
+
});
|
|
711
|
+
|
|
558
712
|
class BaseFormControlComponent {
|
|
559
713
|
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
560
714
|
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
|
|
@@ -562,10 +716,40 @@ class BaseFormControlComponent {
|
|
|
562
716
|
store;
|
|
563
717
|
style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
|
|
564
718
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
565
|
-
|
|
566
|
-
|
|
719
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
720
|
+
injector = inject(Injector);
|
|
721
|
+
storeRegistry = inject(BASE_ENTITY_STORE_REGISTRY);
|
|
722
|
+
// region Angular lifecycle hooks
|
|
723
|
+
// endregion
|
|
724
|
+
resolveRelatedEntityStore() {
|
|
725
|
+
const entityName = this.config().linkedEntityType?.entityName;
|
|
726
|
+
const registryStoreToken = entityName ? this.storeRegistry[entityName] : undefined;
|
|
727
|
+
if (registryStoreToken) {
|
|
728
|
+
return this.injector.get(registryStoreToken, undefined);
|
|
729
|
+
}
|
|
730
|
+
const store = this.config().linkedEntityType?.store;
|
|
731
|
+
if (!store) {
|
|
732
|
+
return undefined;
|
|
733
|
+
}
|
|
734
|
+
if (this.isStoreInstance(store)) {
|
|
735
|
+
return store;
|
|
736
|
+
}
|
|
737
|
+
try {
|
|
738
|
+
return this.injector.get(store, undefined);
|
|
739
|
+
}
|
|
740
|
+
catch {
|
|
741
|
+
return undefined;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
isStoreInstance(store) {
|
|
745
|
+
return (!!store &&
|
|
746
|
+
(typeof store === 'object' || typeof store === 'function') &&
|
|
747
|
+
('load' in store || 'loadById' in store || 'entities' in store));
|
|
748
|
+
}
|
|
749
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseFormControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
750
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", 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 }] });
|
|
567
751
|
}
|
|
568
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
752
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseFormControlComponent, decorators: [{
|
|
569
753
|
type: Component,
|
|
570
754
|
args: [{
|
|
571
755
|
standalone: true,
|
|
@@ -615,10 +799,10 @@ class ObjectStoreService {
|
|
|
615
799
|
const baseConfiguration = Reflect.get(this.runtimeConfiguration, 'BASE_CONFIGURATION');
|
|
616
800
|
return Reflect.get(baseConfiguration, 'OBJECT_STORE_SERVICE_ROOT') ?? Reflect.get(baseConfiguration, 'BACKEND_SERVICE_ROOT') ?? '';
|
|
617
801
|
}
|
|
618
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
619
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
802
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ObjectStoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
803
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ObjectStoreService, providedIn: 'root' });
|
|
620
804
|
}
|
|
621
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ObjectStoreService, decorators: [{
|
|
622
806
|
type: Injectable,
|
|
623
807
|
args: [{ providedIn: 'root' }]
|
|
624
808
|
}] });
|
|
@@ -687,8 +871,8 @@ class ArtifactSelectorComponent {
|
|
|
687
871
|
};
|
|
688
872
|
return mimeTypeByExtension[extension] ?? 'application/octet-stream';
|
|
689
873
|
}
|
|
690
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
691
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
874
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ArtifactSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
875
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: ArtifactSelectorComponent, isStandalone: true, selector: "app-artifact-selector", outputs: { artifactUploaded: "artifactUploaded" }, ngImport: i0, template: `
|
|
692
876
|
<div class="artifact-selector">
|
|
693
877
|
@if (!isSelectorVisible) {
|
|
694
878
|
<button type="button" (click)="showSelector()">Upload file</button>
|
|
@@ -720,7 +904,7 @@ class ArtifactSelectorComponent {
|
|
|
720
904
|
</div>
|
|
721
905
|
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
722
906
|
}
|
|
723
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
907
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ArtifactSelectorComponent, decorators: [{
|
|
724
908
|
type: Component,
|
|
725
909
|
args: [{ selector: 'app-artifact-selector', standalone: true, imports: [FormsModule], template: `
|
|
726
910
|
<div class="artifact-selector">
|
|
@@ -757,8 +941,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
757
941
|
type: Output
|
|
758
942
|
}] } });
|
|
759
943
|
|
|
944
|
+
class DeleteArtifactConfirmationDialog {
|
|
945
|
+
data = inject(MAT_DIALOG_DATA);
|
|
946
|
+
translocoService = inject(TranslocoService);
|
|
947
|
+
t(key, params) {
|
|
948
|
+
return this.translocoService.translate(key, params);
|
|
949
|
+
}
|
|
950
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: DeleteArtifactConfirmationDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
951
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", type: DeleteArtifactConfirmationDialog, isStandalone: true, selector: "app-delete-artifact-confirmation-dialog", providers: [provideTranslocoScope('base-entity')], ngImport: i0, template: `
|
|
952
|
+
<h2 mat-dialog-title>{{ t(data.titleKey) }}</h2>
|
|
953
|
+
<mat-dialog-content>{{ t(data.contentKey, data.contentParams) }}</mat-dialog-content>
|
|
954
|
+
<mat-dialog-actions align="end">
|
|
955
|
+
<button type="button" mat-button [mat-dialog-close]="false">{{ t(data.cancelButtonKey) }}</button>
|
|
956
|
+
<button type="button" mat-raised-button color="warn" [mat-dialog-close]="true">{{ t(data.confirmButtonKey) }}</button>
|
|
957
|
+
</mat-dialog-actions>
|
|
958
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }] });
|
|
959
|
+
}
|
|
960
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: DeleteArtifactConfirmationDialog, decorators: [{
|
|
961
|
+
type: Component,
|
|
962
|
+
args: [{
|
|
963
|
+
selector: 'app-delete-artifact-confirmation-dialog',
|
|
964
|
+
standalone: true,
|
|
965
|
+
imports: [MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose, MatButton],
|
|
966
|
+
providers: [provideTranslocoScope('base-entity')],
|
|
967
|
+
template: `
|
|
968
|
+
<h2 mat-dialog-title>{{ t(data.titleKey) }}</h2>
|
|
969
|
+
<mat-dialog-content>{{ t(data.contentKey, data.contentParams) }}</mat-dialog-content>
|
|
970
|
+
<mat-dialog-actions align="end">
|
|
971
|
+
<button type="button" mat-button [mat-dialog-close]="false">{{ t(data.cancelButtonKey) }}</button>
|
|
972
|
+
<button type="button" mat-raised-button color="warn" [mat-dialog-close]="true">{{ t(data.confirmButtonKey) }}</button>
|
|
973
|
+
</mat-dialog-actions>
|
|
974
|
+
`,
|
|
975
|
+
}]
|
|
976
|
+
}] });
|
|
977
|
+
|
|
760
978
|
class ArtifactComponent extends BaseFormControlComponent {
|
|
761
979
|
objectStoreService = inject(ObjectStoreService);
|
|
980
|
+
dialog = inject(MatDialog);
|
|
762
981
|
artifact() {
|
|
763
982
|
return this.formGroup.get(this.config().attrName)?.value ?? null;
|
|
764
983
|
}
|
|
@@ -773,121 +992,328 @@ class ArtifactComponent extends BaseFormControlComponent {
|
|
|
773
992
|
});
|
|
774
993
|
}
|
|
775
994
|
onArtifactUploaded(artifact) {
|
|
995
|
+
if (this.config().disabled) {
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
776
998
|
const control = this.formGroup.get(this.config().attrName);
|
|
777
999
|
control?.setValue(artifact);
|
|
778
1000
|
control?.markAsDirty();
|
|
779
1001
|
control?.markAsTouched();
|
|
780
1002
|
}
|
|
781
|
-
|
|
782
|
-
|
|
1003
|
+
deleteArtifact() {
|
|
1004
|
+
if (this.config().disabled) {
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
const artifact = this.artifact();
|
|
1008
|
+
if (!artifact) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
const dialogData = {
|
|
1012
|
+
titleKey: 'base-entity.delete_artifact_confirmation_dialog.title',
|
|
1013
|
+
contentKey: 'base-entity.delete_artifact_confirmation_dialog.content',
|
|
1014
|
+
contentParams: { artifactName: artifact.name },
|
|
1015
|
+
cancelButtonKey: 'base-entity.delete_artifact_confirmation_dialog.cancel_button',
|
|
1016
|
+
confirmButtonKey: 'base-entity.delete_artifact_confirmation_dialog.delete_button',
|
|
1017
|
+
};
|
|
1018
|
+
this.dialog
|
|
1019
|
+
.open(DeleteArtifactConfirmationDialog, { data: dialogData })
|
|
1020
|
+
.afterClosed()
|
|
1021
|
+
.pipe(filter((confirmed) => confirmed === true), switchMap(() => this.objectStoreService.deleteObjectByID(artifact.bucket, artifact.objectId)))
|
|
1022
|
+
.subscribe({
|
|
1023
|
+
next: () => this.clearArtifact(),
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
clearArtifact() {
|
|
1027
|
+
const control = this.formGroup.get(this.config().attrName);
|
|
1028
|
+
control?.setValue(null);
|
|
1029
|
+
control?.markAsDirty();
|
|
1030
|
+
control?.markAsTouched();
|
|
1031
|
+
}
|
|
1032
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ArtifactComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1033
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: ArtifactComponent, isStandalone: true, selector: "app-artifact", usesInheritance: true, ngImport: i0, template: `
|
|
783
1034
|
@if (config().visible) {
|
|
784
1035
|
@if (config().isHeading) {
|
|
785
1036
|
<h3 [id]="config().attrName">{{ value() }}</h3>
|
|
786
1037
|
} @else {
|
|
787
|
-
|
|
788
|
-
<
|
|
789
|
-
<
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
1038
|
+
<div class="row">
|
|
1039
|
+
<fieldset class="base-entity-form-field" [ngClass]="config().styleClass" [ngStyle]="config().style">
|
|
1040
|
+
<legend [ngClass]="config().labelClass">{{ config().label }}</legend>
|
|
1041
|
+
<ul [id]="config().attrName" class="base-entity-form-list">
|
|
1042
|
+
@if (artifact(); as artifact) {
|
|
1043
|
+
<li>
|
|
1044
|
+
<a href="" (click)="openArtifact($event, artifact)">{{ artifact.name }}</a>
|
|
1045
|
+
@if (!config().disabled) {
|
|
1046
|
+
<button type="button" mat-icon-button class="base-entity-form-delete-button" aria-label="Delete artifact reference" (click)="deleteArtifact()">
|
|
1047
|
+
<mat-icon>cancel</mat-icon>
|
|
1048
|
+
</button>
|
|
1049
|
+
}
|
|
1050
|
+
</li>
|
|
1051
|
+
}
|
|
1052
|
+
</ul>
|
|
1053
|
+
@if (!config().disabled) {
|
|
1054
|
+
<app-artifact-selector (artifactUploaded)="onArtifactUploaded($event)" />
|
|
1055
|
+
}
|
|
1056
|
+
</fieldset>
|
|
1057
|
+
</div>
|
|
795
1058
|
}
|
|
796
1059
|
}
|
|
797
|
-
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ArtifactSelectorComponent, selector: "app-artifact-selector", outputs: ["artifactUploaded"] }] });
|
|
1060
|
+
`, isInline: true, styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:20px}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ArtifactSelectorComponent, selector: "app-artifact-selector", outputs: ["artifactUploaded"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
798
1061
|
}
|
|
799
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1062
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ArtifactComponent, decorators: [{
|
|
800
1063
|
type: Component,
|
|
801
|
-
args: [{ selector: 'app-artifact', standalone: true, imports: [FormsModule, ReactiveFormsModule, NgStyle, ArtifactSelectorComponent], template: `
|
|
1064
|
+
args: [{ selector: 'app-artifact', standalone: true, imports: [FormsModule, ReactiveFormsModule, NgClass, NgStyle, ArtifactSelectorComponent, MatIconButton, MatIcon], template: `
|
|
802
1065
|
@if (config().visible) {
|
|
803
1066
|
@if (config().isHeading) {
|
|
804
1067
|
<h3 [id]="config().attrName">{{ value() }}</h3>
|
|
805
1068
|
} @else {
|
|
806
|
-
|
|
807
|
-
<
|
|
808
|
-
<
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1069
|
+
<div class="row">
|
|
1070
|
+
<fieldset class="base-entity-form-field" [ngClass]="config().styleClass" [ngStyle]="config().style">
|
|
1071
|
+
<legend [ngClass]="config().labelClass">{{ config().label }}</legend>
|
|
1072
|
+
<ul [id]="config().attrName" class="base-entity-form-list">
|
|
1073
|
+
@if (artifact(); as artifact) {
|
|
1074
|
+
<li>
|
|
1075
|
+
<a href="" (click)="openArtifact($event, artifact)">{{ artifact.name }}</a>
|
|
1076
|
+
@if (!config().disabled) {
|
|
1077
|
+
<button type="button" mat-icon-button class="base-entity-form-delete-button" aria-label="Delete artifact reference" (click)="deleteArtifact()">
|
|
1078
|
+
<mat-icon>cancel</mat-icon>
|
|
1079
|
+
</button>
|
|
1080
|
+
}
|
|
1081
|
+
</li>
|
|
1082
|
+
}
|
|
1083
|
+
</ul>
|
|
1084
|
+
@if (!config().disabled) {
|
|
1085
|
+
<app-artifact-selector (artifactUploaded)="onArtifactUploaded($event)" />
|
|
1086
|
+
}
|
|
1087
|
+
</fieldset>
|
|
1088
|
+
</div>
|
|
814
1089
|
}
|
|
815
1090
|
}
|
|
816
|
-
|
|
1091
|
+
`, styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:20px}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}\n"] }]
|
|
817
1092
|
}] });
|
|
818
1093
|
|
|
819
1094
|
class LabelComponent extends BaseFormControlComponent {
|
|
820
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
821
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1095
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: LabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1096
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", 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"] }] });
|
|
822
1097
|
}
|
|
823
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1098
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: LabelComponent, decorators: [{
|
|
824
1099
|
type: Component,
|
|
825
1100
|
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>" }]
|
|
826
1101
|
}] });
|
|
827
1102
|
|
|
828
1103
|
class DatepickerComponent extends BaseFormControlComponent {
|
|
829
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
830
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1104
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: DatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1105
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", 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"] }] });
|
|
831
1106
|
}
|
|
832
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
833
1108
|
type: Component,
|
|
834
1109
|
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" }]
|
|
835
1110
|
}] });
|
|
836
1111
|
|
|
1112
|
+
var NavigatorCommand;
|
|
1113
|
+
(function (NavigatorCommand) {
|
|
1114
|
+
NavigatorCommand["SELECT_OR_CREATE"] = "SelectOrCreate";
|
|
1115
|
+
NavigatorCommand["EDIT"] = "Edit";
|
|
1116
|
+
})(NavigatorCommand || (NavigatorCommand = {}));
|
|
1117
|
+
|
|
837
1118
|
class ForeignKeyComponent extends BaseFormControlComponent {
|
|
1119
|
+
hasFocus = signal(false, ...(ngDevMode ? [{ debugName: "hasFocus" }] : /* istanbul ignore next */ []));
|
|
1120
|
+
selectedEntity = signal(undefined, ...(ngDevMode ? [{ debugName: "selectedEntity" }] : /* istanbul ignore next */ []));
|
|
1121
|
+
ngOnInit() {
|
|
1122
|
+
this.addSelectedComponentFromNavigatorResponse();
|
|
1123
|
+
}
|
|
838
1124
|
// region event handling methods
|
|
1125
|
+
onFocusOut(event) {
|
|
1126
|
+
const currentTarget = event.currentTarget;
|
|
1127
|
+
const relatedTarget = event.relatedTarget;
|
|
1128
|
+
this.hasFocus.set(!!currentTarget && !!relatedTarget && currentTarget.contains(relatedTarget));
|
|
1129
|
+
}
|
|
839
1130
|
navigateToRelated() {
|
|
840
|
-
this.
|
|
1131
|
+
const relatedEntityName = this.config().linkedEntityType?.entityName;
|
|
1132
|
+
if (!relatedEntityName)
|
|
1133
|
+
return;
|
|
1134
|
+
this.formNavigator.navigateToRelated(relatedEntityName, this.foreignKeyId(), this.formNavigator.determineCurrentUrl());
|
|
1135
|
+
}
|
|
1136
|
+
navigateToRelatedList() {
|
|
1137
|
+
const relatedEntityName = this.config().linkedEntityType?.entityName;
|
|
1138
|
+
if (this.config().disabled || !relatedEntityName) {
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
this.formNavigator.navigateToRelatedList(relatedEntityName, this.formNavigator.determineCurrentUrl(), {
|
|
1142
|
+
command: NavigatorCommand.SELECT_OR_CREATE,
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
// endregion
|
|
1146
|
+
selectEntityTitle() {
|
|
1147
|
+
return 'Select ' + (this.config().linkedEntityType?.entityName ?? 'Entity');
|
|
1148
|
+
}
|
|
1149
|
+
foreignKeyLabel() {
|
|
1150
|
+
return this.config().linkedEntityType?.entityName ?? this.config().label;
|
|
1151
|
+
}
|
|
1152
|
+
showSelectEntityButton() {
|
|
1153
|
+
return !this.config().disabled && this.hasFocus() && this.config().linkedEntityType !== undefined;
|
|
1154
|
+
}
|
|
1155
|
+
foreignKeyDisplayName() {
|
|
1156
|
+
const relatedEntity = this.selectedEntity() ?? this.relatedEntityFromLinkedStore();
|
|
1157
|
+
if (!relatedEntity) {
|
|
1158
|
+
return this.foreignKeyId();
|
|
1159
|
+
}
|
|
1160
|
+
const attrName = this.config().linkedEntityType?.componentIdentification();
|
|
1161
|
+
const componentName = attrName ? relatedEntity[attrName] : undefined;
|
|
1162
|
+
return componentName === undefined || componentName === null ? relatedEntity.id : String(componentName);
|
|
841
1163
|
}
|
|
842
|
-
|
|
843
|
-
|
|
1164
|
+
addSelectedComponentFromNavigatorResponse() {
|
|
1165
|
+
if (this.config().disabled) {
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
const responsePayload = this.formNavigator.popResponsePayload(NavigatorCommand.SELECT_OR_CREATE);
|
|
1169
|
+
const selectedEntity = responsePayload?.payload;
|
|
1170
|
+
const selectedEntityId = selectedEntity?.id;
|
|
1171
|
+
if (!selectedEntityId) {
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
this.selectedEntity.set(selectedEntity);
|
|
1175
|
+
const attrName = this.config().attrName;
|
|
1176
|
+
const entity = this.entity();
|
|
1177
|
+
entity[attrName] = selectedEntityId;
|
|
1178
|
+
const control = this.formGroup.get(attrName);
|
|
1179
|
+
if (!control) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
control.setValue(selectedEntityId);
|
|
1183
|
+
control.markAsDirty();
|
|
1184
|
+
control.markAsTouched();
|
|
1185
|
+
this.formGroup.markAsDirty();
|
|
1186
|
+
this.formGroup.markAsTouched();
|
|
1187
|
+
}
|
|
1188
|
+
foreignKeyId() {
|
|
1189
|
+
const attrName = this.config().attrName;
|
|
1190
|
+
const controlValue = this.formGroup?.get(attrName)?.value;
|
|
1191
|
+
const value = controlValue ?? this.value();
|
|
1192
|
+
return value === undefined || value === null ? '' : String(value);
|
|
1193
|
+
}
|
|
1194
|
+
relatedEntityFromLinkedStore() {
|
|
1195
|
+
const id = this.foreignKeyId();
|
|
1196
|
+
const linkedStore = this.resolveRelatedEntityStore();
|
|
1197
|
+
if (!id || !linkedStore) {
|
|
1198
|
+
return undefined;
|
|
1199
|
+
}
|
|
1200
|
+
if (typeof linkedStore.loadById === 'function') {
|
|
1201
|
+
return linkedStore.loadById(id);
|
|
1202
|
+
}
|
|
1203
|
+
if (typeof linkedStore.entities === 'function') {
|
|
1204
|
+
return linkedStore.entities().find((entity) => entity.id === id);
|
|
1205
|
+
}
|
|
1206
|
+
return undefined;
|
|
1207
|
+
}
|
|
1208
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ForeignKeyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1209
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: ForeignKeyComponent, isStandalone: true, selector: "base-foreign-key", usesInheritance: true, ngImport: i0, template: `
|
|
1210
|
+
@if (config().visible) {
|
|
1211
|
+
<div class="row" [formGroup]="formGroup" (focusin)="hasFocus.set(true)" (focusout)="onFocusOut($event)">
|
|
1212
|
+
<div class="foreign-key-control">
|
|
1213
|
+
<mat-form-field class="foreign-key-field">
|
|
1214
|
+
<mat-label>{{ foreignKeyLabel() }}</mat-label>
|
|
1215
|
+
<input matInput [value]="foreignKeyDisplayName()" [disabled]="config().disabled" readonly />
|
|
1216
|
+
<button type="button" mat-icon-button matSuffix (click)="navigateToRelated()" aria-label="Related entity">
|
|
1217
|
+
<mat-icon>link</mat-icon>
|
|
1218
|
+
</button>
|
|
1219
|
+
</mat-form-field>
|
|
1220
|
+
@if (showSelectEntityButton()) {
|
|
1221
|
+
<div class="foreign-key-select-row">
|
|
1222
|
+
<button
|
|
1223
|
+
type="button"
|
|
1224
|
+
class="foreign-key-select-button"
|
|
1225
|
+
mat-button
|
|
1226
|
+
[title]="selectEntityTitle()"
|
|
1227
|
+
[attr.aria-label]="selectEntityTitle()"
|
|
1228
|
+
(click)="navigateToRelatedList()"
|
|
1229
|
+
>
|
|
1230
|
+
<mat-icon>add</mat-icon>
|
|
1231
|
+
{{ selectEntityTitle() }}
|
|
1232
|
+
</button>
|
|
1233
|
+
</div>
|
|
1234
|
+
}
|
|
1235
|
+
</div>
|
|
1236
|
+
<input type="hidden" [formControlName]="config().attrName" />
|
|
1237
|
+
</div>
|
|
1238
|
+
}
|
|
1239
|
+
`, isInline: true, styles: [".foreign-key-control{display:inline-flex;flex-direction:column;align-items:stretch}.foreign-key-field{width:100%}.foreign-key-select-row{display:flex;min-height:28px;margin-top:-18px;padding:0 12px 0 16px;justify-content:flex-start}.foreign-key-select-button{height:28px;min-width:max-content;padding:0 8px;line-height:28px;white-space:nowrap}.foreign-key-select-button mat-icon{width:18px;height:18px;margin-right:4px;font-size:18px;line-height:18px}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
844
1240
|
}
|
|
845
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1241
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ForeignKeyComponent, decorators: [{
|
|
846
1242
|
type: Component,
|
|
847
|
-
args: [{ selector: 'base-foreign-key', standalone: true,
|
|
1243
|
+
args: [{ selector: 'base-foreign-key', standalone: true, template: `
|
|
1244
|
+
@if (config().visible) {
|
|
1245
|
+
<div class="row" [formGroup]="formGroup" (focusin)="hasFocus.set(true)" (focusout)="onFocusOut($event)">
|
|
1246
|
+
<div class="foreign-key-control">
|
|
1247
|
+
<mat-form-field class="foreign-key-field">
|
|
1248
|
+
<mat-label>{{ foreignKeyLabel() }}</mat-label>
|
|
1249
|
+
<input matInput [value]="foreignKeyDisplayName()" [disabled]="config().disabled" readonly />
|
|
1250
|
+
<button type="button" mat-icon-button matSuffix (click)="navigateToRelated()" aria-label="Related entity">
|
|
1251
|
+
<mat-icon>link</mat-icon>
|
|
1252
|
+
</button>
|
|
1253
|
+
</mat-form-field>
|
|
1254
|
+
@if (showSelectEntityButton()) {
|
|
1255
|
+
<div class="foreign-key-select-row">
|
|
1256
|
+
<button
|
|
1257
|
+
type="button"
|
|
1258
|
+
class="foreign-key-select-button"
|
|
1259
|
+
mat-button
|
|
1260
|
+
[title]="selectEntityTitle()"
|
|
1261
|
+
[attr.aria-label]="selectEntityTitle()"
|
|
1262
|
+
(click)="navigateToRelatedList()"
|
|
1263
|
+
>
|
|
1264
|
+
<mat-icon>add</mat-icon>
|
|
1265
|
+
{{ selectEntityTitle() }}
|
|
1266
|
+
</button>
|
|
1267
|
+
</div>
|
|
1268
|
+
}
|
|
1269
|
+
</div>
|
|
1270
|
+
<input type="hidden" [formControlName]="config().attrName" />
|
|
1271
|
+
</div>
|
|
1272
|
+
}
|
|
1273
|
+
`, imports: [MatButton, MatIconButton, MatIcon, MatLabel, MatFormField, MatInput, MatSuffix, ReactiveFormsModule], styles: [".foreign-key-control{display:inline-flex;flex-direction:column;align-items:stretch}.foreign-key-field{width:100%}.foreign-key-select-row{display:flex;min-height:28px;margin-top:-18px;padding:0 12px 0 16px;justify-content:flex-start}.foreign-key-select-button{height:28px;min-width:max-content;padding:0 8px;line-height:28px;white-space:nowrap}.foreign-key-select-button mat-icon{width:18px;height:18px;margin-right:4px;font-size:18px;line-height:18px}\n"] }]
|
|
848
1274
|
}] });
|
|
849
1275
|
|
|
850
1276
|
class TextboxComponent extends BaseFormControlComponent {
|
|
851
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
852
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1277
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TextboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1278
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", 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"] }] });
|
|
853
1279
|
}
|
|
854
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TextboxComponent, decorators: [{
|
|
855
1281
|
type: Component,
|
|
856
1282
|
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>" }]
|
|
857
1283
|
}] });
|
|
858
1284
|
|
|
859
1285
|
class DropdownComponent extends BaseFormControlComponent {
|
|
860
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
861
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1286
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: DropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1287
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", 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"] }] });
|
|
862
1288
|
}
|
|
863
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
864
1290
|
type: Component,
|
|
865
1291
|
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>" }]
|
|
866
1292
|
}] });
|
|
867
1293
|
|
|
868
1294
|
class CheckboxComponent extends BaseFormControlComponent {
|
|
869
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
870
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1295
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1296
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", 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"] }] });
|
|
871
1297
|
}
|
|
872
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1298
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
873
1299
|
type: Component,
|
|
874
1300
|
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"] }]
|
|
875
1301
|
}] });
|
|
876
1302
|
|
|
877
1303
|
class RadioComponent extends BaseFormControlComponent {
|
|
878
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
879
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1304
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1305
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", 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"] }] });
|
|
880
1306
|
}
|
|
881
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: RadioComponent, decorators: [{
|
|
882
1308
|
type: Component,
|
|
883
1309
|
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>" }]
|
|
884
1310
|
}] });
|
|
885
1311
|
|
|
886
1312
|
class TextareaComponent extends BaseFormControlComponent {
|
|
887
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
888
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1313
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1314
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", 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"] }] });
|
|
889
1315
|
}
|
|
890
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
891
1317
|
type: Component,
|
|
892
1318
|
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>" }]
|
|
893
1319
|
}] });
|
|
@@ -897,10 +1323,10 @@ class FlexBoxHostDirective {
|
|
|
897
1323
|
constructor(viewContainerRef) {
|
|
898
1324
|
this.viewContainerRef = viewContainerRef;
|
|
899
1325
|
}
|
|
900
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
901
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.
|
|
1326
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: FlexBoxHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1327
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.12", type: FlexBoxHostDirective, isStandalone: true, selector: "[flexBoxHost]", ngImport: i0 });
|
|
902
1328
|
}
|
|
903
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1329
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: FlexBoxHostDirective, decorators: [{
|
|
904
1330
|
type: Directive,
|
|
905
1331
|
args: [{
|
|
906
1332
|
standalone: true,
|
|
@@ -940,10 +1366,10 @@ class FlexBoxComponent extends BaseFormControlComponent {
|
|
|
940
1366
|
throw new Error('Unknown flex direction');
|
|
941
1367
|
}
|
|
942
1368
|
}
|
|
943
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
944
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1369
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: FlexBoxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1370
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", 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"] }] });
|
|
945
1371
|
}
|
|
946
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: FlexBoxComponent, decorators: [{
|
|
947
1373
|
type: Component,
|
|
948
1374
|
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"] }]
|
|
949
1375
|
}], propDecorators: { flexBoxHost: [{
|
|
@@ -987,8 +1413,8 @@ class TagsComponent extends BaseFormControlComponent {
|
|
|
987
1413
|
control?.markAsDirty();
|
|
988
1414
|
control?.markAsTouched();
|
|
989
1415
|
}
|
|
990
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
991
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1416
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TagsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1417
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: TagsComponent, isStandalone: true, selector: "base-tags", usesInheritance: true, ngImport: i0, template: `
|
|
992
1418
|
<ng-container *ngIf="config().visible">
|
|
993
1419
|
<div class="row" [formGroup]="formGroup">
|
|
994
1420
|
<mat-form-field>
|
|
@@ -1009,7 +1435,7 @@ class TagsComponent extends BaseFormControlComponent {
|
|
|
1009
1435
|
</ng-container>
|
|
1010
1436
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "component", type: MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "directive", type: MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
1011
1437
|
}
|
|
1012
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1438
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TagsComponent, decorators: [{
|
|
1013
1439
|
type: Component,
|
|
1014
1440
|
args: [{
|
|
1015
1441
|
selector: 'base-tags',
|
|
@@ -1038,28 +1464,383 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
1038
1464
|
}]
|
|
1039
1465
|
}] });
|
|
1040
1466
|
|
|
1467
|
+
class EntityComponentRefComponent {
|
|
1468
|
+
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
|
|
1469
|
+
component = input.required(...(ngDevMode ? [{ debugName: "component" }] : /* istanbul ignore next */ []));
|
|
1470
|
+
componentNameAttr = input.required(...(ngDevMode ? [{ debugName: "componentNameAttr" }] : /* istanbul ignore next */ []));
|
|
1471
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1472
|
+
formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
1473
|
+
linkedEntityType = input.required(...(ngDevMode ? [{ debugName: "linkedEntityType" }] : /* istanbul ignore next */ []));
|
|
1474
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
1475
|
+
componentName() {
|
|
1476
|
+
const attrName = this.componentNameAttr().attrName;
|
|
1477
|
+
const component = this.component();
|
|
1478
|
+
const componentName = attrName ? component[attrName] : undefined;
|
|
1479
|
+
return componentName === undefined || componentName === null ? component.id : String(componentName);
|
|
1480
|
+
}
|
|
1481
|
+
navigateToRelated(event) {
|
|
1482
|
+
event.preventDefault();
|
|
1483
|
+
this.formNavigator.navigateToRelated(this.linkedEntityType(), this.component().id, this.formNavigator.determineCurrentUrl());
|
|
1484
|
+
}
|
|
1485
|
+
removeComponent() {
|
|
1486
|
+
if (this.disabled()) {
|
|
1487
|
+
return;
|
|
1488
|
+
}
|
|
1489
|
+
const componentsAttrName = this.componentNameAttr().name;
|
|
1490
|
+
const entity = this.entity();
|
|
1491
|
+
const components = entity[componentsAttrName];
|
|
1492
|
+
if (!Array.isArray(components)) {
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1495
|
+
const remainingComponents = components.filter((component) => component.id !== this.component().id);
|
|
1496
|
+
entity[componentsAttrName] = remainingComponents;
|
|
1497
|
+
const control = this.formGroup().get(componentsAttrName);
|
|
1498
|
+
control?.setValue(remainingComponents);
|
|
1499
|
+
control?.markAsDirty();
|
|
1500
|
+
control?.markAsTouched();
|
|
1501
|
+
}
|
|
1502
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: EntityComponentRefComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1503
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: EntityComponentRefComponent, isStandalone: true, selector: "app-entity-component-ref", inputs: { entity: { classPropertyName: "entity", publicName: "entity", isSignal: true, isRequired: true, transformFunction: null }, component: { classPropertyName: "component", publicName: "component", isSignal: true, isRequired: true, transformFunction: null }, componentNameAttr: { classPropertyName: "componentNameAttr", publicName: "componentNameAttr", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, linkedEntityType: { classPropertyName: "linkedEntityType", publicName: "linkedEntityType", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
1504
|
+
<a href="" (click)="navigateToRelated($event)">{{ componentName() }}</a>
|
|
1505
|
+
@if (!disabled()) {
|
|
1506
|
+
<button type="button" mat-icon-button class="base-entity-form-delete-button" aria-label="Delete component reference" (click)="removeComponent()">
|
|
1507
|
+
<mat-icon>cancel</mat-icon>
|
|
1508
|
+
</button>
|
|
1509
|
+
}
|
|
1510
|
+
`, isInline: true, styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:20px}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}\n"], dependencies: [{ kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
1511
|
+
}
|
|
1512
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: EntityComponentRefComponent, decorators: [{
|
|
1513
|
+
type: Component,
|
|
1514
|
+
args: [{ selector: 'app-entity-component-ref', standalone: true, imports: [MatIconButton, MatIcon], template: `
|
|
1515
|
+
<a href="" (click)="navigateToRelated($event)">{{ componentName() }}</a>
|
|
1516
|
+
@if (!disabled()) {
|
|
1517
|
+
<button type="button" mat-icon-button class="base-entity-form-delete-button" aria-label="Delete component reference" (click)="removeComponent()">
|
|
1518
|
+
<mat-icon>cancel</mat-icon>
|
|
1519
|
+
</button>
|
|
1520
|
+
}
|
|
1521
|
+
`, styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:20px}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}\n"] }]
|
|
1522
|
+
}], propDecorators: { entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: true }] }], component: [{ type: i0.Input, args: [{ isSignal: true, alias: "component", required: true }] }], componentNameAttr: [{ type: i0.Input, args: [{ isSignal: true, alias: "componentNameAttr", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], linkedEntityType: [{ type: i0.Input, args: [{ isSignal: true, alias: "linkedEntityType", required: true }] }] } });
|
|
1523
|
+
|
|
1524
|
+
class EntityComponentsListComponent extends BaseFormControlComponent {
|
|
1525
|
+
logger = inject(NGXLogger);
|
|
1526
|
+
linkedEntityType = computed(() => {
|
|
1527
|
+
this.logger.debug('config(): ', this.config());
|
|
1528
|
+
const linkedEntityType = this.config().linkedEntityType;
|
|
1529
|
+
if (linkedEntityType === undefined) {
|
|
1530
|
+
throw new Error('linkedEntityType should be defined for EntityComponentsListComponent.');
|
|
1531
|
+
}
|
|
1532
|
+
return linkedEntityType;
|
|
1533
|
+
}, ...(ngDevMode ? [{ debugName: "linkedEntityType" }] : /* istanbul ignore next */ []));
|
|
1534
|
+
ngOnInit() {
|
|
1535
|
+
this.addSelectedComponentFromNavigatorResponse();
|
|
1536
|
+
}
|
|
1537
|
+
componentNameAttr() {
|
|
1538
|
+
return {
|
|
1539
|
+
attrName: this.linkedEntityType().componentIdentification(),
|
|
1540
|
+
name: this.config().attrName,
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
components() {
|
|
1544
|
+
const value = this.formGroup.get(this.config().attrName)?.value ?? this.value();
|
|
1545
|
+
return Array.isArray(value) ? value : [];
|
|
1546
|
+
}
|
|
1547
|
+
addComponentTitle() {
|
|
1548
|
+
return 'Add ' + this.linkedEntityType().entityName;
|
|
1549
|
+
}
|
|
1550
|
+
navigateToRelatedList() {
|
|
1551
|
+
if (this.config().disabled) {
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
this.formNavigator.navigateToRelatedList(this.linkedEntityType().entityName, this.formNavigator.determineCurrentUrl(), {
|
|
1555
|
+
command: NavigatorCommand.SELECT_OR_CREATE,
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
addSelectedComponentFromNavigatorResponse() {
|
|
1559
|
+
if (this.config().disabled) {
|
|
1560
|
+
return;
|
|
1561
|
+
}
|
|
1562
|
+
const responsePayload = this.formNavigator.popResponsePayload(NavigatorCommand.SELECT_OR_CREATE);
|
|
1563
|
+
if (!responsePayload?.payload) {
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
const components = [...this.components(), responsePayload.payload];
|
|
1567
|
+
const attrName = this.config().attrName;
|
|
1568
|
+
const entity = this.entity();
|
|
1569
|
+
entity[attrName] = components;
|
|
1570
|
+
const control = this.formGroup.get(attrName);
|
|
1571
|
+
if (!control) {
|
|
1572
|
+
this.logger.warn('Unable to add selected component to form control because the control is missing.', this.describeFormState(attrName));
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
control.setValue(components);
|
|
1576
|
+
control.markAsDirty();
|
|
1577
|
+
control.markAsTouched();
|
|
1578
|
+
this.formGroup.markAsDirty();
|
|
1579
|
+
this.formGroup.markAsTouched();
|
|
1580
|
+
this.logger.info('Added selected component from navigator response.', this.describeFormState(attrName));
|
|
1581
|
+
}
|
|
1582
|
+
describeFormState(attrName) {
|
|
1583
|
+
const controls = Object.entries(this.formGroup.controls).map(([name, control]) => ({
|
|
1584
|
+
name,
|
|
1585
|
+
dirty: control.dirty,
|
|
1586
|
+
disabled: control.disabled,
|
|
1587
|
+
errors: control.errors,
|
|
1588
|
+
invalid: control.invalid,
|
|
1589
|
+
status: control.status,
|
|
1590
|
+
touched: control.touched,
|
|
1591
|
+
}));
|
|
1592
|
+
return {
|
|
1593
|
+
attrName,
|
|
1594
|
+
formDirty: this.formGroup.dirty,
|
|
1595
|
+
formInvalid: this.formGroup.invalid,
|
|
1596
|
+
formStatus: this.formGroup.status,
|
|
1597
|
+
targetControl: controls.find((control) => control.name === attrName),
|
|
1598
|
+
invalidControls: controls.filter((control) => control.invalid),
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: EntityComponentsListComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1602
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: EntityComponentsListComponent, isStandalone: true, selector: "app-component-list", usesInheritance: true, ngImport: i0, template: `
|
|
1603
|
+
@if (config().visible) {
|
|
1604
|
+
<div class="row">
|
|
1605
|
+
<fieldset class="base-entity-form-field" [ngClass]="config().styleClass" [ngStyle]="config().style">
|
|
1606
|
+
<legend [ngClass]="config().labelClass">{{ config().label }}</legend>
|
|
1607
|
+
<ul [id]="config().attrName" class="base-entity-form-list">
|
|
1608
|
+
@for (component of components(); track component.id) {
|
|
1609
|
+
<li>
|
|
1610
|
+
<app-entity-component-ref
|
|
1611
|
+
[entity]="entity()"
|
|
1612
|
+
[component]="component"
|
|
1613
|
+
[componentNameAttr]="componentNameAttr()"
|
|
1614
|
+
[disabled]="config().disabled"
|
|
1615
|
+
[formGroup]="formGroup"
|
|
1616
|
+
[linkedEntityType]="linkedEntityType().entityName"
|
|
1617
|
+
/>
|
|
1618
|
+
</li>
|
|
1619
|
+
}
|
|
1620
|
+
</ul>
|
|
1621
|
+
@if (!config().disabled) {
|
|
1622
|
+
<button type="button" mat-button [title]="addComponentTitle()" [attr.aria-label]="addComponentTitle()" (click)="navigateToRelatedList()">
|
|
1623
|
+
<mat-icon>add</mat-icon>
|
|
1624
|
+
{{ addComponentTitle() }}
|
|
1625
|
+
</button>
|
|
1626
|
+
}
|
|
1627
|
+
</fieldset>
|
|
1628
|
+
</div>
|
|
1629
|
+
}
|
|
1630
|
+
`, isInline: true, styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:20px}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: EntityComponentRefComponent, selector: "app-entity-component-ref", inputs: ["entity", "component", "componentNameAttr", "disabled", "formGroup", "linkedEntityType"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
1631
|
+
}
|
|
1632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: EntityComponentsListComponent, decorators: [{
|
|
1633
|
+
type: Component,
|
|
1634
|
+
args: [{ selector: 'app-component-list', standalone: true, imports: [NgClass, NgStyle, EntityComponentRefComponent, MatButton, MatIcon], template: `
|
|
1635
|
+
@if (config().visible) {
|
|
1636
|
+
<div class="row">
|
|
1637
|
+
<fieldset class="base-entity-form-field" [ngClass]="config().styleClass" [ngStyle]="config().style">
|
|
1638
|
+
<legend [ngClass]="config().labelClass">{{ config().label }}</legend>
|
|
1639
|
+
<ul [id]="config().attrName" class="base-entity-form-list">
|
|
1640
|
+
@for (component of components(); track component.id) {
|
|
1641
|
+
<li>
|
|
1642
|
+
<app-entity-component-ref
|
|
1643
|
+
[entity]="entity()"
|
|
1644
|
+
[component]="component"
|
|
1645
|
+
[componentNameAttr]="componentNameAttr()"
|
|
1646
|
+
[disabled]="config().disabled"
|
|
1647
|
+
[formGroup]="formGroup"
|
|
1648
|
+
[linkedEntityType]="linkedEntityType().entityName"
|
|
1649
|
+
/>
|
|
1650
|
+
</li>
|
|
1651
|
+
}
|
|
1652
|
+
</ul>
|
|
1653
|
+
@if (!config().disabled) {
|
|
1654
|
+
<button type="button" mat-button [title]="addComponentTitle()" [attr.aria-label]="addComponentTitle()" (click)="navigateToRelatedList()">
|
|
1655
|
+
<mat-icon>add</mat-icon>
|
|
1656
|
+
{{ addComponentTitle() }}
|
|
1657
|
+
</button>
|
|
1658
|
+
}
|
|
1659
|
+
</fieldset>
|
|
1660
|
+
</div>
|
|
1661
|
+
}
|
|
1662
|
+
`, styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:20px}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}\n"] }]
|
|
1663
|
+
}] });
|
|
1664
|
+
|
|
1665
|
+
class LookupComponent extends BaseFormControlComponent {
|
|
1666
|
+
displayControl = new FormControl('', { nonNullable: true });
|
|
1667
|
+
filterText = signal('', ...(ngDevMode ? [{ debugName: "filterText" }] : /* istanbul ignore next */ []));
|
|
1668
|
+
destroyRef = inject(DestroyRef);
|
|
1669
|
+
lookupStore = computed(() => this.resolveRelatedEntityStore(), ...(ngDevMode ? [{ debugName: "lookupStore" }] : /* istanbul ignore next */ []));
|
|
1670
|
+
lookupItems = computed(() => this.lookupStore()?.entities?.() ?? [], ...(ngDevMode ? [{ debugName: "lookupItems" }] : /* istanbul ignore next */ []));
|
|
1671
|
+
filteredLookupItems = computed(() => {
|
|
1672
|
+
const filterText = this.filterText().trim().toLocaleLowerCase();
|
|
1673
|
+
const lookupItems = this.lookupItems();
|
|
1674
|
+
if (!filterText) {
|
|
1675
|
+
return lookupItems;
|
|
1676
|
+
}
|
|
1677
|
+
return lookupItems.filter((lookupItem) => this.lookupFilterValue(lookupItem).includes(filterText));
|
|
1678
|
+
}, ...(ngDevMode ? [{ debugName: "filteredLookupItems" }] : /* istanbul ignore next */ []));
|
|
1679
|
+
constructor() {
|
|
1680
|
+
super();
|
|
1681
|
+
effect(() => {
|
|
1682
|
+
const disabled = this.config().disabled;
|
|
1683
|
+
if (disabled && this.displayControl.enabled) {
|
|
1684
|
+
this.displayControl.disable({ emitEvent: false });
|
|
1685
|
+
}
|
|
1686
|
+
else if (!disabled && this.displayControl.disabled) {
|
|
1687
|
+
this.displayControl.enable({ emitEvent: false });
|
|
1688
|
+
}
|
|
1689
|
+
const selectedItem = this.selectedLookupItem();
|
|
1690
|
+
const displayValue = selectedItem ? this.lookupDisplayValue(selectedItem) : this.lookupKey();
|
|
1691
|
+
if (displayValue !== this.displayControl.value) {
|
|
1692
|
+
this.displayControl.setValue(displayValue, { emitEvent: false });
|
|
1693
|
+
}
|
|
1694
|
+
this.filterText.set(displayValue);
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
ngOnInit() {
|
|
1698
|
+
this.loadLookupTable();
|
|
1699
|
+
this.displayControl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((displayValue) => {
|
|
1700
|
+
this.filterText.set(displayValue ?? '');
|
|
1701
|
+
if (displayValue === '') {
|
|
1702
|
+
this.setLookupKey('');
|
|
1703
|
+
}
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
selectLookupItem(event) {
|
|
1707
|
+
this.setLookupKey(String(event.option.value ?? ''));
|
|
1708
|
+
this.restoreSelectedValue();
|
|
1709
|
+
}
|
|
1710
|
+
restoreSelectedValue() {
|
|
1711
|
+
const selectedItem = this.selectedLookupItem();
|
|
1712
|
+
const displayValue = selectedItem ? this.lookupDisplayValue(selectedItem) : this.lookupKey();
|
|
1713
|
+
this.displayControl.setValue(displayValue, { emitEvent: false });
|
|
1714
|
+
this.filterText.set(displayValue);
|
|
1715
|
+
}
|
|
1716
|
+
navigateToRelated() {
|
|
1717
|
+
const relatedEntityName = this.config().linkedEntityType?.entityName;
|
|
1718
|
+
const relatedEntityId = this.selectedLookupItem()?.id ?? this.lookupKey();
|
|
1719
|
+
if (!relatedEntityName || !relatedEntityId) {
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
this.formNavigator.navigateToRelated(relatedEntityName, relatedEntityId, this.formNavigator.determineCurrentUrl());
|
|
1723
|
+
}
|
|
1724
|
+
canNavigateToRelated() {
|
|
1725
|
+
return !!this.config().linkedEntityType?.entityName && !!(this.selectedLookupItem()?.id ?? this.lookupKey());
|
|
1726
|
+
}
|
|
1727
|
+
lookupDisplayValue(lookupItem) {
|
|
1728
|
+
return lookupItem.value === undefined || lookupItem.value === null ? lookupItem.key : String(lookupItem.value);
|
|
1729
|
+
}
|
|
1730
|
+
selectedLookupItem() {
|
|
1731
|
+
const lookupKey = this.lookupKey();
|
|
1732
|
+
if (!lookupKey) {
|
|
1733
|
+
return undefined;
|
|
1734
|
+
}
|
|
1735
|
+
return this.lookupItems().find((lookupItem) => lookupItem.key === lookupKey || lookupItem.id === lookupKey) ?? this.lookupStore()?.loadById?.(lookupKey);
|
|
1736
|
+
}
|
|
1737
|
+
lookupKey() {
|
|
1738
|
+
const controlValue = this.formGroup?.get(this.config().attrName)?.value;
|
|
1739
|
+
const value = controlValue ?? this.value();
|
|
1740
|
+
return value === undefined || value === null ? '' : String(value);
|
|
1741
|
+
}
|
|
1742
|
+
setLookupKey(lookupKey) {
|
|
1743
|
+
const attrName = this.config().attrName;
|
|
1744
|
+
const control = this.formGroup.get(attrName);
|
|
1745
|
+
if (!control) {
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1748
|
+
control.setValue(lookupKey);
|
|
1749
|
+
control.markAsDirty();
|
|
1750
|
+
control.markAsTouched();
|
|
1751
|
+
Reflect.set(this.entity(), attrName, lookupKey);
|
|
1752
|
+
this.formGroup.markAsDirty();
|
|
1753
|
+
this.formGroup.markAsTouched();
|
|
1754
|
+
}
|
|
1755
|
+
lookupFilterValue(lookupItem) {
|
|
1756
|
+
return [lookupItem.key, lookupItem.value, lookupItem.description]
|
|
1757
|
+
.filter((value) => value !== undefined && value !== null)
|
|
1758
|
+
.map((value) => String(value).toLocaleLowerCase())
|
|
1759
|
+
.join(' ');
|
|
1760
|
+
}
|
|
1761
|
+
loadLookupTable() {
|
|
1762
|
+
const lookupStore = this.lookupStore();
|
|
1763
|
+
if (!lookupStore?.load) {
|
|
1764
|
+
return;
|
|
1765
|
+
}
|
|
1766
|
+
lookupStore.load({});
|
|
1767
|
+
}
|
|
1768
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: LookupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1769
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: LookupComponent, isStandalone: true, selector: "lookup-control", usesInheritance: true, ngImport: i0, template: `
|
|
1770
|
+
<ng-container *ngIf="config().visible">
|
|
1771
|
+
<div class="row" [formGroup]="formGroup">
|
|
1772
|
+
<mat-form-field>
|
|
1773
|
+
<mat-label>{{ config().label }}</mat-label>
|
|
1774
|
+
<input type="text" matInput [formControl]="displayControl" [matAutocomplete]="lookupOptions" (blur)="restoreSelectedValue()" />
|
|
1775
|
+
<button type="button" mat-icon-button matSuffix [disabled]="!canNavigateToRelated()" (click)="navigateToRelated()" aria-label="Related entity">
|
|
1776
|
+
<mat-icon>link</mat-icon>
|
|
1777
|
+
</button>
|
|
1778
|
+
<mat-autocomplete #lookupOptions="matAutocomplete" (optionSelected)="selectLookupItem($event)">
|
|
1779
|
+
@for (lookupItem of filteredLookupItems(); track lookupItem.key) {
|
|
1780
|
+
<mat-option [value]="lookupItem.key">{{ lookupDisplayValue(lookupItem) }}</mat-option>
|
|
1781
|
+
}
|
|
1782
|
+
</mat-autocomplete>
|
|
1783
|
+
</mat-form-field>
|
|
1784
|
+
<input type="hidden" [formControlName]="config().attrName" />
|
|
1785
|
+
</div>
|
|
1786
|
+
</ng-container>
|
|
1787
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i2$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i2$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }] });
|
|
1788
|
+
}
|
|
1789
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: LookupComponent, decorators: [{
|
|
1790
|
+
type: Component,
|
|
1791
|
+
args: [{
|
|
1792
|
+
selector: 'lookup-control',
|
|
1793
|
+
standalone: true,
|
|
1794
|
+
template: `
|
|
1795
|
+
<ng-container *ngIf="config().visible">
|
|
1796
|
+
<div class="row" [formGroup]="formGroup">
|
|
1797
|
+
<mat-form-field>
|
|
1798
|
+
<mat-label>{{ config().label }}</mat-label>
|
|
1799
|
+
<input type="text" matInput [formControl]="displayControl" [matAutocomplete]="lookupOptions" (blur)="restoreSelectedValue()" />
|
|
1800
|
+
<button type="button" mat-icon-button matSuffix [disabled]="!canNavigateToRelated()" (click)="navigateToRelated()" aria-label="Related entity">
|
|
1801
|
+
<mat-icon>link</mat-icon>
|
|
1802
|
+
</button>
|
|
1803
|
+
<mat-autocomplete #lookupOptions="matAutocomplete" (optionSelected)="selectLookupItem($event)">
|
|
1804
|
+
@for (lookupItem of filteredLookupItems(); track lookupItem.key) {
|
|
1805
|
+
<mat-option [value]="lookupItem.key">{{ lookupDisplayValue(lookupItem) }}</mat-option>
|
|
1806
|
+
}
|
|
1807
|
+
</mat-autocomplete>
|
|
1808
|
+
</mat-form-field>
|
|
1809
|
+
<input type="hidden" [formControlName]="config().attrName" />
|
|
1810
|
+
</div>
|
|
1811
|
+
</ng-container>
|
|
1812
|
+
`,
|
|
1813
|
+
imports: [NgIf, ReactiveFormsModule, MatLabel, MatFormField, MatInput, MatAutocompleteModule, MatIconButton, MatIcon, MatSuffix],
|
|
1814
|
+
}]
|
|
1815
|
+
}], ctorParameters: () => [] });
|
|
1816
|
+
|
|
1041
1817
|
class BaseEntityFormBuilder {
|
|
1042
1818
|
logger = inject(NGXLogger);
|
|
1043
1819
|
// region public methods
|
|
1044
1820
|
buildForm(viewContainerRef, baseEntityForm, store, attrDescriptors, entity) {
|
|
1045
|
-
this.logger.trace(
|
|
1821
|
+
this.logger.trace('Starting to build form for: ', { attrDescriptors: attrDescriptors });
|
|
1046
1822
|
viewContainerRef.clear();
|
|
1047
1823
|
attrDescriptors.forEach((column) => {
|
|
1048
|
-
this.logger.
|
|
1824
|
+
this.logger.trace('Processing column: ', column.attrName);
|
|
1049
1825
|
const formControlType = this.createFormControl(column);
|
|
1050
1826
|
if (formControlType) {
|
|
1051
|
-
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
1052
|
-
componentRef.instance.config = signal(column, ...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1053
|
-
componentRef.instance.entity = entity;
|
|
1054
|
-
componentRef.instance.formGroup = baseEntityForm;
|
|
1055
|
-
componentRef.instance.store = store;
|
|
1056
1827
|
if (column instanceof BaseEntityAttrDescriptor) {
|
|
1057
1828
|
const currentAttrValue = Reflect.get(entity(), column.attrName);
|
|
1058
|
-
|
|
1059
|
-
const formControl = new FormControl({ value: currentAttrValue, disabled: column.disabled }, Validators.required);
|
|
1829
|
+
const formControl = new FormControl({ value: currentAttrValue, disabled: column.disabled }, column.required ? Validators.required : null);
|
|
1060
1830
|
baseEntityForm.addControl(column.attrName, formControl);
|
|
1831
|
+
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
1832
|
+
componentRef.setInput('config', column);
|
|
1833
|
+
componentRef.setInput('entity', entity());
|
|
1834
|
+
componentRef.setInput('value', currentAttrValue);
|
|
1835
|
+
componentRef.instance.formGroup = baseEntityForm;
|
|
1836
|
+
componentRef.instance.store = store;
|
|
1061
1837
|
}
|
|
1062
1838
|
else if (column instanceof FlexboxDescriptor) {
|
|
1839
|
+
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
1840
|
+
componentRef.setInput('config', column);
|
|
1841
|
+
componentRef.setInput('entity', entity());
|
|
1842
|
+
componentRef.instance.formGroup = baseEntityForm;
|
|
1843
|
+
componentRef.instance.store = store;
|
|
1063
1844
|
this.buildForm(componentRef.instance.flexBoxHost.viewContainerRef, baseEntityForm, store, column.attrDescriptors, entity);
|
|
1064
1845
|
}
|
|
1065
1846
|
else
|
|
@@ -1076,6 +1857,9 @@ class BaseEntityFormBuilder {
|
|
|
1076
1857
|
else if (column.formControlType === FormControlType.CHECKBOX) {
|
|
1077
1858
|
return CheckboxComponent;
|
|
1078
1859
|
}
|
|
1860
|
+
else if (column.formControlType === FormControlType.COMPONENTS) {
|
|
1861
|
+
return EntityComponentsListComponent;
|
|
1862
|
+
}
|
|
1079
1863
|
else if (column.formControlType === FormControlType.DATE) {
|
|
1080
1864
|
return DatepickerComponent;
|
|
1081
1865
|
}
|
|
@@ -1085,6 +1869,9 @@ class BaseEntityFormBuilder {
|
|
|
1085
1869
|
else if (column.formControlType === FormControlType.LABEL) {
|
|
1086
1870
|
return LabelComponent;
|
|
1087
1871
|
}
|
|
1872
|
+
else if (column.formControlType === FormControlType.LOOKUP) {
|
|
1873
|
+
return LookupComponent;
|
|
1874
|
+
}
|
|
1088
1875
|
else if (column.formControlType === FormControlType.RADIO) {
|
|
1089
1876
|
return RadioComponent;
|
|
1090
1877
|
}
|
|
@@ -1106,10 +1893,10 @@ class BaseEntityFormBuilder {
|
|
|
1106
1893
|
else
|
|
1107
1894
|
throw Error('Undefined form control type');
|
|
1108
1895
|
}
|
|
1109
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1110
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
1896
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityFormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1897
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityFormBuilder, providedIn: 'root' });
|
|
1111
1898
|
}
|
|
1112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1899
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityFormBuilder, decorators: [{
|
|
1113
1900
|
type: Injectable,
|
|
1114
1901
|
args: [{ providedIn: 'root' }]
|
|
1115
1902
|
}] });
|
|
@@ -1123,6 +1910,7 @@ class BaseEntityFormComponent {
|
|
|
1123
1910
|
store = computed(() => this.entityDescriptor().store, ...(ngDevMode ? [{ debugName: "store" }] : /* istanbul ignore next */ []));
|
|
1124
1911
|
entityFormBuilder = inject((BaseEntityFormBuilder));
|
|
1125
1912
|
formBuilder = inject(FormBuilder);
|
|
1913
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
1126
1914
|
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : /* istanbul ignore next */ []));
|
|
1127
1915
|
logger = inject(NGXLogger);
|
|
1128
1916
|
constructor() {
|
|
@@ -1130,15 +1918,16 @@ class BaseEntityFormComponent {
|
|
|
1130
1918
|
}
|
|
1131
1919
|
// region angular lifecycle hooks
|
|
1132
1920
|
ngOnInit() {
|
|
1133
|
-
this.
|
|
1921
|
+
this.formNavigator.setEntityName(this.entityDescriptor().entityName);
|
|
1922
|
+
this.formNavigator.determineActiveRouteSegment();
|
|
1134
1923
|
this.baseEntityForm = this.formBuilder.group({});
|
|
1135
|
-
this.logger.info('BaseEntityFormComponent initialized with:', { entityDescriptor: this.entityDescriptor() });
|
|
1924
|
+
this.logger.info('BaseEntityFormComponent initialized with: ', { entityDescriptor: this.entityDescriptor() });
|
|
1136
1925
|
}
|
|
1137
1926
|
// endregion
|
|
1138
1927
|
// region event handlers
|
|
1139
1928
|
async onCancel() {
|
|
1140
1929
|
this.store().setCurrentEntity(undefined);
|
|
1141
|
-
await this.
|
|
1930
|
+
await this.formNavigator.navigateBack();
|
|
1142
1931
|
}
|
|
1143
1932
|
async onSubmit() {
|
|
1144
1933
|
const objectToSave = { ...this.entity(), ...this.baseEntityForm.value };
|
|
@@ -1149,7 +1938,7 @@ class BaseEntityFormComponent {
|
|
|
1149
1938
|
this.store().update(objectToSave, objectToSave.id);
|
|
1150
1939
|
}
|
|
1151
1940
|
this.store().setCurrentEntity(undefined);
|
|
1152
|
-
await this.
|
|
1941
|
+
await this.formNavigator.navigateBack();
|
|
1153
1942
|
}
|
|
1154
1943
|
// endregion
|
|
1155
1944
|
// region protected, private helper methods
|
|
@@ -1165,10 +1954,10 @@ class BaseEntityFormComponent {
|
|
|
1165
1954
|
this.store().setCurrentEntity(this.entity().id);
|
|
1166
1955
|
});
|
|
1167
1956
|
}
|
|
1168
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1169
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
1957
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1958
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", 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"] }] });
|
|
1170
1959
|
}
|
|
1171
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1960
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityFormComponent, decorators: [{
|
|
1172
1961
|
type: Component,
|
|
1173
1962
|
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" }]
|
|
1174
1963
|
}], ctorParameters: () => [], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }], componentHost: [{
|
|
@@ -1188,12 +1977,36 @@ function filterAttributeDescriptors(descriptors) {
|
|
|
1188
1977
|
return attrDescriptors;
|
|
1189
1978
|
}
|
|
1190
1979
|
|
|
1980
|
+
class BaseEntityDescriptor {
|
|
1981
|
+
store;
|
|
1982
|
+
attrDescriptors;
|
|
1983
|
+
entityName;
|
|
1984
|
+
entityTitle;
|
|
1985
|
+
constructor({ store, attrDescriptors, entityName, entityTitle }) {
|
|
1986
|
+
this.store = store;
|
|
1987
|
+
this.attrDescriptors = attrDescriptors;
|
|
1988
|
+
this.entityName = entityName;
|
|
1989
|
+
this.entityTitle = entityTitle ?? '';
|
|
1990
|
+
}
|
|
1991
|
+
componentIdentification() {
|
|
1992
|
+
const attrDescriptor = filterAttributeDescriptors(this.attrDescriptors).find((attrDescriptor) => attrDescriptor.isLinkToDetails === true);
|
|
1993
|
+
return attrDescriptor?.attrName ?? '';
|
|
1994
|
+
}
|
|
1995
|
+
overwriteLinkedEntityAttr(attrName, linkedEntityDescr) {
|
|
1996
|
+
const attrDescriptor = filterAttributeDescriptors(this.attrDescriptors).find((attrDescriptor) => attrDescriptor.attrName === attrName);
|
|
1997
|
+
if (attrDescriptor) {
|
|
1998
|
+
attrDescriptor.linkedEntityType = linkedEntityDescr;
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
|
|
1191
2003
|
const BASE_LIST_DESCRIPTORS = new InjectionToken('BASE_TABLE_DISPLAYED_COLUMNS');
|
|
1192
2004
|
class BaseEntityListComponent {
|
|
1193
2005
|
dataSource = new MatTableDataSource();
|
|
1194
2006
|
selection = new SelectionModel(true, []);
|
|
1195
2007
|
entityDescriptor = inject(ROUTER_OUTLET_DATA);
|
|
1196
2008
|
logger = inject(NGXLogger);
|
|
2009
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
1197
2010
|
objectStoreService = inject(ObjectStoreService);
|
|
1198
2011
|
columnDescriptors = computed(() => {
|
|
1199
2012
|
return filterAttributeDescriptors(this.entityDescriptor().attrDescriptors);
|
|
@@ -1208,7 +2021,7 @@ class BaseEntityListComponent {
|
|
|
1208
2021
|
sort = {};
|
|
1209
2022
|
paginator = {};
|
|
1210
2023
|
store;
|
|
1211
|
-
|
|
2024
|
+
selectOrCreateMode = false;
|
|
1212
2025
|
constructor() {
|
|
1213
2026
|
this.store = this.entityDescriptor().store;
|
|
1214
2027
|
this.registerEffects();
|
|
@@ -1221,7 +2034,10 @@ class BaseEntityListComponent {
|
|
|
1221
2034
|
this.loadAllData();
|
|
1222
2035
|
}
|
|
1223
2036
|
ngOnInit() {
|
|
1224
|
-
this.
|
|
2037
|
+
this.formNavigator.setEntityName(this.entityDescriptor().entityName);
|
|
2038
|
+
this.formNavigator.determineActiveRouteSegment();
|
|
2039
|
+
const requestPayload = this.formNavigator.popRequestPayload();
|
|
2040
|
+
this.selectOrCreateMode = requestPayload?.command === NavigatorCommand.SELECT_OR_CREATE;
|
|
1225
2041
|
this.logger.info('BaseEntityListComponent initialized with:', { columnDescriptors: this.columnDescriptors() });
|
|
1226
2042
|
}
|
|
1227
2043
|
// endregion
|
|
@@ -1237,11 +2053,14 @@ class BaseEntityListComponent {
|
|
|
1237
2053
|
this.store.clearCurrentEntity();
|
|
1238
2054
|
}
|
|
1239
2055
|
onNavigateToDetails(entity) {
|
|
1240
|
-
this.
|
|
2056
|
+
this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, entity.id);
|
|
1241
2057
|
this.store.setCurrentEntity(entity.id);
|
|
1242
2058
|
}
|
|
1243
2059
|
onNavigateToRelated(config, entity) {
|
|
1244
|
-
|
|
2060
|
+
const relatedEntityName = config.linkedEntityType?.entityName;
|
|
2061
|
+
if (!relatedEntityName)
|
|
2062
|
+
return;
|
|
2063
|
+
this.formNavigator.navigateToRelated(relatedEntityName, this.getPropertyValue(entity, config.attrName));
|
|
1245
2064
|
}
|
|
1246
2065
|
onRowClick(entity) {
|
|
1247
2066
|
this.selection.toggle(entity);
|
|
@@ -1278,6 +2097,16 @@ class BaseEntityListComponent {
|
|
|
1278
2097
|
});
|
|
1279
2098
|
}
|
|
1280
2099
|
}
|
|
2100
|
+
async onCancelSelectOrCreate() {
|
|
2101
|
+
this.cancelSelections();
|
|
2102
|
+
await this.formNavigator.navigateBack();
|
|
2103
|
+
}
|
|
2104
|
+
async onSelectEntity() {
|
|
2105
|
+
if (!this.canSelectEntity())
|
|
2106
|
+
return;
|
|
2107
|
+
this.formNavigator.pushResponsePayload({ command: NavigatorCommand.SELECT_OR_CREATE, payload: this.selection.selected[0] });
|
|
2108
|
+
await this.formNavigator.navigateBack();
|
|
2109
|
+
}
|
|
1281
2110
|
// endregion
|
|
1282
2111
|
// region protected, private helper methods
|
|
1283
2112
|
cancelSelections() {
|
|
@@ -1312,10 +2141,13 @@ class BaseEntityListComponent {
|
|
|
1312
2141
|
isSelected(row) {
|
|
1313
2142
|
return this.selection.isSelected(row);
|
|
1314
2143
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
2144
|
+
canSelectEntity() {
|
|
2145
|
+
return this.selection.selected.length === 1;
|
|
2146
|
+
}
|
|
2147
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2148
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: BaseEntityListComponent, isStandalone: true, selector: "base-list", viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<div class=\"base-entity-list mat-elevation-z8\">\n <mat-table [dataSource]=\"dataSource\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n\n @for (colDescriptor of columnDescriptors(); track colDescriptor.attrName; let i = $index) {\n <ng-container [matColumnDef]=\"colDescriptor.attrName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</mat-header-cell>\n <mat-cell (click)=\"onRowClick(element)\" *matCellDef=\"let element\">\n @if (colDescriptor.isLinkToDetails) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.formControlType === 'ARTIFACT' && element[colDescriptor.attrName] !== undefined ) {\n @let artifact = element[colDescriptor.attrName];\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.objectId ?? '') | slice:0:20) + ((artifact.name ?? artifact.objectId ?? '').length > 20 ? '...' : '') }}</a>\n } @else if (colDescriptor.formControlType === 'TAGS' && element[colDescriptor.attrName] !== undefined ) {\n {{ (element[colDescriptor.attrName].join(', ') | slice:0:20) + (element[colDescriptor.attrName].join(', ').length > 20 ? '...' : '') }}\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </mat-cell>\n </ng-container>\n }\n <mat-header-row *matHeaderRowDef=\"displayedColumns()\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns()\"></mat-row>\n </mat-table>\n <mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\n</div>\n@if (selectOrCreateMode) {\n <div class=\"base-entity-list-actions\">\n <button id=\"cancel\" type=\"button\" mat-raised-button color=\"secondary\" (click)=\"onCancelSelectOrCreate()\">Cancel</button>\n <button id=\"select\" type=\"button\" mat-raised-button color=\"primary\" [disabled]=\"!canSelectEntity()\" (click)=\"onSelectEntity()\">Select</button>\n </div>\n}\n", styles: [".base-entity-list{display:flex;flex-direction:column;max-height:500px;min-width:300px}.mat-table{overflow:auto;max-height:500px}.mat-column-select{overflow:visible}.mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}.base-entity-list-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}\n"], dependencies: [{ kind: "component", type: MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "component", type: MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: SlicePipe, name: "slice" }] });
|
|
1317
2149
|
}
|
|
1318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
2150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseEntityListComponent, decorators: [{
|
|
1319
2151
|
type: Component,
|
|
1320
2152
|
args: [{ selector: 'base-list', standalone: true, imports: [
|
|
1321
2153
|
MatTable,
|
|
@@ -1334,7 +2166,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
1334
2166
|
MatProgressBar,
|
|
1335
2167
|
MatCheckbox,
|
|
1336
2168
|
SlicePipe,
|
|
1337
|
-
|
|
2169
|
+
MatButton,
|
|
2170
|
+
], template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<div class=\"base-entity-list mat-elevation-z8\">\n <mat-table [dataSource]=\"dataSource\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n\n @for (colDescriptor of columnDescriptors(); track colDescriptor.attrName; let i = $index) {\n <ng-container [matColumnDef]=\"colDescriptor.attrName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</mat-header-cell>\n <mat-cell (click)=\"onRowClick(element)\" *matCellDef=\"let element\">\n @if (colDescriptor.isLinkToDetails) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.formControlType === 'ARTIFACT' && element[colDescriptor.attrName] !== undefined ) {\n @let artifact = element[colDescriptor.attrName];\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.objectId ?? '') | slice:0:20) + ((artifact.name ?? artifact.objectId ?? '').length > 20 ? '...' : '') }}</a>\n } @else if (colDescriptor.formControlType === 'TAGS' && element[colDescriptor.attrName] !== undefined ) {\n {{ (element[colDescriptor.attrName].join(', ') | slice:0:20) + (element[colDescriptor.attrName].join(', ').length > 20 ? '...' : '') }}\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </mat-cell>\n </ng-container>\n }\n <mat-header-row *matHeaderRowDef=\"displayedColumns()\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns()\"></mat-row>\n </mat-table>\n <mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\n</div>\n@if (selectOrCreateMode) {\n <div class=\"base-entity-list-actions\">\n <button id=\"cancel\" type=\"button\" mat-raised-button color=\"secondary\" (click)=\"onCancelSelectOrCreate()\">Cancel</button>\n <button id=\"select\" type=\"button\" mat-raised-button color=\"primary\" [disabled]=\"!canSelectEntity()\" (click)=\"onSelectEntity()\">Select</button>\n </div>\n}\n", styles: [".base-entity-list{display:flex;flex-direction:column;max-height:500px;min-width:300px}.mat-table{overflow:auto;max-height:500px}.mat-column-select{overflow:visible}.mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}.base-entity-list-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}\n"] }]
|
|
1338
2171
|
}], ctorParameters: () => [], propDecorators: { sort: [{
|
|
1339
2172
|
type: ViewChild,
|
|
1340
2173
|
args: [MatSort]
|
|
@@ -1349,6 +2182,14 @@ var OrderByDirection;
|
|
|
1349
2182
|
OrderByDirection["DESC"] = "desc";
|
|
1350
2183
|
})(OrderByDirection || (OrderByDirection = {}));
|
|
1351
2184
|
|
|
2185
|
+
const BASE_ENTITY_MAPPER = new InjectionToken('BASE_ENTITY_MAPPER');
|
|
2186
|
+
function getEnumKeyByValue(myEnum, enumValue) {
|
|
2187
|
+
return Object.values(myEnum)[enumValue];
|
|
2188
|
+
}
|
|
2189
|
+
function getEnumValueByKey(myEnum, enumKey) {
|
|
2190
|
+
return myEnum[enumKey];
|
|
2191
|
+
}
|
|
2192
|
+
|
|
1352
2193
|
const INITIAL_TABS_STATE = {
|
|
1353
2194
|
activeTabs: [],
|
|
1354
2195
|
currentTab: undefined,
|
|
@@ -1465,6 +2306,9 @@ const findByQuery = (store, repository) => {
|
|
|
1465
2306
|
};
|
|
1466
2307
|
|
|
1467
2308
|
const BASE_ENTITY_STORE = new InjectionToken('BASE_ENTITY_STORE');
|
|
2309
|
+
function entityNameFromType(entityType) {
|
|
2310
|
+
return entityType.name ?? 'base-entity';
|
|
2311
|
+
}
|
|
1468
2312
|
function BaseEntityStore(entityType, repositoryType) {
|
|
1469
2313
|
return signalStoreFeature(withState({
|
|
1470
2314
|
entities: [],
|
|
@@ -1476,7 +2320,7 @@ function BaseEntityStore(entityType, repositoryType) {
|
|
|
1476
2320
|
isLoading: false,
|
|
1477
2321
|
error: undefined,
|
|
1478
2322
|
selectedEntities: [],
|
|
1479
|
-
}), withMethods((store, repository = inject(repositoryType)) => ({
|
|
2323
|
+
}), withDevtools(entityNameFromType(entityType)), withMethods((store, repository = inject(repositoryType)) => ({
|
|
1480
2324
|
clearCurrentEntity: () => patchState(store, { currentEntity: undefined }),
|
|
1481
2325
|
createEntity: () => new entityType(),
|
|
1482
2326
|
add: addEntity(store, repository),
|
|
@@ -1718,7 +2562,7 @@ function getEntityIds(instance) {
|
|
|
1718
2562
|
|
|
1719
2563
|
const BASE_ENTITY_ROUTES = [
|
|
1720
2564
|
{ path: '', redirectTo: 'list', pathMatch: 'full' },
|
|
1721
|
-
{ path: ':
|
|
2565
|
+
{ path: ':' + BaseUrlSegments.EntityID + '/details', component: BaseEntityFormComponent },
|
|
1722
2566
|
{ path: 'list', component: BaseEntityListComponent },
|
|
1723
2567
|
];
|
|
1724
2568
|
|
|
@@ -1728,5 +2572,5 @@ const BASE_ENTITY_ROUTES = [
|
|
|
1728
2572
|
* Generated bundle index. Do not edit.
|
|
1729
2573
|
*/
|
|
1730
2574
|
|
|
1731
|
-
export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorStore, Entity, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, getEntityIds, getEntityOptions };
|
|
2575
|
+
export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_ENTITY_STORE_REGISTRY, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityDescriptor, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorSingletonStore, BaseFormNavigatorStore, Entity, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, getEntityIds, getEntityOptions, getEnumKeyByValue, getEnumValueByKey };
|
|
1732
2576
|
//# sourceMappingURL=processpuzzle-base-entity.mjs.map
|