@vue-interface/dropdown-menu 2.0.0-beta.3 → 2.0.0-beta.4
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/dropdown-menu.es.js +13 -18
- package/dist/dropdown-menu.umd.js +1 -1
- package/package.json +1 -1
- package/src/DropdownMenuItems.vue +4 -14
package/dist/dropdown-menu.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as d,
|
|
1
|
+
import { h as d, Fragment as m, resolveComponent as u, openBlock as f, createElementBlock as w, normalizeClass as h, createVNode as g, withCtx as _, renderSlot as y } from "vue";
|
|
2
2
|
function s(e, t) {
|
|
3
3
|
e.props.class = `${e.props.class || ""} ${t}`.trim();
|
|
4
4
|
}
|
|
@@ -10,14 +10,9 @@ function i(e, t) {
|
|
|
10
10
|
function p(e, t) {
|
|
11
11
|
return e.attrs.on[t] || e.type && e.type.listeners && e.componentOptions.listeners[t];
|
|
12
12
|
}
|
|
13
|
-
function _(e) {
|
|
14
|
-
return e && e.type && (e.type === "fragment" || typeof e.type == "symbol");
|
|
15
|
-
}
|
|
16
13
|
function a(e) {
|
|
17
14
|
for (const t of e) {
|
|
18
|
-
|
|
19
|
-
return a(t.children);
|
|
20
|
-
t.props = Object.assign({ class: void 0 }, t.props), t.attrs = Object.assign({}, t.attrs), t.attrs.on || (t.attrs.on = {});
|
|
15
|
+
t.type === m && a(t.children), t.props = Object.assign({ class: void 0 }, t.props), t.attrs = Object.assign({}, t.attrs), t.attrs.on || (t.attrs.on = {});
|
|
21
16
|
const n = t.props.class && t.props.class.match(/dropdown-item/), r = t.props.class && t.props.class.match(/dropdown-divider/);
|
|
22
17
|
t.attrs.on.click = i((o) => {
|
|
23
18
|
context.parent.$emit("click-item", o, t);
|
|
@@ -47,28 +42,28 @@ const b = (e, t) => d("div", {}, a(t.slots.default())), $ = b, k = (e, t) => {
|
|
|
47
42
|
},
|
|
48
43
|
show: Boolean
|
|
49
44
|
}
|
|
50
|
-
},
|
|
51
|
-
function
|
|
52
|
-
const l =
|
|
53
|
-
return
|
|
54
|
-
class:
|
|
45
|
+
}, v = ["aria-labelledby"];
|
|
46
|
+
function D(e, t, n, r, o, I) {
|
|
47
|
+
const l = u("dropdown-menu-items");
|
|
48
|
+
return f(), w("div", {
|
|
49
|
+
class: h(["dropdown-menu", {
|
|
55
50
|
"dropdown-menu-left": n.align === "left",
|
|
56
51
|
"dropdown-menu-right": n.align === "right",
|
|
57
52
|
show: n.show
|
|
58
53
|
}]),
|
|
59
54
|
"aria-labelledby": e.$attrs.id
|
|
60
55
|
}, [
|
|
61
|
-
|
|
62
|
-
default:
|
|
63
|
-
|
|
56
|
+
g(l, null, {
|
|
57
|
+
default: _(() => [
|
|
58
|
+
y(e.$slots, "default", {
|
|
64
59
|
onClick: t[0] || (t[0] = (...c) => e.onItemClick && e.onItemClick(...c))
|
|
65
60
|
})
|
|
66
61
|
]),
|
|
67
62
|
_: 3
|
|
68
63
|
})
|
|
69
|
-
], 10,
|
|
64
|
+
], 10, v);
|
|
70
65
|
}
|
|
71
|
-
const
|
|
66
|
+
const O = /* @__PURE__ */ k(C, [["render", D]]);
|
|
72
67
|
export {
|
|
73
|
-
|
|
68
|
+
O as DropdownMenu
|
|
74
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(s,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(s=typeof globalThis<"u"?globalThis:s||self,n(s.DropdownMenu={},s.Vue))})(this,function(s,n){"use strict";function d(t,e){t.props.class=`${t.props.class||""} ${e}`.trim()}function p(t,e){return o=>{typeof e=="function"&&e(o),o.cancelBubble||t(o)}}function l(t,e){return t.attrs.on[e]||t.type&&t.type.listeners&&t.componentOptions.listeners[e]}function a(t){for(const e of t){e.type===n.Fragment&&a(e.children),e.props=Object.assign({class:void 0},e.props),e.attrs=Object.assign({},e.attrs),e.attrs.on||(e.attrs.on={});const o=e.props.class&&e.props.class.match(/dropdown-item/),i=e.props.class&&e.props.class.match(/dropdown-divider/);e.attrs.on.click=p(r=>{context.parent.$emit("click-item",r,e)},l(e,"click")),e.attrs.on.blur=p(r=>{context.parent.$emit("blur-item",r,e)},l(e,"blur")),typeof e.type=="string"&&e.type.match(/^h\d$/)?d(e,"dropdown-header"):e.type==="hr"&&!i?(e.type="div",d(e,"dropdown-divider")):!o&&!i&&d(e,"dropdown-item")}return t}const c=(t,e)=>n.h("div",{},a(e.slots.default())),u=(t,e)=>{const o=t.__vccOpts||t;for(const[i,r]of e)o[i]=r;return o},f={name:"DropdownMenu",components:{DropdownMenuItems:c},props:{align:{type:String,default:"left",validate(t){return["left","right"].indexOf(t.toLowerCase())!==-1}},show:Boolean}},m=["aria-labelledby"];function w(t,e,o,i,r,b){const y=n.resolveComponent("dropdown-menu-items");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["dropdown-menu",{"dropdown-menu-left":o.align==="left","dropdown-menu-right":o.align==="right",show:o.show}]),"aria-labelledby":t.$attrs.id},[n.createVNode(y,null,{default:n.withCtx(()=>[n.renderSlot(t.$slots,"default",{onClick:e[0]||(e[0]=(..._)=>t.onItemClick&&t.onItemClick(..._))})]),_:3})],10,m)}const h=u(f,[["render",w]]);s.DropdownMenu=h,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment, h } from 'vue';
|
|
3
3
|
|
|
4
4
|
function appendClass(vnode, str) {
|
|
5
5
|
vnode.props.class = `${vnode.props.class || ''} ${str}`.trim();
|
|
@@ -25,20 +25,10 @@ function listener(vnode, key) {
|
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function
|
|
29
|
-
return vnode && vnode.type && vnode.type.name === 'DropdownItem';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function isFragment(vnode) {
|
|
33
|
-
// We'll go ahead and assume that if the type is a symbol, then the vnode is fragment.
|
|
34
|
-
// This may be a faulty assumption; if it is, it'll need to be changed.
|
|
35
|
-
return vnode && vnode.type && (vnode.type === 'fragment' || typeof vnode.type === 'symbol');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function changeMenuItems(items) {
|
|
28
|
+
function changeMenuItems(items) {
|
|
39
29
|
for(const vnode of items) {
|
|
40
|
-
if(
|
|
41
|
-
|
|
30
|
+
if(vnode.type === Fragment) {
|
|
31
|
+
changeMenuItems(vnode.children);
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
vnode.props = Object.assign({ class: undefined }, vnode.props);
|