@adaptabletools/adaptable 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 (136) hide show
  1. package/agGrid.d.ts +4 -3
  2. package/agGrid.js +4 -3
  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 +36 -12
  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 +79 -0
  31. package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
  32. package/src/Api/Internal/Fdc3InternalApi.js +6 -10
  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 +1 -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 +43 -31
  41. package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
  42. package/src/PredefinedConfig/Common/Fdc3Intent.js +26 -73
  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 +1 -1
  52. package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
  53. package/src/Utilities/Services/Fdc3Service.js +2 -2
  54. package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
  55. package/src/Utilities/Services/QueryLanguageService.js +105 -6
  56. package/src/Utilities/Services/ReportService.js +8 -5
  57. package/src/Utilities/Services/RowSummaryService.js +3 -1
  58. package/src/Utilities/divideBy100.d.ts +1 -0
  59. package/src/Utilities/divideBy100.js +30 -0
  60. package/src/Utilities/times100.d.ts +1 -0
  61. package/src/Utilities/times100.js +23 -0
  62. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
  63. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
  64. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
  65. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
  66. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +5 -5
  67. package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
  68. package/src/View/Components/EntityRulesEditor/index.js +11 -7
  69. package/src/View/Components/ExpressionWizard.js +1 -1
  70. package/src/View/Components/FilterForm/FilterForm.js +2 -2
  71. package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
  72. package/src/View/Components/FilterForm/QuickFilterValues.d.ts +1 -1
  73. package/src/View/Components/FilterForm/QuickFilterValues.js +5 -5
  74. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
  75. package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
  76. package/src/View/Components/Selectors/FieldSelector.js +21 -0
  77. package/src/View/Components/Selectors/PermittedValuesSelector.js +9 -5
  78. package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
  79. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
  80. package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
  81. package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
  82. package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
  83. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
  84. package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
  85. package/src/agGrid/AdaptableAgGrid.d.ts +4 -6
  86. package/src/agGrid/AdaptableAgGrid.js +68 -49
  87. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
  88. package/src/agGrid/AgGridColumnAdapter.js +22 -0
  89. package/src/agGrid/AgGridMenuAdapter.js +1 -1
  90. package/src/agGrid/FilterWrapper.js +12 -7
  91. package/src/agGrid/defaultAdaptableOptions.js +2 -2
  92. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
  93. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
  94. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
  95. package/src/agGrid/editors/AdaptableDateEditor/index.js +5 -18
  96. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
  97. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
  98. package/src/agGrid/editors/AdaptableNumberEditor/index.js +5 -2
  99. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
  100. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +80 -0
  101. package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
  102. package/src/agGrid/editors/AdaptablePercentageEditor/index.js +148 -0
  103. package/src/components/Accordion.js +1 -1
  104. package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
  105. package/src/components/Datepicker/index.js +3 -4
  106. package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
  107. package/src/components/ExpressionEditor/DataTableEditor.js +63 -0
  108. package/src/components/ExpressionEditor/EditorInput.js +22 -9
  109. package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
  110. package/src/components/ExpressionEditor/NamedQueryEditor.js +30 -0
  111. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
  112. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
  113. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
  114. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +71 -13
  115. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +30 -22
  116. package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
  117. package/src/components/ExpressionEditor/QueryBuilder/utils.js +41 -3
  118. package/src/components/ExpressionEditor/index.d.ts +3 -1
  119. package/src/components/ExpressionEditor/index.js +67 -94
  120. package/src/components/Input/NumberInput.d.ts +2 -1
  121. package/src/components/Input/NumberInput.js +7 -4
  122. package/src/components/OverlayTrigger/index.js +10 -6
  123. package/src/components/icons/column-outline.d.ts +3 -0
  124. package/src/components/icons/column-outline.js +4 -0
  125. package/src/components/icons/index.js +5 -1
  126. package/src/components/icons/sync.d.ts +3 -0
  127. package/src/components/icons/sync.js +4 -0
  128. package/src/env.js +2 -2
  129. package/src/metamodel/adaptable.metamodel.d.ts +121 -200
  130. package/src/metamodel/adaptable.metamodel.js +1 -1
  131. package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
  132. package/src/parser/src/predicate/mapExpressionToQlPredicate.js +12 -2
  133. package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
  134. package/src/parser/src/types.d.ts +101 -1
  135. package/src/types.d.ts +8 -6
  136. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -215,13 +215,36 @@ export class AlertInternalApi extends ApiBase {
215
215
  * Returns a description of an Alert Definition
216
216
  * @param alertDefinition Alert Definition to use
217
217
  */
218
- getAlertDescription(alertDefinition, cellDataChangedInfo) {
219
- const customMessage = this.getCustomAlertDescription(alertDefinition, { cellDataChangedInfo });
218
+ getAlertDescriptionForDataChange(alertDefinition, cellDataChangedInfo) {
219
+ let customMessage = this.getCustomAlertDescription(alertDefinition, { cellDataChangedInfo });
220
+ const anotationContext = cellDataChangedInfo
221
+ ? {
222
+ column: cellDataChangedInfo.column,
223
+ rowNode: cellDataChangedInfo.rowNode,
224
+ oldValue: cellDataChangedInfo.oldValue,
225
+ newValue: cellDataChangedInfo.newValue,
226
+ primaryKeyValue: cellDataChangedInfo.primaryKeyValue,
227
+ timestamp: cellDataChangedInfo.changedAt,
228
+ trigger: cellDataChangedInfo.trigger,
229
+ }
230
+ : {};
220
231
  if (customMessage) {
232
+ customMessage = cellDataChangedInfo
233
+ ? this.annotateAlertText(customMessage, anotationContext)
234
+ : customMessage;
221
235
  return customMessage;
222
236
  }
223
237
  if (alertDefinition.MessageText != null) {
224
- return alertDefinition.MessageText;
238
+ let alertText = alertDefinition.MessageText;
239
+ try {
240
+ alertText = cellDataChangedInfo
241
+ ? this.annotateAlertText(alertText, anotationContext)
242
+ : alertText;
243
+ return alertText;
244
+ }
245
+ catch (e) {
246
+ this.logError('Error in getAlertMessageHeader', e);
247
+ }
225
248
  }
226
249
  let scopeDescription = this.getColumnScopeApi().getScopeDescription(alertDefinition.Scope);
227
250
  let ruleDescription = this.getAlertRuleDescription(alertDefinition);
@@ -231,11 +254,75 @@ export class AlertInternalApi extends ApiBase {
231
254
  * Returns a description title of an Alert Definition
232
255
  * @param alertDefinition Alert Definition to use
233
256
  */
234
- getAlertMessageHeader(alertDefinition, cellDataChangedInfo) {
257
+ getAlertMessageHeaderForDataChange(alertDefinition, cellDataChangedInfo) {
235
258
  var _a, _b;
236
- return ((_a = this.getCustomAlertMessageHeader(alertDefinition, {
259
+ const anotationContext = cellDataChangedInfo
260
+ ? {
261
+ column: cellDataChangedInfo.column,
262
+ rowNode: cellDataChangedInfo.rowNode,
263
+ oldValue: cellDataChangedInfo.oldValue,
264
+ newValue: cellDataChangedInfo.newValue,
265
+ primaryKeyValue: cellDataChangedInfo.primaryKeyValue,
266
+ timestamp: cellDataChangedInfo.changedAt,
267
+ trigger: cellDataChangedInfo.trigger,
268
+ }
269
+ : {};
270
+ let message = (_a = this.getCustomAlertMessageHeader(alertDefinition, {
237
271
  cellDataChangedInfo,
238
- })) !== null && _a !== void 0 ? _a : (_b = cellDataChangedInfo === null || cellDataChangedInfo === void 0 ? void 0 : cellDataChangedInfo.column) === null || _b === void 0 ? void 0 : _b.friendlyName);
272
+ })) !== null && _a !== void 0 ? _a : (_b = cellDataChangedInfo === null || cellDataChangedInfo === void 0 ? void 0 : cellDataChangedInfo.column) === null || _b === void 0 ? void 0 : _b.friendlyName;
273
+ try {
274
+ message = cellDataChangedInfo ? this.annotateAlertText(message, anotationContext) : message;
275
+ }
276
+ catch (e) {
277
+ this.logError('Error in getAlertMessageHeader', e);
278
+ }
279
+ return message;
280
+ }
281
+ getAlertMessageForGridDataChange(alertDefinition, gridDataChangedInfo) {
282
+ const rowAdded = gridDataChangedInfo.rowTrigger === 'Add';
283
+ const numberOfChangedRows = gridDataChangedInfo.rowNodes.length;
284
+ const actionName = rowAdded ? 'Added' : 'Removed';
285
+ const defaultMessage = numberOfChangedRows > 1
286
+ ? `${numberOfChangedRows} rows were ${actionName.toLowerCase()}`
287
+ : `${numberOfChangedRows} row was ${actionName.toLowerCase()}`;
288
+ const customMessage = this.getCustomAlertDescription(alertDefinition, {
289
+ gridDataChangedInfo,
290
+ });
291
+ let alertMessage = alertDefinition.MessageText
292
+ ? alertDefinition.MessageText
293
+ : customMessage !== null && customMessage !== void 0 ? customMessage : defaultMessage;
294
+ try {
295
+ alertMessage = this.annotateAlertText(alertMessage, {
296
+ numberOfRows: numberOfChangedRows,
297
+ timestamp: gridDataChangedInfo.changedAt,
298
+ trigger: gridDataChangedInfo.rowTrigger,
299
+ });
300
+ }
301
+ catch (e) {
302
+ this.logError('Error in getAlertMessageForGridDataChange', e);
303
+ }
304
+ return alertMessage;
305
+ }
306
+ getAlertHeaderForGridDataChange(alertDefinition, gridDataChangedInfo) {
307
+ const rowAdded = gridDataChangedInfo.rowTrigger === 'Add';
308
+ const numberOfChangedRows = gridDataChangedInfo.rowNodes.length;
309
+ const actionName = rowAdded ? 'Added' : 'Removed';
310
+ const customHeader = this.getCustomAlertMessageHeader(alertDefinition, {
311
+ gridDataChangedInfo,
312
+ });
313
+ const alertHeader = numberOfChangedRows > 1 ? `${actionName} Rows` : `${actionName} Row `;
314
+ let header = customHeader !== null && customHeader !== void 0 ? customHeader : alertHeader;
315
+ try {
316
+ header = this.annotateAlertText(header, {
317
+ numberOfRows: numberOfChangedRows,
318
+ timestamp: gridDataChangedInfo.changedAt,
319
+ trigger: gridDataChangedInfo.rowTrigger,
320
+ });
321
+ }
322
+ catch (e) {
323
+ this.logError('Error in getAlertHeaderForGridDataChange', e);
324
+ }
325
+ return header;
239
326
  }
240
327
  /**
241
328
  * Returns custom description for alert using the 'alertMessageText' property
@@ -450,6 +537,7 @@ export class AlertInternalApi extends ApiBase {
450
537
  }
451
538
  }
452
539
  });
540
+ ``;
453
541
  }
454
542
  return triggeredAlerts;
455
543
  }
@@ -466,7 +554,6 @@ export class AlertInternalApi extends ApiBase {
466
554
  }
467
555
  isAlertPredicateTriggered(alert, dataChangedEvent, defaultNoPredicateReturn = false) {
468
556
  var _a;
469
- const adapatableApi = this.getAdaptableApi();
470
557
  const predicateDefHandlerContext = Object.assign({ value: dataChangedEvent.newValue, oldValue: dataChangedEvent.oldValue,
471
558
  // TODO send real display value
472
559
  displayValue: null, node: dataChangedEvent.rowNode, column: dataChangedEvent.column }, this.getAdaptableApi().internalApi.buildBaseContext());
@@ -480,7 +567,7 @@ export class AlertInternalApi extends ApiBase {
480
567
  if (isCellDataChangedInfo(dataChangedInfo)) {
481
568
  alertDefinitions.forEach((alertDefinition) => {
482
569
  if (this.shouldFireAlertOnClient(alertDefinition)) {
483
- const alert = ObjectFactory.CreateCellChangedAlert(this.getAlertMessageHeader(alertDefinition, dataChangedInfo), this.getAlertDescription(alertDefinition, dataChangedInfo), alertDefinition, dataChangedInfo);
570
+ const alert = ObjectFactory.CreateCellChangedAlert(this.getAlertMessageHeaderForDataChange(alertDefinition, dataChangedInfo), this.getAlertDescriptionForDataChange(alertDefinition, dataChangedInfo), alertDefinition, dataChangedInfo);
484
571
  this.getAdaptableApi().alertApi.showAdaptableAlert(alert);
485
572
  }
486
573
  });
@@ -490,25 +577,9 @@ export class AlertInternalApi extends ApiBase {
490
577
  }
491
578
  }
492
579
  showAlertsForGridDataChanges(gridDataChangedInfo, alertDefinitions) {
493
- const rowAdded = gridDataChangedInfo.rowTrigger === 'Add';
494
- const numberOfChangedRows = gridDataChangedInfo.rowNodes.length;
495
- const actionName = rowAdded ? 'Added' : 'Removed';
496
- const alertHeader = numberOfChangedRows > 1 ? `${actionName} Rows` : `${actionName} Row `;
497
- const defaultMessage = numberOfChangedRows > 1
498
- ? `${numberOfChangedRows} rows were ${actionName.toLowerCase()}`
499
- : `${numberOfChangedRows} row was ${actionName.toLowerCase()}`;
500
580
  alertDefinitions === null || alertDefinitions === void 0 ? void 0 : alertDefinitions.forEach((alertDefinition) => {
501
581
  if (this.shouldFireAlertOnClient(alertDefinition)) {
502
- const customMessage = this.getCustomAlertDescription(alertDefinition, {
503
- gridDataChangedInfo,
504
- });
505
- const customHeader = this.getCustomAlertMessageHeader(alertDefinition, {
506
- gridDataChangedInfo,
507
- });
508
- const alertMessage = alertDefinition.MessageText
509
- ? alertDefinition.MessageText
510
- : customMessage !== null && customMessage !== void 0 ? customMessage : defaultMessage;
511
- const alert = ObjectFactory.CreateRowChangedAlert(customHeader !== null && customHeader !== void 0 ? customHeader : alertHeader, alertMessage, alertDefinition, gridDataChangedInfo);
582
+ const alert = ObjectFactory.CreateRowChangedAlert(this.getAlertHeaderForGridDataChange(alertDefinition, gridDataChangedInfo), this.getAlertMessageForGridDataChange(alertDefinition, gridDataChangedInfo), alertDefinition, gridDataChangedInfo);
512
583
  this.getAlertApi().showAdaptableAlert(alert);
513
584
  }
514
585
  });
@@ -541,4 +612,104 @@ export class AlertInternalApi extends ApiBase {
541
612
  ],
542
613
  };
543
614
  }
615
+ /**
616
+ * Supported tokens:
617
+ * - column-that-changed-name -> [column]
618
+ * - rowData.newValue -> [rowData.newValue]
619
+ * - rowData.oldValue -> [rowData.oldValue]
620
+ * - primaryKey -> [primaryKeyValue]
621
+ * - timestamp -> [timestamp]
622
+ * - trigger -> [trigger]
623
+ */
624
+ annotateAlertText(text, context) {
625
+ var _a, _b, _c;
626
+ if (!text) {
627
+ return text;
628
+ }
629
+ if (!context) {
630
+ return text;
631
+ }
632
+ if (context === null || context === void 0 ? void 0 : context.newValue) {
633
+ text = this.replaceAll(text, '[newValue]', context.newValue);
634
+ }
635
+ if (context === null || context === void 0 ? void 0 : context.oldValue) {
636
+ text = this.replaceAll(text, '[oldValue]', context.oldValue);
637
+ }
638
+ if (context === null || context === void 0 ? void 0 : context.primaryKeyValue) {
639
+ text = this.replaceAll(text, '[primaryKeyValue]', context.primaryKeyValue);
640
+ }
641
+ if (context === null || context === void 0 ? void 0 : context.timestamp) {
642
+ text = this.replaceAll(text, '[timestamp]', context.timestamp + '');
643
+ }
644
+ if (context === null || context === void 0 ? void 0 : context.numberOfRows) {
645
+ text = this.replaceAll(text, '[numberOfRows]', context.numberOfRows + '');
646
+ }
647
+ if (context === null || context === void 0 ? void 0 : context.trigger) {
648
+ const dataChangeTriggerMap = {
649
+ edit: 'Edit',
650
+ tick: 'Tick',
651
+ undo: 'Undo',
652
+ aggChange: 'AggChange',
653
+ };
654
+ const rowChangeTriggerMap = {
655
+ Add: 'Added',
656
+ Edit: 'Edited',
657
+ Delete: 'Deleted',
658
+ Load: 'Loaded',
659
+ };
660
+ const mappedTrigger =
661
+ // @ts-ignore
662
+ (_a = (dataChangeTriggerMap[context.trigger] || rowChangeTriggerMap[context.trigger])) !== null && _a !== void 0 ? _a : context.trigger;
663
+ text = this.replaceAll(text, '[trigger]', mappedTrigger);
664
+ }
665
+ if ((context === null || context === void 0 ? void 0 : context.column) && (context === null || context === void 0 ? void 0 : context.rowNode)) {
666
+ text = this.replaceAll(text, '[column]', this.getGridApi().getRawValueFromRowNode(context.rowNode, context.column.columnId));
667
+ }
668
+ if (context === null || context === void 0 ? void 0 : context.rowNode) {
669
+ const columns = this.extractColsFromText(text);
670
+ for (const column of columns) {
671
+ if (this.getColumnApi().getColumnWithColumnId(column)) {
672
+ text = this.replaceAll(text, `[rowData.${column}]`, this.getGridApi().getRawValueFromRowNode(context.rowNode, column));
673
+ }
674
+ }
675
+ }
676
+ if (text.indexOf('[context') !== -1) {
677
+ const agGridContext = (_c = (_b = this.adaptable.agGridAdapter).getGridOption) === null || _c === void 0 ? void 0 : _c.call(_b, 'context');
678
+ const agGridContextKeys = this.extractContextKeysFromText(text);
679
+ for (const key of agGridContextKeys) {
680
+ if (agGridContext[key]) {
681
+ text = this.replaceAll(text, `[context.${key}]`, agGridContext[key]);
682
+ }
683
+ }
684
+ }
685
+ return text;
686
+ }
687
+ replaceAll(text, toReplace, replaceWith) {
688
+ if (!text) {
689
+ return text;
690
+ }
691
+ // fails for []
692
+ toReplace = toReplace.replace('[', '\\[').replace(']', '\\]');
693
+ return text.replace(new RegExp(toReplace, 'g'), replaceWith);
694
+ }
695
+ extractColsFromText(text) {
696
+ // rowData.columnName => columnName
697
+ const regex = /\[rowData\.(.*?)\]/g;
698
+ let m;
699
+ const cols = [];
700
+ while ((m = regex.exec(text)) !== null) {
701
+ cols.push(m[1]);
702
+ }
703
+ return cols;
704
+ }
705
+ extractContextKeysFromText(text) {
706
+ // context.columnName => columnName
707
+ const regex = /\[context\.(.*?)\]/g;
708
+ let m;
709
+ const contextKeys = [];
710
+ while ((m = regex.exec(text)) !== null) {
711
+ contextKeys.push(m[1]);
712
+ }
713
+ return contextKeys;
714
+ }
544
715
  }
@@ -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
  }
@@ -206,4 +206,24 @@ export class ColumnFilterInternalApi extends ApiBase {
206
206
  return maxFilterValues;
207
207
  }
208
208
  }
209
+ getValuesFitlerPredicateIds(column) {
210
+ var _a, _b;
211
+ const valuesFilterPredicateOptions = (_b = (_a = this.getOptions().columnFilterOptions) === null || _a === void 0 ? void 0 : _a.valuesFilterOptions) === null || _b === void 0 ? void 0 : _b.valuesFilterPredicateOptions;
212
+ const availablePredicates = this.getPredicateApi().getPredicateDefsByModuleScope('columnFilter');
213
+ let predicateIds = [];
214
+ if (typeof (valuesFilterPredicateOptions === null || valuesFilterPredicateOptions === void 0 ? void 0 : valuesFilterPredicateOptions.predicates) === 'function') {
215
+ const columnFilterContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { column: column });
216
+ predicateIds = valuesFilterPredicateOptions.predicates(columnFilterContext);
217
+ }
218
+ else if (Array.isArray(valuesFilterPredicateOptions === null || valuesFilterPredicateOptions === void 0 ? void 0 : valuesFilterPredicateOptions.predicates)) {
219
+ predicateIds = valuesFilterPredicateOptions.predicates;
220
+ }
221
+ return predicateIds.filter((predicateId) => {
222
+ const predicate = availablePredicates.find((p) => p.id === predicateId);
223
+ if (!predicate) {
224
+ return false;
225
+ }
226
+ return this.getColumnScopeApi().isColumnInScope(column, predicate.columnScope);
227
+ });
228
+ }
209
229
  }
@@ -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
  }
@@ -94,28 +94,42 @@ export class ExportInternalApi extends ApiBase {
94
94
  isVisualDataExportInProgress() {
95
95
  return this.getAdaptableState().System.Export.visualDataExportInProgress;
96
96
  }
97
- isDateCellExportedAsFormattedValue() {
97
+ isDateCellExportedAsFormattedValue(abColumn) {
98
98
  return (!!this.getExportOptions().exportDateFormat ||
99
- this.getCellExportFormatType('Date') === 'formattedValue');
99
+ this.getCellExportFormatType(abColumn, 'Date') === 'formattedValue');
100
100
  }
101
- getCellExportFormatType(columnDataType) {
101
+ getCellExportFormatType(column, columnDataType) {
102
102
  const exportOptions = this.getExportOptions();
103
- if (exportOptions.exportFormatType === 'rawValue' ||
104
- exportOptions.exportFormatType === 'formattedValue') {
105
- return exportOptions.exportFormatType;
103
+ const exportFormatType = exportOptions.exportFormatType;
104
+ // First check if a function was provided and return the result
105
+ if (exportFormatType != null && typeof exportFormatType === 'function') {
106
+ const context = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { column: column });
107
+ return exportFormatType(context);
106
108
  }
107
- // format is customized based on column data type
108
- switch (columnDataType) {
109
- case 'String':
110
- return exportOptions.exportFormatType.string;
111
- case 'Number':
112
- return exportOptions.exportFormatType.number;
113
- case 'Date':
114
- return exportOptions.exportFormatType.date;
115
- default:
116
- // default to rawValue for all other column types
117
- return 'rawValue';
109
+ // Next Check if a "hard-coded" value has been provided and return that
110
+ if (exportFormatType === 'rawValue') {
111
+ return 'rawValue';
118
112
  }
113
+ if (exportFormatType === 'formattedValue') {
114
+ return 'formattedValue';
115
+ }
116
+ // Finally test if a DataType object has been provided and return the relevant property
117
+ const dataFormatDataType = exportFormatType;
118
+ if (dataFormatDataType) {
119
+ // format is customized based on column data type
120
+ switch (columnDataType) {
121
+ case 'String':
122
+ return dataFormatDataType.string;
123
+ case 'Number':
124
+ return dataFormatDataType.number;
125
+ case 'Date':
126
+ return dataFormatDataType.date;
127
+ default:
128
+ // default to rawValue for all other column types
129
+ return 'rawValue';
130
+ }
131
+ }
132
+ return 'rawValue';
119
133
  }
120
134
  isDestinationEnabled(destination) {
121
135
  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,4 +1,5 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
+ import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
2
3
  export class ExpressionInternalApi extends ApiBase {
3
4
  /**
4
5
  * Checks if a column is referenced in a given Expression
@@ -45,4 +46,82 @@ export class ExpressionInternalApi extends ApiBase {
45
46
  }
46
47
  return !evaluateExpressionExternallyFn(context);
47
48
  }
49
+ // Used later, when we extend to support inferring fields from data
50
+ // private getFieldsFromData<T extends Record<string, any>>(data: T): string[] {
51
+ // if (!data) {
52
+ // return [];
53
+ // }
54
+ // if (typeof data !== 'object' || Number.isNaN(data)) {
55
+ // return [];
56
+ // }
57
+ // const keys: string[] = [];
58
+ // for (const key in Object.keys(data)) {
59
+ // const candidate = data[key];
60
+ // if (
61
+ // typeof candidate === 'number' ||
62
+ // typeof candidate === 'string' ||
63
+ // typeof candidate === 'boolean' ||
64
+ // candidate instanceof Date
65
+ // ) {
66
+ // keys.push(key);
67
+ // continue;
68
+ // }
69
+ // // no support for arrays
70
+ // // for objects we go one level deep
71
+ // if (typeof candidate === 'object' && candidate !== null && !Array.isArray(candidate)) {
72
+ // const childKeys = this.getFieldsFromData(candidate);
73
+ // for (const childKey of childKeys) {
74
+ // keys.push(`${key}.${childKey}`);
75
+ // }
76
+ // }
77
+ // }
78
+ // return keys;
79
+ // }
80
+ getFieldsFromOptions() {
81
+ const fields = this.adaptable.api.optionsApi.getExpressionOptions().fields;
82
+ if (fields != null && typeof fields === 'function') {
83
+ return fields(this.getAdaptableApi().internalApi.buildBaseContext());
84
+ }
85
+ else {
86
+ let arr = fields;
87
+ if (arr && ArrayExtensions.IsNotNullOrEmpty(arr)) {
88
+ return arr;
89
+ }
90
+ }
91
+ }
92
+ getAvailableFields(data) {
93
+ var _a, _b;
94
+ 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 })));
95
+ // const existingFields = new Set<string>();
96
+ // Exclude fields already in options
97
+ // optionFields.forEach((field) => existingFields.add(field.value));
98
+ // const queriableColumns = this.getColumnApi().getQueryableColumns();
99
+ // Exclude queriable columns
100
+ // queriableColumns.forEach((column) => existingFields.add(column.field));
101
+ // const dataFields = this.getFieldsFromData(data).reduce<AdaptableField[]>((acc, field) => {
102
+ // if (!existingFields.has(field)) {
103
+ // acc.push({
104
+ // label: field,
105
+ // value: field,
106
+ // });
107
+ // }
108
+ // return acc;
109
+ // }, []);
110
+ return optionFields;
111
+ }
112
+ getFieldType(field) {
113
+ var _a;
114
+ const fieldDef = (_a = this.getFieldsFromOptions()) === null || _a === void 0 ? void 0 : _a.find((f) => f.name === field);
115
+ if (fieldDef) {
116
+ return fieldDef.dataType;
117
+ }
118
+ return 'String';
119
+ }
120
+ getFieldsOfType(type) {
121
+ var _a, _b, _c;
122
+ if (!type) {
123
+ return (_a = this.getAvailableFields()) !== null && _a !== void 0 ? _a : [];
124
+ }
125
+ return (_c = (_b = this.getAvailableFields()) === null || _b === void 0 ? void 0 : _b.filter((f) => f.dataType === type)) !== null && _c !== void 0 ? _c : [];
126
+ }
48
127
  }
@@ -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;
@@ -1,17 +1,15 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
- import { StandardContextTypes, } from '../../PredefinedConfig/Common/Fdc3Context';
3
- import { ContextTypes } from '@finos/fdc3';
2
+ import { isStandardContextType, isStandardIntent, } from '@finos/fdc3';
4
3
  import { ColumnRefTypePrefix, FieldRefTypePrefix, } from '../../AdaptableOptions/Fdc3Options';
5
- import { Fdc3StandardIntents, } from '../../PredefinedConfig/Common/Fdc3Intent';
6
4
  import { AB_FDC3_COLUMN, AB_SPECIAL_COLUMN } from '../../Utilities/Constants/GeneralConstants';
7
5
  import { ActionColumnRenderer, ReactActionColumnRenderer } from '../../agGrid/ActionColumnRenderer';
8
6
  export class Fdc3InternalApi extends ApiBase {
9
7
  mapRowToContextData(contextType, rowNode) {
10
8
  var _a, _b, _c;
11
- if (contextType === ContextTypes.Nothing) {
12
- return { type: ContextTypes.Nothing };
9
+ if (contextType === 'fdc3.nothing') {
10
+ return { type: contextType };
13
11
  }
14
- const mappedContextData = this.mapRowValueToContextData(rowNode, this.isStandardContextType(contextType) && contextType !== ContextTypes.Nothing
12
+ const mappedContextData = this.mapRowValueToContextData(rowNode, this.isStandardContextType(contextType) && contextType !== 'fdc3.nothing'
15
13
  ? (_a = this.getFdc3Options().gridDataContextMapping) === null || _a === void 0 ? void 0 : _a[contextType]
16
14
  : (_c = (_b = this.getFdc3Options().gridDataContextMapping) === null || _b === void 0 ? void 0 : _b.custom) === null || _c === void 0 ? void 0 : _c[contextType]);
17
15
  const contextMappedFromGridData = Object.assign({ type: contextType }, mappedContextData);
@@ -154,12 +152,10 @@ export class Fdc3InternalApi extends ApiBase {
154
152
  }
155
153
  }
156
154
  isStandardContextType(contextType) {
157
- // @ts-ignore
158
- return StandardContextTypes.includes(contextType);
155
+ return isStandardContextType(contextType);
159
156
  }
160
157
  isStandardIntentType(intentType) {
161
- // @ts-ignore
162
- return Fdc3StandardIntents.includes(intentType);
158
+ return isStandardIntent(intentType);
163
159
  }
164
160
  getAllRaiseIntentConfigs() {
165
161
  var _a;