etendo-ui-library 1.2.38 → 1.2.39
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-native/components/pagination/Pagination.d.ts +1 -1
- package/dist-native/components/pagination/Pagination.js +1 -1
- package/dist-native/components/pagination/Pagination.styles.d.ts +2 -2
- package/dist-native/components/pagination/Pagination.styles.js +1 -1
- package/dist-native/components/pagination/Pagination.types.d.ts +12 -10
- package/dist-web/components/pagination/Pagination.d.ts +1 -1
- package/dist-web/components/pagination/Pagination.js +22 -28
- package/dist-web/components/pagination/Pagination.styles.d.ts +2 -2
- package/dist-web/components/pagination/Pagination.styles.js +1 -6
- package/dist-web/components/pagination/Pagination.types.d.ts +12 -10
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PaginationProps } from './Pagination.types';
|
|
3
|
-
declare const Pagination: ({ currentPage, onChangeSelected, totalData, amountDataPerPage,
|
|
3
|
+
declare const Pagination: ({ currentPage, onChangeSelected, totalData, amountDataPerPage, }: PaginationProps) => React.JSX.Element;
|
|
4
4
|
export default Pagination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _Pagination=require("./Pagination.styles");var _ArrowLeftIcon=require("../../assets/images/icons/ArrowLeftIcon");var _ArrowFirstIcon=require("../../assets/images/icons/ArrowFirstIcon");var _ArrowRightIcon=require("../../assets/images/icons/ArrowRightIcon");var _ArrowLastIcon=require("../../assets/images/icons/ArrowLastIcon");var _this=this,_jsxFileName="/home/jenkins/workspace/etendo_ui_library_develop/src/components/pagination/Pagination.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var Pagination=function Pagination(_ref){var currentPage=_ref.currentPage,onChangeSelected=_ref.onChangeSelected,totalData=_ref.totalData,amountDataPerPage=_ref.amountDataPerPage
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _Pagination=require("./Pagination.styles");var _ArrowLeftIcon=require("../../assets/images/icons/ArrowLeftIcon");var _ArrowFirstIcon=require("../../assets/images/icons/ArrowFirstIcon");var _ArrowRightIcon=require("../../assets/images/icons/ArrowRightIcon");var _ArrowLastIcon=require("../../assets/images/icons/ArrowLastIcon");var _this=this,_jsxFileName="/home/jenkins/workspace/etendo_ui_library_develop/src/components/pagination/Pagination.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var Pagination=function Pagination(_ref){var currentPage=_ref.currentPage,onChangeSelected=_ref.onChangeSelected,totalData=_ref.totalData,amountDataPerPage=_ref.amountDataPerPage;var _useState=(0,_react.useState)(currentPage),_useState2=(0,_slicedToArray2.default)(_useState,2),page=_useState2[0],setPage=_useState2[1];var pageNumbers=[];for(var i=1;i<=Math.ceil(totalData/amountDataPerPage);i++){pageNumbers.push(i);}var backToFirstPage=function backToFirstPage(){setPage(1);};var backPage=function backPage(){if(page>1){setPage(page-1);}};var nextPage=function nextPage(){if(page<Math.ceil(totalData/amountDataPerPage)){setPage(page+1);}};var nextLastPage=function nextLastPage(pageNumbers){setPage(pageNumbers.length);};(0,_react.useEffect)(function(){onChangeSelected(page,(page-1)*amountDataPerPage);},[page,amountDataPerPage,onChangeSelected]);return _react.default.createElement(_reactNative.View,{style:_Pagination.paginationStyleVariant.primary.container,__self:_this,__source:{fileName:_jsxFileName,lineNumber:54,columnNumber:5}},_react.default.createElement(_reactNative.View,{style:_Pagination.paginationStyleVariant.primary.container,__self:_this,__source:{fileName:_jsxFileName,lineNumber:55,columnNumber:7}},_react.default.createElement(_reactNative.TouchableOpacity,{disabled:page<=1||totalData===0,onPress:backToFirstPage,__self:_this,__source:{fileName:_jsxFileName,lineNumber:56,columnNumber:9}},_react.default.createElement(_ArrowFirstIcon.ArrowFirstIcon,{style:{height:10,width:10,marginRight:10},__self:_this,__source:{fileName:_jsxFileName,lineNumber:60,columnNumber:11}})),_react.default.createElement(_reactNative.TouchableOpacity,{disabled:page<=1||totalData===0,onPress:backPage,__self:_this,__source:{fileName:_jsxFileName,lineNumber:69,columnNumber:9}},_react.default.createElement(_ArrowLeftIcon.ArrowLeftIcon,{style:{height:10,width:10,marginRight:10},__self:_this,__source:{fileName:_jsxFileName,lineNumber:73,columnNumber:11}})),_react.default.createElement(_reactNative.View,{style:_Pagination.paginationStyleVariant.primary.pageNumberContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:83,columnNumber:9}},_react.default.createElement(_reactNative.Text,{style:_Pagination.paginationStyleVariant.primary.pageNumberText,__self:_this,__source:{fileName:_jsxFileName,lineNumber:84,columnNumber:11}},page)),_react.default.createElement(_reactNative.TouchableOpacity,{disabled:page===pageNumbers.length||totalData===0,onPress:function onPress(){nextPage();},__self:_this,__source:{fileName:_jsxFileName,lineNumber:89,columnNumber:9}},_react.default.createElement(_ArrowRightIcon.ArrowRightIcon,{style:{height:10,width:10,marginRight:10},__self:_this,__source:{fileName:_jsxFileName,lineNumber:95,columnNumber:11}})),_react.default.createElement(_reactNative.TouchableOpacity,{disabled:page===pageNumbers.length||totalData===0,onPress:function onPress(){nextLastPage(pageNumbers);if(page!==Math.ceil(totalData/8)){onChangeSelected(Math.ceil(totalData/amountDataPerPage),totalData-totalData%amountDataPerPage-8);}},__self:_this,__source:{fileName:_jsxFileName,lineNumber:104,columnNumber:9}},_react.default.createElement(_ArrowLastIcon.ArrowLastIcon,{style:{height:10,width:10,marginRight:10},__self:_this,__source:{fileName:_jsxFileName,lineNumber:116,columnNumber:11}}))));};var _default=exports.default=Pagination;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
1
|
+
import { PaginationStyleVariant } from './Pagination.types';
|
|
2
|
+
export declare const paginationStyleVariant: PaginationStyleVariant;
|
|
3
3
|
export declare const styles: {
|
|
4
4
|
storiesContainer: {
|
|
5
5
|
height: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.styles=exports.
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.styles=exports.paginationStyleVariant=void 0;var _colors=require("../../styles/colors");var _reactNative=require("react-native");var paginationStyleVariant=exports.paginationStyleVariant={primary:{container:{flex:1,width:120,height:22,flexDirection:'row',alignItems:'center'},icon:{width:22,height:22,marginRight:17},pageNumberContainer:{backgroundColor:_colors.QUATERNARY_50,width:25,height:25,borderRadius:3,justifyContent:'center',alignSelf:'center',marginRight:12},pageNumberText:{fontWeight:'500',fontSize:12,alignSelf:'center'}}};var styles=exports.styles=_reactNative.StyleSheet.create({storiesContainer:{height:50}});
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
-
export type Info = {
|
|
3
|
-
name: string;
|
|
4
|
-
route: string;
|
|
5
|
-
key: string;
|
|
6
|
-
};
|
|
7
2
|
export interface PaginationProps {
|
|
8
3
|
currentPage: number;
|
|
9
|
-
onChangeSelected: (
|
|
4
|
+
onChangeSelected: (currentPage: number, offset: number) => void;
|
|
10
5
|
totalData: number;
|
|
11
6
|
amountDataPerPage: number;
|
|
12
|
-
pagination: number;
|
|
13
|
-
isWeb?: boolean;
|
|
14
7
|
}
|
|
15
|
-
export type
|
|
16
|
-
export
|
|
8
|
+
export type PaginationStyleType = 'primary';
|
|
9
|
+
export interface PaginationStyles {
|
|
10
|
+
container: ViewStyle;
|
|
11
|
+
icon?: ImageStyle;
|
|
12
|
+
pageNumberContainer: ViewStyle;
|
|
13
|
+
pageNumberText: TextStyle;
|
|
14
|
+
}
|
|
15
|
+
export type PaginationStyleVariant = {
|
|
16
|
+
primary: PaginationStyles;
|
|
17
|
+
};
|
|
18
|
+
export type PaginationStyleRecord = Record<PaginationStyleType, {
|
|
17
19
|
container: ViewStyle;
|
|
18
20
|
icon?: ImageStyle;
|
|
19
21
|
pageNumberContainer: ViewStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PaginationProps } from './Pagination.types';
|
|
3
|
-
declare const Pagination: ({ currentPage, onChangeSelected, totalData, amountDataPerPage,
|
|
3
|
+
declare const Pagination: ({ currentPage, onChangeSelected, totalData, amountDataPerPage, }: PaginationProps) => React.JSX.Element;
|
|
4
4
|
export default Pagination;
|
|
@@ -5,9 +5,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
/* Imports */
|
|
8
|
-
import React, { useState } from 'react';
|
|
8
|
+
import React, { useEffect, useState } from 'react';
|
|
9
9
|
import { View, TouchableOpacity, Text } from "react-native-web";
|
|
10
|
-
import {
|
|
10
|
+
import { paginationStyleVariant } from "./Pagination.styles";
|
|
11
11
|
import { ArrowLeftIcon } from "../../assets/images/icons/ArrowLeftIcon";
|
|
12
12
|
import { ArrowFirstIcon } from "../../assets/images/icons/ArrowFirstIcon";
|
|
13
13
|
import { ArrowRightIcon } from "../../assets/images/icons/ArrowRightIcon";
|
|
@@ -18,8 +18,7 @@ var Pagination = function Pagination(_ref) {
|
|
|
18
18
|
var currentPage = _ref.currentPage,
|
|
19
19
|
onChangeSelected = _ref.onChangeSelected,
|
|
20
20
|
totalData = _ref.totalData,
|
|
21
|
-
amountDataPerPage = _ref.amountDataPerPage
|
|
22
|
-
pagination = _ref.pagination;
|
|
21
|
+
amountDataPerPage = _ref.amountDataPerPage;
|
|
23
22
|
// Will serve to set the page number where the user is
|
|
24
23
|
var _useState = useState(currentPage),
|
|
25
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -37,40 +36,38 @@ var Pagination = function Pagination(_ref) {
|
|
|
37
36
|
var backToFirstPage = function backToFirstPage() {
|
|
38
37
|
setPage(1);
|
|
39
38
|
};
|
|
40
|
-
var backPage = function backPage(
|
|
41
|
-
|
|
39
|
+
var backPage = function backPage() {
|
|
40
|
+
if (page > 1) {
|
|
41
|
+
setPage(page - 1);
|
|
42
|
+
}
|
|
42
43
|
};
|
|
43
|
-
var nextPage = function nextPage(
|
|
44
|
-
|
|
44
|
+
var nextPage = function nextPage() {
|
|
45
|
+
if (page < Math.ceil(totalData / amountDataPerPage)) {
|
|
46
|
+
setPage(page + 1);
|
|
47
|
+
}
|
|
45
48
|
};
|
|
46
49
|
var nextLastPage = function nextLastPage(pageNumbers) {
|
|
47
50
|
setPage(pageNumbers.length);
|
|
48
51
|
};
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
onChangeSelected(page, (page - 1) * amountDataPerPage);
|
|
54
|
+
}, [page, amountDataPerPage, onChangeSelected]);
|
|
49
55
|
return /*#__PURE__*/React.createElement(View, {
|
|
50
|
-
style:
|
|
56
|
+
style: paginationStyleVariant.primary.container
|
|
51
57
|
}, /*#__PURE__*/React.createElement(View, {
|
|
52
|
-
style:
|
|
58
|
+
style: paginationStyleVariant.primary.container
|
|
53
59
|
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
54
60
|
disabled: page <= 1 || totalData === 0,
|
|
55
|
-
onPress:
|
|
56
|
-
/* Allows to detect the selected item */
|
|
57
|
-
backToFirstPage();
|
|
58
|
-
onChangeSelected(1, 0);
|
|
59
|
-
}
|
|
61
|
+
onPress: backToFirstPage
|
|
60
62
|
}, /*#__PURE__*/React.createElement(ArrowFirstIcon, {
|
|
61
63
|
style: {
|
|
62
|
-
width: 10,
|
|
63
64
|
height: 10,
|
|
65
|
+
width: 10,
|
|
64
66
|
marginRight: 10
|
|
65
67
|
}
|
|
66
68
|
})), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
67
69
|
disabled: page <= 1 || totalData === 0,
|
|
68
|
-
onPress:
|
|
69
|
-
backPage(page);
|
|
70
|
-
if (page !== 1) {
|
|
71
|
-
onChangeSelected(page - 1, pagination - amountDataPerPage);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
70
|
+
onPress: backPage
|
|
74
71
|
}, /*#__PURE__*/React.createElement(ArrowLeftIcon, {
|
|
75
72
|
style: {
|
|
76
73
|
height: 10,
|
|
@@ -78,16 +75,13 @@ var Pagination = function Pagination(_ref) {
|
|
|
78
75
|
marginRight: 10
|
|
79
76
|
}
|
|
80
77
|
})), /*#__PURE__*/React.createElement(View, {
|
|
81
|
-
style:
|
|
78
|
+
style: paginationStyleVariant.primary.pageNumberContainer
|
|
82
79
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
83
|
-
style:
|
|
80
|
+
style: paginationStyleVariant.primary.pageNumberText
|
|
84
81
|
}, page)), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
85
82
|
disabled: page === pageNumbers.length || totalData === 0,
|
|
86
83
|
onPress: function onPress() {
|
|
87
|
-
nextPage(
|
|
88
|
-
if (page !== Math.ceil(totalData / 8)) {
|
|
89
|
-
onChangeSelected(page + 1, pagination + amountDataPerPage);
|
|
90
|
-
}
|
|
84
|
+
nextPage();
|
|
91
85
|
}
|
|
92
86
|
}, /*#__PURE__*/React.createElement(ArrowRightIcon, {
|
|
93
87
|
style: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
1
|
+
import { PaginationStyleVariant } from './Pagination.types';
|
|
2
|
+
export declare const paginationStyleVariant: PaginationStyleVariant;
|
|
3
3
|
export declare const styles: {
|
|
4
4
|
storiesContainer: {
|
|
5
5
|
height: number;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
/* Imports */
|
|
2
1
|
import { QUATERNARY_50 } from "../../styles/colors";
|
|
3
2
|
import { StyleSheet } from "react-native-web";
|
|
4
|
-
|
|
5
|
-
/* Export of different styles */
|
|
6
|
-
export var PaginationStyleVariant = {
|
|
7
|
-
/* Primary style */
|
|
3
|
+
export var paginationStyleVariant = {
|
|
8
4
|
primary: {
|
|
9
5
|
container: {
|
|
10
6
|
flex: 1,
|
|
11
7
|
width: 120,
|
|
12
8
|
height: 22,
|
|
13
9
|
flexDirection: 'row',
|
|
14
|
-
justifyContent: 'flex-end',
|
|
15
10
|
alignItems: 'center'
|
|
16
11
|
},
|
|
17
12
|
icon: {
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
-
export type Info = {
|
|
3
|
-
name: string;
|
|
4
|
-
route: string;
|
|
5
|
-
key: string;
|
|
6
|
-
};
|
|
7
2
|
export interface PaginationProps {
|
|
8
3
|
currentPage: number;
|
|
9
|
-
onChangeSelected: (
|
|
4
|
+
onChangeSelected: (currentPage: number, offset: number) => void;
|
|
10
5
|
totalData: number;
|
|
11
6
|
amountDataPerPage: number;
|
|
12
|
-
pagination: number;
|
|
13
|
-
isWeb?: boolean;
|
|
14
7
|
}
|
|
15
|
-
export type
|
|
16
|
-
export
|
|
8
|
+
export type PaginationStyleType = 'primary';
|
|
9
|
+
export interface PaginationStyles {
|
|
10
|
+
container: ViewStyle;
|
|
11
|
+
icon?: ImageStyle;
|
|
12
|
+
pageNumberContainer: ViewStyle;
|
|
13
|
+
pageNumberText: TextStyle;
|
|
14
|
+
}
|
|
15
|
+
export type PaginationStyleVariant = {
|
|
16
|
+
primary: PaginationStyles;
|
|
17
|
+
};
|
|
18
|
+
export type PaginationStyleRecord = Record<PaginationStyleType, {
|
|
17
19
|
container: ViewStyle;
|
|
18
20
|
icon?: ImageStyle;
|
|
19
21
|
pageNumberContainer: ViewStyle;
|