import w from "../../ci-no-data-status/index.vue.js";
import { defineComponent as $, ref as t, onMounted as q, nextTick as H, onBeforeUnmount as z, createElementBlock as r, openBlock as u, createCommentVNode as f, createElementVNode as E, renderSlot as c, normalizeClass as N, createVNode as A } from "vue";
const B = { class: "CiCommonListLayout" }, O = {
  name: "CiCommonListLayout",
  inheritAttrs: !1
}, T = /* @__PURE__ */ $({
  ...O,
  setup(V) {
    const d = t(null), o = t(null), y = t(null), h = t(null), m = t(null), C = t(!1), v = t(!1), g = t(0), p = t(0), L = t(0), _ = t(0), k = t(0), l = () => {
      H(() => {
        var e, n, s, a, i;
        g.value = ((n = (e = h.value) == null ? void 0 : e.parentElement) == null ? void 0 : n.offsetHeight) || window.innerHeight, p.value = ((s = d.value) == null ? void 0 : s.offsetHeight) || 0, L.value = ((a = o.value) == null ? void 0 : a.offsetHeight) || 0, _.value = ((i = y.value) == null ? void 0 : i.offsetHeight) || 0, k.value = g.value - (p.value + L.value + _.value + 40);
      });
    }, b = () => {
      o.value && (m.value = new ResizeObserver(() => {
        l();
      }), m.value.observe(o.value));
    }, Q = () => {
      if (o.value) {
        const e = Array.from(o.value.children);
        console.log("查询区域所有一级子元素:", e), C.value = e.some(
          (n) => n.classList.contains("CiCommonListQuery")
        ), console.log(
          "查询区域所有一级子元素内是否包含类名 CiCommonListQuery:",
          C.value
        );
      }
    }, R = () => {
      var e, n, s;
      if (o.value) {
        const a = Array.from(o.value.children), i = a[a.length - 1];
        v.value = i ? ((s = (n = (e = i.__vnode) == null ? void 0 : e.ctx) == null ? void 0 : n.type) == null ? void 0 : s.name) === "CiCommonListQuery" : !1, console.log(
          "查询区域最后一个一级子元素是否是 CiCommonListQuery 组件:",
          v.value
        );
      }
    };
    return q(() => {
      l(), window.addEventListener("resize", l), b(), H(() => {
        Q(), R();
      });
    }), z(() => {
      var e;
      window.removeEventListener("resize", l), (e = m.value) == null || e.disconnect();
    }), (e, n) => {
      const s = w;
      return u(), r("div", B, [
        e.$slots.actions ? (u(), r("div", {
          key: 0,
          ref_key: "actionsRef",
          ref: d,
          class: "area-actions"
        }, [
          c(e.$slots, "actions", {}, void 0, !0)
        ], 512)) : f("", !0),
        e.$slots.query ? (u(), r("div", {
          key: 1,
          ref_key: "queryRef",
          ref: o,
          class: N(["area-query", { hasLastComponentIsCommonListQuery: v.value }])
        }, [
          c(e.$slots, "query", {}, void 0, !0)
        ], 2)) : f("", !0),
        E("div", {
          class: "area-table",
          ref_key: "tableRef",
          ref: h
        }, [
          c(e.$slots, "table", { tableHeight: k.value }, () => [
            A(s)
          ], !0)
        ], 512),
        e.$slots.pagination ? (u(), r("div", {
          key: 2,
          ref_key: "paginationRef",
          ref: y,
          class: "area-pagination"
        }, [
          c(e.$slots, "pagination", {}, void 0, !0)
        ], 512)) : f("", !0)
      ]);
    };
  }
});
export {
  T as default
};
