From da5f7155c63c2a9f7b42a31130fa24e9698b1191 Mon Sep 17 00:00:00 2001 From: Kamil Gabryjelski Date: Fri, 14 Apr 2023 15:50:13 +0200 Subject: [PATCH] fix: Further drill by in Pivot Table (#23692) --- .../src/PivotTableChart.tsx | 19 ++++++++++++------- .../src/react-pivottable/TableRenderers.jsx | 18 ++++++++---------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx index 8ec1cb9ad1..9d5718120f 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx +++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx @@ -17,22 +17,24 @@ * under the License. */ import React, { useCallback, useMemo } from 'react'; -import { PlusSquareOutlined, MinusSquareOutlined } from '@ant-design/icons'; +import { MinusSquareOutlined, PlusSquareOutlined } from '@ant-design/icons'; import { AdhocMetric, + BinaryQueryObjectFilterClause, DataRecordValue, + FeatureFlag, getColumnLabel, getNumberFormatter, + getSelectedText, + isAdhocColumn, + isFeatureEnabled, isPhysicalColumn, NumberFormatter, styled, - useTheme, - isAdhocColumn, - BinaryQueryObjectFilterClause, t, - getSelectedText, + useTheme, } from '@superset-ui/core'; -import { PivotTable, sortAs, aggregatorTemplates } from './react-pivottable'; +import { aggregatorTemplates, PivotTable, sortAs } from './react-pivottable'; import { FilterType, MetricsLayoutEnum, @@ -407,7 +409,10 @@ export default function PivotTableChart(props: PivotTableProps) { clickColumnHeaderCallback: toggleFilter, colTotals, rowTotals, - highlightHeaderCellsOnHover: emitCrossFilters, + highlightHeaderCellsOnHover: + emitCrossFilters || + isFeatureEnabled(FeatureFlag.DRILL_BY) || + isFeatureEnabled(FeatureFlag.DRILL_TO_DETAIL), highlightedHeaderCells: selectedFilters, omittedHighlightHeaderGroups: [METRIC_KEY], cellColorFormatters: { [METRIC_KEY]: metricColorFormatters }, diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx index 4ca3f6d5af..8915ed7e9c 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx +++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx @@ -398,11 +398,10 @@ export class TableRenderer extends React.Component { const colSpan = attrIdx < colKey.length ? colAttrSpans[i][attrIdx] : 1; let colLabelClass = 'pvtColLabel'; if (attrIdx < colKey.length) { - if ( - highlightHeaderCellsOnHover && - !omittedHighlightHeaderGroups.includes(colAttrs[attrIdx]) - ) { - colLabelClass += ' hoverable'; + if (!omittedHighlightHeaderGroups.includes(colAttrs[attrIdx])) { + if (highlightHeaderCellsOnHover) { + colLabelClass += ' hoverable'; + } handleContextMenu = e => this.props.onContextMenu(e, colKey, undefined, { [attrName]: colKey[attrIdx], @@ -598,11 +597,10 @@ export class TableRenderer extends React.Component { const attrValueCells = rowKey.map((r, i) => { let handleContextMenu; let valueCellClassName = 'pvtRowLabel'; - if ( - highlightHeaderCellsOnHover && - !omittedHighlightHeaderGroups.includes(rowAttrs[i]) - ) { - valueCellClassName += ' hoverable'; + if (!omittedHighlightHeaderGroups.includes(rowAttrs[i])) { + if (highlightHeaderCellsOnHover) { + valueCellClassName += ' hoverable'; + } handleContextMenu = e => this.props.onContextMenu(e, undefined, rowKey, { [rowAttrs[i]]: r,