Skip to content

Commit

Permalink
Add extendsProps
Browse files Browse the repository at this point in the history
  • Loading branch information
bokuweb committed Sep 20, 2016
1 parent f71c92e commit d55764d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ Calls back with (`direction: string`, `styleSize: object`, `clientSize: object`,

For example, when `<Resizable width={100} height={200} style={{ padding: '20px'}} onResize={...} />` mounted and resize 'right' 20px, this callback is called with `('right', { width: 120, height: 200 }, { width: 160, height: 240 }, {width: 20, height: 0})`

#### `extendsProps`: PropTypes.object

This property is used to pass the other props to the component.

e.g.

``` javascript
const extendsProps = {
data-foo: 'foo',
onMouseOver: () => {},
};

<Resizable {...extendsProps} />
```


## method

Expand Down Expand Up @@ -238,6 +253,10 @@ npm test

## Changelog

#### v1.8.0

- Add `extendsProps` prop to other props (e.g. `data-*`, `aria-*`, and other ).

#### v1.7.0

- Support siver side rendering #43
Expand Down
7 changes: 4 additions & 3 deletions docs/dist/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -22826,7 +22826,7 @@ var Resizable = function (_Component) {

return _react2.default.createElement(
'div',
{
_extends({
ref: 'resizable',
style: _extends({
position: 'relative'
Expand All @@ -22836,7 +22836,7 @@ var Resizable = function (_Component) {
onMouseDown: onMouseDown,
onDoubleClick: onDoubleClick,
onTouchStart: onTouchStart
},
}, this.props.extendsProps),
this.props.children,
this.renderResizer()
);
Expand Down Expand Up @@ -22894,7 +22894,8 @@ Resizable.propTypes = {
maxWidth: _react.PropTypes.number,
maxHeight: _react.PropTypes.number,
grid: _react.PropTypes.arrayOf(_react.PropTypes.number),
lockAspectRatio: _react.PropTypes.bool.isRequired
lockAspectRatio: _react.PropTypes.bool.isRequired,
extendsProps: _react.PropTypes.object
};
Resizable.defaultProps = {
onResizeStart: function onResizeStart() {
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export default class Resizable extends Component {
maxHeight: PropTypes.number,
grid: PropTypes.arrayOf(PropTypes.number),
lockAspectRatio: PropTypes.bool.isRequired,
extendsProps: PropTypes.object,
};

static defaultProps = {
Expand Down Expand Up @@ -316,6 +317,7 @@ export default class Resizable extends Component {
onMouseDown={onMouseDown}
onDoubleClick={onDoubleClick}
onTouchStart={onTouchStart}
{...this.props.extendsProps}
>
{this.props.children}
{this.renderResizer()}
Expand Down

0 comments on commit d55764d

Please sign in to comment.