@tanstack/table-core 9.0.0-beta.46 → 9.0.0-beta.48

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 (212) hide show
  1. package/dist/core/row-models/coreRowModelsFeature.types.d.cts +1 -1
  2. package/dist/core/row-models/coreRowModelsFeature.types.d.ts +1 -1
  3. package/dist/core/row-models/coreRowModelsFeature.utils.cjs +1 -1
  4. package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
  5. package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +1 -1
  6. package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +1 -1
  7. package/dist/core/row-models/coreRowModelsFeature.utils.js +1 -1
  8. package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
  9. package/dist/features/aggregation/aggregationFeature.cjs +38 -0
  10. package/dist/features/aggregation/aggregationFeature.cjs.map +1 -0
  11. package/dist/features/aggregation/aggregationFeature.d.cts +10 -0
  12. package/dist/features/aggregation/aggregationFeature.d.ts +10 -0
  13. package/dist/features/aggregation/aggregationFeature.js +38 -0
  14. package/dist/features/aggregation/aggregationFeature.js.map +1 -0
  15. package/dist/features/aggregation/aggregationFeature.types.cjs +13 -0
  16. package/dist/features/aggregation/aggregationFeature.types.cjs.map +1 -0
  17. package/dist/features/aggregation/aggregationFeature.types.d.cts +172 -0
  18. package/dist/features/aggregation/aggregationFeature.types.d.ts +172 -0
  19. package/dist/features/aggregation/aggregationFeature.types.js +12 -0
  20. package/dist/features/aggregation/aggregationFeature.types.js.map +1 -0
  21. package/dist/features/aggregation/aggregationFeature.utils.cjs +198 -0
  22. package/dist/features/aggregation/aggregationFeature.utils.cjs.map +1 -0
  23. package/dist/features/aggregation/aggregationFeature.utils.d.cts +33 -0
  24. package/dist/features/aggregation/aggregationFeature.utils.d.ts +33 -0
  25. package/dist/features/aggregation/aggregationFeature.utils.js +192 -0
  26. package/dist/features/aggregation/aggregationFeature.utils.js.map +1 -0
  27. package/dist/features/aggregation/aggregationFns.cjs +240 -0
  28. package/dist/features/aggregation/aggregationFns.cjs.map +1 -0
  29. package/dist/features/aggregation/aggregationFns.d.cts +67 -0
  30. package/dist/features/aggregation/aggregationFns.d.ts +67 -0
  31. package/dist/features/aggregation/aggregationFns.js +229 -0
  32. package/dist/features/aggregation/aggregationFns.js.map +1 -0
  33. package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +43 -3
  34. package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +43 -3
  35. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +18 -9
  36. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
  37. package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +6 -2
  38. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +6 -2
  39. package/dist/features/column-filtering/columnFilteringFeature.utils.js +18 -9
  40. package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
  41. package/dist/features/column-filtering/createFilteredRowModel.cjs +7 -2
  42. package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
  43. package/dist/features/column-filtering/createFilteredRowModel.d.cts +6 -2
  44. package/dist/features/column-filtering/createFilteredRowModel.d.ts +6 -2
  45. package/dist/features/column-filtering/createFilteredRowModel.js +7 -2
  46. package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
  47. package/dist/features/column-filtering/filterFns.cjs +399 -0
  48. package/dist/features/column-filtering/filterFns.cjs.map +1 -0
  49. package/dist/features/column-filtering/filterFns.d.cts +210 -0
  50. package/dist/features/column-filtering/filterFns.d.ts +210 -0
  51. package/dist/features/column-filtering/filterFns.js +375 -0
  52. package/dist/features/column-filtering/filterFns.js.map +1 -0
  53. package/dist/features/column-grouping/columnGroupingFeature.cjs +3 -12
  54. package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
  55. package/dist/features/column-grouping/columnGroupingFeature.d.cts +1 -1
  56. package/dist/features/column-grouping/columnGroupingFeature.d.ts +1 -1
  57. package/dist/features/column-grouping/columnGroupingFeature.js +4 -13
  58. package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
  59. package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +6 -49
  60. package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +6 -49
  61. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +0 -50
  62. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
  63. package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +2 -39
  64. package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +2 -39
  65. package/dist/features/column-grouping/columnGroupingFeature.utils.js +2 -49
  66. package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
  67. package/dist/features/column-grouping/createGroupedRowModel.cjs +23 -13
  68. package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
  69. package/dist/features/column-grouping/createGroupedRowModel.d.cts +2 -3
  70. package/dist/features/column-grouping/createGroupedRowModel.d.ts +2 -3
  71. package/dist/features/column-grouping/createGroupedRowModel.js +25 -15
  72. package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
  73. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +4 -2
  74. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
  75. package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +2 -6
  76. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +2 -6
  77. package/dist/features/global-filtering/globalFilteringFeature.utils.js +4 -2
  78. package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
  79. package/dist/features/row-sorting/createSortedRowModel.cjs +6 -2
  80. package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
  81. package/dist/features/row-sorting/createSortedRowModel.d.cts +6 -2
  82. package/dist/features/row-sorting/createSortedRowModel.d.ts +6 -2
  83. package/dist/features/row-sorting/createSortedRowModel.js +6 -2
  84. package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
  85. package/dist/features/row-sorting/rowSortingFeature.types.d.cts +32 -3
  86. package/dist/features/row-sorting/rowSortingFeature.types.d.ts +32 -3
  87. package/dist/features/row-sorting/rowSortingFeature.utils.cjs +20 -5
  88. package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
  89. package/dist/features/row-sorting/rowSortingFeature.utils.js +20 -5
  90. package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
  91. package/dist/{fns → features/row-sorting}/sortFns.cjs +69 -22
  92. package/dist/features/row-sorting/sortFns.cjs.map +1 -0
  93. package/dist/features/row-sorting/sortFns.d.cts +98 -0
  94. package/dist/features/row-sorting/sortFns.d.ts +98 -0
  95. package/dist/{fns → features/row-sorting}/sortFns.js +69 -23
  96. package/dist/features/row-sorting/sortFns.js.map +1 -0
  97. package/dist/features/stockFeatures.cjs +2 -0
  98. package/dist/features/stockFeatures.cjs.map +1 -1
  99. package/dist/features/stockFeatures.d.cts +2 -0
  100. package/dist/features/stockFeatures.d.ts +2 -0
  101. package/dist/features/stockFeatures.js +2 -0
  102. package/dist/features/stockFeatures.js.map +1 -1
  103. package/dist/helpers/tableFeatures.cjs +5 -4
  104. package/dist/helpers/tableFeatures.cjs.map +1 -1
  105. package/dist/helpers/tableFeatures.d.cts +5 -4
  106. package/dist/helpers/tableFeatures.d.ts +5 -4
  107. package/dist/helpers/tableFeatures.js +5 -4
  108. package/dist/helpers/tableFeatures.js.map +1 -1
  109. package/dist/index.cjs +18 -3
  110. package/dist/index.d.cts +10 -8
  111. package/dist/index.d.ts +10 -8
  112. package/dist/index.js +6 -4
  113. package/dist/static-functions.cjs +8 -3
  114. package/dist/static-functions.d.cts +3 -2
  115. package/dist/static-functions.d.ts +3 -2
  116. package/dist/static-functions.js +3 -2
  117. package/dist/types/Cell.d.cts +3 -1
  118. package/dist/types/Cell.d.ts +3 -1
  119. package/dist/types/Column.d.cts +4 -2
  120. package/dist/types/Column.d.ts +4 -2
  121. package/dist/types/ColumnDef.d.cts +5 -3
  122. package/dist/types/ColumnDef.d.ts +5 -3
  123. package/dist/types/Row.d.cts +3 -1
  124. package/dist/types/Row.d.ts +3 -1
  125. package/dist/types/RowModel.d.cts +1 -1
  126. package/dist/types/RowModel.d.ts +1 -1
  127. package/dist/types/RowModelFns.d.cts +3 -3
  128. package/dist/types/RowModelFns.d.ts +3 -3
  129. package/dist/types/Table.d.cts +1 -1
  130. package/dist/types/Table.d.ts +1 -1
  131. package/dist/types/TableFeatures.d.cts +19 -11
  132. package/dist/types/TableFeatures.d.ts +19 -11
  133. package/dist/types/TableOptions.d.cts +5 -3
  134. package/dist/types/TableOptions.d.ts +5 -3
  135. package/dist/types/TableState.d.cts +1 -1
  136. package/dist/types/TableState.d.ts +1 -1
  137. package/dist/types/type-utils.d.cts +8 -1
  138. package/dist/types/type-utils.d.ts +8 -1
  139. package/dist/worker/initTableWorker.cjs.map +1 -1
  140. package/dist/worker/initTableWorker.js.map +1 -1
  141. package/package.json +1 -1
  142. package/skills/aggregation/SKILL.md +131 -0
  143. package/skills/api-not-found/SKILL.md +1 -1
  144. package/skills/client-vs-server/SKILL.md +1 -1
  145. package/skills/column-faceting/SKILL.md +11 -5
  146. package/skills/column-filtering/SKILL.md +8 -3
  147. package/skills/column-ordering/SKILL.md +1 -1
  148. package/skills/column-pinning/SKILL.md +1 -1
  149. package/skills/column-resizing/SKILL.md +1 -1
  150. package/skills/column-sizing/SKILL.md +1 -1
  151. package/skills/column-visibility/SKILL.md +1 -1
  152. package/skills/core/SKILL.md +1 -1
  153. package/skills/custom-features/SKILL.md +1 -1
  154. package/skills/expanding/SKILL.md +1 -1
  155. package/skills/global-filtering/SKILL.md +3 -3
  156. package/skills/grouping/SKILL.md +12 -13
  157. package/skills/migrate-v8-to-v9/SKILL.md +21 -8
  158. package/skills/pagination/SKILL.md +1 -1
  159. package/skills/row-pinning/SKILL.md +1 -1
  160. package/skills/row-selection/SKILL.md +1 -1
  161. package/skills/sorting/SKILL.md +9 -3
  162. package/skills/table-features/SKILL.md +19 -13
  163. package/skills/typescript/SKILL.md +1 -1
  164. package/src/core/row-models/coreRowModelsFeature.utils.ts +1 -1
  165. package/src/features/aggregation/aggregationFeature.ts +59 -0
  166. package/src/features/aggregation/aggregationFeature.types.ts +312 -0
  167. package/src/features/aggregation/aggregationFeature.utils.ts +401 -0
  168. package/src/features/aggregation/aggregationFns.ts +336 -0
  169. package/src/features/column-filtering/columnFilteringFeature.types.ts +61 -1
  170. package/src/features/column-filtering/columnFilteringFeature.utils.ts +33 -19
  171. package/src/features/column-filtering/createFilteredRowModel.ts +13 -3
  172. package/src/features/column-filtering/filterFns.ts +533 -0
  173. package/src/features/column-grouping/columnGroupingFeature.ts +1 -20
  174. package/src/features/column-grouping/columnGroupingFeature.types.ts +4 -86
  175. package/src/features/column-grouping/columnGroupingFeature.utils.ts +1 -88
  176. package/src/features/column-grouping/createGroupedRowModel.ts +32 -38
  177. package/src/features/global-filtering/globalFilteringFeature.utils.ts +9 -1
  178. package/src/features/row-sorting/createSortedRowModel.ts +6 -2
  179. package/src/features/row-sorting/rowSortingFeature.types.ts +54 -2
  180. package/src/features/row-sorting/rowSortingFeature.utils.ts +46 -14
  181. package/src/{fns → features/row-sorting}/sortFns.ts +95 -81
  182. package/src/features/stockFeatures.ts +3 -0
  183. package/src/helpers/tableFeatures.ts +5 -4
  184. package/src/index.ts +7 -8
  185. package/src/static-functions.ts +1 -0
  186. package/src/types/Cell.ts +2 -0
  187. package/src/types/Column.ts +3 -1
  188. package/src/types/ColumnDef.ts +6 -3
  189. package/src/types/Row.ts +2 -0
  190. package/src/types/RowModelFns.ts +3 -3
  191. package/src/types/TableFeatures.ts +19 -11
  192. package/src/types/TableOptions.ts +5 -1
  193. package/src/types/type-utils.ts +8 -0
  194. package/src/worker/initTableWorker.ts +1 -1
  195. package/dist/fns/aggregationFns.cjs +0 -163
  196. package/dist/fns/aggregationFns.cjs.map +0 -1
  197. package/dist/fns/aggregationFns.d.cts +0 -85
  198. package/dist/fns/aggregationFns.d.ts +0 -85
  199. package/dist/fns/aggregationFns.js +0 -153
  200. package/dist/fns/aggregationFns.js.map +0 -1
  201. package/dist/fns/filterFns.cjs +0 -242
  202. package/dist/fns/filterFns.cjs.map +0 -1
  203. package/dist/fns/filterFns.d.cts +0 -178
  204. package/dist/fns/filterFns.d.ts +0 -178
  205. package/dist/fns/filterFns.js +0 -226
  206. package/dist/fns/filterFns.js.map +0 -1
  207. package/dist/fns/sortFns.cjs.map +0 -1
  208. package/dist/fns/sortFns.d.cts +0 -65
  209. package/dist/fns/sortFns.d.ts +0 -65
  210. package/dist/fns/sortFns.js.map +0 -1
  211. package/src/fns/aggregationFns.ts +0 -245
  212. package/src/fns/filterFns.ts +0 -455
@@ -1,65 +0,0 @@
1
- import { RowData } from "../types/type-utils.cjs";
2
- import { Row } from "../types/Row.cjs";
3
- import { TableFeatures } from "../types/TableFeatures.cjs";
4
-
5
- //#region src/fns/sortFns.d.ts
6
- /**
7
- * Regular expression used to split mixed text and numeric chunks.
8
- *
9
- * The alphanumeric sort functions use these chunks for natural sorting of
10
- * strings like `item2` before `item10`.
11
- */
12
- declare const reSplitAlphaNumeric: RegExp;
13
- /**
14
- * Sorts rows with the built-in alphanumeric strategy.
15
- *
16
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
17
- */
18
- declare const sortFn_alphanumeric: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
19
- /**
20
- * Sorts rows with the built-in alphanumeric case sensitive strategy.
21
- *
22
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
23
- */
24
- declare const sortFn_alphanumericCaseSensitive: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
25
- /**
26
- * Sorts rows with the built-in text strategy.
27
- *
28
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
29
- */
30
- declare const sortFn_text: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
31
- /**
32
- * Sorts rows with the built-in text case sensitive strategy.
33
- *
34
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
35
- */
36
- declare const sortFn_textCaseSensitive: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
37
- /**
38
- * Sorts rows with the built-in datetime strategy.
39
- *
40
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
41
- */
42
- declare const sortFn_datetime: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
43
- /**
44
- * Sorts rows with the built-in basic strategy.
45
- *
46
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
47
- */
48
- declare const sortFn_basic: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
49
- /**
50
- * The built-in sorting function registry.
51
- *
52
- * Pass this object to sorted row model creation or extend it with custom sorting functions.
53
- */
54
- declare const sortFns: {
55
- alphanumeric: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
56
- alphanumericCaseSensitive: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
57
- basic: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
58
- datetime: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
59
- text: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
60
- textCaseSensitive: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
61
- };
62
- type BuiltInSortFn = keyof typeof sortFns;
63
- //#endregion
64
- export { BuiltInSortFn, reSplitAlphaNumeric, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns };
65
- //# sourceMappingURL=sortFns.d.cts.map
@@ -1,65 +0,0 @@
1
- import { RowData } from "../types/type-utils.js";
2
- import { Row } from "../types/Row.js";
3
- import { TableFeatures } from "../types/TableFeatures.js";
4
-
5
- //#region src/fns/sortFns.d.ts
6
- /**
7
- * Regular expression used to split mixed text and numeric chunks.
8
- *
9
- * The alphanumeric sort functions use these chunks for natural sorting of
10
- * strings like `item2` before `item10`.
11
- */
12
- declare const reSplitAlphaNumeric: RegExp;
13
- /**
14
- * Sorts rows with the built-in alphanumeric strategy.
15
- *
16
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
17
- */
18
- declare const sortFn_alphanumeric: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
19
- /**
20
- * Sorts rows with the built-in alphanumeric case sensitive strategy.
21
- *
22
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
23
- */
24
- declare const sortFn_alphanumericCaseSensitive: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
25
- /**
26
- * Sorts rows with the built-in text strategy.
27
- *
28
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
29
- */
30
- declare const sortFn_text: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
31
- /**
32
- * Sorts rows with the built-in text case sensitive strategy.
33
- *
34
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
35
- */
36
- declare const sortFn_textCaseSensitive: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
37
- /**
38
- * Sorts rows with the built-in datetime strategy.
39
- *
40
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
41
- */
42
- declare const sortFn_datetime: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
43
- /**
44
- * Sorts rows with the built-in basic strategy.
45
- *
46
- * This comparator returns ascending-order results; descending order is applied by the sorting row model.
47
- */
48
- declare const sortFn_basic: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
49
- /**
50
- * The built-in sorting function registry.
51
- *
52
- * Pass this object to sorted row model creation or extend it with custom sorting functions.
53
- */
54
- declare const sortFns: {
55
- alphanumeric: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
56
- alphanumericCaseSensitive: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
57
- basic: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
58
- datetime: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
59
- text: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
60
- textCaseSensitive: <TFeatures extends TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
61
- };
62
- type BuiltInSortFn = keyof typeof sortFns;
63
- //#endregion
64
- export { BuiltInSortFn, reSplitAlphaNumeric, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns };
65
- //# sourceMappingURL=sortFns.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sortFns.js","names":[],"sources":["../../src/fns/sortFns.ts"],"sourcesContent":["import type { RowData } from '../types/type-utils'\nimport type { TableFeatures } from '../types/TableFeatures'\nimport type { Row } from '../types/Row'\n\n/**\n * Regular expression used to split mixed text and numeric chunks.\n *\n * The alphanumeric sort functions use these chunks for natural sorting of\n * strings like `item2` before `item10`.\n */\nexport const reSplitAlphaNumeric = /([0-9]+)/gm\n\n/**\n * Sorts rows with the built-in alphanumeric strategy.\n *\n * This comparator returns ascending-order results; descending order is applied by the sorting row model.\n */\nexport const sortFn_alphanumeric = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowA: Row<TFeatures, TData>,\n rowB: Row<TFeatures, TData>,\n columnId: string,\n) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase(),\n )\n}\n\n/**\n * Sorts rows with the built-in alphanumeric case sensitive strategy.\n *\n * This comparator returns ascending-order results; descending order is applied by the sorting row model.\n */\nexport const sortFn_alphanumericCaseSensitive = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowA: Row<TFeatures, TData>,\n rowB: Row<TFeatures, TData>,\n columnId: string,\n) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId)),\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\n/**\n * Sorts rows with the built-in text strategy.\n *\n * This comparator returns ascending-order results; descending order is applied by the sorting row model.\n */\nexport const sortFn_text = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowA: Row<TFeatures, TData>,\n rowB: Row<TFeatures, TData>,\n columnId: string,\n) => {\n return compareBasic(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase(),\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\n/**\n * Sorts rows with the built-in text case sensitive strategy.\n *\n * This comparator returns ascending-order results; descending order is applied by the sorting row model.\n */\nexport const sortFn_textCaseSensitive = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowA: Row<TFeatures, TData>,\n rowB: Row<TFeatures, TData>,\n columnId: string,\n) => {\n return compareBasic(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId)),\n )\n}\n\n/**\n * Sorts rows with the built-in datetime strategy.\n *\n * This comparator returns ascending-order results; descending order is applied by the sorting row model.\n */\nexport const sortFn_datetime = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowA: Row<TFeatures, TData>,\n rowB: Row<TFeatures, TData>,\n columnId: string,\n) => {\n const a = toDateSortValue(rowA.getValue(columnId))\n const b = toDateSortValue(rowB.getValue(columnId))\n\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n return a > b ? 1 : a < b ? -1 : 0\n}\n\n/**\n * Sorts rows with the built-in basic strategy.\n *\n * This comparator returns ascending-order results; descending order is applied by the sorting row model.\n */\nexport const sortFn_basic = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowA: Row<TFeatures, TData>,\n rowB: Row<TFeatures, TData>,\n columnId: string,\n) => {\n return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId))\n}\n\n// Utils\n\nfunction compareBasic(a: any, b: any) {\n return a === b ? 0 : a > b ? 1 : -1\n}\n\nfunction toDateSortValue(value: any) {\n return value instanceof Date ? value.getTime() : value\n}\n\nfunction toString(a: any) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return ''\n }\n return String(a)\n }\n if (typeof a === 'string') {\n return a\n }\n return ''\n}\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nfunction compareAlphanumeric(aStr: string, bStr: string) {\n let ai = 0\n let bi = 0\n const aLen = aStr.length\n const bLen = bStr.length\n\n while (ai < aLen && bi < bLen) {\n const aIsNumeric = isDigit(aStr.charCodeAt(ai))\n const bIsNumeric = isDigit(bStr.charCodeAt(bi))\n\n const aEnd = findChunkEnd(aStr, ai, aIsNumeric)\n const bEnd = findChunkEnd(bStr, bi, bIsNumeric)\n\n // Both are string chunks\n if (!aIsNumeric && !bIsNumeric) {\n const stringComparison = compareStringChunks(\n aStr,\n ai,\n aEnd,\n bStr,\n bi,\n bEnd,\n )\n if (stringComparison) {\n return stringComparison\n }\n ai = aEnd\n bi = bEnd\n continue\n }\n\n // One is a string chunk, one is a number chunk — the string sorts first\n if (aIsNumeric !== bIsNumeric) {\n return aIsNumeric ? 1 : -1\n }\n\n // Both are numeric chunks\n const numericComparison = compareNumericChunks(\n aStr,\n ai,\n aEnd,\n bStr,\n bi,\n bEnd,\n )\n if (numericComparison) {\n return numericComparison\n }\n\n ai = aEnd\n bi = bEnd\n }\n\n // One side is exhausted — compare the counts of remaining non-empty chunks\n return countRemainingChunks(aStr, ai) - countRemainingChunks(bStr, bi)\n}\n\nfunction isDigit(charCode: number) {\n return charCode >= 48 && charCode <= 57\n}\n\nfunction findChunkEnd(str: string, start: number, isNumeric: boolean) {\n let end = start + 1\n while (end < str.length && isDigit(str.charCodeAt(end)) === isNumeric) {\n end++\n }\n return end\n}\n\nfunction compareStringChunks(\n aStr: string,\n aStart: number,\n aEnd: number,\n bStr: string,\n bStart: number,\n bEnd: number,\n) {\n const aLength = aEnd - aStart\n const bLength = bEnd - bStart\n const minLength = aLength < bLength ? aLength : bLength\n\n for (let i = 0; i < minLength; i++) {\n const aCode = aStr.charCodeAt(aStart + i)\n const bCode = bStr.charCodeAt(bStart + i)\n\n if (aCode > bCode) {\n return 1\n }\n if (bCode > aCode) {\n return -1\n }\n }\n\n if (aLength > bLength) {\n return 1\n }\n if (bLength > aLength) {\n return -1\n }\n return 0\n}\n\nfunction compareNumericChunks(\n aStr: string,\n aStart: number,\n aEnd: number,\n bStr: string,\n bStart: number,\n bEnd: number,\n) {\n let aSignificantStart = aStart\n while (\n aSignificantStart < aEnd &&\n aStr.charCodeAt(aSignificantStart) === 48\n ) {\n aSignificantStart++\n }\n\n let bSignificantStart = bStart\n while (\n bSignificantStart < bEnd &&\n bStr.charCodeAt(bSignificantStart) === 48\n ) {\n bSignificantStart++\n }\n\n const aSignificantLength = aEnd - aSignificantStart\n const bSignificantLength = bEnd - bSignificantStart\n\n if (aSignificantLength === 0 && bSignificantLength === 0) {\n return 0\n }\n\n if (aSignificantLength <= 15 && bSignificantLength <= 15) {\n const an = parseSmallInt(aStr, aSignificantStart, aEnd)\n const bn = parseSmallInt(bStr, bSignificantStart, bEnd)\n\n if (an > bn) {\n return 1\n }\n if (bn > an) {\n return -1\n }\n return 0\n }\n\n // Preserve parseInt precision-collapse behavior for unusually large chunks.\n const an = parseInt(aStr.slice(aStart, aEnd), 10)\n const bn = parseInt(bStr.slice(bStart, bEnd), 10)\n\n if (an > bn) {\n return 1\n }\n if (bn > an) {\n return -1\n }\n return 0\n}\n\nfunction parseSmallInt(str: string, start: number, end: number) {\n let result = 0\n for (let i = start; i < end; i++) {\n result = result * 10 + str.charCodeAt(i) - 48\n }\n return result\n}\n\nfunction countRemainingChunks(str: string, start: number) {\n let count = 0\n let index = start\n\n while (index < str.length) {\n count++\n index = findChunkEnd(str, index, isDigit(str.charCodeAt(index)))\n }\n\n return count\n}\n\n// Exports\n\n/**\n * The built-in sorting function registry.\n *\n * Pass this object to sorted row model creation or extend it with custom sorting functions.\n */\nexport const sortFns = {\n alphanumeric: sortFn_alphanumeric,\n alphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,\n basic: sortFn_basic,\n datetime: sortFn_datetime,\n text: sortFn_text,\n text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AQ,aAAa,KAAK,OAAO,QAAQ,IAAI,WAAW,KAAK,CAAC,CAAC;CACjE;CAEA,OAAO;AACT;;;;;;AASA,MAAa,UAAU;CACrB,cAAc;CACd,2BAA2B;CAC3B,OAAO;CACP,UAAU;CACV,MAAM;CACN,mBAAmB;AACrB"}
@@ -1,245 +0,0 @@
1
- import type { RowData } from '../types/type-utils'
2
- import type { TableFeatures } from '../types/TableFeatures'
3
- import type { Row } from '../types/Row'
4
-
5
- /**
6
- * Sums numeric child-row values for a grouped column.
7
- *
8
- * Non-number values contribute `0`. Child rows are used so nested group totals
9
- * can reuse already aggregated values.
10
- */
11
- export function aggregationFn_sum<
12
- TFeatures extends TableFeatures,
13
- TData extends RowData,
14
- >(
15
- columnId: string,
16
- _leafRows: Array<Row<TFeatures, TData>>,
17
- childRows: Array<Row<TFeatures, TData>>,
18
- ) {
19
- // It's faster to just add the aggregations together instead of
20
- // process leaf nodes individually
21
- let sumValue = 0
22
- for (let i = 0; i < childRows.length; i++) {
23
- const nextValue = childRows[i]!.getValue(columnId)
24
- sumValue += typeof nextValue === 'number' ? nextValue : 0
25
- }
26
- return sumValue
27
- }
28
-
29
- /**
30
- * Finds the minimum numeric child-row value for a grouped column.
31
- *
32
- * Nullish and non-number values are ignored. Returns `undefined` when no
33
- * numeric value is found.
34
- */
35
- export function aggregationFn_min<
36
- TFeatures extends TableFeatures,
37
- TData extends RowData,
38
- >(
39
- columnId: string,
40
- _leafRows: Array<Row<TFeatures, TData>>,
41
- childRows: Array<Row<TFeatures, TData>>,
42
- ) {
43
- let minValue: number | undefined
44
-
45
- for (let i = 0; i < childRows.length; i++) {
46
- const value = childRows[i]!.getValue(columnId)
47
-
48
- if (
49
- typeof value === 'number' &&
50
- (minValue === undefined || value < minValue)
51
- ) {
52
- minValue = value
53
- }
54
- }
55
-
56
- return minValue
57
- }
58
-
59
- /**
60
- * Finds the maximum numeric child-row value for a grouped column.
61
- *
62
- * Nullish and non-number values are ignored. Returns `undefined` when no
63
- * numeric value is found.
64
- */
65
- export function aggregationFn_max<
66
- TFeatures extends TableFeatures,
67
- TData extends RowData,
68
- >(
69
- columnId: string,
70
- _leafRows: Array<Row<TFeatures, TData>>,
71
- childRows: Array<Row<TFeatures, TData>>,
72
- ) {
73
- let maxValue: number | undefined
74
-
75
- for (let i = 0; i < childRows.length; i++) {
76
- const value = childRows[i]!.getValue(columnId)
77
- if (
78
- typeof value === 'number' &&
79
- (maxValue === undefined || value > maxValue)
80
- ) {
81
- maxValue = value
82
- }
83
- }
84
-
85
- return maxValue
86
- }
87
-
88
- /**
89
- * Finds the numeric extent for a grouped column.
90
- *
91
- * Returns `[min, max]`, where each entry is `undefined` when no numeric value is
92
- * present.
93
- */
94
- export function aggregationFn_extent<
95
- TFeatures extends TableFeatures,
96
- TData extends RowData,
97
- >(
98
- columnId: string,
99
- _leafRows: Array<Row<TFeatures, TData>>,
100
- childRows: Array<Row<TFeatures, TData>>,
101
- ) {
102
- let minValue: number | undefined
103
- let maxValue: number | undefined
104
-
105
- for (let i = 0; i < childRows.length; i++) {
106
- const value = childRows[i]!.getValue(columnId)
107
- if (typeof value === 'number') {
108
- if (minValue === undefined) {
109
- minValue = maxValue = value
110
- } else {
111
- if (minValue > value) minValue = value
112
- if (maxValue! < value) maxValue = value
113
- }
114
- }
115
- }
116
-
117
- return [minValue, maxValue]
118
- }
119
-
120
- /**
121
- * Averages numeric leaf-row values for a grouped column.
122
- *
123
- * Number-like values are coerced with unary `+`; nullish and non-numeric values
124
- * are ignored.
125
- */
126
- export function aggregationFn_mean<
127
- TFeatures extends TableFeatures,
128
- TData extends RowData,
129
- >(columnId: string, leafRows: Array<Row<TFeatures, TData>>) {
130
- let count = 0
131
- let sumValue = 0
132
-
133
- for (let i = 0; i < leafRows.length; i++) {
134
- const value = leafRows[i]!.getValue(columnId)
135
- if (value != null && typeof value === 'number') {
136
- ++count
137
- sumValue += value
138
- } else if (value != null) {
139
- const numValue = +value
140
- if (!Number.isNaN(numValue)) {
141
- ++count
142
- sumValue += numValue
143
- }
144
- }
145
- }
146
-
147
- if (count) return sumValue / count
148
-
149
- return
150
- }
151
-
152
- /**
153
- * Computes the median of numeric leaf-row values for a grouped column.
154
- *
155
- * All values must be numbers. If any value is non-numeric, or no leaf rows are
156
- * present, the result is `undefined`.
157
- */
158
- export function aggregationFn_median<
159
- TFeatures extends TableFeatures,
160
- TData extends RowData,
161
- >(columnId: string, leafRows: Array<Row<TFeatures, TData>>) {
162
- if (!leafRows.length) {
163
- return
164
- }
165
-
166
- const values: Array<number> = new Array(leafRows.length)
167
- for (let i = 0; i < leafRows.length; i++) {
168
- const v = leafRows[i]!.getValue(columnId)
169
- if (typeof v !== 'number') return
170
- values[i] = v
171
- }
172
-
173
- if (values.length === 1) {
174
- return values[0]
175
- }
176
-
177
- const mid = Math.floor(values.length / 2)
178
- values.sort((a, b) => a - b)
179
- return values.length % 2 !== 0
180
- ? values[mid]
181
- : (values[mid - 1]! + values[mid]!) / 2
182
- }
183
-
184
- /**
185
- * Collects unique leaf-row values for a grouped column.
186
- *
187
- * Values are compared with JavaScript `Set` semantics.
188
- */
189
- export function aggregationFn_unique<
190
- TFeatures extends TableFeatures,
191
- TData extends RowData,
192
- >(columnId: string, leafRows: Array<Row<TFeatures, TData>>) {
193
- const set = new Set<unknown>()
194
- for (let i = 0; i < leafRows.length; i++) {
195
- set.add(leafRows[i]!.getValue(columnId))
196
- }
197
- return Array.from(set.values())
198
- }
199
-
200
- /**
201
- * Counts unique leaf-row values for a grouped column.
202
- *
203
- * Values are compared with JavaScript `Set` semantics.
204
- */
205
- export function aggregationFn_uniqueCount<
206
- TFeatures extends TableFeatures,
207
- TData extends RowData,
208
- >(columnId: string, leafRows: Array<Row<TFeatures, TData>>) {
209
- const set = new Set<unknown>()
210
- for (let i = 0; i < leafRows.length; i++) {
211
- set.add(leafRows[i]!.getValue(columnId))
212
- }
213
- return set.size
214
- }
215
-
216
- /**
217
- * Counts the number of leaf rows in the group.
218
- *
219
- * The column id is ignored because the result is based only on group size.
220
- */
221
- export function aggregationFn_count<
222
- TFeatures extends TableFeatures,
223
- TData extends RowData,
224
- >(_columnId: string, leafRows: Array<Row<TFeatures, TData>>) {
225
- return leafRows.length
226
- }
227
-
228
- /**
229
- * The built-in aggregation function registry.
230
- *
231
- * Pass this object to grouped row model creation or extend it with custom aggregation functions for grouped columns.
232
- */
233
- export const aggregationFns = {
234
- sum: aggregationFn_sum,
235
- min: aggregationFn_min,
236
- max: aggregationFn_max,
237
- extent: aggregationFn_extent,
238
- mean: aggregationFn_mean,
239
- median: aggregationFn_median,
240
- unique: aggregationFn_unique,
241
- uniqueCount: aggregationFn_uniqueCount,
242
- count: aggregationFn_count,
243
- }
244
-
245
- export type BuiltInAggregationFn = keyof typeof aggregationFns