fix(dashboard): Allow selecting text in cells in Table and PivotTable without triggering cross filters (#23283)

This commit is contained in:
Kamil Gabryjelski
2023-03-06 13:42:52 +01:00
committed by GitHub
parent 1b139d0748
commit d16512b775
5 changed files with 67 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ import {
DTTM_ALIAS,
ensureIsArray,
GenericDataType,
getSelectedText,
getTimeFormatterForGranularity,
BinaryQueryObjectFilterClause,
styled,
@@ -493,7 +494,12 @@ export default function TableChart<D extends DataRecord = DataRecord>(
title: typeof value === 'number' ? String(value) : undefined,
onClick:
emitCrossFilters && !valueRange && !isMetric
? () => toggleFilter(key, value)
? () => {
// allow selecting text in a cell
if (!getSelectedText()) {
toggleFilter(key, value);
}
}
: undefined,
onContextMenu: (e: MouseEvent) => {
if (handleContextMenu) {