import { ColumnComp as g } from "./0667825e.js";
import { gR as a, dU as d, c1 as c } from "./684d2f28.js";
import { MockTableComp as w } from "./621469b1.js";
import { TableComp as x } from "./9639b54b.js";
import { O as f } from "./bdf03194.js";
import "react";
import "./49a8125c.js";
import "./7281819e.js";
import "./9869e60a.js";
import "./b1144c16.js";
import "react-dom";
import "./d404aae1.js";
import "./926d8ea1.js";
import "./d6402597.js";
import "./7a630f06.js";
import "./d883a28b.js";
import "./6be5dc74.js";
import "./1312a48b.js";
import "./00dac55d.js";
import "./622ce240.js";
import "./0c4ef413.js";
import "./b8f8370b.js";
import "./ca17ca0f.js";
import "./d9d1e856.js";
import "./6538ec2e.js";
import "./226f78bd.js";
import "./8e06f4ed.js";
import "./a014bc57.js";
import "./6cf5f7c0.js";
import "./7f2964c3.js";
import "./602ac28f.js";
import "./f9c25fbe.js";
import "./2d5fc5ff.js";
import "./0f3d7a1a.js";
import "./698a4355.js";
import "./cf2c1864.js";
import "./fcd1d96f.js";
import "./ff81ee95.js";
import "./6b18b908.js";
import "./6cb1f6af.js";
import "./36711569.js";
import "./392e04da.js";
import "./619fbfe2.js";
import "./e3ea3031.js";
import "./913682de.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 w({});
  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, f))), {
      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: h
  } = 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);
});
