mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 21:13:07 +00:00
Added form field parser factory to remove switch in row-parser.ts
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import { DynamicSelectModel, DynamicSelectModelConfig } from '@ng-dynamic-forms/core';
|
||||
|
||||
import { FieldParser } from './field-parser';
|
||||
import { FormFieldModel } from '../models/form-field.model';
|
||||
import {
|
||||
DsDynamicQualdropModelConfig,
|
||||
DynamicQualdropModel,
|
||||
QUALDROP_GROUP_SUFFIX,
|
||||
QUALDROP_METADATA_SUFFIX,
|
||||
QUALDROP_VALUE_SUFFIX,
|
||||
DsDynamicQualdropModelConfig,
|
||||
DynamicQualdropModel
|
||||
QUALDROP_VALUE_SUFFIX
|
||||
} from '../ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model';
|
||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||
import { isNotEmpty } from '../../../empty.util';
|
||||
@@ -19,13 +18,6 @@ import {
|
||||
|
||||
export class OneboxFieldParser extends FieldParser {
|
||||
|
||||
constructor(protected configData: FormFieldModel,
|
||||
protected initFormValues,
|
||||
protected readOnly: boolean,
|
||||
protected authorityUuid: string) {
|
||||
super(configData, initFormValues, readOnly);
|
||||
}
|
||||
|
||||
public modelFactory(fieldValue: FormFieldMetadataValueObject): any {
|
||||
if (this.configData.selectableMetadata.length > 1) {
|
||||
// Case ComboBox
|
||||
@@ -79,7 +71,7 @@ export class OneboxFieldParser extends FieldParser {
|
||||
return new DynamicQualdropModel(inputSelectGroup, clsGroup);
|
||||
} else if (this.configData.selectableMetadata[0].authority) {
|
||||
const typeaheadModelConfig: DsDynamicTypeaheadModelConfig = this.initModel();
|
||||
this.setAuthorityOptions(typeaheadModelConfig, this.authorityUuid);
|
||||
this.setAuthorityOptions(typeaheadModelConfig, this.parserOptions.authorityUuid);
|
||||
this.setValues(typeaheadModelConfig, fieldValue, true);
|
||||
const typeaheadModel = new DynamicTypeaheadModel(typeaheadModelConfig);
|
||||
return typeaheadModel;
|
||||
|
Reference in New Issue
Block a user