import { defineComponent as S, useCssVars as k, unref as s, toRefs as $, reactive as w, computed as o, onMounted as L, watch as E, openBlock as d, createElementBlock as g, normalizeClass as _, toDisplayString as l, createCommentVNode as c, Fragment as C, renderList as h, normalizeStyle as m, createElementVNode as y, createVNode as Z, mergeProps as z, withCtx as A } from "vue";
import { Vue3SeamlessScroll as O } from "vue3-seamless-scroll";
const j = { class: "seamless_scroll_box" }, q = {
  key: 0,
  class: "order_cloum header_item"
}, M = ["align"], P = {
  key: 0,
  class: "order_cloum"
}, J = ["align"], K = S({ name: "ETableGeneral" }), X = /* @__PURE__ */ S({
  ...K,
  props: {
    chartConfig: {
      type: Object,
      required: !0
    }
  },
  setup(b) {
    const a = b;
    k((r) => ({
      "7e69defd": e.gap[0] + "px",
      "995fcb84": e.gap[1] + "px",
      69309617: e.mergedConfig.tableType == 1 ? e.mergedConfig.headerBGC : "",
      "2c0542cd": e.mergedConfig.tableType == 1 ? e.mergedConfig.borderRadius + "px" : 0,
      "4e31f80a": e.mergedConfig.headerFW,
      "26f5361d": e.mergedConfig.headerFS + "px",
      "4e31f7f6": e.mergedConfig.headerFC,
      "30c4f263": e.mergedConfig.headerHeight + "px",
      "7cdfba25": e.mergedConfig.modelValue ? "hidden" : "auto",
      "7393086c": e.mergedConfig.tableType == 1 && e.mergedConfig.borderRadius + "px",
      "37233ce7": e.mergedConfig.dataFW,
      a1651940: e.mergedConfig.dataFS + "px",
      "37233cd3": e.mergedConfig.dataFC,
      "5fbe7e8c": e.mergedConfig.tableType == 1 && e.mergedConfig.oddRowBGC,
      58510099: e.mergedConfig.tableType == 2 && e.mergedConfig.oddRowBGC,
      "6a9e0d6a": e.mergedConfig.tableType == 2 && e.mergedConfig.borderRadius + "px",
      "152320f7": e.mergedConfig.tableType == 1 && e.mergedConfig.evenRowBGC,
      da0a4610: e.mergedConfig.tableType == 2 && e.mergedConfig.evenRowBGC,
      "32e3a70a": s(x) + "px",
      "7f5334df": e.mergedConfig.orderWidth + "px",
      "5c2f367b": e.mergedConfig.orderHighLight && e.mergedConfig.orderBR + "px",
      "3d6ee877": e.mergedConfig.orderHighLight && e.mergedConfig.orderFZ + "px",
      "5c770566": e.mergedConfig.orderHighLight && e.mergedConfig.orderFZ * 1.5 + "px",
      "31c87cf7": e.mergedConfig.tableType == 2 && e.mergedConfig.headerBGC
    }));
    const { w: F, h: f } = $(a.chartConfig.attr);
    console.log(a.chartConfig, F, f, "wh");
    const e = w({
      defaultConfig: {
        tableType: 1,
        borderRadius: 4,
        columnWidth: [],
        align: [],
        gap: [0, 0],
        header: [],
        headerShow: !0,
        headerBGC: "#00BAFF",
        headerFS: 24,
        headerFW: 600,
        headerFC: "#ffffff",
        headerHeight: 35,
        dataset: [],
        oddRowBGC: "#003B51",
        evenRowBGC: "#003B51",
        dataFS: 24,
        dataFW: 600,
        dataFC: "gray",
        modelValue: !0,
        step: 0.3,
        limitScrollNum: 5,
        hover: !0,
        singleWaitTime: 1e3,
        ease: "ease",
        wheel: !0,
        orderName: "\u5E8F\u53F7",
        orderShow: !0,
        orderWidth: 100,
        orderFC: "#ffffff",
        orderFZ: 28,
        orderHighLight: !1,
        orderHC: ["#ff0000", "#ff8f1f", "#e4c91c"],
        orderBW: 2,
        orderBR: 2
      },
      mergedConfig: a.chartConfig.option,
      header: [],
      rowsData: [],
      columnWidth: [],
      aligns: [],
      gap: [10, 10],
      orderHC: []
    }), x = o(
      () => (f.value - e.gap[0] * e.mergedConfig.limitScrollNum - (e.mergedConfig.headerShow && e.header.length ? e.mergedConfig.headerHeight : 0)) / (e.mergedConfig.limitScrollNum - 1)
    ), u = () => {
      W(), B(), H(), v(), R(), T(), V();
    };
    L(() => {
      u();
    });
    const W = () => {
      e.mergedConfig = {
        ...e.defaultConfig,
        ...a.chartConfig.option
      }, console.log(e.header.length, e.mergedConfig, "wh");
    }, H = () => {
      let { columnWidth: r } = e.mergedConfig;
      if (!r.length) {
        e.aligns = [];
        return;
      }
      r = [...r], e.columnWidth = r;
    }, B = () => {
      let { align: r } = e.mergedConfig;
      if (!r.length) {
        e.aligns = [];
        return;
      }
      r = [...r], e.aligns = r;
    }, v = () => {
      let { rowGap: r, columnGap: p } = e.mergedConfig;
      e.gap = [p, r];
    }, R = () => {
      let { header: r } = e.mergedConfig;
      if (!r.length) {
        e.header = [];
        return;
      }
      r = [...r], e.header = r;
    }, T = () => {
      let { orderHC: r } = e.mergedConfig;
      if (!r.length) {
        e.orderHC = [];
        return;
      }
      r = [...r], e.orderHC = r;
    }, V = () => {
      let { dataset: r } = e.mergedConfig;
      if (console.log(r, "dataset"), !r.length) {
        e.rowsData = [];
        return;
      }
      r = [...r], e.rowsData = r;
    }, G = () => {
      try {
        if (!e.mergedConfig)
          return;
        u();
      } catch {
      }
    };
    E(
      () => a.chartConfig.option,
      () => {
        G();
      },
      { deep: !0 }
    );
    const N = w({
      list: o(() => e.rowsData),
      modelValue: o(() => e.mergedConfig.modelValue),
      copyNum: o(() => e.mergedConfig.modelValue ? 1 : 0),
      step: o(() => e.mergedConfig.step),
      limitScrollNum: o(() => e.mergedConfig.limitScrollNum),
      hover: o(() => e.mergedConfig.hover),
      singleWaitTime: o(() => e.mergedConfig.singleWaitTime),
      ease: o(() => e.mergedConfig.ease),
      wheel: o(() => e.mergedConfig.wheel)
    });
    return (r, p) => (d(), g("div", j, [
      e.mergedConfig.headerShow && e.header.length ? (d(), g("div", {
        key: 0,
        class: _(["header", {
          scroll_bar_header: !e.mergedConfig.modelValue && e.rowsData.length >= e.mergedConfig.limitScrollNum
        }])
      }, [
        e.mergedConfig.orderShow ? (d(), g("div", q, l(e.mergedConfig.orderName), 1)) : c("", !0),
        (d(!0), g(C, null, h(e.header, (i, t) => (d(), g("div", {
          class: "header_item header_item",
          key: i,
          style: m(`
        ${e.columnWidth[t] == "auto" ? "flex-grow:1;" : "width:" + e.columnWidth[t] + "px"};
      `),
          align: e.aligns[t]
        }, l(i), 13, M))), 128))
      ], 2)) : c("", !0),
      y("div", {
        class: _({
          scroll_bar: !e.mergedConfig.modelValue && e.rowsData.length >= e.mergedConfig.limitScrollNum
        }),
        style: m(`height: ${s(f) - (e.mergedConfig.headerShow ? e.mergedConfig.headerHeight + e.gap[0] : 0)}px;`)
      }, [
        Z(s(O), z({ class: "Vue3_SeamlessScroll" }, { ...N }), {
          default: A(() => [
            (d(!0), g(C, null, h(e.rowsData, (i, t) => (d(), g("div", {
              key: t,
              class: "list_row"
            }, [
              e.mergedConfig.orderShow ? (d(), g("div", P, [
                y("div", {
                  style: m(`${e.mergedConfig.orderHighLight && `
              color:${e.orderHC[t] || e.mergedConfig.orderFC};
              border:${e.mergedConfig.orderBW}px solid ${e.mergedConfig.orderHC[t] || e.mergedConfig.orderFC};
              `}`)
                }, l(t + 1), 5)
              ])) : c("", !0),
              (d(!0), g(C, null, h(i, (D, n) => (d(), g("div", {
                key: n,
                class: "data_cloum",
                style: m(`${e.columnWidth[n] == "auto" ? "flex-grow:1;" : "width:" + e.columnWidth[n] + "px"};`),
                align: e.aligns[n]
              }, l(D), 13, J))), 128))
            ]))), 128))
          ]),
          _: 1
        }, 16)
      ], 6)
    ]));
  }
});
export {
  X as default
};
