PageSourceSearch

https://neighbourexpress.com/js/RegionInputPro.CqkBqQu6.js

js neighbourexpress.com collected 2026-10-07 23:46:36 UTC 9,223 bytes, 1 lines download raw bytes

1import{l as ee,w as O,z as R,q as o,v as r,A as n,D as $,I as V,M as k,N as j,O as y,a5 as le,r as x,j as B,X as te}from"./index.Bp9SQj6I.js";const ae={class:"relative w-full font-NB"},ne={class:"group relative"},se=["value","placeholder","disabled"],oe={key:0,class:"absolute z-50 mt-2 bg-white border border-gray-200 rounded-lg shadow-lg flex flex-col overflow-hidden min-w-max",style:{"min-height":"280px","max-height":"300px"}},re={key:0,class:"w-full overflow-y-auto py-2 min-w-[320px]",style:{"max-height":"300px"}},ue={key:0,class:"px-4 py-8 text-center text-gray-400 text-sm"},ie=["onClick"],ce=["innerHTML"],de={class:"flex flex-1 min-h-0"},ve={class:"w-40 overflow-y-auto border-r border-gray-100 custom-scrollbar"},pe=["onClick"],fe={key:0,class:"w-3 h-3 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},he={class:"w-40 overflow-y-auto border-r border-gray-100 custom-scrollbar"},ge={key:0,class:"px-3 py-2 text-sm text-gray-400"},ye={key:1,class:"px-3 py-2 text-sm text-gray-400"},be=["onClick"],xe={key:0,class:"w-3 h-3 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},me={class:"w-40 flex flex-col min-h-0"},_e={class:"flex-shrink-0 px-2 py-2 border-b border-gray-100"},ke={class:"flex-1 overflow-y-auto min-h-0"},we={key:0,class:"px-3 py-2 text-sm text-gray-400"},Ce={class:"px-3 py-4 text-sm text-gray-600 text-center border-b border-gray-100"},Ve=["onClick"],Le=["innerHTML"],$e={key:1},je=ee({__name:"RegionInputPro",props:{options:{},modelValue:{},disabled:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:modelValue"],setup(A,{emit:H}){const f=A,m=H,i=x("");O(()=>f.modelValue,e=>{Array.isArray(e)?i.value=e.join(" / "):i.value=e||""},{immediate:!0});const w=x(!1),C=x(!1),s=x(""),p=x(null),c=x(null),h=x(null),b=x([]),N=B(()=>f.options),M=B(()=>p.value?p.value.children||[]:[]),z=B(()=>{const e=[],l=(t,u=[],g=[])=>{t.forEach(a=>{const d=[...u,a.label],v=[...g,a.value];!a.children||a.children.length===0?e.push({fullLabel:d.join(" / "),fullValue:v.join("/")}):l(a.children,d,v)})};return l(f.options),e}),E=B(()=>i.value?z.value.filter(e=>e.fullLabel.toLowerCase().includes(i.value.toLowerCase())):[]),P=()=>{var l,t,u,g;const e=f.modelValue;if(!e){p.value=null,c.value=null,h.value=null,s.value="",i.value="";return}if(Array.isArray(e)){if(e.length>=1){const a=f.options.find(d=>d.label===e[0]);if(p.value=a||null,a&&e.length>=2){const d=(l=a.children)==null?void 0:l.find(v=>v.label===e[1]);if(c.value=d||null,d&&e.length>=3){const v=(t=d.children)==null?void 0:t.find(_=>_.label===e[2]);h.value=v||null,!v&&e[2]?(s.value=e[2],i.value=e.join(" / ")):i.value=e.slice(0,3).join(" / ")}}}}else{const a=e.split(" / ").filter(Boolean);if(a.length>=1){const d=f.options.find(v=>v.label===a[0]);if(p.value=d||null,d&&a.length>=2){const v=(u=d.children)==null?void 0:u.find(_=>_.label===a[1]);if(c.value=v||null,v&&a.length>=3){const _=(g=v.children)==null?void 0:g.find(Z=>Z.label===a[2]);h.value=_||null,!_&&a[2]?(s.value=a[2],i.value=a.join(" / ")):i.value=a.slice(0,3).join(" / ")}}}}};O(()=>f.modelValue,()=>{P()},{immediate:!0});const D=e=>{p.value=e,c.value=null,h.value=null,s.value="",b.value=[]},F=e=>{c.value=e,h.value=null,s.value="",b.value=e.children||[]},q=e=>{h.value=e,s.value="",S(),L()},U=()=>{s.value&&p.value&&c.value&&(h.value={label:s.value,value:s.value},S(),L())},S=()=>{if(p.value&&c.value){const e=[p.value.label,c.value.label,h.value?h.value.label:s.value];i.value=e.join(" / "),Array.isArray(f.modelValue)?m("update:modelValue",e):m("update:modelValue",i.value)}},X=()=>{var e,l;if(!s.value)b.value=((e=c.value)==null?void 0:e.children)||[];else{const t=s.value.toLowerCase();b.value=(((l=c.value)==null?void 0:l.children)||[]).filter(u=>u.label.toLowerCase().includes(t))}},G=e=>{var t;const l=((t=e.target)==null?void 0:t.value)||"";i.value=l,Array.isArray(f.modelValue)?m("update:modelValue",l.split(" / ").filter(Boolean)):m("update:modelValue",l),C.value=!!l,w.value=!0,l&&(!l.includes("/")||l.split("/").length<3)&&(p.value=null,c.value=null,h.value=null,s.value="")},J=e=>{var t,u;i.value=e,Array.isArray(f.modelValue)?m("update:modelValue",e.split(" / ").filter(
1Boolean)):m("update:modelValue",e);const l=e.split(" / ").filter(Boolean);if(l.length>=1){const g=f.options.find(a=>a.label===l[0]);if(p.value=g||null,g&&l.length>=2){const a=(t=g.children)==null?void 0:t.find(d=>d.label===l[1]);if(c.value=a||null,a&&l.length>=3){const d=(u=a.children)==null?void 0:u.find(v=>v.label===l[2]);h.value=d||null}}}L()},K=e=>{if(!s.value)return e;const l=new RegExp(`(${T(s.value)})`,"gi");return e.replace(l,'<span class="text-blue-600 font-bold">$1</span>')},Q=e=>{if(!i.value)return e;const l=new RegExp(`(${T(i.value)})`,"gi");return e.replace(l,'<span class="text-blue-600 font-bold">$1</span>')},I=e=>e.children&&e.children.length>0,W=()=>{w.value=!0,i.value?(C.value=!1,P(),c.value&&(b.value=c.value.children||[])):(C.value=!1,c.value&&(b.value=c.value.children||[]))},L=()=>{w.value=!1,C.value=!1,s.value=""},T=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y={mounted(e,l){e.clickOutsideEvent=t=>{e===t.target||e.contains(t.target)||l.value()},document.addEventListener("click",e.clickOutsideEvent)},unmounted(e){document.removeEventListener("click",e.clickOutsideEvent)}};return(e,l)=>R((o(),r("div",ae,[n("div",ne,[n("input",{value:i.value,type:"text",placeholder:A.placeholder,disabled:f.disabled,onFocus:W,onInput:G,readonly:"",class:"w-full px-2 !text-[#606266] text-sm border rounded-md outline-none transition-all duration-200 border-gray-300 group-hover:border-gray-400 focus:border-blue-500 disabled:text-[#b9bcc2] disabled:bg-[#fafafa] disabled:border-[#e4e7ed] disabled:cursor-not-allowed"},null,40,se),n("span",{class:$(["absolute right-3 top-2.5 text-gray-400 transition-transform duration-300",{"rotate-180":w.value}])},[...l[1]||(l[1]=[n("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[n("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"})],-1)])],2)]),w.value?(o(),r("div",oe,[C.value&&i.value?(o(),r("div",re,[E.value.length===0?(o(),r("div",ue,"无匹配数据")):V("",!0),(o(!0),r(k,null,j(E.value,t=>(o(),r("div",{key:t.fullValue,onClick:u=>J(t.fullLabel),class:"px-4 py-2 text-sm cursor-pointer hover:bg-gray-100 transition-colors flex flex-col"},[n("span",{class:"text-gray-700",innerHTML:Q(t.fullLabel)},null,8,ce)],8,ie))),128))])):(o(),r(k,{key:1},[l[5]||(l[5]=n("div",{class:"flex-shrink-0 flex items-center px-3 py-1 border-b border-gray-200 bg-gray-50 text-sm font-medium text-gray-700"},[n("span",{class:"w-40 text-left"},"Country"),n("span",{class:"w-40 text-left"},"Province"),n("span",{class:"w-40 text-left"},"City")],-1)),n("div",de,[n("div",ve,[(o(!0),r(k,null,j(N.value,t=>{var u;return o(),r("div",{key:t.value,onClick:g=>D(t),class:$(["px-3 py-2 text-sm cursor-pointer flex justify-between items-center transition-colors",[((u=p.value)==null?void 0:u.value)===t.value?"text-blue-600 font-medium bg-blue-50":"text-gray-600 hover:bg-gray-100"]])},[n("span",null,y(t.label),1),I(t)?(o(),r("svg",fe,[...l[2]||(l[2]=[n("path",{d:"M9 5l7 7-7-7"},null,-1)])])):V("",!0)],10,pe)}),128))]),n("div",he,[M.value.length===0&&p.value?(o(),r("div",ge," 该国家下无省份数据 ")):V("",!0),p.value?(o(!0),r(k,{key:2},j(M.value,t=>{var u;return o(),r("div",{key:t.value,onClick:g=>F(t),class:$(["px-3 py-2 text-sm cursor-pointer flex justify-between items-center transition-colors",[((u=c.value)==null?void 0:u.value)===t.value?"text-blue-600 font-medium bg-blue-50":"text-gray-600 hover:bg-gray-100"]])},[n("span",null,y(t.label),1),I(t)?(o(),r("svg",xe,[...l[3]||(l[3]=[n("path",{d:"M9 5l7 7-7-7"},null,-1)])])):V("",!0)],10,be)}),128)):(o(),r("div",ye,y(e.$t("order_mgn_agent.pleaseSelectCountry")),1))]),n("div",me,[n("div",_e,[R(n("input",{"onUpdate:modelValue":l[0]||(l[0]=t=>s.value=t),type:"text",placeholder:"Search city",onInput:X,class:"w-full px-2 py-1 text-sm border border-gray-300 rounded focus:border-blue-500 focus:outline-none"},null,544),[[le,s.value]])]),n("div",ke,[c.value?b.value.length===0&&s.value?(o(),r(k,{key:1},[n("div",Ce,y(e.$t("order_mgn_agent.NoMatchingFound")),1),n("div",{onClick:U,class:"px-3 py-2 text-sm cursor-pointer flex items-center justify-between text-blue-600 hover:bg-blue-50 transition-colors"},[n("span",null,y(e.$t("order_mgn_agent.use"))+'"'+y(s.value)+'"'+y(e.$t("order_mgn_agent.asCity")),1),l[4]||(l[4]=n("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[n("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1))])],64)):(o(!0),r(k,{key:2},j(b.value,t=>{var u;return o(),r("div",{key:t.value,onClick:g=>q(t),class:$(["px-3 py-2 text-sm cursor-pointer transition-colors",[((u=h.value)==null?void 0:u.value)===t.value?"text-blue-600 font-medium bg-blue-50":"text-gray-600 hover:bg-gray-100"]])},[s.value?(o(),r("span",{key:0,innerHTML:K(t.label)},null,8,Le)):(o(),r("span",$e,y(t.label),1))],10,Ve)}),128)):(o(),r("div",we,y(e.$t("order_mgn_agent.pleaseSelectProvice")),1))])])])],64))])):V("",!0)])),[[Y,L]])}}),Ae=te(je,[["__scopeId","data-v-dee39001"]]);export{Ae as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.