@adaptabletools/adaptable-cjs 20.0.0-canary.5 → 20.0.0-canary.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.
@@ -46,6 +46,47 @@ const ConfigurationWizard = (props) => {
46
46
  delete newColumn.caption;
47
47
  return newColumn;
48
48
  });
49
+ const columnDefs = adaptableConfig.gridOptions.columnDefs;
50
+ // handle the layout creation
51
+ let Layouts = newAdaptableOptions.predefinedConfig?.Layout?.Layouts || [];
52
+ const NewLayout = {
53
+ TableColumns: columnDefs.map((col) => col.colId ?? col.field),
54
+ Name: 'Default Layout',
55
+ };
56
+ let currentLayoutName = NewLayout.Name;
57
+ let found = false;
58
+ if (!Layouts.length) {
59
+ // no layouts, make this the only one
60
+ Layouts = [NewLayout];
61
+ }
62
+ else {
63
+ Layouts = Layouts.map((layout) => {
64
+ if (found) {
65
+ return layout;
66
+ }
67
+ if (layout.TableColumns?.length === 0) {
68
+ // when finding the first empty layout
69
+ // set its column to be those of the new layout
70
+ found = true;
71
+ // and grab the name so we can put it in the Layout.CurrentLayout state
72
+ currentLayoutName = layout.Name;
73
+ layout = { ...layout };
74
+ layout.TableColumns = NewLayout.TableColumns;
75
+ }
76
+ return layout;
77
+ });
78
+ if (!found) {
79
+ Layouts.push(NewLayout);
80
+ }
81
+ }
82
+ newAdaptableOptions.predefinedConfig = {
83
+ ...newAdaptableOptions.predefinedConfig,
84
+ Layout: {
85
+ ...newAdaptableOptions.predefinedConfig.Layout,
86
+ Layouts: Layouts,
87
+ CurrentLayout: currentLayoutName,
88
+ },
89
+ };
49
90
  newAdaptableOptions.primaryKey = columnsHandle.current.getPrimaryKey();
50
91
  }
51
92
  const newAdaptableConfig = {
@@ -2965,6 +2965,10 @@ You need to define at least one Layout!`);
2965
2965
  };
2966
2966
  this.agGridColumnAdapter.setupColumnHeader(colSetupInfo);
2967
2967
  });
2968
+ // need to refresh the header,
2969
+ // as the Layout.ColumnHeaders state property is not implemented in the LayoutManager
2970
+ // and is specific to Adaptable, therefore we need to refresh it manually
2971
+ this.refreshHeader();
2968
2972
  const layoutModel = (0, LayoutHelpers_1.layoutStateToLayoutModel)(layout);
2969
2973
  this.layoutManager?.setLayout(layoutModel, {
2970
2974
  skipApplyRowGroupsExpandedState: !shouldUpdateExpandState,
@@ -100,7 +100,7 @@ class AgGridAdapter {
100
100
  // `context`
101
101
  const passedContext = options.context;
102
102
  if (passedContext) {
103
- passedContext['__adaptable'] = self;
103
+ passedContext['__adaptable'] = self._adaptableInstance;
104
104
  passedContext['adaptableApi'] = self.adaptableApi;
105
105
  }
106
106
  // we mutated the options array, so it's OK to use the 'arguments' object
@@ -392,9 +392,6 @@ class AgGridColumnAdapter {
392
392
  if (layoutCustomHeader) {
393
393
  resultHeaderName = layoutCustomHeader;
394
394
  }
395
- // required here for the initial layout rendering
396
- // Removed by JW, 3 october 2023; i don't think we need it and it overrides stuff unnecessarily
397
- abColumn.friendlyName = resultHeaderName;
398
395
  return resultHeaderName;
399
396
  });
400
397
  const newColumnHeader = col?.getColDef()?.headerName;
@@ -23,6 +23,7 @@ export declare class AgGridExportAdapter {
23
23
  private get agGridApi();
24
24
  private get adaptableApi();
25
25
  private get exportOptions();
26
+ private get logger();
26
27
  static getExcelClassNameForCell(colId: string, primaryKeyValue: any, userDefinedCellClass?: string | string[]): string;
27
28
  destroy(): void;
28
29
  exportData(config: ExportConfig): Promise<null | ExportResultData>;
@@ -33,6 +33,9 @@ class AgGridExportAdapter {
33
33
  get exportOptions() {
34
34
  return this._adaptableInstance.api.optionsApi.getExportOptions();
35
35
  }
36
+ get logger() {
37
+ return this._adaptableInstance.logger;
38
+ }
36
39
  static getExcelClassNameForCell(colId, primaryKeyValue, userDefinedCellClass) {
37
40
  let excelClassName = `--excel-cell-${colId}-${primaryKeyValue}`;
38
41
  if (excelClassName.indexOf(' ') > 0) {
@@ -102,8 +105,7 @@ class AgGridExportAdapter {
102
105
  };
103
106
  }
104
107
  catch (error) {
105
- // FIXME AFL improve logging
106
- console.error(error);
108
+ this.logger.consoleError(`Error exporting ${report.Name} in ${format} format to ${config.destination}`, error);
107
109
  }
108
110
  finally {
109
111
  /**
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  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" || '',
5
- PUBLISH_TIMESTAMP: 1741156652553 || Date.now(),
6
- VERSION: "20.0.0-canary.5" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1741274250893 || Date.now(),
6
+ VERSION: "20.0.0-canary.7" || '--current-version--',
7
7
  };