@adaptabletools/adaptable 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 +9 -26
  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 +106 -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 +70 -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 +59 -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 +4 -0
  52. package/src/PredefinedConfig/Common/AggregationColumns.d.ts +1 -0
  53. package/src/PredefinedConfig/Common/AggregationColumns.js +3 -0
  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 +1 -0
  103. package/src/Utilities/Helpers/AdaptableHelper.d.ts +0 -3
  104. package/src/Utilities/Helpers/AdaptableHelper.js +0 -58
  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 +8 -5292
  126. package/src/agGrid/AdaptableAgGrid.d.ts +336 -0
  127. package/src/agGrid/AdaptableAgGrid.js +3780 -0
  128. package/src/agGrid/AdaptableLogger.js +77 -11
  129. package/src/agGrid/AgGridAdapter.d.ts +54 -0
  130. package/src/agGrid/AgGridAdapter.js +549 -0
  131. package/src/agGrid/AgGridColumnAdapter.d.ts +56 -0
  132. package/src/agGrid/AgGridColumnAdapter.js +813 -0
  133. package/src/agGrid/AgGridMenuAdapter.d.ts +28 -0
  134. package/src/agGrid/AgGridMenuAdapter.js +271 -0
  135. package/src/agGrid/AgGridOptionsService.d.ts +11 -0
  136. package/src/agGrid/AgGridOptionsService.js +50 -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} +69 -8
  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 +4 -3
  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 +48 -0
  155. package/src/migration/VersionUpgrade.d.ts +8 -0
  156. package/src/migration/VersionUpgrade.js +11 -0
  157. package/src/migration/VersionUpgrade17.d.ts +18 -0
  158. package/src/migration/VersionUpgrade17.js +342 -0
  159. package/src/migration/VersionUpgrade18.d.ts +5 -0
  160. package/src/migration/VersionUpgrade18.js +6 -0
  161. package/src/types.d.ts +5 -4
  162. package/tsconfig.esm.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 -1
  166. package/src/agGrid/agGridHelper.d.ts +0 -57
  167. package/src/agGrid/agGridHelper.js +0 -686
  168. package/src/agGrid/agGridMenuHelper.d.ts +0 -46
  169. package/src/agGrid/agGridMenuHelper.js +0 -668
@@ -1,8 +1,8 @@
1
1
  import { InfiniteTable } from '@infinite-table/infinite-react';
2
2
  export * from '@infinite-table/infinite-react';
3
- import env from '../../env';
3
+ import { INFINITE_TABLE_LICENSE_KEY } from '../../EnvVars';
4
4
  const defaultProps = InfiniteTable.defaultProps;
5
- defaultProps.licenseKey = env.INFINITE_TABLE_LICENSE_KEY;
5
+ defaultProps.licenseKey = INFINITE_TABLE_LICENSE_KEY;
6
6
  defaultProps.sortable = false;
7
7
  defaultProps.rowHeight = '--ab-grid-row-height';
8
8
  defaultProps.draggableColumns = false;
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { FlexProps } from 'rebass';
3
+ export declare const ensurePortalElement: () => HTMLElement;
3
4
  export interface ModalProps extends FlexProps {
4
5
  isOpen?: boolean;
5
6
  baseZIndex?: number;
@@ -9,15 +9,16 @@ import { baseClassName, default as Backdrop } from './Backdrop';
9
9
  import { createUuid } from '../utils/uuid';
10
10
  import { isBrowserDocumentAvailable } from '../../View/UIHelper';
11
11
  let portalElement;
12
- const ensurePortalElement = () => {
12
+ export const ensurePortalElement = () => {
13
13
  if (!isBrowserDocumentAvailable()) {
14
- return;
14
+ return null;
15
15
  }
16
16
  if (portalElement) {
17
- return;
17
+ return portalElement;
18
18
  }
19
19
  portalElement = document.createElement('div');
20
20
  document.body.appendChild(portalElement);
21
+ return portalElement;
21
22
  };
22
23
  let globalCounter = 0;
23
24
  export const Modal = (props) => {
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  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: 1710512529508 || Date.now(),
4
- VERSION: "18.0.0-canary.4" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1710513512221 || Date.now(),
4
+ VERSION: "18.0.0-canary.5" || '--current-version--',
5
5
  };
@@ -681,6 +681,15 @@ export declare const ADAPTABLE_METAMODEL: {
681
681
  noCode: string;
682
682
  defVal?: undefined;
683
683
  ref?: undefined;
684
+ } | {
685
+ name: string;
686
+ kind: string;
687
+ desc: string;
688
+ isOpt: boolean;
689
+ defVal: string;
690
+ gridInfo?: undefined;
691
+ noCode?: undefined;
692
+ ref?: undefined;
684
693
  } | {
685
694
  name: string;
686
695
  kind: string;
@@ -735,15 +744,6 @@ export declare const ADAPTABLE_METAMODEL: {
735
744
  gridInfo?: undefined;
736
745
  defVal?: undefined;
737
746
  ref?: undefined;
738
- } | {
739
- name: string;
740
- kind: string;
741
- desc: string;
742
- isOpt: boolean;
743
- defVal: string;
744
- gridInfo?: undefined;
745
- noCode?: undefined;
746
- ref?: undefined;
747
747
  } | {
748
748
  name: string;
749
749
  kind: string;
@@ -1188,6 +1188,13 @@ export const ADAPTABLE_METAMODEL = {
1188
1188
  "gridInfo": "item",
1189
1189
  "defVal": "false"
1190
1190
  },
1191
+ {
1192
+ "name": "autoMigrateState",
1193
+ "kind": "b",
1194
+ "desc": "Automatically migrate the state from the previous version of Adaptable to the current version.",
1195
+ "isOpt": true,
1196
+ "defVal": "true"
1197
+ },
1191
1198
  {
1192
1199
  "name": "calendarOptions",
1193
1200
  "kind": "R",
@@ -0,0 +1,38 @@
1
+ import { VersionUpgrade } from './VersionUpgrade';
2
+ import { AdaptableState } from '../PredefinedConfig/AdaptableState';
3
+ /**
4
+ * The upgrade config object
5
+ */
6
+ export interface UpgradeConfig {
7
+ /**
8
+ * The version to upgrade from
9
+ */
10
+ fromVersion: number;
11
+ /**
12
+ * The version to upgrade to
13
+ *
14
+ * @defaultValue The current version
15
+ */
16
+ toVersion?: number;
17
+ /**
18
+ * The logger object
19
+ *
20
+ * @defaultValue The console object
21
+ */
22
+ logger?: MigrationLogger;
23
+ }
24
+ export interface MigrationLogger {
25
+ success: (message: string, ...optionalParams: any[]) => void;
26
+ info: (message: string, ...optionalParams: any[]) => void;
27
+ warn: (message: string, ...optionalParams: any[]) => void;
28
+ error: (message: string, ...optionalParams: any[]) => void;
29
+ }
30
+ export declare class AdaptableUpgradeHelper {
31
+ protected currentMajorVersion: number;
32
+ protected versionUpgrades: Map<number, VersionUpgrade>;
33
+ protected logger: MigrationLogger;
34
+ private constructor();
35
+ static migrateAdaptableState(state: AdaptableState, config: UpgradeConfig): AdaptableState;
36
+ private getCurrentMajorVersion;
37
+ private getConsoleLogger;
38
+ }
@@ -0,0 +1,48 @@
1
+ import { VersionUpgrade17 } from './VersionUpgrade17';
2
+ import { VersionUpgrade18 } from './VersionUpgrade18';
3
+ import { ADAPTABLE_VERSION } from '../EnvVars';
4
+ export class AdaptableUpgradeHelper {
5
+ constructor(logger) {
6
+ this.currentMajorVersion = this.getCurrentMajorVersion(ADAPTABLE_VERSION);
7
+ this.logger = logger || this.getConsoleLogger();
8
+ this.versionUpgrades = new Map();
9
+ this.versionUpgrades.set(17, new VersionUpgrade17(this.logger));
10
+ this.versionUpgrades.set(18, new VersionUpgrade18(this.logger));
11
+ }
12
+ static migrateAdaptableState(state, config) {
13
+ const upgradeHelper = new AdaptableUpgradeHelper(config.logger);
14
+ let fromVersion = (config === null || config === void 0 ? void 0 : config.fromVersion) || 16;
15
+ const toVersion = (config === null || config === void 0 ? void 0 : config.toVersion) || upgradeHelper.currentMajorVersion;
16
+ if (fromVersion >= toVersion) {
17
+ console.warn(`The fromVersion (${fromVersion}) should be less than toVersion (${toVersion})!`);
18
+ return state;
19
+ }
20
+ if (fromVersion < 16) {
21
+ // until version 16 we didn't have versioning
22
+ fromVersion = 16;
23
+ }
24
+ const versionUpgrades = Array.from(upgradeHelper.versionUpgrades.keys());
25
+ let updatedState = structuredClone(state);
26
+ for (const version of versionUpgrades) {
27
+ if (version > fromVersion && version <= toVersion) {
28
+ upgradeHelper.logger.info(`Migration to ${version} started...`);
29
+ updatedState = upgradeHelper.versionUpgrades.get(version).migrateState(updatedState);
30
+ upgradeHelper.logger.info(`Migration to ${version} finished!`);
31
+ }
32
+ }
33
+ return updatedState;
34
+ }
35
+ getCurrentMajorVersion(version) {
36
+ // is good enough for now, we just need to make sure we don't forget to update it
37
+ // TODO AFL is there a better way to do this for local development?
38
+ return parseInt(version.split('.')[0]) || 18;
39
+ }
40
+ getConsoleLogger() {
41
+ return {
42
+ success: console.log,
43
+ info: console.info,
44
+ warn: console.warn,
45
+ error: console.error,
46
+ };
47
+ }
48
+ }
@@ -0,0 +1,8 @@
1
+ import { AdaptableState } from '../PredefinedConfig/AdaptableState';
2
+ import { MigrationLogger } from './AdaptableUpgradeHelper';
3
+ export declare abstract class VersionUpgrade {
4
+ protected logger: MigrationLogger;
5
+ constructor(logger: MigrationLogger);
6
+ abstract migrateState(state: AdaptableState): AdaptableState;
7
+ protected migrateStateWithMethods(state: AdaptableState, methods: ((state: AdaptableState) => AdaptableState)[]): AdaptableState;
8
+ }
@@ -0,0 +1,11 @@
1
+ export class VersionUpgrade {
2
+ constructor(logger) {
3
+ this.logger = logger;
4
+ }
5
+ migrateStateWithMethods(state, methods) {
6
+ for (let method of methods) {
7
+ state = method.call(this, state);
8
+ }
9
+ return state;
10
+ }
11
+ }
@@ -0,0 +1,18 @@
1
+ import { VersionUpgrade } from './VersionUpgrade';
2
+ import { AdaptableState } from '../PredefinedConfig/AdaptableState';
3
+ export declare class VersionUpgrade17 extends VersionUpgrade {
4
+ migrateState(state: AdaptableState): AdaptableState;
5
+ private migrateChartingState;
6
+ private migrateColumnFilterState;
7
+ private migrateDashboardState;
8
+ private migrateFlashinCellState;
9
+ private migrateFormatColumnState;
10
+ private migrateFreeTextColumnState;
11
+ private migrateGridFilterState;
12
+ private migrateNamedQueryState;
13
+ private migrateStyledColumnState;
14
+ private migrateToolPanelState;
15
+ private migrateAlertState;
16
+ private migrateCalculatedColumnState;
17
+ private migrateUserState;
18
+ }
@@ -0,0 +1,342 @@
1
+ import { VersionUpgrade } from './VersionUpgrade';
2
+ import { updateSingleToMultiplePredicates } from '../Strategy/Utilities/updateSingleToMultiplePredicates';
3
+ import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
4
+ import ObjectFactory from '../Utilities/ObjectFactory';
5
+ import StringExtensions from '../Utilities/Extensions/StringExtensions';
6
+ export class VersionUpgrade17 extends VersionUpgrade {
7
+ migrateState(state) {
8
+ return this.migrateStateWithMethods(state, [
9
+ this.migrateCalculatedColumnState,
10
+ this.migrateAlertState,
11
+ this.migrateToolPanelState,
12
+ this.migrateStyledColumnState,
13
+ this.migrateNamedQueryState,
14
+ this.migrateGridFilterState,
15
+ this.migrateFreeTextColumnState,
16
+ this.migrateFormatColumnState,
17
+ this.migrateFlashinCellState,
18
+ this.migrateDashboardState,
19
+ this.migrateColumnFilterState,
20
+ this.migrateChartingState,
21
+ ]);
22
+ }
23
+ migrateChartingState(state) {
24
+ var _a;
25
+ // const allChartDefinitions = this.api.chartingApi.getChartDefinitions();
26
+ const allChartDefinitions = (_a = state.Charting) === null || _a === void 0 ? void 0 : _a.ChartDefinitions;
27
+ if (Array.isArray(allChartDefinitions)) {
28
+ allChartDefinitions
29
+ .filter((chartDefinition) => 'model' in chartDefinition || !('Name' in chartDefinition))
30
+ .forEach((charDefinition) => {
31
+ if ('model' in charDefinition) {
32
+ charDefinition.Model = charDefinition.model;
33
+ delete charDefinition.model;
34
+ }
35
+ if (!('Name' in charDefinition)) {
36
+ // default to chartId
37
+ // @ts-ignore possible because First iteration had no 'Name' and model was under 'model' key (lowercase)
38
+ charDefinition.Name = charDefinition.Model.chartId;
39
+ }
40
+ });
41
+ }
42
+ return state;
43
+ }
44
+ migrateColumnFilterState(state) {
45
+ var _a, _b, _c, _d, _e;
46
+ // Update Module Buttons
47
+ const moduleButtons = (_a = state.Dashboard) === null || _a === void 0 ? void 0 : _a.ModuleButtons;
48
+ if ((moduleButtons === null || moduleButtons === void 0 ? void 0 : moduleButtons.length) && !moduleButtons.includes('ColumnFilter')) {
49
+ const dashboardState = (_b = state.Dashboard) !== null && _b !== void 0 ? _b : {};
50
+ dashboardState.ModuleButtons = moduleButtons.map((moduleButton) => {
51
+ if (moduleButton == 'Filter') {
52
+ return 'ColumnFilter';
53
+ }
54
+ return moduleButton;
55
+ });
56
+ }
57
+ // Update Toolbars
58
+ const tabs = (_c = state.Dashboard) === null || _c === void 0 ? void 0 : _c.Tabs;
59
+ if (Array.isArray(tabs)) {
60
+ state.Dashboard.Tabs = tabs.map((tab) => {
61
+ if (tab.Toolbars.includes('Filter') &&
62
+ !tab.Toolbars.includes('ColumnFilter')) {
63
+ return Object.assign(Object.assign({}, tab), {
64
+ // replace with 'GridFilter'
65
+ Toolbars: tab.Toolbars.map((t) => (t == 'Filter' ? 'ColumnFilter' : t)) });
66
+ }
67
+ return tab;
68
+ });
69
+ }
70
+ // - move pinned toolbars
71
+ const pinnedToolbars = (_d = state.Dashboard) === null || _d === void 0 ? void 0 : _d.PinnedToolbars;
72
+ if (pinnedToolbars && !(pinnedToolbars === null || pinnedToolbars === void 0 ? void 0 : pinnedToolbars.includes('ColumnFilter'))) {
73
+ state.Dashboard.PinnedToolbars = pinnedToolbars.map((pinnedToolbar) => {
74
+ if (pinnedToolbar == 'Filter') {
75
+ return 'ColumnFilter';
76
+ }
77
+ return pinnedToolbar;
78
+ });
79
+ }
80
+ // Update Status Bar
81
+ const statusBars = (_e = state.StatusBar) === null || _e === void 0 ? void 0 : _e.StatusBars;
82
+ if (statusBars) {
83
+ state.StatusBar.StatusBars = statusBars.map((panel) => {
84
+ return Object.assign(Object.assign({}, panel), { StatusBarPanels: panel.StatusBarPanels.map((panel) => {
85
+ if (panel === 'Filter') {
86
+ return 'ColumnFilter';
87
+ }
88
+ return panel;
89
+ }) });
90
+ });
91
+ }
92
+ return state;
93
+ }
94
+ migrateDashboardState(state) {
95
+ // let dashboardState: any = this.api.dashboardApi.getDashboardState();
96
+ let dashboardState = state.Dashboard;
97
+ if (dashboardState === null || dashboardState === void 0 ? void 0 : dashboardState.VisibleButtons) {
98
+ this.logger.warn(`Updating Obsolete VisibleButtons Config for DashboardState: [${dashboardState.VisibleButtons}]`);
99
+ state.Dashboard.ModuleButtons = [
100
+ ...state.Dashboard.ModuleButtons,
101
+ ...dashboardState.VisibleButtons,
102
+ ];
103
+ //@ts-ignore delete as no longer needed
104
+ delete state.Dashboard.VisibleButtons;
105
+ }
106
+ return state;
107
+ }
108
+ migrateFlashinCellState(state) {
109
+ const flashingCellState = state.FlashingCell;
110
+ if (Array.isArray(flashingCellState === null || flashingCellState === void 0 ? void 0 : flashingCellState.FlashingCellDefinitions)) {
111
+ flashingCellState.FlashingCellDefinitions.forEach((flashingCellDefinition) => {
112
+ if (flashingCellDefinition.Rule && 'Predicate' in flashingCellDefinition.Rule) {
113
+ updateSingleToMultiplePredicates(flashingCellDefinition.Rule);
114
+ }
115
+ });
116
+ }
117
+ return state;
118
+ }
119
+ migrateFormatColumnState(state) {
120
+ var _a, _b, _c, _d;
121
+ // const formatColumns = this.api.formatColumnApi.getFormatColumns();
122
+ const formatColumns = ((_a = state.FormatColumn) === null || _a === void 0 ? void 0 : _a.FormatColumns) || [];
123
+ formatColumns.forEach((formatColumn) => {
124
+ if (formatColumn.Rule && 'Predicate' in formatColumn.Rule) {
125
+ //@ts-ignore ignore
126
+ updateSingleToMultiplePredicates(formatColumn.Rule);
127
+ }
128
+ });
129
+ // update ConditionalStyle StatusBarPanel
130
+ // const oldStatusBars = this.api.internalApi.getState().StatusBar.StatusBars;
131
+ const statusBars = ((_b = state.StatusBar) === null || _b === void 0 ? void 0 : _b.StatusBars) || [];
132
+ let replaceConditionalStyleStatusBar = false;
133
+ statusBars.forEach((statusBar) => (Object.assign(Object.assign({}, statusBar), { StatusBarPanels: [
134
+ ...new Set(statusBar.StatusBarPanels.map((statusBarPanel) => {
135
+ if (statusBarPanel === 'ConditionalStyle') {
136
+ replaceConditionalStyleStatusBar = true;
137
+ return 'FormatColumn';
138
+ }
139
+ return statusBarPanel;
140
+ })),
141
+ ] })));
142
+ // update ConditionalStyle dashboard buttons
143
+ // const dashboardModuleButtons = this.api.internalApi.getState().Dashboard.ModuleButtons as any;
144
+ const dashboardModuleButtons = (_c = state.Dashboard) === null || _c === void 0 ? void 0 : _c.ModuleButtons;
145
+ if (dashboardModuleButtons && dashboardModuleButtons.includes('ConditionalStyle')) {
146
+ dashboardModuleButtons[dashboardModuleButtons.indexOf('ConditionalStyle')] = 'FormatColumn';
147
+ }
148
+ // update ConditionalStyle toolPanel buttons
149
+ // const toolPanelModuleButtons = this.api.internalApi.getState().ToolPanel.ModuleButtons as any;
150
+ const toolPanelModuleButtons = (_d = state.ToolPanel) === null || _d === void 0 ? void 0 : _d.ModuleButtons;
151
+ if (toolPanelModuleButtons && toolPanelModuleButtons.includes('ConditionalStyle')) {
152
+ toolPanelModuleButtons[toolPanelModuleButtons.indexOf('ConditionalStyle')] = 'FormatColumn';
153
+ }
154
+ return state;
155
+ }
156
+ migrateFreeTextColumnState(state) {
157
+ var _a;
158
+ // make sure all default to type string
159
+ const allFreeTextColumns = ((_a = state.FreeTextColumn) === null || _a === void 0 ? void 0 : _a.FreeTextColumns) || [];
160
+ for (const freeTextColumn of allFreeTextColumns) {
161
+ const unTypedCol = freeTextColumn;
162
+ if (unTypedCol.DataType) {
163
+ const dataType = unTypedCol.DataType;
164
+ delete unTypedCol['DataType'];
165
+ if (!freeTextColumn.FreeTextColumnSettings) {
166
+ freeTextColumn.FreeTextColumnSettings = {
167
+ DataType: dataType,
168
+ };
169
+ }
170
+ else {
171
+ freeTextColumn.FreeTextColumnSettings.DataType = dataType;
172
+ }
173
+ }
174
+ if (!freeTextColumn.FreeTextColumnSettings) {
175
+ freeTextColumn.FreeTextColumnSettings = {
176
+ DataType: 'String',
177
+ };
178
+ }
179
+ if (!freeTextColumn.FreeTextColumnSettings.DataType) {
180
+ freeTextColumn.FreeTextColumnSettings.DataType = 'String';
181
+ }
182
+ }
183
+ return state;
184
+ }
185
+ migrateGridFilterState(state) {
186
+ var _a, _b;
187
+ const oldQueryState = state.Query;
188
+ if (!oldQueryState) {
189
+ return state;
190
+ }
191
+ // - move query to current layout
192
+ const expression = oldQueryState.CurrentQuery;
193
+ const currentLayout = (_a = state.Layout.Layouts) === null || _a === void 0 ? void 0 : _a.find((l) => l.Name === state.Layout.CurrentLayout);
194
+ const currentGridFilter = currentLayout === null || currentLayout === void 0 ? void 0 : currentLayout.GridFilter;
195
+ const currentGridFilterExpression = currentGridFilter && !currentGridFilter.IsSuspended ? currentGridFilter.Expression || '' : '';
196
+ if (expression && StringExtensions.IsNullOrEmpty(currentGridFilterExpression)) {
197
+ currentLayout.GridFilter = Object.assign(Object.assign({}, currentGridFilter), { Expression: expression });
198
+ }
199
+ // - move dashboard/toolbar
200
+ (_b = state.Dashboard.Tabs) === null || _b === void 0 ? void 0 : _b.forEach((tab) => {
201
+ if (tab.Toolbars.includes('Query')) {
202
+ tab.Toolbars = tab.Toolbars.map((t) => (t == 'Query' ? 'GridFilter' : t));
203
+ }
204
+ });
205
+ // - move pinned toolbars
206
+ let updatePinnedToolbars = false;
207
+ if (state.Dashboard.PinnedToolbars) {
208
+ state.Dashboard.PinnedToolbars = state.Dashboard.PinnedToolbars.map((pinnedToolbar) => {
209
+ if (pinnedToolbar == 'Query') {
210
+ return 'GridFilter';
211
+ }
212
+ return pinnedToolbar;
213
+ });
214
+ }
215
+ return state;
216
+ }
217
+ migrateNamedQueryState(state) {
218
+ // - move named queries from old Query State to this Module
219
+ // Note: GridFilter Module moves the "old" CurrentQuery into Layout
220
+ // const oldQueryState: QueryState = this.api.internalApi.getAdaptableState().Query;
221
+ const oldQueryState = state.Query;
222
+ const oldNamedQueries = oldQueryState === null || oldQueryState === void 0 ? void 0 : oldQueryState.NamedQueries;
223
+ if (ArrayExtensions.IsNotNullOrEmpty(oldNamedQueries)) {
224
+ const currentNamedQueries = state.NamedQuery.NamedQueries;
225
+ oldNamedQueries.forEach((oldNamedQuery) => {
226
+ var _a, _b;
227
+ const currentQuery = currentNamedQueries.find((q) => q.Name === oldNamedQuery.Name);
228
+ if (!currentQuery) {
229
+ (_b = (_a = state.NamedQuery) === null || _a === void 0 ? void 0 : _a.NamedQueries) === null || _b === void 0 ? void 0 : _b.push(oldNamedQuery);
230
+ }
231
+ });
232
+ }
233
+ if (oldQueryState) {
234
+ delete state.Query;
235
+ }
236
+ return state;
237
+ }
238
+ migrateStyledColumnState(state) {
239
+ var _a, _b, _c, _d;
240
+ var _e;
241
+ const formatColumnsWithColumnStyles = ((_b = (_a = state.FormatColumn) === null || _a === void 0 ? void 0 : _a.FormatColumns) === null || _b === void 0 ? void 0 : _b.filter((fc) => fc.ColumnStyle)) || [];
242
+ if (!formatColumnsWithColumnStyles.length) {
243
+ return state;
244
+ }
245
+ this.logger.info(`Converting ${formatColumnsWithColumnStyles.length} FormatColumns Styles to Styled Columns`, formatColumnsWithColumnStyles);
246
+ // delete the format columns with column styles
247
+ state.FormatColumn.FormatColumns = (_c = state.FormatColumn.FormatColumns) === null || _c === void 0 ? void 0 : _c.filter((fc) => !fc.ColumnStyle);
248
+ const styledColumns = formatColumnsWithColumnStyles
249
+ .map((formatColumn) => {
250
+ if (!('ColumnIds' in formatColumn.Scope)) {
251
+ return null;
252
+ }
253
+ return Object.assign(Object.assign(Object.assign({}, ObjectFactory.CreateEmptyStyledColumn()), { ColumnId: formatColumn.Scope.ColumnIds[0] }), formatColumn.ColumnStyle);
254
+ })
255
+ .filter(Boolean);
256
+ (_d = (_e = state.StyledColumn).StyledColumns) !== null && _d !== void 0 ? _d : (_e.StyledColumns = []);
257
+ styledColumns.forEach((styledColumn) => {
258
+ state.StyledColumn.StyledColumns.push(styledColumn);
259
+ });
260
+ return state;
261
+ }
262
+ migrateToolPanelState(state) {
263
+ var _a;
264
+ // const deprecatedToolPanelConfigs: AdaptableToolPanels | undefined = (
265
+ // this.api.toolPanelApi.getToolPanelState() as any
266
+ // ).VisibleToolPanels;
267
+ const deprecatedToolPanelConfigs = (_a = state.ToolPanel) === null || _a === void 0 ? void 0 : _a.VisibleToolPanels;
268
+ if (deprecatedToolPanelConfigs === null || deprecatedToolPanelConfigs === void 0 ? void 0 : deprecatedToolPanelConfigs.length) {
269
+ this.logger.warn(`Updating Obsolete VisibleToolPanels Config for ToolPanelState: [${deprecatedToolPanelConfigs}]`);
270
+ const migratedToolPanelConfigs = deprecatedToolPanelConfigs.map((toolPanel) => ({
271
+ Name: toolPanel,
272
+ State: 'collapsed',
273
+ }));
274
+ state.ToolPanel.ToolPanels = migratedToolPanelConfigs;
275
+ }
276
+ return state;
277
+ }
278
+ migrateAlertState(state) {
279
+ var _a, _b, _c, _d, _e;
280
+ (_b = (_a = state.Alert) === null || _a === void 0 ? void 0 : _a.AlertDefinitions) === null || _b === void 0 ? void 0 : _b.forEach((alertDefinition) => {
281
+ if (alertDefinition.Rule && 'Predicate' in alertDefinition.Rule) {
282
+ updateSingleToMultiplePredicates(alertDefinition.Rule);
283
+ }
284
+ });
285
+ const alertState = state.Alert;
286
+ if (ArrayExtensions.IsEmpty((_c = state.FlashingCell) === null || _c === void 0 ? void 0 : _c.FlashingCellDefinitions) &&
287
+ ArrayExtensions.IsNotNullOrEmpty(alertState === null || alertState === void 0 ? void 0 : alertState.FlashingAlertDefinitions)) {
288
+ state.FlashingCell.FlashingCellDefinitions = alertState.FlashingAlertDefinitions;
289
+ //@ts-ignore delete as no longer needed
290
+ delete state.Alert.FlashingAlertDefinitions;
291
+ }
292
+ (_e = (_d = state.Alert) === null || _d === void 0 ? void 0 : _d.AlertDefinitions) === null || _e === void 0 ? void 0 : _e.forEach((alertDefinition) => {
293
+ // if ShowPopup then change to DisplayNotificate
294
+ if (alertDefinition.AlertProperties &&
295
+ alertDefinition.AlertProperties.ShowPopup &&
296
+ alertDefinition.AlertProperties.ShowPopup == true &&
297
+ !alertDefinition.AlertProperties.DisplayNotification) {
298
+ alertDefinition.AlertProperties.DisplayNotification = true;
299
+ alertDefinition.AlertProperties.ShowPopup = undefined;
300
+ }
301
+ // if no rule but a predicate then use that
302
+ if (!alertDefinition.Rule) {
303
+ if (alertDefinition.Predicate && alertDefinition.Predicate != undefined) {
304
+ const predicate = alertDefinition.Predicate;
305
+ alertDefinition.Rule = {
306
+ Predicate: predicate,
307
+ };
308
+ alertDefinition.Predicate = undefined;
309
+ }
310
+ }
311
+ else {
312
+ //migrate alert definitions with `AggregationExpression` (now `AggregatedBooleanExpression`)
313
+ const obsoleteAggregationExpression = alertDefinition.Rule['AggregationExpression'];
314
+ if (obsoleteAggregationExpression) {
315
+ alertDefinition.Rule.AggregatedBooleanExpression = obsoleteAggregationExpression;
316
+ }
317
+ }
318
+ });
319
+ return state;
320
+ }
321
+ migrateCalculatedColumnState(state) {
322
+ var _a, _b;
323
+ (_b = (_a = state.CalculatedColumn) === null || _a === void 0 ? void 0 : _a.CalculatedColumns) === null || _b === void 0 ? void 0 : _b.forEach((cc) => {
324
+ if (cc.ColumnExpression && !cc.Query) {
325
+ cc.Query = {
326
+ ScalarExpression: cc.ColumnExpression,
327
+ };
328
+ cc.ColumnExpression = undefined;
329
+ }
330
+ if (!cc.CalculatedColumnSettings) {
331
+ cc.CalculatedColumnSettings = {
332
+ DataType: 'Number',
333
+ };
334
+ this.logger.warn(`Updating incorrect Predefined Config for Calculated Column: ${cc.ColumnId}`);
335
+ }
336
+ });
337
+ return state;
338
+ }
339
+ migrateUserState(state) {
340
+ return state;
341
+ }
342
+ }
@@ -0,0 +1,5 @@
1
+ import { VersionUpgrade } from './VersionUpgrade';
2
+ import { AdaptableState } from '../PredefinedConfig/AdaptableState';
3
+ export declare class VersionUpgrade18 extends VersionUpgrade {
4
+ migrateState(state: AdaptableState): AdaptableState;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { VersionUpgrade } from './VersionUpgrade';
2
+ export class VersionUpgrade18 extends VersionUpgrade {
3
+ migrateState(state) {
4
+ return state;
5
+ }
6
+ }
package/src/types.d.ts CHANGED
@@ -22,9 +22,9 @@ export type { DataImportValidationError, DataImportOptions, DataImportFileHandle
22
22
  export type { DataSetOptions, DataSet, DataSetFormContext, } from './AdaptableOptions/DataSetOptions';
23
23
  export type { CellSummaryOptions } from './AdaptableOptions/CellSummaryOptions';
24
24
  export type { CustomSortOptions, ColumnValuesComparer } from './AdaptableOptions/CustomSortOptions';
25
- export type { NoteOptions as NotesOptions, NotableCellContext } from './AdaptableOptions/NoteOptions';
26
- export type { CommentsOptions, CommentableCellContext, CommentLoadContext as CommentsLoadContext } from './AdaptableOptions/CommentOptions';
27
- export type { GroupingOptions, BalancedGroupsKeyContext, } from './AdaptableOptions/GroupingOptions';
25
+ export type { NoteOptions as NotesOptions, NotableCellContext, } from './AdaptableOptions/NoteOptions';
26
+ export type { CommentsOptions, CommentableCellContext, CommentLoadContext as CommentsLoadContext, } from './AdaptableOptions/CommentOptions';
27
+ export type { GroupingOptions, BalancedGroupsKeyContext } from './AdaptableOptions/GroupingOptions';
28
28
  export type { IPushPullPluginOptions } from './AdaptableOptions/IPushPullPluginOptions';
29
29
  export type { LayoutOptions, LayoutViewOptions, LayoutTagOptions, LayoutAvailableContext, AutoGenerateTagsForLayoutsContext, LayoutAssociatedObject, PivotPreviewColumnsContext, } from './AdaptableOptions/LayoutOptions';
30
30
  export type { ChartingOptions, ChartContainer, ExternalChartingContext, ExternalChartingOptions, } from './AdaptableOptions/ChartingOptions';
@@ -42,7 +42,7 @@ export type { AggregationColumns, WeightedAverageAggregation, } from './Predefin
42
42
  export type { AccessLevel, Entitlement } from './PredefinedConfig/Common/Entitlement';
43
43
  export type { FilterActionOnDataChange } from './PredefinedConfig/Common/FilterActionOnDataChange';
44
44
  export type { ConfigState } from './PredefinedConfig/ConfigState';
45
- export type { AdaptableNote, NotesState, AdaptableNotes, } from './PredefinedConfig/NotesState';
45
+ export type { AdaptableNote, NotesState, AdaptableNotes } from './PredefinedConfig/NotesState';
46
46
  export type { TeamSharingOptions, SharedEntitiesContext, } from './AdaptableOptions/TeamSharingOptions';
47
47
  export type { ToolPanelOptions, CustomToolPanel, ToolPanelButtonContext, CustomToolPanelButtonContext, } from './AdaptableOptions/ToolPanelOptions';
48
48
  export type { UserInterfaceOptions, BasePermittedValues, PermittedValues, EditLookUpPermittedValues, FilterPermittedValues, CustomSortPermittedValues, BulkUpdatePermittedValues, EditLookUpContext, PermittedValuesContext, FilterPermittedValuesContext, BulkUpdatePermittedValuesContext, ObjectTagsContext, CustomIcon, } from './AdaptableOptions/UserInterfaceOptions';
@@ -204,3 +204,4 @@ export type { Fdc3IntentType, Fdc3StandardIntentType, Fdc3CustomIntentType, Comp
204
204
  export type { Fdc3Options, GridDataContextMapping, ActionColumnDefaultConfiguration, ResolveContextDataContext, RaiseIntentConfig, BroadcastConfig, HandleFdc3IntentContext, HandleFdc3Context, Fdc3ButtonContext, Fdc3AdaptableButton, HandleFdc3IntentResolutionContext, UIControlConfig, Fdc3IntentOptions, Fdc3ContextOptions, RaiseIntentConfiguration, BroadcastConfiguration, FDC3ActionColumn, } from './AdaptableOptions/Fdc3Options';
205
205
  export type { CellAddress } from './PredefinedConfig/CellAddress';
206
206
  export type { CommentThread, AdaptableComment } from './PredefinedConfig/CommentState';
207
+ export type { UpgradeConfig } from '../agGrid';