@elliemae/ds-pagination 2.2.0-alpha.3 → 2.2.0-next.2
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/cjs/Pagination.js +35 -49
- package/cjs/PaginationDataTestID.js +9 -37
- package/cjs/hooks/usePaginationSearch.js +20 -48
- package/cjs/index.d.js +2 -27
- package/cjs/index.js +10 -28
- package/cjs/parts/PageNextButton.js +32 -52
- package/cjs/parts/PagePrevButton.js +31 -51
- package/cjs/parts/PaginationContent.js +77 -91
- package/cjs/parts/Paginator.js +124 -112
- package/cjs/parts/PerPageSelector.js +63 -68
- package/cjs/props.js +34 -63
- package/cjs/styled.js +47 -112
- package/esm/Pagination.js +23 -17
- package/esm/PaginationDataTestID.js +5 -8
- package/esm/hooks/usePaginationSearch.js +13 -16
- package/esm/index.d.js +1 -2
- package/esm/index.js +1 -3
- package/esm/parts/PageNextButton.js +24 -23
- package/esm/parts/PagePrevButton.js +23 -22
- package/esm/parts/PaginationContent.js +68 -62
- package/esm/parts/Paginator.js +110 -76
- package/esm/parts/PerPageSelector.js +49 -32
- package/esm/props.js +29 -34
- package/esm/styled.js +33 -83
- package/package.json +7 -7
- package/cjs/Pagination.js.map +0 -7
- package/cjs/PaginationDataTestID.js.map +0 -7
- package/cjs/hooks/usePaginationSearch.js.map +0 -7
- package/cjs/index.d.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/parts/PageNextButton.js.map +0 -7
- package/cjs/parts/PagePrevButton.js.map +0 -7
- package/cjs/parts/PaginationContent.js.map +0 -7
- package/cjs/parts/Paginator.js.map +0 -7
- package/cjs/parts/PerPageSelector.js.map +0 -7
- package/cjs/props.js.map +0 -7
- package/cjs/styled.js.map +0 -7
- package/esm/Pagination.js.map +0 -7
- package/esm/PaginationDataTestID.js.map +0 -7
- package/esm/hooks/usePaginationSearch.js.map +0 -7
- package/esm/index.d.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/parts/PageNextButton.js.map +0 -7
- package/esm/parts/PagePrevButton.js.map +0 -7
- package/esm/parts/PaginationContent.js.map +0 -7
- package/esm/parts/Paginator.js.map +0 -7
- package/esm/parts/PerPageSelector.js.map +0 -7
- package/esm/props.js.map +0 -7
- package/esm/styled.js.map +0 -7
package/cjs/parts/Paginator.js
CHANGED
|
@@ -1,131 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const { width: btnWidth } = (0, import_ds_utilities.useOnElementResize)(btnRef);
|
|
46
|
-
const { width: txtWidth } = (0, import_ds_utilities.useOnElementResize)(pageInfoRef);
|
|
47
|
-
const options = (0, import_react.useMemo)(() => new Array(pageCount).fill(0).map((_, index) => {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
9
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
10
|
+
var Grid = require('@elliemae/ds-grid');
|
|
11
|
+
var dsDropdownmenu = require('@elliemae/ds-dropdownmenu');
|
|
12
|
+
var styled = require('../styled.js');
|
|
13
|
+
var usePaginationSearch = require('../hooks/usePaginationSearch.js');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
19
|
+
var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
|
|
20
|
+
|
|
21
|
+
var _div, _PaginationSeparator, _PaginationSeparator2, _PaginationSeparator3, _PaginationSeparator4;
|
|
22
|
+
|
|
23
|
+
const Paginator = props => {
|
|
24
|
+
var _span2;
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
pageIndex,
|
|
28
|
+
pageCount,
|
|
29
|
+
onPageChange,
|
|
30
|
+
pageDetails,
|
|
31
|
+
pageDetailsTitle
|
|
32
|
+
} = props;
|
|
33
|
+
const [isOpened, setIsOpened] = react.useState(false);
|
|
34
|
+
const btnRef = react.useRef(null);
|
|
35
|
+
const pageInfoRef = react.useRef(null);
|
|
36
|
+
const {
|
|
37
|
+
width: btnWidth
|
|
38
|
+
} = dsUtilities.useOnElementResize(btnRef);
|
|
39
|
+
const {
|
|
40
|
+
width: txtWidth
|
|
41
|
+
} = dsUtilities.useOnElementResize(pageInfoRef);
|
|
42
|
+
const options = react.useMemo(() => new Array(pageCount).fill(0).map((_, index) => {
|
|
43
|
+
var _span;
|
|
44
|
+
|
|
48
45
|
const option = {
|
|
49
46
|
dsId: (index + 1).toString(),
|
|
50
47
|
label: (index + 1).toString(),
|
|
51
48
|
value: index + 1,
|
|
52
|
-
type:
|
|
49
|
+
type: 'single'
|
|
53
50
|
};
|
|
51
|
+
|
|
54
52
|
if (pageDetails.length) {
|
|
55
|
-
option.render = () =>
|
|
56
|
-
cols: [
|
|
53
|
+
option.render = () => /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
|
|
54
|
+
cols: ['16px', "".concat(txtWidth + 16, "px"), 'auto'],
|
|
57
55
|
gutter: "xxs",
|
|
58
56
|
alignItems: "center"
|
|
59
|
-
}, pageIndex === index ?
|
|
57
|
+
}, void 0, pageIndex === index ? /*#__PURE__*/_jsx__default["default"](dsIcons.Checkmark, {
|
|
60
58
|
size: "s",
|
|
61
|
-
color: [
|
|
62
|
-
}) :
|
|
59
|
+
color: ['brand-primary', '600']
|
|
60
|
+
}) : _div || (_div = /*#__PURE__*/_jsx__default["default"]("div", {})), _span || (_span = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, index + 1)), /*#__PURE__*/_jsx__default["default"]("span", {
|
|
63
61
|
style: {
|
|
64
|
-
whiteSpace:
|
|
65
|
-
textOverflow:
|
|
66
|
-
overflow:
|
|
62
|
+
whiteSpace: 'nowrap',
|
|
63
|
+
textOverflow: 'ellipsis',
|
|
64
|
+
overflow: 'hidden'
|
|
67
65
|
}
|
|
68
|
-
}, pageDetails[index]));
|
|
66
|
+
}, void 0, pageDetails[index]));
|
|
69
67
|
}
|
|
68
|
+
|
|
70
69
|
return option;
|
|
71
70
|
}), [pageCount, pageDetails, pageIndex, txtWidth]);
|
|
72
|
-
const actionRef =
|
|
73
|
-
|
|
71
|
+
const actionRef = react.useRef({});
|
|
72
|
+
react.useEffect(() => {
|
|
74
73
|
if (isOpened) {
|
|
75
74
|
actionRef.current.setActiveDescendant((pageIndex + 1).toString());
|
|
76
75
|
actionRef.current.scrollOptionIntoView((pageIndex + 1).toString());
|
|
77
|
-
}
|
|
76
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
|
+
|
|
78
78
|
}, [isOpened]);
|
|
79
|
-
const onKeyDown =
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
79
|
+
const onKeyDown = usePaginationSearch.usePaginationSearch(pageCount, actionRef);
|
|
80
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
81
|
+
children: [_PaginationSeparator || (_PaginationSeparator = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {})), /*#__PURE__*/_jsx__default["default"](dsDropdownmenu.DSDropdownMenuV2, {
|
|
82
|
+
isOpened: isOpened,
|
|
83
|
+
options: options,
|
|
84
|
+
selectedOptions: {
|
|
85
|
+
[(pageIndex + 1).toString()]: true
|
|
86
|
+
},
|
|
87
|
+
onOptionClick: (_, clickedOption) => {
|
|
88
|
+
onPageChange(clickedOption.value);
|
|
89
|
+
setIsOpened(false);
|
|
90
|
+
btnRef.current.focus();
|
|
91
|
+
},
|
|
92
|
+
onClickOutside: () => {
|
|
93
|
+
setIsOpened(false);
|
|
94
|
+
btnRef.current.focus();
|
|
95
|
+
},
|
|
96
|
+
customOffset: [0, 2],
|
|
97
|
+
startPlacementPreference: "top-end",
|
|
98
|
+
actionRef: actionRef,
|
|
99
|
+
onKeyDown: onKeyDown,
|
|
100
|
+
minWidth: btnWidth + 23,
|
|
101
|
+
maxHeight: 300,
|
|
102
|
+
HeaderComp: () => pageDetailsTitle !== '' ? /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
|
|
103
|
+
cols: ["".concat(txtWidth + 50, "px"), '8px', 'auto']
|
|
104
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("span", {
|
|
105
|
+
style: {
|
|
106
|
+
marginLeft: '8px'
|
|
107
|
+
}
|
|
108
|
+
}, void 0, "Page"), _PaginationSeparator2 || (_PaginationSeparator2 = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {
|
|
109
|
+
height: "100%"
|
|
110
|
+
})), _span2 || (_span2 = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, pageDetailsTitle))) : 'Page'
|
|
111
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.PaginationDropdownButton, {
|
|
112
|
+
buttonType: "raw",
|
|
113
|
+
onClick: () => setIsOpened(true),
|
|
114
|
+
innerRef: btnRef
|
|
115
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
116
|
+
style: {
|
|
117
|
+
display: 'flex',
|
|
118
|
+
gridGap: '8px',
|
|
119
|
+
alignItems: 'center'
|
|
120
|
+
}
|
|
121
|
+
}, void 0, /*#__PURE__*/jsxRuntime.jsxs(Grid__default["default"], {
|
|
122
|
+
cols: ['auto', 'auto', 'auto'],
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
gutter: "xxxs",
|
|
125
|
+
ref: pageInfoRef,
|
|
126
|
+
children: [/*#__PURE__*/_jsx__default["default"](styled.PaginationBoldText, {
|
|
127
|
+
fontSize: "18px"
|
|
128
|
+
}, void 0, pageIndex + 1), " / ", pageCount]
|
|
129
|
+
}), pageDetails.length !== 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
130
|
+
children: [_PaginationSeparator3 || (_PaginationSeparator3 = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {
|
|
131
|
+
height: "12px",
|
|
132
|
+
ml: "8px"
|
|
133
|
+
})), /*#__PURE__*/_jsx__default["default"](styled.PaginationBoldText, {
|
|
134
|
+
fontSize: "13px",
|
|
135
|
+
mr: "8px"
|
|
136
|
+
}, void 0, pageDetails[pageIndex])]
|
|
137
|
+
}), /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronDown, {
|
|
138
|
+
color: ['brand-primary', '700']
|
|
139
|
+
})))), _PaginationSeparator4 || (_PaginationSeparator4 = /*#__PURE__*/_jsx__default["default"](styled.PaginationSeparator, {}))]
|
|
140
|
+
});
|
|
128
141
|
};
|
|
129
|
-
|
|
130
|
-
module.exports =
|
|
131
|
-
//# sourceMappingURL=Paginator.js.map
|
|
142
|
+
|
|
143
|
+
module.exports = Paginator;
|
|
@@ -1,77 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var PerPageSelector_exports = {};
|
|
29
|
-
__export(PerPageSelector_exports, {
|
|
30
|
-
default: () => PerPageSelector_default
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_memoize_one = __toESM(require("memoize-one"));
|
|
35
|
-
var import_ds_utilities = __toESM(require("@elliemae/ds-utilities"));
|
|
36
|
-
var import_ds_dropdownmenu = __toESM(require("@elliemae/ds-dropdownmenu"));
|
|
37
|
-
var import_ds_icons = __toESM(require("@elliemae/ds-icons"));
|
|
38
|
-
var import_styled = __toESM(require("../styled"));
|
|
39
|
-
const generateOption = (value) => {
|
|
40
|
-
if (typeof value === "object") {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var memoize = require('memoize-one');
|
|
9
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
10
|
+
var dsDropdownmenu = require('@elliemae/ds-dropdownmenu');
|
|
11
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
12
|
+
var styled = require('../styled.js');
|
|
13
|
+
|
|
14
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
|
+
var memoize__default = /*#__PURE__*/_interopDefaultLegacy(memoize);
|
|
18
|
+
|
|
19
|
+
const generateOption = value => {
|
|
20
|
+
if (typeof value === 'object') {
|
|
41
21
|
return value;
|
|
42
22
|
}
|
|
23
|
+
|
|
43
24
|
return {
|
|
44
25
|
dsId: value.toString(),
|
|
45
26
|
value,
|
|
46
27
|
label: value.toString(),
|
|
47
|
-
type:
|
|
28
|
+
type: 'single'
|
|
48
29
|
};
|
|
49
30
|
};
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
|
|
32
|
+
const getOptions = memoize__default["default"]((step, min, max) => {
|
|
33
|
+
const options = dsUtilities.range(min, max + step, step).map(generateOption);
|
|
52
34
|
return min === 0 ? options.slice(1, options.length) : options;
|
|
53
35
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
|
|
37
|
+
const PerPageSelector = props => {
|
|
38
|
+
const [isOpened, setIsOpened] = react.useState(false);
|
|
39
|
+
const {
|
|
40
|
+
pageSize,
|
|
41
|
+
onPageSizeChange,
|
|
42
|
+
perPageOptions,
|
|
43
|
+
maxPerPage,
|
|
44
|
+
perPageStep,
|
|
45
|
+
minPerPage
|
|
46
|
+
} = props;
|
|
47
|
+
const options = react.useMemo(() => {
|
|
48
|
+
if (perPageOptions) return perPageOptions.map(generateOption);
|
|
60
49
|
return getOptions(perPageStep, minPerPage, maxPerPage);
|
|
61
50
|
}, [maxPerPage, minPerPage, perPageOptions, perPageStep]);
|
|
62
|
-
const actionRef =
|
|
63
|
-
const btnRef =
|
|
64
|
-
|
|
51
|
+
const actionRef = react.useRef({});
|
|
52
|
+
const btnRef = react.useRef(null);
|
|
53
|
+
react.useEffect(() => {
|
|
65
54
|
if (isOpened) {
|
|
66
55
|
actionRef.current.setActiveDescendant(pageSize.toString());
|
|
67
56
|
actionRef.current.scrollOptionIntoView(pageSize.toString());
|
|
68
|
-
}
|
|
57
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
|
|
69
59
|
}, [isOpened]);
|
|
70
|
-
const {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
const {
|
|
61
|
+
width
|
|
62
|
+
} = dsUtilities.useOnElementResize(btnRef);
|
|
63
|
+
return /*#__PURE__*/_jsx__default["default"](dsDropdownmenu.DSDropdownMenuV2, {
|
|
64
|
+
isOpened: isOpened,
|
|
65
|
+
options: options,
|
|
66
|
+
selectedOptions: {
|
|
67
|
+
[pageSize.toString()]: true
|
|
68
|
+
},
|
|
75
69
|
onOptionClick: (_, clickedOption) => {
|
|
76
70
|
onPageSizeChange(clickedOption.value);
|
|
77
71
|
setIsOpened(false);
|
|
@@ -83,21 +77,22 @@ const PerPageSelector = (props) => {
|
|
|
83
77
|
},
|
|
84
78
|
customOffset: [0, 2],
|
|
85
79
|
startPlacementPreference: "top-end",
|
|
86
|
-
actionRef,
|
|
80
|
+
actionRef: actionRef,
|
|
87
81
|
minWidth: width + 25,
|
|
88
82
|
maxHeight: 300,
|
|
89
|
-
HeaderComp: () =>
|
|
90
|
-
},
|
|
91
|
-
style: {
|
|
92
|
-
|
|
83
|
+
HeaderComp: () => 'Per Page'
|
|
84
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
85
|
+
style: {
|
|
86
|
+
marginLeft: '32px'
|
|
87
|
+
}
|
|
88
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.PaginationDropdownButton, {
|
|
93
89
|
buttonType: "raw",
|
|
94
90
|
onClick: () => setIsOpened(true),
|
|
95
91
|
"aria-pressed": isOpened,
|
|
96
92
|
innerRef: btnRef
|
|
97
|
-
}, pageSize, " / page",
|
|
98
|
-
color: [
|
|
93
|
+
}, void 0, pageSize, " / page", /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronDown, {
|
|
94
|
+
color: ['brand-primary', '700']
|
|
99
95
|
}))));
|
|
100
96
|
};
|
|
101
|
-
|
|
102
|
-
module.exports =
|
|
103
|
-
//# sourceMappingURL=PerPageSelector.js.map
|
|
97
|
+
|
|
98
|
+
module.exports = PerPageSelector;
|
package/cjs/props.js
CHANGED
|
@@ -1,64 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var props_exports = {};
|
|
29
|
-
__export(props_exports, {
|
|
30
|
-
defaultProps: () => defaultProps,
|
|
31
|
-
propTypes: () => propTypes
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_react_desc = __toESM(require("react-desc"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var reactDesc = require('react-desc');
|
|
6
|
+
|
|
35
7
|
const emptyFunc = () => null;
|
|
8
|
+
|
|
36
9
|
const propTypes = {
|
|
37
|
-
pageCount:
|
|
38
|
-
pageIndex:
|
|
39
|
-
canPreviousPage:
|
|
40
|
-
canNextPage:
|
|
41
|
-
pageSize:
|
|
42
|
-
showPerPageSelector:
|
|
43
|
-
perPageOptions:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
pageDetails: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.string).description("Details to provide for each page").defaultValue([]),
|
|
60
|
-
pageDetailsTitle: import_react_desc.PropTypes.string.description("The title of the details (usually a column of your dataset)").defaultValue(""),
|
|
61
|
-
width: import_react_desc.PropTypes.any.description("Width for the container of the pagination").defaultValue("100%")
|
|
10
|
+
pageCount: reactDesc.PropTypes.number.description('How many pages are there'),
|
|
11
|
+
pageIndex: reactDesc.PropTypes.number.description('Index of the current page, starting from 1').defaultValue(1),
|
|
12
|
+
canPreviousPage: reactDesc.PropTypes.bool.description('Whether the previous button is disabled or not').defaultValue(true),
|
|
13
|
+
canNextPage: reactDesc.PropTypes.bool.description('Whether the next button is disabled or not').defaultValue(true),
|
|
14
|
+
pageSize: reactDesc.PropTypes.number.description('The current page size').defaultValue(10),
|
|
15
|
+
showPerPageSelector: reactDesc.PropTypes.bool.description('Whether to show the page selector').defaultValue(true),
|
|
16
|
+
perPageOptions: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.shape({
|
|
17
|
+
dsId: reactDesc.PropTypes.string,
|
|
18
|
+
value: reactDesc.PropTypes.number,
|
|
19
|
+
label: reactDesc.PropTypes.string,
|
|
20
|
+
type: reactDesc.PropTypes.oneOf(['single'])
|
|
21
|
+
})])).description('The available options for page size').defaultValue([10]),
|
|
22
|
+
perPageStep: reactDesc.PropTypes.number.description('Step for the per page options').defaultValue(5),
|
|
23
|
+
minPerPage: reactDesc.PropTypes.number.description('Step for the per page options').defaultValue(0),
|
|
24
|
+
maxPerPage: reactDesc.PropTypes.number.description('Step for the per page options').defaultValue(100),
|
|
25
|
+
onPageSizeChange: reactDesc.PropTypes.func.description('Function invoked when the page size changes').defaultValue(() => null),
|
|
26
|
+
onPreviousPage: reactDesc.PropTypes.func.description('Function invoked when the previous button is pressed').defaultValue(() => null),
|
|
27
|
+
onPageChange: reactDesc.PropTypes.func.description('Function invoked when the page changes').defaultValue(() => null),
|
|
28
|
+
onNextPage: reactDesc.PropTypes.func.description('Function invoked when next button is pressed').defaultValue(() => null),
|
|
29
|
+
pageDetails: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.string).description('Details to provide for each page').defaultValue([]),
|
|
30
|
+
pageDetailsTitle: reactDesc.PropTypes.string.description('The title of the details (usually a column of your dataset)').defaultValue(''),
|
|
31
|
+
width: reactDesc.PropTypes.any.description('Width for the container of the pagination').defaultValue('100%')
|
|
62
32
|
};
|
|
63
33
|
const defaultProps = {
|
|
64
34
|
pageIndex: 1,
|
|
@@ -75,8 +45,9 @@ const defaultProps = {
|
|
|
75
45
|
onNextPage: emptyFunc,
|
|
76
46
|
onPageChange: emptyFunc,
|
|
77
47
|
pageDetails: [],
|
|
78
|
-
pageDetailsTitle:
|
|
79
|
-
width:
|
|
48
|
+
pageDetailsTitle: '',
|
|
49
|
+
width: '100%'
|
|
80
50
|
};
|
|
81
|
-
|
|
82
|
-
|
|
51
|
+
|
|
52
|
+
exports.defaultProps = defaultProps;
|
|
53
|
+
exports.propTypes = propTypes;
|