@adaptabletools/adaptable-cjs 18.0.11 → 18.1.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) 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/AdaptableOptions/ActionColumnOptions.d.ts +1 -1
  9. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +27 -1
  10. package/src/AdaptableOptions/ExportOptions.d.ts +20 -7
  11. package/src/AdaptableOptions/ExpressionOptions.d.ts +12 -2
  12. package/src/AdaptableOptions/Fdc3Options.d.ts +48 -43
  13. package/src/Api/ColumnApi.d.ts +1 -1
  14. package/src/Api/Events/Fdc3MessageInfo.d.ts +5 -7
  15. package/src/Api/ExpressionApi.d.ts +2 -2
  16. package/src/Api/Fdc3Api.d.ts +14 -19
  17. package/src/Api/Implementation/ConfigApiImpl.js +3 -0
  18. package/src/Api/Implementation/Fdc3ApiImpl.d.ts +14 -16
  19. package/src/Api/Implementation/Fdc3ApiImpl.js +35 -11
  20. package/src/Api/Internal/AlertInternalApi.d.ts +17 -2
  21. package/src/Api/Internal/AlertInternalApi.js +196 -25
  22. package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -0
  23. package/src/Api/Internal/ColumnFilterInternalApi.js +20 -0
  24. package/src/Api/Internal/ExportInternalApi.d.ts +3 -3
  25. package/src/Api/Internal/ExportInternalApi.js +31 -17
  26. package/src/Api/Internal/ExpressionInternalApi.d.ts +5 -1
  27. package/src/Api/Internal/ExpressionInternalApi.js +80 -0
  28. package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
  29. package/src/Api/Internal/Fdc3InternalApi.js +5 -9
  30. package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
  31. package/src/PredefinedConfig/Common/AdaptableField.js +2 -0
  32. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  33. package/src/PredefinedConfig/Common/AdaptablePredicate.js +18 -1
  34. package/src/PredefinedConfig/Common/Fdc3Context.d.ts +7 -226
  35. package/src/PredefinedConfig/Common/Fdc3Context.js +44 -32
  36. package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
  37. package/src/PredefinedConfig/Common/Fdc3Intent.js +27 -74
  38. package/src/PredefinedConfig/Common/RowSummary.d.ts +2 -1
  39. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  40. package/src/Redux/ActionsReducers/FormatColumnRedux.js +0 -3
  41. package/src/Strategy/AdaptableModuleBase.js +1 -3
  42. package/src/Strategy/AlertModule.d.ts +1 -1
  43. package/src/Strategy/AlertModule.js +8 -8
  44. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
  45. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +14 -13
  46. package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
  47. package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
  48. package/src/Utilities/Services/QueryLanguageService.js +105 -6
  49. package/src/Utilities/Services/ReportService.js +8 -5
  50. package/src/Utilities/Services/RowSummaryService.js +3 -1
  51. package/src/Utilities/divideBy100.d.ts +1 -0
  52. package/src/Utilities/divideBy100.js +34 -0
  53. package/src/Utilities/times100.d.ts +1 -0
  54. package/src/Utilities/times100.js +27 -0
  55. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
  56. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
  57. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
  58. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
  59. package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
  60. package/src/View/Components/EntityRulesEditor/index.js +11 -7
  61. package/src/View/Components/ExpressionWizard.js +1 -1
  62. package/src/View/Components/FilterForm/QuickFilterValues.js +28 -4
  63. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
  64. package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
  65. package/src/View/Components/Selectors/FieldSelector.js +26 -0
  66. package/src/View/Components/Selectors/PermittedValuesSelector.js +8 -4
  67. package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
  68. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
  69. package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
  70. package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
  71. package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
  72. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
  73. package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
  74. package/src/agGrid/AdaptableAgGrid.d.ts +1 -2
  75. package/src/agGrid/AdaptableAgGrid.js +65 -37
  76. package/src/agGrid/AgGridAdapter.d.ts +2 -0
  77. package/src/agGrid/AgGridAdapter.js +12 -2
  78. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
  79. package/src/agGrid/AgGridColumnAdapter.js +24 -1
  80. package/src/agGrid/AgGridMenuAdapter.js +1 -1
  81. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
  82. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
  83. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
  84. package/src/agGrid/editors/AdaptableDateEditor/index.js +6 -19
  85. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
  86. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
  87. package/src/agGrid/editors/AdaptableNumberEditor/index.js +6 -2
  88. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
  89. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +84 -0
  90. package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
  91. package/src/agGrid/editors/AdaptablePercentageEditor/index.js +153 -0
  92. package/src/agGrid/weightedAverage.js +3 -2
  93. package/src/components/Accordion.js +1 -1
  94. package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
  95. package/src/components/Datepicker/index.js +3 -4
  96. package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
  97. package/src/components/ExpressionEditor/DataTableEditor.js +68 -0
  98. package/src/components/ExpressionEditor/EditorInput.js +21 -8
  99. package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
  100. package/src/components/ExpressionEditor/NamedQueryEditor.js +35 -0
  101. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
  102. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
  103. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
  104. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +72 -14
  105. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +27 -19
  106. package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
  107. package/src/components/ExpressionEditor/QueryBuilder/utils.js +46 -4
  108. package/src/components/ExpressionEditor/index.d.ts +3 -1
  109. package/src/components/ExpressionEditor/index.js +67 -92
  110. package/src/components/Input/NumberInput.d.ts +2 -1
  111. package/src/components/Input/NumberInput.js +6 -5
  112. package/src/components/OverlayTrigger/index.js +10 -6
  113. package/src/components/icons/column-outline.d.ts +3 -0
  114. package/src/components/icons/column-outline.js +7 -0
  115. package/src/components/icons/index.js +5 -1
  116. package/src/components/icons/sync.d.ts +3 -0
  117. package/src/components/icons/sync.js +7 -0
  118. package/src/env.js +2 -2
  119. package/src/metamodel/adaptable.metamodel.d.ts +78 -200
  120. package/src/metamodel/adaptable.metamodel.js +1 -1
  121. package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
  122. package/src/parser/src/predicate/mapExpressionToQlPredicate.js +13 -3
  123. package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
  124. package/src/parser/src/types.d.ts +101 -1
  125. package/src/types.d.ts +9 -7
  126. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -32,6 +32,6 @@ const NamedQueryExpressionWizardSection = (props) => {
32
32
  const initialData = (0, react_1.useMemo)(() => api.internalApi.getQueryPreviewData(), []);
33
33
  return (React.createElement(ExpressionEditor_1.ExpressionEditor, { allowSaveNamedQuery: false, showQueryBuilder: true, type: 'boolean', module: moduleInfo.ModuleName, value: data.BooleanExpression, onChange: (BooleanExpression) => {
34
34
  props.onChange(Object.assign(Object.assign({}, data), { BooleanExpression }));
35
- }, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }));
35
+ }, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }));
36
36
  };
37
37
  exports.NamedQueryExpressionWizardSection = NamedQueryExpressionWizardSection;
@@ -75,7 +75,8 @@ const OnePageAdaptableWizard = (props) => {
75
75
  };
76
76
  exports.OnePageAdaptableWizard = OnePageAdaptableWizard;
77
77
  const OnePageWizardSummary = () => {
78
- const { setCurrentSection, sections, data } = (0, OnePageWizards_1.useOnePageWizardContext)();
78
+ const { sections, data, api } = useOnePageAdaptableWizardContext();
79
+ const { setCurrentSection } = (0, OnePageWizards_1.useOnePageWizardContext)();
79
80
  const renderEdit = (index) => (React.createElement(SimpleButton_1.default, { px: 1, variant: "text", style: {
80
81
  textDecoration: 'underline',
81
82
  display: 'inline-block',
@@ -96,7 +97,7 @@ const OnePageWizardSummary = () => {
96
97
  section.title,
97
98
  " ",
98
99
  renderEdit(index)),
99
- React.createElement(Tabs_1.Tabs.Content, null, section.renderSummary(data))));
100
+ React.createElement(Tabs_1.Tabs.Content, null, section.renderSummary(data, api))));
100
101
  })
101
102
  .filter(Boolean)));
102
103
  };
@@ -25,9 +25,8 @@ import { AgGridMenuAdapter } from './AgGridMenuAdapter';
25
25
  import { AdaptableColumn, AdaptableTheme, ChartDefinition, ColumnSort, DataUpdateConfig, GridCell, Layout, ReportData, SelectedCellInfo, SelectedRowInfo } from '../types';
26
26
  import { RenderReactRootFn } from '../renderReactRoot';
27
27
  import { AgGridOptionsService } from './AgGridOptionsService';
28
- import { AgGridColumnAdapter } from './AgGridColumnAdapter';
28
+ import { AdaptableVariant, AgGridColumnAdapter } from './AgGridColumnAdapter';
29
29
  import { RowEditService } from '../Utilities/Services/RowEditService';
30
- export type AdaptableVariant = 'vanilla' | 'react' | 'angular';
31
30
  export type AdaptableLifecycleState = 'initial' | 'preprocessOptions' | 'initAdaptableState' | 'setupAgGrid' | 'initAgGrid' | 'available' | 'ready' | 'preDestroyed';
32
31
  type RenderAgGridFrameworkComponentResult = false | GridApi;
33
32
  interface AdaptableInitInternalConfig<TData = any> {
@@ -69,8 +69,6 @@ const Fdc3Module_1 = require("../Strategy/Fdc3Module");
69
69
  const GridFilterModule_1 = require("../Strategy/GridFilterModule");
70
70
  const NamedQueryModule_1 = require("../Strategy/NamedQueryModule");
71
71
  const CommentModule_1 = require("../Strategy/CommentModule");
72
- const AdaptableNumberEditor_1 = require("./editors/AdaptableNumberEditor");
73
- const AdaptableDateEditor_1 = require("./editors/AdaptableDateEditor");
74
72
  const Helper_1 = require("../Utilities/Helpers/Helper");
75
73
  const uuid_1 = require("../components/utils/uuid");
76
74
  const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
@@ -93,7 +91,7 @@ const RowEditService_1 = require("../Utilities/Services/RowEditService");
93
91
  const weightedAverage_1 = require("./weightedAverage");
94
92
  const sortWithOrder_1 = require("../Utilities/sortWithOrder");
95
93
  const Enums_1 = require("../PredefinedConfig/Common/Enums");
96
- const ObjectFactory_1 = tslib_1.__importDefault(require("../Utilities/ObjectFactory"));
94
+ const ObjectFactory_1 = tslib_1.__importStar(require("../Utilities/ObjectFactory"));
97
95
  const EnvVars_1 = require("../EnvVars");
98
96
  const AdaptableUpgradeHelper_1 = require("../migration/AdaptableUpgradeHelper");
99
97
  const Modal_1 = require("../components/Modal");
@@ -402,9 +400,16 @@ class AdaptableAgGrid {
402
400
  }
403
401
  this.lifecycleState = 'ready';
404
402
  this.forPlugins((plugin) => plugin.onAdaptableReady(this, this.adaptableOptions));
405
- this.api.eventApi.emit('AdaptableReady', {
406
- adaptableApi: this.api,
407
- agGridApi: this.agGridAdapter.getAgGridApi(),
403
+ setTimeout(() => {
404
+ // without the setTimeout, calling autoSizeAllColumns immediately in the onAdaptableReady
405
+ // does not work. (I prefer setTimeout to rAF, as raf is not running when you switch tabs)
406
+ //
407
+ // it also makes it possible to listen to CALCULATED_COLUMN_READY, DASHBOARD_READY, etc.
408
+ // in onAdaptableReady - without this those event listeners are not triggered
409
+ this.api.eventApi.emit('AdaptableReady', {
410
+ adaptableApi: this.api,
411
+ agGridApi: this.agGridAdapter.getAgGridApi(),
412
+ });
408
413
  });
409
414
  perfInitAdaptableAgGrid.end();
410
415
  return Promise.resolve(this.api);
@@ -673,10 +678,15 @@ class AdaptableAgGrid {
673
678
  const columnFilters = this.api.columnFilterApi.getActiveColumnFilters();
674
679
  try {
675
680
  if (columnFilters.length > 0) {
681
+ const isRowFiltrable = this.api.optionsApi.getColumnFilterOptions().isRowFilterable;
676
682
  for (const columnFilter of columnFilters) {
677
683
  const evaluateFilterOnClient = this.api.expressionApi.internalApi.evaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, [columnFilter.Predicate]);
678
684
  if (evaluateFilterOnClient) {
679
685
  // we then assess filters (if running locally)
686
+ if (typeof isRowFiltrable === 'function' &&
687
+ !isRowFiltrable(Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(this.api)), { rowNode: node, data: node.data }))) {
688
+ return true;
689
+ }
680
690
  if (!this.api.columnFilterApi.internalApi.evaluateColumnFilter(columnFilter, node)) {
681
691
  return false;
682
692
  }
@@ -935,37 +945,46 @@ class AdaptableAgGrid {
935
945
  */
936
946
  // this will have to go/be heavily extended with https://github.com/AdaptableTools/adaptable/issues/2230
937
947
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'columnTypes', (original_columnTypes) => {
938
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
948
+ var _a;
939
949
  const providedColumnTypes = original_columnTypes || {};
940
950
  const gridOptionsColumnTypes = gridOptions.columnTypes || {};
941
- const patchedColumnTypes = Object.assign(providedColumnTypes, {
951
+ const patchedColumnTypes = Object.assign({}, providedColumnTypes, {
942
952
  [GeneralConstants_1.AB_SPECIAL_COLUMN]: {},
943
953
  [GeneralConstants_1.AB_FDC3_COLUMN]: {},
944
- abColDefNumber: (_a = gridOptionsColumnTypes.abColDefNumber) !== null && _a !== void 0 ? _a : {},
945
- abColDefString: (_b = gridOptionsColumnTypes.abColDefString) !== null && _b !== void 0 ? _b : {},
946
- abColDefBoolean: (_c = gridOptionsColumnTypes.abColDefBoolean) !== null && _c !== void 0 ? _c : {},
947
- abColDefDate: (_d = gridOptionsColumnTypes.abColDefDate) !== null && _d !== void 0 ? _d : {},
948
- abColDefObject: (_e = gridOptionsColumnTypes.abColDefObject) !== null && _e !== void 0 ? _e : {},
949
- abColDefCustom: (_f = gridOptionsColumnTypes.abColDefCustom) !== null && _f !== void 0 ? _f : {},
950
- abColDefStringArray: (_g = gridOptionsColumnTypes.abColDefStringArray) !== null && _g !== void 0 ? _g : {},
951
- abColDefNumberArray: (_h = gridOptionsColumnTypes.abColDefNumberArray) !== null && _h !== void 0 ? _h : {},
952
- abColDefTupleNumberArray: (_j = gridOptionsColumnTypes.abColDefTupleNumberArray) !== null && _j !== void 0 ? _j : {},
953
- abColDefObjectNumberArray: (_k = gridOptionsColumnTypes.abColDefObjectNumberArray) !== null && _k !== void 0 ? _k : {},
954
+ abColDefNumber: Object.assign({}, gridOptionsColumnTypes.abColDefNumber),
955
+ abColDefString: Object.assign({}, gridOptionsColumnTypes.abColDefString),
956
+ abColDefBoolean: Object.assign({}, gridOptionsColumnTypes.abColDefBoolean),
957
+ abColDefDate: Object.assign({}, gridOptionsColumnTypes.abColDefDate),
958
+ abColDefObject: Object.assign({}, gridOptionsColumnTypes.abColDefObject),
959
+ abColDefCustom: Object.assign({}, gridOptionsColumnTypes.abColDefCustom),
960
+ abColDefStringArray: Object.assign({}, gridOptionsColumnTypes.abColDefStringArray),
961
+ abColDefNumberArray: Object.assign({}, gridOptionsColumnTypes.abColDefNumberArray),
962
+ abColDefTupleNumberArray: Object.assign({}, gridOptionsColumnTypes.abColDefTupleNumberArray),
963
+ abColDefObjectNumberArray: Object.assign({}, gridOptionsColumnTypes.abColDefObjectNumberArray),
954
964
  });
955
- const customColumnTypes = (_l = this.api.columnApi.getColumnTypes()) !== null && _l !== void 0 ? _l : [];
965
+ const customColumnTypes = (_a = this.api.columnApi.getColumnTypes()) !== null && _a !== void 0 ? _a : [];
956
966
  for (const customColumnType of customColumnTypes) {
957
967
  if (!patchedColumnTypes[customColumnType]) {
958
968
  patchedColumnTypes[customColumnType] = {};
959
969
  }
960
970
  }
961
- if (patchedColumnTypes.abColDefNumber.cellEditor == undefined) {
962
- patchedColumnTypes.abColDefNumber.cellEditor =
963
- this.variant === 'react' ? AdaptableNumberEditor_1.ReactAdaptableNumberEditor : AdaptableNumberEditor_1.AdaptableNumberEditor;
964
- }
965
- if (patchedColumnTypes.abColDefDate.cellEditor == undefined) {
966
- patchedColumnTypes.abColDefDate.cellEditor =
967
- this.variant === 'react' ? AdaptableDateEditor_1.ReactAdaptableDateEditor : AdaptableDateEditor_1.AdaptableDateEditor;
968
- }
971
+ const colTypesToEditors = (0, AgGridColumnAdapter_1.getEditorsForColumnTypes)(this.variant);
972
+ // we used to patch here the column types
973
+ // and have the editors for abColDefNumber and abColDefDate set here
974
+ // but AG Grid seems to have a bug where if we have a custom editor
975
+ // for a specific number column, it's applied to all abColDefNumber columns, because they
976
+ // share the same column type
977
+ // so we're now doing this logic in AgGridColumnAdaptapter.setupColumnCellEditor
978
+ // and instead, here we're just assigning the editor to null
979
+ // because if we don't assign to null, the default that AG Grid provides
980
+ // will be used instead, and we don't want that for those column types
981
+ Object.keys(colTypesToEditors).forEach((colType) => {
982
+ if (patchedColumnTypes[colType].cellEditor == undefined) {
983
+ patchedColumnTypes[colType].cellEditor = null; // colTypesToEditors[colType];
984
+ // if you dont believe me, just put colTypesToEditors[colType] in the line above instead of the null value
985
+ // and see the editing/percentage-editor.spec.ts test fail as it wont be using the correct editor
986
+ }
987
+ });
969
988
  return patchedColumnTypes;
970
989
  });
971
990
  /**
@@ -1795,10 +1814,7 @@ class AdaptableAgGrid {
1795
1814
  if (!this.hasAutogeneratedPrimaryKey) {
1796
1815
  // support both AG Grid pre & post v31.3.x
1797
1816
  // TODO remove this with the next major Adaptable version
1798
- result =
1799
- typeof agGridApi.getCellValue === 'function'
1800
- ? agGridApi.getCellValue({ colKey: this.adaptableOptions.primaryKey, rowNode })
1801
- : agGridApi.getValue(this.adaptableOptions.primaryKey, rowNode);
1817
+ result = this.agGridAdapter._agGridApi_getValue(this.adaptableOptions.primaryKey, rowNode, agGridApi);
1802
1818
  }
1803
1819
  if (result == undefined && rowNode.data) {
1804
1820
  result = rowNode.data[this.adaptableOptions.primaryKey];
@@ -1809,7 +1825,7 @@ class AdaptableAgGrid {
1809
1825
  if (rowNode == null) {
1810
1826
  return undefined;
1811
1827
  }
1812
- return this.agGridAdapter.getAgGridApi().getValue(columnId, rowNode);
1828
+ return this.agGridAdapter._agGridApi_getValue(columnId, rowNode);
1813
1829
  }
1814
1830
  getDisplayValueFromRowNode(rowNode, columnId) {
1815
1831
  if (rowNode == null) {
@@ -2688,6 +2704,16 @@ class AdaptableAgGrid {
2688
2704
  return 'ag-theme-balham';
2689
2705
  }
2690
2706
  applyAdaptableTheme(theme) {
2707
+ const container = this.getAgGridContainerElement();
2708
+ if (container != null) {
2709
+ container.classList.add('ab-Grid');
2710
+ if (this.adaptableOptions.columnFilterOptions.indicateFilteredColumns) {
2711
+ container.classList.add('ab-Grid--indicate-filtered-columns');
2712
+ }
2713
+ }
2714
+ if (this._isDetailGrid) {
2715
+ return;
2716
+ }
2691
2717
  theme = this.ThemeService.mapOsTheme(theme);
2692
2718
  const themeName = typeof theme === 'string' ? theme : theme.Name;
2693
2719
  const isSystemTheme = this.api.themeApi.internalApi.isSystemTheme(themeName);
@@ -2742,7 +2768,6 @@ class AdaptableAgGrid {
2742
2768
  el.classList.add(`infinite-${variantTheme}`);
2743
2769
  }
2744
2770
  // AG THEME CLASS NAME
2745
- const container = this.getAgGridContainerElement();
2746
2771
  const getAgGridLightThemeName = () => this.getAgGridLightThemeName();
2747
2772
  const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
2748
2773
  if (newTheme && (isSystemTheme || variantTheme)) {
@@ -2776,10 +2801,6 @@ class AdaptableAgGrid {
2776
2801
  if (newTheme && newTheme.AgGridClassName) {
2777
2802
  container.classList.add(newTheme.AgGridClassName);
2778
2803
  }
2779
- container.classList.add('ab-Grid');
2780
- if (this.adaptableOptions.columnFilterOptions.indicateFilteredColumns) {
2781
- container.classList.add('ab-Grid--indicate-filtered-columns');
2782
- }
2783
2804
  }
2784
2805
  // MAC LIKE SCROLLBARS
2785
2806
  if (this.adaptableOptions.userInterfaceOptions &&
@@ -3949,12 +3970,19 @@ class AdaptableAgGrid {
3949
3970
  const gridOptionsService = agGridApi.gos;
3950
3971
  const self = this;
3951
3972
  gridOptionsService.updateGridOptions = function ({ options, force, source = 'api', }) {
3973
+ // `columnDefs`
3952
3974
  const passedColumnDefs = options.columnDefs;
3953
3975
  if (passedColumnDefs) {
3954
3976
  const colDefsWithSpecialColumns = self.getColumnDefinitionsInclSpecialColumns(passedColumnDefs);
3955
3977
  options['columnDefs'] = colDefsWithSpecialColumns;
3956
3978
  self.logger.info(`Added SpecialColumns on GridOptions.columnDefs update (source=${source})`);
3957
3979
  }
3980
+ // `context`
3981
+ const passedContext = options.context;
3982
+ if (passedContext) {
3983
+ passedContext['__adaptable'] = self;
3984
+ passedContext['adaptableApi'] = self.api;
3985
+ }
3958
3986
  // we mutated the options array, so it's OK to use the 'arguments' object
3959
3987
  GridOptionsService_updateGridOptions.apply(this, arguments);
3960
3988
  };
@@ -61,4 +61,6 @@ export declare class AgGridAdapter {
61
61
  */
62
62
  assignColumnIdsToColDefs(colDefs?: (ColDef | ColGroupDef)[]): void;
63
63
  getDefaultColumnDefinition(): GridOptions['defaultColDef'];
64
+ _agGridApi_getValue(colKey: string | Column, rowNode: IRowNode, gridApi?: GridApi): any;
64
65
  }
66
+ export declare const _agGridApi_getValue: (colKey: string | Column, rowNode: IRowNode, gridApi: GridApi) => any;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgGridAdapter = void 0;
3
+ exports._agGridApi_getValue = exports.AgGridAdapter = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("ag-grid-community");
6
6
  const GeneralConstants_1 = require("../Utilities/Constants/GeneralConstants");
@@ -346,7 +346,7 @@ class AgGridAdapter {
346
346
  }
347
347
  row = childNodes[0];
348
348
  }
349
- const value = this.getAgGridApi().getValue(column, row);
349
+ const value = this._agGridApi_getValue(column, row);
350
350
  if (value instanceof Date) {
351
351
  dataType = 'Date';
352
352
  }
@@ -590,5 +590,15 @@ class AgGridAdapter {
590
590
  // for early init phase, gridApi might not be ready yet
591
591
  return (_b = (_a = this.getAgGridApi(true)) === null || _a === void 0 ? void 0 : _a.getGridOption('defaultColDef')) !== null && _b !== void 0 ? _b : {};
592
592
  }
593
+ _agGridApi_getValue(colKey, rowNode, gridApi) {
594
+ return (0, exports._agGridApi_getValue)(colKey, rowNode, gridApi || this.getAgGridApi());
595
+ }
593
596
  }
594
597
  exports.AgGridAdapter = AgGridAdapter;
598
+ // FIXME remove this once we support only AG Grid >=30.3.x
599
+ const _agGridApi_getValue = (colKey, rowNode, gridApi) => {
600
+ return typeof gridApi.getCellValue === 'function'
601
+ ? gridApi.getCellValue({ colKey, rowNode })
602
+ : gridApi.getValue(colKey, rowNode);
603
+ };
604
+ exports._agGridApi_getValue = _agGridApi_getValue;
@@ -1,10 +1,13 @@
1
1
  import { AdaptableAgGrid } from './AdaptableAgGrid';
2
2
  import { ColumnSetupInfo } from './ColumnSetupInfo';
3
3
  import { ColDef, Column } from '@ag-grid-community/core';
4
+ export type AdaptableVariant = 'vanilla' | 'react' | 'angular';
5
+ export declare function getEditorsForColumnTypes(variant: AdaptableVariant): Record<string, ColDef['cellEditor']>;
4
6
  export declare class AgGridColumnAdapter {
5
7
  private adaptableInstance;
6
8
  private colDefPropertyCache;
7
9
  constructor(adaptableInstance: AdaptableAgGrid);
10
+ private getVariant;
8
11
  destroy(): void;
9
12
  private get adaptableApi();
10
13
  private get adaptableOptions();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgGridColumnAdapter = void 0;
3
+ exports.AgGridColumnAdapter = exports.getEditorsForColumnTypes = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("ag-grid-community");
6
6
  const merge_1 = tslib_1.__importDefault(require("lodash/merge"));
@@ -14,11 +14,23 @@ const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
14
14
  const PercentBarRenderer_1 = require("./PercentBarRenderer");
15
15
  const BadgeRenderer_1 = require("./BadgeRenderer");
16
16
  const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"));
17
+ const AdaptableNumberEditor_1 = require("./editors/AdaptableNumberEditor");
18
+ const AdaptableDateEditor_1 = require("./editors/AdaptableDateEditor");
19
+ function getEditorsForColumnTypes(variant) {
20
+ return {
21
+ abColDefNumber: variant === 'react' ? AdaptableNumberEditor_1.AdaptableReactNumberEditor : AdaptableNumberEditor_1.AdaptableNumberEditor,
22
+ abColDefDate: variant === 'react' ? AdaptableDateEditor_1.AdaptableReactDateEditor : AdaptableDateEditor_1.AdaptableDateEditor,
23
+ };
24
+ }
25
+ exports.getEditorsForColumnTypes = getEditorsForColumnTypes;
17
26
  class AgGridColumnAdapter {
18
27
  constructor(adaptableInstance) {
19
28
  this.adaptableInstance = adaptableInstance;
20
29
  this.colDefPropertyCache = new Map();
21
30
  }
31
+ getVariant() {
32
+ return this.adaptableInstance.variant;
33
+ }
22
34
  destroy() {
23
35
  this.adaptableInstance = null;
24
36
  this.colDefPropertyCache.clear();
@@ -183,6 +195,17 @@ class AgGridColumnAdapter {
183
195
  if (editLookUpItem) {
184
196
  return hasRichSelectCellEditor ? 'agRichSelectCellEditor' : 'agSelectCellEditor';
185
197
  }
198
+ else {
199
+ const colDef = col.getColDef();
200
+ if (colDef.cellEditor) {
201
+ return colDef.cellEditor;
202
+ }
203
+ const columnTypeToCellEditor = getEditorsForColumnTypes(this.getVariant());
204
+ return (adaptableColumn.columnTypes || []).reduce((cellEditor, colType) => {
205
+ var _a;
206
+ return (_a = columnTypeToCellEditor[colType]) !== null && _a !== void 0 ? _a : cellEditor;
207
+ }, undefined);
208
+ }
186
209
  });
187
210
  this.setColDefProperty(col, 'cellEditorPopup', () => {
188
211
  // as specified in https://www.ag-grid.com/react-data-grid/provided-cell-editors/#rich-select-cell-editor
@@ -320,7 +320,7 @@ class AgGridMenuAdapter {
320
320
  ...this.normalizeMenuGroup(editMenuItem),
321
321
  '-',
322
322
  ...this.normalizeMenuGroup(gridMenuItem),
323
- ...columnInfoMenuItems
323
+ ...columnInfoMenuItems,
324
324
  ], '-');
325
325
  }
326
326
  /**
@@ -8,6 +8,5 @@ export type InternalAdaptableDateEditorProps = {
8
8
  dateFormat: string;
9
9
  onValueChange?: (value: Date | null) => void;
10
10
  onStopEdit?: (keyboardEventKey?: string) => void;
11
- showClearButton?: boolean;
12
11
  };
13
12
  export declare const InternalAdaptableDateEditor: React.ForwardRefExoticComponent<InternalAdaptableDateEditorProps & React.RefAttributes<InternalAdaptableDateEditorApi>>;
@@ -26,7 +26,6 @@ const inputStyle = {
26
26
  border: 'none',
27
27
  };
28
28
  exports.InternalAdaptableDateEditor = React.forwardRef((props, ref) => {
29
- var _a;
30
29
  const inputRef = React.useRef(null);
31
30
  const focus = () => {
32
31
  var _a;
@@ -60,7 +59,6 @@ exports.InternalAdaptableDateEditor = React.forwardRef((props, ref) => {
60
59
  (_a = props.onStopEdit) === null || _a === void 0 ? void 0 : _a.call(props, keyboardEventKey);
61
60
  },
62
61
  onShow: () => { },
63
- showClearButton: (_a = props.showClearButton) !== null && _a !== void 0 ? _a : true,
64
62
  } },
65
63
  React.createElement(AdaptableInput_1.default, { type: 'date', value: stringValue, onChange: onChange, style: inputStyle, ref: inputRef }))));
66
64
  });
@@ -1,25 +1,13 @@
1
1
  import * as React from 'react';
2
2
  import { ICellEditorComp, ICellEditorParams } from '@ag-grid-community/core';
3
3
  import { IAdaptable } from '../../../AdaptableInterfaces/IAdaptable';
4
- export declare const ReactAdaptableDateEditor: React.ForwardRefExoticComponent<ICellEditorParams<any, any, any> & {
5
- showClearButton?: boolean;
6
- } & React.RefAttributes<unknown>>;
4
+ export interface AdaptableDateEditorParams extends ICellEditorParams {
5
+ onValueChange?: (value: any) => void;
6
+ }
7
+ export declare const AdaptableReactDateEditor: React.ForwardRefExoticComponent<AdaptableDateEditorParams & React.RefAttributes<unknown>>;
7
8
  /**
8
9
  * Used by default for all `abColDefDate` columns.
9
10
  *
10
- * You can configure it by specifying `cellEditorParams` in the colDef:
11
- *
12
- * colDef {
13
- * field: 'tradeDate',
14
- * type: 'abColDefDate',
15
- * cellEditorParams: {
16
- * showClearButton: true
17
- * }
18
- * }
19
- *
20
- * For now, there is just 1 editor param you can configure:
21
- *
22
- * cellEditorParams.showClearButton - defaults to `true` - whether to show the clear button.
23
11
  *
24
12
  * When the colDef has a `valueParser` provided as a function, it will be used before setting the value for the cell.
25
13
  * This is useful because dates can be stored as strings, numbers or Date instances - the value parser will be called with a `Date` instance,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdaptableDateEditor = exports.ReactAdaptableDateEditor = void 0;
3
+ exports.AdaptableDateEditor = exports.AdaptableReactDateEditor = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
@@ -27,8 +27,7 @@ const defaultDateValueParser = ({ newValue, oldValue, defaultParser }) => {
27
27
  }
28
28
  return newValue;
29
29
  };
30
- exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
31
- var _a;
30
+ exports.AdaptableReactDateEditor = (0, react_1.forwardRef)((props, ref) => {
32
31
  const [initialValue] = (0, react_1.useState)(() => getStartValue(props));
33
32
  const valueRef = (0, react_1.useRef)(initialValue);
34
33
  const colValueParser = props.column.getColDef().valueParser;
@@ -48,6 +47,7 @@ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
48
47
  };
49
48
  });
50
49
  const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: initialValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
50
+ var _a;
51
51
  const invalid = isNaN(+value);
52
52
  if (valueParser) {
53
53
  const params = Object.assign(Object.assign({}, props), { oldValue: props.value, newValue: value, defaultParser: (value) => {
@@ -62,6 +62,7 @@ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
62
62
  } });
63
63
  // @ts-ignore it will be fixed with https://github.com/AdaptableTools/adaptable/issues/2230
64
64
  valueRef.current = valueParser(params);
65
+ (_a = props.onValueChange) === null || _a === void 0 ? void 0 : _a.call(props, valueRef.current);
65
66
  }
66
67
  else {
67
68
  valueRef.current = invalid ? null : value;
@@ -71,7 +72,7 @@ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
71
72
  props.stopEditing();
72
73
  });
73
74
  }
74
- }, showClearButton: (_a = props.showClearButton) !== null && _a !== void 0 ? _a : true, onStopEdit: (keyboardEventKey) => {
75
+ }, onStopEdit: (keyboardEventKey) => {
75
76
  if (keyboardEventKey === 'Escape') {
76
77
  props.api.stopEditing(true);
77
78
  }
@@ -87,19 +88,6 @@ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
87
88
  /**
88
89
  * Used by default for all `abColDefDate` columns.
89
90
  *
90
- * You can configure it by specifying `cellEditorParams` in the colDef:
91
- *
92
- * colDef {
93
- * field: 'tradeDate',
94
- * type: 'abColDefDate',
95
- * cellEditorParams: {
96
- * showClearButton: true
97
- * }
98
- * }
99
- *
100
- * For now, there is just 1 editor param you can configure:
101
- *
102
- * cellEditorParams.showClearButton - defaults to `true` - whether to show the clear button.
103
91
  *
104
92
  * When the colDef has a `valueParser` provided as a function, it will be used before setting the value for the cell.
105
93
  * This is useful because dates can be stored as strings, numbers or Date instances - the value parser will be called with a `Date` instance,
@@ -144,7 +132,6 @@ class AdaptableDateEditor {
144
132
  }
145
133
  // after this component has been created and inserted into the grid
146
134
  afterGuiAttached() {
147
- var _a;
148
135
  const adaptable = this.getAdaptableInstance(this.params);
149
136
  const defaultValue = shouldClearExistingValue(this.params) ? '' : this.params.value;
150
137
  const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: defaultValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
@@ -171,7 +158,7 @@ class AdaptableDateEditor {
171
158
  this.params.stopEditing();
172
159
  });
173
160
  }
174
- }, showClearButton: (_a = this.params.showClearButton) !== null && _a !== void 0 ? _a : true, onStopEdit: (keyboardEventKey) => {
161
+ }, onStopEdit: (keyboardEventKey) => {
175
162
  if (keyboardEventKey === 'Escape') {
176
163
  this.params.api.stopEditing(true);
177
164
  }
@@ -38,6 +38,11 @@ exports.InternalAdaptableNumberEditor = React.forwardRef(function InternalAdapta
38
38
  (_a = props.onValueChange) === null || _a === void 0 ? void 0 : _a.call(props, value);
39
39
  },
40
40
  });
41
+ React.useEffect(() => {
42
+ // When the editor is opened by typing, the value is not set, even if the user
43
+ // dismisses the editing by pressing enter or clicking outside, this forces the value to be set.
44
+ setValue(props.defaultValue);
45
+ }, []);
41
46
  React.useImperativeHandle(ref, () => {
42
47
  return {
43
48
  focus,
@@ -50,7 +55,7 @@ exports.InternalAdaptableNumberEditor = React.forwardRef(function InternalAdapta
50
55
  e.stopPropagation();
51
56
  }
52
57
  } },
53
- React.createElement("input", { type: (_a = props.type) !== null && _a !== void 0 ? _a : 'number', value: value, onChange: React.useCallback((event) => {
58
+ React.createElement("input", { "data-name": "AdaptableNumberEditorInput", type: (_a = props.type) !== null && _a !== void 0 ? _a : 'number', value: value, onChange: React.useCallback((event) => {
54
59
  setValue(event.target.value);
55
60
  }, []), style: inputStyle, ref: inputRef }),
56
61
  showClear ? (React.createElement("div", { style: {
@@ -1,9 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { ICellEditorComp, ICellEditorParams } from '@ag-grid-community/core';
3
+ export declare function getStartValue(params: ICellEditorParams): any;
3
4
  /**
4
5
  * Adaptable number editor parameters extending the AG Grid {@link ICellEditorParams}.
5
6
  */
6
- interface AdaptableNumberCellEditorParams extends ICellEditorParams {
7
+ export interface AdaptableNumberCellEditorParams extends ICellEditorParams {
7
8
  /**
8
9
  * Whether to show the clear button. If `true`, it works together with `cellEditorParams.emptyValue`
9
10
  * @defaultValue true
@@ -14,8 +15,9 @@ interface AdaptableNumberCellEditorParams extends ICellEditorParams {
14
15
  * @defaultValue '' (empty string)
15
16
  */
16
17
  emptyValue: string;
18
+ onValueChange: (value: any) => void;
17
19
  }
18
- export declare const ReactAdaptableNumberEditor: React.ForwardRefExoticComponent<AdaptableNumberCellEditorParams & React.RefAttributes<unknown>>;
20
+ export declare const AdaptableReactNumberEditor: React.ForwardRefExoticComponent<AdaptableNumberCellEditorParams & React.RefAttributes<unknown>>;
19
21
  /**
20
22
  * Used by default for all `abColDefNumber` columns.
21
23
  *
@@ -54,4 +56,3 @@ export declare class AdaptableNumberEditor implements ICellEditorComp {
54
56
  destroy(): void;
55
57
  private onValueChange;
56
58
  }
57
- export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdaptableNumberEditor = exports.ReactAdaptableNumberEditor = void 0;
3
+ exports.AdaptableNumberEditor = exports.AdaptableReactNumberEditor = exports.getStartValue = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
@@ -24,6 +24,7 @@ function getStartValue(params) {
24
24
  }
25
25
  return params.value;
26
26
  }
27
+ exports.getStartValue = getStartValue;
27
28
  const defaultValueParser = ({ newValue, oldValue: _ }) => {
28
29
  return newValue;
29
30
  };
@@ -34,7 +35,7 @@ const style = {
34
35
  right: '0px',
35
36
  bottom: '0px',
36
37
  };
37
- exports.ReactAdaptableNumberEditor = (0, react_1.forwardRef)((props, ref) => {
38
+ exports.AdaptableReactNumberEditor = (0, react_1.forwardRef)((props, ref) => {
38
39
  var _a, _b;
39
40
  const [initialValue] = (0, react_1.useState)(() => getStartValue(props));
40
41
  const valueRef = (0, react_1.useRef)(initialValue);
@@ -43,10 +44,12 @@ exports.ReactAdaptableNumberEditor = (0, react_1.forwardRef)((props, ref) => {
43
44
  const colValueParser = props.column.getColDef().valueParser;
44
45
  const valueParser = typeof colValueParser === 'function' ? colValueParser : defaultValueParser;
45
46
  function onValueChange(value) {
47
+ var _a;
46
48
  value = valueParser
47
49
  ? valueParser(Object.assign(Object.assign({}, props), { oldValue: props.value, newValue: value }))
48
50
  : value;
49
51
  valueRef.current = value;
52
+ (_a = props.onValueChange) === null || _a === void 0 ? void 0 : _a.call(props, value);
50
53
  }
51
54
  const editorRef = (0, react_1.useRef)(null);
52
55
  (0, react_1.useImperativeHandle)(ref, () => {
@@ -77,6 +80,7 @@ exports.ReactAdaptableNumberEditor = (0, react_1.forwardRef)((props, ref) => {
77
80
  }
78
81
  return (React.createElement("div", { style: style, onKeyDown: onKeyDown }, (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable)));
79
82
  });
83
+ exports.AdaptableReactNumberEditor.displayName = 'AdaptableReactNumberEditor';
80
84
  /**
81
85
  * Used by default for all `abColDefNumber` columns.
82
86
  *
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ export type InternalAdaptablePercentageEditorApi = {
3
+ focus: VoidFunction;
4
+ setValue: (value: any) => void;
5
+ };
6
+ export type InternalAdaptablePercentageEditorProps = {
7
+ /**
8
+ * Value to set when the x (when showClear: true) is pressed
9
+ */
10
+ emptyValue?: string | number;
11
+ defaultValue?: string | number;
12
+ value?: string | number;
13
+ /**
14
+ * The input type. Defaults to 'number'
15
+ */
16
+ type?: string;
17
+ /**
18
+ * Whether to show the clear button. Defaults to false
19
+ */
20
+ showClearButton?: boolean;
21
+ onValueChange?: (value: string | number) => void;
22
+ };
23
+ export declare const InternalAdaptablePercentageEditor: React.ForwardRefExoticComponent<InternalAdaptablePercentageEditorProps & React.RefAttributes<InternalAdaptablePercentageEditorApi>>;