@infinite-table/infinite-react 6.0.11 → 6.0.13
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 +17 -8
- package/index.dev.js +44 -6
- package/index.dev.mjs +44 -6
- package/index.js +44 -6
- package/index.mjs +44 -6
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -2300,6 +2300,13 @@ declare class GroupRowsState<KeyType extends any = any> extends BooleanDeepColle
|
|
|
2300
2300
|
toggleGroupRow(keys: KeyType[]): void;
|
|
2301
2301
|
}
|
|
2302
2302
|
|
|
2303
|
+
declare type IndexerOptions<DataType, PrimaryKeyType> = {
|
|
2304
|
+
toPrimaryKey: (data: DataType) => PrimaryKeyType;
|
|
2305
|
+
cache?: DataSourceCache<DataType, PrimaryKeyType>;
|
|
2306
|
+
getNodeChildren?: TreeParams<DataType, PrimaryKeyType>['getNodeChildren'];
|
|
2307
|
+
isLeafNode?: TreeParams<DataType, PrimaryKeyType>['isLeafNode'];
|
|
2308
|
+
nodesKey: string | undefined;
|
|
2309
|
+
};
|
|
2303
2310
|
declare class Indexer<DataType, PrimaryKeyType = string> {
|
|
2304
2311
|
primaryKeyToData: Map<PrimaryKeyType, DataType>;
|
|
2305
2312
|
nodePathsToData: DeepMap<PrimaryKeyType, DataType>;
|
|
@@ -2308,13 +2315,7 @@ declare class Indexer<DataType, PrimaryKeyType = string> {
|
|
|
2308
2315
|
clear: () => void;
|
|
2309
2316
|
getDataForPrimaryKey: (primaryKey: PrimaryKeyType) => DataType | undefined;
|
|
2310
2317
|
getDataForNodePath: (nodePath: NodePath$1<any>) => DataType | undefined;
|
|
2311
|
-
indexArray: (arr: DataType[], options:
|
|
2312
|
-
toPrimaryKey: (data: DataType) => PrimaryKeyType;
|
|
2313
|
-
cache?: DataSourceCache<DataType, PrimaryKeyType> | undefined;
|
|
2314
|
-
getNodeChildren?: ((item: DataType) => DataType[] | null) | undefined;
|
|
2315
|
-
isLeafNode?: ((item: DataType) => boolean) | undefined;
|
|
2316
|
-
nodesKey: string | undefined;
|
|
2317
|
-
}) => DataType[];
|
|
2318
|
+
indexArray: (arr: DataType[], options: IndexerOptions<DataType, PrimaryKeyType>) => DataType[];
|
|
2318
2319
|
}
|
|
2319
2320
|
|
|
2320
2321
|
declare class RowDisabledState<KeyType = any> extends BooleanCollectionState<RowDisabledStateObject<KeyType>, KeyType> {
|
|
@@ -2600,6 +2601,7 @@ declare type DataSourceInsertParam = DataSourceCRUDParam & ({
|
|
|
2600
2601
|
position: 'start' | 'end';
|
|
2601
2602
|
nodePath: NodePath$1;
|
|
2602
2603
|
});
|
|
2604
|
+
declare type UpdateChildrenFn<T> = (dataChildren: T[] | undefined | null, data: T) => T[] | undefined | null;
|
|
2603
2605
|
interface DataSourceApi<T> {
|
|
2604
2606
|
getOriginalDataArray: () => T[];
|
|
2605
2607
|
getRowInfoArray: () => InfiniteTableRowInfo<T>[];
|
|
@@ -2617,6 +2619,7 @@ interface DataSourceApi<T> {
|
|
|
2617
2619
|
get treeApi(): TreeApi<T>;
|
|
2618
2620
|
updateData(data: Partial<T>, options?: DataSourceCRUDParam): Promise<any>;
|
|
2619
2621
|
updateDataByNodePath(data: Partial<T>, nodePath: NodePath$1, options?: DataSourceUpdateParam): Promise<any>;
|
|
2622
|
+
updateChildrenByNodePath(childrenOrFn: T[] | undefined | null | UpdateChildrenFn<T>, nodePath: NodePath$1, options?: DataSourceUpdateParam): Promise<any>;
|
|
2620
2623
|
updateDataArray(data: Partial<T>[], options?: DataSourceCRUDParam): Promise<any>;
|
|
2621
2624
|
updateDataArrayByNodePath(updateInfo: {
|
|
2622
2625
|
data: Partial<T>;
|
|
@@ -6021,6 +6024,12 @@ declare type PivotBy<DataType, KeyType> = Omit<GroupBy<DataType, KeyType>, 'colu
|
|
|
6021
6024
|
columnGroup: InfiniteTablePivotFinalColumnGroup<DataType, KeyType>;
|
|
6022
6025
|
}) => ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnGroup<DataType>>>);
|
|
6023
6026
|
};
|
|
6027
|
+
declare type TreeParams<DataType, _KeyType> = {
|
|
6028
|
+
isLeafNode: (item: DataType) => boolean;
|
|
6029
|
+
getNodeChildren: (item: DataType) => null | DataType[];
|
|
6030
|
+
toKey: (item: DataType) => any;
|
|
6031
|
+
reducers?: Record<string, DataSourceAggregationReducer<DataType, any>>;
|
|
6032
|
+
};
|
|
6024
6033
|
declare type GroupParams<DataType, KeyType> = {
|
|
6025
6034
|
groupBy: GroupBy<DataType, KeyType>[];
|
|
6026
6035
|
defaultToKey?: (value: any, item: DataType) => GroupKeyType<KeyType>;
|
|
@@ -6979,4 +6988,4 @@ declare const components: {
|
|
|
6979
6988
|
NumberFilterEditor: typeof NumberFilterEditor;
|
|
6980
6989
|
};
|
|
6981
6990
|
|
|
6982
|
-
export { AdvancedAlignable, CellSelectionState, CellSelectionStateObject, ColumnTypeWithInherit, DataClient, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceApi, DataSourceCRUDParam, DataSourceCallback_BaseParam, 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, DataSourcePropIsNodeExpanded, DataSourcePropIsNodeReadOnly, DataSourcePropIsNodeSelectable, DataSourcePropIsNodeSelected, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnCellSelectionChange_MultiCell, DataSourcePropOnCellSelectionChange_SingleCell, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropOnTreeSelectionChange, DataSourcePropOnTreeSelectionChange_MultiNode, DataSourcePropOnTreeSelectionChange_SingleNode, DataSourcePropPivotBy, DataSourcePropRowInfoReducers, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropShouldReloadData, DataSourcePropShouldReloadDataObject, DataSourcePropSortFn, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourcePropTreeSelection, DataSourcePropTreeSelection_MultiNode, DataSourcePropTreeSelection_SingleNode, DataSourceProps, DataSourcePropsNotAvailableInTreeDataSource, DataSourcePropsWithChildren, DataSourceRawReducer, DataSourceRemoteData, DataSourceRowInfoReducer, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, DataSourceUpdateParam, DebugLogger, DeepMap, ElementContainerGetter, FixedSizeSet, FlashingColumnCell, 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, InfiniteTablePropColumnGroupVisibility, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropGetCellContextMenuItems, InfiniteTablePropGetColumnMenuItems, InfiniteTablePropGetContextMenuItems, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropKeyboardShorcut, InfiniteTablePropMultiSortBehavior, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTablePropsNotAvailableInTreeGrid, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, InfiniteTable_HasGrouping_RowInfoGroup, InfiniteTable_HasGrouping_RowInfoNormal, InfiniteTable_Tree_RowInfoLeafNode, InfiniteTable_Tree_RowInfoNode, InfiniteTable_Tree_RowInfoParentNode, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Menu, MenuChildrenFnParam, MenuColumn, MenuColumnRenderParam, MenuDecoration, MenuIconProps, MenuItemActionContext, MenuItemDefinition, MenuItemObject, MenuProps, MenuRenderable, MenuRuntimeItem, MenuRuntimeItemSelectable, MenuSeparator, OverlayShowParams, RowDetailCache, RowDetailState, RowDetailStateObject, RowDisabledState, RowDisabledStateObject, RowSelectionState, ScrollStopInfo, Scrollbars, ShowOverlayFn, TableRenderRange, TreeDataSource, TreeDataSourceProps, TreeExpandState, TreeExpandStateValue, TreeGrid, TreeGridOnlyProps, TreeGridProps, TreeSelectionState, TreeSelectionValue, UpdateOverlayContentFn, WeakFixedSizeSet, alignNode, components, createFlashingColumnCellComponent, debounce, debug, defaultFilterTypes, eventMatchesKeyboardShortcut, defaultFilterTypes as filterTypes, flatten, buildManagedComponent as getComponentStateRoot, group, interceptMap, keyboardShortcuts, multisort, multisortNested, queryKeyToCacheKey, toTreeDataArray, useManagedComponentState as useComponentState, useDataSourceInternal, useDataSourceState, useEffectWhen, useEffectWhenSameDeps, useEffectWithChanges, useEffectWithObject, useGridScroll, useInfiniteColumnCell, useInfiniteColumnEditor, useInfiniteColumnFilterEditor, useInfiniteHeaderCell, useInfinitePortalContainer, useManagedDataSource, useMasterRowInfo, useOverlay, useOverlayPortal, usePrevious, useRowInfoReducers, useVisibleColumnSizes };
|
|
6991
|
+
export { AdvancedAlignable, CellSelectionState, CellSelectionStateObject, ColumnTypeWithInherit, DataClient, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceApi, DataSourceCRUDParam, DataSourceCallback_BaseParam, 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, DataSourcePropIsNodeExpanded, DataSourcePropIsNodeReadOnly, DataSourcePropIsNodeSelectable, DataSourcePropIsNodeSelected, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnCellSelectionChange_MultiCell, DataSourcePropOnCellSelectionChange_SingleCell, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropOnTreeSelectionChange, DataSourcePropOnTreeSelectionChange_MultiNode, DataSourcePropOnTreeSelectionChange_SingleNode, DataSourcePropPivotBy, DataSourcePropRowInfoReducers, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropShouldReloadData, DataSourcePropShouldReloadDataObject, DataSourcePropSortFn, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourcePropTreeSelection, DataSourcePropTreeSelection_MultiNode, DataSourcePropTreeSelection_SingleNode, DataSourceProps, DataSourcePropsNotAvailableInTreeDataSource, DataSourcePropsWithChildren, DataSourceRawReducer, DataSourceRemoteData, DataSourceRowInfoReducer, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, DataSourceUpdateParam, DebugLogger, DeepMap, ElementContainerGetter, FixedSizeSet, FlashingColumnCell, 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, InfiniteTablePropColumnGroupVisibility, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropGetCellContextMenuItems, InfiniteTablePropGetColumnMenuItems, InfiniteTablePropGetContextMenuItems, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropKeyboardShorcut, InfiniteTablePropMultiSortBehavior, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTablePropsNotAvailableInTreeGrid, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, InfiniteTable_HasGrouping_RowInfoGroup, InfiniteTable_HasGrouping_RowInfoNormal, InfiniteTable_Tree_RowInfoLeafNode, InfiniteTable_Tree_RowInfoNode, InfiniteTable_Tree_RowInfoParentNode, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Menu, MenuChildrenFnParam, MenuColumn, MenuColumnRenderParam, MenuDecoration, MenuIconProps, MenuItemActionContext, MenuItemDefinition, MenuItemObject, MenuProps, MenuRenderable, MenuRuntimeItem, MenuRuntimeItemSelectable, MenuSeparator, OverlayShowParams, RowDetailCache, RowDetailState, RowDetailStateObject, RowDisabledState, RowDisabledStateObject, RowSelectionState, ScrollStopInfo, Scrollbars, ShowOverlayFn, TableRenderRange, TreeDataSource, TreeDataSourceProps, TreeExpandState, TreeExpandStateValue, TreeGrid, TreeGridOnlyProps, TreeGridProps, TreeSelectionState, TreeSelectionValue, UpdateChildrenFn, UpdateOverlayContentFn, WeakFixedSizeSet, alignNode, components, createFlashingColumnCellComponent, debounce, debug, defaultFilterTypes, eventMatchesKeyboardShortcut, defaultFilterTypes as filterTypes, flatten, buildManagedComponent as getComponentStateRoot, group, interceptMap, keyboardShortcuts, multisort, multisortNested, queryKeyToCacheKey, toTreeDataArray, useManagedComponentState as useComponentState, useDataSourceInternal, useDataSourceState, useEffectWhen, useEffectWhenSameDeps, useEffectWithChanges, useEffectWithObject, useGridScroll, useInfiniteColumnCell, useInfiniteColumnEditor, useInfiniteColumnFilterEditor, useInfiniteHeaderCell, useInfinitePortalContainer, useManagedDataSource, useMasterRowInfo, useOverlay, useOverlayPortal, usePrevious, useRowInfoReducers, useVisibleColumnSizes };
|
package/index.dev.js
CHANGED
|
@@ -13858,9 +13858,20 @@ var Indexer = class {
|
|
|
13858
13858
|
this.add = (primaryKey, data) => {
|
|
13859
13859
|
this.primaryKeyToData.set(primaryKey, data);
|
|
13860
13860
|
};
|
|
13861
|
-
this.addNodePath = (nodePath, data) => {
|
|
13861
|
+
this.addNodePath = (nodePath, data, options) => {
|
|
13862
13862
|
this.nodePathsToData.set(nodePath, data);
|
|
13863
13863
|
this.add(nodePath[nodePath.length - 1], data);
|
|
13864
|
+
const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
|
|
13865
|
+
//@ts-ignore
|
|
13866
|
+
data[options.nodesKey]
|
|
13867
|
+
) : null;
|
|
13868
|
+
if (children && Array.isArray(children)) {
|
|
13869
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
13870
|
+
const child = children[i];
|
|
13871
|
+
const childPath = [...nodePath, options.toPrimaryKey(child)];
|
|
13872
|
+
this.addNodePath(childPath, child, options);
|
|
13873
|
+
}
|
|
13874
|
+
}
|
|
13864
13875
|
};
|
|
13865
13876
|
this.clear = () => {
|
|
13866
13877
|
this.primaryKeyToData.clear();
|
|
@@ -13894,7 +13905,7 @@ var Indexer = class {
|
|
|
13894
13905
|
if (info.type === "insert") {
|
|
13895
13906
|
const insertPK = toPrimaryKey(info.data);
|
|
13896
13907
|
if (isTree) {
|
|
13897
|
-
this.addNodePath([insertPK], info.data);
|
|
13908
|
+
this.addNodePath([insertPK], info.data, options);
|
|
13898
13909
|
} else {
|
|
13899
13910
|
this.add(insertPK, info.data);
|
|
13900
13911
|
}
|
|
@@ -13937,7 +13948,7 @@ var Indexer = class {
|
|
|
13937
13948
|
const insertPK = toPrimaryKey(info.data);
|
|
13938
13949
|
if (isTreeModeForNode) {
|
|
13939
13950
|
const currentPath = [...parentPath, insertPK];
|
|
13940
|
-
this.addNodePath(currentPath, info.data);
|
|
13951
|
+
this.addNodePath(currentPath, info.data, options);
|
|
13941
13952
|
} else {
|
|
13942
13953
|
this.add(insertPK, info.data);
|
|
13943
13954
|
}
|
|
@@ -13967,7 +13978,7 @@ var Indexer = class {
|
|
|
13967
13978
|
indexArray(children, parentPath);
|
|
13968
13979
|
parentPath.pop();
|
|
13969
13980
|
}
|
|
13970
|
-
this.addNodePath(nodePath, item);
|
|
13981
|
+
this.addNodePath(nodePath, item, options);
|
|
13971
13982
|
} else {
|
|
13972
13983
|
this.add(pk, item);
|
|
13973
13984
|
}
|
|
@@ -15326,7 +15337,16 @@ var DataSourceApiImpl = class {
|
|
|
15326
15337
|
};
|
|
15327
15338
|
this.getDataByNodePath = (nodePath) => {
|
|
15328
15339
|
const { indexer } = this.getState();
|
|
15329
|
-
|
|
15340
|
+
const data = indexer.getDataForNodePath(nodePath);
|
|
15341
|
+
if (!data) {
|
|
15342
|
+
console.warn(
|
|
15343
|
+
`getDataByNodePath: no data found for nodePath: "${nodePath.join(
|
|
15344
|
+
" / "
|
|
15345
|
+
)}"`
|
|
15346
|
+
);
|
|
15347
|
+
return null;
|
|
15348
|
+
}
|
|
15349
|
+
return data;
|
|
15330
15350
|
};
|
|
15331
15351
|
/**
|
|
15332
15352
|
* Replaces all data in the DataSource with the provided data.
|
|
@@ -15383,6 +15403,24 @@ var DataSourceApiImpl = class {
|
|
|
15383
15403
|
}
|
|
15384
15404
|
return result;
|
|
15385
15405
|
};
|
|
15406
|
+
this.updateChildrenByNodePath = (childrenOrFn, nodePath, options) => {
|
|
15407
|
+
const data = this.getDataByNodePath(nodePath);
|
|
15408
|
+
if (data == null) {
|
|
15409
|
+
return Promise.resolve(null);
|
|
15410
|
+
}
|
|
15411
|
+
const nodesKey = this.getState().nodesKey;
|
|
15412
|
+
const dataChildren = data[nodesKey];
|
|
15413
|
+
debugger;
|
|
15414
|
+
const children = typeof childrenOrFn === "function" ? childrenOrFn(dataChildren, data) : childrenOrFn;
|
|
15415
|
+
return this.updateDataByNodePath(
|
|
15416
|
+
{
|
|
15417
|
+
...data,
|
|
15418
|
+
[nodesKey]: children
|
|
15419
|
+
},
|
|
15420
|
+
nodePath,
|
|
15421
|
+
options
|
|
15422
|
+
);
|
|
15423
|
+
};
|
|
15386
15424
|
this.updateDataByNodePath = (data, nodePath, options) => {
|
|
15387
15425
|
return this.updateDataArrayByNodePath(
|
|
15388
15426
|
[
|
|
@@ -22202,7 +22240,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
22202
22240
|
}
|
|
22203
22241
|
let valid2 = isValidLicense(licenseKey, {
|
|
22204
22242
|
publishedAt: 1624970570587,
|
|
22205
|
-
version: "6.0.
|
|
22243
|
+
version: "6.0.13"
|
|
22206
22244
|
});
|
|
22207
22245
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
22208
22246
|
return true;
|
package/index.dev.mjs
CHANGED
|
@@ -13807,9 +13807,20 @@ var Indexer = class {
|
|
|
13807
13807
|
this.add = (primaryKey, data) => {
|
|
13808
13808
|
this.primaryKeyToData.set(primaryKey, data);
|
|
13809
13809
|
};
|
|
13810
|
-
this.addNodePath = (nodePath, data) => {
|
|
13810
|
+
this.addNodePath = (nodePath, data, options) => {
|
|
13811
13811
|
this.nodePathsToData.set(nodePath, data);
|
|
13812
13812
|
this.add(nodePath[nodePath.length - 1], data);
|
|
13813
|
+
const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
|
|
13814
|
+
//@ts-ignore
|
|
13815
|
+
data[options.nodesKey]
|
|
13816
|
+
) : null;
|
|
13817
|
+
if (children && Array.isArray(children)) {
|
|
13818
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
13819
|
+
const child = children[i];
|
|
13820
|
+
const childPath = [...nodePath, options.toPrimaryKey(child)];
|
|
13821
|
+
this.addNodePath(childPath, child, options);
|
|
13822
|
+
}
|
|
13823
|
+
}
|
|
13813
13824
|
};
|
|
13814
13825
|
this.clear = () => {
|
|
13815
13826
|
this.primaryKeyToData.clear();
|
|
@@ -13843,7 +13854,7 @@ var Indexer = class {
|
|
|
13843
13854
|
if (info.type === "insert") {
|
|
13844
13855
|
const insertPK = toPrimaryKey(info.data);
|
|
13845
13856
|
if (isTree) {
|
|
13846
|
-
this.addNodePath([insertPK], info.data);
|
|
13857
|
+
this.addNodePath([insertPK], info.data, options);
|
|
13847
13858
|
} else {
|
|
13848
13859
|
this.add(insertPK, info.data);
|
|
13849
13860
|
}
|
|
@@ -13886,7 +13897,7 @@ var Indexer = class {
|
|
|
13886
13897
|
const insertPK = toPrimaryKey(info.data);
|
|
13887
13898
|
if (isTreeModeForNode) {
|
|
13888
13899
|
const currentPath = [...parentPath, insertPK];
|
|
13889
|
-
this.addNodePath(currentPath, info.data);
|
|
13900
|
+
this.addNodePath(currentPath, info.data, options);
|
|
13890
13901
|
} else {
|
|
13891
13902
|
this.add(insertPK, info.data);
|
|
13892
13903
|
}
|
|
@@ -13916,7 +13927,7 @@ var Indexer = class {
|
|
|
13916
13927
|
indexArray(children, parentPath);
|
|
13917
13928
|
parentPath.pop();
|
|
13918
13929
|
}
|
|
13919
|
-
this.addNodePath(nodePath, item);
|
|
13930
|
+
this.addNodePath(nodePath, item, options);
|
|
13920
13931
|
} else {
|
|
13921
13932
|
this.add(pk, item);
|
|
13922
13933
|
}
|
|
@@ -15275,7 +15286,16 @@ var DataSourceApiImpl = class {
|
|
|
15275
15286
|
};
|
|
15276
15287
|
this.getDataByNodePath = (nodePath) => {
|
|
15277
15288
|
const { indexer } = this.getState();
|
|
15278
|
-
|
|
15289
|
+
const data = indexer.getDataForNodePath(nodePath);
|
|
15290
|
+
if (!data) {
|
|
15291
|
+
console.warn(
|
|
15292
|
+
`getDataByNodePath: no data found for nodePath: "${nodePath.join(
|
|
15293
|
+
" / "
|
|
15294
|
+
)}"`
|
|
15295
|
+
);
|
|
15296
|
+
return null;
|
|
15297
|
+
}
|
|
15298
|
+
return data;
|
|
15279
15299
|
};
|
|
15280
15300
|
/**
|
|
15281
15301
|
* Replaces all data in the DataSource with the provided data.
|
|
@@ -15332,6 +15352,24 @@ var DataSourceApiImpl = class {
|
|
|
15332
15352
|
}
|
|
15333
15353
|
return result;
|
|
15334
15354
|
};
|
|
15355
|
+
this.updateChildrenByNodePath = (childrenOrFn, nodePath, options) => {
|
|
15356
|
+
const data = this.getDataByNodePath(nodePath);
|
|
15357
|
+
if (data == null) {
|
|
15358
|
+
return Promise.resolve(null);
|
|
15359
|
+
}
|
|
15360
|
+
const nodesKey = this.getState().nodesKey;
|
|
15361
|
+
const dataChildren = data[nodesKey];
|
|
15362
|
+
debugger;
|
|
15363
|
+
const children = typeof childrenOrFn === "function" ? childrenOrFn(dataChildren, data) : childrenOrFn;
|
|
15364
|
+
return this.updateDataByNodePath(
|
|
15365
|
+
{
|
|
15366
|
+
...data,
|
|
15367
|
+
[nodesKey]: children
|
|
15368
|
+
},
|
|
15369
|
+
nodePath,
|
|
15370
|
+
options
|
|
15371
|
+
);
|
|
15372
|
+
};
|
|
15335
15373
|
this.updateDataByNodePath = (data, nodePath, options) => {
|
|
15336
15374
|
return this.updateDataArrayByNodePath(
|
|
15337
15375
|
[
|
|
@@ -22160,7 +22198,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
22160
22198
|
}
|
|
22161
22199
|
let valid2 = isValidLicense(licenseKey, {
|
|
22162
22200
|
publishedAt: 1624970570587,
|
|
22163
|
-
version: "6.0.
|
|
22201
|
+
version: "6.0.13"
|
|
22164
22202
|
});
|
|
22165
22203
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
22166
22204
|
return true;
|
package/index.js
CHANGED
|
@@ -13858,9 +13858,20 @@ var Indexer = class {
|
|
|
13858
13858
|
this.add = (primaryKey, data) => {
|
|
13859
13859
|
this.primaryKeyToData.set(primaryKey, data);
|
|
13860
13860
|
};
|
|
13861
|
-
this.addNodePath = (nodePath, data) => {
|
|
13861
|
+
this.addNodePath = (nodePath, data, options) => {
|
|
13862
13862
|
this.nodePathsToData.set(nodePath, data);
|
|
13863
13863
|
this.add(nodePath[nodePath.length - 1], data);
|
|
13864
|
+
const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
|
|
13865
|
+
//@ts-ignore
|
|
13866
|
+
data[options.nodesKey]
|
|
13867
|
+
) : null;
|
|
13868
|
+
if (children && Array.isArray(children)) {
|
|
13869
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
13870
|
+
const child = children[i];
|
|
13871
|
+
const childPath = [...nodePath, options.toPrimaryKey(child)];
|
|
13872
|
+
this.addNodePath(childPath, child, options);
|
|
13873
|
+
}
|
|
13874
|
+
}
|
|
13864
13875
|
};
|
|
13865
13876
|
this.clear = () => {
|
|
13866
13877
|
this.primaryKeyToData.clear();
|
|
@@ -13894,7 +13905,7 @@ var Indexer = class {
|
|
|
13894
13905
|
if (info.type === "insert") {
|
|
13895
13906
|
const insertPK = toPrimaryKey(info.data);
|
|
13896
13907
|
if (isTree) {
|
|
13897
|
-
this.addNodePath([insertPK], info.data);
|
|
13908
|
+
this.addNodePath([insertPK], info.data, options);
|
|
13898
13909
|
} else {
|
|
13899
13910
|
this.add(insertPK, info.data);
|
|
13900
13911
|
}
|
|
@@ -13937,7 +13948,7 @@ var Indexer = class {
|
|
|
13937
13948
|
const insertPK = toPrimaryKey(info.data);
|
|
13938
13949
|
if (isTreeModeForNode) {
|
|
13939
13950
|
const currentPath = [...parentPath, insertPK];
|
|
13940
|
-
this.addNodePath(currentPath, info.data);
|
|
13951
|
+
this.addNodePath(currentPath, info.data, options);
|
|
13941
13952
|
} else {
|
|
13942
13953
|
this.add(insertPK, info.data);
|
|
13943
13954
|
}
|
|
@@ -13967,7 +13978,7 @@ var Indexer = class {
|
|
|
13967
13978
|
indexArray(children, parentPath);
|
|
13968
13979
|
parentPath.pop();
|
|
13969
13980
|
}
|
|
13970
|
-
this.addNodePath(nodePath, item);
|
|
13981
|
+
this.addNodePath(nodePath, item, options);
|
|
13971
13982
|
} else {
|
|
13972
13983
|
this.add(pk, item);
|
|
13973
13984
|
}
|
|
@@ -15326,7 +15337,16 @@ var DataSourceApiImpl = class {
|
|
|
15326
15337
|
};
|
|
15327
15338
|
this.getDataByNodePath = (nodePath) => {
|
|
15328
15339
|
const { indexer } = this.getState();
|
|
15329
|
-
|
|
15340
|
+
const data = indexer.getDataForNodePath(nodePath);
|
|
15341
|
+
if (!data) {
|
|
15342
|
+
console.warn(
|
|
15343
|
+
`getDataByNodePath: no data found for nodePath: "${nodePath.join(
|
|
15344
|
+
" / "
|
|
15345
|
+
)}"`
|
|
15346
|
+
);
|
|
15347
|
+
return null;
|
|
15348
|
+
}
|
|
15349
|
+
return data;
|
|
15330
15350
|
};
|
|
15331
15351
|
/**
|
|
15332
15352
|
* Replaces all data in the DataSource with the provided data.
|
|
@@ -15383,6 +15403,24 @@ var DataSourceApiImpl = class {
|
|
|
15383
15403
|
}
|
|
15384
15404
|
return result;
|
|
15385
15405
|
};
|
|
15406
|
+
this.updateChildrenByNodePath = (childrenOrFn, nodePath, options) => {
|
|
15407
|
+
const data = this.getDataByNodePath(nodePath);
|
|
15408
|
+
if (data == null) {
|
|
15409
|
+
return Promise.resolve(null);
|
|
15410
|
+
}
|
|
15411
|
+
const nodesKey = this.getState().nodesKey;
|
|
15412
|
+
const dataChildren = data[nodesKey];
|
|
15413
|
+
debugger;
|
|
15414
|
+
const children = typeof childrenOrFn === "function" ? childrenOrFn(dataChildren, data) : childrenOrFn;
|
|
15415
|
+
return this.updateDataByNodePath(
|
|
15416
|
+
{
|
|
15417
|
+
...data,
|
|
15418
|
+
[nodesKey]: children
|
|
15419
|
+
},
|
|
15420
|
+
nodePath,
|
|
15421
|
+
options
|
|
15422
|
+
);
|
|
15423
|
+
};
|
|
15386
15424
|
this.updateDataByNodePath = (data, nodePath, options) => {
|
|
15387
15425
|
return this.updateDataArrayByNodePath(
|
|
15388
15426
|
[
|
|
@@ -22202,7 +22240,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
22202
22240
|
}
|
|
22203
22241
|
let valid2 = isValidLicense(licenseKey, {
|
|
22204
22242
|
publishedAt: 1624970570587,
|
|
22205
|
-
version: "6.0.
|
|
22243
|
+
version: "6.0.13"
|
|
22206
22244
|
});
|
|
22207
22245
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
22208
22246
|
return true;
|
package/index.mjs
CHANGED
|
@@ -13807,9 +13807,20 @@ var Indexer = class {
|
|
|
13807
13807
|
this.add = (primaryKey, data) => {
|
|
13808
13808
|
this.primaryKeyToData.set(primaryKey, data);
|
|
13809
13809
|
};
|
|
13810
|
-
this.addNodePath = (nodePath, data) => {
|
|
13810
|
+
this.addNodePath = (nodePath, data, options) => {
|
|
13811
13811
|
this.nodePathsToData.set(nodePath, data);
|
|
13812
13812
|
this.add(nodePath[nodePath.length - 1], data);
|
|
13813
|
+
const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
|
|
13814
|
+
//@ts-ignore
|
|
13815
|
+
data[options.nodesKey]
|
|
13816
|
+
) : null;
|
|
13817
|
+
if (children && Array.isArray(children)) {
|
|
13818
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
13819
|
+
const child = children[i];
|
|
13820
|
+
const childPath = [...nodePath, options.toPrimaryKey(child)];
|
|
13821
|
+
this.addNodePath(childPath, child, options);
|
|
13822
|
+
}
|
|
13823
|
+
}
|
|
13813
13824
|
};
|
|
13814
13825
|
this.clear = () => {
|
|
13815
13826
|
this.primaryKeyToData.clear();
|
|
@@ -13843,7 +13854,7 @@ var Indexer = class {
|
|
|
13843
13854
|
if (info.type === "insert") {
|
|
13844
13855
|
const insertPK = toPrimaryKey(info.data);
|
|
13845
13856
|
if (isTree) {
|
|
13846
|
-
this.addNodePath([insertPK], info.data);
|
|
13857
|
+
this.addNodePath([insertPK], info.data, options);
|
|
13847
13858
|
} else {
|
|
13848
13859
|
this.add(insertPK, info.data);
|
|
13849
13860
|
}
|
|
@@ -13886,7 +13897,7 @@ var Indexer = class {
|
|
|
13886
13897
|
const insertPK = toPrimaryKey(info.data);
|
|
13887
13898
|
if (isTreeModeForNode) {
|
|
13888
13899
|
const currentPath = [...parentPath, insertPK];
|
|
13889
|
-
this.addNodePath(currentPath, info.data);
|
|
13900
|
+
this.addNodePath(currentPath, info.data, options);
|
|
13890
13901
|
} else {
|
|
13891
13902
|
this.add(insertPK, info.data);
|
|
13892
13903
|
}
|
|
@@ -13916,7 +13927,7 @@ var Indexer = class {
|
|
|
13916
13927
|
indexArray(children, parentPath);
|
|
13917
13928
|
parentPath.pop();
|
|
13918
13929
|
}
|
|
13919
|
-
this.addNodePath(nodePath, item);
|
|
13930
|
+
this.addNodePath(nodePath, item, options);
|
|
13920
13931
|
} else {
|
|
13921
13932
|
this.add(pk, item);
|
|
13922
13933
|
}
|
|
@@ -15275,7 +15286,16 @@ var DataSourceApiImpl = class {
|
|
|
15275
15286
|
};
|
|
15276
15287
|
this.getDataByNodePath = (nodePath) => {
|
|
15277
15288
|
const { indexer } = this.getState();
|
|
15278
|
-
|
|
15289
|
+
const data = indexer.getDataForNodePath(nodePath);
|
|
15290
|
+
if (!data) {
|
|
15291
|
+
console.warn(
|
|
15292
|
+
`getDataByNodePath: no data found for nodePath: "${nodePath.join(
|
|
15293
|
+
" / "
|
|
15294
|
+
)}"`
|
|
15295
|
+
);
|
|
15296
|
+
return null;
|
|
15297
|
+
}
|
|
15298
|
+
return data;
|
|
15279
15299
|
};
|
|
15280
15300
|
/**
|
|
15281
15301
|
* Replaces all data in the DataSource with the provided data.
|
|
@@ -15332,6 +15352,24 @@ var DataSourceApiImpl = class {
|
|
|
15332
15352
|
}
|
|
15333
15353
|
return result;
|
|
15334
15354
|
};
|
|
15355
|
+
this.updateChildrenByNodePath = (childrenOrFn, nodePath, options) => {
|
|
15356
|
+
const data = this.getDataByNodePath(nodePath);
|
|
15357
|
+
if (data == null) {
|
|
15358
|
+
return Promise.resolve(null);
|
|
15359
|
+
}
|
|
15360
|
+
const nodesKey = this.getState().nodesKey;
|
|
15361
|
+
const dataChildren = data[nodesKey];
|
|
15362
|
+
debugger;
|
|
15363
|
+
const children = typeof childrenOrFn === "function" ? childrenOrFn(dataChildren, data) : childrenOrFn;
|
|
15364
|
+
return this.updateDataByNodePath(
|
|
15365
|
+
{
|
|
15366
|
+
...data,
|
|
15367
|
+
[nodesKey]: children
|
|
15368
|
+
},
|
|
15369
|
+
nodePath,
|
|
15370
|
+
options
|
|
15371
|
+
);
|
|
15372
|
+
};
|
|
15335
15373
|
this.updateDataByNodePath = (data, nodePath, options) => {
|
|
15336
15374
|
return this.updateDataArrayByNodePath(
|
|
15337
15375
|
[
|
|
@@ -22160,7 +22198,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
22160
22198
|
}
|
|
22161
22199
|
let valid2 = isValidLicense(licenseKey, {
|
|
22162
22200
|
publishedAt: 1624970570587,
|
|
22163
|
-
version: "6.0.
|
|
22201
|
+
version: "6.0.13"
|
|
22164
22202
|
});
|
|
22165
22203
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
22166
22204
|
return true;
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/infinite-table/infinite-react/issues"
|
|
27
27
|
},
|
|
28
|
-
"version": "6.0.
|
|
28
|
+
"version": "6.0.13",
|
|
29
29
|
"main": "index.js",
|
|
30
30
|
"module": "index.mjs",
|
|
31
31
|
"typings": "index.d.ts",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
},
|
|
35
35
|
"license": "Commercial & Open Source",
|
|
36
36
|
"//": "will be updated at build time",
|
|
37
|
-
"publishedAt":
|
|
37
|
+
"publishedAt": 1731357157760
|
|
38
38
|
}
|