@ray-js/ipc-player-integration 0.0.44 → 0.0.45-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.
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/useEc/index.d.ts +1 -0
- package/lib/hooks/useEc/index.js +25 -0
- package/lib/hooks/useWaterTemperature/index.d.ts +1 -0
- package/lib/hooks/useWaterTemperature/index.js +23 -0
- package/lib/iconfont/iconfont.css +31 -3
- package/lib/iconfont/iconfont.js +8 -8
- package/lib/iconfont/iconfont.json +49 -0
- package/lib/iconfont/iconfont.ttf +0 -0
- package/lib/iconfont/iconfont.woff +0 -0
- package/lib/iconfont/iconfont.woff2 +0 -0
- package/lib/utils/content/dpCode.d.ts +2 -0
- package/lib/utils/content/dpCode.js +4 -0
- package/lib/widgets/tempHumidity/tempHumidity.js +57 -38
- package/lib/widgets/tempHumidity/tempHumidity.less +5 -0
- package/package.json +1 -1
|
@@ -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
|
|
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,63 @@ export const TempHumidity = props => {
|
|
|
14
18
|
tempF
|
|
15
19
|
} = useTemperature(devId);
|
|
16
20
|
const humidity = useHumidity(devId);
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const ec = useEc(devId);
|
|
22
|
+
const waterTemp = useWaterTemperature(devId);
|
|
23
|
+
// 稳定 dpCodes 引用,避免每次渲染都生成新数组导致 useDpSupport 内 getDeviceInfo 被反复触发
|
|
24
|
+
const dpCodes = useMemo(() => [...DP_CODES], []);
|
|
25
|
+
const dpSupport = useDpSupport({
|
|
26
|
+
devId,
|
|
27
|
+
dpCodes
|
|
28
|
+
});
|
|
29
|
+
const items = useMemo(() => {
|
|
30
|
+
const list = [];
|
|
31
|
+
if (dpSupport[IPC_EC]) {
|
|
32
|
+
list.push({
|
|
33
|
+
key: 'ec',
|
|
34
|
+
iconClass: 'icon-panel-ECzhi',
|
|
35
|
+
text: ec || '--'
|
|
36
|
+
});
|
|
24
37
|
}
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
38
|
+
if (dpSupport[SENSOR_TEMPERATURE]) {
|
|
39
|
+
const tempText = tempUnit === '1' && tempF ? tempF : tempC || '--';
|
|
40
|
+
list.push({
|
|
41
|
+
key: 'temp',
|
|
42
|
+
iconClass: 'icon-panel-temperature',
|
|
43
|
+
text: tempText
|
|
44
|
+
});
|
|
29
45
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
if (dpSupport[SENSOR_HUMIDITY]) {
|
|
47
|
+
list.push({
|
|
48
|
+
key: 'humidity',
|
|
49
|
+
iconClass: 'icon-panel-humidity',
|
|
50
|
+
text: humidity || '--'
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (dpSupport[IPC_WATER_TEMPERATURE]) {
|
|
54
|
+
list.push({
|
|
55
|
+
key: 'waterTemp',
|
|
56
|
+
iconClass: 'icon-panel-lvye1',
|
|
57
|
+
text: waterTemp || '--'
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return list;
|
|
61
|
+
}, [dpSupport, ec, tempUnit, tempF, tempC, humidity, waterTemp]);
|
|
62
|
+
if (!items.length) {
|
|
41
63
|
return null;
|
|
42
64
|
}
|
|
43
65
|
return /*#__PURE__*/React.createElement(View, {
|
|
44
66
|
className: clsx(className)
|
|
45
67
|
}, /*#__PURE__*/React.createElement(View, {
|
|
46
68
|
className: clsx('ipc-player-plugin-tempHumidity')
|
|
47
|
-
}, (() => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
})()));
|
|
69
|
+
}, items.map((item, index) => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
70
|
+
key: item.key
|
|
71
|
+
}, index > 0 && /*#__PURE__*/React.createElement(View, {
|
|
72
|
+
className: "ipc-player-plugin-tempHumidity-divider"
|
|
73
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
74
|
+
className: "ipc-player-plugin-tempHumidity-item"
|
|
75
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
76
|
+
className: clsx('ipc-player-plugin-tempHumidity-text-icon', 'icon-panel', item.iconClass)
|
|
77
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
78
|
+
className: "tempHumidity"
|
|
79
|
+
}, item.text))))));
|
|
61
80
|
};
|
|
@@ -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);
|