import { defineComponent, markRaw, defineAsyncComponent, ref, watchEffect, openBlock, createBlock, unref, mergeProps, withCtx, createElementBlock, Fragment, renderList, normalizeStyle, normalizeClass, resolveDynamicComponent, toHandlers, renderSlot, createCommentVNode } from "vue";
import { Form } from "vant";
var employeeSelector = {
  employeeData: null,
  topFiveEmployeeData: null,
  organization: null,
  organization_count: null,
  count: 0,
  dept_list: [],
  company_list: [],
  company_list_count: 0,
  companyEmployeeList: [],
  totalCompanyEmployeeList: [],
  totalCompanyEmployeeObjList: []
};
const Store = {
  sid: "",
  app_id: "",
  user_id: "",
  user_name: "",
  corp_id: "",
  node_env: "",
  domain: "",
  token: "",
  card_resource: "",
  employeeSelector
};
var Store$1 = new Proxy(Store, {
  get(target, name, property) {
    return Reflect.get(target, name, property);
  },
  set(target, name, value, property) {
    return Reflect.set(target, name, value, property);
  }
});
const __default__ = {
  name: "BCRenderFormNew"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    data: { default: () => {
    } },
    columns: { default: () => [] },
    envData: { default: null },
    formItemStyle: { default: null },
    formItemClass: { default: "" }
  },
  setup(__props, { expose }) {
    var _a, _b, _c, _d, _e;
    const props = __props;
    const componentDict = {
      input: markRaw(
        defineAsyncComponent(() => import("./index3.js"))
      ),
      select: markRaw(
        defineAsyncComponent(() => import("./index7.js"))
      ),
      date: markRaw(
        defineAsyncComponent(() => import("./index10.js"))
      ),
      content: markRaw(
        defineAsyncComponent(() => import("./index11.js"))
      ),
      textarea: markRaw(
        defineAsyncComponent(() => import("./index12.js"))
      ),
      picSelect: markRaw(
        defineAsyncComponent(() => import("./index14.js"))
      ),
      mulSelect: markRaw(
        defineAsyncComponent(() => import("./index15.js"))
      ),
      colorSelect: markRaw(
        defineAsyncComponent(() => import("./index16.js"))
      ),
      selectInput: markRaw(
        defineAsyncComponent(() => import("./index17.js"))
      ),
      companySearch: markRaw(
        defineAsyncComponent(
          () => import("./index19.js")
        )
      )
    };
    const componentName = ref(componentDict);
    Store$1.sid = (_a = props.envData) == null ? void 0 : _a.sid;
    Store$1.app_id = (_b = props.envData) == null ? void 0 : _b.app_id;
    Store$1.user_id = (_c = props.envData) == null ? void 0 : _c.user_id;
    Store$1.corp_id = (_d = props.envData) == null ? void 0 : _d.corp_id;
    Store$1.node_env = (_e = props.envData) == null ? void 0 : _e.node_env;
    const formData = ref({});
    const renderFormRef = ref(null);
    watchEffect(() => {
      formData.value = props.data;
    });
    const submit = () => {
      renderFormRef.value.submit();
    };
    expose({
      submit,
      renderFormRef
    });
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Form), mergeProps({
        ref_key: "renderFormRef",
        ref: renderFormRef,
        "scroll-to-error": true,
        "show-error": true
      }, _ctx.$attrs), {
        default: withCtx(() => [
          (openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (item) => {
            var _a2, _b2;
            return openBlock(), createElementBlock("div", {
              key: (_a2 = item.key) != null ? _a2 : item.label,
              style: normalizeStyle(__props.formItemStyle),
              class: normalizeClass(__props.formItemClass)
            }, [
              componentName.value[item.type] ? (openBlock(), createBlock(resolveDynamicComponent(componentName.value[item.type]), mergeProps({
                key: 0,
                item,
                value: formData.value[item.key],
                "onUpdate:value": ($event) => formData.value[item.key] = $event
              }, item, toHandlers((_b2 = item.on) != null ? _b2 : {})), {
                default: withCtx(() => {
                  var _a3;
                  return [
                    ((_a3 = item == null ? void 0 : item.slots) == null ? void 0 : _a3.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(item.slots, (slotName) => {
                      return renderSlot(_ctx.$slots, slotName, mergeProps(__props.data, { key: slotName }));
                    }), 128)) : createCommentVNode("", true)
                  ];
                }),
                _: 2
              }, 1040, ["item", "value", "onUpdate:value"])) : renderSlot(_ctx.$slots, "default", { key: 1 })
            ], 6);
          }), 128))
        ]),
        _: 3
      }, 16);
    };
  }
});
var __uno = "";
_sfc_main.install = (app) => {
  app.component(_sfc_main.name, _sfc_main);
};
export { Store$1 as S, _sfc_main as _ };
