@adaptabletools/adaptable-cjs 18.0.17 → 18.1.0-canary.1

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 (135) hide show
  1. package/agGrid.d.ts +4 -3
  2. package/agGrid.js +6 -1
  3. package/base.css +7 -2
  4. package/base.css.map +1 -1
  5. package/index.css +11 -2
  6. package/index.css.map +1 -1
  7. package/package.json +2 -2
  8. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -4
  9. package/src/AdaptableOptions/ActionColumnOptions.d.ts +1 -1
  10. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +52 -11
  11. package/src/AdaptableOptions/ExportOptions.d.ts +20 -7
  12. package/src/AdaptableOptions/ExpressionOptions.d.ts +12 -2
  13. package/src/AdaptableOptions/Fdc3Options.d.ts +48 -43
  14. package/src/Api/ColumnApi.d.ts +5 -0
  15. package/src/Api/Events/Fdc3MessageInfo.d.ts +5 -7
  16. package/src/Api/ExpressionApi.d.ts +2 -2
  17. package/src/Api/Fdc3Api.d.ts +14 -19
  18. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  19. package/src/Api/Implementation/ColumnApiImpl.js +3 -0
  20. package/src/Api/Implementation/ConfigApiImpl.js +3 -0
  21. package/src/Api/Implementation/Fdc3ApiImpl.d.ts +14 -16
  22. package/src/Api/Implementation/Fdc3ApiImpl.js +35 -11
  23. package/src/Api/Internal/AlertInternalApi.d.ts +17 -2
  24. package/src/Api/Internal/AlertInternalApi.js +196 -25
  25. package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -0
  26. package/src/Api/Internal/ColumnFilterInternalApi.js +20 -0
  27. package/src/Api/Internal/ExportInternalApi.d.ts +3 -3
  28. package/src/Api/Internal/ExportInternalApi.js +31 -17
  29. package/src/Api/Internal/ExpressionInternalApi.d.ts +5 -1
  30. package/src/Api/Internal/ExpressionInternalApi.js +80 -0
  31. package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
  32. package/src/Api/Internal/Fdc3InternalApi.js +5 -9
  33. package/src/Api/Internal/GridInternalApi.d.ts +29 -13
  34. package/src/Api/Internal/GridInternalApi.js +129 -39
  35. package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
  36. package/src/PredefinedConfig/Common/AdaptableField.js +2 -0
  37. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  38. package/src/PredefinedConfig/Common/AdaptablePredicate.js +22 -1
  39. package/src/PredefinedConfig/Common/Fdc3Context.d.ts +7 -226
  40. package/src/PredefinedConfig/Common/Fdc3Context.js +44 -32
  41. package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
  42. package/src/PredefinedConfig/Common/Fdc3Intent.js +27 -74
  43. package/src/PredefinedConfig/Common/RowSummary.d.ts +2 -1
  44. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  45. package/src/Redux/ActionsReducers/FormatColumnRedux.js +0 -3
  46. package/src/Strategy/AdaptableModuleBase.js +1 -3
  47. package/src/Strategy/AlertModule.d.ts +1 -1
  48. package/src/Strategy/AlertModule.js +8 -8
  49. package/src/Utilities/Constants/DocumentationLinkConstants.js +4 -4
  50. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
  51. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +14 -13
  52. package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
  53. package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
  54. package/src/Utilities/Services/QueryLanguageService.js +105 -6
  55. package/src/Utilities/Services/ReportService.js +8 -5
  56. package/src/Utilities/Services/RowSummaryService.js +3 -1
  57. package/src/Utilities/divideBy100.d.ts +1 -0
  58. package/src/Utilities/divideBy100.js +34 -0
  59. package/src/Utilities/times100.d.ts +1 -0
  60. package/src/Utilities/times100.js +27 -0
  61. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
  62. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
  63. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
  64. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
  65. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +5 -5
  66. package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
  67. package/src/View/Components/EntityRulesEditor/index.js +11 -7
  68. package/src/View/Components/ExpressionWizard.js +1 -1
  69. package/src/View/Components/FilterForm/FilterForm.js +2 -2
  70. package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
  71. package/src/View/Components/FilterForm/QuickFilterValues.d.ts +1 -1
  72. package/src/View/Components/FilterForm/QuickFilterValues.js +5 -5
  73. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
  74. package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
  75. package/src/View/Components/Selectors/FieldSelector.js +26 -0
  76. package/src/View/Components/Selectors/PermittedValuesSelector.js +9 -5
  77. package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
  78. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
  79. package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
  80. package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
  81. package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
  82. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
  83. package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
  84. package/src/agGrid/AdaptableAgGrid.d.ts +4 -6
  85. package/src/agGrid/AdaptableAgGrid.js +66 -47
  86. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
  87. package/src/agGrid/AgGridColumnAdapter.js +24 -1
  88. package/src/agGrid/AgGridMenuAdapter.js +1 -1
  89. package/src/agGrid/FilterWrapper.js +12 -7
  90. package/src/agGrid/defaultAdaptableOptions.js +2 -2
  91. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
  92. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
  93. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
  94. package/src/agGrid/editors/AdaptableDateEditor/index.js +6 -19
  95. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
  96. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
  97. package/src/agGrid/editors/AdaptableNumberEditor/index.js +6 -2
  98. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
  99. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +84 -0
  100. package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
  101. package/src/agGrid/editors/AdaptablePercentageEditor/index.js +153 -0
  102. package/src/components/Accordion.js +1 -1
  103. package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
  104. package/src/components/Datepicker/index.js +3 -4
  105. package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
  106. package/src/components/ExpressionEditor/DataTableEditor.js +68 -0
  107. package/src/components/ExpressionEditor/EditorInput.js +21 -8
  108. package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
  109. package/src/components/ExpressionEditor/NamedQueryEditor.js +35 -0
  110. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
  111. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
  112. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
  113. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +72 -14
  114. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +27 -19
  115. package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
  116. package/src/components/ExpressionEditor/QueryBuilder/utils.js +46 -4
  117. package/src/components/ExpressionEditor/index.d.ts +3 -1
  118. package/src/components/ExpressionEditor/index.js +68 -95
  119. package/src/components/Input/NumberInput.d.ts +2 -1
  120. package/src/components/Input/NumberInput.js +6 -5
  121. package/src/components/OverlayTrigger/index.js +10 -6
  122. package/src/components/icons/column-outline.d.ts +3 -0
  123. package/src/components/icons/column-outline.js +7 -0
  124. package/src/components/icons/index.js +5 -1
  125. package/src/components/icons/sync.d.ts +3 -0
  126. package/src/components/icons/sync.js +7 -0
  127. package/src/env.js +2 -2
  128. package/src/metamodel/adaptable.metamodel.d.ts +121 -200
  129. package/src/metamodel/adaptable.metamodel.js +1 -1
  130. package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
  131. package/src/parser/src/predicate/mapExpressionToQlPredicate.js +14 -3
  132. package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
  133. package/src/parser/src/types.d.ts +101 -1
  134. package/src/types.d.ts +8 -6
  135. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -219,13 +219,36 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
219
219
  * Returns a description of an Alert Definition
220
220
  * @param alertDefinition Alert Definition to use
221
221
  */
222
- getAlertDescription(alertDefinition, cellDataChangedInfo) {
223
- const customMessage = this.getCustomAlertDescription(alertDefinition, { cellDataChangedInfo });
222
+ getAlertDescriptionForDataChange(alertDefinition, cellDataChangedInfo) {
223
+ let customMessage = this.getCustomAlertDescription(alertDefinition, { cellDataChangedInfo });
224
+ const anotationContext = cellDataChangedInfo
225
+ ? {
226
+ column: cellDataChangedInfo.column,
227
+ rowNode: cellDataChangedInfo.rowNode,
228
+ oldValue: cellDataChangedInfo.oldValue,
229
+ newValue: cellDataChangedInfo.newValue,
230
+ primaryKeyValue: cellDataChangedInfo.primaryKeyValue,
231
+ timestamp: cellDataChangedInfo.changedAt,
232
+ trigger: cellDataChangedInfo.trigger,
233
+ }
234
+ : {};
224
235
  if (customMessage) {
236
+ customMessage = cellDataChangedInfo
237
+ ? this.annotateAlertText(customMessage, anotationContext)
238
+ : customMessage;
225
239
  return customMessage;
226
240
  }
227
241
  if (alertDefinition.MessageText != null) {
228
- return alertDefinition.MessageText;
242
+ let alertText = alertDefinition.MessageText;
243
+ try {
244
+ alertText = cellDataChangedInfo
245
+ ? this.annotateAlertText(alertText, anotationContext)
246
+ : alertText;
247
+ return alertText;
248
+ }
249
+ catch (e) {
250
+ this.logError('Error in getAlertMessageHeader', e);
251
+ }
229
252
  }
230
253
  let scopeDescription = this.getColumnScopeApi().getScopeDescription(alertDefinition.Scope);
231
254
  let ruleDescription = this.getAlertRuleDescription(alertDefinition);
@@ -235,11 +258,75 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
235
258
  * Returns a description title of an Alert Definition
236
259
  * @param alertDefinition Alert Definition to use
237
260
  */
238
- getAlertMessageHeader(alertDefinition, cellDataChangedInfo) {
261
+ getAlertMessageHeaderForDataChange(alertDefinition, cellDataChangedInfo) {
239
262
  var _a, _b;
240
- return ((_a = this.getCustomAlertMessageHeader(alertDefinition, {
263
+ const anotationContext = cellDataChangedInfo
264
+ ? {
265
+ column: cellDataChangedInfo.column,
266
+ rowNode: cellDataChangedInfo.rowNode,
267
+ oldValue: cellDataChangedInfo.oldValue,
268
+ newValue: cellDataChangedInfo.newValue,
269
+ primaryKeyValue: cellDataChangedInfo.primaryKeyValue,
270
+ timestamp: cellDataChangedInfo.changedAt,
271
+ trigger: cellDataChangedInfo.trigger,
272
+ }
273
+ : {};
274
+ let message = (_a = this.getCustomAlertMessageHeader(alertDefinition, {
241
275
  cellDataChangedInfo,
242
- })) !== null && _a !== void 0 ? _a : (_b = cellDataChangedInfo === null || cellDataChangedInfo === void 0 ? void 0 : cellDataChangedInfo.column) === null || _b === void 0 ? void 0 : _b.friendlyName);
276
+ })) !== null && _a !== void 0 ? _a : (_b = cellDataChangedInfo === null || cellDataChangedInfo === void 0 ? void 0 : cellDataChangedInfo.column) === null || _b === void 0 ? void 0 : _b.friendlyName;
277
+ try {
278
+ message = cellDataChangedInfo ? this.annotateAlertText(message, anotationContext) : message;
279
+ }
280
+ catch (e) {
281
+ this.logError('Error in getAlertMessageHeader', e);
282
+ }
283
+ return message;
284
+ }
285
+ getAlertMessageForGridDataChange(alertDefinition, gridDataChangedInfo) {
286
+ const rowAdded = gridDataChangedInfo.rowTrigger === 'Add';
287
+ const numberOfChangedRows = gridDataChangedInfo.rowNodes.length;
288
+ const actionName = rowAdded ? 'Added' : 'Removed';
289
+ const defaultMessage = numberOfChangedRows > 1
290
+ ? `${numberOfChangedRows} rows were ${actionName.toLowerCase()}`
291
+ : `${numberOfChangedRows} row was ${actionName.toLowerCase()}`;
292
+ const customMessage = this.getCustomAlertDescription(alertDefinition, {
293
+ gridDataChangedInfo,
294
+ });
295
+ let alertMessage = alertDefinition.MessageText
296
+ ? alertDefinition.MessageText
297
+ : customMessage !== null && customMessage !== void 0 ? customMessage : defaultMessage;
298
+ try {
299
+ alertMessage = this.annotateAlertText(alertMessage, {
300
+ numberOfRows: numberOfChangedRows,
301
+ timestamp: gridDataChangedInfo.changedAt,
302
+ trigger: gridDataChangedInfo.rowTrigger,
303
+ });
304
+ }
305
+ catch (e) {
306
+ this.logError('Error in getAlertMessageForGridDataChange', e);
307
+ }
308
+ return alertMessage;
309
+ }
310
+ getAlertHeaderForGridDataChange(alertDefinition, gridDataChangedInfo) {
311
+ const rowAdded = gridDataChangedInfo.rowTrigger === 'Add';
312
+ const numberOfChangedRows = gridDataChangedInfo.rowNodes.length;
313
+ const actionName = rowAdded ? 'Added' : 'Removed';
314
+ const customHeader = this.getCustomAlertMessageHeader(alertDefinition, {
315
+ gridDataChangedInfo,
316
+ });
317
+ const alertHeader = numberOfChangedRows > 1 ? `${actionName} Rows` : `${actionName} Row `;
318
+ let header = customHeader !== null && customHeader !== void 0 ? customHeader : alertHeader;
319
+ try {
320
+ header = this.annotateAlertText(header, {
321
+ numberOfRows: numberOfChangedRows,
322
+ timestamp: gridDataChangedInfo.changedAt,
323
+ trigger: gridDataChangedInfo.rowTrigger,
324
+ });
325
+ }
326
+ catch (e) {
327
+ this.logError('Error in getAlertHeaderForGridDataChange', e);
328
+ }
329
+ return header;
243
330
  }
244
331
  /**
245
332
  * Returns custom description for alert using the 'alertMessageText' property
@@ -454,6 +541,7 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
454
541
  }
455
542
  }
456
543
  });
544
+ ``;
457
545
  }
458
546
  return triggeredAlerts;
459
547
  }
@@ -470,7 +558,6 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
470
558
  }
471
559
  isAlertPredicateTriggered(alert, dataChangedEvent, defaultNoPredicateReturn = false) {
472
560
  var _a;
473
- const adapatableApi = this.getAdaptableApi();
474
561
  const predicateDefHandlerContext = Object.assign({ value: dataChangedEvent.newValue, oldValue: dataChangedEvent.oldValue,
475
562
  // TODO send real display value
476
563
  displayValue: null, node: dataChangedEvent.rowNode, column: dataChangedEvent.column }, this.getAdaptableApi().internalApi.buildBaseContext());
@@ -484,7 +571,7 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
484
571
  if ((0, IAlertService_1.isCellDataChangedInfo)(dataChangedInfo)) {
485
572
  alertDefinitions.forEach((alertDefinition) => {
486
573
  if (this.shouldFireAlertOnClient(alertDefinition)) {
487
- const alert = ObjectFactory_1.default.CreateCellChangedAlert(this.getAlertMessageHeader(alertDefinition, dataChangedInfo), this.getAlertDescription(alertDefinition, dataChangedInfo), alertDefinition, dataChangedInfo);
574
+ const alert = ObjectFactory_1.default.CreateCellChangedAlert(this.getAlertMessageHeaderForDataChange(alertDefinition, dataChangedInfo), this.getAlertDescriptionForDataChange(alertDefinition, dataChangedInfo), alertDefinition, dataChangedInfo);
488
575
  this.getAdaptableApi().alertApi.showAdaptableAlert(alert);
489
576
  }
490
577
  });
@@ -494,25 +581,9 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
494
581
  }
495
582
  }
496
583
  showAlertsForGridDataChanges(gridDataChangedInfo, alertDefinitions) {
497
- const rowAdded = gridDataChangedInfo.rowTrigger === 'Add';
498
- const numberOfChangedRows = gridDataChangedInfo.rowNodes.length;
499
- const actionName = rowAdded ? 'Added' : 'Removed';
500
- const alertHeader = numberOfChangedRows > 1 ? `${actionName} Rows` : `${actionName} Row `;
501
- const defaultMessage = numberOfChangedRows > 1
502
- ? `${numberOfChangedRows} rows were ${actionName.toLowerCase()}`
503
- : `${numberOfChangedRows} row was ${actionName.toLowerCase()}`;
504
584
  alertDefinitions === null || alertDefinitions === void 0 ? void 0 : alertDefinitions.forEach((alertDefinition) => {
505
585
  if (this.shouldFireAlertOnClient(alertDefinition)) {
506
- const customMessage = this.getCustomAlertDescription(alertDefinition, {
507
- gridDataChangedInfo,
508
- });
509
- const customHeader = this.getCustomAlertMessageHeader(alertDefinition, {
510
- gridDataChangedInfo,
511
- });
512
- const alertMessage = alertDefinition.MessageText
513
- ? alertDefinition.MessageText
514
- : customMessage !== null && customMessage !== void 0 ? customMessage : defaultMessage;
515
- const alert = ObjectFactory_1.default.CreateRowChangedAlert(customHeader !== null && customHeader !== void 0 ? customHeader : alertHeader, alertMessage, alertDefinition, gridDataChangedInfo);
586
+ const alert = ObjectFactory_1.default.CreateRowChangedAlert(this.getAlertHeaderForGridDataChange(alertDefinition, gridDataChangedInfo), this.getAlertMessageForGridDataChange(alertDefinition, gridDataChangedInfo), alertDefinition, gridDataChangedInfo);
516
587
  this.getAlertApi().showAdaptableAlert(alert);
517
588
  }
518
589
  });
@@ -545,5 +616,105 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
545
616
  ],
546
617
  };
547
618
  }
619
+ /**
620
+ * Supported tokens:
621
+ * - column-that-changed-name -> [column]
622
+ * - rowData.newValue -> [rowData.newValue]
623
+ * - rowData.oldValue -> [rowData.oldValue]
624
+ * - primaryKey -> [primaryKeyValue]
625
+ * - timestamp -> [timestamp]
626
+ * - trigger -> [trigger]
627
+ */
628
+ annotateAlertText(text, context) {
629
+ var _a, _b, _c;
630
+ if (!text) {
631
+ return text;
632
+ }
633
+ if (!context) {
634
+ return text;
635
+ }
636
+ if (context === null || context === void 0 ? void 0 : context.newValue) {
637
+ text = this.replaceAll(text, '[newValue]', context.newValue);
638
+ }
639
+ if (context === null || context === void 0 ? void 0 : context.oldValue) {
640
+ text = this.replaceAll(text, '[oldValue]', context.oldValue);
641
+ }
642
+ if (context === null || context === void 0 ? void 0 : context.primaryKeyValue) {
643
+ text = this.replaceAll(text, '[primaryKeyValue]', context.primaryKeyValue);
644
+ }
645
+ if (context === null || context === void 0 ? void 0 : context.timestamp) {
646
+ text = this.replaceAll(text, '[timestamp]', context.timestamp + '');
647
+ }
648
+ if (context === null || context === void 0 ? void 0 : context.numberOfRows) {
649
+ text = this.replaceAll(text, '[numberOfRows]', context.numberOfRows + '');
650
+ }
651
+ if (context === null || context === void 0 ? void 0 : context.trigger) {
652
+ const dataChangeTriggerMap = {
653
+ edit: 'Edit',
654
+ tick: 'Tick',
655
+ undo: 'Undo',
656
+ aggChange: 'AggChange',
657
+ };
658
+ const rowChangeTriggerMap = {
659
+ Add: 'Added',
660
+ Edit: 'Edited',
661
+ Delete: 'Deleted',
662
+ Load: 'Loaded',
663
+ };
664
+ const mappedTrigger =
665
+ // @ts-ignore
666
+ (_a = (dataChangeTriggerMap[context.trigger] || rowChangeTriggerMap[context.trigger])) !== null && _a !== void 0 ? _a : context.trigger;
667
+ text = this.replaceAll(text, '[trigger]', mappedTrigger);
668
+ }
669
+ if ((context === null || context === void 0 ? void 0 : context.column) && (context === null || context === void 0 ? void 0 : context.rowNode)) {
670
+ text = this.replaceAll(text, '[column]', this.getGridApi().getRawValueFromRowNode(context.rowNode, context.column.columnId));
671
+ }
672
+ if (context === null || context === void 0 ? void 0 : context.rowNode) {
673
+ const columns = this.extractColsFromText(text);
674
+ for (const column of columns) {
675
+ if (this.getColumnApi().getColumnWithColumnId(column)) {
676
+ text = this.replaceAll(text, `[rowData.${column}]`, this.getGridApi().getRawValueFromRowNode(context.rowNode, column));
677
+ }
678
+ }
679
+ }
680
+ if (text.indexOf('[context') !== -1) {
681
+ const agGridContext = (_c = (_b = this.adaptable.agGridAdapter).getGridOption) === null || _c === void 0 ? void 0 : _c.call(_b, 'context');
682
+ const agGridContextKeys = this.extractContextKeysFromText(text);
683
+ for (const key of agGridContextKeys) {
684
+ if (agGridContext[key]) {
685
+ text = this.replaceAll(text, `[context.${key}]`, agGridContext[key]);
686
+ }
687
+ }
688
+ }
689
+ return text;
690
+ }
691
+ replaceAll(text, toReplace, replaceWith) {
692
+ if (!text) {
693
+ return text;
694
+ }
695
+ // fails for []
696
+ toReplace = toReplace.replace('[', '\\[').replace(']', '\\]');
697
+ return text.replace(new RegExp(toReplace, 'g'), replaceWith);
698
+ }
699
+ extractColsFromText(text) {
700
+ // rowData.columnName => columnName
701
+ const regex = /\[rowData\.(.*?)\]/g;
702
+ let m;
703
+ const cols = [];
704
+ while ((m = regex.exec(text)) !== null) {
705
+ cols.push(m[1]);
706
+ }
707
+ return cols;
708
+ }
709
+ extractContextKeysFromText(text) {
710
+ // context.columnName => columnName
711
+ const regex = /\[context\.(.*?)\]/g;
712
+ let m;
713
+ const contextKeys = [];
714
+ while ((m = regex.exec(text)) !== null) {
715
+ contextKeys.push(m[1]);
716
+ }
717
+ return contextKeys;
718
+ }
548
719
  }
549
720
  exports.AlertInternalApi = AlertInternalApi;
@@ -6,6 +6,7 @@ import { ColumnFilter } from '../../PredefinedConfig/Common/ColumnFilter';
6
6
  import { IRowNode } from '@ag-grid-community/core';
7
7
  import { LayoutColumnFilterAction } from '../../Redux/ActionsReducers/LayoutRedux';
8
8
  import * as Redux from 'redux';
9
+ import { ColumnValuesFilterPredicate } from '../../AdaptableOptions/ColumnFilterOptions';
9
10
  export declare class ColumnFilterInternalApi extends ApiBase {
10
11
  /**
11
12
  * Returns Predicate Definition for given Column and Quick Filter shortcut
@@ -58,4 +59,5 @@ export declare class ColumnFilterInternalApi extends ApiBase {
58
59
  areColumnFiltersDifferent(oldFilters: ColumnFilter[], newFilters: ColumnFilter[]): boolean;
59
60
  getPredicateDefShortcuts(predicateDef: AdaptablePredicateDef): string[];
60
61
  getFilterValuesMaxNumberOfItems(column: AdaptableColumn): number | undefined;
62
+ getValuesFitlerPredicateIds(column: AdaptableColumn): ColumnValuesFilterPredicate[];
61
63
  }
@@ -210,5 +210,25 @@ class ColumnFilterInternalApi extends ApiBase_1.ApiBase {
210
210
  return maxFilterValues;
211
211
  }
212
212
  }
213
+ getValuesFitlerPredicateIds(column) {
214
+ var _a, _b;
215
+ const valuesFilterPredicateOptions = (_b = (_a = this.getOptions().columnFilterOptions) === null || _a === void 0 ? void 0 : _a.valuesFilterOptions) === null || _b === void 0 ? void 0 : _b.valuesFilterPredicateOptions;
216
+ const availablePredicates = this.getPredicateApi().getPredicateDefsByModuleScope('columnFilter');
217
+ let predicateIds = [];
218
+ if (typeof (valuesFilterPredicateOptions === null || valuesFilterPredicateOptions === void 0 ? void 0 : valuesFilterPredicateOptions.predicates) === 'function') {
219
+ const columnFilterContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { column: column });
220
+ predicateIds = valuesFilterPredicateOptions.predicates(columnFilterContext);
221
+ }
222
+ else if (Array.isArray(valuesFilterPredicateOptions === null || valuesFilterPredicateOptions === void 0 ? void 0 : valuesFilterPredicateOptions.predicates)) {
223
+ predicateIds = valuesFilterPredicateOptions.predicates;
224
+ }
225
+ return predicateIds.filter((predicateId) => {
226
+ const predicate = availablePredicates.find((p) => p.id === predicateId);
227
+ if (!predicate) {
228
+ return false;
229
+ }
230
+ return this.getColumnScopeApi().isColumnInScope(column, predicate.columnScope);
231
+ });
232
+ }
213
233
  }
214
234
  exports.ColumnFilterInternalApi = ColumnFilterInternalApi;
@@ -3,7 +3,7 @@ import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChang
3
3
  import { Report } from '../../PredefinedConfig/ExportState';
4
4
  import { AdaptableColumnType } from '../../PredefinedConfig/Common/Types';
5
5
  import { ExcelDataType, ExcelStyle } from '@ag-grid-community/core';
6
- import { AdaptableColumnDataType } from '../../PredefinedConfig/Common/AdaptableColumn';
6
+ import { AdaptableColumn, AdaptableColumnDataType } from '../../PredefinedConfig/Common/AdaptableColumn';
7
7
  import { DataFormatType } from '../../AdaptableOptions/ExportOptions';
8
8
  export declare class ExportInternalApi extends ApiBase {
9
9
  /**
@@ -14,8 +14,8 @@ export declare class ExportInternalApi extends ApiBase {
14
14
  isDataChangeInReport(cellDataChangedInfo: CellDataChangedInfo, report: Report): boolean;
15
15
  getExcelDataType(adaptableColumnType: string | string[] | AdaptableColumnType | AdaptableColumnType[]): ExcelDataType;
16
16
  isVisualDataExportInProgress(): boolean;
17
- isDateCellExportedAsFormattedValue(): boolean;
18
- getCellExportFormatType(columnDataType: AdaptableColumnDataType): DataFormatType;
17
+ isDateCellExportedAsFormattedValue(abColumn: AdaptableColumn): boolean;
18
+ getCellExportFormatType(column: AdaptableColumn, columnDataType: AdaptableColumnDataType): DataFormatType;
19
19
  isDestinationEnabled(destination: string): boolean;
20
20
  getExcelStylesForVisualDataExport(original_excelStyles: ExcelStyle[]): ExcelStyle[];
21
21
  }
@@ -97,28 +97,42 @@ class ExportInternalApi extends ApiBase_1.ApiBase {
97
97
  isVisualDataExportInProgress() {
98
98
  return this.getAdaptableState().System.Export.visualDataExportInProgress;
99
99
  }
100
- isDateCellExportedAsFormattedValue() {
100
+ isDateCellExportedAsFormattedValue(abColumn) {
101
101
  return (!!this.getExportOptions().exportDateFormat ||
102
- this.getCellExportFormatType('Date') === 'formattedValue');
102
+ this.getCellExportFormatType(abColumn, 'Date') === 'formattedValue');
103
103
  }
104
- getCellExportFormatType(columnDataType) {
104
+ getCellExportFormatType(column, columnDataType) {
105
105
  const exportOptions = this.getExportOptions();
106
- if (exportOptions.exportFormatType === 'rawValue' ||
107
- exportOptions.exportFormatType === 'formattedValue') {
108
- return exportOptions.exportFormatType;
106
+ const exportFormatType = exportOptions.exportFormatType;
107
+ // First check if a function was provided and return the result
108
+ if (exportFormatType != null && typeof exportFormatType === 'function') {
109
+ const context = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { column: column });
110
+ return exportFormatType(context);
109
111
  }
110
- // format is customized based on column data type
111
- switch (columnDataType) {
112
- case 'String':
113
- return exportOptions.exportFormatType.string;
114
- case 'Number':
115
- return exportOptions.exportFormatType.number;
116
- case 'Date':
117
- return exportOptions.exportFormatType.date;
118
- default:
119
- // default to rawValue for all other column types
120
- return 'rawValue';
112
+ // Next Check if a "hard-coded" value has been provided and return that
113
+ if (exportFormatType === 'rawValue') {
114
+ return 'rawValue';
121
115
  }
116
+ if (exportFormatType === 'formattedValue') {
117
+ return 'formattedValue';
118
+ }
119
+ // Finally test if a DataType object has been provided and return the relevant property
120
+ const dataFormatDataType = exportFormatType;
121
+ if (dataFormatDataType) {
122
+ // format is customized based on column data type
123
+ switch (columnDataType) {
124
+ case 'String':
125
+ return dataFormatDataType.string;
126
+ case 'Number':
127
+ return dataFormatDataType.number;
128
+ case 'Date':
129
+ return dataFormatDataType.date;
130
+ default:
131
+ // default to rawValue for all other column types
132
+ return 'rawValue';
133
+ }
134
+ }
135
+ return 'rawValue';
122
136
  }
123
137
  isDestinationEnabled(destination) {
124
138
  if (destination === 'Table' && this.getLayoutApi().internalApi.isLayoutGrouped()) {
@@ -1,6 +1,6 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
2
  import { AdaptableQLModule } from '../../PredefinedConfig/Common/Types';
3
- import { AdaptableObject, AdaptablePredicate } from '../../types';
3
+ import { AdaptableField, AdaptableObject, AdaptablePredicate } from '../../types';
4
4
  export declare class ExpressionInternalApi extends ApiBase {
5
5
  /**
6
6
  * Checks if a column is referenced in a given Expression
@@ -10,4 +10,8 @@ export declare class ExpressionInternalApi extends ApiBase {
10
10
  isColumnReferencedInExpression(columnId: string, expression: string): boolean;
11
11
  evaluateExpressionInAdaptableQL(module: AdaptableQLModule, object?: AdaptableObject, expression?: string): boolean;
12
12
  evaluatePredicatesInAdaptableQL(module: AdaptableQLModule, object?: AdaptableObject, predicates?: AdaptablePredicate[]): boolean;
13
+ private getFieldsFromOptions;
14
+ getAvailableFields(data?: Record<string, any>): AdaptableField[];
15
+ getFieldType(field: string): AdaptableField['dataType'];
16
+ getFieldsOfType(type?: AdaptableField['dataType']): AdaptableField[];
13
17
  }
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExpressionInternalApi = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const ApiBase_1 = require("../Implementation/ApiBase");
6
+ const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
5
7
  class ExpressionInternalApi extends ApiBase_1.ApiBase {
6
8
  /**
7
9
  * Checks if a column is referenced in a given Expression
@@ -48,5 +50,83 @@ class ExpressionInternalApi extends ApiBase_1.ApiBase {
48
50
  }
49
51
  return !evaluateExpressionExternallyFn(context);
50
52
  }
53
+ // Used later, when we extend to support inferring fields from data
54
+ // private getFieldsFromData<T extends Record<string, any>>(data: T): string[] {
55
+ // if (!data) {
56
+ // return [];
57
+ // }
58
+ // if (typeof data !== 'object' || Number.isNaN(data)) {
59
+ // return [];
60
+ // }
61
+ // const keys: string[] = [];
62
+ // for (const key in Object.keys(data)) {
63
+ // const candidate = data[key];
64
+ // if (
65
+ // typeof candidate === 'number' ||
66
+ // typeof candidate === 'string' ||
67
+ // typeof candidate === 'boolean' ||
68
+ // candidate instanceof Date
69
+ // ) {
70
+ // keys.push(key);
71
+ // continue;
72
+ // }
73
+ // // no support for arrays
74
+ // // for objects we go one level deep
75
+ // if (typeof candidate === 'object' && candidate !== null && !Array.isArray(candidate)) {
76
+ // const childKeys = this.getFieldsFromData(candidate);
77
+ // for (const childKey of childKeys) {
78
+ // keys.push(`${key}.${childKey}`);
79
+ // }
80
+ // }
81
+ // }
82
+ // return keys;
83
+ // }
84
+ getFieldsFromOptions() {
85
+ const fields = this.adaptable.api.optionsApi.getExpressionOptions().fields;
86
+ if (fields != null && typeof fields === 'function') {
87
+ return fields(this.getAdaptableApi().internalApi.buildBaseContext());
88
+ }
89
+ else {
90
+ let arr = fields;
91
+ if (arr && ArrayExtensions_1.default.IsNotNullOrEmpty(arr)) {
92
+ return arr;
93
+ }
94
+ }
95
+ }
96
+ getAvailableFields(data) {
97
+ var _a, _b;
98
+ const optionFields = (_b = ((_a = this.getFieldsFromOptions()) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.map((field) => (Object.assign(Object.assign({}, field), { label: field.label || field.name })));
99
+ // const existingFields = new Set<string>();
100
+ // Exclude fields already in options
101
+ // optionFields.forEach((field) => existingFields.add(field.value));
102
+ // const queriableColumns = this.getColumnApi().getQueryableColumns();
103
+ // Exclude queriable columns
104
+ // queriableColumns.forEach((column) => existingFields.add(column.field));
105
+ // const dataFields = this.getFieldsFromData(data).reduce<AdaptableField[]>((acc, field) => {
106
+ // if (!existingFields.has(field)) {
107
+ // acc.push({
108
+ // label: field,
109
+ // value: field,
110
+ // });
111
+ // }
112
+ // return acc;
113
+ // }, []);
114
+ return optionFields;
115
+ }
116
+ getFieldType(field) {
117
+ var _a;
118
+ const fieldDef = (_a = this.getFieldsFromOptions()) === null || _a === void 0 ? void 0 : _a.find((f) => f.name === field);
119
+ if (fieldDef) {
120
+ return fieldDef.dataType;
121
+ }
122
+ return 'String';
123
+ }
124
+ getFieldsOfType(type) {
125
+ var _a, _b, _c;
126
+ if (!type) {
127
+ return (_a = this.getAvailableFields()) !== null && _a !== void 0 ? _a : [];
128
+ }
129
+ return (_c = (_b = this.getAvailableFields()) === null || _b === void 0 ? void 0 : _b.filter((f) => f.dataType === type)) !== null && _c !== void 0 ? _c : [];
130
+ }
51
131
  }
52
132
  exports.ExpressionInternalApi = ExpressionInternalApi;
@@ -1,32 +1,30 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
- import { Fdc3ContextType, Fdc3Context, Fdc3StandardContextType } from '../../PredefinedConfig/Common/Fdc3Context';
3
2
  import { ColDef, IRowNode } from '@ag-grid-community/core';
4
- import { AppIdentifier, Context, IntentResolution } from '@finos/fdc3';
3
+ import { AppIdentifier, Context, ContextType, Intent, IntentResolution, StandardContextType, StandardIntent } from '@finos/fdc3';
5
4
  import { BroadcastConfig, RaiseIntentConfig } from '../../AdaptableOptions/Fdc3Options';
6
- import { Fdc3IntentType, Fdc3StandardIntentType } from '../../PredefinedConfig/Common/Fdc3Intent';
7
5
  import { AdaptableButton } from '../../PredefinedConfig/Common/AdaptableButton';
8
6
  import { ActionColumnContext } from '../../AdaptableOptions/ActionColumnOptions';
9
7
  import { AdaptableIcon } from '../../PredefinedConfig/Common/AdaptableIcon';
10
8
  export type WithContext<K> = K & {
11
- contextType: Fdc3ContextType;
9
+ contextType: ContextType;
12
10
  };
13
11
  export type WithIntent<K> = K & {
14
- intentType: Fdc3IntentType;
12
+ intentType: Intent;
15
13
  };
16
14
  export declare class Fdc3InternalApi extends ApiBase {
17
- mapRowToContextData(contextType: Fdc3ContextType, rowNode: IRowNode): Fdc3Context;
15
+ mapRowToContextData(contextType: ContextType, rowNode: IRowNode): Context;
18
16
  getFdc3ActionColDefs(): ColDef[];
19
17
  getButtonsForFdc3MainActionColumn(): AdaptableButton<ActionColumnContext<any>>[];
20
18
  getButtonsForFdc3StandaloneActionColumn(columnId: string): AdaptableButton<ActionColumnContext<any>>[];
21
19
  isFdc3MainActionColumn(columnId: string): boolean;
22
20
  isFdc3StandaloneActionColumn(columnId: string, columnType: string | string[]): boolean;
23
21
  handleIntentResolution(intentResolution: IntentResolution, context: Context, raisedIntent: string, app?: AppIdentifier): void;
24
- isStandardContextType(contextType: string): contextType is Fdc3StandardContextType;
25
- isStandardIntentType(intentType: string): intentType is Fdc3StandardIntentType;
22
+ isStandardContextType(contextType: string): contextType is StandardContextType;
23
+ isStandardIntentType(intentType: string): intentType is StandardIntent;
26
24
  getAllRaiseIntentConfigs(): WithIntent<RaiseIntentConfig>[];
27
25
  getAllBroadcastContextConfigs(): WithContext<BroadcastConfig>[];
28
- getDefaultIconForIntent(intentType: Fdc3IntentType): AdaptableIcon;
29
- getDefaultIconForContext(contextType: Fdc3ContextType): AdaptableIcon;
26
+ getDefaultIconForIntent(intentType: Intent): AdaptableIcon;
27
+ getDefaultIconForContext(contextType: ContextType): AdaptableIcon;
30
28
  private mapRowValueToContextData;
31
29
  private isAtLeastOneActionButtonConfigured;
32
30
  private getIntentConfigsWithActionButtons;
@@ -2,19 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Fdc3InternalApi = void 0;
4
4
  const ApiBase_1 = require("../Implementation/ApiBase");
5
- const Fdc3Context_1 = require("../../PredefinedConfig/Common/Fdc3Context");
6
5
  const fdc3_1 = require("@finos/fdc3");
7
6
  const Fdc3Options_1 = require("../../AdaptableOptions/Fdc3Options");
8
- const Fdc3Intent_1 = require("../../PredefinedConfig/Common/Fdc3Intent");
9
7
  const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
10
8
  const ActionColumnRenderer_1 = require("../../agGrid/ActionColumnRenderer");
11
9
  class Fdc3InternalApi extends ApiBase_1.ApiBase {
12
10
  mapRowToContextData(contextType, rowNode) {
13
11
  var _a, _b, _c;
14
- if (contextType === fdc3_1.ContextTypes.Nothing) {
15
- return { type: fdc3_1.ContextTypes.Nothing };
12
+ if (contextType === 'fdc3.nothing') {
13
+ return { type: contextType };
16
14
  }
17
- const mappedContextData = this.mapRowValueToContextData(rowNode, this.isStandardContextType(contextType) && contextType !== fdc3_1.ContextTypes.Nothing
15
+ const mappedContextData = this.mapRowValueToContextData(rowNode, this.isStandardContextType(contextType) && contextType !== 'fdc3.nothing'
18
16
  ? (_a = this.getFdc3Options().gridDataContextMapping) === null || _a === void 0 ? void 0 : _a[contextType]
19
17
  : (_c = (_b = this.getFdc3Options().gridDataContextMapping) === null || _b === void 0 ? void 0 : _b.custom) === null || _c === void 0 ? void 0 : _c[contextType]);
20
18
  const contextMappedFromGridData = Object.assign({ type: contextType }, mappedContextData);
@@ -157,12 +155,10 @@ class Fdc3InternalApi extends ApiBase_1.ApiBase {
157
155
  }
158
156
  }
159
157
  isStandardContextType(contextType) {
160
- // @ts-ignore
161
- return Fdc3Context_1.StandardContextTypes.includes(contextType);
158
+ return (0, fdc3_1.isStandardContextType)(contextType);
162
159
  }
163
160
  isStandardIntentType(intentType) {
164
- // @ts-ignore
165
- return Fdc3Intent_1.Fdc3StandardIntents.includes(intentType);
161
+ return (0, fdc3_1.isStandardIntent)(intentType);
166
162
  }
167
163
  getAllRaiseIntentConfigs() {
168
164
  var _a;