Skip to content

Commit e47c540

Browse files
Simone-Ramundiatarix83
authored andcommitted
Merged in task/dspace-cris-2023_02_x/DSC-2038 (pull request DSpace#2800)
[DSC-2038] Approved-by: Giuseppe Digilio
2 parents 322077e + 1707756 commit e47c540

5 files changed

Lines changed: 11 additions & 1 deletion

File tree

config/config.example.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ submission:
187187
metadataDetailsList:
188188
- label: 'Document type'
189189
name: dc.type
190+
# Minimum number of characters required before performing a lookup.
191+
minChars: 3
190192

191193
# Default Language in which the UI will be rendered if the user's browser language is not an active language
192194
defaultLanguage: en

src/app/shared/form/builder/parsers/onebox-field-parser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DynamicSelectModel, DynamicSelectModelConfig } from '@ng-dynamic-forms/core';
2+
import { environment } from '../../../../../environments/environment';
23

34
import { FieldParser } from './field-parser';
45
import {
@@ -82,6 +83,7 @@ export class OneboxFieldParser extends FieldParser {
8283
const oneboxModelConfig: DsDynamicOneboxModelConfig = this.initModel(null, label);
8384
this.setVocabularyOptions(oneboxModelConfig, this.parserOptions.collectionUUID);
8485
oneboxModelConfig.submissionScope = this.parserOptions.submissionScope;
86+
oneboxModelConfig.minChars = environment.submission.minChars;
8587
this.setValues(oneboxModelConfig, fieldValue, true);
8688

8789
return new DynamicOneboxModel(oneboxModelConfig);

src/app/shared/form/builder/parsers/tag-field-parser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { FieldParser } from './field-parser';
22
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
33
import { DynamicTagModel, DynamicTagModelConfig } from '../ds-dynamic-form-ui/models/tag/dynamic-tag.model';
44
import {DynamicFormControlLayout} from '@ng-dynamic-forms/core';
5+
import { environment } from '../../../../../environments/environment';
6+
57
export class TagFieldParser extends FieldParser {
68
public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any {
79
let clsTag: DynamicFormControlLayout;
@@ -15,6 +17,7 @@ export class TagFieldParser extends FieldParser {
1517
&& this.configData.selectableMetadata[0].controlledVocabulary.length > 0) {
1618
this.setVocabularyOptions(tagModelConfig, this.parserOptions.collectionUUID);
1719
}
20+
tagModelConfig.minChars = environment.submission.minChars;
1821
this.setValues(tagModelConfig, fieldValue, null, true);
1922
tagModelConfig.placeholder = 'Enter the Keywords';
2023
const tagModel = new DynamicTagModel(tagModelConfig, clsTag);

src/config/default-app-config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ export class DefaultAppConfig implements AppConfig {
293293
dropdownHintEnabled: {
294294
// NOTE: list of metadata fields for which the dropdown hint is enabled
295295
// eg. 'dc.access.rights': true,
296-
}
296+
},
297+
// Minimum number of characters required before performing a lookup.
298+
minChars: 3,
297299
};
298300

299301
// Default Language in which the UI will be rendered if the user's browser language is not an active language

src/config/submission-config.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@ export interface SubmissionConfig extends Config {
4949
icons: IconsConfig;
5050
detectDuplicate: DetectDuplicateConfig;
5151
dropdownHintEnabled?: SubmissionDropdownHintEnabled;
52+
minChars?: number;
5253
}

0 commit comments

Comments
 (0)