6 lines
4.3 KiB
JavaScript
6 lines
4.3 KiB
JavaScript
import{h as L,r as R,m as B}from"../js/utils.68c800e0.js";import{aq as $,f as k,i as C,j as h,U as V,a0 as x,an as A,h as I}from"../js/vendor-vue-ui.f00a1236.js";import{b as P,u as N,aq as b}from"../js/app-core.b862f9c8.js";import{l as O}from"../js/index.18357c0f.js";import{B as H}from"../js/Select.952b21a0.js";import{_ as q}from"../js/_plugin-vue_export-helper.eefbdd86.js";import{_ as s,a as y}from"../js/vendor-other.7b559694.js";import"../js/vendor-lodash.d3ad8b99.js";import"../js/Caret.e6c9f7cc.js";import"../js/Close.de45e465.js";const D=L`
|
|
<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M17.2001 7.2L19.0361 9.036L17.7641 10.308L10.0001 2.544L2.23611 10.308L0.964111 9.036L10.0001 0L14.8001 4.8V2.4H17.2001V7.2ZM10.0001 4.248L17.2001 11.436V18.6H2.80011V11.436L10.0001 4.248ZM12.4001 17.4V11.4H7.60011V17.4H12.4001Z" fill="black"/>
|
|
</svg>
|
|
`,M="aioseo/locations",U="AIOSEO Local - Locations",Z="Displays locations.",j="aioseo",F={categoryId:{type:"number",default:0}},T={html:!1},z={name:M,title:U,description:Z,category:j,attributes:F,supports:T},G={setup(){return{postEditorStore:N(),rootStore:P()}},components:{BaseSelect:H},data(){return{locationCategories:[],strings:{selectLocation:this.rootStore.aioseo.localBusiness.taxonomySingleLabel}}},methods:{getCategoryOptions(e){let t=this.locationCategories.find(a=>a.value===e);return t||(t=this.locationCategories.find(a=>a.value===this.postEditorStore.currentPost.localBusinessCategory)||this.locationCategories.find(a=>!!a),t&&(this.$root.$data.categoryId=t.value)),t}},created(){this.$root.$data.categories&&this.$root.$data.categories.forEach(e=>{this.locationCategories.push({value:e.id,label:e.name})})}},J={class:"aioseo-locations-sidebar"},K={class:"sidebar-row"},Q={class:"title"};function W(e,t,a,c,o,m){const u=$("base-select");return k(),C("div",J,[h("div",K,[h("p",Q,V(o.strings.selectLocation),1),x(u,{size:"medium",options:o.locationCategories,modelValue:m.getCategoryOptions(e.$root.$data.categoryId),"onUpdate:modelValue":t[0]||(t[0]=n=>e.$root.$data.categoryId=n.value),"track-by":"value"},null,8,["options","modelValue"])])])}const X=q(G,[["render",W]]),i="all-in-one-seo-pack",{name:E,title:Y,description:ee,category:te,supports:oe,attributes:ne}=z,r=window.wp,ae=r.serverSideRender||r.components.ServerSideRender,S=r.blockEditor?.InspectorControls||r.editor.InspectorControls,_=r.components.PanelBody,se=r.data.withSelect,p={},v=[],ie={title:Y,description:ee,category:te,supports:oe,attributes:ne,icon:D,edit:se(function(e){return{categories:e("core").getEntityRecords("taxonomy",window.aioseo.localBusiness.taxonomyName)}})(function(e){const t=window?.aioseo?.options?.localBusiness?.locations?.general?.multiple,{setAttributes:a,attributes:c,clientId:o,isSelected:m,toggleSelection:u}=e;let{categories:n}=e;const g="aioseo-"+o;if(r.data.useSelect(l=>l("core/edit-post").getActiveGeneralSidebarName())==="edit-post/block"&&(typeof u!="function"||u(!0)),t&&n===null)return React.createElement("div",null,s("Loading...",i));if(n=n===null?[]:n,!t)return React.createElement("div",null,s("Please enable multiple locations before using this block.",i));if(n.length===0)return React.createElement("div",null,y(s("No %1$s found",i),window.aioseo.localBusiness.taxonomyPluralLabel));const f={id:g,parent:document.querySelector(".block-editor"),subtree:!0,loop:!1,done:function(l){B(o,v);let d=A({name:"Blocks/Locations",data:function(){return p[o]},watch:{$data:{handler:function(w){a(w)},deep:!0}},render:()=>I(X)});d=O(d),d.mount(l),v.push({id:o,app:d})}};return m&&(p[o]={},Object.keys(c).forEach(l=>{p[o][l]=c[l]}),p[o].categories=n,b(f)),n!==null&&n.length===0?React.createElement("div",null,y(s("No %1$s found",i),window.aioseo.localBusiness.taxonomyPluralLabel)):c.categoryId?React.createElement(React.Fragment,null,React.createElement(S,null,React.createElement(_,{title:s("Block Settings",i),initialOpen:!0,onToggle:b(f)},React.createElement("div",{id:g}))),React.createElement(ae,{block:E,attributes:{...c}})):React.createElement(React.Fragment,null,React.createElement(S,null,React.createElement(_,{title:s("Block Settings",i),initialOpen:!0,onToggle:b(f)},React.createElement("div",{id:g}))),React.createElement("div",null,y(s("Select a %1$s",i),window.aioseo.localBusiness.taxonomySingleLabel)))}),save:function(){return null}};R({name:E,settings:ie});
|