@axelor/aos-mobile-core 8.3.7 → 8.4.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 (318) hide show
  1. package/README.md +2 -312
  2. package/lib/api/aop-filter-api.d.ts +9 -0
  3. package/lib/api/aop-filter-api.js +63 -0
  4. package/lib/api/aop-filter-api.js.map +1 -0
  5. package/lib/api/currency-api.d.ts +1 -0
  6. package/lib/api/currency-api.js +28 -0
  7. package/lib/api/currency-api.js.map +1 -0
  8. package/lib/api/index.d.ts +12 -0
  9. package/lib/api/index.js +30 -0
  10. package/lib/api/index.js.map +1 -0
  11. package/lib/api/login-api.js +2 -2
  12. package/lib/api/login-api.js.map +1 -1
  13. package/lib/api/metafile-api.d.ts +1 -1
  14. package/lib/api/print-template-api.d.ts +1 -1
  15. package/lib/api/print-template-api.js +2 -1
  16. package/lib/api/print-template-api.js.map +1 -1
  17. package/lib/apiProviders/Standard/requests.helper.d.ts +13 -1
  18. package/lib/apiProviders/Standard/requests.helper.js +37 -2
  19. package/lib/apiProviders/Standard/requests.helper.js.map +1 -1
  20. package/lib/apiProviders/middlewares/index.d.ts +2 -1
  21. package/lib/apiProviders/middlewares/index.js +2 -1
  22. package/lib/apiProviders/middlewares/index.js.map +1 -1
  23. package/lib/apiProviders/middlewares/maintenance.d.ts +5 -0
  24. package/lib/apiProviders/middlewares/maintenance.js +63 -0
  25. package/lib/apiProviders/middlewares/maintenance.js.map +1 -0
  26. package/lib/app/Application.d.ts +1 -0
  27. package/lib/app/Application.js +1 -1
  28. package/lib/app/Application.js.map +1 -1
  29. package/lib/app/ContextedApplication.js +4 -2
  30. package/lib/app/ContextedApplication.js.map +1 -1
  31. package/lib/app/ContextsProvider.d.ts +2 -1
  32. package/lib/app/ContextsProvider.js +5 -1
  33. package/lib/app/ContextsProvider.js.map +1 -1
  34. package/lib/app/modules/types.d.ts +2 -2
  35. package/lib/auth/api/config-api.js +1 -1
  36. package/lib/auth/api/config-api.js.map +1 -1
  37. package/lib/components/external/Camera/Camera.js +10 -0
  38. package/lib/components/external/Camera/Camera.js.map +1 -1
  39. package/lib/components/external/Toast/Toast.js +10 -35
  40. package/lib/components/external/Toast/Toast.js.map +1 -1
  41. package/lib/components/external/Toast/ToastDisplay.d.ts +4 -0
  42. package/lib/components/external/Toast/ToastDisplay.js +59 -0
  43. package/lib/components/external/Toast/ToastDisplay.js.map +1 -0
  44. package/lib/components/molecules/UploadFileInput/UploadFileInput.js +35 -52
  45. package/lib/components/molecules/UploadFileInput/UploadFileInput.js.map +1 -1
  46. package/lib/components/molecules/index.d.ts +0 -3
  47. package/lib/components/molecules/index.js +0 -3
  48. package/lib/components/molecules/index.js.map +1 -1
  49. package/lib/components/organisms/DateInput/DateInput.js +1 -4
  50. package/lib/components/organisms/DateInput/DateInput.js.map +1 -1
  51. package/lib/components/organisms/FilterContainer/FilterContainer.d.ts +12 -0
  52. package/lib/components/organisms/FilterContainer/FilterContainer.js +54 -0
  53. package/lib/components/organisms/FilterContainer/FilterContainer.js.map +1 -0
  54. package/lib/components/organisms/PopupFilters/PopupFilters.d.ts +10 -0
  55. package/lib/components/organisms/PopupFilters/PopupFilters.js +73 -0
  56. package/lib/components/organisms/PopupFilters/PopupFilters.js.map +1 -0
  57. package/lib/components/organisms/PopupPrintTemplate/PopupPrintTemplate.d.ts +3 -1
  58. package/lib/components/organisms/PopupPrintTemplate/PopupPrintTemplate.js +20 -34
  59. package/lib/components/organisms/PopupPrintTemplate/PopupPrintTemplate.js.map +1 -1
  60. package/lib/components/organisms/index.d.ts +2 -4
  61. package/lib/components/organisms/index.js +2 -4
  62. package/lib/components/organisms/index.js.map +1 -1
  63. package/lib/components/pages/FormView/FormView.js +2 -0
  64. package/lib/components/pages/FormView/FormView.js.map +1 -1
  65. package/lib/components/templates/SearchListView/SearchListView.js +8 -5
  66. package/lib/components/templates/SearchListView/SearchListView.js.map +1 -1
  67. package/lib/components/templates/index.d.ts +0 -1
  68. package/lib/components/templates/index.js +0 -1
  69. package/lib/components/templates/index.js.map +1 -1
  70. package/lib/features/asyncFunctions-index.d.ts +12 -0
  71. package/lib/features/asyncFunctions-index.js +30 -0
  72. package/lib/features/asyncFunctions-index.js.map +1 -0
  73. package/lib/features/authSlice.js +8 -0
  74. package/lib/features/authSlice.js.map +1 -1
  75. package/lib/features/cameraScannerSlice.d.ts +3 -1
  76. package/lib/features/cameraScannerSlice.js +14 -2
  77. package/lib/features/cameraScannerSlice.js.map +1 -1
  78. package/lib/features/{attachedFilesSlice.d.ts → currencySlice.d.ts} +3 -3
  79. package/lib/features/{attachedFilesSlice.js → currencySlice.js} +20 -15
  80. package/lib/features/currencySlice.js.map +1 -0
  81. package/lib/features/index.d.ts +1 -2
  82. package/lib/features/index.js +1 -2
  83. package/lib/features/index.js.map +1 -1
  84. package/lib/forms/studio/api.helpers.d.ts +1 -1
  85. package/lib/forms/studio/api.helpers.js.map +1 -1
  86. package/lib/header/FilterProvider.d.ts +22 -0
  87. package/lib/header/FilterProvider.js +48 -0
  88. package/lib/header/FilterProvider.js.map +1 -0
  89. package/lib/header/HeaderActionsProvider.d.ts +1 -0
  90. package/lib/header/HeaderActionsProvider.js.map +1 -1
  91. package/lib/header/hooks.d.ts +1 -67
  92. package/lib/header/hooks.js +153 -158
  93. package/lib/header/hooks.js.map +1 -1
  94. package/lib/header/index.d.ts +2 -1
  95. package/lib/header/index.js +1 -0
  96. package/lib/header/index.js.map +1 -1
  97. package/lib/header/types.d.ts +0 -4
  98. package/lib/hooks/index.d.ts +3 -0
  99. package/lib/hooks/index.js +3 -0
  100. package/lib/hooks/index.js.map +1 -1
  101. package/lib/hooks/use-currency-formatter.d.ts +1 -0
  102. package/lib/hooks/use-currency-formatter.js +37 -0
  103. package/lib/hooks/use-currency-formatter.js.map +1 -0
  104. package/lib/hooks/use-header-registers.js +2 -0
  105. package/lib/hooks/use-header-registers.js.map +1 -1
  106. package/lib/hooks/use-mass-scanner.d.ts +15 -0
  107. package/lib/hooks/use-mass-scanner.js +70 -0
  108. package/lib/hooks/use-mass-scanner.js.map +1 -0
  109. package/lib/hooks/use-outdated-version.d.ts +3 -0
  110. package/lib/hooks/use-outdated-version.js +30 -0
  111. package/lib/hooks/use-outdated-version.js.map +1 -0
  112. package/lib/hooks/use-scan-activator.d.ts +8 -3
  113. package/lib/hooks/use-scan-activator.js +42 -22
  114. package/lib/hooks/use-scan-activator.js.map +1 -1
  115. package/lib/i18n/translations/en.json +9 -18
  116. package/lib/i18n/translations/fr.json +9 -18
  117. package/lib/index.d.ts +16 -22
  118. package/lib/index.js +16 -22
  119. package/lib/index.js.map +1 -1
  120. package/lib/models/objectFields.js +9 -0
  121. package/lib/models/objectFields.js.map +1 -1
  122. package/lib/navigator/Navigator.d.ts +3 -6
  123. package/lib/navigator/Navigator.js +17 -19
  124. package/lib/navigator/Navigator.js.map +1 -1
  125. package/lib/navigator/components/DrawerContent.d.ts +13 -0
  126. package/lib/navigator/{drawer → components}/DrawerContent.js +34 -73
  127. package/lib/navigator/components/DrawerContent.js.map +1 -0
  128. package/lib/navigator/components/header/Header.d.ts +9 -0
  129. package/lib/navigator/{drawer → components/header}/Header.js +13 -21
  130. package/lib/navigator/components/header/Header.js.map +1 -0
  131. package/lib/navigator/components/header/HeaderButton.d.ts +6 -0
  132. package/lib/navigator/{drawer/DrawerToggleButton.js → components/header/HeaderButton.js} +10 -10
  133. package/lib/navigator/components/header/HeaderButton.js.map +1 -0
  134. package/lib/navigator/components/header/HeaderOptionMenu.d.ts +13 -0
  135. package/lib/{components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js → navigator/components/header/HeaderOptionMenu.js} +10 -43
  136. package/lib/navigator/components/header/HeaderOptionMenu.js.map +1 -0
  137. package/lib/navigator/components/header/HeaderOptionMenuItem.js.map +1 -0
  138. package/lib/navigator/components/header/index.d.ts +1 -0
  139. package/lib/navigator/components/header/index.js +19 -0
  140. package/lib/navigator/components/header/index.js.map +1 -0
  141. package/lib/navigator/components/index.d.ts +2 -0
  142. package/lib/navigator/components/index.js +20 -0
  143. package/lib/navigator/components/index.js.map +1 -0
  144. package/lib/navigator/components/menu/AuthMenu.d.ts +8 -0
  145. package/lib/navigator/{drawer/AuthMenuIconButton.js → components/menu/AuthMenu.js} +10 -9
  146. package/lib/navigator/components/menu/AuthMenu.js.map +1 -0
  147. package/lib/navigator/components/menu/Menu.d.ts +13 -0
  148. package/lib/navigator/components/menu/Menu.js +63 -0
  149. package/lib/navigator/components/menu/Menu.js.map +1 -0
  150. package/lib/navigator/components/menu/MenuIconButton.d.ts +14 -0
  151. package/lib/navigator/{drawer → components/menu}/MenuIconButton.js +17 -20
  152. package/lib/navigator/components/menu/MenuIconButton.js.map +1 -0
  153. package/lib/navigator/components/menu/MenuItem.d.ts +14 -0
  154. package/lib/navigator/{drawer → components/menu}/MenuItem.js +6 -6
  155. package/lib/navigator/components/menu/MenuItem.js.map +1 -0
  156. package/lib/navigator/components/menu/MenuItemEntry.d.ts +16 -0
  157. package/lib/navigator/{drawer → components/menu}/MenuItemEntry.js +11 -19
  158. package/lib/navigator/components/menu/MenuItemEntry.js.map +1 -0
  159. package/lib/navigator/components/menu/MenuItemList.d.ts +12 -0
  160. package/lib/navigator/{drawer/Menu.js → components/menu/MenuItemList.js} +5 -46
  161. package/lib/navigator/components/menu/MenuItemList.js.map +1 -0
  162. package/lib/navigator/components/menu/MenuSeparator.d.ts +7 -0
  163. package/lib/navigator/{drawer → components/menu}/MenuSeparator.js +4 -8
  164. package/lib/navigator/components/menu/MenuSeparator.js.map +1 -0
  165. package/lib/navigator/components/menu/MenuTitle.d.ts +8 -0
  166. package/lib/navigator/{drawer → components/menu}/MenuTitle.js +3 -3
  167. package/lib/navigator/components/menu/MenuTitle.js.map +1 -0
  168. package/lib/navigator/components/menu/SubMenuItem.d.ts +9 -0
  169. package/lib/navigator/{drawer → components/menu}/SubMenuItem.js +4 -4
  170. package/lib/navigator/components/menu/SubMenuItem.js.map +1 -0
  171. package/lib/navigator/components/menu/SubMenuItemList.d.ts +12 -0
  172. package/lib/navigator/{drawer → components/menu}/SubMenuItemList.js +5 -5
  173. package/lib/navigator/components/menu/SubMenuItemList.js.map +1 -0
  174. package/lib/navigator/components/menu/index.d.ts +4 -0
  175. package/lib/navigator/components/menu/index.js +22 -0
  176. package/lib/navigator/components/menu/index.js.map +1 -0
  177. package/lib/navigator/helpers/access.helper.d.ts +4 -0
  178. package/lib/navigator/helpers/access.helper.js +121 -0
  179. package/lib/navigator/helpers/access.helper.js.map +1 -0
  180. package/lib/navigator/helpers/compatibility.helper.d.ts +3 -0
  181. package/lib/navigator/helpers/compatibility.helper.js +123 -0
  182. package/lib/navigator/helpers/compatibility.helper.js.map +1 -0
  183. package/lib/navigator/helpers/index.d.ts +6 -0
  184. package/lib/navigator/helpers/index.js +24 -0
  185. package/lib/navigator/helpers/index.js.map +1 -0
  186. package/lib/navigator/helpers/menu.helper.d.ts +56 -0
  187. package/lib/navigator/{menu.helper.js → helpers/menu.helper.js} +17 -22
  188. package/lib/navigator/helpers/menu.helper.js.map +1 -0
  189. package/lib/navigator/helpers/module.helper.d.ts +8 -0
  190. package/lib/navigator/helpers/module.helper.js +58 -0
  191. package/lib/navigator/helpers/module.helper.js.map +1 -0
  192. package/lib/navigator/helpers/navigation-type.d.ts +4 -0
  193. package/lib/navigator/helpers/navigation-type.js +19 -0
  194. package/lib/navigator/helpers/navigation-type.js.map +1 -0
  195. package/lib/navigator/helpers/tool.helper.d.ts +3 -0
  196. package/lib/navigator/helpers/tool.helper.js +44 -0
  197. package/lib/navigator/helpers/tool.helper.js.map +1 -0
  198. package/lib/navigator/index.d.ts +3 -1
  199. package/lib/navigator/index.js +3 -1
  200. package/lib/navigator/index.js.map +1 -1
  201. package/lib/navigator/{ActiveScreenProvider.d.ts → providers/active-screen.d.ts} +1 -1
  202. package/lib/navigator/{ActiveScreenProvider.js → providers/active-screen.js} +3 -3
  203. package/lib/navigator/providers/active-screen.js.map +1 -0
  204. package/lib/navigator/providers/index.d.ts +3 -0
  205. package/lib/navigator/providers/index.js +21 -0
  206. package/lib/navigator/providers/index.js.map +1 -0
  207. package/lib/navigator/providers/module-navigator.d.ts +8 -0
  208. package/lib/{screens/MailMessageScreen.js → navigator/providers/module-navigator.js} +7 -7
  209. package/lib/navigator/providers/module-navigator.js.map +1 -0
  210. package/lib/navigator/{NavigationInformationsProvider.d.ts → providers/navigation-informations.d.ts} +6 -2
  211. package/lib/navigator/{NavigationInformationsProvider.js → providers/navigation-informations.js} +11 -10
  212. package/lib/navigator/providers/navigation-informations.js.map +1 -0
  213. package/lib/screens/ErrorScreen.d.ts +7 -5
  214. package/lib/screens/ErrorScreen.js +26 -4
  215. package/lib/screens/ErrorScreen.js.map +1 -1
  216. package/lib/screens/index.d.ts +10 -33
  217. package/lib/screens/index.js +1 -17
  218. package/lib/screens/index.js.map +1 -1
  219. package/lib/tools/FileDownloader.js +7 -2
  220. package/lib/tools/FileDownloader.js.map +1 -1
  221. package/lib/tools/FilePicker.js +4 -3
  222. package/lib/tools/FilePicker.js.map +1 -1
  223. package/lib/types/index.d.ts +0 -2
  224. package/lib/types/index.js +0 -2
  225. package/lib/types/index.js.map +1 -1
  226. package/lib/utils/date.d.ts +1 -0
  227. package/lib/utils/date.js +4 -1
  228. package/lib/utils/date.js.map +1 -1
  229. package/lib/utils/index.d.ts +2 -2
  230. package/lib/utils/index.js +2 -2
  231. package/lib/utils/index.js.map +1 -1
  232. package/lib/websocket/WebSocketProvider.d.ts +20 -0
  233. package/lib/websocket/WebSocketProvider.js +89 -0
  234. package/lib/websocket/WebSocketProvider.js.map +1 -0
  235. package/lib/websocket/hooks.d.ts +2 -0
  236. package/lib/{navigator/drawer/BackIcon.js → websocket/hooks.js} +8 -17
  237. package/lib/websocket/hooks.js.map +1 -0
  238. package/lib/websocket/index.d.ts +2 -0
  239. package/lib/websocket/index.js +20 -0
  240. package/lib/websocket/index.js.map +1 -0
  241. package/lib/websocket/types.d.ts +13 -0
  242. package/lib/websocket/types.js +26 -0
  243. package/lib/websocket/types.js.map +1 -0
  244. package/package.json +35 -29
  245. package/lib/api/mail-message-api.d.ts +0 -44
  246. package/lib/api/mail-message-api.js +0 -129
  247. package/lib/api/mail-message-api.js.map +0 -1
  248. package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.js.map +0 -1
  249. package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.d.ts +0 -12
  250. package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js +0 -59
  251. package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js.map +0 -1
  252. package/lib/components/molecules/TrackItem/TrackItem.d.ts +0 -10
  253. package/lib/components/molecules/TrackItem/TrackItem.js +0 -65
  254. package/lib/components/molecules/TrackItem/TrackItem.js.map +0 -1
  255. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.d.ts +0 -13
  256. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js.map +0 -1
  257. package/lib/components/organisms/MailMessageCard/MailMessageCard.d.ts +0 -17
  258. package/lib/components/organisms/MailMessageCard/MailMessageCard.js +0 -76
  259. package/lib/components/organisms/MailMessageCard/MailMessageCard.js.map +0 -1
  260. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.d.ts +0 -13
  261. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js +0 -138
  262. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js.map +0 -1
  263. package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.d.ts +0 -17
  264. package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js +0 -81
  265. package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js.map +0 -1
  266. package/lib/components/templates/MailMessageView/MailMessageView.d.ts +0 -10
  267. package/lib/components/templates/MailMessageView/MailMessageView.js +0 -184
  268. package/lib/components/templates/MailMessageView/MailMessageView.js.map +0 -1
  269. package/lib/features/attachedFilesSlice.js.map +0 -1
  270. package/lib/features/mailMessageSlice.d.ts +0 -97
  271. package/lib/features/mailMessageSlice.js +0 -196
  272. package/lib/features/mailMessageSlice.js.map +0 -1
  273. package/lib/navigator/ActiveScreenProvider.js.map +0 -1
  274. package/lib/navigator/NavigationInformationsProvider.js.map +0 -1
  275. package/lib/navigator/drawer/AuthMenuIconButton.d.ts +0 -7
  276. package/lib/navigator/drawer/AuthMenuIconButton.js.map +0 -1
  277. package/lib/navigator/drawer/BackIcon.d.ts +0 -5
  278. package/lib/navigator/drawer/BackIcon.js.map +0 -1
  279. package/lib/navigator/drawer/DrawerContent.d.ts +0 -10
  280. package/lib/navigator/drawer/DrawerContent.js.map +0 -1
  281. package/lib/navigator/drawer/DrawerToggleButton.d.ts +0 -5
  282. package/lib/navigator/drawer/DrawerToggleButton.js.map +0 -1
  283. package/lib/navigator/drawer/Header.d.ts +0 -8
  284. package/lib/navigator/drawer/Header.js.map +0 -1
  285. package/lib/navigator/drawer/Menu.d.ts +0 -10
  286. package/lib/navigator/drawer/Menu.js.map +0 -1
  287. package/lib/navigator/drawer/MenuIconButton.d.ts +0 -12
  288. package/lib/navigator/drawer/MenuIconButton.js.map +0 -1
  289. package/lib/navigator/drawer/MenuItem.d.ts +0 -12
  290. package/lib/navigator/drawer/MenuItem.js.map +0 -1
  291. package/lib/navigator/drawer/MenuItemEntry.d.ts +0 -14
  292. package/lib/navigator/drawer/MenuItemEntry.js.map +0 -1
  293. package/lib/navigator/drawer/MenuSeparator.d.ts +0 -6
  294. package/lib/navigator/drawer/MenuSeparator.js.map +0 -1
  295. package/lib/navigator/drawer/MenuTitle.d.ts +0 -6
  296. package/lib/navigator/drawer/MenuTitle.js.map +0 -1
  297. package/lib/navigator/drawer/SubMenuItem.d.ts +0 -8
  298. package/lib/navigator/drawer/SubMenuItem.js.map +0 -1
  299. package/lib/navigator/drawer/SubMenuItemList.d.ts +0 -11
  300. package/lib/navigator/drawer/SubMenuItemList.js.map +0 -1
  301. package/lib/navigator/menu.helper.d.ts +0 -17
  302. package/lib/navigator/menu.helper.js.map +0 -1
  303. package/lib/navigator/module.helper.d.ts +0 -25
  304. package/lib/navigator/module.helper.js +0 -299
  305. package/lib/navigator/module.helper.js.map +0 -1
  306. package/lib/screens/MailMessageAttachedFilesScreen.d.ts +0 -5
  307. package/lib/screens/MailMessageAttachedFilesScreen.js +0 -68
  308. package/lib/screens/MailMessageAttachedFilesScreen.js.map +0 -1
  309. package/lib/screens/MailMessageScreen.d.ts +0 -5
  310. package/lib/screens/MailMessageScreen.js.map +0 -1
  311. package/lib/types/mail-message-notification-type.d.ts +0 -12
  312. package/lib/types/mail-message-notification-type.js +0 -48
  313. package/lib/types/mail-message-notification-type.js.map +0 -1
  314. package/lib/types/mail-message-type.d.ts +0 -18
  315. package/lib/types/mail-message-type.js +0 -55
  316. package/lib/types/mail-message-type.js.map +0 -1
  317. /package/lib/{components/molecules/HeaderOptionsMenuItem → navigator/components/header}/HeaderOptionMenuItem.d.ts +0 -0
  318. /package/lib/{components/molecules/HeaderOptionsMenuItem → navigator/components/header}/HeaderOptionMenuItem.js +0 -0
@@ -0,0 +1,121 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2025 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 { findIndexAndObjectOfModule, moduleHasMenus } from './module.helper';
19
+ function removeMenusFromOverridingModule(menus, keyToRemove) {
20
+ const _menus = { ...menus };
21
+ keyToRemove.forEach(_key => delete _menus[_key]);
22
+ return _menus;
23
+ }
24
+ export function manageOverridingMenus(modules) {
25
+ if (modules == null) {
26
+ return modules;
27
+ }
28
+ let result = [];
29
+ modules.forEach(_module => {
30
+ if (moduleHasMenus(_module)) {
31
+ const menusToRemove = [];
32
+ Object.keys(_module.menus).forEach(_menuKey => {
33
+ const menu = _module.menus[_menuKey];
34
+ const menuParentField = menu?.parent;
35
+ if (menuParentField != null && menuParentField !== _module.name) {
36
+ const { module: parentModule, index } = findIndexAndObjectOfModule(result, menuParentField);
37
+ if (index && parentModule) {
38
+ result[index] = {
39
+ ...parentModule,
40
+ menus: { ...parentModule.menus, [_menuKey]: menu },
41
+ };
42
+ }
43
+ menusToRemove.push(_menuKey);
44
+ }
45
+ });
46
+ const clearedModule = {
47
+ ..._module,
48
+ menus: removeMenusFromOverridingModule(_module.menus, menusToRemove),
49
+ };
50
+ result.push(clearedModule);
51
+ }
52
+ else {
53
+ result.push(_module);
54
+ }
55
+ });
56
+ return result;
57
+ }
58
+ export function manageWebConfig(modules, storeState) {
59
+ if (modules == null) {
60
+ return modules;
61
+ }
62
+ let result = [];
63
+ modules.forEach(_module => {
64
+ if (moduleHasMenus(_module)) {
65
+ const menusToRemove = [];
66
+ const menusNames = Object.keys(_module.menus);
67
+ menusNames.forEach(_menuKey => {
68
+ const menu = _module.menus[_menuKey];
69
+ if (menu.hideIf && menu.hideIf(storeState)) {
70
+ menusToRemove.push(_menuKey);
71
+ }
72
+ });
73
+ const clearedModule = {
74
+ ..._module,
75
+ menus: removeMenusFromOverridingModule(_module.menus, menusToRemove),
76
+ };
77
+ result.push(clearedModule);
78
+ }
79
+ else {
80
+ result.push(_module);
81
+ }
82
+ });
83
+ return result;
84
+ }
85
+ function updateAccessibleMenus(_module, isCustomizeMenuEnabled, accessibleMenus) {
86
+ if (moduleHasMenus(_module)) {
87
+ const enabledMenus = {};
88
+ const { menus } = _module;
89
+ Object.keys(menus).forEach(_key => {
90
+ const accessibleMenu = accessibleMenus?.find(menu => menu.technicalName === _key);
91
+ if (!isCustomizeMenuEnabled || accessibleMenu) {
92
+ enabledMenus[_key] = menus[_key];
93
+ if (accessibleMenu) {
94
+ enabledMenus[_key].order = accessibleMenu.menuOrder;
95
+ }
96
+ }
97
+ });
98
+ return {
99
+ ..._module,
100
+ menus: enabledMenus,
101
+ };
102
+ }
103
+ return _module;
104
+ }
105
+ export function checkModulesMenusAccessibility(modules, webConfig) {
106
+ if (!Array.isArray(modules) || modules.length === 0) {
107
+ return [];
108
+ }
109
+ else if (!Array.isArray(webConfig) || webConfig.length === 0) {
110
+ return modules;
111
+ }
112
+ const authorizedModules = [];
113
+ modules.forEach(_module => {
114
+ const mobileConfigForModule = webConfig.find(app => app.sequence === _module.name);
115
+ if (mobileConfigForModule == null || mobileConfigForModule?.isAppEnabled) {
116
+ authorizedModules.push(updateAccessibleMenus(_module, mobileConfigForModule?.isCustomizeMenuEnabled, mobileConfigForModule?.accessibleMenuList));
117
+ }
118
+ });
119
+ return authorizedModules;
120
+ }
121
+ //# sourceMappingURL=access.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.helper.js","sourceRoot":"","sources":["../../../src/navigator/helpers/access.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,0BAA0B,EAAE,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE3E,SAAS,+BAA+B,CACtC,KAA4B,EAC5B,WAAqB;IAErB,MAAM,MAAM,GAAG,EAAC,GAAG,KAAK,EAAC,CAAC;IAC1B,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAEjD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAiB;IACrD,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,OAAO,CAAC;KAChB;IAED,IAAI,MAAM,GAAa,EAAE,CAAC;IAE1B,OAAO,CAAC,OAAO,C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AI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;gBACjC,IAAI,cAAc,EAAE;oBAClB,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,cAAc,CAAC,SAAS,CAAC;iBACrD;aACF;QACH,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,OAAO;YACV,KAAK,EAAE,YAAY;SACpB,CAAC;KACH;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,OAAiB,EACjB,SAAgB;IAEhB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACnD,OAAO,EAAE,CAAC;KACX;SAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9D,OAAO,OAAO,CAAC;KAChB;IAED,MAAM,iBAAiB,GAAG,EAAE,CAAC;IAE7B,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QACxB,MAAM,qBAAqB,GAAG,SAAS,CAAC,IAAI,CAC1C,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC,IAAI,CACrC,CAAC;QAEF,IAAI,qBAAqB,IAAI,IAAI,IAAI,qBAAqB,EAAE,YAAY,EAAE;YACxE,iBAAiB,CAAC,IAAI,CACpB,qBAAqB,CACnB,OAAO,EACP,qBAAqB,EAAE,sBAAsB,EAC7C,qBAAqB,EAAE,kBAAkB,CAC1C,CACF,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Module, Compatibility } from '../../app';
2
+ export declare function formatCompatibilityToDisplay(compatibility: Compatibility): Compatibility;
3
+ export declare function manageWebCompatibility(modules: Module[], metaModules: any[]): Module[];
@@ -0,0 +1,123 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2025 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 { hasSubMenus } from './menu.helper';
19
+ import { moduleHasMenus } from './module.helper';
20
+ export function formatCompatibilityToDisplay(compatibility) {
21
+ return {
22
+ downToVersion: '-',
23
+ upToVersion: '-',
24
+ ...compatibility,
25
+ };
26
+ }
27
+ function findModuleDependingOnWeb(modules, webModuleName) {
28
+ const index = modules.findIndex(_module => _module.compatibilityAOS?.moduleName === webModuleName);
29
+ if (index === -1) {
30
+ return { module: null, index: null };
31
+ }
32
+ return { module: modules[index], index: index };
33
+ }
34
+ const manageCompatibilityOverride = (modules) => {
35
+ if (modules == null) {
36
+ return modules;
37
+ }
38
+ let result = [];
39
+ modules.forEach(_module => {
40
+ if (_module.compatibilityAOS != null) {
41
+ const { module: parentModule, index } = findModuleDependingOnWeb(result, _module.compatibilityAOS.moduleName);
42
+ if (index && parentModule) {
43
+ result[index] = {
44
+ ...parentModule,
45
+ compatibilityAOS: {
46
+ ...parentModule.compatibilityAOS,
47
+ ..._module.compatibilityAOS,
48
+ },
49
+ };
50
+ result.push({ ..._module, compatibilityAOS: null });
51
+ }
52
+ else {
53
+ result.push(_module);
54
+ }
55
+ }
56
+ else {
57
+ result.push(_module);
58
+ }
59
+ });
60
+ return result;
61
+ };
62
+ function manageMenuCompatibility(menus, metaModules, parentWebModule) {
63
+ if (Object.keys(menus ?? {}).length > 0) {
64
+ const _menus = {};
65
+ for (const [key, menu] of Object.entries(menus)) {
66
+ if (menu.compatibilityAOS) {
67
+ _menus[key] = menu;
68
+ }
69
+ const _menu = menu;
70
+ let compatibilityAOS = _menu.compatibilityAOS;
71
+ const menuWebModule = compatibilityAOS?.moduleName != null
72
+ ? metaModules?.find(({ name }) => name === compatibilityAOS?.moduleName)
73
+ : parentWebModule;
74
+ if (compatibilityAOS != null) {
75
+ compatibilityAOS = {
76
+ ...compatibilityAOS,
77
+ moduleName: compatibilityAOS.moduleName ?? menuWebModule?.name,
78
+ moduleVersion: menuWebModule?.moduleVersion,
79
+ };
80
+ }
81
+ if (hasSubMenus(_menu)) {
82
+ _menus[key] = {
83
+ ..._menu,
84
+ compatibilityAOS,
85
+ subMenus: manageMenuCompatibility(_menu.subMenus, metaModules, menuWebModule),
86
+ };
87
+ }
88
+ else {
89
+ _menus[key] = { ..._menu, compatibilityAOS };
90
+ }
91
+ }
92
+ return _menus;
93
+ }
94
+ return undefined;
95
+ }
96
+ export function manageWebCompatibility(modules, metaModules) {
97
+ if (!Array.isArray(modules) || modules.length === 0) {
98
+ return [];
99
+ }
100
+ const _modules = manageCompatibilityOverride(modules);
101
+ return _modules.map((_module) => {
102
+ if (_module.compatibilityAOS != null) {
103
+ let compatibilityAOS = _module.compatibilityAOS;
104
+ const webModule = metaModules?.find(({ name }) => name === compatibilityAOS.moduleName);
105
+ compatibilityAOS = {
106
+ ...compatibilityAOS,
107
+ moduleVersion: webModule?.moduleVersion,
108
+ };
109
+ if (moduleHasMenus(_module)) {
110
+ return {
111
+ ..._module,
112
+ compatibilityAOS,
113
+ menus: manageMenuCompatibility(_module.menus, metaModules, webModule),
114
+ };
115
+ }
116
+ else {
117
+ return { ..._module, compatibilityAOS };
118
+ }
119
+ }
120
+ return _module;
121
+ });
122
+ }
123
+ //# sourceMappingURL=compatibility.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility.helper.js","sourceRoot":"","sources":["../../../src/navigator/helpers/compatibility.helper.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AAgB,EAAC,CAAC;aACvC;SACF;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { checkModulesMenusAccessibility, manageOverridingMenus, manageWebConfig, } from './access.helper';
2
+ export { formatCompatibilityToDisplay, manageWebCompatibility, } from './compatibility.helper';
3
+ export { findIndexAndRouteOfMenu, formatMenus, getCompatibilityError, getDefaultMenuKey, getMenuTitle, hasSubMenus, isMenuIncompatible, manageSubMenusOverriding, resolveSubMenus, } from './menu.helper';
4
+ export { findIndexAndObjectOfModule, getDefaultModule, moduleHasMenus, numberOfModules, } from './module.helper';
5
+ export { addModuleTools, addToolDefaultValues } from './tool.helper';
6
+ export * from './navigation-type';
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2025 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 { checkModulesMenusAccessibility, manageOverridingMenus, manageWebConfig, } from './access.helper';
19
+ export { formatCompatibilityToDisplay, manageWebCompatibility, } from './compatibility.helper';
20
+ export { findIndexAndRouteOfMenu, formatMenus, getCompatibilityError, getDefaultMenuKey, getMenuTitle, hasSubMenus, isMenuIncompatible, manageSubMenusOverriding, resolveSubMenus, } from './menu.helper';
21
+ export { findIndexAndObjectOfModule, getDefaultModule, moduleHasMenus, numberOfModules, } from './module.helper';
22
+ export { addModuleTools, addToolDefaultValues } from './tool.helper';
23
+ export * from './navigation-type';
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/navigator/helpers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,cAAc,EAAE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AACnE,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { Compatibility, Menu, Module, SubMenu } from '../../app';
2
+ import { TranslatorProps } from '../../i18n';
3
+ import { Route } from './navigation-type';
4
+ export declare function findIndexAndRouteOfMenu(routes: Route[], menuName: string): {
5
+ route: Route;
6
+ index: number;
7
+ };
8
+ export declare function getMenuTitle(menu: Menu | Module, I18n: TranslatorProps): string;
9
+ export declare function isMenuIncompatible(compatibility: Compatibility): boolean;
10
+ export declare function getCompatibilityError(compatibility: Compatibility, I18n: TranslatorProps, showDetails?: boolean): string;
11
+ export declare function formatMenus(module: Module): {
12
+ [k: string]: {
13
+ order: number;
14
+ parent: string;
15
+ subMenus: {
16
+ [subMenuKey: string]: SubMenu;
17
+ };
18
+ icon: string;
19
+ disabled?: boolean;
20
+ compatibilityAOS?: Compatibility;
21
+ title: string;
22
+ hideIf?: (storeState: any) => boolean;
23
+ } | {
24
+ order: number;
25
+ parent: string;
26
+ isDefault?: boolean;
27
+ screen: string;
28
+ icon: string;
29
+ disabled?: boolean;
30
+ compatibilityAOS?: Compatibility;
31
+ title: string;
32
+ hideIf?: (storeState: any) => boolean;
33
+ } | {
34
+ order: number;
35
+ parent: string;
36
+ separator: true;
37
+ title: string;
38
+ hideIf?: (storeState: any) => boolean;
39
+ };
40
+ };
41
+ export declare function hasSubMenus(menu: Menu): boolean;
42
+ export declare function resolveSubMenus(subMenus: {
43
+ [key: string]: SubMenu;
44
+ }): {
45
+ key: string;
46
+ screen: string;
47
+ icon: string;
48
+ disabled?: boolean;
49
+ compatibilityAOS?: Compatibility;
50
+ title: string;
51
+ hideIf?: (storeState: any) => boolean;
52
+ parent?: string;
53
+ order?: number;
54
+ }[];
55
+ export declare function manageSubMenusOverriding(modules: Module[]): Module[];
56
+ export declare function getDefaultMenuKey(module: Module): string;
@@ -16,8 +16,9 @@
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
  import { checkNullString } from '@axelor/aos-mobile-ui';
19
- import { formatVersionString } from '../utils/string';
20
- import { formatCompatibilityToDisplay } from './module.helper';
19
+ import { formatVersionString } from '../../utils';
20
+ import { formatCompatibilityToDisplay } from './compatibility.helper';
21
+ import { moduleHasMenus } from './module.helper';
21
22
  export function findIndexAndRouteOfMenu(routes, menuName) {
22
23
  const index = routes.findIndex(_route => _route.name === menuName);
23
24
  if (index === -1) {
@@ -25,7 +26,7 @@ export function findIndexAndRouteOfMenu(routes, menuName) {
25
26
  }
26
27
  return { route: routes[index], index: index };
27
28
  }
28
- export function getMenuTitle(menu, { I18n }) {
29
+ export function getMenuTitle(menu, I18n) {
29
30
  if (menu.title != null) {
30
31
  return I18n.t(menu.title);
31
32
  }
@@ -83,9 +84,7 @@ export function formatMenus(module) {
83
84
  }));
84
85
  }
85
86
  export function hasSubMenus(menu) {
86
- return (menu != null &&
87
- Object.keys(menu).length > 0 &&
88
- Object.keys(menu).includes('subMenus'));
87
+ return Object.keys(menu ?? {}).includes('subMenus');
89
88
  }
90
89
  export function resolveSubMenus(subMenus) {
91
90
  if (subMenus == null || Object.keys(subMenus).length === 0) {
@@ -113,11 +112,11 @@ export function manageSubMenusOverriding(modules) {
113
112
  modules.forEach(module => {
114
113
  if (module.menus) {
115
114
  Object.values(module.menus).forEach(menu => {
116
- if (menu.subMenus && Object.keys(menu.subMenus).length !== 0) {
117
- menu.subMenus = Object.entries(menu.subMenus).reduce((acc, [subMenuKey, subMenu]) => {
115
+ if (hasSubMenus(menu)) {
116
+ const _menu = menu;
117
+ _menu.subMenus = Object.entries(_menu.subMenus).reduce((acc, [subMenuKey, subMenu]) => {
118
118
  if ('parent' in subMenu) {
119
- const parentMenuName = subMenu.parent;
120
- const parentMenu = allMenus[parentMenuName];
119
+ const parentMenu = allMenus[subMenu.parent];
121
120
  if (parentMenu) {
122
121
  if (!parentMenu.subMenus) {
123
122
  parentMenu.subMenus = {};
@@ -137,16 +136,13 @@ export function manageSubMenusOverriding(modules) {
137
136
  });
138
137
  return cleanEmptyMenusAndSubMenus(modules);
139
138
  }
140
- export function cleanEmptyMenusAndSubMenus(modules) {
139
+ function cleanEmptyMenusAndSubMenus(modules) {
141
140
  const cleanedModules = modules.map(module => {
142
- const { menus, ...restModuleAttrs } = module;
143
- if (menus) {
144
- if (Object.keys(menus).length === 0) {
145
- return { ...restModuleAttrs };
146
- }
141
+ const { menus } = module;
142
+ if (moduleHasMenus(module)) {
147
143
  const cleanedMenus = Object.entries(menus).map(([key, menu]) => {
148
144
  const { subMenus, ...restMenusAttrs } = menu;
149
- if (subMenus && Object.keys(subMenus).length === 0) {
145
+ if (hasSubMenus(menu) && Object.keys(subMenus).length === 0) {
150
146
  return [key, { ...restMenusAttrs }];
151
147
  }
152
148
  return [key, menu];
@@ -158,14 +154,13 @@ export function cleanEmptyMenusAndSubMenus(modules) {
158
154
  return cleanedModules;
159
155
  }
160
156
  export function getDefaultMenuKey(module) {
161
- const { menus } = module;
162
- if (menus == null) {
157
+ if (!moduleHasMenus(module)) {
163
158
  return null;
164
159
  }
165
- const defaultMenuEntry = Object.entries(menus)
160
+ const defaultMenuEntry = Object.entries(module.menus)
166
161
  .map(([key, menu]) => ({ ...menu, key }))
167
- .filter(menu => !isMenuIncompatible(menu.compatibilityAOS))
168
- .find(menu => menu.isDefault === true);
162
+ .filter((menu) => !isMenuIncompatible(menu.compatibilityAOS))
163
+ .find((menu) => menu.isDefault === true);
169
164
  return defaultMenuEntry ? defaultMenuEntry.key : null;
170
165
  }
171
166
  //# sourceMappingURL=menu.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.helper.js","sourceRoot":"","sources":["../../../src/navigator/helpers/menu.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAStD,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAC,4BAA4B,EAAC,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE/C,MAAM,UAAU,uBAAuB,CACrC,MAAe,EACf,QAAgB;IAEhB,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IAEnE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;KACnC;IAED,OAAO,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,EAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,IAAmB,EACnB,IAAqB;IAErB,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;QACtB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC3B;IACD,OAAQ,IAAY,CAA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MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,EAAC,CAAC;SAC7D;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;QAC3B,OAAO,IAAI,CAAC;KACb;IAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;SAClD,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC;SACtC,MAAM,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACjE,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC;IAEhD,OAAO,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Module } from '../../app';
2
+ export declare function findIndexAndObjectOfModule(modules: Module[], moduleName: string): {
3
+ module: Module;
4
+ index: number;
5
+ };
6
+ export declare function moduleHasMenus(_module: Module): boolean;
7
+ export declare function getDefaultModule(modules: Module[], mainMenu: string): Module;
8
+ export declare function numberOfModules(modules: Module[]): number;
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2025 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 function findIndexAndObjectOfModule(modules, moduleName) {
19
+ const index = modules.findIndex(_module => _module.name === moduleName);
20
+ if (index === -1) {
21
+ return { module: null, index: null };
22
+ }
23
+ return { module: modules[index], index: index };
24
+ }
25
+ export function moduleHasMenus(_module) {
26
+ return Object.keys(_module.menus ?? {}).length > 0;
27
+ }
28
+ export function getDefaultModule(modules, mainMenu) {
29
+ if (!Array.isArray(modules) || modules.length === 0) {
30
+ return null;
31
+ }
32
+ else if (mainMenu != null && modulesContainsMenu(modules, mainMenu)) {
33
+ return findModuleWithMenu(modules, mainMenu);
34
+ }
35
+ else {
36
+ return firstModulesWithMenus(modules);
37
+ }
38
+ }
39
+ function authModuleFilter(_module) {
40
+ return _module.name !== 'Auth';
41
+ }
42
+ export function numberOfModules(modules) {
43
+ return modules.filter(authModuleFilter).filter(moduleHasMenus).length;
44
+ }
45
+ function modulesContainsMenu(modules, menuKey) {
46
+ return modules
47
+ .filter(moduleHasMenus)
48
+ .some(_module => _module.menus[menuKey] != null);
49
+ }
50
+ function findModuleWithMenu(modules, menuKey) {
51
+ return modules
52
+ .filter(moduleHasMenus)
53
+ .find(_module => _module.menus[menuKey] != null);
54
+ }
55
+ function firstModulesWithMenus(modules) {
56
+ return modules.filter(moduleHasMenus)?.[0];
57
+ }
58
+ //# sourceMappingURL=module.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.helper.js","sourceRoot":"","sources":["../../../src/navigator/helpers/module.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,UAAU,0BAA0B,CACxC,OAAiB,EACjB,UAAkB;IAElB,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CA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AAO,CAAC,IAAI,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAiB,EAAE,OAAe;IAC5D,OAAO,OAAO;SACX,MAAM,CAAC,cAAc,CAAC;SACtB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAiB;IAC9C,OAAO,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { DrawerNavigationState, ParamListBase, NavigationHelpers, NavigationRoute } from '@react-navigation/native';
2
+ export type DrawerState = DrawerNavigationState<ParamListBase>;
3
+ export type NavigationObject = NavigationHelpers<ParamListBase>;
4
+ export type Route = NavigationRoute<ParamListBase, string>;
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2025 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 {};
19
+ //# sourceMappingURL=navigation-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-type.js","sourceRoot":"","sources":["../../../src/navigator/helpers/navigation-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
@@ -0,0 +1,3 @@
1
+ import { Module, Tool } from '../../app';
2
+ export declare const addModuleTools: (registeredTools: Tool[], module: Module) => Tool[];
3
+ export declare const addToolDefaultValues: (tool: Tool, idx: number) => Tool;
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2025 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 addModuleTools = (registeredTools, module) => {
19
+ const currentTools = registeredTools.map(_i => _i.key);
20
+ const moduleTools = module.globalTools;
21
+ let result = moduleTools.filter(({ key }) => !currentTools.includes(key)) ?? [];
22
+ registeredTools.forEach(_tool => {
23
+ const overrideTool = moduleTools.find(({ key }) => key === _tool.key);
24
+ if (overrideTool == null) {
25
+ result.push(_tool);
26
+ }
27
+ else {
28
+ result.push({
29
+ ..._tool,
30
+ ...overrideTool,
31
+ });
32
+ }
33
+ });
34
+ return result;
35
+ };
36
+ export const addToolDefaultValues = (tool, idx) => {
37
+ return {
38
+ ...tool,
39
+ order: tool.order ?? idx * 10,
40
+ hideIf: tool.hideIf != null ? tool.hideIf : () => false,
41
+ disabledIf: tool.disabledIf != null ? tool.disabledIf : () => false,
42
+ };
43
+ };
44
+ //# sourceMappingURL=tool.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.helper.js","sourceRoot":"","sources":["../../../src/navigator/helpers/tool.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,eAAuB,EACvB,MAAc,EACN,EAAE;IACV,MAAM,YAAY,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ActiveScreenProvider';
1
+ export * from './components';
2
+ export * from './helpers';
3
+ export * from './providers';
2
4
  export { default as Navigator } from './Navigator';
@@ -15,6 +15,8 @@
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
- export { getModelId, isModel, useActiveScreen, useContextRegister, } from './ActiveScreenProvider';
18
+ export * from './components';
19
+ export * from './helpers';
20
+ export * from './providers';
19
21
  export { default as Navigator } from './Navigator';
20
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,UAAU,EACV,OAAO,EACP,eAAe,EACf,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC"}