feat: Adds options to show subtotals in Pivot Table (#24960)

This commit is contained in:
Michael S. Molina
2023-08-14 09:20:32 -03:00
committed by GitHub
parent a44c99899a
commit be11556799
8 changed files with 42 additions and 2 deletions

View File

@@ -138,7 +138,9 @@ export default function PivotTableChart(props: PivotTableProps) {
rowSubtotalPosition,
colSubtotalPosition,
colTotals,
colSubTotals,
rowTotals,
rowSubTotals,
valueFormat,
currencyFormat,
emitCrossFilters,
@@ -432,7 +434,9 @@ export default function PivotTableChart(props: PivotTableProps) {
clickRowHeaderCallback: toggleFilter,
clickColumnHeaderCallback: toggleFilter,
colTotals,
colSubTotals,
rowTotals,
rowSubTotals,
highlightHeaderCellsOnHover:
emitCrossFilters ||
isFeatureEnabled(FeatureFlag.DRILL_BY) ||
@@ -444,10 +448,12 @@ export default function PivotTableChart(props: PivotTableProps) {
}),
[
colTotals,
colSubTotals,
dateFormatters,
emitCrossFilters,
metricColorFormatters,
rowTotals,
rowSubTotals,
selectedFilters,
toggleFilter,
],

View File

@@ -218,6 +218,18 @@ const config: ControlPanelConfig = {
},
},
],
[
{
name: 'rowSubTotals',
config: {
type: 'CheckboxControl',
label: t('Show rows subtotal'),
default: false,
renderTrigger: true,
description: t('Display row level subtotal'),
},
},
],
[
{
name: 'colTotals',
@@ -230,6 +242,18 @@ const config: ControlPanelConfig = {
},
},
],
[
{
name: 'colSubTotals',
config: {
type: 'CheckboxControl',
label: t('Show columns subtotal'),
default: false,
renderTrigger: true,
description: t('Display column level subtotal'),
},
},
],
[
{
name: 'transposePivot',

View File

@@ -96,7 +96,9 @@ export default function transformProps(chartProps: ChartProps<QueryFormData>) {
rowSubtotalPosition,
colSubtotalPosition,
colTotals,
colSubTotals,
rowTotals,
rowSubTotals,
valueFormat,
dateFormat,
metricsLayout,
@@ -156,7 +158,9 @@ export default function transformProps(chartProps: ChartProps<QueryFormData>) {
rowSubtotalPosition,
colSubtotalPosition,
colTotals,
colSubTotals,
rowTotals,
rowSubTotals,
valueFormat,
currencyFormat,
emitCrossFilters,

View File

@@ -92,14 +92,14 @@ export class TableRenderer extends React.Component {
const colSubtotalDisplay = {
displayOnTop: false,
enabled: rowTotals,
enabled: tableOptions.colSubTotals,
hideOnExpand: false,
...subtotalOptions.colSubtotalDisplay,
};
const rowSubtotalDisplay = {
displayOnTop: false,
enabled: colTotals,
enabled: tableOptions.rowSubTotals,
hideOnExpand: false,
...subtotalOptions.rowSubtotalDisplay,
};

View File

@@ -63,7 +63,9 @@ interface PivotTableCustomizeProps {
rowSubtotalPosition: boolean;
colSubtotalPosition: boolean;
colTotals: boolean;
colSubTotals: boolean;
rowTotals: boolean;
rowSubTotals: boolean;
valueFormat: string;
currencyFormat: Currency;
setDataMask: SetDataMaskHook;