@adaptabletools/adaptable 12.0.6 → 12.0.9

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 (42) hide show
  1. package/bundle.cjs.js +96 -96
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/Api/EventApi.d.ts +13 -1
  6. package/src/Api/Events/AdaptableStateReloaded.d.ts +23 -0
  7. package/src/Api/Events/AdaptableStateReloaded.js +2 -0
  8. package/src/Api/GridApi.d.ts +2 -1
  9. package/src/Api/Implementation/ConfigApiImpl.js +11 -0
  10. package/src/Api/Implementation/GridApiImpl.d.ts +1 -1
  11. package/src/Api/Implementation/GridApiImpl.js +1 -1
  12. package/src/Api/Implementation/InternalApiImpl.js +3 -0
  13. package/src/PredefinedConfig/Common/CellSummary.d.ts +2 -6
  14. package/src/Redux/Store/AdaptableStore.js +1 -1
  15. package/src/Strategy/AdaptableModuleBase.d.ts +2 -0
  16. package/src/Strategy/AdaptableModuleBase.js +6 -0
  17. package/src/Strategy/AlertModule.js +2 -2
  18. package/src/Strategy/CalculatedColumnModule.d.ts +2 -0
  19. package/src/Strategy/CalculatedColumnModule.js +4 -0
  20. package/src/Strategy/CellSummaryModule.js +4 -3
  21. package/src/Strategy/FlashingCellModule.js +2 -2
  22. package/src/Strategy/TeamSharingModule.js +4 -2
  23. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +10 -0
  24. package/src/Utilities/Services/CalculatedColumnExpressionService.js +26 -10
  25. package/src/Utilities/Services/ReportService.js +1 -1
  26. package/src/Utilities/Services/RowEditService.js +4 -1
  27. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableOptionsForm.d.ts +8 -0
  28. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/{ConfigurationForm.js → AdaptableOptionsForm.js} +3 -39
  29. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +27 -3
  30. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/{ConfigurationForm.d.ts → EntitlementsForm.d.ts} +3 -3
  31. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.js +17 -0
  32. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.d.ts +8 -0
  33. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.js +54 -0
  34. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +0 -1
  35. package/src/agGrid/Adaptable.d.ts +1 -0
  36. package/src/agGrid/Adaptable.js +23 -8
  37. package/src/agGrid/agGridHelper.js +2 -2
  38. package/src/components/ExpressionEditor/BaseEditorInput.js +3 -0
  39. package/src/components/ExpressionEditor/index.js +2 -2
  40. package/src/metamodel/adaptable.metamodel.js +1 -1
  41. package/version.d.ts +1 -1
  42. package/version.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "12.0.6",
3
+ "version": "12.0.9",
4
4
  "description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
5
5
  "keywords": [
6
6
  "web-components",
@@ -1,2 +1,2 @@
1
- declare const _default: 1657449987893;
1
+ declare const _default: 1657803750403;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1657449987893;
3
+ exports.default = 1657803750403;
@@ -16,6 +16,7 @@ import { GridDataChangedInfo } from './Events/GridDataChanged';
16
16
  import { TeamSharingEntityChangedInfo } from './Events/TeamSharingEntityChanged';
17
17
  import { ActionRowSubmittedInfo } from './Events/ActionRowSubmitted';
18
18
  import { DataSetSelectedInfo } from './Events/DataSetSelected';
19
+ import { AdaptableStateReloadedInfo } from './Events/AdaptableStateReloaded';
19
20
  /**
20
21
  * Responsible for publishing the many Events that AdapTable fires
21
22
  */
@@ -183,6 +184,17 @@ export interface EventApi {
183
184
  * Unsubscribe from AdaptableStateChanged
184
185
  */
185
186
  off(eventName: 'AdaptableStateChanged', callback: (adaptableStateChangedInfo: AdaptableStateChangedInfo) => void): void;
187
+ /**
188
+ * Event fired whenever **Adaptable State is reloaded**
189
+ * @param eventName AdaptableStateReloaded
190
+ * @param callback AdaptableStateReloadedInfo
191
+ * @returns the unsubscribe function
192
+ */
193
+ on(eventName: 'AdaptableStateReloaded', callback: (adaptableStateReloadedInfo: AdaptableStateReloadedInfo) => void): () => void;
194
+ /**
195
+ * Unsubscribe from AdaptableStateReloaded
196
+ */
197
+ off(eventName: 'AdaptableStateReloaded', callback: (adaptableStateReloadedInfo: AdaptableStateReloadedInfo) => void): void;
186
198
  /**
187
199
  * Event fired whenever **a change occurs relating to live reports / data**
188
200
  * Used in conjunction with AdapTable's partners OpenFin, ipushpull or Glue42
@@ -252,6 +264,6 @@ export interface EventApi {
252
264
  emitSync(eventName: 'DashboardChanged', data?: any): any[];
253
265
  emitSync(eventName: 'FlashingCellDisplayed', data?: any): any[];
254
266
  emitSync(eventName: 'AdaptableDestroy'): any[];
255
- emit(eventName: 'AdaptableReady' | 'AlertFired' | 'CheckboxColumnClicked' | 'CustomToolbarConfigured' | 'AdaptableStateChanged' | 'DashboardChanged' | 'CellChanged' | 'GridDataChanged' | 'LayoutChanged' | 'LiveDataChanged' | 'SearchChanged' | 'SelectionChanged' | 'SystemStatusMessageDisplayed' | 'TeamSharingEntityChanged' | 'ThemeChanged' | 'FDC3MessageSent' | 'ActionRowSubmitted' | 'DataSetSelected', data?: any): Promise<any>;
267
+ emit(eventName: 'AdaptableReady' | 'AlertFired' | 'CheckboxColumnClicked' | 'CustomToolbarConfigured' | 'AdaptableStateChanged' | 'AdaptableStateReloaded' | 'DashboardChanged' | 'CellChanged' | 'GridDataChanged' | 'LayoutChanged' | 'LiveDataChanged' | 'SearchChanged' | 'SelectionChanged' | 'SystemStatusMessageDisplayed' | 'TeamSharingEntityChanged' | 'ThemeChanged' | 'FDC3MessageSent' | 'ActionRowSubmitted' | 'DataSetSelected', data?: any): Promise<any>;
256
268
  destroy(): void;
257
269
  }
@@ -0,0 +1,23 @@
1
+ import { AdaptablePersistentState } from '../../PredefinedConfig/AdaptableState';
2
+ import { BaseEventInfo } from './BaseEventInfo';
3
+ /**
4
+ * Object returned by the `AdaptableStateReloaded` event
5
+ */
6
+ export interface AdaptableStateReloadedInfo extends BaseEventInfo {
7
+ /**
8
+ * Current AdapTableId
9
+ */
10
+ adaptableId: string;
11
+ /**
12
+ * Current Adaptable State Key
13
+ */
14
+ adaptableStateKey: string;
15
+ /**
16
+ * Adaptable State before the reload
17
+ */
18
+ oldState: AdaptablePersistentState;
19
+ /**
20
+ * Adaptable State after the reload
21
+ */
22
+ newState: AdaptablePersistentState;
23
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -261,8 +261,9 @@ export interface GridApi {
261
261
  * Retrieves Formatted Value for a given Raw Value in given Column
262
262
  * @param columnId ColumnId to lookup
263
263
  * @param rawValue Raw Value
264
+ * @param rowNode Node containig the Column
264
265
  */
265
- getFormattedValueFromRawValue(rowNode: RowNode, columnId: string, rawValue: any): string | undefined;
266
+ getDisplayValueFromRawValue(rowNode: RowNode, columnId: string, rawValue: any): string | undefined;
266
267
  /**
267
268
  * Retrieves Display Value for Cell in given Row and Column
268
269
  * @param rowNode Row to use
@@ -48,6 +48,7 @@ class ConfigApiImpl extends ApiBase_1.ApiBase {
48
48
  reloadPredefinedConfig(newPredefinedConfig) {
49
49
  var _a;
50
50
  const adaptableOptions = this.adaptable.adaptableOptions;
51
+ const oldState = this.getPersistedState();
51
52
  const clearStateFn = ((_a = adaptableOptions.stateOptions) === null || _a === void 0 ? void 0 : _a.clearState) ||
52
53
  (() => {
53
54
  localStorage.removeItem(adaptableOptions.adaptableStateKey);
@@ -63,6 +64,16 @@ class ConfigApiImpl extends ApiBase_1.ApiBase {
63
64
  this.setAdaptableStateKey(adaptableOptions.adaptableStateKey, {
64
65
  predefinedConfig: newPredefinedConfig || adaptableOptions.predefinedConfig,
65
66
  flushCurrentState: false,
67
+ }).then(() => {
68
+ const newState = this.getPersistedState();
69
+ const stateReloadedInfo = {
70
+ oldState,
71
+ newState,
72
+ adaptableStateKey: adaptableOptions.adaptableStateKey,
73
+ adaptableId: adaptableOptions.adaptableId,
74
+ adaptableApi: this.adaptable.api,
75
+ };
76
+ this.adaptable.api.eventApi.emit('AdaptableStateReloaded', stateReloadedInfo);
66
77
  });
67
78
  });
68
79
  });
@@ -65,7 +65,7 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
65
65
  getGridCellFromRowNode(rowNode: RowNode, columnId: string): GridCell | undefined;
66
66
  getRawValueFromRowNode(rowNode: RowNode, columnId: string): any | undefined;
67
67
  getDisplayValueFromRowNode(rowNode: RowNode, columnId: string): any | undefined;
68
- getFormattedValueFromRawValue(rowNode: RowNode, columnId: string, rawValue: any): string | undefined;
68
+ getDisplayValueFromRawValue(rowNode: RowNode, columnId: string, rawValue: any): string | undefined;
69
69
  getNormalisedValueFromRowNode(rowNode: RowNode, columnId: string): any | undefined;
70
70
  getRowNodesForPrimaryKeys(primaryKeyValues: any[]): RowNode[];
71
71
  getRowNodeForPrimaryKey(primaryKeyValue: any): RowNode;
@@ -200,7 +200,7 @@ class GridApiImpl extends ApiBase_1.ApiBase {
200
200
  getDisplayValueFromRowNode(rowNode, columnId) {
201
201
  return this.adaptable.getDisplayValueFromRowNode(rowNode, columnId);
202
202
  }
203
- getFormattedValueFromRawValue(rowNode, columnId, rawValue) {
203
+ getDisplayValueFromRawValue(rowNode, columnId, rawValue) {
204
204
  return this.adaptable.getDisplayValueFromRawValue(rowNode, columnId, rawValue);
205
205
  }
206
206
  getNormalisedValueFromRowNode(rowNode, columnId) {
@@ -390,6 +390,9 @@ class InternalApiImpl extends ApiBase_1.ApiBase {
390
390
  getQueryPreviewData() {
391
391
  var _a;
392
392
  const firstRowNode = this.adaptable.api.gridApi.getFirstRowNode();
393
+ if (firstRowNode == undefined) {
394
+ return {};
395
+ }
393
396
  const firstRowData = (_a = Object.assign({}, firstRowNode === null || firstRowNode === void 0 ? void 0 : firstRowNode.data)) !== null && _a !== void 0 ? _a : {};
394
397
  // handle CalcCols which are not persisted in the rowModel
395
398
  this.adaptable.api.calculatedColumnApi.getAllCalculatedColumn().forEach((calculatedColumn) => {
@@ -1,4 +1,4 @@
1
- import { AdaptableApi } from '../../Api/AdaptableApi';
1
+ import { BaseContext } from '../../../types';
2
2
  import { SelectedCellInfo } from '../Selection/SelectedCellInfo';
3
3
  /**
4
4
  * Defines the Summary operations provides for Selected Cells
@@ -30,7 +30,7 @@ export interface CellSummaryOperation {
30
30
  /**
31
31
  * Context provided to a custom Cell Summary Operation function
32
32
  */
33
- export interface CellSummaryOperationContext {
33
+ export interface CellSummaryOperationContext extends BaseContext {
34
34
  /**
35
35
  * Currently selected cells
36
36
  */
@@ -51,8 +51,4 @@ export interface CellSummaryOperationContext {
51
51
  * Count of currently selected cells
52
52
  */
53
53
  distinctCount: number;
54
- /**
55
- * Adaptable Api object
56
- */
57
- api: AdaptableApi;
58
54
  }
@@ -570,7 +570,7 @@ const adaptableMiddleware = (adaptable) => function (middlewareAPI) {
570
570
  .getCalculatedColumnExpressionService()
571
571
  .createAggregatedScalarCalculatedColumn(calculatedColumn);
572
572
  });
573
- // refresh calcualted columns
573
+ // refresh calculated columns
574
574
  const aggCalculatedColumnIds = aggregatedCalculatedColumns.map((calculatedColumn) => calculatedColumn.ColumnId);
575
575
  adaptable.refreshCells(null, aggCalculatedColumnIds, true);
576
576
  return;
@@ -12,6 +12,7 @@ import { AccessLevel } from '../PredefinedConfig/Common/Entitlement';
12
12
  import { CalculatedColumn } from '../PredefinedConfig/CalculatedColumnState';
13
13
  import { FreeTextColumn } from '../PredefinedConfig/FreeTextColumnState';
14
14
  import { AdaptableInternalIconName } from '../PredefinedConfig/Common/AdaptableIcon';
15
+ import { AdaptableStateReloadedInfo } from '../Api/Events/AdaptableStateReloaded';
15
16
  /**
16
17
  * Base class for all strategies and does most of the work of creating menus
17
18
  */
@@ -34,6 +35,7 @@ export declare abstract class AdaptableModuleBase implements IModule {
34
35
  getReferencedNamedQueryNames(adaptableObject: AdaptableObject): string[];
35
36
  hasNamedQueryReferences(): boolean;
36
37
  handleAdaptableReady(): void;
38
+ handleConfigReloaded(adaptableStateReloadedInfo: AdaptableStateReloadedInfo): void;
37
39
  setModuleEntitlement(): void;
38
40
  addModuleMenuItem(source: 'ModuleMenu' | 'ModuleButton'): AdaptableMenuItem | undefined;
39
41
  addModuleButtonMenuItem(): AdaptableMenuItem | undefined;
@@ -24,6 +24,9 @@ class AdaptableModuleBase {
24
24
  this.handleAdaptableReady();
25
25
  this.api.configApi.dispatchStateReadyAction(this.moduleInfo.ModuleName);
26
26
  });
27
+ this.api.eventApi.on('AdaptableStateReloaded', (adaptableStateReloadedInfo) => {
28
+ this.handleConfigReloaded(adaptableStateReloadedInfo);
29
+ });
27
30
  }
28
31
  getViewAccessLevel() {
29
32
  // override where necessary (ex. only 'Full' accessLevel should be displayed)
@@ -68,6 +71,9 @@ class AdaptableModuleBase {
68
71
  handleAdaptableReady() {
69
72
  // override where necessary in base classes
70
73
  }
74
+ handleConfigReloaded(adaptableStateReloadedInfo) {
75
+ // override where necessary in base classes
76
+ }
71
77
  setModuleEntitlement() {
72
78
  this.AccessLevel = this.api.internalApi
73
79
  .getEntitlementService()
@@ -32,8 +32,8 @@ class AlertModule extends AdaptableModuleBase_1.AdaptableModuleBase {
32
32
  'formattedValue') {
33
33
  const { oldValue, newValue, rowNode } = cellDataChangedInfo;
34
34
  const columnId = cellDataChangedInfo.column.columnId;
35
- const oldFormattedValue = this.api.gridApi.getFormattedValueFromRawValue(rowNode, columnId, oldValue);
36
- const newFormattedValue = this.api.gridApi.getFormattedValueFromRawValue(rowNode, columnId, newValue);
35
+ const oldFormattedValue = this.api.gridApi.getDisplayValueFromRawValue(rowNode, columnId, oldValue);
36
+ const newFormattedValue = this.api.gridApi.getDisplayValueFromRawValue(rowNode, columnId, newValue);
37
37
  if (oldFormattedValue === newFormattedValue) {
38
38
  // if the formattedValues are identical, then no alert is fired
39
39
  return;
@@ -8,8 +8,10 @@ import { CalculatedColumn } from '../PredefinedConfig/CalculatedColumnState';
8
8
  import { AdaptableObjectItemView, IModule } from './Interface/IModule';
9
9
  import { AdaptableApi } from '../Api/AdaptableApi';
10
10
  import { AdaptableObject } from '../PredefinedConfig/Common/AdaptableObject';
11
+ import { AdaptableStateReloadedInfo } from '../Api/Events/AdaptableStateReloaded';
11
12
  export declare class CalculatedColumnModule extends AdaptableModuleBase implements IModule {
12
13
  constructor(api: AdaptableApi);
14
+ handleConfigReloaded(adaptableStateReloadedInfo: AdaptableStateReloadedInfo): void;
13
15
  getModuleAdaptableObjects(): AdaptableObject[];
14
16
  updateOldConfig(): void;
15
17
  getExplicitlyReferencedColumnIds(calculatedColumn: CalculatedColumn): string[];
@@ -15,6 +15,10 @@ class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
15
15
  constructor(api) {
16
16
  super(ModuleConstants.CalculatedColumnModuleId, 'Calculated Column', 'calculated-column', 'CalculatedColumnPopup', 'Create bespoke columns whose cell value is derived dynamically from an Expression', api);
17
17
  }
18
+ handleConfigReloaded(adaptableStateReloadedInfo) {
19
+ // re-dispatch the CalculatedColumnReady action to recreate all the aggregated scalar columns
20
+ this.api.internalApi.dispatchReduxAction(CalculatedColumnRedux.CalculatedColumnReady(this.api.calculatedColumnApi.getCalculatedColumnState()));
21
+ }
18
22
  getModuleAdaptableObjects() {
19
23
  return this.api.calculatedColumnApi.getAllCalculatedColumn();
20
24
  }
@@ -98,14 +98,15 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
98
98
  const api = this.api;
99
99
  operationDefinitions === null || operationDefinitions === void 0 ? void 0 : operationDefinitions.forEach((operation) => {
100
100
  if (operation.operationFunction) {
101
- selectedCellSummary[operation.operationName] = operation.operationFunction({
101
+ const cellSummaryOperationContext = {
102
102
  selectedCellInfo,
103
103
  distinctCount,
104
104
  allValues,
105
105
  numericValues,
106
106
  numericColumns,
107
- api,
108
- });
107
+ adaptableApi: this.api,
108
+ };
109
+ selectedCellSummary[operation.operationName] = operation.operationFunction(cellSummaryOperationContext);
109
110
  }
110
111
  });
111
112
  }
@@ -31,8 +31,8 @@ class FlashingCellModule extends AdaptableModuleBase_1.AdaptableModuleBase {
31
31
  'formattedValue') {
32
32
  const { oldValue, newValue, rowNode } = cellDataChangedInfo;
33
33
  const columnId = cellDataChangedInfo.column.columnId;
34
- const oldFormattedValue = this.api.gridApi.getFormattedValueFromRawValue(rowNode, columnId, oldValue);
35
- const newFormattedValue = this.api.gridApi.getFormattedValueFromRawValue(rowNode, columnId, newValue);
34
+ const oldFormattedValue = this.api.gridApi.getDisplayValueFromRawValue(rowNode, columnId, oldValue);
35
+ const newFormattedValue = this.api.gridApi.getDisplayValueFromRawValue(rowNode, columnId, newValue);
36
36
  if (oldFormattedValue === newFormattedValue) {
37
37
  // if the formattedValues are identical, then no alert is fired
38
38
  return;
@@ -32,10 +32,12 @@ class TeamSharingModule extends AdaptableModuleBase_1.AdaptableModuleBase {
32
32
  // make sure there is no zombie import process remaining (in case a previous import crashed)
33
33
  this.api.internalApi.dispatchReduxAction(TeamSharingRedux.TeamSharingCommitImport());
34
34
  });
35
- this.api.teamSharingApi.triggerLoadingTeamSharingEntries();
35
+ if (this.api.teamSharingApi.isTeamSharingAvailable()) {
36
+ this.api.teamSharingApi.triggerLoadingTeamSharingEntries();
37
+ }
36
38
  }
37
39
  isModuleAvailable() {
38
- return super.isModuleAvailable() && this.api.teamSharingApi.isTeamSharingActivated();
40
+ return super.isModuleAvailable() && this.api.teamSharingApi.isTeamSharingAvailable();
39
41
  }
40
42
  isModuleObjectsShareable() {
41
43
  return false;
@@ -177,6 +177,11 @@ exports.aggregatedScalarExpressionFunctions = {
177
177
  }
178
178
  return rowValue < minValue ? rowValue : minValue;
179
179
  },
180
+ done: (minValue) => {
181
+ if (minValue !== Number.MAX_VALUE) {
182
+ return minValue;
183
+ }
184
+ },
180
185
  },
181
186
  },
182
187
  },
@@ -218,6 +223,11 @@ exports.aggregatedScalarExpressionFunctions = {
218
223
  }
219
224
  return rowValue > maxValue ? rowValue : maxValue;
220
225
  },
226
+ done: (maxValue) => {
227
+ if (maxValue !== Number.MIN_VALUE) {
228
+ return maxValue;
229
+ }
230
+ },
221
231
  },
222
232
  },
223
233
  },
@@ -29,6 +29,16 @@ class CalculatedColumnExpressionService {
29
29
  this.adaptableApi.gridApi.refreshCells(null, refreshedCalculatedColumns);
30
30
  }
31
31
  });
32
+ this.adaptableApi.eventApi.on('GridDataChanged', () => {
33
+ const refreshedCalculatedColumns = [];
34
+ this.aggregatedScalarCalculatedColumnsMap.forEach((aggregatedScalarCalculatedColumn) => {
35
+ aggregatedScalarCalculatedColumn.refreshAggregatedColumnValue();
36
+ refreshedCalculatedColumns.push(aggregatedScalarCalculatedColumn.getCalculatedColumnId());
37
+ });
38
+ if (refreshedCalculatedColumns.length) {
39
+ this.adaptableApi.gridApi.refreshCells(null, refreshedCalculatedColumns);
40
+ }
41
+ });
32
42
  }
33
43
  destroy() {
34
44
  [...this.aggregatedScalarCalculatedColumnsMap.values()].forEach((aggregatedScalarCalculatedColumn) => aggregatedScalarCalculatedColumn.destroy());
@@ -116,10 +126,7 @@ class CalculatedColumnExpressionService {
116
126
  // if there is already an aggregated scalar, delete it (possible when editing)
117
127
  this.destroyAggregatedScalarCalculatedColumn(calculatedColumn);
118
128
  if ((_a = calculatedColumn.Query) === null || _a === void 0 ? void 0 : _a.AggregatedScalarExpression) {
119
- const aggregationConfig = this.adaptableApi.internalApi
120
- .getQueryLanguageService()
121
- .evaluateAggregatedScalarExpression(calculatedColumn.Query.AggregatedScalarExpression, ModuleConstants_1.CalculatedColumnModuleId);
122
- const aggregatedScalarCalculatedColumn = new AggregatedScalarCalculatedColumn(aggregationConfig.value, calculatedColumn, this.adaptableApi);
129
+ const aggregatedScalarCalculatedColumn = new AggregatedScalarCalculatedColumn(calculatedColumn, this.adaptableApi);
123
130
  this.aggregatedScalarCalculatedColumnsMap.set(calculatedColumn.Uuid, aggregatedScalarCalculatedColumn);
124
131
  }
125
132
  }
@@ -131,13 +138,16 @@ class CalculatedColumnExpressionService {
131
138
  }
132
139
  exports.CalculatedColumnExpressionService = CalculatedColumnExpressionService;
133
140
  class AggregatedScalarCalculatedColumn {
134
- constructor(expressionEvaluation, calculatedColumn, adaptableApi) {
135
- this.expressionEvaluation = expressionEvaluation;
141
+ constructor(calculatedColumn, adaptableApi) {
136
142
  this.calculatedColumn = calculatedColumn;
137
143
  this.adaptableApi = adaptableApi;
138
- this.aggregationResult = this.computeAggregatedValue(expressionEvaluation);
144
+ const aggregationConfig = this.adaptableApi.internalApi
145
+ .getQueryLanguageService()
146
+ .evaluateAggregatedScalarExpression(calculatedColumn.Query.AggregatedScalarExpression, ModuleConstants_1.CalculatedColumnModuleId);
147
+ this.expressionEvaluation = aggregationConfig.value;
148
+ this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
139
149
  // currently we support only one reducer
140
- this.aggregationReducerName = Object.keys(expressionEvaluation.aggregationParams.reducers)[0];
150
+ this.aggregationReducerName = Object.keys(this.expressionEvaluation.aggregationParams.reducers)[0];
141
151
  }
142
152
  destroy() {
143
153
  this.expressionEvaluation = null;
@@ -153,6 +163,10 @@ class AggregatedScalarCalculatedColumn {
153
163
  return aggregationValue;
154
164
  }
155
165
  refreshAggregatedColumnValue() {
166
+ const aggregationConfig = this.adaptableApi.internalApi
167
+ .getQueryLanguageService()
168
+ .evaluateAggregatedScalarExpression(this.calculatedColumn.Query.AggregatedScalarExpression, ModuleConstants_1.CalculatedColumnModuleId);
169
+ this.expressionEvaluation = aggregationConfig.value;
156
170
  this.aggregationResult = this.computeAggregatedValue(this.expressionEvaluation);
157
171
  }
158
172
  getCalculatedColumnId() {
@@ -167,11 +181,13 @@ class AggregatedScalarCalculatedColumn {
167
181
  // we iterate over the RowNode list (we need this to handle complex column values (nested values, valueGetters etc)
168
182
  // so we will map the fieldNames to RowNode.data
169
183
  const mapReducerValueGetter = (fieldName) => {
170
- return (rowNode) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
184
+ return (rowNode) => {
185
+ return this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
186
+ };
171
187
  };
172
188
  Object.values(expressionEvaluation.aggregationParams.reducers).forEach((aggregationReducer) => {
173
189
  aggregationReducer.getter = mapReducerValueGetter(aggregationReducer.field);
174
- // nullify the getter to force the fallback on the getter fn
190
+ // nullify the field to force the fallback on the getter fn
175
191
  aggregationReducer.field = null;
176
192
  });
177
193
  const mapGroupByToKey = (fieldName) => {
@@ -339,7 +339,7 @@ class ReportService {
339
339
  return type === 'rawValue'
340
340
  ? cellRawValue
341
341
  : // type === formattedValue
342
- this.adaptableApi.gridApi.getFormattedValueFromRawValue(rowNode, columnId, cellRawValue);
342
+ this.adaptableApi.gridApi.getDisplayValueFromRawValue(rowNode, columnId, cellRawValue);
343
343
  }
344
344
  computeCellExportValueFormat(columnDataType) {
345
345
  const exportOptions = this.adaptableApi.internalApi.getAdaptableOptions().exportOptions;
@@ -189,7 +189,10 @@ class RowEditService {
189
189
  adaptableApi,
190
190
  })
191
191
  : Object.assign({}, formData);
192
- adaptableApi.gridApi.addGridData([newRowData], { addIndex: 0 });
192
+ const config = {
193
+ addIndex: 0,
194
+ };
195
+ adaptableApi.gridApi.addGridData([newRowData], config);
193
196
  }
194
197
  }
195
198
  }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { AdaptableOptions } from '../../../types';
3
+ interface AdaptableOptionsFormOptions {
4
+ adaptableOptions: AdaptableOptions;
5
+ onChangeadaptableOptions: (adaptableOptions: AdaptableOptions) => void;
6
+ }
7
+ declare const AdaptableOptionsForm: (props: AdaptableOptionsFormOptions) => JSX.Element;
8
+ export default AdaptableOptionsForm;
@@ -8,17 +8,13 @@ const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlo
8
8
  const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
9
9
  const rebass_1 = require("rebass");
10
10
  const DefaultAdaptableOptions_1 = require("../../../Utilities/Defaults/DefaultAdaptableOptions");
11
- const ConfigurationForm = (props) => {
12
- var _a, _b, _c;
11
+ const AdaptableOptionsForm = (props) => {
12
+ var _a, _b;
13
13
  let abOptions = props.adaptableOptions;
14
14
  const layoutOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.layoutOptions), abOptions.layoutOptions);
15
15
  const generalOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.generalOptions), abOptions.generalOptions);
16
16
  const adaptableQLOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.adaptableQLOptions), abOptions.adaptableQLOptions);
17
- const userInterfaceOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.userInterfaceOptions), abOptions.userInterfaceOptions);
18
- const searchOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.searchOptions), abOptions.searchOptions);
19
17
  const filterOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.filterOptions), abOptions.filterOptions);
20
- // we are 'hard-coding' this to use AG Grid but so does helper so ok for now and we can refactor when Adaptable Grid is ready
21
- const gridOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.gridOptions), abOptions.gridOptions);
22
18
  return (React.createElement(React.Fragment, null,
23
19
  React.createElement(HelpBlock_1.default, null, "Base Options"),
24
20
  React.createElement(FormLayout_1.default, { margin: 2, columns: [{ name: 'label', style: { textAlign: 'start' } }, { name: 'children' }] },
@@ -36,38 +32,6 @@ const ConfigurationForm = (props) => {
36
32
  abOptions.generalOptions.showMissingPrimaryKeyAlert = showMissingPrimaryKeyWarning;
37
33
  props.onChangeadaptableOptions(abOptions);
38
34
  } }))),
39
- React.createElement(HelpBlock_1.default, null, "Grid Options"),
40
- React.createElement(FormLayout_1.default, { margin: 2, columns: [{ name: 'children' }, { name: 'label', style: { textAlign: 'start' } }] },
41
- React.createElement(FormLayout_1.FormRow, { label: "Enable Range Selection" },
42
- React.createElement(CheckBox_1.CheckBox, { checked: gridOptions.enableRangeSelection, onChange: (enableRangeSelection) => {
43
- abOptions = Object.assign({}, abOptions);
44
- abOptions.gridOptions = Object.assign({}, abOptions.gridOptions);
45
- abOptions.gridOptions.enableRangeSelection = enableRangeSelection;
46
- props.onChangeadaptableOptions(abOptions);
47
- } })),
48
- React.createElement(FormLayout_1.FormRow, { label: "Show Quick Filter" },
49
- React.createElement(CheckBox_1.CheckBox, { checked: (_c = gridOptions.defaultColDef) === null || _c === void 0 ? void 0 : _c.floatingFilter, onChange: (floatingFilter) => {
50
- abOptions = Object.assign({}, abOptions);
51
- abOptions.gridOptions = Object.assign({}, abOptions.gridOptions);
52
- abOptions.gridOptions.defaultColDef = {
53
- floatingFilter,
54
- };
55
- props.onChangeadaptableOptions(abOptions);
56
- } })),
57
- React.createElement(FormLayout_1.FormRow, { label: "Suppress Column Virtualisation" },
58
- React.createElement(CheckBox_1.CheckBox, { checked: gridOptions.suppressColumnVirtualisation, onChange: (suppressColumnVirtualisation) => {
59
- abOptions = Object.assign({}, abOptions);
60
- abOptions.gridOptions = Object.assign({}, abOptions.gridOptions);
61
- abOptions.gridOptions.suppressColumnVirtualisation = suppressColumnVirtualisation;
62
- props.onChangeadaptableOptions(abOptions);
63
- } })),
64
- React.createElement(FormLayout_1.FormRow, { label: "Show Column Menu Button" },
65
- React.createElement(CheckBox_1.CheckBox, { checked: gridOptions.suppressMenuHide, onChange: (suppressMenuHide) => {
66
- abOptions = Object.assign({}, abOptions);
67
- abOptions.gridOptions = Object.assign({}, abOptions.gridOptions);
68
- abOptions.gridOptions.suppressMenuHide = suppressMenuHide;
69
- props.onChangeadaptableOptions(abOptions);
70
- } }))),
71
35
  React.createElement(HelpBlock_1.default, null, "Layout Options"),
72
36
  React.createElement(FormLayout_1.default, { margin: 2, columns: [{ name: 'children' }, { name: 'label', style: { textAlign: 'start' } }] },
73
37
  React.createElement(FormLayout_1.FormRow, { label: "Auto Save Layouts" },
@@ -134,4 +98,4 @@ const ConfigurationForm = (props) => {
134
98
  props.onChangeadaptableOptions(abOptions);
135
99
  }, value: filterOptions.maxFilterValuesToDisplay, marginRight: 3 })))));
136
100
  };
137
- exports.default = ConfigurationForm;
101
+ exports.default = AdaptableOptionsForm;
@@ -7,7 +7,8 @@ const react_1 = require("react");
7
7
  const StringExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/StringExtensions"));
8
8
  const OnePageWizards_1 = require("../../Wizard/OnePageWizards");
9
9
  const ConfigurationWizardColumnsStep_1 = require("./ConfigurationWizardColumnsStep");
10
- const ConfigurationForm_1 = tslib_1.__importDefault(require("./ConfigurationForm"));
10
+ const GridOptionsForm_1 = tslib_1.__importDefault(require("./GridOptionsForm"));
11
+ const AdaptableOptionsForm_1 = tslib_1.__importDefault(require("./AdaptableOptionsForm"));
11
12
  const ConfigurationWizard = (props) => {
12
13
  const [isPrimaryKeySelected, setIsValid] = React.useState(true);
13
14
  const [adaptableOptions, setAdaptableOptions] = react_1.useState(props.adaptableOptions);
@@ -50,7 +51,7 @@ const ConfigurationWizard = (props) => {
50
51
  let sections = [
51
52
  {
52
53
  title: 'Columns',
53
- details: 'Configure Adaptable',
54
+ details: 'Configure Columns',
54
55
  isValid: () => {
55
56
  if (!isPrimaryKeySelected) {
56
57
  return 'Primary key column must be included';
@@ -65,10 +66,33 @@ const ConfigurationWizard = (props) => {
65
66
  title: 'Adaptable Options',
66
67
  details: 'Configure Adaptable Options',
67
68
  isValid: () => (adaptableOptions.adaptableId ? true : 'Adaptable ID is required'),
68
- render: () => (React.createElement(ConfigurationForm_1.default, { adaptableOptions: adaptableOptions, onChangeadaptableOptions: (abOptions) => {
69
+ render: () => (React.createElement(AdaptableOptionsForm_1.default, { adaptableOptions: adaptableOptions, onChangeadaptableOptions: (abOptions) => {
69
70
  setAdaptableOptions(abOptions);
70
71
  } })),
71
72
  },
73
+ {
74
+ title: 'Grid Options',
75
+ details: 'Configure AG Grid Options',
76
+ render: () => (React.createElement(GridOptionsForm_1.default, { adaptableOptions: adaptableOptions, onChangeadaptableOptions: (abOptions) => {
77
+ setAdaptableOptions(abOptions);
78
+ } })),
79
+ },
80
+ // JW - I would like at some point to do a page of Entitlements
81
+ // to show all the Modules and let users select which are Full, ReadOnly or Hidden
82
+ /*
83
+ {
84
+ title: 'Entitlements',
85
+ details: 'Configure Entitlements',
86
+ render: () => (
87
+ <EntitlementsForm
88
+ adaptableOptions={adaptableOptions}
89
+ onChangeadaptableOptions={(abOptions) => {
90
+ setAdaptableOptions(abOptions);
91
+ }}
92
+ />
93
+ ),
94
+ },
95
+ */
72
96
  ];
73
97
  if (props.startSections) {
74
98
  sections = [
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { AdaptableOptions } from '../../../types';
3
- interface ConfigurationFormOptions {
3
+ interface EntitlementsFormOptions {
4
4
  adaptableOptions: AdaptableOptions;
5
5
  onChangeadaptableOptions: (adaptableOptions: AdaptableOptions) => void;
6
6
  }
7
- declare const ConfigurationForm: (props: ConfigurationFormOptions) => JSX.Element;
8
- export default ConfigurationForm;
7
+ declare const EntitlementsForm: (props: EntitlementsFormOptions) => JSX.Element;
8
+ export default EntitlementsForm;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const React = tslib_1.__importStar(require("react"));
5
+ const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
6
+ const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock"));
7
+ const DefaultAdaptableOptions_1 = require("../../../Utilities/Defaults/DefaultAdaptableOptions");
8
+ const EntitlementsForm = (props) => {
9
+ let abOptions = props.adaptableOptions;
10
+ const entitlementOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.entitlementOptions), abOptions.entitlementOptions);
11
+ const gridOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.gridOptions), abOptions.gridOptions);
12
+ return (React.createElement(React.Fragment, null,
13
+ React.createElement(HelpBlock_1.default, null, "EntitlementOptions Options"),
14
+ React.createElement(FormLayout_1.default, { margin: 2, columns: [{ name: 'children' }, { name: 'label', style: { textAlign: 'start' } }] },
15
+ React.createElement(FormLayout_1.FormRow, { label: "Entitlements to be set here" }))));
16
+ };
17
+ exports.default = EntitlementsForm;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { AdaptableOptions } from '../../../types';
3
+ interface GridOptionsFormOptions {
4
+ adaptableOptions: AdaptableOptions;
5
+ onChangeadaptableOptions: (adaptableOptions: AdaptableOptions) => void;
6
+ }
7
+ declare const GridOptionsForm: (props: GridOptionsFormOptions) => JSX.Element;
8
+ export default GridOptionsForm;