import "../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import "../../../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.mjs";
import "../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.mjs";
import "../../../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.mjs";
import "../../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.mjs";
import "../../../../../enums/pageEnum.mjs";
import "../../../../../router/index.mjs";
import "../../../../../store/modules/designStore/designStore.mjs";
import "../../../../../settings/designSetting.mjs";
import "../../../../../components/GoLoading/index.mjs";
import "../../../../../components/GoSkeleton/index.vue.mjs";
import { icon } from "../../../../../plugins/icon.mjs";
import { defineComponent, computed, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx } from "../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.mjs";
import { ref, toRefs, reactive, unref } from "../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.mjs";
import { normalizeStyle } from "../../../../../../node_modules/.pnpm/@vue_shared@3.3.4/node_modules/@vue/shared/dist/shared.esm-bundler.mjs";
const _hoisted_1 = { class: "go-tables-basic" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    const { SearchIcon } = icon.ionicons5;
    const inputData = ref("");
    const filterData = computed(() => {
      var _a, _b;
      return (_b = (_a = option == null ? void 0 : option.dataset) == null ? void 0 : _a.source) == null ? void 0 : _b.filter((item) => {
        return Object.values(item).some((val) => {
          return String(val).toLowerCase().includes(inputData.value.toLowerCase());
        });
      });
    });
    const { align, pagination, inputShow } = toRefs(props.chartConfig.option);
    pagination.value.onChange = (page) => {
      pagination.value.page = page;
    };
    const { w, h } = toRefs(props.chartConfig.attr);
    const option = reactive({
      dataset: props.chartConfig.option.dataset,
      style: props.chartConfig.option.style
    });
    watch(
      () => props.chartConfig.option.dataset,
      (newData) => {
        var _a, _b;
        option.dataset = newData;
        (_b = (_a = option == null ? void 0 : option.dataset) == null ? void 0 : _a.dimensions) == null ? void 0 : _b.forEach((header) => {
          header.align = align.value;
        });
      },
      {
        immediate: true,
        deep: true
      }
    );
    return (_ctx, _cache) => {
      const _component_n_icon = resolveComponent("n-icon");
      const _component_n_input = resolveComponent("n-input");
      const _component_n_data_table = resolveComponent("n-data-table");
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createVNode(_component_n_input, {
          value: inputData.value,
          "onUpdate:value": _cache[0] || (_cache[0] = ($event) => inputData.value = $event),
          placeholder: "请输入信息",
          style: normalizeStyle([`display: ${unref(inputShow)}`, { "margin-bottom": "5px", "float": "right", "width": "240px" }])
        }, {
          prefix: withCtx(() => [
            createVNode(_component_n_icon, { component: unref(SearchIcon) }, null, 8, ["component"])
          ]),
          _: 1
        }, 8, ["value", "style"]),
        createVNode(_component_n_data_table, {
          style: normalizeStyle(`
      width: ${unref(w)}px;
      height: ${unref(h)}px;
      font-size: ${option.style.fontSize}px;
      border-width: ${option.style.border === "on" ? option.style.borderWidth : 0}px;
      border-color: ${option.style.borderColor};
      border-style: ${option.style.borderStyle}`),
          bordered: option.style.border === "on",
          "single-column": option.style.singleColumn === "on",
          "single-line": option.style.singleLine === "on",
          "bottom-bordered": option.style.bottomBordered === "on",
          striped: option.style.striped === "on",
          "max-height": unref(h),
          size: "small",
          columns: option.dataset.dimensions,
          data: filterData.value,
          pagination: unref(pagination)
        }, null, 8, ["style", "bordered", "single-column", "single-line", "bottom-bordered", "striped", "max-height", "columns", "data", "pagination"])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
