@tanstack/react-table 8.0.0-alpha.5 → 8.0.0-alpha.52
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/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -78
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/cjs/index.js +98 -17
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +38 -4716
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +29 -779
- package/build/types/index.d.ts +10 -8
- package/build/umd/index.development.js +50 -4722
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +4 -1
- package/src/index.tsx +104 -8
- package/build/cjs/aggregationTypes.js +0 -130
- package/build/cjs/aggregationTypes.js.map +0 -1
- package/build/cjs/core.js +0 -552
- package/build/cjs/core.js.map +0 -1
- package/build/cjs/createTable.js +0 -108
- package/build/cjs/createTable.js.map +0 -1
- package/build/cjs/features/ColumnSizing.js +0 -317
- package/build/cjs/features/ColumnSizing.js.map +0 -1
- package/build/cjs/features/Expanding.js +0 -255
- package/build/cjs/features/Expanding.js.map +0 -1
- package/build/cjs/features/Filters.js +0 -445
- package/build/cjs/features/Filters.js.map +0 -1
- package/build/cjs/features/Grouping.js +0 -249
- package/build/cjs/features/Grouping.js.map +0 -1
- package/build/cjs/features/Headers.js +0 -549
- package/build/cjs/features/Headers.js.map +0 -1
- package/build/cjs/features/Ordering.js +0 -86
- package/build/cjs/features/Ordering.js.map +0 -1
- package/build/cjs/features/Pagination.js +0 -198
- package/build/cjs/features/Pagination.js.map +0 -1
- package/build/cjs/features/Pinning.js +0 -149
- package/build/cjs/features/Pinning.js.map +0 -1
- package/build/cjs/features/RowSelection.js +0 -541
- package/build/cjs/features/RowSelection.js.map +0 -1
- package/build/cjs/features/Sorting.js +0 -327
- package/build/cjs/features/Sorting.js.map +0 -1
- package/build/cjs/features/Visibility.js +0 -166
- package/build/cjs/features/Visibility.js.map +0 -1
- package/build/cjs/filterTypes.js +0 -172
- package/build/cjs/filterTypes.js.map +0 -1
- package/build/cjs/sortTypes.js +0 -122
- package/build/cjs/sortTypes.js.map +0 -1
- package/build/cjs/utils/columnFilterRowsFn.js +0 -131
- package/build/cjs/utils/columnFilterRowsFn.js.map +0 -1
- package/build/cjs/utils/expandRowsFn.js +0 -38
- package/build/cjs/utils/expandRowsFn.js.map +0 -1
- package/build/cjs/utils/globalFilterRowsFn.js +0 -101
- package/build/cjs/utils/globalFilterRowsFn.js.map +0 -1
- package/build/cjs/utils/groupRowsFn.js +0 -155
- package/build/cjs/utils/groupRowsFn.js.map +0 -1
- package/build/cjs/utils/paginateRowsFn.js +0 -44
- package/build/cjs/utils/paginateRowsFn.js.map +0 -1
- package/build/cjs/utils/sortRowsFn.js +0 -94
- package/build/cjs/utils/sortRowsFn.js.map +0 -1
- package/build/cjs/utils.js +0 -146
- package/build/cjs/utils.js.map +0 -1
- package/build/types/aggregationTypes.d.ts +0 -22
- package/build/types/core.d.ts +0 -111
- package/build/types/createTable.d.ts +0 -52
- package/build/types/features/ColumnSizing.d.ts +0 -67
- package/build/types/features/Expanding.d.ts +0 -53
- package/build/types/features/Filters.d.ts +0 -98
- package/build/types/features/Grouping.d.ts +0 -82
- package/build/types/features/Headers.d.ts +0 -41
- package/build/types/features/Ordering.d.ts +0 -19
- package/build/types/features/Pagination.d.ts +0 -44
- package/build/types/features/Pinning.d.ts +0 -39
- package/build/types/features/RowSelection.d.ts +0 -66
- package/build/types/features/Sorting.d.ts +0 -78
- package/build/types/features/Visibility.d.ts +0 -47
- package/build/types/filterTypes.d.ts +0 -50
- package/build/types/sortTypes.d.ts +0 -18
- package/build/types/types.d.ts +0 -127
- package/build/types/utils/columnFilterRowsFn.d.ts +0 -2
- package/build/types/utils/expandRowsFn.d.ts +0 -2
- package/build/types/utils/globalFilterRowsFn.d.ts +0 -2
- package/build/types/utils/groupRowsFn.d.ts +0 -2
- package/build/types/utils/paginateRowsFn.d.ts +0 -2
- package/build/types/utils/sortRowsFn.d.ts +0 -2
- package/build/types/utils.d.ts +0 -28
- package/src/aggregationTypes.ts +0 -115
- package/src/core.tsx +0 -1181
- package/src/createTable.tsx +0 -241
- package/src/features/ColumnSizing.ts +0 -453
- package/src/features/Expanding.ts +0 -404
- package/src/features/Filters.ts +0 -762
- package/src/features/Grouping.ts +0 -466
- package/src/features/Headers.ts +0 -912
- package/src/features/Ordering.ts +0 -133
- package/src/features/Pagination.ts +0 -327
- package/src/features/Pinning.ts +0 -200
- package/src/features/RowSelection.ts +0 -831
- package/src/features/Sorting.ts +0 -547
- package/src/features/Visibility.ts +0 -279
- package/src/filterTypes.ts +0 -251
- package/src/sortTypes.ts +0 -159
- package/src/types.ts +0 -331
- package/src/utils/columnFilterRowsFn.ts +0 -155
- package/src/utils/expandRowsFn.ts +0 -50
- package/src/utils/globalFilterRowsFn.ts +0 -122
- package/src/utils/groupRowsFn.ts +0 -194
- package/src/utils/paginateRowsFn.ts +0 -34
- package/src/utils/sortRowsFn.ts +0 -115
- package/src/utils.tsx +0 -257
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { MouseEvent, TouchEvent } from 'react';
|
|
2
|
-
import { RowModel } from '..';
|
|
3
|
-
import { BuiltInSortType } from '../sortTypes';
|
|
4
|
-
import { Column, Getter, OnChangeFn, PropGetterValue, ReactTable, Row, Updater } from '../types';
|
|
5
|
-
export declare type SortDirection = 'asc' | 'desc';
|
|
6
|
-
export declare type ColumnSort = {
|
|
7
|
-
id: string;
|
|
8
|
-
desc: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare type SortingState = ColumnSort[];
|
|
11
|
-
export declare type SortingFn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
|
|
12
|
-
(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): number;
|
|
13
|
-
};
|
|
14
|
-
export declare type SortingTableState = {
|
|
15
|
-
sorting: SortingState;
|
|
16
|
-
};
|
|
17
|
-
export declare type SortType<TSortingFns> = 'auto' | BuiltInSortType | keyof TSortingFns | SortingFn<any, any, any, TSortingFns, any>;
|
|
18
|
-
export declare type SortingColumnDef<TFilterFns> = {
|
|
19
|
-
sortType?: SortType<TFilterFns>;
|
|
20
|
-
sortDescFirst?: boolean;
|
|
21
|
-
enableSorting?: boolean;
|
|
22
|
-
enableMultiSort?: boolean;
|
|
23
|
-
defaultCanSort?: boolean;
|
|
24
|
-
invertSorting?: boolean;
|
|
25
|
-
sortUndefined?: false | -1 | 1;
|
|
26
|
-
};
|
|
27
|
-
export declare type SortingColumn<_TData, _TValue, TFilterFns, _TSortingFns, _TAggregationFns> = {
|
|
28
|
-
sortType: SortType<TFilterFns>;
|
|
29
|
-
getCanSort: () => boolean;
|
|
30
|
-
getCanMultiSort: () => boolean;
|
|
31
|
-
getSortIndex: () => number;
|
|
32
|
-
getIsSorted: () => false | SortDirection;
|
|
33
|
-
toggleSorting: (desc?: boolean, isMulti?: boolean) => void;
|
|
34
|
-
getToggleSortingProps: <TGetter extends Getter<ToggleSortingProps>>(userProps?: TGetter) => undefined | PropGetterValue<ToggleSortingProps, TGetter>;
|
|
35
|
-
};
|
|
36
|
-
export declare type SortingOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
|
|
37
|
-
sortTypes?: TSortingFns;
|
|
38
|
-
onSortingChange?: OnChangeFn<SortingState>;
|
|
39
|
-
autoResetSorting?: boolean;
|
|
40
|
-
enableSorting?: boolean;
|
|
41
|
-
enableSortingRemoval?: boolean;
|
|
42
|
-
enableMultiRemove?: boolean;
|
|
43
|
-
enableMultiSort?: boolean;
|
|
44
|
-
sortDescFirst?: boolean;
|
|
45
|
-
sortRowsFn?: (instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>) => RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
46
|
-
maxMultiSortColCount?: number;
|
|
47
|
-
isMultiSortEvent?: (e: MouseEvent | TouchEvent) => boolean;
|
|
48
|
-
};
|
|
49
|
-
export declare type ToggleSortingProps = {
|
|
50
|
-
title?: string;
|
|
51
|
-
onClick?: (event: MouseEvent | TouchEvent) => void;
|
|
52
|
-
};
|
|
53
|
-
export declare type SortingInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
|
|
54
|
-
_notifySortingReset: () => void;
|
|
55
|
-
getColumnAutoSortingFn: (columnId: string) => SortingFn<any, any, any, any, any> | undefined;
|
|
56
|
-
getColumnAutoSortDir: (columnId: string) => SortDirection;
|
|
57
|
-
getColumnSortingFn: (columnId: string) => SortingFn<any, any, any, any, any> | undefined;
|
|
58
|
-
setSorting: (updater: Updater<SortingState>) => void;
|
|
59
|
-
toggleColumnSorting: (columnId: string, desc?: boolean, multi?: boolean) => void;
|
|
60
|
-
resetSorting: () => void;
|
|
61
|
-
getColumnCanSort: (columnId: string) => boolean;
|
|
62
|
-
getColumnCanMultiSort: (columnId: string) => boolean;
|
|
63
|
-
getColumnIsSorted: (columnId: string) => false | 'asc' | 'desc';
|
|
64
|
-
getColumnSortIndex: (columnId: string) => number;
|
|
65
|
-
getToggleSortingProps: <TGetter extends Getter<ToggleSortingProps>>(columnId: string, userProps?: TGetter) => undefined | PropGetterValue<ToggleSortingProps, TGetter>;
|
|
66
|
-
getSortedRowModel: () => RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
67
|
-
getPreSortedRows: () => Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
68
|
-
getPreSortedFlatRows: () => Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
69
|
-
getPreSortedRowsById: () => Record<string, Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>>;
|
|
70
|
-
getSortedRows: () => Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
71
|
-
getSortedFlatRows: () => Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
72
|
-
getSortedRowsById: () => Record<string, Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>>;
|
|
73
|
-
};
|
|
74
|
-
export declare function getDefaultColumn<TFilterFns>(): SortingColumnDef<TFilterFns>;
|
|
75
|
-
export declare function getInitialState(): SortingTableState;
|
|
76
|
-
export declare function getDefaultOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): SortingOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
77
|
-
export declare function createColumn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(column: Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): SortingColumn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
78
|
-
export declare function getInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): SortingInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Cell, Column, Getter, OnChangeFn, PropGetterValue, ReactTable, Updater } from '../types';
|
|
2
|
-
export declare type VisibilityOptions = {
|
|
3
|
-
onColumnVisibilityChange?: OnChangeFn<VisibilityState>;
|
|
4
|
-
enableHiding?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare type VisibilityDefaultOptions = {
|
|
7
|
-
onColumnVisibilityChange: OnChangeFn<VisibilityState>;
|
|
8
|
-
};
|
|
9
|
-
export declare type VisibilityState = Record<string, boolean>;
|
|
10
|
-
export declare type VisibilityTableState = {
|
|
11
|
-
columnVisibility: VisibilityState;
|
|
12
|
-
};
|
|
13
|
-
export declare type VisibilityInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
|
|
14
|
-
getVisibleFlatColumns: () => Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
15
|
-
getVisibleLeafColumns: () => Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
16
|
-
setColumnVisibility: (updater: Updater<VisibilityState>) => void;
|
|
17
|
-
toggleColumnVisibility: (columnId: string, value?: boolean) => void;
|
|
18
|
-
toggleAllColumnsVisible: (value?: boolean) => void;
|
|
19
|
-
getColumnIsVisible: (columId: string) => boolean;
|
|
20
|
-
getColumnCanHide: (columnId: string) => boolean;
|
|
21
|
-
getIsAllColumnsVisible: () => boolean;
|
|
22
|
-
getIsSomeColumnsVisible: () => boolean;
|
|
23
|
-
getToggleAllColumnsVisibilityProps: <TGetter extends Getter<ToggleAllColumnsVisibilityProps>>(userProps?: TGetter) => undefined | PropGetterValue<ToggleAllColumnsVisibilityProps, TGetter>;
|
|
24
|
-
};
|
|
25
|
-
declare type ToggleVisibilityProps = {};
|
|
26
|
-
declare type ToggleAllColumnsVisibilityProps = {};
|
|
27
|
-
export declare type VisibilityColumnDef = {
|
|
28
|
-
enableHiding?: boolean;
|
|
29
|
-
defaultCanHide?: boolean;
|
|
30
|
-
};
|
|
31
|
-
export declare type VisibilityRow<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
|
|
32
|
-
getVisibleCells: () => Cell<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
33
|
-
};
|
|
34
|
-
export declare type VisibilityColumn = {
|
|
35
|
-
getCanHide: () => boolean;
|
|
36
|
-
getIsVisible: () => boolean;
|
|
37
|
-
toggleVisibility: (value?: boolean) => void;
|
|
38
|
-
getToggleVisibilityProps: <TGetter extends Getter<ToggleVisibilityProps>>(userProps?: TGetter) => PropGetterValue<ToggleVisibilityProps, TGetter>;
|
|
39
|
-
};
|
|
40
|
-
export declare function getInitialState(): VisibilityTableState;
|
|
41
|
-
export declare function getDefaultOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): VisibilityDefaultOptions;
|
|
42
|
-
export declare function getDefaultColumn(): {
|
|
43
|
-
defaultIsVisible: boolean;
|
|
44
|
-
};
|
|
45
|
-
export declare function createColumn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(column: Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): VisibilityColumn;
|
|
46
|
-
export declare function getInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): VisibilityInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
47
|
-
export {};
|
|
@@ -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,18 +0,0 @@
|
|
|
1
|
-
import { Row } from './types';
|
|
2
|
-
export declare const reSplitAlphaNumeric: RegExp;
|
|
3
|
-
export declare const sortTypes: {
|
|
4
|
-
alphanumeric: typeof alphanumeric;
|
|
5
|
-
alphanumericCaseSensitive: typeof alphanumericCaseSensitive;
|
|
6
|
-
text: typeof text;
|
|
7
|
-
textCaseSensitive: typeof textCaseSensitive;
|
|
8
|
-
datetime: typeof datetime;
|
|
9
|
-
basic: typeof basic;
|
|
10
|
-
};
|
|
11
|
-
export declare type BuiltInSortType = keyof typeof sortTypes;
|
|
12
|
-
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;
|
|
13
|
-
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;
|
|
14
|
-
declare function text<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): 1 | 0 | -1;
|
|
15
|
-
declare function textCaseSensitive<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): 1 | 0 | -1;
|
|
16
|
-
declare function datetime<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): 1 | 0 | -1;
|
|
17
|
-
declare function basic<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(rowA: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowB: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, columnId: string): 1 | 0 | -1;
|
|
18
|
-
export {};
|
package/build/types/types.d.ts
DELETED
|
@@ -1,127 +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
|
-
import { ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingTableState } from './features/ColumnSizing';
|
|
13
|
-
import { PaginationInstance, PaginationOptions, PaginationTableState } from './features/Pagination';
|
|
14
|
-
import { RowSelectionInstance, RowSelectionOptions, RowSelectionRow, RowSelectionTableState } from './features/RowSelection';
|
|
15
|
-
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> & ColumnSizingInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & ExpandedInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & PaginationInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & RowSelectionInstance<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
16
|
-
export declare type Renderable<TProps> = React.ReactNode | React.FunctionComponent<TProps> | React.Component<TProps>;
|
|
17
|
-
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> & ColumnSizingOptions & PaginationOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & RowSelectionOptions<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
18
|
-
export declare type Updater<T> = T | ((old: T) => T);
|
|
19
|
-
export declare type OnChangeFn<T> = (updaterOrValue: Updater<T>, value: T) => void;
|
|
20
|
-
export declare type TableState = VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationTableState & RowSelectionTableState;
|
|
21
|
-
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 & RowSelectionRow;
|
|
22
|
-
export declare type RowValues = {
|
|
23
|
-
[key: string]: any;
|
|
24
|
-
};
|
|
25
|
-
export declare type RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
|
|
26
|
-
rows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
27
|
-
flatRows: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
28
|
-
rowsById: Record<string, Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>>;
|
|
29
|
-
};
|
|
30
|
-
export declare type AccessorFn<TData> = (originalRow: TData, index: number) => any;
|
|
31
|
-
export declare type ColumnDef<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = CoreColumnDef<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TFilterFns> & SortingColumnDef<TSortingFns> & GroupingColumnDef<TAggregationFns> & ColumnSizingColumnDef;
|
|
32
|
-
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> & ColumnSizingColumn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
33
|
-
export declare type Cell<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
|
|
34
|
-
id: string;
|
|
35
|
-
rowId: string;
|
|
36
|
-
columnId: string;
|
|
37
|
-
value: TValue;
|
|
38
|
-
row: Row<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
39
|
-
column: Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
40
|
-
getCellProps: PropGetter<CellProps>;
|
|
41
|
-
renderCell: () => React.ReactNode;
|
|
42
|
-
};
|
|
43
|
-
export declare type Header<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = CoreHeader<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
44
|
-
export declare type CoreHeader<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
|
|
45
|
-
id: string;
|
|
46
|
-
depth: number;
|
|
47
|
-
column: Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
48
|
-
getWidth: () => number;
|
|
49
|
-
subHeaders: Header<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
50
|
-
colSpan?: number;
|
|
51
|
-
rowSpan?: number;
|
|
52
|
-
getHeaderProps: PropGetter<HeaderProps>;
|
|
53
|
-
getFooterProps: PropGetter<HeaderProps>;
|
|
54
|
-
getLeafHeaders: () => Header<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
55
|
-
isPlaceholder?: boolean;
|
|
56
|
-
placeholderId?: string;
|
|
57
|
-
renderHeader: (options?: {
|
|
58
|
-
renderPlaceholder?: boolean;
|
|
59
|
-
}) => React.ReactNode;
|
|
60
|
-
renderFooter: (options?: {
|
|
61
|
-
renderPlaceholder?: boolean;
|
|
62
|
-
}) => React.ReactNode;
|
|
63
|
-
};
|
|
64
|
-
export declare type HeaderGroup<TData, TValue, TFilterFns, TSortingFns, TAggregationFns> = {
|
|
65
|
-
id: string;
|
|
66
|
-
depth: number;
|
|
67
|
-
headers: Header<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>[];
|
|
68
|
-
getHeaderGroupProps: PropGetter<HeaderGroupProps>;
|
|
69
|
-
getFooterGroupProps: PropGetter<FooterGroupProps>;
|
|
70
|
-
};
|
|
71
|
-
export declare type HeaderRenderProps<THeader> = {
|
|
72
|
-
header: THeader;
|
|
73
|
-
};
|
|
74
|
-
export declare type FooterRenderProps<THeader> = {
|
|
75
|
-
header: THeader;
|
|
76
|
-
};
|
|
77
|
-
export declare type CellRenderProps<TCell, TRow> = {
|
|
78
|
-
cell: TCell;
|
|
79
|
-
row: TRow;
|
|
80
|
-
};
|
|
81
|
-
export declare type TableProps = {
|
|
82
|
-
role: string;
|
|
83
|
-
};
|
|
84
|
-
export declare type TableBodyProps = {
|
|
85
|
-
role: string;
|
|
86
|
-
};
|
|
87
|
-
export declare type TableHeadProps = {
|
|
88
|
-
key: string;
|
|
89
|
-
role: string;
|
|
90
|
-
};
|
|
91
|
-
export declare type TableFooterProps = {
|
|
92
|
-
key: string;
|
|
93
|
-
role: string;
|
|
94
|
-
};
|
|
95
|
-
export declare type HeaderGroupProps = {
|
|
96
|
-
key: string;
|
|
97
|
-
role: string;
|
|
98
|
-
};
|
|
99
|
-
export declare type FooterGroupProps = {
|
|
100
|
-
key: string;
|
|
101
|
-
role: string;
|
|
102
|
-
};
|
|
103
|
-
export declare type HeaderProps = {
|
|
104
|
-
key: string;
|
|
105
|
-
role: string;
|
|
106
|
-
colSpan?: number;
|
|
107
|
-
rowSpan?: number;
|
|
108
|
-
};
|
|
109
|
-
export declare type FooterProps = {
|
|
110
|
-
key: string;
|
|
111
|
-
role: string;
|
|
112
|
-
colSpan?: number;
|
|
113
|
-
rowSpan?: number;
|
|
114
|
-
};
|
|
115
|
-
export declare type RowProps = {
|
|
116
|
-
key: string;
|
|
117
|
-
role: string;
|
|
118
|
-
};
|
|
119
|
-
export declare type CellProps = {
|
|
120
|
-
key: string;
|
|
121
|
-
role: string;
|
|
122
|
-
};
|
|
123
|
-
export declare type Listener<TArgs extends [...any]> = (...args: [...TArgs]) => void;
|
|
124
|
-
export declare type PropGetter<TBase> = <TGetter extends Getter<TBase>>(userProps?: TGetter) => PropGetterValue<TBase, TGetter>;
|
|
125
|
-
export declare type Getter<TInitial> = ((initial: TInitial) => object) | object | undefined;
|
|
126
|
-
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;
|
|
127
|
-
export declare type NoInfer<A extends any> = [A][A extends any ? 0 : never];
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { ReactTable, RowModel } from '../types';
|
|
2
|
-
export declare function columnFilterRowsFn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { ReactTable, RowModel } from '../types';
|
|
2
|
-
export declare function expandRowsFn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, sortedRowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { ReactTable, RowModel } from '../types';
|
|
2
|
-
export declare function globalFilterRowsFn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { ReactTable, RowModel } from '../types';
|
|
2
|
-
export declare function groupRowsFn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, sortedRowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { ReactTable, RowModel } from '../types';
|
|
2
|
-
export declare function paginateRowsFn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { ReactTable, RowModel } from '../types';
|
|
2
|
-
export declare function sortRowsFn<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>(instance: ReactTable<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>, rowModel: RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>): RowModel<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
package/build/types/utils.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Getter, NoInfer, PropGetterValue, Renderable, TableState } 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: keyof TableState, 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, opts: {
|
|
21
|
-
key: string;
|
|
22
|
-
debug?: boolean;
|
|
23
|
-
onChange?: (result: TResult, previousResult?: TResult) => void;
|
|
24
|
-
}): () => TResult;
|
|
25
|
-
export declare function isPlainObject(o: any): o is Object;
|
|
26
|
-
export declare type Render = typeof flexRender;
|
|
27
|
-
export declare function flexRender<TProps extends {}>(Comp: Renderable<TProps>, props: TProps): React.ReactNode;
|
|
28
|
-
export {};
|
package/src/aggregationTypes.ts
DELETED
|
@@ -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
|
-
}
|