@cashub/hooks-elv 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/usePagination.js +3 -0
- package/useToggleOptions.js +8 -2
package/package.json
CHANGED
package/usePagination.js
CHANGED
|
@@ -58,6 +58,9 @@ const usePagination = _ref => {
|
|
|
58
58
|
const middleRange = range(leftSiblingIndex, rightSiblingIndex);
|
|
59
59
|
return [firstPageIndex, DOTS, ...middleRange, DOTS, lastPageIndex];
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
// neither side needs dots (only reachable when siblingCount > 1): show every page
|
|
63
|
+
return range(1, totalPageCount);
|
|
61
64
|
}, [totalCount, pageSize, siblingCount, currentPage]);
|
|
62
65
|
return paginationRange;
|
|
63
66
|
};
|
package/useToggleOptions.js
CHANGED
|
@@ -8,8 +8,14 @@ var _react = require("react");
|
|
|
8
8
|
const useToggleOptions = defaultOptions => {
|
|
9
9
|
const [options, setOptions] = (0, _react.useState)(defaultOptions);
|
|
10
10
|
const handleToggleOptions = index => {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
setOptions(previous => {
|
|
12
|
+
return previous.map((option, optionIndex) => {
|
|
13
|
+
return optionIndex === index ? {
|
|
14
|
+
...option,
|
|
15
|
+
checked: option.checked === 1 ? 0 : 1
|
|
16
|
+
} : option;
|
|
17
|
+
});
|
|
18
|
+
});
|
|
13
19
|
};
|
|
14
20
|
const resetOptions = (0, _react.useCallback)(options => {
|
|
15
21
|
if (options) {
|