@cpzxrobot/sdk 1.2.46 → 1.2.47

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/camera_gateway.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Unit, Camera } from ".";
1
+ import { Cpzxrobot, type Unit, type Camera } from ".";
2
2
 
3
3
  export class CameraGateway extends Object {
4
4
  context: Cpzxrobot;
package/car_gateway.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Factory } from ".";
1
+ import { Cpzxrobot, type Factory } from ".";
2
2
 
3
3
  export class CarGateway extends Object {
4
4
  context: Cpzxrobot;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Cpzxrobot,
3
- Factory,
3
+ type Factory,
4
4
  } from "./types";
5
5
 
6
6
  export class ChickenFarmGateway extends Object {
package/device_filter.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, DataQueryArgs } from ".";
1
+ import { Cpzxrobot, type DataQueryArgs } from ".";
2
2
  import type { AxiosResponse } from "axios";
3
3
  import { FieldDatas, SensorDatas } from "./sensor_datas";
4
4
 
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Unit, DeviceType } from "."
1
+ import { Cpzxrobot, type Unit,type DeviceType } from "."
2
2
 
3
3
  //缓存设备类型数据
4
4
  export class DeviceTypeGateway {
@@ -2,8 +2,8 @@ import {
2
2
  type FodderOrderList,
3
3
  type FeedTower,
4
4
  type FeedTowerExtraInfo,
5
- DataQueryArgs,
6
- FeedTowerV2,
5
+ type DataQueryArgs,
6
+ type FeedTowerV2,
7
7
  } from "..";
8
8
  import { DeviceFilter } from "../device_filter";
9
9
 
@@ -1,4 +1,4 @@
1
- import { Device } from "..";
1
+ import { type Device } from "..";
2
2
  import { DeviceFilter } from "../device_filter";
3
3
 
4
4
  //适配常见设备类型
package/dist/index.js CHANGED
@@ -392,22 +392,23 @@ class Cpzxrobot {
392
392
  }
393
393
  this.resolveReady(this.axios);
394
394
  });
395
- //load www.cpzxrobot.com/web_components.js as web components
396
- // const script = document.createElement("script");
397
- // script.src = "https://www.cpzxrobot.com/web_components.js";
398
- // document.body.appendChild(script);
399
- // //insert cpzxrobot_web_components into body
400
- // const div = document.createElement("cpzxrobot_web_components");
401
- // document.body.appendChild(div);
402
- // //register onUnitChanged and onFactoryChanged on div
403
- // div.addEventListener("unitChanged", function (e: any) {
404
- // // @ts-ignore
405
- // window._notifyUnitChanged(e.detail);
406
- // });
407
- // div.addEventListener("factoryChanged", function (e: any) {
408
- // // @ts-ignore
409
- // window._notifyFactoryChanged(e.detail);
410
- // });
395
+ // load www.cpzxrobot.com/web_components.js as web components
396
+ const script = document.createElement("script");
397
+ script.src = "https://www.cpzxrobot.com/webc/factory_selector.js";
398
+ document.body.appendChild(script);
399
+ //insert cpzxrobot_factory_selector into body
400
+ const div = document.createElement("cpzxrobot_factory_selector");
401
+ div.setAttribute("selector-style", "float-button");
402
+ document.body.appendChild(div);
403
+ //register onUnitChanged and onFactoryChanged on div
404
+ div.addEventListener("unitChanged", function (e) {
405
+ // @ts-ignore
406
+ window._notifyUnitChanged(e.detail);
407
+ });
408
+ div.addEventListener("factoryChanged", function (e) {
409
+ // @ts-ignore
410
+ window._notifyFactoryChanged(e.detail);
411
+ });
411
412
  return;
412
413
  }
413
414
  else {
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Factory } from "./types";
1
+ import { Cpzxrobot, type Factory } from "./types";
2
2
 
3
3
  export class FactoryGateway extends Object {
4
4
  _selectedFarm: Factory = {
package/index.ts CHANGED
@@ -443,22 +443,23 @@ export class Cpzxrobot {
443
443
  }
444
444
  this.resolveReady(this.axios);
445
445
  });
446
- //load www.cpzxrobot.com/web_components.js as web components
447
- // const script = document.createElement("script");
448
- // script.src = "https://www.cpzxrobot.com/web_components.js";
449
- // document.body.appendChild(script);
450
- // //insert cpzxrobot_web_components into body
451
- // const div = document.createElement("cpzxrobot_web_components");
452
- // document.body.appendChild(div);
453
- // //register onUnitChanged and onFactoryChanged on div
454
- // div.addEventListener("unitChanged", function (e: any) {
455
- // // @ts-ignore
456
- // window._notifyUnitChanged(e.detail);
457
- // });
458
- // div.addEventListener("factoryChanged", function (e: any) {
459
- // // @ts-ignore
460
- // window._notifyFactoryChanged(e.detail);
461
- // });
446
+ // load www.cpzxrobot.com/web_components.js as web components
447
+ const script = document.createElement("script");
448
+ script.src = "https://www.cpzxrobot.com/webc/factory_selector.js";
449
+ document.body.appendChild(script);
450
+ //insert cpzxrobot_factory_selector into body
451
+ const div = document.createElement("cpzxrobot_factory_selector");
452
+ div.setAttribute("selector-style","float-button")
453
+ document.body.appendChild(div);
454
+ //register onUnitChanged and onFactoryChanged on div
455
+ div.addEventListener("unitChanged", function (e: any) {
456
+ // @ts-ignore
457
+ window._notifyUnitChanged(e.detail);
458
+ });
459
+ div.addEventListener("factoryChanged", function (e: any) {
460
+ // @ts-ignore
461
+ window._notifyFactoryChanged(e.detail);
462
+ });
462
463
  return;
463
464
  } else {
464
465
  //if url has access_token and app_code, use it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.46",
3
+ "version": "1.2.47",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Cpzxrobot,
3
- DeviceConfig,
4
- Factory,
5
- HeatLamp,
6
- Unit,
7
- WeightMeter,
8
- WeightMeterSensor,
9
- weightMeterSensorsConfig,
3
+ type DeviceConfig,
4
+ type Factory,
5
+ type HeatLamp,
6
+ type Unit,
7
+ type WeightMeter,
8
+ type WeightMeterSensor,
9
+ type weightMeterSensorsConfig,
10
10
  } from ".";
11
11
 
12
12
  export class PigfarmGateway extends Object {
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, FodderOrder } from ".";
1
+ import { Cpzxrobot, type FodderOrder } from ".";
2
2
 
3
3
  export class TransportGateway extends Object {
4
4
  _selectedFarm: string = "";
package/unit_gateway.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Unit } from "./types";
1
+ import { Cpzxrobot, type Unit } from "./types";
2
2
 
3
3
  export class UnitGateway extends Object {
4
4
  context: Cpzxrobot;
package/user_gateway.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Factory, Unit } from "./types";
1
+ import { Cpzxrobot, type Factory,type Unit } from "./types";
2
2
 
3
3
  export class UserGateway extends Object {
4
4
  _selectedFarm: Factory = {