import React from 'react';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/es/locale/zh_CN';
import zh from "../locale/zh";
// 默认配置
export var defaultConfig = {
  prefixCls: 'ehr-ui',
  iconPrefixCls: 'anticon',
  locale: zhCN,
  uiLocale: zh
};
export var ConfigContext = /*#__PURE__*/React.createContext(defaultConfig);

// 组件库组件都需要此高阶函数包裹一层，使全局配置的参数能传递到antd ConfigProvider组件
export var ConfigHoc = function ConfigHoc(Component) {
  return function (props) {
    return /*#__PURE__*/React.createElement(ConfigContext.Consumer, null, function (value) {
      console.log('ConfigContext.Consumer', value);
      return /*#__PURE__*/React.createElement(ConfigProvider, value, /*#__PURE__*/React.createElement(Component, props));
    });
  };
};
export var ConfigConsumer = ConfigContext.Consumer;