primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue) [ • 6.84 kB
JavaScript
"use strict";var e=require("vue"),n={name:"DockSub",props:{model:{type:Array,default:null},template:{type:Function,default:null},exact:{type:Boolean,default:!0},tooltipOptions:null},data:()=>({currentIndex:-3}),methods:{onListMouseLeave(){this.currentIndex=-3},onItemMouseEnter(e){this.currentIndex=e},onItemClick(e,n,t){this.disabled(n)?e.preventDefault():(n.command&&n.command({originalEvent:e,item:n}),n.to&&t&&t(e))},itemClass(e){return["p-dock-item",{"p-dock-item-second-prev":this.currentIndex-2===e,"p-dock-item-prev":this.currentIndex-1===e,"p-dock-item-current":this.currentIndex===e,"p-dock-item-next":this.currentIndex+1===e,"p-dock-item-second-next":this.currentIndex+2===e}]},linkClass(e,n){return["p-dock-action",{"p-disabled":this.disabled(e),"router-link-active":n&&n.isActive,"router-link-active-exact":this.exact&&n&&n.isExactActive}]},disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled}};const t={class:"p-dock-list-container"};n.render=function(n,o,i,c,l,r){const s=e.resolveComponent("router-link"),a=e.resolveDirective("ripple"),d=e.resolveDirective("tooltip");return e.openBlock(),e.createBlock("div",t,[e.createVNode("ul",{ref:"list",class:"p-dock-list",role:"menu",onMouseleave:o[1]||(o[1]=(...e)=>r.onListMouseLeave&&r.onListMouseLeave(...e))},[(e.openBlock(!0),e.createBlock(e.Fragment,null,e.renderList(i.model,((n,t)=>(e.openBlock(),e.createBlock("li",{class:r.itemClass(t),key:t,role:"none",onMouseenter:e=>r.onItemMouseEnter(t)},[i.template?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.template),{key:1,item:n},null,8,["item"])):(e.openBlock(),e.createBlock(e.Fragment,{key:0},[n.to&&!r.disabled(n)?(e.openBlock(),e.createBlock(s,{key:0,to:n.to,custom:""},{default:e.withCtx((({navigate:t,href:o,isActive:c,isExactActive:l})=>[e.withDirectives(e.createVNode("a",{href:o,role:"menuitem",class:r.linkClass(n,{isActive:c,isExactActive:l}),target:n.target,onClick:e=>r.onItemClick(e,n,t)},["string"==typeof n.icon?e.withDirectives((e.openBlock(),e.createBlock("span",{key:0,class:["p-dock-action-icon",n.icon]},null,2)),[[a]]):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:1}))],10,["href","target","onClick"]),[[d,{value:n.label,disabled:!i.tooltipOptions},i.tooltipOptions]])])),_:2},1032,["to"])):e.withDirectives((e.openBlock(),e.createBlock("a",{key:1,href:n.url,role:"menuitem",class:r.linkClass(n),target:n.target,onClick:e=>r.onItemClick(e,n),tabindex:r.disabled(n)?null:"0"},["string"==typeof n.icon?e.withDirectives((e.openBlock(),e.createBlock("span",{key:0,class:["p-dock-action-icon",n.icon]},null,2)),[[a]]):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:1}))],10,["href","target","onClick","tabindex"])),[[d,{value:n.label,disabled:!i.tooltipOptions},i.tooltipOptions]])],64))],42,["onMouseenter"])))),128))],544)])};var o={name:"Dock",props:{position:{type:String,default:"bottom"},model:null,class:null,style:null,tooltipOptions:null,exact:{type:Boolean,default:!0}},computed:{containerClass(){return["p-dock p-component",`p-dock-${this.position}`,this.class]}},components:{DockSub:n}};!function(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===t&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-dock {\n position: absolute;\n z-index: 1;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n pointer-events: none;\n}\n.p-dock-list-container {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n pointer-events: auto;\n}\n.p-dock-list {\n margin: 0;\n padding: 0;\n list-style: none;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-dock-item {\n -webkit-transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);\n transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);\n will-change: transform;\n}\n.p-dock-action {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n cursor: default;\n}\n.p-dock-item-second-prev,\n.p-dock-item-second-next {\n -webkit-transform: scale(1.2);\n transform: scale(1.2);\n}\n.p-dock-item-prev,\n.p-dock-item-next {\n -webkit-transform: scale(1.4);\n transform: scale(1.4);\n}\n.p-dock-item-current {\n -webkit-transform: scale(1.6);\n transform: scale(1.6);\n z-index: 1;\n}\n\n/* Position */\n/* top */\n.p-dock-top {\n left: 0;\n top: 0;\n width: 100%;\n}\n.p-dock-top .p-dock-item {\n -webkit-transform-origin: center top;\n transform-origin: center top;\n}\n\n/* bottom */\n.p-dock-bottom {\n left: 0;\n bottom: 0;\n width: 100%;\n}\n.p-dock-bottom .p-dock-item {\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n}\n\n/* right */\n.p-dock-right {\n right: 0;\n top: 0;\n height: 100%;\n}\n.p-dock-right .p-dock-item {\n -webkit-transform-origin: center right;\n transform-origin: center right;\n}\n.p-dock-right .p-dock-list {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n\n/* left */\n.p-dock-left {\n left: 0;\n top: 0;\n height: 100%;\n}\n.p-dock-left .p-dock-item {\n -webkit-transform-origin: center left;\n transform-origin: center left;\n}\n.p-dock-left .p-dock-list {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n"),o.render=function(n,t,o,i,c,l){const r=e.resolveComponent("DockSub");return e.openBlock(),e.createBlock("div",{class:l.containerClass,style:o.style},[e.createVNode(r,{model:o.model,template:n.$slots.item,exact:o.exact,tooltipOptions:o.tooltipOptions},null,8,["model","template","exact","tooltipOptions"])],6)},module.exports=o;