@adaptabletools/adaptable 20.0.0-canary.6 → 20.0.0-canary.8

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.
@@ -29,6 +29,9 @@ export class AgGridExportAdapter {
29
29
  get exportOptions() {
30
30
  return this._adaptableInstance.api.optionsApi.getExportOptions();
31
31
  }
32
+ get logger() {
33
+ return this._adaptableInstance.logger;
34
+ }
32
35
  static getExcelClassNameForCell(colId, primaryKeyValue, userDefinedCellClass) {
33
36
  let excelClassName = `--excel-cell-${colId}-${primaryKeyValue}`;
34
37
  if (excelClassName.indexOf(' ') > 0) {
@@ -57,14 +60,12 @@ export class AgGridExportAdapter {
57
60
  await waitForTimeout(16);
58
61
  }
59
62
  this.adaptableApi.exportApi.internalApi.setExportInProgress(config.report.Name, config.format, config.destination);
60
- const exportContext = this.buildExportProcessContext(config);
63
+ const { exportContext, exportParams } = this.buildExportProcessData(config);
61
64
  if (exportContext.isVisualExcelReport) {
62
65
  // FIXME AFL patch styles only for exported columns!
63
66
  // or even better, only cells
64
67
  this.patchExcelStyles();
65
68
  }
66
- const exportParams = this.buildExportParams(exportContext);
67
- exportContext.exportedColumnIds = exportParams.columnKeys;
68
69
  // 1. easiest case, we download the file using AG Grid
69
70
  // these methods will automatically handle the file download
70
71
  if (exportContext.destination === 'Download' && exportContext.isExcelReport) {
@@ -98,8 +99,7 @@ export class AgGridExportAdapter {
98
99
  };
99
100
  }
100
101
  catch (error) {
101
- // FIXME AFL improve logging
102
- console.error(error);
102
+ this.logger.consoleError(`Error exporting ${report.Name} in ${format} format to ${config.destination}`, error);
103
103
  }
104
104
  finally {
105
105
  /**
@@ -114,6 +114,21 @@ export class AgGridExportAdapter {
114
114
  }
115
115
  }
116
116
  }
117
+ /**
118
+ * Creates export context and parameters for a given export configuration
119
+ */
120
+ buildExportProcessData(config) {
121
+ const exportContext = this.buildExportProcessContext(config);
122
+ if (exportContext.isVisualExcelReport) {
123
+ this.patchExcelStyles();
124
+ }
125
+ const exportParams = this.buildExportParams(exportContext);
126
+ exportContext.exportedColumnIds = exportParams.columnKeys;
127
+ return {
128
+ exportContext,
129
+ exportParams,
130
+ };
131
+ }
117
132
  buildExportParams(exportContext) {
118
133
  const baseExportParams = this.buildBaseExportParams(exportContext);
119
134
  if (exportContext.format === 'Excel' || exportContext.format === 'VisualExcel') {
@@ -652,9 +667,9 @@ export class AgGridExportAdapter {
652
667
  .map((columnId) => this.adaptableApi.columnApi.getColumnWithColumnId(columnId))
653
668
  .map((column) => ({
654
669
  columnId: column.columnId,
670
+ field: column.field ?? column.columnId,
655
671
  friendlyName: column.friendlyName,
656
672
  dataType: column.dataType,
657
- field: column.field ?? column.columnId,
658
673
  }));
659
674
  const reportData = {
660
675
  columns,
@@ -726,27 +741,11 @@ export class AgGridExportAdapter {
726
741
  masterRowNode: node,
727
742
  masterRowData: node?.data,
728
743
  isExpanded: node.expanded,
729
- createCellCsv: (cellContent) => {
730
- return {
731
- data: {
732
- value: cellContent != undefined ? String(cellContent) : null,
733
- },
734
- };
735
- },
736
- createCellExcel: (cellContent, cellType) => {
737
- return {
738
- data: {
739
- value: cellContent != undefined ? String(cellContent) : null,
740
- type: cellType,
741
- },
742
- };
743
- },
744
+ createCellCsv: (cellContent) => this.adaptableApi.exportApi.internalApi.createCellCsv(cellContent),
745
+ createCellExcel: (cellContent, cellType) => this.adaptableApi.exportApi.internalApi.createCellExcel(cellContent, cellType),
744
746
  createCellHeader: (cellContent) => {
745
747
  return {
746
- data: {
747
- value: cellContent != undefined ? String(cellContent) : null,
748
- type: 'String',
749
- },
748
+ ...this.adaptableApi.exportApi.internalApi.createCellHeader(cellContent),
750
749
  // see #masterDetailHeader
751
750
  styleId: '_masterDetailHeader',
752
751
  };
@@ -35,7 +35,8 @@ export const getBadgeRendererForColumn = (badgeStyle, abColumn, api) => {
35
35
  this.eGui.innerHTML = formattedValue;
36
36
  return;
37
37
  }
38
- if (['NumberArray', 'StringArray'].includes(abColumn.dataType)) {
38
+ const arrayTypes = ['numberArray', 'textArray'];
39
+ if (arrayTypes.includes(abColumn.dataType)) {
39
40
  this.renderArrayValues(params, adaptableApi);
40
41
  }
41
42
  else {
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1741253338614 || Date.now(),
4
- VERSION: "20.0.0-canary.6" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1741620176158 || Date.now(),
4
+ VERSION: "20.0.0-canary.8" || '--current-version--',
5
5
  };