diff --git a/src/explore-education-statistics-common/src/modules/table-tool/components/__tests__/TimePeriodDataTable.test.tsx b/src/explore-education-statistics-common/src/modules/table-tool/components/__tests__/TimePeriodDataTable.test.tsx index 8660ec48b20..00d6402cd35 100644 --- a/src/explore-education-statistics-common/src/modules/table-tool/components/__tests__/TimePeriodDataTable.test.tsx +++ b/src/explore-education-statistics-common/src/modules/table-tool/components/__tests__/TimePeriodDataTable.test.tsx @@ -36,10 +36,10 @@ describe('TimePeriodDataTable', () => { const table = screen.getByRole('table'); - expect(table.querySelectorAll('thead tr')).toHaveLength(2); - expect(table.querySelectorAll('thead th')).toHaveLength(6); + expect(table.querySelectorAll('thead tr')).toHaveLength(3); + expect(table.querySelectorAll('thead th')).toHaveLength(7); expect(table.querySelectorAll('thead th[scope="colgroup"]')).toHaveLength( - 2, + 3, ); expect(table.querySelectorAll('thead th[scope="col"]')).toHaveLength(4); @@ -90,10 +90,10 @@ describe('TimePeriodDataTable', () => { const table = screen.getByRole('table'); - expect(table.querySelectorAll('thead tr')).toHaveLength(2); - expect(table.querySelectorAll('thead th')).toHaveLength(6); + expect(table.querySelectorAll('thead tr')).toHaveLength(3); + expect(table.querySelectorAll('thead th')).toHaveLength(7); expect(table.querySelectorAll('thead th[scope="colgroup"]')).toHaveLength( - 2, + 3, ); expect(table.querySelectorAll('thead th[scope="col"]')).toHaveLength(4); @@ -144,10 +144,10 @@ describe('TimePeriodDataTable', () => { const table = screen.getByRole('table'); - expect(table.querySelectorAll('thead tr')).toHaveLength(1); - expect(table.querySelectorAll('thead th')).toHaveLength(2); + expect(table.querySelectorAll('thead tr')).toHaveLength(2); + expect(table.querySelectorAll('thead th')).toHaveLength(3); expect(table.querySelectorAll('thead th[scope="colgroup"]')).toHaveLength( - 0, + 1, ); expect(table.querySelectorAll('thead th[scope="col"]')).toHaveLength(2); @@ -317,10 +317,10 @@ describe('TimePeriodDataTable', () => { const table = screen.getByRole('table'); - expect(table.querySelectorAll('thead tr')).toHaveLength(1); - expect(table.querySelectorAll('thead th')).toHaveLength(1); + expect(table.querySelectorAll('thead tr')).toHaveLength(2); + expect(table.querySelectorAll('thead th')).toHaveLength(2); expect(table.querySelectorAll('thead th[scope="colgroup"]')).toHaveLength( - 0, + 1, ); expect(table.querySelectorAll('thead th[scope="col"]')).toHaveLength(1); expect(table.querySelector('thead th[scope="col"]')).toHaveTextContent( @@ -1450,9 +1450,9 @@ describe('TimePeriodDataTable', () => { expect(table.querySelectorAll('thead th[scope="col"]')).toHaveLength(3); expect(table.querySelectorAll('tbody tr')).toHaveLength(6); - expect(table.querySelectorAll('tbody th')).toHaveLength(11); + expect(table.querySelectorAll('tbody th')).toHaveLength(13); expect(table.querySelectorAll('tbody th[scope="rowgroup"]')).toHaveLength( - 5, + 7, ); expect(table.querySelectorAll('tbody th[scope="row"]')).toHaveLength(6); @@ -1526,10 +1526,10 @@ describe('TimePeriodDataTable', () => { const table = screen.getByRole('table'); - expect(table.querySelectorAll('thead tr')).toHaveLength(2); - expect(table.querySelectorAll('thead th')).toHaveLength(6); + expect(table.querySelectorAll('thead tr')).toHaveLength(3); + expect(table.querySelectorAll('thead th')).toHaveLength(7); expect(table.querySelectorAll('thead th[scope="colgroup"]')).toHaveLength( - 2, + 3, ); expect(table.querySelectorAll('thead th[scope="col"]')).toHaveLength(4); diff --git a/src/explore-education-statistics-common/src/modules/table-tool/components/__tests__/__snapshots__/TimePeriodDataTable.test.tsx.snap b/src/explore-education-statistics-common/src/modules/table-tool/components/__tests__/__snapshots__/TimePeriodDataTable.test.tsx.snap index 34fb42825a1..3952e2f15c4 100644 --- a/src/explore-education-statistics-common/src/modules/table-tool/components/__tests__/__snapshots__/TimePeriodDataTable.test.tsx.snap +++ b/src/explore-education-statistics-common/src/modules/table-tool/components/__tests__/__snapshots__/TimePeriodDataTable.test.tsx.snap @@ -309,8 +309,17 @@ exports[`TimePeriodDataTable renders table with completely empty columns removed + + First language + + + Coventry + + First language + Croydon + + First language + + + Ethnic group major + + + + + Ethnic group major + + + + + Ethnic group major + + + + + Ethnic group major + + + { expect(result.thead).toEqual([ [ { - colSpan: 1, + colSpan: 2, rowSpan: 1, tag: 'td', }, @@ -82,6 +82,13 @@ describe('mapTableToJson', () => { expect(result.tbody).toEqual([ [ + { + rowSpan: 2, + colSpan: 1, + scope: 'rowgroup', + text: 'Region 1', + tag: 'th', + }, { rowSpan: 1, colSpan: 1, @@ -115,7 +122,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ { - colSpan: 2, + colSpan: 3, rowSpan: 1, tag: 'td', }, @@ -138,6 +145,13 @@ describe('mapTableToJson', () => { text: 'Indicator 1', tag: 'th', }, + { + rowSpan: 2, + colSpan: 1, + scope: 'rowgroup', + text: 'Region 1', + tag: 'th', + }, { rowSpan: 1, colSpan: 1, @@ -160,7 +174,7 @@ describe('mapTableToJson', () => { ]); }); - test('returns the correct JSON for a table with two levels of col headers and one level of row headers', () => { + test('returns the correct JSON for a table with three levels of col headers and one level of row headers', () => { const result = mapTableToJson({ tableHeadersConfig: testTableWithOneLevelOfRowsAndTwoLevelsOfColHeadersConfig, @@ -172,7 +186,7 @@ describe('mapTableToJson', () => { [ { colSpan: 1, - rowSpan: 2, + rowSpan: 3, tag: 'td', }, { @@ -183,6 +197,15 @@ describe('mapTableToJson', () => { tag: 'th', }, ], + [ + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + text: 'Region 1', + tag: 'th', + }, + ], [ { colSpan: 1, @@ -225,7 +248,16 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 2, rowSpan: 2, tag: 'td' }, + { colSpan: 2, rowSpan: 3, tag: 'td' }, + { + colSpan: 4, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Region 1', + }, + ], + [ { colSpan: 2, rowSpan: 1, scope: 'colgroup', tag: 'th', text: 'LA 1' }, { colSpan: 2, rowSpan: 1, scope: 'colgroup', tag: 'th', text: 'LA 2' }, ], @@ -307,7 +339,7 @@ describe('mapTableToJson', () => { ]); }); - test('returns the correct JSON for a table with three levels of row and column headers', () => { + test('returns the correct JSON for a table with three levels of row and four column headers', () => { const result = mapTableToJson({ tableHeadersConfig: testTableWithThreeLevelsOfRowAndColHeadersConfig, subjectMeta: testTableWithThreeLevelsOfRowAndColHeaders.subjectMeta, @@ -316,7 +348,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 3, rowSpan: 3, tag: 'td' }, + { colSpan: 3, rowSpan: 4, tag: 'td' }, { colSpan: 4, rowSpan: 1, @@ -332,6 +364,22 @@ describe('mapTableToJson', () => { text: 'Category 2 Filter 2', }, ], + [ + { + colSpan: 4, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + { + colSpan: 4, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + ], [ { colSpan: 2, @@ -1184,7 +1232,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 1, rowSpan: 2, tag: 'td' }, + { colSpan: 1, rowSpan: 3, tag: 'td' }, { colSpan: 2, rowSpan: 1, @@ -1200,6 +1248,22 @@ describe('mapTableToJson', () => { text: 'Category 1 Group 2', }, ], + [ + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + ], [ { colSpan: 1, @@ -1261,7 +1325,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 1, rowSpan: 3, tag: 'td' }, + { colSpan: 1, rowSpan: 4, tag: 'td' }, { colSpan: 2, rowSpan: 2, @@ -1286,6 +1350,22 @@ describe('mapTableToJson', () => { text: 'Category 1 Group 2 Filter 1', }, ], + [ + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + ], [ { colSpan: 1, @@ -1346,7 +1426,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 1, rowSpan: 3, tag: 'td' }, + { colSpan: 1, rowSpan: 4, tag: 'td' }, { colSpan: 4, rowSpan: 1, @@ -1371,6 +1451,22 @@ describe('mapTableToJson', () => { tag: 'th', }, ], + [ + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + ], [ { colSpan: 1, @@ -1444,7 +1540,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 1, rowSpan: 4, tag: 'td' }, + { colSpan: 1, rowSpan: 5, tag: 'td' }, { colSpan: 6, rowSpan: 1, @@ -1485,6 +1581,29 @@ describe('mapTableToJson', () => { tag: 'th', }, ], + [ + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + { + colSpan: 2, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + ], [ { colSpan: 1, @@ -1579,7 +1698,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 1, rowSpan: 3, tag: 'td' }, + { colSpan: 1, rowSpan: 4, tag: 'td' }, { colSpan: 4, rowSpan: 1, @@ -1588,6 +1707,15 @@ describe('mapTableToJson', () => { tag: 'th', }, ], + [ + { + colSpan: 4, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + ], [ { colSpan: 2, @@ -1677,7 +1805,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 1, rowSpan: 4, tag: 'td' }, + { colSpan: 1, rowSpan: 5, tag: 'td' }, { colSpan: 4, rowSpan: 1, @@ -1686,6 +1814,15 @@ describe('mapTableToJson', () => { tag: 'th', }, ], + [ + { + colSpan: 4, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + ], [ { colSpan: 2, @@ -1789,7 +1926,16 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 1, rowSpan: 3, tag: 'td' }, + { colSpan: 1, rowSpan: 4, tag: 'td' }, + { + colSpan: 3, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + ], + [ { colSpan: 2, rowSpan: 1, @@ -1866,8 +2012,8 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ { - colSpan: 1, - rowSpan: 4, + colSpan: 2, + rowSpan: 5, tag: 'td', }, { @@ -1878,6 +2024,15 @@ describe('mapTableToJson', () => { tag: 'th', }, ], + [ + { + colSpan: 3, + rowSpan: 1, + scope: 'colgroup', + tag: 'th', + text: 'Group 1', + }, + ], [ { colSpan: 2, @@ -1930,6 +2085,13 @@ describe('mapTableToJson', () => { expect(result.tbody).toEqual([ [ + { + colSpan: 1, + rowSpan: 2, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { text: 'Category 2 Group 1 Filter 1', rowSpan: 1, @@ -2084,7 +2246,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 2, rowSpan: 1, tag: 'td' }, + { colSpan: 3, rowSpan: 1, tag: 'td' }, { colSpan: 1, rowSpan: 1, @@ -2104,6 +2266,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Category 1 Group 1', }, + { + colSpan: 1, + rowSpan: 2, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 1, @@ -2131,6 +2300,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Category 1 Group 2', }, + { + colSpan: 1, + rowSpan: 2, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 1, @@ -2165,7 +2341,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 3, rowSpan: 1, tag: 'td' }, + { colSpan: 4, rowSpan: 1, tag: 'td' }, { colSpan: 1, rowSpan: 1, @@ -2185,6 +2361,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Category 1 Group 1', }, + { + colSpan: 1, + rowSpan: 2, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 1, @@ -2219,6 +2402,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Category 1 Group 2 Filter 1', }, + { + colSpan: 1, + rowSpan: 2, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 1, @@ -2252,7 +2442,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 3, rowSpan: 1, tag: 'td' }, + { colSpan: 4, rowSpan: 1, tag: 'td' }, { colSpan: 1, rowSpan: 1, @@ -2279,6 +2469,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Category 1 Group 1', }, + { + colSpan: 1, + rowSpan: 2, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 1, @@ -2306,6 +2503,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Category 1 Group 2', }, + { + colSpan: 1, + rowSpan: 2, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 1, @@ -2340,7 +2544,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 4, rowSpan: 1, tag: 'td' }, + { colSpan: 5, rowSpan: 1, tag: 'td' }, { colSpan: 1, rowSpan: 1, @@ -2367,6 +2571,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Category 1 Group 1', }, + { + colSpan: 1, + rowSpan: 2, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 1, @@ -2401,6 +2612,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Category 1 Group 2 Filter 1', }, + { + colSpan: 1, + rowSpan: 2, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 1, @@ -2434,7 +2652,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 3, rowSpan: 1, tag: 'td' }, + { colSpan: 4, rowSpan: 1, tag: 'td' }, { colSpan: 1, rowSpan: 1, @@ -2454,6 +2672,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Indicator 1', }, + { + colSpan: 1, + rowSpan: 4, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 2, @@ -2522,7 +2747,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 4, rowSpan: 1, tag: 'td' }, + { colSpan: 5, rowSpan: 1, tag: 'td' }, { colSpan: 1, rowSpan: 1, @@ -2542,6 +2767,13 @@ describe('mapTableToJson', () => { tag: 'th', text: 'Indicator 1', }, + { + colSpan: 1, + rowSpan: 4, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 2, @@ -2622,7 +2854,7 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ - { colSpan: 3, rowSpan: 1, tag: 'td' }, + { colSpan: 4, rowSpan: 1, tag: 'td' }, { colSpan: 1, rowSpan: 1, @@ -2635,6 +2867,13 @@ describe('mapTableToJson', () => { expect(result.tbody).toEqual([ [ + { + colSpan: 1, + rowSpan: 3, + scope: 'rowgroup', + tag: 'th', + text: 'Group 1', + }, { colSpan: 1, rowSpan: 2, @@ -2699,11 +2938,16 @@ describe('mapTableToJson', () => { expect(result.thead).toEqual([ [ + { colSpan: 5, rowSpan: 2, tag: 'td' }, { - colSpan: 4, + colSpan: 2, rowSpan: 1, - tag: 'td', + scope: 'colgroup', + text: 'Group 1', + tag: 'th', }, + ], + [ { colSpan: 1, rowSpan: 1, @@ -2730,6 +2974,13 @@ describe('mapTableToJson', () => { colSpan: 1, tag: 'th', }, + { + text: 'Group 1', + rowSpan: 3, + scope: 'rowgroup', + colSpan: 1, + tag: 'th', + }, { text: 'Category 3 Group 1 Filter 1', rowSpan: 2, diff --git a/src/explore-education-statistics-common/src/modules/table-tool/utils/__tests__/optimizeFilters.test.ts b/src/explore-education-statistics-common/src/modules/table-tool/utils/__tests__/optimizeFilters.test.ts index c5a60c6bc21..49f85e14393 100644 --- a/src/explore-education-statistics-common/src/modules/table-tool/utils/__tests__/optimizeFilters.test.ts +++ b/src/explore-education-statistics-common/src/modules/table-tool/utils/__tests__/optimizeFilters.test.ts @@ -44,6 +44,12 @@ const testTimePeriod2 = new TimePeriodFilter({ code: 'AY', order: 1, }); +const testFilterGroup1 = new CategoryFilter({ + value: 'Filter Group 1 (level: 0)', + label: 'Filter Group 1', + group: undefined, + category: 'Category 1', +}); const testCategory1Group1Filter1 = new CategoryFilter({ value: 'filter-1', label: 'Filter 1', @@ -88,17 +94,6 @@ const testCategory3Group2Filter7 = new CategoryFilter({ }); describe('optimizeFilters', () => { - test('returns the filters unchanged when there are no groups to add or single headers to remove', () => { - const testFilters: Filter[] = [testLocationFilter1, testTimePeriod1]; - const testHeaderConfig: Filter[][] = [ - [testLocationFilter1, testLocationFilter2], - [testTimePeriod1, testTimePeriod2], - ]; - - const result = optimizeFilters(testFilters, testHeaderConfig); - expect(result).toEqual(testFilters); - }); - test('removes the last filter when there are zero filters in the last header array', () => { const testFilters: Filter[] = [testLocationFilter1, testTimePeriod1]; const testHeaderConfig: Filter[][] = [ @@ -107,7 +102,10 @@ describe('optimizeFilters', () => { ]; const result = optimizeFilters(testFilters, testHeaderConfig); - expect(result).toEqual([testLocationFilter1]); + expect(result).toEqual([ + new FilterGroup('North East', 0), + testLocationFilter1, + ]); }); test('removes the last filter when there is only one filter in the last header array', () => { @@ -118,7 +116,10 @@ describe('optimizeFilters', () => { ]; const result = optimizeFilters(testFilters, testHeaderConfig); - expect(result).toEqual([testLocationFilter1]); + expect(result).toEqual([ + new FilterGroup('North East', 0), + testLocationFilter1, + ]); }); test('adds FilterGroup when groups with different labels in 1 level are not `Default`', () => { @@ -249,7 +250,11 @@ describe('optimizeFilters', () => { ]; const result = optimizeFilters(testFilters, testHeaderConfig); - expect(result).toEqual([testCategory1Group1Filter1, testTimePeriod1]); + expect(result).toEqual([ + new FilterGroup('Filter Group 1', 0), + testCategory1Group1Filter1, + testTimePeriod1, + ]); }); test('does not add FilterGroups when groups across 1 level have same labels that are not `Default`', () => { @@ -261,7 +266,11 @@ describe('optimizeFilters', () => { ]; const result = optimizeFilters(testFilters, testHeaderConfig); - expect(result).toEqual([testCategory1Group1Filter1, testTimePeriod1]); + expect(result).toEqual([ + new FilterGroup('Filter Group 1', 0), + testCategory1Group1Filter1, + testTimePeriod1, + ]); }); test('does not add FilterGroups when groups across 2 adjacent levels have same labels that are not `Default`', () => { @@ -280,7 +289,9 @@ describe('optimizeFilters', () => { const result = optimizeFilters(testFilters, testHeaderConfig); expect(result).toEqual([ + new FilterGroup('Filter Group 1', 0), testCategory1Group1Filter2, + new FilterGroup('Filter Group 2', 1), testCategory3Group2Filter7, testTimePeriod2, ]); @@ -288,6 +299,7 @@ describe('optimizeFilters', () => { test('does not add FilterGroups when groups across 2 non-adjacent levels have same labels that are not `Default`', () => { const testFilters: Filter[] = [ + testFilterGroup1, testCategory1Group1Filter1, testTimePeriod1, testCategory3Group1Filter5, @@ -302,8 +314,11 @@ describe('optimizeFilters', () => { const result = optimizeFilters(testFilters, testHeaderConfig); expect(result).toEqual([ + testFilterGroup1, + new FilterGroup('Filter Group 1', 1), testCategory1Group1Filter1, testTimePeriod1, + new FilterGroup('Filter Group 1', 3), testCategory3Group1Filter5, ]); }); diff --git a/src/explore-education-statistics-common/src/modules/table-tool/utils/optimizeFilters.ts b/src/explore-education-statistics-common/src/modules/table-tool/utils/optimizeFilters.ts index 497678bda31..bf2e92d9243 100644 --- a/src/explore-education-statistics-common/src/modules/table-tool/utils/optimizeFilters.ts +++ b/src/explore-education-statistics-common/src/modules/table-tool/utils/optimizeFilters.ts @@ -35,15 +35,7 @@ export default function optimizeFilters( // Add additional filter groups to our filters if required. return optimizedFilters.flatMap((filter, index) => { - const firstSubGroup = headerConfig[index][0].group; - - // Don't bother showing a single group as this adds - // additional groups to a potentially crowded table. - const hasMultipleGroups = headerConfig[index].some( - header => header.group !== firstSubGroup, - ); - - return filter.group && filter.group !== 'Default' && hasMultipleGroups + return filter.group && filter.group !== 'Default' ? [new FilterGroup(filter.group, index), filter] : filter; });