@workday/canvas-kit-react 7.2.10 → 7.2.11
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/dist/commonjs/pagination/lib/Pagination/usePaginationModel.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/usePaginationModel.js +5 -1
- package/dist/es6/pagination/lib/Pagination/usePaginationModel.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/usePaginationModel.js +5 -1
- package/package.json +3 -3
- package/pagination/lib/Pagination/usePaginationModel.ts +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaginationModel.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/usePaginationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAExC,oBAAY,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,0EAM5B,wBAAwB,KAAG,
|
|
1
|
+
{"version":3,"file":"usePaginationModel.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/usePaginationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAExC,oBAAY,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,0EAM5B,wBAAwB,KAAG,eAmE7B,CAAC"}
|
|
@@ -27,7 +27,11 @@ var usePaginationModel = function (_a) {
|
|
|
27
27
|
var _b = _a.firstPage, firstPage = _b === void 0 ? 1 : _b, _c = _a.initialCurrentPage, initialCurrentPage = _c === void 0 ? 1 : _c, lastPage = _a.lastPage, _d = _a.rangeSize, rangeSize = _d === void 0 ? 5 : _d, onPageChange = _a.onPageChange;
|
|
28
28
|
var _e = React.useState(initialCurrentPage), currentPage = _e[0], setCurrentPage = _e[1];
|
|
29
29
|
var changePage = function (page) {
|
|
30
|
-
|
|
30
|
+
// Don't fire an `onPageChange` event if the page number is the same as the current page.
|
|
31
|
+
// `setCurrentPage` doesn't need this check, because React won't update the state if the values are the same.
|
|
32
|
+
if (currentPage !== page) {
|
|
33
|
+
onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(page);
|
|
34
|
+
}
|
|
31
35
|
setCurrentPage(page);
|
|
32
36
|
};
|
|
33
37
|
var first = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaginationModel.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/usePaginationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAExC,oBAAY,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,0EAM5B,wBAAwB,KAAG,
|
|
1
|
+
{"version":3,"file":"usePaginationModel.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/usePaginationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAExC,oBAAY,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,0EAM5B,wBAAwB,KAAG,eAmE7B,CAAC"}
|
|
@@ -5,7 +5,11 @@ export var usePaginationModel = function (_a) {
|
|
|
5
5
|
var _b = _a.firstPage, firstPage = _b === void 0 ? 1 : _b, _c = _a.initialCurrentPage, initialCurrentPage = _c === void 0 ? 1 : _c, lastPage = _a.lastPage, _d = _a.rangeSize, rangeSize = _d === void 0 ? 5 : _d, onPageChange = _a.onPageChange;
|
|
6
6
|
var _e = React.useState(initialCurrentPage), currentPage = _e[0], setCurrentPage = _e[1];
|
|
7
7
|
var changePage = function (page) {
|
|
8
|
-
|
|
8
|
+
// Don't fire an `onPageChange` event if the page number is the same as the current page.
|
|
9
|
+
// `setCurrentPage` doesn't need this check, because React won't update the state if the values are the same.
|
|
10
|
+
if (currentPage !== page) {
|
|
11
|
+
onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(page);
|
|
12
|
+
}
|
|
9
13
|
setCurrentPage(page);
|
|
10
14
|
};
|
|
11
15
|
var first = function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.11",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@emotion/styled": "^11.6.0",
|
|
50
50
|
"@popperjs/core": "^2.5.4",
|
|
51
51
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
52
|
-
"@workday/canvas-kit-popup-stack": "^7.2.
|
|
52
|
+
"@workday/canvas-kit-popup-stack": "^7.2.11",
|
|
53
53
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
54
54
|
"@workday/design-assets-types": "^0.2.8",
|
|
55
55
|
"chroma-js": "^2.1.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
69
69
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "359ab1ae25e3397a5293f11d40b3abf517919db4"
|
|
72
72
|
}
|
|
@@ -41,8 +41,11 @@ export const usePaginationModel = ({
|
|
|
41
41
|
const [currentPage, setCurrentPage] = React.useState(initialCurrentPage);
|
|
42
42
|
|
|
43
43
|
const changePage = (page: number) => {
|
|
44
|
-
onPageChange
|
|
45
|
-
|
|
44
|
+
// Don't fire an `onPageChange` event if the page number is the same as the current page.
|
|
45
|
+
// `setCurrentPage` doesn't need this check, because React won't update the state if the values are the same.
|
|
46
|
+
if (currentPage !== page) {
|
|
47
|
+
onPageChange?.(page);
|
|
48
|
+
}
|
|
46
49
|
setCurrentPage(page);
|
|
47
50
|
};
|
|
48
51
|
|