mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 13:03:04 +00:00
created DynamicLookupNameModel and added more tests
This commit is contained in:
@@ -1,22 +1,29 @@
|
||||
import { FormFieldModel } from '../models/form-field.model';
|
||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||
import { LookupFieldParser } from './lookup-field-parser';
|
||||
import { FieldParser } from './field-parser';
|
||||
import {
|
||||
DynamicLookupNameModel,
|
||||
DynamicLookupNameModelConfig
|
||||
} from '../ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model';
|
||||
|
||||
export class LookupNameFieldParser extends LookupFieldParser {
|
||||
export class LookupNameFieldParser extends FieldParser {
|
||||
|
||||
constructor(protected configData: FormFieldModel,
|
||||
protected initFormValues,
|
||||
protected readOnly: boolean,
|
||||
protected authorityUuid: string) {
|
||||
super(configData, initFormValues, readOnly, authorityUuid);
|
||||
super(configData, initFormValues, readOnly);
|
||||
}
|
||||
|
||||
public modelFactory(fieldValue: FormFieldMetadataValueObject | any): any {
|
||||
const lookupModel = super.modelFactory(fieldValue);
|
||||
lookupModel.separator = ',';
|
||||
lookupModel.placeholder = 'form.last-name';
|
||||
lookupModel.placeholder2 = 'form.first-name';
|
||||
return lookupModel;
|
||||
public modelFactory(fieldValue: any): any {
|
||||
if (this.configData.selectableMetadata[0].authority) {
|
||||
const lookupModelConfig: DynamicLookupNameModelConfig = this.initModel();
|
||||
|
||||
this.setAuthorityOptions(lookupModelConfig, this.authorityUuid);
|
||||
|
||||
this.setValues(lookupModelConfig, fieldValue, true);
|
||||
|
||||
return new DynamicLookupNameModel(lookupModelConfig);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user