@ray-js/ipc-player-integration 0.0.43-beta.3 → 0.0.44

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,55 +5,6 @@
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
- },
57
8
  {
58
9
  "icon_id": "47777351",
59
10
  "name": "智能画质-关闭",
Binary file
Binary file
Binary file
@@ -2,8 +2,6 @@ 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";
7
5
  export declare const PTZ_CONTROL = "ptz_control";
8
6
  export declare const GUN_BALL = "ipc_multi_locate_coor";
9
7
  export declare const ZOOM_CONTROL = "zoom_control";
@@ -6,10 +6,6 @@ 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
-
13
9
  export const PTZ_CONTROL = 'ptz_control'; // ptz
14
10
 
15
11
  export const GUN_BALL = 'ipc_multi_locate_coor'; // 旧枪球联动-定位器
@@ -1,12 +1,8 @@
1
- import "core-js/modules/esnext.iterator.constructor.js";
2
- import "core-js/modules/esnext.iterator.map.js";
3
- import React, { useMemo } from 'react';
1
+ import React from 'react';
4
2
  import { View, Text } from '@ray-js/ray';
5
3
  import clsx from 'clsx';
6
- import { useTemperature, useHumidity, useEc, useWaterTemperature, useDpSupport } from '../../hooks';
7
- import { IPC_EC, IPC_WATER_TEMPERATURE, SENSOR_HUMIDITY, SENSOR_TEMPERATURE } from '../../utils/content/dpCode';
4
+ import { useTemperature, useHumidity } from '../../hooks';
8
5
  import './tempHumidity.less';
9
- const DP_CODES = [IPC_EC, SENSOR_TEMPERATURE, SENSOR_HUMIDITY, IPC_WATER_TEMPERATURE];
10
6
  export const TempHumidity = props => {
11
7
  const {
12
8
  className,
@@ -18,61 +14,48 @@ export const TempHumidity = props => {
18
14
  tempF
19
15
  } = useTemperature(devId);
20
16
  const humidity = useHumidity(devId);
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
- });
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));
35
24
  }
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
- });
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));
43
29
  }
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) {
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) {
61
41
  return null;
62
42
  }
63
43
  return /*#__PURE__*/React.createElement(View, {
64
44
  className: clsx(className)
65
45
  }, /*#__PURE__*/React.createElement(View, {
66
46
  className: clsx('ipc-player-plugin-tempHumidity')
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))))));
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
+ })()));
78
61
  };
@@ -10,11 +10,6 @@
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
-
18
13
  .ipc-player-plugin-tempHumidity-divider {
19
14
  margin: calc(6px * var(--ipc-player-size-scale, 1));
20
15
  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.43-beta.3",
3
+ "version": "0.0.44",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -38,7 +38,7 @@
38
38
  "@ray-js/direction-control": "^0.0.8",
39
39
  "@ray-js/ipc-ptz-zoom": "^0.0.3",
40
40
  "@ray-js/ray-ipc-player": "^2.1.3",
41
- "@ray-js/ray-ipc-utils": "^1.1.15",
41
+ "@ray-js/ray-ipc-utils": "^1.1.16",
42
42
  "@ray-js/svg": "0.2.0",
43
43
  "clsx": "^1.2.1",
44
44
  "color": "^5.0.2",
@@ -1 +0,0 @@
1
- export declare const useEc: (devId: string) => string;
@@ -1,25 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { useDpState } from '../useDpState';
3
- import { IPC_EC } from '../../utils/content/dpCode';
4
- import { showMathPowValue } from '../../utils/device';
5
- export const useEc = devId => {
6
- const [ec, setEc] = useState('');
7
- const [dpState, schemaObj] = useDpState({
8
- devId,
9
- dpCodes: [IPC_EC]
10
- });
11
- useEffect(() => {
12
- var _schema$property;
13
- if (dpState[IPC_EC] === undefined) {
14
- setEc('');
15
- return;
16
- }
17
- const schema = schemaObj === null || schemaObj === void 0 ? void 0 : schemaObj[IPC_EC];
18
- const scale = (schema === null || schema === void 0 || (_schema$property = schema.property) === null || _schema$property === void 0 ? void 0 : _schema$property.scale) || 0;
19
- // const unit = schema?.property?.unit || 'μS/cm';
20
- const value = showMathPowValue(dpState[IPC_EC], scale);
21
- // EC 值始终以整数形式展示(showMathPowValue 在 scale !== 0 时会保留一位小数,如 "0.0")
22
- setEc(`${Math.round(Number(value))}`);
23
- }, [dpState, schemaObj]);
24
- return ec;
25
- };
@@ -1 +0,0 @@
1
- export declare const useWaterTemperature: (devId: string) => string;
@@ -1,23 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { useDpState } from '../useDpState';
3
- import { IPC_WATER_TEMPERATURE } from '../../utils/content/dpCode';
4
- import { showMathPowValue } from '../../utils/device';
5
- export const useWaterTemperature = devId => {
6
- const [waterTemp, setWaterTemp] = useState('');
7
- const [dpState, schemaObj] = useDpState({
8
- devId,
9
- dpCodes: [IPC_WATER_TEMPERATURE]
10
- });
11
- useEffect(() => {
12
- var _schema$property;
13
- if (dpState[IPC_WATER_TEMPERATURE] === undefined) {
14
- setWaterTemp('');
15
- return;
16
- }
17
- const schema = schemaObj === null || schemaObj === void 0 ? void 0 : schemaObj[IPC_WATER_TEMPERATURE];
18
- const scale = (schema === null || schema === void 0 || (_schema$property = schema.property) === null || _schema$property === void 0 ? void 0 : _schema$property.scale) || 0;
19
- const value = showMathPowValue(dpState[IPC_WATER_TEMPERATURE], scale);
20
- setWaterTemp(`${value}°C`);
21
- }, [dpState, schemaObj]);
22
- return waterTemp;
23
- };