@processpuzzle/base-entity 0.4.1 → 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',
|
|
@@ -514,11 +660,11 @@ class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
|
514
660
|
placeholder;
|
|
515
661
|
lines;
|
|
516
662
|
options;
|
|
663
|
+
required = false;
|
|
517
664
|
_label;
|
|
518
665
|
_linkedEntityType;
|
|
519
666
|
constructor(attrName, formControlType, label, selectables, isLinkToDetails, options) {
|
|
520
667
|
super(attrName, formControlType);
|
|
521
|
-
this.attrName = attrName;
|
|
522
668
|
this._label = label;
|
|
523
669
|
this.selectables = selectables;
|
|
524
670
|
this.isLinkToDetails = isLinkToDetails;
|
|
@@ -544,10 +690,10 @@ class BaseFormHostDirective {
|
|
|
544
690
|
constructor(viewContainerRef) {
|
|
545
691
|
this.viewContainerRef = viewContainerRef;
|
|
546
692
|
}
|
|
547
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
548
|
-
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 });
|
|
549
695
|
}
|
|
550
|
-
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: [{
|
|
551
697
|
type: Directive,
|
|
552
698
|
args: [{
|
|
553
699
|
standalone: true,
|
|
@@ -562,10 +708,11 @@ class BaseFormControlComponent {
|
|
|
562
708
|
store;
|
|
563
709
|
style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
|
|
564
710
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
565
|
-
|
|
566
|
-
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 }] });
|
|
567
714
|
}
|
|
568
|
-
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: [{
|
|
569
716
|
type: Component,
|
|
570
717
|
args: [{
|
|
571
718
|
standalone: true,
|
|
@@ -615,10 +762,10 @@ class ObjectStoreService {
|
|
|
615
762
|
const baseConfiguration = Reflect.get(this.runtimeConfiguration, 'BASE_CONFIGURATION');
|
|
616
763
|
return Reflect.get(baseConfiguration, 'OBJECT_STORE_SERVICE_ROOT') ?? Reflect.get(baseConfiguration, 'BACKEND_SERVICE_ROOT') ?? '';
|
|
617
764
|
}
|
|
618
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
619
|
-
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' });
|
|
620
767
|
}
|
|
621
|
-
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: [{
|
|
622
769
|
type: Injectable,
|
|
623
770
|
args: [{ providedIn: 'root' }]
|
|
624
771
|
}] });
|
|
@@ -687,8 +834,8 @@ class ArtifactSelectorComponent {
|
|
|
687
834
|
};
|
|
688
835
|
return mimeTypeByExtension[extension] ?? 'application/octet-stream';
|
|
689
836
|
}
|
|
690
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
691
|
-
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: `
|
|
692
839
|
<div class="artifact-selector">
|
|
693
840
|
@if (!isSelectorVisible) {
|
|
694
841
|
<button type="button" (click)="showSelector()">Upload file</button>
|
|
@@ -720,7 +867,7 @@ class ArtifactSelectorComponent {
|
|
|
720
867
|
</div>
|
|
721
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"] }] });
|
|
722
869
|
}
|
|
723
|
-
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: [{
|
|
724
871
|
type: Component,
|
|
725
872
|
args: [{ selector: 'app-artifact-selector', standalone: true, imports: [FormsModule], template: `
|
|
726
873
|
<div class="artifact-selector">
|
|
@@ -757,8 +904,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
757
904
|
type: Output
|
|
758
905
|
}] } });
|
|
759
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
|
+
|
|
760
941
|
class ArtifactComponent extends BaseFormControlComponent {
|
|
761
942
|
objectStoreService = inject(ObjectStoreService);
|
|
943
|
+
dialog = inject(MatDialog);
|
|
762
944
|
artifact() {
|
|
763
945
|
return this.formGroup.get(this.config().attrName)?.value ?? null;
|
|
764
946
|
}
|
|
@@ -773,63 +955,119 @@ class ArtifactComponent extends BaseFormControlComponent {
|
|
|
773
955
|
});
|
|
774
956
|
}
|
|
775
957
|
onArtifactUploaded(artifact) {
|
|
958
|
+
if (this.config().disabled) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
776
961
|
const control = this.formGroup.get(this.config().attrName);
|
|
777
962
|
control?.setValue(artifact);
|
|
778
963
|
control?.markAsDirty();
|
|
779
964
|
control?.markAsTouched();
|
|
780
965
|
}
|
|
781
|
-
|
|
782
|
-
|
|
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() {
|
|
990
|
+
const control = this.formGroup.get(this.config().attrName);
|
|
991
|
+
control?.setValue(null);
|
|
992
|
+
control?.markAsDirty();
|
|
993
|
+
control?.markAsTouched();
|
|
994
|
+
}
|
|
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
|
-
|
|
793
|
-
|
|
794
|
-
|
|
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)" />
|
|
1018
|
+
}
|
|
1019
|
+
</fieldset>
|
|
1020
|
+
</div>
|
|
795
1021
|
}
|
|
796
1022
|
}
|
|
797
|
-
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ArtifactSelectorComponent, selector: "app-artifact-selector", outputs: ["artifactUploaded"] }] });
|
|
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"] }] });
|
|
798
1024
|
}
|
|
799
|
-
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: [{
|
|
800
1026
|
type: Component,
|
|
801
|
-
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: `
|
|
802
1028
|
@if (config().visible) {
|
|
803
1029
|
@if (config().isHeading) {
|
|
804
1030
|
<h3 [id]="config().attrName">{{ value() }}</h3>
|
|
805
1031
|
} @else {
|
|
806
|
-
|
|
807
|
-
<
|
|
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)" />
|
|
1049
|
+
}
|
|
1050
|
+
</fieldset>
|
|
1051
|
+
</div>
|
|
814
1052
|
}
|
|
815
1053
|
}
|
|
816
|
-
|
|
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"] }]
|
|
817
1055
|
}] });
|
|
818
1056
|
|
|
819
1057
|
class LabelComponent extends BaseFormControlComponent {
|
|
820
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
821
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
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"] }] });
|
|
822
1060
|
}
|
|
823
|
-
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: [{
|
|
824
1062
|
type: Component,
|
|
825
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>" }]
|
|
826
1064
|
}] });
|
|
827
1065
|
|
|
828
1066
|
class DatepickerComponent extends BaseFormControlComponent {
|
|
829
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
830
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
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"] }] });
|
|
831
1069
|
}
|
|
832
|
-
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: [{
|
|
833
1071
|
type: Component,
|
|
834
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" }]
|
|
835
1073
|
}] });
|
|
@@ -837,57 +1075,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
837
1075
|
class ForeignKeyComponent extends BaseFormControlComponent {
|
|
838
1076
|
// region event handling methods
|
|
839
1077
|
navigateToRelated() {
|
|
840
|
-
this.
|
|
1078
|
+
const relatedEntityName = this.config().linkedEntityType?.entityName;
|
|
1079
|
+
if (!relatedEntityName)
|
|
1080
|
+
return;
|
|
1081
|
+
this.formNavigator.navigateToRelated(relatedEntityName, this.value());
|
|
841
1082
|
}
|
|
842
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
843
|
-
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"] }] });
|
|
844
1085
|
}
|
|
845
|
-
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: [{
|
|
846
1087
|
type: Component,
|
|
847
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>" }]
|
|
848
1089
|
}] });
|
|
849
1090
|
|
|
850
1091
|
class TextboxComponent extends BaseFormControlComponent {
|
|
851
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
852
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
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"] }] });
|
|
853
1094
|
}
|
|
854
|
-
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: [{
|
|
855
1096
|
type: Component,
|
|
856
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>" }]
|
|
857
1098
|
}] });
|
|
858
1099
|
|
|
859
1100
|
class DropdownComponent extends BaseFormControlComponent {
|
|
860
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
861
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
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"] }] });
|
|
862
1103
|
}
|
|
863
|
-
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: [{
|
|
864
1105
|
type: Component,
|
|
865
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>" }]
|
|
866
1107
|
}] });
|
|
867
1108
|
|
|
868
1109
|
class CheckboxComponent extends BaseFormControlComponent {
|
|
869
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
870
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
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"] }] });
|
|
871
1112
|
}
|
|
872
|
-
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: [{
|
|
873
1114
|
type: Component,
|
|
874
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"] }]
|
|
875
1116
|
}] });
|
|
876
1117
|
|
|
877
1118
|
class RadioComponent extends BaseFormControlComponent {
|
|
878
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
879
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
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"] }] });
|
|
880
1121
|
}
|
|
881
|
-
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: [{
|
|
882
1123
|
type: Component,
|
|
883
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>" }]
|
|
884
1125
|
}] });
|
|
885
1126
|
|
|
886
1127
|
class TextareaComponent extends BaseFormControlComponent {
|
|
887
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
888
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
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"] }] });
|
|
889
1130
|
}
|
|
890
|
-
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: [{
|
|
891
1132
|
type: Component,
|
|
892
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>" }]
|
|
893
1134
|
}] });
|
|
@@ -897,10 +1138,10 @@ class FlexBoxHostDirective {
|
|
|
897
1138
|
constructor(viewContainerRef) {
|
|
898
1139
|
this.viewContainerRef = viewContainerRef;
|
|
899
1140
|
}
|
|
900
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
901
|
-
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 });
|
|
902
1143
|
}
|
|
903
|
-
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: [{
|
|
904
1145
|
type: Directive,
|
|
905
1146
|
args: [{
|
|
906
1147
|
standalone: true,
|
|
@@ -940,10 +1181,10 @@ class FlexBoxComponent extends BaseFormControlComponent {
|
|
|
940
1181
|
throw new Error('Unknown flex direction');
|
|
941
1182
|
}
|
|
942
1183
|
}
|
|
943
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
944
|
-
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"] }] });
|
|
945
1186
|
}
|
|
946
|
-
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: [{
|
|
947
1188
|
type: Component,
|
|
948
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"] }]
|
|
949
1190
|
}], propDecorators: { flexBoxHost: [{
|
|
@@ -987,8 +1228,8 @@ class TagsComponent extends BaseFormControlComponent {
|
|
|
987
1228
|
control?.markAsDirty();
|
|
988
1229
|
control?.markAsTouched();
|
|
989
1230
|
}
|
|
990
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
991
|
-
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: `
|
|
992
1233
|
<ng-container *ngIf="config().visible">
|
|
993
1234
|
<div class="row" [formGroup]="formGroup">
|
|
994
1235
|
<mat-form-field>
|
|
@@ -1009,7 +1250,7 @@ class TagsComponent extends BaseFormControlComponent {
|
|
|
1009
1250
|
</ng-container>
|
|
1010
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"] }] });
|
|
1011
1252
|
}
|
|
1012
|
-
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: [{
|
|
1013
1254
|
type: Component,
|
|
1014
1255
|
args: [{
|
|
1015
1256
|
selector: 'base-tags',
|
|
@@ -1038,28 +1279,237 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
1038
1279
|
}]
|
|
1039
1280
|
}] });
|
|
1040
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
|
+
|
|
1041
1486
|
class BaseEntityFormBuilder {
|
|
1042
1487
|
logger = inject(NGXLogger);
|
|
1043
1488
|
// region public methods
|
|
1044
1489
|
buildForm(viewContainerRef, baseEntityForm, store, attrDescriptors, entity) {
|
|
1045
|
-
this.logger.trace(
|
|
1490
|
+
this.logger.trace('Starting to build form for: ', { attrDescriptors: attrDescriptors });
|
|
1046
1491
|
viewContainerRef.clear();
|
|
1047
1492
|
attrDescriptors.forEach((column) => {
|
|
1048
|
-
this.logger.
|
|
1493
|
+
this.logger.trace('Processing column: ', column.attrName);
|
|
1049
1494
|
const formControlType = this.createFormControl(column);
|
|
1050
1495
|
if (formControlType) {
|
|
1051
|
-
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
1052
|
-
componentRef.instance.config = signal(column, ...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1053
|
-
componentRef.instance.entity = entity;
|
|
1054
|
-
componentRef.instance.formGroup = baseEntityForm;
|
|
1055
|
-
componentRef.instance.store = store;
|
|
1056
1496
|
if (column instanceof BaseEntityAttrDescriptor) {
|
|
1057
1497
|
const currentAttrValue = Reflect.get(entity(), column.attrName);
|
|
1058
|
-
|
|
1059
|
-
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);
|
|
1060
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;
|
|
1061
1506
|
}
|
|
1062
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;
|
|
1063
1513
|
this.buildForm(componentRef.instance.flexBoxHost.viewContainerRef, baseEntityForm, store, column.attrDescriptors, entity);
|
|
1064
1514
|
}
|
|
1065
1515
|
else
|
|
@@ -1076,6 +1526,9 @@ class BaseEntityFormBuilder {
|
|
|
1076
1526
|
else if (column.formControlType === FormControlType.CHECKBOX) {
|
|
1077
1527
|
return CheckboxComponent;
|
|
1078
1528
|
}
|
|
1529
|
+
else if (column.formControlType === FormControlType.COMPONENTS) {
|
|
1530
|
+
return EntityComponentsListComponent;
|
|
1531
|
+
}
|
|
1079
1532
|
else if (column.formControlType === FormControlType.DATE) {
|
|
1080
1533
|
return DatepickerComponent;
|
|
1081
1534
|
}
|
|
@@ -1106,10 +1559,10 @@ class BaseEntityFormBuilder {
|
|
|
1106
1559
|
else
|
|
1107
1560
|
throw Error('Undefined form control type');
|
|
1108
1561
|
}
|
|
1109
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1110
|
-
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' });
|
|
1111
1564
|
}
|
|
1112
|
-
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: [{
|
|
1113
1566
|
type: Injectable,
|
|
1114
1567
|
args: [{ providedIn: 'root' }]
|
|
1115
1568
|
}] });
|
|
@@ -1123,6 +1576,7 @@ class BaseEntityFormComponent {
|
|
|
1123
1576
|
store = computed(() => this.entityDescriptor().store, ...(ngDevMode ? [{ debugName: "store" }] : /* istanbul ignore next */ []));
|
|
1124
1577
|
entityFormBuilder = inject((BaseEntityFormBuilder));
|
|
1125
1578
|
formBuilder = inject(FormBuilder);
|
|
1579
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
1126
1580
|
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : /* istanbul ignore next */ []));
|
|
1127
1581
|
logger = inject(NGXLogger);
|
|
1128
1582
|
constructor() {
|
|
@@ -1130,15 +1584,16 @@ class BaseEntityFormComponent {
|
|
|
1130
1584
|
}
|
|
1131
1585
|
// region angular lifecycle hooks
|
|
1132
1586
|
ngOnInit() {
|
|
1133
|
-
this.
|
|
1587
|
+
this.formNavigator.setEntityName(this.entityDescriptor().entityName);
|
|
1588
|
+
this.formNavigator.determineActiveRouteSegment();
|
|
1134
1589
|
this.baseEntityForm = this.formBuilder.group({});
|
|
1135
|
-
this.logger.info('BaseEntityFormComponent initialized with:', { entityDescriptor: this.entityDescriptor() });
|
|
1590
|
+
this.logger.info('BaseEntityFormComponent initialized with: ', { entityDescriptor: this.entityDescriptor() });
|
|
1136
1591
|
}
|
|
1137
1592
|
// endregion
|
|
1138
1593
|
// region event handlers
|
|
1139
1594
|
async onCancel() {
|
|
1140
1595
|
this.store().setCurrentEntity(undefined);
|
|
1141
|
-
await this.
|
|
1596
|
+
await this.formNavigator.navigateBack();
|
|
1142
1597
|
}
|
|
1143
1598
|
async onSubmit() {
|
|
1144
1599
|
const objectToSave = { ...this.entity(), ...this.baseEntityForm.value };
|
|
@@ -1149,7 +1604,7 @@ class BaseEntityFormComponent {
|
|
|
1149
1604
|
this.store().update(objectToSave, objectToSave.id);
|
|
1150
1605
|
}
|
|
1151
1606
|
this.store().setCurrentEntity(undefined);
|
|
1152
|
-
await this.
|
|
1607
|
+
await this.formNavigator.navigateBack();
|
|
1153
1608
|
}
|
|
1154
1609
|
// endregion
|
|
1155
1610
|
// region protected, private helper methods
|
|
@@ -1165,10 +1620,10 @@ class BaseEntityFormComponent {
|
|
|
1165
1620
|
this.store().setCurrentEntity(this.entity().id);
|
|
1166
1621
|
});
|
|
1167
1622
|
}
|
|
1168
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
1169
|
-
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"] }] });
|
|
1170
1625
|
}
|
|
1171
|
-
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: [{
|
|
1172
1627
|
type: Component,
|
|
1173
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" }]
|
|
1174
1629
|
}], ctorParameters: () => [], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }], componentHost: [{
|
|
@@ -1188,12 +1643,36 @@ function filterAttributeDescriptors(descriptors) {
|
|
|
1188
1643
|
return attrDescriptors;
|
|
1189
1644
|
}
|
|
1190
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
|
+
|
|
1191
1669
|
const BASE_LIST_DESCRIPTORS = new InjectionToken('BASE_TABLE_DISPLAYED_COLUMNS');
|
|
1192
1670
|
class BaseEntityListComponent {
|
|
1193
1671
|
dataSource = new MatTableDataSource();
|
|
1194
1672
|
selection = new SelectionModel(true, []);
|
|
1195
1673
|
entityDescriptor = inject(ROUTER_OUTLET_DATA);
|
|
1196
1674
|
logger = inject(NGXLogger);
|
|
1675
|
+
formNavigator = inject(BaseFormNavigatorSingletonStore);
|
|
1197
1676
|
objectStoreService = inject(ObjectStoreService);
|
|
1198
1677
|
columnDescriptors = computed(() => {
|
|
1199
1678
|
return filterAttributeDescriptors(this.entityDescriptor().attrDescriptors);
|
|
@@ -1208,7 +1687,7 @@ class BaseEntityListComponent {
|
|
|
1208
1687
|
sort = {};
|
|
1209
1688
|
paginator = {};
|
|
1210
1689
|
store;
|
|
1211
|
-
|
|
1690
|
+
selectOrCreateMode = false;
|
|
1212
1691
|
constructor() {
|
|
1213
1692
|
this.store = this.entityDescriptor().store;
|
|
1214
1693
|
this.registerEffects();
|
|
@@ -1221,7 +1700,10 @@ class BaseEntityListComponent {
|
|
|
1221
1700
|
this.loadAllData();
|
|
1222
1701
|
}
|
|
1223
1702
|
ngOnInit() {
|
|
1224
|
-
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;
|
|
1225
1707
|
this.logger.info('BaseEntityListComponent initialized with:', { columnDescriptors: this.columnDescriptors() });
|
|
1226
1708
|
}
|
|
1227
1709
|
// endregion
|
|
@@ -1237,11 +1719,14 @@ class BaseEntityListComponent {
|
|
|
1237
1719
|
this.store.clearCurrentEntity();
|
|
1238
1720
|
}
|
|
1239
1721
|
onNavigateToDetails(entity) {
|
|
1240
|
-
this.
|
|
1722
|
+
this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, entity.id);
|
|
1241
1723
|
this.store.setCurrentEntity(entity.id);
|
|
1242
1724
|
}
|
|
1243
1725
|
onNavigateToRelated(config, entity) {
|
|
1244
|
-
|
|
1726
|
+
const relatedEntityName = config.linkedEntityType?.entityName;
|
|
1727
|
+
if (!relatedEntityName)
|
|
1728
|
+
return;
|
|
1729
|
+
this.formNavigator.navigateToRelated(relatedEntityName, this.getPropertyValue(entity, config.attrName));
|
|
1245
1730
|
}
|
|
1246
1731
|
onRowClick(entity) {
|
|
1247
1732
|
this.selection.toggle(entity);
|
|
@@ -1278,6 +1763,16 @@ class BaseEntityListComponent {
|
|
|
1278
1763
|
});
|
|
1279
1764
|
}
|
|
1280
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
|
+
}
|
|
1281
1776
|
// endregion
|
|
1282
1777
|
// region protected, private helper methods
|
|
1283
1778
|
cancelSelections() {
|
|
@@ -1312,10 +1807,13 @@ class BaseEntityListComponent {
|
|
|
1312
1807
|
isSelected(row) {
|
|
1313
1808
|
return this.selection.isSelected(row);
|
|
1314
1809
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
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" }] });
|
|
1317
1815
|
}
|
|
1318
|
-
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: [{
|
|
1319
1817
|
type: Component,
|
|
1320
1818
|
args: [{ selector: 'base-list', standalone: true, imports: [
|
|
1321
1819
|
MatTable,
|
|
@@ -1334,7 +1832,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
1334
1832
|
MatProgressBar,
|
|
1335
1833
|
MatCheckbox,
|
|
1336
1834
|
SlicePipe,
|
|
1337
|
-
|
|
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"] }]
|
|
1338
1837
|
}], ctorParameters: () => [], propDecorators: { sort: [{
|
|
1339
1838
|
type: ViewChild,
|
|
1340
1839
|
args: [MatSort]
|
|
@@ -1349,6 +1848,14 @@ var OrderByDirection;
|
|
|
1349
1848
|
OrderByDirection["DESC"] = "desc";
|
|
1350
1849
|
})(OrderByDirection || (OrderByDirection = {}));
|
|
1351
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
|
+
|
|
1352
1859
|
const INITIAL_TABS_STATE = {
|
|
1353
1860
|
activeTabs: [],
|
|
1354
1861
|
currentTab: undefined,
|
|
@@ -1476,7 +1983,7 @@ function BaseEntityStore(entityType, repositoryType) {
|
|
|
1476
1983
|
isLoading: false,
|
|
1477
1984
|
error: undefined,
|
|
1478
1985
|
selectedEntities: [],
|
|
1479
|
-
}), withMethods((store, repository = inject(repositoryType)) => ({
|
|
1986
|
+
}), withDevtools('base-entity'), withMethods((store, repository = inject(repositoryType)) => ({
|
|
1480
1987
|
clearCurrentEntity: () => patchState(store, { currentEntity: undefined }),
|
|
1481
1988
|
createEntity: () => new entityType(),
|
|
1482
1989
|
add: addEntity(store, repository),
|
|
@@ -1718,7 +2225,7 @@ function getEntityIds(instance) {
|
|
|
1718
2225
|
|
|
1719
2226
|
const BASE_ENTITY_ROUTES = [
|
|
1720
2227
|
{ path: '', redirectTo: 'list', pathMatch: 'full' },
|
|
1721
|
-
{ path: ':
|
|
2228
|
+
{ path: ':' + BaseUrlSegments.EntityID + '/details', component: BaseEntityFormComponent },
|
|
1722
2229
|
{ path: 'list', component: BaseEntityListComponent },
|
|
1723
2230
|
];
|
|
1724
2231
|
|
|
@@ -1728,5 +2235,5 @@ const BASE_ENTITY_ROUTES = [
|
|
|
1728
2235
|
* Generated bundle index. Do not edit.
|
|
1729
2236
|
*/
|
|
1730
2237
|
|
|
1731
|
-
export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorStore, Entity, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, getEntityIds, getEntityOptions };
|
|
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 };
|
|
1732
2239
|
//# sourceMappingURL=processpuzzle-base-entity.mjs.map
|