@pega/lists-core 9.0.0-build.9.9 → 9.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 (277) hide show
  1. package/lib/index.d.ts +3 -2
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +3 -2
  4. package/lib/index.js.map +1 -1
  5. package/lib/src/core/RsCore.d.ts +1 -1
  6. package/lib/src/core/RsCore.js +1 -1
  7. package/lib/src/core/RsCore.js.map +1 -1
  8. package/lib/src/core/RsInternal.d.ts +23 -0
  9. package/lib/src/core/RsInternal.d.ts.map +1 -1
  10. package/lib/src/core/RsInternal.js +18 -2
  11. package/lib/src/core/RsInternal.js.map +1 -1
  12. package/lib/src/core/RsProps.d.ts +0 -7
  13. package/lib/src/core/RsProps.d.ts.map +1 -1
  14. package/lib/src/core/RsProps.js +0 -7
  15. package/lib/src/core/RsProps.js.map +1 -1
  16. package/lib/src/core/RsStore.d.ts +5 -1
  17. package/lib/src/core/RsStore.d.ts.map +1 -1
  18. package/lib/src/core/RsStore.js +12 -0
  19. package/lib/src/core/RsStore.js.map +1 -1
  20. package/lib/src/core/StateResolver.d.ts +0 -1
  21. package/lib/src/core/StateResolver.d.ts.map +1 -1
  22. package/lib/src/core/StateResolver.js +19 -9
  23. package/lib/src/core/StateResolver.js.map +1 -1
  24. package/lib/src/core/a11y/BaseA11y.d.ts +25 -6
  25. package/lib/src/core/a11y/BaseA11y.d.ts.map +1 -1
  26. package/lib/src/core/a11y/BaseA11y.js +39 -8
  27. package/lib/src/core/a11y/BaseA11y.js.map +1 -1
  28. package/lib/src/core/actions/actionConstants.d.ts +7 -4
  29. package/lib/src/core/actions/actionConstants.d.ts.map +1 -1
  30. package/lib/src/core/actions/actionConstants.js +8 -5
  31. package/lib/src/core/actions/actionConstants.js.map +1 -1
  32. package/lib/src/core/actions/actions.d.ts +35 -34
  33. package/lib/src/core/actions/actions.d.ts.map +1 -1
  34. package/lib/src/core/actions/actions.js +47 -40
  35. package/lib/src/core/actions/actions.js.map +1 -1
  36. package/lib/src/core/actions/actions.types.d.ts +34 -27
  37. package/lib/src/core/actions/actions.types.d.ts.map +1 -1
  38. package/lib/src/core/actions/actions.types.js.map +1 -1
  39. package/lib/src/core/config/config.d.ts +1 -1
  40. package/lib/src/core/config/config.d.ts.map +1 -1
  41. package/lib/src/core/config/config.js +5 -2
  42. package/lib/src/core/config/config.js.map +1 -1
  43. package/lib/src/core/constants.d.ts +4 -0
  44. package/lib/src/core/constants.d.ts.map +1 -1
  45. package/lib/src/core/constants.js +22 -5
  46. package/lib/src/core/constants.js.map +1 -1
  47. package/lib/src/core/defaultTranslations.d.ts +6 -1
  48. package/lib/src/core/defaultTranslations.d.ts.map +1 -1
  49. package/lib/src/core/defaultTranslations.js +6 -1
  50. package/lib/src/core/defaultTranslations.js.map +1 -1
  51. package/lib/src/core/features/featureFactory.d.ts +6 -2
  52. package/lib/src/core/features/featureFactory.d.ts.map +1 -1
  53. package/lib/src/core/features/featureFactory.js +9 -8
  54. package/lib/src/core/features/featureFactory.js.map +1 -1
  55. package/lib/src/core/features/uIFeatures/afterRender/animation.d.ts.map +1 -1
  56. package/lib/src/core/features/uIFeatures/afterRender/animation.js +11 -2
  57. package/lib/src/core/features/uIFeatures/afterRender/animation.js.map +1 -1
  58. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.d.ts +2 -16
  59. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.d.ts.map +1 -1
  60. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.js +48 -89
  61. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.js.map +1 -1
  62. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts +3 -4
  63. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts.map +1 -1
  64. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js +83 -45
  65. package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js.map +1 -1
  66. package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.d.ts.map +1 -1
  67. package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.js +2 -2
  68. package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.js.map +1 -1
  69. package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.d.ts +4 -1
  70. package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.d.ts.map +1 -1
  71. package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.js +15 -14
  72. package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.js.map +1 -1
  73. package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.d.ts.map +1 -1
  74. package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.js +10 -2
  75. package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.js.map +1 -1
  76. package/lib/src/core/features/uIFeatures/beforeRender/aggregation.d.ts +1 -1
  77. package/lib/src/core/features/uIFeatures/beforeRender/aggregation.js +2 -2
  78. package/lib/src/core/features/uIFeatures/beforeRender/aggregation.js.map +1 -1
  79. package/lib/src/core/features/uIFeatures/beforeRender/animation.d.ts +1 -1
  80. package/lib/src/core/features/uIFeatures/beforeRender/animation.d.ts.map +1 -1
  81. package/lib/src/core/features/uIFeatures/beforeRender/animation.js +5 -4
  82. package/lib/src/core/features/uIFeatures/beforeRender/animation.js.map +1 -1
  83. package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.d.ts +1 -1
  84. package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.js +2 -2
  85. package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.js.map +1 -1
  86. package/lib/src/core/features/uIFeatures/beforeRender/changePersonalisation.js +1 -1
  87. package/lib/src/core/features/uIFeatures/beforeRender/changePersonalisation.js.map +1 -1
  88. package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.d.ts +13 -0
  89. package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.d.ts.map +1 -0
  90. package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.js +40 -0
  91. package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.js.map +1 -0
  92. package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.d.ts +2 -0
  93. package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.d.ts.map +1 -1
  94. package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.js +14 -1
  95. package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.js.map +1 -1
  96. package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.d.ts.map +1 -1
  97. package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.js +7 -5
  98. package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.js.map +1 -1
  99. package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.d.ts.map +1 -1
  100. package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.js +13 -5
  101. package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.js.map +1 -1
  102. package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.d.ts +1 -1
  103. package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.d.ts.map +1 -1
  104. package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.js +20 -17
  105. package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.js.map +1 -1
  106. package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.d.ts +2 -4
  107. package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.d.ts.map +1 -1
  108. package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js +61 -40
  109. package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js.map +1 -1
  110. package/lib/src/core/features/uIFeatures/beforeRender/columnSort.d.ts.map +1 -1
  111. package/lib/src/core/features/uIFeatures/beforeRender/columnSort.js +1 -1
  112. package/lib/src/core/features/uIFeatures/beforeRender/columnSort.js.map +1 -1
  113. package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.d.ts +2 -2
  114. package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.d.ts.map +1 -1
  115. package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.js +10 -5
  116. package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.js.map +1 -1
  117. package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.d.ts +1 -1
  118. package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.js +4 -4
  119. package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.js.map +1 -1
  120. package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.d.ts.map +1 -1
  121. package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.js +9 -8
  122. package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.js.map +1 -1
  123. package/lib/src/core/features/uIFeatures/beforeRender/customColumn.d.ts +1 -1
  124. package/lib/src/core/features/uIFeatures/beforeRender/customColumn.d.ts.map +1 -1
  125. package/lib/src/core/features/uIFeatures/beforeRender/customColumn.js +22 -8
  126. package/lib/src/core/features/uIFeatures/beforeRender/customColumn.js.map +1 -1
  127. package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.d.ts.map +1 -1
  128. package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.js +9 -6
  129. package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.js.map +1 -1
  130. package/lib/src/core/features/uIFeatures/beforeRender/filter.d.ts +1 -0
  131. package/lib/src/core/features/uIFeatures/beforeRender/filter.d.ts.map +1 -1
  132. package/lib/src/core/features/uIFeatures/beforeRender/filter.js +13 -3
  133. package/lib/src/core/features/uIFeatures/beforeRender/filter.js.map +1 -1
  134. package/lib/src/core/features/uIFeatures/beforeRender/freeze.d.ts +2 -2
  135. package/lib/src/core/features/uIFeatures/beforeRender/freeze.d.ts.map +1 -1
  136. package/lib/src/core/features/uIFeatures/beforeRender/freeze.js +14 -9
  137. package/lib/src/core/features/uIFeatures/beforeRender/freeze.js.map +1 -1
  138. package/lib/src/core/features/uIFeatures/beforeRender/grouping.d.ts.map +1 -1
  139. package/lib/src/core/features/uIFeatures/beforeRender/grouping.js +23 -24
  140. package/lib/src/core/features/uIFeatures/beforeRender/grouping.js.map +1 -1
  141. package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.d.ts +32 -1
  142. package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.d.ts.map +1 -1
  143. package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.js +128 -32
  144. package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.js.map +1 -1
  145. package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.d.ts.map +1 -1
  146. package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.js +4 -4
  147. package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.js.map +1 -1
  148. package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.d.ts.map +1 -1
  149. package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.js +14 -10
  150. package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.js.map +1 -1
  151. package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.d.ts +16 -4
  152. package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.d.ts.map +1 -1
  153. package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.js +124 -72
  154. package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.js.map +1 -1
  155. package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.d.ts +2 -2
  156. package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.d.ts.map +1 -1
  157. package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.js +116 -37
  158. package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.js.map +1 -1
  159. package/lib/src/core/features/uIFeatures/index.d.ts +2 -3
  160. package/lib/src/core/features/uIFeatures/index.d.ts.map +1 -1
  161. package/lib/src/core/features/uIFeatures/index.js +2 -4
  162. package/lib/src/core/features/uIFeatures/index.js.map +1 -1
  163. package/lib/src/core/generators/ColumnGenerator.d.ts +15 -21
  164. package/lib/src/core/generators/ColumnGenerator.d.ts.map +1 -1
  165. package/lib/src/core/generators/ColumnGenerator.js +32 -95
  166. package/lib/src/core/generators/ColumnGenerator.js.map +1 -1
  167. package/lib/src/core/generators/ColumnGenerator.types.d.ts +16 -13
  168. package/lib/src/core/generators/ColumnGenerator.types.d.ts.map +1 -1
  169. package/lib/src/core/generators/ColumnGenerator.types.js.map +1 -1
  170. package/lib/src/core/generators/GroupGenerator.d.ts +5 -1
  171. package/lib/src/core/generators/GroupGenerator.d.ts.map +1 -1
  172. package/lib/src/core/generators/GroupGenerator.js +20 -0
  173. package/lib/src/core/generators/GroupGenerator.js.map +1 -1
  174. package/lib/src/core/generators/RowGenerator.d.ts +2 -2
  175. package/lib/src/core/generators/RowGenerator.d.ts.map +1 -1
  176. package/lib/src/core/generators/RowGenerator.js +3 -4
  177. package/lib/src/core/generators/RowGenerator.js.map +1 -1
  178. package/lib/src/core/generators/RowGenerator.types.d.ts +2 -1
  179. package/lib/src/core/generators/RowGenerator.types.d.ts.map +1 -1
  180. package/lib/src/core/generators/RowGenerator.types.js.map +1 -1
  181. package/lib/src/core/generators/ViewGenerator.d.ts +42 -28
  182. package/lib/src/core/generators/ViewGenerator.d.ts.map +1 -1
  183. package/lib/src/core/generators/ViewGenerator.js +101 -61
  184. package/lib/src/core/generators/ViewGenerator.js.map +1 -1
  185. package/lib/src/core/generators/ViewGenerator.types.d.ts +13 -1
  186. package/lib/src/core/generators/ViewGenerator.types.d.ts.map +1 -1
  187. package/lib/src/core/generators/ViewGenerator.types.js.map +1 -1
  188. package/lib/src/core/generators/__tests__/viewUtilityMockSetup.d.ts +3 -0
  189. package/lib/src/core/generators/__tests__/viewUtilityMockSetup.d.ts.map +1 -1
  190. package/lib/src/core/generators/viewUtilityMethods.d.ts +23 -10
  191. package/lib/src/core/generators/viewUtilityMethods.d.ts.map +1 -1
  192. package/lib/src/core/generators/viewUtilityMethods.js +50 -11
  193. package/lib/src/core/generators/viewUtilityMethods.js.map +1 -1
  194. package/lib/src/core/index.d.ts.map +1 -1
  195. package/lib/src/core/index.js +1 -2
  196. package/lib/src/core/index.js.map +1 -1
  197. package/lib/src/core/reducers/changeTemplate.d.ts +5 -0
  198. package/lib/src/core/reducers/changeTemplate.d.ts.map +1 -0
  199. package/lib/src/core/reducers/changeTemplate.js +14 -0
  200. package/lib/src/core/reducers/changeTemplate.js.map +1 -0
  201. package/lib/src/core/reducers/dragDrop.d.ts.map +1 -1
  202. package/lib/src/core/reducers/dragDrop.js +5 -4
  203. package/lib/src/core/reducers/dragDrop.js.map +1 -1
  204. package/lib/src/core/reducers/error.d.ts +8 -4
  205. package/lib/src/core/reducers/error.d.ts.map +1 -1
  206. package/lib/src/core/reducers/{edit.d.ts → galleryView.d.ts} +1 -1
  207. package/lib/src/core/reducers/galleryView.d.ts.map +1 -0
  208. package/lib/src/core/reducers/galleryView.js +11 -0
  209. package/lib/src/core/reducers/galleryView.js.map +1 -0
  210. package/lib/src/core/reducers/grouping.d.ts.map +1 -1
  211. package/lib/src/core/reducers/grouping.js +7 -0
  212. package/lib/src/core/reducers/grouping.js.map +1 -1
  213. package/lib/src/core/reducers/index.d.ts +8 -4
  214. package/lib/src/core/reducers/index.d.ts.map +1 -1
  215. package/lib/src/core/reducers/index.js +5 -3
  216. package/lib/src/core/reducers/index.js.map +1 -1
  217. package/lib/src/core/reducers/personalizationDirtyReducer.d.ts.map +1 -1
  218. package/lib/src/core/reducers/personalizationDirtyReducer.js +8 -4
  219. package/lib/src/core/reducers/personalizationDirtyReducer.js.map +1 -1
  220. package/lib/src/core/reducers/personalizationReducer.d.ts +3 -2
  221. package/lib/src/core/reducers/personalizationReducer.d.ts.map +1 -1
  222. package/lib/src/core/reducers/personalizationReducer.js +12 -4
  223. package/lib/src/core/reducers/personalizationReducer.js.map +1 -1
  224. package/lib/src/core/reducers/renderFormatter.d.ts.map +1 -1
  225. package/lib/src/core/reducers/renderFormatter.js +13 -3
  226. package/lib/src/core/reducers/renderFormatter.js.map +1 -1
  227. package/lib/src/core/reducers/rowSelect.d.ts.map +1 -1
  228. package/lib/src/core/reducers/rowSelect.js +0 -8
  229. package/lib/src/core/reducers/rowSelect.js.map +1 -1
  230. package/lib/src/core/reducers/versioning/index.d.ts +1 -1
  231. package/lib/src/core/reducers/versioning/index.d.ts.map +1 -1
  232. package/lib/src/core/reducers/versioning/index.js +1 -1
  233. package/lib/src/core/reducers/versioning/index.js.map +1 -1
  234. package/lib/src/core/reducers/visibility.d.ts +2 -1
  235. package/lib/src/core/reducers/visibility.d.ts.map +1 -1
  236. package/lib/src/core/reducers/visibility.js +69 -19
  237. package/lib/src/core/reducers/visibility.js.map +1 -1
  238. package/lib/src/core/test/junitMocks.d.ts +1322 -0
  239. package/lib/src/core/test/junitMocks.d.ts.map +1 -1
  240. package/lib/src/core/test/junitMocks.js +32 -51
  241. package/lib/src/core/test/junitMocks.js.map +1 -1
  242. package/lib/src/core/utils/condition-utils.d.ts +1 -1
  243. package/lib/src/core/utils/condition-utils.d.ts.map +1 -1
  244. package/lib/src/core/utils/condition-utils.js +5 -3
  245. package/lib/src/core/utils/condition-utils.js.map +1 -1
  246. package/lib/src/core/utils/util.d.ts +58 -9
  247. package/lib/src/core/utils/util.d.ts.map +1 -1
  248. package/lib/src/core/utils/util.js +151 -18
  249. package/lib/src/core/utils/util.js.map +1 -1
  250. package/lib/types/ApiContext.types.d.ts +69 -7
  251. package/lib/types/ApiContext.types.d.ts.map +1 -1
  252. package/lib/types/ApiContext.types.js.map +1 -1
  253. package/lib/types/Meta.types.d.ts +153 -11
  254. package/lib/types/Meta.types.d.ts.map +1 -1
  255. package/lib/types/Meta.types.js +7 -1
  256. package/lib/types/Meta.types.js.map +1 -1
  257. package/lib/types/RsCoreBootArgs.types.d.ts +11 -13
  258. package/lib/types/RsCoreBootArgs.types.d.ts.map +1 -1
  259. package/lib/types/RsCoreBootArgs.types.js.map +1 -1
  260. package/lib/types/State.types.d.ts +32 -30
  261. package/lib/types/State.types.d.ts.map +1 -1
  262. package/lib/types/State.types.js.map +1 -1
  263. package/lib/types.d.ts +10 -2
  264. package/lib/types.d.ts.map +1 -1
  265. package/lib/types.js.map +1 -1
  266. package/package.json +6 -8
  267. package/lib/src/core/features/uIFeatures/beforeRender/edit.d.ts +0 -12
  268. package/lib/src/core/features/uIFeatures/beforeRender/edit.d.ts.map +0 -1
  269. package/lib/src/core/features/uIFeatures/beforeRender/edit.js +0 -94
  270. package/lib/src/core/features/uIFeatures/beforeRender/edit.js.map +0 -1
  271. package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.d.ts +0 -12
  272. package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.d.ts.map +0 -1
  273. package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.js +0 -51
  274. package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.js.map +0 -1
  275. package/lib/src/core/reducers/edit.d.ts.map +0 -1
  276. package/lib/src/core/reducers/edit.js +0 -65
  277. package/lib/src/core/reducers/edit.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"featureFactory.js","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAaA,OAAO,UAAU,MAAM,cAAc,CAAC;AA6CtC,SAAS,aAAa;IACpB,MAAM,QAAQ,GAGV;QACF,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,EAAE;KAChB,CAAC;IACF,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAChE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAClE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,CAA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,UAAU;oBACjC,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;oBACnD,gBAAgB,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,gBAAgB;oBACnE,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;iBACpD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,UAAsB;IAEtB,OAAO,CAAC,8BAA8B,CAAC,UAAU,CAAC,EAAE,6BAA6B,CAAC,UAAU,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { State } from 'packages/lists-rs-core/types/State.types';\n\nimport type View from '../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Column from '../generators/ColumnGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Row from '../generators/RowGenerator';\nimport type RsInternal from '../RsInternal';\nimport type RsProps from '../RsProps';\nimport type StateResolver from '../StateResolver';\nimport type RsStore from '../RsStore';\nimport type { Action } from '../actions/actions.types';\n\nimport uiFeatures from './uIFeatures';\n\nexport type FeatureProps<WithQueuedActions extends boolean = false> = {\n /** Returns reference to current {@link View} */\n getView: () => View;\n /** Returns reference to {@link RsStore} */\n getRsStore: () => RsStore;\n /** Returns reference to {@link RsProps} */\n getRsProps: () => RsProps;\n /** Returns reference to latest/current {@link State} */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n} & (WithQueuedActions extends true\n ? {\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n }\n : // For better readability keeping {} rather than Record<string, never>.\n // eslint-disable-next-line @typescript-eslint/ban-types\n {});\n\nexport type BeforeRenderFeatureProps = FeatureProps<true>;\n\nexport type MiddleWareFeatureProps = {\n /** Reference to RsInternal object. */\n rsInternal: RsInternal;\n /** Returns reference to latest/current {@link State}. */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n};\n\n/** A feature is a function that runs based on a particular state slice change and produces immutable generator({@link View}, {@link Row}, {@link Column}) objects. It may also {@link StateResolver.dispatch dispatch} an action. */\nexport type Feature<WithQueuedActions extends boolean = false> = (\n rsInternal: RsInternal\n) => ((featureProps: FeatureProps<WithQueuedActions>) => void) | void;\n\nexport type UIFeatures = ReturnType<typeof getUIFeatures>;\nfunction getUIFeatures() {\n const features: {\n beforeRender: Feature<true>[];\n afterRender: Feature[];\n } = {\n beforeRender: [],\n afterRender: []\n };\n features.beforeRender.push(uiFeatures.beforeRender.scrollToTop);\n features.beforeRender.push(uiFeatures.beforeRender.busyIndicator);\n features.beforeRender.push(uiFeatures.beforeRender.personalization);\n // Reset dataApi context so that new count and data could be fetched on change of personalization\n features.beforeRender.push(uiFeatures.beforeRender.resetFetch);\n features.beforeRender.push(uiFeatures.beforeRender.changePersonalisation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareColumns);\n features.beforeRender.push(uiFeatures.beforeRender.columnFormatter);\n features.beforeRender.push(uiFeatures.beforeRender.ColumnDisplayMode);\n /* customColumn feature injects field definitions for custom fields, so stateSanitization feature should run after customColumn */\n features.beforeRender.push(uiFeatures.beforeRender.customColumn);\n features.beforeRender.push(uiFeatures.beforeRender.columnAlias);\n features.beforeRender.push(uiFeatures.beforeRender.stateSanitization);\n features.beforeRender.push(uiFeatures.beforeRender.stateHydration);\n features.beforeRender.push(uiFeatures.beforeRender.conditionalStyleFormat);\n features.beforeRender.push(uiFeatures.beforeRender.columnToggle);\n // ORDER: if any feature is going to generate some markup, then it should come before columnSizing feature\n // If reordering or moving records is enabled then rowDragDrop handler size has to be calculated and picked by column sizing\n features.beforeRender.push(uiFeatures.beforeRender.errorColumn);\n features.beforeRender.push(uiFeatures.beforeRender.rowDragDrop);\n features.beforeRender.push(uiFeatures.beforeRender.columnSizing);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeight);\n features.beforeRender.push(uiFeatures.beforeRender.freeze);\n // columnOrder is required for both columnVisualOrder and columnReorder feature\n features.beforeRender.push(uiFeatures.beforeRender.columnOrder);\n features.beforeRender.push(uiFeatures.beforeRender.columnVisualOrder);\n // Columns header should be rendered as soon as it is available. Features making calculation on columns should be before this.\n features.beforeRender.push(uiFeatures.beforeRender.renderHeader);\n features.beforeRender.push(uiFeatures.beforeRender.refresh);\n features.beforeRender.push(uiFeatures.beforeRender.rowHeight);\n features.beforeRender.push(uiFeatures.beforeRender.animation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareRows);\n // We have to inject this feature always as we are generating instance\n // level data with same to avoid condition block in UI.\n\n features.beforeRender.push(uiFeatures.beforeRender.grouping);\n features.beforeRender.push(uiFeatures.beforeRender.filter);\n features.beforeRender.push(uiFeatures.beforeRender.columnSort);\n features.beforeRender.push(uiFeatures.beforeRender.columnResize);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeightToFitRecords);\n\n features.beforeRender.push(uiFeatures.beforeRender.columnReOrder);\n features.beforeRender.push(uiFeatures.beforeRender.rowSelect);\n features.beforeRender.push(uiFeatures.beforeRender.toggleSelectAllCheckbox);\n features.beforeRender.push(uiFeatures.beforeRender.aggregation);\n features.beforeRender.push(uiFeatures.beforeRender.edit);\n features.beforeRender.push(uiFeatures.beforeRender.moveRecords);\n features.beforeRender.push(uiFeatures.beforeRender.toggleHeaderIcons);\n\n features.afterRender.push(uiFeatures.afterRender.animation);\n features.afterRender.push(uiFeatures.afterRender.columnAutoSizing);\n features.afterRender.push(uiFeatures.afterRender.customizeParentContainer);\n\n return features;\n}\n\n/**\n * Initializes and returns before render features which run when any action is dispatched in the queue.\n * @param rsInternal - RsInternal reference.\n * @returns\n */\nfunction initializeBeforeRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const beforeRenderUIFeatures = features.beforeRender.map(t => t(rsInternal)).filter(Boolean);\n return (featureProps: MiddleWareFeatureProps) => {\n return (beforeRenderUIFeatures as ((featureProps: BeforeRenderFeatureProps) => void)[]).reduce<\n Promise<void | null>\n >(async (p, feature) => {\n return p.then(() => {\n if (!featureProps.rsInternal.getRsStore().isMounted) return null;\n return feature({\n getView: featureProps.rsInternal.getView,\n getRsStore: featureProps.rsInternal.getRsStore,\n getRsProps: featureProps.rsInternal.getRsProps,\n getState: featureProps.getState,\n getOriginalState: featureProps.getOriginalState,\n dispatch: featureProps.dispatch,\n queuedActions: featureProps.queuedActions\n });\n });\n }, Promise.resolve());\n };\n}\n\n/**\n * Initializes and returns after render features which run after the render is completed.\n * @param rsInternal RsInternal reference.\n * @returns\n */\nfunction initializeAfterRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const afterRenderUIFeatures = features.afterRender.map(t => t(rsInternal)).filter(Boolean);\n\n return () => {\n (afterRenderUIFeatures as ((featureProps: FeatureProps) => void)[]).forEach(feature => {\n if (rsInternal.getRsStore().isMounted) {\n feature({\n getView: rsInternal.getView,\n getRsStore: rsInternal.getRsStore,\n getRsProps: rsInternal.getRsProps,\n getState: rsInternal.getRsStateResolver()!.getState,\n getOriginalState: rsInternal.getRsStateResolver()!.getOriginalState,\n dispatch: rsInternal.getRsStateResolver()!.dispatch\n });\n }\n });\n };\n}\n\n/**\n * Initializes and return before and after render features.\n * @param rsInternal\n * @returns\n */\nexport default function initializeFeatures(\n rsInternal: RsInternal\n): [(featureProps: MiddleWareFeatureProps) => Promise<void | null>, () => void] {\n return [initializeBeforeRenderFeatures(rsInternal), initializeAfterRenderFeatures(rsInternal)];\n}\n"]}
1
+ {"version":3,"file":"featureFactory.js","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAcA,OA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AqB,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE3F,OAAO,GAAG,EAAE;QACT,qBAAkE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACpF,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC,SAAS,IAAI,UAAU,CAAC,kBAAkB,EAAE,EAAE,CAAC;gBACzE,OAAO,CAAC;oBACN,OAAO,EAAE,UAAU,CAAC,OAAO;oBAC3B,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAE,CAAC,QAAQ;oBAClD,gBAAgB,EAAE,UAAU,CAAC,kBAAkB,EAAE,CAAC,gBAAgB;oBAClE,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAE,CAAC,QAAQ;oBAClD,cAAc,EAAE,UAAU,CAAC,iBAAiB,EAAE;iBAC/C,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,UAAsB;IAEtB,OAAO,CAAC,8BAA8B,CAAC,UAAU,CAAC,EAAE,6BAA6B,CAAC,UAAU,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { State } from 'pega-repeating-structures-core/lib/types/State.types';\n\nimport type View from '../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Column from '../generators/ColumnGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Row from '../generators/RowGenerator';\nimport type RsInternal from '../RsInternal';\nimport type { BrowserContext } from '../RsInternal';\nimport type RsProps from '../RsProps';\nimport type StateResolver from '../StateResolver';\nimport type RsStore from '../RsStore';\nimport type { Action } from '../actions/actions.types';\n\nimport uiFeatures from './uIFeatures';\n\nexport type FeatureProps<WithQueuedActions extends boolean = false> = {\n /** Returns reference to current {@link View} */\n getView: () => View;\n /** Returns reference to {@link RsStore} */\n getRsStore: () => RsStore;\n /** Returns reference to {@link RsProps} */\n getRsProps: () => RsProps;\n /** Returns reference to latest/current {@link State} */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n /** Frame-aware browser environment context. Use {@link BrowserContext.document} and\n * {@link BrowserContext.window} instead of the global `document` and `window` so that\n * features work correctly when rendered inside an iFrame. */\n browserContext: BrowserContext;\n} & (WithQueuedActions extends true\n ? {\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n }\n : // For better readability keeping {} rather than Record<string, never>.\n // eslint-disable-next-line @typescript-eslint/ban-types\n {});\n\nexport type BeforeRenderFeatureProps = FeatureProps<true>;\n\nexport type MiddleWareFeatureProps = {\n /** Reference to RsInternal object. */\n rsInternal: RsInternal;\n /** Returns reference to latest/current {@link State}. */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n};\n\n/** A feature is a function that runs based on a particular state slice change and produces immutable generator({@link View}, {@link Row}, {@link Column}) objects. It may also {@link StateResolver.dispatch dispatch} an action. */\nexport type Feature<WithQueuedActions extends boolean = false> = (\n rsInternal: RsInternal\n) => ((featureProps: FeatureProps<WithQueuedActions>) => void) | void;\n\nexport type UIFeatures = ReturnType<typeof getUIFeatures>;\nfunction getUIFeatures() {\n const features: {\n beforeRender: Feature<true>[];\n afterRender: Feature[];\n } = {\n beforeRender: [],\n afterRender: []\n };\n features.beforeRender.push(uiFeatures.beforeRender.scrollToTop);\n features.beforeRender.push(uiFeatures.beforeRender.busyIndicator);\n features.beforeRender.push(uiFeatures.beforeRender.personalization);\n // Reset dataApi context so that new count and data could be fetched on change of personalization\n features.beforeRender.push(uiFeatures.beforeRender.resetFetch);\n features.beforeRender.push(uiFeatures.beforeRender.changePersonalisation);\n // changeTemplate must run before any feature that reads view.template so that\n // the resolved runtime template (e.g. Gallery after a Table→Gallery switch)\n // is visible to downstream height, column, and layout calculations.\n features.beforeRender.push(uiFeatures.beforeRender.changeTemplate);\n features.beforeRender.push(uiFeatures.beforeRender.prepareColumns);\n features.beforeRender.push(uiFeatures.beforeRender.columnFormatter);\n features.beforeRender.push(uiFeatures.beforeRender.ColumnDisplayMode);\n /* customColumn feature injects field definitions for custom fields, so stateSanitization feature should run after customColumn */\n features.beforeRender.push(uiFeatures.beforeRender.customColumn);\n features.beforeRender.push(uiFeatures.beforeRender.columnAlias);\n features.beforeRender.push(uiFeatures.beforeRender.stateSanitization);\n features.beforeRender.push(uiFeatures.beforeRender.stateHydration);\n features.beforeRender.push(uiFeatures.beforeRender.conditionalStyleFormat);\n features.beforeRender.push(uiFeatures.beforeRender.columnToggle);\n // ORDER: if any feature is going to generate some markup, then it should come before columnSizing feature\n // If reordering or moving records is enabled then rowDragDrop handler size has to be calculated and picked by column sizing\n features.beforeRender.push(uiFeatures.beforeRender.errorColumn);\n features.beforeRender.push(uiFeatures.beforeRender.rowDragDrop);\n features.beforeRender.push(uiFeatures.beforeRender.columnSizing);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeight);\n features.beforeRender.push(uiFeatures.beforeRender.freeze);\n // columnOrder is required for both columnVisualOrder and columnReorder feature\n features.beforeRender.push(uiFeatures.beforeRender.columnOrder);\n features.beforeRender.push(uiFeatures.beforeRender.columnVisualOrder);\n // Columns header should be rendered as soon as it is available. Features making calculation on columns should be before this.\n features.beforeRender.push(uiFeatures.beforeRender.renderHeader);\n features.beforeRender.push(uiFeatures.beforeRender.refresh);\n features.beforeRender.push(uiFeatures.beforeRender.rowHeight);\n features.beforeRender.push(uiFeatures.beforeRender.animation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareRows);\n // We have to inject this feature always as we are generating instance\n // level data with same to avoid condition block in UI.\n\n features.beforeRender.push(uiFeatures.beforeRender.grouping);\n features.beforeRender.push(uiFeatures.beforeRender.filter);\n features.beforeRender.push(uiFeatures.beforeRender.columnSort);\n features.beforeRender.push(uiFeatures.beforeRender.columnResize);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeightToFitRecords);\n\n features.beforeRender.push(uiFeatures.beforeRender.columnReOrder);\n features.beforeRender.push(uiFeatures.beforeRender.rowSelect);\n features.beforeRender.push(uiFeatures.beforeRender.aggregation);\n features.beforeRender.push(uiFeatures.beforeRender.moveRecords);\n features.beforeRender.push(uiFeatures.beforeRender.toggleHeaderIcons);\n\n features.afterRender.push(uiFeatures.afterRender.animation);\n features.afterRender.push(uiFeatures.afterRender.columnAutoSizing);\n features.afterRender.push(uiFeatures.afterRender.customizeParentContainer);\n\n return features;\n}\n\n/**\n * Initializes and returns before render features which run when any action is dispatched in the queue.\n * @param rsInternal - RsInternal reference.\n */\nfunction initializeBeforeRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const beforeRenderUIFeatures = features.beforeRender.map(t => t(rsInternal)).filter(Boolean);\n return (featureProps: MiddleWareFeatureProps) => {\n return (beforeRenderUIFeatures as ((featureProps: BeforeRenderFeatureProps) => void)[]).reduce<\n Promise<void | null>\n >(async (p, feature) => {\n return p.then(() => {\n if (!featureProps.rsInternal.getRsStore().isMounted) return null;\n return feature({\n getView: featureProps.rsInternal.getView,\n getRsStore: featureProps.rsInternal.getRsStore,\n getRsProps: featureProps.rsInternal.getRsProps,\n getState: featureProps.getState,\n getOriginalState: featureProps.getOriginalState,\n dispatch: featureProps.dispatch,\n queuedActions: featureProps.queuedActions,\n browserContext: featureProps.rsInternal.getBrowserContext()\n });\n });\n }, Promise.resolve());\n };\n}\n\n/**\n * Initializes and returns after render features which run after the render is completed.\n * @param rsInternal RsInternal reference.\n */\nfunction initializeAfterRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const afterRenderUIFeatures = features.afterRender.map(t => t(rsInternal)).filter(Boolean);\n\n return () => {\n (afterRenderUIFeatures as ((featureProps: FeatureProps) => void)[]).forEach(feature => {\n if (rsInternal.getRsStore().isMounted && rsInternal.getRsStateResolver()) {\n feature({\n getView: rsInternal.getView,\n getRsStore: rsInternal.getRsStore,\n getRsProps: rsInternal.getRsProps,\n getState: rsInternal.getRsStateResolver().getState,\n getOriginalState: rsInternal.getRsStateResolver().getOriginalState,\n dispatch: rsInternal.getRsStateResolver().dispatch,\n browserContext: rsInternal.getBrowserContext()\n });\n }\n });\n };\n}\n\n/**\n * Initializes and return before and after render features.\n * @param rsInternal\n */\nexport default function initializeFeatures(\n rsInternal: RsInternal\n): [(featureProps: MiddleWareFeatureProps) => Promise<void | null>, () => void] {\n return [initializeBeforeRenderFeatures(rsInternal), initializeAfterRenderFeatures(rsInternal)];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/afterRender/animation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA6HzD;;;;;;;;;;;;;;;;;;;GAmBG;+BAKuB,cAAc,YAAY;AAJpD,wBA8BE"}
1
+ {"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/afterRender/animation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAuIzD;;;;;;;;;;;;;;;;;;;GAmBG;+BAKuB,cAAc,YAAY;AAJpD,wBA8BE"}
@@ -1,3 +1,4 @@
1
+ import { isInstance } from '@pega/cosmos-react-core';
1
2
  import { withMemoization } from '../../../utils/util';
2
3
  /**
3
4
  * Triggers animation on a {@link domNode} in X and Y direction by {@link deltaX} and {@link deltaY} respectively.
@@ -41,7 +42,9 @@ const rowAnimation = ([{ getState, getView, getRsStore }]) => {
41
42
  // Calculate the bounding box
42
43
  const newBoundingBox = new Map();
43
44
  rowContainer?.childNodes.forEach(n => {
44
- if (n.nodeType === Node.ELEMENT_NODE && n instanceof Element && n.hasAttribute?.('data-key'))
45
+ if (n.nodeType === Node.ELEMENT_NODE &&
46
+ isInstance(n, Element) &&
47
+ n.hasAttribute?.('data-key'))
45
48
  newBoundingBox.set(n.getAttribute('data-key'), n.getBoundingClientRect());
46
49
  });
47
50
  for (const [key, value] of newBoundingBox) {
@@ -90,17 +93,23 @@ const columnAnimation = ([{ getState, getView, getRsStore }]) => {
90
93
  .getItemElement()
91
94
  .childNodes.forEach(cell => {
92
95
  if (cell.nodeType === Node.ELEMENT_NODE &&
93
- cell instanceof Element &&
96
+ isInstance(cell, Element) &&
94
97
  cell.hasAttribute?.('data-col-id')) {
95
98
  newColBoundingBox.set(cell.getAttribute('data-col-id'), cell.getBoundingClientRect());
96
99
  }
97
100
  });
98
101
  }
102
+ const visibleColumns = getView().getVisibleColumns();
99
103
  rsStore.oldColumnBoundingBox.forEach((value, key) => {
100
104
  if (newColBoundingBox.has(key)) {
101
105
  const deltaX = value.left - newColBoundingBox.get(key).left;
102
106
  const domNodes = pNode?.querySelectorAll(`[data-col-id='${key}']`);
103
107
  if (deltaX) {
108
+ // FIXME: skipping animation on the last column because in case a record is added like in embedded tables, a vertical scrollbar appears momentarily which shifts the last column to left and this triggers unnecessary animation on last column.
109
+ const currentColumn = visibleColumns.find(col => col.field.id === key);
110
+ if (currentColumn?.isLastColumn) {
111
+ return;
112
+ }
104
113
  domNodes?.forEach(domNode => {
105
114
  animate(domNode, deltaX, 0);
106
115
  });
@@ -1 +1 @@
1
- {"version":3,"file":"animation.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/afterRender/animation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA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C;gBAC7D,MAAM,QAAQ,GAAG,KAAK,EAAE,gBAAgB,CAAc,iBAAiB,GAAG,IAAI,CAAC,CAAC;gBAChF,IAAI,MAAM,EAAE,CAAC;oBACX,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;wBAC1B,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;oBAC9B,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACtC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAe,GAAG,EAAE;IAClB,MAAM,oBAAoB,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAC3D,MAAM,uBAAuB,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;IAEjE,OAAO,SAAS,OAAO,CAAC,YAA0B;QAChD,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QACtC,oBAAoB,CAClB,CAAC,YAAY,CAAC,EACd;YACE,KAAK,CAAC,gBAAgB;YACtB,iGAAiG;YACjG,KAAK,CAAC,UAAU;YAChB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,MAAM;YACZ,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,oBAAoB;SAC3B,CACF,CAAC;QACF,uBAAuB,CACrB,CAAC,YAAY,CAAC,EACd;YACE,KAAK,CAAC,aAAa;YACnB,KAAK,CAAC,QAAQ;YACd,KAAK,CAAC,aAAa;YACnB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,OAAO;YACb,YAAY,CAAC,UAAU,EAAE,CAAC,4BAA4B;SACvD,CACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { State } from '../../../../../types/State.types';\nimport { withMemoization } from '../../../utils/util';\nimport type { FeatureProps } from '../../featureFactory';\n// Used in JsDoc.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type RsStore from '../../../RsStore';\n\n/**\n * Triggers animation on a {@link domNode} in X and Y direction by {@link deltaX} and {@link deltaY} respectively.\n * @param domNode - Dom node on which animation should be triggered.\n * @param deltaX - Range of movement on X axis.\n * @param deltaY - Range of movement on Y axis\n * @returns void\n */\nfunction animate(domNode: HTMLElement, deltaX = 150, deltaY = 150) {\n if (!domNode) return;\n if (deltaY || deltaX) {\n requestAnimationFrame(() => {\n // Ensure that it inverts immediately\n domNode.style.transition = 'transform 0s';\n // Before the DOM paints, Invert it to its old\n domNode.style.transform = `translate3d(${deltaX}px, ${deltaY}px, 0)`;\n\n requestAnimationFrame(() => {\n domNode.style.removeProperty('transform');\n domNode.style.removeProperty('transition');\n });\n });\n }\n}\n\n/**\n * Triggers column animation.\n * @param featureProps - A tuple containing an object of feature props.\n * @returns void\n */\nconst rowAnimation = ([{ getState, getView, getRsStore }]: [featureProps: FeatureProps]) => {\n const { featuresToAvoid } = getState();\n const rsStore = getRsStore();\n let avoidRowAnimation = false;\n if (featuresToAvoid?.includes('rowAnimation')) {\n avoidRowAnimation = true;\n }\n // Row animation\n if (!avoidRowAnimation && rsStore.oldBoundingBox?.size) {\n const pNode = getView().getDomContainer();\n const rowContainer = pNode?.querySelector('.row-container'); // row container should wrap all the rows.\n\n // Calculate the bounding box\n const newBoundingBox = new Map();\n rowContainer?.childNodes.forEach(n => {\n if (n.nodeType === Node.ELEMENT_NODE && n instanceof Element && n.hasAttribute?.('data-key'))\n newBoundingBox.set(n.getAttribute('data-key'), n.getBoundingClientRect());\n });\n\n for (const [key, value] of newBoundingBox) {\n const rowNode = rowContainer?.querySelector<HTMLElement>(`[data-key='${CSS.escape(key)}']`);\n if (rsStore.oldBoundingBox.has(key)) {\n // Those elements that were in the dom earlier as well\n const deltaY = rsStore.oldBoundingBox.get(key)!.top - value.top;\n const deltaX = rsStore.oldBoundingBox.get(key)!.left - value.left;\n animate(rowNode!, deltaX, deltaY);\n } else {\n // Those elements that came in now\n animate(rowNode!, 0);\n }\n }\n rsStore.oldBoundingBox = null;\n }\n};\n\n/**\n * Evaluates if column animation needs to be skipped based on {@link State.featuresToAvoid}\n * @param featuresToAvoid\n * @returns boolean - true if columnAnimation should be skipped otherwise false.\n */\nfunction avoidColumnAnimation(featuresToAvoid: State['featuresToAvoid']) {\n return featuresToAvoid?.includes('columnAnimation');\n}\n/**\n * Triggers column animation.\n * @param featureProps - A tuple containing an object of feature props.\n * @returns void\n */\nconst columnAnimation = ([{ getState, getView, getRsStore }]: [featureProps: FeatureProps]) => {\n const { featuresToAvoid } = getState();\n const rsStore = getRsStore();\n\n if (rsStore.skipColumnAnimationOnNextRun) {\n rsStore.skipColumnAnimationOnNextRun = false;\n return;\n }\n\n // Column animation\n if (!avoidColumnAnimation(featuresToAvoid) && rsStore.oldColumnBoundingBox?.size) {\n const pNode = getView().getDomContainer();\n\n // Calculate the bounding box\n const newColBoundingBox = new Map<string, DOMRect>();\n if (getView().getItemElement()) {\n getView()\n .getItemElement()!\n .childNodes.forEach(cell => {\n if (\n cell.nodeType === Node.ELEMENT_NODE &&\n cell instanceof Element &&\n cell.hasAttribute?.('data-col-id')\n ) {\n newColBoundingBox.set(cell.getAttribute('data-col-id')!, cell.getBoundingClientRect());\n }\n });\n }\n rsStore.oldColumnBoundingBox.forEach((value, key) => {\n if (newColBoundingBox.has(key)) {\n const deltaX = value.left - newColBoundingBox.get(key)!.left;\n const domNodes = pNode?.querySelectorAll<HTMLElement>(`[data-col-id='${key}']`);\n if (deltaX) {\n domNodes?.forEach(domNode => {\n animate(domNode, deltaX, 0);\n });\n }\n }\n });\n rsStore.oldColumnBoundingBox = null;\n }\n};\n\n/**\n * Handles animations for rows and columns\n * The animations are triggered based on changes to specific state properties:\n *\n * ### Row Animation Triggers\n * - {@link State.filterExpression}\n * - search text\n * - {@link State.sortingOrder}\n * - {@link State.groups}\n * - {@link State.refresh}\n * - {@link State.selectedHeightOption}\n *\n * ### Column Animation Triggers\n * - {@link State.freezeColumns}\n * - {@link State.colOrder}\n * - {@link State.hiddenColumns}\n * - {@link State.columnWidths}\n * - {@link State.refresh}\n * - {@link RsStore.skipColumnAnimationOnNextRun}\n */\nexport default () => {\n const memoizedRowAnimation = withMemoization(rowAnimation);\n const memoizedColumnAnimation = withMemoization(columnAnimation);\n\n return function execute(featureProps: FeatureProps) {\n const state = featureProps.getState();\n memoizedRowAnimation(\n [featureProps],\n [\n state.filterExpression,\n // @ts-expect-error Property 'searchText' does not exist on type 'State' but exists on view.state\n state.searchText,\n state.sortingOrder,\n state.groups,\n state.refresh,\n state.selectedHeightOption\n ]\n );\n memoizedColumnAnimation(\n [featureProps],\n [\n state.freezeColumns,\n state.colOrder,\n state.hiddenColumns,\n state.columnWidths,\n state.refresh,\n featureProps.getRsStore().skipColumnAnimationOnNextRun\n ]\n );\n };\n};\n"]}
1
+ {"version":3,"file":"animation.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/afterRender/animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAMtD;;;;;;GAMG;AACH,SAAS,OAAO,CAAC,OAAoB,EAAE,MAAM,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG;IAC/D,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;QACrB,qBAAqB,CAAC,GAAG,EAAE;YACzB,qCAAqC;YACrC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,cAAc,CAAC;YAC1C,8CAA8C;YAC9C,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,MAAM,OAAO,MAAM,QAAQ,CAAC;YAErE,qBAAqB,CAAC,GAAG,EAAE;gBACzB,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;gBAC1C,OAAO,CAAC,KAAK,CAAC,cAAc,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O,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;oBAC9B,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACtC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAe,GAAG,EAAE;IAClB,MAAM,oBAAoB,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAC3D,MAAM,uBAAuB,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;IAEjE,OAAO,SAAS,OAAO,CAAC,YAA0B;QAChD,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QACtC,oBAAoB,CAClB,CAAC,YAAY,CAAC,EACd;YACE,KAAK,CAAC,gBAAgB;YACtB,iGAAiG;YACjG,KAAK,CAAC,UAAU;YAChB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,MAAM;YACZ,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,oBAAoB;SAC3B,CACF,CAAC;QACF,uBAAuB,CACrB,CAAC,YAAY,CAAC,EACd;YACE,KAAK,CAAC,aAAa;YACnB,KAAK,CAAC,QAAQ;YACd,KAAK,CAAC,aAAa;YACnB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,OAAO;YACb,YAAY,CAAC,UAAU,EAAE,CAAC,4BAA4B;SACvD,CACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { isInstance } from '@pega/cosmos-react-core';\n\nimport type { State } from '../../../../../types/State.types';\nimport { withMemoization } from '../../../utils/util';\nimport type { FeatureProps } from '../../featureFactory';\n// Used in JsDoc.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type RsStore from '../../../RsStore';\n\n/**\n * Triggers animation on a {@link domNode} in X and Y direction by {@link deltaX} and {@link deltaY} respectively.\n * @param domNode - Dom node on which animation should be triggered.\n * @param deltaX - Range of movement on X axis.\n * @param deltaY - Range of movement on Y axis\n * @returns void\n */\nfunction animate(domNode: HTMLElement, deltaX = 150, deltaY = 150) {\n if (!domNode) return;\n if (deltaY || deltaX) {\n requestAnimationFrame(() => {\n // Ensure that it inverts immediately\n domNode.style.transition = 'transform 0s';\n // Before the DOM paints, Invert it to its old\n domNode.style.transform = `translate3d(${deltaX}px, ${deltaY}px, 0)`;\n\n requestAnimationFrame(() => {\n domNode.style.removeProperty('transform');\n domNode.style.removeProperty('transition');\n });\n });\n }\n}\n\n/**\n * Triggers column animation.\n * @param featureProps - A tuple containing an object of feature props.\n * @returns void\n */\nconst rowAnimation = ([{ getState, getView, getRsStore }]: [featureProps: FeatureProps]) => {\n const { featuresToAvoid } = getState();\n const rsStore = getRsStore();\n let avoidRowAnimation = false;\n if (featuresToAvoid?.includes('rowAnimation')) {\n avoidRowAnimation = true;\n }\n // Row animation\n if (!avoidRowAnimation && rsStore.oldBoundingBox?.size) {\n const pNode = getView().getDomContainer();\n const rowContainer = pNode?.querySelector('.row-container'); // row container should wrap all the rows.\n\n // Calculate the bounding box\n const newBoundingBox = new Map();\n rowContainer?.childNodes.forEach(n => {\n if (\n n.nodeType === Node.ELEMENT_NODE &&\n isInstance(n, Element) &&\n n.hasAttribute?.('data-key')\n )\n newBoundingBox.set(n.getAttribute('data-key'), n.getBoundingClientRect());\n });\n\n for (const [key, value] of newBoundingBox) {\n const rowNode = rowContainer?.querySelector<HTMLElement>(`[data-key='${CSS.escape(key)}']`);\n if (rsStore.oldBoundingBox.has(key)) {\n // Those elements that were in the dom earlier as well\n const deltaY = rsStore.oldBoundingBox.get(key)!.top - value.top;\n const deltaX = rsStore.oldBoundingBox.get(key)!.left - value.left;\n animate(rowNode!, deltaX, deltaY);\n } else {\n // Those elements that came in now\n animate(rowNode!, 0);\n }\n }\n rsStore.oldBoundingBox = null;\n }\n};\n\n/**\n * Evaluates if column animation needs to be skipped based on {@link State.featuresToAvoid}\n * @param featuresToAvoid\n * @returns boolean - true if columnAnimation should be skipped otherwise false.\n */\nfunction avoidColumnAnimation(featuresToAvoid: State['featuresToAvoid']) {\n return featuresToAvoid?.includes('columnAnimation');\n}\n/**\n * Triggers column animation.\n * @param featureProps - A tuple containing an object of feature props.\n * @returns void\n */\nconst columnAnimation = ([{ getState, getView, getRsStore }]: [featureProps: FeatureProps]) => {\n const { featuresToAvoid } = getState();\n const rsStore = getRsStore();\n\n if (rsStore.skipColumnAnimationOnNextRun) {\n rsStore.skipColumnAnimationOnNextRun = false;\n return;\n }\n\n // Column animation\n if (!avoidColumnAnimation(featuresToAvoid) && rsStore.oldColumnBoundingBox?.size) {\n const pNode = getView().getDomContainer();\n\n // Calculate the bounding box\n const newColBoundingBox = new Map<string, DOMRect>();\n if (getView().getItemElement()) {\n getView()\n .getItemElement()!\n .childNodes.forEach(cell => {\n if (\n cell.nodeType === Node.ELEMENT_NODE &&\n isInstance(cell, Element) &&\n cell.hasAttribute?.('data-col-id')\n ) {\n newColBoundingBox.set(cell.getAttribute('data-col-id')!, cell.getBoundingClientRect());\n }\n });\n }\n const visibleColumns = getView().getVisibleColumns();\n rsStore.oldColumnBoundingBox.forEach((value, key) => {\n if (newColBoundingBox.has(key)) {\n const deltaX = value.left - newColBoundingBox.get(key)!.left;\n const domNodes = pNode?.querySelectorAll<HTMLElement>(`[data-col-id='${key}']`);\n if (deltaX) {\n // FIXME: skipping animation on the last column because in case a record is added like in embedded tables, a vertical scrollbar appears momentarily which shifts the last column to left and this triggers unnecessary animation on last column.\n const currentColumn = visibleColumns.find(col => col.field.id === key);\n if (currentColumn?.isLastColumn) {\n return;\n }\n domNodes?.forEach(domNode => {\n animate(domNode, deltaX, 0);\n });\n }\n }\n });\n rsStore.oldColumnBoundingBox = null;\n }\n};\n\n/**\n * Handles animations for rows and columns\n * The animations are triggered based on changes to specific state properties:\n *\n * ### Row Animation Triggers\n * - {@link State.filterExpression}\n * - search text\n * - {@link State.sortingOrder}\n * - {@link State.groups}\n * - {@link State.refresh}\n * - {@link State.selectedHeightOption}\n *\n * ### Column Animation Triggers\n * - {@link State.freezeColumns}\n * - {@link State.colOrder}\n * - {@link State.hiddenColumns}\n * - {@link State.columnWidths}\n * - {@link State.refresh}\n * - {@link RsStore.skipColumnAnimationOnNextRun}\n */\nexport default () => {\n const memoizedRowAnimation = withMemoization(rowAnimation);\n const memoizedColumnAnimation = withMemoization(columnAnimation);\n\n return function execute(featureProps: FeatureProps) {\n const state = featureProps.getState();\n memoizedRowAnimation(\n [featureProps],\n [\n state.filterExpression,\n // @ts-expect-error Property 'searchText' does not exist on type 'State' but exists on view.state\n state.searchText,\n state.sortingOrder,\n state.groups,\n state.refresh,\n state.selectedHeightOption\n ]\n );\n memoizedColumnAnimation(\n [featureProps],\n [\n state.freezeColumns,\n state.colOrder,\n state.hiddenColumns,\n state.columnWidths,\n state.refresh,\n featureProps.getRsStore().skipColumnAnimationOnNextRun\n ]\n );\n };\n};\n"]}
@@ -1,22 +1,8 @@
1
1
  import type Column from '../../../../generators/ColumnGenerator';
2
2
  import type View from '../../../../generators/ViewGenerator';
3
+ export declare function autoSizeOfColumn(col: Column, domContainer: NonNullable<View['domContainer']>, forceAutoSize?: boolean): number;
3
4
  /**
4
- * Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.
5
- *
6
- * @param column - A column object representing column in the view.
7
- * @param domContainer - The HTML element that acts as the container for RS.
8
- * @param forceAutoSize - A boolean flag that indicates whether to force a recalculation of column widths.
9
- * @returns column width in pixels.
10
- */
11
- export declare function autoSizeOfColumn(column: Column, domContainer: NonNullable<View['domContainer']>, forceAutoSize?: boolean): number;
12
- /**
13
- * Calculates the maximum width available in the dom container
14
- * @param domContainer The HTML element that acts as the container for RS.
15
- * @returns Maximum available width.
16
- */
17
- export declare function getMaxAvailableWidth(domContainer: NonNullable<View['domContainer']>): number;
18
- /**
19
- * Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width..
5
+ * Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.
20
6
  *
21
7
  * @param columns - An array of `Column` objects representing the columns in the view.
22
8
  * @param domContainer - The HTML element that acts as the container for RS.
@@ -1 +1 @@
1
- {"version":3,"file":"autoSize.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,wCAAwC,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,sCAAsC,CAAC;AAK7D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAC/C,aAAa,UAAQ,UA0DtB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,UAmBnF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAC/C,KAAK,CAAC,EAAE,OAAO;;EA8BhB"}
1
+ {"version":3,"file":"autoSize.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,wCAAwC,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,sCAAsC,CAAC;AAmD7D,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAC/C,aAAa,UAAQ,GACpB,MAAM,CAWR;AACD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAC/C,KAAK,CAAC,EAAE,OAAO;;EAmChB"}
@@ -1,5 +1,4 @@
1
- import { expandCollapseAllMeta, rowSelectColumnMeta } from '../../../../constants';
2
- import { getScrollbarWidth } from '../../../../utils/util';
1
+ import { rowSelectColumnMeta } from '../../../../constants';
3
2
  /**
4
3
  * Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.
5
4
  *
@@ -8,81 +7,44 @@ import { getScrollbarWidth } from '../../../../utils/util';
8
7
  * @param forceAutoSize - A boolean flag that indicates whether to force a recalculation of column widths.
9
8
  * @returns column width in pixels.
10
9
  */
11
- export function autoSizeOfColumn(column, domContainer, forceAutoSize = false) {
10
+ const MAX_CONTENT = 'max-content';
11
+ const ROUNDING_BUFFER = 1;
12
+ function calculateColumnWidth(column, domContainer, forceAutoSize = false) {
12
13
  if (!forceAutoSize) {
13
14
  // This will be executed in case of reset width
14
15
  const personalizedWidth = column.getPersonalizedWidth();
15
- if (personalizedWidth)
16
+ if (personalizedWidth) {
16
17
  return personalizedWidth;
17
- if (column.field.width)
18
+ }
19
+ if (column.field.width) {
18
20
  return column.field.width;
21
+ }
19
22
  }
20
- const view = column.parent;
21
- const { showGroupingExpandCollapseAll, state: { showSelectAllCheckbox } } = view;
22
- // Condition for double click event triggered to autosize the column
23
- /* Autosize calculations begin */
24
- const cells = domContainer.querySelectorAll(`[data-col-id="${column.field.id}"]`);
25
- const holder = document.createElement('div');
26
- holder.style.width = '100000px'; // some very high number
27
- const span = document.createElement('span');
28
- holder.appendChild(span);
29
- domContainer.appendChild(holder);
30
- cells.forEach(cell => {
31
- const row = document.createElement('div');
32
- row.style.display = 'table-row';
33
- cell.childNodes.forEach(child => row.appendChild(child.cloneNode(true)));
34
- span.appendChild(row);
23
+ const cellsList = Array.from(domContainer.querySelectorAll(`[data-col-id="${column.field.id}"]`));
24
+ let maxContentWidth = 0;
25
+ cellsList.forEach(cell => {
26
+ const cellWidth = cell.offsetWidth;
27
+ if (cellWidth > maxContentWidth) {
28
+ maxContentWidth = cellWidth;
29
+ }
35
30
  });
36
- let autoSize = Math.ceil(span.getBoundingClientRect().width);
37
- const iconsPlaceholder = domContainer.querySelector(`.header .cell[data-col-id="${column.field.id}"] .icons-ph`);
38
- // If grouping and select all functionality are enabled and selection is the first column, reserve extra space in Row select header column to accommodate expand all button.
39
- const reserveSpaceForGroupToggleButton = showGroupingExpandCollapseAll &&
40
- showSelectAllCheckbox &&
41
- column.field.id === rowSelectColumnMeta.field.id &&
42
- // TODO: Selectors should not be hardcoded in rsCore OR it should come via proper contract.
43
- domContainer.querySelector(`.row .cell[data-col-id="${rowSelectColumnMeta.field.id}"]:first-child`);
44
- if (iconsPlaceholder) {
45
- autoSize += iconsPlaceholder.offsetWidth;
46
- }
47
- if (reserveSpaceForGroupToggleButton) {
48
- const expandCollapseAllElement = domContainer.querySelector(expandCollapseAllMeta.selector);
49
- autoSize += expandCollapseAllElement ? expandCollapseAllElement.offsetWidth : 0;
50
- }
51
- domContainer.removeChild(holder);
52
- // Increased spacing style width by 1px to account for offsetWidth rounding off, this was causing truncation.
53
- autoSize += 17; // 17px for Spacing styles applied (Fetching applied styles is costly, so keeping some visible space)
54
- // Allow columns to autosize till a restricted max width
55
- return column.field.maxWidth && autoSize > column.field.maxWidth
31
+ /* buffer to prevent content clipping due to offsetWidth rounding */
32
+ const maxColumnWidth = maxContentWidth + ROUNDING_BUFFER;
33
+ return column.field.maxWidth && maxColumnWidth > column.field.maxWidth
56
34
  ? column.field.maxWidth
57
- : autoSize;
35
+ : maxColumnWidth;
58
36
  }
59
- /**
60
- * Calculates the maximum width available in the dom container
61
- * @param domContainer The HTML element that acts as the container for RS.
62
- * @returns Maximum available width.
63
- */
64
- export function getMaxAvailableWidth(domContainer) {
65
- let width = domContainer.clientWidth - getScrollbarWidth();
66
- const firstCell = domContainer.querySelector('.cell');
67
- if (!firstCell) {
68
- return width;
69
- }
70
- let element = firstCell.parentElement;
71
- let style = null;
72
- let margin = 0;
73
- let padding = 0;
74
- while (element !== domContainer.parentElement) {
75
- // @ts-expect-error Property 'currentStyle' does not exist on type 'HTMLElement' This was used for IE browser initially. Check if it can be removed.
76
- style = element.currentStyle || window.getComputedStyle(element);
77
- margin = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
78
- padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
79
- width -= padding + margin + element.offsetWidth - element.clientWidth;
80
- element = element.parentElement;
81
- }
82
- return width;
37
+ export function autoSizeOfColumn(col, domContainer, forceAutoSize = false) {
38
+ // Set to max-content to measure actual content width
39
+ domContainer.style.setProperty(`--col-width-${col.field.idHash}`, MAX_CONTENT);
40
+ domContainer.setAttribute('data-content-size-measuring', 'true');
41
+ const columnWidth = calculateColumnWidth(col, domContainer, forceAutoSize);
42
+ domContainer.style.setProperty(`--col-width-${col.field.idHash}`, `${col.currentWidth}px`);
43
+ domContainer.removeAttribute('data-content-size-measuring');
44
+ return columnWidth;
83
45
  }
84
46
  /**
85
- * Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width..
47
+ * Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.
86
48
  *
87
49
  * @param columns - An array of `Column` objects representing the columns in the view.
88
50
  * @param domContainer - The HTML element that acts as the container for RS.
@@ -90,32 +52,29 @@ export function getMaxAvailableWidth(domContainer) {
90
52
  * @returns An object containing width for each column.
91
53
  */
92
54
  export function autoSizeOfColumns(columns, domContainer, reset) {
93
- let totalCalculatedWidth = 0;
94
55
  const columnAutoSizes = {};
95
- const remainingAvailableWidth = getMaxAvailableWidth(domContainer);
96
- columns.forEach(column => {
97
- if (!column.hidden) {
98
- if (!(column.currentWidth && reset === undefined)) {
99
- // always calculate the content based width for row selection column because it's width will change depending on if grouping is applied or not.
100
- const forceAutosize = column.field.id === rowSelectColumnMeta.field.id || !reset;
101
- const autoSize = autoSizeOfColumn(column, domContainer, forceAutosize);
102
- columnAutoSizes[column.field.id] = autoSize;
103
- totalCalculatedWidth += autoSize;
104
- }
105
- else {
106
- totalCalculatedWidth += column.currentWidth;
107
- }
56
+ const visibleColumns = columns.filter(col => !col.hidden);
57
+ // Set CSS variables for all columns that need auto-sizing first (single batch write)
58
+ visibleColumns.forEach(column => {
59
+ domContainer.style.setProperty(`--col-width-${column.field.idHash}`, MAX_CONTENT);
60
+ });
61
+ domContainer.setAttribute('data-content-size-measuring', 'true');
62
+ // Now calculate widths for all columns (each does its own DOM reading in batch context)
63
+ visibleColumns.forEach(column => {
64
+ if (!(column.currentWidth && reset === undefined)) {
65
+ // always calculate the content based width for row selection column because it's width will change depending on if grouping is applied or not.
66
+ const forceAutosize = column.field.id === rowSelectColumnMeta.field.id || !reset;
67
+ const columnWidth = calculateColumnWidth(column, domContainer, forceAutosize);
68
+ columnAutoSizes[column.field.id] = columnWidth;
69
+ }
70
+ });
71
+ domContainer.removeAttribute('data-content-size-measuring');
72
+ // Reset CSS variables back to original widths for columns that had max-content set
73
+ visibleColumns.forEach(column => {
74
+ if (column.currentWidth) {
75
+ domContainer.style.setProperty(`--col-width-${column.field.idHash}`, `${column.currentWidth}px`);
108
76
  }
109
77
  });
110
- const extraSpace = remainingAvailableWidth - totalCalculatedWidth;
111
- if (extraSpace <= 0 || Number.isNaN(extraSpace))
112
- return columnAutoSizes;
113
- const columnToFillRemainingSpace = columns.find(c => c.field.fillAvailableSpace);
114
- if (columnToFillRemainingSpace && !columnToFillRemainingSpace.hidden) {
115
- columnAutoSizes[columnToFillRemainingSpace.field.id] =
116
- (columnAutoSizes[columnToFillRemainingSpace.field.id] ??
117
- columnToFillRemainingSpace.currentWidth) + extraSpace;
118
- }
119
78
  return columnAutoSizes;
120
79
  }
121
80
  //# sourceMappingURL=autoSize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"autoSize.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAI3D;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAc,EACd,YAA+C,EAC/C,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,+CAA+C;QAC/C,MAAM,iBAAiB,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACxD,IAAI,iBAAiB;YAAE,OAAO,iBAAiB,CAAC;QAChD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IACpD,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3B,MAAM,EACJ,6BAA6B,EAC7B,KAAK,EAAE,EAAE,qBAAqB,EAAE,EACjC,GAAG,IAAI,CAAC;IACT,oEAAoE;IACpE,iCAAiC;IACjC,MAAM,KAAK,GAAG,YAAY,CAAC,gBAAgB,CAAC,iBAAiB,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;IAClF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,wBAAwB;IACzD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzB,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC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CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;IAC5D,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { ColumnResizePayload } from '../../../../actions/actions.types';\nimport { expandCollapseAllMeta, rowSelectColumnMeta } from '../../../../constants';\nimport type Column from '../../../../generators/ColumnGenerator';\nimport type View from '../../../../generators/ViewGenerator';\nimport { getScrollbarWidth } from '../../../../utils/util';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { FieldDef } from '../../../../../../types/Meta.types';\n\n/**\n * Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.\n *\n * @param column - A column object representing column in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param forceAutoSize - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns column width in pixels.\n */\nexport function autoSizeOfColumn(\n column: Column,\n domContainer: NonNullable<View['domContainer']>,\n forceAutoSize = false\n) {\n if (!forceAutoSize) {\n // This will be executed in case of reset width\n const personalizedWidth = column.getPersonalizedWidth();\n if (personalizedWidth) return personalizedWidth;\n if (column.field.width) return column.field.width;\n }\n\n const view = column.parent;\n const {\n showGroupingExpandCollapseAll,\n state: { showSelectAllCheckbox }\n } = view;\n // Condition for double click event triggered to autosize the column\n /* Autosize calculations begin */\n const cells = domContainer.querySelectorAll(`[data-col-id=\"${column.field.id}\"]`);\n const holder = document.createElement('div');\n holder.style.width = '100000px'; // some very high number\n const span = document.createElement('span');\n holder.appendChild(span);\n domContainer.appendChild(holder);\n cells.forEach(cell => {\n const row = document.createElement('div');\n row.style.display = 'table-row';\n cell.childNodes.forEach(child => row.appendChild(child.cloneNode(true)));\n span.appendChild(row);\n });\n let autoSize = Math.ceil(span.getBoundingClientRect().width);\n const iconsPlaceholder = domContainer.querySelector<HTMLElement>(\n `.header .cell[data-col-id=\"${column.field.id}\"] .icons-ph`\n );\n // If grouping and select all functionality are enabled and selection is the first column, reserve extra space in Row select header column to accommodate expand all button.\n const reserveSpaceForGroupToggleButton =\n showGroupingExpandCollapseAll &&\n showSelectAllCheckbox &&\n column.field.id === rowSelectColumnMeta.field.id &&\n // TODO: Selectors should not be hardcoded in rsCore OR it should come via proper contract.\n domContainer.querySelector<HTMLElement>(\n `.row .cell[data-col-id=\"${rowSelectColumnMeta.field.id}\"]:first-child`\n );\n\n if (iconsPlaceholder) {\n autoSize += iconsPlaceholder.offsetWidth;\n }\n if (reserveSpaceForGroupToggleButton) {\n const expandCollapseAllElement = domContainer.querySelector<HTMLElement>(\n expandCollapseAllMeta.selector\n );\n autoSize += expandCollapseAllElement ? expandCollapseAllElement.offsetWidth : 0;\n }\n domContainer.removeChild(holder);\n // Increased spacing style width by 1px to account for offsetWidth rounding off, this was causing truncation.\n autoSize += 17; // 17px for Spacing styles applied (Fetching applied styles is costly, so keeping some visible space)\n // Allow columns to autosize till a restricted max width\n return column.field.maxWidth && autoSize > column.field.maxWidth\n ? column.field.maxWidth\n : autoSize;\n}\n\n/**\n * Calculates the maximum width available in the dom container\n * @param domContainer The HTML element that acts as the container for RS.\n * @returns Maximum available width.\n */\nexport function getMaxAvailableWidth(domContainer: NonNullable<View['domContainer']>) {\n let width = domContainer.clientWidth - getScrollbarWidth();\n const firstCell = domContainer.querySelector('.cell');\n if (!firstCell) {\n return width;\n }\n let element = firstCell.parentElement!;\n let style = null;\n let margin = 0;\n let padding = 0;\n while (element !== domContainer.parentElement) {\n // @ts-expect-error Property 'currentStyle' does not exist on type 'HTMLElement' This was used for IE browser initially. Check if it can be removed.\n style = element.currentStyle || window.getComputedStyle(element);\n margin = parseFloat(style.marginLeft) + parseFloat(style.marginRight);\n padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);\n width -= padding + margin + element.offsetWidth - element.clientWidth;\n element = element.parentElement!;\n }\n return width;\n}\n\n/**\n * Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width..\n *\n * @param columns - An array of `Column` objects representing the columns in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param reset - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns An object containing width for each column.\n */\nexport function autoSizeOfColumns(\n columns: Column[],\n domContainer: NonNullable<View['domContainer']>,\n reset?: boolean\n) {\n let totalCalculatedWidth = 0;\n const columnAutoSizes: ColumnResizePayload['data'] = {};\n\n const remainingAvailableWidth = getMaxAvailableWidth(domContainer);\n\n columns.forEach(column => {\n if (!column.hidden) {\n if (!(column.currentWidth && reset === undefined)) {\n // always calculate the content based width for row selection column because it's width will change depending on if grouping is applied or not.\n const forceAutosize = column.field.id === rowSelectColumnMeta.field.id || !reset;\n const autoSize = autoSizeOfColumn(column, domContainer, forceAutosize);\n columnAutoSizes[column.field.id] = autoSize;\n totalCalculatedWidth += autoSize;\n } else {\n totalCalculatedWidth += column.currentWidth;\n }\n }\n });\n const extraSpace = remainingAvailableWidth - totalCalculatedWidth;\n if (extraSpace <= 0 || Number.isNaN(extraSpace)) return columnAutoSizes;\n const columnToFillRemainingSpace = columns.find(c => c.field.fillAvailableSpace);\n\n if (columnToFillRemainingSpace && !columnToFillRemainingSpace.hidden) {\n columnAutoSizes[columnToFillRemainingSpace.field.id] =\n (columnAutoSizes[columnToFillRemainingSpace.field.id] ??\n columnToFillRemainingSpace.currentWidth) + extraSpace;\n }\n return columnAutoSizes;\n}\n"]}
1
+ {"version":3,"file":"autoSize.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAM5D;;;;;;;GAOG;AAEH,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,SAAS,oBAAoB,CAC3B,MAAc,EACd,YAA+C,EAC/C,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,aAAa,EAAE,CAA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CAAC,CAAC;IAC5D,mFAAmF;IACnF,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC9B,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YACxB,YAAY,CAAC,KAAK,CAAC,WAAW,CAC5B,eAAe,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,EACpC,GAAG,MAAM,CAAC,YAAY,IAAI,CAC3B,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { ColumnResizePayload } from '../../../../actions/actions.types';\nimport { rowSelectColumnMeta } from '../../../../constants';\nimport type Column from '../../../../generators/ColumnGenerator';\nimport type View from '../../../../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { FieldDef } from '../../../../../../types/Meta.types';\n\n/**\n * Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.\n *\n * @param column - A column object representing column in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param forceAutoSize - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns column width in pixels.\n */\n\nconst MAX_CONTENT = 'max-content';\nconst ROUNDING_BUFFER = 1;\nfunction calculateColumnWidth(\n column: Column,\n domContainer: NonNullable<View['domContainer']>,\n forceAutoSize = false\n) {\n if (!forceAutoSize) {\n // This will be executed in case of reset width\n const personalizedWidth = column.getPersonalizedWidth();\n if (personalizedWidth) {\n return personalizedWidth;\n }\n if (column.field.width) {\n return column.field.width;\n }\n }\n\n const cellsList = Array.from(\n domContainer.querySelectorAll<HTMLElement>(`[data-col-id=\"${column.field.id}\"]`)\n );\n\n let maxContentWidth = 0;\n cellsList.forEach(cell => {\n const cellWidth = cell.offsetWidth;\n if (cellWidth > maxContentWidth) {\n maxContentWidth = cellWidth;\n }\n });\n\n /* buffer to prevent content clipping due to offsetWidth rounding */\n const maxColumnWidth = maxContentWidth + ROUNDING_BUFFER;\n\n return column.field.maxWidth && maxColumnWidth > column.field.maxWidth\n ? column.field.maxWidth\n : maxColumnWidth;\n}\n\nexport function autoSizeOfColumn(\n col: Column,\n domContainer: NonNullable<View['domContainer']>,\n forceAutoSize = false\n): number {\n // Set to max-content to measure actual content width\n domContainer.style.setProperty(`--col-width-${col.field.idHash}`, MAX_CONTENT);\n domContainer.setAttribute('data-content-size-measuring', 'true');\n\n const columnWidth = calculateColumnWidth(col, domContainer, forceAutoSize);\n\n domContainer.style.setProperty(`--col-width-${col.field.idHash}`, `${col.currentWidth}px`);\n domContainer.removeAttribute('data-content-size-measuring');\n\n return columnWidth;\n}\n/**\n * Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.\n *\n * @param columns - An array of `Column` objects representing the columns in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param reset - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns An object containing width for each column.\n */\nexport function autoSizeOfColumns(\n columns: Column[],\n domContainer: NonNullable<View['domContainer']>,\n reset?: boolean\n) {\n const columnAutoSizes: ColumnResizePayload['data'] = {};\n\n const visibleColumns = columns.filter(col => !col.hidden);\n\n // Set CSS variables for all columns that need auto-sizing first (single batch write)\n visibleColumns.forEach(column => {\n domContainer.style.setProperty(`--col-width-${column.field.idHash}`, MAX_CONTENT);\n });\n domContainer.setAttribute('data-content-size-measuring', 'true');\n\n // Now calculate widths for all columns (each does its own DOM reading in batch context)\n visibleColumns.forEach(column => {\n if (!(column.currentWidth && reset === undefined)) {\n // always calculate the content based width for row selection column because it's width will change depending on if grouping is applied or not.\n const forceAutosize = column.field.id === rowSelectColumnMeta.field.id || !reset;\n const columnWidth = calculateColumnWidth(column, domContainer, forceAutosize);\n\n columnAutoSizes[column.field.id] = columnWidth;\n }\n });\n\n domContainer.removeAttribute('data-content-size-measuring');\n // Reset CSS variables back to original widths for columns that had max-content set\n visibleColumns.forEach(column => {\n if (column.currentWidth) {\n domContainer.style.setProperty(\n `--col-width-${column.field.idHash}`,\n `${column.currentWidth}px`\n );\n }\n });\n\n return columnAutoSizes;\n}\n"]}
@@ -3,10 +3,9 @@ import type { FeatureProps } from '../../../featureFactory';
3
3
  /**
4
4
  * Executes the autosizing feature on all the columns. It dispatches an action that updates {@link State.columnWidths} slice with the calculated widths for all the columns.
5
5
  * @param param featureProps
6
- * @returns
7
6
  */
8
- export declare function runColumnSizing([{ getState, getView, getRsStore, dispatch }]: [
9
- featureProps: OmitStrict<FeatureProps, 'getOriginalState' | 'getRsProps'>
7
+ export declare function runColumnSizing([{ getView, getRsStore, dispatch }]: [
8
+ featureProps: OmitStrict<FeatureProps, 'getOriginalState' | 'getRsProps' | 'browserContext'>
10
9
  ]): void;
11
10
  /**
12
11
  * Manages the autosizing feature of columns in the view. This includes the following actions:
@@ -27,7 +26,7 @@ export declare function runColumnSizing([{ getState, getView, getRsStore, dispat
27
26
  * - {@link State.hiddenColumns}
28
27
  * - {@link State.customFields}
29
28
  *
30
- * 3. **Executing Autosize on Row Selection Column**:
29
+ * 3. **Executing Autosize on First Visual Column**:
31
30
  *
32
31
  * This action is triggered when any of the following properties change:
33
32
  * - {@link State.groups}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAU1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAmE5D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,EAAE;IAC7E,YAAY,EAAE,UAAU,CAAC,YAAY,EAAE,kBAAkB,GAAG,YAAY,CAAC;CAC1E,QA2DA;AAWD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;+BAMuB,cAAc,YAAY;AALpD,wBA0BE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAU1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAyE5D;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,EAAE;IACnE,YAAY,EAAE,UAAU,CAAC,YAAY,EAAE,kBAAkB,GAAG,YAAY,GAAG,gBAAgB,CAAC;CAC7F,QAgCA;AAWD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;+BAQuB,cAAc,YAAY;AAPpD,wBAmGE"}