jiku-ui
Version:
A Component Library for Vue.js.
2 lines (1 loc) • 5.03 kB
JavaScript
module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=145)}({0:function(t,e,n){"use strict";function o(t,e,n,o,r,i,u,s){var a,l="function"==typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=n,l._compiled=!0),o&&(l.functional=!0),i&&(l._scopeId="data-v-"+i),u?(a=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(u)},l._ssrRegister=a):r&&(a=s?function(){r.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:r),a)if(l.functional){l._injectStyles=a;var c=l.render;l.render=function(t,e){return a.call(e),c(t,e)}}else{var d=l.beforeCreate;l.beforeCreate=d?[].concat(d,a):[a]}return{exports:t,options:l}}n.d(e,"a",(function(){return o}))},145:function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{staticClass:"hn-menu-item",class:{"is-active":t.active,"is-disabled":t.disabled},style:[t.paddingStyle,t.itemStyle,{backgroundColor:t.backgroundColor}],attrs:{role:"menuitem",tabindex:"-1"},on:{click:t.handleClick,mouseenter:t.onMouseEnter,focus:t.onMouseEnter,blur:t.onMouseLeave,mouseleave:t.onMouseLeave}},["HnMenu"===t.parentMenu.$options.componentName&&t.rootMenu.collapse&&t.$slots.title?n("hn-tooltip",{attrs:{effect:"dark",placement:"right"}},[n("div",{attrs:{slot:"content"},slot:"content"},[t._t("title")],2),n("div",{staticStyle:{position:"absolute",left:"0",top:"0",height:"100%",width:"100%",display:"inline-block","box-sizing":"border-box",padding:"0 20px"}},[t._t("default")],2)]):[t._t("default"),t._t("title")]],2)};o._withStripped=!0;var r=n(37),i=n(24),u=n.n(i),s=n(4),a=n.n(s),l={name:"HnMenuItem",componentName:"HnMenuItem",mixins:[r.a,a.a],components:{HnTooltip:u.a},props:{index:{default:null,validator:function(t){return"string"==typeof t||null===t}},route:[String,Object],disabled:Boolean},computed:{active:function(){return this.index===this.rootMenu.activeIndex},hoverBackground:function(){return this.rootMenu.hoverBackground},backgroundColor:function(){return this.rootMenu.backgroundColor||""},activeTextColor:function(){return this.rootMenu.activeTextColor||""},textColor:function(){return this.rootMenu.textColor||""},mode:function(){return this.rootMenu.mode},itemStyle:function(){var t={color:this.active?this.activeTextColor:this.textColor};return"horizontal"!==this.mode||this.isNested||(t.borderBottomColor=this.active?this.rootMenu.activeTextColor?this.activeTextColor:"":"transparent"),t},isNested:function(){return this.parentMenu!==this.rootMenu}},methods:{onMouseEnter:function(){("horizontal"!==this.mode||this.rootMenu.backgroundColor)&&(this.$el.style.backgroundColor=this.hoverBackground)},onMouseLeave:function(){("horizontal"!==this.mode||this.rootMenu.backgroundColor)&&(this.$el.style.backgroundColor=this.backgroundColor)},handleClick:function(){this.disabled||(this.dispatch("HnMenu","item-click",this),this.$emit("click",this))}},mounted:function(){this.parentMenu.addItem(this),this.rootMenu.addItem(this)},beforeDestroy:function(){this.parentMenu.removeItem(this),this.rootMenu.removeItem(this)}},c=n(0),d=Object(c.a)(l,o,[],!1,null,null,null);d.options.__file="packages/menu/src/menu-item.vue";var f=d.exports;f.install=function(t){t.component(f.name,f)};e.default=f},24:function(t,e){t.exports=require("jiku-ui/lib/tooltip")},37:function(t,e,n){"use strict";e.a={inject:["rootMenu"],computed:{indexPath:function(){for(var t=[this.index],e=this.$parent;"HnMenu"!==e.$options.componentName;)e.index&&t.unshift(e.index),e=e.$parent;return t},parentMenu:function(){for(var t=this.$parent;t&&-1===["HnMenu","HnSubmenu"].indexOf(t.$options.componentName);)t=t.$parent;return t},paddingStyle:function(){if("vertical"!==this.rootMenu.mode)return{};var t=20,e=this.$parent;if(this.rootMenu.collapse)t=20;else for(;e&&"HnMenu"!==e.$options.componentName;)"HnSubmenu"===e.$options.componentName&&(t+=20),e=e.$parent;return{paddingLeft:t+"px"}}}}},4:function(t,e){t.exports=require("jiku-ui/lib/mixins/emitter")}}).default;