How to use the @ng-dynamic-forms/core.DynamicInputModel function in @ng-dynamic-forms/core

To help you get started, we’ve selected a few @ng-dynamic-forms/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DSpace / dspace-angular / src / app / shared / form / builder / parsers / concat-field-parser.ts View on Github external
input1ModelConfig.placeholder = this.firstPlaceholder;
    }

    if (isNotEmpty(this.secondPlaceholder)) {
      input2ModelConfig.placeholder = this.secondPlaceholder;
    }

    // Split placeholder if is like 'placeholder1/placeholder2'
    const placeholder = this.configData.label.split('/');
    if (placeholder.length === 2) {
      input1ModelConfig.placeholder = placeholder[0];
      input2ModelConfig.placeholder = placeholder[1];
    }

    const model1 = new DynamicInputModel(input1ModelConfig, clsInput);
    const model2 = new DynamicInputModel(input2ModelConfig, clsInput);
    concatGroup.group.push(model1);
    concatGroup.group.push(model2);

    clsGroup = {
      element: {
        control: 'form-row',
      }
    };
    const concatModel = new DynamicConcatModel(concatGroup, clsGroup);
    concatModel.name = this.getFieldId();

    // Init values
    if (isNotEmpty(fieldValue)) {
      concatModel.value = fieldValue;
    }
github DSpace / dspace-angular / src / app / shared / form / builder / form-builder.service.spec.ts View on Github external
it('should insert a form control to an existing form group', () => {

    const formGroup = service.createFormGroup(testModel);
    const nestedFormGroup = formGroup.controls.testFormGroup as FormGroup;
    const nestedFormGroupModel = testModel[7] as DynamicFormGroupModel;
    const newModel1 = new DynamicInputModel({id: 'newInput1'});
    const newModel2 = new DynamicInputModel({id: 'newInput2'});

    service.insertFormGroupControl(4, formGroup, testModel, newModel1);
    service.insertFormGroupControl(0, nestedFormGroup, nestedFormGroupModel, newModel2);

    expect(formGroup.controls[newModel1.id]).toBeTruthy();
    expect(testModel[4] === newModel1).toBe(true);
    expect(service.getPath(testModel[4])).toEqual(['newInput1']);

    expect((formGroup.controls.testFormGroup as FormGroup).controls[newModel2.id]).toBeTruthy();
    expect(nestedFormGroupModel.get(0) === newModel2).toBe(true);
    expect(service.getPath(nestedFormGroupModel.get(0))).toEqual(['testFormGroup', 'newInput2']);
  });
github mesemus / django-angular-dynamic-forms / angular / packages / django-angular-dynamic-forms / src / impl / django-form-content.component.ts View on Github external
},
                    merge_layouts(field_config.layout, extra_layout)
                );
                if (sfc.autocomplete_list ||
                    sfc.autocomplete_url) {
                    this.autocompleters.push(
                        new AutoCompleter(this.httpClient, this.error_service,
                            sfc.autocomplete_list,
                            sfc.autocomplete_url,
                            model));
                }
                return model;
            }
            case SimpleFieldTypes.EMAIL: {
                const sfc = field_config as EmailFieldConfig;
                const model = new DynamicInputModel(
                    {
                        id: id,
                        placeholder: label,
                        required: field_config.required,
                        disabled: field_config.read_only,
                        inputType: 'email',
                        validators: {
                            external_validator: {
                                name: external_validator.name,
                                args: {id: id, errors: this._external_errors}
                            },
                            maxLength: sfc.max_length,
                            minLength: sfc.min_length
                        },
                        errorMessages: {
                            external_error: '{{external_error}}'
github mesemus / django-angular-dynamic-forms / demo / angular / src / django-angular-dynamic-forms / src / impl / django-form-content.component.ts View on Github external
},
                    field_config.layout
                );
                if (sfc.autocomplete_list ||
                    sfc.autocomplete_url) {
                    this.autocompleters.push(
                        new AutoCompleter(this.httpClient, this.error_service,
                            sfc.autocomplete_list,
                            sfc.autocomplete_url,
                            model));
                }
                return model;
            }
            case SimpleFieldTypes.EMAIL: {
                const sfc = field_config as EmailFieldConfig;
                const model = new DynamicInputModel(
                    {
                        id: id,
                        placeholder: label,
                        required: field_config.required,
                        disabled: field_config.read_only,
                        inputType: 'email',
                        validators: {
                            external_validator: {
                                name: external_validator.name,
                                args: {id: id, errors: this._external_errors}
                            },
                            maxLength: sfc.max_length,
                            minLength: sfc.min_length
                        },
                        errorMessages: {
                            external_error: '{{external_error}}'
github DSpace / dspace-angular / src / app / +admin / admin-registries / bitstream-formats / format-form / format-form.component.ts View on Github external
(fieldModel: DynamicFormControlModel) => {
        if (fieldModel.name === 'extensions') {
          if (hasValue(this.bitstreamFormat.extensions)) {
            const extenstions = this.bitstreamFormat.extensions;
            const formArray = (fieldModel as DynamicFormArrayModel);
            for (let i = 0; i < extenstions.length; i++) {
              formArray.insertGroup(i).group[0] = new DynamicInputModel({
                id: `extension-${i}`,
                value: extenstions[i]
              }, this.arrayInputElementLayout);
            }
          }
        } else {
          if (hasValue(this.bitstreamFormat[fieldModel.name])) {
            (fieldModel as DynamicInputModel).value = this.bitstreamFormat[fieldModel.name];
          }
        }
      });
  }
github udos86 / ng-dynamic-forms / packages / ui-kendo / src / autocomplete / dynamic-kendo-autocomplete.component.spec.ts View on Github external
describe("DynamicKendoAutoCompleteComponent test suite", () => {

    let testModel = new DynamicInputModel({id: "input", list: ["One", "Two", "Three"]}),
        formModel = [testModel],
        formGroup: FormGroup,
        fixture: ComponentFixture,
        component: DynamicKendoAutoCompleteComponent,
        debugElement: DebugElement,
        testElement: DebugElement;

    beforeEach(async(() => {

        TestBed.configureTestingModule({

            imports: [
                ReactiveFormsModule,
                NoopAnimationsModule,
                TextMaskModule,
                AutoCompleteModule,
github mesemus / django-angular-dynamic-forms / angular / packages / django-angular-dynamic-forms / src / impl / django-form-content.component.ts View on Github external
validators: {
                            external_validator: {
                                name: external_validator.name,
                                args: {id: id, errors: this._external_errors}
                            },
                            maxLength: (field_config as TextAreaFieldConfig).max_length,
                            minLength: (field_config as TextAreaFieldConfig).min_length
                        },
                        errorMessages: {
                            external_error: '{{external_error}}'
                        },
                    },
                    merge_layouts(field_config.layout, extra_layout)
                );
            case SimpleFieldTypes.DATE:
                return new DynamicInputModel(
                    {
                        id: id,
                        placeholder: label,
                        inputType: DYNAMIC_FORM_CONTROL_INPUT_TYPE_DATE,
                        required: field_config.required,
                        disabled: field_config.read_only,
                        validators: {
                            external_validator: {
                                name: external_validator.name,
                                args: {id: id, errors: this._external_errors}
                            }
                        },
                        errorMessages: {
                            external_error: '{{external_error}}'
                        },
                    },
github udos86 / ng-dynamic-forms / packages / ui-primeng / src / input / dynamic-primeng-input.component.spec.ts View on Github external
describe("DynamicPrimeNGInputComponent test suite", () => {

    let testModel = new DynamicInputModel({id: "input", maxLength: 51}),
        formModel = [testModel],
        formGroup: FormGroup,
        fixture: ComponentFixture,
        component: DynamicPrimeNGInputComponent,
        debugElement: DebugElement,
        testElement: DebugElement;

    beforeEach(async(() => {

        TestBed.configureTestingModule({

            imports: [
                ReactiveFormsModule,
                NoopAnimationsModule,
                TextMaskModule,
                InputTextModule,
github mesemus / django-angular-dynamic-forms / demo / angular / src / django-angular-dynamic-forms / src / impl / django-form-content.component.ts View on Github external
args: {id: id, errors: this._external_errors}
                            },
                            min: ifc.min_value,
                            max: ifc.max_value
                        },
                        errorMessages: {
                            external_error: '{{external_error}}',
                            min: `Value must be in range ${ifc.min_value} - ${ifc.max_value}`,
                            max: `Value must be in range ${ifc.min_value} - ${ifc.max_value}`
                        }
                    },
                    field_config.layout
                );
            case SimpleFieldTypes.FLOAT:
                const ffc = (field_config as FloatFieldConfig);
                return new DynamicInputModel(
                    {
                        id: id,
                        placeholder: label,
                        inputType: DYNAMIC_FORM_CONTROL_INPUT_TYPE_NUMBER,
                        required: field_config.required,
                        disabled: field_config.read_only,
                        min: ffc.min_value,
                        max: ffc.max_value,
                        step: 0.00000001,
                        validators: {
                            external_validator: {
                                name: external_validator.name,
                                args: {id: id, errors: this._external_errors}
                            },
                            min: ffc.min_value,
                            max: ffc.max_value
github udos86 / ng-dynamic-forms / src / app / ui-ngx-bootstrap / ngx-bootstrap-sample-form.component.ts View on Github external
this.formService.moveFormArrayGroup(2, -1, this.formArray, this.formArrayModel);

        this.formService.addFormGroupControl(
            this.formGroup,
            this.formModel,
            new DynamicFormGroupModel({
                id: "bsFormGroup3",
                group: [new DynamicInputModel({id: "newInput"})]
            })
        );

        this.formService.addFormGroupControl(
            this.formGroup.get("bsFormGroup3") as FormGroup,
            this.formModel[2] as DynamicFormGroupModel,
            new DynamicInputModel({id: "newInput"})
        );

        //this.formService.detectChanges();
    }