@ray-js/ipc-player-integration 0.0.42 → 0.0.43-beta.1

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.
@@ -5,6 +5,55 @@
5
5
  "css_prefix_text": "icon-panel-",
6
6
  "description": "IPC 小程序公版",
7
7
  "glyphs": [
8
+ {
9
+ "icon_id": "47934817",
10
+ "name": "绿叶",
11
+ "font_class": "lvye1",
12
+ "unicode": "e6ce",
13
+ "unicode_decimal": 59086
14
+ },
15
+ {
16
+ "icon_id": "47934689",
17
+ "name": "绿叶",
18
+ "font_class": "lvye",
19
+ "unicode": "e6cd",
20
+ "unicode_decimal": 59085
21
+ },
22
+ {
23
+ "icon_id": "47917149",
24
+ "name": "植物记录",
25
+ "font_class": "zhiwujilu",
26
+ "unicode": "e6cc",
27
+ "unicode_decimal": 59084
28
+ },
29
+ {
30
+ "icon_id": "47915428",
31
+ "name": "水位",
32
+ "font_class": "shuiwei",
33
+ "unicode": "e6c8",
34
+ "unicode_decimal": 59080
35
+ },
36
+ {
37
+ "icon_id": "47915429",
38
+ "name": "EC值",
39
+ "font_class": "ECzhi",
40
+ "unicode": "e6c9",
41
+ "unicode_decimal": 59081
42
+ },
43
+ {
44
+ "icon_id": "47915427",
45
+ "name": "灯光",
46
+ "font_class": "dengguang",
47
+ "unicode": "e6ca",
48
+ "unicode_decimal": 59082
49
+ },
50
+ {
51
+ "icon_id": "47915426",
52
+ "name": "总开关",
53
+ "font_class": "zongkaiguan",
54
+ "unicode": "e6cb",
55
+ "unicode_decimal": 59083
56
+ },
8
57
  {
9
58
  "icon_id": "47777351",
10
59
  "name": "智能画质-关闭",
Binary file
Binary file
Binary file
@@ -2,6 +2,8 @@ export declare const TEMP_UNIT_SELECT = "temp_unit_select";
2
2
  export declare const TEMP_REPORT_F = "temp_report_f";
3
3
  export declare const SENSOR_TEMPERATURE = "sensor_temperature";
4
4
  export declare const SENSOR_HUMIDITY = "sensor_humidity";
5
+ export declare const IPC_EC = "ipc_ec";
6
+ export declare const IPC_WATER_TEMPERATURE = "ipc_water_temperature";
5
7
  export declare const PTZ_CONTROL = "ptz_control";
6
8
  export declare const GUN_BALL = "ipc_multi_locate_coor";
7
9
  export declare const ZOOM_CONTROL = "zoom_control";
@@ -6,6 +6,10 @@ export const SENSOR_TEMPERATURE = 'sensor_temperature'; // 摄氏度
6
6
 
7
7
  export const SENSOR_HUMIDITY = 'sensor_humidity'; // 湿度
8
8
 
9
+ export const IPC_EC = 'ipc_ec'; // EC 值(电导率)
10
+
11
+ export const IPC_WATER_TEMPERATURE = 'ipc_water_temperature'; // 水温
12
+
9
13
  export const PTZ_CONTROL = 'ptz_control'; // ptz
10
14
 
11
15
  export const GUN_BALL = 'ipc_multi_locate_coor'; // 旧枪球联动-定位器
@@ -1,8 +1,12 @@
1
- import React from 'react';
1
+ import "core-js/modules/esnext.iterator.constructor.js";
2
+ import "core-js/modules/esnext.iterator.map.js";
3
+ import React, { useMemo } from 'react';
2
4
  import { View, Text } from '@ray-js/ray';
3
5
  import clsx from 'clsx';
4
- import { useTemperature, useHumidity } from '../../hooks';
6
+ import { useTemperature, useHumidity, useEc, useWaterTemperature, useDpSupport } from '../../hooks';
7
+ import { IPC_EC, IPC_WATER_TEMPERATURE, SENSOR_HUMIDITY, SENSOR_TEMPERATURE } from '../../utils/content/dpCode';
5
8
  import './tempHumidity.less';
9
+ const DP_CODES = [IPC_EC, SENSOR_TEMPERATURE, SENSOR_HUMIDITY, IPC_WATER_TEMPERATURE];
6
10
  export const TempHumidity = props => {
7
11
  const {
8
12
  className,
@@ -14,48 +18,61 @@ export const TempHumidity = props => {
14
18
  tempF
15
19
  } = useTemperature(devId);
16
20
  const humidity = useHumidity(devId);
17
- const tempRender = () => {
18
- if (tempUnit === '1' && tempF) {
19
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
20
- className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-temperature"
21
- }), /*#__PURE__*/React.createElement(Text, {
22
- className: "tempHumidity"
23
- }, tempF));
21
+ const ec = useEc(devId);
22
+ const waterTemp = useWaterTemperature(devId);
23
+ const dpSupport = useDpSupport({
24
+ devId,
25
+ dpCodes: [...DP_CODES]
26
+ });
27
+ const items = useMemo(() => {
28
+ const list = [];
29
+ if (dpSupport[IPC_EC]) {
30
+ list.push({
31
+ key: 'ec',
32
+ iconClass: 'icon-panel-ECzhi',
33
+ text: ec || '--'
34
+ });
24
35
  }
25
- if (tempC) {
26
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
27
- className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-temperature"
28
- }), /*#__PURE__*/React.createElement(Text, null, tempC));
36
+ if (dpSupport[SENSOR_TEMPERATURE]) {
37
+ const tempText = tempUnit === '1' && tempF ? tempF : tempC || '--';
38
+ list.push({
39
+ key: 'temp',
40
+ iconClass: 'icon-panel-temperature',
41
+ text: tempText
42
+ });
29
43
  }
30
- return null;
31
- };
32
- const humRender = () => {
33
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
34
- className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-humidity"
35
- }), /*#__PURE__*/React.createElement(Text, {
36
- className: "tempHumidity"
37
- }, `${humidity}`));
38
- };
39
- // 当无值时返回null
40
- if (!tempC && !tempF && !humidity) {
44
+ if (dpSupport[SENSOR_HUMIDITY]) {
45
+ list.push({
46
+ key: 'humidity',
47
+ iconClass: 'icon-panel-humidity',
48
+ text: humidity || '--'
49
+ });
50
+ }
51
+ if (dpSupport[IPC_WATER_TEMPERATURE]) {
52
+ list.push({
53
+ key: 'waterTemp',
54
+ iconClass: 'icon-panel-lvye1',
55
+ text: waterTemp || '--'
56
+ });
57
+ }
58
+ return list;
59
+ }, [dpSupport, ec, tempUnit, tempF, tempC, humidity, waterTemp]);
60
+ if (!items.length) {
41
61
  return null;
42
62
  }
43
63
  return /*#__PURE__*/React.createElement(View, {
44
64
  className: clsx(className)
45
65
  }, /*#__PURE__*/React.createElement(View, {
46
66
  className: clsx('ipc-player-plugin-tempHumidity')
47
- }, (() => {
48
- if ((tempC || tempUnit === '1' && tempF) && humidity) {
49
- return /*#__PURE__*/React.createElement(React.Fragment, null, tempRender(), /*#__PURE__*/React.createElement(View, {
50
- className: "ipc-player-plugin-tempHumidity-divider"
51
- }), humRender());
52
- }
53
- if (tempC || tempUnit === '1' && tempF) {
54
- return /*#__PURE__*/React.createElement(React.Fragment, null, tempRender());
55
- }
56
- if (humidity) {
57
- return /*#__PURE__*/React.createElement(React.Fragment, null, humRender());
58
- }
59
- return null;
60
- })()));
67
+ }, items.map((item, index) => /*#__PURE__*/React.createElement(React.Fragment, {
68
+ key: item.key
69
+ }, index > 0 && /*#__PURE__*/React.createElement(View, {
70
+ className: "ipc-player-plugin-tempHumidity-divider"
71
+ }), /*#__PURE__*/React.createElement(View, {
72
+ className: "ipc-player-plugin-tempHumidity-item"
73
+ }, /*#__PURE__*/React.createElement(Text, {
74
+ className: clsx('ipc-player-plugin-tempHumidity-text-icon', 'icon-panel', item.iconClass)
75
+ }), /*#__PURE__*/React.createElement(Text, {
76
+ className: "tempHumidity"
77
+ }, item.text))))));
61
78
  };
@@ -10,6 +10,11 @@
10
10
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
11
11
  }
12
12
 
13
+ .ipc-player-plugin-tempHumidity-item {
14
+ display: flex;
15
+ align-items: center;
16
+ }
17
+
13
18
  .ipc-player-plugin-tempHumidity-divider {
14
19
  margin: calc(6px * var(--ipc-player-size-scale, 1));
15
20
  color: rgba(0,0,0,0.2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.42",
3
+ "version": "0.0.43-beta.1",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [