@adaptabletools/adaptable 18.0.0-canary.8 → 18.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 (439) hide show
  1. package/base.css +18 -20
  2. package/base.css.map +1 -1
  3. package/index.css +22 -20
  4. package/index.css.map +1 -1
  5. package/package.json +1 -1
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +10 -4
  7. package/src/AdaptableOptions/ActionColumnOptions.d.ts +3 -2
  8. package/src/AdaptableOptions/AdaptableFrameworkComponent.d.ts +3 -0
  9. package/src/AdaptableOptions/AdaptableOptions.d.ts +15 -14
  10. package/src/AdaptableOptions/AdaptablePlugin.d.ts +2 -0
  11. package/src/AdaptableOptions/AdaptablePlugin.js +2 -0
  12. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +7 -0
  13. package/src/AdaptableOptions/ColumnMenuOptions.d.ts +94 -0
  14. package/src/AdaptableOptions/ColumnOptions.d.ts +9 -4
  15. package/src/AdaptableOptions/CommentOptions.d.ts +20 -9
  16. package/src/AdaptableOptions/ContextMenuOptions.d.ts +94 -0
  17. package/src/AdaptableOptions/CustomSortOptions.d.ts +2 -2
  18. package/src/AdaptableOptions/DataImportOptions.d.ts +2 -2
  19. package/src/AdaptableOptions/FormatColumnOptions.d.ts +2 -2
  20. package/src/AdaptableOptions/GroupingOptions.d.ts +0 -26
  21. package/src/AdaptableOptions/NoteOptions.d.ts +12 -3
  22. package/src/AdaptableOptions/PredicateOptions.d.ts +2 -2
  23. package/src/AdaptableOptions/QuickSearchOptions.d.ts +1 -1
  24. package/src/AdaptableOptions/StateOptions.d.ts +6 -0
  25. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +2 -2
  26. package/src/Api/AdaptableApi.d.ts +16 -6
  27. package/src/Api/ColumnApi.d.ts +13 -0
  28. package/src/Api/ColumnMenuApi.d.ts +13 -0
  29. package/src/Api/{ScopeApi.d.ts → ColumnScopeApi.d.ts} +36 -26
  30. package/src/Api/CommentApi.d.ts +20 -22
  31. package/src/Api/ConfigApi.d.ts +4 -5
  32. package/src/Api/ContextMenuApi.d.ts +9 -0
  33. package/src/Api/EventApi.d.ts +7 -9
  34. package/src/Api/Events/CommentChanged.d.ts +11 -0
  35. package/src/Api/Events/CommentChanged.js +1 -0
  36. package/src/Api/Events/GridDataChanged.d.ts +1 -1
  37. package/src/Api/FlashingCellApi.d.ts +2 -2
  38. package/src/Api/GridApi.d.ts +35 -3
  39. package/src/Api/Implementation/ActionColumnApiImpl.js +3 -6
  40. package/src/Api/Implementation/ActionRowApiImpl.js +3 -7
  41. package/src/Api/Implementation/AdaptableApiImpl.d.ts +7 -5
  42. package/src/Api/Implementation/AdaptableApiImpl.js +9 -5
  43. package/src/Api/Implementation/AlertApiImpl.js +8 -13
  44. package/src/Api/Implementation/ApiBase.d.ts +6 -4
  45. package/src/Api/Implementation/ApiBase.js +11 -5
  46. package/src/Api/Implementation/CalendarApiImpl.js +1 -6
  47. package/src/Api/Implementation/CellSummaryApiImpl.d.ts +0 -5
  48. package/src/Api/Implementation/CellSummaryApiImpl.js +2 -23
  49. package/src/Api/Implementation/ChartingApiImpl.js +3 -3
  50. package/src/Api/Implementation/ColumnApiImpl.d.ts +5 -0
  51. package/src/Api/Implementation/ColumnApiImpl.js +45 -15
  52. package/src/Api/Implementation/ColumnFilterApiImpl.js +7 -7
  53. package/src/Api/Implementation/ColumnMenuApiImpl.d.ts +8 -0
  54. package/src/Api/Implementation/ColumnMenuApiImpl.js +12 -0
  55. package/src/Api/Implementation/ColumnScopeApiImpl.d.ts +33 -0
  56. package/src/Api/Implementation/{ScopeApiImpl.js → ColumnScopeApiImpl.js} +65 -19
  57. package/src/Api/Implementation/CommentsApiImpl.d.ts +8 -5
  58. package/src/Api/Implementation/CommentsApiImpl.js +10 -5
  59. package/src/Api/Implementation/ConfigApiImpl.d.ts +2 -2
  60. package/src/Api/Implementation/ConfigApiImpl.js +27 -28
  61. package/src/Api/Implementation/ContextMenuApiImpl.d.ts +7 -0
  62. package/src/Api/Implementation/ContextMenuApiImpl.js +9 -0
  63. package/src/Api/Implementation/DashboardApiImpl.js +1 -6
  64. package/src/Api/Implementation/ExportApiImpl.js +5 -10
  65. package/src/Api/Implementation/ExpressionApiImpl.js +14 -19
  66. package/src/Api/Implementation/Fdc3ApiImpl.js +1 -1
  67. package/src/Api/Implementation/FlashingCellApiImpl.d.ts +2 -2
  68. package/src/Api/Implementation/FlashingCellApiImpl.js +3 -8
  69. package/src/Api/Implementation/FormatColumnApiImpl.js +4 -4
  70. package/src/Api/Implementation/FreeTextColumnApiImpl.js +1 -1
  71. package/src/Api/Implementation/GridApiImpl.d.ts +9 -1
  72. package/src/Api/Implementation/GridApiImpl.js +63 -9
  73. package/src/Api/Implementation/LayoutApiImpl.d.ts +4 -11
  74. package/src/Api/Implementation/LayoutApiImpl.js +20 -28
  75. package/src/Api/Implementation/NoteApiImpl.d.ts +18 -0
  76. package/src/Api/Implementation/NoteApiImpl.js +40 -0
  77. package/src/Api/Implementation/OptionsApiImpl.d.ts +6 -5
  78. package/src/Api/Implementation/OptionsApiImpl.js +7 -4
  79. package/src/Api/Implementation/PredicateApiImpl.js +2 -2
  80. package/src/Api/Implementation/ScheduleApiImpl.js +6 -6
  81. package/src/Api/Implementation/TeamSharingApiImpl.js +3 -15
  82. package/src/Api/Implementation/ThemeApiImpl.js +2 -7
  83. package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +14 -8
  84. package/src/Api/Implementation/UserInterfaceApiImpl.js +32 -27
  85. package/src/Api/Internal/ActionRowInternalApi.d.ts +1 -0
  86. package/src/Api/Internal/ActionRowInternalApi.js +19 -46
  87. package/src/Api/Internal/AdaptableInternalApi.d.ts +3 -4
  88. package/src/Api/Internal/AdaptableInternalApi.js +16 -30
  89. package/src/Api/Internal/AlertInternalApi.d.ts +2 -2
  90. package/src/Api/Internal/AlertInternalApi.js +7 -20
  91. package/src/Api/Internal/CalculatedColumnInternalApi.js +11 -17
  92. package/src/Api/Internal/ChartingInternalApi.js +13 -13
  93. package/src/Api/Internal/ColumnFilterInternalApi.d.ts +1 -0
  94. package/src/Api/Internal/ColumnFilterInternalApi.js +24 -30
  95. package/src/Api/Internal/ColumnInternalApi.d.ts +2 -0
  96. package/src/Api/Internal/ColumnInternalApi.js +7 -1
  97. package/src/Api/Internal/CommentsInternalApi.d.ts +4 -0
  98. package/src/Api/Internal/CommentsInternalApi.js +14 -0
  99. package/src/Api/Internal/CustomSortInternalApi.js +1 -1
  100. package/src/Api/Internal/DashboardInternalApi.js +5 -11
  101. package/src/Api/Internal/DataImportInternalApi.js +3 -9
  102. package/src/Api/Internal/DataSetInternalApi.js +2 -7
  103. package/src/Api/Internal/ExportInternalApi.d.ts +2 -1
  104. package/src/Api/Internal/ExportInternalApi.js +8 -5
  105. package/src/Api/Internal/ExpressionInternalApi.js +3 -13
  106. package/src/Api/Internal/Fdc3InternalApi.js +3 -12
  107. package/src/Api/Internal/FormatColumnInternalApi.d.ts +3 -6
  108. package/src/Api/Internal/FormatColumnInternalApi.js +38 -30
  109. package/src/Api/Internal/FreeTextColumnInternalApi.js +5 -4
  110. package/src/Api/Internal/GridFilterInternalApi.d.ts +5 -0
  111. package/src/Api/Internal/GridFilterInternalApi.js +8 -8
  112. package/src/Api/Internal/GridInternalApi.d.ts +2 -0
  113. package/src/Api/Internal/GridInternalApi.js +28 -40
  114. package/src/Api/Internal/LayoutInternalApi.d.ts +2 -0
  115. package/src/Api/Internal/LayoutInternalApi.js +26 -19
  116. package/src/Api/Internal/NoteInternalApi.d.ts +4 -0
  117. package/src/Api/Internal/NoteInternalApi.js +14 -0
  118. package/src/Api/Internal/PredicateInternalApi.d.ts +6 -6
  119. package/src/Api/Internal/PredicateInternalApi.js +5 -40
  120. package/src/Api/Internal/ScheduleInternalApi.js +1 -6
  121. package/src/Api/Internal/StyledColumnInternalApi.d.ts +2 -2
  122. package/src/Api/Internal/StyledColumnInternalApi.js +8 -9
  123. package/src/Api/Internal/SystemStatusInternalApi.js +1 -7
  124. package/src/Api/Internal/TeamSharingInternalApi.js +2 -7
  125. package/src/Api/Internal/ThemeInternalApi.js +1 -1
  126. package/src/Api/Internal/UserInterfaceInternalApi.js +1 -1
  127. package/src/Api/LayoutApi.d.ts +15 -15
  128. package/src/Api/NoteApi.d.ts +48 -0
  129. package/src/Api/NoteApi.js +1 -0
  130. package/src/Api/OptionsApi.d.ts +14 -10
  131. package/src/Api/UserInterfaceApi.d.ts +15 -13
  132. package/src/PredefinedConfig/AdaptableState.d.ts +2 -2
  133. package/src/PredefinedConfig/AlertState.d.ts +2 -2
  134. package/src/PredefinedConfig/CommentState.d.ts +27 -23
  135. package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +4 -0
  136. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  137. package/src/PredefinedConfig/Common/AdaptableObject.d.ts +4 -4
  138. package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +2 -2
  139. package/src/PredefinedConfig/Common/CellSummary.d.ts +5 -14
  140. package/src/PredefinedConfig/Common/{AdaptableScope.d.ts → ColumnScope.d.ts} +4 -1
  141. package/src/PredefinedConfig/Common/ColumnScope.js +1 -0
  142. package/src/PredefinedConfig/Common/DataUpdateConfig.d.ts +1 -5
  143. package/src/PredefinedConfig/Common/Enums.d.ts +4 -1
  144. package/src/PredefinedConfig/Common/Enums.js +3 -0
  145. package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +2 -2
  146. package/src/PredefinedConfig/Common/Menu.d.ts +39 -4
  147. package/src/PredefinedConfig/Common/Menu.js +125 -1
  148. package/src/PredefinedConfig/Common/RowScope.d.ts +17 -0
  149. package/src/PredefinedConfig/Common/RowScope.js +1 -0
  150. package/src/PredefinedConfig/Common/RowSummary.d.ts +21 -0
  151. package/src/PredefinedConfig/Common/RowSummary.js +17 -0
  152. package/src/PredefinedConfig/Common/TransposeConfig.d.ts +30 -0
  153. package/src/PredefinedConfig/Common/TransposeConfig.js +1 -0
  154. package/src/PredefinedConfig/Common/Types.d.ts +4 -4
  155. package/src/PredefinedConfig/Common/Types.js +4 -1
  156. package/src/PredefinedConfig/ExportState.d.ts +2 -2
  157. package/src/PredefinedConfig/FlashingCellState.d.ts +2 -2
  158. package/src/PredefinedConfig/FormatColumnState.d.ts +9 -5
  159. package/src/PredefinedConfig/LayoutState.d.ts +6 -1
  160. package/src/PredefinedConfig/{NotesState.d.ts → NoteState.d.ts} +4 -4
  161. package/src/PredefinedConfig/NoteState.js +1 -0
  162. package/src/PredefinedConfig/PlusMinusState.d.ts +2 -2
  163. package/src/PredefinedConfig/PopupState.d.ts +1 -2
  164. package/src/PredefinedConfig/PredefinedConfig.d.ts +2 -2
  165. package/src/PredefinedConfig/Selection/GridCell.d.ts +13 -0
  166. package/src/PredefinedConfig/ShortcutState.d.ts +2 -2
  167. package/src/PredefinedConfig/StyledColumnState.d.ts +5 -5
  168. package/src/PredefinedConfig/SystemState.d.ts +12 -4
  169. package/src/Redux/ActionsReducers/CommentsRedux.d.ts +0 -4
  170. package/src/Redux/ActionsReducers/CommentsRedux.js +0 -34
  171. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +9 -0
  172. package/src/Redux/ActionsReducers/LayoutRedux.js +32 -10
  173. package/src/Redux/ActionsReducers/NoteRedux.d.ts +38 -0
  174. package/src/Redux/ActionsReducers/{NotesRedux.js → NoteRedux.js} +24 -24
  175. package/src/Redux/ActionsReducers/PopupRedux.d.ts +5 -13
  176. package/src/Redux/ActionsReducers/PopupRedux.js +0 -19
  177. package/src/Redux/ActionsReducers/SystemRedux.d.ts +15 -4
  178. package/src/Redux/ActionsReducers/SystemRedux.js +24 -9
  179. package/src/Redux/Store/AdaptableStore.js +48 -30
  180. package/src/Redux/Store/Interface/IAdaptableStore.d.ts +2 -2
  181. package/src/Strategy/AdaptableModuleBase.d.ts +10 -10
  182. package/src/Strategy/AdaptableModuleBase.js +13 -16
  183. package/src/Strategy/AlertModule.d.ts +3 -2
  184. package/src/Strategy/AlertModule.js +4 -4
  185. package/src/Strategy/BulkUpdateModule.d.ts +3 -2
  186. package/src/Strategy/BulkUpdateModule.js +2 -1
  187. package/src/Strategy/CalculatedColumnModule.d.ts +3 -4
  188. package/src/Strategy/CalculatedColumnModule.js +18 -14
  189. package/src/Strategy/CellSummaryModule.d.ts +10 -9
  190. package/src/Strategy/CellSummaryModule.js +101 -83
  191. package/src/Strategy/ColumnFilterModule.d.ts +3 -3
  192. package/src/Strategy/ColumnFilterModule.js +36 -57
  193. package/src/Strategy/ColumnInfoModule.d.ts +3 -3
  194. package/src/Strategy/ColumnInfoModule.js +6 -4
  195. package/src/Strategy/CommentModule.d.ts +12 -0
  196. package/src/Strategy/CommentModule.js +70 -0
  197. package/src/Strategy/CustomSortModule.d.ts +1 -2
  198. package/src/Strategy/CustomSortModule.js +3 -2
  199. package/src/Strategy/DashboardModule.d.ts +3 -3
  200. package/src/Strategy/DashboardModule.js +11 -21
  201. package/src/Strategy/DataImportModule.d.ts +4 -4
  202. package/src/Strategy/DataImportModule.js +8 -8
  203. package/src/Strategy/ExportModule.d.ts +1 -2
  204. package/src/Strategy/ExportModule.js +58 -44
  205. package/src/Strategy/Fdc3Module.d.ts +1 -1
  206. package/src/Strategy/Fdc3Module.js +3 -13
  207. package/src/Strategy/FlashingCellModule.d.ts +4 -3
  208. package/src/Strategy/FlashingCellModule.js +10 -10
  209. package/src/Strategy/FormatColumnModule.d.ts +1 -1
  210. package/src/Strategy/FormatColumnModule.js +29 -47
  211. package/src/Strategy/FreeTextColumnModule.d.ts +1 -2
  212. package/src/Strategy/FreeTextColumnModule.js +2 -2
  213. package/src/Strategy/GridInfoModule.d.ts +3 -3
  214. package/src/Strategy/GridInfoModule.js +5 -3
  215. package/src/Strategy/Interface/IModule.d.ts +4 -4
  216. package/src/Strategy/LayoutModule.d.ts +4 -3
  217. package/src/Strategy/LayoutModule.js +71 -72
  218. package/src/Strategy/NoteModule.d.ts +10 -0
  219. package/src/Strategy/NoteModule.js +55 -0
  220. package/src/Strategy/PlusMinusModule.d.ts +1 -2
  221. package/src/Strategy/PlusMinusModule.js +5 -5
  222. package/src/Strategy/SettingsPanelModule.d.ts +3 -3
  223. package/src/Strategy/SettingsPanelModule.js +6 -6
  224. package/src/Strategy/ShortcutModule.js +1 -1
  225. package/src/Strategy/SmartEditModule.d.ts +3 -2
  226. package/src/Strategy/SmartEditModule.js +2 -1
  227. package/src/Strategy/StyledColumnModule.d.ts +2 -1
  228. package/src/Strategy/StyledColumnModule.js +42 -22
  229. package/src/Strategy/SystemStatusModule.d.ts +3 -3
  230. package/src/Strategy/SystemStatusModule.js +6 -3
  231. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.js +4 -2
  232. package/src/Strategy/Utilities/getScopeViewItems.d.ts +2 -2
  233. package/src/Strategy/Utilities/getScopeViewItems.js +3 -0
  234. package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
  235. package/src/Utilities/Constants/GeneralConstants.js +1 -0
  236. package/src/Utilities/Constants/ModuleConstants.d.ts +6 -6
  237. package/src/Utilities/Constants/ModuleConstants.js +6 -6
  238. package/src/Utilities/Defaults/DefaultSettingsPanel.js +2 -2
  239. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -2
  240. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +433 -3
  241. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +3 -3
  242. package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +1 -1
  243. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -1
  244. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +15 -0
  245. package/src/Utilities/Extensions/ArrayExtensions.d.ts +2 -0
  246. package/src/Utilities/Extensions/ArrayExtensions.js +4 -0
  247. package/src/Utilities/Helpers/AdaptableHelper.d.ts +3 -1
  248. package/src/Utilities/Helpers/AdaptableHelper.js +19 -0
  249. package/src/Utilities/Interface/MessagePopups.d.ts +0 -3
  250. package/src/Utilities/MenuItem.d.ts +10 -7
  251. package/src/Utilities/MenuItem.js +6 -3
  252. package/src/Utilities/ObjectFactory.d.ts +3 -3
  253. package/src/Utilities/ObjectFactory.js +7 -25
  254. package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +4 -2
  255. package/src/Utilities/Services/AggregatedScalarLiveValue.js +23 -18
  256. package/src/Utilities/Services/CellPopupService.js +4 -4
  257. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +1 -1
  258. package/src/Utilities/Services/Interface/IReportService.d.ts +1 -4
  259. package/src/Utilities/Services/LicenseService/index.js +1 -190
  260. package/src/Utilities/Services/ModuleService.js +6 -2
  261. package/src/Utilities/Services/QueryLanguageService.d.ts +1 -1
  262. package/src/Utilities/Services/QueryLanguageService.js +4 -3
  263. package/src/Utilities/Services/ReportService.d.ts +7 -5
  264. package/src/Utilities/Services/ReportService.js +245 -26
  265. package/src/Utilities/Services/RowSummaryService.d.ts +26 -0
  266. package/src/Utilities/Services/RowSummaryService.js +155 -0
  267. package/src/Utilities/Services/ValidationService.js +2 -2
  268. package/src/Utilities/adaptableQlUtils.d.ts +2 -0
  269. package/src/Utilities/adaptableQlUtils.js +14 -0
  270. package/src/Utilities/license/decode.js +1 -65
  271. package/src/Utilities/license/hashing.js +1 -43
  272. package/src/View/AdaptableViewFactory.js +2 -2
  273. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.js +1 -1
  274. package/src/View/Alert/AlertEntityRow.js +1 -1
  275. package/src/View/Alert/Utilities/getAvailablePredicates.d.ts +2 -2
  276. package/src/View/Alert/Utilities/getDefaultAlertDefinition.d.ts +1 -1
  277. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -2
  278. package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +1 -1
  279. package/src/View/BulkUpdate/BulkUpdatePopup.js +2 -2
  280. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.d.ts +1 -1
  281. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +3 -3
  282. package/src/View/ColumnInfo/ColumnInfo.js +1 -1
  283. package/src/View/Comments/CommentsEditor.js +28 -17
  284. package/src/View/Comments/CommentsPopup.js +15 -7
  285. package/src/View/Components/AdaptableDateInput/index.d.ts +1 -1
  286. package/src/View/Components/AdaptableInput/AdaptableDateInlineInput.d.ts +5 -0
  287. package/src/View/Components/AdaptableInput/AdaptableDateInlineInput.js +42 -0
  288. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +5 -2
  289. package/src/View/Components/CellPopup/index.d.ts +1 -0
  290. package/src/View/Components/CellPopup/index.js +6 -3
  291. package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/EntityRulePredicatesEditor.d.ts +3 -3
  292. package/src/View/Components/EntityRulesEditor/index.d.ts +3 -3
  293. package/src/View/Components/FilterForm/FilterForm.js +20 -12
  294. package/src/View/Components/FilterForm/QuickFilterForm.js +15 -8
  295. package/src/View/Components/FilterForm/QuickFilterValues.js +39 -23
  296. package/src/View/Components/NewScopeComponent.d.ts +5 -5
  297. package/src/View/Components/NewScopeComponent.js +36 -3
  298. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +4 -1
  299. package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +10 -1
  300. package/src/View/Components/Popups/GridCellPopup/GridCellPopup.js +7 -10
  301. package/src/View/Components/RangesComponent.d.ts +2 -2
  302. package/src/View/Components/RangesComponent.js +1 -1
  303. package/src/View/Components/Selectors/PermittedValuesSelector.js +1 -1
  304. package/src/View/Components/SharedProps/WizardScopeState.d.ts +2 -2
  305. package/src/View/Components/ValueSelector/index.d.ts +1 -0
  306. package/src/View/Components/ValueSelector/index.js +2 -2
  307. package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +1 -1
  308. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +4 -2
  309. package/src/View/DataImport/DataImportWizard/DataImportWizard.js +1 -1
  310. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +2 -2
  311. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +20 -7
  312. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
  313. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
  314. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +27 -12
  315. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +1 -1
  316. package/src/View/FreeTextColumn/FreeTextColumnSummary.js +1 -1
  317. package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +3 -1
  318. package/src/View/GridFilter/GridFilterViewPanel.js +3 -3
  319. package/src/View/GridFilter/useGridFilterExpressionEditor.js +1 -1
  320. package/src/View/Layout/LayoutViewPanel.js +2 -1
  321. package/src/View/Layout/TransposedPopup.js +27 -25
  322. package/src/View/Layout/Wizard/LayoutWizard.js +38 -3
  323. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  324. package/src/View/Layout/Wizard/sections/FilterSection.js +1 -1
  325. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +18 -2
  326. package/src/View/Layout/Wizard/sections/RowSummarySection.d.ts +9 -0
  327. package/src/View/Layout/Wizard/sections/RowSummarySection.js +174 -0
  328. package/src/View/License/LicenseWatermark.js +1 -61
  329. package/src/View/Note/NotePopup.d.ts +2 -0
  330. package/src/View/{Notes/NotesPopup.js → Note/NotePopup.js} +14 -9
  331. package/src/View/PlusMinus/PlusMinusSummary.js +2 -2
  332. package/src/View/SmartEdit/SmartEditPopup.js +1 -1
  333. package/src/View/SpecialColumnSettingsWizardStep.js +4 -4
  334. package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +5 -7
  335. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +1 -1
  336. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +1 -1
  337. package/src/View/StyledColumn/Wizard/StyledColumnWizardSettingsSection.js +38 -14
  338. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +1 -1
  339. package/src/agGrid/ActionColumnRenderer.js +40 -4
  340. package/src/agGrid/AdaptableAgGrid.d.ts +21 -12
  341. package/src/agGrid/AdaptableAgGrid.js +313 -225
  342. package/src/agGrid/AgGridAdapter.d.ts +5 -2
  343. package/src/agGrid/AgGridAdapter.js +20 -0
  344. package/src/agGrid/AgGridColumnAdapter.d.ts +1 -3
  345. package/src/agGrid/AgGridColumnAdapter.js +52 -70
  346. package/src/agGrid/AgGridMenuAdapter.d.ts +25 -8
  347. package/src/agGrid/AgGridMenuAdapter.js +405 -74
  348. package/src/agGrid/AgGridOptionsService.d.ts +4 -1
  349. package/src/agGrid/AgGridOptionsService.js +22 -0
  350. package/src/agGrid/BadgeRenderer.d.ts +2 -2
  351. package/src/agGrid/BadgeRenderer.js +24 -11
  352. package/src/agGrid/PercentBarRenderer.js +2 -1
  353. package/src/agGrid/buildSortedColumnStateForLayout.d.ts +7 -0
  354. package/src/agGrid/buildSortedColumnStateForLayout.js +120 -0
  355. package/src/agGrid/defaultAdaptableOptions.js +7 -12
  356. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +1 -1
  357. package/src/agGrid/editors/AdaptableDateEditor/index.js +1 -1
  358. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -2
  359. package/src/agGrid/sortColumnStateForVisibleColumns.d.ts +12 -0
  360. package/src/agGrid/sortColumnStateForVisibleColumns.js +46 -0
  361. package/src/agGrid/weightedAverage.d.ts +0 -2
  362. package/src/agGrid/weightedAverage.js +0 -54
  363. package/src/components/Accordion.d.ts +7 -0
  364. package/src/components/Accordion.js +36 -0
  365. package/src/components/CheckBox/index.js +1 -1
  366. package/src/components/ColorPicker/ColorPicker.d.ts +1 -1
  367. package/src/components/Datepicker/index.d.ts +1 -1
  368. package/src/components/Datepicker/index.js +10 -2
  369. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +2 -1
  370. package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +0 -1
  371. package/src/components/ExpressionEditor/QueryBuilder/utils.js +1 -14
  372. package/src/components/Input/index.d.ts +1 -2
  373. package/src/components/List/ListGroupItem/index.d.ts +1 -1
  374. package/src/components/ProgressIndicator/ProgressIndicator.js +15 -6
  375. package/src/components/Select/Select.d.ts +1 -1
  376. package/src/components/Select/Select.js +3 -1
  377. package/src/components/Textarea/index.d.ts +2 -2
  378. package/src/components/icons/collapse-all.d.ts +3 -0
  379. package/src/components/icons/collapse-all.js +4 -0
  380. package/src/components/icons/copy.d.ts +3 -0
  381. package/src/components/icons/copy.js +4 -0
  382. package/src/components/icons/csv.d.ts +3 -0
  383. package/src/components/icons/csv.js +4 -0
  384. package/src/components/icons/data-object.d.ts +3 -0
  385. package/src/components/icons/data-object.js +4 -0
  386. package/src/components/icons/excel.d.ts +3 -0
  387. package/src/components/icons/excel.js +5 -0
  388. package/src/components/icons/expand-all.d.ts +3 -0
  389. package/src/components/icons/expand-all.js +4 -0
  390. package/src/components/icons/filter-off.d.ts +3 -0
  391. package/src/components/icons/filter-off.js +4 -0
  392. package/src/components/icons/grid-info.d.ts +3 -0
  393. package/src/components/icons/grid-info.js +4 -0
  394. package/src/components/icons/index.js +24 -0
  395. package/src/components/icons/note.js +2 -2
  396. package/src/components/icons/rows.d.ts +3 -0
  397. package/src/components/icons/rows.js +4 -0
  398. package/src/components/icons/select-all.d.ts +3 -0
  399. package/src/components/icons/select-all.js +4 -0
  400. package/src/components/icons/select-fwd.d.ts +3 -0
  401. package/src/components/icons/select-fwd.js +4 -0
  402. package/src/components/icons/select-off.d.ts +3 -0
  403. package/src/components/icons/select-off.js +4 -0
  404. package/src/env.js +2 -2
  405. package/src/metamodel/adaptable.metamodel.d.ts +230 -116
  406. package/src/metamodel/adaptable.metamodel.js +1 -9408
  407. package/src/parser/src/parser.js +576 -553
  408. package/src/parser/src/predicate/mapExpressionToQlPredicate.js +1 -1
  409. package/src/parser/src/predicate/mapQlPredicateToExpression.js +3 -4
  410. package/src/parser/src/types.d.ts +7 -2
  411. package/src/parser/src/types.js +1 -2
  412. package/src/types.d.ts +32 -25
  413. package/tsconfig.esm.tsbuildinfo +1 -1
  414. package/src/AdaptableOptions/MenuOptions.d.ts +0 -234
  415. package/src/AdaptableOptions/MenuOptions.js +0 -95
  416. package/src/Api/Events/CommentsChangedInfo.d.ts +0 -5
  417. package/src/Api/Implementation/NotesApiImpl.d.ts +0 -14
  418. package/src/Api/Implementation/NotesApiImpl.js +0 -35
  419. package/src/Api/Implementation/ScopeApiImpl.d.ts +0 -31
  420. package/src/Api/NotesApi.d.ts +0 -48
  421. package/src/PredefinedConfig/CellAddress.d.ts +0 -13
  422. package/src/PredefinedConfig/CellAddress.js +0 -4
  423. package/src/Redux/ActionsReducers/NotesRedux.d.ts +0 -38
  424. package/src/Strategy/CommentsModule.d.ts +0 -17
  425. package/src/Strategy/CommentsModule.js +0 -78
  426. package/src/Strategy/NotesModule.d.ts +0 -10
  427. package/src/Strategy/NotesModule.js +0 -57
  428. package/src/View/Components/ScopeComponent.d.ts +0 -24
  429. package/src/View/Components/ScopeComponent.js +0 -133
  430. package/src/View/Export/Wizard/ReportScopeWizard.d.ts +0 -17
  431. package/src/View/Export/Wizard/ReportScopeWizard.js +0 -47
  432. package/src/View/Notes/NotesPopup.d.ts +0 -2
  433. /package/src/{Api/Events/CommentsChangedInfo.js → AdaptableOptions/ColumnMenuOptions.js} +0 -0
  434. /package/src/{Api/NotesApi.js → AdaptableOptions/ContextMenuOptions.js} +0 -0
  435. /package/src/Api/{ScopeApi.js → ColumnMenuApi.js} +0 -0
  436. /package/src/{PredefinedConfig/Common/AdaptableScope.js → Api/ColumnScopeApi.js} +0 -0
  437. /package/src/{PredefinedConfig/NotesState.js → Api/ContextMenuApi.js} +0 -0
  438. /package/src/View/{Notes → Note}/NoteEditor.d.ts +0 -0
  439. /package/src/View/{Notes → Note}/NoteEditor.js +0 -0
@@ -59,12 +59,12 @@ import { ColumnInfoModule } from '../Strategy/ColumnInfoModule';
59
59
  import { SettingsPanelModule } from '../Strategy/SettingsPanelModule';
60
60
  import { StatusBarModule } from '../Strategy/StatusBarModule';
61
61
  import { ChartingModule } from '../Strategy/ChartingModule';
62
- import { NotesModule } from '../Strategy/NotesModule';
62
+ import { NoteModule } from '../Strategy/NoteModule';
63
63
  import { StyledColumnModule } from '../Strategy/StyledColumnModule';
64
64
  import { Fdc3Module } from '../Strategy/Fdc3Module';
65
65
  import { GridFilterModule } from '../Strategy/GridFilterModule';
66
66
  import { NamedQueryModule } from '../Strategy/NamedQueryModule';
67
- import { CommentsModule } from '../Strategy/CommentsModule';
67
+ import { CommentModule } from '../Strategy/CommentModule';
68
68
  import { AdaptableNumberEditor, ReactAdaptableNumberEditor } from './editors/AdaptableNumberEditor';
69
69
  import { AdaptableDateEditor, ReactAdaptableDateEditor } from './editors/AdaptableDateEditor';
70
70
  import { Helper } from '../Utilities/Helpers/Helper';
@@ -95,6 +95,8 @@ import { AdaptableUpgradeHelper } from '../migration/AdaptableUpgradeHelper';
95
95
  import { ensurePortalElement } from '../components/Modal';
96
96
  import { AdaptableLoadingScreen } from '../View/Components/Popups/AdaptableLoadingScreen';
97
97
  import { createElement } from 'react';
98
+ import { removeUuidAndSource } from '../Utilities/Helpers/AdaptableHelper';
99
+ import { buildSortedColumnStateForLayout } from './buildSortedColumnStateForLayout';
98
100
  const RowNodeProto = RowNode.prototype;
99
101
  const RowNode_dispatchLocalEvent = RowNodeProto.dispatchLocalEvent;
100
102
  /**
@@ -138,6 +140,11 @@ const adaptableInstances = {};
138
140
  const publishTimestamp = Number(ADAPTABLE_PUBLISH_TIMESTAMP);
139
141
  export class AdaptableAgGrid {
140
142
  constructor() {
143
+ /**
144
+ * once layouts are properly handled with the new aggrid methods & events
145
+ * we can remove this hack
146
+ */
147
+ this.previousAgGridLayoutState = '';
141
148
  this.columnMinMaxValuesCache = {};
142
149
  this.renderReactRoot = (node, container) => defaultRenderReactRoot(node, container);
143
150
  /**
@@ -248,11 +255,11 @@ export class AdaptableAgGrid {
248
255
  async _initAdaptableAgGrid(config) {
249
256
  var _a, _b;
250
257
  // Phase 1: Preprocess Adaptable Options
258
+ this._isDetailGrid = config.isDetailGrid === true;
251
259
  this.lifecycleState = 'preprocessOptions';
252
260
  this._rawAdaptableOptions = config.adaptableOptions;
253
261
  if (StringExtensions.IsNullOrEmptyOrWhiteSpace(this._rawAdaptableOptions.adaptableId)) {
254
- AdaptableLogger.consoleErrorBase(`'AdaptableOptions.adaptableId' is a required property and cannot be empty or null`);
255
- this._rawAdaptableOptions.adaptableId = `AdapTable_${Date.now()}`;
262
+ this._rawAdaptableOptions.adaptableId = `adaptable_id_${Date.now()}`;
256
263
  }
257
264
  this.logger = (_a = this.logger) !== null && _a !== void 0 ? _a : new AdaptableLogger(this._rawAdaptableOptions.adaptableId);
258
265
  const perfInitAdaptableAgGrid = this.logger.beginPerf(`Adaptable._initAdaptableAgGrid()`);
@@ -290,6 +297,7 @@ export class AdaptableAgGrid {
290
297
  this.forPlugins((plugin) => plugin.afterInitModules(this, this.adaptableModules));
291
298
  const perfLoadStore = this.logger.beginPerf(`loadStore()`);
292
299
  this.adaptableStore = this.initAdaptableStore();
300
+ this.forPlugins((plugin) => plugin.afterInitStore(this));
293
301
  await this.adaptableStore.loadStore({
294
302
  adaptable: this,
295
303
  adaptableStateKey: this.adaptableOptions.adaptableStateKey,
@@ -299,15 +307,14 @@ export class AdaptableAgGrid {
299
307
  * e.g. adding default Layout, migrating deprecated state, etc.
300
308
  */
301
309
  postLoadHook: (state) => {
302
- if (this.adaptableOptions.autoMigrateState) {
310
+ if (this.adaptableOptions.stateOptions.autoMigrateState) {
303
311
  state = AdaptableUpgradeHelper.migrateAdaptableState(state, {
304
312
  // version 16 actually includes all versions up until 16
305
313
  fromVersion: 16,
306
314
  logger: this.logger,
307
315
  });
308
316
  }
309
- state = this.normaliseLayoutState(state, config);
310
- state = this.normaliseToolPanelState(state);
317
+ state = this.normalizeAdaptableState(state, config.gridOptions);
311
318
  return state;
312
319
  },
313
320
  });
@@ -317,8 +324,7 @@ export class AdaptableAgGrid {
317
324
  return Promise.reject('Adaptable was destroyed while loading the store.');
318
325
  // FIXME AFL MIG: is this enough?! talk with the team
319
326
  }
320
- this.forPlugins((plugin) => plugin.afterInitServices(this));
321
- this.forPlugins((plugin) => plugin.afterInitModules(this, this.adaptableModules));
327
+ this.forPlugins((plugin) => plugin.afterInitialStateLoaded(this));
322
328
  // do this now so it sets module entitlements
323
329
  this.EntitlementService.setModulesEntitlements();
324
330
  /**
@@ -354,7 +360,7 @@ export class AdaptableAgGrid {
354
360
  this.api.themeApi.applyCurrentTheme();
355
361
  this.validatePrimaryKey();
356
362
  this.embedColumnMenu = this.agGridAdapter.isModulePresent(ModuleNames.MenuModule);
357
- this.api.internalApi.setTreeMode(this.agGridAdapter.initialGridOptions.treeData);
363
+ this.api.internalApi.setTreeMode(!!this.agGridAdapter.getAgGridApi().getGridOption('treeData'));
358
364
  // TODO AFL MIG: we could just patch the defautl Layout on init? instead
359
365
  this.checkShouldClearExistingFiltersOrSearches();
360
366
  this.applyColumnFiltering();
@@ -362,6 +368,16 @@ export class AdaptableAgGrid {
362
368
  this.temporaryAdaptableStateUpdates();
363
369
  this.redrawBody();
364
370
  this.refreshHeader();
371
+ const currentLayout = this.api.layoutApi.getCurrentLayout();
372
+ if (currentLayout.EnablePivot) {
373
+ // this is very very strange!
374
+ // for some projects, if the initial layout is pivot, the columnDefs of the pivot resutl columns are NOT derived correctly from the main colDefs
375
+ // doing the following line fixes the issue because it foces the pivot columns to be created again
376
+ // this proj works without the hack: /tests/pages/format-column/initial-pivot-layout.page.tsx
377
+ // but this proj needs the hack: /tests/pages/format-column/initial-pivot-layout-docs.page.tsx
378
+ this.agGridAdapter.setGridOption('pivotMode', false);
379
+ this.agGridAdapter.setGridOption('pivotMode', true);
380
+ }
365
381
  // create the module menu (for use in the dashboard and the toolpanel)
366
382
  // TODO see #create-create-module-menu - make sure it's the same here and there
367
383
  this.ModuleService.createModuleMenus();
@@ -378,14 +394,18 @@ export class AdaptableAgGrid {
378
394
  adaptableApi: this.api,
379
395
  agGridApi: this.agGridAdapter.getAgGridApi(),
380
396
  });
381
- this.api.userInterfaceApi.hideLoadingScreen();
382
397
  perfInitAdaptableAgGrid.end();
383
398
  return Promise.resolve(this.api);
384
399
  }
385
- normaliseLayoutState(state, config) {
400
+ normalizeAdaptableState(state, gridOptions) {
401
+ state = this.normaliseLayoutState(state, gridOptions);
402
+ state = this.normaliseToolPanelState(state);
403
+ return state;
404
+ }
405
+ normaliseLayoutState(state, gridOptions) {
386
406
  var _a, _b, _c, _d, _e, _f;
387
407
  if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
388
- const defaultLayout = this.createDefaultLayout(state, config.gridOptions.columnDefs);
408
+ const defaultLayout = this.createDefaultLayout(state, gridOptions.columnDefs);
389
409
  const layoutState = state.Layout || {};
390
410
  const availableLayouts = layoutState.Layouts || [];
391
411
  availableLayouts.push(defaultLayout);
@@ -421,7 +441,7 @@ export class AdaptableAgGrid {
421
441
  * logic where layout is applied, it is easier and
422
442
  * less error prone to just remove it.
423
443
  */
424
- if (config.gridOptions.rowModelType === 'viewport') {
444
+ if (gridOptions.rowModelType === 'viewport') {
425
445
  (_f = state.Layout.Layouts) === null || _f === void 0 ? void 0 : _f.forEach((layout) => {
426
446
  if (layout.RowGroupedColumns) {
427
447
  delete layout.RowGroupedColumns;
@@ -451,15 +471,19 @@ export class AdaptableAgGrid {
451
471
  state.ToolPanel = toolPanelState;
452
472
  return state;
453
473
  }
454
- applyColumnFiltering() {
455
- if (this.api.columnFilterApi.isQuickFilterAvailable()) {
456
- if (this.api.columnFilterApi.isQuickFilterVisible()) {
457
- this.showQuickFilter();
474
+ refreshQuickFilter() {
475
+ const isQuickFilterVisible = this.api.internalApi.getSystemState().IsQuickFilterVisible;
476
+ if (this.isQuickFilterAvailable()) {
477
+ if (isQuickFilterVisible) {
478
+ this.api.columnFilterApi.showQuickFilterBar();
458
479
  }
459
480
  else {
460
- this.hideQuickFilter();
481
+ this.api.columnFilterApi.hideQuickFilterBar();
461
482
  }
462
483
  }
484
+ }
485
+ applyColumnFiltering() {
486
+ this.refreshQuickFilter();
463
487
  this.applyGridFiltering();
464
488
  this.agGridAdapter.updateColumnFilterActiveState();
465
489
  }
@@ -702,6 +726,20 @@ export class AdaptableAgGrid {
702
726
  return nodeA.key < nodeB.key ? -1 : 1;
703
727
  };
704
728
  });
729
+ /**
730
+ * `autoSizeStrategy`
731
+ *
732
+ * This is needed here, even if we do auto sizing on FIRST_DATA_RENDERED.
733
+ * Sometimes FIRST_DATA_RENDERED is triggered too early and autoSizing doesn't work initially
734
+ * so we need this block
735
+ */
736
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'autoSizeStrategy', (original_autoSizeStrategy) => {
737
+ return this.shouldAutoSizeLayout()
738
+ ? {
739
+ type: 'fitCellContents',
740
+ }
741
+ : original_autoSizeStrategy;
742
+ });
705
743
  }
706
744
  /**
707
745
  * `components`
@@ -850,12 +888,40 @@ export class AdaptableAgGrid {
850
888
  return (returnValue === null || returnValue === void 0 ? void 0 : returnValue.length) ? returnValue : undefined;
851
889
  };
852
890
  });
891
+ /**
892
+ * `floatingFiltersHeight`
893
+ */
894
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'floatingFiltersHeight', (original_floatingFiltersHeight) => {
895
+ if (this.api.layoutApi.getCurrentLayout().EnablePivot) {
896
+ // if the default layout is a pivot on, hide the floating filters from the beginning, otherwise we get an annoying flicker
897
+ return 0;
898
+ }
899
+ return original_floatingFiltersHeight;
900
+ });
901
+ /**
902
+ * `excelStyles`
903
+ */
904
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'excelStyles', (original_excelStyles) => {
905
+ // we need this here just to register the original excelStyles in the service
906
+ return original_excelStyles;
907
+ });
908
+ /**
909
+ * `processPivotResultColDef`
910
+ */
911
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'processPivotResultColDef', () => {
912
+ return (colDef) => {
913
+ if (this.adaptableOptions.columnFilterOptions.useAdaptableColumnFiltering) {
914
+ colDef.floatingFilter = false;
915
+ colDef.filter = false;
916
+ }
917
+ };
918
+ });
853
919
  /**
854
920
  * `columnTypes`
855
921
  */
856
922
  // this will have to go/be heavily extended with https://github.com/AdaptableTools/adaptable/issues/2230
857
923
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'columnTypes', (original_columnTypes) => {
858
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
924
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
859
925
  const providedColumnTypes = original_columnTypes || {};
860
926
  const gridOptionsColumnTypes = gridOptions.columnTypes || {};
861
927
  const patchedColumnTypes = Object.assign(providedColumnTypes, {
@@ -872,6 +938,12 @@ export class AdaptableAgGrid {
872
938
  abColDefTupleNumberArray: (_j = gridOptionsColumnTypes.abColDefTupleNumberArray) !== null && _j !== void 0 ? _j : {},
873
939
  abColDefObjectNumberArray: (_k = gridOptionsColumnTypes.abColDefObjectNumberArray) !== null && _k !== void 0 ? _k : {},
874
940
  });
941
+ const customColumnTypes = (_l = this.api.columnApi.getColumnTypes()) !== null && _l !== void 0 ? _l : [];
942
+ for (const customColumnType of customColumnTypes) {
943
+ if (!patchedColumnTypes[customColumnType]) {
944
+ patchedColumnTypes[customColumnType] = {};
945
+ }
946
+ }
875
947
  if (patchedColumnTypes.abColDefNumber.cellEditor == undefined) {
876
948
  patchedColumnTypes.abColDefNumber.cellEditor =
877
949
  this.variant === 'react' ? ReactAdaptableNumberEditor : AdaptableNumberEditor;
@@ -906,6 +978,9 @@ export class AdaptableAgGrid {
906
978
  return revertedDateTypeDefinitions;
907
979
  });
908
980
  }
981
+ isDetailGrid() {
982
+ return this._isDetailGrid;
983
+ }
909
984
  /**
910
985
  * Either initializes the AG Grid instance or delegates it to the framework wrappers (React/Anglar)
911
986
  */
@@ -919,7 +994,9 @@ export class AdaptableAgGrid {
919
994
  // framework wrapper may pass the rowData as a prop
920
995
  const rowData = agGridApi.getGridOption('rowData');
921
996
  this.initWithLazyData = rowData == undefined || rowData.length === 0;
922
- this.logger.info('initWithLazyData = TRUE');
997
+ if (this.initWithLazyData) {
998
+ this.logger.info('initWithLazyData = TRUE');
999
+ }
923
1000
  if (!this.getAgGridContainerElement()) {
924
1001
  // initialize the agGridContainerElement from the AgGrid instance
925
1002
  // @ts-ignore
@@ -947,19 +1024,21 @@ export class AdaptableAgGrid {
947
1024
  }
948
1025
  getAllColumnDefinitions(agGridColDefs) {
949
1026
  const allColDefs = this.enhanceColDefsWithSpecialColumns(agGridColDefs !== null && agGridColDefs !== void 0 ? agGridColDefs : this.agGridAdapter.getAgGridApi().getColumnDefs());
950
- this.agGridAdapter.assignColumnIdsToColDefs(allColDefs);
951
1027
  return allColDefs;
952
1028
  }
953
1029
  getSpecialColDefs() {
954
- return [
1030
+ const specialColDefs = [
955
1031
  ...this.api.calculatedColumnApi.internalApi.getColDefsForCalculatedColumns(),
956
1032
  ...this.api.actionColumnApi.getColDefsForActionColumns(),
957
1033
  ...this.api.freeTextColumnApi.internalApi.getColDefsForFreeTextColumns(),
958
1034
  ...this.api.actionRowApi.internalApi.getColDefsForActionRowColumns(),
959
1035
  ...this.api.fdc3Api.internalApi.getFdc3ActionColDefs(),
960
1036
  ];
1037
+ this.agGridAdapter.assignColumnIdsToColDefs(specialColDefs);
1038
+ return specialColDefs;
961
1039
  }
962
1040
  enhanceColDefsWithSpecialColumns(agGridColDefs) {
1041
+ this.agGridAdapter.assignColumnIdsToColDefs(agGridColDefs);
963
1042
  const specialColDefs = this.getSpecialColDefs();
964
1043
  const isSpecialColDef = (colDef) => {
965
1044
  const { type } = colDef;
@@ -983,7 +1062,9 @@ export class AdaptableAgGrid {
983
1062
  else {
984
1063
  if (!isSpecialColDef(colDef)) {
985
1064
  // if it's not a special column, return it as is
986
- return colDef;
1065
+ // without a minWidth, columns in details grid are VERY wide
1066
+ // so the line below fixes https://github.com/AdaptableTools/adaptable/issues/2559
1067
+ return Object.assign({ minWidth: 10 }, colDef);
987
1068
  }
988
1069
  const newlyCreatedSpecialColDef = specialColDefs.find((specialColDef) => specialColDef.colId === colDef.colId);
989
1070
  if (newlyCreatedSpecialColDef) {
@@ -991,7 +1072,9 @@ export class AdaptableAgGrid {
991
1072
  processedSpecialColDefIds.push(colDef.colId);
992
1073
  // merge the user defined colDef with the special col def
993
1074
  // this way the user may provide some custom settings for the special col def (tooltip, etc)
994
- const mergedColDef = Object.assign(Object.assign({}, colDef), newlyCreatedSpecialColDef);
1075
+ const mergedColDef = Object.assign(Object.assign({
1076
+ // see above comment for minWidth
1077
+ minWidth: 10 }, colDef), newlyCreatedSpecialColDef);
995
1078
  return mergedColDef;
996
1079
  }
997
1080
  else {
@@ -1020,7 +1103,7 @@ export class AdaptableAgGrid {
1020
1103
  return resultColDefs;
1021
1104
  }
1022
1105
  useRowNodeLookUp() {
1023
- return this.agGridAdapter.initialGridOptions.getRowId != undefined;
1106
+ return this.agGridAdapter.getAgGridApi().getGridOption('getRowId') != undefined;
1024
1107
  }
1025
1108
  getAgGridContainerElement() {
1026
1109
  if (!this.DANGER_USE_GETTER_agGridContainerElement) {
@@ -1043,10 +1126,7 @@ export class AdaptableAgGrid {
1043
1126
  // This method returns selected cells ONLY (if selection mode is cells or multiple cells).
1044
1127
  // If the selection mode is row it will returns nothing - use the setSelectedRows() method
1045
1128
  refreshSelectedCellsState() {
1046
- var _a;
1047
- const isRangeSelectionModuleRegistered = this.agGridAdapter.isModulePresent(ModuleNames.RangeSelectionModule);
1048
- if (!isRangeSelectionModuleRegistered ||
1049
- !((_a = this.agGridAdapter.getLiveGridOptions()) === null || _a === void 0 ? void 0 : _a.enableRangeSelection) === true) {
1129
+ if (!this.isGridRangeSelectable()) {
1050
1130
  return;
1051
1131
  }
1052
1132
  const selectedCellInfo = this.agGridAdapter.deriveSelectedCellInfoFromAgGrid();
@@ -1057,8 +1137,8 @@ export class AdaptableAgGrid {
1057
1137
  return selectedCellInfo;
1058
1138
  }
1059
1139
  refreshSelectedRowsState() {
1060
- if (!this.isGridSelectable()) {
1061
- return undefined;
1140
+ if (!this.isGridRowSelectable()) {
1141
+ return;
1062
1142
  }
1063
1143
  const selectedRowInfo = this.agGridAdapter.deriveSelectedRowInfoFromAgGrid();
1064
1144
  this.api.gridApi.internalApi.setSelectedRows(selectedRowInfo);
@@ -1066,9 +1146,13 @@ export class AdaptableAgGrid {
1066
1146
  this.api.eventApi.emit('RowSelectionChanged', rowSelectionChangedInfo);
1067
1147
  return selectedRowInfo;
1068
1148
  }
1069
- isGridSelectable() {
1070
- return (this.agGridAdapter.initialGridOptions.rowSelection === 'single' ||
1071
- this.agGridAdapter.initialGridOptions.rowSelection === 'multiple');
1149
+ isGridRowSelectable() {
1150
+ const rowSelection = this.agGridAdapter.getAgGridApi().getGridOption('rowSelection');
1151
+ return rowSelection === 'single' || rowSelection === 'multiple';
1152
+ }
1153
+ isGridRangeSelectable() {
1154
+ return (this.agGridAdapter.isModulePresent(ModuleNames.RangeSelectionModule) &&
1155
+ this.agGridAdapter.getGridOption('enableRangeSelection'));
1072
1156
  }
1073
1157
  initAdaptableStore() {
1074
1158
  const perfNewAdaptableStore = this.logger.beginPerf(`initAdaptableStore()`);
@@ -1084,15 +1168,26 @@ export class AdaptableAgGrid {
1084
1168
  var _a, _b, _c;
1085
1169
  const agGridState = {};
1086
1170
  const currentLayoutName = (_a = adaptableState.Layout) === null || _a === void 0 ? void 0 : _a.CurrentLayout;
1087
- const currentLayout = currentLayoutName &&
1171
+ const _currentLayout = currentLayoutName &&
1088
1172
  ((_c = (_b = adaptableState.Layout) === null || _b === void 0 ? void 0 : _b.Layouts) === null || _c === void 0 ? void 0 : _c.find((l) => l.Name === currentLayoutName));
1089
- if (!currentLayout) {
1173
+ if (!_currentLayout) {
1090
1174
  return agGridState;
1091
1175
  }
1092
- const allAgGridColDefIds = agGridColDefs.map((colDef) => colDef.colId);
1093
- const getColDef = (colId) => agGridColDefs.find((colDef) => colDef.colId == colId);
1176
+ const currentLayout = removeUuidAndSource(_currentLayout);
1177
+ const allAgGridFlattenedColDefs = this.agGridAdapter.getFlattenedColDefs(agGridColDefs);
1178
+ const allAgGridColDefIds = allAgGridFlattenedColDefs.map((colDef) => colDef.colId);
1179
+ const { columnApi } = this.api;
1180
+ // also add the row group columns, if they are specified in the layout
1181
+ currentLayout.Columns.forEach((colId) => {
1182
+ if (columnApi.isAutoRowGroupColumn(colId)) {
1183
+ allAgGridColDefIds.push(colId);
1184
+ }
1185
+ });
1186
+ const getColDef = (colId) => allAgGridFlattenedColDefs.find((colDef) => colDef.colId === colId);
1094
1187
  agGridState.columnVisibility = {
1095
- hiddenColIds: allAgGridColDefIds.filter((colDefId) => { var _a; return !((_a = currentLayout.Columns) === null || _a === void 0 ? void 0 : _a.includes(colDefId)); }),
1188
+ hiddenColIds: allAgGridFlattenedColDefs
1189
+ .filter((colDef) => { var _a; return !((_a = currentLayout.Columns) === null || _a === void 0 ? void 0 : _a.includes(colDef.colId)) || colDef.hide || colDef.initialHide; })
1190
+ .map((colDef) => colDef.colId),
1096
1191
  };
1097
1192
  agGridState.columnOrder = {
1098
1193
  orderedColIds: sortWithOrderArray(allAgGridColDefIds, currentLayout.Columns || [], {
@@ -1235,7 +1330,9 @@ export class AdaptableAgGrid {
1235
1330
  if (this.initWithLazyData) {
1236
1331
  this.updateColumnModelAndRefreshGrid();
1237
1332
  this.api.calculatedColumnApi.refreshAggregatedCalculatedColumns();
1333
+ this._emit('FirstDataRendered');
1238
1334
  }
1335
+ this.autoSizeLayoutIfNeeded();
1239
1336
  }));
1240
1337
  /**
1241
1338
  * Use Case: Entered or Left Pivot Mode
@@ -1286,16 +1383,17 @@ export class AdaptableAgGrid {
1286
1383
  // ADD filter event
1287
1384
  this.agGridAdapter.getAgGridApi().addGlobalListener((this.listenerGlobalColumnEventsThatTriggerAutoLayoutSave = (type) => {
1288
1385
  if (columnEventsThatTriggersAutoLayoutSave.indexOf(type) > -1) {
1289
- this.debouncedSaveGridLayout();
1386
+ this.debouncedSaveGridLayout(type);
1290
1387
  }
1291
1388
  }));
1292
1389
  /**
1293
1390
  * Save Layout if Display Row Groups is "dynamic
1294
1391
  */
1295
- this.debouncedSaveGridLayout = debounce(() => {
1392
+ this.debouncedSaveGridLayout = debounce((type) => {
1296
1393
  if (!this.isReady) {
1297
1394
  return;
1298
1395
  }
1396
+ this.logger.info('Event Triggering Auto Layout Save', type || '');
1299
1397
  this.updateLayoutFromGrid();
1300
1398
  }, HALF_SECOND);
1301
1399
  const rowGroupEventsThatTriggersAutoLayoutSave = [
@@ -1305,7 +1403,7 @@ export class AdaptableAgGrid {
1305
1403
  this.agGridAdapter.getAgGridApi().addGlobalListener((this.listenerGlobalRowGroupEventsThatTriggerAutoLayoutSave = (type) => {
1306
1404
  if (rowGroupEventsThatTriggersAutoLayoutSave.indexOf(type) > -1) {
1307
1405
  if (this.adaptableOptions.layoutOptions.displayRowGroups == 'dynamic') {
1308
- this.debouncedSaveGridLayout();
1406
+ this.debouncedSaveGridLayout(type);
1309
1407
  }
1310
1408
  }
1311
1409
  }));
@@ -1329,7 +1427,7 @@ export class AdaptableAgGrid {
1329
1427
  */
1330
1428
  this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_COLUMN_RESIZED, (this.listenerColumnResized = (params) => {
1331
1429
  if (params.finished == true && params.type == 'columnResized' && params.column) {
1332
- this.debouncedSaveGridLayout();
1430
+ this.debouncedSaveGridLayout(params.type);
1333
1431
  }
1334
1432
  }));
1335
1433
  /**
@@ -1376,26 +1474,6 @@ export class AdaptableAgGrid {
1376
1474
  this.onSortChanged();
1377
1475
  this.debouncedSetSelectedCells();
1378
1476
  }));
1379
- const showGroupingTotalsAsHeader = this.adaptableOptions.groupingOptions.showGroupingTotalsAsHeader;
1380
- /**
1381
- * Use Case: Model has updated
1382
- * Action: If user has set to see grouping totals as header create a pinned row (bit of a hack)
1383
- */
1384
- this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_MODEL_UPDATED, (this.listenerModelUpdated = (params) => {
1385
- if (showGroupingTotalsAsHeader) {
1386
- if (params && params.api) {
1387
- const pinnedData = params.api.getPinnedTopRow(0);
1388
- const model = params.api.getModel();
1389
- const rootNode = model.getRootNode();
1390
- if (!pinnedData) {
1391
- params.api.setPinnedTopRowData([rootNode.aggData]);
1392
- }
1393
- else {
1394
- pinnedData.updateData(rootNode.aggData);
1395
- }
1396
- }
1397
- }
1398
- }));
1399
1477
  const eventsThatTriggerChartingChanges = [
1400
1478
  Events.EVENT_CHART_CREATED,
1401
1479
  /** Chart Range selection has changed */
@@ -1437,6 +1515,25 @@ export class AdaptableAgGrid {
1437
1515
  },
1438
1516
  };
1439
1517
  }
1518
+ shouldAutoSizeLayout() {
1519
+ const { layoutApi } = this.api;
1520
+ const { layoutOptions } = this.adaptableOptions;
1521
+ const currentLayout = layoutApi.getCurrentLayout();
1522
+ if (currentLayout.ColumnWidthMap && Object.keys(currentLayout.ColumnWidthMap).length > 0) {
1523
+ return;
1524
+ }
1525
+ const autoSize = currentLayout.EnablePivot
1526
+ ? layoutOptions.autoSizeColumnsInPivotLayout
1527
+ : layoutOptions.autoSizeColumnsInLayout;
1528
+ return autoSize;
1529
+ }
1530
+ autoSizeLayoutIfNeeded() {
1531
+ if (this.shouldAutoSizeLayout()) {
1532
+ requestAnimationFrame(() => {
1533
+ this.autoSizeAllColumns();
1534
+ });
1535
+ }
1536
+ }
1440
1537
  performAudit(action, oldState, newState) {
1441
1538
  if (this.isReady) {
1442
1539
  const adaptableStateChangedInfo = {
@@ -1512,7 +1609,7 @@ export class AdaptableAgGrid {
1512
1609
  modules.set(ModuleConstants.ChartingModuleId, new ChartingModule(this.api));
1513
1610
  modules.set(ModuleConstants.ColumnFilterModuleId, new ColumnFilterModule(this.api));
1514
1611
  modules.set(ModuleConstants.ColumnInfoModuleId, new ColumnInfoModule(this.api));
1515
- modules.set(ModuleConstants.CommentsModuleId, new CommentsModule(this.api));
1612
+ modules.set(ModuleConstants.CommentModuleId, new CommentModule(this.api));
1516
1613
  modules.set(ModuleConstants.CustomSortModuleId, new CustomSortModule(this.api));
1517
1614
  modules.set(ModuleConstants.DashboardModuleId, new DashboardModule(this.api));
1518
1615
  modules.set(ModuleConstants.DataChangeHistoryModuleId, new DataChangeHistoryModule(this.api));
@@ -1527,7 +1624,7 @@ export class AdaptableAgGrid {
1527
1624
  modules.set(ModuleConstants.GridInfoModuleId, new GridInfoModule(this.api));
1528
1625
  modules.set(ModuleConstants.LayoutModuleId, new LayoutModule(this.api));
1529
1626
  modules.set(ModuleConstants.NamedQueryModuleId, new NamedQueryModule(this.api));
1530
- modules.set(ModuleConstants.NotesModuleId, new NotesModule(this.api));
1627
+ modules.set(ModuleConstants.NoteModuleId, new NoteModule(this.api));
1531
1628
  modules.set(ModuleConstants.PlusMinusModuleId, new PlusMinusModule(this.api));
1532
1629
  modules.set(ModuleConstants.QuickSearchModuleId, new QuickSearchModule(this.api));
1533
1630
  modules.set(ModuleConstants.ScheduleModuleId, new ScheduleModule(this.api));
@@ -1552,7 +1649,9 @@ export class AdaptableAgGrid {
1552
1649
  this.api.eventApi.on('AdaptableReady', () => {
1553
1650
  var _a, _b;
1554
1651
  // update status bar state
1555
- const adaptableStatusPanels = (_b = (_a = this.agGridAdapter.initialGridOptions.statusBar) === null || _a === void 0 ? void 0 : _a.statusPanels) === null || _b === void 0 ? void 0 : _b.filter((statusPanel) => this.adaptableStatusPanelKeys.includes(statusPanel.key));
1652
+ const adaptableStatusPanels = (_b = (_a = this.agGridAdapter
1653
+ .getAgGridApi()
1654
+ .getGridOption('statusBar')) === null || _a === void 0 ? void 0 : _a.statusPanels) === null || _b === void 0 ? void 0 : _b.filter((statusPanel) => this.adaptableStatusPanelKeys.includes(statusPanel.key));
1556
1655
  const statusBarModule = this.ModuleService.getModuleById(ModuleConstants.StatusBarModuleId);
1557
1656
  // need to add only the adaptable panels
1558
1657
  statusBarModule.syncStateWithOptions(adaptableStatusPanels);
@@ -1585,13 +1684,14 @@ export class AdaptableAgGrid {
1585
1684
  // TODO AFL MIG: check why this assertion is here
1586
1685
  .getAllDisplayedColumnGroups();
1587
1686
  const groupsCount = {};
1588
- const colsToGroups = columnGroupChildren.reduce((acc, columnGroup) => {
1687
+ const colsToGroups = (columnGroupChildren !== null && columnGroupChildren !== void 0 ? columnGroupChildren : []).reduce((acc, columnGroup) => {
1589
1688
  var _a, _b, _c;
1590
1689
  if (!((_b = (_a = columnGroup.getProvidedColumnGroup) === null || _a === void 0 ? void 0 : _a.call(columnGroup)) === null || _b === void 0 ? void 0 : _b.getColGroupDef())) {
1591
1690
  return acc;
1592
1691
  }
1593
1692
  const ColumnGroupId = columnGroup.getGroupId();
1594
- const AllowGroupSplit = !columnGroup.getProvidedColumnGroup().getColGroupDef().marryChildren;
1693
+ const AllowGroupSplit = !columnGroup.getProvidedColumnGroup().getColGroupDef()
1694
+ .marryChildren;
1595
1695
  const FriendlyName = (_c = columnGroup.getProvidedColumnGroup().getColGroupDef().headerName) !== null && _c !== void 0 ? _c : ColumnGroupId;
1596
1696
  const columnsInGroup = columnGroup.getLeafColumns();
1597
1697
  columnsInGroup.forEach((col) => {
@@ -1752,7 +1852,10 @@ export class AdaptableAgGrid {
1752
1852
  }
1753
1853
  return rawValue;
1754
1854
  }
1755
- updateColumnModelAndRefreshGrid() {
1855
+ updateColumnModelAndRefreshGrid(config) {
1856
+ if (!(config === null || config === void 0 ? void 0 : config.skipColDefsRefresh)) {
1857
+ this.refreshColDefs();
1858
+ }
1756
1859
  this.deriveAdaptableColumnStateFromAgGrid();
1757
1860
  this.agGridColumnAdapter.setupColumns();
1758
1861
  this.redrawBody();
@@ -2114,50 +2217,20 @@ export class AdaptableAgGrid {
2114
2217
  });
2115
2218
  this.deriveAdaptableColumnStateFromAgGrid();
2116
2219
  }
2117
- getSortedColumnStateForVisibleColumns(visibleColumnList, columnState) {
2220
+ getSortedColumnStateForVisibleColumns(visibleColumnList, columnState, layout) {
2221
+ layout = layout || this.api.layoutApi.getCurrentLayout();
2222
+ visibleColumnList = visibleColumnList || layout.Columns;
2118
2223
  columnState = columnState || this.agGridAdapter.getAgGridApi().getColumnState();
2119
- const NewVisibleColumnIdsMap = visibleColumnList.reduce((acc, colId, index) => {
2120
- acc[colId] = index;
2121
- return acc;
2122
- }, {});
2123
- const columnsStateIndexes = columnState.reduce((acc, colState, index) => {
2124
- acc[colState.colId] = index;
2125
- return acc;
2126
- }, {});
2127
- const newVisibleColumnsMap = visibleColumnList.reduce((acc, colId, index) => {
2128
- acc[colId] = index;
2129
- return acc;
2130
- }, {});
2131
- const result = [...columnState]
2132
- .sort((colState1, colState2) => {
2133
- const colId1 = colState1.colId;
2134
- const colId2 = colState2.colId;
2135
- const originalIndex1 = columnsStateIndexes[colId1];
2136
- const originalIndex2 = columnsStateIndexes[colId2];
2137
- const isRowGroup1 = this.api.columnApi.isAutoRowGroupColumn(colId1);
2138
- const isRowGroup2 = this.api.columnApi.isAutoRowGroupColumn(colId2);
2139
- if (isRowGroup1 && isRowGroup2) {
2140
- return 1;
2141
- }
2142
- if (isRowGroup1) {
2143
- return -1;
2144
- }
2145
- if (isRowGroup2) {
2146
- return 1;
2147
- }
2148
- if (newVisibleColumnsMap[colId1] != null && newVisibleColumnsMap[colId2] == null) {
2149
- return -1;
2150
- }
2151
- if (newVisibleColumnsMap[colId1] == null && newVisibleColumnsMap[colId2] != null) {
2152
- return 1;
2153
- }
2154
- if (newVisibleColumnsMap[colId1] == null && newVisibleColumnsMap[colId2] == null) {
2155
- return originalIndex1 - originalIndex2;
2156
- }
2157
- return newVisibleColumnsMap[colState1.colId] - newVisibleColumnsMap[colState2.colId];
2158
- })
2159
- .map((colState) => (Object.assign(Object.assign({}, colState), { hide: NewVisibleColumnIdsMap[colState.colId] == null })));
2160
- return result;
2224
+ return buildSortedColumnStateForLayout({
2225
+ columnState: columnState.map((colState) => {
2226
+ return {
2227
+ colId: colState.colId,
2228
+ hide: colState.hide,
2229
+ };
2230
+ }),
2231
+ layout: Object.assign(Object.assign({}, layout), { Columns: visibleColumnList }),
2232
+ gridOptions: this.agGridAdapter.getLiveGridOptions(),
2233
+ });
2161
2234
  }
2162
2235
  getDistinctValuesForColumn(column, distinctValuesParams) {
2163
2236
  let gridCells = this.getGridCellsForPermittedValues(column, distinctValuesParams);
@@ -2342,10 +2415,10 @@ export class AdaptableAgGrid {
2342
2415
  });
2343
2416
  }
2344
2417
  getAgGridRowModelType() {
2345
- var _a, _b;
2418
+ var _a;
2346
2419
  // it seems that this can be null so we need explicitly to return "clientSide" in this case
2347
2420
  // need to check that for ServerSideRowModel it is ALWAYS returned...
2348
- return (_b = (_a = this.agGridAdapter.initialGridOptions) === null || _a === void 0 ? void 0 : _a.rowModelType) !== null && _b !== void 0 ? _b : 'clientSide';
2421
+ return (_a = this.agGridAdapter.getAgGridApi().getGridOption('rowModelType')) !== null && _a !== void 0 ? _a : 'clientSide';
2349
2422
  }
2350
2423
  getAllRowNodes(config) {
2351
2424
  let rowNodes = [];
@@ -2468,7 +2541,7 @@ export class AdaptableAgGrid {
2468
2541
  }
2469
2542
  canGenerateCharts() {
2470
2543
  return (this.agGridAdapter.isModulePresent(ModuleNames.GridChartsModule) &&
2471
- this.agGridAdapter.initialGridOptions.enableCharts);
2544
+ this.agGridAdapter.getAgGridApi().getGridOption('enableCharts'));
2472
2545
  }
2473
2546
  canDisplaySparklines() {
2474
2547
  return this.agGridAdapter.isModulePresent(ModuleNames.SparklinesModule);
@@ -2684,7 +2757,7 @@ export class AdaptableAgGrid {
2684
2757
  setRowGroupColumns(columnIds) {
2685
2758
  this.agGridAdapter.getAgGridApi().setRowGroupColumns(columnIds);
2686
2759
  }
2687
- getAgGridAllGridColumns() {
2760
+ getAllGridColumns() {
2688
2761
  return this.agGridAdapter.getAgGridApi().getAllGridColumns();
2689
2762
  }
2690
2763
  clearRowGroupColumns() {
@@ -2865,6 +2938,7 @@ export class AdaptableAgGrid {
2865
2938
  else {
2866
2939
  (_b = this.agGridAdapter.getAgGridApi()) === null || _b === void 0 ? void 0 : _b.destroy();
2867
2940
  }
2941
+ this.previousAgGridLayoutState = '';
2868
2942
  const gridContainerElement = this.getAgGridContainerElement();
2869
2943
  if (gridContainerElement) {
2870
2944
  gridContainerElement.removeEventListener('keydown', this.agGridListenerKeydown);
@@ -2982,54 +3056,89 @@ export class AdaptableAgGrid {
2982
3056
  ephemeralGridApi.destroy();
2983
3057
  }
2984
3058
  exportVisualDataToExcel() {
2985
- // // add adaptable style props to user defined props
2986
- // this.setExcelStylesForExport();
2987
- //
2988
- // this.gridOptions.api.exportDataAsExcel({
2989
- // sheetName: 'Sheet 1',
2990
- // fileName: this.ReportService.getReportFileName(this.adaptableOptions.adaptableId, 'Excel'),
2991
- // // delegate the cell value processing to Adaptable
2992
- // processCellCallback: ({ node, column, value }: ProcessCellForExportParams): string => {
2993
- // const columnId = column.getColId();
2994
- // if (
2995
- // node?.group &&
2996
- // (this.api.columnApi.isAutoRowGroupColumn(columnId) ||
2997
- // // we would still need to process the cell if this is a group row with an aggregated value
2998
- // node?.aggData?.[columnId] == undefined)
2999
- // ) {
3000
- // // skip processing of row groups, this was already handled in processRowGroupCallback()
3001
- // return value;
3002
- // }
3003
- // return this.processCellForExcelExport(node, columnId);
3004
- // },
3005
- // processRowGroupCallback: (params: ProcessRowGroupForExportParams): string => {
3006
- // // recreating the standard AG Grid styling for row groups: 'Parent -> Child'
3007
- // // additionally the values are formatted
3008
- // let rowGroupNode = params.node;
3009
- // const isFooterRow = rowGroupNode.footer;
3010
- // const rowGroupSummary = [this.processRowGroupForExcelExport(rowGroupNode) ?? ''];
3011
- // while (rowGroupNode.parent) {
3012
- // rowGroupNode = rowGroupNode.parent;
3013
- // const formattedParentNode = this.processRowGroupForExcelExport(rowGroupNode);
3014
- // if (formattedParentNode) {
3015
- // rowGroupSummary.push(formattedParentNode);
3016
- // }
3017
- // }
3018
- //
3019
- // let summary = rowGroupSummary.reverse().join(' -> ');
3020
- // if (isFooterRow) {
3021
- // summary = `Total: ${summary}`;
3022
- // }
3023
- // return summary;
3024
- // },
3025
- // });
3026
- //
3027
- // // keep only the user defined props
3028
- // this.setGridOptionsProperty('excelStyles', (userExcelStyles) => {
3029
- // return userExcelStyles;
3030
- // });
3059
+ try {
3060
+ const exportExcelStyles = this.ReportService.buildExcelStylesForVisualReports();
3061
+ this.agGridOptionsService.CAREFUL_patchGridOptionsProperty('excelStyles', exportExcelStyles);
3062
+ this.agGridAdapter.getAgGridApi().exportDataAsExcel({
3063
+ sheetName: 'Sheet 1',
3064
+ fileName: this.ReportService.getReportFileName(this.adaptableOptions.adaptableId, 'Excel'),
3065
+ // delegate the cell value processing to Adaptable
3066
+ processCellCallback: ({ node, column, value }) => {
3067
+ var _a;
3068
+ const columnId = column.getColId();
3069
+ if ((node === null || node === void 0 ? void 0 : node.group) &&
3070
+ (this.api.columnApi.isAutoRowGroupColumn(columnId) ||
3071
+ // we would still need to process the cell if this is a group row with an aggregated value
3072
+ ((_a = node === null || node === void 0 ? void 0 : node.aggData) === null || _a === void 0 ? void 0 : _a[columnId]) == undefined)) {
3073
+ // skip processing of row groups, this was already handled in processRowGroupCallback()
3074
+ return value;
3075
+ }
3076
+ return this.processCellForExcelExport(node, columnId);
3077
+ },
3078
+ processRowGroupCallback: (params) => {
3079
+ var _a;
3080
+ // recreating the standard AG Grid styling for row groups: 'Parent -> Child'
3081
+ // additionally the values are formatted
3082
+ let rowGroupNode = params.node;
3083
+ const isFooterRow = rowGroupNode.footer;
3084
+ const rowGroupSummary = [(_a = this.processRowGroupForExcelExport(rowGroupNode)) !== null && _a !== void 0 ? _a : ''];
3085
+ while (rowGroupNode.parent) {
3086
+ rowGroupNode = rowGroupNode.parent;
3087
+ const formattedParentNode = this.processRowGroupForExcelExport(rowGroupNode);
3088
+ if (formattedParentNode) {
3089
+ rowGroupSummary.push(formattedParentNode);
3090
+ }
3091
+ }
3092
+ let summary = rowGroupSummary.reverse().join(' -> ');
3093
+ if (isFooterRow) {
3094
+ summary = `Total: ${summary}`;
3095
+ }
3096
+ return summary;
3097
+ },
3098
+ });
3099
+ this.agGridOptionsService.revertGridOptionsPropertyToUserValue('excelStyles');
3100
+ }
3101
+ catch (error) {
3102
+ this.logger.consoleError('Error exporting visual data to Excel', error);
3103
+ }
3104
+ }
3105
+ processRowGroupForExcelExport(rowNode) {
3106
+ var _a, _b, _c, _d, _e;
3107
+ const columnId = (_c = (_a = rowNode.field) !== null && _a !== void 0 ? _a : (_b = rowNode.rowGroupColumn) === null || _b === void 0 ? void 0 : _b.getColId()) !== null && _c !== void 0 ? _c : (_e = (_d = rowNode.rowGroupColumn) === null || _d === void 0 ? void 0 : _d.getColDef()) === null || _e === void 0 ? void 0 : _e.field;
3108
+ if (!columnId || !rowNode.key) {
3109
+ return;
3110
+ }
3111
+ let rawValue = rowNode.key;
3112
+ if (this.api.columnApi.getColumnDataTypeForColumnId(columnId) === 'Date' &&
3113
+ typeof rawValue === 'string' &&
3114
+ // rawValue is composed only of digits
3115
+ /^\d+$/.test(rawValue)) {
3116
+ // AG-Grid converts the value to string, we have to reconvert it back
3117
+ const dateRawValue = parseInt(rawValue);
3118
+ if (dateRawValue != undefined) {
3119
+ // @ts-ignore
3120
+ rawValue = dateRawValue;
3121
+ }
3122
+ }
3123
+ return this.ReportService.getCellExportValueFromRawValue(rowNode, rawValue, columnId);
3124
+ }
3125
+ processCellForExcelExport(rowNode, columnId) {
3126
+ if (this.api.exportApi.internalApi.isVisualDataExportInProgress()) {
3127
+ const cellKey = this.agGridColumnAdapter.getExcelClassNameForCell(columnId, this.getPrimaryKeyValueFromRowNode(rowNode));
3128
+ const isoFormattedDate = this.ReportService.getExcelStyleWithFormattedDate(cellKey);
3129
+ if (isoFormattedDate) {
3130
+ // this is a Date cell which will be formatted by Excel
3131
+ return isoFormattedDate;
3132
+ }
3133
+ }
3134
+ return this.ReportService.getCellExportValueFromRowNode(rowNode, columnId);
3031
3135
  }
3032
3136
  isQuickFilterAvailable() {
3137
+ if (this.api.layoutApi.isCurrentLayoutPivot() &&
3138
+ this.adaptableOptions.columnFilterOptions.useAdaptableColumnFiltering) {
3139
+ // hide completely the quick filter if pivot is enabled
3140
+ return false;
3141
+ }
3033
3142
  return this.hasFloatingFilterOnAtLeastOneColumn(this.agGridAdapter.getAgGridApi().getColumnDefs());
3034
3143
  }
3035
3144
  hasFloatingFilterOnAtLeastOneColumn(columnDefs) {
@@ -3062,10 +3171,6 @@ export class AdaptableAgGrid {
3062
3171
  layout.PinnedColumnsMap = layout.PinnedColumnsMap || {};
3063
3172
  layout.PinnedColumnsMap[actionRowColumn.colId] = actionRowColumn.pinned;
3064
3173
  }
3065
- const layoutColumnsMap = layout.Columns.reduce((acc, colId) => {
3066
- acc[colId] = true;
3067
- return acc;
3068
- }, {});
3069
3174
  const columnsState = this.agGridAdapter.getAgGridApi().getColumnState();
3070
3175
  const columnsStateIndexes = {};
3071
3176
  const columnsStateMap = columnsState.reduce((acc, colState, index) => {
@@ -3097,20 +3202,19 @@ export class AdaptableAgGrid {
3097
3202
  .getPivotResultColumns()) === null || _b === void 0 ? void 0 : _b.map((column) => column.getColId())) || [];
3098
3203
  let isChanged = false;
3099
3204
  const colsToAutoSize = {};
3100
- let newColumnsState = this.getSortedColumnStateForVisibleColumns(columnsToShow, columnsState);
3205
+ let newColumnsState = this.getSortedColumnStateForVisibleColumns(columnsToShow, columnsState, layout);
3101
3206
  newColumnsState = newColumnsState
3102
3207
  .map((colState) => {
3103
3208
  var _a, _b, _c;
3104
3209
  const { colId } = colState;
3105
3210
  const oldColState = columnsStateMap[colId];
3106
- const hide = this.api.columnApi.isAutoPivotColumn(colId)
3107
- ? colState.hide
3108
- : !layoutColumnsMap[colId];
3109
- const newColState = Object.assign(Object.assign({}, oldColState), { hide });
3211
+ // it's important to have width here, so it's not inherited from the existing colState
3212
+ // which could be from a different layout
3213
+ const newColState = Object.assign(Object.assign(Object.assign({}, oldColState), { width: null }), colState);
3110
3214
  if (layout.ColumnWidthMap && layout.ColumnWidthMap[colId] != null) {
3111
3215
  newColState.width = layout.ColumnWidthMap[colId];
3112
3216
  }
3113
- else if (!hide) {
3217
+ else if (!colState.hide) {
3114
3218
  // autosize only the columns which are part of the selected layout
3115
3219
  colsToAutoSize[colId] = true;
3116
3220
  }
@@ -3119,11 +3223,7 @@ export class AdaptableAgGrid {
3119
3223
  }
3120
3224
  newColState.rowGroupIndex =
3121
3225
  groupedColumnsIndexesMap[colId] != null ? groupedColumnsIndexesMap[colId] : null;
3122
- const previousRowGroup = newColState.rowGroup;
3123
3226
  newColState.rowGroup = newColState.rowGroupIndex != null;
3124
- if (!previousRowGroup && newColState.rowGroup) {
3125
- this.agGridColumnAdapter.triggerSetupColumnKeyCreator(colId);
3126
- }
3127
3227
  const normalizePinned = (pinnedValue) => {
3128
3228
  if (typeof pinnedValue === 'string') {
3129
3229
  return pinnedValue;
@@ -3228,14 +3328,13 @@ export class AdaptableAgGrid {
3228
3328
  // as otherwise column order is not preserved properly when
3229
3329
  // going from pivoted to unpivoted layout
3230
3330
  if (shouldUpdatePivoted) {
3231
- this.agGridAdapter.getAgGridApi().setPivotMode(pivoted);
3331
+ this.agGridAdapter.setGridOption('pivotMode', pivoted);
3232
3332
  }
3233
3333
  const perfApplyColumnState = this.logger.beginPerf('applyColumnState (layout.isChanged)');
3234
3334
  this.agGridAdapter.getAgGridApi().applyColumnState({
3235
3335
  state: newColumnsState,
3236
3336
  applyOrder: true,
3237
3337
  });
3238
- this.applyGroupColumnWidth(layout);
3239
3338
  perfApplyColumnState.end();
3240
3339
  this.api.gridApi.setColumnSorts(layout.ColumnSorts);
3241
3340
  this.agGridAdapter.getAgGridApi().setPivotColumns(layout.PivotColumns || []);
@@ -3254,18 +3353,22 @@ export class AdaptableAgGrid {
3254
3353
  requestAnimationFrame(() => {
3255
3354
  this.agGridAdapter.getAgGridApi().autoSizeAllColumns();
3256
3355
  });
3257
- //but if it's also the first time the grid is loading
3258
- //it's not timely enough the above call, so we keep trying... I know it's ugly, we need to find a better way
3259
- setTimeout(() => {
3260
- this.agGridAdapter.getAgGridApi().autoSizeAllColumns();
3261
- setTimeout(() => {
3262
- this.agGridAdapter.getAgGridApi().autoSizeAllColumns();
3263
- }, 200);
3264
- }, 100);
3356
+ // //but if it's also the first time the grid is loading
3357
+ // //it's not timely enough the above call, so we keep trying... I know it's ugly, we need to find a better way
3358
+ // setTimeout(() => {
3359
+ // this.agGridAdapter.getAgGridApi().autoSizeAllColumns();
3360
+ // setTimeout(() => {
3361
+ // this.agGridAdapter.getAgGridApi().autoSizeAllColumns();
3362
+ // }, 200);
3363
+ // }, 100);
3265
3364
  }
3266
- else if (((_f = (_e = this.adaptableOptions) === null || _e === void 0 ? void 0 : _e.layoutOptions) === null || _f === void 0 ? void 0 : _f.autoSizeColumnsInLayout) &&
3267
- colsToAutoSizeArray.length) {
3268
- this.agGridAdapter.getAgGridApi().autoSizeColumns(colsToAutoSizeArray);
3365
+ else {
3366
+ if (((_f = (_e = this.adaptableOptions) === null || _e === void 0 ? void 0 : _e.layoutOptions) === null || _f === void 0 ? void 0 : _f.autoSizeColumnsInLayout) &&
3367
+ colsToAutoSizeArray.length) {
3368
+ requestAnimationFrame(() => {
3369
+ this.autoSizeColumns(colsToAutoSizeArray);
3370
+ });
3371
+ }
3269
3372
  }
3270
3373
  this.forPlugins((plugin) => {
3271
3374
  if (plugin.afterSetLayout) {
@@ -3288,38 +3391,6 @@ export class AdaptableAgGrid {
3288
3391
  }
3289
3392
  return null;
3290
3393
  }
3291
- /**
3292
- * Setting layout works by modifing the column state.
3293
- * The column state is based on the current existing columns.
3294
- * At this point the column groups do not exist, and the widths from layout are not applied.
3295
- *
3296
- * After the col sate is applied and the column groups are created we need
3297
- * to apply the state again to update the widths of the group columns.
3298
- */
3299
- applyGroupColumnWidth(layout) {
3300
- if (!layout.RowGroupedColumns || !layout.RowGroupedColumns.length) {
3301
- return;
3302
- }
3303
- const groupColumnWithDifferentWidths = this.agGridAdapter
3304
- .getAgGridApi()
3305
- .getColumnState()
3306
- .reduce((acc, col) => {
3307
- var _a;
3308
- if (this.api.columnApi.isAutoRowGroupColumn(col.colId)) {
3309
- const widthInLayout = (_a = layout.ColumnWidthMap) === null || _a === void 0 ? void 0 : _a[col.colId];
3310
- if (widthInLayout && widthInLayout !== col.width) {
3311
- acc.push(Object.assign(Object.assign({}, col), { width: widthInLayout }));
3312
- }
3313
- }
3314
- return acc;
3315
- }, []);
3316
- if (groupColumnWithDifferentWidths.length === 0) {
3317
- return;
3318
- }
3319
- this.agGridAdapter.getAgGridApi().applyColumnState({
3320
- state: groupColumnWithDifferentWidths,
3321
- });
3322
- }
3323
3394
  onRowDataChanged({ rowNode, oldData, newData, }) {
3324
3395
  if (oldData == null || oldData == undefined) {
3325
3396
  return;
@@ -3498,12 +3569,12 @@ export class AdaptableAgGrid {
3498
3569
  if (!dataChangedScope.wholeRow) {
3499
3570
  const columnIds = this.api.expressionApi.getColumnsFromExpression(styleModule.Rule.BooleanExpression);
3500
3571
  if (columnIds.includes(cellDataChangedInfo.column.columnId)) {
3501
- if (this.api.scopeApi.scopeIsAll(styleModule.Scope)) {
3572
+ if (this.api.columnScopeApi.scopeIsAll(styleModule.Scope)) {
3502
3573
  dataChangedScope.wholeRow = true;
3503
3574
  return;
3504
3575
  }
3505
3576
  else {
3506
- this.api.scopeApi
3577
+ this.api.columnScopeApi
3507
3578
  .getColumnsForScope(styleModule.Scope)
3508
3579
  .map((c) => c.columnId)
3509
3580
  .forEach((colId) => {
@@ -3614,6 +3685,24 @@ export class AdaptableAgGrid {
3614
3685
  */
3615
3686
  updateLayoutFromGrid() {
3616
3687
  var _a, _b;
3688
+ const agGridApi = this.agGridAdapter.getAgGridApi();
3689
+ const columnState = agGridApi.getColumnState();
3690
+ const expandedState = agGridApi.getState().rowGroupExpansion || { expandedRowGroupIds: [] };
3691
+ const currentLayoutState = { columnState, expandedState };
3692
+ try {
3693
+ // TODO
3694
+ const stringifiedLayoutState = JSON.stringify(currentLayoutState);
3695
+ if (stringifiedLayoutState === this.previousAgGridLayoutState) {
3696
+ // same grid column state as a previous,
3697
+ // so no need to update, as the layout has already been updated
3698
+ // for this grid column state
3699
+ return;
3700
+ }
3701
+ this.previousAgGridLayoutState = stringifiedLayoutState;
3702
+ }
3703
+ catch (ex) {
3704
+ this.logger.consoleError('Error stringifying column state', ex);
3705
+ }
3617
3706
  const currentLayout = this.api.layoutApi.getCurrentLayout();
3618
3707
  if (currentLayout.IsReadOnly) {
3619
3708
  // reaply the layout so the grid is reverted
@@ -3625,7 +3714,6 @@ export class AdaptableAgGrid {
3625
3714
  const columnFlexes = {};
3626
3715
  const pinnedColumns = {};
3627
3716
  const columnSorts = [];
3628
- const columnState = this.agGridAdapter.getAgGridApi().getColumnState();
3629
3717
  let groupedColumns = [...new Array(columnState.length)];
3630
3718
  let pivotedColumns = [...new Array(columnState.length)];
3631
3719
  const pivotColumns = [];