@messaia/cdk 13.3.3 → 13.3.5-rc02
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/esm2020/lib/base/components/generic-form-base.component.mjs +15 -13
- package/esm2020/lib/forms/components/generic-form/generic-form.component.mjs +3 -3
- package/esm2020/lib/forms/constants/constants.mjs +3 -2
- package/esm2020/lib/forms/forms.module.mjs +4 -4
- package/esm2020/lib/forms/functions/decorators.mjs +49 -117
- package/esm2020/lib/forms/functions/functions.mjs +3 -26
- package/esm2020/lib/forms/models/form-field-group-definition.mjs +12 -0
- package/fesm2015/messaia-cdk.mjs +99 -188
- package/fesm2015/messaia-cdk.mjs.map +1 -1
- package/fesm2020/messaia-cdk.mjs +99 -186
- package/fesm2020/messaia-cdk.mjs.map +1 -1
- package/lib/base/components/generic-form-base.component.d.ts +2 -2
- package/lib/forms/components/generic-form/generic-form.component.d.ts +2 -2
- package/lib/forms/constants/constants.d.ts +2 -1
- package/lib/forms/forms.module.d.ts +3 -3
- package/lib/forms/functions/decorators.d.ts +4 -8
- package/lib/forms/functions/functions.d.ts +2 -9
- package/lib/forms/models/{form-field-group.d.ts → form-field-group-definition.d.ts} +5 -2
- package/package.json +1 -1
- package/esm2020/lib/forms/models/form-field-group.mjs +0 -12
package/fesm2020/messaia-cdk.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { HttpParams, HttpClient, HttpRequest, HttpHeaders, HttpEventType, HttpRe
|
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { Directive, Input, Pipe, HostListener, Component, NgModule, Injectable, Injector, ViewEncapsulation, COMPILER_OPTIONS, CompilerFactory, Compiler, ContentChildren, Optional, SkipSelf, NgZone, ElementRef, ViewChildren, ViewChild, forwardRef, ContentChild, EventEmitter, ViewContainerRef, Output, LOCALE_ID, Inject, HostBinding, Self, Attribute, SecurityContext } from '@angular/core';
|
|
7
7
|
import * as i1 from '@angular/forms';
|
|
8
|
-
import { FormControlName, FormControlDirective, FormGroup
|
|
8
|
+
import { FormControlName, FormControlDirective, FormGroup, NG_VALUE_ACCESSOR, FormArray, FormControl, NG_ASYNC_VALIDATORS, NG_VALIDATORS, AbstractControl, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
9
|
import * as i1$2 from '@angular/material/dialog';
|
|
10
10
|
import { MatDialogConfig, MatDialog, MatDialogModule } from '@angular/material/dialog';
|
|
11
11
|
import { MatExpansionPanel } from '@angular/material/expansion';
|
|
@@ -3128,48 +3128,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
3128
3128
|
args: [MatExpansionPanel]
|
|
3129
3129
|
}] } });
|
|
3130
3130
|
|
|
3131
|
-
const
|
|
3132
|
-
|
|
3133
|
-
class FormFieldGroup {
|
|
3134
|
-
/**
|
|
3135
|
-
* constructor
|
|
3136
|
-
* @param init
|
|
3137
|
-
*/
|
|
3138
|
-
constructor(init) {
|
|
3139
|
-
this.name = 'details';
|
|
3140
|
-
this.fields = [];
|
|
3141
|
-
Object.assign(this, init);
|
|
3142
|
-
}
|
|
3143
|
-
}
|
|
3131
|
+
const formFieldsMetadataKey = Symbol('vdFormFields');
|
|
3132
|
+
const formFieldGroupsMetadataKey = Symbol('vdFormFieldGroup');
|
|
3144
3133
|
|
|
3145
|
-
/**
|
|
3146
|
-
* Gets poperties decoarated with @FormField grouped by row
|
|
3147
|
-
* @param origin
|
|
3148
|
-
* @returns
|
|
3149
|
-
* @deprecated
|
|
3150
|
-
*/
|
|
3151
|
-
function getFormGroupsOld(origin) {
|
|
3152
|
-
return Reflect.getMetadata(formFieldGroupMetadataKey, origin);
|
|
3153
|
-
}
|
|
3154
3134
|
/**
|
|
3155
3135
|
* Gets poperties decoarated with @FormField grouped by row
|
|
3156
3136
|
* @param origin
|
|
3157
3137
|
* @returns
|
|
3158
3138
|
*/
|
|
3159
3139
|
function getFormGroups(origin) {
|
|
3160
|
-
|
|
3161
|
-
return Array.from(grouped).map(([_, value]) => new FormFieldGroup({
|
|
3162
|
-
name: value[0].groupName || null,
|
|
3163
|
-
header: value[0].groupHeader,
|
|
3164
|
-
fields: value,
|
|
3165
|
-
groups: Object.values((value).reduce(function (r, a) {
|
|
3166
|
-
r[a.row] = (r[a.row] || []);
|
|
3167
|
-
r[a.row].push(a);
|
|
3168
|
-
r[a.row].forEach((x, i) => x.index = x.index || i);
|
|
3169
|
-
Utils.sortArray(r[a.row], 'index');
|
|
3170
|
-
return r;
|
|
3171
|
-
}, Object.create(null)))
|
|
3172
|
-
}));
|
|
3140
|
+
return Reflect.getMetadata(formFieldGroupsMetadataKey, origin);
|
|
3173
3141
|
}
|
|
3174
3142
|
|
|
3175
3143
|
// @dynamic
|
|
@@ -3470,12 +3438,14 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
3470
3438
|
validateForm(form = null) {
|
|
3471
3439
|
var form = form || this.form;
|
|
3472
3440
|
/* Set the form as submitted */
|
|
3473
|
-
if (form && form instanceof FormGroup
|
|
3441
|
+
if (form && form instanceof FormGroup) {
|
|
3474
3442
|
/* Set form as submitted */
|
|
3475
3443
|
form['submitted'] = true;
|
|
3476
3444
|
/* Update value and validity */
|
|
3477
3445
|
form.updateValueAndValidity();
|
|
3478
3446
|
}
|
|
3447
|
+
/* Print some debug information */
|
|
3448
|
+
this.debugForm(form);
|
|
3479
3449
|
}
|
|
3480
3450
|
/**
|
|
3481
3451
|
* Validates the form
|
|
@@ -3483,9 +3453,7 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
3483
3453
|
*/
|
|
3484
3454
|
isFormValid(form = null) {
|
|
3485
3455
|
/* Print some debug information */
|
|
3486
|
-
|
|
3487
|
-
this.debugForm(form);
|
|
3488
|
-
}
|
|
3456
|
+
this.debugForm(form);
|
|
3489
3457
|
/* If the form ist not valid.. */
|
|
3490
3458
|
if (!form.valid) {
|
|
3491
3459
|
/* Mark invalid controls as dirtty and touched */
|
|
@@ -3559,15 +3527,17 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
3559
3527
|
* @param form
|
|
3560
3528
|
*/
|
|
3561
3529
|
debugForm(form = null) {
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3530
|
+
if (this.debug) {
|
|
3531
|
+
console.log('Form:', form);
|
|
3532
|
+
Object.keys(form.controls).forEach(key => {
|
|
3533
|
+
const controlErrors = form.controls[key].errors;
|
|
3534
|
+
if (controlErrors != null) {
|
|
3535
|
+
Object.keys(controlErrors).forEach(keyError => {
|
|
3536
|
+
console.log('Key control: ' + key + ', keyError: ' + keyError + ', err value: ', controlErrors[keyError]);
|
|
3537
|
+
});
|
|
3538
|
+
}
|
|
3539
|
+
});
|
|
3540
|
+
}
|
|
3571
3541
|
}
|
|
3572
3542
|
/**
|
|
3573
3543
|
* Add toolbar menu items
|
|
@@ -6987,10 +6957,10 @@ function isResetControl(controlName, control, options) {
|
|
|
6987
6957
|
isReset = control instanceof FormControl;
|
|
6988
6958
|
break;
|
|
6989
6959
|
case ResetFormType.ControlsAndFormGroupsOnly:
|
|
6990
|
-
isReset = control instanceof FormControl || control instanceof FormGroup
|
|
6960
|
+
isReset = control instanceof FormControl || control instanceof FormGroup;
|
|
6991
6961
|
break;
|
|
6992
6962
|
case ResetFormType.FormGroupsOnly:
|
|
6993
|
-
isReset = control instanceof FormGroup
|
|
6963
|
+
isReset = control instanceof FormGroup;
|
|
6994
6964
|
break;
|
|
6995
6965
|
case ResetFormType.FormArraysOnly:
|
|
6996
6966
|
isReset = control instanceof FormArray;
|
|
@@ -7031,7 +7001,7 @@ function getNestedOptions(controlName, options) {
|
|
|
7031
7001
|
return undefined;
|
|
7032
7002
|
}
|
|
7033
7003
|
|
|
7034
|
-
class RxFormGroup extends FormGroup
|
|
7004
|
+
class RxFormGroup extends FormGroup {
|
|
7035
7005
|
constructor(model, entityObject, controls, validatorOrOpts, asyncValidator) {
|
|
7036
7006
|
super(controls, validatorOrOpts, asyncValidator);
|
|
7037
7007
|
this.model = model;
|
|
@@ -7098,7 +7068,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7098
7068
|
let isDirty = false;
|
|
7099
7069
|
for (let name in this.value) {
|
|
7100
7070
|
let currentValue = this.modelInstance[name];
|
|
7101
|
-
if (!(this.controls[name] instanceof FormGroup
|
|
7071
|
+
if (!(this.controls[name] instanceof FormGroup || this.controls[name] instanceof FormArray)) {
|
|
7102
7072
|
isDirty = ApplicationUtil.notEqualTo(this.baseObject[name], currentValue);
|
|
7103
7073
|
}
|
|
7104
7074
|
else if (this.controls[name] instanceof RxFormGroup)
|
|
@@ -7117,7 +7087,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7117
7087
|
resetForm(options) {
|
|
7118
7088
|
for (let name in this.controls) {
|
|
7119
7089
|
if (isResetControl(name, this.controls[name], options)) {
|
|
7120
|
-
if (this.controls[name] instanceof FormGroup
|
|
7090
|
+
if (this.controls[name] instanceof FormGroup)
|
|
7121
7091
|
this.controls[name].resetForm(getNestedOptions(name, options));
|
|
7122
7092
|
else if (this.controls[name] instanceof FormArray) {
|
|
7123
7093
|
this.controls[name].resetForm(options && options.value ? options.value[name] : undefined);
|
|
@@ -7133,7 +7103,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7133
7103
|
}
|
|
7134
7104
|
commit() {
|
|
7135
7105
|
for (let name in this.controls) {
|
|
7136
|
-
if (this.controls[name] instanceof FormGroup
|
|
7106
|
+
if (this.controls[name] instanceof FormGroup)
|
|
7137
7107
|
this.controls[name].commit();
|
|
7138
7108
|
else if (this.controls[name] instanceof FormArray) {
|
|
7139
7109
|
this.controls[name].commit();
|
|
@@ -7164,7 +7134,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7164
7134
|
getErrorSummary(onlyMessage) {
|
|
7165
7135
|
let jObject = {};
|
|
7166
7136
|
Object.keys(this.controls).forEach(columnName => {
|
|
7167
|
-
if (this.controls[columnName] instanceof FormGroup
|
|
7137
|
+
if (this.controls[columnName] instanceof FormGroup) {
|
|
7168
7138
|
let error = this.controls[columnName].getErrorSummary(false);
|
|
7169
7139
|
if (Object.keys(error).length > 0)
|
|
7170
7140
|
jObject[columnName] = error;
|
|
@@ -7197,7 +7167,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7197
7167
|
}
|
|
7198
7168
|
valueChangedSync() {
|
|
7199
7169
|
Object.keys(this.controls).forEach(columnName => {
|
|
7200
|
-
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup
|
|
7170
|
+
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup || this.controls[columnName] instanceof RxFormGroup) && !(this.entityObject[columnName] instanceof FormControl || this.entityObject[columnName] instanceof RxFormControl) && this.controls[columnName].getControlValue && ApplicationUtil.notEqualTo(this.controls[columnName].getControlValue(), this.entityObject[columnName])) {
|
|
7201
7171
|
this.controls[columnName].setValue(this.entityObject[columnName], { updateChanged: true });
|
|
7202
7172
|
}
|
|
7203
7173
|
else if ((this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray)) {
|
|
@@ -7212,7 +7182,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7212
7182
|
}
|
|
7213
7183
|
refreshDisable() {
|
|
7214
7184
|
Object.keys(this.controls).forEach(columnName => {
|
|
7215
|
-
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup
|
|
7185
|
+
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup || this.controls[columnName] instanceof RxFormGroup)) {
|
|
7216
7186
|
this.controls[columnName].refresh();
|
|
7217
7187
|
}
|
|
7218
7188
|
else if ((this.controls[columnName] instanceof RxFormGroup)) {
|
|
@@ -7222,7 +7192,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7222
7192
|
}
|
|
7223
7193
|
bindErrorMessages() {
|
|
7224
7194
|
Object.keys(this.controls).forEach(columnName => {
|
|
7225
|
-
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup
|
|
7195
|
+
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup || this.controls[columnName] instanceof RxFormGroup)) {
|
|
7226
7196
|
this.controls[columnName].bindError();
|
|
7227
7197
|
}
|
|
7228
7198
|
else if ((this.controls[columnName] instanceof RxFormGroup)) {
|
|
@@ -7241,7 +7211,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7241
7211
|
for (let formGroup of formArray.controls)
|
|
7242
7212
|
formGroup.submitted = value;
|
|
7243
7213
|
}
|
|
7244
|
-
else if (this.controls[columnName] instanceof FormGroup
|
|
7214
|
+
else if (this.controls[columnName] instanceof FormGroup) {
|
|
7245
7215
|
this.controls[columnName].submitted = value;
|
|
7246
7216
|
}
|
|
7247
7217
|
else
|
|
@@ -7278,7 +7248,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7278
7248
|
setBackEndErrors(errors) {
|
|
7279
7249
|
Object.keys(errors).forEach(controlName => {
|
|
7280
7250
|
if (this.controls[controlName]) {
|
|
7281
|
-
if (this.controls[controlName] instanceof FormGroup
|
|
7251
|
+
if (this.controls[controlName] instanceof FormGroup)
|
|
7282
7252
|
this.controls[controlName].setBackEndErrors(errors[controlName]);
|
|
7283
7253
|
else
|
|
7284
7254
|
this.controls[controlName].setBackEndErrors(errors[controlName]);
|
|
@@ -7289,7 +7259,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7289
7259
|
let clearErrors = errors ? Object.keys(errors) : Object.keys(this.controls);
|
|
7290
7260
|
clearErrors.forEach(controlName => {
|
|
7291
7261
|
if (this.controls[controlName]) {
|
|
7292
|
-
if (this.controls[controlName] instanceof FormGroup
|
|
7262
|
+
if (this.controls[controlName] instanceof FormGroup)
|
|
7293
7263
|
errors ? this.controls[controlName].clearBackEndErrors(errors[controlName]) : this.controls[controlName].clearBackEndErrors();
|
|
7294
7264
|
else
|
|
7295
7265
|
errors ? this.controls[controlName].clearBackEndErrors(errors[controlName]) : this.controls[controlName].clearBackEndErrors();
|
|
@@ -9479,7 +9449,7 @@ class RxwebFormDirective extends BaseDirective {
|
|
|
9479
9449
|
}
|
|
9480
9450
|
updateValueAndValidity(controls) {
|
|
9481
9451
|
Object.keys(controls).forEach(key => {
|
|
9482
|
-
if (controls[key] instanceof FormGroup
|
|
9452
|
+
if (controls[key] instanceof FormGroup)
|
|
9483
9453
|
this.updateValueAndValidity(controls[key].controls);
|
|
9484
9454
|
else if (controls[key] instanceof FormArray)
|
|
9485
9455
|
this.updateValueAndValidity(controls[key].controls);
|
|
@@ -9516,7 +9486,7 @@ class RxwebFormDirective extends BaseDirective {
|
|
|
9516
9486
|
}
|
|
9517
9487
|
});
|
|
9518
9488
|
}
|
|
9519
|
-
else if (formControl instanceof FormGroup
|
|
9489
|
+
else if (formControl instanceof FormGroup) {
|
|
9520
9490
|
this.expressionProcessor(formControl.controls, `${fieldName}.`);
|
|
9521
9491
|
}
|
|
9522
9492
|
else if (formControl instanceof FormArray) {
|
|
@@ -9533,7 +9503,7 @@ class RxwebFormDirective extends BaseDirective {
|
|
|
9533
9503
|
if (this.validationRule.conditionalValidationProps && this.validationRule.conditionalValidationProps[fieldName]) {
|
|
9534
9504
|
controls[fieldName][CONDITIONAL_VALIDATOR] = conditionalChangeValidator(this.validationRule.conditionalValidationProps[fieldName]);
|
|
9535
9505
|
}
|
|
9536
|
-
else if (controls[fieldName] instanceof FormGroup
|
|
9506
|
+
else if (controls[fieldName] instanceof FormGroup && this.validationRule.conditionalObjectProps) {
|
|
9537
9507
|
var fields = this.validationRule.conditionalObjectProps.filter(t => t.objectPropName == fieldName);
|
|
9538
9508
|
let nestedFormGroup = controls[fieldName];
|
|
9539
9509
|
let propWiseConditionalControls = {};
|
|
@@ -10998,10 +10968,10 @@ class RxFormBuilder extends BaseFormBuilder {
|
|
|
10998
10968
|
}
|
|
10999
10969
|
else if (typeof prop == OBJECT_STRING && !(prop instanceof FormControl || prop instanceof RxFormControl)) {
|
|
11000
10970
|
let formGroup = (prop instanceof FormArray) ? prop.controls[0] : prop;
|
|
11001
|
-
if (!formGroup.model && (prop instanceof FormGroup
|
|
10971
|
+
if (!formGroup.model && (prop instanceof FormGroup || prop instanceof RxFormGroup)) {
|
|
11002
10972
|
formGroup = this.group(formGroup.controls);
|
|
11003
10973
|
}
|
|
11004
|
-
if (prop instanceof FormGroup
|
|
10974
|
+
if (prop instanceof FormGroup || prop instanceof RxFormGroup) {
|
|
11005
10975
|
entityObject[propName] = prop;
|
|
11006
10976
|
defaultContainer.initPropertyObject(propName, OBJECT_PROPERTY, formGroup.model, modelInstance);
|
|
11007
10977
|
}
|
|
@@ -11142,7 +11112,7 @@ class RxFormBuilder extends BaseFormBuilder {
|
|
|
11142
11112
|
break;
|
|
11143
11113
|
case OBJECT_PROPERTY:
|
|
11144
11114
|
let objectValue = entityObject[property.name];
|
|
11145
|
-
if (objectValue && objectValue instanceof Object && !(objectValue instanceof FormGroup
|
|
11115
|
+
if (objectValue && objectValue instanceof Object && !(objectValue instanceof FormGroup || objectValue instanceof RxFormGroup)) {
|
|
11146
11116
|
this.isNestedBinding = this.isNested = true;
|
|
11147
11117
|
if (instanceContainer && instanceContainer.conditionalObjectProps)
|
|
11148
11118
|
this.conditionalObjectProps = instanceContainer.conditionalObjectProps.filter(t => t.objectPropName == property.name);
|
|
@@ -11157,7 +11127,7 @@ class RxFormBuilder extends BaseFormBuilder {
|
|
|
11157
11127
|
this.builderConfigurationConditionalObjectProps = [];
|
|
11158
11128
|
this.isNestedBinding = this.isNested = false;
|
|
11159
11129
|
}
|
|
11160
|
-
else if (objectValue instanceof FormGroup
|
|
11130
|
+
else if (objectValue instanceof FormGroup || objectValue instanceof RxFormGroup)
|
|
11161
11131
|
formGroupObject[property.name] = objectValue;
|
|
11162
11132
|
break;
|
|
11163
11133
|
case ARRAY_PROPERTY:
|
|
@@ -14073,10 +14043,10 @@ class VdGenericFormComponent {
|
|
|
14073
14043
|
}
|
|
14074
14044
|
}
|
|
14075
14045
|
/** @nocollapse */ /** @nocollapse */ VdGenericFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: VdGenericFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14076
|
-
/** @nocollapse */ /** @nocollapse */ VdGenericFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: VdGenericFormComponent, selector: "vd-generic-form", inputs: { formGroup: "formGroup", fieldGroups: "fieldGroups", groupName: "groupName", context: "context", separatorKeysCodes: "separatorKeysCodes" }, queries: [{ propertyName: "editorTemplate", first: true, predicate: VdEditorDirective, descendants: true }, { propertyName: "codeTemplate", first: true, predicate: VdCodeDirective, descendants: true }, { propertyName: "fileTemplate", first: true, predicate: VdFileDirective, descendants: true }, { propertyName: "customTemplate", first: true, predicate: VdCustomDirective, descendants: true }], ngImport: i0, template: "<div *ngIf=\"formGroup && fieldRows\" [formGroup]=\"formGroup\">\r\n <!-- #region Fields -->\r\n <div layout-gt-sm=\"row\" layout=\"column\" *ngFor=\"let fields of fieldRows\">\r\n <ng-container *ngFor=\"let field of fields\" [ngSwitch]=\"field.type\">\r\n <!-- #region Error handling -->\r\n <ng-template #fieldErrors>\r\n <div *ngFor=\"let errorMessage of formGroup.controls[field.name]['errorMessages']\">{{errorMessage}}</div>\r\n </ng-template>\r\n <!-- #endregion -->\r\n <ng-container *ngIf=\"!field.hide || !field.hide(formGroup?.value, formGroup, context)\">\r\n <!-- #region Text input -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Text\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input [type]=\"field.inputType\" [minlength]=\"field.minLength||null\" [maxlength]=\"field.maxLength||null\" matInput [formControlName]=\"field.name\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Text area -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.TextArea\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <textarea matInput [formControlName]=\"field.name\" rows=\"field.rows||2\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\"></textarea>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Enum -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Enum\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-select [formControlName]=\"field.name\" [enum]=\"field.enumType\" [key]=\"field.optionValue\" [text]=\"field.optionText\" [multiple]=\"field.multiple\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" flex>\r\n <ng-template vd-select-trigger let-trigger=\"trigger\" *ngIf=\"field.triggerTemplate\">\r\n <div [innerHTML]=\"field.triggerTemplate(trigger)\"></div>\r\n </ng-template>\r\n <ng-template vd-select-option let-option=\"option\" *ngIf=\"field.optionTemplate\">\r\n <div [outerHTML]=\"field.optionTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region VdSelect -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.VdSelect\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-select [formControlName]=\"field.name\" [endpoint]=\"field.endpoint\" [params]=\"field.params?field.params(formGroup.value, formGroup, context):{}\" [projection]=\"field.projection\" [mapper]=\"field.mapper\" [compareWith]=\"field.compareWith\" [key]=\"field.optionValue\" [text]=\"field.optionText\" [multiple]=\"field.multiple\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" (itemSelected)=\"field.itemSelect && field.itemSelect($event, formGroup?.value, formGroup, context);\" (itemChange)=\"field.itemChange && field.itemChange($event, formGroup?.value, formGroup, context);\" flex>\r\n <ng-template vd-select-trigger let-trigger=\"trigger\" *ngIf=\"field.triggerTemplate\">\r\n <div [innerHTML]=\"field.triggerTemplate(trigger)\"></div>\r\n </ng-template>\r\n <ng-template vd-select-option let-option=\"option\" *ngIf=\"field.optionTemplate\">\r\n <div [outerHTML]=\"field.optionTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Chips -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Chips\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <mat-chip-list #chipList [formControlName]=\"field.name\" [disableControl]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-chip *ngFor=\"let chip of formGroup.controls[field.name]?.value\" (removed)=\"removeChip(field, chip)\" color=\"primary\" selectable=\"true\" selected>\r\n <span>{{chip}}</span>\r\n <button matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip>\r\n <input [placeholder]=\"field.header\" #chipInput [matChipInputFor]=\"chipList\" [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" [matAutocomplete]=\"chipAutocomplete\" (input)=\"filterAutocomplete(field, chipInput)\" (matChipInputTokenEnd)=\"addChip(field, $event)\" autocomplete=\"off\">\r\n </mat-chip-list>\r\n <mat-autocomplete autoActiveFirstOption #chipAutocomplete=\"matAutocomplete\" (optionSelected)=\"autocompleteValueSelected(field, $event, chipInput)\">\r\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions[field.name]\" [value]=\"option.id\">\r\n {{option.name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region VdChips -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.VdChips\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-chips #vdChip [formControlName]=\"field.name\" [endpoint]=\"field.endpoint\" [params]=\"field.params?field.params(formGroup?.value, formGroup, context):{}\" [searchField]=\"field.searchField\" [projection]=\"field.projection\" [key]=\"field.optionValue\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" [removable]=\"!field.clear\" [context]=\"context\" [suffixButtons]=\"field.suffixButtons\" (initSelect)=\"field.itemSelect && field.itemSelect($event, formGroup?.value, formGroup, context);\" (selected)=\"field.itemChange && field.itemChange($event, formGroup?.value, formGroup, context);\" (cleared)=\"field.clear && field.clear(formGroup?.value, formGroup, context);\" flex>\r\n <ng-template vd-chip let-chip=\"chip\" *ngIf=\"field.chipTemplate\">\r\n <div [outerHTML]=\"field.chipTemplate(chip)\"></div>\r\n </ng-template>\r\n <ng-template vd-autocomplete-option let-option=\"option\" *ngIf=\"field.autocompleteTemplate\">\r\n <div [outerHTML]=\"field.autocompleteTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-chips>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-hint *ngIf=\"vdChip.emptyResult\" class=\"tc-red-400\" i18n=\"@@noResultsFound\">No results found</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Select -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Select\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <mat-select [formControlName]=\"field.name\" [multiple]=\"field.multiple\" flex>\r\n <mat-option *ngFor=\"let option of field.options\" [value]=\"option.id\">{{option.name}}</mat-option>\r\n </mat-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Autocomplete -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Autocomplete\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input type=\"text\" matInput [formControlName]=\"field.name\" [matAutocomplete]=\"auto\" #autocompleteInput (input)=\"filterAutocomplete(field, autocompleteInput)\" autocomplete=\"off\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions[field.name]\" [value]=\"option.id\">\r\n {{option.name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Date -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Date\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input matInput [formControlName]=\"field.name\" autocomplete=\"off\" [matDatepicker]=\"datePicker\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-datepicker-toggle matSuffix [for]=\"datePicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #datePicker></mat-datepicker>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Checkbox -->\r\n <div *ngSwitchCase=\"FormFieldType.Checkbox\" layout-margin appearance=\"outline\" class=\"pad-bottom-xs\">\r\n <mat-checkbox [formControlName]=\"field.name\" [disableControl]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">{{field.header}}</mat-checkbox>\r\n </div>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Editor -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Editor\">\r\n <ng-template *ngIf=\"editorTemplate?.templateRef\" [ngTemplateOutlet]=\"editorTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Code -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Code\">\r\n <ng-template *ngIf=\"codeTemplate?.templateRef\" [ngTemplateOutlet]=\"codeTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region File -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.File\">\r\n <ng-template *ngIf=\"fileTemplate?.templateRef\" [ngTemplateOutlet]=\"fileTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Custom -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Custom\">\r\n <ng-template *ngIf=\"customTemplate?.templateRef\" [ngTemplateOutlet]=\"customTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <!-- #endregion -->\r\n</div>", styles: [""], components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: VdSelectComponent, selector: "vd-select", inputs: ["multiple", "disabled", "sorted", "textPrefix", "endpoint", "params", "projection", "enum", "key", "text", "prefix", "options", "filteredOptions", "filterable", "cache", "sortBy", "mapper", "compareWith", "searchField"], outputs: ["change", "itemChange", "selected", "itemSelected", "launch"] }, { type: i4$4.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i8.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i2$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: VdChipsComponent, selector: "vd-chips", inputs: ["chips", "endpoint", "params", "projection", "path", "context", "key", "searchField", "searchFields", "termMinlength", "limit", "removable", "debounce", "suffixButtons", "default"], outputs: ["initSelect", "selected", "cleared", "launch", "chipFocus"] }, { type: i4$2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i9.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i9.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { type: i4$3.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i4.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: MatFormFieldReadonlyDirective, selector: "mat-form-field" }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i1$3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { type: i1$3.MatError, selector: "mat-error", inputs: ["id"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: VdSelectTriggerDirective, selector: "[vd-select-trigger]ng-template" }, { type: VdSelectOptionDirective, selector: "[vd-select-option]ng-template" }, { type: DisableControlDirective, selector: "[disableControl]", inputs: ["disableControl"] }, { type: i4$4.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i4$4.MatChipRemove, selector: "[matChipRemove]" }, { type: i4$4.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { type: i8.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: VdChipDirective, selector: "[vd-chip]ng-template" }, { type: VdAutocompleteOptionDirective, selector: "[vd-autocomplete-option]ng-template" }, { type: i9.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i1$3.MatSuffix, selector: "[matSuffix]" }] });
|
|
14046
|
+
/** @nocollapse */ /** @nocollapse */ VdGenericFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: VdGenericFormComponent, selector: "vd-generic-form", inputs: { formGroup: "formGroup", fieldGroups: "fieldGroups", groupName: "groupName", context: "context", separatorKeysCodes: "separatorKeysCodes" }, queries: [{ propertyName: "editorTemplate", first: true, predicate: VdEditorDirective, descendants: true }, { propertyName: "codeTemplate", first: true, predicate: VdCodeDirective, descendants: true }, { propertyName: "fileTemplate", first: true, predicate: VdFileDirective, descendants: true }, { propertyName: "customTemplate", first: true, predicate: VdCustomDirective, descendants: true }], ngImport: i0, template: "<div *ngIf=\"formGroup && fieldRows\" [formGroup]=\"formGroup\">\r\n <!-- #region Fields -->\r\n <div layout-gt-sm=\"row\" layout=\"column\" *ngFor=\"let fields of fieldRows\">\r\n <ng-container *ngFor=\"let field of fields\" [ngSwitch]=\"field.type\">\r\n <!-- #region Error handling -->\r\n <ng-template #fieldErrors>\r\n <div *ngFor=\"let errorMessage of formGroup.controls[field.name]['errorMessages']\">{{errorMessage}}</div>\r\n </ng-template>\r\n <!-- #endregion -->\r\n <ng-container *ngIf=\"!field.hide || !field.hide(formGroup?.value, formGroup, context)\">\r\n <!-- #region Text input -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Text\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input [type]=\"field.inputType\" [minlength]=\"field.minLength||null\" [maxlength]=\"field.maxLength||null\" matInput [formControlName]=\"field.name\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Text area -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.TextArea\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <textarea matInput [formControlName]=\"field.name\" rows=\"field.rows||2\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\"></textarea>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Enum -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Enum\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-select [formControlName]=\"field.name\" [enum]=\"field.enumType\" [key]=\"field.optionValue\" [text]=\"field.optionText\" [multiple]=\"field.multiple\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" flex>\r\n <ng-template vd-select-trigger let-trigger=\"trigger\" *ngIf=\"field.triggerTemplate\">\r\n <div [innerHTML]=\"field.triggerTemplate(trigger)\"></div>\r\n </ng-template>\r\n <ng-template vd-select-option let-option=\"option\" *ngIf=\"field.optionTemplate\">\r\n <div [outerHTML]=\"field.optionTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region VdSelect -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.VdSelect\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-select [formControlName]=\"field.name\" [endpoint]=\"field.endpoint\" [params]=\"field.params?field.params(formGroup.value, formGroup, context):{}\" [projection]=\"field.projection\" [mapper]=\"field.mapper\" [compareWith]=\"field.compareWith\" [key]=\"field.optionValue\" [text]=\"field.optionText\" [multiple]=\"field.multiple\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" (itemSelected)=\"field.itemSelect && field.itemSelect($event, formGroup?.value, formGroup, context);\" (itemChange)=\"field.itemChange && field.itemChange($event, formGroup?.value, formGroup, context);\" flex>\r\n <ng-template vd-select-trigger let-trigger=\"trigger\" *ngIf=\"field.triggerTemplate\">\r\n <div [innerHTML]=\"field.triggerTemplate(trigger)\"></div>\r\n </ng-template>\r\n <ng-template vd-select-option let-option=\"option\" *ngIf=\"field.optionTemplate\">\r\n <div [outerHTML]=\"field.optionTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Chips -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Chips\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <mat-chip-list #chipList [formControlName]=\"field.name\" [disableControl]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-chip *ngFor=\"let chip of formGroup.controls[field.name]?.value\" (removed)=\"removeChip(field, chip)\" color=\"primary\" selectable=\"true\" selected>\r\n <span>{{chip}}</span>\r\n <button matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip>\r\n <input [placeholder]=\"field.header\" #chipInput [matChipInputFor]=\"chipList\" [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" [matAutocomplete]=\"chipAutocomplete\" (input)=\"filterAutocomplete(field, chipInput)\" (matChipInputTokenEnd)=\"addChip(field, $event)\" autocomplete=\"off\">\r\n </mat-chip-list>\r\n <mat-autocomplete autoActiveFirstOption #chipAutocomplete=\"matAutocomplete\" (optionSelected)=\"autocompleteValueSelected(field, $event, chipInput)\">\r\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions[field.name]\" [value]=\"option.id\">\r\n {{option.name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region VdChips -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.VdChips\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-chips #vdChip [formControlName]=\"field.name\" [endpoint]=\"field.endpoint\" [params]=\"field.params?field.params(formGroup?.value, formGroup, context):{}\" [searchField]=\"field.searchField\" [projection]=\"field.projection\" [key]=\"field.optionValue\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" [removable]=\"!field.clear\" [context]=\"context\" [suffixButtons]=\"field.suffixButtons\" (initSelect)=\"field.itemSelect && field.itemSelect($event, formGroup?.value, formGroup, context);\" (selected)=\"field.itemChange && field.itemChange($event, formGroup?.value, formGroup, context);\" (cleared)=\"field.clear && field.clear(formGroup?.value, formGroup, context);\" flex>\r\n <ng-template vd-chip let-chip=\"chip\" *ngIf=\"field.chipTemplate\">\r\n <div [outerHTML]=\"field.chipTemplate(chip)\"></div>\r\n </ng-template>\r\n <ng-template vd-autocomplete-option let-option=\"option\" *ngIf=\"field.autocompleteTemplate\">\r\n <div [outerHTML]=\"field.autocompleteTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-chips>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-hint *ngIf=\"vdChip.emptyResult\" class=\"tc-red-400\" i18n=\"@@noResultsFound\">No results were found.</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Select -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Select\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <mat-select [formControlName]=\"field.name\" [multiple]=\"field.multiple\" flex>\r\n <mat-option *ngFor=\"let option of field.options\" [value]=\"option.id\">{{option.name}}</mat-option>\r\n </mat-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Autocomplete -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Autocomplete\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input type=\"text\" matInput [formControlName]=\"field.name\" [matAutocomplete]=\"auto\" #autocompleteInput (input)=\"filterAutocomplete(field, autocompleteInput)\" autocomplete=\"off\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions[field.name]\" [value]=\"option.id\">\r\n {{option.name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Date -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Date\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input matInput [formControlName]=\"field.name\" autocomplete=\"off\" [matDatepicker]=\"datePicker\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-datepicker-toggle matSuffix [for]=\"datePicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #datePicker></mat-datepicker>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Checkbox -->\r\n <div *ngSwitchCase=\"FormFieldType.Checkbox\" layout-margin appearance=\"outline\" class=\"pad-bottom-xs\">\r\n <mat-checkbox [formControlName]=\"field.name\" [disableControl]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">{{field.header}}</mat-checkbox>\r\n </div>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Editor -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Editor\">\r\n <ng-template *ngIf=\"editorTemplate?.templateRef\" [ngTemplateOutlet]=\"editorTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Code -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Code\">\r\n <ng-template *ngIf=\"codeTemplate?.templateRef\" [ngTemplateOutlet]=\"codeTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region File -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.File\">\r\n <ng-template *ngIf=\"fileTemplate?.templateRef\" [ngTemplateOutlet]=\"fileTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Custom -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Custom\">\r\n <ng-template *ngIf=\"customTemplate?.templateRef\" [ngTemplateOutlet]=\"customTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <!-- #endregion -->\r\n</div>", styles: [""], components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: VdSelectComponent, selector: "vd-select", inputs: ["multiple", "disabled", "sorted", "textPrefix", "endpoint", "params", "projection", "enum", "key", "text", "prefix", "options", "filteredOptions", "filterable", "cache", "sortBy", "mapper", "compareWith", "searchField"], outputs: ["change", "itemChange", "selected", "itemSelected", "launch"] }, { type: i4$4.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i8.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i2$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: VdChipsComponent, selector: "vd-chips", inputs: ["chips", "endpoint", "params", "projection", "path", "context", "key", "searchField", "searchFields", "termMinlength", "limit", "removable", "debounce", "suffixButtons", "default"], outputs: ["initSelect", "selected", "cleared", "launch", "chipFocus"] }, { type: i4$2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i9.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i9.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { type: i4$3.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i4.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: MatFormFieldReadonlyDirective, selector: "mat-form-field" }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i1$3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { type: i1$3.MatError, selector: "mat-error", inputs: ["id"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: VdSelectTriggerDirective, selector: "[vd-select-trigger]ng-template" }, { type: VdSelectOptionDirective, selector: "[vd-select-option]ng-template" }, { type: DisableControlDirective, selector: "[disableControl]", inputs: ["disableControl"] }, { type: i4$4.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i4$4.MatChipRemove, selector: "[matChipRemove]" }, { type: i4$4.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { type: i8.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: VdChipDirective, selector: "[vd-chip]ng-template" }, { type: VdAutocompleteOptionDirective, selector: "[vd-autocomplete-option]ng-template" }, { type: i9.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i1$3.MatSuffix, selector: "[matSuffix]" }] });
|
|
14077
14047
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: VdGenericFormComponent, decorators: [{
|
|
14078
14048
|
type: Component,
|
|
14079
|
-
args: [{ selector: 'vd-generic-form', template: "<div *ngIf=\"formGroup && fieldRows\" [formGroup]=\"formGroup\">\r\n <!-- #region Fields -->\r\n <div layout-gt-sm=\"row\" layout=\"column\" *ngFor=\"let fields of fieldRows\">\r\n <ng-container *ngFor=\"let field of fields\" [ngSwitch]=\"field.type\">\r\n <!-- #region Error handling -->\r\n <ng-template #fieldErrors>\r\n <div *ngFor=\"let errorMessage of formGroup.controls[field.name]['errorMessages']\">{{errorMessage}}</div>\r\n </ng-template>\r\n <!-- #endregion -->\r\n <ng-container *ngIf=\"!field.hide || !field.hide(formGroup?.value, formGroup, context)\">\r\n <!-- #region Text input -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Text\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input [type]=\"field.inputType\" [minlength]=\"field.minLength||null\" [maxlength]=\"field.maxLength||null\" matInput [formControlName]=\"field.name\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Text area -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.TextArea\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <textarea matInput [formControlName]=\"field.name\" rows=\"field.rows||2\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\"></textarea>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Enum -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Enum\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-select [formControlName]=\"field.name\" [enum]=\"field.enumType\" [key]=\"field.optionValue\" [text]=\"field.optionText\" [multiple]=\"field.multiple\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" flex>\r\n <ng-template vd-select-trigger let-trigger=\"trigger\" *ngIf=\"field.triggerTemplate\">\r\n <div [innerHTML]=\"field.triggerTemplate(trigger)\"></div>\r\n </ng-template>\r\n <ng-template vd-select-option let-option=\"option\" *ngIf=\"field.optionTemplate\">\r\n <div [outerHTML]=\"field.optionTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region VdSelect -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.VdSelect\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-select [formControlName]=\"field.name\" [endpoint]=\"field.endpoint\" [params]=\"field.params?field.params(formGroup.value, formGroup, context):{}\" [projection]=\"field.projection\" [mapper]=\"field.mapper\" [compareWith]=\"field.compareWith\" [key]=\"field.optionValue\" [text]=\"field.optionText\" [multiple]=\"field.multiple\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" (itemSelected)=\"field.itemSelect && field.itemSelect($event, formGroup?.value, formGroup, context);\" (itemChange)=\"field.itemChange && field.itemChange($event, formGroup?.value, formGroup, context);\" flex>\r\n <ng-template vd-select-trigger let-trigger=\"trigger\" *ngIf=\"field.triggerTemplate\">\r\n <div [innerHTML]=\"field.triggerTemplate(trigger)\"></div>\r\n </ng-template>\r\n <ng-template vd-select-option let-option=\"option\" *ngIf=\"field.optionTemplate\">\r\n <div [outerHTML]=\"field.optionTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Chips -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Chips\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <mat-chip-list #chipList [formControlName]=\"field.name\" [disableControl]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-chip *ngFor=\"let chip of formGroup.controls[field.name]?.value\" (removed)=\"removeChip(field, chip)\" color=\"primary\" selectable=\"true\" selected>\r\n <span>{{chip}}</span>\r\n <button matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip>\r\n <input [placeholder]=\"field.header\" #chipInput [matChipInputFor]=\"chipList\" [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" [matAutocomplete]=\"chipAutocomplete\" (input)=\"filterAutocomplete(field, chipInput)\" (matChipInputTokenEnd)=\"addChip(field, $event)\" autocomplete=\"off\">\r\n </mat-chip-list>\r\n <mat-autocomplete autoActiveFirstOption #chipAutocomplete=\"matAutocomplete\" (optionSelected)=\"autocompleteValueSelected(field, $event, chipInput)\">\r\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions[field.name]\" [value]=\"option.id\">\r\n {{option.name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region VdChips -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.VdChips\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-chips #vdChip [formControlName]=\"field.name\" [endpoint]=\"field.endpoint\" [params]=\"field.params?field.params(formGroup?.value, formGroup, context):{}\" [searchField]=\"field.searchField\" [projection]=\"field.projection\" [key]=\"field.optionValue\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" [removable]=\"!field.clear\" [context]=\"context\" [suffixButtons]=\"field.suffixButtons\" (initSelect)=\"field.itemSelect && field.itemSelect($event, formGroup?.value, formGroup, context);\" (selected)=\"field.itemChange && field.itemChange($event, formGroup?.value, formGroup, context);\" (cleared)=\"field.clear && field.clear(formGroup?.value, formGroup, context);\" flex>\r\n <ng-template vd-chip let-chip=\"chip\" *ngIf=\"field.chipTemplate\">\r\n <div [outerHTML]=\"field.chipTemplate(chip)\"></div>\r\n </ng-template>\r\n <ng-template vd-autocomplete-option let-option=\"option\" *ngIf=\"field.autocompleteTemplate\">\r\n <div [outerHTML]=\"field.autocompleteTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-chips>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-hint *ngIf=\"vdChip.emptyResult\" class=\"tc-red-400\" i18n=\"@@noResultsFound\">No results found</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Select -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Select\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <mat-select [formControlName]=\"field.name\" [multiple]=\"field.multiple\" flex>\r\n <mat-option *ngFor=\"let option of field.options\" [value]=\"option.id\">{{option.name}}</mat-option>\r\n </mat-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Autocomplete -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Autocomplete\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input type=\"text\" matInput [formControlName]=\"field.name\" [matAutocomplete]=\"auto\" #autocompleteInput (input)=\"filterAutocomplete(field, autocompleteInput)\" autocomplete=\"off\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions[field.name]\" [value]=\"option.id\">\r\n {{option.name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Date -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Date\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input matInput [formControlName]=\"field.name\" autocomplete=\"off\" [matDatepicker]=\"datePicker\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-datepicker-toggle matSuffix [for]=\"datePicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #datePicker></mat-datepicker>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Checkbox -->\r\n <div *ngSwitchCase=\"FormFieldType.Checkbox\" layout-margin appearance=\"outline\" class=\"pad-bottom-xs\">\r\n <mat-checkbox [formControlName]=\"field.name\" [disableControl]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">{{field.header}}</mat-checkbox>\r\n </div>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Editor -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Editor\">\r\n <ng-template *ngIf=\"editorTemplate?.templateRef\" [ngTemplateOutlet]=\"editorTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Code -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Code\">\r\n <ng-template *ngIf=\"codeTemplate?.templateRef\" [ngTemplateOutlet]=\"codeTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region File -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.File\">\r\n <ng-template *ngIf=\"fileTemplate?.templateRef\" [ngTemplateOutlet]=\"fileTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Custom -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Custom\">\r\n <ng-template *ngIf=\"customTemplate?.templateRef\" [ngTemplateOutlet]=\"customTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <!-- #endregion -->\r\n</div>", styles: [""] }]
|
|
14049
|
+
args: [{ selector: 'vd-generic-form', template: "<div *ngIf=\"formGroup && fieldRows\" [formGroup]=\"formGroup\">\r\n <!-- #region Fields -->\r\n <div layout-gt-sm=\"row\" layout=\"column\" *ngFor=\"let fields of fieldRows\">\r\n <ng-container *ngFor=\"let field of fields\" [ngSwitch]=\"field.type\">\r\n <!-- #region Error handling -->\r\n <ng-template #fieldErrors>\r\n <div *ngFor=\"let errorMessage of formGroup.controls[field.name]['errorMessages']\">{{errorMessage}}</div>\r\n </ng-template>\r\n <!-- #endregion -->\r\n <ng-container *ngIf=\"!field.hide || !field.hide(formGroup?.value, formGroup, context)\">\r\n <!-- #region Text input -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Text\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input [type]=\"field.inputType\" [minlength]=\"field.minLength||null\" [maxlength]=\"field.maxLength||null\" matInput [formControlName]=\"field.name\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Text area -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.TextArea\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <textarea matInput [formControlName]=\"field.name\" rows=\"field.rows||2\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\"></textarea>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Enum -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Enum\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-select [formControlName]=\"field.name\" [enum]=\"field.enumType\" [key]=\"field.optionValue\" [text]=\"field.optionText\" [multiple]=\"field.multiple\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" flex>\r\n <ng-template vd-select-trigger let-trigger=\"trigger\" *ngIf=\"field.triggerTemplate\">\r\n <div [innerHTML]=\"field.triggerTemplate(trigger)\"></div>\r\n </ng-template>\r\n <ng-template vd-select-option let-option=\"option\" *ngIf=\"field.optionTemplate\">\r\n <div [outerHTML]=\"field.optionTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region VdSelect -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.VdSelect\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-select [formControlName]=\"field.name\" [endpoint]=\"field.endpoint\" [params]=\"field.params?field.params(formGroup.value, formGroup, context):{}\" [projection]=\"field.projection\" [mapper]=\"field.mapper\" [compareWith]=\"field.compareWith\" [key]=\"field.optionValue\" [text]=\"field.optionText\" [multiple]=\"field.multiple\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" (itemSelected)=\"field.itemSelect && field.itemSelect($event, formGroup?.value, formGroup, context);\" (itemChange)=\"field.itemChange && field.itemChange($event, formGroup?.value, formGroup, context);\" flex>\r\n <ng-template vd-select-trigger let-trigger=\"trigger\" *ngIf=\"field.triggerTemplate\">\r\n <div [innerHTML]=\"field.triggerTemplate(trigger)\"></div>\r\n </ng-template>\r\n <ng-template vd-select-option let-option=\"option\" *ngIf=\"field.optionTemplate\">\r\n <div [outerHTML]=\"field.optionTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Chips -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Chips\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <mat-chip-list #chipList [formControlName]=\"field.name\" [disableControl]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-chip *ngFor=\"let chip of formGroup.controls[field.name]?.value\" (removed)=\"removeChip(field, chip)\" color=\"primary\" selectable=\"true\" selected>\r\n <span>{{chip}}</span>\r\n <button matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip>\r\n <input [placeholder]=\"field.header\" #chipInput [matChipInputFor]=\"chipList\" [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" [matAutocomplete]=\"chipAutocomplete\" (input)=\"filterAutocomplete(field, chipInput)\" (matChipInputTokenEnd)=\"addChip(field, $event)\" autocomplete=\"off\">\r\n </mat-chip-list>\r\n <mat-autocomplete autoActiveFirstOption #chipAutocomplete=\"matAutocomplete\" (optionSelected)=\"autocompleteValueSelected(field, $event, chipInput)\">\r\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions[field.name]\" [value]=\"option.id\">\r\n {{option.name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region VdChips -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.VdChips\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <vd-chips #vdChip [formControlName]=\"field.name\" [endpoint]=\"field.endpoint\" [params]=\"field.params?field.params(formGroup?.value, formGroup, context):{}\" [searchField]=\"field.searchField\" [projection]=\"field.projection\" [key]=\"field.optionValue\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\" [removable]=\"!field.clear\" [context]=\"context\" [suffixButtons]=\"field.suffixButtons\" (initSelect)=\"field.itemSelect && field.itemSelect($event, formGroup?.value, formGroup, context);\" (selected)=\"field.itemChange && field.itemChange($event, formGroup?.value, formGroup, context);\" (cleared)=\"field.clear && field.clear(formGroup?.value, formGroup, context);\" flex>\r\n <ng-template vd-chip let-chip=\"chip\" *ngIf=\"field.chipTemplate\">\r\n <div [outerHTML]=\"field.chipTemplate(chip)\"></div>\r\n </ng-template>\r\n <ng-template vd-autocomplete-option let-option=\"option\" *ngIf=\"field.autocompleteTemplate\">\r\n <div [outerHTML]=\"field.autocompleteTemplate(option)\"></div>\r\n </ng-template>\r\n </vd-chips>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-hint *ngIf=\"vdChip.emptyResult\" class=\"tc-red-400\" i18n=\"@@noResultsFound\">No results were found.</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Select -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Select\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <mat-select [formControlName]=\"field.name\" [multiple]=\"field.multiple\" flex>\r\n <mat-option *ngFor=\"let option of field.options\" [value]=\"option.id\">{{option.name}}</mat-option>\r\n </mat-select>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Autocomplete -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Autocomplete\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input type=\"text\" matInput [formControlName]=\"field.name\" [matAutocomplete]=\"auto\" #autocompleteInput (input)=\"filterAutocomplete(field, autocompleteInput)\" autocomplete=\"off\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions[field.name]\" [value]=\"option.id\">\r\n {{option.name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Date -->\r\n <mat-form-field *ngSwitchCase=\"FormFieldType.Date\" [attr.flex]=\"field.flex||0\" layout-margin appearance=\"outline\">\r\n <mat-label>{{field.header}}</mat-label>\r\n <input matInput [formControlName]=\"field.name\" autocomplete=\"off\" [matDatepicker]=\"datePicker\" [readonly]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">\r\n <mat-datepicker-toggle matSuffix [for]=\"datePicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #datePicker></mat-datepicker>\r\n <mat-hint *ngIf=\"field.hint\">{{field.hint}}</mat-hint>\r\n <mat-error>\r\n <ng-container *ngTemplateOutlet=\"fieldErrors\"></ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Checkbox -->\r\n <div *ngSwitchCase=\"FormFieldType.Checkbox\" layout-margin appearance=\"outline\" class=\"pad-bottom-xs\">\r\n <mat-checkbox [formControlName]=\"field.name\" [disableControl]=\"field.readonly && field.readonly(formGroup?.value, formGroup, context)\">{{field.header}}</mat-checkbox>\r\n </div>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Editor -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Editor\">\r\n <ng-template *ngIf=\"editorTemplate?.templateRef\" [ngTemplateOutlet]=\"editorTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Code -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Code\">\r\n <ng-template *ngIf=\"codeTemplate?.templateRef\" [ngTemplateOutlet]=\"codeTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region File -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.File\">\r\n <ng-template *ngIf=\"fileTemplate?.templateRef\" [ngTemplateOutlet]=\"fileTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Custom -->\r\n <ng-container *ngSwitchCase=\"FormFieldType.Custom\">\r\n <ng-template *ngIf=\"customTemplate?.templateRef\" [ngTemplateOutlet]=\"customTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ field: field, formGroup: formGroup }\"></ng-template>\r\n </ng-container>\r\n <!-- #endregion -->\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <!-- #endregion -->\r\n</div>", styles: [""] }]
|
|
14080
14050
|
}], propDecorators: { formGroup: [{
|
|
14081
14051
|
type: Input
|
|
14082
14052
|
}], fieldGroups: [{
|
|
@@ -14478,87 +14448,18 @@ class FormFieldDefinition {
|
|
|
14478
14448
|
}
|
|
14479
14449
|
}
|
|
14480
14450
|
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
var formField = new FormFieldDefinition(Object.assign(args, {
|
|
14494
|
-
name: args.name || propertyKey,
|
|
14495
|
-
header: args.header || Reflect.getMetadata(headerMetadataKey, target, propertyKey) || propertyName,
|
|
14496
|
-
autocompleteTemplate: args.autocompleteTemplate || ((option) => option[formField.autocompleteText]),
|
|
14497
|
-
chipTemplate: args.chipTemplate || ((chip) => chip[formField.chipText])
|
|
14498
|
-
}));
|
|
14499
|
-
/* Type enum */
|
|
14500
|
-
if (formField.enumType) {
|
|
14501
|
-
formField.type || (formField.type = FormFieldType.Enum);
|
|
14502
|
-
}
|
|
14503
|
-
/* Type VdSelect */
|
|
14504
|
-
else if (formField.endpoint) {
|
|
14505
|
-
formField.type || (formField.type = FormFieldType.VdSelect);
|
|
14506
|
-
}
|
|
14507
|
-
/* Type Select */
|
|
14508
|
-
else if (formField.options) {
|
|
14509
|
-
formField.type || (formField.type = FormFieldType.Select);
|
|
14510
|
-
}
|
|
14511
|
-
/* Type TextArea */
|
|
14512
|
-
else if (formField.rows) {
|
|
14513
|
-
formField.type || (formField.type = FormFieldType.TextArea);
|
|
14514
|
-
}
|
|
14515
|
-
/* Type File */
|
|
14516
|
-
else if (formField.filePath) {
|
|
14517
|
-
formField.type || (formField.type = FormFieldType.File);
|
|
14518
|
-
}
|
|
14519
|
-
/* Other types */
|
|
14520
|
-
else {
|
|
14521
|
-
switch (propertyType.toLowerCase()) {
|
|
14522
|
-
case 'number':
|
|
14523
|
-
formField.type || (formField.type = FormFieldType.Text);
|
|
14524
|
-
formField.inputType || (formField.inputType = 'number');
|
|
14525
|
-
break;
|
|
14526
|
-
case 'date':
|
|
14527
|
-
formField.type || (formField.type = FormFieldType.Date);
|
|
14528
|
-
break;
|
|
14529
|
-
case 'boolean':
|
|
14530
|
-
formField.type || (formField.type = FormFieldType.Checkbox);
|
|
14531
|
-
break;
|
|
14532
|
-
default:
|
|
14533
|
-
formField.type || (formField.type = FormFieldType.Text);
|
|
14534
|
-
break;
|
|
14535
|
-
}
|
|
14536
|
-
}
|
|
14537
|
-
/* Get existing table groups */
|
|
14538
|
-
let formFieldGroups = Reflect.getMetadata(formFieldGroupMetadataKey, target) || [];
|
|
14539
|
-
/* Get the group */
|
|
14540
|
-
var group = formFieldGroups.filter(x => x.name?.trim() == formField.groupName?.trim())[0];
|
|
14541
|
-
/* The group already exists, add the new form field */
|
|
14542
|
-
if (group) {
|
|
14543
|
-
group.fields.push(formField);
|
|
14544
|
-
}
|
|
14545
|
-
/* Create a new group */
|
|
14546
|
-
else {
|
|
14547
|
-
group = new FormFieldGroup({ name: formField.groupName || null, header: formField.groupHeader, fields: [formField] });
|
|
14548
|
-
formFieldGroups.push(group);
|
|
14549
|
-
}
|
|
14550
|
-
/* Sort the fields by row */
|
|
14551
|
-
group.fields = group.fields?.sort((a, b) => (a.row || 0 > b.row || 0) ? 1 : ((b.row || 0 > a.row || 0) ? -1 : 0)) || [];
|
|
14552
|
-
/* Group the fields */
|
|
14553
|
-
group.groups = Object.values((group.fields).reduce(function (r, a) {
|
|
14554
|
-
r[a.row] = r[a.row] || [];
|
|
14555
|
-
r[a.row].push(a);
|
|
14556
|
-
return r;
|
|
14557
|
-
}, Object.create(null)));
|
|
14558
|
-
/* Add new table column */
|
|
14559
|
-
Reflect.defineMetadata(formFieldGroupMetadataKey, formFieldGroups, target);
|
|
14560
|
-
};
|
|
14561
|
-
}
|
|
14451
|
+
class FormFieldGroupDefinition {
|
|
14452
|
+
/**
|
|
14453
|
+
* constructor
|
|
14454
|
+
* @param init
|
|
14455
|
+
*/
|
|
14456
|
+
constructor(init) {
|
|
14457
|
+
this.name = 'details';
|
|
14458
|
+
this.fields = [];
|
|
14459
|
+
Object.assign(this, init);
|
|
14460
|
+
}
|
|
14461
|
+
}
|
|
14462
|
+
|
|
14562
14463
|
/**
|
|
14563
14464
|
* Property decorator to create form fields
|
|
14564
14465
|
* @param args
|
|
@@ -14616,50 +14517,62 @@ function FormField(args) {
|
|
|
14616
14517
|
}
|
|
14617
14518
|
}
|
|
14618
14519
|
/* Get old form fields */
|
|
14619
|
-
const previousFormFields = Reflect.getMetadata(
|
|
14520
|
+
const previousFormFields = Reflect.getMetadata(formFieldsMetadataKey, target);
|
|
14620
14521
|
/* Create a copy of the result */
|
|
14621
14522
|
let formFields = previousFormFields ? previousFormFields.concat([formField]) : [formField];
|
|
14622
14523
|
/* Override the result in the metadata */
|
|
14623
|
-
Reflect.defineMetadata(
|
|
14524
|
+
Reflect.defineMetadata(formFieldsMetadataKey, formFields, target);
|
|
14525
|
+
/* Group the fields */
|
|
14526
|
+
var groups = Array.from(Utils.groupArrayBy(formFields, x => x.groupName))
|
|
14527
|
+
.map(([_, value]) => new FormFieldGroupDefinition({
|
|
14528
|
+
name: value[0].groupName || null,
|
|
14529
|
+
header: value[0].groupHeader,
|
|
14530
|
+
fields: value,
|
|
14531
|
+
groups: Object.values((value).reduce(function (r, a) {
|
|
14532
|
+
r[a.row] = (r[a.row] || []);
|
|
14533
|
+
r[a.row].push(a);
|
|
14534
|
+
r[a.row].forEach((x, i) => x.index = x.index || i);
|
|
14535
|
+
Utils.sortArray(r[a.row], 'index');
|
|
14536
|
+
return r;
|
|
14537
|
+
}, Object.create(null)))
|
|
14538
|
+
}));
|
|
14539
|
+
/* Override the result in the metadata */
|
|
14540
|
+
Reflect.defineMetadata(formFieldGroupsMetadataKey, groups, target);
|
|
14624
14541
|
};
|
|
14625
14542
|
}
|
|
14626
14543
|
/**
|
|
14627
14544
|
* Property decorator to create form fields
|
|
14628
|
-
* @param
|
|
14545
|
+
* @param type
|
|
14546
|
+
* @param header
|
|
14547
|
+
* @param init
|
|
14629
14548
|
* @returns
|
|
14630
14549
|
*/
|
|
14631
|
-
function
|
|
14550
|
+
function FormFieldGroup(type, header, init) {
|
|
14632
14551
|
return function (target, propertyKey) {
|
|
14633
|
-
/*
|
|
14634
|
-
|
|
14552
|
+
/* Create an instance of the group object */
|
|
14553
|
+
var instance = Reflect.construct(type, []);
|
|
14635
14554
|
/* Get from groups */
|
|
14636
|
-
var groups = getFormGroups(
|
|
14637
|
-
/* Get
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
/*
|
|
14654
|
-
|
|
14655
|
-
/*
|
|
14656
|
-
|
|
14657
|
-
r[a.row] = r[a.row] || [];
|
|
14658
|
-
r[a.row].push(a);
|
|
14659
|
-
return r;
|
|
14660
|
-
}, Object.create(null)));
|
|
14661
|
-
/* Add new table column */
|
|
14662
|
-
Reflect.defineMetadata(formFieldGroupMetadataKey, formFieldGroups, target);
|
|
14555
|
+
var groups = getFormGroups(instance);
|
|
14556
|
+
/* Get the fields from the groups */
|
|
14557
|
+
groups?.forEach(x => {
|
|
14558
|
+
Object.assign(x, {
|
|
14559
|
+
name: propertyKey,
|
|
14560
|
+
header: header,
|
|
14561
|
+
type: type,
|
|
14562
|
+
instance: init || instance
|
|
14563
|
+
});
|
|
14564
|
+
/* Set the name of the group in the fields */
|
|
14565
|
+
x.fields.forEach(y => Object.assign(y, {
|
|
14566
|
+
groupName: propertyKey,
|
|
14567
|
+
groupHeader: header
|
|
14568
|
+
}));
|
|
14569
|
+
});
|
|
14570
|
+
/* Get old form field groups */
|
|
14571
|
+
const previousGroups = Reflect.getMetadata(formFieldGroupsMetadataKey, target);
|
|
14572
|
+
/* Create a copy of the result */
|
|
14573
|
+
let combinedGroups = previousGroups ? previousGroups.concat(groups) : groups;
|
|
14574
|
+
/* Override the result in the metadata */
|
|
14575
|
+
Reflect.defineMetadata(formFieldGroupsMetadataKey, combinedGroups, target);
|
|
14663
14576
|
};
|
|
14664
14577
|
}
|
|
14665
14578
|
|
|
@@ -16865,5 +16778,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
16865
16778
|
* Generated bundle index. Do not edit.
|
|
16866
16779
|
*/
|
|
16867
16780
|
|
|
16868
|
-
export { AbstractMatFormField, ActionMenuItem, Api, AppSetting, AppStorage, AsyncValidationDirective, AuditEntity, AuditUser, AuthHelper, AuthUser, BaseComponent, BaseDirective, BaseEntity, BaseInterceptor, BaseService, CachingInterceptor, Column, Common, ContextHelper, DataSourceFilterDirective, DataSourcePipe, DisableControlDirective, Display, DynamicBuilder, DynamicComponentCompiler, EnumPipe, EnumService, EqualValidator, ErrorMessageBindingStrategy, FileControlDirective, FileService, FileSizePipe, FilterClearComponent, FilterDateComponent, FilterInputComponent, FilterPipe, FilterSelectComponent, FirstLetterPipe, FormBuilderConfiguration, FormField, FormFieldDefinition, FormFieldGroup,
|
|
16781
|
+
export { AbstractMatFormField, ActionMenuItem, Api, AppSetting, AppStorage, AsyncValidationDirective, AuditEntity, AuditUser, AuthHelper, AuthUser, BaseComponent, BaseDirective, BaseEntity, BaseInterceptor, BaseService, CachingInterceptor, Column, Common, ContextHelper, DataSourceFilterDirective, DataSourcePipe, DisableControlDirective, Display, DynamicBuilder, DynamicComponentCompiler, EnumPipe, EnumService, EqualValidator, ErrorMessageBindingStrategy, FileControlDirective, FileService, FileSizePipe, FilterClearComponent, FilterDateComponent, FilterInputComponent, FilterPipe, FilterSelectComponent, FirstLetterPipe, FormBuilderConfiguration, FormField, FormFieldDefinition, FormFieldGroup, FormFieldGroupDefinition, FormFieldType, GenericFormBaseComponent, GenericFormComponent, GenericListComponent, GenericReactiveFormComponent, GenericService, HtmlControlTemplateDirective, IAbstractControl, ImageFileControlDirective, IpVersion, KeyValue, KeysPipe, LoadingScreenInterceptor, LoadingScreenService, MatFormFieldEditorDirective, MatFormFieldReadonlyDirective, Menu, MenuItem, MenuItemService, MenuResolve, MenuScope, MenuService, MessageType, MonthNamePipe, NativeElementInjectorDirective, NumericValueType, OnlyNumberDirective, OrderPipe, Pagination, PlaceholderPipe, PrintService, RUNTIME_COMPILER_PROVIDERS, ReactiveFormConfig, ReactiveTypedFormsModule, ResetFormType, RxFormArray, RxFormBuilder, RxFormControl, RxFormControlDirective, RxFormGroup, RxReactiveFormsModule, RxwebFormDirective, RxwebValidators, SafeHtmlPipe, Salutation, SaveAction, ServiceLocator, SubMenuResolve, SuffixButton, Table, TableColumn, TableColumnType, TableDataSource, TableDefinition, TableMenuItem, TableStaticDataSource, TimePipe, TitleCase, TruncatePipe, TypedForm, TypedFormBuilder, UniqueValidatorDirective, Utils, ValidationAlphabetLocale, ValueAccessorBase, ValuesPipe, VdAlertDialogComponent, VdAutocompleteOptionDirective, VdBaseModule, VdChipDirective, VdChipsComponent, VdChipsModule, VdCodeDirective, VdCommonModule, VdConfirmDialogComponent, VdCustomDirective, VdDialogActionsDirective, VdDialogComponent, VdDialogContentDirective, VdDialogService, VdDialogTitleDirective, VdDialogsModule, VdDynamicTableComponent, VdEditorDirective, VdFileDirective, VdFileInputComponent, VdFileModule, VdFilterOptionDirective, VdFormToolbarComponent, VdFormToolbarMenuComponent, VdFormsModule, VdGenericFormComponent, VdHttpModule, VdLayoutCardOverComponent, VdLayoutCloseDirective, VdLayoutComponent, VdLayoutFooterComponent, VdLayoutManageListCloseDirective, VdLayoutManageListComponent, VdLayoutManageListOpenDirective, VdLayoutManageListToggleDirective, VdLayoutModule, VdLayoutNavComponent, VdLayoutNavListCloseDirective, VdLayoutNavListComponent, VdLayoutNavListOpenDirective, VdLayoutNavListToggleDirective, VdLayoutOpenDirective, VdLayoutToggleDirective, VdListToolbarComponent, VdListToolbarMenuComponent, VdMediaModule, VdMediaService, VdMediaToggleDirective, VdMenuComponent, VdMenuModule, VdNavigationDrawerComponent, VdNavigationDrawerMenuDirective, VdNavigationDrawerToolbarDirective, VdPromptDialogComponent, VdSearchBoxComponent, VdSearchInputComponent, VdSearchModule, VdSelectComponent, VdSelectModule, VdSelectOptionDirective, VdSelectTriggerDirective, VdTableModule, allOf, allOfAsync, alpha, alphaAsync, alphaNumeric, alphaNumericAsync, and, ascii, async, blacklist, choice, choiceAsync, compare, compose, contains, containsAsync, createCompiler, creditCard, creditCardAsync, cusip, custom, customAsync, dataUri, date, dateAsync, different, digit, disable, elementClass, email, endsWith, endsWithAsync, error, escape, even, extension, extensionAsync, factor, factorAsync, file, fileAsync, fileSize, fileSizeAsync, formFieldsMetadataKey as formFieldGroupMetadataKey, formFieldGroupsMetadataKey as formFieldsMetadataKey, getEndpoint, getFormGroups, getTableDefinition, greaterThan, greaterThanAsync, greaterThanEqualTo, greaterThanEqualToAsync, grid, headerMetadataKey, hexColor, image, imageAsync, json, latLong, latitude, leapYear, lessThan, lessThanAsync, lessThanEqualTo, lessThanEqualToAsync, longitude, lowerCase, ltrim, mac, mask, maxDate, maxDateAsync, maxLength, maxLengthAsync, maxNumber, maxNumberAsync, maxTime, maxTimeAsync, minDate, minDateAsync, minLength, minLengthAsync, minNumber, minNumberAsync, minTime, minTimeAsync, mixinControlValueAccessor, mixinDisabled, model, noneOf, noneOfAsync, not, notEmpty, numeric, numericAsync, odd, oneOf, oneOfAsync, or, password, passwordAsync, pattern, patternAsync, port, prefix, primeNumber, prop, propArray, propObject, range, rangeAsync, required, requiredTrue, rtrim, rule, sanitize, startsWith, startsWithAsync, stripLow, suffix, time, timeAsync, toBoolean, toDate, toDouble, toFloat, toInt, toString, trim, unique, upperCase, url, urlAsync, whitelist };
|
|
16869
16782
|
//# sourceMappingURL=messaia-cdk.mjs.map
|