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