import { ref, onMounted, watch, createElementBlock, createCommentVNode, openBlock, createElementVNode, normalizeClass, toDisplayString, nextTick } from "vue";
/* empty css                  */
import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
const _hoisted_1 = {
  key: 0,
  class: "app-content"
};
const _sfc_main = {
  __name: "ApproveIdea",
  props: {
    approveDesc: {
      type: String,
      default: ""
    },
    uniqueKey: {
      type: String,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    const ideaRef = ref(null);
    const isExpanded = ref(false);
    const isOverflow = ref(true);
    const checkOverflow = () => {
      if (!ideaRef.value) return;
      nextTick(() => {
        isOverflow.value = ideaRef.value.scrollHeight > ideaRef.value.offsetHeight;
      });
    };
    const toggle = () => {
      isExpanded.value = !isExpanded.value;
    };
    onMounted(() => {
      checkOverflow();
    });
    watch(
      () => props.approveDesc,
      () => {
        isExpanded.value = false;
        checkOverflow();
      }
    );
    return (_ctx, _cache) => {
      return __props.approveDesc ? (openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("div", {
          class: normalizeClass(["approveIdea", { "is-expanded": isExpanded.value || !isOverflow.value }]),
          ref: (el) => {
            if (el) ideaRef.value = el;
          }
        }, toDisplayString(__props.approveDesc), 3),
        isOverflow.value ? (openBlock(), createElementBlock("div", {
          key: 0,
          class: "approve-toggle",
          onClick: toggle
        }, toDisplayString(isExpanded.value ? "收起" : "展开"), 1)) : createCommentVNode("", true)
      ])) : createCommentVNode("", true);
    };
  }
};
const ApproveIdea = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-95cdb22f"]]);
export {
  ApproveIdea as default
};
