@rxap/material-form-system 21.0.1 → 22.0.0-dev.1
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.
- package/CHANGELOG.md +26 -0
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +70 -5
- package/compodoc/classes/ExtractHideShowMixin.html +95 -21
- package/compodoc/classes/RecordViewTuple.html +71 -18
- package/compodoc/components/FormControlsComponent.html +269 -165
- package/compodoc/dependencies.html +124 -35
- package/compodoc/directives/ChipInputAdapterDirective.html +83 -13
- package/compodoc/directives/ChipListIteratorDirective.html +98 -23
- package/compodoc/directives/CompareWithDirective.html +142 -57
- package/compodoc/directives/ControlErrorDirective.html +163 -56
- package/compodoc/directives/ControlErrorsDirective.html +120 -26
- package/compodoc/directives/FormFieldHideShowDirective.html +122 -33
- package/compodoc/directives/InputClearButtonDirective.html +125 -47
- package/compodoc/directives/RequiredDirective.html +98 -20
- package/compodoc/index.html +46 -5
- package/compodoc/interfaces/ChipListTemplateContext.html +155 -95
- package/compodoc/interfaces/ControlErrorDirectiveContext.html +149 -94
- package/compodoc/interfaces/ControlErrorsDirectiveContext.html +149 -94
- package/compodoc/js/architecture-graph.js +288 -0
- package/compodoc/js/libs/bootstrap-native.js +4 -2
- package/compodoc/js/libs/jszip.min.js +13 -0
- package/compodoc/js/libs/svg-pan-zoom.min.js +3 -3
- package/compodoc/js/libs/tablesort.min.js +3 -3
- package/compodoc/js/libs/tablesort.number.min.js +3 -3
- package/compodoc/js/libs/vis-network.min.js +78 -0
- package/compodoc/js/menu-wc.js +25 -12
- package/compodoc/js/menu.js +10 -11
- package/compodoc/js/routes/routes_index.js +1 -0
- package/compodoc/js/routes.js +142 -34
- package/compodoc/js/search/search-lunr.js +6 -8
- package/compodoc/js/search/search.js +118 -66
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/js/tabs.js +98 -15
- package/compodoc/js/tree.js +44 -7
- package/compodoc/license.html +48 -6
- package/compodoc/llms.txt +196 -0
- package/compodoc/miscellaneous/functions.html +51 -8
- package/compodoc/miscellaneous/variables.html +148 -5
- package/compodoc/modules.html +44 -3
- package/compodoc/overview.html +54 -3
- package/compodoc/properties.html +45 -4
- package/compodoc/routes.html +227 -0
- package/compodoc/styles/compodoc.css +365 -44
- package/compodoc/styles/dark.css +16 -0
- package/compodoc/template-playground/default-templates.json +192 -0
- package/compodoc/template-playground/hbs-render.service.ts +217 -0
- package/compodoc/template-playground/main.ts +9 -0
- package/compodoc/template-playground/template-editor.service.ts +173 -0
- package/compodoc/template-playground/template-playground.component.ts +614 -0
- package/compodoc/template-playground/template-playground.module.ts +29 -0
- package/compodoc/template-playground/zip-export.service.ts +86 -0
- package/compodoc/template-playground-app/app.js +1389 -0
- package/compodoc/template-playground-app/index.html +462 -0
- package/docs/documentation.json +944 -739
- package/docs/html/assets/hierarchy.js +1 -1
- package/docs/html/assets/highlight.css +1 -1
- package/docs/html/assets/icons.js +1 -1
- package/docs/html/assets/icons.svg +1 -1
- package/docs/html/assets/main.js +5 -5
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +265 -228
- package/docs/html/classes/ChipInputAdapterDirective.html +97 -6
- package/docs/html/classes/ChipListIteratorDirective.html +109 -7
- package/docs/html/classes/CompareWithDirective.html +95 -5
- package/docs/html/classes/ControlErrorDirective.html +160 -12
- package/docs/html/classes/ControlErrorsDirective.html +154 -11
- package/docs/html/classes/ExtractHideShowMixin.html +141 -8
- package/docs/html/classes/FormControlsComponent.html +183 -15
- package/docs/html/classes/FormFieldHideShowDirective.html +210 -15
- package/docs/html/classes/InputClearButtonDirective.html +122 -7
- package/docs/html/classes/RequiredDirective.html +81 -4
- package/docs/html/hierarchy.html +33 -1
- package/docs/html/index.html +40 -4
- package/docs/html/interfaces/ChipListTemplateContext.html +61 -3
- package/docs/html/interfaces/ControlErrorDirectiveContext.html +61 -3
- package/docs/html/interfaces/ControlErrorsDirectiveContext.html +61 -3
- package/docs/html/modules.html +40 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/ChipInputAdapterDirective.md +8 -8
- package/docs/markdown/classes/ChipListIteratorDirective.md +8 -8
- package/docs/markdown/classes/CompareWithDirective.md +7 -7
- package/docs/markdown/classes/ControlErrorDirective.md +18 -16
- package/docs/markdown/classes/ControlErrorsDirective.md +17 -15
- package/docs/markdown/classes/ExtractHideShowMixin.md +23 -23
- package/docs/markdown/classes/FormControlsComponent.md +22 -20
- package/docs/markdown/classes/FormFieldHideShowDirective.md +31 -28
- package/docs/markdown/classes/InputClearButtonDirective.md +12 -12
- package/docs/markdown/classes/RequiredDirective.md +6 -6
- package/docs/markdown/globals.md +2 -2
- package/docs/markdown/interfaces/ChipListTemplateContext.md +5 -5
- package/docs/markdown/interfaces/ControlErrorDirectiveContext.md +4 -4
- package/docs/markdown/interfaces/ControlErrorsDirectiveContext.md +4 -4
- package/docs/wiki/Class.ChipInputAdapterDirective.md +7 -7
- package/docs/wiki/Class.ChipListIteratorDirective.md +7 -7
- package/docs/wiki/Class.CompareWithDirective.md +6 -6
- package/docs/wiki/Class.ControlErrorDirective.md +17 -15
- package/docs/wiki/Class.ControlErrorsDirective.md +16 -14
- package/docs/wiki/Class.ExtractHideShowMixin.md +22 -22
- package/docs/wiki/Class.FormControlsComponent.md +21 -19
- package/docs/wiki/Class.FormFieldHideShowDirective.md +30 -27
- package/docs/wiki/Class.InputClearButtonDirective.md +11 -11
- package/docs/wiki/Class.RequiredDirective.md +5 -5
- package/docs/wiki/Interface.ChipListTemplateContext.md +4 -4
- package/docs/wiki/Interface.ControlErrorDirectiveContext.md +3 -3
- package/docs/wiki/Interface.ControlErrorsDirectiveContext.md +3 -3
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-material-form-system.mjs +544 -265
- package/fesm2022/rxap-material-form-system.mjs.map +1 -1
- package/package.json +39 -39
- package/types/rxap-material-form-system.d.ts +165 -148
|
@@ -1,61 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { Subscription, of } from
|
|
21
|
-
import {
|
|
22
|
-
import { Mixin } from
|
|
23
|
-
import { getMetadata } from
|
|
24
|
-
|
|
25
|
-
class FormControlsComponent {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Directive, ElementRef, IterableDiffers, Renderer2, TemplateRef, ViewContainerRef, inject, input, isDevMode, output, signal } from "@angular/core";
|
|
4
|
+
import { outputToObservable } from "@angular/core/rxjs-interop";
|
|
5
|
+
import { FormDirective, RxapFormControl, controlErrorChanges$ } from "@rxap/forms";
|
|
6
|
+
import { clone, coerceBoolean, equals, getFromObject, unique } from "@rxap/utilities";
|
|
7
|
+
import { catchError, filter, startWith, take, tap } from "rxjs/operators";
|
|
8
|
+
import { Router } from "@angular/router";
|
|
9
|
+
import { MatSnackBar, MatSnackBarModule } from "@angular/material/snack-bar";
|
|
10
|
+
import * as i2 from "@angular/material/progress-spinner";
|
|
11
|
+
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
|
12
|
+
import { NgClass } from "@angular/common";
|
|
13
|
+
import * as i1 from "@angular/material/button";
|
|
14
|
+
import { MatButtonModule } from "@angular/material/button";
|
|
15
|
+
import { COMMA, ENTER } from "@angular/cdk/keycodes";
|
|
16
|
+
import { NgControl } from "@angular/forms";
|
|
17
|
+
import { MatChipInput } from "@angular/material/chips";
|
|
18
|
+
import { MatSelect } from "@angular/material/select";
|
|
19
|
+
import { MAT_FORM_FIELD } from "@angular/material/form-field";
|
|
20
|
+
import { Subscription, of } from "rxjs";
|
|
21
|
+
import { ExtractFormDefinitionMixin, RXAP_FORM_SYSTEM_HIDE_METADATA, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, RXAP_FORM_SYSTEM_SHOW_METADATA } from "@rxap/form-system";
|
|
22
|
+
import { Mixin } from "@rxap/mixin";
|
|
23
|
+
import { getMetadata } from "@rxap/reflect-metadata";
|
|
24
|
+
let FormControlsComponent = class FormControlsComponent {
|
|
26
25
|
constructor() {
|
|
27
26
|
this.formDirective = inject(FormDirective);
|
|
28
27
|
this.snackBar = inject(MatSnackBar);
|
|
29
28
|
this.router = inject(Router, { optional: true });
|
|
30
29
|
this.submitting = this.formDirective.submitting;
|
|
31
|
-
this.invalid = signal(false, ...
|
|
32
|
-
this.navigateAfterSubmit = input(...
|
|
33
|
-
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
30
|
+
this.invalid = signal(false, ...ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []);
|
|
31
|
+
this.navigateAfterSubmit = input(...ngDevMode ? [void 0, { debugName: "navigateAfterSubmit" }] : /* istanbul ignore next */ []);
|
|
34
32
|
this.close = output();
|
|
35
33
|
this.submitted = output();
|
|
36
34
|
this.isDevMode = isDevMode();
|
|
37
|
-
/**
|
|
38
|
-
* Collection of successful submitted values
|
|
39
|
-
* @private
|
|
40
|
-
*/
|
|
41
35
|
this._submitted = [];
|
|
42
|
-
this.allowResubmit = input(false, {
|
|
36
|
+
this.allowResubmit = input(false, {
|
|
37
|
+
...ngDevMode ? { debugName: "allowResubmit" } : /* istanbul ignore next */ {},
|
|
38
|
+
transform: coerceBoolean
|
|
39
|
+
});
|
|
43
40
|
}
|
|
44
41
|
ngOnInit() {
|
|
45
|
-
outputToObservable(this.close)
|
|
46
|
-
.pipe(take(1), tap(() => {
|
|
42
|
+
outputToObservable(this.close).pipe(take(1), tap(() => {
|
|
47
43
|
const navigateAfterSubmit = this.navigateAfterSubmit();
|
|
48
44
|
if (navigateAfterSubmit) {
|
|
49
|
-
if (this.router)
|
|
45
|
+
if (this.router)
|
|
50
46
|
return this.router.navigate(navigateAfterSubmit);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
console.warn('The Router is not available. Ensure that tha RouterModule is imported');
|
|
54
|
-
}
|
|
47
|
+
else
|
|
48
|
+
console.warn("The Router is not available. Ensure that tha RouterModule is imported");
|
|
55
49
|
}
|
|
56
50
|
return Promise.resolve();
|
|
57
|
-
}))
|
|
58
|
-
.subscribe();
|
|
51
|
+
})).subscribe();
|
|
59
52
|
}
|
|
60
53
|
reset() {
|
|
61
54
|
this.invalid.set(false);
|
|
@@ -67,47 +60,156 @@ class FormControlsComponent {
|
|
|
67
60
|
submit(closeAfterSubmit) {
|
|
68
61
|
this.formDirective.form.markAllAsDirty();
|
|
69
62
|
this.formDirective.form.markAllAsTouched();
|
|
70
|
-
// eslint-disable-next-line prefer-const
|
|
71
63
|
let submitSubscription;
|
|
72
|
-
const invalidSubmitSubscription = outputToObservable(this.formDirective.invalidSubmit)
|
|
73
|
-
|
|
74
|
-
.subscribe();
|
|
75
|
-
submitSubscription = outputToObservable(this.formDirective.rxapSubmit)
|
|
76
|
-
.pipe(take(1), tap((value) => {
|
|
64
|
+
const invalidSubmitSubscription = outputToObservable(this.formDirective.invalidSubmit).pipe(take(1), tap(() => submitSubscription?.unsubscribe()), tap(() => this.invalid.set(true)), tap(() => this.snackBar.open($localize `:@@rxap-material.form-system.form-controls.form-is-invalid:Form is not valid`, "ok", { duration: 5e3 }))).subscribe();
|
|
65
|
+
submitSubscription = outputToObservable(this.formDirective.rxapSubmit).pipe(take(1), tap((value) => {
|
|
77
66
|
const clonedValue = clone(value);
|
|
78
67
|
this._submitted.push(clonedValue);
|
|
79
68
|
this.submitted.emit(clonedValue);
|
|
80
|
-
if (closeAfterSubmit)
|
|
69
|
+
if (closeAfterSubmit)
|
|
81
70
|
this.close.emit(this._submitted.length > 1 ? this._submitted : this._submitted[0]);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (typeof this.formDirective.formDefinition.rxapReuse === 'function') {
|
|
85
|
-
this.formDirective.formDefinition.rxapReuse();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
71
|
+
else if (typeof this.formDirective.formDefinition.rxapReuse === "function")
|
|
72
|
+
this.formDirective.formDefinition.rxapReuse();
|
|
88
73
|
invalidSubmitSubscription.unsubscribe();
|
|
89
74
|
this.invalid.set(false);
|
|
90
|
-
}))
|
|
91
|
-
|
|
92
|
-
this.formDirective.onSubmit(new Event('submit'));
|
|
75
|
+
})).subscribe();
|
|
76
|
+
this.formDirective.onSubmit(new Event("submit"));
|
|
93
77
|
}
|
|
94
78
|
logCurrentFormState() {
|
|
95
79
|
console.log(clone(this.formDirective.form.value));
|
|
96
80
|
}
|
|
97
|
-
static {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
static {
|
|
82
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
83
|
+
minVersion: "12.0.0",
|
|
84
|
+
version: "22.3.0",
|
|
85
|
+
ngImport: i0,
|
|
86
|
+
type: FormControlsComponent,
|
|
87
|
+
deps: [],
|
|
88
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
static {
|
|
92
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
93
|
+
minVersion: "17.0.0",
|
|
94
|
+
version: "22.3.0",
|
|
95
|
+
type: FormControlsComponent,
|
|
96
|
+
isStandalone: true,
|
|
97
|
+
selector: "rxap-form-controls",
|
|
98
|
+
inputs: {
|
|
99
|
+
navigateAfterSubmit: {
|
|
100
|
+
classPropertyName: "navigateAfterSubmit",
|
|
101
|
+
publicName: "navigateAfterSubmit",
|
|
102
|
+
isSignal: true,
|
|
103
|
+
isRequired: false,
|
|
104
|
+
transformFunction: null
|
|
105
|
+
},
|
|
106
|
+
allowResubmit: {
|
|
107
|
+
classPropertyName: "allowResubmit",
|
|
108
|
+
publicName: "allowResubmit",
|
|
109
|
+
isSignal: true,
|
|
110
|
+
isRequired: false,
|
|
111
|
+
transformFunction: null
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
outputs: {
|
|
115
|
+
close: "close",
|
|
116
|
+
submitted: "submitted"
|
|
117
|
+
},
|
|
118
|
+
ngImport: i0,
|
|
119
|
+
template: "<div class=\"flex flex-row justify-between items-center gap-8\">\n <div class=\"flex grow-0 flex-row justify-end items-center gap-8 w-full\">\n <button (click)=\"reset()\"\n [disabled]=\"submitting()\"\n class=\"grow-0\"\n mat-stroked-button\n type=\"button\">\n <ng-container i18n>Reset</ng-container>\n </button>\n <button (click)=\"cancel()\"\n [disabled]=\"submitting()\"\n color=\"warn\"\n class=\"grow-0\"\n mat-stroked-button\n type=\"button\">\n <ng-container i18n>Cancel</ng-container>\n </button>\n <button (click)=\"submit(!allowResubmit())\"\n [disabled]=\"submitting()\"\n [ngClass]=\"{ invalid: invalid() }\"\n color=\"primary\"\n class=\"grow-0\"\n mat-raised-button\n type=\"button\">\n <span class=\"flex flex-row items-center gap-2\">\n <span class=\"grow-0\">\n <ng-container i18n>Submit</ng-container>\n </span>\n @if (submitting()) {\n <mat-spinner [diameter]=\"15\" color=\"accent\" class=\"grow-0\"\n mode=\"indeterminate\"></mat-spinner>\n }\n </span>\n </button>\n @if (allowResubmit()) {\n <button (click)=\"submit(true)\"\n [disabled]=\"submitting()\"\n [ngClass]=\"{ invalid: invalid() }\"\n color=\"primary\"\n class=\"grow-0\"\n mat-raised-button\n type=\"button\">\n <span class=\"flex flex-row items-center gap-2\">\n <span class=\"grow-0\">\n <ng-container i18n>Submit and Close</ng-container>\n </span>\n @if (submitting()) {\n <mat-spinner [diameter]=\"15\" color=\"accent\" class=\"grow-0\"\n mode=\"indeterminate\"></mat-spinner>\n }\n </span>\n </button>\n }\n @if (isDevMode) {\n <button (click)=\"logCurrentFormState()\" mat-button type=\"button\" class=\"grow-0\">\n Current Form State\n </button>\n }\n </div>\n</div>\n",
|
|
120
|
+
styles: ["button{overflow:hidden}button.invalid{border:6px solid darkred}\n"],
|
|
121
|
+
dependencies: [
|
|
122
|
+
{
|
|
123
|
+
kind: "ngmodule",
|
|
124
|
+
type: MatButtonModule
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
kind: "component",
|
|
128
|
+
type: i1.MatButton,
|
|
129
|
+
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] ",
|
|
130
|
+
inputs: ["matButton"],
|
|
131
|
+
exportAs: ["matButton", "matAnchor"]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
kind: "directive",
|
|
135
|
+
type: NgClass,
|
|
136
|
+
selector: "[ngClass]",
|
|
137
|
+
inputs: ["class", "ngClass"]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
kind: "ngmodule",
|
|
141
|
+
type: MatProgressSpinnerModule
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
kind: "component",
|
|
145
|
+
type: i2.MatProgressSpinner,
|
|
146
|
+
selector: "mat-progress-spinner, mat-spinner",
|
|
147
|
+
inputs: [
|
|
148
|
+
"color",
|
|
149
|
+
"mode",
|
|
150
|
+
"value",
|
|
151
|
+
"diameter",
|
|
152
|
+
"strokeWidth"
|
|
153
|
+
],
|
|
154
|
+
exportAs: ["matProgressSpinner"]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
kind: "ngmodule",
|
|
158
|
+
type: MatSnackBarModule
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
166
|
+
minVersion: "12.0.0",
|
|
167
|
+
version: "22.3.0",
|
|
168
|
+
ngImport: i0,
|
|
169
|
+
type: FormControlsComponent,
|
|
170
|
+
decorators: [{
|
|
101
171
|
type: Component,
|
|
102
|
-
args: [{
|
|
172
|
+
args: [{
|
|
173
|
+
selector: "rxap-form-controls",
|
|
174
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
175
|
+
imports: [
|
|
103
176
|
MatButtonModule,
|
|
104
177
|
NgClass,
|
|
105
178
|
MatProgressSpinnerModule,
|
|
106
179
|
MatSnackBarModule
|
|
107
|
-
],
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
180
|
+
],
|
|
181
|
+
template: "<div class=\"flex flex-row justify-between items-center gap-8\">\n <div class=\"flex grow-0 flex-row justify-end items-center gap-8 w-full\">\n <button (click)=\"reset()\"\n [disabled]=\"submitting()\"\n class=\"grow-0\"\n mat-stroked-button\n type=\"button\">\n <ng-container i18n>Reset</ng-container>\n </button>\n <button (click)=\"cancel()\"\n [disabled]=\"submitting()\"\n color=\"warn\"\n class=\"grow-0\"\n mat-stroked-button\n type=\"button\">\n <ng-container i18n>Cancel</ng-container>\n </button>\n <button (click)=\"submit(!allowResubmit())\"\n [disabled]=\"submitting()\"\n [ngClass]=\"{ invalid: invalid() }\"\n color=\"primary\"\n class=\"grow-0\"\n mat-raised-button\n type=\"button\">\n <span class=\"flex flex-row items-center gap-2\">\n <span class=\"grow-0\">\n <ng-container i18n>Submit</ng-container>\n </span>\n @if (submitting()) {\n <mat-spinner [diameter]=\"15\" color=\"accent\" class=\"grow-0\"\n mode=\"indeterminate\"></mat-spinner>\n }\n </span>\n </button>\n @if (allowResubmit()) {\n <button (click)=\"submit(true)\"\n [disabled]=\"submitting()\"\n [ngClass]=\"{ invalid: invalid() }\"\n color=\"primary\"\n class=\"grow-0\"\n mat-raised-button\n type=\"button\">\n <span class=\"flex flex-row items-center gap-2\">\n <span class=\"grow-0\">\n <ng-container i18n>Submit and Close</ng-container>\n </span>\n @if (submitting()) {\n <mat-spinner [diameter]=\"15\" color=\"accent\" class=\"grow-0\"\n mode=\"indeterminate\"></mat-spinner>\n }\n </span>\n </button>\n }\n @if (isDevMode) {\n <button (click)=\"logCurrentFormState()\" mat-button type=\"button\" class=\"grow-0\">\n Current Form State\n </button>\n }\n </div>\n</div>\n",
|
|
182
|
+
styles: ["button{overflow:hidden}button.invalid{border:6px solid darkred}\n"]
|
|
183
|
+
}]
|
|
184
|
+
}],
|
|
185
|
+
propDecorators: {
|
|
186
|
+
navigateAfterSubmit: [{
|
|
187
|
+
type: i0.Input,
|
|
188
|
+
args: [{
|
|
189
|
+
isSignal: true,
|
|
190
|
+
alias: "navigateAfterSubmit",
|
|
191
|
+
required: false
|
|
192
|
+
}]
|
|
193
|
+
}],
|
|
194
|
+
close: [{
|
|
195
|
+
type: i0.Output,
|
|
196
|
+
args: ["close"]
|
|
197
|
+
}],
|
|
198
|
+
submitted: [{
|
|
199
|
+
type: i0.Output,
|
|
200
|
+
args: ["submitted"]
|
|
201
|
+
}],
|
|
202
|
+
allowResubmit: [{
|
|
203
|
+
type: i0.Input,
|
|
204
|
+
args: [{
|
|
205
|
+
isSignal: true,
|
|
206
|
+
alias: "allowResubmit",
|
|
207
|
+
required: false
|
|
208
|
+
}]
|
|
209
|
+
}]
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
var ChipInputAdapterDirective = class ChipInputAdapterDirective {
|
|
111
213
|
constructor() {
|
|
112
214
|
this.matChipInput = inject(MatChipInput);
|
|
113
215
|
this.ngControl = inject(NgControl);
|
|
@@ -118,65 +220,85 @@ class ChipInputAdapterDirective {
|
|
|
118
220
|
this._subscription?.unsubscribe();
|
|
119
221
|
}
|
|
120
222
|
ngOnInit() {
|
|
121
|
-
this._subscription = this.matChipInput.chipEnd
|
|
122
|
-
.pipe(filter((add) => !!add.value?.trim()), tap((add) => {
|
|
223
|
+
this._subscription = this.matChipInput.chipEnd.pipe(filter((add) => !!add.value?.trim()), tap((add) => {
|
|
123
224
|
const value = this.ngControl.value ?? [];
|
|
124
225
|
this.ngControl.control?.setValue([...value, add.value].filter(unique()));
|
|
125
226
|
this.matChipInput.clear();
|
|
126
|
-
}))
|
|
127
|
-
|
|
227
|
+
})).subscribe();
|
|
228
|
+
}
|
|
229
|
+
static {
|
|
230
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
231
|
+
minVersion: "12.0.0",
|
|
232
|
+
version: "22.3.0",
|
|
233
|
+
ngImport: i0,
|
|
234
|
+
type: ChipInputAdapterDirective,
|
|
235
|
+
deps: [],
|
|
236
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
237
|
+
});
|
|
128
238
|
}
|
|
129
|
-
static {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
239
|
+
static {
|
|
240
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
241
|
+
minVersion: "14.0.0",
|
|
242
|
+
version: "22.3.0",
|
|
243
|
+
type: ChipInputAdapterDirective,
|
|
244
|
+
isStandalone: true,
|
|
245
|
+
selector: "[matChipInputFor][rxapChipInputAdapter]",
|
|
246
|
+
ngImport: i0
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
251
|
+
minVersion: "12.0.0",
|
|
252
|
+
version: "22.3.0",
|
|
253
|
+
ngImport: i0,
|
|
254
|
+
type: ChipInputAdapterDirective,
|
|
255
|
+
decorators: [{
|
|
133
256
|
type: Directive,
|
|
134
257
|
args: [{
|
|
135
|
-
selector:
|
|
136
|
-
standalone: true
|
|
258
|
+
selector: "[matChipInputFor][rxapChipInputAdapter]",
|
|
259
|
+
standalone: true
|
|
137
260
|
}]
|
|
138
|
-
}],
|
|
139
|
-
|
|
261
|
+
}],
|
|
262
|
+
ctorParameters: () => []
|
|
263
|
+
});
|
|
140
264
|
function getTypeName(type) {
|
|
141
|
-
return type[
|
|
265
|
+
return type["name"] || typeof type;
|
|
142
266
|
}
|
|
143
|
-
|
|
267
|
+
var RecordViewTuple = class {
|
|
144
268
|
constructor(record, view) {
|
|
145
269
|
this.record = record;
|
|
146
270
|
this.view = view;
|
|
147
271
|
}
|
|
148
|
-
}
|
|
149
|
-
class ChipListIteratorDirective {
|
|
272
|
+
};
|
|
273
|
+
var ChipListIteratorDirective = class ChipListIteratorDirective {
|
|
150
274
|
constructor() {
|
|
151
275
|
this.template = inject(TemplateRef);
|
|
152
276
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
153
277
|
this.ngControl = inject(NgControl);
|
|
154
278
|
this.differs = inject(IterableDiffers);
|
|
279
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
155
280
|
this._dirty = true;
|
|
156
281
|
this._differ = null;
|
|
157
282
|
}
|
|
158
283
|
ngOnInit() {
|
|
159
|
-
this._subscription = this.ngControl.valueChanges
|
|
160
|
-
?.pipe(startWith(this.ngControl.value), filter((value) => Array.isArray(value)), tap((items) => {
|
|
284
|
+
this._subscription = this.ngControl.valueChanges?.pipe(startWith(this.ngControl.value), filter((value) => Array.isArray(value)), tap((items) => {
|
|
161
285
|
this._dirty = false;
|
|
162
|
-
// React on ngForOf changes only once all inputs have been initialized
|
|
163
286
|
const value = items;
|
|
164
|
-
if (!this._differ && value)
|
|
287
|
+
if (!this._differ && value)
|
|
165
288
|
try {
|
|
166
289
|
this._differ = this.differs.find(value).create((_, item) => item);
|
|
167
290
|
}
|
|
168
291
|
catch {
|
|
169
292
|
throw new Error(`Cannot find a differ supporting object '${value}' of type '${getTypeName(value)}'. NgFor only supports binding to Iterables such as Arrays.`);
|
|
170
293
|
}
|
|
171
|
-
}
|
|
172
294
|
if (this._differ) {
|
|
173
295
|
const changes = this._differ.diff(items);
|
|
174
296
|
if (changes) {
|
|
175
297
|
this.applyChanges(changes);
|
|
298
|
+
this.cdr.markForCheck();
|
|
176
299
|
}
|
|
177
300
|
}
|
|
178
|
-
}))
|
|
179
|
-
.subscribe();
|
|
301
|
+
})).subscribe();
|
|
180
302
|
}
|
|
181
303
|
ngOnDestroy() {
|
|
182
304
|
this._subscription?.unsubscribe();
|
|
@@ -185,19 +307,14 @@ class ChipListIteratorDirective {
|
|
|
185
307
|
const insertTuples = [];
|
|
186
308
|
changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
|
|
187
309
|
if (item.previousIndex == null) {
|
|
188
|
-
|
|
189
|
-
// that a new item needs to be inserted from the iterable. This implies that
|
|
190
|
-
// there is an iterable value for "_ngForOf".
|
|
191
|
-
const view = this.viewContainerRef.createEmbeddedView(this.template, {
|
|
310
|
+
const tuple = new RecordViewTuple(item, this.viewContainerRef.createEmbeddedView(this.template, {
|
|
192
311
|
$implicit: item.item,
|
|
193
|
-
onRemoved: this.onRemoved.bind(this)
|
|
194
|
-
}, currentIndex === null ?
|
|
195
|
-
const tuple = new RecordViewTuple(item, view);
|
|
312
|
+
onRemoved: this.onRemoved.bind(this)
|
|
313
|
+
}, currentIndex === null ? void 0 : currentIndex));
|
|
196
314
|
insertTuples.push(tuple);
|
|
197
315
|
}
|
|
198
|
-
else if (currentIndex == null)
|
|
199
|
-
this.viewContainerRef.remove(adjustedPreviousIndex === null ?
|
|
200
|
-
}
|
|
316
|
+
else if (currentIndex == null)
|
|
317
|
+
this.viewContainerRef.remove(adjustedPreviousIndex === null ? void 0 : adjustedPreviousIndex);
|
|
201
318
|
else if (adjustedPreviousIndex !== null) {
|
|
202
319
|
const view = this.viewContainerRef.get(adjustedPreviousIndex);
|
|
203
320
|
this.viewContainerRef.move(view, currentIndex);
|
|
@@ -205,11 +322,10 @@ class ChipListIteratorDirective {
|
|
|
205
322
|
insertTuples.push(tuple);
|
|
206
323
|
}
|
|
207
324
|
});
|
|
208
|
-
for (let i = 0; i < insertTuples.length; i++)
|
|
325
|
+
for (let i = 0; i < insertTuples.length; i++)
|
|
209
326
|
this.perViewChange(insertTuples[i].view, insertTuples[i].record);
|
|
210
|
-
}
|
|
211
327
|
changes.forEachIdentityChange((record) => {
|
|
212
|
-
const viewRef =
|
|
328
|
+
const viewRef = this.viewContainerRef.get(record.currentIndex);
|
|
213
329
|
viewRef.context.$implicit = record.item;
|
|
214
330
|
});
|
|
215
331
|
}
|
|
@@ -219,21 +335,48 @@ class ChipListIteratorDirective {
|
|
|
219
335
|
perViewChange(view, record) {
|
|
220
336
|
view.context.$implicit = record.item;
|
|
221
337
|
}
|
|
222
|
-
static {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
338
|
+
static {
|
|
339
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
340
|
+
minVersion: "12.0.0",
|
|
341
|
+
version: "22.3.0",
|
|
342
|
+
ngImport: i0,
|
|
343
|
+
type: ChipListIteratorDirective,
|
|
344
|
+
deps: [],
|
|
345
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
static {
|
|
349
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
350
|
+
minVersion: "14.0.0",
|
|
351
|
+
version: "22.3.0",
|
|
352
|
+
type: ChipListIteratorDirective,
|
|
353
|
+
isStandalone: true,
|
|
354
|
+
selector: "[rxapChipListIterator]",
|
|
355
|
+
ngImport: i0
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
360
|
+
minVersion: "12.0.0",
|
|
361
|
+
version: "22.3.0",
|
|
362
|
+
ngImport: i0,
|
|
363
|
+
type: ChipListIteratorDirective,
|
|
364
|
+
decorators: [{
|
|
226
365
|
type: Directive,
|
|
227
366
|
args: [{
|
|
228
|
-
selector:
|
|
229
|
-
standalone: true
|
|
367
|
+
selector: "[rxapChipListIterator]",
|
|
368
|
+
standalone: true
|
|
230
369
|
}]
|
|
231
|
-
}]
|
|
232
|
-
|
|
233
|
-
|
|
370
|
+
}]
|
|
371
|
+
});
|
|
372
|
+
const PRISM_FORM_STYLE$2 = "display: flex; flex-direction: column; gap: 8px; min-width: 280px";
|
|
373
|
+
let CompareWithDirective = class CompareWithDirective {
|
|
234
374
|
constructor() {
|
|
235
375
|
this.matSelect = inject(MatSelect);
|
|
236
|
-
this.objectPath = input.required({
|
|
376
|
+
this.objectPath = input.required({
|
|
377
|
+
...ngDevMode ? { debugName: "objectPath" } : /* istanbul ignore next */ {},
|
|
378
|
+
alias: "rxapCompareWith"
|
|
379
|
+
});
|
|
237
380
|
}
|
|
238
381
|
ngOnInit() {
|
|
239
382
|
this.matSelect.compareWith = this.compareWith.bind(this);
|
|
@@ -241,47 +384,84 @@ class CompareWithDirective {
|
|
|
241
384
|
compareWith(o1, o2) {
|
|
242
385
|
const objectPath = this.objectPath();
|
|
243
386
|
if (objectPath) {
|
|
244
|
-
if (typeof o1 !==
|
|
245
|
-
if (isDevMode())
|
|
246
|
-
console.warn(
|
|
247
|
-
}
|
|
387
|
+
if (typeof o1 !== "object" || typeof o2 !== "object") {
|
|
388
|
+
if (isDevMode())
|
|
389
|
+
console.warn("At least one of the select options value is not an object");
|
|
248
390
|
return false;
|
|
249
391
|
}
|
|
250
|
-
if (o1 === null || o1 ===
|
|
251
|
-
if (isDevMode())
|
|
252
|
-
console.warn(
|
|
253
|
-
}
|
|
392
|
+
if (o1 === null || o1 === void 0 || o2 === null || o2 === void 0) {
|
|
393
|
+
if (isDevMode())
|
|
394
|
+
console.warn("At least one of the select options value is undefined or null");
|
|
254
395
|
return false;
|
|
255
396
|
}
|
|
256
397
|
const o1Value = getFromObject(o1, objectPath);
|
|
257
398
|
const o2Value = getFromObject(o2, objectPath);
|
|
258
|
-
if (o1Value ===
|
|
399
|
+
if (o1Value === void 0 || o2Value === void 0)
|
|
259
400
|
return false;
|
|
260
|
-
}
|
|
261
401
|
return o1Value === o2Value;
|
|
262
402
|
}
|
|
263
|
-
else
|
|
403
|
+
else
|
|
264
404
|
return equals(o1, o2);
|
|
265
|
-
}
|
|
266
405
|
}
|
|
267
|
-
static {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
406
|
+
static {
|
|
407
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
408
|
+
minVersion: "12.0.0",
|
|
409
|
+
version: "22.3.0",
|
|
410
|
+
ngImport: i0,
|
|
411
|
+
type: CompareWithDirective,
|
|
412
|
+
deps: [],
|
|
413
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
static {
|
|
417
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
418
|
+
minVersion: "17.1.0",
|
|
419
|
+
version: "22.3.0",
|
|
420
|
+
type: CompareWithDirective,
|
|
421
|
+
isStandalone: true,
|
|
422
|
+
selector: "mat-select[rxapCompareWith]",
|
|
423
|
+
inputs: { objectPath: {
|
|
424
|
+
classPropertyName: "objectPath",
|
|
425
|
+
publicName: "rxapCompareWith",
|
|
426
|
+
isSignal: true,
|
|
427
|
+
isRequired: true,
|
|
428
|
+
transformFunction: null
|
|
429
|
+
} },
|
|
430
|
+
ngImport: i0
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
435
|
+
minVersion: "12.0.0",
|
|
436
|
+
version: "22.3.0",
|
|
437
|
+
ngImport: i0,
|
|
438
|
+
type: CompareWithDirective,
|
|
439
|
+
decorators: [{
|
|
271
440
|
type: Directive,
|
|
272
441
|
args: [{
|
|
273
|
-
selector:
|
|
274
|
-
standalone: true
|
|
442
|
+
selector: "mat-select[rxapCompareWith]",
|
|
443
|
+
standalone: true
|
|
275
444
|
}]
|
|
276
|
-
}],
|
|
277
|
-
|
|
278
|
-
|
|
445
|
+
}],
|
|
446
|
+
propDecorators: { objectPath: [{
|
|
447
|
+
type: i0.Input,
|
|
448
|
+
args: [{
|
|
449
|
+
isSignal: true,
|
|
450
|
+
alias: "rxapCompareWith",
|
|
451
|
+
required: true
|
|
452
|
+
}]
|
|
453
|
+
}] }
|
|
454
|
+
});
|
|
455
|
+
var ControlErrorDirective = class ControlErrorDirective {
|
|
279
456
|
constructor() {
|
|
280
457
|
this.formField = inject(MAT_FORM_FIELD);
|
|
281
458
|
this.template = inject(TemplateRef);
|
|
282
459
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
283
460
|
this.cdr = inject(ChangeDetectorRef);
|
|
284
|
-
this.key = input.required({
|
|
461
|
+
this.key = input.required({
|
|
462
|
+
...ngDevMode ? { debugName: "key" } : /* istanbul ignore next */ {},
|
|
463
|
+
alias: "rxapControlErrorKey"
|
|
464
|
+
});
|
|
285
465
|
}
|
|
286
466
|
static ngTemplateContextGuard(dir, ctx) {
|
|
287
467
|
return true;
|
|
@@ -290,13 +470,10 @@ class ControlErrorDirective {
|
|
|
290
470
|
const control = this.formField._control.ngControl?.control;
|
|
291
471
|
if (control) {
|
|
292
472
|
this._control = control;
|
|
293
|
-
this._subscription = controlErrorChanges$(control)
|
|
294
|
-
.pipe(tap((errors) => this.render(errors)))
|
|
295
|
-
.subscribe();
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
throw new Error('The form field has not a control associated!');
|
|
473
|
+
this._subscription = controlErrorChanges$(control).pipe(tap((errors) => this.render(errors))).subscribe();
|
|
299
474
|
}
|
|
475
|
+
else
|
|
476
|
+
throw new Error("The form field has not a control associated!");
|
|
300
477
|
}
|
|
301
478
|
ngOnDestroy() {
|
|
302
479
|
this._subscription?.unsubscribe();
|
|
@@ -304,33 +481,69 @@ class ControlErrorDirective {
|
|
|
304
481
|
render(errors) {
|
|
305
482
|
this.viewContainerRef.clear();
|
|
306
483
|
if (errors) {
|
|
307
|
-
const
|
|
308
|
-
const matchingKey = errorKeys.find((key) => key.toLowerCase() === this.key().toLowerCase());
|
|
484
|
+
const matchingKey = Object.keys(errors).find((key) => key.toLowerCase() === this.key().toLowerCase());
|
|
309
485
|
if (matchingKey) {
|
|
310
486
|
const error = errors[matchingKey];
|
|
311
|
-
if (!this._control)
|
|
312
|
-
throw new Error(
|
|
313
|
-
}
|
|
487
|
+
if (!this._control)
|
|
488
|
+
throw new Error("The control is not defined!");
|
|
314
489
|
this.viewContainerRef.createEmbeddedView(this.template, {
|
|
315
490
|
$implicit: error,
|
|
316
|
-
control: this._control
|
|
491
|
+
control: this._control
|
|
317
492
|
});
|
|
318
493
|
}
|
|
319
494
|
}
|
|
320
495
|
this.cdr.detectChanges();
|
|
321
496
|
}
|
|
322
|
-
static {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
497
|
+
static {
|
|
498
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
499
|
+
minVersion: "12.0.0",
|
|
500
|
+
version: "22.3.0",
|
|
501
|
+
ngImport: i0,
|
|
502
|
+
type: ControlErrorDirective,
|
|
503
|
+
deps: [],
|
|
504
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
static {
|
|
508
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
509
|
+
minVersion: "17.1.0",
|
|
510
|
+
version: "22.3.0",
|
|
511
|
+
type: ControlErrorDirective,
|
|
512
|
+
isStandalone: true,
|
|
513
|
+
selector: "[rxapControlError]",
|
|
514
|
+
inputs: { key: {
|
|
515
|
+
classPropertyName: "key",
|
|
516
|
+
publicName: "rxapControlErrorKey",
|
|
517
|
+
isSignal: true,
|
|
518
|
+
isRequired: true,
|
|
519
|
+
transformFunction: null
|
|
520
|
+
} },
|
|
521
|
+
ngImport: i0
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
526
|
+
minVersion: "12.0.0",
|
|
527
|
+
version: "22.3.0",
|
|
528
|
+
ngImport: i0,
|
|
529
|
+
type: ControlErrorDirective,
|
|
530
|
+
decorators: [{
|
|
326
531
|
type: Directive,
|
|
327
532
|
args: [{
|
|
328
|
-
selector:
|
|
329
|
-
standalone: true
|
|
533
|
+
selector: "[rxapControlError]",
|
|
534
|
+
standalone: true
|
|
330
535
|
}]
|
|
331
|
-
}],
|
|
332
|
-
|
|
333
|
-
|
|
536
|
+
}],
|
|
537
|
+
propDecorators: { key: [{
|
|
538
|
+
type: i0.Input,
|
|
539
|
+
args: [{
|
|
540
|
+
isSignal: true,
|
|
541
|
+
alias: "rxapControlErrorKey",
|
|
542
|
+
required: true
|
|
543
|
+
}]
|
|
544
|
+
}] }
|
|
545
|
+
});
|
|
546
|
+
var ControlErrorsDirective = class ControlErrorsDirective {
|
|
334
547
|
constructor() {
|
|
335
548
|
this.formField = inject(MAT_FORM_FIELD);
|
|
336
549
|
this.template = inject(TemplateRef);
|
|
@@ -344,13 +557,10 @@ class ControlErrorsDirective {
|
|
|
344
557
|
const control = this.formField._control.ngControl?.control;
|
|
345
558
|
if (control) {
|
|
346
559
|
this._control = control;
|
|
347
|
-
this._subscription = controlErrorChanges$(control)
|
|
348
|
-
.pipe(tap((errors) => this.render(errors)))
|
|
349
|
-
.subscribe();
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
throw new Error('The form field has not a control associated!');
|
|
560
|
+
this._subscription = controlErrorChanges$(control).pipe(tap((errors) => this.render(errors))).subscribe();
|
|
353
561
|
}
|
|
562
|
+
else
|
|
563
|
+
throw new Error("The form field has not a control associated!");
|
|
354
564
|
}
|
|
355
565
|
ngOnDestroy() {
|
|
356
566
|
this._subscription?.unsubscribe();
|
|
@@ -358,51 +568,69 @@ class ControlErrorsDirective {
|
|
|
358
568
|
render(errors) {
|
|
359
569
|
this.viewContainerRef.clear();
|
|
360
570
|
if (errors) {
|
|
361
|
-
if (!this._control)
|
|
362
|
-
throw new Error(
|
|
363
|
-
}
|
|
571
|
+
if (!this._control)
|
|
572
|
+
throw new Error("The control is not defined!");
|
|
364
573
|
this.viewContainerRef.createEmbeddedView(this.template, {
|
|
365
574
|
$implicit: errors,
|
|
366
|
-
control: this._control
|
|
575
|
+
control: this._control
|
|
367
576
|
});
|
|
368
577
|
}
|
|
369
578
|
this.cdr.detectChanges();
|
|
370
579
|
}
|
|
371
|
-
static {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
580
|
+
static {
|
|
581
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
582
|
+
minVersion: "12.0.0",
|
|
583
|
+
version: "22.3.0",
|
|
584
|
+
ngImport: i0,
|
|
585
|
+
type: ControlErrorsDirective,
|
|
586
|
+
deps: [],
|
|
587
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
static {
|
|
591
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
592
|
+
minVersion: "14.0.0",
|
|
593
|
+
version: "22.3.0",
|
|
594
|
+
type: ControlErrorsDirective,
|
|
595
|
+
isStandalone: true,
|
|
596
|
+
selector: "[rxapControlErrors]",
|
|
597
|
+
ngImport: i0
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
602
|
+
minVersion: "12.0.0",
|
|
603
|
+
version: "22.3.0",
|
|
604
|
+
ngImport: i0,
|
|
605
|
+
type: ControlErrorsDirective,
|
|
606
|
+
decorators: [{
|
|
375
607
|
type: Directive,
|
|
376
608
|
args: [{
|
|
377
|
-
selector:
|
|
378
|
-
standalone: true
|
|
609
|
+
selector: "[rxapControlErrors]",
|
|
610
|
+
standalone: true
|
|
379
611
|
}]
|
|
380
|
-
}]
|
|
381
|
-
|
|
382
|
-
|
|
612
|
+
}]
|
|
613
|
+
});
|
|
614
|
+
var ExtractHideShowMixin = class {
|
|
383
615
|
extractOptions(formDefinition = this.formDefinition, controlId = this.control?.controlId ?? this.controlId) {
|
|
384
616
|
const map = getMetadata(RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, Object.getPrototypeOf(formDefinition)) ?? null;
|
|
385
|
-
if (!map || !map.has(controlId))
|
|
617
|
+
if (!map || !map.has(controlId))
|
|
386
618
|
return {};
|
|
387
|
-
}
|
|
388
619
|
return map.get(controlId);
|
|
389
620
|
}
|
|
390
621
|
extractHideFunction(formDefinition = this.formDefinition, controlId = this.control?.controlId ?? this.controlId) {
|
|
391
622
|
const map = getMetadata(RXAP_FORM_SYSTEM_HIDE_METADATA, Object.getPrototypeOf(formDefinition)) ?? null;
|
|
392
|
-
if (!map || !map.has(controlId))
|
|
623
|
+
if (!map || !map.has(controlId))
|
|
393
624
|
return null;
|
|
394
|
-
}
|
|
395
625
|
return map.get(controlId);
|
|
396
626
|
}
|
|
397
627
|
extractShowFunction(formDefinition = this.formDefinition, controlId = this.control?.controlId ?? this.controlId) {
|
|
398
628
|
const map = getMetadata(RXAP_FORM_SYSTEM_SHOW_METADATA, Object.getPrototypeOf(formDefinition)) ?? null;
|
|
399
|
-
if (!map || !map.has(controlId))
|
|
629
|
+
if (!map || !map.has(controlId))
|
|
400
630
|
return null;
|
|
401
|
-
}
|
|
402
631
|
return map.get(controlId);
|
|
403
632
|
}
|
|
404
|
-
}
|
|
405
|
-
// TODO : create mixin for hide and show logic (this class and ControlHideShowDirective in @rxap/form-system)
|
|
633
|
+
};
|
|
406
634
|
let FormFieldHideShowDirective = class FormFieldHideShowDirective {
|
|
407
635
|
constructor() {
|
|
408
636
|
this.formField = inject(MAT_FORM_FIELD);
|
|
@@ -412,94 +640,103 @@ let FormFieldHideShowDirective = class FormFieldHideShowDirective {
|
|
|
412
640
|
}
|
|
413
641
|
ngAfterContentInit() {
|
|
414
642
|
const control = this.formField._control.ngControl?.control;
|
|
415
|
-
if (!control)
|
|
416
|
-
throw new Error(
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
throw new Error('The associated control is not a RxapFormControl');
|
|
420
|
-
}
|
|
643
|
+
if (!control)
|
|
644
|
+
throw new Error("The form field has not a control associated!");
|
|
645
|
+
if (!(control instanceof RxapFormControl))
|
|
646
|
+
throw new Error("The associated control is not a RxapFormControl");
|
|
421
647
|
this.control = control;
|
|
422
648
|
this.formDefinition = this.extractFormDefinition(control);
|
|
423
649
|
const hideFunction = this.extractHideFunction(this.formDefinition);
|
|
424
650
|
const showFunction = this.extractShowFunction(this.formDefinition);
|
|
425
651
|
const options = this.extractOptions(this.formDefinition);
|
|
426
652
|
let changeTrigger = this.formDefinition.rxapFormGroup.valueChanges;
|
|
427
|
-
if (options.rootChange)
|
|
653
|
+
if (options.rootChange)
|
|
428
654
|
changeTrigger = this.formDefinition.rxapFormGroup.root.valueChanges;
|
|
429
|
-
}
|
|
430
655
|
changeTrigger = changeTrigger.pipe(startWith(null));
|
|
431
|
-
if (showFunction)
|
|
656
|
+
if (showFunction)
|
|
432
657
|
this.subscription.add(changeTrigger.pipe(tap(() => {
|
|
433
|
-
|
|
434
|
-
const show = showFunction.call(this.formDefinition, control);
|
|
435
|
-
switch (show) {
|
|
658
|
+
switch (showFunction.call(this.formDefinition, control)) {
|
|
436
659
|
case true:
|
|
437
660
|
this.show();
|
|
438
661
|
break;
|
|
439
662
|
case false:
|
|
440
663
|
this.hide();
|
|
441
664
|
break;
|
|
442
|
-
case null:
|
|
443
|
-
this.reset();
|
|
444
|
-
break;
|
|
665
|
+
case null: this.reset();
|
|
445
666
|
}
|
|
446
|
-
}), catchError(err => {
|
|
667
|
+
}), catchError((err) => {
|
|
447
668
|
console.error(err);
|
|
448
669
|
return of(null);
|
|
449
670
|
})).subscribe());
|
|
450
|
-
|
|
451
|
-
if (hideFunction) {
|
|
671
|
+
if (hideFunction)
|
|
452
672
|
this.subscription.add(changeTrigger.pipe(tap(() => {
|
|
453
|
-
|
|
454
|
-
const hide = hideFunction.call(this.formDefinition, control);
|
|
455
|
-
switch (hide) {
|
|
673
|
+
switch (hideFunction.call(this.formDefinition, control)) {
|
|
456
674
|
case true:
|
|
457
675
|
this.hide();
|
|
458
676
|
break;
|
|
459
677
|
case false:
|
|
460
678
|
this.show();
|
|
461
679
|
break;
|
|
462
|
-
case null:
|
|
463
|
-
this.reset();
|
|
464
|
-
break;
|
|
680
|
+
case null: this.reset();
|
|
465
681
|
}
|
|
466
|
-
}), catchError(err => {
|
|
682
|
+
}), catchError((err) => {
|
|
467
683
|
console.error(err);
|
|
468
684
|
return of(null);
|
|
469
685
|
})).subscribe());
|
|
470
|
-
}
|
|
471
686
|
}
|
|
472
687
|
ngOnDestroy() {
|
|
473
688
|
this.subscription.unsubscribe();
|
|
474
689
|
}
|
|
475
690
|
hide() {
|
|
476
|
-
this.renderer.setStyle(this.elementRef.nativeElement,
|
|
691
|
+
this.renderer.setStyle(this.elementRef.nativeElement, "display", "none");
|
|
477
692
|
}
|
|
478
693
|
show() {
|
|
479
|
-
this.renderer.setStyle(this.elementRef.nativeElement,
|
|
694
|
+
this.renderer.setStyle(this.elementRef.nativeElement, "display", "block");
|
|
480
695
|
}
|
|
481
696
|
reset() {
|
|
482
|
-
this.renderer.removeStyle(this.elementRef.nativeElement,
|
|
697
|
+
this.renderer.removeStyle(this.elementRef.nativeElement, "display");
|
|
698
|
+
}
|
|
699
|
+
static {
|
|
700
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
701
|
+
minVersion: "12.0.0",
|
|
702
|
+
version: "22.3.0",
|
|
703
|
+
ngImport: i0,
|
|
704
|
+
type: FormFieldHideShowDirective,
|
|
705
|
+
deps: [],
|
|
706
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
static {
|
|
710
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
711
|
+
minVersion: "14.0.0",
|
|
712
|
+
version: "22.3.0",
|
|
713
|
+
type: FormFieldHideShowDirective,
|
|
714
|
+
isStandalone: true,
|
|
715
|
+
selector: "mat-form-field[rxapHideShow]",
|
|
716
|
+
ngImport: i0
|
|
717
|
+
});
|
|
483
718
|
}
|
|
484
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormFieldHideShowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
485
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: FormFieldHideShowDirective, isStandalone: true, selector: "mat-form-field[rxapHideShow]", ngImport: i0 }); }
|
|
486
719
|
};
|
|
487
|
-
FormFieldHideShowDirective = __decorate([
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
720
|
+
FormFieldHideShowDirective = __decorate([Mixin(ExtractHideShowMixin, ExtractFormDefinitionMixin)], FormFieldHideShowDirective);
|
|
721
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
722
|
+
minVersion: "12.0.0",
|
|
723
|
+
version: "22.3.0",
|
|
724
|
+
ngImport: i0,
|
|
725
|
+
type: FormFieldHideShowDirective,
|
|
726
|
+
decorators: [{
|
|
491
727
|
type: Directive,
|
|
492
728
|
args: [{
|
|
493
|
-
selector:
|
|
494
|
-
standalone: true
|
|
729
|
+
selector: "mat-form-field[rxapHideShow]",
|
|
730
|
+
standalone: true
|
|
495
731
|
}]
|
|
496
|
-
}]
|
|
497
|
-
|
|
498
|
-
|
|
732
|
+
}]
|
|
733
|
+
});
|
|
734
|
+
const PRISM_FORM_STYLE$1 = "display: flex; flex-direction: column; gap: 8px; min-width: 280px";
|
|
735
|
+
let InputClearButtonDirective = class InputClearButtonDirective {
|
|
499
736
|
constructor() {
|
|
500
737
|
this.formField = inject(MAT_FORM_FIELD);
|
|
501
|
-
this.type =
|
|
502
|
-
this.tabIndex =
|
|
738
|
+
this.type = "button";
|
|
739
|
+
this.tabIndex = "-1";
|
|
503
740
|
}
|
|
504
741
|
get control() {
|
|
505
742
|
return this.formField._control;
|
|
@@ -509,68 +746,110 @@ class InputClearButtonDirective {
|
|
|
509
746
|
}
|
|
510
747
|
onClick() {
|
|
511
748
|
if (this.control.ngControl) {
|
|
512
|
-
if (this.control.ngControl.control)
|
|
749
|
+
if (this.control.ngControl.control)
|
|
513
750
|
this.control.ngControl.control.setValue(null);
|
|
514
|
-
|
|
515
|
-
else {
|
|
751
|
+
else
|
|
516
752
|
this.control.ngControl.reset();
|
|
517
|
-
}
|
|
518
753
|
}
|
|
519
754
|
else {
|
|
520
|
-
console.log(
|
|
755
|
+
console.log("InputClearButtonDirective.onClick", "value = null");
|
|
521
756
|
this.control.value = null;
|
|
522
757
|
}
|
|
523
758
|
}
|
|
524
|
-
static {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
759
|
+
static {
|
|
760
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
761
|
+
minVersion: "12.0.0",
|
|
762
|
+
version: "22.3.0",
|
|
763
|
+
ngImport: i0,
|
|
764
|
+
type: InputClearButtonDirective,
|
|
765
|
+
deps: [],
|
|
766
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
static {
|
|
770
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
771
|
+
minVersion: "14.0.0",
|
|
772
|
+
version: "22.3.0",
|
|
773
|
+
type: InputClearButtonDirective,
|
|
774
|
+
isStandalone: true,
|
|
775
|
+
selector: "[rxapInputClearButton]",
|
|
776
|
+
host: {
|
|
777
|
+
listeners: { "click": "onClick()" },
|
|
778
|
+
properties: {
|
|
779
|
+
"attr.type": "type",
|
|
780
|
+
"attr.tabindex": "tabIndex",
|
|
781
|
+
"disabled": "isDisabled"
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
ngImport: i0
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
789
|
+
minVersion: "12.0.0",
|
|
790
|
+
version: "22.3.0",
|
|
791
|
+
ngImport: i0,
|
|
792
|
+
type: InputClearButtonDirective,
|
|
793
|
+
decorators: [{
|
|
528
794
|
type: Directive,
|
|
529
795
|
args: [{
|
|
530
|
-
selector:
|
|
796
|
+
selector: "[rxapInputClearButton]",
|
|
531
797
|
standalone: true,
|
|
532
798
|
host: {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
}
|
|
799
|
+
"[attr.type]": "type",
|
|
800
|
+
"[attr.tabindex]": "tabIndex",
|
|
801
|
+
"[disabled]": "isDisabled",
|
|
802
|
+
"(click)": "onClick()"
|
|
803
|
+
}
|
|
538
804
|
}]
|
|
539
|
-
}]
|
|
540
|
-
|
|
541
|
-
|
|
805
|
+
}]
|
|
806
|
+
});
|
|
807
|
+
const PRISM_FORM_STYLE = "display: flex; flex-direction: column; gap: 8px; min-width: 280px";
|
|
808
|
+
let RequiredDirective = class RequiredDirective {
|
|
542
809
|
constructor() {
|
|
543
810
|
this.formField = inject(MAT_FORM_FIELD);
|
|
544
811
|
}
|
|
545
812
|
ngAfterContentInit() {
|
|
546
813
|
const control = this.formField._control.ngControl?.control;
|
|
547
814
|
if (control) {
|
|
548
|
-
|
|
549
|
-
if (hasRequiredValidator) {
|
|
815
|
+
if (Reflect.get(control, "hasRequiredValidator"))
|
|
550
816
|
this.formField._control.required = true;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
else {
|
|
554
|
-
throw new Error('The form field has not a control associated!');
|
|
555
817
|
}
|
|
818
|
+
else
|
|
819
|
+
throw new Error("The form field has not a control associated!");
|
|
820
|
+
}
|
|
821
|
+
static {
|
|
822
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
823
|
+
minVersion: "12.0.0",
|
|
824
|
+
version: "22.3.0",
|
|
825
|
+
ngImport: i0,
|
|
826
|
+
type: RequiredDirective,
|
|
827
|
+
deps: [],
|
|
828
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
829
|
+
});
|
|
556
830
|
}
|
|
557
|
-
static {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
831
|
+
static {
|
|
832
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
833
|
+
minVersion: "14.0.0",
|
|
834
|
+
version: "22.3.0",
|
|
835
|
+
type: RequiredDirective,
|
|
836
|
+
isStandalone: true,
|
|
837
|
+
selector: "[formControlName][rxapRequired],[formControl][rxapRequired]",
|
|
838
|
+
ngImport: i0
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
843
|
+
minVersion: "12.0.0",
|
|
844
|
+
version: "22.3.0",
|
|
845
|
+
ngImport: i0,
|
|
846
|
+
type: RequiredDirective,
|
|
847
|
+
decorators: [{
|
|
561
848
|
type: Directive,
|
|
562
849
|
args: [{
|
|
563
|
-
selector:
|
|
564
|
-
standalone: true
|
|
850
|
+
selector: "[formControlName][rxapRequired],[formControl][rxapRequired]",
|
|
851
|
+
standalone: true
|
|
565
852
|
}]
|
|
566
|
-
}]
|
|
567
|
-
|
|
568
|
-
// region form-controls
|
|
569
|
-
// endregion
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* Generated bundle index. Do not edit.
|
|
573
|
-
*/
|
|
574
|
-
|
|
853
|
+
}]
|
|
854
|
+
});
|
|
575
855
|
export { ChipInputAdapterDirective, ChipListIteratorDirective, CompareWithDirective, ControlErrorDirective, ControlErrorsDirective, ExtractHideShowMixin, FormControlsComponent, FormFieldHideShowDirective, InputClearButtonDirective, RequiredDirective };
|
|
576
|
-
//# sourceMappingURL=rxap-material-form-system.mjs.map
|