Gathering detailed insights and metrics for react-draggable-resizable
Gathering detailed insights and metrics for react-draggable-resizable
Gathering detailed insights and metrics for react-draggable-resizable
Gathering detailed insights and metrics for react-draggable-resizable
react-rnd
A draggable and resizable React Component
react-grid-layout
A draggable and resizable grid layout with responsive breakpoints, for React.
react-moveable
A React Component that create Moveable, Draggable, Resizable, Scalable, Rotatable, Warpable, Pinchable, Groupable.
react-resizable-rotatable-draggable
A rectangle react component which can be resized and rotated
npm install react-draggable-resizable
Typescript
Module System
Node Version
NPM Version
68.4
Supply Chain
94.2
Quality
74
Maintenance
100
Vulnerability
100
License
Total Downloads
2,336
Last Day
2
Last Week
10
Last Month
51
Last Year
893
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
react-draggable-resizable@1.0.1
Unpacked Size
337.23 kB
Size
96.68 kB
File Count
18
NPM Version
6.4.1
Node Version
10.10.0
Cumulative downloads
Total Downloads
Last Day
100%
2
Compared to previous day
Last Week
11.1%
10
Compared to previous week
Last Month
-44%
51
Compared to previous month
Last Year
114.7%
893
Compared to previous year
React Component for draggable and resizable component
使用npm
1npm install react-draggable-resizable --save
使用yarn
1yarn add react-draggable-resizable
1import React from 'react' 2import ReactDOM from 'react-dom' 3import ReactDraggableResizable from 'react-draggable-resizable' 4 5class App extends React.Component { 6 constructor(props) { 7 super(props) 8 this.state = { 9 width: 0, 10 height: 0, 11 left: 0, 12 right: 0 13 } 14 } 15 16 onDrag(left, top) { 17 this.setState({ 18 left, 19 top 20 }) 21 } 22 23 onResize(left, top, width, height) { 24 this.setState({ 25 left, 26 top, 27 width, 28 height 29 }) 30 } 31 32 render() { 33 const { left, top, width, height } = this.state 34 return ( 35 <ReactDraggableResizable 36 w={200} 37 h={200} 38 dragging={this.onDrag.bind(this)} 39 resizing={this.onResize.bind(this)} 40 > 41 <div> 42 <div>left: {left}</div> 43 <div>top: {top}</div> 44 <div>width: {width}</div> 45 <div>height: {height}</div> 46 </div> 47 </ReactDraggableResizable> 48 ) 49 } 50} 51 52ReactDOM.render(<App />, document.getElementById('app'))
Boolean
false
false
用于控制组件的状态
1<ReactDraggableResizable active={true}></ReactDraggableResizable>
Boolean
false
true
控制组件是否能够拖动
1<ReactDraggableResizable draggable={false}></ReactDraggableResizable>
Boolean
false
true
控制组件是否能够缩放
Number
false
200
拖动元素的初始化宽度
1<ReactDraggableResizable w={200}></ReactDraggableResizable>
Number
false
200
拖动元素的初始化高度
1<ReactDraggableResizable h={200}></ReactDraggableResizable>
Number
false
50
拖动元素的最小宽度
1<ReactDraggableResizable minw={50}></ReactDraggableResizable>
Number
false
50
拖动元素的最小高度
1<ReactDraggableResizable minh={50}></ReactDraggableResizable>
Number
false
0
拖动元素初始left值
1<ReactDraggableResizable x={50}></ReactDraggableResizable>
Number
false
0
拖动元素初始top值
1<ReactDraggableResizable y={50}></ReactDraggableResizable>
String | Number
false
auto
拖动元素的zIndex值
1<ReactDraggableResizable z={50}></ReactDraggableResizable>
Array
false
['tl', 'tm', 'tr', 'mr', 'br', 'bm', 'bl', 'ml']
控制元素可以拖动的方向
tl
- 左上角tm
- 上边的中部tr
- 右上角mr
- 右边的中部br
- 右下角bm
- 下边的中部bl
- 左下角ml
- 左边的中部1<ReactDraggableResizable handles={['tm', 'tr', 'tl']}></ReactDraggableResizable>
String
false
both
控制拖动元素的拖动的方向
1<ReactDraggableResizable axis='x'></ReactDraggableResizable>
Array
false
[1,1]
控制拖动元素在x和y轴的每次移动的距离
1<ReactDraggableResizable grid={[10, 5]}></ReactDraggableResizable>
Boolean
false
false
控制拖动元素是否只能在父节点中移动和缩放
1<ReactDraggableResizable parent={true}></ReactDraggableResizable>
Boolean
false
false
设置为true,则双击拖动元素,充满父元素
1<ReactDraggableResizable maximize={true}></ReactDraggableResizable>
Function
false
无
当拖动元素被点击的时候调用
1<ReactDraggableResizable 2 activated={() => {console.log('Element Clicked!!!')}} 3> 4 5</ReactDraggableResizable>
Function
false
无
点击拖动元素之外的区域,拖动元素失去焦点的时候调用
1<ReactDraggableResizable 2 deactivated={() => {console.log('deactivated')}} 3> 4 5</ReactDraggableResizable>
Function
false
left
拖动元素的left值top
拖动元素的top值width
拖动元素的宽度height
拖动元素的高度当拖动元素被缩放的时候被调用
1<ReactDraggableResizable 2 resizestop={(left, top, width, height) => {console.log(`left: ${left}, top: ${top}, width: ${width}, height: ${height}`)}}> 3 4</ReactDraggableResizable>
Function
false
left
拖动元素的left值top
拖动元素的top值width
拖动元素的宽度height
拖动元素的高度当拖动元素缩放停止的时候被调用
1<ReactDraggableResizable 2 resizestop={(left, top, width, height) => {console.log(`left: ${left}, top: ${top}, width: ${width}, height: ${height}`)}}> 3 4</ReactDraggableResizable>
Function
false
left
拖动元素的left值top
拖动元素的top值当拖动元素被拖动的时候调用
1<ReactDraggableResizable dragging={(left, top) => {console.log(`left: ${left}, top: ${top}`)}}> 2 3</ReactDraggableResizable>
Function
false
left
拖动元素的left值top
拖动元素的top值当拖动元素拖动停止的时候调用
1<ReactDraggableResizable dragstop={(left, top) => {console.log(`left: ${left}, top: ${top}`)}}> 2 3</ReactDraggableResizable>
No vulnerabilities found.
No security vulnerabilities found.