var _excluded = ["type", "extendType"];
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React, { useContext, forwardRef } from 'react';
import { FanContext } from "../../ConfigContext";
var ExtensionField = /*#__PURE__*/forwardRef(function (props, ref) {
  var InitFanContext = useContext(FanContext);
  var providerConfig = InitFanContext['Field'] || {}; // 使用上下文（全局配置）设置扩展的配置项
  var type = props.type,
    extendType = props.extendType,
    fieldProps = _objectWithoutProperties(props, _excluded);
  var MatchType = ((providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.extendComponents) || []).find(function (tItem) {
    return tItem.extendType === extendType;
  });
  var MatchTypeComponent = (MatchType === null || MatchType === void 0 ? void 0 : MatchType.component) || null;
  return typeof MatchTypeComponent === 'function' ? /*#__PURE__*/React.createElement(MatchTypeComponent, fieldProps) : MatchTypeComponent;
});
export default /*#__PURE__*/React.memo(ExtensionField);