@eohjsc/react-native-smart-city 0.7.21 → 0.7.23
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/package.json +1 -1
- package/src/Images/Common/default_end_device.png +0 -0
- package/src/commons/ActionGroup/TerminalBoxTemplate.js +3 -0
- package/src/commons/ActionTemplate/OnOffButtonAction.js +38 -4
- package/src/commons/ActionTemplate/OnOffSimpleAction.js +55 -15
- package/src/commons/ActionTemplate/OnOffSmartLockAction.js +46 -8
- package/src/commons/ActionTemplate/SwitchButtonAction.js +35 -4
- package/src/commons/ActionTemplate/ThreeButtonAction.js +13 -3
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +46 -7
- package/src/commons/ActionTemplate/__test__/OnOffSimpleAction.test.js +66 -6
- package/src/commons/ActionTemplate/__test__/OnOffSmartLockAction.test.js +53 -13
- package/src/commons/ActionTemplate/__test__/SwitchButtonAction.test.js +46 -7
- package/src/commons/ActionTemplate/__test__/index.test.js +6 -2
- package/src/commons/ActionTemplate/index.js +65 -10
- package/src/commons/Dashboard/MyUnit/index.js +19 -20
- package/src/commons/DevMode/Search.js +1 -1
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +5 -5
- package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +26 -32
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +8 -6
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +6 -0
- package/src/commons/SubUnit/OneTap/index.js +5 -0
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +9 -11
- package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +2 -2
- package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +1 -1
- package/src/configs/API.js +10 -0
- package/src/configs/AccessibilityLabel.js +5 -1
- package/src/configs/Images.js +1 -0
- package/src/navigations/AddMemberStack.js +3 -3
- package/src/screens/ActivityLog/__test__/index.test.js +10 -0
- package/src/screens/ActivityLog/hooks/index.js +1 -1
- package/src/screens/AddCommon/SelectUnit.js +3 -2
- package/src/screens/AddLocationMaps/__test__/index.test.js +13 -13
- package/src/screens/Automate/AddNewAction/ChooseAction.js +15 -51
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +13 -3
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +74 -54
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +114 -4
- package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +9 -11
- package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +37 -8
- package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +5 -0
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddAutomationTypeSmart.test.js +31 -0
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +18 -2
- package/src/screens/Automate/Components/InputName.js +7 -6
- package/src/screens/Automate/Constants.js +12 -0
- package/src/screens/Automate/EditActionsList/UpdateActionScript.js +24 -55
- package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +298 -41
- package/src/screens/Automate/EditActionsList/__tests__/index.test.js +2 -2
- package/src/screens/Automate/EditActionsList/index.js +26 -14
- package/src/screens/Automate/MultiUnits.js +9 -1
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +3 -3
- package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +4 -10
- package/src/screens/Automate/ScriptDetail/Components/DeleteScript.js +2 -4
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +78 -0
- package/src/screens/Automate/ScriptDetail/index.js +16 -10
- package/src/screens/Automate/ScriptDetail/utils.js +39 -35
- package/src/screens/Automate/SetSchedule/AddEditConditionSchedule.js +27 -160
- package/src/screens/Automate/SetSchedule/EditSchedule.js +269 -0
- package/src/screens/Automate/SetSchedule/__test__/AddEditConditionSchedule.test.js +327 -22
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +35 -22
- package/src/screens/Automate/SetSchedule/components/RepeatOptionsPopup.js +2 -8
- package/src/screens/Automate/SetSchedule/index.js +15 -129
- package/src/screens/Automate/SetSchedule/styles/indexStyles.js +9 -0
- package/src/screens/Automate/__test__/MultiUnits.test.js +6 -1
- package/src/screens/Automate/hooks/useAction.js +222 -0
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +69 -13
- package/src/screens/ConfirmUnitDeletion/index.js +14 -14
- package/src/screens/Device/__test__/detail.test.js +48 -1
- package/src/screens/Device/detail.js +46 -3
- package/src/screens/PlayBackCamera/__test__/index.test.js +48 -13
- package/src/screens/PlayBackCamera/index.js +1 -1
- package/src/screens/Sharing/Components/ConfigItem.js +34 -0
- package/src/screens/Sharing/Components/DeviceItem.js +77 -0
- package/src/screens/Sharing/Components/ItemChangeRole.js +3 -4
- package/src/screens/Sharing/Components/ShareDeviceSelector.js +255 -0
- package/src/screens/Sharing/Components/Styles/CheckBoxCustomStyles.js +1 -1
- package/src/screens/Sharing/Components/Styles/DeviceItemStyles.js +11 -27
- package/src/screens/Sharing/{Styles/SelectPermissionStyles.js → Components/Styles/ShareDeviceSelectorStyles.js} +3 -11
- package/src/screens/Sharing/Components/SubUnitItem.js +28 -0
- package/src/screens/Sharing/Components/SubUnitTreeView.js +68 -0
- package/src/screens/Sharing/Components/TitleCheckBox.js +23 -41
- package/src/screens/Sharing/Components/__test__/ItemChangeRole.test.js +7 -7
- package/src/screens/Sharing/Components/__test__/ShareDeviceSelector.test.js +298 -0
- package/src/screens/Sharing/Components/index.js +14 -1
- package/src/screens/Sharing/InfoMemberUnit.js +20 -20
- package/src/screens/Sharing/SelectShareDevice.js +11 -255
- package/src/screens/Sharing/SelectUser.js +12 -12
- package/src/screens/Sharing/UpdateShareDevice.js +45 -301
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +58 -11
- package/src/screens/Sharing/__test__/SelectShareDevice.test.js +51 -160
- package/src/screens/Sharing/__test__/SelectUser.test.js +72 -10
- package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +49 -209
- package/src/utils/Apis/axios.js +6 -0
- package/src/utils/I18n/translations/en.js +9 -1
- package/src/utils/I18n/translations/vi.js +10 -2
- package/src/commons/Sharing/StationDevicePermissions.js +0 -204
- package/src/screens/Automate/constants.js +0 -0
- package/src/screens/Sharing/Components/CheckBoxConfig.js +0 -44
- package/src/screens/Sharing/Components/CheckBoxSubUnit.js +0 -35
- package/src/screens/Sharing/Components/EndDevice.js +0 -93
- package/src/screens/Sharing/Components/Styles/CheckBoxConfigStyles.js +0 -18
- package/src/screens/Sharing/Components/Styles/TitleCheckBoxStyles.js +0 -21
- package/src/screens/Sharing/Components/__test__/TitleCheckBox.test.js +0 -31
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React, { memo, useMemo, useState } from 'react';
|
|
2
|
-
import { View, Text, TouchableOpacity } from 'react-native';
|
|
3
|
-
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
|
-
import { Colors } from '../../../configs';
|
|
5
|
-
import styles from './Styles/DeviceItemStyles';
|
|
6
|
-
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
7
|
-
import IconComponent from '../../../commons/IconComponent';
|
|
8
|
-
import CheckBoxConfig from './CheckBoxConfig';
|
|
9
|
-
|
|
10
|
-
const EndDevice = ({
|
|
11
|
-
item,
|
|
12
|
-
onTickedChild,
|
|
13
|
-
onTickEndDevice,
|
|
14
|
-
isItemExpanded,
|
|
15
|
-
toggleExpandEndDevice,
|
|
16
|
-
indexSubUnit,
|
|
17
|
-
indexEndDevice,
|
|
18
|
-
expandEndDevice,
|
|
19
|
-
}) => {
|
|
20
|
-
const { name, actions, read_configs, icon_kit, icon, isChecked } = item;
|
|
21
|
-
const [checked, setChecked] = useState(isChecked);
|
|
22
|
-
|
|
23
|
-
const dataConfig = useMemo(() => {
|
|
24
|
-
return [
|
|
25
|
-
...actions.map((i) => ({ ...i, isControl: true })),
|
|
26
|
-
...read_configs.map((i) => ({ ...i, isConfig: true })),
|
|
27
|
-
];
|
|
28
|
-
}, [actions, read_configs]);
|
|
29
|
-
|
|
30
|
-
const onPressItem = () => {
|
|
31
|
-
expandEndDevice();
|
|
32
|
-
onTickEndDevice(indexSubUnit, indexEndDevice, item, !checked);
|
|
33
|
-
setChecked(!checked);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const renderData = useMemo(() => {
|
|
37
|
-
return dataConfig.map((i) => (
|
|
38
|
-
<CheckBoxConfig
|
|
39
|
-
key={i.id}
|
|
40
|
-
item={item}
|
|
41
|
-
title={i.name}
|
|
42
|
-
configId={i.id}
|
|
43
|
-
isConfig={i.isConfig}
|
|
44
|
-
isControl={i.isControl}
|
|
45
|
-
onPress={onTickedChild}
|
|
46
|
-
isChecked={i.isChecked}
|
|
47
|
-
indexSubUnit={indexSubUnit}
|
|
48
|
-
indexEndDevice={indexEndDevice}
|
|
49
|
-
/>
|
|
50
|
-
));
|
|
51
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
-
}, [dataConfig]);
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<View style={styles.wrap}>
|
|
56
|
-
<TouchableOpacity onPress={onPressItem}>
|
|
57
|
-
<IconComponent
|
|
58
|
-
icon={icon_kit || icon}
|
|
59
|
-
size={20}
|
|
60
|
-
style={styles.viewLeft}
|
|
61
|
-
/>
|
|
62
|
-
</TouchableOpacity>
|
|
63
|
-
<View style={styles.wrapRight}>
|
|
64
|
-
<View style={styles.viewRight}>
|
|
65
|
-
<Text
|
|
66
|
-
numberOfLines={1}
|
|
67
|
-
style={styles.text}
|
|
68
|
-
onPress={onPressItem}
|
|
69
|
-
accessibilityLabel={`${AccessibilityLabel.SHARE_DEVICE.CLICK_NAME_END_DEVICE}-${indexEndDevice}`}
|
|
70
|
-
>
|
|
71
|
-
{name}
|
|
72
|
-
</Text>
|
|
73
|
-
{checked && (
|
|
74
|
-
<IconOutline name={'check'} color={Colors.Primary} size={20} />
|
|
75
|
-
)}
|
|
76
|
-
|
|
77
|
-
{dataConfig.length > 0 && (
|
|
78
|
-
<IconOutline
|
|
79
|
-
onPress={() => toggleExpandEndDevice()}
|
|
80
|
-
name={isItemExpanded ? 'up' : 'down'}
|
|
81
|
-
size={20}
|
|
82
|
-
color={Colors.Gray6}
|
|
83
|
-
accessibilityLabel={`${AccessibilityLabel.SHARE_DEVICE.EXPAND_END_DEVICE}-${indexEndDevice}`}
|
|
84
|
-
/>
|
|
85
|
-
)}
|
|
86
|
-
</View>
|
|
87
|
-
{isItemExpanded && <View style={styles.wrapExpand}>{renderData}</View>}
|
|
88
|
-
</View>
|
|
89
|
-
</View>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export default memo(EndDevice);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
export default StyleSheet.create({
|
|
4
|
-
wrap: {
|
|
5
|
-
flexDirection: 'row',
|
|
6
|
-
alignItems: 'center',
|
|
7
|
-
},
|
|
8
|
-
wrapRow: {
|
|
9
|
-
flexDirection: 'row',
|
|
10
|
-
alignItems: 'center',
|
|
11
|
-
},
|
|
12
|
-
wrapCheckBoxStyle: {
|
|
13
|
-
marginLeft: -10,
|
|
14
|
-
},
|
|
15
|
-
titleStyle: {
|
|
16
|
-
width: 200,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { Colors } from '../../../../configs';
|
|
3
|
-
import { normalize } from '../../../../configs/Constants';
|
|
4
|
-
|
|
5
|
-
export default StyleSheet.create({
|
|
6
|
-
wrap: {
|
|
7
|
-
flexDirection: 'row',
|
|
8
|
-
alignItems: 'center',
|
|
9
|
-
},
|
|
10
|
-
title: {
|
|
11
|
-
color: Colors.Gray8,
|
|
12
|
-
fontSize: normalize(14),
|
|
13
|
-
lineHeight: normalize(22),
|
|
14
|
-
fontWeight: '600',
|
|
15
|
-
fontStyle: 'normal',
|
|
16
|
-
},
|
|
17
|
-
wrapRow: {
|
|
18
|
-
flexDirection: 'row',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
|
-
|
|
4
|
-
import { SCProvider } from '../../../../context';
|
|
5
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
-
import TitleCheckBox from '../TitleCheckBox';
|
|
7
|
-
import { CheckBoxCustom } from '..';
|
|
8
|
-
|
|
9
|
-
const mockOnPress = jest.fn();
|
|
10
|
-
const wrapComponent = (idGroup, id) => (
|
|
11
|
-
<SCProvider initState={mockSCStore({})}>
|
|
12
|
-
<TitleCheckBox idGroup={idGroup} id={id} onPress={mockOnPress} />
|
|
13
|
-
</SCProvider>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
describe('test TitleCheckBox', () => {
|
|
17
|
-
it('test handleOnPress', async () => {
|
|
18
|
-
let tree;
|
|
19
|
-
await act(async () => {
|
|
20
|
-
tree = await create(wrapComponent(1, 2));
|
|
21
|
-
});
|
|
22
|
-
const instance = tree.root;
|
|
23
|
-
const checkBoxCustom = instance.findByType(CheckBoxCustom);
|
|
24
|
-
await act(async () => {
|
|
25
|
-
checkBoxCustom.props.onPress();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
expect(checkBoxCustom.props.isChecked).toBe(true);
|
|
29
|
-
expect(mockOnPress).toHaveBeenLastCalledWith(1, true, 2);
|
|
30
|
-
});
|
|
31
|
-
});
|