@infinite-table/infinite-react 4.1.0 → 4.2.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 +21 -3
- package/index.dev.js +95 -18
- package/index.dev.mjs +95 -18
- package/index.js +2 -2
- package/index.mjs +2 -2
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -2046,6 +2046,10 @@ interface DataSourceApi<T> {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
declare type DataSourcePropRowInfoReducers<T> = Record<string, DataSourceRowInfoReducer<T>>;
|
|
2048
2048
|
declare type DataSourceRowInfoReducer<T> = DataSourceRawReducer<InfiniteTableRowInfo<T>, any>;
|
|
2049
|
+
declare type DataSourcePropShouldReloadDataObject<T> = {
|
|
2050
|
+
[key in keyof Pick<DataSourceDataParams<T>, 'sortInfo' | 'pivotBy' | 'groupBy' | 'filterValue'>]: boolean;
|
|
2051
|
+
};
|
|
2052
|
+
declare type DataSourcePropShouldReloadData<T> = DataSourcePropShouldReloadDataObject<T>;
|
|
2049
2053
|
declare type DataSourceProps<T> = {
|
|
2050
2054
|
debugId?: string;
|
|
2051
2055
|
children: React$1.ReactNode | ((contextData: DataSourceState<T>) => React$1.ReactNode);
|
|
@@ -2100,8 +2104,19 @@ declare type DataSourceProps<T> = {
|
|
|
2100
2104
|
livePaginationCursor?: DataSourcePropLivePaginationCursor<T>;
|
|
2101
2105
|
onLivePaginationCursorChange?: (livePaginationCursor: DataSourceLivePaginationCursorValue) => void;
|
|
2102
2106
|
filterFunction?: DataSourcePropFilterFunction<T>;
|
|
2107
|
+
/**
|
|
2108
|
+
* @deprecated Use shouldReloadData.sortInfo instead
|
|
2109
|
+
*/
|
|
2103
2110
|
sortMode?: 'local' | 'remote';
|
|
2111
|
+
/**
|
|
2112
|
+
* @deprecated Use shouldReloadData.filterValue instead
|
|
2113
|
+
*/
|
|
2104
2114
|
filterMode?: 'local' | 'remote';
|
|
2115
|
+
/**
|
|
2116
|
+
* @deprecated Use shouldReloadData.groupBy instead
|
|
2117
|
+
*/
|
|
2118
|
+
groupMode?: 'local' | 'remote';
|
|
2119
|
+
shouldReloadData?: DataSourcePropShouldReloadData<T>;
|
|
2105
2120
|
filterValue?: DataSourcePropFilterValue<T>;
|
|
2106
2121
|
defaultFilterValue?: DataSourcePropFilterValue<T>;
|
|
2107
2122
|
onFilterValueChange?: (filterValue: DataSourcePropFilterValue<T>) => void;
|
|
@@ -2198,8 +2213,11 @@ interface DataSourceState<T> extends DataSourceSetupState<T>, DataSourceDerivedS
|
|
|
2198
2213
|
declare type DataSourceDerivedState<T> = {
|
|
2199
2214
|
toPrimaryKey: (data: T) => any;
|
|
2200
2215
|
operatorsByFilterType: Record<string, Record<string, DataSourceFilterOperator<T>>>;
|
|
2201
|
-
sortMode:
|
|
2202
|
-
filterMode:
|
|
2216
|
+
sortMode: 'local' | 'remote';
|
|
2217
|
+
filterMode: 'local' | 'remote';
|
|
2218
|
+
groupMode: 'local' | 'remote';
|
|
2219
|
+
pivotMode: 'local' | 'remote';
|
|
2220
|
+
shouldReloadData: NonUndefined<Required<DataSourcePropShouldReloadData<T>>>;
|
|
2203
2221
|
groupRowsState: GroupRowsState<T>;
|
|
2204
2222
|
multiSort: boolean;
|
|
2205
2223
|
controlledSort: boolean;
|
|
@@ -3332,4 +3350,4 @@ declare const components: {
|
|
|
3332
3350
|
NumberFilterEditor: typeof NumberFilterEditor;
|
|
3333
3351
|
};
|
|
3334
3352
|
|
|
3335
|
-
export { AdvancedAlignable, CellSelectionState, CellSelectionStateObject, 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, DataSourceMasterDetailContextValue, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropCellSelection, DataSourcePropCellSelection_MultiCell, DataSourcePropCellSelection_SingleCell, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnCellSelectionChange_MultiCell, DataSourcePropOnCellSelectionChange_SingleCell, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropPivotBy, DataSourcePropRowInfoReducers, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropSortFn, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourceProps, DataSourceRawReducer, DataSourceRemoteData, DataSourceRowInfoReducer, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, DebugLogger, DeepMap, ElementContainerGetter, FixedSizeSet, GroupRowsState, InfiniteColumnEditorContextType, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableApi, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnApi, InfiniteTableColumnCellContextType, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderFunctionForGroupRows, InfiniteTableColumnRenderFunctionForNormalRows, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableColumnValueFormatterParams, InfiniteTableColumnValueGetterParams, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropGetCellContextMenuItems, InfiniteTablePropGetColumnMenuItems, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropKeyboardShorcut, InfiniteTablePropMultiSortBehavior, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, InfiniteTable_HasGrouping_RowInfoGroup, InfiniteTable_HasGrouping_RowInfoNormal, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Menu, MenuChildrenFnParam, MenuColumn, MenuColumnRenderParam, MenuDecoration, MenuIconProps, MenuItemActionContext, MenuItemDefinition, MenuItemObject, MenuProps, MenuRenderable, MenuRuntimeItem, MenuRuntimeItemSelectable, MenuSeparator, OverlayShowParams, RowDetailCache, RowDetailState, RowDetailStateObject, RowSelectionState, Scrollbars, ShowOverlayFn, WeakFixedSizeSet, components, debounce, debug, defaultFilterTypes, eventMatchesKeyboardShortcut, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, keyboardShortcuts, multisort, useComponentState, useDataSource, useEffectWithChanges, useEffectWithObject, useGridScroll, useInfiniteColumnCell, useInfiniteColumnEditor, useInfiniteColumnFilterEditor, useInfiniteHeaderCell, useMasterRowInfo, useOverlay, useOverlayPortal, useRowInfoReducers, useVisibleColumnSizes };
|
|
3353
|
+
export { AdvancedAlignable, CellSelectionState, CellSelectionStateObject, 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, DataSourceMasterDetailContextValue, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropCellSelection, DataSourcePropCellSelection_MultiCell, DataSourcePropCellSelection_SingleCell, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnCellSelectionChange_MultiCell, DataSourcePropOnCellSelectionChange_SingleCell, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropPivotBy, DataSourcePropRowInfoReducers, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropShouldReloadData, DataSourcePropShouldReloadDataObject, DataSourcePropSortFn, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourceProps, DataSourceRawReducer, DataSourceRemoteData, DataSourceRowInfoReducer, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, DebugLogger, DeepMap, ElementContainerGetter, FixedSizeSet, GroupRowsState, InfiniteColumnEditorContextType, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableApi, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnApi, InfiniteTableColumnCellContextType, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderFunctionForGroupRows, InfiniteTableColumnRenderFunctionForNormalRows, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableColumnValueFormatterParams, InfiniteTableColumnValueGetterParams, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropGetCellContextMenuItems, InfiniteTablePropGetColumnMenuItems, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropKeyboardShorcut, InfiniteTablePropMultiSortBehavior, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, InfiniteTable_HasGrouping_RowInfoGroup, InfiniteTable_HasGrouping_RowInfoNormal, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Menu, MenuChildrenFnParam, MenuColumn, MenuColumnRenderParam, MenuDecoration, MenuIconProps, MenuItemActionContext, MenuItemDefinition, MenuItemObject, MenuProps, MenuRenderable, MenuRuntimeItem, MenuRuntimeItemSelectable, MenuSeparator, OverlayShowParams, RowDetailCache, RowDetailState, RowDetailStateObject, RowSelectionState, Scrollbars, ShowOverlayFn, WeakFixedSizeSet, components, debounce, debug, defaultFilterTypes, eventMatchesKeyboardShortcut, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, keyboardShortcuts, multisort, useComponentState, useDataSource, useEffectWithChanges, useEffectWithObject, useGridScroll, useInfiniteColumnCell, useInfiniteColumnEditor, useInfiniteColumnFilterEditor, useInfiniteHeaderCell, useMasterRowInfo, useOverlay, useOverlayPortal, useRowInfoReducers, useVisibleColumnSizes };
|
package/index.dev.js
CHANGED
|
@@ -851,7 +851,7 @@ function debugPackage(channelName) {
|
|
|
851
851
|
let lastMessageTimestamp = 0;
|
|
852
852
|
const isEnabled = () => enabled != null ? enabled : isLoggingEnabled(channel, storageKeyValue);
|
|
853
853
|
const color = getNextColor(debug.colors);
|
|
854
|
-
const
|
|
854
|
+
const logger2 = Object.defineProperties(
|
|
855
855
|
(...args) => {
|
|
856
856
|
if (isLoggingEnabled(channel, storageKeyValue)) {
|
|
857
857
|
const now = Date.now();
|
|
@@ -928,8 +928,8 @@ function debugPackage(channelName) {
|
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
930
|
);
|
|
931
|
-
loggers.set(channelParts,
|
|
932
|
-
return
|
|
931
|
+
loggers.set(channelParts, logger2);
|
|
932
|
+
return logger2;
|
|
933
933
|
}
|
|
934
934
|
return debugFactory(channelName);
|
|
935
935
|
}
|
|
@@ -4504,7 +4504,6 @@ var notifyChange = (props, callbackPropName, values) => {
|
|
|
4504
4504
|
callbackProp(...values);
|
|
4505
4505
|
}
|
|
4506
4506
|
};
|
|
4507
|
-
var debug3 = dbg("rerender");
|
|
4508
4507
|
var ComponentContext;
|
|
4509
4508
|
function getComponentStateContext() {
|
|
4510
4509
|
if (ComponentContext) {
|
|
@@ -4753,7 +4752,8 @@ function getComponentStateRoot(config) {
|
|
|
4753
4752
|
}
|
|
4754
4753
|
});
|
|
4755
4754
|
if (updatedPropsToStateCount > 0 || newMappedStateCount > 0) {
|
|
4756
|
-
|
|
4755
|
+
const logger2 = config.debugName ? dbg(`${config.debugName}:rerender`) : dbg("rerender");
|
|
4756
|
+
logger2(
|
|
4757
4757
|
"Triggered by new values for the following props",
|
|
4758
4758
|
...[
|
|
4759
4759
|
...Object.keys(newMappedState != null ? newMappedState : {}),
|
|
@@ -12188,7 +12188,7 @@ function getRowSelectionApi(param) {
|
|
|
12188
12188
|
}
|
|
12189
12189
|
|
|
12190
12190
|
// src/components/DataSource/CellSelectionState.ts
|
|
12191
|
-
var
|
|
12191
|
+
var debug3 = dbg("CellSelectionState");
|
|
12192
12192
|
var WILDCARD = "*";
|
|
12193
12193
|
var CellSelectionState = class {
|
|
12194
12194
|
constructor(clone) {
|
|
@@ -12449,7 +12449,7 @@ var CellSelectionState = class {
|
|
|
12449
12449
|
console.error(
|
|
12450
12450
|
`CellSelectionState.isCellSelected should not be called with wildcard`
|
|
12451
12451
|
);
|
|
12452
|
-
|
|
12452
|
+
debug3(
|
|
12453
12453
|
`CellSelectionState.isCellSelected should not be called with wildcard`
|
|
12454
12454
|
);
|
|
12455
12455
|
return false;
|
|
@@ -13779,7 +13779,7 @@ function useLoadData() {
|
|
|
13779
13779
|
notifyScrollbarsChange,
|
|
13780
13780
|
refetchKey,
|
|
13781
13781
|
sortInfo,
|
|
13782
|
-
|
|
13782
|
+
shouldReloadData,
|
|
13783
13783
|
groupBy,
|
|
13784
13784
|
pivotBy,
|
|
13785
13785
|
filterValue,
|
|
@@ -13850,11 +13850,12 @@ function useLoadData() {
|
|
|
13850
13850
|
});
|
|
13851
13851
|
}, [filterValue, filterMode, filterTypes]);
|
|
13852
13852
|
const depsObject = {
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13853
|
+
// #sortMode_vs_shouldReloadData.sortInfo
|
|
13854
|
+
sortInfo: shouldReloadData.sortInfo ? sortInfo : null,
|
|
13855
|
+
groupBy: shouldReloadData.groupBy ? groupBy : null,
|
|
13856
|
+
pivotBy: shouldReloadData.pivotBy ? pivotBy : null,
|
|
13856
13857
|
refetchKey,
|
|
13857
|
-
filterValue: computedFilterValue,
|
|
13858
|
+
filterValue: shouldReloadData.filterValue ? computedFilterValue : null,
|
|
13858
13859
|
cursorId: livePagination ? stateCursorId : null
|
|
13859
13860
|
};
|
|
13860
13861
|
const initialRef = (0, import_react35.useRef)(true);
|
|
@@ -14094,6 +14095,36 @@ function lazyLoadRange(options, cache) {
|
|
|
14094
14095
|
}, initialPromise);
|
|
14095
14096
|
}
|
|
14096
14097
|
|
|
14098
|
+
// src/utils/logger.ts
|
|
14099
|
+
var log = debug("InfiniteTable");
|
|
14100
|
+
var COLOR_WARN_VALUE = `#eb9316`;
|
|
14101
|
+
var warnChannel = "Warn";
|
|
14102
|
+
var errorChannel = "Error";
|
|
14103
|
+
var infoChannel = "Info";
|
|
14104
|
+
var successChannel = "Success";
|
|
14105
|
+
var logChannel = "Logs";
|
|
14106
|
+
var logger = log.extend(logChannel);
|
|
14107
|
+
var infoLogger = logger.extend(infoChannel);
|
|
14108
|
+
var warnLogger = logger.extend(warnChannel);
|
|
14109
|
+
var errorLogger = logger.extend(errorChannel);
|
|
14110
|
+
var successLogger = logger.extend(successChannel);
|
|
14111
|
+
var logColorWarn = COLOR_WARN_VALUE;
|
|
14112
|
+
var warn = (message, logger2) => {
|
|
14113
|
+
logger2 = logger2 ? logger2.extend(warnChannel) : warnLogger;
|
|
14114
|
+
logger2(log.color(logColorWarn, message));
|
|
14115
|
+
};
|
|
14116
|
+
var doOnceFlags = new DeepMap();
|
|
14117
|
+
var doOnce = (func, ...keys) => {
|
|
14118
|
+
if (doOnceFlags.has(keys)) {
|
|
14119
|
+
return;
|
|
14120
|
+
}
|
|
14121
|
+
doOnceFlags.set(keys, true);
|
|
14122
|
+
func();
|
|
14123
|
+
};
|
|
14124
|
+
var warnOnce = (message, key = message, logger2) => {
|
|
14125
|
+
doOnce(() => warn(message, logger2), key, "warn");
|
|
14126
|
+
};
|
|
14127
|
+
|
|
14097
14128
|
// src/components/utils/discardCallsWithEqualArg.ts
|
|
14098
14129
|
var map = /* @__PURE__ */ new WeakMap();
|
|
14099
14130
|
var getCompareDefault = (a) => a;
|
|
@@ -14204,6 +14235,7 @@ var normalizeSortInfo = (initialSortInfo, weakMap3) => {
|
|
|
14204
14235
|
};
|
|
14205
14236
|
|
|
14206
14237
|
// src/components/DataSource/state/getInitialState.ts
|
|
14238
|
+
var DataSourceLogger = dbg("DataSource");
|
|
14207
14239
|
var defaultCursorId = Symbol("cursorId");
|
|
14208
14240
|
function initSetupState() {
|
|
14209
14241
|
const now = Date.now();
|
|
@@ -14334,7 +14366,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
14334
14366
|
}
|
|
14335
14367
|
var weakMap = /* @__PURE__ */ new WeakMap();
|
|
14336
14368
|
function deriveStateFromProps(params) {
|
|
14337
|
-
var _a, _b, _c;
|
|
14369
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
14338
14370
|
const { props, state, oldState } = params;
|
|
14339
14371
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
14340
14372
|
const controlledFilter = isControlledValue(props.filterValue);
|
|
@@ -14423,17 +14455,61 @@ function deriveStateFromProps(params) {
|
|
|
14423
14455
|
collapsedRows: []
|
|
14424
14456
|
}
|
|
14425
14457
|
);
|
|
14458
|
+
const { shouldReloadData = {} } = props;
|
|
14459
|
+
const propsGroupMode = (_b = props.groupMode) != null ? _b : shouldReloadData.groupBy != null ? shouldReloadData.groupBy ? "remote" : "local" : void 0;
|
|
14460
|
+
const propsSortMode = ((_c = props.sortMode) != null ? _c : shouldReloadData.sortInfo != null) ? shouldReloadData.sortInfo ? "remote" : "local" : void 0;
|
|
14461
|
+
const propsFilterMode = ((_d = props.filterMode) != null ? _d : shouldReloadData.filterValue != null) ? shouldReloadData.filterValue ? "remote" : "local" : void 0;
|
|
14462
|
+
if (props.groupMode) {
|
|
14463
|
+
warnOnce(
|
|
14464
|
+
`"groupMode" prop is deprecated for the <DataSource />, use "shouldReloadData.groupBy: true|false" instead`,
|
|
14465
|
+
"groupMode deprecated",
|
|
14466
|
+
DataSourceLogger
|
|
14467
|
+
);
|
|
14468
|
+
}
|
|
14469
|
+
if (props.sortMode) {
|
|
14470
|
+
warnOnce(
|
|
14471
|
+
`"sortMode" prop is deprecated for the <DataSource />, use "shouldReloadData.sortInfo: true|false" instead`,
|
|
14472
|
+
"sortMode deprecated",
|
|
14473
|
+
DataSourceLogger
|
|
14474
|
+
);
|
|
14475
|
+
}
|
|
14476
|
+
if (props.filterMode) {
|
|
14477
|
+
warnOnce(
|
|
14478
|
+
`"filterMode" prop is deprecated for the <DataSource />, use "shouldReloadData.filterValue: true|false" instead`,
|
|
14479
|
+
"filterMode deprecated",
|
|
14480
|
+
DataSourceLogger
|
|
14481
|
+
);
|
|
14482
|
+
}
|
|
14483
|
+
const groupMode = typeof props.data === "function" ? propsGroupMode != null ? propsGroupMode : "local" : "local";
|
|
14484
|
+
const sortMode = props.sortFunction ? "local" : propsSortMode != null ? propsSortMode : controlledSort ? "remote" : "local";
|
|
14485
|
+
const filterMode = typeof props.filterFunction === "function" ? "local" : propsFilterMode != null ? propsFilterMode : typeof props.data === "function" ? "remote" : "local";
|
|
14486
|
+
const pivotMode = shouldReloadData.pivotBy ? "remote" : "local";
|
|
14426
14487
|
const result = {
|
|
14427
14488
|
selectionMode,
|
|
14428
14489
|
groupRowsState,
|
|
14490
|
+
shouldReloadData: {
|
|
14491
|
+
// #sortMode_vs_shouldReloadData.sortInfo
|
|
14492
|
+
// we reconstruct this object
|
|
14493
|
+
// and don't default to the computed filterMode, sortMode, groupMode and pivotMode
|
|
14494
|
+
// as computed above
|
|
14495
|
+
// since we want a subtle difference between the computed sortMode and shouldReloadData.sortInfo (for example)
|
|
14496
|
+
// difference: sortMode will be local when sortFunction is provided, however, the user may want to reload data when sortInfo changes
|
|
14497
|
+
// and thus the data will be refetched, but will be sorted locally
|
|
14498
|
+
filterValue: (_f = (_e = props.shouldReloadData) == null ? void 0 : _e.filterValue) != null ? _f : filterMode === "remote",
|
|
14499
|
+
sortInfo: (_h = (_g = props.shouldReloadData) == null ? void 0 : _g.sortInfo) != null ? _h : sortMode === "remote",
|
|
14500
|
+
groupBy: (_j = (_i = props.shouldReloadData) == null ? void 0 : _i.groupBy) != null ? _j : groupMode === "remote",
|
|
14501
|
+
pivotBy: (_l = (_k = props.shouldReloadData) == null ? void 0 : _k.pivotBy) != null ? _l : pivotMode === "remote"
|
|
14502
|
+
},
|
|
14429
14503
|
rowSelection: rowSelectionState,
|
|
14430
14504
|
cellSelection: cellSelectionState,
|
|
14505
|
+
groupMode,
|
|
14506
|
+
sortMode,
|
|
14507
|
+
filterMode,
|
|
14508
|
+
pivotMode,
|
|
14431
14509
|
toPrimaryKey,
|
|
14432
14510
|
operatorsByFilterType,
|
|
14433
14511
|
controlledSort,
|
|
14434
14512
|
controlledFilter,
|
|
14435
|
-
sortMode: props.sortFunction ? "local" : (_b = props.sortMode) != null ? _b : controlledSort ? "remote" : "local",
|
|
14436
|
-
filterMode: typeof props.filterFunction === "function" ? "local" : (_c = props.filterMode) != null ? _c : typeof props.data === "function" ? "remote" : "local",
|
|
14437
14513
|
multiSort: Array.isArray(
|
|
14438
14514
|
controlledSort ? props.sortInfo : props.defaultSortInfo
|
|
14439
14515
|
),
|
|
@@ -14969,6 +15045,7 @@ function DataSourceWithContext(props) {
|
|
|
14969
15045
|
return /* @__PURE__ */ React50.createElement(React50.Fragment, null, children);
|
|
14970
15046
|
}
|
|
14971
15047
|
var DataSourceRoot = getComponentStateRoot({
|
|
15048
|
+
debugName: "DataSource",
|
|
14972
15049
|
//@ts-ignore
|
|
14973
15050
|
initSetupState,
|
|
14974
15051
|
//@ts-ignore
|
|
@@ -17068,13 +17145,13 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
17068
17145
|
|
|
17069
17146
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
17070
17147
|
var import_react42 = require("react");
|
|
17071
|
-
var
|
|
17148
|
+
var debug4 = dbg("useColumnSizeFn");
|
|
17072
17149
|
function useColumnSizeFn(columns) {
|
|
17073
17150
|
const columnSize = (0, import_react42.useCallback)(
|
|
17074
17151
|
(index) => {
|
|
17075
17152
|
const column = columns[index];
|
|
17076
17153
|
if (false) {
|
|
17077
|
-
|
|
17154
|
+
debug4("cannot find column at index", index, columns);
|
|
17078
17155
|
}
|
|
17079
17156
|
return column ? column.computedWidth : 0;
|
|
17080
17157
|
},
|
|
@@ -18634,7 +18711,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
18634
18711
|
}
|
|
18635
18712
|
let valid2 = isValidLicense(licenseKey, {
|
|
18636
18713
|
publishedAt: 1624970570587,
|
|
18637
|
-
version: "4.
|
|
18714
|
+
version: "4.2.0"
|
|
18638
18715
|
});
|
|
18639
18716
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
18640
18717
|
return true;
|
package/index.dev.mjs
CHANGED
|
@@ -799,7 +799,7 @@ function debugPackage(channelName) {
|
|
|
799
799
|
let lastMessageTimestamp = 0;
|
|
800
800
|
const isEnabled = () => enabled != null ? enabled : isLoggingEnabled(channel, storageKeyValue);
|
|
801
801
|
const color = getNextColor(debug.colors);
|
|
802
|
-
const
|
|
802
|
+
const logger2 = Object.defineProperties(
|
|
803
803
|
(...args) => {
|
|
804
804
|
if (isLoggingEnabled(channel, storageKeyValue)) {
|
|
805
805
|
const now = Date.now();
|
|
@@ -876,8 +876,8 @@ function debugPackage(channelName) {
|
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
878
|
);
|
|
879
|
-
loggers.set(channelParts,
|
|
880
|
-
return
|
|
879
|
+
loggers.set(channelParts, logger2);
|
|
880
|
+
return logger2;
|
|
881
881
|
}
|
|
882
882
|
return debugFactory(channelName);
|
|
883
883
|
}
|
|
@@ -4471,7 +4471,6 @@ var notifyChange = (props, callbackPropName, values) => {
|
|
|
4471
4471
|
callbackProp(...values);
|
|
4472
4472
|
}
|
|
4473
4473
|
};
|
|
4474
|
-
var debug3 = dbg("rerender");
|
|
4475
4474
|
var ComponentContext;
|
|
4476
4475
|
function getComponentStateContext() {
|
|
4477
4476
|
if (ComponentContext) {
|
|
@@ -4720,7 +4719,8 @@ function getComponentStateRoot(config) {
|
|
|
4720
4719
|
}
|
|
4721
4720
|
});
|
|
4722
4721
|
if (updatedPropsToStateCount > 0 || newMappedStateCount > 0) {
|
|
4723
|
-
|
|
4722
|
+
const logger2 = config.debugName ? dbg(`${config.debugName}:rerender`) : dbg("rerender");
|
|
4723
|
+
logger2(
|
|
4724
4724
|
"Triggered by new values for the following props",
|
|
4725
4725
|
...[
|
|
4726
4726
|
...Object.keys(newMappedState != null ? newMappedState : {}),
|
|
@@ -12155,7 +12155,7 @@ function getRowSelectionApi(param) {
|
|
|
12155
12155
|
}
|
|
12156
12156
|
|
|
12157
12157
|
// src/components/DataSource/CellSelectionState.ts
|
|
12158
|
-
var
|
|
12158
|
+
var debug3 = dbg("CellSelectionState");
|
|
12159
12159
|
var WILDCARD = "*";
|
|
12160
12160
|
var CellSelectionState = class {
|
|
12161
12161
|
constructor(clone) {
|
|
@@ -12416,7 +12416,7 @@ var CellSelectionState = class {
|
|
|
12416
12416
|
console.error(
|
|
12417
12417
|
`CellSelectionState.isCellSelected should not be called with wildcard`
|
|
12418
12418
|
);
|
|
12419
|
-
|
|
12419
|
+
debug3(
|
|
12420
12420
|
`CellSelectionState.isCellSelected should not be called with wildcard`
|
|
12421
12421
|
);
|
|
12422
12422
|
return false;
|
|
@@ -13746,7 +13746,7 @@ function useLoadData() {
|
|
|
13746
13746
|
notifyScrollbarsChange,
|
|
13747
13747
|
refetchKey,
|
|
13748
13748
|
sortInfo,
|
|
13749
|
-
|
|
13749
|
+
shouldReloadData,
|
|
13750
13750
|
groupBy,
|
|
13751
13751
|
pivotBy,
|
|
13752
13752
|
filterValue,
|
|
@@ -13817,11 +13817,12 @@ function useLoadData() {
|
|
|
13817
13817
|
});
|
|
13818
13818
|
}, [filterValue, filterMode, filterTypes]);
|
|
13819
13819
|
const depsObject = {
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13820
|
+
// #sortMode_vs_shouldReloadData.sortInfo
|
|
13821
|
+
sortInfo: shouldReloadData.sortInfo ? sortInfo : null,
|
|
13822
|
+
groupBy: shouldReloadData.groupBy ? groupBy : null,
|
|
13823
|
+
pivotBy: shouldReloadData.pivotBy ? pivotBy : null,
|
|
13823
13824
|
refetchKey,
|
|
13824
|
-
filterValue: computedFilterValue,
|
|
13825
|
+
filterValue: shouldReloadData.filterValue ? computedFilterValue : null,
|
|
13825
13826
|
cursorId: livePagination ? stateCursorId : null
|
|
13826
13827
|
};
|
|
13827
13828
|
const initialRef = useRef21(true);
|
|
@@ -14061,6 +14062,36 @@ function lazyLoadRange(options, cache) {
|
|
|
14061
14062
|
}, initialPromise);
|
|
14062
14063
|
}
|
|
14063
14064
|
|
|
14065
|
+
// src/utils/logger.ts
|
|
14066
|
+
var log = debug("InfiniteTable");
|
|
14067
|
+
var COLOR_WARN_VALUE = `#eb9316`;
|
|
14068
|
+
var warnChannel = "Warn";
|
|
14069
|
+
var errorChannel = "Error";
|
|
14070
|
+
var infoChannel = "Info";
|
|
14071
|
+
var successChannel = "Success";
|
|
14072
|
+
var logChannel = "Logs";
|
|
14073
|
+
var logger = log.extend(logChannel);
|
|
14074
|
+
var infoLogger = logger.extend(infoChannel);
|
|
14075
|
+
var warnLogger = logger.extend(warnChannel);
|
|
14076
|
+
var errorLogger = logger.extend(errorChannel);
|
|
14077
|
+
var successLogger = logger.extend(successChannel);
|
|
14078
|
+
var logColorWarn = COLOR_WARN_VALUE;
|
|
14079
|
+
var warn = (message, logger2) => {
|
|
14080
|
+
logger2 = logger2 ? logger2.extend(warnChannel) : warnLogger;
|
|
14081
|
+
logger2(log.color(logColorWarn, message));
|
|
14082
|
+
};
|
|
14083
|
+
var doOnceFlags = new DeepMap();
|
|
14084
|
+
var doOnce = (func, ...keys) => {
|
|
14085
|
+
if (doOnceFlags.has(keys)) {
|
|
14086
|
+
return;
|
|
14087
|
+
}
|
|
14088
|
+
doOnceFlags.set(keys, true);
|
|
14089
|
+
func();
|
|
14090
|
+
};
|
|
14091
|
+
var warnOnce = (message, key = message, logger2) => {
|
|
14092
|
+
doOnce(() => warn(message, logger2), key, "warn");
|
|
14093
|
+
};
|
|
14094
|
+
|
|
14064
14095
|
// src/components/utils/discardCallsWithEqualArg.ts
|
|
14065
14096
|
var map = /* @__PURE__ */ new WeakMap();
|
|
14066
14097
|
var getCompareDefault = (a) => a;
|
|
@@ -14171,6 +14202,7 @@ var normalizeSortInfo = (initialSortInfo, weakMap3) => {
|
|
|
14171
14202
|
};
|
|
14172
14203
|
|
|
14173
14204
|
// src/components/DataSource/state/getInitialState.ts
|
|
14205
|
+
var DataSourceLogger = dbg("DataSource");
|
|
14174
14206
|
var defaultCursorId = Symbol("cursorId");
|
|
14175
14207
|
function initSetupState() {
|
|
14176
14208
|
const now = Date.now();
|
|
@@ -14301,7 +14333,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
14301
14333
|
}
|
|
14302
14334
|
var weakMap = /* @__PURE__ */ new WeakMap();
|
|
14303
14335
|
function deriveStateFromProps(params) {
|
|
14304
|
-
var _a, _b, _c;
|
|
14336
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
14305
14337
|
const { props, state, oldState } = params;
|
|
14306
14338
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
14307
14339
|
const controlledFilter = isControlledValue(props.filterValue);
|
|
@@ -14390,17 +14422,61 @@ function deriveStateFromProps(params) {
|
|
|
14390
14422
|
collapsedRows: []
|
|
14391
14423
|
}
|
|
14392
14424
|
);
|
|
14425
|
+
const { shouldReloadData = {} } = props;
|
|
14426
|
+
const propsGroupMode = (_b = props.groupMode) != null ? _b : shouldReloadData.groupBy != null ? shouldReloadData.groupBy ? "remote" : "local" : void 0;
|
|
14427
|
+
const propsSortMode = ((_c = props.sortMode) != null ? _c : shouldReloadData.sortInfo != null) ? shouldReloadData.sortInfo ? "remote" : "local" : void 0;
|
|
14428
|
+
const propsFilterMode = ((_d = props.filterMode) != null ? _d : shouldReloadData.filterValue != null) ? shouldReloadData.filterValue ? "remote" : "local" : void 0;
|
|
14429
|
+
if (props.groupMode) {
|
|
14430
|
+
warnOnce(
|
|
14431
|
+
`"groupMode" prop is deprecated for the <DataSource />, use "shouldReloadData.groupBy: true|false" instead`,
|
|
14432
|
+
"groupMode deprecated",
|
|
14433
|
+
DataSourceLogger
|
|
14434
|
+
);
|
|
14435
|
+
}
|
|
14436
|
+
if (props.sortMode) {
|
|
14437
|
+
warnOnce(
|
|
14438
|
+
`"sortMode" prop is deprecated for the <DataSource />, use "shouldReloadData.sortInfo: true|false" instead`,
|
|
14439
|
+
"sortMode deprecated",
|
|
14440
|
+
DataSourceLogger
|
|
14441
|
+
);
|
|
14442
|
+
}
|
|
14443
|
+
if (props.filterMode) {
|
|
14444
|
+
warnOnce(
|
|
14445
|
+
`"filterMode" prop is deprecated for the <DataSource />, use "shouldReloadData.filterValue: true|false" instead`,
|
|
14446
|
+
"filterMode deprecated",
|
|
14447
|
+
DataSourceLogger
|
|
14448
|
+
);
|
|
14449
|
+
}
|
|
14450
|
+
const groupMode = typeof props.data === "function" ? propsGroupMode != null ? propsGroupMode : "local" : "local";
|
|
14451
|
+
const sortMode = props.sortFunction ? "local" : propsSortMode != null ? propsSortMode : controlledSort ? "remote" : "local";
|
|
14452
|
+
const filterMode = typeof props.filterFunction === "function" ? "local" : propsFilterMode != null ? propsFilterMode : typeof props.data === "function" ? "remote" : "local";
|
|
14453
|
+
const pivotMode = shouldReloadData.pivotBy ? "remote" : "local";
|
|
14393
14454
|
const result = {
|
|
14394
14455
|
selectionMode,
|
|
14395
14456
|
groupRowsState,
|
|
14457
|
+
shouldReloadData: {
|
|
14458
|
+
// #sortMode_vs_shouldReloadData.sortInfo
|
|
14459
|
+
// we reconstruct this object
|
|
14460
|
+
// and don't default to the computed filterMode, sortMode, groupMode and pivotMode
|
|
14461
|
+
// as computed above
|
|
14462
|
+
// since we want a subtle difference between the computed sortMode and shouldReloadData.sortInfo (for example)
|
|
14463
|
+
// difference: sortMode will be local when sortFunction is provided, however, the user may want to reload data when sortInfo changes
|
|
14464
|
+
// and thus the data will be refetched, but will be sorted locally
|
|
14465
|
+
filterValue: (_f = (_e = props.shouldReloadData) == null ? void 0 : _e.filterValue) != null ? _f : filterMode === "remote",
|
|
14466
|
+
sortInfo: (_h = (_g = props.shouldReloadData) == null ? void 0 : _g.sortInfo) != null ? _h : sortMode === "remote",
|
|
14467
|
+
groupBy: (_j = (_i = props.shouldReloadData) == null ? void 0 : _i.groupBy) != null ? _j : groupMode === "remote",
|
|
14468
|
+
pivotBy: (_l = (_k = props.shouldReloadData) == null ? void 0 : _k.pivotBy) != null ? _l : pivotMode === "remote"
|
|
14469
|
+
},
|
|
14396
14470
|
rowSelection: rowSelectionState,
|
|
14397
14471
|
cellSelection: cellSelectionState,
|
|
14472
|
+
groupMode,
|
|
14473
|
+
sortMode,
|
|
14474
|
+
filterMode,
|
|
14475
|
+
pivotMode,
|
|
14398
14476
|
toPrimaryKey,
|
|
14399
14477
|
operatorsByFilterType,
|
|
14400
14478
|
controlledSort,
|
|
14401
14479
|
controlledFilter,
|
|
14402
|
-
sortMode: props.sortFunction ? "local" : (_b = props.sortMode) != null ? _b : controlledSort ? "remote" : "local",
|
|
14403
|
-
filterMode: typeof props.filterFunction === "function" ? "local" : (_c = props.filterMode) != null ? _c : typeof props.data === "function" ? "remote" : "local",
|
|
14404
14480
|
multiSort: Array.isArray(
|
|
14405
14481
|
controlledSort ? props.sortInfo : props.defaultSortInfo
|
|
14406
14482
|
),
|
|
@@ -14936,6 +15012,7 @@ function DataSourceWithContext(props) {
|
|
|
14936
15012
|
return /* @__PURE__ */ React50.createElement(React50.Fragment, null, children);
|
|
14937
15013
|
}
|
|
14938
15014
|
var DataSourceRoot = getComponentStateRoot({
|
|
15015
|
+
debugName: "DataSource",
|
|
14939
15016
|
//@ts-ignore
|
|
14940
15017
|
initSetupState,
|
|
14941
15018
|
//@ts-ignore
|
|
@@ -17039,13 +17116,13 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
17039
17116
|
|
|
17040
17117
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
17041
17118
|
import { useCallback as useCallback20 } from "react";
|
|
17042
|
-
var
|
|
17119
|
+
var debug4 = dbg("useColumnSizeFn");
|
|
17043
17120
|
function useColumnSizeFn(columns) {
|
|
17044
17121
|
const columnSize = useCallback20(
|
|
17045
17122
|
(index) => {
|
|
17046
17123
|
const column = columns[index];
|
|
17047
17124
|
if (false) {
|
|
17048
|
-
|
|
17125
|
+
debug4("cannot find column at index", index, columns);
|
|
17049
17126
|
}
|
|
17050
17127
|
return column ? column.computedWidth : 0;
|
|
17051
17128
|
},
|
|
@@ -18605,7 +18682,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
18605
18682
|
}
|
|
18606
18683
|
let valid2 = isValidLicense(licenseKey, {
|
|
18607
18684
|
publishedAt: 1624970570587,
|
|
18608
|
-
version: "4.
|
|
18685
|
+
version: "4.2.0"
|
|
18609
18686
|
});
|
|
18610
18687
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
18611
18688
|
return true;
|