UNPKG

zp-bee

Version:

zp-bee,是一款基于 Dumi,由 React + TypeScript 开发的组件库 🎉。

46 lines (37 loc) 1.51 kB
var __rest = this && this.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; } if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import React, { useMemo } from 'react'; import { observer } from 'mobx-react-lite'; import classNames from 'classnames'; import AutoWired from './AutoWired'; import { ConfigContext } from '../bee-config'; var Item = function Item(props) { var wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, width = props.width, rest = __rest(props, ["wrapperClassName", "wrapperStyle", "width"]); var newStyle = useMemo(function () { if (width === undefined || width === null) { return wrapperStyle; } return Object.assign(Object.assign({}, wrapperStyle), { width: width }); }, [wrapperStyle, width]); var _React$useContext = React.useContext(ConfigContext), getPrefixCls = _React$useContext.getPrefixCls; var prefixCls = getPrefixCls('form-item'); return /*#__PURE__*/React.createElement("div", { className: classNames(wrapperClassName, prefixCls), style: newStyle }, /*#__PURE__*/React.createElement(AutoWired, Object.assign({}, rest))); }; export default observer(Item);