@tanstack/react-table 8.0.0-alpha.1 → 8.0.0-alpha.11

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 (96) hide show
  1. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -78
  2. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  3. package/build/cjs/index.js +67 -12
  4. package/build/cjs/index.js.map +1 -1
  5. package/build/esm/index.js +30 -3346
  6. package/build/esm/index.js.map +1 -1
  7. package/build/stats-html.html +1 -1
  8. package/build/stats-react.json +28 -632
  9. package/build/types/index.d.ts +3 -7
  10. package/build/umd/index.development.js +37 -3348
  11. package/build/umd/index.development.js.map +1 -1
  12. package/build/umd/index.production.js +1 -1
  13. package/build/umd/index.production.js.map +1 -1
  14. package/package.json +4 -1
  15. package/src/index.tsx +56 -7
  16. package/build/cjs/aggregationTypes.js +0 -130
  17. package/build/cjs/aggregationTypes.js.map +0 -1
  18. package/build/cjs/core.js +0 -493
  19. package/build/cjs/core.js.map +0 -1
  20. package/build/cjs/createTable.js +0 -103
  21. package/build/cjs/createTable.js.map +0 -1
  22. package/build/cjs/features/Expanding.js +0 -234
  23. package/build/cjs/features/Expanding.js.map +0 -1
  24. package/build/cjs/features/Filters.js +0 -396
  25. package/build/cjs/features/Filters.js.map +0 -1
  26. package/build/cjs/features/Grouping.js +0 -228
  27. package/build/cjs/features/Grouping.js.map +0 -1
  28. package/build/cjs/features/Headers.js +0 -483
  29. package/build/cjs/features/Headers.js.map +0 -1
  30. package/build/cjs/features/Ordering.js +0 -83
  31. package/build/cjs/features/Ordering.js.map +0 -1
  32. package/build/cjs/features/Pinning.js +0 -163
  33. package/build/cjs/features/Pinning.js.map +0 -1
  34. package/build/cjs/features/Sorting.js +0 -269
  35. package/build/cjs/features/Sorting.js.map +0 -1
  36. package/build/cjs/features/Visibility.js +0 -160
  37. package/build/cjs/features/Visibility.js.map +0 -1
  38. package/build/cjs/filterTypes.js +0 -172
  39. package/build/cjs/filterTypes.js.map +0 -1
  40. package/build/cjs/sortTypes.js +0 -121
  41. package/build/cjs/sortTypes.js.map +0 -1
  42. package/build/cjs/utils/columnFilterRowsFn.js +0 -130
  43. package/build/cjs/utils/columnFilterRowsFn.js.map +0 -1
  44. package/build/cjs/utils/expandRowsFn.js +0 -38
  45. package/build/cjs/utils/expandRowsFn.js.map +0 -1
  46. package/build/cjs/utils/globalFilterRowsFn.js +0 -100
  47. package/build/cjs/utils/globalFilterRowsFn.js.map +0 -1
  48. package/build/cjs/utils/groupRowsFn.js +0 -154
  49. package/build/cjs/utils/groupRowsFn.js.map +0 -1
  50. package/build/cjs/utils/sortRowsFn.js +0 -93
  51. package/build/cjs/utils/sortRowsFn.js.map +0 -1
  52. package/build/cjs/utils.js +0 -143
  53. package/build/cjs/utils.js.map +0 -1
  54. package/build/types/aggregationTypes.d.ts +0 -22
  55. package/build/types/core.d.ts +0 -122
  56. package/build/types/createTable.d.ts +0 -35
  57. package/build/types/features/Expanding.d.ts +0 -52
  58. package/build/types/features/Filters.d.ts +0 -93
  59. package/build/types/features/Grouping.d.ts +0 -82
  60. package/build/types/features/Headers.d.ts +0 -41
  61. package/build/types/features/Ordering.d.ts +0 -19
  62. package/build/types/features/Pinning.d.ts +0 -39
  63. package/build/types/features/Sorting.d.ts +0 -75
  64. package/build/types/features/Visibility.d.ts +0 -47
  65. package/build/types/filterTypes.d.ts +0 -50
  66. package/build/types/sortTypes.d.ts +0 -17
  67. package/build/types/types.d.ts +0 -122
  68. package/build/types/utils/columnFilterRowsFn.d.ts +0 -2
  69. package/build/types/utils/expandRowsFn.d.ts +0 -2
  70. package/build/types/utils/globalFilterRowsFn.d.ts +0 -2
  71. package/build/types/utils/groupRowsFn.d.ts +0 -2
  72. package/build/types/utils/sortRowsFn.d.ts +0 -2
  73. package/build/types/utils.d.ts +0 -24
  74. package/src/aggregationTypes.ts +0 -115
  75. package/src/core.tsx +0 -1194
  76. package/src/createTable.tsx +0 -181
  77. package/src/features/Expanding.ts +0 -388
  78. package/src/features/Filters.ts +0 -707
  79. package/src/features/Grouping.ts +0 -451
  80. package/src/features/Headers.ts +0 -907
  81. package/src/features/Ordering.ts +0 -134
  82. package/src/features/Pinning.ts +0 -213
  83. package/src/features/Sorting.ts +0 -487
  84. package/src/features/Visibility.ts +0 -281
  85. package/src/features/withColumnResizing.oldts +0 -281
  86. package/src/features/withPagination.oldts +0 -208
  87. package/src/features/withRowSelection.oldts +0 -467
  88. package/src/filterTypes.ts +0 -251
  89. package/src/sortTypes.ts +0 -159
  90. package/src/types.ts +0 -285
  91. package/src/utils/columnFilterRowsFn.ts +0 -162
  92. package/src/utils/expandRowsFn.ts +0 -53
  93. package/src/utils/globalFilterRowsFn.ts +0 -129
  94. package/src/utils/groupRowsFn.ts +0 -196
  95. package/src/utils/sortRowsFn.ts +0 -115
  96. package/src/utils.tsx +0 -243
@@ -1,50 +0,0 @@
1
- import { AccessorFn, Row } from './types';
2
- export declare const filterTypes: {
3
- includesString: typeof includesString;
4
- includesStringSensitive: typeof includesStringSensitive;
5
- equalsString: typeof equalsString;
6
- equalsStringSensitive: typeof equalsStringSensitive;
7
- arrIncludes: typeof arrIncludes;
8
- arrIncludesAll: typeof arrIncludesAll;
9
- equals: typeof equals;
10
- weakEquals: typeof weakEquals;
11
- betweenNumberRange: typeof betweenNumberRange;
12
- };
13
- export declare type BuiltInFilterType = keyof typeof filterTypes;
14
- declare function includesString<TData, TValue, TAccessor extends AccessorFn<TData>, TFilterFns, TSortingFns, TAggregationFns>(rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[], columnIds: string[], filterValue: unknown): Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
15
- declare namespace includesString {
16
- var autoRemove: (val: any) => boolean;
17
- }
18
- declare function includesStringSensitive<TData, TValue, TAccessor extends AccessorFn<TData>, TFilterFns, TSortingFns, TAggregationFns>(rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[], columnIds: string[], filterValue: unknown): Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
19
- declare namespace includesStringSensitive {
20
- var autoRemove: (val: any) => boolean;
21
- }
22
- declare function equalsString<TData, TValue, TAccessor extends AccessorFn<TData>, TFilterFns, TSortingFns, TAggregationFns>(rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[], columnIds: string[], filterValue: unknown): Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
23
- declare namespace equalsString {
24
- var autoRemove: (val: any) => boolean;
25
- }
26
- declare function equalsStringSensitive<TData, TValue, TAccessor extends AccessorFn<TData>, TFilterFns, TSortingFns, TAggregationFns>(rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[], columnIds: string[], filterValue: unknown): Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
27
- declare namespace equalsStringSensitive {
28
- var autoRemove: (val: any) => boolean;
29
- }
30
- declare function arrIncludes<TData, TValue, TAccessor extends AccessorFn<TData>, TFilterFns, TSortingFns, TAggregationFns>(rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[], columnIds: string[], filterValue: unknown): Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
31
- declare namespace arrIncludes {
32
- var autoRemove: (val: any) => boolean;
33
- }
34
- declare function arrIncludesAll<TData, TValue, TAccessor extends AccessorFn<TData>, TFilterFns, TSortingFns, TAggregationFns>(rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[], columnIds: string[], filterValue: unknown[]): Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
35
- declare namespace arrIncludesAll {
36
- var autoRemove: (val: any) => boolean;
37
- }
38
- declare function equals<TData, TValue, TAccessor extends AccessorFn<TData>, TFilterFns, TSortingFns, TAggregationFns>(rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[], columnIds: string[], filterValue: unknown): Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
39
- declare namespace equals {
40
- var autoRemove: (val: any) => boolean;
41
- }
42
- declare function weakEquals<TData, TValue, TAccessor extends AccessorFn<TData>, TFilterFns, TSortingFns, TAggregationFns>(rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[], columnIds: string[], filterValue: unknown): Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
43
- declare namespace weakEquals {
44
- var autoRemove: (val: any) => boolean;
45
- }
46
- declare function betweenNumberRange<TData, TValue, TAccessor extends AccessorFn<TData>, TFilterFns, TSortingFns, TAggregationFns>(rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[], columnIds: string[], filterValue: [unknown, unknown]): Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
47
- declare namespace betweenNumberRange {
48
- var autoRemove: (val: any) => boolean;
49
- }
50
- export {};
@@ -1,17 +0,0 @@
1
- import { Row } from './types';
2
- export declare const sortTypes: {
3
- alphanumeric: typeof alphanumeric;
4
- alphanumericCaseSensitive: typeof alphanumericCaseSensitive;
5
- text: typeof text;
6
- textCaseSensitive: typeof textCaseSensitive;
7
- datetime: typeof datetime;
8
- basic: typeof basic;
9
- };
10
- export declare type BuiltInSortType = keyof typeof sortTypes;
11
- declare function alphanumeric<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): number;
12
- declare function alphanumericCaseSensitive<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): number;
13
- declare function text<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): 0 | 1 | -1;
14
- declare function textCaseSensitive<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): 0 | 1 | -1;
15
- declare function datetime<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): 0 | 1 | -1;
16
- declare function basic<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): 0 | 1 | -1;
17
- export {};
@@ -1,122 +0,0 @@
1
- import React from 'react';
2
- import { CoreColumn, CoreColumnDef, CoreOptions, CoreRow, TableCore } from './core';
3
- import { VisibilityInstance, VisibilityTableState, VisibilityColumn as ColumnVisibilityColumn, VisibilityOptions, VisibilityColumnDef, VisibilityRow } from './features/Visibility';
4
- import { ColumnOrderInstance, ColumnOrderOptions, ColumnOrderTableState } from './features/Ordering';
5
- import { ColumnPinningColumn, ColumnPinningColumnDef, ColumnPinningInstance, ColumnPinningOptions, ColumnPinningTableState } from './features/Pinning';
6
- import { HeadersInstance, HeadersRow } from './features/Headers';
7
- import { FiltersColumn, FiltersColumnDef, FiltersInstance, FiltersOptions, FiltersTableState } from './features/Filters';
8
- import { SortingColumn, SortingColumnDef, SortingInstance, SortingOptions, SortingTableState } from './features/Sorting';
9
- import { GroupingColumn, GroupingColumnDef, GroupingInstance, GroupingOptions, GroupingRow, GroupingTableState } from './features/Grouping';
10
- import { ExpandedInstance, ExpandedOptions, ExpandedTableState } from './features/Expanding';
11
- import { Overwrite } from './utils';
12
- export declare type ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = TableCore<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & VisibilityInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & ColumnOrderInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & ColumnPinningInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & HeadersInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & FiltersInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & SortingInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & GroupingInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & ExpandedInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
13
- export declare type Renderable<TProps> = React.ReactNode | React.FunctionComponent<TProps> | React.Component<TProps>;
14
- export declare type Options<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = CoreOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & VisibilityOptions & ColumnOrderOptions & ColumnPinningOptions & FiltersOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & SortingOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & GroupingOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & ExpandedOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
15
- export declare type Updater<T> = T | ((old?: T) => T);
16
- export declare type OnChangeFn<T> = (updaterOrValue: Updater<T>, value: T) => void;
17
- export declare type TableState = VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState;
18
- export declare type Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = CoreRow<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & VisibilityRow<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & HeadersRow<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & GroupingRow;
19
- export declare type RowValues = {
20
- [key: string]: any;
21
- };
22
- export declare type RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
23
- rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
24
- flatRows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
25
- rowsById: Record<string, Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>>;
26
- };
27
- export declare type AccessorFn<TData> = (originalRow: TData, index: number) => any;
28
- export declare type ColumnDef<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = CoreColumnDef<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TFilterFns> & SortingColumnDef<TSortingFns> & GroupingColumnDef<TAggregationFns>;
29
- export declare type Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = ColumnDef<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & CoreColumn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & SortingColumn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & GroupingColumn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
30
- export declare type Cell<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
31
- id: string;
32
- rowId: string;
33
- columnId: string;
34
- value: TValue;
35
- row: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
36
- column: Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
37
- getCellProps: PropGetter<CellProps>;
38
- renderCell: () => React.ReactNode;
39
- };
40
- export declare type Header<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
41
- id: string;
42
- depth: number;
43
- column: Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
44
- getWidth: () => number;
45
- subHeaders: Header<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
46
- colSpan?: number;
47
- rowSpan?: number;
48
- getHeaderProps: PropGetter<HeaderProps>;
49
- getFooterProps: PropGetter<HeaderProps>;
50
- getLeafHeaders: () => Header<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
51
- isPlaceholder?: boolean;
52
- placeholderId?: string;
53
- renderHeader: (options?: {
54
- renderPlaceholder?: boolean;
55
- }) => React.ReactNode;
56
- renderFooter: (options?: {
57
- renderPlaceholder?: boolean;
58
- }) => React.ReactNode;
59
- };
60
- export declare type HeaderGroup<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
61
- id: string;
62
- depth: number;
63
- headers: Header<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
64
- getHeaderGroupProps: PropGetter<HeaderGroupProps>;
65
- getFooterGroupProps: PropGetter<FooterGroupProps>;
66
- };
67
- export declare type HeaderRenderProps<THeader> = {
68
- header: THeader;
69
- };
70
- export declare type FooterRenderProps<THeader> = {
71
- header: THeader;
72
- };
73
- export declare type CellRenderProps<TCell, TRow> = {
74
- cell: TCell;
75
- row: TRow;
76
- };
77
- export declare type TableProps = {
78
- role: string;
79
- };
80
- export declare type TableBodyProps = {
81
- role: string;
82
- };
83
- export declare type TableHeadProps = {
84
- key: string;
85
- role: string;
86
- };
87
- export declare type TableFooterProps = {
88
- key: string;
89
- role: string;
90
- };
91
- export declare type HeaderGroupProps = {
92
- key: string;
93
- role: string;
94
- };
95
- export declare type FooterGroupProps = {
96
- key: string;
97
- role: string;
98
- };
99
- export declare type HeaderProps = {
100
- key: string;
101
- role: string;
102
- colSpan?: number;
103
- rowSpan?: number;
104
- };
105
- export declare type FooterProps = {
106
- key: string;
107
- role: string;
108
- colSpan?: number;
109
- rowSpan?: number;
110
- };
111
- export declare type RowProps = {
112
- key: string;
113
- role: string;
114
- };
115
- export declare type CellProps = {
116
- key: string;
117
- role: string;
118
- };
119
- export declare type PropGetter<TBase> = <TGetter extends Getter<TBase>>(userProps?: TGetter) => PropGetterValue<TBase, TGetter>;
120
- export declare type Getter<TInitial> = ((initial: TInitial) => object) | object | undefined;
121
- export declare type PropGetterValue<TBase, TGetter> = TGetter extends undefined ? TBase : TGetter extends (...args: any[]) => infer TReturn ? Overwrite<TBase, TReturn> : TGetter extends object ? Overwrite<TBase, TGetter> : never;
122
- export declare type NoInfer<A extends any> = [A][A extends any ? 0 : never];
@@ -1,2 +0,0 @@
1
- import { Options } from '..';
2
- export declare const columnFilterRowsFn: Options<any, any, {}, {}, {}>['columnFilterRowsFn'];
@@ -1,2 +0,0 @@
1
- import { Options } from '../types';
2
- export declare const expandRowsFn: Options<any, any, {}, {}, {}>['expandRowsFn'];
@@ -1,2 +0,0 @@
1
- import { Options } from '..';
2
- export declare const globalFilterRowsFn: Options<any, any, {}, {}, {}>['globalFilterRowsFn'];
@@ -1,2 +0,0 @@
1
- import { Options } from '../types';
2
- export declare const groupRowsFn: Options<any, any, {}, {}, {}>['groupRowsFn'];
@@ -1,2 +0,0 @@
1
- import { Options } from '../types';
2
- export declare const sortRowsFn: Options<any, any, {}, {}, {}>['sortRowsFn'];
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import { Getter, NoInfer, PropGetterValue, Renderable } from './types';
3
- export declare type IsAny<T> = 0 extends 1 & T ? true : false;
4
- export declare type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
5
- export declare type RequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
6
- export declare type Overwrite<T, U> = Omit<T, keyof U> & U;
7
- export declare type DataUpdateFunction<TInput, TOutput> = (input: TInput) => TOutput;
8
- export declare type Updater<TInput, TOutput> = TOutput | DataUpdateFunction<TInput, TOutput>;
9
- export declare function functionalUpdate<TInput, TOutput = TInput>(updater: Updater<TInput, TOutput>, input: TInput): TOutput;
10
- export declare function noop(): void;
11
- export declare function makeStateUpdater(key: string, instance: unknown): (updater: Updater<any, any>) => void;
12
- export declare const safeUseLayoutEffect: typeof React.useLayoutEffect;
13
- export declare function useMountedLayoutEffect(fn: any, deps: any[]): void;
14
- export declare function useGetLatest<T>(obj: T): () => T;
15
- declare type AnyFunction = (...args: any) => any;
16
- export declare function isFunction<T extends AnyFunction>(d: any): d is T;
17
- export declare function flattenBy<TNode>(arr: TNode[], getChildren: (item: TNode) => TNode[]): TNode[];
18
- declare type PropGetterImpl = <TBaseProps, TGetter extends Getter<TBaseProps>>(initial: TBaseProps, userProps?: TGetter) => PropGetterValue<TBaseProps, TGetter>;
19
- export declare const propGetter: PropGetterImpl;
20
- export declare function memo<TDeps extends readonly any[], TResult>(getDeps: () => [...TDeps], fn: (...args: NoInfer<[...TDeps]>) => TResult, key?: string, debug?: boolean): () => TResult;
21
- export declare function isPlainObject(o: any): o is Object;
22
- export declare type Render = typeof flexRender;
23
- export declare function flexRender<TProps extends {}>(Comp: Renderable<TProps>, props: TProps): React.ReactNode;
24
- export {};
@@ -1,115 +0,0 @@
1
- export const aggregationTypes = {
2
- sum,
3
- min,
4
- max,
5
- extent,
6
- mean,
7
- median,
8
- unique,
9
- uniqueCount,
10
- count,
11
- }
12
-
13
- export type BuiltInAggregationType = keyof typeof aggregationTypes
14
-
15
- function sum(_leafValues: unknown[], childValues: unknown[]) {
16
- // It's faster to just add the aggregations together instead of
17
- // process leaf nodes individually
18
- return childValues.reduce(
19
- (sum: number, next: unknown) => sum + (typeof next === 'number' ? next : 0),
20
- 0
21
- )
22
- }
23
-
24
- function min(_leafValues: unknown[], childValues: unknown[]) {
25
- let min: number | undefined
26
-
27
- for (const value of childValues as number[]) {
28
- if (
29
- value != null &&
30
- (min! > value || (min === undefined && value >= value))
31
- ) {
32
- min = value
33
- }
34
- }
35
-
36
- return min
37
- }
38
-
39
- function max(_leafValues: unknown[], childValues: unknown[]) {
40
- let max: number | undefined
41
-
42
- for (const value of childValues as number[]) {
43
- if (
44
- value != null &&
45
- (max! < value || (max === undefined && value >= value))
46
- ) {
47
- max = value
48
- }
49
- }
50
-
51
- return max
52
- }
53
-
54
- function extent(_leafValues: unknown[], childValues: unknown[]) {
55
- let min: number | undefined
56
- let max: number | undefined
57
-
58
- for (const value of childValues as number[]) {
59
- if (value != null) {
60
- if (min === undefined) {
61
- if (value >= value) min = max = value
62
- } else {
63
- if (min > value) min = value
64
- if (max! < value) max = value
65
- }
66
- }
67
- }
68
-
69
- return [min, max]
70
- }
71
-
72
- function mean(leafValues: unknown[]) {
73
- let count = 0
74
- let sum = 0
75
-
76
- for (let value of leafValues as number[]) {
77
- if (value != null && (value = +value) >= value) {
78
- ++count, (sum += value)
79
- }
80
- }
81
-
82
- if (count) return sum / count
83
-
84
- return
85
- }
86
-
87
- function median(values: unknown[]) {
88
- if (!values.length) {
89
- return
90
- }
91
-
92
- let min = 0
93
- let max = 0
94
-
95
- values.forEach(value => {
96
- if (typeof value === 'number') {
97
- min = Math.min(min, value)
98
- max = Math.max(max, value)
99
- }
100
- })
101
-
102
- return (min + max) / 2
103
- }
104
-
105
- function unique<T>(values: T[]) {
106
- return Array.from(new Set(values).values())
107
- }
108
-
109
- function uniqueCount(values: unknown[]) {
110
- return new Set(values).size
111
- }
112
-
113
- function count(values: unknown[]) {
114
- return values.length
115
- }