@tanstack/table-core 9.0.0-beta.1 → 9.0.0-beta.10

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 (432) hide show
  1. package/dist/core/cells/constructCell.d.cts +1 -1
  2. package/dist/core/cells/constructCell.d.ts +1 -1
  3. package/dist/core/cells/coreCellsFeature.cjs +11 -20
  4. package/dist/core/cells/coreCellsFeature.cjs.map +1 -1
  5. package/dist/core/cells/coreCellsFeature.d.cts +4 -12
  6. package/dist/core/cells/coreCellsFeature.d.ts +4 -12
  7. package/dist/core/cells/coreCellsFeature.js +12 -20
  8. package/dist/core/cells/coreCellsFeature.js.map +1 -1
  9. package/dist/core/cells/coreCellsFeature.types.d.cts +1 -1
  10. package/dist/core/cells/coreCellsFeature.types.d.ts +1 -1
  11. package/dist/core/cells/coreCellsFeature.utils.d.cts +1 -1
  12. package/dist/core/cells/coreCellsFeature.utils.d.ts +1 -1
  13. package/dist/core/columns/constructColumn.d.cts +1 -1
  14. package/dist/core/columns/constructColumn.d.ts +1 -1
  15. package/dist/core/columns/coreColumnsFeature.cjs +59 -68
  16. package/dist/core/columns/coreColumnsFeature.cjs.map +1 -1
  17. package/dist/core/columns/coreColumnsFeature.d.cts +4 -12
  18. package/dist/core/columns/coreColumnsFeature.d.ts +4 -12
  19. package/dist/core/columns/coreColumnsFeature.js +60 -68
  20. package/dist/core/columns/coreColumnsFeature.js.map +1 -1
  21. package/dist/core/columns/coreColumnsFeature.types.d.cts +1 -1
  22. package/dist/core/columns/coreColumnsFeature.types.d.ts +1 -1
  23. package/dist/core/columns/coreColumnsFeature.utils.d.cts +1 -1
  24. package/dist/core/columns/coreColumnsFeature.utils.d.ts +1 -1
  25. package/dist/core/coreFeatures.cjs.map +1 -1
  26. package/dist/core/coreFeatures.d.cts +1 -1
  27. package/dist/core/coreFeatures.d.ts +1 -1
  28. package/dist/core/coreFeatures.js.map +1 -1
  29. package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
  30. package/dist/core/headers/buildHeaderGroups.d.cts +1 -1
  31. package/dist/core/headers/buildHeaderGroups.d.ts +1 -1
  32. package/dist/core/headers/buildHeaderGroups.js.map +1 -1
  33. package/dist/core/headers/constructHeader.d.cts +1 -1
  34. package/dist/core/headers/constructHeader.d.ts +1 -1
  35. package/dist/core/headers/coreHeadersFeature.cjs +44 -53
  36. package/dist/core/headers/coreHeadersFeature.cjs.map +1 -1
  37. package/dist/core/headers/coreHeadersFeature.d.cts +4 -12
  38. package/dist/core/headers/coreHeadersFeature.d.ts +4 -12
  39. package/dist/core/headers/coreHeadersFeature.js +45 -53
  40. package/dist/core/headers/coreHeadersFeature.js.map +1 -1
  41. package/dist/core/headers/coreHeadersFeature.types.d.cts +1 -1
  42. package/dist/core/headers/coreHeadersFeature.types.d.ts +1 -1
  43. package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
  44. package/dist/core/headers/coreHeadersFeature.utils.d.cts +1 -1
  45. package/dist/core/headers/coreHeadersFeature.utils.d.ts +1 -1
  46. package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
  47. package/dist/core/row-models/coreRowModelsFeature.cjs +17 -26
  48. package/dist/core/row-models/coreRowModelsFeature.cjs.map +1 -1
  49. package/dist/core/row-models/coreRowModelsFeature.d.cts +4 -12
  50. package/dist/core/row-models/coreRowModelsFeature.d.ts +4 -12
  51. package/dist/core/row-models/coreRowModelsFeature.js +18 -26
  52. package/dist/core/row-models/coreRowModelsFeature.js.map +1 -1
  53. package/dist/core/row-models/coreRowModelsFeature.types.d.cts +3 -13
  54. package/dist/core/row-models/coreRowModelsFeature.types.d.ts +3 -13
  55. package/dist/core/row-models/coreRowModelsFeature.utils.cjs +13 -13
  56. package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
  57. package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +2 -2
  58. package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +2 -2
  59. package/dist/core/row-models/coreRowModelsFeature.utils.js +13 -13
  60. package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
  61. package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
  62. package/dist/core/row-models/createCoreRowModel.d.cts +1 -1
  63. package/dist/core/row-models/createCoreRowModel.d.ts +1 -1
  64. package/dist/core/row-models/createCoreRowModel.js.map +1 -1
  65. package/dist/core/rows/constructRow.d.cts +1 -1
  66. package/dist/core/rows/constructRow.d.ts +1 -1
  67. package/dist/core/rows/coreRowsFeature.cjs +27 -36
  68. package/dist/core/rows/coreRowsFeature.cjs.map +1 -1
  69. package/dist/core/rows/coreRowsFeature.d.cts +4 -12
  70. package/dist/core/rows/coreRowsFeature.d.ts +4 -12
  71. package/dist/core/rows/coreRowsFeature.js +28 -36
  72. package/dist/core/rows/coreRowsFeature.js.map +1 -1
  73. package/dist/core/rows/coreRowsFeature.types.d.cts +1 -1
  74. package/dist/core/rows/coreRowsFeature.types.d.ts +1 -1
  75. package/dist/core/rows/coreRowsFeature.utils.d.cts +1 -1
  76. package/dist/core/rows/coreRowsFeature.utils.d.ts +1 -1
  77. package/dist/core/table/constructTable.cjs +21 -6
  78. package/dist/core/table/constructTable.cjs.map +1 -1
  79. package/dist/core/table/constructTable.d.cts +1 -1
  80. package/dist/core/table/constructTable.d.ts +1 -1
  81. package/dist/core/table/constructTable.js +21 -6
  82. package/dist/core/table/constructTable.js.map +1 -1
  83. package/dist/core/table/coreTablesFeature.cjs +7 -16
  84. package/dist/core/table/coreTablesFeature.cjs.map +1 -1
  85. package/dist/core/table/coreTablesFeature.d.cts +4 -12
  86. package/dist/core/table/coreTablesFeature.d.ts +4 -12
  87. package/dist/core/table/coreTablesFeature.js +8 -16
  88. package/dist/core/table/coreTablesFeature.js.map +1 -1
  89. package/dist/core/table/coreTablesFeature.types.d.cts +23 -11
  90. package/dist/core/table/coreTablesFeature.types.d.ts +23 -11
  91. package/dist/core/table/coreTablesFeature.utils.cjs +1 -2
  92. package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
  93. package/dist/core/table/coreTablesFeature.utils.d.cts +1 -1
  94. package/dist/core/table/coreTablesFeature.utils.d.ts +1 -1
  95. package/dist/core/table/coreTablesFeature.utils.js +1 -2
  96. package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
  97. package/dist/features/column-faceting/columnFacetingFeature.cjs +49 -61
  98. package/dist/features/column-faceting/columnFacetingFeature.cjs.map +1 -1
  99. package/dist/features/column-faceting/columnFacetingFeature.d.cts +4 -15
  100. package/dist/features/column-faceting/columnFacetingFeature.d.ts +4 -15
  101. package/dist/features/column-faceting/columnFacetingFeature.js +50 -61
  102. package/dist/features/column-faceting/columnFacetingFeature.js.map +1 -1
  103. package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +4 -25
  104. package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +4 -25
  105. package/dist/features/column-faceting/columnFacetingFeature.utils.cjs +12 -12
  106. package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
  107. package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +1 -1
  108. package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +1 -1
  109. package/dist/features/column-faceting/columnFacetingFeature.utils.js +12 -12
  110. package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
  111. package/dist/features/column-faceting/createFacetedMinMaxValues.cjs.map +1 -1
  112. package/dist/features/column-faceting/createFacetedMinMaxValues.d.cts +1 -1
  113. package/dist/features/column-faceting/createFacetedMinMaxValues.d.ts +1 -1
  114. package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
  115. package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
  116. package/dist/features/column-faceting/createFacetedRowModel.d.cts +1 -1
  117. package/dist/features/column-faceting/createFacetedRowModel.d.ts +1 -1
  118. package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
  119. package/dist/features/column-faceting/createFacetedUniqueValues.cjs.map +1 -1
  120. package/dist/features/column-faceting/createFacetedUniqueValues.d.cts +1 -1
  121. package/dist/features/column-faceting/createFacetedUniqueValues.d.ts +1 -1
  122. package/dist/features/column-faceting/createFacetedUniqueValues.js.map +1 -1
  123. package/dist/features/column-filtering/columnFilteringFeature.cjs +40 -53
  124. package/dist/features/column-filtering/columnFilteringFeature.cjs.map +1 -1
  125. package/dist/features/column-filtering/columnFilteringFeature.d.cts +4 -16
  126. package/dist/features/column-filtering/columnFilteringFeature.d.ts +4 -16
  127. package/dist/features/column-filtering/columnFilteringFeature.js +41 -53
  128. package/dist/features/column-filtering/columnFilteringFeature.js.map +1 -1
  129. package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +31 -17
  130. package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +31 -17
  131. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +1 -1
  132. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
  133. package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +2 -2
  134. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +2 -2
  135. package/dist/features/column-filtering/columnFilteringFeature.utils.js +1 -1
  136. package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
  137. package/dist/features/column-filtering/createFilteredRowModel.cjs +4 -2
  138. package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
  139. package/dist/features/column-filtering/createFilteredRowModel.d.cts +5 -3
  140. package/dist/features/column-filtering/createFilteredRowModel.d.ts +5 -3
  141. package/dist/features/column-filtering/createFilteredRowModel.js +4 -2
  142. package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
  143. package/dist/features/column-grouping/columnGroupingFeature.cjs +57 -69
  144. package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
  145. package/dist/features/column-grouping/columnGroupingFeature.d.cts +4 -15
  146. package/dist/features/column-grouping/columnGroupingFeature.d.ts +4 -15
  147. package/dist/features/column-grouping/columnGroupingFeature.js +58 -69
  148. package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
  149. package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +17 -13
  150. package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +17 -13
  151. package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +1 -1
  152. package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +1 -1
  153. package/dist/features/column-grouping/createGroupedRowModel.cjs +5 -2
  154. package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
  155. package/dist/features/column-grouping/createGroupedRowModel.d.cts +6 -3
  156. package/dist/features/column-grouping/createGroupedRowModel.d.ts +6 -3
  157. package/dist/features/column-grouping/createGroupedRowModel.js +5 -2
  158. package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
  159. package/dist/features/column-ordering/columnOrderingFeature.cjs +47 -59
  160. package/dist/features/column-ordering/columnOrderingFeature.cjs.map +1 -1
  161. package/dist/features/column-ordering/columnOrderingFeature.d.cts +4 -15
  162. package/dist/features/column-ordering/columnOrderingFeature.d.ts +4 -15
  163. package/dist/features/column-ordering/columnOrderingFeature.js +48 -59
  164. package/dist/features/column-ordering/columnOrderingFeature.js.map +1 -1
  165. package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +1 -1
  166. package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +1 -1
  167. package/dist/features/column-pinning/columnPinningFeature.cjs +209 -221
  168. package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
  169. package/dist/features/column-pinning/columnPinningFeature.d.cts +4 -15
  170. package/dist/features/column-pinning/columnPinningFeature.d.ts +4 -15
  171. package/dist/features/column-pinning/columnPinningFeature.js +210 -221
  172. package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
  173. package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
  174. package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +13 -13
  175. package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +13 -13
  176. package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
  177. package/dist/features/column-resizing/columnResizingFeature.cjs +31 -43
  178. package/dist/features/column-resizing/columnResizingFeature.cjs.map +1 -1
  179. package/dist/features/column-resizing/columnResizingFeature.d.cts +4 -15
  180. package/dist/features/column-resizing/columnResizingFeature.d.ts +4 -15
  181. package/dist/features/column-resizing/columnResizingFeature.js +32 -43
  182. package/dist/features/column-resizing/columnResizingFeature.js.map +1 -1
  183. package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +1 -1
  184. package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +1 -1
  185. package/dist/features/column-sizing/columnSizingFeature.cjs +112 -125
  186. package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
  187. package/dist/features/column-sizing/columnSizingFeature.d.cts +4 -16
  188. package/dist/features/column-sizing/columnSizingFeature.d.ts +4 -16
  189. package/dist/features/column-sizing/columnSizingFeature.js +113 -125
  190. package/dist/features/column-sizing/columnSizingFeature.js.map +1 -1
  191. package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +4 -4
  192. package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +4 -4
  193. package/dist/features/column-visibility/columnVisibilityFeature.cjs +83 -95
  194. package/dist/features/column-visibility/columnVisibilityFeature.cjs.map +1 -1
  195. package/dist/features/column-visibility/columnVisibilityFeature.d.cts +4 -15
  196. package/dist/features/column-visibility/columnVisibilityFeature.d.ts +4 -15
  197. package/dist/features/column-visibility/columnVisibilityFeature.js +84 -95
  198. package/dist/features/column-visibility/columnVisibilityFeature.js.map +1 -1
  199. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +1 -1
  200. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +1 -1
  201. package/dist/features/global-filtering/globalFilteringFeature.cjs +31 -43
  202. package/dist/features/global-filtering/globalFilteringFeature.cjs.map +1 -1
  203. package/dist/features/global-filtering/globalFilteringFeature.d.cts +4 -15
  204. package/dist/features/global-filtering/globalFilteringFeature.d.ts +4 -15
  205. package/dist/features/global-filtering/globalFilteringFeature.js +32 -43
  206. package/dist/features/global-filtering/globalFilteringFeature.js.map +1 -1
  207. package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +1 -1
  208. package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +1 -1
  209. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
  210. package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +7 -5
  211. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +7 -5
  212. package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
  213. package/dist/features/row-expanding/createExpandedRowModel.cjs.map +1 -1
  214. package/dist/features/row-expanding/createExpandedRowModel.d.cts +1 -1
  215. package/dist/features/row-expanding/createExpandedRowModel.d.ts +1 -1
  216. package/dist/features/row-expanding/createExpandedRowModel.js.map +1 -1
  217. package/dist/features/row-expanding/rowExpandingFeature.cjs +37 -49
  218. package/dist/features/row-expanding/rowExpandingFeature.cjs.map +1 -1
  219. package/dist/features/row-expanding/rowExpandingFeature.d.cts +4 -15
  220. package/dist/features/row-expanding/rowExpandingFeature.d.ts +4 -15
  221. package/dist/features/row-expanding/rowExpandingFeature.js +38 -49
  222. package/dist/features/row-expanding/rowExpandingFeature.js.map +1 -1
  223. package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +1 -10
  224. package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +1 -10
  225. package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +1 -1
  226. package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +1 -1
  227. package/dist/features/row-pagination/createPaginatedRowModel.cjs.map +1 -1
  228. package/dist/features/row-pagination/createPaginatedRowModel.d.cts +1 -1
  229. package/dist/features/row-pagination/createPaginatedRowModel.d.ts +1 -1
  230. package/dist/features/row-pagination/createPaginatedRowModel.js.map +1 -1
  231. package/dist/features/row-pagination/rowPaginationFeature.cjs +35 -47
  232. package/dist/features/row-pagination/rowPaginationFeature.cjs.map +1 -1
  233. package/dist/features/row-pagination/rowPaginationFeature.d.cts +4 -15
  234. package/dist/features/row-pagination/rowPaginationFeature.d.ts +4 -15
  235. package/dist/features/row-pagination/rowPaginationFeature.js +36 -47
  236. package/dist/features/row-pagination/rowPaginationFeature.js.map +1 -1
  237. package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +1 -10
  238. package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +1 -10
  239. package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +1 -1
  240. package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +1 -1
  241. package/dist/features/row-pinning/rowPinningFeature.cjs +55 -67
  242. package/dist/features/row-pinning/rowPinningFeature.cjs.map +1 -1
  243. package/dist/features/row-pinning/rowPinningFeature.d.cts +4 -15
  244. package/dist/features/row-pinning/rowPinningFeature.d.ts +4 -15
  245. package/dist/features/row-pinning/rowPinningFeature.js +56 -67
  246. package/dist/features/row-pinning/rowPinningFeature.js.map +1 -1
  247. package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +1 -1
  248. package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +1 -1
  249. package/dist/features/row-selection/rowSelectionFeature.cjs +65 -77
  250. package/dist/features/row-selection/rowSelectionFeature.cjs.map +1 -1
  251. package/dist/features/row-selection/rowSelectionFeature.d.cts +4 -15
  252. package/dist/features/row-selection/rowSelectionFeature.d.ts +4 -15
  253. package/dist/features/row-selection/rowSelectionFeature.js +66 -77
  254. package/dist/features/row-selection/rowSelectionFeature.js.map +1 -1
  255. package/dist/features/row-selection/rowSelectionFeature.utils.cjs +10 -6
  256. package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
  257. package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +1 -1
  258. package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +1 -1
  259. package/dist/features/row-selection/rowSelectionFeature.utils.js +10 -6
  260. package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
  261. package/dist/features/row-sorting/createSortedRowModel.cjs +4 -2
  262. package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
  263. package/dist/features/row-sorting/createSortedRowModel.d.cts +5 -3
  264. package/dist/features/row-sorting/createSortedRowModel.d.ts +5 -3
  265. package/dist/features/row-sorting/createSortedRowModel.js +4 -2
  266. package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
  267. package/dist/features/row-sorting/rowSortingFeature.cjs +45 -57
  268. package/dist/features/row-sorting/rowSortingFeature.cjs.map +1 -1
  269. package/dist/features/row-sorting/rowSortingFeature.d.cts +4 -15
  270. package/dist/features/row-sorting/rowSortingFeature.d.ts +4 -15
  271. package/dist/features/row-sorting/rowSortingFeature.js +46 -57
  272. package/dist/features/row-sorting/rowSortingFeature.js.map +1 -1
  273. package/dist/features/row-sorting/rowSortingFeature.types.d.cts +16 -13
  274. package/dist/features/row-sorting/rowSortingFeature.types.d.ts +16 -13
  275. package/dist/features/row-sorting/rowSortingFeature.utils.cjs +8 -5
  276. package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
  277. package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +1 -1
  278. package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +1 -1
  279. package/dist/features/row-sorting/rowSortingFeature.utils.js +8 -5
  280. package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
  281. package/dist/fns/aggregationFns.cjs +18 -18
  282. package/dist/fns/aggregationFns.cjs.map +1 -1
  283. package/dist/fns/aggregationFns.d.cts +21 -19
  284. package/dist/fns/aggregationFns.d.ts +21 -19
  285. package/dist/fns/aggregationFns.js +18 -18
  286. package/dist/fns/aggregationFns.js.map +1 -1
  287. package/dist/fns/filterFns.cjs +51 -65
  288. package/dist/fns/filterFns.cjs.map +1 -1
  289. package/dist/fns/filterFns.d.cts +82 -28
  290. package/dist/fns/filterFns.d.ts +82 -28
  291. package/dist/fns/filterFns.js +51 -65
  292. package/dist/fns/filterFns.js.map +1 -1
  293. package/dist/fns/sortFns.cjs +18 -6
  294. package/dist/fns/sortFns.cjs.map +1 -1
  295. package/dist/fns/sortFns.d.cts +15 -13
  296. package/dist/fns/sortFns.d.ts +15 -13
  297. package/dist/fns/sortFns.js +18 -6
  298. package/dist/fns/sortFns.js.map +1 -1
  299. package/dist/helpers/metaHelper.cjs +30 -0
  300. package/dist/helpers/metaHelper.cjs.map +1 -0
  301. package/dist/helpers/metaHelper.d.cts +26 -0
  302. package/dist/helpers/metaHelper.d.ts +26 -0
  303. package/dist/helpers/metaHelper.js +29 -0
  304. package/dist/helpers/metaHelper.js.map +1 -0
  305. package/dist/helpers/tableFeatures.cjs +31 -3
  306. package/dist/helpers/tableFeatures.cjs.map +1 -1
  307. package/dist/helpers/tableFeatures.d.cts +33 -5
  308. package/dist/helpers/tableFeatures.d.ts +33 -5
  309. package/dist/helpers/tableFeatures.js +31 -3
  310. package/dist/helpers/tableFeatures.js.map +1 -1
  311. package/dist/index.cjs +2 -20
  312. package/dist/index.d.cts +44 -43
  313. package/dist/index.d.ts +44 -43
  314. package/dist/index.js +22 -21
  315. package/dist/store-reactivity-bindings.cjs +1 -1
  316. package/dist/store-reactivity-bindings.cjs.map +1 -1
  317. package/dist/store-reactivity-bindings.d.cts +1 -1
  318. package/dist/store-reactivity-bindings.d.ts +1 -1
  319. package/dist/store-reactivity-bindings.js +1 -1
  320. package/dist/store-reactivity-bindings.js.map +1 -1
  321. package/dist/types/Cell.d.cts +7 -9
  322. package/dist/types/Cell.d.ts +7 -9
  323. package/dist/types/Column.d.cts +18 -11
  324. package/dist/types/Column.d.ts +18 -11
  325. package/dist/types/ColumnDef.d.cts +29 -10
  326. package/dist/types/ColumnDef.d.ts +29 -10
  327. package/dist/types/Header.d.cts +9 -10
  328. package/dist/types/Header.d.ts +9 -10
  329. package/dist/types/HeaderGroup.d.cts +3 -8
  330. package/dist/types/HeaderGroup.d.ts +3 -8
  331. package/dist/types/Row.d.cts +14 -10
  332. package/dist/types/Row.d.ts +14 -10
  333. package/dist/types/RowModel.d.cts +19 -19
  334. package/dist/types/RowModel.d.ts +19 -19
  335. package/dist/types/RowModelFns.d.cts +9 -9
  336. package/dist/types/RowModelFns.d.ts +9 -9
  337. package/dist/types/Table.d.cts +25 -15
  338. package/dist/types/Table.d.ts +25 -15
  339. package/dist/types/TableFeatures.d.cts +178 -41
  340. package/dist/types/TableFeatures.d.ts +178 -41
  341. package/dist/types/TableOptions.d.cts +24 -9
  342. package/dist/types/TableOptions.d.ts +24 -9
  343. package/dist/types/TableState.d.cts +22 -13
  344. package/dist/types/TableState.d.ts +22 -13
  345. package/dist/utils.cjs.map +1 -1
  346. package/dist/utils.d.cts +2 -2
  347. package/dist/utils.d.ts +2 -2
  348. package/dist/utils.js.map +1 -1
  349. package/package.json +1 -1
  350. package/skills/column-definitions/SKILL.md +3 -6
  351. package/skills/column-layout/SKILL.md +0 -2
  352. package/skills/customizing-feature-behavior/SKILL.md +63 -56
  353. package/skills/filtering/SKILL.md +60 -42
  354. package/skills/filtering/references/faceting-and-fuzzy.md +59 -32
  355. package/skills/grouping/SKILL.md +49 -54
  356. package/skills/migrate-v8-to-v9/SKILL.md +30 -33
  357. package/skills/pagination/SKILL.md +22 -20
  358. package/skills/row-expanding/SKILL.md +33 -25
  359. package/skills/row-pinning/SKILL.md +11 -7
  360. package/skills/row-selection/SKILL.md +0 -3
  361. package/skills/setup/SKILL.md +55 -65
  362. package/skills/sorting/SKILL.md +21 -21
  363. package/skills/state-management/SKILL.md +40 -25
  364. package/src/core/cells/coreCellsFeature.ts +17 -39
  365. package/src/core/columns/coreColumnsFeature.ts +56 -83
  366. package/src/core/coreFeatures.ts +1 -1
  367. package/src/core/headers/buildHeaderGroups.ts +1 -1
  368. package/src/core/headers/coreHeadersFeature.ts +42 -64
  369. package/src/core/headers/coreHeadersFeature.utils.ts +1 -1
  370. package/src/core/row-models/coreRowModelsFeature.ts +43 -64
  371. package/src/core/row-models/coreRowModelsFeature.types.ts +1 -18
  372. package/src/core/row-models/coreRowModelsFeature.utils.ts +7 -7
  373. package/src/core/row-models/createCoreRowModel.ts +1 -1
  374. package/src/core/rows/coreRowsFeature.ts +45 -72
  375. package/src/core/table/constructTable.ts +49 -12
  376. package/src/core/table/coreTablesFeature.ts +13 -35
  377. package/src/core/table/coreTablesFeature.types.ts +33 -10
  378. package/src/core/table/coreTablesFeature.utils.ts +2 -3
  379. package/src/features/column-faceting/columnFacetingFeature.ts +71 -102
  380. package/src/features/column-faceting/columnFacetingFeature.types.ts +3 -36
  381. package/src/features/column-faceting/columnFacetingFeature.utils.ts +6 -6
  382. package/src/features/column-faceting/createFacetedMinMaxValues.ts +1 -1
  383. package/src/features/column-faceting/createFacetedRowModel.ts +1 -1
  384. package/src/features/column-faceting/createFacetedUniqueValues.ts +1 -1
  385. package/src/features/column-filtering/columnFilteringFeature.ts +60 -103
  386. package/src/features/column-filtering/columnFilteringFeature.types.ts +37 -21
  387. package/src/features/column-filtering/columnFilteringFeature.utils.ts +2 -2
  388. package/src/features/column-filtering/createFilteredRowModel.ts +5 -7
  389. package/src/features/column-grouping/columnGroupingFeature.ts +82 -126
  390. package/src/features/column-grouping/columnGroupingFeature.types.ts +20 -19
  391. package/src/features/column-grouping/createGroupedRowModel.ts +7 -11
  392. package/src/features/column-ordering/columnOrderingFeature.ts +52 -84
  393. package/src/features/column-pinning/columnPinningFeature.ts +268 -304
  394. package/src/features/column-pinning/columnPinningFeature.utils.ts +5 -5
  395. package/src/features/column-resizing/columnResizingFeature.ts +44 -78
  396. package/src/features/column-sizing/columnSizingFeature.ts +115 -152
  397. package/src/features/column-visibility/columnVisibilityFeature.ts +92 -129
  398. package/src/features/global-filtering/globalFilteringFeature.ts +45 -79
  399. package/src/features/global-filtering/globalFilteringFeature.utils.ts +4 -2
  400. package/src/features/row-expanding/createExpandedRowModel.ts +1 -1
  401. package/src/features/row-expanding/rowExpandingFeature.ts +65 -101
  402. package/src/features/row-expanding/rowExpandingFeature.types.ts +0 -14
  403. package/src/features/row-pagination/createPaginatedRowModel.ts +1 -1
  404. package/src/features/row-pagination/rowPaginationFeature.ts +69 -103
  405. package/src/features/row-pagination/rowPaginationFeature.types.ts +0 -14
  406. package/src/features/row-pinning/rowPinningFeature.ts +72 -104
  407. package/src/features/row-selection/rowSelectionFeature.ts +103 -135
  408. package/src/features/row-selection/rowSelectionFeature.utils.ts +12 -7
  409. package/src/features/row-sorting/createSortedRowModel.ts +6 -6
  410. package/src/features/row-sorting/rowSortingFeature.ts +73 -114
  411. package/src/features/row-sorting/rowSortingFeature.types.ts +19 -18
  412. package/src/features/row-sorting/rowSortingFeature.utils.ts +8 -6
  413. package/src/fns/aggregationFns.ts +26 -42
  414. package/src/fns/filterFns.ts +231 -264
  415. package/src/fns/sortFns.ts +51 -29
  416. package/src/helpers/metaHelper.ts +24 -0
  417. package/src/helpers/tableFeatures.ts +36 -5
  418. package/src/index.ts +1 -0
  419. package/src/store-reactivity-bindings.ts +1 -1
  420. package/src/types/Cell.ts +8 -28
  421. package/src/types/Column.ts +18 -53
  422. package/src/types/ColumnDef.ts +44 -45
  423. package/src/types/Header.ts +8 -30
  424. package/src/types/HeaderGroup.ts +2 -13
  425. package/src/types/Row.ts +15 -36
  426. package/src/types/RowModel.ts +21 -111
  427. package/src/types/RowModelFns.ts +11 -30
  428. package/src/types/Table.ts +24 -66
  429. package/src/types/TableFeatures.ts +253 -108
  430. package/src/types/TableOptions.ts +40 -72
  431. package/src/types/TableState.ts +20 -73
  432. package/src/utils.ts +5 -4
@@ -1,7 +1,6 @@
1
1
  import { RowData } from "../../types/type-utils.js";
2
- import { SortFn, SortFns } from "./rowSortingFeature.types.js";
3
- import { TableFeatures } from "../../types/TableFeatures.js";
4
2
  import { Table } from "../../types/Table.js";
3
+ import { TableFeatures } from "../../types/TableFeatures.js";
5
4
  import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
6
5
 
7
6
  //#region src/features/row-sorting/createSortedRowModel.d.ts
@@ -9,8 +8,11 @@ import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
9
8
  * Creates a memoized sorted row model factory.
10
9
  *
11
10
  * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
11
+ *
12
+ * Register sorting functions with the `sortFns` slot on the `features` option:
13
+ * `tableFeatures({ rowSortingFeature, sortedRowModel: createSortedRowModel(), sortFns })`.
12
14
  */
13
- declare function createSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(sortFns: Record<keyof SortFns, SortFn<TFeatures, TData>>): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
15
+ declare function createSortedRowModel<TFeatures extends TableFeatures, TData extends RowData>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
14
16
  //#endregion
15
17
  export { createSortedRowModel };
16
18
  //# sourceMappingURL=createSortedRowModel.d.ts.map
@@ -7,11 +7,13 @@ import { column_getCanSort, column_getSortFn } from "./rowSortingFeature.utils.j
7
7
  * Creates a memoized sorted row model factory.
8
8
  *
9
9
  * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
10
+ *
11
+ * Register sorting functions with the `sortFns` slot on the `features` option:
12
+ * `tableFeatures({ rowSortingFeature, sortedRowModel: createSortedRowModel(), sortFns })`.
10
13
  */
11
- function createSortedRowModel(sortFns) {
14
+ function createSortedRowModel() {
12
15
  return (_table) => {
13
16
  const table = _table;
14
- if (!table._rowModelFns.sortFns) table._rowModelFns.sortFns = sortFns;
15
17
  return tableMemo({
16
18
  feature: "rowSortingFeature",
17
19
  table,
@@ -1 +1 @@
1
- {"version":3,"file":"createSortedRowModel.js","names":[],"sources":["../../../src/features/row-sorting/createSortedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport { column_getCanSort, column_getSortFn } from './rowSortingFeature.utils'\nimport type { Column_Internal } from '../../types/Column'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { SortFn, SortFns } from './rowSortingFeature.types'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized sorted row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createSortedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n sortFns: Record<keyof SortFns, SortFn<TFeatures, TData>>,\n): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table: Table_Internal<TFeatures, TData> = _table\n if (!table._rowModelFns.sortFns) table._rowModelFns.sortFns = sortFns\n return tableMemo({\n feature: 'rowSortingFeature',\n table,\n fnName: 'table.getSortedRowModel',\n memoDeps: () => [\n table.atoms.sorting?.get(),\n table.getPreSortedRowModel(),\n ],\n fn: () => _createSortedRowModel(table),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createSortedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const preSortedRowModel = table.getPreSortedRowModel()\n const sorting = table.atoms.sorting?.get()\n\n if (!preSortedRowModel.rows.length || !sorting?.length) {\n return preSortedRowModel\n }\n\n const sortedFlatRows: Array<Row<TFeatures, TData>> = []\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sorting.filter((sort) =>\n column_getCanSort(\n table.getColumn(sort.id) as Column_Internal<TFeatures, TData>,\n ),\n )\n\n const columnInfoById: Record<\n string,\n {\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n invertSorting?: boolean\n sortFn: SortFn<TFeatures, TData>\n }\n > = {}\n\n availableSorting.forEach((sortEntry) => {\n const column: Column_Internal<TFeatures, TData> | undefined =\n table.getColumn(sortEntry.id)\n if (!column) return\n\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortFn: column_getSortFn(column),\n }\n })\n\n const sortData = (rows: Array<Row<TFeatures, TData>>) => {\n const sortedData = rows.slice()\n\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i++) {\n const sortEntry = availableSorting[i]!\n const columnInfo = columnInfoById[sortEntry.id]!\n const sortUndefined = columnInfo.sortUndefined\n const isDesc = sortEntry.desc\n\n let sortInt = 0\n\n // All sorting ints should always return in ascending order\n if (sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id)\n const bValue = rowB.getValue(sortEntry.id)\n\n const aUndefined = aValue === undefined\n const bUndefined = bValue === undefined\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1\n if (sortUndefined === 'last') return aUndefined ? 1 : -1\n sortInt =\n aUndefined && bUndefined\n ? 0\n : aUndefined\n ? sortUndefined\n : -sortUndefined\n }\n }\n\n if (sortInt === 0) {\n sortInt = columnInfo.sortFn(rowA, rowB, sortEntry.id)\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1\n }\n\n if (columnInfo.invertSorting) {\n sortInt *= -1\n }\n\n return sortInt\n }\n }\n return rowA.index - rowB.index\n })\n\n // If there are sub-rows, sort them. Clone only rows that need mutation\n // (i.e. have subRows) so we don't corrupt the source row model.\n for (let i = 0; i < sortedData.length; i++) {\n const row = sortedData[i]!\n if (row.subRows.length) {\n // Preserve prototype chain so methods like getValue() remain accessible\n const cloned = Object.create(Object.getPrototypeOf(row))\n Object.assign(cloned, row)\n cloned.subRows = sortData(row.subRows)\n sortedData[i] = cloned\n sortedFlatRows.push(cloned)\n } else {\n sortedFlatRows.push(row)\n }\n }\n\n return sortedData\n }\n\n return {\n rows: sortData(preSortedRowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: preSortedRowModel.rowsById,\n }\n}\n"],"mappings":";;;;;;;;;;AAgBA,SAAgB,qBAId,SACsE;CACtE,QAAQ,WAAW;EACjB,MAAM,QAA0C;EAChD,IAAI,CAAC,MAAM,aAAa,SAAS,MAAM,aAAa,UAAU;EAC9D,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;oCACd,MAAM,MAAM,qFAAS,IAAI,GACzB,MAAM,qBAAqB,CAC7B;;GACA,UAAU,sBAAsB,KAAK;GACrC,qBAAqB,yBAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,sBAGP,OAAqE;;CACrE,MAAM,oBAAoB,MAAM,qBAAqB;CACrD,MAAM,mCAAU,MAAM,MAAM,uFAAS,IAAI;CAEzC,IAAI,CAAC,kBAAkB,KAAK,UAAU,oDAAC,QAAS,SAC9C,OAAO;CAGT,MAAM,iBAA+C,CAAC;CAGtD,MAAM,mBAAmB,QAAQ,QAAQ,SACvC,kBACE,MAAM,UAAU,KAAK,EAAE,CACzB,CACF;CAEA,MAAM,iBAOF,CAAC;CAEL,iBAAiB,SAAS,cAAc;EACtC,MAAM,SACJ,MAAM,UAAU,UAAU,EAAE;EAC9B,IAAI,CAAC,QAAQ;EAEb,eAAe,UAAU,MAAM;GAC7B,eAAe,OAAO,UAAU;GAChC,eAAe,OAAO,UAAU;GAChC,QAAQ,iBAAiB,MAAM;EACjC;CACF,CAAC;CAED,MAAM,YAAY,SAAuC;EACvD,MAAM,aAAa,KAAK,MAAM;EAE9B,WAAW,MAAM,MAAM,SAAS;GAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,iBAAiB,QAAQ,KAAK;IAChD,MAAM,YAAY,iBAAiB;IACnC,MAAM,aAAa,eAAe,UAAU;IAC5C,MAAM,gBAAgB,WAAW;IACjC,MAAM,SAAS,UAAU;IAEzB,IAAI,UAAU;IAGd,IAAI,eAAe;KACjB,MAAM,SAAS,KAAK,SAAS,UAAU,EAAE;KACzC,MAAM,SAAS,KAAK,SAAS,UAAU,EAAE;KAEzC,MAAM,aAAa,WAAW;KAC9B,MAAM,aAAa,WAAW;KAE9B,IAAI,cAAc,YAAY;MAC5B,IAAI,kBAAkB,SAAS,OAAO,aAAa,KAAK;MACxD,IAAI,kBAAkB,QAAQ,OAAO,aAAa,IAAI;MACtD,UACE,cAAc,aACV,IACA,aACE,gBACA,CAAC;KACX;IACF;IAEA,IAAI,YAAY,GACd,UAAU,WAAW,OAAO,MAAM,MAAM,UAAU,EAAE;IAItD,IAAI,YAAY,GAAG;KACjB,IAAI,QACF,WAAW;KAGb,IAAI,WAAW,eACb,WAAW;KAGb,OAAO;IACT;GACF;GACA,OAAO,KAAK,QAAQ,KAAK;EAC3B,CAAC;EAID,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;GAC1C,MAAM,MAAM,WAAW;GACvB,IAAI,IAAI,QAAQ,QAAQ;IAEtB,MAAM,SAAS,OAAO,OAAO,OAAO,eAAe,GAAG,CAAC;IACvD,OAAO,OAAO,QAAQ,GAAG;IACzB,OAAO,UAAU,SAAS,IAAI,OAAO;IACrC,WAAW,KAAK;IAChB,eAAe,KAAK,MAAM;GAC5B,OACE,eAAe,KAAK,GAAG;EAE3B;EAEA,OAAO;CACT;CAEA,OAAO;EACL,MAAM,SAAS,kBAAkB,IAAI;EACrC,UAAU;EACV,UAAU,kBAAkB;CAC9B;AACF"}
1
+ {"version":3,"file":"createSortedRowModel.js","names":[],"sources":["../../../src/features/row-sorting/createSortedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport { column_getCanSort, column_getSortFn } from './rowSortingFeature.utils'\nimport type { Column_Internal } from '../../types/Column'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { SortFn } from './rowSortingFeature.types'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized sorted row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n *\n * Register sorting functions with the `sortFns` slot on the `features` option:\n * `tableFeatures({ rowSortingFeature, sortedRowModel: createSortedRowModel(), sortFns })`.\n */\nexport function createSortedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table = _table as unknown as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'rowSortingFeature',\n table,\n fnName: 'table.getSortedRowModel',\n memoDeps: () => [\n table.atoms.sorting?.get(),\n table.getPreSortedRowModel(),\n ],\n fn: () => _createSortedRowModel(table),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createSortedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const preSortedRowModel = table.getPreSortedRowModel()\n const sorting = table.atoms.sorting?.get()\n\n if (!preSortedRowModel.rows.length || !sorting?.length) {\n return preSortedRowModel\n }\n\n const sortedFlatRows: Array<Row<TFeatures, TData>> = []\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sorting.filter((sort) =>\n column_getCanSort(\n table.getColumn(sort.id) as Column_Internal<TFeatures, TData>,\n ),\n )\n\n const columnInfoById: Record<\n string,\n {\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n invertSorting?: boolean\n sortFn: SortFn<TFeatures, TData>\n }\n > = {}\n\n availableSorting.forEach((sortEntry) => {\n const column: Column_Internal<TFeatures, TData> | undefined =\n table.getColumn(sortEntry.id)\n if (!column) return\n\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortFn: column_getSortFn(column),\n }\n })\n\n const sortData = (rows: Array<Row<TFeatures, TData>>) => {\n const sortedData = rows.slice()\n\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i++) {\n const sortEntry = availableSorting[i]!\n const columnInfo = columnInfoById[sortEntry.id]!\n const sortUndefined = columnInfo.sortUndefined\n const isDesc = sortEntry.desc\n\n let sortInt = 0\n\n // All sorting ints should always return in ascending order\n if (sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id)\n const bValue = rowB.getValue(sortEntry.id)\n\n const aUndefined = aValue === undefined\n const bUndefined = bValue === undefined\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1\n if (sortUndefined === 'last') return aUndefined ? 1 : -1\n sortInt =\n aUndefined && bUndefined\n ? 0\n : aUndefined\n ? sortUndefined\n : -sortUndefined\n }\n }\n\n if (sortInt === 0) {\n sortInt = columnInfo.sortFn(rowA, rowB, sortEntry.id)\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1\n }\n\n if (columnInfo.invertSorting) {\n sortInt *= -1\n }\n\n return sortInt\n }\n }\n return rowA.index - rowB.index\n })\n\n // If there are sub-rows, sort them. Clone only rows that need mutation\n // (i.e. have subRows) so we don't corrupt the source row model.\n for (let i = 0; i < sortedData.length; i++) {\n const row = sortedData[i]!\n if (row.subRows.length) {\n // Preserve prototype chain so methods like getValue() remain accessible\n const cloned = Object.create(Object.getPrototypeOf(row))\n Object.assign(cloned, row)\n cloned.subRows = sortData(row.subRows)\n sortedData[i] = cloned\n sortedFlatRows.push(cloned)\n } else {\n sortedFlatRows.push(row)\n }\n }\n\n return sortedData\n }\n\n return {\n rows: sortData(preSortedRowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: preSortedRowModel.rowsById,\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,SAAgB,uBAG0D;CACxE,QAAQ,WAAW;EACjB,MAAM,QAAQ;EACd,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;oCACd,MAAM,MAAM,qFAAS,IAAI,GACzB,MAAM,qBAAqB,CAC7B;;GACA,UAAU,sBAAsB,KAAK;GACrC,qBAAqB,yBAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,sBAGP,OAAqE;;CACrE,MAAM,oBAAoB,MAAM,qBAAqB;CACrD,MAAM,mCAAU,MAAM,MAAM,uFAAS,IAAI;CAEzC,IAAI,CAAC,kBAAkB,KAAK,UAAU,oDAAC,QAAS,SAC9C,OAAO;CAGT,MAAM,iBAA+C,CAAC;CAGtD,MAAM,mBAAmB,QAAQ,QAAQ,SACvC,kBACE,MAAM,UAAU,KAAK,EAAE,CACzB,CACF;CAEA,MAAM,iBAOF,CAAC;CAEL,iBAAiB,SAAS,cAAc;EACtC,MAAM,SACJ,MAAM,UAAU,UAAU,EAAE;EAC9B,IAAI,CAAC,QAAQ;EAEb,eAAe,UAAU,MAAM;GAC7B,eAAe,OAAO,UAAU;GAChC,eAAe,OAAO,UAAU;GAChC,QAAQ,iBAAiB,MAAM;EACjC;CACF,CAAC;CAED,MAAM,YAAY,SAAuC;EACvD,MAAM,aAAa,KAAK,MAAM;EAE9B,WAAW,MAAM,MAAM,SAAS;GAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,iBAAiB,QAAQ,KAAK;IAChD,MAAM,YAAY,iBAAiB;IACnC,MAAM,aAAa,eAAe,UAAU;IAC5C,MAAM,gBAAgB,WAAW;IACjC,MAAM,SAAS,UAAU;IAEzB,IAAI,UAAU;IAGd,IAAI,eAAe;KACjB,MAAM,SAAS,KAAK,SAAS,UAAU,EAAE;KACzC,MAAM,SAAS,KAAK,SAAS,UAAU,EAAE;KAEzC,MAAM,aAAa,WAAW;KAC9B,MAAM,aAAa,WAAW;KAE9B,IAAI,cAAc,YAAY;MAC5B,IAAI,kBAAkB,SAAS,OAAO,aAAa,KAAK;MACxD,IAAI,kBAAkB,QAAQ,OAAO,aAAa,IAAI;MACtD,UACE,cAAc,aACV,IACA,aACE,gBACA,CAAC;KACX;IACF;IAEA,IAAI,YAAY,GACd,UAAU,WAAW,OAAO,MAAM,MAAM,UAAU,EAAE;IAItD,IAAI,YAAY,GAAG;KACjB,IAAI,QACF,WAAW;KAGb,IAAI,WAAW,eACb,WAAW;KAGb,OAAO;IACT;GACF;GACA,OAAO,KAAK,QAAQ,KAAK;EAC3B,CAAC;EAID,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;GAC1C,MAAM,MAAM,WAAW;GACvB,IAAI,IAAI,QAAQ,QAAQ;IAEtB,MAAM,SAAS,OAAO,OAAO,OAAO,eAAe,GAAG,CAAC;IACvD,OAAO,OAAO,QAAQ,GAAG;IACzB,OAAO,UAAU,SAAS,IAAI,OAAO;IACrC,WAAW,KAAK;IAChB,eAAe,KAAK,MAAM;GAC5B,OACE,eAAe,KAAK,GAAG;EAE3B;EAEA,OAAO;CACT;CAEA,OAAO;EACL,MAAM,SAAS,kBAAkB,IAAI;EACrC,UAAU;EACV,UAAU,kBAAkB;CAC9B;AACF"}
@@ -3,65 +3,53 @@ const require_rowSortingFeature_utils = require('./rowSortingFeature.utils.cjs')
3
3
 
4
4
  //#region src/features/row-sorting/rowSortingFeature.ts
5
5
  /**
6
- * Creates the stock row sorting feature.
7
- *
8
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
6
+ * Feature that adds row sorting state, defaults, and column/table sorting APIs.
9
7
  */
10
- function constructRowSortingFeature() {
11
- return {
12
- getInitialState(initialState) {
13
- return {
14
- sorting: require_rowSortingFeature_utils.getDefaultSortingState(),
15
- ...initialState
16
- };
17
- },
18
- getDefaultColumnDef() {
19
- return {
20
- sortFn: "auto",
21
- sortUndefined: 1
22
- };
23
- },
24
- getDefaultTableOptions(table) {
25
- return {
26
- onSortingChange: require_utils.makeStateUpdater("sorting", table),
27
- isMultiSortEvent: (e) => {
28
- return e.shiftKey;
29
- }
30
- };
31
- },
32
- assignColumnPrototype(prototype, table) {
33
- require_utils.assignPrototypeAPIs("rowSortingFeature", prototype, table, {
34
- column_getAutoSortFn: { fn: (column) => require_rowSortingFeature_utils.column_getAutoSortFn(column) },
35
- column_getAutoSortDir: { fn: (column) => require_rowSortingFeature_utils.column_getAutoSortDir(column) },
36
- column_getSortFn: { fn: (column) => require_rowSortingFeature_utils.column_getSortFn(column) },
37
- column_toggleSorting: { fn: (column, desc, multi) => require_rowSortingFeature_utils.column_toggleSorting(column, desc, multi) },
38
- column_getFirstSortDir: { fn: (column) => require_rowSortingFeature_utils.column_getFirstSortDir(column) },
39
- column_getNextSortingOrder: { fn: (column, multi) => require_rowSortingFeature_utils.column_getNextSortingOrder(column, multi) },
40
- column_getCanSort: { fn: (column) => require_rowSortingFeature_utils.column_getCanSort(column) },
41
- column_getCanMultiSort: { fn: (column) => require_rowSortingFeature_utils.column_getCanMultiSort(column) },
42
- column_getIsSorted: { fn: (column) => require_rowSortingFeature_utils.column_getIsSorted(column) },
43
- column_getSortIndex: { fn: (column) => require_rowSortingFeature_utils.column_getSortIndex(column) },
44
- column_clearSorting: { fn: (column) => require_rowSortingFeature_utils.column_clearSorting(column) },
45
- column_getToggleSortingHandler: { fn: (column) => require_rowSortingFeature_utils.column_getToggleSortingHandler(column) }
46
- });
47
- },
48
- constructTableAPIs(table) {
49
- require_utils.assignTableAPIs("rowSortingFeature", table, {
50
- table_setSorting: { fn: (updater) => require_rowSortingFeature_utils.table_setSorting(table, updater) },
51
- table_resetSorting: { fn: (defaultState) => require_rowSortingFeature_utils.table_resetSorting(table, defaultState) }
52
- });
53
- }
54
- };
55
- }
56
- /**
57
- * The stock row sorting feature.
58
- *
59
- * Register this feature to add sorting state, column sorting APIs, and sorted
60
- * row-model support for client-side or manual sorting.
61
- */
62
- const rowSortingFeature = constructRowSortingFeature();
8
+ const rowSortingFeature = {
9
+ getInitialState(initialState) {
10
+ return {
11
+ sorting: require_rowSortingFeature_utils.getDefaultSortingState(),
12
+ ...initialState
13
+ };
14
+ },
15
+ getDefaultColumnDef() {
16
+ return {
17
+ sortFn: "auto",
18
+ sortUndefined: 1
19
+ };
20
+ },
21
+ getDefaultTableOptions(table) {
22
+ return {
23
+ onSortingChange: require_utils.makeStateUpdater("sorting", table),
24
+ isMultiSortEvent: (e) => {
25
+ return e.shiftKey;
26
+ }
27
+ };
28
+ },
29
+ assignColumnPrototype(prototype, table) {
30
+ require_utils.assignPrototypeAPIs("rowSortingFeature", prototype, table, {
31
+ column_getAutoSortFn: { fn: (column) => require_rowSortingFeature_utils.column_getAutoSortFn(column) },
32
+ column_getAutoSortDir: { fn: (column) => require_rowSortingFeature_utils.column_getAutoSortDir(column) },
33
+ column_getSortFn: { fn: (column) => require_rowSortingFeature_utils.column_getSortFn(column) },
34
+ column_toggleSorting: { fn: (column, desc, multi) => require_rowSortingFeature_utils.column_toggleSorting(column, desc, multi) },
35
+ column_getFirstSortDir: { fn: (column) => require_rowSortingFeature_utils.column_getFirstSortDir(column) },
36
+ column_getNextSortingOrder: { fn: (column, multi) => require_rowSortingFeature_utils.column_getNextSortingOrder(column, multi) },
37
+ column_getCanSort: { fn: (column) => require_rowSortingFeature_utils.column_getCanSort(column) },
38
+ column_getCanMultiSort: { fn: (column) => require_rowSortingFeature_utils.column_getCanMultiSort(column) },
39
+ column_getIsSorted: { fn: (column) => require_rowSortingFeature_utils.column_getIsSorted(column) },
40
+ column_getSortIndex: { fn: (column) => require_rowSortingFeature_utils.column_getSortIndex(column) },
41
+ column_clearSorting: { fn: (column) => require_rowSortingFeature_utils.column_clearSorting(column) },
42
+ column_getToggleSortingHandler: { fn: (column) => require_rowSortingFeature_utils.column_getToggleSortingHandler(column) }
43
+ });
44
+ },
45
+ constructTableAPIs(table) {
46
+ require_utils.assignTableAPIs("rowSortingFeature", table, {
47
+ table_setSorting: { fn: (updater) => require_rowSortingFeature_utils.table_setSorting(table, updater) },
48
+ table_resetSorting: { fn: (defaultState) => require_rowSortingFeature_utils.table_resetSorting(table, defaultState) }
49
+ });
50
+ }
51
+ };
63
52
 
64
53
  //#endregion
65
- exports.constructRowSortingFeature = constructRowSortingFeature;
66
54
  exports.rowSortingFeature = rowSortingFeature;
67
55
  //# sourceMappingURL=rowSortingFeature.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rowSortingFeature.cjs","names":["getDefaultSortingState","makeStateUpdater","column_getAutoSortFn","column_getAutoSortDir","column_getSortFn","column_toggleSorting","column_getFirstSortDir","column_getNextSortingOrder","column_getCanSort","column_getCanMultiSort","column_getIsSorted","column_getSortIndex","column_clearSorting","column_getToggleSortingHandler","table_setSorting","table_resetSorting"],"sources":["../../../src/features/row-sorting/rowSortingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n makeStateUpdater,\n} from '../../utils'\nimport {\n column_clearSorting,\n column_getAutoSortDir,\n column_getAutoSortFn,\n column_getCanMultiSort,\n column_getCanSort,\n column_getFirstSortDir,\n column_getIsSorted,\n column_getNextSortingOrder,\n column_getSortFn,\n column_getSortIndex,\n column_getToggleSortingHandler,\n column_toggleSorting,\n getDefaultSortingState,\n table_resetSorting,\n table_setSorting,\n} from './rowSortingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type {\n// CachedRowModel_Sorted,\n// ColumnDef_RowSorting,\n// Column_RowSorting,\n// CreateRowModel_Sorted,\n// RowModelFns_RowSorting,\n// TableOptions_RowSorting,\n// TableState_RowSorting,\n// Table_RowSorting,\n// } from './rowSortingFeature.types'\n\nexport interface RowSortingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Sorted<TFeatures, TData>\n // Column: Column_RowSorting<TFeatures, TData>\n // ColumnDef: ColumnDef_RowSorting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Sorted<TFeatures, TData>\n // RowModelFns: RowModelFns_RowSorting<TFeatures, TData>\n // Table: Table_RowSorting<TFeatures, TData>\n // TableOptions: TableOptions_RowSorting\n // TableState: TableState_RowSorting\n}\n\n/**\n * Creates the stock row sorting feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructRowSortingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<RowSortingFeatureConstructors<TFeatures, TData>> {\n return {\n getInitialState(initialState) {\n return {\n sorting: getDefaultSortingState(),\n ...initialState,\n }\n },\n\n getDefaultColumnDef() {\n return {\n sortFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultTableOptions(table) {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n assignColumnPrototype(prototype, table) {\n assignPrototypeAPIs('rowSortingFeature', prototype, table, {\n column_getAutoSortFn: {\n fn: (column) => column_getAutoSortFn(column),\n },\n column_getAutoSortDir: {\n fn: (column) => column_getAutoSortDir(column),\n },\n column_getSortFn: {\n fn: (column) => column_getSortFn(column),\n },\n column_toggleSorting: {\n fn: (column, desc, multi) =>\n column_toggleSorting(column, desc, multi),\n },\n column_getFirstSortDir: {\n fn: (column) => column_getFirstSortDir(column),\n },\n column_getNextSortingOrder: {\n fn: (column, multi) => column_getNextSortingOrder(column, multi),\n },\n column_getCanSort: {\n fn: (column) => column_getCanSort(column),\n },\n column_getCanMultiSort: {\n fn: (column) => column_getCanMultiSort(column),\n },\n column_getIsSorted: {\n fn: (column) => column_getIsSorted(column),\n },\n column_getSortIndex: {\n fn: (column) => column_getSortIndex(column),\n },\n column_clearSorting: {\n fn: (column) => column_clearSorting(column),\n },\n column_getToggleSortingHandler: {\n fn: (column) => column_getToggleSortingHandler(column),\n },\n })\n },\n\n constructTableAPIs(table) {\n assignTableAPIs('rowSortingFeature', table, {\n table_setSorting: {\n fn: (updater) => table_setSorting(table, updater),\n },\n table_resetSorting: {\n fn: (defaultState) => table_resetSorting(table, defaultState),\n },\n })\n },\n }\n}\n\n/**\n * The stock row sorting feature.\n *\n * Register this feature to add sorting state, column sorting APIs, and sorted\n * row-model support for client-side or manual sorting.\n */\nexport const rowSortingFeature = constructRowSortingFeature()\n"],"mappings":";;;;;;;;;AAsDA,SAAgB,6BAGmD;CACjE,OAAO;EACL,gBAAgB,cAAc;GAC5B,OAAO;IACL,SAASA,uDAAuB;IAChC,GAAG;GACL;EACF;EAEA,sBAAsB;GACpB,OAAO;IACL,QAAQ;IACR,eAAe;GACjB;EACF;EAEA,uBAAuB,OAAO;GAC5B,OAAO;IACL,iBAAiBC,+BAAiB,WAAW,KAAK;IAClD,mBAAmB,MAAe;KAChC,OAAQ,EAAiB;IAC3B;GACF;EACF;EAEA,sBAAsB,WAAW,OAAO;GACtC,kCAAoB,qBAAqB,WAAW,OAAO;IACzD,sBAAsB,EACpB,KAAK,WAAWC,qDAAqB,MAAM,EAC7C;IACA,uBAAuB,EACrB,KAAK,WAAWC,sDAAsB,MAAM,EAC9C;IACA,kBAAkB,EAChB,KAAK,WAAWC,iDAAiB,MAAM,EACzC;IACA,sBAAsB,EACpB,KAAK,QAAQ,MAAM,UACjBC,qDAAqB,QAAQ,MAAM,KAAK,EAC5C;IACA,wBAAwB,EACtB,KAAK,WAAWC,uDAAuB,MAAM,EAC/C;IACA,4BAA4B,EAC1B,KAAK,QAAQ,UAAUC,2DAA2B,QAAQ,KAAK,EACjE;IACA,mBAAmB,EACjB,KAAK,WAAWC,kDAAkB,MAAM,EAC1C;IACA,wBAAwB,EACtB,KAAK,WAAWC,uDAAuB,MAAM,EAC/C;IACA,oBAAoB,EAClB,KAAK,WAAWC,mDAAmB,MAAM,EAC3C;IACA,qBAAqB,EACnB,KAAK,WAAWC,oDAAoB,MAAM,EAC5C;IACA,qBAAqB,EACnB,KAAK,WAAWC,oDAAoB,MAAM,EAC5C;IACA,gCAAgC,EAC9B,KAAK,WAAWC,+DAA+B,MAAM,EACvD;GACF,CAAC;EACH;EAEA,mBAAmB,OAAO;GACxB,8BAAgB,qBAAqB,OAAO;IAC1C,kBAAkB,EAChB,KAAK,YAAYC,iDAAiB,OAAO,OAAO,EAClD;IACA,oBAAoB,EAClB,KAAK,iBAAiBC,mDAAmB,OAAO,YAAY,EAC9D;GACF,CAAC;EACH;CACF;AACF;;;;;;;AAQA,MAAa,oBAAoB,2BAA2B"}
1
+ {"version":3,"file":"rowSortingFeature.cjs","names":["getDefaultSortingState","makeStateUpdater","column_getAutoSortFn","column_getAutoSortDir","column_getSortFn","column_toggleSorting","column_getFirstSortDir","column_getNextSortingOrder","column_getCanSort","column_getCanMultiSort","column_getIsSorted","column_getSortIndex","column_clearSorting","column_getToggleSortingHandler","table_setSorting","table_resetSorting"],"sources":["../../../src/features/row-sorting/rowSortingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n makeStateUpdater,\n} from '../../utils'\nimport {\n column_clearSorting,\n column_getAutoSortDir,\n column_getAutoSortFn,\n column_getCanMultiSort,\n column_getCanSort,\n column_getFirstSortDir,\n column_getIsSorted,\n column_getNextSortingOrder,\n column_getSortFn,\n column_getSortIndex,\n column_getToggleSortingHandler,\n column_toggleSorting,\n getDefaultSortingState,\n table_resetSorting,\n table_setSorting,\n} from './rowSortingFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Feature that adds row sorting state, defaults, and column/table sorting APIs.\n */\nexport const rowSortingFeature: TableFeature = {\n getInitialState(initialState) {\n return {\n sorting: getDefaultSortingState(),\n ...initialState,\n }\n },\n\n getDefaultColumnDef() {\n return {\n sortFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultTableOptions(table) {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n assignColumnPrototype(prototype, table) {\n assignPrototypeAPIs('rowSortingFeature', prototype, table, {\n column_getAutoSortFn: {\n fn: (column) => column_getAutoSortFn(column),\n },\n column_getAutoSortDir: {\n fn: (column) => column_getAutoSortDir(column),\n },\n column_getSortFn: {\n fn: (column) => column_getSortFn(column),\n },\n column_toggleSorting: {\n fn: (column, desc, multi) => column_toggleSorting(column, desc, multi),\n },\n column_getFirstSortDir: {\n fn: (column) => column_getFirstSortDir(column),\n },\n column_getNextSortingOrder: {\n fn: (column, multi) => column_getNextSortingOrder(column, multi),\n },\n column_getCanSort: {\n fn: (column) => column_getCanSort(column),\n },\n column_getCanMultiSort: {\n fn: (column) => column_getCanMultiSort(column),\n },\n column_getIsSorted: {\n fn: (column) => column_getIsSorted(column),\n },\n column_getSortIndex: {\n fn: (column) => column_getSortIndex(column),\n },\n column_clearSorting: {\n fn: (column) => column_clearSorting(column),\n },\n column_getToggleSortingHandler: {\n fn: (column) => column_getToggleSortingHandler(column),\n },\n })\n },\n\n constructTableAPIs(table) {\n assignTableAPIs('rowSortingFeature', table, {\n table_setSorting: {\n fn: (updater) => table_setSorting(table, updater),\n },\n table_resetSorting: {\n fn: (defaultState) => table_resetSorting(table, defaultState),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AA2BA,MAAa,oBAAkC;CAC7C,gBAAgB,cAAc;EAC5B,OAAO;GACL,SAASA,uDAAuB;GAChC,GAAG;EACL;CACF;CAEA,sBAAsB;EACpB,OAAO;GACL,QAAQ;GACR,eAAe;EACjB;CACF;CAEA,uBAAuB,OAAO;EAC5B,OAAO;GACL,iBAAiBC,+BAAiB,WAAW,KAAK;GAClD,mBAAmB,MAAe;IAChC,OAAQ,EAAiB;GAC3B;EACF;CACF;CAEA,sBAAsB,WAAW,OAAO;EACtC,kCAAoB,qBAAqB,WAAW,OAAO;GACzD,sBAAsB,EACpB,KAAK,WAAWC,qDAAqB,MAAM,EAC7C;GACA,uBAAuB,EACrB,KAAK,WAAWC,sDAAsB,MAAM,EAC9C;GACA,kBAAkB,EAChB,KAAK,WAAWC,iDAAiB,MAAM,EACzC;GACA,sBAAsB,EACpB,KAAK,QAAQ,MAAM,UAAUC,qDAAqB,QAAQ,MAAM,KAAK,EACvE;GACA,wBAAwB,EACtB,KAAK,WAAWC,uDAAuB,MAAM,EAC/C;GACA,4BAA4B,EAC1B,KAAK,QAAQ,UAAUC,2DAA2B,QAAQ,KAAK,EACjE;GACA,mBAAmB,EACjB,KAAK,WAAWC,kDAAkB,MAAM,EAC1C;GACA,wBAAwB,EACtB,KAAK,WAAWC,uDAAuB,MAAM,EAC/C;GACA,oBAAoB,EAClB,KAAK,WAAWC,mDAAmB,MAAM,EAC3C;GACA,qBAAqB,EACnB,KAAK,WAAWC,oDAAoB,MAAM,EAC5C;GACA,qBAAqB,EACnB,KAAK,WAAWC,oDAAoB,MAAM,EAC5C;GACA,gCAAgC,EAC9B,KAAK,WAAWC,+DAA+B,MAAM,EACvD;EACF,CAAC;CACH;CAEA,mBAAmB,OAAO;EACxB,8BAAgB,qBAAqB,OAAO;GAC1C,kBAAkB,EAChB,KAAK,YAAYC,iDAAiB,OAAO,OAAO,EAClD;GACA,oBAAoB,EAClB,KAAK,iBAAiBC,mDAAmB,OAAO,YAAY,EAC9D;EACF,CAAC;CACH;AACF"}
@@ -1,21 +1,10 @@
1
- import { RowData } from "../../types/type-utils.cjs";
2
- import { TableFeature, TableFeatures } from "../../types/TableFeatures.cjs";
1
+ import { TableFeature } from "../../types/TableFeatures.cjs";
3
2
 
4
3
  //#region src/features/row-sorting/rowSortingFeature.d.ts
5
- interface RowSortingFeatureConstructors<TFeatures extends TableFeatures, TData extends RowData> {}
6
4
  /**
7
- * Creates the stock row sorting feature.
8
- *
9
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
5
+ * Feature that adds row sorting state, defaults, and column/table sorting APIs.
10
6
  */
11
- declare function constructRowSortingFeature<TFeatures extends TableFeatures, TData extends RowData>(): TableFeature<RowSortingFeatureConstructors<TFeatures, TData>>;
12
- /**
13
- * The stock row sorting feature.
14
- *
15
- * Register this feature to add sorting state, column sorting APIs, and sorted
16
- * row-model support for client-side or manual sorting.
17
- */
18
- declare const rowSortingFeature: TableFeature<RowSortingFeatureConstructors<TableFeatures, RowData>>;
7
+ declare const rowSortingFeature: TableFeature;
19
8
  //#endregion
20
- export { RowSortingFeatureConstructors, constructRowSortingFeature, rowSortingFeature };
9
+ export { rowSortingFeature };
21
10
  //# sourceMappingURL=rowSortingFeature.d.cts.map
@@ -1,21 +1,10 @@
1
- import { RowData } from "../../types/type-utils.js";
2
- import { TableFeature, TableFeatures } from "../../types/TableFeatures.js";
1
+ import { TableFeature } from "../../types/TableFeatures.js";
3
2
 
4
3
  //#region src/features/row-sorting/rowSortingFeature.d.ts
5
- interface RowSortingFeatureConstructors<TFeatures extends TableFeatures, TData extends RowData> {}
6
4
  /**
7
- * Creates the stock row sorting feature.
8
- *
9
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
5
+ * Feature that adds row sorting state, defaults, and column/table sorting APIs.
10
6
  */
11
- declare function constructRowSortingFeature<TFeatures extends TableFeatures, TData extends RowData>(): TableFeature<RowSortingFeatureConstructors<TFeatures, TData>>;
12
- /**
13
- * The stock row sorting feature.
14
- *
15
- * Register this feature to add sorting state, column sorting APIs, and sorted
16
- * row-model support for client-side or manual sorting.
17
- */
18
- declare const rowSortingFeature: TableFeature<RowSortingFeatureConstructors<TableFeatures, RowData>>;
7
+ declare const rowSortingFeature: TableFeature;
19
8
  //#endregion
20
- export { RowSortingFeatureConstructors, constructRowSortingFeature, rowSortingFeature };
9
+ export { rowSortingFeature };
21
10
  //# sourceMappingURL=rowSortingFeature.d.ts.map
@@ -3,64 +3,53 @@ import { column_clearSorting, column_getAutoSortDir, column_getAutoSortFn, colum
3
3
 
4
4
  //#region src/features/row-sorting/rowSortingFeature.ts
5
5
  /**
6
- * Creates the stock row sorting feature.
7
- *
8
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
6
+ * Feature that adds row sorting state, defaults, and column/table sorting APIs.
9
7
  */
10
- function constructRowSortingFeature() {
11
- return {
12
- getInitialState(initialState) {
13
- return {
14
- sorting: getDefaultSortingState(),
15
- ...initialState
16
- };
17
- },
18
- getDefaultColumnDef() {
19
- return {
20
- sortFn: "auto",
21
- sortUndefined: 1
22
- };
23
- },
24
- getDefaultTableOptions(table) {
25
- return {
26
- onSortingChange: makeStateUpdater("sorting", table),
27
- isMultiSortEvent: (e) => {
28
- return e.shiftKey;
29
- }
30
- };
31
- },
32
- assignColumnPrototype(prototype, table) {
33
- assignPrototypeAPIs("rowSortingFeature", prototype, table, {
34
- column_getAutoSortFn: { fn: (column) => column_getAutoSortFn(column) },
35
- column_getAutoSortDir: { fn: (column) => column_getAutoSortDir(column) },
36
- column_getSortFn: { fn: (column) => column_getSortFn(column) },
37
- column_toggleSorting: { fn: (column, desc, multi) => column_toggleSorting(column, desc, multi) },
38
- column_getFirstSortDir: { fn: (column) => column_getFirstSortDir(column) },
39
- column_getNextSortingOrder: { fn: (column, multi) => column_getNextSortingOrder(column, multi) },
40
- column_getCanSort: { fn: (column) => column_getCanSort(column) },
41
- column_getCanMultiSort: { fn: (column) => column_getCanMultiSort(column) },
42
- column_getIsSorted: { fn: (column) => column_getIsSorted(column) },
43
- column_getSortIndex: { fn: (column) => column_getSortIndex(column) },
44
- column_clearSorting: { fn: (column) => column_clearSorting(column) },
45
- column_getToggleSortingHandler: { fn: (column) => column_getToggleSortingHandler(column) }
46
- });
47
- },
48
- constructTableAPIs(table) {
49
- assignTableAPIs("rowSortingFeature", table, {
50
- table_setSorting: { fn: (updater) => table_setSorting(table, updater) },
51
- table_resetSorting: { fn: (defaultState) => table_resetSorting(table, defaultState) }
52
- });
53
- }
54
- };
55
- }
56
- /**
57
- * The stock row sorting feature.
58
- *
59
- * Register this feature to add sorting state, column sorting APIs, and sorted
60
- * row-model support for client-side or manual sorting.
61
- */
62
- const rowSortingFeature = constructRowSortingFeature();
8
+ const rowSortingFeature = {
9
+ getInitialState(initialState) {
10
+ return {
11
+ sorting: getDefaultSortingState(),
12
+ ...initialState
13
+ };
14
+ },
15
+ getDefaultColumnDef() {
16
+ return {
17
+ sortFn: "auto",
18
+ sortUndefined: 1
19
+ };
20
+ },
21
+ getDefaultTableOptions(table) {
22
+ return {
23
+ onSortingChange: makeStateUpdater("sorting", table),
24
+ isMultiSortEvent: (e) => {
25
+ return e.shiftKey;
26
+ }
27
+ };
28
+ },
29
+ assignColumnPrototype(prototype, table) {
30
+ assignPrototypeAPIs("rowSortingFeature", prototype, table, {
31
+ column_getAutoSortFn: { fn: (column) => column_getAutoSortFn(column) },
32
+ column_getAutoSortDir: { fn: (column) => column_getAutoSortDir(column) },
33
+ column_getSortFn: { fn: (column) => column_getSortFn(column) },
34
+ column_toggleSorting: { fn: (column, desc, multi) => column_toggleSorting(column, desc, multi) },
35
+ column_getFirstSortDir: { fn: (column) => column_getFirstSortDir(column) },
36
+ column_getNextSortingOrder: { fn: (column, multi) => column_getNextSortingOrder(column, multi) },
37
+ column_getCanSort: { fn: (column) => column_getCanSort(column) },
38
+ column_getCanMultiSort: { fn: (column) => column_getCanMultiSort(column) },
39
+ column_getIsSorted: { fn: (column) => column_getIsSorted(column) },
40
+ column_getSortIndex: { fn: (column) => column_getSortIndex(column) },
41
+ column_clearSorting: { fn: (column) => column_clearSorting(column) },
42
+ column_getToggleSortingHandler: { fn: (column) => column_getToggleSortingHandler(column) }
43
+ });
44
+ },
45
+ constructTableAPIs(table) {
46
+ assignTableAPIs("rowSortingFeature", table, {
47
+ table_setSorting: { fn: (updater) => table_setSorting(table, updater) },
48
+ table_resetSorting: { fn: (defaultState) => table_resetSorting(table, defaultState) }
49
+ });
50
+ }
51
+ };
63
52
 
64
53
  //#endregion
65
- export { constructRowSortingFeature, rowSortingFeature };
54
+ export { rowSortingFeature };
66
55
  //# sourceMappingURL=rowSortingFeature.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rowSortingFeature.js","names":[],"sources":["../../../src/features/row-sorting/rowSortingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n makeStateUpdater,\n} from '../../utils'\nimport {\n column_clearSorting,\n column_getAutoSortDir,\n column_getAutoSortFn,\n column_getCanMultiSort,\n column_getCanSort,\n column_getFirstSortDir,\n column_getIsSorted,\n column_getNextSortingOrder,\n column_getSortFn,\n column_getSortIndex,\n column_getToggleSortingHandler,\n column_toggleSorting,\n getDefaultSortingState,\n table_resetSorting,\n table_setSorting,\n} from './rowSortingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type {\n// CachedRowModel_Sorted,\n// ColumnDef_RowSorting,\n// Column_RowSorting,\n// CreateRowModel_Sorted,\n// RowModelFns_RowSorting,\n// TableOptions_RowSorting,\n// TableState_RowSorting,\n// Table_RowSorting,\n// } from './rowSortingFeature.types'\n\nexport interface RowSortingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Sorted<TFeatures, TData>\n // Column: Column_RowSorting<TFeatures, TData>\n // ColumnDef: ColumnDef_RowSorting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Sorted<TFeatures, TData>\n // RowModelFns: RowModelFns_RowSorting<TFeatures, TData>\n // Table: Table_RowSorting<TFeatures, TData>\n // TableOptions: TableOptions_RowSorting\n // TableState: TableState_RowSorting\n}\n\n/**\n * Creates the stock row sorting feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructRowSortingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<RowSortingFeatureConstructors<TFeatures, TData>> {\n return {\n getInitialState(initialState) {\n return {\n sorting: getDefaultSortingState(),\n ...initialState,\n }\n },\n\n getDefaultColumnDef() {\n return {\n sortFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultTableOptions(table) {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n assignColumnPrototype(prototype, table) {\n assignPrototypeAPIs('rowSortingFeature', prototype, table, {\n column_getAutoSortFn: {\n fn: (column) => column_getAutoSortFn(column),\n },\n column_getAutoSortDir: {\n fn: (column) => column_getAutoSortDir(column),\n },\n column_getSortFn: {\n fn: (column) => column_getSortFn(column),\n },\n column_toggleSorting: {\n fn: (column, desc, multi) =>\n column_toggleSorting(column, desc, multi),\n },\n column_getFirstSortDir: {\n fn: (column) => column_getFirstSortDir(column),\n },\n column_getNextSortingOrder: {\n fn: (column, multi) => column_getNextSortingOrder(column, multi),\n },\n column_getCanSort: {\n fn: (column) => column_getCanSort(column),\n },\n column_getCanMultiSort: {\n fn: (column) => column_getCanMultiSort(column),\n },\n column_getIsSorted: {\n fn: (column) => column_getIsSorted(column),\n },\n column_getSortIndex: {\n fn: (column) => column_getSortIndex(column),\n },\n column_clearSorting: {\n fn: (column) => column_clearSorting(column),\n },\n column_getToggleSortingHandler: {\n fn: (column) => column_getToggleSortingHandler(column),\n },\n })\n },\n\n constructTableAPIs(table) {\n assignTableAPIs('rowSortingFeature', table, {\n table_setSorting: {\n fn: (updater) => table_setSorting(table, updater),\n },\n table_resetSorting: {\n fn: (defaultState) => table_resetSorting(table, defaultState),\n },\n })\n },\n }\n}\n\n/**\n * The stock row sorting feature.\n *\n * Register this feature to add sorting state, column sorting APIs, and sorted\n * row-model support for client-side or manual sorting.\n */\nexport const rowSortingFeature = constructRowSortingFeature()\n"],"mappings":";;;;;;;;;AAsDA,SAAgB,6BAGmD;CACjE,OAAO;EACL,gBAAgB,cAAc;GAC5B,OAAO;IACL,SAAS,uBAAuB;IAChC,GAAG;GACL;EACF;EAEA,sBAAsB;GACpB,OAAO;IACL,QAAQ;IACR,eAAe;GACjB;EACF;EAEA,uBAAuB,OAAO;GAC5B,OAAO;IACL,iBAAiB,iBAAiB,WAAW,KAAK;IAClD,mBAAmB,MAAe;KAChC,OAAQ,EAAiB;IAC3B;GACF;EACF;EAEA,sBAAsB,WAAW,OAAO;GACtC,oBAAoB,qBAAqB,WAAW,OAAO;IACzD,sBAAsB,EACpB,KAAK,WAAW,qBAAqB,MAAM,EAC7C;IACA,uBAAuB,EACrB,KAAK,WAAW,sBAAsB,MAAM,EAC9C;IACA,kBAAkB,EAChB,KAAK,WAAW,iBAAiB,MAAM,EACzC;IACA,sBAAsB,EACpB,KAAK,QAAQ,MAAM,UACjB,qBAAqB,QAAQ,MAAM,KAAK,EAC5C;IACA,wBAAwB,EACtB,KAAK,WAAW,uBAAuB,MAAM,EAC/C;IACA,4BAA4B,EAC1B,KAAK,QAAQ,UAAU,2BAA2B,QAAQ,KAAK,EACjE;IACA,mBAAmB,EACjB,KAAK,WAAW,kBAAkB,MAAM,EAC1C;IACA,wBAAwB,EACtB,KAAK,WAAW,uBAAuB,MAAM,EAC/C;IACA,oBAAoB,EAClB,KAAK,WAAW,mBAAmB,MAAM,EAC3C;IACA,qBAAqB,EACnB,KAAK,WAAW,oBAAoB,MAAM,EAC5C;IACA,qBAAqB,EACnB,KAAK,WAAW,oBAAoB,MAAM,EAC5C;IACA,gCAAgC,EAC9B,KAAK,WAAW,+BAA+B,MAAM,EACvD;GACF,CAAC;EACH;EAEA,mBAAmB,OAAO;GACxB,gBAAgB,qBAAqB,OAAO;IAC1C,kBAAkB,EAChB,KAAK,YAAY,iBAAiB,OAAO,OAAO,EAClD;IACA,oBAAoB,EAClB,KAAK,iBAAiB,mBAAmB,OAAO,YAAY,EAC9D;GACF,CAAC;EACH;CACF;AACF;;;;;;;AAQA,MAAa,oBAAoB,2BAA2B"}
1
+ {"version":3,"file":"rowSortingFeature.js","names":[],"sources":["../../../src/features/row-sorting/rowSortingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n makeStateUpdater,\n} from '../../utils'\nimport {\n column_clearSorting,\n column_getAutoSortDir,\n column_getAutoSortFn,\n column_getCanMultiSort,\n column_getCanSort,\n column_getFirstSortDir,\n column_getIsSorted,\n column_getNextSortingOrder,\n column_getSortFn,\n column_getSortIndex,\n column_getToggleSortingHandler,\n column_toggleSorting,\n getDefaultSortingState,\n table_resetSorting,\n table_setSorting,\n} from './rowSortingFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Feature that adds row sorting state, defaults, and column/table sorting APIs.\n */\nexport const rowSortingFeature: TableFeature = {\n getInitialState(initialState) {\n return {\n sorting: getDefaultSortingState(),\n ...initialState,\n }\n },\n\n getDefaultColumnDef() {\n return {\n sortFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultTableOptions(table) {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n assignColumnPrototype(prototype, table) {\n assignPrototypeAPIs('rowSortingFeature', prototype, table, {\n column_getAutoSortFn: {\n fn: (column) => column_getAutoSortFn(column),\n },\n column_getAutoSortDir: {\n fn: (column) => column_getAutoSortDir(column),\n },\n column_getSortFn: {\n fn: (column) => column_getSortFn(column),\n },\n column_toggleSorting: {\n fn: (column, desc, multi) => column_toggleSorting(column, desc, multi),\n },\n column_getFirstSortDir: {\n fn: (column) => column_getFirstSortDir(column),\n },\n column_getNextSortingOrder: {\n fn: (column, multi) => column_getNextSortingOrder(column, multi),\n },\n column_getCanSort: {\n fn: (column) => column_getCanSort(column),\n },\n column_getCanMultiSort: {\n fn: (column) => column_getCanMultiSort(column),\n },\n column_getIsSorted: {\n fn: (column) => column_getIsSorted(column),\n },\n column_getSortIndex: {\n fn: (column) => column_getSortIndex(column),\n },\n column_clearSorting: {\n fn: (column) => column_clearSorting(column),\n },\n column_getToggleSortingHandler: {\n fn: (column) => column_getToggleSortingHandler(column),\n },\n })\n },\n\n constructTableAPIs(table) {\n assignTableAPIs('rowSortingFeature', table, {\n table_setSorting: {\n fn: (updater) => table_setSorting(table, updater),\n },\n table_resetSorting: {\n fn: (defaultState) => table_resetSorting(table, defaultState),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AA2BA,MAAa,oBAAkC;CAC7C,gBAAgB,cAAc;EAC5B,OAAO;GACL,SAAS,uBAAuB;GAChC,GAAG;EACL;CACF;CAEA,sBAAsB;EACpB,OAAO;GACL,QAAQ;GACR,eAAe;EACjB;CACF;CAEA,uBAAuB,OAAO;EAC5B,OAAO;GACL,iBAAiB,iBAAiB,WAAW,KAAK;GAClD,mBAAmB,MAAe;IAChC,OAAQ,EAAiB;GAC3B;EACF;CACF;CAEA,sBAAsB,WAAW,OAAO;EACtC,oBAAoB,qBAAqB,WAAW,OAAO;GACzD,sBAAsB,EACpB,KAAK,WAAW,qBAAqB,MAAM,EAC7C;GACA,uBAAuB,EACrB,KAAK,WAAW,sBAAsB,MAAM,EAC9C;GACA,kBAAkB,EAChB,KAAK,WAAW,iBAAiB,MAAM,EACzC;GACA,sBAAsB,EACpB,KAAK,QAAQ,MAAM,UAAU,qBAAqB,QAAQ,MAAM,KAAK,EACvE;GACA,wBAAwB,EACtB,KAAK,WAAW,uBAAuB,MAAM,EAC/C;GACA,4BAA4B,EAC1B,KAAK,QAAQ,UAAU,2BAA2B,QAAQ,KAAK,EACjE;GACA,mBAAmB,EACjB,KAAK,WAAW,kBAAkB,MAAM,EAC1C;GACA,wBAAwB,EACtB,KAAK,WAAW,uBAAuB,MAAM,EAC/C;GACA,oBAAoB,EAClB,KAAK,WAAW,mBAAmB,MAAM,EAC3C;GACA,qBAAqB,EACnB,KAAK,WAAW,oBAAoB,MAAM,EAC5C;GACA,qBAAqB,EACnB,KAAK,WAAW,oBAAoB,MAAM,EAC5C;GACA,gCAAgC,EAC9B,KAAK,WAAW,+BAA+B,MAAM,EACvD;EACF,CAAC;CACH;CAEA,mBAAmB,OAAO;EACxB,gBAAgB,qBAAqB,OAAO;GAC1C,kBAAkB,EAChB,KAAK,YAAY,iBAAiB,OAAO,OAAO,EAClD;GACA,oBAAoB,EAClB,KAAK,iBAAiB,mBAAmB,OAAO,YAAY,EAC9D;EACF,CAAC;CACH;AACF"}
@@ -1,8 +1,7 @@
1
1
  import { OnChangeFn, RowData, Updater } from "../../types/type-utils.cjs";
2
2
  import { BuiltInSortFn } from "../../fns/sortFns.cjs";
3
3
  import { Row } from "../../types/Row.cjs";
4
- import { TableFeatures } from "../../types/TableFeatures.cjs";
5
- import { Table } from "../../types/Table.cjs";
4
+ import { IsAny, TableFeatures } from "../../types/TableFeatures.cjs";
6
5
  import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.cjs";
7
6
 
8
7
  //#region src/features/row-sorting/rowSortingFeature.types.d.ts
@@ -16,14 +15,26 @@ interface TableState_RowSorting {
16
15
  sorting: SortingState;
17
16
  }
18
17
  interface RowModelFns_RowSorting<TFeatures extends TableFeatures, TData extends RowData> {
19
- sortFns: Record<keyof SortFns, SortFn<TFeatures, TData>>;
18
+ sortFns: Record<string, SortFn<TFeatures, TData>>;
20
19
  }
21
20
  interface SortFns {}
22
21
  interface SortFn<TFeatures extends TableFeatures, TData extends RowData> {
23
22
  (rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string): number;
24
23
  }
25
24
  type CustomSortFns<TFeatures extends TableFeatures, TData extends RowData> = Record<string, SortFn<TFeatures, TData>>;
26
- type SortFnOption<TFeatures extends TableFeatures, TData extends RowData> = 'auto' | keyof SortFns | BuiltInSortFn | SortFn<TFeatures, TData>;
25
+ /**
26
+ * Resolves the valid string names for `columnDef.sortFn` for a feature set.
27
+ *
28
+ * When the features object declares a `sortFns` registry
29
+ * (`tableFeatures({ ..., sortFns })`), its keys are the only valid names; a
30
+ * name is only assignable if a sorting function is actually registered for it.
31
+ * Otherwise this falls back to the global declaration-merged `SortFns`
32
+ * interface.
33
+ */
34
+ type ExtractSortFnKeys<TFeatures extends TableFeatures> = IsAny<TFeatures> extends true ? keyof SortFns | BuiltInSortFn : TFeatures extends {
35
+ sortFns: infer TSortFns extends object;
36
+ } ? Extract<keyof TSortFns, string> : keyof SortFns;
37
+ type SortFnOption<TFeatures extends TableFeatures, TData extends RowData> = 'auto' | ExtractSortFnKeys<TFeatures> | SortFn<TFeatures, TData>;
27
38
  interface ColumnDef_RowSorting<TFeatures extends TableFeatures, TData extends RowData> {
28
39
  /**
29
40
  * Enables/Disables multi-sorting for this column.
@@ -172,17 +183,9 @@ interface Table_RowModels_Sorted<TFeatures extends TableFeatures, TData extends
172
183
  */
173
184
  getSortedRowModel: () => RowModel<TFeatures, TData>;
174
185
  }
175
- interface CreateRowModel_Sorted<TFeatures extends TableFeatures, TData extends RowData> {
176
- /**
177
- * Factory used to retrieve the sorted row model. If using server-side
178
- * sorting, this is not required. To use client-side sorting, pass the
179
- * exported `createSortedRowModel()` or implement your own factory.
180
- */
181
- sortedRowModel?: (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
182
- }
183
186
  interface CachedRowModel_Sorted<TFeatures extends TableFeatures, TData extends RowData> {
184
187
  sortedRowModel: () => RowModel<TFeatures, TData>;
185
188
  }
186
189
  //#endregion
187
- export { CachedRowModel_Sorted, ColumnDef_RowSorting, ColumnSort, Column_RowSorting, CreateRowModel_Sorted, CustomSortFns, RowModelFns_RowSorting, SortDirection, SortFn, SortFnOption, SortFns, SortingState, TableOptions_RowSorting, TableState_RowSorting, Table_RowModels_Sorted, Table_RowSorting };
190
+ export { CachedRowModel_Sorted, ColumnDef_RowSorting, ColumnSort, Column_RowSorting, CustomSortFns, ExtractSortFnKeys, RowModelFns_RowSorting, SortDirection, SortFn, SortFnOption, SortFns, SortingState, TableOptions_RowSorting, TableState_RowSorting, Table_RowModels_Sorted, Table_RowSorting };
188
191
  //# sourceMappingURL=rowSortingFeature.types.d.cts.map
@@ -1,8 +1,7 @@
1
1
  import { OnChangeFn, RowData, Updater } from "../../types/type-utils.js";
2
2
  import { BuiltInSortFn } from "../../fns/sortFns.js";
3
3
  import { Row } from "../../types/Row.js";
4
- import { TableFeatures } from "../../types/TableFeatures.js";
5
- import { Table } from "../../types/Table.js";
4
+ import { IsAny, TableFeatures } from "../../types/TableFeatures.js";
6
5
  import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
7
6
 
8
7
  //#region src/features/row-sorting/rowSortingFeature.types.d.ts
@@ -16,14 +15,26 @@ interface TableState_RowSorting {
16
15
  sorting: SortingState;
17
16
  }
18
17
  interface RowModelFns_RowSorting<TFeatures extends TableFeatures, TData extends RowData> {
19
- sortFns: Record<keyof SortFns, SortFn<TFeatures, TData>>;
18
+ sortFns: Record<string, SortFn<TFeatures, TData>>;
20
19
  }
21
20
  interface SortFns {}
22
21
  interface SortFn<TFeatures extends TableFeatures, TData extends RowData> {
23
22
  (rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string): number;
24
23
  }
25
24
  type CustomSortFns<TFeatures extends TableFeatures, TData extends RowData> = Record<string, SortFn<TFeatures, TData>>;
26
- type SortFnOption<TFeatures extends TableFeatures, TData extends RowData> = 'auto' | keyof SortFns | BuiltInSortFn | SortFn<TFeatures, TData>;
25
+ /**
26
+ * Resolves the valid string names for `columnDef.sortFn` for a feature set.
27
+ *
28
+ * When the features object declares a `sortFns` registry
29
+ * (`tableFeatures({ ..., sortFns })`), its keys are the only valid names; a
30
+ * name is only assignable if a sorting function is actually registered for it.
31
+ * Otherwise this falls back to the global declaration-merged `SortFns`
32
+ * interface.
33
+ */
34
+ type ExtractSortFnKeys<TFeatures extends TableFeatures> = IsAny<TFeatures> extends true ? keyof SortFns | BuiltInSortFn : TFeatures extends {
35
+ sortFns: infer TSortFns extends object;
36
+ } ? Extract<keyof TSortFns, string> : keyof SortFns;
37
+ type SortFnOption<TFeatures extends TableFeatures, TData extends RowData> = 'auto' | ExtractSortFnKeys<TFeatures> | SortFn<TFeatures, TData>;
27
38
  interface ColumnDef_RowSorting<TFeatures extends TableFeatures, TData extends RowData> {
28
39
  /**
29
40
  * Enables/Disables multi-sorting for this column.
@@ -172,17 +183,9 @@ interface Table_RowModels_Sorted<TFeatures extends TableFeatures, TData extends
172
183
  */
173
184
  getSortedRowModel: () => RowModel<TFeatures, TData>;
174
185
  }
175
- interface CreateRowModel_Sorted<TFeatures extends TableFeatures, TData extends RowData> {
176
- /**
177
- * Factory used to retrieve the sorted row model. If using server-side
178
- * sorting, this is not required. To use client-side sorting, pass the
179
- * exported `createSortedRowModel()` or implement your own factory.
180
- */
181
- sortedRowModel?: (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
182
- }
183
186
  interface CachedRowModel_Sorted<TFeatures extends TableFeatures, TData extends RowData> {
184
187
  sortedRowModel: () => RowModel<TFeatures, TData>;
185
188
  }
186
189
  //#endregion
187
- export { CachedRowModel_Sorted, ColumnDef_RowSorting, ColumnSort, Column_RowSorting, CreateRowModel_Sorted, CustomSortFns, RowModelFns_RowSorting, SortDirection, SortFn, SortFnOption, SortFns, SortingState, TableOptions_RowSorting, TableState_RowSorting, Table_RowModels_Sorted, Table_RowSorting };
190
+ export { CachedRowModel_Sorted, ColumnDef_RowSorting, ColumnSort, Column_RowSorting, CustomSortFns, ExtractSortFnKeys, RowModelFns_RowSorting, SortDirection, SortFn, SortFnOption, SortFns, SortingState, TableOptions_RowSorting, TableState_RowSorting, Table_RowModels_Sorted, Table_RowSorting };
188
191
  //# sourceMappingURL=rowSortingFeature.types.d.ts.map
@@ -60,19 +60,22 @@ function table_resetSorting(table, defaultState) {
60
60
  */
61
61
  function column_getAutoSortFn(column) {
62
62
  const sortFns = column.table._rowModelFns.sortFns;
63
- let sortFn;
64
63
  const firstRows = column.table.getFilteredRowModel().flatRows.slice(0, 10);
65
64
  let isString = false;
66
65
  for (let i = 0; i < firstRows.length; i++) {
67
66
  const value = firstRows[i].getValue(column.id);
68
- if (Object.prototype.toString.call(value) === "[object Date]") sortFn = sortFns === null || sortFns === void 0 ? void 0 : sortFns.datetime;
67
+ if (Object.prototype.toString.call(value) === "[object Date]") {
68
+ if (sortFns === null || sortFns === void 0 ? void 0 : sortFns.datetime) return sortFns.datetime;
69
+ }
69
70
  if (typeof value === "string") {
70
71
  isString = true;
71
- if (value.split(require_sortFns.reSplitAlphaNumeric).length > 1) sortFn = sortFns === null || sortFns === void 0 ? void 0 : sortFns.alphanumeric;
72
+ if (value.split(require_sortFns.reSplitAlphaNumeric).length > 1) {
73
+ if (sortFns === null || sortFns === void 0 ? void 0 : sortFns.alphanumeric) return sortFns.alphanumeric;
74
+ }
72
75
  }
73
76
  }
74
- if (isString) sortFn = sortFns === null || sortFns === void 0 ? void 0 : sortFns.text;
75
- return sortFn ?? require_sortFns.sortFn_basic;
77
+ if (isString) return (sortFns === null || sortFns === void 0 ? void 0 : sortFns.text) ?? require_sortFns.sortFn_basic;
78
+ return require_sortFns.sortFn_basic;
76
79
  }
77
80
  /**
78
81
  * Chooses the default first sort direction from the first filtered row value.