bootstrap-vue-wrapper
Version:
Bootstrap 5 components in Vue3 wrapper.
1,285 lines (1,284 loc) • 30.4 kB
JavaScript
import { defineComponent as m, resolveComponent as E, openBlock as a, createElementBlock as i, createElementVNode as s, Fragment as b, renderList as y, normalizeClass as h, createBlock as w, withCtx as H, createTextVNode as S, toDisplayString as l, renderSlot as g, ref as C, createCommentVNode as u, mergeProps as k, resolveDirective as M, withDirectives as R, pushScopeId as A, popScopeId as L } from "vue";
import { useI18n as N } from "vue-i18n";
import { Toast as B, Modal as P, Offcanvas as V } from "bootstrap";
const O = m({
name: "BsBreadcrumb",
props: {
/**
* List of breadcrumb items.
*/
items: {
type: Array,
required: !0
}
},
methods: {
/**
* Is route available
*
* @param item
* @returns {boolean}
*/
isRouteAvailable(e) {
return e.route !== void 0;
}
}
}), c = (e, t) => {
const r = e.__vccOpts || e;
for (const [d, v] of t)
r[d] = v;
return r;
}, _ = { "aria-label": "breadcrumb" }, D = { class: "breadcrumb" }, q = ["textContent"];
function T(e, t, r, d, v, f) {
const o = E("router-link");
return a(), i("nav", _, [
s("ol", D, [
(a(!0), i(b, null, y(e.items, (n, p) => (a(), i("li", {
key: p,
class: h(["breadcrumb-item", { active: !e.isRouteAvailable(n) }])
}, [
e.isRouteAvailable(n) ? (a(), w(o, {
key: 0,
to: n.route
}, {
default: H(() => [
S(l(n.title), 1)
]),
_: 2
}, 1032, ["to"])) : (a(), i("span", {
key: 1,
textContent: l(n.title)
}, null, 8, q))
], 2))), 128))
])
]);
}
const rt = /* @__PURE__ */ c(O, [["render", T]]), F = m({
name: "BsForm",
emits: ["submit"],
data() {
return {
submitClicked: !1
};
},
methods: {
/**
* On submit event.
*
* @param event
*/
onSubmit(e) {
e.preventDefault(), this.submitClicked = !0, this.$emit("submit", e);
}
}
});
function z(e, t, r, d, v, f) {
return a(), i("form", {
class: h(["needs-validation", {
"was-validated": e.submitClicked
}]),
novalidate: "",
onSubmit: t[0] || (t[0] = (...o) => e.onSubmit && e.onSubmit(...o))
}, [
g(e.$slots, "default")
], 34);
}
const dt = /* @__PURE__ */ c(F, [["render", z]]);
function I(e) {
const { t } = N(), r = C(null);
function d(n) {
const p = e.value;
p !== null && (n !== null ? p.setCustomValidity(n) : p.setCustomValidity(""), r.value = v(p));
}
function v(n) {
if (n.validity.valueMissing)
return t("validator.error.value_missing");
if (n.validity.tooShort)
return t("validator.error.too_short", [n.minLength]);
if (n.validity.tooLong)
return t("validator.error.too_long", [n.maxLength]);
if (n.validity.rangeUnderflow)
return t("validator.error.range_underflow", [n.min]);
if (n.validity.rangeOverflow)
return t("validator.error.range_overflow", [n.max]);
if (n.validity.typeMismatch) {
if (n.type === "email")
return t("validator.error.type_mismatch.email");
if (n.type === "url")
return t("validator.error.type_mismatch.url");
}
if (n.validity.badInput) {
if (n.type === "number")
return t("validator.error.bad_input.number");
if (n.type === "date")
return t("validator.error.bad_input.date");
}
if (n.validity.patternMismatch)
return t("validator.error.pattern_mismatch");
if (n.validity.stepMismatch) {
const p = Math.floor(Number(n.value) / Number(n.step)) * Number(n.step), $ = Math.ceil(Number(n.value) / Number(n.step)) * Number(n.step);
return t("validator.error.step_mismatch", [p, $]);
}
return n.validity.customError ? n.validationMessage : null;
}
function f(n) {
n.target !== null && (r.value = v(n.target));
}
function o() {
return r.value;
}
return {
onInvalid: f,
getInvalidMessage: o,
setCustomError: d
};
}
const j = m({
name: "BsInput",
props: {
/**
* Value for v-model
*/
modelValue: {
type: [String, Number],
default: null
},
/**
* Html id
*/
id: {
type: String,
required: !0
},
/**
* Label for input
*/
label: {
type: String,
default: void 0
},
/**
* Attribute hint
*/
hint: {
type: String,
default: void 0
},
/**
* Enable or disable validator
*/
validatorEnabled: {
type: Boolean,
default: !0
}
},
emits: ["update:modelValue"],
setup() {
const e = C(null);
return {
inputRef: e,
validator: I(e)
};
},
methods: {
/**
* Hint id is generated
*/
getHintId() {
return this.id + "Hint";
},
/**
* On input event
*
* @param event
*/
onInput(e) {
const t = e.target;
this.$emit("update:modelValue", t.value);
},
/**
* On invalid event
*
* @param event
*/
onInvalid(e) {
this.validatorEnabled && this.validator.onInvalid(e);
}
}
}), U = ["for", "textContent"], G = ["id", "value", "aria-describedby"], J = ["textContent"], K = ["id", "textContent"];
function Q(e, t, r, d, v, f) {
return a(), i(b, null, [
e.label !== void 0 ? (a(), i("label", {
key: 0,
for: e.id,
class: "form-label",
textContent: l(e.label)
}, null, 8, U)) : u("", !0),
s("input", k({
id: e.id,
ref: "inputRef",
value: e.modelValue,
class: "form-control"
}, e.$attrs, {
"aria-describedby": e.hint !== void 0 ? e.getHintId() : void 0,
onInput: t[0] || (t[0] = (...o) => e.onInput && e.onInput(...o)),
onInvalid: t[1] || (t[1] = (...o) => e.onInvalid && e.onInvalid(...o))
}), null, 16, G),
e.validatorEnabled && e.validator.getInvalidMessage() !== null ? (a(), i("div", {
key: 1,
class: "invalid-feedback",
textContent: l(e.validator.getInvalidMessage())
}, null, 8, J)) : u("", !0),
e.hint !== void 0 ? (a(), i("div", {
key: 2,
id: e.getHintId(),
class: "form-text",
textContent: l(e.hint)
}, null, 8, K)) : u("", !0)
], 64);
}
const ut = /* @__PURE__ */ c(j, [["render", Q]]), W = m({
name: "BsCheckbox",
props: {
/**
* Value for checkbox if v-model is array.
*/
value: {
type: String,
default: null
},
/**
* Value for v-model
*/
modelValue: {
type: [Array, Boolean],
default: null
},
/**
* Html id
*/
id: {
type: String,
required: !0
},
/**
* Label for input
*/
label: {
type: String,
default: void 0
},
/**
* Attribute hint
*/
hint: {
type: String,
default: void 0
},
/**
* Input container div class.
*/
classContainer: {
type: String,
default: void 0
},
/**
* Enable or disable validator
*/
validatorEnabled: {
type: Boolean,
default: !0
}
},
emits: ["update:modelValue"],
setup() {
const e = C(null);
return {
inputRef: e,
validator: I(e)
};
},
computed: {
/**
* Checkbox is checked or not.
*/
isChecked() {
return this.modelValue instanceof Array ? this.modelValue.includes(this.value) : this.modelValue === !0;
}
},
methods: {
/**
* Hint id is generated
*/
getHintId() {
return this.id + "Hint";
},
/**
* On input event
*
* @param event
*/
onInput(e) {
const r = e.target.checked;
if (this.modelValue instanceof Array) {
const d = [...this.modelValue];
r ? d.push(this.value) : d.splice(d.indexOf(this.value), 1), this.$emit("update:modelValue", d);
} else
this.$emit("update:modelValue", r);
},
/**
* On invalid event
*
* @param event
*/
onInvalid(e) {
this.validatorEnabled && this.validator.onInvalid(e);
}
}
}), X = ["id", "value", "checked", "aria-describedby"], Y = ["for", "textContent"], Z = ["textContent"], x = ["id", "textContent"];
function ee(e, t, r, d, v, f) {
return a(), i("div", {
class: h(["form-check", e.classContainer])
}, [
s("input", k({
id: e.id,
ref: "inputRef",
value: e.modelValue
}, e.$attrs, {
type: "checkbox",
class: "form-check-input",
checked: e.isChecked,
"aria-describedby": e.hint !== void 0 ? e.getHintId() : void 0,
onInput: t[0] || (t[0] = (...o) => e.onInput && e.onInput(...o)),
onInvalid: t[1] || (t[1] = (...o) => e.onInvalid && e.onInvalid(...o))
}), null, 16, X),
e.label !== void 0 ? (a(), i("label", {
key: 0,
for: e.id,
class: "form-check-label",
textContent: l(e.label)
}, null, 8, Y)) : u("", !0),
e.validatorEnabled && e.validator.getInvalidMessage() !== null ? (a(), i("div", {
key: 1,
class: "invalid-feedback",
textContent: l(e.validator.getInvalidMessage())
}, null, 8, Z)) : u("", !0),
e.hint !== void 0 ? (a(), i("div", {
key: 2,
id: e.getHintId(),
class: "form-text",
textContent: l(e.hint)
}, null, 8, x)) : u("", !0)
], 2);
}
const vt = /* @__PURE__ */ c(W, [["render", ee]]), te = m({
name: "BsTextarea",
props: {
/**
* Value for v-model
*/
modelValue: {
type: [String, Number],
default: null
},
/**
* Html id
*/
id: {
type: String,
required: !0
},
/**
* Label for textarea
*/
label: {
type: String,
default: void 0
},
/**
* Attribute hint
*/
hint: {
type: String,
default: void 0
},
/**
* Enable or disable validator
*/
validatorEnabled: {
type: Boolean,
default: !0
}
},
emits: ["update:modelValue"],
setup() {
const e = C(null);
return {
inputRef: e,
validator: I(e)
};
},
methods: {
/**
* Hint id is generated
*/
getHintId() {
return this.id + "Hint";
},
/**
* On input event
*
* @param event
*/
onInput(e) {
const t = e.target;
this.$emit("update:modelValue", t.value);
},
/**
* On invalid event
*
* @param event
*/
onInvalid(e) {
this.validatorEnabled && this.validator.onInvalid(e);
}
}
}), ne = ["for", "textContent"], ae = ["id", "value", "aria-describedby"], ie = ["textContent"], oe = ["id", "textContent"];
function se(e, t, r, d, v, f) {
return a(), i(b, null, [
e.label !== void 0 ? (a(), i("label", {
key: 0,
for: e.id,
class: "form-label",
textContent: l(e.label)
}, null, 8, ne)) : u("", !0),
s("textarea", k({
id: e.id,
ref: "inputRef",
value: e.modelValue
}, e.$attrs, {
class: "form-control",
"aria-describedby": e.hint !== void 0 ? e.getHintId() : void 0,
onInput: t[0] || (t[0] = (...o) => e.onInput && e.onInput(...o)),
onInvalid: t[1] || (t[1] = (...o) => e.onInvalid && e.onInvalid(...o))
}), null, 16, ae),
e.validatorEnabled && e.validator.getInvalidMessage() !== null ? (a(), i("div", {
key: 1,
class: "invalid-feedback",
textContent: l(e.validator.getInvalidMessage())
}, null, 8, ie)) : u("", !0),
e.hint !== void 0 ? (a(), i("div", {
key: 2,
id: e.getHintId(),
class: "form-text",
textContent: l(e.hint)
}, null, 8, oe)) : u("", !0)
], 64);
}
const ht = /* @__PURE__ */ c(te, [["render", se]]), le = m({
name: "BsPaginator",
props: {
/**
* Total count of items.
*/
totalCount: {
type: Number,
required: !0
},
/**
* Page size
*/
pageSize: {
type: Number,
required: !0
},
/**
* Current page
*/
currentPage: {
type: Number,
required: !0
},
/**
* Max visible page
*/
maxVisiblePage: {
type: Number,
default: 5
},
/**
* First page label
*/
firstPageLabel: {
type: String,
default: "«"
},
/**
* Previous page label
*/
previousPageLabel: {
type: String,
default: "‹"
},
/**
* Next page label
*/
nextPageLabel: {
type: String,
default: "›"
},
/**
* Last page label
*/
lastPageLabel: {
type: String,
default: "»"
}
},
emits: ["pageChanged"],
methods: {
/**
* Count of pages
*
* @returns {number}
*/
getPageCount() {
return Math.ceil(this.totalCount / this.pageSize);
},
/**
* Visible page list
*
* @returns {*[]}
*/
getVisiblePages() {
const e = [], t = this.getPageRange();
for (let r = t.beginPage; r <= t.endPage; r += 1)
e.push(r + 1);
return e;
},
/**
* Is page active, or not
*
* @param page
* @returns {boolean}
*/
isPageActive(e) {
return e === this.currentPage;
},
/**
* On page click
*/
onPageClick(e) {
this.isPageActive(e) || this.$emit("pageChanged", e);
},
/**
* Page range, example: 3 available page, current page 3, range is: [1, 3] (zero-based)
*
* @returns {{beginPage: number, endPage: number}}
*/
getPageRange() {
let e = Math.max(0, this.currentPage - this.maxVisiblePage / 2), t = e + this.maxVisiblePage - 1;
return t >= this.getPageCount() && (t = this.getPageCount() - 1, e = Math.max(0, t - this.maxVisiblePage + 1)), {
beginPage: Math.floor(e),
endPage: Math.floor(t)
};
}
}
}), re = { class: "pagination" }, de = ["textContent"], ue = ["textContent"], ve = ["onClick", "textContent"], he = ["textContent"], fe = ["textContent"];
function pe(e, t, r, d, v, f) {
return a(), i("nav", null, [
s("ul", re, [
s("li", {
class: h(["page-item page-item-first", { disabled: e.isPageActive(1) }])
}, [
s("div", {
class: "page-link",
onClick: t[0] || (t[0] = (o) => e.onPageClick(1)),
textContent: l(e.firstPageLabel)
}, null, 8, de)
], 2),
s("li", {
class: h(["page-item page-item-previous", { disabled: e.isPageActive(1) }])
}, [
s("div", {
class: "page-link",
onClick: t[1] || (t[1] = (o) => e.onPageClick(e.currentPage - 1)),
textContent: l(e.previousPageLabel)
}, null, 8, ue)
], 2),
(a(!0), i(b, null, y(e.getVisiblePages(), (o, n) => (a(), i("li", {
key: n,
class: h(["page-item page-item-number", {
active: e.isPageActive(o)
}])
}, [
s("div", {
class: "page-link",
onClick: (p) => e.onPageClick(o),
textContent: l(o)
}, null, 8, ve)
], 2))), 128)),
s("li", {
class: h(["page-item page-item-next", { disabled: e.isPageActive(e.getPageCount()) }])
}, [
s("div", {
class: "page-link",
onClick: t[2] || (t[2] = (o) => e.onPageClick(e.currentPage + 1)),
textContent: l(e.nextPageLabel)
}, null, 8, he)
], 2),
s("li", {
class: h(["page-item page-item-last", { disabled: e.isPageActive(e.getPageCount()) }])
}, [
s("div", {
class: "page-link",
onClick: t[3] || (t[3] = (o) => e.onPageClick(e.getPageCount())),
textContent: l(e.lastPageLabel)
}, null, 8, fe)
], 2)
])
]);
}
const ft = /* @__PURE__ */ c(le, [["render", pe], ["__scopeId", "data-v-ff85ae67"]]), me = m({
name: "BsTable",
props: {
/**
* Field list
*/
fields: {
type: Array,
required: !0
},
/**
* Item list
*/
items: {
type: Array,
required: !0
},
/**
* Items loading
*/
isLoading: {
type: Boolean,
default: !1
},
/**
* Order by field name
*/
orderBy: {
type: String,
default: void 0
},
/**
* Sort is descending or ascending
*/
sortDesc: {
type: Boolean,
default: void 0
},
/**
* th element css lass
*/
thClass: {
type: String,
default: void 0
},
/**
* td element css class
*/
tdClass: {
type: String,
default: void 0
}
},
emits: ["orderChanged"],
methods: {
/**
* Is order by active by field?
*
* @param fieldKey
* @returns {boolean}
*/
isActiveOrderBy(e) {
return e === this.orderBy;
},
/**
* Is field sortable?
*
* @param field
* @returns {boolean}
*/
isSortableField(e) {
return e.sort === void 0 || e.sort;
},
/**
* Sort icon class.
*
* @returns {string}
*/
getSortIconClass() {
if (this.sortDesc === void 0)
throw new Error("Sort desc value is null, cannot calculate the sort icon!");
return this.sortDesc ? "bi bi-caret-up-fill" : "bi bi-caret-down-fill";
},
/**
* Calcuate sort desc value on click
* Returns null if there is no sortDesc value.
*/
calcSortDesc(e) {
return this.sortDesc === void 0 ? null : this.isOrderByChanged(e) ? !1 : !this.sortDesc;
},
/**
* Is order by changed?
*/
isOrderByChanged(e) {
return this.orderBy !== e;
},
/**
* Table head clicked.
*/
onHeadClick(e) {
this.isSortableField(e) && this.$emit("orderChanged", { sortDesc: this.calcSortDesc(e.key), orderBy: e.key });
}
}
}), ce = (e) => (A("data-v-b32962df"), e = e(), L(), e), ge = { class: "table" }, be = ["onClick"], $e = { key: 0 }, ye = ["colspan"], Ce = /* @__PURE__ */ ce(() => /* @__PURE__ */ s("div", { class: "d-flex justify-content-center p-2" }, [
/* @__PURE__ */ s("div", { class: "spinner-border spinner-border-sm" })
], -1)), ke = { key: 1 }, Ie = ["colspan"], Se = { class: "text-center text-muted small" };
function Be(e, t, r, d, v, f) {
const o = M("t");
return a(), i("table", ge, [
s("thead", null, [
s("tr", null, [
(a(!0), i(b, null, y(e.fields, (n) => (a(), i("th", {
key: n.key,
class: h({
"cursor-pointer": e.isSortableField(n),
"text-decoration-underline": e.isActiveOrderBy(n.key),
thClass: e.thClass
}),
onClick: (p) => e.onHeadClick(n)
}, [
g(e.$slots, "tr", {}, () => [
S(l(n.label) + " ", 1),
e.isActiveOrderBy(n.key) && e.sortDesc !== void 0 ? (a(), i("i", {
key: 0,
class: h(e.getSortIconClass())
}, null, 2)) : u("", !0)
], !0)
], 10, be))), 128))
])
]),
s("tbody", null, [
e.isLoading ? (a(), i("tr", $e, [
s("td", {
colspan: e.fields.length
}, [
g(e.$slots, "loading", {}, () => [
Ce
], !0)
], 8, ye)
])) : e.items.length === 0 ? (a(), i("tr", ke, [
s("td", {
colspan: e.fields.length
}, [
g(e.$slots, "empty", {}, () => [
R(s("div", Se, null, 512), [
[o, "table.empty_text"]
])
], !0)
], 8, Ie)
])) : (a(!0), i(b, { key: 2 }, y(e.items, (n, p) => (a(), i("tr", {
key: p,
class: h(n.trClass)
}, [
(a(!0), i(b, null, y(e.fields, ($) => (a(), i("td", {
key: $.key,
class: h(e.tdClass)
}, [
g(e.$slots, "td", {
key: p,
field: $.key,
row: n,
value: $.key in n ? n[$.key] : null
}, () => [
S(l(n[$.key]), 1)
], !0)
], 2))), 128))
], 2))), 128))
])
]);
}
const pt = /* @__PURE__ */ c(me, [["render", Be], ["__scopeId", "data-v-b32962df"]]), Pe = m({
name: "BsToast",
emits: ["shown", "hidden"],
mounted() {
const e = this.$refs.toastRef;
B.getOrCreateInstance(e).show(), e.addEventListener("shown.bs.toast", this.onShown), e.addEventListener("hidden.bs.toast", this.onHidden);
},
methods: {
/**
* Trigger toast hide event.
*/
hide() {
const e = this.$refs.toastRef;
B.getOrCreateInstance(e).hide();
},
/**
* Hidden event.
*/
onShown() {
this.$emit("shown");
},
/**
* Hidden event.
*/
onHidden() {
this.$emit("hidden");
}
}
}), Ve = {
ref: "toastRef",
class: "toast hide",
role: "alert",
"aria-live": "assertive",
"aria-atomic": "true"
};
function Ee(e, t, r, d, v, f) {
return a(), i("div", Ve, [
g(e.$slots, "default")
], 512);
}
const mt = /* @__PURE__ */ c(Pe, [["render", Ee]]), we = m({
name: "BsModal",
props: {
/**
* Modal title
*/
title: {
type: String,
required: !0
},
classDialog: {
type: [String, Object],
default: null
},
hideHeader: {
type: Boolean,
default: !1
},
hideBody: {
type: Boolean,
default: !1
},
hideFooter: {
type: Boolean,
default: !1
}
},
emits: ["shown", "hidden"],
mounted() {
const e = this.$refs.modalRef;
P.getOrCreateInstance(e).show(), e.addEventListener("shown.bs.modal", this.onShown), e.addEventListener("hidden.bs.modal", this.onHidden);
},
methods: {
/**
* Trigger modal hide event.
*/
hide() {
const e = this.$refs.modalRef;
P.getOrCreateInstance(e).hide();
},
/**
* Shown event.
*/
onShown() {
this.$emit("shown");
},
/**
* Hidden event.
*/
onHidden() {
this.$emit("hidden");
}
}
}), He = {
ref: "modalRef",
class: "modal fade",
tabindex: "-1"
}, Me = { class: "modal-content" }, Re = {
key: 0,
class: "modal-header"
}, Ae = ["textContent"], Le = /* @__PURE__ */ s("button", {
type: "button",
class: "btn-close",
"data-bs-dismiss": "modal"
}, null, -1), Ne = {
key: 1,
class: "modal-body"
}, Oe = {
key: 2,
class: "modal-footer"
};
function _e(e, t, r, d, v, f) {
return a(), i("div", He, [
s("div", {
class: h(["modal-dialog", e.classDialog])
}, [
s("div", Me, [
e.hideHeader ? u("", !0) : (a(), i("div", Re, [
g(e.$slots, "header", {}, () => [
s("div", {
class: "h5 modal-title",
textContent: l(e.title)
}, null, 8, Ae),
Le
])
])),
e.hideBody ? u("", !0) : (a(), i("div", Ne, [
g(e.$slots, "body")
])),
e.hideFooter ? u("", !0) : (a(), i("div", Oe, [
g(e.$slots, "footer")
]))
])
], 2)
], 512);
}
const ct = /* @__PURE__ */ c(we, [["render", _e]]), De = m({
name: "BsSelect",
props: {
/**
* Value for v-model
*/
modelValue: {
type: [String, Number, Array],
default: null
},
/**
* Html id
*/
id: {
type: String,
required: !0
},
/**
* Label for input
*/
label: {
type: String,
default: void 0
},
/**
* Attribute hint
*/
hint: {
type: String,
default: void 0
},
/**
* Options
*/
options: {
type: Array,
required: !0
},
/**
* Placeholder
*/
placeholder: {
type: String,
default: void 0
},
/**
* Enable or disable validator
*/
validatorEnabled: {
type: Boolean,
default: !0
}
},
emits: ["update:modelValue"],
setup() {
const e = C(null);
return {
inputRef: e,
validator: I(e)
};
},
methods: {
/**
* Hint id is generated
*/
getHintId() {
return this.id + "Hint";
},
/**
* On input event
*
* @param event
*/
onInput(e) {
const t = e.target;
this.$emit("update:modelValue", t.value);
},
/**
* On invalid event
*
* @param event
*/
onInvalid(e) {
this.validatorEnabled && this.validator.onInvalid(e);
}
}
}), qe = ["for", "textContent"], Te = ["id", "value", "aria-labelledby"], Fe = {
key: 0,
value: "",
disabled: "",
hidden: ""
}, ze = ["value", "disabled"], je = ["textContent"], Ue = ["id", "textContent"];
function Ge(e, t, r, d, v, f) {
return a(), i(b, null, [
e.label !== void 0 ? (a(), i("label", {
key: 0,
for: e.id,
class: "form-label",
textContent: l(e.label)
}, null, 8, qe)) : u("", !0),
s("select", k({
id: e.id,
ref: "inputRef",
class: "form-select",
value: e.modelValue,
"aria-labelledby": e.hint !== void 0 ? e.getHintId() : void 0
}, e.$attrs, {
onInput: t[0] || (t[0] = (...o) => e.onInput && e.onInput(...o)),
onInvalid: t[1] || (t[1] = (...o) => e.onInvalid && e.onInvalid(...o))
}), [
e.placeholder !== void 0 ? (a(), i("option", Fe, l(e.placeholder), 1)) : u("", !0),
(a(!0), i(b, null, y(e.options, (o, n) => (a(), i("option", {
key: n,
value: o.value,
disabled: o.disabled !== void 0 && o.disabled
}, l(o.text), 9, ze))), 128))
], 16, Te),
e.validatorEnabled && e.validator.getInvalidMessage() !== null ? (a(), i("div", {
key: 1,
class: "invalid-feedback",
textContent: l(e.validator.getInvalidMessage())
}, null, 8, je)) : u("", !0),
e.hint !== void 0 ? (a(), i("div", {
key: 2,
id: e.getHintId(),
class: "form-text",
textContent: l(e.hint)
}, null, 8, Ue)) : u("", !0)
], 64);
}
const gt = /* @__PURE__ */ c(De, [["render", Ge]]), Je = m({
name: "BsRadio",
props: {
/**
* Radio value
*/
value: {
type: [String, Number],
default: null
},
/**
* Value for v-model
*/
modelValue: {
type: [String, Number],
default: null
},
/**
* Html id
*/
id: {
type: String,
required: !0
},
/**
* Label for input
*/
label: {
type: String,
default: void 0
},
/**
* Attribute hint
*/
hint: {
type: String,
default: void 0
},
/**
* Input container div class.
*/
classContainer: {
type: String,
default: void 0
},
/**
* Enable or disable validator
*/
validatorEnabled: {
type: Boolean,
default: !0
}
},
emits: ["update:modelValue"],
setup() {
const e = C(null);
return {
inputRef: e,
validator: I(e)
};
},
computed: {
/**
* Radio is checked or not.
*/
isChecked() {
return this.modelValue === this.value;
}
},
methods: {
/**
* Hint id is generated
*/
getHintId() {
return this.id + "Hint";
},
/**
* On input event
*/
onInput() {
this.$emit("update:modelValue", this.value);
},
/**
* On invalid event
*
* @param event
*/
onInvalid(e) {
this.validatorEnabled && this.validator.onInvalid(e);
}
}
}), Ke = ["id", "value", "checked", "aria-describedby"], Qe = ["for", "textContent"], We = ["textContent"], Xe = ["id", "textContent"];
function Ye(e, t, r, d, v, f) {
return a(), i("div", {
class: h(["form-check", e.classContainer])
}, [
s("input", k({
id: e.id,
ref: "inputRef",
value: e.modelValue
}, e.$attrs, {
type: "radio",
class: "form-check-input",
checked: e.isChecked,
"aria-describedby": e.hint !== void 0 ? e.getHintId() : void 0,
onInput: t[0] || (t[0] = (...o) => e.onInput && e.onInput(...o)),
onInvalid: t[1] || (t[1] = (...o) => e.onInvalid && e.onInvalid(...o))
}), null, 16, Ke),
e.label !== void 0 ? (a(), i("label", {
key: 0,
for: e.id,
class: "form-check-label",
textContent: l(e.label)
}, null, 8, Qe)) : u("", !0),
e.validatorEnabled && e.validator.getInvalidMessage() !== null ? (a(), i("div", {
key: 1,
class: "invalid-feedback",
textContent: l(e.validator.getInvalidMessage())
}, null, 8, We)) : u("", !0),
e.hint !== void 0 ? (a(), i("div", {
key: 2,
id: e.getHintId(),
class: "form-text",
textContent: l(e.hint)
}, null, 8, Xe)) : u("", !0)
], 2);
}
const bt = /* @__PURE__ */ c(Je, [["render", Ye]]), Ze = m({
name: "BsOffcanvas",
props: {
/**
* Offcanvas title
*/
title: {
type: String,
required: !0
}
},
emits: ["shown", "hidden"],
mounted() {
const e = this.$refs.offcanvasRef;
V.getOrCreateInstance(e).show(), e.addEventListener("shown.bs.offcanvas", this.onShown), e.addEventListener("hidden.bs.offcanvas", this.onHidden);
},
methods: {
/**
* Trigger offcanvas hide event.
*/
hide() {
const e = this.$refs.offcanvasRef;
V.getOrCreateInstance(e).hide();
},
/**
* Shown event.
*/
onShown() {
this.$emit("shown");
},
/**
* Hidden event.
*/
onHidden() {
this.$emit("hidden");
}
}
}), xe = {
ref: "offcanvasRef",
class: "offcanvas",
tabindex: "-1",
"aria-labelledby": "offcanvasTitle"
}, et = { class: "offcanvas-header" }, tt = ["textContent"], nt = /* @__PURE__ */ s("button", {
type: "button",
class: "btn-close text-reset",
"data-bs-dismiss": "offcanvas"
}, null, -1), at = { class: "offcanvas-body" };
function it(e, t, r, d, v, f) {
return a(), i("div", xe, [
s("div", et, [
g(e.$slots, "header", {}, () => [
s("div", {
id: "offcanvasTitle",
class: "h5 mb-0",
textContent: l(e.title)
}, null, 8, tt),
nt
])
]),
s("div", at, [
g(e.$slots, "body")
])
], 512);
}
const $t = /* @__PURE__ */ c(Ze, [["render", it]]);
export {
rt as BsBreadcrumb,
vt as BsCheckbox,
dt as BsForm,
ut as BsInput,
ct as BsModal,
$t as BsOffcanvas,
ft as BsPaginator,
bt as BsRadio,
gt as BsSelect,
pt as BsTable,
ht as BsTextarea,
mt as BsToast,
I as useValidator
};