@jctrans-materials/comps 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/dist/index.cjs.js +0 -1
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.esm.js +0 -502
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jctrans-materials/comps",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"vue": "^3.2.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@jctrans-materials/shared": "1.0.
|
|
29
|
+
"@jctrans-materials/shared": "1.0.7"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@vitejs/plugin-vue": "^6.0.2",
|
package/dist/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),H=require("@jctrans-materials/shared"),Y=(h,f)=>{const d=h.__vccOpts||h;for(const[g,k]of f)d[g]=k;return d},ne={class:"modal-container"},se={class:"modal-body"},re={class:"form-item"},ce={class:"input-box"},ie={class:"form-item"},ue={class:"type-group"},de=["onClick"],ve={key:0,class:"check-mark"},me={class:"form-item"},pe={class:"dropdown-wrapper"},Ae={class:"select-trigger"},ye={key:0,class:"dropdown-panel"},he={key:0,class:"no-data"},fe=["onClick"],ge={class:"option-content"},ke={class:"type-tag"},Ee={class:"main-text"},Ce={class:"sub-text"},Ve={key:0,class:"no-data"},Be={__name:"ApplyDataDialog",props:{value:Boolean},emits:["update:value","confirm"],setup(h,{emit:f}){const d=f,g=["City","Port","Airport"],k=e.ref(!1),n=e.ref(""),A=e.ref(""),y=e.ref(!1);let v=null;const c=e.ref([]),i=e.reactive({name:"",type:"City",selectedCountry:null});e.watch(A,async s=>{if(!s.trim()){c.value=[];return}y.value=!0;try{console.log("Fetching data for:",s);const r=[{name:s+" City",region:"China",type:"City"},{name:s+" Port",region:"China",type:"Port"},{name:s+" Country",region:"China",type:"Port"},{name:s+" AirPort",region:"China",type:"Port"},{name:s+" SeaPort",region:"China",type:"Port"},{name:s+" RegionPort",region:"China",type:"Port"},{name:s+" VssPort",region:"China",type:"Port"},{name:s+" CrrPort",region:"China",type:"Port"}];await new Promise(u=>setTimeout(u,300)),c.value=r}catch(r){console.error("Failed to fetch data:",r),c.value=[]}finally{y.value=!1}});const m=c,p=()=>{k.value=!0,v&&clearTimeout(v),v=setTimeout(()=>{A.value=n.value},400)},C=()=>{d("update:value",!1)},D=()=>{k.value=!1},E=s=>{i.selectedCountry=s,n.value=s.name,A.value=s.name,k.value=!1},O=()=>{if(!i.name||!n.value){alert("Please fill in all fields");return}d("confirm",{...i,country:n.value})},V={bind(s,r){s.clickOutsideEvent=u=>{s===u.target||s.contains(u.target)||r.value()},document.addEventListener("mousedown",s.clickOutsideEvent)},unbind(s){document.removeEventListener("mousedown",s.clickOutsideEvent)}};return(s,r)=>h.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"modal-mask",onClick:e.withModifiers(C,["self"])},[e.createElementVNode("div",ne,[e.createElementVNode("div",{class:"modal-header"},[r[2]||(r[2]=e.createElementVNode("span",{class:"header-title"},"Apply for data addition",-1)),e.createElementVNode("div",{class:"close-btn",onClick:C},"×")]),e.createElementVNode("div",se,[e.createElementVNode("div",re,[r[3]||(r[3]=e.createElementVNode("label",{class:"required"},"Data To Add",-1)),e.createElementVNode("div",ce,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=u=>i.name=u),type:"text",placeholder:"Please enter your data",class:"custom-input"},null,512),[[e.vModelText,i.name]])])]),e.createElementVNode("div",ie,[r[4]||(r[4]=e.createElementVNode("label",{class:"required"},"Type",-1)),e.createElementVNode("div",ue,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(g,u=>e.createElementVNode("div",{key:u,class:e.normalizeClass(["type-btn",{active:i.type===u}]),onClick:b=>i.type=u},[e.createTextVNode(e.toDisplayString(u)+" ",1),i.type===u?(e.openBlock(),e.createElementBlock("div",ve)):e.createCommentVNode("",!0)],10,de)),64))])]),e.createElementVNode("div",me,[r[5]||(r[5]=e.createElementVNode("label",{class:"required"},"Country",-1)),e.withDirectives((e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",Ae,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":r[1]||(r[1]=u=>n.value=u),placeholder:"Please input to search",onInput:p,class:"custom-input"},null,544),[[e.vModelText,n.value]]),e.createElementVNode("i",{class:e.normalizeClass(["arrow-icon",{up:k.value}])},null,2)]),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[k.value?(e.openBlock(),e.createElementBlock("div",ye,[y.value?(e.openBlock(),e.createElementBlock("div",he,"Searching...")):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(u,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:"option-item",onClick:R=>E(u)},[e.createElementVNode("div",ge,[e.createElementVNode("span",ke,e.toDisplayString(u.type),1),e.createElementVNode("span",Ee,e.toDisplayString(u.name),1),e.createElementVNode("span",Ce,", "+e.toDisplayString(u.region),1)])],8,fe))),128)),e.unref(m).length===0?(e.openBlock(),e.createElementBlock("div",Ve," No matching data found ")):e.createCommentVNode("",!0)],64))])):e.createCommentVNode("",!0)]),_:1})])),[[V,D]])])]),e.createElementVNode("div",{class:"modal-footer"},[e.createElementVNode("button",{class:"confirm-btn",onClick:O},"Confirm")])])])):e.createCommentVNode("",!0)}},X=Y(Be,[["__scopeId","data-v-634d3db0"]]),Ne="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACT0lEQVR4AaRSO2hTYRT+zn9v2g6CiktFJYoVHXQoOljM2EIEh0orbRKa5qUuDoIZAnXI4FBwcRDikMcNkoQMQjcVESo4OASsW2kLBi3oUKiD1OZx7/H811wJZFF6uOee85/H93/3nKtwQPkvgFKpdKRgVR+UrFrOsurX9N3/DJCvVPxMwx+lKcbgKzbstPhwAXSyWK7eLZZrc4VCNZDPPx/Tt+kCrTqvOrQqfuNrc2OcgW0CduQM9TfJyIB5mQy8UaaxKbftFq3qL9HP1KGGFDe+NDdC/jPnlwgcZEM9lRiU2VFjgngI4FGxa0IvZXecU07XPsc2pkCUIULaa2Z2MsJ7Orkw/8kFiMVCb4XWcQV14w8temL4aJNM47Fh0OHEYqieWAyXT/jPBhzmh7o5EY28Rk/cGWSz2a4GSsTCt3tgs5qmDc726sTQvsS6/c0SFDz97lO/329K4z2Amm1u3ZK11SyrOmNC/ZDYSElWiT5R2resymUZ1pIUv2Qa+iafcrrFretDNJwTf94GUnt7u9u6to3hUW09dQEcIC+BR0LxqgztPnFrotd8wWHclNykaR4dYeCngj0IQNyekOQshLas8hmzLyA3B2UTU6l4eEX8Ld8IZsTu+Mg4hj5xGcTj8f1kLPxChjgO0AdWlAOwnkotbImFrHGFGdOy6u82aJAB+kUZywQ6KaH3ou7TcbguziRApiLWOXjiMvAO2iaic3rH6wxe1Wetd+KRNQKEDV9kwisd83QAQCfkr7uUjEUq2vdUgdJQFExEw++8mLa/AQAA//9h0VsEAAAABklEQVQDAKhs6Pxd3K8TAAAAAElFTkSuQmCC",T="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACgUlEQVR4AXRST0hUYRD/zbfbrqahQpAHlQ3dSurYoaBAwWNQkIT7J/ve09DQsOigkNCha4ckl4Lct0/S3QI7REFEBB08FBHRIYLwIJEodOlUurnfNN+6mq9weMPM+818v2/mm1HYQX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i0ZfX6APEYNAg86bjMluCFDr+7OX1JoWQNJed/ipaK6Z6oOi2dbTZ85eVan+YYLBL7yBdRb9IXkha23aPPa8bQBrFoUVqo4qMMU5mOZ2JBKeo98RiwHi8xQ7Qo6vCsdb6e+//4ubgJegLzlmDOQ6i/XKCVQskZg9aaFtRrBGsYytQpQiu+SPOI5xQ2+kK6mQJRJHo8lko8MqxswGhceCzY25mMnLEmOf3Br6f2/BaLaTqhuSl6/xxPRQNDrJehBRrSWxABMaMnmsKfCN9eEfSZS9lAG9O3OmJ9J1C9ABVb1rgoF1PqA/Cokw3k7stgKDvZHwHXcUYqW+J1CacejlcXoi4SvFvD2lRdxAER0s3glirS5Gyr7+FwAA//8Pj6q2AAAABklEQVQDAJPeLlNn5TR8AAAAAElFTkSuQmCC",we="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyDgoaSnuHeZY3MlYcNsnIb8fze6M3hra0XoKJm95N3Nv3EnyhFvb2EgjRJbOMKqmO2tDcvQ5fK+qvl4CJbOn9/CJPP9tArp5sHtP4lc652VXxPL1Z1hRFIOytF1NuTJCfnT4Ms8HjSgJctn1xIt6hxqIkdK+u8U8zT1ESmP5enUkWmqMkhG2FmxXOvR+EGD5KAhoDqsQvtiMXJQGNQJ4N8mF6PMd/wL8SxuOXPSG21pj9p+L1EOjGyAHoQQ0zWGDqx9pbPWIpwqOEkw+gGyMHoAc1ozOkVhOcZyepYndNpDpPvwAAAP//BVQJHAAAAAZJREFUAwDZWL4hub5xHQAAAABJRU5ErkJggg==",De="data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='2534'%20width='200'%20height='200'%3e%3cpath%20d='M448%2085.333333a362.666667%20362.666667%200%201%200%20224.512%20647.509334l155.818667%20155.818666a42.666667%2042.666667%200%200%200%2060.330666-60.330666l-155.818666-155.818667A362.666667%20362.666667%200%200%200%20448%2085.333333zM170.666667%20448a277.333333%20277.333333%200%201%201%20554.666666%200%20277.333333%20277.333333%200%200%201-554.666666%200z'%20p-id='2535'%3e%3c/path%3e%3c/svg%3e";async function L(h,f=["Continent","Country","City","Seaport","Airport"]){return H.locationSearchV2.searchByName({keyword:h,displayInfo:f})}const K=(h,f)=>H.locationSearchV2.searchByIdWithType(h,f),_e={class:"search-container"},be={class:"search-input-wrapper"},Oe=["placeholder"],Re={class:"suffix-area"},Qe={key:1,class:"loading-spinner"},Te={class:"search-icon"},xe=["src"],Me={key:0,class:"history-section"},Pe={class:"history-header"},Ue=["onMousedown"],Ie={class:"category-tag"},Fe=["src"],Je={class:"type-text"},Le={class:"result-text"},Ke={key:0,class:"status-msg"},Ge=["onMousedown"],qe={class:"category-tag"},He=["src"],Ye={class:"type-text"},Xe={class:"result-text"},We={key:0,class:"load-more-msg"},je={key:1,class:"load-more-msg no-more"},Ze={key:2,class:"status-msg"},G="_search_history_cache",ze={__name:"index",props:{modelValue:{type:[Object,String],default:null},value:{type:[Object,String],default:null},searchTypeList:{type:Array,default:()=>["Continent","Country","Region","City","Seaport","Airport"]},historyKey:{type:String,default:""}},emits:["update:modelValue","input","select","change","submit-search"],setup(h,{emit:f}){const d=h,g=f,k=e.ref(null),n=e.ref(""),A=e.ref(""),y=e.ref(""),v=e.ref(!1),c=e.ref([]),i=e.ref(!1),m=e.ref(!1),p=e.ref([]);let C=null;const D=e.ref(1),E=e.ref(0),O=e.ref(10),V=e.ref(!1),s=e.computed(()=>c.value.length>=E.value&&E.value>0),r=e.computed(()=>d.historyKey+G),u=e.computed(()=>r.value!==G),b=e.computed(()=>v.value?A.value:N.value?"Please enter...":"请输入..."),R=e.computed(()=>d.modelValue||d.value),x=e.computed(()=>d.searchTypeList.length>0?d.searchTypeList:[]),N=e.computed(()=>{let t="";try{if(typeof useCookie=="function"){const a=useCookie("jc-language").value;if(a)return/en/.test(a)||/en-US/.test(a)}}catch{}return typeof process<"u"&&process.client?t=document.cookie||"":typeof process<"u"&&process.server&&(t=useNuxtApp?.()?.ssrContext?.event.node.req.headers.cookie||""),/jc-language=en-US/.test(t)||/jc-language=en/.test(t)});e.watch(()=>[d.value,d.modelValue],([t,a],o)=>{const l=t||a;if(!l){A.value="",y.value="",v.value=!1;return}if(Array.isArray(o)){const[w,_]=o,Q=w||_;if(JSON.stringify(l)===JSON.stringify(Q)&&v.value)return}const S=(w,_)=>{K(w,_).then(Q=>{const B=Q.records.find(le=>le.id===w);B&&(A.value=B.display||B.name||B.nameEn||B.nameCn||"",y.value=B.nameEn||B.nameCn||B.display||"",v.value=!!A.value)})};if(l&&typeof l=="object"){if(l.id&&l.type){S(l.id,l.type);return}A.value=l.display||l.name||l.nameEn||l.nameCn||"",y.value=l.nameEn||l.nameCn||l.display||"",v.value=!!A.value}else typeof l=="string"?(A.value=l,y.value=l,v.value=!!l):(A.value="",y.value="",v.value=!1)},{immediate:!0,deep:!0}),e.watch(n,t=>{if(!t.trim()){c.value=[],i.value=!1,E.value=0;return}m.value=!0,g("change",t),C&&clearTimeout(C),C=setTimeout(()=>{M(1,!1)},300)});const M=async(t=1,a=!1)=>{if(!(!n.value.trim()&&!a)){a?V.value=!0:(i.value=!0,D.value=1);try{const o=await L(n.value,x.value,{current:t,size:O.value});if(console.log("🍉 ~ SearchV2.vue:314 ~ fetchData ~ res:",o),n.value.trim()||a){const l=o.records||[],S=d.searchTypeList.includes("Country")?[...d.searchTypeList,"Region"]:d.searchTypeList,w=l.filter(_=>S.includes(_.type));a?c.value=[...c.value,...w]:c.value=w,E.value=o.total||0,D.value=t}}finally{i.value=!1,V.value=!1}}},j=t=>{const{scrollTop:a,scrollHeight:o,clientHeight:l}=t.target;a+l>=o-20&&!i.value&&!V.value&&!s.value&&n.value&&M(D.value+1,!0)};e.onMounted(()=>{const t=localStorage.getItem(r.value);if(t)try{p.value=JSON.parse(t)}catch{p.value=[]}}),e.watch(m,t=>{t?document.body.style.overflow="hidden":document.body.style.overflow=""}),e.onBeforeUnmount(()=>{document.body.style.overflow=""});const P=t=>{F(t);const a=t.display||t.name||t.nameEn||t.nameCn;A.value=a,y.value=t.nameEn||t.nameCn,v.value=!0,n.value="",c.value=[],m.value=!1,i.value=!1,E.value=0,C&&clearTimeout(C),g("update:modelValue",t),g("input",t),g("select",t)},U=()=>{n.value="",A.value="",y.value="",v.value=!1,c.value=[],E.value=0,g("update:modelValue",null),g("input",null),p.value.length>0?m.value=!0:m.value=!1,k.value&&k.value.focus()},Z=async()=>{if((p.value.length>0||n.value||c.value.length>0||v.value)&&(m.value=!0),v.value&&c.value.length===0&&!i.value){const a=R.value;i.value=!0;try{let o=null;if(a&&a.id&&a.type?o=await K(a.id,a.type):y.value&&(o=await L(y.value,x.value)),o&&o.records){const l=o.records.length>0?o.records:a?[a]:[];c.value=l.filter(S=>d.searchTypeList.includes(S.type)),E.value=o.total||c.value.length,c.value.length===0&&p.value.length===0&&(m.value=!1)}}catch(o){console.error("回显搜索失败",o)}finally{i.value=!1}}},z=()=>{setTimeout(()=>{m.value=!1,n.value!==""&&(n.value="")},200)},$=t=>{t.target.value!==""?v.value=!1:U()},ee=t=>{const a=d.value||d.modelValue;if(!a)return!1;if(t.id&&a.id)return t.id===a.id;const o=t.display||t.name||t.nameEn||t.nameCn,l=a.display||a.name||a.nameEn||a.nameCn;return o===l&&t.type===a.type},I=t=>({City:we,Country:Se,Airport:Ne,Seaport:J,Continent:T,Province:T,Region:T,Port:J})[t]||"",F=t=>{if(!t)return;const a=p.value.filter(o=>o.id&&o.id!==t.id||o.display!==t.display);a.unshift(t),u.value&&(p.value=a.slice(0,4),localStorage.setItem(r.value,JSON.stringify(p.value)))},te=()=>{p.value=[],localStorage.removeItem(r.value),!n.value&&c.value.length===0&&(m.value=!1)},ae=()=>{const t=R.value,a=n.value.trim();v.value&&t&&typeof t=="object"?(F(t),g("submit-search",t),m.value=!1):a?(g("submit-search",{nameCn:a,type:"Manual"}),m.value=!1):k.value?.focus()};return(t,a)=>(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",be,[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:k,class:e.normalizeClass({"is-selected-state":v.value}),"onUpdate:modelValue":a[0]||(a[0]=o=>n.value=o),type:"text",placeholder:b.value,onFocus:Z,onBlur:z,onInput:$},null,42,Oe),[[e.vModelText,n.value]]),e.createElementVNode("div",Re,[n.value||v.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"clear-icon",onMousedown:a[1]||(a[1]=e.withModifiers(()=>{},["prevent"])),onClick:e.withModifiers(U,["stop"])},"ⓧ",32)):e.createCommentVNode("",!0),i.value&&!V.value?(e.openBlock(),e.createElementBlock("div",Qe)):(e.openBlock(),e.createElementBlock("button",{key:2,class:"search-btn",onClick:ae},[e.createElementVNode("span",Te,[e.createElementVNode("img",{src:e.unref(De),alt:"search"},null,8,xe)])]))])]),m.value&&(c.value.length>0||i.value||n.value||p.value.length>0)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dropdown-list",onScroll:j},[e.renderSlot(t.$slots,"history",{searchHistory:p.value},()=>[p.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("div",Pe,[e.createElementVNode("span",null,e.toDisplayString(N.value?"Recent search":"最近搜索"),1),e.createElementVNode("span",{class:"clear-btn",onMousedown:a[2]||(a[2]=e.withModifiers(()=>{},["prevent"])),onClick:e.withModifiers(te,["stop"])},e.toDisplayString(N.value?"Clear":"清空"),33)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(o,l)=>(e.openBlock(),e.createElementBlock("div",{key:"hist-"+l,class:"dropdown-item",onMousedown:S=>P(o)},[e.createElementVNode("div",Ie,[e.createElementVNode("img",{class:"type-icon",src:I(o.type),alt:""},null,8,Fe),e.createElementVNode("span",Je,e.toDisplayString(o.type),1)]),e.createElementVNode("div",Le,e.toDisplayString(o.display||o.nameEn||o.nameCn),1)],40,Ue))),128)),a[3]||(a[3]=e.createElementVNode("hr",{class:"divider"},null,-1))])):e.createCommentVNode("",!0)],!0),i.value&&!V.value?(e.openBlock(),e.createElementBlock("div",Ke,e.toDisplayString(N.value?"Searching...":"正在搜索中..."),1)):c.value.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"results",{searchResults:c.value},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(o,l)=>(e.openBlock(),e.createElementBlock("div",{key:l,class:e.normalizeClass(["dropdown-item",{"is-active":ee(o)}]),onMousedown:S=>P(o)},[e.createElementVNode("div",qe,[e.createElementVNode("img",{class:"type-icon",src:I(o.type),alt:""},null,8,He),e.createElementVNode("span",Ye,e.toDisplayString(o.type),1)]),e.createElementVNode("div",Xe,e.toDisplayString(o.display||o.nameEn||o.nameCn),1)],42,Ge))),128))],!0),V.value?(e.openBlock(),e.createElementBlock("div",We,e.toDisplayString(N.value?"Loading more...":"正在加载更多..."),1)):s.value&&n.value?(e.openBlock(),e.createElementBlock("div",je,e.toDisplayString(N.value?"All results have been loaded":"已加载全部结果"),1)):e.createCommentVNode("",!0)],64)):n.value&&!i.value?(e.openBlock(),e.createElementBlock("div",Ze,[e.renderSlot(t.$slots,"noData",{},()=>[e.createTextVNode(e.toDisplayString(N.value?`No results found related to "${n.value}".`:`未找到与 "${n.value}" 相关的结果`),1)],!0)])):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)]))}},W=Y(ze,[["__scopeId","data-v-8d9e82dd"]]),q={ApplyDataDialog:X,JcSearch:W},$e={install(h){for(const f in q)h.component(f,q[f])}};exports.ApplyDataDialog=X;exports.JcSearch=W;exports.default=$e;
|
package/dist/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@charset "UTF-8";.modal-mask[data-v-634d3db0]{position:fixed;inset:0;background:#0009;display:flex;align-items:center;justify-content:center;z-index:2000}.modal-container[data-v-634d3db0]{width:560px;background:#fff;border-radius:12px;overflow:hidden;box-shadow:0 12px 32px #0000001a;display:flex;flex-direction:column}.modal-container .modal-header[data-v-634d3db0]{background:#3b1c10;color:#fff;padding:20px 24px;display:flex;justify-content:space-between;align-items:center;border-top-left-radius:12px;border-top-right-radius:12px}.modal-container .modal-header .header-title[data-v-634d3db0]{font-weight:700;font-size:18px;font-style:italic}.modal-container .modal-header .close-btn[data-v-634d3db0]{cursor:pointer;font-size:24px;line-height:1}.modal-container .modal-body[data-v-634d3db0]{padding:30px 40px}.modal-container .modal-body .form-item[data-v-634d3db0]{margin-bottom:24px;width:100%}.modal-container .modal-body .form-item label[data-v-634d3db0]{display:block;margin-bottom:10px;font-weight:600}.modal-container .modal-body .form-item label.required[data-v-634d3db0]:after{content:" *";color:#f56c6c}.modal-container .modal-body .form-item .custom-input[data-v-634d3db0]{width:100%;box-sizing:border-box;height:44px;border:1px solid #e7e7e8;border-radius:6px;padding:0 15px;outline:none;font-size:14px;transition:border-color .2s}.modal-container .modal-body .form-item .custom-input[data-v-634d3db0]:focus{border-color:#ff7a22}.type-group[data-v-634d3db0]{display:flex;gap:12px}.type-group .type-btn[data-v-634d3db0]{flex:1;height:44px;border:1px solid #e7e7e8;border-radius:4px;display:flex;align-items:center;justify-content:center;cursor:pointer;position:relative;background:#fff;overflow:hidden}.type-group .type-btn.active[data-v-634d3db0]{border-color:#ff7a22;color:#ff7a22;background:#fff9f5}.type-group .type-btn.active .check-mark[data-v-634d3db0]{position:absolute;right:-1px;bottom:-1px;width:16px;height:16px;background:#ff7a22;clip-path:xywh(0 0 100% 100% round 10px 0 0 0)}.type-group .type-btn.active .check-mark[data-v-634d3db0]:after{content:"✓";color:#fff;font-size:8px;position:absolute;right:3px;bottom:1px}.dropdown-wrapper[data-v-634d3db0],.dropdown-wrapper .select-trigger[data-v-634d3db0]{position:relative}.dropdown-wrapper .select-trigger .arrow-icon[data-v-634d3db0]{position:absolute;right:15px;top:50%;transform:translateY(-50%);border:6px solid transparent;border-top-color:#c0c4cc;transition:transform .3s;pointer-events:none}.dropdown-wrapper .select-trigger .arrow-icon.up[data-v-634d3db0]{transform:translateY(-75%) rotate(180deg)}.dropdown-wrapper .dropdown-panel[data-v-634d3db0]{position:absolute;top:calc(100% + 5px);left:0;width:100%;background:#fff;border:1px solid #e7e7e8;border-radius:8px;box-shadow:0 4px 12px #0000001a;z-index:100;max-height:100px;overflow-y:auto}.dropdown-wrapper .dropdown-panel .option-item[data-v-634d3db0]{padding:12px 16px;cursor:pointer;display:flex;align-items:center}.dropdown-wrapper .dropdown-panel .option-item[data-v-634d3db0]:hover{background:#f5f7fa}.dropdown-wrapper .dropdown-panel .option-item .type-tag[data-v-634d3db0]{background:#f0f2f5;color:#909399;padding:2px 8px;border-radius:4px;font-size:12px;margin-right:12px;min-width:60px;text-align:center}.dropdown-wrapper .dropdown-panel .option-item .main-text[data-v-634d3db0]{font-weight:500}.dropdown-wrapper .dropdown-panel .option-item .sub-text[data-v-634d3db0]{color:#999;font-size:13px}.dropdown-wrapper .dropdown-panel .no-data[data-v-634d3db0]{padding:20px;text-align:center;color:#999}.confirm-btn[data-v-634d3db0]{width:calc(100% - 80px);margin:0 40px 30px;height:50px;background:#ff7a22;border:none;border-radius:8px;color:#fff;font-size:16px;font-weight:700;cursor:pointer}.confirm-btn[data-v-634d3db0]:hover{background:#ff6b09}.fade-enter-active[data-v-634d3db0],.fade-leave-active[data-v-634d3db0]{transition:opacity .2s}.fade-enter[data-v-634d3db0],.fade-leave-to[data-v-634d3db0]{opacity:0}.search-container[data-v-8d9e82dd]{--original-orange: #ff6a00;--original-orange-hover: #e55f00;--original-bg-active: #fff8f5;--original-text-main: #333;--original-text-muted: #999;width:100%;margin:50px auto;position:relative;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Arial,sans-serif}.search-input-wrapper[data-v-8d9e82dd]{display:flex;align-items:center;background:#fff;border:1px solid #e0e0e0;border-radius:8px;padding:6px 10px;box-shadow:0 2px 10px #0000000d;transition:border-color .3s}.search-input-wrapper[data-v-8d9e82dd]:focus-within{border-color:var(--original-orange)}.search-input-wrapper input[data-v-8d9e82dd]{flex:1;border:none;outline:none;padding:10px;font-size:16px;color:var(--original-text-main);background-color:transparent}.search-input-wrapper input[data-v-8d9e82dd]::placeholder{color:var(--original-text-muted)}.search-input-wrapper input.is-selected-state[data-v-8d9e82dd]:not(:focus)::placeholder{color:var(--original-text-main);font-weight:500}.search-input-wrapper input.is-selected-state[data-v-8d9e82dd]:focus::placeholder{color:#ccc}.suffix-area[data-v-8d9e82dd]{display:flex;align-items:center;gap:8px}.clear-icon[data-v-8d9e82dd]{cursor:pointer;color:#ccc;font-size:14px;margin-right:4px;opacity:0;transition:opacity .2s,color .2s}.search-input-wrapper:hover .clear-icon[data-v-8d9e82dd],.search-input-wrapper:focus-within .clear-icon[data-v-8d9e82dd]{opacity:1}.clear-icon[data-v-8d9e82dd]:hover{color:var(--original-orange)}.loading-spinner[data-v-8d9e82dd]{width:18px;height:18px;border:2px solid #f3f3f3;border-top:2px solid var(--original-orange);border-radius:50%;animation:spin-8d9e82dd .8s linear infinite}@keyframes spin-8d9e82dd{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.search-btn[data-v-8d9e82dd]{background:var(--original-orange);border:none;border-radius:6px;width:36px;height:36px;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center}.search-icon img[data-v-8d9e82dd]{width:19px;height:19px}.dropdown-list[data-v-8d9e82dd]{position:absolute;top:105%;width:100%;background:#fff;border-radius:8px;box-shadow:0 10px 25px #0000001a;z-index:100;padding:8px 0;border:1px solid #f0f0f0;max-height:300px;overflow-y:auto}.dropdown-item[data-v-8d9e82dd]{display:flex;align-items:center;padding:12px 20px;cursor:pointer}.dropdown-item[data-v-8d9e82dd]:hover{background-color:#f5f7fa}.dropdown-item.is-active[data-v-8d9e82dd]{background-color:var(--original-bg-active);color:var(--original-orange);font-weight:600;position:relative}.dropdown-item.is-active[data-v-8d9e82dd]:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background-color:var(--original-orange)}.category-tag[data-v-8d9e82dd]{background-color:#f0f2f5;padding:4px 12px;border-radius:4px;margin-right:8px;min-width:118px;display:flex;align-items:center;gap:4px}.type-icon[data-v-8d9e82dd]{width:16px;height:16px}.type-text[data-v-8d9e82dd]{font-size:12px;color:#666;font-weight:600;text-transform:uppercase}.result-text[data-v-8d9e82dd]{font-size:15px;color:#2c3e50;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.status-msg[data-v-8d9e82dd]{padding:20px;color:var(--original-text-muted);text-align:center;font-size:14px}.history-header[data-v-8d9e82dd]{display:flex;justify-content:space-between;padding:10px 20px;font-size:14px;font-weight:700}.clear-btn[data-v-8d9e82dd]{color:#666;cursor:pointer;font-weight:400}.divider[data-v-8d9e82dd]{border:none;border-top:1px solid #f0f0f0;margin:8px 0}.load-more-msg[data-v-8d9e82dd]{padding:10px;text-align:center;font-size:12px;color:var(--original-orange)}.load-more-msg.no-more[data-v-8d9e82dd]{color:var(--original-text-muted)}
|
package/dist/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { App } from 'vue';
|
|
2
|
-
import { default as ApplyDataDialog } from '../components/ApplyDataDialog';
|
|
3
|
-
import { default as JcSearch } from '../components/search/index';
|
|
4
|
-
|
|
5
|
-
export { ApplyDataDialog, JcSearch };
|
|
6
|
-
declare const _default: {
|
|
7
|
-
install(app: App): void;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
package/dist/index.esm.js
DELETED
|
@@ -1,502 +0,0 @@
|
|
|
1
|
-
import { ref as y, reactive as ge, watch as M, createElementBlock as r, createCommentVNode as b, openBlock as i, withModifiers as I, createElementVNode as s, withDirectives as J, vModelText as X, Fragment as x, renderList as L, normalizeClass as F, createTextVNode as re, toDisplayString as g, createVNode as Ce, Transition as ke, withCtx as _e, unref as W, computed as D, onMounted as Ee, onBeforeUnmount as Se, renderSlot as q } from "vue";
|
|
2
|
-
import { locationSearchV2 as ie } from "@jctrans-materials/shared";
|
|
3
|
-
const ce = (k, _) => {
|
|
4
|
-
const A = k.__vccOpts || k;
|
|
5
|
-
for (const [E, S] of _)
|
|
6
|
-
A[E] = S;
|
|
7
|
-
return A;
|
|
8
|
-
}, we = { class: "modal-container" }, be = { class: "modal-body" }, Re = { class: "form-item" }, Oe = { class: "input-box" }, Qe = { class: "form-item" }, Ve = { class: "type-group" }, Be = ["onClick"], Te = {
|
|
9
|
-
key: 0,
|
|
10
|
-
class: "check-mark"
|
|
11
|
-
}, De = { class: "form-item" }, xe = { class: "dropdown-wrapper" }, Pe = { class: "select-trigger" }, Ue = {
|
|
12
|
-
key: 0,
|
|
13
|
-
class: "dropdown-panel"
|
|
14
|
-
}, Ie = {
|
|
15
|
-
key: 0,
|
|
16
|
-
class: "no-data"
|
|
17
|
-
}, Ne = ["onClick"], Me = { class: "option-content" }, Je = { class: "type-tag" }, Le = { class: "main-text" }, Fe = { class: "sub-text" }, Ke = {
|
|
18
|
-
key: 0,
|
|
19
|
-
class: "no-data"
|
|
20
|
-
}, Ge = {
|
|
21
|
-
__name: "ApplyDataDialog",
|
|
22
|
-
props: {
|
|
23
|
-
value: Boolean
|
|
24
|
-
// Vue 2.7 v-model 绑定
|
|
25
|
-
},
|
|
26
|
-
emits: ["update:value", "confirm"],
|
|
27
|
-
setup(k, { emit: _ }) {
|
|
28
|
-
const A = _, E = ["City", "Port", "Airport"], S = y(!1), n = y(""), f = y(""), C = y(!1);
|
|
29
|
-
let p = null;
|
|
30
|
-
const u = y([]), d = ge({
|
|
31
|
-
name: "",
|
|
32
|
-
type: "City",
|
|
33
|
-
selectedCountry: null
|
|
34
|
-
});
|
|
35
|
-
M(f, async (o) => {
|
|
36
|
-
if (!o.trim()) {
|
|
37
|
-
u.value = [];
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
C.value = !0;
|
|
41
|
-
try {
|
|
42
|
-
console.log("Fetching data for:", o);
|
|
43
|
-
const c = [
|
|
44
|
-
{ name: o + " City", region: "China", type: "City" },
|
|
45
|
-
{ name: o + " Port", region: "China", type: "Port" },
|
|
46
|
-
{ name: o + " Country", region: "China", type: "Port" },
|
|
47
|
-
{ name: o + " AirPort", region: "China", type: "Port" },
|
|
48
|
-
{ name: o + " SeaPort", region: "China", type: "Port" },
|
|
49
|
-
{ name: o + " RegionPort", region: "China", type: "Port" },
|
|
50
|
-
{ name: o + " VssPort", region: "China", type: "Port" },
|
|
51
|
-
{ name: o + " CrrPort", region: "China", type: "Port" }
|
|
52
|
-
];
|
|
53
|
-
await new Promise((v) => setTimeout(v, 300)), u.value = c;
|
|
54
|
-
} catch (c) {
|
|
55
|
-
console.error("Failed to fetch data:", c), u.value = [];
|
|
56
|
-
} finally {
|
|
57
|
-
C.value = !1;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
const h = u, m = () => {
|
|
61
|
-
S.value = !0, p && clearTimeout(p), p = setTimeout(() => {
|
|
62
|
-
f.value = n.value;
|
|
63
|
-
}, 400);
|
|
64
|
-
}, R = () => {
|
|
65
|
-
A("update:value", !1);
|
|
66
|
-
}, P = () => {
|
|
67
|
-
S.value = !1;
|
|
68
|
-
}, w = (o) => {
|
|
69
|
-
d.selectedCountry = o, n.value = o.name, f.value = o.name, S.value = !1;
|
|
70
|
-
}, K = () => {
|
|
71
|
-
if (!d.name || !n.value) {
|
|
72
|
-
alert("Please fill in all fields");
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
A("confirm", { ...d, country: n.value });
|
|
76
|
-
}, O = {
|
|
77
|
-
bind(o, c) {
|
|
78
|
-
o.clickOutsideEvent = (v) => {
|
|
79
|
-
o === v.target || o.contains(v.target) || c.value();
|
|
80
|
-
}, document.addEventListener("mousedown", o.clickOutsideEvent);
|
|
81
|
-
},
|
|
82
|
-
unbind(o) {
|
|
83
|
-
document.removeEventListener("mousedown", o.clickOutsideEvent);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
return (o, c) => k.value ? (i(), r("div", {
|
|
87
|
-
key: 0,
|
|
88
|
-
class: "modal-mask",
|
|
89
|
-
onClick: I(R, ["self"])
|
|
90
|
-
}, [
|
|
91
|
-
s("div", we, [
|
|
92
|
-
s("div", { class: "modal-header" }, [
|
|
93
|
-
c[2] || (c[2] = s("span", { class: "header-title" }, "Apply for data addition", -1)),
|
|
94
|
-
s("div", {
|
|
95
|
-
class: "close-btn",
|
|
96
|
-
onClick: R
|
|
97
|
-
}, "×")
|
|
98
|
-
]),
|
|
99
|
-
s("div", be, [
|
|
100
|
-
s("div", Re, [
|
|
101
|
-
c[3] || (c[3] = s("label", { class: "required" }, "Data To Add", -1)),
|
|
102
|
-
s("div", Oe, [
|
|
103
|
-
J(s("input", {
|
|
104
|
-
"onUpdate:modelValue": c[0] || (c[0] = (v) => d.name = v),
|
|
105
|
-
type: "text",
|
|
106
|
-
placeholder: "Please enter your data",
|
|
107
|
-
class: "custom-input"
|
|
108
|
-
}, null, 512), [
|
|
109
|
-
[X, d.name]
|
|
110
|
-
])
|
|
111
|
-
])
|
|
112
|
-
]),
|
|
113
|
-
s("div", Qe, [
|
|
114
|
-
c[4] || (c[4] = s("label", { class: "required" }, "Type", -1)),
|
|
115
|
-
s("div", Ve, [
|
|
116
|
-
(i(), r(x, null, L(E, (v) => s("div", {
|
|
117
|
-
key: v,
|
|
118
|
-
class: F(["type-btn", { active: d.type === v }]),
|
|
119
|
-
onClick: (N) => d.type = v
|
|
120
|
-
}, [
|
|
121
|
-
re(g(v) + " ", 1),
|
|
122
|
-
d.type === v ? (i(), r("div", Te)) : b("", !0)
|
|
123
|
-
], 10, Be)), 64))
|
|
124
|
-
])
|
|
125
|
-
]),
|
|
126
|
-
s("div", De, [
|
|
127
|
-
c[5] || (c[5] = s("label", { class: "required" }, "Country", -1)),
|
|
128
|
-
J((i(), r("div", xe, [
|
|
129
|
-
s("div", Pe, [
|
|
130
|
-
J(s("input", {
|
|
131
|
-
type: "text",
|
|
132
|
-
"onUpdate:modelValue": c[1] || (c[1] = (v) => n.value = v),
|
|
133
|
-
placeholder: "Please input to search",
|
|
134
|
-
onInput: m,
|
|
135
|
-
class: "custom-input"
|
|
136
|
-
}, null, 544), [
|
|
137
|
-
[X, n.value]
|
|
138
|
-
]),
|
|
139
|
-
s("i", {
|
|
140
|
-
class: F(["arrow-icon", { up: S.value }])
|
|
141
|
-
}, null, 2)
|
|
142
|
-
]),
|
|
143
|
-
Ce(ke, { name: "fade" }, {
|
|
144
|
-
default: _e(() => [
|
|
145
|
-
S.value ? (i(), r("div", Ue, [
|
|
146
|
-
C.value ? (i(), r("div", Ie, "Searching...")) : (i(), r(x, { key: 1 }, [
|
|
147
|
-
(i(!0), r(x, null, L(W(h), (v, N) => (i(), r("div", {
|
|
148
|
-
key: N,
|
|
149
|
-
class: "option-item",
|
|
150
|
-
onClick: (G) => w(v)
|
|
151
|
-
}, [
|
|
152
|
-
s("div", Me, [
|
|
153
|
-
s("span", Je, g(v.type), 1),
|
|
154
|
-
s("span", Le, g(v.name), 1),
|
|
155
|
-
s("span", Fe, ", " + g(v.region), 1)
|
|
156
|
-
])
|
|
157
|
-
], 8, Ne))), 128)),
|
|
158
|
-
W(h).length === 0 ? (i(), r("div", Ke, " No matching data found ")) : b("", !0)
|
|
159
|
-
], 64))
|
|
160
|
-
])) : b("", !0)
|
|
161
|
-
]),
|
|
162
|
-
_: 1
|
|
163
|
-
})
|
|
164
|
-
])), [
|
|
165
|
-
[O, P]
|
|
166
|
-
])
|
|
167
|
-
])
|
|
168
|
-
]),
|
|
169
|
-
s("div", { class: "modal-footer" }, [
|
|
170
|
-
s("button", {
|
|
171
|
-
class: "confirm-btn",
|
|
172
|
-
onClick: K
|
|
173
|
-
}, "Confirm")
|
|
174
|
-
])
|
|
175
|
-
])
|
|
176
|
-
])) : b("", !0);
|
|
177
|
-
}
|
|
178
|
-
}, He = /* @__PURE__ */ ce(Ge, [["__scopeId", "data-v-634d3db0"]]), qe = "data:image/png;base64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fX6APEYNAg86bjMluCFDr+7OX1JoWQNJed/ipaK6Z6oOi2dbTZ85eVan+YYLBL7yBdRb9IXkha23aPPa8bQBrFoUVqo4qMMU5mOZ2JBKeo98RiwHi8xQ7Qo6vCsdb6e+//4ubgJegLzlmDOQ6i/XKCVQskZg9aaFtRrBGsYytQpQiu+SPOI5xQ2+kK6mQJRJHo8lko8MqxswGhceCzY25mMnLEmOf3Br6f2/BaLaTqhuSl6/xxPRQNDrJehBRrSWxABMaMnmsKfCN9eEfSZS9lAG9O3OmJ9J1C9ABVb1rgoF1PqA/Cokw3k7stgKDvZHwHXcUYqW+J1CacejlcXoi4SvFvD2lRdxAER0s3glirS5Gyr7+FwAA//8Pj6q2AAAABklEQVQDAJPeLlNn5TR8AAAAAElFTkSuQmCC", Xe = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyDgoaSnuHeZY3MlYcNsnIb8fze6M3hra0XoKJm95N3Nv3EnyhFvb2EgjRJbOMKqmO2tDcvQ5fK+qvl4CJbOn9/CJPP9tArp5sHtP4lc652VXxPL1Z1hRFIOytF1NuTJCfnT4Ms8HjSgJctn1xIt6hxqIkdK+u8U8zT1ESmP5enUkWmqMkhG2FmxXOvR+EGD5KAhoDqsQvtiMXJQGNQJ4N8mF6PMd/wL8SxuOXPSG21pj9p+L1EOjGyAHoQQ0zWGDqx9pbPWIpwqOEkw+gGyMHoAc1ozOkVhOcZyepYndNpDpPvwAAAP//BVQJHAAAAAZJREFUAwDZWL4hub5xHQAAAABJRU5ErkJggg==", We = "data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='2534'%20width='200'%20height='200'%3e%3cpath%20d='M448%2085.333333a362.666667%20362.666667%200%201%200%20224.512%20647.509334l155.818667%20155.818666a42.666667%2042.666667%200%200%200%2060.330666-60.330666l-155.818666-155.818667A362.666667%20362.666667%200%200%200%20448%2085.333333zM170.666667%20448a277.333333%20277.333333%200%201%201%20554.666666%200%20277.333333%20277.333333%200%200%201-554.666666%200z'%20p-id='2535'%3e%3c/path%3e%3c/svg%3e";
|
|
179
|
-
async function se(k, _ = [
|
|
180
|
-
"Continent",
|
|
181
|
-
"Country",
|
|
182
|
-
"City",
|
|
183
|
-
"Seaport",
|
|
184
|
-
"Airport"
|
|
185
|
-
]) {
|
|
186
|
-
return ie.searchByName({
|
|
187
|
-
keyword: k,
|
|
188
|
-
displayInfo: _
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
const le = (k, _) => ie.searchByIdWithType(k, _), je = { class: "search-container" }, Ze = { class: "search-input-wrapper" }, ze = ["placeholder"], $e = { class: "suffix-area" }, et = {
|
|
192
|
-
key: 1,
|
|
193
|
-
class: "loading-spinner"
|
|
194
|
-
}, tt = { class: "search-icon" }, at = ["src"], st = {
|
|
195
|
-
key: 0,
|
|
196
|
-
class: "history-section"
|
|
197
|
-
}, lt = { class: "history-header" }, nt = ["onMousedown"], ot = { class: "category-tag" }, rt = ["src"], it = { class: "type-text" }, ct = { class: "result-text" }, ut = {
|
|
198
|
-
key: 0,
|
|
199
|
-
class: "status-msg"
|
|
200
|
-
}, dt = ["onMousedown"], vt = { class: "category-tag" }, At = ["src"], pt = { class: "type-text" }, yt = { class: "result-text" }, ht = {
|
|
201
|
-
key: 0,
|
|
202
|
-
class: "load-more-msg"
|
|
203
|
-
}, mt = {
|
|
204
|
-
key: 1,
|
|
205
|
-
class: "load-more-msg no-more"
|
|
206
|
-
}, ft = {
|
|
207
|
-
key: 2,
|
|
208
|
-
class: "status-msg"
|
|
209
|
-
}, ne = "_search_history_cache", gt = {
|
|
210
|
-
__name: "index",
|
|
211
|
-
props: {
|
|
212
|
-
modelValue: {
|
|
213
|
-
type: [Object, String],
|
|
214
|
-
default: null
|
|
215
|
-
},
|
|
216
|
-
value: {
|
|
217
|
-
type: [Object, String],
|
|
218
|
-
default: null
|
|
219
|
-
},
|
|
220
|
-
searchTypeList: {
|
|
221
|
-
type: Array,
|
|
222
|
-
default: () => [
|
|
223
|
-
"Continent",
|
|
224
|
-
"Country",
|
|
225
|
-
"Region",
|
|
226
|
-
"City",
|
|
227
|
-
"Seaport",
|
|
228
|
-
"Airport"
|
|
229
|
-
]
|
|
230
|
-
},
|
|
231
|
-
historyKey: {
|
|
232
|
-
type: String,
|
|
233
|
-
default: ""
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
emits: [
|
|
237
|
-
"update:modelValue",
|
|
238
|
-
"input",
|
|
239
|
-
"select",
|
|
240
|
-
"change",
|
|
241
|
-
"submit-search"
|
|
242
|
-
],
|
|
243
|
-
setup(k, { emit: _ }) {
|
|
244
|
-
const A = k, E = _, S = y(null), n = y(""), f = y(""), C = y(""), p = y(!1), u = y([]), d = y(!1), h = y(!1), m = y([]);
|
|
245
|
-
let R = null;
|
|
246
|
-
const P = y(1), w = y(0), K = y(10), O = y(!1), o = D(() => u.value.length >= w.value && w.value > 0), c = D(() => A.historyKey + ne), v = D(() => c.value !== ne), N = D(() => p.value ? f.value : V.value ? "Please enter..." : "请输入..."), G = D(() => A.modelValue || A.value), j = D(() => A.searchTypeList.length > 0 ? A.searchTypeList : []), V = D(() => {
|
|
247
|
-
let e = "";
|
|
248
|
-
try {
|
|
249
|
-
if (typeof useCookie == "function") {
|
|
250
|
-
const t = useCookie("jc-language").value;
|
|
251
|
-
if (t) return /en/.test(t) || /en-US/.test(t);
|
|
252
|
-
}
|
|
253
|
-
} catch {
|
|
254
|
-
}
|
|
255
|
-
return typeof process < "u" && process.client ? e = document.cookie || "" : typeof process < "u" && process.server && (e = useNuxtApp?.()?.ssrContext?.event.node.req.headers.cookie || ""), /jc-language=en-US/.test(e) || /jc-language=en/.test(e);
|
|
256
|
-
});
|
|
257
|
-
M(
|
|
258
|
-
() => [A.value, A.modelValue],
|
|
259
|
-
([e, t], a) => {
|
|
260
|
-
const l = e || t;
|
|
261
|
-
if (!l) {
|
|
262
|
-
f.value = "", C.value = "", p.value = !1;
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
if (Array.isArray(a)) {
|
|
266
|
-
const [T, U] = a, H = T || U;
|
|
267
|
-
if (JSON.stringify(l) === JSON.stringify(H) && p.value) return;
|
|
268
|
-
}
|
|
269
|
-
const B = (T, U) => {
|
|
270
|
-
le(T, U).then((H) => {
|
|
271
|
-
const Q = H.records.find((fe) => fe.id === T);
|
|
272
|
-
Q && (f.value = Q.display || Q.name || Q.nameEn || Q.nameCn || "", C.value = Q.nameEn || Q.nameCn || Q.display || "", p.value = !!f.value);
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
if (l && typeof l == "object") {
|
|
276
|
-
if (l.id && l.type) {
|
|
277
|
-
B(l.id, l.type);
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
f.value = l.display || l.name || l.nameEn || l.nameCn || "", C.value = l.nameEn || l.nameCn || l.display || "", p.value = !!f.value;
|
|
281
|
-
} else typeof l == "string" ? (f.value = l, C.value = l, p.value = !!l) : (f.value = "", C.value = "", p.value = !1);
|
|
282
|
-
},
|
|
283
|
-
{ immediate: !0, deep: !0 }
|
|
284
|
-
), M(n, (e) => {
|
|
285
|
-
if (!e.trim()) {
|
|
286
|
-
u.value = [], d.value = !1, w.value = 0;
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
h.value = !0, E("change", e), R && clearTimeout(R), R = setTimeout(() => {
|
|
290
|
-
Z(1, !1);
|
|
291
|
-
}, 300);
|
|
292
|
-
});
|
|
293
|
-
const Z = async (e = 1, t = !1) => {
|
|
294
|
-
if (!(!n.value.trim() && !t)) {
|
|
295
|
-
t ? O.value = !0 : (d.value = !0, P.value = 1);
|
|
296
|
-
try {
|
|
297
|
-
const a = await se(n.value, j.value, {
|
|
298
|
-
current: e,
|
|
299
|
-
size: K.value
|
|
300
|
-
});
|
|
301
|
-
if (console.log("🍉 ~ SearchV2.vue:314 ~ fetchData ~ res:", a), n.value.trim() || t) {
|
|
302
|
-
const l = a.records || [], B = A.searchTypeList.includes("Country") ? [...A.searchTypeList, "Region"] : A.searchTypeList, T = l.filter(
|
|
303
|
-
(U) => B.includes(U.type)
|
|
304
|
-
);
|
|
305
|
-
t ? u.value = [...u.value, ...T] : u.value = T, w.value = a.total || 0, P.value = e;
|
|
306
|
-
}
|
|
307
|
-
} finally {
|
|
308
|
-
d.value = !1, O.value = !1;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}, ue = (e) => {
|
|
312
|
-
const { scrollTop: t, scrollHeight: a, clientHeight: l } = e.target;
|
|
313
|
-
t + l >= a - 20 && !d.value && !O.value && !o.value && n.value && Z(P.value + 1, !0);
|
|
314
|
-
};
|
|
315
|
-
Ee(() => {
|
|
316
|
-
const e = localStorage.getItem(c.value);
|
|
317
|
-
if (e)
|
|
318
|
-
try {
|
|
319
|
-
m.value = JSON.parse(e);
|
|
320
|
-
} catch {
|
|
321
|
-
m.value = [];
|
|
322
|
-
}
|
|
323
|
-
}), M(h, (e) => {
|
|
324
|
-
e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "";
|
|
325
|
-
}), Se(() => {
|
|
326
|
-
document.body.style.overflow = "";
|
|
327
|
-
});
|
|
328
|
-
const z = (e) => {
|
|
329
|
-
te(e);
|
|
330
|
-
const t = e.display || e.name || e.nameEn || e.nameCn;
|
|
331
|
-
f.value = t, C.value = e.nameEn || e.nameCn, p.value = !0, n.value = "", u.value = [], h.value = !1, d.value = !1, w.value = 0, R && clearTimeout(R), E("update:modelValue", e), E("input", e), E("select", e);
|
|
332
|
-
}, $ = () => {
|
|
333
|
-
n.value = "", f.value = "", C.value = "", p.value = !1, u.value = [], w.value = 0, E("update:modelValue", null), E("input", null), m.value.length > 0 ? h.value = !0 : h.value = !1, S.value && S.value.focus();
|
|
334
|
-
}, de = async () => {
|
|
335
|
-
if ((m.value.length > 0 || n.value || u.value.length > 0 || p.value) && (h.value = !0), p.value && u.value.length === 0 && !d.value) {
|
|
336
|
-
const t = G.value;
|
|
337
|
-
d.value = !0;
|
|
338
|
-
try {
|
|
339
|
-
let a = null;
|
|
340
|
-
if (t && t.id && t.type ? a = await le(t.id, t.type) : C.value && (a = await se(
|
|
341
|
-
C.value,
|
|
342
|
-
j.value
|
|
343
|
-
)), a && a.records) {
|
|
344
|
-
const l = a.records.length > 0 ? a.records : t ? [t] : [];
|
|
345
|
-
u.value = l.filter(
|
|
346
|
-
(B) => A.searchTypeList.includes(B.type)
|
|
347
|
-
), w.value = a.total || u.value.length, u.value.length === 0 && m.value.length === 0 && (h.value = !1);
|
|
348
|
-
}
|
|
349
|
-
} catch (a) {
|
|
350
|
-
console.error("回显搜索失败", a);
|
|
351
|
-
} finally {
|
|
352
|
-
d.value = !1;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}, ve = () => {
|
|
356
|
-
setTimeout(() => {
|
|
357
|
-
h.value = !1, n.value !== "" && (n.value = "");
|
|
358
|
-
}, 200);
|
|
359
|
-
}, Ae = (e) => {
|
|
360
|
-
e.target.value !== "" ? p.value = !1 : $();
|
|
361
|
-
}, pe = (e) => {
|
|
362
|
-
const t = A.value || A.modelValue;
|
|
363
|
-
if (!t) return !1;
|
|
364
|
-
if (e.id && t.id) return e.id === t.id;
|
|
365
|
-
const a = e.display || e.name || e.nameEn || e.nameCn, l = t.display || t.name || t.nameEn || t.nameCn;
|
|
366
|
-
return a === l && e.type === t.type;
|
|
367
|
-
}, ee = (e) => ({
|
|
368
|
-
City: Xe,
|
|
369
|
-
Country: Ye,
|
|
370
|
-
Airport: qe,
|
|
371
|
-
Seaport: ae,
|
|
372
|
-
Continent: Y,
|
|
373
|
-
Province: Y,
|
|
374
|
-
Region: Y,
|
|
375
|
-
Port: ae
|
|
376
|
-
})[e] || "", te = (e) => {
|
|
377
|
-
if (!e) return;
|
|
378
|
-
const t = m.value.filter(
|
|
379
|
-
(a) => a.id && a.id !== e.id || a.display !== e.display
|
|
380
|
-
);
|
|
381
|
-
t.unshift(e), v.value && (m.value = t.slice(0, 4), localStorage.setItem(
|
|
382
|
-
c.value,
|
|
383
|
-
JSON.stringify(m.value)
|
|
384
|
-
));
|
|
385
|
-
}, ye = () => {
|
|
386
|
-
m.value = [], localStorage.removeItem(c.value), !n.value && u.value.length === 0 && (h.value = !1);
|
|
387
|
-
}, he = () => {
|
|
388
|
-
const e = G.value, t = n.value.trim();
|
|
389
|
-
p.value && e && typeof e == "object" ? (te(e), E("submit-search", e), h.value = !1) : t ? (E("submit-search", { nameCn: t, type: "Manual" }), h.value = !1) : S.value?.focus();
|
|
390
|
-
};
|
|
391
|
-
return (e, t) => (i(), r("div", je, [
|
|
392
|
-
s("div", Ze, [
|
|
393
|
-
J(s("input", {
|
|
394
|
-
ref_key: "inputRef",
|
|
395
|
-
ref: S,
|
|
396
|
-
class: F({ "is-selected-state": p.value }),
|
|
397
|
-
"onUpdate:modelValue": t[0] || (t[0] = (a) => n.value = a),
|
|
398
|
-
type: "text",
|
|
399
|
-
placeholder: N.value,
|
|
400
|
-
onFocus: de,
|
|
401
|
-
onBlur: ve,
|
|
402
|
-
onInput: Ae
|
|
403
|
-
}, null, 42, ze), [
|
|
404
|
-
[X, n.value]
|
|
405
|
-
]),
|
|
406
|
-
s("div", $e, [
|
|
407
|
-
n.value || p.value ? (i(), r("span", {
|
|
408
|
-
key: 0,
|
|
409
|
-
class: "clear-icon",
|
|
410
|
-
onMousedown: t[1] || (t[1] = I(() => {
|
|
411
|
-
}, ["prevent"])),
|
|
412
|
-
onClick: I($, ["stop"])
|
|
413
|
-
}, "ⓧ", 32)) : b("", !0),
|
|
414
|
-
d.value && !O.value ? (i(), r("div", et)) : (i(), r("button", {
|
|
415
|
-
key: 2,
|
|
416
|
-
class: "search-btn",
|
|
417
|
-
onClick: he
|
|
418
|
-
}, [
|
|
419
|
-
s("span", tt, [
|
|
420
|
-
s("img", {
|
|
421
|
-
src: W(We),
|
|
422
|
-
alt: "search"
|
|
423
|
-
}, null, 8, at)
|
|
424
|
-
])
|
|
425
|
-
]))
|
|
426
|
-
])
|
|
427
|
-
]),
|
|
428
|
-
h.value && (u.value.length > 0 || d.value || n.value || m.value.length > 0) ? (i(), r("div", {
|
|
429
|
-
key: 0,
|
|
430
|
-
class: "dropdown-list",
|
|
431
|
-
onScroll: ue
|
|
432
|
-
}, [
|
|
433
|
-
q(e.$slots, "history", { searchHistory: m.value }, () => [
|
|
434
|
-
m.value.length > 0 ? (i(), r("div", st, [
|
|
435
|
-
s("div", lt, [
|
|
436
|
-
s("span", null, g(V.value ? "Recent search" : "最近搜索"), 1),
|
|
437
|
-
s("span", {
|
|
438
|
-
class: "clear-btn",
|
|
439
|
-
onMousedown: t[2] || (t[2] = I(() => {
|
|
440
|
-
}, ["prevent"])),
|
|
441
|
-
onClick: I(ye, ["stop"])
|
|
442
|
-
}, g(V.value ? "Clear" : "清空"), 33)
|
|
443
|
-
]),
|
|
444
|
-
(i(!0), r(x, null, L(m.value, (a, l) => (i(), r("div", {
|
|
445
|
-
key: "hist-" + l,
|
|
446
|
-
class: "dropdown-item",
|
|
447
|
-
onMousedown: (B) => z(a)
|
|
448
|
-
}, [
|
|
449
|
-
s("div", ot, [
|
|
450
|
-
s("img", {
|
|
451
|
-
class: "type-icon",
|
|
452
|
-
src: ee(a.type),
|
|
453
|
-
alt: ""
|
|
454
|
-
}, null, 8, rt),
|
|
455
|
-
s("span", it, g(a.type), 1)
|
|
456
|
-
]),
|
|
457
|
-
s("div", ct, g(a.display || a.nameEn || a.nameCn), 1)
|
|
458
|
-
], 40, nt))), 128)),
|
|
459
|
-
t[3] || (t[3] = s("hr", { class: "divider" }, null, -1))
|
|
460
|
-
])) : b("", !0)
|
|
461
|
-
], !0),
|
|
462
|
-
d.value && !O.value ? (i(), r("div", ut, g(V.value ? "Searching..." : "正在搜索中..."), 1)) : u.value.length > 0 ? (i(), r(x, { key: 1 }, [
|
|
463
|
-
q(e.$slots, "results", { searchResults: u.value }, () => [
|
|
464
|
-
(i(!0), r(x, null, L(u.value, (a, l) => (i(), r("div", {
|
|
465
|
-
key: l,
|
|
466
|
-
class: F(["dropdown-item", { "is-active": pe(a) }]),
|
|
467
|
-
onMousedown: (B) => z(a)
|
|
468
|
-
}, [
|
|
469
|
-
s("div", vt, [
|
|
470
|
-
s("img", {
|
|
471
|
-
class: "type-icon",
|
|
472
|
-
src: ee(a.type),
|
|
473
|
-
alt: ""
|
|
474
|
-
}, null, 8, At),
|
|
475
|
-
s("span", pt, g(a.type), 1)
|
|
476
|
-
]),
|
|
477
|
-
s("div", yt, g(a.display || a.nameEn || a.nameCn), 1)
|
|
478
|
-
], 42, dt))), 128))
|
|
479
|
-
], !0),
|
|
480
|
-
O.value ? (i(), r("div", ht, g(V.value ? "Loading more..." : "正在加载更多..."), 1)) : o.value && n.value ? (i(), r("div", mt, g(V.value ? "All results have been loaded" : "已加载全部结果"), 1)) : b("", !0)
|
|
481
|
-
], 64)) : n.value && !d.value ? (i(), r("div", ft, [
|
|
482
|
-
q(e.$slots, "noData", {}, () => [
|
|
483
|
-
re(g(V.value ? `No results found related to "${n.value}".` : `未找到与 "${n.value}" 相关的结果`), 1)
|
|
484
|
-
], !0)
|
|
485
|
-
])) : b("", !0)
|
|
486
|
-
], 32)) : b("", !0)
|
|
487
|
-
]));
|
|
488
|
-
}
|
|
489
|
-
}, Ct = /* @__PURE__ */ ce(gt, [["__scopeId", "data-v-8d9e82dd"]]), oe = {
|
|
490
|
-
ApplyDataDialog: He,
|
|
491
|
-
JcSearch: Ct
|
|
492
|
-
}, Et = {
|
|
493
|
-
install(k) {
|
|
494
|
-
for (const _ in oe)
|
|
495
|
-
k.component(_, oe[_]);
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
export {
|
|
499
|
-
He as ApplyDataDialog,
|
|
500
|
-
Ct as JcSearch,
|
|
501
|
-
Et as default
|
|
502
|
-
};
|