@gmfe/react 2.14.11 → 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.11",
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.11",
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": "2415091911db68597c5411e9c7657d88bdd8aad8"
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 { data, onChange, showCount, _peekInfo, className, ...rest } = props
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 data={data} onChange={onChange} showCount={showCount} />
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 limitData = [
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: '60px' }}
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}条记录,&nbsp;</span>}
40
44
  <span>每页&nbsp;</span>
41
- <Limit value={data.limit} onChange={handleChangeLimit} />
45
+ <Limit
46
+ value={data.limit}
47
+ limitData={limitData}
48
+ onChange={handleChangeLimit}
49
+ />
42
50
  <span>&nbsp;条</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
@@ -0,0 +1,21 @@
1
+ import 'react-photo-view/dist/react-photo-view.css'
2
+ import { PhotoProvider, PhotoView } from 'react-photo-view'
3
+ import PropTypes from 'prop-types'
4
+ import React from 'react'
5
+
6
+ export default function PicturePreview({ images, className }) {
7
+ return (
8
+ <PhotoProvider>
9
+ {(images || []).map((item, index) => (
10
+ <PhotoView key={index} src={item}>
11
+ <img src={item} alt='' className={className} />
12
+ </PhotoView>
13
+ ))}
14
+ </PhotoProvider>
15
+ )
16
+ }
17
+
18
+ PicturePreview.propTypes = {
19
+ images: PropTypes.array,
20
+ className: PropTypes.string
21
+ }
package/src/index.js CHANGED
@@ -102,6 +102,7 @@ import Steps from './component/steps'
102
102
  import Selection from './component/selection'
103
103
  import TreeV2 from './component/tree_v2'
104
104
  import RecommendInput from './component/recommend_input'
105
+ import PicturePreview from './component/picture_preview'
105
106
 
106
107
  Object.assign(Sheet, {
107
108
  SheetColumn,
@@ -231,5 +232,6 @@ export {
231
232
  Steps,
232
233
  Selection,
233
234
  TreeV2,
234
- RecommendInput
235
+ RecommendInput,
236
+ PicturePreview
235
237
  }