@adaptabletools/adaptable 11.2.1-canary.0 → 11.2.3

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 (73) hide show
  1. package/base.css +24 -1
  2. package/bundle.cjs.js +94 -94
  3. package/index.css +28 -1
  4. package/package.json +1 -1
  5. package/publishTimestamp.d.ts +1 -1
  6. package/publishTimestamp.js +1 -1
  7. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -0
  8. package/src/AdaptableOptions/LayoutOptions.d.ts +36 -11
  9. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +0 -1
  10. package/src/Api/GridApi.d.ts +8 -1
  11. package/src/Api/Implementation/ColumnApiImpl.js +2 -1
  12. package/src/Api/Implementation/FreeTextColumnApiImpl.js +3 -3
  13. package/src/Api/Implementation/GridApiImpl.d.ts +3 -0
  14. package/src/Api/Implementation/GridApiImpl.js +3 -0
  15. package/src/Api/Implementation/InternalApiImpl.d.ts +2 -0
  16. package/src/Api/Implementation/InternalApiImpl.js +49 -28
  17. package/src/Api/Implementation/LayoutApiImpl.d.ts +2 -0
  18. package/src/Api/Implementation/LayoutApiImpl.js +6 -0
  19. package/src/Api/Implementation/SystemStatusApiImpl.js +1 -1
  20. package/src/Api/Implementation/TeamSharingApiImpl.d.ts +2 -1
  21. package/src/Api/Implementation/TeamSharingApiImpl.js +11 -2
  22. package/src/Api/Implementation/ThemeApiImpl.js +1 -1
  23. package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +2 -1
  24. package/src/Api/Implementation/UserInterfaceApiImpl.js +16 -4
  25. package/src/Api/InternalApi.d.ts +2 -0
  26. package/src/Api/LayoutApi.d.ts +6 -1
  27. package/src/Api/TeamSharingApi.d.ts +10 -1
  28. package/src/Api/UserInterfaceApi.d.ts +6 -1
  29. package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +4 -0
  30. package/src/PredefinedConfig/Common/AdaptableObject.d.ts +5 -5
  31. package/src/Redux/ActionsReducers/TeamSharingRedux.d.ts +1 -1
  32. package/src/Redux/ActionsReducers/TeamSharingRedux.js +4 -4
  33. package/src/Strategy/FilterModule.d.ts +7 -0
  34. package/src/Strategy/FilterModule.js +11 -2
  35. package/src/Strategy/Interface/IModule.d.ts +5 -0
  36. package/src/Strategy/LayoutModule.js +4 -4
  37. package/src/Strategy/Utilities/getObjectTagsViewItems.js +1 -1
  38. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +4 -1
  39. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +4 -3
  40. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +16 -36
  41. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +24 -14
  42. package/src/Utilities/Services/CalculatedColumnExpressionService.js +32 -9
  43. package/src/View/AdaptablePopover/index.d.ts +1 -0
  44. package/src/View/AdaptablePopover/index.js +2 -2
  45. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +1 -1
  46. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.d.ts +13 -0
  47. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +41 -0
  48. package/src/View/Components/EntityRulesEditor/index.js +2 -1
  49. package/src/View/Components/ExpressionWizard.js +2 -1
  50. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +1 -1
  51. package/src/View/Components/TagValueSelector/index.js +4 -3
  52. package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.js +2 -2
  53. package/src/View/Export/ReportExportDropdown.js +1 -1
  54. package/src/View/Filter/ActiveFiltersPanel.d.ts +1 -13
  55. package/src/View/Filter/ActiveFiltersPanel.js +8 -31
  56. package/src/View/Filter/FilterStatusBarSubPanelPopover.js +1 -10
  57. package/src/View/Filter/FilterViewPanel.js +2 -2
  58. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +2 -2
  59. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +1 -1
  60. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +1 -1
  61. package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +1 -1
  62. package/src/View/Schedule/Wizard/ScheduleWizard.js +4 -4
  63. package/src/agGrid/Adaptable.d.ts +3 -0
  64. package/src/agGrid/Adaptable.js +10 -2
  65. package/src/agGrid/agGridHelper.js +1 -0
  66. package/src/components/ExpressionEditor/BaseEditorInput.js +8 -1
  67. package/src/components/ExpressionEditor/index.js +54 -5
  68. package/src/metamodel/adaptable.metamodel.d.ts +32 -18
  69. package/src/metamodel/adaptable.metamodel.js +96 -25
  70. package/src/parser/src/types.d.ts +1 -1
  71. package/src/types.d.ts +3 -3
  72. package/version.d.ts +1 -1
  73. package/version.js +1 -1
@@ -42,7 +42,7 @@ export interface TeamSharingCommitImportAction extends Redux.Action {
42
42
  }
43
43
  export interface TeamSharingCheckForUpdatesAction extends Redux.Action {
44
44
  }
45
- export declare const TeamSharingShare: (Entity: AdaptableObject, Module: AdaptableModule, Configuration: SharedEntityConfig) => TeamSharingShareAction;
45
+ export declare const TeamSharingShare: (entity: AdaptableObject, module: AdaptableModule, configuration: SharedEntityConfig) => TeamSharingShareAction;
46
46
  export declare const TeamSharingSet: (Entities: SharedEntity[]) => TeamSharingSetAction;
47
47
  export declare const TeamSharingImportItem: (SharedEntity: SharedEntity) => TeamSharingImportItemAction;
48
48
  export declare const TeamSharingProcessImport: (ImportSteps: TeamSharingImportStep[]) => TeamSharingProcessImportAction;
@@ -12,11 +12,11 @@ exports.TEAMSHARING_REMOVE_ITEM = 'TEAMSHARING_REMOVE_ITEM';
12
12
  exports.TEAMSHARING_LINK_ITEM = 'TEAMSHARING_LINK_ITEM';
13
13
  exports.TEAMSHARING_UPDATE_ITEM = 'TEAMSHARING_UPDATE_ITEM';
14
14
  exports.TEAMSHARING_CHECK_FOR_UPDATES = 'TEAMSHARING_CHECK_FOR_UPDATES';
15
- exports.TeamSharingShare = (Entity, Module, Configuration) => ({
15
+ exports.TeamSharingShare = (entity, module, configuration) => ({
16
16
  type: exports.TEAMSHARING_SHARE,
17
- Entity,
18
- Module,
19
- Configuration,
17
+ Entity: entity,
18
+ Module: module,
19
+ Configuration: configuration,
20
20
  });
21
21
  exports.TeamSharingSet = (Entities) => ({
22
22
  type: exports.TEAMSHARING_SET,
@@ -17,6 +17,13 @@ export declare class FilterModule extends AdaptableModuleBase implements IModule
17
17
  addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
18
18
  addColumnMenuItems(column: AdaptableColumn): AdaptableMenuItem[] | undefined;
19
19
  getTeamSharingAction(): TeamSharingImportInfo<ColumnFilter>;
20
+ toViewCompact(filter: ColumnFilter): {
21
+ item: {
22
+ name: string;
23
+ values: string[];
24
+ };
25
+ abObject: ColumnFilter;
26
+ };
20
27
  toView(filter: ColumnFilter): AdaptableObjectView;
21
28
  toViewAll(): AdaptableObjectView[];
22
29
  getViewProperties(): {
@@ -77,12 +77,21 @@ class FilterModule extends AdaptableModuleBase_1.AdaptableModuleBase {
77
77
  EditAction: FilterRedux.ColumnFilterEdit,
78
78
  };
79
79
  }
80
+ toViewCompact(filter) {
81
+ return {
82
+ item: {
83
+ name: this.api.columnApi.getFriendlyNameFromColumnId(filter.ColumnId),
84
+ values: [this.api.filterApi.columnFilterToString(filter)],
85
+ },
86
+ abObject: filter,
87
+ };
88
+ }
80
89
  toView(filter) {
81
90
  return {
82
91
  items: [
83
92
  {
84
93
  name: 'Column',
85
- values: [filter.ColumnId],
94
+ values: [this.api.columnApi.getFriendlyNameFromColumnId(filter.ColumnId)],
86
95
  },
87
96
  {
88
97
  name: 'Filter',
@@ -120,7 +129,7 @@ class FilterModule extends AdaptableModuleBase_1.AdaptableModuleBase {
120
129
  return {
121
130
  content: text,
122
131
  popover,
123
- popoverMinWidth: 280,
132
+ popoverMinWidth: 320,
124
133
  };
125
134
  },
126
135
  };
@@ -62,6 +62,10 @@ export interface AdaptableObjectView {
62
62
  */
63
63
  abObject: AdaptableObject;
64
64
  }
65
+ export interface AdaptableObjectCompactView {
66
+ item: AdaptableObjectItemView;
67
+ abObject: AdaptableObject;
68
+ }
65
69
  export declare type AdaptableModuleViewAction = React.FunctionComponent<{
66
70
  data: AdaptableObject;
67
71
  accessLevel: AccessLevel;
@@ -130,6 +134,7 @@ export interface IModule {
130
134
  */
131
135
  toView?: (abObject: AdaptableObject) => AdaptableObjectView;
132
136
  toViewAll?: () => AdaptableObjectView[];
137
+ toViewCompact?: (abObject: AdaptableObject) => AdaptableObjectCompactView;
133
138
  getViewProperties?: () => AdaptableModuleView;
134
139
  }
135
140
  /**
@@ -144,7 +144,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
144
144
  }
145
145
  toView(layout) {
146
146
  var _a, _b, _c, _d, _e, _f, _g;
147
- const maxColumnsToDisplay = (_d = (_c = (_b = (_a = this.api.internalApi.getAdaptableOptions()) === null || _a === void 0 ? void 0 : _a.layoutOptions) === null || _b === void 0 ? void 0 : _b.viewOptions) === null || _c === void 0 ? void 0 : _c.maxColumnsToDisplay) !== null && _d !== void 0 ? _d : 10;
147
+ const maxColumnsToDisplay = (_d = (_c = (_b = (_a = this.api.internalApi.getAdaptableOptions()) === null || _a === void 0 ? void 0 : _a.layoutOptions) === null || _b === void 0 ? void 0 : _b.layoutViewOptions) === null || _c === void 0 ? void 0 : _c.maxColumnsToDisplay) !== null && _d !== void 0 ? _d : 10;
148
148
  const columnIdToFriendlyName = (columnId) => {
149
149
  return this.api.columnApi.getFriendlyNameFromColumnId(columnId);
150
150
  };
@@ -157,6 +157,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
157
157
  .map((colId) => columnIdToFriendlyName(colId));
158
158
  columns = [...firstNColumns, `and other ${extraColumns}`];
159
159
  }
160
+ columns = columns.map((column) => this.api.columnApi.getFriendlyNameFromColumnId(column));
160
161
  return {
161
162
  items: [
162
163
  {
@@ -220,9 +221,8 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
220
221
  };
221
222
  }
222
223
  handleLayoutChange() {
223
- // update objects associated with the current layout via the LayoutOptions.isObjectAssociatedWithLayout() method
224
- if (!this.api.internalApi.getAdaptableOptions().layoutOptions.isObjectAvailableInLayout) {
225
- // no need if no callback implementation is provided
224
+ if (!this.api.internalApi.hasLayoutSpecificObjects()) {
225
+ // no need if no callback implementation is provided or no auto checking
226
226
  return;
227
227
  }
228
228
  // PlusMinus
@@ -8,6 +8,6 @@ exports.getObjectTagsViewItems = (object, api) => {
8
8
  }
9
9
  return {
10
10
  name: 'Tags',
11
- values: (_a = object === null || object === void 0 ? void 0 : object.Tags) === null || _a === void 0 ? void 0 : _a.map((tag) => tag.label),
11
+ values: (_a = object === null || object === void 0 ? void 0 : object.Tags) === null || _a === void 0 ? void 0 : _a.map((tag) => api.internalApi.getLabelForTag(tag)),
12
12
  };
13
13
  };
@@ -134,9 +134,12 @@ exports.DefaultAdaptableOptions = {
134
134
  autoSizeColumnsInLayout: false,
135
135
  autoSizeColumnsInPivotLayout: false,
136
136
  createDefaultLayout: false,
137
- viewOptions: {
137
+ layoutViewOptions: {
138
138
  maxColumnsToDisplay: 10,
139
139
  },
140
+ layoutTagOptions: {
141
+ autoCheckTagsForLayouts: false,
142
+ },
140
143
  },
141
144
  menuOptions: {
142
145
  showAdaptableContextMenu: true,
@@ -196,13 +196,14 @@ const getSumAggregation$ = (source$, initialSum) => {
196
196
  const getColumnValueSum = (column, context) => {
197
197
  let sum = 0;
198
198
  context.api.internalApi.forAllRowNodesDo((rowNode) => {
199
- var _a;
200
199
  // if there is a WHERE clause defined, check if the current rowNode satisfies the condition
201
200
  if (context.filterFn && !context.filterFn(rowNode)) {
202
201
  return;
203
202
  }
204
- const cellValue = (_a = rowNode.data) === null || _a === void 0 ? void 0 : _a[column];
205
- // cell value may not always be defined (ex. group nodes)
203
+ if (context.api.gridApi.isGroupRowNode(rowNode)) {
204
+ return;
205
+ }
206
+ const cellValue = context.api.gridApi.getRawValueFromRowNode(rowNode, column);
206
207
  if (cellValue != undefined) {
207
208
  sum = sum + expressionFunctionUtils_1.getNumericValue(rowNode.data[column]);
208
209
  }
@@ -28,15 +28,7 @@ exports.aggregatedScalarExpressionFunctions = {
28
28
  },
29
29
  columnDependencies: [sumColumnName],
30
30
  };
31
- if (groupByParameter) {
32
- const groupByColumnName = groupByParameter.value;
33
- aggregationExpressionEvaluation.aggregationParams.groupBy = [
34
- {
35
- field: groupByColumnName,
36
- },
37
- ];
38
- aggregationExpressionEvaluation.columnDependencies.push(groupByColumnName);
39
- }
31
+ addGroupByParams(groupByParameter, aggregationExpressionEvaluation);
40
32
  const result = {
41
33
  name: 'SUM',
42
34
  type: 'aggregation',
@@ -149,15 +141,7 @@ exports.aggregatedScalarExpressionFunctions = {
149
141
  },
150
142
  columnDependencies: [avgColumnName],
151
143
  };
152
- if (groupByParameter) {
153
- const groupByColumnName = groupByParameter.value;
154
- aggregationExpressionEvaluation.aggregationParams.groupBy = [
155
- {
156
- field: groupByColumnName,
157
- },
158
- ];
159
- aggregationExpressionEvaluation.columnDependencies.push(groupByColumnName);
160
- }
144
+ addGroupByParams(groupByParameter, aggregationExpressionEvaluation);
161
145
  const result = {
162
146
  name: 'AVG',
163
147
  type: 'aggregation',
@@ -198,15 +182,7 @@ exports.aggregatedScalarExpressionFunctions = {
198
182
  },
199
183
  columnDependencies: [minColumnName],
200
184
  };
201
- if (groupByParameter) {
202
- const groupByColumnName = groupByParameter.value;
203
- aggregationExpressionEvaluation.aggregationParams.groupBy = [
204
- {
205
- field: groupByColumnName,
206
- },
207
- ];
208
- aggregationExpressionEvaluation.columnDependencies.push(groupByColumnName);
209
- }
185
+ addGroupByParams(groupByParameter, aggregationExpressionEvaluation);
210
186
  const result = {
211
187
  name: 'MIN',
212
188
  type: 'aggregation',
@@ -247,15 +223,7 @@ exports.aggregatedScalarExpressionFunctions = {
247
223
  },
248
224
  columnDependencies: [maxColumnName],
249
225
  };
250
- if (groupByParameter) {
251
- const groupByColumnName = groupByParameter.value;
252
- aggregationExpressionEvaluation.aggregationParams.groupBy = [
253
- {
254
- field: groupByColumnName,
255
- },
256
- ];
257
- aggregationExpressionEvaluation.columnDependencies.push(groupByColumnName);
258
- }
226
+ addGroupByParams(groupByParameter, aggregationExpressionEvaluation);
259
227
  const result = {
260
228
  name: 'MAX',
261
229
  type: 'aggregation',
@@ -337,3 +305,15 @@ exports.aggregatedScalarExpressionFunctions = {
337
305
  examples: ['[col1]', 'COL("col1")'],
338
306
  },
339
307
  };
308
+ // !! mutates expressionEvaluation
309
+ const addGroupByParams = (groupByParameter, expressionEvaluation) => {
310
+ if (groupByParameter) {
311
+ const groupByColumnName = groupByParameter.value;
312
+ expressionEvaluation.aggregationParams.groupBy = [
313
+ {
314
+ field: groupByColumnName,
315
+ },
316
+ ];
317
+ expressionEvaluation.columnDependencies.push(groupByColumnName);
318
+ }
319
+ };
@@ -18,10 +18,19 @@ const differenceInMonths_1 = tslib_1.__importDefault(require("date-fns/differenc
18
18
  const differenceInYears_1 = tslib_1.__importDefault(require("date-fns/differenceInYears"));
19
19
  const expressionFunctionUtils_1 = require("./expressionFunctionUtils");
20
20
  const dateUtils_1 = require("./dateUtils");
21
+ const sanitizeArguments = (values, allowNaN) => {
22
+ return values.filter((value) => value != undefined && value != null && value !== '' && (allowNaN || !isNaN(value)));
23
+ };
24
+ const sanitizeNumericResult = (value) => {
25
+ if (isNaN(value)) {
26
+ return '';
27
+ }
28
+ return value;
29
+ };
21
30
  exports.scalarExpressionFunctions = {
22
31
  ADD: {
23
32
  handler(args) {
24
- return args.reduce((a, b) => a + b);
33
+ return sanitizeArguments(args, true).reduce((a, b) => a + b);
25
34
  },
26
35
  isHiddenFromMenu: true,
27
36
  description: 'Returns the sum of 2 numbers',
@@ -30,7 +39,7 @@ exports.scalarExpressionFunctions = {
30
39
  },
31
40
  SUB: {
32
41
  handler(args) {
33
- return args.reduce((a, b) => a - b);
42
+ return sanitizeArguments(args).reduce((a, b) => a - b);
34
43
  },
35
44
  isHiddenFromMenu: true,
36
45
  description: 'Returns the difference of 2 numbers',
@@ -39,7 +48,7 @@ exports.scalarExpressionFunctions = {
39
48
  },
40
49
  MUL: {
41
50
  handler(args) {
42
- return args.reduce((a, b) => a * b);
51
+ return sanitizeNumericResult(args.reduce((a, b) => a * b));
43
52
  },
44
53
  isHiddenFromMenu: true,
45
54
  description: 'Returns the product of 2 numbers',
@@ -48,7 +57,7 @@ exports.scalarExpressionFunctions = {
48
57
  },
49
58
  DIV: {
50
59
  handler(args) {
51
- return args.reduce((a, b) => a / b);
60
+ return sanitizeNumericResult(args.reduce((a, b) => a / b));
52
61
  },
53
62
  isHiddenFromMenu: true,
54
63
  description: 'Returns the division of 2 numbers',
@@ -57,7 +66,7 @@ exports.scalarExpressionFunctions = {
57
66
  },
58
67
  MOD: {
59
68
  handler(args) {
60
- return args[0] % args[1];
69
+ return sanitizeNumericResult(args[0] % args[1]);
61
70
  },
62
71
  isHiddenFromMenu: true,
63
72
  description: 'Returns the modulo of 2 numbers',
@@ -66,7 +75,7 @@ exports.scalarExpressionFunctions = {
66
75
  },
67
76
  POW: {
68
77
  handler(args) {
69
- return Math.pow(args[0], args[1]);
78
+ return sanitizeNumericResult(Math.pow(args[0], args[1]));
70
79
  },
71
80
  isHiddenFromMenu: true,
72
81
  description: 'Returns the pow of 2 numbers',
@@ -101,7 +110,7 @@ exports.scalarExpressionFunctions = {
101
110
  },
102
111
  MIN: {
103
112
  handler(args) {
104
- return Math.min(...args);
113
+ return Math.min(...sanitizeArguments(args));
105
114
  },
106
115
  description: 'Returns the smallest of inputted numbers',
107
116
  signatures: ['MIN(number, number, ...number)'],
@@ -109,7 +118,7 @@ exports.scalarExpressionFunctions = {
109
118
  },
110
119
  MAX: {
111
120
  handler(args) {
112
- return Math.max(...args);
121
+ return Math.max(...sanitizeArguments(args));
113
122
  },
114
123
  description: 'Returns the highest of inputted numbers',
115
124
  signatures: ['MAX(number, number, ...number)'],
@@ -117,9 +126,10 @@ exports.scalarExpressionFunctions = {
117
126
  },
118
127
  AVG: {
119
128
  handler(args) {
120
- if (args.length === 0)
129
+ if (args.length === 0) {
121
130
  return 0;
122
- return args.reduce((a, b) => a + b) / args.length;
131
+ }
132
+ return sanitizeArguments(args).reduce((a, b) => a + b) / args.length;
123
133
  },
124
134
  description: 'Returns the average of inputted numbers',
125
135
  signatures: ['AVG(number, number, ...number)'],
@@ -222,7 +232,7 @@ exports.scalarExpressionFunctions = {
222
232
  handler(args) {
223
233
  const [first, second] = dateUtils_1.normalizeDateParams(args);
224
234
  const result = differenceInDays_1.default(first, second);
225
- return isNaN(result) ? '' : result;
235
+ return sanitizeNumericResult(result);
226
236
  },
227
237
  description: 'Returns the difference in days between 2 dates',
228
238
  signatures: ['DIFF_DAYS(a: date, b: date)'],
@@ -232,7 +242,7 @@ exports.scalarExpressionFunctions = {
232
242
  handler(args) {
233
243
  const [first, second] = dateUtils_1.normalizeDateParams(args);
234
244
  const result = differenceInWeeks_1.default(first, second);
235
- return isNaN(result) ? '' : result;
245
+ return sanitizeNumericResult(result);
236
246
  },
237
247
  description: 'Returns the difference in weeks between 2 dates',
238
248
  signatures: ['DIFF_WEEKS(a: date, b: date)'],
@@ -242,7 +252,7 @@ exports.scalarExpressionFunctions = {
242
252
  handler(args) {
243
253
  const [first, second] = dateUtils_1.normalizeDateParams(args);
244
254
  const result = differenceInMonths_1.default(first, second);
245
- return isNaN(result) ? '' : result;
255
+ return sanitizeNumericResult(result);
246
256
  },
247
257
  description: 'Returns the difference in months between 2 dates',
248
258
  signatures: ['DIFF_MONTHS(a: date, b: date)'],
@@ -252,7 +262,7 @@ exports.scalarExpressionFunctions = {
252
262
  handler(args) {
253
263
  const [first, second] = dateUtils_1.normalizeDateParams(args);
254
264
  const result = differenceInYears_1.default(first, second);
255
- return isNaN(result) ? '' : result;
265
+ return sanitizeNumericResult(result);
256
266
  },
257
267
  description: 'Returns the difference in years between 2 dates',
258
268
  signatures: ['DIFF_YEARS(a: date, b: date)'],
@@ -163,19 +163,39 @@ class AggregatedScalarCalculatedColumn {
163
163
  return this.expressionEvaluation.columnDependencies;
164
164
  }
165
165
  computeAggregatedValue(expressionEvaluation) {
166
- const gridData = this.adaptableApi.gridApi.getGridData();
166
+ var _a;
167
+ const gridRowNodes = this.adaptableApi.gridApi.getAllRowNodes();
168
+ // we iterate over the RowNode list (we need this to handle complex column values (nested values, valueGetters etc)
169
+ // so we will map the fieldNames to RowNode.data
170
+ const mapReducerValueGetter = (fieldName) => {
171
+ return (rowNode) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
172
+ };
173
+ Object.values(expressionEvaluation.aggregationParams.reducers).forEach((aggregationReducer) => {
174
+ aggregationReducer.getter = mapReducerValueGetter(aggregationReducer.field);
175
+ // nullify the getter to force the fallback on the getter fn
176
+ aggregationReducer.field = null;
177
+ });
178
+ const mapGroupByToKey = (fieldName) => {
179
+ return (_unusableProperty, rowNode) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, fieldName);
180
+ };
181
+ (_a = expressionEvaluation.aggregationParams.groupBy) === null || _a === void 0 ? void 0 : _a.forEach((groupByDef) => {
182
+ groupByDef.toKey = mapGroupByToKey(groupByDef.field);
183
+ });
167
184
  if (!expressionEvaluation.cumulateOver) {
168
- return scalarAggregationHelper_1.aggregate(expressionEvaluation.aggregationParams, gridData);
185
+ return scalarAggregationHelper_1.aggregate(expressionEvaluation.aggregationParams, gridRowNodes);
169
186
  }
170
187
  else {
171
188
  // 1. sort grid data by given OVER column
172
189
  const sortByColumn = expressionEvaluation.cumulateOver;
173
- // currently we support only ascending sorting
174
- gridData.sort((first, second) => {
175
- if (first[sortByColumn] < second[sortByColumn]) {
190
+ const getRowNodeValue = (rowNode, columnId) => this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, columnId);
191
+ // currently, we support only ascending sorting
192
+ gridRowNodes.sort((first, second) => {
193
+ const firstValue = getRowNodeValue(first, sortByColumn);
194
+ const secondValue = getRowNodeValue(second, sortByColumn);
195
+ if (firstValue < secondValue) {
176
196
  return -1;
177
197
  }
178
- if (first[sortByColumn] > second[sortByColumn]) {
198
+ if (firstValue > secondValue) {
179
199
  return 1;
180
200
  }
181
201
  return 0;
@@ -184,11 +204,14 @@ class AggregatedScalarCalculatedColumn {
184
204
  if (!expressionEvaluation.aggregationParams.groupBy) {
185
205
  expressionEvaluation.aggregationParams.groupBy = [];
186
206
  }
187
- const gridPrimaryKey = this.adaptableApi.internalApi.getAdaptableOptions().primaryKey;
207
+ const gridPrimaryKeyColumn = this.adaptableApi.internalApi.getAdaptableOptions().primaryKey;
188
208
  // !! aggregationParams mutated
189
- expressionEvaluation.aggregationParams.groupBy.push({ field: gridPrimaryKey });
209
+ expressionEvaluation.aggregationParams.groupBy.push({
210
+ field: gridPrimaryKeyColumn,
211
+ toKey: mapGroupByToKey(gridPrimaryKeyColumn),
212
+ });
190
213
  // 3. cumulate
191
- return scalarAggregationHelper_1.cumulate(expressionEvaluation.aggregationParams, gridData);
214
+ return scalarAggregationHelper_1.cumulate(expressionEvaluation.aggregationParams, gridRowNodes);
192
215
  }
193
216
  }
194
217
  getAggregationValue(rowNode) {
@@ -12,6 +12,7 @@ export interface AdaptablePopoverProps extends React.ClassAttributes<AdaptablePo
12
12
  useButton?: boolean;
13
13
  tooltipText?: string;
14
14
  popoverMinWidth?: number;
15
+ popupPadding?: number;
15
16
  }
16
17
  export declare class AdaptablePopover extends React.Component<AdaptablePopoverProps, {}> {
17
18
  render(): JSX.Element;
@@ -11,7 +11,7 @@ const OverlayTrigger_1 = tslib_1.__importDefault(require("../../components/Overl
11
11
  const rebass_1 = require("rebass");
12
12
  class AdaptablePopover extends React.Component {
13
13
  render() {
14
- var _a;
14
+ var _a, _b;
15
15
  let messageType = this.props.MessageType != null ? this.props.MessageType : 'Info';
16
16
  const showIcon = (_a = this.props.showIcon) !== null && _a !== void 0 ? _a : true;
17
17
  let useButton = this.props.useButton != null ? this.props.useButton : false;
@@ -27,7 +27,7 @@ class AdaptablePopover extends React.Component {
27
27
  } },
28
28
  title ? (React.createElement(rebass_1.Text, { fontSize: 2, padding: 2 },
29
29
  React.createElement("b", null, title))) : null,
30
- React.createElement(rebass_1.Box, { padding: 2 }, this.props.bodyText.map((textOrHTML, index) => (React.createElement("span", { key: index }, textOrHTML))))));
30
+ React.createElement(rebass_1.Box, { className: "ab-Popover__body", padding: (_b = this.props.popupPadding) !== null && _b !== void 0 ? _b : 2 }, this.props.bodyText.map((textOrHTML, index) => (React.createElement("span", { key: index }, textOrHTML))))));
31
31
  const icon = 'info'; // - think this is wrong - UIHelper.getGlyphByMessageType(messageType);
32
32
  const color = UIHelper_1.UIHelper.getColorByMessageType(messageType);
33
33
  const iconStyle = {
@@ -34,7 +34,7 @@ exports.isValidCalculatedColumnSettings = (data, api) => {
34
34
  var _a;
35
35
  const columns = api.columnApi.getColumns();
36
36
  if (!data.ColumnId) {
37
- return 'Column id cannot be empty';
37
+ return 'Column Id cannot be empty';
38
38
  }
39
39
  if (!((_a = data.CalculatedColumnSettings) === null || _a === void 0 ? void 0 : _a.DataType)) {
40
40
  return 'No data type specified for column';
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { IModule } from '../../../Strategy/Interface/IModule';
3
+ import { AdaptableObject } from '../../../types';
4
+ export interface AdaptableObjectCompactListItemProps {
5
+ module: IModule;
6
+ abObject: AdaptableObject;
7
+ }
8
+ export declare const AdaptableObjectCompactListItem: React.FunctionComponent<AdaptableObjectCompactListItemProps>;
9
+ export interface AdaptableObjectCompactListProps {
10
+ abObjects: AdaptableObject[];
11
+ module: IModule;
12
+ }
13
+ export declare const AdaptableObjectCompactList: React.FunctionComponent<AdaptableObjectCompactListProps>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdaptableObjectCompactList = exports.AdaptableObjectCompactListItem = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const react_redux_1 = require("react-redux");
7
+ const rebass_1 = require("rebass");
8
+ const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
9
+ const AdaptableContext_1 = require("../../AdaptableContext");
10
+ const ValueSelector_1 = require("../ValueSelector");
11
+ const baseClassName = 'ab-Adaptable-Object-Compact-List';
12
+ const ICON_SIZE = 20;
13
+ exports.AdaptableObjectCompactListItem = (props) => {
14
+ var _a, _b, _c, _d, _e, _f, _g;
15
+ const dispatch = react_redux_1.useDispatch();
16
+ const adaptable = AdaptableContext_1.useAdaptable();
17
+ const objectView = props.module.toViewCompact(props.abObject);
18
+ const viewOptions = (_b = (_a = props.module) === null || _a === void 0 ? void 0 : _a.getViewProperties) === null || _b === void 0 ? void 0 : _b.call(_a);
19
+ const deleteAction = (_c = viewOptions === null || viewOptions === void 0 ? void 0 : viewOptions.getDeleteAction) === null || _c === void 0 ? void 0 : _c.call(viewOptions, props.abObject);
20
+ const moduleAccessLevel = adaptable.api.internalApi
21
+ .getEntitlementService()
22
+ .getEntitlementAccessLevelForModule(props.module.moduleInfo.ModuleName);
23
+ const handleDelete = React.useCallback(() => {
24
+ dispatch(deleteAction);
25
+ }, []);
26
+ return (React.createElement(rebass_1.Flex, { className: `${baseClassName}__Item`, alignItems: "center" },
27
+ React.createElement(rebass_1.Flex, { className: `${baseClassName}__Item__Name` }, (_d = objectView.item.label) !== null && _d !== void 0 ? _d : objectView.item.name),
28
+ React.createElement(rebass_1.Box, { flex: 1 },
29
+ objectView.item.view &&
30
+ React.createElement(objectView.item.view, {
31
+ data: props.abObject,
32
+ }),
33
+ Boolean(((_e = objectView.item) === null || _e === void 0 ? void 0 : _e.values) && ((_g = (_f = objectView.item) === null || _f === void 0 ? void 0 : _f.values) === null || _g === void 0 ? void 0 : _g.length)) && (React.createElement(rebass_1.Box, { mb: 2, className: `${baseClassName}__Item__Values` },
34
+ React.createElement(ValueSelector_1.ValueOptionsTags, { style: { marginRight: 0 }, readOnly: true, options: objectView.item.values, value: objectView.item.values, allowWrap: true, toIdentifier: (c) => c, toLabel: (c) => React.createElement(React.Fragment, null, c) })))),
35
+ React.createElement(rebass_1.Flex, null, deleteAction && (React.createElement(SimpleButton_1.default, { iconSize: ICON_SIZE, icon: "delete", variant: "text", onClick: handleDelete, accessLevel: moduleAccessLevel })))));
36
+ };
37
+ exports.AdaptableObjectCompactList = (props) => {
38
+ return (React.createElement("div", { className: baseClassName }, props.abObjects.map((abObject) => {
39
+ return React.createElement(exports.AdaptableObjectCompactListItem, { abObject: abObject, module: props.module });
40
+ })));
41
+ };
@@ -13,6 +13,7 @@ const AdaptableInput_1 = tslib_1.__importDefault(require("../AdaptableInput"));
13
13
  const AdaptableContext_1 = require("../../AdaptableContext");
14
14
  const ButtonInfo_1 = require("../Buttons/ButtonInfo");
15
15
  const DocumentationLinkConstants_1 = require("../../../Utilities/Constants/DocumentationLinkConstants");
16
+ const react_1 = require("react");
16
17
  exports.isRuleValid = (abObject, api, context) => {
17
18
  var _a, _b, _c, _d, _e, _f;
18
19
  if (!((_a = abObject === null || abObject === void 0 ? void 0 : abObject.Rule) === null || _a === void 0 ? void 0 : _a.Predicate) && !((_b = abObject === null || abObject === void 0 ? void 0 : abObject.Rule) === null || _b === void 0 ? void 0 : _b.BooleanExpression)) {
@@ -128,7 +129,7 @@ exports.EntityRulesEditor = (props) => {
128
129
  const setAggregationExpression = (expression) => {
129
130
  props.onChange(Object.assign(Object.assign({}, data), { Rule: { AggregatedBooleanExpression: expression } }));
130
131
  };
131
- const initialData = api.internalApi.getQueryPreviewData();
132
+ const initialData = react_1.useMemo(() => api.internalApi.getQueryPreviewData(), []);
132
133
  const showDocumentationLinks = api.internalApi.isDocumentationLinksDisplayed();
133
134
  return (React.createElement(rebass_1.Flex, Object.assign({ flexDirection: "column", padding: 2, pt: 0, pl: 0 }, flexProps, { style: Object.assign({ height: '100%' }, flexProps === null || flexProps === void 0 ? void 0 : flexProps.style) }),
134
135
  children,
@@ -9,6 +9,7 @@ const ExpressionEditor_1 = require("../../components/ExpressionEditor");
9
9
  const Input_1 = tslib_1.__importDefault(require("../../components/Input"));
10
10
  const StringExtensions_1 = require("../../Utilities/Extensions/StringExtensions");
11
11
  const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
12
+ const react_1 = require("react");
12
13
  class ExpressionWizard extends React.Component {
13
14
  constructor(props) {
14
15
  var _a, _b;
@@ -28,7 +29,7 @@ class ExpressionWizard extends React.Component {
28
29
  };
29
30
  }
30
31
  render() {
31
- const initialData = this.props.api.internalApi.getQueryPreviewData();
32
+ const initialData = react_1.useMemo(() => this.props.api.internalApi.getQueryPreviewData(), []);
32
33
  return (React.createElement(React.Fragment, null,
33
34
  React.createElement(ExpressionEditor_1.ExpressionEditor, { type: 'boolean', module: ModuleConstants_1.QueryModuleId, value: this.state.expression, onChange: this.handleCustomExpressionChange, initialData: initialData, columns: this.props.api.columnApi.getQueryableColumns(), namedQueries: this.props.api.queryApi.getAllNamedQuery(), api: this.props.api }),
34
35
  ' ',
@@ -105,7 +105,7 @@ exports.AdaptablePopupModuleView = (props) => {
105
105
  "s not available in current Layout")));
106
106
  };
107
107
  return (React.createElement(PopupPanel_1.PopupPanel, { glyphicon: moduleInfo.Glyph, infoLink: moduleInfo.HelpPage, headerText: moduleInfo.FriendlyName, button: newButton, infoLinkDisabled: !props.api.internalApi.isDocumentationLinksDisplayed() },
108
- !!(items === null || items === void 0 ? void 0 : items.length) && toggleButtonShowLayoutAssociatedObjects(),
108
+ toggleButtonShowLayoutAssociatedObjects(),
109
109
  (items === null || items === void 0 ? void 0 : items.length) ? (React.createElement(AdaptableObjectList_1.AdaptableObjectList, { module: props.module, items: items })) : (React.createElement(EmptyContent_1.default, null, emptyContent !== null && emptyContent !== void 0 ? emptyContent : `Click 'New' to create a new ${moduleInfo.FriendlyName}`)),
110
110
  isWizardOpen && EditWizard && (React.createElement(EditWizard, { abObjectType: abObjectType, moduleInfo: moduleInfo, data: null, popupParams: props.popupParams, configEntities: null, onCloseWizard: handleWizardClose, onFinishWizard: handleWizardClose }))));
111
111
  };
@@ -12,11 +12,12 @@ exports.TagValueSelector = (props) => {
12
12
  return (_a = api.internalApi.getAvailableTags()) !== null && _a !== void 0 ? _a : [];
13
13
  };
14
14
  const { availableTags = getDefaultTags(), selectedTags = [], onChange, singleSelect } = props;
15
- return (React.createElement(ValueSelector_1.ValueSelector, { options: availableTags, value: selectedTags.map((tag) => tag.value), singleSelect: singleSelect, allowReorder: false, onChange: (selectedTagsIds, selectedTagsMap) => {
15
+ return (React.createElement(ValueSelector_1.ValueSelector, { options: availableTags, value: selectedTags.map((tag) => api.internalApi.getLabelForTag(tag)), singleSelect: singleSelect, allowReorder: false, onChange: (selectedTagsIds, selectedTagsMap) => {
16
16
  onChange(selectedTagsIds.map((id) => selectedTagsMap.get(id)));
17
- }, selectionBoxPosition: 'top', toIdentifier: (tag) => tag.value, toLabel: (tag) => tag.label, noSelectionLabel: singleSelect ? 'Select a tag' : 'You have not selected any tags.', xSelectedLabel: singleSelect ? () => 'Selected tag:' : () => 'Selected tags:' }));
17
+ }, selectionBoxPosition: 'top', toIdentifier: (tag) => api.internalApi.getLabelForTag(tag), toLabel: (tag) => api.internalApi.getLabelForTag(tag), noSelectionLabel: singleSelect ? 'Select a tag' : 'You have not selected any tags.', xSelectedLabel: singleSelect ? () => 'Selected tag:' : () => 'Selected tags:' }));
18
18
  };
19
19
  exports.TagValueOptionsTags = (props) => {
20
20
  const { tags = [] } = props;
21
- return (React.createElement(ValueSelector_1.ValueOptionsTags, { options: tags, value: tags.map((tag) => tag.value), toIdentifier: (tag) => tag.value, toLabel: (tag) => tag.label, allowWrap: true, readOnly: true }));
21
+ const { api } = AdaptableContext_1.useAdaptable();
22
+ return (React.createElement(ValueSelector_1.ValueOptionsTags, { options: tags, value: tags.map((tag) => api.internalApi.getValueForTag(tag)), toIdentifier: (tag) => api.internalApi.getValueForTag(tag), toLabel: (tag) => api.internalApi.getLabelForTag(tag), allowWrap: true, readOnly: true }));
22
23
  };
@@ -20,8 +20,8 @@ const ConditionalStyleRedux = tslib_1.__importStar(require("../../../Redux/Actio
20
20
  const ConditionalStyleSettingsWizardSettings_1 = require("./ConditionalStyleSettingsWizardSettings");
21
21
  const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection");
22
22
  exports.ConditionalStyleWizard = (props) => {
23
- var _a;
24
- const data = (_a = props.data) !== null && _a !== void 0 ? _a : props.popupParams.value;
23
+ var _a, _b;
24
+ const data = (_a = props.data) !== null && _a !== void 0 ? _a : (_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.value;
25
25
  const [conditionalStyle, setConditionalStyle] = react_1.useState(() => {
26
26
  var _a, _b, _c;
27
27
  const DEFAULT_RULE = {
@@ -32,6 +32,6 @@ exports.ReportExportDropdown = (props) => {
32
32
  if ((report === null || report === void 0 ? void 0 : report.Name) === GeneralConstants_1.VISUAL_DATA_REPORT) {
33
33
  destinationItems.forEach((item) => (item.disabled = item.label === Enums_1.ExportDestination.Excel ? false : true));
34
34
  }
35
- return (React.createElement(DropdownButton_1.default, { tooltip: "Export Report", variant: "text", items: destinationItems },
35
+ return (React.createElement(DropdownButton_1.default, { columns: ['label'], tooltip: "Export Report", variant: "text", items: destinationItems },
36
36
  React.createElement(icons_1.Icon, { name: "export" })));
37
37
  };