@eohjsc/react-native-smart-city 0.4.41 → 0.4.42
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/android/build.gradle +24 -19
- package/package.json +12 -14
- package/src/commons/Action/ItemQuickAction.js +0 -1
- package/src/commons/ActionGroup/ColorPickerTemplate.js +4 -3
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +2 -2
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +5 -4
- package/src/commons/ActionGroup/OnOffTemplate/SwitchButtonTemplate.js +4 -4
- package/src/commons/ActionGroup/OnOffTemplate/index.js +5 -6
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +4 -4
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +17 -6
- package/src/commons/ActionGroup/SliderRangeTemplate.js +3 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +7 -7
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +20 -6
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonTemplate.test.js +6 -6
- package/src/commons/ActionGroup/ThreeButtonTemplate/index.js +2 -2
- package/src/commons/ActionGroup/TimerActionTemplate.js +2 -3
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +135 -133
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +14 -37
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +31 -71
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +11 -11
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +17 -13
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +48 -44
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +22 -56
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +21 -123
- package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +16 -12
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +38 -73
- package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +15 -11
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +15 -11
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +9 -9
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +31 -21
- package/src/commons/ActionGroup/__test__/index.test.js +21 -36
- package/src/commons/ActionGroup/index.js +7 -4
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +5 -0
- package/src/commons/Dashboard/MyUnit/index.js +2 -2
- package/src/commons/DateTimeRangeChange/index.js +3 -3
- package/src/commons/Device/HistoryChart.js +1 -1
- package/src/commons/Device/HorizontalBarChart.js +4 -3
- package/src/commons/Device/LinearChart.js +5 -3
- package/src/commons/FlatListDnD/__test__/index.test.js +25 -27
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +22 -1
- package/src/commons/HeaderAni/index.js +2 -12
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +23 -1
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +3 -5
- package/src/commons/Processing/index.js +0 -1
- package/src/commons/Processing/styles.js +0 -3
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +0 -1
- package/src/commons/Unit/HeaderUnit/index.js +8 -15
- package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +289 -0
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +59 -1
- package/src/configs/AccessibilityLabel.js +0 -1
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +51 -52
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +2 -3
- package/src/hooks/useMqtt.js +2 -5
- package/src/iot/mqtt.js +0 -2
- package/src/navigations/UnitStack.js +2 -2
- package/src/screens/AddNewGateway/ConnectingDevice.js +2 -2
- package/src/screens/AddNewGateway/ShareWifiPassword.js +2 -2
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +32 -31
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +2 -19
- package/src/screens/Automate/AddNewAction/__test__/{SetupConfigCondition.test.js → SetupSensor.test.js} +0 -97
- package/src/screens/Automate/EditActionsList/__tests__/index.test.js +68 -69
- package/src/screens/ChangePosition/__test__/index.test.js +32 -34
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +11 -1
- package/src/screens/Device/__test__/detail.test.js +45 -40
- package/src/screens/Device/__test__/sensorDisplayItem.test.js +2 -14
- package/src/screens/Device/components/ChartWrapper.js +12 -14
- package/src/screens/Device/components/SensorDisplayItem.js +2 -18
- package/src/screens/Device/components/VisualChart.js +3 -17
- package/src/screens/Device/components/__test__/VisualChart.test.js +15 -12
- package/src/screens/Device/detail.js +15 -34
- package/src/screens/Device/hooks/__test__/useEvaluateValue.test.js +18 -20
- package/src/screens/Device/styles.js +0 -3
- package/src/screens/Sharing/MemberList.js +3 -16
- package/src/screens/Sharing/__test__/SelectPermission.test.js +137 -96
- package/src/screens/Template/__test__/EditTemplate.test.js +45 -48
- package/src/screens/Unit/SelectAddToFavorites.js +0 -1
- package/src/screens/Unit/__test__/SelectAddress.test.js +11 -4
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +11 -1
- package/src/utils/Apis/axios.js +0 -1
- package/src/utils/I18n/translations/en.js +0 -2
- package/src/utils/I18n/translations/vi.js +0 -2
- package/src/utils/Monitor.js +2 -2
- package/src/commons/Highcharts/index.js +0 -111
- package/src/commons/icon/index.js +0 -57
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import WebView from 'react-native-webview';
|
|
3
|
-
|
|
4
|
-
const Highcharts = (props) => {
|
|
5
|
-
const [init] = useState(`<html>
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" />
|
|
7
|
-
<style media="screen" type="text/css">
|
|
8
|
-
#container {
|
|
9
|
-
width:100%;
|
|
10
|
-
height:100%;
|
|
11
|
-
top:0;
|
|
12
|
-
left:0;
|
|
13
|
-
right:0;
|
|
14
|
-
bottom:0;
|
|
15
|
-
position:absolute;
|
|
16
|
-
user-select: none;
|
|
17
|
-
-webkit-user-select: none;
|
|
18
|
-
}
|
|
19
|
-
</style>
|
|
20
|
-
<head>
|
|
21
|
-
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
|
|
22
|
-
${
|
|
23
|
-
props.stock
|
|
24
|
-
? '<script src="https://code.highcharts.com/stock/highstock.js"></script>'
|
|
25
|
-
: '<script src="https://code.highcharts.com/highcharts.js"></script>'
|
|
26
|
-
}
|
|
27
|
-
${
|
|
28
|
-
props.more
|
|
29
|
-
? '<script src="https://code.highcharts.com/highcharts-more.js"></script>'
|
|
30
|
-
: ''
|
|
31
|
-
}
|
|
32
|
-
${
|
|
33
|
-
props.guage
|
|
34
|
-
? '<script src="https://code.highcharts.com/modules/solid-gauge.js"></script>'
|
|
35
|
-
: ''
|
|
36
|
-
}
|
|
37
|
-
<script src="https://code.highcharts.com/modules/exporting.js"></script>
|
|
38
|
-
<script>
|
|
39
|
-
$(function () {
|
|
40
|
-
Highcharts.setOptions(${JSON.stringify(
|
|
41
|
-
props.options
|
|
42
|
-
)});
|
|
43
|
-
Highcharts.${
|
|
44
|
-
props.stock ? 'stockChart' : 'chart'
|
|
45
|
-
}('container', `);
|
|
46
|
-
const [end] = useState(` );
|
|
47
|
-
});
|
|
48
|
-
</script>
|
|
49
|
-
</head>
|
|
50
|
-
<body>
|
|
51
|
-
<div id="container">
|
|
52
|
-
</div>
|
|
53
|
-
</body>
|
|
54
|
-
</html>`);
|
|
55
|
-
|
|
56
|
-
const flattenText = (item, key) => {
|
|
57
|
-
let str = '';
|
|
58
|
-
if (item && typeof item === 'object' && item.length === undefined) {
|
|
59
|
-
str += flattenObject(item);
|
|
60
|
-
} else if (item && typeof item === 'object' && item.length !== undefined) {
|
|
61
|
-
str += '[';
|
|
62
|
-
item.forEach((k2) => {
|
|
63
|
-
str += `${flattenText(k2)}, `;
|
|
64
|
-
});
|
|
65
|
-
if (item.length > 0) {
|
|
66
|
-
str = str.slice(0, str.length - 2);
|
|
67
|
-
}
|
|
68
|
-
str += ']';
|
|
69
|
-
} else if (typeof item === 'string' && item.slice(0, 8) === 'function') {
|
|
70
|
-
str += `${item}`;
|
|
71
|
-
} else if (typeof item === 'string') {
|
|
72
|
-
// eslint-disable-next-line no-useless-escape
|
|
73
|
-
str += `\"${item.replace(/"/g, '\\"')}\"`;
|
|
74
|
-
} else {
|
|
75
|
-
str += `${item}`;
|
|
76
|
-
}
|
|
77
|
-
return str;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const flattenObject = (obj, str = '{') => {
|
|
81
|
-
Object.keys(obj).forEach(function (key) {
|
|
82
|
-
str += `${key}: ${flattenText(obj[key])}, `;
|
|
83
|
-
});
|
|
84
|
-
return `${str.slice(0, str.length - 2)}}`;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
let config = JSON.stringify(props.options, (key, value) => {
|
|
88
|
-
return typeof value === 'function' ? value.toString() : value;
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
config = JSON.parse(config);
|
|
92
|
-
const concatHTML = `${init}${flattenObject(config)}${end}`.replace(
|
|
93
|
-
': }',
|
|
94
|
-
': {}'
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<WebView
|
|
99
|
-
style={[props.styles, props.webviewStyles]}
|
|
100
|
-
source={{ html: concatHTML }}
|
|
101
|
-
javaScriptEnabled={true}
|
|
102
|
-
domStorageEnabled={true}
|
|
103
|
-
scalesPageToFit={true}
|
|
104
|
-
scrollEnabled={false}
|
|
105
|
-
automaticallyAdjustContentInsets={true}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export default Highcharts;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export const getIcon = (icon, width = 24, height = 24) => {
|
|
4
|
-
if (icon === 'clean-1') {
|
|
5
|
-
const SvgClean = require('../../../assets/images/Device/clean.svg');
|
|
6
|
-
return <SvgClean width={width} height={height} />;
|
|
7
|
-
}
|
|
8
|
-
if (icon === 'circulator-1') {
|
|
9
|
-
const SvgCirculator = require('../../../assets/images/Device/circulator.svg');
|
|
10
|
-
return <SvgCirculator width={width} height={height} />;
|
|
11
|
-
}
|
|
12
|
-
if (icon === 'auto-1') {
|
|
13
|
-
const SvgAuo = require('../../../assets/images/Device/auto.svg');
|
|
14
|
-
return <SvgAuo width={width} height={height} />;
|
|
15
|
-
}
|
|
16
|
-
if (icon === 'air-dry-1') {
|
|
17
|
-
const SvgAirDry = require('../../../assets/images/Device/air-dry.svg');
|
|
18
|
-
return <SvgAirDry width={width} height={height} />;
|
|
19
|
-
}
|
|
20
|
-
if (icon === 'door-state-1') {
|
|
21
|
-
const SvgDoorState = require('../../../assets/images/Device/door-state.svg');
|
|
22
|
-
return <SvgDoorState width={width} height={height} />;
|
|
23
|
-
}
|
|
24
|
-
if (icon === 'curent-state-1') {
|
|
25
|
-
const SvgCurrentState = require('../../../assets/images/Device/current-state.svg');
|
|
26
|
-
return <SvgCurrentState width={width} height={height} />;
|
|
27
|
-
}
|
|
28
|
-
if (icon === 'wind-strength-1') {
|
|
29
|
-
const SvgWindStrength = require('../../../assets/images/Device/wind-strength.svg');
|
|
30
|
-
return <SvgWindStrength width={width} height={height} />;
|
|
31
|
-
}
|
|
32
|
-
if (icon === 'tv') {
|
|
33
|
-
const { TV } = require('../../Images/SmartIr');
|
|
34
|
-
return <TV width={width} height={height} />;
|
|
35
|
-
}
|
|
36
|
-
if (icon === 'fan') {
|
|
37
|
-
const { Fan } = require('../../Images/SmartIr');
|
|
38
|
-
return <Fan width={width} height={height} />;
|
|
39
|
-
}
|
|
40
|
-
if (icon === 'ac') {
|
|
41
|
-
const { AC } = require('../../Images/SmartIr');
|
|
42
|
-
return <AC width={width} height={height} />;
|
|
43
|
-
}
|
|
44
|
-
if (icon === 'wm') {
|
|
45
|
-
const { WM } = require('../../Images/SmartIr');
|
|
46
|
-
return <WM width={width} height={height} />;
|
|
47
|
-
}
|
|
48
|
-
if (icon === 'fridge') {
|
|
49
|
-
const { Fridge } = require('../../Images/SmartIr');
|
|
50
|
-
return <Fridge width={width} height={height} />;
|
|
51
|
-
}
|
|
52
|
-
if (icon === 'diy') {
|
|
53
|
-
const { DIY } = require('../../Images/SmartIr');
|
|
54
|
-
return <DIY width={width} height={height} />;
|
|
55
|
-
}
|
|
56
|
-
return <></>;
|
|
57
|
-
};
|