Added form field parser factory to remove switch in row-parser.ts

This commit is contained in:
Giuseppe Digilio
2018-07-04 16:01:53 +02:00
parent f627c9443e
commit 8dd11c9a3c
27 changed files with 230 additions and 220 deletions

View File

@@ -11,12 +11,13 @@ import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-fo
import { DynamicFormControlLayout } from '@ng-dynamic-forms/core';
import { setLayout } from './parser.utils';
import { AuthorityOptions } from '../../../../core/integration/models/authority-options.model';
import { ParserOptions } from './parser-options';
export abstract class FieldParser {
protected fieldId: string;
constructor(protected configData: FormFieldModel, protected initFormValues, protected readOnly: boolean) {
constructor(protected configData: FormFieldModel, protected initFormValues, protected parserOptions: ParserOptions) {
}
public abstract modelFactory(fieldValue?: FormFieldMetadataValueObject): any;
@@ -175,8 +176,8 @@ export abstract class FieldParser {
controlModel.id = (this.fieldId).replace(/\./g, '_');
// Set read only option
controlModel.readOnly = this.readOnly;
controlModel.disabled = this.readOnly;
controlModel.readOnly = this.parserOptions.readOnly;
controlModel.disabled = this.parserOptions.readOnly;
if (label) {
controlModel.label = (labelEmpty) ? ' ' : this.configData.label;