hisonvue 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +248 -0
- package/dist/HAccordion-CPtgQUK0.js +1 -0
- package/dist/HAccordion-ll-4cIAw.mjs +262 -0
- package/dist/HBaggie-D6omQoFh.js +1 -0
- package/dist/HBaggie-D_7mEiuV.mjs +283 -0
- package/dist/HBanner-DmcMOFqS.mjs +420 -0
- package/dist/HBanner-Io4SdGGs.js +1 -0
- package/dist/HButton-DAVuDmOQ.js +1 -0
- package/dist/HButton-DAriO81x.mjs +256 -0
- package/dist/HCalendar-DKwGatUk.js +2 -0
- package/dist/HCalendar-w18iIB90.mjs +3387 -0
- package/dist/HCaption-6CbSqRA7.js +1 -0
- package/dist/HCaption-DwsXHDNK.mjs +275 -0
- package/dist/HChart-C86JXUyW.js +1 -0
- package/dist/HChart-CcArHFr0.mjs +179 -0
- package/dist/HDrawer-DG1O42iF.mjs +439 -0
- package/dist/HDrawer-U5VC_okK.js +1 -0
- package/dist/HDropdown-Bs7AfefJ.mjs +393 -0
- package/dist/HDropdown-D4RAGmjE.js +1 -0
- package/dist/HFileset-BGuP9O4l.mjs +578 -0
- package/dist/HFileset-CuPR6Hwf.js +2 -0
- package/dist/HGap-BPAdnOQz.js +1 -0
- package/dist/HGap-DzGrfWVt.mjs +233 -0
- package/dist/HGrid-BiIhVCv_.mjs +345 -0
- package/dist/HGrid-C3EV_pgM.js +1 -0
- package/dist/HImagebox-D_DKeCrO.mjs +654 -0
- package/dist/HImagebox-t_UdFjQO.js +2 -0
- package/dist/HInput-BEyJqYkD.mjs +1103 -0
- package/dist/HInput-DMGLY473.js +1 -0
- package/dist/HInputGroup-D37WTYoI.mjs +281 -0
- package/dist/HInputGroup-Dcfr23sZ.js +1 -0
- package/dist/HLabel-B2FOqSiS.mjs +369 -0
- package/dist/HLabel-Dm48mSwn.js +1 -0
- package/dist/HLayout-BbCEm_aO.mjs +196 -0
- package/dist/HLayout-C1e4BZ_K.js +1 -0
- package/dist/HList-CAeYb-hz.mjs +419 -0
- package/dist/HList-eNXmMf27.js +1 -0
- package/dist/HModal-BDBEEpKm.mjs +778 -0
- package/dist/HModal-GODLq3wH.js +1 -0
- package/dist/HNote-CWnUjt3_.mjs +934 -0
- package/dist/HNote-D_Xwu9oL.js +1 -0
- package/dist/HPagination-Db_L9wv-.js +1 -0
- package/dist/HPagination-e5e2a5GS.mjs +496 -0
- package/dist/HParagraph-BRuSeOMU.js +1 -0
- package/dist/HParagraph-DYuB-qjY.mjs +463 -0
- package/dist/HPopup-Brp1FVpm.mjs +431 -0
- package/dist/HPopup-ChkoI3xm.js +1 -0
- package/dist/HSpinner-DDtU9PL_.js +1 -0
- package/dist/HSpinner-DOq2k5kT.mjs +281 -0
- package/dist/HTable-DGFnzD4u.js +1 -0
- package/dist/HTable-GCDP5O_J.mjs +620 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/ar.es-CKau4tBl.js +5 -0
- package/dist/ar.es-XxSuE68c.mjs +57 -0
- package/dist/bg.es-BJ7fu6yy.mjs +57 -0
- package/dist/bg.es-Melqx1M5.js +5 -0
- package/dist/bn.es-CYlBkxc5.mjs +57 -0
- package/dist/bn.es-ClbAZ4WP.js +5 -0
- package/dist/bs.es-KjOcbE96.js +5 -0
- package/dist/bs.es-yMnaKmdi.mjs +57 -0
- package/dist/ca.es-BaGTENcW.js +5 -0
- package/dist/ca.es-DIhlxmQc.mjs +67 -0
- package/dist/cs.es-BN8oxRXQ.mjs +57 -0
- package/dist/cs.es-ChOlHqBr.js +5 -0
- package/dist/da.es-DJB5lAli.mjs +57 -0
- package/dist/da.es-DOFXbf8-.js +5 -0
- package/dist/de.es-DwE82Kaw.js +5 -0
- package/dist/de.es-glb8GeJh.mjs +57 -0
- package/dist/drag-and-drop.es-4ttM1tRs.js +5 -0
- package/dist/drag-and-drop.es-Ckzp6XEn.mjs +183 -0
- package/dist/el.es-CNrCgzYI.js +5 -0
- package/dist/el.es-_bBZf22h.mjs +76 -0
- package/dist/en.es-CV9nmQGr.mjs +57 -0
- package/dist/en.es-CgL601qd.js +5 -0
- package/dist/es.es-CZjcWK54.mjs +57 -0
- package/dist/es.es-IdFGKY7Q.js +5 -0
- package/dist/et.es-BygWmV3P.js +5 -0
- package/dist/et.es-CjvQAzNF.mjs +57 -0
- package/dist/fa.es-DW_0SmsT.js +5 -0
- package/dist/fa.es-DykeFwDA.mjs +57 -0
- package/dist/fi.es-Bl7Pp7AO.mjs +57 -0
- package/dist/fi.es-pgfJlZ8i.js +5 -0
- package/dist/fr.es-CNKVhFfO.mjs +57 -0
- package/dist/fr.es-OENguFuM.js +5 -0
- package/dist/he.es-bixEnAeH.js +5 -0
- package/dist/he.es-nF4GFhjH.mjs +57 -0
- package/dist/hisonvue.cjs.js +1 -0
- package/dist/hisonvue.css +1 -0
- package/dist/hisonvue.d.ts +19934 -0
- package/dist/hisonvue.es.js +114 -0
- package/dist/hr.es-CkRAP94O.js +5 -0
- package/dist/hr.es-QFfz660j.mjs +57 -0
- package/dist/hu.es-Ck2rE01V.mjs +57 -0
- package/dist/hu.es-DG6HeiQJ.js +5 -0
- package/dist/id.es-D4tPi6wP.js +5 -0
- package/dist/id.es-Je7FEUJ5.mjs +57 -0
- package/dist/index-BmKMHsSZ.js +153 -0
- package/dist/index-DUh7pai4.mjs +19976 -0
- package/dist/is.es-CDFqLYCV.js +5 -0
- package/dist/is.es-bzprHvXI.mjs +57 -0
- package/dist/it.es-BHgrw_C6.js +5 -0
- package/dist/it.es-CJtfqmNS.mjs +57 -0
- package/dist/ja.es-BaiGjqZ6.mjs +57 -0
- package/dist/ja.es-D-lxWwyb.js +5 -0
- package/dist/ka.es-CnnB6q4A.js +5 -0
- package/dist/ka.es-x9QJo_dl.mjs +57 -0
- package/dist/ko.es-6c447eTS.mjs +57 -0
- package/dist/ko.es-b18aaB3V.js +5 -0
- package/dist/lt.es-2twYdvmJ.mjs +57 -0
- package/dist/lt.es-BY9UQ6wZ.js +5 -0
- package/dist/mn.es-BLQRG1uu.mjs +57 -0
- package/dist/mn.es-YFS7gSdf.js +5 -0
- package/dist/nl.es-BEx-4hnj.js +5 -0
- package/dist/nl.es-bB1qWR_S.mjs +57 -0
- package/dist/no.es-BQnRWlWR.js +5 -0
- package/dist/no.es-CWDVXpTf.mjs +57 -0
- package/dist/pl.es-CKCsZ_02.js +5 -0
- package/dist/pl.es-Dzct23w9.mjs +57 -0
- package/dist/pt-br.es-BeBuiitI.mjs +57 -0
- package/dist/pt-br.es-oH7qh6Fd.js +5 -0
- package/dist/pt-pt.es-BeBuiitI.mjs +57 -0
- package/dist/pt-pt.es-DLk5I0ej.js +5 -0
- package/dist/ro.es-DfMVJ30M.mjs +57 -0
- package/dist/ro.es-DgTen1Dh.js +5 -0
- package/dist/ru.es-Bv9UvrBe.mjs +67 -0
- package/dist/ru.es-jGIQfREl.js +5 -0
- package/dist/scrollManager-BGnq4wyt.mjs +14 -0
- package/dist/scrollManager-CEEWQwoK.js +1 -0
- package/dist/setButtonCssEvent-B9WTs2X7.js +1 -0
- package/dist/setButtonCssEvent-dBs1GcAh.mjs +70 -0
- package/dist/sk.es-CUOTpLuL.mjs +57 -0
- package/dist/sk.es-D2bhVb26.js +5 -0
- package/dist/sl.es-DeIGgZbR.mjs +57 -0
- package/dist/sl.es-TV8Uraa1.js +5 -0
- package/dist/sq.es-CQJJrZHv.mjs +67 -0
- package/dist/sq.es-Cc65zxbr.js +5 -0
- package/dist/sr.es-CKS0AkiW.mjs +57 -0
- package/dist/sr.es-D5VNA_GW.js +5 -0
- package/dist/sv.es-ChHQRrAe.mjs +57 -0
- package/dist/sv.es-dBeK_DZs.js +5 -0
- package/dist/tr.es-B3v90gVv.mjs +57 -0
- package/dist/tr.es-BUz4S13G.js +5 -0
- package/dist/uk.es-B8uaeLcK.js +5 -0
- package/dist/uk.es-CiR4NnbN.mjs +67 -0
- package/dist/vi.es-2OFMtbQI.js +5 -0
- package/dist/vi.es-DFDi5l7p.mjs +67 -0
- package/dist/zh-cn.es-9cbEAuAi.mjs +67 -0
- package/dist/zh-cn.es-fDHCbCIg.js +5 -0
- package/dist/zh-hk.es-COzeh5F8.js +5 -0
- package/dist/zh-hk.es-z0tio4jE.mjs +67 -0
- package/nuxt/module.mjs +39 -0
- package/nuxt/plugin.mjs +21 -0
- package/package.json +53 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { defineComponent as de, ref as o, computed as d, onMounted as ve, onBeforeUnmount as ce, watch as i, unref as J, nextTick as ge, createElementBlock as $, openBlock as B, normalizeStyle as L, normalizeClass as U, createElementVNode as h, withKeys as Q, withModifiers as Z, renderSlot as me, toDisplayString as _, createCommentVNode as fe, Fragment as ye, renderList as be } from "vue";
|
|
2
|
+
import { T as pe, w as m, D as he, x as Se, E as we, y as z, g as Ce, u as Ae, e as Ne, t as Ie, b as ee, h as S, r as Te, c as Ee, d as Oe } from "./index-DUh7pai4.mjs";
|
|
3
|
+
import { a as De, r as ke } from "./setButtonCssEvent-dBs1GcAh.mjs";
|
|
4
|
+
import { _ as Me } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
5
|
+
const Ve = {
|
|
6
|
+
/**
|
|
7
|
+
* Unique identifier for the dropdown instance.
|
|
8
|
+
* - Retrieve methods via `hison.component.getDropdown(id)`
|
|
9
|
+
* - ⚠️ Duplicate `id` will throw at mount time
|
|
10
|
+
*/
|
|
11
|
+
id: { type: String, required: !1 },
|
|
12
|
+
/**
|
|
13
|
+
* Custom class applied to the dropdown (string / array / object).
|
|
14
|
+
* - Works with responsive classes like `hison-col-*`, `hison-size-*`, etc.
|
|
15
|
+
*/
|
|
16
|
+
class: {
|
|
17
|
+
type: [String, Array, Object],
|
|
18
|
+
required: !1
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* Inline styles for the root container (`.hison-dropdown`).
|
|
22
|
+
*/
|
|
23
|
+
style: {
|
|
24
|
+
type: [String, Object, Array],
|
|
25
|
+
required: !1
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Inline styles for the toggle area (`.hison-dropdown-toggle`).
|
|
29
|
+
*/
|
|
30
|
+
toggleStyle: {
|
|
31
|
+
type: [String, Object, Array],
|
|
32
|
+
required: !1
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Inline styles for the menu container (`.hison-dropdown-menu`).
|
|
36
|
+
* Merged on top of internal computed styles (e.g., maxHeight, overflow).
|
|
37
|
+
*/
|
|
38
|
+
menuStyle: {
|
|
39
|
+
type: [String, Object, Array],
|
|
40
|
+
required: !1
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* Inline styles applied to each option item (`.hison-dropdown-item`).
|
|
44
|
+
*/
|
|
45
|
+
itemStyle: {
|
|
46
|
+
type: [String, Object, Array],
|
|
47
|
+
required: !1
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Visibility flag
|
|
51
|
+
*/
|
|
52
|
+
visible: { type: Boolean, default: !0 },
|
|
53
|
+
/**
|
|
54
|
+
* Edit mode of the dropdown.
|
|
55
|
+
* - 'editable' | 'disable' | 'readonly'
|
|
56
|
+
*/
|
|
57
|
+
editMode: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: z.editable,
|
|
60
|
+
validator: (l) => we.includes(l)
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Placeholder text shown when no value selected
|
|
64
|
+
*/
|
|
65
|
+
placeholder: { type: String, default: "" },
|
|
66
|
+
/**
|
|
67
|
+
* Trigger type to open menu
|
|
68
|
+
* - 'click': click/tap to toggle
|
|
69
|
+
* - 'hover': mouseenter/mouseleave
|
|
70
|
+
*/
|
|
71
|
+
trigger: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: Se.click,
|
|
74
|
+
validator: (l) => he.includes(l)
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Model: { value, options }
|
|
78
|
+
* - value: selected value
|
|
79
|
+
* - options: array of { label, value, disabled? }
|
|
80
|
+
* - Supports v-model
|
|
81
|
+
*/
|
|
82
|
+
modelValue: { type: Object, required: !0 },
|
|
83
|
+
/**
|
|
84
|
+
* Max menu height in px (scrolls when overflown)
|
|
85
|
+
*/
|
|
86
|
+
maxHeight: {
|
|
87
|
+
type: Number,
|
|
88
|
+
default: 240,
|
|
89
|
+
validator: (l) => Number.isFinite(l) && l >= 0
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Close menu when selecting an option
|
|
93
|
+
*/
|
|
94
|
+
closeOnSelect: { type: Boolean, default: !0 },
|
|
95
|
+
/**
|
|
96
|
+
* Text alignment for toggle and menu.
|
|
97
|
+
* - 'left' | 'center' | 'right'
|
|
98
|
+
* - Applies to both the toggle and the menu container.
|
|
99
|
+
*/
|
|
100
|
+
textAlign: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: m.left,
|
|
103
|
+
validator: (l) => pe.includes(l)
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Animate menu open/close & caret rotation.
|
|
107
|
+
*/
|
|
108
|
+
animate: { type: Boolean, default: !0 },
|
|
109
|
+
/**
|
|
110
|
+
* Animation duration in ms.
|
|
111
|
+
* Applied via CSS var `--hdd-duration`.
|
|
112
|
+
*/
|
|
113
|
+
duration: {
|
|
114
|
+
type: Number,
|
|
115
|
+
default: 500,
|
|
116
|
+
validator: (l) => Number.isFinite(l) && l >= 0
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* CSS timing function (e.g., 'ease', 'linear', 'ease-in-out', 'cubic-bezier(...)').
|
|
120
|
+
* Applied via CSS var `--hdd-easing`.
|
|
121
|
+
*/
|
|
122
|
+
easing: { type: String, default: "ease" },
|
|
123
|
+
/**
|
|
124
|
+
* Controls keyboard focus order of the element.
|
|
125
|
+
* - `0` enables natural tab navigation, positive numbers set custom order.
|
|
126
|
+
* - `null` or `''` removes tabindex (not focusable).
|
|
127
|
+
*/
|
|
128
|
+
tabIndex: {
|
|
129
|
+
type: [Number, String],
|
|
130
|
+
default: null,
|
|
131
|
+
validator: (l) => l === null || l === "" || !isNaN(+l) && isFinite(+l)
|
|
132
|
+
}
|
|
133
|
+
}, Le = de({
|
|
134
|
+
name: "HDropdown",
|
|
135
|
+
props: Ve,
|
|
136
|
+
inheritAttrs: !1,
|
|
137
|
+
emits: ["mounted", "responsive-change", "open", "close", "toggle-click", "item-click", "change", "update:modelValue"],
|
|
138
|
+
setup(l, { emit: t }) {
|
|
139
|
+
var X, Y;
|
|
140
|
+
const c = l.id || Ce(), R = `hdropdown:${c}`, s = o(null), w = o(null), a = Ae(), u = o(!1), v = o(((X = l.modelValue) == null ? void 0 : X.options) ?? []), r = o(((Y = l.modelValue) == null ? void 0 : Y.value) ?? null), y = o(!!l.visible), b = o(l.editMode), C = d(() => b.value === z.disable), A = d(() => b.value === z.readonly), F = o(l.placeholder || ""), N = o(l.trigger), I = o(l.textAlign ?? m.left), le = d(() => ({ textAlign: I.value })), T = o(l.animate ?? !0), E = o(l.duration ?? 500), O = o(l.easing ?? "ease"), D = o(
|
|
141
|
+
l.tabIndex !== null && l.tabIndex !== "" ? Number(l.tabIndex) : null
|
|
142
|
+
), ne = d(() => ({
|
|
143
|
+
"--hdd-duration": `${E.value}ms`,
|
|
144
|
+
"--hdd-easing": O.value
|
|
145
|
+
})), te = d(() => y.value ? "" : "hison-display-none"), ae = d(() => C.value ? "hison-disable" : ""), oe = d(() => A.value ? "hison-readonly" : ""), H = o([]), j = () => {
|
|
146
|
+
H.value = Ne(Ie(l.class) || "", a.value), ee(H.value, "size", S.componentStyle.size), ee(H.value, "color", "primary");
|
|
147
|
+
}, G = d(() => {
|
|
148
|
+
const e = v.value.find((n) => n.value === r.value);
|
|
149
|
+
return (e == null ? void 0 : e.label) ?? "";
|
|
150
|
+
}), k = o(l.maxHeight ?? 240), ie = d(() => ({
|
|
151
|
+
maxHeight: `${k.value}px`,
|
|
152
|
+
overflowY: "auto"
|
|
153
|
+
})), M = o(l.closeOnSelect ?? !0), se = d(() => {
|
|
154
|
+
const e = v.value.findIndex((n) => n.value === r.value);
|
|
155
|
+
return e >= 0 ? `opt-${e}` : void 0;
|
|
156
|
+
}), K = (e) => {
|
|
157
|
+
if (!u.value) return;
|
|
158
|
+
const n = e.target, f = !!s.value && !!n && s.value.contains(n), p = !!w.value && !!n && w.value.contains(n);
|
|
159
|
+
!f && !p && V();
|
|
160
|
+
}, q = (e) => {
|
|
161
|
+
C.value || A.value || !y.value || u.value || (u.value = !0, t("open", e ?? null, g.value));
|
|
162
|
+
}, V = (e) => {
|
|
163
|
+
var p;
|
|
164
|
+
if (!u.value) return;
|
|
165
|
+
const n = document.activeElement, f = w.value;
|
|
166
|
+
f && n && f.contains(n) && ((p = s.value) == null || p.focus()), u.value = !1, t("close", e ?? null, g.value);
|
|
167
|
+
}, x = (e) => u.value ? V(e) : q(e), ue = (e) => {
|
|
168
|
+
N.value === "click" && (C.value || A.value || (t("toggle-click", e, g.value), x(e)));
|
|
169
|
+
}, re = (e, n) => {
|
|
170
|
+
if (e.disabled || C.value || A.value) return;
|
|
171
|
+
n && t("item-click", n, g.value, e);
|
|
172
|
+
const f = r.value;
|
|
173
|
+
if (e.value !== f) {
|
|
174
|
+
r.value = e.value;
|
|
175
|
+
const p = { value: r.value, options: J(v) };
|
|
176
|
+
t("update:modelValue", p), t("change", f, r.value, g.value);
|
|
177
|
+
}
|
|
178
|
+
M.value && V(n);
|
|
179
|
+
}, g = o(null), P = () => {
|
|
180
|
+
S.component.dropdownList[c] && S.component.dropdownList[c].isHisonvueComponent && console.warn(`[Hisonvue] The dropdown ID is at risk of being duplicated. ${c}`), Te(R, () => {
|
|
181
|
+
W(), ge(P);
|
|
182
|
+
}), s.value && De(s.value), j(), g.value = {
|
|
183
|
+
isHisonvueComponent: !0,
|
|
184
|
+
getId: () => c,
|
|
185
|
+
getType: () => "dropdown",
|
|
186
|
+
isVisible: () => y.value,
|
|
187
|
+
setVisible: (e) => {
|
|
188
|
+
y.value = e;
|
|
189
|
+
},
|
|
190
|
+
getEditMode: () => b.value,
|
|
191
|
+
setEditMode: (e) => {
|
|
192
|
+
b.value = e;
|
|
193
|
+
},
|
|
194
|
+
isOpen: () => u.value,
|
|
195
|
+
open: q,
|
|
196
|
+
close: V,
|
|
197
|
+
toggle: x,
|
|
198
|
+
getValue: () => r.value,
|
|
199
|
+
setValue: (e) => {
|
|
200
|
+
r.value = e;
|
|
201
|
+
},
|
|
202
|
+
getText: () => G.value,
|
|
203
|
+
getOptions: () => J(v),
|
|
204
|
+
setOptions: (e) => {
|
|
205
|
+
v.value = Array.isArray(e) ? e : [];
|
|
206
|
+
},
|
|
207
|
+
setTriggerType: (e) => {
|
|
208
|
+
N.value = e;
|
|
209
|
+
},
|
|
210
|
+
getMaxHeight: () => k.value,
|
|
211
|
+
setMaxHeight: (e) => {
|
|
212
|
+
const n = Number(e);
|
|
213
|
+
!Number.isFinite(n) || n < 0 || (k.value = n);
|
|
214
|
+
},
|
|
215
|
+
isCloseOnSelect: () => M.value,
|
|
216
|
+
setCloseOnSelect: (e) => {
|
|
217
|
+
M.value = !!e;
|
|
218
|
+
},
|
|
219
|
+
getTextAlign: () => I.value,
|
|
220
|
+
setTextAlign: (e) => {
|
|
221
|
+
(e === m.left || e === m.center || e === m.right) && (I.value = e);
|
|
222
|
+
},
|
|
223
|
+
getAnimate: () => T.value,
|
|
224
|
+
setAnimate: (e) => {
|
|
225
|
+
T.value = !!e;
|
|
226
|
+
},
|
|
227
|
+
getDuration: () => E.value,
|
|
228
|
+
setDuration: (e) => {
|
|
229
|
+
const n = Number(e);
|
|
230
|
+
Number.isFinite(n) && n >= 0 && (E.value = n);
|
|
231
|
+
},
|
|
232
|
+
getEasing: () => O.value,
|
|
233
|
+
setEasing: (e) => {
|
|
234
|
+
typeof e == "string" && (O.value = e);
|
|
235
|
+
},
|
|
236
|
+
getTabIndex: () => D.value,
|
|
237
|
+
setTabIndex: (e) => {
|
|
238
|
+
D.value = e != null ? Number(e) : null;
|
|
239
|
+
},
|
|
240
|
+
focus: () => {
|
|
241
|
+
var e;
|
|
242
|
+
(e = s.value) == null || e.focus();
|
|
243
|
+
},
|
|
244
|
+
reload: () => Ee(R)
|
|
245
|
+
}, S.component.dropdownList[c] = g.value, document.addEventListener("mousedown", K), t("mounted", g.value);
|
|
246
|
+
}, W = () => {
|
|
247
|
+
var e;
|
|
248
|
+
Oe(R);
|
|
249
|
+
try {
|
|
250
|
+
document.removeEventListener("mousedown", K);
|
|
251
|
+
} catch {
|
|
252
|
+
}
|
|
253
|
+
s.value && ke(s.value), (e = S.component) != null && e.dropdownList && delete S.component.dropdownList[c];
|
|
254
|
+
};
|
|
255
|
+
return ve(P), ce(W), i(() => l.modelValue, (e) => {
|
|
256
|
+
!e || typeof e != "object" || (Array.isArray(e.options) && (v.value = e.options), r.value = e.value);
|
|
257
|
+
}, { deep: !0 }), i(a, (e) => {
|
|
258
|
+
j(), t("responsive-change", e);
|
|
259
|
+
}), i(() => l.visible, (e) => {
|
|
260
|
+
!!e !== y.value && (y.value = !!e);
|
|
261
|
+
}), i(() => l.editMode, (e) => {
|
|
262
|
+
e && e !== b.value && (b.value = e);
|
|
263
|
+
}), i(() => l.placeholder, (e) => {
|
|
264
|
+
const n = e ?? "";
|
|
265
|
+
n !== F.value && (F.value = n);
|
|
266
|
+
}), i(() => l.trigger, (e) => {
|
|
267
|
+
e && e !== N.value && (N.value = e);
|
|
268
|
+
}), i(() => l.textAlign, (e) => {
|
|
269
|
+
(e === m.left || e === m.center || e === m.right) && e !== I.value && (I.value = e);
|
|
270
|
+
}), i(() => l.animate, (e) => {
|
|
271
|
+
const n = !!e;
|
|
272
|
+
n !== T.value && (T.value = n);
|
|
273
|
+
}), i(() => l.duration, (e) => {
|
|
274
|
+
const n = Number(e);
|
|
275
|
+
Number.isFinite(n) && n >= 0 && n !== E.value && (E.value = n);
|
|
276
|
+
}), i(() => l.easing, (e) => {
|
|
277
|
+
const n = typeof e == "string" ? e : "ease";
|
|
278
|
+
n !== O.value && (O.value = n);
|
|
279
|
+
}), i(() => l.tabIndex, (e) => {
|
|
280
|
+
const n = e === null || e === "" ? null : Number(e);
|
|
281
|
+
n !== D.value && (D.value = n);
|
|
282
|
+
}), i(() => l.maxHeight, (e) => {
|
|
283
|
+
const n = Number(e);
|
|
284
|
+
Number.isFinite(n) && n >= 0 && n !== k.value && (k.value = n);
|
|
285
|
+
}), i(() => l.closeOnSelect, (e) => {
|
|
286
|
+
const n = !!e;
|
|
287
|
+
n !== M.value && (M.value = n);
|
|
288
|
+
}), i(() => l.class, () => {
|
|
289
|
+
j();
|
|
290
|
+
}), {
|
|
291
|
+
toggleRef: s,
|
|
292
|
+
menuRef: w,
|
|
293
|
+
props: l,
|
|
294
|
+
isDisabled: C,
|
|
295
|
+
isReadonly: A,
|
|
296
|
+
visibleClass: te,
|
|
297
|
+
disableClass: ae,
|
|
298
|
+
readonlyClass: oe,
|
|
299
|
+
responsiveClassList: H,
|
|
300
|
+
isOpen: u,
|
|
301
|
+
trigger: N,
|
|
302
|
+
selectedValue: r,
|
|
303
|
+
selectedLabel: G,
|
|
304
|
+
placeholder: F,
|
|
305
|
+
activeDescId: se,
|
|
306
|
+
menuInlineStyle: ie,
|
|
307
|
+
options: v,
|
|
308
|
+
animate: T,
|
|
309
|
+
rootInlineStyle: ne,
|
|
310
|
+
tabIndex: D,
|
|
311
|
+
onToggleClick: ue,
|
|
312
|
+
onSelect: re,
|
|
313
|
+
textAlignStyle: le,
|
|
314
|
+
open: q,
|
|
315
|
+
close: V,
|
|
316
|
+
toggle: x
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}), Re = ["aria-expanded", "aria-disabled", "tabindex"], He = { class: "hison-dropdown-label" }, $e = ["aria-activedescendant", "inert"], Be = { class: "hison-dropdown-panel" }, Fe = ["aria-selected", "onClick"], je = {
|
|
320
|
+
key: 0,
|
|
321
|
+
class: "hison-dropdown-empty"
|
|
322
|
+
};
|
|
323
|
+
function qe(l, t, c, R, s, w) {
|
|
324
|
+
return B(), $("div", {
|
|
325
|
+
class: U([
|
|
326
|
+
"hison-dropdown",
|
|
327
|
+
...l.responsiveClassList,
|
|
328
|
+
l.visibleClass,
|
|
329
|
+
l.disableClass,
|
|
330
|
+
l.readonlyClass,
|
|
331
|
+
l.isOpen ? "hison-open" : "",
|
|
332
|
+
l.animate ? "" : "hison-no-anim"
|
|
333
|
+
]),
|
|
334
|
+
style: L([l.rootInlineStyle, l.props.style]),
|
|
335
|
+
onMouseenter: t[3] || (t[3] = (a) => l.trigger === "hover" ? l.open(a) : null),
|
|
336
|
+
onMouseleave: t[4] || (t[4] = (a) => l.trigger === "hover" ? l.close(a) : null)
|
|
337
|
+
}, [
|
|
338
|
+
h("div", {
|
|
339
|
+
ref: "toggleRef",
|
|
340
|
+
class: U(["hison-dropdown-toggle", [
|
|
341
|
+
l.isDisabled ? "hison-disable" : "",
|
|
342
|
+
l.isReadonly ? "hison-readonly" : ""
|
|
343
|
+
]]),
|
|
344
|
+
"aria-expanded": l.isOpen,
|
|
345
|
+
role: "combobox",
|
|
346
|
+
"aria-disabled": l.isDisabled || l.isReadonly ? "true" : "false",
|
|
347
|
+
tabindex: l.tabIndex ?? void 0,
|
|
348
|
+
style: L([l.textAlignStyle, l.props.toggleStyle]),
|
|
349
|
+
onClick: t[0] || (t[0] = (a) => l.onToggleClick(a)),
|
|
350
|
+
onKeydown: [
|
|
351
|
+
t[1] || (t[1] = Q(Z((a) => l.onToggleClick(a), ["prevent"]), ["enter"])),
|
|
352
|
+
t[2] || (t[2] = Q(Z((a) => l.onToggleClick(a), ["prevent"]), ["space"]))
|
|
353
|
+
]
|
|
354
|
+
}, [
|
|
355
|
+
h("span", He, _(l.selectedLabel || l.placeholder), 1),
|
|
356
|
+
me(l.$slots, "caret", {}, () => [
|
|
357
|
+
t[5] || (t[5] = h("span", { class: "hison-dropdown-caret" }, "▾", -1))
|
|
358
|
+
])
|
|
359
|
+
], 46, Re),
|
|
360
|
+
h("div", {
|
|
361
|
+
ref: "menuRef",
|
|
362
|
+
class: "hison-dropdown-menu",
|
|
363
|
+
style: L([l.textAlignStyle, l.props.menuStyle]),
|
|
364
|
+
role: "listbox",
|
|
365
|
+
"aria-activedescendant": l.activeDescId,
|
|
366
|
+
inert: !l.isOpen || void 0
|
|
367
|
+
}, [
|
|
368
|
+
h("div", Be, [
|
|
369
|
+
h("div", {
|
|
370
|
+
class: "hison-dropdown-panel-inner",
|
|
371
|
+
style: L(l.menuInlineStyle)
|
|
372
|
+
}, [
|
|
373
|
+
(B(!0), $(ye, null, be(l.options, (a, u) => (B(), $("div", {
|
|
374
|
+
key: `opt-${u}`,
|
|
375
|
+
class: U(["hison-dropdown-item", [
|
|
376
|
+
a.disabled ? "hison-disable" : "",
|
|
377
|
+
a.value === l.selectedValue ? "hison-selected" : ""
|
|
378
|
+
]]),
|
|
379
|
+
style: L(l.props.itemStyle),
|
|
380
|
+
role: "option",
|
|
381
|
+
"aria-selected": a.value === l.selectedValue ? "true" : "false",
|
|
382
|
+
onClick: (v) => l.onSelect(a, v)
|
|
383
|
+
}, _(a.label), 15, Fe))), 128)),
|
|
384
|
+
l.options.length === 0 ? (B(), $("div", je, "No options")) : fe("", !0)
|
|
385
|
+
], 4)
|
|
386
|
+
])
|
|
387
|
+
], 12, $e)
|
|
388
|
+
], 38);
|
|
389
|
+
}
|
|
390
|
+
const Ke = /* @__PURE__ */ Me(Le, [["render", qe]]);
|
|
391
|
+
export {
|
|
392
|
+
Ke as default
|
|
393
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),o=require("./index-BmKMHsSZ.js"),j=require("./setButtonCssEvent-B9WTs2X7.js"),Q=require("./_plugin-vue_export-helper-BHFhmbuH.js"),Z={id:{type:String,required:!1},class:{type:[String,Array,Object],required:!1},style:{type:[String,Object,Array],required:!1},toggleStyle:{type:[String,Object,Array],required:!1},menuStyle:{type:[String,Object,Array],required:!1},itemStyle:{type:[String,Object,Array],required:!1},visible:{type:Boolean,default:!0},editMode:{type:String,default:o.EditMode.editable,validator:t=>o.EDIT_MODE_VALUES.includes(t)},placeholder:{type:String,default:""},trigger:{type:String,default:o.DropdownTrigger.click,validator:t=>o.DROPDOWN_TRIGGER_VALUES.includes(t)},modelValue:{type:Object,required:!0},maxHeight:{type:Number,default:240,validator:t=>Number.isFinite(t)&&t>=0},closeOnSelect:{type:Boolean,default:!0},textAlign:{type:String,default:o.TextAlign.left,validator:t=>o.TEXT_ALIGN_VALUES.includes(t)},animate:{type:Boolean,default:!0},duration:{type:Number,default:500,validator:t=>Number.isFinite(t)&&t>=0},easing:{type:String,default:"ease"},tabIndex:{type:[Number,String],default:null,validator:t=>t===null||t===""||!isNaN(+t)&&isFinite(+t)}},_=l.defineComponent({name:"HDropdown",props:Z,inheritAttrs:!1,emits:["mounted","responsive-change","open","close","toggle-click","item-click","change","update:modelValue"],setup(t,{emit:a}){var $,z;const c=t.id||o.getUUID(),I=`hdropdown:${c}`,s=l.ref(null),p=l.ref(null),i=o.useDevice(),u=l.ref(!1),d=l.ref((($=t.modelValue)==null?void 0:$.options)??[]),r=l.ref(((z=t.modelValue)==null?void 0:z.value)??null),m=l.ref(!!t.visible),f=l.ref(t.editMode),b=l.computed(()=>f.value===o.EditMode.disable),h=l.computed(()=>f.value===o.EditMode.readonly),M=l.ref(t.placeholder||""),S=l.ref(t.trigger),w=l.ref(t.textAlign??o.TextAlign.left),F=l.computed(()=>({textAlign:w.value})),C=l.ref(t.animate??!0),A=l.ref(t.duration??500),E=l.ref(t.easing??"ease"),T=l.ref(t.tabIndex!==null&&t.tabIndex!==""?Number(t.tabIndex):null),U=l.computed(()=>({"--hdd-duration":`${A.value}ms`,"--hdd-easing":E.value})),G=l.computed(()=>m.value?"":"hison-display-none"),K=l.computed(()=>b.value?"hison-disable":""),P=l.computed(()=>h.value?"hison-readonly":""),O=l.ref([]),D=()=>{O.value=o.extractResponsiveClasses(o.toClassString(t.class)||"",i.value),o.addComponentNameToClass(O.value,"size",o.hisonCloser.componentStyle.size),o.addComponentNameToClass(O.value,"color","primary")},H=l.computed(()=>{const e=d.value.find(n=>n.value===r.value);return(e==null?void 0:e.label)??""}),N=l.ref(t.maxHeight??240),W=l.computed(()=>({maxHeight:`${N.value}px`,overflowY:"auto"})),k=l.ref(t.closeOnSelect??!0),X=l.computed(()=>{const e=d.value.findIndex(n=>n.value===r.value);return e>=0?`opt-${e}`:void 0}),R=e=>{if(!u.value)return;const n=e.target,g=!!s.value&&!!n&&s.value.contains(n),y=!!p.value&&!!n&&p.value.contains(n);!g&&!y&&V()},L=e=>{b.value||h.value||!m.value||u.value||(u.value=!0,a("open",e??null,v.value))},V=e=>{var y;if(!u.value)return;const n=document.activeElement,g=p.value;g&&n&&g.contains(n)&&((y=s.value)==null||y.focus()),u.value=!1,a("close",e??null,v.value)},B=e=>u.value?V(e):L(e),Y=e=>{S.value==="click"&&(b.value||h.value||(a("toggle-click",e,v.value),B(e)))},J=(e,n)=>{if(e.disabled||b.value||h.value)return;n&&a("item-click",n,v.value,e);const g=r.value;if(e.value!==g){r.value=e.value;const y={value:r.value,options:l.unref(d)};a("update:modelValue",y),a("change",g,r.value,v.value)}k.value&&V(n)},v=l.ref(null),x=()=>{o.hisonCloser.component.dropdownList[c]&&o.hisonCloser.component.dropdownList[c].isHisonvueComponent&&console.warn(`[Hisonvue] The dropdown ID is at risk of being duplicated. ${c}`),o.registerReloadable(I,()=>{q(),l.nextTick(x)}),s.value&&j.addButtonCssEvent(s.value),D(),v.value={isHisonvueComponent:!0,getId:()=>c,getType:()=>"dropdown",isVisible:()=>m.value,setVisible:e=>{m.value=e},getEditMode:()=>f.value,setEditMode:e=>{f.value=e},isOpen:()=>u.value,open:L,close:V,toggle:B,getValue:()=>r.value,setValue:e=>{r.value=e},getText:()=>H.value,getOptions:()=>l.unref(d),setOptions:e=>{d.value=Array.isArray(e)?e:[]},setTriggerType:e=>{S.value=e},getMaxHeight:()=>N.value,setMaxHeight:e=>{const n=Number(e);!Number.isFinite(n)||n<0||(N.value=n)},isCloseOnSelect:()=>k.value,setCloseOnSelect:e=>{k.value=!!e},getTextAlign:()=>w.value,setTextAlign:e=>{(e===o.TextAlign.left||e===o.TextAlign.center||e===o.TextAlign.right)&&(w.value=e)},getAnimate:()=>C.value,setAnimate:e=>{C.value=!!e},getDuration:()=>A.value,setDuration:e=>{const n=Number(e);Number.isFinite(n)&&n>=0&&(A.value=n)},getEasing:()=>E.value,setEasing:e=>{typeof e=="string"&&(E.value=e)},getTabIndex:()=>T.value,setTabIndex:e=>{T.value=e!=null?Number(e):null},focus:()=>{var e;(e=s.value)==null||e.focus()},reload:()=>o.reloadHisonComponent(I)},o.hisonCloser.component.dropdownList[c]=v.value,document.addEventListener("mousedown",R),a("mounted",v.value)},q=()=>{var e;o.unregisterReloadable(I);try{document.removeEventListener("mousedown",R)}catch{}s.value&&j.removeButtonCssEvent(s.value),(e=o.hisonCloser.component)!=null&&e.dropdownList&&delete o.hisonCloser.component.dropdownList[c]};return l.onMounted(x),l.onBeforeUnmount(q),l.watch(()=>t.modelValue,e=>{!e||typeof e!="object"||(Array.isArray(e.options)&&(d.value=e.options),r.value=e.value)},{deep:!0}),l.watch(i,e=>{D(),a("responsive-change",e)}),l.watch(()=>t.visible,e=>{!!e!==m.value&&(m.value=!!e)}),l.watch(()=>t.editMode,e=>{e&&e!==f.value&&(f.value=e)}),l.watch(()=>t.placeholder,e=>{const n=e??"";n!==M.value&&(M.value=n)}),l.watch(()=>t.trigger,e=>{e&&e!==S.value&&(S.value=e)}),l.watch(()=>t.textAlign,e=>{(e===o.TextAlign.left||e===o.TextAlign.center||e===o.TextAlign.right)&&e!==w.value&&(w.value=e)}),l.watch(()=>t.animate,e=>{const n=!!e;n!==C.value&&(C.value=n)}),l.watch(()=>t.duration,e=>{const n=Number(e);Number.isFinite(n)&&n>=0&&n!==A.value&&(A.value=n)}),l.watch(()=>t.easing,e=>{const n=typeof e=="string"?e:"ease";n!==E.value&&(E.value=n)}),l.watch(()=>t.tabIndex,e=>{const n=e===null||e===""?null:Number(e);n!==T.value&&(T.value=n)}),l.watch(()=>t.maxHeight,e=>{const n=Number(e);Number.isFinite(n)&&n>=0&&n!==N.value&&(N.value=n)}),l.watch(()=>t.closeOnSelect,e=>{const n=!!e;n!==k.value&&(k.value=n)}),l.watch(()=>t.class,()=>{D()}),{toggleRef:s,menuRef:p,props:t,isDisabled:b,isReadonly:h,visibleClass:G,disableClass:K,readonlyClass:P,responsiveClassList:O,isOpen:u,trigger:S,selectedValue:r,selectedLabel:H,placeholder:M,activeDescId:X,menuInlineStyle:W,options:d,animate:C,rootInlineStyle:U,tabIndex:T,onToggleClick:Y,onSelect:J,textAlignStyle:F,open:L,close:V,toggle:B}}}),ee=["aria-expanded","aria-disabled","tabindex"],te={class:"hison-dropdown-label"},le=["aria-activedescendant","inert"],ne={class:"hison-dropdown-panel"},oe=["aria-selected","onClick"],ae={key:0,class:"hison-dropdown-empty"};function ie(t,a,c,I,s,p){return l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["hison-dropdown",...t.responsiveClassList,t.visibleClass,t.disableClass,t.readonlyClass,t.isOpen?"hison-open":"",t.animate?"":"hison-no-anim"]),style:l.normalizeStyle([t.rootInlineStyle,t.props.style]),onMouseenter:a[3]||(a[3]=i=>t.trigger==="hover"?t.open(i):null),onMouseleave:a[4]||(a[4]=i=>t.trigger==="hover"?t.close(i):null)},[l.createElementVNode("div",{ref:"toggleRef",class:l.normalizeClass(["hison-dropdown-toggle",[t.isDisabled?"hison-disable":"",t.isReadonly?"hison-readonly":""]]),"aria-expanded":t.isOpen,role:"combobox","aria-disabled":t.isDisabled||t.isReadonly?"true":"false",tabindex:t.tabIndex??void 0,style:l.normalizeStyle([t.textAlignStyle,t.props.toggleStyle]),onClick:a[0]||(a[0]=i=>t.onToggleClick(i)),onKeydown:[a[1]||(a[1]=l.withKeys(l.withModifiers(i=>t.onToggleClick(i),["prevent"]),["enter"])),a[2]||(a[2]=l.withKeys(l.withModifiers(i=>t.onToggleClick(i),["prevent"]),["space"]))]},[l.createElementVNode("span",te,l.toDisplayString(t.selectedLabel||t.placeholder),1),l.renderSlot(t.$slots,"caret",{},()=>[a[5]||(a[5]=l.createElementVNode("span",{class:"hison-dropdown-caret"},"▾",-1))])],46,ee),l.createElementVNode("div",{ref:"menuRef",class:"hison-dropdown-menu",style:l.normalizeStyle([t.textAlignStyle,t.props.menuStyle]),role:"listbox","aria-activedescendant":t.activeDescId,inert:!t.isOpen||void 0},[l.createElementVNode("div",ne,[l.createElementVNode("div",{class:"hison-dropdown-panel-inner",style:l.normalizeStyle(t.menuInlineStyle)},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.options,(i,u)=>(l.openBlock(),l.createElementBlock("div",{key:`opt-${u}`,class:l.normalizeClass(["hison-dropdown-item",[i.disabled?"hison-disable":"",i.value===t.selectedValue?"hison-selected":""]]),style:l.normalizeStyle(t.props.itemStyle),role:"option","aria-selected":i.value===t.selectedValue?"true":"false",onClick:d=>t.onSelect(i,d)},l.toDisplayString(i.label),15,oe))),128)),t.options.length===0?(l.openBlock(),l.createElementBlock("div",ae,"No options")):l.createCommentVNode("",!0)],4)])],12,le)],38)}const se=Q._export_sfc(_,[["render",ie]]);exports.default=se;
|