amis-rpc-design/node_modules/rc-drawer/lib/DrawerPanel.js
2023-10-07 19:42:30 +08:00

57 lines
3.1 KiB
JavaScript

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _classnames = _interopRequireDefault(require("classnames"));
var _rcUtil = require("rc-util");
var React = _interopRequireWildcard(require("react"));
var _context = require("./context");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
var DrawerPanel = function DrawerPanel(props) {
var prefixCls = props.prefixCls,
className = props.className,
style = props.style,
children = props.children,
containerRef = props.containerRef,
id = props.id,
onMouseEnter = props.onMouseEnter,
onMouseOver = props.onMouseOver,
onMouseLeave = props.onMouseLeave,
onClick = props.onClick,
onKeyDown = props.onKeyDown,
onKeyUp = props.onKeyUp;
var eventHandlers = {
onMouseEnter: onMouseEnter,
onMouseOver: onMouseOver,
onMouseLeave: onMouseLeave,
onClick: onClick,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp
};
var _React$useContext = React.useContext(_context.RefContext),
panelRef = _React$useContext.panel;
var mergedRef = (0, _rcUtil.useComposeRef)(panelRef, containerRef);
// =============================== Render ===============================
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
id: id,
className: (0, _classnames.default)("".concat(prefixCls, "-content"), className),
style: (0, _objectSpread2.default)({}, style),
"aria-modal": "true",
role: "dialog",
ref: mergedRef
}, eventHandlers), children));
};
if (process.env.NODE_ENV !== 'production') {
DrawerPanel.displayName = 'DrawerPanel';
}
var _default = DrawerPanel;
exports.default = _default;