import { defineComponent, reactive, markRaw, defineAsyncComponent, ref, computed, watchEffect, openBlock, createElementBlock, unref, createElementVNode, toDisplayString, createCommentVNode, Fragment, renderList, withDirectives, normalizeStyle, createBlock, resolveDynamicComponent, mergeProps, vShow } from "vue";
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1 = {
  class: "business-opportunity-card",
  "data-weiling-mobile-ui-bc-business-card": ""
};
const _hoisted_2 = {
  key: 0,
  class: "tag"
};
const _hoisted_3 = { class: "field" };
const _hoisted_4 = { class: "field-label" };
const __default__ = {
  name: "BCBusinessCard"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    data: { default: null },
    keyword: { default: "" },
    list: { default: () => [
      {
        id: 1,
        type: "DefaultText",
        key: "name",
        label: "\u5546\u673A\u540D\u79F0"
      },
      {
        id: 3,
        type: "SelectStage",
        key: "stage",
        label: "\u5546\u673A\u9636\u6BB5"
      },
      {
        id: 2,
        type: "WlUser",
        key: "owner",
        label: "\u5F52\u5C5E\u4EBA"
      }
    ] }
  },
  setup(__props) {
    const props = __props;
    const currentComponent = reactive({
      DefaultText: markRaw(
        defineAsyncComponent(() => import("./index2.js"))
      ),
      SelectStage: markRaw(
        defineAsyncComponent(() => import("./index3.js"))
      ),
      DefaultInput: markRaw(
        defineAsyncComponent(() => import("./index5.js"))
      ),
      WlUser: markRaw(
        defineAsyncComponent(
          () => import("./index6.js")
        )
      )
    });
    const formData = ref();
    const info_style = computed(() => {
      return (item) => {
        const { type = "" } = item;
        const { input_edit = false } = formData.value;
        return { overflow: type === "Input" && input_edit ? "inherit" : "hidden" };
      };
    });
    const item_show = computed(() => {
      return (key) => {
        const { hidden = {} } = formData.value;
        return !hidden[key];
      };
    });
    const tag_show = computed(() => {
      const { tagShow = null, input_edit = false } = formData.value;
      return tagShow === null ? !input_edit : tagShow;
    });
    watchEffect(() => {
      formData.value = props.data;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        __props.data["tag"] && unref(tag_show) ? (openBlock(), createElementBlock("div", _hoisted_2, [
          createElementVNode("p", null, toDisplayString(__props.data.tag), 1)
        ])) : createCommentVNode("", true),
        (openBlock(true), createElementBlock(Fragment, null, renderList(__props.list, (item) => {
          return withDirectives((openBlock(), createElementBlock("div", {
            class: "field-wrap",
            key: item.id
          }, [
            createElementVNode("div", _hoisted_3, [
              createElementVNode("p", _hoisted_4, toDisplayString(item.label), 1),
              createElementVNode("div", {
                class: "field-content",
                style: normalizeStyle(unref(info_style)(item))
              }, [
                (openBlock(), createBlock(resolveDynamicComponent(currentComponent[item.type]), mergeProps(Object.assign(item, _ctx.$attrs), {
                  data: item.type === "WlUser" ? __props.data[item.key] : __props.data,
                  modelValue: formData.value[item.key],
                  "onUpdate:modelValue": ($event) => formData.value[item.key] = $event,
                  effect: "needMasker"
                }), null, 16, ["data", "modelValue", "onUpdate:modelValue"]))
              ], 4)
            ])
          ])), [
            [vShow, unref(item_show)(item.key)]
          ]);
        }), 128))
      ]);
    };
  }
});
var __uno = "";
_sfc_main.install = (app) => {
  app.component(_sfc_main.name, _sfc_main);
};
export { _sfc_main as default };
