Tabs.94a491a6.js
4.97 KB
import{S as r}from"./SaveChanges.e40a9083.js";import{T as l}from"./TruSeoScore.339d22e1.js";import{a as c,m as u}from"./vuex.esm.8fdeb4b6.js";import{f as d,a as h}from"./Caret.19b10233.js";import{S as _}from"./Information.93f80cbf.js";import{n as i}from"./_plugin-vue2_normalizer.61652a7c.js";import{T as m}from"./Slide.15a07930.js";const b={};var f=function(){var t=this,s=t._self._c;return s("svg",{staticClass:"aioseo-ellipse",attrs:{viewBox:"0 0 6 6",fill:"none",xmlns:"http://www.w3.org/2000/svg"}},[s("circle",{attrs:{r:"2",transform:"matrix(-1 0 0 1 3 3)",fill:"currentColor",stroke:"currentColor","stroke-width":"2"}})])},v=[],p=i(b,f,v,!1,null,null,null,null);const g=p.exports;const w={components:{SvgCaret:d,SvgCircleCheck:h,SvgCircleInformation:_,SvgEllipse:g,TransitionSlide:m},mixins:[r,l],props:{tabs:{type:Array,required:!0},skinnyTabs:Boolean,active:String,showSaveButton:{type:Boolean,default(){return!0}},internal:Boolean,disableMobile:Boolean},data(){return{buttonLoading:!1,showMobileMenu:!0,calculateWidth:!1,showMobileTabs:!1,strings:{saveChanges:this.$t.__("Save Changes",this.$td)}}},computed:{...c(["loading","currentPost"]),filteredTabs(){return this.tabs.filter(a=>a.slug!==(this.active?this.active:this.$route&&this.$route.name?this.$route.name:""))}},methods:{...u(["openModal"]),getActiveTabName(){const a=this.tabs.find(t=>t.slug===(this.active?this.active:this.$route&&this.$route.name?this.$route.name:""));return a?a.name:""},maybeShowMobileMenu(){if(window.matchMedia("(max-width: 782px)").matches&&!this.disableMobile){this.showMobileMenu=!0;return}let a=0;this.calculateWidth=!0,this.$nextTick(()=>{a=this.$refs["tabs-scroller"].offsetWidth,this.calculateWidth=!1;let t=0;const s=this.$refs["tabs-button"];if(s){const e=s.querySelector(".aioseo-button");t=e?e.scrollWidth:0}if(a+t>this.$refs["aioseo-tabs"].offsetWidth){this.showMobileMenu=!0;return}this.showMobileMenu=!1})}},beforeDestroy(){window.removeEventListener("resize",this.maybeShowMobileMenu)},mounted(){window.addEventListener("resize",this.maybeShowMobileMenu),this.$nextTick(()=>this.maybeShowMobileMenu())}};var y=function(){var t=this,s=t._self._c;return s("div",{ref:"aioseo-tabs",staticClass:"aioseo-tabs",class:{internal:t.internal,skinny:t.skinnyTabs}},[s("div",{directives:[{name:"show",rawName:"v-show",value:!t.showMobileMenu||t.calculateWidth,expression:"!showMobileMenu || calculateWidth"}],ref:"tabs-scroller",staticClass:"tabs-scroller"},[s("md-tabs",{attrs:{"md-sync-route":!t.active,"md-active-tab":t.active},on:{"md-changed":e=>t.$emit("changed",e)},scopedSlots:t._u([{key:"md-tab",fn:function({tab:e}){return[t._t("md-tab",function(){return[t._t("md-tab-icon",null,{tab:e}),s("span",{staticClass:"label"},[t._v(t._s(e.label))]),t.$root._data.screenContext==="sidebar"&&t.getActiveTabName()!==e.label?s("md-tooltip",{attrs:{"md-direction":"top"}},[t._v(" "+t._s(e.label)+" ")]):t._e(),e.data.errorCount>=0?s("span",{staticClass:"tab-score",class:t.getErrorClass(t.currentPost.page_analysis.analysis[e.data.slug].errors)},[0<t.currentPost.page_analysis.analysis[e.data.slug].errors?s("svg-ellipse",{attrs:{width:"6"}}):t._e(),t.currentPost.page_analysis.analysis[e.data.slug].errors===0?s("svg-circle-check",{attrs:{width:"12"}}):t._e(),t._v(" "+t._s(t.getErrorDisplay(t.currentPost.page_analysis.analysis[e.data.slug].errors))+" ")],1):t._e(),e.data.warning&&t.$root._data.screenContext!=="sidebar"?s("span",{staticClass:"warning"},[s("svg-circle-information",{attrs:{width:"15",height:"15"}})],1):t._e()]},{tab:e})]}}],null,!0)},t._l(t.tabs,function(e,n){return s("md-tab",{key:n,attrs:{id:e.slug,"md-label":e.name,"md-icon":e.icon,to:e.url,"md-template-data":{pro:e.pro,analyze:e.analyze,errorCount:e.errorCount,slug:e.slug,warning:e.warning}}})}),1)],1),t.showMobileMenu?s("div",{staticClass:"aioseo-mobile-tabs"},[s("div",{staticClass:"active-tab",on:{click:function(e){t.showMobileTabs=!t.showMobileTabs}}},[s("div",[t._v(" "+t._s(t.getActiveTabName())+" "),s("svg-caret",{class:{rotated:!t.showMobileTabs},on:{click:function(e){e.stopPropagation(),t.showMobileTabs=!t.showMobileTabs}}}),s("span",{staticClass:"tab-indicator"})],1)]),s("transition-slide",{staticClass:"tab-dropdown",attrs:{active:t.showMobileTabs}},[s("div",{staticClass:"tab-links"},[t.active?t._e():t._l(t.filteredTabs,function(e,n){return s("router-link",{key:n,attrs:{to:e.url},nativeOn:{click:function(o){t.showMobileTabs=!1}}},[t._v(" "+t._s(e.name)+" ")])}),t.active?t._l(t.filteredTabs,function(e,n){return s("a",{key:n,attrs:{href:"#"},on:{click:function(o){o.preventDefault(),t.$emit("changed",e.slug)&&(t.showMobileTabs=!1)}}},[t._v(" "+t._s(e.name)+" ")])}):t._e()],2)])],1):t._e(),t.showSaveButton?s("div",{ref:"tabs-button",staticClass:"button-right"},[t._t("button",function(){return[s("base-button",{attrs:{type:"blue",size:"medium",loading:t.loading},on:{click:t.processSaveChanges}},[t._v(" "+t._s(t.strings.saveChanges)+" ")])]})],2):t._e(),s("div",{staticClass:"tabs-extra"},[t._t("extra")],2)])},M=[],C=i(w,y,M,!1,null,null,null,null);const A=C.exports;export{A as C,g as S};