@infinite-table/infinite-react 0.5.3 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -157,6 +157,7 @@ declare type InfiniteTableColumnHeaderParam<DATA_TYPE, COL_TYPE = InfiniteTableC
157
157
  someRowsSelected: boolean;
158
158
  api: InfiniteTableApi<DATA_TYPE>;
159
159
  renderBag: {
160
+ all?: Renderable;
160
161
  header: string | number | Renderable;
161
162
  sortIcon?: Renderable;
162
163
  menuIcon?: Renderable;
@@ -166,6 +167,7 @@ declare type InfiniteTableColumnHeaderParam<DATA_TYPE, COL_TYPE = InfiniteTableC
166
167
  declare type InfiniteTableColumnRenderBag = {
167
168
  value: string | number | Renderable;
168
169
  groupIcon?: Renderable;
170
+ all?: Renderable;
169
171
  selectionCheckBox?: Renderable;
170
172
  };
171
173
  declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
@@ -211,6 +213,14 @@ declare type InfiniteTableColumnRenderFunctionForNormalRows<DATA_TYPE, COL_TYPE
211
213
  }) => Renderable | null;
212
214
  declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
213
215
  declare type InfiniteTableColumnHeaderRenderFunction<T> = (headerParams: InfiniteTableColumnHeaderParam<T>) => Renderable;
216
+ declare type InfiniteTableColumnContentFocusable<T> = boolean | InfiniteTableColumnContentFocusableFn<T>;
217
+ declare type InfiniteTableColumnEditable<T> = boolean | InfiniteTableColumnEditableFn<T>;
218
+ declare type InfiniteTableColumnContentFocusableFn<T> = (params: InfiniteTableColumnContentFocusableParams<T>) => boolean;
219
+ declare type InfiniteTableColumnEditableFn<T> = (params: InfiniteTableColumnEditableParams<T>) => boolean;
220
+ declare type InfiniteTableColumnContentFocusableParams<T> = InfiniteTableColumnValueFormatterParams<T> & {
221
+ column: InfiniteTableComputedColumn<T>;
222
+ };
223
+ declare type InfiniteTableColumnEditableParams<T> = InfiniteTableColumnContentFocusableParams<T>;
214
224
  declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
215
225
  declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
216
226
  declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
@@ -248,11 +258,14 @@ declare type InfiniteTableColumn<DATA_TYPE> = {
248
258
  sortable?: boolean;
249
259
  draggable?: boolean;
250
260
  resizable?: boolean;
261
+ contentFocusable?: InfiniteTableColumnContentFocusable<DATA_TYPE>;
262
+ editable?: InfiniteTableColumnEditable<DATA_TYPE>;
251
263
  comparer?: InfiniteTableColumnComparer<DATA_TYPE>;
252
264
  defaultHiddenWhenGroupedBy?: '*' | true | keyof DATA_TYPE | {
253
265
  [k in keyof Partial<DATA_TYPE>]: true;
254
266
  };
255
267
  align?: InfiniteTableColumnAlign;
268
+ headerAlign?: InfiniteTableColumnAlign;
256
269
  verticalAlign?: InfiniteTableColumnVerticalAlign;
257
270
  columnGroup?: string;
258
271
  header?: InfiniteTableColumnHeader<DATA_TYPE>;
@@ -936,12 +949,14 @@ declare class ScrollListener {
936
949
 
937
950
  interface InfiniteTableSetupState<T> {
938
951
  renderer: ReactHeadlessTableRenderer;
952
+ getDOMNodeForCell: (cellPos: CellPosition) => HTMLElement | null;
939
953
  onRenderUpdater: SubscriptionCallback<Renderable>;
940
954
  propsCache: Map<keyof InfiniteTableProps<T>, WeakMap<any, any>>;
941
955
  columnsWhenInlineGroupRenderStrategy?: Map<string, InfiniteTableColumn<T>>;
942
956
  domRef: MutableRefObject<HTMLDivElement | null>;
943
957
  scrollerDOMRef: MutableRefObject<HTMLDivElement | null>;
944
958
  portalDOMRef: MutableRefObject<HTMLDivElement | null>;
959
+ focusDetectDOMRef: MutableRefObject<HTMLDivElement | null>;
945
960
  activeCellIndicatorDOMRef: MutableRefObject<HTMLDivElement | null>;
946
961
  onRowHeightCSSVarChange: SubscriptionCallback<number>;
947
962
  onColumnMenuClick: SubscriptionCallback<{
@@ -979,6 +994,8 @@ interface InfiniteTableMappedState<T> {
979
994
  viewportReservedWidth: InfiniteTableProps<T>['viewportReservedWidth'];
980
995
  resizableColumns: InfiniteTableProps<T>['resizableColumns'];
981
996
  groupColumn: InfiniteTableProps<T>['groupColumn'];
997
+ onKeyDown: InfiniteTableProps<T>['onKeyDown'];
998
+ onCellClick: InfiniteTableProps<T>['onCellClick'];
982
999
  headerOptions: NonUndefined<InfiniteTableProps<T>['headerOptions']>;
983
1000
  onScrollbarsChange: InfiniteTableProps<T>['onScrollbarsChange'];
984
1001
  getColumContextMenuItems: InfiniteTableProps<T>['getColumContextMenuItems'];
@@ -1179,6 +1196,7 @@ interface DataSourceMappedState<T> {
1179
1196
  aggregationReducers?: DataSourceProps<T>['aggregationReducers'];
1180
1197
  livePagination: DataSourceProps<T>['livePagination'];
1181
1198
  isRowSelected: DataSourceProps<T>['isRowSelected'];
1199
+ onDataArrayChange: DataSourceProps<T>['onDataArrayChange'];
1182
1200
  lazyLoad: DataSourceProps<T>['lazyLoad'];
1183
1201
  useGroupKeysForMultiRowSelection: NonUndefined<DataSourceProps<T>['useGroupKeysForMultiRowSelection']>;
1184
1202
  onDataParamsChange: DataSourceProps<T>['onDataParamsChange'];
@@ -1239,6 +1257,8 @@ interface DataSourceSetupState<T> {
1239
1257
  indexer: Indexer<T, any>;
1240
1258
  unfilteredCount: number;
1241
1259
  filteredCount: number;
1260
+ originalDataArrayChanged: boolean;
1261
+ originalDataArrayChangedAt: number;
1242
1262
  lazyLoadCacheOfLoadedBatches: DeepMap<string, true>;
1243
1263
  pivotMappings?: DataSourceMappings;
1244
1264
  propsCache: Map<keyof DataSourceProps<T>, WeakMap<any, any>>;
@@ -1322,6 +1342,7 @@ declare type DataSourceProps<T> = {
1322
1342
  defaultSortInfo?: DataSourceSortInfo<T>;
1323
1343
  onSortInfoChange?: ((sortInfo: DataSourceSingleSortInfo<T> | null) => void) | ((sortInfo: DataSourceSingleSortInfo<T>[]) => void);
1324
1344
  onDataParamsChange?: (dataParamsChange: DataSourceDataParams<T>) => void;
1345
+ onDataArrayChange?: (dataArray: DataSourceState<T>['originalDataArray']) => void;
1325
1346
  livePagination?: boolean;
1326
1347
  livePaginationCursor?: DataSourcePropLivePaginationCursor<T>;
1327
1348
  onLivePaginationCursorChange?: (livePaginationCursor: DataSourceLivePaginationCursorValue) => void;
@@ -1913,6 +1934,23 @@ declare type MenuColumnRenderParam = {
1913
1934
  domProps: HTMLProps<HTMLDivElement>;
1914
1935
  };
1915
1936
 
1937
+ declare type InfiniteTableEventHandlerContext<T> = {
1938
+ getComputed: () => InfiniteTableComputedValues<T>;
1939
+ getState: () => InfiniteTableState<T>;
1940
+ actions: InfiniteTableActions<T>;
1941
+ cloneRowSelection: (rowSelection: RowSelectionState<T>) => RowSelectionState<T>;
1942
+ getDataSourceState: () => DataSourceState<T>;
1943
+ dataSourceActions: DataSourceComponentActions<T>;
1944
+ api: InfiniteTableApi<T>;
1945
+ };
1946
+ declare type InfiniteTableKeyboardEventHandlerContext<T> = InfiniteTableEventHandlerContext<T>;
1947
+ declare type InfiniteTableCellClickEventHandlerContext<T> = InfiniteTableEventHandlerContext<T> & {
1948
+ rowIndex: number;
1949
+ colIndex: number;
1950
+ };
1951
+
1952
+ declare type OnCellClickContext<T> = InfiniteTableCellClickEventHandlerContext<T> & InfiniteTableKeyboardEventHandlerContext<T>;
1953
+
1916
1954
  declare type LoadMaskProps = {
1917
1955
  visible: boolean;
1918
1956
  children: Renderable;
@@ -1951,6 +1989,8 @@ declare type InfiniteTableColumnType<T> = {
1951
1989
  resizable?: InfiniteTableColumn<T>['resizable'];
1952
1990
  align?: InfiniteTableColumn<T>['align'];
1953
1991
  verticalAlign?: InfiniteTableColumn<T>['verticalAlign'];
1992
+ contentFocusable?: InfiniteTableColumn<T>['contentFocusable'];
1993
+ editable?: InfiniteTableColumn<T>['editable'];
1954
1994
  columnGroup?: string;
1955
1995
  cssEllipsis?: boolean;
1956
1996
  headerCssEllipsis?: boolean;
@@ -2111,6 +2151,27 @@ interface InfiniteTableProps<T> {
2111
2151
  rowStyle?: InfiniteTablePropRowStyle<T>;
2112
2152
  rowClassName?: InfiniteTablePropRowClassName<T>;
2113
2153
  columnHeaderHeight: number | string;
2154
+ onKeyDown?: (context: {
2155
+ api: InfiniteTableEventHandlerContext<T>['api'];
2156
+ getState: InfiniteTableEventHandlerContext<T>['getState'];
2157
+ getDataSourceState: InfiniteTableEventHandlerContext<T>['getDataSourceState'];
2158
+ actions: InfiniteTableEventHandlerContext<T>['actions'];
2159
+ }, event: React$1.KeyboardEvent) => void;
2160
+ onCellClick?: (context: {
2161
+ rowIndex: OnCellClickContext<T>['rowIndex'];
2162
+ colIndex: OnCellClickContext<T>['colIndex'];
2163
+ api: OnCellClickContext<T>['api'];
2164
+ getState: OnCellClickContext<T>['getState'];
2165
+ getDataSourceState: OnCellClickContext<T>['getDataSourceState'];
2166
+ actions: OnCellClickContext<T>['actions'];
2167
+ }, event: React$1.MouseEvent) => void;
2168
+ /**
2169
+ * Properties to be sent directly to the DOM element underlying InfiniteTable.
2170
+ *
2171
+ * Useful for passing a className or style and any other event handlers. For more context
2172
+ * on some event handlers (eg: onKeyDown), you might want to use dedicated props that give you access
2173
+ * to component state as well.
2174
+ */
2114
2175
  domProps?: React$1.HTMLProps<HTMLDivElement>;
2115
2176
  /**
2116
2177
  * A unique identifier for the table instance. Will not be passed to the DOM.