react-stately 3.46.0 → 3.47.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 (496) hide show
  1. package/dist/exports/Color.cjs.map +1 -1
  2. package/dist/exports/Color.js.map +1 -1
  3. package/dist/exports/Color.mjs.map +1 -1
  4. package/dist/exports/index.cjs.map +1 -1
  5. package/dist/exports/index.js.map +1 -1
  6. package/dist/exports/index.mjs.map +1 -1
  7. package/dist/exports/private/autocomplete/useAutocompleteState.cjs.map +1 -1
  8. package/dist/exports/private/autocomplete/useAutocompleteState.js.map +1 -1
  9. package/dist/exports/private/autocomplete/useAutocompleteState.mjs.map +1 -1
  10. package/dist/exports/private/collections/getChildNodes.cjs.map +1 -1
  11. package/dist/exports/private/collections/getChildNodes.js.map +1 -1
  12. package/dist/exports/private/collections/getChildNodes.mjs.map +1 -1
  13. package/dist/exports/private/flags/flags.cjs.map +1 -1
  14. package/dist/exports/private/flags/flags.js.map +1 -1
  15. package/dist/exports/private/flags/flags.mjs.map +1 -1
  16. package/dist/exports/private/form/useFormValidationState.cjs.map +1 -1
  17. package/dist/exports/private/form/useFormValidationState.js.map +1 -1
  18. package/dist/exports/private/form/useFormValidationState.mjs.map +1 -1
  19. package/dist/exports/private/grid/GridCollection.cjs.map +1 -1
  20. package/dist/exports/private/grid/GridCollection.js.map +1 -1
  21. package/dist/exports/private/grid/GridCollection.mjs.map +1 -1
  22. package/dist/exports/private/steplist/useStepListState.cjs.map +1 -1
  23. package/dist/exports/private/steplist/useStepListState.js.map +1 -1
  24. package/dist/exports/private/steplist/useStepListState.mjs.map +1 -1
  25. package/dist/exports/private/table/TableCollection.cjs.map +1 -1
  26. package/dist/exports/private/table/TableCollection.js.map +1 -1
  27. package/dist/exports/private/table/TableCollection.mjs.map +1 -1
  28. package/dist/exports/private/table/useTreeGridState.cjs.map +1 -1
  29. package/dist/exports/private/table/useTreeGridState.js.map +1 -1
  30. package/dist/exports/private/table/useTreeGridState.mjs.map +1 -1
  31. package/dist/exports/useAsyncList.cjs.map +1 -1
  32. package/dist/exports/useAsyncList.js.map +1 -1
  33. package/dist/exports/useAsyncList.mjs.map +1 -1
  34. package/dist/exports/useCalendarState.cjs.map +1 -1
  35. package/dist/exports/useCalendarState.js.map +1 -1
  36. package/dist/exports/useCalendarState.mjs.map +1 -1
  37. package/dist/exports/useColorAreaState.cjs.map +1 -1
  38. package/dist/exports/useColorAreaState.js.map +1 -1
  39. package/dist/exports/useColorAreaState.mjs.map +1 -1
  40. package/dist/exports/useColorFieldState.cjs.map +1 -1
  41. package/dist/exports/useColorFieldState.js.map +1 -1
  42. package/dist/exports/useColorFieldState.mjs.map +1 -1
  43. package/dist/exports/useColorPickerState.cjs.map +1 -1
  44. package/dist/exports/useColorPickerState.js.map +1 -1
  45. package/dist/exports/useColorPickerState.mjs.map +1 -1
  46. package/dist/exports/useColorSliderState.cjs.map +1 -1
  47. package/dist/exports/useColorSliderState.js.map +1 -1
  48. package/dist/exports/useColorSliderState.mjs.map +1 -1
  49. package/dist/exports/useColorWheelState.cjs.map +1 -1
  50. package/dist/exports/useColorWheelState.js.map +1 -1
  51. package/dist/exports/useColorWheelState.mjs.map +1 -1
  52. package/dist/exports/useComboBoxState.cjs +1 -1
  53. package/dist/exports/useComboBoxState.cjs.map +1 -1
  54. package/dist/exports/useComboBoxState.js +1 -1
  55. package/dist/exports/useComboBoxState.js.map +1 -1
  56. package/dist/exports/useComboBoxState.mjs +1 -1
  57. package/dist/exports/useComboBoxState.mjs.map +1 -1
  58. package/dist/exports/useDateFieldState.cjs.map +1 -1
  59. package/dist/exports/useDateFieldState.js.map +1 -1
  60. package/dist/exports/useDateFieldState.mjs.map +1 -1
  61. package/dist/exports/useDatePickerState.cjs.map +1 -1
  62. package/dist/exports/useDatePickerState.js.map +1 -1
  63. package/dist/exports/useDatePickerState.mjs.map +1 -1
  64. package/dist/exports/useDateRangePickerState.cjs.map +1 -1
  65. package/dist/exports/useDateRangePickerState.js.map +1 -1
  66. package/dist/exports/useDateRangePickerState.mjs.map +1 -1
  67. package/dist/exports/useDisclosureGroupState.cjs.map +1 -1
  68. package/dist/exports/useDisclosureGroupState.js.map +1 -1
  69. package/dist/exports/useDisclosureGroupState.mjs.map +1 -1
  70. package/dist/exports/useDraggableCollectionState.cjs.map +1 -1
  71. package/dist/exports/useDraggableCollectionState.js.map +1 -1
  72. package/dist/exports/useDraggableCollectionState.mjs.map +1 -1
  73. package/dist/exports/useDroppableCollectionState.cjs.map +1 -1
  74. package/dist/exports/useDroppableCollectionState.js.map +1 -1
  75. package/dist/exports/useDroppableCollectionState.mjs.map +1 -1
  76. package/dist/exports/useMenuTriggerState.cjs.map +1 -1
  77. package/dist/exports/useMenuTriggerState.js.map +1 -1
  78. package/dist/exports/useMenuTriggerState.mjs.map +1 -1
  79. package/dist/exports/useMultipleSelectionState.cjs.map +1 -1
  80. package/dist/exports/useMultipleSelectionState.js.map +1 -1
  81. package/dist/exports/useMultipleSelectionState.mjs.map +1 -1
  82. package/dist/exports/useOverlayTriggerState.cjs.map +1 -1
  83. package/dist/exports/useOverlayTriggerState.js.map +1 -1
  84. package/dist/exports/useOverlayTriggerState.mjs.map +1 -1
  85. package/dist/exports/useRangeCalendarState.cjs.map +1 -1
  86. package/dist/exports/useRangeCalendarState.js.map +1 -1
  87. package/dist/exports/useRangeCalendarState.mjs.map +1 -1
  88. package/dist/exports/useSelectState.cjs.map +1 -1
  89. package/dist/exports/useSelectState.js.map +1 -1
  90. package/dist/exports/useSelectState.mjs.map +1 -1
  91. package/dist/exports/useSingleSelectListState.cjs.map +1 -1
  92. package/dist/exports/useSingleSelectListState.js.map +1 -1
  93. package/dist/exports/useSingleSelectListState.mjs.map +1 -1
  94. package/dist/exports/useTableState.cjs.map +1 -1
  95. package/dist/exports/useTableState.js.map +1 -1
  96. package/dist/exports/useTableState.mjs.map +1 -1
  97. package/dist/exports/useTimeFieldState.cjs.map +1 -1
  98. package/dist/exports/useTimeFieldState.js.map +1 -1
  99. package/dist/exports/useTimeFieldState.mjs.map +1 -1
  100. package/dist/exports/useToastState.cjs.map +1 -1
  101. package/dist/exports/useToastState.js.map +1 -1
  102. package/dist/exports/useToastState.mjs.map +1 -1
  103. package/dist/private/autocomplete/useAutocompleteState.cjs.map +1 -1
  104. package/dist/private/autocomplete/useAutocompleteState.js.map +1 -1
  105. package/dist/private/autocomplete/useAutocompleteState.mjs.map +1 -1
  106. package/dist/private/calendar/useCalendarState.cjs +82 -30
  107. package/dist/private/calendar/useCalendarState.cjs.map +1 -1
  108. package/dist/private/calendar/useCalendarState.js +85 -32
  109. package/dist/private/calendar/useCalendarState.js.map +1 -1
  110. package/dist/private/calendar/useCalendarState.mjs +84 -32
  111. package/dist/private/calendar/useCalendarState.mjs.map +1 -1
  112. package/dist/private/calendar/useRangeCalendarState.cjs +53 -40
  113. package/dist/private/calendar/useRangeCalendarState.cjs.map +1 -1
  114. package/dist/private/calendar/useRangeCalendarState.js +55 -43
  115. package/dist/private/calendar/useRangeCalendarState.js.map +1 -1
  116. package/dist/private/calendar/useRangeCalendarState.mjs +55 -42
  117. package/dist/private/calendar/useRangeCalendarState.mjs.map +1 -1
  118. package/dist/private/calendar/utils.cjs +6 -1
  119. package/dist/private/calendar/utils.cjs.map +1 -1
  120. package/dist/private/calendar/utils.js +6 -2
  121. package/dist/private/calendar/utils.js.map +1 -1
  122. package/dist/private/calendar/utils.mjs +6 -2
  123. package/dist/private/calendar/utils.mjs.map +1 -1
  124. package/dist/private/checkbox/useCheckboxGroupState.cjs.map +1 -1
  125. package/dist/private/checkbox/useCheckboxGroupState.js.map +1 -1
  126. package/dist/private/checkbox/useCheckboxGroupState.mjs.map +1 -1
  127. package/dist/private/collections/CollectionBuilder.cjs.map +1 -1
  128. package/dist/private/collections/CollectionBuilder.js.map +1 -1
  129. package/dist/private/collections/CollectionBuilder.mjs.map +1 -1
  130. package/dist/private/collections/Item.cjs +1 -0
  131. package/dist/private/collections/Item.cjs.map +1 -1
  132. package/dist/private/collections/Item.js +1 -0
  133. package/dist/private/collections/Item.js.map +1 -1
  134. package/dist/private/collections/Item.mjs +1 -0
  135. package/dist/private/collections/Item.mjs.map +1 -1
  136. package/dist/private/collections/Section.cjs +1 -0
  137. package/dist/private/collections/Section.cjs.map +1 -1
  138. package/dist/private/collections/Section.js +1 -0
  139. package/dist/private/collections/Section.js.map +1 -1
  140. package/dist/private/collections/Section.mjs +1 -0
  141. package/dist/private/collections/Section.mjs.map +1 -1
  142. package/dist/private/collections/getChildNodes.cjs.map +1 -1
  143. package/dist/private/collections/getChildNodes.js.map +1 -1
  144. package/dist/private/collections/getChildNodes.mjs.map +1 -1
  145. package/dist/private/collections/useCollection.cjs.map +1 -1
  146. package/dist/private/collections/useCollection.js.map +1 -1
  147. package/dist/private/collections/useCollection.mjs.map +1 -1
  148. package/dist/private/color/Color.cjs +15 -9
  149. package/dist/private/color/Color.cjs.map +1 -1
  150. package/dist/private/color/Color.js +15 -9
  151. package/dist/private/color/Color.js.map +1 -1
  152. package/dist/private/color/Color.mjs +15 -9
  153. package/dist/private/color/Color.mjs.map +1 -1
  154. package/dist/private/color/useColorAreaState.cjs.map +1 -1
  155. package/dist/private/color/useColorAreaState.js.map +1 -1
  156. package/dist/private/color/useColorAreaState.mjs.map +1 -1
  157. package/dist/private/color/useColorChannelFieldState.cjs.map +1 -1
  158. package/dist/private/color/useColorChannelFieldState.js.map +1 -1
  159. package/dist/private/color/useColorChannelFieldState.mjs.map +1 -1
  160. package/dist/private/color/useColorFieldState.cjs.map +1 -1
  161. package/dist/private/color/useColorFieldState.js.map +1 -1
  162. package/dist/private/color/useColorFieldState.mjs.map +1 -1
  163. package/dist/private/color/useColorPickerState.cjs.map +1 -1
  164. package/dist/private/color/useColorPickerState.js.map +1 -1
  165. package/dist/private/color/useColorPickerState.mjs.map +1 -1
  166. package/dist/private/color/useColorSliderState.cjs +5 -3
  167. package/dist/private/color/useColorSliderState.cjs.map +1 -1
  168. package/dist/private/color/useColorSliderState.js +5 -3
  169. package/dist/private/color/useColorSliderState.js.map +1 -1
  170. package/dist/private/color/useColorSliderState.mjs +5 -3
  171. package/dist/private/color/useColorSliderState.mjs.map +1 -1
  172. package/dist/private/color/useColorWheelState.cjs.map +1 -1
  173. package/dist/private/color/useColorWheelState.js.map +1 -1
  174. package/dist/private/color/useColorWheelState.mjs.map +1 -1
  175. package/dist/private/combobox/useComboBoxState.cjs +8 -2
  176. package/dist/private/combobox/useComboBoxState.cjs.map +1 -1
  177. package/dist/private/combobox/useComboBoxState.js +8 -2
  178. package/dist/private/combobox/useComboBoxState.js.map +1 -1
  179. package/dist/private/combobox/useComboBoxState.mjs +8 -2
  180. package/dist/private/combobox/useComboBoxState.mjs.map +1 -1
  181. package/dist/private/data/useAsyncList.cjs.map +1 -1
  182. package/dist/private/data/useAsyncList.js.map +1 -1
  183. package/dist/private/data/useAsyncList.mjs.map +1 -1
  184. package/dist/private/data/useListData.cjs.map +1 -1
  185. package/dist/private/data/useListData.js.map +1 -1
  186. package/dist/private/data/useListData.mjs.map +1 -1
  187. package/dist/private/data/useTreeData.cjs.map +1 -1
  188. package/dist/private/data/useTreeData.js.map +1 -1
  189. package/dist/private/data/useTreeData.mjs.map +1 -1
  190. package/dist/private/datepicker/IncompleteDate.cjs +8 -2
  191. package/dist/private/datepicker/IncompleteDate.cjs.map +1 -1
  192. package/dist/private/datepicker/IncompleteDate.js +8 -2
  193. package/dist/private/datepicker/IncompleteDate.js.map +1 -1
  194. package/dist/private/datepicker/IncompleteDate.mjs +8 -2
  195. package/dist/private/datepicker/IncompleteDate.mjs.map +1 -1
  196. package/dist/private/datepicker/placeholders.cjs +5 -0
  197. package/dist/private/datepicker/placeholders.cjs.map +1 -1
  198. package/dist/private/datepicker/placeholders.js +5 -0
  199. package/dist/private/datepicker/placeholders.js.map +1 -1
  200. package/dist/private/datepicker/placeholders.mjs +5 -0
  201. package/dist/private/datepicker/placeholders.mjs.map +1 -1
  202. package/dist/private/datepicker/useDateFieldState.cjs.map +1 -1
  203. package/dist/private/datepicker/useDateFieldState.js.map +1 -1
  204. package/dist/private/datepicker/useDateFieldState.mjs.map +1 -1
  205. package/dist/private/datepicker/useDatePickerState.cjs.map +1 -1
  206. package/dist/private/datepicker/useDatePickerState.js.map +1 -1
  207. package/dist/private/datepicker/useDatePickerState.mjs.map +1 -1
  208. package/dist/private/datepicker/useDateRangePickerState.cjs +1 -1
  209. package/dist/private/datepicker/useDateRangePickerState.cjs.map +1 -1
  210. package/dist/private/datepicker/useDateRangePickerState.js +1 -1
  211. package/dist/private/datepicker/useDateRangePickerState.js.map +1 -1
  212. package/dist/private/datepicker/useDateRangePickerState.mjs +1 -1
  213. package/dist/private/datepicker/useDateRangePickerState.mjs.map +1 -1
  214. package/dist/private/datepicker/useTimeFieldState.cjs.map +1 -1
  215. package/dist/private/datepicker/useTimeFieldState.js.map +1 -1
  216. package/dist/private/datepicker/useTimeFieldState.mjs.map +1 -1
  217. package/dist/private/datepicker/utils.cjs +2 -2
  218. package/dist/private/datepicker/utils.cjs.map +1 -1
  219. package/dist/private/datepicker/utils.js +2 -2
  220. package/dist/private/datepicker/utils.js.map +1 -1
  221. package/dist/private/datepicker/utils.mjs +2 -2
  222. package/dist/private/datepicker/utils.mjs.map +1 -1
  223. package/dist/private/disclosure/useDisclosureGroupState.cjs.map +1 -1
  224. package/dist/private/disclosure/useDisclosureGroupState.js.map +1 -1
  225. package/dist/private/disclosure/useDisclosureGroupState.mjs.map +1 -1
  226. package/dist/private/disclosure/useDisclosureState.cjs.map +1 -1
  227. package/dist/private/disclosure/useDisclosureState.js.map +1 -1
  228. package/dist/private/disclosure/useDisclosureState.mjs.map +1 -1
  229. package/dist/private/dnd/useDraggableCollectionState.cjs.map +1 -1
  230. package/dist/private/dnd/useDraggableCollectionState.js.map +1 -1
  231. package/dist/private/dnd/useDraggableCollectionState.mjs.map +1 -1
  232. package/dist/private/dnd/useDroppableCollectionState.cjs.map +1 -1
  233. package/dist/private/dnd/useDroppableCollectionState.js.map +1 -1
  234. package/dist/private/dnd/useDroppableCollectionState.mjs.map +1 -1
  235. package/dist/private/form/useFormValidationState.cjs.map +1 -1
  236. package/dist/private/form/useFormValidationState.js.map +1 -1
  237. package/dist/private/form/useFormValidationState.mjs.map +1 -1
  238. package/dist/private/grid/GridCollection.cjs.map +1 -1
  239. package/dist/private/grid/GridCollection.js.map +1 -1
  240. package/dist/private/grid/GridCollection.mjs.map +1 -1
  241. package/dist/private/grid/useGridState.cjs.map +1 -1
  242. package/dist/private/grid/useGridState.js.map +1 -1
  243. package/dist/private/grid/useGridState.mjs.map +1 -1
  244. package/dist/private/layout/GridLayout.cjs +8 -3
  245. package/dist/private/layout/GridLayout.cjs.map +1 -1
  246. package/dist/private/layout/GridLayout.js +8 -3
  247. package/dist/private/layout/GridLayout.js.map +1 -1
  248. package/dist/private/layout/GridLayout.mjs +8 -3
  249. package/dist/private/layout/GridLayout.mjs.map +1 -1
  250. package/dist/private/layout/ListLayout.cjs +1 -1
  251. package/dist/private/layout/ListLayout.cjs.map +1 -1
  252. package/dist/private/layout/ListLayout.js +2 -1
  253. package/dist/private/layout/ListLayout.js.map +1 -1
  254. package/dist/private/layout/ListLayout.mjs +1 -1
  255. package/dist/private/layout/ListLayout.mjs.map +1 -1
  256. package/dist/private/layout/TableLayout.cjs +60 -35
  257. package/dist/private/layout/TableLayout.cjs.map +1 -1
  258. package/dist/private/layout/TableLayout.js +65 -38
  259. package/dist/private/layout/TableLayout.js.map +1 -1
  260. package/dist/private/layout/TableLayout.mjs +61 -36
  261. package/dist/private/layout/TableLayout.mjs.map +1 -1
  262. package/dist/private/layout/WaterfallLayout.cjs.map +1 -1
  263. package/dist/private/layout/WaterfallLayout.js.map +1 -1
  264. package/dist/private/layout/WaterfallLayout.mjs.map +1 -1
  265. package/dist/private/list/ListCollection.cjs.map +1 -1
  266. package/dist/private/list/ListCollection.js.map +1 -1
  267. package/dist/private/list/ListCollection.mjs.map +1 -1
  268. package/dist/private/list/useListState.cjs.map +1 -1
  269. package/dist/private/list/useListState.js.map +1 -1
  270. package/dist/private/list/useListState.mjs.map +1 -1
  271. package/dist/private/list/useSingleSelectListState.cjs.map +1 -1
  272. package/dist/private/list/useSingleSelectListState.js.map +1 -1
  273. package/dist/private/list/useSingleSelectListState.mjs.map +1 -1
  274. package/dist/private/menu/useMenuTriggerState.cjs.map +1 -1
  275. package/dist/private/menu/useMenuTriggerState.js.map +1 -1
  276. package/dist/private/menu/useMenuTriggerState.mjs.map +1 -1
  277. package/dist/private/menu/useSubmenuTriggerState.cjs.map +1 -1
  278. package/dist/private/menu/useSubmenuTriggerState.js.map +1 -1
  279. package/dist/private/menu/useSubmenuTriggerState.mjs.map +1 -1
  280. package/dist/private/numberfield/useNumberFieldState.cjs +13 -1
  281. package/dist/private/numberfield/useNumberFieldState.cjs.map +1 -1
  282. package/dist/private/numberfield/useNumberFieldState.js +13 -1
  283. package/dist/private/numberfield/useNumberFieldState.js.map +1 -1
  284. package/dist/private/numberfield/useNumberFieldState.mjs +13 -1
  285. package/dist/private/numberfield/useNumberFieldState.mjs.map +1 -1
  286. package/dist/private/overlays/useOverlayTriggerState.cjs.map +1 -1
  287. package/dist/private/overlays/useOverlayTriggerState.js.map +1 -1
  288. package/dist/private/overlays/useOverlayTriggerState.mjs.map +1 -1
  289. package/dist/private/radio/useRadioGroupState.cjs.map +1 -1
  290. package/dist/private/radio/useRadioGroupState.js.map +1 -1
  291. package/dist/private/radio/useRadioGroupState.mjs.map +1 -1
  292. package/dist/private/searchfield/useSearchFieldState.cjs.map +1 -1
  293. package/dist/private/searchfield/useSearchFieldState.js.map +1 -1
  294. package/dist/private/searchfield/useSearchFieldState.mjs.map +1 -1
  295. package/dist/private/select/useSelectState.cjs.map +1 -1
  296. package/dist/private/select/useSelectState.js.map +1 -1
  297. package/dist/private/select/useSelectState.mjs.map +1 -1
  298. package/dist/private/selection/SelectionManager.cjs +2 -1
  299. package/dist/private/selection/SelectionManager.cjs.map +1 -1
  300. package/dist/private/selection/SelectionManager.js +3 -2
  301. package/dist/private/selection/SelectionManager.js.map +1 -1
  302. package/dist/private/selection/SelectionManager.mjs +2 -1
  303. package/dist/private/selection/SelectionManager.mjs.map +1 -1
  304. package/dist/private/selection/useMultipleSelectionState.cjs.map +1 -1
  305. package/dist/private/selection/useMultipleSelectionState.js.map +1 -1
  306. package/dist/private/selection/useMultipleSelectionState.mjs.map +1 -1
  307. package/dist/private/slider/useSliderState.cjs +22 -2
  308. package/dist/private/slider/useSliderState.cjs.map +1 -1
  309. package/dist/private/slider/useSliderState.js +22 -2
  310. package/dist/private/slider/useSliderState.js.map +1 -1
  311. package/dist/private/slider/useSliderState.mjs +22 -2
  312. package/dist/private/slider/useSliderState.mjs.map +1 -1
  313. package/dist/private/steplist/useStepListState.cjs.map +1 -1
  314. package/dist/private/steplist/useStepListState.js.map +1 -1
  315. package/dist/private/steplist/useStepListState.mjs.map +1 -1
  316. package/dist/private/table/Cell.cjs +2 -1
  317. package/dist/private/table/Cell.cjs.map +1 -1
  318. package/dist/private/table/Cell.js +2 -1
  319. package/dist/private/table/Cell.js.map +1 -1
  320. package/dist/private/table/Cell.mjs +2 -1
  321. package/dist/private/table/Cell.mjs.map +1 -1
  322. package/dist/private/table/Column.cjs +1 -0
  323. package/dist/private/table/Column.cjs.map +1 -1
  324. package/dist/private/table/Column.js +1 -0
  325. package/dist/private/table/Column.js.map +1 -1
  326. package/dist/private/table/Column.mjs +1 -0
  327. package/dist/private/table/Column.mjs.map +1 -1
  328. package/dist/private/table/Row.cjs +2 -1
  329. package/dist/private/table/Row.cjs.map +1 -1
  330. package/dist/private/table/Row.js +2 -1
  331. package/dist/private/table/Row.js.map +1 -1
  332. package/dist/private/table/Row.mjs +2 -1
  333. package/dist/private/table/Row.mjs.map +1 -1
  334. package/dist/private/table/TableBody.cjs +4 -2
  335. package/dist/private/table/TableBody.cjs.map +1 -1
  336. package/dist/private/table/TableBody.js +4 -2
  337. package/dist/private/table/TableBody.js.map +1 -1
  338. package/dist/private/table/TableBody.mjs +4 -2
  339. package/dist/private/table/TableBody.mjs.map +1 -1
  340. package/dist/private/table/TableCollection.cjs +1 -1
  341. package/dist/private/table/TableCollection.cjs.map +1 -1
  342. package/dist/private/table/TableCollection.js +1 -1
  343. package/dist/private/table/TableCollection.js.map +1 -1
  344. package/dist/private/table/TableCollection.mjs +1 -1
  345. package/dist/private/table/TableCollection.mjs.map +1 -1
  346. package/dist/private/table/TableColumnLayout.cjs +4 -1
  347. package/dist/private/table/TableColumnLayout.cjs.map +1 -1
  348. package/dist/private/table/TableColumnLayout.js +4 -1
  349. package/dist/private/table/TableColumnLayout.js.map +1 -1
  350. package/dist/private/table/TableColumnLayout.mjs +4 -1
  351. package/dist/private/table/TableColumnLayout.mjs.map +1 -1
  352. package/dist/private/table/TableHeader.cjs +4 -2
  353. package/dist/private/table/TableHeader.cjs.map +1 -1
  354. package/dist/private/table/TableHeader.js +4 -2
  355. package/dist/private/table/TableHeader.js.map +1 -1
  356. package/dist/private/table/TableHeader.mjs +4 -2
  357. package/dist/private/table/TableHeader.mjs.map +1 -1
  358. package/dist/private/table/TableUtils.cjs +1 -1
  359. package/dist/private/table/TableUtils.cjs.map +1 -1
  360. package/dist/private/table/TableUtils.js +1 -1
  361. package/dist/private/table/TableUtils.js.map +1 -1
  362. package/dist/private/table/TableUtils.mjs +1 -1
  363. package/dist/private/table/TableUtils.mjs.map +1 -1
  364. package/dist/private/table/useTableColumnResizeState.cjs.map +1 -1
  365. package/dist/private/table/useTableColumnResizeState.js.map +1 -1
  366. package/dist/private/table/useTableColumnResizeState.mjs.map +1 -1
  367. package/dist/private/table/useTableState.cjs +2 -1
  368. package/dist/private/table/useTableState.cjs.map +1 -1
  369. package/dist/private/table/useTableState.js +2 -1
  370. package/dist/private/table/useTableState.js.map +1 -1
  371. package/dist/private/table/useTableState.mjs +2 -1
  372. package/dist/private/table/useTableState.mjs.map +1 -1
  373. package/dist/private/table/useTreeGridState.cjs +2 -1
  374. package/dist/private/table/useTreeGridState.cjs.map +1 -1
  375. package/dist/private/table/useTreeGridState.js +2 -1
  376. package/dist/private/table/useTreeGridState.js.map +1 -1
  377. package/dist/private/table/useTreeGridState.mjs +2 -1
  378. package/dist/private/table/useTreeGridState.mjs.map +1 -1
  379. package/dist/private/tabs/useTabListState.cjs.map +1 -1
  380. package/dist/private/tabs/useTabListState.js.map +1 -1
  381. package/dist/private/tabs/useTabListState.mjs.map +1 -1
  382. package/dist/private/toast/useToastState.cjs.map +1 -1
  383. package/dist/private/toast/useToastState.js.map +1 -1
  384. package/dist/private/toast/useToastState.mjs.map +1 -1
  385. package/dist/private/toggle/useToggleGroupState.cjs.map +1 -1
  386. package/dist/private/toggle/useToggleGroupState.js.map +1 -1
  387. package/dist/private/toggle/useToggleGroupState.mjs.map +1 -1
  388. package/dist/private/toggle/useToggleState.cjs.map +1 -1
  389. package/dist/private/toggle/useToggleState.js.map +1 -1
  390. package/dist/private/toggle/useToggleState.mjs.map +1 -1
  391. package/dist/private/tooltip/useTooltipTriggerState.cjs.map +1 -1
  392. package/dist/private/tooltip/useTooltipTriggerState.js.map +1 -1
  393. package/dist/private/tooltip/useTooltipTriggerState.mjs.map +1 -1
  394. package/dist/private/tree/TreeCollection.cjs.map +1 -1
  395. package/dist/private/tree/TreeCollection.js.map +1 -1
  396. package/dist/private/tree/TreeCollection.mjs.map +1 -1
  397. package/dist/private/tree/useTreeState.cjs.map +1 -1
  398. package/dist/private/tree/useTreeState.js.map +1 -1
  399. package/dist/private/tree/useTreeState.mjs.map +1 -1
  400. package/dist/private/utils/number.cjs +2 -1
  401. package/dist/private/utils/number.cjs.map +1 -1
  402. package/dist/private/utils/number.js +2 -1
  403. package/dist/private/utils/number.js.map +1 -1
  404. package/dist/private/utils/number.mjs +2 -1
  405. package/dist/private/utils/number.mjs.map +1 -1
  406. package/dist/private/utils/useControlledState.cjs.map +1 -1
  407. package/dist/private/utils/useControlledState.js.map +1 -1
  408. package/dist/private/utils/useControlledState.mjs.map +1 -1
  409. package/dist/private/virtualizer/Layout.cjs.map +1 -1
  410. package/dist/private/virtualizer/Layout.js.map +1 -1
  411. package/dist/private/virtualizer/Layout.mjs.map +1 -1
  412. package/dist/private/virtualizer/LayoutInfo.cjs +4 -2
  413. package/dist/private/virtualizer/LayoutInfo.cjs.map +1 -1
  414. package/dist/private/virtualizer/LayoutInfo.js +4 -2
  415. package/dist/private/virtualizer/LayoutInfo.js.map +1 -1
  416. package/dist/private/virtualizer/LayoutInfo.mjs +4 -2
  417. package/dist/private/virtualizer/LayoutInfo.mjs.map +1 -1
  418. package/dist/private/virtualizer/Rect.cjs +4 -0
  419. package/dist/private/virtualizer/Rect.cjs.map +1 -1
  420. package/dist/private/virtualizer/Rect.js +4 -0
  421. package/dist/private/virtualizer/Rect.js.map +1 -1
  422. package/dist/private/virtualizer/Rect.mjs +4 -0
  423. package/dist/private/virtualizer/Rect.mjs.map +1 -1
  424. package/dist/private/virtualizer/ReusableView.cjs.map +1 -1
  425. package/dist/private/virtualizer/ReusableView.js.map +1 -1
  426. package/dist/private/virtualizer/ReusableView.mjs.map +1 -1
  427. package/dist/private/virtualizer/Size.cjs.map +1 -1
  428. package/dist/private/virtualizer/Size.js.map +1 -1
  429. package/dist/private/virtualizer/Size.mjs.map +1 -1
  430. package/dist/private/virtualizer/Virtualizer.cjs +4 -4
  431. package/dist/private/virtualizer/Virtualizer.cjs.map +1 -1
  432. package/dist/private/virtualizer/Virtualizer.js +4 -4
  433. package/dist/private/virtualizer/Virtualizer.js.map +1 -1
  434. package/dist/private/virtualizer/Virtualizer.mjs +4 -4
  435. package/dist/private/virtualizer/Virtualizer.mjs.map +1 -1
  436. package/dist/private/virtualizer/useVirtualizerState.cjs.map +1 -1
  437. package/dist/private/virtualizer/useVirtualizerState.js.map +1 -1
  438. package/dist/private/virtualizer/useVirtualizerState.mjs.map +1 -1
  439. package/dist/types/exports/useCalendarState.d.ts +1 -1
  440. package/dist/types/src/autocomplete/useAutocompleteState.d.ts +4 -1
  441. package/dist/types/src/calendar/types.d.ts +50 -14
  442. package/dist/types/src/calendar/useCalendarState.d.ts +20 -6
  443. package/dist/types/src/calendar/useRangeCalendarState.d.ts +14 -5
  444. package/dist/types/src/calendar/utils.d.ts +1 -0
  445. package/dist/types/src/checkbox/useCheckboxGroupState.d.ts +1 -0
  446. package/dist/types/src/collections/useCollection.d.ts +1 -1
  447. package/dist/types/src/color/useColorAreaState.d.ts +21 -8
  448. package/dist/types/src/color/useColorFieldState.d.ts +2 -3
  449. package/dist/types/src/color/useColorSliderState.d.ts +4 -1
  450. package/dist/types/src/color/useColorWheelState.d.ts +5 -1
  451. package/dist/types/src/combobox/useComboBoxState.d.ts +19 -6
  452. package/dist/types/src/data/useAsyncList.d.ts +2 -2
  453. package/dist/types/src/data/useListData.d.ts +13 -1
  454. package/dist/types/src/data/useTreeData.d.ts +11 -0
  455. package/dist/types/src/datepicker/IncompleteDate.d.ts +11 -5
  456. package/dist/types/src/datepicker/types.d.ts +37 -11
  457. package/dist/types/src/datepicker/useDateFieldState.d.ts +13 -4
  458. package/dist/types/src/datepicker/useDatePickerState.d.ts +10 -4
  459. package/dist/types/src/datepicker/useDateRangePickerState.d.ts +12 -3
  460. package/dist/types/src/dnd/useDraggableCollectionState.d.ts +4 -1
  461. package/dist/types/src/form/useFormValidationState.d.ts +4 -1
  462. package/dist/types/src/grid/GridCollection.d.ts +2 -1
  463. package/dist/types/src/grid/useGridState.d.ts +7 -3
  464. package/dist/types/src/layout/GridLayout.d.ts +18 -2
  465. package/dist/types/src/layout/ListLayout.d.ts +34 -12
  466. package/dist/types/src/layout/TableLayout.d.ts +11 -4
  467. package/dist/types/src/layout/WaterfallLayout.d.ts +9 -2
  468. package/dist/types/src/list/useListState.d.ts +2 -2
  469. package/dist/types/src/menu/useMenuTriggerState.d.ts +3 -1
  470. package/dist/types/src/menu/useSubmenuTriggerState.d.ts +2 -2
  471. package/dist/types/src/numberfield/useNumberFieldState.d.ts +15 -11
  472. package/dist/types/src/radio/useRadioGroupState.d.ts +4 -1
  473. package/dist/types/src/select/useSelectState.d.ts +13 -2
  474. package/dist/types/src/selection/types.d.ts +4 -1
  475. package/dist/types/src/selection/useMultipleSelectionState.d.ts +2 -0
  476. package/dist/types/src/slider/useSliderState.d.ts +22 -2
  477. package/dist/types/src/table/Column.d.ts +4 -1
  478. package/dist/types/src/table/Row.d.ts +5 -3
  479. package/dist/types/src/table/TableBody.d.ts +3 -2
  480. package/dist/types/src/table/TableCollection.d.ts +4 -1
  481. package/dist/types/src/table/TableColumnLayout.d.ts +4 -1
  482. package/dist/types/src/table/TableHeader.d.ts +7 -3
  483. package/dist/types/src/table/TableUtils.d.ts +19 -16
  484. package/dist/types/src/table/useTableColumnResizeState.d.ts +5 -3
  485. package/dist/types/src/table/useTableState.d.ts +15 -6
  486. package/dist/types/src/table/useTreeGridState.d.ts +3 -2
  487. package/dist/types/src/toggle/useToggleGroupState.d.ts +1 -0
  488. package/dist/types/src/toggle/useToggleState.d.ts +2 -1
  489. package/dist/types/src/tooltip/useTooltipTriggerState.d.ts +8 -2
  490. package/dist/types/src/tree/useTreeState.d.ts +1 -1
  491. package/dist/types/src/utils/number.d.ts +2 -1
  492. package/dist/types/src/virtualizer/Layout.d.ts +5 -2
  493. package/dist/types/src/virtualizer/LayoutInfo.d.ts +10 -3
  494. package/dist/types/src/virtualizer/Rect.d.ts +4 -0
  495. package/dist/types/src/virtualizer/Virtualizer.d.ts +5 -4
  496. package/package.json +8 -7
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAyFD,MAAM,uCAAiB;AAOhB,MAAM,kDAAuE,CAAA,GAAA,wCAAK;IAoBvF;;;GAGC,GACD,YAAY,UAA6B,CAAC,CAAC,CAAE;QAC3C,KAAK;QACL,IAAI,CAAC,OAAO,GAAG,SAAS,WAAW,SAAS,aAAa;QACzD,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI;QAC1C,IAAI,CAAC,gBAAgB,GAAG,SAAS,oBAAoB,SAAS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,IAAI,CAAC;IAGhB,OAAO;AACT","sources":["packages/react-stately/src/layout/ListLayout.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, DropTarget, DropTargetDelegate, ItemDropTarget, Key, Node, Orientation} from '@react-types/shared';\nimport {getChildNodes} from '../collections/getChildNodes';\nimport {InvalidationContext} from '../virtualizer/types';\nimport {Layout} from '../virtualizer/Layout';\nimport {LayoutInfo} from '../virtualizer/LayoutInfo';\nimport {Rect} from '../virtualizer/Rect';\nimport {Size} from '../virtualizer/Size';\n\nexport interface ListLayoutOptions {\n /**\n * The primary orientation of the items. Usually this is the direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The fixed size of a row in px with respect to the applied orientation.\n * @default 48\n */\n rowSize?: number,\n /** The estimated size of a row in px with respect to the applied orientation, when row sizes are variable. */\n estimatedRowSize?: number,\n /**\n * The fixed size of a section header in px with respect to the applied orientation.\n * @default 48\n */\n headingSize?: number,\n /** The estimated size of a section header in px with respect to the applied orientation, when heading sizes are variable. */\n estimatedHeadingSize?: number,\n /**\n * The fixed size of a loader element in px with respect to the applied orientation. This loader is specifically for\n * \"load more\" elements rendered when loading more rows at the root level or inside nested row/sections.\n * @default 48\n */\n loaderSize?: number,\n /**\n * The thickness of the drop indicator.\n * @default 2\n */\n dropIndicatorThickness?: number,\n /**\n * The gap between items.\n * @default 0\n */\n gap?: number,\n /**\n * The padding around the list.\n * @default 0\n */\n padding?: number,\n /**\n * The fixed height of a row in px.\n * @default 48\n * @deprecated Use `rowSize` instead.\n */\n rowHeight?: number,\n /** The estimated height of a row, when row heights are variable.\n * @deprecated Use `estimatedRowSize` instead.\n */\n estimatedRowHeight?: number,\n /**\n * The fixed height of a section header in px.\n * @default 48\n * @deprecated Use `headingSize` instead.\n */\n headingHeight?: number,\n /** The estimated height of a section header, when the height is variable.\n * @deprecated Use `estimatedHeadingSize` instead.\n */\n estimatedHeadingHeight?: number,\n /**\n * The fixed height of a loader element in px. This loader is specifically for\n * \"load more\" elements rendered when loading more rows at the root level or inside nested row/sections.\n * @default 48\n * @deprecated Use `loaderSize` instead.\n */\n loaderHeight?: number\n}\n\n// A wrapper around LayoutInfo that supports hierarchy\nexport interface LayoutNode {\n node?: Node<unknown>,\n layoutInfo: LayoutInfo,\n children?: LayoutNode[],\n validRect: Rect,\n index?: number\n}\n\nconst DEFAULT_HEIGHT = 48;\n\n/**\n * ListLayout is a virtualizer Layout implementation\n * that arranges its items in a stack along its applied orientation.\n * It supports both fixed and variable size items.\n */\nexport class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> extends Layout<Node<T>, O> implements DropTargetDelegate {\n protected rowSize: number | null;\n protected orientation: Orientation;\n protected estimatedRowSize: number | null;\n protected headingSize: number | null;\n protected estimatedHeadingSize: number | null;\n protected loaderSize: number | null;\n protected dropIndicatorThickness: number;\n protected gap: number;\n protected padding: number;\n protected layoutNodes: Map<Key, LayoutNode>;\n protected contentSize: Size;\n protected lastCollection: Collection<Node<T>> | null;\n protected rootNodes: LayoutNode[];\n private invalidateEverything: boolean;\n /** The rectangle containing currently valid layout infos. */\n protected validRect: Rect;\n /** The rectangle of requested layout infos so far. */\n protected requestedRect: Rect;\n\n /**\n * Creates a new ListLayout with options. See the list of properties below for a description\n * of the options that can be provided.\n */\n constructor(options: ListLayoutOptions = {}) {\n super();\n this.rowSize = options?.rowSize ?? options?.rowHeight ?? null;\n this.orientation = options.orientation ?? 'vertical';\n this.estimatedRowSize = options?.estimatedRowSize ?? options?.estimatedRowHeight ?? null;\n this.headingSize = options?.headingSize ?? options?.headingHeight ?? null;\n this.estimatedHeadingSize = options?.estimatedHeadingSize ?? options?.estimatedHeadingHeight ?? null;\n this.loaderSize = options?.loaderSize ?? options?.loaderHeight ?? null;\n this.dropIndicatorThickness = options.dropIndicatorThickness || 2;\n this.gap = options.gap || 0;\n this.padding = options.padding || 0;\n this.layoutNodes = new Map();\n this.rootNodes = [];\n this.lastCollection = null;\n this.invalidateEverything = false;\n this.validRect = new Rect();\n this.requestedRect = new Rect();\n this.contentSize = new Size();\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): Collection<Node<T>> {\n return this.virtualizer!.collection;\n }\n\n /** @deprecated Use `rowSize` instead. */\n protected get rowHeight(): number | null {\n return this.rowSize;\n }\n\n /** @deprecated Use `estimatedRowSize` instead. */\n protected get estimatedRowHeight(): number | null {\n return this.estimatedRowSize;\n }\n\n /** @deprecated Use `headingSize` instead. */\n protected get headingHeight(): number | null {\n return this.headingSize;\n\n }\n /** @deprecated Use `estimatedHeadingSize` instead. */\n protected get estimatedHeadingHeight(): number | null {\n return this.estimatedHeadingSize;\n }\n\n /** @deprecated Use `loaderSize` instead. */\n protected get loaderHeight(): number | null {\n return this.loaderSize;\n }\n\n getLayoutInfo(key: Key): LayoutInfo | null {\n this.ensureLayoutInfo(key);\n return this.layoutNodes.get(key)?.layoutInfo || null;\n }\n\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n\n // Adjust rect to keep number of visible rows consistent.\n // (only if height > 1 or width > 1 for getDropTargetFromPoint)\n if (rect[heightProperty] > 1) {\n let rowHeight = (this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT) + this.gap;\n // Clone only before mutating\n rect = rect.copy();\n let offset = Math.floor(rect[offsetProperty] / rowHeight) * rowHeight;\n let height = rect[heightProperty] + rect[offsetProperty] - offset;\n rect[offsetProperty] = offset;\n rect[heightProperty] = Math.ceil(height / rowHeight) * rowHeight;\n }\n\n // If layout hasn't yet been done for the requested rect, union the\n // new rect with the existing valid rect, and recompute.\n this.layoutIfNeeded(rect);\n\n let res: LayoutInfo[] = [];\n\n let addNodes = (nodes: LayoutNode[]) => {\n for (let node of nodes) {\n if (this.isVisible(node, rect)) {\n res.push(node.layoutInfo);\n\n if (node.children) {\n addNodes(node.children);\n }\n }\n }\n };\n\n addNodes(this.rootNodes);\n return res;\n }\n\n protected layoutIfNeeded(rect: Rect): void {\n if (!this.lastCollection) {\n return;\n }\n\n if (!this.requestedRect.containsRect(rect)) {\n this.requestedRect = this.requestedRect.union(rect);\n this.rootNodes = this.buildCollection();\n }\n\n // Ensure all of the persisted keys are available.\n for (let key of this.virtualizer!.persistedKeys) {\n if (this.ensureLayoutInfo(key)) {\n return;\n }\n }\n }\n\n private ensureLayoutInfo(key: Key) {\n // If the layout info wasn't found, it might be outside the bounds of the area that we've\n // computed layout for so far. This can happen when accessing a random key, e.g pressing Home/End.\n // Compute the full layout and try again.\n if (!this.layoutNodes.has(key) && this.requestedRect.area < this.contentSize.area && this.lastCollection) {\n this.requestedRect = new Rect(0, 0, Infinity, Infinity);\n this.rootNodes = this.buildCollection();\n this.requestedRect = new Rect(0, 0, this.contentSize.width, this.contentSize.height);\n return true;\n }\n\n return false;\n }\n\n protected isVisible(node: LayoutNode, rect: Rect): boolean {\n return node.layoutInfo.rect.intersects(rect) || node.layoutInfo.isSticky || node.layoutInfo.type === 'header' || node.layoutInfo.type === 'loader' || this.virtualizer!.isPersistedKey(node.layoutInfo.key);\n }\n\n protected shouldInvalidateEverything(invalidationContext: InvalidationContext<O>): boolean {\n // Invalidate cache if the size of the collection changed.\n // In this case, we need to recalculate the entire layout.\n // Also invalidate if fixed sizes/gaps change.\n let options = invalidationContext.layoutOptions;\n return invalidationContext.sizeChanged\n || this.rowSize !== (options?.rowSize ?? options?.rowHeight ?? this.rowSize)\n || this.orientation !== (options?.orientation ?? this.orientation)\n || this.headingSize !== (options?.headingSize ?? options?.headingHeight ?? this.headingSize)\n || this.loaderSize !== (options?.loaderSize ?? options?.loaderHeight ?? this.loaderSize)\n || this.gap !== (options?.gap ?? this.gap)\n || this.padding !== (options?.padding ?? this.padding);\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return (newOptions?.rowSize ?? newOptions?.rowHeight) !== (oldOptions?.rowSize ?? oldOptions?.rowHeight)\n || newOptions.orientation !== oldOptions.orientation\n || (newOptions?.estimatedRowSize ?? newOptions?.estimatedRowHeight) !== (oldOptions?.estimatedRowSize ?? oldOptions?.estimatedRowHeight)\n || (newOptions?.headingSize ?? newOptions?.headingHeight) !== (oldOptions?.headingSize ?? oldOptions?.headingHeight)\n || (newOptions?.estimatedHeadingSize ?? newOptions?.estimatedHeadingHeight) !== (oldOptions?.estimatedHeadingSize ?? oldOptions?.estimatedHeadingHeight)\n || (newOptions?.loaderSize ?? newOptions?.loaderHeight) !== (oldOptions?.loaderSize ?? oldOptions?.loaderHeight)\n || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness\n || newOptions.gap !== oldOptions.gap\n || newOptions.padding !== oldOptions.padding;\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let collection = this.virtualizer!.collection;\n\n // Reset valid rect if we will have to invalidate everything.\n // Otherwise we can reuse cached layout infos outside the current visible rect.\n this.invalidateEverything = this.shouldInvalidateEverything(invalidationContext);\n if (this.invalidateEverything) {\n this.requestedRect = this.virtualizer!.visibleRect.copy();\n this.layoutNodes.clear();\n }\n\n let options = invalidationContext.layoutOptions;\n this.rowSize = options?.rowSize ?? options?.rowHeight ?? this.rowSize;\n this.orientation = options?.orientation ?? this.orientation;\n this.estimatedRowSize = options?.estimatedRowSize ?? options?.estimatedRowHeight ?? this.estimatedRowSize;\n this.headingSize = options?.headingSize ?? options?.headingHeight ?? this.headingSize;\n this.estimatedHeadingSize = options?.estimatedHeadingSize ?? options?.estimatedHeadingHeight ?? this.estimatedHeadingSize;\n this.loaderSize = options?.loaderSize ?? options?.loaderHeight ?? this.loaderSize;\n this.dropIndicatorThickness = options?.dropIndicatorThickness ?? this.dropIndicatorThickness;\n this.gap = options?.gap ?? this.gap;\n this.padding = options?.padding ?? this.padding;\n\n this.rootNodes = this.buildCollection();\n\n // Remove deleted layout nodes\n if (this.lastCollection && collection !== this.lastCollection) {\n for (let key of this.lastCollection.getKeys()) {\n if (!collection.getItem(key)) {\n let layoutNode = this.layoutNodes.get(key);\n if (layoutNode) {\n this.layoutNodes.delete(key);\n }\n }\n }\n }\n\n this.lastCollection = collection;\n this.invalidateEverything = false;\n this.validRect = this.requestedRect.copy();\n }\n\n protected buildCollection(offset: number = this.padding): LayoutNode[] {\n let collection = this.virtualizer!.collection;\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n let maxOffsetProperty = this.orientation === 'horizontal' ? 'maxX' : 'maxY';\n\n // filter out content nodes since we don't want them to affect the height\n // Tree specific for now, if we add content nodes to other collection items, we might need to reconsider this\n let collectionNodes = toArray(collection, (node) => node.type !== 'content');\n let loaderNodes = collectionNodes.filter(node => node.type === 'loader');\n let nodes: LayoutNode[] = [];\n let isEmptyOrLoading = collection?.size === 0;\n if (isEmptyOrLoading) {\n offset = 0;\n }\n\n for (let node of collectionNodes) {\n let rowHeight = (this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT) + this.gap;\n // Skip rows before the valid rectangle unless they are already cached.\n if (node.type === 'item' && offset + rowHeight < this.requestedRect[offsetProperty] && !this.isValid(node, offset)) {\n offset += rowHeight;\n continue;\n }\n\n let layoutNode = this.orientation === 'horizontal' ? this.buildChild(node, offset, this.padding, null) : this.buildChild(node, this.padding, offset, null);\n offset = layoutNode.layoutInfo.rect[maxOffsetProperty] + this.gap;\n nodes.push(layoutNode);\n if (node.type === 'loader') {\n let index = loaderNodes.indexOf(node);\n loaderNodes.splice(index, 1);\n }\n\n // Build each loader that exists in the collection that is outside the visible rect so that they are persisted\n // at the proper estimated location. If the node.type is \"section\" then we don't do this shortcut since we have to\n // build the sections to see how tall they are.\n if ((node.type === 'item' || node.type === 'loader') && offset > this.requestedRect[maxOffsetProperty]) {\n let lastProcessedIndex = collectionNodes.indexOf(node);\n for (let loaderNode of loaderNodes) {\n let loaderNodeIndex = collectionNodes.indexOf(loaderNode);\n // Subtract by an additional 1 since we've already added the current item's height to y\n offset += (loaderNodeIndex - lastProcessedIndex - 1) * rowHeight;\n let loader = this.orientation === 'horizontal' ? this.buildChild(loaderNode, offset, this.padding, null) : this.buildChild(loaderNode, this.padding, offset, null);\n nodes.push(loader);\n offset = loader.layoutInfo.rect[maxOffsetProperty];\n lastProcessedIndex = loaderNodeIndex;\n }\n\n // Account for the rest of the items after the last loader spinner, subtract by 1 since we've processed the current node's height already\n offset += (collectionNodes.length - lastProcessedIndex - 1) * rowHeight;\n break;\n }\n }\n\n offset = Math.max(offset - this.gap, 0);\n offset += isEmptyOrLoading ? 0 : this.padding;\n this.contentSize = this.orientation === 'horizontal' ? new Size(offset, this.virtualizer!.size.height) : new Size(this.virtualizer!.size.width, offset);\n return nodes;\n }\n\n protected isValid(node: Node<T>, offset: number): boolean {\n let cached = this.layoutNodes.get(node.key);\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n return (\n !this.invalidateEverything &&\n !!cached &&\n cached.node === node &&\n offset === cached.layoutInfo.rect[offsetProperty] &&\n cached.layoutInfo.rect.intersects(this.validRect) &&\n cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))\n );\n }\n\n protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {\n if (this.isValid(node, this.orientation === 'horizontal' ? x : y)) {\n return this.layoutNodes.get(node.key)!;\n }\n\n let layoutNode = this.buildNode(node, x, y);\n\n layoutNode.layoutInfo.parentKey = parentKey ?? null;\n layoutNode.layoutInfo.allowOverflow = true;\n this.layoutNodes.set(node.key, layoutNode);\n return layoutNode;\n }\n\n protected buildNode(node: Node<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'section':\n return this.buildSection(node, x, y);\n case 'item':\n return this.buildItem(node, x, y);\n case 'header':\n return this.buildSectionHeader(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n case 'separator':\n return this.buildItem(node, x, y);\n default:\n throw new Error('Unsupported node type: ' + node.type);\n }\n }\n\n protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, this.padding, 0);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n // Note that if the user provides isLoading to their sentinel during a case where they only want to render the emptyState, this will reserve\n // room for the loader alongside rendering the emptyState\n if (this.orientation === 'horizontal') {\n rect.height = this.virtualizer!.contentSize.height - this.padding - y;\n rect.width = node.props.isLoading ? this.loaderSize ?? this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT : 0;\n } else {\n rect.width = this.virtualizer!.contentSize.width - this.padding - x;\n rect.height = node.props.isLoading ? this.loaderSize ?? this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT : 0;\n }\n\n return {\n layoutInfo,\n validRect: rect.intersection(this.requestedRect)\n };\n }\n\n protected buildSection(node: Node<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection;\n let width = this.virtualizer!.size.width - this.padding - x;\n let height = this.virtualizer!.size.height - this.padding - y;\n let rect = this.orientation === 'horizontal' ? new Rect(x, y, 0, height) : new Rect(x, y, width, 0);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n let offset = this.orientation === 'horizontal' ? x : y;\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n let maxOffsetProperty = this.orientation === 'horizontal' ? 'maxX' : 'maxY';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n\n let skipped = 0;\n let children: LayoutNode[] = [];\n for (let child of getChildNodes(node, collection)) {\n // skip if it is a content node, Tree specific for now, if we add content nodes to other collection items, we might need to reconsider this\n if (child.type === 'content') {\n continue;\n }\n\n let rowHeight = (this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT) + this.gap;\n\n // Skip rows before the valid rectangle unless they are already cached.\n if (offset + rowHeight < this.requestedRect[offsetProperty] && !this.isValid(node, offset)) {\n offset += rowHeight;\n skipped++;\n continue;\n }\n\n let layoutNode = this.orientation === 'horizontal' ? this.buildChild(child, offset, y, layoutInfo.key) : this.buildChild(child, x, offset, layoutInfo.key);\n offset = layoutNode.layoutInfo.rect[maxOffsetProperty] + this.gap;\n children.push(layoutNode);\n\n if (offset > this.requestedRect[maxOffsetProperty]) {\n // Estimate the remaining height for rows that we don't need to layout right now.\n offset += ([...getChildNodes(node, collection)].length - (children.length + skipped)) * rowHeight;\n break;\n }\n }\n\n offset -= this.gap;\n rect[heightProperty] = offset - (this.orientation === 'horizontal' ? x : y);\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildSectionHeader(node: Node<T>, x: number, y: number): LayoutNode {\n let widthProperty = this.orientation === 'horizontal' ? 'height' : 'width';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n let width = this.virtualizer!.size[widthProperty] - this.padding - (this.orientation === 'horizontal' ? y : x);\n let rectHeight = this.headingSize;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n let previousLayoutInfo = previousLayoutNode?.layoutInfo;\n if (previousLayoutInfo) {\n let curNode = this.virtualizer!.collection.getItem(node.key);\n let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;\n rectHeight = previousLayoutNode!.layoutInfo.rect[heightProperty];\n isEstimated = width !== previousLayoutInfo.rect[widthProperty] || curNode !== lastNode || previousLayoutInfo.estimatedSize;\n } else {\n rectHeight = (node.rendered ? this.estimatedHeadingSize : 0);\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let headerRect = this.orientation === 'horizontal' ? new Rect(x, y, rectHeight, width - y) : new Rect(x, y, width - x, rectHeight);\n let header = new LayoutInfo('header', node.key, headerRect);\n header.estimatedSize = isEstimated;\n return {\n layoutInfo: header,\n children: [],\n validRect: header.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n let widthProperty = this.orientation === 'horizontal' ? 'height' : 'width';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n\n let width = this.virtualizer!.size[widthProperty] - this.padding - (this.orientation === 'horizontal' ? y : x);\n let rectHeight = this.rowSize;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n rectHeight = previousLayoutNode.layoutInfo.rect[heightProperty];\n isEstimated = width !== previousLayoutNode.layoutInfo.rect[widthProperty] || node !== previousLayoutNode.node || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n rectHeight = this.estimatedRowSize;\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let rect = this.orientation === 'horizontal' ? new Rect(x, y, rectHeight, width) : new Rect(x, y, width, rectHeight);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.estimatedSize = isEstimated;\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node\n };\n }\n\n updateItemSize(key: Key, size: Size): boolean {\n let layoutNode = this.layoutNodes.get(key);\n // If no layoutInfo, item has been deleted/removed.\n if (!layoutNode) {\n return false;\n }\n\n let collection = this.virtualizer!.collection;\n let layoutInfo = layoutNode.layoutInfo;\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n layoutInfo.estimatedSize = false;\n if (layoutInfo.rect[heightProperty] !== size[heightProperty]) {\n // Copy layout info rather than mutating so that later caches are invalidated.\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect[heightProperty] = size[heightProperty];\n layoutNode.layoutInfo = newLayoutInfo;\n\n // Items after this layoutInfo will need to be repositioned to account for the new height.\n // Adjust the validRect so that only items above remain valid.\n this.validRect[heightProperty] = Math.min(this.validRect[heightProperty], layoutInfo.rect[offsetProperty] - this.validRect[offsetProperty]);\n\n // The requestedRect also needs to be adjusted to account for the height difference.\n this.requestedRect[heightProperty] += newLayoutInfo.rect[heightProperty] - layoutInfo.rect[heightProperty];\n\n // Invalidate layout for this layout node and all parents\n this.updateLayoutNode(key, layoutInfo, newLayoutInfo);\n\n let node = layoutInfo.parentKey != null ? collection.getItem(layoutInfo.parentKey) : null;\n while (node) {\n this.updateLayoutNode(node.key, layoutInfo, newLayoutInfo);\n node = node.parentKey != null ? collection.getItem(node.parentKey) : null;\n }\n\n return true;\n }\n\n return false;\n }\n\n private updateLayoutNode(key: Key, oldLayoutInfo: LayoutInfo, newLayoutInfo: LayoutInfo) {\n let n = this.layoutNodes.get(key);\n if (n) {\n // Invalidate by intersecting the validRect of this node with the overall validRect.\n n.validRect = n.validRect.intersection(this.validRect);\n\n // Replace layout info in LayoutNode\n if (n.layoutInfo === oldLayoutInfo) {\n n.layoutInfo = newLayoutInfo;\n }\n }\n }\n\n getContentSize(): Size {\n return this.contentSize;\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null {\n x += this.virtualizer!.visibleRect.x;\n y += this.virtualizer!.visibleRect.y;\n\n // Find the closest item within on either side of the point using the gap width.\n let searchRect = new Rect(x, Math.max(0, y - this.gap), 1, Math.max(1, this.gap * 2));\n let candidates = this.getVisibleLayoutInfos(searchRect);\n let key: Key | null = null;\n let minDistance = Infinity;\n for (let candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (!candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n let yDist = Math.abs(candidate.rect.y - y);\n let maxYDist = Math.abs(candidate.rect.maxY - y);\n let dist = Math.min(yDist, maxYDist);\n if (dist < minDistance) {\n minDistance = dist;\n key = candidate.key;\n }\n }\n\n if (key == null || this.virtualizer!.collection.size === 0) {\n return {type: 'root'};\n }\n\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = layoutInfo.rect;\n let target: DropTarget = {\n type: 'item',\n key: layoutInfo.key,\n dropPosition: 'on'\n };\n\n // If dropping on the item isn't accepted, try the target before or after depending on the y position.\n // Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px\n // of the top or bottom of the item.\n if (!isValidDropTarget(target)) {\n if (y <= rect.y + rect.height / 2 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n } else if (y <= rect.y + 10 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (y >= rect.maxY - 10 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n\n return target;\n }\n\n getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n let layoutInfo = this.getLayoutInfo(target.key)!;\n let rect: Rect;\n if (target.dropPosition === 'before') {\n rect = this.orientation === 'horizontal' ?\n new Rect(Math.max(0, layoutInfo.rect.x - this.dropIndicatorThickness / 2), layoutInfo.rect.y, this.dropIndicatorThickness, layoutInfo.rect.height)\n : new Rect(layoutInfo.rect.x, Math.max(0, layoutInfo.rect.y - this.dropIndicatorThickness / 2), layoutInfo.rect.width, this.dropIndicatorThickness);\n } else if (target.dropPosition === 'after') {\n // Render after last visible descendant of the drop target.\n let targetNode = this.collection.getItem(target.key);\n if (targetNode) {\n let targetLevel = targetNode.level ?? 0;\n let currentKey = this.collection.getKeyAfter(target.key);\n\n while (currentKey != null) {\n let node = this.collection.getItem(currentKey);\n if (!node || node.level <= targetLevel) {\n break;\n }\n\n layoutInfo = this.getLayoutInfo(currentKey) || layoutInfo;\n currentKey = this.collection.getKeyAfter(currentKey);\n }\n }\n rect = this.orientation === 'horizontal' ?\n new Rect(layoutInfo.rect.maxX - this.dropIndicatorThickness / 2, layoutInfo.rect.y, this.dropIndicatorThickness, layoutInfo.rect.height)\n : new Rect(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);\n } else {\n rect = layoutInfo.rect;\n }\n\n return new LayoutInfo('dropIndicator', target.key + ':' + target.dropPosition, rect);\n }\n}\n\nfunction toArray<T>(collection: Collection<Node<T>>, predicate: (node: Node<T>) => boolean): Node<T>[] {\n const result: Node<T>[] = [];\n for (const node of collection) {\n if (predicate(node)) {\n result.push(node);\n }\n }\n return result;\n}\n"],"names":[],"version":3,"file":"ListLayout.mjs.map"}
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAuHD,MAAM,uCAAiB;AAOhB,MAAM,kDACH,CAAA,GAAA,wCAAK;IAsBb;;;GAGC,GACD,YAAY,UAA6B,CAAC,CAAC,CAAE;QAC3C,KAAK;QACL,IAAI,CAAC,OAAO,GAAG,SAAS,WAAW,SAAS,aAAa;QACzD,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI;QAC1C,IAAI,CAAC,gBAAgB,GAAG,SAAS,oBAAoB,SAAS,sBAAsB;QACpF,IAAI,CAAC,WAAW,GAAG,SAAS,eAAe,SAAS,iBAAiB;QACrE,IAAI,CAAC,oBAAoB,GACvB,SAAS,wBAAwB,SAAS,0BAA0B;QACtE,IAAI,CAAC,UAAU,GAAG,SAAS,cAAc,SAAS,gBAAgB;QAClE,IAAI,CAAC,sBAAsB,GAAG,QAAQ,sBAAsB,IAAI;QAChE,IAAI,CAAC,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KAAK,IAAI;gBACtC,IAAI,aAAa,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,GAAG;gBAEvD,MAAO,cAAc,KAAM;oBACzB,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;oBACnC,IAAI,CAAC,QAAQ,KAAK,KAAK,IAAI,aACzB;oBAGF,aAAa,IAAI,CAAC,aAAa,CAAC,eAAe;oBAC/C,aAAa,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;gBAC3C;YACF;YACA,OACE,IAAI,CAAC,WAAW,KAAK,eACjB,IAAI,CAAA,GAAA,yCAAG,EACL,WAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,sBAAsB,GAAG,GACrD,WAAW,IAAI,CAAC,CAAC,EACjB,IAAI,CAAC,sBAAsB,EAC3B,WAAW,IAAI,CAAC,MAAM,IAExB,IAAI,CAAA,GAAA,yCAAG,EACL,WAAW,IAAI,CAAC,CAAC,EACjB,WAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,sBAAsB,GAAG,GACrD,WAAW,IAAI,CAAC,KAAK,EACrB,IAAI,CAAC,sBAAsB;QAErC,OACE,OAAO,WAAW,IAAI;QAGxB,OAAO,IAAI,CAAA,GAAA,yCAAS,EAAE,iBAAiB,OAAO,GAAG,GAAG,MAAM,OAAO,YAAY,EAAE;IACjF;AACF;AAEA,SAAS,8BACP,UAA+B,EAC/B,SAAqC;IAErC,MAAM,SAAoB,EAAE;IAC5B,KAAK,MAAM,QAAQ,WACjB,IAAI,UAAU,OACZ,OAAO,IAAI,CAAC;IAGhB,OAAO;AACT","sources":["packages/react-stately/src/layout/ListLayout.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n Collection,\n DropTarget,\n DropTargetDelegate,\n ItemDropTarget,\n Key,\n Node,\n Orientation\n} from '@react-types/shared';\nimport {getChildNodes} from '../collections/getChildNodes';\nimport {InvalidationContext} from '../virtualizer/types';\nimport {Layout} from '../virtualizer/Layout';\nimport {LayoutInfo} from '../virtualizer/LayoutInfo';\nimport {Rect} from '../virtualizer/Rect';\nimport {Size} from '../virtualizer/Size';\n\nexport interface ListLayoutOptions {\n /**\n * The primary orientation of the items. Usually this is the direction that the collection\n * scrolls.\n *\n * @default 'vertical'\n */\n orientation?: Orientation;\n /**\n * The fixed size of a row in px with respect to the applied orientation.\n *\n * @default 48\n */\n rowSize?: number;\n /**\n * The estimated size of a row in px with respect to the applied orientation, when row sizes are\n * variable.\n */\n estimatedRowSize?: number;\n /**\n * The fixed size of a section header in px with respect to the applied orientation.\n *\n * @default 48\n */\n headingSize?: number;\n /**\n * The estimated size of a section header in px with respect to the applied orientation, when\n * heading sizes are variable.\n */\n estimatedHeadingSize?: number;\n /**\n * The fixed size of a loader element in px with respect to the applied orientation. This loader\n * is specifically for \"load more\" elements rendered when loading more rows at the root level or\n * inside nested row/sections.\n *\n * @default 48\n */\n loaderSize?: number;\n /**\n * The thickness of the drop indicator.\n *\n * @default 2\n */\n dropIndicatorThickness?: number;\n /**\n * The gap between items.\n *\n * @default 0\n */\n gap?: number;\n /**\n * The padding around the list.\n *\n * @default 0\n */\n padding?: number;\n /**\n * The fixed height of a row in px.\n *\n * @deprecated Use `rowSize` instead.\n * @default 48\n */\n rowHeight?: number;\n /**\n * The estimated height of a row, when row heights are variable.\n *\n * @deprecated Use `estimatedRowSize` instead.\n */\n estimatedRowHeight?: number;\n /**\n * The fixed height of a section header in px.\n *\n * @deprecated Use `headingSize` instead.\n * @default 48\n */\n headingHeight?: number;\n /**\n * The estimated height of a section header, when the height is variable.\n *\n * @deprecated Use `estimatedHeadingSize` instead.\n */\n estimatedHeadingHeight?: number;\n /**\n * The fixed height of a loader element in px. This loader is specifically for \"load more\"\n * elements rendered when loading more rows at the root level or inside nested row/sections.\n *\n * @deprecated Use `loaderSize` instead.\n * @default 48\n */\n loaderHeight?: number;\n}\n\n// A wrapper around LayoutInfo that supports hierarchy\nexport interface LayoutNode {\n node?: Node<unknown>;\n layoutInfo: LayoutInfo;\n children?: LayoutNode[];\n validRect: Rect;\n index?: number;\n}\n\nconst DEFAULT_HEIGHT = 48;\n\n/**\n * ListLayout is a virtualizer Layout implementation\n * that arranges its items in a stack along its applied orientation.\n * It supports both fixed and variable size items.\n */\nexport class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions>\n extends Layout<Node<T>, O>\n implements DropTargetDelegate\n{\n protected rowSize: number | null;\n protected orientation: Orientation;\n protected estimatedRowSize: number | null;\n protected headingSize: number | null;\n protected estimatedHeadingSize: number | null;\n protected loaderSize: number | null;\n protected dropIndicatorThickness: number;\n protected gap: number;\n protected padding: number;\n protected layoutNodes: Map<Key, LayoutNode>;\n protected contentSize: Size;\n protected lastCollection: Collection<Node<T>> | null;\n protected rootNodes: LayoutNode[];\n private invalidateEverything: boolean;\n /** The rectangle containing currently valid layout infos. */\n protected validRect: Rect;\n /** The rectangle of requested layout infos so far. */\n protected requestedRect: Rect;\n\n /**\n * Creates a new ListLayout with options. See the list of properties below for a description\n * of the options that can be provided.\n */\n constructor(options: ListLayoutOptions = {}) {\n super();\n this.rowSize = options?.rowSize ?? options?.rowHeight ?? null;\n this.orientation = options.orientation ?? 'vertical';\n this.estimatedRowSize = options?.estimatedRowSize ?? options?.estimatedRowHeight ?? null;\n this.headingSize = options?.headingSize ?? options?.headingHeight ?? null;\n this.estimatedHeadingSize =\n options?.estimatedHeadingSize ?? options?.estimatedHeadingHeight ?? null;\n this.loaderSize = options?.loaderSize ?? options?.loaderHeight ?? null;\n this.dropIndicatorThickness = options.dropIndicatorThickness || 2;\n this.gap = options.gap || 0;\n this.padding = options.padding || 0;\n this.layoutNodes = new Map();\n this.rootNodes = [];\n this.lastCollection = null;\n this.invalidateEverything = false;\n this.validRect = new Rect();\n this.requestedRect = new Rect();\n this.contentSize = new Size();\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): Collection<Node<T>> {\n return this.virtualizer!.collection;\n }\n\n /** @deprecated Use `rowSize` instead. */\n protected get rowHeight(): number | null {\n return this.rowSize;\n }\n\n /** @deprecated Use `estimatedRowSize` instead. */\n protected get estimatedRowHeight(): number | null {\n return this.estimatedRowSize;\n }\n\n /** @deprecated Use `headingSize` instead. */\n protected get headingHeight(): number | null {\n return this.headingSize;\n }\n /** @deprecated Use `estimatedHeadingSize` instead. */\n protected get estimatedHeadingHeight(): number | null {\n return this.estimatedHeadingSize;\n }\n\n /** @deprecated Use `loaderSize` instead. */\n protected get loaderHeight(): number | null {\n return this.loaderSize;\n }\n\n getLayoutInfo(key: Key): LayoutInfo | null {\n this.ensureLayoutInfo(key);\n return this.layoutNodes.get(key)?.layoutInfo || null;\n }\n\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n\n // Adjust rect to keep number of visible rows consistent.\n // (only if height > 1 or width > 1 for getDropTargetFromPoint)\n if (rect[heightProperty] > 1) {\n let rowHeight = (this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT) + this.gap;\n // Clone only before mutating\n rect = rect.copy();\n let offset = Math.floor(rect[offsetProperty] / rowHeight) * rowHeight;\n let height = rect[heightProperty] + rect[offsetProperty] - offset;\n rect[offsetProperty] = offset;\n rect[heightProperty] = Math.ceil(height / rowHeight) * rowHeight;\n }\n\n // If layout hasn't yet been done for the requested rect, union the\n // new rect with the existing valid rect, and recompute.\n this.layoutIfNeeded(rect);\n\n let res: LayoutInfo[] = [];\n\n let addNodes = (nodes: LayoutNode[]) => {\n for (let node of nodes) {\n if (this.isVisible(node, rect)) {\n res.push(node.layoutInfo);\n\n if (node.children) {\n addNodes(node.children);\n }\n }\n }\n };\n\n addNodes(this.rootNodes);\n return res;\n }\n\n protected layoutIfNeeded(rect: Rect): void {\n if (!this.lastCollection) {\n return;\n }\n\n if (!this.requestedRect.containsRect(rect)) {\n this.requestedRect = this.requestedRect.union(rect);\n this.rootNodes = this.buildCollection();\n }\n\n // Ensure all of the persisted keys are available.\n for (let key of this.virtualizer!.persistedKeys) {\n if (this.ensureLayoutInfo(key)) {\n return;\n }\n }\n }\n\n private ensureLayoutInfo(key: Key) {\n // If the layout info wasn't found, it might be outside the bounds of the area that we've\n // computed layout for so far. This can happen when accessing a random key, e.g pressing Home/End.\n // Compute the full layout and try again.\n if (\n !this.layoutNodes.has(key) &&\n this.requestedRect.area < this.contentSize.area &&\n this.lastCollection\n ) {\n this.requestedRect = new Rect(0, 0, Infinity, Infinity);\n this.rootNodes = this.buildCollection();\n this.requestedRect = new Rect(0, 0, this.contentSize.width, this.contentSize.height);\n return true;\n }\n\n return false;\n }\n\n protected isVisible(node: LayoutNode, rect: Rect): boolean {\n return (\n node.layoutInfo.rect.intersects(rect) ||\n node.layoutInfo.isSticky ||\n node.layoutInfo.type === 'header' ||\n node.layoutInfo.type === 'loader' ||\n this.virtualizer!.isPersistedKey(node.layoutInfo.key)\n );\n }\n\n protected shouldInvalidateEverything(invalidationContext: InvalidationContext<O>): boolean {\n // Invalidate cache if the size of the collection changed.\n // In this case, we need to recalculate the entire layout.\n // Also invalidate if fixed sizes/gaps change.\n let options = invalidationContext.layoutOptions;\n return (\n invalidationContext.sizeChanged ||\n this.rowSize !== (options?.rowSize ?? options?.rowHeight ?? this.rowSize) ||\n this.orientation !== (options?.orientation ?? this.orientation) ||\n this.headingSize !== (options?.headingSize ?? options?.headingHeight ?? this.headingSize) ||\n this.loaderSize !== (options?.loaderSize ?? options?.loaderHeight ?? this.loaderSize) ||\n this.gap !== (options?.gap ?? this.gap) ||\n this.padding !== (options?.padding ?? this.padding)\n );\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return (\n (newOptions?.rowSize ?? newOptions?.rowHeight) !==\n (oldOptions?.rowSize ?? oldOptions?.rowHeight) ||\n newOptions.orientation !== oldOptions.orientation ||\n (newOptions?.estimatedRowSize ?? newOptions?.estimatedRowHeight) !==\n (oldOptions?.estimatedRowSize ?? oldOptions?.estimatedRowHeight) ||\n (newOptions?.headingSize ?? newOptions?.headingHeight) !==\n (oldOptions?.headingSize ?? oldOptions?.headingHeight) ||\n (newOptions?.estimatedHeadingSize ?? newOptions?.estimatedHeadingHeight) !==\n (oldOptions?.estimatedHeadingSize ?? oldOptions?.estimatedHeadingHeight) ||\n (newOptions?.loaderSize ?? newOptions?.loaderHeight) !==\n (oldOptions?.loaderSize ?? oldOptions?.loaderHeight) ||\n newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness ||\n newOptions.gap !== oldOptions.gap ||\n newOptions.padding !== oldOptions.padding\n );\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let collection = this.virtualizer!.collection;\n\n // Reset valid rect if we will have to invalidate everything.\n // Otherwise we can reuse cached layout infos outside the current visible rect.\n this.invalidateEverything = this.shouldInvalidateEverything(invalidationContext);\n if (this.invalidateEverything) {\n this.requestedRect = this.virtualizer!.visibleRect.copy();\n this.layoutNodes.clear();\n }\n\n let options = invalidationContext.layoutOptions;\n this.rowSize = options?.rowSize ?? options?.rowHeight ?? this.rowSize;\n this.orientation = options?.orientation ?? this.orientation;\n this.estimatedRowSize =\n options?.estimatedRowSize ?? options?.estimatedRowHeight ?? this.estimatedRowSize;\n this.headingSize = options?.headingSize ?? options?.headingHeight ?? this.headingSize;\n this.estimatedHeadingSize =\n options?.estimatedHeadingSize ?? options?.estimatedHeadingHeight ?? this.estimatedHeadingSize;\n this.loaderSize = options?.loaderSize ?? options?.loaderHeight ?? this.loaderSize;\n this.dropIndicatorThickness = options?.dropIndicatorThickness ?? this.dropIndicatorThickness;\n this.gap = options?.gap ?? this.gap;\n this.padding = options?.padding ?? this.padding;\n\n this.rootNodes = this.buildCollection();\n\n // Remove deleted layout nodes\n if (this.lastCollection && collection !== this.lastCollection) {\n for (let key of this.lastCollection.getKeys()) {\n if (!collection.getItem(key)) {\n let layoutNode = this.layoutNodes.get(key);\n if (layoutNode) {\n this.layoutNodes.delete(key);\n }\n }\n }\n }\n\n this.lastCollection = collection;\n this.invalidateEverything = false;\n this.validRect = this.requestedRect.copy();\n }\n\n protected buildCollection(offset: number = this.padding): LayoutNode[] {\n let collection = this.virtualizer!.collection;\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n let maxOffsetProperty = this.orientation === 'horizontal' ? 'maxX' : 'maxY';\n\n // filter out content nodes since we don't want them to affect the height\n // Tree specific for now, if we add content nodes to other collection items, we might need to reconsider this\n let collectionNodes = toArray(collection, node => node.type !== 'content');\n let loaderNodes = collectionNodes.filter(node => node.type === 'loader');\n let nodes: LayoutNode[] = [];\n let isEmptyOrLoading = collection?.size === 0;\n if (isEmptyOrLoading) {\n offset = 0;\n }\n\n for (let node of collectionNodes) {\n let rowHeight = (this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT) + this.gap;\n // Skip rows before the valid rectangle unless they are already cached.\n if (\n node.type === 'item' &&\n offset + rowHeight < this.requestedRect[offsetProperty] &&\n !this.isValid(node, offset)\n ) {\n offset += rowHeight;\n continue;\n }\n\n let layoutNode =\n this.orientation === 'horizontal'\n ? this.buildChild(node, offset, this.padding, null)\n : this.buildChild(node, this.padding, offset, null);\n offset = layoutNode.layoutInfo.rect[maxOffsetProperty] + this.gap;\n nodes.push(layoutNode);\n if (node.type === 'loader') {\n let index = loaderNodes.indexOf(node);\n loaderNodes.splice(index, 1);\n }\n\n // Build each loader that exists in the collection that is outside the visible rect so that they are persisted\n // at the proper estimated location. If the node.type is \"section\" then we don't do this shortcut since we have to\n // build the sections to see how tall they are.\n if (\n (node.type === 'item' || node.type === 'loader') &&\n offset > this.requestedRect[maxOffsetProperty]\n ) {\n let lastProcessedIndex = collectionNodes.indexOf(node);\n for (let loaderNode of loaderNodes) {\n let loaderNodeIndex = collectionNodes.indexOf(loaderNode);\n // Subtract by an additional 1 since we've already added the current item's height to y\n offset += (loaderNodeIndex - lastProcessedIndex - 1) * rowHeight;\n let loader =\n this.orientation === 'horizontal'\n ? this.buildChild(loaderNode, offset, this.padding, null)\n : this.buildChild(loaderNode, this.padding, offset, null);\n nodes.push(loader);\n offset = loader.layoutInfo.rect[maxOffsetProperty];\n lastProcessedIndex = loaderNodeIndex;\n }\n\n // Account for the rest of the items after the last loader spinner, subtract by 1 since we've processed the current node's height already\n offset += (collectionNodes.length - lastProcessedIndex - 1) * rowHeight;\n break;\n }\n }\n\n offset = Math.max(offset - this.gap, 0);\n offset += isEmptyOrLoading ? 0 : this.padding;\n this.contentSize =\n this.orientation === 'horizontal'\n ? new Size(offset, this.virtualizer!.size.height)\n : new Size(this.virtualizer!.size.width, offset);\n return nodes;\n }\n\n protected isValid(node: Node<T>, offset: number): boolean {\n let cached = this.layoutNodes.get(node.key);\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n return (\n !this.invalidateEverything &&\n !!cached &&\n cached.node === node &&\n offset === cached.layoutInfo.rect[offsetProperty] &&\n cached.layoutInfo.rect.intersects(this.validRect) &&\n cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))\n );\n }\n\n protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {\n if (this.isValid(node, this.orientation === 'horizontal' ? x : y)) {\n return this.layoutNodes.get(node.key)!;\n }\n\n let layoutNode = this.buildNode(node, x, y);\n\n layoutNode.layoutInfo.parentKey = parentKey ?? null;\n layoutNode.layoutInfo.allowOverflow = true;\n this.layoutNodes.set(node.key, layoutNode);\n return layoutNode;\n }\n\n protected buildNode(node: Node<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'section':\n return this.buildSection(node, x, y);\n case 'item':\n return this.buildItem(node, x, y);\n case 'header':\n return this.buildSectionHeader(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n case 'separator':\n return this.buildItem(node, x, y);\n default:\n throw new Error('Unsupported node type: ' + node.type);\n }\n }\n\n protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, this.padding, 0);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n // Note that if the user provides isLoading to their sentinel during a case where they only want to render the emptyState, this will reserve\n // room for the loader alongside rendering the emptyState\n if (this.orientation === 'horizontal') {\n rect.height = this.virtualizer!.contentSize.height - this.padding - y;\n rect.width = node.props.isLoading\n ? (this.loaderSize ?? this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT)\n : 0;\n } else {\n rect.width = this.virtualizer!.contentSize.width - this.padding - x;\n rect.height = node.props.isLoading\n ? (this.loaderSize ?? this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT)\n : 0;\n }\n\n return {\n layoutInfo,\n validRect: rect.intersection(this.requestedRect)\n };\n }\n\n protected buildSection(node: Node<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection;\n let width = this.virtualizer!.size.width - this.padding - x;\n let height = this.virtualizer!.size.height - this.padding - y;\n let rect =\n this.orientation === 'horizontal' ? new Rect(x, y, 0, height) : new Rect(x, y, width, 0);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n let offset = this.orientation === 'horizontal' ? x : y;\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n let maxOffsetProperty = this.orientation === 'horizontal' ? 'maxX' : 'maxY';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n\n let skipped = 0;\n let children: LayoutNode[] = [];\n for (let child of getChildNodes(node, collection)) {\n // skip if it is a content node, Tree specific for now, if we add content nodes to other collection items, we might need to reconsider this\n if (child.type === 'content') {\n continue;\n }\n\n let rowHeight = (this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT) + this.gap;\n\n // Skip rows before the valid rectangle unless they are already cached.\n if (offset + rowHeight < this.requestedRect[offsetProperty] && !this.isValid(node, offset)) {\n offset += rowHeight;\n skipped++;\n continue;\n }\n\n let layoutNode =\n this.orientation === 'horizontal'\n ? this.buildChild(child, offset, y, layoutInfo.key)\n : this.buildChild(child, x, offset, layoutInfo.key);\n offset = layoutNode.layoutInfo.rect[maxOffsetProperty] + this.gap;\n children.push(layoutNode);\n\n if (offset > this.requestedRect[maxOffsetProperty]) {\n // Estimate the remaining height for rows that we don't need to layout right now.\n offset +=\n ([...getChildNodes(node, collection)].length - (children.length + skipped)) * rowHeight;\n break;\n }\n }\n\n offset -= this.gap;\n rect[heightProperty] = offset - (this.orientation === 'horizontal' ? x : y);\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildSectionHeader(node: Node<T>, x: number, y: number): LayoutNode {\n let widthProperty = this.orientation === 'horizontal' ? 'height' : 'width';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n let width =\n this.virtualizer!.size[widthProperty] -\n this.padding -\n (this.orientation === 'horizontal' ? y : x);\n let rectHeight = this.headingSize;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n let previousLayoutInfo = previousLayoutNode?.layoutInfo;\n if (previousLayoutInfo) {\n let curNode = this.virtualizer!.collection.getItem(node.key);\n let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;\n rectHeight = previousLayoutNode!.layoutInfo.rect[heightProperty];\n isEstimated =\n width !== previousLayoutInfo.rect[widthProperty] ||\n curNode !== lastNode ||\n previousLayoutInfo.estimatedSize;\n } else {\n rectHeight = node.rendered ? this.estimatedHeadingSize : 0;\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let headerRect =\n this.orientation === 'horizontal'\n ? new Rect(x, y, rectHeight, width - y)\n : new Rect(x, y, width - x, rectHeight);\n let header = new LayoutInfo('header', node.key, headerRect);\n header.estimatedSize = isEstimated;\n return {\n layoutInfo: header,\n children: [],\n validRect: header.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n let widthProperty = this.orientation === 'horizontal' ? 'height' : 'width';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n\n let width =\n this.virtualizer!.size[widthProperty] -\n this.padding -\n (this.orientation === 'horizontal' ? y : x);\n let rectHeight = this.rowSize;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n rectHeight = previousLayoutNode.layoutInfo.rect[heightProperty];\n isEstimated =\n width !== previousLayoutNode.layoutInfo.rect[widthProperty] ||\n node !== previousLayoutNode.node ||\n previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n rectHeight = this.estimatedRowSize;\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let rect =\n this.orientation === 'horizontal'\n ? new Rect(x, y, rectHeight, width)\n : new Rect(x, y, width, rectHeight);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.estimatedSize = isEstimated;\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node\n };\n }\n\n updateItemSize(key: Key, size: Size): boolean {\n let layoutNode = this.layoutNodes.get(key);\n // If no layoutInfo, item has been deleted/removed.\n if (!layoutNode) {\n return false;\n }\n\n let collection = this.virtualizer!.collection;\n let layoutInfo = layoutNode.layoutInfo;\n let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n layoutInfo.estimatedSize = false;\n if (layoutInfo.rect[heightProperty] !== size[heightProperty]) {\n // Copy layout info rather than mutating so that later caches are invalidated.\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect[heightProperty] = size[heightProperty];\n layoutNode.layoutInfo = newLayoutInfo;\n\n // Items after this layoutInfo will need to be repositioned to account for the new height.\n // Adjust the validRect so that only items above remain valid.\n this.validRect[heightProperty] = Math.min(\n this.validRect[heightProperty],\n layoutInfo.rect[offsetProperty] - this.validRect[offsetProperty]\n );\n\n // The requestedRect also needs to be adjusted to account for the height difference.\n if (layoutNode.node?.type === 'item') {\n this.requestedRect[heightProperty] +=\n newLayoutInfo.rect[heightProperty] - layoutInfo.rect[heightProperty];\n }\n\n // Invalidate layout for this layout node and all parents\n this.updateLayoutNode(key, layoutInfo, newLayoutInfo);\n\n let node = layoutInfo.parentKey != null ? collection.getItem(layoutInfo.parentKey) : null;\n while (node) {\n this.updateLayoutNode(node.key, layoutInfo, newLayoutInfo);\n node = node.parentKey != null ? collection.getItem(node.parentKey) : null;\n }\n\n return true;\n }\n\n return false;\n }\n\n private updateLayoutNode(key: Key, oldLayoutInfo: LayoutInfo, newLayoutInfo: LayoutInfo) {\n let n = this.layoutNodes.get(key);\n if (n) {\n // Invalidate by intersecting the validRect of this node with the overall validRect.\n n.validRect = n.validRect.intersection(this.validRect);\n\n // Replace layout info in LayoutNode\n if (n.layoutInfo === oldLayoutInfo) {\n n.layoutInfo = newLayoutInfo;\n }\n }\n }\n\n getContentSize(): Size {\n return this.contentSize;\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean\n ): DropTarget | null {\n x += this.virtualizer!.visibleRect.x;\n y += this.virtualizer!.visibleRect.y;\n\n // Find the closest item within on either side of the point using the gap width.\n let searchRect = new Rect(x, Math.max(0, y - this.gap), 1, Math.max(1, this.gap * 2));\n let candidates = this.getVisibleLayoutInfos(searchRect);\n let key: Key | null = null;\n let minDistance = Infinity;\n for (let candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (!candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n let yDist = Math.abs(candidate.rect.y - y);\n let maxYDist = Math.abs(candidate.rect.maxY - y);\n let dist = Math.min(yDist, maxYDist);\n if (dist < minDistance) {\n minDistance = dist;\n key = candidate.key;\n }\n }\n\n if (key == null || this.virtualizer!.collection.size === 0) {\n return {type: 'root'};\n }\n\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = layoutInfo.rect;\n let target: DropTarget = {\n type: 'item',\n key: layoutInfo.key,\n dropPosition: 'on'\n };\n\n // If dropping on the item isn't accepted, try the target before or after depending on the y position.\n // Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px\n // of the top or bottom of the item.\n if (!isValidDropTarget(target)) {\n if (y <= rect.y + rect.height / 2 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n } else if (y <= rect.y + 10 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (y >= rect.maxY - 10 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n\n return target;\n }\n\n getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n let layoutInfo = this.getLayoutInfo(target.key)!;\n let rect: Rect;\n if (target.dropPosition === 'before') {\n rect =\n this.orientation === 'horizontal'\n ? new Rect(\n Math.max(0, layoutInfo.rect.x - this.dropIndicatorThickness / 2),\n layoutInfo.rect.y,\n this.dropIndicatorThickness,\n layoutInfo.rect.height\n )\n : new Rect(\n layoutInfo.rect.x,\n Math.max(0, layoutInfo.rect.y - this.dropIndicatorThickness / 2),\n layoutInfo.rect.width,\n this.dropIndicatorThickness\n );\n } else if (target.dropPosition === 'after') {\n // Render after last visible descendant of the drop target.\n let targetNode = this.collection.getItem(target.key);\n if (targetNode) {\n let targetLevel = targetNode.level ?? 0;\n let currentKey = this.collection.getKeyAfter(target.key);\n\n while (currentKey != null) {\n let node = this.collection.getItem(currentKey);\n if (!node || node.level <= targetLevel) {\n break;\n }\n\n layoutInfo = this.getLayoutInfo(currentKey) || layoutInfo;\n currentKey = this.collection.getKeyAfter(currentKey);\n }\n }\n rect =\n this.orientation === 'horizontal'\n ? new Rect(\n layoutInfo.rect.maxX - this.dropIndicatorThickness / 2,\n layoutInfo.rect.y,\n this.dropIndicatorThickness,\n layoutInfo.rect.height\n )\n : new Rect(\n layoutInfo.rect.x,\n layoutInfo.rect.maxY - this.dropIndicatorThickness / 2,\n layoutInfo.rect.width,\n this.dropIndicatorThickness\n );\n } else {\n rect = layoutInfo.rect;\n }\n\n return new LayoutInfo('dropIndicator', target.key + ':' + target.dropPosition, rect);\n }\n}\n\nfunction toArray<T>(\n collection: Collection<Node<T>>,\n predicate: (node: Node<T>) => boolean\n): Node<T>[] {\n const result: Node<T>[] = [];\n for (const node of collection) {\n if (predicate(node)) {\n result.push(node);\n }\n }\n return result;\n}\n"],"names":[],"version":3,"file":"ListLayout.mjs.map"}
@@ -79,20 +79,51 @@ class $779e19dedce4578d$export$62444c3c724b1b20 extends (0, $d474db7fa4a60716$ex
79
79
  buildCollection() {
80
80
  this.stickyColumnIndices = [];
81
81
  let collection = this.virtualizer.collection;
82
- if (collection.head?.key === -1) return [];
83
82
  for (let column of collection.columns)// The selection cell and any other sticky columns always need to be visible.
84
83
  // In addition, row headers need to be in the DOM for accessibility labeling.
85
84
  if (this.isStickyColumn(column) || collection.rowHeaderColumnKeys.has(column.key)) this.stickyColumnIndices.push(column.index);
86
- let header = this.buildTableHeader();
87
- this.layoutNodes.set(header.layoutInfo.key, header);
88
- let body = this.buildBody(header.layoutInfo.rect.maxY + this.gap);
85
+ let layoutNodes = [];
86
+ let y = 0;
87
+ let width = 0;
88
+ if (!collection.head) {
89
+ let header = this.buildTableHeader();
90
+ this.layoutNodes.set(header.layoutInfo.key, header);
91
+ let body = this.buildBody(header.layoutInfo.rect.maxY + this.gap);
92
+ body.layoutInfo.rect.width = Math.max(header.layoutInfo.rect.width, body.layoutInfo.rect.width);
93
+ y = body.layoutInfo.rect.maxY;
94
+ width = body.layoutInfo.rect.width;
95
+ layoutNodes = [
96
+ header,
97
+ body
98
+ ];
99
+ } else {
100
+ for (let node of collection)switch(node.type){
101
+ case 'tableheader':
102
+ {
103
+ let header = this.buildTableHeader();
104
+ y = header.layoutInfo.rect.maxY + this.gap;
105
+ width = Math.max(width, header.layoutInfo.rect.width);
106
+ this.layoutNodes.set(header.layoutInfo.key, header);
107
+ layoutNodes.push(header);
108
+ break;
109
+ }
110
+ case 'tablebody':
111
+ case 'tablefooter':
112
+ {
113
+ let body = this.buildRowGroup(y, node);
114
+ y = body.layoutInfo.rect.maxY + this.gap;
115
+ width = Math.max(width, body.layoutInfo.rect.width);
116
+ this.layoutNodes.set(body.layoutInfo.key, body);
117
+ layoutNodes.push(body);
118
+ break;
119
+ }
120
+ }
121
+ if (y > 0) y -= this.gap;
122
+ for (let layoutNode of layoutNodes)layoutNode.layoutInfo.rect.width = width;
123
+ }
89
124
  this.lastPersistedKeys = null;
90
- body.layoutInfo.rect.width = Math.max(header.layoutInfo.rect.width, body.layoutInfo.rect.width);
91
- this.contentSize = new (0, $f9c934dfa703bb0a$exports.Size)(body.layoutInfo.rect.width + this.padding * 2, body.layoutInfo.rect.maxY + this.padding);
92
- return [
93
- header,
94
- body
95
- ];
125
+ this.contentSize = new (0, $f9c934dfa703bb0a$exports.Size)(width + this.padding * 2, y + this.padding);
126
+ return layoutNodes;
96
127
  }
97
128
  buildTableHeader() {
98
129
  let collection = this.virtualizer.collection;
@@ -208,20 +239,22 @@ class $779e19dedce4578d$export$62444c3c724b1b20 extends (0, $d474db7fa4a60716$ex
208
239
  return false;
209
240
  }
210
241
  buildBody(y) {
242
+ let collection = this.virtualizer.collection;
243
+ return this.buildRowGroup(y, collection.body);
244
+ }
245
+ buildRowGroup(y, node) {
211
246
  let collection = this.virtualizer.collection;
212
247
  let rect = new (0, $2bdd626d0eea82c5$exports.Rect)(this.padding, y, 0, 0);
213
- let layoutInfo = new (0, $6114beb2608093a1$exports.LayoutInfo)('rowgroup', collection.body.key, rect);
248
+ let layoutInfo = new (0, $6114beb2608093a1$exports.LayoutInfo)('rowgroup', node.key, rect);
214
249
  let startY = y;
215
- let skipped = 0;
216
250
  let width = 0;
217
251
  let children = [];
218
252
  let rowHeight = this.getEstimatedRowHeight() + this.gap;
219
- let childNodes = (0, $c731fb93d14b07fc$exports.getChildNodes)(collection.body, collection);
253
+ let childNodes = (0, $c731fb93d14b07fc$exports.getChildNodes)(node, collection);
220
254
  for (let node of childNodes){
221
- // Skip rows before the valid rectangle unless they are already cached.
222
- if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {
255
+ // Skip rows outside the valid rectangle unless they are already cached.
256
+ if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y) || y > this.requestedRect.maxY && node.type !== 'loader') {
223
257
  y += rowHeight;
224
- skipped++;
225
258
  continue;
226
259
  }
227
260
  let layoutNode = this.buildChild(node, this.padding, y, layoutInfo.key);
@@ -230,23 +263,6 @@ class $779e19dedce4578d$export$62444c3c724b1b20 extends (0, $d474db7fa4a60716$ex
230
263
  y = layoutNode.layoutInfo.rect.maxY + this.gap;
231
264
  width = Math.max(width, layoutNode.layoutInfo.rect.width);
232
265
  children.push(layoutNode);
233
- if (y > this.requestedRect.maxY) {
234
- let rowsAfterRect = collection.size - (children.length + skipped);
235
- let lastNode = (0, $c731fb93d14b07fc$exports.getLastItem)(childNodes);
236
- // Estimate the remaining height for rows that we don't need to layout right now.
237
- y += rowsAfterRect * rowHeight;
238
- // Always add the loader sentinel if present. This assumes the loader is the last row in the body,
239
- // will need to refactor when handling multi section loading
240
- if (lastNode?.type === 'loader' && children.at(-1)?.layoutInfo.type !== 'loader') {
241
- let loader = this.buildChild(lastNode, this.padding, y, layoutInfo.key);
242
- loader.layoutInfo.parentKey = layoutInfo.key;
243
- loader.index = collection.size;
244
- width = Math.max(width, loader.layoutInfo.rect.width);
245
- children.push(loader);
246
- y = loader.layoutInfo.rect.maxY;
247
- }
248
- break;
249
- }
250
266
  }
251
267
  // Make sure that the table body gets a height if empty or performing initial load
252
268
  let isEmptyOrLoading = collection?.size === 0;
@@ -258,9 +274,18 @@ class $779e19dedce4578d$export$62444c3c724b1b20 extends (0, $d474db7fa4a60716$ex
258
274
  layoutInfo: layoutInfo,
259
275
  children: children,
260
276
  validRect: layoutInfo.rect.intersection(this.requestedRect),
261
- node: collection.body
277
+ node: node
262
278
  };
263
279
  }
280
+ buildLoader(node, x, y) {
281
+ let layoutNode = super.buildLoader(node, x, y);
282
+ let collection = this.virtualizer.collection;
283
+ // use the same approach as buildRow to get the proper width of the loader, otherwise
284
+ // we get a outdated loader width
285
+ layoutNode.layoutInfo.rect.width = this.layoutNodes.get(collection.head?.key ?? 'header').layoutInfo.rect.width;
286
+ layoutNode.validRect = layoutNode.layoutInfo.rect.intersection(this.requestedRect);
287
+ return layoutNode;
288
+ }
264
289
  buildNode(node, x, y) {
265
290
  switch(node.type){
266
291
  case 'headerrow':
@@ -508,7 +533,7 @@ class $779e19dedce4578d$export$62444c3c724b1b20 extends (0, $d474db7fa4a60716$ex
508
533
  }
509
534
  getDropTargetLayoutInfo(target) {
510
535
  let layoutInfo = super.getDropTargetLayoutInfo(target);
511
- layoutInfo.parentKey = this.virtualizer.collection.body.key;
536
+ layoutInfo.parentKey = this.virtualizer.collection.getItem(target.key)?.parentKey ?? null;
512
537
  return layoutInfo;
513
538
  }
514
539
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAwCD,MAAM,2CAAqB;AAMpB,MAAM,kDAAsE,CAAA,GAAA,oCAAS;IAO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AI,kBAAkB;gBAAC,GAAG,MAAM;gBAAE,cAAc;YAAO,IAC5D,OAAO,YAAY,GAAG;QAE1B,OAAO,IAAI,KAAK,KAAK,CAAC,GAAG,MAAM,kBAAkB;YAAC,GAAG,MAAM;YAAE,cAAc;QAAQ,IACjF,OAAO,YAAY,GAAG;aACjB,IAAI,KAAK,KAAK,IAAI,GAAG,MAAM,kBAAkB;YAAC,GAAG,MAAM;YAAE,cAAc;QAAO,IACnF,OAAO,YAAY,GAAG;QAGxB,OAAO;IACT;IAEA,wBAAwB,MAAsB,EAAc;QAC1D,IAAI,aAAa,KAAK,CAAC,wBAAwB;QAC/C,WAAW,SAAS,GAAG,AAAC,IAAI,CAAC,WAAW,CAAE,UAAU,CAAwB,IAAI,CAAC,GAAG;QACpF,OAAO;IACT;AACF","sources":["packages/react-stately/src/layout/TableLayout.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DropTarget, ItemDropTarget, Key} from '@react-types/shared';\nimport {getChildNodes, getLastItem} from '../collections/getChildNodes';\nimport {GridNode} from '../grid/GridCollection';\nimport {InvalidationContext} from '../virtualizer/types';\nimport {LayoutInfo} from '../virtualizer/LayoutInfo';\nimport {LayoutNode, ListLayout, ListLayoutOptions} from './ListLayout';\nimport {Point} from '../virtualizer/Point';\nimport {Rect} from '../virtualizer/Rect';\nimport {Size} from '../virtualizer/Size';\nimport {ITableCollection as TableCollection} from '../table/TableCollection';\nimport {TableColumnLayout} from '../table/TableColumnLayout';\n\nexport interface TableLayoutProps extends Omit<ListLayoutOptions, 'orientation' | 'rowSize' | 'estimatedRowSize' | 'headingSize' | 'estimatedHeadingSize' | 'loaderSize'> {\n /**\n * The fixed height of a row in px.\n * @default 48\n */\n rowHeight?: number,\n /** The estimated height of a row, when row heights are variable.\n */\n estimatedRowHeight?: number,\n /**\n * The fixed height of a section header in px.\n * @default 48\n */\n headingHeight?: number,\n /** The estimated height of a section header, when the height is variable.\n */\n estimatedHeadingHeight?: number,\n /**\n * The fixed height of a loader element in px. This loader is specifically for\n * \"load more\" elements rendered when loading more rows at the root level or inside nested row/sections.\n * @default 48\n */\n loaderHeight?: number,\n columnWidths?: Map<Key, number>\n}\n\nconst DEFAULT_ROW_HEIGHT = 48;\n\n/**\n * TableLayout is a virtualizer Layout implementation that arranges\n * items in rows and columns.\n */\nexport class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> extends ListLayout<T, O> {\n protected lastCollection: TableCollection<T> | null = null;\n private columnWidths: Map<Key, number> = new Map();\n private stickyColumnIndices: number[];\n private lastPersistedKeys: Set<Key> | null = null;\n private persistedIndices: Map<Key, number[]> = new Map();\n\n constructor(options?: TableLayoutProps) {\n super(options);\n this.stickyColumnIndices = [];\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): TableCollection<T> {\n return this.virtualizer!.collection as TableCollection<T>;\n }\n\n // Preserve the old rowHeight/other \"height\" properties since Table doesn't support a \"horizontal\" orientation\n protected get rowHeight(): number | null {\n return super.rowHeight;\n }\n\n protected get estimatedRowHeight(): number | null {\n return super.estimatedRowHeight;\n }\n\n protected get headingHeight(): number | null {\n return super.headingHeight;\n }\n\n protected get estimatedHeadingHeight(): number | null {\n return super.estimatedHeadingHeight;\n }\n\n protected get loaderHeight(): number | null {\n return super.loaderHeight;\n }\n\n private columnsChanged(newCollection: TableCollection<T>, oldCollection: TableCollection<T> | null) {\n return !oldCollection ||\n newCollection.columns !== oldCollection.columns &&\n newCollection.columns.length !== oldCollection.columns.length ||\n newCollection.columns.some((c, i) =>\n c.key !== oldCollection.columns[i].key ||\n c.props.width !== oldCollection.columns[i].props.width ||\n c.props.minWidth !== oldCollection.columns[i].props.minWidth ||\n c.props.maxWidth !== oldCollection.columns[i].props.maxWidth\n );\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.columnWidths !== oldOptions.columnWidths\n || super.shouldInvalidateLayoutOptions(newOptions, oldOptions);\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let newCollection = this.virtualizer!.collection as TableCollection<T>;\n\n // If columnWidths were provided via layoutOptions, update those.\n // Otherwise, calculate column widths ourselves.\n if (invalidationContext.layoutOptions?.columnWidths) {\n for (const [key, val] of invalidationContext.layoutOptions.columnWidths) {\n if (this.columnWidths.get(key) !== val) {\n this.columnWidths = invalidationContext.layoutOptions.columnWidths;\n invalidationContext.sizeChanged = true;\n break;\n }\n }\n } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {\n let columnLayout = new TableColumnLayout({});\n this.columnWidths = columnLayout.buildColumnWidths(this.virtualizer!.size.width - this.padding * 2, newCollection, new Map());\n invalidationContext.sizeChanged = true;\n }\n\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n this.stickyColumnIndices = [];\n\n let collection = this.virtualizer!.collection as TableCollection<T>;\n if (collection.head?.key === -1) {\n return [];\n }\n\n for (let column of collection.columns) {\n // The selection cell and any other sticky columns always need to be visible.\n // In addition, row headers need to be in the DOM for accessibility labeling.\n if (this.isStickyColumn(column) || collection.rowHeaderColumnKeys.has(column.key)) {\n this.stickyColumnIndices.push(column.index);\n }\n }\n\n let header = this.buildTableHeader();\n this.layoutNodes.set(header.layoutInfo.key, header);\n let body = this.buildBody(header.layoutInfo.rect.maxY + this.gap);\n this.lastPersistedKeys = null;\n\n body.layoutInfo.rect.width = Math.max(header.layoutInfo.rect.width, body.layoutInfo.rect.width);\n this.contentSize = new Size(body.layoutInfo.rect.width + this.padding * 2, body.layoutInfo.rect.maxY + this.padding);\n return [\n header,\n body\n ];\n }\n\n protected buildTableHeader(): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, this.padding, 0, 0);\n let layoutInfo = new LayoutInfo('header', collection.head?.key ?? 'header', rect);\n layoutInfo.isSticky = true;\n layoutInfo.zIndex = 1;\n\n let y = this.padding;\n let width = 0;\n let children: LayoutNode[] = [];\n for (let headerRow of collection.headerRows) {\n let layoutNode = this.buildChild(headerRow, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n y = layoutNode.layoutInfo.rect.maxY;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n\n rect.width = width;\n rect.height = y - this.padding;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect,\n node: collection.head\n };\n }\n\n protected buildHeaderRow(headerRow: GridNode<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, 0, 0);\n let row = new LayoutInfo('headerrow', headerRow.key, rect);\n\n let height = 0;\n let columns: LayoutNode[] = [];\n for (let cell of getChildNodes(headerRow, this.virtualizer!.collection)) {\n let layoutNode = this.buildChild(cell, x, y, row.key);\n layoutNode.layoutInfo.parentKey = row.key;\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = columns.length;\n columns.push(layoutNode);\n }\n for (let [i, layout] of columns.entries()) {\n layout.layoutInfo.zIndex = columns.length - i + 1;\n }\n\n this.setChildHeights(columns, height);\n\n rect.height = height;\n rect.width = x - rect.x;\n\n return {\n layoutInfo: row,\n children: columns,\n validRect: rect,\n node: headerRow\n };\n }\n\n private setChildHeights(children: LayoutNode[], height: number) {\n for (let child of children) {\n if (child.layoutInfo.rect.height !== height) {\n // Need to copy the layout info before we mutate it.\n child.layoutInfo = child.layoutInfo.copy();\n child.layoutInfo.rect.height = height;\n }\n }\n }\n\n // used to get the column widths when rendering to the DOM\n private getRenderedColumnWidth(node: GridNode<T>) {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let colSpan = node.colSpan ?? 1;\n let colIndex = node.colIndex ?? node.index;\n let width = 0;\n for (let i = colIndex; i < colIndex + colSpan; i++) {\n let column = collection.columns[i];\n if (column?.key != null) {\n width += this.columnWidths.get(column.key) ?? 0;\n }\n }\n\n return width;\n }\n\n private getEstimatedHeight(node: GridNode<T>, width: number, height: number | null, estimatedHeight: number | null) {\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (height == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall collection view changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n height = previousLayoutNode.layoutInfo.rect.height;\n isEstimated = node !== previousLayoutNode.node || width !== previousLayoutNode.layoutInfo.rect.width || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n height = estimatedHeight ?? DEFAULT_ROW_HEIGHT;\n isEstimated = true;\n }\n }\n\n return {height, isEstimated};\n }\n\n protected getEstimatedRowHeight(): number {\n return this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_ROW_HEIGHT;\n }\n\n protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.headingHeight ?? this.rowHeight, this.estimatedHeadingHeight ?? this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n // For subclasses.\n // eslint-disable-next-line\n protected isStickyColumn(node: GridNode<T>) {\n return false;\n }\n\n protected buildBody(y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, y, 0, 0);\n let layoutInfo = new LayoutInfo('rowgroup', collection.body.key, rect);\n\n let startY = y;\n let skipped = 0;\n let width = 0;\n let children: LayoutNode[] = [];\n let rowHeight = this.getEstimatedRowHeight() + this.gap;\n let childNodes = getChildNodes(collection.body, collection);\n for (let node of childNodes) {\n // Skip rows before the valid rectangle unless they are already cached.\n if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {\n y += rowHeight;\n skipped++;\n continue;\n }\n\n let layoutNode = this.buildChild(node, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n layoutNode.index = children.length;\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n children.push(layoutNode);\n\n if (y > this.requestedRect.maxY) {\n let rowsAfterRect = collection.size - (children.length + skipped);\n let lastNode = getLastItem(childNodes);\n\n // Estimate the remaining height for rows that we don't need to layout right now.\n y += rowsAfterRect * rowHeight;\n\n // Always add the loader sentinel if present. This assumes the loader is the last row in the body,\n // will need to refactor when handling multi section loading\n if (lastNode?.type === 'loader' && children.at(-1)?.layoutInfo.type !== 'loader') {\n let loader = this.buildChild(lastNode, this.padding, y, layoutInfo.key);\n loader.layoutInfo.parentKey = layoutInfo.key;\n loader.index = collection.size;\n width = Math.max(width, loader.layoutInfo.rect.width);\n children.push(loader);\n y = loader.layoutInfo.rect.maxY;\n }\n break;\n }\n }\n\n // Make sure that the table body gets a height if empty or performing initial load\n let isEmptyOrLoading = collection?.size === 0;\n if (isEmptyOrLoading) {\n y = this.virtualizer!.size.height;\n } else {\n y -= this.gap;\n }\n\n rect.width = width;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node: collection.body\n };\n }\n\n protected buildNode(node: GridNode<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'headerrow':\n return this.buildHeaderRow(node, x, y);\n case 'item':\n return this.buildRow(node, x, y);\n case 'column':\n case 'placeholder':\n return this.buildColumn(node, x, y);\n case 'cell':\n return this.buildCell(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n default:\n throw new Error('Unknown node type ' + node.type);\n }\n }\n\n protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(x, y, 0, 0);\n let layoutInfo = new LayoutInfo('row', node.key, rect);\n\n let children: LayoutNode[] = [];\n let height = 0;\n for (let child of getChildNodes(node, collection)) {\n if (child.type === 'cell') {\n if (x > this.requestedRect.maxX) {\n // Adjust existing cached layoutInfo to ensure that it is out of view.\n // This can happen due to column resizing.\n let layoutNode = this.layoutNodes.get(child.key);\n if (layoutNode) {\n layoutNode.layoutInfo.rect.x = x;\n x += layoutNode.layoutInfo.rect.width;\n } else {\n break;\n }\n } else {\n let layoutNode = this.buildChild(child, x, y, layoutInfo.key);\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n }\n }\n\n this.setChildHeights(children, height);\n\n rect.width = this.layoutNodes.get(collection.head?.key ?? 'header')!.layoutInfo.rect.width;\n rect.height = height;\n\n return {\n layoutInfo,\n children,\n validRect: rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildCell(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.rowHeight, this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: rect,\n node\n };\n }\n\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n // Adjust rect to keep number of visible rows consistent.\n // (only if height > 1 for getDropTargetFromPoint)\n if (rect.height > 1) {\n let rowHeight = this.getEstimatedRowHeight();\n rect.y = Math.floor(rect.y / rowHeight) * rowHeight;\n rect.height = Math.ceil(rect.height / rowHeight) * rowHeight;\n }\n\n // If layout hasn't yet been done for the requested rect, union the\n // new rect with the existing valid rect, and recompute.\n this.layoutIfNeeded(rect);\n\n let res: LayoutInfo[] = [];\n\n this.buildPersistedIndices();\n for (let node of this.rootNodes) {\n res.push(node.layoutInfo);\n this.addVisibleLayoutInfos(res, node, rect);\n }\n\n return res;\n }\n\n private addVisibleLayoutInfos(res: LayoutInfo[], node: LayoutNode, rect: Rect) {\n if (!node.children || node.children.length === 0) {\n return;\n }\n\n switch (node.layoutInfo.type) {\n case 'header': {\n for (let child of node.children) {\n res.push(child.layoutInfo);\n this.addVisibleLayoutInfos(res, child, rect);\n }\n break;\n }\n case 'rowgroup': {\n let firstVisibleRow = this.binarySearch(node.children, rect.topLeft, 'y');\n let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight, 'y');\n\n // Add persisted rows before the visible rows.\n let persistedRowIndices = this.persistedIndices.get(node.layoutInfo.key);\n let persistIndex = 0;\n while (\n persistedRowIndices &&\n persistIndex < persistedRowIndices.length &&\n persistedRowIndices[persistIndex] < firstVisibleRow\n ) {\n let idx = persistedRowIndices[persistIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n persistIndex++;\n }\n\n for (let i = firstVisibleRow; i <= lastVisibleRow; i++) {\n // Skip persisted rows that overlap with visible cells.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length && persistedRowIndices[persistIndex] < i) {\n persistIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[i], rect);\n }\n\n // Add persisted rows after the visible rows.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length) {\n let idx = persistedRowIndices[persistIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n }\n\n // Always include loading sentinel even when virtualized, we assume it is always the last child for now\n let lastRow = node.children.at(-1);\n if (lastRow?.layoutInfo.type === 'loader') {\n res.push(lastRow.layoutInfo);\n }\n break;\n }\n case 'headerrow':\n case 'row': {\n let firstVisibleCell = this.binarySearch(node.children, rect.topLeft, 'x');\n let lastVisibleCell = this.binarySearch(node.children, rect.topRight, 'x');\n let stickyIndex = 0;\n\n // Add persisted/sticky cells before the visible cells.\n let persistedCellIndices = this.persistedIndices.get(node.layoutInfo.key) || this.stickyColumnIndices;\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < firstVisibleCell) {\n let idx = persistedCellIndices[stickyIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n stickyIndex++;\n }\n\n for (let i = firstVisibleCell; i <= lastVisibleCell; i++) {\n // Skip sticky cells that overlap with visible cells.\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < i) {\n stickyIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n }\n\n // Add any remaining sticky cells after the visible cells.\n while (stickyIndex < persistedCellIndices.length) {\n let idx = persistedCellIndices[stickyIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n }\n break;\n }\n default:\n throw new Error('Unknown node type ' + node.layoutInfo.type);\n }\n }\n\n private binarySearch(items: LayoutNode[], point: Point, axis: 'x' | 'y') {\n let low = 0;\n let high = items.length - 1;\n while (low <= high) {\n let mid = (low + high) >> 1;\n let item = items[mid];\n\n if ((axis === 'x' && item.layoutInfo.rect.maxX <= point.x) || (axis === 'y' && item.layoutInfo.rect.maxY <= point.y)) {\n low = mid + 1;\n } else if ((axis === 'x' && item.layoutInfo.rect.x > point.x) || (axis === 'y' && item.layoutInfo.rect.y > point.y)) {\n high = mid - 1;\n } else {\n return mid;\n }\n }\n\n return Math.max(0, Math.min(items.length - 1, low));\n }\n\n private buildPersistedIndices() {\n if (this.virtualizer!.persistedKeys === this.lastPersistedKeys) {\n return;\n }\n\n this.lastPersistedKeys = this.virtualizer!.persistedKeys;\n this.persistedIndices.clear();\n\n // Build a map of parentKey => indices of children to persist.\n for (let key of this.virtualizer!.persistedKeys) {\n let layoutInfo = this.layoutNodes.get(key)?.layoutInfo;\n\n // Walk up ancestors so parents are also persisted if children are.\n while (layoutInfo && layoutInfo.parentKey) {\n let collectionNode = this.virtualizer!.collection.getItem(layoutInfo.key);\n let indices = this.persistedIndices.get(layoutInfo.parentKey);\n if (!indices) {\n // stickyColumnIndices are always persisted along with any cells from persistedKeys.\n indices = collectionNode?.type === 'cell' || collectionNode?.type === 'column' ? [...this.stickyColumnIndices] : [];\n this.persistedIndices.set(layoutInfo.parentKey, indices);\n }\n\n let index = this.layoutNodes.get(layoutInfo.key)?.index;\n if (index != null && !indices.includes(index)) {\n indices.push(index);\n }\n\n layoutInfo = this.layoutNodes.get(layoutInfo.parentKey)?.layoutInfo;\n }\n }\n\n for (let indices of this.persistedIndices.values()) {\n indices.sort((a, b) => a - b);\n }\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null {\n x += this.virtualizer!.visibleRect.x;\n y += this.virtualizer!.visibleRect.y;\n\n // Find the closest item within on either side of the point using the gap width.\n let searchRect = new Rect(x, Math.max(0, y - this.gap), 1, Math.max(1, this.gap * 2));\n let candidates = this.getVisibleLayoutInfos(searchRect);\n let key: Key | null = null;\n let minDistance = Infinity;\n for (let candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (candidate.type !== 'row' || !candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n let yDist = Math.abs(candidate.rect.y - y);\n let maxYDist = Math.abs(candidate.rect.maxY - y);\n let dist = Math.min(yDist, maxYDist);\n if (dist < minDistance) {\n minDistance = dist;\n key = candidate.key;\n }\n }\n\n if (key == null || this.virtualizer!.collection.size === 0) {\n return {type: 'root'};\n }\n\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = layoutInfo.rect;\n let target: DropTarget = {\n type: 'item',\n key: layoutInfo.key,\n dropPosition: 'on'\n };\n\n // If dropping on the item isn't accepted, try the target before or after depending on the y position.\n // Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px\n // of the top or bottom of the item.\n if (!isValidDropTarget(target)) {\n if (y <= rect.y + rect.height / 2 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n } else if (y <= rect.y + 10 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (y >= rect.maxY - 10 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n\n return target;\n }\n\n getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n let layoutInfo = super.getDropTargetLayoutInfo(target);\n layoutInfo.parentKey = (this.virtualizer!.collection as TableCollection<T>).body.key;\n return layoutInfo;\n }\n}\n"],"names":[],"version":3,"file":"TableLayout.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAqDD,MAAM,2CAAqB;AAMpB,MAAM,kDAAsE,CAAA,GAAA,oCAAS;IAU1F,YAAY,OAA0B,CAAE;QACtC,KAAK,CAAC,eAPE,iBAA4C,WAC9C,eAAiC,IAAI,YAErC,oBAAqC,WACrC,mBAAuC,IAAI;QAIjD,IAAI,CAAC,mBAAmB,GAAG,EAAE;IAC/B;IAEA,0CAA0C;IAC1C,IAAc,aAAiC;QAC7C,OAAO,IAAI,CAAC,WAAW,CAAE,UAAU;IACrC;IAEA,8GAA8G;IAC9G,IAAc,YAA2B;QACvC,OAAO,KAAK,CAAC;IACf;IAEA,IAAc,qBAAoC;QAChD,OAAO,KAAK,CAAC;IACf;IAEA,IAAc,gBAA+B;QAC3C,OAAO,KAAK,CAA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GACvD,OAAO;YAAC,MAAM;QAAM;QAGtB,IAAI,aAAa,IAAI,CAAC,aAAa,CAAC;QACpC,IAAI,CAAC,YACH,OAAO;QAGT,IAAI,OAAO,WAAW,IAAI;QAC1B,IAAI,SAAqB;YACvB,MAAM;YACN,KAAK,WAAW,GAAG;YACnB,cAAc;QAChB;QAEA,sGAAsG;QACtG,sGAAsG;QACtG,oCAAoC;QACpC,IAAI,CAAC,kBAAkB,SAAS;YAC9B,IAAI,KAAK,KAAK,CAAC,GAAG,KAAK,MAAM,GAAG,KAAK,kBAAkB;gBAAC,GAAG,MAAM;gBAAE,cAAc;YAAQ,IACvF,OAAO,YAAY,GAAG;iBACjB,IAAI,kBAAkB;gBAAC,GAAG,MAAM;gBAAE,cAAc;YAAO,IAC5D,OAAO,YAAY,GAAG;QAE1B,OAAO,IAAI,KAAK,KAAK,CAAC,GAAG,MAAM,kBAAkB;YAAC,GAAG,MAAM;YAAE,cAAc;QAAQ,IACjF,OAAO,YAAY,GAAG;aACjB,IAAI,KAAK,KAAK,IAAI,GAAG,MAAM,kBAAkB;YAAC,GAAG,MAAM;YAAE,cAAc;QAAO,IACnF,OAAO,YAAY,GAAG;QAGxB,OAAO;IACT;IAEA,wBAAwB,MAAsB,EAAc;QAC1D,IAAI,aAAa,KAAK,CAAC,wBAAwB;QAC/C,WAAW,SAAS,GAAG,IAAI,CAAC,WAAW,CAAE,UAAU,CAAC,OAAO,CAAC,OAAO,GAAG,GAAG,aAAa;QACtF,OAAO;IACT;AACF","sources":["packages/react-stately/src/layout/TableLayout.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DropTarget, ItemDropTarget, Key} from '@react-types/shared';\nimport {getChildNodes} from '../collections/getChildNodes';\nimport {GridNode} from '../grid/GridCollection';\nimport {InvalidationContext} from '../virtualizer/types';\nimport {LayoutInfo} from '../virtualizer/LayoutInfo';\nimport {LayoutNode, ListLayout, ListLayoutOptions} from './ListLayout';\nimport {Point} from '../virtualizer/Point';\nimport {Rect} from '../virtualizer/Rect';\nimport {Size} from '../virtualizer/Size';\nimport {ITableCollection as TableCollection} from '../table/TableCollection';\nimport {TableColumnLayout} from '../table/TableColumnLayout';\n\nexport interface TableLayoutProps extends Omit<\n ListLayoutOptions,\n | 'orientation'\n | 'rowSize'\n | 'estimatedRowSize'\n | 'headingSize'\n | 'estimatedHeadingSize'\n | 'loaderSize'\n> {\n /**\n * The fixed height of a row in px.\n *\n * @default 48\n */\n rowHeight?: number;\n /**\n * The estimated height of a row, when row heights are variable.\n */\n estimatedRowHeight?: number;\n /**\n * The fixed height of a section header in px.\n *\n * @default 48\n */\n headingHeight?: number;\n /**\n * The estimated height of a section header, when the height is variable.\n */\n estimatedHeadingHeight?: number;\n /**\n * The fixed height of a loader element in px. This loader is specifically for \"load more\"\n * elements rendered when loading more rows at the root level or inside nested row/sections.\n *\n * @default 48\n */\n loaderHeight?: number;\n columnWidths?: Map<Key, number>;\n}\n\nconst DEFAULT_ROW_HEIGHT = 48;\n\n/**\n * TableLayout is a virtualizer Layout implementation that arranges\n * items in rows and columns.\n */\nexport class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> extends ListLayout<\n T,\n O\n> {\n protected lastCollection: TableCollection<T> | null = null;\n private columnWidths: Map<Key, number> = new Map();\n private stickyColumnIndices: number[];\n private lastPersistedKeys: Set<Key> | null = null;\n private persistedIndices: Map<Key, number[]> = new Map();\n\n constructor(options?: TableLayoutProps) {\n super(options);\n this.stickyColumnIndices = [];\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): TableCollection<T> {\n return this.virtualizer!.collection as TableCollection<T>;\n }\n\n // Preserve the old rowHeight/other \"height\" properties since Table doesn't support a \"horizontal\" orientation\n protected get rowHeight(): number | null {\n return super.rowHeight;\n }\n\n protected get estimatedRowHeight(): number | null {\n return super.estimatedRowHeight;\n }\n\n protected get headingHeight(): number | null {\n return super.headingHeight;\n }\n\n protected get estimatedHeadingHeight(): number | null {\n return super.estimatedHeadingHeight;\n }\n\n protected get loaderHeight(): number | null {\n return super.loaderHeight;\n }\n\n private columnsChanged(\n newCollection: TableCollection<T>,\n oldCollection: TableCollection<T> | null\n ) {\n return (\n !oldCollection ||\n (newCollection.columns !== oldCollection.columns &&\n newCollection.columns.length !== oldCollection.columns.length) ||\n newCollection.columns.some(\n (c, i) =>\n c.key !== oldCollection.columns[i].key ||\n c.props.width !== oldCollection.columns[i].props.width ||\n c.props.minWidth !== oldCollection.columns[i].props.minWidth ||\n c.props.maxWidth !== oldCollection.columns[i].props.maxWidth\n )\n );\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return (\n newOptions.columnWidths !== oldOptions.columnWidths ||\n super.shouldInvalidateLayoutOptions(newOptions, oldOptions)\n );\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let newCollection = this.virtualizer!.collection as TableCollection<T>;\n\n // If columnWidths were provided via layoutOptions, update those.\n // Otherwise, calculate column widths ourselves.\n if (invalidationContext.layoutOptions?.columnWidths) {\n for (const [key, val] of invalidationContext.layoutOptions.columnWidths) {\n if (this.columnWidths.get(key) !== val) {\n this.columnWidths = invalidationContext.layoutOptions.columnWidths;\n invalidationContext.sizeChanged = true;\n break;\n }\n }\n } else if (\n invalidationContext.sizeChanged ||\n this.columnsChanged(newCollection, this.lastCollection)\n ) {\n let columnLayout = new TableColumnLayout({});\n this.columnWidths = columnLayout.buildColumnWidths(\n this.virtualizer!.size.width - this.padding * 2,\n newCollection,\n new Map()\n );\n invalidationContext.sizeChanged = true;\n }\n\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n this.stickyColumnIndices = [];\n\n let collection = this.virtualizer!.collection as TableCollection<T>;\n for (let column of collection.columns) {\n // The selection cell and any other sticky columns always need to be visible.\n // In addition, row headers need to be in the DOM for accessibility labeling.\n if (this.isStickyColumn(column) || collection.rowHeaderColumnKeys.has(column.key)) {\n this.stickyColumnIndices.push(column.index);\n }\n }\n\n let layoutNodes: LayoutNode[] = [];\n let y = 0;\n let width = 0;\n\n if (!collection.head) {\n let header = this.buildTableHeader();\n this.layoutNodes.set(header.layoutInfo.key, header);\n let body = this.buildBody(header.layoutInfo.rect.maxY + this.gap);\n body.layoutInfo.rect.width = Math.max(\n header.layoutInfo.rect.width,\n body.layoutInfo.rect.width\n );\n y = body.layoutInfo.rect.maxY;\n width = body.layoutInfo.rect.width;\n layoutNodes = [header, body];\n } else {\n for (let node of collection) {\n switch (node.type) {\n case 'tableheader': {\n let header = this.buildTableHeader();\n y = header.layoutInfo.rect.maxY + this.gap;\n width = Math.max(width, header.layoutInfo.rect.width);\n this.layoutNodes.set(header.layoutInfo.key, header);\n layoutNodes.push(header);\n break;\n }\n case 'tablebody':\n case 'tablefooter': {\n let body = this.buildRowGroup(y, node);\n y = body.layoutInfo.rect.maxY + this.gap;\n width = Math.max(width, body.layoutInfo.rect.width);\n this.layoutNodes.set(body.layoutInfo.key, body);\n layoutNodes.push(body);\n break;\n }\n }\n }\n\n if (y > 0) {\n y -= this.gap;\n }\n\n for (let layoutNode of layoutNodes) {\n layoutNode.layoutInfo.rect.width = width;\n }\n }\n\n this.lastPersistedKeys = null;\n this.contentSize = new Size(width + this.padding * 2, y + this.padding);\n return layoutNodes;\n }\n\n protected buildTableHeader(): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, this.padding, 0, 0);\n let layoutInfo = new LayoutInfo('header', collection.head?.key ?? 'header', rect);\n layoutInfo.isSticky = true;\n layoutInfo.zIndex = 1;\n\n let y = this.padding;\n let width = 0;\n let children: LayoutNode[] = [];\n for (let headerRow of collection.headerRows) {\n let layoutNode = this.buildChild(headerRow, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n y = layoutNode.layoutInfo.rect.maxY;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n\n rect.width = width;\n rect.height = y - this.padding;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect,\n node: collection.head\n };\n }\n\n protected buildHeaderRow(headerRow: GridNode<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, 0, 0);\n let row = new LayoutInfo('headerrow', headerRow.key, rect);\n\n let height = 0;\n let columns: LayoutNode[] = [];\n for (let cell of getChildNodes(headerRow, this.virtualizer!.collection)) {\n let layoutNode = this.buildChild(cell, x, y, row.key);\n layoutNode.layoutInfo.parentKey = row.key;\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = columns.length;\n columns.push(layoutNode);\n }\n for (let [i, layout] of columns.entries()) {\n layout.layoutInfo.zIndex = columns.length - i + 1;\n }\n\n this.setChildHeights(columns, height);\n\n rect.height = height;\n rect.width = x - rect.x;\n\n return {\n layoutInfo: row,\n children: columns,\n validRect: rect,\n node: headerRow\n };\n }\n\n private setChildHeights(children: LayoutNode[], height: number) {\n for (let child of children) {\n if (child.layoutInfo.rect.height !== height) {\n // Need to copy the layout info before we mutate it.\n child.layoutInfo = child.layoutInfo.copy();\n child.layoutInfo.rect.height = height;\n }\n }\n }\n\n // used to get the column widths when rendering to the DOM\n private getRenderedColumnWidth(node: GridNode<T>) {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let colSpan = node.colSpan ?? 1;\n let colIndex = node.colIndex ?? node.index;\n let width = 0;\n for (let i = colIndex; i < colIndex + colSpan; i++) {\n let column = collection.columns[i];\n if (column?.key != null) {\n width += this.columnWidths.get(column.key) ?? 0;\n }\n }\n\n return width;\n }\n\n private getEstimatedHeight(\n node: GridNode<T>,\n width: number,\n height: number | null,\n estimatedHeight: number | null\n ) {\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (height == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall collection view changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n height = previousLayoutNode.layoutInfo.rect.height;\n isEstimated =\n node !== previousLayoutNode.node ||\n width !== previousLayoutNode.layoutInfo.rect.width ||\n previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n height = estimatedHeight ?? DEFAULT_ROW_HEIGHT;\n isEstimated = true;\n }\n }\n\n return {height, isEstimated};\n }\n\n protected getEstimatedRowHeight(): number {\n return this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_ROW_HEIGHT;\n }\n\n protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(\n node,\n width,\n this.headingHeight ?? this.rowHeight,\n this.estimatedHeadingHeight ?? this.estimatedRowHeight\n );\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n // For subclasses.\n // eslint-disable-next-line\n protected isStickyColumn(node: GridNode<T>) {\n return false;\n }\n\n protected buildBody(y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n return this.buildRowGroup(y, collection.body);\n }\n\n protected buildRowGroup(y: number, node: GridNode<T>): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, y, 0, 0);\n let layoutInfo = new LayoutInfo('rowgroup', node.key, rect);\n\n let startY = y;\n let width = 0;\n let children: LayoutNode[] = [];\n let rowHeight = this.getEstimatedRowHeight() + this.gap;\n let childNodes = getChildNodes(node, collection);\n for (let node of childNodes) {\n // Skip rows outside the valid rectangle unless they are already cached.\n if (\n (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) ||\n (y > this.requestedRect.maxY && node.type !== 'loader')\n ) {\n y += rowHeight;\n continue;\n }\n\n let layoutNode = this.buildChild(node, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n layoutNode.index = children.length;\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n children.push(layoutNode);\n }\n\n // Make sure that the table body gets a height if empty or performing initial load\n let isEmptyOrLoading = collection?.size === 0;\n if (isEmptyOrLoading) {\n y = this.virtualizer!.size.height;\n } else {\n y -= this.gap;\n }\n\n rect.width = width;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildLoader(node: GridNode<T>, x: number, y: number): LayoutNode {\n let layoutNode = super.buildLoader(node, x, y);\n let collection = this.virtualizer!.collection as TableCollection<T>;\n\n // use the same approach as buildRow to get the proper width of the loader, otherwise\n // we get a outdated loader width\n layoutNode.layoutInfo.rect.width = this.layoutNodes.get(\n collection.head?.key ?? 'header'\n )!.layoutInfo.rect.width;\n layoutNode.validRect = layoutNode.layoutInfo.rect.intersection(this.requestedRect);\n return layoutNode;\n }\n\n protected buildNode(node: GridNode<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'headerrow':\n return this.buildHeaderRow(node, x, y);\n case 'item':\n return this.buildRow(node, x, y);\n case 'column':\n case 'placeholder':\n return this.buildColumn(node, x, y);\n case 'cell':\n return this.buildCell(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n default:\n throw new Error('Unknown node type ' + node.type);\n }\n }\n\n protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(x, y, 0, 0);\n let layoutInfo = new LayoutInfo('row', node.key, rect);\n\n let children: LayoutNode[] = [];\n let height = 0;\n for (let child of getChildNodes(node, collection)) {\n if (child.type === 'cell') {\n if (x > this.requestedRect.maxX) {\n // Adjust existing cached layoutInfo to ensure that it is out of view.\n // This can happen due to column resizing.\n let layoutNode = this.layoutNodes.get(child.key);\n if (layoutNode) {\n layoutNode.layoutInfo.rect.x = x;\n x += layoutNode.layoutInfo.rect.width;\n } else {\n break;\n }\n } else {\n let layoutNode = this.buildChild(child, x, y, layoutInfo.key);\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n }\n }\n\n this.setChildHeights(children, height);\n\n rect.width = this.layoutNodes.get(collection.head?.key ?? 'header')!.layoutInfo.rect.width;\n rect.height = height;\n\n return {\n layoutInfo,\n children,\n validRect: rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildCell(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(\n node,\n width,\n this.rowHeight,\n this.estimatedRowHeight\n );\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: rect,\n node\n };\n }\n\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n // Adjust rect to keep number of visible rows consistent.\n // (only if height > 1 for getDropTargetFromPoint)\n if (rect.height > 1) {\n let rowHeight = this.getEstimatedRowHeight();\n rect.y = Math.floor(rect.y / rowHeight) * rowHeight;\n rect.height = Math.ceil(rect.height / rowHeight) * rowHeight;\n }\n\n // If layout hasn't yet been done for the requested rect, union the\n // new rect with the existing valid rect, and recompute.\n this.layoutIfNeeded(rect);\n\n let res: LayoutInfo[] = [];\n\n this.buildPersistedIndices();\n for (let node of this.rootNodes) {\n res.push(node.layoutInfo);\n this.addVisibleLayoutInfos(res, node, rect);\n }\n\n return res;\n }\n\n private addVisibleLayoutInfos(res: LayoutInfo[], node: LayoutNode, rect: Rect) {\n if (!node.children || node.children.length === 0) {\n return;\n }\n\n switch (node.layoutInfo.type) {\n case 'header': {\n for (let child of node.children) {\n res.push(child.layoutInfo);\n this.addVisibleLayoutInfos(res, child, rect);\n }\n break;\n }\n case 'rowgroup': {\n let firstVisibleRow = this.binarySearch(node.children, rect.topLeft, 'y');\n let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight, 'y');\n\n // Add persisted rows before the visible rows.\n let persistedRowIndices = this.persistedIndices.get(node.layoutInfo.key);\n let persistIndex = 0;\n while (\n persistedRowIndices &&\n persistIndex < persistedRowIndices.length &&\n persistedRowIndices[persistIndex] < firstVisibleRow\n ) {\n let idx = persistedRowIndices[persistIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n persistIndex++;\n }\n\n for (let i = firstVisibleRow; i <= lastVisibleRow; i++) {\n // Skip persisted rows that overlap with visible cells.\n while (\n persistedRowIndices &&\n persistIndex < persistedRowIndices.length &&\n persistedRowIndices[persistIndex] < i\n ) {\n persistIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[i], rect);\n }\n\n // Add persisted rows after the visible rows.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length) {\n let idx = persistedRowIndices[persistIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n }\n\n // Always include loading sentinel even when virtualized, we assume it is always the last child for now\n let lastRow = node.children.at(-1);\n if (lastRow?.layoutInfo.type === 'loader') {\n res.push(lastRow.layoutInfo);\n }\n break;\n }\n case 'headerrow':\n case 'row': {\n let firstVisibleCell = this.binarySearch(node.children, rect.topLeft, 'x');\n let lastVisibleCell = this.binarySearch(node.children, rect.topRight, 'x');\n let stickyIndex = 0;\n\n // Add persisted/sticky cells before the visible cells.\n let persistedCellIndices =\n this.persistedIndices.get(node.layoutInfo.key) || this.stickyColumnIndices;\n while (\n stickyIndex < persistedCellIndices.length &&\n persistedCellIndices[stickyIndex] < firstVisibleCell\n ) {\n let idx = persistedCellIndices[stickyIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n stickyIndex++;\n }\n\n for (let i = firstVisibleCell; i <= lastVisibleCell; i++) {\n // Skip sticky cells that overlap with visible cells.\n while (\n stickyIndex < persistedCellIndices.length &&\n persistedCellIndices[stickyIndex] < i\n ) {\n stickyIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n }\n\n // Add any remaining sticky cells after the visible cells.\n while (stickyIndex < persistedCellIndices.length) {\n let idx = persistedCellIndices[stickyIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n }\n break;\n }\n default:\n throw new Error('Unknown node type ' + node.layoutInfo.type);\n }\n }\n\n private binarySearch(items: LayoutNode[], point: Point, axis: 'x' | 'y') {\n let low = 0;\n let high = items.length - 1;\n while (low <= high) {\n let mid = (low + high) >> 1;\n let item = items[mid];\n\n if (\n (axis === 'x' && item.layoutInfo.rect.maxX <= point.x) ||\n (axis === 'y' && item.layoutInfo.rect.maxY <= point.y)\n ) {\n low = mid + 1;\n } else if (\n (axis === 'x' && item.layoutInfo.rect.x > point.x) ||\n (axis === 'y' && item.layoutInfo.rect.y > point.y)\n ) {\n high = mid - 1;\n } else {\n return mid;\n }\n }\n\n return Math.max(0, Math.min(items.length - 1, low));\n }\n\n private buildPersistedIndices() {\n if (this.virtualizer!.persistedKeys === this.lastPersistedKeys) {\n return;\n }\n\n this.lastPersistedKeys = this.virtualizer!.persistedKeys;\n this.persistedIndices.clear();\n\n // Build a map of parentKey => indices of children to persist.\n for (let key of this.virtualizer!.persistedKeys) {\n let layoutInfo = this.layoutNodes.get(key)?.layoutInfo;\n\n // Walk up ancestors so parents are also persisted if children are.\n while (layoutInfo && layoutInfo.parentKey) {\n let collectionNode = this.virtualizer!.collection.getItem(layoutInfo.key);\n let indices = this.persistedIndices.get(layoutInfo.parentKey);\n if (!indices) {\n // stickyColumnIndices are always persisted along with any cells from persistedKeys.\n indices =\n collectionNode?.type === 'cell' || collectionNode?.type === 'column'\n ? [...this.stickyColumnIndices]\n : [];\n this.persistedIndices.set(layoutInfo.parentKey, indices);\n }\n\n let index = this.layoutNodes.get(layoutInfo.key)?.index;\n if (index != null && !indices.includes(index)) {\n indices.push(index);\n }\n\n layoutInfo = this.layoutNodes.get(layoutInfo.parentKey)?.layoutInfo;\n }\n }\n\n for (let indices of this.persistedIndices.values()) {\n indices.sort((a, b) => a - b);\n }\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean\n ): DropTarget | null {\n x += this.virtualizer!.visibleRect.x;\n y += this.virtualizer!.visibleRect.y;\n\n // Find the closest item within on either side of the point using the gap width.\n let searchRect = new Rect(x, Math.max(0, y - this.gap), 1, Math.max(1, this.gap * 2));\n let candidates = this.getVisibleLayoutInfos(searchRect);\n let key: Key | null = null;\n let minDistance = Infinity;\n for (let candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (candidate.type !== 'row' || !candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n let yDist = Math.abs(candidate.rect.y - y);\n let maxYDist = Math.abs(candidate.rect.maxY - y);\n let dist = Math.min(yDist, maxYDist);\n if (dist < minDistance) {\n minDistance = dist;\n key = candidate.key;\n }\n }\n\n if (key == null || this.virtualizer!.collection.size === 0) {\n return {type: 'root'};\n }\n\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = layoutInfo.rect;\n let target: DropTarget = {\n type: 'item',\n key: layoutInfo.key,\n dropPosition: 'on'\n };\n\n // If dropping on the item isn't accepted, try the target before or after depending on the y position.\n // Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px\n // of the top or bottom of the item.\n if (!isValidDropTarget(target)) {\n if (y <= rect.y + rect.height / 2 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n } else if (y <= rect.y + 10 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (y >= rect.maxY - 10 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n\n return target;\n }\n\n getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n let layoutInfo = super.getDropTargetLayoutInfo(target);\n layoutInfo.parentKey = this.virtualizer!.collection.getItem(target.key)?.parentKey ?? null;\n return layoutInfo;\n }\n}\n"],"names":[],"version":3,"file":"TableLayout.cjs.map"}