@scalar/api-client
Version:
the open source API testing client
97 lines (96 loc) • 3.4 kB
JavaScript
import { defineComponent as x, createBlock as f, openBlock as t, unref as m, withCtx as e, createElementBlock as s, createVNode as n, createTextVNode as l, Fragment as u, renderList as y, toDisplayString as i, renderSlot as h } from "vue";
import b from "../../../../components/DataTable/DataTable.vue.js";
import c from "../../../../components/DataTable/DataTableRow.vue.js";
import p from "../../../../components/DataTable/DataTableText.vue.js";
import g from "../../../../components/HelpfulLink.vue.js";
import { httpHeaders as k } from "../../../../data/httpHeaders.js";
import w from "../../../components/layout/CollapsibleSection.vue.js";
import _ from "../../../../components/DataTable/DataTableHeader.vue.js";
const C = {
key: 0,
class: "max-h-[calc(100%-32px)] overflow-y-auto"
}, H = {
key: 1,
class: "text-c-3 bg-b-1 flex min-h-12 items-center justify-center rounded border px-4 text-base"
}, T = /* @__PURE__ */ x({
__name: "Headers",
props: {
headers: {}
},
setup($) {
const d = (r) => k.find(
(o) => o.name.toLowerCase() === r.toLowerCase()
);
return (r, o) => (t(), f(m(w), {
class: "overflow-auto",
defaultOpen: !1,
itemCount: r.headers.length
}, {
title: e(() => [
h(r.$slots, "title")
]),
default: e(() => [
r.headers.length ? (t(), s("div", C, [
n(b, {
columns: ["minmax(auto, min-content)", "minmax(50%, 1fr)"],
scroll: ""
}, {
default: e(() => [
n(c, { class: "sr-only !block" }, {
default: e(() => [
n(m(_), null, {
default: e(() => [...o[0] || (o[0] = [
l("Header Key", -1)
])]),
_: 1
}),
n(m(_), null, {
default: e(() => [...o[1] || (o[1] = [
l("Header Value", -1)
])]),
_: 1
})
]),
_: 1
}),
(t(!0), s(u, null, y(r.headers, (a) => (t(), f(c, {
key: a.name,
class: "group/row text-c-1"
}, {
default: e(() => [
n(p, { class: "bg-b-1 sticky left-0 z-1 max-w-full group-first/row:border-t-0" }, {
default: e(() => [
typeof d(a.name)?.url == "string" ? (t(), f(g, {
key: 0,
class: "decoration-c-3",
href: d(a.name).url
}, {
default: e(() => [
l(i(a.name), 1)
]),
_: 2
}, 1032, ["href"])) : (t(), s(u, { key: 1 }, [
l(i(a.name), 1)
], 64))
]),
_: 2
}, 1024),
n(p, {
class: "z-0 group-first/row:border-t-0",
text: a.value
}, null, 8, ["text"])
]),
_: 2
}, 1024))), 128))
]),
_: 1
})
])) : (t(), s("div", H, " No Headers "))
]),
_: 3
}, 8, ["itemCount"]));
}
});
export {
T as default
};