@adaptabletools/adaptable-cjs 18.0.0-canary.4 → 18.0.0-canary.5

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 (169) hide show
  1. package/agGrid.d.ts +4 -21
  2. package/agGrid.js +5 -21
  3. package/base.css +1 -1
  4. package/base.css.map +1 -1
  5. package/index.css +74 -68
  6. package/index.css.map +1 -1
  7. package/package.json +3 -4
  8. package/src/AdaptableInterfaces/IAdaptable.d.ts +55 -109
  9. package/src/AdaptableOptions/AdaptableOptions.d.ts +6 -0
  10. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +17 -0
  11. package/src/Api/AdaptableApi.d.ts +5 -0
  12. package/src/Api/ColumnFilterApi.d.ts +0 -5
  13. package/src/Api/Events/AdaptableReady.d.ts +3 -3
  14. package/src/Api/Events/GridDataChanged.d.ts +4 -4
  15. package/src/Api/GridApi.d.ts +14 -13
  16. package/src/Api/Implementation/ActionColumnApiImpl.d.ts +2 -0
  17. package/src/Api/Implementation/ActionColumnApiImpl.js +33 -0
  18. package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -0
  19. package/src/Api/Implementation/AdaptableApiImpl.js +3 -0
  20. package/src/Api/Implementation/ApiBase.d.ts +2 -1
  21. package/src/Api/Implementation/ApiBase.js +3 -0
  22. package/src/Api/Implementation/ColumnFilterApiImpl.d.ts +0 -1
  23. package/src/Api/Implementation/ColumnFilterApiImpl.js +0 -10
  24. package/src/Api/Implementation/CommentsApiImpl.js +2 -1
  25. package/src/Api/Implementation/ConfigApiImpl.js +8 -3
  26. package/src/Api/Implementation/GridApiImpl.d.ts +3 -3
  27. package/src/Api/Implementation/GridApiImpl.js +20 -14
  28. package/src/Api/Implementation/StatusBarApiImpl.d.ts +0 -1
  29. package/src/Api/Implementation/StatusBarApiImpl.js +0 -3
  30. package/src/Api/Implementation/ToolPanelApiImpl.js +6 -6
  31. package/src/Api/Internal/ActionRowInternalApi.d.ts +5 -1
  32. package/src/Api/Internal/ActionRowInternalApi.js +107 -0
  33. package/src/Api/Internal/AdaptableInternalApi.d.ts +3 -4
  34. package/src/Api/Internal/AdaptableInternalApi.js +10 -8
  35. package/src/Api/Internal/CalculatedColumnInternalApi.d.ts +2 -0
  36. package/src/Api/Internal/CalculatedColumnInternalApi.js +71 -0
  37. package/src/Api/Internal/ColumnFilterInternalApi.d.ts +1 -0
  38. package/src/Api/Internal/ColumnFilterInternalApi.js +11 -1
  39. package/src/Api/Internal/ColumnInternalApi.d.ts +4 -1
  40. package/src/Api/Internal/ColumnInternalApi.js +12 -0
  41. package/src/Api/Internal/CustomSortInternalApi.d.ts +3 -2
  42. package/src/Api/Internal/CustomSortInternalApi.js +32 -1
  43. package/src/Api/Internal/DataSetInternalApi.js +1 -1
  44. package/src/Api/Internal/FreeTextColumnInternalApi.d.ts +2 -0
  45. package/src/Api/Internal/FreeTextColumnInternalApi.js +60 -0
  46. package/src/Api/Internal/GridFilterInternalApi.js +1 -1
  47. package/src/Api/Internal/GridInternalApi.d.ts +21 -3
  48. package/src/Api/Internal/GridInternalApi.js +126 -7
  49. package/src/Api/Internal/TeamSharingInternalApi.js +1 -1
  50. package/src/EnvVars.d.ts +3 -0
  51. package/src/EnvVars.js +8 -0
  52. package/src/PredefinedConfig/Common/AggregationColumns.d.ts +1 -0
  53. package/src/PredefinedConfig/Common/AggregationColumns.js +5 -1
  54. package/src/Redux/Store/AdaptableStore.d.ts +4 -6
  55. package/src/Redux/Store/AdaptableStore.js +22 -50
  56. package/src/Redux/Store/Interface/IAdaptableStore.d.ts +7 -1
  57. package/src/Strategy/AdaptableModuleBase.d.ts +2 -3
  58. package/src/Strategy/AdaptableModuleBase.js +4 -7
  59. package/src/Strategy/AlertModule.d.ts +1 -2
  60. package/src/Strategy/AlertModule.js +2 -55
  61. package/src/Strategy/CalculatedColumnModule.d.ts +2 -3
  62. package/src/Strategy/CalculatedColumnModule.js +5 -25
  63. package/src/Strategy/ChartingModule.d.ts +0 -1
  64. package/src/Strategy/ChartingModule.js +0 -21
  65. package/src/Strategy/ColumnFilterModule.d.ts +1 -2
  66. package/src/Strategy/ColumnFilterModule.js +1 -64
  67. package/src/Strategy/CommentsModule.d.ts +1 -0
  68. package/src/Strategy/CommentsModule.js +2 -1
  69. package/src/Strategy/CustomSortModule.js +1 -1
  70. package/src/Strategy/DashboardModule.d.ts +1 -2
  71. package/src/Strategy/DashboardModule.js +1 -8
  72. package/src/Strategy/DataChangeHistoryModule.d.ts +1 -0
  73. package/src/Strategy/DataChangeHistoryModule.js +3 -1
  74. package/src/Strategy/DataSetModule.d.ts +1 -1
  75. package/src/Strategy/DataSetModule.js +1 -1
  76. package/src/Strategy/FlashingCellModule.d.ts +1 -2
  77. package/src/Strategy/FlashingCellModule.js +2 -15
  78. package/src/Strategy/FormatColumnModule.d.ts +0 -2
  79. package/src/Strategy/FormatColumnModule.js +0 -47
  80. package/src/Strategy/FreeTextColumnModule.d.ts +0 -1
  81. package/src/Strategy/FreeTextColumnModule.js +0 -30
  82. package/src/Strategy/GridFilterModule.d.ts +0 -1
  83. package/src/Strategy/GridFilterModule.js +0 -37
  84. package/src/Strategy/Interface/IModule.d.ts +0 -1
  85. package/src/Strategy/LayoutModule.d.ts +1 -3
  86. package/src/Strategy/LayoutModule.js +6 -50
  87. package/src/Strategy/NamedQueryModule.d.ts +0 -1
  88. package/src/Strategy/NamedQueryModule.js +0 -19
  89. package/src/Strategy/PlusMinusModule.d.ts +1 -1
  90. package/src/Strategy/PlusMinusModule.js +1 -1
  91. package/src/Strategy/ScheduleModule.d.ts +1 -1
  92. package/src/Strategy/ScheduleModule.js +1 -1
  93. package/src/Strategy/ShortcutModule.d.ts +1 -1
  94. package/src/Strategy/ShortcutModule.js +1 -1
  95. package/src/Strategy/StyledColumnModule.d.ts +0 -1
  96. package/src/Strategy/StyledColumnModule.js +0 -21
  97. package/src/Strategy/TeamSharingModule.d.ts +1 -0
  98. package/src/Strategy/TeamSharingModule.js +5 -5
  99. package/src/Strategy/ToolPanelModule.d.ts +0 -1
  100. package/src/Strategy/ToolPanelModule.js +0 -23
  101. package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
  102. package/src/Utilities/Constants/GeneralConstants.js +3 -2
  103. package/src/Utilities/Helpers/AdaptableHelper.d.ts +0 -3
  104. package/src/Utilities/Helpers/AdaptableHelper.js +1 -60
  105. package/src/Utilities/Services/CellPopupService.js +0 -1
  106. package/src/Utilities/Services/LicenseService/index.d.ts +3 -0
  107. package/src/Utilities/Services/LicenseService/index.js +10 -3
  108. package/src/Utilities/Services/MetamodelService.d.ts +1 -1
  109. package/src/Utilities/Services/MetamodelService.js +6 -3
  110. package/src/Utilities/Services/RowEditService.d.ts +3 -2
  111. package/src/Utilities/Services/RowEditService.js +3 -1
  112. package/src/View/AdaptableView.js +0 -2
  113. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +2 -2
  114. package/src/View/CalculatedColumn/utils.d.ts +1 -1
  115. package/src/View/CellSummary/CellSummaryPopup.js +1 -1
  116. package/src/View/Components/Popups/AdaptableLoadingScreen.d.ts +6 -5
  117. package/src/View/Components/Popups/AdaptableLoadingScreen.js +19 -9
  118. package/src/View/CustomSort/CustomSortSummary.js +1 -1
  119. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -1
  120. package/src/View/GridFilter/GridFilterViewPanel.js +6 -2
  121. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +2 -3
  122. package/src/View/Layout/Wizard/LayoutWizard.js +1 -1
  123. package/src/agGrid/ActionColumnRenderer.js +4 -4
  124. package/src/agGrid/Adaptable.d.ts +3 -455
  125. package/src/agGrid/Adaptable.js +7 -5291
  126. package/src/agGrid/AdaptableAgGrid.d.ts +336 -0
  127. package/src/agGrid/AdaptableAgGrid.js +3785 -0
  128. package/src/agGrid/AdaptableLogger.js +78 -13
  129. package/src/agGrid/AgGridAdapter.d.ts +54 -0
  130. package/src/agGrid/AgGridAdapter.js +554 -0
  131. package/src/agGrid/AgGridColumnAdapter.d.ts +56 -0
  132. package/src/agGrid/AgGridColumnAdapter.js +818 -0
  133. package/src/agGrid/AgGridMenuAdapter.d.ts +28 -0
  134. package/src/agGrid/AgGridMenuAdapter.js +276 -0
  135. package/src/agGrid/AgGridOptionsService.d.ts +11 -0
  136. package/src/agGrid/AgGridOptionsService.js +54 -0
  137. package/src/agGrid/BadgeRenderer.js +1 -1
  138. package/src/agGrid/CheckboxRenderer.js +1 -1
  139. package/src/agGrid/FilterWrapper.d.ts +2 -2
  140. package/src/agGrid/FilterWrapper.js +1 -1
  141. package/src/agGrid/attachAddaptableColumnTypes.d.ts +12 -12
  142. package/src/agGrid/defaultAdaptableOptions.d.ts +3 -0
  143. package/src/{Utilities/Defaults/DefaultAdaptableOptions.js → agGrid/defaultAdaptableOptions.js} +72 -9
  144. package/src/agGrid/editors/AdaptableDateEditor/index.js +2 -2
  145. package/src/agGrid/editors/AdaptableNumberEditor/index.js +2 -2
  146. package/src/components/Datepicker/index.d.ts +1 -1
  147. package/src/components/InfiniteTable/index.js +2 -2
  148. package/src/components/Modal/index.d.ts +1 -0
  149. package/src/components/Modal/index.js +6 -4
  150. package/src/env.js +2 -2
  151. package/src/metamodel/adaptable.metamodel.d.ts +9 -9
  152. package/src/metamodel/adaptable.metamodel.js +7 -0
  153. package/src/migration/AdaptableUpgradeHelper.d.ts +38 -0
  154. package/src/migration/AdaptableUpgradeHelper.js +52 -0
  155. package/src/migration/VersionUpgrade.d.ts +8 -0
  156. package/src/migration/VersionUpgrade.js +15 -0
  157. package/src/migration/VersionUpgrade17.d.ts +18 -0
  158. package/src/migration/VersionUpgrade17.js +347 -0
  159. package/src/migration/VersionUpgrade18.d.ts +5 -0
  160. package/src/migration/VersionUpgrade18.js +10 -0
  161. package/src/types.d.ts +5 -4
  162. package/tsconfig.cjs.tsbuildinfo +1 -1
  163. package/src/Utilities/Defaults/DefaultAdaptableOptions.d.ts +0 -2
  164. package/src/Utilities/Services/Interface/IRowEditService.d.ts +0 -3
  165. package/src/Utilities/Services/Interface/IRowEditService.js +0 -2
  166. package/src/agGrid/agGridHelper.d.ts +0 -57
  167. package/src/agGrid/agGridHelper.js +0 -691
  168. package/src/agGrid/agGridMenuHelper.d.ts +0 -46
  169. package/src/agGrid/agGridMenuHelper.js +0 -673
@@ -1,7 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FreeTextColumnInternalApi = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const ApiBase_1 = require("../Implementation/ApiBase");
6
+ const ObjectFactory_1 = require("../../Utilities/ObjectFactory");
7
+ const AdaptableNumberEditor_1 = require("../../agGrid/editors/AdaptableNumberEditor");
8
+ const AdaptableDateEditor_1 = require("../../agGrid/editors/AdaptableDateEditor");
9
+ const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
10
+ const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
5
11
  class FreeTextColumnInternalApi extends ApiBase_1.ApiBase {
6
12
  /**
7
13
  * Checks if a User Edit was in a Free Text Column
@@ -40,5 +46,59 @@ class FreeTextColumnInternalApi extends ApiBase_1.ApiBase {
40
46
  });
41
47
  return references;
42
48
  }
49
+ getColDefsForFreeTextColumns() {
50
+ const defaultFreeTextColumnSettings = (0, ObjectFactory_1.CreateEmptyFreeTextColumn)().FreeTextColumnSettings;
51
+ return this.getFreeTextColumnApi()
52
+ .getFreeTextColumns()
53
+ .map((freeTextColumn) => {
54
+ var _a;
55
+ const freeTextColumnSettings = Object.assign(Object.assign({}, defaultFreeTextColumnSettings), freeTextColumn.FreeTextColumnSettings);
56
+ const dataTypeEditor = freeTextColumnSettings.DataType === 'Number'
57
+ ? AdaptableNumberEditor_1.AdaptableNumberEditor
58
+ : freeTextColumnSettings.DataType === 'Date'
59
+ ? AdaptableDateEditor_1.AdaptableDateEditor
60
+ : null;
61
+ const columnTypes = [
62
+ GeneralConstants_1.AB_SPECIAL_COLUMN,
63
+ this.getGridApi().internalApi.getAgGridDataType(freeTextColumnSettings.DataType),
64
+ ];
65
+ if (ArrayExtensions_1.default.IsNotNullOrEmpty((_a = freeTextColumn === null || freeTextColumn === void 0 ? void 0 : freeTextColumn.FreeTextColumnSettings) === null || _a === void 0 ? void 0 : _a.ColumnTypes)) {
66
+ columnTypes.push(...freeTextColumn.FreeTextColumnSettings.ColumnTypes);
67
+ }
68
+ const newColDef = {
69
+ headerName: freeTextColumn.FriendlyName || freeTextColumn.ColumnId,
70
+ colId: freeTextColumn.ColumnId,
71
+ editable: true,
72
+ hide: true,
73
+ width: freeTextColumnSettings.Width,
74
+ enableValue: freeTextColumnSettings.Aggregatable,
75
+ filter: freeTextColumnSettings.Filterable,
76
+ floatingFilter: freeTextColumnSettings.Filterable,
77
+ resizable: freeTextColumnSettings.Resizable,
78
+ enableRowGroup: freeTextColumnSettings.Groupable,
79
+ sortable: freeTextColumnSettings.Sortable,
80
+ enablePivot: freeTextColumnSettings.Pivotable,
81
+ suppressMenu: freeTextColumnSettings.SuppressMenu,
82
+ suppressMovable: freeTextColumnSettings.SuppressMovable,
83
+ cellEditor: dataTypeEditor !== null && dataTypeEditor !== void 0 ? dataTypeEditor : (freeTextColumn.TextEditor && freeTextColumn.TextEditor == 'Large'
84
+ ? 'agLargeTextCellEditor'
85
+ : 'agTextCellEditor'),
86
+ type: columnTypes,
87
+ valueSetter: (params) => {
88
+ return (params.data[freeTextColumn.ColumnId] = params.newValue);
89
+ },
90
+ // use a Boolean Cell Data Type if the Free Text Column is boolean
91
+ cellDataType: freeTextColumnSettings.DataType && freeTextColumnSettings.DataType == 'Boolean'
92
+ ? 'boolean'
93
+ : undefined,
94
+ valueGetter: (params) => this.getFreeTextColumnApi().getFreeTextColumnValueForRowNode(freeTextColumn, params.node),
95
+ };
96
+ if (freeTextColumnSettings.HeaderToolTip) {
97
+ newColDef.headerTooltip = freeTextColumnSettings.HeaderToolTip;
98
+ }
99
+ this.getAdaptableApi().logInfo('Setting up FreeText Column: ' + freeTextColumn.ColumnId);
100
+ return newColDef;
101
+ });
102
+ }
43
103
  }
44
104
  exports.FreeTextColumnInternalApi = FreeTextColumnInternalApi;
@@ -4,7 +4,7 @@ exports.GridFilterInternalApi = void 0;
4
4
  const ApiBase_1 = require("../Implementation/ApiBase");
5
5
  class GridFilterInternalApi extends ApiBase_1.ApiBase {
6
6
  fireGridFilterAppliedEvent() {
7
- if (this.adaptable.isLive) {
7
+ if (this.adaptable.isReady) {
8
8
  const currentGridFilter = this.getGridFilterApi().getCurrentGridFilter();
9
9
  const adaptableApi = this.getAdaptableApi();
10
10
  const gridFilterAppliedInfo = {
@@ -1,12 +1,15 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
2
  import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
3
- import { IRowNode } from '@ag-grid-community/core';
3
+ import { IRowNode, RowClassParams } from '@ag-grid-community/core';
4
+ import { GridDataChangeTrigger } from '../Events/GridDataChanged';
4
5
  import { GridCell } from '../../PredefinedConfig/Selection/GridCell';
5
- import { AdaptableColumn } from '../../PredefinedConfig/Common/AdaptableColumn';
6
+ import { AdaptableColumn, AdaptableColumnDataType } from '../../PredefinedConfig/Common/AdaptableColumn';
6
7
  import { SelectedCellInfo } from '../../PredefinedConfig/Selection/SelectedCellInfo';
7
8
  import { SelectedRowInfo } from '../../PredefinedConfig/Selection/SelectedRowInfo';
8
9
  import { AdaptableMenuItem } from '../../PredefinedConfig/Common/Menu';
9
10
  import { EditLookUpPermittedValues } from '../../AdaptableOptions/UserInterfaceOptions';
11
+ import { DistinctValuesParams } from '../../AdaptableInterfaces/IAdaptable';
12
+ import { AdaptableColumnType } from '../../PredefinedConfig/Common/Types';
10
13
  export declare class GridInternalApi extends ApiBase {
11
14
  /**
12
15
  * Fires Grid Sorted Event
@@ -19,7 +22,7 @@ export declare class GridInternalApi extends ApiBase {
19
22
  /**
20
23
  * Fires Grid Data Changed Event - when a row has changed in AG Grid
21
24
  */
22
- fireGridDataChangedEvent(dataRows: any[], rowNodes: IRowNode[], rowTrigger: 'Add' | 'Edit' | 'Delete'): void;
25
+ fireGridDataChangedEvent(dataRows: any[], rowNodes: IRowNode[], rowTrigger: GridDataChangeTrigger): void;
23
26
  /**
24
27
  * Gets all distinct display values in the Column with the given ColumnId
25
28
  * @param columnId Column to check
@@ -39,17 +42,23 @@ export declare class GridInternalApi extends ApiBase {
39
42
  }[];
40
43
  suppressClientSideFilter: boolean;
41
44
  }>;
45
+ getDistinctFilterListValuesForColumn(column: AdaptableColumn, filter: string, distinctValuesParams: DistinctValuesParams): Promise<{
46
+ suppressClientSideFilter?: boolean;
47
+ gridCells: GridCell[];
48
+ }>;
42
49
  /**
43
50
  * Gets all distinct Custom Sort values for the Column with the given ColumnId
44
51
  * @param columnId Column to check
45
52
  */
46
53
  getDistinctCustomSortDisplayValuesForColumn(columnId: string): Promise<any[]>;
54
+ getDistinctCustomSortValuesForColumn(column: AdaptableColumn, distinctValuesParams: DistinctValuesParams): Promise<GridCell<any>[]>;
47
55
  /**
48
56
  * Gets all distinct Bulk Update values for the Column with the given ColumnId
49
57
  * @param columnId Column to check
50
58
  * @param selectedGridCells Selected grid cells
51
59
  */
52
60
  getDistinctBulkUpdateDisplayValuesForColumn(columnId: string, selectedGridCells: GridCell[]): Promise<any[]>;
61
+ getDistinctBulkUpdateValuesForColumn(column: AdaptableColumn, selectedGridCells: GridCell[], distinctValuesParams: DistinctValuesParams): Promise<GridCell<any>[]>;
53
62
  /**
54
63
  * Gets all distinct visible (after current filters are applied) display values in the Column with the given ColumnId
55
64
  * @param columnId Column to check
@@ -78,4 +87,13 @@ export declare class GridInternalApi extends ApiBase {
78
87
  setSelectedRows(selectedRowInfo: SelectedRowInfo): void;
79
88
  buildStandaloneColumnHeader(column: AdaptableColumn): AdaptableMenuItem[];
80
89
  getEditLookUpValuesForColumn(editLookUpItem: EditLookUpPermittedValues, column: AdaptableColumn, gridCell?: GridCell): any[] | undefined;
90
+ getAgGridDataType(dataType: AdaptableColumnDataType): AdaptableColumnType;
91
+ getRowHighlightStyle(params: RowClassParams): {
92
+ [cssProperty: string]: string;
93
+ };
94
+ getAlertRowStyle(params: RowClassParams): {
95
+ [cssProperty: string]: string;
96
+ };
97
+ getAlertRowClass(params: RowClassParams): string | null;
98
+ getRowHighlightClass(params: RowClassParams): string | null;
81
99
  }
@@ -7,12 +7,15 @@ const Enums_1 = require("../../PredefinedConfig/Common/Enums");
7
7
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
8
8
  const GridRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/GridRedux"));
9
9
  const NumberExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/NumberExtensions"));
10
+ const StyleHelper_1 = require("../../Utilities/Helpers/StyleHelper");
11
+ const UIHelper_1 = tslib_1.__importDefault(require("../../View/UIHelper"));
12
+ const ObjectFactory_1 = require("../../Utilities/ObjectFactory");
10
13
  class GridInternalApi extends ApiBase_1.ApiBase {
11
14
  /**
12
15
  * Fires Grid Sorted Event
13
16
  */
14
17
  fireGridSortedEvent() {
15
- if (this.adaptable.isLive) {
18
+ if (this.adaptable.isReady) {
16
19
  const adaptableSortState = this.adaptable.api.configApi.getAdaptableSortState();
17
20
  const adaptableApi = this.getAdaptableApi();
18
21
  const gridSortedInfo = {
@@ -28,7 +31,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
28
31
  * Fires Cell Changed Changed Event - when any data in AG Grid's dataset has changed
29
32
  */
30
33
  fireCellChangedEvent(cellDataChangedInfo) {
31
- if (this.adaptable.isLive) {
34
+ if (this.adaptable.isReady) {
32
35
  const cellChangedInfo = {
33
36
  adaptableApi: this.adaptable.api,
34
37
  cellChange: cellDataChangedInfo,
@@ -42,7 +45,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
42
45
  * Fires Grid Data Changed Event - when a row has changed in AG Grid
43
46
  */
44
47
  fireGridDataChangedEvent(dataRows, rowNodes, rowTrigger) {
45
- if (this.adaptable.isLive) {
48
+ if (this.adaptable.isReady) {
46
49
  const gridDataChangedInfo = {
47
50
  changedAt: Date.now(),
48
51
  adaptableApi: this.adaptable.api,
@@ -92,7 +95,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
92
95
  const distinctValuesParams = {
93
96
  visibleRowsOnly: showFilteredRowsOnly,
94
97
  };
95
- const { gridCells, suppressClientSideFilter } = await this.adaptable.getDistinctFilterListValuesForColumn(abColumn, filter, distinctValuesParams);
98
+ const { gridCells, suppressClientSideFilter } = await this.getDistinctFilterListValuesForColumn(abColumn, filter, distinctValuesParams);
96
99
  const sortedDistinctValues = this.sortDistinctValues(gridCells, abColumn);
97
100
  let shouldShowValuesCount = false;
98
101
  const showValuesCountFunction = this.getColumnFilterOptions().valuesFilterOptions.showValuesCount;
@@ -132,6 +135,26 @@ class GridInternalApi extends ApiBase_1.ApiBase {
132
135
  suppressClientSideFilter,
133
136
  };
134
137
  }
138
+ async getDistinctFilterListValuesForColumn(column, filter, distinctValuesParams) {
139
+ var _a;
140
+ const filterPermittedValues = (_a = this.getUserInterfaceApi().getFilterPermittedValuesForColumn(column)) !== null && _a !== void 0 ? _a : {
141
+ suppressFilterSearchBar: false,
142
+ values: () => undefined,
143
+ };
144
+ let preparedPermittedValues = undefined;
145
+ try {
146
+ const filterPermittedValuesParams = Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(this.adaptable.api)), { column: column, searchFilter: filter });
147
+ preparedPermittedValues = await (filterPermittedValues === null || filterPermittedValues === void 0 ? void 0 : filterPermittedValues.values(filterPermittedValuesParams));
148
+ }
149
+ catch (error) {
150
+ this.adaptable.logger.consoleError(`Failed to load filter permitted values`, column, filter, error);
151
+ }
152
+ distinctValuesParams.permittedValues = preparedPermittedValues;
153
+ return {
154
+ suppressClientSideFilter: filterPermittedValues.suppressFilterSearchBar,
155
+ gridCells: this.adaptable.getDistinctValuesForColumn(column, distinctValuesParams),
156
+ };
157
+ }
135
158
  /**
136
159
  * Gets all distinct Custom Sort values for the Column with the given ColumnId
137
160
  * @param columnId Column to check
@@ -144,11 +167,24 @@ class GridInternalApi extends ApiBase_1.ApiBase {
144
167
  const distinctValuesParams = {
145
168
  visibleRowsOnly: false,
146
169
  };
147
- const gridCells = await this.adaptable.getDistinctCustomSortValuesForColumn(abColumn, distinctValuesParams);
170
+ const gridCells = await this.getDistinctCustomSortValuesForColumn(abColumn, distinctValuesParams);
148
171
  return this.sortDistinctValues(gridCells, abColumn).map((cv) => {
149
172
  return cv.normalisedValue;
150
173
  });
151
174
  }
175
+ async getDistinctCustomSortValuesForColumn(column, distinctValuesParams) {
176
+ const customSortPermittedValues = await this.getUserInterfaceApi().getCustomSortPermittedValuesForColumn(column);
177
+ let preparedPermittedValues = undefined;
178
+ try {
179
+ const permittedValuesParams = Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(this.adaptable.api)), { column: column });
180
+ preparedPermittedValues = await (customSortPermittedValues === null || customSortPermittedValues === void 0 ? void 0 : customSortPermittedValues.values(permittedValuesParams));
181
+ }
182
+ catch (error) {
183
+ this.adaptable.logger.consoleError(`Failed to load custom sort permitted values`, column, error);
184
+ }
185
+ distinctValuesParams.permittedValues = preparedPermittedValues;
186
+ return this.adaptable.getDistinctValuesForColumn(column, distinctValuesParams);
187
+ }
152
188
  /**
153
189
  * Gets all distinct Bulk Update values for the Column with the given ColumnId
154
190
  * @param columnId Column to check
@@ -162,11 +198,24 @@ class GridInternalApi extends ApiBase_1.ApiBase {
162
198
  const distinctValuesParams = {
163
199
  visibleRowsOnly: false,
164
200
  };
165
- const gridCells = await this.adaptable.getDistinctBulkUpdateValuesForColumn(abColumn, selectedGridCells, distinctValuesParams);
201
+ const gridCells = await this.getDistinctBulkUpdateValuesForColumn(abColumn, selectedGridCells, distinctValuesParams);
166
202
  return this.sortDistinctValues(gridCells, abColumn).map((cv) => {
167
203
  return cv.normalisedValue;
168
204
  });
169
205
  }
206
+ async getDistinctBulkUpdateValuesForColumn(column, selectedGridCells, distinctValuesParams) {
207
+ const bulkUpdatePermittedValues = await this.getUserInterfaceApi().getBulkUpdatePermittedValuesForColumn(column);
208
+ let preparedPermittedValues = undefined;
209
+ try {
210
+ const bulkUpdatePermittedValuesParams = Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(this.adaptable.api)), { column: column, gridCells: selectedGridCells });
211
+ preparedPermittedValues = await (bulkUpdatePermittedValues === null || bulkUpdatePermittedValues === void 0 ? void 0 : bulkUpdatePermittedValues.values(bulkUpdatePermittedValuesParams));
212
+ }
213
+ catch (error) {
214
+ this.adaptable.logger.consoleError(`Failed to load bulk permitted values`, error, column, selectedGridCells);
215
+ }
216
+ distinctValuesParams.permittedValues = preparedPermittedValues;
217
+ return this.adaptable.getDistinctValuesForColumn(column, distinctValuesParams);
218
+ }
170
219
  /**
171
220
  * Gets all distinct visible (after current filters are applied) display values in the Column with the given ColumnId
172
221
  * @param columnId Column to check
@@ -261,7 +310,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
261
310
  this.dispatchAction(GridRedux.GridSetSelectedRows(selectedRowInfo));
262
311
  }
263
312
  buildStandaloneColumnHeader(column) {
264
- return this.adaptable.buildStandaloneColumnHeader(column);
313
+ return this.adaptable.agGridMenuAdapter.buildStandaloneColumnHeader(column);
265
314
  }
266
315
  getEditLookUpValuesForColumn(editLookUpItem, column, gridCell) {
267
316
  if (!editLookUpItem || !column) {
@@ -289,5 +338,75 @@ class GridInternalApi extends ApiBase_1.ApiBase {
289
338
  // this will use the columnApi method that first looks for permitted values and then distinct values
290
339
  return this.getDistinctDisplayValuesForColumn(column.columnId);
291
340
  }
341
+ getAgGridDataType(dataType) {
342
+ if (!dataType) {
343
+ return 'abColDefString';
344
+ }
345
+ switch (dataType) {
346
+ case 'Boolean':
347
+ return 'abColDefBoolean';
348
+ case 'Date':
349
+ return 'abColDefDate';
350
+ case 'Number':
351
+ return 'abColDefNumber';
352
+ case 'Object':
353
+ return 'abColDefObject';
354
+ case 'String':
355
+ return 'abColDefString';
356
+ case 'NumberArray':
357
+ return 'abColDefNumberArray';
358
+ case 'TupleNumberArray':
359
+ return 'abColDefTupleNumberArray';
360
+ case 'ObjectNumberArray':
361
+ return 'abColDefObjectNumberArray';
362
+ default:
363
+ return 'abColDefCustom';
364
+ }
365
+ }
366
+ getRowHighlightStyle(params) {
367
+ var _a;
368
+ const primaryKeyValue = this.adaptable.getPrimaryKeyValueFromRowNode(params.node, params.api);
369
+ const highlightRow = (_a = this.getAdaptableApi()
370
+ .internalApi.getSystemState()
371
+ .HighlightedRows) === null || _a === void 0 ? void 0 : _a.find((highlightRow) => {
372
+ return highlightRow.primaryKeyValue === primaryKeyValue;
373
+ });
374
+ if (highlightRow) {
375
+ return (0, StyleHelper_1.convertAdaptableStyleToCSS)(highlightRow.highlightStyle);
376
+ }
377
+ }
378
+ getAlertRowStyle(params) {
379
+ var _a, _b;
380
+ const alert = this.getAlertApi().internalApi.getAdaptableAlertWithHighlightRow(params.node);
381
+ const highlightRow = (_b = (_a = alert === null || alert === void 0 ? void 0 : alert.alertDefinition) === null || _a === void 0 ? void 0 : _a.AlertProperties) === null || _b === void 0 ? void 0 : _b.HighlightRow;
382
+ if (highlightRow) {
383
+ return typeof highlightRow === 'object'
384
+ ? (0, StyleHelper_1.convertAdaptableStyleToCSS)(highlightRow)
385
+ : {
386
+ backgroundColor: UIHelper_1.default.getColorByMessageType(alert.alertDefinition.MessageType),
387
+ };
388
+ }
389
+ return null;
390
+ }
391
+ getAlertRowClass(params) {
392
+ var _a, _b;
393
+ const alert = this.getAlertApi().internalApi.getAdaptableAlertWithHighlightRow(params.node);
394
+ const highlightRow = (_b = (_a = alert === null || alert === void 0 ? void 0 : alert.alertDefinition) === null || _a === void 0 ? void 0 : _a.AlertProperties) === null || _b === void 0 ? void 0 : _b.HighlightRow;
395
+ return typeof highlightRow === 'object' && (highlightRow === null || highlightRow === void 0 ? void 0 : highlightRow.ClassName)
396
+ ? highlightRow === null || highlightRow === void 0 ? void 0 : highlightRow.ClassName
397
+ : null;
398
+ }
399
+ getRowHighlightClass(params) {
400
+ var _a;
401
+ const primaryKeyValue = this.adaptable.getPrimaryKeyValueFromRowNode(params.node, params.api);
402
+ const highlightRow = (_a = this.getAdaptableApi()
403
+ .internalApi.getSystemState()
404
+ .HighlightedRows) === null || _a === void 0 ? void 0 : _a.find((highlightRow) => {
405
+ return highlightRow.primaryKeyValue === primaryKeyValue;
406
+ });
407
+ return typeof (highlightRow === null || highlightRow === void 0 ? void 0 : highlightRow.highlightStyle) === 'object'
408
+ ? highlightRow.highlightStyle.ClassName
409
+ : null;
410
+ }
292
411
  }
293
412
  exports.GridInternalApi = GridInternalApi;
@@ -8,7 +8,7 @@ class TeamSharingInternalApi extends ApiBase_1.ApiBase {
8
8
  * @param sharedEntity Entity that has been changed
9
9
  */
10
10
  fireTeamSharingEntityChangedEvent(sharedEntity) {
11
- if (this.adaptable.isLive) {
11
+ if (this.adaptable.isReady) {
12
12
  const teamSharingEntityChangedInfo = {
13
13
  adaptableApi: this.adaptable.api,
14
14
  sharedEntity: sharedEntity,
@@ -0,0 +1,3 @@
1
+ export declare const ADAPTABLE_VERSION: any;
2
+ export declare const ADAPTABLE_PUBLISH_TIMESTAMP: any;
3
+ export declare const INFINITE_TABLE_LICENSE_KEY: any;
package/src/EnvVars.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INFINITE_TABLE_LICENSE_KEY = exports.ADAPTABLE_PUBLISH_TIMESTAMP = exports.ADAPTABLE_VERSION = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const env_1 = tslib_1.__importDefault(require("./env"));
6
+ exports.ADAPTABLE_VERSION = env_1.default.VERSION;
7
+ exports.ADAPTABLE_PUBLISH_TIMESTAMP = env_1.default.PUBLISH_TIMESTAMP;
8
+ exports.INFINITE_TABLE_LICENSE_KEY = env_1.default.INFINITE_TABLE_LICENSE_KEY;
@@ -16,3 +16,4 @@ export interface WeightedAverageAggregation {
16
16
  * Defines which Columns in a Layout display Aggregated values when Row-Grouped
17
17
  */
18
18
  export type AggregationColumns = Record<string, string | true | WeightedAverageAggregation>;
19
+ export declare const isWeightedAverageAggregation: (aggFunc: AggregationColumns[keyof AggregationColumns]) => aggFunc is WeightedAverageAggregation;
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WEIGHTED_AVERAGE_AGG_FN_NAME = void 0;
3
+ exports.isWeightedAverageAggregation = exports.WEIGHTED_AVERAGE_AGG_FN_NAME = void 0;
4
4
  exports.WEIGHTED_AVERAGE_AGG_FN_NAME = 'weightedAvg';
5
+ const isWeightedAverageAggregation = (aggFunc) => {
6
+ return (aggFunc === null || aggFunc === void 0 ? void 0 : aggFunc.type) === 'weightedAverage';
7
+ };
8
+ exports.isWeightedAverageAggregation = isWeightedAverageAggregation;
@@ -2,8 +2,7 @@ import * as Redux from 'redux';
2
2
  import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
3
3
  import { AdaptableState } from '../../PredefinedConfig/AdaptableState';
4
4
  import { ConfigState } from '../../PredefinedConfig/ConfigState';
5
- import { PredefinedConfig } from '../../PredefinedConfig/PredefinedConfig';
6
- import { IAdaptableStore } from './Interface/IAdaptableStore';
5
+ import { IAdaptableStore, LoadStoreConfig } from './Interface/IAdaptableStore';
7
6
  type EmitterCallback = (data?: any) => any;
8
7
  type EmitterAnyCallback = (eventName: string, data?: any) => any;
9
8
  export declare const INIT_STATE = "INIT_STATE";
@@ -22,7 +21,6 @@ export declare const LoadState: (State: {
22
21
  [s: string]: ConfigState;
23
22
  }) => LoadStateAction;
24
23
  export declare class AdaptableStore implements IAdaptableStore {
25
- private isAgGridReady;
26
24
  TheStore: Redux.Store<AdaptableState>;
27
25
  Load: Promise<any>;
28
26
  private emitter;
@@ -36,12 +34,12 @@ export declare class AdaptableStore implements IAdaptableStore {
36
34
  /**
37
35
  *
38
36
  * @param adaptable The Adaptable instance
39
- * @param isAgGridReady A promise which is resolved when AG Grid is ready for binding
37
+ * @param postLoadHook A function that hydrates the state after it has been loaded from storage
40
38
  */
41
- constructor(adaptable: IAdaptable, isAgGridReady: Promise<any>);
39
+ constructor(adaptable: IAdaptable);
42
40
  destroy(): void;
43
41
  getCurrentStorageState(): AdaptableState;
44
42
  saveStateNow(adaptable: IAdaptable): Promise<any>;
45
- loadStore: (adaptable: IAdaptable, adaptableStateKey: string, predefinedConfig?: PredefinedConfig) => Promise<any>;
43
+ loadStore: (config: LoadStoreConfig) => Promise<any>;
46
44
  }
47
45
  export {};
@@ -51,9 +51,9 @@ const TeamSharingState_1 = require("../../PredefinedConfig/TeamSharingState");
51
51
  exports.INIT_STATE = 'INIT_STATE';
52
52
  exports.LOAD_STATE = 'LOAD_STATE';
53
53
  const NON_PERSIST_ACTIONS = {
54
- [exports.LOAD_STATE]: true,
55
54
  '@@INIT': true,
56
55
  '@@redux/init': true,
56
+ [exports.LOAD_STATE]: true,
57
57
  [exports.INIT_STATE]: true,
58
58
  // progress indicators should NOT interfere with state management as it may lead to race conditions due to load/persist state being async
59
59
  [SystemRedux_1.SYSTEM_PROGRESS_INDICATOR_SHOW]: true,
@@ -72,13 +72,12 @@ class AdaptableStore {
72
72
  /**
73
73
  *
74
74
  * @param adaptable The Adaptable instance
75
- * @param isAgGridReady A promise which is resolved when AG Grid is ready for binding
75
+ * @param postLoadHook A function that hydrates the state after it has been loaded from storage
76
76
  */
77
- constructor(adaptable, isAgGridReady) {
77
+ constructor(adaptable) {
78
78
  /*
79
79
  This is the main store for Adaptable State
80
80
  */
81
- this.isAgGridReady = isAgGridReady;
82
81
  this.loadStorageInProgress = false;
83
82
  this.loadStateOnStartup = true; // set to false if you want no state
84
83
  this.on = (eventName, callback) => {
@@ -90,7 +89,9 @@ class AdaptableStore {
90
89
  this.emit = (eventName, data) => {
91
90
  return this.emitter.emit(eventName, data);
92
91
  };
93
- this.loadStore = (adaptable, adaptableStateKey, predefinedConfig) => {
92
+ this.loadStore = (config) => {
93
+ const { adaptable, adaptableStateKey, predefinedConfig, postLoadHook } = config;
94
+ const postProcessState = postLoadHook !== null && postLoadHook !== void 0 ? postLoadHook : ((state) => state);
94
95
  this.storageEngine.setStateKey(adaptableStateKey);
95
96
  // START STATE LOAD
96
97
  this.loadStorageInProgress = true;
@@ -98,17 +99,15 @@ class AdaptableStore {
98
99
  .load(predefinedConfig)
99
100
  .then((storedState) => {
100
101
  if (storedState && this.loadStateOnStartup) {
101
- this.TheStore.dispatch((0, exports.LoadState)(adaptable.adaptableOptions.stateOptions.applyState(storedState)));
102
+ this.TheStore.dispatch((0, exports.LoadState)(postProcessState(adaptable.adaptableOptions.stateOptions.applyState(storedState))));
102
103
  }
103
104
  })
104
- // we need AG Grid to be ready because several states(ex. Layout) depend on its API
105
- .then(() => this.isAgGridReady)
106
105
  .then(() => {
107
106
  this.TheStore.dispatch((0, exports.InitState)());
108
107
  // END STATE LOAD
109
108
  this.loadStorageInProgress = false;
110
109
  }, (e) => {
111
- adaptable.logger.error('Failed to load previous Adaptable State : ', e);
110
+ adaptable.logger.consoleError('Failed to load previous Adaptable State : ', e);
112
111
  //for now i'm still initializing Adaptable even if loading state has failed....
113
112
  //we may revisit that later
114
113
  this.TheStore.dispatch((0, exports.InitState)());
@@ -166,17 +165,6 @@ class AdaptableStore {
166
165
  case exports.LOAD_STATE:
167
166
  const { State } = action;
168
167
  Object.keys(State).forEach((key) => {
169
- // this check should be removed in version 12 !!!
170
- if (key === 'Chart') {
171
- adaptable.logger.consoleWarn(`DEPRECATED: AdapTable Charts Plugin is deprecated! AG Grid built-in charts are fully supported & integrated in AdapTable.
172
-
173
- Please contact 'support@adaptabletools.com' if you require any charting features that are not currently available.`);
174
- }
175
- if (key === 'SparklineColumn') {
176
- adaptable.logger.consoleWarn(`DEPRECATED: AdapTable SparklineColumn is deprecated! AG Grid built-in Sparklines are fully supported & integrated in AdapTable.
177
-
178
- Please contact 'support@adaptabletools.com' if you require any sparklines features that are not currently available.`);
179
- }
180
168
  state[key] = State[key];
181
169
  });
182
170
  break;
@@ -257,7 +245,6 @@ class AdaptableStore {
257
245
  ...pluginsMiddleware // the plugins middleware
258
246
  )));
259
247
  this.storageEngine = storageEngine;
260
- this.loadStore(adaptable, adaptable.adaptableOptions.adaptableStateKey);
261
248
  }
262
249
  destroy() {
263
250
  var _a;
@@ -345,7 +332,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
345
332
  }
346
333
  case SystemRedux.SYSTEM_FLASHING_CELL_DELETE_ALL: {
347
334
  let ret = next(action);
348
- adaptable.redrawRenderedRows();
335
+ adaptable.redrawBody();
349
336
  return ret;
350
337
  }
351
338
  /*******************
@@ -401,7 +388,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
401
388
  });
402
389
  }
403
390
  // called also for rendered column actions, see RENDERED COLUMN ACTIONS block
404
- adaptable.setupColumns();
391
+ adaptable.updateColumnModelAndRefreshGrid();
405
392
  return returnAction;
406
393
  }
407
394
  /*******************
@@ -416,7 +403,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
416
403
  case FlashingCellRedux.FLASHING_CELL_DEFINITION_SUSPEND_ALL: {
417
404
  const returnAction = next(action);
418
405
  // called also for rendered column actions, see RENDERED COLUMN ACTIONS block
419
- adaptable.setupColumns();
406
+ adaptable.updateColumnModelAndRefreshGrid();
420
407
  return returnAction;
421
408
  }
422
409
  /**
@@ -581,11 +568,6 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
581
568
  /*******************
582
569
  * SPECIAL COLUMN ACTIONS
583
570
  *******************/
584
- case CalculatedColumnRedux.CALCULATED_COLUMN_READY: {
585
- // create aggregated scalar columns at grid startup
586
- adaptable.api.calculatedColumnApi.refreshAggregatedCalculatedColumns();
587
- return;
588
- }
589
571
  /**
590
572
  * Use Case: We have added / edited / deleted a Special Column (i.e. one not in initial ColumnDefs)
591
573
  * Action: We update the Special ColumnDefs
@@ -603,7 +585,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
603
585
  .createAggregatedScalarLiveValue(returnAction.calculatedColumn);
604
586
  adaptable.api.calculatedColumnApi.internalApi.fireCalculatedColumnChangedEvent(action.type, actionTyped.calculatedColumn);
605
587
  }
606
- adaptable.updateColDefsForSpecialColumns();
588
+ adaptable.updateColumnModelAndRefreshGrid();
607
589
  return returnAction;
608
590
  }
609
591
  /**
@@ -628,7 +610,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
628
610
  .getCalculatedColumnExpressionService()
629
611
  .destroyAggregatedScalarLiveValue(returnAction.calculatedColumn);
630
612
  adaptable.api.calculatedColumnApi.internalApi.fireCalculatedColumnChangedEvent(action.type, actionTyped.calculatedColumn);
631
- adaptable.updateColDefsForSpecialColumns();
613
+ adaptable.updateColumnModelAndRefreshGrid();
632
614
  return returnAction;
633
615
  }
634
616
  /**
@@ -649,7 +631,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
649
631
  return;
650
632
  }
651
633
  const returnAction = next(action);
652
- adaptable.updateColDefsForSpecialColumns();
634
+ adaptable.updateColumnModelAndRefreshGrid();
653
635
  return returnAction;
654
636
  }
655
637
  /*******************
@@ -686,7 +668,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
686
668
  case CustomSortRedux.CUSTOM_SORT_UNSUSPEND_ALL: {
687
669
  const returnAction = next(action);
688
670
  // called also for alert actions, see ALERT ACTIONS block
689
- adaptable.setupColumns();
671
+ adaptable.updateColumnModelAndRefreshGrid();
690
672
  return returnAction;
691
673
  }
692
674
  /*******************
@@ -1663,24 +1645,14 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
1663
1645
  *******************/
1664
1646
  case exports.INIT_STATE: {
1665
1647
  let returnAction = next(action);
1666
- if (adaptable.isDestroyed) {
1667
- return returnAction;
1668
- }
1669
- // make sure we have the grid columns in state, before we do any layout work
1670
- adaptable.updateColumnsIntoStore();
1671
- const layoutState = middlewareAPI.getState().Layout;
1672
- const defaultLayout = adaptable.api.layoutApi.internalApi.createDefaultLayoutIfNeeded();
1673
- let currentLayout = (layoutState === null || layoutState === void 0 ? void 0 : layoutState.CurrentLayout) || (defaultLayout === null || defaultLayout === void 0 ? void 0 : defaultLayout.Name);
1674
- if (!adaptable.api.layoutApi.getLayoutByName(currentLayout)) {
1675
- currentLayout = defaultLayout ? defaultLayout.Name : layoutState.Layouts[0].Name;
1648
+ if (adaptable.isReady) {
1649
+ // TODO see #create-create-module-menu
1650
+ // create the module menu (for use in the dashboard and the toolpanel)
1651
+ // we need this here for when the state key is changed
1652
+ // since we need the transient state to be restored in the same
1653
+ // way as when Adaptable is initialised.
1654
+ adaptable.ModuleService.createModuleMenus();
1676
1655
  }
1677
- middlewareAPI.dispatch(LayoutRedux.LayoutSelect(currentLayout));
1678
- // do this now so it sets module entitlements
1679
- adaptable.EntitlementService.setModulesEntitlements();
1680
- // create the module menu (for use in the dashboard and the toolpanel)
1681
- adaptable.ModuleService.createModuleMenus();
1682
- // update initial mode of DataChangeHistory
1683
- adaptable.api.internalApi.initializeDataChangeHistory();
1684
1656
  return returnAction;
1685
1657
  }
1686
1658
  default: {
@@ -2,10 +2,16 @@ import * as Redux from 'redux';
2
2
  import { AdaptableState } from '../../../PredefinedConfig/AdaptableState';
3
3
  import { PredefinedConfig } from '../../../types';
4
4
  import { IAdaptable } from '../../../AdaptableInterfaces/IAdaptable';
5
+ export interface LoadStoreConfig {
6
+ adaptable: IAdaptable;
7
+ adaptableStateKey: string;
8
+ predefinedConfig?: PredefinedConfig;
9
+ postLoadHook?: (state: AdaptableState) => AdaptableState;
10
+ }
5
11
  export interface IAdaptableStore {
6
12
  TheStore: Redux.Store<AdaptableState>;
7
13
  Load: PromiseLike<any>;
8
- loadStore: (adaptable: IAdaptable, adaptableStateKey: string, predefinedConfig?: PredefinedConfig) => PromiseLike<any>;
14
+ loadStore: (config: LoadStoreConfig) => PromiseLike<any>;
9
15
  getCurrentStorageState: () => AdaptableState | void;
10
16
  saveStateNow: (adaptable: IAdaptable) => Promise<any>;
11
17
  on: (eventName: string, callback: (data?: any) => any) => () => void;