mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
added input value as query in modal
This commit is contained in:
@@ -317,10 +317,12 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
* Open a modal where the user can select relationships to be added to item being submitted
|
* Open a modal where the user can select relationships to be added to item being submitted
|
||||||
*/
|
*/
|
||||||
openLookup() {
|
openLookup() {
|
||||||
|
console.log(this.model);
|
||||||
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, {
|
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, {
|
||||||
size: 'lg'
|
size: 'lg'
|
||||||
});
|
});
|
||||||
const modalComp = this.modalRef.componentInstance;
|
const modalComp = this.modalRef.componentInstance;
|
||||||
|
modalComp.query = this.model.value.value;
|
||||||
modalComp.repeatable = this.model.repeatable;
|
modalComp.repeatable = this.model.repeatable;
|
||||||
modalComp.listId = this.listId;
|
modalComp.listId = this.listId;
|
||||||
modalComp.relationshipOptions = this.model.relationship;
|
modalComp.relationshipOptions = this.model.relationship;
|
||||||
|
@@ -37,7 +37,7 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
|
|||||||
constructor(config: DynamicConcatModelConfig, layout?: DynamicFormControlLayout) {
|
constructor(config: DynamicConcatModelConfig, layout?: DynamicFormControlLayout) {
|
||||||
|
|
||||||
super(config, layout);
|
super(config, layout);
|
||||||
|
console.log(config);
|
||||||
this.separator = config.separator + ' ';
|
this.separator = config.separator + ' ';
|
||||||
this.relationship = config.relationship;
|
this.relationship = config.relationship;
|
||||||
this.repeatable = config.repeatable;
|
this.repeatable = config.repeatable;
|
||||||
@@ -57,8 +57,10 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
|
|||||||
return Object.assign(new FormFieldMetadataValueObject(), firstValue, { value: firstValue.value + this.separator + secondValue.value });
|
return Object.assign(new FormFieldMetadataValueObject(), firstValue, { value: firstValue.value + this.separator + secondValue.value });
|
||||||
} else if (isNotEmpty(firstValue) && isNotEmpty(firstValue.value)) {
|
} else if (isNotEmpty(firstValue) && isNotEmpty(firstValue.value)) {
|
||||||
return Object.assign(new FormFieldMetadataValueObject(), firstValue);
|
return Object.assign(new FormFieldMetadataValueObject(), firstValue);
|
||||||
|
} else if (isNotEmpty(secondValue) && isNotEmpty(secondValue.value)) {
|
||||||
|
return Object.assign(new FormFieldMetadataValueObject(), secondValue);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return new FormFieldMetadataValueObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
[relationship]="relationshipOptions"
|
[relationship]="relationshipOptions"
|
||||||
[repeatable]="repeatable"
|
[repeatable]="repeatable"
|
||||||
[context]="context"
|
[context]="context"
|
||||||
|
[query]="query"
|
||||||
(selectObject)="select($event)"
|
(selectObject)="select($event)"
|
||||||
(deselectObject)="deselect($event)"
|
(deselectObject)="deselect($event)"
|
||||||
class="d-block pt-3">
|
class="d-block pt-3">
|
||||||
|
@@ -42,6 +42,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
|||||||
selection$: Observable<ListableObject[]>;
|
selection$: Observable<ListableObject[]>;
|
||||||
context: Context;
|
context: Context;
|
||||||
metadataFields: string;
|
metadataFields: string;
|
||||||
|
query: string;
|
||||||
subMap: {
|
subMap: {
|
||||||
[uuid: string]: Subscription
|
[uuid: string]: Subscription
|
||||||
} = {};
|
} = {};
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
[resultCount]="(resultsRD$ | async)?.payload?.totalElements"
|
[resultCount]="(resultsRD$ | async)?.payload?.totalElements"
|
||||||
[inPlaceSearch]="true" [showViewModes]="false"></ds-search-sidebar>
|
[inPlaceSearch]="true" [showViewModes]="false"></ds-search-sidebar>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<ds-search-form [inPlaceSearch]="true"></ds-search-form>
|
<ds-search-form [inPlaceSearch]="true" [query]="query"></ds-search-form>
|
||||||
|
|
||||||
<ds-search-labels [inPlaceSearch]="true"></ds-search-labels>
|
<ds-search-labels [inPlaceSearch]="true"></ds-search-labels>
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ import { Context } from '../../../../../../core/shared/context.model';
|
|||||||
export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDestroy {
|
export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDestroy {
|
||||||
@Input() relationship: RelationshipOptions;
|
@Input() relationship: RelationshipOptions;
|
||||||
@Input() listId: string;
|
@Input() listId: string;
|
||||||
|
@Input() query: string;
|
||||||
@Input() repeatable: boolean;
|
@Input() repeatable: boolean;
|
||||||
@Input() selection$: Observable<ListableObject[]>;
|
@Input() selection$: Observable<ListableObject[]>;
|
||||||
@Input() context: Context;
|
@Input() context: Context;
|
||||||
@@ -73,8 +74,6 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
this.resetRoute();
|
this.resetRoute();
|
||||||
this.routeService.setParameter('fixedFilterQuery', this.relationship.filter);
|
this.routeService.setParameter('fixedFilterQuery', this.relationship.filter);
|
||||||
this.routeService.setParameter('configuration', this.relationship.searchConfiguration);
|
this.routeService.setParameter('configuration', this.relationship.searchConfiguration);
|
||||||
|
|
||||||
this.someSelected$ = this.selection$.pipe(map((selection) => isNotEmpty(selection)));
|
|
||||||
this.resultsRD$ = this.searchConfigService.paginatedSearchOptions.pipe(
|
this.resultsRD$ = this.searchConfigService.paginatedSearchOptions.pipe(
|
||||||
map((options) => {
|
map((options) => {
|
||||||
return Object.assign(new PaginatedSearchOptions({}), options, { fixedFilter: this.relationship.filter, configuration: this.relationship.searchConfiguration })
|
return Object.assign(new PaginatedSearchOptions({}), options, { fixedFilter: this.relationship.filter, configuration: this.relationship.searchConfiguration })
|
||||||
@@ -101,7 +100,7 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
*/
|
*/
|
||||||
resetRoute() {
|
resetRoute() {
|
||||||
this.router.navigate([], {
|
this.router.navigate([], {
|
||||||
queryParams: Object.assign({}, { page: 1, pageSize: this.initialPagination.pageSize }),
|
queryParams: Object.assign({}, { page: 1, pageSize: this.initialPagination.pageSize, query: this.query }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,8 @@ export abstract class FieldParser {
|
|||||||
public abstract modelFactory(fieldValue?: FormFieldMetadataValueObject, label?: boolean): any;
|
public abstract modelFactory(fieldValue?: FormFieldMetadataValueObject, label?: boolean): any;
|
||||||
|
|
||||||
public parse() {
|
public parse() {
|
||||||
|
console.log(this.configData);
|
||||||
|
|
||||||
if (((this.getInitValueCount() > 1 && !this.configData.repeatable) || (this.configData.repeatable))
|
if (((this.getInitValueCount() > 1 && !this.configData.repeatable) || (this.configData.repeatable))
|
||||||
&& (this.configData.input.type !== 'list')
|
&& (this.configData.input.type !== 'list')
|
||||||
&& (this.configData.input.type !== 'tag')
|
&& (this.configData.input.type !== 'tag')
|
||||||
@@ -44,9 +46,8 @@ export abstract class FieldParser {
|
|||||||
|
|
||||||
if (Array.isArray(this.configData.selectableMetadata) && this.configData.selectableMetadata.length === 1) {
|
if (Array.isArray(this.configData.selectableMetadata) && this.configData.selectableMetadata.length === 1) {
|
||||||
metadataKey = this.configData.selectableMetadata[0].metadata;
|
metadataKey = this.configData.selectableMetadata[0].metadata;
|
||||||
};
|
}
|
||||||
|
|
||||||
console.log(this.getInitArrayIndex());
|
|
||||||
const config = {
|
const config = {
|
||||||
id: uniqueId() + '_array',
|
id: uniqueId() + '_array',
|
||||||
label: this.configData.label,
|
label: this.configData.label,
|
||||||
|
Reference in New Issue
Block a user