@react-pakistan/util-functions 1.22.28 → 1.22.31

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.
@@ -0,0 +1,2 @@
1
+ import { PageLimit } from '../constants';
2
+ export declare const dynamicPageLimit: (totalRecordCount: number) => PageLimit;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dynamicPageLimit = void 0;
4
+ const constants_1 = require("../constants");
5
+ const dynamicPageLimit = (totalRecordCount) => {
6
+ let adjustedPageLimit = Object.assign({}, constants_1.PAGE_LIMIT);
7
+ if (totalRecordCount <= 5) {
8
+ adjustedPageLimit = {
9
+ 5: 5,
10
+ };
11
+ }
12
+ else if (totalRecordCount <= 10) {
13
+ adjustedPageLimit = {
14
+ 5: 5,
15
+ 10: 10,
16
+ };
17
+ }
18
+ else if (totalRecordCount <= 15) {
19
+ adjustedPageLimit = {
20
+ 5: 5,
21
+ 10: 10,
22
+ 15: 15,
23
+ };
24
+ }
25
+ else if (totalRecordCount <= 25) {
26
+ adjustedPageLimit = {
27
+ 5: 5,
28
+ 10: 10,
29
+ 15: 15,
30
+ 25: 25,
31
+ };
32
+ }
33
+ else if (totalRecordCount <= 50) {
34
+ adjustedPageLimit = {
35
+ 5: 5,
36
+ 10: 10,
37
+ 15: 15,
38
+ 25: 25,
39
+ 50: 50,
40
+ };
41
+ }
42
+ else if (totalRecordCount > 150) {
43
+ adjustedPageLimit = Object.assign(Object.assign({}, constants_1.PAGE_LIMIT), { 150: 150 });
44
+ }
45
+ return adjustedPageLimit;
46
+ };
47
+ exports.dynamicPageLimit = dynamicPageLimit;
@@ -4,6 +4,7 @@ export * from './camel-to-sentense-case';
4
4
  export * from './check-even-odd-length';
5
5
  export * from './countries';
6
6
  export * from './currencies';
7
+ export * from './dynamic-page-limit';
7
8
  export * from './format-date';
8
9
  export * from './generate-blog-schema';
9
10
  export * from './generate-breadcrumb-schema';
@@ -15,7 +16,9 @@ export * from './get-full-name';
15
16
  export * from './get-href';
16
17
  export * from './get-month-name';
17
18
  export * from './get-pathname';
19
+ export * from './is-next-button-disabled';
18
20
  export * from './is-odd';
21
+ export * from './is-previous-button-disabled';
19
22
  export * from './linear-gradients';
20
23
  export * from './repeat-times';
21
24
  export * from './resolve-anchor-link';
package/general/index.js CHANGED
@@ -21,6 +21,7 @@ __exportStar(require("./camel-to-sentense-case"), exports);
21
21
  __exportStar(require("./check-even-odd-length"), exports);
22
22
  __exportStar(require("./countries"), exports);
23
23
  __exportStar(require("./currencies"), exports);
24
+ __exportStar(require("./dynamic-page-limit"), exports);
24
25
  __exportStar(require("./format-date"), exports);
25
26
  __exportStar(require("./generate-blog-schema"), exports);
26
27
  __exportStar(require("./generate-breadcrumb-schema"), exports);
@@ -32,7 +33,9 @@ __exportStar(require("./get-full-name"), exports);
32
33
  __exportStar(require("./get-href"), exports);
33
34
  __exportStar(require("./get-month-name"), exports);
34
35
  __exportStar(require("./get-pathname"), exports);
36
+ __exportStar(require("./is-next-button-disabled"), exports);
35
37
  __exportStar(require("./is-odd"), exports);
38
+ __exportStar(require("./is-previous-button-disabled"), exports);
36
39
  __exportStar(require("./linear-gradients"), exports);
37
40
  __exportStar(require("./repeat-times"), exports);
38
41
  __exportStar(require("./resolve-anchor-link"), exports);
@@ -0,0 +1 @@
1
+ export declare const isNextButtonDisabled: (currentPage: number, totalPages: number) => boolean;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNextButtonDisabled = void 0;
4
+ const isNextButtonDisabled = (currentPage, totalPages) => currentPage >= totalPages;
5
+ exports.isNextButtonDisabled = isNextButtonDisabled;
@@ -0,0 +1 @@
1
+ export declare const isPreviousButtonDisabled: (currentPage: number) => boolean;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPreviousButtonDisabled = void 0;
4
+ const isPreviousButtonDisabled = (currentPage) => currentPage <= 1;
5
+ exports.isPreviousButtonDisabled = isPreviousButtonDisabled;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.22.28",
3
+ "version": "1.22.31",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {