@adaptabletools/adaptable 13.0.0-canary.9 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/base.css +1231 -733
  2. package/base.css.map +1 -0
  3. package/bundle.cjs.js +236 -219
  4. package/index.css +1249 -734
  5. package/index.css.map +1 -0
  6. package/package.json +5 -5
  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/DataSet/DataSetSelector.js +1 -1
  115. package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
  116. package/src/View/Export/ExportViewPanel.d.ts +1 -1
  117. package/src/View/Export/ExportViewPanel.js +4 -4
  118. package/src/View/Export/ReportExportDropdown.js +1 -1
  119. package/src/View/Export/Wizard/ReportNameWizardSection.js +10 -11
  120. package/src/View/Filter/FilterSummary.d.ts +1 -1
  121. package/src/View/Filter/FilterViewPanel.d.ts +1 -1
  122. package/src/View/FlashingCell/FlashingCellStyle.js +3 -3
  123. package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +3 -3
  124. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +6 -6
  125. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +4 -4
  126. package/src/View/FormatColumn/FormatColumnSummary.js +1 -1
  127. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +27 -27
  128. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +4 -5
  129. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
  130. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +2 -6
  131. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +3 -3
  132. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +6 -300
  133. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +3 -10
  134. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +7 -7
  135. package/src/View/GridInfo/ColumnInfoComponent.js +0 -7
  136. package/src/View/Layout/LayoutRadioSelector.js +1 -1
  137. package/src/View/Layout/LayoutViewPanel.d.ts +1 -1
  138. package/src/View/Layout/Wizard/Components/ColumnLabels.js +1 -1
  139. package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
  140. package/src/View/Layout/Wizard/sections/ColumnsSection.js +7 -6
  141. package/src/View/Layout/Wizard/sections/SettingsSection.js +2 -2
  142. package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +1 -1
  143. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +3 -3
  144. package/src/View/Query/QueryViewPanel.d.ts +1 -1
  145. package/src/View/Query/Wizard/NamedQuerySettingsWizardSection.js +1 -1
  146. package/src/View/QuickSearch/QuickSearchPopup.js +2 -2
  147. package/src/View/QuickSearch/QuickSearchViewPanel.d.ts +1 -1
  148. package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +5 -5
  149. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsGlue42.js +1 -1
  150. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsIPushPull.js +5 -5
  151. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsOpenFin.js +1 -1
  152. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReminder.js +5 -5
  153. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +2 -2
  154. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +3 -3
  155. package/src/View/SmartEdit/SmartEditPopup.js +3 -3
  156. package/src/View/SpecialColumnSettingsWizardStep.js +10 -10
  157. package/src/View/StateManagement/StateManagementPopup.js +4 -4
  158. package/src/View/StyledColumn/Wizard/StyledColumnWizard.d.ts +7 -0
  159. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +77 -0
  160. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.d.ts +9 -0
  161. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +65 -0
  162. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.d.ts +9 -0
  163. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection.js +234 -0
  164. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.d.ts +7 -0
  165. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +59 -0
  166. package/src/View/SystemStatus/SystemStatusEntityRow.js +4 -6
  167. package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +1 -1
  168. package/src/View/TeamSharing/SharedEntityObjectView.js +1 -1
  169. package/src/View/TeamSharing/TeamSharingApplyButton.js +1 -1
  170. package/src/View/Theme/ThemePopup.js +1 -1
  171. package/src/View/Wizard/OnePageAdaptableWizard.d.ts +1 -1
  172. package/src/View/Wizard/OnePageAdaptableWizard.js +1 -2
  173. package/src/agGrid/ActionColumnRenderer.d.ts +2 -0
  174. package/src/agGrid/ActionColumnRenderer.js +94 -62
  175. package/src/agGrid/Adaptable.d.ts +10 -11
  176. package/src/agGrid/Adaptable.js +161 -222
  177. package/src/agGrid/CheckboxRenderer.js +1 -1
  178. package/src/agGrid/FilterWrapper.js +60 -16
  179. package/src/agGrid/FloatingFilterWrapper.d.ts +2 -2
  180. package/src/agGrid/FloatingFilterWrapper.js +71 -32
  181. package/src/agGrid/PercentBarRenderer.d.ts +6 -2
  182. package/src/agGrid/PercentBarRenderer.js +19 -17
  183. package/src/agGrid/agGridHelper.d.ts +6 -2
  184. package/src/agGrid/agGridHelper.js +17 -17
  185. package/src/agGrid/createAgStatusPanelComponent.d.ts +1 -1
  186. package/src/agGrid/createAgStatusPanelComponent.js +17 -0
  187. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -1
  188. package/src/agGrid/editors/AdaptableDateEditor/index.js +84 -17
  189. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +1 -1
  190. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -3
  191. package/src/agGrid/editors/AdaptableNumberEditor/index.js +78 -27
  192. package/src/agGrid/weightedAverage.js +19 -11
  193. package/src/components/CheckBox/index.js +7 -2
  194. package/src/components/Datepicker/index.d.ts +1 -1
  195. package/src/components/ExpressionEditor/BaseEditorInput.js +13 -32
  196. package/src/components/ExpressionEditor/index.js +9 -17
  197. package/src/components/FormLayout/index.js +1 -1
  198. package/src/components/StylePreview.js +2 -1
  199. package/src/components/icons/brush.d.ts +3 -0
  200. package/src/components/icons/brush.js +7 -0
  201. package/src/components/icons/index.js +2 -0
  202. package/src/metamodel/adaptable.metamodel.d.ts +113 -57
  203. package/src/metamodel/adaptable.metamodel.js +1 -1
  204. package/src/renderReactRoot.d.ts +2 -0
  205. package/src/renderReactRoot.js +11 -9
  206. package/src/types.d.ts +5 -5
  207. package/themes/dark.css +8 -4
  208. package/themes/dark.css.map +1 -0
  209. package/themes/light.css +4 -1
  210. package/themes/light.css.map +1 -0
  211. package/version.d.ts +1 -1
  212. package/version.js +1 -1
  213. package/src/AdaptableComponents.d.ts +0 -1
  214. package/src/AdaptableComponents.js +0 -5
  215. package/src/Api/ConditionalStyleApi.d.ts +0 -86
  216. package/src/Api/Implementation/ConditionalStyleApiImpl.d.ts +0 -29
  217. package/src/Api/Implementation/ConditionalStyleApiImpl.js +0 -98
  218. package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +0 -49
  219. package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +0 -95
  220. package/src/Strategy/Interface/IConditionalStyleModule.d.ts +0 -6
  221. package/src/Strategy/Utilities/getStyleViewItems.d.ts +0 -2
  222. package/src/Strategy/Utilities/getStyleViewItems.js +0 -16
  223. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.d.ts +0 -2
  224. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.js +0 -18
  225. package/src/View/ConditionalStyle/ConditionalStyleSummary.d.ts +0 -25
  226. package/src/View/ConditionalStyle/ConditionalStyleSummary.js +0 -108
  227. package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.d.ts +0 -9
  228. package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.js +0 -42
  229. package/src/View/ConditionalStyle/Wizard/ConditionalStyleScopeWizardSection.d.ts +0 -8
  230. package/src/View/ConditionalStyle/Wizard/ConditionalStyleScopeWizardSection.js +0 -43
  231. package/src/View/ConditionalStyle/Wizard/ConditionalStyleSettingsWizardSettings.d.ts +0 -8
  232. package/src/View/ConditionalStyle/Wizard/ConditionalStyleSettingsWizardSettings.js +0 -29
  233. package/src/View/ConditionalStyle/Wizard/ConditionalStyleStyleWizardSection.d.ts +0 -8
  234. package/src/View/ConditionalStyle/Wizard/ConditionalStyleStyleWizardSection.js +0 -23
  235. package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.d.ts +0 -6
  236. package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.js +0 -114
  237. package/src/View/ConditionalStyle/Wizard/DEFAULT_PREDICATE_ID_FOR_CONDITIONAL_STYLE.d.ts +0 -1
  238. package/src/View/ConditionalStyle/Wizard/DEFAULT_PREDICATE_ID_FOR_CONDITIONAL_STYLE.js +0 -4
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StyledColumnWizardStyleSection = exports.renderStyledColumnStyleSummary = exports.renderFormatColumnStyleWizardSummary = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const rebass_1 = require("rebass");
7
+ const CheckBox_1 = require("../../../components/CheckBox");
8
+ const ErrorBox_1 = tslib_1.__importDefault(require("../../../components/ErrorBox"));
9
+ const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
10
+ const Tabs_1 = require("../../../components/Tabs");
11
+ const Tag_1 = require("../../../components/Tag");
12
+ const ColorPicker_1 = require("../../ColorPicker");
13
+ const RangesComponent_1 = require("../../Components/RangesComponent");
14
+ const StyleVisualItem_1 = require("../../Components/StyleVisualItem");
15
+ const UIHelper_1 = require("../../UIHelper");
16
+ const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
17
+ const renderFormatColumnStyleWizardSummary = (data) => {
18
+ const { api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
19
+ return (0, exports.renderStyledColumnStyleSummary)(data, api);
20
+ };
21
+ exports.renderFormatColumnStyleWizardSummary = renderFormatColumnStyleWizardSummary;
22
+ const getRanges = (ranges) => {
23
+ return ranges.map((r, i) => (React.createElement(rebass_1.Flex, { key: i, alignItems: "center", mr: 3 },
24
+ React.createElement(rebass_1.Box, { mr: 1 },
25
+ r.Min,
26
+ " to ",
27
+ r.Max,
28
+ ' '),
29
+ React.createElement(StyleVisualItem_1.StyleVisualItem, { Style: {
30
+ BackColor: r.Color,
31
+ ForeColor: r.Color,
32
+ } }))));
33
+ };
34
+ const getColumnComparison = (columnComparison, api) => {
35
+ return (React.createElement(rebass_1.Flex, { key: 'cc', alignItems: "center", mr: 3 },
36
+ React.createElement(rebass_1.Box, { mr: 1 },
37
+ "Min Value:",
38
+ ' ',
39
+ isNaN(Number(columnComparison.MinValue))
40
+ ? '[' + api.columnApi.getFriendlyNameFromColumnId(String(columnComparison.MinValue)) + ']'
41
+ : columnComparison.MinValue,
42
+ ' ',
43
+ ", Max Value:",
44
+ ' ',
45
+ isNaN(Number(columnComparison.MaxValue))
46
+ ? '[' + api.columnApi.getFriendlyNameFromColumnId(String(columnComparison.MaxValue)) + ']'
47
+ : columnComparison.MaxValue,
48
+ ' '),
49
+ React.createElement(StyleVisualItem_1.StyleVisualItem, { Style: {
50
+ BackColor: columnComparison.Color,
51
+ ForeColor: columnComparison.Color,
52
+ } })));
53
+ };
54
+ const renderStyledColumnStyleSummary = (data, api) => {
55
+ if (data.CheckBoxStyle) {
56
+ return React.createElement(Tag_1.Tag, null, "Checkbox Style");
57
+ }
58
+ if (data.GradientStyle) {
59
+ if (data.GradientStyle.CellRanges) {
60
+ return getRanges(data.GradientStyle.CellRanges);
61
+ }
62
+ if (data.GradientStyle.ColumnComparison) {
63
+ return getColumnComparison(data.GradientStyle.ColumnComparison, api);
64
+ }
65
+ }
66
+ if (data.PercentBarStyle) {
67
+ if (data.PercentBarStyle.CellRanges) {
68
+ return getRanges(data.PercentBarStyle.CellRanges);
69
+ }
70
+ if (data.PercentBarStyle.ColumnComparison) {
71
+ return getColumnComparison(data.PercentBarStyle.ColumnComparison, api);
72
+ }
73
+ }
74
+ return React.createElement(Tag_1.Tag, null, "No Styling Defined");
75
+ };
76
+ exports.renderStyledColumnStyleSummary = renderStyledColumnStyleSummary;
77
+ const StyledColumnWizardStyleSection = (props) => {
78
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
79
+ const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
80
+ const minMaxRangeValues = React.useMemo(() => {
81
+ const columnId = data.ColumnId;
82
+ if (!columnId) {
83
+ return null;
84
+ }
85
+ const column = api.columnApi.getColumnFromId(columnId);
86
+ return {
87
+ min: api.columnApi.getMinValueForNumericColumn(column),
88
+ max: api.columnApi.getMaxValueForNumericColumn(column),
89
+ };
90
+ }, [data]);
91
+ const scope = { ColumnIds: [data.ColumnId] }; // TODO: remove scope when format column columnStyle is removed
92
+ // gradient
93
+ const onUpdateGradientStyleRanges = (ranges) => {
94
+ const GradientStyle = {
95
+ CellRanges: ranges,
96
+ };
97
+ props.onChange(Object.assign(Object.assign({}, data), { GradientStyle }));
98
+ };
99
+ const onUpdateGradientStyleColumnComparison = (columnComparison) => {
100
+ const GradientStyle = {
101
+ ColumnComparison: columnComparison,
102
+ };
103
+ props.onChange(Object.assign(Object.assign({}, data), { GradientStyle }));
104
+ };
105
+ // percentbar
106
+ const onUpdatePercentBarStyleColumnComparison = (columnComparison) => {
107
+ const PercentBarStyle = Object.assign(Object.assign({}, data.PercentBarStyle), { ColumnComparison: columnComparison });
108
+ props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle }));
109
+ };
110
+ const onUpdatePercentBarStyleRanges = (ranges) => {
111
+ const PercentBarStyle = Object.assign(Object.assign({}, data.PercentBarStyle), { CellRanges: ranges });
112
+ props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle }));
113
+ };
114
+ const onPercentBarCellTextCellValueChanged = (checked) => {
115
+ let percentBarStyle = data === null || data === void 0 ? void 0 : data.PercentBarStyle;
116
+ if (checked) {
117
+ if (!percentBarStyle.CellText) {
118
+ percentBarStyle.CellText = ['CellValue'];
119
+ }
120
+ else {
121
+ percentBarStyle.CellText.push('CellValue');
122
+ }
123
+ }
124
+ else {
125
+ if (percentBarStyle.CellText && percentBarStyle.CellText.includes('PercentageValue')) {
126
+ percentBarStyle.CellText = ['PercentageValue'];
127
+ }
128
+ else {
129
+ percentBarStyle.CellText = [];
130
+ }
131
+ }
132
+ props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
133
+ };
134
+ const onPercentBarCellTextPercentValueChanged = (checked) => {
135
+ let percentBarStyle = data === null || data === void 0 ? void 0 : data.PercentBarStyle;
136
+ if (checked) {
137
+ if (!percentBarStyle.CellText) {
138
+ percentBarStyle.CellText = ['PercentageValue'];
139
+ }
140
+ else {
141
+ percentBarStyle.CellText.push('PercentageValue');
142
+ }
143
+ }
144
+ else {
145
+ if (percentBarStyle.CellText && percentBarStyle.CellText.includes('CellValue')) {
146
+ percentBarStyle.CellText = ['CellValue'];
147
+ }
148
+ else {
149
+ percentBarStyle.CellText = [];
150
+ }
151
+ }
152
+ props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
153
+ };
154
+ const onPercentBarToolTipTextCellValueChanged = (checked) => {
155
+ let percentBarStyle = data === null || data === void 0 ? void 0 : data.PercentBarStyle;
156
+ if (checked) {
157
+ if (!percentBarStyle.ToolTipText) {
158
+ percentBarStyle.ToolTipText = ['CellValue'];
159
+ }
160
+ else {
161
+ percentBarStyle.ToolTipText.push('CellValue');
162
+ }
163
+ }
164
+ else {
165
+ if (percentBarStyle.ToolTipText && percentBarStyle.ToolTipText.includes('PercentageValue')) {
166
+ percentBarStyle.ToolTipText = ['PercentageValue'];
167
+ }
168
+ else {
169
+ percentBarStyle.ToolTipText = [];
170
+ }
171
+ }
172
+ props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
173
+ };
174
+ const onPercentBarToolTipTextPercentValueChanged = (checked) => {
175
+ let percentBarStyle = data.PercentBarStyle;
176
+ if (checked) {
177
+ if (!percentBarStyle.ToolTipText) {
178
+ percentBarStyle.ToolTipText = ['PercentageValue'];
179
+ }
180
+ else {
181
+ percentBarStyle.ToolTipText.push('PercentageValue');
182
+ }
183
+ }
184
+ else {
185
+ if (percentBarStyle.ToolTipText && percentBarStyle.ToolTipText.includes('CellValue')) {
186
+ percentBarStyle.ToolTipText = ['CellValue'];
187
+ }
188
+ else {
189
+ percentBarStyle.ToolTipText = [];
190
+ }
191
+ }
192
+ props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
193
+ };
194
+ const onUsePercentStyleColorCheckChanged = (checked) => {
195
+ let percentBarStyle = data === null || data === void 0 ? void 0 : data.PercentBarStyle;
196
+ percentBarStyle.BackColor = checked ? (0, UIHelper_1.getHexForName)(UIHelper_1.GRAY) : null;
197
+ props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
198
+ };
199
+ const onForeColorSelectChange = (color) => {
200
+ let percentBarStyle = data.PercentBarStyle;
201
+ percentBarStyle.BackColor = color;
202
+ props.onChange(Object.assign(Object.assign({}, data), { PercentBarStyle: percentBarStyle }));
203
+ };
204
+ const disabled = !data.ColumnId;
205
+ return (React.createElement(rebass_1.Box, null,
206
+ data.CheckBoxStyle && (React.createElement(Tabs_1.Tabs, null,
207
+ React.createElement(Tabs_1.Tabs.Tab, null, "Check Box Column"),
208
+ React.createElement(Tabs_1.Tabs.Content, null,
209
+ React.createElement(CheckBox_1.CheckBox, { marginLeft: 2, readOnly: true, checked: true }, "Display Column As CheckBox")))),
210
+ (data === null || data === void 0 ? void 0 : data.GradientStyle) && (React.createElement(RangesComponent_1.RangesComponent, { disabled: !data.ColumnId, minMaxRangeValues: minMaxRangeValues, api: api, scope: scope, showRangeDirection: true, ranges: (_a = data.GradientStyle) === null || _a === void 0 ? void 0 : _a.CellRanges, columnComparison: (_b = data === null || data === void 0 ? void 0 : data.GradientStyle) === null || _b === void 0 ? void 0 : _b.ColumnComparison, updateRanges: (ranges) => onUpdateGradientStyleRanges(ranges), updateColumnComparison: (columnComparison) => onUpdateGradientStyleColumnComparison(columnComparison) })),
211
+ data.PercentBarStyle && (React.createElement(React.Fragment, null,
212
+ React.createElement(RangesComponent_1.RangesComponent, { disabled: disabled, minMaxRangeValues: minMaxRangeValues, api: api, scope: scope, showRangeDirection: false, ranges: (_c = data.PercentBarStyle) === null || _c === void 0 ? void 0 : _c.CellRanges, columnComparison: (_d = data === null || data === void 0 ? void 0 : data.PercentBarStyle) === null || _d === void 0 ? void 0 : _d.ColumnComparison, updateRanges: (ranges) => onUpdatePercentBarStyleRanges(ranges), updateColumnComparison: (columnComparison) => onUpdatePercentBarStyleColumnComparison(columnComparison) }),
213
+ React.createElement(FormLayout_1.default, { marginLeft: 2, marginTop: 2 },
214
+ React.createElement(FormLayout_1.FormRow, { label: "Cell Display:" },
215
+ React.createElement(CheckBox_1.CheckBox, { disabled: disabled, marginLeft: 2, checked: (_f = (_e = data.PercentBarStyle) === null || _e === void 0 ? void 0 : _e.CellText) === null || _f === void 0 ? void 0 : _f.includes('CellValue'), onChange: (checked) => onPercentBarCellTextCellValueChanged(checked) }, "Cell Value"),
216
+ ' ',
217
+ React.createElement(CheckBox_1.CheckBox, { disabled: disabled, marginLeft: 3, checked: (_h = (_g = data === null || data === void 0 ? void 0 : data.PercentBarStyle) === null || _g === void 0 ? void 0 : _g.CellText) === null || _h === void 0 ? void 0 : _h.includes('PercentageValue'), onChange: (checked) => onPercentBarCellTextPercentValueChanged(checked) },
218
+ "Percent Value",
219
+ ' '),
220
+ ' '),
221
+ React.createElement(FormLayout_1.FormRow, { label: "ToolTip Display:" },
222
+ React.createElement(CheckBox_1.CheckBox, { disabled: disabled, marginLeft: 2, checked: (_k = (_j = data === null || data === void 0 ? void 0 : data.PercentBarStyle) === null || _j === void 0 ? void 0 : _j.ToolTipText) === null || _k === void 0 ? void 0 : _k.includes('CellValue'), onChange: (checked) => onPercentBarToolTipTextCellValueChanged(checked) }, "Cell Value"),
223
+ ' ',
224
+ React.createElement(CheckBox_1.CheckBox, { disabled: disabled, marginLeft: 3, checked: (_m = (_l = data === null || data === void 0 ? void 0 : data.PercentBarStyle) === null || _l === void 0 ? void 0 : _l.ToolTipText) === null || _m === void 0 ? void 0 : _m.includes('PercentageValue'), onChange: (checked) => onPercentBarToolTipTextPercentValueChanged(checked) },
225
+ "Percent Value",
226
+ ' '),
227
+ ' '),
228
+ React.createElement(FormLayout_1.FormRow, { label: `Back ${api.internalApi.getCorrectEnglishVariant('Colour')}` },
229
+ React.createElement(rebass_1.Flex, { alignItems: "center", marginLeft: 2 },
230
+ React.createElement(CheckBox_1.CheckBox, { disabled: disabled, checked: !!((_o = data.PercentBarStyle) === null || _o === void 0 ? void 0 : _o.BackColor), onChange: (checked) => onUsePercentStyleColorCheckChanged(checked), mr: 2 }),
231
+ ((_p = data.PercentBarStyle) === null || _p === void 0 ? void 0 : _p.BackColor) !== undefined && (React.createElement(ColorPicker_1.ColorPicker, { disabled: disabled, api: api, value: (_q = data.PercentBarStyle) === null || _q === void 0 ? void 0 : _q.BackColor, onChange: (x) => onForeColorSelectChange(x) }))))))),
232
+ !data.ColumnId && React.createElement(ErrorBox_1.default, { mt: 2 }, "You need to select a column before styling.")));
233
+ };
234
+ exports.StyledColumnWizardStyleSection = StyledColumnWizardStyleSection;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { StyledColumn } from '../../../PredefinedConfig/StyledColumnState';
3
+ export declare const renderStyledColumnTypeSummary: (data: StyledColumn) => JSX.Element;
4
+ export interface StyledColumnWizardTypeSectionProps {
5
+ onChange: (styledColumn: StyledColumn) => void;
6
+ }
7
+ export declare const StyledColumnWizardTypeSection: React.FunctionComponent<StyledColumnWizardTypeSectionProps>;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StyledColumnWizardTypeSection = exports.renderStyledColumnTypeSummary = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const rebass_1 = require("rebass");
7
+ const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
8
+ const Tabs_1 = require("../../../components/Tabs");
9
+ const Tag_1 = require("../../../components/Tag");
10
+ const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
11
+ const renderStyledColumnTypeSummary = (data) => {
12
+ let type = null;
13
+ if (data.GradientStyle) {
14
+ type = 'Gradient Column';
15
+ }
16
+ else if (data.PercentBarStyle) {
17
+ type = 'Percent Bar';
18
+ }
19
+ else if (data.CheckBoxStyle) {
20
+ type = 'Check Box';
21
+ }
22
+ return (React.createElement(rebass_1.Text, { pr: 2, py: 2 },
23
+ "Type ",
24
+ React.createElement(Tag_1.Tag, null, type)));
25
+ };
26
+ exports.renderStyledColumnTypeSummary = renderStyledColumnTypeSummary;
27
+ const StyledColumnWizardTypeSection = (props) => {
28
+ const { data } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
29
+ const handleTypeChange = (type) => {
30
+ const newStyledColumn = Object.assign({}, data);
31
+ switch (type) {
32
+ case 'gradient':
33
+ newStyledColumn.GradientStyle = {};
34
+ delete newStyledColumn.PercentBarStyle;
35
+ delete newStyledColumn.CheckBoxStyle;
36
+ break;
37
+ case 'percent':
38
+ newStyledColumn.PercentBarStyle = {};
39
+ delete newStyledColumn.GradientStyle;
40
+ delete newStyledColumn.CheckBoxStyle;
41
+ break;
42
+ case 'checkbox':
43
+ newStyledColumn.CheckBoxStyle = true;
44
+ delete newStyledColumn.GradientStyle;
45
+ delete newStyledColumn.PercentBarStyle;
46
+ break;
47
+ }
48
+ newStyledColumn.ColumnId = null;
49
+ props.onChange(newStyledColumn);
50
+ };
51
+ return (React.createElement(rebass_1.Flex, { height: "100%", flexDirection: "column", "data-name": "styled-column-type" },
52
+ React.createElement(Tabs_1.Tabs, { autoFocus: false, padding: 2 },
53
+ React.createElement(Tabs_1.Tabs.Tab, null, "Type"),
54
+ React.createElement(Tabs_1.Tabs.Content, null,
55
+ React.createElement(Radio_1.default, { checked: Boolean(data.GradientStyle), onChange: () => handleTypeChange('gradient') }, "Gradient Column"),
56
+ React.createElement(Radio_1.default, { onChange: () => handleTypeChange('percent'), checked: Boolean(data.PercentBarStyle) }, "Percent Bar"),
57
+ React.createElement(Radio_1.default, { onChange: () => handleTypeChange('checkbox'), checked: Boolean(data.CheckBoxStyle) }, "Check Box")))));
58
+ };
59
+ exports.StyledColumnWizardTypeSection = StyledColumnWizardTypeSection;
@@ -7,6 +7,7 @@ const AdaptableObjectRow_1 = require("../Components/AdaptableObjectRow");
7
7
  const rebass_1 = require("rebass");
8
8
  const UIHelper_1 = tslib_1.__importDefault(require("../UIHelper"));
9
9
  const Helper_1 = require("../../Utilities/Helpers/Helper");
10
+ const join_1 = tslib_1.__importDefault(require("../../components/utils/join"));
10
11
  class SystemStatusEntityRow extends React.Component {
11
12
  render() {
12
13
  var _a;
@@ -15,15 +16,12 @@ class SystemStatusEntityRow extends React.Component {
15
16
  let messageTypeColor = UIHelper_1.default.getColorByMessageType((_a = systemStatus === null || systemStatus === void 0 ? void 0 : systemStatus.statusType) !== null && _a !== void 0 ? _a : 'Success');
16
17
  let colItems = (0, Helper_1.cloneObject)(this.props.colItems);
17
18
  colItems[0].Content = systemStatus ? (React.createElement("details", null,
18
- React.createElement(rebass_1.Flex, { title: systemStatus.statusFurtherInformation ? 'Click to see more' : '', style: {
19
- borderRadius: 'var(--ab__border-radius)',
20
- fontWeight: 'bold',
21
- cursor: systemStatus.statusFurtherInformation ? 'pointer' : 'auto',
22
- }, className: "ab-DashboardToolbar__SystemStatus__text", marginRight: 2, padding: 2, color: 'text-on-secondary', backgroundColor: messageTypeColor, fontSize: 'var( --ab-font-size-2)', alignItems: "center", as: "summary" },
19
+ React.createElement(rebass_1.Flex, { title: systemStatus.statusFurtherInformation ? 'Click to see more' : '', className: (0, join_1.default)('ab-DashboardToolbar__SystemStatus__text', systemStatus.statusFurtherInformation &&
20
+ 'ab-DashboardToolbar__SystemStatus__text--expandable'), backgroundColor: messageTypeColor, alignItems: "center", as: "summary" },
23
21
  systemStatus.statusMessage,
24
22
  " ",
25
23
  systemStatus.statusFurtherInformation ? '...' : ''),
26
- systemStatus.statusFurtherInformation ? (React.createElement(rebass_1.Box, { margin: 2, style: { whiteSpace: 'normal' } }, systemStatus.statusFurtherInformation)) : null)) : null;
24
+ systemStatus.statusFurtherInformation ? (React.createElement(rebass_1.Box, { className: "ab-DashboardToolbar__SystemStatus__further-information", margin: 2 }, systemStatus.statusFurtherInformation)) : null)) : null;
27
25
  colItems[1].Content = systemStatus.timestamp.toLocaleString();
28
26
  return React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: colItems });
29
27
  }
@@ -8,5 +8,5 @@ declare class SystemStatusViewPanelComponent extends React.Component<SystemStatu
8
8
  constructor(props: SystemStatusViewPanelComponentProps);
9
9
  render(): JSX.Element;
10
10
  }
11
- export declare let SystemStatusViewPanel: import("react-redux").ConnectedComponent<typeof SystemStatusViewPanelComponent, import("react-redux").Omit<React.ClassAttributes<SystemStatusViewPanelComponent> & SystemStatusViewPanelComponentProps, "api" | "moduleInfo" | "accessLevel" | "SystemStatusMessageInfos" | "viewType">>;
11
+ export declare let SystemStatusViewPanel: import("react-redux").ConnectedComponent<typeof SystemStatusViewPanelComponent, import("react-redux").Omit<React.ClassAttributes<SystemStatusViewPanelComponent> & SystemStatusViewPanelComponentProps, "api" | "accessLevel" | "moduleInfo" | "SystemStatusMessageInfos" | "viewType">>;
12
12
  export {};
@@ -19,7 +19,7 @@ const SharedEntityTypeItemView = (props) => {
19
19
  React.createElement(rebass_1.Flex, { mb: 2, mt: 2 },
20
20
  React.createElement(rebass_1.Flex, { mr: 2, alignItems: "center" },
21
21
  React.createElement(Tag_1.Tag, { style: { margin: 0 } }, props.data.Module)),
22
- isExpanded ? (React.createElement(SimpleButton_1.default, { onClick: () => setIsExpanded(false), icon: "arrow-up" }, "Collapse")) : (React.createElement(SimpleButton_1.default, { onClick: () => setIsExpanded(true), icon: "arrow-down" }, "Expand"))),
22
+ isExpanded ? (React.createElement(SimpleButton_1.default, { "data-name": "shared-entity-collapse-button", onClick: () => setIsExpanded(false), icon: "arrow-up" }, "Collapse")) : (React.createElement(SimpleButton_1.default, { "data-name": "shared-entity-epxand-button", onClick: () => setIsExpanded(true), icon: "arrow-down" }, "Expand"))),
23
23
  isExpanded && (React.createElement(rebass_1.Box, { as: "ul", padding: 0, className: "ab-Shared-Entity-Shared-Object" },
24
24
  React.createElement(AdaptableObjectList_1.AdaptableObjectListItem, { hideControls: true, data: item, module: module })))));
25
25
  };
@@ -10,6 +10,6 @@ const TeamSharingApplyButton = (props) => {
10
10
  const handleImport = React.useCallback(() => {
11
11
  adaptable.api.teamSharingApi.importSharedEntry(props.data);
12
12
  }, []);
13
- return (React.createElement(SimpleButton_1.default, { onClick: handleImport, variant: "text", tooltip: "Apply Adaptable Object", icon: "import-export" }));
13
+ return (React.createElement(SimpleButton_1.default, { "data-name": "shared-entity-apply-button", onClick: handleImport, variant: "text", tooltip: "Apply Adaptable Object", icon: "import-export" }));
14
14
  };
15
15
  exports.TeamSharingApplyButton = TeamSharingApplyButton;
@@ -38,7 +38,7 @@ class ThemePopupComponent extends React.Component {
38
38
  return (React.createElement(PopupPanel_1.PopupPanel, { headerText: this.props.moduleInfo.FriendlyName, glyphicon: this.props.moduleInfo.Glyph, infoLink: this.props.moduleInfo.HelpPage, infoLinkDisabled: !this.props.api.internalApi.isDocumentationLinksDisplayed() },
39
39
  React.createElement(FormLayout_1.default, null,
40
40
  React.createElement(FormLayout_1.FormRow, { label: "Current Theme:" },
41
- React.createElement(DropdownButton_1.default, { columns: ['label'], style: { width: '50%', minWidth: 200 }, placeholder: "Select theme", value: this.props.CurrentTheme, items: optionThemes, accessLevel: this.props.accessLevel }, currentThemeDescription)))));
41
+ React.createElement(DropdownButton_1.default, { "data-name": "select-theme-dropdown", columns: ['label'], style: { width: '50%', minWidth: 200 }, placeholder: "Select theme", value: this.props.CurrentTheme, items: optionThemes, accessLevel: this.props.accessLevel }, currentThemeDescription)))));
42
42
  }
43
43
  onChangeTheme(value) {
44
44
  this.props.SelectTheme(value);
@@ -22,7 +22,7 @@ export interface OnePageAdaptableWizardSection<ENTITY> {
22
22
  isValid?: (data: ENTITY, api: AdaptableApi, context: OnePageAdaptableWizardContextType<ENTITY>) => true | string;
23
23
  isVisible?: (data: ENTITY, api: AdaptableApi, context: OnePageAdaptableWizardContextType<ENTITY>) => boolean;
24
24
  render: (data: ENTITY, index: number) => React.ReactNode;
25
- renderSummary?: (data: ENTITY) => React.ReactNode;
25
+ renderSummary?: (data: ENTITY, api: AdaptableApi) => React.ReactNode;
26
26
  }
27
27
  export interface OnePageAdaptableWizardProps<ENTITY> {
28
28
  moduleInfo: ModuleInfo;
@@ -76,7 +76,6 @@ const OnePageAdaptableWizard = (props) => {
76
76
  exports.OnePageAdaptableWizard = OnePageAdaptableWizard;
77
77
  const OnePageWizardSummary = () => {
78
78
  const { setCurrentSection, sections, data } = (0, OnePageWizards_1.useOnePageWizardContext)();
79
- const { api } = useOnePageAdaptableWizardContext();
80
79
  const renderEdit = (index) => (React.createElement(SimpleButton_1.default, { px: 1, variant: "text", style: {
81
80
  textDecoration: 'underline',
82
81
  display: 'inline-block',
@@ -84,7 +83,7 @@ const OnePageWizardSummary = () => {
84
83
  }, onClick: () => {
85
84
  setCurrentSection(index);
86
85
  } }, "edit"));
87
- return (React.createElement(React.Fragment, null, sections
86
+ return (React.createElement(rebass_1.Box, { className: "ab-OnePageWizardSummary" }, sections
88
87
  .map((section, index) => {
89
88
  if (section === '-') {
90
89
  return null;
@@ -1,8 +1,10 @@
1
+ /// <reference types="react" />
1
2
  import { ICellRendererComp, ICellRendererParams } from '@ag-grid-community/core';
2
3
  import { ActionColumn } from '../AdaptableOptions/ActionOptions';
3
4
  interface ActionColumnCellRendererParams extends ICellRendererParams {
4
5
  actionColumn?: ActionColumn;
5
6
  }
7
+ export declare const ReactActionColumnRenderer: (props: ActionColumnCellRendererParams) => JSX.Element;
6
8
  export declare class ActionColumnRenderer implements ICellRendererComp {
7
9
  private eGui;
8
10
  private eventListener;
@@ -1,76 +1,108 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionColumnRenderer = void 0;
3
+ exports.ActionColumnRenderer = exports.ReactActionColumnRenderer = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const SimpleButton_1 = tslib_1.__importDefault(require("../components/SimpleButton"));
6
6
  const React = tslib_1.__importStar(require("react"));
7
7
  const uuid_1 = require("../components/utils/uuid");
8
+ const useRerender_1 = require("../components/utils/useRerender");
9
+ function getActionButtonsAndActionColumn(adaptable, actionColumn, colId) {
10
+ var _a;
11
+ const actionCol = actionColumn
12
+ ? actionColumn
13
+ : (_a = adaptable.api.actionApi.getAllActionColumn()) === null || _a === void 0 ? void 0 : _a.find((ac) => ac.columnId == colId);
14
+ if (actionCol && actionCol.actionColumnButton) {
15
+ let actionButtons = Array.isArray(actionCol.actionColumnButton)
16
+ ? actionCol.actionColumnButton
17
+ : [actionCol.actionColumnButton];
18
+ if (!actionButtons.length) {
19
+ return;
20
+ }
21
+ // actionButtons don't have IDs, so we need to generate them to be used later as a react component key
22
+ actionButtons = actionButtons.map((actionButton) => (Object.assign(Object.assign({}, actionButton), { Uuid: (0, uuid_1.createUuid)() })));
23
+ return { actionButtons, actionColumn: actionCol };
24
+ }
25
+ return {
26
+ actionButtons: [],
27
+ actionColumn: actionCol,
28
+ };
29
+ }
30
+ const renderActionButtons = (buttons, adaptableApi, context, rerender) => {
31
+ return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
32
+ var _a, _b;
33
+ if (button.hidden && button.hidden(button, context)) {
34
+ return;
35
+ }
36
+ const buttonIcon = adaptableApi.internalApi.getIconForButton(button, context, {
37
+ height: 15,
38
+ width: 15,
39
+ });
40
+ const buttonStyle = adaptableApi.internalApi.getStyleForButton(button, context);
41
+ const buttonLabel = adaptableApi.internalApi.getLabelForButton(button, context);
42
+ const buttonTooltip = adaptableApi.internalApi.getTooltipForButton(button, context);
43
+ const handleClick = () => {
44
+ var _a;
45
+ (_a = button.onClick) === null || _a === void 0 ? void 0 : _a.call(button, button, context);
46
+ // Timeout to let any updates to be done before re-rendering the component
47
+ setTimeout(() => {
48
+ // when called again it triggers a re-render
49
+ // https:reactjs.org/docs/react-dom.html#render
50
+ rerender();
51
+ }, 16);
52
+ };
53
+ const disabled = button.disabled && button.disabled(button, context);
54
+ return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${index + 1}`, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, tone: (_b = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _b !== void 0 ? _b : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' }, buttonLabel));
55
+ })));
56
+ };
57
+ const ReactActionColumnRenderer = (props) => {
58
+ const rerender = (0, useRerender_1.useRerender)();
59
+ const adaptable = props.api.__adaptable;
60
+ const { actionButtons, actionColumn } = getActionButtonsAndActionColumn(adaptable, props.actionColumn, props.colDef.colId);
61
+ if (!actionColumn || !actionButtons.length) {
62
+ return null;
63
+ }
64
+ if (adaptable.api.gridApi.isGroupRowNode(props.node) && !actionColumn.includeGroupedRows) {
65
+ return null;
66
+ }
67
+ const pkValue = adaptable.getPrimaryKeyValueFromRowNode(props.node);
68
+ const buttonContext = {
69
+ actionColumn,
70
+ primaryKeyValue: pkValue,
71
+ rowNode: props.node,
72
+ adaptableApi: adaptable.api,
73
+ };
74
+ return (React.createElement("div", { className: "ab-ActionColumn" }, renderActionButtons(actionButtons, adaptable.api, buttonContext, rerender)));
75
+ };
76
+ exports.ReactActionColumnRenderer = ReactActionColumnRenderer;
8
77
  class ActionColumnRenderer {
9
78
  // gets called once before the renderer is used
10
79
  init(params) {
11
- var _a;
12
80
  const adaptable = params.api.__adaptable;
13
- const actionCol = params.actionColumn
14
- ? params.actionColumn
15
- : (_a = adaptable.api.actionApi
16
- .getAllActionColumn()) === null || _a === void 0 ? void 0 : _a.find((ac) => ac.columnId == params.colDef.colId);
17
- if (actionCol && actionCol.actionColumnButton) {
18
- let actionButtons = Array.isArray(actionCol.actionColumnButton)
19
- ? actionCol.actionColumnButton
20
- : [actionCol.actionColumnButton];
21
- if (!actionButtons.length) {
22
- return;
23
- }
24
- // actionButtons don't have IDs, so we need to generate them to be used later as a react component key
25
- actionButtons = actionButtons.map((actionButton) => (Object.assign(Object.assign({}, actionButton), { Uuid: (0, uuid_1.createUuid)() })));
26
- // create the cell
27
- this.eGui = document.createElement('div');
28
- this.eGui.className = 'ab-ActionColumn';
29
- // if its a group node then only show if set to do so
30
- if (adaptable.api.gridApi.isGroupRowNode(params.node) && !actionCol.includeGroupedRows) {
31
- this.eGui.innerHTML = '';
32
- return;
33
- }
34
- const pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
35
- const buttonContext = {
36
- actionColumn: actionCol,
37
- primaryKeyValue: pkValue,
38
- rowNode: params.node,
39
- adaptableApi: adaptable.api,
40
- };
41
- const renderActionButtons = (buttons, adaptableApi, context) => {
42
- return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
43
- var _a, _b;
44
- if (button.hidden && button.hidden(button, context)) {
45
- return;
46
- }
47
- const buttonIcon = adaptableApi.internalApi.getIconForButton(button, context, {
48
- height: 15,
49
- width: 15,
50
- });
51
- const buttonStyle = adaptableApi.internalApi.getStyleForButton(button, context);
52
- const buttonLabel = adaptableApi.internalApi.getLabelForButton(button, context);
53
- const buttonTooltip = adaptableApi.internalApi.getTooltipForButton(button, context);
54
- const handleClick = () => {
55
- button.onClick(button, context);
56
- // Timeout to let any updates to be done before re-rendering the component
57
- setTimeout(() => {
58
- // when called again it triggers a re-render
59
- // https:reactjs.org/docs/react-dom.html#render
60
- doRender();
61
- }, 16);
62
- };
63
- const disabled = button.disabled && button.disabled(button, context);
64
- return (React.createElement(SimpleButton_1.default, { key: button.Uuid, "data-name": `action-button-${index + 1}`, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, icon: buttonIcon, tone: (_b = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _b !== void 0 ? _b : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' }, buttonLabel));
65
- })));
66
- };
67
- const eGui = this.eGui;
68
- const doRender = () => {
69
- this.unmountReactRoot = adaptable.renderReactRoot(renderActionButtons(actionButtons, adaptable.api, buttonContext), eGui);
70
- };
71
- this.render = doRender;
72
- doRender();
81
+ const { actionButtons, actionColumn } = getActionButtonsAndActionColumn(adaptable, params.actionColumn, params.colDef.colId);
82
+ if (!actionColumn || !actionButtons.length) {
83
+ return;
84
+ }
85
+ // create the cell
86
+ this.eGui = document.createElement('div');
87
+ this.eGui.className = 'ab-ActionColumn';
88
+ // if its a group node then only show if set to do so
89
+ if (adaptable.api.gridApi.isGroupRowNode(params.node) && !actionColumn.includeGroupedRows) {
90
+ this.eGui.innerHTML = '';
91
+ return;
73
92
  }
93
+ const pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
94
+ const buttonContext = {
95
+ actionColumn,
96
+ primaryKeyValue: pkValue,
97
+ rowNode: params.node,
98
+ adaptableApi: adaptable.api,
99
+ };
100
+ const eGui = this.eGui;
101
+ const doRender = () => {
102
+ this.unmountReactRoot = adaptable.renderReactRoot(renderActionButtons(actionButtons, adaptable.api, buttonContext, doRender), eGui);
103
+ };
104
+ this.render = doRender;
105
+ doRender();
74
106
  }
75
107
  // defined on init
76
108
  // used to re-render in refresh