Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 1x 137x 137x 137x 137x 137x 137x 137x 137x 137x 137x 137x 27x 3x 40x 7x 12x 3x 9x 10x 151x 13x 30x 13x | import { Inject, Injectable, Optional } from '@angular/core'; import { DynamicFormActionType } from '../dynamic-form-action/dynamic-form-action-type'; import { DynamicFormActionTypeConfig, DYNAMIC_FORM_ACTION_TYPE_CONFIG } from '../dynamic-form-action/dynamic-form-action-type-config'; import { DynamicFormElementType } from '../dynamic-form-element/dynamic-form-element-type'; import { DynamicFormElementTypeConfig, DYNAMIC_FORM_ELEMENT_TYPE_CONFIG } from '../dynamic-form-element/dynamic-form-element-type-config'; import { DynamicFormFieldType } from '../dynamic-form-field/dynamic-form-field-type'; import { DynamicFormFieldTypeConfig, DYNAMIC_FORM_FIELD_TYPE_CONFIG } from '../dynamic-form-field/dynamic-form-field-type-config'; import { DynamicFormFieldWrapperType } from '../dynamic-form-field/dynamic-form-field-wrapper-type'; import { DynamicFormFieldWrapperTypeConfig, DYNAMIC_FORM_FIELD_WRAPPER_TYPE_CONFIG, } from '../dynamic-form-field/dynamic-form-field-wrapper-type-config'; import { DynamicFormInputType } from '../dynamic-form-input/dynamic-form-input-type'; import { DynamicFormInputTypeConfig, DYNAMIC_FORM_INPUT_TYPE_CONFIG } from '../dynamic-form-input/dynamic-form-input-type-config'; import { DynamicFormLibraryService } from '../dynamic-form-library/dynamic-form-library.service'; import { DynamicFormClassType } from './dynamic-form-class-type'; @Injectable() export class DynamicFormConfigService { readonly elementTypes: DynamicFormElementType[]; readonly fieldTypes: DynamicFormFieldType[]; readonly actionTypes: DynamicFormActionType[]; readonly inputTypes: DynamicFormInputType[]; readonly fieldWrapperTypes: DynamicFormFieldWrapperType[]; constructor( private readonly libraryService: DynamicFormLibraryService, @Optional() @Inject(DYNAMIC_FORM_ELEMENT_TYPE_CONFIG) private elementTypeConfig: DynamicFormElementTypeConfig, @Optional() @Inject(DYNAMIC_FORM_FIELD_TYPE_CONFIG) private fieldTypeConfig: DynamicFormFieldTypeConfig, @Optional() @Inject(DYNAMIC_FORM_ACTION_TYPE_CONFIG) private actionTypeConfig: DynamicFormActionTypeConfig, @Optional() @Inject(DYNAMIC_FORM_INPUT_TYPE_CONFIG) private inputTypeConfig: DynamicFormInputTypeConfig, @Optional() @Inject(DYNAMIC_FORM_FIELD_WRAPPER_TYPE_CONFIG) private fieldWrapperTypeConfig: DynamicFormFieldWrapperTypeConfig, ) { this.elementTypes = this.libraryService.filterTypes(this.elementTypeConfig); this.fieldTypes = this.libraryService.filterTypes(this.fieldTypeConfig); this.actionTypes = this.libraryService.filterTypes(this.actionTypeConfig); this.inputTypes = this.libraryService.filterTypes(this.inputTypeConfig); this.fieldWrapperTypes = this.libraryService.filterTypes(this.fieldWrapperTypeConfig); } getClassType(type: string): DynamicFormClassType | undefined { if (this.elementTypes.some(f => f.type === type)) { return 'element'; } else if (this.fieldTypes.some(f => f.type === type)) { return 'field'; } else if (this.actionTypes.some(f => f.type === type)) { return 'action'; } else { return undefined; } } getElementType(type: string): DynamicFormElementType | undefined { return this.elementTypes.find(f => f.type === type); } getFieldType(type: string): DynamicFormFieldType | undefined { return this.fieldTypes.find(f => f.type === type); } getActionType(type: string): DynamicFormActionType | undefined { return this.actionTypes.find(f => f.type === type); } getInputType(type: string): DynamicFormInputType | undefined { return this.inputTypes.find(f => f.type === type); } getFieldWrapperType(type: string | undefined): DynamicFormFieldWrapperType | undefined { return this.fieldWrapperTypes.find(f => f.type === type); } } |