UNPKG

@scalar/api-client

Version:

the open source API testing client

52 lines (51 loc) 2.03 kB
import { defineComponent as g, createElementBlock as p, createCommentVNode as y, openBlock as o, Fragment as h, renderList as k, normalizeClass as C, createElementVNode as V, createBlock as f, toDisplayString as B } from "vue"; import S from "./ServerVariablesSelect.vue.js"; import $ from "./ServerVariablesTextbox.vue.js"; const j = { class: "flex items-center py-1.5 pl-3 group-has-[input]/label:mr-0 after:content-[':']" }, O = /* @__PURE__ */ g({ __name: "ServerVariablesForm", props: { variables: {}, values: {}, controls: {}, layout: { default: "client" } }, emits: ["update:variable"], setup(n, { emit: v }) { const d = v; function s(e, r) { d("update:variable", e, r); } const i = (e) => { var r, l, a; return (((r = n.values) == null ? void 0 : r[e]) ?? ((a = (l = n.variables) == null ? void 0 : l[e]) == null ? void 0 : a.default) ?? "").toString(); }; return (e, r) => e.variables && Object.keys(e.variables ?? {}).length ? (o(!0), p(h, { key: 0 }, k(Object.keys(e.variables), (l) => { var a, u, c, b, m; return o(), p("label", { key: l, class: C([ "group/label flex w-full", e.layout === "reference" && "items-center border-x border-b last:rounded-b-lg" ]) }, [ V("span", j, B(l), 1), (c = (u = (a = e.variables) == null ? void 0 : a[l]) == null ? void 0 : u.enum) != null && c.length ? (o(), f(S, { key: 0, controls: e.controls, enum: ((m = (b = e.variables[l]) == null ? void 0 : b.enum) == null ? void 0 : m.map((t) => `${t}`)) ?? [], label: l, value: i(l), onChange: (t) => s(l, t) }, null, 8, ["controls", "enum", "label", "value", "onChange"])) : (o(), f($, { key: 1, controls: e.controls, value: i(l), onChange: (t) => s(l, t) }, null, 8, ["controls", "value", "onChange"])) ], 2); }), 128)) : y("", !0); } }); export { O as default };