@infinite-table/infinite-react 0.5.0 → 0.5.2
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/README.md +104 -0
- package/index.css +896 -0
- package/index.d.ts +2264 -0
- package/index.esm.css +896 -0
- package/index.esm.js +15404 -0
- package/index.js +15240 -0
- package/package.json +9 -94
- package/.vscode/settings.json +0 -3
- package/API.md +0 -0
- package/build/buildPackageJson.js +0 -43
- package/build/scripts/test.js +0 -37
- package/bundler.config.js +0 -25
- package/globals.d.ts +0 -7
- package/rollup.config.js +0 -15
- package/run-build-deepmap.js +0 -47
- package/run-build.js +0 -45
- package/run-dts-concat.js +0 -21
- package/src/components/CSSVariableWatch.tsx +0 -82
- package/src/components/DataSource/BooleanCollectionState.ts +0 -214
- package/src/components/DataSource/BooleanDeepCollectionState.ts +0 -208
- package/src/components/DataSource/DataSourceContext.ts +0 -20
- package/src/components/DataSource/GroupRowsState.ts +0 -74
- package/src/components/DataSource/Indexer.ts +0 -27
- package/src/components/DataSource/RowSelectionState.ts +0 -763
- package/src/components/DataSource/defaultFilterTypes.ts +0 -64
- package/src/components/DataSource/index.tsx +0 -108
- package/src/components/DataSource/privateHooks/getChangeDetect.ts +0 -7
- package/src/components/DataSource/privateHooks/useLoadData.ts +0 -783
- package/src/components/DataSource/publicHooks/useDataSource.ts +0 -19
- package/src/components/DataSource/publicHooks/useDataSourceActions.ts +0 -14
- package/src/components/DataSource/state/getInitialState.ts +0 -494
- package/src/components/DataSource/state/normalizeSortInfo.ts +0 -35
- package/src/components/DataSource/state/reducer.ts +0 -466
- package/src/components/DataSource/state/rowInfoStatus.ts +0 -27
- package/src/components/DataSource/types.ts +0 -548
- package/src/components/HeadlessTable/HeadlessTableWithPinnedContainers.tsx +0 -142
- package/src/components/HeadlessTable/MappedCells.ts +0 -251
- package/src/components/HeadlessTable/RawTable.tsx +0 -98
- package/src/components/HeadlessTable/ReactHeadlessTableRenderer.tsx +0 -1516
- package/src/components/HeadlessTable/index.tsx +0 -234
- package/src/components/InfiniteTable/InfiniteCls.css.ts +0 -164
- package/src/components/InfiniteTable/InfiniteTableContext.ts +0 -16
- package/src/components/InfiniteTable/api/getImperativeApi.ts +0 -391
- package/src/components/InfiniteTable/api/getSelectionApi.ts +0 -364
- package/src/components/InfiniteTable/api/type.ts +0 -11
- package/src/components/InfiniteTable/components/ActiveCellIndicator.css.ts +0 -51
- package/src/components/InfiniteTable/components/ActiveCellIndicator.tsx +0 -116
- package/src/components/InfiniteTable/components/ActiveRowIndicator.css.ts +0 -56
- package/src/components/InfiniteTable/components/ActiveRowIndicator.tsx +0 -94
- package/src/components/InfiniteTable/components/CheckBox.css.ts +0 -13
- package/src/components/InfiniteTable/components/CheckBox.tsx +0 -96
- package/src/components/InfiniteTable/components/FilterEditors.tsx +0 -52
- package/src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx +0 -27
- package/src/components/InfiniteTable/components/InfiniteTableBody/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx +0 -31
- package/src/components/InfiniteTable/components/InfiniteTableFooter/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx +0 -102
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx +0 -163
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx +0 -574
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx +0 -79
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderTypes.tsx +0 -25
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx +0 -185
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx +0 -159
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts +0 -124
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts +0 -166
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx +0 -146
- package/src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts +0 -240
- package/src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts +0 -358
- package/src/components/InfiniteTable/components/InfiniteTableHeader/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx +0 -114
- package/src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx +0 -146
- package/src/components/InfiniteTable/components/InfiniteTableLicenseFooter/footer.css.ts +0 -7
- package/src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx +0 -110
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx +0 -120
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCellTypes.ts +0 -74
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx +0 -457
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx +0 -107
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts +0 -6
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowTypes.ts +0 -32
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowUnvirtualized.tsx +0 -75
- package/src/components/InfiniteTable/components/InfiniteTableRow/columnRendering.tsx +0 -263
- package/src/components/InfiniteTable/components/InfiniteTableRow/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts +0 -74
- package/src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts +0 -199
- package/src/components/InfiniteTable/components/LoadMask.css.ts +0 -34
- package/src/components/InfiniteTable/components/LoadMask.tsx +0 -27
- package/src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx +0 -56
- package/src/components/InfiniteTable/components/cell.css.ts +0 -192
- package/src/components/InfiniteTable/components/icons/ArrowDown.tsx +0 -14
- package/src/components/InfiniteTable/components/icons/ArrowUp.tsx +0 -14
- package/src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts +0 -31
- package/src/components/InfiniteTable/components/icons/ExpanderIcon.tsx +0 -63
- package/src/components/InfiniteTable/components/icons/Icon.tsx +0 -18
- package/src/components/InfiniteTable/components/icons/InfiniteTableIconClassName.ts +0 -1
- package/src/components/InfiniteTable/components/icons/LoadingIcon.css.ts +0 -8
- package/src/components/InfiniteTable/components/icons/LoadingIcon.tsx +0 -45
- package/src/components/InfiniteTable/components/icons/MenuIcon.tsx +0 -50
- package/src/components/InfiniteTable/components/icons/SortIcon.tsx +0 -113
- package/src/components/InfiniteTable/eventHandlers/eventHandlerTypes.ts +0 -57
- package/src/components/InfiniteTable/eventHandlers/index.ts +0 -95
- package/src/components/InfiniteTable/eventHandlers/keyboardNavigation.ts +0 -232
- package/src/components/InfiniteTable/eventHandlers/keyboardSelection.ts +0 -110
- package/src/components/InfiniteTable/eventHandlers/onCellClick.ts +0 -94
- package/src/components/InfiniteTable/eventHandlers/onKeyDown.ts +0 -25
- package/src/components/InfiniteTable/hooks/adjustColumnOrderForAllColumns.ts +0 -70
- package/src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts +0 -476
- package/src/components/InfiniteTable/hooks/useAutoSizeColumns.ts +0 -206
- package/src/components/InfiniteTable/hooks/useCellClassName.ts +0 -80
- package/src/components/InfiniteTable/hooks/useCellRendering.tsx +0 -217
- package/src/components/InfiniteTable/hooks/useColumnGroups.ts +0 -71
- package/src/components/InfiniteTable/hooks/useColumnMenu.ts +0 -72
- package/src/components/InfiniteTable/hooks/useColumnPointerEvents.ts +0 -258
- package/src/components/InfiniteTable/hooks/useColumnRowspan.ts +0 -43
- package/src/components/InfiniteTable/hooks/useColumnSizeFn.ts +0 -24
- package/src/components/InfiniteTable/hooks/useColumnsWhen.ts +0 -582
- package/src/components/InfiniteTable/hooks/useComputed.ts +0 -186
- package/src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts +0 -219
- package/src/components/InfiniteTable/hooks/useDOMProps.ts +0 -306
- package/src/components/InfiniteTable/hooks/useEffectWithRaf.ts +0 -47
- package/src/components/InfiniteTable/hooks/useInfiniteTable.ts +0 -10
- package/src/components/InfiniteTable/hooks/useInfiniteTableState.ts +0 -11
- package/src/components/InfiniteTable/hooks/useInternalProps.ts +0 -8
- package/src/components/InfiniteTable/hooks/useLicense/LicenseDetails.ts +0 -13
- package/src/components/InfiniteTable/hooks/useLicense/crc32.ts +0 -56
- package/src/components/InfiniteTable/hooks/useLicense/decode.ts +0 -147
- package/src/components/InfiniteTable/hooks/useLicense/useLicense.ts +0 -39
- package/src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts +0 -21
- package/src/components/InfiniteTable/hooks/useRowHover.ts +0 -18
- package/src/components/InfiniteTable/hooks/useScrollToActiveCell.ts +0 -48
- package/src/components/InfiniteTable/hooks/useScrollToActiveRow.ts +0 -44
- package/src/components/InfiniteTable/hooks/useScrollbars.ts +0 -51
- package/src/components/InfiniteTable/hooks/useToggleGroupRow.ts +0 -56
- package/src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx +0 -165
- package/src/components/InfiniteTable/hooks/useYourBrain.ts +0 -55
- package/src/components/InfiniteTable/index.tsx +0 -352
- package/src/components/InfiniteTable/internalProps.ts +0 -4
- package/src/components/InfiniteTable/state/computeColumnGroupsDepths.ts +0 -29
- package/src/components/InfiniteTable/state/getColumnVisibilityForHideEmptyGroupColumns.ts +0 -127
- package/src/components/InfiniteTable/state/getInitialState.ts +0 -375
- package/src/components/InfiniteTable/theme.css.ts +0 -556
- package/src/components/InfiniteTable/types/InfiniteTableAction.ts +0 -6
- package/src/components/InfiniteTable/types/InfiniteTableActionType.ts +0 -12
- package/src/components/InfiniteTable/types/InfiniteTableColumn.ts +0 -478
- package/src/components/InfiniteTable/types/InfiniteTableComputedValues.ts +0 -43
- package/src/components/InfiniteTable/types/InfiniteTableContextValue.ts +0 -12
- package/src/components/InfiniteTable/types/InfiniteTableInternalProps.ts +0 -3
- package/src/components/InfiniteTable/types/InfiniteTableProps.ts +0 -511
- package/src/components/InfiniteTable/types/InfiniteTableState.ts +0 -195
- package/src/components/InfiniteTable/types/Utility.ts +0 -35
- package/src/components/InfiniteTable/types/index.ts +0 -96
- package/src/components/InfiniteTable/utilities.css.ts +0 -179
- package/src/components/InfiniteTable/utils/MultiRowSelector.ts +0 -111
- package/src/components/InfiniteTable/utils/RenderHookComponentForInfinite.tsx +0 -52
- package/src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts +0 -33
- package/src/components/InfiniteTable/utils/assignFiltered.ts +0 -29
- package/src/components/InfiniteTable/utils/defaultGetColumContextMenuItems.tsx +0 -108
- package/src/components/InfiniteTable/utils/getColumnComputedType.ts +0 -33
- package/src/components/InfiniteTable/utils/getColumnForGroupBy.tsx +0 -313
- package/src/components/InfiniteTable/utils/getComputedVisibleColumns.ts +0 -773
- package/src/components/InfiniteTable/utils/getContextMenuForColumn.tsx +0 -72
- package/src/components/InfiniteTable/utils/infiniteDOMUtils.ts +0 -189
- package/src/components/InfiniteTable/utils/mapToObject.ts +0 -20
- package/src/components/InfiniteTable/utils/moveXatY.ts +0 -25
- package/src/components/InfiniteTable/utils/objectValuesExcept.ts +0 -9
- package/src/components/InfiniteTable/utils/progressiveSpeedScroller.ts +0 -158
- package/src/components/InfiniteTable/utils/rafFn.ts +0 -13
- package/src/components/InfiniteTable/utils/toCSSVarName.ts +0 -1
- package/src/components/InfiniteTable/utils/toMap.ts +0 -24
- package/src/components/Menu/Menu.tsx +0 -750
- package/src/components/Menu/MenuCls.css.ts +0 -139
- package/src/components/Menu/MenuContext.ts +0 -10
- package/src/components/Menu/MenuContextValue.ts +0 -15
- package/src/components/Menu/MenuProps.ts +0 -98
- package/src/components/Menu/MenuState.ts +0 -56
- package/src/components/Menu/MenuTriangleContext.ts +0 -352
- package/src/components/Menu/childrenToRuntimeItems.tsx +0 -103
- package/src/components/Menu/getMenuState.tsx +0 -119
- package/src/components/Menu/index.tsx +0 -88
- package/src/components/Menu/propToIdentifyMenu.ts +0 -1
- package/src/components/RawList/AvoidReactDiff.tsx +0 -48
- package/src/components/RawList/MappedItems.ts +0 -143
- package/src/components/RawList/ReactVirtualRenderer.tsx +0 -307
- package/src/components/RawList/index.tsx +0 -42
- package/src/components/RawList/types.ts +0 -23
- package/src/components/RawList/useVirtualRenderer.ts +0 -36
- package/src/components/RenderHookComponent.tsx +0 -10
- package/src/components/ResizeObserver/index.tsx +0 -170
- package/src/components/VirtualBrain/MatrixBrain.ts +0 -1621
- package/src/components/VirtualBrain/ScrollListener.ts +0 -39
- package/src/components/VirtualBrain/index.ts +0 -664
- package/src/components/VirtualList/ColumnListWithExternalScrolling.tsx +0 -78
- package/src/components/VirtualList/InfiniteListRootClassName.ts +0 -1
- package/src/components/VirtualList/RowListWithExternalScrolling.tsx +0 -120
- package/src/components/VirtualList/SpacePlaceholder.tsx +0 -32
- package/src/components/VirtualList/VirtualList.css.ts +0 -29
- package/src/components/VirtualList/VirtualList.tsx +0 -141
- package/src/components/VirtualList/VirtualRowList.tsx +0 -34
- package/src/components/VirtualList/types.ts +0 -56
- package/src/components/VirtualList/useCorrectHeightForRowElements.ts +0 -14
- package/src/components/VirtualScrollContainer/VirtualScrollContainer.css.ts +0 -51
- package/src/components/VirtualScrollContainer/getScrollableClassName.ts +0 -30
- package/src/components/VirtualScrollContainer/index.tsx +0 -63
- package/src/components/flexbox/index.ts +0 -562
- package/src/components/hooks/useComponentState/index.tsx +0 -562
- package/src/components/hooks/useComponentState/types.ts +0 -32
- package/src/components/hooks/useEffectOnceWithProperUnmount.ts +0 -33
- package/src/components/hooks/useEffectWithChanges.ts +0 -56
- package/src/components/hooks/useImmutableRef.ts +0 -7
- package/src/components/hooks/useInterceptedMap.ts +0 -71
- package/src/components/hooks/useLatest.tsx +0 -8
- package/src/components/hooks/useLazyLatest.ts +0 -23
- package/src/components/hooks/useMemoShallowObjectMerge.ts +0 -16
- package/src/components/hooks/useMounted.ts +0 -18
- package/src/components/hooks/useOnMount.ts +0 -21
- package/src/components/hooks/useOnScroll.ts +0 -34
- package/src/components/hooks/useOnce.ts +0 -10
- package/src/components/hooks/useOverlay/index.tsx +0 -418
- package/src/components/hooks/usePrevious.ts +0 -8
- package/src/components/hooks/usePropertyOld.ts +0 -168
- package/src/components/hooks/useRerender.ts +0 -12
- package/src/components/hooks/xuseProperty.ts +0 -165
- package/src/components/types/CellPosition.ts +0 -4
- package/src/components/types/NonUndefined.ts +0 -1
- package/src/components/types/RemoveObject.ts +0 -22
- package/src/components/types/Renderable.ts +0 -3
- package/src/components/types/ScrollPosition.ts +0 -7
- package/src/components/types/Setter.ts +0 -2
- package/src/components/types/Size.ts +0 -6
- package/src/components/types/SubscriptionCallback.ts +0 -10
- package/src/components/types/VoidFn.ts +0 -1
- package/src/components/utils/buildSubscriptionCallback.tsx +0 -60
- package/src/components/utils/clamp.ts +0 -3
- package/src/components/utils/debounce.ts +0 -16
- package/src/components/utils/decamelize.ts +0 -11
- package/src/components/utils/discardCallsWithEqualArg.ts +0 -42
- package/src/components/utils/getRenderIndexes.ts +0 -33
- package/src/components/utils/getScrollbarWidth.ts +0 -31
- package/src/components/utils/getVirtualRenderCount.ts +0 -21
- package/src/components/utils/isControlled.ts +0 -12
- package/src/components/utils/isControlledValue.ts +0 -5
- package/src/index.tsx +0 -34
- package/src/test.tsx +0 -18
- package/src/utils/DeepMap/index.ts +0 -588
- package/src/utils/DeepMap/once.ts +0 -16
- package/src/utils/DeepMap/sortAscending.ts +0 -1
- package/src/utils/DeepMap/tsconfig.deepmap.json +0 -17
- package/src/utils/DeepMap/xpackage.json +0 -26
- package/src/utils/debug.ts +0 -40
- package/src/utils/deepClone.ts +0 -38
- package/src/utils/getGlobal.ts +0 -3
- package/src/utils/groupAndPivot/defaultToKey.ts +0 -3
- package/src/utils/groupAndPivot/getGroupKeysForDataItem.ts +0 -19
- package/src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts +0 -361
- package/src/utils/groupAndPivot/index.ts +0 -1229
- package/src/utils/groupAndPivot/types.ts +0 -10
- package/src/utils/join.ts +0 -4
- package/src/utils/mathIntersection.ts +0 -21
- package/src/utils/minified.d.ts +0 -2
- package/src/utils/minified.js +0 -6
- package/src/utils/multisort/index.ts +0 -151
- package/src/utils/multisort/sortTypes.ts +0 -25
- package/src/utils/notes-status.md +0 -92
- package/src/utils/pageGeometry/ConvexPoly.ts +0 -34
- package/src/utils/pageGeometry/Point.ts +0 -51
- package/src/utils/pageGeometry/PolyWithPoints.ts +0 -52
- package/src/utils/pageGeometry/Rectangle.ts +0 -98
- package/src/utils/pageGeometry/Triangle.ts +0 -16
- package/src/utils/pageGeometry/alignment/index.ts +0 -221
- package/src/utils/pageGeometry/polyContainsPoint.ts +0 -182
- package/src/utils/pageGeometry/types.ts +0 -3
- package/src/utils/proxyFnCall.ts +0 -46
- package/src/utils/raf.ts +0 -13
- package/src/utils/selectParent.ts +0 -18
- package/src/utils/shallowEqualObjects.ts +0 -49
- package/src/utils/stripVar.ts +0 -3
- package/src/utils/toUpperFirst.ts +0 -5
- package/todo.md +0 -2
- package/tsconfig.build.json +0 -8
- package/tsconfig.dev.json +0 -7
- package/tsconfig.json +0 -30
- package/tsconfig.typebundler.json +0 -13
- package/typedoc.json +0 -4
|
@@ -1,548 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { DeepMap } from '../../utils/DeepMap';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
AggregationReducerResult,
|
|
7
|
-
DeepMapGroupValueType,
|
|
8
|
-
GroupKeyType,
|
|
9
|
-
PivotBy,
|
|
10
|
-
} from '../../utils/groupAndPivot';
|
|
11
|
-
import { GroupBy } from '../../utils/groupAndPivot/types';
|
|
12
|
-
import { MultisortInfo } from '../../utils/multisort';
|
|
13
|
-
import { ComponentStateActions } from '../hooks/useComponentState/types';
|
|
14
|
-
import {
|
|
15
|
-
InfiniteTableColumn,
|
|
16
|
-
InfiniteTableColumnGroup,
|
|
17
|
-
InfiniteTableRowInfo,
|
|
18
|
-
Scrollbars,
|
|
19
|
-
} from '../InfiniteTable/types';
|
|
20
|
-
import {
|
|
21
|
-
DiscriminatedUnion,
|
|
22
|
-
InfiniteTablePivotColumn,
|
|
23
|
-
InfiniteTablePivotFinalColumnVariant,
|
|
24
|
-
} from '../InfiniteTable/types/InfiniteTableColumn';
|
|
25
|
-
import { ScrollStopInfo } from '../InfiniteTable/types/InfiniteTableProps';
|
|
26
|
-
import {
|
|
27
|
-
InfiniteTablePropPivotGrandTotalColumnPosition,
|
|
28
|
-
InfiniteTablePropPivotTotalColumnPosition,
|
|
29
|
-
} from '../InfiniteTable/types/InfiniteTableState';
|
|
30
|
-
import { NonUndefined } from '../types/NonUndefined';
|
|
31
|
-
import { SubscriptionCallback } from '../types/SubscriptionCallback';
|
|
32
|
-
import { RenderRange } from '../VirtualBrain';
|
|
33
|
-
|
|
34
|
-
import { GroupRowsState } from './GroupRowsState';
|
|
35
|
-
import { Indexer } from './Indexer';
|
|
36
|
-
import {
|
|
37
|
-
RowSelectionState,
|
|
38
|
-
RowSelectionStateObject,
|
|
39
|
-
} from './RowSelectionState';
|
|
40
|
-
|
|
41
|
-
export interface DataSourceDataParams<T> {
|
|
42
|
-
originalDataArray: T[];
|
|
43
|
-
sortInfo?: DataSourceSortInfo<T>;
|
|
44
|
-
groupBy?: DataSourcePropGroupBy<T>;
|
|
45
|
-
pivotBy?: DataSourcePropPivotBy<T>;
|
|
46
|
-
filterValue?: DataSourcePropFilterValue<T>;
|
|
47
|
-
|
|
48
|
-
groupRowsState?: DataSourcePropGroupRowsStateObject<any>;
|
|
49
|
-
|
|
50
|
-
lazyLoadBatchSize?: number;
|
|
51
|
-
lazyLoadStartIndex?: number;
|
|
52
|
-
groupKeys?: any[];
|
|
53
|
-
|
|
54
|
-
append?: boolean;
|
|
55
|
-
|
|
56
|
-
aggregationReducers?: DataSourcePropAggregationReducers<T>;
|
|
57
|
-
|
|
58
|
-
livePaginationCursor?: DataSourceLivePaginationCursorValue;
|
|
59
|
-
__cursorId?: DataSourceSetupState<T>['cursorId'];
|
|
60
|
-
|
|
61
|
-
changes?: DataSourceDataParamsChanges<T>;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type DataSourceDataParamsChanges<T> = Partial<
|
|
65
|
-
Record<
|
|
66
|
-
keyof Omit<DataSourceDataParams<T>, 'originalDataArray' | 'changes'>,
|
|
67
|
-
true
|
|
68
|
-
>
|
|
69
|
-
>;
|
|
70
|
-
|
|
71
|
-
export type DataSourceSingleSortInfo<T> = Omit<MultisortInfo<T>, 'field'> & {
|
|
72
|
-
field?: keyof T | (keyof T)[];
|
|
73
|
-
id?: string;
|
|
74
|
-
};
|
|
75
|
-
export type DataSourceGroupBy<T> = GroupBy<T, any>;
|
|
76
|
-
export type DataSourcePivotBy<T> = PivotBy<T, any>;
|
|
77
|
-
|
|
78
|
-
export type DataSourceSortInfo<T> =
|
|
79
|
-
| null
|
|
80
|
-
| DataSourceSingleSortInfo<T>
|
|
81
|
-
| DataSourceSingleSortInfo<T>[];
|
|
82
|
-
|
|
83
|
-
export type DataSourcePropSortInfo<T> = DataSourceSortInfo<T>;
|
|
84
|
-
|
|
85
|
-
export type DataSourceRemoteData<T> = {
|
|
86
|
-
data: T[] | LazyGroupDataItem<T>[];
|
|
87
|
-
mappings?: DataSourceMappings;
|
|
88
|
-
cache?: boolean;
|
|
89
|
-
error?: string;
|
|
90
|
-
totalCount?: number;
|
|
91
|
-
totalCountUnfiltered?: number;
|
|
92
|
-
livePaginationCursor?: DataSourceLivePaginationCursorValue;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export type DataSourceData<T> =
|
|
96
|
-
| T[]
|
|
97
|
-
| DataSourceRemoteData<T>
|
|
98
|
-
| Promise<T[] | DataSourceRemoteData<T>>
|
|
99
|
-
| ((
|
|
100
|
-
dataInfo: DataSourceDataParams<T>,
|
|
101
|
-
) => T[] | Promise<T[] | DataSourceRemoteData<T>>);
|
|
102
|
-
|
|
103
|
-
export type DataSourceGroupRowsList<KeyType> = true | KeyType[][];
|
|
104
|
-
|
|
105
|
-
export type DataSourcePropGroupRowsStateObject<KeyType> = {
|
|
106
|
-
expandedRows: DataSourceGroupRowsList<KeyType>;
|
|
107
|
-
collapsedRows: DataSourceGroupRowsList<KeyType>;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export type DataSourcePropGroupBy<T> = DataSourceGroupBy<T>[];
|
|
111
|
-
export type DataSourcePropPivotBy<T> = DataSourcePivotBy<T>[];
|
|
112
|
-
|
|
113
|
-
export interface DataSourceMappedState<T> {
|
|
114
|
-
aggregationReducers?: DataSourceProps<T>['aggregationReducers'];
|
|
115
|
-
livePagination: DataSourceProps<T>['livePagination'];
|
|
116
|
-
isRowSelected: DataSourceProps<T>['isRowSelected'];
|
|
117
|
-
|
|
118
|
-
lazyLoad: DataSourceProps<T>['lazyLoad'];
|
|
119
|
-
useGroupKeysForMultiRowSelection: NonUndefined<
|
|
120
|
-
DataSourceProps<T>['useGroupKeysForMultiRowSelection']
|
|
121
|
-
>;
|
|
122
|
-
|
|
123
|
-
onDataParamsChange: DataSourceProps<T>['onDataParamsChange'];
|
|
124
|
-
data: DataSourceProps<T>['data'];
|
|
125
|
-
sortMode: DataSourceProps<T>['sortMode'];
|
|
126
|
-
filterFunction: DataSourceProps<T>['filterFunction'];
|
|
127
|
-
filterValue: DataSourceProps<T>['filterValue'];
|
|
128
|
-
filterTypes: NonUndefined<DataSourceProps<T>['filterTypes']>;
|
|
129
|
-
primaryKey: DataSourceProps<T>['primaryKey'];
|
|
130
|
-
filterDelay: NonUndefined<DataSourceProps<T>['filterDelay']>;
|
|
131
|
-
groupBy: NonUndefined<DataSourceProps<T>['groupBy']>;
|
|
132
|
-
|
|
133
|
-
pivotBy: DataSourceProps<T>['pivotBy'];
|
|
134
|
-
loading: NonUndefined<DataSourceProps<T>['loading']>;
|
|
135
|
-
sortTypes: NonUndefined<DataSourceProps<T>['sortTypes']>;
|
|
136
|
-
collapseGroupRowsOnDataFunctionChange: NonUndefined<
|
|
137
|
-
DataSourceProps<T>['collapseGroupRowsOnDataFunctionChange']
|
|
138
|
-
>;
|
|
139
|
-
sortInfo: DataSourceSingleSortInfo<T>[] | null;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export type DataSourceAggregationReducer<T, AggregationResultType> = {
|
|
143
|
-
name?: string;
|
|
144
|
-
field?: keyof T;
|
|
145
|
-
initialValue?: AggregationResultType;
|
|
146
|
-
getter?: (data: T) => any;
|
|
147
|
-
reducer:
|
|
148
|
-
| string
|
|
149
|
-
| ((
|
|
150
|
-
accumulator: any,
|
|
151
|
-
value: any,
|
|
152
|
-
data: T,
|
|
153
|
-
index: number,
|
|
154
|
-
groupKeys: any[] | undefined,
|
|
155
|
-
) => AggregationResultType | any);
|
|
156
|
-
done?: (
|
|
157
|
-
accumulatedValue: AggregationResultType | any,
|
|
158
|
-
array: T[],
|
|
159
|
-
) => AggregationResultType;
|
|
160
|
-
pivotColumn?:
|
|
161
|
-
| ColumnTypeWithInherit<Partial<InfiniteTableColumn<T>>>
|
|
162
|
-
| (({
|
|
163
|
-
column,
|
|
164
|
-
}: {
|
|
165
|
-
column: InfiniteTablePivotFinalColumnVariant<T>;
|
|
166
|
-
}) => ColumnTypeWithInherit<Partial<InfiniteTablePivotColumn<T>>>);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
export type ColumnTypeWithInherit<COL_TYPE> = COL_TYPE & {
|
|
170
|
-
inheritFromColumn?: string | boolean;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
export type DataSourceMappings = Record<'totals' | 'values', string>;
|
|
174
|
-
|
|
175
|
-
export type LazyGroupDataItem<DataType> = {
|
|
176
|
-
data: Partial<DataType>;
|
|
177
|
-
keys: any[];
|
|
178
|
-
aggregations?: Record<string, any>;
|
|
179
|
-
dataset?: DataSourceRemoteData<DataType>;
|
|
180
|
-
totalChildrenCount?: number;
|
|
181
|
-
pivot?: {
|
|
182
|
-
values: Record<string, any>;
|
|
183
|
-
totals?: Record<string, any>;
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export type LazyRowInfoGroup<DataType> = {
|
|
188
|
-
/**
|
|
189
|
-
* Those are direct children of the current lazy group row
|
|
190
|
-
*/
|
|
191
|
-
children: LazyGroupDataItem<DataType>[];
|
|
192
|
-
childrenLoading: boolean;
|
|
193
|
-
childrenAvailable: boolean;
|
|
194
|
-
cache: boolean;
|
|
195
|
-
totalCount: number;
|
|
196
|
-
// TODO make sure this is properly implemented
|
|
197
|
-
totalCountUnfiltered: number;
|
|
198
|
-
error?: string;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
export type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<
|
|
202
|
-
KeyType,
|
|
203
|
-
LazyRowInfoGroup<DataType>
|
|
204
|
-
>;
|
|
205
|
-
|
|
206
|
-
export interface DataSourceSetupState<T> {
|
|
207
|
-
indexer: Indexer<T, any>;
|
|
208
|
-
unfilteredCount: number;
|
|
209
|
-
filteredCount: number;
|
|
210
|
-
lazyLoadCacheOfLoadedBatches: DeepMap<string, true>;
|
|
211
|
-
pivotMappings?: DataSourceMappings;
|
|
212
|
-
propsCache: Map<keyof DataSourceProps<T>, WeakMap<any, any>>;
|
|
213
|
-
showSeparatePivotColumnForSingleAggregation: boolean;
|
|
214
|
-
dataParams?: DataSourceDataParams<T>;
|
|
215
|
-
originalLazyGroupData: LazyGroupDataDeepMap<T>;
|
|
216
|
-
originalLazyGroupDataChangeDetect: number | string;
|
|
217
|
-
scrollStopDelayUpdatedByTable: number;
|
|
218
|
-
|
|
219
|
-
notifyScrollbarsChange: SubscriptionCallback<Scrollbars>;
|
|
220
|
-
notifyScrollStop: SubscriptionCallback<ScrollStopInfo>;
|
|
221
|
-
notifyRenderRangeChange: SubscriptionCallback<RenderRange>;
|
|
222
|
-
originalDataArray: T[];
|
|
223
|
-
lastFilterDataArray?: T[];
|
|
224
|
-
lastSortDataArray?: T[];
|
|
225
|
-
lastGroupDataArray?: InfiniteTableRowInfo<T>[];
|
|
226
|
-
dataArray: InfiniteTableRowInfo<T>[];
|
|
227
|
-
groupDeepMap?: DeepMap<GroupKeyType, DeepMapGroupValueType<T, any>>;
|
|
228
|
-
groupRowsIndexesInDataArray?: number[];
|
|
229
|
-
reducerResults?: Record<string, AggregationReducerResult>;
|
|
230
|
-
allRowsSelected: boolean;
|
|
231
|
-
// selectedRowCount: number;
|
|
232
|
-
someRowsSelected: boolean;
|
|
233
|
-
pivotTotalColumnPosition: InfiniteTablePropPivotTotalColumnPosition;
|
|
234
|
-
pivotGrandTotalColumnPosition: InfiniteTablePropPivotGrandTotalColumnPosition;
|
|
235
|
-
cursorId: number | symbol | DataSourceLivePaginationCursorValue;
|
|
236
|
-
|
|
237
|
-
updatedAt: number;
|
|
238
|
-
reducedAt: number;
|
|
239
|
-
groupedAt: number;
|
|
240
|
-
sortedAt: number;
|
|
241
|
-
filteredAt: number;
|
|
242
|
-
generateGroupRows: boolean;
|
|
243
|
-
|
|
244
|
-
postFilterDataArray?: T[];
|
|
245
|
-
postSortDataArray?: T[];
|
|
246
|
-
postGroupDataArray?: InfiniteTableRowInfo<T>[];
|
|
247
|
-
pivotColumns?: Map<string, InfiniteTableColumn<T>>;
|
|
248
|
-
pivotColumnGroups?: Map<string, InfiniteTableColumnGroup>;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export type DataSourcePropAggregationReducers<T> = Record<
|
|
252
|
-
string,
|
|
253
|
-
DataSourceAggregationReducer<T, any>
|
|
254
|
-
>;
|
|
255
|
-
export type DataSourcePropMultiRowSelectionChangeParamType =
|
|
256
|
-
RowSelectionStateObject;
|
|
257
|
-
|
|
258
|
-
export type DataSourcePropRowSelection =
|
|
259
|
-
| DataSourcePropRowSelection_MultiRow
|
|
260
|
-
| DataSourcePropRowSelection_SingleRow;
|
|
261
|
-
|
|
262
|
-
export type DataSourcePropRowSelection_MultiRow = RowSelectionStateObject;
|
|
263
|
-
export type DataSourcePropRowSelection_SingleRow = null | string | number;
|
|
264
|
-
|
|
265
|
-
export type DataSourcePropCellSelection = any;
|
|
266
|
-
|
|
267
|
-
export type DataSourcePropSelectionMode =
|
|
268
|
-
| false
|
|
269
|
-
| 'single-cell'
|
|
270
|
-
| 'single-row'
|
|
271
|
-
| 'multi-cell'
|
|
272
|
-
| 'multi-row';
|
|
273
|
-
|
|
274
|
-
// export type DataSourcePropOnRowSelectionChange_MultiRow = (params: {
|
|
275
|
-
// rowSelection: DataSourcePropRowSelection_MultiRow;
|
|
276
|
-
// rowSelectionState: RowSelectionState;
|
|
277
|
-
// selectionMode: 'multi-row';
|
|
278
|
-
// }) => void;
|
|
279
|
-
// export type DataSourcePropOnRowSelectionChange_SingleRow = (params: {
|
|
280
|
-
// rowSelection: DataSourcePropRowSelection_SingleRow;
|
|
281
|
-
// selectionMode: 'single-row';
|
|
282
|
-
// }) => void;
|
|
283
|
-
|
|
284
|
-
export type DataSourcePropOnRowSelectionChange_MultiRow = (
|
|
285
|
-
rowSelection: DataSourcePropRowSelection_MultiRow,
|
|
286
|
-
selectionMode: 'multi-row',
|
|
287
|
-
) => void;
|
|
288
|
-
export type DataSourcePropOnRowSelectionChange_SingleRow = (
|
|
289
|
-
rowSelection: DataSourcePropRowSelection_SingleRow,
|
|
290
|
-
selectionMode: 'single-row',
|
|
291
|
-
) => void;
|
|
292
|
-
|
|
293
|
-
export type DataSourcePropOnRowSelectionChange =
|
|
294
|
-
| DataSourcePropOnRowSelectionChange_SingleRow
|
|
295
|
-
| DataSourcePropOnRowSelectionChange_MultiRow;
|
|
296
|
-
export type DataSourcePropOnCellSelectionChange = (
|
|
297
|
-
cellSelectionParams: any,
|
|
298
|
-
) => void;
|
|
299
|
-
|
|
300
|
-
export type DataSourcePropIsRowSelected<T> = (
|
|
301
|
-
rowInfo: InfiniteTableRowInfo<T>,
|
|
302
|
-
rowSelectionState: RowSelectionState,
|
|
303
|
-
selectionMode: 'multi-row',
|
|
304
|
-
) => boolean | null;
|
|
305
|
-
|
|
306
|
-
export type DataSourceProps<T> = {
|
|
307
|
-
children:
|
|
308
|
-
| React.ReactNode
|
|
309
|
-
| ((contextData: DataSourceState<T>) => React.ReactNode);
|
|
310
|
-
primaryKey: keyof T | ((data: T) => string);
|
|
311
|
-
fields?: (keyof T)[];
|
|
312
|
-
|
|
313
|
-
data: DataSourceData<T>;
|
|
314
|
-
|
|
315
|
-
selectionMode?: DataSourcePropSelectionMode;
|
|
316
|
-
useGroupKeysForMultiRowSelection?: boolean;
|
|
317
|
-
|
|
318
|
-
rowSelection?:
|
|
319
|
-
| DataSourcePropRowSelection_MultiRow
|
|
320
|
-
| DataSourcePropRowSelection_SingleRow;
|
|
321
|
-
defaultRowSelection?:
|
|
322
|
-
| DataSourcePropRowSelection_MultiRow
|
|
323
|
-
| DataSourcePropRowSelection_SingleRow;
|
|
324
|
-
|
|
325
|
-
cellSelection?: DataSourcePropCellSelection;
|
|
326
|
-
defaultCellSelection?: DataSourcePropCellSelection;
|
|
327
|
-
onCellSelectionChange?: DataSourcePropOnCellSelectionChange;
|
|
328
|
-
|
|
329
|
-
isRowSelected?: DataSourcePropIsRowSelected<T>;
|
|
330
|
-
|
|
331
|
-
lazyLoad?: boolean | { batchSize?: number };
|
|
332
|
-
|
|
333
|
-
// other properties, each with controlled and uncontrolled variant
|
|
334
|
-
loading?: boolean;
|
|
335
|
-
defaultLoading?: boolean;
|
|
336
|
-
onLoadingChange?: (loading: boolean) => void;
|
|
337
|
-
|
|
338
|
-
pivotBy?: DataSourcePropPivotBy<T>;
|
|
339
|
-
defaultPivotBy?: DataSourcePropPivotBy<T>;
|
|
340
|
-
onPivotByChange?: (pivotBy: DataSourcePropPivotBy<T>) => void;
|
|
341
|
-
|
|
342
|
-
aggregationReducers?: DataSourcePropAggregationReducers<T>;
|
|
343
|
-
defaultAggregationReducers?: DataSourcePropAggregationReducers<T>;
|
|
344
|
-
|
|
345
|
-
groupBy?: DataSourcePropGroupBy<T>;
|
|
346
|
-
defaultGroupBy?: DataSourcePropGroupBy<T>;
|
|
347
|
-
onGroupByChange?: (groupBy: DataSourcePropGroupBy<T>) => void;
|
|
348
|
-
|
|
349
|
-
groupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<any>;
|
|
350
|
-
defaultGroupRowsState?:
|
|
351
|
-
| GroupRowsState
|
|
352
|
-
| DataSourcePropGroupRowsStateObject<keyof T>;
|
|
353
|
-
onGroupRowsStateChange?: (groupRowsState: GroupRowsState) => void;
|
|
354
|
-
|
|
355
|
-
collapseGroupRowsOnDataFunctionChange?: boolean;
|
|
356
|
-
|
|
357
|
-
sortInfo?: DataSourceSortInfo<T>;
|
|
358
|
-
defaultSortInfo?: DataSourceSortInfo<T>;
|
|
359
|
-
onSortInfoChange?:
|
|
360
|
-
| ((sortInfo: DataSourceSingleSortInfo<T> | null) => void)
|
|
361
|
-
| ((sortInfo: DataSourceSingleSortInfo<T>[]) => void);
|
|
362
|
-
|
|
363
|
-
onDataParamsChange?: (dataParamsChange: DataSourceDataParams<T>) => void;
|
|
364
|
-
livePagination?: boolean;
|
|
365
|
-
livePaginationCursor?: DataSourcePropLivePaginationCursor<T>;
|
|
366
|
-
onLivePaginationCursorChange?: (
|
|
367
|
-
livePaginationCursor: DataSourceLivePaginationCursorValue,
|
|
368
|
-
) => void;
|
|
369
|
-
|
|
370
|
-
filterFunction?: DataSourcePropFilterFunction<T>;
|
|
371
|
-
|
|
372
|
-
sortMode?: 'local' | 'remote';
|
|
373
|
-
filterMode?: 'local' | 'remote';
|
|
374
|
-
filterValue?: DataSourcePropFilterValue<T>;
|
|
375
|
-
defaultFilterValue?: DataSourcePropFilterValue<T>;
|
|
376
|
-
onFilterValueChange?: (filterValue: DataSourcePropFilterValue<T>) => void;
|
|
377
|
-
|
|
378
|
-
filterDelay?: number;
|
|
379
|
-
filterTypes?: DataSourcePropFilterTypes<T>;
|
|
380
|
-
|
|
381
|
-
sortTypes?: DataSourcePropSortTypes;
|
|
382
|
-
} & (
|
|
383
|
-
| {
|
|
384
|
-
selectionMode?: 'multi-row';
|
|
385
|
-
rowSelection?: DataSourcePropRowSelection_MultiRow;
|
|
386
|
-
defaultRowSelection?: DataSourcePropRowSelection_MultiRow;
|
|
387
|
-
onRowSelectionChange?: DataSourcePropOnRowSelectionChange_MultiRow;
|
|
388
|
-
}
|
|
389
|
-
| {
|
|
390
|
-
selectionMode?: 'single-row';
|
|
391
|
-
rowSelection?: DataSourcePropRowSelection_SingleRow;
|
|
392
|
-
defaultRowSelection?: DataSourcePropRowSelection_SingleRow;
|
|
393
|
-
onRowSelectionChange?: DataSourcePropOnRowSelectionChange_SingleRow;
|
|
394
|
-
}
|
|
395
|
-
| {
|
|
396
|
-
selectionMode?: 'single-cell';
|
|
397
|
-
}
|
|
398
|
-
| {
|
|
399
|
-
selectionMode?: 'multi-cell';
|
|
400
|
-
}
|
|
401
|
-
| {
|
|
402
|
-
selectionMode?: false;
|
|
403
|
-
}
|
|
404
|
-
);
|
|
405
|
-
|
|
406
|
-
export type DataSourcePropSortTypes = Record<
|
|
407
|
-
string,
|
|
408
|
-
(first: any, second: any) => number
|
|
409
|
-
>;
|
|
410
|
-
|
|
411
|
-
export type DataSourcePropFilterTypes<T> = Record<
|
|
412
|
-
string,
|
|
413
|
-
DataSourceFilterType<T>
|
|
414
|
-
>;
|
|
415
|
-
|
|
416
|
-
export type DataSourceFilterFunctionParam<T> = {
|
|
417
|
-
data: T;
|
|
418
|
-
index: number;
|
|
419
|
-
dataArray: T[];
|
|
420
|
-
primaryKey: any;
|
|
421
|
-
};
|
|
422
|
-
export type DataSourcePropFilterFunction<T> = (
|
|
423
|
-
filterParam: DataSourceFilterFunctionParam<T>,
|
|
424
|
-
) => boolean;
|
|
425
|
-
|
|
426
|
-
export type DataSourcePropFilterValue<T> = DataSourceFilterValueItem<T>[];
|
|
427
|
-
|
|
428
|
-
export type DataSourceFilterValueItem<T> = DiscriminatedUnion<
|
|
429
|
-
{
|
|
430
|
-
field: keyof T;
|
|
431
|
-
},
|
|
432
|
-
{ id: string }
|
|
433
|
-
> & {
|
|
434
|
-
valueGetter?: DataSourceFilterValueItemValueGetter<T>;
|
|
435
|
-
filterValue: any;
|
|
436
|
-
disabled?: boolean;
|
|
437
|
-
filterType: string;
|
|
438
|
-
operator: string;
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
export type DataSourceFilterValueItemValueGetter<T> = (
|
|
442
|
-
param: DataSourceFilterFunctionParam<T>,
|
|
443
|
-
) => any;
|
|
444
|
-
|
|
445
|
-
export type DataSourceFilterType<T> = {
|
|
446
|
-
emptyValues: Set<any>;
|
|
447
|
-
label?: string;
|
|
448
|
-
defaultOperator: string;
|
|
449
|
-
operators: DataSourceFilterOperator<T>[];
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
export type DataSourceFilterOperator<T> = {
|
|
453
|
-
name: string;
|
|
454
|
-
label?: string;
|
|
455
|
-
fn: DataSourceFilterOperatorFunction<T>;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
export type DataSourceFilterOperatorFunction<T> = (
|
|
459
|
-
filterOperatorFunctionParam: DataSourceFilterOperatorFunctionParam<T>,
|
|
460
|
-
) => boolean;
|
|
461
|
-
|
|
462
|
-
export type DataSourceFilterOperatorFunctionParam<T> = {
|
|
463
|
-
currentValue: any;
|
|
464
|
-
filterValue: any;
|
|
465
|
-
emptyValues: Set<any>;
|
|
466
|
-
} & DataSourceFilterFunctionParam<T>;
|
|
467
|
-
|
|
468
|
-
export type DataSourcePropLivePaginationCursor<T> =
|
|
469
|
-
| DataSourceLivePaginationCursorValue
|
|
470
|
-
| DataSourceLivePaginationCursorFn<T>;
|
|
471
|
-
|
|
472
|
-
export type DataSourceLivePaginationCursorFn<T> = (
|
|
473
|
-
params: DataSourceLivePaginationCursorParams<T>,
|
|
474
|
-
) => DataSourceLivePaginationCursorValue;
|
|
475
|
-
export type DataSourceLivePaginationCursorParams<T> = {
|
|
476
|
-
array: T[];
|
|
477
|
-
lastItem: T | Partial<T> | null;
|
|
478
|
-
length: number;
|
|
479
|
-
};
|
|
480
|
-
export type DataSourceLivePaginationCursorValue = string | number | null;
|
|
481
|
-
|
|
482
|
-
// export type DataSourceState<T> = DataSourceSetupState<T> &
|
|
483
|
-
// DataSourceDerivedState<T> &
|
|
484
|
-
// DataSourceMappedState<T>;
|
|
485
|
-
|
|
486
|
-
export interface DataSourceState<T>
|
|
487
|
-
extends DataSourceSetupState<T>,
|
|
488
|
-
DataSourceDerivedState<T>,
|
|
489
|
-
DataSourceMappedState<T> {}
|
|
490
|
-
|
|
491
|
-
export type DataSourceDerivedState<T> = {
|
|
492
|
-
// TODO pass as second arg the index
|
|
493
|
-
toPrimaryKey: (data: T) => any;
|
|
494
|
-
operatorsByFilterType: Record<
|
|
495
|
-
string,
|
|
496
|
-
Record<string, DataSourceFilterOperator<T>>
|
|
497
|
-
>;
|
|
498
|
-
|
|
499
|
-
filterMode: NonUndefined<DataSourceProps<T>['filterMode']>;
|
|
500
|
-
groupRowsState: GroupRowsState<T>;
|
|
501
|
-
multiSort: boolean;
|
|
502
|
-
controlledSort: boolean;
|
|
503
|
-
controlledFilter: boolean;
|
|
504
|
-
livePaginationCursor?: DataSourceLivePaginationCursorValue;
|
|
505
|
-
lazyLoadBatchSize?: number;
|
|
506
|
-
rowSelection: RowSelectionState | null | number | string;
|
|
507
|
-
selectionMode: NonUndefined<DataSourceProps<T>['selectionMode']>;
|
|
508
|
-
};
|
|
509
|
-
// & (
|
|
510
|
-
// | {
|
|
511
|
-
// rowSelection: RowSelectionState;
|
|
512
|
-
// selectionMode: 'multi-row';
|
|
513
|
-
// }
|
|
514
|
-
// | {
|
|
515
|
-
// rowSelection: null | number | string;
|
|
516
|
-
// selectionMode: 'single-row';
|
|
517
|
-
// }
|
|
518
|
-
// | {
|
|
519
|
-
// selectionMode: false | 'single-cell' | 'multi-cell';
|
|
520
|
-
// rowSelection: null;
|
|
521
|
-
// }
|
|
522
|
-
// );
|
|
523
|
-
|
|
524
|
-
export type DataSourceComponentActions<T> = ComponentStateActions<
|
|
525
|
-
DataSourceState<T>
|
|
526
|
-
>;
|
|
527
|
-
|
|
528
|
-
export interface DataSourceContextValue<T> {
|
|
529
|
-
getState: () => DataSourceState<T>;
|
|
530
|
-
componentState: DataSourceState<T>;
|
|
531
|
-
componentActions: DataSourceComponentActions<T>;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
export enum DataSourceActionType {
|
|
535
|
-
INIT = 'INIT',
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
export interface DataSourceAction<T> {
|
|
539
|
-
type: DataSourceActionType;
|
|
540
|
-
payload: T;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
export interface DataSourceReducer<T> {
|
|
544
|
-
(
|
|
545
|
-
state: DataSourceState<T>,
|
|
546
|
-
action: DataSourceAction<any>,
|
|
547
|
-
): DataSourceState<T>;
|
|
548
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { RefObject, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { HeadlessTableProps, useMatrixBrain } from '.';
|
|
5
|
-
import { join } from '../../utils/join';
|
|
6
|
-
import {
|
|
7
|
-
boxSizingBorderBox,
|
|
8
|
-
display,
|
|
9
|
-
position,
|
|
10
|
-
transformTranslateZero,
|
|
11
|
-
} from '../InfiniteTable/utilities.css';
|
|
12
|
-
import { useResizeObserver } from '../ResizeObserver';
|
|
13
|
-
import { ScrollPosition } from '../types/ScrollPosition';
|
|
14
|
-
import { Size } from '../types/Size';
|
|
15
|
-
import { getScrollbarWidth } from '../utils/getScrollbarWidth';
|
|
16
|
-
import { MatrixBrain } from '../VirtualBrain/MatrixBrain';
|
|
17
|
-
import { SpacePlaceholder } from '../VirtualList/SpacePlaceholder';
|
|
18
|
-
import { scrollTransformTargetCls } from '../VirtualList/VirtualList.css';
|
|
19
|
-
import { VirtualScrollContainer } from '../VirtualScrollContainer';
|
|
20
|
-
import { RawTable } from './RawTable';
|
|
21
|
-
import { TableRenderCellFnParam } from './ReactHeadlessTableRenderer';
|
|
22
|
-
|
|
23
|
-
export type HeadlessTableWithPinnedContainersProps = {} & HeadlessTableProps;
|
|
24
|
-
|
|
25
|
-
const ONLY_VERTICAL_SCROLL = {
|
|
26
|
-
horizontal: false,
|
|
27
|
-
vertical: true,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const measureSizeStyle: React.CSSProperties = {
|
|
31
|
-
position: 'absolute',
|
|
32
|
-
inset: 0, // this is same as top,left,bottom,right:0
|
|
33
|
-
pointerEvents: 'none',
|
|
34
|
-
zIndex: -1_000,
|
|
35
|
-
};
|
|
36
|
-
export function HeadlessTableWithPinnedContainersFn(
|
|
37
|
-
props: HeadlessTableWithPinnedContainersProps,
|
|
38
|
-
) {
|
|
39
|
-
const { brain } = props;
|
|
40
|
-
|
|
41
|
-
const domRef = useRef<HTMLDivElement>(null);
|
|
42
|
-
const measureSizeRef = useRef<HTMLDivElement>(null);
|
|
43
|
-
|
|
44
|
-
const [measureSize, setMeasureSize] = useState<Size | null>(null);
|
|
45
|
-
const size = measureSize || { width: props.width, height: props.height };
|
|
46
|
-
|
|
47
|
-
useMatrixBrain(
|
|
48
|
-
brain,
|
|
49
|
-
{
|
|
50
|
-
...props,
|
|
51
|
-
height: size.height,
|
|
52
|
-
width: size.width,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
fixedColsStart: props.fixedColsStart,
|
|
56
|
-
fixedColsEnd: props.fixedColsEnd,
|
|
57
|
-
fixedRowsStart: props.fixedRowsStart,
|
|
58
|
-
fixedRowsEnd: props.fixedRowsEnd,
|
|
59
|
-
},
|
|
60
|
-
);
|
|
61
|
-
useResizeObserver(measureSizeRef, setMeasureSize);
|
|
62
|
-
const onContainerScroll = useCallback(
|
|
63
|
-
(scrollPos: ScrollPosition) => {
|
|
64
|
-
brain.setScrollPosition({
|
|
65
|
-
scrollTop: scrollPos.scrollTop,
|
|
66
|
-
scrollLeft: 0,
|
|
67
|
-
});
|
|
68
|
-
domRef.current!.style.transform = `translate3d(${-scrollPos.scrollLeft}px, ${-scrollPos.scrollTop}px, 0px)`;
|
|
69
|
-
},
|
|
70
|
-
[brain],
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const [scrollSize, setTotalScrollSize] = useState({
|
|
74
|
-
width: 0,
|
|
75
|
-
height: 0,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
const removeOnRenderCount = brain.onRenderCountChange(() => {
|
|
80
|
-
setTotalScrollSize(brain.getTotalSize());
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
setTotalScrollSize(brain.getTotalSize());
|
|
84
|
-
|
|
85
|
-
return () => {
|
|
86
|
-
removeOnRenderCount();
|
|
87
|
-
};
|
|
88
|
-
}, [brain]);
|
|
89
|
-
|
|
90
|
-
// const hasHorizontalScrollbar =
|
|
91
|
-
// computedUnpinnedColumnsWidth >
|
|
92
|
-
// bodySize.width -
|
|
93
|
-
// computedPinnedStartColumnsWidth -
|
|
94
|
-
// computedPinnedEndColumnsWidth;
|
|
95
|
-
|
|
96
|
-
// const reservedContentHeight =
|
|
97
|
-
// brain.getTotalSize().height +
|
|
98
|
-
// (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
99
|
-
return (
|
|
100
|
-
<div
|
|
101
|
-
className={join(
|
|
102
|
-
transformTranslateZero,
|
|
103
|
-
position.relative,
|
|
104
|
-
boxSizingBorderBox,
|
|
105
|
-
)}
|
|
106
|
-
style={{
|
|
107
|
-
width: props.width,
|
|
108
|
-
height: props.height,
|
|
109
|
-
}}
|
|
110
|
-
>
|
|
111
|
-
<VirtualScrollContainer
|
|
112
|
-
scrollable={ONLY_VERTICAL_SCROLL}
|
|
113
|
-
onContainerScroll={onContainerScroll}
|
|
114
|
-
ref={props.scrollerDOMRef as RefObject<HTMLDivElement>}
|
|
115
|
-
>
|
|
116
|
-
<div className={display.flex}>
|
|
117
|
-
<div
|
|
118
|
-
ref={domRef}
|
|
119
|
-
className={scrollTransformTargetCls}
|
|
120
|
-
data-name="scroll-transform-target"
|
|
121
|
-
>
|
|
122
|
-
<RawTable renderCell={props.renderCell} brain={brain} />
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
<SpacePlaceholder
|
|
126
|
-
count={props.rows}
|
|
127
|
-
width={0}
|
|
128
|
-
height={scrollSize.height}
|
|
129
|
-
/>
|
|
130
|
-
{/**
|
|
131
|
-
* we need this size measurer, even though we have props.width and props.height passed down to us
|
|
132
|
-
* because this measurer also accounts for scrollbars showing/hiding which changes the
|
|
133
|
-
* dimensions of the space available for virtualization
|
|
134
|
-
*/}
|
|
135
|
-
<div ref={measureSizeRef} style={measureSizeStyle} />
|
|
136
|
-
</VirtualScrollContainer>
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export const HeadlessTableWithPinnedContainers: React.FC<HeadlessTableWithPinnedContainersProps> =
|
|
142
|
-
React.memo(HeadlessTableWithPinnedContainersFn);
|