@vue-interface/dropdown-menu 2.0.0-beta.2 → 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 +26 -28
- package/dist/dropdown-menu.umd.js +1 -1
- package/package.json +1 -1
- package/src/DropdownMenuItems.vue +4 -13
package/dist/dropdown-menu.es.js
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import { h as
|
|
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
|
}
|
|
5
5
|
function i(e, t) {
|
|
6
|
-
return (
|
|
7
|
-
typeof t == "function" && t(
|
|
6
|
+
return (n) => {
|
|
7
|
+
typeof t == "function" && t(n), n.cancelBubble || e(n);
|
|
8
8
|
};
|
|
9
9
|
}
|
|
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
|
|
14
|
-
for (const t of e
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
t.
|
|
18
|
-
|
|
19
|
-
t.attrs.on.
|
|
20
|
-
context.parent.$emit("
|
|
21
|
-
}, p(t, "
|
|
22
|
-
context.parent.$emit("blur-item", n, t);
|
|
23
|
-
}, p(t, "blur")), typeof t.type == "string" && t.type.match(/^h\d$/) ? s(t, "dropdown-header") : t.type === "hr" && !r ? (t.type = "div", s(t, "dropdown-divider")) : !o && !r && s(t, "dropdown-item");
|
|
13
|
+
function a(e) {
|
|
14
|
+
for (const t of e) {
|
|
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 = {});
|
|
16
|
+
const n = t.props.class && t.props.class.match(/dropdown-item/), r = t.props.class && t.props.class.match(/dropdown-divider/);
|
|
17
|
+
t.attrs.on.click = i((o) => {
|
|
18
|
+
context.parent.$emit("click-item", o, t);
|
|
19
|
+
}, p(t, "click")), t.attrs.on.blur = i((o) => {
|
|
20
|
+
context.parent.$emit("blur-item", o, t);
|
|
21
|
+
}, p(t, "blur")), typeof t.type == "string" && t.type.match(/^h\d$/) ? s(t, "dropdown-header") : t.type === "hr" && !r ? (t.type = "div", s(t, "dropdown-divider")) : !n && !r && s(t, "dropdown-item");
|
|
24
22
|
}
|
|
25
23
|
return e;
|
|
26
24
|
}
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
for (const [r,
|
|
30
|
-
|
|
31
|
-
return
|
|
25
|
+
const b = (e, t) => d("div", {}, a(t.slots.default())), $ = b, k = (e, t) => {
|
|
26
|
+
const n = e.__vccOpts || e;
|
|
27
|
+
for (const [r, o] of t)
|
|
28
|
+
n[r] = o;
|
|
29
|
+
return n;
|
|
32
30
|
}, C = {
|
|
33
31
|
name: "DropdownMenu",
|
|
34
32
|
components: {
|
|
@@ -45,20 +43,20 @@ const y = (e, t) => c("div", {}, b(t.slots.default())), $ = y, k = (e, t) => {
|
|
|
45
43
|
show: Boolean
|
|
46
44
|
}
|
|
47
45
|
}, v = ["aria-labelledby"];
|
|
48
|
-
function D(e, t,
|
|
46
|
+
function D(e, t, n, r, o, I) {
|
|
49
47
|
const l = u("dropdown-menu-items");
|
|
50
|
-
return
|
|
51
|
-
class:
|
|
52
|
-
"dropdown-menu-left":
|
|
53
|
-
"dropdown-menu-right":
|
|
54
|
-
show:
|
|
48
|
+
return f(), w("div", {
|
|
49
|
+
class: h(["dropdown-menu", {
|
|
50
|
+
"dropdown-menu-left": n.align === "left",
|
|
51
|
+
"dropdown-menu-right": n.align === "right",
|
|
52
|
+
show: n.show
|
|
55
53
|
}]),
|
|
56
54
|
"aria-labelledby": e.$attrs.id
|
|
57
55
|
}, [
|
|
58
|
-
|
|
56
|
+
g(l, null, {
|
|
59
57
|
default: _(() => [
|
|
60
|
-
|
|
61
|
-
onClick: t[0] || (t[0] = (...
|
|
58
|
+
y(e.$slots, "default", {
|
|
59
|
+
onClick: t[0] || (t[0] = (...c) => e.onItemClick && e.onItemClick(...c))
|
|
62
60
|
})
|
|
63
61
|
]),
|
|
64
62
|
_: 3
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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();
|
|
@@ -24,20 +24,11 @@ function listener(vnode, key) {
|
|
|
24
24
|
vnode.componentOptions.listeners[key]
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
|
-
function isDropdownItem(vnode) {
|
|
28
|
-
return vnode && vnode.type && vnode.type.name === 'DropdownItem';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// function isSymbol(vnode) {
|
|
32
|
-
// // We'll go ahead and assume that if the type is a symbol, then the vnode is fragment.
|
|
33
|
-
// // This may be a faulty assumption; if it is, it'll need to be changed.
|
|
34
|
-
// return vnode && vnode.type && (vnode.type === 'fragment' || typeof vnode.type === 'symbol');
|
|
35
|
-
// }
|
|
36
27
|
|
|
37
28
|
function changeMenuItems(items) {
|
|
38
|
-
for(const vnode of items
|
|
39
|
-
if(
|
|
40
|
-
|
|
29
|
+
for(const vnode of items) {
|
|
30
|
+
if(vnode.type === Fragment) {
|
|
31
|
+
changeMenuItems(vnode.children);
|
|
41
32
|
}
|
|
42
33
|
|
|
43
34
|
vnode.props = Object.assign({ class: undefined }, vnode.props);
|