@pantograph/vue 0.28.7 → 0.29.1
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/dist/Card/Card.d.ts +46 -0
- package/dist/Card/Card.model.d.ts +2 -0
- package/dist/Card/index.d.ts +2 -0
- package/dist/Card/index.js +6 -0
- package/dist/Card/index.umd.cjs +1 -0
- package/dist/Card.vue_vue_type_style_index_0_lang-Cq4rXSmn.js +109 -0
- package/dist/Card.vue_vue_type_style_index_0_lang-Iyaj4565.js +1 -0
- package/dist/Chip/Chip.d.ts +1 -1
- package/dist/Combobox/index.js +1 -1
- package/dist/Combobox/index.umd.cjs +1 -1
- package/dist/{Combobox.vue_vue_type_style_index_0_lang-DpG8BdPi.js → Combobox.vue_vue_type_style_index_0_lang-a7qKkBIb.js} +1 -1
- package/dist/{Combobox.vue_vue_type_style_index_0_lang-Dbpez_Ag.js → Combobox.vue_vue_type_style_index_0_lang-cmleh5Z8.js} +1 -1
- package/dist/Comment/index.js +2 -2
- package/dist/Comment/index.umd.cjs +1 -1
- package/dist/DataTable/index.js +1 -1
- package/dist/DataTable/index.umd.cjs +1 -1
- package/dist/{DataTable.vue_vue_type_style_index_0_lang-D1Lfs62n.js → DataTable.vue_vue_type_style_index_0_lang-DcYyvhP1.js} +1 -1
- package/dist/{DataTable.vue_vue_type_style_index_0_lang-CnbFI80m.js → DataTable.vue_vue_type_style_index_0_lang-ZuEJ496q.js} +1 -1
- package/dist/Menu/MenuItemWrapper.d.ts +4 -1
- package/dist/Menu/index.js +1 -1
- package/dist/Menu/index.umd.cjs +1 -1
- package/dist/MenuItem/index.js +1 -1
- package/dist/MenuItem/index.umd.cjs +1 -1
- package/dist/MenuItem.vue_vue_type_style_index_0_lang-CpFi8orx.js +1 -0
- package/dist/MenuItem.vue_vue_type_style_index_0_lang-pKKwSjqz.js +588 -0
- package/dist/SubMenu/index.js +1 -1
- package/dist/SubMenu/index.umd.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +232 -229
- package/dist/index.umd.cjs +1 -1
- package/dist/style/index.css +1 -1
- package/package.json +11 -6
- package/dist/MenuItem.vue_vue_type_style_index_0_lang-CnfTPScR.js +0 -1
- package/dist/MenuItem.vue_vue_type_style_index_0_lang-CyyVI54S.js +0 -610
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
import { defineComponent as U, useSlots as Q, computed as C, useAttrs as ee, createBlock as E, openBlock as B, h as P, ref as J, getCurrentInstance as ae, unref as c, resolveDynamicComponent as ye, mergeProps as A, withCtx as $, createElementVNode as Ce, createVNode as fe, createSlots as N, renderList as F, renderSlot as D, normalizeProps as T, guardReactiveProps as V, createElementBlock as w, Fragment as oe, watch as ne, withModifiers as he, normalizeClass as H, createCommentVNode as Y, createTextVNode as be, toDisplayString as ke } from "vue";
|
|
2
|
+
import { getBemBlock as se, getComponentOptions as X, generateVariantClassList as I, normCls as S, getBemElement as z, usePCId as ie, isEmptyLikeLodash as Se } from "@pantograph/utils";
|
|
3
|
+
import { isEmptyElement as L, useInputDataStates as re, useFormInput as Be } from "@pantograph/utils-vue";
|
|
4
|
+
import { cva as ue } from "class-variance-authority";
|
|
5
|
+
import { omit as Me, cloneDeep as Z, isString as ze } from "es-toolkit";
|
|
6
|
+
import { _ as Ke } from "./Icon.vue_vue_type_style_index_0_lang-BUxhmWxU.js";
|
|
7
|
+
import { _ as _e } from "./Popover.vue_vue_type_style_index_0_lang-CWM6Krh-.js";
|
|
8
|
+
import { _ as Ie } from "./HoverCard.vue_vue_type_style_index_0_lang-DOwcNfdp.js";
|
|
9
|
+
import { createContext as de } from "reka-ui";
|
|
10
|
+
import { i as De } from "./isNumber-BduWbB-B.js";
|
|
11
|
+
const ce = ["sm", "md", "lg"], v = se("menu_item"), te = (o) => {
|
|
12
|
+
switch (o) {
|
|
13
|
+
case "sm":
|
|
14
|
+
return "2xsm";
|
|
15
|
+
default:
|
|
16
|
+
return "xsm";
|
|
17
|
+
}
|
|
18
|
+
}, Oe = (o) => {
|
|
19
|
+
switch (o) {
|
|
20
|
+
case "lg":
|
|
21
|
+
return "md";
|
|
22
|
+
default:
|
|
23
|
+
return "sm";
|
|
24
|
+
}
|
|
25
|
+
}, le = (o) => {
|
|
26
|
+
switch (o) {
|
|
27
|
+
case "sm":
|
|
28
|
+
return "2xsm";
|
|
29
|
+
case "md":
|
|
30
|
+
return "xsm";
|
|
31
|
+
default:
|
|
32
|
+
return "sm";
|
|
33
|
+
}
|
|
34
|
+
}, x = (o) => {
|
|
35
|
+
switch (o) {
|
|
36
|
+
case "lg":
|
|
37
|
+
return "md";
|
|
38
|
+
case "md":
|
|
39
|
+
return "xsm";
|
|
40
|
+
default:
|
|
41
|
+
return "2xsm";
|
|
42
|
+
}
|
|
43
|
+
}, Pe = (o, s) => ({
|
|
44
|
+
iconSize: te(o),
|
|
45
|
+
buttonSize: Oe(o),
|
|
46
|
+
checkIconSize: le(o),
|
|
47
|
+
switchSize: le(o),
|
|
48
|
+
checkboxSize: te(o),
|
|
49
|
+
avatarSize: x(o),
|
|
50
|
+
graphicalObjectSize: x(o),
|
|
51
|
+
badgeSize: x(o),
|
|
52
|
+
...s ?? {}
|
|
53
|
+
}), pe = /* @__PURE__ */ U({
|
|
54
|
+
...X("MenuItemContent"),
|
|
55
|
+
__name: "MenuItemContent",
|
|
56
|
+
props: {
|
|
57
|
+
size: {},
|
|
58
|
+
title: {},
|
|
59
|
+
leading: {},
|
|
60
|
+
trailing: {},
|
|
61
|
+
hoverTrailing: { type: Boolean },
|
|
62
|
+
description: {},
|
|
63
|
+
selected: { type: Boolean },
|
|
64
|
+
unFocusable: { type: Boolean },
|
|
65
|
+
danger: { type: Boolean },
|
|
66
|
+
disabled: { type: Boolean, default: void 0 },
|
|
67
|
+
class: {},
|
|
68
|
+
leadingCls: {},
|
|
69
|
+
leadingContentCls: {},
|
|
70
|
+
contentCls: {},
|
|
71
|
+
titleCls: {},
|
|
72
|
+
descriptionCls: {},
|
|
73
|
+
leadingCenter: { type: Boolean },
|
|
74
|
+
trailingCls: {},
|
|
75
|
+
branchCls: {},
|
|
76
|
+
branchIcon: {},
|
|
77
|
+
hover: { type: Boolean },
|
|
78
|
+
hasChildren: { type: Boolean },
|
|
79
|
+
staticStyle: { type: Boolean },
|
|
80
|
+
slotProps: {}
|
|
81
|
+
},
|
|
82
|
+
setup(o) {
|
|
83
|
+
const s = o, l = Q(), t = ue(v, {
|
|
84
|
+
variants: {
|
|
85
|
+
size: I(ce, v),
|
|
86
|
+
selected: I("selected", v),
|
|
87
|
+
unFocusable: I("un-focusable", v),
|
|
88
|
+
danger: I("danger", v),
|
|
89
|
+
disabled: I("disabled", v),
|
|
90
|
+
hoverTrailing: I("hover-trailing", v),
|
|
91
|
+
description: I("description", v),
|
|
92
|
+
leadingCenter: I("leading-center", v),
|
|
93
|
+
staticStyle: I("static-style", v)
|
|
94
|
+
}
|
|
95
|
+
}), r = C(() => Pe(s.size, s.slotProps)), e = ee(), m = () => {
|
|
96
|
+
var p;
|
|
97
|
+
const g = (p = l.description) == null ? void 0 : p.call(l, s.slotProps ?? {}), b = !L(g), K = () => {
|
|
98
|
+
var j, G, R, W;
|
|
99
|
+
const f = [], u = (j = l.leading) == null ? void 0 : j.call(l, r.value), n = !L(u);
|
|
100
|
+
(n || s.leading) && f.push(
|
|
101
|
+
P(
|
|
102
|
+
"div",
|
|
103
|
+
{ class: S(z(v, "leading"), s.leadingCls) },
|
|
104
|
+
P(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
class: S(
|
|
108
|
+
z(v, "leading_content"),
|
|
109
|
+
s.leadingContentCls
|
|
110
|
+
)
|
|
111
|
+
},
|
|
112
|
+
n ? u : s.leading
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
const d = (G = l.title) == null ? void 0 : G.call(l, s.slotProps ?? {}), i = !L(d);
|
|
117
|
+
if (i || s.title || b || s.description) {
|
|
118
|
+
const O = [];
|
|
119
|
+
(i || s.title) && O.push(
|
|
120
|
+
P(
|
|
121
|
+
"div",
|
|
122
|
+
{ class: S(z(v, "title"), s.titleCls) },
|
|
123
|
+
i ? d : s.title
|
|
124
|
+
)
|
|
125
|
+
), (b || s.description) && O.push(
|
|
126
|
+
P(
|
|
127
|
+
"div",
|
|
128
|
+
{
|
|
129
|
+
class: S(z(v, "description"), s.descriptionCls)
|
|
130
|
+
},
|
|
131
|
+
b ? g : s.description
|
|
132
|
+
)
|
|
133
|
+
), f.push(
|
|
134
|
+
P(
|
|
135
|
+
"div",
|
|
136
|
+
{ class: S(z(v, "content"), s.contentCls) },
|
|
137
|
+
O
|
|
138
|
+
)
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
const y = (R = l.trailing) == null ? void 0 : R.call(l, r.value), h = !L(y);
|
|
142
|
+
if (s.hasChildren) {
|
|
143
|
+
const O = (W = l.branchIcon) == null ? void 0 : W.call(l, r.value);
|
|
144
|
+
f.push(
|
|
145
|
+
P(
|
|
146
|
+
Ke,
|
|
147
|
+
{
|
|
148
|
+
class: S(z(v, "branch"), s.branchCls ?? ""),
|
|
149
|
+
flipOnDir: "rtl",
|
|
150
|
+
size: r.value.checkIconSize,
|
|
151
|
+
icon: s.branchIcon
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
default: L(O) ? null : O
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
} else (h || s.trailing) && f.push(
|
|
159
|
+
P(
|
|
160
|
+
"div",
|
|
161
|
+
{ class: S(z(v, "trailing"), s.trailingCls) },
|
|
162
|
+
h ? y : s.trailing
|
|
163
|
+
)
|
|
164
|
+
);
|
|
165
|
+
return f;
|
|
166
|
+
};
|
|
167
|
+
return P(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
...e,
|
|
171
|
+
role: "menuitem",
|
|
172
|
+
tabindex: s.unFocusable ? void 0 : e.tabindex ?? 0,
|
|
173
|
+
"data-hover": s.hover ? "" : void 0,
|
|
174
|
+
class: S(
|
|
175
|
+
t({
|
|
176
|
+
size: s.size,
|
|
177
|
+
selected: s.selected,
|
|
178
|
+
unFocusable: s.unFocusable,
|
|
179
|
+
staticStyle: s.staticStyle,
|
|
180
|
+
danger: s.danger,
|
|
181
|
+
disabled: s.disabled,
|
|
182
|
+
hoverTrailing: s.hoverTrailing,
|
|
183
|
+
leadingCenter: s.leadingCenter,
|
|
184
|
+
description: !!(b || s.description)
|
|
185
|
+
}),
|
|
186
|
+
s.class
|
|
187
|
+
)
|
|
188
|
+
},
|
|
189
|
+
K()
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
return (g, b) => (B(), E(m));
|
|
193
|
+
}
|
|
194
|
+
}), $e = [...ce, "none"], [Te, Fe] = de("SubMenu"), je = /* @__PURE__ */ U({
|
|
195
|
+
...X("SubMenu"),
|
|
196
|
+
__name: "SubMenu",
|
|
197
|
+
props: {
|
|
198
|
+
subMenuCloseDelay: { default: 300 },
|
|
199
|
+
subMenuOpenDelay: { default: 700 },
|
|
200
|
+
triggerSubMenuAction: {},
|
|
201
|
+
submenuTriggerCls: {},
|
|
202
|
+
submenuCls: {},
|
|
203
|
+
forceMountSubmenu: { type: Boolean, default: void 0 },
|
|
204
|
+
items: {},
|
|
205
|
+
unExtendParent: { type: Boolean, default: !1 },
|
|
206
|
+
size: { default: "md" },
|
|
207
|
+
title: {},
|
|
208
|
+
leading: {},
|
|
209
|
+
trailing: {},
|
|
210
|
+
hoverTrailing: { type: Boolean, default: void 0 },
|
|
211
|
+
description: {},
|
|
212
|
+
selected: { type: Boolean, default: void 0 },
|
|
213
|
+
unFocusable: { type: Boolean, default: void 0 },
|
|
214
|
+
danger: { type: Boolean, default: void 0 },
|
|
215
|
+
disabled: { type: Boolean, default: void 0 },
|
|
216
|
+
class: {},
|
|
217
|
+
leadingCls: {},
|
|
218
|
+
leadingContentCls: {},
|
|
219
|
+
contentCls: {},
|
|
220
|
+
titleCls: {},
|
|
221
|
+
descriptionCls: {},
|
|
222
|
+
leadingCenter: { type: Boolean, default: void 0 },
|
|
223
|
+
trailingCls: {},
|
|
224
|
+
branchCls: {},
|
|
225
|
+
branchIcon: { default: "tabler:chevron-right" },
|
|
226
|
+
hover: { type: Boolean },
|
|
227
|
+
staticStyle: { type: Boolean },
|
|
228
|
+
slotProps: {}
|
|
229
|
+
},
|
|
230
|
+
setup(o) {
|
|
231
|
+
const s = o, l = Q(), t = C(() => {
|
|
232
|
+
switch (s.size) {
|
|
233
|
+
case "lg":
|
|
234
|
+
return 10;
|
|
235
|
+
case "md":
|
|
236
|
+
return 8;
|
|
237
|
+
default:
|
|
238
|
+
return 6;
|
|
239
|
+
}
|
|
240
|
+
}), r = J(), e = s.unExtendParent ? void 0 : ve(), m = C(() => {
|
|
241
|
+
var a;
|
|
242
|
+
return s.triggerSubMenuAction ?? ((a = e == null ? void 0 : e.props) == null ? void 0 : a.triggerSubMenuAction);
|
|
243
|
+
}), g = Te({
|
|
244
|
+
parentKeys: []
|
|
245
|
+
}), b = (a) => {
|
|
246
|
+
var _;
|
|
247
|
+
(m.value === "click" || (_ = c(g.parentKeys)) != null && _.length) && (a.stopPropagation(), a.preventDefault());
|
|
248
|
+
}, K = se("sub_menu"), p = ie(K), f = C(() => {
|
|
249
|
+
var a;
|
|
250
|
+
return ((a = ae()) == null ? void 0 : a.vnode.key) ?? p;
|
|
251
|
+
});
|
|
252
|
+
Fe({
|
|
253
|
+
parentKeys: C(() => [...c(g.parentKeys), f.value])
|
|
254
|
+
});
|
|
255
|
+
const u = C(() => ({
|
|
256
|
+
...s,
|
|
257
|
+
key: f.value,
|
|
258
|
+
hasChildren: !0,
|
|
259
|
+
parentKeys: c(g.parentKeys)
|
|
260
|
+
})), n = C(() => {
|
|
261
|
+
var a;
|
|
262
|
+
return ((a = e == null ? void 0 : e.props) == null ? void 0 : a.size) ?? s.size;
|
|
263
|
+
}), d = () => {
|
|
264
|
+
var a;
|
|
265
|
+
return !!((a = e == null ? void 0 : e.getDisabled) != null && a.value || s.disabled);
|
|
266
|
+
}, { rootBindings: i, inputBindings: y } = re({
|
|
267
|
+
getDisabled: d
|
|
268
|
+
}), h = J(!1), j = C(() => {
|
|
269
|
+
var a;
|
|
270
|
+
return ((a = e == null ? void 0 : e.isOpen) == null ? void 0 : a.call(e, f.value)) ?? h.value;
|
|
271
|
+
}), G = C(() => {
|
|
272
|
+
var a, _, k;
|
|
273
|
+
return {
|
|
274
|
+
...Me(s, [
|
|
275
|
+
"subMenuOpenDelay",
|
|
276
|
+
"triggerSubMenuAction",
|
|
277
|
+
"submenuTriggerCls",
|
|
278
|
+
"submenuCls",
|
|
279
|
+
"forceMountSubmenu",
|
|
280
|
+
"items"
|
|
281
|
+
]),
|
|
282
|
+
size: n.value,
|
|
283
|
+
selected: ((a = e == null ? void 0 : e.isItemSelected) == null ? void 0 : a.call(e, u.value)) ?? s.selected,
|
|
284
|
+
hoverTrailing: s.hoverTrailing ?? ((_ = e == null ? void 0 : e.props) == null ? void 0 : _.hoverTrailing),
|
|
285
|
+
leadingCenter: s.leadingCenter ?? ((k = e == null ? void 0 : e.props) == null ? void 0 : k.leadingCenter),
|
|
286
|
+
hasChildren: !0,
|
|
287
|
+
unFocusable: d(),
|
|
288
|
+
disabled: d(),
|
|
289
|
+
onClick: (M) => {
|
|
290
|
+
var q;
|
|
291
|
+
return (q = e == null ? void 0 : e.onClick) == null ? void 0 : q.call(e, u.value, M);
|
|
292
|
+
},
|
|
293
|
+
hover: j.value,
|
|
294
|
+
...y.value
|
|
295
|
+
};
|
|
296
|
+
}), R = (a) => {
|
|
297
|
+
var k, M;
|
|
298
|
+
(((k = e == null ? void 0 : e.isOpen) == null ? void 0 : k.call(e, f.value)) ?? h.value) !== a && (e != null && e.onChildrenOpenChange ? (M = e == null ? void 0 : e.onChildrenOpenChange) == null || M.call(e, u.value, a) : h.value = a);
|
|
299
|
+
}, W = C(() => {
|
|
300
|
+
var a, _, k, M;
|
|
301
|
+
return {
|
|
302
|
+
size: n.value,
|
|
303
|
+
containerProps: {
|
|
304
|
+
onClick: b
|
|
305
|
+
},
|
|
306
|
+
to: r.value,
|
|
307
|
+
reversePlacementOnDir: "rtl",
|
|
308
|
+
placement: "right-start",
|
|
309
|
+
containerCls: [
|
|
310
|
+
z(K, "items"),
|
|
311
|
+
(a = e == null ? void 0 : e.props) == null ? void 0 : a.submenuCls,
|
|
312
|
+
s.submenuCls
|
|
313
|
+
],
|
|
314
|
+
sideOffset: t.value,
|
|
315
|
+
forceMount: s.forceMountSubmenu ?? ((_ = e == null ? void 0 : e.props) == null ? void 0 : _.forceMountSubmenu),
|
|
316
|
+
trigger: m.value,
|
|
317
|
+
closeDelay: ((k = e == null ? void 0 : e.props) == null ? void 0 : k.subMenuCloseDelay) ?? s.subMenuCloseDelay,
|
|
318
|
+
openDelay: ((M = e == null ? void 0 : e.props) == null ? void 0 : M.subMenuOpenDelay) ?? s.subMenuOpenDelay,
|
|
319
|
+
open: j.value
|
|
320
|
+
};
|
|
321
|
+
}), O = C(() => m.value === "click" ? _e : Ie), me = ee();
|
|
322
|
+
return (a, _) => (B(), E(ye(O.value), A(W.value, {
|
|
323
|
+
"onUpdate:open": R,
|
|
324
|
+
key: String(m.value)
|
|
325
|
+
}), {
|
|
326
|
+
content: $(() => [
|
|
327
|
+
D(a.$slots, "items", T(V({ ...s, key: f.value })), () => [
|
|
328
|
+
(B(!0), w(oe, null, F(a.items, (k) => (B(), E(ge, { item: k }, N({ _: 2 }, [
|
|
329
|
+
F(Object.keys(l), (M) => ({
|
|
330
|
+
name: M,
|
|
331
|
+
fn: $((q) => [
|
|
332
|
+
D(a.$slots, M, A({ ref_for: !0 }, q))
|
|
333
|
+
])
|
|
334
|
+
}))
|
|
335
|
+
]), 1032, ["item"]))), 256))
|
|
336
|
+
])
|
|
337
|
+
]),
|
|
338
|
+
default: $(() => [
|
|
339
|
+
Ce("div", A({
|
|
340
|
+
class: c(S)(c(K), s.submenuTriggerCls),
|
|
341
|
+
ref_key: "root",
|
|
342
|
+
ref: r
|
|
343
|
+
}, c(i)), [
|
|
344
|
+
fe(pe, A(G.value, {
|
|
345
|
+
class: c(z)(c(K), "trigger")
|
|
346
|
+
}), N({ _: 2 }, [
|
|
347
|
+
F(Object.keys(l), (k) => ({
|
|
348
|
+
name: k,
|
|
349
|
+
fn: $((M) => [
|
|
350
|
+
D(a.$slots, k, T(V({
|
|
351
|
+
...c(me),
|
|
352
|
+
...s,
|
|
353
|
+
...M,
|
|
354
|
+
key: f.value
|
|
355
|
+
})))
|
|
356
|
+
])
|
|
357
|
+
}))
|
|
358
|
+
]), 1040, ["class"])
|
|
359
|
+
], 16)
|
|
360
|
+
]),
|
|
361
|
+
_: 3
|
|
362
|
+
}, 16));
|
|
363
|
+
}
|
|
364
|
+
}), ge = /* @__PURE__ */ U({
|
|
365
|
+
__name: "MenuItemWrapper",
|
|
366
|
+
props: {
|
|
367
|
+
item: {}
|
|
368
|
+
},
|
|
369
|
+
setup(o) {
|
|
370
|
+
const s = o, l = Q(), t = C(() => {
|
|
371
|
+
var r, e;
|
|
372
|
+
return !!((e = (r = s.item) == null ? void 0 : r.items) != null && e.length || l.items);
|
|
373
|
+
});
|
|
374
|
+
return (r, e) => t.value ? (B(), E(je, T(A({ key: 0 }, r.item)), N({ _: 2 }, [
|
|
375
|
+
F(Object.keys(r.$slots), (m) => ({
|
|
376
|
+
name: m,
|
|
377
|
+
fn: $((g) => [
|
|
378
|
+
D(r.$slots, m, T(V(g)))
|
|
379
|
+
])
|
|
380
|
+
}))
|
|
381
|
+
]), 1040)) : (B(), E(we, T(A({ key: 1 }, r.item)), N({ _: 2 }, [
|
|
382
|
+
F(Object.keys(r.$slots), (m) => ({
|
|
383
|
+
name: m,
|
|
384
|
+
fn: $((g) => [
|
|
385
|
+
D(r.$slots, m, T(V(g)))
|
|
386
|
+
])
|
|
387
|
+
}))
|
|
388
|
+
]), 1040));
|
|
389
|
+
}
|
|
390
|
+
}), [Ae, Ee] = de("Menu"), ve = () => Ae({}), Qe = /* @__PURE__ */ U({
|
|
391
|
+
...X("Menu"),
|
|
392
|
+
__name: "Menu",
|
|
393
|
+
props: {
|
|
394
|
+
size: { default: "md" },
|
|
395
|
+
header: {},
|
|
396
|
+
forceMountSubmenu: { type: Boolean },
|
|
397
|
+
multiple: { type: Boolean },
|
|
398
|
+
selectable: { type: Boolean, default: !0 },
|
|
399
|
+
hoverTrailing: { type: Boolean },
|
|
400
|
+
disabled: { type: Boolean, default: void 0 },
|
|
401
|
+
leadingCenter: { type: Boolean },
|
|
402
|
+
items: {},
|
|
403
|
+
class: {},
|
|
404
|
+
submenuCls: {},
|
|
405
|
+
openKeys: {},
|
|
406
|
+
selectedKeys: {},
|
|
407
|
+
subMenuCloseDelay: {},
|
|
408
|
+
subMenuOpenDelay: {},
|
|
409
|
+
triggerSubMenuAction: { default: "hover" },
|
|
410
|
+
gap: {}
|
|
411
|
+
},
|
|
412
|
+
emits: [
|
|
413
|
+
"update:openKeys",
|
|
414
|
+
"update:selectedKeys",
|
|
415
|
+
"openChange",
|
|
416
|
+
"click",
|
|
417
|
+
"headerClick",
|
|
418
|
+
"deselect",
|
|
419
|
+
"select"
|
|
420
|
+
],
|
|
421
|
+
setup(o, { emit: s }) {
|
|
422
|
+
const l = o, t = s, { getDisabled: r } = Be(), e = se("menu"), m = ue(e, {
|
|
423
|
+
variants: {
|
|
424
|
+
gap: I($e, e)
|
|
425
|
+
}
|
|
426
|
+
}), g = J(l.openKeys ?? []);
|
|
427
|
+
ne(
|
|
428
|
+
() => l.openKeys,
|
|
429
|
+
() => {
|
|
430
|
+
g.value = l.openKeys ?? [];
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
const b = (n, d) => {
|
|
434
|
+
let i = Z(g.value);
|
|
435
|
+
d ? i = [...n.parentKeys ?? [], n.key] : i = i.filter((y) => y !== n.key), l.openKeys || (g.value = i), t("update:openKeys", i), t("openChange", i);
|
|
436
|
+
}, K = (n) => g.value.includes(n), p = J(l.selectedKeys ?? []);
|
|
437
|
+
return ne(
|
|
438
|
+
() => l.selectedKeys,
|
|
439
|
+
() => {
|
|
440
|
+
p.value = l.selectedKeys ?? [];
|
|
441
|
+
}
|
|
442
|
+
), Ee({
|
|
443
|
+
props: l,
|
|
444
|
+
getDisabled: r,
|
|
445
|
+
onClick: (n, d) => {
|
|
446
|
+
const i = ![void 0, null].includes(n.key) && (ze(n.key) && !Se(n.key) || De(n.key));
|
|
447
|
+
if (!r.value && !n.danger && !n.disabled && i && l.selectable && !n.hasChildren) {
|
|
448
|
+
if (l.multiple)
|
|
449
|
+
if (p.value.indexOf(n.key) > -1) {
|
|
450
|
+
if (p.value.length > 1) {
|
|
451
|
+
const h = Z(p.value).filter((j) => j !== n.key);
|
|
452
|
+
l.selectedKeys || (p.value = h), t("update:selectedKeys", h), t("deselect", { item: n, selectedKeys: p.value });
|
|
453
|
+
}
|
|
454
|
+
} else {
|
|
455
|
+
const h = [...Z(p.value), n.key];
|
|
456
|
+
l.selectedKeys || (p.value = h), t("update:selectedKeys", h), t("select", { item: n, selectedKeys: p.value });
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
const y = [n.key];
|
|
460
|
+
l.selectedKeys || (p.value = y), t("update:selectedKeys", y), t("select", { item: n, selectedKeys: p.value });
|
|
461
|
+
}
|
|
462
|
+
t("click", n, d);
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
isItemSelected: (n) => !r.value && !n.danger && !n.disabled && p.value.includes(n.key),
|
|
466
|
+
onChildrenOpenChange: b,
|
|
467
|
+
isOpen: K
|
|
468
|
+
}), (n, d) => (B(), w("div", {
|
|
469
|
+
class: H(c(S)(c(m)({ gap: n.gap ?? n.size }), l.class)),
|
|
470
|
+
onClick: d[1] || (d[1] = he(() => {
|
|
471
|
+
}, ["stop"]))
|
|
472
|
+
}, [
|
|
473
|
+
n.$slots.header || n.header || n.$slots.headerActions ? (B(), w("div", {
|
|
474
|
+
key: 0,
|
|
475
|
+
class: H(c(S)(c(z)(c(e), "header"))),
|
|
476
|
+
onClick: d[0] || (d[0] = (i) => t("headerClick", i))
|
|
477
|
+
}, [
|
|
478
|
+
n.$slots.header || n.header ? (B(), w("div", {
|
|
479
|
+
key: 0,
|
|
480
|
+
class: H(c(S)(c(z)(c(e), "header__title")))
|
|
481
|
+
}, [
|
|
482
|
+
D(n.$slots, "header", {}, () => [
|
|
483
|
+
be(ke(n.header), 1)
|
|
484
|
+
])
|
|
485
|
+
], 2)) : Y("", !0),
|
|
486
|
+
n.$slots.headerActions ? (B(), w("div", {
|
|
487
|
+
key: 1,
|
|
488
|
+
class: H(c(S)(c(z)(c(e), "header__actions")))
|
|
489
|
+
}, [
|
|
490
|
+
D(n.$slots, "headerActions")
|
|
491
|
+
], 2)) : Y("", !0)
|
|
492
|
+
], 2)) : Y("", !0),
|
|
493
|
+
D(n.$slots, "default", {}, () => [
|
|
494
|
+
(B(!0), w(oe, null, F(n.items, (i) => (B(), E(ge, { item: i }, N({ _: 2 }, [
|
|
495
|
+
F(Object.keys(n.$slots), (y) => ({
|
|
496
|
+
name: y,
|
|
497
|
+
fn: $((h) => [
|
|
498
|
+
D(n.$slots, y, A({ ref_for: !0 }, h))
|
|
499
|
+
])
|
|
500
|
+
}))
|
|
501
|
+
]), 1032, ["item"]))), 256))
|
|
502
|
+
])
|
|
503
|
+
], 2));
|
|
504
|
+
}
|
|
505
|
+
}), we = /* @__PURE__ */ U({
|
|
506
|
+
...X("MenuItem"),
|
|
507
|
+
__name: "MenuItem",
|
|
508
|
+
props: {
|
|
509
|
+
size: { default: "md" },
|
|
510
|
+
title: {},
|
|
511
|
+
leading: {},
|
|
512
|
+
trailing: {},
|
|
513
|
+
hoverTrailing: { type: Boolean, default: void 0 },
|
|
514
|
+
description: {},
|
|
515
|
+
selected: { type: Boolean, default: void 0 },
|
|
516
|
+
unFocusable: { type: Boolean, default: void 0 },
|
|
517
|
+
danger: { type: Boolean, default: void 0 },
|
|
518
|
+
disabled: { type: Boolean, default: void 0 },
|
|
519
|
+
class: {},
|
|
520
|
+
leadingCls: {},
|
|
521
|
+
leadingContentCls: {},
|
|
522
|
+
contentCls: {},
|
|
523
|
+
titleCls: {},
|
|
524
|
+
descriptionCls: {},
|
|
525
|
+
leadingCenter: { type: Boolean, default: void 0 },
|
|
526
|
+
trailingCls: {},
|
|
527
|
+
hover: { type: Boolean },
|
|
528
|
+
staticStyle: { type: Boolean },
|
|
529
|
+
slotProps: {},
|
|
530
|
+
unExtendParent: { type: Boolean, default: !1 }
|
|
531
|
+
},
|
|
532
|
+
setup(o) {
|
|
533
|
+
const s = o, l = Q(), t = s.unExtendParent ? void 0 : ve(), r = ie(v), e = C(() => {
|
|
534
|
+
var u;
|
|
535
|
+
return ((u = ae()) == null ? void 0 : u.vnode.key) ?? r;
|
|
536
|
+
}), m = C(() => ({
|
|
537
|
+
...s,
|
|
538
|
+
key: e.value
|
|
539
|
+
})), g = C(() => {
|
|
540
|
+
var u;
|
|
541
|
+
return ((u = t == null ? void 0 : t.props) == null ? void 0 : u.size) ?? s.size;
|
|
542
|
+
}), b = () => {
|
|
543
|
+
var u;
|
|
544
|
+
return ((u = t == null ? void 0 : t.getDisabled) == null ? void 0 : u.value) ?? s.disabled;
|
|
545
|
+
}, { inputBindings: K } = re({
|
|
546
|
+
getDisabled: b
|
|
547
|
+
}), p = C(() => {
|
|
548
|
+
var u, n, d;
|
|
549
|
+
return {
|
|
550
|
+
...s,
|
|
551
|
+
size: g.value,
|
|
552
|
+
selected: ((u = t == null ? void 0 : t.isItemSelected) == null ? void 0 : u.call(t, m.value)) ?? s.selected,
|
|
553
|
+
unFocusable: t != null && t.onClick ? void 0 : s.unFocusable,
|
|
554
|
+
hoverTrailing: s.hoverTrailing ?? ((n = t == null ? void 0 : t.props) == null ? void 0 : n.hoverTrailing),
|
|
555
|
+
leadingCenter: s.leadingCenter ?? ((d = t == null ? void 0 : t.props) == null ? void 0 : d.leadingCenter),
|
|
556
|
+
disabled: b(),
|
|
557
|
+
onClick: (i) => {
|
|
558
|
+
var y;
|
|
559
|
+
b() && (i.preventDefault(), i.stopPropagation()), (y = t == null ? void 0 : t.onClick) == null || y.call(t, m.value, i);
|
|
560
|
+
},
|
|
561
|
+
...K.value
|
|
562
|
+
};
|
|
563
|
+
}), f = ee();
|
|
564
|
+
return (u, n) => (B(), E(pe, T(V(p.value)), N({ _: 2 }, [
|
|
565
|
+
F(Object.keys(l), (d) => ({
|
|
566
|
+
name: d,
|
|
567
|
+
fn: $((i) => [
|
|
568
|
+
D(u.$slots, d, T(V({
|
|
569
|
+
...c(f),
|
|
570
|
+
...s,
|
|
571
|
+
...i,
|
|
572
|
+
key: e.value
|
|
573
|
+
})))
|
|
574
|
+
])
|
|
575
|
+
}))
|
|
576
|
+
]), 1040));
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
export {
|
|
580
|
+
$e as M,
|
|
581
|
+
Qe as _,
|
|
582
|
+
we as a,
|
|
583
|
+
ce as b,
|
|
584
|
+
je as c,
|
|
585
|
+
Pe as g,
|
|
586
|
+
ve as i,
|
|
587
|
+
Ee as p
|
|
588
|
+
};
|
package/dist/SubMenu/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../MenuItem.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../MenuItem.vue_vue_type_style_index_0_lang-CpFi8orx.js");exports.SubMenu=e._sfc_main$2;exports.default=e._sfc_main$2;
|
package/dist/index.d.ts
CHANGED