UNPKG

zp-bee

Version:

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

37 lines (33 loc) 1.51 kB
import * as React from 'react'; import defaultRenderEmpty from './renderEmpty'; var defaultGetPrefixCls = function defaultGetPrefixCls(suffixCls, customizePrefixCls) { if (customizePrefixCls) return customizePrefixCls; return suffixCls ? "bee-".concat(suffixCls) : 'bee'; }; export var ConfigContext = /*#__PURE__*/React.createContext({ // We provide a default function for Context without provider getPrefixCls: defaultGetPrefixCls, renderEmpty: defaultRenderEmpty }); export var ConfigConsumer = ConfigContext.Consumer; /** @deprecated Use hooks instead. This is a legacy function */ export function withConfigConsumer(config) { return function withConfigConsumerFunc(Component) { // Wrap with ConfigConsumer. Since we need compatible with react 15, be care when using ref methods var SFC = function SFC(props) { return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (configProps) { var basicPrefixCls = config.prefixCls; var getPrefixCls = configProps.getPrefixCls; var customizePrefixCls = props.prefixCls; var prefixCls = getPrefixCls(basicPrefixCls, customizePrefixCls); return /*#__PURE__*/React.createElement(Component, Object.assign({}, configProps, props, { prefixCls: prefixCls })); }); }; var cons = Component.constructor; var name = cons && cons.displayName || Component.name || 'Component'; SFC.displayName = "withConfigConsumer(".concat(name, ")"); return SFC; }; }