@adaptabletools/adaptable 23.0.0-canary.4 → 23.0.0-canary.5

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 (248) hide show
  1. package/index.css +116 -61
  2. package/package.json +9 -4
  3. package/src/AdaptableOptions/EditOptions.d.ts +2 -2
  4. package/src/AdaptableState/Common/AggregationColumns.d.ts +14 -6
  5. package/src/AdaptableState/Common/AggregationColumns.js +27 -2
  6. package/src/AdaptableState/Common/ColumnScope.d.ts +4 -0
  7. package/src/AdaptableState/Common/Enums.d.ts +5 -5
  8. package/src/AdaptableState/Common/Enums.js +4 -4
  9. package/src/AdaptableState/PlusMinusState.d.ts +3 -3
  10. package/src/AdaptableState/ShortcutState.d.ts +2 -6
  11. package/src/AdaptableState/StyledColumnState.d.ts +3 -5
  12. package/src/AdaptableState/ThemeState.d.ts +33 -28
  13. package/src/Api/EventApi.d.ts +14 -1
  14. package/src/Api/Events/ThemeChanged.d.ts +6 -0
  15. package/src/Api/Events/ThemeSelected.d.ts +11 -0
  16. package/src/Api/Events/ThemeSelected.js +1 -0
  17. package/src/Api/Implementation/EventApiImpl.js +4 -0
  18. package/src/Api/Implementation/LayoutApiImpl.d.ts +0 -2
  19. package/src/Api/Implementation/LayoutApiImpl.js +0 -14
  20. package/src/Api/Implementation/LayoutHelpers.d.ts +2 -0
  21. package/src/Api/Implementation/LayoutHelpers.js +17 -7
  22. package/src/Api/Implementation/ThemeApiImpl.d.ts +3 -2
  23. package/src/Api/Implementation/ThemeApiImpl.js +19 -15
  24. package/src/Api/Internal/EventInternalApi.d.ts +2 -0
  25. package/src/Api/Internal/EventInternalApi.js +8 -1
  26. package/src/Api/Internal/StyledColumnInternalApi.d.ts +4 -4
  27. package/src/Api/Internal/StyledColumnInternalApi.js +4 -4
  28. package/src/Api/Internal/ThemeInternalApi.d.ts +0 -1
  29. package/src/Api/Internal/ThemeInternalApi.js +0 -10
  30. package/src/Api/LayoutApi.d.ts +1 -8
  31. package/src/Api/ThemeApi.d.ts +6 -2
  32. package/src/Redux/ActionsReducers/ThemeRedux.d.ts +3 -3
  33. package/src/Strategy/FormatColumnModule.js +14 -7
  34. package/src/Strategy/LayoutModule.js +13 -8
  35. package/src/Strategy/StyledColumnModule.js +64 -36
  36. package/src/Utilities/Constants/ReduxConstants.d.ts +2 -2
  37. package/src/Utilities/Constants/ReduxConstants.js +1 -14
  38. package/src/Utilities/Helpers/FormatHelper.js +20 -1
  39. package/src/Utilities/Helpers/SparklineOptionsHelper.d.ts +7 -0
  40. package/src/Utilities/Helpers/SparklineOptionsHelper.js +65 -0
  41. package/src/Utilities/Helpers/StyledColumnGradientHelper.d.ts +23 -1
  42. package/src/Utilities/Helpers/StyledColumnGradientHelper.js +204 -0
  43. package/src/Utilities/Helpers/ThemeHelpers.d.ts +5 -0
  44. package/src/Utilities/Helpers/ThemeHelpers.js +38 -0
  45. package/src/Utilities/Helpers/percentBarPreviewHelper.d.ts +19 -0
  46. package/src/Utilities/Helpers/percentBarPreviewHelper.js +143 -0
  47. package/src/Utilities/ObjectFactory.d.ts +1 -3
  48. package/src/Utilities/ObjectFactory.js +0 -8
  49. package/src/Utilities/Services/ThemeService.js +1 -1
  50. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +17 -16
  51. package/src/View/Alert/Wizard/AlertButtonsEditor.js +114 -103
  52. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +13 -14
  53. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +55 -55
  54. package/src/View/Alert/Wizard/AlertRulesWizardSection.js +3 -2
  55. package/src/View/Alert/Wizard/AlertScheduledWizardSection.js +2 -2
  56. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +31 -39
  57. package/src/View/Alert/Wizard/AlertTypeWizardSection.js +3 -4
  58. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +9 -13
  59. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +30 -17
  60. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +7 -9
  61. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +3 -3
  62. package/src/View/CellSummary/CellSummaryViewPanel.js +1 -1
  63. package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.js +3 -10
  64. package/src/View/Charting/ChartingWizard/AgChargingWizard/PreviewChartSection.js +1 -1
  65. package/src/View/Charting/ChartingWizard/AgChargingWizard/SettingsSection.js +32 -41
  66. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.js +4 -31
  67. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/PreviewChartSection.d.ts +5 -0
  68. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/PreviewChartSection.js +21 -0
  69. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.d.ts +1 -0
  70. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/SettingsSection.js +10 -7
  71. package/src/View/Comments/CommentsEditor.js +1 -1
  72. package/src/View/Components/ModuleProfile.js +1 -1
  73. package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
  74. package/src/View/Components/Popups/WindowPopups/windowFactory.js +0 -1
  75. package/src/View/Components/RangesComponent.d.ts +7 -2
  76. package/src/View/Components/RangesComponent.js +94 -22
  77. package/src/View/Components/StyleComponent.d.ts +1 -0
  78. package/src/View/Components/StyleComponent.js +1 -1
  79. package/src/View/Components/ValueSelector/index.js +70 -57
  80. package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +8 -13
  81. package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +8 -8
  82. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -1
  83. package/src/View/DataImport/DataImportWizard/sections/ColumnsSection.js +11 -12
  84. package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadSection.js +6 -4
  85. package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadTextSection.js +3 -2
  86. package/src/View/DataImport/DataImportWizard/sections/ValidationSection.js +5 -15
  87. package/src/View/Export/Wizard/ReportColumnsWizardSection.js +24 -26
  88. package/src/View/Export/Wizard/ReportNameWizardSection.js +10 -13
  89. package/src/View/Export/Wizard/ReportRowsWizardSection.js +20 -22
  90. package/src/View/Export/Wizard/ScheduledReportSettings.d.ts +2 -0
  91. package/src/View/Export/Wizard/ScheduledReportSettings.js +13 -13
  92. package/src/View/Export/Wizard/ScheduledReportWizard.js +4 -5
  93. package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +8 -6
  94. package/src/View/FlashingCell/Wizard/FlashingCellScopeWizardSection.js +21 -22
  95. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +20 -11
  96. package/src/View/FlashingCell/Wizard/FlashingCellStyleWizardSection.js +21 -5
  97. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +4 -4
  98. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +7 -0
  99. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +117 -12
  100. package/src/View/FormatColumn/Wizard/FormatColumnPreview.d.ts +15 -0
  101. package/src/View/FormatColumn/Wizard/FormatColumnPreview.js +66 -0
  102. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.d.ts +4 -0
  103. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +30 -0
  104. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +13 -8
  105. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +1 -1
  106. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.d.ts +3 -1
  107. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +62 -13
  108. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +5 -3
  109. package/src/View/FreeTextColumn/Utilities/getFreeTextColumnSettingsTags.d.ts +2 -0
  110. package/src/View/FreeTextColumn/Utilities/getFreeTextColumnSettingsTags.js +15 -0
  111. package/src/View/FreeTextColumn/Wizard/FreeTextColumnDefinitionWizardSection.d.ts +10 -0
  112. package/src/View/FreeTextColumn/Wizard/FreeTextColumnDefinitionWizardSection.js +53 -0
  113. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +2 -3
  114. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +33 -68
  115. package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +15 -11
  116. package/src/View/Layout/TransposedPopup.js +2 -2
  117. package/src/View/Layout/Wizard/LayoutWizard.js +3 -3
  118. package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +2 -3
  119. package/src/View/Layout/Wizard/sections/AggregationsSection.js +115 -26
  120. package/src/View/Layout/Wizard/sections/ColumnsSection.js +79 -79
  121. package/src/View/Layout/Wizard/sections/FilterSection.js +31 -32
  122. package/src/View/Layout/Wizard/sections/GridFilterSection.js +11 -11
  123. package/src/View/Layout/Wizard/sections/PivotAggregationsSection.d.ts +1 -2
  124. package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +101 -52
  125. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +9 -8
  126. package/src/View/Layout/Wizard/sections/PivotRowGroupingSection.js +4 -4
  127. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +36 -33
  128. package/src/View/Layout/Wizard/sections/RowSelectionSection.js +2 -2
  129. package/src/View/Layout/Wizard/sections/RowSummarySection.js +95 -73
  130. package/src/View/Layout/Wizard/sections/SettingsSection.js +4 -5
  131. package/src/View/Layout/Wizard/sections/SortSection.js +2 -2
  132. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
  133. package/src/View/NamedQuery/Wizard/NamedQuerySettingsWizardSection.js +9 -14
  134. package/src/View/NamedQuery/Wizard/NamedQueryWizard.js +1 -3
  135. package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.d.ts +4 -0
  136. package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +43 -13
  137. package/src/View/PlusMinus/Wizard/PlusMinusScopeWizardSection.js +11 -18
  138. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.d.ts +2 -6
  139. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +6 -22
  140. package/src/View/PlusMinus/Wizard/PlusMinusWizard.js +15 -21
  141. package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +2 -2
  142. package/src/View/Shortcut/Wizard/ShortcutScopeWizardSection.js +11 -18
  143. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +17 -6
  144. package/src/View/Shortcut/Wizard/ShortcutWizard.js +3 -3
  145. package/src/View/Shortcut/shortcutOperations.d.ts +3 -0
  146. package/src/View/Shortcut/shortcutOperations.js +28 -0
  147. package/src/View/SpecialColumnSettingsWizardStep.js +9 -8
  148. package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +5 -0
  149. package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.js +24 -15
  150. package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.d.ts +10 -2
  151. package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +96 -16
  152. package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +14 -0
  153. package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.js +45 -24
  154. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.d.ts +2 -3
  155. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +108 -33
  156. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +21 -13
  157. package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.d.ts +5 -0
  158. package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +121 -23
  159. package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.d.ts +1 -0
  160. package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.js +34 -11
  161. package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.d.ts +5 -0
  162. package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +86 -12
  163. package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.d.ts +5 -0
  164. package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +121 -34
  165. package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.d.ts +1 -0
  166. package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.js +55 -75
  167. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.d.ts +5 -0
  168. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/BulletRangesSummaryPreview.js +16 -0
  169. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/GradientSummaryPreview.js +7 -13
  170. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarColumnComparisonPreview.js +5 -5
  171. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarRangesPreview.js +4 -3
  172. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarStylePreview.d.ts +5 -4
  173. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarStylePreview.js +12 -14
  174. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.d.ts +5 -0
  175. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/RangeBarRangesSummaryPreview.js +16 -0
  176. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.d.ts +3 -0
  177. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.js +31 -3
  178. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.d.ts +9 -0
  179. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview.js +58 -0
  180. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview.d.ts +10 -0
  181. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview.js +30 -0
  182. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.d.ts +10 -0
  183. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview.js +91 -0
  184. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.d.ts +8 -0
  185. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview.js +52 -0
  186. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.d.ts +8 -0
  187. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview.js +53 -0
  188. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.d.ts +18 -0
  189. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview.js +58 -0
  190. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview.d.ts +10 -0
  191. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview.js +126 -0
  192. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardRangesSection.js +12 -5
  193. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.d.ts +1 -5
  194. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +52 -29
  195. package/src/View/SystemStatus/Utilities/getStatusItemStyle.js +1 -1
  196. package/src/View/Theme/ThemePopup.d.ts +2 -14
  197. package/src/View/Theme/ThemePopup.js +1 -36
  198. package/src/View/UIHelper.js +1 -1
  199. package/src/View/Wizard/OnePageAdaptableWizard.js +7 -21
  200. package/src/agGrid/AdaptableAgGrid.d.ts +1 -0
  201. package/src/agGrid/AdaptableAgGrid.js +35 -25
  202. package/src/agGrid/AgGridAdapter.d.ts +1 -1
  203. package/src/agGrid/AgGridAdapter.js +27 -17
  204. package/src/agGrid/AgGridColumnAdapter.js +9 -15
  205. package/src/agGrid/AgGridMenuAdapter.d.ts +0 -1
  206. package/src/agGrid/AgGridMenuAdapter.js +20 -37
  207. package/src/agGrid/buildValueAggregationMenuItem.d.ts +19 -0
  208. package/src/agGrid/buildValueAggregationMenuItem.js +111 -0
  209. package/src/agGrid/cellRenderers/IconRenderer.d.ts +6 -0
  210. package/src/agGrid/cellRenderers/IconRenderer.js +43 -15
  211. package/src/agGrid/createAgGridIcon.d.ts +10 -0
  212. package/src/agGrid/createAgGridIcon.js +16 -0
  213. package/src/components/DragAndDropContext/UnusedPanel.js +1 -1
  214. package/src/components/ExpressionEditor/BaseEditorInput.js +1 -1
  215. package/src/components/ExpressionEditor/ExpressionFunctionDocumentation.js +1 -1
  216. package/src/components/Input/NumberInput.js +1 -1
  217. package/src/components/Panel/index.js +1 -1
  218. package/src/components/SimpleButton/index.js +4 -4
  219. package/src/components/Toggle/Toggle.js +1 -1
  220. package/src/components/Toggle/ToggleGroup.js +1 -1
  221. package/src/env.js +2 -2
  222. package/src/layout-manager/src/index.js +2 -9
  223. package/src/metamodel/adaptable.metamodel.d.ts +39 -29
  224. package/src/metamodel/adaptable.metamodel.js +1 -1
  225. package/src/types.d.ts +5 -4
  226. package/themes/dark.css +1 -68
  227. package/themes/light.css +1 -5
  228. package/tsconfig.esm.tsbuildinfo +1 -1
  229. package/src/Aggregation/ParameterizedAggregationRegistry.d.ts +0 -35
  230. package/src/Aggregation/ParameterizedAggregationRegistry.js +0 -63
  231. package/src/Aggregation/definitions/weightedAverageAggregationDefinition.d.ts +0 -3
  232. package/src/Aggregation/definitions/weightedAverageAggregationDefinition.js +0 -55
  233. package/src/Aggregation/parameterizedAggregationColumnMenu.d.ts +0 -8
  234. package/src/Aggregation/parameterizedAggregationColumnMenu.js +0 -137
  235. package/src/Aggregation/parameterizedAggregationHeader.d.ts +0 -13
  236. package/src/Aggregation/parameterizedAggregationHeader.js +0 -60
  237. package/src/Aggregation/parameterizedAggregationHelpers.d.ts +0 -23
  238. package/src/Aggregation/parameterizedAggregationHelpers.js +0 -111
  239. package/src/Aggregation/parameterizedAggregationWizardHelpers.d.ts +0 -9
  240. package/src/Aggregation/parameterizedAggregationWizardHelpers.js +0 -66
  241. package/src/Aggregation/validateParameterizedAggregations.d.ts +0 -4
  242. package/src/Aggregation/validateParameterizedAggregations.js +0 -20
  243. package/src/View/Layout/Wizard/sections/ParameterizedAggFuncPicker.d.ts +0 -12
  244. package/src/View/Layout/Wizard/sections/ParameterizedAggFuncPicker.js +0 -43
  245. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.d.ts +0 -5
  246. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.js +0 -28
  247. package/src/View/Theme/VariantSelector.d.ts +0 -8
  248. package/src/View/Theme/VariantSelector.js +0 -20
@@ -9,8 +9,7 @@ import { LayoutCloneButton } from '../View/Layout/LayoutCloneButton';
9
9
  import { LayoutWizard } from '../View/Layout/Wizard/LayoutWizard';
10
10
  import { getLayoutFilterViewItems } from './Utilities/Layout/getLayoutFilterViewItems';
11
11
  import { getLayoutSortViewItems } from './Utilities/Layout/getLayoutSortViewItems';
12
- import { isParameterizedAggregation } from '../Aggregation/ParameterizedAggregationRegistry';
13
- import { getParameterizedAggregationDisplayName } from '../Aggregation/parameterizedAggregationHeader';
12
+ import { WEIGHTED_AVERAGE_AGG_FN_NAME } from '../AdaptableState/Common/AggregationColumns';
14
13
  import { SHOW_PIVOT_COLUMN_DETAILS } from '../View/Components/Popups/WindowPopups/windowFactory';
15
14
  import flattenDeep from '../Utilities/utils/flattenDeep';
16
15
  import StringExtensions from '../Utilities/Extensions/StringExtensions';
@@ -338,10 +337,13 @@ export class LayoutModule extends AdaptableModuleBase {
338
337
  if (ColumnId === 'Source' || ColumnId === 'Uuid' || ColumnId === 'AdaptableVersion') {
339
338
  return '';
340
339
  }
341
- if (isParameterizedAggregation(aggFn)) {
342
- return getParameterizedAggregationDisplayName(this.api, aggFn, ColumnId);
340
+ let aggFnName = '';
341
+ if (typeof aggFn === 'string') {
342
+ aggFnName = aggFn;
343
+ }
344
+ else if (typeof aggFn === 'object' && aggFn.type === 'weightedAverage') {
345
+ aggFnName = WEIGHTED_AVERAGE_AGG_FN_NAME;
343
346
  }
344
- const aggFnName = typeof aggFn === 'string' ? aggFn : '';
345
347
  return `${aggFnName}(${columnIdToFriendlyName(ColumnId)})`;
346
348
  }).filter(Boolean),
347
349
  },
@@ -353,10 +355,13 @@ export class LayoutModule extends AdaptableModuleBase {
353
355
  if (ColumnId === 'Source' || ColumnId === 'Uuid' || ColumnId === 'AdaptableVersion') {
354
356
  return '';
355
357
  }
356
- if (isParameterizedAggregation(aggFn)) {
357
- return getParameterizedAggregationDisplayName(this.api, aggFn, ColumnId);
358
+ let aggFnName = '';
359
+ if (typeof aggFn === 'string') {
360
+ aggFnName = aggFn;
361
+ }
362
+ else if (typeof aggFn === 'object' && aggFn.type === 'weightedAverage') {
363
+ aggFnName = WEIGHTED_AVERAGE_AGG_FN_NAME;
358
364
  }
359
- const aggFnName = typeof aggFn === 'string' ? aggFn : '';
360
365
  return `${aggFnName}(${columnIdToFriendlyName(ColumnId)})`;
361
366
  }).filter(Boolean),
362
367
  },
@@ -2,17 +2,25 @@ import { AdaptableModuleBase } from './AdaptableModuleBase';
2
2
  import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
3
3
  import * as StyledColumnRedux from '../Redux/ActionsReducers/StyledColumnRedux';
4
4
  import { StyledColumnWizard } from '../View/StyledColumn/Wizard/StyledColumnWizard';
5
- import { renderStyledColumnRangesSummary, renderStyledColumnStyleSummary, } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection';
6
- import { renderStyledColumnGradientStyleSummary } from '../View/StyledColumn/Wizard/StyledColumnWizardGradientSection';
7
- import { renderStyledColumnBulletRangesSummary, renderStyledColumnBulletStyleSummary, } from '../View/StyledColumn/Wizard/StyledColumnWizardBulletSection';
8
- import { renderStyledColumnRatingSummary } from '../View/StyledColumn/Wizard/StyledColumnWizardRatingSection';
9
- import { renderStyledColumnRangeBarDisplayStepSummary, renderStyledColumnRangeBarRangeStepSummary, } from '../View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection';
10
- import { renderStyledColumnIconStyleSummary, renderStyledColumnIconMappingsSummary, } from '../View/StyledColumn/Wizard/StyledColumnWizardIconSection';
5
+ import { renderStyledColumnRangesSummary, getStyledColumnPercentBarStyleViewValues, } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection';
6
+ import { getStyledColumnGradientStyleViewValues } from '../View/StyledColumn/Wizard/StyledColumnWizardGradientSection';
7
+ import { getStyledColumnBulletStyleViewValues, StyledColumnBulletRangesView, } from '../View/StyledColumn/Wizard/StyledColumnWizardBulletSection';
8
+ import { StyledColumnBulletPreview } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBulletPreview';
9
+ import { getStyledColumnRatingStyleViewValues } from '../View/StyledColumn/Wizard/StyledColumnWizardRatingSection';
10
+ import { StyledColumnRatingPreview } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRatingPreview';
11
+ import { getStyledColumnRangeBarDisplayViewValues, StyledColumnRangeBarRangeView, } from '../View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection';
12
+ import { StyledColumnRangeBarPreview } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnRangeBarPreview';
13
+ import { getStyledColumnIconStyleViewValues, StyledColumnIconMappingsView, } from '../View/StyledColumn/Wizard/StyledColumnWizardIconSection';
14
+ import { StyledColumnIconPreview } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnIconPreview';
11
15
  import { collectIncludedRowKindLabels } from '../View/StyledColumn/Wizard/StyledColumnWizardScopeSection';
12
16
  import ObjectFactory from '../Utilities/ObjectFactory';
13
17
  import { StyledColumnBadgePreview } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview';
18
+ import { StyledColumnGradientPreview } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnGradientPreview';
19
+ import { StyledColumnPercentBarPreview } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnPercentBarPreview';
20
+ import { getStyledColumnBadgeStyleViewValues, StyledColumnBadgeDefinitionsView, } from '../View/StyledColumn/Wizard/StyledColumnBadgeSection';
21
+ import { getStyledColumnSparklineStyleViewValues } from '../View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection';
22
+ import { StyledColumnSparklinePreview } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnSparklinePreview';
14
23
  import { getObjectTagsViewItems } from '../Utilities/getObjectTagsViewItems';
15
- import { StyledColumnBadgeSettings } from '../View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings';
16
24
  export class StyledColumnModule extends AdaptableModuleBase {
17
25
  constructor(api) {
18
26
  super(ModuleConstants.StyledColumnModuleId, ModuleConstants.StyledColumnFriendlyName, 'brush', 'StyledColumnPopup', // to change
@@ -283,80 +291,100 @@ export class StyledColumnModule extends AdaptableModuleBase {
283
291
  if (styledColumn.PercentBarStyle) {
284
292
  specificTypeItems.push({
285
293
  name: 'Style',
286
- view: () => {
287
- return renderStyledColumnStyleSummary(styledColumn, this.api);
288
- },
294
+ values: getStyledColumnPercentBarStyleViewValues(styledColumn),
295
+ });
296
+ specificTypeItems.push({
297
+ name: 'Preview',
298
+ view: StyledColumnPercentBarPreview,
289
299
  });
290
300
  }
291
301
  if (styledColumn.GradientStyle) {
292
302
  specificTypeItems.push({
293
303
  name: 'Style',
294
- view: () => {
295
- return renderStyledColumnGradientStyleSummary(styledColumn);
296
- },
304
+ values: getStyledColumnGradientStyleViewValues(styledColumn),
305
+ });
306
+ specificTypeItems.push({
307
+ name: 'Preview',
308
+ view: StyledColumnGradientPreview,
297
309
  });
298
310
  }
299
311
  }
300
312
  if (styledColumn.BulletChartStyle) {
301
313
  specificTypeItems.push({
302
314
  name: 'Ranges',
303
- view: () => {
304
- return renderStyledColumnBulletRangesSummary(styledColumn);
305
- },
315
+ view: StyledColumnBulletRangesView,
306
316
  });
307
317
  specificTypeItems.push({
308
318
  name: 'Style',
309
- view: () => {
310
- return renderStyledColumnBulletStyleSummary(styledColumn);
311
- },
319
+ values: getStyledColumnBulletStyleViewValues(styledColumn),
320
+ });
321
+ specificTypeItems.push({
322
+ name: 'Preview',
323
+ view: StyledColumnBulletPreview,
312
324
  });
313
325
  }
314
326
  if (styledColumn.RatingStyle) {
315
327
  specificTypeItems.push({
316
328
  name: 'Style',
317
- view: () => {
318
- return renderStyledColumnRatingSummary(styledColumn);
319
- },
329
+ values: getStyledColumnRatingStyleViewValues(styledColumn),
330
+ });
331
+ specificTypeItems.push({
332
+ name: 'Preview',
333
+ view: StyledColumnRatingPreview,
320
334
  });
321
335
  }
322
336
  if (styledColumn.RangeBarStyle) {
323
337
  specificTypeItems.push({
324
338
  name: 'Style',
325
- view: () => {
326
- return renderStyledColumnRangeBarRangeStepSummary(styledColumn);
327
- },
339
+ view: StyledColumnRangeBarRangeView,
328
340
  });
329
341
  specificTypeItems.push({
330
342
  name: 'Display',
331
- view: () => {
332
- return renderStyledColumnRangeBarDisplayStepSummary(styledColumn);
333
- },
343
+ values: getStyledColumnRangeBarDisplayViewValues(styledColumn),
344
+ });
345
+ specificTypeItems.push({
346
+ name: 'Preview',
347
+ view: StyledColumnRangeBarPreview,
334
348
  });
335
349
  }
336
350
  if (styledColumn.IconStyle) {
337
351
  specificTypeItems.push({
338
352
  name: 'Mappings',
339
- view: () => {
340
- return renderStyledColumnIconMappingsSummary(styledColumn);
341
- },
353
+ view: StyledColumnIconMappingsView,
342
354
  });
343
355
  specificTypeItems.push({
344
356
  name: 'Style',
345
- view: () => {
346
- return renderStyledColumnIconStyleSummary(styledColumn);
347
- },
357
+ values: getStyledColumnIconStyleViewValues(styledColumn),
358
+ });
359
+ specificTypeItems.push({
360
+ name: 'Preview',
361
+ view: StyledColumnIconPreview,
348
362
  });
349
363
  }
350
364
  if (styledColumn.BadgeStyle) {
351
365
  specificTypeItems.push({
352
- name: 'Settings',
353
- view: StyledColumnBadgeSettings,
366
+ name: 'Badges',
367
+ view: StyledColumnBadgeDefinitionsView,
368
+ });
369
+ specificTypeItems.push({
370
+ name: 'Style',
371
+ values: getStyledColumnBadgeStyleViewValues(styledColumn, this.api),
354
372
  });
355
373
  specificTypeItems.push({
356
374
  name: 'Preview',
357
375
  view: StyledColumnBadgePreview,
358
376
  });
359
377
  }
378
+ if (styledColumn.SparklineStyle) {
379
+ specificTypeItems.push({
380
+ name: 'Style',
381
+ values: getStyledColumnSparklineStyleViewValues(styledColumn),
382
+ });
383
+ specificTypeItems.push({
384
+ name: 'Preview',
385
+ view: StyledColumnSparklinePreview,
386
+ });
387
+ }
360
388
  const includedRowKinds = collectIncludedRowKindLabels(styledColumn);
361
389
  return {
362
390
  abObject: styledColumn,
@@ -1,9 +1,9 @@
1
1
  import { SummaryOperation } from '../../AdaptableState/Common/Enums';
2
- import { AdaptableTheme } from '../../AdaptableState/ThemeState';
2
+ import { SystemThemeEntry } from '../../AdaptableState/ThemeState';
3
3
  export declare const CELL_SUMMARY_DEFAULT_OPERATION: SummaryOperation | string;
4
4
  export declare const QUICK_SEARCH_DEFAULT_TEXT_BACK_COLOR: string;
5
5
  export declare const QUICK_SEARCH_DEFAULT_CELL_BACK_COLOR: string;
6
6
  export declare const QUICK_SEARCH_DEFAULT_FORE_COLOR: string;
7
7
  export declare const QUICK_SEARCH_DEFAULT_CURRENT_BACK_COLOR: string;
8
- export declare const SYSTEM_THEMES: AdaptableTheme[];
8
+ export declare const SYSTEM_THEMES: SystemThemeEntry[];
9
9
  export declare const THEME_DEFAULT_CURRENT_THEME: string;
@@ -10,18 +10,5 @@ export const QUICK_SEARCH_DEFAULT_FORE_COLOR = getSwatchColorVar(1); // black
10
10
  export const QUICK_SEARCH_DEFAULT_CURRENT_BACK_COLOR = getSwatchColorVar(20); // orange
11
11
  // theme
12
12
  // consts for Themes
13
- export const SYSTEM_THEMES = [
14
- {
15
- Name: LIGHT_THEME,
16
- Description: 'Light Theme',
17
- },
18
- {
19
- Name: DARK_THEME,
20
- Description: 'Dark Theme',
21
- },
22
- {
23
- Name: OS_THEME,
24
- Description: 'OS Theme',
25
- },
26
- ];
13
+ export const SYSTEM_THEMES = [LIGHT_THEME, DARK_THEME, OS_THEME];
27
14
  export const THEME_DEFAULT_CURRENT_THEME = LIGHT_THEME;
@@ -4,6 +4,20 @@ import sentenceCase from '../utils/sentenceCase';
4
4
  import { DEFAULT_DATE_FORMAT_PATTERN } from '../Constants/GeneralConstants';
5
5
  import Helper from './Helper';
6
6
  import StringExtensions from '../Extensions/StringExtensions';
7
+ const getInputFractionDigitCount = (input) => {
8
+ const fraction = String(input).split('.')[1];
9
+ return fraction ? fraction.replace(/0+$/, '').length : 0;
10
+ };
11
+ const getFractionDigitsAfterMultiplier = (input, multiplier, explicitFractionDigits) => {
12
+ if (explicitFractionDigits != null) {
13
+ return explicitFractionDigits;
14
+ }
15
+ if (multiplier === 1) {
16
+ return getInputFractionDigitCount(input);
17
+ }
18
+ const multiplierPower = Math.round(Math.log10(Math.abs(multiplier)));
19
+ return Math.max(0, getInputFractionDigitCount(input) - multiplierPower);
20
+ };
7
21
  export function NumberFormatter(input, options = {}, rowNode, column, api) {
8
22
  let preparedInput;
9
23
  if (options.Content) {
@@ -29,9 +43,11 @@ export function NumberFormatter(input, options = {}, rowNode, column, api) {
29
43
  return preparedInput.toString();
30
44
  }
31
45
  let multiplier = options.Multiplier ? options.Multiplier : 1;
46
+ let multiplierFractionDigits;
32
47
  if (options.Multiplier !== undefined) {
33
48
  n *= multiplier;
34
- n = parseFloat(n.toFixed(12));
49
+ multiplierFractionDigits = getFractionDigitsAfterMultiplier(preparedInput, options.Multiplier, options.FractionDigits);
50
+ n = parseFloat(n.toFixed(multiplierFractionDigits));
35
51
  }
36
52
  // Set Integer and Fraction Digits to a max of 20
37
53
  if (options.IntegerDigits > 20) {
@@ -71,6 +87,9 @@ export function NumberFormatter(input, options = {}, rowNode, column, api) {
71
87
  else if (options.FractionDigits != null) {
72
88
  digitsToUse = options.FractionDigits;
73
89
  }
90
+ else if (multiplierFractionDigits != null) {
91
+ digitsToUse = multiplierFractionDigits;
92
+ }
74
93
  else {
75
94
  let decimalCount = Math.floor(n) === n ? 0 : n.toString().split(fractionsSepatator)[1]?.length || 0;
76
95
  digitsToUse = decimalCount;
@@ -0,0 +1,7 @@
1
+ import type { AgSparklineOptions } from 'ag-charts-types';
2
+ /**
3
+ * AG Charts sparklines do not resolve Adaptable `var(--ab-color-*)` tokens.
4
+ * Resolve palette / theme CSS variables to concrete colours at render time so
5
+ * wizard previews and grid cells match the chosen Fill / Stroke values.
6
+ */
7
+ export declare function resolveSparklineOptionsForRender(options: AgSparklineOptions): AgSparklineOptions;
@@ -0,0 +1,65 @@
1
+ import { getVariableColor } from './StyleHelper';
2
+ const resolveCssColor = (color) => {
3
+ if (color == null || color === '') {
4
+ return color;
5
+ }
6
+ const resolved = getVariableColor(color);
7
+ return resolved || color;
8
+ };
9
+ const resolveHighlightStyle = (style) => {
10
+ if (!style) {
11
+ return style;
12
+ }
13
+ const resolved = { ...style };
14
+ if (style.fill != null) {
15
+ resolved.fill = resolveCssColor(style.fill);
16
+ }
17
+ if (style.stroke != null) {
18
+ resolved.stroke = resolveCssColor(style.stroke);
19
+ }
20
+ return resolved;
21
+ };
22
+ /**
23
+ * AG Charts sparklines do not resolve Adaptable `var(--ab-color-*)` tokens.
24
+ * Resolve palette / theme CSS variables to concrete colours at render time so
25
+ * wizard previews and grid cells match the chosen Fill / Stroke values.
26
+ */
27
+ export function resolveSparklineOptionsForRender(options) {
28
+ const resolved = { ...options };
29
+ if ('fill' in options && options.fill != null) {
30
+ resolved.fill = resolveCssColor(options.fill);
31
+ }
32
+ if (options.stroke != null) {
33
+ resolved.stroke = resolveCssColor(options.stroke);
34
+ }
35
+ if (options.background?.fill != null) {
36
+ resolved.background = {
37
+ ...options.background,
38
+ fill: resolveCssColor(options.background.fill),
39
+ };
40
+ }
41
+ if ('marker' in options && options.marker) {
42
+ const marker = { ...options.marker };
43
+ if (marker.fill != null) {
44
+ marker.fill = resolveCssColor(marker.fill);
45
+ }
46
+ if (marker.stroke != null) {
47
+ marker.stroke = resolveCssColor(marker.stroke);
48
+ }
49
+ resolved.marker = marker;
50
+ }
51
+ if (options.highlight) {
52
+ resolved.highlight = {
53
+ ...options.highlight,
54
+ highlightedItem: resolveHighlightStyle(options.highlight.highlightedItem),
55
+ highlightedSeries: resolveHighlightStyle(options.highlight.highlightedSeries),
56
+ };
57
+ }
58
+ if (options.axis && typeof options.axis === 'object' && options.axis.stroke != null) {
59
+ resolved.axis = {
60
+ ...options.axis,
61
+ stroke: resolveCssColor(options.axis.stroke),
62
+ };
63
+ }
64
+ return resolved;
65
+ }
@@ -1,4 +1,7 @@
1
- import { CellColorRange, GradientStyle, NumericStyledColumn } from '../../AdaptableState/StyledColumnState';
1
+ import type { CSSProperties } from 'react';
2
+ import type { IRowNode } from 'ag-grid-community';
3
+ import { CellColorRange, GradientStyle, NumericStyledColumn, StyledColumn } from '../../AdaptableState/StyledColumnState';
4
+ import { AdaptableApi } from '../../Api/AdaptableApi';
2
5
  /**
3
6
  * Default alpha at the **low** end of a Gradient range when `MinAlpha` is unset.
4
7
  * Slightly above zero so the bottom-edge value of every range still shows its
@@ -9,6 +12,25 @@ export declare const DEFAULT_GRADIENT_MIN_ALPHA = 0.15;
9
12
  * Default alpha at the **high** end of a Gradient range when `MaxAlpha` is unset.
10
13
  */
11
14
  export declare const DEFAULT_GRADIENT_MAX_ALPHA = 1;
15
+ export declare const hasGradientRangesConfigured: (gs: GradientStyle | undefined) => boolean;
16
+ /** Number of sample cells shown in Gradient / Percent Bar style previews. */
17
+ export declare const STYLED_COLUMN_PREVIEW_SAMPLE_COUNT = 6;
18
+ /** Illustrative zero-centred scale endpoints for preview geometry. */
19
+ export declare const ZERO_CENTRED_PREVIEW_SCALE_MIN = -20;
20
+ export declare const ZERO_CENTRED_PREVIEW_SCALE_MAX = 20;
21
+ /** @deprecated Use {@link getZeroCentredGradientPreviewValues} — kept for callers using endpoints. */
22
+ export declare const ZERO_CENTRED_GRADIENT_PREVIEW_VALUES: readonly number[];
23
+ export declare const getZeroCentredGradientPreviewValues: () => number[];
24
+ export declare function isDivergingZeroCellRanges(ranges: CellColorRange[] | undefined): boolean;
25
+ export declare function isZeroCentredGradientStyle(gs: GradientStyle): boolean;
26
+ /**
27
+ * Sample cell values for gradient preview strips — spread across the effective scale.
28
+ */
29
+ export declare const getGradientPreviewSampleValues: (styledColumn: StyledColumn, api: AdaptableApi) => number[];
30
+ /**
31
+ * Cell CSS for gradient preview — mirrors `AgGridColumnAdapter.getStyledColumnStyle` gradient path.
32
+ */
33
+ export declare const getGradientPreviewCellStyle: (cellValue: number, styledColumn: StyledColumn, api: AdaptableApi, rowNode?: IRowNode | null) => CSSProperties;
12
34
  /**
13
35
  * Effective cell ranges for gradient rendering / range lookup.
14
36
  * When `ZeroCentred` is set, expands to the canonical Col-Min…0 and 0…Col-Max bands.
@@ -1,3 +1,7 @@
1
+ import tinycolor from 'tinycolor2';
2
+ import { convertAdaptableStyleToCSS } from './StyleHelper';
3
+ import { getVariableColor } from './StyleHelper';
4
+ import clamp from '../utils/clamp';
1
5
  /**
2
6
  * Default alpha at the **low** end of a Gradient range when `MinAlpha` is unset.
3
7
  * Slightly above zero so the bottom-edge value of every range still shows its
@@ -8,6 +12,206 @@ export const DEFAULT_GRADIENT_MIN_ALPHA = 0.15;
8
12
  * Default alpha at the **high** end of a Gradient range when `MaxAlpha` is unset.
9
13
  */
10
14
  export const DEFAULT_GRADIENT_MAX_ALPHA = 1;
15
+ export const hasGradientRangesConfigured = (gs) => !!(gs?.ZeroCentred || gs?.CellRanges?.length || gs?.ColumnComparison);
16
+ const evenlySpacedValues = (min, max, count) => {
17
+ if (count <= 1) {
18
+ return [min];
19
+ }
20
+ const step = (max - min) / (count - 1);
21
+ return Array.from({ length: count }, (_, i) => min + step * i);
22
+ };
23
+ /** Number of sample cells shown in Gradient / Percent Bar style previews. */
24
+ export const STYLED_COLUMN_PREVIEW_SAMPLE_COUNT = 6;
25
+ /** Illustrative zero-centred scale endpoints for preview geometry. */
26
+ export const ZERO_CENTRED_PREVIEW_SCALE_MIN = -20;
27
+ export const ZERO_CENTRED_PREVIEW_SCALE_MAX = 20;
28
+ /** @deprecated Use {@link getZeroCentredGradientPreviewValues} — kept for callers using endpoints. */
29
+ export const ZERO_CENTRED_GRADIENT_PREVIEW_VALUES = evenlySpacedValues(ZERO_CENTRED_PREVIEW_SCALE_MIN, ZERO_CENTRED_PREVIEW_SCALE_MAX, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
30
+ export const getZeroCentredGradientPreviewValues = () => evenlySpacedValues(ZERO_CENTRED_PREVIEW_SCALE_MIN, ZERO_CENTRED_PREVIEW_SCALE_MAX, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
31
+ export function isDivergingZeroCellRanges(ranges) {
32
+ if (!ranges || ranges.length !== 2) {
33
+ return false;
34
+ }
35
+ const [a, b] = ranges;
36
+ return a.Max === 0 && b.Min === 0;
37
+ }
38
+ export function isZeroCentredGradientStyle(gs) {
39
+ return !!(gs.ZeroCentred || isDivergingZeroCellRanges(gs.CellRanges));
40
+ }
41
+ /**
42
+ * Sample cell values for gradient preview strips — spread across the effective scale.
43
+ */
44
+ export const getGradientPreviewSampleValues = (styledColumn, api) => {
45
+ const gs = styledColumn.GradientStyle;
46
+ if (!gs || !hasGradientRangesConfigured(gs)) {
47
+ return [];
48
+ }
49
+ if (isZeroCentredGradientStyle(gs)) {
50
+ return getZeroCentredGradientPreviewValues();
51
+ }
52
+ if (gs.ColumnComparison) {
53
+ const min = Number(gs.ColumnComparison.MinValue);
54
+ const max = Number(gs.ColumnComparison.MaxValue);
55
+ if (!Number.isNaN(min) && !Number.isNaN(max)) {
56
+ return evenlySpacedValues(min, max, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
57
+ }
58
+ return evenlySpacedValues(0, 100, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
59
+ }
60
+ const column = styledColumn.ColumnId
61
+ ? api.columnApi.getColumnWithColumnId(styledColumn.ColumnId)
62
+ : undefined;
63
+ if (!column) {
64
+ return evenlySpacedValues(0, 100, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
65
+ }
66
+ const colMin = api.styledColumnApi.internalApi.getMinValueForNumericColumn(column);
67
+ const colMax = api.styledColumnApi.internalApi.getMaxValueForNumericColumn(column);
68
+ if (colMin === colMax) {
69
+ return [colMin];
70
+ }
71
+ return evenlySpacedValues(colMin, colMax, STYLED_COLUMN_PREVIEW_SAMPLE_COUNT);
72
+ };
73
+ const getZeroCentredPreviewColors = (gradientStyle) => {
74
+ if (gradientStyle.ZeroCentred) {
75
+ return {
76
+ negative: gradientStyle.ZeroCentred.NegativeColor,
77
+ positive: gradientStyle.ZeroCentred.PositiveColor,
78
+ };
79
+ }
80
+ const ranges = gradientStyle.CellRanges;
81
+ if (isDivergingZeroCellRanges(ranges)) {
82
+ return {
83
+ negative: ranges[0].Color,
84
+ positive: ranges[1].Color,
85
+ };
86
+ }
87
+ return null;
88
+ };
89
+ /**
90
+ * Zero-centred preview uses a fixed -20…20 illustrative scale so negative
91
+ * colours always appear — independent of whether the column currently has
92
+ * negative values (Col-Min may be above zero today).
93
+ */
94
+ const getZeroCentredGradientPreviewCellStyle = (cellValue, gradientStyle) => {
95
+ const colors = getZeroCentredPreviewColors(gradientStyle);
96
+ if (!colors) {
97
+ return {};
98
+ }
99
+ const previewMin = ZERO_CENTRED_PREVIEW_SCALE_MIN;
100
+ const previewMax = ZERO_CENTRED_PREVIEW_SCALE_MAX;
101
+ const syntheticRanges = [
102
+ { Min: previewMin, Max: 0, Color: colors.negative },
103
+ { Min: 0, Max: previewMax, Color: colors.positive },
104
+ ];
105
+ let matchingRange = null;
106
+ for (const range of syntheticRanges) {
107
+ const min = range.Min;
108
+ const max = range.Max;
109
+ if (cellValue >= min && cellValue <= max) {
110
+ matchingRange = range;
111
+ break;
112
+ }
113
+ }
114
+ if (!matchingRange) {
115
+ return {};
116
+ }
117
+ const min = matchingRange.Min;
118
+ const max = matchingRange.Max;
119
+ const reverseGradient = matchingRange.Min === previewMin && matchingRange.Max === 0;
120
+ const minAlphaBound = gradientStyle.MinAlpha ?? DEFAULT_GRADIENT_MIN_ALPHA;
121
+ const maxAlphaBound = gradientStyle.MaxAlpha ?? DEFAULT_GRADIENT_MAX_ALPHA;
122
+ const lo = Math.min(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
123
+ const hi = Math.max(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
124
+ const span = Math.abs(max - min);
125
+ let t = span === 0 ? 0.5 : (Number(cellValue) - min) / span;
126
+ t = clamp(t, 0, 1);
127
+ if (reverseGradient) {
128
+ t = 1 - t;
129
+ }
130
+ const alpha = Number((lo + t * (hi - lo)).toPrecision(4));
131
+ let style = {};
132
+ const bg = tinycolor(getVariableColor(matchingRange.Color)).setAlpha(alpha);
133
+ style.backgroundColor = bg.toRgbString();
134
+ if (gradientStyle.AutoContrastText) {
135
+ style.color = bg.getLuminance() > 0.45 ? '#111111' : '#ffffff';
136
+ }
137
+ const autoContrastColor = gradientStyle.AutoContrastText && style.color ? style.color : undefined;
138
+ if (gradientStyle.Font) {
139
+ style = { ...style, ...convertAdaptableStyleToCSS(gradientStyle.Font) };
140
+ }
141
+ if (autoContrastColor) {
142
+ style.color = autoContrastColor;
143
+ }
144
+ if (gradientStyle.Font?.Alignment && gradientStyle.Font.Alignment !== 'Default') {
145
+ style.textAlign = gradientStyle.Font.Alignment.toLowerCase();
146
+ }
147
+ return style;
148
+ };
149
+ /**
150
+ * Cell CSS for gradient preview — mirrors `AgGridColumnAdapter.getStyledColumnStyle` gradient path.
151
+ */
152
+ export const getGradientPreviewCellStyle = (cellValue, styledColumn, api, rowNode) => {
153
+ const gradientStyle = styledColumn.GradientStyle;
154
+ if (!gradientStyle || !hasGradientRangesConfigured(gradientStyle)) {
155
+ return {};
156
+ }
157
+ if (isZeroCentredGradientStyle(gradientStyle)) {
158
+ return getZeroCentredGradientPreviewCellStyle(cellValue, gradientStyle);
159
+ }
160
+ const column = styledColumn.ColumnId
161
+ ? api.columnApi.getColumnWithColumnId(styledColumn.ColumnId)
162
+ : undefined;
163
+ if (!column) {
164
+ return {};
165
+ }
166
+ const node = rowNode ?? api.gridApi?.getRowNodeForIndex(0) ?? null;
167
+ const internalApi = api.styledColumnApi.internalApi;
168
+ let style = {};
169
+ const min = internalApi.getNumericStyleMinValue(styledColumn, column, node, cellValue);
170
+ const max = internalApi.getNumericStyleMaxValue(styledColumn, column, node, cellValue);
171
+ let cellBackColor;
172
+ let reverseGradient = false;
173
+ if (gradientStyle.ColumnComparison) {
174
+ cellBackColor = gradientStyle.ColumnComparison.Color;
175
+ }
176
+ else {
177
+ const matchingRange = internalApi.findRangeForColumn(expandGradientCellRanges(gradientStyle), column, gradientStyleRangeLookupValueType(gradientStyle), cellValue);
178
+ if (matchingRange) {
179
+ cellBackColor = matchingRange.Color;
180
+ reverseGradient =
181
+ (!!gradientStyle.ZeroCentred && isNegativeZeroCentredBand(matchingRange)) ||
182
+ !!matchingRange.ReverseGradient;
183
+ }
184
+ }
185
+ const minAlphaBound = gradientStyle.MinAlpha ?? DEFAULT_GRADIENT_MIN_ALPHA;
186
+ const maxAlphaBound = gradientStyle.MaxAlpha ?? DEFAULT_GRADIENT_MAX_ALPHA;
187
+ const lo = Math.min(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
188
+ const hi = Math.max(clamp(minAlphaBound, 0, 1), clamp(maxAlphaBound, 0, 1));
189
+ const span = Math.abs(max - min);
190
+ let t = span === 0 ? 0.5 : (Number(cellValue) - min) / span;
191
+ t = clamp(t, 0, 1);
192
+ if (reverseGradient) {
193
+ t = 1 - t;
194
+ }
195
+ const alpha = Number((lo + t * (hi - lo)).toPrecision(4));
196
+ if (cellBackColor) {
197
+ const bg = tinycolor(getVariableColor(cellBackColor)).setAlpha(alpha);
198
+ style.backgroundColor = bg.toRgbString();
199
+ if (gradientStyle.AutoContrastText) {
200
+ style.color = bg.getLuminance() > 0.45 ? '#111111' : '#ffffff';
201
+ }
202
+ }
203
+ const autoContrastColor = gradientStyle.AutoContrastText && style.color ? style.color : undefined;
204
+ if (gradientStyle.Font) {
205
+ style = { ...style, ...convertAdaptableStyleToCSS(gradientStyle.Font) };
206
+ }
207
+ if (autoContrastColor) {
208
+ style.color = autoContrastColor;
209
+ }
210
+ if (gradientStyle.Font?.Alignment && gradientStyle.Font.Alignment !== 'Default') {
211
+ style.textAlign = gradientStyle.Font.Alignment.toLowerCase();
212
+ }
213
+ return style;
214
+ };
11
215
  /**
12
216
  * Effective cell ranges for gradient rendering / range lookup.
13
217
  * When `ZeroCentred` is set, expands to the canonical Col-Min…0 and 0…Col-Max bands.
@@ -0,0 +1,5 @@
1
+ import { AdaptableTheme, SystemThemeEntry } from '../../AdaptableState/ThemeState';
2
+ import { AdaptableLogger } from '../../agGrid/AdaptableLogger';
3
+ export declare function isLegacySystemThemeObject(theme: SystemThemeEntry | AdaptableTheme): theme is AdaptableTheme;
4
+ export declare function resolveSystemThemeDescription(name: string): string;
5
+ export declare function systemThemeEntryToAdaptableTheme(theme: SystemThemeEntry | AdaptableTheme, logger?: AdaptableLogger): AdaptableTheme;
@@ -0,0 +1,38 @@
1
+ import { StaticThemes } from '../../themes';
2
+ import { logDeprecation } from '../logDeprecation';
3
+ const LEGACY_SYSTEM_THEME_PROPS = ['Description', 'CSSVariables', 'Variant'];
4
+ export function isLegacySystemThemeObject(theme) {
5
+ if (typeof theme === 'string') {
6
+ return false;
7
+ }
8
+ return LEGACY_SYSTEM_THEME_PROPS.some((prop) => prop in theme && theme[prop] !== undefined);
9
+ }
10
+ export function resolveSystemThemeDescription(name) {
11
+ return StaticThemes.find((staticTheme) => staticTheme.Name === name)?.Description ?? name;
12
+ }
13
+ export function systemThemeEntryToAdaptableTheme(theme, logger) {
14
+ if (typeof theme === 'string') {
15
+ return {
16
+ Name: theme,
17
+ Description: resolveSystemThemeDescription(theme),
18
+ };
19
+ }
20
+ if (isLegacySystemThemeObject(theme)) {
21
+ if (logger) {
22
+ logDeprecation(logger, 'ThemeState', 'SystemThemes', undefined, 'Passing a full AdaptableTheme object in SystemThemes is deprecated. Use a theme name string or SystemThemeOptions (Name with AgThemeMode / AgGridClassName only).');
23
+ }
24
+ return {
25
+ Name: theme.Name,
26
+ Description: theme.Description ?? resolveSystemThemeDescription(theme.Name),
27
+ AgThemeMode: theme.AgThemeMode,
28
+ AgGridClassName: theme.AgGridClassName,
29
+ };
30
+ }
31
+ const options = theme;
32
+ return {
33
+ Name: options.Name,
34
+ Description: resolveSystemThemeDescription(options.Name),
35
+ AgThemeMode: options.AgThemeMode,
36
+ AgGridClassName: options.AgGridClassName,
37
+ };
38
+ }