vlite3 0.7.8 → 0.7.10
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/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/Dropdown/Dropdown.vue.js +131 -142
- package/components/Dropdown/composables/useDropdownHydration.d.ts +105 -0
- package/components/Dropdown/composables/useDropdownHydration.js +32 -0
- package/components/MultiSelect/MultiSelect.vue.js +90 -92
- package/components/MultiSelect/composables/useMultiSelectHydration.d.ts +97 -0
- package/components/MultiSelect/composables/useMultiSelectHydration.js +30 -0
- package/components/MultiSelect/index.d.ts +1 -0
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/components/Tooltip.vue.js +1 -1
- package/index.js +121 -119
- package/package.json +2 -2
- /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
|
@@ -5,8 +5,8 @@ import O from "../Input.vue.js";
|
|
|
5
5
|
/* empty css */
|
|
6
6
|
import "../../core/config.js";
|
|
7
7
|
import y from "../Button.vue.js";
|
|
8
|
-
import E from "./ColorIro.
|
|
9
|
-
/* empty css
|
|
8
|
+
import E from "./ColorIro.vue2.js";
|
|
9
|
+
/* empty css */
|
|
10
10
|
import { useEyeDropper as P } from "@vueuse/core";
|
|
11
11
|
const I = {
|
|
12
12
|
key: 0,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as K, ref as i, computed as m, watch as T, provide as Q, reactive as W, toRefs as X, openBlock as H, createElementBlock as Y, normalizeStyle as Z, createVNode as B, unref as v, withCtx as c, renderSlot as d, createBlock as _, normalizeClass as ee, createSlots as te, normalizeProps as M, guardReactiveProps as L, createCommentVNode as le } from "vue";
|
|
2
|
+
import oe from "v-tooltip-lite";
|
|
3
3
|
import "v-tooltip-lite/style.css";
|
|
4
4
|
import ne from "./DropdownMenu.vue.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { useDropdownIds as
|
|
8
|
-
import { useDropdownSelection as
|
|
9
|
-
|
|
5
|
+
import ae from "./DropdownTrigger.vue.js";
|
|
6
|
+
import ie from "../ConfirmationModal.vue.js";
|
|
7
|
+
import { useDropdownIds as se } from "./composables/useDropdownIds.js";
|
|
8
|
+
import { useDropdownSelection as re } from "./composables/useDropdownSelection.js";
|
|
9
|
+
import { useDropdownHydration as ue } from "./composables/useDropdownHydration.js";
|
|
10
|
+
const be = /* @__PURE__ */ K({
|
|
10
11
|
__name: "Dropdown",
|
|
11
12
|
props: {
|
|
12
13
|
selected: {},
|
|
@@ -45,228 +46,216 @@ const pe = /* @__PURE__ */ J({
|
|
|
45
46
|
isNested: { type: Boolean, default: !1 }
|
|
46
47
|
},
|
|
47
48
|
emits: ["onSelect", "update:modelValue", "onOpen", "onClose", "update:isOpen", "load-more", "search"],
|
|
48
|
-
setup(
|
|
49
|
-
const
|
|
49
|
+
setup(l, { emit: V }) {
|
|
50
|
+
const n = l, p = V, h = i(!1), f = i(null), s = i({
|
|
50
51
|
title: "Confirm Selection",
|
|
51
52
|
description: "Are you sure you want to select this option?",
|
|
52
53
|
confirmText: "Confirm",
|
|
53
54
|
cancelText: "Cancel",
|
|
54
55
|
variant: "primary"
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
() =>
|
|
56
|
+
}), R = m(() => n.position ? n.position : n.direction === "rtl" ? "bottom-end" : "bottom-start"), z = m(() => n.nestedPosition ? n.nestedPosition : n.direction === "rtl" ? "left-start" : "right-start"), O = i(n.isOpen || !1), y = i(0);
|
|
57
|
+
T(
|
|
58
|
+
() => n.isOpen,
|
|
58
59
|
(e) => {
|
|
59
|
-
e !== void 0 && (
|
|
60
|
+
e !== void 0 && (O.value = e);
|
|
60
61
|
}
|
|
61
62
|
);
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
|
|
63
|
+
const P = (e) => {
|
|
64
|
+
O.value = e, p("update:isOpen", e), p(e ? "onOpen" : "onClose");
|
|
65
|
+
}, g = () => {
|
|
66
|
+
P(!1);
|
|
66
67
|
};
|
|
67
|
-
|
|
68
|
-
close:
|
|
68
|
+
Q("dropdown-context", {
|
|
69
|
+
close: g,
|
|
69
70
|
onChildToggle: (e) => {
|
|
70
|
-
e ?
|
|
71
|
+
e ? y.value++ : y.value = Math.max(0, y.value - 1);
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
const b = m(() => n.options ? n.options.map((e) => typeof e == "string" || typeof e == "number" ? { label: String(e), value: String(e) } : e) : []), C = i([]), I = i(!1), S = i(!1);
|
|
75
|
+
T(
|
|
76
|
+
b,
|
|
76
77
|
(e) => {
|
|
77
|
-
if (e)
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
78
|
+
if (e) {
|
|
79
|
+
if (n.remote) {
|
|
80
|
+
const o = [...C.value];
|
|
80
81
|
e.forEach((t) => {
|
|
81
|
-
|
|
82
|
-
}),
|
|
82
|
+
o.some((a) => a.value !== void 0 && t.value !== void 0 ? typeof a.value == "object" && a.key && t.key ? a.key === t.key && a.value[a.key] === t.value[t.key] : a.value === t.value : a.label === t.label) || o.push(t);
|
|
83
|
+
}), C.value = o;
|
|
83
84
|
} else
|
|
84
|
-
|
|
85
|
+
C.value = e;
|
|
86
|
+
!I.value && e.length > 0 && (I.value = !0, setTimeout(() => {
|
|
87
|
+
S.value = !0, N($.value);
|
|
88
|
+
}, 10));
|
|
89
|
+
}
|
|
85
90
|
},
|
|
86
91
|
{ immediate: !0 }
|
|
87
92
|
// Performance fix: Removed deep: true to prevent heavy recursion mapping
|
|
88
93
|
);
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const t = l.filter((i) => {
|
|
94
|
-
const a = v.value.has(i), x = m.value.some((c) => (c.value ?? c.label) === i);
|
|
95
|
-
return !a && !x;
|
|
96
|
-
});
|
|
97
|
-
if (t.length) {
|
|
98
|
-
k.value = !0;
|
|
99
|
-
try {
|
|
100
|
-
(await o.fetchSelected(t)).forEach((a) => {
|
|
101
|
-
v.value.set(a.value ?? a.label, a);
|
|
102
|
-
});
|
|
103
|
-
} catch (i) {
|
|
104
|
-
console.error("[Dropdown] Hydration failed:", i);
|
|
105
|
-
} finally {
|
|
106
|
-
k.value = !1;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}, h = y(() => {
|
|
110
|
-
const e = [...m.value], l = new Set(e.map((t) => t.value ?? t.label));
|
|
111
|
-
return v.value.forEach((t, i) => {
|
|
112
|
-
l.has(i) || (e.unshift(t), l.add(i));
|
|
94
|
+
const u = m(() => {
|
|
95
|
+
const e = [...C.value], o = new Set(e.map((t) => t.value ?? t.label));
|
|
96
|
+
return k.value.forEach((t, r) => {
|
|
97
|
+
o.has(r) || (e.unshift(t), o.add(r));
|
|
113
98
|
}), e;
|
|
114
|
-
}), {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
99
|
+
}), { selectedBuffer: k, isHydrating: D, hydrateSelected: N } = ue({
|
|
100
|
+
fetchSelected: n.fetchSelected,
|
|
101
|
+
getAvailableOptions: () => u.value,
|
|
102
|
+
isReady: () => S.value
|
|
103
|
+
}), { getAllRecursiveIds: E } = se(), j = W({
|
|
104
|
+
...X(n),
|
|
105
|
+
options: u
|
|
106
|
+
}), { currentValue: $, selectedLabel: x, selectOption: U } = re(
|
|
107
|
+
j,
|
|
119
108
|
p
|
|
120
|
-
),
|
|
121
|
-
const e =
|
|
122
|
-
return [.../* @__PURE__ */ new Set([...e, ...
|
|
109
|
+
), q = m(() => {
|
|
110
|
+
const e = n.ignoreClickOutside || [], o = E(u.value);
|
|
111
|
+
return [.../* @__PURE__ */ new Set([...e, ...o, ".tooltip-container"])];
|
|
123
112
|
});
|
|
124
|
-
|
|
125
|
-
() =>
|
|
113
|
+
T(
|
|
114
|
+
() => $.value,
|
|
126
115
|
(e) => {
|
|
127
|
-
|
|
116
|
+
S.value && N(e);
|
|
128
117
|
},
|
|
129
|
-
{
|
|
118
|
+
{ deep: !0 }
|
|
130
119
|
);
|
|
131
|
-
const
|
|
132
|
-
|
|
120
|
+
const F = (e) => {
|
|
121
|
+
n.doubleConfirmation || !!e.confirmation ? (f.value = e, typeof e.confirmation == "object" ? s.value = {
|
|
133
122
|
title: e.confirmation.title || "Confirm Selection",
|
|
134
123
|
description: e.confirmation.description || "Are you sure you want to select this option?",
|
|
135
124
|
confirmText: e.confirmation.confirmText || "Confirm",
|
|
136
125
|
cancelText: e.confirmation.cancelText || "Cancel",
|
|
137
126
|
variant: e.confirmation.variant || "primary"
|
|
138
|
-
} :
|
|
127
|
+
} : s.value = {
|
|
139
128
|
title: "Confirm Selection",
|
|
140
129
|
description: `Are you sure you want to select "${e.label}"?`,
|
|
141
130
|
confirmText: "Confirm",
|
|
142
131
|
cancelText: "Cancel",
|
|
143
132
|
variant: "primary"
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
const t =
|
|
149
|
-
if (!
|
|
150
|
-
const
|
|
151
|
-
(e._path || [
|
|
152
|
-
typeof
|
|
133
|
+
}, h.value = !0, g()) : (A(e), n.closeOnSelect && g());
|
|
134
|
+
}, A = (e) => {
|
|
135
|
+
const o = e.value ?? e.label;
|
|
136
|
+
k.value.has(o) || k.value.set(o, e);
|
|
137
|
+
const t = U(e);
|
|
138
|
+
if (!n.isNested) {
|
|
139
|
+
const r = e._originalOption || e, a = r.value ?? r.label;
|
|
140
|
+
(e._path || [r]).forEach((w) => {
|
|
141
|
+
typeof w.onSelect == "function" && w.onSelect({
|
|
153
142
|
value: a,
|
|
154
|
-
option:
|
|
155
|
-
data:
|
|
143
|
+
option: w,
|
|
144
|
+
data: u.value || [],
|
|
156
145
|
values: t
|
|
157
146
|
});
|
|
158
147
|
});
|
|
159
148
|
}
|
|
160
|
-
}, q = () => {
|
|
161
|
-
f.value && (N(f.value), f.value = null, g.value = !1);
|
|
162
149
|
}, G = () => {
|
|
163
|
-
f.value = null,
|
|
150
|
+
f.value && (A(f.value), f.value = null, h.value = !1);
|
|
151
|
+
}, J = () => {
|
|
152
|
+
f.value = null, h.value = !1;
|
|
164
153
|
};
|
|
165
|
-
return (e,
|
|
154
|
+
return (e, o) => (H(), Y("div", {
|
|
166
155
|
class: "relative inline-block text-left",
|
|
167
|
-
style:
|
|
156
|
+
style: Z({ direction: l.direction })
|
|
168
157
|
}, [
|
|
169
|
-
|
|
158
|
+
B(v(oe), {
|
|
170
159
|
content: "",
|
|
171
160
|
trigger: "click",
|
|
172
161
|
arrow: !1,
|
|
173
|
-
teleport:
|
|
174
|
-
offset:
|
|
175
|
-
placement:
|
|
176
|
-
isOpen:
|
|
177
|
-
keepAlive:
|
|
178
|
-
menuId:
|
|
179
|
-
ignoreClickOutside:
|
|
162
|
+
teleport: l.teleport,
|
|
163
|
+
offset: l.offset,
|
|
164
|
+
placement: R.value,
|
|
165
|
+
isOpen: O.value,
|
|
166
|
+
keepAlive: y.value > 0,
|
|
167
|
+
menuId: l.menuId,
|
|
168
|
+
ignoreClickOutside: q.value,
|
|
180
169
|
class: "w-full",
|
|
181
|
-
className: "dropdown " + (
|
|
182
|
-
onOnShow:
|
|
183
|
-
onOnHide:
|
|
184
|
-
"onUpdate:isOpen":
|
|
170
|
+
className: "dropdown " + (l.className || ""),
|
|
171
|
+
onOnShow: o[2] || (o[2] = (t) => e.$emit("onOpen")),
|
|
172
|
+
onOnHide: o[3] || (o[3] = (t) => e.$emit("onClose")),
|
|
173
|
+
"onUpdate:isOpen": P,
|
|
185
174
|
triggerClass: "w-full",
|
|
186
175
|
styles: { padding: "0" }
|
|
187
176
|
}, {
|
|
188
|
-
trigger:
|
|
189
|
-
d(e.$slots, "trigger", M(
|
|
190
|
-
|
|
191
|
-
"selected-label":
|
|
177
|
+
trigger: c(({ isOpen: t }) => [
|
|
178
|
+
d(e.$slots, "trigger", M(L({ selectedLabel: v(x), isOpen: t })), () => [
|
|
179
|
+
B(ae, {
|
|
180
|
+
"selected-label": v(x),
|
|
192
181
|
"is-open": t,
|
|
193
|
-
direction:
|
|
194
|
-
triggerProps:
|
|
182
|
+
direction: l.direction,
|
|
183
|
+
triggerProps: l.triggerProps,
|
|
195
184
|
class: "w-full"
|
|
196
185
|
}, null, 8, ["selected-label", "is-open", "direction", "triggerProps"])
|
|
197
186
|
])
|
|
198
187
|
]),
|
|
199
|
-
default:
|
|
188
|
+
default: c(() => [
|
|
200
189
|
d(e.$slots, "default"),
|
|
201
|
-
|
|
190
|
+
b.value.length || u.value.length || e.$slots.menu || e.$slots.item || l.remote || l.searchable ? (H(), _(ne, {
|
|
202
191
|
key: 0,
|
|
203
|
-
options:
|
|
204
|
-
cachedOptions:
|
|
205
|
-
class:
|
|
206
|
-
selected:
|
|
207
|
-
selectedIndex:
|
|
208
|
-
maxHeight:
|
|
209
|
-
nestedPosition:
|
|
210
|
-
nestedOffset:
|
|
211
|
-
selectable:
|
|
212
|
-
direction:
|
|
213
|
-
layout:
|
|
214
|
-
columns:
|
|
215
|
-
loading:
|
|
216
|
-
hasMore:
|
|
217
|
-
searchable:
|
|
218
|
-
remote:
|
|
219
|
-
debounceTime:
|
|
220
|
-
onSelect:
|
|
221
|
-
onClose:
|
|
222
|
-
onLoadMore:
|
|
223
|
-
onSearch:
|
|
224
|
-
},
|
|
192
|
+
options: b.value,
|
|
193
|
+
cachedOptions: u.value,
|
|
194
|
+
class: ee(l.className),
|
|
195
|
+
selected: v($),
|
|
196
|
+
selectedIndex: l.selectedIndex,
|
|
197
|
+
maxHeight: l.maxHeight,
|
|
198
|
+
nestedPosition: z.value,
|
|
199
|
+
nestedOffset: l.nestedOffset,
|
|
200
|
+
selectable: l.selectable,
|
|
201
|
+
direction: l.direction,
|
|
202
|
+
layout: l.layout,
|
|
203
|
+
columns: l.columns,
|
|
204
|
+
loading: l.loading || v(D),
|
|
205
|
+
hasMore: l.hasMore,
|
|
206
|
+
searchable: l.searchable,
|
|
207
|
+
remote: l.remote,
|
|
208
|
+
debounceTime: l.debounceTime,
|
|
209
|
+
onSelect: F,
|
|
210
|
+
onClose: g,
|
|
211
|
+
onLoadMore: o[0] || (o[0] = (t) => e.$emit("load-more")),
|
|
212
|
+
onSearch: o[1] || (o[1] = (t) => e.$emit("search", t))
|
|
213
|
+
}, te({ _: 2 }, [
|
|
225
214
|
e.$slots.menu ? {
|
|
226
215
|
name: "menu",
|
|
227
|
-
fn:
|
|
216
|
+
fn: c(() => [
|
|
228
217
|
d(e.$slots, "menu")
|
|
229
218
|
]),
|
|
230
219
|
key: "0"
|
|
231
220
|
} : void 0,
|
|
232
221
|
e.$slots.item ? {
|
|
233
222
|
name: "item",
|
|
234
|
-
fn:
|
|
235
|
-
d(e.$slots, "item", M(
|
|
223
|
+
fn: c((t) => [
|
|
224
|
+
d(e.$slots, "item", M(L(t)))
|
|
236
225
|
]),
|
|
237
226
|
key: "1"
|
|
238
227
|
} : void 0,
|
|
239
228
|
e.$slots.header ? {
|
|
240
229
|
name: "header",
|
|
241
|
-
fn:
|
|
230
|
+
fn: c(() => [
|
|
242
231
|
d(e.$slots, "header")
|
|
243
232
|
]),
|
|
244
233
|
key: "2"
|
|
245
234
|
} : void 0,
|
|
246
235
|
e.$slots.footer ? {
|
|
247
236
|
name: "footer",
|
|
248
|
-
fn:
|
|
237
|
+
fn: c(() => [
|
|
249
238
|
d(e.$slots, "footer")
|
|
250
239
|
]),
|
|
251
240
|
key: "3"
|
|
252
241
|
} : void 0
|
|
253
|
-
]), 1032, ["options", "cachedOptions", "class", "selected", "selectedIndex", "maxHeight", "nestedPosition", "nestedOffset", "selectable", "direction", "layout", "columns", "loading", "hasMore", "searchable", "remote", "debounceTime"])) :
|
|
242
|
+
]), 1032, ["options", "cachedOptions", "class", "selected", "selectedIndex", "maxHeight", "nestedPosition", "nestedOffset", "selectable", "direction", "layout", "columns", "loading", "hasMore", "searchable", "remote", "debounceTime"])) : le("", !0)
|
|
254
243
|
]),
|
|
255
244
|
_: 3
|
|
256
245
|
}, 8, ["teleport", "offset", "placement", "isOpen", "keepAlive", "menuId", "ignoreClickOutside", "className"]),
|
|
257
|
-
|
|
258
|
-
show:
|
|
259
|
-
title:
|
|
260
|
-
description:
|
|
261
|
-
"confirm-text":
|
|
262
|
-
"cancel-text":
|
|
263
|
-
variant:
|
|
264
|
-
onConfirm:
|
|
265
|
-
onCancel:
|
|
246
|
+
B(ie, {
|
|
247
|
+
show: h.value,
|
|
248
|
+
title: s.value.title,
|
|
249
|
+
description: s.value.description,
|
|
250
|
+
"confirm-text": s.value.confirmText,
|
|
251
|
+
"cancel-text": s.value.cancelText,
|
|
252
|
+
variant: s.value.variant,
|
|
253
|
+
onConfirm: G,
|
|
254
|
+
onCancel: J
|
|
266
255
|
}, null, 8, ["show", "title", "description", "confirm-text", "cancel-text", "variant"])
|
|
267
256
|
], 4));
|
|
268
257
|
}
|
|
269
258
|
});
|
|
270
259
|
export {
|
|
271
|
-
|
|
260
|
+
be as default
|
|
272
261
|
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { IDropdownOption } from '../../../types';
|
|
2
|
+
interface UseDropdownHydrationOptions {
|
|
3
|
+
fetchSelected?: (ids: any[]) => Promise<IDropdownOption[]>;
|
|
4
|
+
/**
|
|
5
|
+
* Returns the current set of options that are already available.
|
|
6
|
+
* Hydration will skip IDs found here.
|
|
7
|
+
*/
|
|
8
|
+
getAvailableOptions: () => IDropdownOption[];
|
|
9
|
+
/**
|
|
10
|
+
* Must return true before hydration is allowed to run.
|
|
11
|
+
* Use this to gate hydration until the initial options fetch + delay is done.
|
|
12
|
+
*/
|
|
13
|
+
isReady: () => boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Manages hydration of selected values whose labels are not yet in the option list.
|
|
17
|
+
* Defers fetching until isReady() returns true, so it never fires for IDs already
|
|
18
|
+
* present in the initial options batch.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useDropdownHydration(opts: UseDropdownHydrationOptions): {
|
|
21
|
+
selectedBuffer: import('vue').Ref<Map<any, {
|
|
22
|
+
label: string;
|
|
23
|
+
labelI18n?: string;
|
|
24
|
+
value?: any;
|
|
25
|
+
subtitle?: string;
|
|
26
|
+
subtitleI18n?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
descriptionI18n?: string;
|
|
29
|
+
icon?: string;
|
|
30
|
+
emoji?: string;
|
|
31
|
+
disabled?: {
|
|
32
|
+
valueOf: () => boolean;
|
|
33
|
+
};
|
|
34
|
+
iconClass?: string;
|
|
35
|
+
iconStyle?: any;
|
|
36
|
+
length?: number;
|
|
37
|
+
values?: any;
|
|
38
|
+
data?: any;
|
|
39
|
+
class?: string;
|
|
40
|
+
triggerClass?: string;
|
|
41
|
+
children?: /*elided*/ any[];
|
|
42
|
+
key?: string;
|
|
43
|
+
position?: any;
|
|
44
|
+
offset?: [number, number];
|
|
45
|
+
showChevron?: boolean;
|
|
46
|
+
confirmation?: boolean | {
|
|
47
|
+
title?: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
confirmText?: string;
|
|
50
|
+
cancelText?: string;
|
|
51
|
+
variant?: "danger" | "primary" | "warning" | "success" | "info";
|
|
52
|
+
};
|
|
53
|
+
onSelect?: (payload: {
|
|
54
|
+
value: any;
|
|
55
|
+
option: IDropdownOption;
|
|
56
|
+
data: IDropdownOption[];
|
|
57
|
+
values?: any;
|
|
58
|
+
}) => void;
|
|
59
|
+
_originalOption?: /*elided*/ any;
|
|
60
|
+
_path?: /*elided*/ any[];
|
|
61
|
+
}> & Omit<Map<any, IDropdownOption>, keyof Map<any, any>>, Map<any, IDropdownOption> | (Map<any, {
|
|
62
|
+
label: string;
|
|
63
|
+
labelI18n?: string;
|
|
64
|
+
value?: any;
|
|
65
|
+
subtitle?: string;
|
|
66
|
+
subtitleI18n?: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
descriptionI18n?: string;
|
|
69
|
+
icon?: string;
|
|
70
|
+
emoji?: string;
|
|
71
|
+
disabled?: {
|
|
72
|
+
valueOf: () => boolean;
|
|
73
|
+
};
|
|
74
|
+
iconClass?: string;
|
|
75
|
+
iconStyle?: any;
|
|
76
|
+
length?: number;
|
|
77
|
+
values?: any;
|
|
78
|
+
data?: any;
|
|
79
|
+
class?: string;
|
|
80
|
+
triggerClass?: string;
|
|
81
|
+
children?: /*elided*/ any[];
|
|
82
|
+
key?: string;
|
|
83
|
+
position?: any;
|
|
84
|
+
offset?: [number, number];
|
|
85
|
+
showChevron?: boolean;
|
|
86
|
+
confirmation?: boolean | {
|
|
87
|
+
title?: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
confirmText?: string;
|
|
90
|
+
cancelText?: string;
|
|
91
|
+
variant?: "danger" | "primary" | "warning" | "success" | "info";
|
|
92
|
+
};
|
|
93
|
+
onSelect?: (payload: {
|
|
94
|
+
value: any;
|
|
95
|
+
option: IDropdownOption;
|
|
96
|
+
data: IDropdownOption[];
|
|
97
|
+
values?: any;
|
|
98
|
+
}) => void;
|
|
99
|
+
_originalOption?: /*elided*/ any;
|
|
100
|
+
_path?: /*elided*/ any[];
|
|
101
|
+
}> & Omit<Map<any, IDropdownOption>, keyof Map<any, any>>)>;
|
|
102
|
+
isHydrating: import('vue').Ref<boolean, boolean>;
|
|
103
|
+
hydrateSelected: (val: any) => Promise<void>;
|
|
104
|
+
};
|
|
105
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ref as f } from "vue";
|
|
2
|
+
function h(n) {
|
|
3
|
+
const l = f(/* @__PURE__ */ new Map()), c = f(!1);
|
|
4
|
+
return {
|
|
5
|
+
selectedBuffer: l,
|
|
6
|
+
isHydrating: c,
|
|
7
|
+
hydrateSelected: async (e) => {
|
|
8
|
+
if (!n.fetchSelected || e === void 0 || e === null || !n.isReady()) return;
|
|
9
|
+
let a = [];
|
|
10
|
+
Array.isArray(e) ? a = e : typeof e == "object" ? a = Object.values(e) : a = [e];
|
|
11
|
+
const o = n.getAvailableOptions(), i = a.filter((t) => {
|
|
12
|
+
const r = l.value.has(t), d = o.some((s) => (s.value ?? s.label) === t);
|
|
13
|
+
return !r && !d;
|
|
14
|
+
});
|
|
15
|
+
if (i.length) {
|
|
16
|
+
c.value = !0;
|
|
17
|
+
try {
|
|
18
|
+
(await n.fetchSelected(i)).forEach((r) => {
|
|
19
|
+
l.value.set(r.value ?? r.label, r);
|
|
20
|
+
});
|
|
21
|
+
} catch (t) {
|
|
22
|
+
console.error("[Dropdown] Hydration failed:", t);
|
|
23
|
+
} finally {
|
|
24
|
+
c.value = !1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
h as useDropdownHydration
|
|
32
|
+
};
|