'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var index = require('../_util/props-util/index.js');
var classNames = require('../_util/classNames.js');
var Col = require('../grid/Col.js');
var ErrorList = require('./ErrorList.js');
var context = require('./context.js');

const FormItemInput = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  slots: Object,
  inheritAttrs: false,
  props: ["prefixCls", "errors", "hasFeedback", "onDomErrorVisibleChange", "wrapperCol", "help", "extra", "status", "marginBottom", "onErrorVisibleChanged"],
  setup(props, {
    slots
  }) {
    const formContext = context.useInjectForm();
    const {
      wrapperCol: contextWrapperCol
    } = formContext;
    const subFormContext = {
      ...formContext
    };
    delete subFormContext.labelCol;
    delete subFormContext.wrapperCol;
    context.useProvideForm(subFormContext);
    context.useProvideFormItemPrefix({
      prefixCls: vue.computed(() => props.prefixCls),
      status: vue.computed(() => props.status)
    });
    return () => {
      var _a, _b, _c;
      const {
        prefixCls,
        wrapperCol,
        marginBottom,
        onErrorVisibleChanged,
        help = (_a = slots.help) == null ? void 0 : _a.call(slots),
        errors = index.filterEmpty((_b = slots.errors) == null ? void 0 : _b.call(slots)),
        // hasFeedback,
        // status,
        extra = (_c = slots.extra) == null ? void 0 : _c.call(slots)
      } = props;
      const baseClassName = `${prefixCls}-item`;
      const mergedWrapperCol = wrapperCol || (contextWrapperCol == null ? void 0 : contextWrapperCol.value) || {};
      const className = classNames.default(`${baseClassName}-control`, mergedWrapperCol.class);
      return vue.createVNode(Col.default, vue.mergeProps(mergedWrapperCol, {
        "class": className
      }), {
        default: () => {
          var _a2;
          return vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
            "class": `${baseClassName}-control-input`
          }, [vue.createVNode("div", {
            "class": `${baseClassName}-control-input-content`
          }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])]), marginBottom !== null || errors.length ? vue.createVNode("div", {
            "style": {
              display: "flex",
              flexWrap: "nowrap"
            }
          }, [vue.createVNode(ErrorList.default, {
            "errors": errors,
            "help": help,
            "class": `${baseClassName}-explain-connected`,
            "onErrorVisibleChanged": onErrorVisibleChanged
          }, null), !!marginBottom && vue.createVNode("div", {
            "style": {
              width: 0,
              height: `${marginBottom}px`
            }
          }, null)]) : null, extra ? vue.createVNode("div", {
            "class": `${baseClassName}-extra`
          }, [extra]) : null]);
        }
      });
    };
  }
});

exports.default = FormItemInput;
//# sourceMappingURL=FormItemInput.js.map
