import { C as g, O as w } from "./158dca8d.js";
import { J as a, dS as d, _ as c } from "./603b75d9.js";
import { MockTableComp as h } from "./f023d901.js";
import { TableComp as x } from "./9a3e93cb.js";
import "react";
import "./18a95abc.js";
import "./c2be1293.js";
import "./4963ac97.js";
import "./ffcffc16.js";
import "react-dom";
import "./62f393ec.js";
import "./26dac75c.js";
import "./11b05d65.js";
import "./56edae87.js";
import "./0cc240d3.js";
import "./00d44232.js";
import "./f9847c56.js";
import "./a4d0e31e.js";
import "./41aba172.js";
import "./e735e391.js";
import "./140b48ce.js";
import "./f5fb28b1.js";
import "./930af84f.js";
import "./9c5ea6de.js";
import "./7f1b43fa.js";
import "./cee178c0.js";
import "./43b58a96.js";
import "./19a46fb5.js";
import "./98f17e53.js";
import "./794d827a.js";
import "./0cdeb449.js";
import "./d50792b8.js";
import "./f64a8554.js";
import "./cf72e8e5.js";
import "./84cede66.js";
import "./3dfed0b7.js";
import "./57f24d28.js";
import "./be662667.js";
import "./8064caf1.js";
import "./d8fd0c14.js";
import "./048c5fdf.js";
import "./2d0ef255.js";
import "./44e33607.js";
import "./2effcf20.js";
import "./6cc9aba1.js";
import "./c873d014.js";
test("test column", () => {
  const e = {
    title: "name"
    // editable: true, // TODO: change to boolean
  };
  let o = new g({
    value: e
  });
  o = a(o);
  const t = o.getView();
  expect(t.title).toEqual(e.title);
});
test("test column render", () => {
  const e = {
    render: {
      compType: "text",
      comp: {
        text: "{{currentRow.id}}"
      }
    }
    // editable: true, // TODO: change to boolean
  };
  let o = new g({
    value: e
  });
  o = a(o);
  const t = o.getView();
  expect(t.render({
    currentCell: null,
    currentIndex: null,
    currentRow: {
      id: "hello"
    },
    currentOriginalIndex: null
  }, "0").getView().view({}).props.normalView).toEqual("hello");
});
test("test table", async () => {
  const e = {
    data: JSON.stringify([{
      a: 1
    }]),
    columns: [{
      dataIndex: "a",
      hide: !0
    }, {
      title: "custom",
      dataIndex: "",
      isCustom: !0
    }]
  }, o = {
    query1: d({
      data: [{
        q: 1
      }]
    }),
    query2: d({
      data: [{
        q2: 2
      }]
    })
  };
  let t = new x({
    dispatch: (l) => {
      t = a(t.reduce(l), o);
    },
    value: e
  });
  t = a(t);
  let r = t.children.columns.getView();
  expect(r.length).toEqual(2), t = a(t.reduce(t.changeChildAction("data", '[{"a":1, "c":2, "d":3}]'))), await new Promise((l) => setTimeout(l, 20)), r = t.children.columns.getView(), expect(r.length).toEqual(4), expect(r[0].getView().dataIndex).toEqual("a"), expect(r[0].getView().hide).toBe(!0), expect(r[1].getView().title).toEqual("custom"), expect(r[2].getView().title).toEqual("c"), expect(r[3].getView().title).toEqual("d");
}, 1e3);
test("test mock table render", () => {
  let e = new h({});
  e = a(e);
});
test("test table data transform", () => {
  function e(i, m) {
    const p = m.exposingValues.displayData, {
      data: u
    } = m.getProps(), s = m.filterData;
    return expect(u.length).toEqual(3), expect(p.length).toEqual(i), expect(p.map((n) => c.omit(n, "custom"))).toEqual(c.map(s, (n) => c.omit(n, w))), {
      transformedData: s,
      data: u,
      displayData: p
    };
  }
  const o = {
    data: JSON.stringify([{
      id: 1,
      name: "gg"
    }, {
      id: 5,
      name: "gg2"
    }, {
      id: 3,
      name: "jjj"
    }]),
    columns: [{
      dataIndex: "id",
      isCustom: !1,
      sortable: !0,
      render: {
        compType: "text",
        comp: {
          text: "{{currentCell}}"
        }
      }
    }, {
      dataIndex: "name",
      isCustom: !1,
      render: {
        compType: "text",
        comp: {
          text: "{{currentCell}}"
        }
      }
    }, {
      title: "custom",
      dataIndex: "ealekfg",
      isCustom: !0,
      render: {
        compType: "image",
        comp: {
          src: "{{currentRow.id}}"
        }
      }
    }]
  };
  let t = new x({
    dispatch: (i) => {
      t = a(t.reduce(i));
    },
    value: o
  });
  t = a(t), t = a(t.reduce(t.changeChildAction("sort", [{
    column: "id",
    desc: !0
  }])));
  let {
    transformedData: r,
    data: l,
    displayData: f
  } = e(3, t);
  expect(r.map((i) => i.id)).toEqual([5, 3, 1]), t = a(t.reduce(t.changeChildAction("toolbar", {
    searchText: "gg"
  }))), e(2, t), t = a(t.reduce(t.changeChildAction("toolbar", {
    showFilter: !0,
    filter: {
      stackType: "and",
      filters: [{
        columnKey: "id",
        filterValue: "4",
        operator: "gt"
      }, {
        columnKey: "id",
        filterValue: "5",
        operator: "lte"
      }]
    }
  }))), e(1, t);
});
