@axelor/aos-mobile-core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +310 -0
- package/lib/api/attached-files-api.d.ts +8 -0
- package/lib/api/attached-files-api.js +51 -0
- package/lib/api/attached-files-api.js.map +1 -0
- package/lib/api/login-api.d.ts +5 -0
- package/lib/api/login-api.js +41 -0
- package/lib/api/login-api.js.map +1 -0
- package/lib/api/mail-message-api.d.ts +43 -0
- package/lib/api/mail-message-api.js +114 -0
- package/lib/api/mail-message-api.js.map +1 -0
- package/lib/api/menu-config-api.d.ts +5 -0
- package/lib/api/menu-config-api.js +68 -0
- package/lib/api/menu-config-api.js.map +1 -0
- package/lib/api/metafile-api.d.ts +6 -0
- package/lib/api/metafile-api.js +50 -0
- package/lib/api/metafile-api.js.map +1 -0
- package/lib/api/mobile-config-api.d.ts +1 -0
- package/lib/api/mobile-config-api.js +31 -0
- package/lib/api/mobile-config-api.js.map +1 -0
- package/lib/api/net-info-utils.d.ts +5 -0
- package/lib/api/net-info-utils.js +29 -0
- package/lib/api/net-info-utils.js.map +1 -0
- package/lib/api/traceback-api.d.ts +7 -0
- package/lib/api/traceback-api.js +35 -0
- package/lib/api/traceback-api.js.map +1 -0
- package/lib/api/utils.d.ts +25 -0
- package/lib/api/utils.js +92 -0
- package/lib/api/utils.js.map +1 -0
- package/lib/app/Application.d.ts +15 -0
- package/lib/app/Application.js +29 -0
- package/lib/app/Application.js.map +1 -0
- package/lib/app/ContextedApplication.d.ts +9 -0
- package/lib/app/ContextedApplication.js +80 -0
- package/lib/app/ContextedApplication.js.map +1 -0
- package/lib/app/ContextsProvider.d.ts +14 -0
- package/lib/app/ContextsProvider.js +63 -0
- package/lib/app/ContextsProvider.js.map +1 -0
- package/lib/app/Module.d.ts +26 -0
- package/lib/app/Module.js +19 -0
- package/lib/app/Module.js.map +1 -0
- package/lib/app/RootNavigator.d.ts +7 -0
- package/lib/app/RootNavigator.js +69 -0
- package/lib/app/RootNavigator.js.map +1 -0
- package/lib/app/index.d.ts +5 -0
- package/lib/app/index.js +22 -0
- package/lib/app/index.js.map +1 -0
- package/lib/assets/Logo_Axelor.png +0 -0
- package/lib/auth/api/company-api.d.ts +1 -0
- package/lib/auth/api/company-api.js +31 -0
- package/lib/auth/api/company-api.js.map +1 -0
- package/lib/auth/api/config-api.d.ts +2 -0
- package/lib/auth/api/config-api.js +45 -0
- package/lib/auth/api/config-api.js.map +1 -0
- package/lib/auth/api/index.d.ts +4 -0
- package/lib/auth/api/index.js +22 -0
- package/lib/auth/api/index.js.map +1 -0
- package/lib/auth/api/language-api.d.ts +1 -0
- package/lib/auth/api/language-api.js +24 -0
- package/lib/auth/api/language-api.js.map +1 -0
- package/lib/auth/api/user-api.d.ts +2 -0
- package/lib/auth/api/user-api.js +30 -0
- package/lib/auth/api/user-api.js.map +1 -0
- package/lib/auth/features/asyncFunctionsIndex.d.ts +4 -0
- package/lib/auth/features/asyncFunctionsIndex.js +22 -0
- package/lib/auth/features/asyncFunctionsIndex.js.map +1 -0
- package/lib/auth/features/companySlice.d.ts +14 -0
- package/lib/auth/features/companySlice.js +48 -0
- package/lib/auth/features/companySlice.js.map +1 -0
- package/lib/auth/features/configSlice.d.ts +37 -0
- package/lib/auth/features/configSlice.js +82 -0
- package/lib/auth/features/configSlice.js.map +1 -0
- package/lib/auth/features/index.d.ts +4 -0
- package/lib/auth/features/index.js +22 -0
- package/lib/auth/features/index.js.map +1 -0
- package/lib/auth/features/languageSlice.d.ts +14 -0
- package/lib/auth/features/languageSlice.js +48 -0
- package/lib/auth/features/languageSlice.js.map +1 -0
- package/lib/auth/features/userSlice.d.ts +27 -0
- package/lib/auth/features/userSlice.js +83 -0
- package/lib/auth/features/userSlice.js.map +1 -0
- package/lib/auth/i18n/en.json +23 -0
- package/lib/auth/i18n/fr.json +23 -0
- package/lib/auth/index.d.ts +5 -0
- package/lib/auth/index.js +55 -0
- package/lib/auth/index.js.map +1 -0
- package/lib/auth/screens/SettingsScreen.d.ts +4 -0
- package/lib/auth/screens/SettingsScreen.js +79 -0
- package/lib/auth/screens/SettingsScreen.js.map +1 -0
- package/lib/auth/screens/UserScreen.d.ts +5 -0
- package/lib/auth/screens/UserScreen.js +116 -0
- package/lib/auth/screens/UserScreen.js.map +1 -0
- package/lib/auth/screens/index.d.ts +2 -0
- package/lib/auth/screens/index.js +20 -0
- package/lib/auth/screens/index.js.map +1 -0
- package/lib/axios/AxiosApi.d.ts +12 -0
- package/lib/axios/AxiosApi.js +32 -0
- package/lib/axios/AxiosApi.js.map +1 -0
- package/lib/components/external/Camera/Camera.d.ts +2 -0
- package/lib/components/external/Camera/Camera.js +148 -0
- package/lib/components/external/Camera/Camera.js.map +1 -0
- package/lib/components/external/Camera/CaptureButton.d.ts +10 -0
- package/lib/components/external/Camera/CaptureButton.js +118 -0
- package/lib/components/external/Camera/CaptureButton.js.map +1 -0
- package/lib/components/external/CameraScanner/CameraScanner.d.ts +10 -0
- package/lib/components/external/CameraScanner/CameraScanner.js +87 -0
- package/lib/components/external/CameraScanner/CameraScanner.js.map +1 -0
- package/lib/components/external/PlanningView/PlanningView.d.ts +11 -0
- package/lib/components/external/PlanningView/PlanningView.js +123 -0
- package/lib/components/external/PlanningView/PlanningView.js.map +1 -0
- package/lib/components/external/PlanningView/agenda.helpers.d.ts +10 -0
- package/lib/components/external/PlanningView/agenda.helpers.js +90 -0
- package/lib/components/external/PlanningView/agenda.helpers.js.map +1 -0
- package/lib/components/external/Scanner/Scanner.d.ts +2 -0
- package/lib/components/external/Scanner/Scanner.js +67 -0
- package/lib/components/external/Scanner/Scanner.js.map +1 -0
- package/lib/components/external/Stopwatch/Stopwatch.d.ts +18 -0
- package/lib/components/external/Stopwatch/Stopwatch.js +114 -0
- package/lib/components/external/Stopwatch/Stopwatch.js.map +1 -0
- package/lib/components/external/Timer/Timer.d.ts +9 -0
- package/lib/components/external/Timer/Timer.js +60 -0
- package/lib/components/external/Timer/Timer.js.map +1 -0
- package/lib/components/external/index.d.ts +6 -0
- package/lib/components/external/index.js +24 -0
- package/lib/components/external/index.js.map +1 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.js +22 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/molecules/ErrorText/ErrorText.d.ts +4 -0
- package/lib/components/molecules/ErrorText/ErrorText.js +31 -0
- package/lib/components/molecules/ErrorText/ErrorText.js.map +1 -0
- package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.d.ts +9 -0
- package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.js +56 -0
- package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.js.map +1 -0
- package/lib/components/molecules/IconSettings/IconSettings.d.ts +4 -0
- package/lib/components/molecules/IconSettings/IconSettings.js +31 -0
- package/lib/components/molecules/IconSettings/IconSettings.js.map +1 -0
- package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.d.ts +7 -0
- package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.js +84 -0
- package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.js.map +1 -0
- package/lib/components/molecules/LoginButton/LoginButton.d.ts +4 -0
- package/lib/components/molecules/LoginButton/LoginButton.js +40 -0
- package/lib/components/molecules/LoginButton/LoginButton.js.map +1 -0
- package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.d.ts +7 -0
- package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js +55 -0
- package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js.map +1 -0
- package/lib/components/molecules/TrackItem/TrackItem.d.ts +9 -0
- package/lib/components/molecules/TrackItem/TrackItem.js +65 -0
- package/lib/components/molecules/TrackItem/TrackItem.js.map +1 -0
- package/lib/components/molecules/index.d.ts +7 -0
- package/lib/components/molecules/index.js +25 -0
- package/lib/components/molecules/index.js.map +1 -0
- package/lib/components/organisms/AOSImage/AOSImage.d.ts +15 -0
- package/lib/components/organisms/AOSImage/AOSImage.js +37 -0
- package/lib/components/organisms/AOSImage/AOSImage.js.map +1 -0
- package/lib/components/organisms/AOSImageBubble/AOSImageBubble.d.ts +9 -0
- package/lib/components/organisms/AOSImageBubble/AOSImageBubble.js +30 -0
- package/lib/components/organisms/AOSImageBubble/AOSImageBubble.js.map +1 -0
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.d.ts +9 -0
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js +68 -0
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js.map +1 -0
- package/lib/components/organisms/LogoImage/LogoImage.d.ts +4 -0
- package/lib/components/organisms/LogoImage/LogoImage.js +52 -0
- package/lib/components/organisms/LogoImage/LogoImage.js.map +1 -0
- package/lib/components/organisms/MailMessageCard/MailMessageCard.d.ts +17 -0
- package/lib/components/organisms/MailMessageCard/MailMessageCard.js +79 -0
- package/lib/components/organisms/MailMessageCard/MailMessageCard.js.map +1 -0
- package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.d.ts +12 -0
- package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js +139 -0
- package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js.map +1 -0
- package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.d.ts +15 -0
- package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js +79 -0
- package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js.map +1 -0
- package/lib/components/organisms/PasswordInput/PasswordInput.d.ts +7 -0
- package/lib/components/organisms/PasswordInput/PasswordInput.js +36 -0
- package/lib/components/organisms/PasswordInput/PasswordInput.js.map +1 -0
- package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.d.ts +17 -0
- package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js +68 -0
- package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js.map +1 -0
- package/lib/components/organisms/UrlInput/UrlInput.d.ts +10 -0
- package/lib/components/organisms/UrlInput/UrlInput.js +38 -0
- package/lib/components/organisms/UrlInput/UrlInput.js.map +1 -0
- package/lib/components/organisms/UsernameInput/UsernameInput.d.ts +6 -0
- package/lib/components/organisms/UsernameInput/UsernameInput.js +33 -0
- package/lib/components/organisms/UsernameInput/UsernameInput.js.map +1 -0
- package/lib/components/organisms/index.d.ts +11 -0
- package/lib/components/organisms/index.js +29 -0
- package/lib/components/organisms/index.js.map +1 -0
- package/lib/components/templates/AttachedFilesView/AttachedFilesView.d.ts +10 -0
- package/lib/components/templates/AttachedFilesView/AttachedFilesView.js +87 -0
- package/lib/components/templates/AttachedFilesView/AttachedFilesView.js.map +1 -0
- package/lib/components/templates/MailMessageView/MailMessageView.d.ts +6 -0
- package/lib/components/templates/MailMessageView/MailMessageView.js +140 -0
- package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -0
- package/lib/components/templates/index.d.ts +2 -0
- package/lib/components/templates/index.js +20 -0
- package/lib/components/templates/index.js.map +1 -0
- package/lib/features/attachedFilesSlice.d.ts +35 -0
- package/lib/features/attachedFilesSlice.js +82 -0
- package/lib/features/attachedFilesSlice.js.map +1 -0
- package/lib/features/authSlice.d.ts +44 -0
- package/lib/features/authSlice.js +67 -0
- package/lib/features/authSlice.js.map +1 -0
- package/lib/features/cameraSlice.d.ts +14 -0
- package/lib/features/cameraSlice.js +52 -0
- package/lib/features/cameraSlice.js.map +1 -0
- package/lib/features/index.d.ts +8 -0
- package/lib/features/index.js +26 -0
- package/lib/features/index.js.map +1 -0
- package/lib/features/mailMessageSlice.d.ts +97 -0
- package/lib/features/mailMessageSlice.js +219 -0
- package/lib/features/mailMessageSlice.js.map +1 -0
- package/lib/features/menuConfigSlice.d.ts +14 -0
- package/lib/features/menuConfigSlice.js +48 -0
- package/lib/features/menuConfigSlice.js.map +1 -0
- package/lib/features/metafileSlice.d.ts +14 -0
- package/lib/features/metafileSlice.js +48 -0
- package/lib/features/metafileSlice.js.map +1 -0
- package/lib/features/mobileConfigSlice.d.ts +14 -0
- package/lib/features/mobileConfigSlice.js +52 -0
- package/lib/features/mobileConfigSlice.js.map +1 -0
- package/lib/features/scannerSlice.d.ts +14 -0
- package/lib/features/scannerSlice.js +52 -0
- package/lib/features/scannerSlice.js.map +1 -0
- package/lib/hooks/use-effect-debugger.d.ts +1 -0
- package/lib/hooks/use-effect-debugger.js +47 -0
- package/lib/hooks/use-effect-debugger.js.map +1 -0
- package/lib/i18n/api/translation.d.ts +2 -0
- package/lib/i18n/api/translation.js +38 -0
- package/lib/i18n/api/translation.js.map +1 -0
- package/lib/i18n/component/Translator.d.ts +6 -0
- package/lib/i18n/component/Translator.js +74 -0
- package/lib/i18n/component/Translator.js.map +1 -0
- package/lib/i18n/helpers/langages.d.ts +3 -0
- package/lib/i18n/helpers/langages.js +34 -0
- package/lib/i18n/helpers/langages.js.map +1 -0
- package/lib/i18n/helpers/translations.d.ts +1 -0
- package/lib/i18n/helpers/translations.js +24 -0
- package/lib/i18n/helpers/translations.js.map +1 -0
- package/lib/i18n/hooks/use-translator.d.ts +5 -0
- package/lib/i18n/hooks/use-translator.js +24 -0
- package/lib/i18n/hooks/use-translator.js.map +1 -0
- package/lib/i18n/i18n.d.ts +20 -0
- package/lib/i18n/i18n.js +53 -0
- package/lib/i18n/i18n.js.map +1 -0
- package/lib/i18n/index.d.ts +4 -0
- package/lib/i18n/index.js +22 -0
- package/lib/i18n/index.js.map +1 -0
- package/lib/i18n/translations/en.json +52 -0
- package/lib/i18n/translations/fr.json +52 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +36 -0
- package/lib/index.js.map +1 -0
- package/lib/navigator/Navigator.d.ts +12 -0
- package/lib/navigator/Navigator.js +118 -0
- package/lib/navigator/Navigator.js.map +1 -0
- package/lib/navigator/drawer/AuthMenuIconButton.d.ts +6 -0
- package/lib/navigator/drawer/AuthMenuIconButton.js +29 -0
- package/lib/navigator/drawer/AuthMenuIconButton.js.map +1 -0
- package/lib/navigator/drawer/BackIcon.d.ts +4 -0
- package/lib/navigator/drawer/BackIcon.js +32 -0
- package/lib/navigator/drawer/BackIcon.js.map +1 -0
- package/lib/navigator/drawer/DrawerContent.d.ts +8 -0
- package/lib/navigator/drawer/DrawerContent.js +177 -0
- package/lib/navigator/drawer/DrawerContent.js.map +1 -0
- package/lib/navigator/drawer/DrawerToggleButton.d.ts +4 -0
- package/lib/navigator/drawer/DrawerToggleButton.js +32 -0
- package/lib/navigator/drawer/DrawerToggleButton.js.map +1 -0
- package/lib/navigator/drawer/Menu.d.ts +8 -0
- package/lib/navigator/drawer/Menu.js +91 -0
- package/lib/navigator/drawer/Menu.js.map +1 -0
- package/lib/navigator/drawer/MenuIconButton.d.ts +10 -0
- package/lib/navigator/drawer/MenuIconButton.js +64 -0
- package/lib/navigator/drawer/MenuIconButton.js.map +1 -0
- package/lib/navigator/drawer/MenuItem.d.ts +8 -0
- package/lib/navigator/drawer/MenuItem.js +71 -0
- package/lib/navigator/drawer/MenuItem.js.map +1 -0
- package/lib/navigator/menu.helper.d.ts +8 -0
- package/lib/navigator/menu.helper.js +50 -0
- package/lib/navigator/menu.helper.js.map +1 -0
- package/lib/navigator/module.helper.d.ts +7 -0
- package/lib/navigator/module.helper.js +95 -0
- package/lib/navigator/module.helper.js.map +1 -0
- package/lib/navigator/roles.helper.d.ts +4 -0
- package/lib/navigator/roles.helper.js +33 -0
- package/lib/navigator/roles.helper.js.map +1 -0
- package/lib/redux/hooks.d.ts +5 -0
- package/lib/redux/hooks.js +25 -0
- package/lib/redux/hooks.js.map +1 -0
- package/lib/redux/store.d.ts +1 -0
- package/lib/redux/store.js +28 -0
- package/lib/redux/store.js.map +1 -0
- package/lib/screens/AttachedFilesScreen.d.ts +5 -0
- package/lib/screens/AttachedFilesScreen.js +26 -0
- package/lib/screens/AttachedFilesScreen.js.map +1 -0
- package/lib/screens/ErrorScreen.d.ts +5 -0
- package/lib/screens/ErrorScreen.js +46 -0
- package/lib/screens/ErrorScreen.js.map +1 -0
- package/lib/screens/LoginScreen.d.ts +4 -0
- package/lib/screens/LoginScreen.js +115 -0
- package/lib/screens/LoginScreen.js.map +1 -0
- package/lib/screens/MailMessageScreen.d.ts +5 -0
- package/lib/screens/MailMessageScreen.js +25 -0
- package/lib/screens/MailMessageScreen.js.map +1 -0
- package/lib/storage/Storage.d.ts +17 -0
- package/lib/storage/Storage.js +53 -0
- package/lib/storage/Storage.js.map +1 -0
- package/lib/tools/ClipboardProvider.d.ts +7 -0
- package/lib/tools/ClipboardProvider.js +59 -0
- package/lib/tools/ClipboardProvider.js.map +1 -0
- package/lib/tools/FileViewer.d.ts +13 -0
- package/lib/tools/FileViewer.js +48 -0
- package/lib/tools/FileViewer.js.map +1 -0
- package/lib/tools/LinkingProvider.d.ts +17 -0
- package/lib/tools/LinkingProvider.js +94 -0
- package/lib/tools/LinkingProvider.js.map +1 -0
- package/lib/tools/index.d.ts +3 -0
- package/lib/tools/index.js +21 -0
- package/lib/tools/index.js.map +1 -0
- package/lib/tools/linking.helper.d.ts +25 -0
- package/lib/tools/linking.helper.js +70 -0
- package/lib/tools/linking.helper.js.map +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +20 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/mail-message-notification-type.d.ts +12 -0
- package/lib/types/mail-message-notification-type.js +48 -0
- package/lib/types/mail-message-notification-type.js.map +1 -0
- package/lib/types/stopwatch-type.d.ts +14 -0
- package/lib/types/stopwatch-type.js +64 -0
- package/lib/types/stopwatch-type.js.map +1 -0
- package/lib/utils/agenda.d.ts +1 -0
- package/lib/utils/agenda.js +28 -0
- package/lib/utils/agenda.js.map +1 -0
- package/lib/utils/date.d.ts +4 -0
- package/lib/utils/date.js +41 -0
- package/lib/utils/date.js.map +1 -0
- package/lib/utils/displayers.d.ts +1 -0
- package/lib/utils/displayers.js +19 -0
- package/lib/utils/displayers.js.map +1 -0
- package/lib/utils/formatters.d.ts +5 -0
- package/lib/utils/formatters.js +74 -0
- package/lib/utils/formatters.js.map +1 -0
- package/lib/utils/index.d.ts +9 -0
- package/lib/utils/index.js +27 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/list.d.ts +3 -0
- package/lib/utils/list.js +101 -0
- package/lib/utils/list.js.map +1 -0
- package/lib/utils/object.d.ts +2 -0
- package/lib/utils/object.js +36 -0
- package/lib/utils/object.js.map +1 -0
- package/lib/utils/show-toast-message.d.ts +2 -0
- package/lib/utils/show-toast-message.js +22 -0
- package/lib/utils/show-toast-message.js.map +1 -0
- package/lib/utils/string.d.ts +4 -0
- package/lib/utils/string.js +54 -0
- package/lib/utils/string.js.map +1 -0
- package/lib/utils/time.d.ts +4 -0
- package/lib/utils/time.js +78 -0
- package/lib/utils/time.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,118 @@
|
|
|
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 React, { createContext, useCallback, useEffect, useMemo, useState, } from 'react';
|
|
19
|
+
import { createDrawerNavigator } from '@react-navigation/drawer';
|
|
20
|
+
import { createStackNavigator } from '@react-navigation/stack';
|
|
21
|
+
import { useThemeColor, getHeaderStyles } from '@axelor/aos-mobile-ui';
|
|
22
|
+
import DrawerContent from './drawer/DrawerContent';
|
|
23
|
+
import { filterAuthorizedModules, getDefaultModule, moduleHasMenus, updateAccessibleMenus, } from './module.helper';
|
|
24
|
+
import { getMenuTitle } from './menu.helper';
|
|
25
|
+
import useTranslator from '../i18n/hooks/use-translator';
|
|
26
|
+
import DrawerToggleButton from './drawer/DrawerToggleButton';
|
|
27
|
+
import BackIcon from './drawer/BackIcon';
|
|
28
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
29
|
+
import { fetchMenuConfig } from '../features/menuConfigSlice';
|
|
30
|
+
import { fetchMobileConfig } from '../features/mobileConfigSlice';
|
|
31
|
+
import AttachedFilesScreen from '../screens/AttachedFilesScreen';
|
|
32
|
+
import MailMessageScreen from '../screens/MailMessageScreen';
|
|
33
|
+
import { Dimensions } from 'react-native';
|
|
34
|
+
const Drawer = createDrawerNavigator();
|
|
35
|
+
const Stack = createStackNavigator();
|
|
36
|
+
export const ModuleNavigatorContext = createContext({
|
|
37
|
+
activeModule: null,
|
|
38
|
+
modulesMenus: {},
|
|
39
|
+
modulesScreens: {},
|
|
40
|
+
});
|
|
41
|
+
const Navigator = ({ modules, mainMenu, showModulesSubtitle = false }) => {
|
|
42
|
+
const { user } = useSelector(state => state.user);
|
|
43
|
+
const { restrictedMenus } = useSelector(state => state.menuConfig);
|
|
44
|
+
const { mobileConfigs } = useSelector(state => state.mobileConfig);
|
|
45
|
+
const [activeModule, setActiveModule] = useState(getDefaultModule(modules, mainMenu));
|
|
46
|
+
const I18n = useTranslator();
|
|
47
|
+
const Colors = useThemeColor();
|
|
48
|
+
const dispatch = useDispatch();
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
dispatch(fetchMobileConfig());
|
|
51
|
+
dispatch(fetchMenuConfig());
|
|
52
|
+
}, [dispatch]);
|
|
53
|
+
const styles = useMemo(() => getHeaderStyles(Colors), [Colors]);
|
|
54
|
+
const changeActiveModule = useCallback(moduleName => {
|
|
55
|
+
setActiveModule(modules.find(_module => _module.name === moduleName));
|
|
56
|
+
}, [modules]);
|
|
57
|
+
const enabledModule = useMemo(() => filterAuthorizedModules(modules, mobileConfigs, user), [mobileConfigs, modules, user]);
|
|
58
|
+
const modulesMenus = useMemo(() => {
|
|
59
|
+
return enabledModule
|
|
60
|
+
.map(_module => updateAccessibleMenus(_module, restrictedMenus, user))
|
|
61
|
+
.filter(moduleHasMenus)
|
|
62
|
+
.reduce((menus, _module) => ({ ...menus, ..._module.menus }), {});
|
|
63
|
+
}, [enabledModule, restrictedMenus, user]);
|
|
64
|
+
const modulesScreens = useMemo(() => modules.reduce((screens, module) => ({ ...screens, ...module.screens }), {
|
|
65
|
+
AttachedFilesScreen: {
|
|
66
|
+
title: 'Base_AttachedFiles',
|
|
67
|
+
component: AttachedFilesScreen,
|
|
68
|
+
options: {
|
|
69
|
+
shadedHeader: false,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
MailMessageScreen: {
|
|
73
|
+
title: 'Base_MailMessages',
|
|
74
|
+
component: MailMessageScreen,
|
|
75
|
+
options: {
|
|
76
|
+
shadedHeader: false,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
}), [modules]);
|
|
80
|
+
const ModulesScreensStackNavigator = useCallback(({ initialRouteName, ...rest }) => (<Stack.Navigator {...rest} initialRouteName={initialRouteName}>
|
|
81
|
+
{Object.entries(modulesScreens).map(([key, { component, title, options = { shadedHeader: true } }]) => {
|
|
82
|
+
const screenOptions = {
|
|
83
|
+
headerTintColor: Colors.primaryColor.background,
|
|
84
|
+
headerStyle: options?.shadedHeader
|
|
85
|
+
? styles.headerColor
|
|
86
|
+
: styles.listScreenHeaderStyle,
|
|
87
|
+
headerTitle: I18n.t(title),
|
|
88
|
+
headerTitleStyle: styles.headerTitle,
|
|
89
|
+
};
|
|
90
|
+
if (initialRouteName === key) {
|
|
91
|
+
screenOptions.headerLeft = () => (<DrawerToggleButton tintColor={Colors.primaryColor.background}/>);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
screenOptions.headerLeft = () => (<BackIcon tintColor={Colors.primaryColor.background}/>);
|
|
95
|
+
}
|
|
96
|
+
return (<Stack.Screen key={key} name={key} component={component} options={screenOptions}/>);
|
|
97
|
+
})}
|
|
98
|
+
</Stack.Navigator>), [Colors, I18n, modulesScreens, styles]);
|
|
99
|
+
const windowWidth = Dimensions.get('window').width;
|
|
100
|
+
const isLargeScreen = windowWidth >= 768;
|
|
101
|
+
return (<ModuleNavigatorContext.Provider value={{ activeModule, modulesMenus, modulesScreens }}>
|
|
102
|
+
<Drawer.Navigator initialRouteName={mainMenu} screenOptions={{
|
|
103
|
+
headerShown: false,
|
|
104
|
+
drawerStyle: {
|
|
105
|
+
backgroundColor: Colors.backgroundColor,
|
|
106
|
+
width: isLargeScreen ? windowWidth * 0.5 : windowWidth * 0.8,
|
|
107
|
+
},
|
|
108
|
+
}} drawerContent={props => (<DrawerContent {...props} modules={enabledModule} onModuleClick={changeActiveModule} showModulesSubtitle={showModulesSubtitle}/>)}>
|
|
109
|
+
{Object.entries(modulesMenus).map(([key, menu]) => (<Drawer.Screen key={key} name={key} options={{
|
|
110
|
+
title: getMenuTitle(menu, { I18n }),
|
|
111
|
+
}}>
|
|
112
|
+
{props => (<ModulesScreensStackNavigator {...props} initialRouteName={menu.screen}/>)}
|
|
113
|
+
</Drawer.Screen>))}
|
|
114
|
+
</Drawer.Navigator>
|
|
115
|
+
</ModuleNavigatorContext.Provider>);
|
|
116
|
+
};
|
|
117
|
+
export default Navigator;
|
|
118
|
+
//# sourceMappingURL=Navigator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/navigator/Navigator.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,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
|
+
* 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 React from 'react';
|
|
19
|
+
import { useThemeColor } from '@axelor/aos-mobile-ui';
|
|
20
|
+
import { authModule } from '../../auth';
|
|
21
|
+
import MenuIconButton from './MenuIconButton';
|
|
22
|
+
import useTranslator from '../../i18n/hooks/use-translator';
|
|
23
|
+
const AuthMenuIconButton = ({ isActive, showModulesSubtitle, onPress }) => {
|
|
24
|
+
const Colors = useThemeColor();
|
|
25
|
+
const I18n = useTranslator();
|
|
26
|
+
return (<MenuIconButton key={authModule.title} icon={authModule.icon} subtitle={showModulesSubtitle && I18n.t(authModule.subtitle)} disabled={authModule.disabled} color={isActive ? Colors.primaryColor.background_light : null} onPress={onPress} rounded={true}/>);
|
|
27
|
+
};
|
|
28
|
+
export default AuthMenuIconButton;
|
|
29
|
+
//# sourceMappingURL=AuthMenuIconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthMenuIconButton.js","sourceRoot":"","sources":["../../../src/navigator/drawer/AuthMenuIconButton.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,aAAa,MAAM,iCAAiC,CAAC;AAE5D,MAAM,kBAAkB,GAAG,CAAC,EAAC,QAAQ,EAAE,mBAAmB,EAAE,OAAO,EAAC,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAE7B,OAAO,CACL,CAAC,cAAc,CACb,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CACtB,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CACtB,QAAQ,CAAC,CAAC,mBAAmB,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAC7D,QAAQ,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAC9B,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAC9D,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,OAAO,CAAC,CAAC,IAAI,CAAC,EACd,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 React from 'react';
|
|
19
|
+
import { StyleSheet } from 'react-native';
|
|
20
|
+
import { StackActions, useNavigation } from '@react-navigation/native';
|
|
21
|
+
import { Icon } from '@axelor/aos-mobile-ui';
|
|
22
|
+
const BackIcon = ({ tintColor }) => {
|
|
23
|
+
const navigation = useNavigation();
|
|
24
|
+
return (<Icon style={styles.icon} name="angle-left" size={24} color={tintColor} touchable={true} onPress={() => navigation.dispatch(StackActions.pop())}/>);
|
|
25
|
+
};
|
|
26
|
+
const styles = StyleSheet.create({
|
|
27
|
+
icon: {
|
|
28
|
+
marginHorizontal: 14,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
export default BackIcon;
|
|
32
|
+
//# sourceMappingURL=BackIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackIcon.js","sourceRoot":"","sources":["../../../src/navigator/drawer/BackIcon.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAE3C,MAAM,QAAQ,GAAG,CAAC,EAAC,SAAS,EAAC,EAAE,EAAE;IAC/B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,OAAO,CACL,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CACnB,IAAI,CAAC,YAAY,CACjB,IAAI,CAAC,CAAC,EAAE,CAAC,CACT,KAAK,CAAC,CAAC,SAAS,CAAC,CACjB,SAAS,CAAC,CAAC,IAAI,CAAC,CAChB,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,EACvD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,gBAAgB,EAAE,EAAE;KACrB;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
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 React, { useRef, useContext, useMemo, useEffect, useCallback, } from 'react';
|
|
19
|
+
import { StyleSheet, View, Animated, TouchableOpacity } from 'react-native';
|
|
20
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
21
|
+
import { Text, useThemeColor } from '@axelor/aos-mobile-ui';
|
|
22
|
+
import { ModuleNavigatorContext } from '../Navigator';
|
|
23
|
+
import MenuIconButton from './MenuIconButton';
|
|
24
|
+
import Menu from './Menu';
|
|
25
|
+
import { moduleHasMenus, numberOfModules } from '../module.helper';
|
|
26
|
+
import { getMenuTitle } from '../menu.helper';
|
|
27
|
+
import useTranslator from '../../i18n/hooks/use-translator';
|
|
28
|
+
import { authModule } from '../../auth';
|
|
29
|
+
import { CommonActions, DrawerActions } from '@react-navigation/native';
|
|
30
|
+
import AuthMenuIconButton from './AuthMenuIconButton';
|
|
31
|
+
const DrawerContent = ({ state, modules, navigation, onModuleClick, showModulesSubtitle = false, }) => {
|
|
32
|
+
const Colors = useThemeColor();
|
|
33
|
+
const I18n = useTranslator();
|
|
34
|
+
const styles = useMemo(() => getStyles(Colors), [Colors]);
|
|
35
|
+
const secondaryMenusLeft = useRef(new Animated.Value(0)).current;
|
|
36
|
+
const { activeModule } = useContext(ModuleNavigatorContext);
|
|
37
|
+
const innerMenuIsVisible = useMemo(() => activeModule !== authModule, [activeModule]);
|
|
38
|
+
const drawerModules = useMemo(() => modules.filter(moduleHasMenus).filter(_module => _module !== authModule), [modules]);
|
|
39
|
+
const externalMenuIsVisible = useMemo(() => numberOfModules(drawerModules) > 1, [drawerModules]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (innerMenuIsVisible) {
|
|
42
|
+
openSecondaryMenu();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
closeSecondaryMenu();
|
|
46
|
+
}
|
|
47
|
+
}, [closeSecondaryMenu, innerMenuIsVisible, openSecondaryMenu]);
|
|
48
|
+
const openSecondaryMenu = useCallback(() => {
|
|
49
|
+
Animated.timing(secondaryMenusLeft, {
|
|
50
|
+
toValue: 0,
|
|
51
|
+
duration: 300,
|
|
52
|
+
useNativeDriver: false,
|
|
53
|
+
}).start();
|
|
54
|
+
}, [secondaryMenusLeft]);
|
|
55
|
+
const closeSecondaryMenu = useCallback(() => {
|
|
56
|
+
Animated.timing(secondaryMenusLeft, {
|
|
57
|
+
toValue: 100,
|
|
58
|
+
duration: 0,
|
|
59
|
+
useNativeDriver: false,
|
|
60
|
+
}).start();
|
|
61
|
+
}, [secondaryMenusLeft]);
|
|
62
|
+
const innerMenuPosition = useMemo(() => externalMenuIsVisible
|
|
63
|
+
? secondaryMenusLeft.interpolate({
|
|
64
|
+
inputRange: [0, 100],
|
|
65
|
+
outputRange: ['0%', '100%'],
|
|
66
|
+
})
|
|
67
|
+
: 0, [externalMenuIsVisible, secondaryMenusLeft]);
|
|
68
|
+
const handleAuthModuleClick = () => {
|
|
69
|
+
onModuleClick(authModule.name);
|
|
70
|
+
const route = state.routes.find(_route => (_route.name = Object.keys(authModule.menus)[0]));
|
|
71
|
+
const focused = state.routes.indexOf(route) === state.index &&
|
|
72
|
+
Object.keys(activeModule.menus).includes(route.name);
|
|
73
|
+
const event = navigation.emit({
|
|
74
|
+
type: 'drawerItemPress',
|
|
75
|
+
target: route.key,
|
|
76
|
+
canPreventDefault: true,
|
|
77
|
+
});
|
|
78
|
+
if (!event.defaultPrevented) {
|
|
79
|
+
navigation.dispatch({
|
|
80
|
+
...(focused
|
|
81
|
+
? DrawerActions.closeDrawer()
|
|
82
|
+
: CommonActions.navigate({ name: route.name, merge: true })),
|
|
83
|
+
target: state.key,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
if (numberOfModules(drawerModules) === 0) {
|
|
88
|
+
return (<SafeAreaView style={styles.container}>
|
|
89
|
+
<View style={styles.iconsContainer}>
|
|
90
|
+
<View style={styles.otherIconsContainer}>
|
|
91
|
+
<AuthMenuIconButton isActive={authModule === activeModule} showModulesSubtitle={showModulesSubtitle} onPress={handleAuthModuleClick}/>
|
|
92
|
+
</View>
|
|
93
|
+
</View>
|
|
94
|
+
<View style={styles.menusContainer}>
|
|
95
|
+
<Text style={styles.primaryMenuTitle}>
|
|
96
|
+
{I18n.t('Base_NoAppConfigured')}
|
|
97
|
+
</Text>
|
|
98
|
+
</View>
|
|
99
|
+
</SafeAreaView>);
|
|
100
|
+
}
|
|
101
|
+
return (<SafeAreaView style={styles.container}>
|
|
102
|
+
{externalMenuIsVisible && (<View style={styles.iconsContainer}>
|
|
103
|
+
<View>
|
|
104
|
+
{drawerModules.map(_module => (<View key={_module.name} style={styles.menuItemContainer}>
|
|
105
|
+
<MenuIconButton key={_module.title} icon={_module.icon} subtitle={showModulesSubtitle && I18n.t(_module.subtitle)} disabled={_module.disabled} color={_module === activeModule
|
|
106
|
+
? Colors.primaryColor.background_light
|
|
107
|
+
: null} onPress={() => onModuleClick(_module.name)}/>
|
|
108
|
+
</View>))}
|
|
109
|
+
</View>
|
|
110
|
+
<View style={styles.otherIconsContainer}>
|
|
111
|
+
<AuthMenuIconButton isActive={authModule === activeModule} showModulesSubtitle={showModulesSubtitle} onPress={handleAuthModuleClick}/>
|
|
112
|
+
</View>
|
|
113
|
+
</View>)}
|
|
114
|
+
<View style={styles.menusContainer}>
|
|
115
|
+
<View>
|
|
116
|
+
{drawerModules.map(_module => (<TouchableOpacity key={_module.name} style={styles.menuItemContainer} onPress={() => onModuleClick(_module.name)}>
|
|
117
|
+
<Text style={styles.primaryMenuTitle} textColor={Colors.secondaryColor_dark.background}>
|
|
118
|
+
{getMenuTitle(_module, { I18n })}
|
|
119
|
+
</Text>
|
|
120
|
+
</TouchableOpacity>))}
|
|
121
|
+
</View>
|
|
122
|
+
<Animated.View style={[
|
|
123
|
+
styles.secondaryMenusContainer,
|
|
124
|
+
{
|
|
125
|
+
left: innerMenuPosition,
|
|
126
|
+
},
|
|
127
|
+
]}>
|
|
128
|
+
<Menu activeModule={externalMenuIsVisible ? activeModule : drawerModules[0]} state={state} navigation={navigation} authMenu={!externalMenuIsVisible ? (<AuthMenuIconButton isActive={authModule === activeModule} showModulesSubtitle={showModulesSubtitle} onPress={handleAuthModuleClick}/>) : null} onItemClick={externalMenuIsVisible
|
|
129
|
+
? () => { }
|
|
130
|
+
: () => onModuleClick(drawerModules[0]?.name)}/>
|
|
131
|
+
</Animated.View>
|
|
132
|
+
</View>
|
|
133
|
+
</SafeAreaView>);
|
|
134
|
+
};
|
|
135
|
+
const getStyles = Colors => StyleSheet.create({
|
|
136
|
+
container: {
|
|
137
|
+
flex: 1,
|
|
138
|
+
flexDirection: 'row',
|
|
139
|
+
backgroundColor: Colors.screenBackgroundColor,
|
|
140
|
+
overflow: 'hidden',
|
|
141
|
+
},
|
|
142
|
+
menusContainer: {
|
|
143
|
+
flex: 1,
|
|
144
|
+
},
|
|
145
|
+
iconsContainer: {
|
|
146
|
+
justifyContent: 'space-between',
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
marginHorizontal: 12,
|
|
149
|
+
},
|
|
150
|
+
otherIconsContainer: {
|
|
151
|
+
marginVertical: 8,
|
|
152
|
+
},
|
|
153
|
+
menuItemContainer: {
|
|
154
|
+
height: 60,
|
|
155
|
+
marginVertical: 8,
|
|
156
|
+
justifyContent: 'center',
|
|
157
|
+
},
|
|
158
|
+
primaryMenuTitle: {
|
|
159
|
+
marginHorizontal: 6,
|
|
160
|
+
fontSize: 24,
|
|
161
|
+
fontWeight: 'bold',
|
|
162
|
+
},
|
|
163
|
+
secondaryMenusContainer: {
|
|
164
|
+
position: 'absolute',
|
|
165
|
+
backgroundColor: Colors.backgroundColor,
|
|
166
|
+
left: 0,
|
|
167
|
+
top: 0,
|
|
168
|
+
width: '100%',
|
|
169
|
+
height: '100%',
|
|
170
|
+
elevation: 4,
|
|
171
|
+
},
|
|
172
|
+
subMenuContainer: {
|
|
173
|
+
padding: 8,
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
export default DrawerContent;
|
|
177
|
+
//# sourceMappingURL=DrawerContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrawerContent.js","sourceRoot":"","sources":["../../../src/navigator/drawer/DrawerContent.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EACZ,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,GACZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAC,IAAI,E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AAc,EAAE,QAAQ;KACzB;IACD,gBAAgB,EAAE;QAChB,gBAAgB,EAAE,CAAC;QACnB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;KACnB;IACD,uBAAuB,EAAE;QACvB,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,CAAC;KACb;IACD,gBAAgB,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;CACF,CAAC,CAAC;AAEL,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 React from 'react';
|
|
19
|
+
import { StyleSheet } from 'react-native';
|
|
20
|
+
import { DrawerActions, useNavigation } from '@react-navigation/native';
|
|
21
|
+
import { Icon } from '@axelor/aos-mobile-ui';
|
|
22
|
+
const DrawerToggleButton = ({ tintColor }) => {
|
|
23
|
+
const navigation = useNavigation();
|
|
24
|
+
return (<Icon style={styles.icon} name="stream" size={24} color={tintColor} touchable={true} onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}/>);
|
|
25
|
+
};
|
|
26
|
+
const styles = StyleSheet.create({
|
|
27
|
+
icon: {
|
|
28
|
+
marginHorizontal: 14,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
export default DrawerToggleButton;
|
|
32
|
+
//# sourceMappingURL=DrawerToggleButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrawerToggleButton.js","sourceRoot":"","sources":["../../../src/navigator/drawer/DrawerToggleButton.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAE3C,MAAM,kBAAkB,GAAG,CAAC,EAAC,SAAS,EAAC,EAAE,EAAE;IACzC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,OAAO,CACL,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CACnB,IAAI,CAAC,QAAQ,CACb,IAAI,CAAC,CAAC,EAAE,CAAC,CACT,KAAK,CAAC,CAAC,SAAS,CAAC,CACjB,SAAS,CAAC,CAAC,IAAI,CAAC,CAChB,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC,EACjE,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,gBAAgB,EAAE,EAAE;KACrB;CACF,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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 React, { useContext, useMemo } from 'react';
|
|
19
|
+
import { View, StyleSheet } from 'react-native';
|
|
20
|
+
import { CommonActions, DrawerActions } from '@react-navigation/native';
|
|
21
|
+
import { Text } from '@axelor/aos-mobile-ui';
|
|
22
|
+
import { ModuleNavigatorContext } from '../Navigator';
|
|
23
|
+
import MenuItem from './MenuItem';
|
|
24
|
+
import { getMenuTitle } from '../menu.helper';
|
|
25
|
+
import useTranslator from '../../i18n/hooks/use-translator';
|
|
26
|
+
const MenuItemList = ({ state, navigation, activeModule, onItemClick }) => {
|
|
27
|
+
const I18n = useTranslator();
|
|
28
|
+
const { modulesMenus } = useContext(ModuleNavigatorContext);
|
|
29
|
+
return state.routes.map((route, i) => {
|
|
30
|
+
if (activeModule.menus[route.name] == null) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const focused = i === state.index && Object.keys(activeModule.menus).includes(route.name);
|
|
34
|
+
const menu = modulesMenus[route.name];
|
|
35
|
+
const onPress = () => {
|
|
36
|
+
onItemClick();
|
|
37
|
+
const event = navigation.emit({
|
|
38
|
+
type: 'drawerItemPress',
|
|
39
|
+
target: route.key,
|
|
40
|
+
canPreventDefault: true,
|
|
41
|
+
});
|
|
42
|
+
if (!event.defaultPrevented) {
|
|
43
|
+
navigation.dispatch({
|
|
44
|
+
...(focused
|
|
45
|
+
? DrawerActions.closeDrawer()
|
|
46
|
+
: CommonActions.navigate({ name: route.name, merge: true })),
|
|
47
|
+
target: state.key,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return (<MenuItem key={route.key} title={getMenuTitle(menu, { I18n })} icon={menu.icon} disabled={menu.disabled} onPress={onPress} isActive={focused}/>);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const Menu = ({ state, navigation, authMenu, activeModule, onItemClick }) => {
|
|
55
|
+
const I18n = useTranslator();
|
|
56
|
+
const title = useMemo(() => getMenuTitle(activeModule, { I18n }), [I18n, activeModule]);
|
|
57
|
+
return (<View style={styles.menuContainer}>
|
|
58
|
+
<View style={styles.moduleMenuContainer}>
|
|
59
|
+
<View style={styles.menuTitleContainer}>
|
|
60
|
+
<Text style={styles.menuTitle}>{title}</Text>
|
|
61
|
+
</View>
|
|
62
|
+
<MenuItemList state={state} navigation={navigation} activeModule={activeModule} onItemClick={onItemClick}/>
|
|
63
|
+
</View>
|
|
64
|
+
<View style={styles.authMenuIcon}>{authMenu}</View>
|
|
65
|
+
</View>);
|
|
66
|
+
};
|
|
67
|
+
const styles = StyleSheet.create({
|
|
68
|
+
menuContainer: {
|
|
69
|
+
flexDirection: 'column',
|
|
70
|
+
justifyContent: 'space-between',
|
|
71
|
+
height: '100%',
|
|
72
|
+
},
|
|
73
|
+
moduleMenuContainer: {
|
|
74
|
+
flexDirection: 'column',
|
|
75
|
+
paddingVertical: 8,
|
|
76
|
+
},
|
|
77
|
+
menuTitleContainer: {
|
|
78
|
+
paddingHorizontal: 16,
|
|
79
|
+
marginBottom: 8,
|
|
80
|
+
},
|
|
81
|
+
menuTitle: {
|
|
82
|
+
fontSize: 21,
|
|
83
|
+
fontWeight: 'bold',
|
|
84
|
+
},
|
|
85
|
+
authMenuIcon: {
|
|
86
|
+
marginBottom: 12,
|
|
87
|
+
marginLeft: 12,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
export default Menu;
|
|
91
|
+
//# sourceMappingURL=Menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/navigator/drawer/Menu.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,UAAU,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,cAAc,CAAC;AACpD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,aAAa,MAAM,iCAAiC,CAAC;AAE5D,MAAM,YAAY,GAAG,CAAC,EAAC,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAC,EAAE,EAAE;IACtE,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,EAAC,YAAY,EAAC,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAE1D,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACnC,IAAI,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE;YAC1C,OAAO,IAAI,CAAC;SACb;QAED,MAAM,OAAO,GACX,CAAC,KAAK,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KA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AY,EAAE,EAAE;QAChB,UAAU,EAAE,EAAE;KACf;CACF,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default MenuIconButton;
|
|
2
|
+
declare function MenuIconButton({ style, icon, onPress, color, subtitle, rounded, disabled, }: {
|
|
3
|
+
style: any;
|
|
4
|
+
icon: any;
|
|
5
|
+
onPress: any;
|
|
6
|
+
color: any;
|
|
7
|
+
subtitle: any;
|
|
8
|
+
rounded?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 React from 'react';
|
|
19
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
20
|
+
import { Icon, Text, useThemeColor } from '@axelor/aos-mobile-ui';
|
|
21
|
+
const WIDTH = 54;
|
|
22
|
+
const HEIGHT = 54;
|
|
23
|
+
const DEFAULT_RADIUS = 8;
|
|
24
|
+
const ROUNDED_RADIUS = WIDTH / 2;
|
|
25
|
+
const MenuIconButton = ({ style, icon, onPress, color, subtitle, rounded = false, disabled = false, }) => {
|
|
26
|
+
const Colors = useThemeColor();
|
|
27
|
+
return (<TouchableOpacity onPress={onPress} disabled={disabled} activeOpacity={0.95}>
|
|
28
|
+
<View style={[
|
|
29
|
+
styles.container,
|
|
30
|
+
{ borderRadius: rounded ? ROUNDED_RADIUS : DEFAULT_RADIUS },
|
|
31
|
+
{
|
|
32
|
+
backgroundColor: disabled
|
|
33
|
+
? Colors.secondaryColor.background_light
|
|
34
|
+
: color
|
|
35
|
+
? color
|
|
36
|
+
: Colors.backgroundColor,
|
|
37
|
+
},
|
|
38
|
+
style,
|
|
39
|
+
]}>
|
|
40
|
+
<Icon size={32} name={icon} color={disabled
|
|
41
|
+
? Colors.secondaryColor.background
|
|
42
|
+
: Colors.secondaryColor_dark.background}/>
|
|
43
|
+
</View>
|
|
44
|
+
{subtitle && (<Text style={styles.moduleSubtitle} numberOfLines={1}>
|
|
45
|
+
{subtitle}
|
|
46
|
+
</Text>)}
|
|
47
|
+
</TouchableOpacity>);
|
|
48
|
+
};
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
container: {
|
|
51
|
+
width: WIDTH,
|
|
52
|
+
height: HEIGHT,
|
|
53
|
+
flexDirection: 'row',
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
elevation: 2,
|
|
56
|
+
},
|
|
57
|
+
moduleSubtitle: {
|
|
58
|
+
fontSize: 10,
|
|
59
|
+
maxWidth: 54,
|
|
60
|
+
alignSelf: 'center',
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
export default MenuIconButton;
|
|
64
|
+
//# sourceMappingURL=MenuIconButton.js.map
|