@infinite-table/infinite-react 0.3.1 → 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.
Files changed (6) hide show
  1. package/index.css +199 -91
  2. package/index.d.ts +654 -411
  3. package/index.esm.css +199 -91
  4. package/index.esm.js +1911 -832
  5. package/index.js +1906 -840
  6. 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;
@@ -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,7 @@ 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']>;
427
511
  onScrollbarsChange: InfiniteTableProps<T>['onScrollbarsChange'];
428
512
  loadingText: InfiniteTableProps<T>['loadingText'];
429
513
  components: InfiniteTableProps<T>['components'];
@@ -435,11 +519,14 @@ interface InfiniteTableMappedState<T> {
435
519
  onFocusWithin: InfiniteTableProps<T>['onFocusWithin'];
436
520
  onBlurWithin: InfiniteTableProps<T>['onBlurWithin'];
437
521
  autoSizeColumnsKey: InfiniteTableProps<T>['autoSizeColumnsKey'];
522
+ activeRowIndex: number | null;
523
+ activeCellIndex: [number, number] | null;
438
524
  scrollStopDelay: NonUndefined<InfiniteTableProps<T>['scrollStopDelay']>;
439
525
  onScrollToTop: InfiniteTableProps<T>['onScrollToTop'];
440
526
  onScrollToBottom: InfiniteTableProps<T>['onScrollToBottom'];
441
527
  onScrollStop: InfiniteTableProps<T>['onScrollStop'];
442
528
  scrollToBottomOffset: InfiniteTableProps<T>['scrollToBottomOffset'];
529
+ filterEditors: NonUndefined<InfiniteTableProps<T>['filterEditors']>;
443
530
  focusedClassName: InfiniteTableProps<T>['focusedClassName'];
444
531
  focusedWithinClassName: InfiniteTableProps<T>['focusedWithinClassName'];
445
532
  focusedStyle: InfiniteTableProps<T>['focusedStyle'];
@@ -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']>;
@@ -467,7 +553,7 @@ interface InfiniteTableMappedState<T> {
467
553
  header: NonUndefined<InfiniteTableProps<T>['header']>;
468
554
  virtualizeColumns: NonUndefined<InfiniteTableProps<T>['virtualizeColumns']>;
469
555
  rowHeight: number;
470
- headerHeight: number;
556
+ columnHeaderHeight: number;
471
557
  licenseKey: NonUndefined<InfiniteTableProps<T>['licenseKey']>;
472
558
  columnVisibility: InfiniteTablePropColumnVisibility;
473
559
  columnPinning: InfiniteTablePropColumnPinningMap;
@@ -481,13 +567,14 @@ 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;
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,20 @@ 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
+ 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;
650
770
  draggableColumns?: boolean;
651
771
  header?: boolean;
772
+ headerOptions?: InfiniteTablePropHeaderOptions;
652
773
  focusedClassName?: string;
653
774
  focusedWithinClassName?: string;
654
775
  focusedStyle?: React$1.CSSProperties;
@@ -661,8 +782,6 @@ interface InfiniteTableProps<T> {
661
782
  resizableColumns?: boolean;
662
783
  virtualizeColumns?: InfiniteTablePropVirtualizeColumns<T>;
663
784
  virtualizeRows?: boolean;
664
- defaultActiveIndex?: number;
665
- activeIndex?: number;
666
785
  onSelfFocus?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
667
786
  onSelfBlur?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
668
787
  onFocusWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
@@ -676,12 +795,16 @@ interface InfiniteTableProps<T> {
676
795
  columnOrder?: InfiniteTablePropColumnOrder;
677
796
  onColumnOrderChange?: (columnOrder: InfiniteTablePropColumnOrder) => void;
678
797
  onRowHeightChange?: (rowHeight: number) => void;
798
+ filterEditors?: InfiniteTablePropFilterEditors<T>;
679
799
  onReady?: (api: InfiniteTableImperativeApi<T>) => void;
680
800
  rowProps?: React$1.HTMLProps<HTMLDivElement> | ((rowArgs: InfiniteTableRowStyleFnParams<T>) => React$1.HTMLProps<HTMLDivElement>);
681
801
  licenseKey?: string;
682
802
  scrollTopKey?: string | number;
683
803
  autoSizeColumnsKey?: InfiniteTablePropAutoSizeColumnsKey;
684
804
  }
805
+ declare type InfiniteTablePropHeaderOptions = {
806
+ alwaysReserveSpaceForSortIcon: boolean;
807
+ };
685
808
  declare type InfiniteTablePropAutoSizeColumnsKey = string | number | {
686
809
  key: string | number;
687
810
  columnsToSkip?: string[];
@@ -692,12 +815,14 @@ declare type Scrollbars = {
692
815
  vertical: boolean;
693
816
  horizontal: boolean;
694
817
  };
818
+ declare type ScrollAdjustPosition = 'start' | 'end' | 'center';
695
819
 
696
820
  interface InfiniteTableComputedValues<T> {
697
821
  scrollbars: {
698
822
  vertical: boolean;
699
823
  horizontal: boolean;
700
824
  };
825
+ showColumnFilters: boolean;
701
826
  rowspan?: MatrixBrainOptions['rowspan'];
702
827
  computedPinnedStartOverflow: boolean;
703
828
  computedPinnedEndOverflow: boolean;
@@ -728,216 +853,208 @@ interface InfiniteTableContextValue<T> {
728
853
  getState: () => InfiniteTableState<T>;
729
854
  }
730
855
 
731
- declare type RenderRange = {
732
- renderStartIndex: number;
733
- renderEndIndex: number;
856
+ declare type InfiniteTableBaseCellProps<T> = {
857
+ column: InfiniteTableComputedColumn<T>;
858
+ renderChildren: () => Renderable;
859
+ width: number;
860
+ cssEllipsis?: boolean;
861
+ contentStyle?: CSSProperties;
862
+ contentClassName?: string;
863
+ virtualized?: boolean;
864
+ skipColumnShifting?: boolean;
865
+ beforeChildren?: Renderable;
866
+ afterChildren?: Renderable;
867
+ offset?: number;
868
+ offsetProperty?: 'left' | 'right';
869
+ cssPosition?: CSSProperties['position'];
870
+ domRef?: React.RefCallback<HTMLElement>;
734
871
  };
872
+ declare type InfiniteTableCellProps<T> = ({
873
+ cellType: 'header';
874
+ } & InfiniteTableBaseCellProps<T>) | ({
875
+ cellType: 'body';
876
+ } & InfiniteTableBaseCellProps<T>);
735
877
 
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
- totalCount?: number;
764
- livePaginationCursor?: DataSourceLivePaginationCursorValue;
878
+ declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
879
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
880
+ }[Keys];
881
+ declare type DiscriminatedUnion<A, B> = (A & {
882
+ [K in keyof B]?: undefined;
883
+ }) | (B & {
884
+ [K in keyof A]?: undefined;
885
+ });
886
+
887
+ declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
888
+ declare type InfiniteTableColumnHeaderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
889
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
890
+ sortTool: JSX.Element | null;
891
+ column: COL_TYPE;
892
+ columnSortInfo: DataSourceSingleSortInfo<DATA_TYPE> | null;
893
+ columnFilterValue: DataSourceFilterValueItem<DATA_TYPE> | null;
765
894
  };
766
- declare type DataSourceData<T> = T[] | DataSourceRemoteData<T> | Promise<T[] | DataSourceRemoteData<T>> | ((dataInfo: DataSourceDataParams<T>) => T[] | Promise<T[] | DataSourceRemoteData<T>>);
767
- declare type DataSourceGroupRowsList<KeyType> = true | KeyType[][];
768
- declare type DataSourcePropGroupRowsStateObject<KeyType> = {
769
- expandedRows: DataSourceGroupRowsList<KeyType>;
770
- collapsedRows: DataSourceGroupRowsList<KeyType>;
895
+ declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
896
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
897
+ value: string | number | Renderable;
898
+ groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
899
+ rowIndex: number;
900
+ rowActive: boolean;
901
+ column: COL_TYPE;
902
+ toggleCurrentGroupRow: () => void;
903
+ toggleGroupRow: InfiniteTableToggleGroupRowFn;
904
+ groupBy: DataSourceState<DATA_TYPE>['groupBy'];
905
+ pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
771
906
  };
772
- declare type DataSourcePropGroupBy<T> = DataSourceGroupBy<T>[];
773
- declare type DataSourcePropPivotBy<T> = DataSourcePivotBy<T>[];
774
- interface DataSourceMappedState<T> {
775
- aggregationReducers?: DataSourceProps<T>['aggregationReducers'];
776
- livePagination: DataSourceProps<T>['livePagination'];
777
- lazyLoad: DataSourceProps<T>['lazyLoad'];
778
- onDataParamsChange: DataSourceProps<T>['onDataParamsChange'];
779
- data: DataSourceProps<T>['data'];
780
- primaryKey: DataSourceProps<T>['primaryKey'];
781
- groupBy: NonUndefined<DataSourceProps<T>['groupBy']>;
782
- groupRowsState: GroupRowsState<T>;
783
- pivotBy: DataSourceProps<T>['pivotBy'];
784
- loading: NonUndefined<DataSourceProps<T>['loading']>;
785
- collapseGroupRowsOnDataFunctionChange: NonUndefined<DataSourceProps<T>['collapseGroupRowsOnDataFunctionChange']>;
786
- sortInfo: DataSourceSingleSortInfo<T>[] | null;
787
- }
788
- declare type DataSourceAggregationReducer<T, AggregationResultType> = {
789
- name?: string;
790
- field?: keyof T;
791
- initialValue?: AggregationResultType;
792
- getter?: (data: T) => any;
793
- reducer: string | ((accumulator: any, value: any, data: T) => AggregationResultType | any);
794
- done?: (accumulatedValue: AggregationResultType | any, array: T[]) => AggregationResultType;
795
- pivotColumn?: ColumnTypeWithInherit<Partial<InfiniteTableColumn<T>>> | (({ column, }: {
796
- column: InfiniteTablePivotFinalColumnVariant<T>;
797
- }) => ColumnTypeWithInherit<Partial<InfiniteTablePivotColumn<T>>>);
907
+ declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & InfiniteTableRowInfoDataDiscriminator<DATA_TYPE>;
908
+ declare type InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & {
909
+ rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<DATA_TYPE>;
910
+ isGroupRow: true;
911
+ data: Partial<DATA_TYPE> | null;
798
912
  };
799
- declare type ColumnTypeWithInherit<COL_TYPE> = COL_TYPE & {
800
- inheritFromColumn?: string | boolean;
913
+ declare type InfiniteTableColumnCellContextType<DATA_TYPE> = InfiniteTableColumnRenderParam<DATA_TYPE> & {};
914
+ declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> & {
915
+ collapsed: boolean;
916
+ groupIcon: Renderable;
801
917
  };
802
- declare type DataSourceMappings = Record<'totals' | 'values', string>;
803
- declare type LazyGroupDataItem<DataType> = {
804
- data: Partial<DataType>;
805
- keys: any[];
806
- aggregations?: Record<string, any>;
807
- dataset?: DataSourceRemoteData<DataType>;
808
- pivot?: {
809
- values: Record<string, any>;
810
- totals?: Record<string, any>;
811
- };
918
+ declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
919
+ declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
920
+ rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
921
+ data: DATA_TYPE | Partial<DATA_TYPE> | null;
922
+ dataArray: InfiniteTableRowInfo<DATA_TYPE>[];
923
+ rowIndex: number;
924
+ column: COL_TYPE;
812
925
  };
813
- declare type LazyRowInfoGroup<DataType> = {
926
+ declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
927
+ declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
928
+ declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderParams<T>) => Renderable;
929
+ declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
930
+ declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
931
+ declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
932
+ declare type InfiniteTableDataTypeNames = 'string' | 'number' | 'date' | string;
933
+ declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
934
+ declare type InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T> = RequireAtLeastOne<{
814
935
  /**
815
- * Those are direct children of the current lazy group row
936
+ * Determines the field property of the column.
816
937
  */
817
- children: LazyGroupDataItem<DataType>[];
818
- childrenLoading: boolean;
819
- childrenAvailable: boolean;
820
- cache: boolean;
821
- totalCount: number;
822
- error?: string;
823
- };
824
- declare type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyRowInfoGroup<DataType>>;
825
- interface DataSourceSetupState<T> {
826
- lazyLoadCacheOfLoadedBatches: DeepMap<string, true>;
827
- pivotMappings?: DataSourceMappings;
828
- propsCache: Map<keyof DataSourceProps<T>, WeakMap<any, any>>;
829
- showSeparatePivotColumnForSingleAggregation: boolean;
830
- dataParams?: DataSourceDataParams<T>;
831
- originalLazyGroupData: LazyGroupDataDeepMap<T>;
832
- originalLazyGroupDataChangeDetect: number | string;
833
- scrollStopDelayUpdatedByTable: number;
834
- notifyScrollbarsChange: SubscriptionCallback<Scrollbars>;
835
- notifyScrollStop: SubscriptionCallback<ScrollStopInfo>;
836
- notifyRenderRangeChange: SubscriptionCallback<RenderRange>;
837
- originalDataArray: T[];
838
- lastSortDataArray?: T[];
839
- lastGroupDataArray?: InfiniteTableRowInfo<T>[];
840
- dataArray: InfiniteTableRowInfo<T>[];
841
- groupDeepMap?: DeepMap<GroupKeyType, DeepMapGroupValueType<T, any>>;
842
- pivotTotalColumnPosition: InfiniteTablePropPivotTotalColumnPosition;
843
- pivotGrandTotalColumnPosition: InfiniteTablePropPivotGrandTotalColumnPosition;
844
- cursorId: number | symbol | DataSourceLivePaginationCursorValue;
845
- updatedAt: number;
846
- reducedAt: number;
847
- groupedAt: number;
848
- sortedAt: number;
849
- generateGroupRows: boolean;
850
- postSortDataArray?: T[];
851
- postGroupDataArray?: InfiniteTableRowInfo<T>[];
852
- pivotColumns?: Map<string, InfiniteTableColumn<T>>;
853
- pivotColumnGroups?: Map<string, InfiniteTableColumnGroup>;
854
- }
855
- declare type DataSourcePropAggregationReducers<T> = Record<string, DataSourceAggregationReducer<T, any>>;
856
- declare type DataSourceProps<T> = {
857
- children: React$1.ReactNode | ((contextData: DataSourceState<T>) => React$1.ReactNode);
858
- primaryKey: keyof T;
859
- fields?: (keyof T)[];
860
- data: DataSourceData<T>;
861
- lazyLoad?: boolean | {
862
- batchSize?: number;
938
+ field?: keyof T;
939
+ render?: InfiniteTableColumnRenderFunction<T>;
940
+ renderValue?: InfiniteTableColumnRenderFunction<T>;
941
+ valueGetter?: InfiniteTableColumnValueGetter<T>;
942
+ valueFormatter?: InfiniteTableColumnValueFormatter<T>;
943
+ }, 'render' | 'renderValue' | 'field' | 'valueGetter' | 'valueFormatter'>;
944
+ declare type InfiniteTableColumnStyleFnParams<T> = {
945
+ value: Renderable;
946
+ column: InfiniteTableColumn<T>;
947
+ } & InfiniteTableRowInfoDataDiscriminator<T>;
948
+ declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React.CSSProperties;
949
+ declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
950
+ declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
951
+ declare type InfiniteTableColumnClassName<T> = string | InfiniteTableColumnClassNameFn<T>;
952
+ declare type InfiniteTableColumnValueGetterParams<T> = {
953
+ data: T;
954
+ field?: keyof T;
955
+ };
956
+ declare type InfiniteTableColumnValueFormatterParams<T> = InfiniteTableRowInfoDataDiscriminator<T>;
957
+ declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = string | number | boolean | Date | null | undefined> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
958
+ declare type InfiniteTableColumnValueFormatter<T, VALUE_FORMATTER_TYPE = string | number | boolean | Date | null | undefined> = (params: InfiniteTableColumnValueFormatterParams<T>) => VALUE_FORMATTER_TYPE;
959
+ declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
960
+ declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
961
+ declare type InfiniteTableBaseColumn<T> = {
962
+ sortable?: boolean;
963
+ draggable?: boolean;
964
+ resizable?: boolean;
965
+ comparer?: InfiniteTableColumnComparer<T>;
966
+ defaultHiddenWhenGroupedBy?: '*' | keyof T | {
967
+ [k in keyof Partial<T>]: true;
968
+ };
969
+ align?: InfiniteTableColumnAlign;
970
+ verticalAlign?: InfiniteTableColumnVerticalAlign;
971
+ columnGroup?: string;
972
+ header?: InfiniteTableColumnHeader<T>;
973
+ name?: Renderable;
974
+ cssEllipsis?: boolean;
975
+ headerCssEllipsis?: boolean;
976
+ type?: InfiniteTableColumnTypeNames | InfiniteTableColumnTypeNames[] | null;
977
+ dataType?: InfiniteTableDataTypeNames;
978
+ sortType?: string;
979
+ filterType?: string;
980
+ style?: InfiniteTableColumnStyle<T>;
981
+ className?: InfiniteTableColumnClassName<T>;
982
+ rowspan?: InfiniteTableColumnRowspanFn<T>;
983
+ valueGetter?: InfiniteTableColumnValueGetter<T>;
984
+ valueFormatter?: InfiniteTableColumnValueFormatter<T>;
985
+ defaultWidth?: number;
986
+ defaultFlex?: number;
987
+ defaultFilterable?: boolean;
988
+ minWidth?: number;
989
+ maxWidth?: number;
990
+ components?: {
991
+ ColumnCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
992
+ HeaderCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
863
993
  };
864
- loading?: boolean;
865
- defaultLoading?: boolean;
866
- onLoadingChange?: (loading: boolean) => void;
867
- pivotBy?: DataSourcePropPivotBy<T>;
868
- defaultPivotBy?: DataSourcePropPivotBy<T>;
869
- onPivotByChange?: (pivotBy: DataSourcePropPivotBy<T>) => void;
870
- aggregationReducers?: DataSourcePropAggregationReducers<T>;
871
- defaultAggregationReducers?: DataSourcePropAggregationReducers<T>;
872
- groupBy?: DataSourcePropGroupBy<T>;
873
- defaultGroupBy?: DataSourcePropGroupBy<T>;
874
- onGroupByChange?: (groupBy: DataSourcePropGroupBy<T>) => void;
875
- groupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<any>;
876
- defaultGroupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<keyof T>;
877
- onGroupRowsStateChange?: (groupRowsState: GroupRowsState) => void;
878
- collapseGroupRowsOnDataFunctionChange?: boolean;
879
- sortInfo?: DataSourceSortInfo<T>;
880
- defaultSortInfo?: DataSourceSortInfo<T>;
881
- onSortInfoChange?: ((sortInfo: DataSourceSingleSortInfo<T> | null) => void) | ((sortInfo: DataSourceSingleSortInfo<T>[]) => void);
882
- onDataParamsChange?: (dataParamsChange: DataSourceDataParams<T>) => void;
883
- livePagination?: boolean;
884
- livePaginationCursor?: DataSourcePropLivePaginationCursor<T>;
885
- onLivePaginationCursorChange?: (livePaginationCursor: DataSourceLivePaginationCursorValue) => void;
886
994
  };
887
- declare type DataSourcePropLivePaginationCursor<T> = DataSourceLivePaginationCursorValue | DataSourceLivePaginationCursorFn<T>;
888
- declare type DataSourceLivePaginationCursorFn<T> = (params: DataSourceLivePaginationCursorParams<T>) => DataSourceLivePaginationCursorValue;
889
- declare type DataSourceLivePaginationCursorParams<T> = {
890
- array: T[];
891
- lastItem: T | Partial<T> | null;
892
- length: number;
995
+ /**
996
+ * Defines a column in the table.
997
+ *
998
+ * @typeParam DATA_TYPE The type of the data in the table.
999
+ *
1000
+ * Can be bound to a field which is a `keyof DATA_TYPE`.
1001
+ */
1002
+ declare type InfiniteTableColumn<DATA_TYPE> = {} & InfiniteTableBaseColumn<DATA_TYPE> & InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<DATA_TYPE>;
1003
+ declare type InfiniteTableGeneratedGroupColumn<T> = InfiniteTableColumn<T> & {
1004
+ groupByField: string | string[];
1005
+ id?: string;
893
1006
  };
894
- declare type DataSourceLivePaginationCursorValue = string | number | null;
895
- interface DataSourceState<T> extends DataSourceSetupState<T>, DataSourceDerivedState<T>, DataSourceMappedState<T> {
896
- }
897
- interface DataSourceDerivedState<_T> {
898
- multiSort: boolean;
899
- controlledSort: boolean;
900
- livePaginationCursor?: DataSourceLivePaginationCursorValue;
901
- lazyLoadBatchSize?: number;
902
- }
903
- declare type DataSourceComponentActions<T> = ComponentStateActions<DataSourceState<T>>;
904
- interface DataSourceContextValue<T> {
905
- getState: () => DataSourceState<T>;
906
- componentState: DataSourceState<T>;
907
- componentActions: DataSourceComponentActions<T>;
908
- }
909
- declare enum DataSourceActionType {
910
- INIT = "INIT"
911
- }
912
- interface DataSourceAction<T> {
913
- type: DataSourceActionType;
914
- payload: T;
915
- }
916
- interface DataSourceReducer<T> {
917
- (state: DataSourceState<T>, action: DataSourceAction<any>): DataSourceState<T>;
918
- }
919
-
920
- declare class GroupRowsState<KeyType extends any = any> {
921
- private expandedMap?;
922
- private collapsedMap?;
923
- private collapsedAll;
924
- private expandedAll;
925
- private initialState;
926
- constructor(state: DataSourcePropGroupRowsStateObject<KeyType> | GroupRowsState<KeyType>);
927
- getState(): DataSourcePropGroupRowsStateObject<KeyType>;
928
- destroy(): void;
929
- private update;
930
- areAllCollapsed(): boolean;
931
- areAllExpanded(): boolean;
932
- collapseAll(): void;
933
- expandAll(): void;
934
- isGroupRowExpanded(keys: KeyType[]): boolean | undefined;
935
- isGroupRowCollapsed(keys: KeyType[]): boolean;
936
- setGroupRowExpanded(keys: KeyType[], shouldExpand: boolean): void;
937
- collapseGroupRow(keys: KeyType[]): void;
938
- expandGroupRow(keys: KeyType[]): void;
939
- toggleGroupRow(keys: KeyType[]): void;
940
- }
1007
+ declare type InfiniteTablePivotColumn<T> = InfiniteTableColumn<T> & ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnVariant<T, any>>>;
1008
+ declare type InfiniteTablePivotFinalColumnGroup<DataType, KeyType extends any = any> = InfiniteTableColumnGroup & {
1009
+ pivotBy: DataSourcePivotBy<DataType>[];
1010
+ pivotTotalColumnGroup?: true;
1011
+ pivotGroupKeys: KeyType[];
1012
+ pivotByAtIndex: PivotBy<DataType, KeyType>;
1013
+ pivotGroupKey: KeyType;
1014
+ pivotIndex: number;
1015
+ };
1016
+ declare type InfiniteTablePivotFinalColumn<DataType, KeyType extends any = any> = InfiniteTableColumn<DataType> & {
1017
+ pivotBy: DataSourcePivotBy<DataType>[];
1018
+ pivotColumn: true;
1019
+ pivotTotalColumn: boolean;
1020
+ pivotAggregator: AggregationReducer<DataType, any>;
1021
+ pivotAggregatorIndex: number;
1022
+ pivotGroupKeys: KeyType[];
1023
+ pivotByAtIndex?: PivotBy<DataType, KeyType>;
1024
+ pivotIndex: number;
1025
+ pivotGroupKey: KeyType;
1026
+ };
1027
+ declare type InfiniteTablePivotFinalColumnVariant<DataType, KeyType extends any = any> = InfiniteTablePivotFinalColumn<DataType, KeyType>;
1028
+ declare type InfiniteTableComputedColumnBase<T> = {
1029
+ computedFilterType: string;
1030
+ computedSortType: string;
1031
+ computedDataType: string;
1032
+ computedWidth: number;
1033
+ computedOffset: number;
1034
+ computedPinningOffset: number;
1035
+ computedAbsoluteOffset: number;
1036
+ computedSortable: boolean;
1037
+ computedSortInfo: DataSourceSingleSortInfo<T> | null;
1038
+ computedSorted: boolean;
1039
+ computedSortedAsc: boolean;
1040
+ computedSortedDesc: boolean;
1041
+ computedSortIndex: number;
1042
+ computedVisibleIndex: number;
1043
+ computedMultiSort: boolean;
1044
+ computedFiltered: boolean;
1045
+ computedFilterable: boolean;
1046
+ computedFilterValue: DataSourceFilterValueItem<T> | null;
1047
+ computedPinned: InfiniteTableColumnPinnedValues;
1048
+ computedDraggable: boolean;
1049
+ computedFirstInCategory: boolean;
1050
+ computedLastInCategory: boolean;
1051
+ computedFirst: boolean;
1052
+ computedLast: boolean;
1053
+ toggleSort: () => void;
1054
+ id: string;
1055
+ };
1056
+ declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteTableComputedColumnBase<T> & Partial<InfiniteTablePivotFinalColumn<T>> & Partial<InfiniteTableGeneratedGroupColumn<T>>;
1057
+ declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
941
1058
 
942
1059
  declare type AggregationReducer<T, AggregationResultType = any> = DataSourceAggregationReducer<T, AggregationResultType> & {
943
1060
  id: string;
@@ -959,10 +1076,14 @@ declare type InfiniteTableRowInfoDataDiscriminator<T> = {
959
1076
  data: T;
960
1077
  isGroupRow: false;
961
1078
  rowInfo: InfiniteTable_NoGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoNormal<T>;
1079
+ field?: keyof T;
1080
+ value: any;
962
1081
  } | {
963
1082
  data: Partial<T> | null;
964
1083
  rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<T>;
965
1084
  isGroupRow: true;
1085
+ field?: keyof T;
1086
+ value: any;
966
1087
  };
967
1088
  /**
968
1089
  * This is the base row info for all scenarios - things every
@@ -988,6 +1109,7 @@ declare type InfiniteTable_HasGrouping_RowInfoGroup<T> = {
988
1109
  * in the order in which they are visible in the table
989
1110
  */
990
1111
  deepRowInfoArray: (InfiniteTable_HasGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoGroup<T>)[];
1112
+ error?: string;
991
1113
  reducerResults?: Record<string, AggregationReducerResult>;
992
1114
  /**
993
1115
  * The count of all leaf nodes (normal rows) that are inside this group.
@@ -1182,177 +1304,292 @@ declare type DataGroupResult<DataType, KeyType extends any> = {
1182
1304
  declare function group<DataType, KeyType = any>(groupParams: GroupParams<DataType, KeyType>, data: DataType[]): DataGroupResult<DataType, KeyType>;
1183
1305
  declare function flatten<DataType, KeyType extends any>(groupResult: DataGroupResult<DataType, KeyType>): DataType[];
1184
1306
 
1185
- declare type InfiniteTableCellProps<T> = {
1186
- column: InfiniteTableComputedColumn<T>;
1187
- renderChildren: () => Renderable;
1188
- width: number;
1189
- cssEllipsis?: boolean;
1190
- virtualized?: boolean;
1191
- skipColumnShifting?: boolean;
1192
- beforeChildren?: Renderable;
1193
- afterChildren?: Renderable;
1194
- offset?: number;
1195
- offsetProperty?: 'left' | 'right';
1196
- cssPosition?: CSSProperties['position'];
1197
- domRef?: React.RefCallback<HTMLElement>;
1198
- cellType: 'body' | 'header';
1307
+ declare type SortDir = 1 | -1;
1308
+ declare type MultisortInfo<T> = {
1309
+ /**
1310
+ * The sorting direction
1311
+ */
1312
+ dir: SortDir;
1313
+ /**
1314
+ * for now 'string' and 'number' are known types, meaning they have
1315
+ * sort functions already implemented
1316
+ */
1317
+ type?: string;
1318
+ fn?: (a: any, b: any) => number;
1319
+ /**
1320
+ * a property whose value to use for sorting on the array items
1321
+ */
1322
+ field?: keyof T;
1323
+ /**
1324
+ * or a function to retrieve the item value to use for sorting
1325
+ */
1326
+ valueGetter?: (item: T) => any;
1327
+ };
1328
+ declare const multisort: {
1329
+ <T>(sortInfo: MultisortInfo<T>[], array: T[], get?: ((item: any) => T) | undefined): T[];
1330
+ knownTypes: {
1331
+ [key: string]: (first: any, second: any) => number;
1332
+ };
1199
1333
  };
1200
1334
 
1201
- declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
1202
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
1203
- }[Keys];
1204
-
1205
- declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
1206
- declare type InfiniteTableColumnHeaderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1207
- domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
1208
- sortTool: JSX.Element;
1209
- column: COL_TYPE;
1210
- columnSortInfo: DataSourceSingleSortInfo<DATA_TYPE> | null;
1335
+ declare type RenderRange = {
1336
+ renderStartIndex: number;
1337
+ renderEndIndex: number;
1211
1338
  };
1212
- declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1213
- domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
1214
- value: string | number | Renderable;
1215
- groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
1216
- rowIndex: number;
1217
- column: COL_TYPE;
1218
- toggleCurrentGroupRow: () => void;
1219
- toggleGroupRow: InfiniteTableToggleGroupRowFn;
1220
- groupBy: DataSourceState<DATA_TYPE>['groupBy'];
1221
- pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
1339
+
1340
+ interface DataSourceDataParams<T> {
1341
+ originalDataArray: T[];
1342
+ sortInfo?: DataSourceSortInfo<T>;
1343
+ groupBy?: DataSourcePropGroupBy<T>;
1344
+ pivotBy?: DataSourcePropPivotBy<T>;
1345
+ filterValue?: DataSourcePropFilterValue<T>;
1346
+ groupRowsState?: DataSourcePropGroupRowsStateObject<any>;
1347
+ lazyLoadBatchSize?: number;
1348
+ lazyLoadStartIndex?: number;
1349
+ groupKeys?: any[];
1350
+ append?: boolean;
1351
+ aggregationReducers?: DataSourcePropAggregationReducers<T>;
1352
+ livePaginationCursor?: DataSourceLivePaginationCursorValue;
1353
+ __cursorId?: DataSourceSetupState<T>['cursorId'];
1354
+ changes?: DataSourceDataParamsChanges<T>;
1355
+ }
1356
+ declare type DataSourceDataParamsChanges<T> = Partial<Record<keyof Omit<DataSourceDataParams<T>, 'originalDataArray' | 'changes'>, true>>;
1357
+ declare type DataSourceSingleSortInfo<T> = MultisortInfo<T> & {
1358
+ field?: keyof T;
1359
+ id?: string;
1222
1360
  };
1223
- declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & InfiniteTableRowInfoDataDiscriminator<DATA_TYPE>;
1224
- declare type InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & {
1225
- rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<DATA_TYPE>;
1226
- isGroupRow: true;
1227
- data: Partial<DATA_TYPE> | null;
1361
+ declare type DataSourceGroupBy<T> = GroupBy<T, any>;
1362
+ declare type DataSourcePivotBy<T> = PivotBy<T, any>;
1363
+ declare type DataSourceSortInfo<T> = null | DataSourceSingleSortInfo<T> | DataSourceSingleSortInfo<T>[];
1364
+ declare type DataSourcePropSortInfo<T> = DataSourceSortInfo<T>;
1365
+ declare type DataSourceRemoteData<T> = {
1366
+ data: T[] | LazyGroupDataItem<T>[];
1367
+ mappings?: DataSourceMappings;
1368
+ cache?: boolean;
1369
+ error?: string;
1370
+ totalCount?: number;
1371
+ totalCountUnfiltered?: number;
1372
+ livePaginationCursor?: DataSourceLivePaginationCursorValue;
1228
1373
  };
1229
- declare type InfiniteTableColumnCellContextType<DATA_TYPE> = InfiniteTableColumnRenderParam<DATA_TYPE> & {};
1230
- declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> & {
1231
- collapsed: boolean;
1232
- groupIcon: Renderable;
1374
+ declare type DataSourceData<T> = T[] | DataSourceRemoteData<T> | Promise<T[] | DataSourceRemoteData<T>> | ((dataInfo: DataSourceDataParams<T>) => T[] | Promise<T[] | DataSourceRemoteData<T>>);
1375
+ declare type DataSourceGroupRowsList<KeyType> = true | KeyType[][];
1376
+ declare type DataSourcePropGroupRowsStateObject<KeyType> = {
1377
+ expandedRows: DataSourceGroupRowsList<KeyType>;
1378
+ collapsedRows: DataSourceGroupRowsList<KeyType>;
1233
1379
  };
1234
- declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
1235
- declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1236
- rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
1237
- data: DATA_TYPE | Partial<DATA_TYPE> | null;
1238
- dataArray: InfiniteTableRowInfo<DATA_TYPE>[];
1239
- rowIndex: number;
1240
- column: COL_TYPE;
1380
+ declare type DataSourcePropGroupBy<T> = DataSourceGroupBy<T>[];
1381
+ declare type DataSourcePropPivotBy<T> = DataSourcePivotBy<T>[];
1382
+ interface DataSourceMappedState<T> {
1383
+ aggregationReducers?: DataSourceProps<T>['aggregationReducers'];
1384
+ livePagination: DataSourceProps<T>['livePagination'];
1385
+ lazyLoad: DataSourceProps<T>['lazyLoad'];
1386
+ onDataParamsChange: DataSourceProps<T>['onDataParamsChange'];
1387
+ data: DataSourceProps<T>['data'];
1388
+ sortMode: DataSourceProps<T>['sortMode'];
1389
+ filterFunction: DataSourceProps<T>['filterFunction'];
1390
+ filterValue: DataSourceProps<T>['filterValue'];
1391
+ filterTypes: NonUndefined<DataSourceProps<T>['filterTypes']>;
1392
+ primaryKey: DataSourceProps<T>['primaryKey'];
1393
+ filterDelay: NonUndefined<DataSourceProps<T>['filterDelay']>;
1394
+ groupBy: NonUndefined<DataSourceProps<T>['groupBy']>;
1395
+ groupRowsState: GroupRowsState<T>;
1396
+ pivotBy: DataSourceProps<T>['pivotBy'];
1397
+ loading: NonUndefined<DataSourceProps<T>['loading']>;
1398
+ sortTypes: NonUndefined<DataSourceProps<T>['sortTypes']>;
1399
+ collapseGroupRowsOnDataFunctionChange: NonUndefined<DataSourceProps<T>['collapseGroupRowsOnDataFunctionChange']>;
1400
+ sortInfo: DataSourceSingleSortInfo<T>[] | null;
1401
+ }
1402
+ declare type DataSourceAggregationReducer<T, AggregationResultType> = {
1403
+ name?: string;
1404
+ field?: keyof T;
1405
+ initialValue?: AggregationResultType;
1406
+ getter?: (data: T) => any;
1407
+ reducer: string | ((accumulator: any, value: any, data: T) => AggregationResultType | any);
1408
+ done?: (accumulatedValue: AggregationResultType | any, array: T[]) => AggregationResultType;
1409
+ pivotColumn?: ColumnTypeWithInherit<Partial<InfiniteTableColumn<T>>> | (({ column, }: {
1410
+ column: InfiniteTablePivotFinalColumnVariant<T>;
1411
+ }) => ColumnTypeWithInherit<Partial<InfiniteTablePivotColumn<T>>>);
1241
1412
  };
1242
- declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
1243
- declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
1244
- declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderParams<T>) => Renderable;
1245
- declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
1246
- declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
1247
- declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
1248
- declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
1249
- declare type InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T> = RequireAtLeastOne<{
1413
+ declare type ColumnTypeWithInherit<COL_TYPE> = COL_TYPE & {
1414
+ inheritFromColumn?: string | boolean;
1415
+ };
1416
+ declare type DataSourceMappings = Record<'totals' | 'values', string>;
1417
+ declare type LazyGroupDataItem<DataType> = {
1418
+ data: Partial<DataType>;
1419
+ keys: any[];
1420
+ aggregations?: Record<string, any>;
1421
+ dataset?: DataSourceRemoteData<DataType>;
1422
+ pivot?: {
1423
+ values: Record<string, any>;
1424
+ totals?: Record<string, any>;
1425
+ };
1426
+ };
1427
+ declare type LazyRowInfoGroup<DataType> = {
1250
1428
  /**
1251
- * Determines the field property of the column.
1429
+ * Those are direct children of the current lazy group row
1252
1430
  */
1253
- field?: keyof T;
1254
- render?: InfiniteTableColumnRenderFunction<T>;
1255
- renderValue?: InfiniteTableColumnRenderFunction<T>;
1256
- valueGetter?: InfiniteTableColumnValueGetter<T>;
1257
- }, 'render' | 'renderValue' | 'field' | 'valueGetter'>;
1258
- declare type InfiniteTableColumnStyleFnParams<T> = {
1259
- value: Renderable;
1260
- column: InfiniteTableColumn<T>;
1261
- } & InfiniteTableRowInfoDataDiscriminator<T>;
1262
- declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React.CSSProperties;
1263
- declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
1264
- declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
1265
- declare type InfiniteTableColumnClassName<T> = string | InfiniteTableColumnClassNameFn<T>;
1266
- declare type InfiniteTableColumnValueGetterParams<T> = InfiniteTableRowInfoDataDiscriminator<T>;
1267
- declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = string | number | boolean | null | undefined> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
1268
- declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
1269
- declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
1270
- declare type InfiniteTableBaseColumn<T> = {
1271
- sortable?: boolean;
1272
- draggable?: boolean;
1273
- resizable?: boolean;
1274
- comparer?: InfiniteTableColumnComparer<T>;
1275
- defaultHiddenWhenGroupedBy?: '*' | keyof T | {
1276
- [k in keyof Partial<T>]: true;
1277
- };
1278
- align?: InfiniteTableColumnAlign;
1279
- verticalAlign?: InfiniteTableColumnVerticalAlign;
1280
- columnGroup?: string;
1281
- header?: InfiniteTableColumnHeader<T>;
1282
- name?: Renderable;
1283
- cssEllipsis?: boolean;
1284
- headerCssEllipsis?: boolean;
1285
- type?: InfiniteTableColumnTypeNames | InfiniteTableColumnTypeNames[] | null;
1286
- style?: InfiniteTableColumnStyle<T>;
1287
- className?: InfiniteTableColumnClassName<T>;
1288
- rowspan?: InfiniteTableColumnRowspanFn<T>;
1289
- valueGetter?: InfiniteTableColumnValueGetter<T>;
1290
- defaultWidth?: number;
1291
- defaultFlex?: number;
1292
- minWidth?: number;
1293
- maxWidth?: number;
1294
- components?: {
1295
- ColumnCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
1296
- HeaderCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
1431
+ children: LazyGroupDataItem<DataType>[];
1432
+ childrenLoading: boolean;
1433
+ childrenAvailable: boolean;
1434
+ cache: boolean;
1435
+ totalCount: number;
1436
+ totalCountUnfiltered: number;
1437
+ error?: string;
1438
+ };
1439
+ declare type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyRowInfoGroup<DataType>>;
1440
+ interface DataSourceSetupState<T> {
1441
+ unfilteredCount: number;
1442
+ filteredCount: number;
1443
+ lazyLoadCacheOfLoadedBatches: DeepMap<string, true>;
1444
+ pivotMappings?: DataSourceMappings;
1445
+ propsCache: Map<keyof DataSourceProps<T>, WeakMap<any, any>>;
1446
+ showSeparatePivotColumnForSingleAggregation: boolean;
1447
+ dataParams?: DataSourceDataParams<T>;
1448
+ originalLazyGroupData: LazyGroupDataDeepMap<T>;
1449
+ originalLazyGroupDataChangeDetect: number | string;
1450
+ scrollStopDelayUpdatedByTable: number;
1451
+ notifyScrollbarsChange: SubscriptionCallback<Scrollbars>;
1452
+ notifyScrollStop: SubscriptionCallback<ScrollStopInfo>;
1453
+ notifyRenderRangeChange: SubscriptionCallback<RenderRange>;
1454
+ originalDataArray: T[];
1455
+ lastFilterDataArray?: T[];
1456
+ lastSortDataArray?: T[];
1457
+ lastGroupDataArray?: InfiniteTableRowInfo<T>[];
1458
+ dataArray: InfiniteTableRowInfo<T>[];
1459
+ groupDeepMap?: DeepMap<GroupKeyType, DeepMapGroupValueType<T, any>>;
1460
+ pivotTotalColumnPosition: InfiniteTablePropPivotTotalColumnPosition;
1461
+ pivotGrandTotalColumnPosition: InfiniteTablePropPivotGrandTotalColumnPosition;
1462
+ cursorId: number | symbol | DataSourceLivePaginationCursorValue;
1463
+ updatedAt: number;
1464
+ reducedAt: number;
1465
+ groupedAt: number;
1466
+ sortedAt: number;
1467
+ filteredAt: number;
1468
+ generateGroupRows: boolean;
1469
+ postFilterDataArray?: T[];
1470
+ postSortDataArray?: T[];
1471
+ postGroupDataArray?: InfiniteTableRowInfo<T>[];
1472
+ pivotColumns?: Map<string, InfiniteTableColumn<T>>;
1473
+ pivotColumnGroups?: Map<string, InfiniteTableColumnGroup>;
1474
+ }
1475
+ declare type DataSourcePropAggregationReducers<T> = Record<string, DataSourceAggregationReducer<T, any>>;
1476
+ declare type DataSourceProps<T> = {
1477
+ children: React$1.ReactNode | ((contextData: DataSourceState<T>) => React$1.ReactNode);
1478
+ primaryKey: keyof T | (({ data, index }: {
1479
+ data: T;
1480
+ index: number;
1481
+ }) => string);
1482
+ fields?: (keyof T)[];
1483
+ data: DataSourceData<T>;
1484
+ lazyLoad?: boolean | {
1485
+ batchSize?: number;
1297
1486
  };
1487
+ loading?: boolean;
1488
+ defaultLoading?: boolean;
1489
+ onLoadingChange?: (loading: boolean) => void;
1490
+ pivotBy?: DataSourcePropPivotBy<T>;
1491
+ defaultPivotBy?: DataSourcePropPivotBy<T>;
1492
+ onPivotByChange?: (pivotBy: DataSourcePropPivotBy<T>) => void;
1493
+ aggregationReducers?: DataSourcePropAggregationReducers<T>;
1494
+ defaultAggregationReducers?: DataSourcePropAggregationReducers<T>;
1495
+ groupBy?: DataSourcePropGroupBy<T>;
1496
+ defaultGroupBy?: DataSourcePropGroupBy<T>;
1497
+ onGroupByChange?: (groupBy: DataSourcePropGroupBy<T>) => void;
1498
+ groupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<any>;
1499
+ defaultGroupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<keyof T>;
1500
+ onGroupRowsStateChange?: (groupRowsState: GroupRowsState) => void;
1501
+ collapseGroupRowsOnDataFunctionChange?: boolean;
1502
+ sortInfo?: DataSourceSortInfo<T>;
1503
+ defaultSortInfo?: DataSourceSortInfo<T>;
1504
+ onSortInfoChange?: ((sortInfo: DataSourceSingleSortInfo<T> | null) => void) | ((sortInfo: DataSourceSingleSortInfo<T>[]) => void);
1505
+ onDataParamsChange?: (dataParamsChange: DataSourceDataParams<T>) => void;
1506
+ livePagination?: boolean;
1507
+ livePaginationCursor?: DataSourcePropLivePaginationCursor<T>;
1508
+ onLivePaginationCursorChange?: (livePaginationCursor: DataSourceLivePaginationCursorValue) => void;
1509
+ filterFunction?: DataSourcePropFilterFunction<T>;
1510
+ sortMode?: 'local' | 'remote';
1511
+ filterMode?: 'local' | 'remote';
1512
+ filterValue?: DataSourcePropFilterValue<T>;
1513
+ defaultFilterValue?: DataSourcePropFilterValue<T>;
1514
+ onFilterValueChange?: (filterValue: DataSourcePropFilterValue<T>) => void;
1515
+ filterDelay?: number;
1516
+ filterTypes?: DataSourcePropFilterTypes<T>;
1517
+ sortTypes?: DataSourcePropSortTypes;
1298
1518
  };
1299
- /**
1300
- * Defines a column in the table.
1301
- *
1302
- * @typeParam DATA_TYPE The type of the data in the table.
1303
- *
1304
- * Can be bound to a field which is a `keyof DATA_TYPE`.
1305
- */
1306
- declare type InfiniteTableColumn<DATA_TYPE> = {} & InfiniteTableBaseColumn<DATA_TYPE> & InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<DATA_TYPE>;
1307
- declare type InfiniteTableGeneratedGroupColumn<T> = InfiniteTableColumn<T> & {
1308
- groupByField: string | string[];
1309
- id?: string;
1519
+ declare type DataSourcePropSortTypes = Record<string, (first: any, second: any) => number>;
1520
+ declare type DataSourcePropFilterTypes<T> = Record<string, DataSourceFilterType<T>>;
1521
+ declare type DataSourceFilterFunctionParam<T> = {
1522
+ data: T;
1523
+ index: number;
1524
+ dataArray: T[];
1525
+ primaryKey: any;
1310
1526
  };
1311
- declare type InfiniteTablePivotColumn<T> = InfiniteTableColumn<T> & ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnVariant<T, any>>>;
1312
- declare type InfiniteTablePivotFinalColumnGroup<DataType, KeyType extends any = any> = InfiniteTableColumnGroup & {
1313
- pivotBy: DataSourcePivotBy<DataType>[];
1314
- pivotTotalColumnGroup?: true;
1315
- pivotGroupKeys: KeyType[];
1316
- pivotByAtIndex: PivotBy<DataType, KeyType>;
1317
- pivotGroupKey: KeyType;
1318
- pivotIndex: number;
1527
+ declare type DataSourcePropFilterFunction<T> = (filterParam: DataSourceFilterFunctionParam<T>) => boolean;
1528
+ declare type DataSourcePropFilterValue<T> = DataSourceFilterValueItem<T>[];
1529
+ declare type DataSourceFilterValueItem<T> = DiscriminatedUnion<{
1530
+ field: keyof T;
1531
+ }, {
1532
+ id: string;
1533
+ }> & {
1534
+ valueGetter?: DataSourceFilterValueItemValueGetter<T>;
1535
+ filterValue: any;
1536
+ disabled?: boolean;
1537
+ filterType: string;
1538
+ operator: string;
1319
1539
  };
1320
- declare type InfiniteTablePivotFinalColumn<DataType, KeyType extends any = any> = InfiniteTableColumn<DataType> & {
1321
- pivotBy: DataSourcePivotBy<DataType>[];
1322
- pivotColumn: true;
1323
- pivotTotalColumn: boolean;
1324
- pivotAggregator: AggregationReducer<DataType, any>;
1325
- pivotAggregatorIndex: number;
1326
- pivotGroupKeys: KeyType[];
1327
- pivotByAtIndex?: PivotBy<DataType, KeyType>;
1328
- pivotIndex: number;
1329
- pivotGroupKey: KeyType;
1540
+ declare type DataSourceFilterValueItemValueGetter<T> = (param: DataSourceFilterFunctionParam<T>) => any;
1541
+ declare type DataSourceFilterType<T> = {
1542
+ emptyValues: Set<any>;
1543
+ label?: string;
1544
+ defaultOperator: string;
1545
+ operators: DataSourceFilterOperator<T>[];
1330
1546
  };
1331
- declare type InfiniteTablePivotFinalColumnVariant<DataType, KeyType extends any = any> = InfiniteTablePivotFinalColumn<DataType, KeyType>;
1332
- declare type InfiniteTableComputedColumnBase<T> = {
1333
- computedWidth: number;
1334
- computedOffset: number;
1335
- computedPinningOffset: number;
1336
- computedAbsoluteOffset: number;
1337
- computedSortable: boolean;
1338
- computedSortInfo: DataSourceSingleSortInfo<T> | null;
1339
- computedSorted: boolean;
1340
- computedSortedAsc: boolean;
1341
- computedSortedDesc: boolean;
1342
- computedSortIndex: number;
1343
- computedVisibleIndex: number;
1344
- computedMultiSort: boolean;
1345
- computedPinned: InfiniteTableColumnPinnedValues;
1346
- computedDraggable: boolean;
1347
- computedFirstInCategory: boolean;
1348
- computedLastInCategory: boolean;
1349
- computedFirst: boolean;
1350
- computedLast: boolean;
1351
- toggleSort: () => void;
1352
- id: string;
1547
+ declare type DataSourceFilterOperator<T> = {
1548
+ name: string;
1549
+ label?: string;
1550
+ fn: DataSourceFilterOperatorFunction<T>;
1353
1551
  };
1354
- declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteTableComputedColumnBase<T> & Partial<InfiniteTablePivotFinalColumn<T>> & Partial<InfiniteTableGeneratedGroupColumn<T>>;
1355
- declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
1552
+ declare type DataSourceFilterOperatorFunction<T> = (filterOperatorFunctionParam: DataSourceFilterOperatorFunctionParam<T>) => boolean;
1553
+ declare type DataSourceFilterOperatorFunctionParam<T> = {
1554
+ currentValue: any;
1555
+ filterValue: any;
1556
+ emptyValues: Set<any>;
1557
+ } & DataSourceFilterFunctionParam<T>;
1558
+ declare type DataSourcePropLivePaginationCursor<T> = DataSourceLivePaginationCursorValue | DataSourceLivePaginationCursorFn<T>;
1559
+ declare type DataSourceLivePaginationCursorFn<T> = (params: DataSourceLivePaginationCursorParams<T>) => DataSourceLivePaginationCursorValue;
1560
+ declare type DataSourceLivePaginationCursorParams<T> = {
1561
+ array: T[];
1562
+ lastItem: T | Partial<T> | null;
1563
+ length: number;
1564
+ };
1565
+ declare type DataSourceLivePaginationCursorValue = string | number | null;
1566
+ interface DataSourceState<T> extends DataSourceSetupState<T>, DataSourceDerivedState<T>, DataSourceMappedState<T> {
1567
+ }
1568
+ interface DataSourceDerivedState<T> {
1569
+ operatorsByFilterType: Record<string, Record<string, DataSourceFilterOperator<T>>>;
1570
+ filterMode: NonUndefined<DataSourceProps<T>['filterMode']>;
1571
+ multiSort: boolean;
1572
+ controlledSort: boolean;
1573
+ controlledFilter: boolean;
1574
+ livePaginationCursor?: DataSourceLivePaginationCursorValue;
1575
+ lazyLoadBatchSize?: number;
1576
+ }
1577
+ declare type DataSourceComponentActions<T> = ComponentStateActions<DataSourceState<T>>;
1578
+ interface DataSourceContextValue<T> {
1579
+ getState: () => DataSourceState<T>;
1580
+ componentState: DataSourceState<T>;
1581
+ componentActions: DataSourceComponentActions<T>;
1582
+ }
1583
+ declare enum DataSourceActionType {
1584
+ INIT = "INIT"
1585
+ }
1586
+ interface DataSourceAction<T> {
1587
+ type: DataSourceActionType;
1588
+ payload: T;
1589
+ }
1590
+ interface DataSourceReducer<T> {
1591
+ (state: DataSourceState<T>, action: DataSourceAction<any>): DataSourceState<T>;
1592
+ }
1356
1593
 
1357
1594
  declare function useInfiniteHeaderCell<T>(): InfiniteTableColumnHeaderParams<T, InfiniteTableComputedColumn<T>>;
1358
1595
 
@@ -1364,10 +1601,12 @@ declare function InfiniteTable<T>(props: InfiniteTableProps<T>): JSX.Element;
1364
1601
  declare namespace InfiniteTable {
1365
1602
  var defaultProps: {
1366
1603
  rowHeight: number;
1367
- headerHeight: _vanilla_extract_private.CSSVarFunction;
1604
+ columnHeaderHeight: _vanilla_extract_private.CSSVarFunction;
1368
1605
  };
1369
1606
  }
1370
1607
 
1608
+ declare const defaultFilterTypes: Record<string, DataSourceFilterType<any>>;
1609
+
1371
1610
  declare function useDataSource<T>(): DataSourceState<T>;
1372
1611
 
1373
1612
  declare function DataSource<T>(props: DataSourceProps<T>): JSX.Element;
@@ -1423,4 +1662,8 @@ declare function interceptMap<K, V>(map: Map<K, V>, fns: InterceptedMapFns<K, V>
1423
1662
 
1424
1663
  declare function useEffectWithChanges<T>(fn: (changes: Record<keyof T, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<keyof T, any>): void;
1425
1664
 
1426
- 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 };
1665
+ declare const defaultFilterEditors: InfiniteTablePropFilterEditors<unknown>;
1666
+ declare function StringFilterEditor<T>(props: InfiniteTableFilterEditorProps<T>): JSX.Element;
1667
+ declare function NumberFilterEditor<T>(props: InfiniteTableFilterEditorProps<T>): JSX.Element;
1668
+
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 };