@adaptabletools/adaptable 14.0.0-canary.3 → 14.0.1-canary.0

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 (76) hide show
  1. package/bundle.cjs.js +196 -191
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -1
  6. package/src/AdaptableOptions/ActionOptions.d.ts +5 -3
  7. package/src/AdaptableOptions/AdaptableOptions.d.ts +16 -2
  8. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +4 -5
  9. package/src/AdaptableOptions/AlertOptions.d.ts +1 -0
  10. package/src/AdaptableOptions/ChartingOptions.d.ts +1 -0
  11. package/src/AdaptableOptions/ColumnOptions.d.ts +3 -0
  12. package/src/AdaptableOptions/DashboardOptions.d.ts +3 -0
  13. package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +1 -0
  14. package/src/AdaptableOptions/ExpressionOptions.d.ts +15 -15
  15. package/src/AdaptableOptions/FilterOptions.d.ts +9 -8
  16. package/src/AdaptableOptions/FinancePluginOptions.d.ts +0 -11
  17. package/src/AdaptableOptions/GeneralOptions.d.ts +3 -9
  18. package/src/AdaptableOptions/LayoutOptions.d.ts +2 -7
  19. package/src/AdaptableOptions/MenuOptions.d.ts +1 -1
  20. package/src/AdaptableOptions/NotificationsOptions.d.ts +1 -0
  21. package/src/AdaptableOptions/SearchOptions.d.ts +1 -0
  22. package/src/AdaptableOptions/SettingsPanelOptions.d.ts +2 -0
  23. package/src/AdaptableOptions/StateOptions.d.ts +0 -4
  24. package/src/AdaptableOptions/ToolPanelOptions.d.ts +1 -0
  25. package/src/Api/AlertApi.d.ts +3 -3
  26. package/src/Api/EventApi.d.ts +8 -8
  27. package/src/Api/GridApi.d.ts +5 -5
  28. package/src/Api/Implementation/AlertApiImpl.d.ts +1 -1
  29. package/src/Api/Implementation/AlertApiImpl.js +1 -1
  30. package/src/Api/Implementation/GridApiImpl.js +1 -1
  31. package/src/Api/Implementation/StyledColumnApiImpl.d.ts +1 -0
  32. package/src/Api/Implementation/StyledColumnApiImpl.js +6 -0
  33. package/src/Api/Implementation/TeamSharingApiImpl.d.ts +2 -0
  34. package/src/Api/Implementation/TeamSharingApiImpl.js +7 -0
  35. package/src/Api/Internal/AdaptableInternalApi.js +2 -2
  36. package/src/Api/Internal/LayoutInternalApi.js +1 -2
  37. package/src/Api/Internal/PredicateInternalApi.js +0 -7
  38. package/src/Api/Internal/TeamSharingInternalApi.d.ts +0 -5
  39. package/src/Api/Internal/TeamSharingInternalApi.js +0 -9
  40. package/src/Api/StyledColumnApi.d.ts +7 -2
  41. package/src/Api/TeamSharingApi.d.ts +8 -0
  42. package/src/PredefinedConfig/AlertState.d.ts +1 -1
  43. package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -6
  44. package/src/PredefinedConfig/Common/Menu.d.ts +5 -5
  45. package/src/PredefinedConfig/Common/SpecialColumnSettings.d.ts +6 -2
  46. package/src/PredefinedConfig/FormatColumnState.d.ts +2 -3
  47. package/src/PredefinedConfig/FreeTextColumnState.d.ts +1 -6
  48. package/src/Strategy/FreeTextColumnModule.js +24 -5
  49. package/src/Strategy/StyledColumnModule.js +60 -28
  50. package/src/Strategy/TeamSharingModule.js +2 -2
  51. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +0 -3
  52. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +1 -1
  53. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +11 -10
  54. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +11 -7
  55. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +1 -1
  56. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +26 -52
  57. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +13 -13
  58. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -1
  59. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +101 -44
  60. package/src/Utilities/ObjectFactory.js +1 -1
  61. package/src/View/Components/Popups/AdaptablePopupConfirmation.js +1 -1
  62. package/src/View/Dashboard/CustomToolbarWrapper.js +7 -1
  63. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +18 -10
  64. package/src/agGrid/Adaptable.d.ts +0 -1
  65. package/src/agGrid/Adaptable.js +10 -21
  66. package/src/agGrid/agGridHelper.js +3 -0
  67. package/src/components/ExpressionEditor/BaseEditorInput.js +42 -7
  68. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +5 -5
  69. package/src/components/ExpressionEditor/editorButtonsSearch.js +8 -12
  70. package/src/metamodel/adaptable.metamodel.d.ts +106 -58
  71. package/src/metamodel/adaptable.metamodel.js +1 -1
  72. package/src/parser/src/types.d.ts +5 -9
  73. package/src/parser/src/utils.js +6 -3
  74. package/src/types.d.ts +3 -3
  75. package/version.d.ts +1 -1
  76. package/version.js +1 -1
@@ -2,6 +2,6 @@ import { ExpressionFunction } from '../../parser/src/types';
2
2
  /**
3
3
  * List of all the Boolean Functions available in AdaptableQL
4
4
  */
5
- export declare type BooleanFunctionName = 'EQ' | 'NEQ' | 'GT' | 'LT' | 'GTE' | 'LTE' | 'AND' | 'OR' | 'NOT' | 'BETWEEN' | 'IN' | 'IS_BLANK' | 'CONTAINS' | 'STARTS_WITH' | 'ENDS_WITH' | 'ANY_CONTAINS' | 'QUERY';
5
+ export declare type BooleanFunctionName = 'EQ' | 'NEQ' | 'GT' | 'LT' | 'GTE' | 'LTE' | 'AND' | 'OR' | 'NOT' | 'BETWEEN' | 'IN' | 'CONTAINS' | 'STARTS_WITH' | 'ENDS_WITH' | 'ANY_CONTAINS' | 'TRUE' | 'FALSE';
6
6
  export declare const booleanExpressionFunctions: Record<BooleanFunctionName, ExpressionFunction>;
7
7
  export declare const booleanExpressionFunctionsNames: BooleanFunctionName[];
@@ -5,53 +5,37 @@ const tslib_1 = require("tslib");
5
5
  const isAfter_1 = tslib_1.__importDefault(require("date-fns/isAfter"));
6
6
  const isBefore_1 = tslib_1.__importDefault(require("date-fns/isBefore"));
7
7
  const isEqual_1 = tslib_1.__importDefault(require("date-fns/isEqual"));
8
- const StringExtensions_1 = tslib_1.__importDefault(require("../Extensions/StringExtensions"));
9
- const src_1 = require("../../parser/src");
10
8
  const ExpressionEvaluationError_1 = require("../../parser/src/ExpressionEvaluationError");
11
9
  const expressionFunctionUtils_1 = require("./expressionFunctionUtils");
12
10
  const TypeExtensions_1 = require("../Extensions/TypeExtensions");
13
11
  exports.booleanExpressionFunctions = {
14
- QUERY: {
15
- handler(args, context) {
16
- var _a, _b;
17
- const namedQueryName = args[0];
18
- if (StringExtensions_1.default.IsNullOrEmpty(namedQueryName)) {
19
- return false;
20
- }
21
- const namedQuery = (_a = context.adaptableApi) === null || _a === void 0 ? void 0 : _a.queryApi.getNamedQueryByName(namedQueryName);
22
- if (!namedQuery) {
23
- throw new ExpressionEvaluationError_1.ExpressionEvaluationError('QUERY', `Named Query with name ${namedQueryName} not found!`);
24
- }
25
- // add query to call stack
26
- if (!context.namedQueryCallStack) {
27
- context.namedQueryCallStack = [];
28
- }
29
- context.namedQueryCallStack.push(namedQueryName);
30
- //check if this Named Query is not already evaluated, in which case this would lead to an infinite evaluation cycle
31
- const firstIndex = context.namedQueryCallStack.indexOf(namedQueryName);
32
- const lastIndex = context.namedQueryCallStack.lastIndexOf(namedQueryName);
33
- if (firstIndex !== lastIndex) {
34
- const cycle = context.namedQueryCallStack.slice(firstIndex, lastIndex + 1);
35
- throw new ExpressionEvaluationError_1.ExpressionEvaluationError(`${namedQueryName}`, ` contains a circular reference: ${cycle.join(' -> ')}`);
36
- }
37
- const queryEvaluationResult = (0, src_1.evaluate)(namedQuery.BooleanExpression, context);
38
- // remove query name from callstack
39
- (_b = context.namedQueryCallStack) === null || _b === void 0 ? void 0 : _b.pop();
40
- return queryEvaluationResult;
12
+ TRUE: {
13
+ handler: () => {
14
+ return true;
41
15
  },
42
- category: 'advanced',
43
- description: 'Returns the evaluation result of the Named Query with the given name',
44
- signatures: ['QUERY("anyNamedQuery")'],
45
- examples: ['QUERY("anyNamedQuery")'],
16
+ description: 'Returns the boolean value TRUE',
17
+ category: 'logical',
46
18
  returnType: 'boolean',
19
+ signatures: ['TRUE'],
20
+ examples: ['TRUE'],
21
+ },
22
+ FALSE: {
23
+ handler: () => {
24
+ return false;
25
+ },
26
+ description: 'Returns the boolean value FALSE',
27
+ category: 'logical',
28
+ returnType: 'boolean',
29
+ signatures: ['FALSE'],
30
+ examples: ['FALSE'],
47
31
  },
48
32
  AND: {
49
33
  handler(args) {
50
34
  return Boolean(args[0] && args[1]);
51
35
  },
52
36
  isHiddenFromMenu: true,
53
- category: 'logic',
54
- description: 'Returns true if both statements is true',
37
+ category: 'logical',
38
+ description: 'Returns true if both statements are true',
55
39
  signatures: ['statement AND statement'],
56
40
  examples: ['[col1] > 5 AND [col2] > 10'],
57
41
  returnType: 'boolean',
@@ -61,8 +45,8 @@ exports.booleanExpressionFunctions = {
61
45
  return Boolean(args[0] || args[1]);
62
46
  },
63
47
  isHiddenFromMenu: true,
64
- category: 'logic',
65
- description: 'Returns true if either statements is true',
48
+ category: 'logical',
49
+ description: 'Returns true if either statement is true',
66
50
  signatures: ['statement OR statement'],
67
51
  examples: ['[col1] > 5 OR [col2] > 10'],
68
52
  returnType: 'boolean',
@@ -72,7 +56,7 @@ exports.booleanExpressionFunctions = {
72
56
  return Boolean(!args[0]);
73
57
  },
74
58
  isHiddenFromMenu: true,
75
- category: 'logic',
59
+ category: 'logical',
76
60
  description: 'Returns the negation of a statement',
77
61
  signatures: ['!statement'],
78
62
  examples: ['!([col1] > 5 AND [col2] > 10)'],
@@ -91,7 +75,7 @@ exports.booleanExpressionFunctions = {
91
75
  },
92
76
  isHiddenFromMenu: true,
93
77
  category: 'comparison',
94
- description: 'Returns true if the 2 inputs are equal',
78
+ description: 'Returns true if the 2 (input) values are equal',
95
79
  signatures: ['value = value', 'EQ(a: value, b: value)'],
96
80
  examples: ['[col1] = 5', 'EQ([col1], 5)'],
97
81
  returnType: 'boolean',
@@ -109,7 +93,7 @@ exports.booleanExpressionFunctions = {
109
93
  },
110
94
  isHiddenFromMenu: true,
111
95
  category: 'comparison',
112
- description: 'Returns true if the 2 inputs are NOT equal',
96
+ description: 'Returns true if the 2 (input) values are NOT equal',
113
97
  signatures: ['value != value', 'NEQ(a: value, b: value)'],
114
98
  examples: ['[col1] != 5', 'NEQ([col1], 5)'],
115
99
  returnType: 'boolean',
@@ -223,19 +207,9 @@ exports.booleanExpressionFunctions = {
223
207
  return haystack.includes(needle);
224
208
  },
225
209
  category: 'comparison',
226
- description: 'Returns true if any input value is in the inputted column',
210
+ description: 'Returns true if the left-hand side value is a constituent element of the right-hand side sequence',
227
211
  signatures: ['values IN (value, value, ...value)'],
228
- examples: ['[col1] IN (5, 10, 17)'],
229
- returnType: 'boolean',
230
- },
231
- IS_BLANK: {
232
- handler(args) {
233
- return args[0] === undefined || args[0] === null || args[0] === '';
234
- },
235
- category: 'comparison',
236
- description: 'Returns true is input value is empty',
237
- signatures: ['IS_BLANK(input: any)'],
238
- examples: ['IS_BLANK([col1])'],
212
+ examples: ['[col1] IN (5, 10, AVG([col2],[col3]))'],
239
213
  returnType: 'boolean',
240
214
  },
241
215
  CONTAINS: {
@@ -17,11 +17,11 @@ exports.observableExpressionFunctions = {
17
17
  return (0, expressionFunctionUtils_1.handleWhereFunction)(args, context);
18
18
  },
19
19
  isHiddenFromMenu: true,
20
- description: 'Splits 2 composed queries, allowing for a main query(lhs) to have a where clause query(rhs) defined',
20
+ description: 'Limits the rows against which the Observable expression will be evaluated',
21
21
  signatures: ['<main_query> WHERE <boolean_query>'],
22
22
  examples: ['<main_query> WHERE <boolean_query>', '<main_query> WHERE QUERY("abc")'],
23
23
  hasEagerEvaluation: true,
24
- category: 'advanced',
24
+ category: 'conditional',
25
25
  },
26
26
  ROW_CHANGE: {
27
27
  handler(args, context) {
@@ -112,7 +112,7 @@ exports.observableExpressionFunctions = {
112
112
  description: 'References a column by its unique identifier',
113
113
  signatures: ['[colName]', 'COL(name: string)'],
114
114
  examples: ['[col1]', "COL('col1')"],
115
- category: 'advanced',
115
+ category: 'special',
116
116
  },
117
117
  COUNT: {
118
118
  handler(args) {
@@ -129,13 +129,13 @@ exports.observableExpressionFunctions = {
129
129
  };
130
130
  return result;
131
131
  },
132
- description: 'Observes if a column value has changed a given number of times',
132
+ description: 'Observes if a column value has changed a given number of times.\nValid only as an operand for an observable function.',
133
133
  signatures: [
134
134
  'COUNT([colName],changeCount: number)',
135
135
  'COUNT(COL(name: string),changeCount: number)',
136
136
  ],
137
137
  examples: ['COUNT([colName],2)', `COUNT(COL('col1'),10)`],
138
- category: 'observable',
138
+ category: 'operand',
139
139
  },
140
140
  NONE: {
141
141
  handler(args) {
@@ -147,10 +147,10 @@ exports.observableExpressionFunctions = {
147
147
  };
148
148
  return result;
149
149
  },
150
- description: 'Observes if a column value has NOT changed',
150
+ description: 'Observes if a column value has NOT changed.\nValid only as an operand for an observable function.',
151
151
  signatures: ['NONE([colName])', 'NONE(COL(name: string))'],
152
152
  examples: ['NONE([colA])', `NONE(COL('col1'))`],
153
- category: 'observable',
153
+ category: 'operand',
154
154
  },
155
155
  MIN: {
156
156
  handler(args) {
@@ -162,10 +162,10 @@ exports.observableExpressionFunctions = {
162
162
  };
163
163
  return result;
164
164
  },
165
- description: 'Observes if the changed column value is the lowest',
165
+ description: 'Observes if the changed column value is the lowest.\nValid only as an operand for an observable function.',
166
166
  signatures: ['MIN([colName])', 'MIN(COL(name: string))'],
167
167
  examples: ['MIN([colA])', `MIN(COL('col1'))`],
168
- category: 'observable',
168
+ category: 'operand',
169
169
  },
170
170
  MAX: {
171
171
  handler(args) {
@@ -177,10 +177,10 @@ exports.observableExpressionFunctions = {
177
177
  };
178
178
  return result;
179
179
  },
180
- description: 'Observes if the changed column value is the highest',
180
+ description: 'Observes if the changed column value is the highest.\nValid only as an operand for an observable function.',
181
181
  signatures: ['MAX([colName])', 'MAX(COL(name: string))'],
182
182
  examples: ['MAX([colA])', `MAX(COL('col1'))`],
183
- category: 'observable',
183
+ category: 'operand',
184
184
  },
185
185
  TIMEFRAME: {
186
186
  handler(args, context) {
@@ -212,14 +212,14 @@ exports.observableExpressionFunctions = {
212
212
  };
213
213
  return result;
214
214
  },
215
- description: 'Limits the monitoring operators to a trailing timeframe defined in seconds, minutes or hours',
215
+ description: 'Limits the monitoring operators to a trailing timeframe defined in seconds, minutes or hours.\nValid only as an operand for an observable function.',
216
216
  signatures: [
217
217
  "TIMEFRAME('%numeric_value%s')",
218
218
  "TIMEFRAME('%numeric_value%m')",
219
219
  "TIMEFRAME('%numeric_value%h')",
220
220
  ],
221
221
  examples: ["TIMEFRAME('20s')", "TIMEFRAME('5m')", "TIMEFRAME('1h')"],
222
- category: 'observable',
222
+ category: 'operand',
223
223
  },
224
224
  };
225
225
  exports.observableExpressionFunctionNames = (0, TypeExtensions_1.getTypedKeys)(exports.observableExpressionFunctions);
@@ -2,6 +2,6 @@ import { ExpressionFunction } from '../../parser/src/types';
2
2
  /**
3
3
  * List of all the Scalar Functions available in AdaptableQL
4
4
  */
5
- export declare type ScalarFunctionName = 'ADD' | 'SUB' | 'MUL' | 'DIV' | 'MOD' | 'POW' | 'MIN' | 'MAX' | 'AVG' | 'DATE' | 'NOW' | 'TODAY' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | 'ADD_DAYS' | 'ADD_WEEKS' | 'ADD_MONTHS' | 'ADD_YEARS' | 'DIFF_DAYS' | 'DIFF_WEEKS' | 'DIFF_MONTHS' | 'DIFF_YEARS' | 'SUB_STRING' | 'REPLACE' | 'COALESCE' | 'LEN' | 'UPPER' | 'LOWER' | 'CONCAT' | 'IF' | 'CASE' | 'COL' | 'VAR';
5
+ export declare type ScalarFunctionName = 'ADD' | 'SUB' | 'MUL' | 'DIV' | 'MOD' | 'POW' | 'MIN' | 'MAX' | 'AVG' | 'DATE' | 'NOW' | 'TODAY' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | 'ADD_DAYS' | 'ADD_WEEKS' | 'ADD_MONTHS' | 'ADD_YEARS' | 'DIFF_DAYS' | 'DIFF_WEEKS' | 'DIFF_MONTHS' | 'DIFF_YEARS' | 'SUB_STRING' | 'REPLACE' | 'COALESCE' | 'LEN' | 'UPPER' | 'LOWER' | 'CONCAT' | 'IF' | 'CASE' | 'COL' | 'VAR' | 'TO_ARRAY' | 'QUERY' | 'IS_BLANK';
6
6
  export declare const scalarExpressionFunctions: Record<ScalarFunctionName, ExpressionFunction>;
7
7
  export declare const scalarExpressionFunctionNames: ScalarFunctionName[];
@@ -20,6 +20,7 @@ const expressionFunctionUtils_1 = require("./expressionFunctionUtils");
20
20
  const dateUtils_1 = require("./dateUtils");
21
21
  const StringExtensions_1 = tslib_1.__importDefault(require("../Extensions/StringExtensions"));
22
22
  const TypeExtensions_1 = require("../Extensions/TypeExtensions");
23
+ const src_1 = require("../../parser/src");
23
24
  const sanitizeArguments = (values, allowNaN) => {
24
25
  return values.filter((value) => value != undefined && value != null && value !== '' && (allowNaN || !isNaN(value)));
25
26
  };
@@ -30,6 +31,20 @@ const sanitizeNumericResult = (value) => {
30
31
  return value;
31
32
  };
32
33
  exports.scalarExpressionFunctions = {
34
+ VAR: {
35
+ handler(args, context) {
36
+ const [functionName, ...optionalArgs] = args;
37
+ if (StringExtensions_1.default.IsNullOrEmpty(functionName)) {
38
+ throw new ExpressionEvaluationError_1.ExpressionEvaluationError('VAR', 'should have a name');
39
+ }
40
+ return context.evaluateCustomQueryVariable(functionName, optionalArgs);
41
+ },
42
+ description: 'Returns the variable evaluation',
43
+ signatures: ['VAR(varName)', 'VAR(varName, arg1, arg2)'],
44
+ examples: ['VAR(CURRENT_USER)', 'VAR(IS_VALID_VALUE, IS_BLANK([col1]), [col2] < [col3])'],
45
+ category: 'special',
46
+ returnType: 'any',
47
+ },
33
48
  COL: {
34
49
  handler(args, context) {
35
50
  var _a, _b;
@@ -43,26 +58,79 @@ exports.scalarExpressionFunctions = {
43
58
  }
44
59
  return (_b = context.adaptableApi) === null || _b === void 0 ? void 0 : _b.gridApi.getNormalisedValueFromRowNode(context.node, columnId);
45
60
  },
46
- description: 'Returns the value of a column',
61
+ description: 'Returns the value of a Column',
47
62
  signatures: ['[colName]', 'COL(name: string)'],
48
63
  examples: ['[col1]', 'COL("col1")'],
49
- category: 'advanced',
64
+ category: 'special',
50
65
  returnType: 'any',
51
66
  },
52
- VAR: {
67
+ QUERY: {
53
68
  handler(args, context) {
54
- const [functionName, ...optionalArgs] = args;
55
- if (StringExtensions_1.default.IsNullOrEmpty(functionName)) {
56
- throw new ExpressionEvaluationError_1.ExpressionEvaluationError('VAR', 'should have a name');
69
+ var _a, _b;
70
+ const namedQueryName = args[0];
71
+ if (StringExtensions_1.default.IsNullOrEmpty(namedQueryName)) {
72
+ return false;
57
73
  }
58
- return context.evaluateCustomQueryVariable(functionName, optionalArgs);
74
+ const namedQuery = (_a = context.adaptableApi) === null || _a === void 0 ? void 0 : _a.queryApi.getNamedQueryByName(namedQueryName);
75
+ if (!namedQuery) {
76
+ throw new ExpressionEvaluationError_1.ExpressionEvaluationError('QUERY', `Named Query with name ${namedQueryName} not found!`);
77
+ }
78
+ // add query to call stack
79
+ if (!context.namedQueryCallStack) {
80
+ context.namedQueryCallStack = [];
81
+ }
82
+ context.namedQueryCallStack.push(namedQueryName);
83
+ //check if this Named Query is not already evaluated, in which case this would lead to an infinite evaluation cycle
84
+ const firstIndex = context.namedQueryCallStack.indexOf(namedQueryName);
85
+ const lastIndex = context.namedQueryCallStack.lastIndexOf(namedQueryName);
86
+ if (firstIndex !== lastIndex) {
87
+ const cycle = context.namedQueryCallStack.slice(firstIndex, lastIndex + 1);
88
+ throw new ExpressionEvaluationError_1.ExpressionEvaluationError(`${namedQueryName}`, ` contains a circular reference: ${cycle.join(' -> ')}`);
89
+ }
90
+ const queryEvaluationResult = (0, src_1.evaluate)(namedQuery.BooleanExpression, context);
91
+ // remove query name from callstack
92
+ (_b = context.namedQueryCallStack) === null || _b === void 0 ? void 0 : _b.pop();
93
+ return queryEvaluationResult;
94
+ },
95
+ category: 'special',
96
+ description: 'Returns the evaluation result of the Named Query with the given name',
97
+ signatures: ['QUERY("anyNamedQuery")'],
98
+ examples: ['QUERY("anyNamedQuery")'],
99
+ returnType: 'boolean',
100
+ },
101
+ TO_ARRAY: {
102
+ handler(args) {
103
+ if (!(args === null || args === void 0 ? void 0 : args.length)) {
104
+ return [];
105
+ }
106
+ return [...args];
59
107
  },
60
- description: 'Returns the variable evaluation',
61
- signatures: ['VAR(varName)', 'VAR(varName, arg1, arg2)'],
62
- examples: ['VAR(CURRENT_USER)', 'VAR(IS_VALID_VALUE, IS_BLANK([col1]), [col2] < [col3])'],
63
- category: 'advanced',
108
+ description: 'Creates an array containing all given parameters (which can be scalar values or expressions)',
109
+ signatures: ['TO_ARRAY(value1, expression1, value2)'],
110
+ examples: [`TO_ARRAY([col1], AVG([col2],[col3]), QUERY("maxValue"))`],
111
+ category: 'special',
64
112
  returnType: 'any',
65
113
  },
114
+ COALESCE: {
115
+ handler(args) {
116
+ return args.find((arg) => !(arg === null || arg === undefined));
117
+ },
118
+ description: 'Returns the first argument which is not null',
119
+ signatures: ['COALESCE(value, value, ...value)'],
120
+ examples: ['COALESCE([col1], [col2], [col3], 0)'],
121
+ category: 'special',
122
+ returnType: 'string',
123
+ },
124
+ IS_BLANK: {
125
+ handler(args) {
126
+ return args[0] === undefined || args[0] === null || args[0] === '';
127
+ },
128
+ category: 'special',
129
+ description: 'Returns true is input value is undefined, null or an empty string',
130
+ signatures: ['IS_BLANK(input: any)'],
131
+ examples: ['IS_BLANK([col1])'],
132
+ returnType: 'boolean',
133
+ },
66
134
  ADD: {
67
135
  handler(args) {
68
136
  const sanitizedArguments = sanitizeArguments(args, true);
@@ -76,7 +144,7 @@ exports.scalarExpressionFunctions = {
76
144
  description: 'Returns the sum of 2 numbers',
77
145
  signatures: ['number + number', 'ADD(a: number, b: number)'],
78
146
  examples: ['[col1] + 5', 'ADD([col1], 5)'],
79
- category: 'math',
147
+ category: 'maths',
80
148
  returnType: 'number',
81
149
  },
82
150
  SUB: {
@@ -92,7 +160,7 @@ exports.scalarExpressionFunctions = {
92
160
  description: 'Returns the difference of 2 numbers',
93
161
  signatures: ['number - number', 'SUB(a: number, b: number)'],
94
162
  examples: ['[col1] - 5', 'SUB([col1], 5)'],
95
- category: 'math',
163
+ category: 'maths',
96
164
  returnType: 'number',
97
165
  },
98
166
  MUL: {
@@ -103,7 +171,7 @@ exports.scalarExpressionFunctions = {
103
171
  description: 'Returns the product of 2 numbers',
104
172
  signatures: ['number * number', 'mul(a: number, b: number)'],
105
173
  examples: ['[col1] * 5', 'mul([col1], 5)'],
106
- category: 'math',
174
+ category: 'maths',
107
175
  returnType: 'number',
108
176
  },
109
177
  DIV: {
@@ -114,7 +182,7 @@ exports.scalarExpressionFunctions = {
114
182
  description: 'Returns the division of 2 numbers',
115
183
  signatures: ['number / number', 'DIV(a: number, b: number)'],
116
184
  examples: ['[col1] / 5', 'DIV([col1], 5)'],
117
- category: 'math',
185
+ category: 'maths',
118
186
  returnType: 'number',
119
187
  },
120
188
  MOD: {
@@ -125,7 +193,7 @@ exports.scalarExpressionFunctions = {
125
193
  description: 'Returns the modulo of 2 numbers',
126
194
  signatures: ['number % number', 'MOD(a: number, b: number)'],
127
195
  examples: ['[col1] % 5', 'MOD([col1], 5)'],
128
- category: 'math',
196
+ category: 'maths',
129
197
  returnType: 'number',
130
198
  },
131
199
  POW: {
@@ -136,7 +204,7 @@ exports.scalarExpressionFunctions = {
136
204
  description: 'Returns the pow of 2 numbers',
137
205
  signatures: ['number ^ number', 'POW(a: number, b: number)'],
138
206
  examples: ['[col1] ^ 5', 'POW([col1], 5)'],
139
- category: 'math',
207
+ category: 'maths',
140
208
  returnType: 'number',
141
209
  },
142
210
  IF: {
@@ -144,10 +212,10 @@ exports.scalarExpressionFunctions = {
144
212
  return args[0] ? args[1] : args[2];
145
213
  },
146
214
  isHiddenFromMenu: true,
147
- description: 'Returns one of two statements based on a condition',
148
- signatures: ['condition ? true_statement : false_statement'],
215
+ description: 'Evaluates a condition expression and returns the result of one of the two expressions, depending on whether the condition expression evaluates to true or false',
216
+ signatures: ['condition_expr ? true_statement : false_statement'],
149
217
  examples: ['[col1] > [col2] ? "BIG" : "SMALL"'],
150
- category: 'logic',
218
+ category: 'conditional',
151
219
  returnType: 'any',
152
220
  },
153
221
  CASE: {
@@ -157,19 +225,18 @@ exports.scalarExpressionFunctions = {
157
225
  (0, expressionFunctionUtils_1.evaluateExpressionNode)(expressionValueNode, context)
158
226
  : // otherwise it returns the first WHEN statement evaluated to TRUE
159
227
  true;
160
- let matchingCase = null;
161
- whenThenListNodes.forEach((whenThenStatement) => {
228
+ const matchingWhen = whenThenListNodes.find((whenThenStatement) => {
162
229
  const whenValue = (0, expressionFunctionUtils_1.evaluateExpressionNode)(whenThenStatement.WHEN, context);
163
- if (whenValue === caseExpressionValue) {
164
- matchingCase = (0, expressionFunctionUtils_1.evaluateExpressionNode)(whenThenStatement.THEN, context);
165
- return;
166
- }
230
+ return whenValue === caseExpressionValue;
167
231
  });
168
- if (!matchingCase && defaultValueNode) {
169
- // if provided, return the default CASE
170
- matchingCase = (0, expressionFunctionUtils_1.evaluateExpressionNode)(defaultValueNode, context);
232
+ if (!matchingWhen) {
233
+ if (defaultValueNode) {
234
+ return (0, expressionFunctionUtils_1.evaluateExpressionNode)(defaultValueNode, context);
235
+ }
236
+ return;
171
237
  }
172
- return matchingCase;
238
+ const matchingThen = (0, expressionFunctionUtils_1.evaluateExpressionNode)(matchingWhen.THEN, context);
239
+ return matchingThen;
173
240
  },
174
241
  isHiddenFromMenu: true,
175
242
  hasEagerEvaluation: true,
@@ -185,7 +252,7 @@ exports.scalarExpressionFunctions = {
185
252
  `CASE [day] WHEN 'Saturday' THEN 'weekend' WHEN 'Sunday' THEN 'weekend' ELSE 'workday' END`,
186
253
  `CASE WHEN [price] < 10 THEN 'low price' WHEN [price] < 50 THEN 'medium price' ELSE 'high price' END`,
187
254
  ],
188
- category: 'logic',
255
+ category: 'conditional',
189
256
  returnType: 'any',
190
257
  },
191
258
  MIN: {
@@ -195,7 +262,7 @@ exports.scalarExpressionFunctions = {
195
262
  description: 'Returns the smallest of inputted numbers',
196
263
  signatures: ['MIN(number, number, ...number)'],
197
264
  examples: ['MIN([col1], 5)'],
198
- category: 'math',
265
+ category: 'maths',
199
266
  returnType: 'number',
200
267
  },
201
268
  MAX: {
@@ -205,7 +272,7 @@ exports.scalarExpressionFunctions = {
205
272
  description: 'Returns the highest of inputted numbers',
206
273
  signatures: ['MAX(number, number, ...number)'],
207
274
  examples: ['MAX([col1], 5)'],
208
- category: 'math',
275
+ category: 'maths',
209
276
  returnType: 'number',
210
277
  },
211
278
  AVG: {
@@ -220,7 +287,7 @@ exports.scalarExpressionFunctions = {
220
287
  description: 'Returns the average of inputted numbers',
221
288
  signatures: ['AVG(number, number, ...number)'],
222
289
  examples: ['AVG([col1], 5)'],
223
- category: 'math',
290
+ category: 'maths',
224
291
  returnType: 'number',
225
292
  },
226
293
  DATE: {
@@ -441,16 +508,6 @@ exports.scalarExpressionFunctions = {
441
508
  category: 'strings',
442
509
  returnType: 'string',
443
510
  },
444
- COALESCE: {
445
- handler(args) {
446
- return args.find((arg) => !(arg === null || arg === undefined));
447
- },
448
- description: 'Returns the first argument which is not null',
449
- signatures: ['COALESCE(value, value, ...value)'],
450
- examples: ['COALESCE([col1], [col2], [col3], 0)'],
451
- category: 'strings',
452
- returnType: 'string',
453
- },
454
511
  CONCAT: {
455
512
  handler(args) {
456
513
  return args.join(' ');
@@ -293,8 +293,8 @@ function CreateEmptyFreeTextColumn() {
293
293
  DefaultValue: GeneralConstants_1.EMPTY_STRING,
294
294
  FreeTextStoredValues: [],
295
295
  TextEditor: 'Inline',
296
- DataType: 'String',
297
296
  FreeTextColumnSettings: {
297
+ DataType: 'String',
298
298
  Filterable: false,
299
299
  Resizable: false,
300
300
  Groupable: false,
@@ -53,7 +53,7 @@ const AdaptablePopupConfirmation = (props) => {
53
53
  React.createElement(rebass_1.Box, { pl: 2 },
54
54
  React.createElement(CheckBox_1.CheckBox, { checked: disableDeleteConfirmation, onChange: () => {
55
55
  setDisableDeleteConfirmation(!disableDeleteConfirmation);
56
- } }, "Do not show this again.")),
56
+ } }, "Do not show this again")),
57
57
  props.showInputBox && (React.createElement(rebass_1.Box, { padding: 2, "data-name": "body" },
58
58
  React.createElement("p", null, "Please enter a comment to confirm"),
59
59
  React.createElement(Input_1.default, { marginTop: 2, width: '100%', value: promptText, type: "string", placeholder: "Enter text", onChange: (e) => changeContent(e) }))),
@@ -43,9 +43,15 @@ const CustomToolbarWrapper = (props) => {
43
43
  if (props.customToolbar.frameworkComponent) {
44
44
  adaptableApi.internalApi.createFrameworkComponent(element, props.customToolbar.frameworkComponent, 'toolbar');
45
45
  }
46
+ const destroyUnsubscribe = adaptableApi.eventApi.on('AdaptableDestroy', () => {
47
+ var _a;
48
+ (_a = adaptableApi === null || adaptableApi === void 0 ? void 0 : adaptableApi.internalApi) === null || _a === void 0 ? void 0 : _a.destroyFrameworkComponent(element, props.customToolbar.frameworkComponent, 'toolbar');
49
+ });
46
50
  return () => {
51
+ var _a;
52
+ destroyUnsubscribe();
47
53
  if (props.customToolbar.frameworkComponent) {
48
- adaptableApi.internalApi.destroyFrameworkComponent(element, props.customToolbar.frameworkComponent, 'toolbar');
54
+ (_a = adaptableApi === null || adaptableApi === void 0 ? void 0 : adaptableApi.internalApi) === null || _a === void 0 ? void 0 : _a.destroyFrameworkComponent(element, props.customToolbar.frameworkComponent, 'toolbar');
49
55
  }
50
56
  };
51
57
  }, []);
@@ -34,7 +34,7 @@ const renderFreeTextColumnSummary = (data) => {
34
34
  React.createElement(Tag_1.Tag, null, (_a = data.FriendlyName) !== null && _a !== void 0 ? _a : data.ColumnId))) : null,
35
35
  React.createElement(rebass_1.Box, { mt: 3 },
36
36
  "Data Type: ",
37
- React.createElement(Tag_1.Tag, null, data.DataType)),
37
+ React.createElement(Tag_1.Tag, null, data.FreeTextColumnSettings.DataType)),
38
38
  data.DefaultValue !== undefined ? (React.createElement(rebass_1.Box, { mt: 3 },
39
39
  "Default Value: ",
40
40
  React.createElement(Tag_1.Tag, null, data.DefaultValue))) : null,
@@ -53,7 +53,7 @@ const isValidFreeTextColumn = (data, api) => {
53
53
  if (hasAlreadyExistingId) {
54
54
  return 'A Column already exists with that id';
55
55
  }
56
- if (!data.DataType) {
56
+ if (!data.FreeTextColumnSettings.DataType) {
57
57
  return 'No data type specified for column';
58
58
  }
59
59
  return true;
@@ -93,14 +93,16 @@ const FreeTextColumnSettingsWizardSection = (props) => {
93
93
  const handleDefaultValueChange = (event) => {
94
94
  let e = event.target;
95
95
  let DefaultValue = e.value;
96
- if (data.DataType === 'Date') {
96
+ if (data.FreeTextColumnSettings.DataType === 'Date') {
97
97
  DefaultValue = (0, FormatHelper_1.DateFormatter)(DefaultValue, {
98
98
  Pattern,
99
99
  });
100
100
  }
101
101
  props.onChange(Object.assign(Object.assign({}, data), { DefaultValue }));
102
102
  };
103
- const handleSpecialColumnSettingsChange = (settings) => {
103
+ const handleSpecialColumnSettingsChange = (
104
+ // settings: SpecialColumnSettings
105
+ settings) => {
104
106
  props.onChange(Object.assign(Object.assign({}, data), { FreeTextColumnSettings: Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.FreeTextColumnSettings), settings) }));
105
107
  };
106
108
  return (React.createElement(React.Fragment, null,
@@ -119,22 +121,28 @@ const FreeTextColumnSettingsWizardSection = (props) => {
119
121
  whiteSpace: 'normal',
120
122
  overflow: 'hidden',
121
123
  maxWidth: 'inherit',
122
- }, placeholder: "Select Data Type", showClearButton: !!data.DataType, onClear: () => handleDataTypeChange(null), columns: ['label'], items: options.map((item) => ({
124
+ }, placeholder: "Select Data Type", showClearButton: !!data.FreeTextColumnSettings.DataType, onClear: () => handleDataTypeChange(null), columns: ['label'], items: options.map((item) => ({
123
125
  value: item.value,
124
126
  label: item.label,
125
127
  onClick: () => handleDataTypeChange(item.value),
126
- })) }, data.DataType ? data.DataType : 'Select Data Type')),
127
- React.createElement(FormLayout_1.FormRow, { label: "Default Value" }, data.DataType === 'Boolean' ? (React.createElement(CheckBox_1.CheckBox, { "data-name": "column-default-value-checkbox", checked: !!data.DefaultValue, onChange: (DefaultValue) => {
128
+ })) }, data.FreeTextColumnSettings.DataType
129
+ ? data.FreeTextColumnSettings.DataType
130
+ : 'Select Data Type')),
131
+ React.createElement(FormLayout_1.FormRow, { label: "Default Value" }, data.FreeTextColumnSettings.DataType === 'Boolean' ? (React.createElement(CheckBox_1.CheckBox, { "data-name": "column-default-value-checkbox", checked: !!data.DefaultValue, onChange: (DefaultValue) => {
128
132
  props.onChange(Object.assign(Object.assign({}, data), { DefaultValue }));
129
- } })) : (React.createElement(AdaptableInput_1.default, { "data-name": "column-default-value", value: data.DataType === 'Date' && data.DefaultValue
133
+ } })) : (React.createElement(AdaptableInput_1.default, { "data-name": "column-default-value", value: data.FreeTextColumnSettings.DataType === 'Date' && data.DefaultValue
130
134
  ? (0, DateHelper_1.parseToISO)(data.DefaultValue, Pattern) || ''
131
- : data.DefaultValue || '', style: { width: '100%', maxWidth: 500 }, type: data.DataType === 'Number' ? 'number' : data.DataType === 'Date' ? 'date' : 'text', placeholder: "Default Column Value (not required)", onChange: (e) => handleDefaultValueChange(e) }))),
135
+ : data.DefaultValue || '', style: { width: '100%', maxWidth: 500 }, type: data.FreeTextColumnSettings.DataType === 'Number'
136
+ ? 'number'
137
+ : data.FreeTextColumnSettings.DataType === 'Date'
138
+ ? 'date'
139
+ : 'text', placeholder: "Default Column Value (not required)", onChange: (e) => handleDefaultValueChange(e) }))),
132
140
  React.createElement(FormLayout_1.FormRow, { label: "Header Tooltip" },
133
141
  React.createElement(Input_1.default, { "data-name": "header-tooltip", type: "text", style: { width: '100%', maxWidth: 500 }, value: ((_a = data.FreeTextColumnSettings) === null || _a === void 0 ? void 0 : _a.HeaderToolTip) || '', onChange: (e) => handleSpecialColumnSettingsChange({
134
142
  HeaderToolTip: e.target.value,
135
143
  }) })),
136
144
  ' ',
137
- data.DataType == 'String' && (React.createElement(FormLayout_1.FormRow, { label: "Editor Type" },
145
+ data.FreeTextColumnSettings.DataType == 'String' && (React.createElement(FormLayout_1.FormRow, { label: "Editor Type" },
138
146
  React.createElement(Radio_1.default, { "data-name": "inline-editor", value: "Inline", checked: data.TextEditor == 'Inline', onChange: (_, e) => onDynamicSelectChanged(e), marginRight: 2 }, "Inline Editor"),
139
147
  React.createElement(Radio_1.default, { "data-name": "large-editor", value: "Large", checked: data.TextEditor == 'Large', onChange: (_, e) => onDynamicSelectChanged(e) }, "Large Editor")))),
140
148
  ErrorMessage ? (React.createElement(ErrorBox_1.default, { mt: 2, mb: 2 }, ErrorMessage)) : null,
@@ -250,7 +250,6 @@ export declare class Adaptable implements IAdaptable {
250
250
  private getColDefsForSpecialColumns;
251
251
  getColDefsForFreeTextColumns(): ColDef<any>[];
252
252
  setupColumnValueGetter({ col }: ColumnSetupInfo): void;
253
- setupColumnAggFunc({ col }: ColumnSetupInfo): void;
254
253
  private getColDefsForRowEditColumns;
255
254
  getColDefsForActionColumns(): ColDef<any>[];
256
255
  updateColDefsForSpecialColumns(): void;