@gmfe/react 2.15.4-alpha.0 → 2.15.6-alpha.0
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 +3 -3
- package/src/component/box/box.js +47 -15
- package/src/hoc/sticky_layout.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gmfe/react",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.6-alpha.0",
|
|
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.15.
|
|
30
|
+
"@gmfe/locales": "^2.15.6-alpha.0",
|
|
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": "9b7441b57c7287e500be9fa86f930d0c7c1411c7"
|
|
39
39
|
}
|
package/src/component/box/box.js
CHANGED
|
@@ -1,31 +1,63 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
+
import Flex from '../flex'
|
|
5
|
+
import StickyLayout from '../../hoc/sticky_layout'
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const { hasGap, className, children, ...rest } = props
|
|
8
|
-
|
|
7
|
+
// 暂时没什么用
|
|
8
|
+
const Info = props => {
|
|
9
9
|
return (
|
|
10
10
|
<div
|
|
11
|
-
{...
|
|
11
|
+
{...props}
|
|
12
|
+
className={classNames('gm-box-table-info', props.className)}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Info.propTypes = {
|
|
18
|
+
className: PropTypes.string,
|
|
19
|
+
style: PropTypes.object
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const BoxHeader = StickyLayout(props => {
|
|
23
|
+
const { info, action, headerProps = {} } = props
|
|
24
|
+
const { className: headerClassName } = headerProps
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Flex
|
|
28
|
+
{...headerProps}
|
|
12
29
|
className={classNames(
|
|
13
|
-
'gm-box',
|
|
14
|
-
|
|
15
|
-
'gm-padding-tb-10 gm-padding-lr-20 ': hasGap
|
|
16
|
-
},
|
|
17
|
-
className
|
|
30
|
+
'gm-box-table-header common-sticky-header',
|
|
31
|
+
headerClassName
|
|
18
32
|
)}
|
|
33
|
+
alignCenter
|
|
19
34
|
>
|
|
20
|
-
{
|
|
35
|
+
<Flex>{info}</Flex>
|
|
36
|
+
<Flex flex />
|
|
37
|
+
<Flex>{action}</Flex>
|
|
38
|
+
</Flex>
|
|
39
|
+
)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const BoxTable = props => {
|
|
43
|
+
const { children, className, ...rest } = props
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div {...rest} className={classNames('gm-box gm-box-table', className)}>
|
|
47
|
+
<BoxHeader {...props} />
|
|
48
|
+
<div>{children}</div>
|
|
21
49
|
</div>
|
|
22
50
|
)
|
|
23
51
|
}
|
|
24
52
|
|
|
25
|
-
|
|
26
|
-
|
|
53
|
+
BoxTable.Info = Info
|
|
54
|
+
|
|
55
|
+
BoxTable.propTypes = {
|
|
56
|
+
info: PropTypes.element,
|
|
57
|
+
action: PropTypes.element,
|
|
27
58
|
className: PropTypes.string,
|
|
28
|
-
style: PropTypes.object
|
|
59
|
+
style: PropTypes.object,
|
|
60
|
+
headerProps: PropTypes.object
|
|
29
61
|
}
|
|
30
62
|
|
|
31
|
-
export default
|
|
63
|
+
export default BoxTable
|
package/src/hoc/sticky_layout.js
CHANGED
|
@@ -142,7 +142,7 @@ const handleTopSentinelLeave = currentStickyRef => {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
function StickyLayout(Component) {
|
|
145
|
-
const
|
|
145
|
+
const _StickyLayout = ({ sticky, ...rest }) => {
|
|
146
146
|
const currentStickyRef = useRef(null)
|
|
147
147
|
const topSentinelRef = useRef(null)
|
|
148
148
|
const bottomSentinelRef = useRef(null)
|
|
@@ -215,15 +215,15 @@ function StickyLayout(Component) {
|
|
|
215
215
|
)
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
sticky:
|
|
218
|
+
_StickyLayout.defaultProps = {
|
|
219
|
+
sticky: true
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
_StickyLayout.propTypes = {
|
|
223
223
|
sticky: PropTypes.oneOfType([PropTypes.bool, PropTypes.object])
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
return
|
|
226
|
+
return _StickyLayout
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
export default StickyLayout
|