@infinite-table/infinite-react 0.2.13 → 0.2.16

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 (4) hide show
  1. package/index.d.ts +43 -14
  2. package/index.esm.js +332 -226
  3. package/index.js +403 -302
  4. 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 { CSSProperties, MutableRefObject } from 'react';
3
+ import { CSSProperties, HTMLProps, MutableRefObject } from 'react';
4
4
 
5
5
  declare function debounce(fn: Function, { wait }: {
6
6
  wait: number;
@@ -47,6 +47,7 @@ declare class DeepMap<KeyType, ValueType> {
47
47
  private map;
48
48
  private length;
49
49
  private revision;
50
+ private emptyKey;
50
51
  static clone<KeyType, ValueType>(map: DeepMap<KeyType, ValueType>): DeepMap<KeyType, ValueType>;
51
52
  constructor(initial?: [KeyType[], ValueType][]);
52
53
  set(keys: KeyType[] & {
@@ -218,14 +219,36 @@ declare class VirtualBrain extends Logger {
218
219
  destroy: () => void;
219
220
  }
220
221
 
221
- declare type Renderable = React$1.ReactNode;
222
+ declare type Renderable = React$1.ReactNode | JSX.Element;
222
223
 
223
224
  declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
224
225
  [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
225
226
  }[Keys];
226
227
 
228
+ declare type InfiniteTableCellProps<T> = {
229
+ column: InfiniteTableComputedColumn<T>;
230
+ renderChildren: () => Renderable;
231
+ cssEllipsis?: boolean;
232
+ virtualized?: boolean;
233
+ skipColumnShifting?: boolean;
234
+ beforeChildren?: Renderable;
235
+ afterChildren?: Renderable;
236
+ offset?: number;
237
+ offsetProperty?: 'left' | 'right';
238
+ cssPosition?: CSSProperties['position'];
239
+ domRef?: React.RefCallback<HTMLElement>;
240
+ cellType: 'body' | 'header';
241
+ };
242
+
227
243
  declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
228
- declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
244
+ declare type InfiniteTableColumnHeaderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
245
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
246
+ sortTool: JSX.Element;
247
+ column: COL_TYPE;
248
+ columnSortInfo: DataSourceSingleSortInfo<DATA_TYPE> | null;
249
+ };
250
+ declare type InfiniteTableColumnRenderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
251
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
229
252
  value: string | number | Renderable;
230
253
  groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
231
254
  rowIndex: number;
@@ -241,11 +264,12 @@ declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableC
241
264
  rowInfo: InfiniteTableRowInfoGroup<DATA_TYPE>;
242
265
  data: Partial<DATA_TYPE> | null;
243
266
  });
244
- declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE> & {
267
+ declare type InfiniteTableColumnCellContextType<DATA_TYPE> = InfiniteTableColumnRenderParams<DATA_TYPE> & {};
268
+ declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParams<DATA_TYPE, COL_TYPE> & {
245
269
  collapsed: boolean;
246
270
  groupIcon: Renderable;
247
271
  };
248
- declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
272
+ declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParams<DATA_TYPE, COL_TYPE>;
249
273
  declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
250
274
  rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
251
275
  data: DATA_TYPE | Partial<DATA_TYPE> | null;
@@ -253,13 +277,9 @@ declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTable
253
277
  rowIndex: number;
254
278
  column: COL_TYPE;
255
279
  };
256
- interface InfiniteTableColumnHeaderRenderParams<T> {
257
- column: InfiniteTableComputedColumn<T>;
258
- columnSortInfo: DataSourceSingleSortInfo<T> | null | undefined;
259
- }
260
- declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = ({ value, rowIndex, column, data, toggleGroupRow, toggleCurrentGroupRow, rowInfo, groupBy, pivotBy, }: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
280
+ declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = ({ value, rowIndex, column, data, toggleGroupRow, toggleCurrentGroupRow, rowInfo, groupBy, pivotBy, }: InfiniteTableColumnRenderParams<DATA_TYPE, COL_TYPE>) => Renderable | null;
261
281
  declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
262
- declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderRenderParams<T>) => Renderable;
282
+ declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderParams<T>) => Renderable;
263
283
  declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
264
284
  declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
265
285
  declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
@@ -294,7 +314,7 @@ declare type InfiniteTableColumnValueGetterParams<T> = {
294
314
  data: Partial<T> | null;
295
315
  rowInfo: InfiniteTableRowInfoGroup<T>;
296
316
  };
297
- declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = Renderable> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
317
+ declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = string | number | boolean | null | undefined> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
298
318
  declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
299
319
  declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
300
320
  declare type InfiniteTableBaseColumn<T> = {
@@ -321,6 +341,10 @@ declare type InfiniteTableBaseColumn<T> = {
321
341
  defaultFlex?: number;
322
342
  minWidth?: number;
323
343
  maxWidth?: number;
344
+ components?: {
345
+ ColumnCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
346
+ HeaderCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
347
+ };
324
348
  };
325
349
  /**
326
350
  * Defines a column in the table.
@@ -390,7 +414,7 @@ interface DataSourceDataParams<T> {
390
414
  groupKeys?: any[];
391
415
  aggregationReducers?: DataSourcePropAggregationReducers<T>;
392
416
  livePaginationCursor?: DataSourceLivePaginationCursorValue;
393
- cursorId?: DataSourceSetupState<T>['cursorId'];
417
+ __cursorId?: DataSourceSetupState<T>['cursorId'];
394
418
  changes?: DataSourceDataParamsChanges<T>;
395
419
  }
396
420
  declare type DataSourceDataParamsChanges<T> = Partial<Record<keyof Omit<DataSourceDataParams<T>, 'originalDataArray' | 'changes'>, true>>;
@@ -695,6 +719,7 @@ declare type InfiniteTableColumnType<T> = {
695
719
  verticalAlign?: InfiniteTableColumn<T>['verticalAlign'];
696
720
  cssEllipsis?: boolean;
697
721
  headerCssEllipsis?: boolean;
722
+ components?: InfiniteTableColumn<T>['components'];
698
723
  renderValue?: InfiniteTableColumn<T>['renderValue'];
699
724
  render?: InfiniteTableColumn<T>['render'];
700
725
  valueGetter?: InfiniteTableColumn<T>['valueGetter'];
@@ -1010,6 +1035,10 @@ interface InfiniteTableContextValue<T> {
1010
1035
  getState: () => InfiniteTableState<T>;
1011
1036
  }
1012
1037
 
1038
+ declare function useInfiniteColumnCell<T>(): InfiniteTableColumnCellContextType<T>;
1039
+
1040
+ declare function useInfiniteHeaderCell<T>(): InfiniteTableColumnHeaderParams<T, InfiniteTableComputedColumn<T>>;
1041
+
1013
1042
  declare const InfiniteTableClassName: string;
1014
1043
  declare const InfiniteTableComponent: React$1.MemoExoticComponent<(<T>() => JSX.Element)>;
1015
1044
  declare function InfiniteTable<T>(props: InfiniteTableProps<T>): JSX.Element;
@@ -1075,4 +1104,4 @@ declare function interceptMap<K, V>(map: Map<K, V>, fns: InterceptedMapFns<K, V>
1075
1104
 
1076
1105
  declare function useEffectWithChanges(fn: (changes: Record<string, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<string, any>): void;
1077
1106
 
1078
- export { ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceExpandedAndCollapsedGroupRows, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropGroupBy, 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, InfiniteTableImperativeApi, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyGroupRowInfo, Scrollbars, debounce, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges };
1107
+ export { ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceExpandedAndCollapsedGroupRows, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropGroupBy, DataSourcePropLivePaginationCursor, DataSourcePropPivotBy, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderParams as 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, LazyGroupRowInfo, Scrollbars, debounce, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useInfiniteColumnCell, useInfiniteHeaderCell };