@processpuzzle/base-entity 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { signalStoreFeature, withState, withMethods, patchState, withHooks, withComputed } from '@ngrx/signals';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
3
|
import { Directive, input, computed, Component, ViewChild, signal, Injectable, inject, effect, untracked, InjectionToken, Inject } from '@angular/core';
|
|
3
4
|
import * as i1$1 from '@angular/forms';
|
|
4
5
|
import { ReactiveFormsModule, FormsModule, FormControl, Validators, FormBuilder } from '@angular/forms';
|
|
5
|
-
import { ROUTER_OUTLET_DATA, Router, ActivatedRoute
|
|
6
|
+
import { ROUTER_OUTLET_DATA, Router, ActivatedRoute } from '@angular/router';
|
|
6
7
|
import { MatCard, MatCardContent, MatCardActions } from '@angular/material/card';
|
|
7
8
|
import * as i3 from '@angular/material/form-field';
|
|
8
9
|
import { MatFormFieldModule, MatLabel, MatFormField, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
@@ -22,18 +23,10 @@ import { MatSort, MatSortHeader } from '@angular/material/sort';
|
|
|
22
23
|
import { MatPaginator } from '@angular/material/paginator';
|
|
23
24
|
import { MatProgressBar } from '@angular/material/progress-bar';
|
|
24
25
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
25
|
-
import { signalStoreFeature, withState, withMethods, patchState, withHooks, withComputed } from '@ngrx/signals';
|
|
26
|
-
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
|
27
|
-
import { MatToolbar } from '@angular/material/toolbar';
|
|
28
|
-
import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
|
29
|
-
import { LayoutService, RUNTIME_CONFIGURATION } from '@processpuzzle/util';
|
|
30
|
-
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
31
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
32
|
-
import { map, pipe, switchMap, tap, from, of } from 'rxjs';
|
|
33
|
-
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
34
|
-
import { buildUrl } from 'build-url-ts';
|
|
35
26
|
import { tapResponse } from '@ngrx/operators';
|
|
36
27
|
import { rxMethod } from '@ngrx/signals/rxjs-interop';
|
|
28
|
+
import { pipe, switchMap, tap, from, of, map } from 'rxjs';
|
|
29
|
+
import { __decorate, __param } from 'tslib';
|
|
37
30
|
import { Firestore, collection, doc, deleteDoc, getDoc, setDoc, orderBy, where, query, limit, getDocs, updateDoc } from '@angular/fire/firestore';
|
|
38
31
|
import 'reflect-metadata';
|
|
39
32
|
|
|
@@ -61,15 +54,64 @@ class AbstractAttrDescriptor {
|
|
|
61
54
|
}
|
|
62
55
|
}
|
|
63
56
|
|
|
57
|
+
const INITIAL_CONTAINER_STATE = {
|
|
58
|
+
filterKey: undefined,
|
|
59
|
+
};
|
|
60
|
+
function BaseEntityContainerStore() {
|
|
61
|
+
return signalStoreFeature(withState(INITIAL_CONTAINER_STATE), withMethods((store) => {
|
|
62
|
+
function doFilter(filterKey) {
|
|
63
|
+
patchState(store, { filterKey });
|
|
64
|
+
}
|
|
65
|
+
return { doFilter };
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
70
|
+
description;
|
|
71
|
+
styleClass = '';
|
|
72
|
+
labelClass = '';
|
|
73
|
+
format;
|
|
74
|
+
isLinkToDetails;
|
|
75
|
+
selectables;
|
|
76
|
+
visible = true;
|
|
77
|
+
isHeading;
|
|
78
|
+
placeholder;
|
|
79
|
+
lines;
|
|
80
|
+
options;
|
|
81
|
+
_label;
|
|
82
|
+
_linkedEntityType;
|
|
83
|
+
constructor(attrName, formControlType, label, selectables, isLinkToDetails, options) {
|
|
84
|
+
super(attrName, formControlType);
|
|
85
|
+
this.attrName = attrName;
|
|
86
|
+
this._label = label;
|
|
87
|
+
this.selectables = selectables;
|
|
88
|
+
this.isLinkToDetails = isLinkToDetails;
|
|
89
|
+
this.options = { inputType: 'text', ...options };
|
|
90
|
+
}
|
|
91
|
+
// region properties
|
|
92
|
+
get label() {
|
|
93
|
+
return this._label ? this._label : this.attrName;
|
|
94
|
+
}
|
|
95
|
+
set label(label) {
|
|
96
|
+
this._label = label;
|
|
97
|
+
}
|
|
98
|
+
get linkedEntityType() {
|
|
99
|
+
return this._linkedEntityType;
|
|
100
|
+
}
|
|
101
|
+
set linkedEntityType(linkedEntityType) {
|
|
102
|
+
this._linkedEntityType = linkedEntityType;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
64
106
|
class BaseFormHostDirective {
|
|
65
107
|
viewContainerRef;
|
|
66
108
|
constructor(viewContainerRef) {
|
|
67
109
|
this.viewContainerRef = viewContainerRef;
|
|
68
110
|
}
|
|
69
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
70
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
111
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseFormHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
112
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: BaseFormHostDirective, isStandalone: true, selector: "[baseFormHost]", ngImport: i0 });
|
|
71
113
|
}
|
|
72
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseFormHostDirective, decorators: [{
|
|
73
115
|
type: Directive,
|
|
74
116
|
args: [{
|
|
75
117
|
standalone: true,
|
|
@@ -87,16 +129,16 @@ var BaseUrlSegments;
|
|
|
87
129
|
})(BaseUrlSegments || (BaseUrlSegments = {}));
|
|
88
130
|
|
|
89
131
|
class BaseFormControlComponent {
|
|
90
|
-
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
91
|
-
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
132
|
+
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
133
|
+
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
|
|
92
134
|
formGroup;
|
|
93
135
|
store;
|
|
94
|
-
style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : []));
|
|
95
|
-
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
96
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
97
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
136
|
+
style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
|
|
137
|
+
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
138
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseFormControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
139
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.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 }] });
|
|
98
140
|
}
|
|
99
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseFormControlComponent, decorators: [{
|
|
100
142
|
type: Component,
|
|
101
143
|
args: [{
|
|
102
144
|
standalone: true,
|
|
@@ -106,19 +148,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
106
148
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
|
|
107
149
|
|
|
108
150
|
class LabelComponent extends BaseFormControlComponent {
|
|
109
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
110
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
151
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: LabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
152
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.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"] }] });
|
|
111
153
|
}
|
|
112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: LabelComponent, decorators: [{
|
|
113
155
|
type: Component,
|
|
114
156
|
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>" }]
|
|
115
157
|
}] });
|
|
116
158
|
|
|
117
159
|
class DatepickerComponent extends BaseFormControlComponent {
|
|
118
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
119
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
160
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
161
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: DatepickerComponent, isStandalone: true, selector: "base-datepicker", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" style=\"margin-bottom: 10px\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" formControlName=\"{{config().attrName}}\">\n <mat-hint>MM-DD-YYYY</mat-hint>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n </div>\n</ng-container>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i5.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
120
162
|
}
|
|
121
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
122
164
|
type: Component,
|
|
123
165
|
args: [{ selector: 'base-datepicker', standalone: true, imports: [CommonModule, FormsModule, MatFormFieldModule, MatInputModule, MatDatepickerModule, ReactiveFormsModule], template: "<ng-container *ngIf=\"config().visible\">\n <div class=\"row\" style=\"margin-bottom: 10px\" [formGroup]=\"formGroup\">\n <mat-form-field>\n <mat-label>{{config().label}}</mat-label>\n <input matInput [matDatepicker]=\"picker\" formControlName=\"{{config().attrName}}\">\n <mat-hint>MM-DD-YYYY</mat-hint>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n </div>\n</ng-container>\n" }]
|
|
124
166
|
}] });
|
|
@@ -128,55 +170,55 @@ class ForeignKeyComponent extends BaseFormControlComponent {
|
|
|
128
170
|
navigateToRelated() {
|
|
129
171
|
this.store.navigateToRelated(this.config().linkedEntityType, this.value());
|
|
130
172
|
}
|
|
131
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
132
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
173
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ForeignKeyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.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$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
133
175
|
}
|
|
134
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ForeignKeyComponent, decorators: [{
|
|
135
177
|
type: Component,
|
|
136
178
|
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
179
|
}] });
|
|
138
180
|
|
|
139
181
|
class TextboxComponent extends BaseFormControlComponent {
|
|
140
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
141
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
182
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
183
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.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$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
142
184
|
}
|
|
143
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextboxComponent, decorators: [{
|
|
144
186
|
type: Component,
|
|
145
187
|
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>" }]
|
|
146
188
|
}] });
|
|
147
189
|
|
|
148
190
|
class DropdownComponent extends BaseFormControlComponent {
|
|
149
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
150
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
191
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
192
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] });
|
|
151
193
|
}
|
|
152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
153
195
|
type: Component,
|
|
154
196
|
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>" }]
|
|
155
197
|
}] });
|
|
156
198
|
|
|
157
199
|
class CheckboxComponent extends BaseFormControlComponent {
|
|
158
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
159
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
200
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
201
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
160
202
|
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
162
204
|
type: Component,
|
|
163
205
|
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"] }]
|
|
164
206
|
}] });
|
|
165
207
|
|
|
166
208
|
class RadioComponent extends BaseFormControlComponent {
|
|
167
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
168
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
209
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
210
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.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$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
169
211
|
}
|
|
170
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: RadioComponent, decorators: [{
|
|
171
213
|
type: Component,
|
|
172
214
|
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>" }]
|
|
173
215
|
}] });
|
|
174
216
|
|
|
175
217
|
class TextareaComponent extends BaseFormControlComponent {
|
|
176
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
177
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
218
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
219
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.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$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
178
220
|
}
|
|
179
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
180
222
|
type: Component,
|
|
181
223
|
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>" }]
|
|
182
224
|
}] });
|
|
@@ -186,10 +228,10 @@ class FlexBoxHostDirective {
|
|
|
186
228
|
constructor(viewContainerRef) {
|
|
187
229
|
this.viewContainerRef = viewContainerRef;
|
|
188
230
|
}
|
|
189
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
190
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
231
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FlexBoxHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
232
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: FlexBoxHostDirective, isStandalone: true, selector: "[flexBoxHost]", ngImport: i0 });
|
|
191
233
|
}
|
|
192
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FlexBoxHostDirective, decorators: [{
|
|
193
235
|
type: Directive,
|
|
194
236
|
args: [{
|
|
195
237
|
standalone: true,
|
|
@@ -215,7 +257,7 @@ class FlexboxDescriptor extends AbstractAttrDescriptor {
|
|
|
215
257
|
|
|
216
258
|
class FlexBoxComponent extends BaseFormControlComponent {
|
|
217
259
|
flexBoxHost;
|
|
218
|
-
flexBoxClass = computed(() => this.calculateFlexStyle(this.config().direction), ...(ngDevMode ? [{ debugName: "flexBoxClass" }] : []));
|
|
260
|
+
flexBoxClass = computed(() => this.calculateFlexStyle(this.config().direction), ...(ngDevMode ? [{ debugName: "flexBoxClass" }] : /* istanbul ignore next */ []));
|
|
219
261
|
// region protected, private helper methods
|
|
220
262
|
calculateFlexStyle(direction) {
|
|
221
263
|
switch (direction) {
|
|
@@ -229,10 +271,10 @@ class FlexBoxComponent extends BaseFormControlComponent {
|
|
|
229
271
|
throw new Error('Unknown flex direction');
|
|
230
272
|
}
|
|
231
273
|
}
|
|
232
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
233
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
274
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FlexBoxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
275
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: FlexBoxComponent, isStandalone: true, selector: "flex-box", viewQueries: [{ propertyName: "flexBoxHost", first: true, predicate: FlexBoxHostDirective, descendants: true, read: FlexBoxHostDirective, static: true }], usesInheritance: true, ngImport: i0, template: "<div [ngClass]=\"flexBoxClass()\" [ngStyle]=\"style()\">\n <ng-template flexBoxHost></ng-template>\n</div>\n", styles: [".flex-box-container{display:flex}.flex-box-container-columns{display:flex;flex-direction:column}.flex-box-container-rows{display:flex;flex-direction:row}\n"], dependencies: [{ kind: "directive", type: FlexBoxHostDirective, selector: "[flexBoxHost]" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
234
276
|
}
|
|
235
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FlexBoxComponent, decorators: [{
|
|
236
278
|
type: Component,
|
|
237
279
|
args: [{ selector: 'flex-box', imports: [FlexBoxHostDirective, NgClass, NgStyle], template: "<div [ngClass]=\"flexBoxClass()\" [ngStyle]=\"style()\">\n <ng-template flexBoxHost></ng-template>\n</div>\n", styles: [".flex-box-container{display:flex}.flex-box-container-columns{display:flex;flex-direction:column}.flex-box-container-rows{display:flex;flex-direction:row}\n"] }]
|
|
238
280
|
}], propDecorators: { flexBoxHost: [{
|
|
@@ -240,43 +282,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
240
282
|
args: [FlexBoxHostDirective, { static: true, read: FlexBoxHostDirective }]
|
|
241
283
|
}] } });
|
|
242
284
|
|
|
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 };
|
|
264
|
-
}
|
|
265
|
-
// region properties
|
|
266
|
-
get label() {
|
|
267
|
-
return this._label ? this._label : this.attrName;
|
|
268
|
-
}
|
|
269
|
-
set label(label) {
|
|
270
|
-
this._label = label;
|
|
271
|
-
}
|
|
272
|
-
get linkedEntityType() {
|
|
273
|
-
return this._linkedEntityType;
|
|
274
|
-
}
|
|
275
|
-
set linkedEntityType(linkedEntityType) {
|
|
276
|
-
this._linkedEntityType = linkedEntityType;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
285
|
class BaseEntityFormBuilder {
|
|
281
286
|
// region public methods
|
|
282
287
|
buildForm(viewContainerRef, baseEntityForm, store, attrDescriptors, entity) {
|
|
@@ -285,13 +290,13 @@ class BaseEntityFormBuilder {
|
|
|
285
290
|
const formControlType = this.createFormControl(column);
|
|
286
291
|
if (formControlType) {
|
|
287
292
|
const componentRef = viewContainerRef.createComponent(formControlType);
|
|
288
|
-
componentRef.instance.config = signal(column, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
293
|
+
componentRef.instance.config = signal(column, ...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
289
294
|
componentRef.instance.entity = entity;
|
|
290
295
|
componentRef.instance.formGroup = baseEntityForm;
|
|
291
296
|
componentRef.instance.store = store;
|
|
292
297
|
if (column instanceof BaseEntityAttrDescriptor) {
|
|
293
298
|
const currentAttrValue = Reflect.get(entity(), column.attrName);
|
|
294
|
-
componentRef.instance.value = signal(currentAttrValue, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
299
|
+
componentRef.instance.value = signal(currentAttrValue, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
295
300
|
const formControl = new FormControl({ value: currentAttrValue, disabled: column.disabled }, Validators.required);
|
|
296
301
|
baseEntityForm.addControl(column.attrName, formControl);
|
|
297
302
|
}
|
|
@@ -336,10 +341,10 @@ class BaseEntityFormBuilder {
|
|
|
336
341
|
else
|
|
337
342
|
throw Error('Undefined form control type');
|
|
338
343
|
}
|
|
339
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
340
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
344
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
345
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormBuilder, providedIn: 'root' });
|
|
341
346
|
}
|
|
342
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormBuilder, decorators: [{
|
|
343
348
|
type: Injectable,
|
|
344
349
|
args: [{ providedIn: 'root' }]
|
|
345
350
|
}] });
|
|
@@ -347,13 +352,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
347
352
|
class BaseEntityFormComponent {
|
|
348
353
|
baseEntityForm;
|
|
349
354
|
baseEntityListOptions = inject(ROUTER_OUTLET_DATA);
|
|
350
|
-
entity = computed(() => (this.isNewObject() ? this.store().createEntity() : this.store().loadById(this.entityId())), ...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
351
|
-
entityId = input.required(...(ngDevMode ? [{ debugName: "entityId" }] : []));
|
|
355
|
+
entity = computed(() => (this.isNewObject() ? this.store().createEntity() : this.store().loadById(this.entityId())), ...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
|
|
356
|
+
entityId = input.required(...(ngDevMode ? [{ debugName: "entityId" }] : /* istanbul ignore next */ []));
|
|
352
357
|
componentHost;
|
|
353
|
-
store = computed(() => this.baseEntityListOptions().store, ...(ngDevMode ? [{ debugName: "store" }] : []));
|
|
358
|
+
store = computed(() => this.baseEntityListOptions().store, ...(ngDevMode ? [{ debugName: "store" }] : /* istanbul ignore next */ []));
|
|
354
359
|
entityFormBuilder = inject((BaseEntityFormBuilder));
|
|
355
360
|
formBuilder = inject(FormBuilder);
|
|
356
|
-
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : []));
|
|
361
|
+
isNewObject = computed(() => this.entityId() === BaseUrlSegments.NewEntity, ...(ngDevMode ? [{ debugName: "isNewObject" }] : /* istanbul ignore next */ []));
|
|
357
362
|
constructor() {
|
|
358
363
|
this.registerEffects();
|
|
359
364
|
}
|
|
@@ -393,10 +398,10 @@ class BaseEntityFormComponent {
|
|
|
393
398
|
this.store().setCurrentEntity(this.entity().id);
|
|
394
399
|
});
|
|
395
400
|
}
|
|
396
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
397
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
401
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
402
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.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: "<mat-card appearance=\"outlined\" class=\"dense-3\">\n <mat-card-content>\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\">\n <ng-template baseFormHost></ng-template>\n </form>\n </mat-card-content>\n <mat-card-actions>\n <button id=\"cancel\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\n <button id=\"submit\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"baseEntityForm.invalid || !baseEntityForm.dirty\" (click)=\"onSubmit()\">Save</button>\n </mat-card-actions>\n</mat-card>\n", dependencies: [{ kind: "directive", type: BaseFormHostDirective, selector: "[baseFormHost]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }] });
|
|
398
403
|
}
|
|
399
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
404
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityFormComponent, decorators: [{
|
|
400
405
|
type: Component,
|
|
401
406
|
args: [{ selector: 'base-form', standalone: true, imports: [BaseFormHostDirective, ReactiveFormsModule, MatCard, MatCardContent, MatCardActions, MatButton], providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }], template: "<mat-card appearance=\"outlined\" class=\"dense-3\">\n <mat-card-content>\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\">\n <ng-template baseFormHost></ng-template>\n </form>\n </mat-card-content>\n <mat-card-actions>\n <button id=\"cancel\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\n <button id=\"submit\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"baseEntityForm.invalid || !baseEntityForm.dirty\" (click)=\"onSubmit()\">Save</button>\n </mat-card-actions>\n</mat-card>\n" }]
|
|
402
407
|
}], ctorParameters: () => [], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }], componentHost: [{
|
|
@@ -423,12 +428,12 @@ class BaseEntityListComponent {
|
|
|
423
428
|
entityDescriptor = inject(ROUTER_OUTLET_DATA);
|
|
424
429
|
columnDescriptors = computed(() => {
|
|
425
430
|
return filterAttributeDescriptors(this.entityDescriptor().attrDescriptors);
|
|
426
|
-
}, ...(ngDevMode ? [{ debugName: "columnDescriptors" }] : []));
|
|
431
|
+
}, ...(ngDevMode ? [{ debugName: "columnDescriptors" }] : /* istanbul ignore next */ []));
|
|
427
432
|
displayedColumns = computed(() => {
|
|
428
433
|
const columns = this.columnDescriptors().map((column) => column.attrName);
|
|
429
434
|
columns.unshift('select');
|
|
430
435
|
return columns;
|
|
431
|
-
}, ...(ngDevMode ? [{ debugName: "displayedColumns" }] : []));
|
|
436
|
+
}, ...(ngDevMode ? [{ debugName: "displayedColumns" }] : /* istanbul ignore next */ []));
|
|
432
437
|
sort = {};
|
|
433
438
|
paginator = {};
|
|
434
439
|
store;
|
|
@@ -515,10 +520,10 @@ class BaseEntityListComponent {
|
|
|
515
520
|
isSelected(row) {
|
|
516
521
|
return this.selection.isSelected(row);
|
|
517
522
|
}
|
|
518
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
519
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
523
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
524
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.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()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 demo-table\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <th mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </td>\n </ng-container>\n\n <ng-container *ngFor=\"let colDescriptor of columnDescriptors(); index as i\" [matColumnDef]=\"colDescriptor.attrName\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</th>\n <!-- //NOSONAR --><td (click)=\"onRowClick(element)\" *matCellDef=\"let element\" mat-cell>\n @if (colDescriptor.isLinkToDetails === true) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns()\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns()\"></tr>\n</table>\n<mat-paginator [pageSizeOptions]=\"[3, 5, 8]\" showFirstLastButtons></mat-paginator>\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"] }] });
|
|
520
525
|
}
|
|
521
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
526
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BaseEntityListComponent, decorators: [{
|
|
522
527
|
type: Component,
|
|
523
528
|
args: [{ selector: 'base-list', standalone: true, imports: [
|
|
524
529
|
MatTable,
|
|
@@ -546,414 +551,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
546
551
|
args: [MatPaginator]
|
|
547
552
|
}] } });
|
|
548
553
|
|
|
549
|
-
const BASE_ENTITY_ROUTES = [
|
|
550
|
-
{ path: '', redirectTo: 'list', pathMatch: 'full' },
|
|
551
|
-
{ path: ':id/details', component: BaseEntityFormComponent },
|
|
552
|
-
{ path: 'list', component: BaseEntityListComponent },
|
|
553
|
-
];
|
|
554
|
-
|
|
555
|
-
const INITIAL_CONTAINER_STATE = {
|
|
556
|
-
filterKey: undefined,
|
|
557
|
-
};
|
|
558
|
-
function BaseEntityContainerStore() {
|
|
559
|
-
return signalStoreFeature(withState(INITIAL_CONTAINER_STATE), withMethods((store) => {
|
|
560
|
-
function doFilter(filterKey) {
|
|
561
|
-
patchState(store, { filterKey });
|
|
562
|
-
}
|
|
563
|
-
return { doFilter };
|
|
564
|
-
}));
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
var RouteSegments;
|
|
568
|
-
(function (RouteSegments) {
|
|
569
|
-
RouteSegments["LIST_ROUTE"] = "LIST_ROUTE";
|
|
570
|
-
RouteSegments["DETAILS_ROUTE"] = "DETAILS_ROUTE";
|
|
571
|
-
})(RouteSegments || (RouteSegments = {}));
|
|
572
|
-
const INITIAL_NAVIGATION_STATE = {
|
|
573
|
-
activeRouteSegment: RouteSegments.LIST_ROUTE,
|
|
574
|
-
entityName: '',
|
|
575
|
-
navigateTo: '',
|
|
576
|
-
returnTo: '',
|
|
577
|
-
};
|
|
578
|
-
function snakeCaseName(entityName) {
|
|
579
|
-
return entityName
|
|
580
|
-
.split(/(?=[A-Z])/)
|
|
581
|
-
.join('-')
|
|
582
|
-
.toLowerCase();
|
|
583
|
-
}
|
|
584
|
-
function BaseFormNavigatorStore(entityName) {
|
|
585
|
-
return signalStoreFeature(withState(INITIAL_NAVIGATION_STATE), withMethods((store, router = inject(Router), route = inject(ActivatedRoute)) => {
|
|
586
|
-
function determineActiveRouteSegment() {
|
|
587
|
-
const currentUrl = Reflect.get(route, '_routerState').snapshot.url;
|
|
588
|
-
if (currentUrl.endsWith(BaseUrlSegments.ListForm)) {
|
|
589
|
-
patchState(store, { activeRouteSegment: RouteSegments.LIST_ROUTE });
|
|
590
|
-
}
|
|
591
|
-
else if (currentUrl.endsWith(BaseUrlSegments.DetailsForm)) {
|
|
592
|
-
patchState(store, { activeRouteSegment: RouteSegments.DETAILS_ROUTE });
|
|
593
|
-
}
|
|
594
|
-
else {
|
|
595
|
-
patchState(store, { activeRouteSegment: undefined });
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
function determineBaseUrl() {
|
|
599
|
-
determineActiveRouteSegment();
|
|
600
|
-
const currentUrl = determineCurrentUrl();
|
|
601
|
-
return store.activeRouteSegment() === RouteSegments.DETAILS_ROUTE ? levelUpUrl(levelUpUrl(levelUpUrl(currentUrl))) : levelUpUrl(levelUpUrl(currentUrl));
|
|
602
|
-
}
|
|
603
|
-
function determineCurrentUrl() {
|
|
604
|
-
return Reflect.get(route, '_routerState').snapshot.url;
|
|
605
|
-
}
|
|
606
|
-
function levelUpUrl(currentUrl) {
|
|
607
|
-
return currentUrl.substring(0, currentUrl.lastIndexOf('/'));
|
|
608
|
-
}
|
|
609
|
-
async function navigateBack(defaultUrl) {
|
|
610
|
-
const goTo = store.returnTo() ? store.returnTo() : defaultUrl;
|
|
611
|
-
patchState(store, { returnTo: '' });
|
|
612
|
-
if (goTo) {
|
|
613
|
-
router
|
|
614
|
-
.navigateByUrl(goTo)
|
|
615
|
-
.then()
|
|
616
|
-
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
617
|
-
}
|
|
618
|
-
else
|
|
619
|
-
await navigateToList();
|
|
620
|
-
}
|
|
621
|
-
async function navigateToDetails(id, returnTo) {
|
|
622
|
-
if (store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
623
|
-
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
624
|
-
const baseUrl = determineBaseUrl();
|
|
625
|
-
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
626
|
-
await navigateToUrl(detailsFormPath, returnTo);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
async function navigateToList(returnTo) {
|
|
630
|
-
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
631
|
-
const baseUrl = determineBaseUrl();
|
|
632
|
-
const goToUrl = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
633
|
-
if (store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
634
|
-
await navigateToUrl(goToUrl, returnTo);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
async function navigateToRelated(relatedTypeName, id, returnTo) {
|
|
638
|
-
const snakeCaseEntityName = snakeCaseName(relatedTypeName);
|
|
639
|
-
const baseUrl = determineBaseUrl();
|
|
640
|
-
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
641
|
-
await navigateToUrl(detailsFormPath, returnTo);
|
|
642
|
-
}
|
|
643
|
-
async function navigateToUrl(url, returnTo) {
|
|
644
|
-
if (!returnTo)
|
|
645
|
-
patchState(store, { returnTo: router.url });
|
|
646
|
-
else
|
|
647
|
-
patchState(store, { returnTo });
|
|
648
|
-
patchState(store, { navigateTo: url });
|
|
649
|
-
await router
|
|
650
|
-
.navigateByUrl(url)
|
|
651
|
-
.then(() => determineActiveRouteSegment())
|
|
652
|
-
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
653
|
-
}
|
|
654
|
-
return { determineCurrentUrl, determineActiveRouteSegment, navigateBack, navigateToDetails, navigateToList, navigateToRelated, navigateToUrl };
|
|
655
|
-
}), withHooks((store) => ({
|
|
656
|
-
onInit: () => {
|
|
657
|
-
store.determineActiveRouteSegment();
|
|
658
|
-
},
|
|
659
|
-
})));
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
class BaseEntityToolbarComponent {
|
|
663
|
-
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : []));
|
|
664
|
-
layoutService = inject(LayoutService);
|
|
665
|
-
store;
|
|
666
|
-
// region Angular lifecycle hooks
|
|
667
|
-
ngOnInit() {
|
|
668
|
-
this.store = this.baseEntityListOptions().store;
|
|
669
|
-
}
|
|
670
|
-
// endregion
|
|
671
|
-
// event handling methods
|
|
672
|
-
onAddEntity() {
|
|
673
|
-
this.store.navigateToDetails(BaseUrlSegments.NewEntity);
|
|
674
|
-
}
|
|
675
|
-
onDeleteEntities() {
|
|
676
|
-
this.store.selectedEntities().forEach((entity) => this.store.delete(entity.id));
|
|
677
|
-
}
|
|
678
|
-
onDoFilter($event) {
|
|
679
|
-
const filterValue = $event.target.value;
|
|
680
|
-
this.store.doFilter(filterValue);
|
|
681
|
-
}
|
|
682
|
-
// endregion
|
|
683
|
-
// public queries and mutators
|
|
684
|
-
isSmallDevice() {
|
|
685
|
-
return this.layoutService.isSmallDevice();
|
|
686
|
-
}
|
|
687
|
-
// endregion
|
|
688
|
-
// protected, private helper methods
|
|
689
|
-
RouteSegments = RouteSegments;
|
|
690
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
691
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", 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[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }] });
|
|
692
|
-
}
|
|
693
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
|
|
694
|
-
type: Component,
|
|
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>" }]
|
|
696
|
-
}], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
697
|
-
|
|
698
|
-
class BaseEntityStatusbarComponent {
|
|
699
|
-
store;
|
|
700
|
-
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : []));
|
|
701
|
-
entityTitle = computed(() => this.evaluateEntityTitle(this.baseEntityListOptions().entityTitle), ...(ngDevMode ? [{ debugName: "entityTitle" }] : []));
|
|
702
|
-
isVisible = computed(() => this.store.currentEntity() != undefined || this.store.selectedEntities().length == 1, ...(ngDevMode ? [{ debugName: "isVisible" }] : []));
|
|
703
|
-
// region Angular lifecycle hooks
|
|
704
|
-
ngOnInit() {
|
|
705
|
-
this.store = this.baseEntityListOptions().store;
|
|
706
|
-
}
|
|
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: "20.3.9", ngImport: i0, type: BaseEntityStatusbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
715
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.9", 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"] }] });
|
|
716
|
-
}
|
|
717
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityStatusbarComponent, decorators: [{
|
|
718
|
-
type: Component,
|
|
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>" }]
|
|
720
|
-
}], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
721
|
-
|
|
722
|
-
class BaseEntityTabsComponent {
|
|
723
|
-
store;
|
|
724
|
-
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : []));
|
|
725
|
-
selectedEntityId = computed(() => (this.store.currentId() ? this.store.currentId() : BaseUrlSegments.NewEntity), ...(ngDevMode ? [{ debugName: "selectedEntityId" }] : []));
|
|
726
|
-
detailsTabName = computed(() => this.baseEntityListOptions().entityName + ' - details', ...(ngDevMode ? [{ debugName: "detailsTabName" }] : []));
|
|
727
|
-
listTabName = computed(() => this.baseEntityListOptions().entityName + ' - list', ...(ngDevMode ? [{ debugName: "listTabName" }] : []));
|
|
728
|
-
constructor() {
|
|
729
|
-
this.registerEffects();
|
|
730
|
-
}
|
|
731
|
-
// region angular lifecycle hooks
|
|
732
|
-
ngOnDestroy() {
|
|
733
|
-
this.store.tabIsInactive(this.listTabName());
|
|
734
|
-
this.store.tabIsInactive(this.detailsTabName());
|
|
735
|
-
}
|
|
736
|
-
ngOnInit() {
|
|
737
|
-
this.store = this.baseEntityListOptions().store;
|
|
738
|
-
}
|
|
739
|
-
// endregion
|
|
740
|
-
// region event handlers
|
|
741
|
-
async onShowDetails() {
|
|
742
|
-
if (this.store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
743
|
-
const id = this.selectedEntityId() ? this.selectedEntityId() : BaseUrlSegments.NewEntity;
|
|
744
|
-
await this.store.navigateToDetails(id);
|
|
745
|
-
this.store.tabIsActive(this.detailsTabName());
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
async onShowList() {
|
|
749
|
-
if (this.store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
750
|
-
await this.store.navigateToList(this.baseEntityListOptions().entityName);
|
|
751
|
-
this.store.tabIsActive(this.listTabName());
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
// endregion
|
|
755
|
-
// region protected, private helper methods
|
|
756
|
-
registerEffects() {
|
|
757
|
-
effect(() => {
|
|
758
|
-
if (this.store.activeRouteSegment() === RouteSegments.DETAILS_ROUTE) {
|
|
759
|
-
this.store.tabIsActive(this.detailsTabName());
|
|
760
|
-
}
|
|
761
|
-
else {
|
|
762
|
-
this.store.tabIsActive(this.listTabName());
|
|
763
|
-
}
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
767
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.9", 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"] }] });
|
|
768
|
-
}
|
|
769
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityTabsComponent, decorators: [{
|
|
770
|
-
type: Component,
|
|
771
|
-
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>" }]
|
|
772
|
-
}], ctorParameters: () => [], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
773
|
-
|
|
774
|
-
class BaseEntityContainerComponent {
|
|
775
|
-
baseEntityListOptions = input.required(...(ngDevMode ? [{ debugName: "baseEntityListOptions" }] : []));
|
|
776
|
-
snackBar = inject(MatSnackBar);
|
|
777
|
-
store;
|
|
778
|
-
constructor() {
|
|
779
|
-
this.registerEffects();
|
|
780
|
-
}
|
|
781
|
-
// region Angular lifecycle hooks
|
|
782
|
-
ngOnDestroy() {
|
|
783
|
-
this.store.reset();
|
|
784
|
-
}
|
|
785
|
-
ngOnInit() {
|
|
786
|
-
this.store = this.baseEntityListOptions().store;
|
|
787
|
-
}
|
|
788
|
-
// endregion
|
|
789
|
-
// region protected, private helper methods
|
|
790
|
-
registerEffects() {
|
|
791
|
-
effect(() => {
|
|
792
|
-
if (this.store.error()) {
|
|
793
|
-
const errorMessage = this.store.error() ? this.store.error() : 'Undefined Error';
|
|
794
|
-
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
|
|
795
|
-
}
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
799
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.9", 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"] }] });
|
|
804
|
-
}
|
|
805
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BaseEntityContainerComponent, decorators: [{
|
|
806
|
-
type: Component,
|
|
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
|
-
}]
|
|
817
|
-
}], ctorParameters: () => [], propDecorators: { baseEntityListOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseEntityListOptions", required: true }] }] } });
|
|
818
|
-
|
|
819
554
|
var OrderByDirection;
|
|
820
555
|
(function (OrderByDirection) {
|
|
821
556
|
OrderByDirection["ASC"] = "asc";
|
|
822
557
|
OrderByDirection["DESC"] = "desc";
|
|
823
558
|
})(OrderByDirection || (OrderByDirection = {}));
|
|
824
559
|
|
|
825
|
-
let BaseEntityRestService = class BaseEntityRestService {
|
|
826
|
-
entityMapper;
|
|
827
|
-
urlProperty;
|
|
828
|
-
resourceUrl;
|
|
829
|
-
runtimeConfiguration = inject(RUNTIME_CONFIGURATION);
|
|
830
|
-
baseUrl;
|
|
831
|
-
httpClient = inject(HttpClient);
|
|
832
|
-
headers = new HttpHeaders({
|
|
833
|
-
'Content-Type': 'application/json; charset=utf-8',
|
|
834
|
-
'Access-Control-Allow-Methods': 'GET, HEAD, PUT, PATCH, POST, DELETE',
|
|
835
|
-
'Access-Control-Allow-Origin-Credentials': 'true',
|
|
836
|
-
'Access-Control-Allow-Headers': 'Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, X-BRZ-User-ID',
|
|
837
|
-
'X-BRZ-User-ID': 'zsolt.zsuffa@extern.brz.gv.at',
|
|
838
|
-
});
|
|
839
|
-
constructor(entityMapper, urlProperty, resourceUrl) {
|
|
840
|
-
this.entityMapper = entityMapper;
|
|
841
|
-
this.urlProperty = urlProperty;
|
|
842
|
-
this.resourceUrl = resourceUrl;
|
|
843
|
-
this.baseUrl = Reflect.get(this.runtimeConfiguration, urlProperty);
|
|
844
|
-
}
|
|
845
|
-
// region public accessor and mutator methods
|
|
846
|
-
delete(id) {
|
|
847
|
-
return this.httpClient.delete(this.resourceUrl + `/${id}`, { headers: this.headers });
|
|
848
|
-
}
|
|
849
|
-
deleteAll() {
|
|
850
|
-
return this.httpClient.delete(this.resourceUrl, { headers: this.headers });
|
|
851
|
-
}
|
|
852
|
-
findAll(page) {
|
|
853
|
-
return this.findByQuery({ page });
|
|
854
|
-
}
|
|
855
|
-
findByQuery(queryCondition) {
|
|
856
|
-
const fullUrl = this.buildFullUrl(this.resourceUrl, queryCondition);
|
|
857
|
-
if (fullUrl) {
|
|
858
|
-
return this.httpClient.get(fullUrl, { headers: this.headers }).pipe(map((httpResponse) => {
|
|
859
|
-
return queryCondition.page ? this.mapPagedResponse(httpResponse) : this.mapSimpleResponse(httpResponse);
|
|
860
|
-
}));
|
|
861
|
-
}
|
|
862
|
-
else
|
|
863
|
-
throw new Error('Could not determine the full url');
|
|
864
|
-
}
|
|
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) {
|
|
877
|
-
const dto = this.entityMapper.toDto(entity);
|
|
878
|
-
const fullUrl = this.buildFullUrl(this.resourceUrl, {});
|
|
879
|
-
if (fullUrl) {
|
|
880
|
-
return this.httpClient.post(fullUrl, dto, { headers: this.headers }).pipe(map((response) => {
|
|
881
|
-
return this.entityMapper.fromDto(response, id);
|
|
882
|
-
}));
|
|
883
|
-
}
|
|
884
|
-
else
|
|
885
|
-
throw new Error('Could not determine the full url');
|
|
886
|
-
}
|
|
887
|
-
update(entity) {
|
|
888
|
-
const dto = this.entityMapper.toDto(entity);
|
|
889
|
-
const pathParams = new Map([['id', String(entity.id)]]);
|
|
890
|
-
const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}', { pathParams });
|
|
891
|
-
if (fullUrl) {
|
|
892
|
-
return this.httpClient.put(fullUrl, dto, { headers: this.headers }).pipe(map((response) => {
|
|
893
|
-
return this.entityMapper.fromDto(response);
|
|
894
|
-
}));
|
|
895
|
-
}
|
|
896
|
-
else
|
|
897
|
-
throw new Error('Could not determine the full url');
|
|
898
|
-
}
|
|
899
|
-
// endregion
|
|
900
|
-
// region protected, private helper methods
|
|
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));
|
|
907
|
-
}
|
|
908
|
-
let params = {};
|
|
909
|
-
if (queryParams.size > 0) {
|
|
910
|
-
for (const [key, value] of queryParams) {
|
|
911
|
-
params = { ...params, [key]: value };
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
else
|
|
915
|
-
params = null;
|
|
916
|
-
if (queryCondition.pathParams !== undefined && queryCondition.pathParams.size != 0) {
|
|
917
|
-
queryCondition.pathParams.forEach((value, key) => {
|
|
918
|
-
const pathParam = '%{' + key + '}';
|
|
919
|
-
resourceUri = resourceUri.replace(pathParam, value);
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
const urlOptions = {
|
|
923
|
-
path: resourceUri,
|
|
924
|
-
hash: queryCondition.hash,
|
|
925
|
-
queryParams: params,
|
|
926
|
-
};
|
|
927
|
-
return buildUrl(this.baseUrl, urlOptions);
|
|
928
|
-
}
|
|
929
|
-
mapPagedResponse(response) {
|
|
930
|
-
const subjectPage = response[0];
|
|
931
|
-
const content = subjectPage.content.map((dto, index) => {
|
|
932
|
-
return this.entityMapper.fromDto(dto, index);
|
|
933
|
-
});
|
|
934
|
-
return {
|
|
935
|
-
page: subjectPage.page,
|
|
936
|
-
pageSize: subjectPage.pageSize,
|
|
937
|
-
totalPageCount: subjectPage.totalPageCount,
|
|
938
|
-
content,
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
mapSimpleResponse(response) {
|
|
942
|
-
if (Object.prototype.toString.call(response) === '[object Array]') {
|
|
943
|
-
return response.map((dto, index) => {
|
|
944
|
-
return this.entityMapper.fromDto(dto, index);
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
else {
|
|
948
|
-
return new Array(this.entityMapper.fromDto(response));
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
};
|
|
952
|
-
BaseEntityRestService = __decorate([
|
|
953
|
-
__param(0, Inject('entityMapper')),
|
|
954
|
-
__metadata("design:paramtypes", [Object, String, String])
|
|
955
|
-
], BaseEntityRestService);
|
|
956
|
-
|
|
957
560
|
const INITIAL_TABS_STATE = {
|
|
958
561
|
activeTabs: [],
|
|
959
562
|
currentTab: undefined,
|
|
@@ -1131,6 +734,104 @@ function BaseEntityStore(entityType, repositoryType) {
|
|
|
1131
734
|
})));
|
|
1132
735
|
}
|
|
1133
736
|
|
|
737
|
+
var RouteSegments;
|
|
738
|
+
(function (RouteSegments) {
|
|
739
|
+
RouteSegments["LIST_ROUTE"] = "LIST_ROUTE";
|
|
740
|
+
RouteSegments["DETAILS_ROUTE"] = "DETAILS_ROUTE";
|
|
741
|
+
})(RouteSegments || (RouteSegments = {}));
|
|
742
|
+
const INITIAL_NAVIGATION_STATE = {
|
|
743
|
+
activeRouteSegment: RouteSegments.LIST_ROUTE,
|
|
744
|
+
entityName: '',
|
|
745
|
+
navigationError: undefined,
|
|
746
|
+
navigateTo: '',
|
|
747
|
+
returnTo: '',
|
|
748
|
+
};
|
|
749
|
+
function snakeCaseName(entityName) {
|
|
750
|
+
return entityName
|
|
751
|
+
.split(/(?=[A-Z])/)
|
|
752
|
+
.join('-')
|
|
753
|
+
.toLowerCase();
|
|
754
|
+
}
|
|
755
|
+
function BaseFormNavigatorStore(entityName) {
|
|
756
|
+
return signalStoreFeature(withState(INITIAL_NAVIGATION_STATE), withMethods((store, router = inject(Router), route = inject(ActivatedRoute)) => {
|
|
757
|
+
function determineActiveRouteSegment() {
|
|
758
|
+
const currentUrl = Reflect.get(route, '_routerState').snapshot.url;
|
|
759
|
+
if (currentUrl.endsWith(BaseUrlSegments.ListForm)) {
|
|
760
|
+
patchState(store, { activeRouteSegment: RouteSegments.LIST_ROUTE });
|
|
761
|
+
}
|
|
762
|
+
else if (currentUrl.endsWith(BaseUrlSegments.DetailsForm)) {
|
|
763
|
+
patchState(store, { activeRouteSegment: RouteSegments.DETAILS_ROUTE });
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
patchState(store, { activeRouteSegment: undefined });
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
function determineBaseUrl() {
|
|
770
|
+
determineActiveRouteSegment();
|
|
771
|
+
const currentUrl = determineCurrentUrl();
|
|
772
|
+
return store.activeRouteSegment() === RouteSegments.DETAILS_ROUTE ? levelUpUrl(levelUpUrl(levelUpUrl(currentUrl))) : levelUpUrl(levelUpUrl(currentUrl));
|
|
773
|
+
}
|
|
774
|
+
function determineCurrentUrl() {
|
|
775
|
+
return Reflect.get(route, '_routerState').snapshot.url;
|
|
776
|
+
}
|
|
777
|
+
function levelUpUrl(currentUrl) {
|
|
778
|
+
return currentUrl.substring(0, currentUrl.lastIndexOf('/'));
|
|
779
|
+
}
|
|
780
|
+
async function navigateBack(defaultUrl) {
|
|
781
|
+
const goTo = store.returnTo() ? store.returnTo() : defaultUrl;
|
|
782
|
+
patchState(store, { returnTo: '' });
|
|
783
|
+
if (goTo) {
|
|
784
|
+
await router
|
|
785
|
+
.navigateByUrl(goTo)
|
|
786
|
+
.then()
|
|
787
|
+
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
788
|
+
}
|
|
789
|
+
else
|
|
790
|
+
await navigateToList();
|
|
791
|
+
}
|
|
792
|
+
async function navigateToDetails(id, returnTo) {
|
|
793
|
+
if (store.activeRouteSegment() != RouteSegments.DETAILS_ROUTE) {
|
|
794
|
+
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
795
|
+
const baseUrl = determineBaseUrl();
|
|
796
|
+
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
797
|
+
await navigateToUrl(detailsFormPath, returnTo);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
async function navigateToList(returnTo) {
|
|
801
|
+
const snakeCaseEntityName = snakeCaseName(entityName);
|
|
802
|
+
const baseUrl = determineBaseUrl();
|
|
803
|
+
const goToUrl = baseUrl + '/' + snakeCaseEntityName + '/list';
|
|
804
|
+
if (store.activeRouteSegment() != RouteSegments.LIST_ROUTE) {
|
|
805
|
+
await navigateToUrl(goToUrl, returnTo);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
async function navigateToRelated(relatedTypeName, id, returnTo) {
|
|
809
|
+
const snakeCaseEntityName = snakeCaseName(relatedTypeName);
|
|
810
|
+
const baseUrl = determineBaseUrl();
|
|
811
|
+
const detailsFormPath = baseUrl + '/' + snakeCaseEntityName + '/' + id + '/details';
|
|
812
|
+
await navigateToUrl(detailsFormPath, returnTo);
|
|
813
|
+
}
|
|
814
|
+
async function navigateToUrl(url, returnTo) {
|
|
815
|
+
if (returnTo) {
|
|
816
|
+
patchState(store, { returnTo });
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
patchState(store, { returnTo: router.url });
|
|
820
|
+
}
|
|
821
|
+
patchState(store, { navigateTo: url });
|
|
822
|
+
await router
|
|
823
|
+
.navigateByUrl(url)
|
|
824
|
+
.then(() => determineActiveRouteSegment())
|
|
825
|
+
.catch((error) => patchState(store, { navigationError: error.message }));
|
|
826
|
+
}
|
|
827
|
+
return { determineCurrentUrl, determineActiveRouteSegment, navigateBack, navigateToDetails, navigateToList, navigateToRelated, navigateToUrl };
|
|
828
|
+
}), withHooks((store) => ({
|
|
829
|
+
onInit: () => {
|
|
830
|
+
store.determineActiveRouteSegment();
|
|
831
|
+
},
|
|
832
|
+
})));
|
|
833
|
+
}
|
|
834
|
+
|
|
1134
835
|
let BaseEntityFirestoreService = class BaseEntityFirestoreService {
|
|
1135
836
|
entityMapper;
|
|
1136
837
|
collectionName;
|
|
@@ -1237,8 +938,7 @@ let BaseEntityFirestoreService = class BaseEntityFirestoreService {
|
|
|
1237
938
|
}
|
|
1238
939
|
};
|
|
1239
940
|
BaseEntityFirestoreService = __decorate([
|
|
1240
|
-
__param(0, Inject('entityMapper'))
|
|
1241
|
-
__metadata("design:paramtypes", [Object, String])
|
|
941
|
+
__param(0, Inject('entityMapper'))
|
|
1242
942
|
], BaseEntityFirestoreService);
|
|
1243
943
|
|
|
1244
944
|
// Symbol to store entity options on instance
|
|
@@ -1317,11 +1017,17 @@ function getEntityIds(instance) {
|
|
|
1317
1017
|
return Reflect.getMetadata(ENTITY_ID_PROPERTIES_KEY, constructor) || [];
|
|
1318
1018
|
}
|
|
1319
1019
|
|
|
1020
|
+
const BASE_ENTITY_ROUTES = [
|
|
1021
|
+
{ path: '', redirectTo: 'list', pathMatch: 'full' },
|
|
1022
|
+
{ path: ':id/details', component: BaseEntityFormComponent },
|
|
1023
|
+
{ path: 'list', component: BaseEntityListComponent },
|
|
1024
|
+
];
|
|
1025
|
+
|
|
1320
1026
|
// Public API Surface of @processpuzzle/base-entity
|
|
1321
1027
|
|
|
1322
1028
|
/**
|
|
1323
1029
|
* Generated bundle index. Do not edit.
|
|
1324
1030
|
*/
|
|
1325
1031
|
|
|
1326
|
-
export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor,
|
|
1032
|
+
export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerStore, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorStore, Entity, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, getEntityIds, getEntityOptions };
|
|
1327
1033
|
//# sourceMappingURL=processpuzzle-base-entity.mjs.map
|