@codebit-programando-solucoes/codebit-web-antd 1.1.40 → 1.1.41
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/dist/components/CssTokenBridge.d.ts +13 -4
- package/dist/components/LoggedMainContainer.d.ts +1 -0
- package/dist/components/UserMenu.d.ts +24 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/contexts/CodebitConfigContext.d.ts +25 -3
- package/dist/index.cjs +1276 -1103
- package/dist/index.css +116 -55
- package/dist/public-pages/Login.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -298,10 +298,11 @@ var __webpack_exports__ = {};
|
|
|
298
298
|
LoggedMainContainer: ()=>LoggedMainContainer,
|
|
299
299
|
CodebitThemeProvider: ()=>CodebitThemeProvider,
|
|
300
300
|
Login: ()=>Login,
|
|
301
|
-
|
|
301
|
+
UserMenu: ()=>UserMenu,
|
|
302
302
|
ErrorRetry: ()=>ErrorRetry,
|
|
303
303
|
CodebitThemeContext: ()=>CodebitThemeContext,
|
|
304
304
|
LocalLoginChangePasswordResult: ()=>LocalLoginChangePasswordResult,
|
|
305
|
+
useErrorModal: ()=>useErrorModal,
|
|
305
306
|
ChangePassword: ()=>ChangePassword,
|
|
306
307
|
ListCard: ()=>ListCard,
|
|
307
308
|
ForgotPassword: ()=>ForgotPassword,
|
|
@@ -326,6 +327,9 @@ var __webpack_exports__ = {};
|
|
|
326
327
|
logout: 'Sair',
|
|
327
328
|
version: 'Versão'
|
|
328
329
|
},
|
|
330
|
+
UserMenu: {
|
|
331
|
+
openMenu: 'Abrir menu do usuário'
|
|
332
|
+
},
|
|
329
333
|
HandleError: {
|
|
330
334
|
notFoundTitle: 'Página não encontrada',
|
|
331
335
|
forbiddenTitle: 'Acesso negado',
|
|
@@ -391,7 +395,7 @@ var __webpack_exports__ = {};
|
|
|
391
395
|
passwordUpperCase: 'uma letra maiúscula',
|
|
392
396
|
passwordLowerCase: 'uma letra minúscula',
|
|
393
397
|
passwordNumbers: 'um número',
|
|
394
|
-
passwordSpecialChars: 'um caractere especial (
|
|
398
|
+
passwordSpecialChars: 'um caractere especial (ex: !@#$%=+)',
|
|
395
399
|
passwordWeak: 'Senha fraca: Deve ter pelo menos {{requirements}}',
|
|
396
400
|
passwordsNotMatch: 'As senhas digitadas não coincidem!',
|
|
397
401
|
tokenInvalidTitle: 'Token inválido',
|
|
@@ -467,6 +471,9 @@ var __webpack_exports__ = {};
|
|
|
467
471
|
logout: 'Logout',
|
|
468
472
|
version: 'Version'
|
|
469
473
|
},
|
|
474
|
+
UserMenu: {
|
|
475
|
+
openMenu: 'Open user menu'
|
|
476
|
+
},
|
|
470
477
|
HandleError: {
|
|
471
478
|
notFoundTitle: 'Page not found',
|
|
472
479
|
forbiddenTitle: 'Access denied',
|
|
@@ -532,7 +539,7 @@ var __webpack_exports__ = {};
|
|
|
532
539
|
passwordUpperCase: 'an uppercase letter',
|
|
533
540
|
passwordLowerCase: 'a lowercase letter',
|
|
534
541
|
passwordNumbers: 'a number',
|
|
535
|
-
passwordSpecialChars: 'a special character (
|
|
542
|
+
passwordSpecialChars: 'a special character (e.g. !@#$%=+)',
|
|
536
543
|
passwordWeak: 'Weak password: Must have at least {{requirements}}',
|
|
537
544
|
passwordsNotMatch: 'The passwords do not match!',
|
|
538
545
|
tokenInvalidTitle: 'Invalid Token',
|
|
@@ -613,7 +620,7 @@ var __webpack_exports__ = {};
|
|
|
613
620
|
const codebit_web_namespaceObject = require("@codebit-programando-solucoes/codebit-web");
|
|
614
621
|
const logger = new codebit_web_namespaceObject.Logger('CodebitConfigContext');
|
|
615
622
|
const CodebitConfigContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
|
|
616
|
-
function CodebitConfigProvider({ children, menuItems, version = '1.0', showVersion = ()=>true, secondarySidebar, secondarySidebarWidth = 280, bottomMenuItems, doLogout, checkLogin, onMenuClick }) {
|
|
623
|
+
function CodebitConfigProvider({ children, menuItems, version = '1.0', showVersion = ()=>true, secondarySidebar, secondarySidebarWidth = 280, bottomMenuItems, userMenuItems, doLogout, checkLogin, onMenuClick }) {
|
|
617
624
|
const [isLogged, setIsLogged] = (0, external_react_.useState)(null);
|
|
618
625
|
const [user, setUser] = (0, external_react_.useState)(null);
|
|
619
626
|
const logout = async ()=>{
|
|
@@ -658,6 +665,7 @@ var __webpack_exports__ = {};
|
|
|
658
665
|
secondarySidebar,
|
|
659
666
|
secondarySidebarWidth,
|
|
660
667
|
bottomMenuItems,
|
|
668
|
+
userMenuItems,
|
|
661
669
|
onMenuClick
|
|
662
670
|
}), [
|
|
663
671
|
menuItems,
|
|
@@ -668,6 +676,7 @@ var __webpack_exports__ = {};
|
|
|
668
676
|
secondarySidebar,
|
|
669
677
|
secondarySidebarWidth,
|
|
670
678
|
bottomMenuItems,
|
|
679
|
+
userMenuItems,
|
|
671
680
|
onMenuClick
|
|
672
681
|
]);
|
|
673
682
|
return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitConfigContext.Provider, {
|
|
@@ -683,10 +692,119 @@ var __webpack_exports__ = {};
|
|
|
683
692
|
secondarySidebar: external_prop_types_default().func,
|
|
684
693
|
secondarySidebarWidth: external_prop_types_default().number,
|
|
685
694
|
bottomMenuItems: external_prop_types_default().func,
|
|
695
|
+
userMenuItems: external_prop_types_default().func,
|
|
686
696
|
doLogout: external_prop_types_default().func.isRequired,
|
|
687
697
|
checkLogin: external_prop_types_default().func.isRequired,
|
|
688
698
|
onMenuClick: external_prop_types_default().func
|
|
689
699
|
};
|
|
700
|
+
const CodebitThemeContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
|
|
701
|
+
const CodebitThemeProvider = ({ children, storeThemeInLocalStorage = true, containerId = 'root', forcedTheme = null, ...props })=>{
|
|
702
|
+
const hasLoaded = (0, external_react_.useRef)(false);
|
|
703
|
+
const [isDarkMode, setIsDarkMode] = (0, external_react_.useState)(()=>{
|
|
704
|
+
if (forcedTheme) return 'dark' === forcedTheme;
|
|
705
|
+
try {
|
|
706
|
+
if (storeThemeInLocalStorage) {
|
|
707
|
+
const savedTheme = localStorage?.getItem('theme');
|
|
708
|
+
if (null !== savedTheme) return 'dark' === savedTheme;
|
|
709
|
+
}
|
|
710
|
+
return globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches ?? false;
|
|
711
|
+
} finally{
|
|
712
|
+
hasLoaded.current = true;
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
(0, external_react_.useEffect)(()=>{
|
|
716
|
+
if (forcedTheme) {
|
|
717
|
+
const mode = 'dark' === forcedTheme;
|
|
718
|
+
setIsDarkMode(mode);
|
|
719
|
+
}
|
|
720
|
+
}, [
|
|
721
|
+
forcedTheme
|
|
722
|
+
]);
|
|
723
|
+
const toggleTheme = ()=>{
|
|
724
|
+
setIsDarkMode((prev)=>!prev);
|
|
725
|
+
};
|
|
726
|
+
(0, external_react_.useEffect)(()=>{
|
|
727
|
+
const target = document.getElementById(containerId);
|
|
728
|
+
if (!target) return;
|
|
729
|
+
if (isDarkMode) {
|
|
730
|
+
document.documentElement.classList.add('dark-theme');
|
|
731
|
+
target.classList.add('dark-theme');
|
|
732
|
+
} else {
|
|
733
|
+
document.documentElement.classList.remove('dark-theme');
|
|
734
|
+
target.classList.remove('dark-theme');
|
|
735
|
+
}
|
|
736
|
+
document.documentElement.style.setProperty('--color-primary', isDarkMode ? '#589C75' : '#29D266');
|
|
737
|
+
}, [
|
|
738
|
+
isDarkMode,
|
|
739
|
+
containerId
|
|
740
|
+
]);
|
|
741
|
+
(0, external_react_.useEffect)(()=>{
|
|
742
|
+
if (hasLoaded.current && storeThemeInLocalStorage) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
|
|
743
|
+
if (hasLoaded.current && storeThemeInLocalStorage && !forcedTheme) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
|
|
744
|
+
}, [
|
|
745
|
+
isDarkMode,
|
|
746
|
+
storeThemeInLocalStorage,
|
|
747
|
+
forcedTheme
|
|
748
|
+
]);
|
|
749
|
+
const themeContextValue = (0, external_react_.useMemo)(()=>({
|
|
750
|
+
isDarkMode,
|
|
751
|
+
toggleTheme,
|
|
752
|
+
setIsDarkMode
|
|
753
|
+
}), [
|
|
754
|
+
isDarkMode
|
|
755
|
+
]);
|
|
756
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitThemeContext.Provider, {
|
|
757
|
+
value: themeContextValue,
|
|
758
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.ConfigProvider, {
|
|
759
|
+
theme: {
|
|
760
|
+
algorithm: isDarkMode ? external_antd_namespaceObject.theme.darkAlgorithm : external_antd_namespaceObject.theme.defaultAlgorithm,
|
|
761
|
+
token: {
|
|
762
|
+
colorPrimary: isDarkMode ? '#589C75' : '#29D266',
|
|
763
|
+
colorInfo: isDarkMode ? '#589C75' : '#29D266',
|
|
764
|
+
colorLink: isDarkMode ? '#589C75' : '#29D266'
|
|
765
|
+
},
|
|
766
|
+
components: {
|
|
767
|
+
Menu: {
|
|
768
|
+
itemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
|
|
769
|
+
itemSelectedColor: '#FAFAFA',
|
|
770
|
+
darkItemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
|
|
771
|
+
darkItemSelectedColor: '#FAFAFA'
|
|
772
|
+
},
|
|
773
|
+
Button: {
|
|
774
|
+
colorPrimary: isDarkMode ? '#589C75' : '#29D266',
|
|
775
|
+
colorPrimaryHover: isDarkMode ? '#6DB589' : '#3FE67F',
|
|
776
|
+
colorPrimaryActive: isDarkMode ? '#4A8361' : '#1FBF4D'
|
|
777
|
+
},
|
|
778
|
+
Layout: {
|
|
779
|
+
siderBg: isDarkMode ? '#1a1a1a' : '#001529',
|
|
780
|
+
triggerBg: isDarkMode ? '#589C75' : '#29D266',
|
|
781
|
+
triggerColor: '#FAFAFA'
|
|
782
|
+
},
|
|
783
|
+
Header: {
|
|
784
|
+
colorPrimary: isDarkMode ? '#589C75' : '#29D266'
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
...props,
|
|
789
|
+
children: [
|
|
790
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(CssTokenBridge, {
|
|
791
|
+
containerId: containerId
|
|
792
|
+
}),
|
|
793
|
+
children
|
|
794
|
+
]
|
|
795
|
+
})
|
|
796
|
+
});
|
|
797
|
+
};
|
|
798
|
+
CodebitThemeProvider.propTypes = {
|
|
799
|
+
children: external_prop_types_default().node.isRequired,
|
|
800
|
+
storeThemeInLocalStorage: external_prop_types_default().bool,
|
|
801
|
+
containerId: external_prop_types_default().string,
|
|
802
|
+
forcedTheme: external_prop_types_default().oneOf([
|
|
803
|
+
'dark',
|
|
804
|
+
'light',
|
|
805
|
+
null
|
|
806
|
+
])
|
|
807
|
+
};
|
|
690
808
|
const ThemeToggle = ()=>{
|
|
691
809
|
const config = (0, external_react_.useContext)(CodebitThemeContext);
|
|
692
810
|
if (!config) throw new Error('ThemeToggle must be used within CodebitThemeContext');
|
|
@@ -725,1167 +843,1220 @@ var __webpack_exports__ = {};
|
|
|
725
843
|
const useCodebitWebAntdTranslation = ()=>(0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd', {
|
|
726
844
|
i18n: i18n
|
|
727
845
|
});
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
errorMessage = t('Error.networkError');
|
|
739
|
-
break;
|
|
740
|
-
case codebit_web_namespaceObject.ErrorCode.ERR_TIMEOUT:
|
|
741
|
-
errorMessage = t('Error.timeoutError');
|
|
742
|
-
break;
|
|
743
|
-
}
|
|
744
|
-
else if (responseStatus) switch(responseStatus){
|
|
745
|
-
case 400:
|
|
746
|
-
errorMessage = t('Error.badRequestError');
|
|
747
|
-
break;
|
|
748
|
-
case 403:
|
|
749
|
-
errorMessage = t('Error.forbiddenError');
|
|
750
|
-
retryText = t('Error.reloadPageButton');
|
|
751
|
-
status = 403;
|
|
752
|
-
onRetryAction = ()=>{
|
|
753
|
-
globalThis.location.reload();
|
|
754
|
-
};
|
|
755
|
-
break;
|
|
756
|
-
case 404:
|
|
757
|
-
errorMessage = t('Error.notFoundError');
|
|
758
|
-
status = 404;
|
|
759
|
-
break;
|
|
760
|
-
case 500:
|
|
761
|
-
errorMessage = t('Error.internalServerError');
|
|
762
|
-
status = 500;
|
|
763
|
-
break;
|
|
764
|
-
case 401:
|
|
765
|
-
errorMessage = t('Error.sessionExpiredError');
|
|
766
|
-
retryText = t('Error.reloadPageButton');
|
|
767
|
-
onRetryAction = ()=>{
|
|
768
|
-
globalThis.location.reload();
|
|
769
|
-
};
|
|
770
|
-
break;
|
|
771
|
-
}
|
|
772
|
-
return {
|
|
773
|
-
errorMessage,
|
|
774
|
-
status,
|
|
775
|
-
retryText,
|
|
776
|
-
onRetryAction
|
|
777
|
-
};
|
|
778
|
-
};
|
|
779
|
-
return {
|
|
780
|
-
getErrorMessage
|
|
781
|
-
};
|
|
782
|
-
}
|
|
783
|
-
const ErrorRetry_logger = new codebit_web_namespaceObject.Logger('ErrorRetry');
|
|
784
|
-
function ErrorRetry({ error, onRetry }) {
|
|
785
|
-
if (error && error instanceof Error) {
|
|
786
|
-
ErrorRetry_logger.error('Fail to load.', error);
|
|
787
|
-
react_namespaceObject.captureException(error);
|
|
788
|
-
}
|
|
789
|
-
const { getErrorMessage } = useErrorMessage();
|
|
790
|
-
const { status, errorMessage, retryText, onRetryAction } = getErrorMessage(error);
|
|
791
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
|
|
792
|
-
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Result, {
|
|
793
|
-
status: status,
|
|
794
|
-
title: errorMessage,
|
|
795
|
-
extra: [
|
|
796
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
797
|
-
type: 'primary',
|
|
798
|
-
onClick: onRetryAction ?? onRetry,
|
|
799
|
-
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ReloadOutlined, {}),
|
|
800
|
-
children: retryText
|
|
801
|
-
}, 'retry')
|
|
802
|
-
]
|
|
803
|
-
})
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
ErrorRetry.propTypes = {
|
|
807
|
-
error: external_prop_types_default().object.isRequired,
|
|
808
|
-
onRetry: external_prop_types_default().func.isRequired
|
|
809
|
-
};
|
|
810
|
-
const ListCard_module = {
|
|
811
|
-
listCard: "listCard-ISftFd",
|
|
812
|
-
headerRow: "headerRow-UsZAzP",
|
|
813
|
-
actions: "actions-ig53s2",
|
|
814
|
-
filtersRow: "filtersRow-f3Xk5a",
|
|
815
|
-
expandArea: "expandArea-czOoFS"
|
|
846
|
+
const UserMenu_module = {
|
|
847
|
+
trigger: "trigger-tlcps4",
|
|
848
|
+
avatar: "avatar-Tmnqa_",
|
|
849
|
+
caret: "caret-OWS8_0",
|
|
850
|
+
panel: "panel-GCcfCo",
|
|
851
|
+
userInfo: "userInfo-fDuDn1",
|
|
852
|
+
userName: "userName-sIs1iq",
|
|
853
|
+
userSubtitle: "userSubtitle-Fflhaw",
|
|
854
|
+
divider: "divider-JJjJVy",
|
|
855
|
+
menu: "menu-cuORr_"
|
|
816
856
|
};
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
857
|
+
const OPEN_KEYS = new Set([
|
|
858
|
+
'Enter',
|
|
859
|
+
' '
|
|
860
|
+
]);
|
|
861
|
+
const { Text } = external_antd_namespaceObject.Typography;
|
|
862
|
+
function getInitials(name) {
|
|
863
|
+
const parts = name?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
864
|
+
if (0 === parts.length) return '';
|
|
865
|
+
const first = [
|
|
866
|
+
...parts[0]
|
|
867
|
+
];
|
|
868
|
+
if (1 === parts.length) return first.slice(0, 2).join('').toUpperCase();
|
|
869
|
+
const last = [
|
|
870
|
+
...parts.at(-1)
|
|
871
|
+
];
|
|
872
|
+
return `${first[0]}${last[0]}`.toUpperCase();
|
|
873
|
+
}
|
|
874
|
+
function UserMenuPanel({ user, items, onItemClick }) {
|
|
875
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
|
|
876
|
+
className: UserMenu_module.panel,
|
|
824
877
|
children: [
|
|
825
|
-
/*#__PURE__*/ (0, jsx_runtime.jsxs)(
|
|
826
|
-
|
|
827
|
-
align: 'middle',
|
|
828
|
-
className: ListCard_module.headerRow,
|
|
878
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
|
|
879
|
+
className: UserMenu_module.userInfo,
|
|
829
880
|
children: [
|
|
830
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(Title, {
|
|
835
|
-
level: 4,
|
|
836
|
-
children: title
|
|
837
|
-
})
|
|
881
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
|
|
882
|
+
className: UserMenu_module.userName,
|
|
883
|
+
strong: true,
|
|
884
|
+
children: user?.name
|
|
838
885
|
}),
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
className: ListCard_module.actions,
|
|
844
|
-
children: [
|
|
845
|
-
!!onClearFilters && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
846
|
-
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ClearOutlined, {}),
|
|
847
|
-
onClick: onClearFilters,
|
|
848
|
-
children: t('ListCard.clearFilters')
|
|
849
|
-
}),
|
|
850
|
-
actions
|
|
851
|
-
]
|
|
886
|
+
user?.subtitle && /*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
|
|
887
|
+
className: UserMenu_module.userSubtitle,
|
|
888
|
+
type: 'secondary',
|
|
889
|
+
children: user.subtitle
|
|
852
890
|
})
|
|
853
891
|
]
|
|
854
892
|
}),
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
className: ListCard_module.filtersRow,
|
|
858
|
-
children: headerContainer
|
|
893
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Divider, {
|
|
894
|
+
className: UserMenu_module.divider
|
|
859
895
|
}),
|
|
860
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.
|
|
861
|
-
className:
|
|
862
|
-
|
|
896
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
|
|
897
|
+
className: UserMenu_module.menu,
|
|
898
|
+
items: items,
|
|
899
|
+
onClick: ({ key })=>onItemClick?.(key)
|
|
863
900
|
})
|
|
864
901
|
]
|
|
865
902
|
});
|
|
866
903
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
904
|
+
UserMenuPanel.propTypes = {
|
|
905
|
+
user: external_prop_types_default().shape({
|
|
906
|
+
name: external_prop_types_default().string,
|
|
907
|
+
subtitle: external_prop_types_default().string
|
|
908
|
+
}),
|
|
909
|
+
items: external_prop_types_default().arrayOf(external_prop_types_default().object).isRequired,
|
|
910
|
+
onItemClick: external_prop_types_default().func
|
|
873
911
|
};
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
};
|
|
880
|
-
const CssTokenBridge = ({ containerId })=>{
|
|
881
|
-
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
882
|
-
(0, external_react_.useLayoutEffect)(()=>{
|
|
883
|
-
const root = containerId ? document.getElementById(containerId) ?? document.documentElement : document.documentElement;
|
|
884
|
-
root.style.setProperty('--antd-color-bg-base', token['colorBgBase']);
|
|
885
|
-
root.style.setProperty('--antd-color-bg-container', token['colorBgContainer']);
|
|
886
|
-
root.style.setProperty('--antd-color-bg-elevated', token['colorBgElevated']);
|
|
887
|
-
root.style.setProperty('--antd-color-bg-layout', token['colorBgLayout']);
|
|
888
|
-
root.style.setProperty('--antd-color-bg-mask', token['colorBgMask']);
|
|
889
|
-
root.style.setProperty('--antd-color-bg-spotlight', token['colorBgSpotlight']);
|
|
890
|
-
root.style.setProperty('--antd-color-primary', token['colorPrimary']);
|
|
891
|
-
root.style.setProperty('--antd-color-success', token['colorSuccess']);
|
|
892
|
-
root.style.setProperty('--antd-color-success-bg', token['colorSuccessBg']);
|
|
893
|
-
root.style.setProperty('--antd-color-success-border', token['colorSuccessBorder']);
|
|
894
|
-
root.style.setProperty('--antd-color-success-text', token['colorSuccessText']);
|
|
895
|
-
root.style.setProperty('--antd-color-warning', token['colorWarning']);
|
|
896
|
-
root.style.setProperty('--antd-color-warning-bg', token['colorWarningBg']);
|
|
897
|
-
root.style.setProperty('--antd-color-warning-border', token['colorWarningBorder']);
|
|
898
|
-
root.style.setProperty('--antd-color-warning-text', token['colorWarningText']);
|
|
899
|
-
root.style.setProperty('--antd-color-error', token['colorError']);
|
|
900
|
-
root.style.setProperty('--antd-color-error-bg', token['colorErrorBg']);
|
|
901
|
-
root.style.setProperty('--antd-color-error-border', token['colorErrorBorder']);
|
|
902
|
-
root.style.setProperty('--antd-color-error-text', token['colorErrorText']);
|
|
903
|
-
root.style.setProperty('--antd-color-info', token['colorInfo']);
|
|
904
|
-
root.style.setProperty('--antd-color-info-bg', token['colorInfoBg']);
|
|
905
|
-
root.style.setProperty('--antd-color-info-border', token['colorInfoBorder']);
|
|
906
|
-
root.style.setProperty('--antd-color-info-text', token['colorInfoText']);
|
|
907
|
-
root.style.setProperty('--antd-color-text', token['colorText']);
|
|
908
|
-
root.style.setProperty('--antd-color-text-secondary', token['colorTextSecondary']);
|
|
909
|
-
root.style.setProperty('--antd-color-text-tertiary', token['colorTextTertiary']);
|
|
910
|
-
root.style.setProperty('--antd-color-text-quaternary', token['colorTextQuaternary']);
|
|
911
|
-
root.style.setProperty('--antd-color-text-disabled', token['colorTextDisabled']);
|
|
912
|
-
root.style.setProperty('--antd-color-border', token['colorBorder']);
|
|
913
|
-
root.style.setProperty('--antd-color-border-secondary', token['colorBorderSecondary']);
|
|
914
|
-
root.style.setProperty('--antd-color-border-hover', token['colorBorderHover']);
|
|
915
|
-
root.style.setProperty('--antd-color-border-secondary-hover', token['colorBorderSecondaryHover']);
|
|
916
|
-
root.style.setProperty('--antd-color-border-disabled', token['colorBorderDisabled']);
|
|
917
|
-
root.style.setProperty('--antd-color-split', token['colorSplit']);
|
|
918
|
-
root.style.setProperty('--antd-color-link', token['colorLink']);
|
|
919
|
-
root.style.setProperty('--antd-color-link-hover', token['colorLinkHover']);
|
|
920
|
-
root.style.setProperty('--antd-color-link-active', token['colorLinkActive']);
|
|
921
|
-
root.style.setProperty('--antd-color-fill', token['colorFill']);
|
|
922
|
-
root.style.setProperty('--antd-color-fill-secondary', token['colorFillSecondary']);
|
|
923
|
-
root.style.setProperty('--antd-color-fill-tertiary', token['colorFillTertiary']);
|
|
924
|
-
root.style.setProperty('--antd-color-fill-quaternary', token['colorFillQuaternary']);
|
|
925
|
-
root.style.setProperty('--antd-color-fill-content', token['colorFillContent']);
|
|
926
|
-
root.style.setProperty('--antd-color-fill-content-hover', token['colorFillContentHover']);
|
|
927
|
-
root.style.setProperty('--antd-color-fill-content-selected', token['colorFillContentSelected']);
|
|
928
|
-
root.style.setProperty('--antd-color-fill-alter', token['colorFillAlter']);
|
|
929
|
-
root.style.setProperty('--antd-color-fill-alter-hover', token['colorFillAlterHover']);
|
|
930
|
-
root.style.setProperty('--antd-color-fill-alter-active', token['colorFillAlterActive']);
|
|
931
|
-
root.style.setProperty('--antd-color-fill-alter-selected', token['colorFillAlterSelected']);
|
|
932
|
-
root.style.setProperty('--antd-color-fill-alter-disabled', token['colorFillAlterDisabled']);
|
|
933
|
-
root.style.setProperty('--antd-color-white', token['colorWhite']);
|
|
934
|
-
root.style.setProperty('--antd-color-black', token['colorBlack']);
|
|
935
|
-
root.style.setProperty('--antd-margin-xxs', `${token['marginXXS']}px`);
|
|
936
|
-
root.style.setProperty('--antd-margin-xs', `${token['marginXS']}px`);
|
|
937
|
-
root.style.setProperty('--antd-margin-sm', `${token['marginSM']}px`);
|
|
938
|
-
root.style.setProperty('--antd-margin', `${token['margin']}px`);
|
|
939
|
-
root.style.setProperty('--antd-margin-md', `${token['marginMD']}px`);
|
|
940
|
-
root.style.setProperty('--antd-margin-lg', `${token['marginLG']}px`);
|
|
941
|
-
root.style.setProperty('--antd-margin-xl', `${token['marginXL']}px`);
|
|
942
|
-
root.style.setProperty('--antd-margin-xxl', `${token['marginXXL']}px`);
|
|
943
|
-
root.style.setProperty('--antd-padding-xxs', `${token['paddingXXS']}px`);
|
|
944
|
-
root.style.setProperty('--antd-padding-xs', `${token['paddingXS']}px`);
|
|
945
|
-
root.style.setProperty('--antd-padding-sm', `${token['paddingSM']}px`);
|
|
946
|
-
root.style.setProperty('--antd-padding', `${token['padding']}px`);
|
|
947
|
-
root.style.setProperty('--antd-padding-md', `${token['paddingMD']}px`);
|
|
948
|
-
root.style.setProperty('--antd-padding-lg', `${token['paddingLG']}px`);
|
|
949
|
-
root.style.setProperty('--antd-padding-xl', `${token['paddingXL']}px`);
|
|
950
|
-
root.style.setProperty('--antd-font-size-xxs', '8px');
|
|
951
|
-
root.style.setProperty('--antd-font-size-xs', '10px');
|
|
952
|
-
root.style.setProperty('--antd-font-size-sm', `${token['fontSizeSM']}px`);
|
|
953
|
-
root.style.setProperty('--antd-font-size', `${token['fontSize']}px`);
|
|
954
|
-
root.style.setProperty('--antd-font-size-lg', `${token['fontSizeLG']}px`);
|
|
955
|
-
root.style.setProperty('--antd-font-size-xl', `${token['fontSizeXL']}px`);
|
|
956
|
-
root.style.setProperty('--antd-font-size-xxl', `${token['fontSizeXXL']}px`);
|
|
957
|
-
root.style.setProperty('--antd-font-size-heading1', `${token['fontSizeHeading1']}px`);
|
|
958
|
-
root.style.setProperty('--antd-font-size-heading2', `${token['fontSizeHeading2']}px`);
|
|
959
|
-
root.style.setProperty('--antd-font-size-heading3', `${token['fontSizeHeading3']}px`);
|
|
960
|
-
root.style.setProperty('--antd-font-size-heading4', `${token['fontSizeHeading4']}px`);
|
|
961
|
-
root.style.setProperty('--antd-font-size-heading5', `${token['fontSizeHeading5']}px`);
|
|
962
|
-
root.style.setProperty('--antd-line-height', token['lineHeight']);
|
|
963
|
-
root.style.setProperty('--antd-line-height-lg', token['lineHeightLG']);
|
|
964
|
-
root.style.setProperty('--antd-control-height-sm', `${token['controlHeightSM']}px`);
|
|
965
|
-
root.style.setProperty('--antd-control-height', `${token['controlHeight']}px`);
|
|
966
|
-
root.style.setProperty('--antd-control-height-lg', `${token['controlHeightLG']}px`);
|
|
967
|
-
root.style.setProperty('--antd-border-radius-sm', `${token['borderRadiusSM']}px`);
|
|
968
|
-
root.style.setProperty('--antd-border-radius', `${token['borderRadius']}px`);
|
|
969
|
-
root.style.setProperty('--antd-border-radius-lg', `${token['borderRadiusLG']}px`);
|
|
970
|
-
}, [
|
|
971
|
-
containerId,
|
|
972
|
-
token
|
|
973
|
-
]);
|
|
974
|
-
return null;
|
|
975
|
-
};
|
|
976
|
-
CssTokenBridge.propTypes = {
|
|
977
|
-
containerId: external_prop_types_default().string
|
|
978
|
-
};
|
|
979
|
-
const TableContainer_module = {
|
|
980
|
-
tableContainer: "tableContainer-EhNwOm"
|
|
981
|
-
};
|
|
982
|
-
function isPaginationNode(node) {
|
|
983
|
-
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
984
|
-
const element = node;
|
|
985
|
-
return element.classList?.contains('ant-table-pagination') || element.querySelector?.('.ant-table-pagination');
|
|
986
|
-
}
|
|
987
|
-
function hasPaginationInMutation(mutation) {
|
|
988
|
-
return Array.from(mutation.addedNodes).some(isPaginationNode);
|
|
989
|
-
}
|
|
990
|
-
function TableContainer({ children }) {
|
|
991
|
-
const containerRef = (0, external_react_.useRef)(null);
|
|
992
|
-
const containerHeightRef = (0, external_react_.useRef)(null);
|
|
993
|
-
const [scrollY, setScrollY] = (0, external_react_.useState)(void 0);
|
|
994
|
-
(0, external_react_.useLayoutEffect)(()=>{
|
|
995
|
-
const calculateHeights = ()=>{
|
|
996
|
-
if (!containerRef.current) return;
|
|
997
|
-
containerHeightRef.current = containerRef.current.offsetHeight;
|
|
998
|
-
const thead = containerRef.current.querySelector('thead');
|
|
999
|
-
let theadHeight = 0;
|
|
1000
|
-
if (thead) {
|
|
1001
|
-
const rect = thead.getBoundingClientRect();
|
|
1002
|
-
const styles = globalThis.getComputedStyle(thead);
|
|
1003
|
-
const marginTop = Number.parseFloat(styles.marginTop) || 0;
|
|
1004
|
-
const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
|
|
1005
|
-
theadHeight = rect.height + marginTop + marginBottom;
|
|
1006
|
-
}
|
|
1007
|
-
const pagination = containerRef.current.querySelector('.ant-table-pagination');
|
|
1008
|
-
let paginationHeight = 0;
|
|
1009
|
-
if (pagination) {
|
|
1010
|
-
const rect = pagination.getBoundingClientRect();
|
|
1011
|
-
const styles = globalThis.getComputedStyle(pagination);
|
|
1012
|
-
const marginTop = Number.parseFloat(styles.marginTop) || 0;
|
|
1013
|
-
const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
|
|
1014
|
-
paginationHeight = rect.height + marginTop + marginBottom;
|
|
1015
|
-
}
|
|
1016
|
-
const availableHeight = Math.ceil(containerHeightRef.current) - Math.ceil(theadHeight) - Math.ceil(paginationHeight) - 1;
|
|
1017
|
-
setScrollY(availableHeight);
|
|
1018
|
-
};
|
|
1019
|
-
calculateHeights();
|
|
1020
|
-
const observer = new MutationObserver((mutations)=>{
|
|
1021
|
-
const hasPagination = mutations.some(hasPaginationInMutation);
|
|
1022
|
-
if (hasPagination) calculateHeights();
|
|
1023
|
-
});
|
|
1024
|
-
if (containerRef.current) observer.observe(containerRef.current, {
|
|
1025
|
-
childList: true,
|
|
1026
|
-
subtree: true
|
|
912
|
+
function createPopupRender(user, items, onItemClick) {
|
|
913
|
+
return ()=>/*#__PURE__*/ (0, jsx_runtime.jsx)(UserMenuPanel, {
|
|
914
|
+
user: user,
|
|
915
|
+
items: items,
|
|
916
|
+
onItemClick: onItemClick
|
|
1027
917
|
});
|
|
1028
|
-
globalThis.addEventListener('resize', calculateHeights);
|
|
1029
|
-
return ()=>{
|
|
1030
|
-
observer.disconnect();
|
|
1031
|
-
globalThis.removeEventListener('resize', calculateHeights);
|
|
1032
|
-
};
|
|
1033
|
-
}, []);
|
|
1034
|
-
const enhancedChildren = scrollY ? /*#__PURE__*/ (0, external_react_.cloneElement)(children, {
|
|
1035
|
-
scroll: {
|
|
1036
|
-
...children.props?.scroll,
|
|
1037
|
-
y: scrollY,
|
|
1038
|
-
x: 'max-content'
|
|
1039
|
-
}
|
|
1040
|
-
}) : children;
|
|
1041
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
|
|
1042
|
-
ref: containerRef,
|
|
1043
|
-
className: TableContainer_module.tableContainer,
|
|
1044
|
-
children: enhancedChildren
|
|
1045
|
-
});
|
|
1046
918
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
|
|
919
|
+
function UserMenu({ user, items = [], onItemClick, caretIcon = /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.DownOutlined, {}) }) {
|
|
920
|
+
const { t } = useCodebitWebAntdTranslation();
|
|
921
|
+
const [open, setOpen] = (0, external_react_.useState)(false);
|
|
922
|
+
const initials = getInitials(user?.name);
|
|
923
|
+
const handleItemClick = (key)=>{
|
|
924
|
+
setOpen(false);
|
|
925
|
+
onItemClick?.(key);
|
|
926
|
+
};
|
|
927
|
+
const avatar = /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Avatar, {
|
|
928
|
+
className: UserMenu_module.avatar,
|
|
929
|
+
children: initials || /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.UserOutlined, {})
|
|
930
|
+
});
|
|
931
|
+
if (!items.length) return avatar;
|
|
932
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Dropdown, {
|
|
933
|
+
trigger: [
|
|
934
|
+
'click'
|
|
935
|
+
],
|
|
936
|
+
open: open,
|
|
937
|
+
onOpenChange: setOpen,
|
|
938
|
+
placement: 'bottomRight',
|
|
939
|
+
popupRender: createPopupRender(user, items, handleItemClick),
|
|
940
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
|
|
941
|
+
className: UserMenu_module.trigger,
|
|
942
|
+
role: 'button',
|
|
943
|
+
tabIndex: 0,
|
|
944
|
+
"aria-haspopup": 'menu',
|
|
945
|
+
"aria-expanded": open,
|
|
946
|
+
"aria-label": t('UserMenu.openMenu'),
|
|
947
|
+
onKeyDown: (event)=>{
|
|
948
|
+
if (!OPEN_KEYS.has(event.key)) return;
|
|
949
|
+
event.preventDefault();
|
|
950
|
+
setOpen((wasOpen)=>!wasOpen);
|
|
951
|
+
},
|
|
952
|
+
children: [
|
|
953
|
+
avatar,
|
|
954
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)("span", {
|
|
955
|
+
className: UserMenu_module.caret,
|
|
956
|
+
children: caretIcon
|
|
957
|
+
})
|
|
958
|
+
]
|
|
959
|
+
})
|
|
1060
960
|
});
|
|
1061
961
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
962
|
+
UserMenu.propTypes = {
|
|
963
|
+
user: external_prop_types_default().shape({
|
|
964
|
+
name: external_prop_types_default().string,
|
|
965
|
+
email: external_prop_types_default().string,
|
|
966
|
+
id: external_prop_types_default().string,
|
|
967
|
+
roles: external_prop_types_default().arrayOf(external_prop_types_default().string),
|
|
968
|
+
subtitle: external_prop_types_default().string
|
|
969
|
+
}),
|
|
970
|
+
items: external_prop_types_default().arrayOf(external_prop_types_default().object),
|
|
971
|
+
onItemClick: external_prop_types_default().func,
|
|
972
|
+
caretIcon: external_prop_types_default().node
|
|
1065
973
|
};
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
974
|
+
const LoggedMainContainer_module = {
|
|
975
|
+
layout: "layout-mL5o6I",
|
|
976
|
+
drawer: "drawer-oj0mJX",
|
|
977
|
+
drawerBody: "drawerBody-YtAN37",
|
|
978
|
+
drawerFlex: "drawerFlex-AGTAax",
|
|
979
|
+
sider: "sider-BDy1Bs",
|
|
980
|
+
siderLayout: "siderLayout-C8H0uI",
|
|
981
|
+
secondarySidebar: "secondarySidebar-P6J_Xn",
|
|
982
|
+
menu: "menu-KMvPt7",
|
|
983
|
+
menuContainer: "menuContainer-ahnhBu",
|
|
984
|
+
menuLabel: "menuLabel-csBJTc",
|
|
985
|
+
menuDescription: "menuDescription-d6BFBO",
|
|
986
|
+
menuSpacer: "menuSpacer-RIB3II",
|
|
987
|
+
versionMenu: "versionMenu-NM4uyG",
|
|
988
|
+
bottomMenu: "bottomMenu-VtOktS",
|
|
989
|
+
header: "header-vgc67L",
|
|
990
|
+
mobile: "mobile-mKGxb5",
|
|
991
|
+
headerSpace: "headerSpace-Fd_iha",
|
|
992
|
+
headerDivider: "headerDivider-yfEwNN",
|
|
993
|
+
content: "content-OZHp2h"
|
|
1071
994
|
};
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
995
|
+
const { Header, Sider, Content } = external_antd_namespaceObject.Layout;
|
|
996
|
+
const { Text: LoggedMainContainer_Text } = external_antd_namespaceObject.Typography;
|
|
997
|
+
const MENU_KEY_APP_LOGOUT = 'app-logout';
|
|
998
|
+
function filterMenuItemsByRole(items, user) {
|
|
999
|
+
return items.filter((item)=>{
|
|
1000
|
+
if (!item.roles) return true;
|
|
1001
|
+
if (!user?.roles) return false;
|
|
1002
|
+
return item.roles.some((role)=>user.roles.includes(role));
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
function LoggedMainContainer({ children }) {
|
|
1006
|
+
const [collapsed, setCollapsed] = (0, external_react_.useState)(true);
|
|
1007
|
+
const [isMobile, setIsMobile] = (0, external_react_.useState)(false);
|
|
1008
|
+
const [drawerVisible, setDrawerVisible] = (0, external_react_.useState)(false);
|
|
1009
|
+
const [secondarySidebarDrawerVisible, setSecondarySidebarDrawerVisible] = (0, external_react_.useState)(false);
|
|
1077
1010
|
const { t } = useCodebitWebAntdTranslation();
|
|
1078
|
-
const
|
|
1079
|
-
const
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1011
|
+
const configCodebit = (0, external_react_.useContext)(CodebitConfigContext);
|
|
1012
|
+
const configTheme = (0, external_react_.useContext)(CodebitThemeContext);
|
|
1013
|
+
const navigate = (0, external_react_router_namespaceObject.useNavigate)();
|
|
1014
|
+
const location = (0, external_react_router_namespaceObject.useLocation)();
|
|
1015
|
+
if (!configCodebit || !configTheme) throw new Error('LoggedContainer must be used within CodebitConfigProvider and CodebitThemeContext');
|
|
1016
|
+
const { logout, user, menuItems, version, showVersion, secondarySidebar, secondarySidebarWidth = 280, bottomMenuItems, userMenuItems, onMenuClick } = configCodebit;
|
|
1017
|
+
const { isDarkMode } = configTheme;
|
|
1018
|
+
const theme = isDarkMode ? 'dark' : 'light';
|
|
1019
|
+
const allMenuItems = (0, external_react_.useMemo)(()=>[
|
|
1020
|
+
...menuItems(user),
|
|
1021
|
+
...bottomMenuItems?.(user) ?? []
|
|
1022
|
+
], [
|
|
1023
|
+
menuItems,
|
|
1024
|
+
user,
|
|
1025
|
+
bottomMenuItems
|
|
1026
|
+
]);
|
|
1027
|
+
const filteredMenuItems = (0, external_react_.useMemo)(()=>filterMenuItemsByRole(menuItems(user), user), [
|
|
1028
|
+
menuItems,
|
|
1029
|
+
user
|
|
1030
|
+
]);
|
|
1031
|
+
const filteredBottomMenuItems = (0, external_react_.useMemo)(()=>{
|
|
1032
|
+
if (!bottomMenuItems) return [];
|
|
1033
|
+
return filterMenuItemsByRole(bottomMenuItems(user), user);
|
|
1034
|
+
}, [
|
|
1035
|
+
bottomMenuItems,
|
|
1036
|
+
user
|
|
1037
|
+
]);
|
|
1038
|
+
const filteredUserMenuItems = (0, external_react_.useMemo)(()=>{
|
|
1039
|
+
if (!userMenuItems) return [];
|
|
1040
|
+
return filterMenuItemsByRole(userMenuItems(user), user);
|
|
1041
|
+
}, [
|
|
1042
|
+
userMenuItems,
|
|
1043
|
+
user
|
|
1044
|
+
]);
|
|
1045
|
+
const memoizedBottomMenuItems = (0, external_react_.useMemo)(()=>[
|
|
1046
|
+
...filteredBottomMenuItems,
|
|
1047
|
+
{
|
|
1048
|
+
key: MENU_KEY_APP_LOGOUT,
|
|
1049
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.LogoutOutlined, {}),
|
|
1050
|
+
label: t('LoggedMainContainer.logout'),
|
|
1051
|
+
danger: true
|
|
1052
|
+
}
|
|
1053
|
+
], [
|
|
1054
|
+
filteredBottomMenuItems,
|
|
1055
|
+
t
|
|
1056
|
+
]);
|
|
1057
|
+
const [selectedKeys, setSelectedKeys] = (0, external_react_.useState)('');
|
|
1108
1058
|
(0, external_react_.useEffect)(()=>{
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1059
|
+
const computeSelectedKey = ()=>{
|
|
1060
|
+
const match = allMenuItems.find((item)=>item.key ? (0, external_react_router_namespaceObject.matchPath)({
|
|
1061
|
+
path: item.key,
|
|
1062
|
+
end: true
|
|
1063
|
+
}, location.pathname) : false);
|
|
1064
|
+
return match?.key ?? '';
|
|
1065
|
+
};
|
|
1066
|
+
setSelectedKeys(computeSelectedKey());
|
|
1067
|
+
}, [
|
|
1068
|
+
location.pathname,
|
|
1069
|
+
allMenuItems
|
|
1070
|
+
]);
|
|
1071
|
+
const handleLogout = (0, external_react_.useCallback)(async ()=>{
|
|
1072
|
+
await logout?.();
|
|
1073
|
+
if (isMobile) setDrawerVisible(false);
|
|
1074
|
+
navigate('/');
|
|
1075
|
+
}, [
|
|
1076
|
+
logout,
|
|
1077
|
+
isMobile,
|
|
1078
|
+
setDrawerVisible,
|
|
1079
|
+
navigate
|
|
1080
|
+
]);
|
|
1081
|
+
const handleMenuClick = (0, external_react_.useCallback)(async (key)=>{
|
|
1082
|
+
if (onMenuClick?.(key) === false) return;
|
|
1083
|
+
try {
|
|
1084
|
+
if (key === MENU_KEY_APP_LOGOUT) return void await handleLogout();
|
|
1085
|
+
navigate(key);
|
|
1086
|
+
} finally{
|
|
1087
|
+
if (isMobile) setDrawerVisible(false);
|
|
1114
1088
|
}
|
|
1115
|
-
setIsPlaying(false);
|
|
1116
|
-
setCurrentTime(0);
|
|
1117
|
-
setDuration(0);
|
|
1118
1089
|
}, [
|
|
1119
|
-
|
|
1090
|
+
onMenuClick,
|
|
1091
|
+
handleLogout,
|
|
1092
|
+
navigate,
|
|
1093
|
+
isMobile,
|
|
1094
|
+
setDrawerVisible
|
|
1120
1095
|
]);
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1096
|
+
const handleUserMenuItemClick = (0, external_react_.useCallback)((key)=>{
|
|
1097
|
+
onMenuClick?.(key);
|
|
1098
|
+
}, [
|
|
1099
|
+
onMenuClick
|
|
1100
|
+
]);
|
|
1101
|
+
const primaryMenu = (0, external_react_.useMemo)(()=>/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
|
|
1102
|
+
theme: theme,
|
|
1103
|
+
mode: 'inline',
|
|
1104
|
+
selectedKeys: selectedKeys ? [
|
|
1105
|
+
selectedKeys
|
|
1106
|
+
] : [],
|
|
1107
|
+
onClick: ({ key })=>handleMenuClick(key),
|
|
1108
|
+
items: filteredMenuItems,
|
|
1109
|
+
className: LoggedMainContainer_module.menu
|
|
1110
|
+
}, 'primary-menu'), [
|
|
1111
|
+
selectedKeys,
|
|
1112
|
+
filteredMenuItems,
|
|
1113
|
+
theme,
|
|
1114
|
+
handleMenuClick
|
|
1115
|
+
]);
|
|
1116
|
+
(0, external_react_.useEffect)(()=>{
|
|
1117
|
+
const checkScreenSize = ()=>setIsMobile(window.innerWidth < 768);
|
|
1118
|
+
checkScreenSize();
|
|
1119
|
+
window.addEventListener('resize', checkScreenSize);
|
|
1120
|
+
return ()=>window.removeEventListener('resize', checkScreenSize);
|
|
1121
|
+
}, []);
|
|
1122
|
+
const menuContent = /*#__PURE__*/ (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
1123
|
+
children: [
|
|
1124
|
+
primaryMenu,
|
|
1125
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout.Content, {
|
|
1126
|
+
className: LoggedMainContainer_module.menuSpacer
|
|
1127
|
+
}),
|
|
1128
|
+
showVersion?.(user) && version && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
|
|
1129
|
+
motion: false,
|
|
1130
|
+
theme: theme,
|
|
1131
|
+
mode: 'horizontal',
|
|
1132
|
+
className: LoggedMainContainer_module.versionMenu,
|
|
1133
|
+
disabled: true,
|
|
1134
|
+
items: [
|
|
1135
|
+
{
|
|
1136
|
+
icon: collapsed ? version : `${t('LoggedMainContainer.version')}: ${version}`,
|
|
1137
|
+
title: ''
|
|
1138
|
+
}
|
|
1139
|
+
]
|
|
1140
|
+
}, 'version-menu'),
|
|
1141
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
|
|
1142
|
+
motion: false,
|
|
1143
|
+
theme: theme,
|
|
1144
|
+
mode: 'inline',
|
|
1145
|
+
selectedKeys: selectedKeys ? [
|
|
1146
|
+
selectedKeys
|
|
1147
|
+
] : [],
|
|
1148
|
+
onClick: ({ key })=>handleMenuClick(key),
|
|
1149
|
+
className: LoggedMainContainer_module.bottomMenu,
|
|
1150
|
+
items: memoizedBottomMenuItems
|
|
1151
|
+
}, 'bottom-menu')
|
|
1152
|
+
]
|
|
1153
|
+
});
|
|
1154
|
+
const renderMenuContent = ()=>{
|
|
1155
|
+
if (isMobile) return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
|
|
1156
|
+
placement: 'left',
|
|
1157
|
+
onClose: ()=>setDrawerVisible(false),
|
|
1158
|
+
open: drawerVisible,
|
|
1159
|
+
size: 250,
|
|
1160
|
+
className: LoggedMainContainer_module.drawer,
|
|
1161
|
+
classNames: {
|
|
1162
|
+
body: LoggedMainContainer_module.drawerBody
|
|
1163
|
+
},
|
|
1164
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Flex, {
|
|
1165
|
+
vertical: true,
|
|
1166
|
+
className: LoggedMainContainer_module.drawerFlex,
|
|
1167
|
+
children: menuContent
|
|
1168
|
+
})
|
|
1169
|
+
});
|
|
1170
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
|
|
1171
|
+
theme: theme,
|
|
1172
|
+
trigger: null,
|
|
1173
|
+
collapsible: true,
|
|
1174
|
+
collapsed: collapsed,
|
|
1175
|
+
breakpoint: 'lg',
|
|
1176
|
+
collapsedWidth: 80,
|
|
1177
|
+
className: LoggedMainContainer_module.sider,
|
|
1178
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
|
|
1179
|
+
className: LoggedMainContainer_module.siderLayout,
|
|
1180
|
+
children: menuContent
|
|
1181
|
+
})
|
|
1182
|
+
});
|
|
1135
1183
|
};
|
|
1136
|
-
|
|
1137
|
-
|
|
1184
|
+
const renderSecondarySidebar = ()=>{
|
|
1185
|
+
if (!secondarySidebar) return null;
|
|
1186
|
+
if (isMobile) return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
|
|
1187
|
+
placement: 'right',
|
|
1188
|
+
onClose: ()=>setSecondarySidebarDrawerVisible(false),
|
|
1189
|
+
open: secondarySidebarDrawerVisible,
|
|
1190
|
+
size: 280,
|
|
1191
|
+
className: LoggedMainContainer_module.drawer,
|
|
1192
|
+
title: null,
|
|
1193
|
+
closeIcon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.CloseOutlined, {}),
|
|
1194
|
+
children: secondarySidebar(user)
|
|
1195
|
+
});
|
|
1196
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
|
|
1197
|
+
theme: theme,
|
|
1198
|
+
width: secondarySidebarWidth,
|
|
1199
|
+
children: secondarySidebar(user)
|
|
1200
|
+
});
|
|
1201
|
+
};
|
|
1202
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Layout, {
|
|
1203
|
+
className: LoggedMainContainer_module.layout,
|
|
1138
1204
|
children: [
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1205
|
+
renderMenuContent(),
|
|
1206
|
+
renderSecondarySidebar(),
|
|
1207
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Layout, {
|
|
1142
1208
|
children: [
|
|
1143
|
-
/*#__PURE__*/ (0, jsx_runtime.jsxs)(
|
|
1144
|
-
|
|
1209
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)(Header, {
|
|
1210
|
+
className: `${LoggedMainContainer_module.header} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
1145
1211
|
children: [
|
|
1146
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
min: 0,
|
|
1157
|
-
max: duration,
|
|
1158
|
-
value: currentTime,
|
|
1159
|
-
onChange: handleSliderChange,
|
|
1160
|
-
tooltip: {
|
|
1161
|
-
open: false
|
|
1162
|
-
},
|
|
1163
|
-
disabled: 0 === duration,
|
|
1164
|
-
className: AudioPlayer_module.slider
|
|
1212
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Space, {
|
|
1213
|
+
children: isMobile ? /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1214
|
+
type: 'text',
|
|
1215
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
|
|
1216
|
+
onClick: ()=>setDrawerVisible(true)
|
|
1217
|
+
}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1218
|
+
type: 'text',
|
|
1219
|
+
icon: collapsed ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuUnfoldOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuFoldOutlined, {}),
|
|
1220
|
+
onClick: ()=>setCollapsed(!collapsed)
|
|
1221
|
+
})
|
|
1165
1222
|
}),
|
|
1166
|
-
/*#__PURE__*/ (0, jsx_runtime.
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1223
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
|
|
1224
|
+
size: isMobile ? 'small' : 'middle',
|
|
1225
|
+
className: `${LoggedMainContainer_module.headerSpace} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
1226
|
+
children: [
|
|
1227
|
+
secondarySidebar && isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1228
|
+
type: 'text',
|
|
1229
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.WechatOutlined, {}),
|
|
1230
|
+
onClick: ()=>setSecondarySidebarDrawerVisible(true)
|
|
1231
|
+
}),
|
|
1232
|
+
!isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(LoggedMainContainer_Text, {
|
|
1233
|
+
children: t('LoggedMainContainer.theme')
|
|
1234
|
+
}),
|
|
1235
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(ThemeToggle, {}),
|
|
1236
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Divider, {
|
|
1237
|
+
type: 'vertical',
|
|
1238
|
+
className: LoggedMainContainer_module.headerDivider
|
|
1239
|
+
}),
|
|
1240
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(UserMenu, {
|
|
1241
|
+
user: user,
|
|
1242
|
+
items: filteredUserMenuItems,
|
|
1243
|
+
onItemClick: handleUserMenuItemClick
|
|
1244
|
+
})
|
|
1245
|
+
]
|
|
1173
1246
|
})
|
|
1174
1247
|
]
|
|
1175
1248
|
}),
|
|
1176
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(
|
|
1177
|
-
className:
|
|
1178
|
-
children:
|
|
1179
|
-
children: `${formatTime(currentTime)} / ${formatTime(duration)}`
|
|
1180
|
-
})
|
|
1249
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(Content, {
|
|
1250
|
+
className: `${LoggedMainContainer_module.content} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
1251
|
+
children: children
|
|
1181
1252
|
})
|
|
1182
1253
|
]
|
|
1183
|
-
}),
|
|
1184
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)("audio", {
|
|
1185
|
-
ref: audioRef,
|
|
1186
|
-
onTimeUpdate: (e)=>{
|
|
1187
|
-
if (!isPlaying) return;
|
|
1188
|
-
const audioElement = e.target;
|
|
1189
|
-
setCurrentTime(audioElement.currentTime);
|
|
1190
|
-
},
|
|
1191
|
-
onLoadedMetadata: handleLoadedMetadata,
|
|
1192
|
-
onEnded: ()=>{
|
|
1193
|
-
setIsPlaying(false);
|
|
1194
|
-
setCurrentTime(0);
|
|
1195
|
-
},
|
|
1196
|
-
onPlay: ()=>setIsPlaying(true),
|
|
1197
|
-
onPause: ()=>setIsPlaying(false),
|
|
1198
|
-
muted: isMuted,
|
|
1199
|
-
children: /*#__PURE__*/ (0, jsx_runtime.jsx)("track", {
|
|
1200
|
-
kind: 'captions'
|
|
1201
|
-
})
|
|
1202
1254
|
})
|
|
1203
1255
|
]
|
|
1204
1256
|
});
|
|
1257
|
+
}
|
|
1258
|
+
LoggedMainContainer.propTypes = {
|
|
1259
|
+
children: external_prop_types_default().node.isRequired
|
|
1205
1260
|
};
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
dialCode: '58',
|
|
1261
|
-
flag: '🇻🇪',
|
|
1262
|
-
maxLocalDigits: 10
|
|
1263
|
-
},
|
|
1264
|
-
{
|
|
1265
|
-
code: 'UY',
|
|
1266
|
-
dialCode: '598',
|
|
1267
|
-
flag: '🇺🇾',
|
|
1268
|
-
maxLocalDigits: 8
|
|
1269
|
-
},
|
|
1270
|
-
{
|
|
1271
|
-
code: 'PY',
|
|
1272
|
-
dialCode: '595',
|
|
1273
|
-
flag: '🇵🇾',
|
|
1274
|
-
maxLocalDigits: 9
|
|
1275
|
-
},
|
|
1276
|
-
{
|
|
1277
|
-
code: 'BO',
|
|
1278
|
-
dialCode: '591',
|
|
1279
|
-
flag: '🇧🇴',
|
|
1280
|
-
maxLocalDigits: 8
|
|
1281
|
-
},
|
|
1282
|
-
{
|
|
1283
|
-
code: 'PT',
|
|
1284
|
-
dialCode: '351',
|
|
1285
|
-
flag: '🇵🇹',
|
|
1286
|
-
maxLocalDigits: 9
|
|
1287
|
-
},
|
|
1288
|
-
{
|
|
1289
|
-
code: 'ES',
|
|
1290
|
-
dialCode: '34',
|
|
1291
|
-
flag: '🇪🇸',
|
|
1292
|
-
maxLocalDigits: 9
|
|
1293
|
-
},
|
|
1294
|
-
{
|
|
1295
|
-
code: 'IT',
|
|
1296
|
-
dialCode: '39',
|
|
1297
|
-
flag: '🇮🇹',
|
|
1298
|
-
maxLocalDigits: 10
|
|
1299
|
-
},
|
|
1300
|
-
{
|
|
1301
|
-
code: 'FR',
|
|
1302
|
-
dialCode: '33',
|
|
1303
|
-
flag: '🇫🇷',
|
|
1304
|
-
maxLocalDigits: 9
|
|
1305
|
-
},
|
|
1306
|
-
{
|
|
1307
|
-
code: 'DE',
|
|
1308
|
-
dialCode: '49',
|
|
1309
|
-
flag: '🇩🇪',
|
|
1310
|
-
maxLocalDigits: 11
|
|
1311
|
-
},
|
|
1312
|
-
{
|
|
1313
|
-
code: 'GB',
|
|
1314
|
-
dialCode: '44',
|
|
1315
|
-
flag: '🇬🇧',
|
|
1316
|
-
maxLocalDigits: 10
|
|
1317
|
-
},
|
|
1318
|
-
{
|
|
1319
|
-
code: 'AO',
|
|
1320
|
-
dialCode: '244',
|
|
1321
|
-
flag: '🇦🇴',
|
|
1322
|
-
maxLocalDigits: 9
|
|
1323
|
-
},
|
|
1324
|
-
{
|
|
1325
|
-
code: 'MZ',
|
|
1326
|
-
dialCode: '258',
|
|
1327
|
-
flag: '🇲🇿',
|
|
1328
|
-
maxLocalDigits: 9
|
|
1329
|
-
},
|
|
1330
|
-
{
|
|
1331
|
-
code: 'ZA',
|
|
1332
|
-
dialCode: '27',
|
|
1333
|
-
flag: '🇿🇦',
|
|
1334
|
-
maxLocalDigits: 9
|
|
1335
|
-
},
|
|
1336
|
-
{
|
|
1337
|
-
code: 'CN',
|
|
1338
|
-
dialCode: '86',
|
|
1339
|
-
flag: '🇨🇳',
|
|
1340
|
-
maxLocalDigits: 11
|
|
1341
|
-
},
|
|
1342
|
-
{
|
|
1343
|
-
code: 'JP',
|
|
1344
|
-
dialCode: '81',
|
|
1345
|
-
flag: '🇯🇵',
|
|
1346
|
-
maxLocalDigits: 10
|
|
1347
|
-
},
|
|
1348
|
-
{
|
|
1349
|
-
code: 'IN',
|
|
1350
|
-
dialCode: '91',
|
|
1351
|
-
flag: '🇮🇳',
|
|
1352
|
-
maxLocalDigits: 10
|
|
1353
|
-
},
|
|
1354
|
-
{
|
|
1355
|
-
code: 'AU',
|
|
1356
|
-
dialCode: '61',
|
|
1357
|
-
flag: '🇦🇺',
|
|
1358
|
-
maxLocalDigits: 9
|
|
1359
|
-
}
|
|
1360
|
-
];
|
|
1361
|
-
function applyBrMask(digits) {
|
|
1362
|
-
if (digits.length <= 2) return `(${digits}`;
|
|
1363
|
-
if (digits.length <= 7) return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
|
|
1364
|
-
if (digits.length <= 10) return `(${digits.slice(0, 2)}) ${digits.slice(2, 6)}-${digits.slice(6)}`;
|
|
1365
|
-
return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7, 11)}`;
|
|
1366
|
-
}
|
|
1367
|
-
function applyUsMask(digits) {
|
|
1368
|
-
if (digits.length <= 3) return `(${digits}`;
|
|
1369
|
-
if (digits.length <= 6) return `(${digits.slice(0, 3)}) ${digits.slice(3)}`;
|
|
1370
|
-
return `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6, 10)}`;
|
|
1371
|
-
}
|
|
1372
|
-
function applyArMask(digits) {
|
|
1373
|
-
if (digits.length <= 2) return `(${digits}`;
|
|
1374
|
-
if (digits.length <= 6) return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
|
|
1375
|
-
return `(${digits.slice(0, 2)}) ${digits.slice(2, 6)}-${digits.slice(6, 10)}`;
|
|
1376
|
-
}
|
|
1377
|
-
function applyGenericMask(digits, areaLen, totalLen) {
|
|
1378
|
-
if (digits.length <= areaLen) return `(${digits}`;
|
|
1379
|
-
const area = digits.slice(0, areaLen);
|
|
1380
|
-
const rest = digits.slice(areaLen, totalLen);
|
|
1381
|
-
const mid = Math.floor(rest.length / 2 + rest.length % 2);
|
|
1382
|
-
if (rest.length <= mid) return `(${area}) ${rest}`;
|
|
1383
|
-
return `(${area}) ${rest.slice(0, mid)}-${rest.slice(mid)}`;
|
|
1261
|
+
function useErrorMessage() {
|
|
1262
|
+
const { t } = useCodebitWebAntdTranslation();
|
|
1263
|
+
const getErrorMessage = (error)=>{
|
|
1264
|
+
let status = 'error';
|
|
1265
|
+
const responseStatus = error?.response?.status || null;
|
|
1266
|
+
let errorMessage = t('Error.defaultError');
|
|
1267
|
+
let retryText = t('Error.retryButton');
|
|
1268
|
+
let onRetryAction = null;
|
|
1269
|
+
if (error?.errorCode) switch(error.errorCode){
|
|
1270
|
+
case codebit_web_namespaceObject.ErrorCode.ERR_NETWORK:
|
|
1271
|
+
errorMessage = t('Error.networkError');
|
|
1272
|
+
break;
|
|
1273
|
+
case codebit_web_namespaceObject.ErrorCode.ERR_TIMEOUT:
|
|
1274
|
+
errorMessage = t('Error.timeoutError');
|
|
1275
|
+
break;
|
|
1276
|
+
}
|
|
1277
|
+
else if (responseStatus) switch(responseStatus){
|
|
1278
|
+
case 400:
|
|
1279
|
+
errorMessage = t('Error.badRequestError');
|
|
1280
|
+
break;
|
|
1281
|
+
case 403:
|
|
1282
|
+
errorMessage = t('Error.forbiddenError');
|
|
1283
|
+
retryText = t('Error.reloadPageButton');
|
|
1284
|
+
status = 403;
|
|
1285
|
+
onRetryAction = ()=>{
|
|
1286
|
+
globalThis.location.reload();
|
|
1287
|
+
};
|
|
1288
|
+
break;
|
|
1289
|
+
case 404:
|
|
1290
|
+
errorMessage = t('Error.notFoundError');
|
|
1291
|
+
status = 404;
|
|
1292
|
+
break;
|
|
1293
|
+
case 500:
|
|
1294
|
+
errorMessage = t('Error.internalServerError');
|
|
1295
|
+
status = 500;
|
|
1296
|
+
break;
|
|
1297
|
+
case 401:
|
|
1298
|
+
errorMessage = t('Error.sessionExpiredError');
|
|
1299
|
+
retryText = t('Error.reloadPageButton');
|
|
1300
|
+
onRetryAction = ()=>{
|
|
1301
|
+
globalThis.location.reload();
|
|
1302
|
+
};
|
|
1303
|
+
break;
|
|
1304
|
+
}
|
|
1305
|
+
return {
|
|
1306
|
+
errorMessage,
|
|
1307
|
+
status,
|
|
1308
|
+
retryText,
|
|
1309
|
+
onRetryAction
|
|
1310
|
+
};
|
|
1311
|
+
};
|
|
1312
|
+
return {
|
|
1313
|
+
getErrorMessage
|
|
1314
|
+
};
|
|
1384
1315
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
case 'CA':
|
|
1391
|
-
return applyUsMask(digits);
|
|
1392
|
-
case 'MX':
|
|
1393
|
-
case 'CO':
|
|
1394
|
-
case 'VE':
|
|
1395
|
-
return applyGenericMask(digits, 2, 10);
|
|
1396
|
-
case 'AR':
|
|
1397
|
-
return applyArMask(digits);
|
|
1398
|
-
case 'CL':
|
|
1399
|
-
case 'PE':
|
|
1400
|
-
case 'PT':
|
|
1401
|
-
case 'ES':
|
|
1402
|
-
case 'AU':
|
|
1403
|
-
case 'ZA':
|
|
1404
|
-
case 'AO':
|
|
1405
|
-
case 'MZ':
|
|
1406
|
-
return applyGenericMask(digits, 2, 9);
|
|
1407
|
-
case 'UY':
|
|
1408
|
-
case 'BO':
|
|
1409
|
-
return applyGenericMask(digits, 1, 8);
|
|
1410
|
-
case 'PY':
|
|
1411
|
-
return applyGenericMask(digits, 3, 9);
|
|
1412
|
-
case 'FR':
|
|
1413
|
-
return applyGenericMask(digits, 2, 9);
|
|
1414
|
-
case 'IT':
|
|
1415
|
-
return applyGenericMask(digits, 3, 10);
|
|
1416
|
-
case 'DE':
|
|
1417
|
-
return applyGenericMask(digits, 3, 11);
|
|
1418
|
-
case 'GB':
|
|
1419
|
-
return applyGenericMask(digits, 4, 10);
|
|
1420
|
-
case 'CN':
|
|
1421
|
-
return applyGenericMask(digits, 3, 11);
|
|
1422
|
-
case 'JP':
|
|
1423
|
-
return applyGenericMask(digits, 3, 10);
|
|
1424
|
-
case 'IN':
|
|
1425
|
-
return applyGenericMask(digits, 5, 10);
|
|
1426
|
-
default:
|
|
1427
|
-
return digits;
|
|
1316
|
+
const ErrorRetry_logger = new codebit_web_namespaceObject.Logger('ErrorRetry');
|
|
1317
|
+
function ErrorRetry({ error, onRetry }) {
|
|
1318
|
+
if (error && error instanceof Error) {
|
|
1319
|
+
ErrorRetry_logger.error('Fail to load.', error);
|
|
1320
|
+
react_namespaceObject.captureException(error);
|
|
1428
1321
|
}
|
|
1322
|
+
const { getErrorMessage } = useErrorMessage();
|
|
1323
|
+
const { status, errorMessage, retryText, onRetryAction } = getErrorMessage(error);
|
|
1324
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
|
|
1325
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Result, {
|
|
1326
|
+
status: status,
|
|
1327
|
+
title: errorMessage,
|
|
1328
|
+
extra: [
|
|
1329
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1330
|
+
type: 'primary',
|
|
1331
|
+
onClick: onRetryAction ?? onRetry,
|
|
1332
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ReloadOutlined, {}),
|
|
1333
|
+
children: retryText
|
|
1334
|
+
}, 'retry')
|
|
1335
|
+
]
|
|
1336
|
+
})
|
|
1337
|
+
});
|
|
1429
1338
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
};
|
|
1444
|
-
const
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1339
|
+
ErrorRetry.propTypes = {
|
|
1340
|
+
error: external_prop_types_default().object.isRequired,
|
|
1341
|
+
onRetry: external_prop_types_default().func.isRequired
|
|
1342
|
+
};
|
|
1343
|
+
const ListCard_module = {
|
|
1344
|
+
listCard: "listCard-ISftFd",
|
|
1345
|
+
headerRow: "headerRow-UsZAzP",
|
|
1346
|
+
actions: "actions-ig53s2",
|
|
1347
|
+
filtersRow: "filtersRow-f3Xk5a",
|
|
1348
|
+
expandArea: "expandArea-czOoFS"
|
|
1349
|
+
};
|
|
1350
|
+
const { Title } = external_antd_namespaceObject.Typography;
|
|
1351
|
+
function ListCard({ title, onClearFilters, headerContainer, tableContainer, actions }) {
|
|
1352
|
+
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
1353
|
+
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd');
|
|
1354
|
+
const margin = token['margin'];
|
|
1355
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Card, {
|
|
1356
|
+
className: ListCard_module.listCard,
|
|
1357
|
+
children: [
|
|
1358
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Row, {
|
|
1359
|
+
gutter: margin,
|
|
1360
|
+
align: 'middle',
|
|
1361
|
+
className: ListCard_module.headerRow,
|
|
1362
|
+
children: [
|
|
1363
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Col, {
|
|
1364
|
+
xs: 24,
|
|
1365
|
+
sm: 24,
|
|
1366
|
+
md: 12,
|
|
1367
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(Title, {
|
|
1368
|
+
level: 4,
|
|
1369
|
+
children: title
|
|
1370
|
+
})
|
|
1371
|
+
}),
|
|
1372
|
+
(!!onClearFilters || !!actions) && /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Col, {
|
|
1373
|
+
xs: 24,
|
|
1374
|
+
sm: 24,
|
|
1375
|
+
md: 12,
|
|
1376
|
+
className: ListCard_module.actions,
|
|
1377
|
+
children: [
|
|
1378
|
+
!!onClearFilters && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1379
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ClearOutlined, {}),
|
|
1380
|
+
onClick: onClearFilters,
|
|
1381
|
+
children: t('ListCard.clearFilters')
|
|
1382
|
+
}),
|
|
1383
|
+
actions
|
|
1384
|
+
]
|
|
1385
|
+
})
|
|
1386
|
+
]
|
|
1387
|
+
}),
|
|
1388
|
+
!!headerContainer && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Row, {
|
|
1389
|
+
gutter: margin,
|
|
1390
|
+
className: ListCard_module.filtersRow,
|
|
1391
|
+
children: headerContainer
|
|
1392
|
+
}),
|
|
1393
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
|
|
1394
|
+
className: ListCard_module.expandArea,
|
|
1395
|
+
children: tableContainer
|
|
1396
|
+
})
|
|
1397
|
+
]
|
|
1450
1398
|
});
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1399
|
+
}
|
|
1400
|
+
ListCard.propTypes = {
|
|
1401
|
+
title: external_prop_types_default().string.isRequired,
|
|
1402
|
+
onClearFilters: external_prop_types_default().func,
|
|
1403
|
+
headerContainer: external_prop_types_default().node,
|
|
1404
|
+
tableContainer: external_prop_types_default().node,
|
|
1405
|
+
actions: external_prop_types_default().node
|
|
1406
|
+
};
|
|
1407
|
+
ListCard.defaultProps = {
|
|
1408
|
+
onClearFilters: null,
|
|
1409
|
+
headerContainer: null,
|
|
1410
|
+
tableContainer: null,
|
|
1411
|
+
actions: null
|
|
1412
|
+
};
|
|
1413
|
+
const CssTokenBridge = ({ containerId })=>{
|
|
1414
|
+
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
1415
|
+
(0, external_react_.useLayoutEffect)(()=>{
|
|
1416
|
+
const scopedContainer = containerId ? document.getElementById(containerId) : null;
|
|
1417
|
+
const targets = scopedContainer ? [
|
|
1418
|
+
document.documentElement,
|
|
1419
|
+
scopedContainer
|
|
1420
|
+
] : [
|
|
1421
|
+
document.documentElement
|
|
1422
|
+
];
|
|
1423
|
+
const setVar = (name, value)=>{
|
|
1424
|
+
for (const target of targets)target.style.setProperty(name, value);
|
|
1425
|
+
};
|
|
1426
|
+
setVar('--antd-color-bg-base', token['colorBgBase']);
|
|
1427
|
+
setVar('--antd-color-bg-container', token['colorBgContainer']);
|
|
1428
|
+
setVar('--antd-color-bg-elevated', token['colorBgElevated']);
|
|
1429
|
+
setVar('--antd-color-bg-layout', token['colorBgLayout']);
|
|
1430
|
+
setVar('--antd-color-bg-mask', token['colorBgMask']);
|
|
1431
|
+
setVar('--antd-color-bg-spotlight', token['colorBgSpotlight']);
|
|
1432
|
+
setVar('--antd-color-primary', token['colorPrimary']);
|
|
1433
|
+
setVar('--antd-color-success', token['colorSuccess']);
|
|
1434
|
+
setVar('--antd-color-success-bg', token['colorSuccessBg']);
|
|
1435
|
+
setVar('--antd-color-success-border', token['colorSuccessBorder']);
|
|
1436
|
+
setVar('--antd-color-success-text', token['colorSuccessText']);
|
|
1437
|
+
setVar('--antd-color-warning', token['colorWarning']);
|
|
1438
|
+
setVar('--antd-color-warning-bg', token['colorWarningBg']);
|
|
1439
|
+
setVar('--antd-color-warning-border', token['colorWarningBorder']);
|
|
1440
|
+
setVar('--antd-color-warning-text', token['colorWarningText']);
|
|
1441
|
+
setVar('--antd-color-error', token['colorError']);
|
|
1442
|
+
setVar('--antd-color-error-bg', token['colorErrorBg']);
|
|
1443
|
+
setVar('--antd-color-error-border', token['colorErrorBorder']);
|
|
1444
|
+
setVar('--antd-color-error-text', token['colorErrorText']);
|
|
1445
|
+
setVar('--antd-color-info', token['colorInfo']);
|
|
1446
|
+
setVar('--antd-color-info-bg', token['colorInfoBg']);
|
|
1447
|
+
setVar('--antd-color-info-border', token['colorInfoBorder']);
|
|
1448
|
+
setVar('--antd-color-info-text', token['colorInfoText']);
|
|
1449
|
+
setVar('--antd-color-text', token['colorText']);
|
|
1450
|
+
setVar('--antd-color-text-secondary', token['colorTextSecondary']);
|
|
1451
|
+
setVar('--antd-color-text-tertiary', token['colorTextTertiary']);
|
|
1452
|
+
setVar('--antd-color-text-quaternary', token['colorTextQuaternary']);
|
|
1453
|
+
setVar('--antd-color-text-disabled', token['colorTextDisabled']);
|
|
1454
|
+
setVar('--antd-color-border', token['colorBorder']);
|
|
1455
|
+
setVar('--antd-color-border-secondary', token['colorBorderSecondary']);
|
|
1456
|
+
setVar('--antd-color-border-hover', token['colorBorderHover']);
|
|
1457
|
+
setVar('--antd-color-border-disabled', token['colorBorderDisabled']);
|
|
1458
|
+
setVar('--antd-color-split', token['colorSplit']);
|
|
1459
|
+
setVar('--antd-color-link', token['colorLink']);
|
|
1460
|
+
setVar('--antd-color-link-hover', token['colorLinkHover']);
|
|
1461
|
+
setVar('--antd-color-link-active', token['colorLinkActive']);
|
|
1462
|
+
setVar('--antd-color-fill', token['colorFill']);
|
|
1463
|
+
setVar('--antd-color-fill-secondary', token['colorFillSecondary']);
|
|
1464
|
+
setVar('--antd-color-fill-tertiary', token['colorFillTertiary']);
|
|
1465
|
+
setVar('--antd-color-fill-quaternary', token['colorFillQuaternary']);
|
|
1466
|
+
setVar('--antd-color-fill-content', token['colorFillContent']);
|
|
1467
|
+
setVar('--antd-color-fill-content-hover', token['colorFillContentHover']);
|
|
1468
|
+
setVar('--antd-color-fill-content-selected', token['colorFillContentSelected']);
|
|
1469
|
+
setVar('--antd-color-fill-alter', token['colorFillAlter']);
|
|
1470
|
+
setVar('--antd-color-fill-alter-hover', token['colorFillAlterHover']);
|
|
1471
|
+
setVar('--antd-color-fill-alter-active', token['colorFillAlterActive']);
|
|
1472
|
+
setVar('--antd-color-fill-alter-selected', token['colorFillAlterSelected']);
|
|
1473
|
+
setVar('--antd-color-fill-alter-disabled', token['colorFillAlterDisabled']);
|
|
1474
|
+
setVar('--antd-color-white', token['colorWhite']);
|
|
1475
|
+
setVar('--antd-color-black', token['colorBlack']);
|
|
1476
|
+
setVar('--antd-margin-xxs', `${token['marginXXS']}px`);
|
|
1477
|
+
setVar('--antd-margin-xs', `${token['marginXS']}px`);
|
|
1478
|
+
setVar('--antd-margin-sm', `${token['marginSM']}px`);
|
|
1479
|
+
setVar('--antd-margin', `${token['margin']}px`);
|
|
1480
|
+
setVar('--antd-margin-md', `${token['marginMD']}px`);
|
|
1481
|
+
setVar('--antd-margin-lg', `${token['marginLG']}px`);
|
|
1482
|
+
setVar('--antd-margin-xl', `${token['marginXL']}px`);
|
|
1483
|
+
setVar('--antd-margin-xxl', `${token['marginXXL']}px`);
|
|
1484
|
+
setVar('--antd-padding-xxs', `${token['paddingXXS']}px`);
|
|
1485
|
+
setVar('--antd-padding-xs', `${token['paddingXS']}px`);
|
|
1486
|
+
setVar('--antd-padding-sm', `${token['paddingSM']}px`);
|
|
1487
|
+
setVar('--antd-padding', `${token['padding']}px`);
|
|
1488
|
+
setVar('--antd-padding-md', `${token['paddingMD']}px`);
|
|
1489
|
+
setVar('--antd-padding-lg', `${token['paddingLG']}px`);
|
|
1490
|
+
setVar('--antd-padding-xl', `${token['paddingXL']}px`);
|
|
1491
|
+
setVar('--antd-font-size-xxs', '8px');
|
|
1492
|
+
setVar('--antd-font-size-xs', '10px');
|
|
1493
|
+
setVar('--antd-font-size-sm', `${token['fontSizeSM']}px`);
|
|
1494
|
+
setVar('--antd-font-size', `${token['fontSize']}px`);
|
|
1495
|
+
setVar('--antd-font-size-lg', `${token['fontSizeLG']}px`);
|
|
1496
|
+
setVar('--antd-font-size-xl', `${token['fontSizeXL']}px`);
|
|
1497
|
+
setVar('--antd-font-size-xxl', `${token['fontSizeXXL']}px`);
|
|
1498
|
+
setVar('--antd-font-size-heading1', `${token['fontSizeHeading1']}px`);
|
|
1499
|
+
setVar('--antd-font-size-heading2', `${token['fontSizeHeading2']}px`);
|
|
1500
|
+
setVar('--antd-font-size-heading3', `${token['fontSizeHeading3']}px`);
|
|
1501
|
+
setVar('--antd-font-size-heading4', `${token['fontSizeHeading4']}px`);
|
|
1502
|
+
setVar('--antd-font-size-heading5', `${token['fontSizeHeading5']}px`);
|
|
1503
|
+
setVar('--antd-line-height-sm', token['lineHeightSM']);
|
|
1504
|
+
setVar('--antd-line-height', token['lineHeight']);
|
|
1505
|
+
setVar('--antd-line-height-lg', token['lineHeightLG']);
|
|
1506
|
+
setVar('--antd-control-height-xs', `${token['controlHeightXS']}px`);
|
|
1507
|
+
setVar('--antd-control-height-sm', `${token['controlHeightSM']}px`);
|
|
1508
|
+
setVar('--antd-control-height', `${token['controlHeight']}px`);
|
|
1509
|
+
setVar('--antd-control-height-lg', `${token['controlHeightLG']}px`);
|
|
1510
|
+
setVar('--antd-border-radius-sm', `${token['borderRadiusSM']}px`);
|
|
1511
|
+
setVar('--antd-border-radius', `${token['borderRadius']}px`);
|
|
1512
|
+
setVar('--antd-border-radius-lg', `${token['borderRadiusLG']}px`);
|
|
1513
|
+
setVar('--antd-shadow', token['boxShadow']);
|
|
1514
|
+
setVar('--antd-shadow-lg', token['boxShadowSecondary']);
|
|
1457
1515
|
}, [
|
|
1458
|
-
|
|
1516
|
+
containerId,
|
|
1517
|
+
token
|
|
1459
1518
|
]);
|
|
1460
|
-
|
|
1461
|
-
const country = COUNTRIES.find((c)=>c.code === countryCode) ?? COUNTRIES[0];
|
|
1462
|
-
setSelectedCountry(country);
|
|
1463
|
-
setDisplayValue('');
|
|
1464
|
-
onChange?.('');
|
|
1465
|
-
};
|
|
1466
|
-
const handleInputChange = (e)=>{
|
|
1467
|
-
const rawDigits = e.target.value.replaceAll(/\D/g, '').slice(0, selectedCountry.maxLocalDigits);
|
|
1468
|
-
setDisplayValue(applyMask(rawDigits, selectedCountry.code));
|
|
1469
|
-
onChange?.(selectedCountry.dialCode + rawDigits);
|
|
1470
|
-
};
|
|
1471
|
-
const countrySelector = /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Select, {
|
|
1472
|
-
value: selectedCountry.code,
|
|
1473
|
-
onChange: handleCountryChange,
|
|
1474
|
-
disabled: disabled,
|
|
1475
|
-
size: size,
|
|
1476
|
-
style: {
|
|
1477
|
-
width: 110
|
|
1478
|
-
},
|
|
1479
|
-
popupMatchSelectWidth: false,
|
|
1480
|
-
showSearch: true,
|
|
1481
|
-
filterOption: (input, option)=>option?.searchLabel?.toLowerCase().includes(input.toLowerCase()) ?? false,
|
|
1482
|
-
options: COUNTRIES.map((c)=>({
|
|
1483
|
-
value: c.code,
|
|
1484
|
-
label: `${c.flag} +${c.dialCode}`,
|
|
1485
|
-
searchLabel: countrySearchLabel(c)
|
|
1486
|
-
})),
|
|
1487
|
-
optionRender: (option)=>option.data.searchLabel
|
|
1488
|
-
});
|
|
1489
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Input, {
|
|
1490
|
-
addonBefore: countrySelector,
|
|
1491
|
-
value: displayValue,
|
|
1492
|
-
onChange: handleInputChange,
|
|
1493
|
-
disabled: disabled,
|
|
1494
|
-
size: size,
|
|
1495
|
-
placeholder: placeholder
|
|
1496
|
-
});
|
|
1519
|
+
return null;
|
|
1497
1520
|
};
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
onChange: external_prop_types_default().func,
|
|
1501
|
-
disabled: external_prop_types_default().bool,
|
|
1502
|
-
size: external_prop_types_default().oneOf([
|
|
1503
|
-
'large',
|
|
1504
|
-
'middle',
|
|
1505
|
-
'small'
|
|
1506
|
-
]),
|
|
1507
|
-
placeholder: external_prop_types_default().string
|
|
1521
|
+
CssTokenBridge.propTypes = {
|
|
1522
|
+
containerId: external_prop_types_default().string
|
|
1508
1523
|
};
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
const country = detectCountry(fullDigits);
|
|
1512
|
-
const localDigits = fullDigits.slice(country.dialCode.length);
|
|
1513
|
-
const masked = applyMask(localDigits, country.code);
|
|
1514
|
-
return `${country.flag} +${country.dialCode} ${masked}`;
|
|
1524
|
+
const TableContainer_module = {
|
|
1525
|
+
tableContainer: "tableContainer-EhNwOm"
|
|
1515
1526
|
};
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1527
|
+
function isPaginationNode(node) {
|
|
1528
|
+
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
1529
|
+
const element = node;
|
|
1530
|
+
return element.classList?.contains('ant-table-pagination') || element.querySelector?.('.ant-table-pagination');
|
|
1531
|
+
}
|
|
1532
|
+
function hasPaginationInMutation(mutation) {
|
|
1533
|
+
return Array.from(mutation.addedNodes).some(isPaginationNode);
|
|
1534
|
+
}
|
|
1535
|
+
function TableContainer({ children }) {
|
|
1536
|
+
const containerRef = (0, external_react_.useRef)(null);
|
|
1537
|
+
const containerHeightRef = (0, external_react_.useRef)(null);
|
|
1538
|
+
const [scrollY, setScrollY] = (0, external_react_.useState)(void 0);
|
|
1539
|
+
(0, external_react_.useLayoutEffect)(()=>{
|
|
1540
|
+
const calculateHeights = ()=>{
|
|
1541
|
+
if (!containerRef.current) return;
|
|
1542
|
+
containerHeightRef.current = containerRef.current.offsetHeight;
|
|
1543
|
+
const thead = containerRef.current.querySelector('thead');
|
|
1544
|
+
let theadHeight = 0;
|
|
1545
|
+
if (thead) {
|
|
1546
|
+
const rect = thead.getBoundingClientRect();
|
|
1547
|
+
const styles = globalThis.getComputedStyle(thead);
|
|
1548
|
+
const marginTop = Number.parseFloat(styles.marginTop) || 0;
|
|
1549
|
+
const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
|
|
1550
|
+
theadHeight = rect.height + marginTop + marginBottom;
|
|
1525
1551
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1552
|
+
const pagination = containerRef.current.querySelector('.ant-table-pagination');
|
|
1553
|
+
let paginationHeight = 0;
|
|
1554
|
+
if (pagination) {
|
|
1555
|
+
const rect = pagination.getBoundingClientRect();
|
|
1556
|
+
const styles = globalThis.getComputedStyle(pagination);
|
|
1557
|
+
const marginTop = Number.parseFloat(styles.marginTop) || 0;
|
|
1558
|
+
const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
|
|
1559
|
+
paginationHeight = rect.height + marginTop + marginBottom;
|
|
1560
|
+
}
|
|
1561
|
+
const availableHeight = Math.ceil(containerHeightRef.current) - Math.ceil(theadHeight) - Math.ceil(paginationHeight) - 1;
|
|
1562
|
+
setScrollY(availableHeight);
|
|
1563
|
+
};
|
|
1564
|
+
calculateHeights();
|
|
1565
|
+
const observer = new MutationObserver((mutations)=>{
|
|
1566
|
+
const hasPagination = mutations.some(hasPaginationInMutation);
|
|
1567
|
+
if (hasPagination) calculateHeights();
|
|
1568
|
+
});
|
|
1569
|
+
if (containerRef.current) observer.observe(containerRef.current, {
|
|
1570
|
+
childList: true,
|
|
1571
|
+
subtree: true
|
|
1572
|
+
});
|
|
1573
|
+
globalThis.addEventListener('resize', calculateHeights);
|
|
1574
|
+
return ()=>{
|
|
1575
|
+
observer.disconnect();
|
|
1576
|
+
globalThis.removeEventListener('resize', calculateHeights);
|
|
1577
|
+
};
|
|
1578
|
+
}, []);
|
|
1579
|
+
const enhancedChildren = scrollY ? /*#__PURE__*/ (0, external_react_.cloneElement)(children, {
|
|
1580
|
+
scroll: {
|
|
1581
|
+
...children.props?.scroll,
|
|
1582
|
+
y: scrollY,
|
|
1583
|
+
x: 'max-content'
|
|
1529
1584
|
}
|
|
1585
|
+
}) : children;
|
|
1586
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
|
|
1587
|
+
ref: containerRef,
|
|
1588
|
+
className: TableContainer_module.tableContainer,
|
|
1589
|
+
children: enhancedChildren
|
|
1530
1590
|
});
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
setIsDarkMode(mode);
|
|
1535
|
-
}
|
|
1536
|
-
}, [
|
|
1537
|
-
forcedTheme
|
|
1538
|
-
]);
|
|
1539
|
-
const toggleTheme = ()=>{
|
|
1540
|
-
setIsDarkMode((prev)=>!prev);
|
|
1541
|
-
};
|
|
1542
|
-
(0, external_react_.useEffect)(()=>{
|
|
1543
|
-
const target = document.getElementById(containerId);
|
|
1544
|
-
if (!target) return;
|
|
1545
|
-
if (isDarkMode) {
|
|
1546
|
-
document.documentElement.classList.add('dark-theme');
|
|
1547
|
-
target.classList.add('dark-theme');
|
|
1548
|
-
} else {
|
|
1549
|
-
document.documentElement.classList.remove('dark-theme');
|
|
1550
|
-
target.classList.remove('dark-theme');
|
|
1551
|
-
}
|
|
1552
|
-
document.documentElement.style.setProperty('--color-primary', isDarkMode ? '#589C75' : '#29D266');
|
|
1553
|
-
}, [
|
|
1554
|
-
isDarkMode,
|
|
1555
|
-
containerId
|
|
1556
|
-
]);
|
|
1557
|
-
(0, external_react_.useEffect)(()=>{
|
|
1558
|
-
if (hasLoaded.current && storeThemeInLocalStorage) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
|
|
1559
|
-
if (hasLoaded.current && storeThemeInLocalStorage && !forcedTheme) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
|
|
1560
|
-
}, [
|
|
1561
|
-
isDarkMode,
|
|
1562
|
-
storeThemeInLocalStorage,
|
|
1563
|
-
forcedTheme
|
|
1564
|
-
]);
|
|
1565
|
-
const themeContextValue = (0, external_react_.useMemo)(()=>({
|
|
1566
|
-
isDarkMode,
|
|
1567
|
-
toggleTheme,
|
|
1568
|
-
setIsDarkMode
|
|
1569
|
-
}), [
|
|
1570
|
-
isDarkMode
|
|
1571
|
-
]);
|
|
1572
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitThemeContext.Provider, {
|
|
1573
|
-
value: themeContextValue,
|
|
1574
|
-
children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.ConfigProvider, {
|
|
1575
|
-
theme: {
|
|
1576
|
-
algorithm: isDarkMode ? external_antd_namespaceObject.theme.darkAlgorithm : external_antd_namespaceObject.theme.defaultAlgorithm,
|
|
1577
|
-
token: {
|
|
1578
|
-
colorPrimary: isDarkMode ? '#589C75' : '#29D266',
|
|
1579
|
-
colorInfo: isDarkMode ? '#589C75' : '#29D266',
|
|
1580
|
-
colorLink: isDarkMode ? '#589C75' : '#29D266'
|
|
1581
|
-
},
|
|
1582
|
-
components: {
|
|
1583
|
-
Menu: {
|
|
1584
|
-
itemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
|
|
1585
|
-
itemSelectedColor: '#FAFAFA',
|
|
1586
|
-
darkItemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
|
|
1587
|
-
darkItemSelectedColor: '#FAFAFA'
|
|
1588
|
-
},
|
|
1589
|
-
Button: {
|
|
1590
|
-
colorPrimary: isDarkMode ? '#589C75' : '#29D266',
|
|
1591
|
-
colorPrimaryHover: isDarkMode ? '#6DB589' : '#3FE67F',
|
|
1592
|
-
colorPrimaryActive: isDarkMode ? '#4A8361' : '#1FBF4D'
|
|
1593
|
-
},
|
|
1594
|
-
Layout: {
|
|
1595
|
-
siderBg: isDarkMode ? '#1a1a1a' : '#001529',
|
|
1596
|
-
triggerBg: isDarkMode ? '#589C75' : '#29D266',
|
|
1597
|
-
triggerColor: '#FAFAFA'
|
|
1598
|
-
},
|
|
1599
|
-
Header: {
|
|
1600
|
-
colorPrimary: isDarkMode ? '#589C75' : '#29D266'
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
},
|
|
1604
|
-
...props,
|
|
1605
|
-
children: [
|
|
1606
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(CssTokenBridge, {
|
|
1607
|
-
containerId: containerId
|
|
1608
|
-
}),
|
|
1609
|
-
children
|
|
1610
|
-
]
|
|
1611
|
-
})
|
|
1612
|
-
});
|
|
1591
|
+
}
|
|
1592
|
+
TableContainer.propTypes = {
|
|
1593
|
+
children: external_prop_types_default().element.isRequired
|
|
1613
1594
|
};
|
|
1614
|
-
|
|
1595
|
+
function FilterContainer({ children, ...props }) {
|
|
1596
|
+
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
1597
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
|
|
1598
|
+
styles: {
|
|
1599
|
+
body: {
|
|
1600
|
+
padding: token['paddingXS'] + 'px'
|
|
1601
|
+
}
|
|
1602
|
+
},
|
|
1603
|
+
...props,
|
|
1604
|
+
children: children
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
FilterContainer.propTypes = {
|
|
1615
1608
|
children: external_prop_types_default().node.isRequired,
|
|
1616
|
-
|
|
1617
|
-
containerId: external_prop_types_default().string,
|
|
1618
|
-
forcedTheme: external_prop_types_default().oneOf([
|
|
1619
|
-
'dark',
|
|
1620
|
-
'light',
|
|
1621
|
-
null
|
|
1622
|
-
])
|
|
1609
|
+
...external_antd_namespaceObject.Card.propTypes
|
|
1623
1610
|
};
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
sider: "sider-BDy1Bs",
|
|
1630
|
-
siderLayout: "siderLayout-C8H0uI",
|
|
1631
|
-
secondarySidebar: "secondarySidebar-P6J_Xn",
|
|
1632
|
-
menu: "menu-KMvPt7",
|
|
1633
|
-
menuContainer: "menuContainer-ahnhBu",
|
|
1634
|
-
menuLabel: "menuLabel-csBJTc",
|
|
1635
|
-
menuDescription: "menuDescription-d6BFBO",
|
|
1636
|
-
menuSpacer: "menuSpacer-RIB3II",
|
|
1637
|
-
versionMenu: "versionMenu-NM4uyG",
|
|
1638
|
-
bottomMenu: "bottomMenu-VtOktS",
|
|
1639
|
-
header: "header-vgc67L",
|
|
1640
|
-
mobile: "mobile-mKGxb5",
|
|
1641
|
-
headerSpace: "headerSpace-Fd_iha",
|
|
1642
|
-
content: "content-OZHp2h"
|
|
1611
|
+
const external_date_fns_namespaceObject = require("date-fns");
|
|
1612
|
+
const AudioPlayer_module = {
|
|
1613
|
+
audioPlayer: "audioPlayer-a4xARM",
|
|
1614
|
+
durationTimeContainer: "durationTimeContainer-kmkK6M",
|
|
1615
|
+
slider: "slider-bdta4v"
|
|
1643
1616
|
};
|
|
1644
|
-
const
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
const [
|
|
1649
|
-
const [isMobile, setIsMobile] = (0, external_react_.useState)(false);
|
|
1650
|
-
const [drawerVisible, setDrawerVisible] = (0, external_react_.useState)(false);
|
|
1651
|
-
const [secondarySidebarDrawerVisible, setSecondarySidebarDrawerVisible] = (0, external_react_.useState)(false);
|
|
1617
|
+
const AudioPlayer = ({ audioUrl })=>{
|
|
1618
|
+
const [isMuted, setIsMuted] = (0, external_react_.useState)(false);
|
|
1619
|
+
const [duration, setDuration] = (0, external_react_.useState)(0);
|
|
1620
|
+
const [currentTime, setCurrentTime] = (0, external_react_.useState)(0);
|
|
1621
|
+
const [isPlaying, setIsPlaying] = (0, external_react_.useState)(false);
|
|
1652
1622
|
const { t } = useCodebitWebAntdTranslation();
|
|
1653
|
-
const
|
|
1654
|
-
const
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
const
|
|
1678
|
-
if (!
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1623
|
+
const audioRef = (0, external_react_.useRef)(null);
|
|
1624
|
+
const hasSource = !!audioUrl;
|
|
1625
|
+
const formatTime = (seconds)=>{
|
|
1626
|
+
const sec = Math.max(0, Math.floor(seconds));
|
|
1627
|
+
const date = (0, external_date_fns_namespaceObject.addSeconds)(new Date(0), sec);
|
|
1628
|
+
const h = Math.floor(sec / 3600);
|
|
1629
|
+
const timeFormat = h > 0 ? 'H:mm:ss' : 'm:ss';
|
|
1630
|
+
return (0, external_date_fns_namespaceObject.format)(date, timeFormat);
|
|
1631
|
+
};
|
|
1632
|
+
const togglePlay = async ()=>{
|
|
1633
|
+
if (!audioRef.current || !hasSource) return;
|
|
1634
|
+
if (audioRef.current.paused) {
|
|
1635
|
+
await audioRef.current.play();
|
|
1636
|
+
setIsPlaying(true);
|
|
1637
|
+
} else {
|
|
1638
|
+
audioRef.current.pause();
|
|
1639
|
+
setIsPlaying(false);
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
const toggleMute = ()=>{
|
|
1643
|
+
if (!audioRef.current) return;
|
|
1644
|
+
audioRef.current.muted = !audioRef.current.muted;
|
|
1645
|
+
setIsMuted(audioRef.current.muted);
|
|
1646
|
+
};
|
|
1647
|
+
const handleSliderChange = (value)=>{
|
|
1648
|
+
if (!audioRef.current) return;
|
|
1649
|
+
const safeValue = Math.min(Math.round(value), Math.round(duration));
|
|
1650
|
+
audioRef.current.currentTime = safeValue;
|
|
1651
|
+
setCurrentTime(safeValue);
|
|
1652
|
+
};
|
|
1653
|
+
(0, external_react_.useEffect)(()=>{
|
|
1654
|
+
if (audioRef.current && audioUrl) {
|
|
1655
|
+
audioRef.current.pause();
|
|
1656
|
+
audioRef.current.currentTime = 0;
|
|
1657
|
+
audioRef.current.src = audioUrl;
|
|
1658
|
+
audioRef.current.load();
|
|
1659
|
+
}
|
|
1660
|
+
setIsPlaying(false);
|
|
1661
|
+
setCurrentTime(0);
|
|
1662
|
+
setDuration(0);
|
|
1684
1663
|
}, [
|
|
1685
|
-
|
|
1686
|
-
user
|
|
1687
|
-
]);
|
|
1688
|
-
const memoizedBottomMenuItems = (0, external_react_.useMemo)(()=>[
|
|
1689
|
-
...filteredBottomMenuItems,
|
|
1690
|
-
{
|
|
1691
|
-
key: MENU_KEY_APP_LOGOUT,
|
|
1692
|
-
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.LogoutOutlined, {}),
|
|
1693
|
-
label: t('LoggedMainContainer.logout'),
|
|
1694
|
-
danger: true
|
|
1695
|
-
}
|
|
1696
|
-
], [
|
|
1697
|
-
filteredBottomMenuItems,
|
|
1698
|
-
t
|
|
1664
|
+
audioUrl
|
|
1699
1665
|
]);
|
|
1700
|
-
const
|
|
1666
|
+
const handleLoadedMetadata = ()=>{
|
|
1667
|
+
if (!audioRef.current) return;
|
|
1668
|
+
const audio = audioRef.current;
|
|
1669
|
+
if (audio.duration !== 1 / 0 && Number.isFinite(audio.duration)) {
|
|
1670
|
+
if (audio.duration > 0) setDuration(audio.duration);
|
|
1671
|
+
} else {
|
|
1672
|
+
audio.currentTime = 1e101;
|
|
1673
|
+
const timeUpdateHandler = ()=>{
|
|
1674
|
+
audio.removeEventListener('timeupdate', timeUpdateHandler);
|
|
1675
|
+
audio.currentTime = 0;
|
|
1676
|
+
setDuration(audio.duration || 0);
|
|
1677
|
+
};
|
|
1678
|
+
audio.addEventListener('timeupdate', timeUpdateHandler);
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
|
|
1682
|
+
className: AudioPlayer_module.audioPlayer,
|
|
1683
|
+
children: [
|
|
1684
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
|
|
1685
|
+
orientation: 'vertical',
|
|
1686
|
+
size: 'middle',
|
|
1687
|
+
children: [
|
|
1688
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
|
|
1689
|
+
align: 'center',
|
|
1690
|
+
children: [
|
|
1691
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1692
|
+
type: 'primary',
|
|
1693
|
+
shape: 'circle',
|
|
1694
|
+
icon: isPlaying ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.PauseCircleOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.PlayCircleOutlined, {}),
|
|
1695
|
+
onClick: togglePlay,
|
|
1696
|
+
disabled: !hasSource,
|
|
1697
|
+
title: isPlaying ? t('AudioPlayer.pause') : t('AudioPlayer.play'),
|
|
1698
|
+
"aria-label": isPlaying ? t('AudioPlayer.pauseAudio') : t('AudioPlayer.playAudio')
|
|
1699
|
+
}),
|
|
1700
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Slider, {
|
|
1701
|
+
min: 0,
|
|
1702
|
+
max: duration,
|
|
1703
|
+
value: currentTime,
|
|
1704
|
+
onChange: handleSliderChange,
|
|
1705
|
+
tooltip: {
|
|
1706
|
+
open: false
|
|
1707
|
+
},
|
|
1708
|
+
disabled: 0 === duration,
|
|
1709
|
+
className: AudioPlayer_module.slider
|
|
1710
|
+
}),
|
|
1711
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1712
|
+
shape: 'circle',
|
|
1713
|
+
icon: isMuted ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MutedOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.SoundOutlined, {}),
|
|
1714
|
+
onClick: toggleMute,
|
|
1715
|
+
disabled: !hasSource,
|
|
1716
|
+
title: isMuted ? t('AudioPlayer.unmute') : t('AudioPlayer.mute'),
|
|
1717
|
+
"aria-label": isMuted ? t('AudioPlayer.unmuteAudio') : t('AudioPlayer.muteAudio')
|
|
1718
|
+
})
|
|
1719
|
+
]
|
|
1720
|
+
}),
|
|
1721
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
|
|
1722
|
+
className: AudioPlayer_module.durationTimeContainer,
|
|
1723
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Text, {
|
|
1724
|
+
children: `${formatTime(currentTime)} / ${formatTime(duration)}`
|
|
1725
|
+
})
|
|
1726
|
+
})
|
|
1727
|
+
]
|
|
1728
|
+
}),
|
|
1729
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)("audio", {
|
|
1730
|
+
ref: audioRef,
|
|
1731
|
+
onTimeUpdate: (e)=>{
|
|
1732
|
+
if (!isPlaying) return;
|
|
1733
|
+
const audioElement = e.target;
|
|
1734
|
+
setCurrentTime(audioElement.currentTime);
|
|
1735
|
+
},
|
|
1736
|
+
onLoadedMetadata: handleLoadedMetadata,
|
|
1737
|
+
onEnded: ()=>{
|
|
1738
|
+
setIsPlaying(false);
|
|
1739
|
+
setCurrentTime(0);
|
|
1740
|
+
},
|
|
1741
|
+
onPlay: ()=>setIsPlaying(true),
|
|
1742
|
+
onPause: ()=>setIsPlaying(false),
|
|
1743
|
+
muted: isMuted,
|
|
1744
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)("track", {
|
|
1745
|
+
kind: 'captions'
|
|
1746
|
+
})
|
|
1747
|
+
})
|
|
1748
|
+
]
|
|
1749
|
+
});
|
|
1750
|
+
};
|
|
1751
|
+
AudioPlayer.propTypes = {
|
|
1752
|
+
audioUrl: external_prop_types_default().string.isRequired
|
|
1753
|
+
};
|
|
1754
|
+
const COUNTRIES = [
|
|
1755
|
+
{
|
|
1756
|
+
code: 'BR',
|
|
1757
|
+
dialCode: '55',
|
|
1758
|
+
flag: '🇧🇷',
|
|
1759
|
+
maxLocalDigits: 11
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
code: 'US',
|
|
1763
|
+
dialCode: '1',
|
|
1764
|
+
flag: '🇺🇸',
|
|
1765
|
+
maxLocalDigits: 10
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
code: 'CA',
|
|
1769
|
+
dialCode: '1',
|
|
1770
|
+
flag: '🇨🇦',
|
|
1771
|
+
maxLocalDigits: 10
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
code: 'MX',
|
|
1775
|
+
dialCode: '52',
|
|
1776
|
+
flag: '🇲🇽',
|
|
1777
|
+
maxLocalDigits: 10
|
|
1778
|
+
},
|
|
1779
|
+
{
|
|
1780
|
+
code: 'AR',
|
|
1781
|
+
dialCode: '54',
|
|
1782
|
+
flag: '🇦🇷',
|
|
1783
|
+
maxLocalDigits: 10
|
|
1784
|
+
},
|
|
1785
|
+
{
|
|
1786
|
+
code: 'CL',
|
|
1787
|
+
dialCode: '56',
|
|
1788
|
+
flag: '🇨🇱',
|
|
1789
|
+
maxLocalDigits: 9
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
code: 'CO',
|
|
1793
|
+
dialCode: '57',
|
|
1794
|
+
flag: '🇨🇴',
|
|
1795
|
+
maxLocalDigits: 10
|
|
1796
|
+
},
|
|
1797
|
+
{
|
|
1798
|
+
code: 'PE',
|
|
1799
|
+
dialCode: '51',
|
|
1800
|
+
flag: '🇵🇪',
|
|
1801
|
+
maxLocalDigits: 9
|
|
1802
|
+
},
|
|
1803
|
+
{
|
|
1804
|
+
code: 'VE',
|
|
1805
|
+
dialCode: '58',
|
|
1806
|
+
flag: '🇻🇪',
|
|
1807
|
+
maxLocalDigits: 10
|
|
1808
|
+
},
|
|
1809
|
+
{
|
|
1810
|
+
code: 'UY',
|
|
1811
|
+
dialCode: '598',
|
|
1812
|
+
flag: '🇺🇾',
|
|
1813
|
+
maxLocalDigits: 8
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
code: 'PY',
|
|
1817
|
+
dialCode: '595',
|
|
1818
|
+
flag: '🇵🇾',
|
|
1819
|
+
maxLocalDigits: 9
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
code: 'BO',
|
|
1823
|
+
dialCode: '591',
|
|
1824
|
+
flag: '🇧🇴',
|
|
1825
|
+
maxLocalDigits: 8
|
|
1826
|
+
},
|
|
1827
|
+
{
|
|
1828
|
+
code: 'PT',
|
|
1829
|
+
dialCode: '351',
|
|
1830
|
+
flag: '🇵🇹',
|
|
1831
|
+
maxLocalDigits: 9
|
|
1832
|
+
},
|
|
1833
|
+
{
|
|
1834
|
+
code: 'ES',
|
|
1835
|
+
dialCode: '34',
|
|
1836
|
+
flag: '🇪🇸',
|
|
1837
|
+
maxLocalDigits: 9
|
|
1838
|
+
},
|
|
1839
|
+
{
|
|
1840
|
+
code: 'IT',
|
|
1841
|
+
dialCode: '39',
|
|
1842
|
+
flag: '🇮🇹',
|
|
1843
|
+
maxLocalDigits: 10
|
|
1844
|
+
},
|
|
1845
|
+
{
|
|
1846
|
+
code: 'FR',
|
|
1847
|
+
dialCode: '33',
|
|
1848
|
+
flag: '🇫🇷',
|
|
1849
|
+
maxLocalDigits: 9
|
|
1850
|
+
},
|
|
1851
|
+
{
|
|
1852
|
+
code: 'DE',
|
|
1853
|
+
dialCode: '49',
|
|
1854
|
+
flag: '🇩🇪',
|
|
1855
|
+
maxLocalDigits: 11
|
|
1856
|
+
},
|
|
1857
|
+
{
|
|
1858
|
+
code: 'GB',
|
|
1859
|
+
dialCode: '44',
|
|
1860
|
+
flag: '🇬🇧',
|
|
1861
|
+
maxLocalDigits: 10
|
|
1862
|
+
},
|
|
1863
|
+
{
|
|
1864
|
+
code: 'AO',
|
|
1865
|
+
dialCode: '244',
|
|
1866
|
+
flag: '🇦🇴',
|
|
1867
|
+
maxLocalDigits: 9
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
code: 'MZ',
|
|
1871
|
+
dialCode: '258',
|
|
1872
|
+
flag: '🇲🇿',
|
|
1873
|
+
maxLocalDigits: 9
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
code: 'ZA',
|
|
1877
|
+
dialCode: '27',
|
|
1878
|
+
flag: '🇿🇦',
|
|
1879
|
+
maxLocalDigits: 9
|
|
1880
|
+
},
|
|
1881
|
+
{
|
|
1882
|
+
code: 'CN',
|
|
1883
|
+
dialCode: '86',
|
|
1884
|
+
flag: '🇨🇳',
|
|
1885
|
+
maxLocalDigits: 11
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
code: 'JP',
|
|
1889
|
+
dialCode: '81',
|
|
1890
|
+
flag: '🇯🇵',
|
|
1891
|
+
maxLocalDigits: 10
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
code: 'IN',
|
|
1895
|
+
dialCode: '91',
|
|
1896
|
+
flag: '🇮🇳',
|
|
1897
|
+
maxLocalDigits: 10
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
code: 'AU',
|
|
1901
|
+
dialCode: '61',
|
|
1902
|
+
flag: '🇦🇺',
|
|
1903
|
+
maxLocalDigits: 9
|
|
1904
|
+
}
|
|
1905
|
+
];
|
|
1906
|
+
function applyBrMask(digits) {
|
|
1907
|
+
if (digits.length <= 2) return `(${digits}`;
|
|
1908
|
+
if (digits.length <= 7) return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
|
|
1909
|
+
if (digits.length <= 10) return `(${digits.slice(0, 2)}) ${digits.slice(2, 6)}-${digits.slice(6)}`;
|
|
1910
|
+
return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7, 11)}`;
|
|
1911
|
+
}
|
|
1912
|
+
function applyUsMask(digits) {
|
|
1913
|
+
if (digits.length <= 3) return `(${digits}`;
|
|
1914
|
+
if (digits.length <= 6) return `(${digits.slice(0, 3)}) ${digits.slice(3)}`;
|
|
1915
|
+
return `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6, 10)}`;
|
|
1916
|
+
}
|
|
1917
|
+
function applyArMask(digits) {
|
|
1918
|
+
if (digits.length <= 2) return `(${digits}`;
|
|
1919
|
+
if (digits.length <= 6) return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
|
|
1920
|
+
return `(${digits.slice(0, 2)}) ${digits.slice(2, 6)}-${digits.slice(6, 10)}`;
|
|
1921
|
+
}
|
|
1922
|
+
function applyGenericMask(digits, areaLen, totalLen) {
|
|
1923
|
+
if (digits.length <= areaLen) return `(${digits}`;
|
|
1924
|
+
const area = digits.slice(0, areaLen);
|
|
1925
|
+
const rest = digits.slice(areaLen, totalLen);
|
|
1926
|
+
const mid = Math.floor(rest.length / 2 + rest.length % 2);
|
|
1927
|
+
if (rest.length <= mid) return `(${area}) ${rest}`;
|
|
1928
|
+
return `(${area}) ${rest.slice(0, mid)}-${rest.slice(mid)}`;
|
|
1929
|
+
}
|
|
1930
|
+
function applyMask(digits, countryCode) {
|
|
1931
|
+
switch(countryCode){
|
|
1932
|
+
case 'BR':
|
|
1933
|
+
return applyBrMask(digits);
|
|
1934
|
+
case 'US':
|
|
1935
|
+
case 'CA':
|
|
1936
|
+
return applyUsMask(digits);
|
|
1937
|
+
case 'MX':
|
|
1938
|
+
case 'CO':
|
|
1939
|
+
case 'VE':
|
|
1940
|
+
return applyGenericMask(digits, 2, 10);
|
|
1941
|
+
case 'AR':
|
|
1942
|
+
return applyArMask(digits);
|
|
1943
|
+
case 'CL':
|
|
1944
|
+
case 'PE':
|
|
1945
|
+
case 'PT':
|
|
1946
|
+
case 'ES':
|
|
1947
|
+
case 'AU':
|
|
1948
|
+
case 'ZA':
|
|
1949
|
+
case 'AO':
|
|
1950
|
+
case 'MZ':
|
|
1951
|
+
return applyGenericMask(digits, 2, 9);
|
|
1952
|
+
case 'UY':
|
|
1953
|
+
case 'BO':
|
|
1954
|
+
return applyGenericMask(digits, 1, 8);
|
|
1955
|
+
case 'PY':
|
|
1956
|
+
return applyGenericMask(digits, 3, 9);
|
|
1957
|
+
case 'FR':
|
|
1958
|
+
return applyGenericMask(digits, 2, 9);
|
|
1959
|
+
case 'IT':
|
|
1960
|
+
return applyGenericMask(digits, 3, 10);
|
|
1961
|
+
case 'DE':
|
|
1962
|
+
return applyGenericMask(digits, 3, 11);
|
|
1963
|
+
case 'GB':
|
|
1964
|
+
return applyGenericMask(digits, 4, 10);
|
|
1965
|
+
case 'CN':
|
|
1966
|
+
return applyGenericMask(digits, 3, 11);
|
|
1967
|
+
case 'JP':
|
|
1968
|
+
return applyGenericMask(digits, 3, 10);
|
|
1969
|
+
case 'IN':
|
|
1970
|
+
return applyGenericMask(digits, 5, 10);
|
|
1971
|
+
default:
|
|
1972
|
+
return digits;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
function detectCountry(fullDigits) {
|
|
1976
|
+
if (!fullDigits) return COUNTRIES[0];
|
|
1977
|
+
const sorted = [
|
|
1978
|
+
...COUNTRIES
|
|
1979
|
+
].sort((a, b)=>b.dialCode.length - a.dialCode.length);
|
|
1980
|
+
for (const c of sorted)if (fullDigits.startsWith(c.dialCode)) return c;
|
|
1981
|
+
return COUNTRIES[0];
|
|
1982
|
+
}
|
|
1983
|
+
const PhoneInput = ({ value, onChange, disabled, size, placeholder })=>{
|
|
1984
|
+
const { t } = useCodebitWebAntdTranslation();
|
|
1985
|
+
const countrySearchLabel = (c)=>{
|
|
1986
|
+
const name = t(`PhoneInput.countries.${c.code}`);
|
|
1987
|
+
return `${c.flag} ${name} +${c.dialCode}`;
|
|
1988
|
+
};
|
|
1989
|
+
const [selectedCountry, setSelectedCountry] = (0, external_react_.useState)(()=>detectCountry(value));
|
|
1990
|
+
const [displayValue, setDisplayValue] = (0, external_react_.useState)(()=>{
|
|
1991
|
+
if (!value) return '';
|
|
1992
|
+
const country = detectCountry(value);
|
|
1993
|
+
const localDigits = value.slice(country.dialCode.length);
|
|
1994
|
+
return applyMask(localDigits, country.code);
|
|
1995
|
+
});
|
|
1701
1996
|
(0, external_react_.useEffect)(()=>{
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
return match?.key ?? '';
|
|
1708
|
-
};
|
|
1709
|
-
setSelectedKeys(computeSelectedKey());
|
|
1710
|
-
}, [
|
|
1711
|
-
location.pathname,
|
|
1712
|
-
allMenuItems
|
|
1713
|
-
]);
|
|
1714
|
-
const handleLogout = (0, external_react_.useCallback)(async ()=>{
|
|
1715
|
-
await logout?.();
|
|
1716
|
-
if (isMobile) setDrawerVisible(false);
|
|
1717
|
-
navigate('/');
|
|
1718
|
-
}, [
|
|
1719
|
-
logout,
|
|
1720
|
-
isMobile,
|
|
1721
|
-
setDrawerVisible,
|
|
1722
|
-
navigate
|
|
1723
|
-
]);
|
|
1724
|
-
const handleMenuClick = (0, external_react_.useCallback)(async (key)=>{
|
|
1725
|
-
if (onMenuClick?.(key) === false) return;
|
|
1726
|
-
try {
|
|
1727
|
-
if (key === MENU_KEY_APP_LOGOUT) return void await handleLogout();
|
|
1728
|
-
navigate(key);
|
|
1729
|
-
} finally{
|
|
1730
|
-
if (isMobile) setDrawerVisible(false);
|
|
1731
|
-
}
|
|
1997
|
+
if (!value) return void setDisplayValue('');
|
|
1998
|
+
const country = detectCountry(value);
|
|
1999
|
+
setSelectedCountry(country);
|
|
2000
|
+
const localDigits = value.slice(country.dialCode.length);
|
|
2001
|
+
setDisplayValue(applyMask(localDigits, country.code));
|
|
1732
2002
|
}, [
|
|
1733
|
-
|
|
1734
|
-
handleLogout,
|
|
1735
|
-
navigate,
|
|
1736
|
-
isMobile,
|
|
1737
|
-
setDrawerVisible
|
|
1738
|
-
]);
|
|
1739
|
-
const primaryMenu = (0, external_react_.useMemo)(()=>/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
|
|
1740
|
-
theme: theme,
|
|
1741
|
-
mode: 'inline',
|
|
1742
|
-
selectedKeys: selectedKeys ? [
|
|
1743
|
-
selectedKeys
|
|
1744
|
-
] : [],
|
|
1745
|
-
onClick: ({ key })=>handleMenuClick(key),
|
|
1746
|
-
items: filteredMenuItems,
|
|
1747
|
-
className: LoggedMainContainer_module.menu
|
|
1748
|
-
}, 'primary-menu'), [
|
|
1749
|
-
selectedKeys,
|
|
1750
|
-
filteredMenuItems,
|
|
1751
|
-
theme,
|
|
1752
|
-
handleMenuClick
|
|
2003
|
+
value
|
|
1753
2004
|
]);
|
|
1754
|
-
|
|
1755
|
-
const
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
}, []);
|
|
1760
|
-
const menuContent = /*#__PURE__*/ (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
1761
|
-
children: [
|
|
1762
|
-
primaryMenu,
|
|
1763
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout.Content, {
|
|
1764
|
-
className: LoggedMainContainer_module.menuSpacer
|
|
1765
|
-
}),
|
|
1766
|
-
showVersion?.(user) && version && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
|
|
1767
|
-
motion: false,
|
|
1768
|
-
theme: theme,
|
|
1769
|
-
mode: 'horizontal',
|
|
1770
|
-
className: LoggedMainContainer_module.versionMenu,
|
|
1771
|
-
disabled: true,
|
|
1772
|
-
items: [
|
|
1773
|
-
{
|
|
1774
|
-
icon: collapsed ? version : `${t('LoggedMainContainer.version')}: ${version}`,
|
|
1775
|
-
title: ''
|
|
1776
|
-
}
|
|
1777
|
-
]
|
|
1778
|
-
}, 'version-menu'),
|
|
1779
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
|
|
1780
|
-
motion: false,
|
|
1781
|
-
theme: theme,
|
|
1782
|
-
mode: 'inline',
|
|
1783
|
-
selectedKeys: selectedKeys ? [
|
|
1784
|
-
selectedKeys
|
|
1785
|
-
] : [],
|
|
1786
|
-
onClick: ({ key })=>handleMenuClick(key),
|
|
1787
|
-
className: LoggedMainContainer_module.bottomMenu,
|
|
1788
|
-
items: memoizedBottomMenuItems
|
|
1789
|
-
}, 'bottom-menu')
|
|
1790
|
-
]
|
|
1791
|
-
});
|
|
1792
|
-
const renderMenuContent = ()=>{
|
|
1793
|
-
if (isMobile) return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
|
|
1794
|
-
placement: 'left',
|
|
1795
|
-
onClose: ()=>setDrawerVisible(false),
|
|
1796
|
-
open: drawerVisible,
|
|
1797
|
-
size: 250,
|
|
1798
|
-
className: LoggedMainContainer_module.drawer,
|
|
1799
|
-
classNames: {
|
|
1800
|
-
body: LoggedMainContainer_module.drawerBody
|
|
1801
|
-
},
|
|
1802
|
-
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Flex, {
|
|
1803
|
-
vertical: true,
|
|
1804
|
-
className: LoggedMainContainer_module.drawerFlex,
|
|
1805
|
-
children: menuContent
|
|
1806
|
-
})
|
|
1807
|
-
});
|
|
1808
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
|
|
1809
|
-
theme: theme,
|
|
1810
|
-
trigger: null,
|
|
1811
|
-
collapsible: true,
|
|
1812
|
-
collapsed: collapsed,
|
|
1813
|
-
breakpoint: 'lg',
|
|
1814
|
-
collapsedWidth: 80,
|
|
1815
|
-
className: LoggedMainContainer_module.sider,
|
|
1816
|
-
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
|
|
1817
|
-
className: LoggedMainContainer_module.siderLayout,
|
|
1818
|
-
children: menuContent
|
|
1819
|
-
})
|
|
1820
|
-
});
|
|
2005
|
+
const handleCountryChange = (countryCode)=>{
|
|
2006
|
+
const country = COUNTRIES.find((c)=>c.code === countryCode) ?? COUNTRIES[0];
|
|
2007
|
+
setSelectedCountry(country);
|
|
2008
|
+
setDisplayValue('');
|
|
2009
|
+
onChange?.('');
|
|
1821
2010
|
};
|
|
1822
|
-
const
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
onClose: ()=>setSecondarySidebarDrawerVisible(false),
|
|
1827
|
-
open: secondarySidebarDrawerVisible,
|
|
1828
|
-
size: 280,
|
|
1829
|
-
className: LoggedMainContainer_module.drawer,
|
|
1830
|
-
title: null,
|
|
1831
|
-
closeIcon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.CloseOutlined, {}),
|
|
1832
|
-
children: secondarySidebar(user)
|
|
1833
|
-
});
|
|
1834
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
|
|
1835
|
-
theme: theme,
|
|
1836
|
-
width: secondarySidebarWidth,
|
|
1837
|
-
children: secondarySidebar(user)
|
|
1838
|
-
});
|
|
2011
|
+
const handleInputChange = (e)=>{
|
|
2012
|
+
const rawDigits = e.target.value.replaceAll(/\D/g, '').slice(0, selectedCountry.maxLocalDigits);
|
|
2013
|
+
setDisplayValue(applyMask(rawDigits, selectedCountry.code));
|
|
2014
|
+
onChange?.(selectedCountry.dialCode + rawDigits);
|
|
1839
2015
|
};
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
icon: collapsed ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuUnfoldOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuFoldOutlined, {}),
|
|
1858
|
-
onClick: ()=>setCollapsed(!collapsed)
|
|
1859
|
-
})
|
|
1860
|
-
}),
|
|
1861
|
-
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
|
|
1862
|
-
size: isMobile ? 'small' : 'middle',
|
|
1863
|
-
className: `${LoggedMainContainer_module.headerSpace} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
1864
|
-
children: [
|
|
1865
|
-
secondarySidebar && isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1866
|
-
type: 'text',
|
|
1867
|
-
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.WechatOutlined, {}),
|
|
1868
|
-
onClick: ()=>setSecondarySidebarDrawerVisible(true)
|
|
1869
|
-
}),
|
|
1870
|
-
!isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
|
|
1871
|
-
children: t('LoggedMainContainer.theme')
|
|
1872
|
-
}),
|
|
1873
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(ThemeToggle, {})
|
|
1874
|
-
]
|
|
1875
|
-
})
|
|
1876
|
-
]
|
|
1877
|
-
}),
|
|
1878
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(Content, {
|
|
1879
|
-
className: `${LoggedMainContainer_module.content} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
1880
|
-
children: children
|
|
1881
|
-
})
|
|
1882
|
-
]
|
|
1883
|
-
})
|
|
1884
|
-
]
|
|
2016
|
+
const countrySelector = /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Select, {
|
|
2017
|
+
value: selectedCountry.code,
|
|
2018
|
+
onChange: handleCountryChange,
|
|
2019
|
+
disabled: disabled,
|
|
2020
|
+
size: size,
|
|
2021
|
+
style: {
|
|
2022
|
+
width: 110
|
|
2023
|
+
},
|
|
2024
|
+
popupMatchSelectWidth: false,
|
|
2025
|
+
showSearch: true,
|
|
2026
|
+
filterOption: (input, option)=>option?.searchLabel?.toLowerCase().includes(input.toLowerCase()) ?? false,
|
|
2027
|
+
options: COUNTRIES.map((c)=>({
|
|
2028
|
+
value: c.code,
|
|
2029
|
+
label: `${c.flag} +${c.dialCode}`,
|
|
2030
|
+
searchLabel: countrySearchLabel(c)
|
|
2031
|
+
})),
|
|
2032
|
+
optionRender: (option)=>option.data.searchLabel
|
|
1885
2033
|
});
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
2034
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Input, {
|
|
2035
|
+
addonBefore: countrySelector,
|
|
2036
|
+
value: displayValue,
|
|
2037
|
+
onChange: handleInputChange,
|
|
2038
|
+
disabled: disabled,
|
|
2039
|
+
size: size,
|
|
2040
|
+
placeholder: placeholder
|
|
2041
|
+
});
|
|
2042
|
+
};
|
|
2043
|
+
PhoneInput.propTypes = {
|
|
2044
|
+
value: external_prop_types_default().string,
|
|
2045
|
+
onChange: external_prop_types_default().func,
|
|
2046
|
+
disabled: external_prop_types_default().bool,
|
|
2047
|
+
size: external_prop_types_default().oneOf([
|
|
2048
|
+
'large',
|
|
2049
|
+
'middle',
|
|
2050
|
+
'small'
|
|
2051
|
+
]),
|
|
2052
|
+
placeholder: external_prop_types_default().string
|
|
2053
|
+
};
|
|
2054
|
+
PhoneInput.format = (fullDigits)=>{
|
|
2055
|
+
if (!fullDigits) return '';
|
|
2056
|
+
const country = detectCountry(fullDigits);
|
|
2057
|
+
const localDigits = fullDigits.slice(country.dialCode.length);
|
|
2058
|
+
const masked = applyMask(localDigits, country.code);
|
|
2059
|
+
return `${country.flag} +${country.dialCode} ${masked}`;
|
|
1889
2060
|
};
|
|
1890
2061
|
const Login_module = {
|
|
1891
2062
|
containerRow: "containerRow-lnjnDt",
|
|
@@ -2499,7 +2670,7 @@ var __webpack_exports__ = {};
|
|
|
2499
2670
|
hasUpperCase: /[A-Z]/.test(value),
|
|
2500
2671
|
hasLowerCase: /[a-z]/.test(value),
|
|
2501
2672
|
hasNumbers: /\d/.test(value),
|
|
2502
|
-
hasSpecialChars: /[
|
|
2673
|
+
hasSpecialChars: /[^a-zA-Z0-9\s]/.test(value)
|
|
2503
2674
|
};
|
|
2504
2675
|
const failedChecks = Object.entries(strengthChecks).filter(([, passes])=>!passes).map(([key])=>key);
|
|
2505
2676
|
if (0 === failedChecks.length) return Promise.resolve();
|
|
@@ -2688,6 +2859,7 @@ exports.OllamaOutlinedIcon = __webpack_exports__.OllamaOutlinedIcon;
|
|
|
2688
2859
|
exports.PhoneInput = __webpack_exports__.PhoneInput;
|
|
2689
2860
|
exports.TableContainer = __webpack_exports__.TableContainer;
|
|
2690
2861
|
exports.ThemeToggle = __webpack_exports__.ThemeToggle;
|
|
2862
|
+
exports.UserMenu = __webpack_exports__.UserMenu;
|
|
2691
2863
|
exports.useErrorMessage = __webpack_exports__.useErrorMessage;
|
|
2692
2864
|
exports.useErrorModal = __webpack_exports__.useErrorModal;
|
|
2693
2865
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -2715,6 +2887,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
2715
2887
|
"PhoneInput",
|
|
2716
2888
|
"TableContainer",
|
|
2717
2889
|
"ThemeToggle",
|
|
2890
|
+
"UserMenu",
|
|
2718
2891
|
"useErrorMessage",
|
|
2719
2892
|
"useErrorModal"
|
|
2720
2893
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|