import { defineComponent as S, computed as f, ref as x, onMounted as I, nextTick as L, createElementBlock as a, createCommentVNode as g, openBlock as s, normalizeStyle as R, createVNode as y, Fragment as w, renderList as E, unref as d, withCtx as T, createElementVNode as z } from "vue";
import { debounce as v, cloneDeep as N } from "lodash";
import { nanoid as h } from "nanoid";
import { RecycleScroller as O } from "vue-virtual-scroller";
/* empty css                                     */
/* empty css                                     */
import "../../../Interaction/components/Tabs/index.mjs";
import "../../../Interaction/components/Tabs-icon/index.mjs";
import "../../../Interaction/components/Button/index.mjs";
import "../../../Interaction/components/DatePicker/index.mjs";
import "../../../Interaction/components/DatePickerRange/index.mjs";
import "../../../Interaction/components/Switch/index.mjs";
import "../../../Interaction/components/Input/index.mjs";
import "../../../Interaction/components/Select/index.mjs";
import "../../../Interaction/components/Slider/index.mjs";
import "../List/index.mjs";
import "../Text/index.mjs";
import "../TextDynamic/index.mjs";
import "./index.mjs";
import "../TableScroll/index.mjs";
import "../RowScroll/index.mjs";
import "../RealTime/index.mjs";
import "../OverNumber/index.mjs";
import "../CountDown/index.mjs";
import "../TextCarousel/index.mjs";
import "../../../Media/components/Audio/index.mjs";
import "../../../Media/components/Video/index.mjs";
import "../../../Media/components/VideoDynamic/index.mjs";
import "../../../Media/components/Carousel/index.mjs";
import "../../../Media/components/Flv/index.mjs";
import "../../../Media/components/Iframe/index.mjs";
import "../../../Media/components/IframeCarousel/index.mjs";
import "../../../Media/components/Image/index.mjs";
import "../../../Media/components/ImageDynamic/index.mjs";
import "../../../Media/components/M3u8/index.mjs";
import "../../../Media/components/Wavesurfer/index.mjs";
import "../../../Media/components/Weather/index.mjs";
import "../../../Media/components/Qrcode/index.mjs";
import "../../../Chart/components/bar/basic/index.mjs";
import "../../../Chart/components/bar/animation/index.mjs";
import "../../../Chart/components/bar/contrast/index.mjs";
import "../../../Chart/components/bar/contrast2/index.mjs";
import "../../../Chart/components/bar/contrast3/index.mjs";
import "../../../Chart/components/bar/gradient-column-chart/index.mjs";
import "../../../Chart/components/bar/horizontal/index.mjs";
import "../../../Chart/components/bar/horizontal-stack/index.mjs";
import "../../../Chart/components/bar/line-bar/index.mjs";
import "../../../Chart/components/bar/line-bar2/index.mjs";
import "../../../Chart/components/bar/loop/index.mjs";
import "../../../Chart/components/bar/mini/index.mjs";
import "../../../Chart/components/bar/polar/index.mjs";
import "../../../Chart/components/bar/polar-stack/index.mjs";
import "../../../Chart/components/bar/polar2/index.mjs";
import "../../../Chart/components/bar/radius-circle/index.mjs";
import "../../../Chart/components/bar/rank/index.mjs";
import "../../../Chart/components/bar/segmented-progress/index.mjs";
import "../../../Chart/components/bar/spire/index.mjs";
import "../../../Chart/components/bar/stack/index.mjs";
import "../../../Chart/components/bar/stack-line/index.mjs";
import "../../../Chart/components/bar/stack2/index.mjs";
import "../../../Chart/components/bar/stack3/index.mjs";
import "../../../Chart/components/bar/staggered/index.mjs";
import "../../../Chart/components/bar/three/index.mjs";
import "../../../Chart/components/bar/waterfall/index.mjs";
import "../../../Chart/components/bar/zebra/index.mjs";
import "../../../Chart/components/line/area-gradient/index.mjs";
import "../../../Chart/components/line/area-highlight/index.mjs";
import "../../../Chart/components/line/area-highlight2/index.mjs";
import "../../../Chart/components/line/basic/index.mjs";
import "../../../Chart/components/line/bump/index.mjs";
import "../../../Chart/components/line/dashed/index.mjs";
import "../../../Chart/components/line/ladder/index.mjs";
import "../../../Chart/components/line/logarithm/index.mjs";
import "../../../Chart/components/line/multix/index.mjs";
import "../../../Chart/components/line/polar-double/index.mjs";
import "../../../Chart/components/line/rain-flow/index.mjs";
import "../../../Chart/components/line/scale/index.mjs";
import "../../../Chart/components/line/smooth/index.mjs";
import "../../../Chart/components/line/smooth-area/index.mjs";
import "../../../Chart/components/line/stack/index.mjs";
import "../../../Chart/components/line/stack-area/index.mjs";
import "../../../Chart/components/line/temp/index.mjs";
import "../../../Chart/components/line/vertical/index.mjs";
import "../../../Chart/components/map/basic/index.mjs";
import "../../../Chart/components/map/bmap-basic/index.mjs";
import "../../../Chart/components/map/bmap-heatmap/index.mjs";
import "../../../Chart/components/map/bmap-rich/index.mjs";
import "../../../Chart/components/map/customize/index.mjs";
import "../../../Chart/components/map/lines/index.mjs";
import "../../../Chart/components/map/scatter/index.mjs";
import "../../../Chart/components/pie/3d/index.mjs";
import "../../../Chart/components/pie/basic/index.mjs";
import "../../../Chart/components/pie/basic2/index.mjs";
import "../../../Chart/components/pie/customized/index.mjs";
import "../../../Chart/components/pie/index/index.mjs";
import "../../../Chart/components/pie/interval/index.mjs";
import "../../../Chart/components/pie/legend-scroll/index.mjs";
import "../../../Chart/components/pie/radius/index.mjs";
import "../../../Chart/components/pie/rose/index.mjs";
import "../../../Chart/components/pie/round/index.mjs";
import "../../../Chart/components/pie/sunburst/index.mjs";
import "../../../Chart/components/scatter/basic/index.mjs";
import "../../../Chart/components/scatter/basic2/index.mjs";
import "../../../Chart/components/scatter/bubble/index.mjs";
import "../../../Chart/components/scatter/ripples/index.mjs";
import "../../../Chart/components/other/candlestick-basic/index.mjs";
import "../../../Chart/components/other/sunburst-basic/index.mjs";
import "../../../Chart/components/other/sunburst-basic2/index.mjs";
import "../../../Chart/components/other/sunburst-basic3/index.mjs";
import "../../../Chart/components/other/sunburst-basic4/index.mjs";
import "../../../Chart/components/other/sunburst-book/index.mjs";
import "../../../Chart/components/other/sunburst-flavors/index.mjs";
import "../../../Chart/components/other/sunburst-radius/index.mjs";
import "../../../Chart/components/other/funnel/index.mjs";
import "../../../Chart/components/other/funnel-contrast/index.mjs";
import "../../../Chart/components/other/funnel-split/index.mjs";
import "../../../Chart/components/other/funnel2/index.mjs";
import "../../../Chart/components/other/force/index.mjs";
import "../../../Chart/components/other/force2/index.mjs";
import "../../../Chart/components/other/gauge/index.mjs";
import "../../../Chart/components/other/gauge-grade/index.mjs";
import "../../../Chart/components/other/gauge-stage/index.mjs";
import "../../../Chart/components/other/graph-basic/index.mjs";
import "../../../Chart/components/other/graph-basic2/index.mjs";
import "../../../Chart/components/other/graph-calendar/index.mjs";
import "../../../Chart/components/other/circular-graph/index.mjs";
import "../../../Chart/components/other/heatmap/index.mjs";
import "../../../Chart/components/other/liquidfill/index.mjs";
import "../../../Chart/components/other/parallel-basic/index.mjs";
import "../../../Chart/components/other/parallel-mul/index.mjs";
import "../../../Chart/components/other/radar-stack/index.mjs";
import "../../../Chart/components/other/tree/index.mjs";
import "../../../Chart/components/other/tree-line/index.mjs";
import "../../../Chart/components/other/word-cloud/index.mjs";
import "../../../Chart/components/other/treemap/index.mjs";
import "../../../Chart/components/other/treemap-basic/index.mjs";
import "../../../Chart/components/other/label-gauge/index.mjs";
import "../../../Chart/components/other/grid-percentage/index.mjs";
import "../../../Chart/components/other/radar/index.mjs";
import "../../../Commons/components/CustomComponentRender/index.mjs";
import "../../../Commons/components/Graphical/index.mjs";
import "../../../Commons/components/Svg/index.mjs";
import "../../../Commons/components/ModelViewer/index.mjs";
import "../../../Commons/components/VrVideo/index.mjs";
import "../../../Commons/components/VrPhoto/index.mjs";
import "../../../Commons/components/Babylon/index.mjs";
import "../../../Commons/components/Echarts/index.mjs";
import "../../../Commons/components/GSViewer/index.mjs";
import "../../../Scene/components/Amap2d/index.mjs";
import "../../../Scene/components/Amap3d/index.mjs";
import "../../../Scene/components/Default/index.mjs";
import "../../../Scene/components/Map2d/index.mjs";
import "../../../Scene/components/Map3d/index.mjs";
import "../../../Scene/components/UeIframe/index.mjs";
import "../../../Scene/components/UeShj/index.mjs";
import "../../../Scene/components/UnityIframe/index.mjs";
import "../../../Scene/components/UnityWebgl/index.mjs";
import "../../../Scene/components/Vr/index.mjs";
import "../../../Scene/components/Earth/index.mjs";
import { SHJDatasourceV2 as W } from "../../../../commons/plugins/datasource/index.mjs";
import { SHJParseEvent as n } from "../../../../commons/plugins/event/index.mjs";
import { useWatch as H } from "./hooks/useWatch.mjs";
import C from "../../../../commons/components/Text.vue.mjs";
import { upgradeTableBasic as J } from "./version.mjs";
import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
const F = {
  key: 0,
  class: "table-header"
}, P = ["onClick", "onMouseenter", "onMouseout"], q = ["onClick"], A = S({ name: "ShjTableBasic" }), Ye = /* @__PURE__ */ S({
  ...A,
  props: {
    option: {},
    sources: {},
    useEvents: {}
  },
  emits: [
    "on-click-item",
    "on-click-row",
    "on-mouseenter-row",
    "on-mouseout-row"
  ],
  setup(m, { expose: B, emit: M }) {
    const c = M, o = f(() => J(m.option)), b = x(h()), p = x([]), u = () => {
      W.parse({
        sources: m.sources,
        callback: (r) => {
          try {
            n.parseEvents(m.useEvents, "dataListener", p), b.value = h(), p.value = N(r.data[0].data).map((e, t) => ({
              id: e.id || t,
              ...e
            }));
          } catch {
            n.parseEvents(m.useEvents, "dataListener", null), b.value = h(), p.value = [];
          }
        }
      });
    }, k = f(() => Object.keys(p.value[0])), V = v((r, e) => {
      const t = { row: r, rowIndex: e };
      c("on-click-row", t), n.parseEvents(m.useEvents, "on-click-row", t);
    }, 100), $ = v((r, e) => {
      const t = { row: r, rowIndex: e };
      c("on-mouseenter-row", t), n.parseEvents(m.useEvents, "on-mouseenter-row", t);
    }, 100), j = v((r, e) => {
      const t = { row: r, rowIndex: e };
      c("on-mouseout-row", t), n.parseEvents(m.useEvents, "on-mouseout-row", t);
    }, 100), D = v(
      (r, e, t, l) => {
        const i = {
          row: r,
          item: e,
          rowIndex: t,
          columnIndex: l
        };
        c("on-click-item", i), n.parseEvents(m.useEvents, "on-click-item", i);
      },
      100
    );
    return I(() => {
      L(() => {
        u();
      });
    }), H({ option: o.value, sources: m.sources }, u), B({
      refresh: () => u(),
      refreshView: () => u(),
      refreshData: () => u()
    }), (r, e) => p.value.length > 0 ? (s(), a("div", {
      key: b.value,
      class: "table",
      style: R({
        "--table-border-color": o.value.style.table.borderColor,
        "--table-border-width": o.value.style.table.borderWidth + "px",
        "--table-border-style": o.value.style.table.borderStyle,
        "--table-padding-left": o.value.style.table.paddingLeft + "px",
        "--table-align-items": o.value.style.table.alignItems,
        "--table-justify-content": o.value.style.table.justifyContent,
        "--table-header-height": o.value.style.header.height + "px",
        "--tabel-header-background": `url(${o.value.style.header.background})`,
        "--table-header-border-bottom-color": o.value.style.header.borderBottomColor,
        "--table-header-border-bottom-width": o.value.style.header.borderBottomWidth + "px",
        "--table-header-border-bottom-style": o.value.style.header.borderBottomStyle,
        "--table-body-height": o.value.style.body.height + "px",
        "--table-body-background": o.value.style.body.background,
        "--table-odd-background": o.value.style.oddBackground,
        "--table-hover-color": o.value.style.hoverColor
      })
    }, [
      o.value.style.header.show ? (s(), a("div", F, [
        (s(!0), a(w, null, E(k.value, (t) => (s(), a("div", {
          key: t,
          class: "th"
        }, [
          y(C, {
            text: t,
            textStyle: o.value.style.header.textStyle
          }, null, 8, ["text", "textStyle"])
        ]))), 128))
      ])) : g("", !0),
      y(d(O), {
        id: "",
        class: "table-body",
        items: p.value,
        "item-size": o.value.style.body.height,
        "key-field": "id"
      }, {
        default: T(({ item: t, index: l }) => [
          z("div", {
            class: "tr",
            onClick: (i) => d(V)(t, l),
            onMouseenter: (i) => d($)(t, l),
            onMouseout: (i) => d(j)(t, l)
          }, [
            (s(!0), a(w, null, E(t, (i) => (s(), a("div", {
              key: i,
              class: "td",
              onClick: (G) => d(D)(
                t,
                t[i],
                l,
                k.value.indexOf(i)
              )
            }, [
              y(C, {
                text: i,
                textStyle: o.value.style.body.textStyle
              }, null, 8, ["text", "textStyle"])
            ], 8, q))), 128))
          ], 40, P)
        ]),
        _: 1
      }, 8, ["items", "item-size"])
    ], 4)) : g("", !0);
  }
});
export {
  Ye as default
};
