@adaptabletools/adaptable 13.0.0-canary.9 → 13.0.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 (243) hide show
  1. package/base.css +1454 -840
  2. package/base.css.map +1 -0
  3. package/bundle.cjs.js +238 -220
  4. package/index.css +1505 -850
  5. package/index.css.map +1 -0
  6. package/package.json +6 -6
  7. package/publishTimestamp.d.ts +1 -1
  8. package/publishTimestamp.js +1 -1
  9. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -0
  10. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +30 -6
  11. package/src/AdaptableOptions/ExportOptions.d.ts +2 -2
  12. package/src/AdaptableOptions/GeneralOptions.d.ts +0 -5
  13. package/src/AdaptableOptions/LayoutOptions.d.ts +2 -1
  14. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +2 -2
  15. package/src/Api/AdaptableApi.d.ts +2 -5
  16. package/src/Api/ColumnApi.d.ts +8 -2
  17. package/src/Api/ConfigApi.d.ts +0 -5
  18. package/src/Api/ExportApi.d.ts +6 -6
  19. package/src/Api/FormatColumnApi.d.ts +46 -73
  20. package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -2
  21. package/src/Api/Implementation/AdaptableApiImpl.js +2 -3
  22. package/src/Api/Implementation/AlertApiImpl.js +9 -4
  23. package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -1
  24. package/src/Api/Implementation/ColumnApiImpl.js +15 -11
  25. package/src/Api/Implementation/ConfigApiImpl.d.ts +0 -2
  26. package/src/Api/Implementation/ConfigApiImpl.js +0 -11
  27. package/src/Api/Implementation/ExportApiImpl.d.ts +4 -4
  28. package/src/Api/Implementation/ExportApiImpl.js +14 -14
  29. package/src/Api/Implementation/FlashingCellApiImpl.js +4 -1
  30. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +24 -22
  31. package/src/Api/Implementation/FormatColumnApiImpl.js +57 -224
  32. package/src/Api/Implementation/InternalApiImpl.d.ts +1 -1
  33. package/src/Api/Implementation/InternalApiImpl.js +4 -3
  34. package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +2 -1
  35. package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -15
  36. package/src/Api/Implementation/ScopeApiImpl.d.ts +1 -1
  37. package/src/Api/Implementation/StyledColumnApiImpl.d.ts +25 -0
  38. package/src/Api/Implementation/StyledColumnApiImpl.js +193 -0
  39. package/src/Api/InternalApi.d.ts +1 -1
  40. package/src/Api/QueryLanguageApi.d.ts +3 -2
  41. package/src/Api/ScopeApi.d.ts +1 -1
  42. package/src/Api/StyledColumnApi.d.ts +106 -0
  43. package/src/Api/{ConditionalStyleApi.js → StyledColumnApi.js} +0 -0
  44. package/src/PredefinedConfig/AdaptableState.d.ts +2 -0
  45. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  46. package/src/PredefinedConfig/Common/Types.d.ts +3 -3
  47. package/src/PredefinedConfig/Common/Types.js +1 -0
  48. package/src/PredefinedConfig/FormatColumnState.d.ts +6 -90
  49. package/src/PredefinedConfig/PredefinedConfig.d.ts +5 -0
  50. package/src/PredefinedConfig/StyledColumnState.d.ts +119 -0
  51. package/src/{Strategy/Interface/IConditionalStyleModule.js → PredefinedConfig/StyledColumnState.js} +0 -0
  52. package/src/Redux/ActionsReducers/PluginsRedux.d.ts +4 -4
  53. package/src/Redux/ActionsReducers/PluginsRedux.js +5 -5
  54. package/src/Redux/ActionsReducers/StyledColumnRedux.d.ts +49 -0
  55. package/src/Redux/ActionsReducers/StyledColumnRedux.js +92 -0
  56. package/src/Redux/DeadRedux.d.ts +6 -0
  57. package/src/Redux/DeadRedux.js +19 -1
  58. package/src/Redux/Store/AdaptableStore.js +9 -8
  59. package/src/Strategy/ConditionalStyleModule.d.ts +2 -27
  60. package/src/Strategy/ConditionalStyleModule.js +0 -219
  61. package/src/Strategy/FormatColumnModule.d.ts +0 -2
  62. package/src/Strategy/FormatColumnModule.js +30 -221
  63. package/src/Strategy/LayoutModule.js +0 -4
  64. package/src/Strategy/StyledColumnModule.d.ts +24 -0
  65. package/src/Strategy/StyledColumnModule.js +165 -0
  66. package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +1 -16
  67. package/src/Strategy/Utilities/getScopeViewItems.js +1 -1
  68. package/src/Utilities/Constants/ModuleConstants.d.ts +3 -0
  69. package/src/Utilities/Constants/ModuleConstants.js +4 -1
  70. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -3
  71. package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -1
  72. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +1 -4
  73. package/src/Utilities/ObjectFactory.d.ts +5 -2
  74. package/src/Utilities/ObjectFactory.js +14 -6
  75. package/src/Utilities/Services/ModuleService.js +2 -2
  76. package/src/Utilities/Services/QueryLanguageService.js +1 -1
  77. package/src/Utilities/Services/ReportService.js +6 -6
  78. package/src/View/AdaptablePopover/index.js +1 -1
  79. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +15 -14
  80. package/src/View/Alert/Wizard/AlertButtonsEditor.js +24 -1
  81. package/src/View/Alert/Wizard/AlertDisplayWizardSection.js +6 -5
  82. package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.js +3 -3
  83. package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +3 -3
  84. package/src/View/Alert/Wizard/isValidAlertRules.js +1 -1
  85. package/src/View/BulkUpdate/BulkUpdatePopup.js +1 -1
  86. package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +1 -1
  87. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
  88. package/src/View/Components/AdaptableObjectRow/index.js +1 -6
  89. package/src/View/Components/Buttons/ButtonInfo.d.ts +1 -3
  90. package/src/View/Components/Buttons/ButtonInfo.js +3 -5
  91. package/src/View/Components/EntityRulesEditor/index.js +8 -17
  92. package/src/View/Components/FilterForm/FilterForm.js +11 -16
  93. package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
  94. package/src/View/Components/FilterForm/QuickFilterForm.js +7 -13
  95. package/src/View/Components/NewScopeComponent.js +3 -3
  96. package/src/View/Components/Panels/PanelWithButton.js +1 -5
  97. package/src/View/Components/Panels/PanelWithImage.js +1 -5
  98. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +2 -2
  99. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.d.ts +1 -0
  100. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +3 -16
  101. package/src/View/Components/Popups/AdaptablePopup/PopupPanel.js +1 -1
  102. package/src/View/Components/Popups/AdaptablePopupTeamSharing.js +5 -5
  103. package/src/View/Components/RangesComponent.d.ts +8 -1
  104. package/src/View/Components/RangesComponent.js +60 -24
  105. package/src/View/Components/ScopeComponent.js +6 -6
  106. package/src/View/Components/Selectors/ColumnSelector.d.ts +1 -0
  107. package/src/View/Components/Selectors/ColumnSelector.js +2 -1
  108. package/src/View/Components/Selectors/ColumnValueSelector.js +2 -2
  109. package/src/View/Components/StyleComponent.js +14 -19
  110. package/src/View/Components/ToolPanel/AdaptableToolPanel.d.ts +1 -11
  111. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +21 -9
  112. package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
  113. package/src/View/Components/ToolPanel/ToolPanelPopup.d.ts +1 -1
  114. package/src/View/Dashboard/DashboardPopup.js +1 -1
  115. package/src/View/DataSet/DataSetSelector.js +1 -1
  116. package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
  117. package/src/View/Export/ExportViewPanel.d.ts +1 -1
  118. package/src/View/Export/ExportViewPanel.js +4 -4
  119. package/src/View/Export/ReportExportDropdown.js +1 -1
  120. package/src/View/Export/Wizard/ReportNameWizardSection.js +10 -11
  121. package/src/View/Filter/FilterSummary.d.ts +1 -1
  122. package/src/View/Filter/FilterViewPanel.d.ts +1 -1
  123. package/src/View/FlashingCell/FlashingCellStyle.js +3 -3
  124. package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +3 -3
  125. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +6 -6
  126. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +4 -4
  127. package/src/View/FormatColumn/FormatColumnSummary.js +1 -1
  128. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +27 -27
  129. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +4 -5
  130. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
  131. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +2 -6
  132. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +3 -3
  133. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +6 -300
  134. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +3 -10
  135. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +7 -7
  136. package/src/View/GridInfo/ColumnInfoComponent.js +26 -18
  137. package/src/View/GridInfo/GridInfoPopup.js +10 -9
  138. package/src/View/Layout/LayoutRadioSelector.js +1 -1
  139. package/src/View/Layout/LayoutViewPanel.d.ts +1 -1
  140. package/src/View/Layout/Wizard/Components/ColumnLabels.js +1 -1
  141. package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
  142. package/src/View/Layout/Wizard/sections/ColumnsSection.js +7 -6
  143. package/src/View/Layout/Wizard/sections/SettingsSection.js +2 -2
  144. package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +1 -1
  145. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +3 -3
  146. package/src/View/Query/QueryViewPanel.d.ts +1 -1
  147. package/src/View/Query/Wizard/NamedQuerySettingsWizardSection.js +1 -1
  148. package/src/View/QuickSearch/QuickSearchPopup.js +2 -2
  149. package/src/View/QuickSearch/QuickSearchViewPanel.d.ts +1 -1
  150. package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +5 -5
  151. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsGlue42.js +1 -1
  152. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsIPushPull.js +5 -5
  153. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsOpenFin.js +1 -1
  154. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReminder.js +5 -5
  155. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +2 -2
  156. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +3 -3
  157. package/src/View/SmartEdit/SmartEditPopup.js +3 -3
  158. package/src/View/SpecialColumnSettingsWizardStep.js +10 -10
  159. package/src/View/StateManagement/StateManagementPopup.js +4 -4
  160. package/src/View/StatusBar/StatusBarPopup.js +1 -1
  161. package/src/View/StyledColumn/Wizard/StyledColumnWizard.d.ts +7 -0
  162. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +77 -0
  163. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.d.ts +9 -0
  164. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +65 -0
  165. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.d.ts +9 -0
  166. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.js +234 -0
  167. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.d.ts +7 -0
  168. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +59 -0
  169. package/src/View/SystemStatus/SystemStatusEntityRow.js +4 -6
  170. package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +1 -1
  171. package/src/View/TeamSharing/SharedEntityObjectView.js +1 -1
  172. package/src/View/TeamSharing/TeamSharingApplyButton.js +1 -1
  173. package/src/View/Theme/ThemePopup.js +1 -1
  174. package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -1
  175. package/src/View/Wizard/OnePageAdaptableWizard.js +1 -2
  176. package/src/agGrid/ActionColumnRenderer.d.ts +2 -0
  177. package/src/agGrid/ActionColumnRenderer.js +94 -62
  178. package/src/agGrid/Adaptable.d.ts +10 -11
  179. package/src/agGrid/Adaptable.js +164 -222
  180. package/src/agGrid/CheckboxRenderer.js +1 -1
  181. package/src/agGrid/FilterWrapper.js +60 -16
  182. package/src/agGrid/FloatingFilterWrapper.d.ts +2 -2
  183. package/src/agGrid/FloatingFilterWrapper.js +71 -32
  184. package/src/agGrid/PercentBarRenderer.d.ts +6 -2
  185. package/src/agGrid/PercentBarRenderer.js +19 -17
  186. package/src/agGrid/agGridHelper.d.ts +6 -2
  187. package/src/agGrid/agGridHelper.js +17 -17
  188. package/src/agGrid/createAgStatusPanelComponent.d.ts +1 -1
  189. package/src/agGrid/createAgStatusPanelComponent.js +17 -0
  190. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -1
  191. package/src/agGrid/editors/AdaptableDateEditor/index.js +84 -17
  192. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +1 -1
  193. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -3
  194. package/src/agGrid/editors/AdaptableNumberEditor/index.js +78 -27
  195. package/src/agGrid/weightedAverage.js +19 -11
  196. package/src/components/CheckBox/index.js +7 -2
  197. package/src/components/Datepicker/index.d.ts +1 -1
  198. package/src/components/DragAndDropContext/TabList.js +1 -1
  199. package/src/components/DragAndDropContext/UnusedPanel.js +3 -2
  200. package/src/components/ExpressionEditor/BaseEditorInput.js +13 -32
  201. package/src/components/ExpressionEditor/index.js +9 -17
  202. package/src/components/FormLayout/index.js +1 -1
  203. package/src/components/StylePreview.js +2 -1
  204. package/src/components/icons/brush.d.ts +3 -0
  205. package/src/components/icons/brush.js +7 -0
  206. package/src/components/icons/index.js +2 -0
  207. package/src/metamodel/adaptable.metamodel.d.ts +113 -57
  208. package/src/metamodel/adaptable.metamodel.js +1 -1
  209. package/src/renderReactRoot.d.ts +2 -0
  210. package/src/renderReactRoot.js +11 -9
  211. package/src/types.d.ts +5 -5
  212. package/themes/dark.css +8 -4
  213. package/themes/dark.css.map +1 -0
  214. package/themes/light.css +4 -1
  215. package/themes/light.css.map +1 -0
  216. package/version.d.ts +1 -1
  217. package/version.js +1 -1
  218. package/src/AdaptableComponents.d.ts +0 -1
  219. package/src/AdaptableComponents.js +0 -5
  220. package/src/Api/ConditionalStyleApi.d.ts +0 -86
  221. package/src/Api/Implementation/ConditionalStyleApiImpl.d.ts +0 -29
  222. package/src/Api/Implementation/ConditionalStyleApiImpl.js +0 -98
  223. package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +0 -49
  224. package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +0 -95
  225. package/src/Strategy/Interface/IConditionalStyleModule.d.ts +0 -6
  226. package/src/Strategy/Utilities/getStyleViewItems.d.ts +0 -2
  227. package/src/Strategy/Utilities/getStyleViewItems.js +0 -16
  228. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.d.ts +0 -2
  229. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.js +0 -18
  230. package/src/View/ConditionalStyle/ConditionalStyleSummary.d.ts +0 -25
  231. package/src/View/ConditionalStyle/ConditionalStyleSummary.js +0 -108
  232. package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.d.ts +0 -9
  233. package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.js +0 -42
  234. package/src/View/ConditionalStyle/Wizard/ConditionalStyleScopeWizardSection.d.ts +0 -8
  235. package/src/View/ConditionalStyle/Wizard/ConditionalStyleScopeWizardSection.js +0 -43
  236. package/src/View/ConditionalStyle/Wizard/ConditionalStyleSettingsWizardSettings.d.ts +0 -8
  237. package/src/View/ConditionalStyle/Wizard/ConditionalStyleSettingsWizardSettings.js +0 -29
  238. package/src/View/ConditionalStyle/Wizard/ConditionalStyleStyleWizardSection.d.ts +0 -8
  239. package/src/View/ConditionalStyle/Wizard/ConditionalStyleStyleWizardSection.js +0 -23
  240. package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.d.ts +0 -6
  241. package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.js +0 -114
  242. package/src/View/ConditionalStyle/Wizard/DEFAULT_PREDICATE_ID_FOR_CONDITIONAL_STYLE.d.ts +0 -1
  243. package/src/View/ConditionalStyle/Wizard/DEFAULT_PREDICATE_ID_FOR_CONDITIONAL_STYLE.js +0 -4
@@ -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;
@@ -7,7 +7,6 @@ const AlertModule_1 = require("../Strategy/AlertModule");
7
7
  const BulkUpdateModule_1 = require("../Strategy/BulkUpdateModule");
8
8
  const CalculatedColumnModule_1 = require("../Strategy/CalculatedColumnModule");
9
9
  const CellSummaryModule_1 = require("../Strategy/CellSummaryModule");
10
- const ConditionalStyleModule_1 = require("../Strategy/ConditionalStyleModule");
11
10
  const CustomSortModule_1 = require("../Strategy/CustomSortModule");
12
11
  const DashboardModule_1 = require("../Strategy/DashboardModule");
13
12
  const DataSetModule_1 = require("../Strategy/DataSetModule");
@@ -43,6 +42,7 @@ const StatusBarModule_1 = require("../Strategy/StatusBarModule");
43
42
  const GeneralConstants = tslib_1.__importStar(require("../Utilities/Constants/GeneralConstants"));
44
43
  const GeneralConstants_1 = require("../Utilities/Constants/GeneralConstants");
45
44
  const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
45
+ const StyledColumnModule_1 = require("../Strategy/StyledColumnModule");
46
46
  const tinycolor = require('tinycolor2');
47
47
  /**
48
48
  * Adaptable AG Grid implementation is getting really big and unwieldy
@@ -80,7 +80,7 @@ class agGridHelper {
80
80
  modules.set(ModuleConstants.BulkUpdateModuleId, new BulkUpdateModule_1.BulkUpdateModule(api));
81
81
  modules.set(ModuleConstants.CalculatedColumnModuleId, new CalculatedColumnModule_1.CalculatedColumnModule(api));
82
82
  modules.set(ModuleConstants.CellSummaryModuleId, new CellSummaryModule_1.CellSummaryModule(api));
83
- modules.set(ModuleConstants.ConditionalStyleModuleId, new ConditionalStyleModule_1.ConditionalStyleModule(api));
83
+ // modules.set(ModuleConstants.ConditionalStyleModuleId, new ConditionalStyleModule(api));
84
84
  modules.set(ModuleConstants.CustomSortModuleId, new CustomSortModule_1.CustomSortModule(api));
85
85
  modules.set(ModuleConstants.DataChangeHistoryModuleId, new DataChangeHistoryModule_1.DataChangeHistoryModule(api));
86
86
  modules.set(ModuleConstants.DataSetModuleId, new DataSetModule_1.DataSetModule(api));
@@ -104,6 +104,7 @@ class agGridHelper {
104
104
  modules.set(ModuleConstants.SettingsPanelModuleId, new SettingsPanelModule_1.SettingsPanelModule(api));
105
105
  modules.set(ModuleConstants.StatusBarModuleId, new StatusBarModule_1.StatusBarModule(api));
106
106
  modules.set(ModuleConstants.ChartingModuleId, new ChartingModule_1.ChartingModule(api));
107
+ modules.set(ModuleConstants.StyledColumnModuleId, new StyledColumnModule_1.StyledColumnModule(api));
107
108
  return modules;
108
109
  }
109
110
  TrySetUpNodeIds(hasAutogeneratedPrimaryKey) {
@@ -150,8 +151,8 @@ class agGridHelper {
150
151
  createCheckboxRendererComp(columnId, isColumnReadOnly) {
151
152
  return (0, CheckboxRenderer_1.getCheckboxRendererForColumn)(columnId, isColumnReadOnly, this.adaptable.api);
152
153
  }
153
- createPercentBarRendererComp(formatColumn, abColumn) {
154
- return (0, PercentBarRenderer_1.getPercentBarRendererForColumn)(formatColumn, abColumn, this.adaptable.api);
154
+ createPercentBarRendererComp(columnStyle, abColumn) {
155
+ return (0, PercentBarRenderer_1.getPercentBarRendererForColumn)(columnStyle, abColumn, this.adaptable.api);
155
156
  }
156
157
  getCleanValue(value) {
157
158
  if (value == null || value == 'null' || value == undefined || value == 'undefined') {
@@ -174,7 +175,7 @@ class agGridHelper {
174
175
  const customFriendlyName = typeof columnFriendlyName === 'function'
175
176
  ? columnFriendlyName({ colId: colId, agColumn: agGridColumn })
176
177
  : null;
177
- const FriendlyName = customFriendlyName !== null && customFriendlyName !== void 0 ? customFriendlyName : (isActionRowButtonColumn
178
+ const friendlyName = customFriendlyName !== null && customFriendlyName !== void 0 ? customFriendlyName : (isActionRowButtonColumn
178
179
  ? GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME
179
180
  : this.gridOptions.columnApi.getDisplayNameForColumn(agGridColumn, 'header'));
180
181
  if (!this.initialAgGridColDefs[colId]) {
@@ -183,13 +184,14 @@ class agGridHelper {
183
184
  const ColumnId = colId;
184
185
  const pkColumn = this.adaptable.adaptableOptions.primaryKey;
185
186
  let ColumnGroup = colsToGroups === null || colsToGroups === void 0 ? void 0 : colsToGroups[ColumnId];
187
+ const dataType = this.getColumnDataType(agGridColumn, false);
186
188
  const abColumn = {
187
189
  Uuid: (0, Uuid_1.createUuid)(),
188
190
  columnId: ColumnId,
189
191
  field: colDef.field,
190
- friendlyName: FriendlyName,
192
+ friendlyName: friendlyName,
191
193
  isPrimaryKey: ColumnId === pkColumn,
192
- dataType: this.getColumnDataType(agGridColumn, false),
194
+ dataType: dataType,
193
195
  visible: agGridColumn.isVisible(),
194
196
  readOnly: this.isColumnReadonly(colDef),
195
197
  columnGroup: ColumnGroup,
@@ -202,7 +204,7 @@ class agGridHelper {
202
204
  aggregationFunction: null,
203
205
  moveable: this.isColumnMoveable(colDef),
204
206
  hideable: this.isColumnHideable(colDef),
205
- queryable: this.isColumnQueryable(colDef, ColumnId),
207
+ queryable: this.isColumnQueryable(colDef, ColumnId, friendlyName, dataType),
206
208
  isGrouped: this.isColumnGrouped(colDef),
207
209
  isFixed: this.isColumnFixed(colDef),
208
210
  pinned: this.getColumnPinnedPosition(colDef),
@@ -316,21 +318,19 @@ class agGridHelper {
316
318
  }
317
319
  return true;
318
320
  }
319
- isColumnQueryable(colDef, columnId) {
321
+ isColumnQueryable(colDef, columnId, friendlyName, datatype) {
320
322
  if (!colDef) {
321
323
  return false;
322
324
  }
323
325
  if (colDef.colId === GeneralConstants_1.ADAPTABLE_ROW_ACTION_BUTTONS) {
324
326
  return false;
325
327
  }
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;
328
+ const abColumnBase = {
329
+ columnId: columnId,
330
+ friendlyName: friendlyName,
331
+ dataType: datatype,
332
+ };
333
+ return this.adaptable.api.queryLanguageApi.isColumnQueryable(abColumnBase);
334
334
  }
335
335
  isColumnHideable(colDef) {
336
336
  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
  *
@@ -38,5 +42,4 @@ export declare class AdaptableDateEditor implements ICellEditorComp {
38
42
  getAdaptableInstance(params: ICellEditorParams): IAdaptable;
39
43
  afterGuiAttached(): void;
40
44
  destroy(): void;
41
- private shouldClearExistingValue;
42
45
  }
@@ -1,12 +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
6
  const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
7
7
  const InternalAdaptableDateEditor_1 = require("./InternalAdaptableDateEditor");
8
8
  const core_1 = require("@ag-grid-community/core");
9
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
+ });
10
86
  /**
11
87
  * Used by default for all `abColDefDate` columns.
12
88
  *
@@ -32,26 +108,20 @@ const FormatHelper_1 = require("../../../Utilities/Helpers/FormatHelper");
32
108
  */
33
109
  class AdaptableDateEditor {
34
110
  constructor() {
35
- this.valueParser = ({ newValue, oldValue, defaultParser }) => {
36
- if ((typeof oldValue === 'string' || oldValue == null) && defaultParser) {
37
- return defaultParser(newValue);
38
- }
39
- return newValue;
40
- };
111
+ this.valueParser = defaultDateValueParser;
41
112
  }
42
113
  init(params) {
43
- this.value = this.shouldClearExistingValue(params) ? '' : params.value;
114
+ this.value = getStartValue(params);
44
115
  const { valueParser } = params.column.getColDef();
45
116
  this.params = params;
46
117
  if (typeof valueParser === 'function') {
47
118
  this.valueParser = valueParser;
48
119
  }
49
120
  this.el = document.createElement('div');
50
- this.el.style.position = 'absolute';
51
- this.el.style.top = '0px';
52
- this.el.style.left = '0px';
53
- this.el.style.right = '0px';
54
- this.el.style.bottom = '0px';
121
+ Object.keys(style).forEach((key) => {
122
+ //@ts-ignore
123
+ this.el.style[key] = style[key];
124
+ });
55
125
  }
56
126
  /* Component Editor Lifecycle methods */
57
127
  // gets called once when grid ready to insert the element
@@ -75,7 +145,7 @@ class AdaptableDateEditor {
75
145
  afterGuiAttached() {
76
146
  var _a;
77
147
  const adaptable = this.getAdaptableInstance(this.params);
78
- const defaultValue = this.shouldClearExistingValue(this.params) ? '' : this.params.value;
148
+ const defaultValue = shouldClearExistingValue(this.params) ? '' : this.params.value;
79
149
  const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: defaultValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
80
150
  const invalid = isNaN(+value);
81
151
  if (this.valueParser) {
@@ -116,8 +186,5 @@ class AdaptableDateEditor {
116
186
  var _a;
117
187
  (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
118
188
  }
119
- shouldClearExistingValue(params) {
120
- return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
121
- }
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 = () => {