@gooddata/sdk-ui-pivot 11.54.0-alpha.5 → 11.54.0-alpha.7

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.
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Shared stand-in for `ag-grid-react`.
3
+ *
4
+ * The test suite runs without isolation, so the module graph is shared between test files. Every file
5
+ * that needs `ag-grid-react` replaced must therefore mock it with this very module - the mock of the file
6
+ * that happens to load `PivotTableNext` first is the one baked into the shared graph, so all of them have
7
+ * to be interchangeable:
8
+ *
9
+ * ```ts
10
+ * vi.mock("ag-grid-react", () => import("../testUtils/agGridReactMock.fixture.js"));
11
+ * ```
12
+ */
13
+ /**
14
+ * Test id of the element rendered instead of the real grid.
15
+ */
16
+ export declare const AG_GRID_MOCK_TEST_ID = "ag-grid-react";
17
+ /**
18
+ * The subset of the grid props the tests assert on; the rest is captured as-is.
19
+ */
20
+ export interface IAgGridReactMockProps {
21
+ serverSideDatasource?: unknown;
22
+ [prop: string]: unknown;
23
+ }
24
+ /**
25
+ * Props of every render of the mocked grid, in render order. Reset it in `beforeEach`, module state
26
+ * outlives a single test file in a non-isolated run.
27
+ */
28
+ export declare const capturedAgGridProps: IAgGridReactMockProps[];
29
+ /**
30
+ * Drop-in replacement for the real `AgGridReact` component.
31
+ */
32
+ export declare function AgGridReact(props: IAgGridReactMockProps): import("react/jsx-runtime").JSX.Element;
33
+ /**
34
+ * Forgets all props captured so far.
35
+ */
36
+ export declare function resetCapturedAgGridProps(): void;
37
+ //# sourceMappingURL=agGridReactMock.fixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agGridReactMock.fixture.d.ts","sourceRoot":"","sources":["../../src/testUtils/agGridReactMock.fixture.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,qBAAqB,EAAO,CAAC;AAE/D;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,qBAAqB,2CAIvD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,SAEvC"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2026 GoodData Corporation
3
+ /**
4
+ * Shared stand-in for `ag-grid-react`.
5
+ *
6
+ * The test suite runs without isolation, so the module graph is shared between test files. Every file
7
+ * that needs `ag-grid-react` replaced must therefore mock it with this very module - the mock of the file
8
+ * that happens to load `PivotTableNext` first is the one baked into the shared graph, so all of them have
9
+ * to be interchangeable:
10
+ *
11
+ * ```ts
12
+ * vi.mock("ag-grid-react", () => import("../testUtils/agGridReactMock.fixture.js"));
13
+ * ```
14
+ */
15
+ /**
16
+ * Test id of the element rendered instead of the real grid.
17
+ */
18
+ export const AG_GRID_MOCK_TEST_ID = "ag-grid-react";
19
+ /**
20
+ * Props of every render of the mocked grid, in render order. Reset it in `beforeEach`, module state
21
+ * outlives a single test file in a non-isolated run.
22
+ */
23
+ export const capturedAgGridProps = [];
24
+ /**
25
+ * Drop-in replacement for the real `AgGridReact` component.
26
+ */
27
+ export function AgGridReact(props) {
28
+ capturedAgGridProps.push(props);
29
+ return _jsx("div", { "data-testid": AG_GRID_MOCK_TEST_ID });
30
+ }
31
+ /**
32
+ * Forgets all props captured so far.
33
+ */
34
+ export function resetCapturedAgGridProps() {
35
+ capturedAgGridProps.length = 0;
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-pivot",
3
- "version": "11.54.0-alpha.5",
3
+ "version": "11.54.0-alpha.7",
4
4
  "description": "GoodData.UI SDK - Pivot Table",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -42,21 +42,21 @@
42
42
  "ts-invariant": "0.10.3",
43
43
  "tslib": "2.8.1",
44
44
  "uuid": "11.1.1",
45
- "@gooddata/sdk-backend-spi": "11.54.0-alpha.5",
46
- "@gooddata/sdk-model": "11.54.0-alpha.5",
47
- "@gooddata/sdk-ui": "11.54.0-alpha.5",
48
- "@gooddata/sdk-ui-kit": "11.54.0-alpha.5",
49
- "@gooddata/sdk-ui-theme-provider": "11.54.0-alpha.5",
50
- "@gooddata/sdk-ui-vis-commons": "11.54.0-alpha.5"
45
+ "@gooddata/sdk-backend-spi": "11.54.0-alpha.7",
46
+ "@gooddata/sdk-model": "11.54.0-alpha.7",
47
+ "@gooddata/sdk-ui-kit": "11.54.0-alpha.7",
48
+ "@gooddata/sdk-ui": "11.54.0-alpha.7",
49
+ "@gooddata/sdk-ui-theme-provider": "11.54.0-alpha.7",
50
+ "@gooddata/sdk-ui-vis-commons": "11.54.0-alpha.7"
51
51
  },
52
52
  "devDependencies": {
53
- "@microsoft/api-documenter": "^7.17.0",
53
+ "@microsoft/api-documenter": "7.30.10",
54
54
  "@microsoft/api-extractor": "^7.55.2",
55
55
  "@testing-library/dom": "10.4.1",
56
56
  "@testing-library/react": "16.3.0",
57
57
  "@types/lodash-es": "^4.17.12",
58
58
  "@types/node": "24.12.0",
59
- "@types/raf": "^3.4.0",
59
+ "@types/raf": "3.4.3",
60
60
  "@types/react": "19.1.11",
61
61
  "@types/react-dom": "19.1.7",
62
62
  "@typescript-eslint/eslint-plugin": "8.58.0",
@@ -75,7 +75,7 @@
75
75
  "eslint-plugin-react": "7.37.5",
76
76
  "eslint-plugin-react-hooks": "5.2.0",
77
77
  "eslint-plugin-sonarjs": "3.0.6",
78
- "full-icu": "^1.3.0",
78
+ "full-icu": "1.6.0",
79
79
  "happy-dom": "20.9.0",
80
80
  "npm-run-all": "^4.1.5",
81
81
  "oxfmt": "0.52.0",
@@ -89,12 +89,12 @@
89
89
  "typescript": "5.9.3",
90
90
  "vitest": "4.1.8",
91
91
  "vitest-dom": "0.1.1",
92
- "@gooddata/eslint-config": "11.54.0-alpha.5",
93
- "@gooddata/oxlint-config": "11.54.0-alpha.5",
94
- "@gooddata/sdk-backend-base": "11.54.0-alpha.5",
95
- "@gooddata/reference-workspace": "11.54.0-alpha.5",
96
- "@gooddata/stylelint-config": "11.54.0-alpha.5",
97
- "@gooddata/sdk-backend-mockingbird": "11.54.0-alpha.5"
92
+ "@gooddata/eslint-config": "11.54.0-alpha.7",
93
+ "@gooddata/oxlint-config": "11.54.0-alpha.7",
94
+ "@gooddata/reference-workspace": "11.54.0-alpha.7",
95
+ "@gooddata/sdk-backend-base": "11.54.0-alpha.7",
96
+ "@gooddata/sdk-backend-mockingbird": "11.54.0-alpha.7",
97
+ "@gooddata/stylelint-config": "11.54.0-alpha.7"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "react": "^18.0.0 || ^19.0.0",
@@ -1,10 +0,0 @@
1
- import { type Column } from "ag-grid-enterprise";
2
- /**
3
- * Gets the next sort state for a column
4
- *
5
- * @param column - The AgGrid column to get the next sort state for
6
- * @returns The next sort state: "desc", "asc", or null
7
- * @internal
8
- */
9
- export declare function getNextSortState(column: Column): "desc" | "asc" | null;
10
- //# sourceMappingURL=getNextSortState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNextSortState.d.ts","sourceRoot":"","sources":["../../../../src/next/features/sorting/getNextSortState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAYtE"}
@@ -1,17 +0,0 @@
1
- // (C) 2025 GoodData Corporation
2
- /**
3
- * Gets the next sort state for a column
4
- *
5
- * @param column - The AgGrid column to get the next sort state for
6
- * @returns The next sort state: "desc", "asc", or null
7
- * @internal
8
- */
9
- export function getNextSortState(column) {
10
- const currentSort = column.getSort();
11
- const colDef = column.getColDef();
12
- const sortingOrder = colDef.sortingOrder || ["desc", "asc", null];
13
- const currentIndex = sortingOrder.findIndex((order) => order === currentSort);
14
- // Get next index (cycle back to 0 if at the end)
15
- const nextIndex = (currentIndex + 1) % sortingOrder.length;
16
- return sortingOrder[nextIndex];
17
- }
@@ -1,9 +0,0 @@
1
- import { type AgGridApi } from "../../types/agGrid.js";
2
- import { type ITextWrapping } from "../../types/textWrapping.js";
3
- /**
4
- * Hook to get default text wrapping state from ag-grid's defaultColDef.
5
- *
6
- * @internal
7
- */
8
- export declare function useGetDefaultTextWrapping(): (gridApi: AgGridApi | null, configDefaults?: ITextWrapping | undefined) => ITextWrapping;
9
- //# sourceMappingURL=useGetDefaultTextWrapping.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useGetDefaultTextWrapping.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/textWrapping/useGetDefaultTextWrapping.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,yBAAyB,6FAaxC"}
@@ -1,19 +0,0 @@
1
- // (C) 2025 GoodData Corporation
2
- import { useCallback } from "react";
3
- /**
4
- * Hook to get default text wrapping state from ag-grid's defaultColDef.
5
- *
6
- * @internal
7
- */
8
- export function useGetDefaultTextWrapping() {
9
- return useCallback((gridApi, configDefaults) => {
10
- if (!gridApi) {
11
- return configDefaults ?? { wrapHeaderText: false, wrapText: false };
12
- }
13
- const defaultColDef = gridApi.getGridOption("defaultColDef") || {};
14
- return {
15
- wrapHeaderText: !!defaultColDef.wrapHeaderText,
16
- wrapText: !!defaultColDef.wrapText,
17
- };
18
- }, []);
19
- }
@@ -1,9 +0,0 @@
1
- import { type AgGridApi } from "../../types/agGrid.js";
2
- import { type ITextWrapping } from "../../types/textWrapping.js";
3
- /**
4
- * Updates ag-grid's defaultColDef with text wrapping settings.
5
- *
6
- * @internal
7
- */
8
- export declare function useUpdateDefaultTextWrapping(): (gridApi: AgGridApi | undefined, textWrapping: ITextWrapping) => void;
9
- //# sourceMappingURL=useUpdateDefaultTextWrapping.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUpdateDefaultTextWrapping.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/textWrapping/useUpdateDefaultTextWrapping.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,4BAA4B,0EAoB3C"}
@@ -1,25 +0,0 @@
1
- // (C) 2025 GoodData Corporation
2
- import { useCallback } from "react";
3
- /**
4
- * Updates ag-grid's defaultColDef with text wrapping settings.
5
- *
6
- * @internal
7
- */
8
- export function useUpdateDefaultTextWrapping() {
9
- return useCallback((gridApi, textWrapping) => {
10
- if (!gridApi) {
11
- return;
12
- }
13
- const wrapText = !!textWrapping.wrapText;
14
- const wrapHeaderText = !!textWrapping.wrapHeaderText;
15
- const currentDefaultColDef = gridApi.getGridOption("defaultColDef") || {};
16
- const newDefaultColDef = {
17
- ...currentDefaultColDef,
18
- wrapText,
19
- wrapHeaderText,
20
- autoHeight: wrapText,
21
- autoHeaderHeight: wrapHeaderText,
22
- };
23
- gridApi.setGridOption("defaultColDef", newDefaultColDef);
24
- }, []);
25
- }
@@ -1,24 +0,0 @@
1
- import { type AgGridApi } from "../../types/agGrid.js";
2
- import { type ITextWrapping } from "../../types/textWrapping.js";
3
- /**
4
- * Manages text wrapping updates and communicates changes externally.
5
- * Updates ag-grid and keeps defaultColDef in sync; optionally communicates via pushData.
6
- *
7
- * Why both colDefs and defaultColDef must be updated (unlike column widths):
8
- * - ColumnDefs: wrapping for body cells is a per-column concern (`colDef.wrapText`). Changing just
9
- * `defaultColDef` does not affect existing columns, so cells would not react without updating current
10
- * column defs.
11
- * - DefaultColDef: header wrapping/auto height behavior depends on default column settings that the
12
- * grid reads during header layout. Only updating column defs may not propagate to header rows and
13
- * any lazily created defs. Keeping `defaultColDef` in sync ensures header behavior and future defs
14
- * are consistent.
15
- * - Column widths differ: width is managed by the grid's sizing system and column state; a single
16
- * update path is sufficient. Wrapping is a boolean style flag applied in multiple places, hence
17
- * the need for both updates here.
18
- *
19
- * @internal
20
- */
21
- export declare function useUpdateTextWrapping(): {
22
- onUpdateTextWrapping: (newTextWrapping: ITextWrapping, gridApi: AgGridApi | null) => void;
23
- };
24
- //# sourceMappingURL=useUpdateTextWrapping.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUpdateTextWrapping.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/textWrapping/useUpdateTextWrapping.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAwB,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMjE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB;;EA4DpC"}
@@ -1,74 +0,0 @@
1
- // (C) 2025-2026 GoodData Corporation
2
- import { useCallback } from "react";
3
- import { usePivotTableProps } from "../../context/PivotTablePropsContext.js";
4
- import { allowCellWrappingByColumnDefinition } from "../../features/textWrapping/allowCellWrappingByColumnDefinition.js";
5
- import { useGetAgGridColumns } from "../columns/useGetAgGridColumns.js";
6
- import { useUpdateAgGridColumnDefs } from "../columns/useUpdateAgGridColumnDefs.js";
7
- import { useUpdateDefaultTextWrapping } from "./useUpdateDefaultTextWrapping.js";
8
- /**
9
- * Manages text wrapping updates and communicates changes externally.
10
- * Updates ag-grid and keeps defaultColDef in sync; optionally communicates via pushData.
11
- *
12
- * Why both colDefs and defaultColDef must be updated (unlike column widths):
13
- * - ColumnDefs: wrapping for body cells is a per-column concern (`colDef.wrapText`). Changing just
14
- * `defaultColDef` does not affect existing columns, so cells would not react without updating current
15
- * column defs.
16
- * - DefaultColDef: header wrapping/auto height behavior depends on default column settings that the
17
- * grid reads during header layout. Only updating column defs may not propagate to header rows and
18
- * any lazily created defs. Keeping `defaultColDef` in sync ensures header behavior and future defs
19
- * are consistent.
20
- * - Column widths differ: width is managed by the grid's sizing system and column state; a single
21
- * update path is sufficient. Wrapping is a boolean style flag applied in multiple places, hence
22
- * the need for both updates here.
23
- *
24
- * @internal
25
- */
26
- export function useUpdateTextWrapping() {
27
- const { pushData } = usePivotTableProps();
28
- const updateAgGridColumnDefs = useUpdateAgGridColumnDefs();
29
- const updateDefaultTextWrapping = useUpdateDefaultTextWrapping();
30
- const getAgGridColumns = useGetAgGridColumns();
31
- const onUpdateTextWrapping = useCallback((newTextWrapping, gridApi) => {
32
- if (gridApi) {
33
- const wrapText = !!newTextWrapping.wrapText;
34
- const wrapHeaderText = !!newTextWrapping.wrapHeaderText;
35
- // Update existing column defs so body cells respect the new wrapping settings immediately
36
- const allColumns = getAgGridColumns(gridApi);
37
- const updatedColDefs = allColumns?.map((column) => {
38
- const colDef = column.getColDef();
39
- const currentWidth = column.getActualWidth();
40
- const columnDefinition = colDef.context?.columnDefinition;
41
- // Skip wrapText for some columns (performance optimization)
42
- const allowCellWrapping = columnDefinition && allowCellWrappingByColumnDefinition(columnDefinition);
43
- const shouldWrapText = wrapText && allowCellWrapping;
44
- return {
45
- ...colDef,
46
- wrapText: shouldWrapText,
47
- wrapHeaderText,
48
- // enable/disable auto sizing only together with wrapping to avoid perf issues
49
- autoHeight: shouldWrapText,
50
- autoHeaderHeight: wrapHeaderText,
51
- // preserve current width, otherwise ag-grid will recalculate it and use the stale one
52
- width: currentWidth,
53
- };
54
- });
55
- if (updatedColDefs) {
56
- updateAgGridColumnDefs(updatedColDefs, gridApi);
57
- }
58
- // Keep defaultColDef in sync so header layout and any future defs are consistent
59
- updateDefaultTextWrapping(gridApi, newTextWrapping);
60
- }
61
- if (pushData) {
62
- pushData({
63
- properties: {
64
- controls: {
65
- textWrapping: newTextWrapping,
66
- },
67
- },
68
- });
69
- }
70
- }, [pushData, updateAgGridColumnDefs, getAgGridColumns, updateDefaultTextWrapping]);
71
- return {
72
- onUpdateTextWrapping,
73
- };
74
- }