|
@@ -1,30 +1,47 @@
|
|
import React from 'react'
|
|
import React from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import PropTypes from 'prop-types'
|
|
import GridItem from './GridItem'
|
|
import GridItem from './GridItem'
|
|
-import { int, innerHeight, innerWidth, outerHeight, outerWidth, parseBounds, isNumber } from './utils'
|
|
|
|
|
|
|
|
import './style.css'
|
|
import './style.css'
|
|
|
|
|
|
-export default class CtmpFather extends React.Component {
|
|
|
|
-
|
|
|
|
- onWindowResize(e) {
|
|
|
|
- console.log(this.node.clientWidth)
|
|
|
|
|
|
+class DraggerLayout extends React.Component {
|
|
|
|
+ static PropTypes = {
|
|
|
|
+ /**外部属性 */
|
|
|
|
+ layout: PropTypes.array,
|
|
|
|
+ col: PropTypes.number,
|
|
|
|
+ width: PropTypes.number,
|
|
|
|
+ rowHeight: PropTypes.number,
|
|
|
|
+ padding: PropTypes.number,
|
|
}
|
|
}
|
|
- componentDidMount() {
|
|
|
|
- console.log(this.node)
|
|
|
|
- window.addEventListener('resize', this.onWindowResize.bind(this))
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
|
+ const { col, width } = this.props
|
|
return (
|
|
return (
|
|
<div
|
|
<div
|
|
- className='shitWrap'
|
|
|
|
|
|
+ className='DraggerLayout'
|
|
style={{ position: 'absolute', left: 100, width: 500, height: 500, border: '1px solid black' }}
|
|
style={{ position: 'absolute', left: 100, width: 500, height: 500, border: '1px solid black' }}
|
|
- ref={(node) => this.node = node}
|
|
|
|
>
|
|
>
|
|
- <GridItem/>
|
|
|
|
|
|
+ {React.Children.map(this.props.children,
|
|
|
|
+ (child) =>
|
|
|
|
+ <GridItem
|
|
|
|
+ col={col}
|
|
|
|
+ containerWidth={width}
|
|
|
|
+ containerPadding={padding}
|
|
|
|
+ >
|
|
|
|
+ {child}
|
|
|
|
+ </GridItem >
|
|
|
|
+ )}
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+export const LayoutDemo = () => {
|
|
|
|
+ return (
|
|
|
|
+ <DraggerLayout>
|
|
|
|
+ <p>asdasd</p>
|
|
|
|
+ <p>asdasd</p>
|
|
|
|
+ </DraggerLayout>
|
|
|
|
+ )
|
|
|
|
+}
|