tedir-select
Advanced tools
Comparing version 0.0.1-beta-10 to 0.0.1-beta-11
@@ -1,3 +0,3 @@ | ||
import { defineComponent as T, ref as k, watch as z, computed as B, openBlock as o, createElementBlock as i, normalizeClass as j, createElementVNode as d, normalizeStyle as x, toDisplayString as m, unref as g, Fragment as N, withDirectives as R, withModifiers as V, vShow as W, renderList as L, renderSlot as A, pushScopeId as E, popScopeId as H, reactive as D, createTextVNode as F, withKeys as K, vModelText as U } from "vue"; | ||
const P = (n) => (E("data-v-9d6782b2"), n = n(), H(), n), q = { class: "pickerWrap" }, G = { class: "pickerContent" }, J = { class: "pickerHeader" }, Q = { | ||
import { defineComponent as T, ref as g, watch as z, computed as B, openBlock as o, createElementBlock as i, normalizeClass as w, createElementVNode as d, normalizeStyle as x, toDisplayString as m, unref as b, Fragment as S, withDirectives as R, withModifiers as O, vShow as W, renderList as L, renderSlot as A, pushScopeId as E, popScopeId as H, reactive as D, createTextVNode as F, withKeys as K, vModelText as U } from "vue"; | ||
const P = (r) => (E("data-v-9d6782b2"), r = r(), H(), r), q = { class: "pickerWrap" }, G = { class: "pickerContent" }, J = { class: "pickerHeader" }, Q = { | ||
key: 0, | ||
@@ -7,3 +7,3 @@ class: "tedirSelectLoading" | ||
X | ||
], Z = ["onClick"], ee = { class: "check" }, le = ["checked", "id"], te = ["for"], ae = ["onClick"], se = { class: "check" }, ue = ["checked", "id"], ne = ["for"], re = ["onClick"], ce = ["onClick"], oe = ["onClick"], ie = ["onClick"], de = /* @__PURE__ */ T({ | ||
], Z = ["onClick"], ee = { class: "check" }, le = ["checked", "id"], te = ["for"], ae = ["onClick"], se = { class: "check" }, ue = ["checked", "id"], re = ["for"], ne = ["onClick"], ce = ["onClick"], oe = ["onClick"], ie = ["onClick"], de = /* @__PURE__ */ T({ | ||
__name: "SelectBox", | ||
@@ -24,24 +24,24 @@ props: { | ||
emits: ["update:modelValue", "change", "search"], | ||
setup(n, { emit: h }) { | ||
const u = n, e = k(u.modelValue || {}), v = k(!1), f = k(""), y = k(null), I = k(void 0); | ||
z(() => u.modelValue, () => { | ||
e.value = u.modelValue; | ||
setup(r, { emit: h }) { | ||
const t = r, e = g(t.modelValue || {}), v = g(!1), f = g(""), y = g(null), j = g(void 0); | ||
z(() => t.modelValue, () => { | ||
e.value = t.modelValue; | ||
}); | ||
const b = () => { | ||
clearTimeout(I.value), I.value = setTimeout(() => { | ||
var s, a; | ||
f.value = "", ((s = y.value) == null ? void 0 : s.value) && ((a = y.value) == null ? void 0 : a.value) !== "" && (f.value = y.value.value), h("search", f.value); | ||
const $ = () => { | ||
clearTimeout(j.value), j.value = setTimeout(() => { | ||
var s, u; | ||
f.value = "", ((s = y.value) == null ? void 0 : s.value) && ((u = y.value) == null ? void 0 : u.value) !== "" && (f.value = y.value.value), h("search", f.value); | ||
}, 500); | ||
}, C = B(() => { | ||
let s = u.options; | ||
return f.value.length >= 1 && (s = s.filter((a) => { | ||
if (isNaN(a) === !1 && Number(a) === Number(f.value)) | ||
}, k = B(() => { | ||
let s = t.options; | ||
return f.value.length >= 1 && (s = s.filter((u) => { | ||
if (isNaN(u) === !1 && Number(u) === Number(f.value)) | ||
return !0; | ||
if (typeof a == "string" && a.toLowerCase().includes(f.value.toLowerCase())) | ||
if (typeof u == "string" && u.toLowerCase().includes(f.value.toLowerCase())) | ||
return !0; | ||
if (typeof a == "object" && a !== null && Object.prototype.toString.call(a) === "[object Object]") | ||
for (const t of Object.keys(a)) { | ||
if (isNaN(a[t]) === !1 && Number(a[t]) === Number(f.value)) | ||
if (typeof u == "object" && u !== null && Object.prototype.toString.call(u) === "[object Object]") | ||
for (const a of Object.keys(u)) { | ||
if (isNaN(u[a]) === !1 && Number(u[a]) === Number(f.value)) | ||
return !0; | ||
if (typeof a[t] == "string" && a[t].toLowerCase().includes(f.value.toLowerCase())) | ||
if (typeof u[a] == "string" && u[a].toLowerCase().includes(f.value.toLowerCase())) | ||
return !0; | ||
@@ -51,31 +51,31 @@ } | ||
})), s; | ||
}), _ = ((s = 10) => { | ||
let a = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", t = ""; | ||
for (let w = 0; w < s; w++) | ||
t += a.charAt(Math.floor(Math.random() * a.length)); | ||
return t; | ||
})(), $ = (s) => { | ||
var a; | ||
s.target.style.display = "none", v.value = !1, (a = y.value) != null && a.value && (y.value.value = "", f.value = ""); | ||
}), I = ((s = 10) => { | ||
let u = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", a = ""; | ||
for (let V = 0; V < s; V++) | ||
a += u.charAt(Math.floor(Math.random() * u.length)); | ||
return a; | ||
})(), N = (s) => { | ||
var u; | ||
s.target.style.display = "none", v.value = !1, (u = y.value) != null && u.value && (y.value.value = "", f.value = ""); | ||
}, p = (s) => { | ||
e.value = s, h("update:modelValue", e.value), h("change", e.value, s), v.value = !1; | ||
}, r = (s, a = "") => { | ||
a !== "" ? e.value.map((t) => t[a]).includes(s[a]) ? e.value.splice(e.value.findIndex((t) => t[a] === s[a]), 1) : e.value.push(s) : e.value.includes(s) ? e.value.splice(e.value.findIndex((t) => t === s), 1) : e.value.push(s), h("update:modelValue", e.value), h("change", e.value, s); | ||
}, n = (s, u = "") => { | ||
u !== "" ? e.value.map((a) => a[u]).includes(s[u]) ? e.value.splice(e.value.findIndex((a) => a[u] === s[u]), 1) : e.value.push(s) : e.value.includes(s) ? e.value.splice(e.value.findIndex((a) => a === s), 1) : e.value.push(s), h("update:modelValue", e.value), h("change", e.value, s); | ||
}, l = (s) => { | ||
typeof s == "object" && s !== null && String(u.datatype).toLowerCase() === "string" ? (e.value = s[String(u.dataprop || u.prop)], h("update:modelValue", String(e.value))) : typeof s == "object" && s !== null && String(u.datatype).toLowerCase() === "number" ? (e.value = s[String(u.dataprop || u.prop)], h("update:modelValue", Number(e.value))) : (e.value = s, h("update:modelValue", e.value)), v.value = !1, h("change", e.value, s); | ||
typeof s == "object" && s !== null && String(t.datatype).toLowerCase() === "string" ? (e.value = s[String(t.dataprop || t.prop)], h("update:modelValue", String(e.value))) : typeof s == "object" && s !== null && String(t.datatype).toLowerCase() === "number" ? (e.value = s[String(t.dataprop || t.prop)], h("update:modelValue", Number(e.value))) : (e.value = s, h("update:modelValue", e.value)), v.value = !1, h("change", e.value, s); | ||
}, c = B(() => { | ||
let s = (u == null ? void 0 : u.placeholder) || "-- Select option --"; | ||
if (C.value.length >= 1) | ||
let s = (t == null ? void 0 : t.placeholder) || "-- Select option --"; | ||
if (k.value.length >= 1) | ||
if (typeof e.value == "number") { | ||
let a = C.value.filter((t) => Number(t[String(u.dataprop || u.prop)]) === Number(e.value)); | ||
typeof C.value[0] == "object" && a.length >= 1 ? s = a[0][String(u.prop)] : typeof C.value[0] == "number" && (s = e.value); | ||
let u = k.value.filter((a) => Number(a[String(t.dataprop || t.prop)]) === Number(e.value)); | ||
typeof k.value[0] == "object" && u.length >= 1 ? s = u[0][String(t.prop)] : typeof k.value[0] == "number" && (s = e.value); | ||
} else if (typeof e.value == "string") { | ||
let a = C.value.filter((t) => String(t[String(u.dataprop || u.prop)]) === e.value); | ||
typeof C.value[0] == "object" && a.length >= 1 ? s = a[0][String(u.prop)] : typeof C.value[0] == "string" && e.value !== "" && (s = e.value); | ||
let u = k.value.filter((a) => String(a[String(t.dataprop || t.prop)]) === e.value); | ||
typeof k.value[0] == "object" && u.length >= 1 ? s = u[0][String(t.prop)] : typeof k.value[0] == "string" && e.value !== "" && (s = e.value); | ||
} else | ||
typeof e.value == "object" && (Array.isArray(e.value) && e.value.length >= 1 ? typeof e.value[0] == "object" && String(u.prop) in e.value[0] ? s = e.value.map((a) => a[String(u.prop)]).join(", ") : s = e.value.join(", ") : e.value !== null && String(u.prop) in e.value && (s = e.value[String(u.prop)])); | ||
typeof e.value == "object" && (Array.isArray(e.value) && e.value.length >= 1 ? typeof e.value[0] == "object" && String(t.prop) in e.value[0] ? s = e.value.map((u) => u[String(t.prop)]).join(", ") : s = e.value.join(", ") : e.value !== null && String(t.prop) in e.value && (s = e.value[String(t.prop)])); | ||
return s; | ||
}); | ||
return (s, a) => (o(), i("div", { | ||
class: j(["picker suggestion", { active: v.value, pickerUp: n.up }]) | ||
return (s, u) => (o(), i("div", { | ||
class: w(["picker suggestion", { active: v.value, pickerUp: r.up }]) | ||
}, [ | ||
@@ -85,3 +85,3 @@ d("div", { | ||
style: x({ display: v.value ? "block" : "none" }), | ||
onClick: $ | ||
onClick: N | ||
}, null, 4), | ||
@@ -91,4 +91,4 @@ d("div", q, [ | ||
class: "select pickerToggler", | ||
onClick: a[0] || (a[0] = (t) => v.value = !v.value) | ||
}, m(g(c)), 1), | ||
onClick: u[0] || (u[0] = (a) => v.value = !v.value) | ||
}, m(b(c)), 1), | ||
d("div", G, [ | ||
@@ -100,24 +100,24 @@ d("div", J, [ | ||
ref: y, | ||
onInput: b, | ||
onInput: $, | ||
class: "input" | ||
}, null, 544) | ||
]), | ||
n.loading ? (o(), i("div", Q, Y)) : (o(), i(N, { key: 1 }, [ | ||
r.loading ? (o(), i("div", Q, Y)) : (o(), i(S, { key: 1 }, [ | ||
Array.isArray(e.value) ? (o(), i("div", { | ||
key: 0, | ||
class: "pickerMenu", | ||
style: x({ "max-height": Number(n.size) !== 0 ? Number(n.size) * 42 + "px" : "auto" }) | ||
style: x({ "max-height": Number(r.size) !== 0 ? Number(r.size) * 42 + "px" : "auto" }) | ||
}, [ | ||
R(d("div", { | ||
onClick: a[1] || (a[1] = V((t) => p(typeof n.modelValue == "object" ? Array.isArray(n.modelValue) ? [] : {} : ""), ["stop"])), | ||
onClick: u[1] || (u[1] = O((a) => p(typeof r.modelValue == "object" ? Array.isArray(r.modelValue) ? [] : {} : ""), ["stop"])), | ||
class: "pickerItem" | ||
}, m(n.placeholder || "-- Select Option --"), 513), [ | ||
[W, n.defaultOption] | ||
}, m(r.placeholder || "-- Select Option --"), 513), [ | ||
[W, r.defaultOption] | ||
]), | ||
(o(!0), i(N, null, L(g(C), (t, w) => (o(), i(N, { | ||
key: "option-" + t | ||
(o(!0), i(S, null, L(b(k), (a, V) => (o(), i(S, { | ||
key: "option-" + a | ||
}, [ | ||
typeof t == "string" && n.type !== "slot" ? (o(), i("div", { | ||
typeof a == "string" && r.type !== "slot" ? (o(), i("div", { | ||
key: 0, | ||
onClick: V((O) => r(t), ["stop"]), | ||
onClick: O((_) => n(a), ["stop"]), | ||
class: "pickerItem" | ||
@@ -129,4 +129,4 @@ }, [ | ||
class: "checkInput", | ||
checked: e.value.includes(t), | ||
id: "check-" + (g(_) + String(w)), | ||
checked: e.value.includes(a), | ||
id: "check-" + (b(I) + String(V)), | ||
style: { "pointer-events": "none" } | ||
@@ -136,9 +136,9 @@ }, null, 8, le), | ||
class: "checkLabel", | ||
for: "check-" + (g(_) + String(w)), | ||
for: "check-" + (b(I) + String(V)), | ||
style: { "pointer-events": "none" } | ||
}, m(t), 9, te) | ||
}, m(a), 9, te) | ||
]) | ||
], 8, Z)) : typeof t == "object" && t !== null && n.prop in t && n.type !== "slot" ? (o(), i("div", { | ||
], 8, Z)) : typeof a == "object" && a !== null && r.prop in a && r.type !== "slot" ? (o(), i("div", { | ||
key: 1, | ||
onClick: V((O) => r(t, n.prop), ["stop"]), | ||
onClick: O((_) => n(a, r.prop), ["stop"]), | ||
class: "pickerItem" | ||
@@ -150,4 +150,4 @@ }, [ | ||
class: "checkInput", | ||
checked: e.value.includes(t), | ||
id: "check-" + (g(_) + String(w)), | ||
checked: e.value.includes(a), | ||
id: "check-" + (b(I) + String(V)), | ||
style: { "pointer-events": "none" } | ||
@@ -157,16 +157,16 @@ }, null, 8, ue), | ||
class: "checkLabel", | ||
for: "check-" + (g(_) + String(w)), | ||
for: "check-" + (b(I) + String(V)), | ||
style: { "pointer-events": "none" } | ||
}, m(t[n.prop]), 9, ne) | ||
}, m(a[r.prop]), 9, re) | ||
]) | ||
], 8, ae)) : (o(), i("div", { | ||
key: 2, | ||
onClick: V((O) => r(t), ["stop"]), | ||
onClick: O((_) => n(a), ["stop"]), | ||
class: "pickerItem" | ||
}, [ | ||
A(s.$slots, "default", { | ||
option: t, | ||
option: a, | ||
selected: e.value | ||
}, void 0, !0) | ||
], 8, re)) | ||
], 8, ne)) | ||
], 64))), 128)) | ||
@@ -176,28 +176,28 @@ ], 4)) : (o(), i("div", { | ||
class: "pickerMenu", | ||
style: x({ "max-height": Number(n.size) !== 0 ? Number(n.size) * 42 + "px" : "auto" }) | ||
style: x({ "max-height": Number(r.size) !== 0 ? Number(r.size) * 42 + "px" : "auto" }) | ||
}, [ | ||
R(d("div", { | ||
onClick: a[2] || (a[2] = V((t) => p(typeof n.modelValue == "object" ? Array.isArray(n.modelValue) ? [] : {} : ""), ["stop"])), | ||
onClick: u[2] || (u[2] = O((a) => p(typeof r.modelValue == "object" ? Array.isArray(r.modelValue) ? [] : {} : ""), ["stop"])), | ||
class: "pickerItem" | ||
}, m(n.placeholder || "-- Select Option --"), 513), [ | ||
[W, n.defaultOption] | ||
}, m(r.placeholder || "-- Select Option --"), 513), [ | ||
[W, r.defaultOption] | ||
]), | ||
(o(!0), i(N, null, L(g(C), (t, w) => (o(), i(N, { | ||
key: "option-" + t | ||
(o(!0), i(S, null, L(b(k), (a, V) => (o(), i(S, { | ||
key: "option-" + a | ||
}, [ | ||
typeof t == "string" && n.type !== "slot" ? (o(), i("div", { | ||
typeof a == "string" && r.type !== "slot" ? (o(), i("div", { | ||
key: 0, | ||
onClick: (O) => l(t), | ||
class: j(["pickerItem", e.value === t ? "active" : ""]) | ||
}, m(t), 11, ce)) : typeof t == "object" && t !== null && n.prop in t && n.type !== "slot" ? (o(), i("div", { | ||
onClick: (_) => l(a), | ||
class: w(["pickerItem", e.value === a ? "active" : ""]) | ||
}, m(a), 11, ce)) : typeof a == "object" && a !== null && r.prop in a && r.type !== "slot" ? (o(), i("div", { | ||
key: 1, | ||
onClick: (O) => l(t), | ||
class: j(["pickerItem", e.value[n.prop] === t[n.prop] || String(t[n.dataprop || n.prop]) === String(e.value) ? "active" : ""]) | ||
}, m(t[n.prop]), 11, oe)) : (o(), i("div", { | ||
onClick: (_) => l(a), | ||
class: w(["pickerItem", e.value[r.prop] === a[r.prop] || String(a[r.dataprop || r.prop]) === String(e.value) ? "active" : ""]) | ||
}, m(a[r.prop]), 11, oe)) : (o(), i("div", { | ||
key: 2, | ||
onClick: V((O) => l(t), ["stop"]), | ||
class: j(["pickerItem", e.value === t ? "active" : ""]) | ||
onClick: O((_) => l(a), ["stop"]), | ||
class: w(["pickerItem", e.value === a ? "active" : ""]) | ||
}, [ | ||
A(s.$slots, "default", { | ||
option: t, | ||
option: a, | ||
selected: e.value | ||
@@ -214,7 +214,7 @@ }, void 0, !0) | ||
}); | ||
const M = (n, h) => { | ||
const u = n.__vccOpts || n; | ||
const M = (r, h) => { | ||
const t = r.__vccOpts || r; | ||
for (const [e, v] of h) | ||
u[e] = v; | ||
return u; | ||
t[e] = v; | ||
return t; | ||
}, vl = /* @__PURE__ */ M(de, [["__scopeId", "data-v-9d6782b2"]]), ve = { class: "pickerWrap" }, fe = ["value", "placeholder"], pe = ["value", "placeholder"], he = { class: "pickerContent pickerSizing" }, ye = ["onClick"], ke = ["onClick"], ge = ["onClick"], be = /* @__PURE__ */ T({ | ||
@@ -228,3 +228,3 @@ __name: "ComboBox", | ||
dataprop: { default: "" }, | ||
placeholder: { default: "-- Search option --" }, | ||
placeholder: { default: "-- Search Option --" }, | ||
size: { default: 0 }, | ||
@@ -237,10 +237,11 @@ select: { type: Boolean, default: !1 }, | ||
emits: ["update:modelValue", "change", "search"], | ||
setup(n, { emit: h }) { | ||
const u = n, e = k(u.modelValue || {}), v = k(!1), f = k(""), y = k(null), I = k(void 0); | ||
z(() => u.modelValue, () => { | ||
e.value = u.modelValue; | ||
setup(r, { emit: h }) { | ||
const t = r, e = g(t.modelValue || {}), v = g(!1), f = g(""), y = g(null), j = g(void 0), $ = g(!1); | ||
z(() => t.modelValue, () => { | ||
var n, l; | ||
e.value = t.modelValue, typeof t.modelValue == "string" || isNaN(t.modelValue) === !1 ? (f.value = t.modelValue, y.value.value = t.modelValue) : (typeof ((n = t.modelValue) == null ? void 0 : n[String(t.dataprop || t.prop)]) == "string" || isNaN((l = t.modelValue) == null ? void 0 : l[String(t.dataprop || t.prop)]) === !1) && (f.value = t.modelValue[String(t.dataprop || t.prop)], y.value.value = t.modelValue[String(t.dataprop || t.prop)]), t.emptySearch == !0 && (f.value = "", y.value.value = "", h("search", f.value)); | ||
}); | ||
const b = B(() => { | ||
let r = u.options; | ||
return f.value.length >= 1 && u.serverSearch !== !0 && (r = r.filter((l) => { | ||
const k = B(() => { | ||
let n = t.options; | ||
return f.value.length >= 1 && t.serverSearch !== !0 && (n = n.filter((l) => { | ||
if (isNaN(l) === !1 && Number(l) === Number(f.value)) | ||
@@ -258,31 +259,30 @@ return !0; | ||
return !1; | ||
})), r; | ||
})), n; | ||
}), C = () => { | ||
clearTimeout(I.value), I.value = setTimeout(() => { | ||
var r, l; | ||
f.value = "", ((r = y.value) == null ? void 0 : r.value) && ((l = y.value) == null ? void 0 : l.value) !== "" && (f.value = y.value.value), h("search", f.value), b.value.length >= 1 && f.value !== "" || u.serverSearch == !0 ? v.value = !0 : v.value = !1; | ||
clearTimeout(j.value), j.value = setTimeout(() => { | ||
var n, l; | ||
f.value = "", ((n = y.value) == null ? void 0 : n.value) && ((l = y.value) == null ? void 0 : l.value) !== "" && (f.value = y.value.value), h("search", f.value), k.value.length >= 1 && $.value === !0 || t.serverSearch == !0 ? v.value = !0 : v.value = !1; | ||
}, 500); | ||
}, S = (r, l) => { | ||
(typeof r == "string" || isNaN(r) === !1) && (f.value = r, y.value.value = r), u.emptySearch == !0 && (f.value = "", y.value.value = "", h("search", f.value)), typeof l == "object" && l !== null && String(u.datatype).toLowerCase() === "string" ? (e.value = l[String(u.dataprop || u.prop)], h("update:modelValue", String(e.value))) : typeof l == "object" && l !== null && String(u.datatype).toLowerCase() === "number" ? (e.value = l[String(u.dataprop || u.prop)], h("update:modelValue", Number(e.value))) : (e.value = l, h("update:modelValue", e.value)), h("change", r, l), v.value = !1; | ||
}, _ = (r) => { | ||
r.target.style.display = "none", v.value = !1; | ||
}, $ = k(!1), p = B(() => { | ||
let r = ""; | ||
if (b.value.length >= 1 && $.value === !1) | ||
}, I = (n, l) => { | ||
(typeof n == "string" || isNaN(n) === !1) && (f.value = n, y.value.value = n), t.emptySearch == !0 && (f.value = "", y.value.value = "", h("search", f.value)), typeof l == "object" && l !== null && String(t.datatype).toLowerCase() === "string" ? (e.value = l[String(t.dataprop || t.prop)], h("update:modelValue", String(e.value))) : typeof l == "object" && l !== null && String(t.datatype).toLowerCase() === "number" ? (e.value = l[String(t.dataprop || t.prop)], h("update:modelValue", Number(e.value))) : (e.value = l, h("update:modelValue", e.value)), h("change", n, l), v.value = !1; | ||
}, N = (n) => { | ||
n.target.style.display = "none", v.value = !1; | ||
}, p = B(() => { | ||
var l; | ||
let n = ""; | ||
if (k.value.length >= 1 && $.value !== !0 && t.emptySearch !== !0) | ||
if (typeof e.value == "number") { | ||
let l = b.value.filter((c) => Number(c[String(u.dataprop || u.prop)]) === Number(e.value)); | ||
typeof b.value[0] == "object" && l.length >= 1 ? r = l[0][String(u.prop)] : typeof b.value[0] == "number" && (r = e.value); | ||
let c = k.value.filter((s) => Number(s[String(t.dataprop || t.prop)]) === Number(e.value)); | ||
typeof k.value[0] == "object" && c.length >= 1 ? n = c[0][String(t.prop)] : typeof k.value[0] == "number" && (n = e.value); | ||
} else if (typeof e.value == "string") { | ||
let l = b.value.filter((c) => String(c[String(u.dataprop || u.prop)]) === e.value); | ||
typeof b.value[0] == "object" && l.length >= 1 ? r = l[0][String(u.prop)] : typeof b.value[0] == "string" && e.value !== "" && (r = e.value); | ||
let c = k.value.filter((s) => String(s[String(t.dataprop || t.prop)]) === e.value); | ||
typeof k.value[0] == "object" && c.length >= 1 ? n = c[0][String(t.prop)] : typeof k.value[0] == "string" && e.value !== "" && (n = e.value); | ||
} else | ||
typeof e.value == "object" && (Array.isArray(e.value) && e.value.length >= 1 ? typeof e.value[0] == "object" && String(u.prop) in e.value[0] ? r = e.value.map((l) => l[String(u.prop)]).join(", ") : r = e.value.join(", ") : e.value !== null && String(u.prop) in e.value && (r = e.value[String(u.prop)])); | ||
typeof e.value == "object" && (Array.isArray(e.value) && e.value.length >= 1 ? typeof e.value[0] == "object" && String(t.prop) in e.value[0] ? n = e.value.map((c) => c[String(t.prop)]).join(", ") : n = e.value.join(", ") : e.value !== null && String(t.prop) in e.value && (n = e.value[String(t.prop)])); | ||
else | ||
y.value.value && $.value === !0 && (r = y.value.value); | ||
return r; | ||
((l = y.value) == null ? void 0 : l.value) && $.value === !0 && t.emptySearch !== !0 && (n = y.value.value); | ||
return n; | ||
}); | ||
return (r, l) => (o(), i("div", { | ||
class: j(["picker suggestion", { active: v.value, pickerUp: n.up }]), | ||
onMouseenter: l[2] || (l[2] = V((c) => $.value = !0, ["self"])), | ||
onMouseleave: l[3] || (l[3] = V((c) => $.value = !1, ["self"])) | ||
return (n, l) => (o(), i("div", { | ||
class: w(["picker suggestion", { active: v.value, pickerUp: r.up }]) | ||
}, [ | ||
@@ -292,9 +292,9 @@ d("div", { | ||
style: x({ display: v.value ? "block" : "none" }), | ||
onClick: _ | ||
onClick: N | ||
}, null, 4), | ||
d("div", ve, [ | ||
n.select ? (o(), i("input", { | ||
r.select ? (o(), i("input", { | ||
key: 0, | ||
type: "search", | ||
value: g(p), | ||
value: b(p), | ||
ref_key: "searchRef", | ||
@@ -304,17 +304,21 @@ ref: y, | ||
onClick: l[0] || (l[0] = (c) => v.value = !0), | ||
onFocus: l[1] || (l[1] = (c) => $.value = !0), | ||
onBlur: l[2] || (l[2] = (c) => $.value = !1), | ||
class: "select", | ||
placeholder: n.placeholder | ||
placeholder: r.placeholder | ||
}, null, 40, fe)) : (o(), i("input", { | ||
key: 1, | ||
type: "search", | ||
value: g(p), | ||
value: b(p), | ||
ref_key: "searchRef", | ||
ref: y, | ||
onInput: C, | ||
onClick: l[1] || (l[1] = (c) => g(b).length >= 1 && f.value !== "" ? v.value = !0 : v.value = !1), | ||
onClick: l[3] || (l[3] = (c) => b(k).length >= 1 && f.value !== "" ? v.value = !0 : v.value = !1), | ||
onFocus: l[4] || (l[4] = (c) => $.value = !0), | ||
onBlur: l[5] || (l[5] = (c) => $.value = !1), | ||
class: "input", | ||
placeholder: n.placeholder | ||
placeholder: r.placeholder | ||
}, null, 40, pe)), | ||
d("div", he, [ | ||
(o(!0), i(N, null, L(g(b), (c, s) => (o(), i(N, { | ||
(o(!0), i(S, null, L(b(k), (c, s) => (o(), i(S, { | ||
key: "option-" + c | ||
@@ -324,14 +328,14 @@ }, [ | ||
key: 0, | ||
onClick: (a) => S(c, c), | ||
class: j(["pickerItem", n.modelValue === c ? "active" : ""]) | ||
}, m(c), 11, ye)) : typeof c == "object" && n.prop in c ? (o(), i("div", { | ||
onClick: (u) => I(c, c), | ||
class: w(["pickerItem", r.modelValue === c ? "active" : ""]) | ||
}, m(c), 11, ye)) : typeof c == "object" && r.prop in c ? (o(), i("div", { | ||
key: 1, | ||
onClick: (a) => S(c[n.prop], c), | ||
class: j(["pickerItem", n.modelValue[n.prop] === c[n.prop] ? "active" : ""]) | ||
}, m(c[n.prop]), 11, ke)) : (o(), i("div", { | ||
onClick: (u) => I(c[r.prop], c), | ||
class: w(["pickerItem", r.modelValue[r.prop] === c[r.prop] ? "active" : ""]) | ||
}, m(c[r.prop]), 11, ke)) : (o(), i("div", { | ||
key: 2, | ||
onClick: (a) => S(c, c), | ||
class: j(["pickerItem", n.modelValue === c ? "active" : ""]) | ||
onClick: (u) => I(c, c), | ||
class: w(["pickerItem", r.modelValue === c ? "active" : ""]) | ||
}, [ | ||
A(r.$slots, "default", { option: c }, void 0, !0) | ||
A(n.$slots, "default", { option: c }, void 0, !0) | ||
], 10, ge)) | ||
@@ -341,6 +345,6 @@ ], 64))), 128)) | ||
]) | ||
], 34)); | ||
], 2)); | ||
} | ||
}); | ||
const fl = /* @__PURE__ */ M(be, [["__scopeId", "data-v-af106d79"]]), Ce = { class: "list" }, me = { class: "listHeader" }, Se = ["onClick"], $e = { class: "check" }, Ne = ["checked", "id"], we = ["for"], je = ["onClick"], Ve = { class: "check" }, Ie = ["checked", "id"], _e = ["for"], Oe = ["onClick"], xe = ["onClick"], Le = ["onClick"], Be = ["onClick"], Ae = /* @__PURE__ */ T({ | ||
const fl = /* @__PURE__ */ M(be, [["__scopeId", "data-v-fd87e445"]]), me = { class: "list" }, Ce = { class: "listHeader" }, Se = ["onClick"], $e = { class: "check" }, Ne = ["checked", "id"], Ve = ["for"], we = ["onClick"], je = { class: "check" }, Ie = ["checked", "id"], Oe = ["for"], _e = ["onClick"], xe = ["onClick"], Le = ["onClick"], Be = ["onClick"], Ae = /* @__PURE__ */ T({ | ||
__name: "ListBox", | ||
@@ -356,24 +360,24 @@ props: { | ||
emits: ["update:modelValue", "change", "search"], | ||
setup(n, { emit: h }) { | ||
const u = n, e = k(u.modelValue || {}), v = k(""), f = k(null), y = k(void 0); | ||
z(() => u.modelValue, () => { | ||
e.value = u.modelValue; | ||
setup(r, { emit: h }) { | ||
const t = r, e = g(t.modelValue || {}), v = g(""), f = g(null), y = g(void 0); | ||
z(() => t.modelValue, () => { | ||
e.value = t.modelValue; | ||
}); | ||
const I = () => { | ||
const j = () => { | ||
clearTimeout(y.value), y.value = setTimeout(() => { | ||
var p, r; | ||
v.value = "", ((p = f.value) == null ? void 0 : p.value) && ((r = f.value) == null ? void 0 : r.value) !== "" && (v.value = f.value.value), h("search", v.value); | ||
var p, n; | ||
v.value = "", ((p = f.value) == null ? void 0 : p.value) && ((n = f.value) == null ? void 0 : n.value) !== "" && (v.value = f.value.value), h("search", v.value); | ||
}, 500); | ||
}, b = B(() => { | ||
let p = u.options; | ||
return v.value.length >= 1 && (p = p.filter((r) => { | ||
if (isNaN(r) === !1 && Number(r) === Number(v.value)) | ||
}, $ = B(() => { | ||
let p = t.options; | ||
return v.value.length >= 1 && (p = p.filter((n) => { | ||
if (isNaN(n) === !1 && Number(n) === Number(v.value)) | ||
return !0; | ||
if (typeof r == "string" && r.toLowerCase().includes(v.value.toLowerCase())) | ||
if (typeof n == "string" && n.toLowerCase().includes(v.value.toLowerCase())) | ||
return !0; | ||
if (typeof r == "object" && r !== null && Object.prototype.toString.call(r) === "[object Object]") | ||
for (const l of Object.keys(r)) { | ||
if (isNaN(r[l]) === !1 && Number(r[l]) === Number(v.value)) | ||
if (typeof n == "object" && n !== null && Object.prototype.toString.call(n) === "[object Object]") | ||
for (const l of Object.keys(n)) { | ||
if (isNaN(n[l]) === !1 && Number(n[l]) === Number(v.value)) | ||
return !0; | ||
if (typeof r[l] == "string" && r[l].toLowerCase().includes(v.value.toLowerCase())) | ||
if (typeof n[l] == "string" && n[l].toLowerCase().includes(v.value.toLowerCase())) | ||
return !0; | ||
@@ -383,15 +387,15 @@ } | ||
})), p; | ||
}), S = (() => { | ||
let p = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", r = ""; | ||
}), C = (() => { | ||
let p = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", n = ""; | ||
for (let l = 0; l < 10; l++) | ||
r += p.charAt(Math.floor(Math.random() * p.length)); | ||
return r; | ||
})(), _ = (p, r = "") => { | ||
r !== "" ? e.value.map((l) => l[r]).includes(p[r]) ? e.value.splice(e.value.findIndex((l) => l[r] === p[r]), 1) : e.value.push(p) : e.value.includes(p) ? e.value.splice(e.value.findIndex((l) => l === p), 1) : e.value.push(p), h("update:modelValue", e.value), h("change", e.value, p); | ||
}, $ = (p) => { | ||
typeof p == "object" && p !== null && String(u.datatype).toLowerCase() === "string" ? (e.value = p[String(u.dataprop || u.prop)], h("update:modelValue", String(e.value))) : typeof p == "object" && p !== null && String(u.datatype).toLowerCase() === "number" ? (e.value = p[String(u.dataprop || u.prop)], h("update:modelValue", Number(e.value))) : (e.value = p, h("update:modelValue", e.value)), h("change", e.value, p); | ||
n += p.charAt(Math.floor(Math.random() * p.length)); | ||
return n; | ||
})(), I = (p, n = "") => { | ||
n !== "" ? e.value.map((l) => l[n]).includes(p[n]) ? e.value.splice(e.value.findIndex((l) => l[n] === p[n]), 1) : e.value.push(p) : e.value.includes(p) ? e.value.splice(e.value.findIndex((l) => l === p), 1) : e.value.push(p), h("update:modelValue", e.value), h("change", e.value, p); | ||
}, N = (p) => { | ||
typeof p == "object" && p !== null && String(t.datatype).toLowerCase() === "string" ? (e.value = p[String(t.dataprop || t.prop)], h("update:modelValue", String(e.value))) : typeof p == "object" && p !== null && String(t.datatype).toLowerCase() === "number" ? (e.value = p[String(t.dataprop || t.prop)], h("update:modelValue", Number(e.value))) : (e.value = p, h("update:modelValue", e.value)), h("change", e.value, p); | ||
}; | ||
return (p, r) => (o(), i("div", null, [ | ||
d("div", Ce, [ | ||
d("div", me, [ | ||
return (p, n) => (o(), i("div", null, [ | ||
d("div", me, [ | ||
d("div", Ce, [ | ||
d("input", { | ||
@@ -401,12 +405,12 @@ type: "search", | ||
ref: f, | ||
onInput: I, | ||
onInput: j, | ||
class: "input" | ||
}, null, 544) | ||
]), | ||
Array.isArray(n.modelValue) ? (o(), i("div", { | ||
Array.isArray(r.modelValue) ? (o(), i("div", { | ||
key: 0, | ||
class: "listMenu", | ||
style: x({ "max-height": Number(n.size) !== 0 ? Number(n.size) * 44 + "px" : "auto" }) | ||
style: x({ "max-height": Number(r.size) !== 0 ? Number(r.size) * 44 + "px" : "auto" }) | ||
}, [ | ||
(o(!0), i(N, null, L(g(b), (l, c) => (o(), i(N, { | ||
(o(!0), i(S, null, L(b($), (l, c) => (o(), i(S, { | ||
key: "option-" + l | ||
@@ -416,3 +420,3 @@ }, [ | ||
key: 0, | ||
onClick: V((s) => _(l), ["stop"]), | ||
onClick: O((s) => I(l), ["stop"]), | ||
class: "listItem" | ||
@@ -425,3 +429,3 @@ }, [ | ||
checked: e.value.includes(l), | ||
id: "check-" + (g(S) + String(c)), | ||
id: "check-" + (b(C) + String(c)), | ||
style: { "pointer-events": "none" } | ||
@@ -431,12 +435,12 @@ }, null, 8, Ne), | ||
class: "checkLabel", | ||
for: "check-" + (g(S) + String(c)), | ||
for: "check-" + (b(C) + String(c)), | ||
style: { "pointer-events": "none" } | ||
}, m(l), 9, we) | ||
}, m(l), 9, Ve) | ||
]) | ||
], 8, Se)) : typeof l == "object" && n.prop in l ? (o(), i("div", { | ||
], 8, Se)) : typeof l == "object" && r.prop in l ? (o(), i("div", { | ||
key: 1, | ||
onClick: V((s) => _(l, n.prop), ["stop"]), | ||
onClick: O((s) => I(l, r.prop), ["stop"]), | ||
class: "listItem" | ||
}, [ | ||
d("div", Ve, [ | ||
d("div", je, [ | ||
d("input", { | ||
@@ -446,3 +450,3 @@ type: "checkbox", | ||
checked: e.value.includes(l), | ||
id: "check-" + (g(S) + String(c)), | ||
id: "check-" + (b(C) + String(c)), | ||
style: { "pointer-events": "none" } | ||
@@ -452,10 +456,10 @@ }, null, 8, Ie), | ||
class: "checkLabel", | ||
for: "check-" + (g(S) + String(c)), | ||
for: "check-" + (b(C) + String(c)), | ||
style: { "pointer-events": "none" } | ||
}, m(l[n.prop]), 9, _e) | ||
}, m(l[r.prop]), 9, Oe) | ||
]) | ||
], 8, je)) : (o(), i("div", { | ||
], 8, we)) : (o(), i("div", { | ||
key: 2, | ||
onClick: V((s) => _(l), ["stop"]), | ||
class: j(["listItem", e.value.includes(l) ? "active" : ""]) | ||
onClick: O((s) => I(l), ["stop"]), | ||
class: w(["listItem", e.value.includes(l) ? "active" : ""]) | ||
}, [ | ||
@@ -466,3 +470,3 @@ A(p.$slots, "default", { | ||
}, void 0, !0) | ||
], 10, Oe)) | ||
], 10, _e)) | ||
], 64))), 128)) | ||
@@ -472,5 +476,5 @@ ], 4)) : (o(), i("div", { | ||
class: "listMenu", | ||
style: x({ "max-height": Number(n.size) !== 0 ? Number(n.size) * 44 + "px" : "auto" }) | ||
style: x({ "max-height": Number(r.size) !== 0 ? Number(r.size) * 44 + "px" : "auto" }) | ||
}, [ | ||
(o(!0), i(N, null, L(g(b), (l, c) => (o(), i(N, { | ||
(o(!0), i(S, null, L(b($), (l, c) => (o(), i(S, { | ||
key: "option-" + l | ||
@@ -480,12 +484,12 @@ }, [ | ||
key: 0, | ||
onClick: (s) => $(l), | ||
class: j(["listItem", e.value === l ? "active" : ""]) | ||
}, m(l), 11, xe)) : typeof l == "object" && n.prop in l ? (o(), i("div", { | ||
onClick: (s) => N(l), | ||
class: w(["listItem", e.value === l ? "active" : ""]) | ||
}, m(l), 11, xe)) : typeof l == "object" && r.prop in l ? (o(), i("div", { | ||
key: 1, | ||
onClick: (s) => $(l), | ||
class: j(["listItem", e.value[n.prop] === l[n.prop] || String(l[n.dataprop || n.prop]) === String(e.value) ? "active" : ""]) | ||
}, m(l[n.prop]), 11, Le)) : (o(), i("div", { | ||
onClick: (s) => N(l), | ||
class: w(["listItem", e.value[r.prop] === l[r.prop] || String(l[r.dataprop || r.prop]) === String(e.value) ? "active" : ""]) | ||
}, m(l[r.prop]), 11, Le)) : (o(), i("div", { | ||
key: 2, | ||
onClick: V((s) => $(l), ["stop"]), | ||
class: j(["listItem", e.value === l ? "active" : ""]) | ||
onClick: O((s) => N(l), ["stop"]), | ||
class: w(["listItem", e.value === l ? "active" : ""]) | ||
}, [ | ||
@@ -503,3 +507,3 @@ A(p.$slots, "default", { | ||
}); | ||
const pl = /* @__PURE__ */ M(Ae, [["__scopeId", "data-v-d7fed8bc"]]), Te = (n) => (E("data-v-3acd22f1"), n = n(), H(), n), ze = { class: "tagWrap" }, Me = { class: "tags" }, Re = { class: "tag groupItem" }, Fe = ["onClick"], We = /* @__PURE__ */ Te(() => /* @__PURE__ */ d("svg", { | ||
const pl = /* @__PURE__ */ M(Ae, [["__scopeId", "data-v-d7fed8bc"]]), Te = (r) => (E("data-v-3acd22f1"), r = r(), H(), r), ze = { class: "tagWrap" }, Me = { class: "tags" }, Re = { class: "tag groupItem" }, Fe = ["onClick"], We = /* @__PURE__ */ Te(() => /* @__PURE__ */ d("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -540,6 +544,6 @@ width: "16", | ||
emits: ["update:modelValue"], | ||
setup(n, { emit: h }) { | ||
const u = n, e = k(!1), v = k(""), f = k(null), y = D(u.modelValue || []), I = k(u.options || []), b = k(u.separator || ","), C = k(u.prop || "value"), S = B(() => { | ||
let r = I.value; | ||
return v.value.length >= 1 && (r = r.filter((l) => { | ||
setup(r, { emit: h }) { | ||
const t = r, e = g(!1), v = g(""), f = g(null), y = D(t.modelValue || []), j = g(t.options || []), $ = g(t.separator || ","), k = g(t.prop || "value"), C = B(() => { | ||
let n = j.value; | ||
return v.value.length >= 1 && (n = n.filter((l) => { | ||
if (isNaN(l) === !1 && Number(l) === Number(v.value)) | ||
@@ -557,9 +561,9 @@ return !0; | ||
return !1; | ||
})), r; | ||
}), _ = () => { | ||
})), n; | ||
}), I = () => { | ||
f.value.focus(); | ||
}, $ = (r) => { | ||
if (r.key !== "Enter" && S.value.length >= 1 ? e.value = !0 : e.value = !1, v.value.endsWith(b.value) || r.key === "Enter") { | ||
const l = v.value.replace(b.value, ""); | ||
y.includes(l) || (y.push(l), I.value.includes(l) && (I.value = I.value.filter((c) => typeof c == "string" && c !== l ? !0 : typeof c == "object" && C.value in c && c[C.value] !== l))), v.value = "", h("update:modelValue", y); | ||
}, N = (n) => { | ||
if (n.key !== "Enter" && C.value.length >= 1 ? e.value = !0 : e.value = !1, v.value.endsWith($.value) || n.key === "Enter") { | ||
const l = v.value.replace($.value, ""); | ||
y.includes(l) || (y.push(l), j.value.includes(l) && (j.value = j.value.filter((c) => typeof c == "string" && c !== l ? !0 : typeof c == "object" && k.value in c && c[k.value] !== l))), v.value = "", h("update:modelValue", y); | ||
} | ||
@@ -569,15 +573,15 @@ }; | ||
if (f.value !== null) { | ||
const r = document.createElement("div"); | ||
r.style.width = "max-content", r.style.position = "absolute", r.style.visibility = "hidden"; | ||
const n = document.createElement("div"); | ||
n.style.width = "max-content", n.style.position = "absolute", n.style.visibility = "hidden"; | ||
const l = v.value.length >= 2 ? v.value : f.value.getAttribute("placeholder"); | ||
r.innerHTML = l.replace(/ /g, " ").trim(), document.body.appendChild(r); | ||
const c = Math.ceil(Number(window.getComputedStyle(r).width.replace("px", ""))) + 30; | ||
f.value.style.setProperty("width", c + "px"), r.remove(); | ||
n.innerHTML = l.replace(/ /g, " ").trim(), document.body.appendChild(n); | ||
const c = Math.ceil(Number(window.getComputedStyle(n).width.replace("px", ""))) + 30; | ||
f.value.style.setProperty("width", c + "px"), n.remove(); | ||
} | ||
}); | ||
const p = (r) => { | ||
r.target.style.display = "none", e.value = !1; | ||
const p = (n) => { | ||
n.target.style.display = "none", e.value = !1; | ||
}; | ||
return (r, l) => (o(), i("div", { | ||
class: j(["taggable", { active: e.value === !0 }]) | ||
return (n, l) => (o(), i("div", { | ||
class: w(["taggable", { active: e.value === !0 }]) | ||
}, [ | ||
@@ -592,6 +596,6 @@ d("div", { | ||
class: "input tagToggler", | ||
onClick: _ | ||
onClick: I | ||
}, [ | ||
d("div", Me, [ | ||
(o(!0), i(N, null, L(y, (c, s) => (o(), i("div", { | ||
(o(!0), i(S, null, L(y, (c, s) => (o(), i("div", { | ||
key: "tag-" + s, | ||
@@ -601,8 +605,8 @@ class: "group" | ||
d("div", Re, [ | ||
typeof c == "string" && c !== "" ? (o(), i(N, { key: 0 }, [ | ||
typeof c == "string" && c !== "" ? (o(), i(S, { key: 0 }, [ | ||
F(m(c), 1) | ||
], 64)) : typeof c == "object" && C.value in c ? (o(), i(N, { key: 1 }, [ | ||
F(m(c[C.value]), 1) | ||
], 64)) : (o(), i(N, { key: 2 }, [ | ||
F(m(n.placeholder), 1) | ||
], 64)) : typeof c == "object" && k.value in c ? (o(), i(S, { key: 1 }, [ | ||
F(m(c[k.value]), 1) | ||
], 64)) : (o(), i(S, { key: 2 }, [ | ||
F(m(r.placeholder), 1) | ||
], 64)) | ||
@@ -612,3 +616,3 @@ ]), | ||
class: "tag groupItem", | ||
onClick: (a) => y.splice(s, 1) | ||
onClick: (u) => y.splice(s, 1) | ||
}, Ee, 8, Fe) | ||
@@ -622,4 +626,4 @@ ]))), 128)), | ||
class: "tagInput", | ||
onInput: l[1] || (l[1] = (c) => $(c)), | ||
onKeyup: l[2] || (l[2] = K((c) => $(c), ["enter"])), | ||
onInput: l[1] || (l[1] = (c) => N(c)), | ||
onKeyup: l[2] || (l[2] = K((c) => N(c), ["enter"])), | ||
placeholder: "Add new tag" | ||
@@ -632,3 +636,3 @@ }, null, 544), [ | ||
d("div", He, [ | ||
(o(!0), i(N, null, L(g(S), (c, s) => (o(), i(N, { | ||
(o(!0), i(S, null, L(b(C), (c, s) => (o(), i(S, { | ||
key: "option-" + c | ||
@@ -638,20 +642,20 @@ }, [ | ||
key: 0, | ||
onClick: (a) => { | ||
v.value = c + ",", $(a); | ||
onClick: (u) => { | ||
v.value = c + ",", N(u); | ||
}, | ||
class: "tagItem" | ||
}, m(c), 9, Ue)) : typeof c == "object" && C.value in c ? (o(), i("div", { | ||
}, m(c), 9, Ue)) : typeof c == "object" && k.value in c ? (o(), i("div", { | ||
key: 1, | ||
onClick: (a) => { | ||
v.value = c[C.value] + ",", $(a); | ||
onClick: (u) => { | ||
v.value = c[k.value] + ",", N(u); | ||
}, | ||
class: "tagItem" | ||
}, m(c[C.value]), 9, De)) : (o(), i("div", { | ||
}, m(c[k.value]), 9, De)) : (o(), i("div", { | ||
key: 2, | ||
onClick: (a) => { | ||
v.value = c + ",", $(a); | ||
onClick: (u) => { | ||
v.value = c + ",", N(u); | ||
}, | ||
class: "tagItem" | ||
}, [ | ||
A(r.$slots, "default", { option: c }, void 0, !0) | ||
A(n.$slots, "default", { option: c }, void 0, !0) | ||
], 8, Ke)) | ||
@@ -664,3 +668,3 @@ ], 64))), 128)) | ||
}); | ||
const hl = /* @__PURE__ */ M(Pe, [["__scopeId", "data-v-3acd22f1"]]), qe = { class: "pickerOverlay pickerWrap" }, Ge = { class: "pickerContent" }, Je = { class: "pickerHeader" }, Qe = ["onClick"], Xe = { class: "check" }, Ye = ["checked", "id"], Ze = ["for"], el = ["onClick"], ll = { class: "check" }, tl = ["checked", "id"], al = ["for"], sl = ["onClick"], ul = ["onClick"], nl = ["onClick"], rl = ["onClick"], cl = { class: "pickerFooter" }, ol = { class: "tedirCategoryAdd" }, il = /* @__PURE__ */ T({ | ||
const hl = /* @__PURE__ */ M(Pe, [["__scopeId", "data-v-3acd22f1"]]), qe = { class: "pickerOverlay pickerWrap" }, Ge = { class: "pickerContent" }, Je = { class: "pickerHeader" }, Qe = ["onClick"], Xe = { class: "check" }, Ye = ["checked", "id"], Ze = ["for"], el = ["onClick"], ll = { class: "check" }, tl = ["checked", "id"], al = ["for"], sl = ["onClick"], ul = ["onClick"], rl = ["onClick"], nl = ["onClick"], cl = { class: "pickerFooter" }, ol = { class: "tedirCategoryAdd" }, il = /* @__PURE__ */ T({ | ||
__name: "CategoryBox", | ||
@@ -678,24 +682,24 @@ props: { | ||
emits: ["update:modelValue", "change", "add", "search"], | ||
setup(n, { emit: h }) { | ||
const u = n, e = k(u.modelValue || {}), v = k(!1), f = k(""), y = k(null), I = k(void 0), b = k(""); | ||
z(() => u.modelValue, () => { | ||
e.value = u.modelValue; | ||
setup(r, { emit: h }) { | ||
const t = r, e = g(t.modelValue || {}), v = g(!1), f = g(""), y = g(null), j = g(void 0), $ = g(""); | ||
z(() => t.modelValue, () => { | ||
e.value = t.modelValue; | ||
}); | ||
const C = () => { | ||
clearTimeout(I.value), I.value = setTimeout(() => { | ||
var s, a; | ||
f.value = "", ((s = y.value) == null ? void 0 : s.value) && ((a = y.value) == null ? void 0 : a.value) !== "" && (f.value = y.value.value), h("search", f.value); | ||
const k = () => { | ||
clearTimeout(j.value), j.value = setTimeout(() => { | ||
var s, u; | ||
f.value = "", ((s = y.value) == null ? void 0 : s.value) && ((u = y.value) == null ? void 0 : u.value) !== "" && (f.value = y.value.value), h("search", f.value); | ||
}, 500); | ||
}, S = B(() => { | ||
let s = u.options; | ||
return f.value.length >= 1 && (s = s.filter((a) => { | ||
if (isNaN(a) === !1 && Number(a) === Number(f.value)) | ||
}, C = B(() => { | ||
let s = t.options; | ||
return f.value.length >= 1 && (s = s.filter((u) => { | ||
if (isNaN(u) === !1 && Number(u) === Number(f.value)) | ||
return !0; | ||
if (typeof a == "string" && a.toLowerCase().includes(f.value.toLowerCase())) | ||
if (typeof u == "string" && u.toLowerCase().includes(f.value.toLowerCase())) | ||
return !0; | ||
if (typeof a == "object" && a !== null && Object.prototype.toString.call(a) === "[object Object]") | ||
for (const t of Object.keys(a)) { | ||
if (isNaN(a[t]) === !1 && Number(a[t]) === Number(f.value)) | ||
if (typeof u == "object" && u !== null && Object.prototype.toString.call(u) === "[object Object]") | ||
for (const a of Object.keys(u)) { | ||
if (isNaN(u[a]) === !1 && Number(u[a]) === Number(f.value)) | ||
return !0; | ||
if (typeof a[t] == "string" && a[t].toLowerCase().includes(f.value.toLowerCase())) | ||
if (typeof u[a] == "string" && u[a].toLowerCase().includes(f.value.toLowerCase())) | ||
return !0; | ||
@@ -705,29 +709,29 @@ } | ||
})), s; | ||
}), $ = ((s = 10) => { | ||
let a = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", t = ""; | ||
for (let w = 0; w < s; w++) | ||
t += a.charAt(Math.floor(Math.random() * a.length)); | ||
return t; | ||
}), N = ((s = 10) => { | ||
let u = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", a = ""; | ||
for (let V = 0; V < s; V++) | ||
a += u.charAt(Math.floor(Math.random() * u.length)); | ||
return a; | ||
})(), p = (s) => { | ||
var a; | ||
s.target.style.display = "none", v.value = !1, (a = y.value) != null && a.value && (y.value.value = "", f.value = ""); | ||
}, r = (s, a = "") => { | ||
a !== "" ? e.value.map((t) => t[a]).includes(s[a]) ? e.value.splice(e.value.findIndex((t) => t[a] === s[a]), 1) : e.value.push(s) : e.value.includes(s) ? e.value.splice(e.value.findIndex((t) => t === s), 1) : e.value.push(s), h("update:modelValue", e.value), h("change", e.value, s); | ||
var u; | ||
s.target.style.display = "none", v.value = !1, (u = y.value) != null && u.value && (y.value.value = "", f.value = ""); | ||
}, n = (s, u = "") => { | ||
u !== "" ? e.value.map((a) => a[u]).includes(s[u]) ? e.value.splice(e.value.findIndex((a) => a[u] === s[u]), 1) : e.value.push(s) : e.value.includes(s) ? e.value.splice(e.value.findIndex((a) => a === s), 1) : e.value.push(s), h("update:modelValue", e.value), h("change", e.value, s); | ||
}, l = (s) => { | ||
typeof s == "object" && s !== null && String(u.datatype).toLowerCase() === "string" ? (e.value = s[String(u.dataprop || u.prop)], h("update:modelValue", String(e.value))) : typeof s == "object" && s !== null && String(u.datatype).toLowerCase() === "number" ? (e.value = s[String(u.dataprop || u.prop)], h("update:modelValue", Number(e.value))) : (e.value = s, h("update:modelValue", e.value)), v.value = !1, h("change", e.value, s); | ||
typeof s == "object" && s !== null && String(t.datatype).toLowerCase() === "string" ? (e.value = s[String(t.dataprop || t.prop)], h("update:modelValue", String(e.value))) : typeof s == "object" && s !== null && String(t.datatype).toLowerCase() === "number" ? (e.value = s[String(t.dataprop || t.prop)], h("update:modelValue", Number(e.value))) : (e.value = s, h("update:modelValue", e.value)), v.value = !1, h("change", e.value, s); | ||
}, c = B(() => { | ||
let s = (u == null ? void 0 : u.placeholder) || "-- Select option --"; | ||
if (S.value.length >= 1) | ||
let s = (t == null ? void 0 : t.placeholder) || "-- Select option --"; | ||
if (C.value.length >= 1) | ||
if (typeof e.value == "number") { | ||
let a = S.value.filter((t) => Number(t[String(u.dataprop || u.prop)]) === Number(e.value)); | ||
typeof S.value[0] == "object" && a.length >= 1 ? s = a[0][String(u.prop)] : typeof S.value[0] == "number" && (s = e.value); | ||
let u = C.value.filter((a) => Number(a[String(t.dataprop || t.prop)]) === Number(e.value)); | ||
typeof C.value[0] == "object" && u.length >= 1 ? s = u[0][String(t.prop)] : typeof C.value[0] == "number" && (s = e.value); | ||
} else if (typeof e.value == "string") { | ||
let a = S.value.filter((t) => String(t[String(u.dataprop || u.prop)]) === e.value); | ||
typeof S.value[0] == "object" && a.length >= 1 ? s = a[0][String(u.prop)] : typeof S.value[0] == "string" && e.value !== "" && (s = e.value); | ||
let u = C.value.filter((a) => String(a[String(t.dataprop || t.prop)]) === e.value); | ||
typeof C.value[0] == "object" && u.length >= 1 ? s = u[0][String(t.prop)] : typeof C.value[0] == "string" && e.value !== "" && (s = e.value); | ||
} else | ||
typeof e.value == "object" && (Array.isArray(e.value) && e.value.length >= 1 ? typeof e.value[0] == "object" && String(u.prop) in e.value[0] ? s = e.value.map((a) => a[String(u.prop)]).join(", ") : s = e.value.join(", ") : e.value !== null && String(u.prop) in e.value && (s = e.value[String(u.prop)])); | ||
typeof e.value == "object" && (Array.isArray(e.value) && e.value.length >= 1 ? typeof e.value[0] == "object" && String(t.prop) in e.value[0] ? s = e.value.map((u) => u[String(t.prop)]).join(", ") : s = e.value.join(", ") : e.value !== null && String(t.prop) in e.value && (s = e.value[String(t.prop)])); | ||
return s; | ||
}); | ||
return (s, a) => (o(), i("div", { | ||
class: j(["picker suggestion tedirCategory", { active: v.value, pickerUp: n.up }]) | ||
return (s, u) => (o(), i("div", { | ||
class: w(["picker suggestion tedirCategory", { active: v.value, pickerUp: r.up }]) | ||
}, [ | ||
@@ -742,4 +746,4 @@ d("div", { | ||
class: "select pickerToggler", | ||
onClick: a[0] || (a[0] = (t) => v.value = !v.value) | ||
}, m(g(c)), 1), | ||
onClick: u[0] || (u[0] = (a) => v.value = !v.value) | ||
}, m(b(c)), 1), | ||
d("div", Ge, [ | ||
@@ -751,3 +755,3 @@ d("div", Je, [ | ||
ref: y, | ||
onInput: C, | ||
onInput: k, | ||
class: "input" | ||
@@ -759,10 +763,10 @@ }, null, 544) | ||
class: "pickerMenu", | ||
style: x({ "max-height": Number(n.size) !== 0 ? Number(n.size) * 42 + "px" : "auto" }) | ||
style: x({ "max-height": Number(r.size) !== 0 ? Number(r.size) * 42 + "px" : "auto" }) | ||
}, [ | ||
(o(!0), i(N, null, L(g(S), (t, w) => (o(), i(N, { | ||
key: "option-" + t | ||
(o(!0), i(S, null, L(b(C), (a, V) => (o(), i(S, { | ||
key: "option-" + a | ||
}, [ | ||
typeof t == "string" ? (o(), i("div", { | ||
typeof a == "string" ? (o(), i("div", { | ||
key: 0, | ||
onClick: V((O) => r(t), ["stop"]), | ||
onClick: O((_) => n(a), ["stop"]), | ||
class: "pickerItem" | ||
@@ -774,4 +778,4 @@ }, [ | ||
class: "checkInput", | ||
checked: e.value.includes(t), | ||
id: "check-" + (g($) + String(w)), | ||
checked: e.value.includes(a), | ||
id: "check-" + (b(N) + String(V)), | ||
style: { "pointer-events": "none" } | ||
@@ -781,9 +785,9 @@ }, null, 8, Ye), | ||
class: "checkLabel", | ||
for: "check-" + (g($) + String(w)), | ||
for: "check-" + (b(N) + String(V)), | ||
style: { "pointer-events": "none" } | ||
}, m(t), 9, Ze) | ||
}, m(a), 9, Ze) | ||
]) | ||
], 8, Qe)) : typeof t == "object" && t !== null && n.prop in t ? (o(), i("div", { | ||
], 8, Qe)) : typeof a == "object" && a !== null && r.prop in a ? (o(), i("div", { | ||
key: 1, | ||
onClick: V((O) => r(t, n.prop), ["stop"]), | ||
onClick: O((_) => n(a, r.prop), ["stop"]), | ||
class: "pickerItem" | ||
@@ -795,4 +799,4 @@ }, [ | ||
class: "checkInput", | ||
checked: e.value.includes(t), | ||
id: "check-" + (g($) + String(w)), | ||
checked: e.value.includes(a), | ||
id: "check-" + (b(N) + String(V)), | ||
style: { "pointer-events": "none" } | ||
@@ -802,13 +806,13 @@ }, null, 8, tl), | ||
class: "checkLabel", | ||
for: "check-" + (g($) + String(w)), | ||
for: "check-" + (b(N) + String(V)), | ||
style: { "pointer-events": "none" } | ||
}, m(t[n.prop]), 9, al) | ||
}, m(a[r.prop]), 9, al) | ||
]) | ||
], 8, el)) : (o(), i("div", { | ||
key: 2, | ||
onClick: V((O) => r(t), ["stop"]), | ||
onClick: O((_) => n(a), ["stop"]), | ||
class: "pickerItem" | ||
}, [ | ||
A(s.$slots, "default", { | ||
option: t, | ||
option: a, | ||
selected: e.value | ||
@@ -821,25 +825,25 @@ }, void 0, !0) | ||
class: "pickerMenu", | ||
style: x({ "max-height": Number(n.size) !== 0 ? Number(n.size) * 42 + "px" : "auto" }) | ||
style: x({ "max-height": Number(r.size) !== 0 ? Number(r.size) * 42 + "px" : "auto" }) | ||
}, [ | ||
(o(!0), i(N, null, L(g(S), (t, w) => (o(), i(N, { | ||
key: "option-" + t | ||
(o(!0), i(S, null, L(b(C), (a, V) => (o(), i(S, { | ||
key: "option-" + a | ||
}, [ | ||
typeof t == "string" ? (o(), i("div", { | ||
typeof a == "string" ? (o(), i("div", { | ||
key: 0, | ||
onClick: (O) => l(t), | ||
class: j(["pickerItem", e.value === t ? "active" : ""]) | ||
}, m(t), 11, ul)) : typeof t == "object" && t !== null && n.prop in t ? (o(), i("div", { | ||
onClick: (_) => l(a), | ||
class: w(["pickerItem", e.value === a ? "active" : ""]) | ||
}, m(a), 11, ul)) : typeof a == "object" && a !== null && r.prop in a ? (o(), i("div", { | ||
key: 1, | ||
onClick: (O) => l(t), | ||
class: j(["pickerItem", e.value[n.prop] === t[n.prop] || String(t[n.dataprop || n.prop]) === String(e.value) ? "active" : ""]) | ||
}, m(t[n.prop]), 11, nl)) : (o(), i("div", { | ||
onClick: (_) => l(a), | ||
class: w(["pickerItem", e.value[r.prop] === a[r.prop] || String(a[r.dataprop || r.prop]) === String(e.value) ? "active" : ""]) | ||
}, m(a[r.prop]), 11, rl)) : (o(), i("div", { | ||
key: 2, | ||
onClick: V((O) => l(t), ["stop"]), | ||
class: j(["pickerItem", e.value === t ? "active" : ""]) | ||
onClick: O((_) => l(a), ["stop"]), | ||
class: w(["pickerItem", e.value === a ? "active" : ""]) | ||
}, [ | ||
A(s.$slots, "default", { | ||
option: t, | ||
option: a, | ||
selected: e.value | ||
}, void 0, !0) | ||
], 10, rl)) | ||
], 10, nl)) | ||
], 64))), 128)) | ||
@@ -851,7 +855,7 @@ ], 4)), | ||
type: "text", | ||
"onUpdate:modelValue": a[1] || (a[1] = (t) => b.value = t), | ||
"onUpdate:modelValue": u[1] || (u[1] = (a) => $.value = a), | ||
class: "input", | ||
placeholder: "Add New Category" | ||
}, null, 512), [ | ||
[U, b.value] | ||
[U, $.value] | ||
]), | ||
@@ -861,4 +865,4 @@ d("button", { | ||
class: "button tedirCategoryButton", | ||
onClick: a[2] || (a[2] = (t) => { | ||
h("add", b.value), b.value = ""; | ||
onClick: u[2] || (u[2] = (a) => { | ||
h("add", $.value), $.value = ""; | ||
}) | ||
@@ -865,0 +869,0 @@ }, "Save") |
@@ -1,1 +0,1 @@ | ||
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C.TedirSelect={},C.Vue))})(this,function(C,e){"use strict";const E=c=>(e.pushScopeId("data-v-9d6782b2"),c=c(),e.popScopeId(),c),V={class:"pickerWrap"},$={class:"pickerContent"},w={class:"pickerHeader"},j={key:0,class:"tedirSelectLoading"},_=[E(()=>e.createElementVNode("span",{class:"spinner"},null,-1))],I=["onClick"],x={class:"check"},O=["checked","id"],L=["for"],z=["onClick"],M={class:"check"},T=["checked","id"],F=["for"],D=["onClick"],A=["onClick"],R=["onClick"],W=["onClick"],H=e.defineComponent({__name:"SelectBox",props:{modelValue:{default:{}},options:{default:[]},prop:{default:"value"},datatype:{default:""},dataprop:{default:""},placeholder:{default:"-- Select Option --"},size:{default:0},type:{default:""},up:{type:Boolean,default:!1},defaultOption:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["update:modelValue","change","search"],setup(c,{emit:p}){const o=c,l=e.ref(o.modelValue||{}),d=e.ref(!1),u=e.ref(""),k=e.ref(null),b=e.ref(void 0);e.watch(()=>o.modelValue,()=>{l.value=o.modelValue});const y=()=>{clearTimeout(b.value),b.value=setTimeout(()=>{var r,n;u.value="",((r=k.value)==null?void 0:r.value)&&((n=k.value)==null?void 0:n.value)!==""&&(u.value=k.value.value),p("search",u.value)},500)},h=e.computed(()=>{let r=o.options;return u.value.length>=1&&(r=r.filter(n=>{if(isNaN(n)===!1&&Number(n)===Number(u.value))return!0;if(typeof n=="string"&&n.toLowerCase().includes(u.value.toLowerCase()))return!0;if(typeof n=="object"&&n!==null&&Object.prototype.toString.call(n)==="[object Object]")for(const a of Object.keys(n)){if(isNaN(n[a])===!1&&Number(n[a])===Number(u.value))return!0;if(typeof n[a]=="string"&&n[a].toLowerCase().includes(u.value.toLowerCase()))return!0}return!1})),r}),S=((r=10)=>{let n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",a="";for(let B=0;B<r;B++)a+=n.charAt(Math.floor(Math.random()*n.length));return a})(),g=r=>{var n;r.target.style.display="none",d.value=!1,(n=k.value)!=null&&n.value&&(k.value.value="",u.value="")},f=r=>{l.value=r,p("update:modelValue",l.value),p("change",l.value,r),d.value=!1},s=(r,n="")=>{n!==""?l.value.map(a=>a[n]).includes(r[n])?l.value.splice(l.value.findIndex(a=>a[n]===r[n]),1):l.value.push(r):l.value.includes(r)?l.value.splice(l.value.findIndex(a=>a===r),1):l.value.push(r),p("update:modelValue",l.value),p("change",l.value,r)},t=r=>{typeof r=="object"&&r!==null&&String(o.datatype).toLowerCase()==="string"?(l.value=r[String(o.dataprop||o.prop)],p("update:modelValue",String(l.value))):typeof r=="object"&&r!==null&&String(o.datatype).toLowerCase()==="number"?(l.value=r[String(o.dataprop||o.prop)],p("update:modelValue",Number(l.value))):(l.value=r,p("update:modelValue",l.value)),d.value=!1,p("change",l.value,r)},i=e.computed(()=>{let r=(o==null?void 0:o.placeholder)||"-- Select option --";if(h.value.length>=1)if(typeof l.value=="number"){let n=h.value.filter(a=>Number(a[String(o.dataprop||o.prop)])===Number(l.value));typeof h.value[0]=="object"&&n.length>=1?r=n[0][String(o.prop)]:typeof h.value[0]=="number"&&(r=l.value)}else if(typeof l.value=="string"){let n=h.value.filter(a=>String(a[String(o.dataprop||o.prop)])===l.value);typeof h.value[0]=="object"&&n.length>=1?r=n[0][String(o.prop)]:typeof h.value[0]=="string"&&l.value!==""&&(r=l.value)}else typeof l.value=="object"&&(Array.isArray(l.value)&&l.value.length>=1?typeof l.value[0]=="object"&&String(o.prop)in l.value[0]?r=l.value.map(n=>n[String(o.prop)]).join(", "):r=l.value.join(", "):l.value!==null&&String(o.prop)in l.value&&(r=l.value[String(o.prop)]));return r});return(r,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["picker suggestion",{active:d.value,pickerUp:c.up}])},[e.createElementVNode("div",{class:"pickerBackdrop",style:e.normalizeStyle({display:d.value?"block":"none"}),onClick:g},null,4),e.createElementVNode("div",V,[e.createElementVNode("div",{class:"select pickerToggler",onClick:n[0]||(n[0]=a=>d.value=!d.value)},e.toDisplayString(e.unref(i)),1),e.createElementVNode("div",$,[e.createElementVNode("div",w,[e.createElementVNode("input",{type:"search",ref_key:"searchRef",ref:k,onInput:y,class:"input"},null,544)]),c.loading?(e.openBlock(),e.createElementBlock("div",j,_)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[Array.isArray(l.value)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pickerMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*42+"px":"auto"})},[e.withDirectives(e.createElementVNode("div",{onClick:n[1]||(n[1]=e.withModifiers(a=>f(typeof c.modelValue=="object"?Array.isArray(c.modelValue)?[]:{}:""),["stop"])),class:"pickerItem"},e.toDisplayString(c.placeholder||"-- Select Option --"),513),[[e.vShow,c.defaultOption]]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h),(a,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+a},[typeof a=="string"&&c.type!=="slot"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:e.withModifiers(v=>s(a),["stop"]),class:"pickerItem"},[e.createElementVNode("div",x,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(a),id:"check-"+(e.unref(S)+String(B)),style:{"pointer-events":"none"}},null,8,O),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(S)+String(B)),style:{"pointer-events":"none"}},e.toDisplayString(a),9,L)])],8,I)):typeof a=="object"&&a!==null&&c.prop in a&&c.type!=="slot"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:e.withModifiers(v=>s(a,c.prop),["stop"]),class:"pickerItem"},[e.createElementVNode("div",M,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(a),id:"check-"+(e.unref(S)+String(B)),style:{"pointer-events":"none"}},null,8,T),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(S)+String(B)),style:{"pointer-events":"none"}},e.toDisplayString(a[c.prop]),9,F)])],8,z)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(v=>s(a),["stop"]),class:"pickerItem"},[e.renderSlot(r.$slots,"default",{option:a,selected:l.value},void 0,!0)],8,D))],64))),128))],4)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"pickerMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*42+"px":"auto"})},[e.withDirectives(e.createElementVNode("div",{onClick:n[2]||(n[2]=e.withModifiers(a=>f(typeof c.modelValue=="object"?Array.isArray(c.modelValue)?[]:{}:""),["stop"])),class:"pickerItem"},e.toDisplayString(c.placeholder||"-- Select Option --"),513),[[e.vShow,c.defaultOption]]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h),(a,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+a},[typeof a=="string"&&c.type!=="slot"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:v=>t(a),class:e.normalizeClass(["pickerItem",l.value===a?"active":""])},e.toDisplayString(a),11,A)):typeof a=="object"&&a!==null&&c.prop in a&&c.type!=="slot"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:v=>t(a),class:e.normalizeClass(["pickerItem",l.value[c.prop]===a[c.prop]||String(a[c.dataprop||c.prop])===String(l.value)?"active":""])},e.toDisplayString(a[c.prop]),11,R)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(v=>t(a),["stop"]),class:e.normalizeClass(["pickerItem",l.value===a?"active":""])},[e.renderSlot(r.$slots,"default",{option:a,selected:l.value},void 0,!0)],10,W))],64))),128))],4))],64))])])],2))}}),Ge="",N=(c,p)=>{const o=c.__vccOpts||c;for(const[l,d]of p)o[l]=d;return o},U=N(H,[["__scopeId","data-v-9d6782b2"]]),K={class:"pickerWrap"},P=["value","placeholder"],q=["value","placeholder"],G={class:"pickerContent pickerSizing"},J=["onClick"],Q=["onClick"],X=["onClick"],Y=e.defineComponent({__name:"ComboBox",props:{modelValue:{default:null},options:{default:[]},prop:{default:"value"},datatype:{default:""},dataprop:{default:""},placeholder:{default:"-- Search option --"},size:{default:0},select:{type:Boolean,default:!1},up:{type:Boolean,default:!1},serverSearch:{type:Boolean,default:!1},emptySearch:{type:Boolean,default:!1}},emits:["update:modelValue","change","search"],setup(c,{emit:p}){const o=c,l=e.ref(o.modelValue||{}),d=e.ref(!1),u=e.ref(""),k=e.ref(null),b=e.ref(void 0);e.watch(()=>o.modelValue,()=>{l.value=o.modelValue});const y=e.computed(()=>{let s=o.options;return u.value.length>=1&&o.serverSearch!==!0&&(s=s.filter(t=>{if(isNaN(t)===!1&&Number(t)===Number(u.value))return!0;if(typeof t=="string"&&t.toLowerCase().includes(u.value.toLowerCase()))return!0;if(typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]")for(const i of Object.keys(t)){if(isNaN(t[i])===!1&&Number(t[i])===Number(u.value))return!0;if(typeof t[i]=="string"&&t[i].toLowerCase().includes(u.value.toLowerCase()))return!0}return!1})),s}),h=()=>{clearTimeout(b.value),b.value=setTimeout(()=>{var s,t;u.value="",((s=k.value)==null?void 0:s.value)&&((t=k.value)==null?void 0:t.value)!==""&&(u.value=k.value.value),p("search",u.value),y.value.length>=1&&u.value!==""||o.serverSearch==!0?d.value=!0:d.value=!1},500)},m=(s,t)=>{(typeof s=="string"||isNaN(s)===!1)&&(u.value=s,k.value.value=s),o.emptySearch==!0&&(u.value="",k.value.value="",p("search",u.value)),typeof t=="object"&&t!==null&&String(o.datatype).toLowerCase()==="string"?(l.value=t[String(o.dataprop||o.prop)],p("update:modelValue",String(l.value))):typeof t=="object"&&t!==null&&String(o.datatype).toLowerCase()==="number"?(l.value=t[String(o.dataprop||o.prop)],p("update:modelValue",Number(l.value))):(l.value=t,p("update:modelValue",l.value)),p("change",s,t),d.value=!1},S=s=>{s.target.style.display="none",d.value=!1},g=e.ref(!1),f=e.computed(()=>{let s="";if(y.value.length>=1&&g.value===!1)if(typeof l.value=="number"){let t=y.value.filter(i=>Number(i[String(o.dataprop||o.prop)])===Number(l.value));typeof y.value[0]=="object"&&t.length>=1?s=t[0][String(o.prop)]:typeof y.value[0]=="number"&&(s=l.value)}else if(typeof l.value=="string"){let t=y.value.filter(i=>String(i[String(o.dataprop||o.prop)])===l.value);typeof y.value[0]=="object"&&t.length>=1?s=t[0][String(o.prop)]:typeof y.value[0]=="string"&&l.value!==""&&(s=l.value)}else typeof l.value=="object"&&(Array.isArray(l.value)&&l.value.length>=1?typeof l.value[0]=="object"&&String(o.prop)in l.value[0]?s=l.value.map(t=>t[String(o.prop)]).join(", "):s=l.value.join(", "):l.value!==null&&String(o.prop)in l.value&&(s=l.value[String(o.prop)]));else k.value.value&&g.value===!0&&(s=k.value.value);return s});return(s,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["picker suggestion",{active:d.value,pickerUp:c.up}]),onMouseenter:t[2]||(t[2]=e.withModifiers(i=>g.value=!0,["self"])),onMouseleave:t[3]||(t[3]=e.withModifiers(i=>g.value=!1,["self"]))},[e.createElementVNode("div",{class:"pickerBackdrop",style:e.normalizeStyle({display:d.value?"block":"none"}),onClick:S},null,4),e.createElementVNode("div",K,[c.select?(e.openBlock(),e.createElementBlock("input",{key:0,type:"search",value:e.unref(f),ref_key:"searchRef",ref:k,onInput:h,onClick:t[0]||(t[0]=i=>d.value=!0),class:"select",placeholder:c.placeholder},null,40,P)):(e.openBlock(),e.createElementBlock("input",{key:1,type:"search",value:e.unref(f),ref_key:"searchRef",ref:k,onInput:h,onClick:t[1]||(t[1]=i=>e.unref(y).length>=1&&u.value!==""?d.value=!0:d.value=!1),class:"input",placeholder:c.placeholder},null,40,q)),e.createElementVNode("div",G,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),(i,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+i},[typeof i=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:n=>m(i,i),class:e.normalizeClass(["pickerItem",c.modelValue===i?"active":""])},e.toDisplayString(i),11,J)):typeof i=="object"&&c.prop in i?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:n=>m(i[c.prop],i),class:e.normalizeClass(["pickerItem",c.modelValue[c.prop]===i[c.prop]?"active":""])},e.toDisplayString(i[c.prop]),11,Q)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:n=>m(i,i),class:e.normalizeClass(["pickerItem",c.modelValue===i?"active":""])},[e.renderSlot(s.$slots,"default",{option:i},void 0,!0)],10,X))],64))),128))])])],34))}}),Je="",Z=N(Y,[["__scopeId","data-v-af106d79"]]),ee={class:"list"},le={class:"listHeader"},te=["onClick"],ae={class:"check"},ne=["checked","id"],re=["for"],oe=["onClick"],ce={class:"check"},se=["checked","id"],ie=["for"],de=["onClick"],ue=["onClick"],fe=["onClick"],pe=["onClick"],ke=e.defineComponent({__name:"ListBox",props:{modelValue:{default:{}},options:{default:[]},prop:{default:"value"},datatype:{default:""},dataprop:{default:""},size:{default:0}},emits:["update:modelValue","change","search"],setup(c,{emit:p}){const o=c,l=e.ref(o.modelValue||{}),d=e.ref(""),u=e.ref(null),k=e.ref(void 0);e.watch(()=>o.modelValue,()=>{l.value=o.modelValue});const b=()=>{clearTimeout(k.value),k.value=setTimeout(()=>{var f,s;d.value="",((f=u.value)==null?void 0:f.value)&&((s=u.value)==null?void 0:s.value)!==""&&(d.value=u.value.value),p("search",d.value)},500)},y=e.computed(()=>{let f=o.options;return d.value.length>=1&&(f=f.filter(s=>{if(isNaN(s)===!1&&Number(s)===Number(d.value))return!0;if(typeof s=="string"&&s.toLowerCase().includes(d.value.toLowerCase()))return!0;if(typeof s=="object"&&s!==null&&Object.prototype.toString.call(s)==="[object Object]")for(const t of Object.keys(s)){if(isNaN(s[t])===!1&&Number(s[t])===Number(d.value))return!0;if(typeof s[t]=="string"&&s[t].toLowerCase().includes(d.value.toLowerCase()))return!0}return!1})),f}),m=(()=>{let f="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",s="";for(let t=0;t<10;t++)s+=f.charAt(Math.floor(Math.random()*f.length));return s})(),S=(f,s="")=>{s!==""?l.value.map(t=>t[s]).includes(f[s])?l.value.splice(l.value.findIndex(t=>t[s]===f[s]),1):l.value.push(f):l.value.includes(f)?l.value.splice(l.value.findIndex(t=>t===f),1):l.value.push(f),p("update:modelValue",l.value),p("change",l.value,f)},g=f=>{typeof f=="object"&&f!==null&&String(o.datatype).toLowerCase()==="string"?(l.value=f[String(o.dataprop||o.prop)],p("update:modelValue",String(l.value))):typeof f=="object"&&f!==null&&String(o.datatype).toLowerCase()==="number"?(l.value=f[String(o.dataprop||o.prop)],p("update:modelValue",Number(l.value))):(l.value=f,p("update:modelValue",l.value)),p("change",l.value,f)};return(f,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ee,[e.createElementVNode("div",le,[e.createElementVNode("input",{type:"search",ref_key:"searchRef",ref:u,onInput:b,class:"input"},null,544)]),Array.isArray(c.modelValue)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"listMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*44+"px":"auto"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),(t,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+t},[typeof t=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:e.withModifiers(r=>S(t),["stop"]),class:"listItem"},[e.createElementVNode("div",ae,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(t),id:"check-"+(e.unref(m)+String(i)),style:{"pointer-events":"none"}},null,8,ne),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(m)+String(i)),style:{"pointer-events":"none"}},e.toDisplayString(t),9,re)])],8,te)):typeof t=="object"&&c.prop in t?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:e.withModifiers(r=>S(t,c.prop),["stop"]),class:"listItem"},[e.createElementVNode("div",ce,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(t),id:"check-"+(e.unref(m)+String(i)),style:{"pointer-events":"none"}},null,8,se),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(m)+String(i)),style:{"pointer-events":"none"}},e.toDisplayString(t[c.prop]),9,ie)])],8,oe)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(r=>S(t),["stop"]),class:e.normalizeClass(["listItem",l.value.includes(t)?"active":""])},[e.renderSlot(f.$slots,"default",{option:t,selected:l.value},void 0,!0)],10,de))],64))),128))],4)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"listMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*44+"px":"auto"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),(t,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+t},[typeof t=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:r=>g(t),class:e.normalizeClass(["listItem",l.value===t?"active":""])},e.toDisplayString(t),11,ue)):typeof t=="object"&&c.prop in t?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:r=>g(t),class:e.normalizeClass(["listItem",l.value[c.prop]===t[c.prop]||String(t[c.dataprop||c.prop])===String(l.value)?"active":""])},e.toDisplayString(t[c.prop]),11,fe)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(r=>g(t),["stop"]),class:e.normalizeClass(["listItem",l.value===t?"active":""])},[e.renderSlot(f.$slots,"default",{option:t,selected:l.value},void 0,!0)],10,pe))],64))),128))],4))])]))}}),Qe="",ye=N(ke,[["__scopeId","data-v-d7fed8bc"]]),he=c=>(e.pushScopeId("data-v-3acd22f1"),c=c(),e.popScopeId(),c),me={class:"tagWrap"},ge={class:"tags"},Be={class:"tag groupItem"},be=["onClick"],Se=[he(()=>e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1))],Ce={class:"tagContent"},ve=["onClick"],Ne=["onClick"],Ee=["onClick"],Ve=e.defineComponent({__name:"TagBox",props:{modelValue:{default:[]},options:{default:[]},prop:{default:"value"},placeholder:{default:"Add new tag"},size:{default:0},separator:{default:","}},emits:["update:modelValue"],setup(c,{emit:p}){const o=c,l=e.ref(!1),d=e.ref(""),u=e.ref(null),k=e.reactive(o.modelValue||[]),b=e.ref(o.options||[]),y=e.ref(o.separator||","),h=e.ref(o.prop||"value"),m=e.computed(()=>{let s=b.value;return d.value.length>=1&&(s=s.filter(t=>{if(isNaN(t)===!1&&Number(t)===Number(d.value))return!0;if(typeof t=="string"&&t.toLowerCase().includes(d.value.toLowerCase()))return!0;if(typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]")for(const i of Object.keys(t)){if(isNaN(t[i])===!1&&Number(t[i])===Number(d.value))return!0;if(typeof t[i]=="string"&&t[i].toLowerCase().includes(d.value.toLowerCase()))return!0}return!1})),s}),S=()=>{u.value.focus()},g=s=>{if(s.key!=="Enter"&&m.value.length>=1?l.value=!0:l.value=!1,d.value.endsWith(y.value)||s.key==="Enter"){const t=d.value.replace(y.value,"");k.includes(t)||(k.push(t),b.value.includes(t)&&(b.value=b.value.filter(i=>typeof i=="string"&&i!==t?!0:typeof i=="object"&&h.value in i&&i[h.value]!==t))),d.value="",p("update:modelValue",k)}};e.watch(d,()=>{if(u.value!==null){const s=document.createElement("div");s.style.width="max-content",s.style.position="absolute",s.style.visibility="hidden";const t=d.value.length>=2?d.value:u.value.getAttribute("placeholder");s.innerHTML=t.replace(/ /g," ").trim(),document.body.appendChild(s);const i=Math.ceil(Number(window.getComputedStyle(s).width.replace("px","")))+30;u.value.style.setProperty("width",i+"px"),s.remove()}});const f=s=>{s.target.style.display="none",l.value=!1};return(s,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["taggable",{active:l.value===!0}])},[e.createElementVNode("div",{class:"tagBackdrop",style:e.normalizeStyle({display:l.value?"block":"none"}),onClick:f},null,4),e.createElementVNode("div",me,[e.createElementVNode("div",{class:"input tagToggler",onClick:S},[e.createElementVNode("div",ge,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k,(i,r)=>(e.openBlock(),e.createElementBlock("div",{key:"tag-"+r,class:"group"},[e.createElementVNode("div",Be,[typeof i=="string"&&i!==""?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(i),1)],64)):typeof i=="object"&&h.value in i?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(i[h.value]),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(c.placeholder),1)],64))]),e.createElementVNode("div",{class:"tag groupItem",onClick:n=>k.splice(r,1)},Se,8,be)]))),128)),e.withDirectives(e.createElementVNode("input",{type:"search",ref_key:"inputRef",ref:u,"onUpdate:modelValue":t[0]||(t[0]=i=>d.value=i),class:"tagInput",onInput:t[1]||(t[1]=i=>g(i)),onKeyup:t[2]||(t[2]=e.withKeys(i=>g(i),["enter"])),placeholder:"Add new tag"},null,544),[[e.vModelText,d.value]])])]),e.createElementVNode("div",Ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(i,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+i},[typeof i=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:n=>{d.value=i+",",g(n)},class:"tagItem"},e.toDisplayString(i),9,ve)):typeof i=="object"&&h.value in i?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:n=>{d.value=i[h.value]+",",g(n)},class:"tagItem"},e.toDisplayString(i[h.value]),9,Ne)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:n=>{d.value=i+",",g(n)},class:"tagItem"},[e.renderSlot(s.$slots,"default",{option:i},void 0,!0)],8,Ee))],64))),128))])])],2))}}),Ye="",$e=N(Ve,[["__scopeId","data-v-3acd22f1"]]),we={class:"pickerOverlay pickerWrap"},je={class:"pickerContent"},_e={class:"pickerHeader"},Ie=["onClick"],xe={class:"check"},Oe=["checked","id"],Le=["for"],ze=["onClick"],Me={class:"check"},Te=["checked","id"],Fe=["for"],De=["onClick"],Ae=["onClick"],Re=["onClick"],We=["onClick"],He={class:"pickerFooter"},Ue={class:"tedirCategoryAdd"},Ke=e.defineComponent({__name:"CategoryBox",props:{modelValue:{default:{}},options:{default:[]},prop:{default:"value"},datatype:{default:""},dataprop:{default:""},placeholder:{default:"-- Select option --"},size:{default:0},up:{type:Boolean,default:!1}},emits:["update:modelValue","change","add","search"],setup(c,{emit:p}){const o=c,l=e.ref(o.modelValue||{}),d=e.ref(!1),u=e.ref(""),k=e.ref(null),b=e.ref(void 0),y=e.ref("");e.watch(()=>o.modelValue,()=>{l.value=o.modelValue});const h=()=>{clearTimeout(b.value),b.value=setTimeout(()=>{var r,n;u.value="",((r=k.value)==null?void 0:r.value)&&((n=k.value)==null?void 0:n.value)!==""&&(u.value=k.value.value),p("search",u.value)},500)},m=e.computed(()=>{let r=o.options;return u.value.length>=1&&(r=r.filter(n=>{if(isNaN(n)===!1&&Number(n)===Number(u.value))return!0;if(typeof n=="string"&&n.toLowerCase().includes(u.value.toLowerCase()))return!0;if(typeof n=="object"&&n!==null&&Object.prototype.toString.call(n)==="[object Object]")for(const a of Object.keys(n)){if(isNaN(n[a])===!1&&Number(n[a])===Number(u.value))return!0;if(typeof n[a]=="string"&&n[a].toLowerCase().includes(u.value.toLowerCase()))return!0}return!1})),r}),g=((r=10)=>{let n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",a="";for(let B=0;B<r;B++)a+=n.charAt(Math.floor(Math.random()*n.length));return a})(),f=r=>{var n;r.target.style.display="none",d.value=!1,(n=k.value)!=null&&n.value&&(k.value.value="",u.value="")},s=(r,n="")=>{n!==""?l.value.map(a=>a[n]).includes(r[n])?l.value.splice(l.value.findIndex(a=>a[n]===r[n]),1):l.value.push(r):l.value.includes(r)?l.value.splice(l.value.findIndex(a=>a===r),1):l.value.push(r),p("update:modelValue",l.value),p("change",l.value,r)},t=r=>{typeof r=="object"&&r!==null&&String(o.datatype).toLowerCase()==="string"?(l.value=r[String(o.dataprop||o.prop)],p("update:modelValue",String(l.value))):typeof r=="object"&&r!==null&&String(o.datatype).toLowerCase()==="number"?(l.value=r[String(o.dataprop||o.prop)],p("update:modelValue",Number(l.value))):(l.value=r,p("update:modelValue",l.value)),d.value=!1,p("change",l.value,r)},i=e.computed(()=>{let r=(o==null?void 0:o.placeholder)||"-- Select option --";if(m.value.length>=1)if(typeof l.value=="number"){let n=m.value.filter(a=>Number(a[String(o.dataprop||o.prop)])===Number(l.value));typeof m.value[0]=="object"&&n.length>=1?r=n[0][String(o.prop)]:typeof m.value[0]=="number"&&(r=l.value)}else if(typeof l.value=="string"){let n=m.value.filter(a=>String(a[String(o.dataprop||o.prop)])===l.value);typeof m.value[0]=="object"&&n.length>=1?r=n[0][String(o.prop)]:typeof m.value[0]=="string"&&l.value!==""&&(r=l.value)}else typeof l.value=="object"&&(Array.isArray(l.value)&&l.value.length>=1?typeof l.value[0]=="object"&&String(o.prop)in l.value[0]?r=l.value.map(n=>n[String(o.prop)]).join(", "):r=l.value.join(", "):l.value!==null&&String(o.prop)in l.value&&(r=l.value[String(o.prop)]));return r});return(r,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["picker suggestion tedirCategory",{active:d.value,pickerUp:c.up}])},[e.createElementVNode("div",{class:"pickerBackdrop",style:e.normalizeStyle({display:d.value?"block":"none"}),onClick:f},null,4),e.createElementVNode("div",we,[e.createElementVNode("div",{class:"select pickerToggler",onClick:n[0]||(n[0]=a=>d.value=!d.value)},e.toDisplayString(e.unref(i)),1),e.createElementVNode("div",je,[e.createElementVNode("div",_e,[e.createElementVNode("input",{type:"search",ref_key:"searchRef",ref:k,onInput:h,class:"input"},null,544)]),Array.isArray(l.value)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pickerMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*42+"px":"auto"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(a,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+a},[typeof a=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:e.withModifiers(v=>s(a),["stop"]),class:"pickerItem"},[e.createElementVNode("div",xe,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(a),id:"check-"+(e.unref(g)+String(B)),style:{"pointer-events":"none"}},null,8,Oe),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(g)+String(B)),style:{"pointer-events":"none"}},e.toDisplayString(a),9,Le)])],8,Ie)):typeof a=="object"&&a!==null&&c.prop in a?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:e.withModifiers(v=>s(a,c.prop),["stop"]),class:"pickerItem"},[e.createElementVNode("div",Me,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(a),id:"check-"+(e.unref(g)+String(B)),style:{"pointer-events":"none"}},null,8,Te),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(g)+String(B)),style:{"pointer-events":"none"}},e.toDisplayString(a[c.prop]),9,Fe)])],8,ze)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(v=>s(a),["stop"]),class:"pickerItem"},[e.renderSlot(r.$slots,"default",{option:a,selected:l.value},void 0,!0)],8,De))],64))),128))],4)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"pickerMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*42+"px":"auto"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(a,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+a},[typeof a=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:v=>t(a),class:e.normalizeClass(["pickerItem",l.value===a?"active":""])},e.toDisplayString(a),11,Ae)):typeof a=="object"&&a!==null&&c.prop in a?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:v=>t(a),class:e.normalizeClass(["pickerItem",l.value[c.prop]===a[c.prop]||String(a[c.dataprop||c.prop])===String(l.value)?"active":""])},e.toDisplayString(a[c.prop]),11,Re)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(v=>t(a),["stop"]),class:e.normalizeClass(["pickerItem",l.value===a?"active":""])},[e.renderSlot(r.$slots,"default",{option:a,selected:l.value},void 0,!0)],10,We))],64))),128))],4)),e.createElementVNode("div",He,[e.createElementVNode("div",Ue,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":n[1]||(n[1]=a=>y.value=a),class:"input",placeholder:"Add New Category"},null,512),[[e.vModelText,y.value]]),e.createElementVNode("button",{type:"button",class:"button tedirCategoryButton",onClick:n[2]||(n[2]=a=>{p("add",y.value),y.value=""})},"Save")])])])])],2))}}),Ze="",Pe=N(Ke,[["__scopeId","data-v-9bd9abf8"]]);C.CategoryBox=Pe,C.ComboBox=Z,C.ListBox=ye,C.SelectBox=U,C.TagBox=$e,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(b,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(b=typeof globalThis<"u"?globalThis:b||self,e(b.TedirSelect={},b.Vue))})(this,function(b,e){"use strict";const V=c=>(e.pushScopeId("data-v-9d6782b2"),c=c(),e.popScopeId(),c),E={class:"pickerWrap"},$={class:"pickerContent"},w={class:"pickerHeader"},j={key:0,class:"tedirSelectLoading"},I=[V(()=>e.createElementVNode("span",{class:"spinner"},null,-1))],_=["onClick"],x={class:"check"},O=["checked","id"],L=["for"],z=["onClick"],M={class:"check"},F=["checked","id"],T=["for"],D=["onClick"],A=["onClick"],R=["onClick"],W=["onClick"],H=e.defineComponent({__name:"SelectBox",props:{modelValue:{default:{}},options:{default:[]},prop:{default:"value"},datatype:{default:""},dataprop:{default:""},placeholder:{default:"-- Select Option --"},size:{default:0},type:{default:""},up:{type:Boolean,default:!1},defaultOption:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["update:modelValue","change","search"],setup(c,{emit:p}){const a=c,l=e.ref(a.modelValue||{}),d=e.ref(!1),u=e.ref(""),k=e.ref(null),B=e.ref(void 0);e.watch(()=>a.modelValue,()=>{l.value=a.modelValue});const h=()=>{clearTimeout(B.value),B.value=setTimeout(()=>{var r,o;u.value="",((r=k.value)==null?void 0:r.value)&&((o=k.value)==null?void 0:o.value)!==""&&(u.value=k.value.value),p("search",u.value)},500)},m=e.computed(()=>{let r=a.options;return u.value.length>=1&&(r=r.filter(o=>{if(isNaN(o)===!1&&Number(o)===Number(u.value))return!0;if(typeof o=="string"&&o.toLowerCase().includes(u.value.toLowerCase()))return!0;if(typeof o=="object"&&o!==null&&Object.prototype.toString.call(o)==="[object Object]")for(const n of Object.keys(o)){if(isNaN(o[n])===!1&&Number(o[n])===Number(u.value))return!0;if(typeof o[n]=="string"&&o[n].toLowerCase().includes(u.value.toLowerCase()))return!0}return!1})),r}),S=((r=10)=>{let o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n="";for(let v=0;v<r;v++)n+=o.charAt(Math.floor(Math.random()*o.length));return n})(),g=r=>{var o;r.target.style.display="none",d.value=!1,(o=k.value)!=null&&o.value&&(k.value.value="",u.value="")},f=r=>{l.value=r,p("update:modelValue",l.value),p("change",l.value,r),d.value=!1},s=(r,o="")=>{o!==""?l.value.map(n=>n[o]).includes(r[o])?l.value.splice(l.value.findIndex(n=>n[o]===r[o]),1):l.value.push(r):l.value.includes(r)?l.value.splice(l.value.findIndex(n=>n===r),1):l.value.push(r),p("update:modelValue",l.value),p("change",l.value,r)},t=r=>{typeof r=="object"&&r!==null&&String(a.datatype).toLowerCase()==="string"?(l.value=r[String(a.dataprop||a.prop)],p("update:modelValue",String(l.value))):typeof r=="object"&&r!==null&&String(a.datatype).toLowerCase()==="number"?(l.value=r[String(a.dataprop||a.prop)],p("update:modelValue",Number(l.value))):(l.value=r,p("update:modelValue",l.value)),d.value=!1,p("change",l.value,r)},i=e.computed(()=>{let r=(a==null?void 0:a.placeholder)||"-- Select option --";if(m.value.length>=1)if(typeof l.value=="number"){let o=m.value.filter(n=>Number(n[String(a.dataprop||a.prop)])===Number(l.value));typeof m.value[0]=="object"&&o.length>=1?r=o[0][String(a.prop)]:typeof m.value[0]=="number"&&(r=l.value)}else if(typeof l.value=="string"){let o=m.value.filter(n=>String(n[String(a.dataprop||a.prop)])===l.value);typeof m.value[0]=="object"&&o.length>=1?r=o[0][String(a.prop)]:typeof m.value[0]=="string"&&l.value!==""&&(r=l.value)}else typeof l.value=="object"&&(Array.isArray(l.value)&&l.value.length>=1?typeof l.value[0]=="object"&&String(a.prop)in l.value[0]?r=l.value.map(o=>o[String(a.prop)]).join(", "):r=l.value.join(", "):l.value!==null&&String(a.prop)in l.value&&(r=l.value[String(a.prop)]));return r});return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["picker suggestion",{active:d.value,pickerUp:c.up}])},[e.createElementVNode("div",{class:"pickerBackdrop",style:e.normalizeStyle({display:d.value?"block":"none"}),onClick:g},null,4),e.createElementVNode("div",E,[e.createElementVNode("div",{class:"select pickerToggler",onClick:o[0]||(o[0]=n=>d.value=!d.value)},e.toDisplayString(e.unref(i)),1),e.createElementVNode("div",$,[e.createElementVNode("div",w,[e.createElementVNode("input",{type:"search",ref_key:"searchRef",ref:k,onInput:h,class:"input"},null,544)]),c.loading?(e.openBlock(),e.createElementBlock("div",j,I)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[Array.isArray(l.value)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pickerMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*42+"px":"auto"})},[e.withDirectives(e.createElementVNode("div",{onClick:o[1]||(o[1]=e.withModifiers(n=>f(typeof c.modelValue=="object"?Array.isArray(c.modelValue)?[]:{}:""),["stop"])),class:"pickerItem"},e.toDisplayString(c.placeholder||"-- Select Option --"),513),[[e.vShow,c.defaultOption]]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(n,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+n},[typeof n=="string"&&c.type!=="slot"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:e.withModifiers(C=>s(n),["stop"]),class:"pickerItem"},[e.createElementVNode("div",x,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(n),id:"check-"+(e.unref(S)+String(v)),style:{"pointer-events":"none"}},null,8,O),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(S)+String(v)),style:{"pointer-events":"none"}},e.toDisplayString(n),9,L)])],8,_)):typeof n=="object"&&n!==null&&c.prop in n&&c.type!=="slot"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:e.withModifiers(C=>s(n,c.prop),["stop"]),class:"pickerItem"},[e.createElementVNode("div",M,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(n),id:"check-"+(e.unref(S)+String(v)),style:{"pointer-events":"none"}},null,8,F),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(S)+String(v)),style:{"pointer-events":"none"}},e.toDisplayString(n[c.prop]),9,T)])],8,z)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(C=>s(n),["stop"]),class:"pickerItem"},[e.renderSlot(r.$slots,"default",{option:n,selected:l.value},void 0,!0)],8,D))],64))),128))],4)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"pickerMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*42+"px":"auto"})},[e.withDirectives(e.createElementVNode("div",{onClick:o[2]||(o[2]=e.withModifiers(n=>f(typeof c.modelValue=="object"?Array.isArray(c.modelValue)?[]:{}:""),["stop"])),class:"pickerItem"},e.toDisplayString(c.placeholder||"-- Select Option --"),513),[[e.vShow,c.defaultOption]]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(n,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+n},[typeof n=="string"&&c.type!=="slot"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:C=>t(n),class:e.normalizeClass(["pickerItem",l.value===n?"active":""])},e.toDisplayString(n),11,A)):typeof n=="object"&&n!==null&&c.prop in n&&c.type!=="slot"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:C=>t(n),class:e.normalizeClass(["pickerItem",l.value[c.prop]===n[c.prop]||String(n[c.dataprop||c.prop])===String(l.value)?"active":""])},e.toDisplayString(n[c.prop]),11,R)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(C=>t(n),["stop"]),class:e.normalizeClass(["pickerItem",l.value===n?"active":""])},[e.renderSlot(r.$slots,"default",{option:n,selected:l.value},void 0,!0)],10,W))],64))),128))],4))],64))])])],2))}}),Ge="",N=(c,p)=>{const a=c.__vccOpts||c;for(const[l,d]of p)a[l]=d;return a},U=N(H,[["__scopeId","data-v-9d6782b2"]]),K={class:"pickerWrap"},P=["value","placeholder"],q=["value","placeholder"],G={class:"pickerContent pickerSizing"},J=["onClick"],Q=["onClick"],X=["onClick"],Y=e.defineComponent({__name:"ComboBox",props:{modelValue:{default:null},options:{default:[]},prop:{default:"value"},datatype:{default:""},dataprop:{default:""},placeholder:{default:"-- Search Option --"},size:{default:0},select:{type:Boolean,default:!1},up:{type:Boolean,default:!1},serverSearch:{type:Boolean,default:!1},emptySearch:{type:Boolean,default:!1}},emits:["update:modelValue","change","search"],setup(c,{emit:p}){const a=c,l=e.ref(a.modelValue||{}),d=e.ref(!1),u=e.ref(""),k=e.ref(null),B=e.ref(void 0),h=e.ref(!1);e.watch(()=>a.modelValue,()=>{var s,t;l.value=a.modelValue,typeof a.modelValue=="string"||isNaN(a.modelValue)===!1?(u.value=a.modelValue,k.value.value=a.modelValue):(typeof((s=a.modelValue)==null?void 0:s[String(a.dataprop||a.prop)])=="string"||isNaN((t=a.modelValue)==null?void 0:t[String(a.dataprop||a.prop)])===!1)&&(u.value=a.modelValue[String(a.dataprop||a.prop)],k.value.value=a.modelValue[String(a.dataprop||a.prop)]),a.emptySearch==!0&&(u.value="",k.value.value="",p("search",u.value))});const m=e.computed(()=>{let s=a.options;return u.value.length>=1&&a.serverSearch!==!0&&(s=s.filter(t=>{if(isNaN(t)===!1&&Number(t)===Number(u.value))return!0;if(typeof t=="string"&&t.toLowerCase().includes(u.value.toLowerCase()))return!0;if(typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]")for(const i of Object.keys(t)){if(isNaN(t[i])===!1&&Number(t[i])===Number(u.value))return!0;if(typeof t[i]=="string"&&t[i].toLowerCase().includes(u.value.toLowerCase()))return!0}return!1})),s}),y=()=>{clearTimeout(B.value),B.value=setTimeout(()=>{var s,t;u.value="",((s=k.value)==null?void 0:s.value)&&((t=k.value)==null?void 0:t.value)!==""&&(u.value=k.value.value),p("search",u.value),m.value.length>=1&&h.value===!0||a.serverSearch==!0?d.value=!0:d.value=!1},500)},S=(s,t)=>{(typeof s=="string"||isNaN(s)===!1)&&(u.value=s,k.value.value=s),a.emptySearch==!0&&(u.value="",k.value.value="",p("search",u.value)),typeof t=="object"&&t!==null&&String(a.datatype).toLowerCase()==="string"?(l.value=t[String(a.dataprop||a.prop)],p("update:modelValue",String(l.value))):typeof t=="object"&&t!==null&&String(a.datatype).toLowerCase()==="number"?(l.value=t[String(a.dataprop||a.prop)],p("update:modelValue",Number(l.value))):(l.value=t,p("update:modelValue",l.value)),p("change",s,t),d.value=!1},g=s=>{s.target.style.display="none",d.value=!1},f=e.computed(()=>{var t;let s="";if(m.value.length>=1&&h.value!==!0&&a.emptySearch!==!0)if(typeof l.value=="number"){let i=m.value.filter(r=>Number(r[String(a.dataprop||a.prop)])===Number(l.value));typeof m.value[0]=="object"&&i.length>=1?s=i[0][String(a.prop)]:typeof m.value[0]=="number"&&(s=l.value)}else if(typeof l.value=="string"){let i=m.value.filter(r=>String(r[String(a.dataprop||a.prop)])===l.value);typeof m.value[0]=="object"&&i.length>=1?s=i[0][String(a.prop)]:typeof m.value[0]=="string"&&l.value!==""&&(s=l.value)}else typeof l.value=="object"&&(Array.isArray(l.value)&&l.value.length>=1?typeof l.value[0]=="object"&&String(a.prop)in l.value[0]?s=l.value.map(i=>i[String(a.prop)]).join(", "):s=l.value.join(", "):l.value!==null&&String(a.prop)in l.value&&(s=l.value[String(a.prop)]));else((t=k.value)==null?void 0:t.value)&&h.value===!0&&a.emptySearch!==!0&&(s=k.value.value);return s});return(s,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["picker suggestion",{active:d.value,pickerUp:c.up}])},[e.createElementVNode("div",{class:"pickerBackdrop",style:e.normalizeStyle({display:d.value?"block":"none"}),onClick:g},null,4),e.createElementVNode("div",K,[c.select?(e.openBlock(),e.createElementBlock("input",{key:0,type:"search",value:e.unref(f),ref_key:"searchRef",ref:k,onInput:y,onClick:t[0]||(t[0]=i=>d.value=!0),onFocus:t[1]||(t[1]=i=>h.value=!0),onBlur:t[2]||(t[2]=i=>h.value=!1),class:"select",placeholder:c.placeholder},null,40,P)):(e.openBlock(),e.createElementBlock("input",{key:1,type:"search",value:e.unref(f),ref_key:"searchRef",ref:k,onInput:y,onClick:t[3]||(t[3]=i=>e.unref(m).length>=1&&u.value!==""?d.value=!0:d.value=!1),onFocus:t[4]||(t[4]=i=>h.value=!0),onBlur:t[5]||(t[5]=i=>h.value=!1),class:"input",placeholder:c.placeholder},null,40,q)),e.createElementVNode("div",G,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(i,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+i},[typeof i=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o=>S(i,i),class:e.normalizeClass(["pickerItem",c.modelValue===i?"active":""])},e.toDisplayString(i),11,J)):typeof i=="object"&&c.prop in i?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:o=>S(i[c.prop],i),class:e.normalizeClass(["pickerItem",c.modelValue[c.prop]===i[c.prop]?"active":""])},e.toDisplayString(i[c.prop]),11,Q)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:o=>S(i,i),class:e.normalizeClass(["pickerItem",c.modelValue===i?"active":""])},[e.renderSlot(s.$slots,"default",{option:i},void 0,!0)],10,X))],64))),128))])])],2))}}),Je="",Z=N(Y,[["__scopeId","data-v-fd87e445"]]),ee={class:"list"},le={class:"listHeader"},te=["onClick"],ae={class:"check"},ne=["checked","id"],re=["for"],oe=["onClick"],ce={class:"check"},se=["checked","id"],ie=["for"],de=["onClick"],ue=["onClick"],fe=["onClick"],pe=["onClick"],ke=e.defineComponent({__name:"ListBox",props:{modelValue:{default:{}},options:{default:[]},prop:{default:"value"},datatype:{default:""},dataprop:{default:""},size:{default:0}},emits:["update:modelValue","change","search"],setup(c,{emit:p}){const a=c,l=e.ref(a.modelValue||{}),d=e.ref(""),u=e.ref(null),k=e.ref(void 0);e.watch(()=>a.modelValue,()=>{l.value=a.modelValue});const B=()=>{clearTimeout(k.value),k.value=setTimeout(()=>{var f,s;d.value="",((f=u.value)==null?void 0:f.value)&&((s=u.value)==null?void 0:s.value)!==""&&(d.value=u.value.value),p("search",d.value)},500)},h=e.computed(()=>{let f=a.options;return d.value.length>=1&&(f=f.filter(s=>{if(isNaN(s)===!1&&Number(s)===Number(d.value))return!0;if(typeof s=="string"&&s.toLowerCase().includes(d.value.toLowerCase()))return!0;if(typeof s=="object"&&s!==null&&Object.prototype.toString.call(s)==="[object Object]")for(const t of Object.keys(s)){if(isNaN(s[t])===!1&&Number(s[t])===Number(d.value))return!0;if(typeof s[t]=="string"&&s[t].toLowerCase().includes(d.value.toLowerCase()))return!0}return!1})),f}),y=(()=>{let f="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",s="";for(let t=0;t<10;t++)s+=f.charAt(Math.floor(Math.random()*f.length));return s})(),S=(f,s="")=>{s!==""?l.value.map(t=>t[s]).includes(f[s])?l.value.splice(l.value.findIndex(t=>t[s]===f[s]),1):l.value.push(f):l.value.includes(f)?l.value.splice(l.value.findIndex(t=>t===f),1):l.value.push(f),p("update:modelValue",l.value),p("change",l.value,f)},g=f=>{typeof f=="object"&&f!==null&&String(a.datatype).toLowerCase()==="string"?(l.value=f[String(a.dataprop||a.prop)],p("update:modelValue",String(l.value))):typeof f=="object"&&f!==null&&String(a.datatype).toLowerCase()==="number"?(l.value=f[String(a.dataprop||a.prop)],p("update:modelValue",Number(l.value))):(l.value=f,p("update:modelValue",l.value)),p("change",l.value,f)};return(f,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ee,[e.createElementVNode("div",le,[e.createElementVNode("input",{type:"search",ref_key:"searchRef",ref:u,onInput:B,class:"input"},null,544)]),Array.isArray(c.modelValue)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"listMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*44+"px":"auto"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h),(t,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+t},[typeof t=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:e.withModifiers(r=>S(t),["stop"]),class:"listItem"},[e.createElementVNode("div",ae,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(t),id:"check-"+(e.unref(y)+String(i)),style:{"pointer-events":"none"}},null,8,ne),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(y)+String(i)),style:{"pointer-events":"none"}},e.toDisplayString(t),9,re)])],8,te)):typeof t=="object"&&c.prop in t?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:e.withModifiers(r=>S(t,c.prop),["stop"]),class:"listItem"},[e.createElementVNode("div",ce,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(t),id:"check-"+(e.unref(y)+String(i)),style:{"pointer-events":"none"}},null,8,se),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(y)+String(i)),style:{"pointer-events":"none"}},e.toDisplayString(t[c.prop]),9,ie)])],8,oe)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(r=>S(t),["stop"]),class:e.normalizeClass(["listItem",l.value.includes(t)?"active":""])},[e.renderSlot(f.$slots,"default",{option:t,selected:l.value},void 0,!0)],10,de))],64))),128))],4)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"listMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*44+"px":"auto"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h),(t,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+t},[typeof t=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:r=>g(t),class:e.normalizeClass(["listItem",l.value===t?"active":""])},e.toDisplayString(t),11,ue)):typeof t=="object"&&c.prop in t?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:r=>g(t),class:e.normalizeClass(["listItem",l.value[c.prop]===t[c.prop]||String(t[c.dataprop||c.prop])===String(l.value)?"active":""])},e.toDisplayString(t[c.prop]),11,fe)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(r=>g(t),["stop"]),class:e.normalizeClass(["listItem",l.value===t?"active":""])},[e.renderSlot(f.$slots,"default",{option:t,selected:l.value},void 0,!0)],10,pe))],64))),128))],4))])]))}}),Qe="",me=N(ke,[["__scopeId","data-v-d7fed8bc"]]),ye=c=>(e.pushScopeId("data-v-3acd22f1"),c=c(),e.popScopeId(),c),he={class:"tagWrap"},ge={class:"tags"},ve={class:"tag groupItem"},Be=["onClick"],Se=[ye(()=>e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1))],be={class:"tagContent"},Ce=["onClick"],Ne=["onClick"],Ve=["onClick"],Ee=e.defineComponent({__name:"TagBox",props:{modelValue:{default:[]},options:{default:[]},prop:{default:"value"},placeholder:{default:"Add new tag"},size:{default:0},separator:{default:","}},emits:["update:modelValue"],setup(c,{emit:p}){const a=c,l=e.ref(!1),d=e.ref(""),u=e.ref(null),k=e.reactive(a.modelValue||[]),B=e.ref(a.options||[]),h=e.ref(a.separator||","),m=e.ref(a.prop||"value"),y=e.computed(()=>{let s=B.value;return d.value.length>=1&&(s=s.filter(t=>{if(isNaN(t)===!1&&Number(t)===Number(d.value))return!0;if(typeof t=="string"&&t.toLowerCase().includes(d.value.toLowerCase()))return!0;if(typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]")for(const i of Object.keys(t)){if(isNaN(t[i])===!1&&Number(t[i])===Number(d.value))return!0;if(typeof t[i]=="string"&&t[i].toLowerCase().includes(d.value.toLowerCase()))return!0}return!1})),s}),S=()=>{u.value.focus()},g=s=>{if(s.key!=="Enter"&&y.value.length>=1?l.value=!0:l.value=!1,d.value.endsWith(h.value)||s.key==="Enter"){const t=d.value.replace(h.value,"");k.includes(t)||(k.push(t),B.value.includes(t)&&(B.value=B.value.filter(i=>typeof i=="string"&&i!==t?!0:typeof i=="object"&&m.value in i&&i[m.value]!==t))),d.value="",p("update:modelValue",k)}};e.watch(d,()=>{if(u.value!==null){const s=document.createElement("div");s.style.width="max-content",s.style.position="absolute",s.style.visibility="hidden";const t=d.value.length>=2?d.value:u.value.getAttribute("placeholder");s.innerHTML=t.replace(/ /g," ").trim(),document.body.appendChild(s);const i=Math.ceil(Number(window.getComputedStyle(s).width.replace("px","")))+30;u.value.style.setProperty("width",i+"px"),s.remove()}});const f=s=>{s.target.style.display="none",l.value=!1};return(s,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["taggable",{active:l.value===!0}])},[e.createElementVNode("div",{class:"tagBackdrop",style:e.normalizeStyle({display:l.value?"block":"none"}),onClick:f},null,4),e.createElementVNode("div",he,[e.createElementVNode("div",{class:"input tagToggler",onClick:S},[e.createElementVNode("div",ge,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k,(i,r)=>(e.openBlock(),e.createElementBlock("div",{key:"tag-"+r,class:"group"},[e.createElementVNode("div",ve,[typeof i=="string"&&i!==""?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(i),1)],64)):typeof i=="object"&&m.value in i?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(i[m.value]),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(c.placeholder),1)],64))]),e.createElementVNode("div",{class:"tag groupItem",onClick:o=>k.splice(r,1)},Se,8,Be)]))),128)),e.withDirectives(e.createElementVNode("input",{type:"search",ref_key:"inputRef",ref:u,"onUpdate:modelValue":t[0]||(t[0]=i=>d.value=i),class:"tagInput",onInput:t[1]||(t[1]=i=>g(i)),onKeyup:t[2]||(t[2]=e.withKeys(i=>g(i),["enter"])),placeholder:"Add new tag"},null,544),[[e.vModelText,d.value]])])]),e.createElementVNode("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),(i,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+i},[typeof i=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o=>{d.value=i+",",g(o)},class:"tagItem"},e.toDisplayString(i),9,Ce)):typeof i=="object"&&m.value in i?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:o=>{d.value=i[m.value]+",",g(o)},class:"tagItem"},e.toDisplayString(i[m.value]),9,Ne)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:o=>{d.value=i+",",g(o)},class:"tagItem"},[e.renderSlot(s.$slots,"default",{option:i},void 0,!0)],8,Ve))],64))),128))])])],2))}}),Ye="",$e=N(Ee,[["__scopeId","data-v-3acd22f1"]]),we={class:"pickerOverlay pickerWrap"},je={class:"pickerContent"},Ie={class:"pickerHeader"},_e=["onClick"],xe={class:"check"},Oe=["checked","id"],Le=["for"],ze=["onClick"],Me={class:"check"},Fe=["checked","id"],Te=["for"],De=["onClick"],Ae=["onClick"],Re=["onClick"],We=["onClick"],He={class:"pickerFooter"},Ue={class:"tedirCategoryAdd"},Ke=e.defineComponent({__name:"CategoryBox",props:{modelValue:{default:{}},options:{default:[]},prop:{default:"value"},datatype:{default:""},dataprop:{default:""},placeholder:{default:"-- Select option --"},size:{default:0},up:{type:Boolean,default:!1}},emits:["update:modelValue","change","add","search"],setup(c,{emit:p}){const a=c,l=e.ref(a.modelValue||{}),d=e.ref(!1),u=e.ref(""),k=e.ref(null),B=e.ref(void 0),h=e.ref("");e.watch(()=>a.modelValue,()=>{l.value=a.modelValue});const m=()=>{clearTimeout(B.value),B.value=setTimeout(()=>{var r,o;u.value="",((r=k.value)==null?void 0:r.value)&&((o=k.value)==null?void 0:o.value)!==""&&(u.value=k.value.value),p("search",u.value)},500)},y=e.computed(()=>{let r=a.options;return u.value.length>=1&&(r=r.filter(o=>{if(isNaN(o)===!1&&Number(o)===Number(u.value))return!0;if(typeof o=="string"&&o.toLowerCase().includes(u.value.toLowerCase()))return!0;if(typeof o=="object"&&o!==null&&Object.prototype.toString.call(o)==="[object Object]")for(const n of Object.keys(o)){if(isNaN(o[n])===!1&&Number(o[n])===Number(u.value))return!0;if(typeof o[n]=="string"&&o[n].toLowerCase().includes(u.value.toLowerCase()))return!0}return!1})),r}),g=((r=10)=>{let o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n="";for(let v=0;v<r;v++)n+=o.charAt(Math.floor(Math.random()*o.length));return n})(),f=r=>{var o;r.target.style.display="none",d.value=!1,(o=k.value)!=null&&o.value&&(k.value.value="",u.value="")},s=(r,o="")=>{o!==""?l.value.map(n=>n[o]).includes(r[o])?l.value.splice(l.value.findIndex(n=>n[o]===r[o]),1):l.value.push(r):l.value.includes(r)?l.value.splice(l.value.findIndex(n=>n===r),1):l.value.push(r),p("update:modelValue",l.value),p("change",l.value,r)},t=r=>{typeof r=="object"&&r!==null&&String(a.datatype).toLowerCase()==="string"?(l.value=r[String(a.dataprop||a.prop)],p("update:modelValue",String(l.value))):typeof r=="object"&&r!==null&&String(a.datatype).toLowerCase()==="number"?(l.value=r[String(a.dataprop||a.prop)],p("update:modelValue",Number(l.value))):(l.value=r,p("update:modelValue",l.value)),d.value=!1,p("change",l.value,r)},i=e.computed(()=>{let r=(a==null?void 0:a.placeholder)||"-- Select option --";if(y.value.length>=1)if(typeof l.value=="number"){let o=y.value.filter(n=>Number(n[String(a.dataprop||a.prop)])===Number(l.value));typeof y.value[0]=="object"&&o.length>=1?r=o[0][String(a.prop)]:typeof y.value[0]=="number"&&(r=l.value)}else if(typeof l.value=="string"){let o=y.value.filter(n=>String(n[String(a.dataprop||a.prop)])===l.value);typeof y.value[0]=="object"&&o.length>=1?r=o[0][String(a.prop)]:typeof y.value[0]=="string"&&l.value!==""&&(r=l.value)}else typeof l.value=="object"&&(Array.isArray(l.value)&&l.value.length>=1?typeof l.value[0]=="object"&&String(a.prop)in l.value[0]?r=l.value.map(o=>o[String(a.prop)]).join(", "):r=l.value.join(", "):l.value!==null&&String(a.prop)in l.value&&(r=l.value[String(a.prop)]));return r});return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["picker suggestion tedirCategory",{active:d.value,pickerUp:c.up}])},[e.createElementVNode("div",{class:"pickerBackdrop",style:e.normalizeStyle({display:d.value?"block":"none"}),onClick:f},null,4),e.createElementVNode("div",we,[e.createElementVNode("div",{class:"select pickerToggler",onClick:o[0]||(o[0]=n=>d.value=!d.value)},e.toDisplayString(e.unref(i)),1),e.createElementVNode("div",je,[e.createElementVNode("div",Ie,[e.createElementVNode("input",{type:"search",ref_key:"searchRef",ref:k,onInput:m,class:"input"},null,544)]),Array.isArray(l.value)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pickerMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*42+"px":"auto"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),(n,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+n},[typeof n=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:e.withModifiers(C=>s(n),["stop"]),class:"pickerItem"},[e.createElementVNode("div",xe,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(n),id:"check-"+(e.unref(g)+String(v)),style:{"pointer-events":"none"}},null,8,Oe),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(g)+String(v)),style:{"pointer-events":"none"}},e.toDisplayString(n),9,Le)])],8,_e)):typeof n=="object"&&n!==null&&c.prop in n?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:e.withModifiers(C=>s(n,c.prop),["stop"]),class:"pickerItem"},[e.createElementVNode("div",Me,[e.createElementVNode("input",{type:"checkbox",class:"checkInput",checked:l.value.includes(n),id:"check-"+(e.unref(g)+String(v)),style:{"pointer-events":"none"}},null,8,Fe),e.createElementVNode("label",{class:"checkLabel",for:"check-"+(e.unref(g)+String(v)),style:{"pointer-events":"none"}},e.toDisplayString(n[c.prop]),9,Te)])],8,ze)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(C=>s(n),["stop"]),class:"pickerItem"},[e.renderSlot(r.$slots,"default",{option:n,selected:l.value},void 0,!0)],8,De))],64))),128))],4)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"pickerMenu",style:e.normalizeStyle({"max-height":Number(c.size)!==0?Number(c.size)*42+"px":"auto"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),(n,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"option-"+n},[typeof n=="string"?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:C=>t(n),class:e.normalizeClass(["pickerItem",l.value===n?"active":""])},e.toDisplayString(n),11,Ae)):typeof n=="object"&&n!==null&&c.prop in n?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:C=>t(n),class:e.normalizeClass(["pickerItem",l.value[c.prop]===n[c.prop]||String(n[c.dataprop||c.prop])===String(l.value)?"active":""])},e.toDisplayString(n[c.prop]),11,Re)):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:e.withModifiers(C=>t(n),["stop"]),class:e.normalizeClass(["pickerItem",l.value===n?"active":""])},[e.renderSlot(r.$slots,"default",{option:n,selected:l.value},void 0,!0)],10,We))],64))),128))],4)),e.createElementVNode("div",He,[e.createElementVNode("div",Ue,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":o[1]||(o[1]=n=>h.value=n),class:"input",placeholder:"Add New Category"},null,512),[[e.vModelText,h.value]]),e.createElementVNode("button",{type:"button",class:"button tedirCategoryButton",onClick:o[2]||(o[2]=n=>{p("add",h.value),h.value=""})},"Save")])])])])],2))}}),Ze="",Pe=N(Ke,[["__scopeId","data-v-9bd9abf8"]]);b.CategoryBox=Pe,b.ComboBox=Z,b.ListBox=me,b.SelectBox=U,b.TagBox=$e,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "tedir-select", | ||
"version": "0.0.1-beta-10", | ||
"version": "0.0.1-beta-11", | ||
"description": "Tedir Select is a Vue 3 & Web Component Custom SelectBox, ListBox, Taggable, etc.", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue/tedir-select-vue.umd.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
588171
6747