@processpuzzle/base-entity 0.2.0 → 0.3.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.
Files changed (31) hide show
  1. package/README.md +108 -42
  2. package/fesm2022/processpuzzle-base-entity.mjs +566 -340
  3. package/fesm2022/processpuzzle-base-entity.mjs.map +1 -1
  4. package/lib/base-entity/abstact-attr.descriptor.d.ts +21 -0
  5. package/lib/base-entity/base-entity-attr.descriptor.d.ts +7 -21
  6. package/lib/base-entity/base-entity.descriptor.d.ts +2 -2
  7. package/lib/base-entity/filter-attr-descriptor.d.ts +3 -0
  8. package/lib/base-entity/flexboxDescriptor.d.ts +11 -0
  9. package/lib/base-entity-service/base-entity-firestore.service.d.ts +27 -0
  10. package/lib/base-entity-service/base-entity-load-response.d.ts +48 -0
  11. package/lib/base-entity-service/base-entity-rest.service.d.ts +26 -0
  12. package/lib/base-entity-service/base-entity.service.d.ts +14 -0
  13. package/lib/base-entity-store/addEntity.d.ts +9 -0
  14. package/lib/{base-entity.store.d.ts → base-entity-store/base-entity.store.d.ts} +12 -19
  15. package/lib/base-entity-store/deleteAllEntities.d.ts +9 -0
  16. package/lib/base-entity-store/deleteEntity.d.ts +9 -0
  17. package/lib/base-entity-store/findByQuery.d.ts +10 -0
  18. package/lib/base-entity-store/updateEntity.d.ts +9 -0
  19. package/lib/base-form/base-entity-form.builder.d.ts +11 -0
  20. package/lib/base-form/base-entity-form.component.d.ts +5 -6
  21. package/lib/base-form/base-form-control.component.d.ts +4 -1
  22. package/lib/base-form/flex-box/flex-box-host.directive.d.ts +8 -0
  23. package/lib/base-form/flex-box/flex-box.component.d.ts +11 -0
  24. package/lib/base-form-navigator/base-form-navigator.store.d.ts +5 -8
  25. package/lib/base-list/base-entity-list.component.d.ts +4 -4
  26. package/lib/base-statusbar/base-entity-statusbar.component.d.ts +1 -0
  27. package/lib/base-toolbar/base-entity-toolbar.component.d.ts +1 -1
  28. package/package.json +13 -13
  29. package/public-api.d.ts +8 -5
  30. package/lib/base-entity-load-response.d.ts +0 -7
  31. package/lib/base-entity.service.d.ts +0 -25
@@ -1,23 +1,23 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, input, Component, inject, computed, signal, effect, untracked, ViewChild, InjectionToken, Inject } from '@angular/core';
3
- import * as i1 from '@angular/forms';
4
- import { ReactiveFormsModule, FormsModule, FormBuilder, FormControl, Validators } from '@angular/forms';
2
+ import { Directive, input, computed, Component, ViewChild, signal, Injectable, inject, effect, untracked, InjectionToken, Inject } from '@angular/core';
3
+ import * as i1$1 from '@angular/forms';
4
+ import { ReactiveFormsModule, FormsModule, FormControl, Validators, FormBuilder } from '@angular/forms';
5
5
  import { ROUTER_OUTLET_DATA, Router, ActivatedRoute, RouterOutlet } from '@angular/router';
6
- import * as i1$1 from '@angular/common';
7
- import { NgIf, NgStyle, NgClass, NgForOf, CommonModule } from '@angular/common';
8
- import * as i3$1 from '@angular/material/form-field';
9
- import { MatFormField, MatLabel, MatFormFieldModule, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
10
- import * as i4 from '@angular/material/input';
11
- import { MatInput, MatInputModule } from '@angular/material/input';
12
- import * as i2 from '@angular/material/select';
13
- import { MatSelectModule } from '@angular/material/select';
14
- import * as i3 from '@angular/material/core';
15
- import { MatCheckbox } from '@angular/material/checkbox';
16
6
  import { MatCard, MatCardContent, MatCardActions } from '@angular/material/card';
7
+ import * as i3 from '@angular/material/form-field';
8
+ import { MatFormFieldModule, MatLabel, MatFormField, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
9
+ import { MatButton } from '@angular/material/button';
10
+ import * as i1 from '@angular/common';
11
+ import { NgIf, NgStyle, CommonModule, NgClass, NgForOf } from '@angular/common';
17
12
  import * as i5 from '@angular/material/datepicker';
18
13
  import { MatDatepickerModule } from '@angular/material/datepicker';
19
- import { MatButton } from '@angular/material/button';
14
+ import * as i4 from '@angular/material/input';
15
+ import { MatInputModule, MatInput } from '@angular/material/input';
20
16
  import { MatIcon } from '@angular/material/icon';
17
+ import * as i2 from '@angular/material/select';
18
+ import { MatSelectModule } from '@angular/material/select';
19
+ import * as i3$1 from '@angular/material/core';
20
+ import { MatCheckbox } from '@angular/material/checkbox';
21
21
  import { MatTableDataSource, MatTable, MatHeaderCell, MatHeaderRow, MatRow, MatCell, MatColumnDef, MatHeaderCellDef, MatCellDef, MatHeaderRowDef, MatRowDef } from '@angular/material/table';
22
22
  import { MatSort, MatSortHeader } from '@angular/material/sort';
23
23
  import { MatPaginator } from '@angular/material/paginator';
@@ -30,90 +30,73 @@ import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
30
30
  import { LayoutService, RUNTIME_CONFIGURATION } from '@processpuzzle/util';
31
31
  import { MatSnackBar } from '@angular/material/snack-bar';
32
32
  import { __decorate, __param, __metadata } from 'tslib';
33
- import { map, pipe, tap, switchMap } from 'rxjs';
33
+ import { map, pipe, switchMap, tap, from, of } from 'rxjs';
34
34
  import { HttpClient, HttpHeaders } from '@angular/common/http';
35
- import buildUrl from 'build-url-ts';
36
- import { rxMethod } from '@ngrx/signals/rxjs-interop';
35
+ import { buildUrl } from 'build-url-ts';
37
36
  import { tapResponse } from '@ngrx/operators';
38
-
39
- class BaseFormHostDirective {
40
- viewContainerRef;
41
- constructor(viewContainerRef) {
42
- this.viewContainerRef = viewContainerRef;
43
- }
44
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseFormHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
45
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: BaseFormHostDirective, isStandalone: true, selector: "[baseFormHost]", ngImport: i0 });
46
- }
47
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseFormHostDirective, decorators: [{
48
- type: Directive,
49
- args: [{
50
- standalone: true,
51
- selector: '[baseFormHost]',
52
- }]
53
- }], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
37
+ import { rxMethod } from '@ngrx/signals/rxjs-interop';
38
+ import { Firestore, collection, doc, deleteDoc, getDoc, setDoc, orderBy, where, query, limit, getDocs, updateDoc } from '@angular/fire/firestore';
54
39
 
55
40
  var FormControlType;
56
41
  (function (FormControlType) {
42
+ FormControlType["CHECKBOX"] = "CHECKBOX";
57
43
  FormControlType["DATE"] = "DATE";
44
+ FormControlType["DROPDOWN"] = "DROPDOWN";
45
+ FormControlType["FLEX_BOX"] = "FLEX_BOX";
46
+ FormControlType["FOREIGN_KEY"] = "FOREIGN_KEY";
58
47
  FormControlType["LABEL"] = "LABEL";
48
+ FormControlType["RADIO"] = "RADIO";
59
49
  FormControlType["TITLE"] = "TITLE";
60
50
  FormControlType["TEXT_BOX"] = "TEXT_BOX";
61
- FormControlType["DROPDOWN"] = "DROPDOWN";
62
- FormControlType["CHECKBOX"] = "CHECKBOX";
63
- FormControlType["RADIO"] = "RADIO";
64
51
  FormControlType["TEXTAREA"] = "TEXTAREA";
65
- FormControlType["FOREIGN_KEY"] = "FOREIGN_KEY";
66
52
  })(FormControlType || (FormControlType = {}));
67
- class BaseEntityAttrDescriptor {
53
+ class AbstractAttrDescriptor {
68
54
  attrName;
69
- description;
70
- styleClass = '';
71
- labelClass = '';
72
- format;
73
- isLinkToDetails;
74
55
  formControlType;
75
- selectables;
76
- visible = true;
77
56
  disabled = false;
78
- isHeading;
79
57
  style;
80
- placeholder;
81
- lines;
82
- options;
83
- _label;
84
- _linkedEntityType;
85
- constructor(attrName, formControlType, label, isLinkToDetails, options) {
58
+ constructor(attrName, formControlType) {
86
59
  this.attrName = attrName;
87
60
  this.formControlType = formControlType;
88
- this._label = label;
89
- this.isLinkToDetails = isLinkToDetails;
90
- this.options = { inputType: 'text', ...options };
91
61
  }
92
- // region properties
93
- get label() {
94
- return this._label ? this._label : this.attrName;
95
- }
96
- set label(label) {
97
- this._label = label;
98
- }
99
- get linkedEntityType() {
100
- return this._linkedEntityType;
101
- }
102
- setLinkedEntityType(linkedEntityType) {
103
- this._linkedEntityType = linkedEntityType;
62
+ }
63
+
64
+ class BaseFormHostDirective {
65
+ viewContainerRef;
66
+ constructor(viewContainerRef) {
67
+ this.viewContainerRef = viewContainerRef;
104
68
  }
69
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseFormHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
70
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: BaseFormHostDirective, isStandalone: true, selector: "[baseFormHost]", ngImport: i0 });
105
71
  }
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseFormHostDirective, decorators: [{
73
+ type: Directive,
74
+ args: [{
75
+ standalone: true,
76
+ selector: '[baseFormHost]',
77
+ }]
78
+ }], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
79
+
80
+ var BaseUrlSegments;
81
+ (function (BaseUrlSegments) {
82
+ BaseUrlSegments["DetailsForm"] = "details";
83
+ BaseUrlSegments["Feed"] = "feed";
84
+ BaseUrlSegments["ListForm"] = "list";
85
+ BaseUrlSegments["NewEntity"] = "new";
86
+ BaseUrlSegments["UnknownEntity"] = "unknown";
87
+ })(BaseUrlSegments || (BaseUrlSegments = {}));
106
88
 
107
89
  class BaseFormControlComponent {
108
90
  config = input.required();
109
91
  entity = input.required();
110
92
  formGroup;
111
93
  store;
94
+ style = computed(() => this.config().style);
112
95
  value = input.required();
113
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseFormControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
114
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.4", type: BaseFormControlComponent, isStandalone: true, selector: "ng-component", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, entity: { classPropertyName: "entity", publicName: "entity", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: ``, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }] });
96
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseFormControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
97
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.2", 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 }] });
115
98
  }
116
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseFormControlComponent, decorators: [{
99
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseFormControlComponent, decorators: [{
117
100
  type: Component,
118
101
  args: [{
119
102
  standalone: true,
@@ -123,144 +106,205 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
123
106
  }] });
124
107
 
125
108
  class LabelComponent extends BaseFormControlComponent {
126
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: LabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
127
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: LabelComponent, isStandalone: true, selector: "base-label", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <ng-container *ngIf=\"config().isHeading; else normalText\">\n <h3 [id]=\"config().attrName\">{{value()}}</h3>\n </ng-container>\n\n <ng-template #normalText>\n <p [id]=\"config().attrName\" [ngStyle]=\"config().style\">{{value()}}</p>\n </ng-template>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
109
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: LabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
110
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", 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"] }] });
128
111
  }
129
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: LabelComponent, decorators: [{
112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: LabelComponent, decorators: [{
130
113
  type: Component,
131
114
  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>" }]
132
115
  }] });
133
116
 
117
+ class DatepickerComponent extends BaseFormControlComponent {
118
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
119
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", type: DatepickerComponent, isStandalone: true, selector: "base-datepicker", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\r\n <div class=\"row\" style=\"margin-bottom: 10px\" [formGroup]=\"formGroup\">\r\n <mat-form-field>\r\n <mat-label>{{config().label}}</mat-label>\r\n <input matInput [matDatepicker]=\"picker\" formControlName=\"{{config().attrName}}\">\r\n <mat-hint>MM-DD-YYYY</mat-hint>\r\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker></mat-datepicker>\r\n </mat-form-field>\r\n </div>\r\n</ng-container>\r\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],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i5.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
120
+ }
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DatepickerComponent, decorators: [{
122
+ type: Component,
123
+ args: [{ selector: 'base-datepicker', standalone: true, imports: [CommonModule, FormsModule, MatFormFieldModule, MatInputModule, MatDatepickerModule, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\r\n <div class=\"row\" style=\"margin-bottom: 10px\" [formGroup]=\"formGroup\">\r\n <mat-form-field>\r\n <mat-label>{{config().label}}</mat-label>\r\n <input matInput [matDatepicker]=\"picker\" formControlName=\"{{config().attrName}}\">\r\n <mat-hint>MM-DD-YYYY</mat-hint>\r\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker></mat-datepicker>\r\n </mat-form-field>\r\n </div>\r\n</ng-container>\r\n" }]
124
+ }] });
125
+
126
+ class ForeignKeyComponent extends BaseFormControlComponent {
127
+ // region event handling methods
128
+ navigateToRelated() {
129
+ this.store.navigateToRelated(this.config().linkedEntityType, this.value());
130
+ }
131
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ForeignKeyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
132
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", 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],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
133
+ }
134
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ForeignKeyComponent, decorators: [{
135
+ type: Component,
136
+ args: [{ selector: 'base-foreign-key', standalone: true, imports: [NgIf, MatIcon, MatLabel, MatFormField, MatInput, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{ config().attrName }}</mat-label>\n <input matInput formControlName=\"{{config().attrName}}\">\n </mat-form-field>\n <a (click)=\"navigateToRelated()\" aria-label=\"Related entity\">\n <mat-icon>link</mat-icon>\n </a>\n </div>\n</ng-container>" }]
137
+ }] });
138
+
134
139
  class TextboxComponent extends BaseFormControlComponent {
135
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: TextboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
136
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: TextboxComponent, isStandalone: true, selector: "base-textbox", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <input matInput formControlName=\"{{config().attrName}}\">\n </mat-form-field>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
140
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: TextboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
141
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", 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],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"] }] });
137
142
  }
138
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: TextboxComponent, decorators: [{
143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: TextboxComponent, decorators: [{
139
144
  type: Component,
140
145
  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>" }]
141
146
  }] });
142
147
 
143
148
  class DropdownComponent extends BaseFormControlComponent {
144
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
145
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: DropdownComponent, isStandalone: true, selector: "base-dropdown", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <mat-select formControlName=\"{{config().attrName}}\">\n @for (option of config().selectables; track option) {\n <mat-option [value]=\"option.value\">{{option.value}}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.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: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] });
149
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
150
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", 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],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: i3$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] });
146
151
  }
147
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DropdownComponent, decorators: [{
152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DropdownComponent, decorators: [{
148
153
  type: Component,
149
154
  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>" }]
150
155
  }] });
151
156
 
152
157
  class CheckboxComponent extends BaseFormControlComponent {
153
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
154
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: CheckboxComponent, isStandalone: true, selector: "base-checkbox", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div [formGroup]=\"formGroup\" class=\"row\">\n <mat-checkbox [ngClass]=\"config().labelClass\" formControlName=\"{{config().attrName}}\">{{config().label}}</mat-checkbox>\n </div>\n</ng-container>", styles: ["mat-checkbox{margin-bottom:12px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
158
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
159
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", 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],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"] }] });
155
160
  }
156
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CheckboxComponent, decorators: [{
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: CheckboxComponent, decorators: [{
157
162
  type: Component,
158
163
  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"] }]
159
164
  }] });
160
165
 
161
166
  class RadioComponent extends BaseFormControlComponent {
162
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
163
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: RadioComponent, isStandalone: true, selector: "base-radio", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <ng-container *ngIf=\"config().label\">\n <label [for]=\"config().attrName\">{{config().label}}</label>\n </ng-container>\n <div \n [ngClass]=\"config().styleClass ? config().styleClass : ''\"\n *ngFor=\"let radio of config().selectables; let i = index\">\n <input type=\"radio\"\n class=\"form-check-input\"\n [name]=\"config().attrName\"\n [id]=\"config().attrName + i\"\n [value]=\"radio.value\"\n [checked]=\"radio.key === value()\"\n [disabled]=\"config().disabled\"\n >\n <label [for]=\"config().attrName\" [ngClass]=\"config().labelClass ? config().labelClass : ''\">{{radio.value}}</label>\n </div>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
167
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
168
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", 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],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
164
169
  }
165
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: RadioComponent, decorators: [{
170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: RadioComponent, decorators: [{
166
171
  type: Component,
167
172
  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>" }]
168
173
  }] });
169
174
 
170
175
  class TextareaComponent extends BaseFormControlComponent {
171
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: TextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
172
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: TextareaComponent, isStandalone: true, selector: "base-textarea", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field [ngClass]=\"config().styleClass\">\n <mat-label [ngClass]=\"config().labelClass\">{{config().label}}</mat-label>\n <textarea matInput formControlName=\"{{config().attrName}}\" placeholder=\"Ex. It makes me feel...\"></textarea>\n </mat-form-field>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
176
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: TextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
177
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", 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],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"] }] });
173
178
  }
174
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: TextareaComponent, decorators: [{
179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: TextareaComponent, decorators: [{
175
180
  type: Component,
176
181
  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>" }]
177
182
  }] });
178
183
 
179
- class DatepickerComponent extends BaseFormControlComponent {
180
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
181
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: DatepickerComponent, isStandalone: true, selector: "base-datepicker", 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 [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$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3$1.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.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
184
+ class FlexBoxHostDirective {
185
+ viewContainerRef;
186
+ constructor(viewContainerRef) {
187
+ this.viewContainerRef = viewContainerRef;
188
+ }
189
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: FlexBoxHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
190
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: FlexBoxHostDirective, isStandalone: true, selector: "[flexBoxHost]", ngImport: i0 });
182
191
  }
183
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DatepickerComponent, decorators: [{
184
- type: Component,
185
- args: [{ selector: 'base-datepicker', standalone: true, imports: [CommonModule, FormsModule, MatFormFieldModule, MatInputModule, MatDatepickerModule, 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 [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" }]
186
- }] });
192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: FlexBoxHostDirective, decorators: [{
193
+ type: Directive,
194
+ args: [{
195
+ standalone: true,
196
+ selector: '[flexBoxHost]',
197
+ }]
198
+ }], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
187
199
 
188
- var BaseUrlSegments;
189
- (function (BaseUrlSegments) {
190
- BaseUrlSegments["DetailsForm"] = "details";
191
- BaseUrlSegments["Feed"] = "feed";
192
- BaseUrlSegments["ListForm"] = "list";
193
- BaseUrlSegments["NewEntity"] = "new";
194
- BaseUrlSegments["UnknownEntity"] = "unknown";
195
- })(BaseUrlSegments || (BaseUrlSegments = {}));
200
+ var FlexDirection;
201
+ (function (FlexDirection) {
202
+ FlexDirection[FlexDirection["CONTAINER"] = 0] = "CONTAINER";
203
+ FlexDirection[FlexDirection["COLUMN"] = 1] = "COLUMN";
204
+ FlexDirection[FlexDirection["ROW"] = 2] = "ROW";
205
+ })(FlexDirection || (FlexDirection = {}));
206
+ class FlexboxDescriptor extends AbstractAttrDescriptor {
207
+ attrDescriptors;
208
+ direction;
209
+ constructor(attrDescriptors, direction) {
210
+ super('dummy', FormControlType.FLEX_BOX);
211
+ this.attrDescriptors = attrDescriptors;
212
+ this.direction = direction;
213
+ }
214
+ }
196
215
 
197
- class ForeignKeyComponent extends BaseFormControlComponent {
198
- // region event handling methods
199
- navigateToRelated() {
200
- this.store.navigateToRelated(this.config().linkedEntityType, this.value());
216
+ class FlexBoxComponent extends BaseFormControlComponent {
217
+ flexBoxHost;
218
+ flexBoxClass = computed(() => this.calculateFlexStyle(this.config().direction));
219
+ // region protected, private helper methods
220
+ calculateFlexStyle(direction) {
221
+ switch (direction) {
222
+ case FlexDirection.CONTAINER:
223
+ return 'flex-box-container';
224
+ case FlexDirection.COLUMN:
225
+ return 'flex-box-container-columns';
226
+ case FlexDirection.ROW:
227
+ return 'flex-box-container-rows';
228
+ default:
229
+ throw new Error('Unknown flex direction');
230
+ }
201
231
  }
202
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: ForeignKeyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
203
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: ForeignKeyComponent, isStandalone: true, selector: "base-foreign-key", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{ config().attrName }}</mat-label>\n <input matInput formControlName=\"{{config().attrName}}\">\n </mat-form-field>\n <a (click)=\"navigateToRelated()\" aria-label=\"Related entity\">\n <mat-icon>link</mat-icon>\n </a>\n </div>\n</ng-container>", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
232
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: FlexBoxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
233
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", 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()\">\r\n <ng-template flexBoxHost></ng-template>\r\n</div>\r\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"] }] });
204
234
  }
205
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: ForeignKeyComponent, decorators: [{
235
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: FlexBoxComponent, decorators: [{
206
236
  type: Component,
207
- 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>" }]
208
- }] });
237
+ args: [{ selector: 'flex-box', imports: [FlexBoxHostDirective, NgClass, NgStyle], template: "<div [ngClass]=\"flexBoxClass()\" [ngStyle]=\"style()\">\r\n <ng-template flexBoxHost></ng-template>\r\n</div>\r\n", styles: [".flex-box-container{display:flex}.flex-box-container-columns{display:flex;flex-direction:column}.flex-box-container-rows{display:flex;flex-direction:row}\n"] }]
238
+ }], propDecorators: { flexBoxHost: [{
239
+ type: ViewChild,
240
+ args: [FlexBoxHostDirective, { static: true, read: FlexBoxHostDirective }]
241
+ }] } });
209
242
 
210
- class BaseEntityFormComponent {
211
- baseEntityForm;
212
- baseEntityListOptions = inject(ROUTER_OUTLET_DATA);
213
- entityId = input.required();
214
- componentHost;
215
- formBuilder = inject(FormBuilder);
216
- store = computed(() => this.baseEntityListOptions().store);
217
- isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity);
218
- entity = computed(() => (this.isNewObject() ? this.store().createEntity() : this.store().loadById(this.entityId())));
219
- constructor() {
220
- this.registerEffects();
243
+ class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
244
+ description;
245
+ styleClass = '';
246
+ labelClass = '';
247
+ format;
248
+ isLinkToDetails;
249
+ selectables;
250
+ visible = true;
251
+ isHeading;
252
+ placeholder;
253
+ lines;
254
+ options;
255
+ _label;
256
+ _linkedEntityType;
257
+ constructor(attrName, formControlType, label, selectables, isLinkToDetails, options) {
258
+ super(attrName, formControlType);
259
+ this.attrName = attrName;
260
+ this._label = label;
261
+ this.selectables = selectables;
262
+ this.isLinkToDetails = isLinkToDetails;
263
+ this.options = { inputType: 'text', ...options };
221
264
  }
222
- // region angular lifecycle hooks
223
- ngOnInit() {
224
- this.store().determineActiveRouteSegment();
225
- this.baseEntityForm = this.formBuilder.group({});
265
+ // region properties
266
+ get label() {
267
+ return this._label ? this._label : this.attrName;
226
268
  }
227
- // endregion
228
- // region event handlers
229
- async onCancel() {
230
- this.store().setCurrentEntity(undefined);
231
- await this.store().navigateBack();
269
+ set label(label) {
270
+ this._label = label;
232
271
  }
233
- async onSubmit() {
234
- const objectToSave = { ...this.entity(), ...this.baseEntityForm.value };
235
- if (this.isNewObject()) {
236
- this.store().save(objectToSave);
237
- }
238
- else {
239
- this.store().update(objectToSave, objectToSave.id);
240
- }
241
- this.store().setCurrentEntity(undefined);
242
- await this.store().navigateBack();
272
+ get linkedEntityType() {
273
+ return this._linkedEntityType;
243
274
  }
244
- // endregion
245
- // region protected, private helper methods
246
- buildForm() {
247
- this.componentHost.viewContainerRef.clear();
248
- const viewContainerRef = this.componentHost.viewContainerRef;
249
- this.baseEntityListOptions().columnDescriptors.forEach((column) => {
275
+ set linkedEntityType(linkedEntityType) {
276
+ this._linkedEntityType = linkedEntityType;
277
+ }
278
+ }
279
+
280
+ class BaseEntityFormBuilder {
281
+ // region public methods
282
+ buildForm(viewContainerRef, baseEntityForm, store, attrDescriptors, entity) {
283
+ viewContainerRef.clear();
284
+ attrDescriptors.forEach((column) => {
250
285
  const formControlType = this.createFormControl(column);
251
- const currentAttrValue = Reflect.get(this.entity(), column.attrName);
252
286
  if (formControlType) {
253
287
  const componentRef = viewContainerRef.createComponent(formControlType);
254
288
  componentRef.instance.config = signal(column);
255
- componentRef.instance.entity = this.entity;
256
- componentRef.instance.formGroup = this.baseEntityForm;
257
- componentRef.instance.store = this.store();
258
- componentRef.instance.value = signal(currentAttrValue);
259
- const formControl = new FormControl({ value: currentAttrValue, disabled: column.disabled }, Validators.required);
260
- this.baseEntityForm.addControl(column.attrName, formControl);
289
+ componentRef.instance.entity = entity;
290
+ componentRef.instance.formGroup = baseEntityForm;
291
+ componentRef.instance.store = store;
292
+ if (column instanceof BaseEntityAttrDescriptor) {
293
+ const currentAttrValue = Reflect.get(entity(), column.attrName);
294
+ componentRef.instance.value = signal(currentAttrValue);
295
+ const formControl = new FormControl({ value: currentAttrValue, disabled: column.disabled }, Validators.required);
296
+ baseEntityForm.addControl(column.attrName, formControl);
297
+ }
298
+ else if (column instanceof FlexboxDescriptor) {
299
+ this.buildForm(componentRef.instance.flexBoxHost.viewContainerRef, baseEntityForm, store, column.attrDescriptors, entity);
300
+ }
301
+ else
302
+ throw Error('Undefined subclass of AbstractAttrDescriptor');
261
303
  }
262
304
  });
263
305
  }
306
+ // endregion
307
+ // region protected, private helper methods
264
308
  createFormControl(column) {
265
309
  if (column.formControlType === FormControlType.LABEL) {
266
310
  return LabelComponent;
@@ -268,6 +312,9 @@ class BaseEntityFormComponent {
268
312
  else if (column.formControlType === FormControlType.DATE) {
269
313
  return DatepickerComponent;
270
314
  }
315
+ else if (column.formControlType === FormControlType.FLEX_BOX) {
316
+ return FlexBoxComponent;
317
+ }
271
318
  else if (column.formControlType === FormControlType.FOREIGN_KEY) {
272
319
  return ForeignKeyComponent;
273
320
  }
@@ -289,11 +336,56 @@ class BaseEntityFormComponent {
289
336
  else
290
337
  throw Error('Undefined form control type');
291
338
  }
339
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityFormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
340
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityFormBuilder, providedIn: 'root' });
341
+ }
342
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityFormBuilder, decorators: [{
343
+ type: Injectable,
344
+ args: [{ providedIn: 'root' }]
345
+ }] });
346
+
347
+ class BaseEntityFormComponent {
348
+ baseEntityForm;
349
+ baseEntityListOptions = inject(ROUTER_OUTLET_DATA);
350
+ entity = computed(() => (this.isNewObject() ? this.store().createEntity() : this.store().loadById(this.entityId())));
351
+ entityId = input.required();
352
+ componentHost;
353
+ store = computed(() => this.baseEntityListOptions().store);
354
+ entityFormBuilder = inject((BaseEntityFormBuilder));
355
+ formBuilder = inject(FormBuilder);
356
+ isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity);
357
+ constructor() {
358
+ this.registerEffects();
359
+ }
360
+ // region angular lifecycle hooks
361
+ ngOnInit() {
362
+ this.store().determineActiveRouteSegment();
363
+ this.baseEntityForm = this.formBuilder.group({});
364
+ }
365
+ // endregion
366
+ // region event handlers
367
+ async onCancel() {
368
+ this.store().setCurrentEntity(undefined);
369
+ await this.store().navigateBack();
370
+ }
371
+ async onSubmit() {
372
+ const objectToSave = { ...this.entity(), ...this.baseEntityForm.value };
373
+ if (this.isNewObject()) {
374
+ this.store().add(objectToSave);
375
+ }
376
+ else {
377
+ this.store().update(objectToSave, objectToSave.id);
378
+ }
379
+ this.store().setCurrentEntity(undefined);
380
+ await this.store().navigateBack();
381
+ }
382
+ // endregion
383
+ // region protected, private helper methods
292
384
  registerEffects() {
293
385
  effect(() => {
294
386
  if (this.entityId() && this.baseEntityListOptions() && this.entity())
295
387
  untracked(() => {
296
- this.buildForm();
388
+ this.entityFormBuilder.buildForm(this.componentHost.viewContainerRef, this.baseEntityForm, this.store(), this.baseEntityListOptions().attrDescriptors, this.entity);
297
389
  });
298
390
  });
299
391
  effect(() => {
@@ -301,53 +393,37 @@ class BaseEntityFormComponent {
301
393
  this.store().setCurrentEntity(this.entity().id);
302
394
  });
303
395
  }
304
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
305
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.4", type: BaseEntityFormComponent, isStandalone: true, selector: "base-form", inputs: { entityId: { classPropertyName: "entityId", publicName: "entityId", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }], viewQueries: [{ propertyName: "componentHost", first: true, predicate: BaseFormHostDirective, descendants: true, read: BaseFormHostDirective, static: true }], ngImport: i0, template: `
306
- <mat-card appearance="outlined" class="dense-3">
307
- <mat-card-content>
308
- <form [formGroup]="baseEntityForm" (ngSubmit)="onSubmit()">
309
- <ng-template baseFormHost></ng-template>
310
- </form>
311
- </mat-card-content>
312
- <mat-card-actions>
313
- <button id="cancel" mat-raised-button color="secondary" (click)="onCancel()">Cancel</button>
314
- <button id="submit" mat-raised-button color="primary" type="submit" [disabled]="baseEntityForm.invalid || !baseEntityForm.dirty" (click)="onSubmit()">Save</button>
315
- </mat-card-actions>
316
- </mat-card>
317
- `, isInline: true, dependencies: [{ kind: "directive", type: BaseFormHostDirective, selector: "[baseFormHost]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.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[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] });
396
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
397
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.2", 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\">\r\n <mat-card-content>\r\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\">\r\n <ng-template baseFormHost></ng-template>\r\n </form>\r\n </mat-card-content>\r\n <mat-card-actions>\r\n <button id=\"cancel\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\r\n <button id=\"submit\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"baseEntityForm.invalid || !baseEntityForm.dirty\" (click)=\"onSubmit()\">Save</button>\r\n </mat-card-actions>\r\n</mat-card>\r\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],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[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] });
318
398
  }
319
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityFormComponent, decorators: [{
399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityFormComponent, decorators: [{
320
400
  type: Component,
321
- args: [{
322
- selector: 'base-form',
323
- standalone: true,
324
- template: `
325
- <mat-card appearance="outlined" class="dense-3">
326
- <mat-card-content>
327
- <form [formGroup]="baseEntityForm" (ngSubmit)="onSubmit()">
328
- <ng-template baseFormHost></ng-template>
329
- </form>
330
- </mat-card-content>
331
- <mat-card-actions>
332
- <button id="cancel" mat-raised-button color="secondary" (click)="onCancel()">Cancel</button>
333
- <button id="submit" mat-raised-button color="primary" type="submit" [disabled]="baseEntityForm.invalid || !baseEntityForm.dirty" (click)="onSubmit()">Save</button>
334
- </mat-card-actions>
335
- </mat-card>
336
- `,
337
- imports: [BaseFormHostDirective, ReactiveFormsModule, MatCard, MatCardContent, MatCardActions, MatButton],
338
- providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }],
339
- }]
401
+ 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\">\r\n <mat-card-content>\r\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\">\r\n <ng-template baseFormHost></ng-template>\r\n </form>\r\n </mat-card-content>\r\n <mat-card-actions>\r\n <button id=\"cancel\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\r\n <button id=\"submit\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"baseEntityForm.invalid || !baseEntityForm.dirty\" (click)=\"onSubmit()\">Save</button>\r\n </mat-card-actions>\r\n</mat-card>\r\n" }]
340
402
  }], ctorParameters: () => [], propDecorators: { componentHost: [{
341
403
  type: ViewChild,
342
404
  args: [BaseFormHostDirective, { static: true, read: BaseFormHostDirective }]
343
405
  }] } });
344
406
 
407
+ function filterAttributeDescriptors(descriptors) {
408
+ let attrDescriptors = [];
409
+ descriptors.forEach((descriptor) => {
410
+ if (descriptor instanceof BaseEntityAttrDescriptor)
411
+ attrDescriptors.push(descriptor);
412
+ else if (descriptor instanceof FlexboxDescriptor) {
413
+ attrDescriptors = attrDescriptors.concat(filterAttributeDescriptors(descriptor.attrDescriptors));
414
+ }
415
+ });
416
+ return attrDescriptors;
417
+ }
418
+
345
419
  const BASE_LIST_DESCRIPTORS = new InjectionToken('BASE_TABLE_DISPLAYED_COLUMNS');
346
420
  class BaseEntityListComponent {
347
421
  dataSource = new MatTableDataSource();
348
422
  selection = new SelectionModel(true, []);
349
- baseEntityListOptions = inject(ROUTER_OUTLET_DATA);
350
- columnDescriptors = computed(() => this.baseEntityListOptions().columnDescriptors);
423
+ entityDescriptor = inject(ROUTER_OUTLET_DATA);
424
+ columnDescriptors = computed(() => {
425
+ return filterAttributeDescriptors(this.entityDescriptor().attrDescriptors);
426
+ });
351
427
  displayedColumns = computed(() => {
352
428
  const columns = this.columnDescriptors().map((column) => column.attrName);
353
429
  columns.unshift('select');
@@ -358,7 +434,7 @@ class BaseEntityListComponent {
358
434
  store;
359
435
  router = inject(Router);
360
436
  constructor() {
361
- this.store = this.baseEntityListOptions().store;
437
+ this.store = this.entityDescriptor().store;
362
438
  this.registerEffects();
363
439
  }
364
440
  // region Angular lifecycle events
@@ -418,9 +494,9 @@ class BaseEntityListComponent {
418
494
  return Reflect.get(entity, property);
419
495
  }
420
496
  loadAllData() {
421
- const path = new Map([]);
422
- const filter = new Map([]);
423
- this.store.load({ path, filter });
497
+ const pathParams = new Map([]);
498
+ const filters = [];
499
+ this.store.load({ pathParams, filters });
424
500
  }
425
501
  registerEffects() {
426
502
  effect(() => (this.dataSource.data = this.store.entities()));
@@ -439,10 +515,10 @@ class BaseEntityListComponent {
439
515
  isSelected(row) {
440
516
  return this.selection.isSelected(row);
441
517
  }
442
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
443
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: BaseEntityListComponent, isStandalone: true, selector: "base-list", viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "@if (store.isLoading()) {\r\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\r\n}\r\n<table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 demo-table\" matSort aria-describedby=\"base-entity-list\">\r\n <!-- Checkbox Column -->\r\n <ng-container matColumnDef=\"select\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container *ngFor=\"let colDescriptor of columnDescriptors(); index as i\" [matColumnDef]=\"colDescriptor.attrName\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</th>\r\n <td (click)=\"onRowClick(element)\" *matCellDef=\"let element\" mat-cell>\r\n @if (colDescriptor.isLinkToDetails === true) {\r\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\r\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\r\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\r\n } @else {\r\n {{ element[colDescriptor.attrName] }}\r\n }\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns()\"></tr>\r\n</table>\r\n<mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\r\n", styles: [".mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}\n"], dependencies: [{ kind: "component", type: MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "component", type: MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }] });
518
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
519
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", 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()) {\r\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\r\n}\r\n<table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 demo-table\" matSort aria-describedby=\"base-entity-list\">\r\n <!-- Checkbox Column -->\r\n <ng-container matColumnDef=\"select\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container *ngFor=\"let colDescriptor of columnDescriptors(); index as i\" [matColumnDef]=\"colDescriptor.attrName\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</th>\r\n <!-- //NOSONAR --><td (click)=\"onRowClick(element)\" *matCellDef=\"let element\" mat-cell>\r\n @if (colDescriptor.isLinkToDetails === true) {\r\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\r\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\r\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\r\n } @else {\r\n {{ element[colDescriptor.attrName] }}\r\n }\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns()\"></tr>\r\n</table>\r\n<mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\r\n", styles: [".mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}\n"], dependencies: [{ kind: "component", type: MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "component", type: MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }] });
444
520
  }
445
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityListComponent, decorators: [{
521
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityListComponent, decorators: [{
446
522
  type: Component,
447
523
  args: [{ selector: 'base-list', standalone: true, imports: [
448
524
  MatTable,
@@ -461,7 +537,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
461
537
  MatSortHeader,
462
538
  MatProgressBar,
463
539
  MatCheckbox,
464
- ], template: "@if (store.isLoading()) {\r\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\r\n}\r\n<table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 demo-table\" matSort aria-describedby=\"base-entity-list\">\r\n <!-- Checkbox Column -->\r\n <ng-container matColumnDef=\"select\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container *ngFor=\"let colDescriptor of columnDescriptors(); index as i\" [matColumnDef]=\"colDescriptor.attrName\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</th>\r\n <td (click)=\"onRowClick(element)\" *matCellDef=\"let element\" mat-cell>\r\n @if (colDescriptor.isLinkToDetails === true) {\r\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\r\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\r\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\r\n } @else {\r\n {{ element[colDescriptor.attrName] }}\r\n }\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns()\"></tr>\r\n</table>\r\n<mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\r\n", styles: [".mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}\n"] }]
540
+ ], template: "@if (store.isLoading()) {\r\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\r\n}\r\n<table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 demo-table\" matSort aria-describedby=\"base-entity-list\">\r\n <!-- Checkbox Column -->\r\n <ng-container matColumnDef=\"select\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container *ngFor=\"let colDescriptor of columnDescriptors(); index as i\" [matColumnDef]=\"colDescriptor.attrName\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</th>\r\n <!-- //NOSONAR --><td (click)=\"onRowClick(element)\" *matCellDef=\"let element\" mat-cell>\r\n @if (colDescriptor.isLinkToDetails === true) {\r\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\r\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\r\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\r\n } @else {\r\n {{ element[colDescriptor.attrName] }}\r\n }\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns()\"></tr>\r\n</table>\r\n<mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\r\n", styles: [".mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}\n"] }]
465
541
  }], ctorParameters: () => [], propDecorators: { sort: [{
466
542
  type: ViewChild,
467
543
  args: [MatSort]
@@ -495,21 +571,17 @@ var RouteSegments;
495
571
  })(RouteSegments || (RouteSegments = {}));
496
572
  const INITIAL_NAVIGATION_STATE = {
497
573
  activeRouteSegment: RouteSegments.LIST_ROUTE,
574
+ entityName: '',
498
575
  navigateTo: '',
499
576
  returnTo: '',
500
577
  };
501
- function entityName(entityType) {
502
- const entity = new entityType();
503
- return entity.constructor.name;
504
- }
505
- function snakeCaseName(entityType) {
506
- const nameOfEntity = entityName(entityType);
507
- return nameOfEntity
578
+ function snakeCaseName(entityName) {
579
+ return entityName
508
580
  .split(/(?=[A-Z])/)
509
581
  .join('-')
510
582
  .toLowerCase();
511
583
  }
512
- function BaseFormNavigatorStore(entityType) {
584
+ function BaseFormNavigatorStore(entityName) {
513
585
  return signalStoreFeature(withState(INITIAL_NAVIGATION_STATE), withMethods((store, router = inject(Router), route = inject(ActivatedRoute)) => {
514
586
  function determineActiveRouteSegment() {
515
587
  const currentUrl = Reflect.get(route, '_routerState').snapshot.url;
@@ -534,7 +606,7 @@ function BaseFormNavigatorStore(entityType) {
534
606
  function levelUpUrl(currentUrl) {
535
607
  return currentUrl.substring(0, currentUrl.lastIndexOf('/'));
536
608
  }
537
- function navigateBack(defaultUrl) {
609
+ async function navigateBack(defaultUrl) {
538
610
  const goTo = store.returnTo() ? store.returnTo() : defaultUrl;
539
611
  patchState(store, { returnTo: '' });
540
612
  if (goTo) {
@@ -544,26 +616,26 @@ function BaseFormNavigatorStore(entityType) {
544
616
  .catch((error) => patchState(store, { navigationError: error.message }));
545
617
  }
546
618
  else
547
- navigateToList();
619
+ await navigateToList();
548
620
  }
549
621
  async function navigateToDetails(id, returnTo) {
550
622
  if (store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
551
- const snakeCaseEntityName = snakeCaseName(entityType);
623
+ const snakeCaseEntityName = snakeCaseName(entityName);
552
624
  const baseUrl = determineBaseUrl();
553
625
  const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
554
626
  await navigateToUrl(detailsFormPath, returnTo);
555
627
  }
556
628
  }
557
629
  async function navigateToList(returnTo) {
558
- const snakeCaseEntityName = snakeCaseName(entityType);
630
+ const snakeCaseEntityName = snakeCaseName(entityName);
559
631
  const baseUrl = determineBaseUrl();
560
632
  const goToUrl = baseUrl + '/' + snakeCaseEntityName + '/list';
561
633
  if (store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
562
634
  await navigateToUrl(goToUrl, returnTo);
563
635
  }
564
636
  }
565
- async function navigateToRelated(relatedType, id, returnTo) {
566
- const snakeCaseEntityName = snakeCaseName(relatedType);
637
+ async function navigateToRelated(relatedTypeName, id, returnTo) {
638
+ const snakeCaseEntityName = snakeCaseName(relatedTypeName);
567
639
  const baseUrl = determineBaseUrl();
568
640
  const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
569
641
  await navigateToUrl(detailsFormPath, returnTo);
@@ -615,10 +687,10 @@ class BaseEntityToolbarComponent {
615
687
  // endregion
616
688
  // protected, private helper methods
617
689
  RouteSegments = RouteSegments;
618
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
619
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: BaseEntityToolbarComponent, isStandalone: true, selector: "base-entity-toolbar", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"store.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input test-id=\"filter-input\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\n </mat-form-field>\n </div>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu test-id=\"menu\" #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button test-id=\"add\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-menu-item [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"add\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.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[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { 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"] }] });
690
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
691
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: BaseEntityToolbarComponent, isStandalone: true, selector: "base-entity-toolbar", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"store.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input test-id=\"filter-input\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\n </mat-form-field>\n </div>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu test-id=\"menu\" #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button test-id=\"add\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-menu-item [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"add\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { 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"] }] });
620
692
  }
621
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
693
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
622
694
  type: Component,
623
695
  args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbar, MatIcon, MatFormField, MatInput, MatButton, MatMenu, MatMenuItem, MatMenuTrigger], template: "<mat-toolbar *ngIf=\"store.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <div class=\"dense-3\" [ngStyle]=\"{'padding-top': '12px' }\">\n <mat-form-field>\n <input test-id=\"filter-input\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\" placeholder=\"Filter\">\n </mat-form-field>\n </div>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu test-id=\"menu\" #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button test-id=\"add\" mat-menu-item (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-menu-item [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"add\" mat-button (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button test-id=\"delete\" mat-button [disabled]=\"store.selectedEntities().length === 0\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>" }]
624
696
  }] });
@@ -626,16 +698,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
626
698
  class BaseEntityStatusbarComponent {
627
699
  store;
628
700
  baseEntityListOptions = input.required();
629
- entityTitle = computed(() => eval(this.baseEntityListOptions().entityTitle));
701
+ entityTitle = computed(() => this.evaluateEntityTitle(this.baseEntityListOptions().entityTitle));
630
702
  isVisible = computed(() => this.store.currentEntity() != undefined || this.store.selectedEntities().length == 1);
631
703
  // region Angular lifecycle hooks
632
704
  ngOnInit() {
633
705
  this.store = this.baseEntityListOptions().store;
634
706
  }
635
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityStatusbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
636
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.4", type: BaseEntityStatusbarComponent, isStandalone: true, selector: "base-entity-statusbar", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"isVisible()\">\n <div>\n <span>{{entityTitle()}}</span>\n </div>\n</mat-toolbar>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }] });
707
+ // endregion
708
+ // event handling methods
709
+ // endregion
710
+ // protected, private helper methods
711
+ evaluateEntityTitle(title) {
712
+ return eval(title); //NOSONAR the value title comes from a trusted source
713
+ }
714
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityStatusbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
715
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.2", type: BaseEntityStatusbarComponent, isStandalone: true, selector: "base-entity-statusbar", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mat-toolbar *ngIf=\"isVisible()\">\n <div>\n <span>{{entityTitle()}}</span>\n </div>\n</mat-toolbar>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }] });
637
716
  }
638
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityStatusbarComponent, decorators: [{
717
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityStatusbarComponent, decorators: [{
639
718
  type: Component,
640
719
  args: [{ selector: 'base-entity-statusbar', standalone: true, imports: [CommonModule, MatToolbar], template: "<mat-toolbar *ngIf=\"isVisible()\">\n <div>\n <span>{{entityTitle()}}</span>\n </div>\n</mat-toolbar>" }]
641
720
  }] });
@@ -684,12 +763,12 @@ class BaseEntityTabsComponent {
684
763
  }
685
764
  });
686
765
  }
687
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
688
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.4", type: BaseEntityTabsComponent, isStandalone: true, selector: "base-entity-tabs", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<nav mat-tab-nav-bar [tabPanel]=\"tabPanel\">\n <a mat-tab-link (click)=\"onShowList()\" [active]=\"store.currentTab() === listTabName()\">{{listTabName()}}</a>\n <a mat-tab-link [disabled]=\"store.currentEntity() === undefined\" (click)=\"onShowDetails()\" [active]=\"store.currentTab() === detailsTabName()\">{{detailsTabName()}}</a>\n</nav>\n\n<mat-tab-nav-panel #tabPanel>\n <base-entity-statusbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <base-entity-toolbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <router-outlet [routerOutletData]=\"baseEntityListOptions()\"/>\n</mat-tab-nav-panel>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: MatTabNav, selector: "[mat-tab-nav-bar]", inputs: ["fitInkBarToContent", "mat-stretch-tabs", "animationDuration", "backgroundColor", "disableRipple", "color", "tabPanel"], exportAs: ["matTabNavBar", "matTabNav"] }, { kind: "component", type: MatTabLink, selector: "[mat-tab-link], [matTabLink]", inputs: ["active", "disabled", "disableRipple", "tabIndex", "id"], exportAs: ["matTabLink"] }, { kind: "component", type: MatTabNavPanel, selector: "mat-tab-nav-panel", inputs: ["id"], exportAs: ["matTabNavPanel"] }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: BaseEntityToolbarComponent, selector: "base-entity-toolbar", inputs: ["baseEntityListOptions"] }, { kind: "component", type: BaseEntityStatusbarComponent, selector: "base-entity-statusbar", inputs: ["baseEntityListOptions"] }] });
766
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
767
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.2", type: BaseEntityTabsComponent, isStandalone: true, selector: "base-entity-tabs", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<nav mat-tab-nav-bar [tabPanel]=\"tabPanel\">\r\n <a mat-tab-link (click)=\"onShowList()\" [active]=\"store.currentTab() === listTabName()\">{{listTabName()}}</a>\r\n <a mat-tab-link [disabled]=\"store.currentEntity() === undefined\" (click)=\"onShowDetails()\" [active]=\"store.currentTab() === detailsTabName()\">{{detailsTabName()}}</a>\r\n</nav>\r\n\r\n<mat-tab-nav-panel #tabPanel>\r\n <base-entity-statusbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\r\n <base-entity-toolbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\r\n <router-outlet [routerOutletData]=\"baseEntityListOptions()\"/>\r\n</mat-tab-nav-panel>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: MatTabNav, selector: "[mat-tab-nav-bar]", inputs: ["fitInkBarToContent", "mat-stretch-tabs", "animationDuration", "backgroundColor", "disableRipple", "color", "tabPanel"], exportAs: ["matTabNavBar", "matTabNav"] }, { kind: "component", type: MatTabLink, selector: "[mat-tab-link], [matTabLink]", inputs: ["active", "disabled", "disableRipple", "tabIndex", "id"], exportAs: ["matTabLink"] }, { kind: "component", type: MatTabNavPanel, selector: "mat-tab-nav-panel", inputs: ["id"], exportAs: ["matTabNavPanel"] }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: BaseEntityToolbarComponent, selector: "base-entity-toolbar", inputs: ["baseEntityListOptions"] }, { kind: "component", type: BaseEntityStatusbarComponent, selector: "base-entity-statusbar", inputs: ["baseEntityListOptions"] }] });
689
768
  }
690
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityTabsComponent, decorators: [{
769
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityTabsComponent, decorators: [{
691
770
  type: Component,
692
- args: [{ selector: 'base-entity-tabs', standalone: true, imports: [CommonModule, MatTabNav, MatTabLink, MatTabNavPanel, RouterOutlet, BaseEntityToolbarComponent, BaseEntityStatusbarComponent], template: "<nav mat-tab-nav-bar [tabPanel]=\"tabPanel\">\n <a mat-tab-link (click)=\"onShowList()\" [active]=\"store.currentTab() === listTabName()\">{{listTabName()}}</a>\n <a mat-tab-link [disabled]=\"store.currentEntity() === undefined\" (click)=\"onShowDetails()\" [active]=\"store.currentTab() === detailsTabName()\">{{detailsTabName()}}</a>\n</nav>\n\n<mat-tab-nav-panel #tabPanel>\n <base-entity-statusbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <base-entity-toolbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\n <router-outlet [routerOutletData]=\"baseEntityListOptions()\"/>\n</mat-tab-nav-panel>" }]
771
+ args: [{ selector: 'base-entity-tabs', standalone: true, imports: [CommonModule, MatTabNav, MatTabLink, MatTabNavPanel, RouterOutlet, BaseEntityToolbarComponent, BaseEntityStatusbarComponent], template: "<nav mat-tab-nav-bar [tabPanel]=\"tabPanel\">\r\n <a mat-tab-link (click)=\"onShowList()\" [active]=\"store.currentTab() === listTabName()\">{{listTabName()}}</a>\r\n <a mat-tab-link [disabled]=\"store.currentEntity() === undefined\" (click)=\"onShowDetails()\" [active]=\"store.currentTab() === detailsTabName()\">{{detailsTabName()}}</a>\r\n</nav>\r\n\r\n<mat-tab-nav-panel #tabPanel>\r\n <base-entity-statusbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\r\n <base-entity-toolbar [baseEntityListOptions]=\"baseEntityListOptions()\"/>\r\n <router-outlet [routerOutletData]=\"baseEntityListOptions()\"/>\r\n</mat-tab-nav-panel>" }]
693
772
  }], ctorParameters: () => [] });
694
773
 
695
774
  class BaseEntityContainerComponent {
@@ -716,24 +795,34 @@ class BaseEntityContainerComponent {
716
795
  }
717
796
  });
718
797
  }
719
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
720
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.4", type: BaseEntityContainerComponent, isStandalone: true, selector: "base-entity-container", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
721
- <div>
722
- <base-entity-tabs [baseEntityListOptions]="baseEntityListOptions()"></base-entity-tabs>
723
- </div>
724
- `, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BaseEntityTabsComponent, selector: "base-entity-tabs", inputs: ["baseEntityListOptions"] }] });
798
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
799
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.2", type: BaseEntityContainerComponent, isStandalone: true, selector: "base-entity-container", inputs: { baseEntityListOptions: { classPropertyName: "baseEntityListOptions", publicName: "baseEntityListOptions", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
800
+ <div>
801
+ <base-entity-tabs [baseEntityListOptions]="baseEntityListOptions()"></base-entity-tabs>
802
+ </div>
803
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BaseEntityTabsComponent, selector: "base-entity-tabs", inputs: ["baseEntityListOptions"] }] });
725
804
  }
726
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseEntityContainerComponent, decorators: [{
805
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseEntityContainerComponent, decorators: [{
727
806
  type: Component,
728
- args: [{ selector: 'base-entity-container', standalone: true, imports: [CommonModule, BaseEntityTabsComponent], template: `
729
- <div>
730
- <base-entity-tabs [baseEntityListOptions]="baseEntityListOptions()"></base-entity-tabs>
731
- </div>
732
- ` }]
807
+ args: [{
808
+ selector: 'base-entity-container',
809
+ standalone: true,
810
+ imports: [CommonModule, BaseEntityTabsComponent],
811
+ template: `
812
+ <div>
813
+ <base-entity-tabs [baseEntityListOptions]="baseEntityListOptions()"></base-entity-tabs>
814
+ </div>
815
+ `,
816
+ }]
733
817
  }], ctorParameters: () => [] });
734
818
 
735
- const BASE_ENTITY_SERVICE = new InjectionToken('BASE_ENTITY_SERVICE');
736
- let BaseEntityService = class BaseEntityService {
819
+ var OrderByDirection;
820
+ (function (OrderByDirection) {
821
+ OrderByDirection["ASC"] = "asc";
822
+ OrderByDirection["DESC"] = "desc";
823
+ })(OrderByDirection || (OrderByDirection = {}));
824
+
825
+ let BaseEntityRestService = class BaseEntityRestService {
737
826
  entityMapper;
738
827
  urlProperty;
739
828
  resourceUrl;
@@ -760,19 +849,33 @@ let BaseEntityService = class BaseEntityService {
760
849
  deleteAll() {
761
850
  return this.httpClient.delete(this.resourceUrl, { headers: this.headers });
762
851
  }
763
- findAll(path, filter, page) {
764
- const fullUrl = this.buildFullUrl(this.resourceUrl, path, filter, page);
852
+ findAll(page) {
853
+ return this.findByQuery({ page });
854
+ }
855
+ findByQuery(queryCondition) {
856
+ const fullUrl = this.buildFullUrl(this.resourceUrl, queryCondition);
765
857
  if (fullUrl) {
766
858
  return this.httpClient.get(fullUrl, { headers: this.headers }).pipe(map((httpResponse) => {
767
- return page ? this.mapPagedResponse(httpResponse) : this.mapSimpleResponse(httpResponse);
859
+ return queryCondition.page ? this.mapPagedResponse(httpResponse) : this.mapSimpleResponse(httpResponse);
768
860
  }));
769
861
  }
770
862
  else
771
863
  throw new Error('Could not determine the full url');
772
864
  }
773
- save(entity, id) {
865
+ findById(id) {
866
+ const queryCondition = { pathParams: new Map([['id', id]]) };
867
+ const fullUrl = this.buildFullUrl(this.resourceUrl, queryCondition);
868
+ if (fullUrl) {
869
+ return this.httpClient.get(fullUrl, { headers: this.headers }).pipe(map((httpResponse) => {
870
+ return this.mapSimpleResponse(httpResponse);
871
+ }));
872
+ }
873
+ else
874
+ throw new Error('Could not determine the full url');
875
+ }
876
+ add(entity, id) {
774
877
  const dto = this.entityMapper.toDto(entity);
775
- const fullUrl = this.buildFullUrl(this.resourceUrl);
878
+ const fullUrl = this.buildFullUrl(this.resourceUrl, {});
776
879
  if (fullUrl) {
777
880
  return this.httpClient.post(fullUrl, dto, { headers: this.headers }).pipe(map((response) => {
778
881
  return this.entityMapper.fromDto(response, id);
@@ -783,9 +886,8 @@ let BaseEntityService = class BaseEntityService {
783
886
  }
784
887
  update(entity) {
785
888
  const dto = this.entityMapper.toDto(entity);
786
- const path = new Map([['id', String(entity.id)]]);
787
- const filter = new Map([]);
788
- const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}', path, filter);
889
+ const pathParams = new Map([['id', String(entity.id)]]);
890
+ const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}', { pathParams });
789
891
  if (fullUrl) {
790
892
  return this.httpClient.put(fullUrl, dto, { headers: this.headers }).pipe(map((response) => {
791
893
  return this.entityMapper.fromDto(response);
@@ -796,14 +898,12 @@ let BaseEntityService = class BaseEntityService {
796
898
  }
797
899
  // endregion
798
900
  // region protected, private helper methods
799
- buildFullUrl(resourceUri, path, filter, page, hash) {
800
- const pageParam = new Map(page ? [['page', page.toString()]] : []);
801
- let queryParams;
802
- if (filter !== undefined && filter.size != 0) {
803
- queryParams = new Map([...Array.from(pageParam), ...Array.from(filter.entries())]);
804
- }
805
- else {
806
- queryParams = new Map([...Array.from(pageParam)]);
901
+ buildFullUrl(resourceUri, queryCondition) {
902
+ const queryParams = new Map();
903
+ if (queryCondition.page)
904
+ queryParams.set('page', queryCondition.page.toString());
905
+ if (queryCondition.filters !== undefined && queryCondition.filters.length != 0) {
906
+ queryCondition.filters.forEach((filter) => queryParams.set(filter.property, filter.value));
807
907
  }
808
908
  let params = {};
809
909
  if (queryParams.size > 0) {
@@ -813,15 +913,15 @@ let BaseEntityService = class BaseEntityService {
813
913
  }
814
914
  else
815
915
  params = null;
816
- if (path !== undefined && path.size != 0) {
817
- path.forEach((value, key) => {
916
+ if (queryCondition.pathParams !== undefined && queryCondition.pathParams.size != 0) {
917
+ queryCondition.pathParams.forEach((value, key) => {
818
918
  const pathParam = '%{' + key + '}';
819
919
  resourceUri = resourceUri.replace(pathParam, value);
820
920
  });
821
921
  }
822
922
  const urlOptions = {
823
923
  path: resourceUri,
824
- hash: hash,
924
+ hash: queryCondition.hash,
825
925
  queryParams: params,
826
926
  };
827
927
  return buildUrl(this.baseUrl, urlOptions);
@@ -849,10 +949,10 @@ let BaseEntityService = class BaseEntityService {
849
949
  }
850
950
  }
851
951
  };
852
- BaseEntityService = __decorate([
952
+ BaseEntityRestService = __decorate([
853
953
  __param(0, Inject('entityMapper')),
854
954
  __metadata("design:paramtypes", [Object, String, String])
855
- ], BaseEntityService);
955
+ ], BaseEntityRestService);
856
956
 
857
957
  const INITIAL_TABS_STATE = {
858
958
  activeTabs: [],
@@ -882,6 +982,93 @@ function BaseEntityTabsStore() {
882
982
  }));
883
983
  }
884
984
 
985
+ const BASE_ENTITY_SERVICE = new InjectionToken('BASE_ENTITY_SERVICE');
986
+
987
+ const addEntity = (store, repository) => {
988
+ return rxMethod(pipe(switchMap((entity) => {
989
+ patchState(store, { isLoading: true, error: undefined });
990
+ return repository.add(entity).pipe(tapResponse({
991
+ next: (savedEntity) => {
992
+ patchState(store, { entities: store.entities().concat([savedEntity]), isLoading: false });
993
+ },
994
+ error: (error) => patchState(store, { error: error.message }),
995
+ finalize: () => patchState(store, { isLoading: false }),
996
+ }));
997
+ })));
998
+ };
999
+
1000
+ const deleteEntity = (store, repository) => {
1001
+ return rxMethod(pipe(tap(() => patchState(store, { isLoading: true, error: undefined })), switchMap((id) => {
1002
+ return repository.delete(id).pipe(tapResponse({
1003
+ next: () => {
1004
+ const remainingEntities = store.entities().filter((entity) => entity.id !== id);
1005
+ patchState(store, { entities: remainingEntities, isLoading: false });
1006
+ },
1007
+ error: (error) => patchState(store, { error: error.message }),
1008
+ finalize: () => patchState(store, { isLoading: false }),
1009
+ }));
1010
+ })));
1011
+ };
1012
+
1013
+ const deleteAllEntities = (store, repository) => {
1014
+ return rxMethod(pipe(switchMap(() => {
1015
+ patchState(store, { isLoading: true, error: undefined });
1016
+ return repository.deleteAll().pipe(tapResponse({
1017
+ next: () => patchState(store, { entities: [], isLoading: false }),
1018
+ error: (error) => patchState(store, { error: error.message }),
1019
+ finalize: () => patchState(store, { isLoading: false }),
1020
+ }));
1021
+ })));
1022
+ };
1023
+
1024
+ const updateEntity = (store, repository) => {
1025
+ return rxMethod(pipe(switchMap((entity) => {
1026
+ patchState(store, { isLoading: true, error: undefined });
1027
+ return repository.update(entity).pipe(tapResponse({
1028
+ next: (updatedEntity) => {
1029
+ const currentEntities = store.entities();
1030
+ const indexToUpdate = currentEntities.findIndex((item) => item.id === entity.id);
1031
+ currentEntities[indexToUpdate] = updatedEntity;
1032
+ patchState(store, { entities: [...currentEntities], isLoading: false });
1033
+ },
1034
+ error: (error) => patchState(store, { error: error.message }),
1035
+ finalize: () => patchState(store, { isLoading: false }),
1036
+ }));
1037
+ })));
1038
+ };
1039
+
1040
+ const findByQuery = (store, repository) => {
1041
+ return rxMethod(pipe(tap((query) => patchState(store, { page: query.page, isLoading: true, error: undefined })),
1042
+ // debounceTime(1000),
1043
+ // distinctUntilChanged(),
1044
+ switchMap((parameters) => repository.findByQuery(parameters).pipe(tapResponse({
1045
+ next: (response) => {
1046
+ if (Object.prototype.hasOwnProperty.call(response, 'content')) {
1047
+ const baseEntityResponse = response;
1048
+ patchState(store, {
1049
+ entities: baseEntityResponse.content,
1050
+ page: baseEntityResponse.page,
1051
+ pageSize: baseEntityResponse.pageSize,
1052
+ totalPageCount: baseEntityResponse.totalPageCount,
1053
+ isLoading: false,
1054
+ });
1055
+ }
1056
+ else {
1057
+ const entities = response.slice();
1058
+ patchState(store, {
1059
+ entities,
1060
+ page: undefined,
1061
+ pageSize: entities.length,
1062
+ totalPageCount: undefined,
1063
+ isLoading: false,
1064
+ });
1065
+ }
1066
+ },
1067
+ error: (error) => patchState(store, { error: error.message }),
1068
+ finalize: () => patchState(store, { isLoading: false }),
1069
+ })))));
1070
+ };
1071
+
885
1072
  const BASE_ENTITY_STORE = new InjectionToken('BASE_ENTITY_STORE');
886
1073
  function BaseEntityStore(entityType, repositoryType) {
887
1074
  return signalStoreFeature(withState({
@@ -896,27 +1083,10 @@ function BaseEntityStore(entityType, repositoryType) {
896
1083
  selectedEntities: [],
897
1084
  }), withMethods((store, repository = inject(repositoryType)) => ({
898
1085
  clearCurrentEntity: () => patchState(store, { currentEntity: undefined }),
899
- createEntity: () => {
900
- return new entityType();
901
- },
902
- delete: rxMethod(pipe(tap(() => patchState(store, { isLoading: true, error: undefined })), switchMap((id) => {
903
- return repository.delete(id).pipe(tapResponse({
904
- next: () => {
905
- const remainingEntities = store.entities().filter((entity) => entity.id !== id);
906
- patchState(store, { entities: remainingEntities, isLoading: false });
907
- },
908
- error: (error) => patchState(store, { error: error.message }),
909
- finalize: () => patchState(store, { isLoading: false }),
910
- }));
911
- }))),
912
- deleteAll: rxMethod(pipe(switchMap(() => {
913
- patchState(store, { isLoading: true, error: undefined });
914
- return repository.deleteAll().pipe(tapResponse({
915
- next: () => patchState(store, { entities: [], isLoading: false }),
916
- error: (error) => patchState(store, { error: error.message }),
917
- finalize: () => patchState(store, { isLoading: false }),
918
- }));
919
- }))),
1086
+ createEntity: () => new entityType(),
1087
+ add: addEntity(store, repository),
1088
+ delete: deleteEntity(store, repository),
1089
+ deleteAll: deleteAllEntities(store, repository),
920
1090
  deselectAll: () => {
921
1091
  patchState(store, { selectedEntities: [] });
922
1092
  },
@@ -931,49 +1101,11 @@ function BaseEntityStore(entityType, repositoryType) {
931
1101
  }
932
1102
  }
933
1103
  },
934
- load: rxMethod(pipe(tap((parameters) => patchState(store, { page: parameters.page, isLoading: true, error: undefined })),
935
- // debounceTime(1000),
936
- // distinctUntilChanged(),
937
- switchMap((parameters) => repository.findAll(parameters.path, parameters.filter, parameters.page).pipe(tapResponse({
938
- next: (response) => {
939
- if (Object.prototype.hasOwnProperty.call(response, 'content')) {
940
- const baseEntityResponse = response;
941
- patchState(store, {
942
- entities: baseEntityResponse.content,
943
- page: baseEntityResponse.page,
944
- pageSize: baseEntityResponse.pageSize,
945
- totalPageCount: baseEntityResponse.totalPageCount,
946
- isLoading: false,
947
- });
948
- }
949
- else {
950
- const entities = response.slice();
951
- patchState(store, {
952
- entities,
953
- page: undefined,
954
- pageSize: entities.length,
955
- totalPageCount: undefined,
956
- isLoading: false,
957
- });
958
- }
959
- },
960
- error: (error) => patchState(store, { error: error.message }),
961
- finalize: () => patchState(store, { isLoading: false }),
962
- }))))),
1104
+ load: findByQuery(store, repository),
963
1105
  loadById: (id) => {
964
1106
  return store.entities().find((entity) => entity.id === id);
965
1107
  },
966
1108
  resetErrorState: () => patchState(store, { error: undefined }),
967
- save: rxMethod(pipe(switchMap((entity) => {
968
- patchState(store, { isLoading: true, error: undefined });
969
- return repository.save(entity).pipe(tapResponse({
970
- next: (savedEntity) => {
971
- patchState(store, { entities: store.entities().concat([savedEntity]), isLoading: false });
972
- },
973
- error: (error) => patchState(store, { error: error.message }),
974
- finalize: () => patchState(store, { isLoading: false }),
975
- }));
976
- }))),
977
1109
  selectEntity: (id) => {
978
1110
  const foundEntity = store.entities() && store.entities().length > 0 ? store.entities().filter((entity) => entity.id === id) : undefined;
979
1111
  if (foundEntity && foundEntity.length == 1 && store.selectedEntities().indexOf(foundEntity[0]) == -1) {
@@ -988,24 +1120,10 @@ function BaseEntityStore(entityType, repositoryType) {
988
1120
  else
989
1121
  patchState(store, { currentEntity: undefined, currentId: undefined });
990
1122
  },
991
- update: rxMethod(pipe(switchMap((entity) => {
992
- patchState(store, { isLoading: true, error: undefined });
993
- return repository.update(entity).pipe(tapResponse({
994
- next: (updatedEntity) => {
995
- const currentEntities = store.entities();
996
- const indexToUpdate = currentEntities.findIndex((item) => item.id === entity.id);
997
- currentEntities[indexToUpdate] = updatedEntity;
998
- patchState(store, { entities: [...currentEntities], isLoading: false });
999
- },
1000
- error: (error) => patchState(store, { error: error.message }),
1001
- finalize: () => patchState(store, { isLoading: false }),
1002
- }));
1003
- }))),
1123
+ update: updateEntity(store, repository),
1004
1124
  })), withHooks((store) => ({
1005
1125
  onInit: () => {
1006
- const path = new Map([]);
1007
- const filter = new Map([]);
1008
- store.load({ path, filter });
1126
+ store.load({});
1009
1127
  },
1010
1128
  })), withComputed((store) => ({
1011
1129
  countOfEntities: computed(() => store.entities().length),
@@ -1013,13 +1131,121 @@ function BaseEntityStore(entityType, repositoryType) {
1013
1131
  })));
1014
1132
  }
1015
1133
 
1016
- /*
1017
- * Public API Surface of @processpuzzle/base-entity
1018
- */
1134
+ let BaseEntityFirestoreService = class BaseEntityFirestoreService {
1135
+ entityMapper;
1136
+ collectionName;
1137
+ collection;
1138
+ firestore = inject(Firestore);
1139
+ constructor(entityMapper, collectionName) {
1140
+ this.entityMapper = entityMapper;
1141
+ this.collectionName = collectionName;
1142
+ this.collection = collection(this.firestore, collectionName);
1143
+ }
1144
+ // region public accessors and mutators
1145
+ add(entity) {
1146
+ if (!entity)
1147
+ throw new Error('Entity cant be undefined');
1148
+ return from(this.addAsync(entity));
1149
+ }
1150
+ delete(id) {
1151
+ const docRef = doc(this.firestore, this.collectionName, id);
1152
+ return from(deleteDoc(docRef));
1153
+ }
1154
+ deleteAll() {
1155
+ return of(undefined);
1156
+ }
1157
+ findAll(page, pageSize) {
1158
+ return this.findByQuery({ page, pageSize });
1159
+ }
1160
+ findById(id) {
1161
+ const docRef = doc(this.firestore, this.collectionName, id);
1162
+ return from(getDoc(docRef)
1163
+ .then((document) => {
1164
+ return this.mapDocument(document.data());
1165
+ })
1166
+ .catch((error) => {
1167
+ throw new Error(`Error: ${error} occurred while finding document by id: ${id}`);
1168
+ }));
1169
+ }
1170
+ findByQuery(queryCondition) {
1171
+ return from(this.findByQueryAsync(queryCondition));
1172
+ }
1173
+ update(entity) {
1174
+ return from(this.updateAsync(entity));
1175
+ }
1176
+ // endregion
1177
+ // protected, private helper methods
1178
+ async addAsync(entity) {
1179
+ const newDoc = doc(this.collection, entity.id);
1180
+ await setDoc(newDoc, this.mapEntity(entity));
1181
+ return new Promise((resolve, reject) => {
1182
+ resolve(entity);
1183
+ reject(new Error('Failed to update entity: ' + entity));
1184
+ });
1185
+ }
1186
+ createQuery(queryCondition) {
1187
+ let orderBys = [];
1188
+ if (queryCondition.orderBys && queryCondition.orderBys?.length > 0) {
1189
+ orderBys = queryCondition.orderBys?.map((orderByCondition) => {
1190
+ const name = Object.keys(OrderByDirection).filter((key) => key === orderByCondition.direction);
1191
+ const direction = Object.values(OrderByDirection).filter((value) => value === name[0]);
1192
+ return orderBy(orderByCondition.property, direction[0]);
1193
+ });
1194
+ }
1195
+ let wheres = [];
1196
+ if (queryCondition.filters && queryCondition.filters?.length > 0) {
1197
+ wheres =
1198
+ queryCondition.filters?.map((filter) => {
1199
+ return where(filter.property, filter.operator, filter.value);
1200
+ }) ?? [];
1201
+ }
1202
+ return query(this.collection, ...wheres, ...orderBys, limit(queryCondition.pageSize ?? 99));
1203
+ }
1204
+ async findByQueryAsync(queryCondition) {
1205
+ const query = this.createQuery(queryCondition);
1206
+ const results = await getDocs(query);
1207
+ const content = [];
1208
+ results.docs.forEach((doc) => {
1209
+ content.push(this.mapDocument({ id: doc.id, ...doc.data() }));
1210
+ });
1211
+ return Promise.resolve({
1212
+ page: queryCondition.page,
1213
+ pageSize: queryCondition.pageSize,
1214
+ totalPageCount: 1,
1215
+ content,
1216
+ });
1217
+ }
1218
+ mapCollection(collection) {
1219
+ const entities = [];
1220
+ collection.pipe(map((documents) => {
1221
+ documents.forEach((document) => entities.push(this.entityMapper.fromDto(document)));
1222
+ }));
1223
+ return entities;
1224
+ }
1225
+ mapDocument(document) {
1226
+ return this.entityMapper.fromDto(document);
1227
+ }
1228
+ mapEntity(entity) {
1229
+ return this.entityMapper.toDto(entity);
1230
+ }
1231
+ async updateAsync(entity) {
1232
+ if (!entity)
1233
+ throw new Error('Entity cant be undefined');
1234
+ const docRef = doc(this.firestore, this.collectionName, entity.id);
1235
+ await updateDoc(docRef, this.mapEntity(entity));
1236
+ return Promise.resolve(entity);
1237
+ }
1238
+ };
1239
+ BaseEntityFirestoreService = __decorate([
1240
+ __param(0, Inject('entityMapper')),
1241
+ __metadata("design:paramtypes", [Object, String])
1242
+ ], BaseEntityFirestoreService);
1243
+
1244
+ // Public API Surface of @processpuzzle/base-entity
1019
1245
 
1020
1246
  /**
1021
1247
  * Generated bundle index. Do not edit.
1022
1248
  */
1023
1249
 
1024
- export { BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorStore, FormControlType };
1250
+ export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorStore, FlexDirection, FlexboxDescriptor, FormControlType, OrderByDirection };
1025
1251
  //# sourceMappingURL=processpuzzle-base-entity.mjs.map