@axelor/aos-mobile-core 8.1.7 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/print-template-api.d.ts +21 -0
- package/lib/api/print-template-api.js +95 -0
- package/lib/api/print-template-api.js.map +1 -0
- package/lib/app/Application.d.ts +5 -1
- package/lib/app/Application.js +15 -7
- package/lib/app/Application.js.map +1 -1
- package/lib/app/ContextedApplication.d.ts +4 -1
- package/lib/app/ContextedApplication.js +4 -3
- package/lib/app/ContextedApplication.js.map +1 -1
- package/lib/app/ContextsProvider.d.ts +3 -1
- package/lib/app/ContextsProvider.js +31 -72
- package/lib/app/ContextsProvider.js.map +1 -1
- package/lib/app/RootNavigator.d.ts +3 -1
- package/lib/app/RootNavigator.js +7 -4
- package/lib/app/RootNavigator.js.map +1 -1
- package/lib/app/modules/ModuleProvider.d.ts +3 -1
- package/lib/app/modules/ModuleProvider.js +12 -5
- package/lib/app/modules/ModuleProvider.js.map +1 -1
- package/lib/app/modules/hooks.d.ts +3 -0
- package/lib/app/modules/hooks.js +58 -0
- package/lib/app/modules/hooks.js.map +1 -0
- package/lib/app/modules/index.d.ts +1 -0
- package/lib/app/modules/index.js +1 -0
- package/lib/app/modules/index.js.map +1 -1
- package/lib/app/modules/types.d.ts +22 -1
- package/lib/auth/components/molecules/TranslationsButton/TranslationsButton.js +6 -4
- package/lib/auth/components/molecules/TranslationsButton/TranslationsButton.js.map +1 -1
- package/lib/auth/features/companySlice.d.ts +10 -1
- package/lib/auth/features/configSlice.d.ts +20 -2
- package/lib/auth/features/localizationSlice.d.ts +10 -1
- package/lib/auth/features/userSlice.d.ts +20 -2
- package/lib/auth/i18n/en.json +1 -0
- package/lib/auth/i18n/fr.json +1 -0
- package/lib/auth/index.js +10 -0
- package/lib/auth/index.js.map +1 -1
- package/lib/auth/models/objectFields.js +4 -5
- package/lib/auth/models/objectFields.js.map +1 -1
- package/lib/auth/screens/SettingsScreen.js +7 -1
- package/lib/auth/screens/SettingsScreen.js.map +1 -1
- package/lib/auth/screens/UserScreen.js +5 -2
- package/lib/auth/screens/UserScreen.js.map +1 -1
- package/lib/components/external/Camera/Camera.js +1 -1
- package/lib/components/external/Camera/Camera.js.map +1 -1
- package/lib/components/molecules/DateDisplay/DateDisplay.d.ts +2 -1
- package/lib/components/molecules/DateDisplay/DateDisplay.js +4 -1
- package/lib/components/molecules/DateDisplay/DateDisplay.js.map +1 -1
- package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.d.ts +11 -9
- package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.js +46 -23
- package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.js.map +1 -1
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.d.ts +2 -1
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js +10 -3
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js.map +1 -1
- package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.d.ts +3 -2
- package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js +2 -1
- package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js.map +1 -1
- package/lib/components/organisms/PopupPrintTemplate/PopupPrintTemplate.d.ts +9 -0
- package/lib/components/organisms/PopupPrintTemplate/PopupPrintTemplate.js +89 -0
- package/lib/components/organisms/PopupPrintTemplate/PopupPrintTemplate.js.map +1 -0
- package/lib/components/organisms/index.d.ts +1 -0
- package/lib/components/organisms/index.js +1 -0
- package/lib/components/organisms/index.js.map +1 -1
- package/lib/components/pages/CustomFieldForm/CustomFieldForm.d.ts +4 -1
- package/lib/components/pages/CustomFieldForm/CustomFieldForm.js +48 -22
- package/lib/components/pages/CustomFieldForm/CustomFieldForm.js.map +1 -1
- package/lib/components/pages/FormView/Components/Panel.js.map +1 -1
- package/lib/components/pages/FormView/Custom/CustomButton.d.ts +1 -5
- package/lib/components/pages/FormView/Custom/CustomButton.js +3 -5
- package/lib/components/pages/FormView/Custom/CustomButton.js.map +1 -1
- package/lib/components/pages/FormView/Custom/CustomPicker.js +11 -6
- package/lib/components/pages/FormView/Custom/CustomPicker.js.map +1 -1
- package/lib/components/pages/FormView/Custom/CustomSearchBar.js +2 -2
- package/lib/components/pages/FormView/Custom/CustomSearchBar.js.map +1 -1
- package/lib/components/pages/FormView/FormView.d.ts +3 -1
- package/lib/components/pages/FormView/FormView.js +3 -3
- package/lib/components/pages/FormView/FormView.js.map +1 -1
- package/lib/components/templates/GlobalToolBox/GlobalToolBox.d.ts +3 -0
- package/lib/components/templates/GlobalToolBox/GlobalToolBox.js +77 -0
- package/lib/components/templates/GlobalToolBox/GlobalToolBox.js.map +1 -0
- package/lib/components/templates/PeriodInput/PeriodInput.d.ts +3 -1
- package/lib/components/templates/PeriodInput/PeriodInput.js +62 -11
- package/lib/components/templates/PeriodInput/PeriodInput.js.map +1 -1
- package/lib/components/templates/PrintTemplateSearchBar/PrintTemplateSearchBar.d.ts +12 -0
- package/lib/components/templates/PrintTemplateSearchBar/PrintTemplateSearchBar.js +38 -0
- package/lib/components/templates/PrintTemplateSearchBar/PrintTemplateSearchBar.js.map +1 -0
- package/lib/components/templates/SingleSelectSearchListView/SingleSelectSearchListView.d.ts +30 -0
- package/lib/components/templates/SingleSelectSearchListView/SingleSelectSearchListView.js +81 -0
- package/lib/components/templates/SingleSelectSearchListView/SingleSelectSearchListView.js.map +1 -0
- package/lib/components/templates/index.d.ts +3 -0
- package/lib/components/templates/index.js +3 -0
- package/lib/components/templates/index.js.map +1 -1
- package/lib/config/RouterProvider.d.ts +4 -0
- package/lib/config/RouterProvider.js +4 -0
- package/lib/config/RouterProvider.js.map +1 -1
- package/lib/config/routes.d.ts +6 -0
- package/lib/config/routes.js +4 -0
- package/lib/config/routes.js.map +1 -1
- package/lib/dashboards/component/AOPChart/AOPChart.js +76 -36
- package/lib/dashboards/component/AOPChart/AOPChart.js.map +1 -1
- package/lib/dashboards/component/AOPChart/DynamicSearchForm.d.ts +8 -0
- package/lib/dashboards/component/AOPChart/DynamicSearchForm.js +84 -0
- package/lib/dashboards/component/AOPChart/DynamicSearchForm.js.map +1 -0
- package/lib/dashboards/menu.helpers.d.ts +1 -0
- package/lib/dashboards/menu.helpers.js +13 -0
- package/lib/dashboards/menu.helpers.js.map +1 -1
- package/lib/features/appConfigSlice.d.ts +10 -1
- package/lib/features/attachedFilesSlice.d.ts +30 -3
- package/lib/features/authSlice.d.ts +47 -3
- package/lib/features/authSlice.js +8 -1
- package/lib/features/authSlice.js.map +1 -1
- package/lib/features/formSlice.d.ts +40 -4
- package/lib/features/index.d.ts +1 -2
- package/lib/features/index.js +1 -2
- package/lib/features/index.js.map +1 -1
- package/lib/features/mailMessageSlice.d.ts +80 -8
- package/lib/features/metaJsonFieldSlice.d.ts +40 -4
- package/lib/features/metaModuleSlice.d.ts +10 -1
- package/lib/features/metafileSlice.d.ts +10 -1
- package/lib/features/permissionSlice.d.ts +20 -2
- package/lib/features/printTemplateSlice.d.ts +16 -0
- package/lib/features/{mobileWebViewSlice.js → printTemplateSlice.js} +19 -12
- package/lib/features/printTemplateSlice.js.map +1 -0
- package/lib/features/userSlice.d.ts +10 -1
- package/lib/forms/studio/api.helpers.d.ts +2 -2
- package/lib/forms/studio/api.helpers.js +4 -3
- package/lib/forms/studio/api.helpers.js.map +1 -1
- package/lib/forms/studio/display.helpers.d.ts +1 -1
- package/lib/forms/studio/display.helpers.js +2 -1
- package/lib/forms/studio/display.helpers.js.map +1 -1
- package/lib/forms/types.d.ts +1 -1
- package/lib/header/hooks.d.ts +19 -1
- package/lib/header/hooks.js +49 -15
- package/lib/header/hooks.js.map +1 -1
- package/lib/header/types.d.ts +1 -0
- package/lib/hooks/use-header-registers.js +3 -1
- package/lib/hooks/use-header-registers.js.map +1 -1
- package/lib/hooks/use-storage-config.d.ts +4 -0
- package/lib/hooks/use-storage-config.js +71 -0
- package/lib/hooks/use-storage-config.js.map +1 -0
- package/lib/i18n/component/Translator.d.ts +17 -5
- package/lib/i18n/component/Translator.js +28 -23
- package/lib/i18n/component/Translator.js.map +1 -1
- package/lib/i18n/helpers/langages.d.ts +2 -5
- package/lib/i18n/helpers/langages.js +1 -7
- package/lib/i18n/helpers/langages.js.map +1 -1
- package/lib/i18n/hooks/use-translator.js +3 -4
- package/lib/i18n/hooks/use-translator.js.map +1 -1
- package/lib/i18n/i18n.d.ts +0 -1
- package/lib/i18n/i18n.js +1 -5
- package/lib/i18n/i18n.js.map +1 -1
- package/lib/i18n/translations/en.json +6 -2
- package/lib/i18n/translations/fr.json +6 -2
- package/lib/index.d.ts +4 -2
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/models/objectFields.js +3 -0
- package/lib/models/objectFields.js.map +1 -1
- package/lib/models/searchFields.js +1 -0
- package/lib/models/searchFields.js.map +1 -1
- package/lib/navigator/ActiveScreenProvider.d.ts +35 -0
- package/lib/navigator/ActiveScreenProvider.js +117 -0
- package/lib/navigator/ActiveScreenProvider.js.map +1 -0
- package/lib/navigator/Navigator.d.ts +0 -2
- package/lib/navigator/Navigator.js +36 -53
- package/lib/navigator/Navigator.js.map +1 -1
- package/lib/navigator/drawer/Header.js +1 -1
- package/lib/navigator/drawer/Header.js.map +1 -1
- package/lib/navigator/drawer/MenuIconButton.js.map +1 -1
- package/lib/navigator/index.d.ts +2 -0
- package/lib/navigator/index.js +20 -0
- package/lib/navigator/index.js.map +1 -0
- package/lib/navigator/menu.helper.d.ts +0 -1
- package/lib/navigator/menu.helper.js +0 -13
- package/lib/navigator/menu.helper.js.map +1 -1
- package/lib/navigator/module.helper.d.ts +5 -3
- package/lib/navigator/module.helper.js +35 -6
- package/lib/navigator/module.helper.js.map +1 -1
- package/lib/screens/JsonFieldScreen.js +5 -14
- package/lib/screens/JsonFieldScreen.js.map +1 -1
- package/lib/sessions/SessionStorage.d.ts +1 -0
- package/lib/sessions/SessionStorage.js +5 -0
- package/lib/sessions/SessionStorage.js.map +1 -1
- package/lib/sessions/components/alerts/PopupCreateSession.js.map +1 -1
- package/lib/tools/FileViewer.d.ts +6 -2
- package/lib/tools/FileViewer.js +10 -4
- package/lib/tools/FileViewer.js.map +1 -1
- package/lib/utils/displayers.d.ts +1 -0
- package/lib/utils/displayers.js +1 -0
- package/lib/utils/displayers.js.map +1 -1
- package/lib/utils/image.js +7 -5
- package/lib/utils/image.js.map +1 -1
- package/lib/utils/index.d.ts +3 -3
- package/lib/utils/index.js +3 -3
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/list.d.ts +2 -0
- package/lib/utils/list.js +21 -0
- package/lib/utils/list.js.map +1 -1
- package/lib/utils/time.d.ts +1 -0
- package/lib/utils/time.js +1 -0
- package/lib/utils/time.js.map +1 -1
- package/lib/webViews/menu.helper.d.ts +1 -0
- package/lib/webViews/menu.helper.js +13 -0
- package/lib/webViews/menu.helper.js.map +1 -1
- package/package.json +38 -38
- package/lib/features/mobileDashboardSlice.d.ts +0 -4
- package/lib/features/mobileDashboardSlice.js +0 -43
- package/lib/features/mobileDashboardSlice.js.map +0 -1
- package/lib/features/mobileWebViewSlice.d.ts +0 -4
- package/lib/features/mobileWebViewSlice.js.map +0 -1
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
export const useHeaderRegisters = headerRegisters => {
|
|
19
|
-
|
|
19
|
+
headerRegisters.forEach(_moduleHook => {
|
|
20
|
+
_moduleHook();
|
|
21
|
+
});
|
|
20
22
|
};
|
|
21
23
|
//# sourceMappingURL=use-header-registers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-header-registers.js","sourceRoot":"","sources":["../../src/hooks/use-header-registers.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC,EAAE;IAClD,
|
|
1
|
+
{"version":3,"file":"use-header-registers.js","sourceRoot":"","sources":["../../src/hooks/use-header-registers.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC,EAAE;IAClD,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACpC,WAAW,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 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 { useCallback, useEffect, useMemo } from 'react';
|
|
19
|
+
import { useConfig, useTheme } from '@axelor/aos-mobile-ui';
|
|
20
|
+
import { storage } from '../storage/Storage';
|
|
21
|
+
const CONFIG_STORAGE_KEY = 'ui_config';
|
|
22
|
+
export const useStorageUpdater = () => {
|
|
23
|
+
const { showFilter, showSubtitles, showToolbox, hideVirtualKeyboard } = useConfig();
|
|
24
|
+
const { activeTheme, isColorBlind } = useTheme();
|
|
25
|
+
const storageConfig = useMemo(() => ({
|
|
26
|
+
showFilter,
|
|
27
|
+
showSubtitles,
|
|
28
|
+
showToolbox,
|
|
29
|
+
hideVirtualKeyboard,
|
|
30
|
+
activeTheme,
|
|
31
|
+
isColorBlind,
|
|
32
|
+
}), [
|
|
33
|
+
activeTheme,
|
|
34
|
+
hideVirtualKeyboard,
|
|
35
|
+
isColorBlind,
|
|
36
|
+
showFilter,
|
|
37
|
+
showSubtitles,
|
|
38
|
+
showToolbox,
|
|
39
|
+
]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
storage.setItem(CONFIG_STORAGE_KEY, storageConfig);
|
|
42
|
+
}, [storageConfig]);
|
|
43
|
+
};
|
|
44
|
+
export const useConfigUpdater = () => {
|
|
45
|
+
const { setFilterConfig, setShowSubtitles, setShowToolbox, setVirtualKeyboardConfig, } = useConfig();
|
|
46
|
+
const { activateColorBlind, changeTheme } = useTheme();
|
|
47
|
+
const updateConfigFromStorage = useCallback(() => {
|
|
48
|
+
const _config = storage.getItem(CONFIG_STORAGE_KEY);
|
|
49
|
+
if (_config != null) {
|
|
50
|
+
setFilterConfig(_config.showFilter);
|
|
51
|
+
setShowSubtitles(_config.showSubtitles);
|
|
52
|
+
setShowToolbox(_config.showToolbox);
|
|
53
|
+
setVirtualKeyboardConfig(_config.hideVirtualKeyboard);
|
|
54
|
+
if (_config.isColorBlind) {
|
|
55
|
+
activateColorBlind();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
changeTheme(_config.activeTheme?.key);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, [
|
|
62
|
+
activateColorBlind,
|
|
63
|
+
changeTheme,
|
|
64
|
+
setFilterConfig,
|
|
65
|
+
setShowSubtitles,
|
|
66
|
+
setShowToolbox,
|
|
67
|
+
setVirtualKeyboardConfig,
|
|
68
|
+
]);
|
|
69
|
+
return useMemo(() => ({ updateConfigFromStorage }), [updateConfigFromStorage]);
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=use-storage-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-storage-config.js","sourceRoot":"","sources":["../../src/hooks/use-storage-config.ts"],"names":[],"m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EAAE;YACnB,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACpC,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACxC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACpC,wBAAwB,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;YACtD,IAAI,OAAO,CAAC,YAAY,EAAE;gBACxB,kBAAkB,EAAE,CAAC;aACtB;iBAAM;gBACL,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;aACvC;SACF;IACH,CAAC,EAAE;QACD,kBAAkB;QAClB,WAAW;QACX,eAAe;QACf,gBAAgB;QAChB,cAAc;QACd,wBAAwB;KACzB,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAC,uBAAuB,EAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC"}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
export function getTranslations(
|
|
2
|
-
export const selectLanguage: ((state: any, ...params: any[]) =>
|
|
1
|
+
export function getTranslations(localization: any): any;
|
|
2
|
+
export const selectLanguage: ((state: any, ...params: any[]) => {
|
|
3
|
+
localization: any;
|
|
4
|
+
language: any;
|
|
5
|
+
}) & {
|
|
3
6
|
clearCache: () => void;
|
|
4
7
|
resultsCount: () => number;
|
|
5
8
|
resetResultsCount: () => void;
|
|
6
9
|
} & {
|
|
7
|
-
resultFunc: (...resultFuncArgs: readonly any[]) =>
|
|
8
|
-
|
|
10
|
+
resultFunc: (...resultFuncArgs: readonly any[]) => {
|
|
11
|
+
localization: any;
|
|
12
|
+
language: any;
|
|
13
|
+
};
|
|
14
|
+
memoizedResultFunc: ((...resultFuncArgs: readonly any[]) => {
|
|
15
|
+
localization: any;
|
|
16
|
+
language: any;
|
|
17
|
+
}) & {
|
|
9
18
|
clearCache: () => void;
|
|
10
19
|
resultsCount: () => number;
|
|
11
20
|
resetResultsCount: () => void;
|
|
12
21
|
};
|
|
13
|
-
lastResult: () =>
|
|
22
|
+
lastResult: () => {
|
|
23
|
+
localization: any;
|
|
24
|
+
language: any;
|
|
25
|
+
};
|
|
14
26
|
dependencies: import("reselect").SelectorArray<any>;
|
|
15
27
|
recomputations: () => number;
|
|
16
28
|
resetRecomputations: () => void;
|
|
@@ -22,15 +22,18 @@ import { reduceTranslationsToI18nResources } from '../helpers/translations';
|
|
|
22
22
|
import { storage } from '../../storage/Storage';
|
|
23
23
|
import { i18nProvider } from '../i18n';
|
|
24
24
|
import { useSelector } from 'react-redux';
|
|
25
|
-
export const selectLanguage = createSelector(state => state?.user, userState =>
|
|
25
|
+
export const selectLanguage = createSelector(state => state?.user, userState => ({
|
|
26
|
+
localization: userState?.user?.localization?.code,
|
|
27
|
+
language: userState?.user?.localization?.language?.code,
|
|
28
|
+
}));
|
|
26
29
|
const DEFAULT_NAMESPACE = 'translation';
|
|
27
30
|
const useLanguageEffect = callback => {
|
|
28
|
-
const
|
|
31
|
+
const { localization } = useSelector(selectLanguage);
|
|
29
32
|
useEffect(() => {
|
|
30
|
-
if (
|
|
31
|
-
callback(
|
|
33
|
+
if (localization) {
|
|
34
|
+
callback({ localization });
|
|
32
35
|
}
|
|
33
|
-
}, [
|
|
36
|
+
}, [callback, localization]);
|
|
34
37
|
};
|
|
35
38
|
const Translator = () => {
|
|
36
39
|
useEffect(() => {
|
|
@@ -38,37 +41,39 @@ const Translator = () => {
|
|
|
38
41
|
loadTranslationsFromStorage(i18nProvider.i18n.language);
|
|
39
42
|
});
|
|
40
43
|
}, []);
|
|
41
|
-
useLanguageEffect(useCallback(
|
|
42
|
-
loadTranslationsFromStorage(
|
|
44
|
+
useLanguageEffect(useCallback(({ localization }) => {
|
|
45
|
+
loadTranslationsFromStorage(localization);
|
|
43
46
|
}, []));
|
|
44
|
-
useLanguageEffect(useCallback(
|
|
45
|
-
fetchTranslation(
|
|
47
|
+
useLanguageEffect(useCallback(({ localization }) => {
|
|
48
|
+
fetchTranslation(localization).then(translations => {
|
|
46
49
|
if (translations) {
|
|
47
|
-
addTranslationsToI18n(
|
|
48
|
-
saveTranslationResourcesToStorage(
|
|
50
|
+
addTranslationsToI18n(localization, translations);
|
|
51
|
+
saveTranslationResourcesToStorage(localization);
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
54
|
}, []));
|
|
52
|
-
useLanguageEffect(useCallback(
|
|
53
|
-
i18nProvider.i18n.changeLanguage(
|
|
55
|
+
useLanguageEffect(useCallback(({ localization }) => {
|
|
56
|
+
i18nProvider.i18n.changeLanguage(localization);
|
|
54
57
|
}, []));
|
|
55
58
|
return null;
|
|
56
59
|
};
|
|
57
|
-
export function getTranslations(
|
|
58
|
-
return i18nProvider.i18n.getResourceBundle(
|
|
60
|
+
export function getTranslations(localization) {
|
|
61
|
+
return i18nProvider.i18n.getResourceBundle(localization, DEFAULT_NAMESPACE);
|
|
59
62
|
}
|
|
60
|
-
function loadTranslationsFromStorage(
|
|
61
|
-
const translations = storage.getItem(`language.${
|
|
63
|
+
function loadTranslationsFromStorage(localization) {
|
|
64
|
+
const translations = storage.getItem(`language.${localization}`);
|
|
62
65
|
if (translations != null) {
|
|
63
|
-
i18nProvider.i18n.addResourceBundle(
|
|
66
|
+
i18nProvider.i18n.addResourceBundle(localization, DEFAULT_NAMESPACE, translations);
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
|
-
function addTranslationsToI18n(
|
|
67
|
-
i18nProvider.i18n.addResources(
|
|
69
|
+
function addTranslationsToI18n(localization, translations) {
|
|
70
|
+
i18nProvider.i18n.addResources(localization, DEFAULT_NAMESPACE, reduceTranslationsToI18nResources(translations));
|
|
68
71
|
}
|
|
69
|
-
function saveTranslationResourcesToStorage(
|
|
70
|
-
const translationResources = i18nProvider.i18n.getResourceBundle(
|
|
71
|
-
|
|
72
|
+
function saveTranslationResourcesToStorage(localization) {
|
|
73
|
+
const translationResources = i18nProvider.i18n.getResourceBundle(localization, DEFAULT_NAMESPACE);
|
|
74
|
+
if (translationResources != null) {
|
|
75
|
+
storage.setItem(`language.${localization}`, translationResources);
|
|
76
|
+
}
|
|
72
77
|
}
|
|
73
78
|
export default Translator;
|
|
74
79
|
//# sourceMappingURL=Translator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Translator.js","sourceRoot":"","sources":["../../../src/i18n/component/Translator.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,iCAAiC,EAAC,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AACrC,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAC1C,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EACpB,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"Translator.js","sourceRoot":"","sources":["../../../src/i18n/component/Translator.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,iCAAiC,EAAC,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAC9C,OAAO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C"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { resourcesBinding } from '../i18n';
|
|
2
|
-
|
|
2
|
+
export declare const formatResources: ({ resources, }: {
|
|
3
3
|
resources: resourcesBinding[];
|
|
4
|
-
}
|
|
5
|
-
export declare const getSupportedLangages: ({ resources }: translations) => string[];
|
|
6
|
-
export declare const formatResources: ({ resources }: translations) => {};
|
|
7
|
-
export {};
|
|
4
|
+
}) => {};
|
|
@@ -15,13 +15,7 @@
|
|
|
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 const
|
|
19
|
-
if (resources == null || resources.length === 0) {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
return resources.map(langageBundle => langageBundle.lng);
|
|
23
|
-
};
|
|
24
|
-
export const formatResources = ({ resources }) => {
|
|
18
|
+
export const formatResources = ({ resources, }) => {
|
|
25
19
|
if (resources == null || resources.length === 0) {
|
|
26
20
|
return {};
|
|
27
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langages.js","sourceRoot":"","sources":["../../../src/i18n/helpers/langages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"langages.js","sourceRoot":"","sources":["../../../src/i18n/helpers/langages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,SAAS,GAGV,EAAE,EAAE;IACH,IAAI,SAAS,IAAI,IAAI,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC/C,OAAO,EAAE,CAAC;KACX;IAED,MAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,SAAS,CAAC,OAAO,CACf,aAAa,CAAC,EAAE,CACd,CAAC,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG;QACnC,WAAW,EAAE,aAAa,CAAC,kBAAkB;KAC9C,CAAC,CACL,CAAC;IAEF,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
|
|
@@ -16,11 +16,10 @@
|
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
import { useMemo } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { useTranslation } from 'react-i18next';
|
|
20
20
|
function useTranslator() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
[i18nProvider.i18n.language]);
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
return useMemo(() => ({ t: t != null ? t : value => value }), [t]);
|
|
24
23
|
}
|
|
25
24
|
export default useTranslator;
|
|
26
25
|
//# sourceMappingURL=use-translator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-translator.js","sourceRoot":"","sources":["../../../src/i18n/hooks/use-translator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"use-translator.js","sourceRoot":"","sources":["../../../src/i18n/hooks/use-translator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAM7C,SAAS,aAAa;IACpB,MAAM,EAAC,CAAC,EAAC,GAAG,cAAc,EAAE,CAAC;IAE7B,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC;AAED,eAAe,aAAa,CAAC"}
|
package/lib/i18n/i18n.d.ts
CHANGED
package/lib/i18n/i18n.js
CHANGED
|
@@ -17,13 +17,11 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import i18next from 'i18next';
|
|
19
19
|
import { initReactI18next } from 'react-i18next';
|
|
20
|
-
import { formatResources
|
|
20
|
+
import { formatResources } from './helpers/langages';
|
|
21
21
|
class I18nProvider {
|
|
22
|
-
supportedLng;
|
|
23
22
|
resources;
|
|
24
23
|
i18next;
|
|
25
24
|
constructor() {
|
|
26
|
-
this.supportedLng = [];
|
|
27
25
|
this.resources = [];
|
|
28
26
|
this.i18next = i18next;
|
|
29
27
|
}
|
|
@@ -31,7 +29,6 @@ class I18nProvider {
|
|
|
31
29
|
return this.i18next;
|
|
32
30
|
}
|
|
33
31
|
configI18n({ resources, defaultLanguage }) {
|
|
34
|
-
this.supportedLng = getSupportedLangages({ resources });
|
|
35
32
|
this.resources = formatResources({ resources });
|
|
36
33
|
this.initI18n(defaultLanguage);
|
|
37
34
|
}
|
|
@@ -40,7 +37,6 @@ class I18nProvider {
|
|
|
40
37
|
compatibilityJSON: 'v3',
|
|
41
38
|
lng: defaultLanguage,
|
|
42
39
|
fallbackLng: 'en',
|
|
43
|
-
supportedLngs: this.supportedLng,
|
|
44
40
|
resources: this.resources,
|
|
45
41
|
react: {
|
|
46
42
|
bindI18nStore: 'added',
|
package/lib/i18n/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/i18n/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,OAAe,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/i18n/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAA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_Content": "Content",
|
|
39
40
|
"Base_ViewAll": "View all",
|
|
40
41
|
"Base_ChooseFile": "Choose a file",
|
|
@@ -203,6 +204,10 @@
|
|
|
203
204
|
"Base_Loader_Status_Success": "Success",
|
|
204
205
|
"Base_Loader_Status_Failed": "Failed",
|
|
205
206
|
"Base_MoreResults": "More results...",
|
|
207
|
+
"Base_SeeActions": "See actions",
|
|
208
|
+
"Base_Print": "Print",
|
|
209
|
+
"Base_PrintTemplate": "Print template",
|
|
210
|
+
"Base_NoRecordsFound": "No records found",
|
|
206
211
|
"Base_SliceAction_FetchAttachedFiles": "fetch attached files",
|
|
207
212
|
"Base_SliceAction_FetchFilesDetails": "fetch file details",
|
|
208
213
|
"Base_SliceAction_FetchMetaModule": "fetch meta modules",
|
|
@@ -226,6 +231,5 @@
|
|
|
226
231
|
"Base_SliceAction_UpdateJsonFieldsObject": "update custom fields of object",
|
|
227
232
|
"Base_SliceAction_FetchAnomalies": "fetch anomalies of object",
|
|
228
233
|
"Base_SliceAction_SearchUser": "search user",
|
|
229
|
-
"
|
|
230
|
-
"Base_SliceAction_FetchWebViewConfigs": "fetch webView configurations"
|
|
234
|
+
"Base_SliceAction_SearchPrintingTemplate": "search printing template"
|
|
231
235
|
}
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"Base_Confirm": "Confirmer",
|
|
36
36
|
"Base_Declare": "Déclarer",
|
|
37
37
|
"Base_Cancel": "Annuler",
|
|
38
|
+
"Base_Remove": "Retirer",
|
|
38
39
|
"Base_Content": "Contenu",
|
|
39
40
|
"Base_ViewAll": "Tout voir",
|
|
40
41
|
"Base_ChooseFile": "Choisir un fichier",
|
|
@@ -203,6 +204,10 @@
|
|
|
203
204
|
"Base_Loader_Status_Success": "Succès",
|
|
204
205
|
"Base_Loader_Status_Failed": "Échoué",
|
|
205
206
|
"Base_MoreResults": "Plus de résultats...",
|
|
207
|
+
"Base_SeeActions": "Voir les actions",
|
|
208
|
+
"Base_Print": "Imprimer",
|
|
209
|
+
"Base_PrintTemplate": "Modèle d'impression",
|
|
210
|
+
"Base_NoRecordsFound": "Aucun enregistrement trouvé",
|
|
206
211
|
"Base_SliceAction_FetchAttachedFiles": "récupération des fichiers joints",
|
|
207
212
|
"Base_SliceAction_FetchFilesDetails": "récupération des détails du fichier",
|
|
208
213
|
"Base_SliceAction_FetchMetaModule": "récupération des modules",
|
|
@@ -226,6 +231,5 @@
|
|
|
226
231
|
"Base_SliceAction_UpdateJsonFieldsObject": "mise à jour des champs studio de l'objet",
|
|
227
232
|
"Base_SliceAction_FetchAnomalies": "récupération des anomalies d'un object",
|
|
228
233
|
"Base_SliceAction_SearchUser": "récupération des utilisateurs",
|
|
229
|
-
"
|
|
230
|
-
"Base_SliceAction_FetchWebViewConfigs": "récupération des configurations de vues web"
|
|
234
|
+
"Base_SliceAction_SearchPrintingTemplate": "recherche sur les modèles d'impression"
|
|
231
235
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export * from './app';
|
|
2
|
-
export
|
|
2
|
+
export * from './navigator';
|
|
3
3
|
export { configGlobalStore } from './redux/store';
|
|
4
4
|
export { storage, Storage, useStorage } from './storage/Storage';
|
|
5
5
|
export { traceError } from './api/traceback-api';
|
|
6
6
|
export { useEffectDebugger } from './hooks/use-effect-debugger';
|
|
7
|
-
export { login, logout } from './features/authSlice';
|
|
7
|
+
export { clearError, isUrlValid, login, logout, setAppVersion, updateAuthState, } from './features/authSlice';
|
|
8
8
|
export * from './apiProviders';
|
|
9
9
|
export { useScannedValueByKey, useScannerSelector, enableScan, scanValue, disableScan, clearScan, default as scannerReducer, } from './features/scannerSlice';
|
|
10
|
+
export { useCameraScannerSelector, useCameraScannerValueByKey, clearBarcode, enableCameraScanner, scanBarcode, disableCameraScanner, } from './features/cameraScannerSlice';
|
|
10
11
|
export { useCameraSelector, useCameraValueByKey, enableCamera, takePhoto, clearPhoto, disableCamera, default as cameraReducer, } from './features/cameraSlice';
|
|
11
12
|
export { useEffectOnline, useOnline, enable as enableOnline, disable as disableOnline, } from './features/onlineSlice';
|
|
12
13
|
export { getNetInfo } from './api/net-info-utils';
|
|
@@ -27,3 +28,4 @@ export * from './permissions';
|
|
|
27
28
|
export * from './selections';
|
|
28
29
|
export { useScanActivator, useScannerDeviceActivator, useCameraScannerActivator, } from './hooks/use-scan-activator';
|
|
29
30
|
export { useNavigation, useIsFocused } from './hooks/use-navigation';
|
|
31
|
+
export { useConfigUpdater, useStorageUpdater } from './hooks/use-storage-config';
|
package/lib/index.js
CHANGED
|
@@ -16,14 +16,15 @@
|
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
export * from './app';
|
|
19
|
-
export
|
|
19
|
+
export * from './navigator';
|
|
20
20
|
export { configGlobalStore } from './redux/store';
|
|
21
21
|
export { storage, Storage, useStorage } from './storage/Storage';
|
|
22
22
|
export { traceError } from './api/traceback-api';
|
|
23
23
|
export { useEffectDebugger } from './hooks/use-effect-debugger';
|
|
24
|
-
export { login, logout } from './features/authSlice';
|
|
24
|
+
export { clearError, isUrlValid, login, logout, setAppVersion, updateAuthState, } from './features/authSlice';
|
|
25
25
|
export * from './apiProviders';
|
|
26
26
|
export { useScannedValueByKey, useScannerSelector, enableScan, scanValue, disableScan, clearScan, default as scannerReducer, } from './features/scannerSlice';
|
|
27
|
+
export { useCameraScannerSelector, useCameraScannerValueByKey, clearBarcode, enableCameraScanner, scanBarcode, disableCameraScanner, } from './features/cameraScannerSlice';
|
|
27
28
|
export { useCameraSelector, useCameraValueByKey, enableCamera, takePhoto, clearPhoto, disableCamera, default as cameraReducer, } from './features/cameraSlice';
|
|
28
29
|
export { useEffectOnline, useOnline, enable as enableOnline, disable as disableOnline, } from './features/onlineSlice';
|
|
29
30
|
export { getNetInfo } from './api/net-info-utils';
|
|
@@ -44,4 +45,5 @@ export * from './permissions';
|
|
|
44
45
|
export * from './selections';
|
|
45
46
|
export { useScanActivator, useScannerDeviceActivator, useCameraScannerActivator, } from './hooks/use-scan-activator';
|
|
46
47
|
export { useNavigation, useIsFocused } from './hooks/use-navigation';
|
|
48
|
+
export { useConfigUpdater, useStorageUpdater } from './hooks/use-storage-config';
|
|
47
49
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,OAAO,CAAC;AACtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,UAAU,EACV,KAAK,EACL,MAAM,EACN,aAAa,EACb,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,OAAO,IAAI,cAAc,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,UAAU,EACV,aAAa,EACb,OAAO,IAAI,aAAa,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,SAAS,EACT,MAAM,IAAI,YAAY,EACtB,OAAO,IAAI,aAAa,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAC,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,4BAA4B,CAAC"}
|
|
@@ -26,6 +26,9 @@ export const core_modelAPI = {
|
|
|
26
26
|
fileName: schemaContructor.string(),
|
|
27
27
|
createdOn: schemaContructor.string(),
|
|
28
28
|
}),
|
|
29
|
+
core_printTemplate: schemaContructor.object({
|
|
30
|
+
name: schemaContructor.string(),
|
|
31
|
+
}),
|
|
29
32
|
core_user: schemaContructor.object({
|
|
30
33
|
fullName: schemaContructor.string(),
|
|
31
34
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectFields.js","sourceRoot":"","sources":["../../src/models/objectFields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAE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M,CAAC;QAC/C,KAAK,EAAE,gBAAgB,CAAC,MAAM,EAAE;QAChC,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE;QACnC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,EAAE;QACpC,cAAc,EAAE,gBAAgB,CAAC,SAAS,EAAE,CAAC,MAAM,CACjD,gBAAgB,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE;YAC/B,MAAM,EAAE,gBAAgB,CAAC,MAAM,EAAE;SAClC,CAAC,CACH;KACF,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchFields.js","sourceRoot":"","sources":["../../src/models/searchFields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC7C,SAAS,EAAE,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"searchFields.js","sourceRoot":"","sources":["../../src/models/searchFields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC7C,SAAS,EAAE,CAAC,UAAU,CAAC;IACvB,kBAAkB,EAAE,CAAC,MAAM,CAAC;CAC7B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Module, Tool } from '../app';
|
|
2
|
+
declare class ActiveScreenProvider {
|
|
3
|
+
private screenName;
|
|
4
|
+
private screenContext;
|
|
5
|
+
private tools;
|
|
6
|
+
private refreshCallBack;
|
|
7
|
+
constructor();
|
|
8
|
+
registerCallback(callBack: Function): void;
|
|
9
|
+
unregisterCallback(callBack: Function): void;
|
|
10
|
+
registerActiveScreen(state: any): void;
|
|
11
|
+
registerScreenContext(context: any): void;
|
|
12
|
+
registerScreenTools(modules: Module[]): void;
|
|
13
|
+
private updateState;
|
|
14
|
+
}
|
|
15
|
+
export declare const activeScreenProvider: ActiveScreenProvider;
|
|
16
|
+
export declare const useActiveScreen: () => {
|
|
17
|
+
name: string;
|
|
18
|
+
context: any;
|
|
19
|
+
tools: Tool[];
|
|
20
|
+
};
|
|
21
|
+
interface Model {
|
|
22
|
+
model: string;
|
|
23
|
+
key?: string;
|
|
24
|
+
id?: number;
|
|
25
|
+
ids?: number[];
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
interface Data {
|
|
29
|
+
models?: Model[];
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export declare const useContextRegister: (data: Data) => void;
|
|
33
|
+
export declare const isModel: (context: Data, model: string, key?: string) => boolean;
|
|
34
|
+
export declare const getModelId: (context: Data, model: string, key?: string) => undefined | number | number[];
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 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 { useCallback, useEffect, useMemo, useState } from 'react';
|
|
19
|
+
import { useIsFocused } from '../hooks/use-navigation';
|
|
20
|
+
import { addModuleTools, addToolDefaultValues } from './module.helper';
|
|
21
|
+
class ActiveScreenProvider {
|
|
22
|
+
screenName;
|
|
23
|
+
screenContext;
|
|
24
|
+
tools;
|
|
25
|
+
refreshCallBack;
|
|
26
|
+
constructor() {
|
|
27
|
+
this.screenName = null;
|
|
28
|
+
this.screenContext = null;
|
|
29
|
+
this.tools = [];
|
|
30
|
+
this.refreshCallBack = [];
|
|
31
|
+
}
|
|
32
|
+
registerCallback(callBack) {
|
|
33
|
+
this.refreshCallBack.push(callBack);
|
|
34
|
+
}
|
|
35
|
+
unregisterCallback(callBack) {
|
|
36
|
+
this.refreshCallBack = this.refreshCallBack.filter(_f => _f !== callBack);
|
|
37
|
+
}
|
|
38
|
+
registerActiveScreen(state) {
|
|
39
|
+
this.screenName = state?.routes?.at(-1)?.name;
|
|
40
|
+
this.screenContext = null;
|
|
41
|
+
this.updateState();
|
|
42
|
+
}
|
|
43
|
+
registerScreenContext(context) {
|
|
44
|
+
this.screenContext = context;
|
|
45
|
+
this.updateState();
|
|
46
|
+
}
|
|
47
|
+
registerScreenTools(modules) {
|
|
48
|
+
this.tools = modules
|
|
49
|
+
.filter(_m => _m.globalTools?.length > 0)
|
|
50
|
+
.reduce(addModuleTools, [])
|
|
51
|
+
.map(addToolDefaultValues);
|
|
52
|
+
this.updateState();
|
|
53
|
+
}
|
|
54
|
+
updateState() {
|
|
55
|
+
this.refreshCallBack.forEach(_f => _f({
|
|
56
|
+
screenName: this.screenName,
|
|
57
|
+
screenContext: this.screenContext,
|
|
58
|
+
registeredTools: this.tools,
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export const activeScreenProvider = new ActiveScreenProvider();
|
|
63
|
+
export const useActiveScreen = () => {
|
|
64
|
+
const [activeScreen, setActiveScreen] = useState();
|
|
65
|
+
const [context, setContext] = useState();
|
|
66
|
+
const [tools, setTools] = useState([]);
|
|
67
|
+
const refreshData = useCallback(({ screenName, screenContext, registeredTools }) => {
|
|
68
|
+
setActiveScreen(screenName);
|
|
69
|
+
setContext(screenContext);
|
|
70
|
+
setTools(registeredTools);
|
|
71
|
+
}, []);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
activeScreenProvider.registerCallback(refreshData);
|
|
74
|
+
return () => {
|
|
75
|
+
activeScreenProvider.unregisterCallback(refreshData);
|
|
76
|
+
};
|
|
77
|
+
}, [refreshData]);
|
|
78
|
+
return useMemo(() => ({ name: activeScreen, context, tools }), [activeScreen, context, tools]);
|
|
79
|
+
};
|
|
80
|
+
export const useContextRegister = (data) => {
|
|
81
|
+
const isFocused = useIsFocused();
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (isFocused) {
|
|
84
|
+
activeScreenProvider.registerScreenContext(data);
|
|
85
|
+
}
|
|
86
|
+
}, [data, isFocused]);
|
|
87
|
+
};
|
|
88
|
+
const isModelMatch = (model, modelName, key) => {
|
|
89
|
+
const isModelNameMatch = model.model === modelName;
|
|
90
|
+
if (key) {
|
|
91
|
+
return isModelNameMatch && model.key === key;
|
|
92
|
+
}
|
|
93
|
+
return isModelNameMatch;
|
|
94
|
+
};
|
|
95
|
+
export const isModel = (context, model, key) => {
|
|
96
|
+
if (!Array.isArray(context?.models) || context?.models.length === 0) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return context?.models.some(m => isModelMatch(m, model, key));
|
|
100
|
+
};
|
|
101
|
+
export const getModelId = (context, model, key) => {
|
|
102
|
+
if (!Array.isArray(context?.models) || context?.models.length === 0) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const foundModel = context?.models.find(m => isModelMatch(m, model, key));
|
|
106
|
+
if (!foundModel) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
if (Array.isArray(foundModel.ids) && foundModel.ids.length > 0) {
|
|
110
|
+
return foundModel.ids;
|
|
111
|
+
}
|
|
112
|
+
else if (foundModel.id) {
|
|
113
|
+
return foundModel.id;
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=ActiveScreenProvider.js.map
|