@scalar/api-client
Version:
the open source API testing client
79 lines (78 loc) • 2.92 kB
JavaScript
import { defineComponent as p, useId as y, createBlock as o, openBlock as n, createSlots as c, withCtx as t, createElementVNode as a, createCommentVNode as h, createElementBlock as s, Fragment as b, renderList as g, createVNode as m, unref as r, toDisplayString as u, renderSlot as v } from "vue";
import { ScalarIcon as V } from "@scalar/components";
import x from "../../../../components/ViewLayout/ViewLayoutSection.vue.js";
import _ from "../../../components/data-table/DataTable.vue.js";
import S from "../../../components/data-table/DataTableInput.vue.js";
import U from "../../../components/data-table/DataTableRow.vue.js";
const $ = { key: 0 }, w = { class: "flex flex-1 flex-col gap-1.5" }, B = ["for"], C = { class: "centered-y bg-b-2 flex-center absolute right-1 z-1 rounded px-1 py-0.5" }, j = /* @__PURE__ */ p({
__name: "Form",
props: {
title: {},
options: {},
data: {},
onUpdate: { type: Function },
environment: {}
},
setup(e) {
const d = y();
return (i, D) => (n(), o(x, { class: "last:rounded-b-lg" }, c({
default: t(() => [
a("div", w, [
Object.keys(e.data).length > 0 ? (n(), o(_, {
key: 0,
class: "rounded-b-lg",
columns: [""]
}, {
default: t(() => [
(n(!0), s(b, null, g(e.options, (l, f) => (n(), o(U, { key: f }, {
default: t(() => [
m(S, {
id: r(d),
class: "pr-9",
environment: e.environment,
lineWrapping: "",
modelValue: e.data[l.key] ?? "",
placeholder: l.placeholder,
"onUpdate:modelValue": (k) => e.onUpdate(l.key, k)
}, c({
default: t(() => [
a("label", { for: r(d) }, u(l.label), 9, B)
]),
_: 2
}, [
l.key === "description" ? {
name: "icon",
fn: t(() => [
a("div", C, [
m(r(V), {
icon: "Markdown",
size: "lg"
})
])
]),
key: "0"
} : void 0
]), 1032, ["id", "environment", "modelValue", "placeholder", "onUpdate:modelValue"])
]),
_: 2
}, 1024))), 128))
]),
_: 1
})) : h("", !0)
])
]),
_: 2
}, [
e.title || i.$slots.title ? {
name: "title",
fn: t(() => [
e.title ? (n(), s("span", $, u(e.title), 1)) : v(i.$slots, "title", { key: 1 })
]),
key: "0"
} : void 0
]), 1024));
}
});
export {
j as default
};