import { computed as i, unref as l } from "vue";
import { v as f, y as b, s as h, A as s, w as p, p as a, q as r, c as u } from "./index-a857af7d.mjs";
const w = f("el-form", {}, (e, { config: t, data: o }) => (e["#"] = y(t, o), e));
function y(e, t) {
  const o = [];
  for (const n of e._container || [])
    o.push(T(n, t));
  return o;
}
function T(e, t) {
  const o = b("el-form-item", { config: e });
  return o["#"] = v(e, t), o;
}
function v(e, t) {
  const o = e["~controllerType"] || "input";
  if (o == "container")
    return h(e);
  const n = {
    "~modelValue": t,
    "~modelValuePath": e.prop
  };
  if (o == "input")
    _(e, n);
  else if (o == "input-number")
    g(e, n);
  else if (o == "switch")
    x(e, n);
  else if (o == "select")
    S(e, n);
  else
    throw new Error("Unsuported type:" + o);
  return n;
}
function _(e, t) {
  t["~component"] = "el-input", s(e, t);
}
function g(e, t) {
  t["~component"] = "el-input-number", s(e, t);
}
function x(e, t) {
  t["~component"] = "el-switch", s(e, t);
}
function S(e, t) {
  t["~component"] = "el-select", s(e, t), I(e, t);
}
function I(e, t) {
  const o = [], m = (e["~options"] || "").split(",");
  for (const d of m) {
    const c = d.split(":");
    o.push({
      "~component": "el-option",
      label: c.length > 1 ? c[1] : c[0],
      value: c[0]
    });
  }
  t["#"] = o;
}
const q = {
  key: "_form",
  name: "Form",
  description: "Basic form",
  icon: "mdiFormatColumns",
  sequence: 13,
  transform: w,
  editor: {
    basic: {
      ui: [
        p("inline"),
        a("label-position", ["left", "right", "top"]),
        r("label-width"),
        {
          "~component": "lc-editable-list",
          "~label": "Items",
          "~prop": "_container",
          labelColumn: "label",
          editConfig: function(e) {
            return [
              r("label"),
              r("prop"),
              p("required"),
              a("~controllerType", [
                "input",
                "input-number",
                "select",
                "switch",
                "container"
              ]),
              a("_type", ["text", "textarea"], void 0, {
                "~show": i(() => l(e)["~controllerType"] == "input")
              }),
              p("_controls", "Show controls", {
                "~show": i(() => l(e)["~controllerType"] == "input-number"),
                "~default": !0
              }),
              r("_placeholder", void 0, {
                "~show": i(() => l(e)["~controllerType"] != "switch")
              }),
              p("_clearable", void 0, {
                "~show": i(() => l(e)["~controllerType"] != "switch")
              }),
              r("_active-text", void 0, {
                "~show": i(() => l(e)["~controllerType"] == "switch")
              }),
              r("_inactive-text", void 0, {
                "~show": i(() => l(e)["~controllerType"] == "switch")
              }),
              r("~options", void 0, {
                "~show": i(() => l(e)["~controllerType"] == "select")
              })
            ];
          }
        }
      ],
      init: {
        inline: !1,
        "label-position": "top",
        "label-width": "50px",
        _container: [
          { label: "Name", prop: "name", type: "input", key: u() },
          { label: "Address", prop: "address", type: "input", key: u() }
        ]
      }
    },
    data: {
      modelValueName: "model",
      //readonly:true,
      type: "Object"
    },
    display: {
      init: {
        style: {
          display: "block",
          width: "100%",
          margin: "4px 0 4px 0"
        }
      }
    }
  }
};
export {
  q as default
};
