From 58b6206d04fec0930eaf4f902269d1b24a4846df Mon Sep 17 00:00:00 2001 From: "kim.tran" Date: Wed, 13 Nov 2024 13:08:06 +0100 Subject: [PATCH 1/2] fix: custom group selector reordering applied to table displayed columns --- .../interactive-data-view/interactive-data-view.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.ts b/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.ts index 72670bd7..a079f8f5 100644 --- a/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.ts +++ b/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.ts @@ -403,7 +403,7 @@ export class InteractiveDataViewComponent implements OnInit, AfterContentInit { .map((column) => column.id) } this.displayedColumns$ = this.displayedColumnKeys$.pipe( - distinctUntilChanged((prev, curr) => prev.length === curr.length && prev.every((v) => curr.includes(v))), + distinctUntilChanged((prev, curr) => prev.length === curr.length && prev.every((v, i) => curr[i] === v)), map( (columnKeys) => (columnKeys.map((key) => this.columns.find((col) => col.id === key)).filter((d) => d) as DataTableColumn[]) ?? From 23af6980613eb1486547d7c011391c28198a4908 Mon Sep 17 00:00:00 2001 From: "kim.tran" Date: Wed, 13 Nov 2024 17:00:25 +0100 Subject: [PATCH 2/2] fix: tests fixed --- .../interactive-data-view.component.spec.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.spec.ts b/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.spec.ts index 9c55de38..59dfe9ac 100644 --- a/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.spec.ts +++ b/libs/angular-accelerator/src/lib/components/interactive-data-view/interactive-data-view.component.spec.ts @@ -1012,18 +1012,18 @@ describe('InteractiveDataViewComponent', () => { it('should move item up in picklist active columns list', async () => { const spy = jest.spyOn(CustomGroupColumnSelectorComponent.prototype, 'onSaveClick') const expectedHeaders = [ - 'COLUMN_HEADER_NAME.NAME', 'COLUMN_HEADER_NAME.DESCRIPTION', + 'COLUMN_HEADER_NAME.NAME', 'COLUMN_HEADER_NAME.STATUS', 'COLUMN_HEADER_NAME.RESPONSIBLE', 'Actions', ] const expectedRowsData = [ - ['some name', '', 'some status', 'someone responsible'], - ['example', 'example description', 'status example', ''], - ['name 1', '', 'status name 1', ''], - ['name 2', '', 'status name 2', ''], - ['name 3', '', 'status name 3', ''], + ['', 'some name', 'some status', 'someone responsible'], + ['example description', 'example', 'status example', ''], + ['', 'name 1', 'status name 1', ''], + ['', 'name 2', 'status name 2', ''], + ['', 'name 3', 'status name 3', ''], ] await activeColumnsList[1].selectItem() await sourceControlsButtons[0].click() @@ -1042,17 +1042,17 @@ describe('InteractiveDataViewComponent', () => { const spy = jest.spyOn(CustomGroupColumnSelectorComponent.prototype, 'onSaveClick') const expectedHeaders = [ 'COLUMN_HEADER_NAME.NAME', - 'COLUMN_HEADER_NAME.DESCRIPTION', 'COLUMN_HEADER_NAME.STATUS', + 'COLUMN_HEADER_NAME.DESCRIPTION', 'COLUMN_HEADER_NAME.RESPONSIBLE', 'Actions', ] const expectedRowsData = [ - ['some name', '', 'some status', 'someone responsible'], - ['example', 'example description', 'status example', ''], - ['name 1', '', 'status name 1', ''], - ['name 2', '', 'status name 2', ''], - ['name 3', '', 'status name 3', ''], + ['some name', 'some status', '', 'someone responsible'], + ['example', 'status example', 'example description', ''], + ['name 1', 'status name 1', '', ''], + ['name 2', 'status name 2', '', ''], + ['name 3', 'status name 3', '', ''], ] await activeColumnsList[1].selectItem()