mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
69 lines
2.1 KiB
TypeScript
69 lines
2.1 KiB
TypeScript
import { Component, Input } from '@angular/core';
|
|
import { DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
|
|
import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynamic-form-control.model';
|
|
import { Collection } from '../../core/shared/collection.model';
|
|
import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component';
|
|
import { NormalizedCollection } from '../../core/cache/models/normalized-collection.model';
|
|
|
|
/**
|
|
* Form used for creating and editing collections
|
|
*/
|
|
@Component({
|
|
selector: 'ds-collection-form',
|
|
styleUrls: ['../../shared/comcol-forms/comcol-form/comcol-form.component.scss'],
|
|
templateUrl: '../../shared/comcol-forms/comcol-form/comcol-form.component.html'
|
|
})
|
|
export class CollectionFormComponent extends ComColFormComponent<Collection> {
|
|
/**
|
|
* @type {Collection} A new collection when a collection is being created, an existing Input collection when a collection is being edited
|
|
*/
|
|
@Input() dso: Collection = new Collection();
|
|
|
|
/**
|
|
* @type {Collection.type} This is a collection-type form
|
|
*/
|
|
protected type = Collection.type;
|
|
|
|
/**
|
|
* The dynamic form fields used for creating/editing a collection
|
|
* @type {(DynamicInputModel | DynamicTextAreaModel)[]}
|
|
*/
|
|
formModel: DynamicFormControlModel[] = [
|
|
new DynamicInputModel({
|
|
id: 'title',
|
|
name: 'dc.title',
|
|
required: true,
|
|
validators: {
|
|
required: null
|
|
},
|
|
errorMessages: {
|
|
required: 'Please enter a name for this title'
|
|
},
|
|
}),
|
|
new DynamicTextAreaModel({
|
|
id: 'description',
|
|
name: 'dc.description',
|
|
}),
|
|
new DynamicTextAreaModel({
|
|
id: 'abstract',
|
|
name: 'dc.description.abstract',
|
|
}),
|
|
new DynamicTextAreaModel({
|
|
id: 'rights',
|
|
name: 'dc.rights',
|
|
}),
|
|
new DynamicTextAreaModel({
|
|
id: 'tableofcontents',
|
|
name: 'dc.description.tableofcontents',
|
|
}),
|
|
new DynamicTextAreaModel({
|
|
id: 'license',
|
|
name: 'dc.rights.license',
|
|
}),
|
|
new DynamicTextAreaModel({
|
|
id: 'provenance',
|
|
name: 'dc.description.provenance',
|
|
}),
|
|
];
|
|
}
|