'use strict';

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

var vue = require('vue');
require('../../../utils/index.cjs');
var index = require('../../grid/index.cjs');
var ErrorList = require('./ErrorList.cjs');
var context = require('./context.cjs');
var props = require('../../../utils/vue/props.cjs');
var _class = require('../../../utils/dom/class.cjs');

var FormItemInput = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "FormItemInput",
  slots: Object,
  inheritAttrs: false,
  props: ["prefixCls", "errors", "hasFeedback", "onDomErrorVisibleChange", "wrapperCol", "help", "extra", "status", "marginBottom", "onErrorVisibleChanged"],
  setup(props$1, {
    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$1.prefixCls),
      status: vue.computed(() => props$1.status)
    });
    return () => {
      var _a, _b, _c;
      const {
        prefixCls,
        wrapperCol,
        marginBottom,
        onErrorVisibleChanged,
        help = (_a = slots.help) == null ? void 0 : _a.call(slots),
        errors = props.filterEmpty((_b = slots.errors) == null ? void 0 : _b.call(slots)),
        // hasFeedback,
        // status,
        extra = (_c = slots.extra) == null ? void 0 : _c.call(slots)
      } = props$1;
      const baseClassName = `${prefixCls}-item`;
      const mergedWrapperCol = wrapperCol || (contextWrapperCol == null ? void 0 : contextWrapperCol.value) || {};
      const className = _class.classNames(`${baseClassName}-control`, mergedWrapperCol.class);
      return vue.createVNode(index.Col, {
        ...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.cjs.map
