@processpuzzle/base-entity 0.4.0 → 0.5.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, Injectable, EventEmitter, Output, ViewChild, untracked, InjectionToken, 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
12
|
import { MatFormField, MatFormFieldModule, MatLabel, 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';
|
|
@@ -35,6 +37,7 @@ import { MatSort, MatSortHeader } from '@angular/material/sort';
|
|
|
35
37
|
import { MatPaginator } from '@angular/material/paginator';
|
|
36
38
|
import { MatProgressBar } from '@angular/material/progress-bar';
|
|
37
39
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
40
|
+
import { withDevtools } from '@angular-architects/ngrx-toolkit';
|
|
38
41
|
import { tapResponse } from '@ngrx/operators';
|
|
39
42
|
import { rxMethod } from '@ngrx/signals/rxjs-interop';
|
|
40
43
|
import { Firestore, collection, doc, deleteDoc, getDoc, setDoc, orderBy, where, query, limit, getDocs, updateDoc } from '@angular/fire/firestore';
|
|
@@ -44,6 +47,7 @@ var FormControlType;
|
|
|
44
47
|
(function (FormControlType) {
|
|
45
48
|
FormControlType["ARTIFACT"] = "ARTIFACT";
|
|
46
49
|
FormControlType["CHECKBOX"] = "CHECKBOX";
|
|
50
|
+
FormControlType["COMPONENTS"] = "COMPONENTS";
|
|
47
51
|
FormControlType["DATE"] = "DATE";
|
|
48
52
|
FormControlType["DROPDOWN"] = "DROPDOWN";
|
|
49
53
|
FormControlType["FLEX_BOX"] = "FLEX_BOX";
|
|
@@ -69,6 +73,7 @@ class AbstractAttrDescriptor {
|
|
|
69
73
|
var BaseUrlSegments;
|
|
70
74
|
(function (BaseUrlSegments) {
|
|
71
75
|
BaseUrlSegments["DetailsForm"] = "details";
|
|
76
|
+
BaseUrlSegments["EntityID"] = "entityId";
|
|
72
77
|
BaseUrlSegments["Feed"] = "feed";
|
|
73
78
|
BaseUrlSegments["ListForm"] = "list";
|
|
74
79
|
BaseUrlSegments["NewEntity"] = "new";
|
|
@@ -85,106 +90,245 @@ const INITIAL_NAVIGATION_STATE = {
|
|
|
85
90
|
entityName: '',
|
|
86
91
|
navigationError: undefined,
|
|
87
92
|
navigateTo: '',
|
|
93
|
+
responsePayloads: new Stack(),
|
|
94
|
+
requestPayloads: new Stack(),
|
|
88
95
|
returnTo: '',
|
|
89
96
|
};
|
|
90
97
|
function snakeCaseName(entityName) {
|
|
91
98
|
return entityName
|
|
99
|
+
.replace(/\s+/g, '')
|
|
92
100
|
.split(/(?=[A-Z])/)
|
|
93
101
|
.join('-')
|
|
94
102
|
.toLowerCase();
|
|
95
103
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
104
|
+
const BaseFormNavigatorSingletonStore = signalStore({ providedIn: 'root' }, withState(INITIAL_NAVIGATION_STATE), withMethods((store, router = inject(Router), route = inject(ActivatedRoute)) => {
|
|
105
|
+
let pendingNavigatorUrl;
|
|
106
|
+
let routerEventsSubscription;
|
|
107
|
+
function clearPayloadStacks() {
|
|
108
|
+
patchState(store, {
|
|
109
|
+
requestPayloads: new Stack(),
|
|
110
|
+
responsePayloads: new Stack(),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function determineActiveRouteSegment() {
|
|
114
|
+
const currentUrl = Reflect.get(route, '_routerState').snapshot.url;
|
|
115
|
+
if (currentUrl.endsWith(BaseUrlSegments.ListForm)) {
|
|
116
|
+
patchState(store, { activeRouteSegment: RouteSegments.LIST_ROUTE });
|
|
109
117
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const currentUrl = determineCurrentUrl();
|
|
113
|
-
return store.activeRouteSegment() === RouteSegments.DETAILS_ROUTE ? levelUpUrl(levelUpUrl(levelUpUrl(currentUrl))) : levelUpUrl(levelUpUrl(currentUrl));
|
|
118
|
+
else if (currentUrl.endsWith(BaseUrlSegments.DetailsForm)) {
|
|
119
|
+
patchState(store, { activeRouteSegment: RouteSegments.DETAILS_ROUTE });
|
|
114
120
|
}
|
|
115
|
-
|
|
116
|
-
|
|
121
|
+
else {
|
|
122
|
+
patchState(store, { activeRouteSegment: undefined });
|
|
117
123
|
}
|
|
118
|
-
|
|
119
|
-
|
|
124
|
+
}
|
|
125
|
+
function determineBaseUrl() {
|
|
126
|
+
determineActiveRouteSegment();
|
|
127
|
+
const currentUrl = determineCurrentUrl();
|
|
128
|
+
return store.activeRouteSegment() === RouteSegments.DETAILS_ROUTE ? levelUpUrl(levelUpUrl(levelUpUrl(currentUrl))) : levelUpUrl(levelUpUrl(currentUrl));
|
|
129
|
+
}
|
|
130
|
+
function determineCurrentUrl() {
|
|
131
|
+
return Reflect.get(route, '_routerState').snapshot.url;
|
|
132
|
+
}
|
|
133
|
+
function levelUpUrl(currentUrl) {
|
|
134
|
+
return currentUrl.substring(0, currentUrl.lastIndexOf('/'));
|
|
135
|
+
}
|
|
136
|
+
function normalizeUrl(url) {
|
|
137
|
+
return url.startsWith('/') ? url : '/' + url;
|
|
138
|
+
}
|
|
139
|
+
function isPendingNavigatorUrl(navigationEnd) {
|
|
140
|
+
if (!pendingNavigatorUrl) {
|
|
141
|
+
return false;
|
|
120
142
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
143
|
+
const normalizedPendingUrl = normalizeUrl(pendingNavigatorUrl);
|
|
144
|
+
return [navigationEnd.url, navigationEnd.urlAfterRedirects].some((url) => normalizeUrl(url) === normalizedPendingUrl);
|
|
145
|
+
}
|
|
146
|
+
function initializeNavigationTracking() {
|
|
147
|
+
routerEventsSubscription ??= router.events.subscribe((event) => {
|
|
148
|
+
if (!(event instanceof NavigationEnd)) {
|
|
149
|
+
return;
|
|
129
150
|
}
|
|
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);
|
|
151
|
+
if (isPendingNavigatorUrl(event)) {
|
|
152
|
+
pendingNavigatorUrl = undefined;
|
|
139
153
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
143
|
-
const baseUrl = determineBaseUrl();
|
|
144
|
-
const goToUrl = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
145
|
-
if (store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
146
|
-
await navigateToUrl(goToUrl, returnTo);
|
|
154
|
+
else {
|
|
155
|
+
clearPayloadStacks();
|
|
147
156
|
}
|
|
157
|
+
determineActiveRouteSegment();
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function destroyNavigationTracking() {
|
|
161
|
+
routerEventsSubscription?.unsubscribe();
|
|
162
|
+
routerEventsSubscription = undefined;
|
|
163
|
+
}
|
|
164
|
+
async function navigateBack(defaultUrl) {
|
|
165
|
+
const goTo = store.returnTo() ? store.returnTo() : defaultUrl;
|
|
166
|
+
const navigatorPayloads = new Stack(store.requestPayloads().toArray());
|
|
167
|
+
navigatorPayloads.pop();
|
|
168
|
+
patchState(store, { requestPayloads: navigatorPayloads, returnTo: '' });
|
|
169
|
+
if (goTo) {
|
|
170
|
+
pendingNavigatorUrl = goTo;
|
|
171
|
+
await router
|
|
172
|
+
.navigateByUrl(goTo)
|
|
173
|
+
.then()
|
|
174
|
+
.catch((error) => {
|
|
175
|
+
pendingNavigatorUrl = undefined;
|
|
176
|
+
patchState(store, { navigationError: error.message });
|
|
177
|
+
});
|
|
148
178
|
}
|
|
149
|
-
|
|
150
|
-
|
|
179
|
+
else
|
|
180
|
+
await navigateToList(store.entityName());
|
|
181
|
+
}
|
|
182
|
+
async function navigateToDetails(entityName, id, returnTo, payload) {
|
|
183
|
+
patchState(store, { entityName });
|
|
184
|
+
pushPayload(payload);
|
|
185
|
+
if (store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
186
|
+
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
151
187
|
const baseUrl = determineBaseUrl();
|
|
152
188
|
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
153
189
|
await navigateToUrl(detailsFormPath, returnTo);
|
|
154
190
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
await
|
|
164
|
-
.navigateByUrl(url)
|
|
165
|
-
.then(() => determineActiveRouteSegment())
|
|
166
|
-
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
191
|
+
}
|
|
192
|
+
async function navigateToList(entityName, returnTo, payload) {
|
|
193
|
+
patchState(store, { entityName });
|
|
194
|
+
pushPayload(payload);
|
|
195
|
+
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
196
|
+
const baseUrl = determineBaseUrl();
|
|
197
|
+
const goToUrl = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
198
|
+
if (store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
199
|
+
await navigateToUrl(goToUrl, returnTo);
|
|
167
200
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
201
|
+
}
|
|
202
|
+
async function navigateToRelated(relatedTypeName, id, returnTo, payload) {
|
|
203
|
+
patchState(store, { entityName: relatedTypeName });
|
|
204
|
+
pushPayload(payload);
|
|
205
|
+
const snakeCaseEntityName = snakeCaseName(relatedTypeName);
|
|
206
|
+
const baseUrl = determineBaseUrl();
|
|
207
|
+
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
208
|
+
await navigateToUrl(detailsFormPath, returnTo);
|
|
209
|
+
}
|
|
210
|
+
async function navigateToRelatedList(relatedTypeName, returnTo, payload) {
|
|
211
|
+
patchState(store, { entityName: relatedTypeName });
|
|
212
|
+
pushPayload(payload);
|
|
213
|
+
const snakeCaseEntityName = snakeCaseName(relatedTypeName);
|
|
214
|
+
const baseUrl = determineBaseUrl();
|
|
215
|
+
const listPath = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
216
|
+
await navigateToUrl(listPath, returnTo);
|
|
217
|
+
}
|
|
218
|
+
function setEntityName(entityName) {
|
|
219
|
+
patchState(store, { entityName });
|
|
220
|
+
}
|
|
221
|
+
function pushPayload(payload) {
|
|
222
|
+
if (payload) {
|
|
223
|
+
const navigatorPayloads = new Stack(store.requestPayloads().toArray());
|
|
224
|
+
navigatorPayloads.push(payload);
|
|
225
|
+
patchState(store, { requestPayloads: navigatorPayloads });
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function popRequestPayload() {
|
|
229
|
+
const navigatorPayloads = new Stack(store.requestPayloads().toArray());
|
|
230
|
+
const payload = navigatorPayloads.pop();
|
|
231
|
+
patchState(store, { requestPayloads: navigatorPayloads });
|
|
232
|
+
return payload;
|
|
233
|
+
}
|
|
234
|
+
function popResponsePayload(command) {
|
|
235
|
+
const responsePayloadArray = store.responsePayloads().toArray();
|
|
236
|
+
const payloadIndex = command === undefined ? responsePayloadArray.length - 1 : responsePayloadArray.map((payload) => payload.command).lastIndexOf(command);
|
|
237
|
+
if (payloadIndex < 0) {
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
const [payload] = responsePayloadArray.splice(payloadIndex, 1);
|
|
241
|
+
patchState(store, { responsePayloads: new Stack(responsePayloadArray) });
|
|
242
|
+
return payload;
|
|
243
|
+
}
|
|
244
|
+
function pushResponsePayload(payload) {
|
|
245
|
+
const responsePayloads = new Stack(store.responsePayloads().toArray());
|
|
246
|
+
responsePayloads.push(payload);
|
|
247
|
+
patchState(store, { responsePayloads });
|
|
248
|
+
}
|
|
249
|
+
async function navigateToUrl(url, returnTo) {
|
|
250
|
+
if (returnTo) {
|
|
251
|
+
patchState(store, { returnTo });
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
patchState(store, { returnTo: router.url });
|
|
255
|
+
}
|
|
256
|
+
pendingNavigatorUrl = url;
|
|
257
|
+
patchState(store, { navigateTo: url });
|
|
258
|
+
await router
|
|
259
|
+
.navigateByUrl(url)
|
|
260
|
+
.then(() => determineActiveRouteSegment())
|
|
261
|
+
.catch((error) => {
|
|
262
|
+
pendingNavigatorUrl = undefined;
|
|
263
|
+
patchState(store, { navigationError: error.message });
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
determineCurrentUrl,
|
|
268
|
+
determineActiveRouteSegment,
|
|
269
|
+
navigateBack,
|
|
270
|
+
navigateToDetails,
|
|
271
|
+
navigateToList,
|
|
272
|
+
navigateToRelated,
|
|
273
|
+
navigateToRelatedList,
|
|
274
|
+
navigateToUrl,
|
|
275
|
+
destroyNavigationTracking,
|
|
276
|
+
initializeNavigationTracking,
|
|
277
|
+
popRequestPayload,
|
|
278
|
+
popResponsePayload,
|
|
279
|
+
pushResponsePayload,
|
|
280
|
+
setEntityName,
|
|
281
|
+
};
|
|
282
|
+
}), withHooks((store) => ({
|
|
283
|
+
onInit: () => {
|
|
284
|
+
store.determineActiveRouteSegment();
|
|
285
|
+
store.initializeNavigationTracking();
|
|
286
|
+
},
|
|
287
|
+
onDestroy: () => {
|
|
288
|
+
store.destroyNavigationTracking();
|
|
289
|
+
},
|
|
290
|
+
})));
|
|
291
|
+
function BaseFormNavigatorStore(entityName) {
|
|
292
|
+
return signalStoreFeature(withProps((_, navigatorStore = inject(BaseFormNavigatorSingletonStore)) => {
|
|
293
|
+
navigatorStore.setEntityName(entityName);
|
|
294
|
+
return {
|
|
295
|
+
activeRouteSegment: navigatorStore.activeRouteSegment,
|
|
296
|
+
entityName: navigatorStore.entityName,
|
|
297
|
+
navigationError: navigatorStore.navigationError,
|
|
298
|
+
navigateTo: navigatorStore.navigateTo,
|
|
299
|
+
navigatorPayloads: navigatorStore.requestPayloads,
|
|
300
|
+
requestPayloads: navigatorStore.requestPayloads,
|
|
301
|
+
responsePayloads: navigatorStore.responsePayloads,
|
|
302
|
+
returnTo: navigatorStore.returnTo,
|
|
303
|
+
determineActiveRouteSegment: navigatorStore.determineActiveRouteSegment,
|
|
304
|
+
determineCurrentUrl: navigatorStore.determineCurrentUrl,
|
|
305
|
+
navigateBack: navigatorStore.navigateBack,
|
|
306
|
+
navigateToDetails: (id, returnTo, payload) => navigatorStore.navigateToDetails(entityName, id, returnTo, payload),
|
|
307
|
+
navigateToList: (returnTo, payload) => navigatorStore.navigateToList(entityName, returnTo, payload),
|
|
308
|
+
navigateToRelated: navigatorStore.navigateToRelated,
|
|
309
|
+
navigateToRelatedList: navigatorStore.navigateToRelatedList,
|
|
310
|
+
navigateToUrl: navigatorStore.navigateToUrl,
|
|
311
|
+
popRequestPayload: navigatorStore.popRequestPayload,
|
|
312
|
+
popResponsePayload: navigatorStore.popResponsePayload,
|
|
313
|
+
pushResponsePayload: navigatorStore.pushResponsePayload,
|
|
314
|
+
};
|
|
315
|
+
}));
|
|
174
316
|
}
|
|
175
317
|
|
|
176
318
|
class BaseEntityToolbarComponent {
|
|
177
319
|
entityDescriptor = input.required(...(ngDevMode ? [{ debugName: "entityDescriptor" }] : /* istanbul ignore next */ []));
|
|
178
320
|
layoutService = inject(LayoutService);
|
|
321
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
179
322
|
store;
|
|
180
323
|
// region Angular lifecycle hooks
|
|
181
324
|
ngOnInit() {
|
|
182
325
|
this.store = this.entityDescriptor().store;
|
|
326
|
+
this.formNavigator.setEntityName(this.entityDescriptor().entityName);
|
|
183
327
|
}
|
|
184
328
|
// endregion
|
|
185
329
|
// event handling methods
|
|
186
330
|
onAddEntity() {
|
|
187
|
-
this.
|
|
331
|
+
this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, BaseUrlSegments.NewEntity);
|
|
188
332
|
}
|
|
189
333
|
onDeleteEntities() {
|
|
190
334
|
this.store.selectedEntities().forEach((entity) => this.store.delete(entity.id));
|
|
@@ -201,12 +345,12 @@ class BaseEntityToolbarComponent {
|
|
|
201
345
|
// endregion
|
|
202
346
|
// protected, private helper methods
|
|
203
347
|
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.
|
|
348
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
349
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", 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
350
|
}
|
|
207
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
351
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
|
|
208
352
|
type: Component,
|
|
209
|
-
args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbar, MatIcon, MatFormField, MatInput, MatButton, MatMenu, MatMenuItem, MatMenuTrigger], template: "<mat-toolbar *ngIf=\"
|
|
353
|
+
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
354
|
}], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
211
355
|
|
|
212
356
|
class BaseEntityStatusbarComponent {
|
|
@@ -226,10 +370,10 @@ class BaseEntityStatusbarComponent {
|
|
|
226
370
|
const fn = new Function('ctx', 'return ' + title.replace(/this\./g, 'ctx.'));
|
|
227
371
|
return fn(this);
|
|
228
372
|
}
|
|
229
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
230
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
373
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityStatusbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
374
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.11", 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
375
|
}
|
|
232
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityStatusbarComponent, decorators: [{
|
|
233
377
|
type: Component,
|
|
234
378
|
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
379
|
}], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
@@ -240,6 +384,7 @@ class BaseEntityTabsComponent {
|
|
|
240
384
|
selectedEntityId = computed(() => (this.store.currentId() ? this.store.currentId() : BaseUrlSegments.NewEntity), ...(ngDevMode ? [{ debugName: "selectedEntityId" }] : /* istanbul ignore next */ []));
|
|
241
385
|
detailsTabName = computed(() => this.entityDescriptor().entityName + ' - details', ...(ngDevMode ? [{ debugName: "detailsTabName" }] : /* istanbul ignore next */ []));
|
|
242
386
|
listTabName = computed(() => this.entityDescriptor().entityName + ' - list', ...(ngDevMode ? [{ debugName: "listTabName" }] : /* istanbul ignore next */ []));
|
|
387
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
243
388
|
constructor() {
|
|
244
389
|
this.registerEffects();
|
|
245
390
|
}
|
|
@@ -250,19 +395,20 @@ class BaseEntityTabsComponent {
|
|
|
250
395
|
}
|
|
251
396
|
ngOnInit() {
|
|
252
397
|
this.store = this.entityDescriptor().store;
|
|
398
|
+
this.formNavigator.setEntityName(this.entityDescriptor().entityName);
|
|
253
399
|
}
|
|
254
400
|
// endregion
|
|
255
401
|
// region event handlers
|
|
256
402
|
async onShowDetails() {
|
|
257
|
-
if (this.
|
|
258
|
-
const id = this.selectedEntityId()
|
|
259
|
-
await this.
|
|
403
|
+
if (this.formNavigator.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
404
|
+
const id = this.selectedEntityId() ?? BaseUrlSegments.NewEntity;
|
|
405
|
+
await this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, id);
|
|
260
406
|
this.store.tabIsActive(this.detailsTabName());
|
|
261
407
|
}
|
|
262
408
|
}
|
|
263
409
|
async onShowList() {
|
|
264
|
-
if (this.
|
|
265
|
-
await this.
|
|
410
|
+
if (this.formNavigator.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
411
|
+
await this.formNavigator.navigateToList(this.entityDescriptor().entityName);
|
|
266
412
|
this.store.tabIsActive(this.listTabName());
|
|
267
413
|
}
|
|
268
414
|
}
|
|
@@ -270,7 +416,7 @@ class BaseEntityTabsComponent {
|
|
|
270
416
|
// region protected, private helper methods
|
|
271
417
|
registerEffects() {
|
|
272
418
|
effect(() => {
|
|
273
|
-
if (this.
|
|
419
|
+
if (this.formNavigator.activeRouteSegment() === RouteSegments.DETAILS_ROUTE) {
|
|
274
420
|
this.store.tabIsActive(this.detailsTabName());
|
|
275
421
|
}
|
|
276
422
|
else {
|
|
@@ -278,8 +424,8 @@ class BaseEntityTabsComponent {
|
|
|
278
424
|
}
|
|
279
425
|
});
|
|
280
426
|
}
|
|
281
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
282
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
427
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
428
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.11", type: BaseEntityTabsComponent, isStandalone: true, selector: "base-entity-tabs", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
283
429
|
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
|
|
284
430
|
<a mat-tab-link (click)="onShowList()" [active]="store.currentTab() === listTabName()">{{ listTabName() }}</a>
|
|
285
431
|
<a mat-tab-link [disabled]="store.currentEntity() === undefined" (click)="onShowDetails()" [active]="store.currentTab() === detailsTabName()">{{ detailsTabName() }}</a>
|
|
@@ -292,7 +438,7 @@ class BaseEntityTabsComponent {
|
|
|
292
438
|
</mat-tab-nav-panel>
|
|
293
439
|
`, 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
440
|
}
|
|
295
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
441
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityTabsComponent, decorators: [{
|
|
296
442
|
type: Component,
|
|
297
443
|
args: [{
|
|
298
444
|
selector: 'base-entity-tabs',
|
|
@@ -337,14 +483,14 @@ class BaseEntityContainerComponent {
|
|
|
337
483
|
}
|
|
338
484
|
});
|
|
339
485
|
}
|
|
340
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
341
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
486
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
487
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.11", type: BaseEntityContainerComponent, isStandalone: true, selector: "base-entity-container", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
342
488
|
<div>
|
|
343
489
|
<base-entity-tabs [entityDescriptor]="entityDescriptor()"></base-entity-tabs>
|
|
344
490
|
</div>
|
|
345
491
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BaseEntityTabsComponent, selector: "base-entity-tabs", inputs: ["entityDescriptor"] }] });
|
|
346
492
|
}
|
|
347
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
493
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityContainerComponent, decorators: [{
|
|
348
494
|
type: Component,
|
|
349
495
|
args: [{
|
|
350
496
|
selector: 'base-entity-container',
|
|
@@ -509,15 +655,16 @@ class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
|
509
655
|
isLinkToDetails;
|
|
510
656
|
selectables;
|
|
511
657
|
visible = true;
|
|
658
|
+
hideInTable = false;
|
|
512
659
|
isHeading;
|
|
513
660
|
placeholder;
|
|
514
661
|
lines;
|
|
515
662
|
options;
|
|
663
|
+
required = false;
|
|
516
664
|
_label;
|
|
517
665
|
_linkedEntityType;
|
|
518
666
|
constructor(attrName, formControlType, label, selectables, isLinkToDetails, options) {
|
|
519
667
|
super(attrName, formControlType);
|
|
520
|
-
this.attrName = attrName;
|
|
521
668
|
this._label = label;
|
|
522
669
|
this.selectables = selectables;
|
|
523
670
|
this.isLinkToDetails = isLinkToDetails;
|
|
@@ -543,10 +690,10 @@ class BaseFormHostDirective {
|
|
|
543
690
|
constructor(viewContainerRef) {
|
|
544
691
|
this.viewContainerRef = viewContainerRef;
|
|
545
692
|
}
|
|
546
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
547
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.
|
|
693
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseFormHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
694
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.11", type: BaseFormHostDirective, isStandalone: true, selector: "[baseFormHost]", ngImport: i0 });
|
|
548
695
|
}
|
|
549
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
696
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseFormHostDirective, decorators: [{
|
|
550
697
|
type: Directive,
|
|
551
698
|
args: [{
|
|
552
699
|
standalone: true,
|
|
@@ -561,10 +708,11 @@ class BaseFormControlComponent {
|
|
|
561
708
|
store;
|
|
562
709
|
style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
|
|
563
710
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
564
|
-
|
|
565
|
-
static
|
|
711
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
712
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseFormControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
713
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.11", 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 }] });
|
|
566
714
|
}
|
|
567
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
715
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseFormControlComponent, decorators: [{
|
|
568
716
|
type: Component,
|
|
569
717
|
args: [{
|
|
570
718
|
standalone: true,
|
|
@@ -614,10 +762,10 @@ class ObjectStoreService {
|
|
|
614
762
|
const baseConfiguration = Reflect.get(this.runtimeConfiguration, 'BASE_CONFIGURATION');
|
|
615
763
|
return Reflect.get(baseConfiguration, 'OBJECT_STORE_SERVICE_ROOT') ?? Reflect.get(baseConfiguration, 'BACKEND_SERVICE_ROOT') ?? '';
|
|
616
764
|
}
|
|
617
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
618
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
765
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: ObjectStoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
766
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: ObjectStoreService, providedIn: 'root' });
|
|
619
767
|
}
|
|
620
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
768
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: ObjectStoreService, decorators: [{
|
|
621
769
|
type: Injectable,
|
|
622
770
|
args: [{ providedIn: 'root' }]
|
|
623
771
|
}] });
|
|
@@ -686,8 +834,8 @@ class ArtifactSelectorComponent {
|
|
|
686
834
|
};
|
|
687
835
|
return mimeTypeByExtension[extension] ?? 'application/octet-stream';
|
|
688
836
|
}
|
|
689
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
690
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
837
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: ArtifactSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
838
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: ArtifactSelectorComponent, isStandalone: true, selector: "app-artifact-selector", outputs: { artifactUploaded: "artifactUploaded" }, ngImport: i0, template: `
|
|
691
839
|
<div class="artifact-selector">
|
|
692
840
|
@if (!isSelectorVisible) {
|
|
693
841
|
<button type="button" (click)="showSelector()">Upload file</button>
|
|
@@ -719,7 +867,7 @@ class ArtifactSelectorComponent {
|
|
|
719
867
|
</div>
|
|
720
868
|
`, 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"] }] });
|
|
721
869
|
}
|
|
722
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
870
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: ArtifactSelectorComponent, decorators: [{
|
|
723
871
|
type: Component,
|
|
724
872
|
args: [{ selector: 'app-artifact-selector', standalone: true, imports: [FormsModule], template: `
|
|
725
873
|
<div class="artifact-selector">
|
|
@@ -756,11 +904,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
756
904
|
type: Output
|
|
757
905
|
}] } });
|
|
758
906
|
|
|
907
|
+
class DeleteArtifactConfirmationDialog {
|
|
908
|
+
data = inject(MAT_DIALOG_DATA);
|
|
909
|
+
translocoService = inject(TranslocoService);
|
|
910
|
+
t(key, params) {
|
|
911
|
+
return this.translocoService.translate(key, params);
|
|
912
|
+
}
|
|
913
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DeleteArtifactConfirmationDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
914
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: DeleteArtifactConfirmationDialog, isStandalone: true, selector: "app-delete-artifact-confirmation-dialog", providers: [provideTranslocoScope('base-entity')], ngImport: i0, template: `
|
|
915
|
+
<h2 mat-dialog-title>{{ t(data.titleKey) }}</h2>
|
|
916
|
+
<mat-dialog-content>{{ t(data.contentKey, data.contentParams) }}</mat-dialog-content>
|
|
917
|
+
<mat-dialog-actions align="end">
|
|
918
|
+
<button type="button" mat-button [mat-dialog-close]="false">{{ t(data.cancelButtonKey) }}</button>
|
|
919
|
+
<button type="button" mat-raised-button color="warn" [mat-dialog-close]="true">{{ t(data.confirmButtonKey) }}</button>
|
|
920
|
+
</mat-dialog-actions>
|
|
921
|
+
`, 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"] }] });
|
|
922
|
+
}
|
|
923
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DeleteArtifactConfirmationDialog, decorators: [{
|
|
924
|
+
type: Component,
|
|
925
|
+
args: [{
|
|
926
|
+
selector: 'app-delete-artifact-confirmation-dialog',
|
|
927
|
+
standalone: true,
|
|
928
|
+
imports: [MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose, MatButton],
|
|
929
|
+
providers: [provideTranslocoScope('base-entity')],
|
|
930
|
+
template: `
|
|
931
|
+
<h2 mat-dialog-title>{{ t(data.titleKey) }}</h2>
|
|
932
|
+
<mat-dialog-content>{{ t(data.contentKey, data.contentParams) }}</mat-dialog-content>
|
|
933
|
+
<mat-dialog-actions align="end">
|
|
934
|
+
<button type="button" mat-button [mat-dialog-close]="false">{{ t(data.cancelButtonKey) }}</button>
|
|
935
|
+
<button type="button" mat-raised-button color="warn" [mat-dialog-close]="true">{{ t(data.confirmButtonKey) }}</button>
|
|
936
|
+
</mat-dialog-actions>
|
|
937
|
+
`,
|
|
938
|
+
}]
|
|
939
|
+
}] });
|
|
940
|
+
|
|
759
941
|
class ArtifactComponent extends BaseFormControlComponent {
|
|
760
942
|
objectStoreService = inject(ObjectStoreService);
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
return
|
|
943
|
+
dialog = inject(MatDialog);
|
|
944
|
+
artifact() {
|
|
945
|
+
return this.formGroup.get(this.config().attrName)?.value ?? null;
|
|
764
946
|
}
|
|
765
947
|
openArtifact(event, artifact) {
|
|
766
948
|
event.preventDefault();
|
|
@@ -773,67 +955,119 @@ class ArtifactComponent extends BaseFormControlComponent {
|
|
|
773
955
|
});
|
|
774
956
|
}
|
|
775
957
|
onArtifactUploaded(artifact) {
|
|
958
|
+
if (this.config().disabled) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
const control = this.formGroup.get(this.config().attrName);
|
|
962
|
+
control?.setValue(artifact);
|
|
963
|
+
control?.markAsDirty();
|
|
964
|
+
control?.markAsTouched();
|
|
965
|
+
}
|
|
966
|
+
deleteArtifact() {
|
|
967
|
+
if (this.config().disabled) {
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
const artifact = this.artifact();
|
|
971
|
+
if (!artifact) {
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
const dialogData = {
|
|
975
|
+
titleKey: 'base-entity.delete_artifact_confirmation_dialog.title',
|
|
976
|
+
contentKey: 'base-entity.delete_artifact_confirmation_dialog.content',
|
|
977
|
+
contentParams: { artifactName: artifact.name },
|
|
978
|
+
cancelButtonKey: 'base-entity.delete_artifact_confirmation_dialog.cancel_button',
|
|
979
|
+
confirmButtonKey: 'base-entity.delete_artifact_confirmation_dialog.delete_button',
|
|
980
|
+
};
|
|
981
|
+
this.dialog
|
|
982
|
+
.open(DeleteArtifactConfirmationDialog, { data: dialogData })
|
|
983
|
+
.afterClosed()
|
|
984
|
+
.pipe(filter((confirmed) => confirmed === true), switchMap(() => this.objectStoreService.deleteObjectByID(artifact.bucket, artifact.objectId)))
|
|
985
|
+
.subscribe({
|
|
986
|
+
next: () => this.clearArtifact(),
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
clearArtifact() {
|
|
776
990
|
const control = this.formGroup.get(this.config().attrName);
|
|
777
|
-
control?.setValue(
|
|
991
|
+
control?.setValue(null);
|
|
778
992
|
control?.markAsDirty();
|
|
779
993
|
control?.markAsTouched();
|
|
780
994
|
}
|
|
781
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
782
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
995
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: ArtifactComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
996
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: ArtifactComponent, isStandalone: true, selector: "app-artifact", usesInheritance: true, ngImport: i0, template: `
|
|
783
997
|
@if (config().visible) {
|
|
784
998
|
@if (config().isHeading) {
|
|
785
999
|
<h3 [id]="config().attrName">{{ value() }}</h3>
|
|
786
1000
|
} @else {
|
|
787
|
-
|
|
788
|
-
<
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
1001
|
+
<div class="row">
|
|
1002
|
+
<fieldset class="base-entity-form-field" [ngClass]="config().styleClass" [ngStyle]="config().style">
|
|
1003
|
+
<legend [ngClass]="config().labelClass">{{ config().label }}</legend>
|
|
1004
|
+
<ul [id]="config().attrName" class="base-entity-form-list">
|
|
1005
|
+
@if (artifact(); as artifact) {
|
|
1006
|
+
<li>
|
|
1007
|
+
<a href="" (click)="openArtifact($event, artifact)">{{ artifact.name }}</a>
|
|
1008
|
+
@if (!config().disabled) {
|
|
1009
|
+
<button type="button" mat-icon-button class="base-entity-form-delete-button" aria-label="Delete artifact reference" (click)="deleteArtifact()">
|
|
1010
|
+
<mat-icon>cancel</mat-icon>
|
|
1011
|
+
</button>
|
|
1012
|
+
}
|
|
1013
|
+
</li>
|
|
1014
|
+
}
|
|
1015
|
+
</ul>
|
|
1016
|
+
@if (!config().disabled) {
|
|
1017
|
+
<app-artifact-selector (artifactUploaded)="onArtifactUploaded($event)" />
|
|
793
1018
|
}
|
|
794
|
-
</
|
|
795
|
-
|
|
796
|
-
<app-artifact-selector (artifactUploaded)="onArtifactUploaded($event)" />
|
|
1019
|
+
</fieldset>
|
|
1020
|
+
</div>
|
|
797
1021
|
}
|
|
798
1022
|
}
|
|
799
|
-
`, 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"] }] });
|
|
1023
|
+
`, 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"] }] });
|
|
800
1024
|
}
|
|
801
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1025
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: ArtifactComponent, decorators: [{
|
|
802
1026
|
type: Component,
|
|
803
|
-
args: [{ selector: 'app-artifact', standalone: true, imports: [FormsModule, ReactiveFormsModule, NgStyle, ArtifactSelectorComponent], template: `
|
|
1027
|
+
args: [{ selector: 'app-artifact', standalone: true, imports: [FormsModule, ReactiveFormsModule, NgClass, NgStyle, ArtifactSelectorComponent, MatIconButton, MatIcon], template: `
|
|
804
1028
|
@if (config().visible) {
|
|
805
1029
|
@if (config().isHeading) {
|
|
806
1030
|
<h3 [id]="config().attrName">{{ value() }}</h3>
|
|
807
1031
|
} @else {
|
|
808
|
-
|
|
809
|
-
<
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1032
|
+
<div class="row">
|
|
1033
|
+
<fieldset class="base-entity-form-field" [ngClass]="config().styleClass" [ngStyle]="config().style">
|
|
1034
|
+
<legend [ngClass]="config().labelClass">{{ config().label }}</legend>
|
|
1035
|
+
<ul [id]="config().attrName" class="base-entity-form-list">
|
|
1036
|
+
@if (artifact(); as artifact) {
|
|
1037
|
+
<li>
|
|
1038
|
+
<a href="" (click)="openArtifact($event, artifact)">{{ artifact.name }}</a>
|
|
1039
|
+
@if (!config().disabled) {
|
|
1040
|
+
<button type="button" mat-icon-button class="base-entity-form-delete-button" aria-label="Delete artifact reference" (click)="deleteArtifact()">
|
|
1041
|
+
<mat-icon>cancel</mat-icon>
|
|
1042
|
+
</button>
|
|
1043
|
+
}
|
|
1044
|
+
</li>
|
|
1045
|
+
}
|
|
1046
|
+
</ul>
|
|
1047
|
+
@if (!config().disabled) {
|
|
1048
|
+
<app-artifact-selector (artifactUploaded)="onArtifactUploaded($event)" />
|
|
814
1049
|
}
|
|
815
|
-
</
|
|
816
|
-
|
|
817
|
-
<app-artifact-selector (artifactUploaded)="onArtifactUploaded($event)" />
|
|
1050
|
+
</fieldset>
|
|
1051
|
+
</div>
|
|
818
1052
|
}
|
|
819
1053
|
}
|
|
820
|
-
|
|
1054
|
+
`, 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"] }]
|
|
821
1055
|
}] });
|
|
822
1056
|
|
|
823
1057
|
class LabelComponent extends BaseFormControlComponent {
|
|
824
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
825
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1058
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: LabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1059
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", 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"] }] });
|
|
826
1060
|
}
|
|
827
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1061
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: LabelComponent, decorators: [{
|
|
828
1062
|
type: Component,
|
|
829
1063
|
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>" }]
|
|
830
1064
|
}] });
|
|
831
1065
|
|
|
832
1066
|
class DatepickerComponent extends BaseFormControlComponent {
|
|
833
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
834
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1067
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1068
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", 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"] }] });
|
|
835
1069
|
}
|
|
836
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1070
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
837
1071
|
type: Component,
|
|
838
1072
|
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" }]
|
|
839
1073
|
}] });
|
|
@@ -841,57 +1075,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
841
1075
|
class ForeignKeyComponent extends BaseFormControlComponent {
|
|
842
1076
|
// region event handling methods
|
|
843
1077
|
navigateToRelated() {
|
|
844
|
-
this.
|
|
1078
|
+
const relatedEntityName = this.config().linkedEntityType?.entityName;
|
|
1079
|
+
if (!relatedEntityName)
|
|
1080
|
+
return;
|
|
1081
|
+
this.formNavigator.navigateToRelated(relatedEntityName, this.value());
|
|
845
1082
|
}
|
|
846
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
847
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1083
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: ForeignKeyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1084
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: ForeignKeyComponent, isStandalone: true, selector: "base-foreign-key", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{ config().attrName }}</mat-label>\n <input matInput formControlName=\"{{config().attrName}}\">\n </mat-form-field>\n <a (click)=\"navigateToRelated()\" aria-label=\"Related entity\">\n <mat-icon>link</mat-icon>\n </a>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
848
1085
|
}
|
|
849
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1086
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: ForeignKeyComponent, decorators: [{
|
|
850
1087
|
type: Component,
|
|
851
1088
|
args: [{ selector: 'base-foreign-key', standalone: true, imports: [NgIf, MatIcon, MatLabel, MatFormField, MatInput, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{ config().attrName }}</mat-label>\n <input matInput formControlName=\"{{config().attrName}}\">\n </mat-form-field>\n <a (click)=\"navigateToRelated()\" aria-label=\"Related entity\">\n <mat-icon>link</mat-icon>\n </a>\n </div>\n</ng-container>" }]
|
|
852
1089
|
}] });
|
|
853
1090
|
|
|
854
1091
|
class TextboxComponent extends BaseFormControlComponent {
|
|
855
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
856
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1092
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: TextboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1093
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", 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"] }] });
|
|
857
1094
|
}
|
|
858
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1095
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: TextboxComponent, decorators: [{
|
|
859
1096
|
type: Component,
|
|
860
1097
|
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>" }]
|
|
861
1098
|
}] });
|
|
862
1099
|
|
|
863
1100
|
class DropdownComponent extends BaseFormControlComponent {
|
|
864
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
865
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1101
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1102
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", 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"] }] });
|
|
866
1103
|
}
|
|
867
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
868
1105
|
type: Component,
|
|
869
1106
|
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>" }]
|
|
870
1107
|
}] });
|
|
871
1108
|
|
|
872
1109
|
class CheckboxComponent extends BaseFormControlComponent {
|
|
873
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
874
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1110
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1111
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", 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"] }] });
|
|
875
1112
|
}
|
|
876
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
877
1114
|
type: Component,
|
|
878
1115
|
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"] }]
|
|
879
1116
|
}] });
|
|
880
1117
|
|
|
881
1118
|
class RadioComponent extends BaseFormControlComponent {
|
|
882
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
883
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1119
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1120
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", 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"] }] });
|
|
884
1121
|
}
|
|
885
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: RadioComponent, decorators: [{
|
|
886
1123
|
type: Component,
|
|
887
1124
|
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>" }]
|
|
888
1125
|
}] });
|
|
889
1126
|
|
|
890
1127
|
class TextareaComponent extends BaseFormControlComponent {
|
|
891
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
892
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1128
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: TextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1129
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", 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"] }] });
|
|
893
1130
|
}
|
|
894
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
895
1132
|
type: Component,
|
|
896
1133
|
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>" }]
|
|
897
1134
|
}] });
|
|
@@ -901,10 +1138,10 @@ class FlexBoxHostDirective {
|
|
|
901
1138
|
constructor(viewContainerRef) {
|
|
902
1139
|
this.viewContainerRef = viewContainerRef;
|
|
903
1140
|
}
|
|
904
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
905
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.
|
|
1141
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: FlexBoxHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1142
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.11", type: FlexBoxHostDirective, isStandalone: true, selector: "[flexBoxHost]", ngImport: i0 });
|
|
906
1143
|
}
|
|
907
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: FlexBoxHostDirective, decorators: [{
|
|
908
1145
|
type: Directive,
|
|
909
1146
|
args: [{
|
|
910
1147
|
standalone: true,
|
|
@@ -944,10 +1181,10 @@ class FlexBoxComponent extends BaseFormControlComponent {
|
|
|
944
1181
|
throw new Error('Unknown flex direction');
|
|
945
1182
|
}
|
|
946
1183
|
}
|
|
947
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
948
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
1184
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: FlexBoxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1185
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", 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"] }] });
|
|
949
1186
|
}
|
|
950
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1187
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: FlexBoxComponent, decorators: [{
|
|
951
1188
|
type: Component,
|
|
952
1189
|
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"] }]
|
|
953
1190
|
}], propDecorators: { flexBoxHost: [{
|
|
@@ -991,8 +1228,8 @@ class TagsComponent extends BaseFormControlComponent {
|
|
|
991
1228
|
control?.markAsDirty();
|
|
992
1229
|
control?.markAsTouched();
|
|
993
1230
|
}
|
|
994
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
995
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1231
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: TagsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1232
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: TagsComponent, isStandalone: true, selector: "base-tags", usesInheritance: true, ngImport: i0, template: `
|
|
996
1233
|
<ng-container *ngIf="config().visible">
|
|
997
1234
|
<div class="row" [formGroup]="formGroup">
|
|
998
1235
|
<mat-form-field>
|
|
@@ -1013,7 +1250,7 @@ class TagsComponent extends BaseFormControlComponent {
|
|
|
1013
1250
|
</ng-container>
|
|
1014
1251
|
`, 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"] }] });
|
|
1015
1252
|
}
|
|
1016
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: TagsComponent, decorators: [{
|
|
1017
1254
|
type: Component,
|
|
1018
1255
|
args: [{
|
|
1019
1256
|
selector: 'base-tags',
|
|
@@ -1042,28 +1279,237 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
1042
1279
|
}]
|
|
1043
1280
|
}] });
|
|
1044
1281
|
|
|
1282
|
+
class EntityComponentRefComponent {
|
|
1283
|
+
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
|
|
1284
|
+
component = input.required(...(ngDevMode ? [{ debugName: "component" }] : /* istanbul ignore next */ []));
|
|
1285
|
+
componentNameAttr = input.required(...(ngDevMode ? [{ debugName: "componentNameAttr" }] : /* istanbul ignore next */ []));
|
|
1286
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1287
|
+
formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
1288
|
+
linkedEntityType = input.required(...(ngDevMode ? [{ debugName: "linkedEntityType" }] : /* istanbul ignore next */ []));
|
|
1289
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
1290
|
+
componentName() {
|
|
1291
|
+
const attrName = this.componentNameAttr().attrName;
|
|
1292
|
+
const component = this.component();
|
|
1293
|
+
const componentName = attrName ? component[attrName] : undefined;
|
|
1294
|
+
return componentName === undefined || componentName === null ? component.id : String(componentName);
|
|
1295
|
+
}
|
|
1296
|
+
navigateToRelated(event) {
|
|
1297
|
+
event.preventDefault();
|
|
1298
|
+
this.formNavigator.navigateToRelated(this.linkedEntityType(), this.component().id, this.formNavigator.determineCurrentUrl());
|
|
1299
|
+
}
|
|
1300
|
+
removeComponent() {
|
|
1301
|
+
if (this.disabled()) {
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
const componentsAttrName = this.componentNameAttr().name;
|
|
1305
|
+
const entity = this.entity();
|
|
1306
|
+
const components = entity[componentsAttrName];
|
|
1307
|
+
if (!Array.isArray(components)) {
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
const remainingComponents = components.filter((component) => component.id !== this.component().id);
|
|
1311
|
+
entity[componentsAttrName] = remainingComponents;
|
|
1312
|
+
const control = this.formGroup().get(componentsAttrName);
|
|
1313
|
+
control?.setValue(remainingComponents);
|
|
1314
|
+
control?.markAsDirty();
|
|
1315
|
+
control?.markAsTouched();
|
|
1316
|
+
}
|
|
1317
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: EntityComponentRefComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1318
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", 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: `
|
|
1319
|
+
<a href="" (click)="navigateToRelated($event)">{{ componentName() }}</a>
|
|
1320
|
+
@if (!disabled()) {
|
|
1321
|
+
<button type="button" mat-icon-button class="base-entity-form-delete-button" aria-label="Delete component reference" (click)="removeComponent()">
|
|
1322
|
+
<mat-icon>cancel</mat-icon>
|
|
1323
|
+
</button>
|
|
1324
|
+
}
|
|
1325
|
+
`, 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"] }] });
|
|
1326
|
+
}
|
|
1327
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: EntityComponentRefComponent, decorators: [{
|
|
1328
|
+
type: Component,
|
|
1329
|
+
args: [{ selector: 'app-entity-component-ref', standalone: true, imports: [MatIconButton, MatIcon], template: `
|
|
1330
|
+
<a href="" (click)="navigateToRelated($event)">{{ componentName() }}</a>
|
|
1331
|
+
@if (!disabled()) {
|
|
1332
|
+
<button type="button" mat-icon-button class="base-entity-form-delete-button" aria-label="Delete component reference" (click)="removeComponent()">
|
|
1333
|
+
<mat-icon>cancel</mat-icon>
|
|
1334
|
+
</button>
|
|
1335
|
+
}
|
|
1336
|
+
`, 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"] }]
|
|
1337
|
+
}], 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 }] }] } });
|
|
1338
|
+
|
|
1339
|
+
var NavigatorCommand;
|
|
1340
|
+
(function (NavigatorCommand) {
|
|
1341
|
+
NavigatorCommand["SELECT_OR_CREATE"] = "SelectOrCreate";
|
|
1342
|
+
NavigatorCommand["EDIT"] = "Edit";
|
|
1343
|
+
})(NavigatorCommand || (NavigatorCommand = {}));
|
|
1344
|
+
|
|
1345
|
+
class EntityComponentsListComponent extends BaseFormControlComponent {
|
|
1346
|
+
logger = inject(NGXLogger);
|
|
1347
|
+
linkedEntityType = computed(() => {
|
|
1348
|
+
this.logger.debug('config(): ', this.config());
|
|
1349
|
+
const linkedEntityType = this.config().linkedEntityType;
|
|
1350
|
+
if (linkedEntityType === undefined) {
|
|
1351
|
+
throw new Error('linkedEntityType should be defined for EntityComponentsListComponent.');
|
|
1352
|
+
}
|
|
1353
|
+
return linkedEntityType;
|
|
1354
|
+
}, ...(ngDevMode ? [{ debugName: "linkedEntityType" }] : /* istanbul ignore next */ []));
|
|
1355
|
+
ngOnInit() {
|
|
1356
|
+
this.addSelectedComponentFromNavigatorResponse();
|
|
1357
|
+
}
|
|
1358
|
+
componentNameAttr() {
|
|
1359
|
+
return {
|
|
1360
|
+
attrName: this.linkedEntityType().componentIdentification(),
|
|
1361
|
+
name: this.config().attrName,
|
|
1362
|
+
};
|
|
1363
|
+
}
|
|
1364
|
+
components() {
|
|
1365
|
+
const value = this.formGroup.get(this.config().attrName)?.value ?? this.value();
|
|
1366
|
+
return Array.isArray(value) ? value : [];
|
|
1367
|
+
}
|
|
1368
|
+
addComponentTitle() {
|
|
1369
|
+
return 'Add ' + this.linkedEntityType().entityName;
|
|
1370
|
+
}
|
|
1371
|
+
navigateToRelatedList() {
|
|
1372
|
+
if (this.config().disabled) {
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
this.formNavigator.navigateToRelatedList(this.linkedEntityType().entityName, this.formNavigator.determineCurrentUrl(), {
|
|
1376
|
+
command: NavigatorCommand.SELECT_OR_CREATE,
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
addSelectedComponentFromNavigatorResponse() {
|
|
1380
|
+
if (this.config().disabled) {
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
const responsePayload = this.formNavigator.popResponsePayload(NavigatorCommand.SELECT_OR_CREATE);
|
|
1384
|
+
if (!responsePayload?.payload) {
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
const components = [...this.components(), responsePayload.payload];
|
|
1388
|
+
const attrName = this.config().attrName;
|
|
1389
|
+
const entity = this.entity();
|
|
1390
|
+
entity[attrName] = components;
|
|
1391
|
+
const control = this.formGroup.get(attrName);
|
|
1392
|
+
if (!control) {
|
|
1393
|
+
this.logger.warn('Unable to add selected component to form control because the control is missing.', this.describeFormState(attrName));
|
|
1394
|
+
return;
|
|
1395
|
+
}
|
|
1396
|
+
control.setValue(components);
|
|
1397
|
+
control.markAsDirty();
|
|
1398
|
+
control.markAsTouched();
|
|
1399
|
+
this.formGroup.markAsDirty();
|
|
1400
|
+
this.formGroup.markAsTouched();
|
|
1401
|
+
this.logger.info('Added selected component from navigator response.', this.describeFormState(attrName));
|
|
1402
|
+
}
|
|
1403
|
+
describeFormState(attrName) {
|
|
1404
|
+
const controls = Object.entries(this.formGroup.controls).map(([name, control]) => ({
|
|
1405
|
+
name,
|
|
1406
|
+
dirty: control.dirty,
|
|
1407
|
+
disabled: control.disabled,
|
|
1408
|
+
errors: control.errors,
|
|
1409
|
+
invalid: control.invalid,
|
|
1410
|
+
status: control.status,
|
|
1411
|
+
touched: control.touched,
|
|
1412
|
+
}));
|
|
1413
|
+
return {
|
|
1414
|
+
attrName,
|
|
1415
|
+
formDirty: this.formGroup.dirty,
|
|
1416
|
+
formInvalid: this.formGroup.invalid,
|
|
1417
|
+
formStatus: this.formGroup.status,
|
|
1418
|
+
targetControl: controls.find((control) => control.name === attrName),
|
|
1419
|
+
invalidControls: controls.filter((control) => control.invalid),
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1422
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: EntityComponentsListComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1423
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: EntityComponentsListComponent, isStandalone: true, selector: "app-component-list", usesInheritance: true, ngImport: i0, template: `
|
|
1424
|
+
@if (config().visible) {
|
|
1425
|
+
<div class="row">
|
|
1426
|
+
<fieldset class="base-entity-form-field" [ngClass]="config().styleClass" [ngStyle]="config().style">
|
|
1427
|
+
<legend [ngClass]="config().labelClass">{{ config().label }}</legend>
|
|
1428
|
+
<ul [id]="config().attrName" class="base-entity-form-list">
|
|
1429
|
+
@for (component of components(); track component.id) {
|
|
1430
|
+
<li>
|
|
1431
|
+
<app-entity-component-ref
|
|
1432
|
+
[entity]="entity()"
|
|
1433
|
+
[component]="component"
|
|
1434
|
+
[componentNameAttr]="componentNameAttr()"
|
|
1435
|
+
[disabled]="config().disabled"
|
|
1436
|
+
[formGroup]="formGroup"
|
|
1437
|
+
[linkedEntityType]="linkedEntityType().entityName"
|
|
1438
|
+
/>
|
|
1439
|
+
</li>
|
|
1440
|
+
}
|
|
1441
|
+
</ul>
|
|
1442
|
+
@if (!config().disabled) {
|
|
1443
|
+
<button type="button" mat-button [title]="addComponentTitle()" [attr.aria-label]="addComponentTitle()" (click)="navigateToRelatedList()">
|
|
1444
|
+
<mat-icon>add</mat-icon>
|
|
1445
|
+
{{ addComponentTitle() }}
|
|
1446
|
+
</button>
|
|
1447
|
+
}
|
|
1448
|
+
</fieldset>
|
|
1449
|
+
</div>
|
|
1450
|
+
}
|
|
1451
|
+
`, 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"] }] });
|
|
1452
|
+
}
|
|
1453
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: EntityComponentsListComponent, decorators: [{
|
|
1454
|
+
type: Component,
|
|
1455
|
+
args: [{ selector: 'app-component-list', standalone: true, imports: [NgClass, NgStyle, EntityComponentRefComponent, MatButton, MatIcon], template: `
|
|
1456
|
+
@if (config().visible) {
|
|
1457
|
+
<div class="row">
|
|
1458
|
+
<fieldset class="base-entity-form-field" [ngClass]="config().styleClass" [ngStyle]="config().style">
|
|
1459
|
+
<legend [ngClass]="config().labelClass">{{ config().label }}</legend>
|
|
1460
|
+
<ul [id]="config().attrName" class="base-entity-form-list">
|
|
1461
|
+
@for (component of components(); track component.id) {
|
|
1462
|
+
<li>
|
|
1463
|
+
<app-entity-component-ref
|
|
1464
|
+
[entity]="entity()"
|
|
1465
|
+
[component]="component"
|
|
1466
|
+
[componentNameAttr]="componentNameAttr()"
|
|
1467
|
+
[disabled]="config().disabled"
|
|
1468
|
+
[formGroup]="formGroup"
|
|
1469
|
+
[linkedEntityType]="linkedEntityType().entityName"
|
|
1470
|
+
/>
|
|
1471
|
+
</li>
|
|
1472
|
+
}
|
|
1473
|
+
</ul>
|
|
1474
|
+
@if (!config().disabled) {
|
|
1475
|
+
<button type="button" mat-button [title]="addComponentTitle()" [attr.aria-label]="addComponentTitle()" (click)="navigateToRelatedList()">
|
|
1476
|
+
<mat-icon>add</mat-icon>
|
|
1477
|
+
{{ addComponentTitle() }}
|
|
1478
|
+
</button>
|
|
1479
|
+
}
|
|
1480
|
+
</fieldset>
|
|
1481
|
+
</div>
|
|
1482
|
+
}
|
|
1483
|
+
`, 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"] }]
|
|
1484
|
+
}] });
|
|
1485
|
+
|
|
1045
1486
|
class BaseEntityFormBuilder {
|
|
1046
1487
|
logger = inject(NGXLogger);
|
|
1047
1488
|
// region public methods
|
|
1048
1489
|
buildForm(viewContainerRef, baseEntityForm, store, attrDescriptors, entity) {
|
|
1049
|
-
this.logger.trace(
|
|
1490
|
+
this.logger.trace('Starting to build form for: ', { attrDescriptors: attrDescriptors });
|
|
1050
1491
|
viewContainerRef.clear();
|
|
1051
1492
|
attrDescriptors.forEach((column) => {
|
|
1052
|
-
this.logger.
|
|
1493
|
+
this.logger.trace('Processing column: ', column.attrName);
|
|
1053
1494
|
const formControlType = this.createFormControl(column);
|
|
1054
1495
|
if (formControlType) {
|
|
1055
|
-
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
1056
|
-
componentRef.instance.config = signal(column, ...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1057
|
-
componentRef.instance.entity = entity;
|
|
1058
|
-
componentRef.instance.formGroup = baseEntityForm;
|
|
1059
|
-
componentRef.instance.store = store;
|
|
1060
1496
|
if (column instanceof BaseEntityAttrDescriptor) {
|
|
1061
1497
|
const currentAttrValue = Reflect.get(entity(), column.attrName);
|
|
1062
|
-
|
|
1063
|
-
const formControl = new FormControl({ value: currentAttrValue, disabled: column.disabled }, Validators.required);
|
|
1498
|
+
const formControl = new FormControl({ value: currentAttrValue, disabled: column.disabled }, column.required ? Validators.required : null);
|
|
1064
1499
|
baseEntityForm.addControl(column.attrName, formControl);
|
|
1500
|
+
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
1501
|
+
componentRef.setInput('config', column);
|
|
1502
|
+
componentRef.setInput('entity', entity());
|
|
1503
|
+
componentRef.setInput('value', currentAttrValue);
|
|
1504
|
+
componentRef.instance.formGroup = baseEntityForm;
|
|
1505
|
+
componentRef.instance.store = store;
|
|
1065
1506
|
}
|
|
1066
1507
|
else if (column instanceof FlexboxDescriptor) {
|
|
1508
|
+
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
1509
|
+
componentRef.setInput('config', column);
|
|
1510
|
+
componentRef.setInput('entity', entity());
|
|
1511
|
+
componentRef.instance.formGroup = baseEntityForm;
|
|
1512
|
+
componentRef.instance.store = store;
|
|
1067
1513
|
this.buildForm(componentRef.instance.flexBoxHost.viewContainerRef, baseEntityForm, store, column.attrDescriptors, entity);
|
|
1068
1514
|
}
|
|
1069
1515
|
else
|
|
@@ -1080,6 +1526,9 @@ class BaseEntityFormBuilder {
|
|
|
1080
1526
|
else if (column.formControlType === FormControlType.CHECKBOX) {
|
|
1081
1527
|
return CheckboxComponent;
|
|
1082
1528
|
}
|
|
1529
|
+
else if (column.formControlType === FormControlType.COMPONENTS) {
|
|
1530
|
+
return EntityComponentsListComponent;
|
|
1531
|
+
}
|
|
1083
1532
|
else if (column.formControlType === FormControlType.DATE) {
|
|
1084
1533
|
return DatepickerComponent;
|
|
1085
1534
|
}
|
|
@@ -1110,10 +1559,10 @@ class BaseEntityFormBuilder {
|
|
|
1110
1559
|
else
|
|
1111
1560
|
throw Error('Undefined form control type');
|
|
1112
1561
|
}
|
|
1113
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1114
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
1562
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityFormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1563
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityFormBuilder, providedIn: 'root' });
|
|
1115
1564
|
}
|
|
1116
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1565
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityFormBuilder, decorators: [{
|
|
1117
1566
|
type: Injectable,
|
|
1118
1567
|
args: [{ providedIn: 'root' }]
|
|
1119
1568
|
}] });
|
|
@@ -1127,6 +1576,7 @@ class BaseEntityFormComponent {
|
|
|
1127
1576
|
store = computed(() => this.entityDescriptor().store, ...(ngDevMode ? [{ debugName: "store" }] : /* istanbul ignore next */ []));
|
|
1128
1577
|
entityFormBuilder = inject((BaseEntityFormBuilder));
|
|
1129
1578
|
formBuilder = inject(FormBuilder);
|
|
1579
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
1130
1580
|
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : /* istanbul ignore next */ []));
|
|
1131
1581
|
logger = inject(NGXLogger);
|
|
1132
1582
|
constructor() {
|
|
@@ -1134,15 +1584,16 @@ class BaseEntityFormComponent {
|
|
|
1134
1584
|
}
|
|
1135
1585
|
// region angular lifecycle hooks
|
|
1136
1586
|
ngOnInit() {
|
|
1137
|
-
this.
|
|
1587
|
+
this.formNavigator.setEntityName(this.entityDescriptor().entityName);
|
|
1588
|
+
this.formNavigator.determineActiveRouteSegment();
|
|
1138
1589
|
this.baseEntityForm = this.formBuilder.group({});
|
|
1139
|
-
this.logger.info('BaseEntityFormComponent initialized with:', { entityDescriptor: this.entityDescriptor() });
|
|
1590
|
+
this.logger.info('BaseEntityFormComponent initialized with: ', { entityDescriptor: this.entityDescriptor() });
|
|
1140
1591
|
}
|
|
1141
1592
|
// endregion
|
|
1142
1593
|
// region event handlers
|
|
1143
1594
|
async onCancel() {
|
|
1144
1595
|
this.store().setCurrentEntity(undefined);
|
|
1145
|
-
await this.
|
|
1596
|
+
await this.formNavigator.navigateBack();
|
|
1146
1597
|
}
|
|
1147
1598
|
async onSubmit() {
|
|
1148
1599
|
const objectToSave = { ...this.entity(), ...this.baseEntityForm.value };
|
|
@@ -1153,7 +1604,7 @@ class BaseEntityFormComponent {
|
|
|
1153
1604
|
this.store().update(objectToSave, objectToSave.id);
|
|
1154
1605
|
}
|
|
1155
1606
|
this.store().setCurrentEntity(undefined);
|
|
1156
|
-
await this.
|
|
1607
|
+
await this.formNavigator.navigateBack();
|
|
1157
1608
|
}
|
|
1158
1609
|
// endregion
|
|
1159
1610
|
// region protected, private helper methods
|
|
@@ -1169,10 +1620,10 @@ class BaseEntityFormComponent {
|
|
|
1169
1620
|
this.store().setCurrentEntity(this.entity().id);
|
|
1170
1621
|
});
|
|
1171
1622
|
}
|
|
1172
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1173
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
1623
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1624
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.11", 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"] }] });
|
|
1174
1625
|
}
|
|
1175
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1626
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityFormComponent, decorators: [{
|
|
1176
1627
|
type: Component,
|
|
1177
1628
|
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" }]
|
|
1178
1629
|
}], ctorParameters: () => [], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }], componentHost: [{
|
|
@@ -1192,25 +1643,51 @@ function filterAttributeDescriptors(descriptors) {
|
|
|
1192
1643
|
return attrDescriptors;
|
|
1193
1644
|
}
|
|
1194
1645
|
|
|
1646
|
+
class BaseEntityDescriptor {
|
|
1647
|
+
store;
|
|
1648
|
+
attrDescriptors;
|
|
1649
|
+
entityName;
|
|
1650
|
+
entityTitle;
|
|
1651
|
+
constructor({ store, attrDescriptors, entityName, entityTitle }) {
|
|
1652
|
+
this.store = store;
|
|
1653
|
+
this.attrDescriptors = attrDescriptors;
|
|
1654
|
+
this.entityName = entityName;
|
|
1655
|
+
this.entityTitle = entityTitle ?? '';
|
|
1656
|
+
}
|
|
1657
|
+
componentIdentification() {
|
|
1658
|
+
const attrDescriptor = filterAttributeDescriptors(this.attrDescriptors).find((attrDescriptor) => attrDescriptor.isLinkToDetails === true);
|
|
1659
|
+
return attrDescriptor?.attrName ?? '';
|
|
1660
|
+
}
|
|
1661
|
+
overwriteLinkedEntityAttr(attrName, linkedEntityDescr) {
|
|
1662
|
+
const attrDescriptor = filterAttributeDescriptors(this.attrDescriptors).find((attrDescriptor) => attrDescriptor.attrName === attrName);
|
|
1663
|
+
if (attrDescriptor) {
|
|
1664
|
+
attrDescriptor.linkedEntityType = linkedEntityDescr;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1195
1669
|
const BASE_LIST_DESCRIPTORS = new InjectionToken('BASE_TABLE_DISPLAYED_COLUMNS');
|
|
1196
1670
|
class BaseEntityListComponent {
|
|
1197
1671
|
dataSource = new MatTableDataSource();
|
|
1198
1672
|
selection = new SelectionModel(true, []);
|
|
1199
1673
|
entityDescriptor = inject(ROUTER_OUTLET_DATA);
|
|
1200
1674
|
logger = inject(NGXLogger);
|
|
1675
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
1201
1676
|
objectStoreService = inject(ObjectStoreService);
|
|
1202
1677
|
columnDescriptors = computed(() => {
|
|
1203
1678
|
return filterAttributeDescriptors(this.entityDescriptor().attrDescriptors);
|
|
1204
1679
|
}, ...(ngDevMode ? [{ debugName: "columnDescriptors" }] : /* istanbul ignore next */ []));
|
|
1205
1680
|
displayedColumns = computed(() => {
|
|
1206
|
-
const columns = this.columnDescriptors()
|
|
1681
|
+
const columns = this.columnDescriptors()
|
|
1682
|
+
.filter((column) => column.hideInTable !== true)
|
|
1683
|
+
.map((column) => column.attrName);
|
|
1207
1684
|
columns.unshift('select');
|
|
1208
1685
|
return columns;
|
|
1209
1686
|
}, ...(ngDevMode ? [{ debugName: "displayedColumns" }] : /* istanbul ignore next */ []));
|
|
1210
1687
|
sort = {};
|
|
1211
1688
|
paginator = {};
|
|
1212
1689
|
store;
|
|
1213
|
-
|
|
1690
|
+
selectOrCreateMode = false;
|
|
1214
1691
|
constructor() {
|
|
1215
1692
|
this.store = this.entityDescriptor().store;
|
|
1216
1693
|
this.registerEffects();
|
|
@@ -1223,7 +1700,10 @@ class BaseEntityListComponent {
|
|
|
1223
1700
|
this.loadAllData();
|
|
1224
1701
|
}
|
|
1225
1702
|
ngOnInit() {
|
|
1226
|
-
this.
|
|
1703
|
+
this.formNavigator.setEntityName(this.entityDescriptor().entityName);
|
|
1704
|
+
this.formNavigator.determineActiveRouteSegment();
|
|
1705
|
+
const requestPayload = this.formNavigator.popRequestPayload();
|
|
1706
|
+
this.selectOrCreateMode = requestPayload?.command === NavigatorCommand.SELECT_OR_CREATE;
|
|
1227
1707
|
this.logger.info('BaseEntityListComponent initialized with:', { columnDescriptors: this.columnDescriptors() });
|
|
1228
1708
|
}
|
|
1229
1709
|
// endregion
|
|
@@ -1239,11 +1719,14 @@ class BaseEntityListComponent {
|
|
|
1239
1719
|
this.store.clearCurrentEntity();
|
|
1240
1720
|
}
|
|
1241
1721
|
onNavigateToDetails(entity) {
|
|
1242
|
-
this.
|
|
1722
|
+
this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, entity.id);
|
|
1243
1723
|
this.store.setCurrentEntity(entity.id);
|
|
1244
1724
|
}
|
|
1245
1725
|
onNavigateToRelated(config, entity) {
|
|
1246
|
-
|
|
1726
|
+
const relatedEntityName = config.linkedEntityType?.entityName;
|
|
1727
|
+
if (!relatedEntityName)
|
|
1728
|
+
return;
|
|
1729
|
+
this.formNavigator.navigateToRelated(relatedEntityName, this.getPropertyValue(entity, config.attrName));
|
|
1247
1730
|
}
|
|
1248
1731
|
onRowClick(entity) {
|
|
1249
1732
|
this.selection.toggle(entity);
|
|
@@ -1252,8 +1735,8 @@ class BaseEntityListComponent {
|
|
|
1252
1735
|
onDownloadObject(artifact, event) {
|
|
1253
1736
|
event?.stopPropagation();
|
|
1254
1737
|
event?.preventDefault();
|
|
1255
|
-
const bucketName = artifact.
|
|
1256
|
-
const objectID = artifact.
|
|
1738
|
+
const bucketName = artifact.bucket ?? artifact.bucket;
|
|
1739
|
+
const objectID = artifact.objectId ?? artifact.objectId;
|
|
1257
1740
|
if (!bucketName || !objectID) {
|
|
1258
1741
|
this.logger.warn('Cannot download artifact: missing bucketName or objectID', { artifact });
|
|
1259
1742
|
return;
|
|
@@ -1280,6 +1763,16 @@ class BaseEntityListComponent {
|
|
|
1280
1763
|
});
|
|
1281
1764
|
}
|
|
1282
1765
|
}
|
|
1766
|
+
async onCancelSelectOrCreate() {
|
|
1767
|
+
this.cancelSelections();
|
|
1768
|
+
await this.formNavigator.navigateBack();
|
|
1769
|
+
}
|
|
1770
|
+
async onSelectEntity() {
|
|
1771
|
+
if (!this.canSelectEntity())
|
|
1772
|
+
return;
|
|
1773
|
+
this.formNavigator.pushResponsePayload({ command: NavigatorCommand.SELECT_OR_CREATE, payload: this.selection.selected[0] });
|
|
1774
|
+
await this.formNavigator.navigateBack();
|
|
1775
|
+
}
|
|
1283
1776
|
// endregion
|
|
1284
1777
|
// region protected, private helper methods
|
|
1285
1778
|
cancelSelections() {
|
|
@@ -1314,10 +1807,13 @@ class BaseEntityListComponent {
|
|
|
1314
1807
|
isSelected(row) {
|
|
1315
1808
|
return this.selection.isSelected(row);
|
|
1316
1809
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1810
|
+
canSelectEntity() {
|
|
1811
|
+
return this.selection.selected.length === 1;
|
|
1812
|
+
}
|
|
1813
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1814
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", 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" }] });
|
|
1319
1815
|
}
|
|
1320
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1816
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BaseEntityListComponent, decorators: [{
|
|
1321
1817
|
type: Component,
|
|
1322
1818
|
args: [{ selector: 'base-list', standalone: true, imports: [
|
|
1323
1819
|
MatTable,
|
|
@@ -1336,7 +1832,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
1336
1832
|
MatProgressBar,
|
|
1337
1833
|
MatCheckbox,
|
|
1338
1834
|
SlicePipe,
|
|
1339
|
-
|
|
1835
|
+
MatButton,
|
|
1836
|
+
], 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"] }]
|
|
1340
1837
|
}], ctorParameters: () => [], propDecorators: { sort: [{
|
|
1341
1838
|
type: ViewChild,
|
|
1342
1839
|
args: [MatSort]
|
|
@@ -1351,6 +1848,14 @@ var OrderByDirection;
|
|
|
1351
1848
|
OrderByDirection["DESC"] = "desc";
|
|
1352
1849
|
})(OrderByDirection || (OrderByDirection = {}));
|
|
1353
1850
|
|
|
1851
|
+
const BASE_ENTITY_MAPPER = new InjectionToken('BASE_ENTITY_MAPPER');
|
|
1852
|
+
function getEnumKeyByValue(myEnum, enumValue) {
|
|
1853
|
+
return Object.values(myEnum)[enumValue];
|
|
1854
|
+
}
|
|
1855
|
+
function getEnumValueByKey(myEnum, enumKey) {
|
|
1856
|
+
return myEnum[enumKey];
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1354
1859
|
const INITIAL_TABS_STATE = {
|
|
1355
1860
|
activeTabs: [],
|
|
1356
1861
|
currentTab: undefined,
|
|
@@ -1478,7 +1983,7 @@ function BaseEntityStore(entityType, repositoryType) {
|
|
|
1478
1983
|
isLoading: false,
|
|
1479
1984
|
error: undefined,
|
|
1480
1985
|
selectedEntities: [],
|
|
1481
|
-
}), withMethods((store, repository = inject(repositoryType)) => ({
|
|
1986
|
+
}), withDevtools('base-entity'), withMethods((store, repository = inject(repositoryType)) => ({
|
|
1482
1987
|
clearCurrentEntity: () => patchState(store, { currentEntity: undefined }),
|
|
1483
1988
|
createEntity: () => new entityType(),
|
|
1484
1989
|
add: addEntity(store, repository),
|
|
@@ -1720,7 +2225,7 @@ function getEntityIds(instance) {
|
|
|
1720
2225
|
|
|
1721
2226
|
const BASE_ENTITY_ROUTES = [
|
|
1722
2227
|
{ path: '', redirectTo: 'list', pathMatch: 'full' },
|
|
1723
|
-
{ path: ':
|
|
2228
|
+
{ path: ':' + BaseUrlSegments.EntityID + '/details', component: BaseEntityFormComponent },
|
|
1724
2229
|
{ path: 'list', component: BaseEntityListComponent },
|
|
1725
2230
|
];
|
|
1726
2231
|
|
|
@@ -1730,5 +2235,5 @@ const BASE_ENTITY_ROUTES = [
|
|
|
1730
2235
|
* Generated bundle index. Do not edit.
|
|
1731
2236
|
*/
|
|
1732
2237
|
|
|
1733
|
-
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 };
|
|
2238
|
+
export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, 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 };
|
|
1734
2239
|
//# sourceMappingURL=processpuzzle-base-entity.mjs.map
|