@axelor/aos-mobile-core 7.1.1 → 7.2.0

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 (298) hide show
  1. package/lib/api/anomaly-api.d.ts +4 -0
  2. package/lib/api/anomaly-api.js +24 -0
  3. package/lib/api/anomaly-api.js.map +1 -0
  4. package/lib/api/login-api.js +2 -3
  5. package/lib/api/login-api.js.map +1 -1
  6. package/lib/api/metafile-api.d.ts +10 -0
  7. package/lib/api/metafile-api.js +12 -6
  8. package/lib/api/metafile-api.js.map +1 -1
  9. package/lib/api/mobile-config-api.js +9 -15
  10. package/lib/api/mobile-config-api.js.map +1 -1
  11. package/lib/api/model-api.d.ts +4 -0
  12. package/lib/api/model-api.js +28 -0
  13. package/lib/api/model-api.js.map +1 -0
  14. package/lib/api/user-api.d.ts +4 -0
  15. package/lib/api/user-api.js +31 -0
  16. package/lib/api/user-api.js.map +1 -0
  17. package/lib/apiProviders/Standard/ObjectFieldsProvider.d.ts +1 -0
  18. package/lib/apiProviders/Standard/ObjectFieldsProvider.js +21 -4
  19. package/lib/apiProviders/Standard/ObjectFieldsProvider.js.map +1 -1
  20. package/lib/apiProviders/middlewares/fieldParser.d.ts +2 -0
  21. package/lib/apiProviders/middlewares/fieldParser.js +53 -0
  22. package/lib/apiProviders/middlewares/fieldParser.js.map +1 -0
  23. package/lib/apiProviders/middlewares/index.d.ts +1 -0
  24. package/lib/apiProviders/middlewares/index.js +1 -0
  25. package/lib/apiProviders/middlewares/index.js.map +1 -1
  26. package/lib/apiProviders/utils.js +16 -4
  27. package/lib/apiProviders/utils.js.map +1 -1
  28. package/lib/app/ContextsProvider.js +12 -4
  29. package/lib/app/ContextsProvider.js.map +1 -1
  30. package/lib/app/Module.d.ts +2 -0
  31. package/lib/app/RootNavigator.js +1 -1
  32. package/lib/app/context.helper.js +6 -1
  33. package/lib/app/context.helper.js.map +1 -1
  34. package/lib/auth/components/index.d.ts +1 -0
  35. package/lib/{sessions/components/buttons → auth/components}/index.js +1 -3
  36. package/lib/auth/components/index.js.map +1 -0
  37. package/lib/auth/components/molecules/TranslationsButton/TranslationsButton.d.ts +2 -0
  38. package/lib/auth/components/molecules/TranslationsButton/TranslationsButton.js +63 -0
  39. package/lib/auth/components/molecules/TranslationsButton/TranslationsButton.js.map +1 -0
  40. package/lib/auth/components/molecules/index.d.ts +1 -0
  41. package/lib/auth/components/molecules/index.js +19 -0
  42. package/lib/auth/components/molecules/index.js.map +1 -0
  43. package/lib/auth/features/companySlice.d.ts +1 -1
  44. package/lib/auth/features/configSlice.d.ts +1 -1
  45. package/lib/auth/features/languageSlice.d.ts +1 -1
  46. package/lib/auth/features/userSlice.d.ts +1 -1
  47. package/lib/auth/features/userSlice.js +0 -4
  48. package/lib/auth/features/userSlice.js.map +1 -1
  49. package/lib/auth/models/objectFields.js +3 -3
  50. package/lib/auth/models/objectFields.js.map +1 -1
  51. package/lib/auth/screens/SettingsScreen.js +7 -31
  52. package/lib/auth/screens/SettingsScreen.js.map +1 -1
  53. package/lib/auth/screens/UserScreen.js +11 -8
  54. package/lib/auth/screens/UserScreen.js.map +1 -1
  55. package/lib/components/external/Camera/Camera.js +15 -5
  56. package/lib/components/external/Camera/Camera.js.map +1 -1
  57. package/lib/components/external/Camera/CaptureButton.d.ts +2 -1
  58. package/lib/components/external/Camera/CaptureButton.js +3 -3
  59. package/lib/components/external/Camera/CaptureButton.js.map +1 -1
  60. package/lib/components/external/Stopwatch/Stopwatch.d.ts +5 -1
  61. package/lib/components/external/Stopwatch/Stopwatch.js +35 -11
  62. package/lib/components/external/Stopwatch/Stopwatch.js.map +1 -1
  63. package/lib/components/external/Timer/Timer.d.ts +3 -2
  64. package/lib/components/external/Timer/Timer.js +5 -4
  65. package/lib/components/external/Timer/Timer.js.map +1 -1
  66. package/lib/components/index.d.ts +1 -0
  67. package/lib/components/index.js +1 -0
  68. package/lib/components/index.js.map +1 -1
  69. package/lib/components/molecules/CameraButton/CameraButton.d.ts +12 -0
  70. package/lib/components/molecules/CameraButton/CameraButton.js +87 -0
  71. package/lib/components/molecules/CameraButton/CameraButton.js.map +1 -0
  72. package/lib/components/molecules/UploadFileInput/UploadFileInput.d.ts +3 -1
  73. package/lib/components/molecules/UploadFileInput/UploadFileInput.js +71 -15
  74. package/lib/components/molecules/UploadFileInput/UploadFileInput.js.map +1 -1
  75. package/lib/components/molecules/index.d.ts +1 -0
  76. package/lib/components/molecules/index.js +1 -0
  77. package/lib/components/molecules/index.js.map +1 -1
  78. package/lib/components/organisms/AnomalyBubble/AnomalyBubble.d.ts +11 -0
  79. package/lib/components/organisms/AnomalyBubble/AnomalyBubble.js +60 -0
  80. package/lib/components/organisms/AnomalyBubble/AnomalyBubble.js.map +1 -0
  81. package/lib/components/organisms/AnomalyList/AnomalyList.d.ts +7 -0
  82. package/lib/components/organisms/AnomalyList/AnomalyList.js +59 -0
  83. package/lib/components/organisms/AnomalyList/AnomalyList.js.map +1 -0
  84. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.d.ts +3 -1
  85. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js +18 -4
  86. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js.map +1 -1
  87. package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.d.ts +4 -1
  88. package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js +2 -2
  89. package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js.map +1 -1
  90. package/lib/components/organisms/index.d.ts +2 -0
  91. package/lib/components/organisms/index.js +2 -0
  92. package/lib/components/organisms/index.js.map +1 -1
  93. package/lib/components/pages/FormView/Alerts/ConstraintsValidatorPopup.d.ts +11 -0
  94. package/lib/components/pages/FormView/Alerts/ConstraintsValidatorPopup.js +33 -0
  95. package/lib/components/pages/FormView/Alerts/ConstraintsValidatorPopup.js.map +1 -0
  96. package/lib/components/pages/FormView/Alerts/index.d.ts +1 -0
  97. package/lib/components/pages/FormView/Alerts/index.js +19 -0
  98. package/lib/components/pages/FormView/Alerts/index.js.map +1 -0
  99. package/lib/components/pages/FormView/Components/Field.d.ts +9 -0
  100. package/lib/components/pages/FormView/Components/Field.js +149 -0
  101. package/lib/components/pages/FormView/Components/Field.js.map +1 -0
  102. package/lib/components/pages/FormView/Components/Panel.d.ts +8 -0
  103. package/lib/components/pages/FormView/Components/Panel.js +84 -0
  104. package/lib/components/pages/FormView/Components/Panel.js.map +1 -0
  105. package/lib/components/pages/FormView/Components/index.d.ts +2 -0
  106. package/lib/components/pages/FormView/Components/index.js +20 -0
  107. package/lib/components/pages/FormView/Components/index.js.map +1 -0
  108. package/lib/components/pages/FormView/Custom/CustomButton.d.ts +10 -0
  109. package/lib/components/pages/FormView/Custom/CustomButton.js +31 -0
  110. package/lib/components/pages/FormView/Custom/CustomButton.js.map +1 -0
  111. package/lib/components/pages/FormView/Custom/CustomPasswordInput.d.ts +11 -0
  112. package/lib/components/pages/FormView/Custom/CustomPasswordInput.js +40 -0
  113. package/lib/components/pages/FormView/Custom/CustomPasswordInput.js.map +1 -0
  114. package/lib/components/pages/FormView/Custom/CustomPicker.d.ts +12 -0
  115. package/lib/components/pages/FormView/Custom/CustomPicker.js +33 -0
  116. package/lib/components/pages/FormView/Custom/CustomPicker.js.map +1 -0
  117. package/lib/components/pages/FormView/Custom/CustomSearchBar.d.ts +12 -0
  118. package/lib/components/pages/FormView/Custom/CustomSearchBar.js +69 -0
  119. package/lib/components/pages/FormView/Custom/CustomSearchBar.js.map +1 -0
  120. package/lib/components/pages/FormView/Custom/index.d.ts +4 -0
  121. package/lib/components/pages/FormView/Custom/index.js +22 -0
  122. package/lib/components/pages/FormView/Custom/index.js.map +1 -0
  123. package/lib/components/pages/FormView/FormView.d.ts +8 -0
  124. package/lib/components/pages/FormView/FormView.js +199 -0
  125. package/lib/components/pages/FormView/FormView.js.map +1 -0
  126. package/lib/components/pages/index.d.ts +4 -0
  127. package/lib/components/pages/index.js +22 -0
  128. package/lib/components/pages/index.js.map +1 -0
  129. package/lib/components/templates/AttachedFilesView/AttachedFilesView.js +1 -1
  130. package/lib/components/templates/AttachedFilesView/AttachedFilesView.js.map +1 -1
  131. package/lib/components/templates/MailMessageView/MailMessageView.js +8 -2
  132. package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -1
  133. package/lib/components/templates/PopupApplicationNotConfigured/PopupApplicationNotConfigured.js +10 -13
  134. package/lib/components/templates/PopupApplicationNotConfigured/PopupApplicationNotConfigured.js.map +1 -1
  135. package/lib/components/templates/PopupMinimalRequiredVersion/PopupMinimalRequiredVersion.js +15 -25
  136. package/lib/components/templates/PopupMinimalRequiredVersion/PopupMinimalRequiredVersion.js.map +1 -1
  137. package/lib/components/templates/SocialNetworkLinks/SocialNetworkLinks.d.ts +16 -0
  138. package/lib/components/templates/SocialNetworkLinks/SocialNetworkLinks.js +78 -0
  139. package/lib/components/templates/SocialNetworkLinks/SocialNetworkLinks.js.map +1 -0
  140. package/lib/components/templates/UserSearchBar/UserSearchBar.d.ts +14 -0
  141. package/lib/components/templates/UserSearchBar/UserSearchBar.js +34 -0
  142. package/lib/components/templates/UserSearchBar/UserSearchBar.js.map +1 -0
  143. package/lib/components/templates/index.d.ts +2 -0
  144. package/lib/components/templates/index.js +2 -0
  145. package/lib/components/templates/index.js.map +1 -1
  146. package/lib/config/routes.d.ts +23 -20
  147. package/lib/config/routes.js +2 -0
  148. package/lib/config/routes.js.map +1 -1
  149. package/lib/features/attachedFilesSlice.d.ts +1 -1
  150. package/lib/features/authSlice.d.ts +1 -1
  151. package/lib/features/cameraScannerSlice.d.ts +2 -2
  152. package/lib/features/cameraScannerSlice.js +4 -1
  153. package/lib/features/cameraScannerSlice.js.map +1 -1
  154. package/lib/features/cameraSlice.d.ts +13 -4
  155. package/lib/features/cameraSlice.js +4 -1
  156. package/lib/features/cameraSlice.js.map +1 -1
  157. package/lib/features/formSlice.d.ts +34 -0
  158. package/lib/features/formSlice.js +70 -0
  159. package/lib/features/formSlice.js.map +1 -0
  160. package/lib/features/index.d.ts +3 -0
  161. package/lib/features/index.js +3 -0
  162. package/lib/features/index.js.map +1 -1
  163. package/lib/features/mailMessageSlice.d.ts +1 -1
  164. package/lib/features/menuConfigSlice.d.ts +1 -1
  165. package/lib/features/metaJsonFieldSlice.d.ts +34 -0
  166. package/lib/features/metaJsonFieldSlice.js +68 -0
  167. package/lib/features/metaJsonFieldSlice.js.map +1 -0
  168. package/lib/features/metaModuleSlice.d.ts +1 -1
  169. package/lib/features/metafileSlice.d.ts +1 -1
  170. package/lib/features/mobileConfigSlice.d.ts +1 -1
  171. package/lib/features/onlineSlice.d.ts +1 -1
  172. package/lib/features/scannerSlice.d.ts +2 -2
  173. package/lib/features/scannerSlice.js +4 -1
  174. package/lib/features/scannerSlice.js.map +1 -1
  175. package/lib/features/userSlice.d.ts +16 -0
  176. package/lib/features/userSlice.js +49 -0
  177. package/lib/features/userSlice.js.map +1 -0
  178. package/lib/forms/FormConfigsProvider.d.ts +20 -0
  179. package/lib/forms/FormConfigsProvider.js +56 -0
  180. package/lib/forms/FormConfigsProvider.js.map +1 -0
  181. package/lib/forms/api.helpers.d.ts +12 -0
  182. package/lib/forms/api.helpers.js +59 -0
  183. package/lib/forms/api.helpers.js.map +1 -0
  184. package/lib/forms/display.helpers.d.ts +9 -0
  185. package/lib/forms/display.helpers.js +150 -0
  186. package/lib/forms/display.helpers.js.map +1 -0
  187. package/lib/forms/index.d.ts +7 -0
  188. package/lib/forms/index.js +25 -0
  189. package/lib/forms/index.js.map +1 -0
  190. package/lib/forms/register.helpers.d.ts +6 -0
  191. package/lib/forms/register.helpers.js +96 -0
  192. package/lib/forms/register.helpers.js.map +1 -0
  193. package/lib/forms/studio/api.helpers.d.ts +37 -0
  194. package/lib/forms/studio/api.helpers.js +162 -0
  195. package/lib/forms/studio/api.helpers.js.map +1 -0
  196. package/lib/forms/studio/display.helpers.d.ts +7 -0
  197. package/lib/forms/studio/display.helpers.js +256 -0
  198. package/lib/forms/studio/display.helpers.js.map +1 -0
  199. package/lib/forms/studio/index.d.ts +2 -0
  200. package/lib/forms/studio/index.js +20 -0
  201. package/lib/forms/studio/index.js.map +1 -0
  202. package/lib/forms/types.d.ts +100 -0
  203. package/lib/forms/types.js +19 -0
  204. package/lib/forms/types.js.map +1 -0
  205. package/lib/forms/validation.helpers.d.ts +10 -0
  206. package/lib/forms/validation.helpers.js +234 -0
  207. package/lib/forms/validation.helpers.js.map +1 -0
  208. package/lib/header/hooks.d.ts +29 -1
  209. package/lib/header/hooks.js +83 -2
  210. package/lib/header/hooks.js.map +1 -1
  211. package/lib/header/types.d.ts +2 -0
  212. package/lib/hooks/use-navigation.d.ts +1 -0
  213. package/lib/hooks/use-navigation.js +4 -1
  214. package/lib/hooks/use-navigation.js.map +1 -1
  215. package/lib/i18n/component/Translator.d.ts +1 -1
  216. package/lib/i18n/hooks/use-translator.js +3 -1
  217. package/lib/i18n/hooks/use-translator.js.map +1 -1
  218. package/lib/i18n/translations/en.json +53 -1
  219. package/lib/i18n/translations/fr.json +53 -1
  220. package/lib/index.d.ts +4 -3
  221. package/lib/index.js +4 -3
  222. package/lib/index.js.map +1 -1
  223. package/lib/models/index.d.ts +2 -0
  224. package/lib/models/index.js +2 -0
  225. package/lib/models/index.js.map +1 -1
  226. package/lib/models/objectFields.js +3 -0
  227. package/lib/models/objectFields.js.map +1 -1
  228. package/lib/models/searchFields.d.ts +2 -0
  229. package/lib/{sessions/components/buttons/LoginButton.js → models/searchFields.js} +3 -6
  230. package/lib/models/searchFields.js.map +1 -0
  231. package/lib/models/sortFields.d.ts +2 -0
  232. package/lib/{sessions/components/buttons/UpdateButton.js → models/sortFields.js} +3 -6
  233. package/lib/models/sortFields.js.map +1 -0
  234. package/lib/navigator/Navigator.d.ts +1 -1
  235. package/lib/navigator/Navigator.js +2 -18
  236. package/lib/navigator/Navigator.js.map +1 -1
  237. package/lib/navigator/drawer/Header.js +1 -1
  238. package/lib/navigator/drawer/Header.js.map +1 -1
  239. package/lib/redux/store.d.ts +1 -1
  240. package/lib/screens/BarcodeDisplayScreen.d.ts +4 -0
  241. package/lib/screens/BarcodeDisplayScreen.js +54 -0
  242. package/lib/screens/BarcodeDisplayScreen.js.map +1 -0
  243. package/lib/screens/ErrorScreen.js +1 -1
  244. package/lib/screens/ErrorScreen.js.map +1 -1
  245. package/lib/screens/JsonFieldScreen.d.ts +4 -0
  246. package/lib/screens/JsonFieldScreen.js +92 -0
  247. package/lib/screens/JsonFieldScreen.js.map +1 -0
  248. package/lib/screens/SessionManagementScreen.js +1 -1
  249. package/lib/screens/SessionManagementScreen.js.map +1 -1
  250. package/lib/screens/index.d.ts +51 -0
  251. package/lib/screens/index.js +56 -0
  252. package/lib/screens/index.js.map +1 -0
  253. package/lib/sessions/components/alerts/PopupCreateSession.d.ts +3 -3
  254. package/lib/sessions/components/alerts/PopupCreateSession.js +30 -29
  255. package/lib/sessions/components/alerts/PopupCreateSession.js.map +1 -1
  256. package/lib/sessions/components/alerts/PopupEditSession.js +9 -16
  257. package/lib/sessions/components/alerts/PopupEditSession.js.map +1 -1
  258. package/lib/sessions/components/alerts/PopupSession.js +7 -16
  259. package/lib/sessions/components/alerts/PopupSession.js.map +1 -1
  260. package/lib/sessions/components/display/SessionListCard.js +3 -6
  261. package/lib/sessions/components/display/SessionListCard.js.map +1 -1
  262. package/lib/sessions/components/index.d.ts +0 -1
  263. package/lib/sessions/components/index.js +0 -1
  264. package/lib/sessions/components/index.js.map +1 -1
  265. package/lib/sessions/components/inputs/SessionInputs.d.ts +2 -1
  266. package/lib/sessions/components/inputs/SessionInputs.js +18 -13
  267. package/lib/sessions/components/inputs/SessionInputs.js.map +1 -1
  268. package/lib/tools/LinkingProvider.d.ts +2 -2
  269. package/lib/tools/LinkingProvider.js +4 -4
  270. package/lib/tools/LinkingProvider.js.map +1 -1
  271. package/lib/types/anomaly-type.d.ts +16 -0
  272. package/lib/types/anomaly-type.js +56 -0
  273. package/lib/types/anomaly-type.js.map +1 -0
  274. package/lib/types/index.d.ts +1 -0
  275. package/lib/types/index.js +1 -0
  276. package/lib/types/index.js.map +1 -1
  277. package/lib/utils/displayers.d.ts +1 -0
  278. package/lib/utils/displayers.js +1 -0
  279. package/lib/utils/displayers.js.map +1 -1
  280. package/lib/utils/filter.d.ts +4 -0
  281. package/lib/utils/filter.js +13 -0
  282. package/lib/utils/filter.js.map +1 -1
  283. package/lib/utils/formatters.d.ts +1 -0
  284. package/lib/utils/formatters.js +16 -0
  285. package/lib/utils/formatters.js.map +1 -1
  286. package/lib/utils/index.d.ts +3 -3
  287. package/lib/utils/index.js +3 -3
  288. package/lib/utils/index.js.map +1 -1
  289. package/package.json +7 -8
  290. package/lib/sessions/components/buttons/DisabledButton.d.ts +0 -7
  291. package/lib/sessions/components/buttons/DisabledButton.js +0 -45
  292. package/lib/sessions/components/buttons/DisabledButton.js.map +0 -1
  293. package/lib/sessions/components/buttons/LoginButton.d.ts +0 -6
  294. package/lib/sessions/components/buttons/LoginButton.js.map +0 -1
  295. package/lib/sessions/components/buttons/UpdateButton.d.ts +0 -6
  296. package/lib/sessions/components/buttons/UpdateButton.js.map +0 -1
  297. package/lib/sessions/components/buttons/index.d.ts +0 -3
  298. package/lib/sessions/components/buttons/index.js.map +0 -1
@@ -0,0 +1,100 @@
1
+ import { Dispatch } from '@reduxjs/toolkit';
2
+ import { ReactElement } from 'react';
3
+ import { Color } from '@axelor/aos-mobile-ui';
4
+ export declare const DEFAULT_COLSPAN = 12;
5
+ export interface States {
6
+ objectState?: any;
7
+ storeState?: any;
8
+ }
9
+ export interface DependsOnStates extends States {
10
+ newValue?: any;
11
+ dispatch?: any;
12
+ }
13
+ export interface customComponentOptions {
14
+ style?: any;
15
+ title?: string;
16
+ defaultValue?: any;
17
+ onChange: (value?: any) => void;
18
+ required?: boolean;
19
+ readonly?: boolean;
20
+ }
21
+ export interface Field {
22
+ parentPanel?: string;
23
+ order?: number;
24
+ titleKey?: string;
25
+ helperKey?: string;
26
+ type: InputType;
27
+ required?: boolean;
28
+ requiredIf?: (values?: States) => boolean;
29
+ readonly?: boolean;
30
+ readonlyIf?: (values?: States) => boolean;
31
+ hideIf?: (values?: States) => boolean;
32
+ dependsOn?: {
33
+ [fieldName: string]: (values: DependsOnStates) => any;
34
+ };
35
+ widget?: Widget;
36
+ customComponent?: (options?: customComponentOptions) => ReactElement | JSX.Element;
37
+ options?: {
38
+ [propsKey: string]: any;
39
+ };
40
+ validationOptions?: {
41
+ [key: string]: {
42
+ value?: any;
43
+ customErrorKey?: string;
44
+ };
45
+ };
46
+ }
47
+ export type Widget = 'default' | 'increment' | 'star' | 'HTML' | 'label' | 'password' | 'file' | 'date' | 'checkbox' | 'custom';
48
+ export type InputType = 'string' | 'email' | 'url' | 'phone' | 'date' | 'datetime' | 'time' | 'number' | 'boolean' | 'array' | 'object';
49
+ export interface Panel {
50
+ titleKey?: string;
51
+ isCollaspible?: boolean;
52
+ order?: number;
53
+ colSpan?: number;
54
+ direction?: 'row' | 'column';
55
+ parent?: string;
56
+ }
57
+ export interface JSONObject<Type> {
58
+ [Key: string]: Type;
59
+ }
60
+ export interface Form {
61
+ readonlyIf?: (values?: States) => boolean;
62
+ modelName?: string;
63
+ panels?: JSONObject<Panel>;
64
+ /** Fields attribut is a JSON object contening all fields of object.
65
+ * When defining a field you need to define as key in the JSON object
66
+ * the fieldName of the object.
67
+ */
68
+ fields: JSONObject<Field>;
69
+ }
70
+ export interface FormConfigs {
71
+ [formKey: string]: Form;
72
+ }
73
+ export interface DisplayPanel extends Panel {
74
+ key: string;
75
+ content?: (DisplayPanel | DisplayField)[];
76
+ }
77
+ export interface DisplayField extends Field {
78
+ key: string;
79
+ }
80
+ export interface Action {
81
+ key: string;
82
+ type: FormActionType;
83
+ titleKey?: string;
84
+ iconName?: string;
85
+ color?: Color;
86
+ hideIf?: (_states: States) => boolean;
87
+ disabledIf?: (_states: States) => boolean;
88
+ customAction?: (_options: ActionProps) => void;
89
+ needValidation?: boolean;
90
+ needRequiredFields?: boolean;
91
+ }
92
+ interface ActionProps {
93
+ handleReset?: () => void;
94
+ objectState?: any;
95
+ storeState?: any;
96
+ handleObjectChange?: (newValue?: any) => void;
97
+ dispatch?: Dispatch<any>;
98
+ }
99
+ export type FormActionType = 'update' | 'create' | 'reset' | 'refresh' | 'custom';
100
+ export {};
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export const DEFAULT_COLSPAN = 12;
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/forms/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { DisplayField, Form } from './types';
2
+ export declare const updateRequiredFieldsOfConfig: (config: Form, { objectState, storeState }: {
3
+ objectState: any;
4
+ storeState: any;
5
+ }) => Form;
6
+ export declare const isObjectMissingRequiredField: (content: any, config: Form) => boolean;
7
+ export declare const mapErrorWithTranslationKey: () => void;
8
+ export declare function validateSchema(content: Form, value: any): Promise<any>;
9
+ export declare function validateFieldSchema(field: DisplayField, value: any): Promise<any>;
10
+ export declare function getValidationErrors(err: any): any[];
@@ -0,0 +1,234 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { array, boolean, number, object, setLocale, string } from 'yup';
19
+ import { getFields } from './display.helpers';
20
+ export const updateRequiredFieldsOfConfig = (config, { objectState, storeState }) => {
21
+ if (config == null) {
22
+ return null;
23
+ }
24
+ const fields = getFields(config);
25
+ const result = { ...config.fields };
26
+ fields.forEach(_item => {
27
+ result[_item.key] = {
28
+ ..._item,
29
+ required: _item.required || _item.requiredIf({ objectState, storeState }),
30
+ };
31
+ });
32
+ return { ...config, fields: result };
33
+ };
34
+ export const isObjectMissingRequiredField = (content, config) => {
35
+ if (config == null) {
36
+ return false;
37
+ }
38
+ if (content == null) {
39
+ return true;
40
+ }
41
+ const fields = getFields(config);
42
+ const requiredFieldNames = fields
43
+ .filter(_item => _item.required === true)
44
+ .map(_item => _item.key);
45
+ return requiredFieldNames.some(_fieldName => content?.[_fieldName] == null);
46
+ };
47
+ export const mapErrorWithTranslationKey = () => {
48
+ setLocale({
49
+ mixed: {
50
+ notType: function notType(_ref) {
51
+ switch (_ref.type) {
52
+ case 'string':
53
+ return 'Base_FormValidation_String';
54
+ case 'number':
55
+ return 'Base_FormValidation_Number';
56
+ case 'boolean':
57
+ return 'Base_FormValidation_Boolean';
58
+ case 'array':
59
+ return 'Base_FormValidation_Array';
60
+ default:
61
+ return 'Base_FormValidation_Object';
62
+ }
63
+ },
64
+ required: 'Base_FormValidation_Required',
65
+ },
66
+ string: {
67
+ length: ({ length }) => ({
68
+ key: 'Base_FormValidation_String_Length',
69
+ values: { length },
70
+ }),
71
+ min: ({ min }) => ({ key: 'Base_FormValidation_String_Min', values: { min } }),
72
+ max: ({ max }) => ({ key: 'Base_FormValidation_String_Max', values: { max } }),
73
+ matches: ({ regex }) => ({
74
+ key: 'Base_FormValidation_String_Match',
75
+ values: { regex },
76
+ }),
77
+ email: 'Base_FormValidation_String_Email',
78
+ url: 'Base_FormValidation_String_Url',
79
+ uuid: 'Base_FormValidation_String_UUID',
80
+ trim: 'Base_FormValidation_String_Trim',
81
+ lowercase: 'Base_FormValidation_String_Lowercase',
82
+ uppercase: 'Base_FormValidation_String_Uppercase',
83
+ },
84
+ number: {
85
+ min: ({ min }) => ({ key: 'Base_FormValidation_Number_Min', values: { min } }),
86
+ max: ({ max }) => ({ key: 'Base_FormValidation_Number_Max', values: { max } }),
87
+ lessThan: ({ less }) => ({
88
+ key: 'Base_FormValidation_Number_LessThan',
89
+ values: { less },
90
+ }),
91
+ moreThan: ({ more }) => ({
92
+ key: 'Base_FormValidation_Number_MoreThan',
93
+ values: { more },
94
+ }),
95
+ positive: 'Base_FormValidation_Number_Positive',
96
+ negative: 'Base_FormValidation_Number_Negative',
97
+ integer: 'Base_FormValidation_Number_Integer',
98
+ },
99
+ date: {
100
+ min: ({ min }) => ({ key: 'Base_FormValidation_Date_Min', values: { min } }),
101
+ max: ({ max }) => ({ key: 'Base_FormValidation_Date_Max', values: { max } }),
102
+ },
103
+ boolean: {
104
+ isValue: ({ value }) => ({
105
+ key: 'Base_FormValidation_Boolean_IsValue',
106
+ values: { value },
107
+ }),
108
+ },
109
+ object: {
110
+ noUnknown: ({ unknown }) => ({
111
+ key: 'Base_FormValidation_Object_Unknown',
112
+ values: { unknown },
113
+ }),
114
+ },
115
+ array: {
116
+ min: ({ min }) => ({ key: 'Base_FormValidation_Array_Min', values: { min } }),
117
+ max: ({ max }) => ({ key: 'Base_FormValidation_Array_Max', values: { max } }),
118
+ length: ({ length }) => ({
119
+ key: 'Base_FormValidation_Array_Length',
120
+ values: { length },
121
+ }),
122
+ },
123
+ });
124
+ };
125
+ const createValidationSchema = (config) => {
126
+ const fields = getFields(config);
127
+ let schemaConfig = {};
128
+ fields
129
+ .filter(_field => !_field.readonly)
130
+ .filter(_field => _field.widget !== 'label')
131
+ .forEach(_field => {
132
+ schemaConfig[_field.key] = getFieldSchema(_field);
133
+ });
134
+ return object(schemaConfig);
135
+ };
136
+ const getRequiredCondition = (schema, _field) => {
137
+ if (_field.required) {
138
+ return schema.required();
139
+ }
140
+ return schema.nullable();
141
+ };
142
+ const getFieldSchema = (field) => {
143
+ let schema = null;
144
+ switch (field.type) {
145
+ case 'string':
146
+ case 'email':
147
+ case 'url':
148
+ case 'phone':
149
+ case 'date':
150
+ case 'datetime':
151
+ case 'time':
152
+ schema = string();
153
+ break;
154
+ case 'number':
155
+ schema = number();
156
+ break;
157
+ case 'boolean':
158
+ schema = boolean();
159
+ break;
160
+ case 'array':
161
+ schema = array().of(object());
162
+ break;
163
+ case 'object':
164
+ schema = object().shape({
165
+ id: getRequiredCondition(number().positive().integer(), field),
166
+ version: number().min(0).integer().nullable(),
167
+ });
168
+ break;
169
+ default:
170
+ throw new Error(`Type ${field.type} is not managed for schema creation`);
171
+ }
172
+ if (field.validationOptions == null) {
173
+ switch (field.type) {
174
+ case 'email':
175
+ schema = schema.email();
176
+ break;
177
+ case 'url':
178
+ schema = schema.url();
179
+ break;
180
+ case 'phone':
181
+ schema = schema.matches(/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s./0-9]*$/g, 'Base_FormValidation_PhoneNumber');
182
+ break;
183
+ case 'date':
184
+ schema = schema.matches(/^\d{4}-\d{2}-\d{2}$/g, 'Base_FormValidation_Date');
185
+ break;
186
+ case 'datetime':
187
+ schema = schema.matches(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?Z$/g, 'Base_FormValidation_DateTime');
188
+ break;
189
+ default:
190
+ break;
191
+ }
192
+ }
193
+ else {
194
+ for (const [key, _options] of Object.entries(field.validationOptions)) {
195
+ if (_options?.value != null) {
196
+ if (_options?.customErrorKey != null) {
197
+ schema = schema?.[key](_options.value, _options.customErrorKey);
198
+ }
199
+ else {
200
+ schema = schema?.[key](_options.value);
201
+ }
202
+ }
203
+ else {
204
+ if (_options?.customErrorKey != null) {
205
+ schema = schema?.[key](_options.customErrorKey);
206
+ }
207
+ else {
208
+ schema = schema?.[key]();
209
+ }
210
+ }
211
+ }
212
+ }
213
+ return getRequiredCondition(schema, field);
214
+ };
215
+ export async function validateSchema(content, value) {
216
+ return createValidationSchema(content).validate(value, {
217
+ abortEarly: false,
218
+ });
219
+ }
220
+ export async function validateFieldSchema(field, value) {
221
+ return getFieldSchema(field).validate(value);
222
+ }
223
+ export function getValidationErrors(err) {
224
+ return err.inner?.map(e => {
225
+ const message = typeof e.message === 'object' ? e.message?.key : e.message;
226
+ return {
227
+ attr: e.path,
228
+ message: message,
229
+ values: typeof e.message === 'object' ? e.message?.values : null,
230
+ translatable: !message.includes(e.path),
231
+ };
232
+ });
233
+ }
234
+ //# sourceMappingURL=validation.helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.helpers.js","sourceRoot":"","sources":["../../src/forms/validation.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAS,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAG5C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,MAAY,EACZ,EAAC,WAAW,EAAE,UAAU,EAAsC,EACxD,EAAE;IACR,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAEjC,MAAM,MAAM,G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AAM,OAAO,GAAG,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAE3E,OAAO;YACL,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI;YAChE,YAAY,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;SACxC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,8 +1,10 @@
1
- export function useBasicActions({ model, modelId, disableMailMessages, attachedFileScreenTitle, }: {
1
+ export function useBasicActions({ model, modelId, disableMailMessages, disableJsonFields, attachedFileScreenTitle, barcodeFieldname, }: {
2
2
  model: any;
3
3
  modelId: any;
4
4
  disableMailMessages: any;
5
+ disableJsonFields?: boolean;
5
6
  attachedFileScreenTitle: any;
7
+ barcodeFieldname?: string;
6
8
  }): {
7
9
  mailMessagesAction: {
8
10
  key: string;
@@ -25,6 +27,24 @@ export function useBasicActions({ model, modelId, disableMailMessages, attachedF
25
27
  onPress: () => void;
26
28
  showInHeader: boolean;
27
29
  };
30
+ barcodeAction: {
31
+ key: string;
32
+ order: number;
33
+ title: string;
34
+ iconName: string;
35
+ hideIf: boolean;
36
+ onPress: () => void;
37
+ showInHeader: boolean;
38
+ };
39
+ jsonFieldsAction: {
40
+ key: string;
41
+ order: number;
42
+ title: string;
43
+ iconName: string;
44
+ hideIf: boolean;
45
+ onPress: () => void;
46
+ showInHeader: boolean;
47
+ };
28
48
  } | {
29
49
  mailMessagesAction: {
30
50
  key: string;
@@ -34,4 +54,12 @@ export function useBasicActions({ model, modelId, disableMailMessages, attachedF
34
54
  key: string;
35
55
  hideIf: boolean;
36
56
  };
57
+ barcodeAction: {
58
+ key: string;
59
+ hideIf: boolean;
60
+ };
61
+ jsonFieldsAction: {
62
+ key: string;
63
+ hideIf: boolean;
64
+ };
37
65
  };
@@ -22,13 +22,21 @@ import { countAttachmentFiles } from '../features/attachedFilesSlice';
22
22
  import { countUnreadMailMessages } from '../features/mailMessageSlice';
23
23
  import { useTranslator } from '../i18n';
24
24
  import { checkNullString } from '../utils';
25
- export const useBasicActions = ({ model, modelId, disableMailMessages, attachedFileScreenTitle, }) => {
25
+ import { fetchModel } from '../api/model-api';
26
+ import { useOnline } from '../features/onlineSlice';
27
+ import { getNetInfo } from '../api/net-info-utils';
28
+ import { fetchJsonFieldsOfModel } from '../forms';
29
+ export const useBasicActions = ({ model, modelId, disableMailMessages, disableJsonFields = false, attachedFileScreenTitle, barcodeFieldname = 'barCode', }) => {
26
30
  const navigation = useNavigation();
27
31
  const I18n = useTranslator();
32
+ const online = useOnline();
28
33
  const dispatch = useDispatch();
29
34
  const { attachments } = useSelector(state => state.attachedFiles);
30
35
  const { unreadMessages } = useSelector(state => state.mailMessages);
31
36
  const [disableAttachementFiles, setDisableAttachementFiles] = useState(true);
37
+ const [disableBarcode, setDisableBarcode] = useState(true);
38
+ const [disableCustomView, setDisableCustomView] = useState(true);
39
+ const [isConnected, setIsConnected] = useState(true);
32
40
  const modelConfigured = useMemo(() => !checkNullString(model) && modelId != null, [model, modelId]);
33
41
  const countUnreadMessagesAPI = useCallback(() => {
34
42
  if (modelConfigured) {
@@ -49,6 +57,28 @@ export const useBasicActions = ({ model, modelId, disableMailMessages, attachedF
49
57
  useEffect(() => {
50
58
  setDisableAttachementFiles(attachments === 0);
51
59
  }, [attachments]);
60
+ useEffect(() => {
61
+ fetchModel({ model, modelId })
62
+ .catch(() => {
63
+ setDisableBarcode(true);
64
+ })
65
+ .then(object => setDisableBarcode(object?.[barcodeFieldname] == null));
66
+ }, [barcodeFieldname, model, modelId]);
67
+ useEffect(() => {
68
+ fetchJsonFieldsOfModel({ modelName: model })
69
+ .catch(() => setDisableCustomView(true))
70
+ .then(res => {
71
+ setDisableCustomView(res?.data?.total == null || res.data.total === 0);
72
+ });
73
+ }, [model]);
74
+ const checkInternetConnection = useCallback(async () => {
75
+ const { isConnected: _isConnected } = await getNetInfo();
76
+ setIsConnected(_isConnected);
77
+ }, []);
78
+ useEffect(() => {
79
+ const interval = setInterval(checkInternetConnection, 2000);
80
+ return () => clearInterval(interval.current);
81
+ }, [checkInternetConnection]);
52
82
  const mailMessagesAction = useMemo(() => {
53
83
  return {
54
84
  key: 'mailMessages',
@@ -89,17 +119,68 @@ export const useBasicActions = ({ model, modelId, disableMailMessages, attachedF
89
119
  modelId,
90
120
  navigation,
91
121
  ]);
122
+ const barcodeAction = useMemo(() => {
123
+ return {
124
+ key: 'barcode',
125
+ order: 30,
126
+ title: I18n.t('Base_Barcode'),
127
+ iconName: 'qrcode',
128
+ hideIf: disableBarcode,
129
+ onPress: () => navigation.navigate('BarcodeDisplayScreen', {
130
+ model,
131
+ modelId,
132
+ barcodeFieldname,
133
+ }),
134
+ showInHeader: true,
135
+ };
136
+ }, [I18n, barcodeFieldname, disableBarcode, model, modelId, navigation]);
137
+ const jsonFieldsAction = useMemo(() => {
138
+ return {
139
+ key: 'metaJsonFields',
140
+ order: 30,
141
+ title: I18n.t('Base_MetaJsonFields'),
142
+ iconName: 'object-group',
143
+ hideIf: disableCustomView ||
144
+ disableJsonFields ||
145
+ !online.isEnabled ||
146
+ !isConnected,
147
+ onPress: () => navigation.navigate('JsonFieldScreen', {
148
+ model,
149
+ modelId,
150
+ }),
151
+ showInHeader: true,
152
+ };
153
+ }, [
154
+ I18n,
155
+ disableCustomView,
156
+ disableJsonFields,
157
+ online.isEnabled,
158
+ isConnected,
159
+ navigation,
160
+ model,
161
+ modelId,
162
+ ]);
92
163
  return useMemo(() => {
93
164
  if (modelConfigured) {
94
165
  return {
95
166
  mailMessagesAction,
96
167
  attachedFilesAction,
168
+ barcodeAction,
169
+ jsonFieldsAction,
97
170
  };
98
171
  }
99
172
  return {
100
173
  mailMessagesAction: { key: 'mailMessages', hideIf: true },
101
174
  attachedFilesAction: { key: 'attachedFiles', hideIf: true },
175
+ barcodeAction: { key: 'barcode', hideIf: true },
176
+ jsonFieldsAction: { key: 'metaJsonFields', hideIf: true },
102
177
  };
103
- }, [attachedFilesAction, mailMessagesAction, modelConfigured]);
178
+ }, [
179
+ attachedFilesAction,
180
+ barcodeAction,
181
+ jsonFieldsAction,
182
+ mailMessagesAction,
183
+ modelConfigured,
184
+ ]);
104
185
  };
105
186
  //# sourceMappingURL=hooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/header/hooks.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,KAAK,EACL,OAAO,EACP,mBAAmB,EACnB,uBAAuB,GACxB,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE/B,MAAM,EAAC,WAAW,EAAC,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IA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AAa;gBACb,gBAAgB;aACjB,CAAC;SACH;QAED,OAAO;YACL,kBAAkB,EAAE,EAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAC;YACvD,mBAAmB,EAAE,EAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAC;YACzD,aAAa,EAAE,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAC;YAC7C,gBAAgB,EAAE,EAAC,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAC;SACxD,CAAC;IACJ,CAAC,EAAE;QACD,mBAAmB;QACnB,aAAa;QACb,gBAAgB;QAChB,kBAAkB;QAClB,eAAe;KAChB,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -6,7 +6,9 @@ export interface HeaderOptions {
6
6
  model?: string;
7
7
  modelId?: number;
8
8
  disableMailMessages?: boolean;
9
+ disableJsonFields?: boolean;
9
10
  attachedFileScreenTitle?: string;
11
+ barcodeFieldname?: string;
10
12
  headerTitle?: string;
11
13
  actions?: ActionType[];
12
14
  }
@@ -1 +1,2 @@
1
1
  export declare const useNavigation: () => any;
2
+ export declare const useIsFocused: () => boolean;
@@ -15,8 +15,11 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import { useNavigation as useReactNavigation } from '@react-navigation/native';
18
+ import { useNavigation as useReactNavigation, useIsFocused as useReactIsFocused, } from '@react-navigation/native';
19
19
  export const useNavigation = () => {
20
20
  return useReactNavigation();
21
21
  };
22
+ export const useIsFocused = () => {
23
+ return useReactIsFocused();
24
+ };
22
25
  //# sourceMappingURL=use-navigation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-navigation.js","sourceRoot":"","sources":["../../src/hooks/use-navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,aAAa,IAAI,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE7E,MAAM,CAAC,MAAM,aAAa,GAAG,GAAQ,EAAE;IACrC,OAAO,kBAAkB,EAAE,CAAC;AAC9B,CAAC,CAAC"}
1
+ {"version":3,"file":"use-navigation.js","sourceRoot":"","sources":["../../src/hooks/use-navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,aAAa,IAAI,kBAAkB,EACnC,YAAY,IAAI,iBAAiB,GAClC,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAQ,EAAE;IACrC,OAAO,kBAAkB,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAY,EAAE;IACxC,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export function getTranslations(language: any): any;
2
- export const selectLanguage: ((state: any) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any, {
2
+ export const selectLanguage: ((state: any, ...params: any[]) => any) & import("reselect").OutputSelectorFields<(...args: readonly unknown[]) => any, {
3
3
  clearCache: () => void;
4
4
  }> & {
5
5
  clearCache: () => void;
@@ -18,7 +18,9 @@
18
18
  import { useMemo } from 'react';
19
19
  import { i18nProvider } from '../i18n';
20
20
  function useTranslator() {
21
- return useMemo(() => ({ t: i18nProvider?.i18n ? i18nProvider.i18n.t : value => value }), []);
21
+ return useMemo(() => ({ t: i18nProvider?.i18n ? i18nProvider.i18n.t : value => value }),
22
+ // eslint-disable-next-line react-hooks/exhaustive-deps
23
+ [i18nProvider.i18n.language]);
22
24
  }
23
25
  export default useTranslator;
24
26
  //# sourceMappingURL=use-translator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-translator.js","sourceRoot":"","sources":["../../../src/i18n/hooks/use-translator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAMrC,SAAS,aAAa;IACpB,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC,EAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAC,CAAC,EACtE,EAAE,CACH,CAAC;AACJ,CAAC;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"use-translator.js","sourceRoot":"","sources":["../../../src/i18n/hooks/use-translator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAMrC,SAAS,aAAa;IACpB,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC,EAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAC,CAAC;IACtE,uDAAuD;IACvD,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,aAAa,CAAC"}