rc-dropdown
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -6,2 +6,3 @@ import * as React from 'react'; | ||
minOverlayWidthMatchTrigger?: boolean; | ||
arrow?: boolean; | ||
onVisibleChange?: (visible: boolean) => void; | ||
@@ -8,0 +9,0 @@ onOverlayClick?: (e: Event) => void; |
@@ -1,7 +0,11 @@ | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
@@ -19,3 +23,5 @@ | ||
function Dropdown(props, ref) { | ||
var _props$prefixCls = props.prefixCls, | ||
var _props$arrow = props.arrow, | ||
arrow = _props$arrow === void 0 ? false : _props$arrow, | ||
_props$prefixCls = props.prefixCls, | ||
prefixCls = _props$prefixCls === void 0 ? 'rc-dropdown' : _props$prefixCls, | ||
@@ -37,3 +43,3 @@ transitionName = props.transitionName, | ||
trigger = _props$trigger === void 0 ? ['hover'] : _props$trigger, | ||
otherProps = _objectWithoutProperties(props, ["prefixCls", "transitionName", "animation", "align", "placement", "placements", "getPopupContainer", "showAction", "hideAction", "overlayClassName", "overlayStyle", "visible", "trigger"]); | ||
otherProps = _objectWithoutProperties(props, ["arrow", "prefixCls", "transitionName", "animation", "align", "placement", "placements", "getPopupContainer", "showAction", "hideAction", "overlayClassName", "overlayStyle", "visible", "trigger"]); | ||
@@ -98,3 +104,5 @@ var _React$useState = React.useState(), | ||
return React.cloneElement(overlayElement, extraOverlayProps); | ||
return React.createElement(React.Fragment, null, React.createElement("div", { | ||
className: "".concat(prefixCls, "-arrow") | ||
}), React.cloneElement(overlayElement, extraOverlayProps)); | ||
}; | ||
@@ -148,6 +156,7 @@ | ||
var overlayClass = arrow ? "".concat(overlayClassName || '', " ").concat(prefixCls, "-show-arrow") : "".concat(overlayClassName || ''); | ||
return React.createElement(Trigger, Object.assign({}, otherProps, { | ||
prefixCls: prefixCls, | ||
ref: triggerRef, | ||
popupClassName: overlayClassName, | ||
popupClassName: overlayClass, | ||
popupStyle: overlayStyle, | ||
@@ -154,0 +163,0 @@ builtinPlacements: placements, |
@@ -6,2 +6,3 @@ import * as React from 'react'; | ||
minOverlayWidthMatchTrigger?: boolean; | ||
arrow?: boolean; | ||
onVisibleChange?: (visible: boolean) => void; | ||
@@ -8,0 +9,0 @@ onOverlayClick?: (e: Event) => void; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -20,10 +22,14 @@ value: true | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
@@ -36,3 +42,5 @@ | ||
function Dropdown(props, ref) { | ||
var _props$prefixCls = props.prefixCls, | ||
var _props$arrow = props.arrow, | ||
arrow = _props$arrow === void 0 ? false : _props$arrow, | ||
_props$prefixCls = props.prefixCls, | ||
prefixCls = _props$prefixCls === void 0 ? 'rc-dropdown' : _props$prefixCls, | ||
@@ -54,3 +62,3 @@ transitionName = props.transitionName, | ||
trigger = _props$trigger === void 0 ? ['hover'] : _props$trigger, | ||
otherProps = _objectWithoutProperties(props, ["prefixCls", "transitionName", "animation", "align", "placement", "placements", "getPopupContainer", "showAction", "hideAction", "overlayClassName", "overlayStyle", "visible", "trigger"]); | ||
otherProps = _objectWithoutProperties(props, ["arrow", "prefixCls", "transitionName", "animation", "align", "placement", "placements", "getPopupContainer", "showAction", "hideAction", "overlayClassName", "overlayStyle", "visible", "trigger"]); | ||
@@ -115,3 +123,5 @@ var _React$useState = React.useState(), | ||
return React.cloneElement(overlayElement, extraOverlayProps); | ||
return React.createElement(React.Fragment, null, React.createElement("div", { | ||
className: "".concat(prefixCls, "-arrow") | ||
}), React.cloneElement(overlayElement, extraOverlayProps)); | ||
}; | ||
@@ -165,6 +175,7 @@ | ||
var overlayClass = arrow ? "".concat(overlayClassName || '', " ").concat(prefixCls, "-show-arrow") : "".concat(overlayClassName || ''); | ||
return React.createElement(_rcTrigger.default, Object.assign({}, otherProps, { | ||
prefixCls: prefixCls, | ||
ref: triggerRef, | ||
popupClassName: overlayClassName, | ||
popupClassName: overlayClass, | ||
popupStyle: overlayStyle, | ||
@@ -171,0 +182,0 @@ builtinPlacements: placements, |
{ | ||
"name": "rc-dropdown", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "dropdown ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -124,2 +124,8 @@ # rc-dropdown | ||
</tr> | ||
<tr> | ||
<td>getPopupContainer</td> | ||
<td>Function(menuDOMNode): HTMLElement</td> | ||
<th>() => document.body</th> | ||
<td>Where to render the DOM node of dropdown</td> | ||
</tr> | ||
</tbody> | ||
@@ -126,0 +132,0 @@ </table> |
Sorry, the diff of this file is not supported yet
39094
814
161