@miot-rn/car-component 1.0.1 → 1.0.2
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/dist/components/airConditioningCard/index.js +7 -9
- package/dist/components/carInfoHeader/carImage.js +1 -1
- package/dist/components/carInfoHeader/dualRangeIndicator.js +6 -6
- package/dist/components/carInfoHeader/parkingStatus.js +2 -2
- package/dist/components/carInfoHeader/rangeProgressBar.js +2 -2
- package/dist/components/carInfoHeader/singleRangeIndicator.js +4 -4
- package/dist/components/cardContainer/index.js +1 -1
- package/dist/components/flatSelect/FlatOption.js +5 -5
- package/dist/components/groupContainer/index.js +2 -2
- package/dist/components/largeEntrance/LargeEntrance.d.ts +4 -0
- package/dist/components/largeEntrance/LargeEntrance.js +143 -0
- package/dist/components/largeEntrance/index.d.ts +2 -0
- package/dist/components/largeEntrance/index.js +1 -0
- package/dist/components/largeEntrance/interface.d.ts +15 -0
- package/dist/components/largeEntrance/interface.js +1 -0
- package/dist/components/otherSettingCard/index.js +9 -9
- package/dist/components/pageBackground/index.js +1 -1
- package/dist/components/seatControl/index.js +4 -4
- package/dist/components/steeringWheelHotCard/index.d.ts +1 -1
- package/dist/components/steeringWheelHotCard/index.js +1 -1
- package/dist/components/titleContainer/TitleContainer.js +6 -6
- package/dist/components/titleContainer/interface.d.ts +7 -2
- package/dist/components/warningForRunningCard/index.js +3 -2
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +3 -1
- package/dist/config/overseasConfig.d.ts +3 -0
- package/dist/config/overseasConfig.js +3 -0
- package/dist/hooks/useDualRangeData.js +2 -2
- package/dist/hooks/useParkingStatusData.js +5 -5
- package/dist/hooks/useSeatControlData.js +24 -24
- package/dist/hooks/useSingleRangeData.js +5 -5
- package/dist/index.d.ts +6 -4
- package/dist/index.js +3 -1
- package/dist/modules/airconditionModule/README.md +1 -1
- package/dist/utils/featureGate.d.ts +5 -0
- package/dist/utils/featureGate.js +33 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext, memo, useMemo } from 'react';
|
|
2
2
|
import { Text, View, StyleSheet } from 'react-native';
|
|
3
|
-
import { Stepper, Separator, ColumnSeparator,
|
|
3
|
+
import { Stepper, Separator, ColumnSeparator, LargeListToggle, ConfigContext } from 'miot/ui/hyperOSUI';
|
|
4
4
|
import { TitleContainer } from "../titleContainer";
|
|
5
5
|
import { CardContainer } from "../cardContainer";
|
|
6
6
|
function isEffectData(value) {
|
|
@@ -48,13 +48,13 @@ export const AirConditioningCard = /*#__PURE__*/memo(({
|
|
|
48
48
|
}]
|
|
49
49
|
}, isInsideTemperatureEffect && /*#__PURE__*/React.createElement(Text, {
|
|
50
50
|
style: {
|
|
51
|
-
color: disabled ? colorToken.
|
|
51
|
+
color: disabled ? colorToken.contentDisabledPrimary : colorToken.contentTertiaryNormal
|
|
52
52
|
}
|
|
53
53
|
}, insideTip), isInsideTemperatureEffect && isOutsideTemperatureEffect && /*#__PURE__*/React.createElement(ColumnSeparator, {
|
|
54
54
|
style: styles.column
|
|
55
55
|
}), isOutsideTemperatureEffect && /*#__PURE__*/React.createElement(Text, {
|
|
56
56
|
style: {
|
|
57
|
-
color: disabled ? colorToken.
|
|
57
|
+
color: disabled ? colorToken.contentDisabledPrimary : colorToken.contentTertiaryNormal
|
|
58
58
|
}
|
|
59
59
|
}, outsideTip)) : showTargetTemperature ? /*#__PURE__*/React.createElement(View, {
|
|
60
60
|
style: {
|
|
@@ -68,20 +68,18 @@ export const AirConditioningCard = /*#__PURE__*/memo(({
|
|
|
68
68
|
style: styles.stepper
|
|
69
69
|
}, /*#__PURE__*/React.createElement(Stepper, {
|
|
70
70
|
step: temperatureStep,
|
|
71
|
-
symbolType: "
|
|
71
|
+
symbolType: "degree",
|
|
72
72
|
value: transformTargetTemperature,
|
|
73
73
|
disabled: !hvacStatus || disabled,
|
|
74
74
|
onChange: onHvacTemperatureChange,
|
|
75
75
|
min: minTemperature,
|
|
76
76
|
max: maxTemperature
|
|
77
|
-
})), showHvacDefroster && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Separator, {
|
|
78
|
-
style: styles.separator
|
|
79
|
-
}), /*#__PURE__*/React.createElement(LargeVariantSwitch, {
|
|
77
|
+
})), showHvacDefroster && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Separator, null), /*#__PURE__*/React.createElement(LargeListToggle, {
|
|
80
78
|
title: hvacDefrosterTitle,
|
|
81
79
|
disabled: disabled,
|
|
82
80
|
subtitle: hvacDefrosterSubtitle,
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
checked: hvacDefrosterStatus,
|
|
82
|
+
onChange: onHvacDefrosterChange
|
|
85
83
|
})));
|
|
86
84
|
});
|
|
87
85
|
const styles = StyleSheet.create({
|
|
@@ -18,7 +18,7 @@ export const CarImage = ({
|
|
|
18
18
|
}) : /*#__PURE__*/React.createElement(View, {
|
|
19
19
|
style: styles.placeholder
|
|
20
20
|
}, /*#__PURE__*/React.createElement(MijiaLogo, {
|
|
21
|
-
fill: colorToken.
|
|
21
|
+
fill: colorToken.contentSecondaryNormal
|
|
22
22
|
})));
|
|
23
23
|
};
|
|
24
24
|
const styles = StyleSheet.create({
|
|
@@ -60,7 +60,7 @@ export const DualRangeIndicator = ({
|
|
|
60
60
|
totalRange: electricRange,
|
|
61
61
|
currentRange: currentElectricRange,
|
|
62
62
|
icon: /*#__PURE__*/React.createElement(ElectricPower, {
|
|
63
|
-
fill: colorToken.
|
|
63
|
+
fill: colorToken.contentPrimaryNormal
|
|
64
64
|
}),
|
|
65
65
|
color: electricColor,
|
|
66
66
|
progress: electricProgress
|
|
@@ -69,7 +69,7 @@ export const DualRangeIndicator = ({
|
|
|
69
69
|
totalRange: fuelRange,
|
|
70
70
|
currentRange: currentFuelRange,
|
|
71
71
|
icon: /*#__PURE__*/React.createElement(FuelPower, {
|
|
72
|
-
fill: colorToken.
|
|
72
|
+
fill: colorToken.contentPrimaryNormal
|
|
73
73
|
}),
|
|
74
74
|
color: fuelColor,
|
|
75
75
|
progress: fuelProgress
|
|
@@ -109,16 +109,16 @@ const styles = dynamicStyleSheet({
|
|
|
109
109
|
height: 30
|
|
110
110
|
},
|
|
111
111
|
rangeValue: {
|
|
112
|
-
color: defaultColorToken.
|
|
112
|
+
color: defaultColorToken.contentPrimaryNormal,
|
|
113
113
|
includeFontPadding: false,
|
|
114
|
-
...Fonts.
|
|
114
|
+
...Fonts.fontSystem20Medium
|
|
115
115
|
},
|
|
116
116
|
unitSpacer: {
|
|
117
117
|
fontSize: 6
|
|
118
118
|
},
|
|
119
119
|
unit: {
|
|
120
|
-
color: defaultColorToken.
|
|
120
|
+
color: defaultColorToken.contentPrimaryNormal,
|
|
121
121
|
includeFontPadding: false,
|
|
122
|
-
...Fonts.
|
|
122
|
+
...Fonts.fontSystem14Medium
|
|
123
123
|
}
|
|
124
124
|
});
|
|
@@ -88,12 +88,12 @@ const styles = dynamicStyleSheet({
|
|
|
88
88
|
divider: {
|
|
89
89
|
width: 1,
|
|
90
90
|
height: 10,
|
|
91
|
-
backgroundColor: defaultColorToken.
|
|
91
|
+
backgroundColor: defaultColorToken.dividerPrimary,
|
|
92
92
|
marginHorizontal: 4
|
|
93
93
|
},
|
|
94
94
|
statusText: {
|
|
95
95
|
...Fonts.FontTextRegular,
|
|
96
|
-
color: defaultColorToken.
|
|
96
|
+
color: defaultColorToken.contentTertiaryNormal,
|
|
97
97
|
includeFontPadding: false,
|
|
98
98
|
textAlign: 'center'
|
|
99
99
|
}
|
|
@@ -18,8 +18,8 @@ export const RangeProgressBar = ({
|
|
|
18
18
|
if (Number.isNaN(progress)) return 0;
|
|
19
19
|
return Math.min(Math.max(progress, 0), 1);
|
|
20
20
|
}, [progress]);
|
|
21
|
-
const effectiveUnfilled = unfilledColor || colorToken.
|
|
22
|
-
const fillColor = color || colorToken.
|
|
21
|
+
const effectiveUnfilled = unfilledColor || colorToken.fillPrimary;
|
|
22
|
+
const fillColor = color || colorToken.accentGreenFill;
|
|
23
23
|
const rawFilled = clamped * width;
|
|
24
24
|
const hasGap = clamped > 0 && clamped < 1;
|
|
25
25
|
const filledWidth = Math.max(0, Math.min(width, hasGap ? rawFilled - 1 / 2 : rawFilled));
|
|
@@ -41,17 +41,17 @@ const styles = dynamicStyleSheet({
|
|
|
41
41
|
justifyContent: 'center'
|
|
42
42
|
},
|
|
43
43
|
rangeValue: {
|
|
44
|
-
color: defaultColorToken.
|
|
44
|
+
color: defaultColorToken.contentPrimaryNormal,
|
|
45
45
|
includeFontPadding: false,
|
|
46
|
-
...Fonts.
|
|
46
|
+
...Fonts.fontSystem26Medium,
|
|
47
47
|
height: 34,
|
|
48
48
|
lineHeight: 34
|
|
49
49
|
},
|
|
50
50
|
unit: {
|
|
51
51
|
marginLeft: 2,
|
|
52
|
-
color: defaultColorToken.
|
|
52
|
+
color: defaultColorToken.contentPrimaryNormal,
|
|
53
53
|
includeFontPadding: false,
|
|
54
|
-
...Fonts.
|
|
54
|
+
...Fonts.fontSystem14Medium,
|
|
55
55
|
height: 25,
|
|
56
56
|
lineHeight: 25
|
|
57
57
|
}
|
|
@@ -10,7 +10,7 @@ export const CardContainer = /*#__PURE__*/memo(({
|
|
|
10
10
|
} = useContext(ConfigContext);
|
|
11
11
|
return /*#__PURE__*/React.createElement(View, {
|
|
12
12
|
style: [styles.container, {
|
|
13
|
-
backgroundColor: colorToken.
|
|
13
|
+
backgroundColor: colorToken.surfaceCardTranslucent
|
|
14
14
|
}, style]
|
|
15
15
|
}, children);
|
|
16
16
|
});
|
|
@@ -59,15 +59,15 @@ function FlatOption({
|
|
|
59
59
|
case 'red':
|
|
60
60
|
case 'yellow':
|
|
61
61
|
case 'wathet':
|
|
62
|
-
return [primaryColor, disabled ? colorToken.
|
|
62
|
+
return [primaryColor, disabled ? colorToken.contentInverseDisabled : colorToken.staticWhite];
|
|
63
63
|
default:
|
|
64
|
-
return [colorToken.
|
|
64
|
+
return [colorToken.fillQuaternary, disabled ? colorToken.contentDisabledPrimary : colorToken.contentSecondaryNormal];
|
|
65
65
|
}
|
|
66
66
|
}, [colorType, colorToken, disabled, primaryColor]);
|
|
67
67
|
const generateIcon = useMemo(() => {
|
|
68
68
|
if (/*#__PURE__*/isValidElement(icon) && colorType !== 'white' && selected) {
|
|
69
69
|
return /*#__PURE__*/cloneElement(icon, {
|
|
70
|
-
fill: disabled ? colorToken.
|
|
70
|
+
fill: disabled ? colorToken.contentInverseDisabled : colorToken.staticWhite
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
return icon;
|
|
@@ -89,7 +89,7 @@ function FlatOption({
|
|
|
89
89
|
style: [styles.icon]
|
|
90
90
|
}, generateIcon), /*#__PURE__*/React.createElement(Text, {
|
|
91
91
|
style: [styles.label, {
|
|
92
|
-
color: selected ? activeTextColor : disabled ? colorToken.
|
|
92
|
+
color: selected ? activeTextColor : disabled ? colorToken.contentDisabledPrimary : colorToken.contentSecondaryNormal
|
|
93
93
|
}],
|
|
94
94
|
allowFontScaling: false,
|
|
95
95
|
numberOfLines: 2,
|
|
@@ -109,7 +109,7 @@ const styles = StyleSheet.create({
|
|
|
109
109
|
height: 20
|
|
110
110
|
},
|
|
111
111
|
label: {
|
|
112
|
-
...Fonts.
|
|
112
|
+
...Fonts.fontSystem13Medium,
|
|
113
113
|
marginTop: 8,
|
|
114
114
|
textAlign: 'center'
|
|
115
115
|
}
|
|
@@ -29,7 +29,7 @@ export function GroupContainer(props) {
|
|
|
29
29
|
style: style
|
|
30
30
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
31
31
|
style: [styles.title, {
|
|
32
|
-
color: colorToken.
|
|
32
|
+
color: colorToken.accentOsContent
|
|
33
33
|
}]
|
|
34
34
|
}, title), /*#__PURE__*/React.createElement(View, null, validatedChildrenOriginal));
|
|
35
35
|
}
|
|
@@ -40,7 +40,7 @@ const styles = StyleSheet.create({
|
|
|
40
40
|
paddingLeft: 20,
|
|
41
41
|
paddingRight: 16,
|
|
42
42
|
lineHeight: 22,
|
|
43
|
-
...Fonts.
|
|
43
|
+
...Fonts.fontSystem14Regular
|
|
44
44
|
},
|
|
45
45
|
space: {
|
|
46
46
|
height: 8
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React, { isValidElement, cloneElement, useContext } from 'react';
|
|
2
|
+
import { I18nManager, StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { ConfigContext, Fonts, TouchableView } from 'miot/ui/hyperOSUI';
|
|
4
|
+
import { Right } from 'miot/ui/icons';
|
|
5
|
+
const THIN_HEIGHT = 60;
|
|
6
|
+
const PADDING = 16;
|
|
7
|
+
const DOT_SIZE = 7;
|
|
8
|
+
const DOT_RADIUS = DOT_SIZE / 2;
|
|
9
|
+
const ICON_SIZE = 16;
|
|
10
|
+
const MAX_LINE = 3;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @export public
|
|
14
|
+
* @doc_name 大型入口控件
|
|
15
|
+
* @doc_index 2
|
|
16
|
+
* @doc_directory ui
|
|
17
|
+
* @since 10115
|
|
18
|
+
* @module Entrance
|
|
19
|
+
* @description 大型入口控件,用于首页等需要突出展示的场景
|
|
20
|
+
*/
|
|
21
|
+
const LargeEntrance = props => {
|
|
22
|
+
const {
|
|
23
|
+
colorToken
|
|
24
|
+
} = useContext(ConfigContext);
|
|
25
|
+
const {
|
|
26
|
+
title = '',
|
|
27
|
+
subtitle = '',
|
|
28
|
+
value = '',
|
|
29
|
+
onPress,
|
|
30
|
+
disabled = false,
|
|
31
|
+
hideRightIcon = false,
|
|
32
|
+
forceHideRightIconOnPressInvalid = false,
|
|
33
|
+
showDot = false,
|
|
34
|
+
leftIconSource = null,
|
|
35
|
+
customRenderer,
|
|
36
|
+
accessible,
|
|
37
|
+
accessibilityLabel,
|
|
38
|
+
accessibilityHint
|
|
39
|
+
} = props;
|
|
40
|
+
const isRTL = I18nManager.isRTL;
|
|
41
|
+
const subTitleIsString = typeof subtitle === 'string';
|
|
42
|
+
const shouldHideRightIcon = hideRightIcon || forceHideRightIconOnPressInvalid && !onPress;
|
|
43
|
+
return /*#__PURE__*/React.createElement(TouchableView, {
|
|
44
|
+
disabled: !onPress || disabled,
|
|
45
|
+
onPress: onPress,
|
|
46
|
+
viewStyle: styles.container,
|
|
47
|
+
accessible: accessible,
|
|
48
|
+
accessibilityLabel: accessibilityLabel,
|
|
49
|
+
accessibilityHint: accessibilityHint
|
|
50
|
+
}, leftIconSource && /*#__PURE__*/React.createElement(View, {
|
|
51
|
+
style: [styles.leftIcon, {
|
|
52
|
+
opacity: disabled ? 0.3 : 1
|
|
53
|
+
}]
|
|
54
|
+
}, leftIconSource), /*#__PURE__*/React.createElement(View, {
|
|
55
|
+
style: styles.left
|
|
56
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
57
|
+
numberOfLines: MAX_LINE,
|
|
58
|
+
allowFontScaling: false,
|
|
59
|
+
style: [Fonts.mj_text_custom_16_M, {
|
|
60
|
+
color: disabled ? colorToken.contentDisabledPrimary : colorToken.contentPrimaryNormal
|
|
61
|
+
}]
|
|
62
|
+
}, title), subtitle ? subTitleIsString ? /*#__PURE__*/React.createElement(Text, {
|
|
63
|
+
numberOfLines: MAX_LINE,
|
|
64
|
+
allowFontScaling: false,
|
|
65
|
+
style: [Fonts.mj_text_custom_13_R, {
|
|
66
|
+
color: disabled ? colorToken.contentDisabledPrimary : colorToken.contentTertiaryNormal
|
|
67
|
+
}]
|
|
68
|
+
}, subtitle) : /*#__PURE__*/isValidElement(subtitle) ? (/*#__PURE__*/cloneElement(subtitle, {
|
|
69
|
+
disabled
|
|
70
|
+
})) : subtitle : null), /*#__PURE__*/React.createElement(View, {
|
|
71
|
+
style: {
|
|
72
|
+
width: 10
|
|
73
|
+
}
|
|
74
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
75
|
+
style: styles.right
|
|
76
|
+
}, customRenderer || /*#__PURE__*/React.createElement(React.Fragment, null, showDot && /*#__PURE__*/React.createElement(View, {
|
|
77
|
+
accessibilityLabel: "new notification",
|
|
78
|
+
style: [styles.dotLight, {
|
|
79
|
+
backgroundColor: disabled ? colorToken.accentRedLow : colorToken.accentRedFill
|
|
80
|
+
}]
|
|
81
|
+
}), value ? /*#__PURE__*/React.createElement(Text, {
|
|
82
|
+
numberOfLines: MAX_LINE,
|
|
83
|
+
allowFontScaling: false,
|
|
84
|
+
style: [styles.rightText, Fonts.mj_text_body_2_R, {
|
|
85
|
+
color: disabled ? colorToken.contentDisabledPrimary : colorToken.contentQuaternaryNormal
|
|
86
|
+
}]
|
|
87
|
+
}, value) : null, !shouldHideRightIcon && /*#__PURE__*/React.createElement(View, {
|
|
88
|
+
style: [styles.icon, {
|
|
89
|
+
transform: [{
|
|
90
|
+
scaleX: isRTL ? -1 : 1
|
|
91
|
+
}]
|
|
92
|
+
}]
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Right, {
|
|
94
|
+
fill: disabled ? colorToken.contentDisabledSecondary : colorToken.contentDisabledPrimary
|
|
95
|
+
})))));
|
|
96
|
+
};
|
|
97
|
+
const styles = StyleSheet.create({
|
|
98
|
+
container: {
|
|
99
|
+
paddingHorizontal: PADDING,
|
|
100
|
+
flexDirection: 'row',
|
|
101
|
+
alignItems: 'center'
|
|
102
|
+
},
|
|
103
|
+
left: {
|
|
104
|
+
flex: 1,
|
|
105
|
+
minHeight: THIN_HEIGHT,
|
|
106
|
+
paddingHorizontal: 4,
|
|
107
|
+
paddingVertical: 12,
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
overflow: 'hidden'
|
|
110
|
+
},
|
|
111
|
+
right: {
|
|
112
|
+
flexDirection: 'row',
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
justifyContent: 'flex-end',
|
|
115
|
+
minWidth: 52,
|
|
116
|
+
maxWidth: 116
|
|
117
|
+
},
|
|
118
|
+
rightText: {
|
|
119
|
+
flexShrink: 1,
|
|
120
|
+
flexGrow: 0,
|
|
121
|
+
textAlign: 'right',
|
|
122
|
+
marginLeft: 4
|
|
123
|
+
},
|
|
124
|
+
icon: {
|
|
125
|
+
marginLeft: 4,
|
|
126
|
+
width: ICON_SIZE,
|
|
127
|
+
height: ICON_SIZE
|
|
128
|
+
},
|
|
129
|
+
dotLight: {
|
|
130
|
+
width: DOT_SIZE,
|
|
131
|
+
height: DOT_SIZE,
|
|
132
|
+
borderRadius: DOT_RADIUS
|
|
133
|
+
},
|
|
134
|
+
leftIcon: {
|
|
135
|
+
width: 24,
|
|
136
|
+
height: 24,
|
|
137
|
+
overflow: 'hidden',
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
justifyContent: 'center',
|
|
140
|
+
marginRight: 4
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
export default LargeEntrance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LargeEntrance } from "./LargeEntrance";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccessibilityProps } from 'react-native';
|
|
3
|
+
import { SvgProps } from 'react-native-svg';
|
|
4
|
+
export interface LargeEntranceProps extends AccessibilityProps {
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle?: string | React.ReactElement;
|
|
7
|
+
value?: string;
|
|
8
|
+
onPress?: () => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
hideRightIcon?: boolean;
|
|
11
|
+
forceHideRightIconOnPressInvalid?: boolean;
|
|
12
|
+
showDot?: boolean;
|
|
13
|
+
leftIconSource?: React.ReactElement<SvgProps>;
|
|
14
|
+
customRenderer?: React.ReactElement;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useContext, useCallback, memo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LargeListEntrance, ConfigContext } from 'miot/ui/hyperOSUI';
|
|
3
3
|
import { Host, Device } from 'miot';
|
|
4
4
|
import { CarInUsed, DeviceManage } from "../../icons";
|
|
5
5
|
import { CardContainer } from "../cardContainer";
|
|
6
6
|
import { GroupContainer } from "../groupContainer";
|
|
7
|
+
import { useFeatureEnabled } from "../../utils/featureGate";
|
|
7
8
|
export const OtherSettingCard = /*#__PURE__*/memo(props => {
|
|
8
9
|
const {
|
|
9
10
|
usedInCarTip,
|
|
@@ -19,20 +20,19 @@ export const OtherSettingCard = /*#__PURE__*/memo(props => {
|
|
|
19
20
|
const toDeviceManage = useCallback(() => {
|
|
20
21
|
Host.ui.openDeviceRoamingManager(Device.deviceID);
|
|
21
22
|
}, []);
|
|
22
|
-
|
|
23
|
-
// 判断是不是米系车
|
|
24
23
|
const isMiCar = !!Device.model.startsWith('micar.car.');
|
|
24
|
+
const showDeviceRoaming = isMiCar && useFeatureEnabled('deviceRoaming');
|
|
25
25
|
return /*#__PURE__*/React.createElement(GroupContainer, {
|
|
26
26
|
title: othersTip
|
|
27
|
-
}, /*#__PURE__*/React.createElement(CardContainer, null, /*#__PURE__*/React.createElement(
|
|
28
|
-
|
|
29
|
-
fill: colorToken.
|
|
27
|
+
}, /*#__PURE__*/React.createElement(CardContainer, null, /*#__PURE__*/React.createElement(LargeListEntrance, {
|
|
28
|
+
leadingIcon: /*#__PURE__*/React.createElement(CarInUsed, {
|
|
29
|
+
fill: colorToken.contentPrimaryNormal
|
|
30
30
|
}),
|
|
31
31
|
title: usedInCarTip,
|
|
32
32
|
onPress: toUsedInCar
|
|
33
|
-
}),
|
|
34
|
-
|
|
35
|
-
fill: colorToken.
|
|
33
|
+
}), showDeviceRoaming && /*#__PURE__*/React.createElement(LargeListEntrance, {
|
|
34
|
+
leadingIcon: /*#__PURE__*/React.createElement(DeviceManage, {
|
|
35
|
+
fill: colorToken.contentPrimaryNormal
|
|
36
36
|
}),
|
|
37
37
|
title: deviceManageTip,
|
|
38
38
|
onPress: toDeviceManage
|
|
@@ -62,13 +62,13 @@ const styles = dynamicStyleSheet({
|
|
|
62
62
|
minHeight: 104
|
|
63
63
|
},
|
|
64
64
|
title: {
|
|
65
|
-
...Fonts.
|
|
66
|
-
color: defaultColorToken.
|
|
65
|
+
...Fonts.fontSystem14Medium,
|
|
66
|
+
color: defaultColorToken.contentSecondaryNormal,
|
|
67
67
|
textAlign: 'center',
|
|
68
68
|
lineHeight: 20
|
|
69
69
|
},
|
|
70
70
|
titleDisabled: {
|
|
71
|
-
color: defaultColorToken.
|
|
71
|
+
color: defaultColorToken.contentDisabledPrimary
|
|
72
72
|
},
|
|
73
73
|
buttonsContainer: {
|
|
74
74
|
flexDirection: 'row',
|
|
@@ -89,7 +89,7 @@ const styles = dynamicStyleSheet({
|
|
|
89
89
|
borderRadius: 60,
|
|
90
90
|
alignItems: 'center',
|
|
91
91
|
justifyContent: 'center',
|
|
92
|
-
backgroundColor: defaultColorToken.
|
|
92
|
+
backgroundColor: defaultColorToken.fillTertiary
|
|
93
93
|
},
|
|
94
94
|
controlIcon: {
|
|
95
95
|
width: 20,
|
|
@@ -19,7 +19,7 @@ export const SteeringWheelHotCard = /*#__PURE__*/memo(({
|
|
|
19
19
|
colorToken
|
|
20
20
|
} = useContext(ConfigContext);
|
|
21
21
|
const heatingLevelIcon = useMemo(() => {
|
|
22
|
-
const color = disabled ? colorToken.
|
|
22
|
+
const color = disabled ? colorToken.contentDisabledSecondary : colorToken.contentSecondaryNormal;
|
|
23
23
|
const icons = {
|
|
24
24
|
[SteeringWheelHotGear.OFF]: /*#__PURE__*/React.createElement(SteeringWheelHot, {
|
|
25
25
|
fill: color
|
|
@@ -59,8 +59,8 @@ const TitleContainer = ({
|
|
|
59
59
|
switch (type) {
|
|
60
60
|
case WidgetType.SWITCH:
|
|
61
61
|
return /*#__PURE__*/React.createElement(Switch, _extends({}, switchOption || {}, {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
checked: value,
|
|
63
|
+
onChange: _onValueChange,
|
|
64
64
|
disabled: disabled,
|
|
65
65
|
colorType: colorType
|
|
66
66
|
}));
|
|
@@ -84,16 +84,16 @@ const TitleContainer = ({
|
|
|
84
84
|
}, /*#__PURE__*/React.createElement(Text, _extends({
|
|
85
85
|
numberOfLines: MAX_LINE,
|
|
86
86
|
allowFontScaling: false,
|
|
87
|
-
style: [Fonts.
|
|
88
|
-
color: disabled ? colorToken.
|
|
87
|
+
style: [Fonts.fontSystem16Medium, styles.title, {
|
|
88
|
+
color: disabled ? colorToken.contentDisabledPrimary : colorToken.contentPrimaryNormal
|
|
89
89
|
}]
|
|
90
90
|
}, getAccessibilityConfig({
|
|
91
91
|
...accessibilityTitle
|
|
92
92
|
})), title)), subtitle ? subTitleIsString ? /*#__PURE__*/React.createElement(Text, _extends({
|
|
93
93
|
numberOfLines: MAX_LINE,
|
|
94
94
|
allowFontScaling: false,
|
|
95
|
-
style: [Fonts.
|
|
96
|
-
color: disabled ? colorToken.
|
|
95
|
+
style: [Fonts.fontSystem13Regular, {
|
|
96
|
+
color: disabled ? colorToken.contentDisabledPrimary : colorToken.contentTertiaryNormal
|
|
97
97
|
}]
|
|
98
98
|
}, getAccessibilityConfig({
|
|
99
99
|
...accessibilitySubtitle
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ColorType } from '../../config';
|
|
3
3
|
export declare enum RightIconType {
|
|
4
4
|
ARROW = "arrow",
|
|
5
5
|
SELECT = "select",
|
|
@@ -40,7 +40,12 @@ export interface TitleContainerProps {
|
|
|
40
40
|
colorType?: ColorType;
|
|
41
41
|
accessibilitySubtitle?: AccessibilityPropsType;
|
|
42
42
|
accessibilityTitle?: AccessibilityPropsType;
|
|
43
|
-
switchOption?:
|
|
43
|
+
switchOption?: {
|
|
44
|
+
checked?: boolean;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
onChange?: (val: boolean) => void;
|
|
47
|
+
colorType?: ColorType;
|
|
48
|
+
};
|
|
44
49
|
leftIcon?: React.ReactNode;
|
|
45
50
|
showTitleArrow?: boolean;
|
|
46
51
|
customRenderer?: React.ReactElement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useContext, memo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ConfigContext } from 'miot/ui/hyperOSUI';
|
|
3
|
+
import { LargeEntrance } from "../largeEntrance";
|
|
3
4
|
import { Warning } from "../../icons";
|
|
4
5
|
import { CardContainer } from "../cardContainer";
|
|
5
6
|
export const WarningForRunningCard = /*#__PURE__*/memo(props => {
|
|
@@ -11,7 +12,7 @@ export const WarningForRunningCard = /*#__PURE__*/memo(props => {
|
|
|
11
12
|
} = useContext(ConfigContext);
|
|
12
13
|
return /*#__PURE__*/React.createElement(CardContainer, null, /*#__PURE__*/React.createElement(LargeEntrance, {
|
|
13
14
|
leftIconSource: /*#__PURE__*/React.createElement(Warning, {
|
|
14
|
-
fill: colorToken.
|
|
15
|
+
fill: colorToken.accentYellowFill
|
|
15
16
|
}),
|
|
16
17
|
title: carRunningTip,
|
|
17
18
|
hideRightIcon: true,
|
package/dist/config/index.d.ts
CHANGED
|
@@ -8,9 +8,12 @@ export declare const SteeringWheelHotGear: {
|
|
|
8
8
|
readonly 'Level 2': "Level 2";
|
|
9
9
|
readonly 'Level 3': "Level 3";
|
|
10
10
|
};
|
|
11
|
+
export declare const COLOR_TYPES: readonly ["green", "blue", "wathet", "purple", "orange"];
|
|
12
|
+
export type ColorType = (typeof COLOR_TYPES)[number];
|
|
11
13
|
export * from './seatGearLevel';
|
|
12
14
|
export * from './seatFunctionType';
|
|
13
15
|
export * from './seatPosition';
|
|
14
16
|
export * from './seatRowConfig';
|
|
15
17
|
export * from './seatI18nKeys';
|
|
16
18
|
export * from './ConnectStatus';
|
|
19
|
+
export * from './overseasConfig';
|
package/dist/config/index.js
CHANGED
|
@@ -8,9 +8,11 @@ export const SteeringWheelHotGear = {
|
|
|
8
8
|
'Level 2': 'Level 2',
|
|
9
9
|
'Level 3': 'Level 3'
|
|
10
10
|
};
|
|
11
|
+
export const COLOR_TYPES = ['green', 'blue', 'wathet', 'purple', 'orange'];
|
|
11
12
|
export * from "./seatGearLevel";
|
|
12
13
|
export * from "./seatFunctionType";
|
|
13
14
|
export * from "./seatPosition";
|
|
14
15
|
export * from "./seatRowConfig";
|
|
15
16
|
export * from "./seatI18nKeys";
|
|
16
|
-
export * from "./ConnectStatus";
|
|
17
|
+
export * from "./ConnectStatus";
|
|
18
|
+
export * from "./overseasConfig";
|
|
@@ -35,8 +35,8 @@ export const useDualRangeData = ({
|
|
|
35
35
|
return 'km';
|
|
36
36
|
}, []);
|
|
37
37
|
const getDualRangeDisplayData = useCallback(() => {
|
|
38
|
-
const electricColor = colorToken.
|
|
39
|
-
const fuelColor = colorToken.
|
|
38
|
+
const electricColor = colorToken.accentGreenFill;
|
|
39
|
+
const fuelColor = colorToken.contentSecondaryNormal;
|
|
40
40
|
const dcdType = Number(dcdRangeSOCTypeDisplayValue);
|
|
41
41
|
const cltcEstimatedExtendEange = Number(cltcEstimatedExtendEangeValue);
|
|
42
42
|
const cltcFuelEndurance = Number(cltcFuelEnduranceValue);
|
|
@@ -22,16 +22,16 @@ export const useParkingStatusData = ({
|
|
|
22
22
|
const sentryWorkModeValue = useSpecState(specSentryInfoPropertiesSentryWorkMode);
|
|
23
23
|
const parkingStatusIcon = useMemo(() => ({
|
|
24
24
|
errorStatusIcon: /*#__PURE__*/React.createElement(ErrorStatus, {
|
|
25
|
-
fill: colorToken.
|
|
25
|
+
fill: colorToken.accentRedFill
|
|
26
26
|
}),
|
|
27
27
|
loadingIcon: /*#__PURE__*/React.createElement(Loading, {
|
|
28
|
-
stroke: colorToken.
|
|
28
|
+
stroke: colorToken.contentTertiaryNormal
|
|
29
29
|
}),
|
|
30
30
|
parkingStatusIcon: /*#__PURE__*/React.createElement(ParkingIcon, {
|
|
31
|
-
fill: colorToken.
|
|
31
|
+
fill: colorToken.contentTertiaryNormal
|
|
32
32
|
}),
|
|
33
33
|
sentryModeIcon: /*#__PURE__*/React.createElement(SentryMode, {
|
|
34
|
-
fill: colorToken.
|
|
34
|
+
fill: colorToken.contentTertiaryNormal
|
|
35
35
|
})
|
|
36
36
|
}), [colorToken]);
|
|
37
37
|
const enterSentryInfoWorkMode = useMemo(() => {
|
|
@@ -50,7 +50,7 @@ export const useParkingStatusData = ({
|
|
|
50
50
|
const gearStatus = Number(gearStatusValue);
|
|
51
51
|
const centralLockState = Number(centralLockStateValue);
|
|
52
52
|
const textStyle = {
|
|
53
|
-
color: colorToken.
|
|
53
|
+
color: colorToken.contentTertiaryNormal
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
// 1. Connecting
|
|
@@ -8,54 +8,54 @@ import { GearLevel, HeatingStateOrder, VentilationStateOrder, SeatI18nKeys } fro
|
|
|
8
8
|
export const LEVEL_ICONS = colorToken => ({
|
|
9
9
|
heating: {
|
|
10
10
|
Off: /*#__PURE__*/React.createElement(SeatGearHeatingOff, {
|
|
11
|
-
fill: colorToken.
|
|
11
|
+
fill: colorToken.contentSecondaryNormal
|
|
12
12
|
}),
|
|
13
13
|
OffDisabled: /*#__PURE__*/React.createElement(SeatGearHeatingOff, {
|
|
14
|
-
fill: colorToken.
|
|
14
|
+
fill: colorToken.contentDisabledSecondary
|
|
15
15
|
}),
|
|
16
16
|
Three: /*#__PURE__*/React.createElement(SeatGearHeatingLevelThree, {
|
|
17
|
-
fill: colorToken.
|
|
17
|
+
fill: colorToken.staticWhite
|
|
18
18
|
}),
|
|
19
19
|
ThreeDisabled: /*#__PURE__*/React.createElement(SeatGearHeatingLevelThree, {
|
|
20
|
-
fill: colorToken.
|
|
20
|
+
fill: colorToken.contentInverseDisabled
|
|
21
21
|
}),
|
|
22
22
|
Two: /*#__PURE__*/React.createElement(SeatGearHeatingLevelTwo, {
|
|
23
|
-
fill: colorToken.
|
|
23
|
+
fill: colorToken.staticWhite
|
|
24
24
|
}),
|
|
25
25
|
TwoDisabled: /*#__PURE__*/React.createElement(SeatGearHeatingLevelTwo, {
|
|
26
|
-
fill: colorToken.
|
|
26
|
+
fill: colorToken.contentInverseDisabled
|
|
27
27
|
}),
|
|
28
28
|
One: /*#__PURE__*/React.createElement(SeatGearHeatingLevelOne, {
|
|
29
|
-
fill: colorToken.
|
|
29
|
+
fill: colorToken.staticWhite
|
|
30
30
|
}),
|
|
31
31
|
OneDisabled: /*#__PURE__*/React.createElement(SeatGearHeatingLevelOne, {
|
|
32
|
-
fill: colorToken.
|
|
32
|
+
fill: colorToken.contentInverseDisabled
|
|
33
33
|
})
|
|
34
34
|
},
|
|
35
35
|
ventilation: {
|
|
36
36
|
Off: /*#__PURE__*/React.createElement(SeatGearVentilationOff, {
|
|
37
|
-
fill: colorToken.
|
|
37
|
+
fill: colorToken.contentSecondaryNormal
|
|
38
38
|
}),
|
|
39
39
|
OffDisabled: /*#__PURE__*/React.createElement(SeatGearVentilationOff, {
|
|
40
|
-
fill: colorToken.
|
|
40
|
+
fill: colorToken.contentDisabledSecondary
|
|
41
41
|
}),
|
|
42
42
|
Three: /*#__PURE__*/React.createElement(SeatGearVentilationLevelThree, {
|
|
43
|
-
fill: colorToken.
|
|
43
|
+
fill: colorToken.staticWhite
|
|
44
44
|
}),
|
|
45
45
|
ThreeDisabled: /*#__PURE__*/React.createElement(SeatGearVentilationLevelThree, {
|
|
46
|
-
fill: colorToken.
|
|
46
|
+
fill: colorToken.contentInverseDisabled
|
|
47
47
|
}),
|
|
48
48
|
Two: /*#__PURE__*/React.createElement(SeatGearVentilationLevelTwo, {
|
|
49
|
-
fill: colorToken.
|
|
49
|
+
fill: colorToken.staticWhite
|
|
50
50
|
}),
|
|
51
51
|
TwoDisabled: /*#__PURE__*/React.createElement(SeatGearVentilationLevelTwo, {
|
|
52
|
-
fill: colorToken.
|
|
52
|
+
fill: colorToken.contentInverseDisabled
|
|
53
53
|
}),
|
|
54
54
|
One: /*#__PURE__*/React.createElement(SeatGearVentilationLevelOne, {
|
|
55
|
-
fill: colorToken.
|
|
55
|
+
fill: colorToken.staticWhite
|
|
56
56
|
}),
|
|
57
57
|
OneDisabled: /*#__PURE__*/React.createElement(SeatGearVentilationLevelOne, {
|
|
58
|
-
fill: colorToken.
|
|
58
|
+
fill: colorToken.contentInverseDisabled
|
|
59
59
|
})
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -63,20 +63,20 @@ export const TYPE_CONFIG = (colorToken, levelIcons) => ({
|
|
|
63
63
|
heating: {
|
|
64
64
|
order: HeatingStateOrder,
|
|
65
65
|
colors: {
|
|
66
|
-
on: colorToken.
|
|
67
|
-
onDisabled: colorToken.
|
|
68
|
-
off: colorToken.
|
|
69
|
-
offDisabled: colorToken.
|
|
66
|
+
on: colorToken.accentOrangeFill,
|
|
67
|
+
onDisabled: colorToken.accentOrangeLow,
|
|
68
|
+
off: colorToken.fillSecondary,
|
|
69
|
+
offDisabled: colorToken.fillTertiary
|
|
70
70
|
},
|
|
71
71
|
icons: levelIcons.heating
|
|
72
72
|
},
|
|
73
73
|
ventilation: {
|
|
74
74
|
order: VentilationStateOrder,
|
|
75
75
|
colors: {
|
|
76
|
-
on: colorToken.
|
|
77
|
-
onDisabled: colorToken.
|
|
78
|
-
off: colorToken.
|
|
79
|
-
offDisabled: colorToken.
|
|
76
|
+
on: colorToken.accentBlueFill,
|
|
77
|
+
onDisabled: colorToken.accentBlueLow,
|
|
78
|
+
off: colorToken.fillSecondary,
|
|
79
|
+
offDisabled: colorToken.fillTertiary
|
|
80
80
|
},
|
|
81
81
|
icons: levelIcons.ventilation
|
|
82
82
|
}
|
|
@@ -40,11 +40,11 @@ export const useSingleRangeData = ({
|
|
|
40
40
|
currentRange: 0,
|
|
41
41
|
totalRange: 100,
|
|
42
42
|
unit: '%',
|
|
43
|
-
color: colorToken.
|
|
43
|
+
color: colorToken.accentGreenContent
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
const dcdType = Number(dcdRangeSOCTypeDisplayValue);
|
|
47
|
-
let color = colorToken.
|
|
47
|
+
let color = colorToken.accentGreenContent;
|
|
48
48
|
const lowSocWarning = Number(lowSocWarningValue);
|
|
49
49
|
const batterySoCDisplay = Number(batterySoCDisplayValue);
|
|
50
50
|
const batteryEstimatedMileage = Number(batteryEstimatedMileageValue);
|
|
@@ -52,9 +52,9 @@ export const useSingleRangeData = ({
|
|
|
52
52
|
|
|
53
53
|
// Determine color based on low SOC warning level
|
|
54
54
|
if (getValueBySpecDescription(specPowerBatteryPropertiesLowSocWarning, 'Level2 Warning') === lowSocWarning) {
|
|
55
|
-
color = colorToken.
|
|
55
|
+
color = colorToken.accentYellowFill;
|
|
56
56
|
} else if (getValueBySpecDescription(specPowerBatteryPropertiesLowSocWarning, 'Level1 Warning') === lowSocWarning) {
|
|
57
|
-
color = colorToken.
|
|
57
|
+
color = colorToken.accentRedContent;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// 1. Battery SOC percentage
|
|
@@ -90,7 +90,7 @@ export const useSingleRangeData = ({
|
|
|
90
90
|
currentRange: 0,
|
|
91
91
|
totalRange: 100,
|
|
92
92
|
unit: '%',
|
|
93
|
-
color: colorToken.
|
|
93
|
+
color: colorToken.accentGreenContent
|
|
94
94
|
};
|
|
95
95
|
}, [dcdRangeSOCTypeDisplayValue, lowSocWarningValue, batterySoCDisplayValue, batteryEstimatedMileageValue, cltcEstimatedRangeValue, specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, specPowerBatteryPropertiesLowSocWarning, specPowerBatteryPropertiesBatterySoCDisplay, specPowerBatteryPropertiesBatteryEstimatedMileage, specPowerBatteryPropertiesCLTCEstimatedRange, distanceUnit, colorToken]);
|
|
96
96
|
return useMemo(() => getRangeDisplayData(), [getRangeDisplayData]);
|
package/dist/index.d.ts
CHANGED
|
@@ -2,20 +2,22 @@ export { AirConditioningCard } from './components/airConditioningCard';
|
|
|
2
2
|
export { CardContainer } from './components/cardContainer';
|
|
3
3
|
export { default as ContainerWithGap } from './components/containerWithGap';
|
|
4
4
|
export { FlatSelect, FlatOption } from './components/flatSelect';
|
|
5
|
+
export { LargeEntrance, type LargeEntranceProps } from './components/largeEntrance';
|
|
5
6
|
export { GroupContainer } from './components/groupContainer';
|
|
6
7
|
export { OtherSettingCard } from './components/otherSettingCard';
|
|
7
8
|
export { SteeringWheelHotCard } from './components/steeringWheelHotCard';
|
|
8
9
|
export { TitleContainer } from './components/titleContainer';
|
|
9
10
|
export { WarningForRunningCard } from './components/warningForRunningCard';
|
|
10
11
|
export { CarInfoHeader } from './components/carInfoHeader';
|
|
11
|
-
export type { SingleRangeData, DualRangeData, ParkingStatusData, CarInfoHeaderProps
|
|
12
|
-
export { SeatControl, type SeatControlProps, type ControlButtonConfig, type OnButtonPressParams } from './components/seatControl';
|
|
12
|
+
export type { SingleRangeData, DualRangeData, ParkingStatusData, CarInfoHeaderProps } from './components/carInfoHeader';
|
|
13
|
+
export { SeatControl, type SeatControlProps, type ControlButtonConfig, type OnButtonPressParams, } from './components/seatControl';
|
|
13
14
|
export { SeatCard, type SeatCardProps } from './components/seatControl/seatCard';
|
|
14
15
|
export { PageBackground, type PageBackgroundProps } from './components/pageBackground';
|
|
15
16
|
export { SeatControlGroup, type SeatControlGroupProps, type SeatConfig } from './components/seatControlGroup';
|
|
16
17
|
export { useSingleRangeData, type RangeDisplayData, type UseSingleRangeDataProps } from './hooks/useSingleRangeData';
|
|
17
18
|
export { useDualRangeData, type DualRangeDisplayData, type UseDualRangeDataProps } from './hooks/useDualRangeData';
|
|
18
|
-
export { useParkingStatusData, type ParkingStatusInfo, type UseParkingStatusDataProps } from './hooks/useParkingStatusData';
|
|
19
|
-
export { useSeatControlData, type SeatControlDataProps, SeatSpecs, LEVEL_ICONS, TYPE_CONFIG, SEAT_TITLES } from './hooks/useSeatControlData';
|
|
19
|
+
export { useParkingStatusData, type ParkingStatusInfo, type UseParkingStatusDataProps, } from './hooks/useParkingStatusData';
|
|
20
|
+
export { useSeatControlData, type SeatControlDataProps, SeatSpecs, LEVEL_ICONS, TYPE_CONFIG, SEAT_TITLES, } from './hooks/useSeatControlData';
|
|
20
21
|
export * from './config';
|
|
21
22
|
export * from './modules';
|
|
23
|
+
export { isOverseas, isFeatureEnabled, useFeatureEnabled, type FeatureKey } from './utils/featureGate';
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { AirConditioningCard } from "./components/airConditioningCard";
|
|
|
2
2
|
export { CardContainer } from "./components/cardContainer";
|
|
3
3
|
export { default as ContainerWithGap } from "./components/containerWithGap";
|
|
4
4
|
export { FlatSelect, FlatOption } from "./components/flatSelect";
|
|
5
|
+
export { LargeEntrance } from "./components/largeEntrance";
|
|
5
6
|
export { GroupContainer } from "./components/groupContainer";
|
|
6
7
|
export { OtherSettingCard } from "./components/otherSettingCard";
|
|
7
8
|
export { SteeringWheelHotCard } from "./components/steeringWheelHotCard";
|
|
@@ -17,4 +18,5 @@ export { useDualRangeData } from "./hooks/useDualRangeData";
|
|
|
17
18
|
export { useParkingStatusData } from "./hooks/useParkingStatusData";
|
|
18
19
|
export { useSeatControlData, SeatSpecs, LEVEL_ICONS, TYPE_CONFIG, SEAT_TITLES } from "./hooks/useSeatControlData";
|
|
19
20
|
export * from "./config";
|
|
20
|
-
export * from "./modules";
|
|
21
|
+
export * from "./modules";
|
|
22
|
+
export { isOverseas, isFeatureEnabled, useFeatureEnabled } from "./utils/featureGate";
|
|
@@ -158,7 +158,7 @@ const MyCustomAirCondition = ({ specs }) => {
|
|
|
158
158
|
return (
|
|
159
159
|
<View>
|
|
160
160
|
<Text>{hvacTitle}</Text>
|
|
161
|
-
<Switch
|
|
161
|
+
<Switch checked={transformHvacStatus} onChange={onHvacStatusChange} />
|
|
162
162
|
<Text>{insideCarTip}</Text>
|
|
163
163
|
<Text>{outsideCarTip}</Text>
|
|
164
164
|
<Slider
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type FeatureKey = 'deviceRoaming' | 'smartScene' | 'automationEdit' | 'manualControlEdit';
|
|
2
|
+
export declare const initFeatureGate: () => Promise<void>;
|
|
3
|
+
export declare const isOverseas: () => boolean;
|
|
4
|
+
export declare const isFeatureEnabled: (key: FeatureKey) => boolean;
|
|
5
|
+
export declare const useFeatureEnabled: (key: FeatureKey) => boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Service } from 'miot';
|
|
2
|
+
import { create } from 'zustand';
|
|
3
|
+
const OVERSEAS_DISABLED = {
|
|
4
|
+
deviceRoaming: true,
|
|
5
|
+
smartScene: true,
|
|
6
|
+
automationEdit: true,
|
|
7
|
+
manualControlEdit: true
|
|
8
|
+
};
|
|
9
|
+
const useFeatureGateStore = create(() => ({
|
|
10
|
+
isOverseas: false,
|
|
11
|
+
initialized: false
|
|
12
|
+
}));
|
|
13
|
+
export const initFeatureGate = () => {
|
|
14
|
+
if (useFeatureGateStore.getState().initialized) return Promise.resolve();
|
|
15
|
+
return Service.getServerName().then(res => {
|
|
16
|
+
const overseas = (res?.serverCode || 'cn') !== 'cn';
|
|
17
|
+
console.log(`[FeatureGate] init done: serverCode=${res?.serverCode}, isOverseas=${overseas}`);
|
|
18
|
+
useFeatureGateStore.setState({
|
|
19
|
+
isOverseas: overseas,
|
|
20
|
+
initialized: true
|
|
21
|
+
});
|
|
22
|
+
}).catch(() => {
|
|
23
|
+
useFeatureGateStore.setState({
|
|
24
|
+
initialized: true
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export const isOverseas = () => useFeatureGateStore.getState().isOverseas;
|
|
29
|
+
export const isFeatureEnabled = key => !(useFeatureGateStore.getState().isOverseas && OVERSEAS_DISABLED[key]);
|
|
30
|
+
export const useFeatureEnabled = key => {
|
|
31
|
+
const overseas = useFeatureGateStore(s => s.isOverseas);
|
|
32
|
+
return !(overseas && OVERSEAS_DISABLED[key]);
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miot-rn/car-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"react-native": "^0.61.0",
|
|
24
24
|
"react-native-svg": "9.5.3"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "2920def2cc542a8d0efcf100814e477830d94bb3"
|
|
27
27
|
}
|