mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
moving lookup button outside of input field
This commit is contained in:
@@ -48,7 +48,7 @@
|
|||||||
"closed": null
|
"closed": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"languageCodes": []
|
"languageCodes": ["en", "nl"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@@ -9,45 +9,60 @@
|
|||||||
|
|
||||||
<ng-container *ngTemplateOutlet="startTemplate?.templateRef; context: model"></ng-container>
|
<ng-container *ngTemplateOutlet="startTemplate?.templateRef; context: model"></ng-container>
|
||||||
|
|
||||||
<div [ngClass]="{'form-row': model.hasLanguages }">
|
<div [ngClass]="{'form-row': model.hasLanguages || hasRelationLookup }">
|
||||||
<div [ngClass]="getClass('grid', 'control')">
|
<div [ngClass]="getClass('grid', 'control')">
|
||||||
|
|
||||||
<ng-container #componentViewContainer></ng-container>
|
<ng-container #componentViewContainer></ng-container>
|
||||||
|
|
||||||
<small *ngIf="hasHint" class="text-muted" [innerHTML]="model.hint" [ngClass]="getClass('element', 'hint')"></small>
|
<small *ngIf="hasHint" class="text-muted" [innerHTML]="model.hint" [ngClass]="getClass('element', 'hint')"></small>
|
||||||
|
|
||||||
<div *ngIf="showErrorMessages" [ngClass]="[getClass('element', 'errors'), getClass('grid', 'errors')]">
|
<div *ngIf="showErrorMessages" [ngClass]="[getClass('element', 'errors'), getClass('grid', 'errors')]">
|
||||||
<small *ngFor="let message of errorMessages" class="invalid-feedback d-block">{{ message | translate:model.validators }}</small>
|
<small *ngFor="let message of errorMessages" class="invalid-feedback d-block">{{ message | translate:model.validators }}</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="model.languageCodes && model.languageCodes.length > 0" class="col-xs-2">
|
||||||
|
<select
|
||||||
|
#language="ngModel"
|
||||||
|
[disabled]="model.readOnly"
|
||||||
|
[(ngModel)]="model.language"
|
||||||
|
class="form-control"
|
||||||
|
(blur)="onBlur($event)"
|
||||||
|
(change)="onChangeLanguage($event)"
|
||||||
|
[ngModelOptions]="{standalone: true}"
|
||||||
|
required>
|
||||||
|
<option *ngFor="let lang of model.languageCodes" [value]="lang.code">{{lang.display}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="hasRelationLookup" class="col-auto text-center">
|
||||||
|
<button class="btn btn-secondary"
|
||||||
|
type="submit"
|
||||||
|
ngbTooltip="{{'form.lookup-help' | translate}}"
|
||||||
|
placement="top"
|
||||||
|
(click)="openLookup(); $event.stopPropagation();">{{'form.lookup' | translate}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="model.languageCodes && model.languageCodes.length > 0" class="col-xs-2">
|
|
||||||
<select
|
|
||||||
#language="ngModel"
|
|
||||||
[disabled]="model.readOnly"
|
|
||||||
[(ngModel)]="model.language"
|
|
||||||
class="form-control"
|
|
||||||
(blur)="onBlur($event)"
|
|
||||||
(change)="onChangeLanguage($event)"
|
|
||||||
[ngModelOptions]="{standalone: true}"
|
|
||||||
required>
|
|
||||||
<option *ngFor="let lang of model.languageCodes" [value]="lang.code">{{lang.display}}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ng-container *ngTemplateOutlet="endTemplate?.templateRef; context: model"></ng-container>
|
<ng-container *ngTemplateOutlet="endTemplate?.templateRef; context: model"></ng-container>
|
||||||
|
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
|
|
||||||
<div *ngIf="hasRelationLookup" class="col-auto text-center">
|
|
||||||
<button class="btn btn-secondary"
|
|
||||||
type="submit"
|
|
||||||
ngbTooltip="{{'form.lookup-help' | translate}}"
|
|
||||||
placement="top"
|
|
||||||
(click)="openLookup(); $event.stopPropagation();">{{'form.lookup' | translate}}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div *ngIf="hasRelationLookup" class="mt-3">
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li *ngFor="let result of ( model.value | async)">
|
||||||
|
<ng-container *ngVar="result.indexableObject as v">
|
||||||
|
<button type="button" class="close float-left" aria-label="Close button"
|
||||||
|
(click)="removeSelection(result)">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<span class="d-inline-block align-middle ml-1">{{v | dsObjectKeys}}</span>
|
||||||
|
<span class="d-inline-block align-middle ml-1">{{v.name}}</span>
|
||||||
|
</ng-container>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -69,7 +69,7 @@ import { DsDynamicFormArrayComponent } from './models/array-group/dynamic-form-a
|
|||||||
import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components';
|
import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components';
|
||||||
import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './models/relation-group/dynamic-relation-group.model';
|
import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './models/relation-group/dynamic-relation-group.model';
|
||||||
import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component';
|
import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component';
|
||||||
import { map } from 'rxjs/operators';
|
import { map, tap } from 'rxjs/operators';
|
||||||
import { SelectableListState } from '../../../object-list/selectable-list/selectable-list.reducer';
|
import { SelectableListState } from '../../../object-list/selectable-list/selectable-list.reducer';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { SearchResult } from '../../../search/search-result.model';
|
import { SearchResult } from '../../../search/search-result.model';
|
||||||
@@ -77,9 +77,9 @@ import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
|||||||
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { RelationshipService } from '../../../../core/data/relationship.service';
|
import { RelationshipService } from '../../../../core/data/relationship.service';
|
||||||
import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service';
|
||||||
import { DsDynamicEmptyComponent } from './models/empty/dynamic-empty.component';
|
import { DsDynamicDisabledComponent } from './models/disabled/dynamic-disabled.component';
|
||||||
import { DYNAMIC_FORM_CONTROL_TYPE_EMPTY } from './models/empty/dynamic-empty.model';
|
import { DYNAMIC_FORM_CONTROL_TYPE_DISABLED } from './models/disabled/dynamic-disabled.model';
|
||||||
import { DsDynamicLookupRelationModalComponent } from './models/empty/dynamic-lookup-relation-modal.component';
|
import { DsDynamicLookupRelationModalComponent } from './lookup-modal/dynamic-lookup-relation-modal.component';
|
||||||
|
|
||||||
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
|
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
|
||||||
switch (model.type) {
|
switch (model.type) {
|
||||||
@@ -136,8 +136,8 @@ export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<
|
|||||||
case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME:
|
case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME:
|
||||||
return DsDynamicLookupComponent;
|
return DsDynamicLookupComponent;
|
||||||
|
|
||||||
case DYNAMIC_FORM_CONTROL_TYPE_EMPTY:
|
case DYNAMIC_FORM_CONTROL_TYPE_DISABLED:
|
||||||
return DsDynamicEmptyComponent;
|
return DsDynamicDisabledComponent;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@@ -195,7 +195,6 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
private relationService: RelationshipService,
|
private relationService: RelationshipService,
|
||||||
private selectableListService: SelectableListService
|
private selectableListService: SelectableListService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
super(componentFactoryResolver, layoutService, validationService);
|
super(componentFactoryResolver, layoutService, validationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,6 +206,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
this.listId = 'list-' + this.model.relationship.relationshipType;
|
this.listId = 'list-' + this.model.relationship.relationshipType;
|
||||||
this.model.value = this.selectableListService.getSelectableList(this.listId).pipe(
|
this.model.value = this.selectableListService.getSelectableList(this.listId).pipe(
|
||||||
map((listState: SelectableListState) => hasValue(listState) && hasValue(listState.selection) ? listState.selection : []),
|
map((listState: SelectableListState) => hasValue(listState) && hasValue(listState.selection) ? listState.selection : []),
|
||||||
|
tap((t) => console.log(t))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,12 +259,8 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
modalComp.relationKey = this.model.name;
|
modalComp.relationKey = this.model.name;
|
||||||
modalComp.listId = this.listId;
|
modalComp.listId = this.listId;
|
||||||
modalComp.filter = this.filter;
|
modalComp.filter = this.filter;
|
||||||
modalComp.fieldName = this.searchConfig;
|
modalComp.searchConfiguration = this.searchConfig;
|
||||||
modalComp.label = this.model.label;
|
modalComp.label = this.model.label;
|
||||||
|
|
||||||
this.modalRef.result.then((resultString = '') => {
|
|
||||||
this.modalValuesString = resultString;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removeSelection(object: SearchResult<DSpaceObject>) {
|
removeSelection(object: SearchResult<DSpaceObject>) {
|
||||||
|
@@ -1,26 +1,23 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { PaginatedList } from '../../../../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../../../core/data/paginated-list';
|
||||||
import { SearchResult } from '../../../../../search/search-result.model';
|
import { SearchResult } from '../../../../search/search-result.model';
|
||||||
import { RemoteData } from '../../../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../../core/data/remote-data';
|
||||||
import { Observable, ReplaySubject } from 'rxjs';
|
import { Observable, ReplaySubject } from 'rxjs';
|
||||||
import { SearchService } from '../../../../../../core/shared/search/search.service';
|
import { SearchService } from '../../../../../core/shared/search/search.service';
|
||||||
import { PaginatedSearchOptions } from '../../../../../search/paginated-search-options.model';
|
import { PaginatedSearchOptions } from '../../../../search/paginated-search-options.model';
|
||||||
import { DSpaceObject } from '../../../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../../core/shared/dspace-object.model';
|
||||||
import { PaginationComponentOptions } from '../../../../../pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../../pagination/pagination-component-options.model';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { hasValue, isNotEmpty } from '../../../../../empty.util';
|
import { hasValue, isNotEmpty } from '../../../../empty.util';
|
||||||
import { concat, map, multicast, switchMap, take, takeWhile, tap } from 'rxjs/operators';
|
import { concat, map, multicast, switchMap, take, takeWhile, tap } from 'rxjs/operators';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../../../+my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../../+my-dspace-page/my-dspace-page.component';
|
||||||
import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../../core/shared/search/search-configuration.service';
|
||||||
import { SelectableListService } from '../../../../../object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../../object-list/selectable-list/selectable-list.service';
|
||||||
import { SelectableListState } from '../../../../../object-list/selectable-list/selectable-list.reducer';
|
import { SelectableListState } from '../../../../object-list/selectable-list/selectable-list.reducer';
|
||||||
import { ListableObject } from '../../../../../object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../../../object-collection/shared/listable-object.model';
|
||||||
import { RouteService } from '../../../../../services/route.service';
|
import { RouteService } from '../../../../services/route.service';
|
||||||
import { getSucceededRemoteData } from '../../../../../../core/shared/operators';
|
import { getSucceededRemoteData } from '../../../../../core/shared/operators';
|
||||||
|
|
||||||
const RELATION_TYPE_FILTER_PREFIX = 'f.entityType=';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-dynamic-lookup-relation-modal',
|
selector: 'ds-dynamic-lookup-relation-modal',
|
@@ -0,0 +1,13 @@
|
|||||||
|
<div>
|
||||||
|
<div class="form-row align-items-center">
|
||||||
|
<div class="col">
|
||||||
|
<input class="form-control"
|
||||||
|
[class.is-invalid]="showErrorMessages"
|
||||||
|
[value]="model.value"
|
||||||
|
[disabled]="model.disabled"
|
||||||
|
[type]="model.inputType"
|
||||||
|
[placeholder]="model.placeholder | translate"
|
||||||
|
[readonly]="model.readOnly">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@@ -2,20 +2,17 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|||||||
|
|
||||||
import { DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core';
|
import { DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { DynamicEmptyModel } from './dynamic-empty.model';
|
import { DynamicDisabledModel } from './dynamic-disabled.model';
|
||||||
|
|
||||||
/* TODO take a look at this when the REST entities submission is finished: we will probably need to get the fixed filter from the REST instead of filtering is out from the metadata field */
|
|
||||||
const RELATION_TYPE_METADATA_PREFIX = 'relation.isPublicationOf';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-dynamic-empty',
|
selector: 'ds-dynamic-disabled',
|
||||||
templateUrl: './dynamic-empty.component.html'
|
templateUrl: './dynamic-disabled.component.html'
|
||||||
})
|
})
|
||||||
export class DsDynamicEmptyComponent extends DynamicFormControlComponent {
|
export class DsDynamicDisabledComponent extends DynamicFormControlComponent {
|
||||||
|
|
||||||
@Input() formId: string;
|
@Input() formId: string;
|
||||||
@Input() group: FormGroup;
|
@Input() group: FormGroup;
|
||||||
@Input() model: DynamicEmptyModel;
|
@Input() model: DynamicDisabledModel;
|
||||||
|
|
||||||
@Output() blur: EventEmitter<any> = new EventEmitter<any>();
|
@Output() blur: EventEmitter<any> = new EventEmitter<any>();
|
||||||
@Output() change: EventEmitter<any> = new EventEmitter<any>();
|
@Output() change: EventEmitter<any> = new EventEmitter<any>();
|
||||||
@@ -27,6 +24,4 @@ export class DsDynamicEmptyComponent extends DynamicFormControlComponent {
|
|||||||
) {
|
) {
|
||||||
super(layoutService, validationService);
|
super(layoutService, validationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@@ -1,26 +1,22 @@
|
|||||||
import { DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core';
|
import { DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core';
|
||||||
import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-input.model';
|
import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-input.model';
|
||||||
|
|
||||||
export const DYNAMIC_FORM_CONTROL_TYPE_EMPTY = 'EMPTY';
|
export const DYNAMIC_FORM_CONTROL_TYPE_DISABLED = 'EMPTY';
|
||||||
|
|
||||||
export interface DsDynamicEmptyModelConfig extends DsDynamicInputModelConfig {
|
export interface DsDynamicDisabledModelConfig extends DsDynamicInputModelConfig {
|
||||||
value?: any;
|
value?: any;
|
||||||
repeatable: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DynamicEmptyModel extends DsDynamicInputModel {
|
export class DynamicDisabledModel extends DsDynamicInputModel {
|
||||||
|
|
||||||
@serializable() readonly type: string = DYNAMIC_FORM_CONTROL_TYPE_EMPTY;
|
@serializable() readonly type: string = DYNAMIC_FORM_CONTROL_TYPE_DISABLED;
|
||||||
@serializable() value: any;
|
@serializable() value: any;
|
||||||
@serializable() repeatable: boolean;
|
|
||||||
|
|
||||||
constructor(config: DsDynamicEmptyModelConfig, layout?: DynamicFormControlLayout) {
|
|
||||||
|
|
||||||
|
constructor(config: DsDynamicDisabledModelConfig, layout?: DynamicFormControlLayout) {
|
||||||
super(config, layout);
|
super(config, layout);
|
||||||
|
|
||||||
this.readOnly = true;
|
this.readOnly = true;
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
this.repeatable = config.repeatable;
|
|
||||||
this.valueUpdates.next(config.value);
|
this.valueUpdates.next(config.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -11,7 +11,7 @@ import { AuthorityOptions } from '../../../../../core/integration/models/authori
|
|||||||
import { hasValue } from '../../../../empty.util';
|
import { hasValue } from '../../../../empty.util';
|
||||||
import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
||||||
import { Workspaceitem } from '../../../../../core/submission/models/workspaceitem.model';
|
import { Workspaceitem } from '../../../../../core/submission/models/workspaceitem.model';
|
||||||
import { RelationshipOptions } from './empty/model/relationship-options.model';
|
import { RelationshipOptions } from '../../models/relationship-options.model';
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
|
|
||||||
export interface DsDynamicInputModelConfig extends DynamicInputModelConfig {
|
export interface DsDynamicInputModelConfig extends DynamicInputModelConfig {
|
||||||
@@ -21,6 +21,7 @@ export interface DsDynamicInputModelConfig extends DynamicInputModelConfig {
|
|||||||
language?: string;
|
language?: string;
|
||||||
value?: any;
|
value?: any;
|
||||||
relationship?: RelationshipOptions;
|
relationship?: RelationshipOptions;
|
||||||
|
repeatable: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DsDynamicInputModel extends DynamicInputModel {
|
export class DsDynamicInputModel extends DynamicInputModel {
|
||||||
@@ -31,10 +32,11 @@ export class DsDynamicInputModel extends DynamicInputModel {
|
|||||||
@serializable() languageUpdates: Subject<string>;
|
@serializable() languageUpdates: Subject<string>;
|
||||||
@serializable() workspaceItem: Workspaceitem;
|
@serializable() workspaceItem: Workspaceitem;
|
||||||
@serializable() relationship?: RelationshipOptions;
|
@serializable() relationship?: RelationshipOptions;
|
||||||
|
@serializable() repeatable?: boolean;
|
||||||
|
|
||||||
constructor(config: DsDynamicInputModelConfig, layout?: DynamicFormControlLayout) {
|
constructor(config: DsDynamicInputModelConfig, layout?: DynamicFormControlLayout) {
|
||||||
super(config, layout);
|
super(config, layout);
|
||||||
|
this.repeatable = config.repeatable;
|
||||||
this.readOnly = config.readOnly;
|
this.readOnly = config.readOnly;
|
||||||
this.value = config.value;
|
this.value = config.value;
|
||||||
this.relationship = config.relationship;
|
this.relationship = config.relationship;
|
||||||
|
@@ -1,40 +0,0 @@
|
|||||||
<!--<div>-->
|
|
||||||
<!-- <div *ngIf="model.repeatable || !((model.value | async) && (model.value | async).length > 0)" class="form-row align-items-center">-->
|
|
||||||
<!-- <div class="col">-->
|
|
||||||
<!-- <input class="form-control"-->
|
|
||||||
<!-- [class.is-invalid]="showErrorMessages"-->
|
|
||||||
<!-- [value]="modalValuesString"-->
|
|
||||||
<!-- [disabled]="model.disabled"-->
|
|
||||||
<!-- [type]="model.inputType"-->
|
|
||||||
<!-- [placeholder]="model.placeholder | translate"-->
|
|
||||||
<!-- [readonly]="model.readOnly">-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="col-auto text-center">-->
|
|
||||||
<!-- <button class="btn btn-secondary"-->
|
|
||||||
<!-- type="submit"-->
|
|
||||||
<!-- ngbTooltip="{{'form.lookup-help' | translate}}"-->
|
|
||||||
<!-- placement="top"-->
|
|
||||||
<!-- (click)="openLookup(); $event.stopPropagation();">{{'form.lookup' | translate}}-->
|
|
||||||
<!-- </button>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="mt-3">-->
|
|
||||||
<!-- <ul class="list-unstyled">-->
|
|
||||||
<!-- <li *ngFor="let result of (model.value | async)">-->
|
|
||||||
<!-- <ng-container *ngVar="result.indexableObject as value">-->
|
|
||||||
<!-- <button type="button" class="close float-left" aria-label="Close button"-->
|
|
||||||
<!-- (click)="removeSelection(result)">-->
|
|
||||||
<!-- <span aria-hidden="true">×</span>-->
|
|
||||||
<!-- </button>-->
|
|
||||||
<!-- <span class="d-inline-block align-middle ml-1">{{value.name}}</span>-->
|
|
||||||
<!-- <input [dynamicId]="bindId && model.id"-->
|
|
||||||
<!-- [name]="model.name"-->
|
|
||||||
<!-- type="hidden"-->
|
|
||||||
<!-- [ngModel]="value.uuid"-->
|
|
||||||
<!-- [disabled]="true"-->
|
|
||||||
<!-- [readonly]="true">-->
|
|
||||||
<!-- </ng-container>-->
|
|
||||||
<!-- </li>-->
|
|
||||||
<!-- </ul>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!--</div>-->
|
|
@@ -2,7 +2,7 @@ import { autoserialize } from 'cerialize';
|
|||||||
import { FormRowModel } from '../../../../core/config/models/config-submission-forms.model';
|
import { FormRowModel } from '../../../../core/config/models/config-submission-forms.model';
|
||||||
import { LanguageCode } from './form-field-language-value.model';
|
import { LanguageCode } from './form-field-language-value.model';
|
||||||
import { FormFieldMetadataValueObject } from './form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from './form-field-metadata-value.model';
|
||||||
import { RelationshipOptions } from '../ds-dynamic-form-ui/models/empty/model/relationship-options.model';
|
import { RelationshipOptions } from './relationship-options.model';
|
||||||
|
|
||||||
export class FormFieldModel {
|
export class FormFieldModel {
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ export class FormFieldModel {
|
|||||||
selectableMetadata: FormFieldMetadataValueObject[];
|
selectableMetadata: FormFieldMetadataValueObject[];
|
||||||
|
|
||||||
@autoserialize
|
@autoserialize
|
||||||
selectableRelationships: RelationshipOptions[];
|
selectableRelationship: RelationshipOptions;
|
||||||
|
|
||||||
@autoserialize
|
@autoserialize
|
||||||
rows: FormRowModel[];
|
rows: FormRowModel[];
|
||||||
|
11
src/app/shared/form/builder/parsers/disabled-field-parser.ts
Normal file
11
src/app/shared/form/builder/parsers/disabled-field-parser.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { FieldParser } from './field-parser';
|
||||||
|
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||||
|
import { DsDynamicDisabledModelConfig, DynamicDisabledModel } from '../ds-dynamic-form-ui/models/disabled/dynamic-disabled.model';
|
||||||
|
|
||||||
|
export class DisabledFieldParser extends FieldParser {
|
||||||
|
|
||||||
|
public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any {
|
||||||
|
const emptyModelConfig: DsDynamicDisabledModelConfig = this.initModel(null, label);
|
||||||
|
return new DynamicDisabledModel(emptyModelConfig)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,11 +0,0 @@
|
|||||||
import { FieldParser } from './field-parser';
|
|
||||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
|
||||||
import { DsDynamicEmptyModelConfig, DynamicEmptyModel } from '../ds-dynamic-form-ui/models/empty/dynamic-empty.model';
|
|
||||||
|
|
||||||
export class EmptyFieldParser extends FieldParser {
|
|
||||||
|
|
||||||
public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any {
|
|
||||||
const emptyModelConfig: DsDynamicEmptyModelConfig = this.initModel(null, label);
|
|
||||||
return new DynamicEmptyModel(emptyModelConfig)
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,4 +1,4 @@
|
|||||||
import { hasValue, isNotEmpty, isNotNull, isNotUndefined } from '../../../empty.util';
|
import { hasValue, isEmpty, 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';
|
||||||
@@ -27,6 +27,7 @@ export abstract class FieldParser {
|
|||||||
&& (this.configData.input.type !== 'list')
|
&& (this.configData.input.type !== 'list')
|
||||||
&& (this.configData.input.type !== 'tag')
|
&& (this.configData.input.type !== 'tag')
|
||||||
&& (this.configData.input.type !== 'group')
|
&& (this.configData.input.type !== 'group')
|
||||||
|
&& isEmpty(this.configData.selectableRelationship)
|
||||||
) {
|
) {
|
||||||
let arrayCounter = 0;
|
let arrayCounter = 0;
|
||||||
let fieldArrayCounter = 0;
|
let fieldArrayCounter = 0;
|
||||||
@@ -71,7 +72,7 @@ export abstract class FieldParser {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
const model = this.modelFactory(this.getInitFieldValue());
|
const model = this.modelFactory(this.getInitFieldValue());
|
||||||
if (model.hasLanguages) {
|
if (model.hasLanguages || isNotEmpty(model.relationship)) {
|
||||||
setLayout(model, 'grid', 'control', 'col');
|
setLayout(model, 'grid', 'control', 'col');
|
||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
@@ -185,7 +186,8 @@ export abstract class FieldParser {
|
|||||||
controlModel.readOnly = this.parserOptions.readOnly;
|
controlModel.readOnly = this.parserOptions.readOnly;
|
||||||
controlModel.disabled = this.parserOptions.readOnly;
|
controlModel.disabled = this.parserOptions.readOnly;
|
||||||
controlModel.workspaceItem = this.workspaceItem;
|
controlModel.workspaceItem = this.workspaceItem;
|
||||||
controlModel.relationship = this.configData.selectableRelationships;
|
controlModel.relationship = this.configData.selectableRelationship;
|
||||||
|
controlModel.repeatable = this.configData.repeatable;
|
||||||
|
|
||||||
// Set label
|
// Set label
|
||||||
this.setLabel(controlModel, label, labelEmpty);
|
this.setLabel(controlModel, label, labelEmpty);
|
||||||
|
@@ -12,7 +12,7 @@ import { NameFieldParser } from './name-field-parser';
|
|||||||
import { SeriesFieldParser } from './series-field-parser';
|
import { SeriesFieldParser } from './series-field-parser';
|
||||||
import { TagFieldParser } from './tag-field-parser';
|
import { TagFieldParser } from './tag-field-parser';
|
||||||
import { TextareaFieldParser } from './textarea-field-parser';
|
import { TextareaFieldParser } from './textarea-field-parser';
|
||||||
import { EmptyFieldParser } from './empty-field-parser';
|
import { DisabledFieldParser } from './disabled-field-parser';
|
||||||
|
|
||||||
export class ParserFactory {
|
export class ParserFactory {
|
||||||
public static getConstructor(type: ParserType): GenericConstructor<FieldParser> {
|
public static getConstructor(type: ParserType): GenericConstructor<FieldParser> {
|
||||||
@@ -51,7 +51,7 @@ export class ParserFactory {
|
|||||||
return TextareaFieldParser
|
return TextareaFieldParser
|
||||||
}
|
}
|
||||||
case undefined: {
|
case undefined: {
|
||||||
return EmptyFieldParser
|
return DisabledFieldParser
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@@ -1,9 +1,6 @@
|
|||||||
import { DsDynamicInputModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model';
|
import { DsDynamicInputModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model';
|
||||||
import { DynamicQualdropModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model';
|
import { DynamicQualdropModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model';
|
||||||
import {
|
import { DynamicRowArrayModel, DynamicRowArrayModelConfig } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||||
DynamicRowArrayModel,
|
|
||||||
DynamicRowArrayModelConfig
|
|
||||||
} from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
|
||||||
import { DynamicSelectModel } from '@ng-dynamic-forms/core';
|
import { DynamicSelectModel } from '@ng-dynamic-forms/core';
|
||||||
import { FormRowModel } from '../../core/config/models/config-submission-forms.model';
|
import { FormRowModel } from '../../core/config/models/config-submission-forms.model';
|
||||||
import { SubmissionScopeType } from '../../core/submission/submission-scope-type';
|
import { SubmissionScopeType } from '../../core/submission/submission-scope-type';
|
||||||
@@ -14,7 +11,6 @@ import { AuthorityValue } from '../../core/integration/models/authority.value';
|
|||||||
import { FormFieldMetadataValueObject } from '../form/builder/models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../form/builder/models/form-field-metadata-value.model';
|
||||||
import { DynamicRowGroupModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
|
import { DynamicRowGroupModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
|
||||||
import { Workspaceitem } from '../../core/submission/models/workspaceitem.model';
|
import { Workspaceitem } from '../../core/submission/models/workspaceitem.model';
|
||||||
import { Item } from '../../core/shared/item.model';
|
|
||||||
|
|
||||||
export const qualdropSelectConfig = {
|
export const qualdropSelectConfig = {
|
||||||
name: 'dc.identifier_QUALDROP_METADATA',
|
name: 'dc.identifier_QUALDROP_METADATA',
|
||||||
@@ -57,6 +53,7 @@ export const qualdropInputConfig = {
|
|||||||
id: 'dc_identifier_QUALDROP_VALUE',
|
id: 'dc_identifier_QUALDROP_VALUE',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
repeatable: false,
|
||||||
value: 'test',
|
value: 'test',
|
||||||
workspaceItem: new Workspaceitem()
|
workspaceItem: new Workspaceitem()
|
||||||
};
|
};
|
||||||
@@ -123,6 +120,7 @@ const relationGroupConfig = {
|
|||||||
mandatoryField: 'false',
|
mandatoryField: 'false',
|
||||||
relationFields: ['journal', 'issue'],
|
relationFields: ['journal', 'issue'],
|
||||||
scopeUUID: 'scope',
|
scopeUUID: 'scope',
|
||||||
|
repeatable: false,
|
||||||
submissionScope: SubmissionScopeType.WorkspaceItem,
|
submissionScope: SubmissionScopeType.WorkspaceItem,
|
||||||
value: {
|
value: {
|
||||||
journal: [
|
journal: [
|
||||||
@@ -156,6 +154,7 @@ export const inputWithLanguageAndAuthorityConfig = {
|
|||||||
id: 'testWithAuthority',
|
id: 'testWithAuthority',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
repeatable: false,
|
||||||
value: {
|
value: {
|
||||||
value: 'testWithLanguageAndAuthority',
|
value: 'testWithLanguageAndAuthority',
|
||||||
display: 'testWithLanguageAndAuthority',
|
display: 'testWithLanguageAndAuthority',
|
||||||
@@ -182,6 +181,7 @@ export const inputWithLanguageConfig = {
|
|||||||
id: 'testWithLanguage',
|
id: 'testWithLanguage',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
repeatable: false,
|
||||||
value: 'testWithLanguage',
|
value: 'testWithLanguage',
|
||||||
workspaceItem: new Workspaceitem()
|
workspaceItem: new Workspaceitem()
|
||||||
};
|
};
|
||||||
@@ -205,6 +205,7 @@ export const inputWithLanguageAndAuthorityArrayConfig = {
|
|||||||
id: 'testWithLanguageAndAuthorityArray',
|
id: 'testWithLanguageAndAuthorityArray',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
repeatable: false,
|
||||||
value: [{
|
value: [{
|
||||||
value: 'testLanguageAndAuthorityArray',
|
value: 'testLanguageAndAuthorityArray',
|
||||||
display: 'testLanguageAndAuthorityArray',
|
display: 'testLanguageAndAuthorityArray',
|
||||||
@@ -220,6 +221,7 @@ export const inputWithFormFieldValueConfig = {
|
|||||||
id: 'testWithFormField',
|
id: 'testWithFormField',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
repeatable: false,
|
||||||
value: new FormFieldMetadataValueObject('testWithFormFieldValue'),
|
value: new FormFieldMetadataValueObject('testWithFormFieldValue'),
|
||||||
workspaceItem: new Workspaceitem()
|
workspaceItem: new Workspaceitem()
|
||||||
};
|
};
|
||||||
@@ -231,6 +233,7 @@ export const inputWithAuthorityValueConfig = {
|
|||||||
id: 'testWithAuthorityField',
|
id: 'testWithAuthorityField',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
repeatable: false,
|
||||||
value: Object.assign({}, new AuthorityValue(), { value: 'testWithAuthorityValue', id: 'testWithAuthorityValue', display: 'testWithAuthorityValue' }),
|
value: Object.assign({}, new AuthorityValue(), { value: 'testWithAuthorityValue', id: 'testWithAuthorityValue', display: 'testWithAuthorityValue' }),
|
||||||
workspaceItem: new Workspaceitem()
|
workspaceItem: new Workspaceitem()
|
||||||
};
|
};
|
||||||
@@ -242,6 +245,7 @@ export const inputWithObjectValueConfig = {
|
|||||||
id: 'testWithObjectValue',
|
id: 'testWithObjectValue',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
repeatable: false,
|
||||||
value: { value: 'testWithObjectValue', id: 'testWithObjectValue', display: 'testWithObjectValue' },
|
value: { value: 'testWithObjectValue', id: 'testWithObjectValue', display: 'testWithObjectValue' },
|
||||||
workspaceItem: new Workspaceitem()
|
workspaceItem: new Workspaceitem()
|
||||||
};
|
};
|
||||||
@@ -258,6 +262,7 @@ export const fileFormEditInputConfig = {
|
|||||||
id: 'dc_title',
|
id: 'dc_title',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
repeatable: false,
|
||||||
workspaceItem: new Workspaceitem()
|
workspaceItem: new Workspaceitem()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -138,7 +138,7 @@ import { RoleDirective } from './roles/role.directive';
|
|||||||
import { UserMenuComponent } from './auth-nav-menu/user-menu/user-menu.component';
|
import { UserMenuComponent } from './auth-nav-menu/user-menu/user-menu.component';
|
||||||
import { ClaimedTaskActionsReturnToPoolComponent } from './mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component';
|
import { ClaimedTaskActionsReturnToPoolComponent } from './mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component';
|
||||||
import { ItemDetailPreviewFieldComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
|
import { ItemDetailPreviewFieldComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
|
||||||
import { DsDynamicLookupRelationModalComponent } from './form/builder/ds-dynamic-form-ui/models/empty/dynamic-lookup-relation-modal.component';
|
import { DsDynamicLookupRelationModalComponent } from './form/builder/ds-dynamic-form-ui/lookup-modal/dynamic-lookup-relation-modal.component';
|
||||||
import { SearchResultsComponent } from './search/search-results/search-results.component';
|
import { SearchResultsComponent } from './search/search-results/search-results.component';
|
||||||
import { SearchSidebarComponent } from './search/search-sidebar/search-sidebar.component';
|
import { SearchSidebarComponent } from './search/search-sidebar/search-sidebar.component';
|
||||||
import { SearchSettingsComponent } from './search/search-settings/search-settings.component';
|
import { SearchSettingsComponent } from './search/search-settings/search-settings.component';
|
||||||
@@ -159,7 +159,7 @@ import { SearchFacetSelectedOptionComponent } from './search/search-filters/sear
|
|||||||
import { SearchFacetRangeOptionComponent } from './search/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component';
|
import { SearchFacetRangeOptionComponent } from './search/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component';
|
||||||
import { SearchSwitchConfigurationComponent } from './search/search-switch-configuration/search-switch-configuration.component';
|
import { SearchSwitchConfigurationComponent } from './search/search-switch-configuration/search-switch-configuration.component';
|
||||||
import { SearchAuthorityFilterComponent } from './search/search-filters/search-filter/search-authority-filter/search-authority-filter.component';
|
import { SearchAuthorityFilterComponent } from './search/search-filters/search-filter/search-authority-filter/search-authority-filter.component';
|
||||||
import { DsDynamicEmptyComponent } from './form/builder/ds-dynamic-form-ui/models/empty/dynamic-empty.component';
|
import { DsDynamicDisabledComponent } from './form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component';
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
||||||
@@ -220,7 +220,7 @@ const COMPONENTS = [
|
|||||||
DsDynamicFormControlContainerComponent,
|
DsDynamicFormControlContainerComponent,
|
||||||
DsDynamicListComponent,
|
DsDynamicListComponent,
|
||||||
DsDynamicLookupComponent,
|
DsDynamicLookupComponent,
|
||||||
DsDynamicEmptyComponent,
|
DsDynamicDisabledComponent,
|
||||||
DsDynamicLookupRelationModalComponent,
|
DsDynamicLookupRelationModalComponent,
|
||||||
DsDynamicScrollableDropdownComponent,
|
DsDynamicScrollableDropdownComponent,
|
||||||
DsDynamicTagComponent,
|
DsDynamicTagComponent,
|
||||||
@@ -325,7 +325,7 @@ const ENTRY_COMPONENTS = [
|
|||||||
SearchResultGridElementComponent,
|
SearchResultGridElementComponent,
|
||||||
DsDynamicListComponent,
|
DsDynamicListComponent,
|
||||||
DsDynamicLookupComponent,
|
DsDynamicLookupComponent,
|
||||||
DsDynamicEmptyComponent,
|
DsDynamicDisabledComponent,
|
||||||
DsDynamicLookupRelationModalComponent,
|
DsDynamicLookupRelationModalComponent,
|
||||||
DsDynamicScrollableDropdownComponent,
|
DsDynamicScrollableDropdownComponent,
|
||||||
DsDynamicTagComponent,
|
DsDynamicTagComponent,
|
||||||
|
Reference in New Issue
Block a user