fix: Further drill by in Pivot Table (#23692)

This commit is contained in:
Kamil Gabryjelski 2023-04-14 15:50:13 +02:00 committed by GitHub
parent d66e6e6d40
commit da5f7155c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 17 deletions

View File

@ -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 },

View File

@ -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,