inl-ui 0.1.133 → 0.1.135

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/README.md CHANGED
@@ -1,49 +1,49 @@
1
- # 工业PC ui库
2
-
3
- 前端通用库,包括组件、hooks、utils等。
4
-
5
- ### 运行
6
-
7
- + 开发模式 yarn dev
8
- + 生产打包 yarn build
9
- + 生成文档 yarn build:docs
10
- + 打包图扑工具 yarn buildtp
11
-
12
- ### 使用方法
13
-
14
- ```javascript
15
- import inl from 'inl-ui';
16
- import 'inl-ui/dist/style.css';
17
-
18
- vue.use(inl)
19
- ```
20
-
21
-
22
-
23
- ### 激活主题
24
-
25
- **vite.config.ts**
26
-
27
- ```javascript
28
- const additionalData = require("inl-ui/dist/theme").default;
29
-
30
- ...
31
-
32
- css: {
33
- preprocessorOptions: {
34
- less: {
35
- javascriptEnabled: true,
36
- additionalData,
37
- },
38
- },
39
- },
40
- ```
41
-
42
- ### 文档链接
43
-
44
- ##### [组件文档](./src/components/README.md)
45
-
46
- ##### [hooks文档](./src/hooks/README.md)
47
-
48
- ##### [Utils文档](./src/utils/README.md)
49
-
1
+ # 工业PC ui库
2
+
3
+ 前端通用库,包括组件、hooks、utils等。
4
+
5
+ ### 运行
6
+
7
+ + 开发模式 yarn dev
8
+ + 生产打包 yarn build
9
+ + 生成文档 yarn build:docs
10
+ + 打包图扑工具 yarn buildtp
11
+
12
+ ### 使用方法
13
+
14
+ ```javascript
15
+ import inl from 'inl-ui';
16
+ import 'inl-ui/dist/style.css';
17
+
18
+ vue.use(inl)
19
+ ```
20
+
21
+
22
+
23
+ ### 激活主题
24
+
25
+ **vite.config.ts**
26
+
27
+ ```javascript
28
+ const additionalData = require("inl-ui/dist/theme").default;
29
+
30
+ ...
31
+
32
+ css: {
33
+ preprocessorOptions: {
34
+ less: {
35
+ javascriptEnabled: true,
36
+ additionalData,
37
+ },
38
+ },
39
+ },
40
+ ```
41
+
42
+ ### 文档链接
43
+
44
+ ##### [组件文档](./src/components/README.md)
45
+
46
+ ##### [hooks文档](./src/hooks/README.md)
47
+
48
+ ##### [Utils文档](./src/utils/README.md)
49
+
@@ -13,7 +13,6 @@ var qiankun = require('qiankun');
13
13
  var dayjs = require('dayjs');
14
14
  require('vite-plugin-qiankun');
15
15
  var renderWithQiankun = require('vite-plugin-qiankun/dist/helper');
16
- var mqtt = require('mqtt');
17
16
  var mobile = require('@sszj-temp/mobile');
18
17
  var marked = require('marked');
19
18
 
@@ -40,7 +39,6 @@ function _interopNamespace(e) {
40
39
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios$2);
41
40
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
42
41
  var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
43
- var mqtt__default = /*#__PURE__*/_interopDefaultLegacy(mqtt);
44
42
 
45
43
  const config = {
46
44
  prefix: "inl",
@@ -7044,6 +7042,7 @@ const PageContent = vue.defineComponent({
7044
7042
  }
7045
7043
  };
7046
7044
  const handleMenuChange = (val, isFromMenu = false) => {
7045
+ console.log("handleMenuChange", val);
7047
7046
  if (!val) return;
7048
7047
  const routeQuery = {
7049
7048
  ...route.query
@@ -9641,33 +9640,6 @@ var Tree = vue.defineComponent({
9641
9640
  }
9642
9641
  });
9643
9642
 
9644
- let client = null;
9645
- const ip = "10.255.9.121";
9646
- let connectUrl = `ws://${ip}:8083/mqtt`;
9647
- const useMqtt = async (options = {}) => {
9648
- if (client) {
9649
- return client;
9650
- }
9651
- return new Promise(async (resolve, reject) => {
9652
- const mqttOptions = {
9653
- url: connectUrl,
9654
- clientId: `llm_${new Date().getTime()}`,
9655
- username: "admin",
9656
- password: "admin123",
9657
- ...options
9658
- };
9659
- client = mqtt__default["default"].connect(connectUrl, mqttOptions);
9660
- client.on("connect", () => {
9661
- console.log("\u8FDE\u63A5\u6210\u529F");
9662
- resolve(client);
9663
- });
9664
- client.on("error", err => {
9665
- console.log("\u8FDE\u63A5\u5931\u8D25", err);
9666
- reject(err);
9667
- });
9668
- });
9669
- };
9670
-
9671
9643
  const props$6 = {
9672
9644
  // 视频信息|视频源uuid
9673
9645
  camera: {
@@ -9685,7 +9657,7 @@ const props$6 = {
9685
9657
  // },
9686
9658
  btns: {
9687
9659
  type: Array,
9688
- default: ["vlm", "change", "fill", "look", "stream", "magnify", "direction", "fullScreen", "close"]
9660
+ default: ["change", "fill", "look", "stream", "magnify", "direction", "fullScreen", "close"]
9689
9661
  },
9690
9662
  alarm: {
9691
9663
  default: false,
@@ -9703,13 +9675,11 @@ const VideoBoxV2 = vue.defineComponent({
9703
9675
  },
9704
9676
  emits: ["close", "change"],
9705
9677
  setup(_prop, _context) {
9706
- const videoBoxRef = vue.ref();
9707
9678
  const player = vue.ref();
9708
9679
  const cameraConfig = vue.ref({});
9709
9680
  const streamHistory = vue.ref("");
9710
9681
  const streams = vue.ref([]);
9711
9682
  const showInfo = vue.ref(true);
9712
- const showVlmInfo = vue.ref(true);
9713
9683
  const magnifyBtn = vue.ref(false);
9714
9684
  const videoBtns = [[{
9715
9685
  text: "lup",
@@ -9738,7 +9708,6 @@ const VideoBoxV2 = vue.defineComponent({
9738
9708
  }]];
9739
9709
  const infos = vue.ref([]);
9740
9710
  const uuid = vue.ref(UUID());
9741
- let Mqtt = null;
9742
9711
  vue.onMounted(() => {
9743
9712
  showInfo.value = _prop.showInfo;
9744
9713
  });
@@ -9816,26 +9785,10 @@ const VideoBoxV2 = vue.defineComponent({
9816
9785
  });
9817
9786
  camera.value = res.data.data;
9818
9787
  streams.value = JSON.parse(camera.value?.brandTypePo?.streamTypeDict || "[]");
9819
- console.log("vlmSwitchKey.value", vlmSwitchKey.value);
9820
- console.log("localStorage.getItem(vlmSwitchKey.value)", localStorage.getItem(vlmSwitchKey.value));
9821
- clearFlogCanvas();
9822
- if (localStorage.getItem(vlmSwitchKey.value) !== "false") {
9823
- showVlmInfo.value = true;
9824
- if (camera.value?.ip && showVlmInfo.value) {
9825
- initMqtt(camera.value?.ip);
9826
- }
9827
- } else {
9828
- showVlmInfo.value = false;
9829
- }
9830
9788
  };
9831
9789
  let timeout;
9832
9790
  vue.ref(true);
9833
- vue.onBeforeUnmount(() => {
9834
- if (Mqtt) {
9835
- Mqtt?.unsubscribe(topic.value);
9836
- Mqtt = null;
9837
- }
9838
- });
9791
+ vue.onBeforeUnmount(() => {});
9839
9792
  const resetZoom = () => {
9840
9793
  const chooseFieldDom = document.getElementById("chooseField_" + uuid.value);
9841
9794
  chooseFieldDom?.remove();
@@ -9949,11 +9902,6 @@ const VideoBoxV2 = vue.defineComponent({
9949
9902
  }
9950
9903
  };
9951
9904
  vue.watch(() => _prop.camera, val => {
9952
- if (Mqtt) {
9953
- console.log(`\u53D6\u6D88\u8BA2\u9605:${topic.value}`);
9954
- Mqtt?.unsubscribe(topic.value);
9955
- Mqtt = null;
9956
- }
9957
9905
  if (val && Object.keys(val).length != 0) {
9958
9906
  setNewCamera(val);
9959
9907
  }
@@ -10000,170 +9948,9 @@ const VideoBoxV2 = vue.defineComponent({
10000
9948
  }, null) : ""])]
10001
9949
  });
10002
9950
  };
10003
- const topic = vue.ref("");
10004
- const {
10005
- isFullscreen,
10006
- enter,
10007
- exit,
10008
- toggle
10009
- } = core.useFullscreen(videoBoxRef);
10010
- vue.watch(() => isFullscreen.value, val => {
10011
- clearFlogCanvas();
10012
- });
10013
- const initMqtt = async ip => {
10014
- Mqtt = await useMqtt();
10015
- topic.value = `vlm/${ip}`;
10016
- Mqtt.subscribe(topic.value, {
10017
- qos: 2
10018
- }, err => {
10019
- if (!err) {
10020
- console.log(`\u8BA2\u9605\u6210\u529F\u4E3B\u9898:${topic.value}`);
10021
- } else {
10022
- console.log(`\u8BA2\u9605\u5931\u8D25:${err}`);
10023
- }
10024
- });
10025
- Mqtt.on("message", onMtMessageFn);
10026
- };
10027
- const onMtMessageFn = (topicStr, message2) => {
10028
- if (topicStr !== topic.value) {
10029
- return;
10030
- }
10031
- const msg = new TextDecoder("utf-8").decode(message2);
10032
- console.log("msg", JSON.parse(msg));
10033
- drawFlog(JSON.parse(msg));
10034
- };
10035
- let canvasDom = null;
10036
- let textBox = null;
10037
- const createFlogCanvas = async () => {
10038
- await vue.nextTick();
10039
- const box = document.getElementById("videoBox_" + uuid.value);
10040
- if (!box) {
10041
- return {
10042
- canvas: null,
10043
- textBox: null,
10044
- width: 0,
10045
- height: 0
10046
- };
10047
- }
10048
- if (!canvasDom) {
10049
- canvasDom = document.createElement("canvas");
10050
- canvasDom.id = "canvas_" + uuid.value;
10051
- canvasDom.width = box.offsetWidth;
10052
- canvasDom.height = box.offsetHeight;
10053
- canvasDom.style.position = "absolute";
10054
- canvasDom.style.top = "0";
10055
- canvasDom.style.left = "0";
10056
- canvasDom.style.zIndex = "999";
10057
- canvasDom.style.pointerEvents = "none";
10058
- box.appendChild(canvasDom);
10059
- }
10060
- if (!textBox) {
10061
- textBox = document.createElement("div");
10062
- textBox.id = "textBox_" + uuid.value;
10063
- textBox.style.position = "absolute";
10064
- textBox.style.width = "100%";
10065
- textBox.style.left = "0";
10066
- textBox.style.zIndex = "1000";
10067
- textBox.style.pointerEvents = "none";
10068
- box.appendChild(textBox);
10069
- }
10070
- return {
10071
- canvasDom,
10072
- textBox,
10073
- width: box.offsetWidth,
10074
- height: box.offsetHeight
10075
- };
10076
- };
10077
- const clearFlogCanvas = () => {
10078
- if (canvasDom) {
10079
- canvasDom.remove();
10080
- canvasDom = null;
10081
- }
10082
- if (textBox) {
10083
- textBox.remove();
10084
- textBox = null;
10085
- }
10086
- if (drawCleanTimer) {
10087
- clearTimeout(drawCleanTimer);
10088
- drawCleanTimer = null;
10089
- }
10090
- };
10091
- let drawCleanTimer = null;
10092
- const drawFlog = async data => {
10093
- let {
10094
- canvasDom: canvasDom2,
10095
- width,
10096
- height,
10097
- textBox: textBox2
10098
- } = await createFlogCanvas();
10099
- if (!canvasDom2) {
10100
- return;
10101
- }
10102
- const ctx = canvasDom2.getContext("2d");
10103
- if (drawCleanTimer) {
10104
- clearTimeout(drawCleanTimer);
10105
- ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
10106
- }
10107
- if (data.bboxes?.length > 0) {
10108
- (data.bboxes || []).forEach(rect => {
10109
- ctx.beginPath();
10110
- ctx.lineWidth = 2;
10111
- ctx.strokeStyle = rect.color || "red";
10112
- ctx.fillStyle = rect.color || "red";
10113
- ctx.rect(rect.xmin * width, rect.ymin * height, (rect.xmax - rect.xmin) * width, (rect.ymax - rect.ymin) * height);
10114
- ctx.stroke();
10115
- });
10116
- }
10117
- if (data.text) {
10118
- const fontSize = 16 * width / 800;
10119
- const margin = 10;
10120
- const marginTop = height * 0.1 + margin;
10121
- textBox2.innerHTML = data.text;
10122
- textBox2.style.top = marginTop + "px";
10123
- textBox2.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
10124
- textBox2.style.color = data.text_color || "red";
10125
- textBox2.style.fontSize = `${fontSize}px`;
10126
- textBox2.style.padding = `${margin}px`;
10127
- } else {
10128
- removeTxtBox();
10129
- }
10130
- drawCleanTimer = setTimeout(() => {
10131
- ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
10132
- removeTxtBox();
10133
- }, data.seconds * 1e3);
10134
- };
10135
- const removeTxtBox = () => {
10136
- textBox.innerHTML = "";
10137
- textBox.remove();
10138
- textBox = null;
10139
- };
10140
- const vlmSwitchKey = vue.computed(() => {
10141
- return `showVlmInfo_${camera.value?.uuid}`;
10142
- });
10143
- vue.watchEffect(async () => {
10144
- if (showVlmInfo.value) {
10145
- localStorage.removeItem(vlmSwitchKey.value);
10146
- } else {
10147
- localStorage.setItem(vlmSwitchKey.value, "false");
10148
- let {
10149
- canvasDom: canvasDom2,
10150
- textBox: textBox2,
10151
- width,
10152
- height
10153
- } = await createFlogCanvas();
10154
- if (!canvasDom2) {
10155
- return;
10156
- }
10157
- const ctx = canvasDom2.getContext("2d");
10158
- clearTimeout(drawCleanTimer);
10159
- removeTxtBox();
10160
- ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
10161
- }
10162
- });
10163
9951
  return () => vue.createVNode("div", {
10164
9952
  "id": "videoBox_" + uuid.value,
10165
- "class": ["videoBox", _prop.alarm ? "alarm" : ""],
10166
- "ref": videoBoxRef
9953
+ "class": ["videoBox", _prop.alarm ? "alarm" : ""]
10167
9954
  }, [camera.value ? vue.createVNode(VideoPlayerV2, {
10168
9955
  "ref": player,
10169
9956
  "domId": uuid.value,
@@ -10206,7 +9993,7 @@ const VideoBoxV2 = vue.defineComponent({
10206
9993
  }, [vue.createVNode("div", null, [info.name ? `${info.name}\uFF1A` : ""]), vue.createVNode("div", {
10207
9994
  "class": "value"
10208
9995
  }, [info.displayValue && info.displayValue !== "null" ? info.displayValue + " " : ""]), vue.createVNode("div", null, [info.unit])]);
10209
- })]) : "", vue.withDirectives(vue.createVNode("div", {
9996
+ })]) : "", vue.createVNode("div", {
10210
9997
  "class": "footer-min",
10211
9998
  "id": "footer_" + uuid.value
10212
9999
  }, [vue.createVNode("div", {
@@ -10217,20 +10004,6 @@ const VideoBoxV2 = vue.defineComponent({
10217
10004
  }, [_prop.btns.map(btn => {
10218
10005
  if (!(camera.value?.brandTypeCode === "MP4" && btn !== "close" && btn !== "fullScreen" && btn !== "look" && btn !== "change")) {
10219
10006
  switch (btn) {
10220
- case "vlm":
10221
- return vue.createVNode("img", {
10222
- "title": "\u6253\u5F00/\u5173\u95ED\u591A\u6A21\u6001",
10223
- "onClick": e => {
10224
- showVlmInfo.value = !showVlmInfo.value;
10225
- if (showVlmInfo.value) {
10226
- initMqtt(camera.value?.ip);
10227
- } else {
10228
- Mqtt?.unsubscribe(topic.value);
10229
- Mqtt = null;
10230
- }
10231
- },
10232
- "src": showVlmInfo.value ? "/micro-assets/inl/video/controls/ai-show.svg" : "/micro-assets/inl/video/controls/ai-hide.svg"
10233
- }, null);
10234
10007
  case "change":
10235
10008
  return vue.createVNode("img", {
10236
10009
  "title": "\u66F4\u6362\u6444\u50CF\u5934",
@@ -10352,7 +10125,7 @@ const VideoBoxV2 = vue.defineComponent({
10352
10125
  return vue.createVNode("img", {
10353
10126
  "onClick": e => {
10354
10127
  e.stopPropagation();
10355
- toggle();
10128
+ player.value.videoFull();
10356
10129
  },
10357
10130
  "src": "/micro-assets/inl/video/putUp.png"
10358
10131
  }, null);
@@ -10365,7 +10138,7 @@ const VideoBoxV2 = vue.defineComponent({
10365
10138
  }, null);
10366
10139
  }
10367
10140
  }
10368
- })])]), [[vue.vShow, !isFullscreen.value]]), renderChangeCamera()]);
10141
+ })])]), renderChangeCamera()]);
10369
10142
  }
10370
10143
  });
10371
10144
  var VideoBoxV2$1 = installComponent(VideoBoxV2, "video-box-v2");