@awsui/collection-hooks
Advanced tools
Comparing version 1.0.46 to 1.0.47
@@ -74,2 +74,4 @@ import * as React from 'react'; | ||
ref: React.RefObject<CollectionRef>; | ||
totalItemsCount?: number; | ||
firstIndex?: number; | ||
}; | ||
@@ -76,0 +78,0 @@ filterProps: { |
@@ -37,4 +37,5 @@ "use strict"; | ||
allItems: allItems, | ||
allPageItems: allPageItems, | ||
})); | ||
} | ||
exports.useCollection = useCollection; |
@@ -30,7 +30,8 @@ import { Dispatch, Reducer } from 'react'; | ||
}): CollectionActions<T>; | ||
export declare function createSyncProps<T>(options: UseCollectionOptions<T>, { filteringText, sortingState, selectedItems, currentPageIndex, propertyFilteringQuery }: CollectionState<T>, actions: CollectionActions<T>, collectionRef: React.RefObject<CollectionRef>, { pagesCount, actualPageIndex, allItems, }: { | ||
export declare function createSyncProps<T>(options: UseCollectionOptions<T>, { filteringText, sortingState, selectedItems, currentPageIndex, propertyFilteringQuery }: CollectionState<T>, actions: CollectionActions<T>, collectionRef: React.RefObject<CollectionRef>, { pagesCount, actualPageIndex, allItems, allPageItems, }: { | ||
pagesCount?: number; | ||
actualPageIndex?: number; | ||
allItems: ReadonlyArray<T>; | ||
allPageItems: ReadonlyArray<T>; | ||
}): Pick<UseCollectionResult<T>, 'collectionProps' | 'filterProps' | 'paginationProps' | 'propertyFilterProps'>; | ||
export {}; |
@@ -67,5 +67,5 @@ "use strict"; | ||
function createSyncProps(options, _a, actions, collectionRef, _b) { | ||
var _c; | ||
var _c, _d; | ||
var filteringText = _a.filteringText, sortingState = _a.sortingState, selectedItems = _a.selectedItems, currentPageIndex = _a.currentPageIndex, propertyFilteringQuery = _a.propertyFilteringQuery; | ||
var pagesCount = _b.pagesCount, actualPageIndex = _b.actualPageIndex, allItems = _b.allItems; | ||
var pagesCount = _b.pagesCount, actualPageIndex = _b.actualPageIndex, allItems = _b.allItems, allPageItems = _b.allPageItems; | ||
var empty = options.filtering | ||
@@ -98,3 +98,3 @@ ? allItems.length | ||
return { | ||
collectionProps: __assign(__assign(__assign({ empty: empty }, (options.sorting | ||
collectionProps: __assign(__assign(__assign(__assign({ empty: empty }, (options.sorting | ||
? { | ||
@@ -117,3 +117,8 @@ onSortingChange: function (_a) { | ||
} | ||
: {})), { ref: collectionRef }), | ||
: {})), { ref: collectionRef }), (((_c = options.pagination) === null || _c === void 0 ? void 0 : _c.pageSize) | ||
? { | ||
totalItemsCount: allPageItems.length, | ||
firstIndex: ((actualPageIndex !== null && actualPageIndex !== void 0 ? actualPageIndex : currentPageIndex) - 1) * (options.pagination.pageSize + 1), | ||
} | ||
: {})), | ||
filterProps: { | ||
@@ -132,3 +137,3 @@ filteringText: filteringText, | ||
}, | ||
filteringProperties: ((_c = options.propertyFiltering) === null || _c === void 0 ? void 0 : _c.filteringProperties) || [], | ||
filteringProperties: ((_d = options.propertyFiltering) === null || _d === void 0 ? void 0 : _d.filteringProperties) || [], | ||
filteringOptions: filteringOptions, | ||
@@ -135,0 +140,0 @@ }, |
@@ -74,2 +74,4 @@ import * as React from 'react'; | ||
ref: React.RefObject<CollectionRef>; | ||
totalItemsCount?: number; | ||
firstIndex?: number; | ||
}; | ||
@@ -76,0 +78,0 @@ filterProps: { |
@@ -34,3 +34,4 @@ var __assign = (this && this.__assign) || function () { | ||
allItems: allItems, | ||
allPageItems: allPageItems, | ||
})); | ||
} |
@@ -30,7 +30,8 @@ import { Dispatch, Reducer } from 'react'; | ||
}): CollectionActions<T>; | ||
export declare function createSyncProps<T>(options: UseCollectionOptions<T>, { filteringText, sortingState, selectedItems, currentPageIndex, propertyFilteringQuery }: CollectionState<T>, actions: CollectionActions<T>, collectionRef: React.RefObject<CollectionRef>, { pagesCount, actualPageIndex, allItems, }: { | ||
export declare function createSyncProps<T>(options: UseCollectionOptions<T>, { filteringText, sortingState, selectedItems, currentPageIndex, propertyFilteringQuery }: CollectionState<T>, actions: CollectionActions<T>, collectionRef: React.RefObject<CollectionRef>, { pagesCount, actualPageIndex, allItems, allPageItems, }: { | ||
pagesCount?: number; | ||
actualPageIndex?: number; | ||
allItems: ReadonlyArray<T>; | ||
allPageItems: ReadonlyArray<T>; | ||
}): Pick<UseCollectionResult<T>, 'collectionProps' | 'filterProps' | 'paginationProps' | 'propertyFilterProps'>; | ||
export {}; |
@@ -62,5 +62,5 @@ var __assign = (this && this.__assign) || function () { | ||
export function createSyncProps(options, _a, actions, collectionRef, _b) { | ||
var _c; | ||
var _c, _d; | ||
var filteringText = _a.filteringText, sortingState = _a.sortingState, selectedItems = _a.selectedItems, currentPageIndex = _a.currentPageIndex, propertyFilteringQuery = _a.propertyFilteringQuery; | ||
var pagesCount = _b.pagesCount, actualPageIndex = _b.actualPageIndex, allItems = _b.allItems; | ||
var pagesCount = _b.pagesCount, actualPageIndex = _b.actualPageIndex, allItems = _b.allItems, allPageItems = _b.allPageItems; | ||
var empty = options.filtering | ||
@@ -93,3 +93,3 @@ ? allItems.length | ||
return { | ||
collectionProps: __assign(__assign(__assign({ empty: empty }, (options.sorting | ||
collectionProps: __assign(__assign(__assign(__assign({ empty: empty }, (options.sorting | ||
? { | ||
@@ -112,3 +112,8 @@ onSortingChange: function (_a) { | ||
} | ||
: {})), { ref: collectionRef }), | ||
: {})), { ref: collectionRef }), (((_c = options.pagination) === null || _c === void 0 ? void 0 : _c.pageSize) | ||
? { | ||
totalItemsCount: allPageItems.length, | ||
firstIndex: ((actualPageIndex !== null && actualPageIndex !== void 0 ? actualPageIndex : currentPageIndex) - 1) * (options.pagination.pageSize + 1), | ||
} | ||
: {})), | ||
filterProps: { | ||
@@ -127,3 +132,3 @@ filteringText: filteringText, | ||
}, | ||
filteringProperties: ((_c = options.propertyFiltering) === null || _c === void 0 ? void 0 : _c.filteringProperties) || [], | ||
filteringProperties: ((_d = options.propertyFiltering) === null || _d === void 0 ? void 0 : _d.filteringProperties) || [], | ||
filteringOptions: filteringOptions, | ||
@@ -130,0 +135,0 @@ }, |
{ | ||
"commit": "7422836cc6ca17e105bbf56c8dd2ea4efce5e272" | ||
"commit": "158b6adbd849a99b26c90b92faef5b1977edc6e1" | ||
} |
@@ -50,4 +50,4 @@ { | ||
"type": "module", | ||
"version": "1.0.46", | ||
"version": "1.0.47", | ||
"license": "Apache-2.0" | ||
} |
80852
1495