@infinite-table/infinite-react 0.2.14 → 0.2.15

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 +40 -13
  2. package/index.esm.js +238 -169
  3. package/index.js +309 -245
  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;
@@ -219,14 +219,36 @@ declare class VirtualBrain extends Logger {
219
219
  destroy: () => void;
220
220
  }
221
221
 
222
- declare type Renderable = React$1.ReactNode;
222
+ declare type Renderable = React$1.ReactNode | JSX.Element;
223
223
 
224
224
  declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
225
225
  [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
226
226
  }[Keys];
227
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
+
228
243
  declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
229
- 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'];
230
252
  value: string | number | Renderable;
231
253
  groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
232
254
  rowIndex: number;
@@ -242,11 +264,12 @@ declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableC
242
264
  rowInfo: InfiniteTableRowInfoGroup<DATA_TYPE>;
243
265
  data: Partial<DATA_TYPE> | null;
244
266
  });
245
- 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> & {
246
269
  collapsed: boolean;
247
270
  groupIcon: Renderable;
248
271
  };
249
- 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>;
250
273
  declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
251
274
  rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
252
275
  data: DATA_TYPE | Partial<DATA_TYPE> | null;
@@ -254,13 +277,9 @@ declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTable
254
277
  rowIndex: number;
255
278
  column: COL_TYPE;
256
279
  };
257
- interface InfiniteTableColumnHeaderRenderParams<T> {
258
- column: InfiniteTableComputedColumn<T>;
259
- columnSortInfo: DataSourceSingleSortInfo<T> | null | undefined;
260
- }
261
- 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;
262
281
  declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
263
- declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderRenderParams<T>) => Renderable;
282
+ declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderParams<T>) => Renderable;
264
283
  declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
265
284
  declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
266
285
  declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
@@ -295,7 +314,7 @@ declare type InfiniteTableColumnValueGetterParams<T> = {
295
314
  data: Partial<T> | null;
296
315
  rowInfo: InfiniteTableRowInfoGroup<T>;
297
316
  };
298
- 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;
299
318
  declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
300
319
  declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
301
320
  declare type InfiniteTableBaseColumn<T> = {
@@ -322,6 +341,10 @@ declare type InfiniteTableBaseColumn<T> = {
322
341
  defaultFlex?: number;
323
342
  minWidth?: number;
324
343
  maxWidth?: number;
344
+ components?: {
345
+ ColumnCell?: React.ComponentType<HTMLProps<HTMLDivElement>>;
346
+ HeaderCell?: React.ComponentType<HTMLProps<HTMLDivElement>>;
347
+ };
325
348
  };
326
349
  /**
327
350
  * Defines a column in the table.
@@ -1011,6 +1034,10 @@ interface InfiniteTableContextValue<T> {
1011
1034
  getState: () => InfiniteTableState<T>;
1012
1035
  }
1013
1036
 
1037
+ declare function useInfiniteColumnCell<T>(): InfiniteTableColumnCellContextType<T>;
1038
+
1039
+ declare function useInfiniteHeaderCell<T>(): InfiniteTableColumnHeaderParams<T, InfiniteTableComputedColumn<T>>;
1040
+
1014
1041
  declare const InfiniteTableClassName: string;
1015
1042
  declare const InfiniteTableComponent: React$1.MemoExoticComponent<(<T>() => JSX.Element)>;
1016
1043
  declare function InfiniteTable<T>(props: InfiniteTableProps<T>): JSX.Element;
@@ -1076,4 +1103,4 @@ declare function interceptMap<K, V>(map: Map<K, V>, fns: InterceptedMapFns<K, V>
1076
1103
 
1077
1104
  declare function useEffectWithChanges(fn: (changes: Record<string, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<string, any>): void;
1078
1105
 
1079
- 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 };
1106
+ 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 };