import { computed as c, unref as s } from "vue";
import { y as d, s as m, w as i, q as o, p as r, c as l } from "./index-a68a4fdc.mjs";
function u({ config: e, data: a, context: t }) {
  const n = d("el-table", e);
  return n.data = a, n["#"] = p(e, t), n;
}
function p(e, a) {
  const t = [];
  for (const n of e._container || [])
    t.push(b(n, a));
  return t;
}
function b(e, a) {
  const t = d("el-table-column", { config: e });
  return !e.type && e._formatter ? t.formatter = function() {
    return a.methodManager.methodCall({ method: e._formatter }, void 0, ...arguments);
  } : e.type == "container" && (t["#"] = m(e)), t;
}
const k = {
  key: "_table",
  name: "Table",
  description: "Basic table",
  icon: "mdiTable",
  sequence: 14,
  transform: u,
  editor: {
    basic: {
      ui: [
        i("stripe"),
        i("border"),
        o("empty-text"),
        {
          "~component": "lc-editable-list",
          "~label": "Columns",
          "~prop": "_container",
          labelColumn: "label",
          editConfig: function(e) {
            return [
              o("label"),
              o("prop"),
              o("width"),
              r("align", ["left", "center", "right"]),
              r("type", ["selection", "index", "container"]),
              r("_formatter", "#method", void 0, {
                "~show": c(() => !s(e).type)
              })
            ];
          }
        }
      ],
      init: {
        border: !0,
        "empty-text": "No data is found!",
        _container: [
          {
            type: "selection",
            key: l()
          },
          {
            type: "index",
            label: "#",
            key: l()
          },
          {
            prop: "date",
            label: "Date",
            key: l()
          },
          {
            prop: "name",
            label: "Name",
            key: l()
          },
          {
            prop: "address",
            label: "Address",
            key: l()
          }
        ]
      }
    },
    event: {
      list: ["row-click", "row-dblclick", "cell-click", "cell-dblclick", "select"]
    },
    data: {
      modelValueName: "data",
      //readonly:true,
      type: "Array",
      init: {
        mode: "fixed",
        dataContent: `[{"date":"2023-12-23","name":"Tom","address":"Who know it?"},
{"date":"2023-01-02","name":"Jack","address":"May be in the city?"},
{"date":"2021-11-12","name":"Alice","address":"In castle?"}
]`
      }
    },
    display: {
      init: {
        style: {
          // display: 'block',
          // width: '100%',
          // margin: '4px 0 4px 0'
        }
      }
    }
  }
};
export {
  k as default
};
