From 56a7544c1ec17f426587b796cfcd2f0aec76dc0a Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Sat, 31 Oct 2020 13:43:31 +0100 Subject: [PATCH] Make reverse non destructive --- .../feature-list-container/feature-list-container.component.ts | 2 +- .../feature-list-feature-container.component.ts | 2 +- .../item-list-item-container.component.ts | 2 +- .../selected-item-container.component.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/common-map/src/fm-map/components/feature-list-container/feature-list-container.component.ts b/projects/common-map/src/fm-map/components/feature-list-container/feature-list-container.component.ts index 83443ba..0fea03c 100644 --- a/projects/common-map/src/fm-map/components/feature-list-container/feature-list-container.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list-container/feature-list-container.component.ts @@ -17,6 +17,7 @@ import { Observable } from 'rxjs'; export class FeatureListContainerComponent { constructor(private store: Store,private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListComponent) public featureLists: AbstractFeatureListComponent[],private packageService:PackageService ) { + this.featureLists = [...this.featureLists].reverse(); } @Input() features: Array @@ -32,7 +33,6 @@ export class FeatureListContainerComponent { let selected = -1; let maxMatches =0; let showItem = true; - this.featureLists.reverse(); for (let i = 0; i < this.featureLists.length; i++) { let matches=0; let criteria=0; diff --git a/projects/common-map/src/fm-map/components/feature-list-feature-container/feature-list-feature-container.component.ts b/projects/common-map/src/fm-map/components/feature-list-feature-container/feature-list-feature-container.component.ts index 8fb965f..56edfd5 100644 --- a/projects/common-map/src/fm-map/components/feature-list-feature-container/feature-list-feature-container.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list-feature-container/feature-list-feature-container.component.ts @@ -15,6 +15,7 @@ import { WidgetHostDirective } from '../widget-host/widget-host.directive'; export class FeatureListFeatureContainerComponent { constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListFeatureComponent) public featureLists: AbstractFeatureListFeatureComponent[] ) { + this.featureLists = [...this.featureLists].reverse(); } @Input() feature: Feature; @@ -26,7 +27,6 @@ export class FeatureListFeatureContainerComponent { let selected = -1; let maxMatches =0; - this.featureLists.reverse(); for (let i = 0; i < this.featureLists.length; i++) { let matches=0; let criteria=0; diff --git a/projects/common-map/src/fm-map/components/item-list-item-container/item-list-item-container.component.ts b/projects/common-map/src/fm-map/components/item-list-item-container/item-list-item-container.component.ts index e7bc9b8..f7ee0cb 100644 --- a/projects/common-map/src/fm-map/components/item-list-item-container/item-list-item-container.component.ts +++ b/projects/common-map/src/fm-map/components/item-list-item-container/item-list-item-container.component.ts @@ -15,6 +15,7 @@ import { IItem, IListItem } from '@farmmaps/common'; export class ItemListItemContainerComponent { constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractItemListItemComponent) public itemComponentList: AbstractItemListItemComponent[] ) { + this.itemComponentList = [...this.itemComponentList].reverse(); } @Input() item: IListItem; @@ -27,7 +28,6 @@ export class ItemListItemContainerComponent { let selected = -1; let maxMatches =0; let showItem = true; - this.itemComponentList.reverse(); for (let i = 0; i < this.itemComponentList.length; i++) { let matches=0; let criteria=0; diff --git a/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts b/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts index 65d3eb6..37f9569 100644 --- a/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts +++ b/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts @@ -13,6 +13,7 @@ import { IItemLayer } from '../../models/item.layer'; export class SelectedItemContainerComponent { constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractSelectedItemComponent) public selectedItemComponents: AbstractSelectedItemComponent[] ) { + this.selectedItemComponents = [...this.selectedItemComponents].reverse(); } @Input() item: IItem; @@ -28,7 +29,6 @@ export class SelectedItemContainerComponent { let selected = -1; let maxMatches =0; let showItem = true; - this.selectedItemComponents.reverse(); for (let i = 0; i < this.selectedItemComponents.length; i++) { let matches=0; let criteria=0;