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