@infinite-table/infinite-react 0.6.4 → 0.7.0
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 +87 -7
- package/index.esm.js +2 -2
- package/index.js +2 -2
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1137,6 +1137,37 @@ type RenderRange = {
|
|
|
1137
1137
|
renderEndIndex: number;
|
|
1138
1138
|
};
|
|
1139
1139
|
|
|
1140
|
+
type DataSourceMutation<T> = {
|
|
1141
|
+
type: 'delete';
|
|
1142
|
+
primaryKey: any;
|
|
1143
|
+
} | {
|
|
1144
|
+
type: 'update';
|
|
1145
|
+
primaryKey: any;
|
|
1146
|
+
data: Partial<T>;
|
|
1147
|
+
} | {
|
|
1148
|
+
type: 'insert';
|
|
1149
|
+
primaryKey: any;
|
|
1150
|
+
position: 'before' | 'after';
|
|
1151
|
+
data: T;
|
|
1152
|
+
};
|
|
1153
|
+
declare class DataSourceCache<DataType, PrimaryKeyType = string> {
|
|
1154
|
+
private affectedFields;
|
|
1155
|
+
private allFieldsAffected;
|
|
1156
|
+
private primaryKeyToData;
|
|
1157
|
+
static clone<DataType, PrimaryKeyType = string>(cache: DataSourceCache<DataType, PrimaryKeyType>, { light }?: {
|
|
1158
|
+
light?: boolean;
|
|
1159
|
+
}): DataSourceCache<DataType, PrimaryKeyType>;
|
|
1160
|
+
getAffectedFields: () => true | Set<keyof DataType>;
|
|
1161
|
+
delete: (primaryKey: PrimaryKeyType) => void;
|
|
1162
|
+
insert: (primaryKey: PrimaryKeyType, data: DataType, position: 'before' | 'after') => void;
|
|
1163
|
+
update: (primaryKey: PrimaryKeyType, data: Partial<DataType>) => void;
|
|
1164
|
+
clear: () => void;
|
|
1165
|
+
isEmpty: () => boolean;
|
|
1166
|
+
removeInfo: (primaryKey: PrimaryKeyType) => void;
|
|
1167
|
+
getMutationsForPrimaryKey: (primaryKey: PrimaryKeyType) => DataSourceMutation<DataType>[] | undefined;
|
|
1168
|
+
getMutations: () => Map<string, DataSourceMutation<DataType>[]>;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1140
1171
|
type BooleanDeepCollectionStateKeys<KeyType> = true | KeyType[][];
|
|
1141
1172
|
type BooleanDeepCollectionStateObject<KeyType> = {
|
|
1142
1173
|
positiveItems: BooleanDeepCollectionStateKeys<KeyType>;
|
|
@@ -1186,10 +1217,13 @@ declare class GroupRowsState<KeyType extends any = any> extends BooleanDeepColle
|
|
|
1186
1217
|
|
|
1187
1218
|
declare class Indexer<DataType, PrimaryKeyType = string> {
|
|
1188
1219
|
primaryKeyToData: Map<string, DataType>;
|
|
1189
|
-
add
|
|
1220
|
+
private add;
|
|
1190
1221
|
clear: () => void;
|
|
1191
|
-
getDataForPrimaryKey: (primaryKey: PrimaryKeyType) => DataType | undefined;
|
|
1192
|
-
indexArray: (arr: DataType[],
|
|
1222
|
+
getDataForPrimaryKey: (primaryKey: PrimaryKeyType | string) => DataType | undefined;
|
|
1223
|
+
indexArray: (arr: DataType[], options: {
|
|
1224
|
+
toPrimaryKey: (data: DataType) => PrimaryKeyType;
|
|
1225
|
+
cache?: DataSourceCache<DataType, string> | undefined;
|
|
1226
|
+
}) => DataType[];
|
|
1193
1227
|
}
|
|
1194
1228
|
|
|
1195
1229
|
interface DataSourceDataParams<T> {
|
|
@@ -1198,6 +1232,7 @@ interface DataSourceDataParams<T> {
|
|
|
1198
1232
|
groupBy?: DataSourcePropGroupBy<T>;
|
|
1199
1233
|
pivotBy?: DataSourcePropPivotBy<T>;
|
|
1200
1234
|
filterValue?: DataSourcePropFilterValue<T>;
|
|
1235
|
+
refetchKey?: DataSourceProps<T>['refetchKey'];
|
|
1201
1236
|
groupRowsState?: DataSourcePropGroupRowsStateObject<any>;
|
|
1202
1237
|
lazyLoadBatchSize?: number;
|
|
1203
1238
|
lazyLoadStartIndex?: number;
|
|
@@ -1237,8 +1272,11 @@ type DataSourcePropPivotBy<T> = DataSourcePivotBy<T>[];
|
|
|
1237
1272
|
interface DataSourceMappedState<T> {
|
|
1238
1273
|
aggregationReducers?: DataSourceProps<T>['aggregationReducers'];
|
|
1239
1274
|
livePagination: DataSourceProps<T>['livePagination'];
|
|
1275
|
+
refetchKey: NonUndefined<DataSourceProps<T>['refetchKey']>;
|
|
1240
1276
|
isRowSelected: DataSourceProps<T>['isRowSelected'];
|
|
1241
1277
|
onDataArrayChange: DataSourceProps<T>['onDataArrayChange'];
|
|
1278
|
+
onDataMutations: DataSourceProps<T>['onDataMutations'];
|
|
1279
|
+
onReady: DataSourceProps<T>['onReady'];
|
|
1242
1280
|
lazyLoad: DataSourceProps<T>['lazyLoad'];
|
|
1243
1281
|
useGroupKeysForMultiRowSelection: NonUndefined<DataSourceProps<T>['useGroupKeysForMultiRowSelection']>;
|
|
1244
1282
|
onDataParamsChange: DataSourceProps<T>['onDataParamsChange'];
|
|
@@ -1297,10 +1335,14 @@ type LazyRowInfoGroup<DataType> = {
|
|
|
1297
1335
|
type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyRowInfoGroup<DataType>>;
|
|
1298
1336
|
interface DataSourceSetupState<T> {
|
|
1299
1337
|
indexer: Indexer<T, any>;
|
|
1338
|
+
cache?: DataSourceCache<T>;
|
|
1300
1339
|
unfilteredCount: number;
|
|
1301
1340
|
filteredCount: number;
|
|
1302
1341
|
originalDataArrayChanged: boolean;
|
|
1303
|
-
|
|
1342
|
+
originalDataArrayChangedInfo: {
|
|
1343
|
+
timestamp: number;
|
|
1344
|
+
mutations?: Map<string, DataSourceMutation<T>[]>;
|
|
1345
|
+
};
|
|
1304
1346
|
lazyLoadCacheOfLoadedBatches: DeepMap<string, true>;
|
|
1305
1347
|
pivotMappings?: DataSourceMappings;
|
|
1306
1348
|
propsCache: Map<keyof DataSourceProps<T>, WeakMap<any, any>>;
|
|
@@ -1349,10 +1391,34 @@ type DataSourcePropOnRowSelectionChange_SingleRow = (rowSelection: DataSourcePro
|
|
|
1349
1391
|
type DataSourcePropOnRowSelectionChange = DataSourcePropOnRowSelectionChange_SingleRow | DataSourcePropOnRowSelectionChange_MultiRow;
|
|
1350
1392
|
type DataSourcePropOnCellSelectionChange = (cellSelectionParams: any) => void;
|
|
1351
1393
|
type DataSourcePropIsRowSelected<T> = (rowInfo: InfiniteTableRowInfo<T>, rowSelectionState: RowSelectionState, selectionMode: 'multi-row') => boolean | null;
|
|
1394
|
+
type DataSourceCRUDParam = {
|
|
1395
|
+
flush?: boolean;
|
|
1396
|
+
};
|
|
1397
|
+
type DataSourceInsertParam = DataSourceCRUDParam & ({
|
|
1398
|
+
position: 'before' | 'after';
|
|
1399
|
+
primaryKey: any;
|
|
1400
|
+
} | {
|
|
1401
|
+
position: 'start' | 'end';
|
|
1402
|
+
});
|
|
1403
|
+
interface DataSourceApi<T> {
|
|
1404
|
+
getRowInfoArray: () => InfiniteTableRowInfo<T>[];
|
|
1405
|
+
getDataByPrimaryKey(id: any): T | undefined;
|
|
1406
|
+
updateData(data: Partial<T>, options?: DataSourceCRUDParam): void;
|
|
1407
|
+
updateDataArray(data: Partial<T>[], options?: DataSourceCRUDParam): void;
|
|
1408
|
+
removeDataByPrimaryKey(id: any, options?: DataSourceCRUDParam): void;
|
|
1409
|
+
removeDataArrayByPrimaryKeys(id: any[], options?: DataSourceCRUDParam): void;
|
|
1410
|
+
removeData(data: Partial<T>, options?: DataSourceCRUDParam): void;
|
|
1411
|
+
removeDataArray(data: Partial<T>[], options?: DataSourceCRUDParam): void;
|
|
1412
|
+
addData(data: T, options?: DataSourceCRUDParam): void;
|
|
1413
|
+
addDataArray(data: T[], options?: DataSourceCRUDParam): void;
|
|
1414
|
+
insertData(data: T, options: DataSourceInsertParam): void;
|
|
1415
|
+
insertDataArray(data: T[], options: DataSourceInsertParam): void;
|
|
1416
|
+
}
|
|
1352
1417
|
type DataSourceProps<T> = {
|
|
1353
1418
|
children: React$1.ReactNode | ((contextData: DataSourceState<T>) => React$1.ReactNode);
|
|
1354
1419
|
primaryKey: keyof T | ((data: T) => string);
|
|
1355
1420
|
fields?: (keyof T)[];
|
|
1421
|
+
refetchKey?: number | string | object;
|
|
1356
1422
|
data: DataSourceData<T>;
|
|
1357
1423
|
selectionMode?: DataSourcePropSelectionMode;
|
|
1358
1424
|
useGroupKeysForMultiRowSelection?: boolean;
|
|
@@ -1368,6 +1434,7 @@ type DataSourceProps<T> = {
|
|
|
1368
1434
|
loading?: boolean;
|
|
1369
1435
|
defaultLoading?: boolean;
|
|
1370
1436
|
onLoadingChange?: (loading: boolean) => void;
|
|
1437
|
+
onReady?: (api: DataSourceApi<T>) => void;
|
|
1371
1438
|
pivotBy?: DataSourcePropPivotBy<T>;
|
|
1372
1439
|
defaultPivotBy?: DataSourcePropPivotBy<T>;
|
|
1373
1440
|
onPivotByChange?: (pivotBy: DataSourcePropPivotBy<T>) => void;
|
|
@@ -1384,7 +1451,12 @@ type DataSourceProps<T> = {
|
|
|
1384
1451
|
defaultSortInfo?: DataSourceSortInfo<T>;
|
|
1385
1452
|
onSortInfoChange?: ((sortInfo: DataSourceSingleSortInfo<T> | null) => void) | ((sortInfo: DataSourceSingleSortInfo<T>[]) => void);
|
|
1386
1453
|
onDataParamsChange?: (dataParamsChange: DataSourceDataParams<T>) => void;
|
|
1387
|
-
onDataArrayChange?: (dataArray: DataSourceState<T>['originalDataArray']) => void;
|
|
1454
|
+
onDataArrayChange?: (dataArray: DataSourceState<T>['originalDataArray'], info: DataSourceState<T>['originalDataArrayChangedInfo']) => void;
|
|
1455
|
+
onDataMutations?: ({ dataArray, timestamp, mutations, }: {
|
|
1456
|
+
dataArray: DataSourceState<T>['originalDataArray'];
|
|
1457
|
+
timestamp: number;
|
|
1458
|
+
mutations: NonUndefined<DataSourceState<T>['originalDataArrayChangedInfo']['mutations']>;
|
|
1459
|
+
}) => void;
|
|
1388
1460
|
livePagination?: boolean;
|
|
1389
1461
|
livePaginationCursor?: DataSourcePropLivePaginationCursor<T>;
|
|
1390
1462
|
onLivePaginationCursorChange?: (livePaginationCursor: DataSourceLivePaginationCursorValue) => void;
|
|
@@ -1478,6 +1550,7 @@ type DataSourceDerivedState<T> = {
|
|
|
1478
1550
|
};
|
|
1479
1551
|
type DataSourceComponentActions<T> = ComponentStateActions<DataSourceState<T>>;
|
|
1480
1552
|
interface DataSourceContextValue<T> {
|
|
1553
|
+
api: DataSourceApi<T>;
|
|
1481
1554
|
getState: () => DataSourceState<T>;
|
|
1482
1555
|
componentState: DataSourceState<T>;
|
|
1483
1556
|
componentActions: DataSourceComponentActions<T>;
|
|
@@ -2075,6 +2148,10 @@ type InfiniteTableApi<T> = {
|
|
|
2075
2148
|
set scrollLeft(value: number);
|
|
2076
2149
|
get scrollTop(): number;
|
|
2077
2150
|
set scrollTop(value: number);
|
|
2151
|
+
getVerticalRenderRange: () => {
|
|
2152
|
+
renderStartIndex: number;
|
|
2153
|
+
renderEndIndex: number;
|
|
2154
|
+
};
|
|
2078
2155
|
toggleGroupRow: (groupKeys: any[]) => void;
|
|
2079
2156
|
collapseGroupRow: (groupKeys: any[]) => boolean;
|
|
2080
2157
|
expandGroupRow: (groupKeys: any[]) => boolean;
|
|
@@ -2269,7 +2346,10 @@ interface InfiniteTableProps<T> {
|
|
|
2269
2346
|
onColumnOrderChange?: (columnOrder: InfiniteTablePropColumnOrderNormalized) => void;
|
|
2270
2347
|
onRowHeightChange?: (rowHeight: number) => void;
|
|
2271
2348
|
filterEditors?: InfiniteTablePropFilterEditors<T>;
|
|
2272
|
-
onReady?: (api
|
|
2349
|
+
onReady?: ({ api, dataSourceApi, }: {
|
|
2350
|
+
api: InfiniteTableApi<T>;
|
|
2351
|
+
dataSourceApi: DataSourceApi<T>;
|
|
2352
|
+
}) => void;
|
|
2273
2353
|
rowProps?: React$1.HTMLProps<HTMLDivElement> | ((rowArgs: InfiniteTableRowStyleFnParams<T>) => React$1.HTMLProps<HTMLDivElement>);
|
|
2274
2354
|
licenseKey?: string;
|
|
2275
2355
|
scrollTopKey?: string | number;
|
|
@@ -2374,4 +2454,4 @@ declare const components: {
|
|
|
2374
2454
|
LoadMask: (props: LoadMaskProps) => JSX.Element;
|
|
2375
2455
|
};
|
|
2376
2456
|
|
|
2377
|
-
export { AdvancedAlignable, 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, DataSourcePropCellSelection, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropPivotBy, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, ElementContainerGetter, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableApi, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnApi, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderFunctionForGroupRows, InfiniteTableColumnRenderFunctionForNormalRows, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableColumnsMap, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableFilterEditorProps, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropFilterEditors, InfiniteTablePropGetColumnContextMenuItems, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Menu, MenuChildrenFnParam, MenuColumn, MenuColumnRenderParam, MenuDecoration, MenuItemDefinition, MenuItemObject, MenuProps, MenuRenderable, MenuRuntimeItem, MenuRuntimeItemSelectable, MenuSeparator, NumberFilterEditor, OverlayShowParams, RowSelectionState, Scrollbars, StringFilterEditor, components, debounce, defaultFilterEditors, defaultFilterTypes, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useInfiniteColumnCell, useInfiniteHeaderCell, useOverlay, useOverlayPortal };
|
|
2457
|
+
export { AdvancedAlignable, ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceApi, DataSourceCRUDParam, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceFilterFunctionParam, DataSourceFilterOperator, DataSourceFilterOperatorFunction, DataSourceFilterOperatorFunctionParam, DataSourceFilterType, DataSourceFilterValueItem, DataSourceFilterValueItemValueGetter, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceInsertParam, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropCellSelection, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropPivotBy, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, ElementContainerGetter, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableApi, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnApi, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderFunctionForGroupRows, InfiniteTableColumnRenderFunctionForNormalRows, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableColumnsMap, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableFilterEditorProps, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropFilterEditors, InfiniteTablePropGetColumnContextMenuItems, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Menu, MenuChildrenFnParam, MenuColumn, MenuColumnRenderParam, MenuDecoration, MenuItemDefinition, MenuItemObject, MenuProps, MenuRenderable, MenuRuntimeItem, MenuRuntimeItemSelectable, MenuSeparator, NumberFilterEditor, OverlayShowParams, RowSelectionState, Scrollbars, StringFilterEditor, components, debounce, defaultFilterEditors, defaultFilterTypes, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useInfiniteColumnCell, useInfiniteHeaderCell, useOverlay, useOverlayPortal };
|