@infinite-table/infinite-react 0.3.2 → 0.3.5

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.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;
@@ -46,45 +46,34 @@ declare class DeepMap<KeyType, ValueType> {
46
46
  private sortedIterator;
47
47
  }
48
48
 
49
- declare type SortDir = 1 | -1;
50
- declare type MultisortInfo<T> = {
51
- /**
52
- * The sorting direction
53
- */
54
- dir: SortDir;
55
- /**
56
- * a property whose value to use for sorting on the array items
57
- */
58
- field?: keyof T;
59
- /**
60
- * for now 'string' and 'number' are known types, meaning they have
61
- * sort functions already implemented
62
- */
63
- type?: string;
64
- fn?: (a: any, b: any) => number;
65
- };
66
- declare const multisort: {
67
- <T>(sortInfo: MultisortInfo<T>[], array: T[], get?: ((item: any) => T) | undefined): T[];
68
- knownTypes: {
69
- [key: string]: (first: any, second: any) => number;
70
- };
71
- };
49
+ declare class GroupRowsState<KeyType extends any = any> {
50
+ private expandedMap?;
51
+ private collapsedMap?;
52
+ private collapsedAll;
53
+ private expandedAll;
54
+ private initialState;
55
+ constructor(state: DataSourcePropGroupRowsStateObject<KeyType> | GroupRowsState<KeyType>);
56
+ getState(): DataSourcePropGroupRowsStateObject<KeyType>;
57
+ destroy(): void;
58
+ private update;
59
+ areAllCollapsed(): boolean;
60
+ areAllExpanded(): boolean;
61
+ collapseAll(): void;
62
+ expandAll(): void;
63
+ isGroupRowExpanded(keys: KeyType[]): boolean | undefined;
64
+ isGroupRowCollapsed(keys: KeyType[]): boolean;
65
+ setGroupRowExpanded(keys: KeyType[], shouldExpand: boolean): void;
66
+ collapseGroupRow(keys: KeyType[]): void;
67
+ expandGroupRow(keys: KeyType[]): void;
68
+ toggleGroupRow(keys: KeyType[]): void;
69
+ }
72
70
 
73
- declare type ComponentStateContext<T_STATE, T_ACTIONS> = {
74
- getComponentState: () => T_STATE;
75
- componentState: T_STATE;
76
- componentActions: T_ACTIONS;
77
- };
78
- declare type ComponentStateGeneratedActions<T_STATE> = {
79
- [k in keyof T_STATE]: T_STATE[k] | React.SetStateAction<T_STATE[k]>;
80
- };
81
- declare type ComponentInterceptedActions<T_STATE> = {
82
- [k in keyof T_STATE]?: (value: T_STATE[k], { actions, state, }: {
83
- actions: ComponentStateGeneratedActions<T_STATE>;
84
- state: T_STATE;
85
- }) => void | boolean;
86
- };
87
- declare type ComponentStateActions<T_STATE> = ComponentStateGeneratedActions<T_STATE>;
71
+ declare type Renderable = React$1.ReactNode | JSX.Element;
72
+
73
+ interface Size {
74
+ width: number;
75
+ height: number;
76
+ }
88
77
 
89
78
  declare enum InfiniteTableActionType {
90
79
  SET_COLUMN_SIZE = 0,
@@ -119,11 +108,6 @@ interface ScrollPosition {
119
108
  }
120
109
  declare type OnScrollFn = (scrollPosition: ScrollPosition) => void;
121
110
 
122
- interface Size {
123
- width: number;
124
- height: number;
125
- }
126
-
127
111
  declare type VoidFn = () => void;
128
112
 
129
113
  declare type FixedPosition = false | 'start' | 'end';
@@ -319,7 +303,7 @@ declare class MatrixBrain extends Logger {
319
303
  x: number;
320
304
  y: number;
321
305
  };
322
- private getItemOffsetFor;
306
+ getItemOffsetFor: (itemIndex: number, direction: 'horizontal' | 'vertical') => number;
323
307
  private computeCacheFor;
324
308
  private getItemSizeCacheFor;
325
309
  private computeItemSpanUpTo;
@@ -374,7 +358,106 @@ declare class MatrixBrain extends Logger {
374
358
  destroy: () => void;
375
359
  }
376
360
 
377
- declare type Renderable = React$1.ReactNode | JSX.Element;
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
+
444
+ declare type ComponentStateContext<T_STATE, T_ACTIONS> = {
445
+ getComponentState: () => T_STATE;
446
+ componentState: T_STATE;
447
+ componentActions: T_ACTIONS;
448
+ };
449
+ declare type ComponentStateGeneratedActions<T_STATE> = {
450
+ [k in keyof T_STATE]: T_STATE[k] | React.SetStateAction<T_STATE[k]>;
451
+ };
452
+ declare type ComponentInterceptedActions<T_STATE> = {
453
+ [k in keyof T_STATE]?: (value: T_STATE[k], { actions, state, }: {
454
+ actions: ComponentStateGeneratedActions<T_STATE>;
455
+ state: T_STATE;
456
+ }) => void | boolean;
457
+ };
458
+ declare type ComponentStateActions<T_STATE> = ComponentStateGeneratedActions<T_STATE>;
459
+
460
+ declare type NonUndefined<T> = T extends undefined ? never : T;
378
461
 
379
462
  declare type SubscriptionCallbackOnChangeFn<T> = (node: T | null) => void;
380
463
  interface SubscriptionCallback<T> {
@@ -394,16 +477,16 @@ declare class ScrollListener {
394
477
  destroy: () => void;
395
478
  }
396
479
 
397
- declare type NonUndefined<T> = T extends undefined ? never : T;
398
-
399
480
  interface InfiniteTableSetupState<T> {
481
+ renderer: ReactHeadlessTableRenderer;
482
+ onRenderUpdater: SubscriptionCallback<Renderable>;
400
483
  propsCache: Map<keyof InfiniteTableProps<T>, WeakMap<any, any>>;
401
484
  columnsWhenInlineGroupRenderStrategy?: Map<string, InfiniteTableColumn<T>>;
402
485
  domRef: MutableRefObject<HTMLDivElement | null>;
403
486
  scrollerDOMRef: MutableRefObject<HTMLDivElement | null>;
404
487
  portalDOMRef: MutableRefObject<HTMLDivElement | null>;
405
488
  onRowHeightCSSVarChange: SubscriptionCallback<number>;
406
- onHeaderHeightCSSVarChange: SubscriptionCallback<number>;
489
+ onColumnHeaderHeightCSSVarChange: SubscriptionCallback<number>;
407
490
  columnsWhenGrouping?: InfiniteTablePropColumnsMap<T>;
408
491
  bodySize: Size;
409
492
  brain: MatrixBrain;
@@ -424,6 +507,8 @@ interface InfiniteTableMappedState<T> {
424
507
  scrollTopKey: InfiniteTableProps<T>['scrollTopKey'];
425
508
  viewportReservedWidth: InfiniteTableProps<T>['viewportReservedWidth'];
426
509
  groupColumn: InfiniteTableProps<T>['groupColumn'];
510
+ headerOptions: NonUndefined<InfiniteTableProps<T>['headerOptions']>;
511
+ keyboardNavigation: NonUndefined<InfiniteTableProps<T>['keyboardNavigation']>;
427
512
  onScrollbarsChange: InfiniteTableProps<T>['onScrollbarsChange'];
428
513
  loadingText: InfiniteTableProps<T>['loadingText'];
429
514
  components: InfiniteTableProps<T>['components'];
@@ -435,11 +520,14 @@ interface InfiniteTableMappedState<T> {
435
520
  onFocusWithin: InfiniteTableProps<T>['onFocusWithin'];
436
521
  onBlurWithin: InfiniteTableProps<T>['onBlurWithin'];
437
522
  autoSizeColumnsKey: InfiniteTableProps<T>['autoSizeColumnsKey'];
523
+ activeRowIndex: InfiniteTableProps<T>['activeRowIndex'];
524
+ activeCellIndex: InfiniteTableProps<T>['activeCellIndex'];
438
525
  scrollStopDelay: NonUndefined<InfiniteTableProps<T>['scrollStopDelay']>;
439
526
  onScrollToTop: InfiniteTableProps<T>['onScrollToTop'];
440
527
  onScrollToBottom: InfiniteTableProps<T>['onScrollToBottom'];
441
528
  onScrollStop: InfiniteTableProps<T>['onScrollStop'];
442
529
  scrollToBottomOffset: InfiniteTableProps<T>['scrollToBottomOffset'];
530
+ filterEditors: NonUndefined<InfiniteTableProps<T>['filterEditors']>;
443
531
  focusedClassName: InfiniteTableProps<T>['focusedClassName'];
444
532
  focusedWithinClassName: InfiniteTableProps<T>['focusedWithinClassName'];
445
533
  focusedStyle: InfiniteTableProps<T>['focusedStyle'];
@@ -453,7 +541,6 @@ interface InfiniteTableMappedState<T> {
453
541
  pinnedEndMaxWidth: InfiniteTableProps<T>['pinnedEndMaxWidth'];
454
542
  pivotColumn: InfiniteTableProps<T>['pivotColumn'];
455
543
  pivotColumnGroups: InfiniteTablePropColumnGroupsMap;
456
- activeIndex: NonUndefined<InfiniteTableProps<T>['activeIndex']>;
457
544
  columnMinWidth: NonUndefined<InfiniteTableProps<T>['columnMinWidth']>;
458
545
  columnMaxWidth: NonUndefined<InfiniteTableProps<T>['columnMaxWidth']>;
459
546
  columnDefaultWidth: NonUndefined<InfiniteTableProps<T>['columnDefaultWidth']>;
@@ -467,7 +554,7 @@ interface InfiniteTableMappedState<T> {
467
554
  header: NonUndefined<InfiniteTableProps<T>['header']>;
468
555
  virtualizeColumns: NonUndefined<InfiniteTableProps<T>['virtualizeColumns']>;
469
556
  rowHeight: number;
470
- headerHeight: number;
557
+ columnHeaderHeight: number;
471
558
  licenseKey: NonUndefined<InfiniteTableProps<T>['licenseKey']>;
472
559
  columnVisibility: InfiniteTablePropColumnVisibility;
473
560
  columnPinning: InfiniteTablePropColumnPinningMap;
@@ -487,7 +574,7 @@ interface InfiniteTableDerivedState<T> {
487
574
  columnGroupsMaxDepth: number;
488
575
  computedColumnGroups: InfiniteTablePropColumnGroupsMap;
489
576
  rowHeightCSSVar: string;
490
- headerHeightCSSVar: string;
577
+ columnHeaderHeightCSSVar: string;
491
578
  controlledColumnVisibility: boolean;
492
579
  }
493
580
  declare type InfiniteTableActions<T> = ComponentStateActions<InfiniteTableState<T>>;
@@ -519,9 +606,13 @@ declare type InfiniteTableColumnAggregator<T, AggregationResultType> = Omit<Aggr
519
606
  declare type InfiniteTableColumnType<T> = {
520
607
  minWidth?: number;
521
608
  maxWidth?: number;
609
+ filterType?: string;
610
+ sortType?: string;
611
+ dataType?: InfiniteTableDataTypeNames;
522
612
  defaultWidth?: number;
523
613
  defaultFlex?: number;
524
614
  defaultPinned?: InfiniteTableColumnPinnedValues;
615
+ defaultFilterable?: boolean;
525
616
  defaultHiddenWhenGroupedBy?: InfiniteTableColumn<T>['defaultHiddenWhenGroupedBy'];
526
617
  header?: InfiniteTableColumn<T>['header'];
527
618
  comparer?: InfiniteTableColumn<T>['comparer'];
@@ -532,10 +623,12 @@ declare type InfiniteTableColumnType<T> = {
532
623
  verticalAlign?: InfiniteTableColumn<T>['verticalAlign'];
533
624
  cssEllipsis?: boolean;
534
625
  headerCssEllipsis?: boolean;
626
+ field?: keyof T;
535
627
  components?: InfiniteTableColumn<T>['components'];
536
628
  renderValue?: InfiniteTableColumn<T>['renderValue'];
537
629
  render?: InfiniteTableColumn<T>['render'];
538
630
  valueGetter?: InfiniteTableColumn<T>['valueGetter'];
631
+ valueFormatter?: InfiniteTableColumn<T>['valueFormatter'];
539
632
  style?: InfiniteTableColumn<T>['style'];
540
633
  };
541
634
  declare type InfiniteTablePropColumnTypes<T> = Record<'default' | string, InfiniteTableColumnType<T>>;
@@ -550,6 +643,18 @@ declare type InfiniteTableImperativeApi<T> = {
550
643
  setColumnOrder: (columnOrder: InfiniteTablePropColumnOrder) => void;
551
644
  setColumnVisibility: (columnVisibility: InfiniteTablePropColumnVisibility) => void;
552
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;
553
658
  getState: () => InfiniteTableState<T>;
554
659
  getDataSourceState: () => DataSourceState<T>;
555
660
  };
@@ -609,6 +714,15 @@ declare type ScrollStopInfo = {
609
714
  firstVisibleRowIndex: number;
610
715
  lastVisibleRowIndex: number;
611
716
  };
717
+ declare type InfiniteTablePropFilterEditors<T> = Record<string, React$1.FC<InfiniteTableFilterEditorProps<T>>>;
718
+ declare type InfiniteTableFilterEditorProps<T extends any> = {
719
+ filterType: string;
720
+ operator: string;
721
+ ariaLabel: string;
722
+ filterValue: T;
723
+ className: string;
724
+ onChange: (value: T | undefined) => void;
725
+ };
612
726
  interface InfiniteTableProps<T> {
613
727
  columns: InfiniteTablePropColumns<T>;
614
728
  pivotColumns?: InfiniteTablePropColumnsMap<T, InfiniteTablePivotColumn<T>>;
@@ -642,13 +756,21 @@ interface InfiniteTableProps<T> {
642
756
  rowHeight: number | string;
643
757
  rowStyle?: InfiniteTablePropRowStyle<T>;
644
758
  rowClassName?: InfiniteTablePropRowClassName<T>;
645
- headerHeight: number | string;
759
+ columnHeaderHeight: number | string;
646
760
  domProps?: React$1.HTMLProps<HTMLDivElement>;
647
761
  showZebraRows?: boolean;
648
762
  showHoverRows?: boolean;
649
763
  sortable?: boolean;
764
+ keyboardNavigation?: InfiniteTablePropKeyboardNavigation;
765
+ defaultActiveRowIndex?: number | null;
766
+ activeRowIndex?: number | null;
767
+ onActiveRowIndexChange?: (activeRowIndex: number) => void;
768
+ onActiveCellIndexChange?: (activeCellIndex: [number, number]) => void;
769
+ activeCellIndex?: [number, number] | null;
770
+ defaultActiveCellIndex?: [number, number] | null;
650
771
  draggableColumns?: boolean;
651
772
  header?: boolean;
773
+ headerOptions?: InfiniteTablePropHeaderOptions;
652
774
  focusedClassName?: string;
653
775
  focusedWithinClassName?: string;
654
776
  focusedStyle?: React$1.CSSProperties;
@@ -661,8 +783,6 @@ interface InfiniteTableProps<T> {
661
783
  resizableColumns?: boolean;
662
784
  virtualizeColumns?: InfiniteTablePropVirtualizeColumns<T>;
663
785
  virtualizeRows?: boolean;
664
- defaultActiveIndex?: number;
665
- activeIndex?: number;
666
786
  onSelfFocus?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
667
787
  onSelfBlur?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
668
788
  onFocusWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
@@ -676,12 +796,17 @@ interface InfiniteTableProps<T> {
676
796
  columnOrder?: InfiniteTablePropColumnOrder;
677
797
  onColumnOrderChange?: (columnOrder: InfiniteTablePropColumnOrder) => void;
678
798
  onRowHeightChange?: (rowHeight: number) => void;
799
+ filterEditors?: InfiniteTablePropFilterEditors<T>;
679
800
  onReady?: (api: InfiniteTableImperativeApi<T>) => void;
680
801
  rowProps?: React$1.HTMLProps<HTMLDivElement> | ((rowArgs: InfiniteTableRowStyleFnParams<T>) => React$1.HTMLProps<HTMLDivElement>);
681
802
  licenseKey?: string;
682
803
  scrollTopKey?: string | number;
683
804
  autoSizeColumnsKey?: InfiniteTablePropAutoSizeColumnsKey;
684
805
  }
806
+ declare type InfiniteTablePropKeyboardNavigation = 'cell' | 'row' | false;
807
+ declare type InfiniteTablePropHeaderOptions = {
808
+ alwaysReserveSpaceForSortIcon: boolean;
809
+ };
685
810
  declare type InfiniteTablePropAutoSizeColumnsKey = string | number | {
686
811
  key: string | number;
687
812
  columnsToSkip?: string[];
@@ -692,12 +817,14 @@ declare type Scrollbars = {
692
817
  vertical: boolean;
693
818
  horizontal: boolean;
694
819
  };
820
+ declare type ScrollAdjustPosition = 'start' | 'end' | 'center';
695
821
 
696
822
  interface InfiniteTableComputedValues<T> {
697
823
  scrollbars: {
698
824
  vertical: boolean;
699
825
  horizontal: boolean;
700
826
  };
827
+ showColumnFilters: boolean;
701
828
  rowspan?: MatrixBrainOptions['rowspan'];
702
829
  computedPinnedStartOverflow: boolean;
703
830
  computedPinnedEndOverflow: boolean;
@@ -728,217 +855,208 @@ interface InfiniteTableContextValue<T> {
728
855
  getState: () => InfiniteTableState<T>;
729
856
  }
730
857
 
731
- declare type RenderRange = {
732
- renderStartIndex: number;
733
- renderEndIndex: number;
858
+ declare type InfiniteTableBaseCellProps<T> = {
859
+ column: InfiniteTableComputedColumn<T>;
860
+ renderChildren: () => Renderable;
861
+ width: number;
862
+ cssEllipsis?: boolean;
863
+ contentStyle?: CSSProperties;
864
+ contentClassName?: string;
865
+ virtualized?: boolean;
866
+ skipColumnShifting?: boolean;
867
+ beforeChildren?: Renderable;
868
+ afterChildren?: Renderable;
869
+ offset?: number;
870
+ offsetProperty?: 'left' | 'right';
871
+ cssPosition?: CSSProperties['position'];
872
+ domRef?: React.RefCallback<HTMLElement>;
734
873
  };
874
+ declare type InfiniteTableCellProps<T> = ({
875
+ cellType: 'header';
876
+ } & InfiniteTableBaseCellProps<T>) | ({
877
+ cellType: 'body';
878
+ } & InfiniteTableBaseCellProps<T>);
735
879
 
736
- interface DataSourceDataParams<T> {
737
- originalDataArray: T[];
738
- sortInfo?: DataSourceSortInfo<T>;
739
- groupBy?: DataSourcePropGroupBy<T>;
740
- pivotBy?: DataSourcePropPivotBy<T>;
741
- groupRowsState?: DataSourcePropGroupRowsStateObject<any>;
742
- lazyLoadBatchSize?: number;
743
- lazyLoadStartIndex?: number;
744
- groupKeys?: any[];
745
- append?: boolean;
746
- aggregationReducers?: DataSourcePropAggregationReducers<T>;
747
- livePaginationCursor?: DataSourceLivePaginationCursorValue;
748
- __cursorId?: DataSourceSetupState<T>['cursorId'];
749
- changes?: DataSourceDataParamsChanges<T>;
750
- }
751
- declare type DataSourceDataParamsChanges<T> = Partial<Record<keyof Omit<DataSourceDataParams<T>, 'originalDataArray' | 'changes'>, true>>;
752
- declare type DataSourceSingleSortInfo<T> = MultisortInfo<T> & {
753
- field?: keyof T;
754
- id?: string;
755
- };
756
- declare type DataSourceGroupBy<T> = GroupBy<T, any>;
757
- declare type DataSourcePivotBy<T> = PivotBy<T, any>;
758
- declare type DataSourceSortInfo<T> = null | DataSourceSingleSortInfo<T> | DataSourceSingleSortInfo<T>[];
759
- declare type DataSourceRemoteData<T> = {
760
- data: T[] | LazyGroupDataItem<T>[];
761
- mappings?: DataSourceMappings;
762
- cache?: boolean;
763
- error?: string;
764
- totalCount?: number;
765
- livePaginationCursor?: DataSourceLivePaginationCursorValue;
880
+ declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
881
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
882
+ }[Keys];
883
+ declare type DiscriminatedUnion<A, B> = (A & {
884
+ [K in keyof B]?: undefined;
885
+ }) | (B & {
886
+ [K in keyof A]?: undefined;
887
+ });
888
+
889
+ declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
890
+ declare type InfiniteTableColumnHeaderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
891
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
892
+ sortTool: JSX.Element | null;
893
+ column: COL_TYPE;
894
+ columnSortInfo: DataSourceSingleSortInfo<DATA_TYPE> | null;
895
+ columnFilterValue: DataSourceFilterValueItem<DATA_TYPE> | null;
766
896
  };
767
- declare type DataSourceData<T> = T[] | DataSourceRemoteData<T> | Promise<T[] | DataSourceRemoteData<T>> | ((dataInfo: DataSourceDataParams<T>) => T[] | Promise<T[] | DataSourceRemoteData<T>>);
768
- declare type DataSourceGroupRowsList<KeyType> = true | KeyType[][];
769
- declare type DataSourcePropGroupRowsStateObject<KeyType> = {
770
- expandedRows: DataSourceGroupRowsList<KeyType>;
771
- collapsedRows: DataSourceGroupRowsList<KeyType>;
897
+ declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
898
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
899
+ value: string | number | Renderable;
900
+ groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
901
+ rowIndex: number;
902
+ rowActive: boolean;
903
+ column: COL_TYPE;
904
+ toggleCurrentGroupRow: () => void;
905
+ toggleGroupRow: InfiniteTableToggleGroupRowFn;
906
+ groupBy: DataSourceState<DATA_TYPE>['groupBy'];
907
+ pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
772
908
  };
773
- declare type DataSourcePropGroupBy<T> = DataSourceGroupBy<T>[];
774
- declare type DataSourcePropPivotBy<T> = DataSourcePivotBy<T>[];
775
- interface DataSourceMappedState<T> {
776
- aggregationReducers?: DataSourceProps<T>['aggregationReducers'];
777
- livePagination: DataSourceProps<T>['livePagination'];
778
- lazyLoad: DataSourceProps<T>['lazyLoad'];
779
- onDataParamsChange: DataSourceProps<T>['onDataParamsChange'];
780
- data: DataSourceProps<T>['data'];
781
- primaryKey: DataSourceProps<T>['primaryKey'];
782
- groupBy: NonUndefined<DataSourceProps<T>['groupBy']>;
783
- groupRowsState: GroupRowsState<T>;
784
- pivotBy: DataSourceProps<T>['pivotBy'];
785
- loading: NonUndefined<DataSourceProps<T>['loading']>;
786
- collapseGroupRowsOnDataFunctionChange: NonUndefined<DataSourceProps<T>['collapseGroupRowsOnDataFunctionChange']>;
787
- sortInfo: DataSourceSingleSortInfo<T>[] | null;
788
- }
789
- declare type DataSourceAggregationReducer<T, AggregationResultType> = {
790
- name?: string;
791
- field?: keyof T;
792
- initialValue?: AggregationResultType;
793
- getter?: (data: T) => any;
794
- reducer: string | ((accumulator: any, value: any, data: T) => AggregationResultType | any);
795
- done?: (accumulatedValue: AggregationResultType | any, array: T[]) => AggregationResultType;
796
- pivotColumn?: ColumnTypeWithInherit<Partial<InfiniteTableColumn<T>>> | (({ column, }: {
797
- column: InfiniteTablePivotFinalColumnVariant<T>;
798
- }) => ColumnTypeWithInherit<Partial<InfiniteTablePivotColumn<T>>>);
909
+ declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & InfiniteTableRowInfoDataDiscriminator<DATA_TYPE>;
910
+ declare type InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & {
911
+ rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<DATA_TYPE>;
912
+ isGroupRow: true;
913
+ data: Partial<DATA_TYPE> | null;
799
914
  };
800
- declare type ColumnTypeWithInherit<COL_TYPE> = COL_TYPE & {
801
- inheritFromColumn?: string | boolean;
915
+ declare type InfiniteTableColumnCellContextType<DATA_TYPE> = InfiniteTableColumnRenderParam<DATA_TYPE> & {};
916
+ declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> & {
917
+ collapsed: boolean;
918
+ groupIcon: Renderable;
802
919
  };
803
- declare type DataSourceMappings = Record<'totals' | 'values', string>;
804
- declare type LazyGroupDataItem<DataType> = {
805
- data: Partial<DataType>;
806
- keys: any[];
807
- aggregations?: Record<string, any>;
808
- dataset?: DataSourceRemoteData<DataType>;
809
- pivot?: {
810
- values: Record<string, any>;
811
- totals?: Record<string, any>;
812
- };
920
+ declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
921
+ declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
922
+ rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
923
+ data: DATA_TYPE | Partial<DATA_TYPE> | null;
924
+ dataArray: InfiniteTableRowInfo<DATA_TYPE>[];
925
+ rowIndex: number;
926
+ column: COL_TYPE;
813
927
  };
814
- declare type LazyRowInfoGroup<DataType> = {
928
+ declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
929
+ declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
930
+ declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderParams<T>) => Renderable;
931
+ declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
932
+ declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
933
+ declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
934
+ declare type InfiniteTableDataTypeNames = 'string' | 'number' | 'date' | string;
935
+ declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
936
+ declare type InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T> = RequireAtLeastOne<{
815
937
  /**
816
- * Those are direct children of the current lazy group row
938
+ * Determines the field property of the column.
817
939
  */
818
- children: LazyGroupDataItem<DataType>[];
819
- childrenLoading: boolean;
820
- childrenAvailable: boolean;
821
- cache: boolean;
822
- totalCount: number;
823
- error?: string;
824
- };
825
- declare type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyRowInfoGroup<DataType>>;
826
- interface DataSourceSetupState<T> {
827
- lazyLoadCacheOfLoadedBatches: DeepMap<string, true>;
828
- pivotMappings?: DataSourceMappings;
829
- propsCache: Map<keyof DataSourceProps<T>, WeakMap<any, any>>;
830
- showSeparatePivotColumnForSingleAggregation: boolean;
831
- dataParams?: DataSourceDataParams<T>;
832
- originalLazyGroupData: LazyGroupDataDeepMap<T>;
833
- originalLazyGroupDataChangeDetect: number | string;
834
- scrollStopDelayUpdatedByTable: number;
835
- notifyScrollbarsChange: SubscriptionCallback<Scrollbars>;
836
- notifyScrollStop: SubscriptionCallback<ScrollStopInfo>;
837
- notifyRenderRangeChange: SubscriptionCallback<RenderRange>;
838
- originalDataArray: T[];
839
- lastSortDataArray?: T[];
840
- lastGroupDataArray?: InfiniteTableRowInfo<T>[];
841
- dataArray: InfiniteTableRowInfo<T>[];
842
- groupDeepMap?: DeepMap<GroupKeyType, DeepMapGroupValueType<T, any>>;
843
- pivotTotalColumnPosition: InfiniteTablePropPivotTotalColumnPosition;
844
- pivotGrandTotalColumnPosition: InfiniteTablePropPivotGrandTotalColumnPosition;
845
- cursorId: number | symbol | DataSourceLivePaginationCursorValue;
846
- updatedAt: number;
847
- reducedAt: number;
848
- groupedAt: number;
849
- sortedAt: number;
850
- generateGroupRows: boolean;
851
- postSortDataArray?: T[];
852
- postGroupDataArray?: InfiniteTableRowInfo<T>[];
853
- pivotColumns?: Map<string, InfiniteTableColumn<T>>;
854
- pivotColumnGroups?: Map<string, InfiniteTableColumnGroup>;
855
- }
856
- declare type DataSourcePropAggregationReducers<T> = Record<string, DataSourceAggregationReducer<T, any>>;
857
- declare type DataSourceProps<T> = {
858
- children: React$1.ReactNode | ((contextData: DataSourceState<T>) => React$1.ReactNode);
859
- primaryKey: keyof T;
860
- fields?: (keyof T)[];
861
- data: DataSourceData<T>;
862
- lazyLoad?: boolean | {
863
- batchSize?: number;
940
+ field?: keyof T;
941
+ render?: InfiniteTableColumnRenderFunction<T>;
942
+ renderValue?: InfiniteTableColumnRenderFunction<T>;
943
+ valueGetter?: InfiniteTableColumnValueGetter<T>;
944
+ valueFormatter?: InfiniteTableColumnValueFormatter<T>;
945
+ }, 'render' | 'renderValue' | 'field' | 'valueGetter' | 'valueFormatter'>;
946
+ declare type InfiniteTableColumnStyleFnParams<T> = {
947
+ value: Renderable;
948
+ column: InfiniteTableColumn<T>;
949
+ } & InfiniteTableRowInfoDataDiscriminator<T>;
950
+ declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React.CSSProperties;
951
+ declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
952
+ declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
953
+ declare type InfiniteTableColumnClassName<T> = string | InfiniteTableColumnClassNameFn<T>;
954
+ declare type InfiniteTableColumnValueGetterParams<T> = {
955
+ data: T;
956
+ field?: keyof T;
957
+ };
958
+ declare type InfiniteTableColumnValueFormatterParams<T> = InfiniteTableRowInfoDataDiscriminator<T>;
959
+ declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = string | number | boolean | Date | null | undefined> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
960
+ declare type InfiniteTableColumnValueFormatter<T, VALUE_FORMATTER_TYPE = string | number | boolean | Date | null | undefined> = (params: InfiniteTableColumnValueFormatterParams<T>) => VALUE_FORMATTER_TYPE;
961
+ declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
962
+ declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
963
+ declare type InfiniteTableBaseColumn<T> = {
964
+ sortable?: boolean;
965
+ draggable?: boolean;
966
+ resizable?: boolean;
967
+ comparer?: InfiniteTableColumnComparer<T>;
968
+ defaultHiddenWhenGroupedBy?: '*' | keyof T | {
969
+ [k in keyof Partial<T>]: true;
970
+ };
971
+ align?: InfiniteTableColumnAlign;
972
+ verticalAlign?: InfiniteTableColumnVerticalAlign;
973
+ columnGroup?: string;
974
+ header?: InfiniteTableColumnHeader<T>;
975
+ name?: Renderable;
976
+ cssEllipsis?: boolean;
977
+ headerCssEllipsis?: boolean;
978
+ type?: InfiniteTableColumnTypeNames | InfiniteTableColumnTypeNames[] | null;
979
+ dataType?: InfiniteTableDataTypeNames;
980
+ sortType?: string;
981
+ filterType?: string;
982
+ style?: InfiniteTableColumnStyle<T>;
983
+ className?: InfiniteTableColumnClassName<T>;
984
+ rowspan?: InfiniteTableColumnRowspanFn<T>;
985
+ valueGetter?: InfiniteTableColumnValueGetter<T>;
986
+ valueFormatter?: InfiniteTableColumnValueFormatter<T>;
987
+ defaultWidth?: number;
988
+ defaultFlex?: number;
989
+ defaultFilterable?: boolean;
990
+ minWidth?: number;
991
+ maxWidth?: number;
992
+ components?: {
993
+ ColumnCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
994
+ HeaderCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
864
995
  };
865
- loading?: boolean;
866
- defaultLoading?: boolean;
867
- onLoadingChange?: (loading: boolean) => void;
868
- pivotBy?: DataSourcePropPivotBy<T>;
869
- defaultPivotBy?: DataSourcePropPivotBy<T>;
870
- onPivotByChange?: (pivotBy: DataSourcePropPivotBy<T>) => void;
871
- aggregationReducers?: DataSourcePropAggregationReducers<T>;
872
- defaultAggregationReducers?: DataSourcePropAggregationReducers<T>;
873
- groupBy?: DataSourcePropGroupBy<T>;
874
- defaultGroupBy?: DataSourcePropGroupBy<T>;
875
- onGroupByChange?: (groupBy: DataSourcePropGroupBy<T>) => void;
876
- groupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<any>;
877
- defaultGroupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<keyof T>;
878
- onGroupRowsStateChange?: (groupRowsState: GroupRowsState) => void;
879
- collapseGroupRowsOnDataFunctionChange?: boolean;
880
- sortInfo?: DataSourceSortInfo<T>;
881
- defaultSortInfo?: DataSourceSortInfo<T>;
882
- onSortInfoChange?: ((sortInfo: DataSourceSingleSortInfo<T> | null) => void) | ((sortInfo: DataSourceSingleSortInfo<T>[]) => void);
883
- onDataParamsChange?: (dataParamsChange: DataSourceDataParams<T>) => void;
884
- livePagination?: boolean;
885
- livePaginationCursor?: DataSourcePropLivePaginationCursor<T>;
886
- onLivePaginationCursorChange?: (livePaginationCursor: DataSourceLivePaginationCursorValue) => void;
887
996
  };
888
- declare type DataSourcePropLivePaginationCursor<T> = DataSourceLivePaginationCursorValue | DataSourceLivePaginationCursorFn<T>;
889
- declare type DataSourceLivePaginationCursorFn<T> = (params: DataSourceLivePaginationCursorParams<T>) => DataSourceLivePaginationCursorValue;
890
- declare type DataSourceLivePaginationCursorParams<T> = {
891
- array: T[];
892
- lastItem: T | Partial<T> | null;
893
- length: number;
997
+ /**
998
+ * Defines a column in the table.
999
+ *
1000
+ * @typeParam DATA_TYPE The type of the data in the table.
1001
+ *
1002
+ * Can be bound to a field which is a `keyof DATA_TYPE`.
1003
+ */
1004
+ declare type InfiniteTableColumn<DATA_TYPE> = {} & InfiniteTableBaseColumn<DATA_TYPE> & InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<DATA_TYPE>;
1005
+ declare type InfiniteTableGeneratedGroupColumn<T> = InfiniteTableColumn<T> & {
1006
+ groupByField: string | string[];
1007
+ id?: string;
894
1008
  };
895
- declare type DataSourceLivePaginationCursorValue = string | number | null;
896
- interface DataSourceState<T> extends DataSourceSetupState<T>, DataSourceDerivedState<T>, DataSourceMappedState<T> {
897
- }
898
- interface DataSourceDerivedState<_T> {
899
- multiSort: boolean;
900
- controlledSort: boolean;
901
- livePaginationCursor?: DataSourceLivePaginationCursorValue;
902
- lazyLoadBatchSize?: number;
903
- }
904
- declare type DataSourceComponentActions<T> = ComponentStateActions<DataSourceState<T>>;
905
- interface DataSourceContextValue<T> {
906
- getState: () => DataSourceState<T>;
907
- componentState: DataSourceState<T>;
908
- componentActions: DataSourceComponentActions<T>;
909
- }
910
- declare enum DataSourceActionType {
911
- INIT = "INIT"
912
- }
913
- interface DataSourceAction<T> {
914
- type: DataSourceActionType;
915
- payload: T;
916
- }
917
- interface DataSourceReducer<T> {
918
- (state: DataSourceState<T>, action: DataSourceAction<any>): DataSourceState<T>;
919
- }
920
-
921
- declare class GroupRowsState<KeyType extends any = any> {
922
- private expandedMap?;
923
- private collapsedMap?;
924
- private collapsedAll;
925
- private expandedAll;
926
- private initialState;
927
- constructor(state: DataSourcePropGroupRowsStateObject<KeyType> | GroupRowsState<KeyType>);
928
- getState(): DataSourcePropGroupRowsStateObject<KeyType>;
929
- destroy(): void;
930
- private update;
931
- areAllCollapsed(): boolean;
932
- areAllExpanded(): boolean;
933
- collapseAll(): void;
934
- expandAll(): void;
935
- isGroupRowExpanded(keys: KeyType[]): boolean | undefined;
936
- isGroupRowCollapsed(keys: KeyType[]): boolean;
937
- setGroupRowExpanded(keys: KeyType[], shouldExpand: boolean): void;
938
- collapseGroupRow(keys: KeyType[]): void;
939
- expandGroupRow(keys: KeyType[]): void;
940
- toggleGroupRow(keys: KeyType[]): void;
941
- }
1009
+ declare type InfiniteTablePivotColumn<T> = InfiniteTableColumn<T> & ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnVariant<T, any>>>;
1010
+ declare type InfiniteTablePivotFinalColumnGroup<DataType, KeyType extends any = any> = InfiniteTableColumnGroup & {
1011
+ pivotBy: DataSourcePivotBy<DataType>[];
1012
+ pivotTotalColumnGroup?: true;
1013
+ pivotGroupKeys: KeyType[];
1014
+ pivotByAtIndex: PivotBy<DataType, KeyType>;
1015
+ pivotGroupKey: KeyType;
1016
+ pivotIndex: number;
1017
+ };
1018
+ declare type InfiniteTablePivotFinalColumn<DataType, KeyType extends any = any> = InfiniteTableColumn<DataType> & {
1019
+ pivotBy: DataSourcePivotBy<DataType>[];
1020
+ pivotColumn: true;
1021
+ pivotTotalColumn: boolean;
1022
+ pivotAggregator: AggregationReducer<DataType, any>;
1023
+ pivotAggregatorIndex: number;
1024
+ pivotGroupKeys: KeyType[];
1025
+ pivotByAtIndex?: PivotBy<DataType, KeyType>;
1026
+ pivotIndex: number;
1027
+ pivotGroupKey: KeyType;
1028
+ };
1029
+ declare type InfiniteTablePivotFinalColumnVariant<DataType, KeyType extends any = any> = InfiniteTablePivotFinalColumn<DataType, KeyType>;
1030
+ declare type InfiniteTableComputedColumnBase<T> = {
1031
+ computedFilterType: string;
1032
+ computedSortType: string;
1033
+ computedDataType: string;
1034
+ computedWidth: number;
1035
+ computedOffset: number;
1036
+ computedPinningOffset: number;
1037
+ computedAbsoluteOffset: number;
1038
+ computedSortable: boolean;
1039
+ computedSortInfo: DataSourceSingleSortInfo<T> | null;
1040
+ computedSorted: boolean;
1041
+ computedSortedAsc: boolean;
1042
+ computedSortedDesc: boolean;
1043
+ computedSortIndex: number;
1044
+ computedVisibleIndex: number;
1045
+ computedMultiSort: boolean;
1046
+ computedFiltered: boolean;
1047
+ computedFilterable: boolean;
1048
+ computedFilterValue: DataSourceFilterValueItem<T> | null;
1049
+ computedPinned: InfiniteTableColumnPinnedValues;
1050
+ computedDraggable: boolean;
1051
+ computedFirstInCategory: boolean;
1052
+ computedLastInCategory: boolean;
1053
+ computedFirst: boolean;
1054
+ computedLast: boolean;
1055
+ toggleSort: () => void;
1056
+ id: string;
1057
+ };
1058
+ declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteTableComputedColumnBase<T> & Partial<InfiniteTablePivotFinalColumn<T>> & Partial<InfiniteTableGeneratedGroupColumn<T>>;
1059
+ declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
942
1060
 
943
1061
  declare type AggregationReducer<T, AggregationResultType = any> = DataSourceAggregationReducer<T, AggregationResultType> & {
944
1062
  id: string;
@@ -959,11 +1077,17 @@ declare type InfiniteTableRowInfo<T> = InfiniteTable_HasGrouping_RowInfoNormal<T
959
1077
  declare type InfiniteTableRowInfoDataDiscriminator<T> = {
960
1078
  data: T;
961
1079
  isGroupRow: false;
1080
+ rowActive: boolean;
962
1081
  rowInfo: InfiniteTable_NoGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoNormal<T>;
1082
+ field?: keyof T;
1083
+ value: any;
963
1084
  } | {
1085
+ rowActive: boolean;
964
1086
  data: Partial<T> | null;
965
1087
  rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<T>;
966
1088
  isGroupRow: true;
1089
+ field?: keyof T;
1090
+ value: any;
967
1091
  };
968
1092
  /**
969
1093
  * This is the base row info for all scenarios - things every
@@ -1184,177 +1308,292 @@ declare type DataGroupResult<DataType, KeyType extends any> = {
1184
1308
  declare function group<DataType, KeyType = any>(groupParams: GroupParams<DataType, KeyType>, data: DataType[]): DataGroupResult<DataType, KeyType>;
1185
1309
  declare function flatten<DataType, KeyType extends any>(groupResult: DataGroupResult<DataType, KeyType>): DataType[];
1186
1310
 
1187
- declare type InfiniteTableCellProps<T> = {
1188
- column: InfiniteTableComputedColumn<T>;
1189
- renderChildren: () => Renderable;
1190
- width: number;
1191
- cssEllipsis?: boolean;
1192
- virtualized?: boolean;
1193
- skipColumnShifting?: boolean;
1194
- beforeChildren?: Renderable;
1195
- afterChildren?: Renderable;
1196
- offset?: number;
1197
- offsetProperty?: 'left' | 'right';
1198
- cssPosition?: CSSProperties['position'];
1199
- domRef?: React.RefCallback<HTMLElement>;
1200
- cellType: 'body' | 'header';
1311
+ declare type SortDir = 1 | -1;
1312
+ declare type MultisortInfo<T> = {
1313
+ /**
1314
+ * The sorting direction
1315
+ */
1316
+ dir: SortDir;
1317
+ /**
1318
+ * for now 'string' and 'number' are known types, meaning they have
1319
+ * sort functions already implemented
1320
+ */
1321
+ type?: string;
1322
+ fn?: (a: any, b: any) => number;
1323
+ /**
1324
+ * a property whose value to use for sorting on the array items
1325
+ */
1326
+ field?: keyof T;
1327
+ /**
1328
+ * or a function to retrieve the item value to use for sorting
1329
+ */
1330
+ valueGetter?: (item: T) => any;
1331
+ };
1332
+ declare const multisort: {
1333
+ <T>(sortInfo: MultisortInfo<T>[], array: T[], get?: ((item: any) => T) | undefined): T[];
1334
+ knownTypes: {
1335
+ [key: string]: (first: any, second: any) => number;
1336
+ };
1201
1337
  };
1202
1338
 
1203
- declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
1204
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
1205
- }[Keys];
1206
-
1207
- declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
1208
- declare type InfiniteTableColumnHeaderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1209
- domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
1210
- sortTool: JSX.Element;
1211
- column: COL_TYPE;
1212
- columnSortInfo: DataSourceSingleSortInfo<DATA_TYPE> | null;
1339
+ declare type RenderRange = {
1340
+ renderStartIndex: number;
1341
+ renderEndIndex: number;
1213
1342
  };
1214
- declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1215
- domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
1216
- value: string | number | Renderable;
1217
- groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
1218
- rowIndex: number;
1219
- column: COL_TYPE;
1220
- toggleCurrentGroupRow: () => void;
1221
- toggleGroupRow: InfiniteTableToggleGroupRowFn;
1222
- groupBy: DataSourceState<DATA_TYPE>['groupBy'];
1223
- pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
1343
+
1344
+ interface DataSourceDataParams<T> {
1345
+ originalDataArray: T[];
1346
+ sortInfo?: DataSourceSortInfo<T>;
1347
+ groupBy?: DataSourcePropGroupBy<T>;
1348
+ pivotBy?: DataSourcePropPivotBy<T>;
1349
+ filterValue?: DataSourcePropFilterValue<T>;
1350
+ groupRowsState?: DataSourcePropGroupRowsStateObject<any>;
1351
+ lazyLoadBatchSize?: number;
1352
+ lazyLoadStartIndex?: number;
1353
+ groupKeys?: any[];
1354
+ append?: boolean;
1355
+ aggregationReducers?: DataSourcePropAggregationReducers<T>;
1356
+ livePaginationCursor?: DataSourceLivePaginationCursorValue;
1357
+ __cursorId?: DataSourceSetupState<T>['cursorId'];
1358
+ changes?: DataSourceDataParamsChanges<T>;
1359
+ }
1360
+ declare type DataSourceDataParamsChanges<T> = Partial<Record<keyof Omit<DataSourceDataParams<T>, 'originalDataArray' | 'changes'>, true>>;
1361
+ declare type DataSourceSingleSortInfo<T> = MultisortInfo<T> & {
1362
+ field?: keyof T;
1363
+ id?: string;
1224
1364
  };
1225
- declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & InfiniteTableRowInfoDataDiscriminator<DATA_TYPE>;
1226
- declare type InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & {
1227
- rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<DATA_TYPE>;
1228
- isGroupRow: true;
1229
- data: Partial<DATA_TYPE> | null;
1365
+ declare type DataSourceGroupBy<T> = GroupBy<T, any>;
1366
+ declare type DataSourcePivotBy<T> = PivotBy<T, any>;
1367
+ declare type DataSourceSortInfo<T> = null | DataSourceSingleSortInfo<T> | DataSourceSingleSortInfo<T>[];
1368
+ declare type DataSourcePropSortInfo<T> = DataSourceSortInfo<T>;
1369
+ declare type DataSourceRemoteData<T> = {
1370
+ data: T[] | LazyGroupDataItem<T>[];
1371
+ mappings?: DataSourceMappings;
1372
+ cache?: boolean;
1373
+ error?: string;
1374
+ totalCount?: number;
1375
+ totalCountUnfiltered?: number;
1376
+ livePaginationCursor?: DataSourceLivePaginationCursorValue;
1230
1377
  };
1231
- declare type InfiniteTableColumnCellContextType<DATA_TYPE> = InfiniteTableColumnRenderParam<DATA_TYPE> & {};
1232
- declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> & {
1233
- collapsed: boolean;
1234
- groupIcon: Renderable;
1378
+ declare type DataSourceData<T> = T[] | DataSourceRemoteData<T> | Promise<T[] | DataSourceRemoteData<T>> | ((dataInfo: DataSourceDataParams<T>) => T[] | Promise<T[] | DataSourceRemoteData<T>>);
1379
+ declare type DataSourceGroupRowsList<KeyType> = true | KeyType[][];
1380
+ declare type DataSourcePropGroupRowsStateObject<KeyType> = {
1381
+ expandedRows: DataSourceGroupRowsList<KeyType>;
1382
+ collapsedRows: DataSourceGroupRowsList<KeyType>;
1235
1383
  };
1236
- declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
1237
- declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1238
- rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
1239
- data: DATA_TYPE | Partial<DATA_TYPE> | null;
1240
- dataArray: InfiniteTableRowInfo<DATA_TYPE>[];
1241
- rowIndex: number;
1242
- column: COL_TYPE;
1384
+ declare type DataSourcePropGroupBy<T> = DataSourceGroupBy<T>[];
1385
+ declare type DataSourcePropPivotBy<T> = DataSourcePivotBy<T>[];
1386
+ interface DataSourceMappedState<T> {
1387
+ aggregationReducers?: DataSourceProps<T>['aggregationReducers'];
1388
+ livePagination: DataSourceProps<T>['livePagination'];
1389
+ lazyLoad: DataSourceProps<T>['lazyLoad'];
1390
+ onDataParamsChange: DataSourceProps<T>['onDataParamsChange'];
1391
+ data: DataSourceProps<T>['data'];
1392
+ sortMode: DataSourceProps<T>['sortMode'];
1393
+ filterFunction: DataSourceProps<T>['filterFunction'];
1394
+ filterValue: DataSourceProps<T>['filterValue'];
1395
+ filterTypes: NonUndefined<DataSourceProps<T>['filterTypes']>;
1396
+ primaryKey: DataSourceProps<T>['primaryKey'];
1397
+ filterDelay: NonUndefined<DataSourceProps<T>['filterDelay']>;
1398
+ groupBy: NonUndefined<DataSourceProps<T>['groupBy']>;
1399
+ groupRowsState: GroupRowsState<T>;
1400
+ pivotBy: DataSourceProps<T>['pivotBy'];
1401
+ loading: NonUndefined<DataSourceProps<T>['loading']>;
1402
+ sortTypes: NonUndefined<DataSourceProps<T>['sortTypes']>;
1403
+ collapseGroupRowsOnDataFunctionChange: NonUndefined<DataSourceProps<T>['collapseGroupRowsOnDataFunctionChange']>;
1404
+ sortInfo: DataSourceSingleSortInfo<T>[] | null;
1405
+ }
1406
+ declare type DataSourceAggregationReducer<T, AggregationResultType> = {
1407
+ name?: string;
1408
+ field?: keyof T;
1409
+ initialValue?: AggregationResultType;
1410
+ getter?: (data: T) => any;
1411
+ reducer: string | ((accumulator: any, value: any, data: T) => AggregationResultType | any);
1412
+ done?: (accumulatedValue: AggregationResultType | any, array: T[]) => AggregationResultType;
1413
+ pivotColumn?: ColumnTypeWithInherit<Partial<InfiniteTableColumn<T>>> | (({ column, }: {
1414
+ column: InfiniteTablePivotFinalColumnVariant<T>;
1415
+ }) => ColumnTypeWithInherit<Partial<InfiniteTablePivotColumn<T>>>);
1243
1416
  };
1244
- declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
1245
- declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
1246
- declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderParams<T>) => Renderable;
1247
- declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
1248
- declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
1249
- declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
1250
- declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
1251
- declare type InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T> = RequireAtLeastOne<{
1417
+ declare type ColumnTypeWithInherit<COL_TYPE> = COL_TYPE & {
1418
+ inheritFromColumn?: string | boolean;
1419
+ };
1420
+ declare type DataSourceMappings = Record<'totals' | 'values', string>;
1421
+ declare type LazyGroupDataItem<DataType> = {
1422
+ data: Partial<DataType>;
1423
+ keys: any[];
1424
+ aggregations?: Record<string, any>;
1425
+ dataset?: DataSourceRemoteData<DataType>;
1426
+ pivot?: {
1427
+ values: Record<string, any>;
1428
+ totals?: Record<string, any>;
1429
+ };
1430
+ };
1431
+ declare type LazyRowInfoGroup<DataType> = {
1252
1432
  /**
1253
- * Determines the field property of the column.
1433
+ * Those are direct children of the current lazy group row
1254
1434
  */
1255
- field?: keyof T;
1256
- render?: InfiniteTableColumnRenderFunction<T>;
1257
- renderValue?: InfiniteTableColumnRenderFunction<T>;
1258
- valueGetter?: InfiniteTableColumnValueGetter<T>;
1259
- }, 'render' | 'renderValue' | 'field' | 'valueGetter'>;
1260
- declare type InfiniteTableColumnStyleFnParams<T> = {
1261
- value: Renderable;
1262
- column: InfiniteTableColumn<T>;
1263
- } & InfiniteTableRowInfoDataDiscriminator<T>;
1264
- declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React.CSSProperties;
1265
- declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
1266
- declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
1267
- declare type InfiniteTableColumnClassName<T> = string | InfiniteTableColumnClassNameFn<T>;
1268
- declare type InfiniteTableColumnValueGetterParams<T> = InfiniteTableRowInfoDataDiscriminator<T>;
1269
- declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = string | number | boolean | null | undefined> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
1270
- declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
1271
- declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
1272
- declare type InfiniteTableBaseColumn<T> = {
1273
- sortable?: boolean;
1274
- draggable?: boolean;
1275
- resizable?: boolean;
1276
- comparer?: InfiniteTableColumnComparer<T>;
1277
- defaultHiddenWhenGroupedBy?: '*' | keyof T | {
1278
- [k in keyof Partial<T>]: true;
1279
- };
1280
- align?: InfiniteTableColumnAlign;
1281
- verticalAlign?: InfiniteTableColumnVerticalAlign;
1282
- columnGroup?: string;
1283
- header?: InfiniteTableColumnHeader<T>;
1284
- name?: Renderable;
1285
- cssEllipsis?: boolean;
1286
- headerCssEllipsis?: boolean;
1287
- type?: InfiniteTableColumnTypeNames | InfiniteTableColumnTypeNames[] | null;
1288
- style?: InfiniteTableColumnStyle<T>;
1289
- className?: InfiniteTableColumnClassName<T>;
1290
- rowspan?: InfiniteTableColumnRowspanFn<T>;
1291
- valueGetter?: InfiniteTableColumnValueGetter<T>;
1292
- defaultWidth?: number;
1293
- defaultFlex?: number;
1294
- minWidth?: number;
1295
- maxWidth?: number;
1296
- components?: {
1297
- ColumnCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
1298
- HeaderCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
1435
+ children: LazyGroupDataItem<DataType>[];
1436
+ childrenLoading: boolean;
1437
+ childrenAvailable: boolean;
1438
+ cache: boolean;
1439
+ totalCount: number;
1440
+ totalCountUnfiltered: number;
1441
+ error?: string;
1442
+ };
1443
+ declare type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyRowInfoGroup<DataType>>;
1444
+ interface DataSourceSetupState<T> {
1445
+ unfilteredCount: number;
1446
+ filteredCount: number;
1447
+ lazyLoadCacheOfLoadedBatches: DeepMap<string, true>;
1448
+ pivotMappings?: DataSourceMappings;
1449
+ propsCache: Map<keyof DataSourceProps<T>, WeakMap<any, any>>;
1450
+ showSeparatePivotColumnForSingleAggregation: boolean;
1451
+ dataParams?: DataSourceDataParams<T>;
1452
+ originalLazyGroupData: LazyGroupDataDeepMap<T>;
1453
+ originalLazyGroupDataChangeDetect: number | string;
1454
+ scrollStopDelayUpdatedByTable: number;
1455
+ notifyScrollbarsChange: SubscriptionCallback<Scrollbars>;
1456
+ notifyScrollStop: SubscriptionCallback<ScrollStopInfo>;
1457
+ notifyRenderRangeChange: SubscriptionCallback<RenderRange>;
1458
+ originalDataArray: T[];
1459
+ lastFilterDataArray?: T[];
1460
+ lastSortDataArray?: T[];
1461
+ lastGroupDataArray?: InfiniteTableRowInfo<T>[];
1462
+ dataArray: InfiniteTableRowInfo<T>[];
1463
+ groupDeepMap?: DeepMap<GroupKeyType, DeepMapGroupValueType<T, any>>;
1464
+ pivotTotalColumnPosition: InfiniteTablePropPivotTotalColumnPosition;
1465
+ pivotGrandTotalColumnPosition: InfiniteTablePropPivotGrandTotalColumnPosition;
1466
+ cursorId: number | symbol | DataSourceLivePaginationCursorValue;
1467
+ updatedAt: number;
1468
+ reducedAt: number;
1469
+ groupedAt: number;
1470
+ sortedAt: number;
1471
+ filteredAt: number;
1472
+ generateGroupRows: boolean;
1473
+ postFilterDataArray?: T[];
1474
+ postSortDataArray?: T[];
1475
+ postGroupDataArray?: InfiniteTableRowInfo<T>[];
1476
+ pivotColumns?: Map<string, InfiniteTableColumn<T>>;
1477
+ pivotColumnGroups?: Map<string, InfiniteTableColumnGroup>;
1478
+ }
1479
+ declare type DataSourcePropAggregationReducers<T> = Record<string, DataSourceAggregationReducer<T, any>>;
1480
+ declare type DataSourceProps<T> = {
1481
+ children: React$1.ReactNode | ((contextData: DataSourceState<T>) => React$1.ReactNode);
1482
+ primaryKey: keyof T | (({ data, index }: {
1483
+ data: T;
1484
+ index: number;
1485
+ }) => string);
1486
+ fields?: (keyof T)[];
1487
+ data: DataSourceData<T>;
1488
+ lazyLoad?: boolean | {
1489
+ batchSize?: number;
1299
1490
  };
1491
+ loading?: boolean;
1492
+ defaultLoading?: boolean;
1493
+ onLoadingChange?: (loading: boolean) => void;
1494
+ pivotBy?: DataSourcePropPivotBy<T>;
1495
+ defaultPivotBy?: DataSourcePropPivotBy<T>;
1496
+ onPivotByChange?: (pivotBy: DataSourcePropPivotBy<T>) => void;
1497
+ aggregationReducers?: DataSourcePropAggregationReducers<T>;
1498
+ defaultAggregationReducers?: DataSourcePropAggregationReducers<T>;
1499
+ groupBy?: DataSourcePropGroupBy<T>;
1500
+ defaultGroupBy?: DataSourcePropGroupBy<T>;
1501
+ onGroupByChange?: (groupBy: DataSourcePropGroupBy<T>) => void;
1502
+ groupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<any>;
1503
+ defaultGroupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<keyof T>;
1504
+ onGroupRowsStateChange?: (groupRowsState: GroupRowsState) => void;
1505
+ collapseGroupRowsOnDataFunctionChange?: boolean;
1506
+ sortInfo?: DataSourceSortInfo<T>;
1507
+ defaultSortInfo?: DataSourceSortInfo<T>;
1508
+ onSortInfoChange?: ((sortInfo: DataSourceSingleSortInfo<T> | null) => void) | ((sortInfo: DataSourceSingleSortInfo<T>[]) => void);
1509
+ onDataParamsChange?: (dataParamsChange: DataSourceDataParams<T>) => void;
1510
+ livePagination?: boolean;
1511
+ livePaginationCursor?: DataSourcePropLivePaginationCursor<T>;
1512
+ onLivePaginationCursorChange?: (livePaginationCursor: DataSourceLivePaginationCursorValue) => void;
1513
+ filterFunction?: DataSourcePropFilterFunction<T>;
1514
+ sortMode?: 'local' | 'remote';
1515
+ filterMode?: 'local' | 'remote';
1516
+ filterValue?: DataSourcePropFilterValue<T>;
1517
+ defaultFilterValue?: DataSourcePropFilterValue<T>;
1518
+ onFilterValueChange?: (filterValue: DataSourcePropFilterValue<T>) => void;
1519
+ filterDelay?: number;
1520
+ filterTypes?: DataSourcePropFilterTypes<T>;
1521
+ sortTypes?: DataSourcePropSortTypes;
1300
1522
  };
1301
- /**
1302
- * Defines a column in the table.
1303
- *
1304
- * @typeParam DATA_TYPE The type of the data in the table.
1305
- *
1306
- * Can be bound to a field which is a `keyof DATA_TYPE`.
1307
- */
1308
- declare type InfiniteTableColumn<DATA_TYPE> = {} & InfiniteTableBaseColumn<DATA_TYPE> & InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<DATA_TYPE>;
1309
- declare type InfiniteTableGeneratedGroupColumn<T> = InfiniteTableColumn<T> & {
1310
- groupByField: string | string[];
1311
- id?: string;
1523
+ declare type DataSourcePropSortTypes = Record<string, (first: any, second: any) => number>;
1524
+ declare type DataSourcePropFilterTypes<T> = Record<string, DataSourceFilterType<T>>;
1525
+ declare type DataSourceFilterFunctionParam<T> = {
1526
+ data: T;
1527
+ index: number;
1528
+ dataArray: T[];
1529
+ primaryKey: any;
1312
1530
  };
1313
- declare type InfiniteTablePivotColumn<T> = InfiniteTableColumn<T> & ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnVariant<T, any>>>;
1314
- declare type InfiniteTablePivotFinalColumnGroup<DataType, KeyType extends any = any> = InfiniteTableColumnGroup & {
1315
- pivotBy: DataSourcePivotBy<DataType>[];
1316
- pivotTotalColumnGroup?: true;
1317
- pivotGroupKeys: KeyType[];
1318
- pivotByAtIndex: PivotBy<DataType, KeyType>;
1319
- pivotGroupKey: KeyType;
1320
- pivotIndex: number;
1531
+ declare type DataSourcePropFilterFunction<T> = (filterParam: DataSourceFilterFunctionParam<T>) => boolean;
1532
+ declare type DataSourcePropFilterValue<T> = DataSourceFilterValueItem<T>[];
1533
+ declare type DataSourceFilterValueItem<T> = DiscriminatedUnion<{
1534
+ field: keyof T;
1535
+ }, {
1536
+ id: string;
1537
+ }> & {
1538
+ valueGetter?: DataSourceFilterValueItemValueGetter<T>;
1539
+ filterValue: any;
1540
+ disabled?: boolean;
1541
+ filterType: string;
1542
+ operator: string;
1321
1543
  };
1322
- declare type InfiniteTablePivotFinalColumn<DataType, KeyType extends any = any> = InfiniteTableColumn<DataType> & {
1323
- pivotBy: DataSourcePivotBy<DataType>[];
1324
- pivotColumn: true;
1325
- pivotTotalColumn: boolean;
1326
- pivotAggregator: AggregationReducer<DataType, any>;
1327
- pivotAggregatorIndex: number;
1328
- pivotGroupKeys: KeyType[];
1329
- pivotByAtIndex?: PivotBy<DataType, KeyType>;
1330
- pivotIndex: number;
1331
- pivotGroupKey: KeyType;
1544
+ declare type DataSourceFilterValueItemValueGetter<T> = (param: DataSourceFilterFunctionParam<T>) => any;
1545
+ declare type DataSourceFilterType<T> = {
1546
+ emptyValues: Set<any>;
1547
+ label?: string;
1548
+ defaultOperator: string;
1549
+ operators: DataSourceFilterOperator<T>[];
1332
1550
  };
1333
- declare type InfiniteTablePivotFinalColumnVariant<DataType, KeyType extends any = any> = InfiniteTablePivotFinalColumn<DataType, KeyType>;
1334
- declare type InfiniteTableComputedColumnBase<T> = {
1335
- computedWidth: number;
1336
- computedOffset: number;
1337
- computedPinningOffset: number;
1338
- computedAbsoluteOffset: number;
1339
- computedSortable: boolean;
1340
- computedSortInfo: DataSourceSingleSortInfo<T> | null;
1341
- computedSorted: boolean;
1342
- computedSortedAsc: boolean;
1343
- computedSortedDesc: boolean;
1344
- computedSortIndex: number;
1345
- computedVisibleIndex: number;
1346
- computedMultiSort: boolean;
1347
- computedPinned: InfiniteTableColumnPinnedValues;
1348
- computedDraggable: boolean;
1349
- computedFirstInCategory: boolean;
1350
- computedLastInCategory: boolean;
1351
- computedFirst: boolean;
1352
- computedLast: boolean;
1353
- toggleSort: () => void;
1354
- id: string;
1551
+ declare type DataSourceFilterOperator<T> = {
1552
+ name: string;
1553
+ label?: string;
1554
+ fn: DataSourceFilterOperatorFunction<T>;
1355
1555
  };
1356
- declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteTableComputedColumnBase<T> & Partial<InfiniteTablePivotFinalColumn<T>> & Partial<InfiniteTableGeneratedGroupColumn<T>>;
1357
- declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
1556
+ declare type DataSourceFilterOperatorFunction<T> = (filterOperatorFunctionParam: DataSourceFilterOperatorFunctionParam<T>) => boolean;
1557
+ declare type DataSourceFilterOperatorFunctionParam<T> = {
1558
+ currentValue: any;
1559
+ filterValue: any;
1560
+ emptyValues: Set<any>;
1561
+ } & DataSourceFilterFunctionParam<T>;
1562
+ declare type DataSourcePropLivePaginationCursor<T> = DataSourceLivePaginationCursorValue | DataSourceLivePaginationCursorFn<T>;
1563
+ declare type DataSourceLivePaginationCursorFn<T> = (params: DataSourceLivePaginationCursorParams<T>) => DataSourceLivePaginationCursorValue;
1564
+ declare type DataSourceLivePaginationCursorParams<T> = {
1565
+ array: T[];
1566
+ lastItem: T | Partial<T> | null;
1567
+ length: number;
1568
+ };
1569
+ declare type DataSourceLivePaginationCursorValue = string | number | null;
1570
+ interface DataSourceState<T> extends DataSourceSetupState<T>, DataSourceDerivedState<T>, DataSourceMappedState<T> {
1571
+ }
1572
+ interface DataSourceDerivedState<T> {
1573
+ operatorsByFilterType: Record<string, Record<string, DataSourceFilterOperator<T>>>;
1574
+ filterMode: NonUndefined<DataSourceProps<T>['filterMode']>;
1575
+ multiSort: boolean;
1576
+ controlledSort: boolean;
1577
+ controlledFilter: boolean;
1578
+ livePaginationCursor?: DataSourceLivePaginationCursorValue;
1579
+ lazyLoadBatchSize?: number;
1580
+ }
1581
+ declare type DataSourceComponentActions<T> = ComponentStateActions<DataSourceState<T>>;
1582
+ interface DataSourceContextValue<T> {
1583
+ getState: () => DataSourceState<T>;
1584
+ componentState: DataSourceState<T>;
1585
+ componentActions: DataSourceComponentActions<T>;
1586
+ }
1587
+ declare enum DataSourceActionType {
1588
+ INIT = "INIT"
1589
+ }
1590
+ interface DataSourceAction<T> {
1591
+ type: DataSourceActionType;
1592
+ payload: T;
1593
+ }
1594
+ interface DataSourceReducer<T> {
1595
+ (state: DataSourceState<T>, action: DataSourceAction<any>): DataSourceState<T>;
1596
+ }
1358
1597
 
1359
1598
  declare function useInfiniteHeaderCell<T>(): InfiniteTableColumnHeaderParams<T, InfiniteTableComputedColumn<T>>;
1360
1599
 
@@ -1366,17 +1605,19 @@ declare function InfiniteTable<T>(props: InfiniteTableProps<T>): JSX.Element;
1366
1605
  declare namespace InfiniteTable {
1367
1606
  var defaultProps: {
1368
1607
  rowHeight: number;
1369
- headerHeight: _vanilla_extract_private.CSSVarFunction;
1608
+ columnHeaderHeight: _vanilla_extract_private.CSSVarFunction;
1370
1609
  };
1371
1610
  }
1372
1611
 
1612
+ declare const defaultFilterTypes: Record<string, DataSourceFilterType<any>>;
1613
+
1373
1614
  declare function useDataSource<T>(): DataSourceState<T>;
1374
1615
 
1375
1616
  declare function DataSource<T>(props: DataSourceProps<T>): JSX.Element;
1376
1617
 
1377
- declare type ForwardPropsToStateFnResult<TYPE_PROPS, TYPE_RESULT> = Partial<{
1618
+ declare type ForwardPropsToStateFnResult<TYPE_PROPS, TYPE_RESULT> = {
1378
1619
  [propName in keyof TYPE_PROPS & keyof TYPE_RESULT]: 1 | ((value: TYPE_PROPS[propName]) => TYPE_RESULT[propName]);
1379
- }>;
1620
+ };
1380
1621
  declare type ComponentStateRootConfig<T_PROPS, COMPONENT_MAPPED_STATE, COMPONENT_SETUP_STATE = {}, COMPONENT_DERIVED_STATE = {}, T_ACTIONS = {}, T_PARENT_STATE = {}> = {
1381
1622
  debugName?: string;
1382
1623
  initSetupState?: () => COMPONENT_SETUP_STATE;
@@ -1425,4 +1666,8 @@ declare function interceptMap<K, V>(map: Map<K, V>, fns: InterceptedMapFns<K, V>
1425
1666
 
1426
1667
  declare function useEffectWithChanges<T>(fn: (changes: Record<keyof T, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<keyof T, any>): void;
1427
1668
 
1428
- export { ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropLivePaginationCursor, DataSourcePropPivotBy, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTableGroupColumnRenderIconFunction, InfiniteTableImperativeApi, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Scrollbars, debounce, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useInfiniteColumnCell, useInfiniteHeaderCell };
1669
+ declare const defaultFilterEditors: InfiniteTablePropFilterEditors<unknown>;
1670
+ declare function StringFilterEditor<T>(props: InfiniteTableFilterEditorProps<T>): JSX.Element;
1671
+ declare function NumberFilterEditor<T>(props: InfiniteTableFilterEditorProps<T>): JSX.Element;
1672
+
1673
+ 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, InfiniteTablePropKeyboardNavigation, 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 };