inl-ui 0.1.134 → 0.1.136

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",
@@ -7437,7 +7435,8 @@ const Layout = vue.defineComponent({
7437
7435
  emits: ["globalSearch", "personalCenter", "logout", "extraPage"],
7438
7436
  props: Props,
7439
7437
  setup(props, {
7440
- emit
7438
+ emit,
7439
+ expose
7441
7440
  }) {
7442
7441
  const route = vueRouter.useRoute();
7443
7442
  const qiankunState = vue.inject("qiankunState");
@@ -7471,9 +7470,16 @@ const Layout = vue.defineComponent({
7471
7470
  immediate: true,
7472
7471
  flush: "post"
7473
7472
  });
7473
+ const openNewTab = menu => {
7474
+ handleMenuSelect(menu);
7475
+ };
7476
+ expose({
7477
+ openNewTab
7478
+ });
7474
7479
  const currMenu = vue.ref();
7475
7480
  const handleMenuSelect = menu => {
7476
7481
  currMenu.value = menu;
7482
+ console.log("currMenu.value", currMenu.value);
7477
7483
  vue.nextTick(() => currMenu.value = void 0);
7478
7484
  };
7479
7485
  vue.onBeforeUnmount(() => {
@@ -8748,7 +8754,6 @@ const getDetailContainer = () => vue.defineComponent({
8748
8754
  refreshKey: Date.now(),
8749
8755
  id: dataId.value
8750
8756
  });
8751
- console.log("detailList.value", detailList.value);
8752
8757
  setTimeout(() => {
8753
8758
  if (Array.isArray(qiankunState.value.extraTabs)) {
8754
8759
  const extraTabs = [...qiankunState.value.extraTabs, tab];
@@ -9641,33 +9646,6 @@ var Tree = vue.defineComponent({
9641
9646
  }
9642
9647
  });
9643
9648
 
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
9649
  const props$6 = {
9672
9650
  // 视频信息|视频源uuid
9673
9651
  camera: {
@@ -9685,7 +9663,7 @@ const props$6 = {
9685
9663
  // },
9686
9664
  btns: {
9687
9665
  type: Array,
9688
- default: ["vlm", "change", "fill", "look", "stream", "magnify", "direction", "fullScreen", "close"]
9666
+ default: ["change", "fill", "look", "stream", "magnify", "direction", "fullScreen", "close"]
9689
9667
  },
9690
9668
  alarm: {
9691
9669
  default: false,
@@ -9703,13 +9681,11 @@ const VideoBoxV2 = vue.defineComponent({
9703
9681
  },
9704
9682
  emits: ["close", "change"],
9705
9683
  setup(_prop, _context) {
9706
- const videoBoxRef = vue.ref();
9707
9684
  const player = vue.ref();
9708
9685
  const cameraConfig = vue.ref({});
9709
9686
  const streamHistory = vue.ref("");
9710
9687
  const streams = vue.ref([]);
9711
9688
  const showInfo = vue.ref(true);
9712
- const showVlmInfo = vue.ref(true);
9713
9689
  const magnifyBtn = vue.ref(false);
9714
9690
  const videoBtns = [[{
9715
9691
  text: "lup",
@@ -9738,7 +9714,6 @@ const VideoBoxV2 = vue.defineComponent({
9738
9714
  }]];
9739
9715
  const infos = vue.ref([]);
9740
9716
  const uuid = vue.ref(UUID());
9741
- let Mqtt = null;
9742
9717
  vue.onMounted(() => {
9743
9718
  showInfo.value = _prop.showInfo;
9744
9719
  });
@@ -9816,26 +9791,10 @@ const VideoBoxV2 = vue.defineComponent({
9816
9791
  });
9817
9792
  camera.value = res.data.data;
9818
9793
  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
9794
  };
9831
9795
  let timeout;
9832
9796
  vue.ref(true);
9833
- vue.onBeforeUnmount(() => {
9834
- if (Mqtt) {
9835
- Mqtt?.unsubscribe(topic.value);
9836
- Mqtt = null;
9837
- }
9838
- });
9797
+ vue.onBeforeUnmount(() => {});
9839
9798
  const resetZoom = () => {
9840
9799
  const chooseFieldDom = document.getElementById("chooseField_" + uuid.value);
9841
9800
  chooseFieldDom?.remove();
@@ -9949,11 +9908,6 @@ const VideoBoxV2 = vue.defineComponent({
9949
9908
  }
9950
9909
  };
9951
9910
  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
9911
  if (val && Object.keys(val).length != 0) {
9958
9912
  setNewCamera(val);
9959
9913
  }
@@ -10000,169 +9954,9 @@ const VideoBoxV2 = vue.defineComponent({
10000
9954
  }, null) : ""])]
10001
9955
  });
10002
9956
  };
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.left = "0";
10065
- textBox.style.zIndex = "1000";
10066
- textBox.style.pointerEvents = "none";
10067
- box.appendChild(textBox);
10068
- }
10069
- return {
10070
- canvasDom,
10071
- textBox,
10072
- width: box.offsetWidth,
10073
- height: box.offsetHeight
10074
- };
10075
- };
10076
- const clearFlogCanvas = () => {
10077
- if (canvasDom) {
10078
- canvasDom.remove();
10079
- canvasDom = null;
10080
- }
10081
- if (textBox) {
10082
- textBox.remove();
10083
- textBox = null;
10084
- }
10085
- if (drawCleanTimer) {
10086
- clearTimeout(drawCleanTimer);
10087
- drawCleanTimer = null;
10088
- }
10089
- };
10090
- let drawCleanTimer = null;
10091
- const drawFlog = async data => {
10092
- let {
10093
- canvasDom: canvasDom2,
10094
- width,
10095
- height,
10096
- textBox: textBox2
10097
- } = await createFlogCanvas();
10098
- if (!canvasDom2) {
10099
- return;
10100
- }
10101
- const ctx = canvasDom2.getContext("2d");
10102
- if (drawCleanTimer) {
10103
- clearTimeout(drawCleanTimer);
10104
- ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
10105
- }
10106
- if (data.bboxes?.length > 0) {
10107
- (data.bboxes || []).forEach(rect => {
10108
- ctx.beginPath();
10109
- ctx.lineWidth = 2;
10110
- ctx.strokeStyle = rect.color || "red";
10111
- ctx.fillStyle = rect.color || "red";
10112
- ctx.rect(rect.xmin * width, rect.ymin * height, (rect.xmax - rect.xmin) * width, (rect.ymax - rect.ymin) * height);
10113
- ctx.stroke();
10114
- });
10115
- }
10116
- if (data.text) {
10117
- const fontSize = 16 * width / 800;
10118
- const margin = 10;
10119
- const marginTop = height * 0.1 + margin;
10120
- textBox2.innerHTML = data.text;
10121
- textBox2.style.top = marginTop + "px";
10122
- textBox2.style.backgroundColor = "rgba(255, 255, 255, 0.2)";
10123
- textBox2.style.color = data.text_color || "black";
10124
- textBox2.style.fontSize = `${fontSize}px`;
10125
- textBox2.style.padding = `${margin}px`;
10126
- } else {
10127
- removeTxtBox();
10128
- }
10129
- drawCleanTimer = setTimeout(() => {
10130
- ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
10131
- removeTxtBox();
10132
- }, data.seconds * 1e3);
10133
- };
10134
- const removeTxtBox = () => {
10135
- textBox.innerHTML = "";
10136
- textBox.remove();
10137
- textBox = null;
10138
- };
10139
- const vlmSwitchKey = vue.computed(() => {
10140
- return `showVlmInfo_${camera.value?.uuid}`;
10141
- });
10142
- vue.watchEffect(async () => {
10143
- if (showVlmInfo.value) {
10144
- localStorage.removeItem(vlmSwitchKey.value);
10145
- } else {
10146
- localStorage.setItem(vlmSwitchKey.value, "false");
10147
- let {
10148
- canvasDom: canvasDom2,
10149
- textBox: textBox2,
10150
- width,
10151
- height
10152
- } = await createFlogCanvas();
10153
- if (!canvasDom2) {
10154
- return;
10155
- }
10156
- const ctx = canvasDom2.getContext("2d");
10157
- clearTimeout(drawCleanTimer);
10158
- removeTxtBox();
10159
- ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
10160
- }
10161
- });
10162
9957
  return () => vue.createVNode("div", {
10163
9958
  "id": "videoBox_" + uuid.value,
10164
- "class": ["videoBox", _prop.alarm ? "alarm" : ""],
10165
- "ref": videoBoxRef
9959
+ "class": ["videoBox", _prop.alarm ? "alarm" : ""]
10166
9960
  }, [camera.value ? vue.createVNode(VideoPlayerV2, {
10167
9961
  "ref": player,
10168
9962
  "domId": uuid.value,
@@ -10205,7 +9999,7 @@ const VideoBoxV2 = vue.defineComponent({
10205
9999
  }, [vue.createVNode("div", null, [info.name ? `${info.name}\uFF1A` : ""]), vue.createVNode("div", {
10206
10000
  "class": "value"
10207
10001
  }, [info.displayValue && info.displayValue !== "null" ? info.displayValue + " " : ""]), vue.createVNode("div", null, [info.unit])]);
10208
- })]) : "", vue.withDirectives(vue.createVNode("div", {
10002
+ })]) : "", vue.createVNode("div", {
10209
10003
  "class": "footer-min",
10210
10004
  "id": "footer_" + uuid.value
10211
10005
  }, [vue.createVNode("div", {
@@ -10216,20 +10010,6 @@ const VideoBoxV2 = vue.defineComponent({
10216
10010
  }, [_prop.btns.map(btn => {
10217
10011
  if (!(camera.value?.brandTypeCode === "MP4" && btn !== "close" && btn !== "fullScreen" && btn !== "look" && btn !== "change")) {
10218
10012
  switch (btn) {
10219
- case "vlm":
10220
- return vue.createVNode("img", {
10221
- "title": "\u6253\u5F00/\u5173\u95ED\u591A\u6A21\u6001",
10222
- "onClick": e => {
10223
- showVlmInfo.value = !showVlmInfo.value;
10224
- if (showVlmInfo.value) {
10225
- initMqtt(camera.value?.ip);
10226
- } else {
10227
- Mqtt?.unsubscribe(topic.value);
10228
- Mqtt = null;
10229
- }
10230
- },
10231
- "src": showVlmInfo.value ? "/micro-assets/inl/video/controls/ai-show.svg" : "/micro-assets/inl/video/controls/ai-hide.svg"
10232
- }, null);
10233
10013
  case "change":
10234
10014
  return vue.createVNode("img", {
10235
10015
  "title": "\u66F4\u6362\u6444\u50CF\u5934",
@@ -10351,7 +10131,7 @@ const VideoBoxV2 = vue.defineComponent({
10351
10131
  return vue.createVNode("img", {
10352
10132
  "onClick": e => {
10353
10133
  e.stopPropagation();
10354
- toggle();
10134
+ player.value.videoFull();
10355
10135
  },
10356
10136
  "src": "/micro-assets/inl/video/putUp.png"
10357
10137
  }, null);
@@ -10364,7 +10144,7 @@ const VideoBoxV2 = vue.defineComponent({
10364
10144
  }, null);
10365
10145
  }
10366
10146
  }
10367
- })])]), [[vue.vShow, !isFullscreen.value]]), renderChangeCamera()]);
10147
+ })])]), renderChangeCamera()]);
10368
10148
  }
10369
10149
  });
10370
10150
  var VideoBoxV2$1 = installComponent(VideoBoxV2, "video-box-v2");