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

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 (263) hide show
  1. package/agGrid.d.ts +23 -1
  2. package/agGrid.js +23 -1
  3. package/base.css +1232 -733
  4. package/base.css.map +1 -0
  5. package/bundle.cjs.js +191 -174
  6. package/index.css +1250 -734
  7. package/index.css.map +1 -0
  8. package/package.json +5 -5
  9. package/publishTimestamp.d.ts +1 -1
  10. package/publishTimestamp.js +1 -1
  11. package/src/AdaptableInterfaces/IAdaptable.d.ts +7 -3
  12. package/src/AdaptableOptions/AdaptableOptions.d.ts +0 -2
  13. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +136 -27
  14. package/src/AdaptableOptions/ExportOptions.d.ts +2 -2
  15. package/src/AdaptableOptions/FinsemblePluginOptions.d.ts +32 -0
  16. package/src/AdaptableOptions/FinsemblePluginOptions.js +2 -0
  17. package/src/AdaptableOptions/LayoutOptions.d.ts +2 -1
  18. package/src/Api/AdaptableApi.d.ts +2 -0
  19. package/src/Api/ColumnApi.d.ts +8 -2
  20. package/src/Api/ConditionalStyleApi.d.ts +20 -42
  21. package/src/Api/ConfigApi.d.ts +1 -2
  22. package/src/Api/ExportApi.d.ts +6 -6
  23. package/src/Api/FinsembleApi.d.ts +10 -0
  24. package/src/Api/FinsembleApi.js +2 -0
  25. package/src/Api/FormatColumnApi.d.ts +76 -59
  26. package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
  27. package/src/Api/Implementation/AdaptableApiImpl.js +2 -0
  28. package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -1
  29. package/src/Api/Implementation/ColumnApiImpl.js +18 -14
  30. package/src/Api/Implementation/ExportApiImpl.d.ts +4 -4
  31. package/src/Api/Implementation/ExportApiImpl.js +14 -14
  32. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +36 -17
  33. package/src/Api/Implementation/FormatColumnApiImpl.js +101 -185
  34. package/src/Api/Implementation/PluginsApiImpl.d.ts +2 -0
  35. package/src/Api/Implementation/PluginsApiImpl.js +6 -0
  36. package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +2 -3
  37. package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -18
  38. package/src/Api/Implementation/ScopeApiImpl.d.ts +1 -1
  39. package/src/Api/Implementation/StyledColumnApiImpl.d.ts +25 -0
  40. package/src/Api/Implementation/StyledColumnApiImpl.js +193 -0
  41. package/src/Api/Implementation/SystemStatusApiImpl.js +1 -2
  42. package/src/Api/Implementation/ToolPanelApiImpl.d.ts +3 -1
  43. package/src/Api/Implementation/ToolPanelApiImpl.js +8 -0
  44. package/src/Api/PluginsApi.d.ts +5 -0
  45. package/src/Api/QueryLanguageApi.d.ts +3 -7
  46. package/src/Api/ScopeApi.d.ts +1 -1
  47. package/src/Api/StyledColumnApi.d.ts +106 -0
  48. package/src/Api/StyledColumnApi.js +2 -0
  49. package/src/Api/ToolPanelApi.d.ts +10 -1
  50. package/src/PredefinedConfig/AdaptableState.d.ts +2 -0
  51. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  52. package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +1 -1
  53. package/src/PredefinedConfig/Common/AdaptablePredicate.js +37 -37
  54. package/src/PredefinedConfig/Common/Types.d.ts +3 -3
  55. package/src/PredefinedConfig/Common/Types.js +1 -0
  56. package/src/PredefinedConfig/ConditionalStyleState.d.ts +10 -19
  57. package/src/PredefinedConfig/FormatColumnState.d.ts +21 -92
  58. package/src/PredefinedConfig/PredefinedConfig.d.ts +6 -0
  59. package/src/PredefinedConfig/StyledColumnState.d.ts +119 -0
  60. package/src/PredefinedConfig/StyledColumnState.js +2 -0
  61. package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +0 -18
  62. package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +0 -18
  63. package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +14 -0
  64. package/src/Redux/ActionsReducers/FormatColumnRedux.js +43 -1
  65. package/src/Redux/ActionsReducers/PluginsRedux.d.ts +4 -4
  66. package/src/Redux/ActionsReducers/PluginsRedux.js +5 -5
  67. package/src/Redux/ActionsReducers/StyledColumnRedux.d.ts +49 -0
  68. package/src/Redux/ActionsReducers/StyledColumnRedux.js +92 -0
  69. package/src/Redux/Store/AdaptableStore.js +9 -0
  70. package/src/Strategy/ConditionalStyleModule.d.ts +0 -2
  71. package/src/Strategy/ConditionalStyleModule.js +3 -27
  72. package/src/Strategy/DataChangeHistoryModule.d.ts +1 -0
  73. package/src/Strategy/DataChangeHistoryModule.js +12 -0
  74. package/src/Strategy/FormatColumnModule.d.ts +3 -10
  75. package/src/Strategy/FormatColumnModule.js +42 -183
  76. package/src/Strategy/Interface/IModule.d.ts +1 -0
  77. package/src/Strategy/StyledColumnModule.d.ts +24 -0
  78. package/src/Strategy/StyledColumnModule.js +165 -0
  79. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.d.ts +1 -1
  80. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.js +3 -4
  81. package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +1 -16
  82. package/src/Strategy/Utilities/getScopeViewItems.js +1 -1
  83. package/src/Utilities/Constants/ModuleConstants.d.ts +3 -0
  84. package/src/Utilities/Constants/ModuleConstants.js +4 -1
  85. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +6 -12
  86. package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -0
  87. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +3 -2
  88. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +3 -1
  89. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +1 -0
  90. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +3 -1
  91. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +1 -0
  92. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +3 -1
  93. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +2 -4
  94. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +3 -1
  95. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -0
  96. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +3 -1
  97. package/src/Utilities/Extensions/TypeExtensions.d.ts +1 -0
  98. package/src/Utilities/Extensions/TypeExtensions.js +5 -0
  99. package/src/Utilities/ObjectFactory.d.ts +5 -2
  100. package/src/Utilities/ObjectFactory.js +14 -7
  101. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +14 -4
  102. package/src/Utilities/Services/{LicenseService.d.ts → LicenseService/index.d.ts} +3 -3
  103. package/src/Utilities/Services/LicenseService/index.js +1 -0
  104. package/src/Utilities/Services/LicenseService/shouldLogThankYouMessage.d.ts +1 -0
  105. package/src/Utilities/Services/LicenseService/shouldLogThankYouMessage.js +15 -0
  106. package/src/Utilities/Services/ModuleService.js +2 -0
  107. package/src/Utilities/Services/QueryLanguageService.d.ts +3 -3
  108. package/src/Utilities/Services/QueryLanguageService.js +88 -39
  109. package/src/Utilities/Services/ReportService.js +6 -6
  110. package/src/Utilities/license/LicenseDetails.d.ts +1 -1
  111. package/src/Utilities/license/decode.d.ts +1 -0
  112. package/src/Utilities/license/decode.js +1 -1
  113. package/src/View/AdaptablePopover/index.js +1 -1
  114. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +9 -9
  115. package/src/View/Alert/Wizard/AlertDisplayWizardSection.js +6 -5
  116. package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.js +3 -3
  117. package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +3 -3
  118. package/src/View/BulkUpdate/BulkUpdatePopup.js +1 -1
  119. package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +1 -1
  120. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
  121. package/src/View/Components/AdaptableObjectRow/index.js +1 -6
  122. package/src/View/Components/Buttons/ButtonInfo.d.ts +1 -3
  123. package/src/View/Components/Buttons/ButtonInfo.js +3 -5
  124. package/src/View/Components/EntityRulesEditor/index.d.ts +2 -1
  125. package/src/View/Components/EntityRulesEditor/index.js +36 -35
  126. package/src/View/Components/FilterForm/FilterForm.js +11 -16
  127. package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
  128. package/src/View/Components/FilterForm/QuickFilterForm.js +7 -13
  129. package/src/View/Components/NewScopeComponent.js +3 -3
  130. package/src/View/Components/Panels/PanelWithButton.js +1 -5
  131. package/src/View/Components/Panels/PanelWithImage.js +1 -5
  132. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +2 -2
  133. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.d.ts +1 -0
  134. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +3 -16
  135. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +1 -0
  136. package/src/View/Components/Popups/AdaptablePopup/PopupPanel.js +1 -1
  137. package/src/View/Components/Popups/AdaptablePopupTeamSharing.js +5 -5
  138. package/src/View/Components/RangesComponent.d.ts +8 -1
  139. package/src/View/Components/RangesComponent.js +60 -24
  140. package/src/View/Components/ScopeComponent.js +6 -6
  141. package/src/View/Components/Selectors/ColumnSelector.d.ts +1 -0
  142. package/src/View/Components/Selectors/ColumnSelector.js +2 -1
  143. package/src/View/Components/Selectors/ColumnValueSelector.js +2 -2
  144. package/src/View/Components/StyleComponent.js +14 -19
  145. package/src/View/Components/ToolPanel/AdaptableToolPanel.d.ts +3 -9
  146. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +25 -10
  147. package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
  148. package/src/View/Components/ToolPanel/ToolPanelPopup.d.ts +1 -1
  149. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.d.ts +2 -0
  150. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.js +18 -0
  151. package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.js +3 -3
  152. package/src/View/ConditionalStyle/Wizard/ConditionalStyleSettingsWizardSettings.js +1 -1
  153. package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.js +1 -11
  154. package/src/View/DataSet/DataSetSelector.js +1 -1
  155. package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
  156. package/src/View/Export/ExportViewPanel.d.ts +1 -1
  157. package/src/View/Export/ExportViewPanel.js +4 -4
  158. package/src/View/Export/ReportExportDropdown.js +1 -1
  159. package/src/View/Export/Wizard/ReportNameWizardSection.js +10 -11
  160. package/src/View/Filter/FilterSummary.d.ts +1 -1
  161. package/src/View/Filter/FilterViewPanel.d.ts +1 -1
  162. package/src/View/FlashingCell/FlashingCellStyle.js +3 -3
  163. package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +3 -3
  164. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +6 -6
  165. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +4 -4
  166. package/src/View/FormatColumn/FormatColumnSummary.js +1 -1
  167. package/src/View/FormatColumn/MoveFormatColumn.d.ts +7 -0
  168. package/src/View/FormatColumn/MoveFormatColumn.js +27 -0
  169. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +28 -28
  170. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.d.ts +8 -0
  171. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +28 -0
  172. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +21 -3
  173. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +2 -28
  174. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +3 -3
  175. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +6 -300
  176. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +15 -9
  177. package/src/View/FormatColumn/Wizard/constants.d.ts +1 -0
  178. package/src/View/FormatColumn/Wizard/constants.js +4 -0
  179. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +7 -7
  180. package/src/View/Layout/LayoutRadioSelector.js +1 -1
  181. package/src/View/Layout/LayoutViewPanel.d.ts +1 -1
  182. package/src/View/Layout/Wizard/Components/ColumnLabels.js +1 -1
  183. package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
  184. package/src/View/Layout/Wizard/sections/ColumnsSection.js +7 -6
  185. package/src/View/Layout/Wizard/sections/SettingsSection.js +2 -2
  186. package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +1 -1
  187. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +3 -3
  188. package/src/View/Query/QueryViewPanel.d.ts +1 -1
  189. package/src/View/Query/Wizard/NamedQuerySettingsWizardSection.js +1 -1
  190. package/src/View/QuickSearch/QuickSearchPopup.js +2 -2
  191. package/src/View/QuickSearch/QuickSearchViewPanel.d.ts +1 -1
  192. package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +5 -5
  193. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsGlue42.js +1 -1
  194. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsIPushPull.js +5 -5
  195. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsOpenFin.js +1 -1
  196. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReminder.js +5 -5
  197. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +2 -2
  198. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +3 -3
  199. package/src/View/SmartEdit/SmartEditPopup.js +3 -3
  200. package/src/View/SpecialColumnSettingsWizardStep.js +10 -10
  201. package/src/View/StateManagement/StateManagementPopup.js +4 -4
  202. package/src/View/StyledColumn/Wizard/StyledColumnWizard.d.ts +7 -0
  203. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +77 -0
  204. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.d.ts +9 -0
  205. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +65 -0
  206. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.d.ts +9 -0
  207. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.js +234 -0
  208. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.d.ts +7 -0
  209. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +59 -0
  210. package/src/View/SystemStatus/SystemStatusEntityRow.js +4 -6
  211. package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +1 -1
  212. package/src/View/TeamSharing/SharedEntityObjectView.js +1 -1
  213. package/src/View/TeamSharing/TeamSharingApplyButton.js +1 -1
  214. package/src/View/Theme/ThemePopup.js +1 -1
  215. package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -1
  216. package/src/View/Wizard/OnePageAdaptableWizard.js +1 -2
  217. package/src/agGrid/ActionColumnRenderer.d.ts +3 -0
  218. package/src/agGrid/ActionColumnRenderer.js +96 -64
  219. package/src/agGrid/Adaptable.d.ts +13 -9
  220. package/src/agGrid/Adaptable.js +207 -221
  221. package/src/agGrid/CheckboxRenderer.js +1 -1
  222. package/src/agGrid/FilterWrapper.js +60 -16
  223. package/src/agGrid/FloatingFilterWrapper.d.ts +2 -2
  224. package/src/agGrid/FloatingFilterWrapper.js +71 -32
  225. package/src/agGrid/PercentBarRenderer.d.ts +6 -2
  226. package/src/agGrid/PercentBarRenderer.js +19 -17
  227. package/src/agGrid/agGridHelper.d.ts +6 -2
  228. package/src/agGrid/agGridHelper.js +16 -15
  229. package/src/agGrid/createAgStatusPanelComponent.d.ts +1 -1
  230. package/src/agGrid/createAgStatusPanelComponent.js +17 -0
  231. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +5 -1
  232. package/src/agGrid/editors/AdaptableDateEditor/index.js +87 -20
  233. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +1 -1
  234. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +3 -3
  235. package/src/agGrid/editors/AdaptableNumberEditor/index.js +81 -30
  236. package/src/agGrid/weightedAverage.js +19 -11
  237. package/src/components/CheckBox/index.js +7 -2
  238. package/src/components/Datepicker/index.d.ts +1 -1
  239. package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -1
  240. package/src/components/ExpressionEditor/BaseEditorInput.js +13 -32
  241. package/src/components/ExpressionEditor/EditorInput.js +1 -1
  242. package/src/components/ExpressionEditor/EditorInputWithWhereClause.js +1 -1
  243. package/src/components/ExpressionEditor/index.js +9 -17
  244. package/src/components/FormLayout/index.js +1 -1
  245. package/src/components/StylePreview.js +2 -1
  246. package/src/components/icons/brush.d.ts +3 -0
  247. package/src/components/icons/brush.js +7 -0
  248. package/src/components/icons/index.js +2 -0
  249. package/src/metamodel/adaptable.metamodel.d.ts +191 -95
  250. package/src/metamodel/adaptable.metamodel.js +1 -1
  251. package/src/parser/src/types.d.ts +6 -3
  252. package/src/renderReactRoot.d.ts +2 -0
  253. package/src/renderReactRoot.js +11 -9
  254. package/src/types.d.ts +8 -4
  255. package/themes/dark.css +8 -4
  256. package/themes/dark.css.map +1 -0
  257. package/themes/light.css +4 -1
  258. package/themes/light.css.map +1 -0
  259. package/version.d.ts +1 -1
  260. package/version.js +1 -1
  261. package/src/AdaptableComponents.d.ts +0 -1
  262. package/src/AdaptableComponents.js +0 -5
  263. package/src/Utilities/Services/LicenseService.js +0 -1
@@ -30,7 +30,7 @@ const getCheckboxRendererForColumn = (columnId, isColumnReadOnly, api) => {
30
30
  CheckboxRenderer.prototype.checkedHandler = function (e) {
31
31
  let checked = e.target.checked;
32
32
  this.params.node.setDataValue(columnId, checked);
33
- api.formatColumnApi.fireCheckboxColumnClickedEvent(columnId, this.params.node.data, api.gridApi.getPrimaryKeyValueForRowNode(this.params.node), checked);
33
+ api.styledColumnApi.fireCheckboxColumnClickedEvent(columnId, this.params.node.data, api.gridApi.getPrimaryKeyValueForRowNode(this.params.node), checked);
34
34
  };
35
35
  CheckboxRenderer.prototype.suppressEditEvent = function (event) {
36
36
  if (event.target === this.eGui) {
@@ -1,26 +1,72 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FilterWrapperFactory = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const react_1 = require("react");
4
7
  const FilterForm_1 = require("../View/Components/FilterForm/FilterForm");
5
8
  let FilterWrapperFactory = (adaptable) => {
9
+ function isFilterActive(colId) {
10
+ // we need this here
11
+ if (adaptable.isDestroyed) {
12
+ return false;
13
+ }
14
+ //make the small filter icon to appear when there is a filter
15
+ return adaptable.api.filterApi.getColumnFilters().findIndex((x) => x.ColumnId == colId) > -1;
16
+ }
17
+ function getFilterContext(colId, hidePopup) {
18
+ let column = adaptable.api.columnApi.getColumnFromId(colId);
19
+ let filterContext = {
20
+ Column: column,
21
+ Adaptable: adaptable,
22
+ ShowCloseButton: hidePopup,
23
+ };
24
+ return filterContext;
25
+ }
26
+ function getContainerId(colId) {
27
+ return 'filter_' + colId + '_' + adaptable.adaptableOptions.adaptableId;
28
+ }
29
+ if (adaptable.variant === 'react') {
30
+ return (0, react_1.forwardRef)(function ReactFilterWrapper(props, ref) {
31
+ const [filterContext, setFilterContext] = (0, react_1.useState)(null);
32
+ const colId = props.column.getId();
33
+ const column = adaptable.api.columnApi.getColumnFromId(colId);
34
+ (0, react_1.useImperativeHandle)(ref, () => {
35
+ return {
36
+ isFilterActive: () => isFilterActive(colId),
37
+ afterGuiAttached: (params) => {
38
+ var _a;
39
+ const hidePopup = (_a = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _a !== void 0 ? _a : null;
40
+ const filterContext = getFilterContext(colId, !!hidePopup);
41
+ adaptable.hideFilterFormPopup = hidePopup;
42
+ setFilterContext(filterContext);
43
+ },
44
+ getModel: () => { },
45
+ setModel: () => { },
46
+ //we do not filter here.... we filter using the doesExternalFilterPass. Not sure there is a difference....
47
+ doesFilterPass: () => true,
48
+ };
49
+ });
50
+ if (!column || !filterContext) {
51
+ return null;
52
+ }
53
+ return React.createElement("div", { id: getContainerId(colId) }, (0, FilterForm_1.FilterFormReact)(filterContext));
54
+ });
55
+ }
6
56
  return class FilterWrapper {
7
57
  init(params) {
8
58
  this.params = params;
9
59
  this.column = params.column;
10
60
  this.filterContainer = document.createElement('div');
11
- this.filterContainer.id =
12
- 'filter_' + this.params.column.getColId() + '_' + adaptable.adaptableOptions.adaptableId;
13
- }
14
- isFilterActive() {
15
- //make the small filter icon to appear when there is a filter
16
- return (adaptable.api.filterApi
17
- .getColumnFilters()
18
- .findIndex((x) => x.ColumnId == this.params.column.getColId()) > -1);
61
+ this.filterContainer.id = getContainerId(this.params.column.getColId());
19
62
  }
20
63
  doesFilterPass(params) {
21
64
  //we do not filter here.... we filter using the doesExternalFilterPass. Not sure there is a difference....
22
65
  return true;
23
66
  }
67
+ isFilterActive() {
68
+ return isFilterActive(this.params.column.getColId());
69
+ }
24
70
  getModel() {
25
71
  //
26
72
  }
@@ -31,22 +77,20 @@ let FilterWrapperFactory = (adaptable) => {
31
77
  return this.filterContainer;
32
78
  }
33
79
  afterGuiAttached(params) {
34
- var _a;
80
+ var _a, _b;
35
81
  //we always unmount first so the autofocus from the form works... in other grids we unmount when hidden
36
82
  (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
37
83
  let column = adaptable.api.columnApi.getColumnFromId(this.column.getColId());
38
84
  if (column) {
39
- let filterContext = {
40
- Column: column,
41
- Adaptable: adaptable,
42
- ShowCloseButton: params != null && params.hidePopup != null,
43
- };
44
- adaptable.hideFilterFormPopup = params ? params.hidePopup : null;
85
+ const hidePopup = (_b = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _b !== void 0 ? _b : null;
86
+ const filterContext = getFilterContext(this.column.getColId(), !!hidePopup);
87
+ adaptable.hideFilterFormPopup = hidePopup;
45
88
  this.unmountReactRoot = adaptable.renderReactRoot((0, FilterForm_1.FilterFormReact)(filterContext), this.filterContainer);
46
89
  }
47
90
  }
48
91
  destroy() {
49
- this.unmountReactRoot();
92
+ var _a;
93
+ (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
50
94
  this.filterContainer = null;
51
95
  }
52
96
  };
@@ -1,2 +1,2 @@
1
- import { Adaptable } from './Adaptable';
2
- export declare const FloatingFilterWrapperFactory: (adaptable: Adaptable) => any;
1
+ import { IAdaptable } from '../AdaptableInterfaces/IAdaptable';
2
+ export declare const FloatingFilterWrapperFactory: (adaptable: IAdaptable) => any;
@@ -1,43 +1,82 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FloatingFilterWrapperFactory = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const react_1 = require("react");
4
7
  const QuickFilterForm_1 = require("../View/Components/FilterForm/QuickFilterForm");
5
- const FloatingFilterWrapperFactory = (adaptable) => class FloatingFilterWrapper {
6
- onParentModelChanged(parentModel, filterChangedEvent) {
7
- // todo?
8
- }
9
- afterGuiAttached(params) {
10
- // todo: consider theme
11
- this.filterContainer.parentElement.style.overflow = 'visible';
12
- this.filterContainer.parentElement.parentElement.style.padding = 'var(--ab-space-1)';
8
+ const filterContainerStyle = {
9
+ overflow: 'hidden',
10
+ minWidth: '0',
11
+ height: '100%',
12
+ display: 'flex',
13
+ alignItems: 'stretch',
14
+ position: 'relative',
15
+ };
16
+ const FloatingFilterWrapperFactory = (adaptable) => {
17
+ function getContainerId(colId) {
18
+ return `floatingFilter_${colId}_${adaptable.adaptableOptions.adaptableId}`;
13
19
  }
14
- init(params) {
15
- const colId = params.column.getColId();
16
- this.filterContainer = document.createElement('div');
17
- this.filterContainer.id = `floatingFilter_${colId}_${adaptable.adaptableOptions.adaptableId}`;
18
- this.filterContainer.style.overflow = 'hidden';
19
- this.filterContainer.style.minWidth = '0';
20
- this.filterContainer.style.height = '100%';
21
- this.filterContainer.style.display = 'flex';
22
- this.filterContainer.style.alignItems = 'stretch';
23
- this.filterContainer.style.position = 'relative';
20
+ function getFilterContext(colId) {
24
21
  const column = adaptable.api.columnApi.getColumnFromId(colId);
25
- if (column) {
26
- const filterContext = {
27
- Column: column,
28
- Adaptable: adaptable,
29
- ShowCloseButton: false,
30
- };
31
- this.unmountReactRoot = adaptable.renderReactRoot((0, QuickFilterForm_1.QuickFilterFormReact)(filterContext), this.filterContainer);
32
- }
22
+ const filterContext = {
23
+ Column: column,
24
+ Adaptable: adaptable,
25
+ ShowCloseButton: false,
26
+ };
27
+ return filterContext;
33
28
  }
34
- getGui() {
35
- return this.filterContainer;
29
+ function patchParentElement(filterContainer) {
30
+ if (filterContainer) {
31
+ // todo: consider theme
32
+ filterContainer.parentElement.style.overflow = 'visible';
33
+ filterContainer.parentElement.parentElement.style.padding = 'var(--ab-space-1)';
34
+ }
36
35
  }
37
- destroy() {
38
- var _a;
39
- (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
40
- this.filterContainer = null;
36
+ if (adaptable.variant === 'react') {
37
+ return (0, react_1.forwardRef)(function ReactFloatingFilterWrapper(props, ref) {
38
+ const colId = props.column.getId();
39
+ const column = adaptable.api.columnApi.getColumnFromId(colId);
40
+ (0, react_1.useImperativeHandle)(ref, () => {
41
+ return {
42
+ onParentModelChanged() { },
43
+ };
44
+ });
45
+ if (!column) {
46
+ return null;
47
+ }
48
+ return (React.createElement("div", { ref: patchParentElement, id: getContainerId(colId), style: filterContainerStyle }, (0, QuickFilterForm_1.QuickFilterFormReact)(getFilterContext(colId))));
49
+ });
41
50
  }
51
+ return class FloatingFilterWrapper {
52
+ onParentModelChanged(parentModel, filterChangedEvent) {
53
+ // todo?
54
+ }
55
+ afterGuiAttached() {
56
+ patchParentElement(this.filterContainer);
57
+ }
58
+ init(params) {
59
+ const colId = params.column.getColId();
60
+ this.filterContainer = document.createElement('div');
61
+ this.filterContainer.id = getContainerId(colId);
62
+ Object.keys(filterContainerStyle).forEach((key) => {
63
+ //@ts-ignore
64
+ this.filterContainer.style[key] = filterContainerStyle[key];
65
+ });
66
+ const column = adaptable.api.columnApi.getColumnFromId(colId);
67
+ if (column) {
68
+ const filterContext = getFilterContext(colId);
69
+ this.unmountReactRoot = adaptable.renderReactRoot((0, QuickFilterForm_1.QuickFilterFormReact)(filterContext), this.filterContainer);
70
+ }
71
+ }
72
+ getGui() {
73
+ return this.filterContainer;
74
+ }
75
+ destroy() {
76
+ var _a;
77
+ (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
78
+ this.filterContainer = null;
79
+ }
80
+ };
42
81
  };
43
82
  exports.FloatingFilterWrapperFactory = FloatingFilterWrapperFactory;
@@ -1,4 +1,8 @@
1
- import { FormatColumn } from '../PredefinedConfig/FormatColumnState';
1
+ import { GradientStyle, PercentBarStyle } from '../PredefinedConfig/StyledColumnState';
2
2
  import { AdaptableApi } from '../Api/AdaptableApi';
3
3
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
4
- export declare const getPercentBarRendererForColumn: (formatColumn: FormatColumn, abColumn: AdaptableColumn, api: AdaptableApi) => any;
4
+ export declare const getPercentBarRendererForColumn: (columnStyle: {
5
+ GradientStyle?: GradientStyle;
6
+ PercentBarStyle?: PercentBarStyle;
7
+ CheckBoxStyle?: boolean;
8
+ }, abColumn: AdaptableColumn, api: AdaptableApi) => any;
@@ -4,19 +4,15 @@ exports.getPercentBarRendererForColumn = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"));
6
6
  const clamp_1 = tslib_1.__importDefault(require("lodash/clamp"));
7
- const FormatHelper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/FormatHelper"));
8
- const getPercentBarRendererForColumn = (formatColumn, abColumn, api) => {
9
- var _a;
10
- if (!((_a = formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.ColumnStyle) === null || _a === void 0 ? void 0 : _a.PercentBarStyle)) {
7
+ const FormatHelper_1 = require("../Utilities/Helpers/FormatHelper");
8
+ const getPercentBarRendererForColumn = (columnStyle, abColumn, api) => {
9
+ if (!columnStyle.PercentBarStyle) {
11
10
  return;
12
11
  }
13
12
  return class PercentBarRenderer {
14
13
  init(params) {
15
- if (!formatColumn.IncludeGroupedRows && api.gridApi.isGroupRowNode(params.node)) {
16
- return;
17
- }
18
- const min = api.formatColumnApi.getNumericStyleMinValue(formatColumn.ColumnStyle, abColumn, params.node, params.value);
19
- const max = api.formatColumnApi.getNumericStyleMaxValue(formatColumn.ColumnStyle, abColumn, params.node, params.value);
14
+ const min = api.styledColumnApi.getNumericStyleMinValue(columnStyle, abColumn, params.node, params.value);
15
+ const max = api.styledColumnApi.getNumericStyleMaxValue(columnStyle, abColumn, params.node, params.value);
20
16
  let value = params.value;
21
17
  if (Helper_1.default.objectNotExists(value)) {
22
18
  value = 0;
@@ -24,12 +20,16 @@ const getPercentBarRendererForColumn = (formatColumn, abColumn, api) => {
24
20
  const clampedValue = (0, clamp_1.default)(value, min, max);
25
21
  const percentageValue = ((clampedValue - min) / (max - min)) * 100;
26
22
  let cellBackColor;
27
- const percentBarStyle = formatColumn.ColumnStyle.PercentBarStyle;
23
+ const percentBarStyle = columnStyle.PercentBarStyle;
28
24
  if (percentBarStyle.ColumnComparison) {
29
25
  cellBackColor = percentBarStyle.ColumnComparison.Color;
30
26
  }
31
27
  else {
32
- const matchingRange = percentBarStyle.CellRanges.find((r) => r.Min <= clampedValue && r.Max >= clampedValue);
28
+ const matchingRange = percentBarStyle.CellRanges.find((r) => {
29
+ const rMin = r.Min === 'Col-Min' ? min : r.Min;
30
+ const rMax = r.Max === 'Col-Max' ? max : r.Max;
31
+ return rMin <= clampedValue && rMax >= clampedValue;
32
+ });
33
33
  if (matchingRange) {
34
34
  cellBackColor = matchingRange.Color;
35
35
  }
@@ -57,12 +57,14 @@ const getPercentBarRendererForColumn = (formatColumn, abColumn, api) => {
57
57
  textEl.className = 'ab-PercentBar__text';
58
58
  textEl.style.lineHeight = '1.2';
59
59
  if (percentBarStyle.CellText.includes('CellValue')) {
60
- if (formatColumn.DisplayFormat) {
61
- const options = formatColumn.DisplayFormat
62
- .Options;
63
- if (options) {
64
- value = FormatHelper_1.default.NumberFormatter(params.value, options);
65
- }
60
+ const activeFormatColumnsWithDisplayFormat = api.formatColumnApi.getFormatColumnsWithDisplayFormatForColumn(abColumn);
61
+ const [formatColumn] = api.formatColumnApi.getFormatColumnsRelevantForColumn(activeFormatColumnsWithDisplayFormat, abColumn, { node: params.node, value });
62
+ if (formatColumn && api.scopeApi.isColumnInNumericScope(abColumn, formatColumn.Scope)) {
63
+ const options = formatColumn.DisplayFormat.Options;
64
+ value = api.formatColumnApi.getNumberFormattedValue(params.value, params.node, abColumn, options);
65
+ }
66
+ else {
67
+ value = (0, FormatHelper_1.NumberFormatter)(value, { FractionDigits: 2 });
66
68
  }
67
69
  textEl.innerText = value;
68
70
  }
@@ -5,7 +5,7 @@ import { AdaptableNodeComparerFunction } from '../PredefinedConfig/Common/Adapta
5
5
  import { AdaptableColumnType, AdaptableModule } from '../PredefinedConfig/Common/Types';
6
6
  import { IModule } from '../Strategy/Interface/IModule';
7
7
  import { IPPStyle } from '../Utilities/Interface/IPPStyle';
8
- import { FormatColumn } from '../PredefinedConfig/FormatColumnState';
8
+ import { GradientStyle, PercentBarStyle } from '../PredefinedConfig/StyledColumnState';
9
9
  /**
10
10
  * Adaptable AG Grid implementation is getting really big and unwieldy
11
11
  * So lets put some of the more obvious 'Helper' functions here
@@ -22,7 +22,11 @@ export declare class agGridHelper {
22
22
  setUpModules(): Map<AdaptableModule, IModule>;
23
23
  TrySetUpNodeIds(hasAutogeneratedPrimaryKey: boolean): boolean;
24
24
  createCheckboxRendererComp(columnId: string, isColumnReadOnly: boolean): ICellRendererFunc | undefined;
25
- createPercentBarRendererComp(formatColumn: FormatColumn, abColumn: AdaptableColumn): ICellRendererFunc;
25
+ createPercentBarRendererComp(columnStyle: {
26
+ GradientStyle?: GradientStyle;
27
+ PercentBarStyle?: PercentBarStyle;
28
+ CheckBoxStyle?: boolean;
29
+ }, abColumn: AdaptableColumn): ICellRendererFunc;
26
30
  getCleanValue(value: string): string | undefined;
27
31
  getRenderedValue(colDef: ColDef, valueToRender: any): any;
28
32
  createAdaptableColumnFromAgGridColumn(agGridColumn: Column, colsToGroups: Record<string, AdaptableColumnGroup>): AdaptableColumn;
@@ -43,6 +43,7 @@ const StatusBarModule_1 = require("../Strategy/StatusBarModule");
43
43
  const GeneralConstants = tslib_1.__importStar(require("../Utilities/Constants/GeneralConstants"));
44
44
  const GeneralConstants_1 = require("../Utilities/Constants/GeneralConstants");
45
45
  const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
46
+ const StyledColumnModule_1 = require("../Strategy/StyledColumnModule");
46
47
  const tinycolor = require('tinycolor2');
47
48
  /**
48
49
  * Adaptable AG Grid implementation is getting really big and unwieldy
@@ -104,6 +105,7 @@ class agGridHelper {
104
105
  modules.set(ModuleConstants.SettingsPanelModuleId, new SettingsPanelModule_1.SettingsPanelModule(api));
105
106
  modules.set(ModuleConstants.StatusBarModuleId, new StatusBarModule_1.StatusBarModule(api));
106
107
  modules.set(ModuleConstants.ChartingModuleId, new ChartingModule_1.ChartingModule(api));
108
+ modules.set(ModuleConstants.StyledColumnModuleId, new StyledColumnModule_1.StyledColumnModule(api));
107
109
  return modules;
108
110
  }
109
111
  TrySetUpNodeIds(hasAutogeneratedPrimaryKey) {
@@ -150,8 +152,8 @@ class agGridHelper {
150
152
  createCheckboxRendererComp(columnId, isColumnReadOnly) {
151
153
  return (0, CheckboxRenderer_1.getCheckboxRendererForColumn)(columnId, isColumnReadOnly, this.adaptable.api);
152
154
  }
153
- createPercentBarRendererComp(formatColumn, abColumn) {
154
- return (0, PercentBarRenderer_1.getPercentBarRendererForColumn)(formatColumn, abColumn, this.adaptable.api);
155
+ createPercentBarRendererComp(columnStyle, abColumn) {
156
+ return (0, PercentBarRenderer_1.getPercentBarRendererForColumn)(columnStyle, abColumn, this.adaptable.api);
155
157
  }
156
158
  getCleanValue(value) {
157
159
  if (value == null || value == 'null' || value == undefined || value == 'undefined') {
@@ -174,7 +176,7 @@ class agGridHelper {
174
176
  const customFriendlyName = typeof columnFriendlyName === 'function'
175
177
  ? columnFriendlyName({ colId: colId, agColumn: agGridColumn })
176
178
  : null;
177
- const FriendlyName = customFriendlyName !== null && customFriendlyName !== void 0 ? customFriendlyName : (isActionRowButtonColumn
179
+ const friendlyName = customFriendlyName !== null && customFriendlyName !== void 0 ? customFriendlyName : (isActionRowButtonColumn
178
180
  ? GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME
179
181
  : this.gridOptions.columnApi.getDisplayNameForColumn(agGridColumn, 'header'));
180
182
  if (!this.initialAgGridColDefs[colId]) {
@@ -183,13 +185,14 @@ class agGridHelper {
183
185
  const ColumnId = colId;
184
186
  const pkColumn = this.adaptable.adaptableOptions.primaryKey;
185
187
  let ColumnGroup = colsToGroups === null || colsToGroups === void 0 ? void 0 : colsToGroups[ColumnId];
188
+ const dataType = this.getColumnDataType(agGridColumn, false);
186
189
  const abColumn = {
187
190
  Uuid: (0, Uuid_1.createUuid)(),
188
191
  columnId: ColumnId,
189
192
  field: colDef.field,
190
- friendlyName: FriendlyName,
193
+ friendlyName: friendlyName,
191
194
  isPrimaryKey: ColumnId === pkColumn,
192
- dataType: this.getColumnDataType(agGridColumn, false),
195
+ dataType: dataType,
193
196
  visible: agGridColumn.isVisible(),
194
197
  readOnly: this.isColumnReadonly(colDef),
195
198
  columnGroup: ColumnGroup,
@@ -202,7 +205,7 @@ class agGridHelper {
202
205
  aggregationFunction: null,
203
206
  moveable: this.isColumnMoveable(colDef),
204
207
  hideable: this.isColumnHideable(colDef),
205
- queryable: this.isColumnQueryable(colDef, ColumnId),
208
+ queryable: this.isColumnQueryable(colDef, ColumnId, friendlyName, dataType),
206
209
  isGrouped: this.isColumnGrouped(colDef),
207
210
  isFixed: this.isColumnFixed(colDef),
208
211
  pinned: this.getColumnPinnedPosition(colDef),
@@ -316,21 +319,19 @@ class agGridHelper {
316
319
  }
317
320
  return true;
318
321
  }
319
- isColumnQueryable(colDef, columnId) {
322
+ isColumnQueryable(colDef, columnId, friendlyName, datatype) {
320
323
  if (!colDef) {
321
324
  return false;
322
325
  }
323
326
  if (colDef.colId === GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS) {
324
327
  return false;
325
328
  }
326
- const queryableColumns = this.adaptable.api.queryLanguageApi.getQueryableColumnIds();
327
- if (ArrayExtensions_1.ArrayExtensions.IsNull(queryableColumns)) {
328
- return true;
329
- }
330
- if (ArrayExtensions_1.ArrayExtensions.IsEmpty(queryableColumns)) {
331
- return false;
332
- }
333
- return queryableColumns.find((qc) => qc == columnId) != null;
329
+ const abColumnBase = {
330
+ columnId: columnId,
331
+ friendlyName: friendlyName,
332
+ dataType: datatype,
333
+ };
334
+ return this.adaptable.api.queryLanguageApi.isColumnQueryable(abColumnBase);
334
335
  }
335
336
  isColumnHideable(colDef) {
336
337
  if (!colDef) {
@@ -9,7 +9,7 @@ export interface StatusPanelProps {
9
9
  Key: string;
10
10
  };
11
11
  }
12
- export declare const createAgStatusPanelComponent: (component: React.FunctionComponent<StatusPanelProps>, adaptable: IAdaptable, context: StatusPanelProps['context']) => {
12
+ export declare const createAgStatusPanelComponent: (component: React.FunctionComponent<StatusPanelProps>, adaptable: IAdaptable, context: StatusPanelProps['context']) => ((props: IStatusPanelParams) => JSX.Element) | {
13
13
  new (): {
14
14
  params: IStatusPanelParams;
15
15
  eGui: HTMLElement;
@@ -5,6 +5,23 @@ const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const renderWithAdaptableContext_1 = require("../View/renderWithAdaptableContext");
7
7
  const createAgStatusPanelComponent = (component, adaptable, context) => {
8
+ if (adaptable.variant === 'react') {
9
+ return (props) => {
10
+ const children = (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(React.createElement(component, {
11
+ params: props,
12
+ adaptableApi: adaptable.api,
13
+ context,
14
+ }), adaptable);
15
+ return (React.createElement("div", { className: "ab-StatusBar", ref: (node) => {
16
+ if (node) {
17
+ // in React rendering, ag-grid renders an additional extra div
18
+ // around the status panel container, with className of 'ag-react-container'
19
+ // which needs to be stretched in order to fill the status panel
20
+ node.parentElement.style.display = 'flex';
21
+ }
22
+ } }, children));
23
+ };
24
+ }
8
25
  return class StatusBarRenderer {
9
26
  init(params) {
10
27
  this.params = params;
@@ -1,5 +1,9 @@
1
+ import * as React from 'react';
1
2
  import { ICellEditorParams, ICellEditorComp } from '@ag-grid-community/core';
2
3
  import { IAdaptable } from '../../../AdaptableInterfaces/IAdaptable';
4
+ export declare const ReactAdaptableDateEditor: React.ForwardRefExoticComponent<ICellEditorParams<any, any> & {
5
+ showClearButton?: boolean;
6
+ } & React.RefAttributes<unknown>>;
3
7
  /**
4
8
  * Used by default for all `abColDefDate` columns.
5
9
  *
@@ -28,6 +32,7 @@ export declare class AdaptableDateEditor implements ICellEditorComp {
28
32
  private el;
29
33
  private params;
30
34
  private editor;
35
+ private unmountReactRoot?;
31
36
  private valueParser;
32
37
  init(params: ICellEditorParams): void;
33
38
  getGui(): HTMLDivElement;
@@ -37,5 +42,4 @@ export declare class AdaptableDateEditor implements ICellEditorComp {
37
42
  getAdaptableInstance(params: ICellEditorParams): IAdaptable;
38
43
  afterGuiAttached(): void;
39
44
  destroy(): void;
40
- private shouldClearExistingValue;
41
45
  }
@@ -1,13 +1,88 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdaptableDateEditor = void 0;
3
+ exports.AdaptableDateEditor = exports.ReactAdaptableDateEditor = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
- const react_dom_1 = require("react-dom");
7
6
  const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
8
7
  const InternalAdaptableDateEditor_1 = require("./InternalAdaptableDateEditor");
9
8
  const core_1 = require("@ag-grid-community/core");
10
9
  const FormatHelper_1 = require("../../../Utilities/Helpers/FormatHelper");
10
+ const react_1 = require("react");
11
+ function shouldClearExistingValue(params) {
12
+ return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
13
+ }
14
+ function getStartValue(params) {
15
+ return shouldClearExistingValue(params) ? '' : params.value;
16
+ }
17
+ const style = {
18
+ position: 'absolute',
19
+ top: '0px',
20
+ left: '0px',
21
+ right: '0px',
22
+ bottom: '0px',
23
+ };
24
+ const defaultDateValueParser = ({ newValue, oldValue, defaultParser }) => {
25
+ if ((typeof oldValue === 'string' || oldValue == null) && defaultParser) {
26
+ return defaultParser(newValue);
27
+ }
28
+ return newValue;
29
+ };
30
+ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
31
+ var _a;
32
+ const [initialValue] = (0, react_1.useState)(() => getStartValue(props));
33
+ const valueRef = (0, react_1.useRef)(initialValue);
34
+ const colValueParser = props.column.getColDef().valueParser;
35
+ const valueParser = typeof colValueParser === 'function' ? colValueParser : defaultDateValueParser;
36
+ const adaptable = props.api.__adaptable;
37
+ const editorRef = (0, react_1.useRef)(null);
38
+ (0, react_1.useImperativeHandle)(ref, () => {
39
+ return {
40
+ focusIn() {
41
+ var _a;
42
+ (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
43
+ },
44
+ // the final value to send to the grid, on completion of editing
45
+ getValue() {
46
+ return valueRef.current;
47
+ },
48
+ };
49
+ });
50
+ const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: initialValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
51
+ const invalid = isNaN(+value);
52
+ if (valueParser) {
53
+ const params = Object.assign(Object.assign({}, props), { oldValue: props.value, newValue: value, defaultParser: (value) => {
54
+ var _a, _b;
55
+ const Pattern = (_b = (_a = adaptable.adaptableOptions.userInterfaceOptions) === null || _a === void 0 ? void 0 : _a.dateInputOptions) === null || _b === void 0 ? void 0 : _b.dateFormat;
56
+ if (!Pattern) {
57
+ return value;
58
+ }
59
+ return (0, FormatHelper_1.DateFormatter)(value, {
60
+ Pattern,
61
+ });
62
+ } });
63
+ valueRef.current = valueParser(params);
64
+ }
65
+ else {
66
+ valueRef.current = invalid ? null : value;
67
+ }
68
+ if (!invalid) {
69
+ requestAnimationFrame(() => {
70
+ props.stopEditing();
71
+ });
72
+ }
73
+ }, showClearButton: (_a = props.showClearButton) !== null && _a !== void 0 ? _a : true, onStopEdit: (keyboardEventKey) => {
74
+ if (keyboardEventKey === 'Escape') {
75
+ props.api.stopEditing(true);
76
+ }
77
+ else {
78
+ props.stopEditing();
79
+ }
80
+ }, ref: (editor) => {
81
+ editorRef.current = editor;
82
+ editor === null || editor === void 0 ? void 0 : editor.focus();
83
+ } }));
84
+ return React.createElement("div", { style: style }, (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable));
85
+ });
11
86
  /**
12
87
  * Used by default for all `abColDefDate` columns.
13
88
  *
@@ -33,26 +108,20 @@ const FormatHelper_1 = require("../../../Utilities/Helpers/FormatHelper");
33
108
  */
34
109
  class AdaptableDateEditor {
35
110
  constructor() {
36
- this.valueParser = ({ newValue, oldValue, defaultParser }) => {
37
- if ((typeof oldValue === 'string' || oldValue == null) && defaultParser) {
38
- return defaultParser(newValue);
39
- }
40
- return newValue;
41
- };
111
+ this.valueParser = defaultDateValueParser;
42
112
  }
43
113
  init(params) {
44
- this.value = this.shouldClearExistingValue(params) ? '' : params.value;
114
+ this.value = getStartValue(params);
45
115
  const { valueParser } = params.column.getColDef();
46
116
  this.params = params;
47
117
  if (typeof valueParser === 'function') {
48
118
  this.valueParser = valueParser;
49
119
  }
50
120
  this.el = document.createElement('div');
51
- this.el.style.position = 'absolute';
52
- this.el.style.top = '0px';
53
- this.el.style.left = '0px';
54
- this.el.style.right = '0px';
55
- this.el.style.bottom = '0px';
121
+ Object.keys(style).forEach((key) => {
122
+ //@ts-ignore
123
+ this.el.style[key] = style[key];
124
+ });
56
125
  }
57
126
  /* Component Editor Lifecycle methods */
58
127
  // gets called once when grid ready to insert the element
@@ -76,7 +145,7 @@ class AdaptableDateEditor {
76
145
  afterGuiAttached() {
77
146
  var _a;
78
147
  const adaptable = this.getAdaptableInstance(this.params);
79
- const defaultValue = this.shouldClearExistingValue(this.params) ? '' : this.params.value;
148
+ const defaultValue = shouldClearExistingValue(this.params) ? '' : this.params.value;
80
149
  const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: defaultValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
81
150
  const invalid = isNaN(+value);
82
151
  if (this.valueParser) {
@@ -111,13 +180,11 @@ class AdaptableDateEditor {
111
180
  this.editor = editor;
112
181
  editor === null || editor === void 0 ? void 0 : editor.focus();
113
182
  } }));
114
- (0, react_dom_1.render)((0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable), this.el);
183
+ this.unmountReactRoot = adaptable.renderReactRoot((0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable), this.el);
115
184
  }
116
185
  destroy() {
117
- (0, react_dom_1.unmountComponentAtNode)(this.el);
118
- }
119
- shouldClearExistingValue(params) {
120
- return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
186
+ var _a;
187
+ (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
121
188
  }
122
189
  }
123
190
  exports.AdaptableDateEditor = AdaptableDateEditor;
@@ -22,7 +22,7 @@ const inputStyle = {
22
22
  width: '100%',
23
23
  border: 'none',
24
24
  };
25
- exports.InternalAdaptableNumberEditor = React.forwardRef((props, ref) => {
25
+ exports.InternalAdaptableNumberEditor = React.forwardRef(function InternalAdaptableNumberEditorFn(props, ref) {
26
26
  var _a;
27
27
  const inputRef = React.useRef(null);
28
28
  const focus = () => {