@nocopypaste/vue-grid 0.0.0-stage → 0.2.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 (442) hide show
  1. package/AGENTS.md +285 -0
  2. package/CHANGELOG.md +31 -0
  3. package/README.md +881 -2
  4. package/agent/api.json +2336 -0
  5. package/agent/api.md +632 -0
  6. package/agent/grid-config.schema.json +609 -0
  7. package/dist/agent/api.js +2301 -0
  8. package/dist/agent/api.js.map +1 -0
  9. package/dist/agent/index.js +8 -0
  10. package/dist/agent/index.js.map +1 -0
  11. package/dist/agent/requirements.js +57 -0
  12. package/dist/agent/requirements.js.map +1 -0
  13. package/dist/agent/validate.js +181 -0
  14. package/dist/agent/validate.js.map +1 -0
  15. package/dist/base.css +1 -0
  16. package/dist/components/VGrid.js +6 -0
  17. package/dist/components/VGrid.js.map +1 -0
  18. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +759 -0
  19. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -0
  20. package/dist/components/VGridCell.js +6 -0
  21. package/dist/components/VGridCell.js.map +1 -0
  22. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +167 -0
  23. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  24. package/dist/components/VGridCheckbox.js +6 -0
  25. package/dist/components/VGridCheckbox.js.map +1 -0
  26. package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js +39 -0
  27. package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -0
  28. package/dist/components/VGridColumnMenu.js +6 -0
  29. package/dist/components/VGridColumnMenu.js.map +1 -0
  30. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js +100 -0
  31. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  32. package/dist/components/VGridFilterInput.js +6 -0
  33. package/dist/components/VGridFilterInput.js.map +1 -0
  34. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js +89 -0
  35. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
  36. package/dist/components/VGridFilterPanel.js +6 -0
  37. package/dist/components/VGridFilterPanel.js.map +1 -0
  38. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +248 -0
  39. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  40. package/dist/components/VGridFilterPopover.js +6 -0
  41. package/dist/components/VGridFilterPopover.js.map +1 -0
  42. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js +79 -0
  43. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -0
  44. package/dist/components/VGridGroupRow.js +6 -0
  45. package/dist/components/VGridGroupRow.js.map +1 -0
  46. package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js +49 -0
  47. package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js.map +1 -0
  48. package/dist/components/VGridHeader.js +6 -0
  49. package/dist/components/VGridHeader.js.map +1 -0
  50. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js +130 -0
  51. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -0
  52. package/dist/components/VGridMenu.js +6 -0
  53. package/dist/components/VGridMenu.js.map +1 -0
  54. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js +133 -0
  55. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  56. package/dist/components/VGridPagination.js +6 -0
  57. package/dist/components/VGridPagination.js.map +1 -0
  58. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +102 -0
  59. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -0
  60. package/dist/components/VGridPinnedRows.js +6 -0
  61. package/dist/components/VGridPinnedRows.js.map +1 -0
  62. package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js +75 -0
  63. package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js.map +1 -0
  64. package/dist/components/VGridResizeHandle.js +6 -0
  65. package/dist/components/VGridResizeHandle.js.map +1 -0
  66. package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js +34 -0
  67. package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js.map +1 -0
  68. package/dist/components/VGridRows.js +6 -0
  69. package/dist/components/VGridRows.js.map +1 -0
  70. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +178 -0
  71. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -0
  72. package/dist/components/VGridSearch.js +6 -0
  73. package/dist/components/VGridSearch.js.map +1 -0
  74. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js +46 -0
  75. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -0
  76. package/dist/components/VGridTotalCell.js +6 -0
  77. package/dist/components/VGridTotalCell.js.map +1 -0
  78. package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js +74 -0
  79. package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  80. package/dist/composables/useColumnDrag.js +79 -0
  81. package/dist/composables/useColumnDrag.js.map +1 -0
  82. package/dist/composables/useColumnResize.js +68 -0
  83. package/dist/composables/useColumnResize.js.map +1 -0
  84. package/dist/composables/useDataSource.js +47 -0
  85. package/dist/composables/useDataSource.js.map +1 -0
  86. package/dist/composables/useGridFilters.js +125 -0
  87. package/dist/composables/useGridFilters.js.map +1 -0
  88. package/dist/composables/useGridKeyboard.js +111 -0
  89. package/dist/composables/useGridKeyboard.js.map +1 -0
  90. package/dist/composables/useGridMenus.js +214 -0
  91. package/dist/composables/useGridMenus.js.map +1 -0
  92. package/dist/composables/useGridSelection.js +75 -0
  93. package/dist/composables/useGridSelection.js.map +1 -0
  94. package/dist/composables/usePinnedOffsets.js +61 -0
  95. package/dist/composables/usePinnedOffsets.js.map +1 -0
  96. package/dist/composables/usePinnedRows.js +58 -0
  97. package/dist/composables/usePinnedRows.js.map +1 -0
  98. package/dist/composables/useScrollEdges.js +27 -0
  99. package/dist/composables/useScrollEdges.js.map +1 -0
  100. package/dist/composables/useSubRows.js +101 -0
  101. package/dist/composables/useSubRows.js.map +1 -0
  102. package/dist/composables/useTotals.js +30 -0
  103. package/dist/composables/useTotals.js.map +1 -0
  104. package/dist/composables/useVirtualRows.js +160 -0
  105. package/dist/composables/useVirtualRows.js.map +1 -0
  106. package/dist/core/aggregate.js +39 -0
  107. package/dist/core/aggregate.js.map +1 -0
  108. package/dist/core/columns.js +106 -0
  109. package/dist/core/columns.js.map +1 -0
  110. package/dist/core/filter.js +218 -0
  111. package/dist/core/filter.js.map +1 -0
  112. package/dist/core/helpers.js +7 -0
  113. package/dist/core/helpers.js.map +1 -0
  114. package/dist/core/pagination.js +25 -0
  115. package/dist/core/pagination.js.map +1 -0
  116. package/dist/core/patch.js +41 -0
  117. package/dist/core/patch.js.map +1 -0
  118. package/dist/core/selection.js +15 -0
  119. package/dist/core/selection.js.map +1 -0
  120. package/dist/core/sort.js +36 -0
  121. package/dist/core/sort.js.map +1 -0
  122. package/dist/core/storage.js +36 -0
  123. package/dist/core/storage.js.map +1 -0
  124. package/dist/core/value.js +19 -0
  125. package/dist/core/value.js.map +1 -0
  126. package/dist/core/virtual.js +83 -0
  127. package/dist/core/virtual.js.map +1 -0
  128. package/dist/core.css +1 -0
  129. package/dist/features/aggregation.js +11 -0
  130. package/dist/features/aggregation.js.map +1 -0
  131. package/dist/features/columnGroups.js +9 -0
  132. package/dist/features/columnGroups.js.map +1 -0
  133. package/dist/features/columnPinning.js +11 -0
  134. package/dist/features/columnPinning.js.map +1 -0
  135. package/dist/features/columnReorder.js +12 -0
  136. package/dist/features/columnReorder.js.map +1 -0
  137. package/dist/features/columnResizing.js +11 -0
  138. package/dist/features/columnResizing.js.map +1 -0
  139. package/dist/features/columnVisibility.js +9 -0
  140. package/dist/features/columnVisibility.js.map +1 -0
  141. package/dist/features/filtering.js +13 -0
  142. package/dist/features/filtering.js.map +1 -0
  143. package/dist/features/index.js +38 -0
  144. package/dist/features/index.js.map +1 -0
  145. package/dist/features/keyboardNavigation.js +9 -0
  146. package/dist/features/keyboardNavigation.js.map +1 -0
  147. package/dist/features/menus.js +11 -0
  148. package/dist/features/menus.js.map +1 -0
  149. package/dist/features/pagination.js +9 -0
  150. package/dist/features/pagination.js.map +1 -0
  151. package/dist/features/rowPinning.js +11 -0
  152. package/dist/features/rowPinning.js.map +1 -0
  153. package/dist/features/selection.js +11 -0
  154. package/dist/features/selection.js.map +1 -0
  155. package/dist/features/serverData.js +9 -0
  156. package/dist/features/serverData.js.map +1 -0
  157. package/dist/features/sorting.js +9 -0
  158. package/dist/features/sorting.js.map +1 -0
  159. package/dist/features/subGrids.js +9 -0
  160. package/dist/features/subGrids.js.map +1 -0
  161. package/dist/features/virtualScrolling.js +9 -0
  162. package/dist/features/virtualScrolling.js.map +1 -0
  163. package/dist/index.js +67 -0
  164. package/dist/internal/RenderSlot.js +6 -0
  165. package/dist/internal/RenderSlot.js.map +1 -0
  166. package/dist/internal/anchor.js +41 -0
  167. package/dist/internal/anchor.js.map +1 -0
  168. package/dist/internal/clipboard.js +11 -0
  169. package/dist/internal/clipboard.js.map +1 -0
  170. package/dist/internal/context.js +11 -0
  171. package/dist/internal/context.js.map +1 -0
  172. package/dist/internal/dev.js +8 -0
  173. package/dist/internal/dev.js.map +1 -0
  174. package/dist/internal/features.js +9 -0
  175. package/dist/internal/features.js.map +1 -0
  176. package/dist/internal/supports.js +10 -0
  177. package/dist/internal/supports.js.map +1 -0
  178. package/dist/internal/touchHold.js +43 -0
  179. package/dist/internal/touchHold.js.map +1 -0
  180. package/dist/registry/plugin.js +25 -0
  181. package/dist/registry/plugin.js.map +1 -0
  182. package/dist/registry/registry.js +15 -0
  183. package/dist/registry/registry.js.map +1 -0
  184. package/dist/renderers/ActionButtonCell.js +6 -0
  185. package/dist/renderers/ActionButtonCell.js.map +1 -0
  186. package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js +44 -0
  187. package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  188. package/dist/renderers/ActionsMenuCell.js +6 -0
  189. package/dist/renderers/ActionsMenuCell.js.map +1 -0
  190. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js +75 -0
  191. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  192. package/dist/renderers/BooleanCell.js +6 -0
  193. package/dist/renderers/BooleanCell.js.map +1 -0
  194. package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js +45 -0
  195. package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  196. package/dist/renderers/ButtonGroupCell.js +6 -0
  197. package/dist/renderers/ButtonGroupCell.js.map +1 -0
  198. package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js +46 -0
  199. package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  200. package/dist/renderers/ChangeCell.js +6 -0
  201. package/dist/renderers/ChangeCell.js.map +1 -0
  202. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js +59 -0
  203. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  204. package/dist/renderers/CheckboxCell.js +6 -0
  205. package/dist/renderers/CheckboxCell.js.map +1 -0
  206. package/dist/renderers/CheckboxCell.vue_vue_type_script_setup_true_lang.js +41 -0
  207. package/dist/renderers/CheckboxCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  208. package/dist/renderers/ChipCell.js +6 -0
  209. package/dist/renderers/ChipCell.js.map +1 -0
  210. package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js +59 -0
  211. package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  212. package/dist/renderers/CodeCell.js +6 -0
  213. package/dist/renderers/CodeCell.js.map +1 -0
  214. package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js +49 -0
  215. package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  216. package/dist/renderers/CopyCell.js +6 -0
  217. package/dist/renderers/CopyCell.js.map +1 -0
  218. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js +51 -0
  219. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  220. package/dist/renderers/CurrencyCell.js +6 -0
  221. package/dist/renderers/CurrencyCell.js.map +1 -0
  222. package/dist/renderers/CurrencyCell.vue_vue_type_script_setup_true_lang.js +38 -0
  223. package/dist/renderers/CurrencyCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  224. package/dist/renderers/DateCell.js +6 -0
  225. package/dist/renderers/DateCell.js.map +1 -0
  226. package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js +30 -0
  227. package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  228. package/dist/renderers/DateTimeCell.js +6 -0
  229. package/dist/renderers/DateTimeCell.js.map +1 -0
  230. package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js +34 -0
  231. package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  232. package/dist/renderers/DetailsCell.js +6 -0
  233. package/dist/renderers/DetailsCell.js.map +1 -0
  234. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js +82 -0
  235. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  236. package/dist/renderers/EditCell.js +6 -0
  237. package/dist/renderers/EditCell.js.map +1 -0
  238. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js +41 -0
  239. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  240. package/dist/renderers/IconCell.js +6 -0
  241. package/dist/renderers/IconCell.js.map +1 -0
  242. package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js +39 -0
  243. package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  244. package/dist/renderers/IconToggleCell.js +6 -0
  245. package/dist/renderers/IconToggleCell.js.map +1 -0
  246. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js +44 -0
  247. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  248. package/dist/renderers/ImageCell.js +6 -0
  249. package/dist/renderers/ImageCell.js.map +1 -0
  250. package/dist/renderers/ImageCell.vue_vue_type_script_setup_true_lang.js +47 -0
  251. package/dist/renderers/ImageCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  252. package/dist/renderers/JsonCell.js +6 -0
  253. package/dist/renderers/JsonCell.js.map +1 -0
  254. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js +47 -0
  255. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  256. package/dist/renderers/JsonTreeCell.js +6 -0
  257. package/dist/renderers/JsonTreeCell.js.map +1 -0
  258. package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js +56 -0
  259. package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  260. package/dist/renderers/JsonTreeNode.js +6 -0
  261. package/dist/renderers/JsonTreeNode.js.map +1 -0
  262. package/dist/renderers/JsonTreeNode.vue_vue_type_script_setup_true_lang.js +80 -0
  263. package/dist/renderers/JsonTreeNode.vue_vue_type_script_setup_true_lang.js.map +1 -0
  264. package/dist/renderers/LinkCell.js +6 -0
  265. package/dist/renderers/LinkCell.js.map +1 -0
  266. package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js +63 -0
  267. package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  268. package/dist/renderers/ListCell.js +6 -0
  269. package/dist/renderers/ListCell.js.map +1 -0
  270. package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js +46 -0
  271. package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  272. package/dist/renderers/MultiLineCell.js +6 -0
  273. package/dist/renderers/MultiLineCell.js.map +1 -0
  274. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js +102 -0
  275. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  276. package/dist/renderers/NumberCell.js +6 -0
  277. package/dist/renderers/NumberCell.js.map +1 -0
  278. package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js +35 -0
  279. package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  280. package/dist/renderers/RadioCell.js +6 -0
  281. package/dist/renderers/RadioCell.js.map +1 -0
  282. package/dist/renderers/RadioCell.vue_vue_type_script_setup_true_lang.js +43 -0
  283. package/dist/renderers/RadioCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  284. package/dist/renderers/StatusCell.js +6 -0
  285. package/dist/renderers/StatusCell.js.map +1 -0
  286. package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js +51 -0
  287. package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  288. package/dist/renderers/SwitchCell.js +6 -0
  289. package/dist/renderers/SwitchCell.js.map +1 -0
  290. package/dist/renderers/SwitchCell.vue_vue_type_script_setup_true_lang.js +41 -0
  291. package/dist/renderers/SwitchCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  292. package/dist/renderers/TextCell.js +6 -0
  293. package/dist/renderers/TextCell.js.map +1 -0
  294. package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js +92 -0
  295. package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  296. package/dist/renderers/ToggleTextCell.js +6 -0
  297. package/dist/renderers/ToggleTextCell.js.map +1 -0
  298. package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js +36 -0
  299. package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  300. package/dist/renderers/format.js +142 -0
  301. package/dist/renderers/format.js.map +1 -0
  302. package/dist/renderers/index.js +188 -0
  303. package/dist/renderers/index.js.map +1 -0
  304. package/dist/renderers/options.js +17 -0
  305. package/dist/renderers/options.js.map +1 -0
  306. package/dist/renderers/parts/CopyButton.js +6 -0
  307. package/dist/renderers/parts/CopyButton.js.map +1 -0
  308. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js +37 -0
  309. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
  310. package/dist/renderers/parts/NumberValue.js +6 -0
  311. package/dist/renderers/parts/NumberValue.js.map +1 -0
  312. package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js +25 -0
  313. package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js.map +1 -0
  314. package/dist/renderers/parts/ValueBadge.js +6 -0
  315. package/dist/renderers/parts/ValueBadge.js.map +1 -0
  316. package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js +17 -0
  317. package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js.map +1 -0
  318. package/dist/renderers/parts/icons.js +27 -0
  319. package/dist/renderers/parts/icons.js.map +1 -0
  320. package/dist/renderers/parts/routerLink.js +9 -0
  321. package/dist/renderers/parts/routerLink.js.map +1 -0
  322. package/dist/renderers/parts/useToggleControl.js +15 -0
  323. package/dist/renderers/parts/useToggleControl.js.map +1 -0
  324. package/dist/renderers/text.js +10 -0
  325. package/dist/renderers/text.js.map +1 -0
  326. package/dist/renderers.css +1 -0
  327. package/dist/theme.css +1 -0
  328. package/dist/types/agent/index.d.ts +50 -0
  329. package/dist/types/agent/requirements.d.ts +17 -0
  330. package/dist/types/agent/validate.d.ts +33 -0
  331. package/dist/types/components/VGrid.vue.d.ts +205 -0
  332. package/dist/types/components/VGridCell.vue.d.ts +19 -0
  333. package/dist/types/components/VGridCheckbox.vue.d.ts +14 -0
  334. package/dist/types/components/VGridColumnMenu.vue.d.ts +22 -0
  335. package/dist/types/components/VGridFilterInput.vue.d.ts +17 -0
  336. package/dist/types/components/VGridFilterPanel.vue.d.ts +20 -0
  337. package/dist/types/components/VGridFilterPopover.vue.d.ts +12 -0
  338. package/dist/types/components/VGridGroupRow.vue.d.ts +3 -0
  339. package/dist/types/components/VGridHeader.vue.d.ts +26 -0
  340. package/dist/types/components/VGridMenu.vue.d.ts +42 -0
  341. package/dist/types/components/VGridPagination.vue.d.ts +27 -0
  342. package/dist/types/components/VGridPinnedRows.vue.d.ts +15 -0
  343. package/dist/types/components/VGridResizeHandle.vue.d.ts +8 -0
  344. package/dist/types/components/VGridRows.vue.d.ts +28 -0
  345. package/dist/types/components/VGridSearch.vue.d.ts +22 -0
  346. package/dist/types/components/VGridTotalCell.vue.d.ts +13 -0
  347. package/dist/types/composables/useColumnDrag.d.ts +26 -0
  348. package/dist/types/composables/useColumnResize.d.ts +29 -0
  349. package/dist/types/composables/useDataSource.d.ts +39 -0
  350. package/dist/types/composables/useGridFilters.d.ts +45 -0
  351. package/dist/types/composables/useGridKeyboard.d.ts +16 -0
  352. package/dist/types/composables/useGridMenus.d.ts +55 -0
  353. package/dist/types/composables/useGridSelection.d.ts +27 -0
  354. package/dist/types/composables/usePinnedOffsets.d.ts +22 -0
  355. package/dist/types/composables/usePinnedRows.d.ts +26 -0
  356. package/dist/types/composables/useScrollEdges.d.ts +8 -0
  357. package/dist/types/composables/useSubRows.d.ts +38 -0
  358. package/dist/types/composables/useTotals.d.ts +17 -0
  359. package/dist/types/composables/useVirtualRows.d.ts +72 -0
  360. package/dist/types/core/aggregate.d.ts +9 -0
  361. package/dist/types/core/columns.d.ts +35 -0
  362. package/dist/types/core/filter.d.ts +85 -0
  363. package/dist/types/core/helpers.d.ts +3 -0
  364. package/dist/types/core/pagination.d.ts +3 -0
  365. package/dist/types/core/patch.d.ts +23 -0
  366. package/dist/types/core/selection.d.ts +8 -0
  367. package/dist/types/core/sort.d.ts +10 -0
  368. package/dist/types/core/storage.d.ts +6 -0
  369. package/dist/types/core/value.d.ts +6 -0
  370. package/dist/types/core/virtual.d.ts +72 -0
  371. package/dist/types/features/aggregation.d.ts +8 -0
  372. package/dist/types/features/columnGroups.d.ts +7 -0
  373. package/dist/types/features/columnPinning.d.ts +7 -0
  374. package/dist/types/features/columnReorder.d.ts +7 -0
  375. package/dist/types/features/columnResizing.d.ts +8 -0
  376. package/dist/types/features/columnVisibility.d.ts +7 -0
  377. package/dist/types/features/filtering.d.ts +7 -0
  378. package/dist/types/features/index.d.ts +20 -0
  379. package/dist/types/features/keyboardNavigation.d.ts +10 -0
  380. package/dist/types/features/menus.d.ts +8 -0
  381. package/dist/types/features/pagination.d.ts +8 -0
  382. package/dist/types/features/rowPinning.d.ts +8 -0
  383. package/dist/types/features/selection.d.ts +6 -0
  384. package/dist/types/features/serverData.d.ts +6 -0
  385. package/dist/types/features/sorting.d.ts +6 -0
  386. package/dist/types/features/subGrids.d.ts +6 -0
  387. package/dist/types/features/virtualScrolling.d.ts +8 -0
  388. package/dist/types/index.d.ts +21 -0
  389. package/dist/types/internal/RenderSlot.d.ts +6 -0
  390. package/dist/types/internal/anchor.d.ts +18 -0
  391. package/dist/types/internal/clipboard.d.ts +2 -0
  392. package/dist/types/internal/context.d.ts +123 -0
  393. package/dist/types/internal/dev.d.ts +1 -0
  394. package/dist/types/internal/features.d.ts +22 -0
  395. package/dist/types/internal/supports.d.ts +11 -0
  396. package/dist/types/internal/touchHold.d.ts +19 -0
  397. package/dist/types/registry/plugin.d.ts +18 -0
  398. package/dist/types/registry/registry.d.ts +18 -0
  399. package/dist/types/renderers/ActionButtonCell.vue.d.ts +10 -0
  400. package/dist/types/renderers/ActionsMenuCell.vue.d.ts +10 -0
  401. package/dist/types/renderers/BooleanCell.vue.d.ts +6 -0
  402. package/dist/types/renderers/ButtonGroupCell.vue.d.ts +10 -0
  403. package/dist/types/renderers/ChangeCell.vue.d.ts +6 -0
  404. package/dist/types/renderers/CheckboxCell.vue.d.ts +10 -0
  405. package/dist/types/renderers/ChipCell.vue.d.ts +6 -0
  406. package/dist/types/renderers/CodeCell.vue.d.ts +6 -0
  407. package/dist/types/renderers/CopyCell.vue.d.ts +10 -0
  408. package/dist/types/renderers/CurrencyCell.vue.d.ts +10 -0
  409. package/dist/types/renderers/DateCell.vue.d.ts +6 -0
  410. package/dist/types/renderers/DateTimeCell.vue.d.ts +6 -0
  411. package/dist/types/renderers/DetailsCell.vue.d.ts +6 -0
  412. package/dist/types/renderers/EditCell.vue.d.ts +10 -0
  413. package/dist/types/renderers/IconCell.vue.d.ts +6 -0
  414. package/dist/types/renderers/IconToggleCell.vue.d.ts +10 -0
  415. package/dist/types/renderers/ImageCell.vue.d.ts +6 -0
  416. package/dist/types/renderers/JsonCell.vue.d.ts +6 -0
  417. package/dist/types/renderers/JsonTreeCell.vue.d.ts +6 -0
  418. package/dist/types/renderers/JsonTreeNode.vue.d.ts +14 -0
  419. package/dist/types/renderers/LinkCell.vue.d.ts +10 -0
  420. package/dist/types/renderers/ListCell.vue.d.ts +10 -0
  421. package/dist/types/renderers/MultiLineCell.vue.d.ts +10 -0
  422. package/dist/types/renderers/NumberCell.vue.d.ts +12 -0
  423. package/dist/types/renderers/RadioCell.vue.d.ts +10 -0
  424. package/dist/types/renderers/StatusCell.vue.d.ts +10 -0
  425. package/dist/types/renderers/SwitchCell.vue.d.ts +10 -0
  426. package/dist/types/renderers/TextCell.vue.d.ts +10 -0
  427. package/dist/types/renderers/ToggleTextCell.vue.d.ts +10 -0
  428. package/dist/types/renderers/format.d.ts +27 -0
  429. package/dist/types/renderers/index.d.ts +132 -0
  430. package/dist/types/renderers/options.d.ts +325 -0
  431. package/dist/types/renderers/parts/CopyButton.vue.d.ts +16 -0
  432. package/dist/types/renderers/parts/NumberValue.vue.d.ts +12 -0
  433. package/dist/types/renderers/parts/ValueBadge.vue.d.ts +7 -0
  434. package/dist/types/renderers/parts/icons.d.ts +21 -0
  435. package/dist/types/renderers/parts/routerLink.d.ts +7 -0
  436. package/dist/types/renderers/parts/useToggleControl.d.ts +12 -0
  437. package/dist/types/renderers/text.d.ts +3 -0
  438. package/dist/types/types.d.ts +383 -0
  439. package/dist/vue-grid.css +1 -0
  440. package/llms-full.txt +1806 -0
  441. package/llms.txt +23 -0
  442. package/package.json +74 -4
@@ -0,0 +1,61 @@
1
+ import { trackSize as e } from "../core/columns.js";
2
+ import { onBeforeUnmount as t, shallowRef as n, watch as r } from "vue";
3
+ // src/composables/usePinnedOffsets.ts
4
+ var i = /^(?:0|-?\d*\.?\d+(?:px|r?em|r?lh|ch|ex|cap|ic|vw|vh|vi|vb|vmin|vmax|cm|mm|q|in|pt|pc)|var\(--[\w-]+\))$/i;
5
+ function a(t) {
6
+ return i.test(e(t).trim());
7
+ }
8
+ function o(t) {
9
+ let n = {};
10
+ for (let r of ["left", "right"]) {
11
+ let i = t.filter((e) => e.pinned === r);
12
+ r === "right" && i.reverse();
13
+ let o = [];
14
+ for (let t of i) if (n[t.key] = o.length ? `calc(${o.join(" + ")})` : "0px", t !== i[i.length - 1]) {
15
+ if (!a(t.def)) return null;
16
+ o.push(e(t.def).trim());
17
+ }
18
+ }
19
+ return n;
20
+ }
21
+ function s(i, a) {
22
+ let s = n({}), c, l = 0, u = (e) => i.value?.querySelector(`:scope > .vg-header > [data-col-key="${CSS.escape(e)}"]`);
23
+ function d(e) {
24
+ let t = s.value;
25
+ (Object.keys(e).length !== Object.keys(t).length || Object.entries(e).some(([e, n]) => t[e] !== n)) && (s.value = e);
26
+ }
27
+ function f() {
28
+ let e = a(), t = {};
29
+ for (let n of ["left", "right"]) {
30
+ let r = e.filter((e) => e.pinned === n);
31
+ n === "right" && r.reverse();
32
+ let i = 0;
33
+ for (let e of r) t[e.key] = `${i}px`, i += u(e.key)?.getBoundingClientRect().width ?? 0;
34
+ }
35
+ d(t);
36
+ }
37
+ function p() {
38
+ cancelAnimationFrame(l), l = requestAnimationFrame(f);
39
+ }
40
+ function m() {
41
+ c?.disconnect();
42
+ let e = a(), t = o(e);
43
+ if (t) return d(t);
44
+ if (typeof ResizeObserver > "u") return d({});
45
+ c ??= new ResizeObserver(p);
46
+ for (let t of e.filter((e) => e.pinned)) {
47
+ let e = u(t.key);
48
+ e && c.observe(e);
49
+ }
50
+ f();
51
+ }
52
+ return r(() => [i.value, a().map((t) => `${t.key}:${t.pinned ?? ""}:${t.pinned ? e(t.def) : ""}`).join("|")], m, {
53
+ flush: "post",
54
+ immediate: !0
55
+ }), t(() => {
56
+ c?.disconnect(), cancelAnimationFrame(l);
57
+ }), s;
58
+ }
59
+ export { o as cssPinOffsets, a as isFixedTrack, s as usePinnedOffsets };
60
+
61
+ //# sourceMappingURL=usePinnedOffsets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePinnedOffsets.js","names":["FIXED_TRACK","isFixedTrack","trackSize","col","cssPinOffsets","out","side","group","columns","c","before","usePinnedOffsets","offsets","shallowRef","observer","frame","headerCell","root","key","set","prev","next","k","v","measure","cols","sum","schedule","update","fromCss","el","watch","onBeforeUnmount"],"sources":["../../src/composables/usePinnedOffsets.ts"],"sourcesContent":["import { onBeforeUnmount, shallowRef, watch, type Ref } from 'vue'\nimport { trackSize } from '../core/columns'\n\ninterface PinnedColumn {\n key: string\n pinned: 'left' | 'right' | undefined\n def: { width?: string; minWidth?: string }\n}\n\n/** A grid track whose size is a definite length, so it can be summed in `calc()`. */\nconst FIXED_TRACK =\n /^(?:0|-?\\d*\\.?\\d+(?:px|r?em|r?lh|ch|ex|cap|ic|vw|vh|vi|vb|vmin|vmax|cm|mm|q|in|pt|pc)|var\\(--[\\w-]+\\))$/i\n\nexport function isFixedTrack(col: PinnedColumn['def']): boolean {\n return FIXED_TRACK.test(trackSize(col).trim())\n}\n\n/** Sticky offsets per column key from the declared widths, or null if any of them depends on content. */\nexport function cssPinOffsets(columns: readonly PinnedColumn[]): Record<string, string> | null {\n const out: Record<string, string> = {}\n for (const side of ['left', 'right'] as const) {\n const group = columns.filter((c) => c.pinned === side)\n if (side === 'right') group.reverse()\n const before: string[] = []\n for (const col of group) {\n out[col.key] = before.length ? `calc(${before.join(' + ')})` : '0px'\n // The outermost column's own width never offsets anything, so only inner ones must be fixed.\n if (col !== group[group.length - 1]) {\n if (!isFixedTrack(col.def)) return null\n before.push(trackSize(col.def).trim())\n }\n }\n }\n return out\n}\n\n/**\n * Sticky offsets (CSS values) per pinned column key.\n *\n * CSS first: when the pinned columns have definite widths (`8rem`, `120px`, `var(--x)`), offsets are\n * plain `calc()` sums of those widths — nothing is measured and the browser keeps them right on zoom,\n * font or density changes. Only when an inner pinned column is content-sized (`auto`, `fr`,\n * `min-content`, `minmax()`) are header cells measured, with one ResizeObserver.\n */\nexport function usePinnedOffsets(\n root: Ref<HTMLElement | undefined>,\n columns: () => PinnedColumn[],\n) {\n const offsets = shallowRef<Record<string, string>>({})\n let observer: ResizeObserver | undefined\n let frame = 0\n\n const headerCell = (key: string) =>\n root.value?.querySelector<HTMLElement>(\n `:scope > .vg-header > [data-col-key=\"${CSS.escape(key)}\"]`,\n )\n\n function set(next: Record<string, string>) {\n const prev = offsets.value\n const changed =\n Object.keys(next).length !== Object.keys(prev).length ||\n Object.entries(next).some(([k, v]) => prev[k] !== v)\n if (changed) offsets.value = next\n }\n\n function measure() {\n const cols = columns()\n const next: Record<string, string> = {}\n for (const side of ['left', 'right'] as const) {\n const group = cols.filter((c) => c.pinned === side)\n if (side === 'right') group.reverse()\n let sum = 0\n for (const col of group) {\n next[col.key] = `${sum}px`\n sum += headerCell(col.key)?.getBoundingClientRect().width ?? 0\n }\n }\n set(next)\n }\n\n function schedule() {\n cancelAnimationFrame(frame)\n frame = requestAnimationFrame(measure)\n }\n\n function update() {\n observer?.disconnect()\n const cols = columns()\n const fromCss = cssPinOffsets(cols)\n if (fromCss) return set(fromCss)\n // JS fallback: content-sized pinned columns.\n if (typeof ResizeObserver === 'undefined') return set({})\n observer ??= new ResizeObserver(schedule)\n for (const col of cols.filter((c) => c.pinned)) {\n const el = headerCell(col.key)\n if (el) observer.observe(el)\n }\n measure()\n }\n\n watch(\n () => [\n root.value,\n columns()\n .map((c) => `${c.key}:${c.pinned ?? ''}:${c.pinned ? trackSize(c.def) : ''}`)\n .join('|'),\n ],\n update,\n { flush: 'post', immediate: true },\n )\n\n onBeforeUnmount(() => {\n observer?.disconnect()\n cancelAnimationFrame(frame)\n })\n\n return offsets\n}\n"],"mappings":";;;AAUA,IAAMA,IACJ;AAEF,SAAgBC,EAAa,GAAmC;CAC9D,OAAOD,EAAY,KAAKE,EAAUC,CAAG,CAAC,CAAC,KAAK,CAAC;AAC/C;AAGA,SAAgBC,EAAc,GAAiE;CAC7F,IAAMC,IAA8B,CAAC;CACrC,KAAK,IAAMC,KAAQ,CAAC,QAAQ,OAAO,GAAY;EAC7C,IAAMC,IAAQC,EAAQ,QAAQ,MAAMC,EAAE,WAAWH,CAAI;EACrD,AAAIA,MAAS,WAASC,EAAM,QAAQ;EACpC,IAAMG,IAAmB,CAAC;EAC1B,KAAK,IAAMP,KAAOI,GAGhB,IAFA,EAAIJ,EAAI,OAAOO,EAAO,SAAS,QAAQA,EAAO,KAAK,KAAK,EAAE,KAAK,OAE3DP,MAAQI,EAAMA,EAAM,SAAS,IAAI;GACnC,IAAI,CAACN,EAAaE,EAAI,GAAG,GAAG,OAAO;GACnC,EAAO,KAAKD,EAAUC,EAAI,GAAG,CAAC,CAAC,KAAK,CAAC;EACvC;CAEJ;CACA,OAAOE;AACT;AAUA,SAAgBM,EACd,GACA,GACA;CACA,IAAMC,IAAUC,EAAmC,CAAC,CAAC,GACjDC,GACAC,IAAQ,GAENC,KAAc,MAClBC,EAAK,OAAO,cACV,wCAAwC,IAAI,OAAOC,CAAG,EAAE,GAC1D;CAEF,SAASC,EAAI,GAA8B;EACzC,IAAMC,IAAOR,EAAQ;EAIrB,CAFE,OAAO,KAAKS,CAAI,C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C,CAC5E,KAAK,GAAG,CACb,GACAmB,GACA;EAAE,OAAO;EAAQ,WAAW;CAAK,CACnC,GAEAI,QAAsB;EAEpB,AADAlB,GAAU,WAAW,GACrB,qBAAqBC,CAAK;CAC5B,CAAC,GAEMH;AACT"}
@@ -0,0 +1,58 @@
1
+ import { computed as e } from "vue";
2
+ // src/composables/usePinnedRows.ts
3
+ function t(t) {
4
+ let n = e(() => t.model.value?.top ?? []), r = e(() => t.model.value?.bottom ?? []), i = e(() => /* @__PURE__ */ new Set([...n.value, ...r.value])), a = /* @__PURE__ */ new Map(), o = e(() => {
5
+ let e = i.value, n = /* @__PURE__ */ new Map();
6
+ if (!e.size) return a.clear(), n;
7
+ let r = t.keyOf();
8
+ for (let i of t.rows()) {
9
+ let t = r(i);
10
+ e.has(t) && n.set(t, i);
11
+ }
12
+ for (let t of [...a.keys()]) e.has(t) || a.delete(t);
13
+ for (let t of e) {
14
+ let e = n.get(t);
15
+ e === void 0 ? a.has(t) && n.set(t, a.get(t)) : a.set(t, e);
16
+ }
17
+ return n;
18
+ }), s = e(() => {
19
+ let e = t.keyOf(), i = (t, n) => (t ?? []).map((t) => {
20
+ let r = e(t);
21
+ return {
22
+ id: `${n}:x:${String(r)}`,
23
+ kind: "row",
24
+ row: t,
25
+ key: r,
26
+ selectable: !1
27
+ };
28
+ }), a = (e, t) => e.flatMap((e) => {
29
+ let n = o.value.get(e);
30
+ return n === void 0 ? [] : [{
31
+ id: `${t}:k:${String(e)}`,
32
+ kind: "row",
33
+ row: n,
34
+ key: e,
35
+ selectable: !0
36
+ }];
37
+ });
38
+ return {
39
+ top: [...i(t.extraTop(), "top"), ...a(n.value, "top")],
40
+ bottom: [...a(r.value, "bottom"), ...i(t.extraBottom(), "bottom")]
41
+ };
42
+ });
43
+ function c(e, i) {
44
+ let a = n.value.filter((t) => t !== e), o = r.value.filter((t) => t !== e);
45
+ i === "top" ? a.push(e) : i === "bottom" && o.push(e), t.model.value = {
46
+ top: a,
47
+ bottom: o
48
+ };
49
+ }
50
+ return {
51
+ keys: i,
52
+ items: s,
53
+ pinRow: c
54
+ };
55
+ }
56
+ export { t as usePinnedRows };
57
+
58
+ //# sourceMappingURL=usePinnedRows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePinnedRows.js","names":["usePinnedRows","topKeys","computed","opts","bottomKeys","keys","cache","byKey","wanted","found","key","row","k","items","extra","rows","side","keyed","list","pinRow","top","bottom"],"sources":["../../src/composables/usePinnedRows.ts"],"sourcesContent":["import { computed, type Ref } from 'vue'\nimport type { PinnedRowItem } from '../internal/context'\nimport type { PinnedRowsState, RowKey } from '../types'\n\nexport interface PinnedRowsOptions<T> {\n /** `v-model:pinned-rows`. */\n model: Ref<PinnedRowsState | null>\n /** The top-level rows pinned rows are looked up in (before filtering). */\n rows: () => readonly T[]\n /** Reads `row-key` once, for passes over many rows. */\n keyOf: () => (row: T) => RowKey\n /** Extra rows above / below the body that aren't in the data. */\n extraTop: () => readonly T[] | undefined\n extraBottom: () => readonly T[] | undefined\n}\n\n/**\n * Row pinning: the rows pinned by key (`v-model:pinned-rows`) and the app's extra pinned rows, as\n * the items of the two sticky sections; the keys the body leaves out; and `pinRow()`.\n */\nexport function usePinnedRows<T>(opts: PinnedRowsOptions<T>) {\n const topKeys = computed<readonly RowKey[]>(() => opts.model.value?.top ?? [])\n const bottomKeys = computed<readonly RowKey[]>(() => opts.model.value?.bottom ?? [])\n /** Keys of the data rows pinned anywhere: the body leaves them out. */\n const keys = computed(() => new Set([...topKeys.value, ...bottomKeys.value]))\n\n // A pinned row the current rows no longer hold (server data: another page) keeps showing its\n // last known version.\n const cache = new Map<RowKey, T>()\n const byKey = computed(() => {\n const wanted = keys.value\n const found = new Map<RowKey, T>()\n if (!wanted.size) {\n cache.clear()\n return found\n }\n const key = opts.keyOf()\n for (const row of opts.rows()) {\n const k = key(row)\n if (wanted.has(k)) found.set(k, row)\n }\n for (const k of [...cache.keys()]) if (!wanted.has(k)) cache.delete(k)\n for (const k of wanted) {\n const row = found.get(k)\n if (row !== undefined) cache.set(k, row)\n else if (cache.has(k)) found.set(k, cache.get(k)!)\n }\n return found\n })\n\n const items = computed(() => {\n const key = opts.keyOf()\n const extra = (rows: readonly T[] | undefined, side: string) =>\n (rows ?? []).map((row): PinnedRowItem => {\n const k = key(row)\n return { id: `${side}:x:${String(k)}`, kind: 'row', row, key: k, selectable: false }\n })\n const keyed = (list: readonly RowKey[], side: string) =>\n list.flatMap((k): PinnedRowItem[] => {\n const row = byKey.value.get(k)\n return row === undefined ? [] : [{ id: `${side}:k:${String(k)}`, kind: 'row', row, key: k, selectable: true }]\n })\n return {\n top: [...extra(opts.extraTop(), 'top'), ...keyed(topKeys.value, 'top')],\n bottom: [...keyed(bottomKeys.value, 'bottom'), ...extra(opts.extraBottom(), 'bottom')],\n }\n })\n\n /** Pins a top-level row above or below the body (`null` unpins it). */\n function pinRow(key: RowKey, side: 'top' | 'bottom' | null) {\n const top = topKeys.value.filter((k) => k !== key)\n const bottom = bottomKeys.value.filter((k) => k !== key)\n if (side === 'top') top.push(key)\n else if (side === 'bottom') bottom.push(key)\n opts.model.value = { top, bottom }\n }\n\n return { keys, items, pinRow }\n}\n"],"mappings":";;AAoBA,SAAgBA,EAAiB,GAA4B;CAC3D,IAAMC,IAAUC,QAAkCC,EAAK,MAAM,OAAO,OAAO,CAAC,CAAC,GACvEC,IAAaF,QAAkCC,EAAK,MAAM,OAAO,UAAU,CAAC,CAAC,GAE7EE,IAAOH,wBAAe,IAAI,IAAI,CAAC,GAAGD,EAAQ,OAAO,GAAGG,EAAW,KAAK,CAAC,CAAC,GAItEE,oBAAQ,IAAI,IAAe,GAC3BC,IAAQL,QAAe;EAC3B,IAAMM,IAASH,EAAK,OACdI,oBAAQ,IAAI,IAAe;EACjC,IAAI,CAACD,EAAO,MAEV,OADAF,EAAM,MAAM,GACLG;EAET,IAAMC,IAAMP,EAAK,MAAM;EACvB,KAAK,IAAMQ,KAAOR,EAAK,KAAK,GAAG;GAC7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,SAASgB,EAAO,GAAa,GAA+B;EAC1D,IAAMC,IAAMnB,EAAQ,MAAM,QAAQ,MAAMW,MAAMF,CAAG,GAC3CW,IAASjB,EAAW,MAAM,QAAQ,MAAMQ,MAAMF,CAAG;EAGvD,AAFIM,MAAS,QAAOI,EAAI,KAAKV,CAAG,IACvBM,MAAS,YAAUK,EAAO,KAAKX,CAAG,GAC3C,EAAK,MAAM,QAAQ;GAAE;GAAK;EAAO;CACnC;CAEA,OAAO;EAAE;EAAM;EAAO;CAAO;AAC/B"}
@@ -0,0 +1,27 @@
1
+ import { supportsScrollState as e } from "../internal/supports.js";
2
+ import { onBeforeUnmount as t, watch as n } from "vue";
3
+ // src/composables/useScrollEdges.ts
4
+ function r(r, i) {
5
+ let a, o;
6
+ function s() {
7
+ if (!o) return;
8
+ let e = o.scrollWidth - o.clientWidth, t = getComputedStyle(o).direction === "rtl" ? e + o.scrollLeft : o.scrollLeft, n = [t > .5 && "left", t < e - .5 && "right"].filter(Boolean).join(" ");
9
+ o.dataset.vgScrollable !== n && (o.dataset.vgScrollable = n);
10
+ }
11
+ let c = 0, l;
12
+ function u() {
13
+ o && o.scrollLeft !== l && (l = o.scrollLeft, cancelAnimationFrame(c), c = requestAnimationFrame(s));
14
+ }
15
+ function d() {
16
+ a?.disconnect(), cancelAnimationFrame(c), l = void 0, o?.removeEventListener("scroll", u), o && delete o.dataset.vgScrollable, o = void 0;
17
+ }
18
+ n(r, (t) => {
19
+ d(), t && !e() && (o = t, o.addEventListener("scroll", u, { passive: !0 }), typeof ResizeObserver < "u" && (a ??= new ResizeObserver(s), a.observe(o)), s());
20
+ }, {
21
+ immediate: !0,
22
+ flush: "post"
23
+ }), n(i, s, { flush: "post" }), t(d);
24
+ }
25
+ export { r as useScrollEdges };
26
+
27
+ //# sourceMappingURL=useScrollEdges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollEdges.js","names":["useScrollEdges","observer","el","update","max","fromLeft","value","frame","lastLeft","onScroll","stop","watch","root","next","layoutKey","onBeforeUnmount"],"sources":["../../src/composables/useScrollEdges.ts"],"sourcesContent":["import { onBeforeUnmount, watch, type Ref } from 'vue'\nimport { supportsScrollState } from '../internal/supports'\n\n/**\n * JS fallback for `@container scroll-state(scrollable: left | right)`: marks the scroll container\n * with `data-vg-scrollable=\"left right\"` (the physical directions it can still scroll to), so pin\n * shadows appear only while content sits under the pinned columns. Does nothing where CSS can query\n * this itself.\n */\nexport function useScrollEdges(root: Ref<HTMLElement | undefined>, layoutKey: () => unknown) {\n let observer: ResizeObserver | undefined\n let el: HTMLElement | undefined\n\n function update() {\n if (!el) return\n const max = el.scrollWidth - el.clientWidth\n // RTL scrollLeft runs from 0 (rightmost) to -max; normalise to \"distance from the left edge\".\n const fromLeft = getComputedStyle(el).direction === 'rtl' ? max + el.scrollLeft : el.scrollLeft\n const value = [fromLeft > 0.5 && 'left', fromLeft < max - 0.5 && 'right']\n .filter(Boolean)\n .join(' ')\n if (el.dataset.vgScrollable !== value) el.dataset.vgScrollable = value\n }\n\n // Scroll events can fire several times per frame; reading the layout once per frame is enough.\n let frame = 0\n let lastLeft: number | undefined\n function onScroll() {\n if (!el || el.scrollLeft === lastLeft) return // vertical scrolling doesn't move the edges\n lastLeft = el.scrollLeft\n cancelAnimationFrame(frame)\n frame = requestAnimationFrame(update)\n }\n\n function stop() {\n observer?.disconnect()\n cancelAnimationFrame(frame)\n lastLeft = undefined\n el?.removeEventListener('scroll', onScroll)\n if (el) delete el.dataset.vgScrollable\n el = undefined\n }\n\n watch(\n root,\n (next) => {\n stop()\n if (!next || supportsScrollState()) return\n el = next\n el.addEventListener('scroll', onScroll, { passive: true })\n if (typeof ResizeObserver !== 'undefined') {\n observer ??= new ResizeObserver(update)\n observer.observe(el)\n }\n update()\n },\n { immediate: true, flush: 'post' },\n )\n // Column widths / order changes alter the scroll width without resizing the container.\n watch(layoutKey, update, { flush: 'post' })\n\n onBeforeUnmount(stop)\n}\n"],"mappings":";;;AASA,SAAgBA,EAAe,GAAoC,GAA0B;CAC3F,IAAIC,GACAC;CAEJ,SAASC,IAAS;EAChB,IAAI,CAACD,GAAI;EACT,IAAME,IAAMF,EAAG,cAAcA,EAAG,aAE1BG,IAAW,iBAAiBH,CAAE,CAAC,CAAC,cAAc,QAAQE,IAAMF,EAAG,aAAaA,EAAG,YAC/EI,IAAQ,CAACD,IAAW,MAAO,QAAQA,IAAWD,IAAM,MAAO,OAAO,CAAC,CACtE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;EACX,AAAIF,EAAG,QAAQ,iBAAiBI,MAAO,EAAG,QAAQ,eAAeA;CACnE;CAGA,IAAIC,IAAQ,GACRC;CACJ,SAASC,IAAW;EAClB,AAAKP,KAAMA,EAAG,eAAeM,MAC7B,IAAWN,EAAG,YACd,qBAAqBK,CAAK,GAC1B,IAAQ,sBAAsBJ,CAAM;CACtC;CAEA,SAASO,IAAO;EAMd,AALAT,GAAU,WAAW,GACrB,qBAAqBM,CAAK,GAC1B,IAAW,KAAA,GACXL,GAAI,oBAAoB,UAAUO,CAAQ,GACtCP,KAAI,OAAOA,EAAG,QAAQ,cAC1B,IAAK,KAAA;CACP;CAoBA,AAlBAS,EACEC,IACC,MAAS;EAER,AADAF,EAAK,GACAG,KAAQ,GAAoB,MACjC,IAAKA,GACLX,EAAG,iBAAiB,UAAUO,GAAU,EAAE,SAAS,GAAK,CAAC,GACrD,OAAO,iBAAmB,QAC5B,MAAa,IAAI,eAAeN,CAAM,GACtCF,EAAS,QAAQC,CAAE,IAErBC,EAAO;CACT,GACA;EAAE,WAAW;EAAM,OAAO;CAAO,CACnC,GAEAQ,EAAMG,GAAWX,GAAQ,EAAE,OAAO,OAAO,CAAC,GAE1CY,EAAgBL,CAAI;AACtB"}
@@ -0,0 +1,101 @@
1
+ import { patchRows as e } from "../core/patch.js";
2
+ import { shallowReactive as t, toRaw as n } from "vue";
3
+ // src/composables/useSubRows.ts
4
+ function r(r) {
5
+ let i = t(/* @__PURE__ */ new Map()), a = /* @__PURE__ */ new Map();
6
+ function o(e) {
7
+ let t = r.subRows()?.(e);
8
+ return Array.isArray(t) ? t : void 0;
9
+ }
10
+ function s(e) {
11
+ let t = o(e);
12
+ if (t) return t;
13
+ let n = i.get(r.getKey(e));
14
+ return n?.status === "loaded" ? n.rows : void 0;
15
+ }
16
+ function c(e) {
17
+ let t = o(e);
18
+ if (t) return t.length > 0;
19
+ if (!r.loadSubRows()) return !1;
20
+ let n = i.get(r.getKey(e));
21
+ if (n?.status === "loaded") return n.rows.length > 0;
22
+ let a = r.hasSubRows();
23
+ return !a || a(e);
24
+ }
25
+ function l(e) {
26
+ let t = r.loadSubRows();
27
+ if (!t) return;
28
+ let n = r.getKey(e), o = (a.get(n) ?? 0) + 1;
29
+ a.set(n, o), i.set(n, { status: "loading" }), Promise.resolve().then(() => t(e)).then((t) => {
30
+ a.get(n) === o && (i.set(n, {
31
+ status: "loaded",
32
+ rows: t ?? []
33
+ }), r.onLoaded?.(e, t ?? []));
34
+ }, (t) => {
35
+ a.get(n) === o && (i.set(n, {
36
+ status: "error",
37
+ error: t
38
+ }), r.onError(e, t));
39
+ });
40
+ }
41
+ function u(e) {
42
+ !o(e) && r.loadSubRows() && (i.has(r.getKey(e)) || l(e));
43
+ }
44
+ function d(e) {
45
+ if (!o(e)) return i.get(r.getKey(e));
46
+ }
47
+ function f(t) {
48
+ let n = 0;
49
+ for (let [a, o] of i) {
50
+ if (o.status !== "loaded") continue;
51
+ let s = e(o.rows, t, r.getKey);
52
+ s !== o.rows && (n += s.filter((e, t) => e !== o.rows[t]).length, i.set(a, {
53
+ status: "loaded",
54
+ rows: s
55
+ }));
56
+ }
57
+ return n;
58
+ }
59
+ function p(e) {
60
+ e === void 0 ? (i.clear(), a.clear()) : (i.delete(e), a.delete(e));
61
+ }
62
+ function m(e = r.getKey) {
63
+ let t = (t) => e(n(t));
64
+ i.size;
65
+ let a = n(i), o = r.subRows(), s = !!r.loadSubRows(), c = r.hasSubRows(), l = (e) => {
66
+ let t = o?.(e);
67
+ return Array.isArray(t) ? t : void 0;
68
+ };
69
+ return {
70
+ children(e) {
71
+ let n = l(e);
72
+ if (n) return n;
73
+ let r = a.get(t(e));
74
+ return r?.status === "loaded" ? r.rows : void 0;
75
+ },
76
+ mayHaveChildren(e) {
77
+ let n = l(e);
78
+ if (n) return n.length > 0;
79
+ if (!s) return !1;
80
+ let r = a.get(t(e));
81
+ return r?.status === "loaded" ? r.rows.length > 0 : !c || c(e);
82
+ },
83
+ state(e) {
84
+ return l(e) ? void 0 : a.get(t(e));
85
+ }
86
+ };
87
+ }
88
+ return {
89
+ children: s,
90
+ mayHaveChildren: c,
91
+ ensure: u,
92
+ retry: l,
93
+ state: d,
94
+ patchLoaded: f,
95
+ clear: p,
96
+ snapshot: m
97
+ };
98
+ }
99
+ export { r as useSubRows };
100
+
101
+ //# sourceMappingURL=useSubRows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSubRows.js","names":["useSubRows","cache","shallowReactive","requestIds","syncChildren","result","opts","row","children","sync","entry","mayHaveChildren","hint","load","loader","key","id","rows","error","ensure","state","patchLoaded","count","next","patchRows","patches","i","clear","snapshot","getKey","keyOf","toRaw","raw","subRows","hasLoader","s"],"sources":["../../src/composables/useSubRows.ts"],"sourcesContent":["import { shallowReactive, toRaw } from 'vue'\nimport { patchRows, type RowPatches } from '../core/patch'\nimport type { RowKey } from '../types'\n\nexport type SubRowEntry =\n | { status: 'loading' }\n | { status: 'loaded'; rows: unknown[] }\n | { status: 'error'; error: unknown }\n\nexport interface SubRowsOptions<T> {\n getKey: (row: T) => RowKey\n subRows: () => ((row: T) => T[] | undefined | null) | undefined\n loadSubRows: () => ((row: T) => Promise<T[]>) | undefined\n hasSubRows: () => ((row: T) => boolean) | undefined\n onError: (row: T, error: unknown) => void\n /** A row's lazy children arrived. */\n onLoaded?: (row: T, rows: T[]) => void\n}\n\n/**\n * Child rows for the sub-grid: synchronous via `subRows(row)`, or lazily via `loadSubRows(row)`\n * (cached per row key, with loading/error states and retry). A synchronous result wins.\n */\nexport function useSubRows<T>(opts: SubRowsOptions<T>) {\n const cache = shallowReactive(new Map<RowKey, SubRowEntry>())\n // Guards against a stale response landing after a retry started a newer request.\n const requestIds = new Map<RowKey, number>()\n\n function syncChildren(row: T): T[] | undefined {\n const result = opts.subRows()?.(row)\n return Array.isArray(result) ? result : undefined\n }\n\n function children(row: T): T[] | undefined {\n const sync = syncChildren(row)\n if (sync) return sync\n const entry = cache.get(opts.getKey(row))\n return entry?.status === 'loaded' ? (entry.rows as T[]) : undefined\n }\n\n function mayHaveChildren(row: T): boolean {\n const sync = syncChildren(row)\n if (sync) return sync.length > 0\n if (!opts.loadSubRows()) return false\n const entry = cache.get(opts.getKey(row))\n if (entry?.status === 'loaded') return entry.rows.length > 0\n const hint = opts.hasSubRows()\n return hint ? hint(row) : true\n }\n\n function load(row: T) {\n const loader = opts.loadSubRows()\n if (!loader) return\n const key = opts.getKey(row)\n const id = (requestIds.get(key) ?? 0) + 1\n requestIds.set(key, id)\n cache.set(key, { status: 'loading' })\n Promise.resolve()\n .then(() => loader(row))\n .then(\n (rows) => {\n if (requestIds.get(key) !== id) return\n cache.set(key, { status: 'loaded', rows: rows ?? [] })\n opts.onLoaded?.(row, rows ?? [])\n },\n (error: unknown) => {\n if (requestIds.get(key) !== id) return\n cache.set(key, { status: 'error', error })\n opts.onError(row, error)\n },\n )\n }\n\n /** Starts loading if this row needs async children and has not been requested yet. */\n function ensure(row: T) {\n if (syncChildren(row) || !opts.loadSubRows()) return\n if (!cache.has(opts.getKey(row))) load(row)\n }\n\n function state(row: T): SubRowEntry | undefined {\n if (syncChildren(row)) return undefined\n return cache.get(opts.getKey(row))\n }\n\n /**\n * Applies field patches to lazily loaded children (they live in this cache, not in the app's\n * data). Immutable: only entries containing a patched row are replaced, so only those rows\n * re-render. Returns how many rows were patched.\n */\n function patchLoaded(patches: RowPatches<T>): number {\n let count = 0\n for (const [key, entry] of cache) {\n if (entry.status !== 'loaded') continue\n const next = patchRows(entry.rows as T[], patches, opts.getKey)\n if (next === entry.rows) continue\n count += next.filter((row, i) => row !== entry.rows[i]).length\n cache.set(key, { status: 'loaded', rows: next })\n }\n return count\n }\n\n /**\n * Forgets loaded children (of one row, or all), so expanded rows load them again. Requests still\n * in flight for them are ignored when they land.\n */\n function clear(key?: RowKey) {\n if (key === undefined) {\n cache.clear()\n requestIds.clear()\n } else {\n cache.delete(key)\n requestIds.delete(key)\n }\n }\n\n /**\n * `children` / `mayHaveChildren` / `state` over plain values, for a pass over many rows (the\n * virtual layout): the props and the cache are read once, with one dependency on the whole cache.\n */\n function snapshot(keyOf: (row: T) => RowKey = opts.getKey) {\n // Keys come from the raw row: reading them through a reactive row would track each one.\n const getKey = (row: T) => keyOf(toRaw(row))\n void cache.size // any change to the cache re-runs the caller\n const raw = toRaw(cache)\n const subRows = opts.subRows()\n const hasLoader = !!opts.loadSubRows()\n const hint = opts.hasSubRows()\n const sync = (row: T): T[] | undefined => {\n const result = subRows?.(row)\n return Array.isArray(result) ? result : undefined\n }\n return {\n children(row: T): T[] | undefined {\n const s = sync(row)\n if (s) return s\n const entry = raw.get(getKey(row))\n return entry?.status === 'loaded' ? (entry.rows as T[]) : undefined\n },\n mayHaveChildren(row: T): boolean {\n const s = sync(row)\n if (s) return s.length > 0\n if (!hasLoader) return false\n const entry = raw.get(getKey(row))\n if (entry?.status === 'loaded') return entry.rows.length > 0\n return hint ? hint(row) : true\n },\n state(row: T): SubRowEntry | undefined {\n return sync(row) ? undefined : raw.get(getKey(row))\n },\n }\n }\n\n return { children, mayHaveChildren, ensure, retry: load, state, patchLoaded, clear, snapshot }\n}\n"],"mappings":";;;AAuBA,SAAgBA,EAAc,GAAyB;CACrD,IAAMC,IAAQC,kBAAgB,IAAI,IAAyB,CAAC,GAEtDC,oBAAa,IAAI,IAAoB;CAE3C,SAASC,EAAa,GAAyB;EAC7C,IAAMC,IAASC,EAAK,QAAQ,CAAC,GAAGC,CAAG;EACnC,OAAO,MAAM,QAA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B,GAAG,OAAOA;IACd,IAAMzB,IAAQsB,EAAI,IAAIH,EAAOtB,CAAG,CAAC;IACjC,OAAOG,GAAO,WAAW,WAAYA,EAAM,OAAe,KAAA;GAC5D;GACA,gBAAgB,GAAiB;IAC/B,IAAMyB,IAAI1B,EAAKF,CAAG;IAClB,IAAI4B,GAAG,OAAOA,EAAE,SAAS;IACzB,IAAI,CAACD,GAAW,OAAO;IACvB,IAAMxB,IAAQsB,EAAI,IAAIH,EAAOtB,CAAG,CAAC;IAEjC,OADIG,GAAO,WAAW,WAAiBA,EAAM,KAAK,SAAS,IACpD,MAAOE,EAAKL,CAAG;GACxB;GACA,MAAM,GAAiC;IACrC,OAAOE,EAAKF,CAAG,IAAI,KAAA,IAAYyB,EAAI,IAAIH,EAAOtB,CAAG,CAAC;GACpD;EACF;CACF;CAEA,OAAO;EAAE;EAAU;EAAiB;EAAQ,OAAOM;EAAM;EAAO;EAAa;EAAO;CAAS;AAC/F"}
@@ -0,0 +1,30 @@
1
+ import { aggregateRows as e } from "../core/aggregate.js";
2
+ import { computed as t } from "vue";
3
+ // src/composables/useTotals.ts
4
+ function n(n) {
5
+ let r = t(() => {
6
+ let e = n.totals();
7
+ return e ? e === "top" ? "top" : "bottom" : null;
8
+ }), i = t(() => {
9
+ if (!r.value) return {};
10
+ let t = n.given(), i = t ? n.columns().filter((e) => !(e.key in t)) : n.columns(), a = e(n.rows(), i);
11
+ return t ? {
12
+ ...a,
13
+ ...t
14
+ } : a;
15
+ });
16
+ return {
17
+ at: r,
18
+ values: i,
19
+ item: t(() => ({
20
+ id: "total",
21
+ kind: "total",
22
+ row: i.value,
23
+ key: "__vg_total",
24
+ selectable: !1
25
+ }))
26
+ };
27
+ }
28
+ export { n as useTotals };
29
+
30
+ //# sourceMappingURL=useTotals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTotals.js","names":["useTotals","at","computed","t","opts","values","given","columns","c","computedValues","aggregateRows"],"sources":["../../src/composables/useTotals.ts"],"sourcesContent":["import { computed } from 'vue'\nimport { aggregateRows } from '../core/aggregate'\nimport type { PinnedRowItem } from '../internal/context'\nimport type { ColumnDef } from '../types'\n\nexport interface TotalsOptions<T> {\n /** The `totals` prop. */\n totals: () => boolean | 'top' | 'bottom' | undefined\n /** The `aggregates` prop: values that win over computed ones. */\n given: () => Record<string, unknown> | undefined\n /** The rows the totals cover (top-level, filtered, every page). */\n rows: () => readonly T[]\n columns: () => readonly ColumnDef<T>[]\n}\n\n/** The aggregation feature's totals row: where it goes, its values, and its pinned-row item. */\nexport function useTotals<T>(opts: TotalsOptions<T>) {\n const at = computed<'top' | 'bottom' | null>(() => {\n const t = opts.totals()\n return !t ? null : t === 'top' ? 'top' : 'bottom'\n })\n const values = computed<Record<string, unknown>>(() => {\n if (!at.value) return {}\n const given = opts.given()\n const columns = given ? opts.columns().filter((c) => !(c.key in given)) : opts.columns()\n const computedValues = aggregateRows(opts.rows(), columns)\n return given ? { ...computedValues, ...given } : computedValues\n })\n const item = computed<PinnedRowItem>(() => ({ id: 'total', kind: 'total', row: values.value, key: '__vg_total', selectable: false }))\n return { at, values, item }\n}\n"],"mappings":";;;AAgBA,SAAgBA,EAAa,GAAwB;CACnD,IAAMC,IAAKC,QAAwC;EACjD,IAAMC,IAAIC,EAAK,OAAO;EACtB,OAAQD,IAAWA,MAAM,QAAQ,QAAQ,WAA7B;CACd,CAAC,GACKE,IAASH,QAAwC;EACrD,IAAI,CAACD,EAAG,OAAO,OAAO,CAAC;EACvB,IAAMK,IAAQF,EAAK,MAAM,GACnBG,IAAUD,IAAQF,EAAK,QAAQ,CAAC,CAAC,QAAQ,MAAM,EAAEI,EAAE,OAAOF,EAAM,IAAIF,EAAK,QAAQ,GACjFK,IAAiBC,EAAcN,EAAK,KAAK,GAAGG,CAAO;EACzD,OAAOD,IAAQ;GAAE,GAAGG;GAAgB,GAAGH;EAAM,IAAIG;CACnD,CAAC;CAED,OAAO;EAAE;EAAI;EAAQ,MADRP,SAA+B;GAAE,IAAI;GAAS,MAAM;GAAS,KAAKG,EAAO;GAAO,KAAK;GAAc,YAAY;EAAM,EAC7G;CAAK;AAC5B"}
@@ -0,0 +1,160 @@
1
+ import { buildLayout as e, locateRow as t, visibleSpan as n } from "../core/virtual.js";
2
+ import { computed as r, onBeforeUnmount as i, ref as a, shallowReactive as o, shallowRef as s, toRaw as c, watch as l } from "vue";
3
+ // src/composables/useVirtualRows.ts
4
+ var u = 150, d = 120;
5
+ function f(f) {
6
+ let p = a(0), m = a(0), h = 0, g, _ = a(!1), v = 0, y = typeof window < "u" && "onscrollend" in window, b = (e) => {
7
+ window.clearTimeout(v), v = window.setTimeout(() => _.value = !1, e);
8
+ }, x = () => b(d);
9
+ function S() {
10
+ if (!f.options()) return;
11
+ let e = f.root.value;
12
+ _.value = !0, b(y ? 600 : u), cancelAnimationFrame(h), h = requestAnimationFrame(() => p.value = e?.scrollTop ?? 0);
13
+ }
14
+ l([f.root, () => !!f.options()], ([e, t], n, r) => {
15
+ g?.disconnect(), e && t && (y && (e.addEventListener("scrollend", x), r(() => e.removeEventListener("scrollend", x))), typeof ResizeObserver < "u" && (g = new ResizeObserver(() => m.value = e.clientHeight), g.observe(e), m.value = e.clientHeight));
16
+ }, { immediate: !0 });
17
+ let C = o(/* @__PURE__ */ new Map()), w = s({
18
+ top: 0,
19
+ bottom: 0
20
+ }), T = /* @__PURE__ */ new WeakMap(), E, D = /* @__PURE__ */ new Map(), O = 0;
21
+ function k() {
22
+ O = 0;
23
+ for (let [e, t] of D) Math.abs((C.get(e) ?? -1) - t) > .5 && C.set(e, t);
24
+ D.clear();
25
+ }
26
+ function A(e, t) {
27
+ t instanceof Element && typeof ResizeObserver < "u" && T.get(t) !== e && (T.set(t, e), E ??= new ResizeObserver((e) => {
28
+ for (let t of e) {
29
+ if (!t.target.isConnected) {
30
+ E?.unobserve(t.target);
31
+ continue;
32
+ }
33
+ let e = T.get(t.target);
34
+ e && D.set(e, t.borderBoxSize?.[0]?.blockSize ?? t.target.getBoundingClientRect().height);
35
+ }
36
+ D.size && !O && (O = requestAnimationFrame(k));
37
+ }), E.observe(t));
38
+ }
39
+ let j = !1;
40
+ function M(e) {
41
+ if (!(e instanceof Element) || j) return;
42
+ j = !0;
43
+ let t = getComputedStyle(e), n = (parseFloat(t.borderTopWidth) || 0) + (parseFloat(t.paddingTop) || 0), r = (parseFloat(t.borderBottomWidth) || 0) + (parseFloat(t.paddingBottom) || 0), i = w.value;
44
+ (i.top !== n || i.bottom !== r) && (w.value = {
45
+ top: n,
46
+ bottom: r
47
+ });
48
+ }
49
+ i(() => {
50
+ g?.disconnect(), E?.disconnect(), cancelAnimationFrame(O), cancelAnimationFrame(h), window.clearTimeout(v);
51
+ });
52
+ let N = r(() => {
53
+ let t = f.options();
54
+ if (!t) return null;
55
+ let n = f.keyOf(), r = (e) => n(c(e)), i = f.expanded(), a = f.subRows()?.(n) ?? null, o = f.hasDetail(), s = f.rowExpandable();
56
+ C.size;
57
+ let l = c(C), u = t.detailHeight ?? t.rowHeight * 4, d = (e) => !!a?.mayHaveChildren(e) || o && (!s || s(e));
58
+ return e({
59
+ rows: f.rows(),
60
+ getKey: n,
61
+ rowHeight: t.rowHeight,
62
+ prepare: f.preparer(),
63
+ isExpanded: (e) => i.has(r(e)) && d(e),
64
+ detailHeight: (e, t) => o ? l.get(`d:${String(t)}`) ?? u : 0,
65
+ subRows: (e) => {
66
+ if (!a) return;
67
+ let t = a.state(e), n = a.children(e);
68
+ if (t || n?.length) return t?.status === "loading" || t?.status === "error" ? { status: t.status } : { children: n ?? [] };
69
+ },
70
+ statusHeight: (e) => l.get(`s:${String(e)}`) ?? t.rowHeight,
71
+ subgridChrome: w.value
72
+ });
73
+ }), P = r(() => {
74
+ let e = f.options();
75
+ if (!e) return null;
76
+ let t = (e.overscan ?? 6) * e.rowHeight, n = m.value || 800;
77
+ return {
78
+ top: p.value - t,
79
+ bottom: p.value + n + t
80
+ };
81
+ }), F = null, I, L, R = () => f.hasDetail() || f.subRows() !== null;
82
+ function z(e) {
83
+ let t = e.querySelector(":scope > .vg-header")?.lastElementChild ?? e.querySelector(".vg-header-cell"), n = t ? t.getBoundingClientRect().bottom : e.getBoundingClientRect().top;
84
+ for (let t of e.querySelectorAll(".vg-row[data-row-key]")) {
85
+ let e = t.firstElementChild?.getBoundingClientRect();
86
+ if (e && e.bottom > n + 1) return {
87
+ key: t.dataset.rowKey,
88
+ offset: e.top - n
89
+ };
90
+ }
91
+ return null;
92
+ }
93
+ let B = () => [N.value, P.value];
94
+ l(B, () => {
95
+ let e = f.rows(), t = f.expanded(), n = e !== I || t !== L;
96
+ I = e, L = t;
97
+ let r = f.root.value;
98
+ F = !n && r && r.scrollTop > 0 && R() ? z(r) : null;
99
+ }, { flush: "pre" }), l(B, () => {
100
+ let e = f.root.value;
101
+ if (!F || !e) return;
102
+ let t = z(e), n = F;
103
+ if (F = null, !t) return;
104
+ let r = t.key === n.key ? t.offset : null;
105
+ if (r === null) {
106
+ let t = e.querySelector(`.vg-row[data-row-key="${CSS.escape(n.key)}"]`), i = e.querySelector(":scope > .vg-header")?.lastElementChild ?? e.querySelector(".vg-header-cell");
107
+ if (!t || !i) return;
108
+ r = t.firstElementChild.getBoundingClientRect().top - i.getBoundingClientRect().bottom;
109
+ }
110
+ let i = Math.round(r - n.offset);
111
+ i && (e.scrollTop += i);
112
+ }, { flush: "post" });
113
+ function V(e) {
114
+ let n = N.value, r = f.options();
115
+ if (!n || !r) return !1;
116
+ let i = t(n, e, f.keyOf(), r.rowHeight, w.value.top);
117
+ return i && f.root.value && (f.root.value.scrollTop = i.top), !0;
118
+ }
119
+ return {
120
+ layout: N,
121
+ onScroll: S,
122
+ scrollToKey: V,
123
+ context: {
124
+ level(e, t, i) {
125
+ let a = r((r) => {
126
+ let i = e(), a = P.value;
127
+ if (!i || !a) return null;
128
+ let o = n(i, a.top - t(), a.bottom - t());
129
+ return r && r.start === o.start && r.end === o.end ? r : o;
130
+ });
131
+ return {
132
+ span: a,
133
+ pads: r(() => {
134
+ let t = e(), n = a.value;
135
+ return t && n ? {
136
+ top: t.tops[n.start],
137
+ bottom: t.height - t.tops[n.end]
138
+ } : null;
139
+ }),
140
+ info(n, r) {
141
+ let a = e(), o = a.detail[n], s = a.sub.get(r), c = f.options() ? f.options().rowHeight : 0;
142
+ return {
143
+ ariaIndex: i() + a.rowsBefore[n],
144
+ childLayout: s?.kind === "rows" ? s.layout : void 0,
145
+ childOffset: t() + a.tops[n] + c + o + w.value.top,
146
+ childAriaBase: i() + a.rowsBefore[n] + 1 + +(o > 0)
147
+ };
148
+ }
149
+ };
150
+ },
151
+ scrolling: _,
152
+ measureDetail: (e) => (t) => A(`d:${String(e)}`, t),
153
+ measureStatus: (e) => (t) => A(`s:${String(e)}`, t),
154
+ measureSubgrid: M
155
+ }
156
+ };
157
+ }
158
+ export { f as useVirtualRows };
159
+
160
+ //# sourceMappingURL=useVirtualRows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVirtualRows.js","names":["SCROLL_IDLE_MS","SETTLE_MS","useVirtualRows","scrollTop","ref","viewportHeight","scrollFrame","resizeObserver","scrolling","idleTimer","hasScrollEnd","settle","ms","onScrollEnd","onScroll","opts","el","on","onCleanup","heights","shallowReactive","subgridChrome","shallowRef","ids","measurer","pending","measureFrame","flushHeights","key","h","measure","id","entry","entries","subgridMeasured","measureSubgrid","cs","top","bottom","prev","layout","computed","v","rawKey","toRaw","row","expandedKeys","tree","detail","rowExpandable","measured","detailEstimate","expandable","buildLayout","k","state","kids","range","pad","height","anchor","lastRows","lastExpanded","variableHeights","firstRowInView","header","cell","renderInputs","watch","rows","expanded","userChange","now","held","offset","drift","scrollToKey","l","at","locateRow","span","levelLayout","r","next","visibleSpan","s","sub","rowHeight","ariaBase"],"sources":["../../src/composables/useVirtualRows.ts"],"sourcesContent":["import {\n computed,\n onBeforeUnmount,\n ref,\n shallowReactive,\n shallowRef,\n toRaw,\n watch,\n type ComputedRef,\n type Ref,\n} from 'vue'\nimport { buildLayout, locateRow, visibleSpan, type LevelLayout } from '../core/virtual'\nimport type { RowKey, VirtualOptions } from '../types'\nimport type { SubRowEntry } from './useSubRows'\n\n/** Plain-value readers over the sub-row cache, for a pass over many rows (see `useSubRows`). */\nexport interface SubRowsSnapshot<T> {\n children(row: T): T[] | undefined\n mayHaveChildren(row: T): boolean\n state(row: T): SubRowEntry | undefined\n}\n\nexport interface VirtualRowsOptions<T> {\n root: Ref<HTMLElement | undefined>\n options: () => VirtualOptions | false | undefined\n /** Top-level rows, filtered and sorted. */\n rows: () => readonly T[]\n /** The row key reader (its reactive inputs read once per layout pass). */\n keyOf: () => (row: T) => RowKey\n expanded: () => ReadonlySet<RowKey>\n /** Tree mode: a factory for a snapshot of the sub-row cache; null without sub-grids. */\n subRows: () => ((keyOf: (row: T) => RowKey) => SubRowsSnapshot<T>) | null\n hasDetail: () => boolean\n rowExpandable: () => ((row: T) => boolean) | undefined\n /** Filters and sorts a child level (its reactive inputs read once per layout pass). */\n preparer: () => (rows: readonly T[]) => readonly T[]\n}\n\n/** The rows area in view (plus overscan), in px from the first row. */\nexport interface VirtualRange {\n top: number\n bottom: number\n}\n\n/** One level of rows in virtual mode (top level, or the children of an expanded row). */\nexport interface VirtualLevel {\n /** Blocks of the level in view; the same object while they don't change. */\n span: ComputedRef<{ start: number; end: number } | null>\n /** Heights of the spacers before and after them. */\n pads: ComputedRef<{ top: number; bottom: number } | null>\n /** Positioning of block `at` (row key `key`) and of its children. */\n info(\n at: number,\n key: RowKey,\n ): { ariaIndex: number; childLayout?: LevelLayout; childOffset: number; childAriaBase: number }\n}\n\n/** What the rows component needs in virtual mode (part of the grid context). */\nexport interface VirtualRowsContext {\n level(\n layout: () => LevelLayout | undefined,\n offset: () => number,\n ariaBase: () => number,\n ): VirtualLevel\n /** A scroll is in progress: lazy sub-rows wait until it settles. */\n scrolling: Readonly<Ref<boolean>>\n /** Function refs measuring a detail row / sub-grid status row / sub-grid container. */\n measureDetail(key: RowKey): (el: unknown) => void\n measureStatus(key: RowKey): (el: unknown) => void\n measureSubgrid(el: unknown): void\n}\n\n/** How long after the last scroll event a scroll counts as finished where `scrollend` is missing. */\nconst SCROLL_IDLE_MS = 150\n/** Quiet time after `scrollend` before a scroll counts as settled (fast flicks end between steps). */\nconst SETTLE_MS = 120\n\n/**\n * Virtual scrolling: lays out the visible tree (rows, detail rows, sub-grids), tracks the scroll\n * position and viewport (the range to render), measures rows whose height isn't fixed, and tells\n * when a scroll has settled. Each level of rows then renders only what's in view, between spacers,\n * inside the same CSS grid / subgrid structure as without virtual scrolling.\n */\nexport function useVirtualRows<T>(opts: VirtualRowsOptions<T>) {\n const scrollTop = ref(0)\n const viewportHeight = ref(0)\n let scrollFrame = 0\n let resizeObserver: ResizeObserver | undefined\n\n // A scroll in progress: lazy sub-rows wait until it settles, so flying past expanded rows doesn't\n // request their children. Settled = `SETTLE_MS` after `scrollend` with no new scrolling (a fast\n // flick fires `scrollend` between wheel steps); without `scrollend`, `SCROLL_IDLE_MS` of quiet.\n const scrolling = ref(false)\n let idleTimer = 0\n const hasScrollEnd = typeof window !== 'undefined' && 'onscrollend' in window\n const settle = (ms: number) => {\n window.clearTimeout(idleTimer)\n idleTimer = window.setTimeout(() => (scrolling.value = false), ms)\n }\n const onScrollEnd = () => settle(SETTLE_MS)\n\n function onScroll() {\n if (!opts.options()) return\n const el = opts.root.value\n scrolling.value = true\n // With `scrollend`, the long timer is only a safety net (loading never stays paused).\n settle(hasScrollEnd ? SCROLL_IDLE_MS * 4 : SCROLL_IDLE_MS)\n cancelAnimationFrame(scrollFrame)\n scrollFrame = requestAnimationFrame(() => (scrollTop.value = el?.scrollTop ?? 0))\n }\n\n watch(\n [opts.root, () => !!opts.options()],\n ([el, on], _, onCleanup) => {\n resizeObserver?.disconnect()\n if (!el || !on) return\n if (hasScrollEnd) {\n el.addEventListener('scrollend', onScrollEnd)\n onCleanup(() => el.removeEventListener('scrollend', onScrollEnd))\n }\n if (typeof ResizeObserver === 'undefined') return\n resizeObserver = new ResizeObserver(() => (viewportHeight.value = el.clientHeight))\n resizeObserver.observe(el)\n viewportHeight.value = el.clientHeight\n },\n { immediate: true },\n )\n\n // ── Measured heights ──────────────────────────────────────────────────────────────────────\n /** Rendered heights by id (`d:<key>` detail rows, `s:<key>` status rows). */\n const heights = shallowReactive(new Map<string, number>())\n /** Border + padding of sub-grid containers, above and below their rows. */\n const subgridChrome = shallowRef({ top: 0, bottom: 0 })\n const ids = new WeakMap<Element, string>()\n let measurer: ResizeObserver | undefined\n // New heights apply on the next frame: applying them inside the observer callback would re-render\n // rows (resizing observed elements again) within the same frame — a \"ResizeObserver loop\" error.\n const pending = new Map<string, number>()\n let measureFrame = 0\n function flushHeights() {\n measureFrame = 0\n for (const [key, h] of pending)\n if (Math.abs((heights.get(key) ?? -1) - h) > 0.5) heights.set(key, h)\n pending.clear()\n }\n\n /** Measures `el` under `id` whenever its size changes. */\n function measure(id: string, el: unknown) {\n if (!(el instanceof Element) || typeof ResizeObserver === 'undefined') return\n if (ids.get(el) === id) return\n ids.set(el, id)\n measurer ??= new ResizeObserver((entries) => {\n for (const entry of entries) {\n // A removed element reports 0: keep its last height (still the best estimate).\n if (!entry.target.isConnected) {\n measurer?.unobserve(entry.target)\n continue\n }\n const key = ids.get(entry.target)\n if (key)\n pending.set(\n key,\n entry.borderBoxSize?.[0]?.blockSize ?? entry.target.getBoundingClientRect().height,\n )\n }\n if (pending.size && !measureFrame) measureFrame = requestAnimationFrame(flushHeights)\n })\n measurer.observe(el)\n }\n\n /**\n * Reads a sub-grid container's border and padding — once: it's the same for every container, and\n * `getComputedStyle` on each one that mounts would force a style recalculation each time.\n */\n let subgridMeasured = false\n function measureSubgrid(el: unknown) {\n if (!(el instanceof Element) || subgridMeasured) return\n subgridMeasured = true\n const cs = getComputedStyle(el)\n const top = (parseFloat(cs.borderTopWidth) || 0) + (parseFloat(cs.paddingTop) || 0)\n const bottom = (parseFloat(cs.borderBottomWidth) || 0) + (parseFloat(cs.paddingBottom) || 0)\n const prev = subgridChrome.value\n if (prev.top !== top || prev.bottom !== bottom) subgridChrome.value = { top, bottom }\n }\n\n onBeforeUnmount(() => {\n resizeObserver?.disconnect()\n measurer?.disconnect()\n cancelAnimationFrame(measureFrame)\n cancelAnimationFrame(scrollFrame)\n window.clearTimeout(idleTimer)\n })\n\n // ── Layout ────────────────────────────────────────────────────────────────────────────────\n /**\n * Heights and positions of every visible row, detail row and sub-grid. Every reactive input is\n * read once here and the pass runs on plain values: reading props, computeds and caches per row\n * would track tens of thousands of dependencies on a big expanded tree (seconds of work).\n */\n const layout = computed<LevelLayout<T> | null>(() => {\n const v = opts.options()\n if (!v) return null\n const key = opts.keyOf()\n const rawKey = (row: T) => key(toRaw(row))\n const expandedKeys = opts.expanded()\n const tree = opts.subRows()?.(key) ?? null\n const detail = opts.hasDetail()\n const rowExpandable = opts.rowExpandable()\n void heights.size // any new or changed height re-runs the layout\n const measured = toRaw(heights)\n const detailEstimate = v.detailHeight ?? v.rowHeight * 4\n const expandable = (row: T) =>\n !!tree?.mayHaveChildren(row) || (detail && (rowExpandable ? rowExpandable(row) : true))\n return buildLayout<T>({\n rows: opts.rows(),\n getKey: key,\n rowHeight: v.rowHeight,\n prepare: opts.preparer(),\n isExpanded: (row) => expandedKeys.has(rawKey(row)) && expandable(row),\n detailHeight: (_row, k) => (detail ? (measured.get(`d:${String(k)}`) ?? detailEstimate) : 0),\n subRows: (row) => {\n if (!tree) return undefined\n const state = tree.state(row)\n const kids = tree.children(row)\n if (!state && !kids?.length) return undefined\n if (state?.status === 'loading' || state?.status === 'error')\n return { status: state.status }\n return { children: kids ?? [] }\n },\n statusHeight: (k) => measured.get(`s:${String(k)}`) ?? v.rowHeight,\n subgridChrome: subgridChrome.value,\n })\n })\n\n const range = computed<VirtualRange | null>(() => {\n const v = opts.options()\n if (!v) return null\n const pad = (v.overscan ?? 6) * v.rowHeight\n // Before the first measurement, render one screen's worth rather than nothing.\n const height = viewportHeight.value || 800\n return { top: scrollTop.value - pad, bottom: scrollTop.value + height + pad }\n })\n\n // ── Holding the view steady ───────────────────────────────────────────────────────────────\n // Rows above the view can change height on their own: a detail row renders at its real height\n // where the layout had an estimate, children finish loading. The rows in view must not move.\n // Browser scroll anchoring can't be relied on here (Firefox doesn't anchor in this grid at all,\n // Chromium only partly), so virtual grids turn it off (`overflow-anchor: none`) and do it\n // themselves: around every re-render of a grid with variable-height rows, note the first row in\n // view, and correct the drift left after the DOM updates. Changes the user makes (rows, sort,\n // filter, expanding) are left alone, and flat grids (fixed-height rows only) skip all of it.\n let anchor: { key: string; offset: number } | null = null\n let lastRows: unknown\n let lastExpanded: unknown\n const variableHeights = () => opts.hasDetail() || opts.subRows() !== null\n function firstRowInView(el: HTMLElement): { key: string; offset: number } | null {\n const header =\n el.querySelector(':scope > .vg-header')?.lastElementChild ??\n el.querySelector('.vg-header-cell')\n const top = header ? header.getBoundingClientRect().bottom : el.getBoundingClientRect().top\n for (const row of el.querySelectorAll<HTMLElement>('.vg-row[data-row-key]')) {\n const cell = row.firstElementChild?.getBoundingClientRect()\n if (cell && cell.bottom > top + 1) return { key: row.dataset.rowKey!, offset: cell.top - top }\n }\n return null\n }\n // `range` moves with the scroll (new rows render), `layout` with heights and loaded children.\n const renderInputs = () => [layout.value, range.value] as const\n watch(\n renderInputs,\n () => {\n const rows = opts.rows()\n const expanded = opts.expanded()\n const userChange = rows !== lastRows || expanded !== lastExpanded\n lastRows = rows\n lastExpanded = expanded\n const el = opts.root.value\n anchor =\n !userChange && el && el.scrollTop > 0 && variableHeights() ? firstRowInView(el) : null\n },\n { flush: 'pre' },\n )\n watch(\n renderInputs,\n () => {\n const el = opts.root.value\n if (!anchor || !el) return\n const now = firstRowInView(el)\n const held = anchor\n anchor = null\n if (!now) return\n // the same row, if it is still the first one in view; otherwise find it\n let offset = now.key === held.key ? now.offset : null\n if (offset === null) {\n const row = el.querySelector<HTMLElement>(`.vg-row[data-row-key=\"${CSS.escape(held.key)}\"]`)\n const header =\n el.querySelector(':scope > .vg-header')?.lastElementChild ??\n el.querySelector('.vg-header-cell')\n if (!row || !header) return\n offset =\n row.firstElementChild!.getBoundingClientRect().top - header.getBoundingClientRect().bottom\n }\n // whole pixels: sub-pixel offsets would otherwise nudge the scroll back and forth\n const drift = Math.round(offset - held.offset)\n if (drift) el.scrollTop += drift\n },\n { flush: 'post' },\n )\n\n /** Scrolls a row (top-level or nested) to just under the header; false when not in virtual mode. */\n function scrollToKey(key: RowKey): boolean {\n const l = layout.value\n const v = opts.options()\n if (!l || !v) return false\n const at = locateRow(l, key, opts.keyOf(), v.rowHeight, subgridChrome.value.top)\n if (at && opts.root.value) opts.root.value.scrollTop = at.top\n return true\n }\n\n const context: VirtualRowsContext = {\n level(levelLayout, offset, ariaBase) {\n const span = computed<{ start: number; end: number } | null>((prev) => {\n const l = levelLayout()\n const r = range.value\n if (!l || !r) return null\n const next = visibleSpan(l, r.top - offset(), r.bottom - offset())\n return prev && prev.start === next.start && prev.end === next.end ? prev : next\n })\n const pads = computed(() => {\n const l = levelLayout()\n const s = span.value\n return l && s ? { top: l.tops[s.start]!, bottom: l.height - l.tops[s.end]! } : null\n })\n return {\n span,\n pads,\n info(at, key) {\n const l = levelLayout()!\n const detail = l.detail[at]!\n const sub = l.sub.get(key)\n const rowHeight = opts.options() ? (opts.options() as VirtualOptions).rowHeight : 0\n return {\n ariaIndex: ariaBase() + l.rowsBefore[at]!,\n childLayout: sub?.kind === 'rows' ? sub.layout : undefined,\n childOffset: offset() + l.tops[at]! + rowHeight + detail + subgridChrome.value.top,\n childAriaBase: ariaBase() + l.rowsBefore[at]! + 1 + (detail > 0 ? 1 : 0),\n }\n },\n }\n },\n scrolling,\n measureDetail: (key) => (el) => measure(`d:${String(key)}`, el),\n measureStatus: (key) => (el) => measure(`s:${String(key)}`, el),\n measureSubgrid,\n }\n\n return { layout, onScroll, scrollToKey, context }\n}\n"],"mappings":";;;AAyEA,IAAMA,IAAiB,KAEjBC,IAAY;AAQlB,SAAgBC,EAAkB,GAA6B;CAC7D,I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AAKR,EAAE,KAAKQ,EAAE;OAAS,QAAQR,EAAE,SAASA,EAAE,KAAKQ,EAAE;MAAM,IAAI;KACjF,CAGE;KACA,KAAK,GAAI,GAAK;MACZ,IAAMR,IAAII,EAAY,GAChBjC,IAAS6B,EAAE,OAAOC,IAClBQ,IAAMT,EAAE,IAAI,IAAIjD,CAAG,GACnB2D,IAAYxE,EAAK,QAAQ,IAAKA,EAAK,QAAQ,CAAC,CAAoB,YAAY;MAClF,OAAO;OACL,WAAWyE,EAAS,IAAIX,EAAE,WAAWC;OACrC,aAAaQ,GAAK,SAAS,SAASA,EAAI,SAAS,KAAA;OACjD,aAAaZ,EAAO,IAAIG,EAAE,KAAKC,KAAOS,IAAYvC,IAAS3B,EAAc,MAAM;OAC/E,eAAemE,EAAS,IAAIX,EAAE,WAAWC,KAAO,IAAK,MAAS;MAChE;KACF;IACF;GACF;GACA;GACA,gBAAgB,OAAS,MAAOhD,EAAQ,KAAK,OAAOF,CAAG,KAAKZ,CAAE;GAC9D,gBAAgB,OAAS,MAAOc,EAAQ,KAAK,OAAOF,CAAG,KAAKZ,CAAE;GAC9D;EAGsC;CAAQ;AAClD"}
@@ -0,0 +1,39 @@
1
+ import { toNumber as e } from "../renderers/format.js";
2
+ import { compareValues as t } from "./sort.js";
3
+ import { getCellValue as n } from "./value.js";
4
+ // src/core/aggregate.ts
5
+ var r = (e) => e == null || e === "" || typeof e == "number" && Number.isNaN(e) || e instanceof Date && Number.isNaN(e.getTime());
6
+ function i(n, i, a) {
7
+ if (typeof n == "function") return n(i, a);
8
+ switch (n) {
9
+ case "count": return a.length;
10
+ case "sum":
11
+ case "avg": {
12
+ let t = 0, r = 0;
13
+ for (let n of i) {
14
+ let i = e(n);
15
+ i !== null && (t += i, r++);
16
+ }
17
+ return r ? n === "sum" ? t : t / r : null;
18
+ }
19
+ case "min":
20
+ case "max": {
21
+ let e = n === "min" ? 1 : -1, a, o = !1;
22
+ for (let n of i) r(n) || ((!o || t(n, a) * e < 0) && (a = n), o = !0);
23
+ return o ? a : null;
24
+ }
25
+ default: return null;
26
+ }
27
+ }
28
+ function a(e, t) {
29
+ let r = {};
30
+ for (let a of t) {
31
+ if (!a.aggregate) continue;
32
+ let t = a.aggregate === "count" ? [] : e.map((e) => n(e, a));
33
+ r[a.key] = i(a.aggregate, t, e);
34
+ }
35
+ return r;
36
+ }
37
+ export { a as aggregateRows, i as aggregateValues };
38
+
39
+ //# sourceMappingURL=aggregate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate.js","names":["isEmpty","v","aggregateValues","aggregate","values","rows","total","n","num","toNumber","sign","best","found","compareValues","aggregateRows","out","col","columns","getCellValue","row"],"sources":["../../src/core/aggregate.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any -- rows are type-erased here; ColumnDef<T> keeps the public API typed. */\nimport { toNumber } from '../renderers/format'\nimport type { ColumnDef } from '../types'\nimport { compareValues } from './sort'\nimport { getCellValue } from './value'\n\n/** Built-in aggregates. `count` is the number of rows; the others skip empty values. */\nexport type AggregateName = 'sum' | 'avg' | 'min' | 'max' | 'count'\n\n/** A custom aggregate: the column's cell values (one per row, in row order) and the rows. */\nexport type AggregateFn<T = any> = (values: unknown[], rows: readonly T[]) => unknown\n\nconst isEmpty = (v: unknown) =>\n v === null ||\n v === undefined ||\n v === '' ||\n (typeof v === 'number' && Number.isNaN(v)) ||\n (v instanceof Date && Number.isNaN(v.getTime()))\n\n/** Applies one aggregate to a column's values. Empty input gives `null` (`0` for `count`). */\nexport function aggregateValues<T>(\n aggregate: AggregateName | AggregateFn<T>,\n values: readonly unknown[],\n rows: readonly T[],\n): unknown {\n if (typeof aggregate === 'function') return aggregate(values as unknown[], rows)\n switch (aggregate) {\n case 'count':\n return rows.length\n case 'sum':\n case 'avg': {\n let total = 0\n let n = 0\n for (const v of values) {\n const num = toNumber(v)\n if (num === null) continue\n total += num\n n++\n }\n if (!n) return null\n return aggregate === 'sum' ? total : total / n\n }\n case 'min':\n case 'max': {\n const sign = aggregate === 'min' ? 1 : -1\n let best: unknown = undefined\n let found = false\n for (const v of values) {\n if (isEmpty(v)) continue\n if (!found || compareValues(v, best) * sign < 0) best = v\n found = true\n }\n return found ? best : null\n }\n default:\n return null\n }\n}\n\n/** The aggregates of every column that has one (`column.aggregate`), by column key. */\nexport function aggregateRows<T>(rows: readonly T[], columns: readonly ColumnDef<T>[]): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const col of columns) {\n if (!col.aggregate) continue\n // `count` needs no values: skip reading every cell.\n const values = col.aggregate === 'count' ? [] : rows.map((row) => getCellValue(row, col))\n out[col.key] = aggregateValues(col.aggregate, values, rows)\n }\n return out\n}\n"],"mappings":";;;;AAYA,IAAMA,KAAW,MACfC,KAAM,QAENA,MAAM,MACL,OAAOA,KAAM,YAAY,OAAO,MAAMA,CAAC,KACvCA,aAAa,QAAQ,OAAO,MAAMA,EAAE,QAAQ,CAAC;AAGhD,SAAgBC,EACd,GACA,GACA,GACS;CACT,IAAI,OAAOC,KAAc,YAAY,OAAOA,EAAUC,GAAqBC,CAAI;CAC/E,QAAQF,GAAR;EACE,KAAK,SACH,OAAOE,EAAK;EACd,KAAK;EACL,KAAK,OAAO;GACV,IAAIC,IAAQ,GACRC,IAAI;GACR,KAAK,IAAMN,KAAKG,GAAQ;IACtB,IAAMI,IAAMC,EAASR,CAAC;IACtB,AAAIO,MAAQ,SACZ,KAASA,GACT;GACF;GAEA,OADKD,IACEJ,MAAc,QAAQG,IAAQA,IAAQC,IAD9B;EAEjB;EACA,KAAK;EACL,KAAK,OAAO;GACV,IAAMG,IAAOP,MAAc,QAAQ,IAAI,IACnCQ,GACAC,IAAQ;GACZ,KAAK,IAAMX,KAAKG,GACd,AAAIJ,EAAQC,CAAC,OACT,CAACW,KAASC,EAAcZ,GAAGU,CAAI,IAAID,IAAO,OAAG,IAAOT,IACxD,IAAQ;GAEV,OAAOW,IAAQD,IAAO;EACxB;EACA,SACE,OAAO;CACX;AACF;AAGA,SAAgBG,EAAiB,GAAoB,GAA2D;CAC9G,IAAMC,IAA+B,CAAC;CACtC,KAAK,IAAMC,KAAOC,GAAS;EACzB,IAAI,CAACD,EAAI,WAAW;EAEpB,IAAMZ,IAASY,EAAI,cAAc,UAAU,CAAC,IAAIX,EAAK,KAAK,MAAQa,EAAaC,GAAKH,CAAG,CAAC;EACxF,EAAIA,EAAI,OAAOd,EAAgBc,EAAI,WAAWZ,GAAQC,CAAI;CAC5D;CACA,OAAOU;AACT"}