@gooddata/sdk-ui-ext 10.35.0-alpha.9 → 10.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +2207 -1777
- package/esm/dataLoaders/DataLoaderAbstractFactory.d.ts.map +1 -1
- package/esm/insightView/InsightRenderer.d.ts.map +1 -1
- package/esm/insightView/InsightRenderer.js +1 -1
- package/esm/insightView/InsightRenderer.js.map +1 -1
- package/esm/insightView/InsightView.d.ts.map +1 -1
- package/esm/internal/components/BaseVisualization.d.ts.map +1 -1
- package/esm/internal/components/BaseVisualization.js +3 -1
- package/esm/internal/components/BaseVisualization.js.map +1 -1
- package/esm/internal/components/VisualizationCatalog.d.ts +6 -4
- package/esm/internal/components/VisualizationCatalog.d.ts.map +1 -1
- package/esm/internal/components/VisualizationCatalog.js +9 -6
- package/esm/internal/components/VisualizationCatalog.js.map +1 -1
- package/esm/internal/components/attributeHierarchies/attributeHierarchyDialog/useBackendProvider.d.ts.map +1 -1
- package/esm/internal/components/attributeHierarchies/attributeHierarchyDialog/utils.d.ts.map +1 -1
- package/esm/internal/components/configurationControls/ColumnHeadersPositionControl.js +2 -2
- package/esm/internal/components/configurationControls/ColumnHeadersPositionControl.js.map +1 -1
- package/esm/internal/components/configurationControls/ImageControl.d.ts.map +1 -1
- package/esm/internal/components/configurationControls/RowHeightControl.d.ts.map +1 -1
- package/esm/internal/components/configurationControls/TextWrappingControl.d.ts.map +1 -1
- package/esm/internal/components/configurationControls/VerticalAlignControl.d.ts.map +1 -1
- package/esm/internal/components/configurationControls/advanced/snippets.js +1 -1
- package/esm/internal/components/configurationControls/advanced/snippets.js.map +1 -1
- package/esm/internal/components/configurationControls/advanced/useOverflow.d.ts.map +1 -1
- package/esm/internal/components/configurationControls/clustering/ClusteringThresholdControl.d.ts.map +1 -1
- package/esm/internal/components/configurationControls/clustering/NumberOfClustersControl.d.ts.map +1 -1
- package/esm/internal/components/configurationControls/interactions/InteractionsSection.d.ts.map +1 -1
- package/esm/internal/components/configurationControls/total/TotalSection.js +1 -1
- package/esm/internal/components/configurationControls/total/TotalSection.js.map +1 -1
- package/esm/internal/components/configurationPanels/BaseChartConfigurationPanel.js +2 -2
- package/esm/internal/components/configurationPanels/BaseChartConfigurationPanel.js.map +1 -1
- package/esm/internal/components/dialogs/embedInsightDialog/EmbedInsightDialog.d.ts +1 -1
- package/esm/internal/components/dialogs/embedInsightDialog/EmbedInsightDialog.d.ts.map +1 -1
- package/esm/internal/components/dialogs/embedInsightDialog/EmbedInsightDialog.js +3 -3
- package/esm/internal/components/dialogs/embedInsightDialog/EmbedInsightDialog.js.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/DataSources/AsyncSelectComponents.d.ts +0 -1
- package/esm/internal/components/dialogs/userManagementDialogs/DataSources/AsyncSelectComponents.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/DataSources/backend/loadUserDataSourceOptionsPromise.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/DataSources/useAddDataSource.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Details/detailsHooks.d.ts +0 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Details/detailsHooks.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/UserGroups/AsyncSelectComponents.d.ts +0 -1
- package/esm/internal/components/dialogs/userManagementDialogs/UserGroups/AsyncSelectComponents.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/UserGroups/backend/loadUserGroupOptionsPromise.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/UserGroups/userGroupHooks.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Users/AsyncSelectComponents.d.ts +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Users/AsyncSelectComponents.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Users/backend/loadUsersOptionsPromise.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Users/usersHooks.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Workspace/AsyncSelectComponents.d.ts +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Workspace/AsyncSelectComponents.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Workspace/WorkspaceItem/granularPermissionUtils.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Workspace/WorkspaceItem/locales.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Workspace/backend/loadWorkspaceOptionsPromise.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/Workspace/useAddWorkspace.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/dialogHooks.d.ts +0 -1
- package/esm/internal/components/dialogs/userManagementDialogs/dialogHooks.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/hooks/usePermissions.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/types.d.ts.map +1 -1
- package/esm/internal/components/dialogs/userManagementDialogs/utils.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/AbstractPluggableVisualization.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/alerts.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/baseChart/PluggableBaseChart.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/baseChart/PluggableBaseChart.js +2 -2
- package/esm/internal/components/pluggableVisualizations/baseChart/PluggableBaseChart.js.map +1 -1
- package/esm/internal/components/pluggableVisualizations/baseChart/insightIntrospection.js +3 -3
- package/esm/internal/components/pluggableVisualizations/baseChart/insightIntrospection.js.map +1 -1
- package/esm/internal/components/pluggableVisualizations/bulletChart/bucketHelper.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/geoChart/PluggableGeoPushpinChart.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/pivotTable/PluggablePivotTable.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/PivotTableNextDescriptor.d.ts +13 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/PivotTableNextDescriptor.d.ts.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/PivotTableNextDescriptor.js +48 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/PivotTableNextDescriptor.js.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/PluggablePivotTableNext.d.ts +33 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/PluggablePivotTableNext.d.ts.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/PluggablePivotTableNext.js +290 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/PluggablePivotTableNext.js.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/configHelpers.d.ts +14 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/configHelpers.d.ts.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/configHelpers.js +28 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/configHelpers.js.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/helpers.d.ts +6 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/helpers.d.ts.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/helpers.js +23 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/helpers.js.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/pivotTableNextConfigFromInsight.d.ts +4 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/pivotTableNextConfigFromInsight.d.ts.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/pivotTableNextConfigFromInsight.js +14 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/pivotTableNextConfigFromInsight.js.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/sortHelpers.d.ts +20 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/sortHelpers.d.ts.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/sortHelpers.js +166 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/sortHelpers.js.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/totalsHelpers.d.ts +4 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/totalsHelpers.d.ts.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/totalsHelpers.js +15 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/totalsHelpers.js.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/widthItemsHelpers.d.ts +6 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/widthItemsHelpers.d.ts.map +1 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/widthItemsHelpers.js +172 -0
- package/esm/internal/components/pluggableVisualizations/pivotTableNext/widthItemsHelpers.js.map +1 -0
- package/esm/internal/components/pluggableVisualizations/repeater/PluggableRepeater.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/scatterPlot/bucketHelper.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/xirr/PluggableXirr.d.ts.map +1 -1
- package/esm/internal/components/pluggableVisualizations/xirr/xirrBucketHelper.d.ts.map +1 -1
- package/esm/internal/constants/axis.d.ts +26 -2
- package/esm/internal/constants/axis.d.ts.map +1 -1
- package/esm/internal/constants/supportedProperties.d.ts +14 -4
- package/esm/internal/constants/supportedProperties.d.ts.map +1 -1
- package/esm/internal/constants/supportedProperties.js +18 -0
- package/esm/internal/constants/supportedProperties.js.map +1 -1
- package/esm/internal/createRootProvider.d.ts +0 -1
- package/esm/internal/createRootProvider.d.ts.map +1 -1
- package/esm/internal/interfaces/SortConfig.d.ts.map +1 -1
- package/esm/internal/interfaces/Visualization.d.ts +2 -1
- package/esm/internal/interfaces/Visualization.d.ts.map +1 -1
- package/esm/internal/interfaces/Visualization.js.map +1 -1
- package/esm/internal/translations/en-US.json +433 -983
- package/esm/internal/translations/en-US.localization-bundle.d.ts +24 -48
- package/esm/internal/translations/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/internal/translations/en-US.localization-bundle.js +24 -48
- package/esm/internal/translations/en-US.localization-bundle.js.map +1 -1
- package/esm/internal/utils/bucketHelper.d.ts.map +1 -1
- package/esm/internal/utils/bucketHelper.js.map +1 -1
- package/esm/internal/utils/comparisonHelper.d.ts.map +1 -1
- package/esm/internal/utils/embeddingCodeGenerator/getWebComponentsCodeGenerator.d.ts.map +1 -1
- package/esm/internal/utils/uiConfigHelpers/dependencyWheelChartUiConfigHelper.d.ts.map +1 -1
- package/esm/internal/utils/uiConfigHelpers/pivotTableNextUiConfigHelper.d.ts +7 -0
- package/esm/internal/utils/uiConfigHelpers/pivotTableNextUiConfigHelper.d.ts.map +1 -0
- package/esm/internal/utils/uiConfigHelpers/pivotTableNextUiConfigHelper.js +133 -0
- package/esm/internal/utils/uiConfigHelpers/pivotTableNextUiConfigHelper.js.map +1 -0
- package/esm/internal/utils/uiConfigHelpers/repeaterUiConfigHelper.d.ts.map +1 -1
- package/esm/internal/utils/uiConfigHelpers/sankeyChartUiConfigHelper.d.ts.map +1 -1
- package/esm/internal/utils/uiConfigHelpers/xirrUiConfigHelper.d.ts.map +1 -1
- package/esm/notificationsPanel/bem.d.ts.map +1 -1
- package/esm/notificationsPanel/data/dateFilterNaming.d.ts.map +1 -1
- package/esm/notificationsPanel/data/dateFilterNaming.js +1 -1
- package/esm/notificationsPanel/data/dateFilterNaming.js.map +1 -1
- package/esm/sdk-ui-ext.d.ts +1 -3
- package/esm/tsdoc-metadata.json +1 -1
- package/package.json +28 -28
- package/src/notificationsPanel/Notification/DefaultNotification.scss +2 -0
- package/styles/css/main.css +6 -0
- package/styles/css/main.css.map +1 -1
- package/styles/internal/css/attribute_hierarchies.css.map +1 -1
- package/styles/internal/css/bullet_chart.css.map +1 -1
- package/styles/internal/css/charts.css.map +1 -1
- package/styles/internal/css/headline.css.map +1 -1
- package/styles/internal/css/repeater.css +178 -11
- package/styles/internal/css/repeater.css.map +1 -1
- package/styles/internal/scss/attribute_hierarchies.scss +2 -1
package/esm/internal/components/pluggableVisualizations/pivotTableNext/PluggablePivotTableNext.js
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { bucketAttributes, bucketMeasures, insightBucket, insightHasDataDefined, insightProperties, insightFilters, insightBuckets, insightSanitize, } from "@gooddata/sdk-model";
|
|
4
|
+
import { BucketNames, VisualizationTypes } from "@gooddata/sdk-ui";
|
|
5
|
+
import { CorePivotTableNext, } from "@gooddata/sdk-ui-pivot/next";
|
|
6
|
+
import isEmpty from "lodash/isEmpty.js";
|
|
7
|
+
import isEqual from "lodash/isEqual.js";
|
|
8
|
+
import flatMap from "lodash/flatMap.js";
|
|
9
|
+
import cloneDeep from "lodash/cloneDeep.js";
|
|
10
|
+
import { AbstractPluggableVisualization } from "../AbstractPluggableVisualization.js";
|
|
11
|
+
import { METRIC } from "../../../constants/bucket.js";
|
|
12
|
+
import { getMeasureGroupDimensionFromProperties, getReferencePointWithSupportedProperties, getColumnWidthsFromProperties, getColumnHeadersPositionFromProperties, getSupportedPropertiesControls, getPivotTableProperties, } from "../../../utils/propertiesHelper.js";
|
|
13
|
+
import { sanitizePivotTableConfig } from "./configHelpers.js";
|
|
14
|
+
import PivotTableConfigurationPanel from "../../configurationPanels/PivotTableConfigurationPanel.js";
|
|
15
|
+
import { getPivotTableNextDefaultUiConfig, getPivotTableNextMeasuresLimit, setPivotTableNextUiConfig, } from "../../../utils/uiConfigHelpers/pivotTableNextUiConfigHelper.js";
|
|
16
|
+
import { getAllItemsByType, getTotalsFromBucket, limitNumberOfMeasuresInBuckets, removeDuplicateBucketItems, sanitizeFilters, } from "../../../utils/bucketHelper.js";
|
|
17
|
+
import { PIVOT_TABLE_SUPPORTED_PROPERTIES } from "../../../constants/supportedProperties.js";
|
|
18
|
+
import { configureOverTimeComparison, configurePercent } from "../../../utils/bucketConfig.js";
|
|
19
|
+
import { generateDimensions } from "../../../utils/dimensions.js";
|
|
20
|
+
import { isSetColumnHeadersPositionToLeftAllowed } from "../../../utils/controlsHelper.js";
|
|
21
|
+
import { addIntersectionFiltersToInsight, modifyBucketsAttributesForDrillDown, sanitizeTableProperties, } from "../drillDownUtil.js";
|
|
22
|
+
import { getColumnAttributes, getRowAttributes, shouldAdjustColumnHeadersPositionToTop } from "./helpers.js";
|
|
23
|
+
import { adaptReferencePointSortItemsToPivotTable, addDefaultSort, getPivotTableSortItems, getSanitizedSortItems, sanitizePivotTableSorts, } from "./sortHelpers.js";
|
|
24
|
+
import { adaptMdObjectWidthItemsToPivotTable, adaptReferencePointWidthItemsToPivotTable, } from "./widthItemsHelpers.js";
|
|
25
|
+
import { removeInvalidTotals } from "./totalsHelpers.js";
|
|
26
|
+
const PROPERTIES_AFFECTING_REFERENCE_POINT = ["measureGroupDimension"];
|
|
27
|
+
/**
|
|
28
|
+
* Pluggable component for pivot table next.
|
|
29
|
+
*
|
|
30
|
+
* This component uses CorePivotTableNext component to render the pivot table. It creates its own execution and unlike PivotTableNext or CorePivotTableNext,
|
|
31
|
+
* it does its own validation and sanitization of the props from extended reference point and visualization properties.
|
|
32
|
+
*/
|
|
33
|
+
export class PluggablePivotTableNext extends AbstractPluggableVisualization {
|
|
34
|
+
renderFun;
|
|
35
|
+
unmountFun;
|
|
36
|
+
settings;
|
|
37
|
+
backendCapabilities;
|
|
38
|
+
constructor(props) {
|
|
39
|
+
super(props);
|
|
40
|
+
this.renderFun = props.renderFun;
|
|
41
|
+
this.unmountFun = props.unmountFun;
|
|
42
|
+
this.settings = props.featureFlags ?? {};
|
|
43
|
+
this.onColumnResized = this.onColumnResized.bind(this);
|
|
44
|
+
this.handlePushData = this.handlePushData.bind(this);
|
|
45
|
+
this.supportedPropertiesList = PIVOT_TABLE_SUPPORTED_PROPERTIES;
|
|
46
|
+
this.propertiesAffectingReferencePoint = PROPERTIES_AFFECTING_REFERENCE_POINT;
|
|
47
|
+
this.initializeProperties(props.visualizationProperties);
|
|
48
|
+
this.backendCapabilities = props.backend.capabilities;
|
|
49
|
+
}
|
|
50
|
+
unmount() {
|
|
51
|
+
this.unmountFun([this.getElement(), this.getConfigPanelElement()]);
|
|
52
|
+
}
|
|
53
|
+
getExtendedReferencePoint(referencePoint, previousReferencePoint) {
|
|
54
|
+
const clonedReferencePoint = cloneDeep(referencePoint);
|
|
55
|
+
const newReferencePoint = {
|
|
56
|
+
...clonedReferencePoint,
|
|
57
|
+
uiConfig: getPivotTableNextDefaultUiConfig(),
|
|
58
|
+
};
|
|
59
|
+
const buckets = newReferencePoint.buckets;
|
|
60
|
+
const limit = getPivotTableNextMeasuresLimit(this.settings, buckets);
|
|
61
|
+
const limitedBuckets = limitNumberOfMeasuresInBuckets(buckets, limit, true);
|
|
62
|
+
const measures = getAllItemsByType(limitedBuckets, [METRIC]);
|
|
63
|
+
const rowAttributes = getRowAttributes(buckets);
|
|
64
|
+
const previousRowAttributes = previousReferencePoint && getRowAttributes(previousReferencePoint.buckets);
|
|
65
|
+
const columnAttributes = getColumnAttributes(buckets);
|
|
66
|
+
const previousColumnAttributes = previousReferencePoint && getColumnAttributes(previousReferencePoint.buckets);
|
|
67
|
+
const filters = newReferencePoint.filters
|
|
68
|
+
? flatMap(newReferencePoint.filters.items, (item) => item.filters)
|
|
69
|
+
: [];
|
|
70
|
+
const rowTotals = removeInvalidTotals(getTotalsFromBucket(buckets, BucketNames.ATTRIBUTE), filters);
|
|
71
|
+
const colTotals = removeInvalidTotals(getTotalsFromBucket(buckets, BucketNames.COLUMNS), filters);
|
|
72
|
+
newReferencePoint.buckets = removeDuplicateBucketItems([
|
|
73
|
+
{
|
|
74
|
+
localIdentifier: BucketNames.MEASURES,
|
|
75
|
+
items: measures,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
localIdentifier: BucketNames.ATTRIBUTE,
|
|
79
|
+
items: rowAttributes,
|
|
80
|
+
// This is needed because at the beginning totals property is
|
|
81
|
+
// missing from buckets. If we would pass empty array or
|
|
82
|
+
// totals: undefined, reference points would differ.
|
|
83
|
+
...(rowTotals.length > 0 ? { totals: rowTotals } : null),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
localIdentifier: BucketNames.COLUMNS,
|
|
87
|
+
items: columnAttributes,
|
|
88
|
+
// This is needed because at the beginning totals property is
|
|
89
|
+
// missing from buckets. If we would pass empty array or
|
|
90
|
+
// totals: undefined, reference points would differ.
|
|
91
|
+
...(colTotals.length > 0 ? { totals: colTotals } : null),
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
94
|
+
const originalColumnWidths = newReferencePoint.properties?.controls?.columnWidths;
|
|
95
|
+
const originalMeasureGroupDimension = newReferencePoint.properties?.controls?.measureGroupDimension;
|
|
96
|
+
const originalSortItems = getSanitizedSortItems(newReferencePoint.properties?.sortItems, originalMeasureGroupDimension);
|
|
97
|
+
const originalColumnHeadersPosition = shouldAdjustColumnHeadersPositionToTop(newReferencePoint, rowAttributes, originalMeasureGroupDimension)
|
|
98
|
+
? "top"
|
|
99
|
+
: newReferencePoint.properties?.controls?.columnHeadersPosition;
|
|
100
|
+
const columnWidths = adaptReferencePointWidthItemsToPivotTable(originalColumnWidths, measures, rowAttributes, columnAttributes, previousRowAttributes ? previousRowAttributes : [], previousColumnAttributes ? previousColumnAttributes : [], filters, originalMeasureGroupDimension);
|
|
101
|
+
// Build controls object with conditional properties
|
|
102
|
+
const controls = {
|
|
103
|
+
...newReferencePoint.properties?.controls,
|
|
104
|
+
...(columnWidths && { columnWidths }),
|
|
105
|
+
...(originalMeasureGroupDimension && {
|
|
106
|
+
measureGroupDimension: originalMeasureGroupDimension,
|
|
107
|
+
}),
|
|
108
|
+
...(originalColumnHeadersPosition && {
|
|
109
|
+
columnHeadersPosition: originalColumnHeadersPosition,
|
|
110
|
+
}),
|
|
111
|
+
};
|
|
112
|
+
newReferencePoint.properties = {
|
|
113
|
+
sortItems: addDefaultSort(adaptReferencePointSortItemsToPivotTable(originalSortItems, measures, rowAttributes, columnAttributes), filters, rowAttributes, previousRowAttributes, columnAttributes),
|
|
114
|
+
controls,
|
|
115
|
+
};
|
|
116
|
+
setPivotTableNextUiConfig(newReferencePoint, this.intl, VisualizationTypes.TABLE, this.settings);
|
|
117
|
+
configurePercent(newReferencePoint, false);
|
|
118
|
+
configureOverTimeComparison(newReferencePoint, !!this.settings?.["enableWeekFilters"]);
|
|
119
|
+
Object.assign(newReferencePoint, getReferencePointWithSupportedProperties(newReferencePoint, this.supportedPropertiesList));
|
|
120
|
+
return Promise.resolve(sanitizeFilters(newReferencePoint));
|
|
121
|
+
}
|
|
122
|
+
getInsightWithDrillDownApplied(sourceVisualization, drillDownContext, backendSupportsElementUris) {
|
|
123
|
+
const drillDownInsight = modifyBucketsAttributesForDrillDown(sourceVisualization, drillDownContext.drillDefinition);
|
|
124
|
+
const drillDownInsightWithFilters = addIntersectionFiltersToInsight(drillDownInsight, drillDownContext.event.drillContext.intersection, backendSupportsElementUris, this.settings?.enableDuplicatedLabelValuesInAttributeFilter);
|
|
125
|
+
return sanitizeTableProperties(insightSanitize(drillDownInsightWithFilters));
|
|
126
|
+
}
|
|
127
|
+
getSanitizedConfig(insight, customVisualizationConfig) {
|
|
128
|
+
return sanitizePivotTableConfig(insight, customVisualizationConfig, this.settings);
|
|
129
|
+
}
|
|
130
|
+
getExecution(options, insight, executionFactory) {
|
|
131
|
+
const { dateFormat, executionConfig, customVisualizationConfig } = options;
|
|
132
|
+
const sanitizedConfig = this.getSanitizedConfig(insight, customVisualizationConfig);
|
|
133
|
+
return executionFactory
|
|
134
|
+
.forInsight(insight)
|
|
135
|
+
.withDimensions(...this.getDimensions(insight, sanitizedConfig))
|
|
136
|
+
.withSorting(...(getPivotTableSortItems(insight) ?? []))
|
|
137
|
+
.withDateFormat(dateFormat)
|
|
138
|
+
.withExecConfig(executionConfig);
|
|
139
|
+
}
|
|
140
|
+
initializeProperties(visualizationProperties) {
|
|
141
|
+
const controls = visualizationProperties?.controls;
|
|
142
|
+
const supportedProperties = getSupportedPropertiesControls(controls, this.supportedPropertiesList);
|
|
143
|
+
const initialProperties = {
|
|
144
|
+
supportedProperties: { controls: supportedProperties },
|
|
145
|
+
};
|
|
146
|
+
this.pushData({
|
|
147
|
+
initialProperties,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
createCorePivotTableProps = () => {
|
|
151
|
+
return {
|
|
152
|
+
intl: this.intl,
|
|
153
|
+
ErrorComponent: null,
|
|
154
|
+
LoadingComponent: null,
|
|
155
|
+
onDrill: this.onDrill,
|
|
156
|
+
afterRender: this.afterRender,
|
|
157
|
+
onLoadingChanged: this.onLoadingChanged,
|
|
158
|
+
pushData: this.handlePushData,
|
|
159
|
+
onError: this.onError,
|
|
160
|
+
onExportReady: this.onExportReady,
|
|
161
|
+
onDataView: this.onDataView,
|
|
162
|
+
onColumnResized: this.onColumnResized,
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
updateInstanceProperties(options, insight,
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
167
|
+
insightPropertiesMeta) {
|
|
168
|
+
super.updateInstanceProperties(options, insight, insightPropertiesMeta);
|
|
169
|
+
/*
|
|
170
|
+
* This was ported from v7. For some reason (likely related KD interop?) the entire content of properties
|
|
171
|
+
* would be picked up and used.
|
|
172
|
+
*/
|
|
173
|
+
this.visualizationProperties = insightProperties(insight);
|
|
174
|
+
this.adaptPropertiesToInsight(this.visualizationProperties, this.currentInsight);
|
|
175
|
+
}
|
|
176
|
+
renderVisualization(options, insight, executionFactory) {
|
|
177
|
+
if (!insightHasDataDefined(insight)) {
|
|
178
|
+
// there is nothing in the insight's bucket that can be visualized
|
|
179
|
+
// bail out
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const { customVisualizationConfig = {}, theme } = options;
|
|
183
|
+
const execution = this.getExecution(options, insight, executionFactory);
|
|
184
|
+
// Extract bucket data to send down the pivot table
|
|
185
|
+
const measuresBucket = insightBucket(insight, BucketNames.MEASURES);
|
|
186
|
+
const rowsBucket = insightBucket(insight, BucketNames.ATTRIBUTE);
|
|
187
|
+
const columnsBucket = insightBucket(insight, BucketNames.COLUMNS);
|
|
188
|
+
const measures = measuresBucket ? bucketMeasures(measuresBucket) : [];
|
|
189
|
+
const rows = rowsBucket ? bucketAttributes(rowsBucket) : [];
|
|
190
|
+
const columns = columnsBucket ? bucketAttributes(columnsBucket) : [];
|
|
191
|
+
const filters = insightFilters(insight) || [];
|
|
192
|
+
const sortBy = getPivotTableSortItems(insight);
|
|
193
|
+
const measureGroupDimension = getMeasureGroupDimensionFromProperties(insightProperties(insight)) || "columns";
|
|
194
|
+
const columnHeadersPosition = !isSetColumnHeadersPositionToLeftAllowed(insight)
|
|
195
|
+
? "top"
|
|
196
|
+
: getColumnHeadersPositionFromProperties(insightProperties(insight));
|
|
197
|
+
const tableConfig = {
|
|
198
|
+
...customVisualizationConfig,
|
|
199
|
+
measureGroupDimension,
|
|
200
|
+
columnHeadersPosition,
|
|
201
|
+
};
|
|
202
|
+
const pivotTableProps = {
|
|
203
|
+
...this.createCorePivotTableProps(),
|
|
204
|
+
execution,
|
|
205
|
+
measures,
|
|
206
|
+
rows,
|
|
207
|
+
columns,
|
|
208
|
+
filters,
|
|
209
|
+
sortBy,
|
|
210
|
+
config: tableConfig,
|
|
211
|
+
theme,
|
|
212
|
+
};
|
|
213
|
+
this.renderFun(React.createElement(CorePivotTableNext, { ...pivotTableProps }), this.getElement());
|
|
214
|
+
}
|
|
215
|
+
renderConfigurationPanel(insight, options) {
|
|
216
|
+
const configPanelElement = this.getConfigPanelElement();
|
|
217
|
+
if (configPanelElement) {
|
|
218
|
+
const properties = this.visualizationProperties ?? {};
|
|
219
|
+
// we need to handle cases when attribute previously bearing the default sort is no longer available
|
|
220
|
+
// and when measure sort is present but table is transposed
|
|
221
|
+
const sanitizedProperties = properties.sortItems
|
|
222
|
+
? {
|
|
223
|
+
...properties,
|
|
224
|
+
sortItems: sanitizePivotTableSorts(properties.sortItems, insightBuckets(insight), getMeasureGroupDimensionFromProperties(properties)),
|
|
225
|
+
}
|
|
226
|
+
: properties;
|
|
227
|
+
const panelConfig = {
|
|
228
|
+
supportsAttributeHierarchies: this.backendCapabilities.supportsAttributeHierarchies,
|
|
229
|
+
};
|
|
230
|
+
this.renderFun(React.createElement(PivotTableConfigurationPanel, { locale: this.locale, properties: sanitizedProperties, propertiesMeta: this.propertiesMeta, insight: insight, pushData: this.handlePushData, isError: this.getIsError(), isLoading: this.isLoading, featureFlags: this.settings, panelConfig: panelConfig, configurationPanelRenderers: options.custom?.configurationPanelRenderers }), configPanelElement);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
getDimensions(insight, customVisualizationConfig) {
|
|
234
|
+
return generateDimensions(insight, VisualizationTypes.TABLE, customVisualizationConfig);
|
|
235
|
+
}
|
|
236
|
+
adaptPropertiesToInsight(visualizationProperties, insight) {
|
|
237
|
+
const measureGroupDimension = getMeasureGroupDimensionFromProperties(visualizationProperties);
|
|
238
|
+
// This is sanitization of properties from KD vs current mdObject from AD
|
|
239
|
+
const columnWidths = getColumnWidthsFromProperties(visualizationProperties);
|
|
240
|
+
if (columnWidths) {
|
|
241
|
+
this.sanitizeColumnWidths(columnWidths, insight, visualizationProperties, measureGroupDimension);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
sanitizeColumnWidths(columnWidths, insight, visualizationProperties, measureGroupDimension) {
|
|
245
|
+
if (isEmpty(insightBuckets(insight))) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const adaptedColumnWidths = adaptMdObjectWidthItemsToPivotTable(columnWidths, insight, measureGroupDimension);
|
|
249
|
+
if (!isEqual(columnWidths, adaptedColumnWidths)) {
|
|
250
|
+
this.visualizationProperties.controls.columnWidths = adaptedColumnWidths;
|
|
251
|
+
this.pushData({
|
|
252
|
+
properties: {
|
|
253
|
+
controls: {
|
|
254
|
+
columnWidths: adaptedColumnWidths,
|
|
255
|
+
...getPivotTableProperties(this.settings, visualizationProperties),
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
onColumnResized(columnWidths) {
|
|
262
|
+
const properties = this.visualizationProperties ?? {};
|
|
263
|
+
this.pushData({
|
|
264
|
+
properties: {
|
|
265
|
+
controls: {
|
|
266
|
+
columnWidths,
|
|
267
|
+
...getPivotTableProperties(this.settings, properties),
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
handlePushData(data) {
|
|
273
|
+
if (data?.properties?.sortItems) {
|
|
274
|
+
// Handle sort items with optional totals
|
|
275
|
+
const properties = {
|
|
276
|
+
sortItems: data.properties.sortItems,
|
|
277
|
+
...(data.properties.controls && { controls: data.properties.controls }),
|
|
278
|
+
...(data.properties.totals && {
|
|
279
|
+
totals: data.properties.totals,
|
|
280
|
+
bucketType: data.properties.bucketType,
|
|
281
|
+
}),
|
|
282
|
+
};
|
|
283
|
+
this.pushData({ properties });
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
this.pushData(data);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=PluggablePivotTableNext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluggablePivotTableNext.js","sourceRoot":"","sources":["../../../../../src/internal/components/pluggableVisualizations/pivotTableNext/PluggablePivotTableNext.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACH,gBAAgB,EAChB,cAAc,EAId,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,eAAe,GAGlB,M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Q,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACvE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI;oBAC1B,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;oBAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU;iBACzC,CAAC;aACL,CAAC;YAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IInsightDefinition, ISettings } from "@gooddata/sdk-model";
|
|
2
|
+
/**
|
|
3
|
+
* Sanitizes pivot table configuration by ensuring measureGroupDimension is valid
|
|
4
|
+
* when table transposition is disabled.
|
|
5
|
+
*
|
|
6
|
+
* @param insight - The insight definition
|
|
7
|
+
* @param customVisualizationConfig - Custom visualization configuration
|
|
8
|
+
* @param settings - Feature flags and settings
|
|
9
|
+
* @returns Sanitized configuration
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function sanitizePivotTableConfig(insight: IInsightDefinition, customVisualizationConfig: any, settings: ISettings): any;
|
|
14
|
+
//# sourceMappingURL=configHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configHelpers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/pluggableVisualizations/pivotTableNext/configHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAqB,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGvF;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,yBAAyB,EAAE,GAAG,EAC9B,QAAQ,EAAE,SAAS,GACpB,GAAG,CAgBL"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { insightProperties } from "@gooddata/sdk-model";
|
|
3
|
+
import { getMeasureGroupDimensionFromProperties } from "../../../utils/propertiesHelper.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sanitizes pivot table configuration by ensuring measureGroupDimension is valid
|
|
6
|
+
* when table transposition is disabled.
|
|
7
|
+
*
|
|
8
|
+
* @param insight - The insight definition
|
|
9
|
+
* @param customVisualizationConfig - Custom visualization configuration
|
|
10
|
+
* @param settings - Feature flags and settings
|
|
11
|
+
* @returns Sanitized configuration
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export function sanitizePivotTableConfig(insight, customVisualizationConfig, settings) {
|
|
16
|
+
const tableTranspositionEnabled = settings.enableTableTransposition;
|
|
17
|
+
if (!tableTranspositionEnabled &&
|
|
18
|
+
(customVisualizationConfig?.measureGroupDimension === "rows" ||
|
|
19
|
+
getMeasureGroupDimensionFromProperties(insightProperties(insight)) === "rows")) {
|
|
20
|
+
// override custom position to default when FF disabled in meantime
|
|
21
|
+
return {
|
|
22
|
+
...(customVisualizationConfig || {}),
|
|
23
|
+
measureGroupDimension: "columns",
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return customVisualizationConfig;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=configHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configHelpers.js","sourceRoot":"","sources":["../../../../../src/internal/components/pluggableVisualizations/pivotTableNext/configHelpers.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAsB,iBAAiB,EAAa,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,sCAAsC,EAAE,MAAM,oCAAoC,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wBAAwB,CACpC,OAA2B,EAC3B,yBAA8B,EAC9B,QAAmB;IAEnB,MAAM,yBAAyB,GAAG,QAAQ,CAAC,wBAAwB,CAAC;IAEpE,IACI,CAAC,yBAAyB;QAC1B,CAAC,yBAAyB,EAAE,qBAAqB,KAAK,MAAM;YACxD,sCAAsC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,KAAK,MAAM,CAAC,EACpF,CAAC;QACC,mEAAmE;QACnE,OAAO;YACH,GAAG,CAAC,yBAAyB,IAAI,EAAE,CAAC;YACpC,qBAAqB,EAAE,SAAS;SACnC,CAAC;IACN,CAAC;IAED,OAAO,yBAAyB,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MeasureGroupDimension } from "@gooddata/sdk-ui-pivot";
|
|
2
|
+
import { IBucketItem, IBucketOfFun, IExtendedReferencePoint } from "../../../interfaces/Visualization.js";
|
|
3
|
+
export declare const shouldAdjustColumnHeadersPositionToTop: (newReferencePoint: IExtendedReferencePoint, rowAttributes: IBucketItem[], measureGroupDimension: MeasureGroupDimension) => boolean;
|
|
4
|
+
export declare const getColumnAttributes: (buckets: IBucketOfFun[]) => IBucketItem[];
|
|
5
|
+
export declare const getRowAttributes: (buckets: IBucketOfFun[]) => IBucketItem[];
|
|
6
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/pluggableVisualizations/pivotTableNext/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAI1G,eAAO,MAAM,sCAAsC,GAC/C,mBAAmB,uBAAuB,EAC1C,eAAe,WAAW,EAAE,EAC5B,uBAAuB,qBAAqB,KAC7C,OAKF,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,YAAY,EAAE,KAAG,WAAW,EAMxE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,SAAS,YAAY,EAAE,KAAG,WAAW,EAcrE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { BucketNames } from "@gooddata/sdk-ui";
|
|
3
|
+
import { ATTRIBUTE, DATE } from "../../../constants/bucket.js";
|
|
4
|
+
import { getItemsFromBuckets } from "../../../utils/bucketHelper.js";
|
|
5
|
+
export const shouldAdjustColumnHeadersPositionToTop = (newReferencePoint, rowAttributes, measureGroupDimension) => {
|
|
6
|
+
return (newReferencePoint.properties?.controls?.columnHeadersPosition &&
|
|
7
|
+
(rowAttributes.length > 0 || measureGroupDimension === "columns"));
|
|
8
|
+
};
|
|
9
|
+
export const getColumnAttributes = (buckets) => {
|
|
10
|
+
return getItemsFromBuckets(buckets, [BucketNames.COLUMNS, BucketNames.STACK, BucketNames.SEGMENT], [ATTRIBUTE, DATE]);
|
|
11
|
+
};
|
|
12
|
+
export const getRowAttributes = (buckets) => {
|
|
13
|
+
return getItemsFromBuckets(buckets, [
|
|
14
|
+
BucketNames.ATTRIBUTE,
|
|
15
|
+
BucketNames.ATTRIBUTES,
|
|
16
|
+
BucketNames.ATTRIBUTE_FROM,
|
|
17
|
+
BucketNames.ATTRIBUTE_TO,
|
|
18
|
+
BucketNames.VIEW,
|
|
19
|
+
BucketNames.TREND,
|
|
20
|
+
BucketNames.LOCATION,
|
|
21
|
+
], [ATTRIBUTE, DATE]);
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../src/internal/components/pluggableVisualizations/pivotTableNext/helpers.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAClD,iBAA0C,EAC1C,aAA4B,EAC5B,qBAA4C,EACrC,EAAE;IACT,OAAO,CACH,iBAAiB,CAAC,UAAU,EAAE,QAAQ,EAAE,qBAAqB;QAC7D,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,qBAAqB,KAAK,SAAS,CAAC,CACpE,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAuB,EAAiB,EAAE;IAC1E,OAAO,mBAAmB,CACtB,OAAO,EACP,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,EAC7D,CAAC,SAAS,EAAE,IAAI,CAAC,CACpB,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAuB,EAAiB,EAAE;IACvE,OAAO,mBAAmB,CACtB,OAAO,EACP;QACI,WAAW,CAAC,SAAS;QACrB,WAAW,CAAC,UAAU;QACtB,WAAW,CAAC,cAAc;QAC1B,WAAW,CAAC,YAAY;QACxB,WAAW,CAAC,IAAI;QAChB,WAAW,CAAC,KAAK;QACjB,WAAW,CAAC,QAAQ;KACvB,EACD,CAAC,SAAS,EAAE,IAAI,CAAC,CACpB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IInsightDefinition } from "@gooddata/sdk-model";
|
|
2
|
+
import { PivotTableNextConfig } from "@gooddata/sdk-ui-pivot/next";
|
|
3
|
+
export declare function pivotTableNextConfigFromInsight(insight: IInsightDefinition): PivotTableNextConfig;
|
|
4
|
+
//# sourceMappingURL=pivotTableNextConfigFromInsight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pivotTableNextConfigFromInsight.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/pluggableVisualizations/pivotTableNext/pivotTableNextConfigFromInsight.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,kBAAkB,GAAG,oBAAoB,CAUjG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { insightProperties } from "@gooddata/sdk-model";
|
|
3
|
+
import isEmpty from "lodash/isEmpty.js";
|
|
4
|
+
export function pivotTableNextConfigFromInsight(insight) {
|
|
5
|
+
const measureGroupDimension = insightProperties(insight)?.controls?.measureGroupDimension;
|
|
6
|
+
const metricsPositionProp = !isEmpty(measureGroupDimension) ? { measureGroupDimension } : {};
|
|
7
|
+
const columnHeadersPosition = insightProperties(insight)?.controls?.columnHeadersPosition;
|
|
8
|
+
const columnHeadersPositionProp = !isEmpty(columnHeadersPosition) ? { columnHeadersPosition } : {};
|
|
9
|
+
return {
|
|
10
|
+
...metricsPositionProp,
|
|
11
|
+
...columnHeadersPositionProp,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=pivotTableNextConfigFromInsight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pivotTableNextConfigFromInsight.js","sourceRoot":"","sources":["../../../../../src/internal/components/pluggableVisualizations/pivotTableNext/pivotTableNextConfigFromInsight.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAsB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAExC,MAAM,UAAU,+BAA+B,CAAC,OAA2B;IACvE,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,qBAAqB,CAAC;IAC1F,MAAM,mBAAmB,GAAG,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,qBAAqB,CAAC;IAC1F,MAAM,yBAAyB,GAAG,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnG,OAAO;QACH,GAAG,mBAAmB;QACtB,GAAG,yBAAyB;KAC/B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IBucket, IInsightDefinition, ISortItem } from "@gooddata/sdk-model";
|
|
2
|
+
import { MeasureGroupDimension } from "@gooddata/sdk-ui-pivot";
|
|
3
|
+
import { IBucketFilter, IBucketItem } from "../../../interfaces/Visualization.js";
|
|
4
|
+
export declare const adaptReferencePointSortItemsToPivotTable: (originalSortItems: ISortItem[], measures: IBucketItem[], rowAttributes: IBucketItem[], columnAttributes: IBucketItem[]) => ISortItem[];
|
|
5
|
+
export declare const addDefaultSort: (sortItems: ISortItem[], filters: IBucketFilter[], rowAttributes: IBucketItem[], previousRowAttributes: IBucketItem[], columnAttributes?: IBucketItem[]) => ISortItem[];
|
|
6
|
+
export declare const isSortItemVisible: (sortItem: ISortItem, filters: IBucketFilter[], columnAttributes: IBucketItem[]) => boolean;
|
|
7
|
+
export declare const getSanitizedSortItems: (sortItems: ISortItem[], measureGroupDimension: MeasureGroupDimension) => ISortItem[];
|
|
8
|
+
/**
|
|
9
|
+
* This function exists to overcome AD weirdness where AD will sometimes send insight without any
|
|
10
|
+
* sorts even if the pivot table should be sorted by default by the first row attribute in ascending order. Code here
|
|
11
|
+
* fixes this symptom and ensures the default sort is in place.
|
|
12
|
+
*
|
|
13
|
+
* Note: while this may seem small thing, it's actually a messy business. When rendering / switching to the pivot
|
|
14
|
+
* table the AD will call update/render multiple times. Sometimes with sort items, sometimes without sort items. This
|
|
15
|
+
* can seriously mess up the pivot table in return: the column resizing is susceptible to race conditions and timing
|
|
16
|
+
* issues. Because of the flurry of calls, the table may not render or may render not resized at all.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getPivotTableSortItems: (insight: IInsightDefinition) => ISortItem[];
|
|
19
|
+
export declare const sanitizePivotTableSorts: (originalSortItems: ISortItem[], buckets: IBucket[], measureGroupDimension: MeasureGroupDimension) => ISortItem[];
|
|
20
|
+
//# sourceMappingURL=sortHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortHelpers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/pluggableVisualizations/pivotTableNext/sortHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAQH,OAAO,EACP,kBAAkB,EAUlB,SAAS,EAGZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAoB,aAAa,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAIpG,eAAO,MAAM,wCAAwC,GACjD,mBAAmB,SAAS,EAAE,EAC9B,UAAU,WAAW,EAAE,EACvB,eAAe,WAAW,EAAE,EAC5B,kBAAkB,WAAW,EAAE,KAChC,SAAS,EAaX,CAAC;AAqEF,eAAO,MAAM,cAAc,GACvB,WAAW,SAAS,EAAE,EACtB,SAAS,aAAa,EAAE,EACxB,eAAe,WAAW,EAAE,EAC5B,uBAAuB,WAAW,EAAE,EACpC,mBAAkB,WAAW,EAAO,KACrC,SAAS,EAsCX,CAAC;AAmCF,eAAO,MAAM,iBAAiB,GAC1B,UAAU,SAAS,EACnB,SAAS,aAAa,EAAE,EACxB,kBAAkB,WAAW,EAAE,KAChC,OAGoE,CAAC;AAExE,eAAO,MAAM,qBAAqB,GAC9B,WAAW,SAAS,EAAE,EACtB,uBAAuB,qBAAqB,KAC7C,SAAS,EAOX,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,kBAAkB,KAAG,SAAS,EAyB7E,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAChC,mBAAmB,SAAS,EAAE,EAC9B,SAAS,OAAO,EAAE,EAClB,uBAAuB,qBAAqB,KAC7C,SAAS,EAmBX,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { areObjRefsEqual, attributeLocalId, bucketAttribute, bucketAttributes, bucketsFind, bucketsMeasures, insightBucket, insightBuckets, insightProperties, insightSorts, isAttributeLocator, isAttributeSort, isMeasureLocator, isMeasureSort, measureLocalId, newAttributeSort, } from "@gooddata/sdk-model";
|
|
3
|
+
import { BucketNames } from "@gooddata/sdk-ui";
|
|
4
|
+
import isEmpty from "lodash/isEmpty.js";
|
|
5
|
+
import includes from "lodash/includes.js";
|
|
6
|
+
import { isAttributeFilter } from "../../../utils/bucketHelper.js";
|
|
7
|
+
import { getMeasureGroupDimensionFromProperties } from "../../../utils/propertiesHelper.js";
|
|
8
|
+
export const adaptReferencePointSortItemsToPivotTable = (originalSortItems, measures, rowAttributes, columnAttributes) => {
|
|
9
|
+
const measureLocalIdentifiers = measures.map((measure) => measure.localIdentifier);
|
|
10
|
+
const rowAttributeLocalIdentifiers = rowAttributes.map((rowAttribute) => rowAttribute.localIdentifier);
|
|
11
|
+
const columnAttributeLocalIdentifiers = columnAttributes.map((columnAttribute) => columnAttribute.localIdentifier);
|
|
12
|
+
return filterInvalidSortItems(originalSortItems, measureLocalIdentifiers, rowAttributeLocalIdentifiers, columnAttributeLocalIdentifiers);
|
|
13
|
+
};
|
|
14
|
+
const filterInvalidSortItems = (originalSortItems, measureLocalIdentifiers, rowAttributeLocalIdentifiers, columnAttributeLocalIdentifiers) => {
|
|
15
|
+
return originalSortItems.reduce((sortItems, sortItem) => {
|
|
16
|
+
if (isMeasureSort(sortItem)) {
|
|
17
|
+
// filter out invalid locators
|
|
18
|
+
const filteredSortItem = {
|
|
19
|
+
measureSortItem: {
|
|
20
|
+
...sortItem.measureSortItem,
|
|
21
|
+
locators: sortItem.measureSortItem.locators.filter((locator) => {
|
|
22
|
+
// filter out invalid measure locators
|
|
23
|
+
if (isMeasureLocator(locator)) {
|
|
24
|
+
return includes(measureLocalIdentifiers, locator.measureLocatorItem.measureIdentifier);
|
|
25
|
+
}
|
|
26
|
+
// filter out invalid column attribute locators
|
|
27
|
+
if (isAttributeLocator(locator)) {
|
|
28
|
+
return includes(columnAttributeLocalIdentifiers, locator.attributeLocatorItem.attributeIdentifier);
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
// keep sortItem if measureLocator is present and locators are correct length
|
|
35
|
+
if (filteredSortItem.measureSortItem.locators.some((locator) => isMeasureLocator(locator)) &&
|
|
36
|
+
filteredSortItem.measureSortItem.locators.length ===
|
|
37
|
+
columnAttributeLocalIdentifiers.length + 1) {
|
|
38
|
+
sortItems.push(filteredSortItem);
|
|
39
|
+
}
|
|
40
|
+
// otherwise just carry over previous sortItems
|
|
41
|
+
return sortItems;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Keep only row attribute sorts, column sorts are not supported.
|
|
45
|
+
*
|
|
46
|
+
* This exists to overcome AD weirdness where AD will sometimes send insight with invalid sorts
|
|
47
|
+
* even if the pivot table should NOT be sorted by default by the first row attribute in ascending order since it has no row attributes.
|
|
48
|
+
* Code here fixes this symptom and ensures the default sort is in place only if relevant.
|
|
49
|
+
*
|
|
50
|
+
* Typical case is PivotTable with one measure and one row and then the user moves thee attribute from Row bucket to Column bucket.
|
|
51
|
+
* In that case AD sends insight with the irrelevant sort and then without it.
|
|
52
|
+
*
|
|
53
|
+
* Note: while this may seem small thing, it's actually a messy business. When rendering / switching to the pivot
|
|
54
|
+
* table the AD will call update/render multiple times. Sometimes with sort items, sometimes without sort items. This
|
|
55
|
+
* can seriously mess up the pivot table in return: the column resizing is susceptible to race conditions and timing
|
|
56
|
+
* issues. Because of the flurry of calls, the table may not render or load indefinitely.
|
|
57
|
+
*/
|
|
58
|
+
if (includes(rowAttributeLocalIdentifiers, sortItem.attributeSortItem.attributeIdentifier)) {
|
|
59
|
+
return [...sortItems, sortItem];
|
|
60
|
+
}
|
|
61
|
+
return sortItems;
|
|
62
|
+
}, []);
|
|
63
|
+
};
|
|
64
|
+
export const addDefaultSort = (sortItems, filters, rowAttributes, previousRowAttributes, columnAttributes = []) => {
|
|
65
|
+
// cannot construct default sort without a row
|
|
66
|
+
if (rowAttributes.length < 1) {
|
|
67
|
+
return sortItems;
|
|
68
|
+
}
|
|
69
|
+
// detect custom sort
|
|
70
|
+
const firstRow = rowAttributes[0];
|
|
71
|
+
const previousFirstRow = previousRowAttributes?.[0];
|
|
72
|
+
const hasVisibleCustomSort = sortItems.some((sortItem) => {
|
|
73
|
+
if (!isSortItemVisible(sortItem, filters, columnAttributes)) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
// non attribute sort is definitely custom
|
|
77
|
+
if (!isAttributeSort(sortItem)) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
// asc sort on first row is considered default
|
|
81
|
+
if (sortItem.attributeSortItem.attributeIdentifier === firstRow.localIdentifier &&
|
|
82
|
+
sortItem.attributeSortItem.direction === "asc") {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
// asc sort on row that was first until now is considered default as well
|
|
86
|
+
// disabling the eslint rule to maintain readability
|
|
87
|
+
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
88
|
+
if (previousFirstRow &&
|
|
89
|
+
sortItem.attributeSortItem.attributeIdentifier === previousFirstRow.localIdentifier &&
|
|
90
|
+
sortItem.attributeSortItem.direction === "asc") {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
});
|
|
95
|
+
return hasVisibleCustomSort ? sortItems : [newAttributeSort(firstRow.localIdentifier, "asc")];
|
|
96
|
+
};
|
|
97
|
+
const isAttributeSortItemVisible = (_sortItem, _filters) => true;
|
|
98
|
+
const isMeasureSortItemMatchedByFilter = (sortItem, filter) => {
|
|
99
|
+
return filter.selectedElements
|
|
100
|
+
? filter.selectedElements.some((selectedElement) => sortItem.measureSortItem.locators.some((locator) => isAttributeLocator(locator) &&
|
|
101
|
+
locator.attributeLocatorItem.element === selectedElement.uri))
|
|
102
|
+
: false;
|
|
103
|
+
};
|
|
104
|
+
const isMeasureSortItemVisible = (sortItem, filters, columnAttributes) => {
|
|
105
|
+
return filters
|
|
106
|
+
.filter(isAttributeFilter)
|
|
107
|
+
.filter((filter) => columnAttributes.some((columnBucketItem) => areObjRefsEqual(columnBucketItem.dfRef, filter.displayFormRef)))
|
|
108
|
+
.every((filter) => {
|
|
109
|
+
const shouldBeMatched = !filter.isInverted;
|
|
110
|
+
return shouldBeMatched === isMeasureSortItemMatchedByFilter(sortItem, filter);
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
export const isSortItemVisible = (sortItem, filters, columnAttributes) => isAttributeSort(sortItem)
|
|
114
|
+
? isAttributeSortItemVisible(sortItem, filters)
|
|
115
|
+
: isMeasureSortItemVisible(sortItem, filters, columnAttributes);
|
|
116
|
+
export const getSanitizedSortItems = (sortItems, measureGroupDimension) => {
|
|
117
|
+
// Measure sort is not supported on transposed table (metrics in rows).
|
|
118
|
+
if (measureGroupDimension === "rows") {
|
|
119
|
+
return sortItems ? sortItems.filter((sortItem) => !isMeasureSort(sortItem)) : [];
|
|
120
|
+
}
|
|
121
|
+
return sortItems ?? [];
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* This function exists to overcome AD weirdness where AD will sometimes send insight without any
|
|
125
|
+
* sorts even if the pivot table should be sorted by default by the first row attribute in ascending order. Code here
|
|
126
|
+
* fixes this symptom and ensures the default sort is in place.
|
|
127
|
+
*
|
|
128
|
+
* Note: while this may seem small thing, it's actually a messy business. When rendering / switching to the pivot
|
|
129
|
+
* table the AD will call update/render multiple times. Sometimes with sort items, sometimes without sort items. This
|
|
130
|
+
* can seriously mess up the pivot table in return: the column resizing is susceptible to race conditions and timing
|
|
131
|
+
* issues. Because of the flurry of calls, the table may not render or may render not resized at all.
|
|
132
|
+
*/
|
|
133
|
+
export const getPivotTableSortItems = (insight) => {
|
|
134
|
+
const sorts = insightSorts(insight);
|
|
135
|
+
const mesureGroupDimension = getMeasureGroupDimensionFromProperties(insightProperties(insight));
|
|
136
|
+
if (!isEmpty(sorts)) {
|
|
137
|
+
/*
|
|
138
|
+
* This is here to ensure that when rendering pivot table in KD, all invalid sort items
|
|
139
|
+
* are filtered out. At this moment, core pivot table does not handle invalid sorts so well and
|
|
140
|
+
* they can knock it off balance and it won't show up (interplay with resizing).
|
|
141
|
+
*
|
|
142
|
+
* Fixing core pivot to strip out invalid sorts has to happen one day - however regardless of that,
|
|
143
|
+
* it is still the responsibility of the PluggablePivotTable to call the CorePivot correctly and so this
|
|
144
|
+
* sanitization here also makes sense.
|
|
145
|
+
*/
|
|
146
|
+
return sanitizePivotTableSorts(sorts, insightBuckets(insight), mesureGroupDimension);
|
|
147
|
+
}
|
|
148
|
+
const rowBucket = insightBucket(insight, BucketNames.ATTRIBUTE);
|
|
149
|
+
const rowAttribute = rowBucket && bucketAttribute(rowBucket);
|
|
150
|
+
if (rowAttribute) {
|
|
151
|
+
return [newAttributeSort(rowAttribute, "asc")];
|
|
152
|
+
}
|
|
153
|
+
return undefined;
|
|
154
|
+
};
|
|
155
|
+
export const sanitizePivotTableSorts = (originalSortItems, buckets, measureGroupDimension) => {
|
|
156
|
+
const sanitizedOriginalSortItems = getSanitizedSortItems(originalSortItems, measureGroupDimension);
|
|
157
|
+
const measureLocalIdentifiers = bucketsMeasures(buckets).map(measureLocalId);
|
|
158
|
+
const rowBucket = bucketsFind(buckets, BucketNames.ATTRIBUTE);
|
|
159
|
+
const rowAttributeLocalIdentifiers = rowBucket ? bucketAttributes(rowBucket).map(attributeLocalId) : [];
|
|
160
|
+
const columnBucket = bucketsFind(buckets, BucketNames.COLUMNS);
|
|
161
|
+
const columnAttributeLocalIdentifiers = columnBucket
|
|
162
|
+
? bucketAttributes(columnBucket).map(attributeLocalId)
|
|
163
|
+
: [];
|
|
164
|
+
return filterInvalidSortItems(sanitizedOriginalSortItems, measureLocalIdentifiers, rowAttributeLocalIdentifiers, columnAttributeLocalIdentifiers);
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=sortHelpers.js.map
|