rc-drawer
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -27,2 +27,4 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -325,24 +327,35 @@ | ||
value: function render() { | ||
var props = this.props; | ||
var prefixCls = props.prefixCls; | ||
var _rootCls; | ||
var _props = this.props; | ||
var className = _props.className; | ||
var prefixCls = _props.prefixCls; | ||
var position = _props.position; | ||
var transitions = _props.transitions; | ||
var touch = _props.touch; | ||
var sidebar = _props.sidebar; | ||
var children = _props.children; | ||
var docked = _props.docked; | ||
var open = _props.open; | ||
var sidebarStyle = _extends({}, this.props.sidebarStyle); | ||
var contentStyle = _extends({}, this.props.contentStyle); | ||
var overlayStyle = _extends({}, this.props.overlayStyle); | ||
var rootCls = (_rootCls = {}, _defineProperty(_rootCls, className, !!className), _defineProperty(_rootCls, prefixCls, true), _defineProperty(_rootCls, prefixCls + '-' + position, true), _rootCls); | ||
var rootProps = {}; | ||
var sidebarStyle = _extends({}, props.sidebarStyle); | ||
var contentStyle = _extends({}, props.contentStyle); | ||
var overlayStyle = _extends({}, props.overlayStyle); | ||
var isTouching = this.isTouching(); | ||
var dragHandle = null; | ||
rootProps.className = (0, _classnames2["default"])(props.className, props.prefixCls, props.prefixCls + '-' + props.position); | ||
if (isTouching) { | ||
this.renderStyle({ sidebarStyle: sidebarStyle, isTouching: true, overlayStyle: overlayStyle }); | ||
} else if (this.props.docked) { | ||
// show sidebar | ||
} else if (docked) { | ||
if (this.state.sidebarWidth !== 0) { | ||
rootCls[prefixCls + '-docked'] = true; | ||
this.renderStyle({ sidebarStyle: sidebarStyle, contentStyle: contentStyle }); | ||
} | ||
} else if (this.props.open) { | ||
// slide open sidebar | ||
} else if (open) { | ||
rootCls[prefixCls + '-open'] = true; | ||
this.renderStyle({ sidebarStyle: sidebarStyle }); | ||
// show overlay | ||
overlayStyle.opacity = 1; | ||
@@ -352,3 +365,3 @@ overlayStyle.visibility = 'visible'; | ||
if (isTouching || !this.props.transitions) { | ||
if (isTouching || !transitions) { | ||
sidebarStyle.transition = 'none'; | ||
@@ -360,4 +373,6 @@ sidebarStyle.WebkitTransition = 'none'; | ||
if (this.state.touchSupported && this.props.touch) { | ||
if (this.props.open) { | ||
var dragHandle = null; | ||
if (this.state.touchSupported && touch) { | ||
if (open) { | ||
rootProps.onTouchStart = this.onTouchStart; | ||
@@ -369,3 +384,3 @@ rootProps.onTouchMove = this.onTouchMove; | ||
} else { | ||
var dragHandleStyle = _extends({}, props.dragHandleStyle); | ||
var dragHandleStyle = _extends({}, this.props.dragHandleStyle); | ||
@@ -382,3 +397,3 @@ dragHandle = _react2["default"].createElement('div', { className: prefixCls + '-draghandle', style: dragHandleStyle, | ||
'div', | ||
rootProps, | ||
_extends({ className: (0, _classnames2["default"])(rootCls) }, rootProps), | ||
_react2["default"].createElement( | ||
@@ -389,3 +404,3 @@ 'div', | ||
}, | ||
this.props.sidebar | ||
sidebar | ||
), | ||
@@ -403,3 +418,3 @@ _react2["default"].createElement('div', { className: prefixCls + '-overlay', style: overlayStyle, | ||
dragHandle, | ||
this.props.children | ||
children | ||
) | ||
@@ -415,2 +430,3 @@ ); | ||
prefixCls: _react2["default"].PropTypes.string, | ||
className: _react2["default"].PropTypes.string, | ||
// main content to render | ||
@@ -417,0 +433,0 @@ children: _react2["default"].PropTypes.node.isRequired, |
{ | ||
"name": "rc-drawer", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "drawer ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26284
525