@gmfe/react 2.14.12 → 2.14.14
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
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gmfe/react",
|
3
|
-
"version": "2.14.
|
3
|
+
"version": "2.14.14",
|
4
4
|
"description": "",
|
5
5
|
"author": "liyatang <liyatang@qq.com>",
|
6
6
|
"homepage": "https://github.com/gmfe/gmfe#readme",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
29
|
"@gm-common/tool": "^1.0.0",
|
30
|
-
"@gmfe/locales": "^2.14.
|
30
|
+
"@gmfe/locales": "^2.14.14",
|
31
31
|
"big.js": "^5.2.2",
|
32
32
|
"classnames": "^2.2.5",
|
33
33
|
"lodash": "^4.17.14",
|
@@ -35,5 +35,5 @@
|
|
35
35
|
"prop-types": "^15.7.2",
|
36
36
|
"react-window": "^1.8.5"
|
37
37
|
},
|
38
|
-
"gitHead": "
|
38
|
+
"gitHead": "ecec41e60a1f8cb7646adf6728b1a7c5286e9711"
|
39
39
|
}
|
@@ -8,7 +8,15 @@ import Right from './right'
|
|
8
8
|
import PagePeek from './page_peek'
|
9
9
|
|
10
10
|
const PaginationBase = props => {
|
11
|
-
const {
|
11
|
+
const {
|
12
|
+
data,
|
13
|
+
onChange,
|
14
|
+
showCount,
|
15
|
+
_peekInfo,
|
16
|
+
className,
|
17
|
+
limitData = [],
|
18
|
+
...rest
|
19
|
+
} = props
|
12
20
|
|
13
21
|
return (
|
14
22
|
<Flex
|
@@ -16,7 +24,12 @@ const PaginationBase = props => {
|
|
16
24
|
alignCenter
|
17
25
|
className={classNames('gm-pagination', className)}
|
18
26
|
>
|
19
|
-
<Left
|
27
|
+
<Left
|
28
|
+
data={data}
|
29
|
+
limitData={limitData}
|
30
|
+
onChange={onChange}
|
31
|
+
showCount={showCount}
|
32
|
+
/>
|
20
33
|
{_peekInfo ? (
|
21
34
|
<PagePeek data={data} _peekInfo={_peekInfo} onChange={onChange} />
|
22
35
|
) : (
|
@@ -44,7 +57,11 @@ PaginationBase.propTypes = {
|
|
44
57
|
_peekInfo: PropTypes.shape({
|
45
58
|
more: PropTypes.bool,
|
46
59
|
peek: PropTypes.number
|
47
|
-
})
|
60
|
+
}),
|
61
|
+
/**
|
62
|
+
*自定义分页,默认
|
63
|
+
*/
|
64
|
+
limitData: PropTypes.array
|
48
65
|
}
|
49
66
|
|
50
67
|
export default PaginationBase
|
@@ -3,29 +3,33 @@ import PropTypes from 'prop-types'
|
|
3
3
|
import { Select } from '../select'
|
4
4
|
import Flex from '../flex'
|
5
5
|
|
6
|
-
const
|
6
|
+
const defaultLimitData = [
|
7
7
|
{ value: 10, text: 10 },
|
8
8
|
{ value: 20, text: 20 },
|
9
9
|
{ value: 50, text: 50 }
|
10
10
|
]
|
11
11
|
|
12
|
-
const Limit = ({ value, onChange }) => {
|
12
|
+
const Limit = ({ value, onChange, limitData }) => {
|
13
13
|
return (
|
14
14
|
<Select
|
15
15
|
data={limitData}
|
16
16
|
value={value}
|
17
17
|
onChange={onChange}
|
18
|
-
style={{ width: '
|
18
|
+
style={{ width: '70px' }}
|
19
19
|
/>
|
20
20
|
)
|
21
21
|
}
|
22
22
|
|
23
23
|
Limit.propTypes = {
|
24
24
|
value: PropTypes.any.isRequired,
|
25
|
-
onChange: PropTypes.func.isRequired
|
25
|
+
onChange: PropTypes.func.isRequired,
|
26
|
+
limitData: PropTypes.array
|
27
|
+
}
|
28
|
+
Limit.defaultProps = {
|
29
|
+
limitData: defaultLimitData
|
26
30
|
}
|
27
31
|
|
28
|
-
const Left = ({ data, onChange, showCount }) => {
|
32
|
+
const Left = ({ data, onChange, showCount, limitData }) => {
|
29
33
|
const handleChangeLimit = limit => {
|
30
34
|
// 回到第一页
|
31
35
|
onChange({
|
@@ -38,7 +42,11 @@ const Left = ({ data, onChange, showCount }) => {
|
|
38
42
|
<Flex alignCenter>
|
39
43
|
{showCount && <span>共{data.count}条记录, </span>}
|
40
44
|
<span>每页 </span>
|
41
|
-
<Limit
|
45
|
+
<Limit
|
46
|
+
value={data.limit}
|
47
|
+
limitData={limitData}
|
48
|
+
onChange={handleChangeLimit}
|
49
|
+
/>
|
42
50
|
<span> 条</span>
|
43
51
|
</Flex>
|
44
52
|
)
|
@@ -47,7 +55,11 @@ const Left = ({ data, onChange, showCount }) => {
|
|
47
55
|
Left.propTypes = {
|
48
56
|
data: PropTypes.object,
|
49
57
|
onChange: PropTypes.func.isRequired,
|
50
|
-
showCount: PropTypes.bool
|
58
|
+
showCount: PropTypes.bool,
|
59
|
+
limitData: PropTypes.array
|
60
|
+
}
|
61
|
+
Left.defaultProps = {
|
62
|
+
limitData: defaultLimitData
|
51
63
|
}
|
52
64
|
|
53
65
|
export default Left
|