@adaptabletools/adaptable 13.0.0-canary.2 → 13.0.0-canary.4

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 (80) hide show
  1. package/agGrid.d.ts +23 -1
  2. package/agGrid.js +23 -1
  3. package/base.css +1 -0
  4. package/bundle.cjs.js +159 -159
  5. package/index.css +1 -0
  6. package/package.json +1 -1
  7. package/publishTimestamp.d.ts +1 -1
  8. package/publishTimestamp.js +1 -1
  9. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +42 -14
  10. package/src/AdaptableOptions/GeneralOptions.d.ts +6 -0
  11. package/src/Api/ConditionalStyleApi.d.ts +20 -0
  12. package/src/Api/FormatColumnApi.d.ts +42 -3
  13. package/src/Api/Implementation/ColumnApiImpl.js +3 -3
  14. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +17 -1
  15. package/src/Api/Implementation/FormatColumnApiImpl.js +94 -14
  16. package/src/Api/Implementation/InternalApiImpl.d.ts +1 -0
  17. package/src/Api/Implementation/InternalApiImpl.js +4 -0
  18. package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +0 -2
  19. package/src/Api/Implementation/QueryLanguageApiImpl.js +0 -3
  20. package/src/Api/Implementation/ToolPanelApiImpl.d.ts +3 -1
  21. package/src/Api/Implementation/ToolPanelApiImpl.js +8 -0
  22. package/src/Api/InternalApi.d.ts +1 -0
  23. package/src/Api/QueryLanguageApi.d.ts +0 -5
  24. package/src/Api/ToolPanelApi.d.ts +10 -1
  25. package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +1 -1
  26. package/src/PredefinedConfig/Common/AdaptablePredicate.js +37 -37
  27. package/src/PredefinedConfig/FormatColumnState.d.ts +19 -0
  28. package/src/PredefinedConfig/PredefinedConfig.d.ts +1 -0
  29. package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +14 -0
  30. package/src/Redux/ActionsReducers/FormatColumnRedux.js +43 -1
  31. package/src/Redux/Store/AdaptableStore.js +2 -0
  32. package/src/Strategy/ConditionalStyleModule.d.ts +2 -0
  33. package/src/Strategy/ConditionalStyleModule.js +6 -0
  34. package/src/Strategy/FormatColumnModule.d.ts +4 -9
  35. package/src/Strategy/FormatColumnModule.js +51 -1
  36. package/src/Strategy/Interface/IModule.d.ts +1 -0
  37. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +6 -5
  38. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +3 -2
  39. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +4 -1
  40. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +1 -0
  41. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +4 -1
  42. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +1 -0
  43. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +4 -1
  44. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +1 -0
  45. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +4 -1
  46. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -0
  47. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +4 -1
  48. package/src/Utilities/Extensions/TypeExtensions.d.ts +1 -0
  49. package/src/Utilities/Extensions/TypeExtensions.js +5 -0
  50. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +14 -4
  51. package/src/Utilities/Services/LicenseService.js +1 -1
  52. package/src/Utilities/Services/QueryLanguageService.d.ts +5 -3
  53. package/src/Utilities/Services/QueryLanguageService.js +92 -39
  54. package/src/Utilities/license/LicenseDetails.d.ts +1 -1
  55. package/src/Utilities/license/decode.d.ts +1 -0
  56. package/src/Utilities/license/decode.js +1 -1
  57. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +1 -0
  58. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.d.ts +2 -0
  59. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.js +18 -0
  60. package/src/View/FormatColumn/MoveFormatColumn.d.ts +7 -0
  61. package/src/View/FormatColumn/MoveFormatColumn.js +27 -0
  62. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
  63. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.d.ts +9 -0
  64. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +66 -0
  65. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +20 -2
  66. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +2 -1
  67. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +14 -0
  68. package/src/View/FormatColumn/Wizard/constants.d.ts +1 -0
  69. package/src/View/FormatColumn/Wizard/constants.js +4 -0
  70. package/src/agGrid/Adaptable.d.ts +5 -0
  71. package/src/agGrid/Adaptable.js +103 -45
  72. package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -1
  73. package/src/components/ExpressionEditor/EditorInput.js +1 -1
  74. package/src/components/ExpressionEditor/EditorInputWithWhereClause.js +1 -1
  75. package/src/metamodel/adaptable.metamodel.d.ts +47 -29
  76. package/src/metamodel/adaptable.metamodel.js +1 -1
  77. package/src/parser/src/types.d.ts +6 -3
  78. package/src/types.d.ts +2 -2
  79. package/version.d.ts +1 -1
  80. package/version.js +1 -1
@@ -13,6 +13,8 @@ const FormatColumnFormatWizardSection_1 = require("../View/FormatColumn/Wizard/F
13
13
  const getFormatColumnSettingsViewItems_1 = require("./Utilities/FormatColumn/getFormatColumnSettingsViewItems");
14
14
  const getFormatColumnStyleViewItems_1 = require("./Utilities/FormatColumn/getFormatColumnStyleViewItems");
15
15
  const getObjectTagsViewItems_1 = require("./Utilities/getObjectTagsViewItems");
16
+ const getRuleViewItems_1 = require("./Utilities/getRuleViewItems");
17
+ const MoveFormatColumn_1 = require("../View/FormatColumn/MoveFormatColumn");
16
18
  class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
17
19
  constructor(api) {
18
20
  super(ModuleConstants.FormatColumnModuleId, ModuleConstants.FormatColumnFriendlyName, 'format-column', 'FormatColumnPopup', 'Create a column style, display format or cell alignment', api);
@@ -60,6 +62,52 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
60
62
  .FormatColumn) === null || _a === void 0 ? void 0 : _a.FormatColumns) === null || _b === void 0 ? void 0 : _b.some((formatColumn) => !!formatColumn.HeaderName)) {
61
63
  (0, LoggingHelper_1.ConsoleLogWarning)(`DEPRECATED: The 'FormatColumn.HeaderName' property is deprecated; use a Layout custom Column Header instead!`);
62
64
  }
65
+ this.updateGradientColumnsOldConfig();
66
+ const keepDeprecatedConditionalStyles = this.api.internalApi.shouldKeepDeprecatedConditionalStyles();
67
+ if (!keepDeprecatedConditionalStyles) {
68
+ this.updateConditionalStylesColumnsOldConfig();
69
+ // update ConditionalStyle StatusBarPanel
70
+ const oldStatusBars = this.api.internalApi.getState().StatusBar.StatusBars;
71
+ let replaceConditionalStyleStatusBar = false;
72
+ const newStatusBars = oldStatusBars.map((statusBar) => (Object.assign(Object.assign({}, statusBar), { StatusBarPanels: [
73
+ ...new Set(statusBar.StatusBarPanels.map((statusBarPanel) => {
74
+ if (statusBarPanel === 'ConditionalStyle') {
75
+ replaceConditionalStyleStatusBar = true;
76
+ return 'FormatColumn';
77
+ }
78
+ return statusBarPanel;
79
+ })),
80
+ ] })));
81
+ if (replaceConditionalStyleStatusBar) {
82
+ this.api.statusBarApi.setStatusBarPanels(newStatusBars);
83
+ }
84
+ // update ConditionalStyle dashboard buttons
85
+ const dashboardModuleButtons = this.api.internalApi.getState().Dashboard.ModuleButtons;
86
+ if (dashboardModuleButtons.includes('ConditionalStyle')) {
87
+ dashboardModuleButtons[dashboardModuleButtons.indexOf('ConditionalStyle')] = 'FormatColumn';
88
+ this.api.dashboardApi.setModuleButtons([...new Set(dashboardModuleButtons)]);
89
+ }
90
+ // update ConditionalStyle toolPanel buttons
91
+ const toolPanelModuleButtons = this.api.internalApi.getState().ToolPanel.ModuleButtons;
92
+ if (toolPanelModuleButtons.includes('ConditionalStyle')) {
93
+ toolPanelModuleButtons[toolPanelModuleButtons.indexOf('ConditionalStyle')] = 'FormatColumn';
94
+ this.api.toolPanelApi.setModuleButtons([...new Set(dashboardModuleButtons)]);
95
+ }
96
+ }
97
+ }
98
+ updateConditionalStylesColumnsOldConfig() {
99
+ var _a;
100
+ const oldConditionalStyles = (_a = this.api.internalApi.getState().ConditionalStyle) === null || _a === void 0 ? void 0 : _a.ConditionalStyles;
101
+ if (!(oldConditionalStyles === null || oldConditionalStyles === void 0 ? void 0 : oldConditionalStyles.length)) {
102
+ return;
103
+ }
104
+ (0, LoggingHelper_1.ConsoleLogWarning)(`DEPRECATED: The 'ConditionalStyle.ConditionalStyles' property is deprecated; use 'FormatColumn' instead!`);
105
+ // remove conditional styles
106
+ this.api.conditionalStyleApi.deleteConditionalStyles(oldConditionalStyles);
107
+ // add as format column
108
+ this.api.formatColumnApi.addFormatColumns(oldConditionalStyles);
109
+ }
110
+ updateGradientColumnsOldConfig() {
63
111
  let newFormatColumns = [];
64
112
  let existingFormatColumns = [];
65
113
  // 1. Convert Gradient Columns to Format Columns
@@ -241,6 +289,7 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
241
289
  abObject: formatColumn,
242
290
  items: [
243
291
  (0, getScopeViewItems_1.getScopeViewItems)(formatColumn.Scope, this.api),
292
+ formatColumn.Rule && (0, getRuleViewItems_1.getRuleViewItems)(formatColumn.Rule, this.api),
244
293
  {
245
294
  name: 'Style',
246
295
  view: () => (0, getFormatColumnStyleViewItems_1.getFormatColumnStyleViewItems)(formatColumn, this.api),
@@ -251,7 +300,7 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
251
300
  },
252
301
  (0, getFormatColumnSettingsViewItems_1.getFormatColumnSettingsViewItems)(formatColumn),
253
302
  (0, getObjectTagsViewItems_1.getObjectTagsViewItems)(formatColumn, this.api),
254
- ],
303
+ ].filter(Boolean),
255
304
  };
256
305
  }
257
306
  toViewAll() {
@@ -261,6 +310,7 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
261
310
  }
262
311
  getViewProperties() {
263
312
  return {
313
+ actions: [MoveFormatColumn_1.MoveFormatColumn],
264
314
  getDeleteAction: FormatColumnRedux.FormatColumnDelete,
265
315
  getSuspendAction: FormatColumnRedux.FormatColumnSuspend,
266
316
  getUnSuspendAction: FormatColumnRedux.FormatColumnUnSuspend,
@@ -88,6 +88,7 @@ export interface AdaptableModuleView {
88
88
  */
89
89
  actions?: AdaptableModuleViewAction[];
90
90
  onMount?: () => void;
91
+ HeaderComponent?: React.FunctionComponent;
91
92
  onOpenEditPopup?: (abObject?: AdaptableObject) => void;
92
93
  getDeleteAction?: (abObject: AdaptableObject) => Redux.Action;
93
94
  getCompactDeleteAction?: (abObject: AdaptableObject) => Redux.Action;
@@ -64,11 +64,11 @@ exports.DefaultAdaptableOptions = {
64
64
  customPredicateDefs: [],
65
65
  displayColumnFriendlyNamesForExpressions: true,
66
66
  expressionOptions: {
67
- defaultBooleanFunctions: booleanExpressionFunctions_1.booleanExpressionFunctions,
68
- defaultScalarFunctions: scalarExpressionFunctions_1.scalarExpressionFunctions,
69
- defaultObservableFunctions: observableExpressionFunctions_1.observableExpressionFunctions,
70
- defaultAggregatedBooleanFunctions: aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctions,
71
- defaultAggregatedScalarFunctions: aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions,
67
+ defaultBooleanFunctions: booleanExpressionFunctions_1.booleanExpressionFunctionsList,
68
+ defaultScalarFunctions: scalarExpressionFunctions_1.scalarExpressionFunctionsList,
69
+ defaultObservableFunctions: observableExpressionFunctions_1.observableExpressionFunctionsList,
70
+ defaultAggregatedBooleanFunctions: aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctionsList,
71
+ defaultAggregatedScalarFunctions: aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctionsList,
72
72
  moduleExpressionFunctions: undefined,
73
73
  queryableColumns: undefined,
74
74
  performExpressionValidation: true,
@@ -152,6 +152,7 @@ exports.DefaultAdaptableOptions = {
152
152
  customSortComparers: undefined,
153
153
  englishVariant: 'GB',
154
154
  unbalancedGroupsKey: undefined,
155
+ keepDeprecatedConditionalStyles: false,
155
156
  },
156
157
  layoutOptions: {
157
158
  includeExpandedRowGroups: false,
@@ -4,7 +4,7 @@ import { AggregatedScalarExpressionEvaluation } from './aggregatedScalarExpressi
4
4
  /**
5
5
  * List of all the Aggregation Functions available in AdaptableQL
6
6
  */
7
- export declare type AggregationFunctionName = 'WHERE' | 'COL' | 'GROUP_BY' | AggregationFunction | ComparisonFunction;
7
+ export declare type AggregatedBooleanFunctionName = 'WHERE' | 'COL' | 'GROUP_BY' | AggregationFunction | ComparisonFunction;
8
8
  declare type AggregationFunction = 'SUM' | 'MIN' | 'MAX' | 'AVG';
9
9
  declare type ComparisonFunction = 'EQ' | 'NEQ' | 'LT' | 'GT' | 'LTE' | 'GTE';
10
10
  export interface BooleanAggregationParameter extends BaseParameter<'aggregationBoolean', AggregationFunction> {
@@ -15,5 +15,6 @@ export interface BooleanAggregationParameter extends BaseParameter<'aggregationB
15
15
  export interface ScalarAggregationOperand extends BaseParameter<'aggregationScalar', AggregationFunction> {
16
16
  value: AggregatedScalarExpressionEvaluation;
17
17
  }
18
- export declare const aggregatedBooleanExpressionFunctions: Record<AggregationFunctionName, ExpressionFunction>;
18
+ export declare const aggregatedBooleanExpressionFunctions: Record<AggregatedBooleanFunctionName, ExpressionFunction>;
19
+ export declare const aggregatedBooleanExpressionFunctionsList: Record<AggregatedBooleanFunctionName, ExpressionFunction>[];
19
20
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.aggregatedBooleanExpressionFunctions = void 0;
3
+ exports.aggregatedBooleanExpressionFunctionsList = exports.aggregatedBooleanExpressionFunctions = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const parseInt_1 = tslib_1.__importDefault(require("lodash/parseInt"));
6
6
  const ExpressionEvaluationError_1 = require("../../parser/src/ExpressionEvaluationError");
@@ -174,3 +174,6 @@ const extractScalarOperand = (consumingFunctionName, value, allowedTypes) => {
174
174
  // numeric value
175
175
  return (0, parseInt_1.default)(numericString) * numberUnitRatios[largeNumberUnit.toLowerCase()];
176
176
  };
177
+ exports.aggregatedBooleanExpressionFunctionsList = Object.entries(exports.aggregatedBooleanExpressionFunctions).map(([functionName, expressionImplementation]) => ({
178
+ [functionName]: expressionImplementation,
179
+ }));
@@ -42,4 +42,5 @@ export interface CumulatedAggregationValue {
42
42
  export declare const cumulativeAggregatedExpressionFunctions: AggregatedScalarFunctionName[];
43
43
  export declare const aggregatedExpressionFunctions: AggregatedScalarFunctionName[];
44
44
  export declare const aggregatedScalarExpressionFunctions: Record<AggregatedScalarFunctionName, ExpressionFunction>;
45
+ export declare const aggregatedScalarExpressionFunctionsList: Record<AggregatedScalarFunctionName, ExpressionFunction>[];
45
46
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.aggregatedScalarExpressionFunctions = exports.aggregatedExpressionFunctions = exports.cumulativeAggregatedExpressionFunctions = void 0;
3
+ exports.aggregatedScalarExpressionFunctionsList = exports.aggregatedScalarExpressionFunctions = exports.aggregatedExpressionFunctions = exports.cumulativeAggregatedExpressionFunctions = void 0;
4
4
  const expressionFunctionUtils_1 = require("./expressionFunctionUtils");
5
5
  const ExpressionEvaluationError_1 = require("../../parser/src/ExpressionEvaluationError");
6
6
  exports.cumulativeAggregatedExpressionFunctions = [
@@ -649,6 +649,9 @@ const mapAggregationToCumulation = (aggregationParameter, overColumnParameter, c
649
649
  };
650
650
  return cumulationExpressionEvaluation;
651
651
  };
652
+ exports.aggregatedScalarExpressionFunctionsList = Object.entries(exports.aggregatedScalarExpressionFunctions).map(([functionName, expressionImplementation]) => ({
653
+ [functionName]: expressionImplementation,
654
+ }));
652
655
  // !! mutates expressionEvaluation
653
656
  const addGroupByParams = (groupByColumnNames, expressionEvaluation) => {
654
657
  if (groupByColumnNames === null || groupByColumnNames === void 0 ? void 0 : groupByColumnNames.length) {
@@ -4,3 +4,4 @@ import { ExpressionFunction } from '../../parser/src/types';
4
4
  */
5
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';
6
6
  export declare const booleanExpressionFunctions: Record<BooleanFunctionName, ExpressionFunction>;
7
+ export declare const booleanExpressionFunctionsList: Record<BooleanFunctionName, ExpressionFunction>[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.booleanExpressionFunctions = void 0;
3
+ exports.booleanExpressionFunctionsList = exports.booleanExpressionFunctions = void 0;
4
4
  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"));
@@ -293,3 +293,6 @@ exports.booleanExpressionFunctions = {
293
293
  examples: ['QUERY("anyNamedQuery")'],
294
294
  },
295
295
  };
296
+ exports.booleanExpressionFunctionsList = Object.entries(exports.booleanExpressionFunctions).map(([functionName, expressionImplementation]) => ({
297
+ [functionName]: expressionImplementation,
298
+ }));
@@ -6,4 +6,5 @@ export declare type ObservableFunctionName = 'WHERE' | 'COL' | 'TIMEFRAME' | Obs
6
6
  declare type ObservableFunction = 'ROW_CHANGE' | 'GRID_CHANGE';
7
7
  declare type ChangeFunction = 'MAX' | 'MIN' | 'NONE' | 'COUNT';
8
8
  export declare const observableExpressionFunctions: Record<ObservableFunctionName, ExpressionFunction>;
9
+ export declare const observableExpressionFunctionsList: Record<ObservableFunctionName, ExpressionFunction>[];
9
10
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.observableExpressionFunctions = void 0;
3
+ exports.observableExpressionFunctionsList = exports.observableExpressionFunctions = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const rxjs_1 = require("rxjs");
6
6
  const operators_1 = require("rxjs/operators");
@@ -212,6 +212,9 @@ exports.observableExpressionFunctions = {
212
212
  examples: ["TIMEFRAME('20s')", "TIMEFRAME('5m')", "TIMEFRAME('1h')"],
213
213
  },
214
214
  };
215
+ exports.observableExpressionFunctionsList = Object.entries(exports.observableExpressionFunctions).map(([functionName, expressionImplementation]) => ({
216
+ [functionName]: expressionImplementation,
217
+ }));
215
218
  // return TRUE if the last(tail) element has the greatest value
216
219
  const isLastElementMaxValue = (values) => {
217
220
  const [tailValue] = values.slice(-1);
@@ -4,3 +4,4 @@ import { ExpressionFunction } from '../../parser/src/types';
4
4
  */
5
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' | 'COL' | 'VAR';
6
6
  export declare const scalarExpressionFunctions: Record<ScalarFunctionName, ExpressionFunction>;
7
+ export declare const scalarExpressionFunctionsList: Record<ScalarFunctionName, ExpressionFunction>[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scalarExpressionFunctions = void 0;
3
+ exports.scalarExpressionFunctionsList = exports.scalarExpressionFunctions = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ExpressionEvaluationError_1 = require("../../parser/src/ExpressionEvaluationError");
6
6
  const parseISO_1 = tslib_1.__importDefault(require("date-fns/parseISO"));
@@ -356,3 +356,6 @@ exports.scalarExpressionFunctions = {
356
356
  examples: ['VAR(CURRENT_USER)', 'VAR(IS_VALID_VALUE, IS_BLANK([col1]), [col2] < [col3])'],
357
357
  },
358
358
  };
359
+ exports.scalarExpressionFunctionsList = Object.entries(exports.scalarExpressionFunctions).map(([functionName, expressionImplementation]) => ({
360
+ [functionName]: expressionImplementation,
361
+ }));
@@ -73,4 +73,5 @@ export declare type _DeepRequiredObject<T> = {
73
73
  [P in keyof T]-?: DeepRequired<NonUndefined<T[P]>>;
74
74
  };
75
75
  export declare type NonUndefined<A> = A extends undefined ? never : A;
76
+ export declare const getTypedKeys: <T extends string>(input: Record<T, any>) => T[];
76
77
  export {};
@@ -1,2 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTypedKeys = void 0;
4
+ const getTypedKeys = (input) => {
5
+ return Object.keys(input);
6
+ };
7
+ exports.getTypedKeys = getTypedKeys;
@@ -3,9 +3,12 @@ import { IAdaptableService } from './IAdaptableService';
3
3
  import { RowNode } from '@ag-grid-community/core';
4
4
  import { CellDataChangedInfo } from '../../../PredefinedConfig/Common/CellDataChangedInfo';
5
5
  import { AdaptableModule } from '../../../PredefinedConfig/Common/Types';
6
- import { ScalarAggregationParameter } from '../../ExpressionFunctions/aggregatedScalarExpressionFunctions';
7
- import { ModuleExpressionFunctions } from '../../../AdaptableOptions/AdaptableQLOptions';
8
- import { BooleanAggregationParameter } from '../../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
6
+ import { AggregatedScalarFunctionName, ScalarAggregationParameter } from '../../ExpressionFunctions/aggregatedScalarExpressionFunctions';
7
+ import { AggregatedBooleanFunctionName, BooleanAggregationParameter } from '../../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
8
+ import { BooleanFunctionName } from '../../ExpressionFunctions/booleanExpressionFunctions';
9
+ import { ScalarFunctionName } from '../../ExpressionFunctions/scalarExpressionFunctions';
10
+ import { ObservableFunctionName } from '../../ExpressionFunctions/observableExpressionFunctions';
11
+ import { ExpressionFunctionMap } from '../../../parser/src/types';
9
12
  export interface IQueryLanguageService extends IAdaptableService {
10
13
  evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: RowNode): boolean;
11
14
  evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: RowNode): any;
@@ -31,10 +34,17 @@ export interface IQueryLanguageService extends IAdaptableService {
31
34
  errorMessage: string;
32
35
  };
33
36
  computeAggregatedBooleanValue(expression: string, module: AdaptableModule): boolean;
34
- getModuleExpressionFunctions(module: AdaptableModule): ModuleExpressionFunctions;
37
+ getModuleExpressionFunctionsMap(module: AdaptableModule): ModuleExpressionFunctionsMap;
35
38
  getColumnsFromExpression(input: string): string[];
36
39
  getNamedQueryNamesFromExpression(input: string): string[];
37
40
  isCumulativeAggregate(input: string): boolean;
38
41
  evaluateCustomQueryVariable(functionName: string, args?: any[]): any;
39
42
  getExpressionWithColumnFriendlyNames(expression: string): string;
40
43
  }
44
+ export interface ModuleExpressionFunctionsMap {
45
+ booleanFunctions?: ExpressionFunctionMap<BooleanFunctionName>;
46
+ scalarFunctions?: ExpressionFunctionMap<ScalarFunctionName>;
47
+ observableFunctions?: ExpressionFunctionMap<ObservableFunctionName>;
48
+ aggregatedBooleanFunctions?: ExpressionFunctionMap<AggregatedBooleanFunctionName>;
49
+ aggregatedScalarFunctions?: ExpressionFunctionMap<AggregatedScalarFunctionName>;
50
+ }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseService=exports.LicenseValidityType=void 0;const e=require("tslib"),a=require("../../Redux/ActionsReducers/SystemRedux"),t=require("../../Redux/ActionsReducers/PopupRedux"),s=e.__importDefault(require("../ObjectFactory")),o=require("../Helpers/LoggingHelper"),i=e.__importDefault(require("lodash/clamp")),n=require("../Constants/DocumentationLinkConstants"),r=require("../license/decode"),c="sales@adaptabletools.com",l=10,d=864e5;var p;!function(e){e.INVALID_LICENSE="INVALID_LICENSE",e.NO_LICENSE="NO_LICENSE",e.NON_PRODUCTION_VALID="NON_PRODUCTION_VALID",e.NON_PRODUCTION_EXPIRED_IN_SCOPE="NON_PRODUCTION_EXPIRED_IN_SCOPE",e.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE="NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE",e.COMMERCIAL_VALID="COMMERCIAL_VALID",e.COMMERCIAL_EXPIRED_IN_SCOPE="COMMERCIAL_EXPIRED_IN_SCOPE",e.COMMERCIAL_EXPIRED_OUT_OF_SCOPE="COMMERCIAL_EXPIRED_OUT_OF_SCOPE"}(p=exports.LicenseValidityType||(exports.LicenseValidityType={}));const E=/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g,I=/(https):\/\/\S+(\.csb\.app)/g,_=/(https):\/\/\S+(\.adaptabletools\.com)/g,O="undefined"!=typeof window?window.location.origin:"",h=()=>{const[e,a,t]=Array.from(E.exec(O)||[]);return"https"===a&&"sandpack.codesandbox.io"===t},u=()=>{const[e,a,t]=Array.from(I.exec(O)||[]);return"https"===a&&".csb.app"===t},L=()=>{const[e,a,t]=Array.from(_.exec(O)||[]);return"https"===a&&".adaptabletools.com"===t};class A{constructor(e,a,t){this.adaptable=e,this.adaptable=e;let s=null;if(a)try{s=(0,r.decode)(a)}catch(e){s=e}h()||u()||L()||this.handleLicenseValidation(s,this.getValidityType(s,t))}getValidityType(e,a){if(!e)return p.NO_LICENSE;if(e instanceof Error)return p.INVALID_LICENSE;const t=new Date(a.publishedAt),s=new Date(e.end),o=s<new Date,i=e.trial;let n=null;return n=o?s>t?i?p.NON_PRODUCTION_EXPIRED_IN_SCOPE:p.COMMERCIAL_EXPIRED_IN_SCOPE:i?p.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:p.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:i?p.NON_PRODUCTION_VALID:p.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){var t;const s=new Date;s.setHours(0,0,0,0);let r=0;e instanceof Error||!(null==e?void 0:e.end)||(r=Math.floor(((null===(t=null==e?void 0:e.end)||void 0===t?void 0:t.getTime())-s.getTime())/864e5),r=(0,i.default)(r,0,1/0));const l=(e,a=n.LicenseDocsLink,t=c,s=r)=>e.replace("[LINK]",a).replace("[EMAIL]",t).replace("[DAYS]",`${s}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":(0,o.ConsoleLogByMessageType)(l("This instance of AdapTable does not have a license, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("No AdapTable License found."),this.showWatermark("This instance of AdapTable does not have a license, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"INVALID_LICENSE":(0,o.ConsoleLogByMessageType)(l("This instance of AdapTable seems to use a corrupted License, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("Corrupted AdapTable License found."),this.showWatermark("This instance of AdapTable has a corrupted License, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"NON_PRODUCTION_VALID":(0,o.ConsoleLogByMessageType)(l("This AdapTable trial license expires in [DAYS] days. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Info");break;case"NON_PRODUCTION_EXPIRED_IN_SCOPE":(0,o.ConsoleLogByMessageType)(l("This AdapTable trial license has now expired. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Warning"),this.showWatermark("AdapTable License has expired");break;case"COMMERCIAL_VALID":r<=10&&(0,o.ConsoleLogByMessageType)(l("This AdapTable license expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)"),"Info");break;case"COMMERCIAL_EXPIRED_IN_SCOPE":(0,o.ConsoleLogByMessageType)(l("This AdapTable license has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)"),"Warning");break;case"COMMERCIAL_EXPIRED_OUT_OF_SCOPE":(0,o.ConsoleLogByMessageType)(l("This AdapTable license has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license."),"Error"),this.showNotification("Adaptable License has expired"),this.showWatermark("Adaptable License has expired")}}showNotification(e){this.adaptable.api.internalApi.dispatchReduxAction((0,t.PopupShowAlert)({alertType:"generic",header:"License Error",message:e,alertDefinition:s.default.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseShowWatermark)(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseDisablePersistence)())}destroy(){}}exports.LicenseService=A;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseService=exports.LicenseValidityType=void 0;const e=require("tslib"),a=require("../../Redux/ActionsReducers/SystemRedux"),t=require("../../Redux/ActionsReducers/PopupRedux"),s=e.__importDefault(require("../ObjectFactory")),o=require("../Helpers/LoggingHelper"),i=e.__importDefault(require("lodash/clamp")),n=require("../Constants/DocumentationLinkConstants"),r=require("../license/decode"),c="sales@adaptabletools.com",l=10,d=864e5;var p;!function(e){e.INVALID_LICENSE="INVALID_LICENSE",e.NO_LICENSE="NO_LICENSE",e.NON_PRODUCTION_VALID="NON_PRODUCTION_VALID",e.NON_PRODUCTION_EXPIRED_IN_SCOPE="NON_PRODUCTION_EXPIRED_IN_SCOPE",e.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE="NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE",e.COMMERCIAL_VALID="COMMERCIAL_VALID",e.COMMERCIAL_EXPIRED_IN_SCOPE="COMMERCIAL_EXPIRED_IN_SCOPE",e.COMMERCIAL_EXPIRED_OUT_OF_SCOPE="COMMERCIAL_EXPIRED_OUT_OF_SCOPE"}(p=exports.LicenseValidityType||(exports.LicenseValidityType={}));const E=/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g,_=/(https):\/\/\S+(\.csb\.app)/g,I=/(https):\/\/\S+(\.adaptabletools\.com)/g,O="undefined"!=typeof window?window.location.origin:"",N=()=>{const[e,a,t]=Array.from(E.exec(O)||[]);return"https"===a&&"sandpack.codesandbox.io"===t},h=()=>{const[e,a,t]=Array.from(_.exec(O)||[]);return"https"===a&&".csb.app"===t},u=()=>{const[e,a,t]=Array.from(I.exec(O)||[]);return"https"===a&&".adaptabletools.com"===t};class A{constructor(e,a,t){this.adaptable=e,this.adaptable=e;let s=null;if(a)try{s=(0,r.decode)(a)}catch(e){s=e}N()||h()||u()||this.handleLicenseValidation(s,this.getValidityType(s,t))}getValidityType(e,a){if(!e)return p.NO_LICENSE;if(e instanceof Error)return p.INVALID_LICENSE;const t=new Date(a.publishedAt),s=new Date(e.end),o=s<new Date,i=e.trial;let n=null;return n=o?s>t?i?p.NON_PRODUCTION_EXPIRED_IN_SCOPE:p.COMMERCIAL_EXPIRED_IN_SCOPE:i?p.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:p.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:i?p.NON_PRODUCTION_VALID:p.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){var t;const s=new Date;s.setHours(0,0,0,0);let l=0;e instanceof Error||!(null==e?void 0:e.end)||(l=Math.floor(((null===(t=null==e?void 0:e.end)||void 0===t?void 0:t.getTime())-s.getTime())/864e5),l=(0,i.default)(l,0,1/0));let d="",p="";!e||e instanceof Error||!e.appName||e.appName==r.GENERIC_APP_NAME||(d=e.appName,p=" for application [APP_NAME]");const E=(e,a=n.LicenseDocsLink,t=c,s=l,o=d)=>e.replace("[LINK]",a).replace("[EMAIL]",t).replace("[APP_NAME]",o).replace("[DAYS]",`${s}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":(0,o.ConsoleLogByMessageType)(E("This instance of AdapTable does not have a license, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("No AdapTable License found."),this.showWatermark("This instance of AdapTable does not have a license, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"INVALID_LICENSE":(0,o.ConsoleLogByMessageType)(E("This instance of AdapTable seems to use a corrupted License, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("Corrupted AdapTable License found."),this.showWatermark("This instance of AdapTable has a corrupted License, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"NON_PRODUCTION_VALID":(0,o.ConsoleLogByMessageType)(E("This AdapTable trial license expires in [DAYS] days. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Info");break;case"NON_PRODUCTION_EXPIRED_IN_SCOPE":(0,o.ConsoleLogByMessageType)(E("This AdapTable trial license has now expired. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Warning"),this.showWatermark("AdapTable License has expired");break;case"COMMERCIAL_VALID":if(l<=10)(0,o.ConsoleLogByMessageType)(E(`This AdapTable license${p} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`),"Info");else try{"development"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV||(0,o.ConsoleLogByMessageType)(E(`Thank you for using a valid AdapTable license${p}. Your license will expire in [DAYS] days.`),"Info")}catch(e){}break;case"COMMERCIAL_EXPIRED_IN_SCOPE":(0,o.ConsoleLogByMessageType)(E(`This AdapTable license${p} has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)`),"Warning");break;case"COMMERCIAL_EXPIRED_OUT_OF_SCOPE":(0,o.ConsoleLogByMessageType)(E(`This AdapTable license${p} has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license.`),"Error"),this.showNotification("Adaptable License has expired"),this.showWatermark("Adaptable License has expired")}}showNotification(e){this.adaptable.api.internalApi.dispatchReduxAction((0,t.PopupShowAlert)({alertType:"generic",header:"License Error",message:e,alertDefinition:s.default.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseShowWatermark)(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseDisablePersistence)())}destroy(){}}exports.LicenseService=A;
@@ -1,9 +1,8 @@
1
- import { IQueryLanguageService } from './Interface/IQueryLanguageService';
1
+ import { IQueryLanguageService, ModuleExpressionFunctionsMap } from './Interface/IQueryLanguageService';
2
2
  import { Observable } from 'rxjs';
3
3
  import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
4
4
  import { RowNode } from '@ag-grid-community/core';
5
5
  import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
6
- import { ModuleExpressionFunctions } from '../../AdaptableOptions/AdaptableQLOptions';
7
6
  import { ScalarAggregationParameter } from '../ExpressionFunctions/aggregatedScalarExpressionFunctions';
8
7
  import { AdaptableApi } from '../../../types';
9
8
  import { BooleanAggregationParameter } from '../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
@@ -43,7 +42,10 @@ export declare class QueryLanguageService implements IQueryLanguageService {
43
42
  getNamedQueryNamesFromExpression(input?: string): string[];
44
43
  isCumulativeAggregate(input: string): boolean;
45
44
  getExpressionWithColumnFriendlyNames(expression?: string): string;
46
- getModuleExpressionFunctions(module: AdaptableModule): ModuleExpressionFunctions;
45
+ getModuleExpressionFunctionsMap(module: AdaptableModule): ModuleExpressionFunctionsMap;
46
+ private getFunctionNames;
47
+ private extractDefaultExpressionFunctions;
48
+ private mapFunctionsDefinitionToMap;
47
49
  evaluateCustomQueryVariable(functionName: string, args?: any[]): any;
48
50
  private getBooleanAndScalarFunctions;
49
51
  private getExpressionCacheKey;
@@ -5,7 +5,13 @@ const tslib_1 = require("tslib");
5
5
  const parser = tslib_1.__importStar(require("../../parser/src"));
6
6
  const rxjs_1 = require("rxjs");
7
7
  const LoggingHelper_1 = require("../Helpers/LoggingHelper");
8
+ const aggregatedScalarExpressionFunctions_1 = require("../ExpressionFunctions/aggregatedScalarExpressionFunctions");
9
+ const aggregatedBooleanExpressionFunctions_1 = require("../ExpressionFunctions/aggregatedBooleanExpressionFunctions");
8
10
  const AggregatedScalarLiveValue_1 = require("./AggregatedScalarLiveValue");
11
+ const booleanExpressionFunctions_1 = require("../ExpressionFunctions/booleanExpressionFunctions");
12
+ const scalarExpressionFunctions_1 = require("../ExpressionFunctions/scalarExpressionFunctions");
13
+ const observableExpressionFunctions_1 = require("../ExpressionFunctions/observableExpressionFunctions");
14
+ const TypeExtensions_1 = require("../Extensions/TypeExtensions");
9
15
  class QueryLanguageService {
10
16
  constructor(adaptableApi) {
11
17
  this.adaptableApi = adaptableApi;
@@ -16,7 +22,7 @@ class QueryLanguageService {
16
22
  this.cacheModuleSpecificExpressionFunctions = new Map();
17
23
  }
18
24
  evaluateBooleanExpression(expression, module, rowNode) {
19
- const moduleExpressionFunctions = this.getModuleExpressionFunctions(module);
25
+ const moduleExpressionFunctions = this.getModuleExpressionFunctionsMap(module);
20
26
  const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
21
27
  return parser.evaluate(expression, {
22
28
  node: rowNode,
@@ -30,7 +36,7 @@ class QueryLanguageService {
30
36
  return this.evaluateBooleanExpression(expression, module, rowNode);
31
37
  }
32
38
  evaluateAggregatedScalarExpression(expression, module) {
33
- const aggregatedScalarFunctions = this.getModuleExpressionFunctions(module).aggregatedScalarFunctions;
39
+ const aggregatedScalarFunctions = this.getModuleExpressionFunctionsMap(module).aggregatedScalarFunctions;
34
40
  return parser.evaluate(expression, {
35
41
  node: null,
36
42
  adaptableApi: this.adaptableApi,
@@ -39,7 +45,7 @@ class QueryLanguageService {
39
45
  });
40
46
  }
41
47
  evaluateObservableExpression(reactiveExpression, module) {
42
- const moduleExpressionFunctions = this.getModuleExpressionFunctions(module);
48
+ const moduleExpressionFunctions = this.getModuleExpressionFunctionsMap(module);
43
49
  const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
44
50
  const reactiveExpression$ = parser.evaluate(reactiveExpression, {
45
51
  node: reactiveExpression,
@@ -51,12 +57,12 @@ class QueryLanguageService {
51
57
  return reactiveExpression$;
52
58
  }
53
59
  evaluateAggregatedBooleanExpression(aggregationExpression, module) {
54
- const moduleExpressionFunctions = this.getModuleExpressionFunctions(module);
55
- const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
60
+ const moduleExpressionFunctionsMap = this.getModuleExpressionFunctionsMap(module);
61
+ const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctionsMap);
56
62
  const aggregationEvaluation = parser.evaluate(aggregationExpression, {
57
63
  node: aggregationExpression,
58
64
  adaptableApi: this.adaptableApi,
59
- functions: moduleExpressionFunctions.aggregatedBooleanFunctions,
65
+ functions: moduleExpressionFunctionsMap.aggregatedBooleanFunctions,
60
66
  whereClauseFunctions: booleanAndScalarFunctions,
61
67
  evaluateCustomQueryVariable: this.evaluateCustomQueryVariable,
62
68
  });
@@ -89,7 +95,7 @@ class QueryLanguageService {
89
95
  }
90
96
  const { ast } = parser.parse(expression.trim());
91
97
  const rootFn = ast[ast.length - 1];
92
- const moduleExpressionFunctions = this.getModuleExpressionFunctions(module);
98
+ const moduleExpressionFunctions = this.getModuleExpressionFunctionsMap(module);
93
99
  const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
94
100
  if (rootFn.type === undefined || booleanAndScalarFunctions[rootFn.type] === undefined) {
95
101
  const result = {
@@ -268,43 +274,90 @@ class QueryLanguageService {
268
274
  }
269
275
  // Returns the ExpressionFunctions available for the given Module as specified in the `QueryLanguageOptions.moduleExpressionFunctions`
270
276
  // if there are no specific functions defined, it falls back to the default values
271
- getModuleExpressionFunctions(module) {
272
- var _a, _b, _c, _d, _e, _f, _g;
277
+ getModuleExpressionFunctionsMap(module) {
278
+ var _a, _b, _c, _d, _e, _f, _g, _h;
279
+ const expressionOptions = this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions;
280
+ if (module) {
281
+ let cachedResult = this.cacheModuleSpecificExpressionFunctions.get(module);
282
+ if (cachedResult) {
283
+ return cachedResult;
284
+ }
285
+ }
286
+ const defaultBooleanExpressionFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultBooleanFunctions, booleanExpressionFunctions_1.booleanExpressionFunctions);
287
+ const defaultScalarExpressionFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultScalarFunctions, scalarExpressionFunctions_1.scalarExpressionFunctions);
288
+ const defaultObservableExpressionFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultObservableFunctions, observableExpressionFunctions_1.observableExpressionFunctions);
289
+ const defaultAggregatedBooleanFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultAggregatedBooleanFunctions, aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctions);
290
+ const defaultAggregatedScalarFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultAggregatedScalarFunctions, aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions);
273
291
  if (!module) {
274
292
  (0, LoggingHelper_1.LogAdaptableInfo)(`QueryLanguageService.getModuleExpressionFunctions() was called with an undefined 'module' param, this should never happen`);
275
293
  return {
276
- booleanFunctions: this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
277
- .defaultBooleanFunctions,
278
- scalarFunctions: this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
279
- .defaultScalarFunctions,
280
- observableFunctions: this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
281
- .defaultObservableFunctions,
282
- aggregatedBooleanFunctions: this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
283
- .defaultAggregatedBooleanFunctions,
284
- aggregatedScalarFunctions: this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
285
- .defaultAggregatedScalarFunctions,
294
+ booleanFunctions: this.mapFunctionsDefinitionToMap(defaultBooleanExpressionFunctions, booleanExpressionFunctions_1.booleanExpressionFunctions),
295
+ scalarFunctions: this.mapFunctionsDefinitionToMap(defaultScalarExpressionFunctions, scalarExpressionFunctions_1.scalarExpressionFunctions),
296
+ observableFunctions: this.mapFunctionsDefinitionToMap(defaultObservableExpressionFunctions, observableExpressionFunctions_1.observableExpressionFunctions),
297
+ aggregatedBooleanFunctions: this.mapFunctionsDefinitionToMap(defaultAggregatedBooleanFunctions, aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctions),
298
+ aggregatedScalarFunctions: this.mapFunctionsDefinitionToMap(defaultAggregatedScalarFunctions, aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions),
299
+ };
300
+ }
301
+ let moduleExpressionFunctions;
302
+ if (typeof expressionOptions.moduleExpressionFunctions === 'function') {
303
+ const context = {
304
+ adaptableApi: this.adaptableApi,
305
+ module,
306
+ defaultBooleanFunctionNames: this.getFunctionNames(defaultBooleanExpressionFunctions),
307
+ defaultScalarFunctionNames: this.getFunctionNames(defaultScalarExpressionFunctions),
308
+ defaultObservableFunctionNames: this.getFunctionNames(defaultObservableExpressionFunctions),
309
+ defaultAggregatedBooleanFunctionNames: this.getFunctionNames(defaultAggregatedBooleanFunctions),
310
+ defaultAggregatedScalarFunctionNames: this.getFunctionNames(defaultAggregatedScalarFunctions),
286
311
  };
312
+ moduleExpressionFunctions = (_a = expressionOptions.moduleExpressionFunctions(context)) !== null && _a !== void 0 ? _a : {};
287
313
  }
288
- let cachedResult = this.cacheModuleSpecificExpressionFunctions.get(module);
289
- if (cachedResult) {
290
- return cachedResult;
314
+ else {
315
+ moduleExpressionFunctions = (_c = (_b = expressionOptions.moduleExpressionFunctions) === null || _b === void 0 ? void 0 : _b[module]) !== null && _c !== void 0 ? _c : {};
291
316
  }
292
- const moduleSpecificOptions = (_b = (_a = this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
293
- .moduleExpressionFunctions) === null || _a === void 0 ? void 0 : _a[module]) !== null && _b !== void 0 ? _b : {};
294
- const moduleSpecificFunctions = {
295
- booleanFunctions: (_c = moduleSpecificOptions.booleanFunctions) !== null && _c !== void 0 ? _c : this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
296
- .defaultBooleanFunctions,
297
- scalarFunctions: (_d = moduleSpecificOptions.scalarFunctions) !== null && _d !== void 0 ? _d : this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
298
- .defaultScalarFunctions,
299
- observableFunctions: (_e = moduleSpecificOptions.observableFunctions) !== null && _e !== void 0 ? _e : this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
300
- .defaultObservableFunctions,
301
- aggregatedBooleanFunctions: (_f = moduleSpecificOptions.aggregatedBooleanFunctions) !== null && _f !== void 0 ? _f : this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
302
- .defaultAggregatedBooleanFunctions,
303
- aggregatedScalarFunctions: (_g = moduleSpecificOptions.aggregatedScalarFunctions) !== null && _g !== void 0 ? _g : this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
304
- .defaultAggregatedScalarFunctions,
317
+ const moduleExpressionFunctionsMap = {
318
+ booleanFunctions: this.mapFunctionsDefinitionToMap((_d = moduleExpressionFunctions.booleanFunctions) !== null && _d !== void 0 ? _d : defaultBooleanExpressionFunctions, booleanExpressionFunctions_1.booleanExpressionFunctions),
319
+ scalarFunctions: this.mapFunctionsDefinitionToMap((_e = moduleExpressionFunctions.scalarFunctions) !== null && _e !== void 0 ? _e : defaultScalarExpressionFunctions, scalarExpressionFunctions_1.scalarExpressionFunctions),
320
+ observableFunctions: this.mapFunctionsDefinitionToMap((_f = moduleExpressionFunctions.observableFunctions) !== null && _f !== void 0 ? _f : defaultObservableExpressionFunctions, observableExpressionFunctions_1.observableExpressionFunctions),
321
+ aggregatedBooleanFunctions: this.mapFunctionsDefinitionToMap((_g = moduleExpressionFunctions.aggregatedBooleanFunctions) !== null && _g !== void 0 ? _g : defaultAggregatedBooleanFunctions, aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctions),
322
+ aggregatedScalarFunctions: this.mapFunctionsDefinitionToMap((_h = moduleExpressionFunctions.aggregatedScalarFunctions) !== null && _h !== void 0 ? _h : defaultAggregatedScalarFunctions, aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions),
305
323
  };
306
- this.cacheModuleSpecificExpressionFunctions.set(module, moduleSpecificFunctions);
307
- return moduleSpecificFunctions;
324
+ this.cacheModuleSpecificExpressionFunctions.set(module, moduleExpressionFunctionsMap);
325
+ return moduleExpressionFunctionsMap;
326
+ }
327
+ getFunctionNames(definitions) {
328
+ return definitions.flatMap((definition) => {
329
+ if (typeof definition === 'string') {
330
+ return definition;
331
+ }
332
+ else {
333
+ return (0, TypeExtensions_1.getTypedKeys)(definition);
334
+ }
335
+ });
336
+ }
337
+ extractDefaultExpressionFunctions(defaultOptions, availableExpressionFunctions) {
338
+ if (typeof defaultOptions === 'function') {
339
+ const context = {
340
+ adaptableApi: this.adaptableApi,
341
+ availableExpressionFunctionNames: (0, TypeExtensions_1.getTypedKeys)(availableExpressionFunctions),
342
+ };
343
+ return defaultOptions(context);
344
+ }
345
+ return defaultOptions;
346
+ }
347
+ mapFunctionsDefinitionToMap(functionsDefinition, internalExpressionFunctions) {
348
+ let resultMap = {};
349
+ functionsDefinition.forEach((definition) => {
350
+ if (typeof definition === 'string') {
351
+ const internalFunction = internalExpressionFunctions[definition];
352
+ if (internalFunction) {
353
+ resultMap[definition] = internalFunction;
354
+ }
355
+ }
356
+ else {
357
+ resultMap = Object.assign(Object.assign({}, resultMap), definition);
358
+ }
359
+ });
360
+ return resultMap;
308
361
  }
309
362
  evaluateCustomQueryVariable(functionName, args) {
310
363
  var _a, _b, _c;
@@ -317,8 +370,8 @@ class QueryLanguageService {
317
370
  ? customQueryVariableDefinition(context)
318
371
  : customQueryVariableDefinition;
319
372
  }
320
- getBooleanAndScalarFunctions(moduleExpressionFunctions) {
321
- return Object.assign(Object.assign({}, moduleExpressionFunctions.booleanFunctions), moduleExpressionFunctions.scalarFunctions);
373
+ getBooleanAndScalarFunctions(moduleExpressionFunctionsMap) {
374
+ return Object.assign(Object.assign({}, moduleExpressionFunctionsMap.booleanFunctions), moduleExpressionFunctionsMap.scalarFunctions);
322
375
  }
323
376
  getExpressionCacheKey(expression, module) {
324
377
  return `${module}::${expression}`;
@@ -2,9 +2,9 @@ export declare type LicenseDetails = {
2
2
  start: Date;
3
3
  end: Date;
4
4
  owner: string;
5
+ appName: string;
5
6
  trial: boolean;
6
7
  skipAirtable?: boolean;
7
- count?: number;
8
8
  timestamp?: number;
9
9
  ref: string;
10
10
  };
@@ -1,4 +1,5 @@
1
1
  import { LicenseDetails } from './LicenseDetails';
2
+ export declare const GENERIC_APP_NAME = "GenericAdaptableApp";
2
3
  export declare const fieldsToLicenseDetails: (fields: {
3
4
  name: string;
4
5
  value: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decode=exports.fieldsToLicenseDetails=void 0;const e=require("./hashing"),t=()=>new Error("Invalid License"),r=e=>{var r;const o=e.reduce(((e,t)=>(e.set(t.name,t.value),e)),new Map),s={count:o.get("DeveloperCount")?Number(o.get("DeveloperCount")):0,start:new Date(o.get("StartDate")),end:new Date(o.get("EndDate")),owner:o.get("Owner"),timestamp:o.get("TS")?Number(o.get("TS")):0,trial:"true"===o.get("Trial"),ref:null!==(r=o.get("Ref"))&&void 0!==r?r:""};if(!(s.start&&s.end&&s.owner&&"boolean"==typeof s.trial&&s.ref))throw t();return s};exports.fieldsToLicenseDetails=r;const o=r=>{let o="",s=r.split("|").map((e=>{let[t,r]=e.split("=");return"C"===t&&(o=r),{name:t,value:r}}));if(!o)throw t();const n=o.split(",").reverse(),a=n.pop();n.forEach(((r,o)=>{const n=s[o];if((0,e.compute_string)(n.value)!==r)throw t()}));const i=[...s];i.pop();const l=i.map((e=>`${e.name}=${e.value}`)).join("|");if((0,e.compute_string)(l)!==a)throw t();return s=s.map((e=>Object.assign(Object.assign({},e),{value:decodeURI(e.value)}))),(0,exports.fieldsToLicenseDetails)(s)};exports.decode=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decode=exports.fieldsToLicenseDetails=exports.GENERIC_APP_NAME=void 0;const e=require("./hashing"),t=()=>new Error("Invalid License");exports.GENERIC_APP_NAME="GenericAdaptableApp";const r=e=>{var r;const s=e.reduce(((e,t)=>(e.set(t.name,t.value),e)),new Map),o={start:new Date(s.get("StartDate")),end:new Date(s.get("EndDate")),owner:s.get("Owner"),appName:s.get("AppName")||exports.GENERIC_APP_NAME,timestamp:s.get("TS")?Number(s.get("TS")):0,trial:"true"===s.get("Trial"),ref:null!==(r=s.get("Ref"))&&void 0!==r?r:""};if(!(o.start&&o.end&&o.owner&&"boolean"==typeof o.trial&&o.ref))throw t();return o};exports.fieldsToLicenseDetails=r;const s=r=>{let s="",o=r.split("|").map((e=>{let[t,r]=e.split("=");return"C"===t&&(s=r),{name:t,value:r}}));if(!s)throw t();const a=s.split(",").reverse(),n=a.pop();a.forEach(((r,s)=>{const a=o[s];if((0,e.compute_string)(a.value)!==r)throw t()}));const i=[...o];i.pop();const p=i.map((e=>`${e.name}=${e.value}`)).join("|");if((0,e.compute_string)(p)!==n)throw t();return o=o.map((e=>Object.assign(Object.assign({},e),{value:decodeURI(e.value)}))),(0,exports.fieldsToLicenseDetails)(o)};exports.decode=s;
@@ -111,6 +111,7 @@ const AdaptablePopupModuleView = (props) => {
111
111
  "s not available in current Layout")));
112
112
  };
113
113
  return (React.createElement(PopupPanel_1.PopupPanel, { glyphicon: moduleInfo.Glyph, infoLink: moduleInfo.HelpPage, headerText: moduleInfo.FriendlyName, button: newButton, infoLinkDisabled: !props.api.internalApi.isDocumentationLinksDisplayed() },
114
+ moduleViewProperties.HeaderComponent && React.createElement(moduleViewProperties.HeaderComponent, null),
114
115
  toggleButtonShowLayoutAssociatedObjects(),
115
116
  (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}`)),
116
117
  isWizardOpen && EditWizard && (React.createElement(EditWizard, { abObjectType: abObjectType, moduleInfo: moduleInfo, data: null, popupParams: props.popupParams, configEntities: null, onCloseWizard: handleWizardClose, onFinishWizard: handleWizardClose }))));
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const ConditionalStylePopupHeader: React.FunctionComponent;