@adaptabletools/adaptable 15.2.0-canary.1 → 15.2.0-canary.3

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.
Files changed (34) hide show
  1. package/bundle.cjs.js +114 -114
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +10 -4
  6. package/src/AdaptableOptions/ExportOptions.d.ts +52 -2
  7. package/src/Api/GridApi.d.ts +10 -2
  8. package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
  9. package/src/Api/Implementation/AdaptableApiImpl.js +6 -0
  10. package/src/Api/Implementation/ExportApiImpl.d.ts +2 -3
  11. package/src/Api/Implementation/GridApiImpl.d.ts +6 -2
  12. package/src/Api/Implementation/GridApiImpl.js +4 -1
  13. package/src/Api/Implementation/LayoutApiImpl.js +1 -1
  14. package/src/Api/Internal/AdaptableInternalApi.d.ts +8 -2
  15. package/src/Api/Internal/AdaptableInternalApi.js +4 -4
  16. package/src/Api/Internal/LayoutInternalApi.js +1 -1
  17. package/src/PredefinedConfig/ExportState.d.ts +1 -1
  18. package/src/Strategy/ExportModule.d.ts +2 -1
  19. package/src/Strategy/ExportModule.js +78 -29
  20. package/src/Strategy/LayoutModule.js +1 -1
  21. package/src/Utilities/Services/Interface/IReportService.d.ts +4 -2
  22. package/src/Utilities/Services/ReportService.d.ts +3 -2
  23. package/src/Utilities/Services/ReportService.js +27 -25
  24. package/src/Utilities/waitForTimeout.d.ts +1 -0
  25. package/src/Utilities/waitForTimeout.js +12 -0
  26. package/src/View/Export/ExportTablePopup.js +7 -5
  27. package/src/agGrid/Adaptable.d.ts +10 -4
  28. package/src/agGrid/Adaptable.js +19 -10
  29. package/src/components/ProgressIndicator/ProgressIndicator.js +1 -1
  30. package/src/metamodel/adaptable.metamodel.d.ts +40 -0
  31. package/src/metamodel/adaptable.metamodel.js +1 -1
  32. package/src/types.d.ts +1 -1
  33. package/version.d.ts +1 -1
  34. package/version.js +1 -1
@@ -186,7 +186,7 @@ class ReportService {
186
186
  }
187
187
  }
188
188
  }
189
- GetReportColumnsForReport(report, includePrimaryKey = false) {
189
+ getReportDataColumns(report, includePrimaryKey = false) {
190
190
  let reportColumns = [];
191
191
  let gridColumns = this.adaptableApi.columnApi.getExportableColumns();
192
192
  if (this.adaptableApi.exportApi.isServerReport(report)) {
@@ -224,38 +224,32 @@ class ReportService {
224
224
  reportColumns.push(this.adaptableApi.columnApi.getPrimaryKeyColumn());
225
225
  }
226
226
  }
227
- return reportColumns;
227
+ return reportColumns.map((column) => {
228
+ var _a;
229
+ return ({
230
+ columnId: column.columnId,
231
+ friendlyName: column.friendlyName,
232
+ dataType: column.dataType,
233
+ field: (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId,
234
+ });
235
+ });
228
236
  }
229
- getReportData(report, includePrimaryKey = false) {
237
+ getReportDataRows(report, columns, includePrimaryKey) {
230
238
  var _a, _b;
231
- const columns = this.GetReportColumnsForReport(report, includePrimaryKey).map((column) => ({
232
- columnId: column.columnId,
233
- friendlyName: column.friendlyName,
234
- dataType: column.dataType,
235
- }));
236
- if (this.adaptableApi.exportApi.isServerReport(report)) {
237
- return this.adaptableApi.exportApi.runServerReport(report.Name);
238
- }
239
239
  if (ArrayExtensions_1.default.IsNullOrEmpty(columns)) {
240
- return { columns: [], rows: [] };
240
+ return [];
241
241
  }
242
- const data = { columns, rows: [] };
243
242
  const columnIds = columns.map((column) => column.columnId);
243
+ const resultRowData = [];
244
244
  switch (report.ReportRowScope) {
245
245
  case 'AllRows':
246
246
  this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
247
- // skip row groups
248
- if (!rowNode.group) {
249
- data.rows.push(this.getRowObjectForColumnIds(rowNode, columnIds));
250
- }
247
+ resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
251
248
  });
252
249
  break;
253
250
  case 'VisibleRows':
254
251
  this.adaptableApi.internalApi.forAllVisibleRowNodesDo((rowNode) => {
255
- // skip row groups
256
- if (!rowNode.group) {
257
- data.rows.push(this.getRowObjectForColumnIds(rowNode, columnIds));
258
- }
252
+ resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
259
253
  });
260
254
  break;
261
255
  case 'ExpressionRows':
@@ -264,7 +258,7 @@ class ReportService {
264
258
  if (this.adaptableApi.internalApi
265
259
  .getQueryLanguageService()
266
260
  .evaluateBooleanExpression((_a = report.Query) === null || _a === void 0 ? void 0 : _a.BooleanExpression, ModuleConstants_1.ExportModuleId, rowNode)) {
267
- data.rows.push(this.getRowObjectForColumnIds(rowNode, columnIds));
261
+ resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
268
262
  }
269
263
  });
270
264
  break;
@@ -283,7 +277,7 @@ class ReportService {
283
277
  if (includePrimaryKey) {
284
278
  row[this.adaptableApi.optionsApi.getPrimaryKey()] = rowPrimaryKeyValue;
285
279
  }
286
- data.rows.push(row);
280
+ resultRowData.push(row);
287
281
  }
288
282
  });
289
283
  break;
@@ -294,13 +288,21 @@ class ReportService {
294
288
  this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
295
289
  const rowPrimaryKeyValue = this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(rowNode);
296
290
  if (selectedGridRowPrimaryKeys.includes(rowPrimaryKeyValue)) {
297
- data.rows.push(this.getRowObjectForColumnIds(rowNode, columnIds));
291
+ resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
298
292
  }
299
293
  });
300
294
  }
301
295
  break;
302
296
  }
303
- return data;
297
+ return resultRowData;
298
+ }
299
+ getReportData(report, includePrimaryKey = false) {
300
+ if (this.adaptableApi.exportApi.isServerReport(report)) {
301
+ return this.adaptableApi.exportApi.runServerReport(report.Name);
302
+ }
303
+ const columns = this.getReportDataColumns(report, includePrimaryKey);
304
+ const rows = this.getReportDataRows(report, columns, includePrimaryKey);
305
+ return { columns, rows };
304
306
  }
305
307
  getReportDataAsArray(report, includePrimaryKey = false) {
306
308
  const reportData = this.getReportData(report, includePrimaryKey);
@@ -0,0 +1 @@
1
+ export declare function waitForTimeout(ms: number): Promise<void>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.waitForTimeout = void 0;
4
+ // waits for the given ms milliseconds
5
+ function waitForTimeout(ms) {
6
+ return new Promise((resolve) => {
7
+ setTimeout(() => {
8
+ resolve();
9
+ }, ms);
10
+ });
11
+ }
12
+ exports.waitForTimeout = waitForTimeout;
@@ -15,18 +15,17 @@ const tableDOMProps = {
15
15
  const ExportTablePopup = (props) => {
16
16
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
17
17
  const adaptableApi = adaptable.api;
18
- const primaryKey = adaptableApi.optionsApi.getPrimaryKey();
18
+ const primaryKey = '_rowIndex';
19
19
  const { reportData, } = props.popupProps;
20
- const data = reportData.rows;
20
+ const data = reportData.rows.map((row, index) => (Object.assign(Object.assign({}, row), { [primaryKey]: index + 1 })));
21
21
  const columns = React.useMemo(() => {
22
- const getFriendlyName = (columnId) => adaptableApi.columnApi.getFriendlyNameForColumnId(columnId);
23
22
  const columns = {
24
- [primaryKey]: { field: primaryKey, header: getFriendlyName(primaryKey) },
23
+ [primaryKey]: { field: primaryKey, header: 'Index' },
25
24
  };
26
25
  for (let column of reportData.columns) {
27
26
  columns[column.columnId] = {
28
27
  field: column.columnId,
29
- header: getFriendlyName(column.columnId),
28
+ header: column.friendlyName,
30
29
  dataType: column.dataType,
31
30
  };
32
31
  if (column.dataType === 'Date') {
@@ -49,6 +48,9 @@ const ExportTablePopup = (props) => {
49
48
  }
50
49
  return columns;
51
50
  }, [props.popupProps]);
51
+ const columnOrder = React.useMemo(() => {
52
+ return Object.keys(columns);
53
+ }, [columns]);
52
54
  return (React.createElement(InfiniteTable_1.DataSource, { data: data, primaryKey: primaryKey },
53
55
  React.createElement(InfiniteTable_1.InfiniteTable, { columnTypes: {
54
56
  default: {
@@ -219,12 +219,18 @@ export declare class Adaptable implements IAdaptable {
219
219
  getRowNodeForPrimaryKey(primaryKeyValue: any): any;
220
220
  getRowNodeByIndex(index: number): IRowNode;
221
221
  getRowNodesForPrimaryKeys(primaryKeyValues: any[]): any[];
222
- forAllRowNodesDo(func: (rowNode: IRowNode) => void, config?: {
222
+ forAllRowNodesDo(func: (rowNode: IRowNode, rowIndex: number) => void, config?: {
223
223
  includeGroupRows?: boolean;
224
224
  filterFn?: (rowNode: IRowNode) => boolean;
225
225
  }): void;
226
- forAllVisibleRowNodesDo(func: (rowNode: IRowNode, rowIndex: number) => void): void;
227
- getVisibleRowNodes(): IRowNode[];
226
+ forAllVisibleRowNodesDo(func: (rowNode: IRowNode, rowIndex: number) => void, config?: {
227
+ includeGroupRows?: boolean;
228
+ filterFn?: (rowNode: IRowNode) => boolean;
229
+ }): void;
230
+ getVisibleRowNodes(config?: {
231
+ includeGroupRows?: boolean;
232
+ filterFn?: (rowNode: IRowNode) => boolean;
233
+ }): IRowNode[];
228
234
  getAllRowNodes(config?: {
229
235
  includeGroupRows?: boolean;
230
236
  filterFn?: (rowNode: IRowNode) => boolean;
@@ -392,7 +398,7 @@ export declare class Adaptable implements IAdaptable {
392
398
  showChart(chartDefinition: ChartDefinition, container?: HTMLElement): ChartRef;
393
399
  getChartRef(chartId: string): ChartRef;
394
400
  getChartModels(): import("@ag-grid-community/core").ChartModel[];
395
- getRowModel(): import("@ag-grid-community/core").RowModelType;
401
+ getRowModelType(): import("@ag-grid-community/core").RowModelType;
396
402
  private getActiveAdaptableAggFuncForCol;
397
403
  private registerAdaptableAggFuncs;
398
404
  /**
@@ -2104,24 +2104,32 @@ class Adaptable {
2104
2104
  return rowNodes;
2105
2105
  }
2106
2106
  forAllRowNodesDo(func, config) {
2107
- this.gridOptions.api.forEachNode((rowNode) => {
2107
+ this.gridOptions.api.forEachNode((rowNode, rowIndex) => {
2108
2108
  const includeGroupRows = (config === null || config === void 0 ? void 0 : config.includeGroupRows) || !this.isGroupRowNode(rowNode);
2109
2109
  const filterFnFulfilled = !(config === null || config === void 0 ? void 0 : config.filterFn) || (config === null || config === void 0 ? void 0 : config.filterFn(rowNode));
2110
2110
  if (includeGroupRows && filterFnFulfilled) {
2111
- func(rowNode);
2111
+ func(rowNode, rowIndex);
2112
2112
  }
2113
2113
  });
2114
2114
  }
2115
- forAllVisibleRowNodesDo(func) {
2115
+ forAllVisibleRowNodesDo(func, config) {
2116
+ if (this.getRowModelType() !== 'clientSide') {
2117
+ // only in client-side row model can we loop through filtered&sorted rows
2118
+ // see https://www.ag-grid.com/javascript-data-grid/accessing-data/#iterating-rows
2119
+ this.logger.warn('`forAllVisibleRowNodesDo()` is only supported in client-side row model. `forAllRowNodesDo` will be used instead.');
2120
+ return this.forAllRowNodesDo(func, config);
2121
+ }
2116
2122
  this.gridOptions.api.forEachNodeAfterFilterAndSort((rowNode, rowIndex) => {
2117
- func(rowNode, rowIndex);
2123
+ const includeGroupRows = (config === null || config === void 0 ? void 0 : config.includeGroupRows) || !this.isGroupRowNode(rowNode);
2124
+ const filterFnFulfilled = !(config === null || config === void 0 ? void 0 : config.filterFn) || (config === null || config === void 0 ? void 0 : config.filterFn(rowNode));
2125
+ if (includeGroupRows && filterFnFulfilled) {
2126
+ func(rowNode, rowIndex);
2127
+ }
2118
2128
  });
2119
2129
  }
2120
- getVisibleRowNodes() {
2130
+ getVisibleRowNodes(config) {
2121
2131
  let rowNodes = [];
2122
- this.gridOptions.api.forEachNodeAfterFilterAndSort((rowNode, rowIndex) => {
2123
- rowNodes.push(rowNode);
2124
- });
2132
+ this.forAllVisibleRowNodesDo((rowNode) => rowNodes.push(rowNode), config);
2125
2133
  return rowNodes;
2126
2134
  }
2127
2135
  getAllRowNodes(config) {
@@ -4584,6 +4592,7 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4584
4592
  const colDefs = displayedColumns.map((column) => {
4585
4593
  return column.getColDef();
4586
4594
  });
4595
+ const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
4587
4596
  this.forAllVisibleRowNodesDo((node, rowIndex) => {
4588
4597
  const rowParams = {
4589
4598
  node,
@@ -4684,7 +4693,7 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4684
4693
  .getReportService()
4685
4694
  .registerExcelStyle(finalCellExcelStyle, cellClassId);
4686
4695
  });
4687
- });
4696
+ }, forAllVisibleRowNodesDoConfig);
4688
4697
  return this.api.internalApi.getReportService().getRegisteredExcelStyles();
4689
4698
  });
4690
4699
  }
@@ -4881,7 +4890,7 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4881
4890
  }
4882
4891
  return this.gridOptions.api.getChartModels();
4883
4892
  }
4884
- getRowModel() {
4893
+ getRowModelType() {
4885
4894
  return this.gridOptions.rowModelType;
4886
4895
  }
4887
4896
  getActiveAdaptableAggFuncForCol(columnId) {
@@ -40,7 +40,7 @@ const ProgressIndicator = () => {
40
40
  disableAdaptableGrid(adaptable.getAdaptableContainerElement(), active);
41
41
  disableAdaptableGrid(adaptable.getAgGridContainerElement(), active);
42
42
  updateGridContainerCoordinates(adaptable.getAdaptableContainerElement());
43
- // without RAF the progress indicator would be rendered instantly, without the 'transition-delay' defined via CSS
43
+ // without rAF the progress indicator would be rendered instantly, without the 'transition-delay' defined via CSS
44
44
  requestAnimationFrame(() => {
45
45
  setVisible(active);
46
46
  });
@@ -790,6 +790,30 @@ export declare const ADAPTABLE_METAMODEL: {
790
790
  kind: string;
791
791
  desc: string;
792
792
  };
793
+ AdaptableReportColumn: {
794
+ name: string;
795
+ kind: string;
796
+ desc: string;
797
+ props: ({
798
+ name: string;
799
+ kind: string;
800
+ desc: string;
801
+ ref?: undefined;
802
+ isOpt?: undefined;
803
+ } | {
804
+ name: string;
805
+ kind: string;
806
+ desc: string;
807
+ ref: string;
808
+ isOpt?: undefined;
809
+ } | {
810
+ name: string;
811
+ kind: string;
812
+ desc: string;
813
+ isOpt: boolean;
814
+ ref?: undefined;
815
+ })[];
816
+ };
793
817
  AdaptableRowChangedAlert: {
794
818
  name: string;
795
819
  kind: string;
@@ -3629,6 +3653,22 @@ export declare const ADAPTABLE_METAMODEL: {
3629
3653
  isOpt: boolean;
3630
3654
  }[];
3631
3655
  };
3656
+ PreProcessExportContext: {
3657
+ name: string;
3658
+ kind: string;
3659
+ desc: string;
3660
+ props: ({
3661
+ name: string;
3662
+ kind: string;
3663
+ desc: string;
3664
+ ref?: undefined;
3665
+ } | {
3666
+ name: string;
3667
+ kind: string;
3668
+ desc: string;
3669
+ ref: string;
3670
+ })[];
3671
+ };
3632
3672
  QueryableColumnContext: {
3633
3673
  name: string;
3634
3674
  kind: string;