@infinite-table/infinite-react 0.3.3 → 0.3.4
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/index.css +141 -59
- package/index.d.ts +116 -7
- package/index.esm.css +141 -59
- package/index.esm.js +956 -356
- package/index.js +957 -363
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _vanilla_extract_private from '@vanilla-extract/private';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
|
-
import { MutableRefObject, CSSProperties, HTMLProps } from 'react';
|
|
3
|
+
import { RefCallback, MutableRefObject, CSSProperties, HTMLProps } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function debounce(fn: Function, { wait }: {
|
|
6
6
|
wait: number;
|
|
@@ -303,7 +303,7 @@ declare class MatrixBrain extends Logger {
|
|
|
303
303
|
x: number;
|
|
304
304
|
y: number;
|
|
305
305
|
};
|
|
306
|
-
|
|
306
|
+
getItemOffsetFor: (itemIndex: number, direction: 'horizontal' | 'vertical') => number;
|
|
307
307
|
private computeCacheFor;
|
|
308
308
|
private getItemSizeCacheFor;
|
|
309
309
|
private computeItemSpanUpTo;
|
|
@@ -358,6 +358,89 @@ declare class MatrixBrain extends Logger {
|
|
|
358
358
|
destroy: () => void;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
declare type TableRenderCellFnParam = {
|
|
362
|
+
domRef: RefCallback<HTMLElement>;
|
|
363
|
+
rowIndex: number;
|
|
364
|
+
colIndex: number;
|
|
365
|
+
rowspan: number;
|
|
366
|
+
colspan: number;
|
|
367
|
+
hidden: boolean;
|
|
368
|
+
width: number;
|
|
369
|
+
height: number;
|
|
370
|
+
widthWithColspan: number;
|
|
371
|
+
heightWithRowspan: number;
|
|
372
|
+
rowFixed: FixedPosition;
|
|
373
|
+
colFixed: FixedPosition;
|
|
374
|
+
onMouseEnter: VoidFunction;
|
|
375
|
+
onMouseLeave: VoidFunction;
|
|
376
|
+
};
|
|
377
|
+
declare type TableRenderCellFn = (param: TableRenderCellFnParam) => Renderable;
|
|
378
|
+
declare class ReactHeadlessTableRenderer extends Logger {
|
|
379
|
+
private brain;
|
|
380
|
+
private destroyed;
|
|
381
|
+
private scrolling;
|
|
382
|
+
cellHoverClassNames: string[];
|
|
383
|
+
private itemDOMElements;
|
|
384
|
+
private itemDOMRefs;
|
|
385
|
+
private updaters;
|
|
386
|
+
private mappedCells;
|
|
387
|
+
private items;
|
|
388
|
+
private currentHoveredRow;
|
|
389
|
+
private onDestroy;
|
|
390
|
+
private hoverRowUpdatesInProgress;
|
|
391
|
+
constructor(brain: MatrixBrain);
|
|
392
|
+
getFullyVisibleRowsRange: () => {
|
|
393
|
+
start: number;
|
|
394
|
+
end: number;
|
|
395
|
+
} | null;
|
|
396
|
+
getScrollPositionForScrollRowIntoView: (rowIndex: number, config?: {
|
|
397
|
+
scrollAdjustPosition?: ScrollAdjustPosition;
|
|
398
|
+
offset?: number;
|
|
399
|
+
}) => ScrollPosition;
|
|
400
|
+
getScrollPositionForScrollColumnIntoView: (colIndex: number, config?: {
|
|
401
|
+
scrollAdjustPosition?: ScrollAdjustPosition;
|
|
402
|
+
offset?: number;
|
|
403
|
+
}) => ScrollPosition;
|
|
404
|
+
getScrollPositionForScrollCellIntoView: (rowIndex: number, colIndex: number, config?: {
|
|
405
|
+
rowScrollAdjustPosition?: ScrollAdjustPosition;
|
|
406
|
+
colScrollAdjustPosition?: ScrollAdjustPosition;
|
|
407
|
+
scrollAdjustPosition?: ScrollAdjustPosition;
|
|
408
|
+
offsetTop: number;
|
|
409
|
+
offsetLeft: number;
|
|
410
|
+
}) => ScrollPosition;
|
|
411
|
+
isRowFullyVisible: (rowIndex: number, offsetMargin?: number) => boolean;
|
|
412
|
+
isRowVisible: (rowIndex: number, offsetMargin?: number) => boolean;
|
|
413
|
+
isRowRendered: (rowIndex: number) => boolean;
|
|
414
|
+
isCellVisible: (rowIndex: number, colIndex: number) => boolean;
|
|
415
|
+
isCellFullyVisible: (rowIndex: number, colIndex: number) => boolean;
|
|
416
|
+
isColumnFullyVisible: (colIndex: number, offsetMargin?: number) => boolean;
|
|
417
|
+
isColumnVisible: (colIndex: number, offsetMargin?: number) => boolean;
|
|
418
|
+
isCellRendered: (rowIndex: number, colIndex: number) => boolean;
|
|
419
|
+
isColumnRendered: (colIndex: number) => boolean;
|
|
420
|
+
getExtraSpanCellsForRange: (range: TableRenderRange) => [number, number][];
|
|
421
|
+
renderRange: (range: TableRenderRange, { renderCell, force, onRender, }: {
|
|
422
|
+
force?: boolean | undefined;
|
|
423
|
+
renderCell: TableRenderCellFn;
|
|
424
|
+
onRender: (items: Renderable[]) => void;
|
|
425
|
+
}) => Renderable[];
|
|
426
|
+
private renderElement;
|
|
427
|
+
getFixedRanges: (currentRenderRange: TableRenderRange) => TableRenderRange[];
|
|
428
|
+
private isCellFixed;
|
|
429
|
+
private isCellCovered;
|
|
430
|
+
private renderCellAtElement;
|
|
431
|
+
private onMouseEnter;
|
|
432
|
+
private addHoverClass;
|
|
433
|
+
private onMouseLeave;
|
|
434
|
+
private removeHoverClass;
|
|
435
|
+
private updateHoverClassNamesForRow;
|
|
436
|
+
private updateElementPosition;
|
|
437
|
+
private onScrollStart;
|
|
438
|
+
private onScrollStop;
|
|
439
|
+
adjustFixedElementsOnScroll: (scrollPosition?: ScrollPosition) => void;
|
|
440
|
+
destroy: () => void;
|
|
441
|
+
reset(): void;
|
|
442
|
+
}
|
|
443
|
+
|
|
361
444
|
declare type ComponentStateContext<T_STATE, T_ACTIONS> = {
|
|
362
445
|
getComponentState: () => T_STATE;
|
|
363
446
|
componentState: T_STATE;
|
|
@@ -395,6 +478,8 @@ declare class ScrollListener {
|
|
|
395
478
|
}
|
|
396
479
|
|
|
397
480
|
interface InfiniteTableSetupState<T> {
|
|
481
|
+
renderer: ReactHeadlessTableRenderer;
|
|
482
|
+
onRenderUpdater: SubscriptionCallback<Renderable>;
|
|
398
483
|
propsCache: Map<keyof InfiniteTableProps<T>, WeakMap<any, any>>;
|
|
399
484
|
columnsWhenInlineGroupRenderStrategy?: Map<string, InfiniteTableColumn<T>>;
|
|
400
485
|
domRef: MutableRefObject<HTMLDivElement | null>;
|
|
@@ -434,6 +519,8 @@ interface InfiniteTableMappedState<T> {
|
|
|
434
519
|
onFocusWithin: InfiniteTableProps<T>['onFocusWithin'];
|
|
435
520
|
onBlurWithin: InfiniteTableProps<T>['onBlurWithin'];
|
|
436
521
|
autoSizeColumnsKey: InfiniteTableProps<T>['autoSizeColumnsKey'];
|
|
522
|
+
activeRowIndex: number | null;
|
|
523
|
+
activeCellIndex: [number, number] | null;
|
|
437
524
|
scrollStopDelay: NonUndefined<InfiniteTableProps<T>['scrollStopDelay']>;
|
|
438
525
|
onScrollToTop: InfiniteTableProps<T>['onScrollToTop'];
|
|
439
526
|
onScrollToBottom: InfiniteTableProps<T>['onScrollToBottom'];
|
|
@@ -453,7 +540,6 @@ interface InfiniteTableMappedState<T> {
|
|
|
453
540
|
pinnedEndMaxWidth: InfiniteTableProps<T>['pinnedEndMaxWidth'];
|
|
454
541
|
pivotColumn: InfiniteTableProps<T>['pivotColumn'];
|
|
455
542
|
pivotColumnGroups: InfiniteTablePropColumnGroupsMap;
|
|
456
|
-
activeIndex: NonUndefined<InfiniteTableProps<T>['activeIndex']>;
|
|
457
543
|
columnMinWidth: NonUndefined<InfiniteTableProps<T>['columnMinWidth']>;
|
|
458
544
|
columnMaxWidth: NonUndefined<InfiniteTableProps<T>['columnMaxWidth']>;
|
|
459
545
|
columnDefaultWidth: NonUndefined<InfiniteTableProps<T>['columnDefaultWidth']>;
|
|
@@ -481,6 +567,7 @@ interface InfiniteTableMappedState<T> {
|
|
|
481
567
|
interface InfiniteTableDerivedState<T> {
|
|
482
568
|
groupBy: DataSourceProps<T>['groupBy'];
|
|
483
569
|
computedColumns: Map<string, InfiniteTableColumn<T>>;
|
|
570
|
+
enableKeyboardNavigation: boolean;
|
|
484
571
|
groupRenderStrategy: NonUndefined<InfiniteTableProps<T>['groupRenderStrategy']>;
|
|
485
572
|
columnHeaderCssEllipsis: NonUndefined<InfiniteTableProps<T>['columnHeaderCssEllipsis']>;
|
|
486
573
|
columnGroupsDepthsMap: InfiniteTableColumnGroupsDepthsMap;
|
|
@@ -536,6 +623,7 @@ declare type InfiniteTableColumnType<T> = {
|
|
|
536
623
|
verticalAlign?: InfiniteTableColumn<T>['verticalAlign'];
|
|
537
624
|
cssEllipsis?: boolean;
|
|
538
625
|
headerCssEllipsis?: boolean;
|
|
626
|
+
field?: keyof T;
|
|
539
627
|
components?: InfiniteTableColumn<T>['components'];
|
|
540
628
|
renderValue?: InfiniteTableColumn<T>['renderValue'];
|
|
541
629
|
render?: InfiniteTableColumn<T>['render'];
|
|
@@ -555,6 +643,18 @@ declare type InfiniteTableImperativeApi<T> = {
|
|
|
555
643
|
setColumnOrder: (columnOrder: InfiniteTablePropColumnOrder) => void;
|
|
556
644
|
setColumnVisibility: (columnVisibility: InfiniteTablePropColumnVisibility) => void;
|
|
557
645
|
x?: T;
|
|
646
|
+
scrollRowIntoView: (rowIndex: number, config?: {
|
|
647
|
+
scrollAdjustPosition?: ScrollAdjustPosition;
|
|
648
|
+
offset?: number;
|
|
649
|
+
}) => void;
|
|
650
|
+
scrollColumnIntoView: (colId: string, config?: {
|
|
651
|
+
scrollAdjustPosition?: ScrollAdjustPosition;
|
|
652
|
+
offset?: number;
|
|
653
|
+
}) => void;
|
|
654
|
+
scrollCellIntoView: (rowIndex: number, colIdOrIndex: string | number, config?: {
|
|
655
|
+
scrollAdjustPosition?: ScrollAdjustPosition;
|
|
656
|
+
offset?: number;
|
|
657
|
+
}) => void;
|
|
558
658
|
getState: () => InfiniteTableState<T>;
|
|
559
659
|
getDataSourceState: () => DataSourceState<T>;
|
|
560
660
|
};
|
|
@@ -661,6 +761,12 @@ interface InfiniteTableProps<T> {
|
|
|
661
761
|
showZebraRows?: boolean;
|
|
662
762
|
showHoverRows?: boolean;
|
|
663
763
|
sortable?: boolean;
|
|
764
|
+
defaultActiveRowIndex?: number | null;
|
|
765
|
+
activeRowIndex?: number | null;
|
|
766
|
+
onActiveRowIndexChange?: (activeRowIndex: number) => void;
|
|
767
|
+
onActiveCellIndexChange?: (activeCellIndex: [number, number]) => void;
|
|
768
|
+
activeCellIndex?: [number, number] | null;
|
|
769
|
+
defaultActiveCellIndex?: [number, number] | null;
|
|
664
770
|
draggableColumns?: boolean;
|
|
665
771
|
header?: boolean;
|
|
666
772
|
headerOptions?: InfiniteTablePropHeaderOptions;
|
|
@@ -676,8 +782,6 @@ interface InfiniteTableProps<T> {
|
|
|
676
782
|
resizableColumns?: boolean;
|
|
677
783
|
virtualizeColumns?: InfiniteTablePropVirtualizeColumns<T>;
|
|
678
784
|
virtualizeRows?: boolean;
|
|
679
|
-
defaultActiveIndex?: number;
|
|
680
|
-
activeIndex?: number;
|
|
681
785
|
onSelfFocus?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
|
|
682
786
|
onSelfBlur?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
|
|
683
787
|
onFocusWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
|
|
@@ -711,6 +815,7 @@ declare type Scrollbars = {
|
|
|
711
815
|
vertical: boolean;
|
|
712
816
|
horizontal: boolean;
|
|
713
817
|
};
|
|
818
|
+
declare type ScrollAdjustPosition = 'start' | 'end' | 'center';
|
|
714
819
|
|
|
715
820
|
interface InfiniteTableComputedValues<T> {
|
|
716
821
|
scrollbars: {
|
|
@@ -792,6 +897,7 @@ declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTa
|
|
|
792
897
|
value: string | number | Renderable;
|
|
793
898
|
groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
|
|
794
899
|
rowIndex: number;
|
|
900
|
+
rowActive: boolean;
|
|
795
901
|
column: COL_TYPE;
|
|
796
902
|
toggleCurrentGroupRow: () => void;
|
|
797
903
|
toggleGroupRow: InfiniteTableToggleGroupRowFn;
|
|
@@ -1255,6 +1361,7 @@ declare type DataSourceSingleSortInfo<T> = MultisortInfo<T> & {
|
|
|
1255
1361
|
declare type DataSourceGroupBy<T> = GroupBy<T, any>;
|
|
1256
1362
|
declare type DataSourcePivotBy<T> = PivotBy<T, any>;
|
|
1257
1363
|
declare type DataSourceSortInfo<T> = null | DataSourceSingleSortInfo<T> | DataSourceSingleSortInfo<T>[];
|
|
1364
|
+
declare type DataSourcePropSortInfo<T> = DataSourceSortInfo<T>;
|
|
1258
1365
|
declare type DataSourceRemoteData<T> = {
|
|
1259
1366
|
data: T[] | LazyGroupDataItem<T>[];
|
|
1260
1367
|
mappings?: DataSourceMappings;
|
|
@@ -1278,6 +1385,7 @@ interface DataSourceMappedState<T> {
|
|
|
1278
1385
|
lazyLoad: DataSourceProps<T>['lazyLoad'];
|
|
1279
1386
|
onDataParamsChange: DataSourceProps<T>['onDataParamsChange'];
|
|
1280
1387
|
data: DataSourceProps<T>['data'];
|
|
1388
|
+
sortMode: DataSourceProps<T>['sortMode'];
|
|
1281
1389
|
filterFunction: DataSourceProps<T>['filterFunction'];
|
|
1282
1390
|
filterValue: DataSourceProps<T>['filterValue'];
|
|
1283
1391
|
filterTypes: NonUndefined<DataSourceProps<T>['filterTypes']>;
|
|
@@ -1399,7 +1507,8 @@ declare type DataSourceProps<T> = {
|
|
|
1399
1507
|
livePaginationCursor?: DataSourcePropLivePaginationCursor<T>;
|
|
1400
1508
|
onLivePaginationCursorChange?: (livePaginationCursor: DataSourceLivePaginationCursorValue) => void;
|
|
1401
1509
|
filterFunction?: DataSourcePropFilterFunction<T>;
|
|
1402
|
-
|
|
1510
|
+
sortMode?: 'local' | 'remote';
|
|
1511
|
+
filterMode?: 'local' | 'remote';
|
|
1403
1512
|
filterValue?: DataSourcePropFilterValue<T>;
|
|
1404
1513
|
defaultFilterValue?: DataSourcePropFilterValue<T>;
|
|
1405
1514
|
onFilterValueChange?: (filterValue: DataSourcePropFilterValue<T>) => void;
|
|
@@ -1557,4 +1666,4 @@ declare const defaultFilterEditors: InfiniteTablePropFilterEditors<unknown>;
|
|
|
1557
1666
|
declare function StringFilterEditor<T>(props: InfiniteTableFilterEditorProps<T>): JSX.Element;
|
|
1558
1667
|
declare function NumberFilterEditor<T>(props: InfiniteTableFilterEditorProps<T>): JSX.Element;
|
|
1559
1668
|
|
|
1560
|
-
export { ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceFilterFunctionParam, DataSourceFilterOperator, DataSourceFilterOperatorFunction, DataSourceFilterOperatorFunctionParam, DataSourceFilterType, DataSourceFilterValueItem, DataSourceFilterValueItemValueGetter, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropLivePaginationCursor, DataSourcePropPivotBy, DataSourcePropSortTypes, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableFilterEditorProps, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTableGroupColumnRenderIconFunction, InfiniteTableImperativeApi, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTablePropFilterEditors, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, NumberFilterEditor, Scrollbars, StringFilterEditor, debounce, defaultFilterEditors, defaultFilterTypes, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useInfiniteColumnCell, useInfiniteHeaderCell };
|
|
1669
|
+
export { ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceFilterFunctionParam, DataSourceFilterOperator, DataSourceFilterOperatorFunction, DataSourceFilterOperatorFunctionParam, DataSourceFilterType, DataSourceFilterValueItem, DataSourceFilterValueItemValueGetter, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropLivePaginationCursor, DataSourcePropPivotBy, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableFilterEditorProps, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTableGroupColumnRenderIconFunction, InfiniteTableImperativeApi, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTablePropFilterEditors, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, NumberFilterEditor, Scrollbars, StringFilterEditor, debounce, defaultFilterEditors, defaultFilterTypes, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useInfiniteColumnCell, useInfiniteHeaderCell };
|