mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
fix linting issues
This commit is contained in:
@@ -95,4 +95,4 @@ export const paginatedRelationsToItems = (thisId: string) =>
|
||||
)
|
||||
)
|
||||
})
|
||||
);
|
||||
);
|
||||
|
@@ -49,9 +49,6 @@ export class RelatedEntitiesSearchComponent implements OnInit {
|
||||
fixedFilter: string;
|
||||
configuration$: Observable<string>;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (isNotEmpty(this.relationType) && isNotEmpty(this.item)) {
|
||||
this.fixedFilter = getFilterByRelation(this.relationType, this.item.id);
|
||||
|
@@ -8,7 +8,6 @@ import { ConfigurationSearchPageGuard } from './configuration-search-page.guard'
|
||||
import { ConfigurationSearchPageComponent } from './configuration-search-page.component';
|
||||
import { FilteredSearchPageComponent } from './filtered-search-page.component';
|
||||
|
||||
|
||||
const components = [
|
||||
SearchPageComponent,
|
||||
FilteredSearchPageComponent,
|
||||
|
@@ -12,7 +12,7 @@ import { ItemType } from '../shared/item-relationships/item-type.model';
|
||||
|
||||
describe('RelationshipTypeService', () => {
|
||||
let service: RelationshipTypeService;
|
||||
let requestService : RequestService;
|
||||
let requestService: RequestService;
|
||||
let restEndpointURL;
|
||||
let halService: any;
|
||||
let publicationTypeString;
|
||||
@@ -23,8 +23,6 @@ describe('RelationshipTypeService', () => {
|
||||
let orgUnitType;
|
||||
|
||||
let relationshipType1;
|
||||
|
||||
|
||||
let relationshipType2;
|
||||
|
||||
let buildList;
|
||||
@@ -49,7 +47,6 @@ describe('RelationshipTypeService', () => {
|
||||
rightType: createSuccessfulRemoteDataObject$(personType)
|
||||
});
|
||||
|
||||
|
||||
relationshipType2 = Object.assign(new RelationshipType(), {
|
||||
id: '2',
|
||||
uuid: '2',
|
||||
|
@@ -56,9 +56,13 @@ export class RelationshipTypeService {
|
||||
/* Flatten the page so we can treat it like an observable */
|
||||
switchMap((typeListRD: RemoteData<PaginatedList<RelationshipType>>) => typeListRD.payload.page),
|
||||
switchMap((type: RelationshipType) => {
|
||||
if (type.leftwardType === label) return this.checkType(type, firstType, secondType);
|
||||
else if (type.rightwardType === label) return this.checkType(type, secondType, firstType);
|
||||
else return [];
|
||||
if (type.leftwardType === label) {
|
||||
return this.checkType(type, firstType, secondType);
|
||||
} else if (type.rightwardType === label) {
|
||||
return this.checkType(type, secondType, firstType);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -74,4 +78,4 @@ export class RelationshipTypeService {
|
||||
map(() => type)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,6 @@ import { AppState, keySelector } from '../../app.reducer';
|
||||
import { NameVariantListState } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer';
|
||||
import { RemoveNameVariantAction, SetNameVariantAction } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.actions';
|
||||
|
||||
|
||||
const relationshipListsStateSelector = (state: AppState) => state.relationshipLists;
|
||||
|
||||
const relationshipListStateSelector = (listID: string): MemoizedSelector<AppState, NameVariantListState> => {
|
||||
@@ -313,7 +312,7 @@ export class RelationshipService extends DataService<Relationship> {
|
||||
relation.relationshipType.pipe(
|
||||
getSucceededRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
map(type => {
|
||||
map((type) => {
|
||||
return { relation, type }
|
||||
})
|
||||
)
|
||||
|
@@ -34,4 +34,3 @@ export class NormalizedGroup extends NormalizedDSpaceObject<Group> implements Ca
|
||||
@autoserialize
|
||||
public permanent: boolean;
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { Action } from '@ngrx/store';
|
||||
import { type } from '../../shared/ngrx/type';
|
||||
import { Params } from '@angular/router';
|
||||
|
||||
/**
|
||||
* The list of HrefIndexAction type definitions
|
||||
@@ -18,12 +17,6 @@ export const RouterActionTypes = {
|
||||
*/
|
||||
export class RouteUpdateAction implements Action {
|
||||
type = RouterActionTypes.ROUTE_UPDATE;
|
||||
|
||||
/**
|
||||
* Create a new RouteUpdateAction
|
||||
*/
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
/* tslint:enable:max-classes-per-file */
|
||||
|
@@ -19,7 +19,7 @@ export class RouterEffects {
|
||||
map((actions: RouterNavigationAction[]) =>
|
||||
actions.map((navigateAction) => {
|
||||
const urlTree = this.router.parseUrl(navigateAction.payload.routerState.url);
|
||||
return urlTree.root.children['primary'].segments.map(it => it.path).join('/');
|
||||
return urlTree.root.children.primary.segments.map((it) => it.path).join('/');
|
||||
})),
|
||||
filter((actions: string[]) => actions[0] !== actions[1]),
|
||||
map(() => new RouteUpdateAction())
|
||||
|
@@ -94,4 +94,4 @@ function setParameter(state: RouteState, action: SetParameterAction | SetQueryPa
|
||||
const subState = state[paramType];
|
||||
const newSubstate = Object.assign({}, subState, { [action.payload.key]: action.payload.value });
|
||||
return Object.assign({}, state, { [paramType]: newSubstate });
|
||||
}
|
||||
}
|
||||
|
@@ -126,9 +126,8 @@ export const getFirstOccurrence = () =>
|
||||
map((rd) => Object.assign(rd, { payload: rd.payload.page.length > 0 ? rd.payload.page[0] : undefined }))
|
||||
);
|
||||
|
||||
|
||||
export const obsLog = (logString?: string) =>
|
||||
<T>(source: Observable<T>): Observable<T> =>
|
||||
source.pipe(
|
||||
tap((t) => console.log(logString || '', t))
|
||||
);
|
||||
);
|
||||
|
@@ -5,21 +5,6 @@ import { hasValue } from '../../shared/empty.util';
|
||||
* Represents the state of a paginated response
|
||||
*/
|
||||
export class PageInfo {
|
||||
constructor(
|
||||
options?: {
|
||||
elementsPerPage: number,
|
||||
totalElements: number,
|
||||
totalPages: number,
|
||||
currentPage: number
|
||||
}
|
||||
) {
|
||||
if (hasValue(options)) {
|
||||
this.elementsPerPage = options.elementsPerPage;
|
||||
this.totalElements = options.totalElements;
|
||||
this.totalPages = options.totalPages;
|
||||
this.currentPage = options.currentPage;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of elements on a page
|
||||
@@ -59,4 +44,20 @@ export class PageInfo {
|
||||
|
||||
@autoserialize
|
||||
self: string;
|
||||
|
||||
constructor(
|
||||
options?: {
|
||||
elementsPerPage: number,
|
||||
totalElements: number,
|
||||
totalPages: number,
|
||||
currentPage: number
|
||||
}
|
||||
) {
|
||||
if (hasValue(options)) {
|
||||
this.elementsPerPage = options.elementsPerPage;
|
||||
this.totalElements = options.totalElements;
|
||||
this.totalPages = options.totalPages;
|
||||
this.currentPage = options.currentPage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ export function excludeFromEquals(object: any, propertyName: string): any {
|
||||
excludedFromEquals.set(object.constructor, [...list, propertyName]);
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:ban-types
|
||||
export function getExcludedFromEqualsFor(constructor: Function): string[] {
|
||||
return excludedFromEquals.get(constructor) || [];
|
||||
}
|
||||
@@ -50,8 +51,8 @@ export function fieldsForEquals(...fields: string[]): any {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// tslint:disable-next-line:ban-types
|
||||
export function getFieldsForEquals(constructor: Function, field: string): string[] {
|
||||
const fieldMap = fieldsForEqualsMap.get(constructor) || new Map();
|
||||
return fieldMap.get(field);
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ class Dog extends EquatableObject<Dog> {
|
||||
public favouriteToy: { name: string, colour: string };
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:max-classes-per-file
|
||||
class Owner extends EquatableObject<Owner> {
|
||||
@excludeFromEquals
|
||||
favouriteFood: string;
|
||||
@@ -110,4 +111,3 @@ describe('equatable', () => {
|
||||
expect(isEqual).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -39,4 +39,4 @@ export abstract class EquatableObject<T> {
|
||||
const keys = Object.keys(this).filter((key) => !excludedKeys.includes(key));
|
||||
return equalsByFields(this, other, keys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@ let mockItemWithoutMetadata: ItemSearchResult;
|
||||
let nameVariant;
|
||||
let mockRelationshipService;
|
||||
|
||||
|
||||
function init() {
|
||||
mockItemWithMetadata = Object.assign(
|
||||
new ItemSearchResult(),
|
||||
@@ -65,7 +64,7 @@ function init() {
|
||||
})
|
||||
});
|
||||
|
||||
nameVariant = "Doe J.";
|
||||
nameVariant = 'Doe J.';
|
||||
mockRelationshipService = {
|
||||
getNameVariant: () => observableOf(nameVariant)
|
||||
};
|
||||
|
@@ -26,7 +26,6 @@ let mockItemWithoutMetadata: ItemSearchResult;
|
||||
let nameVariant;
|
||||
let mockRelationshipService;
|
||||
|
||||
|
||||
function init() {
|
||||
mockItemWithMetadata = Object.assign(
|
||||
new ItemSearchResult(),
|
||||
@@ -65,7 +64,7 @@ function init() {
|
||||
})
|
||||
});
|
||||
|
||||
nameVariant = "Doe J.";
|
||||
nameVariant = 'Doe J.';
|
||||
mockRelationshipService = {
|
||||
getNameVariant: () => observableOf(nameVariant)
|
||||
};
|
||||
|
@@ -1,19 +1,14 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
@Component({
|
||||
selector: 'name-variant-modal',
|
||||
selector: 'ds-name-variant-modal',
|
||||
templateUrl: './name-variant-modal.component.html',
|
||||
styleUrls: ['./name-variant-modal.component.scss']
|
||||
})
|
||||
export class NameVariantModalComponent implements OnInit {
|
||||
export class NameVariantModalComponent {
|
||||
@Input() value: string;
|
||||
|
||||
constructor(public modal: NgbActiveModal) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -190,6 +190,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
|
||||
const ngZone = TestBed.get(NgZone);
|
||||
|
||||
// tslint:disable-next-line:ban-types
|
||||
spyOn(ngZone, 'runOutsideAngular').and.callFake((fn: Function) => fn());
|
||||
component = fixture.componentInstance;
|
||||
debugElement = fixture.debugElement;
|
||||
|
@@ -178,7 +178,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
@Input() hasErrorMessaging = false;
|
||||
@Input() layout = null as DynamicFormLayout;
|
||||
@Input() model: any;
|
||||
relationships$: Observable<SearchResult<Item>[]>;
|
||||
relationships$: Observable<Array<SearchResult<Item>>>;
|
||||
hasRelationLookup: boolean;
|
||||
modalRef: NgbModalRef;
|
||||
item$: Observable<Item>;
|
||||
@@ -231,14 +231,14 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
take(1),
|
||||
switchMap((item: Item) => this.relationService.getRelatedItemsByLabel(item, this.model.relationship.relationshipType)),
|
||||
map((items: RemoteData<PaginatedList<Item>>) => items.payload.page.map((item) => Object.assign(new ItemSearchResult(), { indexableObject: item }))),
|
||||
).subscribe((relatedItems: SearchResult<Item>[]) => this.selectableListService.select(this.listId, relatedItems));
|
||||
).subscribe((relatedItems: Array<SearchResult<Item>>) => this.selectableListService.select(this.listId, relatedItems));
|
||||
|
||||
this.relationships$ = this.selectableListService.getSelectableList(this.listId).pipe(
|
||||
map((listState: SelectableListState) => hasValue(listState) && hasValue(listState.selection) ? listState.selection : []),
|
||||
) as Observable<SearchResult<Item>[]>;
|
||||
) as Observable<Array<SearchResult<Item>>>;
|
||||
this.modelValueMDRepresentation =
|
||||
observableCombineLatest(this.item$, this.relationships$).pipe(
|
||||
map(([item, relatedItems]: [Item, SearchResult<DSpaceObject>[]]) =>
|
||||
map(([item, relatedItems]: [Item, Array<SearchResult<DSpaceObject>>]) =>
|
||||
relatedItems
|
||||
.map((element: SearchResult<DSpaceObject>) => {
|
||||
const relationMD: MetadataValue = item.firstMetadata(this.model.relationship.metadataField, { value: element.indexableObject.uuid });
|
||||
@@ -294,7 +294,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
}
|
||||
|
||||
public hasResultsSelected(): Observable<boolean> {
|
||||
return this.model.value.pipe(map((list: SearchResult<DSpaceObject>[]) => isNotEmpty(list)));
|
||||
return this.model.value.pipe(map((list: Array<SearchResult<DSpaceObject>>) => isNotEmpty(list)));
|
||||
}
|
||||
|
||||
openLookup() {
|
||||
|
@@ -58,8 +58,8 @@ describe('DsDynamicLookupRelationModalComponent', () => {
|
||||
{ provide: RelationshipTypeService, useValue: {} },
|
||||
{
|
||||
provide: Store, useValue: {
|
||||
dispatch: () => {
|
||||
}
|
||||
// tslint:disable-next-line:no-empty
|
||||
dispatch: () => {}
|
||||
}
|
||||
},
|
||||
{ provide: NgZone, useValue: new NgZone({}) },
|
||||
|
@@ -74,7 +74,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
||||
this.modal.close();
|
||||
}
|
||||
|
||||
select(...selectableObjects: SearchResult<Item>[]) {
|
||||
select(...selectableObjects: Array<SearchResult<Item>>) {
|
||||
this.zone.runOutsideAngular(
|
||||
() => {
|
||||
const obs: Observable<any[]> = combineLatest(...selectableObjects.map((sri: SearchResult<Item>) => {
|
||||
@@ -92,8 +92,8 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
||||
})
|
||||
);
|
||||
obs
|
||||
.subscribe((obs: any[]) => {
|
||||
return obs.forEach((object: any) => {
|
||||
.subscribe((arr: any[]) => {
|
||||
return arr.forEach((object: any) => {
|
||||
this.store.dispatch(new AddRelationshipAction(this.item, object.item, this.relationshipOptions.relationshipType, object.nameVariant));
|
||||
}
|
||||
);
|
||||
@@ -108,7 +108,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
||||
).subscribe((nameVariant: string) => this.store.dispatch(new UpdateRelationshipAction(this.item, sri.indexableObject, this.relationshipOptions.relationshipType, nameVariant)))
|
||||
}
|
||||
|
||||
deselect(...selectableObjects: SearchResult<Item>[]) {
|
||||
deselect(...selectableObjects: Array<SearchResult<Item>>) {
|
||||
this.zone.runOutsideAngular(
|
||||
() => selectableObjects.forEach((object) => {
|
||||
this.subMap[object.indexableObject.uuid].unsubscribe();
|
||||
@@ -120,7 +120,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
||||
private setExistingNameVariants() {
|
||||
const virtualMDs: MetadataValue[] = this.item.allMetadata(this.metadataFields).filter((mdValue) => mdValue.isVirtual);
|
||||
|
||||
const relatedItemPairs$: Observable<[Item, Item][]> =
|
||||
const relatedItemPairs$: Observable<Array<[Item, Item]>> =
|
||||
combineLatest(virtualMDs.map((md: MetadataValue) => this.relationshipService.findById(md.virtualValue).pipe(getSucceededRemoteData(), getRemoteDataPayload())))
|
||||
.pipe(
|
||||
switchMap((relationships: Relationship[]) => combineLatest(relationships.map((relationship: Relationship) =>
|
||||
@@ -133,11 +133,11 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
||||
);
|
||||
|
||||
const relatedItems$: Observable<Item[]> = relatedItemPairs$.pipe(
|
||||
map(([relatedItemPairs,]: [[Item, Item][]]) => relatedItemPairs.map(([left, right]: [Item, Item]) => left.uuid === this.item.uuid ? left : right))
|
||||
map(([relatedItemPairs,]: [Array<[Item, Item]>]) => relatedItemPairs.map(([left, right]: [Item, Item]) => left.uuid === this.item.uuid ? left : right))
|
||||
);
|
||||
|
||||
relatedItems$.pipe(take(1)).subscribe((relatedItems) => {
|
||||
let index: number = 0;
|
||||
let index = 0;
|
||||
virtualMDs.forEach(
|
||||
(md: MetadataValue) => {
|
||||
this.relationshipService.setNameVariant(this.listId, relatedItems[index].uuid, md.value);
|
||||
@@ -151,4 +151,4 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
||||
ngOnDestroy() {
|
||||
Object.values(this.subMap).forEach((subscription) => subscription.unsubscribe());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ function init() {
|
||||
variantList1Item2 = 'Test Name Variant 2';
|
||||
}
|
||||
|
||||
|
||||
describe('nameVariantReducer', () => {
|
||||
beforeEach(() => {
|
||||
init();
|
||||
|
@@ -5,14 +5,14 @@
|
||||
import { NameVariantAction, NameVariantActionTypes, SetNameVariantAction } from './name-variant.actions';
|
||||
import { hasValue } from '../../../../empty.util';
|
||||
|
||||
export type NameVariantListsState = {
|
||||
export interface NameVariantListsState {
|
||||
[listID: string]: NameVariantListState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the state of a single list containing nameVariants in the store
|
||||
*/
|
||||
export type NameVariantListState = {
|
||||
export interface NameVariantListState {
|
||||
[itemID: string]: string;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ export function nameVariantReducer(state: NameVariantListsState = {}, action: Na
|
||||
if (hasValue(listState) && hasValue(listState[action.payload.itemID])) {
|
||||
const newListState = setNameVariant(listState, action.payload.itemID, undefined);
|
||||
return Object.assign({}, state, { [action.payload.listID]: newListState });
|
||||
} else {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
default: {
|
||||
|
@@ -40,7 +40,6 @@ describe('RelationshipEffects', () => {
|
||||
let mockRelationshipService;
|
||||
let mockRelationshipTypeService;
|
||||
|
||||
|
||||
function init() {
|
||||
testUUID1 = '20e24c2f-a00a-467c-bdee-c929e79bf08d';
|
||||
testUUID2 = '7f66a4d0-8557-4e77-8b1e-19930895f10a';
|
||||
@@ -125,7 +124,7 @@ describe('RelationshipEffects', () => {
|
||||
|
||||
describe('When it\'s not the first time for this identifier', () => {
|
||||
let action;
|
||||
let testActionType = "TEST_TYPE";
|
||||
const testActionType = 'TEST_TYPE';
|
||||
beforeEach(() => {
|
||||
(relationEffects as any).initialActionMap[identifier] = testActionType;
|
||||
(relationEffects as any).debounceMap[identifier] = new BehaviorSubject<string>(testActionType);
|
||||
@@ -197,7 +196,7 @@ describe('RelationshipEffects', () => {
|
||||
|
||||
describe('When it\'s not the first time for this identifier', () => {
|
||||
let action;
|
||||
let testActionType = "TEST_TYPE";
|
||||
const testActionType = 'TEST_TYPE';
|
||||
beforeEach(() => {
|
||||
(relationEffects as any).initialActionMap[identifier] = testActionType;
|
||||
(relationEffects as any).debounceMap[identifier] = new BehaviorSubject<string>(testActionType);
|
||||
|
@@ -28,12 +28,10 @@ export class RelationshipEffects {
|
||||
[identifier: string]: string
|
||||
} = {};
|
||||
|
||||
|
||||
private initialActionMap: {
|
||||
[identifier: string]: string
|
||||
} = {};
|
||||
|
||||
|
||||
/**
|
||||
* Effect that makes sure all last fired RelationshipActions' types are stored in the map of this service, with the object uuid as their key
|
||||
*/
|
||||
@@ -92,19 +90,16 @@ export class RelationshipEffects {
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
constructor(private actions$: Actions,
|
||||
private relationshipService: RelationshipService,
|
||||
private relationshipTypeService: RelationshipTypeService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
private createIdentifier(item1: Item, item2: Item, relationshipType: string): string {
|
||||
return `${item1.uuid}-${item2.uuid}-${relationshipType}`;
|
||||
}
|
||||
|
||||
|
||||
private addRelationship(item1: Item, item2: Item, relationshipType: string, nameVariant?: string) {
|
||||
const type1: string = item1.firstMetadataValue('relationship.type');
|
||||
const type2: string = item2.firstMetadataValue('relationship.type');
|
||||
|
@@ -96,21 +96,21 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
||||
});
|
||||
}
|
||||
|
||||
selectPage(page: SearchResult<Item>[]) {
|
||||
selectPage(page: Array<SearchResult<Item>>) {
|
||||
this.selection$
|
||||
.pipe(take(1))
|
||||
.subscribe((selection: SearchResult<Item>[]) => {
|
||||
.subscribe((selection: Array<SearchResult<Item>>) => {
|
||||
const filteredPage = page.filter((pageItem) => selection.findIndex((selected) => selected.equals(pageItem)) < 0);
|
||||
this.selectObject.emit(...filteredPage);
|
||||
});
|
||||
this.selectableListService.select(this.listId, page);
|
||||
}
|
||||
|
||||
deselectPage(page: SearchResult<Item>[]) {
|
||||
deselectPage(page: Array<SearchResult<Item>>) {
|
||||
this.allSelected = false;
|
||||
this.selection$
|
||||
.pipe(take(1))
|
||||
.subscribe((selection: SearchResult<Item>[]) => {
|
||||
.subscribe((selection: Array<SearchResult<Item>>) => {
|
||||
const filteredPage = page.filter((pageItem) => selection.findIndex((selected) => selected.equals(pageItem)) >= 0);
|
||||
this.deselectObject.emit(...filteredPage);
|
||||
});
|
||||
@@ -133,7 +133,7 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
||||
).subscribe((results) => {
|
||||
this.selection$
|
||||
.pipe(take(1))
|
||||
.subscribe((selection: SearchResult<Item>[]) => {
|
||||
.subscribe((selection: Array<SearchResult<Item>>) => {
|
||||
const filteredResults = results.filter((pageItem) => selection.findIndex((selected) => selected.equals(pageItem)) < 0);
|
||||
this.selectObject.emit(...filteredResults);
|
||||
});
|
||||
|
@@ -75,4 +75,4 @@ export class DsDynamicLookupRelationSelectionTabComponent {
|
||||
queryParams: Object.assign({}, { page: 1, pageSize: this.initialPagination.pageSize }),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const RELATION_METADATA_PREFIX = "relation."
|
||||
const RELATION_METADATA_PREFIX = 'relation.'
|
||||
|
||||
export class RelationshipOptions {
|
||||
relationshipType: string;
|
||||
|
@@ -18,7 +18,6 @@ export class SelectableListItemControlComponent implements OnInit {
|
||||
*/
|
||||
@Input() object: ListableObject;
|
||||
|
||||
|
||||
@Input() selectionConfig: { repeatable: boolean, listId: string };
|
||||
|
||||
/**
|
||||
@@ -30,7 +29,6 @@ export class SelectableListItemControlComponent implements OnInit {
|
||||
|
||||
@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
|
||||
|
||||
|
||||
selected$: Observable<boolean>;
|
||||
|
||||
constructor(public selectionService: SelectableListService) {
|
||||
|
@@ -179,6 +179,4 @@ export class ObjectListComponent {
|
||||
onPaginationChange(event) {
|
||||
this.paginationChange.emit(event);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ export const SelectableListActionTypes = {
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
export abstract class SelectableListAction implements Action {
|
||||
// tslint:disable-next-line:no-shadowed-variable
|
||||
constructor(public type, public id: string) {
|
||||
}
|
||||
}
|
||||
@@ -75,12 +76,9 @@ export class SelectableListSetSelectionAction extends SelectableListAction {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class SelectableListDeselectAllAction extends SelectableListAction {
|
||||
constructor(id: string) {
|
||||
super(SelectableListActionTypes.DESELECT_ALL, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* tslint:enable:max-classes-per-file */
|
||||
/* tslint:enable:max-classes-per-file */
|
||||
|
@@ -12,7 +12,7 @@ import { hasNoValue } from '../../empty.util';
|
||||
/**
|
||||
* Represents the state of all selectable lists in the store
|
||||
*/
|
||||
export type SelectableListsState = {
|
||||
export interface SelectableListsState {
|
||||
[id: string]: SelectableListState;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,6 @@ function clearSelection(id: string) {
|
||||
return { id: id, selection: [] };
|
||||
}
|
||||
|
||||
|
||||
function isObjectInSelection(selection: ListableObject[], object: ListableObject) {
|
||||
return selection.findIndex((selected) => selected.equals(object)) >= 0
|
||||
}
|
||||
|
@@ -15,4 +15,4 @@ export function getQueryByRelations(relationType: string, itemUUID: string): str
|
||||
*/
|
||||
export function getFilterByRelation(relationType: string, itemUUID: string): string {
|
||||
return `f.${relationType}=${itemUUID}`;
|
||||
}
|
||||
}
|
||||
|
@@ -2,5 +2,5 @@ import { Router } from '@angular/router';
|
||||
|
||||
export function currentPath(router: Router) {
|
||||
const urlTree = router.parseUrl(router.url);
|
||||
return '/' + urlTree.root.children['primary'].segments.map(it => it.path).join('/')
|
||||
}
|
||||
return '/' + urlTree.root.children.primary.segments.map((it) => it.path).join('/')
|
||||
}
|
||||
|
Reference in New Issue
Block a user