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