urit-qf-ui 0.1.2 → 0.1.3
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/dist/index.js +3 -2
- package/dist/index.umd.cjs +1 -1
- package/dist/qf/interface.d.ts +0 -1
- package/dist/qf/qf.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -61180,13 +61180,14 @@ const sh = "Notice", Joe = "NOTICE", Uu = {
|
|
|
61180
61180
|
Error: "error"
|
|
61181
61181
|
}, Zoe = "v1.00.26911.B01";
|
|
61182
61182
|
class xae {
|
|
61183
|
-
constructor() {
|
|
61183
|
+
constructor(t) {
|
|
61184
61184
|
ht(this, "EventBus");
|
|
61185
61185
|
ht(this, "WebApi");
|
|
61186
61186
|
ht(this, "Mqtt");
|
|
61187
61187
|
ht(this, "options");
|
|
61188
|
+
this.startQf(t);
|
|
61188
61189
|
}
|
|
61189
|
-
|
|
61190
|
+
startQf(t) {
|
|
61190
61191
|
if (!t)
|
|
61191
61192
|
throw new Error(`StartQf failed! options is ${t}`);
|
|
61192
61193
|
this.options = t, console.log("StartQf() qf version = " + Zoe), this.EventBus = new zne(), this.WebApi = new Vne(t), console.log("product", window.location), this.options.useMqtt && (this.Mqtt = new Qoe(this.EventBus, t)), console.log("options = ", t);
|
package/dist/index.umd.cjs
CHANGED
|
@@ -90,4 +90,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
90
90
|
|
|
91
91
|
@babel/runtime/helpers/regenerator.js:
|
|
92
92
|
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
|
|
93
|
-
*/class Hne{constructor(n,r){Ge(this,"mqttClient",null);Ge(this,"eventBus");this.eventBus=n,this.connect(r).then()}async connect(n){const r={username:n.userName,password:n.password,clientId:`${n.module}_${this.randomStr(10)}`,clean:!0,keepalive:n.keepAlive||50,connectTimeout:5e3,reconnectPeriod:n.reconnectPeriod||5e3};let o=n.mqttUrl||"ws://127.0.0.1:5002/ws";if(console.log("mqtt connect url = ",o),this.mqttClient=Wne.connect(o,r),!this.mqttClient){console.log("connect mqtt failed");return}this.mqttClient.on("connect",()=>{console.log("=====> mqtt connect success!"),this.mqttClient.subscribe(Ny,{qos:0},a=>{console.log(a?`mqtt subscribe [${Ny}] failed`:`mqtt subscribe [${Ny}] success`)})}),this.mqttClient.on("message",(a,s)=>{const l=s.toString();if(!l){console.error("Received empty message",a);return}let i=null;try{i=JSON.parse(l)}catch(c){console.error("Failed to parse message JSON",a,l,c);return}if(!i||i.Content===void 0||i.Content===null||!i.PType){console.log("parse notice failed!",l);return}i.PType==Kne&&this.eventBus.Emit(i.Route,i.Content)}),this.mqttClient.on(iu.OffLine,()=>{console.log("mqtt offline...")}),this.mqttClient.on(iu.Reconnect,()=>{console.log("mqtt reconnecting...")}),this.mqttClient.on(iu.Close,()=>{console.log("mqtt close")}),this.mqttClient.on(iu.Error,a=>{console.log("mqtt error")})}randomStr(n){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let o="";for(let a=0;a<n;a++)o+=r.charAt(Math.floor(Math.random()*r.length));return o}}const Ny="Notice",Kne="NOTICE",iu={OffLine:"offline",Close:"close",Reconnect:"reconnect",Error:"error"},qne="v1.00.26911.B01";class Yne{constructor(){Ge(this,"EventBus");Ge(this,"WebApi");Ge(this,"Mqtt");Ge(this,"options")}
|
|
93
|
+
*/class Hne{constructor(n,r){Ge(this,"mqttClient",null);Ge(this,"eventBus");this.eventBus=n,this.connect(r).then()}async connect(n){const r={username:n.userName,password:n.password,clientId:`${n.module}_${this.randomStr(10)}`,clean:!0,keepalive:n.keepAlive||50,connectTimeout:5e3,reconnectPeriod:n.reconnectPeriod||5e3};let o=n.mqttUrl||"ws://127.0.0.1:5002/ws";if(console.log("mqtt connect url = ",o),this.mqttClient=Wne.connect(o,r),!this.mqttClient){console.log("connect mqtt failed");return}this.mqttClient.on("connect",()=>{console.log("=====> mqtt connect success!"),this.mqttClient.subscribe(Ny,{qos:0},a=>{console.log(a?`mqtt subscribe [${Ny}] failed`:`mqtt subscribe [${Ny}] success`)})}),this.mqttClient.on("message",(a,s)=>{const l=s.toString();if(!l){console.error("Received empty message",a);return}let i=null;try{i=JSON.parse(l)}catch(c){console.error("Failed to parse message JSON",a,l,c);return}if(!i||i.Content===void 0||i.Content===null||!i.PType){console.log("parse notice failed!",l);return}i.PType==Kne&&this.eventBus.Emit(i.Route,i.Content)}),this.mqttClient.on(iu.OffLine,()=>{console.log("mqtt offline...")}),this.mqttClient.on(iu.Reconnect,()=>{console.log("mqtt reconnecting...")}),this.mqttClient.on(iu.Close,()=>{console.log("mqtt close")}),this.mqttClient.on(iu.Error,a=>{console.log("mqtt error")})}randomStr(n){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let o="";for(let a=0;a<n;a++)o+=r.charAt(Math.floor(Math.random()*r.length));return o}}const Ny="Notice",Kne="NOTICE",iu={OffLine:"offline",Close:"close",Reconnect:"reconnect",Error:"error"},qne="v1.00.26911.B01";class Yne{constructor(n){Ge(this,"EventBus");Ge(this,"WebApi");Ge(this,"Mqtt");Ge(this,"options");this.startQf(n)}startQf(n){if(!n)throw new Error(`StartQf failed! options is ${n}`);this.options=n,console.log("StartQf() qf version = "+qne),this.EventBus=new Mee,this.WebApi=new Pee(n),console.log("product",window.location),this.options.useMqtt&&(this.Mqtt=new Hne(this.EventBus,n)),console.log("options = ",n)}On(n,r){this.EventBus.On(n,r)}Emit(n,r){this.EventBus.Emit(n,r)}Off(n,r){this.EventBus.Off(n,r)}Post(n,r){return this.WebApi.Post(n,r)}Get(n,r){return this.WebApi.Get(n,r)}Delete(n,r){return this.WebApi.Delete(n,r)}Put(n,r){return this.WebApi.Put(n,r)}Download(n,r){return this.WebApi.Download(n,r)}RegNotice(n,r){this.EventBus.On(n,r)}}const Gne={UInput:Il,UDict:$l,UToggle:dm,UCascader:um,UDate:ui,FormRender:fm,TableRender:cN,UFieldView:Bd},Xne={install(t){t.use(xQ);for(const[n,r]of Object.entries(Gne))t.component(n,r)}};gt.FormRender=fm,gt.Qf=Yne,gt.TableRender=cN,gt.UCascader=um,gt.UDate=ui,gt.UDict=$l,gt.UFieldView=Bd,gt.UInput=Il,gt.UToggle=dm,gt.default=Xne,gt.notify=ro,gt.notifyUtil=Dl,Object.defineProperties(gt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/qf/interface.d.ts
CHANGED
package/dist/qf/qf.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export declare class Qf implements QfInterface {
|
|
|
7
7
|
WebApi: Http;
|
|
8
8
|
Mqtt: MqttAdapter;
|
|
9
9
|
options: QfOptions;
|
|
10
|
-
constructor();
|
|
11
|
-
|
|
10
|
+
constructor(options: QfOptions);
|
|
11
|
+
startQf(options: QfOptions): void;
|
|
12
12
|
On(event: string, callback: any): void;
|
|
13
13
|
Emit(event: string, data: any): void;
|
|
14
14
|
Off(event: string, callback: any): void;
|