dk-plus
Version:
101 lines (100 loc) • 3.05 kB
JavaScript
import m from "./index2.js";
import { resolveComponent as k, openBlock as l, createElementBlock as d, createVNode as p, createSlots as g, withCtx as t, renderSlot as n, Transition as v, withDirectives as $, createElementVNode as y, createTextVNode as i, createCommentVNode as u, Fragment as w, renderList as h, normalizeClass as V, withModifiers as b, toDisplayString as C, vShow as c } from "vue";
import B from "../../_virtual/index.js";
const D = {
ref: "dropdownRef",
class: "dk-autocomplete_dropdown"
}, N = {
key: 0,
class: "dk-autocomplete_loading"
}, S = ["onClick"], z = {
key: 1,
class: "dk-autocomplete_empty"
};
function F(e, s, K, R, T, E) {
const f = k("dk-input");
return l(), d("div", {
ref: "rootRef",
class: "dk-autocomplete",
onKeydown: s[2] || (s[2] = (...o) => e.onKeydown && e.onKeydown(...o))
}, [
p(f, {
modelValue: e.inputValue,
"onUpdate:modelValue": s[0] || (s[0] = (o) => e.inputValue = o),
disabled: e.disabled,
clearable: e.clearable,
placeholder: e.placeholder,
size: e.size,
onFocus: e.onFocus,
onBlur: e.onBlur
}, g({ _: 2 }, [
e.$slots.prefix ? {
name: "prefix",
fn: t(() => [
n(e.$slots, "prefix")
]),
key: "0"
} : void 0,
e.$slots.suffix ? {
name: "suffix",
fn: t(() => [
n(e.$slots, "suffix")
]),
key: "1"
} : void 0,
e.$slots.prepend ? {
name: "prepend",
fn: t(() => [
n(e.$slots, "prepend")
]),
key: "2"
} : void 0,
e.$slots.append ? {
name: "append",
fn: t(() => [
n(e.$slots, "append")
]),
key: "3"
} : void 0
]), 1032, ["modelValue", "disabled", "clearable", "placeholder", "size", "onFocus", "onBlur"]),
p(v, { name: "Dk-trigger" }, {
default: t(() => [
$(y("div", D, [
e.loading && !e.hideLoading ? (l(), d("div", N, [
n(e.$slots, "loading", {}, () => [
i(" loading... ")
])
])) : u("", !0),
(l(!0), d(w, null, h(e.suggestions, (o, r) => (l(), d("div", {
key: r,
ref_for: !0,
ref: (a) => e.setItemRef(a, r),
class: V([
"dk-autocomplete_item",
{ "is-active": r === e.activeIndex }
]),
onMousedown: s[1] || (s[1] = b(() => {
}, ["prevent"])),
onClick: (a) => e.onSelect(o)
}, [
n(e.$slots, "default", { item: o }, () => [
i(C(e.getOptionText(o)), 1)
])
], 42, S))), 128)),
!e.loading && e.suggestions.length === 0 ? (l(), d("div", z, [
n(e.$slots, "empty", {}, () => [
i(" No Data ")
])
])) : u("", !0)
], 512), [
[c, e.showDropdown]
])
]),
_: 3
})
], 544);
}
const O = /* @__PURE__ */ B(m, [["render", F]]);
export {
O as default
};