mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
fixed linting errors
This commit is contained in:
@@ -61,7 +61,6 @@ export class JsonPatchOperationsBuilder {
|
|||||||
this.prepareValue(value, plain, false)));
|
this.prepareValue(value, plain, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
move(path: JsonPatchOperationPathObject, prevPath: string) {
|
move(path: JsonPatchOperationPathObject, prevPath: string) {
|
||||||
this.store.dispatch(
|
this.store.dispatch(
|
||||||
new NewPatchMoveOperationAction(
|
new NewPatchMoveOperationAction(
|
||||||
|
@@ -56,10 +56,10 @@ describe('FormBuilderService test suite', () => {
|
|||||||
let testFormConfiguration: SubmissionFormsModel;
|
let testFormConfiguration: SubmissionFormsModel;
|
||||||
let service: FormBuilderService;
|
let service: FormBuilderService;
|
||||||
|
|
||||||
const submissionId = '1234';
|
const submissionId = '1234';
|
||||||
|
|
||||||
function testValidator() {
|
function testValidator() {
|
||||||
return {testValidator: {valid: true}};
|
return { testValidator: { valid: true } };
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAsyncValidator() {
|
function testAsyncValidator() {
|
||||||
@@ -71,10 +71,10 @@ describe('FormBuilderService test suite', () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [ReactiveFormsModule],
|
imports: [ReactiveFormsModule],
|
||||||
providers: [
|
providers: [
|
||||||
{provide: FormBuilderService, useClass: FormBuilderService},
|
{ provide: FormBuilderService, useClass: FormBuilderService },
|
||||||
{provide: DynamicFormValidationService, useValue: {}},
|
{ provide: DynamicFormValidationService, useValue: {} },
|
||||||
{provide: NG_VALIDATORS, useValue: testValidator, multi: true},
|
{ provide: NG_VALIDATORS, useValue: testValidator, multi: true },
|
||||||
{provide: NG_ASYNC_VALIDATORS, useValue: testAsyncValidator, multi: true}
|
{ provide: NG_ASYNC_VALIDATORS, useValue: testAsyncValidator, multi: true }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -148,9 +148,9 @@ describe('FormBuilderService test suite', () => {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
new DynamicTextAreaModel({id: 'testTextArea'}),
|
new DynamicTextAreaModel({ id: 'testTextArea' }),
|
||||||
|
|
||||||
new DynamicCheckboxModel({id: 'testCheckbox'}),
|
new DynamicCheckboxModel({ id: 'testCheckbox' }),
|
||||||
|
|
||||||
new DynamicFormArrayModel(
|
new DynamicFormArrayModel(
|
||||||
{
|
{
|
||||||
@@ -158,10 +158,10 @@ describe('FormBuilderService test suite', () => {
|
|||||||
initialCount: 5,
|
initialCount: 5,
|
||||||
groupFactory: () => {
|
groupFactory: () => {
|
||||||
return [
|
return [
|
||||||
new DynamicInputModel({id: 'testFormArrayGroupInput'}),
|
new DynamicInputModel({ id: 'testFormArrayGroupInput' }),
|
||||||
new DynamicFormArrayModel({
|
new DynamicFormArrayModel({
|
||||||
id: 'testNestedFormArray', groupFactory: () => [
|
id: 'testNestedFormArray', groupFactory: () => [
|
||||||
new DynamicInputModel({id: 'testNestedFormArrayGroupInput'})
|
new DynamicInputModel({ id: 'testNestedFormArrayGroupInput' })
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
@@ -173,37 +173,37 @@ describe('FormBuilderService test suite', () => {
|
|||||||
{
|
{
|
||||||
id: 'testFormGroup',
|
id: 'testFormGroup',
|
||||||
group: [
|
group: [
|
||||||
new DynamicInputModel({id: 'nestedTestInput'}),
|
new DynamicInputModel({ id: 'nestedTestInput' }),
|
||||||
new DynamicTextAreaModel({id: 'nestedTestTextArea'})
|
new DynamicTextAreaModel({ id: 'nestedTestTextArea' })
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
new DynamicSliderModel({id: 'testSlider'}),
|
new DynamicSliderModel({ id: 'testSlider' }),
|
||||||
|
|
||||||
new DynamicSwitchModel({id: 'testSwitch'}),
|
new DynamicSwitchModel({ id: 'testSwitch' }),
|
||||||
|
|
||||||
new DynamicDatePickerModel({id: 'testDatepicker', value: new Date()}),
|
new DynamicDatePickerModel({ id: 'testDatepicker', value: new Date() }),
|
||||||
|
|
||||||
new DynamicFileUploadModel({id: 'testFileUpload'}),
|
new DynamicFileUploadModel({ id: 'testFileUpload' }),
|
||||||
|
|
||||||
new DynamicEditorModel({id: 'testEditor'}),
|
new DynamicEditorModel({ id: 'testEditor' }),
|
||||||
|
|
||||||
new DynamicTimePickerModel({id: 'testTimePicker'}),
|
new DynamicTimePickerModel({ id: 'testTimePicker' }),
|
||||||
|
|
||||||
new DynamicRatingModel({id: 'testRating'}),
|
new DynamicRatingModel({ id: 'testRating' }),
|
||||||
|
|
||||||
new DynamicColorPickerModel({id: 'testColorPicker'}),
|
new DynamicColorPickerModel({ id: 'testColorPicker' }),
|
||||||
|
|
||||||
new DynamicTypeaheadModel({id: 'testTypeahead', repeatable: false, metadataFields: [], submissionId: '1234'}),
|
new DynamicTypeaheadModel({ id: 'testTypeahead', repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||||
|
|
||||||
new DynamicScrollableDropdownModel({id: 'testScrollableDropdown', authorityOptions: authorityOptions, repeatable: false, metadataFields: [], submissionId: '1234'}),
|
new DynamicScrollableDropdownModel({ id: 'testScrollableDropdown', authorityOptions: authorityOptions, repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||||
|
|
||||||
new DynamicTagModel({id: 'testTag', repeatable: false, metadataFields: [], submissionId: '1234'}),
|
new DynamicTagModel({ id: 'testTag', repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||||
|
|
||||||
new DynamicListCheckboxGroupModel({id: 'testCheckboxList', authorityOptions: authorityOptions, repeatable: true}),
|
new DynamicListCheckboxGroupModel({ id: 'testCheckboxList', authorityOptions: authorityOptions, repeatable: true }),
|
||||||
|
|
||||||
new DynamicListRadioGroupModel({id: 'testRadioList', authorityOptions: authorityOptions, repeatable: false}),
|
new DynamicListRadioGroupModel({ id: 'testRadioList', authorityOptions: authorityOptions, repeatable: false }),
|
||||||
|
|
||||||
new DynamicRelationGroupModel({
|
new DynamicRelationGroupModel({
|
||||||
submissionId,
|
submissionId,
|
||||||
@@ -211,7 +211,7 @@ describe('FormBuilderService test suite', () => {
|
|||||||
formConfiguration: [{
|
formConfiguration: [{
|
||||||
fields: [{
|
fields: [{
|
||||||
hints: 'Enter the name of the author.',
|
hints: 'Enter the name of the author.',
|
||||||
input: {type: 'onebox'},
|
input: { type: 'onebox' },
|
||||||
label: 'Authors',
|
label: 'Authors',
|
||||||
languageCodes: [],
|
languageCodes: [],
|
||||||
mandatory: 'true',
|
mandatory: 'true',
|
||||||
@@ -226,7 +226,7 @@ describe('FormBuilderService test suite', () => {
|
|||||||
} as FormRowModel, {
|
} as FormRowModel, {
|
||||||
fields: [{
|
fields: [{
|
||||||
hints: 'Enter the affiliation of the author.',
|
hints: 'Enter the affiliation of the author.',
|
||||||
input: {type: 'onebox'},
|
input: { type: 'onebox' },
|
||||||
label: 'Affiliation',
|
label: 'Affiliation',
|
||||||
languageCodes: [],
|
languageCodes: [],
|
||||||
mandatory: 'false',
|
mandatory: 'false',
|
||||||
@@ -247,13 +247,13 @@ describe('FormBuilderService test suite', () => {
|
|||||||
metadataFields: []
|
metadataFields: []
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new DynamicDsDatePickerModel({id: 'testDate'}),
|
new DynamicDsDatePickerModel({ id: 'testDate' }),
|
||||||
|
|
||||||
new DynamicLookupModel({id: 'testLookup', repeatable: false, metadataFields: [], submissionId: '1234'}),
|
new DynamicLookupModel({ id: 'testLookup', repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||||
|
|
||||||
new DynamicLookupNameModel({id: 'testLookupName', repeatable: false, metadataFields: [], submissionId: '1234'}),
|
new DynamicLookupNameModel({ id: 'testLookupName', repeatable: false, metadataFields: [], submissionId: '1234' }),
|
||||||
|
|
||||||
new DynamicQualdropModel({id: 'testCombobox', readOnly: false, required: false}),
|
new DynamicQualdropModel({ id: 'testCombobox', readOnly: false, required: false }),
|
||||||
|
|
||||||
new DynamicRowArrayModel(
|
new DynamicRowArrayModel(
|
||||||
{
|
{
|
||||||
@@ -264,11 +264,12 @@ describe('FormBuilderService test suite', () => {
|
|||||||
submissionId: '1234',
|
submissionId: '1234',
|
||||||
groupFactory: () => {
|
groupFactory: () => {
|
||||||
return [
|
return [
|
||||||
new DynamicInputModel({id: 'testFormRowArrayGroupInput'})
|
new DynamicInputModel({ id: 'testFormRowArrayGroupInput' })
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
required: false
|
required: false,
|
||||||
}
|
metadataKey: 'dc.contributor.author'
|
||||||
|
},
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -278,7 +279,7 @@ describe('FormBuilderService test suite', () => {
|
|||||||
{
|
{
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
input: {type: 'lookup'},
|
input: { type: 'lookup' },
|
||||||
label: 'Journal',
|
label: 'Journal',
|
||||||
mandatory: 'false',
|
mandatory: 'false',
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
@@ -293,7 +294,7 @@ describe('FormBuilderService test suite', () => {
|
|||||||
languageCodes: []
|
languageCodes: []
|
||||||
} as FormFieldModel,
|
} as FormFieldModel,
|
||||||
{
|
{
|
||||||
input: {type: 'onebox'},
|
input: { type: 'onebox' },
|
||||||
label: 'Issue',
|
label: 'Issue',
|
||||||
mandatory: 'false',
|
mandatory: 'false',
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
@@ -306,7 +307,7 @@ describe('FormBuilderService test suite', () => {
|
|||||||
languageCodes: []
|
languageCodes: []
|
||||||
} as FormFieldModel,
|
} as FormFieldModel,
|
||||||
{
|
{
|
||||||
input: {type: 'name'},
|
input: { type: 'name' },
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
mandatory: 'false',
|
mandatory: 'false',
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
@@ -324,24 +325,24 @@ describe('FormBuilderService test suite', () => {
|
|||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
hints: 'If the item has any identification numbers or codes associated with↵ it, please enter the types and the actual numbers or codes.',
|
hints: 'If the item has any identification numbers or codes associated with↵ it, please enter the types and the actual numbers or codes.',
|
||||||
input: {type: 'onebox'},
|
input: { type: 'onebox' },
|
||||||
label: 'Identifiers',
|
label: 'Identifiers',
|
||||||
languageCodes: [],
|
languageCodes: [],
|
||||||
mandatory: 'false',
|
mandatory: 'false',
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
selectableMetadata: [
|
selectableMetadata: [
|
||||||
{metadata: 'dc.identifier.issn', label: 'ISSN'},
|
{ metadata: 'dc.identifier.issn', label: 'ISSN' },
|
||||||
{metadata: 'dc.identifier.other', label: 'Other'},
|
{ metadata: 'dc.identifier.other', label: 'Other' },
|
||||||
{metadata: 'dc.identifier.ismn', label: 'ISMN'},
|
{ metadata: 'dc.identifier.ismn', label: 'ISMN' },
|
||||||
{metadata: 'dc.identifier.govdoc', label: 'Gov\'t Doc #'},
|
{ metadata: 'dc.identifier.govdoc', label: 'Gov\'t Doc #' },
|
||||||
{metadata: 'dc.identifier.uri', label: 'URI'},
|
{ metadata: 'dc.identifier.uri', label: 'URI' },
|
||||||
{metadata: 'dc.identifier.isbn', label: 'ISBN'},
|
{ metadata: 'dc.identifier.isbn', label: 'ISBN' },
|
||||||
{metadata: 'dc.identifier.doi', label: 'DOI'},
|
{ metadata: 'dc.identifier.doi', label: 'DOI' },
|
||||||
{metadata: 'dc.identifier.pmid', label: 'PubMed ID'},
|
{ metadata: 'dc.identifier.pmid', label: 'PubMed ID' },
|
||||||
{metadata: 'dc.identifier.arxiv', label: 'arXiv'}
|
{ metadata: 'dc.identifier.arxiv', label: 'arXiv' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
input: {type: 'onebox'},
|
input: { type: 'onebox' },
|
||||||
label: 'Publisher',
|
label: 'Publisher',
|
||||||
mandatory: 'false',
|
mandatory: 'false',
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
@@ -358,7 +359,7 @@ describe('FormBuilderService test suite', () => {
|
|||||||
{
|
{
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
input: {type: 'onebox'},
|
input: { type: 'onebox' },
|
||||||
label: 'Conference',
|
label: 'Conference',
|
||||||
mandatory: 'false',
|
mandatory: 'false',
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
@@ -626,7 +627,7 @@ describe('FormBuilderService test suite', () => {
|
|||||||
|
|
||||||
it('should throw when unknown DynamicFormControlModel id is specified in JSON', () => {
|
it('should throw when unknown DynamicFormControlModel id is specified in JSON', () => {
|
||||||
|
|
||||||
expect(() => service.fromJSON([{id: 'test'}]))
|
expect(() => service.fromJSON([{ id: 'test' }]))
|
||||||
.toThrow(new Error(`unknown form control model type defined on JSON object with id "test"`));
|
.toThrow(new Error(`unknown form control model type defined on JSON object with id "test"`));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -646,8 +647,8 @@ describe('FormBuilderService test suite', () => {
|
|||||||
const formGroup = service.createFormGroup(testModel);
|
const formGroup = service.createFormGroup(testModel);
|
||||||
const nestedFormGroup = formGroup.controls.testFormGroup as FormGroup;
|
const nestedFormGroup = formGroup.controls.testFormGroup as FormGroup;
|
||||||
const nestedFormGroupModel = testModel[7] as DynamicFormGroupModel;
|
const nestedFormGroupModel = testModel[7] as DynamicFormGroupModel;
|
||||||
const newModel1 = new DynamicInputModel({id: 'newInput1'});
|
const newModel1 = new DynamicInputModel({ id: 'newInput1' });
|
||||||
const newModel2 = new DynamicInputModel({id: 'newInput2'});
|
const newModel2 = new DynamicInputModel({ id: 'newInput2' });
|
||||||
|
|
||||||
service.addFormGroupControl(formGroup, testModel, newModel1);
|
service.addFormGroupControl(formGroup, testModel, newModel1);
|
||||||
service.addFormGroupControl(nestedFormGroup, nestedFormGroupModel, newModel2);
|
service.addFormGroupControl(nestedFormGroup, nestedFormGroupModel, newModel2);
|
||||||
@@ -664,8 +665,8 @@ describe('FormBuilderService test suite', () => {
|
|||||||
const formGroup = service.createFormGroup(testModel);
|
const formGroup = service.createFormGroup(testModel);
|
||||||
const nestedFormGroup = formGroup.controls.testFormGroup as FormGroup;
|
const nestedFormGroup = formGroup.controls.testFormGroup as FormGroup;
|
||||||
const nestedFormGroupModel = testModel[7] as DynamicFormGroupModel;
|
const nestedFormGroupModel = testModel[7] as DynamicFormGroupModel;
|
||||||
const newModel1 = new DynamicInputModel({id: 'newInput1'});
|
const newModel1 = new DynamicInputModel({ id: 'newInput1' });
|
||||||
const newModel2 = new DynamicInputModel({id: 'newInput2'});
|
const newModel2 = new DynamicInputModel({ id: 'newInput2' });
|
||||||
|
|
||||||
service.insertFormGroupControl(4, formGroup, testModel, newModel1);
|
service.insertFormGroupControl(4, formGroup, testModel, newModel1);
|
||||||
service.insertFormGroupControl(0, nestedFormGroup, nestedFormGroupModel, newModel2);
|
service.insertFormGroupControl(0, nestedFormGroup, nestedFormGroupModel, newModel2);
|
||||||
|
@@ -1,20 +1,16 @@
|
|||||||
import { Inject, InjectionToken } from '@angular/core';
|
import { Inject, InjectionToken } from '@angular/core';
|
||||||
import { hasValue, isNotEmpty, isNotNull, isNotUndefined, isEmpty } from '../../../empty.util';
|
import { hasValue, isNotEmpty, isNotNull, isNotUndefined } from '../../../empty.util';
|
||||||
import { FormFieldModel } from '../models/form-field.model';
|
import { FormFieldModel } from '../models/form-field.model';
|
||||||
|
|
||||||
import { uniqueId } from 'lodash';
|
import { uniqueId } from 'lodash';
|
||||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||||
import {
|
import { DynamicRowArrayModel, DynamicRowArrayModelConfig } from '../ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||||
DynamicRowArrayModel,
|
|
||||||
DynamicRowArrayModelConfig
|
|
||||||
} from '../ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
|
||||||
import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-form-ui/models/ds-dynamic-input.model';
|
import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-form-ui/models/ds-dynamic-input.model';
|
||||||
import { DynamicFormControlLayout } from '@ng-dynamic-forms/core';
|
import { DynamicFormControlLayout } from '@ng-dynamic-forms/core';
|
||||||
import { setLayout } from './parser.utils';
|
import { setLayout } from './parser.utils';
|
||||||
import { AuthorityOptions } from '../../../../core/integration/models/authority-options.model';
|
import { AuthorityOptions } from '../../../../core/integration/models/authority-options.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
import { RelationshipOptions } from '../models/relationship-options.model';
|
import { RelationshipOptions } from '../models/relationship-options.model';
|
||||||
import { relationship } from '../../../../core/cache/builders/build-decorators';
|
|
||||||
|
|
||||||
export const SUBMISSION_ID: InjectionToken<string> = new InjectionToken<string>('submissionId');
|
export const SUBMISSION_ID: InjectionToken<string> = new InjectionToken<string>('submissionId');
|
||||||
export const CONFIG_DATA: InjectionToken<FormFieldModel> = new InjectionToken<FormFieldModel>('configData');
|
export const CONFIG_DATA: InjectionToken<FormFieldModel> = new InjectionToken<FormFieldModel>('configData');
|
||||||
@@ -170,7 +166,7 @@ export abstract class FieldParser {
|
|||||||
let fieldCount = 0;
|
let fieldCount = 0;
|
||||||
const fieldIds: any = this.getAllFieldIds();
|
const fieldIds: any = this.getAllFieldIds();
|
||||||
if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length === 1 && this.initFormValues.hasOwnProperty(fieldIds)) {
|
if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length === 1 && this.initFormValues.hasOwnProperty(fieldIds)) {
|
||||||
fieldCount = this.initFormValues[fieldIds].filter(value => hasValue(value) && hasValue(value.value)).length;
|
fieldCount = this.initFormValues[fieldIds].filter((value) => hasValue(value) && hasValue(value.value)).length;
|
||||||
} else if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length > 1) {
|
} else if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length > 1) {
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
fieldIds.forEach((id) => {
|
fieldIds.forEach((id) => {
|
||||||
|
@@ -322,9 +322,4 @@ export class FormComponent implements OnDestroy, OnInit {
|
|||||||
const control = group.controls[index] as FormControl;
|
const control = group.controls[index] as FormControl;
|
||||||
return { $event, context, control, group, model, type };
|
return { $event, context, control, group, model, type };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print(data) {
|
|
||||||
console.log(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -151,8 +151,6 @@ function initForm(state: FormState, action: FormInitAction): FormState {
|
|||||||
* the new state, with the data changed.
|
* the new state, with the data changed.
|
||||||
*/
|
*/
|
||||||
function changeDataForm(state: FormState, action: FormChangeAction): FormState {
|
function changeDataForm(state: FormState, action: FormChangeAction): FormState {
|
||||||
console.log("state changed", action);
|
|
||||||
|
|
||||||
if (hasValue(state[action.payload.formId])) {
|
if (hasValue(state[action.payload.formId])) {
|
||||||
const newState = Object.assign({}, state);
|
const newState = Object.assign({}, state);
|
||||||
newState[action.payload.formId] = Object.assign({}, newState[action.payload.formId], {
|
newState[action.payload.formId] = Object.assign({}, newState[action.payload.formId], {
|
||||||
|
Reference in New Issue
Block a user