@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/fesm2015/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';
|
|
@@ -3134,48 +3134,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
3134
3134
|
args: [MatExpansionPanel]
|
|
3135
3135
|
}] } });
|
|
3136
3136
|
|
|
3137
|
-
const
|
|
3138
|
-
|
|
3139
|
-
class FormFieldGroup {
|
|
3140
|
-
/**
|
|
3141
|
-
* constructor
|
|
3142
|
-
* @param init
|
|
3143
|
-
*/
|
|
3144
|
-
constructor(init) {
|
|
3145
|
-
this.name = 'details';
|
|
3146
|
-
this.fields = [];
|
|
3147
|
-
Object.assign(this, init);
|
|
3148
|
-
}
|
|
3149
|
-
}
|
|
3137
|
+
const formFieldsMetadataKey = Symbol('vdFormFields');
|
|
3138
|
+
const formFieldGroupsMetadataKey = Symbol('vdFormFieldGroup');
|
|
3150
3139
|
|
|
3151
|
-
/**
|
|
3152
|
-
* Gets poperties decoarated with @FormField grouped by row
|
|
3153
|
-
* @param origin
|
|
3154
|
-
* @returns
|
|
3155
|
-
* @deprecated
|
|
3156
|
-
*/
|
|
3157
|
-
function getFormGroupsOld(origin) {
|
|
3158
|
-
return Reflect.getMetadata(formFieldGroupMetadataKey, origin);
|
|
3159
|
-
}
|
|
3160
3140
|
/**
|
|
3161
3141
|
* Gets poperties decoarated with @FormField grouped by row
|
|
3162
3142
|
* @param origin
|
|
3163
3143
|
* @returns
|
|
3164
3144
|
*/
|
|
3165
3145
|
function getFormGroups(origin) {
|
|
3166
|
-
|
|
3167
|
-
return Array.from(grouped).map(([_, value]) => new FormFieldGroup({
|
|
3168
|
-
name: value[0].groupName || null,
|
|
3169
|
-
header: value[0].groupHeader,
|
|
3170
|
-
fields: value,
|
|
3171
|
-
groups: Object.values((value).reduce(function (r, a) {
|
|
3172
|
-
r[a.row] = (r[a.row] || []);
|
|
3173
|
-
r[a.row].push(a);
|
|
3174
|
-
r[a.row].forEach((x, i) => x.index = x.index || i);
|
|
3175
|
-
Utils.sortArray(r[a.row], 'index');
|
|
3176
|
-
return r;
|
|
3177
|
-
}, Object.create(null)))
|
|
3178
|
-
}));
|
|
3146
|
+
return Reflect.getMetadata(formFieldGroupsMetadataKey, origin);
|
|
3179
3147
|
}
|
|
3180
3148
|
|
|
3181
3149
|
// @dynamic
|
|
@@ -3478,12 +3446,14 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
3478
3446
|
validateForm(form = null) {
|
|
3479
3447
|
var form = form || this.form;
|
|
3480
3448
|
/* Set the form as submitted */
|
|
3481
|
-
if (form && form instanceof FormGroup
|
|
3449
|
+
if (form && form instanceof FormGroup) {
|
|
3482
3450
|
/* Set form as submitted */
|
|
3483
3451
|
form['submitted'] = true;
|
|
3484
3452
|
/* Update value and validity */
|
|
3485
3453
|
form.updateValueAndValidity();
|
|
3486
3454
|
}
|
|
3455
|
+
/* Print some debug information */
|
|
3456
|
+
this.debugForm(form);
|
|
3487
3457
|
}
|
|
3488
3458
|
/**
|
|
3489
3459
|
* Validates the form
|
|
@@ -3491,9 +3461,7 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
3491
3461
|
*/
|
|
3492
3462
|
isFormValid(form = null) {
|
|
3493
3463
|
/* Print some debug information */
|
|
3494
|
-
|
|
3495
|
-
this.debugForm(form);
|
|
3496
|
-
}
|
|
3464
|
+
this.debugForm(form);
|
|
3497
3465
|
/* If the form ist not valid.. */
|
|
3498
3466
|
if (!form.valid) {
|
|
3499
3467
|
/* Mark invalid controls as dirtty and touched */
|
|
@@ -3568,15 +3536,17 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
3568
3536
|
* @param form
|
|
3569
3537
|
*/
|
|
3570
3538
|
debugForm(form = null) {
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3539
|
+
if (this.debug) {
|
|
3540
|
+
console.log('Form:', form);
|
|
3541
|
+
Object.keys(form.controls).forEach(key => {
|
|
3542
|
+
const controlErrors = form.controls[key].errors;
|
|
3543
|
+
if (controlErrors != null) {
|
|
3544
|
+
Object.keys(controlErrors).forEach(keyError => {
|
|
3545
|
+
console.log('Key control: ' + key + ', keyError: ' + keyError + ', err value: ', controlErrors[keyError]);
|
|
3546
|
+
});
|
|
3547
|
+
}
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3580
3550
|
}
|
|
3581
3551
|
/**
|
|
3582
3552
|
* Add toolbar menu items
|
|
@@ -7012,10 +6982,10 @@ function isResetControl(controlName, control, options) {
|
|
|
7012
6982
|
isReset = control instanceof FormControl;
|
|
7013
6983
|
break;
|
|
7014
6984
|
case ResetFormType.ControlsAndFormGroupsOnly:
|
|
7015
|
-
isReset = control instanceof FormControl || control instanceof FormGroup
|
|
6985
|
+
isReset = control instanceof FormControl || control instanceof FormGroup;
|
|
7016
6986
|
break;
|
|
7017
6987
|
case ResetFormType.FormGroupsOnly:
|
|
7018
|
-
isReset = control instanceof FormGroup
|
|
6988
|
+
isReset = control instanceof FormGroup;
|
|
7019
6989
|
break;
|
|
7020
6990
|
case ResetFormType.FormArraysOnly:
|
|
7021
6991
|
isReset = control instanceof FormArray;
|
|
@@ -7056,7 +7026,7 @@ function getNestedOptions(controlName, options) {
|
|
|
7056
7026
|
return undefined;
|
|
7057
7027
|
}
|
|
7058
7028
|
|
|
7059
|
-
class RxFormGroup extends FormGroup
|
|
7029
|
+
class RxFormGroup extends FormGroup {
|
|
7060
7030
|
constructor(model, entityObject, controls, validatorOrOpts, asyncValidator) {
|
|
7061
7031
|
super(controls, validatorOrOpts, asyncValidator);
|
|
7062
7032
|
this.model = model;
|
|
@@ -7123,7 +7093,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7123
7093
|
let isDirty = false;
|
|
7124
7094
|
for (let name in this.value) {
|
|
7125
7095
|
let currentValue = this.modelInstance[name];
|
|
7126
|
-
if (!(this.controls[name] instanceof FormGroup
|
|
7096
|
+
if (!(this.controls[name] instanceof FormGroup || this.controls[name] instanceof FormArray)) {
|
|
7127
7097
|
isDirty = ApplicationUtil.notEqualTo(this.baseObject[name], currentValue);
|
|
7128
7098
|
}
|
|
7129
7099
|
else if (this.controls[name] instanceof RxFormGroup)
|
|
@@ -7142,7 +7112,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7142
7112
|
resetForm(options) {
|
|
7143
7113
|
for (let name in this.controls) {
|
|
7144
7114
|
if (isResetControl(name, this.controls[name], options)) {
|
|
7145
|
-
if (this.controls[name] instanceof FormGroup
|
|
7115
|
+
if (this.controls[name] instanceof FormGroup)
|
|
7146
7116
|
this.controls[name].resetForm(getNestedOptions(name, options));
|
|
7147
7117
|
else if (this.controls[name] instanceof FormArray) {
|
|
7148
7118
|
this.controls[name].resetForm(options && options.value ? options.value[name] : undefined);
|
|
@@ -7158,7 +7128,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7158
7128
|
}
|
|
7159
7129
|
commit() {
|
|
7160
7130
|
for (let name in this.controls) {
|
|
7161
|
-
if (this.controls[name] instanceof FormGroup
|
|
7131
|
+
if (this.controls[name] instanceof FormGroup)
|
|
7162
7132
|
this.controls[name].commit();
|
|
7163
7133
|
else if (this.controls[name] instanceof FormArray) {
|
|
7164
7134
|
this.controls[name].commit();
|
|
@@ -7189,7 +7159,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7189
7159
|
getErrorSummary(onlyMessage) {
|
|
7190
7160
|
let jObject = {};
|
|
7191
7161
|
Object.keys(this.controls).forEach(columnName => {
|
|
7192
|
-
if (this.controls[columnName] instanceof FormGroup
|
|
7162
|
+
if (this.controls[columnName] instanceof FormGroup) {
|
|
7193
7163
|
let error = this.controls[columnName].getErrorSummary(false);
|
|
7194
7164
|
if (Object.keys(error).length > 0)
|
|
7195
7165
|
jObject[columnName] = error;
|
|
@@ -7222,7 +7192,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7222
7192
|
}
|
|
7223
7193
|
valueChangedSync() {
|
|
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) && !(this.entityObject[columnName] instanceof FormControl || this.entityObject[columnName] instanceof RxFormControl) && this.controls[columnName].getControlValue && ApplicationUtil.notEqualTo(this.controls[columnName].getControlValue(), this.entityObject[columnName])) {
|
|
7226
7196
|
this.controls[columnName].setValue(this.entityObject[columnName], { updateChanged: true });
|
|
7227
7197
|
}
|
|
7228
7198
|
else if ((this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray)) {
|
|
@@ -7237,7 +7207,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7237
7207
|
}
|
|
7238
7208
|
refreshDisable() {
|
|
7239
7209
|
Object.keys(this.controls).forEach(columnName => {
|
|
7240
|
-
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup
|
|
7210
|
+
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup || this.controls[columnName] instanceof RxFormGroup)) {
|
|
7241
7211
|
this.controls[columnName].refresh();
|
|
7242
7212
|
}
|
|
7243
7213
|
else if ((this.controls[columnName] instanceof RxFormGroup)) {
|
|
@@ -7247,7 +7217,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7247
7217
|
}
|
|
7248
7218
|
bindErrorMessages() {
|
|
7249
7219
|
Object.keys(this.controls).forEach(columnName => {
|
|
7250
|
-
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup
|
|
7220
|
+
if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup || this.controls[columnName] instanceof RxFormGroup)) {
|
|
7251
7221
|
this.controls[columnName].bindError();
|
|
7252
7222
|
}
|
|
7253
7223
|
else if ((this.controls[columnName] instanceof RxFormGroup)) {
|
|
@@ -7266,7 +7236,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7266
7236
|
for (let formGroup of formArray.controls)
|
|
7267
7237
|
formGroup.submitted = value;
|
|
7268
7238
|
}
|
|
7269
|
-
else if (this.controls[columnName] instanceof FormGroup
|
|
7239
|
+
else if (this.controls[columnName] instanceof FormGroup) {
|
|
7270
7240
|
this.controls[columnName].submitted = value;
|
|
7271
7241
|
}
|
|
7272
7242
|
else
|
|
@@ -7303,7 +7273,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7303
7273
|
setBackEndErrors(errors) {
|
|
7304
7274
|
Object.keys(errors).forEach(controlName => {
|
|
7305
7275
|
if (this.controls[controlName]) {
|
|
7306
|
-
if (this.controls[controlName] instanceof FormGroup
|
|
7276
|
+
if (this.controls[controlName] instanceof FormGroup)
|
|
7307
7277
|
this.controls[controlName].setBackEndErrors(errors[controlName]);
|
|
7308
7278
|
else
|
|
7309
7279
|
this.controls[controlName].setBackEndErrors(errors[controlName]);
|
|
@@ -7314,7 +7284,7 @@ class RxFormGroup extends FormGroup$1 {
|
|
|
7314
7284
|
let clearErrors = errors ? Object.keys(errors) : Object.keys(this.controls);
|
|
7315
7285
|
clearErrors.forEach(controlName => {
|
|
7316
7286
|
if (this.controls[controlName]) {
|
|
7317
|
-
if (this.controls[controlName] instanceof FormGroup
|
|
7287
|
+
if (this.controls[controlName] instanceof FormGroup)
|
|
7318
7288
|
errors ? this.controls[controlName].clearBackEndErrors(errors[controlName]) : this.controls[controlName].clearBackEndErrors();
|
|
7319
7289
|
else
|
|
7320
7290
|
errors ? this.controls[controlName].clearBackEndErrors(errors[controlName]) : this.controls[controlName].clearBackEndErrors();
|
|
@@ -9504,7 +9474,7 @@ class RxwebFormDirective extends BaseDirective {
|
|
|
9504
9474
|
}
|
|
9505
9475
|
updateValueAndValidity(controls) {
|
|
9506
9476
|
Object.keys(controls).forEach(key => {
|
|
9507
|
-
if (controls[key] instanceof FormGroup
|
|
9477
|
+
if (controls[key] instanceof FormGroup)
|
|
9508
9478
|
this.updateValueAndValidity(controls[key].controls);
|
|
9509
9479
|
else if (controls[key] instanceof FormArray)
|
|
9510
9480
|
this.updateValueAndValidity(controls[key].controls);
|
|
@@ -9541,7 +9511,7 @@ class RxwebFormDirective extends BaseDirective {
|
|
|
9541
9511
|
}
|
|
9542
9512
|
});
|
|
9543
9513
|
}
|
|
9544
|
-
else if (formControl instanceof FormGroup
|
|
9514
|
+
else if (formControl instanceof FormGroup) {
|
|
9545
9515
|
this.expressionProcessor(formControl.controls, `${fieldName}.`);
|
|
9546
9516
|
}
|
|
9547
9517
|
else if (formControl instanceof FormArray) {
|
|
@@ -9558,7 +9528,7 @@ class RxwebFormDirective extends BaseDirective {
|
|
|
9558
9528
|
if (this.validationRule.conditionalValidationProps && this.validationRule.conditionalValidationProps[fieldName]) {
|
|
9559
9529
|
controls[fieldName][CONDITIONAL_VALIDATOR] = conditionalChangeValidator(this.validationRule.conditionalValidationProps[fieldName]);
|
|
9560
9530
|
}
|
|
9561
|
-
else if (controls[fieldName] instanceof FormGroup
|
|
9531
|
+
else if (controls[fieldName] instanceof FormGroup && this.validationRule.conditionalObjectProps) {
|
|
9562
9532
|
var fields = this.validationRule.conditionalObjectProps.filter(t => t.objectPropName == fieldName);
|
|
9563
9533
|
let nestedFormGroup = controls[fieldName];
|
|
9564
9534
|
let propWiseConditionalControls = {};
|
|
@@ -11025,10 +10995,10 @@ class RxFormBuilder extends BaseFormBuilder {
|
|
|
11025
10995
|
}
|
|
11026
10996
|
else if (typeof prop == OBJECT_STRING && !(prop instanceof FormControl || prop instanceof RxFormControl)) {
|
|
11027
10997
|
let formGroup = (prop instanceof FormArray) ? prop.controls[0] : prop;
|
|
11028
|
-
if (!formGroup.model && (prop instanceof FormGroup
|
|
10998
|
+
if (!formGroup.model && (prop instanceof FormGroup || prop instanceof RxFormGroup)) {
|
|
11029
10999
|
formGroup = this.group(formGroup.controls);
|
|
11030
11000
|
}
|
|
11031
|
-
if (prop instanceof FormGroup
|
|
11001
|
+
if (prop instanceof FormGroup || prop instanceof RxFormGroup) {
|
|
11032
11002
|
entityObject[propName] = prop;
|
|
11033
11003
|
defaultContainer.initPropertyObject(propName, OBJECT_PROPERTY, formGroup.model, modelInstance);
|
|
11034
11004
|
}
|
|
@@ -11169,7 +11139,7 @@ class RxFormBuilder extends BaseFormBuilder {
|
|
|
11169
11139
|
break;
|
|
11170
11140
|
case OBJECT_PROPERTY:
|
|
11171
11141
|
let objectValue = entityObject[property.name];
|
|
11172
|
-
if (objectValue && objectValue instanceof Object && !(objectValue instanceof FormGroup
|
|
11142
|
+
if (objectValue && objectValue instanceof Object && !(objectValue instanceof FormGroup || objectValue instanceof RxFormGroup)) {
|
|
11173
11143
|
this.isNestedBinding = this.isNested = true;
|
|
11174
11144
|
if (instanceContainer && instanceContainer.conditionalObjectProps)
|
|
11175
11145
|
this.conditionalObjectProps = instanceContainer.conditionalObjectProps.filter(t => t.objectPropName == property.name);
|
|
@@ -11184,7 +11154,7 @@ class RxFormBuilder extends BaseFormBuilder {
|
|
|
11184
11154
|
this.builderConfigurationConditionalObjectProps = [];
|
|
11185
11155
|
this.isNestedBinding = this.isNested = false;
|
|
11186
11156
|
}
|
|
11187
|
-
else if (objectValue instanceof FormGroup
|
|
11157
|
+
else if (objectValue instanceof FormGroup || objectValue instanceof RxFormGroup)
|
|
11188
11158
|
formGroupObject[property.name] = objectValue;
|
|
11189
11159
|
break;
|
|
11190
11160
|
case ARRAY_PROPERTY:
|
|
@@ -14124,10 +14094,10 @@ class VdGenericFormComponent {
|
|
|
14124
14094
|
}
|
|
14125
14095
|
}
|
|
14126
14096
|
/** @nocollapse */ /** @nocollapse */ VdGenericFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: VdGenericFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14127
|
-
/** @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]" }] });
|
|
14097
|
+
/** @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]" }] });
|
|
14128
14098
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: VdGenericFormComponent, decorators: [{
|
|
14129
14099
|
type: Component,
|
|
14130
|
-
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: [""] }]
|
|
14100
|
+
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: [""] }]
|
|
14131
14101
|
}], propDecorators: { formGroup: [{
|
|
14132
14102
|
type: Input
|
|
14133
14103
|
}], fieldGroups: [{
|
|
@@ -14537,88 +14507,18 @@ class FormFieldDefinition {
|
|
|
14537
14507
|
}
|
|
14538
14508
|
}
|
|
14539
14509
|
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
/* Create table column */
|
|
14553
|
-
var formField = new FormFieldDefinition(Object.assign(args, {
|
|
14554
|
-
name: args.name || propertyKey,
|
|
14555
|
-
header: args.header || Reflect.getMetadata(headerMetadataKey, target, propertyKey) || propertyName,
|
|
14556
|
-
autocompleteTemplate: args.autocompleteTemplate || ((option) => option[formField.autocompleteText]),
|
|
14557
|
-
chipTemplate: args.chipTemplate || ((chip) => chip[formField.chipText])
|
|
14558
|
-
}));
|
|
14559
|
-
/* Type enum */
|
|
14560
|
-
if (formField.enumType) {
|
|
14561
|
-
formField.type || (formField.type = FormFieldType.Enum);
|
|
14562
|
-
}
|
|
14563
|
-
/* Type VdSelect */
|
|
14564
|
-
else if (formField.endpoint) {
|
|
14565
|
-
formField.type || (formField.type = FormFieldType.VdSelect);
|
|
14566
|
-
}
|
|
14567
|
-
/* Type Select */
|
|
14568
|
-
else if (formField.options) {
|
|
14569
|
-
formField.type || (formField.type = FormFieldType.Select);
|
|
14570
|
-
}
|
|
14571
|
-
/* Type TextArea */
|
|
14572
|
-
else if (formField.rows) {
|
|
14573
|
-
formField.type || (formField.type = FormFieldType.TextArea);
|
|
14574
|
-
}
|
|
14575
|
-
/* Type File */
|
|
14576
|
-
else if (formField.filePath) {
|
|
14577
|
-
formField.type || (formField.type = FormFieldType.File);
|
|
14578
|
-
}
|
|
14579
|
-
/* Other types */
|
|
14580
|
-
else {
|
|
14581
|
-
switch (propertyType.toLowerCase()) {
|
|
14582
|
-
case 'number':
|
|
14583
|
-
formField.type || (formField.type = FormFieldType.Text);
|
|
14584
|
-
formField.inputType || (formField.inputType = 'number');
|
|
14585
|
-
break;
|
|
14586
|
-
case 'date':
|
|
14587
|
-
formField.type || (formField.type = FormFieldType.Date);
|
|
14588
|
-
break;
|
|
14589
|
-
case 'boolean':
|
|
14590
|
-
formField.type || (formField.type = FormFieldType.Checkbox);
|
|
14591
|
-
break;
|
|
14592
|
-
default:
|
|
14593
|
-
formField.type || (formField.type = FormFieldType.Text);
|
|
14594
|
-
break;
|
|
14595
|
-
}
|
|
14596
|
-
}
|
|
14597
|
-
/* Get existing table groups */
|
|
14598
|
-
let formFieldGroups = Reflect.getMetadata(formFieldGroupMetadataKey, target) || [];
|
|
14599
|
-
/* Get the group */
|
|
14600
|
-
var group = formFieldGroups.filter(x => { var _a, _b; return ((_a = x.name) === null || _a === void 0 ? void 0 : _a.trim()) == ((_b = formField.groupName) === null || _b === void 0 ? void 0 : _b.trim()); })[0];
|
|
14601
|
-
/* The group already exists, add the new form field */
|
|
14602
|
-
if (group) {
|
|
14603
|
-
group.fields.push(formField);
|
|
14604
|
-
}
|
|
14605
|
-
/* Create a new group */
|
|
14606
|
-
else {
|
|
14607
|
-
group = new FormFieldGroup({ name: formField.groupName || null, header: formField.groupHeader, fields: [formField] });
|
|
14608
|
-
formFieldGroups.push(group);
|
|
14609
|
-
}
|
|
14610
|
-
/* Sort the fields by row */
|
|
14611
|
-
group.fields = ((_b = group.fields) === null || _b === void 0 ? void 0 : _b.sort((a, b) => (a.row || 0 > b.row || 0) ? 1 : ((b.row || 0 > a.row || 0) ? -1 : 0))) || [];
|
|
14612
|
-
/* Group the fields */
|
|
14613
|
-
group.groups = Object.values((group.fields).reduce(function (r, a) {
|
|
14614
|
-
r[a.row] = r[a.row] || [];
|
|
14615
|
-
r[a.row].push(a);
|
|
14616
|
-
return r;
|
|
14617
|
-
}, Object.create(null)));
|
|
14618
|
-
/* Add new table column */
|
|
14619
|
-
Reflect.defineMetadata(formFieldGroupMetadataKey, formFieldGroups, target);
|
|
14620
|
-
};
|
|
14621
|
-
}
|
|
14510
|
+
class FormFieldGroupDefinition {
|
|
14511
|
+
/**
|
|
14512
|
+
* constructor
|
|
14513
|
+
* @param init
|
|
14514
|
+
*/
|
|
14515
|
+
constructor(init) {
|
|
14516
|
+
this.name = 'details';
|
|
14517
|
+
this.fields = [];
|
|
14518
|
+
Object.assign(this, init);
|
|
14519
|
+
}
|
|
14520
|
+
}
|
|
14521
|
+
|
|
14622
14522
|
/**
|
|
14623
14523
|
* Property decorator to create form fields
|
|
14624
14524
|
* @param args
|
|
@@ -14677,51 +14577,62 @@ function FormField(args) {
|
|
|
14677
14577
|
}
|
|
14678
14578
|
}
|
|
14679
14579
|
/* Get old form fields */
|
|
14680
|
-
const previousFormFields = Reflect.getMetadata(
|
|
14580
|
+
const previousFormFields = Reflect.getMetadata(formFieldsMetadataKey, target);
|
|
14681
14581
|
/* Create a copy of the result */
|
|
14682
14582
|
let formFields = previousFormFields ? previousFormFields.concat([formField]) : [formField];
|
|
14683
14583
|
/* Override the result in the metadata */
|
|
14684
|
-
Reflect.defineMetadata(
|
|
14584
|
+
Reflect.defineMetadata(formFieldsMetadataKey, formFields, target);
|
|
14585
|
+
/* Group the fields */
|
|
14586
|
+
var groups = Array.from(Utils.groupArrayBy(formFields, x => x.groupName))
|
|
14587
|
+
.map(([_, value]) => new FormFieldGroupDefinition({
|
|
14588
|
+
name: value[0].groupName || null,
|
|
14589
|
+
header: value[0].groupHeader,
|
|
14590
|
+
fields: value,
|
|
14591
|
+
groups: Object.values((value).reduce(function (r, a) {
|
|
14592
|
+
r[a.row] = (r[a.row] || []);
|
|
14593
|
+
r[a.row].push(a);
|
|
14594
|
+
r[a.row].forEach((x, i) => x.index = x.index || i);
|
|
14595
|
+
Utils.sortArray(r[a.row], 'index');
|
|
14596
|
+
return r;
|
|
14597
|
+
}, Object.create(null)))
|
|
14598
|
+
}));
|
|
14599
|
+
/* Override the result in the metadata */
|
|
14600
|
+
Reflect.defineMetadata(formFieldGroupsMetadataKey, groups, target);
|
|
14685
14601
|
};
|
|
14686
14602
|
}
|
|
14687
14603
|
/**
|
|
14688
14604
|
* Property decorator to create form fields
|
|
14689
|
-
* @param
|
|
14605
|
+
* @param type
|
|
14606
|
+
* @param header
|
|
14607
|
+
* @param init
|
|
14690
14608
|
* @returns
|
|
14691
14609
|
*/
|
|
14692
|
-
function
|
|
14610
|
+
function FormFieldGroup(type, header, init) {
|
|
14693
14611
|
return function (target, propertyKey) {
|
|
14694
|
-
|
|
14695
|
-
|
|
14696
|
-
name || (name = propertyKey);
|
|
14612
|
+
/* Create an instance of the group object */
|
|
14613
|
+
var instance = Reflect.construct(type, []);
|
|
14697
14614
|
/* Get from groups */
|
|
14698
|
-
var groups = getFormGroups(
|
|
14699
|
-
/* Get
|
|
14700
|
-
|
|
14701
|
-
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14705
|
-
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14709
|
-
|
|
14710
|
-
|
|
14711
|
-
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
/*
|
|
14716
|
-
|
|
14717
|
-
/*
|
|
14718
|
-
|
|
14719
|
-
r[a.row] = r[a.row] || [];
|
|
14720
|
-
r[a.row].push(a);
|
|
14721
|
-
return r;
|
|
14722
|
-
}, Object.create(null)));
|
|
14723
|
-
/* Add new table column */
|
|
14724
|
-
Reflect.defineMetadata(formFieldGroupMetadataKey, formFieldGroups, target);
|
|
14615
|
+
var groups = getFormGroups(instance);
|
|
14616
|
+
/* Get the fields from the groups */
|
|
14617
|
+
groups === null || groups === void 0 ? void 0 : groups.forEach(x => {
|
|
14618
|
+
Object.assign(x, {
|
|
14619
|
+
name: propertyKey,
|
|
14620
|
+
header: header,
|
|
14621
|
+
type: type,
|
|
14622
|
+
instance: init || instance
|
|
14623
|
+
});
|
|
14624
|
+
/* Set the name of the group in the fields */
|
|
14625
|
+
x.fields.forEach(y => Object.assign(y, {
|
|
14626
|
+
groupName: propertyKey,
|
|
14627
|
+
groupHeader: header
|
|
14628
|
+
}));
|
|
14629
|
+
});
|
|
14630
|
+
/* Get old form field groups */
|
|
14631
|
+
const previousGroups = Reflect.getMetadata(formFieldGroupsMetadataKey, target);
|
|
14632
|
+
/* Create a copy of the result */
|
|
14633
|
+
let combinedGroups = previousGroups ? previousGroups.concat(groups) : groups;
|
|
14634
|
+
/* Override the result in the metadata */
|
|
14635
|
+
Reflect.defineMetadata(formFieldGroupsMetadataKey, combinedGroups, target);
|
|
14725
14636
|
};
|
|
14726
14637
|
}
|
|
14727
14638
|
|
|
@@ -16954,5 +16865,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
16954
16865
|
* Generated bundle index. Do not edit.
|
|
16955
16866
|
*/
|
|
16956
16867
|
|
|
16957
|
-
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,
|
|
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, 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 };
|
|
16958
16869
|
//# sourceMappingURL=messaia-cdk.mjs.map
|