@gaidalou/control 1.0.17 → 1.0.18

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.
@@ -106,6 +106,6 @@ onmessage = (e) =>{
106
106
  `;const Xc=class Xc{static init(n){return this.instance==null&&(this.instance=new Xc(n)),this.instance}constructor(n){let o="",r="",a=!1;n&&(o=n.namePreFix,r=n.serviceUUIDs,a=n.testModel),this.mitt=As.init(),this.name=o,this.services=r,this.testModel=a,this.device=null,this.deviceName="",this.server=null,this.allServices=null,this.webBleInfos=[],this.webBleInfosObj={},this.version=Vl[0],this.worker=null,this.soundAddEndTime=null,this.soundDiffTime=600}async getDevice(){this.device=await navigator.bluetooth.requestDevice({filters:[{namePrefix:this.name},{services:this.services}]}),this.deviceName=this.device.gatt.device.name}async connect(){this.server=await this.device.gatt.connect()}async getAllServers(){this.allServices=await this.server.getPrimaryServices()}async getAllCharacters(n){let o=null;for await(const r of this.allServices){let a=await this.server.getPrimaryService(r.uuid);o={uuid:r.uuid,service:a,children:[]};let l=await a.getCharacteristics();for await(const s of l){let i=await a.getCharacteristic(s.uuid),c={uuid:s.uuid,characteristic:i,children:[]};o.children.push(c);let d=s.uuid.split("-")[0],u=i;this.webBleInfosObj[d]=u,i.properties.notify&&await this.listening(i)}}if(this.webBleInfos.push(o),n){let{back:r}=n;r&&r()}}listening(n){return new Promise(o=>{new TextDecoder,n.addEventListener("characteristicvaluechanged",r=>{let a=r.target.value;this.testModel&&console.log("blue 接受的数据receivedData",a);let l=ka(),s=new Uint8Array(a.buffer),i=new Int8Array(a.buffer),c=Ik[s[4]],d=s[5],u="";if(c==="sendToYaoKongQi")return;c==="key"&&d===255&&(this.version=Vl[s[6]]);let f=l.getBlueNum({version:this.version,type:c,code:d});if(f.type==="action")if(Dk.some(y=>y===f.value))if(f.value==="remoteIntercom"||f.value==="realTimeShouting"){if(!this.worker){const y=new Blob([Ak],{type:"application/javascript"});let h=URL.createObjectURL(y);this.worker=new Worker(h,{type:"module"}),this.worker.onmessage=async g=>{this.worker&&(this.worker.terminate(),this.worker=null);let p=g.data;this.mitt.bus.emit("blueSend",{version:this.version,type:c,code:d,value:p,source:"bluetooth"}),this.soundAddEndTime=null}}this.soundAddEndTime?(u=s.slice(6),this.worker.postMessage({soundValue:u,source:"bluetooth",isEnd:!1})):this.soundAddEndTime=new Date().getTime(),this.soundTimer&&clearTimeout(this.soundTimer),this.soundTimer=setTimeout(()=>{this.worker.postMessage({isEnd:!0})},this.soundDiffTime);return}else u=s[6];else Rk.some(y=>y===f.value)&&(u=i[6]);c==="key"&&d===255&&u===""||(this.testModel&&console.log("<===blue 接收的数据 类型 type==>",c,`\r
107
107
  <===命令code decodedString==>`,d,`\r
108
108
  <===命令value type==>`,u,`\r
109
- <===版本heart version==>`,this.version),this.mitt.bus.emit("blueSend",{version:this.version,type:c,code:d,value:u,source:"bluetooth"}))}),n.startNotifications().then(()=>{o()}).catch(r=>{r.message.indexOf("unknown reason"),o()}).finally(()=>{o()})})}send(n){let{characteristic:o,value:r}=n;if(!o)return;const a=new Uint8Array([90,168,0,6,0,3,20,248,192,0,0,0,0,0,0,0,0,0,0]);o.writeValue(a)}static async sendMsg(n){let o=this.init({namePreFix:Mk,serviceUUIDs:Ok}),{characteristic:r,value:a}=n,l=o.webBleInfosObj[r];if(!l)return;const s=new Uint8Array(a);await l.writeValue(s)}async getVal(n){let{characteristic:o}=n;if(!o)return;let r=await o.readValue();new TextDecoder().decode(r)}async disconnect(n){if(this.server&&this.server.connected&&(await this.server.disconnect(),this.webBleInfos=[],n)){let{back:o}=n;o&&o()}}static async destory(n){this.instance&&(await this.instance.disconnect(n),this.instance.webBleInfosObj={},this.instance.device=null,this.instance.deviceName="",this.instance.server=null,this.instance.allServices=null,this.instance.webBleInfos=[],this.instance=null)}};Il(Xc,"instance",null);let Cr=Xc;const Zc=class Zc{static init(n){return this.instance==null&&(this.instance=new Zc(n)),this.instance}constructor(n){let o=!1;n&&(o=n.testModel),this.testModel=o,this.serialPort=null,this.reader=null,this.mitt=As.init(),this.firstAudio=!0,this.version=Vl[0],this.timerLongData=null,this.timerLongDataFlag=null,this.worker=null,this.soundAddEndTime=null,this.soundDiffTime=600}async connect(n){try{if(this.serialPort=await navigator.serial.requestPort(),n){let{back:a}=n;a&&a()}let o=9600;await this.serialPort.open({baudRate:o}),await this.serialPort.close(),await this.serialPort.open({baudRate:o});let r=new Uint8Array;for(this.reader=this.serialPort.readable.getReader();;){let{value:a,done:l}=await this.reader.read();if(l)break;let s=new Uint8Array(r.length+a.length);s.set(r,0),s.set(a,r.length),r=s,setTimeout(()=>{if(r.length>=19){let i=r[5];if(i===26||i===15){if(this.firstAudio){this.firstAudio=!1;let c=r.slice(0,19);r=r.slice(19),this.dataReceived(c)}else if(r.length>=262){let c=r.slice(0,262);r=r.slice(262),this.dataReceived(c)}}else{let c=r.slice(0,19);r=r.slice(19),this.dataReceived(c)}}},30)}}catch(o){console.error("出现错误:",o)}}dataReceived(n){let o=n,r=ka(),a=new Uint8Array(o.buffer),l=new Int8Array(o.buffer);this.testModel&&(console.log("usb 接受的数据 uint8Array==>",a),console.log("usb 接受的数据 int8Array==>",l));let s=Ik[a[4]],i=a[5],c="";if(s==="sendToYaoKongQi"||(s==="key"&&i===255&&(this.version=Vl[a[6]]),!s))return;let d=r.getBlueNum({version:this.version,type:s,code:i});if(d.type==="action")if(Dk.some(u=>u===d.value))if(d.value==="remoteIntercom"||d.value==="realTimeShouting"){if(!this.worker){const u=new Blob([Ak],{type:"application/javascript"});let f=URL.createObjectURL(u);this.worker=new Worker(f,{type:"module"}),this.worker.onmessage=async y=>{this.worker&&(this.worker.terminate(),this.worker=null),this.firstAudio=!0;let h=y.data;this.mitt.bus.emit("blueSend",{version:this.version,type:s,code:i,value:h,source:"bluetooth"}),this.soundAddEndTime=null}}this.soundAddEndTime?(c=a.slice(6),this.worker.postMessage({soundValue:c,source:"bluetooth",isEnd:!1})):this.soundAddEndTime=new Date().getTime(),this.soundTimer&&clearTimeout(this.soundTimer),this.soundTimer=setTimeout(()=>{this.worker.postMessage({isEnd:!0})},this.soundDiffTime);return}else c=a[6];else Rk.some(u=>u===d.value)&&(c=l[6]);s==="key"&&i===255&&c===""||(this.testModel&&console.log("<===usb 接收的数据 类型 type==>",s,`\r
109
+ <===版本heart version==>`,this.version),this.mitt.bus.emit("blueSend",{version:this.version,type:c,code:d,value:u,source:"bluetooth"}))}),n.startNotifications().then(()=>{o()}).catch(r=>{r.message.indexOf("unknown reason"),o()}).finally(()=>{o()})})}send(n){let{characteristic:o,value:r}=n;if(!o)return;const a=new Uint8Array([90,168,0,6,0,3,20,248,192,0,0,0,0,0,0,0,0,0,0]);o.writeValue(a)}static async sendMsg(n){let o=this.init({namePreFix:Mk,serviceUUIDs:Ok}),{characteristic:r,value:a}=n,l=o.webBleInfosObj[r];if(!l)return;const s=new Uint8Array(a);await l.writeValue(s)}async getVal(n){let{characteristic:o}=n;if(!o)return;let r=await o.readValue();new TextDecoder().decode(r)}async disconnect(n){if(this.server&&this.server.connected&&(await this.server.disconnect(),this.webBleInfos=[],n)){let{back:o}=n;o&&o()}}static async destory(n){this.instance&&(await this.instance.disconnect(n),this.instance.webBleInfosObj={},this.instance.device=null,this.instance.deviceName="",this.instance.server=null,this.instance.allServices=null,this.instance.webBleInfos=[],this.instance=null)}};Il(Xc,"instance",null);let Cr=Xc;const Zc=class Zc{static init(n){return this.instance==null&&(this.instance=new Zc(n)),this.instance}constructor(n){let o=!1;n&&(o=n.testModel),this.testModel=o,this.serialPort=null,this.reader=null,this.mitt=As.init(),this.firstAudio=!0,this.version=Vl[0],this.timerLongData=null,this.timerLongDataFlag=null,this.animationId=null,this.worker=null,this.soundAddEndTime=null,this.soundDiffTime=600}async connect(n){try{if(this.serialPort=await navigator.serial.requestPort(),n){let{back:r}=n;r&&r()}let o=9600;for(await this.serialPort.open({baudRate:o}),await this.serialPort.close(),await this.serialPort.open({baudRate:o}),this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.buffer=new Uint8Array,this.reader=this.serialPort.readable.getReader(),this.autoHandle();;){let{value:r}=await this.reader.read(),a=new Uint8Array(this.buffer.length+r.length);if(a.set(this.buffer,0),a.set(r,this.buffer.length),this.buffer=a,this.buffer.length>=19){let l=this.buffer[5];if(l===26||l===15){if(this.firstAudio){this.firstAudio=!1;let s=this.buffer.slice(0,19);this.buffer=this.buffer.slice(19),this.dataReceived(s)}else if(this.buffer.length>=262){let s=this.buffer.slice(0,262);this.buffer=this.buffer.slice(262),this.dataReceived(s)}}else{let s=this.buffer.slice(0,19);this.buffer=this.buffer.slice(19),this.dataReceived(s)}}}}catch(o){console.error("出现错误:",o)}}autoHandle(){if(this.buffer.length>=19){let n=this.buffer[5];if(n===26||n===15){if(this.firstAudio){this.firstAudio=!1;let o=this.buffer.slice(0,19);this.buffer=this.buffer.slice(19),this.dataReceived(o)}else if(this.buffer.length>=262){let o=this.buffer.slice(0,262);this.buffer=this.buffer.slice(262),this.dataReceived(o)}}else{let o=this.buffer.slice(0,19);this.buffer=this.buffer.slice(19),this.dataReceived(o)}}this.animationId=requestAnimationFrame(this.autoHandle.bind(this))}dataReceived(n){let o=n,r=ka(),a=new Uint8Array(o.buffer),l=new Int8Array(o.buffer);this.testModel&&(console.log("usb 接受的数据 uint8Array==>",a),console.log("usb 接受的数据 int8Array==>",l));let s=Ik[a[4]],i=a[5],c="";if(s==="sendToYaoKongQi"||(s==="key"&&i===255&&(this.version=Vl[a[6]]),!s))return;let d=r.getBlueNum({version:this.version,type:s,code:i});if(d.type==="action")if(Dk.some(u=>u===d.value))if(d.value==="remoteIntercom"||d.value==="realTimeShouting"){if(!this.worker){const u=new Blob([Ak],{type:"application/javascript"});let f=URL.createObjectURL(u);this.worker=new Worker(f,{type:"module"}),this.worker.onmessage=async y=>{this.worker&&(this.worker.terminate(),this.worker=null),this.firstAudio=!0;let h=y.data;this.mitt.bus.emit("blueSend",{version:this.version,type:s,code:i,value:h,source:"bluetooth"}),this.soundAddEndTime=null}}this.soundAddEndTime?(c=a.slice(6),this.worker.postMessage({soundValue:c,source:"bluetooth",isEnd:!1})):this.soundAddEndTime=new Date().getTime(),this.soundTimer&&clearTimeout(this.soundTimer),this.soundTimer=setTimeout(()=>{this.worker.postMessage({isEnd:!0})},this.soundDiffTime);return}else c=a[6];else Rk.some(u=>u===d.value)&&(c=l[6]);s==="key"&&i===255&&c===""||(this.testModel&&console.log("<===usb 接收的数据 类型 type==>",s,`\r
110
110
  <===命令code decodedString==>`,i,`\r
111
111
  <===命令value type==>`,c),this.mitt.bus.emit("blueSend",{version:this.version,type:s,code:i,value:c,source:"usb"}))}static async sendMsg(n){try{if(!this.instance)return;let o=this.instance.serialPort.writable.getWriter(),{value:r}=n;await o.write(new Uint8Array(r)),o.releaseLock()}catch(o){console.error("发送数据时出现错误:",o)}}async disconnect(n){if(this.serialPort.readable&&this.serialPort.readable.locked&&await this.reader.cancel(),await this.serialPort.close(),this.serialPort=null,this.reader=null,n){let{back:o}=n;o&&o()}}static async destory(n){this.instance&&(await this.instance.disconnect(n),this.instance=null)}};Il(Zc,"instance",null);let wr=Zc,zk=(t,n=2)=>{let o=null;if(isNaN(t)){let r=parseFloat(t);isNaN(r)?o=t:(r*=Math.pow(10,n),r=Math.round(r),o=r/Math.pow(10,n))}else t*=Math.pow(10,n),t=Math.round(t),o=t/Math.pow(10,n);return o};const Qc=class Qc{static init(){return this.instance==null&&(this.instance=new Qc),this.instance}constructor(){}async heart(){let o=new TextEncoder().encode(this.yunTaiName),a=Array.from(o).map(s=>s.toString(10).padStart(2,"0")).join(" ").split(" ");a=a.map(s=>zk(s,0));let l=[90,165,255,255,0,2,...a,248,192,0,0,0,0,0,0,0,0,0,0];await Cr.sendMsg({characteristic:"0000ff04",value:l}),await wr.sendMsg({value:l}),this.heartTimerStatus&&(this.heartTimer=setTimeout(async()=>{await this.heart()},1e3*60*10))}startHeart(){this.heartTimer&&clearInterval(this.heartTimer),this.heartTimerStatus=!0}unHeart(){this.heartTimerStatus=!1,this.heartTimer&&clearInterval(this.heartTimer)}numberToBytes(n){const o=n&255,r=n>>8&255;return[o,r]}async sendBlueYunTaiName(n){this.yunTaiName=n;let r=new TextEncoder().encode(n),l=Array.from(r).map(i=>i.toString(10).padStart(2,"0")).join(" ").split(" ");l=l.map(i=>zk(i,0));let s=[90,165,255,255,0,2,...l,248,192,0,0,0,0,0,0,0,0,0,0];await Cr.sendMsg({characteristic:"0000ff04",value:s}),await wr.sendMsg({value:s})}async sendBlueWenDu(n){let r=[90,165,0,6,0,3,...this.numberToBytes(n*10),248,192,0,0,0,0,0,0,0,0,0,0];await Cr.sendMsg({characteristic:"0000ff04",value:r}),await wr.sendMsg({value:r})}async sendBlueFengSu(n){let r=[90,165,0,6,0,5,...this.numberToBytes(n*10),248,192,0,0,0,0,0,0,0,0,0,0];await Cr.sendMsg({characteristic:"0000ff04",value:r}),await wr.sendMsg({value:r})}sendBlueUavHorizontalSpeed(n){}sendBlueUavVerticalSpeed(n){}sendToBlue(n){}sendBlueOneKeyTakeoffOk(n){}};Il(Qc,"instance",null);let zs=Qc;const Lk=(t,n)=>{const o=t.__vccOpts||t;for(const[r,a]of n)o[r]=a;return o},FK={class:"blue"},HK=["src"],jK=["src"],KK=Lk(Object.assign({name:"Bluetooth"},{__name:"index",props:["blueIcon","tipStatus","blueLinkText","blueDisconnectText","testModel"],setup(t,{expose:n}){let o=t,r=Hc.create(),a=ka(),{blueScanBtnShow:l,usbScanBtnShow:s,selectLinkText:i}=Gp(a),c=null,d=null;async function u(){c=Cr.init({namePreFix:Mk,serviceUUIDs:Ok,testModel:o.testModel}),await c.getDevice(),await c.connect(),await c.getAllServers();let y=e.toRaw(i.value);try{await c.getAllCharacters({back:async()=>{await wr.destory({back:async()=>{s.value=!1}}),d=zs.init(),d.unHeart(),l.value=!0,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.blueLinkText?o.blueLinkText:"操作台设备已上线(蓝牙)"}),i.value="蓝牙连接",setTimeout(async()=>{d.startHeart(),await d.heart()},1e3*3)}})}catch{r.customTip({message:!0,type:"error",content:"操作台设备(蓝牙)连接失败,请重新连接"}),i.value=y}}function f(){Fp.confirm("确定断开操作台设备吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{await Cr.destory({back:()=>{l.value=!1,c=null,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.blueDisconnectText?o.blueDisconnectText:"操作台设备已下线"}),i.value="请选择",d&&d.unHeart()}})}).catch(()=>{r.customTip({message:!0,type:"info",content:"已取消"})})}return n({scan:u,disconnect:f}),e.onMounted(()=>{}),e.onUnmounted(()=>{d&&d.unHeart()}),(y,h)=>{const g=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",FK,[e.unref(l)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"scanBlue",onClick:f},[e.renderSlot(y.$slots,"link",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"断开蓝牙操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothWorking",src:t.blueIcon,alt:""},null,8,jK)]),_:1})],!0)])):(e.openBlock(),e.createElementBlock("div",{key:0,class:"scanBlue",onClick:u},[e.renderSlot(y.$slots,"unlink",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"链接蓝牙操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothUnWorking",src:t.blueIcon,alt:""},null,8,HK)]),_:1})],!0)]))])}}}),[["__scopeId","data-v-2cf4c214"]]),WK={class:"blue"},UK=["src"],qK=["src"],YK=Lk(Object.assign({name:"Webusb"},{__name:"index",props:["usbIcon","tipStatus","usbLinkText","usbDisconnectText","testModel"],setup(t,{expose:n}){let o=t,r=Hc.create(),a=ka(),{blueScanBtnShow:l,usbScanBtnShow:s,selectLinkText:i}=Gp(a),c=null,d=null;async function u(){c=wr.init({testModel:o.testModel}),await c.connect({back:async()=>{await Cr.destory({back:async()=>{l.value=!1}}),d=zs.init(),d.unHeart(),s.value=!0,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.usbLinkText?o.usbLinkText:"操作台设备已上线(USB)"}),i.value="USB连接",setTimeout(async()=>{d.startHeart(),await d.heart()},1e3*3)}})}async function f(){Fp.confirm("确定断开操作台设备吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{await wr.destory({back:()=>{s.value=!1,c=null,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.usbDisconnectText?o.usbDisconnectText:"操作台设备已下线"}),i.value="请选择",d&&d.unHeart()}})}).catch(()=>{r.customTip({message:!0,type:"info",content:"已取消"})})}return e.onMounted(()=>{}),e.onUnmounted(()=>{d&&d.unHeart()}),n({scan:u,disconnect:f}),(y,h)=>{const g=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",WK,[e.unref(s)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"scanBlue",onClick:f},[e.renderSlot(y.$slots,"link",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"断开usb操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothWorking",src:t.usbIcon,alt:""},null,8,qK)]),_:1})],!0)])):(e.openBlock(),e.createElementBlock("div",{key:0,class:"scanBlue",onClick:u},[e.renderSlot(y.$slots,"unlink",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"链接usb操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothUnWorking",src:t.usbIcon,alt:""},null,8,UK)]),_:1})],!0)]))])}}}),[["__scopeId","data-v-4d6b4997"]]),GK={__name:"index",props:{write:{type:Object,default:()=>[{wind:0}]}},emits:["message"],setup(t,{expose:n,emit:o}){let r=t,a=o;ka();let l=zs.init(),s=async u=>{a("message",u)},i=u=>{let f=!1;return u?(Object.keys(u).length==0?f=!0:f=!1,f):!0};e.watch(()=>r.write,()=>{i(r.write)||r.write&&r.write.value&&l.sendBlueFengSu(r.write.value)});let c=async u=>{i(u)||(u.deviceName&&u.deviceName.value&&await l.sendBlueYunTaiName(u.deviceName.value),u.wind&&u.wind.value!==null&&await l.sendBlueFengSu(u.wind.value),u.temperature&&u.temperature.value!==null&&await l.sendBlueWenDu(u.temperature.value))},d=null;return e.onMounted(()=>{d=As.init(),d.has({type:"blueSend",fnName:"blueSend_homePage_control"})||d.bus.on("blueSend",s)}),e.onUnmounted(()=>{d.bus.off("blueSend",s)}),n({sendMessage:c}),(u,f)=>(e.openBlock(),e.createElementBlock("div"))}},XK="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAVCAYAAABCIB6VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDI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18fwIh8wgOMGKJ3TxvcCavQ6j6TUsOGbzod5ftCl3nb+7mfpPIJLPMHnDnDIBzxq4Hls4RTbObVOOsGr1KMEL+ILFtB3ywMplRq2hJdN2nv42AUqNYHp5PIrO95H/anMbil21P+Fe3L776P0qHpTt9OlP873fZcy0vfPUkzwBj7gXf457pJtCyu/AVEyOYhfPAHKAAAAAElFTkSuQmCC",$l=Object.assign({name:"ControlIndex"},{__name:"controlIndex",props:["write","blueIcon","usbIcon","tipStatus","testModel","blueLinkText","blueDisconnectText","usbLinkText","usbDisconnectText"],emits:["message"],setup(t,{expose:n,emit:o}){let r=ka(),{blueScanBtnShow:a,usbScanBtnShow:l,selectLinkText:s}=Gp(r),i=()=>ka,c=e.ref(null),d=e.ref(null),u=e.ref(null),f=t,y=o,h=e.computed(()=>f.tipStatus!==void 0||f.tipStatus!==null?f.tipStatus:!0),g=e.computed(()=>f.blueIcon?f.blueIcon:XK),p=e.computed(()=>f.usbIcon?f.usbIcon:ZK),w=e.computed(()=>f.testModel?f.testModel:!1),C=(v,V)=>{f.testModel&&console.log("item",v),y("message",v,V)};return n({sendMessage:v=>{u.value.sendMessage(v)},blueLink:()=>{c.value.scan()},blueDisconnect:()=>{c.value.disconnect()},usbLink:()=>{d.value.scan()},usbDisconnect:()=>{d.value.disconnect()},getLinkStatus:()=>({blueScanBtnShow:a.value,usbScanBtnShow:l.value,selectLinkText:s.value}),getBlueStore:i}),(v,V)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(KK,{blueIcon:e.unref(g),tipStatus:e.unref(h),blueLinkText:t.blueLinkText,blueDisconnectText:t.blueDisconnectText,testModel:e.unref(w),ref_key:"bluetoothRef",ref:c},{unlink:e.withCtx(()=>[e.renderSlot(v.$slots,"blueUnlink")]),link:e.withCtx(()=>[e.renderSlot(v.$slots,"blueLink")]),_:3},8,["blueIcon","tipStatus","blueLinkText","blueDisconnectText","testModel"]),e.createVNode(YK,{usbIcon:e.unref(p),tipStatus:e.unref(h),usbLinkText:t.usbLinkText,usbDisconnectText:t.usbDisconnectText,testModel:e.unref(w),ref_key:"usbRef",ref:d},{unlink:e.withCtx(()=>[e.renderSlot(v.$slots,"usbUnlink")]),link:e.withCtx(()=>[e.renderSlot(v.$slots,"usbLink")]),_:3},8,["usbIcon","tipStatus","usbLinkText","usbDisconnectText","testModel"]),e.createVNode(GK,{onMessage:e.unref(C),write:t.write,ref_key:"controlRef",ref:u},null,8,["onMessage","write"])]))}});$l.install=t=>{t.component($l.name,$l)};const QK={__name:"controlTest",setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode($l,{tipStatus:!0,blueLinkText:"blueLinkText",blueDisconnectText:"blueDisconnectText",usbLinkText:"usbLinkText",testModel:!0,usbDisconnectText:"usbDisconnectText"},{blueUnlink:e.withCtx(()=>o[0]||(o[0]=[e.createElementVNode("div",null," blueLink ",-1)])),blueLink:e.withCtx(()=>o[1]||(o[1]=[e.createElementVNode("div",null," blueUnlink ",-1)])),usbUnlink:e.withCtx(()=>o[2]||(o[2]=[e.createElementVNode("div",null," usbLink ",-1)])),usbLink:e.withCtx(()=>o[3]||(o[3]=[e.createElementVNode("div",null," usbUnlink ",-1)])),_:1})]))}},JK={__name:"App",setup(t){return(n,o)=>(e.openBlock(),e.createBlock(QK))}};/*! Element Plus v2.9.10 */var e7={name:"zh-cn",el:{breadcrumb:{label:"面包屑"},colorpicker:{confirm:"确定",clear:"清空",defaultLabel:"颜色选择器",description:"当前颜色 {color},按 Enter 键选择新颜色",alphaLabel:"选择透明度的值"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",dateTablePrompt:"使用方向键与 Enter 键可选择日期",monthTablePrompt:"使用方向键与 Enter 键可选择月份",yearTablePrompt:"使用方向键与 Enter 键可选择年份",selectedDate:"已选日期",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},weeksFull:{sun:"星期日",mon:"星期一",tue:"星期二",wed:"星期三",thu:"星期四",fri:"星期五",sat:"星期六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},inputNumber:{decrease:"减少数值",increase:"增加数值"},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},dropdown:{toggleDropdown:"切换下拉选项"},mention:{loading:"加载中"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",page:"页",prev:"上一页",next:"下一页",currentPage:"第 {pager} 页",prevPages:"向前 {pager} 页",nextPages:"向后 {pager} 页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},dialog:{close:"关闭此对话框"},drawer:{close:"关闭此对话框"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!",close:"关闭此对话框"},upload:{deleteTip:"按 Delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},slider:{defaultLabel:"滑块介于 {min} 至 {max}",defaultRangeStartLabel:"选择起始值",defaultRangeEndLabel:"选择结束值"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计"},tour:{next:"下一步",previous:"上一步",finish:"结束导览"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},carousel:{leftArrow:"上一张幻灯片",rightArrow:"下一张幻灯片",indicator:"幻灯片切换至索引 {index}"}}};function t7(t){return typeof t=="object"&&t!==null}function Fk(t,n){return t=t7(t)?t:Object.create(null),new Proxy(t,{get(o,r,a){return r==="key"?Reflect.get(o,r,a):Reflect.get(o,r,a)||Reflect.get(n,r,a)}})}function n7(t,n){return n.reduce((o,r)=>o==null?void 0:o[r],t)}function o7(t,n,o){return n.slice(0,-1).reduce((r,a)=>/^(__proto__)$/.test(a)?{}:r[a]=r[a]||{},t)[n[n.length-1]]=o,t}function r7(t,n){return n.reduce((o,r)=>{const a=r.split(".");return o7(o,a,n7(t,a))},{})}function a7(t,n){return o=>{var r;try{const{storage:a=localStorage,beforeRestore:l=void 0,afterRestore:s=void 0,serializer:i={serialize:JSON.stringify,deserialize:JSON.parse},key:c=n.$id,paths:d=null,debug:u=!1}=o;return{storage:a,beforeRestore:l,afterRestore:s,serializer:i,key:((r=t.key)!=null?r:f=>f)(typeof c=="string"?c:c(n.$id)),paths:d,debug:u}}catch(a){return o.debug&&console.error("[pinia-plugin-persistedstate]",a),null}}}function Hk(t,{storage:n,serializer:o,key:r,debug:a}){try{const l=n==null?void 0:n.getItem(r);l&&t.$patch(o==null?void 0:o.deserialize(l))}catch(l){a&&console.error("[pinia-plugin-persistedstate]",l)}}function jk(t,{storage:n,serializer:o,key:r,paths:a,debug:l}){try{const s=Array.isArray(a)?r7(t,a):t;n.setItem(r,o.serialize(s))}catch(s){l&&console.error("[pinia-plugin-persistedstate]",s)}}function l7(t={}){return n=>{const{auto:o=!1}=t,{options:{persist:r=o},store:a,pinia:l}=n;if(!r)return;if(!(a.$id in l.state.value)){const i=l._s.get(a.$id.replace("__hot:",""));i&&Promise.resolve().then(()=>i.$persist());return}const s=(Array.isArray(r)?r.map(i=>Fk(i,t)):[Fk(r,t)]).map(a7(t,a)).filter(Boolean);a.$persist=()=>{s.forEach(i=>{jk(a.$state,i)})},a.$hydrate=({runHooks:i=!0}={})=>{s.forEach(c=>{const{beforeRestore:d,afterRestore:u}=c;i&&(d==null||d(n)),Hk(a,c),i&&(u==null||u(n))})},s.forEach(i=>{const{beforeRestore:c,afterRestore:d}=i;c==null||c(n),Hk(a,i),d==null||d(n),a.$subscribe((u,f)=>{jk(f,i)},{detached:!0})})}}var s7=l7();let Kk=DK();Kk.use(s7);const Yc=e.createApp(JK);Yc.use(Kk),Yc.use(dK,{locale:e7}),Yc.mount("#app");const i7=Object.freeze(Object.defineProperty({__proto__:null,app:Yc},Symbol.toStringTag,{value:"Module"}));let c7=[$l],Wk=t=>{c7.forEach(n=>{t.component(n.name,n)})};const d7={install:Wk,Main:i7};zt.BoweeControl=$l,zt.default=d7,zt.install=Wk,Object.defineProperties(zt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaidalou/control",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Vue3 control component",
5
5
  "type": "module",
6
6
  "author": "Dalou Gai",