@miot-rn/car-component 1.0.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/README.md +325 -0
- package/dist/assets/i18n/ar.d.ts +55 -0
- package/dist/assets/i18n/ar.js +55 -0
- package/dist/assets/i18n/bo.d.ts +55 -0
- package/dist/assets/i18n/bo.js +55 -0
- package/dist/assets/i18n/cs.d.ts +55 -0
- package/dist/assets/i18n/cs.js +55 -0
- package/dist/assets/i18n/de.d.ts +55 -0
- package/dist/assets/i18n/de.js +55 -0
- package/dist/assets/i18n/el.d.ts +55 -0
- package/dist/assets/i18n/el.js +55 -0
- package/dist/assets/i18n/en.d.ts +55 -0
- package/dist/assets/i18n/en.js +55 -0
- package/dist/assets/i18n/es.d.ts +55 -0
- package/dist/assets/i18n/es.js +55 -0
- package/dist/assets/i18n/es_us.d.ts +55 -0
- package/dist/assets/i18n/es_us.js +55 -0
- package/dist/assets/i18n/fi.d.ts +55 -0
- package/dist/assets/i18n/fi.js +55 -0
- package/dist/assets/i18n/fr.d.ts +55 -0
- package/dist/assets/i18n/fr.js +55 -0
- package/dist/assets/i18n/he.d.ts +55 -0
- package/dist/assets/i18n/he.js +55 -0
- package/dist/assets/i18n/hu.d.ts +55 -0
- package/dist/assets/i18n/hu.js +55 -0
- package/dist/assets/i18n/id.d.ts +55 -0
- package/dist/assets/i18n/id.js +55 -0
- package/dist/assets/i18n/it.d.ts +55 -0
- package/dist/assets/i18n/it.js +55 -0
- package/dist/assets/i18n/ja.d.ts +55 -0
- package/dist/assets/i18n/ja.js +55 -0
- package/dist/assets/i18n/ko.d.ts +55 -0
- package/dist/assets/i18n/ko.js +55 -0
- package/dist/assets/i18n/nb.d.ts +55 -0
- package/dist/assets/i18n/nb.js +55 -0
- package/dist/assets/i18n/nl.d.ts +55 -0
- package/dist/assets/i18n/nl.js +55 -0
- package/dist/assets/i18n/pl.d.ts +55 -0
- package/dist/assets/i18n/pl.js +55 -0
- package/dist/assets/i18n/pt.d.ts +55 -0
- package/dist/assets/i18n/pt.js +55 -0
- package/dist/assets/i18n/pt_pt.d.ts +55 -0
- package/dist/assets/i18n/pt_pt.js +55 -0
- package/dist/assets/i18n/ro.d.ts +55 -0
- package/dist/assets/i18n/ro.js +55 -0
- package/dist/assets/i18n/ru.d.ts +55 -0
- package/dist/assets/i18n/ru.js +55 -0
- package/dist/assets/i18n/sk.d.ts +55 -0
- package/dist/assets/i18n/sk.js +55 -0
- package/dist/assets/i18n/sv.d.ts +55 -0
- package/dist/assets/i18n/sv.js +55 -0
- package/dist/assets/i18n/th.d.ts +55 -0
- package/dist/assets/i18n/th.js +55 -0
- package/dist/assets/i18n/tr.d.ts +55 -0
- package/dist/assets/i18n/tr.js +55 -0
- package/dist/assets/i18n/uk.d.ts +55 -0
- package/dist/assets/i18n/uk.js +55 -0
- package/dist/assets/i18n/vi.d.ts +55 -0
- package/dist/assets/i18n/vi.js +55 -0
- package/dist/assets/i18n/zh.d.ts +55 -0
- package/dist/assets/i18n/zh.js +55 -0
- package/dist/assets/i18n/zh_hk.d.ts +55 -0
- package/dist/assets/i18n/zh_hk.js +55 -0
- package/dist/assets/i18n/zh_tw.d.ts +55 -0
- package/dist/assets/i18n/zh_tw.js +55 -0
- package/dist/assets/image/dark/car_background_dark.png +0 -0
- package/dist/assets/image/default/car_background.png +0 -0
- package/dist/components/airConditioningCard/index.d.ts +24 -0
- package/dist/components/airConditioningCard/index.js +103 -0
- package/dist/components/carInfoHeader/carImage.d.ts +8 -0
- package/dist/components/carInfoHeader/carImage.js +42 -0
- package/dist/components/carInfoHeader/dualRangeIndicator.d.ts +15 -0
- package/dist/components/carInfoHeader/dualRangeIndicator.js +124 -0
- package/dist/components/carInfoHeader/index.d.ts +37 -0
- package/dist/components/carInfoHeader/index.js +118 -0
- package/dist/components/carInfoHeader/parkingStatus.d.ts +12 -0
- package/dist/components/carInfoHeader/parkingStatus.js +100 -0
- package/dist/components/carInfoHeader/rangeProgressBar.d.ts +14 -0
- package/dist/components/carInfoHeader/rangeProgressBar.js +77 -0
- package/dist/components/carInfoHeader/singleRangeIndicator.d.ts +11 -0
- package/dist/components/carInfoHeader/singleRangeIndicator.js +58 -0
- package/dist/components/cardContainer/index.d.ts +8 -0
- package/dist/components/cardContainer/index.js +22 -0
- package/dist/components/containerWithGap/gapWrap.d.ts +8 -0
- package/dist/components/containerWithGap/gapWrap.js +31 -0
- package/dist/components/containerWithGap/index.d.ts +12 -0
- package/dist/components/containerWithGap/index.js +43 -0
- package/dist/components/flatSelect/FlatOption.d.ts +18 -0
- package/dist/components/flatSelect/FlatOption.js +117 -0
- package/dist/components/flatSelect/FlatSelect.d.ts +14 -0
- package/dist/components/flatSelect/FlatSelect.js +112 -0
- package/dist/components/flatSelect/index.d.ts +2 -0
- package/dist/components/flatSelect/index.js +2 -0
- package/dist/components/flatSelect/index.zh-CN.md +89 -0
- package/dist/components/groupContainer/index.d.ts +9 -0
- package/dist/components/groupContainer/index.js +48 -0
- package/dist/components/otherSettingCard/index.d.ts +8 -0
- package/dist/components/otherSettingCard/index.js +40 -0
- package/dist/components/pageBackground/index.d.ts +7 -0
- package/dist/components/pageBackground/index.js +22 -0
- package/dist/components/seatControl/index.d.ts +34 -0
- package/dist/components/seatControl/index.js +98 -0
- package/dist/components/seatControl/seatCard.d.ts +11 -0
- package/dist/components/seatControl/seatCard.js +24 -0
- package/dist/components/seatControl/seatCardRow.d.ts +29 -0
- package/dist/components/seatControl/seatCardRow.js +48 -0
- package/dist/components/seatControlGroup/index.d.ts +40 -0
- package/dist/components/seatControlGroup/index.js +51 -0
- package/dist/components/steeringWheelHotCard/index.d.ts +17 -0
- package/dist/components/steeringWheelHotCard/index.js +66 -0
- package/dist/components/titleContainer/TitleContainer.d.ts +4 -0
- package/dist/components/titleContainer/TitleContainer.js +148 -0
- package/dist/components/titleContainer/TitleContainer.zh-CN.md +62 -0
- package/dist/components/titleContainer/index.d.ts +1 -0
- package/dist/components/titleContainer/index.js +1 -0
- package/dist/components/titleContainer/interface.d.ts +48 -0
- package/dist/components/titleContainer/interface.js +21 -0
- package/dist/components/warningForRunningCard/index.d.ts +6 -0
- package/dist/components/warningForRunningCard/index.js +20 -0
- package/dist/config/ConnectStatus.d.ts +7 -0
- package/dist/config/ConnectStatus.js +8 -0
- package/dist/config/index.d.ts +16 -0
- package/dist/config/index.js +16 -0
- package/dist/config/seatFunctionType.d.ts +7 -0
- package/dist/config/seatFunctionType.js +24 -0
- package/dist/config/seatGearLevel.d.ts +21 -0
- package/dist/config/seatGearLevel.js +19 -0
- package/dist/config/seatI18nKeys.d.ts +9 -0
- package/dist/config/seatI18nKeys.js +9 -0
- package/dist/config/seatPosition.d.ts +8 -0
- package/dist/config/seatPosition.js +8 -0
- package/dist/config/seatRowConfig.d.ts +6 -0
- package/dist/config/seatRowConfig.js +6 -0
- package/dist/global.d.js +0 -0
- package/dist/hooks/CONNECT_STATUS.d.ts +6 -0
- package/dist/hooks/CONNECT_STATUS.js +5 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useAirConditionData.d.ts +29 -0
- package/dist/hooks/useAirConditionData.js +89 -0
- package/dist/hooks/useDualRangeData.d.ts +18 -0
- package/dist/hooks/useDualRangeData.js +82 -0
- package/dist/hooks/useParkingStatusData.d.ts +19 -0
- package/dist/hooks/useParkingStatusData.js +100 -0
- package/dist/hooks/useSeatControlData.d.ts +94 -0
- package/dist/hooks/useSeatControlData.js +251 -0
- package/dist/hooks/useSingleRangeData.d.ts +15 -0
- package/dist/hooks/useSingleRangeData.js +97 -0
- package/dist/hooks/useSteeringWheelData.d.ts +11 -0
- package/dist/hooks/useSteeringWheelData.js +56 -0
- package/dist/icons/CarInUsed.d.ts +4 -0
- package/dist/icons/CarInUsed.js +13 -0
- package/dist/icons/DeviceManage.d.ts +4 -0
- package/dist/icons/DeviceManage.js +13 -0
- package/dist/icons/ElectricPower.d.ts +4 -0
- package/dist/icons/ElectricPower.js +13 -0
- package/dist/icons/ErrorStatus.d.ts +4 -0
- package/dist/icons/ErrorStatus.js +13 -0
- package/dist/icons/FuelPower.d.ts +4 -0
- package/dist/icons/FuelPower.js +18 -0
- package/dist/icons/Loading.d.ts +4 -0
- package/dist/icons/Loading.js +16 -0
- package/dist/icons/MijiaLogo.d.ts +4 -0
- package/dist/icons/MijiaLogo.js +16 -0
- package/dist/icons/Minus.d.ts +4 -0
- package/dist/icons/Minus.js +15 -0
- package/dist/icons/ParkingStatus.d.ts +4 -0
- package/dist/icons/ParkingStatus.js +15 -0
- package/dist/icons/SeatGearHeatingLevelOne.d.ts +4 -0
- package/dist/icons/SeatGearHeatingLevelOne.js +22 -0
- package/dist/icons/SeatGearHeatingLevelThree.d.ts +4 -0
- package/dist/icons/SeatGearHeatingLevelThree.js +18 -0
- package/dist/icons/SeatGearHeatingLevelTwo.d.ts +4 -0
- package/dist/icons/SeatGearHeatingLevelTwo.js +22 -0
- package/dist/icons/SeatGearHeatingOff.d.ts +4 -0
- package/dist/icons/SeatGearHeatingOff.js +18 -0
- package/dist/icons/SeatGearVentilationLevelOne.d.ts +4 -0
- package/dist/icons/SeatGearVentilationLevelOne.js +17 -0
- package/dist/icons/SeatGearVentilationLevelThree.d.ts +4 -0
- package/dist/icons/SeatGearVentilationLevelThree.js +13 -0
- package/dist/icons/SeatGearVentilationLevelTwo.d.ts +4 -0
- package/dist/icons/SeatGearVentilationLevelTwo.js +17 -0
- package/dist/icons/SeatGearVentilationOff.d.ts +4 -0
- package/dist/icons/SeatGearVentilationOff.js +16 -0
- package/dist/icons/SentryMode.d.ts +4 -0
- package/dist/icons/SentryMode.js +13 -0
- package/dist/icons/SmartScene.d.ts +4 -0
- package/dist/icons/SmartScene.js +13 -0
- package/dist/icons/SteeringWheelFirstGear.d.ts +4 -0
- package/dist/icons/SteeringWheelFirstGear.js +13 -0
- package/dist/icons/SteeringWheelHot.d.ts +4 -0
- package/dist/icons/SteeringWheelHot.js +13 -0
- package/dist/icons/SteeringWheelSecondGear.d.ts +4 -0
- package/dist/icons/SteeringWheelSecondGear.js +13 -0
- package/dist/icons/SteeringWheelThirdGear.d.ts +4 -0
- package/dist/icons/SteeringWheelThirdGear.js +13 -0
- package/dist/icons/Warning.d.ts +4 -0
- package/dist/icons/Warning.js +13 -0
- package/dist/icons/index.d.ts +24 -0
- package/dist/icons/index.js +27 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +20 -0
- package/dist/modules/MODULES.md +245 -0
- package/dist/modules/airconditionModule/README.md +262 -0
- package/dist/modules/airconditionModule/index.d.ts +17 -0
- package/dist/modules/airconditionModule/index.js +63 -0
- package/dist/modules/carInfoModule/README.md +418 -0
- package/dist/modules/carInfoModule/index.d.ts +26 -0
- package/dist/modules/carInfoModule/index.js +67 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +2 -0
- package/dist/modules/seatModule/README.md +345 -0
- package/dist/modules/seatModule/index.d.ts +15 -0
- package/dist/modules/seatModule/index.js +40 -0
- package/dist/modules/steeringWheelModule/README.md +216 -0
- package/dist/modules/steeringWheelModule/index.d.ts +13 -0
- package/dist/modules/steeringWheelModule/index.js +31 -0
- package/dist/resources/i18n.d.ts +1730 -0
- package/dist/resources/i18n.js +84 -0
- package/dist/resources/images.d.ts +1 -0
- package/dist/resources/images.js +45 -0
- package/dist/spec/index.d.ts +494 -0
- package/dist/spec/index.js +911 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.js +1 -0
- package/dist/utils/checkSameValue.d.ts +1 -0
- package/dist/utils/checkSameValue.js +11 -0
- package/dist/utils/fns.d.ts +5 -0
- package/dist/utils/fns.js +167 -0
- package/dist/utils/get-value-or-default.d.ts +1 -0
- package/dist/utils/get-value-or-default.js +4 -0
- package/dist/utils/getLocalI18n.d.ts +1 -0
- package/dist/utils/getLocalI18n.js +9 -0
- package/dist/utils/i18n.d.ts +1 -0
- package/dist/utils/i18n.js +141 -0
- package/dist/utils/objects.d.ts +2 -0
- package/dist/utils/objects.js +222 -0
- package/dist/utils/spec.d.ts +8 -0
- package/dist/utils/spec.js +171 -0
- package/dist/utils/types.d.ts +3 -0
- package/dist/utils/types.js +25 -0
- package/package.json +27 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text } from 'react-native';
|
|
3
|
+
import { Fonts, defaultColorToken } from 'miot/ui/hyperOSUI';
|
|
4
|
+
import { RangeProgressBar } from "./rangeProgressBar";
|
|
5
|
+
import { dynamicStyleSheet } from 'miot/ui/Style/DynamicStyleSheet';
|
|
6
|
+
export const SingleRangeIndicator = ({
|
|
7
|
+
currentRange = 0,
|
|
8
|
+
totalRange = 100,
|
|
9
|
+
unit = 'km',
|
|
10
|
+
color,
|
|
11
|
+
style
|
|
12
|
+
}) => {
|
|
13
|
+
const numericRange = typeof currentRange === 'number' ? currentRange : 0;
|
|
14
|
+
const displayValue = typeof currentRange === 'number' ? Math.round(currentRange) : currentRange;
|
|
15
|
+
const progress = typeof currentRange === 'number' && totalRange > 0 ? Math.min(numericRange / totalRange, 1) : 0;
|
|
16
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
17
|
+
style: [styles.container, style]
|
|
18
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
19
|
+
style: styles.rangeContainer
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
21
|
+
style: styles.rangeValue
|
|
22
|
+
}, displayValue), /*#__PURE__*/React.createElement(Text, {
|
|
23
|
+
style: styles.unit
|
|
24
|
+
}, unit)), /*#__PURE__*/React.createElement(RangeProgressBar, {
|
|
25
|
+
progress: progress,
|
|
26
|
+
color: color
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
const styles = dynamicStyleSheet({
|
|
30
|
+
container: {
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
justifyContent: 'center',
|
|
33
|
+
paddingHorizontal: 20,
|
|
34
|
+
paddingVertical: 10,
|
|
35
|
+
height: 60,
|
|
36
|
+
width: '100%'
|
|
37
|
+
},
|
|
38
|
+
rangeContainer: {
|
|
39
|
+
flexDirection: 'row',
|
|
40
|
+
alignItems: 'baseline',
|
|
41
|
+
justifyContent: 'center'
|
|
42
|
+
},
|
|
43
|
+
rangeValue: {
|
|
44
|
+
color: defaultColorToken.mj_color_gray_text_1,
|
|
45
|
+
includeFontPadding: false,
|
|
46
|
+
...Fonts.mj_text_custom_26_M,
|
|
47
|
+
height: 34,
|
|
48
|
+
lineHeight: 34
|
|
49
|
+
},
|
|
50
|
+
unit: {
|
|
51
|
+
marginLeft: 2,
|
|
52
|
+
color: defaultColorToken.mj_color_gray_text_1,
|
|
53
|
+
includeFontPadding: false,
|
|
54
|
+
...Fonts.mj_text_custom_14_M,
|
|
55
|
+
height: 25,
|
|
56
|
+
lineHeight: 25
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
interface CardContainerProps {
|
|
4
|
+
style?: StyleProp<ViewStyle>;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const CardContainer: React.MemoExoticComponent<({ style, children }: CardContainerProps) => React.JSX.Element>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { memo, useContext } from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
import { ConfigContext } from 'miot/ui/hyperOSUI';
|
|
4
|
+
export const CardContainer = /*#__PURE__*/memo(({
|
|
5
|
+
style = undefined,
|
|
6
|
+
children = null
|
|
7
|
+
}) => {
|
|
8
|
+
const {
|
|
9
|
+
colorToken
|
|
10
|
+
} = useContext(ConfigContext);
|
|
11
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
12
|
+
style: [styles.container, {
|
|
13
|
+
backgroundColor: colorToken.mj_color_gray_card_3
|
|
14
|
+
}, style]
|
|
15
|
+
}, children);
|
|
16
|
+
});
|
|
17
|
+
const styles = StyleSheet.create({
|
|
18
|
+
container: {
|
|
19
|
+
borderRadius: 20,
|
|
20
|
+
overflow: 'hidden'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface GapWrapProps {
|
|
3
|
+
gap: number;
|
|
4
|
+
horizontal?: boolean;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const GapWrap: React.MemoExoticComponent<({ gap, horizontal, children }: GapWrapProps) => React.JSX.Element | null>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useState, memo } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
export const GapWrap = /*#__PURE__*/memo(({
|
|
4
|
+
gap,
|
|
5
|
+
horizontal = false,
|
|
6
|
+
children = null
|
|
7
|
+
}) => {
|
|
8
|
+
const [shown, setShown] = useState(true);
|
|
9
|
+
const onLayout = e => {
|
|
10
|
+
setShown(e.nativeEvent.layout.height > 0);
|
|
11
|
+
};
|
|
12
|
+
if (!children) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
16
|
+
style: horizontal ? styles.flex1 : null,
|
|
17
|
+
onLayout: onLayout
|
|
18
|
+
}, children), /*#__PURE__*/React.createElement(View, {
|
|
19
|
+
style: [styles.gap, {
|
|
20
|
+
[horizontal ? 'width' : 'height']: shown ? gap : 0
|
|
21
|
+
}]
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
const styles = StyleSheet.create({
|
|
25
|
+
gap: {
|
|
26
|
+
alignSelf: 'stretch'
|
|
27
|
+
},
|
|
28
|
+
flex1: {
|
|
29
|
+
flex: 1
|
|
30
|
+
}
|
|
31
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
interface ContainerWithGapProps {
|
|
4
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
horizontal?: boolean;
|
|
6
|
+
gap?: number;
|
|
7
|
+
outerGap?: number;
|
|
8
|
+
useChildGap?: boolean;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare const ContainerWithGap: React.MemoExoticComponent<({ containerStyle, horizontal, gap, outerGap, useChildGap, children, }: ContainerWithGapProps) => React.JSX.Element | null>;
|
|
12
|
+
export default ContainerWithGap;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
import { GapWrap } from "./gapWrap";
|
|
4
|
+
const ContainerWithGap = /*#__PURE__*/memo(({
|
|
5
|
+
containerStyle = {},
|
|
6
|
+
horizontal = false,
|
|
7
|
+
gap = 8,
|
|
8
|
+
outerGap = 0,
|
|
9
|
+
useChildGap = false,
|
|
10
|
+
children = null
|
|
11
|
+
}) => {
|
|
12
|
+
const getContents = () => {
|
|
13
|
+
if (!children) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
if (!Array.isArray(children)) {
|
|
17
|
+
return children;
|
|
18
|
+
}
|
|
19
|
+
const count = React.Children.count(children);
|
|
20
|
+
const lengtEdge = count - 1;
|
|
21
|
+
return React.Children.map(children, (child, index) => {
|
|
22
|
+
return /*#__PURE__*/React.createElement(GapWrap, {
|
|
23
|
+
gap: index < lengtEdge ? gap : 0,
|
|
24
|
+
horizontal: horizontal
|
|
25
|
+
}, child);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const contents = useChildGap ? children : getContents();
|
|
29
|
+
if (!contents) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
33
|
+
style: [{
|
|
34
|
+
[horizontal ? 'marginVertical' : 'marginHorizontal']: outerGap
|
|
35
|
+
}, horizontal ? styles.row : null, containerStyle]
|
|
36
|
+
}, contents);
|
|
37
|
+
});
|
|
38
|
+
const styles = StyleSheet.create({
|
|
39
|
+
row: {
|
|
40
|
+
flexDirection: 'row'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export default ContainerWithGap;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
import { SvgProps } from 'react-native-svg';
|
|
4
|
+
import { AccessibilityPropsType } from 'miot/utils/accessibility-helper';
|
|
5
|
+
import { type ColorType } from 'miot/hooks/hyperOS';
|
|
6
|
+
export interface FlatOptionProps extends AccessibilityPropsType {
|
|
7
|
+
value: string | number;
|
|
8
|
+
label: string;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
onSelect?: (value: string | number) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
icon?: React.ReactElement<SvgProps>;
|
|
13
|
+
colorType?: ColorType;
|
|
14
|
+
itemWidth?: string | number;
|
|
15
|
+
style?: ViewStyle;
|
|
16
|
+
}
|
|
17
|
+
declare function FlatOption({ value, label, selected, onSelect, disabled, style, colorType, icon, itemWidth, accessible, accessibilityLabel, accessibilityHint, }: FlatOptionProps): React.JSX.Element;
|
|
18
|
+
export default FlatOption;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import { ConfigContext, Fonts } from 'miot/ui/hyperOSUI';
|
|
3
|
+
import React, { cloneElement, isValidElement, useCallback, useContext, useMemo } from 'react';
|
|
4
|
+
import { StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native';
|
|
5
|
+
import { getAccessibilityConfig } from 'miot/utils/accessibility-helper';
|
|
6
|
+
import { useColorTypeState } from 'miot/hooks/hyperOS';
|
|
7
|
+
/**
|
|
8
|
+
* @export public
|
|
9
|
+
* @doc_name 常用UI组件
|
|
10
|
+
* @doc_index 1
|
|
11
|
+
* @doc_directory ui
|
|
12
|
+
* @author gaoruixiang
|
|
13
|
+
* @since 10114
|
|
14
|
+
* @module FlatOption
|
|
15
|
+
* @description FlatSelect 的子项选项,必须与 FlatSelect 配合使用
|
|
16
|
+
* @property {string|number} value - 选项值
|
|
17
|
+
* @property {string} label - 选项显示文本
|
|
18
|
+
* @property {boolean} selected - 是否选中,默认 false
|
|
19
|
+
* @property {function} onSelect - 选中回调
|
|
20
|
+
* @property {boolean} disabled - 禁用状态,默认 false
|
|
21
|
+
* @property {React.ReactElement} icon - 图标
|
|
22
|
+
* @property {string} colorType - 颜色色系
|
|
23
|
+
* @property {number} itemWidth - 子项宽度
|
|
24
|
+
* @property {object} style - 自定义选项样式
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
function FlatOption({
|
|
28
|
+
value,
|
|
29
|
+
label,
|
|
30
|
+
selected = false,
|
|
31
|
+
onSelect,
|
|
32
|
+
disabled = false,
|
|
33
|
+
style,
|
|
34
|
+
colorType = 'white',
|
|
35
|
+
icon,
|
|
36
|
+
itemWidth,
|
|
37
|
+
accessible,
|
|
38
|
+
accessibilityLabel,
|
|
39
|
+
accessibilityHint
|
|
40
|
+
}) {
|
|
41
|
+
const {
|
|
42
|
+
colorToken
|
|
43
|
+
} = useContext(ConfigContext);
|
|
44
|
+
const primaryColor = useColorTypeState({
|
|
45
|
+
colorType,
|
|
46
|
+
disabled
|
|
47
|
+
});
|
|
48
|
+
const handlePress = useCallback(() => {
|
|
49
|
+
if (!disabled && typeof onSelect === 'function') {
|
|
50
|
+
onSelect(value);
|
|
51
|
+
}
|
|
52
|
+
}, [onSelect, value, disabled]);
|
|
53
|
+
const [activeColor, activeTextColor] = useMemo(() => {
|
|
54
|
+
switch (colorType) {
|
|
55
|
+
case 'orange':
|
|
56
|
+
case 'green':
|
|
57
|
+
case 'blue':
|
|
58
|
+
case 'purple':
|
|
59
|
+
case 'red':
|
|
60
|
+
case 'yellow':
|
|
61
|
+
case 'wathet':
|
|
62
|
+
return [primaryColor, disabled ? colorToken.mj_color_gray_text_8 : colorToken.mj_color_norm_white];
|
|
63
|
+
default:
|
|
64
|
+
return [colorToken.mj_color_gray_card_4, disabled ? colorToken.mj_color_gray_text_6 : colorToken.mj_color_gray_text_2];
|
|
65
|
+
}
|
|
66
|
+
}, [colorType, colorToken, disabled, primaryColor]);
|
|
67
|
+
const generateIcon = useMemo(() => {
|
|
68
|
+
if (/*#__PURE__*/isValidElement(icon) && colorType !== 'white' && selected) {
|
|
69
|
+
return /*#__PURE__*/cloneElement(icon, {
|
|
70
|
+
fill: disabled ? colorToken.mj_color_gray_text_8 : colorToken.mj_color_norm_white
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return icon;
|
|
74
|
+
}, [icon, colorType, selected, disabled, colorToken]);
|
|
75
|
+
const containerStyle = useMemo(() => ({
|
|
76
|
+
backgroundColor: selected ? activeColor : 'transparent',
|
|
77
|
+
width: itemWidth !== 'auto' ? itemWidth : undefined
|
|
78
|
+
}), [selected, activeColor, itemWidth]);
|
|
79
|
+
return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, _extends({
|
|
80
|
+
onPress: handlePress,
|
|
81
|
+
disabled: disabled
|
|
82
|
+
}, getAccessibilityConfig({
|
|
83
|
+
accessible,
|
|
84
|
+
accessibilityLabel,
|
|
85
|
+
accessibilityHint
|
|
86
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
style: [styles.option, containerStyle, style]
|
|
88
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
89
|
+
style: [styles.icon]
|
|
90
|
+
}, generateIcon), /*#__PURE__*/React.createElement(Text, {
|
|
91
|
+
style: [styles.label, {
|
|
92
|
+
color: selected ? activeTextColor : disabled ? colorToken.mj_color_gray_text_6 : colorToken.mj_color_gray_text_2
|
|
93
|
+
}],
|
|
94
|
+
allowFontScaling: false,
|
|
95
|
+
numberOfLines: 2,
|
|
96
|
+
ellipsizeMode: "tail"
|
|
97
|
+
}, label)));
|
|
98
|
+
}
|
|
99
|
+
const styles = StyleSheet.create({
|
|
100
|
+
option: {
|
|
101
|
+
paddingTop: 12,
|
|
102
|
+
paddingBottom: 8,
|
|
103
|
+
paddingHorizontal: 8,
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
borderRadius: 16
|
|
106
|
+
},
|
|
107
|
+
icon: {
|
|
108
|
+
width: 20,
|
|
109
|
+
height: 20
|
|
110
|
+
},
|
|
111
|
+
label: {
|
|
112
|
+
...Fonts.mj_text_custom_13_M,
|
|
113
|
+
marginTop: 8,
|
|
114
|
+
textAlign: 'center'
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
export default FlatOption;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
export interface FlatSelectProps {
|
|
4
|
+
style?: ViewStyle;
|
|
5
|
+
value: string | number | undefined;
|
|
6
|
+
onChange?: (value: string | number) => void;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function FlatSelect({ style, value, onChange, disabled, children }: FlatSelectProps): React.JSX.Element;
|
|
11
|
+
declare namespace FlatSelect {
|
|
12
|
+
var FlatOption: typeof import("./FlatOption").default;
|
|
13
|
+
}
|
|
14
|
+
export default FlatSelect;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { cloneElement, isValidElement, useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { PixelRatio, StyleSheet, View } from 'react-native';
|
|
3
|
+
import FlatOption from "./FlatOption";
|
|
4
|
+
const Padding = 4;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @export public
|
|
8
|
+
* @doc_name 常用UI组件
|
|
9
|
+
* @doc_index 1
|
|
10
|
+
* @doc_directory ui
|
|
11
|
+
* @author gaoruixiang
|
|
12
|
+
* @since 10114
|
|
13
|
+
* @module FlatSelect
|
|
14
|
+
* @description 平铺式选择器组件,需要与 FlatOption 配合使用
|
|
15
|
+
* @property {object} style - 自定义样式
|
|
16
|
+
* @property {string|number} value - 选中值
|
|
17
|
+
* @property {function} onChange - 选中值变化回调
|
|
18
|
+
* @property {boolean} disabled - 禁用状态,默认 false
|
|
19
|
+
* @property {string} size - 禁用状态,默认 false
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
function FlatSelect({
|
|
23
|
+
style = undefined,
|
|
24
|
+
value,
|
|
25
|
+
onChange = undefined,
|
|
26
|
+
disabled = false,
|
|
27
|
+
children
|
|
28
|
+
}) {
|
|
29
|
+
// const { width: windowWidth } = useWindowDimensions();
|
|
30
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
31
|
+
|
|
32
|
+
// 缓存验证(类型检查)
|
|
33
|
+
const {
|
|
34
|
+
validatedChildren,
|
|
35
|
+
childrenCount
|
|
36
|
+
} = useMemo(() => {
|
|
37
|
+
const childrenArray = [];
|
|
38
|
+
React.Children.forEach(children, child => {
|
|
39
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
|
40
|
+
// 检查是否是 FlatOption 组件
|
|
41
|
+
const childDisplayName = child.type.displayName || child.type.name;
|
|
42
|
+
if (child.type === FlatOption || childDisplayName === 'FlatOption') {
|
|
43
|
+
childrenArray.push(child);
|
|
44
|
+
} else {
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.warn(`[FlatSelect] 子组件必须是 FlatOption 组件,当前组件类型: ${child.type}`, '已跳过该子组件');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
validatedChildren: childrenArray,
|
|
52
|
+
childrenCount: childrenArray.length
|
|
53
|
+
};
|
|
54
|
+
}, [children]);
|
|
55
|
+
|
|
56
|
+
// 计算每个子项的宽度
|
|
57
|
+
const itemWidth = useMemo(() => {
|
|
58
|
+
if (containerWidth === 0) {
|
|
59
|
+
return 'auto'; // 全在一排或容器宽度未知时,使用自动宽度
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 计算每个子项的宽度, 总宽度减去间距,再除以每行数量
|
|
63
|
+
const gap = Padding * 2; // 间距总和
|
|
64
|
+
const rawWidth = (containerWidth - gap) / childrenCount;
|
|
65
|
+
// 在物理像素层面向下取整,避免 Yoga 布局引擎 pixel snapping 导致累计溢出换行
|
|
66
|
+
const px = rawWidth * PixelRatio.get();
|
|
67
|
+
return Math.floor(px) / PixelRatio.get();
|
|
68
|
+
}, [containerWidth, childrenCount]);
|
|
69
|
+
|
|
70
|
+
// 处理选项选择
|
|
71
|
+
const handleSelect = useCallback(optionValue => {
|
|
72
|
+
if (!disabled && typeof onChange === 'function') {
|
|
73
|
+
onChange(optionValue);
|
|
74
|
+
}
|
|
75
|
+
}, [disabled, onChange]);
|
|
76
|
+
|
|
77
|
+
// 生成选项的辅助函数
|
|
78
|
+
const generateOptions = (children, selectedValue, onSelect, isDisabled) => children.map(child => {
|
|
79
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
|
80
|
+
return /*#__PURE__*/cloneElement(child, {
|
|
81
|
+
selected: child.props.value === selectedValue,
|
|
82
|
+
onSelect,
|
|
83
|
+
disabled: isDisabled || child.props.disabled,
|
|
84
|
+
itemWidth
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return child;
|
|
88
|
+
});
|
|
89
|
+
const options = generateOptions(validatedChildren, value, handleSelect, disabled);
|
|
90
|
+
const handleLayout = useCallback(event => {
|
|
91
|
+
const {
|
|
92
|
+
width
|
|
93
|
+
} = event.nativeEvent.layout;
|
|
94
|
+
setContainerWidth(width);
|
|
95
|
+
}, []);
|
|
96
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
97
|
+
style: [styles.container, style],
|
|
98
|
+
pointerEvents: disabled ? 'none' : 'auto',
|
|
99
|
+
onLayout: handleLayout
|
|
100
|
+
}, options);
|
|
101
|
+
}
|
|
102
|
+
const styles = StyleSheet.create({
|
|
103
|
+
container: {
|
|
104
|
+
padding: Padding,
|
|
105
|
+
flexDirection: 'row',
|
|
106
|
+
flexWrap: 'wrap',
|
|
107
|
+
alignItems: 'stretch',
|
|
108
|
+
justifyContent: 'flex-start'
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
FlatSelect.FlatOption = FlatOption;
|
|
112
|
+
export default FlatSelect;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# FlatSelect - 平铺式选择器组件
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
基于 `FlatSelectProps` 和 `FlatOptionProps` 接口定义,集成自 `FlatSelect.tsx` 和 `FlatOption.tsx` 中的类型定义。
|
|
5
|
+
|
|
6
|
+
`FlatSelect` 是一个平铺式的选择器组件,将多个选项以平铺的方式展示,用户可以直观地看到所有选项并进行选择。支持四种档位尺寸(L/M/S/XL),根据子项数量智能排列布局。
|
|
7
|
+
|
|
8
|
+
## 预览
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
## 基本信息
|
|
13
|
+
|
|
14
|
+
| 信息项 | 内容 |
|
|
15
|
+
|--------|------|
|
|
16
|
+
| 中文名称 | 平铺式选择器 |
|
|
17
|
+
| 描述 | 将多个选项以平铺方式展示的选择器,支持智能布局 |
|
|
18
|
+
| 位置 | `miot/ui/FlatSelect` |
|
|
19
|
+
| 引入版本 | `10114` |
|
|
20
|
+
| 更新时间 | 2025-12-17 |
|
|
21
|
+
|
|
22
|
+
## 组件关系
|
|
23
|
+
|
|
24
|
+
**FlatSelect 必须搭配 FlatOption 使用**,FlatOption 作为 FlatSelect 的子组件提供具体的选项。
|
|
25
|
+
|
|
26
|
+
## FlatSelect 入参(Props)
|
|
27
|
+
|
|
28
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
29
|
+
|--------|------|------|--------|------|
|
|
30
|
+
| **value** | `string \| number \| undefined` | 是 | - | 当前选中的值 |
|
|
31
|
+
| **onChange** | `(value: string \| number) => void` | 否 | - | 选中值变化回调 |
|
|
32
|
+
| **children** | `ReactNode` | 是 | - | 子组件(必须是 FlatOption) |
|
|
33
|
+
| **disabled** | `boolean` | 否 | `false` | 是否禁用所有选项 |
|
|
34
|
+
| **size** | `'XL' \| 'L' \| 'M' \| 'S'` | 否 | `'XL'` | 档位大小(决定布局规则) |
|
|
35
|
+
| **style** | `ViewStyle` | 否 | `{}` | 自定义容器样式 |
|
|
36
|
+
|
|
37
|
+
## FlatOption 入参(Props)
|
|
38
|
+
|
|
39
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
40
|
+
|--------|------|------|--------|------|
|
|
41
|
+
| **value** | `string \| number` | 是 | - | 选项值 |
|
|
42
|
+
| **label** | `string` | 是 | - | 选项显示文本 |
|
|
43
|
+
| **selected** | `boolean` | 否 | `false` | 是否选中(通常由 FlatSelect 控制) |
|
|
44
|
+
| **onSelect** | `(value: string \| number) => void` | 否 | - | 选中回调(通常由 FlatSelect 控制) |
|
|
45
|
+
| **disabled** | `boolean` | 否 | `false` | 是否禁用该选项 |
|
|
46
|
+
| **icon** | `React.ReactElement<SvgProps>` | 否 | - | 选项图标 |
|
|
47
|
+
| **colorType** | `ColorType` | 否 | `ColorType.White` | 选中时的颜色色系 |
|
|
48
|
+
| **itemWidth** | `string \| number` | 否 | - | 子项宽度(通常自动计算) |
|
|
49
|
+
| **style** | `ViewStyle` | 否 | - | 自定义选项样式 |
|
|
50
|
+
| **accessible** | `boolean` | 否 | - | 无障碍访问设置 |
|
|
51
|
+
| **accessibilityLabel** | `string` | 否 | - | 无障碍标签 |
|
|
52
|
+
| **accessibilityHint** | `string` | 否 | - | 无障碍提示 |
|
|
53
|
+
|
|
54
|
+
## 使用示例
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import { FlatSelect, FlatOption } from '@src/hyperOS/IotComponents/flatSelect';
|
|
58
|
+
import { ColorType } from '@src/styles/Styles';
|
|
59
|
+
|
|
60
|
+
// 基本用法
|
|
61
|
+
<FlatSelect
|
|
62
|
+
value={selectedValue}
|
|
63
|
+
onChange={(val) => setSelectedValue(val)}
|
|
64
|
+
>
|
|
65
|
+
<FlatOption value={1} label="选项一" />
|
|
66
|
+
<FlatOption value={2} label="选项二" />
|
|
67
|
+
<FlatOption value={3} label="选项三" />
|
|
68
|
+
</FlatSelect>
|
|
69
|
+
|
|
70
|
+
// 带图标和颜色
|
|
71
|
+
<FlatSelect
|
|
72
|
+
value={mode}
|
|
73
|
+
onChange={setMode}
|
|
74
|
+
size="L"
|
|
75
|
+
>
|
|
76
|
+
<FlatOption
|
|
77
|
+
value="auto"
|
|
78
|
+
label="自动"
|
|
79
|
+
icon={<AutoIcon />}
|
|
80
|
+
colorType={ColorType.Blue}
|
|
81
|
+
/>
|
|
82
|
+
<FlatOption
|
|
83
|
+
value="manual"
|
|
84
|
+
label="手动"
|
|
85
|
+
icon={<ManualIcon />}
|
|
86
|
+
colorType={ColorType.Green}
|
|
87
|
+
/>
|
|
88
|
+
</FlatSelect>
|
|
89
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
interface GroupContainerProps {
|
|
4
|
+
title: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
export declare function GroupContainer(props: GroupContainerProps): React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useMemo, isValidElement, Children, useContext } from 'react';
|
|
2
|
+
import { Text, View, StyleSheet } from 'react-native';
|
|
3
|
+
import { ConfigContext, Fonts } from 'miot/ui/hyperOSUI';
|
|
4
|
+
export function GroupContainer(props) {
|
|
5
|
+
const {
|
|
6
|
+
title,
|
|
7
|
+
children,
|
|
8
|
+
style
|
|
9
|
+
} = props;
|
|
10
|
+
const {
|
|
11
|
+
colorToken
|
|
12
|
+
} = useContext(ConfigContext);
|
|
13
|
+
const validatedChildrenOriginal = useMemo(() => {
|
|
14
|
+
const childrenArray = [];
|
|
15
|
+
const len = Children.count(children);
|
|
16
|
+
Children.forEach(children, (child, index) => {
|
|
17
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
|
18
|
+
childrenArray.push(child);
|
|
19
|
+
}
|
|
20
|
+
childrenArray.push(/*#__PURE__*/React.createElement(View, {
|
|
21
|
+
key: `space-${len + index}`,
|
|
22
|
+
style: styles.space
|
|
23
|
+
}));
|
|
24
|
+
});
|
|
25
|
+
childrenArray.pop();
|
|
26
|
+
return childrenArray;
|
|
27
|
+
}, [children]);
|
|
28
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
29
|
+
style: style
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
31
|
+
style: [styles.title, {
|
|
32
|
+
color: colorToken.mjcard_color_miui_1
|
|
33
|
+
}]
|
|
34
|
+
}, title), /*#__PURE__*/React.createElement(View, null, validatedChildrenOriginal));
|
|
35
|
+
}
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
title: {
|
|
38
|
+
paddingTop: 18,
|
|
39
|
+
paddingBottom: 6,
|
|
40
|
+
paddingLeft: 20,
|
|
41
|
+
paddingRight: 16,
|
|
42
|
+
lineHeight: 22,
|
|
43
|
+
...Fonts.mj_text_custom_14_R
|
|
44
|
+
},
|
|
45
|
+
space: {
|
|
46
|
+
height: 8
|
|
47
|
+
}
|
|
48
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface OtherSettingCardProps {
|
|
3
|
+
usedInCarTip: string;
|
|
4
|
+
deviceManageTip: string;
|
|
5
|
+
othersTip: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const OtherSettingCard: React.MemoExoticComponent<(props: OtherSettingCardProps) => React.JSX.Element>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useContext, useCallback, memo } from 'react';
|
|
2
|
+
import { LargeEntrance, ConfigContext } from 'miot/ui/hyperOSUI';
|
|
3
|
+
import { Host, Device } from 'miot';
|
|
4
|
+
import { CarInUsed, DeviceManage } from "../../icons";
|
|
5
|
+
import { CardContainer } from "../cardContainer";
|
|
6
|
+
import { GroupContainer } from "../groupContainer";
|
|
7
|
+
export const OtherSettingCard = /*#__PURE__*/memo(props => {
|
|
8
|
+
const {
|
|
9
|
+
usedInCarTip,
|
|
10
|
+
deviceManageTip,
|
|
11
|
+
othersTip
|
|
12
|
+
} = props;
|
|
13
|
+
const {
|
|
14
|
+
colorToken
|
|
15
|
+
} = useContext(ConfigContext);
|
|
16
|
+
const toUsedInCar = useCallback(() => {
|
|
17
|
+
Host.ui.openCarMiHomeManager(Device.deviceID);
|
|
18
|
+
}, []);
|
|
19
|
+
const toDeviceManage = useCallback(() => {
|
|
20
|
+
Host.ui.openDeviceRoamingManager(Device.deviceID);
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
// 判断是不是米系车
|
|
24
|
+
const isMiCar = !!Device.model.startsWith('micar.car.');
|
|
25
|
+
return /*#__PURE__*/React.createElement(GroupContainer, {
|
|
26
|
+
title: othersTip
|
|
27
|
+
}, /*#__PURE__*/React.createElement(CardContainer, null, /*#__PURE__*/React.createElement(LargeEntrance, {
|
|
28
|
+
leftIconSource: /*#__PURE__*/React.createElement(CarInUsed, {
|
|
29
|
+
fill: colorToken.mj_color_gray_icon_1
|
|
30
|
+
}),
|
|
31
|
+
title: usedInCarTip,
|
|
32
|
+
onPress: toUsedInCar
|
|
33
|
+
}), isMiCar && /*#__PURE__*/React.createElement(LargeEntrance, {
|
|
34
|
+
leftIconSource: /*#__PURE__*/React.createElement(DeviceManage, {
|
|
35
|
+
fill: colorToken.mj_color_gray_icon_1
|
|
36
|
+
}),
|
|
37
|
+
title: deviceManageTip,
|
|
38
|
+
onPress: toDeviceManage
|
|
39
|
+
})));
|
|
40
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface PageBackgroundProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
}
|
|
7
|
+
export declare const PageBackground: ({ children, style }: PageBackgroundProps) => React.JSX.Element;
|