@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.
Files changed (242) hide show
  1. package/README.md +325 -0
  2. package/dist/assets/i18n/ar.d.ts +55 -0
  3. package/dist/assets/i18n/ar.js +55 -0
  4. package/dist/assets/i18n/bo.d.ts +55 -0
  5. package/dist/assets/i18n/bo.js +55 -0
  6. package/dist/assets/i18n/cs.d.ts +55 -0
  7. package/dist/assets/i18n/cs.js +55 -0
  8. package/dist/assets/i18n/de.d.ts +55 -0
  9. package/dist/assets/i18n/de.js +55 -0
  10. package/dist/assets/i18n/el.d.ts +55 -0
  11. package/dist/assets/i18n/el.js +55 -0
  12. package/dist/assets/i18n/en.d.ts +55 -0
  13. package/dist/assets/i18n/en.js +55 -0
  14. package/dist/assets/i18n/es.d.ts +55 -0
  15. package/dist/assets/i18n/es.js +55 -0
  16. package/dist/assets/i18n/es_us.d.ts +55 -0
  17. package/dist/assets/i18n/es_us.js +55 -0
  18. package/dist/assets/i18n/fi.d.ts +55 -0
  19. package/dist/assets/i18n/fi.js +55 -0
  20. package/dist/assets/i18n/fr.d.ts +55 -0
  21. package/dist/assets/i18n/fr.js +55 -0
  22. package/dist/assets/i18n/he.d.ts +55 -0
  23. package/dist/assets/i18n/he.js +55 -0
  24. package/dist/assets/i18n/hu.d.ts +55 -0
  25. package/dist/assets/i18n/hu.js +55 -0
  26. package/dist/assets/i18n/id.d.ts +55 -0
  27. package/dist/assets/i18n/id.js +55 -0
  28. package/dist/assets/i18n/it.d.ts +55 -0
  29. package/dist/assets/i18n/it.js +55 -0
  30. package/dist/assets/i18n/ja.d.ts +55 -0
  31. package/dist/assets/i18n/ja.js +55 -0
  32. package/dist/assets/i18n/ko.d.ts +55 -0
  33. package/dist/assets/i18n/ko.js +55 -0
  34. package/dist/assets/i18n/nb.d.ts +55 -0
  35. package/dist/assets/i18n/nb.js +55 -0
  36. package/dist/assets/i18n/nl.d.ts +55 -0
  37. package/dist/assets/i18n/nl.js +55 -0
  38. package/dist/assets/i18n/pl.d.ts +55 -0
  39. package/dist/assets/i18n/pl.js +55 -0
  40. package/dist/assets/i18n/pt.d.ts +55 -0
  41. package/dist/assets/i18n/pt.js +55 -0
  42. package/dist/assets/i18n/pt_pt.d.ts +55 -0
  43. package/dist/assets/i18n/pt_pt.js +55 -0
  44. package/dist/assets/i18n/ro.d.ts +55 -0
  45. package/dist/assets/i18n/ro.js +55 -0
  46. package/dist/assets/i18n/ru.d.ts +55 -0
  47. package/dist/assets/i18n/ru.js +55 -0
  48. package/dist/assets/i18n/sk.d.ts +55 -0
  49. package/dist/assets/i18n/sk.js +55 -0
  50. package/dist/assets/i18n/sv.d.ts +55 -0
  51. package/dist/assets/i18n/sv.js +55 -0
  52. package/dist/assets/i18n/th.d.ts +55 -0
  53. package/dist/assets/i18n/th.js +55 -0
  54. package/dist/assets/i18n/tr.d.ts +55 -0
  55. package/dist/assets/i18n/tr.js +55 -0
  56. package/dist/assets/i18n/uk.d.ts +55 -0
  57. package/dist/assets/i18n/uk.js +55 -0
  58. package/dist/assets/i18n/vi.d.ts +55 -0
  59. package/dist/assets/i18n/vi.js +55 -0
  60. package/dist/assets/i18n/zh.d.ts +55 -0
  61. package/dist/assets/i18n/zh.js +55 -0
  62. package/dist/assets/i18n/zh_hk.d.ts +55 -0
  63. package/dist/assets/i18n/zh_hk.js +55 -0
  64. package/dist/assets/i18n/zh_tw.d.ts +55 -0
  65. package/dist/assets/i18n/zh_tw.js +55 -0
  66. package/dist/assets/image/dark/car_background_dark.png +0 -0
  67. package/dist/assets/image/default/car_background.png +0 -0
  68. package/dist/components/airConditioningCard/index.d.ts +24 -0
  69. package/dist/components/airConditioningCard/index.js +103 -0
  70. package/dist/components/carInfoHeader/carImage.d.ts +8 -0
  71. package/dist/components/carInfoHeader/carImage.js +42 -0
  72. package/dist/components/carInfoHeader/dualRangeIndicator.d.ts +15 -0
  73. package/dist/components/carInfoHeader/dualRangeIndicator.js +124 -0
  74. package/dist/components/carInfoHeader/index.d.ts +37 -0
  75. package/dist/components/carInfoHeader/index.js +118 -0
  76. package/dist/components/carInfoHeader/parkingStatus.d.ts +12 -0
  77. package/dist/components/carInfoHeader/parkingStatus.js +100 -0
  78. package/dist/components/carInfoHeader/rangeProgressBar.d.ts +14 -0
  79. package/dist/components/carInfoHeader/rangeProgressBar.js +77 -0
  80. package/dist/components/carInfoHeader/singleRangeIndicator.d.ts +11 -0
  81. package/dist/components/carInfoHeader/singleRangeIndicator.js +58 -0
  82. package/dist/components/cardContainer/index.d.ts +8 -0
  83. package/dist/components/cardContainer/index.js +22 -0
  84. package/dist/components/containerWithGap/gapWrap.d.ts +8 -0
  85. package/dist/components/containerWithGap/gapWrap.js +31 -0
  86. package/dist/components/containerWithGap/index.d.ts +12 -0
  87. package/dist/components/containerWithGap/index.js +43 -0
  88. package/dist/components/flatSelect/FlatOption.d.ts +18 -0
  89. package/dist/components/flatSelect/FlatOption.js +117 -0
  90. package/dist/components/flatSelect/FlatSelect.d.ts +14 -0
  91. package/dist/components/flatSelect/FlatSelect.js +112 -0
  92. package/dist/components/flatSelect/index.d.ts +2 -0
  93. package/dist/components/flatSelect/index.js +2 -0
  94. package/dist/components/flatSelect/index.zh-CN.md +89 -0
  95. package/dist/components/groupContainer/index.d.ts +9 -0
  96. package/dist/components/groupContainer/index.js +48 -0
  97. package/dist/components/otherSettingCard/index.d.ts +8 -0
  98. package/dist/components/otherSettingCard/index.js +40 -0
  99. package/dist/components/pageBackground/index.d.ts +7 -0
  100. package/dist/components/pageBackground/index.js +22 -0
  101. package/dist/components/seatControl/index.d.ts +34 -0
  102. package/dist/components/seatControl/index.js +98 -0
  103. package/dist/components/seatControl/seatCard.d.ts +11 -0
  104. package/dist/components/seatControl/seatCard.js +24 -0
  105. package/dist/components/seatControl/seatCardRow.d.ts +29 -0
  106. package/dist/components/seatControl/seatCardRow.js +48 -0
  107. package/dist/components/seatControlGroup/index.d.ts +40 -0
  108. package/dist/components/seatControlGroup/index.js +51 -0
  109. package/dist/components/steeringWheelHotCard/index.d.ts +17 -0
  110. package/dist/components/steeringWheelHotCard/index.js +66 -0
  111. package/dist/components/titleContainer/TitleContainer.d.ts +4 -0
  112. package/dist/components/titleContainer/TitleContainer.js +148 -0
  113. package/dist/components/titleContainer/TitleContainer.zh-CN.md +62 -0
  114. package/dist/components/titleContainer/index.d.ts +1 -0
  115. package/dist/components/titleContainer/index.js +1 -0
  116. package/dist/components/titleContainer/interface.d.ts +48 -0
  117. package/dist/components/titleContainer/interface.js +21 -0
  118. package/dist/components/warningForRunningCard/index.d.ts +6 -0
  119. package/dist/components/warningForRunningCard/index.js +20 -0
  120. package/dist/config/ConnectStatus.d.ts +7 -0
  121. package/dist/config/ConnectStatus.js +8 -0
  122. package/dist/config/index.d.ts +16 -0
  123. package/dist/config/index.js +16 -0
  124. package/dist/config/seatFunctionType.d.ts +7 -0
  125. package/dist/config/seatFunctionType.js +24 -0
  126. package/dist/config/seatGearLevel.d.ts +21 -0
  127. package/dist/config/seatGearLevel.js +19 -0
  128. package/dist/config/seatI18nKeys.d.ts +9 -0
  129. package/dist/config/seatI18nKeys.js +9 -0
  130. package/dist/config/seatPosition.d.ts +8 -0
  131. package/dist/config/seatPosition.js +8 -0
  132. package/dist/config/seatRowConfig.d.ts +6 -0
  133. package/dist/config/seatRowConfig.js +6 -0
  134. package/dist/global.d.js +0 -0
  135. package/dist/hooks/CONNECT_STATUS.d.ts +6 -0
  136. package/dist/hooks/CONNECT_STATUS.js +5 -0
  137. package/dist/hooks/index.d.ts +6 -0
  138. package/dist/hooks/index.js +7 -0
  139. package/dist/hooks/useAirConditionData.d.ts +29 -0
  140. package/dist/hooks/useAirConditionData.js +89 -0
  141. package/dist/hooks/useDualRangeData.d.ts +18 -0
  142. package/dist/hooks/useDualRangeData.js +82 -0
  143. package/dist/hooks/useParkingStatusData.d.ts +19 -0
  144. package/dist/hooks/useParkingStatusData.js +100 -0
  145. package/dist/hooks/useSeatControlData.d.ts +94 -0
  146. package/dist/hooks/useSeatControlData.js +251 -0
  147. package/dist/hooks/useSingleRangeData.d.ts +15 -0
  148. package/dist/hooks/useSingleRangeData.js +97 -0
  149. package/dist/hooks/useSteeringWheelData.d.ts +11 -0
  150. package/dist/hooks/useSteeringWheelData.js +56 -0
  151. package/dist/icons/CarInUsed.d.ts +4 -0
  152. package/dist/icons/CarInUsed.js +13 -0
  153. package/dist/icons/DeviceManage.d.ts +4 -0
  154. package/dist/icons/DeviceManage.js +13 -0
  155. package/dist/icons/ElectricPower.d.ts +4 -0
  156. package/dist/icons/ElectricPower.js +13 -0
  157. package/dist/icons/ErrorStatus.d.ts +4 -0
  158. package/dist/icons/ErrorStatus.js +13 -0
  159. package/dist/icons/FuelPower.d.ts +4 -0
  160. package/dist/icons/FuelPower.js +18 -0
  161. package/dist/icons/Loading.d.ts +4 -0
  162. package/dist/icons/Loading.js +16 -0
  163. package/dist/icons/MijiaLogo.d.ts +4 -0
  164. package/dist/icons/MijiaLogo.js +16 -0
  165. package/dist/icons/Minus.d.ts +4 -0
  166. package/dist/icons/Minus.js +15 -0
  167. package/dist/icons/ParkingStatus.d.ts +4 -0
  168. package/dist/icons/ParkingStatus.js +15 -0
  169. package/dist/icons/SeatGearHeatingLevelOne.d.ts +4 -0
  170. package/dist/icons/SeatGearHeatingLevelOne.js +22 -0
  171. package/dist/icons/SeatGearHeatingLevelThree.d.ts +4 -0
  172. package/dist/icons/SeatGearHeatingLevelThree.js +18 -0
  173. package/dist/icons/SeatGearHeatingLevelTwo.d.ts +4 -0
  174. package/dist/icons/SeatGearHeatingLevelTwo.js +22 -0
  175. package/dist/icons/SeatGearHeatingOff.d.ts +4 -0
  176. package/dist/icons/SeatGearHeatingOff.js +18 -0
  177. package/dist/icons/SeatGearVentilationLevelOne.d.ts +4 -0
  178. package/dist/icons/SeatGearVentilationLevelOne.js +17 -0
  179. package/dist/icons/SeatGearVentilationLevelThree.d.ts +4 -0
  180. package/dist/icons/SeatGearVentilationLevelThree.js +13 -0
  181. package/dist/icons/SeatGearVentilationLevelTwo.d.ts +4 -0
  182. package/dist/icons/SeatGearVentilationLevelTwo.js +17 -0
  183. package/dist/icons/SeatGearVentilationOff.d.ts +4 -0
  184. package/dist/icons/SeatGearVentilationOff.js +16 -0
  185. package/dist/icons/SentryMode.d.ts +4 -0
  186. package/dist/icons/SentryMode.js +13 -0
  187. package/dist/icons/SmartScene.d.ts +4 -0
  188. package/dist/icons/SmartScene.js +13 -0
  189. package/dist/icons/SteeringWheelFirstGear.d.ts +4 -0
  190. package/dist/icons/SteeringWheelFirstGear.js +13 -0
  191. package/dist/icons/SteeringWheelHot.d.ts +4 -0
  192. package/dist/icons/SteeringWheelHot.js +13 -0
  193. package/dist/icons/SteeringWheelSecondGear.d.ts +4 -0
  194. package/dist/icons/SteeringWheelSecondGear.js +13 -0
  195. package/dist/icons/SteeringWheelThirdGear.d.ts +4 -0
  196. package/dist/icons/SteeringWheelThirdGear.js +13 -0
  197. package/dist/icons/Warning.d.ts +4 -0
  198. package/dist/icons/Warning.js +13 -0
  199. package/dist/icons/index.d.ts +24 -0
  200. package/dist/icons/index.js +27 -0
  201. package/dist/index.d.ts +21 -0
  202. package/dist/index.js +20 -0
  203. package/dist/modules/MODULES.md +245 -0
  204. package/dist/modules/airconditionModule/README.md +262 -0
  205. package/dist/modules/airconditionModule/index.d.ts +17 -0
  206. package/dist/modules/airconditionModule/index.js +63 -0
  207. package/dist/modules/carInfoModule/README.md +418 -0
  208. package/dist/modules/carInfoModule/index.d.ts +26 -0
  209. package/dist/modules/carInfoModule/index.js +67 -0
  210. package/dist/modules/index.d.ts +2 -0
  211. package/dist/modules/index.js +2 -0
  212. package/dist/modules/seatModule/README.md +345 -0
  213. package/dist/modules/seatModule/index.d.ts +15 -0
  214. package/dist/modules/seatModule/index.js +40 -0
  215. package/dist/modules/steeringWheelModule/README.md +216 -0
  216. package/dist/modules/steeringWheelModule/index.d.ts +13 -0
  217. package/dist/modules/steeringWheelModule/index.js +31 -0
  218. package/dist/resources/i18n.d.ts +1730 -0
  219. package/dist/resources/i18n.js +84 -0
  220. package/dist/resources/images.d.ts +1 -0
  221. package/dist/resources/images.js +45 -0
  222. package/dist/spec/index.d.ts +494 -0
  223. package/dist/spec/index.js +911 -0
  224. package/dist/types.d.ts +63 -0
  225. package/dist/types.js +1 -0
  226. package/dist/utils/checkSameValue.d.ts +1 -0
  227. package/dist/utils/checkSameValue.js +11 -0
  228. package/dist/utils/fns.d.ts +5 -0
  229. package/dist/utils/fns.js +167 -0
  230. package/dist/utils/get-value-or-default.d.ts +1 -0
  231. package/dist/utils/get-value-or-default.js +4 -0
  232. package/dist/utils/getLocalI18n.d.ts +1 -0
  233. package/dist/utils/getLocalI18n.js +9 -0
  234. package/dist/utils/i18n.d.ts +1 -0
  235. package/dist/utils/i18n.js +141 -0
  236. package/dist/utils/objects.d.ts +2 -0
  237. package/dist/utils/objects.js +222 -0
  238. package/dist/utils/spec.d.ts +8 -0
  239. package/dist/utils/spec.js +171 -0
  240. package/dist/utils/types.d.ts +3 -0
  241. package/dist/utils/types.js +25 -0
  242. package/package.json +27 -0
@@ -0,0 +1,100 @@
1
+ /* eslint-disable no-console */
2
+ import React, { useMemo, useCallback, useContext } from 'react';
3
+ import { useSpecState } from '@miot-rn/common-component/dist/store/useGlobalSpecManager';
4
+ import { getValueBySpecDescription } from '@miot-rn/common-component/dist/specs/instance-parser';
5
+ import { getLocalI18n } from '@miot-rn/common-component/dist/specs/i18n-parser';
6
+ import { ConfigContext } from 'miot/ui/hyperOSUI';
7
+ import { ErrorStatus, Loading, ParkingStatus as ParkingIcon, SentryMode } from "../icons";
8
+ import { ConnectStatus } from "../config";
9
+ export const useParkingStatusData = ({
10
+ specBodyGearPropertiesGearStatus,
11
+ specBodyPowerModePropertiesPowerModeState,
12
+ specDoorCentralLockPropertiesCentralLockState,
13
+ specSentryInfoPropertiesSentryWorkMode,
14
+ connectStatus = ConnectStatus.CONNECTING
15
+ }) => {
16
+ const {
17
+ colorToken
18
+ } = useContext(ConfigContext);
19
+ const gearStatusValue = useSpecState(specBodyGearPropertiesGearStatus);
20
+ const powerModeStateValue = useSpecState(specBodyPowerModePropertiesPowerModeState);
21
+ const centralLockStateValue = useSpecState(specDoorCentralLockPropertiesCentralLockState);
22
+ const sentryWorkModeValue = useSpecState(specSentryInfoPropertiesSentryWorkMode);
23
+ const parkingStatusIcon = useMemo(() => ({
24
+ errorStatusIcon: /*#__PURE__*/React.createElement(ErrorStatus, {
25
+ fill: colorToken.mjcard_color_red_1
26
+ }),
27
+ loadingIcon: /*#__PURE__*/React.createElement(Loading, {
28
+ stroke: colorToken.mj_color_gray_icon_4
29
+ }),
30
+ parkingStatusIcon: /*#__PURE__*/React.createElement(ParkingIcon, {
31
+ fill: colorToken.mj_color_gray_icon_4
32
+ }),
33
+ sentryModeIcon: /*#__PURE__*/React.createElement(SentryMode, {
34
+ fill: colorToken.mj_color_gray_icon_4
35
+ })
36
+ }), [colorToken]);
37
+ const enterSentryInfoWorkMode = useMemo(() => {
38
+ if (specSentryInfoPropertiesSentryWorkMode && sentryWorkModeValue !== undefined) {
39
+ const sentryWorkModeOn = getValueBySpecDescription(specSentryInfoPropertiesSentryWorkMode, 'ON');
40
+ const sentryWorkModeStandBy1 = getValueBySpecDescription(specSentryInfoPropertiesSentryWorkMode, 'StandBy1');
41
+ const sentryWorkModeStandBy2 = getValueBySpecDescription(specSentryInfoPropertiesSentryWorkMode, 'StandBy2');
42
+ const sentryWorkModeAlert = getValueBySpecDescription(specSentryInfoPropertiesSentryWorkMode, 'Alert');
43
+ const sentryWorkModeAlarm = getValueBySpecDescription(specSentryInfoPropertiesSentryWorkMode, 'Alarm');
44
+ return [sentryWorkModeOn, sentryWorkModeStandBy1, sentryWorkModeStandBy2, sentryWorkModeAlert, sentryWorkModeAlarm].includes(Number(sentryWorkModeValue));
45
+ }
46
+ return false;
47
+ }, [sentryWorkModeValue, specSentryInfoPropertiesSentryWorkMode]);
48
+ const getParkingStatusInfo = useCallback(() => {
49
+ const powerModeState = Number(powerModeStateValue);
50
+ const gearStatus = Number(gearStatusValue);
51
+ const centralLockState = Number(centralLockStateValue);
52
+ const textStyle = {
53
+ color: colorToken.mj_color_gray_text_4
54
+ };
55
+
56
+ // 1. Connecting
57
+ if (connectStatus === ConnectStatus.CONNECTING) {
58
+ const parkingStatus = getLocalI18n('car_connect_status_connecting');
59
+ return {
60
+ parkingIcon: parkingStatusIcon.loadingIcon,
61
+ parkingStatus,
62
+ showDivider: false,
63
+ textStyle,
64
+ isLoading: true
65
+ };
66
+ }
67
+
68
+ // 4. Locked
69
+ if ([getValueBySpecDescription(specBodyPowerModePropertiesPowerModeState, 'Off'), getValueBySpecDescription(specBodyPowerModePropertiesPowerModeState, 'Awake')].includes(powerModeState) && getValueBySpecDescription(specDoorCentralLockPropertiesCentralLockState, 'Locked') === centralLockState) {
70
+ return {
71
+ parkingIcon: enterSentryInfoWorkMode ? parkingStatusIcon.sentryModeIcon : parkingStatusIcon.parkingStatusIcon,
72
+ parkingStatus: getLocalI18n('car_title_power_status_locked'),
73
+ showDivider: enterSentryInfoWorkMode,
74
+ textStyle,
75
+ isLoading: false
76
+ };
77
+ }
78
+
79
+ // 3. Driving (any of these conditions)
80
+ if (getValueBySpecDescription(specBodyGearPropertiesGearStatus, 'R') === gearStatus || getValueBySpecDescription(specBodyGearPropertiesGearStatus, 'N') === gearStatus || getValueBySpecDescription(specBodyGearPropertiesGearStatus, 'D') === gearStatus) {
81
+ return {
82
+ parkingIcon: parkingStatusIcon.parkingStatusIcon,
83
+ parkingStatus: getLocalI18n('car_title_power_status_run'),
84
+ showDivider: false,
85
+ textStyle,
86
+ isLoading: false
87
+ };
88
+ }
89
+
90
+ // 5. Parked
91
+ return {
92
+ parkingIcon: parkingStatusIcon.parkingStatusIcon,
93
+ parkingStatus: getLocalI18n('car_title_power_status_parking'),
94
+ showDivider: false,
95
+ textStyle,
96
+ isLoading: false
97
+ };
98
+ }, [connectStatus, powerModeStateValue, gearStatusValue, centralLockStateValue, enterSentryInfoWorkMode, specBodyPowerModePropertiesPowerModeState, specBodyGearPropertiesGearStatus, specDoorCentralLockPropertiesCentralLockState, parkingStatusIcon, colorToken]);
99
+ return useMemo(() => getParkingStatusInfo(), [getParkingStatusInfo]);
100
+ };
@@ -0,0 +1,94 @@
1
+ import React from 'react';
2
+ import { Spec } from '../types';
3
+ export interface SeatSpecs {
4
+ specSeatRow1LeftPropertiesHeating?: Spec;
5
+ specSeatRow1LeftPropertiesSeatVentilation?: Spec;
6
+ specSeatRow1RightPropertiesHeating?: Spec;
7
+ specSeatRow1RightPropertiesSeatVentilation?: Spec;
8
+ specSeatRow2LeftPropertiesHeating?: Spec;
9
+ specSeatRow2LeftPropertiesSeatVentilation?: Spec;
10
+ specSeatRow2MiddlePropertiesHeating?: Spec;
11
+ specSeatRow2MiddlePropertiesSeatVentilation?: Spec;
12
+ specSeatRow2RightPropertiesHeating?: Spec;
13
+ specSeatRow2RightPropertiesSeatVentilation?: Spec;
14
+ }
15
+ export interface SeatControlDataProps {
16
+ specs: SeatSpecs;
17
+ disabled?: boolean;
18
+ onSeatChange?: (params: {
19
+ propType: string;
20
+ previousValue: number;
21
+ currentValue: number;
22
+ }) => void;
23
+ }
24
+ export interface OnButtonPressParams {
25
+ propType: string;
26
+ spec?: Spec | string;
27
+ previousValue: string;
28
+ currentValue: string;
29
+ }
30
+ export type LevelIcons = {
31
+ heating: {
32
+ [key: string]: React.ReactElement;
33
+ Off: React.ReactElement;
34
+ OffDisabled: React.ReactElement;
35
+ Three: React.ReactElement;
36
+ ThreeDisabled: React.ReactElement;
37
+ Two: React.ReactElement;
38
+ TwoDisabled: React.ReactElement;
39
+ One: React.ReactElement;
40
+ OneDisabled: React.ReactElement;
41
+ };
42
+ ventilation: {
43
+ [key: string]: React.ReactElement;
44
+ Off: React.ReactElement;
45
+ OffDisabled: React.ReactElement;
46
+ Three: React.ReactElement;
47
+ ThreeDisabled: React.ReactElement;
48
+ Two: React.ReactElement;
49
+ TwoDisabled: React.ReactElement;
50
+ One: React.ReactElement;
51
+ OneDisabled: React.ReactElement;
52
+ };
53
+ };
54
+ export type StateConfig = {
55
+ order: Record<string, number>;
56
+ colors: {
57
+ on: string;
58
+ onDisabled: string;
59
+ off: string;
60
+ offDisabled: string;
61
+ };
62
+ icons: LevelIcons['heating'];
63
+ };
64
+ export declare const LEVEL_ICONS: (colorToken: any) => LevelIcons;
65
+ export declare const TYPE_CONFIG: (colorToken: any, levelIcons: LevelIcons) => {
66
+ heating: StateConfig;
67
+ ventilation: StateConfig;
68
+ };
69
+ export declare const SEAT_TITLES: {
70
+ groupTitle: string | Record<string, string>;
71
+ frontLeft: string | Record<string, string>;
72
+ frontRight: string | Record<string, string>;
73
+ rearLeft: string | Record<string, string>;
74
+ rearCenter: string | Record<string, string>;
75
+ rearRight: string | Record<string, string>;
76
+ };
77
+ export declare const useSeatControlData: ({ specs, disabled, onSeatChange }: SeatControlDataProps) => {
78
+ seatRows: {
79
+ serviceType: string;
80
+ title: string;
81
+ disabled: boolean;
82
+ buttons: any[];
83
+ }[][];
84
+ seatTitles: {
85
+ groupTitle: string | Record<string, string>;
86
+ frontLeft: string | Record<string, string>;
87
+ frontRight: string | Record<string, string>;
88
+ rearLeft: string | Record<string, string>;
89
+ rearCenter: string | Record<string, string>;
90
+ rearRight: string | Record<string, string>;
91
+ };
92
+ handleSeatChange: ({ propType, spec, previousValue, currentValue }: OnButtonPressParams) => void;
93
+ hasSeats: boolean;
94
+ };
@@ -0,0 +1,251 @@
1
+ /* eslint-disable no-console */
2
+ import React, { useMemo, useCallback, useContext } from 'react';
3
+ import { ConfigContext } from 'miot/ui/hyperOSUI';
4
+ import { useSpecState, setSpec } from '@miot-rn/common-component/dist/store/useGlobalSpecManager';
5
+ import { SeatGearHeatingOff, SeatGearHeatingLevelOne, SeatGearHeatingLevelTwo, SeatGearHeatingLevelThree, SeatGearVentilationOff, SeatGearVentilationLevelOne, SeatGearVentilationLevelTwo, SeatGearVentilationLevelThree } from "../icons";
6
+ import { getLocalI18n } from "../utils/getLocalI18n";
7
+ import { GearLevel, HeatingStateOrder, VentilationStateOrder, SeatI18nKeys } from "../config";
8
+ export const LEVEL_ICONS = colorToken => ({
9
+ heating: {
10
+ Off: /*#__PURE__*/React.createElement(SeatGearHeatingOff, {
11
+ fill: colorToken.mj_color_gray_icon_2
12
+ }),
13
+ OffDisabled: /*#__PURE__*/React.createElement(SeatGearHeatingOff, {
14
+ fill: colorToken.mj_color_gray_icon_7
15
+ }),
16
+ Three: /*#__PURE__*/React.createElement(SeatGearHeatingLevelThree, {
17
+ fill: colorToken.mj_color_norm_white
18
+ }),
19
+ ThreeDisabled: /*#__PURE__*/React.createElement(SeatGearHeatingLevelThree, {
20
+ fill: colorToken.mj_color_gray_icon_8
21
+ }),
22
+ Two: /*#__PURE__*/React.createElement(SeatGearHeatingLevelTwo, {
23
+ fill: colorToken.mj_color_norm_white
24
+ }),
25
+ TwoDisabled: /*#__PURE__*/React.createElement(SeatGearHeatingLevelTwo, {
26
+ fill: colorToken.mj_color_gray_icon_8
27
+ }),
28
+ One: /*#__PURE__*/React.createElement(SeatGearHeatingLevelOne, {
29
+ fill: colorToken.mj_color_norm_white
30
+ }),
31
+ OneDisabled: /*#__PURE__*/React.createElement(SeatGearHeatingLevelOne, {
32
+ fill: colorToken.mj_color_gray_icon_8
33
+ })
34
+ },
35
+ ventilation: {
36
+ Off: /*#__PURE__*/React.createElement(SeatGearVentilationOff, {
37
+ fill: colorToken.mj_color_gray_icon_2
38
+ }),
39
+ OffDisabled: /*#__PURE__*/React.createElement(SeatGearVentilationOff, {
40
+ fill: colorToken.mj_color_gray_icon_7
41
+ }),
42
+ Three: /*#__PURE__*/React.createElement(SeatGearVentilationLevelThree, {
43
+ fill: colorToken.mj_color_norm_white
44
+ }),
45
+ ThreeDisabled: /*#__PURE__*/React.createElement(SeatGearVentilationLevelThree, {
46
+ fill: colorToken.mj_color_gray_icon_8
47
+ }),
48
+ Two: /*#__PURE__*/React.createElement(SeatGearVentilationLevelTwo, {
49
+ fill: colorToken.mj_color_norm_white
50
+ }),
51
+ TwoDisabled: /*#__PURE__*/React.createElement(SeatGearVentilationLevelTwo, {
52
+ fill: colorToken.mj_color_gray_icon_8
53
+ }),
54
+ One: /*#__PURE__*/React.createElement(SeatGearVentilationLevelOne, {
55
+ fill: colorToken.mj_color_norm_white
56
+ }),
57
+ OneDisabled: /*#__PURE__*/React.createElement(SeatGearVentilationLevelOne, {
58
+ fill: colorToken.mj_color_gray_icon_8
59
+ })
60
+ }
61
+ });
62
+ export const TYPE_CONFIG = (colorToken, levelIcons) => ({
63
+ heating: {
64
+ order: HeatingStateOrder,
65
+ colors: {
66
+ on: colorToken.mjcard_color_orange_1,
67
+ onDisabled: colorToken.mjcard_color_orange_3,
68
+ off: colorToken.mj_color_gray_fill_2,
69
+ offDisabled: colorToken.mj_color_gray_fill_5
70
+ },
71
+ icons: levelIcons.heating
72
+ },
73
+ ventilation: {
74
+ order: VentilationStateOrder,
75
+ colors: {
76
+ on: colorToken.mjcard_color_blue_1,
77
+ onDisabled: colorToken.mjcard_color_blue_3,
78
+ off: colorToken.mj_color_gray_fill_2,
79
+ offDisabled: colorToken.mj_color_gray_fill_5
80
+ },
81
+ icons: levelIcons.ventilation
82
+ }
83
+ });
84
+ export const SEAT_TITLES = {
85
+ groupTitle: typeof getLocalI18n(SeatI18nKeys.GroupTitle) === 'string' ? getLocalI18n(SeatI18nKeys.GroupTitle) : '',
86
+ frontLeft: typeof getLocalI18n(SeatI18nKeys.FrontLeft) === 'string' ? getLocalI18n(SeatI18nKeys.FrontLeft) : '',
87
+ frontRight: typeof getLocalI18n(SeatI18nKeys.FrontRight) === 'string' ? getLocalI18n(SeatI18nKeys.FrontRight) : '',
88
+ rearLeft: typeof getLocalI18n(SeatI18nKeys.RearLeft) === 'string' ? getLocalI18n(SeatI18nKeys.RearLeft) : '',
89
+ rearCenter: typeof getLocalI18n(SeatI18nKeys.RearCenter) === 'string' ? getLocalI18n(SeatI18nKeys.RearCenter) : '',
90
+ rearRight: typeof getLocalI18n(SeatI18nKeys.RearRight) === 'string' ? getLocalI18n(SeatI18nKeys.RearRight) : ''
91
+ };
92
+ export const useSeatControlData = ({
93
+ specs,
94
+ disabled = false,
95
+ onSeatChange
96
+ }) => {
97
+ const {
98
+ colorToken
99
+ } = useContext(ConfigContext);
100
+ const {
101
+ specSeatRow1LeftPropertiesHeating,
102
+ specSeatRow1LeftPropertiesSeatVentilation,
103
+ specSeatRow1RightPropertiesHeating,
104
+ specSeatRow1RightPropertiesSeatVentilation,
105
+ specSeatRow2LeftPropertiesHeating,
106
+ specSeatRow2LeftPropertiesSeatVentilation,
107
+ specSeatRow2MiddlePropertiesHeating,
108
+ specSeatRow2MiddlePropertiesSeatVentilation,
109
+ specSeatRow2RightPropertiesHeating,
110
+ specSeatRow2RightPropertiesSeatVentilation
111
+ } = specs;
112
+
113
+ // 实时值
114
+ const seatRow1LeftHeatingValue = useSpecState(specSeatRow1LeftPropertiesHeating);
115
+ const seatRow1LeftVentilationValue = useSpecState(specSeatRow1LeftPropertiesSeatVentilation);
116
+ const seatRow1RightHeatingValue = useSpecState(specSeatRow1RightPropertiesHeating);
117
+ const seatRow1RightVentilationValue = useSpecState(specSeatRow1RightPropertiesSeatVentilation);
118
+ const seatRow2LeftHeatingValue = useSpecState(specSeatRow2LeftPropertiesHeating);
119
+ const seatRow2LeftVentilationValue = useSpecState(specSeatRow2LeftPropertiesSeatVentilation);
120
+ const seatRow2MiddleHeatingValue = useSpecState(specSeatRow2MiddlePropertiesHeating);
121
+ const seatRow2MiddleVentilationValue = useSpecState(specSeatRow2MiddlePropertiesSeatVentilation);
122
+ const seatRow2RightHeatingValue = useSpecState(specSeatRow2RightPropertiesHeating);
123
+ const seatRow2RightVentilationValue = useSpecState(specSeatRow2RightPropertiesSeatVentilation);
124
+ const levelIcons = useMemo(() => LEVEL_ICONS(colorToken), [colorToken]);
125
+ const typeConfig = useMemo(() => TYPE_CONFIG(colorToken, levelIcons), [colorToken, levelIcons]);
126
+
127
+ // 根据类型生成状态列表(排序 + 颜色 + 图标)
128
+ const buildStates = useCallback((type, spec, isDisabled) => {
129
+ if (!spec?.prop?.['value-list']) return [];
130
+ const config = typeConfig[type];
131
+ const list = [...spec.prop['value-list']].sort((a, b) => {
132
+ const priorityA = config.order[a.description?.toLowerCase()] ?? 99;
133
+ const priorityB = config.order[b.description?.toLowerCase()] ?? 99;
134
+ return priorityB - priorityA;
135
+ });
136
+ return list.map(item => {
137
+ const iconKey = GearLevel[item.description?.toLowerCase()] || 'Off';
138
+ const disableIconKey = `${iconKey}Disabled`;
139
+ const isOff = iconKey === 'Off';
140
+ const disableIcon = config.icons[disableIconKey] || config.icons[iconKey];
141
+ const backgroundColor = isDisabled ? isOff ? config.colors.offDisabled : config.colors.onDisabled : isOff ? config.colors.off : config.colors.on;
142
+ const icon = isDisabled ? disableIcon : config.icons[iconKey];
143
+ return {
144
+ value: String(item.value),
145
+ backgroundColor,
146
+ icon
147
+ };
148
+ });
149
+ }, [typeConfig]);
150
+
151
+ // 单个按钮配置
152
+ const buildButton = useCallback((type, spec, currentValue, isDisabled) => {
153
+ if (!spec) return null;
154
+ const states = buildStates(type, spec, isDisabled);
155
+ const currentStateIndex = states.findIndex(state => Number(state.value) === currentValue);
156
+ return {
157
+ spec,
158
+ propType: type,
159
+ states,
160
+ currentStateIndex: currentStateIndex >= 0 ? currentStateIndex : 0,
161
+ disabled: isDisabled
162
+ };
163
+ }, [buildStates]);
164
+
165
+ // 按座椅组合按钮(存在的才添加)
166
+ const buildButtons = useCallback((heatingSpec, ventilationSpec, heatingLevel, ventilationLevel, isDisabled) => {
167
+ const buttons = [];
168
+ const heatingButton = buildButton('heating', heatingSpec, heatingLevel, isDisabled);
169
+ const ventilationButton = buildButton('ventilation', ventilationSpec, ventilationLevel, isDisabled);
170
+ if (heatingButton) buttons.push(heatingButton);
171
+ if (ventilationButton) buttons.push(ventilationButton);
172
+ return buttons;
173
+ }, [buildButton]);
174
+
175
+ // 构建座椅行
176
+ const seatRows = useMemo(() => {
177
+ const rows = [[{
178
+ heating: specSeatRow1LeftPropertiesHeating,
179
+ ventilation: specSeatRow1LeftPropertiesSeatVentilation,
180
+ heatingValue: Number(seatRow1LeftHeatingValue ?? 0),
181
+ ventilationValue: Number(seatRow1LeftVentilationValue ?? 0),
182
+ title: SEAT_TITLES.frontLeft
183
+ }, {
184
+ heating: specSeatRow1RightPropertiesHeating,
185
+ ventilation: specSeatRow1RightPropertiesSeatVentilation,
186
+ heatingValue: Number(seatRow1RightHeatingValue ?? 0),
187
+ ventilationValue: Number(seatRow1RightVentilationValue ?? 0),
188
+ title: SEAT_TITLES.frontRight
189
+ }], [{
190
+ heating: specSeatRow2LeftPropertiesHeating,
191
+ ventilation: specSeatRow2LeftPropertiesSeatVentilation,
192
+ heatingValue: Number(seatRow2LeftHeatingValue ?? 0),
193
+ ventilationValue: Number(seatRow2LeftVentilationValue ?? 0),
194
+ title: SEAT_TITLES.rearLeft
195
+ }, {
196
+ heating: specSeatRow2MiddlePropertiesHeating,
197
+ ventilation: specSeatRow2MiddlePropertiesSeatVentilation,
198
+ heatingValue: Number(seatRow2MiddleHeatingValue ?? 0),
199
+ ventilationValue: Number(seatRow2MiddleVentilationValue ?? 0),
200
+ title: SEAT_TITLES.rearCenter
201
+ }, {
202
+ heating: specSeatRow2RightPropertiesHeating,
203
+ ventilation: specSeatRow2RightPropertiesSeatVentilation,
204
+ heatingValue: Number(seatRow2RightHeatingValue ?? 0),
205
+ ventilationValue: Number(seatRow2RightVentilationValue ?? 0),
206
+ title: SEAT_TITLES.rearRight
207
+ }]];
208
+ return rows.map(row => row.map(({
209
+ heating,
210
+ ventilation,
211
+ heatingValue,
212
+ ventilationValue,
213
+ title
214
+ }) => {
215
+ if (!heating && !ventilation) return null;
216
+ const seatId = (heating || ventilation)?.sDescription || title;
217
+ return {
218
+ serviceType: typeof seatId === 'string' ? seatId : '',
219
+ title: typeof title === 'string' ? title : '',
220
+ disabled,
221
+ buttons: buildButtons(heating, ventilation, heatingValue, ventilationValue, disabled)
222
+ };
223
+ }).filter(seat => seat !== null)).filter(rowSeats => rowSeats.length > 0);
224
+ }, [buildButtons, specSeatRow1LeftPropertiesHeating, specSeatRow1LeftPropertiesSeatVentilation, specSeatRow1RightPropertiesHeating, specSeatRow1RightPropertiesSeatVentilation, specSeatRow2LeftPropertiesHeating, specSeatRow2LeftPropertiesSeatVentilation, specSeatRow2MiddlePropertiesHeating, specSeatRow2MiddlePropertiesSeatVentilation, specSeatRow2RightPropertiesHeating, specSeatRow2RightPropertiesSeatVentilation, seatRow1LeftHeatingValue, seatRow1LeftVentilationValue, seatRow1RightHeatingValue, seatRow1RightVentilationValue, seatRow2LeftHeatingValue, seatRow2LeftVentilationValue, seatRow2MiddleHeatingValue, seatRow2MiddleVentilationValue, seatRow2RightHeatingValue, seatRow2RightVentilationValue, disabled]);
225
+ const handleSeatChange = useCallback(({
226
+ propType,
227
+ spec,
228
+ previousValue,
229
+ currentValue
230
+ }) => {
231
+ setSpec({
232
+ ...spec,
233
+ value: Number(currentValue)
234
+ }).then(res => {
235
+ console.log('useSeatControlData setSpec success', res);
236
+ onSeatChange?.({
237
+ propType,
238
+ previousValue: Number(previousValue),
239
+ currentValue: Number(currentValue)
240
+ });
241
+ }).catch(error => {
242
+ console.log('useSeatControlData setSpec error', error);
243
+ });
244
+ }, [onSeatChange]);
245
+ return {
246
+ seatRows,
247
+ seatTitles: SEAT_TITLES,
248
+ handleSeatChange,
249
+ hasSeats: seatRows.length > 0
250
+ };
251
+ };
@@ -0,0 +1,15 @@
1
+ import { Spec } from '../types';
2
+ export interface RangeDisplayData {
3
+ currentRange: number | string;
4
+ totalRange: number;
5
+ unit: string;
6
+ color: string;
7
+ }
8
+ export interface UseSingleRangeDataProps {
9
+ specPowerBatteryPropertiesBatterySoCDisplay: Spec;
10
+ specPowerBatteryPropertiesLowSocWarning: Spec;
11
+ specPowerBatteryPropertiesBatteryEstimatedMileage: Spec;
12
+ specPowerBatteryPropertiesDCDRangeSOCTypeDisplay: Spec;
13
+ specPowerBatteryPropertiesCLTCEstimatedRange: Spec;
14
+ }
15
+ export declare const useSingleRangeData: ({ specPowerBatteryPropertiesBatterySoCDisplay, specPowerBatteryPropertiesLowSocWarning, specPowerBatteryPropertiesBatteryEstimatedMileage, specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, specPowerBatteryPropertiesCLTCEstimatedRange, }: UseSingleRangeDataProps) => RangeDisplayData;
@@ -0,0 +1,97 @@
1
+ /* eslint-disable no-console */
2
+ import { useMemo, useCallback, useContext } from 'react';
3
+ import { useSpecState } from '@miot-rn/common-component/dist/store/useGlobalSpecManager';
4
+ import { getValueBySpecDescription } from '@miot-rn/common-component/dist/specs/instance-parser';
5
+ import { getLocalI18n } from '@miot-rn/common-component/dist/specs/i18n-parser';
6
+ import { ConfigContext } from 'miot/ui/hyperOSUI';
7
+
8
+ /**
9
+ * 单续航数据配置(单位已包含在内)
10
+ */
11
+
12
+ export const useSingleRangeData = ({
13
+ specPowerBatteryPropertiesBatterySoCDisplay,
14
+ specPowerBatteryPropertiesLowSocWarning,
15
+ specPowerBatteryPropertiesBatteryEstimatedMileage,
16
+ specPowerBatteryPropertiesDCDRangeSOCTypeDisplay,
17
+ specPowerBatteryPropertiesCLTCEstimatedRange
18
+ }) => {
19
+ const {
20
+ colorToken
21
+ } = useContext(ConfigContext);
22
+ const batterySoCDisplayValue = useSpecState(specPowerBatteryPropertiesBatterySoCDisplay);
23
+ const lowSocWarningValue = useSpecState(specPowerBatteryPropertiesLowSocWarning);
24
+ const batteryEstimatedMileageValue = useSpecState(specPowerBatteryPropertiesBatteryEstimatedMileage);
25
+ const dcdRangeSOCTypeDisplayValue = useSpecState(specPowerBatteryPropertiesDCDRangeSOCTypeDisplay);
26
+ const cltcEstimatedRangeValue = useSpecState(specPowerBatteryPropertiesCLTCEstimatedRange);
27
+ const distanceUnit = useMemo(() => {
28
+ const text = getLocalI18n('car_distance_value_km');
29
+ if (typeof text === 'string') {
30
+ const match = text.match(/\[([^\]]+)\]/);
31
+ if (match && match[1]) {
32
+ return match[1];
33
+ }
34
+ }
35
+ return 'km';
36
+ }, []);
37
+ const getRangeDisplayData = useCallback(() => {
38
+ if (dcdRangeSOCTypeDisplayValue === undefined) {
39
+ return {
40
+ currentRange: 0,
41
+ totalRange: 100,
42
+ unit: '%',
43
+ color: colorToken.mjcard_color_green_2
44
+ };
45
+ }
46
+ const dcdType = Number(dcdRangeSOCTypeDisplayValue);
47
+ let color = colorToken.mjcard_color_green_2;
48
+ const lowSocWarning = Number(lowSocWarningValue);
49
+ const batterySoCDisplay = Number(batterySoCDisplayValue);
50
+ const batteryEstimatedMileage = Number(batteryEstimatedMileageValue);
51
+ const cltcEstimatedRange = Number(cltcEstimatedRangeValue);
52
+
53
+ // Determine color based on low SOC warning level
54
+ if (getValueBySpecDescription(specPowerBatteryPropertiesLowSocWarning, 'Level2 Warning') === lowSocWarning) {
55
+ color = colorToken.mjcard_color_yellow_2;
56
+ } else if (getValueBySpecDescription(specPowerBatteryPropertiesLowSocWarning, 'Level1 Warning') === lowSocWarning) {
57
+ color = colorToken.mjcard_color_red_2;
58
+ }
59
+
60
+ // 1. Battery SOC percentage
61
+ if (getValueBySpecDescription(specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, 'SOC') === dcdType) {
62
+ return {
63
+ currentRange: batterySoCDisplay || 0,
64
+ totalRange: specPowerBatteryPropertiesBatterySoCDisplay?.prop?.['value-range']?.[1] || 100,
65
+ unit: '%',
66
+ color
67
+ };
68
+ }
69
+
70
+ // 2. CLTC Range
71
+ if (getValueBySpecDescription(specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, 'CLTCRange') === dcdType) {
72
+ return {
73
+ currentRange: cltcEstimatedRange || 0,
74
+ totalRange: specPowerBatteryPropertiesCLTCEstimatedRange?.prop?.['value-range']?.[1] || 100,
75
+ unit: distanceUnit,
76
+ color
77
+ };
78
+ }
79
+
80
+ // 3. Battery mileage in km
81
+ if (getValueBySpecDescription(specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, 'MiRange') === dcdType) {
82
+ return {
83
+ currentRange: batteryEstimatedMileage || 0,
84
+ totalRange: specPowerBatteryPropertiesBatteryEstimatedMileage?.prop?.['value-range']?.[1] || 100,
85
+ unit: distanceUnit,
86
+ color
87
+ };
88
+ }
89
+ return {
90
+ currentRange: 0,
91
+ totalRange: 100,
92
+ unit: '%',
93
+ color: colorToken.mjcard_color_green_2
94
+ };
95
+ }, [dcdRangeSOCTypeDisplayValue, lowSocWarningValue, batterySoCDisplayValue, batteryEstimatedMileageValue, cltcEstimatedRangeValue, specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, specPowerBatteryPropertiesLowSocWarning, specPowerBatteryPropertiesBatterySoCDisplay, specPowerBatteryPropertiesBatteryEstimatedMileage, specPowerBatteryPropertiesCLTCEstimatedRange, distanceUnit, colorToken]);
96
+ return useMemo(() => getRangeDisplayData(), [getRangeDisplayData]);
97
+ };
@@ -0,0 +1,11 @@
1
+ import { Spec } from '../types';
2
+ interface UseSteeringWheelDataProps {
3
+ specBodySteeringWheelPropertiesSteeringWheelHeating: Spec;
4
+ }
5
+ export declare const useSteeringWheelData: ({ specBodySteeringWheelPropertiesSteeringWheelHeating, }: UseSteeringWheelDataProps) => {
6
+ steeringWheelTitle: string | Record<string, string>;
7
+ steeringWheelHeatState: any;
8
+ onSteeringWheelHotChange: (val: any) => void;
9
+ steeringWheelOptions: any;
10
+ };
11
+ export {};
@@ -0,0 +1,56 @@
1
+ /* eslint-disable no-console, @typescript-eslint/no-explicit-any */
2
+ import { useMemo, useCallback } from 'react';
3
+ import { setSpec, useSpecState } from '@miot-rn/common-component/dist/store/useGlobalSpecManager';
4
+ import { getSpecValueList, getValueBySpecDescriptions } from '@miot-rn/common-component/dist/specs/instance-parser';
5
+ import { getLocalI18n } from "../utils/getLocalI18n";
6
+ import { SteeringWheelHotGear } from "../config";
7
+ const {
8
+ steeringWheelTitle,
9
+ steeringWheelClose,
10
+ steeringWheelFirst,
11
+ steeringWheelSecond,
12
+ steeringWheelThird
13
+ } = {
14
+ steeringWheelTitle: getLocalI18n('car_steering_wheel_hot'),
15
+ steeringWheelClose: getLocalI18n('car_steering_wheel_hot_close'),
16
+ steeringWheelFirst: getLocalI18n('car_steering_wheel_hot_first'),
17
+ steeringWheelSecond: getLocalI18n('car_steering_wheel_hot_second'),
18
+ steeringWheelThird: getLocalI18n('car_steering_wheel_hot_third')
19
+ };
20
+ export const useSteeringWheelData = ({
21
+ specBodySteeringWheelPropertiesSteeringWheelHeating
22
+ }) => {
23
+ const steeringWheelHeatState = useSpecState(specBodySteeringWheelPropertiesSteeringWheelHeating);
24
+ const onSteeringWheelHotChange = useCallback(val => {
25
+ setSpec({
26
+ ...specBodySteeringWheelPropertiesSteeringWheelHeating,
27
+ value: val
28
+ }).then(res => {
29
+ console.log('onSteeringWheelHotChange---res', res);
30
+ });
31
+ }, [specBodySteeringWheelPropertiesSteeringWheelHeating]);
32
+ const steeringWheelOptions = useMemo(() => getSpecValueList(specBodySteeringWheelPropertiesSteeringWheelHeating).map(item => {
33
+ const SteeringWheelHotGearText = {
34
+ [SteeringWheelHotGear.OFF]: steeringWheelClose,
35
+ [SteeringWheelHotGear.Level1]: steeringWheelFirst,
36
+ [SteeringWheelHotGear.Level2]: steeringWheelSecond,
37
+ [SteeringWheelHotGear.Level3]: steeringWheelThird,
38
+ [SteeringWheelHotGear.Off]: steeringWheelClose,
39
+ [SteeringWheelHotGear['Level 1']]: steeringWheelFirst,
40
+ [SteeringWheelHotGear['Level 2']]: steeringWheelSecond,
41
+ [SteeringWheelHotGear['Level 3']]: steeringWheelThird
42
+ };
43
+ return {
44
+ ...item,
45
+ // @ts-ignore
46
+ label: SteeringWheelHotGearText[item.description || ''],
47
+ colorType: item.value !== getValueBySpecDescriptions(specBodySteeringWheelPropertiesSteeringWheelHeating, [SteeringWheelHotGear.OFF, SteeringWheelHotGear.Off]) ? 'orange' : undefined
48
+ };
49
+ }), [specBodySteeringWheelPropertiesSteeringWheelHeating]);
50
+ return {
51
+ steeringWheelTitle,
52
+ steeringWheelHeatState,
53
+ onSteeringWheelHotChange,
54
+ steeringWheelOptions
55
+ };
56
+ };
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { SvgProps } from 'react-native-svg';
3
+ declare const CarInUsed: (props: SvgProps) => React.JSX.Element;
4
+ export default CarInUsed;
@@ -0,0 +1,13 @@
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 * as React from 'react';
3
+ import Svg, { Path } from 'react-native-svg';
4
+ const CarInUsed = props => /*#__PURE__*/React.createElement(Svg, _extends({
5
+ width: 20,
6
+ height: 20,
7
+ fill: "none",
8
+ viewBox: "0 0 20 20"
9
+ }, props), /*#__PURE__*/React.createElement(Path, {
10
+ fill: props.fill,
11
+ d: "M13.201 3.672c.145.008.289.025.43.062q.347.091.641.295c.24.166.427.394.614.611l2.832 3.304h.839a.834.834 0 0 1 0 1.667h-.083v5.216c0 .158 0 .326-.01.47a1.5 1.5 0 0 1-.147.553c-.139.272-.36.492-.632.63-.202.104-.4.135-.553.147-.144.012-.312.012-.47.012h-1.145c-.202 0-.41.003-.615-.036a2 2 0 0 1-.484-.155c-.19-.089-.357-.212-.522-.33l-1.119-.798a2 2 0 0 0-.253-.173.4.4 0 0 0-.092-.03 2 2 0 0 0-.307-.007H7.88c-.262 0-.29.004-.308.008a.4.4 0 0 0-.091.029c-.017.008-.04.02-.254.173l-1.119.799c-.164.117-.331.24-.522.329a2 2 0 0 1-.484.155c-.206.039-.413.036-.615.036H3.34c-.157 0-.325 0-.469-.012a1.5 1.5 0 0 1-.553-.146 1.45 1.45 0 0 1-.631-.63 1.5 1.5 0 0 1-.146-.554c-.012-.144-.012-.312-.012-.47V9.611h-.083a.834.834 0 0 1 0-1.667h.838L5.117 4.64c.186-.218.372-.445.613-.611.195-.134.412-.234.64-.295.284-.075.578-.068.864-.068h5.534zm-5.967 1.66c-.375 0-.412.007-.437.014a.4.4 0 0 0-.121.055c-.02.014-.05.04-.294.324L3.3 9.319a1 1 0 0 1-.104.101v5.551l.144.001h1.146c.262 0 .289-.004.307-.007a.4.4 0 0 0 .092-.03c.016-.007.041-.02.254-.172l1.119-.8c.164-.117.33-.24.52-.328q.233-.108.485-.155c.206-.04.414-.036.616-.036h4.246c.202 0 .41-.003.615.036q.252.047.485.155c.19.088.357.211.521.329l1.12.799c.211.151.236.165.252.172q.045.021.092.03c.018.003.046.007.307.007h1.289l.001-.145V9.42a1 1 0 0 1-.105-.1L13.62 5.724c-.244-.285-.273-.31-.294-.324a.4.4 0 0 0-.12-.055.4.4 0 0 0-.088-.01l-.35-.003zm6.16 3.27a.834.834 0 0 1 .629 1.541l-.08.032h-.001l-.003.002-.006.002-.02.006q-.02.008-.058.019a5 5 0 0 1-.204.058 9 9 0 0 1-.756.16c-.658.116-1.622.228-2.893.228s-2.236-.112-2.894-.227a9 9 0 0 1-.755-.161 5 5 0 0 1-.264-.077l-.018-.006-.006-.002-.003-.002H6.06a.834.834 0 0 1 .55-1.573l.026.008q.042.013.14.04c.13.034.337.082.62.131.564.1 1.433.202 2.606.202s2.041-.103 2.606-.202c.282-.049.49-.097.62-.131q.097-.027.139-.04z"
12
+ }));
13
+ export default CarInUsed;
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { SvgProps } from 'react-native-svg';
3
+ declare const DeviceManage: (props: SvgProps) => React.JSX.Element;
4
+ export default DeviceManage;
@@ -0,0 +1,13 @@
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 * as React from 'react';
3
+ import Svg, { Path } from 'react-native-svg';
4
+ const DeviceManage = props => /*#__PURE__*/React.createElement(Svg, _extends({
5
+ width: 20,
6
+ height: 20,
7
+ fill: "none",
8
+ viewBox: "0 0 20 20"
9
+ }, props), /*#__PURE__*/React.createElement(Path, {
10
+ fill: props.fill,
11
+ d: "M10 1.388a8.613 8.613 0 0 1 0 17.224 8.612 8.612 0 0 1 0-17.224m0 1.668a6.944 6.944 0 1 0 0 13.889 6.944 6.944 0 0 0 0-13.89M4.888 8.682a.834.834 0 0 1 1.615.415q-.112.432-.114.903a3.61 3.61 0 0 0 3.931 3.595.831.831 0 0 1 1.142-1.017l1.112.516a.834.834 0 0 1 .066 1.477 5.279 5.279 0 0 1-7.751-5.89M10 4.722a5.278 5.278 0 0 1 5.111 6.597.834.834 0 0 1-1.614-.416q.113-.432.114-.903A3.61 3.61 0 0 0 9.68 6.405a.831.831 0 0 1-1.142 1.018l-1.11-.517a.834.834 0 0 1-.067-1.477A5.26 5.26 0 0 1 10 4.723"
12
+ }));
13
+ export default DeviceManage;