@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.
- package/dist/core/row-models/coreRowModelsFeature.types.d.cts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.types.d.ts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.js +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
- package/dist/features/aggregation/aggregationFeature.cjs +38 -0
- package/dist/features/aggregation/aggregationFeature.cjs.map +1 -0
- package/dist/features/aggregation/aggregationFeature.d.cts +10 -0
- package/dist/features/aggregation/aggregationFeature.d.ts +10 -0
- package/dist/features/aggregation/aggregationFeature.js +38 -0
- package/dist/features/aggregation/aggregationFeature.js.map +1 -0
- package/dist/features/aggregation/aggregationFeature.types.cjs +13 -0
- package/dist/features/aggregation/aggregationFeature.types.cjs.map +1 -0
- package/dist/features/aggregation/aggregationFeature.types.d.cts +172 -0
- package/dist/features/aggregation/aggregationFeature.types.d.ts +172 -0
- package/dist/features/aggregation/aggregationFeature.types.js +12 -0
- package/dist/features/aggregation/aggregationFeature.types.js.map +1 -0
- package/dist/features/aggregation/aggregationFeature.utils.cjs +198 -0
- package/dist/features/aggregation/aggregationFeature.utils.cjs.map +1 -0
- package/dist/features/aggregation/aggregationFeature.utils.d.cts +33 -0
- package/dist/features/aggregation/aggregationFeature.utils.d.ts +33 -0
- package/dist/features/aggregation/aggregationFeature.utils.js +192 -0
- package/dist/features/aggregation/aggregationFeature.utils.js.map +1 -0
- package/dist/features/aggregation/aggregationFns.cjs +240 -0
- package/dist/features/aggregation/aggregationFns.cjs.map +1 -0
- package/dist/features/aggregation/aggregationFns.d.cts +67 -0
- package/dist/features/aggregation/aggregationFns.d.ts +67 -0
- package/dist/features/aggregation/aggregationFns.js +229 -0
- package/dist/features/aggregation/aggregationFns.js.map +1 -0
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +43 -3
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +43 -3
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +18 -9
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +6 -2
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +6 -2
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +18 -9
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.cjs +7 -2
- package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.d.cts +6 -2
- package/dist/features/column-filtering/createFilteredRowModel.d.ts +6 -2
- package/dist/features/column-filtering/createFilteredRowModel.js +7 -2
- package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
- package/dist/features/column-filtering/filterFns.cjs +399 -0
- package/dist/features/column-filtering/filterFns.cjs.map +1 -0
- package/dist/features/column-filtering/filterFns.d.cts +210 -0
- package/dist/features/column-filtering/filterFns.d.ts +210 -0
- package/dist/features/column-filtering/filterFns.js +375 -0
- package/dist/features/column-filtering/filterFns.js.map +1 -0
- package/dist/features/column-grouping/columnGroupingFeature.cjs +3 -12
- package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.d.cts +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.d.ts +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.js +4 -13
- package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +6 -49
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +6 -49
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +0 -50
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +2 -39
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +2 -39
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +2 -49
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.cjs +23 -13
- package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.d.cts +2 -3
- package/dist/features/column-grouping/createGroupedRowModel.d.ts +2 -3
- package/dist/features/column-grouping/createGroupedRowModel.js +25 -15
- package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +4 -2
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +2 -6
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +2 -6
- package/dist/features/global-filtering/globalFilteringFeature.utils.js +4 -2
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.cjs +6 -2
- package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.d.cts +6 -2
- package/dist/features/row-sorting/createSortedRowModel.d.ts +6 -2
- package/dist/features/row-sorting/createSortedRowModel.js +6 -2
- package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +32 -3
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +32 -3
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs +20 -5
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.js +20 -5
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/{fns → features/row-sorting}/sortFns.cjs +69 -22
- package/dist/features/row-sorting/sortFns.cjs.map +1 -0
- package/dist/features/row-sorting/sortFns.d.cts +98 -0
- package/dist/features/row-sorting/sortFns.d.ts +98 -0
- package/dist/{fns → features/row-sorting}/sortFns.js +69 -23
- package/dist/features/row-sorting/sortFns.js.map +1 -0
- package/dist/features/stockFeatures.cjs +2 -0
- package/dist/features/stockFeatures.cjs.map +1 -1
- package/dist/features/stockFeatures.d.cts +2 -0
- package/dist/features/stockFeatures.d.ts +2 -0
- package/dist/features/stockFeatures.js +2 -0
- package/dist/features/stockFeatures.js.map +1 -1
- package/dist/helpers/tableFeatures.cjs +5 -4
- package/dist/helpers/tableFeatures.cjs.map +1 -1
- package/dist/helpers/tableFeatures.d.cts +5 -4
- package/dist/helpers/tableFeatures.d.ts +5 -4
- package/dist/helpers/tableFeatures.js +5 -4
- package/dist/helpers/tableFeatures.js.map +1 -1
- package/dist/index.cjs +18 -3
- package/dist/index.d.cts +10 -8
- package/dist/index.d.ts +10 -8
- package/dist/index.js +6 -4
- package/dist/static-functions.cjs +8 -3
- package/dist/static-functions.d.cts +3 -2
- package/dist/static-functions.d.ts +3 -2
- package/dist/static-functions.js +3 -2
- package/dist/types/Cell.d.cts +3 -1
- package/dist/types/Cell.d.ts +3 -1
- package/dist/types/Column.d.cts +4 -2
- package/dist/types/Column.d.ts +4 -2
- package/dist/types/ColumnDef.d.cts +5 -3
- package/dist/types/ColumnDef.d.ts +5 -3
- package/dist/types/Row.d.cts +3 -1
- package/dist/types/Row.d.ts +3 -1
- package/dist/types/RowModel.d.cts +1 -1
- package/dist/types/RowModel.d.ts +1 -1
- package/dist/types/RowModelFns.d.cts +3 -3
- package/dist/types/RowModelFns.d.ts +3 -3
- package/dist/types/Table.d.cts +1 -1
- package/dist/types/Table.d.ts +1 -1
- package/dist/types/TableFeatures.d.cts +19 -11
- package/dist/types/TableFeatures.d.ts +19 -11
- package/dist/types/TableOptions.d.cts +5 -3
- package/dist/types/TableOptions.d.ts +5 -3
- package/dist/types/TableState.d.cts +1 -1
- package/dist/types/TableState.d.ts +1 -1
- package/dist/types/type-utils.d.cts +8 -1
- package/dist/types/type-utils.d.ts +8 -1
- package/dist/worker/initTableWorker.cjs.map +1 -1
- package/dist/worker/initTableWorker.js.map +1 -1
- package/package.json +1 -1
- package/skills/aggregation/SKILL.md +131 -0
- package/skills/api-not-found/SKILL.md +1 -1
- package/skills/client-vs-server/SKILL.md +1 -1
- package/skills/column-faceting/SKILL.md +11 -5
- package/skills/column-filtering/SKILL.md +8 -3
- package/skills/column-ordering/SKILL.md +1 -1
- package/skills/column-pinning/SKILL.md +1 -1
- package/skills/column-resizing/SKILL.md +1 -1
- package/skills/column-sizing/SKILL.md +1 -1
- package/skills/column-visibility/SKILL.md +1 -1
- package/skills/core/SKILL.md +1 -1
- package/skills/custom-features/SKILL.md +1 -1
- package/skills/expanding/SKILL.md +1 -1
- package/skills/global-filtering/SKILL.md +3 -3
- package/skills/grouping/SKILL.md +12 -13
- package/skills/migrate-v8-to-v9/SKILL.md +21 -8
- package/skills/pagination/SKILL.md +1 -1
- package/skills/row-pinning/SKILL.md +1 -1
- package/skills/row-selection/SKILL.md +1 -1
- package/skills/sorting/SKILL.md +9 -3
- package/skills/table-features/SKILL.md +19 -13
- package/skills/typescript/SKILL.md +1 -1
- package/src/core/row-models/coreRowModelsFeature.utils.ts +1 -1
- package/src/features/aggregation/aggregationFeature.ts +59 -0
- package/src/features/aggregation/aggregationFeature.types.ts +312 -0
- package/src/features/aggregation/aggregationFeature.utils.ts +401 -0
- package/src/features/aggregation/aggregationFns.ts +336 -0
- package/src/features/column-filtering/columnFilteringFeature.types.ts +61 -1
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +33 -19
- package/src/features/column-filtering/createFilteredRowModel.ts +13 -3
- package/src/features/column-filtering/filterFns.ts +533 -0
- package/src/features/column-grouping/columnGroupingFeature.ts +1 -20
- package/src/features/column-grouping/columnGroupingFeature.types.ts +4 -86
- package/src/features/column-grouping/columnGroupingFeature.utils.ts +1 -88
- package/src/features/column-grouping/createGroupedRowModel.ts +32 -38
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +9 -1
- package/src/features/row-sorting/createSortedRowModel.ts +6 -2
- package/src/features/row-sorting/rowSortingFeature.types.ts +54 -2
- package/src/features/row-sorting/rowSortingFeature.utils.ts +46 -14
- package/src/{fns → features/row-sorting}/sortFns.ts +95 -81
- package/src/features/stockFeatures.ts +3 -0
- package/src/helpers/tableFeatures.ts +5 -4
- package/src/index.ts +7 -8
- package/src/static-functions.ts +1 -0
- package/src/types/Cell.ts +2 -0
- package/src/types/Column.ts +3 -1
- package/src/types/ColumnDef.ts +6 -3
- package/src/types/Row.ts +2 -0
- package/src/types/RowModelFns.ts +3 -3
- package/src/types/TableFeatures.ts +19 -11
- package/src/types/TableOptions.ts +5 -1
- package/src/types/type-utils.ts +8 -0
- package/src/worker/initTableWorker.ts +1 -1
- package/dist/fns/aggregationFns.cjs +0 -163
- package/dist/fns/aggregationFns.cjs.map +0 -1
- package/dist/fns/aggregationFns.d.cts +0 -85
- package/dist/fns/aggregationFns.d.ts +0 -85
- package/dist/fns/aggregationFns.js +0 -153
- package/dist/fns/aggregationFns.js.map +0 -1
- package/dist/fns/filterFns.cjs +0 -242
- package/dist/fns/filterFns.cjs.map +0 -1
- package/dist/fns/filterFns.d.cts +0 -178
- package/dist/fns/filterFns.d.ts +0 -178
- package/dist/fns/filterFns.js +0 -226
- package/dist/fns/filterFns.js.map +0 -1
- package/dist/fns/sortFns.cjs.map +0 -1
- package/dist/fns/sortFns.d.cts +0 -65
- package/dist/fns/sortFns.d.ts +0 -65
- package/dist/fns/sortFns.js.map +0 -1
- package/src/fns/aggregationFns.ts +0 -245
- package/src/fns/filterFns.ts +0 -455
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { RowData } from "../../types/type-utils.js";
|
|
2
|
+
import { CreatedSortFn, SortFnDef } from "./rowSortingFeature.types.js";
|
|
3
|
+
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
4
|
+
|
|
5
|
+
//#region src/features/row-sorting/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
|
+
* Builds a `SortFn` from a value-level comparator plus an optional
|
|
15
|
+
* `resolveDataValue` normalizer.
|
|
16
|
+
*
|
|
17
|
+
* The `sort` comparator receives both rows' data values, each already passed
|
|
18
|
+
* through `resolveDataValue` when one is defined. Keeping normalization in the
|
|
19
|
+
* resolver means a variant of an existing sorting function only has to swap
|
|
20
|
+
* the resolver, not re-implement the comparison.
|
|
21
|
+
*
|
|
22
|
+
* The definition is attached to the returned function, so a variant can be
|
|
23
|
+
* created by spreading a built-in sorting function and overriding what
|
|
24
|
+
* differs:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* const stripDiacritics = (value: string) =>
|
|
28
|
+
* value.normalize('NFD').replace(/\p{Diacritic}/gu, '')
|
|
29
|
+
*
|
|
30
|
+
* const alphanumericIgnoreDiacritics = constructSortFn({
|
|
31
|
+
* ...sortFn_alphanumeric,
|
|
32
|
+
* resolveDataValue: (value) =>
|
|
33
|
+
* stripDiacritics(sortFn_alphanumeric.resolveDataValue!(value)),
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare function constructSortFn<TFeatures extends TableFeatures = any, TData extends RowData = any>(def: SortFnDef<TFeatures, TData>): CreatedSortFn<TFeatures, TData>;
|
|
38
|
+
/**
|
|
39
|
+
* Sorts rows with the built-in alphanumeric strategy.
|
|
40
|
+
*
|
|
41
|
+
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
42
|
+
*/
|
|
43
|
+
declare const sortFn_alphanumeric: CreatedSortFn<any, any>;
|
|
44
|
+
/**
|
|
45
|
+
* Sorts rows with the built-in alphanumeric case sensitive strategy.
|
|
46
|
+
*
|
|
47
|
+
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
48
|
+
*/
|
|
49
|
+
declare const sortFn_alphanumericCaseSensitive: CreatedSortFn<any, any>;
|
|
50
|
+
/**
|
|
51
|
+
* Sorts rows with the built-in text strategy.
|
|
52
|
+
*
|
|
53
|
+
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
54
|
+
*/
|
|
55
|
+
declare const sortFn_text: CreatedSortFn<any, any>;
|
|
56
|
+
/**
|
|
57
|
+
* Sorts rows with the built-in text case sensitive strategy.
|
|
58
|
+
*
|
|
59
|
+
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
60
|
+
*/
|
|
61
|
+
declare const sortFn_textCaseSensitive: CreatedSortFn<any, any>;
|
|
62
|
+
/**
|
|
63
|
+
* Sorts rows with the built-in datetime strategy.
|
|
64
|
+
*
|
|
65
|
+
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
66
|
+
*/
|
|
67
|
+
declare const sortFn_datetime: CreatedSortFn<any, any>;
|
|
68
|
+
/**
|
|
69
|
+
* Sorts rows with the built-in basic strategy.
|
|
70
|
+
*
|
|
71
|
+
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
72
|
+
*/
|
|
73
|
+
declare const sortFn_basic: CreatedSortFn<any, any>;
|
|
74
|
+
/**
|
|
75
|
+
* The built-in sorting function registry.
|
|
76
|
+
*
|
|
77
|
+
* Registering this full object opts out of tree-shaking: every built-in
|
|
78
|
+
* sorting function ends up in your bundle. Prefer importing the `sortFn_*`
|
|
79
|
+
* functions you actually use and registering just those in the `sortFns`
|
|
80
|
+
* slot, or passing them directly to the `sortFn` column option.
|
|
81
|
+
*
|
|
82
|
+
* @deprecated Import individual `sortFn_*` functions instead for a smaller
|
|
83
|
+
* bundle. This export still works and is not going away in v9, but built-in
|
|
84
|
+
* name resolution (including `sortFn: 'auto'`) only finds functions you
|
|
85
|
+
* register yourself.
|
|
86
|
+
*/
|
|
87
|
+
declare const sortFns: {
|
|
88
|
+
alphanumeric: CreatedSortFn<any, any>;
|
|
89
|
+
alphanumericCaseSensitive: CreatedSortFn<any, any>;
|
|
90
|
+
basic: CreatedSortFn<any, any>;
|
|
91
|
+
datetime: CreatedSortFn<any, any>;
|
|
92
|
+
text: CreatedSortFn<any, any>;
|
|
93
|
+
textCaseSensitive: CreatedSortFn<any, any>;
|
|
94
|
+
};
|
|
95
|
+
type BuiltInSortFn = keyof typeof sortFns;
|
|
96
|
+
//#endregion
|
|
97
|
+
export { BuiltInSortFn, constructSortFn, reSplitAlphaNumeric, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns };
|
|
98
|
+
//# sourceMappingURL=sortFns.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/features/row-sorting/sortFns.ts
|
|
2
2
|
/**
|
|
3
3
|
* Regular expression used to split mixed text and numeric chunks.
|
|
4
4
|
*
|
|
@@ -7,55 +7,93 @@
|
|
|
7
7
|
*/
|
|
8
8
|
const reSplitAlphaNumeric = /([0-9]+)/gm;
|
|
9
9
|
/**
|
|
10
|
+
* Builds a `SortFn` from a value-level comparator plus an optional
|
|
11
|
+
* `resolveDataValue` normalizer.
|
|
12
|
+
*
|
|
13
|
+
* The `sort` comparator receives both rows' data values, each already passed
|
|
14
|
+
* through `resolveDataValue` when one is defined. Keeping normalization in the
|
|
15
|
+
* resolver means a variant of an existing sorting function only has to swap
|
|
16
|
+
* the resolver, not re-implement the comparison.
|
|
17
|
+
*
|
|
18
|
+
* The definition is attached to the returned function, so a variant can be
|
|
19
|
+
* created by spreading a built-in sorting function and overriding what
|
|
20
|
+
* differs:
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* const stripDiacritics = (value: string) =>
|
|
24
|
+
* value.normalize('NFD').replace(/\p{Diacritic}/gu, '')
|
|
25
|
+
*
|
|
26
|
+
* const alphanumericIgnoreDiacritics = constructSortFn({
|
|
27
|
+
* ...sortFn_alphanumeric,
|
|
28
|
+
* resolveDataValue: (value) =>
|
|
29
|
+
* stripDiacritics(sortFn_alphanumeric.resolveDataValue!(value)),
|
|
30
|
+
* })
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function constructSortFn(def) {
|
|
34
|
+
const sortFn = Object.assign((rowA, rowB, columnId) => {
|
|
35
|
+
let dataValueA = rowA.getValue(columnId);
|
|
36
|
+
let dataValueB = rowB.getValue(columnId);
|
|
37
|
+
const resolveDataValue = sortFn.resolveDataValue;
|
|
38
|
+
if (resolveDataValue) {
|
|
39
|
+
dataValueA = resolveDataValue(dataValueA);
|
|
40
|
+
dataValueB = resolveDataValue(dataValueB);
|
|
41
|
+
}
|
|
42
|
+
return sortFn.sort(dataValueA, dataValueB, rowA, rowB, columnId);
|
|
43
|
+
}, def);
|
|
44
|
+
return sortFn;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
10
47
|
* Sorts rows with the built-in alphanumeric strategy.
|
|
11
48
|
*
|
|
12
49
|
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
13
50
|
*/
|
|
14
|
-
const sortFn_alphanumeric = (
|
|
15
|
-
|
|
16
|
-
|
|
51
|
+
const sortFn_alphanumeric = constructSortFn({
|
|
52
|
+
resolveDataValue: (dataValue) => toString(dataValue).toLowerCase(),
|
|
53
|
+
sort: (dataValueA, dataValueB) => compareAlphanumeric(dataValueA, dataValueB)
|
|
54
|
+
});
|
|
17
55
|
/**
|
|
18
56
|
* Sorts rows with the built-in alphanumeric case sensitive strategy.
|
|
19
57
|
*
|
|
20
58
|
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
21
59
|
*/
|
|
22
|
-
const sortFn_alphanumericCaseSensitive = (
|
|
23
|
-
|
|
24
|
-
|
|
60
|
+
const sortFn_alphanumericCaseSensitive = constructSortFn({
|
|
61
|
+
resolveDataValue: (dataValue) => toString(dataValue),
|
|
62
|
+
sort: (dataValueA, dataValueB) => compareAlphanumeric(dataValueA, dataValueB)
|
|
63
|
+
});
|
|
25
64
|
/**
|
|
26
65
|
* Sorts rows with the built-in text strategy.
|
|
27
66
|
*
|
|
28
67
|
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
29
68
|
*/
|
|
30
|
-
const sortFn_text = (
|
|
31
|
-
|
|
32
|
-
|
|
69
|
+
const sortFn_text = constructSortFn({
|
|
70
|
+
resolveDataValue: (dataValue) => toString(dataValue).toLowerCase(),
|
|
71
|
+
sort: (dataValueA, dataValueB) => compareBasic(dataValueA, dataValueB)
|
|
72
|
+
});
|
|
33
73
|
/**
|
|
34
74
|
* Sorts rows with the built-in text case sensitive strategy.
|
|
35
75
|
*
|
|
36
76
|
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
37
77
|
*/
|
|
38
|
-
const sortFn_textCaseSensitive = (
|
|
39
|
-
|
|
40
|
-
|
|
78
|
+
const sortFn_textCaseSensitive = constructSortFn({
|
|
79
|
+
resolveDataValue: (dataValue) => toString(dataValue),
|
|
80
|
+
sort: (dataValueA, dataValueB) => compareBasic(dataValueA, dataValueB)
|
|
81
|
+
});
|
|
41
82
|
/**
|
|
42
83
|
* Sorts rows with the built-in datetime strategy.
|
|
43
84
|
*
|
|
44
85
|
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
45
86
|
*/
|
|
46
|
-
const sortFn_datetime = (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
87
|
+
const sortFn_datetime = constructSortFn({
|
|
88
|
+
resolveDataValue: (dataValue) => toDateSortValue(dataValue),
|
|
89
|
+
sort: (dataValueA, dataValueB) => dataValueA > dataValueB ? 1 : dataValueA < dataValueB ? -1 : 0
|
|
90
|
+
});
|
|
51
91
|
/**
|
|
52
92
|
* Sorts rows with the built-in basic strategy.
|
|
53
93
|
*
|
|
54
94
|
* This comparator returns ascending-order results; descending order is applied by the sorting row model.
|
|
55
95
|
*/
|
|
56
|
-
const sortFn_basic = (
|
|
57
|
-
return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
|
|
58
|
-
};
|
|
96
|
+
const sortFn_basic = constructSortFn({ sort: (dataValueA, dataValueB) => compareBasic(dataValueA, dataValueB) });
|
|
59
97
|
function compareBasic(a, b) {
|
|
60
98
|
return a === b ? 0 : a > b ? 1 : -1;
|
|
61
99
|
}
|
|
@@ -155,7 +193,15 @@ function countRemainingChunks(str, start) {
|
|
|
155
193
|
/**
|
|
156
194
|
* The built-in sorting function registry.
|
|
157
195
|
*
|
|
158
|
-
*
|
|
196
|
+
* Registering this full object opts out of tree-shaking: every built-in
|
|
197
|
+
* sorting function ends up in your bundle. Prefer importing the `sortFn_*`
|
|
198
|
+
* functions you actually use and registering just those in the `sortFns`
|
|
199
|
+
* slot, or passing them directly to the `sortFn` column option.
|
|
200
|
+
*
|
|
201
|
+
* @deprecated Import individual `sortFn_*` functions instead for a smaller
|
|
202
|
+
* bundle. This export still works and is not going away in v9, but built-in
|
|
203
|
+
* name resolution (including `sortFn: 'auto'`) only finds functions you
|
|
204
|
+
* register yourself.
|
|
159
205
|
*/
|
|
160
206
|
const sortFns = {
|
|
161
207
|
alphanumeric: sortFn_alphanumeric,
|
|
@@ -167,5 +213,5 @@ const sortFns = {
|
|
|
167
213
|
};
|
|
168
214
|
|
|
169
215
|
//#endregion
|
|
170
|
-
export { reSplitAlphaNumeric, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns };
|
|
216
|
+
export { constructSortFn, reSplitAlphaNumeric, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns };
|
|
171
217
|
//# sourceMappingURL=sortFns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortFns.js","names":[],"sources":["../../../src/features/row-sorting/sortFns.ts"],"sourcesContent":["import type { CreatedSortFn, SortFnDef } from './rowSortingFeature.types'\nimport 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 * Builds a `SortFn` from a value-level comparator plus an optional\n * `resolveDataValue` normalizer.\n *\n * The `sort` comparator receives both rows' data values, each already passed\n * through `resolveDataValue` when one is defined. Keeping normalization in the\n * resolver means a variant of an existing sorting function only has to swap\n * the resolver, not re-implement the comparison.\n *\n * The definition is attached to the returned function, so a variant can be\n * created by spreading a built-in sorting function and overriding what\n * differs:\n *\n * ```ts\n * const stripDiacritics = (value: string) =>\n * value.normalize('NFD').replace(/\\p{Diacritic}/gu, '')\n *\n * const alphanumericIgnoreDiacritics = constructSortFn({\n * ...sortFn_alphanumeric,\n * resolveDataValue: (value) =>\n * stripDiacritics(sortFn_alphanumeric.resolveDataValue!(value)),\n * })\n * ```\n */\nexport function constructSortFn<\n TFeatures extends TableFeatures = any,\n TData extends RowData = any,\n>(def: SortFnDef<TFeatures, TData>): CreatedSortFn<TFeatures, TData> {\n const sortFn: CreatedSortFn<TFeatures, TData> = Object.assign(\n <TRowFeatures extends TableFeatures, TRowData extends RowData>(\n rowA: Row<TRowFeatures, TRowData>,\n rowB: Row<TRowFeatures, TRowData>,\n columnId: string,\n ): number => {\n let dataValueA = rowA.getValue(columnId)\n let dataValueB = rowB.getValue(columnId)\n const resolveDataValue = sortFn.resolveDataValue\n if (resolveDataValue) {\n dataValueA = resolveDataValue(dataValueA)\n dataValueB = resolveDataValue(dataValueB)\n }\n // The def's comparator is typed against the factory's TFeatures/TData;\n // the caller's row generics are erased at this boundary.\n return sortFn.sort(\n dataValueA,\n dataValueB,\n rowA as any,\n rowB as any,\n columnId,\n )\n },\n def,\n )\n return sortFn\n}\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 = constructSortFn({\n resolveDataValue: (dataValue) => toString(dataValue).toLowerCase(),\n sort: (dataValueA, dataValueB) => compareAlphanumeric(dataValueA, dataValueB),\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 = constructSortFn({\n resolveDataValue: (dataValue) => toString(dataValue),\n sort: (dataValueA, dataValueB) => compareAlphanumeric(dataValueA, dataValueB),\n})\n\n// The text sort 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 = constructSortFn({\n resolveDataValue: (dataValue) => toString(dataValue).toLowerCase(),\n sort: (dataValueA, dataValueB) => compareBasic(dataValueA, dataValueB),\n})\n\n// The text sort 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 = constructSortFn({\n resolveDataValue: (dataValue) => toString(dataValue),\n sort: (dataValueA, dataValueB) => compareBasic(dataValueA, dataValueB),\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 = constructSortFn({\n resolveDataValue: (dataValue) => toDateSortValue(dataValue),\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n sort: (dataValueA, dataValueB) =>\n dataValueA > dataValueB ? 1 : dataValueA < dataValueB ? -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 = constructSortFn({\n sort: (dataValueA, dataValueB) => compareBasic(dataValueA, dataValueB),\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 * Registering this full object opts out of tree-shaking: every built-in\n * sorting function ends up in your bundle. Prefer importing the `sortFn_*`\n * functions you actually use and registering just those in the `sortFns`\n * slot, or passing them directly to the `sortFn` column option.\n *\n * @deprecated Import individual `sortFn_*` functions instead for a smaller\n * bundle. This export still works and is not going away in v9, but built-in\n * name resolution (including `sortFn: 'auto'`) only finds functions you\n * register yourself.\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 textCaseSensitive: sortFn_textCaseSensitive,\n}\n\nexport type BuiltInSortFn = keyof typeof sortFns\n"],"mappings":"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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_columnFacetingFeature = require('./column-faceting/columnFacetingFeature.cjs');
|
|
2
|
+
const require_aggregationFeature = require('./aggregation/aggregationFeature.cjs');
|
|
2
3
|
const require_columnFilteringFeature = require('./column-filtering/columnFilteringFeature.cjs');
|
|
3
4
|
const require_columnGroupingFeature = require('./column-grouping/columnGroupingFeature.cjs');
|
|
4
5
|
const require_columnOrderingFeature = require('./column-ordering/columnOrderingFeature.cjs');
|
|
@@ -20,6 +21,7 @@ const require_rowSortingFeature = require('./row-sorting/rowSortingFeature.cjs')
|
|
|
20
21
|
* Use individual feature exports for tree-shaking, or this aggregate when a table should include every built-in feature.
|
|
21
22
|
*/
|
|
22
23
|
const stockFeatures = {
|
|
24
|
+
aggregationFeature: require_aggregationFeature.aggregationFeature,
|
|
23
25
|
columnFacetingFeature: require_columnFacetingFeature.columnFacetingFeature,
|
|
24
26
|
columnFilteringFeature: require_columnFilteringFeature.columnFilteringFeature,
|
|
25
27
|
columnGroupingFeature: require_columnGroupingFeature.columnGroupingFeature,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stockFeatures.cjs","names":[],"sources":["../../src/features/stockFeatures.ts"],"sourcesContent":["import { columnFacetingFeature } from './column-faceting/columnFacetingFeature'\nimport { columnFilteringFeature } from './column-filtering/columnFilteringFeature'\nimport { columnGroupingFeature } from './column-grouping/columnGroupingFeature'\nimport { columnOrderingFeature } from './column-ordering/columnOrderingFeature'\nimport { columnPinningFeature } from './column-pinning/columnPinningFeature'\nimport { columnResizingFeature } from './column-resizing/columnResizingFeature'\nimport { columnSizingFeature } from './column-sizing/columnSizingFeature'\nimport { columnVisibilityFeature } from './column-visibility/columnVisibilityFeature'\nimport { globalFilteringFeature } from './global-filtering/globalFilteringFeature'\nimport { rowExpandingFeature } from './row-expanding/rowExpandingFeature'\nimport { rowPaginationFeature } from './row-pagination/rowPaginationFeature'\nimport { rowPinningFeature } from './row-pinning/rowPinningFeature'\nimport { rowSelectionFeature } from './row-selection/rowSelectionFeature'\nimport { rowSortingFeature } from './row-sorting/rowSortingFeature'\n\nexport interface StockFeatures {\n columnFacetingFeature: typeof columnFacetingFeature\n columnFilteringFeature: typeof columnFilteringFeature\n columnGroupingFeature: typeof columnGroupingFeature\n columnOrderingFeature: typeof columnOrderingFeature\n columnPinningFeature: typeof columnPinningFeature\n columnResizingFeature: typeof columnResizingFeature\n columnSizingFeature: typeof columnSizingFeature\n columnVisibilityFeature: typeof columnVisibilityFeature\n globalFilteringFeature: typeof globalFilteringFeature\n rowExpandingFeature: typeof rowExpandingFeature\n rowPaginationFeature: typeof rowPaginationFeature\n rowPinningFeature: typeof rowPinningFeature\n rowSelectionFeature: typeof rowSelectionFeature\n rowSortingFeature: typeof rowSortingFeature\n}\n\n/**\n * The complete set of stock optional table features.\n *\n * Use individual feature exports for tree-shaking, or this aggregate when a table should include every built-in feature.\n */\nexport const stockFeatures: StockFeatures = {\n columnFacetingFeature,\n columnFilteringFeature,\n columnGroupingFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnResizingFeature,\n columnSizingFeature,\n columnVisibilityFeature,\n globalFilteringFeature,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n} as const\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"stockFeatures.cjs","names":[],"sources":["../../src/features/stockFeatures.ts"],"sourcesContent":["import { columnFacetingFeature } from './column-faceting/columnFacetingFeature'\nimport { aggregationFeature } from './aggregation/aggregationFeature'\nimport { columnFilteringFeature } from './column-filtering/columnFilteringFeature'\nimport { columnGroupingFeature } from './column-grouping/columnGroupingFeature'\nimport { columnOrderingFeature } from './column-ordering/columnOrderingFeature'\nimport { columnPinningFeature } from './column-pinning/columnPinningFeature'\nimport { columnResizingFeature } from './column-resizing/columnResizingFeature'\nimport { columnSizingFeature } from './column-sizing/columnSizingFeature'\nimport { columnVisibilityFeature } from './column-visibility/columnVisibilityFeature'\nimport { globalFilteringFeature } from './global-filtering/globalFilteringFeature'\nimport { rowExpandingFeature } from './row-expanding/rowExpandingFeature'\nimport { rowPaginationFeature } from './row-pagination/rowPaginationFeature'\nimport { rowPinningFeature } from './row-pinning/rowPinningFeature'\nimport { rowSelectionFeature } from './row-selection/rowSelectionFeature'\nimport { rowSortingFeature } from './row-sorting/rowSortingFeature'\n\nexport interface StockFeatures {\n aggregationFeature: typeof aggregationFeature\n columnFacetingFeature: typeof columnFacetingFeature\n columnFilteringFeature: typeof columnFilteringFeature\n columnGroupingFeature: typeof columnGroupingFeature\n columnOrderingFeature: typeof columnOrderingFeature\n columnPinningFeature: typeof columnPinningFeature\n columnResizingFeature: typeof columnResizingFeature\n columnSizingFeature: typeof columnSizingFeature\n columnVisibilityFeature: typeof columnVisibilityFeature\n globalFilteringFeature: typeof globalFilteringFeature\n rowExpandingFeature: typeof rowExpandingFeature\n rowPaginationFeature: typeof rowPaginationFeature\n rowPinningFeature: typeof rowPinningFeature\n rowSelectionFeature: typeof rowSelectionFeature\n rowSortingFeature: typeof rowSortingFeature\n}\n\n/**\n * The complete set of stock optional table features.\n *\n * Use individual feature exports for tree-shaking, or this aggregate when a table should include every built-in feature.\n */\nexport const stockFeatures: StockFeatures = {\n aggregationFeature,\n columnFacetingFeature,\n columnFilteringFeature,\n columnGroupingFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnResizingFeature,\n columnSizingFeature,\n columnVisibilityFeature,\n globalFilteringFeature,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n} as const\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAa,gBAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { columnFacetingFeature } from "./column-faceting/columnFacetingFeature.cjs";
|
|
2
|
+
import { aggregationFeature } from "./aggregation/aggregationFeature.cjs";
|
|
2
3
|
import { columnFilteringFeature } from "./column-filtering/columnFilteringFeature.cjs";
|
|
3
4
|
import { columnGroupingFeature } from "./column-grouping/columnGroupingFeature.cjs";
|
|
4
5
|
import { columnOrderingFeature } from "./column-ordering/columnOrderingFeature.cjs";
|
|
@@ -15,6 +16,7 @@ import { rowSortingFeature } from "./row-sorting/rowSortingFeature.cjs";
|
|
|
15
16
|
|
|
16
17
|
//#region src/features/stockFeatures.d.ts
|
|
17
18
|
interface StockFeatures {
|
|
19
|
+
aggregationFeature: typeof aggregationFeature;
|
|
18
20
|
columnFacetingFeature: typeof columnFacetingFeature;
|
|
19
21
|
columnFilteringFeature: typeof columnFilteringFeature;
|
|
20
22
|
columnGroupingFeature: typeof columnGroupingFeature;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { columnFacetingFeature } from "./column-faceting/columnFacetingFeature.js";
|
|
2
|
+
import { aggregationFeature } from "./aggregation/aggregationFeature.js";
|
|
2
3
|
import { columnFilteringFeature } from "./column-filtering/columnFilteringFeature.js";
|
|
3
4
|
import { columnGroupingFeature } from "./column-grouping/columnGroupingFeature.js";
|
|
4
5
|
import { columnOrderingFeature } from "./column-ordering/columnOrderingFeature.js";
|
|
@@ -15,6 +16,7 @@ import { rowSortingFeature } from "./row-sorting/rowSortingFeature.js";
|
|
|
15
16
|
|
|
16
17
|
//#region src/features/stockFeatures.d.ts
|
|
17
18
|
interface StockFeatures {
|
|
19
|
+
aggregationFeature: typeof aggregationFeature;
|
|
18
20
|
columnFacetingFeature: typeof columnFacetingFeature;
|
|
19
21
|
columnFilteringFeature: typeof columnFilteringFeature;
|
|
20
22
|
columnGroupingFeature: typeof columnGroupingFeature;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { columnFacetingFeature } from "./column-faceting/columnFacetingFeature.js";
|
|
2
|
+
import { aggregationFeature } from "./aggregation/aggregationFeature.js";
|
|
2
3
|
import { columnFilteringFeature } from "./column-filtering/columnFilteringFeature.js";
|
|
3
4
|
import { columnGroupingFeature } from "./column-grouping/columnGroupingFeature.js";
|
|
4
5
|
import { columnOrderingFeature } from "./column-ordering/columnOrderingFeature.js";
|
|
@@ -20,6 +21,7 @@ import { rowSortingFeature } from "./row-sorting/rowSortingFeature.js";
|
|
|
20
21
|
* Use individual feature exports for tree-shaking, or this aggregate when a table should include every built-in feature.
|
|
21
22
|
*/
|
|
22
23
|
const stockFeatures = {
|
|
24
|
+
aggregationFeature,
|
|
23
25
|
columnFacetingFeature,
|
|
24
26
|
columnFilteringFeature,
|
|
25
27
|
columnGroupingFeature,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stockFeatures.js","names":[],"sources":["../../src/features/stockFeatures.ts"],"sourcesContent":["import { columnFacetingFeature } from './column-faceting/columnFacetingFeature'\nimport { columnFilteringFeature } from './column-filtering/columnFilteringFeature'\nimport { columnGroupingFeature } from './column-grouping/columnGroupingFeature'\nimport { columnOrderingFeature } from './column-ordering/columnOrderingFeature'\nimport { columnPinningFeature } from './column-pinning/columnPinningFeature'\nimport { columnResizingFeature } from './column-resizing/columnResizingFeature'\nimport { columnSizingFeature } from './column-sizing/columnSizingFeature'\nimport { columnVisibilityFeature } from './column-visibility/columnVisibilityFeature'\nimport { globalFilteringFeature } from './global-filtering/globalFilteringFeature'\nimport { rowExpandingFeature } from './row-expanding/rowExpandingFeature'\nimport { rowPaginationFeature } from './row-pagination/rowPaginationFeature'\nimport { rowPinningFeature } from './row-pinning/rowPinningFeature'\nimport { rowSelectionFeature } from './row-selection/rowSelectionFeature'\nimport { rowSortingFeature } from './row-sorting/rowSortingFeature'\n\nexport interface StockFeatures {\n columnFacetingFeature: typeof columnFacetingFeature\n columnFilteringFeature: typeof columnFilteringFeature\n columnGroupingFeature: typeof columnGroupingFeature\n columnOrderingFeature: typeof columnOrderingFeature\n columnPinningFeature: typeof columnPinningFeature\n columnResizingFeature: typeof columnResizingFeature\n columnSizingFeature: typeof columnSizingFeature\n columnVisibilityFeature: typeof columnVisibilityFeature\n globalFilteringFeature: typeof globalFilteringFeature\n rowExpandingFeature: typeof rowExpandingFeature\n rowPaginationFeature: typeof rowPaginationFeature\n rowPinningFeature: typeof rowPinningFeature\n rowSelectionFeature: typeof rowSelectionFeature\n rowSortingFeature: typeof rowSortingFeature\n}\n\n/**\n * The complete set of stock optional table features.\n *\n * Use individual feature exports for tree-shaking, or this aggregate when a table should include every built-in feature.\n */\nexport const stockFeatures: StockFeatures = {\n columnFacetingFeature,\n columnFilteringFeature,\n columnGroupingFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnResizingFeature,\n columnSizingFeature,\n columnVisibilityFeature,\n globalFilteringFeature,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n} as const\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"stockFeatures.js","names":[],"sources":["../../src/features/stockFeatures.ts"],"sourcesContent":["import { columnFacetingFeature } from './column-faceting/columnFacetingFeature'\nimport { aggregationFeature } from './aggregation/aggregationFeature'\nimport { columnFilteringFeature } from './column-filtering/columnFilteringFeature'\nimport { columnGroupingFeature } from './column-grouping/columnGroupingFeature'\nimport { columnOrderingFeature } from './column-ordering/columnOrderingFeature'\nimport { columnPinningFeature } from './column-pinning/columnPinningFeature'\nimport { columnResizingFeature } from './column-resizing/columnResizingFeature'\nimport { columnSizingFeature } from './column-sizing/columnSizingFeature'\nimport { columnVisibilityFeature } from './column-visibility/columnVisibilityFeature'\nimport { globalFilteringFeature } from './global-filtering/globalFilteringFeature'\nimport { rowExpandingFeature } from './row-expanding/rowExpandingFeature'\nimport { rowPaginationFeature } from './row-pagination/rowPaginationFeature'\nimport { rowPinningFeature } from './row-pinning/rowPinningFeature'\nimport { rowSelectionFeature } from './row-selection/rowSelectionFeature'\nimport { rowSortingFeature } from './row-sorting/rowSortingFeature'\n\nexport interface StockFeatures {\n aggregationFeature: typeof aggregationFeature\n columnFacetingFeature: typeof columnFacetingFeature\n columnFilteringFeature: typeof columnFilteringFeature\n columnGroupingFeature: typeof columnGroupingFeature\n columnOrderingFeature: typeof columnOrderingFeature\n columnPinningFeature: typeof columnPinningFeature\n columnResizingFeature: typeof columnResizingFeature\n columnSizingFeature: typeof columnSizingFeature\n columnVisibilityFeature: typeof columnVisibilityFeature\n globalFilteringFeature: typeof globalFilteringFeature\n rowExpandingFeature: typeof rowExpandingFeature\n rowPaginationFeature: typeof rowPaginationFeature\n rowPinningFeature: typeof rowPinningFeature\n rowSelectionFeature: typeof rowSelectionFeature\n rowSortingFeature: typeof rowSortingFeature\n}\n\n/**\n * The complete set of stock optional table features.\n *\n * Use individual feature exports for tree-shaking, or this aggregate when a table should include every built-in feature.\n */\nexport const stockFeatures: StockFeatures = {\n aggregationFeature,\n columnFacetingFeature,\n columnFilteringFeature,\n columnGroupingFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnResizingFeature,\n columnSizingFeature,\n columnVisibilityFeature,\n globalFilteringFeature,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n} as const\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAa,gBAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
* columnFilteringFeature,
|
|
22
22
|
* createFilteredRowModel,
|
|
23
23
|
* createSortedRowModel,
|
|
24
|
-
*
|
|
24
|
+
* filterFn_includesString,
|
|
25
25
|
* rowSortingFeature,
|
|
26
|
-
*
|
|
26
|
+
* sortFn_alphanumeric,
|
|
27
|
+
* sortFn_text,
|
|
27
28
|
* tableFeatures,
|
|
28
29
|
* } from '@tanstack/react-table'
|
|
29
30
|
* const features = tableFeatures({
|
|
@@ -31,8 +32,8 @@
|
|
|
31
32
|
* rowSortingFeature,
|
|
32
33
|
* filteredRowModel: createFilteredRowModel(),
|
|
33
34
|
* sortedRowModel: createSortedRowModel(),
|
|
34
|
-
* filterFns: {
|
|
35
|
-
* sortFns,
|
|
35
|
+
* filterFns: { includesString: filterFn_includesString, myCustomFilterFn },
|
|
36
|
+
* sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },
|
|
36
37
|
* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },
|
|
37
38
|
* columnMeta: {} as { align?: 'left' | 'right' },
|
|
38
39
|
* });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableFeatures.cjs","names":[],"sources":["../../src/helpers/tableFeatures.ts"],"sourcesContent":["import type {\n TableFeatures,\n ValidateFeatureSlots,\n} from '../types/TableFeatures'\n\n/**\n * A helper function to help define the features that are to be imported and applied to a table instance.\n * Use this utility to make it easier to have the correct type inference for the features that are being imported.\n * **Note:** It is recommended to use this utility statically outside of a component.\n *\n * Alongside feature modules, this object carries everything else that is\n * statically stitched into the table:\n *\n * - Row model factories (`sortedRowModel`, `filteredRowModel`, etc.)\n * - Row model function registries (`sortFns`, `filterFns`, `aggregationFns`),\n * whose keys become the valid string values for `sortFn`, `filterFn`,\n * `globalFilterFn`, and `aggregationFn` with full inference\n * - Type-only `tableMeta`/`columnMeta` slots for declaring per-table meta types\n * instead of using global declaration merging. The values are phantom\n * (ignored and stripped at runtime); only their types are used.\n * @example\n * ```\n * import {\n * columnFilteringFeature,\n * createFilteredRowModel,\n * createSortedRowModel,\n *
|
|
1
|
+
{"version":3,"file":"tableFeatures.cjs","names":[],"sources":["../../src/helpers/tableFeatures.ts"],"sourcesContent":["import type {\n TableFeatures,\n ValidateFeatureSlots,\n} from '../types/TableFeatures'\n\n/**\n * A helper function to help define the features that are to be imported and applied to a table instance.\n * Use this utility to make it easier to have the correct type inference for the features that are being imported.\n * **Note:** It is recommended to use this utility statically outside of a component.\n *\n * Alongside feature modules, this object carries everything else that is\n * statically stitched into the table:\n *\n * - Row model factories (`sortedRowModel`, `filteredRowModel`, etc.)\n * - Row model function registries (`sortFns`, `filterFns`, `aggregationFns`),\n * whose keys become the valid string values for `sortFn`, `filterFn`,\n * `globalFilterFn`, and `aggregationFn` with full inference\n * - Type-only `tableMeta`/`columnMeta` slots for declaring per-table meta types\n * instead of using global declaration merging. The values are phantom\n * (ignored and stripped at runtime); only their types are used.\n * @example\n * ```\n * import {\n * columnFilteringFeature,\n * createFilteredRowModel,\n * createSortedRowModel,\n * filterFn_includesString,\n * rowSortingFeature,\n * sortFn_alphanumeric,\n * sortFn_text,\n * tableFeatures,\n * } from '@tanstack/react-table'\n * const features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * filteredRowModel: createFilteredRowModel(),\n * sortedRowModel: createSortedRowModel(),\n * filterFns: { includesString: filterFn_includesString, myCustomFilterFn },\n * sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },\n * tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },\n * columnMeta: {} as { align?: 'left' | 'right' },\n * });\n * const table = useTable({ features, columns, data });\n * ```\n */\nexport function tableFeatures<TFeatures extends TableFeatures>(\n features: TFeatures & ValidateFeatureSlots<TFeatures>,\n): TFeatures {\n return features\n}\n\n// test\n\n// const features = tableFeatures({\n// rowPinningFeature: {},\n// });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,cACd,UACW;CACX,OAAO;AACT"}
|
|
@@ -22,9 +22,10 @@ import { TableFeatures, ValidateFeatureSlots } from "../types/TableFeatures.cjs"
|
|
|
22
22
|
* columnFilteringFeature,
|
|
23
23
|
* createFilteredRowModel,
|
|
24
24
|
* createSortedRowModel,
|
|
25
|
-
*
|
|
25
|
+
* filterFn_includesString,
|
|
26
26
|
* rowSortingFeature,
|
|
27
|
-
*
|
|
27
|
+
* sortFn_alphanumeric,
|
|
28
|
+
* sortFn_text,
|
|
28
29
|
* tableFeatures,
|
|
29
30
|
* } from '@tanstack/react-table'
|
|
30
31
|
* const features = tableFeatures({
|
|
@@ -32,8 +33,8 @@ import { TableFeatures, ValidateFeatureSlots } from "../types/TableFeatures.cjs"
|
|
|
32
33
|
* rowSortingFeature,
|
|
33
34
|
* filteredRowModel: createFilteredRowModel(),
|
|
34
35
|
* sortedRowModel: createSortedRowModel(),
|
|
35
|
-
* filterFns: {
|
|
36
|
-
* sortFns,
|
|
36
|
+
* filterFns: { includesString: filterFn_includesString, myCustomFilterFn },
|
|
37
|
+
* sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },
|
|
37
38
|
* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },
|
|
38
39
|
* columnMeta: {} as { align?: 'left' | 'right' },
|
|
39
40
|
* });
|
|
@@ -22,9 +22,10 @@ import { TableFeatures, ValidateFeatureSlots } from "../types/TableFeatures.js";
|
|
|
22
22
|
* columnFilteringFeature,
|
|
23
23
|
* createFilteredRowModel,
|
|
24
24
|
* createSortedRowModel,
|
|
25
|
-
*
|
|
25
|
+
* filterFn_includesString,
|
|
26
26
|
* rowSortingFeature,
|
|
27
|
-
*
|
|
27
|
+
* sortFn_alphanumeric,
|
|
28
|
+
* sortFn_text,
|
|
28
29
|
* tableFeatures,
|
|
29
30
|
* } from '@tanstack/react-table'
|
|
30
31
|
* const features = tableFeatures({
|
|
@@ -32,8 +33,8 @@ import { TableFeatures, ValidateFeatureSlots } from "../types/TableFeatures.js";
|
|
|
32
33
|
* rowSortingFeature,
|
|
33
34
|
* filteredRowModel: createFilteredRowModel(),
|
|
34
35
|
* sortedRowModel: createSortedRowModel(),
|
|
35
|
-
* filterFns: {
|
|
36
|
-
* sortFns,
|
|
36
|
+
* filterFns: { includesString: filterFn_includesString, myCustomFilterFn },
|
|
37
|
+
* sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },
|
|
37
38
|
* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },
|
|
38
39
|
* columnMeta: {} as { align?: 'left' | 'right' },
|
|
39
40
|
* });
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
* columnFilteringFeature,
|
|
21
21
|
* createFilteredRowModel,
|
|
22
22
|
* createSortedRowModel,
|
|
23
|
-
*
|
|
23
|
+
* filterFn_includesString,
|
|
24
24
|
* rowSortingFeature,
|
|
25
|
-
*
|
|
25
|
+
* sortFn_alphanumeric,
|
|
26
|
+
* sortFn_text,
|
|
26
27
|
* tableFeatures,
|
|
27
28
|
* } from '@tanstack/react-table'
|
|
28
29
|
* const features = tableFeatures({
|
|
@@ -30,8 +31,8 @@
|
|
|
30
31
|
* rowSortingFeature,
|
|
31
32
|
* filteredRowModel: createFilteredRowModel(),
|
|
32
33
|
* sortedRowModel: createSortedRowModel(),
|
|
33
|
-
* filterFns: {
|
|
34
|
-
* sortFns,
|
|
34
|
+
* filterFns: { includesString: filterFn_includesString, myCustomFilterFn },
|
|
35
|
+
* sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },
|
|
35
36
|
* tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },
|
|
36
37
|
* columnMeta: {} as { align?: 'left' | 'right' },
|
|
37
38
|
* });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableFeatures.js","names":[],"sources":["../../src/helpers/tableFeatures.ts"],"sourcesContent":["import type {\n TableFeatures,\n ValidateFeatureSlots,\n} from '../types/TableFeatures'\n\n/**\n * A helper function to help define the features that are to be imported and applied to a table instance.\n * Use this utility to make it easier to have the correct type inference for the features that are being imported.\n * **Note:** It is recommended to use this utility statically outside of a component.\n *\n * Alongside feature modules, this object carries everything else that is\n * statically stitched into the table:\n *\n * - Row model factories (`sortedRowModel`, `filteredRowModel`, etc.)\n * - Row model function registries (`sortFns`, `filterFns`, `aggregationFns`),\n * whose keys become the valid string values for `sortFn`, `filterFn`,\n * `globalFilterFn`, and `aggregationFn` with full inference\n * - Type-only `tableMeta`/`columnMeta` slots for declaring per-table meta types\n * instead of using global declaration merging. The values are phantom\n * (ignored and stripped at runtime); only their types are used.\n * @example\n * ```\n * import {\n * columnFilteringFeature,\n * createFilteredRowModel,\n * createSortedRowModel,\n *
|
|
1
|
+
{"version":3,"file":"tableFeatures.js","names":[],"sources":["../../src/helpers/tableFeatures.ts"],"sourcesContent":["import type {\n TableFeatures,\n ValidateFeatureSlots,\n} from '../types/TableFeatures'\n\n/**\n * A helper function to help define the features that are to be imported and applied to a table instance.\n * Use this utility to make it easier to have the correct type inference for the features that are being imported.\n * **Note:** It is recommended to use this utility statically outside of a component.\n *\n * Alongside feature modules, this object carries everything else that is\n * statically stitched into the table:\n *\n * - Row model factories (`sortedRowModel`, `filteredRowModel`, etc.)\n * - Row model function registries (`sortFns`, `filterFns`, `aggregationFns`),\n * whose keys become the valid string values for `sortFn`, `filterFn`,\n * `globalFilterFn`, and `aggregationFn` with full inference\n * - Type-only `tableMeta`/`columnMeta` slots for declaring per-table meta types\n * instead of using global declaration merging. The values are phantom\n * (ignored and stripped at runtime); only their types are used.\n * @example\n * ```\n * import {\n * columnFilteringFeature,\n * createFilteredRowModel,\n * createSortedRowModel,\n * filterFn_includesString,\n * rowSortingFeature,\n * sortFn_alphanumeric,\n * sortFn_text,\n * tableFeatures,\n * } from '@tanstack/react-table'\n * const features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * filteredRowModel: createFilteredRowModel(),\n * sortedRowModel: createSortedRowModel(),\n * filterFns: { includesString: filterFn_includesString, myCustomFilterFn },\n * sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },\n * tableMeta: {} as { updateData: (rowIndex: number, columnId: string, value: unknown) => void },\n * columnMeta: {} as { align?: 'left' | 'right' },\n * });\n * const table = useTable({ features, columns, data });\n * ```\n */\nexport function tableFeatures<TFeatures extends TableFeatures>(\n features: TFeatures & ValidateFeatureSlots<TFeatures>,\n): TFeatures {\n return features\n}\n\n// test\n\n// const features = tableFeatures({\n// rowPinningFeature: {},\n// });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,cACd,UACW;CACX,OAAO;AACT"}
|
package/dist/index.cjs
CHANGED
|
@@ -18,10 +18,8 @@ const require_metaHelper = require('./helpers/metaHelper.cjs');
|
|
|
18
18
|
const require_tableFeatures = require('./helpers/tableFeatures.cjs');
|
|
19
19
|
const require_tableOptions = require('./helpers/tableOptions.cjs');
|
|
20
20
|
const require_constructTable = require('./core/table/constructTable.cjs');
|
|
21
|
-
const require_aggregationFns = require('./fns/aggregationFns.cjs');
|
|
22
|
-
const require_filterFns = require('./fns/filterFns.cjs');
|
|
23
|
-
const require_sortFns = require('./fns/sortFns.cjs');
|
|
24
21
|
const require_columnFacetingFeature = require('./features/column-faceting/columnFacetingFeature.cjs');
|
|
22
|
+
const require_aggregationFeature = require('./features/aggregation/aggregationFeature.cjs');
|
|
25
23
|
const require_columnFilteringFeature = require('./features/column-filtering/columnFilteringFeature.cjs');
|
|
26
24
|
const require_columnGroupingFeature = require('./features/column-grouping/columnGroupingFeature.cjs');
|
|
27
25
|
const require_columnOrderingFeature = require('./features/column-ordering/columnOrderingFeature.cjs');
|
|
@@ -29,13 +27,17 @@ const require_columnPinningFeature = require('./features/column-pinning/columnPi
|
|
|
29
27
|
const require_columnResizingFeature = require('./features/column-resizing/columnResizingFeature.cjs');
|
|
30
28
|
const require_columnSizingFeature = require('./features/column-sizing/columnSizingFeature.cjs');
|
|
31
29
|
const require_columnVisibilityFeature = require('./features/column-visibility/columnVisibilityFeature.cjs');
|
|
30
|
+
const require_filterFns = require('./features/column-filtering/filterFns.cjs');
|
|
32
31
|
const require_globalFilteringFeature = require('./features/global-filtering/globalFilteringFeature.cjs');
|
|
33
32
|
const require_rowExpandingFeature = require('./features/row-expanding/rowExpandingFeature.cjs');
|
|
34
33
|
const require_rowPaginationFeature = require('./features/row-pagination/rowPaginationFeature.cjs');
|
|
35
34
|
const require_rowPinningFeature = require('./features/row-pinning/rowPinningFeature.cjs');
|
|
36
35
|
const require_rowSelectionFeature = require('./features/row-selection/rowSelectionFeature.cjs');
|
|
36
|
+
const require_sortFns = require('./features/row-sorting/sortFns.cjs');
|
|
37
37
|
const require_rowSortingFeature = require('./features/row-sorting/rowSortingFeature.cjs');
|
|
38
38
|
const require_stockFeatures = require('./features/stockFeatures.cjs');
|
|
39
|
+
const require_aggregationFeature_types = require('./features/aggregation/aggregationFeature.types.cjs');
|
|
40
|
+
const require_aggregationFns = require('./features/aggregation/aggregationFns.cjs');
|
|
39
41
|
const require_createFacetedMinMaxValues = require('./features/column-faceting/createFacetedMinMaxValues.cjs');
|
|
40
42
|
const require_createFacetedRowModel = require('./features/column-faceting/createFacetedRowModel.cjs');
|
|
41
43
|
const require_createFacetedUniqueValues = require('./features/column-faceting/createFacetedUniqueValues.cjs');
|
|
@@ -45,8 +47,11 @@ const require_createExpandedRowModel = require('./features/row-expanding/createE
|
|
|
45
47
|
const require_createPaginatedRowModel = require('./features/row-pagination/createPaginatedRowModel.cjs');
|
|
46
48
|
const require_createSortedRowModel = require('./features/row-sorting/createSortedRowModel.cjs');
|
|
47
49
|
|
|
50
|
+
exports.aggregationFeature = require_aggregationFeature.aggregationFeature;
|
|
48
51
|
exports.aggregationFn_count = require_aggregationFns.aggregationFn_count;
|
|
49
52
|
exports.aggregationFn_extent = require_aggregationFns.aggregationFn_extent;
|
|
53
|
+
exports.aggregationFn_first = require_aggregationFns.aggregationFn_first;
|
|
54
|
+
exports.aggregationFn_last = require_aggregationFns.aggregationFn_last;
|
|
50
55
|
exports.aggregationFn_max = require_aggregationFns.aggregationFn_max;
|
|
51
56
|
exports.aggregationFn_mean = require_aggregationFns.aggregationFn_mean;
|
|
52
57
|
exports.aggregationFn_median = require_aggregationFns.aggregationFn_median;
|
|
@@ -68,10 +73,13 @@ exports.columnPinningFeature = require_columnPinningFeature.columnPinningFeature
|
|
|
68
73
|
exports.columnResizingFeature = require_columnResizingFeature.columnResizingFeature;
|
|
69
74
|
exports.columnSizingFeature = require_columnSizingFeature.columnSizingFeature;
|
|
70
75
|
exports.columnVisibilityFeature = require_columnVisibilityFeature.columnVisibilityFeature;
|
|
76
|
+
exports.constructAggregationFn = require_aggregationFeature_types.constructAggregationFn;
|
|
71
77
|
exports.constructCell = require_constructCell.constructCell;
|
|
72
78
|
exports.constructColumn = require_constructColumn.constructColumn;
|
|
79
|
+
exports.constructFilterFn = require_filterFns.constructFilterFn;
|
|
73
80
|
exports.constructHeader = require_constructHeader.constructHeader;
|
|
74
81
|
exports.constructRow = require_constructRow.constructRow;
|
|
82
|
+
exports.constructSortFn = require_sortFns.constructSortFn;
|
|
75
83
|
exports.constructTable = require_constructTable.constructTable;
|
|
76
84
|
exports.copyInstancePropertiesWithoutMemos = require_utils.copyInstancePropertiesWithoutMemos;
|
|
77
85
|
exports.coreCellsFeature = require_coreCellsFeature.coreCellsFeature;
|
|
@@ -96,16 +104,23 @@ exports.filterFn_arrHas = require_filterFns.filterFn_arrHas;
|
|
|
96
104
|
exports.filterFn_arrIncludes = require_filterFns.filterFn_arrIncludes;
|
|
97
105
|
exports.filterFn_arrIncludesAll = require_filterFns.filterFn_arrIncludesAll;
|
|
98
106
|
exports.filterFn_arrIncludesSome = require_filterFns.filterFn_arrIncludesSome;
|
|
107
|
+
exports.filterFn_between = require_filterFns.filterFn_between;
|
|
108
|
+
exports.filterFn_betweenInclusive = require_filterFns.filterFn_betweenInclusive;
|
|
109
|
+
exports.filterFn_empty = require_filterFns.filterFn_empty;
|
|
110
|
+
exports.filterFn_endsWith = require_filterFns.filterFn_endsWith;
|
|
99
111
|
exports.filterFn_equals = require_filterFns.filterFn_equals;
|
|
100
112
|
exports.filterFn_equalsString = require_filterFns.filterFn_equalsString;
|
|
101
113
|
exports.filterFn_equalsStringSensitive = require_filterFns.filterFn_equalsStringSensitive;
|
|
102
114
|
exports.filterFn_greaterThan = require_filterFns.filterFn_greaterThan;
|
|
103
115
|
exports.filterFn_greaterThanOrEqualTo = require_filterFns.filterFn_greaterThanOrEqualTo;
|
|
116
|
+
exports.filterFn_inDateRange = require_filterFns.filterFn_inDateRange;
|
|
104
117
|
exports.filterFn_inNumberRange = require_filterFns.filterFn_inNumberRange;
|
|
105
118
|
exports.filterFn_includesString = require_filterFns.filterFn_includesString;
|
|
106
119
|
exports.filterFn_includesStringSensitive = require_filterFns.filterFn_includesStringSensitive;
|
|
107
120
|
exports.filterFn_lessThan = require_filterFns.filterFn_lessThan;
|
|
108
121
|
exports.filterFn_lessThanOrEqualTo = require_filterFns.filterFn_lessThanOrEqualTo;
|
|
122
|
+
exports.filterFn_notEmpty = require_filterFns.filterFn_notEmpty;
|
|
123
|
+
exports.filterFn_startsWith = require_filterFns.filterFn_startsWith;
|
|
109
124
|
exports.filterFn_weakEquals = require_filterFns.filterFn_weakEquals;
|
|
110
125
|
exports.filterFns = require_filterFns.filterFns;
|
|
111
126
|
exports.flattenBy = require_utils.flattenBy;
|