rc-drawer
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -8,5 +8,2 @@ import * as React from 'react'; | ||
declare class DrawerChild extends React.Component<IDrawerChildProps, IState> { | ||
static defaultProps: { | ||
switchScrollingEffect: () => void; | ||
}; | ||
static getDerivedStateFromProps(props: IDrawerChildProps, { prevProps, _self }: { | ||
@@ -13,0 +10,0 @@ prevProps: IDrawerChildProps; |
@@ -0,1 +1,2 @@ | ||
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
@@ -7,9 +8,3 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
import _inherits from "@babel/runtime/helpers/esm/inherits"; | ||
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn"; | ||
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf"; | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
import _createSuper from "@babel/runtime/helpers/esm/createSuper"; | ||
import classnames from 'classnames'; | ||
@@ -224,11 +219,3 @@ import getScrollBarSize from "rc-util/es/getScrollBarSize"; | ||
duration = _this$props5.duration, | ||
ease = _this$props5.ease, | ||
getOpenCount = _this$props5.getOpenCount, | ||
switchScrollingEffect = _this$props5.switchScrollingEffect; | ||
var openCount = getOpenCount && getOpenCount(); | ||
if (openCount === 1) { | ||
switchScrollingEffect(); | ||
} | ||
ease = _this$props5.ease; | ||
var widthTransition = "width ".concat(duration, " ").concat(ease); | ||
@@ -267,11 +254,4 @@ var transformTransition = "transform ".concat(duration, " ").concat(ease); | ||
duration = _this$props6.duration, | ||
ease = _this$props6.ease, | ||
getOpenCount = _this$props6.getOpenCount, | ||
switchScrollingEffect = _this$props6.switchScrollingEffect; | ||
var openCount = getOpenCount && getOpenCount(); | ||
ease = _this$props6.ease; | ||
if (!openCount) { | ||
switchScrollingEffect(true); | ||
} | ||
if (transitionStr) { | ||
@@ -413,2 +393,4 @@ document.body.style.overflowX = 'hidden'; | ||
if (open) { | ||
var _this$props$scrollLoc; | ||
if (container && container.parentNode === document.body) { | ||
@@ -423,2 +405,3 @@ currentDrawer[this.drawerId] = open; | ||
}); | ||
(_this$props$scrollLoc = this.props.scrollLocker) === null || _this$props$scrollLoc === void 0 ? void 0 : _this$props$scrollLoc.lock(); | ||
} | ||
@@ -431,10 +414,7 @@ } | ||
open = _this$props8.open, | ||
getContainer = _this$props8.getContainer; | ||
getContainer = _this$props8.getContainer, | ||
scrollLocker = _this$props8.scrollLocker; | ||
var container = getContainer && getContainer(); | ||
if (open !== prevProps.open) { | ||
if (open) { | ||
this.domFocus(); | ||
} | ||
if (container && container.parentNode === document.body) { | ||
@@ -445,2 +425,9 @@ currentDrawer[this.drawerId] = !!open; | ||
this.openLevelTransition(); | ||
if (open) { | ||
this.domFocus(); | ||
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.lock(); | ||
} else { | ||
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.unLock(); | ||
} | ||
} | ||
@@ -452,6 +439,4 @@ } | ||
var _this$props9 = this.props, | ||
getOpenCount = _this$props9.getOpenCount, | ||
open = _this$props9.open, | ||
switchScrollingEffect = _this$props9.switchScrollingEffect; | ||
var openCount = typeof getOpenCount === 'function' && getOpenCount(); | ||
scrollLocker = _this$props9.scrollLocker; | ||
delete currentDrawer[this.drawerId]; | ||
@@ -464,6 +449,3 @@ | ||
if (!openCount) { | ||
document.body.style.overflow = ''; | ||
switchScrollingEffect(true); | ||
} | ||
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.unLock(); | ||
} // tslint:disable-next-line:member-ordering | ||
@@ -502,4 +484,4 @@ | ||
getOpenCount = _this$props10.getOpenCount, | ||
switchScrollingEffect = _this$props10.switchScrollingEffect, | ||
props = _objectWithoutProperties(_this$props10, ["className", "children", "style", "width", "height", "defaultOpen", "open", "prefixCls", "placement", "level", "levelMove", "ease", "duration", "getContainer", "handler", "onChange", "afterVisibleChange", "showMask", "maskClosable", "maskStyle", "onClose", "onHandleClick", "keyboard", "getOpenCount", "switchScrollingEffect"]); // 首次渲染都将是关闭状态。 | ||
scrollLocker = _this$props10.scrollLocker, | ||
props = _objectWithoutProperties(_this$props10, ["className", "children", "style", "width", "height", "defaultOpen", "open", "prefixCls", "placement", "level", "levelMove", "ease", "duration", "getContainer", "handler", "onChange", "afterVisibleChange", "showMask", "maskClosable", "maskStyle", "onClose", "onHandleClick", "keyboard", "getOpenCount", "scrollLocker"]); // 首次渲染都将是关闭状态。 | ||
@@ -517,3 +499,3 @@ | ||
var transform = open ? '' : "".concat(placementName, "(").concat(placementPos, ")"); | ||
var handlerChildren = handler && React.cloneElement(handler, { | ||
var handlerChildren = handler && /*#__PURE__*/React.cloneElement(handler, { | ||
onClick: function onClick(e) { | ||
@@ -532,3 +514,3 @@ if (handler.props.onClick) { | ||
}); | ||
return React.createElement("div", Object.assign({}, props, { | ||
return /*#__PURE__*/React.createElement("div", _extends({}, props, { | ||
tabIndex: -1, | ||
@@ -542,3 +524,3 @@ className: wrapperClassName, | ||
onTransitionEnd: this.onWrapperTransitionEnd | ||
}), showMask && React.createElement("div", { | ||
}), showMask && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-mask"), | ||
@@ -550,3 +532,3 @@ onClick: maskClosable ? onClose : undefined, | ||
} | ||
}), React.createElement("div", { | ||
}), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-content-wrapper"), | ||
@@ -562,3 +544,3 @@ style: { | ||
} | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-content"), | ||
@@ -568,4 +550,6 @@ ref: function ref(c) { | ||
}, | ||
onTouchStart: open && showMask ? this.removeStartHandler : undefined, | ||
onTouchMove: open && showMask ? this.removeMoveHandler : undefined | ||
onTouchStart: open && showMask ? this.removeStartHandler : undefined // 跑用例用 | ||
, | ||
onTouchMove: open && showMask ? this.removeMoveHandler : undefined // 跑用例用 | ||
}, children), handlerChildren)); | ||
@@ -603,5 +587,2 @@ } | ||
DrawerChild.defaultProps = { | ||
switchScrollingEffect: function switchScrollingEffect() {} | ||
}; | ||
export default DrawerChild; |
@@ -0,1 +1,2 @@ | ||
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
@@ -5,9 +6,3 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
import _inherits from "@babel/runtime/helpers/esm/inherits"; | ||
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn"; | ||
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf"; | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
import _createSuper from "@babel/runtime/helpers/esm/createSuper"; | ||
import Portal from "rc-util/es/PortalWrapper"; | ||
@@ -92,3 +87,3 @@ import * as React from 'react'; | ||
if (!getContainer) { | ||
return React.createElement("div", { | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: wrapperClassName, | ||
@@ -98,3 +93,3 @@ ref: function ref(c) { | ||
} | ||
}, React.createElement(Child, Object.assign({}, props, { | ||
}, /*#__PURE__*/React.createElement(Child, _extends({}, props, { | ||
open: open, | ||
@@ -112,3 +107,3 @@ handler: handler, | ||
var $forceRender = !!handler || forceRender; | ||
return React.createElement(Portal, { | ||
return /*#__PURE__*/React.createElement(Portal, { | ||
visible: open, | ||
@@ -123,4 +118,6 @@ forceRender: $forceRender, | ||
return (// react 15,componentWillUnmount 时 Portal 返回 afterClose, visible. | ||
React.createElement(Child, Object.assign({}, props, rest, { | ||
return ( | ||
/*#__PURE__*/ | ||
// react 15,componentWillUnmount 时 Portal 返回 afterClose, visible. | ||
React.createElement(Child, _extends({}, props, rest, { | ||
open: visible !== undefined ? visible : open, | ||
@@ -164,5 +161,5 @@ afterVisibleChange: afterClose !== undefined ? afterClose : props.afterVisibleChange, | ||
afterVisibleChange: function afterVisibleChange() {}, | ||
handler: React.createElement("div", { | ||
handler: /*#__PURE__*/React.createElement("div", { | ||
className: "drawer-handle" | ||
}, React.createElement("i", { | ||
}, /*#__PURE__*/React.createElement("i", { | ||
className: "drawer-handle-icon" | ||
@@ -169,0 +166,0 @@ })), |
@@ -0,5 +1,6 @@ | ||
import { GetContainer } from 'rc-util/lib/PortalWrapper'; | ||
import * as React from 'react'; | ||
import ScrollLocker from 'rc-util/lib/Dom/scrollLocker'; | ||
export declare type IPlacement = 'left' | 'top' | 'right' | 'bottom'; | ||
declare type ILevelMove = number | [number, number]; | ||
declare type IStringOrHtmlElement = string | HTMLElement; | ||
declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
@@ -24,6 +25,6 @@ interface IProps extends Omit<React.HTMLAttributes<any>, 'onChange'> { | ||
maskStyle?: React.CSSProperties; | ||
onChange?: ((open?: boolean) => void); | ||
afterVisibleChange?: ((open: boolean) => void); | ||
onHandleClick?: ((e: React.MouseEvent | React.KeyboardEvent) => void); | ||
onClose?: ((e: React.MouseEvent | React.KeyboardEvent) => void); | ||
onChange?: (open?: boolean) => void; | ||
afterVisibleChange?: (open: boolean) => void; | ||
onHandleClick?: (e: React.MouseEvent | React.KeyboardEvent) => void; | ||
onClose?: (e: React.MouseEvent | React.KeyboardEvent) => void; | ||
keyboard?: boolean; | ||
@@ -34,3 +35,3 @@ } | ||
forceRender?: boolean; | ||
getContainer?: IStringOrHtmlElement | (() => IStringOrHtmlElement) | null | false; | ||
getContainer?: GetContainer; | ||
} | ||
@@ -40,4 +41,4 @@ export interface IDrawerChildProps extends IProps { | ||
getOpenCount?: () => number; | ||
switchScrollingEffect?: (close?: boolean) => void; | ||
scrollLocker?: ScrollLocker; | ||
} | ||
export {}; |
@@ -8,5 +8,2 @@ import * as React from 'react'; | ||
declare class DrawerChild extends React.Component<IDrawerChildProps, IState> { | ||
static defaultProps: { | ||
switchScrollingEffect: () => void; | ||
}; | ||
static getDerivedStateFromProps(props: IDrawerChildProps, { prevProps, _self }: { | ||
@@ -13,0 +10,0 @@ prevProps: IDrawerChildProps; |
@@ -12,2 +12,4 @@ "use strict"; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -25,6 +27,4 @@ | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _classnames2 = _interopRequireDefault(require("classnames")); | ||
@@ -40,6 +40,2 @@ | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
var currentDrawer = {}; | ||
@@ -50,3 +46,3 @@ | ||
var _super = _createSuper(DrawerChild); | ||
var _super = (0, _createSuper2.default)(DrawerChild); | ||
@@ -249,11 +245,3 @@ function DrawerChild(props) { | ||
duration = _this$props5.duration, | ||
ease = _this$props5.ease, | ||
getOpenCount = _this$props5.getOpenCount, | ||
switchScrollingEffect = _this$props5.switchScrollingEffect; | ||
var openCount = getOpenCount && getOpenCount(); | ||
if (openCount === 1) { | ||
switchScrollingEffect(); | ||
} | ||
ease = _this$props5.ease; | ||
var widthTransition = "width ".concat(duration, " ").concat(ease); | ||
@@ -292,11 +280,4 @@ var transformTransition = "transform ".concat(duration, " ").concat(ease); | ||
duration = _this$props6.duration, | ||
ease = _this$props6.ease, | ||
getOpenCount = _this$props6.getOpenCount, | ||
switchScrollingEffect = _this$props6.switchScrollingEffect; | ||
var openCount = getOpenCount && getOpenCount(); | ||
ease = _this$props6.ease; | ||
if (!openCount) { | ||
switchScrollingEffect(true); | ||
} | ||
if (_utils.transitionStr) { | ||
@@ -438,2 +419,4 @@ document.body.style.overflowX = 'hidden'; | ||
if (open) { | ||
var _this$props$scrollLoc; | ||
if (container && container.parentNode === document.body) { | ||
@@ -448,2 +431,3 @@ currentDrawer[this.drawerId] = open; | ||
}); | ||
(_this$props$scrollLoc = this.props.scrollLocker) === null || _this$props$scrollLoc === void 0 ? void 0 : _this$props$scrollLoc.lock(); | ||
} | ||
@@ -456,10 +440,7 @@ } | ||
open = _this$props8.open, | ||
getContainer = _this$props8.getContainer; | ||
getContainer = _this$props8.getContainer, | ||
scrollLocker = _this$props8.scrollLocker; | ||
var container = getContainer && getContainer(); | ||
if (open !== prevProps.open) { | ||
if (open) { | ||
this.domFocus(); | ||
} | ||
if (container && container.parentNode === document.body) { | ||
@@ -470,2 +451,9 @@ currentDrawer[this.drawerId] = !!open; | ||
this.openLevelTransition(); | ||
if (open) { | ||
this.domFocus(); | ||
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.lock(); | ||
} else { | ||
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.unLock(); | ||
} | ||
} | ||
@@ -477,6 +465,4 @@ } | ||
var _this$props9 = this.props, | ||
getOpenCount = _this$props9.getOpenCount, | ||
open = _this$props9.open, | ||
switchScrollingEffect = _this$props9.switchScrollingEffect; | ||
var openCount = typeof getOpenCount === 'function' && getOpenCount(); | ||
scrollLocker = _this$props9.scrollLocker; | ||
delete currentDrawer[this.drawerId]; | ||
@@ -489,6 +475,3 @@ | ||
if (!openCount) { | ||
document.body.style.overflow = ''; | ||
switchScrollingEffect(true); | ||
} | ||
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.unLock(); | ||
} // tslint:disable-next-line:member-ordering | ||
@@ -527,4 +510,4 @@ | ||
getOpenCount = _this$props10.getOpenCount, | ||
switchScrollingEffect = _this$props10.switchScrollingEffect, | ||
props = (0, _objectWithoutProperties2.default)(_this$props10, ["className", "children", "style", "width", "height", "defaultOpen", "open", "prefixCls", "placement", "level", "levelMove", "ease", "duration", "getContainer", "handler", "onChange", "afterVisibleChange", "showMask", "maskClosable", "maskStyle", "onClose", "onHandleClick", "keyboard", "getOpenCount", "switchScrollingEffect"]); // 首次渲染都将是关闭状态。 | ||
scrollLocker = _this$props10.scrollLocker, | ||
props = (0, _objectWithoutProperties2.default)(_this$props10, ["className", "children", "style", "width", "height", "defaultOpen", "open", "prefixCls", "placement", "level", "levelMove", "ease", "duration", "getContainer", "handler", "onChange", "afterVisibleChange", "showMask", "maskClosable", "maskStyle", "onClose", "onHandleClick", "keyboard", "getOpenCount", "scrollLocker"]); // 首次渲染都将是关闭状态。 | ||
@@ -541,3 +524,3 @@ var open = this.dom ? $open : false; | ||
var transform = open ? '' : "".concat(placementName, "(").concat(placementPos, ")"); | ||
var handlerChildren = handler && React.cloneElement(handler, { | ||
var handlerChildren = handler && /*#__PURE__*/React.cloneElement(handler, { | ||
onClick: function onClick(e) { | ||
@@ -556,3 +539,3 @@ if (handler.props.onClick) { | ||
}); | ||
return React.createElement("div", Object.assign({}, props, { | ||
return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({}, props, { | ||
tabIndex: -1, | ||
@@ -566,3 +549,3 @@ className: wrapperClassName, | ||
onTransitionEnd: this.onWrapperTransitionEnd | ||
}), showMask && React.createElement("div", { | ||
}), showMask && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-mask"), | ||
@@ -574,3 +557,3 @@ onClick: maskClosable ? onClose : undefined, | ||
} | ||
}), React.createElement("div", { | ||
}), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-content-wrapper"), | ||
@@ -586,3 +569,3 @@ style: { | ||
} | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-content"), | ||
@@ -592,4 +575,6 @@ ref: function ref(c) { | ||
}, | ||
onTouchStart: open && showMask ? this.removeStartHandler : undefined, | ||
onTouchMove: open && showMask ? this.removeMoveHandler : undefined | ||
onTouchStart: open && showMask ? this.removeStartHandler : undefined // 跑用例用 | ||
, | ||
onTouchMove: open && showMask ? this.removeMoveHandler : undefined // 跑用例用 | ||
}, children), handlerChildren)); | ||
@@ -626,6 +611,3 @@ } | ||
DrawerChild.defaultProps = { | ||
switchScrollingEffect: function switchScrollingEffect() {} | ||
}; | ||
var _default = DrawerChild; | ||
exports.default = _default; |
@@ -12,2 +12,4 @@ "use strict"; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
@@ -21,6 +23,4 @@ | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _PortalWrapper = _interopRequireDefault(require("rc-util/lib/PortalWrapper")); | ||
@@ -32,10 +32,6 @@ | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
var DrawerWrapper = /*#__PURE__*/function (_React$Component) { | ||
(0, _inherits2.default)(DrawerWrapper, _React$Component); | ||
var _super = _createSuper(DrawerWrapper); | ||
var _super = (0, _createSuper2.default)(DrawerWrapper); | ||
@@ -110,3 +106,3 @@ function DrawerWrapper(props) { | ||
if (!getContainer) { | ||
return React.createElement("div", { | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: wrapperClassName, | ||
@@ -116,3 +112,3 @@ ref: function ref(c) { | ||
} | ||
}, React.createElement(_DrawerChild.default, Object.assign({}, props, { | ||
}, /*#__PURE__*/React.createElement(_DrawerChild.default, (0, _extends2.default)({}, props, { | ||
open: open, | ||
@@ -130,3 +126,3 @@ handler: handler, | ||
var $forceRender = !!handler || forceRender; | ||
return React.createElement(_PortalWrapper.default, { | ||
return /*#__PURE__*/React.createElement(_PortalWrapper.default, { | ||
visible: open, | ||
@@ -140,4 +136,6 @@ forceRender: $forceRender, | ||
rest = (0, _objectWithoutProperties2.default)(_ref, ["visible", "afterClose"]); | ||
return (// react 15,componentWillUnmount 时 Portal 返回 afterClose, visible. | ||
React.createElement(_DrawerChild.default, Object.assign({}, props, rest, { | ||
return ( | ||
/*#__PURE__*/ | ||
// react 15,componentWillUnmount 时 Portal 返回 afterClose, visible. | ||
React.createElement(_DrawerChild.default, (0, _extends2.default)({}, props, rest, { | ||
open: visible !== undefined ? visible : open, | ||
@@ -180,5 +178,5 @@ afterVisibleChange: afterClose !== undefined ? afterClose : props.afterVisibleChange, | ||
afterVisibleChange: function afterVisibleChange() {}, | ||
handler: React.createElement("div", { | ||
handler: /*#__PURE__*/React.createElement("div", { | ||
className: "drawer-handle" | ||
}, React.createElement("i", { | ||
}, /*#__PURE__*/React.createElement("i", { | ||
className: "drawer-handle-icon" | ||
@@ -185,0 +183,0 @@ })), |
@@ -0,5 +1,6 @@ | ||
import { GetContainer } from 'rc-util/lib/PortalWrapper'; | ||
import * as React from 'react'; | ||
import ScrollLocker from 'rc-util/lib/Dom/scrollLocker'; | ||
export declare type IPlacement = 'left' | 'top' | 'right' | 'bottom'; | ||
declare type ILevelMove = number | [number, number]; | ||
declare type IStringOrHtmlElement = string | HTMLElement; | ||
declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
@@ -24,6 +25,6 @@ interface IProps extends Omit<React.HTMLAttributes<any>, 'onChange'> { | ||
maskStyle?: React.CSSProperties; | ||
onChange?: ((open?: boolean) => void); | ||
afterVisibleChange?: ((open: boolean) => void); | ||
onHandleClick?: ((e: React.MouseEvent | React.KeyboardEvent) => void); | ||
onClose?: ((e: React.MouseEvent | React.KeyboardEvent) => void); | ||
onChange?: (open?: boolean) => void; | ||
afterVisibleChange?: (open: boolean) => void; | ||
onHandleClick?: (e: React.MouseEvent | React.KeyboardEvent) => void; | ||
onClose?: (e: React.MouseEvent | React.KeyboardEvent) => void; | ||
keyboard?: boolean; | ||
@@ -34,3 +35,3 @@ } | ||
forceRender?: boolean; | ||
getContainer?: IStringOrHtmlElement | (() => IStringOrHtmlElement) | null | false; | ||
getContainer?: GetContainer; | ||
} | ||
@@ -40,4 +41,4 @@ export interface IDrawerChildProps extends IProps { | ||
getOpenCount?: () => number; | ||
switchScrollingEffect?: (close?: boolean) => void; | ||
scrollLocker?: ScrollLocker; | ||
} | ||
export {}; |
@@ -1,1 +0,5 @@ | ||
"use strict"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); |
{ | ||
"name": "rc-drawer", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "drawer component for react", | ||
@@ -44,3 +44,4 @@ "keywords": [ | ||
"peerDependencies": { | ||
"react": "*" | ||
"react": ">=16.9.0", | ||
"react-dom": ">=16.9.0" | ||
}, | ||
@@ -50,3 +51,3 @@ "devDependencies": { | ||
"@types/enzyme": "^3.1.15", | ||
"@types/jest": "^25.1.0", | ||
"@types/jest": "^26.0.0", | ||
"@types/raf": "^3.4.0", | ||
@@ -70,3 +71,3 @@ "@types/react": "^16.9.5", | ||
"react-test-renderer": "^16.10.2", | ||
"typescript": "^3.9.3" | ||
"typescript": "^4.0.3" | ||
}, | ||
@@ -76,4 +77,4 @@ "dependencies": { | ||
"classnames": "^2.2.6", | ||
"rc-util": "^5.0.1" | ||
"rc-util": "^5.6.2" | ||
} | ||
} |
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
80018
5
1886
Updatedrc-util@^5.6.2