@scalar/api-client
Version:
the open source API testing client
75 lines (74 loc) • 2.76 kB
JavaScript
import { defineComponent as B, computed as f, createBlock as v, openBlock as r, unref as o, withCtx as n, createVNode as u, createElementBlock as D, createTextVNode as d, toDisplayString as m, Fragment as k, renderList as F } from "vue";
import U from "./RequestTableRow.vue.js";
import y from "../../../components/data-table/DataTable.vue.js";
import p from "../../../components/data-table/DataTableRow.vue.js";
import s from "../../../components/data-table/DataTableHeader.vue.js";
const N = /* @__PURE__ */ B({
__name: "RequestTable",
props: {
data: {},
hasCheckboxDisabled: { type: Boolean },
invalidParams: {},
label: {},
showUploadButton: { type: Boolean },
showAddRowPlaceholder: { type: Boolean, default: !0 },
environment: {}
},
emits: ["upsertRow", "deleteRow", "uploadFile", "removeFile", "navigate"],
setup(e, { emit: b }) {
const t = b, w = f(() => e.showUploadButton ? ["36px", "", "", "auto"] : ["36px", "", ""]), h = f(() => {
if (!e.showAddRowPlaceholder)
return e.data;
const i = e.data.at(-1);
return !i || i.name !== "" || i.value !== "" ? [...e.data, { name: "", value: "", isDisabled: !0 }] : e.data;
});
return (i, c) => (r(), v(o(y), {
class: "group/table flex-1",
columns: w.value
}, {
default: n(() => [
u(o(p), { class: "sr-only !block" }, {
default: n(() => [
u(o(s), null, {
default: n(() => [
d(m(e.label) + " Enabled", 1)
]),
_: 1
}),
u(o(s), null, {
default: n(() => [
d(m(e.label) + " Key", 1)
]),
_: 1
}),
u(o(s), null, {
default: n(() => [
d(m(e.label) + " Value", 1)
]),
_: 1
})
]),
_: 1
}),
(r(!0), D(k, null, F(h.value, (R, l) => (r(), v(U, {
key: l,
data: R,
environment: e.environment,
hasCheckboxDisabled: e.hasCheckboxDisabled,
invalidParams: e.invalidParams,
label: e.label,
showUploadButton: e.showUploadButton,
onDeleteRow: (a) => t("deleteRow", l),
onNavigate: c[0] || (c[0] = (a) => t("navigate", a)),
onRemoveFile: (a) => t("removeFile", l),
onUploadFile: (a) => t("uploadFile", l),
onUpsertRow: (a) => t("upsertRow", l, a)
}, null, 8, ["data", "environment", "hasCheckboxDisabled", "invalidParams", "label", "showUploadButton", "onDeleteRow", "onRemoveFile", "onUploadFile", "onUpsertRow"]))), 128))
]),
_: 1
}, 8, ["columns"]));
}
});
export {
N as default
};