@gooddata/sdk-ui-pivot 11.52.0-alpha.4 → 11.52.0-alpha.6

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.
@@ -1,8 +1,6 @@
1
- import { Component } from "react";
2
1
  import { type ICorePivotTableProps } from "./publicTypes.js";
3
- import { type ICorePivotTableState } from "./tableState.js";
4
2
  /**
5
- * This class implements pivot table using the community version of ag-grid.
3
+ * This component implements pivot table using the community version of ag-grid.
6
4
  *
7
5
  * Bear in mind that this is not a typical, standard React component implementation; the main reason
8
6
  * behind that is that while ag-grid comes with a React component the ag-grid itself is not a React component
@@ -12,10 +10,14 @@ import { type ICorePivotTableState } from "./tableState.js";
12
10
  * Instead of looking at this implementation as a typical React component, look at it like a adapter between
13
11
  * React and ag-grid which is used to render data obtained using GD executions.
14
12
  *
15
- * The code in this class is built to reflect the adapter nature of the integration. The responsibility of this
13
+ * The code in this component is built to reflect the adapter nature of the integration. The responsibility of this
16
14
  * component is to correctly handle the component lifecycle and orchestrate integration of React and ag-grid, React
17
15
  * and GoodData, React and GoodData and ag-grid.
18
16
  *
17
+ * Note on the implementation: because the table is driven imperatively, all the non-react state lives in refs and
18
+ * all the functions that the table hands over to its sub-components are stable for the entire lifetime of the
19
+ * component; they read the current props, state and internal state through refs.
20
+ *
19
21
  * Lifecycle
20
22
  * ---------
21
23
  *
@@ -42,7 +44,7 @@ import { type ICorePivotTableState } from "./tableState.js";
42
44
  * prepared execution, add the extra settings and re-drive the execution. Once done, it will update the internal
43
45
  * state and ping ag-grid API to re-render the table.
44
46
  *
45
- * In case the client changes props (say modifying the prepared execution) the componentDidUpdate will determine
47
+ * In case the client changes props (say modifying the prepared execution) the update effect will determine
46
48
  * whether the full reinitialization is in order. If so the entire existing ag-grid and all our internal state
47
49
  * is thrown out and table is initialized from scratch.
48
50
  *
@@ -108,147 +110,7 @@ import { type ICorePivotTableState } from "./tableState.js";
108
110
  *
109
111
  * @internal
110
112
  */
111
- export declare class CorePivotTableAgImpl extends Component<ICorePivotTableProps, ICorePivotTableState> {
112
- static defaultProps: Pick<ICorePivotTableProps, "ErrorComponent" | "LoadingComponent" | "afterRender" | "config" | "drillableItems" | "locale" | "onColumnResized" | "onDataView" | "onDrill" | "onError" | "onExportReady" | "onLoadingChanged" | "pageSize" | "pushData">;
113
- private readonly errorMap;
114
- private containerRef;
115
- private pivotTableId;
116
- private internal;
117
- private boundAgGridCallbacks;
118
- private gridEventHandlers;
119
- private dataRenderHandlers;
120
- private scrollEventHandlers;
121
- private resizeEventHandlers;
122
- private sortingEventHandlers;
123
- private aggregationEventHandlers;
124
- private dataLoadingEventHandlers;
125
- private configAccessors;
126
- private configDelegates;
127
- private stickyRowManager;
128
- private heightCalculationManager;
129
- private executionAbortManager;
130
- private componentUpdateAnalyzer;
131
- constructor(props: ICorePivotTableProps);
132
- /**
133
- * Starts initialization of table that will show results of the provided prepared execution. If there is
134
- * already an initialization in progress for the table, this will abandon the previous initialization
135
- * and start a new one.
136
- *
137
- * During the initialization the code drives the execution and obtains the first page of data. Once that
138
- * is done, the initializer will construct the {@link TableFacade} with all the essential non-react
139
- * table & data state in it.
140
- *
141
- * After the initializer completes this, the table facade and the table itself is ready to render the
142
- * ag-grid component.
143
- *
144
- * @param execution - prepared execution to drive
145
- */
146
- private initialize;
147
- /**
148
- * Completely re-initializes the table in order to show data for the provided prepared execution. At this point
149
- * code has determined that the table layout for the other prepared execution differs from what is currently
150
- * shown and the only reasonable thing to do is to throw everything away and start from scratch.
151
- *
152
- * This will reset all React state and non-react state and start table initialization process.
153
- */
154
- private reinitialize;
155
- componentDidMount(): void;
156
- componentWillUnmount(): void;
157
- componentDidUpdate(prevProps: ICorePivotTableProps): void;
158
- private stopEventWhenResizeHeader;
159
- private setContainerRef;
160
- private renderLoading;
161
- render(): import("react/jsx-runtime").JSX.Element;
162
- private initializeEventHandlers;
163
- private onGridReady;
164
- private onFirstDataRendered;
165
- private onModelUpdated;
166
- private onGridColumnsChanged;
167
- private onGridSizeChanged;
168
- private onGridColumnResized;
169
- private onSortChanged;
170
- private onPinnedRowDataChanged;
171
- private onBodyScroll;
172
- private onContainerMouseDown;
173
- private onPageLoaded;
174
- /**
175
- * This will be called when user changes sorts or adds totals. This means complete re-execution with
176
- * new sorts or totals. Loading indicators will be shown instead of all rendered rows thanks to the
177
- * LoadingRenderer used in all cells of the left-most column.
178
- *
179
- * The table must take care to remove the sticky (top-pinned) row - it is treated differently by
180
- * ag-grid and will be literally sticking there on its own with the loading indicators.
181
- *
182
- * Once transformation finishes - indicated by call to onPageLoaded, table can re-instance the sticky row.
183
- *
184
- * @param newExecution - the new execution which is being run and will be used to populate the table
185
- */
186
- private onExecutionTransformed;
187
- private onMenuAggregationClick;
188
- private onLoadingChanged;
189
- private onError;
190
- private growToFit;
191
- private autoresizeColumns;
192
- private shouldAutoResizeColumns;
193
- private startWatchingTableRendered;
194
- private stopWatchingTableRendered;
195
- private updateStickyRow;
196
- private updateStickyRowContent;
197
- private updateDesiredHeight;
198
- private initializeConfigAccessors;
199
- private getLastSortedColId;
200
- private setLastSortedColId;
201
- private getColumnTotals;
202
- private getRowTotals;
203
- private getExecutionDefinition;
204
- private getGroupRows;
205
- private getMeasureGroupDimension;
206
- private getColumnHeadersPosition;
207
- private getMenuConfig;
208
- private getDefaultWidth;
209
- private isColumnAutoresizeEnabled;
210
- private isGrowToFitEnabled;
211
- private getColumnWidths;
212
- private hasColumnWidths;
213
- private getDefaultWidthFromProps;
214
- /**
215
- * All pushData calls done by the table must go through this guard.
216
- *
217
- * TODO: The guard should ensure a 'disconnect' between push data handling and the calling function processing.
218
- * When the pushData is handled by the application, it MAY (and in our case it DOES) trigger processing that
219
- * lands back in the table. This opens additional set of invariants to check / be prepared for in order to
220
- * optimize the renders and re-renders.
221
- */
222
- private pushDataGuard;
223
- /**
224
- * Wraps the provided callback function with a guard that checks whether the current table state is the same
225
- * as the state snapshot at the time of callback creation. If the state differs, the wrapped function WILL NOT
226
- * be called.
227
- *
228
- * @param callback - function to wrap with state guard
229
- */
230
- private stateBoundCallback;
231
- /**
232
- * All callback functions that the table passes to ag-grid must be bound to the current internal state of the table. The
233
- * callback functions MUST be noop if the internal state at the time of call is different from the internal state
234
- * at the time of creation.
235
- *
236
- * This is essential to prevent errors stemming for racy behavior triggered by ag-grid. ag-grid often triggers
237
- * event callbacks using setTimeout(). It can happen, that once the event is actually processed the ag-grid table
238
- * which caused it is unmounted. Doing anything with the unmounted table's gridApi leads to errors.
239
- *
240
- * Without this, table may trigger ag-grid errors such as this:
241
- *
242
- * https://github.com/ag-grid/ag-grid/issues/3457
243
- *
244
- * or this:
245
- *
246
- * https://github.com/ag-grid/ag-grid/issues/3334
247
- */
248
- private createBoundAgGridCallbacks;
249
- private getTableMethods;
250
- private getResizingConfig;
251
- }
113
+ export declare function CorePivotTableAgImpl(props: ICorePivotTableProps): import("react/jsx-runtime").JSX.Element;
252
114
  /**
253
115
  * @internal
254
116
  */
@@ -1 +1 @@
1
- {"version":3,"file":"CorePivotTable.d.ts","sourceRoot":"","sources":["../src/CorePivotTable.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsB,SAAS,EAAsC,MAAM,OAAO,CAAC;AA8D1F,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,KAAK,oBAAoB,EAAsB,MAAM,iBAAiB,CAAC;AAQhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0GG;AACH,qBAAa,oBAAqB,SAAQ,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAC3F,OAAc,YAAY,yPAA6B;IAEvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,QAAQ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