@processpuzzle/base-entity 0.3.7 → 0.4.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,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, Component, computed, effect, Inject, Directive, ViewChild, signal,
|
|
2
|
+
import { inject, input, Component, computed, effect, Inject, Directive, Injectable, EventEmitter, Output, ViewChild, signal, 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,
|
|
5
|
+
import { CommonModule, NgStyle, NgIf, NgClass, NgForOf, SlicePipe } from '@angular/common';
|
|
6
6
|
import { 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';
|
|
@@ -13,7 +13,7 @@ import { MatFormField, MatFormFieldModule, MatLabel, MAT_FORM_FIELD_DEFAULT_OPTI
|
|
|
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 { signalStoreFeature, withState, withMethods, patchState, withHooks, withComputed } from '@ngrx/signals';
|
|
16
|
+
import { signalStoreFeature, withState, withMethods, patchState, withHooks, watchState, withComputed } from '@ngrx/signals';
|
|
17
17
|
import { LayoutService, RUNTIME_CONFIGURATION } from '@processpuzzle/util';
|
|
18
18
|
import { __decorate, __param } from 'tslib';
|
|
19
19
|
import { map, pipe, switchMap, tap, from, of } from 'rxjs';
|
|
@@ -27,6 +27,8 @@ import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
|
27
27
|
import * as i2 from '@angular/material/select';
|
|
28
28
|
import { MatSelectModule } from '@angular/material/select';
|
|
29
29
|
import { MatCheckbox } from '@angular/material/checkbox';
|
|
30
|
+
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
31
|
+
import { MatChipGrid, MatChipRow, MatChipInput, MatChipRemove } from '@angular/material/chips';
|
|
30
32
|
import { NGXLogger } from 'ngx-logging-kit';
|
|
31
33
|
import { MatTableDataSource, MatTable, MatHeaderCell, MatHeaderRow, MatRow, MatCell, MatColumnDef, MatHeaderCellDef, MatCellDef, MatHeaderRowDef, MatRowDef } from '@angular/material/table';
|
|
32
34
|
import { MatSort, MatSortHeader } from '@angular/material/sort';
|
|
@@ -40,6 +42,7 @@ import 'reflect-metadata';
|
|
|
40
42
|
|
|
41
43
|
var FormControlType;
|
|
42
44
|
(function (FormControlType) {
|
|
45
|
+
FormControlType["ARTIFACT"] = "ARTIFACT";
|
|
43
46
|
FormControlType["CHECKBOX"] = "CHECKBOX";
|
|
44
47
|
FormControlType["DATE"] = "DATE";
|
|
45
48
|
FormControlType["DROPDOWN"] = "DROPDOWN";
|
|
@@ -47,6 +50,7 @@ var FormControlType;
|
|
|
47
50
|
FormControlType["FOREIGN_KEY"] = "FOREIGN_KEY";
|
|
48
51
|
FormControlType["LABEL"] = "LABEL";
|
|
49
52
|
FormControlType["RADIO"] = "RADIO";
|
|
53
|
+
FormControlType["TAGS"] = "TAGS";
|
|
50
54
|
FormControlType["TITLE"] = "TITLE";
|
|
51
55
|
FormControlType["TEXT_BOX"] = "TEXT_BOX";
|
|
52
56
|
FormControlType["TEXTAREA"] = "TEXTAREA";
|
|
@@ -170,12 +174,12 @@ function BaseFormNavigatorStore(entityName) {
|
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
class BaseEntityToolbarComponent {
|
|
173
|
-
|
|
177
|
+
entityDescriptor = input.required(...(ngDevMode ? [{ debugName: "entityDescriptor" }] : /* istanbul ignore next */ []));
|
|
174
178
|
layoutService = inject(LayoutService);
|
|
175
179
|
store;
|
|
176
180
|
// region Angular lifecycle hooks
|
|
177
181
|
ngOnInit() {
|
|
178
|
-
this.store = this.
|
|
182
|
+
this.store = this.entityDescriptor().store;
|
|
179
183
|
}
|
|
180
184
|
// endregion
|
|
181
185
|
// event handling methods
|
|
@@ -197,22 +201,22 @@ class BaseEntityToolbarComponent {
|
|
|
197
201
|
// endregion
|
|
198
202
|
// protected, private helper methods
|
|
199
203
|
RouteSegments = RouteSegments;
|
|
200
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
201
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
204
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
205
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", 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=\"store.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input test-id=\"filter-input\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\n </mat-form-field>\n </div>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu test-id=\"menu\" #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button test-id=\"add\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-menu-item [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"add\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }] });
|
|
202
206
|
}
|
|
203
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
|
|
204
208
|
type: Component,
|
|
205
209
|
args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbar, MatIcon, MatFormField, MatInput, MatButton, MatMenu, MatMenuItem, MatMenuTrigger], template: "<mat-toolbar *ngIf=\"store.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input test-id=\"filter-input\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\n </mat-form-field>\n </div>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu test-id=\"menu\" #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button test-id=\"add\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-menu-item [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"add\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>" }]
|
|
206
|
-
}], propDecorators: {
|
|
210
|
+
}], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
207
211
|
|
|
208
212
|
class BaseEntityStatusbarComponent {
|
|
209
213
|
store;
|
|
210
|
-
|
|
211
|
-
entityTitle = computed(() => this.evaluateEntityTitle(this.
|
|
214
|
+
entityDescriptor = input.required(...(ngDevMode ? [{ debugName: "entityDescriptor" }] : /* istanbul ignore next */ []));
|
|
215
|
+
entityTitle = computed(() => this.evaluateEntityTitle(this.entityDescriptor().entityTitle), ...(ngDevMode ? [{ debugName: "entityTitle" }] : /* istanbul ignore next */ []));
|
|
212
216
|
isVisible = computed(() => this.store.currentEntity() != undefined || this.store.selectedEntities().length == 1, ...(ngDevMode ? [{ debugName: "isVisible" }] : /* istanbul ignore next */ []));
|
|
213
217
|
// region Angular lifecycle hooks
|
|
214
218
|
ngOnInit() {
|
|
215
|
-
this.store = this.
|
|
219
|
+
this.store = this.entityDescriptor().store;
|
|
216
220
|
}
|
|
217
221
|
// endregion
|
|
218
222
|
// event handling methods
|
|
@@ -222,20 +226,20 @@ class BaseEntityStatusbarComponent {
|
|
|
222
226
|
const fn = new Function('ctx', 'return ' + title.replace(/this\./g, 'ctx.'));
|
|
223
227
|
return fn(this);
|
|
224
228
|
}
|
|
225
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
226
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
229
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityStatusbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
230
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.10", 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"] }] });
|
|
227
231
|
}
|
|
228
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
232
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityStatusbarComponent, decorators: [{
|
|
229
233
|
type: Component,
|
|
230
234
|
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>" }]
|
|
231
|
-
}], propDecorators: {
|
|
235
|
+
}], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
232
236
|
|
|
233
237
|
class BaseEntityTabsComponent {
|
|
234
238
|
store;
|
|
235
|
-
|
|
239
|
+
entityDescriptor = input.required(...(ngDevMode ? [{ debugName: "entityDescriptor" }] : /* istanbul ignore next */ []));
|
|
236
240
|
selectedEntityId = computed(() => (this.store.currentId() ? this.store.currentId() : BaseUrlSegments.NewEntity), ...(ngDevMode ? [{ debugName: "selectedEntityId" }] : /* istanbul ignore next */ []));
|
|
237
|
-
detailsTabName = computed(() => this.
|
|
238
|
-
listTabName = computed(() => this.
|
|
241
|
+
detailsTabName = computed(() => this.entityDescriptor().entityName + ' - details', ...(ngDevMode ? [{ debugName: "detailsTabName" }] : /* istanbul ignore next */ []));
|
|
242
|
+
listTabName = computed(() => this.entityDescriptor().entityName + ' - list', ...(ngDevMode ? [{ debugName: "listTabName" }] : /* istanbul ignore next */ []));
|
|
239
243
|
constructor() {
|
|
240
244
|
this.registerEffects();
|
|
241
245
|
}
|
|
@@ -245,7 +249,7 @@ class BaseEntityTabsComponent {
|
|
|
245
249
|
this.store.tabIsInactive(this.detailsTabName());
|
|
246
250
|
}
|
|
247
251
|
ngOnInit() {
|
|
248
|
-
this.store = this.
|
|
252
|
+
this.store = this.entityDescriptor().store;
|
|
249
253
|
}
|
|
250
254
|
// endregion
|
|
251
255
|
// region event handlers
|
|
@@ -258,7 +262,7 @@ class BaseEntityTabsComponent {
|
|
|
258
262
|
}
|
|
259
263
|
async onShowList() {
|
|
260
264
|
if (this.store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
261
|
-
await this.store.navigateToList(this.
|
|
265
|
+
await this.store.navigateToList(this.entityDescriptor().entityName);
|
|
262
266
|
this.store.tabIsActive(this.listTabName());
|
|
263
267
|
}
|
|
264
268
|
}
|
|
@@ -274,21 +278,21 @@ class BaseEntityTabsComponent {
|
|
|
274
278
|
}
|
|
275
279
|
});
|
|
276
280
|
}
|
|
277
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
278
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
281
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
282
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.10", type: BaseEntityTabsComponent, isStandalone: true, selector: "base-entity-tabs", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
279
283
|
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
|
|
280
284
|
<a mat-tab-link (click)="onShowList()" [active]="store.currentTab() === listTabName()">{{ listTabName() }}</a>
|
|
281
285
|
<a mat-tab-link [disabled]="store.currentEntity() === undefined" (click)="onShowDetails()" [active]="store.currentTab() === detailsTabName()">{{ detailsTabName() }}</a>
|
|
282
286
|
</nav>
|
|
283
287
|
|
|
284
288
|
<mat-tab-nav-panel #tabPanel>
|
|
285
|
-
<base-entity-statusbar [
|
|
286
|
-
<base-entity-toolbar [
|
|
287
|
-
<router-outlet [routerOutletData]="
|
|
289
|
+
<base-entity-statusbar [entityDescriptor]="entityDescriptor()" />
|
|
290
|
+
<base-entity-toolbar [entityDescriptor]="entityDescriptor()" />
|
|
291
|
+
<router-outlet [routerOutletData]="entityDescriptor()" />
|
|
288
292
|
</mat-tab-nav-panel>
|
|
289
|
-
`, 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: ["
|
|
293
|
+
`, 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"] }] });
|
|
290
294
|
}
|
|
291
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityTabsComponent, decorators: [{
|
|
292
296
|
type: Component,
|
|
293
297
|
args: [{
|
|
294
298
|
selector: 'base-entity-tabs',
|
|
@@ -301,16 +305,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
301
305
|
</nav>
|
|
302
306
|
|
|
303
307
|
<mat-tab-nav-panel #tabPanel>
|
|
304
|
-
<base-entity-statusbar [
|
|
305
|
-
<base-entity-toolbar [
|
|
306
|
-
<router-outlet [routerOutletData]="
|
|
308
|
+
<base-entity-statusbar [entityDescriptor]="entityDescriptor()" />
|
|
309
|
+
<base-entity-toolbar [entityDescriptor]="entityDescriptor()" />
|
|
310
|
+
<router-outlet [routerOutletData]="entityDescriptor()" />
|
|
307
311
|
</mat-tab-nav-panel>
|
|
308
312
|
`,
|
|
309
313
|
}]
|
|
310
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
314
|
+
}], ctorParameters: () => [], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
311
315
|
|
|
312
316
|
class BaseEntityContainerComponent {
|
|
313
|
-
|
|
317
|
+
entityDescriptor = input.required(...(ngDevMode ? [{ debugName: "entityDescriptor" }] : /* istanbul ignore next */ []));
|
|
314
318
|
snackBar = inject(MatSnackBar);
|
|
315
319
|
store;
|
|
316
320
|
constructor() {
|
|
@@ -321,7 +325,7 @@ class BaseEntityContainerComponent {
|
|
|
321
325
|
this.store.reset();
|
|
322
326
|
}
|
|
323
327
|
ngOnInit() {
|
|
324
|
-
this.store = this.
|
|
328
|
+
this.store = this.entityDescriptor().store;
|
|
325
329
|
}
|
|
326
330
|
// endregion
|
|
327
331
|
// region protected, private helper methods
|
|
@@ -333,14 +337,14 @@ class BaseEntityContainerComponent {
|
|
|
333
337
|
}
|
|
334
338
|
});
|
|
335
339
|
}
|
|
336
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
337
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
340
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
341
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.10", type: BaseEntityContainerComponent, isStandalone: true, selector: "base-entity-container", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
338
342
|
<div>
|
|
339
|
-
<base-entity-tabs [
|
|
343
|
+
<base-entity-tabs [entityDescriptor]="entityDescriptor()"></base-entity-tabs>
|
|
340
344
|
</div>
|
|
341
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BaseEntityTabsComponent, selector: "base-entity-tabs", inputs: ["
|
|
345
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BaseEntityTabsComponent, selector: "base-entity-tabs", inputs: ["entityDescriptor"] }] });
|
|
342
346
|
}
|
|
343
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityContainerComponent, decorators: [{
|
|
344
348
|
type: Component,
|
|
345
349
|
args: [{
|
|
346
350
|
selector: 'base-entity-container',
|
|
@@ -348,11 +352,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
348
352
|
imports: [CommonModule, BaseEntityTabsComponent],
|
|
349
353
|
template: `
|
|
350
354
|
<div>
|
|
351
|
-
<base-entity-tabs [
|
|
355
|
+
<base-entity-tabs [entityDescriptor]="entityDescriptor()"></base-entity-tabs>
|
|
352
356
|
</div>
|
|
353
357
|
`,
|
|
354
358
|
}]
|
|
355
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
359
|
+
}], ctorParameters: () => [], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
|
|
356
360
|
|
|
357
361
|
const INITIAL_CONTAINER_STATE = {
|
|
358
362
|
filterKey: undefined,
|
|
@@ -539,10 +543,10 @@ class BaseFormHostDirective {
|
|
|
539
543
|
constructor(viewContainerRef) {
|
|
540
544
|
this.viewContainerRef = viewContainerRef;
|
|
541
545
|
}
|
|
542
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
543
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.
|
|
546
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseFormHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
547
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.10", type: BaseFormHostDirective, isStandalone: true, selector: "[baseFormHost]", ngImport: i0 });
|
|
544
548
|
}
|
|
545
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
549
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseFormHostDirective, decorators: [{
|
|
546
550
|
type: Directive,
|
|
547
551
|
args: [{
|
|
548
552
|
standalone: true,
|
|
@@ -557,10 +561,10 @@ class BaseFormControlComponent {
|
|
|
557
561
|
store;
|
|
558
562
|
style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
|
|
559
563
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
560
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
561
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
564
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseFormControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
565
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.10", 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 }] });
|
|
562
566
|
}
|
|
563
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
567
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseFormControlComponent, decorators: [{
|
|
564
568
|
type: Component,
|
|
565
569
|
args: [{
|
|
566
570
|
standalone: true,
|
|
@@ -569,20 +573,267 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
569
573
|
}]
|
|
570
574
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
|
|
571
575
|
|
|
576
|
+
class ObjectStoreService {
|
|
577
|
+
runtimeConfiguration = inject(RUNTIME_CONFIGURATION);
|
|
578
|
+
httpClient = inject(HttpClient);
|
|
579
|
+
baseUrl = this.resolveBaseUrl();
|
|
580
|
+
uploadObject(file, name, mimeType) {
|
|
581
|
+
const formData = new FormData();
|
|
582
|
+
formData.append('file', file, name);
|
|
583
|
+
formData.append('name', name);
|
|
584
|
+
formData.append('mimeType', mimeType);
|
|
585
|
+
return this.httpClient.post(this.buildFullUrl('/objects'), formData, { observe: 'response' }).pipe(map((response) => {
|
|
586
|
+
if (!response.body)
|
|
587
|
+
throw new Error('Object store upload response body is missing');
|
|
588
|
+
return {
|
|
589
|
+
...response.body,
|
|
590
|
+
bucketName: response.headers.get('Location') ?? undefined,
|
|
591
|
+
};
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
getObjectByID(bucketName, objectID) {
|
|
595
|
+
const path = `/objects/${encodeURIComponent(bucketName)}/${encodeURIComponent(objectID)}`;
|
|
596
|
+
return this.httpClient.get(this.buildFullUrl(path), { observe: 'response', responseType: 'blob' }).pipe(map((response) => ({
|
|
597
|
+
data: response.body ?? new Blob(),
|
|
598
|
+
fileName: response.headers.get('X-Object-Name') ?? undefined,
|
|
599
|
+
bucketName: response.headers.get('X-Object-Bucket') ?? undefined,
|
|
600
|
+
})));
|
|
601
|
+
}
|
|
602
|
+
deleteObjectByID(bucketName, objectID) {
|
|
603
|
+
const path = `/objects/${encodeURIComponent(bucketName)}/${encodeURIComponent(objectID)}`;
|
|
604
|
+
return this.httpClient.delete(this.buildFullUrl(path));
|
|
605
|
+
}
|
|
606
|
+
getObjectUriByID(bucketName, objectID) {
|
|
607
|
+
const path = `/objects/${encodeURIComponent(bucketName)}/${encodeURIComponent(objectID)}/uri`;
|
|
608
|
+
return this.httpClient.get(this.buildFullUrl(path));
|
|
609
|
+
}
|
|
610
|
+
buildFullUrl(path) {
|
|
611
|
+
return buildUrl(this.baseUrl, { path });
|
|
612
|
+
}
|
|
613
|
+
resolveBaseUrl() {
|
|
614
|
+
const baseConfiguration = Reflect.get(this.runtimeConfiguration, 'BASE_CONFIGURATION');
|
|
615
|
+
return Reflect.get(baseConfiguration, 'OBJECT_STORE_SERVICE_ROOT') ?? Reflect.get(baseConfiguration, 'BACKEND_SERVICE_ROOT') ?? '';
|
|
616
|
+
}
|
|
617
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: ObjectStoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
618
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: ObjectStoreService, providedIn: 'root' });
|
|
619
|
+
}
|
|
620
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: ObjectStoreService, decorators: [{
|
|
621
|
+
type: Injectable,
|
|
622
|
+
args: [{ providedIn: 'root' }]
|
|
623
|
+
}] });
|
|
624
|
+
|
|
625
|
+
class ArtifactSelectorComponent {
|
|
626
|
+
objectStoreService = inject(ObjectStoreService);
|
|
627
|
+
artifactUploaded = new EventEmitter();
|
|
628
|
+
isSelectorVisible = false;
|
|
629
|
+
isUploading = false;
|
|
630
|
+
artifactName = '';
|
|
631
|
+
mimeType = '';
|
|
632
|
+
errorMessage = '';
|
|
633
|
+
selectedFile = null;
|
|
634
|
+
showSelector() {
|
|
635
|
+
this.isSelectorVisible = true;
|
|
636
|
+
}
|
|
637
|
+
onFileSelected(event) {
|
|
638
|
+
const input = event.target;
|
|
639
|
+
const file = input.files?.item(0);
|
|
640
|
+
if (!file) {
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
this.selectedFile = file;
|
|
644
|
+
this.errorMessage = '';
|
|
645
|
+
this.artifactName = file.name;
|
|
646
|
+
this.mimeType = file.type || this.deriveMimeType(file.name);
|
|
647
|
+
this.uploadSelectedFile();
|
|
648
|
+
}
|
|
649
|
+
uploadSelectedFile() {
|
|
650
|
+
if (!this.selectedFile || !this.artifactName || !this.mimeType || this.isUploading) {
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
this.isUploading = true;
|
|
654
|
+
this.objectStoreService.uploadObject(this.selectedFile, this.artifactName, this.mimeType).subscribe({
|
|
655
|
+
next: (response) => {
|
|
656
|
+
const artifact = {
|
|
657
|
+
bucket: response.bucketName ?? '',
|
|
658
|
+
objectId: response.objectID,
|
|
659
|
+
name: response.fileName || this.artifactName,
|
|
660
|
+
mimeType: response.mimeType || this.mimeType,
|
|
661
|
+
};
|
|
662
|
+
this.artifactUploaded.emit(artifact);
|
|
663
|
+
this.selectedFile = null;
|
|
664
|
+
this.isUploading = false;
|
|
665
|
+
},
|
|
666
|
+
error: () => {
|
|
667
|
+
this.isUploading = false;
|
|
668
|
+
this.errorMessage = 'Artifact upload failed.';
|
|
669
|
+
},
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
deriveMimeType(fileName) {
|
|
673
|
+
const extension = fileName.split('.').pop()?.toLowerCase() ?? '';
|
|
674
|
+
const mimeTypeByExtension = {
|
|
675
|
+
csv: 'text/csv',
|
|
676
|
+
gif: 'image/gif',
|
|
677
|
+
jpeg: 'image/jpeg',
|
|
678
|
+
jpg: 'image/jpeg',
|
|
679
|
+
json: 'application/json',
|
|
680
|
+
pdf: 'application/pdf',
|
|
681
|
+
png: 'image/png',
|
|
682
|
+
svg: 'image/svg+xml',
|
|
683
|
+
txt: 'text/plain',
|
|
684
|
+
xml: 'application/xml',
|
|
685
|
+
zip: 'application/zip',
|
|
686
|
+
};
|
|
687
|
+
return mimeTypeByExtension[extension] ?? 'application/octet-stream';
|
|
688
|
+
}
|
|
689
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: ArtifactSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
690
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", type: ArtifactSelectorComponent, isStandalone: true, selector: "app-artifact-selector", outputs: { artifactUploaded: "artifactUploaded" }, ngImport: i0, template: `
|
|
691
|
+
<div class="artifact-selector">
|
|
692
|
+
@if (!isSelectorVisible) {
|
|
693
|
+
<button type="button" (click)="showSelector()">Upload file</button>
|
|
694
|
+
} @else {
|
|
695
|
+
<div class="artifact-selector__inputs">
|
|
696
|
+
<input type="file" (change)="onFileSelected($event)" />
|
|
697
|
+
<input
|
|
698
|
+
type="text"
|
|
699
|
+
[(ngModel)]="artifactName"
|
|
700
|
+
placeholder="Artifact name"
|
|
701
|
+
[disabled]="isUploading"
|
|
702
|
+
/>
|
|
703
|
+
<input
|
|
704
|
+
type="text"
|
|
705
|
+
[(ngModel)]="mimeType"
|
|
706
|
+
placeholder="MIME type"
|
|
707
|
+
[disabled]="isUploading"
|
|
708
|
+
/>
|
|
709
|
+
</div>
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
@if (isUploading) {
|
|
713
|
+
<p>Uploading...</p>
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
@if (errorMessage) {
|
|
717
|
+
<p>{{ errorMessage }}</p>
|
|
718
|
+
}
|
|
719
|
+
</div>
|
|
720
|
+
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
721
|
+
}
|
|
722
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: ArtifactSelectorComponent, decorators: [{
|
|
723
|
+
type: Component,
|
|
724
|
+
args: [{ selector: 'app-artifact-selector', standalone: true, imports: [FormsModule], template: `
|
|
725
|
+
<div class="artifact-selector">
|
|
726
|
+
@if (!isSelectorVisible) {
|
|
727
|
+
<button type="button" (click)="showSelector()">Upload file</button>
|
|
728
|
+
} @else {
|
|
729
|
+
<div class="artifact-selector__inputs">
|
|
730
|
+
<input type="file" (change)="onFileSelected($event)" />
|
|
731
|
+
<input
|
|
732
|
+
type="text"
|
|
733
|
+
[(ngModel)]="artifactName"
|
|
734
|
+
placeholder="Artifact name"
|
|
735
|
+
[disabled]="isUploading"
|
|
736
|
+
/>
|
|
737
|
+
<input
|
|
738
|
+
type="text"
|
|
739
|
+
[(ngModel)]="mimeType"
|
|
740
|
+
placeholder="MIME type"
|
|
741
|
+
[disabled]="isUploading"
|
|
742
|
+
/>
|
|
743
|
+
</div>
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
@if (isUploading) {
|
|
747
|
+
<p>Uploading...</p>
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
@if (errorMessage) {
|
|
751
|
+
<p>{{ errorMessage }}</p>
|
|
752
|
+
}
|
|
753
|
+
</div>
|
|
754
|
+
` }]
|
|
755
|
+
}], propDecorators: { artifactUploaded: [{
|
|
756
|
+
type: Output
|
|
757
|
+
}] } });
|
|
758
|
+
|
|
759
|
+
class ArtifactComponent extends BaseFormControlComponent {
|
|
760
|
+
objectStoreService = inject(ObjectStoreService);
|
|
761
|
+
artifacts() {
|
|
762
|
+
const value = this.formGroup.get(this.config().attrName)?.value;
|
|
763
|
+
return Array.isArray(value) ? value : [];
|
|
764
|
+
}
|
|
765
|
+
openArtifact(event, artifact) {
|
|
766
|
+
event.preventDefault();
|
|
767
|
+
this.objectStoreService.getObjectUriByID(artifact.bucket, artifact.objectId).subscribe({
|
|
768
|
+
next: ({ uri }) => {
|
|
769
|
+
if (uri) {
|
|
770
|
+
window.open(uri, '_blank', 'noopener,noreferrer');
|
|
771
|
+
}
|
|
772
|
+
},
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
onArtifactUploaded(artifact) {
|
|
776
|
+
const control = this.formGroup.get(this.config().attrName);
|
|
777
|
+
control?.setValue([...this.artifacts(), artifact]);
|
|
778
|
+
control?.markAsDirty();
|
|
779
|
+
control?.markAsTouched();
|
|
780
|
+
}
|
|
781
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: ArtifactComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
782
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", type: ArtifactComponent, isStandalone: true, selector: "app-artifact", usesInheritance: true, ngImport: i0, template: `
|
|
783
|
+
@if (config().visible) {
|
|
784
|
+
@if (config().isHeading) {
|
|
785
|
+
<h3 [id]="config().attrName">{{ value() }}</h3>
|
|
786
|
+
} @else {
|
|
787
|
+
@if (artifacts().length) {
|
|
788
|
+
<ul [id]="config().attrName" [ngStyle]="config().style">
|
|
789
|
+
@for (artifact of artifacts(); track artifact.objectId) {
|
|
790
|
+
<li>
|
|
791
|
+
<a href="" (click)="openArtifact($event, artifact)">{{ artifact.name }}</a>
|
|
792
|
+
</li>
|
|
793
|
+
}
|
|
794
|
+
</ul>
|
|
795
|
+
}
|
|
796
|
+
<app-artifact-selector (artifactUploaded)="onArtifactUploaded($event)" />
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ArtifactSelectorComponent, selector: "app-artifact-selector", outputs: ["artifactUploaded"] }] });
|
|
800
|
+
}
|
|
801
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: ArtifactComponent, decorators: [{
|
|
802
|
+
type: Component,
|
|
803
|
+
args: [{ selector: 'app-artifact', standalone: true, imports: [FormsModule, ReactiveFormsModule, NgStyle, ArtifactSelectorComponent], template: `
|
|
804
|
+
@if (config().visible) {
|
|
805
|
+
@if (config().isHeading) {
|
|
806
|
+
<h3 [id]="config().attrName">{{ value() }}</h3>
|
|
807
|
+
} @else {
|
|
808
|
+
@if (artifacts().length) {
|
|
809
|
+
<ul [id]="config().attrName" [ngStyle]="config().style">
|
|
810
|
+
@for (artifact of artifacts(); track artifact.objectId) {
|
|
811
|
+
<li>
|
|
812
|
+
<a href="" (click)="openArtifact($event, artifact)">{{ artifact.name }}</a>
|
|
813
|
+
</li>
|
|
814
|
+
}
|
|
815
|
+
</ul>
|
|
816
|
+
}
|
|
817
|
+
<app-artifact-selector (artifactUploaded)="onArtifactUploaded($event)" />
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
` }]
|
|
821
|
+
}] });
|
|
822
|
+
|
|
572
823
|
class LabelComponent extends BaseFormControlComponent {
|
|
573
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
574
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
824
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: LabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
825
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", 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"] }] });
|
|
575
826
|
}
|
|
576
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
827
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: LabelComponent, decorators: [{
|
|
577
828
|
type: Component,
|
|
578
829
|
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>" }]
|
|
579
830
|
}] });
|
|
580
831
|
|
|
581
832
|
class DatepickerComponent extends BaseFormControlComponent {
|
|
582
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
583
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
833
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: DatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
834
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", 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"] }] });
|
|
584
835
|
}
|
|
585
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
836
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
586
837
|
type: Component,
|
|
587
838
|
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" }]
|
|
588
839
|
}] });
|
|
@@ -592,55 +843,55 @@ class ForeignKeyComponent extends BaseFormControlComponent {
|
|
|
592
843
|
navigateToRelated() {
|
|
593
844
|
this.store.navigateToRelated(this.config().linkedEntityType, this.value());
|
|
594
845
|
}
|
|
595
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
596
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
846
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: ForeignKeyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
847
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", 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"] }] });
|
|
597
848
|
}
|
|
598
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
849
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: ForeignKeyComponent, decorators: [{
|
|
599
850
|
type: Component,
|
|
600
851
|
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>" }]
|
|
601
852
|
}] });
|
|
602
853
|
|
|
603
854
|
class TextboxComponent extends BaseFormControlComponent {
|
|
604
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
605
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
855
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: TextboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
856
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", 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"] }] });
|
|
606
857
|
}
|
|
607
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
858
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: TextboxComponent, decorators: [{
|
|
608
859
|
type: Component,
|
|
609
860
|
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>" }]
|
|
610
861
|
}] });
|
|
611
862
|
|
|
612
863
|
class DropdownComponent extends BaseFormControlComponent {
|
|
613
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
614
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
864
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: DropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
865
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", 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"] }] });
|
|
615
866
|
}
|
|
616
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
617
868
|
type: Component,
|
|
618
869
|
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>" }]
|
|
619
870
|
}] });
|
|
620
871
|
|
|
621
872
|
class CheckboxComponent extends BaseFormControlComponent {
|
|
622
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
623
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
873
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
874
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", 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"] }] });
|
|
624
875
|
}
|
|
625
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
876
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
626
877
|
type: Component,
|
|
627
878
|
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"] }]
|
|
628
879
|
}] });
|
|
629
880
|
|
|
630
881
|
class RadioComponent extends BaseFormControlComponent {
|
|
631
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
632
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
882
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
883
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", 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"] }] });
|
|
633
884
|
}
|
|
634
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
885
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: RadioComponent, decorators: [{
|
|
635
886
|
type: Component,
|
|
636
887
|
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>" }]
|
|
637
888
|
}] });
|
|
638
889
|
|
|
639
890
|
class TextareaComponent extends BaseFormControlComponent {
|
|
640
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
641
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
891
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: TextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
892
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", 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"] }] });
|
|
642
893
|
}
|
|
643
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
894
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
644
895
|
type: Component,
|
|
645
896
|
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>" }]
|
|
646
897
|
}] });
|
|
@@ -650,10 +901,10 @@ class FlexBoxHostDirective {
|
|
|
650
901
|
constructor(viewContainerRef) {
|
|
651
902
|
this.viewContainerRef = viewContainerRef;
|
|
652
903
|
}
|
|
653
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
654
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.
|
|
904
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: FlexBoxHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
905
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.10", type: FlexBoxHostDirective, isStandalone: true, selector: "[flexBoxHost]", ngImport: i0 });
|
|
655
906
|
}
|
|
656
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
907
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: FlexBoxHostDirective, decorators: [{
|
|
657
908
|
type: Directive,
|
|
658
909
|
args: [{
|
|
659
910
|
standalone: true,
|
|
@@ -693,10 +944,10 @@ class FlexBoxComponent extends BaseFormControlComponent {
|
|
|
693
944
|
throw new Error('Unknown flex direction');
|
|
694
945
|
}
|
|
695
946
|
}
|
|
696
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
697
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
947
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: FlexBoxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
948
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", 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"] }] });
|
|
698
949
|
}
|
|
699
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
950
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: FlexBoxComponent, decorators: [{
|
|
700
951
|
type: Component,
|
|
701
952
|
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"] }]
|
|
702
953
|
}], propDecorators: { flexBoxHost: [{
|
|
@@ -704,11 +955,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
704
955
|
args: [FlexBoxHostDirective, { static: true, read: FlexBoxHostDirective }]
|
|
705
956
|
}] } });
|
|
706
957
|
|
|
958
|
+
class TagsComponent extends BaseFormControlComponent {
|
|
959
|
+
separatorKeysCodes = [ENTER, COMMA];
|
|
960
|
+
add(event) {
|
|
961
|
+
const value = (event.value || '').trim();
|
|
962
|
+
if (!value) {
|
|
963
|
+
event.chipInput?.clear();
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
this.setTags([...this.tags(), value]);
|
|
967
|
+
event.chipInput?.clear();
|
|
968
|
+
}
|
|
969
|
+
remove(index) {
|
|
970
|
+
const updatedTags = [...this.tags()];
|
|
971
|
+
updatedTags.splice(index, 1);
|
|
972
|
+
this.setTags(updatedTags);
|
|
973
|
+
}
|
|
974
|
+
edit(index, event) {
|
|
975
|
+
const value = (event.value || '').trim();
|
|
976
|
+
if (!value) {
|
|
977
|
+
this.remove(index);
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
const updatedTags = [...this.tags()];
|
|
981
|
+
updatedTags[index] = value;
|
|
982
|
+
this.setTags(updatedTags);
|
|
983
|
+
}
|
|
984
|
+
tags() {
|
|
985
|
+
const value = this.formGroup.get(this.config().attrName)?.value;
|
|
986
|
+
return Array.isArray(value) ? value : [];
|
|
987
|
+
}
|
|
988
|
+
setTags(tags) {
|
|
989
|
+
const control = this.formGroup.get(this.config().attrName);
|
|
990
|
+
control?.setValue(tags);
|
|
991
|
+
control?.markAsDirty();
|
|
992
|
+
control?.markAsTouched();
|
|
993
|
+
}
|
|
994
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: TagsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
995
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", type: TagsComponent, isStandalone: true, selector: "base-tags", usesInheritance: true, ngImport: i0, template: `
|
|
996
|
+
<ng-container *ngIf="config().visible">
|
|
997
|
+
<div class="row" [formGroup]="formGroup">
|
|
998
|
+
<mat-form-field>
|
|
999
|
+
<mat-label>{{ config().label }}</mat-label>
|
|
1000
|
+
<mat-chip-grid #chipGrid [id]="config().attrName">
|
|
1001
|
+
@for (tag of tags(); track $index; let i = $index) {
|
|
1002
|
+
<mat-chip-row [editable]="true" (edited)="edit(i, $event)" (removed)="remove(i)">
|
|
1003
|
+
{{ tag }}
|
|
1004
|
+
<button matChipRemove [attr.aria-label]="'remove ' + tag">
|
|
1005
|
+
<mat-icon>cancel</mat-icon>
|
|
1006
|
+
</button>
|
|
1007
|
+
</mat-chip-row>
|
|
1008
|
+
}
|
|
1009
|
+
<input [placeholder]="config().label" [matChipInputFor]="chipGrid" [matChipInputSeparatorKeyCodes]="separatorKeysCodes" (matChipInputTokenEnd)="add($event)" />
|
|
1010
|
+
</mat-chip-grid>
|
|
1011
|
+
</mat-form-field>
|
|
1012
|
+
</div>
|
|
1013
|
+
</ng-container>
|
|
1014
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "component", type: MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "directive", type: MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
1015
|
+
}
|
|
1016
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: TagsComponent, decorators: [{
|
|
1017
|
+
type: Component,
|
|
1018
|
+
args: [{
|
|
1019
|
+
selector: 'base-tags',
|
|
1020
|
+
standalone: true,
|
|
1021
|
+
template: `
|
|
1022
|
+
<ng-container *ngIf="config().visible">
|
|
1023
|
+
<div class="row" [formGroup]="formGroup">
|
|
1024
|
+
<mat-form-field>
|
|
1025
|
+
<mat-label>{{ config().label }}</mat-label>
|
|
1026
|
+
<mat-chip-grid #chipGrid [id]="config().attrName">
|
|
1027
|
+
@for (tag of tags(); track $index; let i = $index) {
|
|
1028
|
+
<mat-chip-row [editable]="true" (edited)="edit(i, $event)" (removed)="remove(i)">
|
|
1029
|
+
{{ tag }}
|
|
1030
|
+
<button matChipRemove [attr.aria-label]="'remove ' + tag">
|
|
1031
|
+
<mat-icon>cancel</mat-icon>
|
|
1032
|
+
</button>
|
|
1033
|
+
</mat-chip-row>
|
|
1034
|
+
}
|
|
1035
|
+
<input [placeholder]="config().label" [matChipInputFor]="chipGrid" [matChipInputSeparatorKeyCodes]="separatorKeysCodes" (matChipInputTokenEnd)="add($event)" />
|
|
1036
|
+
</mat-chip-grid>
|
|
1037
|
+
</mat-form-field>
|
|
1038
|
+
</div>
|
|
1039
|
+
</ng-container>
|
|
1040
|
+
`,
|
|
1041
|
+
imports: [NgIf, ReactiveFormsModule, MatFormField, MatLabel, MatChipGrid, MatChipRow, MatChipInput, MatChipRemove, MatIcon],
|
|
1042
|
+
}]
|
|
1043
|
+
}] });
|
|
1044
|
+
|
|
707
1045
|
class BaseEntityFormBuilder {
|
|
1046
|
+
logger = inject(NGXLogger);
|
|
708
1047
|
// region public methods
|
|
709
1048
|
buildForm(viewContainerRef, baseEntityForm, store, attrDescriptors, entity) {
|
|
1049
|
+
this.logger.trace(`Starting to build form for: ${attrDescriptors}`);
|
|
710
1050
|
viewContainerRef.clear();
|
|
711
1051
|
attrDescriptors.forEach((column) => {
|
|
1052
|
+
this.logger.debug(`Processing column: ${column.attrName}`);
|
|
712
1053
|
const formControlType = this.createFormControl(column);
|
|
713
1054
|
if (formControlType) {
|
|
714
1055
|
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
@@ -733,26 +1074,20 @@ class BaseEntityFormBuilder {
|
|
|
733
1074
|
// endregion
|
|
734
1075
|
// region protected, private helper methods
|
|
735
1076
|
createFormControl(column) {
|
|
736
|
-
if (column.formControlType === FormControlType.
|
|
737
|
-
return
|
|
1077
|
+
if (column.formControlType === FormControlType.ARTIFACT) {
|
|
1078
|
+
return ArtifactComponent;
|
|
1079
|
+
}
|
|
1080
|
+
else if (column.formControlType === FormControlType.CHECKBOX) {
|
|
1081
|
+
return CheckboxComponent;
|
|
738
1082
|
}
|
|
739
1083
|
else if (column.formControlType === FormControlType.DATE) {
|
|
740
1084
|
return DatepickerComponent;
|
|
741
1085
|
}
|
|
742
|
-
else if (column.formControlType === FormControlType.FLEX_BOX) {
|
|
743
|
-
return FlexBoxComponent;
|
|
744
|
-
}
|
|
745
|
-
else if (column.formControlType === FormControlType.FOREIGN_KEY) {
|
|
746
|
-
return ForeignKeyComponent;
|
|
747
|
-
}
|
|
748
|
-
else if (column.formControlType === FormControlType.TEXT_BOX) {
|
|
749
|
-
return TextboxComponent;
|
|
750
|
-
}
|
|
751
1086
|
else if (column.formControlType === FormControlType.DROPDOWN) {
|
|
752
1087
|
return DropdownComponent;
|
|
753
1088
|
}
|
|
754
|
-
else if (column.formControlType === FormControlType.
|
|
755
|
-
return
|
|
1089
|
+
else if (column.formControlType === FormControlType.LABEL) {
|
|
1090
|
+
return LabelComponent;
|
|
756
1091
|
}
|
|
757
1092
|
else if (column.formControlType === FormControlType.RADIO) {
|
|
758
1093
|
return RadioComponent;
|
|
@@ -760,24 +1095,36 @@ class BaseEntityFormBuilder {
|
|
|
760
1095
|
else if (column.formControlType === FormControlType.TEXTAREA) {
|
|
761
1096
|
return TextareaComponent;
|
|
762
1097
|
}
|
|
1098
|
+
else if (column.formControlType === FormControlType.FLEX_BOX) {
|
|
1099
|
+
return FlexBoxComponent;
|
|
1100
|
+
}
|
|
1101
|
+
else if (column.formControlType === FormControlType.FOREIGN_KEY) {
|
|
1102
|
+
return ForeignKeyComponent;
|
|
1103
|
+
}
|
|
1104
|
+
else if (column.formControlType === FormControlType.TAGS) {
|
|
1105
|
+
return TagsComponent;
|
|
1106
|
+
}
|
|
1107
|
+
else if (column.formControlType === FormControlType.TEXT_BOX) {
|
|
1108
|
+
return TextboxComponent;
|
|
1109
|
+
}
|
|
763
1110
|
else
|
|
764
1111
|
throw Error('Undefined form control type');
|
|
765
1112
|
}
|
|
766
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
767
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
1113
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityFormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1114
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityFormBuilder, providedIn: 'root' });
|
|
768
1115
|
}
|
|
769
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityFormBuilder, decorators: [{
|
|
770
1117
|
type: Injectable,
|
|
771
1118
|
args: [{ providedIn: 'root' }]
|
|
772
1119
|
}] });
|
|
773
1120
|
|
|
774
1121
|
class BaseEntityFormComponent {
|
|
775
1122
|
baseEntityForm;
|
|
776
|
-
|
|
1123
|
+
entityDescriptor = inject(ROUTER_OUTLET_DATA);
|
|
777
1124
|
entity = computed(() => (this.isNewObject() ? this.store().createEntity() : this.store().loadById(this.entityId())), ...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
|
|
778
1125
|
entityId = input.required(...(ngDevMode ? [{ debugName: "entityId" }] : /* istanbul ignore next */ []));
|
|
779
1126
|
componentHost;
|
|
780
|
-
store = computed(() => this.
|
|
1127
|
+
store = computed(() => this.entityDescriptor().store, ...(ngDevMode ? [{ debugName: "store" }] : /* istanbul ignore next */ []));
|
|
781
1128
|
entityFormBuilder = inject((BaseEntityFormBuilder));
|
|
782
1129
|
formBuilder = inject(FormBuilder);
|
|
783
1130
|
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : /* istanbul ignore next */ []));
|
|
@@ -789,7 +1136,7 @@ class BaseEntityFormComponent {
|
|
|
789
1136
|
ngOnInit() {
|
|
790
1137
|
this.store().determineActiveRouteSegment();
|
|
791
1138
|
this.baseEntityForm = this.formBuilder.group({});
|
|
792
|
-
this.logger.info('BaseEntityFormComponent initialized with:', { entityDescriptor: this.
|
|
1139
|
+
this.logger.info('BaseEntityFormComponent initialized with:', { entityDescriptor: this.entityDescriptor() });
|
|
793
1140
|
}
|
|
794
1141
|
// endregion
|
|
795
1142
|
// region event handlers
|
|
@@ -812,9 +1159,9 @@ class BaseEntityFormComponent {
|
|
|
812
1159
|
// region protected, private helper methods
|
|
813
1160
|
registerEffects() {
|
|
814
1161
|
effect(() => {
|
|
815
|
-
if (this.entityId() && this.
|
|
1162
|
+
if (this.entityId() && this.entityDescriptor() && this.entity())
|
|
816
1163
|
untracked(() => {
|
|
817
|
-
this.entityFormBuilder.buildForm(this.componentHost.viewContainerRef, this.baseEntityForm, this.store(), this.
|
|
1164
|
+
this.entityFormBuilder.buildForm(this.componentHost.viewContainerRef, this.baseEntityForm, this.store(), this.entityDescriptor().attrDescriptors, this.entity);
|
|
818
1165
|
});
|
|
819
1166
|
});
|
|
820
1167
|
effect(() => {
|
|
@@ -822,10 +1169,10 @@ class BaseEntityFormComponent {
|
|
|
822
1169
|
this.store().setCurrentEntity(this.entity().id);
|
|
823
1170
|
});
|
|
824
1171
|
}
|
|
825
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
826
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.
|
|
1172
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1173
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.10", 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"] }] });
|
|
827
1174
|
}
|
|
828
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityFormComponent, decorators: [{
|
|
829
1176
|
type: Component,
|
|
830
1177
|
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" }]
|
|
831
1178
|
}], ctorParameters: () => [], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }], componentHost: [{
|
|
@@ -851,6 +1198,7 @@ class BaseEntityListComponent {
|
|
|
851
1198
|
selection = new SelectionModel(true, []);
|
|
852
1199
|
entityDescriptor = inject(ROUTER_OUTLET_DATA);
|
|
853
1200
|
logger = inject(NGXLogger);
|
|
1201
|
+
objectStoreService = inject(ObjectStoreService);
|
|
854
1202
|
columnDescriptors = computed(() => {
|
|
855
1203
|
return filterAttributeDescriptors(this.entityDescriptor().attrDescriptors);
|
|
856
1204
|
}, ...(ngDevMode ? [{ debugName: "columnDescriptors" }] : /* istanbul ignore next */ []));
|
|
@@ -901,6 +1249,26 @@ class BaseEntityListComponent {
|
|
|
901
1249
|
this.selection.toggle(entity);
|
|
902
1250
|
this.onChangeSelection(entity);
|
|
903
1251
|
}
|
|
1252
|
+
onDownloadObject(artifact, event) {
|
|
1253
|
+
event?.stopPropagation();
|
|
1254
|
+
event?.preventDefault();
|
|
1255
|
+
const bucketName = artifact.bucketName ?? artifact.bucket;
|
|
1256
|
+
const objectID = artifact.objectID ?? artifact.objectId ?? artifact.id;
|
|
1257
|
+
if (!bucketName || !objectID) {
|
|
1258
|
+
this.logger.warn('Cannot download artifact: missing bucketName or objectID', { artifact });
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
this.objectStoreService.getObjectByID(bucketName, objectID).subscribe({
|
|
1262
|
+
next: (response) => {
|
|
1263
|
+
const blobUrl = URL.createObjectURL(response.data);
|
|
1264
|
+
window.open(blobUrl, '_blank', 'noopener');
|
|
1265
|
+
setTimeout(() => URL.revokeObjectURL(blobUrl), 60000);
|
|
1266
|
+
},
|
|
1267
|
+
error: (error) => {
|
|
1268
|
+
this.logger.error('Artifact download failed', { bucketName, objectID, error });
|
|
1269
|
+
},
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
904
1272
|
onToggleAllRows() {
|
|
905
1273
|
if (this.isAllSelected()) {
|
|
906
1274
|
this.cancelSelections();
|
|
@@ -946,10 +1314,10 @@ class BaseEntityListComponent {
|
|
|
946
1314
|
isSelected(row) {
|
|
947
1315
|
return this.selection.isSelected(row);
|
|
948
1316
|
}
|
|
949
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
950
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
1317
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1318
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", 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 @for (artifact of element[colDescriptor.attrName]; track $index; let isLast = $last) {\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.fileName ?? artifact.objectID ?? artifact.objectId ?? artifact.id ?? '') | slice:0:20) + ((artifact.name ?? artifact.fileName ?? artifact.objectID ?? artifact.objectId ?? artifact.id ?? '').length > 20 ? '...' : '') }}</a>@if (!isLast) {, }\n }\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", 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}\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: "pipe", type: SlicePipe, name: "slice" }] });
|
|
951
1319
|
}
|
|
952
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1320
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: BaseEntityListComponent, decorators: [{
|
|
953
1321
|
type: Component,
|
|
954
1322
|
args: [{ selector: 'base-list', standalone: true, imports: [
|
|
955
1323
|
MatTable,
|
|
@@ -967,7 +1335,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
967
1335
|
MatSortHeader,
|
|
968
1336
|
MatProgressBar,
|
|
969
1337
|
MatCheckbox,
|
|
970
|
-
|
|
1338
|
+
SlicePipe,
|
|
1339
|
+
], 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 @for (artifact of element[colDescriptor.attrName]; track $index; let isLast = $last) {\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.fileName ?? artifact.objectID ?? artifact.objectId ?? artifact.id ?? '') | slice:0:20) + ((artifact.name ?? artifact.fileName ?? artifact.objectID ?? artifact.objectId ?? artifact.id ?? '').length > 20 ? '...' : '') }}</a>@if (!isLast) {, }\n }\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", 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}\n"] }]
|
|
971
1340
|
}], ctorParameters: () => [], propDecorators: { sort: [{
|
|
972
1341
|
type: ViewChild,
|
|
973
1342
|
args: [MatSort]
|
|
@@ -1152,6 +1521,11 @@ function BaseEntityStore(entityType, repositoryType) {
|
|
|
1152
1521
|
})), withHooks((store) => ({
|
|
1153
1522
|
onInit: () => {
|
|
1154
1523
|
store.load({});
|
|
1524
|
+
if (isDevMode()) {
|
|
1525
|
+
watchState(store, (state) => {
|
|
1526
|
+
// console.log('[Base Entity Store] state changed:', state);
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1155
1529
|
},
|
|
1156
1530
|
})), withComputed((store) => ({
|
|
1157
1531
|
countOfEntities: computed(() => store.entities().length),
|
|
@@ -1346,7 +1720,7 @@ function getEntityIds(instance) {
|
|
|
1346
1720
|
|
|
1347
1721
|
const BASE_ENTITY_ROUTES = [
|
|
1348
1722
|
{ path: '', redirectTo: 'list', pathMatch: 'full' },
|
|
1349
|
-
{ path: ':
|
|
1723
|
+
{ path: ':entityId/details', component: BaseEntityFormComponent },
|
|
1350
1724
|
{ path: 'list', component: BaseEntityListComponent },
|
|
1351
1725
|
];
|
|
1352
1726
|
|